ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 10 Jan 2018 09:58:18 +0100Obtaining a certain list of posets via SAGEhttps://ask.sagemath.org/question/40517/obtaining-a-certain-list-of-posets-via-sage/I want to apply a function to a list of posets with certain properties.
Question : I want the set of all finite poset with a top and buttom that are not lattices and do not have a subposet isomorphic to the diamond poset or the pentagon poset (here pictures of the two lattices: http://i.stack.imgur.com/zC30M.png ). The part without the diamong and pentagon condition should be easy to obtain as follows:
[format_poset(P) for P in posets(n) if P.has_bottom() and P.has_top() and not P.is_lattice()]
But I do not know how to tell SAGE the pentagon and diamond condition.
I asked a similar question as this before but now it is not so much about time and it is ok if it works only for posets with at most 8 or 9 points. In general, it would also be interesting to check for a given connected poset whether it has a diamond or pentagon lattice as a subposet. Is there an easy way to do this with SAGE?Sun, 07 Jan 2018 13:02:01 +0100https://ask.sagemath.org/question/40517/obtaining-a-certain-list-of-posets-via-sage/Comment by jipilab for <p>I want to apply a function to a list of posets with certain properties.</p>
<p>Question : I want the set of all finite poset with a top and buttom that are not lattices and do not have a subposet isomorphic to the diamond poset or the pentagon poset (here pictures of the two lattices: <a href="http://i.stack.imgur.com/zC30M.png">http://i.stack.imgur.com/zC30M.png</a> ). The part without the diamong and pentagon condition should be easy to obtain as follows:</p>
<p>[format_poset(P) for P in posets(n) if P.has_bottom() and P.has_top() and not P.is_lattice()]
But I do not know how to tell SAGE the pentagon and diamond condition.</p>
<p>I asked a similar question as this before but now it is not so much about time and it is ok if it works only for posets with at most 8 or 9 points. In general, it would also be interesting to check for a given connected poset whether it has a diamond or pentagon lattice as a subposet. Is there an easy way to do this with SAGE?</p>
https://ask.sagemath.org/question/40517/obtaining-a-certain-list-of-posets-via-sage/?comment=40546#post-id-40546Since what you are looking for are exactly distributive lattices, perhaps it would be good to change the title of the question to indicate that this is what is looked for. Something like "Obtaining distributive lattices from a list of posets via SAGE"Wed, 10 Jan 2018 09:58:18 +0100https://ask.sagemath.org/question/40517/obtaining-a-certain-list-of-posets-via-sage/?comment=40546#post-id-40546Answer by dan_fulea for <p>I want to apply a function to a list of posets with certain properties.</p>
<p>Question : I want the set of all finite poset with a top and buttom that are not lattices and do not have a subposet isomorphic to the diamond poset or the pentagon poset (here pictures of the two lattices: <a href="http://i.stack.imgur.com/zC30M.png">http://i.stack.imgur.com/zC30M.png</a> ). The part without the diamong and pentagon condition should be easy to obtain as follows:</p>
<p>[format_poset(P) for P in posets(n) if P.has_bottom() and P.has_top() and not P.is_lattice()]
But I do not know how to tell SAGE the pentagon and diamond condition.</p>
<p>I asked a similar question as this before but now it is not so much about time and it is ok if it works only for posets with at most 8 or 9 points. In general, it would also be interesting to check for a given connected poset whether it has a diamond or pentagon lattice as a subposet. Is there an easy way to do this with SAGE?</p>
https://ask.sagemath.org/question/40517/obtaining-a-certain-list-of-posets-via-sage/?answer=40518#post-id-40518For a poset `p` we can simply ask for:
M3 = Posets.DiamondPoset(5)
N5 = Posets.PentagonPoset()
p.has_isomorphic_subposet(M3)
p.has_isomorphic_subposet(N5)
1.st example:
p = Poset( { 0 : [10,11],
10 : [20,21],
11 : [20,21],
20 : [3],
21 : [3],
3 : [], })
p.show()
p.has_bottom()
p.has_top()
p.has_isomorphic_subposet(M3)
p.has_isomorphic_subposet(N5)
We obtain:
True
True
False
False
2.nd example:
q = Poset( { 0 : [10,11],
10 : [20,21],
11 : [20,21],
20 : [4],
21 : [3],
3 : [4],
4 : [], })
q.show()
q.has_bottom()
q.has_top()
q.has_isomorphic_subposet(M3)
q.has_isomorphic_subposet(N5)
This time:
True
True
False
True
3.rd example:
r = Posets.DiamondPoset(6).star_product( Posets.ChainPoset(4) )
r.has_isomorphic_subposet(M3)
r.has_isomorphic_subposet(N5)
and of course we get
True
False
Sun, 07 Jan 2018 14:02:33 +0100https://ask.sagemath.org/question/40517/obtaining-a-certain-list-of-posets-via-sage/?answer=40518#post-id-40518Comment by sagequstions for <p>For a poset <code>p</code> we can simply ask for:</p>
<pre><code>M3 = Posets.DiamondPoset(5)
N5 = Posets.PentagonPoset()
p.has_isomorphic_subposet(M3)
p.has_isomorphic_subposet(N5)
</code></pre>
<p>1.st example:</p>
<pre><code>p = Poset( { 0 : [10,11],
10 : [20,21],
11 : [20,21],
20 : [3],
21 : [3],
3 : [], })
p.show()
p.has_bottom()
p.has_top()
p.has_isomorphic_subposet(M3)
p.has_isomorphic_subposet(N5)
</code></pre>
<p>We obtain:</p>
<pre><code>True
True
False
False
</code></pre>
<p>2.nd example:</p>
<pre><code>q = Poset( { 0 : [10,11],
10 : [20,21],
11 : [20,21],
20 : [4],
21 : [3],
3 : [4],
4 : [], })
q.show()
q.has_bottom()
q.has_top()
q.has_isomorphic_subposet(M3)
q.has_isomorphic_subposet(N5)
</code></pre>
<p>This time:</p>
<pre><code>True
True
False
True
</code></pre>
<p>3.rd example:</p>
<pre><code>r = Posets.DiamondPoset(6).star_product( Posets.ChainPoset(4) )
r.has_isomorphic_subposet(M3)
r.has_isomorphic_subposet(N5)
</code></pre>
<p>and of course we get</p>
<pre><code>True
False
</code></pre>
https://ask.sagemath.org/question/40517/obtaining-a-certain-list-of-posets-via-sage/?comment=40519#post-id-40519Thank you very much. So in my case [format_poset(P) for P in posets(n) if P.has_bottom() and P.has_top() and not P.is_lattice() and not P.has_isomorphic_subposet(M3) and not P.has_isomorphic_subposet(N5)] should work. I think it does! (hope my usage of "not" is correct, since I just guessed that this does what I want and I didnt found it somewhere).Sun, 07 Jan 2018 14:15:35 +0100https://ask.sagemath.org/question/40517/obtaining-a-certain-list-of-posets-via-sage/?comment=40519#post-id-40519