Section 5.5 Partial Order
A relation \(R\) on a set is a Partial Order (PO) \(\prec\) if it satisfies the reflexive, antisymmetric, and transitive properties. A poset is a set with a partial order relation. For example, the following set of numbers with a relation given by divisibility is a poset.
A Hasse diagram is a simplified visual representation of a poset. Unlike a digraph, the relative position of vertices has meaning: if \(x\) relates to \(y\text{,}\) then the vertex \(x\) appears lower in the drawing than the vertex \(y\text{.}\) Self-loops are assumed and not shown. Similarly, the diagram assumes the transitive property and does not explicitly display the edges that are implied by the transitive property.
If \(R\) is a partial order relation on \(A\text{,}\) then the function
Poset((A, R))
computes the Hasse diagram associated to \(R\text{.}\)
Moreover, the
cover_relations()
function shows the pairs depicted in the Hasse diagram after the previous simplifications.The
.has_bottom()
function tests for a bottom element of a poset.The same applies for the
.has_top()
function but with a top element.The bottom element of a poset, if one exists, can be found with the
.bottom()
attribute.Similarly, the top element of a poset, if one exists, can be found with the
.top()
attribute.Notice that \(P\) does not have a top element, causing nothing to be returned by
P.top()
.