Ask Your Question
0

Obtaining the poset of subsets

asked 2 years ago

klaaa gravatar image

updated 2 years ago

Let G be a set of subsets of a set with n elements. Here a (stupid) example:

p=5
S = Subsets([1,..,p])
G=[t for t in S if sum(t)==p]
display(S)
display(G)

My question is how do I obtain the set G as a poset in Sage? Thanks for any help.

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
1

answered 2 years ago

Max Alekseyev gravatar image

updated 2 years ago

I assume you want to construct boolean lattice. If so, it's defined in Sage's Catalog of posets and lattices:

posets.BooleanLattice(p, use_subsets=True)

ADDED. A subposet can be constructed as

p=5
B = posets.BooleanLattice(p, use_subsets=True)
B.subposet(t for t in B if sum(t)==p)
Preview: (hide)
link

Comments

Thanks, but I actually want the subposet of the whole Boolean lattice consisting of a certain subsets of all subsets. See the example where I want the subset G as a subposet of the Boolean lattice.

klaaa gravatar imageklaaa ( 2 years ago )

Then you can use .subposet() method to obtain that of boolean lattice.

Max Alekseyev gravatar imageMax Alekseyev ( 2 years ago )
0

answered 2 years ago

FrédéricC gravatar image

Like this

sage: S = Subsets([1,..,5])
sage: G = [t for t in S if sum(t)<=3]
sage: Poset((G, lambda x,y: x.issubset(y)))
Finite poset containing 5 elements

And I am slightly tempted to say RTFM.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2 years ago

Seen: 266 times

Last updated: May 09 '23