Lattices can be introduced in algebraic way as commutative idempotent (\(x\cdot x =x\)) semigroups or as partial orders with some additional properties. These two approaches are equivalent. In this theory we will use the order-theoretic approach.
We start with a relation \(r\) which is a partial order on a set \(L\). Such situation is defined in Order_ZF as the predicate \( \text{IsPartOrder}(L,r) \).
A partially ordered \((L,r)\) set is a join-semilattice if each two-element subset of \(L\) has a supremum (i.e. the least upper bound).
definition
\( \text{IsJoinSemilattice}(L,r) \equiv \) \( r\subseteq L\times L \wedge \text{IsPartOrder}(L,r) \wedge (\forall x\in L.\ \forall y\in L.\ \text{HasAsupremum}(r,\{x,y\})) \)
A partially ordered \((L,r)\) set is a meet-semilattice if each two-element subset of \(L\) has an infimum (i.e. the greatest lower bound).
definition
\( \text{IsMeetSemilattice}(L,r) \equiv \) \( r\subseteq L\times L \wedge \text{IsPartOrder}(L,r) \wedge (\forall x\in L.\ \forall y\in L.\ \text{HasAnInfimum}(r,\{x,y\})) \)
Join is a binary operation whose value on a pair \(\langle x,y\rangle\) is defined as the supremum of the set \(\{ x,y\}\).
definition
\( \text{Join}(L,r) \equiv \{\langle p, \text{Supremum}(r,\{\text{fst}(p),\text{snd}(p)\})\rangle .\ p \in L\times L\} \)
Meet is a binary operation whose value on a pair \(\langle x,y\rangle\) is defined as the infimum of the set \(\{ x,y\}\).
definition
\( \text{Meet}(L,r) \equiv \{\langle p, \text{Infimum}(r,\{\text{fst}(p),\text{snd}(p)\})\rangle .\ p \in L\times L\} \)
In a join-semilattice join is indeed a binary operation.
lemma join_is_binop:
assumes \( \text{IsJoinSemilattice}(L,r) \)
shows \( \text{Join}(L,r) : L\times L \rightarrow L \)proofThe value of \( \text{Join}(L,r) \) on a pair \(\langle x,y\rangle\) is the supremum of the set \(\{ x,y\}\), hence its is greater or equal than both.
lemma join_val:
assumes \( \text{IsJoinSemilattice}(L,r) \), \( x\in L \), \( y\in L \)
defines \( j \equiv \text{Join}(L,r)\langle x,y\rangle \)
shows \( j\in L \), \( j = \text{Supremum}(r,\{x,y\}) \), \( \langle x,j\rangle \in r \), \( \langle y,j\rangle \in r \)proofJoin of \(x,y\) is less or equal than any upper bound for \(\{ x,y\}\).
lemma join_least_upbound:
assumes \( \text{IsJoinSemilattice}(L,r) \), \( \langle x,z\rangle \in r \), \( \langle y,z\rangle \in r \)
shows \( \langle \text{Join}(L,r)\langle x,y\rangle ,z\rangle \in r \)proofIn a meet-semilattice meet is indeed a binary operation.
lemma meet_is_binop:
assumes \( \text{IsMeetSemilattice}(L,r) \)
shows \( \text{Meet}(L,r) : L\times L \rightarrow L \)proofThe value of \( \text{Meet}(L,r) \) on a pair \(\langle x,y\rangle\) is the infimum of the set \(\{ x,y\}\), hence is less or equal than both.
lemma meet_val:
assumes \( \text{IsMeetSemilattice}(L,r) \), \( x\in L \), \( y\in L \)
defines \( m \equiv \text{Meet}(L,r)\langle x,y\rangle \)
shows \( m\in L \), \( m = \text{Infimum}(r,\{x,y\}) \), \( \langle m,x\rangle \in r \), \( \langle m,y\rangle \in r \)proofIn a join semilattice a union of two sets that have suprema has a supremum.
lemma join_semilat_sup_two:
assumes \( \text{IsJoinSemilattice}(L,r) \), \( \text{HasAsupremum}(r,A) \), \( \text{HasAsupremum}(r,B) \)
shows \( \text{HasAsupremum}(r,A\cup B) \) and \( \text{Supremum}(r,A\cup B) = \text{Join}(L,r)\langle \text{Supremum}(r,A), \text{Supremum}(r,B)\rangle \)proofIn a meet semilattice a union of two sets that have infima has an infimum.
lemma meet_semilat_inf_two:
assumes \( \text{IsMeetSemilattice}(L,r) \), \( \text{HasAnInfimum}(r,A) \), \( \text{HasAnInfimum}(r,B) \)
shows \( \text{HasAnInfimum}(r,A\cup B) \) and \( \text{Infimum}(r,A\cup B) = \text{Meet}(L,r)\langle \text{Infimum}(r,A), \text{Infimum}(r,B)\rangle \)proofIn a join semilattice every nonempty finite set has a supremum.
lemma join_semilat_fin_sup:
assumes \( \text{IsJoinSemilattice}(L,r) \), \( N\in \text{FinPow}(L) \), \( N\neq \emptyset \)
shows \( \text{HasAsupremum}(r,N) \)proofIn a meet semilattice every nonempty finite set has a infimum.
lemma meet_semilat_fin_inf:
assumes \( \text{IsMeetSemilattice}(L,r) \), \( N\in \text{FinPow}(L) \), \( N\neq \emptyset \)
shows \( \text{HasAnInfimum}(r,N) \)proofIn a (nonempty) meet semi-lattice the relation down-directs the set.
lemma meet_down_directs:
assumes \( \text{IsMeetSemilattice}(L,r) \), \( L\neq 0 \)
shows \( r \text{ down-directs } L \)proofIn a (nonempty) join semi-lattice the relation up-directs the set.
lemma join_up_directs:
assumes \( \text{IsJoinSemilattice}(L,r) \), \( L\neq 0 \)
shows \( r \text{ up-directs } L \)proofThe next locale defines a a notation for join-semilattice. We will use the \(\sqcup\) symbol rather than more common \(\vee\) to avoid confusion with logical "or".
locale join_semilatt
assumes joinLatt: \( \text{IsJoinSemilattice}(L,r) \)
defines \( x \sqcup y \equiv \text{Join}(L,r)\langle x,y\rangle \)
defines \( \text{sup}A \equiv \text{Supremum}(r,A) \)
Join of the elements of the lattice is in the lattice.
lemma (in join_semilatt) join_props:
assumes \( x\in L \), \( y\in L \)
shows \( x\sqcup y \in L \) and \( x\sqcup y = \text{sup}\{x,y\} \)proofJoin is associative.
lemma (in join_semilatt) join_assoc:
assumes \( x\in L \), \( y\in L \), \( z\in L \)
shows \( x\sqcup (y\sqcup z) = x\sqcup y\sqcup z \)proofJoin is idempotent.
lemma (in join_semilatt) join_idempotent:
assumes \( x\in L \)
shows \( x\sqcup x = x \) using joinLatt, assms, join_val(2), IsJoinSemilattice_def, IsPartOrder_def, sup_inf_singl(2)The meet_semilatt locale is the dual of the join-semilattice locale defined above. We will use the \(\sqcap\) symbol to denote join, giving it ab bit higher precedence.
locale meet_semilatt
assumes meetLatt: \( \text{IsMeetSemilattice}(L,r) \)
defines \( x \sqcap y \equiv \text{Meet}(L,r)\langle x,y\rangle \)
defines \( \text{inf}A \equiv \text{Infimum}(r,A) \)
Meet of the elements of the lattice is in the lattice.
lemma (in meet_semilatt) meet_props:
assumes \( x\in L \), \( y\in L \)
shows \( x\sqcap y \in L \) and \( x\sqcap y = \text{inf}\{x,y\} \)proofMeet is associative.
lemma (in meet_semilatt) meet_assoc:
assumes \( x\in L \), \( y\in L \), \( z\in L \)
shows \( x\sqcap (y\sqcap z) = x\sqcap y\sqcap z \)proofMeet is idempotent.
lemma (in meet_semilatt) meet_idempotent:
assumes \( x\in L \)
shows \( x\sqcap x = x \) using meetLatt, assms, meet_val, IsMeetSemilattice_def, IsPartOrder_def, sup_inf_singl(4)Here we study lattices, i.e. structures where both meet and join are defined.
A partially ordered \((L,r)\) set is a lattice if it is both join and meet-semilattice, i.e. if every two element set has a supremum (least upper bound) and infimum (greatest lower bound).
definition
\( r \text{ is a lattice on } L \equiv \text{IsJoinSemilattice}(L,r) \wedge \text{IsMeetSemilattice}(L,r) \)
Linear order is a lattice.
lemma lin_is_latt:
assumes \( r\subseteq L\times L \) and \( \text{IsLinOrder}(L,r) \)
shows \( r \text{ is a lattice on } L \)proofThe definition of a lattice requires that every two-element set has a supremum and infimum. As we show in join_semilat_fin_sup and meet_semilat_fin_inf this implies that every finite subset of the lattice has supremum and infimum. In this section we study structures in which every nonempty subset (not necessarily finite) has both supremum and infimum.
Wikipedia defines a complete lattice as a partially ordered set in which every subset has both supremum and infimum. The way we define supremum and infimum only nonempty sets can have infima or suprema so to avoid inconsistency we define a complete lattice as the one in which all nonempty subsets have both infima and suprema. We also add the assumption that the carrier is nonempty so that we don't have to repeat that assumption in every proposition about complete lattices.
definition
\( \text{IsCompleteLattice}(L,r) \equiv L\neq \emptyset \wedge r\subseteq L\times L \wedge \text{IsPartOrder}(L,r) \wedge \) \( (\forall A\in Pow(L)\setminus \{\emptyset \}.\ ( \text{HasAsupremum}(r,A) \wedge \text{HasAnInfimum}(r,A))) \)
Complete lattices are bounded and have both maximum and minimum.
lemma compl_lat_bounded:
assumes \( \text{IsCompleteLattice}(L,r) \)
shows \( \text{HasAmaximum}(r,L) \), \( \text{HasAminimum}(r,L) \), \( \text{IsBounded}(L,r) \)proofassumes \( r \subseteq X\times X \), \( \text{antisym}(r) \), \( \text{HasAminimum}(r,\bigcap a\in A.\ r\{a\}) \)
shows \( \text{Supremum}(r,A) \in X \) and \( \forall x\in A.\ \langle x, \text{Supremum}(r,A)\rangle \in r \)assumes \( \forall x\in X.\ b(x) \in Y \)
shows \( \{\langle x,b(x)\rangle .\ x\in X\} : X\rightarrow Y \)assumes \( \text{IsJoinSemilattice}(L,r) \)
shows \( \text{Join}(L,r) : L\times L \rightarrow L \)assumes \( f:X\rightarrow Y \), \( x\in X \) and \( f = \{\langle x,b(x)\rangle .\ x\in X\} \)
shows \( f(x) = b(x) \) and \( b(x)\in Y \)assumes \( r \subseteq X\times X \), \( \text{antisym}(r) \), \( \text{HasAminimum}(r,\bigcap a\in A.\ r\{a\}) \)
shows \( \text{Supremum}(r,A) \in X \) and \( \forall x\in A.\ \langle x, \text{Supremum}(r,A)\rangle \in r \)assumes \( \text{IsJoinSemilattice}(L,r) \), \( x\in L \), \( y\in L \)
defines \( j \equiv \text{Join}(L,r)\langle x,y\rangle \)
shows \( j\in L \), \( j = \text{Supremum}(r,\{x,y\}) \), \( \langle x,j\rangle \in r \), \( \langle y,j\rangle \in r \)assumes \( \text{antisym}(r) \), \( \text{HasAsupremum}(r,A) \), \( \forall a\in A.\ \langle a,u\rangle \in r \)
shows \( \langle \text{Supremum}(r,A),u\rangle \in r \)assumes \( r \subseteq X\times X \), \( \text{antisym}(r) \), \( \text{HasAmaximum}(r,\bigcap a\in A.\ r^{-1}\{a\}) \)
shows \( \text{Infimum}(r,A) \in X \) and \( \forall x\in A.\ \langle \text{Infimum}(r,A),x\rangle \in r \)assumes \( \text{IsMeetSemilattice}(L,r) \)
shows \( \text{Meet}(L,r) : L\times L \rightarrow L \)assumes \( r \subseteq X\times X \), \( \text{antisym}(r) \), \( \text{HasAmaximum}(r,\bigcap a\in A.\ r^{-1}\{a\}) \)
shows \( \text{Infimum}(r,A) \in X \) and \( \forall x\in A.\ \langle \text{Infimum}(r,A),x\rangle \in r \)assumes \( \text{IsJoinSemilattice}(L,r) \), \( x\in L \), \( y\in L \)
defines \( j \equiv \text{Join}(L,r)\langle x,y\rangle \)
shows \( j\in L \), \( j = \text{Supremum}(r,\{x,y\}) \), \( \langle x,j\rangle \in r \), \( \langle y,j\rangle \in r \)assumes \( r \subseteq X\times X \), \( \text{antisym}(r) \), \( \text{trans}(r) \), \( \forall T\in \mathcal{T} .\ \text{HasAsupremum}(r,T) \), \( \text{HasAsupremum}(r,\{ \text{Supremum}(r,T).\ T\in \mathcal{T} \}) \)
shows \( \text{HasAsupremum}(r,\bigcup \mathcal{T} ) \) and \( \text{Supremum}(r,\{ \text{Supremum}(r,T).\ T\in \mathcal{T} \}) = \text{Supremum}(r,\bigcup \mathcal{T} ) \)assumes \( \text{IsMeetSemilattice}(L,r) \), \( x\in L \), \( y\in L \)
defines \( m \equiv \text{Meet}(L,r)\langle x,y\rangle \)
shows \( m\in L \), \( m = \text{Infimum}(r,\{x,y\}) \), \( \langle m,x\rangle \in r \), \( \langle m,y\rangle \in r \)assumes \( r \subseteq X\times X \), \( \text{antisym}(r) \), \( \text{trans}(r) \), \( \forall T\in \mathcal{T} .\ \text{HasAnInfimum}(r,T) \), \( \text{HasAnInfimum}(r,\{ \text{Infimum}(r,T).\ T\in \mathcal{T} \}) \)
shows \( \text{HasAnInfimum}(r,\bigcup \mathcal{T} ) \) and \( \text{Infimum}(r,\{ \text{Infimum}(r,T).\ T\in \mathcal{T} \}) = \text{Infimum}(r,\bigcup \mathcal{T} ) \)assumes \( \text{antisym}(r) \), \( \text{refl}(X,r) \), \( z\in X \)
shows \( \text{HasAsupremum}(r,\{z\}) \), \( \text{Supremum}(r,\{z\}) = z \) and \( \text{HasAnInfimum}(r,\{z\}) \), \( \text{Infimum}(r,\{z\}) = z \)assumes \( \text{IsJoinSemilattice}(L,r) \), \( \text{HasAsupremum}(r,A) \), \( \text{HasAsupremum}(r,B) \)
shows \( \text{HasAsupremum}(r,A\cup B) \) and \( \text{Supremum}(r,A\cup B) = \text{Join}(L,r)\langle \text{Supremum}(r,A), \text{Supremum}(r,B)\rangle \)assumes \( N\in \text{FinPow}(X) \), \( N\neq \emptyset \), \( \forall x\in N.\ \{x\} \in C \), \( \forall A\in C.\ \forall B\in C.\ A\cup B \in C \)
shows \( N\in C \)assumes \( \text{antisym}(r) \), \( \text{refl}(X,r) \), \( z\in X \)
shows \( \text{HasAsupremum}(r,\{z\}) \), \( \text{Supremum}(r,\{z\}) = z \) and \( \text{HasAnInfimum}(r,\{z\}) \), \( \text{Infimum}(r,\{z\}) = z \)assumes \( \text{IsMeetSemilattice}(L,r) \), \( \text{HasAnInfimum}(r,A) \), \( \text{HasAnInfimum}(r,B) \)
shows \( \text{HasAnInfimum}(r,A\cup B) \) and \( \text{Infimum}(r,A\cup B) = \text{Meet}(L,r)\langle \text{Infimum}(r,A), \text{Infimum}(r,B)\rangle \)assumes \( \text{IsMeetSemilattice}(L,r) \), \( x\in L \), \( y\in L \)
defines \( m \equiv \text{Meet}(L,r)\langle x,y\rangle \)
shows \( m\in L \), \( m = \text{Infimum}(r,\{x,y\}) \), \( \langle m,x\rangle \in r \), \( \langle m,y\rangle \in r \)assumes \( x\in L \), \( y\in L \)
shows \( x\sqcup y \in L \) and \( x\sqcup y = \text{sup}\{x,y\} \)assumes \( \text{antisym}(r) \), \( \text{refl}(X,r) \), \( z\in X \)
shows \( \text{HasAsupremum}(r,\{z\}) \), \( \text{Supremum}(r,\{z\}) = z \) and \( \text{HasAnInfimum}(r,\{z\}) \), \( \text{Infimum}(r,\{z\}) = z \)assumes \( r \subseteq X\times X \), \( \text{antisym}(r) \), \( \text{HasAminimum}(r,\bigcap a\in A.\ r\{a\}) \)
shows \( \text{Supremum}(r,A) \in X \) and \( \forall x\in A.\ \langle x, \text{Supremum}(r,A)\rangle \in r \)assumes \( x\in L \), \( y\in L \)
shows \( x\sqcap y \in L \) and \( x\sqcap y = \text{inf}\{x,y\} \)assumes \( \text{antisym}(r) \), \( \text{refl}(X,r) \), \( z\in X \)
shows \( \text{HasAsupremum}(r,\{z\}) \), \( \text{Supremum}(r,\{z\}) = z \) and \( \text{HasAnInfimum}(r,\{z\}) \), \( \text{Infimum}(r,\{z\}) = z \)assumes \( r \subseteq X\times X \), \( \text{antisym}(r) \), \( \text{HasAmaximum}(r,\bigcap a\in A.\ r^{-1}\{a\}) \)
shows \( \text{Infimum}(r,A) \in X \) and \( \forall x\in A.\ \langle \text{Infimum}(r,A),x\rangle \in r \)assumes \( \text{IsLinOrder}(X,r) \)
shows \( \text{IsPartOrder}(X,r) \)assumes \( \text{antisym}(r) \), \( r \text{ is total on } X \), \( x\in X \), \( y\in X \)
shows \( \text{HasAnInfimum}(r,\{x,y\}) \), \( \text{Minimum}(r,\{x,y\}) = \text{Infimum}(r,\{x,y\}) \), \( \text{HasAsupremum}(r,\{x,y\}) \), \( \text{Maximum}(r,\{x,y\}) = \text{Supremum}(r,\{x,y\}) \)assumes \( \text{antisym}(r) \), \( r \text{ is total on } X \), \( x\in X \), \( y\in X \)
shows \( \text{HasAnInfimum}(r,\{x,y\}) \), \( \text{Minimum}(r,\{x,y\}) = \text{Infimum}(r,\{x,y\}) \), \( \text{HasAsupremum}(r,\{x,y\}) \), \( \text{Maximum}(r,\{x,y\}) = \text{Supremum}(r,\{x,y\}) \)assumes \( \text{antisym}(r) \), \( \text{HasAsupremum}(r,A) \), \( \text{Supremum}(r,A) \in A \)
shows \( \text{HasAmaximum}(r,A) \) and \( \text{Maximum}(r,A) = \text{Supremum}(r,A) \)assumes \( \text{antisym}(r) \), \( \text{HasAnInfimum}(r,A) \), \( \text{Infimum}(r,A) \in A \)
shows \( \text{HasAminimum}(r,A) \) and \( \text{Minimum}(r,A) = \text{Infimum}(r,A) \)assumes \( \text{HasAmaximum}(r,A) \)
shows \( \text{IsBoundedAbove}(A,r) \)assumes \( \text{HasAminimum}(r,A) \)
shows \( \text{IsBoundedBelow}(A,r) \)