sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.4k stars 473 forks source link

LatticePoset: add is_vertically_decomposable #19123

Closed f29946bc-ee7b-48cd-9abc-3445948c551d closed 8 years ago

f29946bc-ee7b-48cd-9abc-3445948c551d commented 9 years ago

This patch adds a function is_vertically_decomposable to finite lattices.

For testing see https://oeis.org/A058800 ; for example

sum([1 for L in Posets(6) if L.is_lattice() and
 not LatticePoset(L).is_vertically_decomposable()])

returns 7 as it should.

There is a place for possible optimization: If there is, say, covering relations bottom -> 5, 3 -> 8 and 7 -> top, is suffices to show that the lattice is not vertically decomposable. This might be faster on average. Now the complexity is linear to number of covering relations.

CC: @nathanncohen @tscrim @kevindilks

Component: combinatorics

Author: Jori Mäntysalo

Branch/Commit: bf4d108

Reviewer: Kevin Dilks

Issue created by migration from https://trac.sagemath.org/ticket/19123

f29946bc-ee7b-48cd-9abc-3445948c551d commented 9 years ago
comment:38

Merged. Sorry for wrong term.

f29946bc-ee7b-48cd-9abc-3445948c551d commented 9 years ago
comment:39

Kevin, if you are interested in docs, you might want to review this. It does some polishing together with adding little new functionality.

1adc0eef-8957-46d9-975b-2dd71dfbd9ba commented 9 years ago
comment:40

I still think that formal definitions should come first, without being labelled as formal definitions, and then informal definitions can come after.

1adc0eef-8957-46d9-975b-2dd71dfbd9ba commented 9 years ago
comment:41

I'm not sure if I like the backend code living in hasse_diagram.py. Even if the code applies to more than lattices, you seem to still be making assumptions about the poset being bounded. Plus the initial docstring there is written in a way that implies it only works for lattices.

f29946bc-ee7b-48cd-9abc-3445948c551d commented 9 years ago
comment:42

Replying to @kevindilks:

I still think that formal definitions should come first, without being labelled as formal definitions, and then informal definitions can come after.

OK, I can change that.

Replying to @kevindilks:

I'm not sure if I like the backend code living in hasse_diagram.py. Even if the code applies to more than lattices, you seem to still be making assumptions about the poset being bounded. Plus the initial docstring there is written in a way that implies it only works for lattices.

I think that all code in hasse_diagram.py is "internal", i.e. it is user's fault if something break for direct call to it.

If this is not in hasse_diagram.py, then I guess it must be copied if I want to optimize frattini_sublattice() with it. Or linear_extensions_number() maybe?

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

b408d0cChange order of formal and informal definition.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 1356d17 to b408d0c

f29946bc-ee7b-48cd-9abc-3445948c551d commented 9 years ago
comment:44

Better docstring now?

If this seems hard one to decide, then I can split the (non-relating) part that rearranges the index of functions.

f29946bc-ee7b-48cd-9abc-3445948c551d commented 8 years ago
comment:45

ping -c 1 Kevin. This could be nice to have before #18511, as this modifies the index of function.

(Funny. I have a poset of dependencies between poset-related tickets.)

f29946bc-ee7b-48cd-9abc-3445948c551d commented 8 years ago
comment:46

Replying to @nathanncohen:

Also, why is it only defined for lattices? The algorithm works in all cases.

Here is a kind of followup: #19659. I think that it is most natural generalization to all posets.

f29946bc-ee7b-48cd-9abc-3445948c551d commented 8 years ago
comment:47

Documentation part (i.e. index of functions) done in #19854, so this one needs work.

Also this should be thinked about. There is also #19659 waiting, and in principle it is same thing as this one; a poset that is also a lattice can be expressed as an ordinal sum of two posets only if it vertically decomposable. At least http://users.cecs.anu.edu.au/~bdm/papers/posets.pdf by Brinkmann and McKay uses term "vertically decomposable" with non-lattice posets.

(Actually after #19659 it is easy to make a simple function for #19215, and then use it as a "precompiler" for #14126. But that's another story.)

fchapoton commented 8 years ago

New commits:

0ee8b96Merge branch 'u/jmantysalo/vertically_decomposable2' into 7.1.rc0
fchapoton commented 8 years ago

Changed commit from b408d0c to 0ee8b96

fchapoton commented 8 years ago

Changed branch from u/jmantysalo/vertically_decomposable2 to public/19123

1adc0eef-8957-46d9-975b-2dd71dfbd9ba commented 8 years ago
comment:49

Minor grammatical corrections:

Besides that, I think I'm happy with it. I'll just need to check the rendered documentation once those changes are made.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from 0ee8b96 to bf4d108

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

bf4d108Docstring corrections.
f29946bc-ee7b-48cd-9abc-3445948c551d commented 8 years ago
comment:51

Replying to @kevindilks:

Minor grammatical corrections:

Thanks! Done those.

  • 'Informally said, this returns the lattice SPLIT INTO parts AT every single-element "cutting point".'

These are hard ones... In Finnish 'hila'='lattice', 'hilassani'='in my lattice' etc.

1adc0eef-8957-46d9-975b-2dd71dfbd9ba commented 8 years ago

Reviewer: Kevin Dilks

vbraun commented 8 years ago

Changed branch from public/19123 to bf4d108