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\})) \)
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) \)
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\} \)
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 \)proofIn 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 \)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 (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)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 \( 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 \( 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{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 \( \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{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 \( 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 \( \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 \( 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 \( 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 \( \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 \( 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} ) \)