Obtaining a simplicial complex associated to a poset with the help of Sage
I want to associate to a finite poset a simplicial complex Δ(P) and study the homology(with coefficients in the rational numbers or a finite field) and the topological type of this simplicial complex using Sage. I have not yet used sage for this and wanted to ask whether there is an easy method to do this.
Let P be a a finite poset with at least two elements and for p∈P define two subsets as follows:
J(p):= { g∈P|p≰g } and I(p):= { g∈P|g≤p }.
For a subset S of P (we view P also as set of its vertices) we then define
J(S):=⋂p∈SJ(p) and I(S):=⋃p∈SI(p).
We set J(∅)=P,J(P)=∅ and I(∅)=∅, I(P)=P.
Then the simplicial complex Δ(P) is defined as the set of all subsets S⊆P with J(Sc)⊆I(Sc), where fore a subset S⊆P we denote by Sc the complement of S in P.
For example when the poset P is a chain with n-elements then Δ(P) should have topological type of the (n−2)-sphere.
I can obtain the sets J(p) and I(p) for elements but not for subsets in Sage, but I would think there is an easy trick.
Here is an example in Sage for a given poset P :
P=posets.BooleanLattice(2)
display(P)
p=P[2]
I=[u for u in P if P.is_lequal(u,p)]
J=[u for u in P if not P.is_lequal(p,u)]
display(I)
display(J)
Thanks for any help.
Please add the code you have so far, with an example P.
I added a small example for the Boolean lattice on how to obtain J(p) and I(p).