# Poset of intervals of a poset up to isomorphism

Let P be a finite poset.

Is there an easy way to obtain the poset U(P) of intervals of P up to isomorphism?

So the elements of U(P) are the intervals of P up to isomorphism and x<=y in U(P) if x is isomorphic to an interval of y.

For example if P is the lattice of divisors of the number 12, then U(P) contains 5 elements. Namely the poset with 1 element, the chain with 2 elements, the chain with 3 elements, the Boolean lattice of a 2-set and the poset P itself. U(P) is isomorphic to the Boolean lattice of a 2-set with a minimum appended.

edit retag close merge delete

Sort by » oldest newest most voted

Like this for just the set of isoclasses.

def iso(P):
D = {}
for x, y in P.relations():
Q = P.subposet(P.interval(x, y))
dp = Q.degree_polynomial()
if dp not in D:
D[dp] = []
if not any(Q.is_isomorphic(R) for R in D[dp]):
D[dp].append(Q)
return D


then

sage: P = posets.PentagonPoset()
sage: iso(P)
{1: [Finite poset containing 1 elements],
x + y: [Finite poset containing 2 elements],
x^2 + 3*x*y + y^2: [Finite poset containing 5 elements],
x*y + x + y: [Finite poset containing 3 elements]}

more

Just a minor note: if dp not in D: D[dp] = [] can be replaced with D.setdefault(dp,[])

( 2024-05-06 22:20:18 +0200 )edit

Thanks. I am not so familiar with Sage, but is there an easy way to just obtain the posets as an output and not those polynomials? I tried something like [r[1] for r in list(iso(P))], but it seems to not work. I noted that there is the command has_isomorphic_subposet, which might then be used to define the right order on iso(P).

( 2024-05-07 00:37:31 +0200 )edit

Instead of [r[1] for r in list(iso(P))] use list(iso(P).values()). I suggest you to learn about basic Python structures such as dict- e.g. at https://greenteapress.com/thinkpython...

( 2024-05-07 02:18:05 +0200 )edit

Thank you. I will buy that book.

( 2024-05-07 10:34:44 +0200 )edit

Here my attempt so far using the program suggested in the answer of FrédéricC: There seems to be a probem with the program fcn. Maybe it is because list(iso(P).values()) gives lists of posets instead of posets as an output? I will try to fix this error, but maybe someone sees my mistake already.

def iso(P):
D = {}
for x, y in P.relations():
Q = P.subposet(P.interval(x, y))
dp = Q.degree_polynomial()
if dp not in D:
D[dp] = []
if not any(Q.is_isomorphic(R) for R in D[dp]):
D[dp].append(Q)
return D

def fcn(A, B):
if B.has_isomorphic_subposet(A):
return True
if not B.has_isomorphic_subposet(A):
return False

def isoposet(P):
U=list(iso(P).values())
UU=Poset((U,fcn), cover_relations=True)
return(UU)

P = posets.PentagonPoset()
U=isoposet(P)

more

Like that maybe

def isoposet(P):
U = [po for liste in iso(P).values() for po in liste]
UU = Poset((U,fcn), cover_relations=False)
return UU

( 2024-05-07 11:23:59 +0200 )edit

and your "fcn" is much too complicated, it could be written in one line..

( 2024-05-07 11:33:37 +0200 )edit

Thanks. I also noted that it is still not quite what I wanted since I wanted x<=y if x is isomorphic to a subposet given by an interval of y. So the result of this code for the example posets.DivisorLattice(12) gives a chain instead of the result I intended as in the entry post. I will think about how to modify the fcn to do the right thing.

( 2024-05-07 11:55:02 +0200 )edit

Perhaps you want sum(iso(P).values(), []).

( 2024-05-07 13:02:07 +0200 )edit