How to obtain all finite connected distributive lattices with SAGE
In https://ask.sagemath.org/question/388... I asked for a programm that translates all finite posets into a given form. Now I want to do the same with all finite connected distributive lattices instead of all connected posets.
First I wanted it with all lattices, I changed the code posets = [ p for p in Posets(n) if p.is_connected() ] into posets = [ p for p in Posets(n) if p.is_connected() and p.is_lattice]
This worked for me. But if I try to obtain now in addition all distributive lattices via the command is_distributive() (found here: http://doc.sagemath.org/html/en/refer...) I get an error when I try into posets = [ p for p in Posets(n) if p.is_connected() and p.is_lattice() and p.is_distributive()]. How to fix that?
And is there a way to obtain all connected finite posets with n points having a global maximum and a global minimum?
Another question: I want to use the SAGE output of this to define a list in GAP. The problem is that I cannot directly copy paste since GAP allows me to define a list only in case the list occupies only one line. (for example [ [["x1", "x2", "x3"], [["x1", "x2"], ["x1", "x3"]] ],
[["x1", "x2", "x3"], [["x1", "x2"], ["x2", "x3"]]],
[["x1", "x2", "x3"], [["x1", "x3"], ["x2", "x3"]]]]
is not ok for GAP but [ [["x1", "x2", "x3"], [["x1", "x2"], ["x1", "x3"]] ], [["x1", "x2", "x3"], [["x1", "x2"], ["x2", "x3"]]], [["x1", "x2", "x3"], [["x1", "x3"], ["x2", "x3"]]]] is ok when it is in one line). Is there a way to obtain the SAGE output in one line or is there a textmanager that can do such a thing? (this is a problem in case the SAGE output is very long)
edit: For my second problem I found the website https://www.textfixer.com/tools/remov... to remove line breaks in text. I wonder if there is a basic way using texteditors without the internet.
You could try to start from the list of posets and take their .order_ideals_lattice()
You can just save your text (say the variable txt) using
Good idea to use order ideals but why does the command is_distributive() not work? Maybe I can get all lattices directly without filtering and then the command works?
For the second problem, if
mrepresents your data,str(m)orprint(m)should give you the output with no line breaks. Justmtries to present the output in a more readable format.