Section 9.1 Lattices
Subsection 9.1.1 Definition
A lattice is a partially ordered set (poset) in which any two elements have a least upper bound (also known as join) and greatest lower bound (also known as meet).
In Sage, a lattice can be represented as a poset using the
Poset()
function. This function takes a tuple as its argument, where the first element is the set of elements in the poset, and the second element is a list of ordered pairs representing the partial order relations between those elements.First, let’s define the lists of elements and relations we will use for the following examples:
Create a poset from a tuple of elements and relations.
The function
is_lattice()
determines whether the poset is a lattice.We can also use
LatticePoset()
function to plot the lattice. The function Poset()
can be used with any poset, even when the poset is not a lattice. The LatticePoset()
function will raise an error if the poset is not a lattice.Subsection 9.1.2 Join
The join of two elements in a lattice is the least upper bound of those elements.
To check if a poset is a join semi-lattice (every pair of elements has a least upper bound), we use
is_join_semilattice()
function.We can also find the join for individual pairs using the
join()
function.Subsection 9.1.3 Meet
The meet of two elements in a lattice is their greatest lower bound.
To check if a poset is a meet semi-lattice (every pair of elements has a greatest lower bound), we use
is_meet_semilattice()
function.We can also find the meet for individual pairs using the
meet()
function.