Skip to main content

Exercises 19.9 Sage Exercises


Use R = Posets.RandomPoset(30,0.05) to construct a random poset. Use R.plot() to get an idea of what you have built.

  1. Illustrate the use of the poset methods: .is_lequal(), .is_less_than(), .is_gequal(), and .is_greater_than() to determine if two specific elements (of your choice) are related or incomparable.

  2. Use .minimal_elements() and .maximal_elements() to find the smallest and largest elements of your poset.

  3. Use LatticePoset(R) to see if the poset R is a lattice by attempting to convert it into a lattice.

  4. Find a linear extension of your poset. Confirm that any pair of elements that are comparable in the poset will be similarly comparable in the linear extension.


Construct the poset on the positive divisors of \(72=2^3\cdot 3^2\) with divisiblity as the relation, and then convert to a lattice.

  1. Determine the one and zero element using .top() and .bottom().

  2. Determine all the pairs of elements of the lattice that are complements of each other without using the .complement() method, but rather just use the .meet() and .join() methods. Extra credit if you can output each pair just once.

  3. Determine if the lattice is distributive using just the .meet() and .join() methods, and not the .is_distributive() method.


Construct several specific diamond lattices with Posets.DiamondPoset(n) by varying the value of n. Once you feel you have enough empirical evidence, give answers, with justifications, to the following questions for general values of \(n\text{,}\) based on observations obtained from your experiments with Sage.

  1. Which elements have complements and which do not, and why?

  2. Read the documentation of the .antichains() method to learn what an antichain is. How many antichains are there?

  3. Is the lattice distributive?


Use Posets.BooleanLattice(4) to construct an instance of the prototypical Boolean algebra on \(16\) elements (i.e., all subsets of a \(4\)-set).

Then use Posets.IntegerCompositions(5) to construct the poset whose \(16\) elements are the compositions of the integer \(5\text{.}\) We have seen above that the integer composition lattice is distributive and complemented, making it a Boolean algebra. And by Theorem 19.23 we can conclude that these two Boolean algebras are isomorphic.

Use the .plot() method to see the similarity visually. Then use the method .hasse_diagram() on each poset to obtain a directed graph (which you can also plot, though the embedding into the plane may not be as informative). Employ the graph method .is_isomorphic() to see that the two Hasse diagrams really are the “same.”


(Advanced) For the previous question, construct an explicit isomorphism between the two Boolean algebras. This would be a bijective function (constructed with the def command) that converts compositions into sets (or if, you choose, sets into compositions) and which respects the meet and join operations. You can test and illustrate your function by its interaction with specific elements evaluated in the meet and join operations, as described in the definition of an isomorphism of Boolean algebras.