Based on a very patient and kind explanation by bollu.
It’s taking me more than four months to understand the gist of this theorem and its implication and uses,
hopefully writing down what I got to so far will be helpful on this quest.
statement: the set of fixed points of a monotone function over a complete lattice is itself a complete lattice.
we will need a bunch of definitions around lattices to get to the theorem.
A lattice is a set of elements L such that
there exists two binary operations meet(∧) and join(∨) such that
∧ is associative: ∀x,y,z∈L,(x∧y)∧z=x∧(y∧z)
∧ is commutative: ∀x,y∈L,x∧y=x∧x
∧ is idempotent: ∀x∈L,x∧x=x
∨ is associative: ∀x,y,z∈L,(x∨y)∨z=x∨(y∨z)
∨ is commutative: ∀x,y∈L,x∨y=x∨x
∨ is idempotent: ∀x∈L,x∨x=x
there exists two elements ⊤ and ⊥ such that
⊤ is an identity element for ∧: ∀x∈L,x∧⊤=x
⊥ is an absorbing element for ∧: ∀x∈L,x∧⊥=⊥
⊥ is an identity element for ∨: ∀x∈L,x∨⊥=x
⊤ is an absorbing element for ∨: ∀x∈L,x∨⊤=⊤
there exists a partial order, which we indicate as ≤, such that
⊥ is below everything: ∀x,⊥≤x
⊤ is above everything: ∀x,x≤⊤
x∧y is the “greatest lower bound (GLB) of x and y”, where:
(i) the lower bound of x,y is p=LB(x,y) if p≤x and p≤y
(ii) p is the greatest lower bound if ∀q,q=LB(x,y), where q≤x and q≤y,
we also have q≤p
x∨y is the “least upper bound (LUB) of x and y”, where:
(i) the upper bound of x,y is p=UB(x,y) if x≤p and y≤p
(ii) p is the least upper bound if ∀q,q=UB(x,y), where x≤q and y≤q,
we also have p≤q
From the definitions we have:
x∧y≤x and x∧y≤y
x∨y≥x and x∨y≥y
x∧(y∨z)≤((x∧y)∨(x∧z))
⊤ | x ∨ y "join" : LUB / \ / \ x y \ / \ / x ∧ y "meet" : GLB | ⊥
Other examples:
Given any set, the set of its subsets is a lattice, with the partial order ⊆
R between [0,1] is a latice with ∧ being max, ∨ being min,
and the order relation being ≤
same for Q between [0,1]
We can also reason the other way around and get a lattice out of a partial order: consider Q[0,1] with order relation ≤, we need to define meet and join.
We can have a lattice with d=⊤, a=⊥ and a∧c=a, b∧c=a …
d / \ b c \ / a
In this case:
d / \ c e | x | b f \ / a
We have a lattice with d=⊤, a=⊥ and b∧f=e, but also b∧f=c?
In this lattice we can’t decide what’s the actual LUB between c and e. This goes against the actual definition of join, hence this is not a lattice.
To make this a proper lattice we can just add:
d / \ c - e | x | b f \ / a
meaning that b∧f=c since c≤e, and it can’t be b∧f=e since e is not the least upper bound.
If a partial order fails to become a lattice it’s usually because there’s no ⊤, no ⊥ or
two elements don’t have a unique LUB\GLB.
We now need to define a complete lattice.
Given the above definitions, we can reason about meet and join over sets with different number of elements:
from which it follows for S=∅ that meet()=p⟺(∀i∈∅,p≤xi)∧(∀k(∀i∈∅,k≤xi)⟹k≤p) where:
(∀i∈∅,p≤xi) is always true, since the existence of a certain xi,i∈∅ to compare p against is itself a contradiction.
(∀i∈∅,k≤xi) is always true for the same reason
leaving us with ∀k,k≤p, meaning p=⊤.
meet finds the highest point in the lattice that is lower than the given points (GLB)
and in particular, the lattice definition ensures that if such point exists, it is unique.
Let’s consider the set L=N∪{S∣S⊆N∧∣S∣≤∞}, i.e.,
containing the set of natural numbers and any subset of natural numbers with finite cardinality.
Let’s make sure this is actually a lattice by defining:
⊤=N
meet = ∩
join = ∪
⊥=∅, note that ∅ has finite cardinality and is a subset of N, thus belongs to L
any two elements have GLB and LUB with respect to the relation ⊆: given c,y∈L the GLB is also finite and
by definition x∪y∈L, else if one of them is N, then N∪x=N∈L
Let’s consider the infinite family of elements in this lattice c={0},{2},{4},...,{2n},∀n∈N:
The points in C do not have a LUB in L!
While this structure is a lattice, it is not a complete lattice: pairs (or more in general, finite collections of elements)
have a LUB (join, or in this case ∪ suffices), but not every infinite collection does.
To handle the join over an infinite collection of elements, we need more guarantees.
The same happens for meet: let’s consider L′={S∣S=∅∨S⊆N:∣S∣=∞}, which looks something like:
We can build an infinite collection of elements whose intersections is finite, for example consider
c=N\{1},N\{1,2},{4},...,N\{1,2,...,k+1},∀k∈N.
any finite intersection of the elements in c will only miss a finite number of elements (“from the highest k onwards”), however
the intersection over all the elements in c fill have finite cardinality and will eventually like {0}∈/L′, since {0} is common
to every element of the collection.
Incomplete lattices often have the structure of L: everything works up to finite collections of elements, but when
meet/join need to handle an infinite number of elements, the structure stops working.
Other examples:
Q∩[0,1] with order relation ≤ is not complete, e.g. 2 is missing and sub-lattices around that area will not have the appropriate upper/lower bounds.
R∩[0,5] with order relation ≤ is a complete lattice
In Lean, Prop with order relation ⟹ is a lattice, where join is disjunction and meet is conjunction, ⊥ is false and ⊤ is true
Moving on with the theorem statement, we need to define a monotone function on a partial order ≤.
Let f:A→B, where A has a partial order given by ≤ and B has a partial order given by ⊑.
f is monotone ⟺∀a,a′∈A,a≤a′⟹f(a)⊑f(a′) with f(a),f(a′)∈A
Basically, a function is monotone if it preserves the order relation existing in the codomain into the domain,
without establishing a relation between the two order relation themselves (no hypothesis is required for le,⊑).
We then define a fixed point: given f:A→A and x∈A, we say x is a fixed point (FP) ⟺x=f(x).
We now have enough definitions to go back to the theorem statement: given a function f:L→L that is monotone, with
L being a complete lattice, then we know:
f has a FP
let S be the set of FPs of f, then ∃ at least one least FP, i.e., one element s∈S smaller than all other FPs
the set of FPs S is a complete sub-lattice of L
Example: let’s consider L={x∣x⊆N} with partial order ⊆:
⊥=∅
⊤=N
meet = ∩
join = ∪
and think about a few functions:
f(x)=x, in which case the set of FPs is S=L
f(x)={1}, meaning S only contains one element: {1}. Note that S={{1}} is itself a complete lattice!
f(x)=x∪{1,2} with fixed points {1,2}, {1,2,3}, … and therefore S={x∣{1,2}⊆x} :
S is the set of subsets x of N such that the subset {1,2} is contained in x.
With this in mind, we define for the sublattice:
⊤=N
⊥={1,2}
meet = ∩: even in the case infinite meet, the resulting subset is {1,2} and this be part of the sub-lattice ({1,2}⊆x,∀x∈S)
join = ∪, again the infinite union is N which is in S
given x,y∈S: LUB = x∪y∈S given that 1,2 will still be in the union
given x,y∈S: GLB = x∩y∈S given that at least 1,2 are always in the intersection
The final objective of my effort with this theorem, is to understand its implication in type theory and in particular
concerning types definitions in Lean, so let’s try to move towards that domain.
Let’s consider L={x∣x⊆N} and introduce the concept of indicator functionI:
when we say ∀S,S⊆N, we really are defining a function IS:N→B where
a∈S⟺IS(a)=True.
We can re-interpret lattices considering this idea.
B is a complete lattice, with ⊤=True and ⊥=False, meet=&&, join=∣∣.
From this lattice, we derive a new lattice N→B by pointwise definition:
join: given f,g∈N→B then f∪g:N→B is the join on functions such that:
n:N↦f(n)∪g(n). For each point n, we consider the behavior of f,g,join in the B domain.
meet: we use the same approach, given f,g∈N→B then f∪g:N→B is the meet on functions such that: n:N↦f(n)∩g(n). For each point n, we consider the behavior of f,g,meet in the B domain.
Knaster-Tarski theorem in analysis
A more analytical explanation.
We construct a lattice using N and adding two arbitrary elements ⊤ and ⊥:
⊤ 0, 1, 2, ... ⊥
forming a complete lattice with:
LUB(∅) = $\bot: any element is an upper bound of an empty set
LUB(n) = n
LUB(n,m) = ⊤
We now consider any set X: the space of functions [X,L]={f∣X→L} will be a complete lattice, with
bottom function ⊥(x)=⊥, “spits out ⊥ for any input”
join function f∪g:x↦f(x)∪g(x)
meet function f∩g:x↦f(x)∩g(x)
in particular, the lattice is complete, in fact:
infinite join given a family of functions f1∪...∪fn:x↦f1(x)∪...∪fn(x): the join of infinitely many elements is the LUB. This still belongs in L, since all fi do - also L was complete in the first place, meaning that infinite join belongs in L!
infinite meet given a family of functions f1∩...∩fn(x):x↦f1(x)∩...∩fn(x): the meet of infinitely many elements is the GLB. The same reasoning as join applies.
We instantiate this construction with X=N and L=N equipped with ⊥,⊤ (L=N⊤⊥).
This construction contains, for example:
almost identity function fun (x : ℕ) => x
always-returns-bottom function fun (x : ℕ) => ⊥
weird function 1 fun (x : ℕ) => if x = 0 then 1 else ⊥
weird function 2 fun (x : ℕ) => if x = 0 then 1 else if x = 1 then 1 else ⊥
weird function 3 fun (x : ℕ) => if x = 0 then 1 else if x = 1 then 1 else if x =- 2 then 2 else ⊥
weird function 4 fun (x : ℕ) => if x = 0 then 1 else if x = 1 then 1 else if x =- 2 then 2 else if x = 3 then 6 else ⊥
these weird functions are all finite approximations of the factorial function (up to a- certain x).
We now can build a monotone function from this space of functions to itself m=(N→L)→(N→L),
i.e. m(f)=x↦ifx=0then1elsex∗f(n−1):
0 1 2 3 4 5 ... f0 = fun x => ⊥ ⊥ ⊥ ... f1 = m f0 1 ⊥ ⊥ ... we cheat, because we're multiplying a natural number by ⊥! f2 = m f1 1 1 ⊥ ⊥ ⊥ ... f3 = m f2 1 1 2 ⊥ ⊥ ... f4 = m f3 1 1 2 6 ⊥ ... f1 ∪ f2 1 1 ⊥ ... we take the join (upper) element of {f1(0), f(0)}, etc.
given two said functions we define f≤g⟺∀x,f(x)≤g(x)⟹m(f)≤m(g)
A concrete construction of naturals using this setting:
we consider a function $f(S) = {0}\cup {succ(s) ;|;s\in S}
this function is monotone with respect to ⊆: in fact S1⊆S2⟹f(S1)⊆f(S2)
according to Knaster Tarski, the set of fixed points of f over a complete lattice is itself a complete lattice:
in this case the fixed point is a set S=f(S): N is the fixed point itself.
In other words, Knaster Tarski guarantees that the recursive function defining the set has a fixed point and therefore
the set actually exists!
For example, let’s consider a function with no fixed points: f(x)=x+1 in the lattice R[0,1]:
we can’t get a set of elements out of this function.
Think about the lattice R[0,1] for “normal functions” (i.e. real analysis).
Then think about sets: e.g. the set of naturals S (each set is a node of the lattice), with the lattice
structure given by ∪∩,∪, the monotone function we consider to reason about the theorem is such that:
S↦{zero}∪{∀s∈S,succ(s)}:
Knaster Tarski allows to use the recursive definitions to create an actual “math object”.
For example, if we consider a function with no fixed points over R→R, e.g.
f(x)=x+1
In lean, the positivity check verifies that the function we’re using to build a type is monotone!
For example, when defining the type Nat, the constructor might have a parameter of type Nat, e.g. :
Nat : | zero : Nat | succ (n : Nat) : Nat
the positivity check ensures that the function f mapping a set of candidates for Nat to a new,
larger set is indeed a monotone function on the lattice of all possible subsets of Nat.
On the complete lattice L = \{S \;|\;\ S\subseteq \mathbb{N}}, the function we use to construct
the type is f(S)={0}∪{∀s∈S,succ(s)} and checking its monotonicity ensures that the
f has a fixed point, i.e. a set S=f(S) ensuring the validity of the construction.
TODO: find an example with a non monotone function!