Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 9084a3c

Browse files
committed
chore(order/fixed_point): add docstring for Knaster-Tarski theorem (#7589)
clarify that the def provided constitutes the Knaster-Tarski theorem
1 parent c8a2fd7 commit 9084a3c

File tree

3 files changed

+144
-149
lines changed

3 files changed

+144
-149
lines changed

src/order/countable_dense_linear_order.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import data.finset
1313
1414
Suppose `α β` are linear orders, with `α` countable and `β` dense, nonempty, without endpoints.
1515
Then there is an order embedding `α ↪ β`. If in addition `α` is dense, nonempty, without
16-
endpoints and `β` is countable, then we can upgrade this to an order isomorhpism `α ≃ β`.
16+
endpoints and `β` is countable, then we can upgrade this to an order isomorphism `α ≃ β`.
1717
1818
The idea for both results is to consider "partial isomorphisms", which
1919
identify a finite subset of `α` with a finite subset of `β`, and prove that

src/order/fixed_points.lean

Lines changed: 121 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@ import dynamics.fixed_points.basic
88

99
/-!
1010
# Fixed point construction on complete lattices
11+
12+
This file sets up the basic theory of fixed points of a monotone function in a complete lattice
13+
14+
## Main definitions
15+
16+
* `lfp`: The least fixed point of a monotone function.
17+
* `gfp`: The greatest fixed point of a monotone function.
18+
* `prev_fixed`: The least fixed point of a monotone function greater than a given element.
19+
* `next_fixed`: The greatest fixed point of a monotone function smaller than a given element.
20+
* `fixed_points.complete_lattice`: The Knaster-Tarski theorem: fixed points form themselves a
21+
complete lattice.
22+
23+
## Tags
24+
25+
fixed point, complete lattice, monotone function
1126
-/
1227

1328
universes u v w
@@ -23,102 +38,95 @@ def lfp (f : α → α) : α := Inf {a | f a ≤ a}
2338
/-- Greatest fixed point of a monotone function -/
2439
def gfp (f : α → α) : α := Sup {a | a ≤ f a}
2540

26-
theorem lfp_le {a : α} (h : f a ≤ a) : lfp f ≤ a :=
41+
lemma lfp_le {a : α} (h : f a ≤ a) : lfp f ≤ a :=
2742
Inf_le h
2843

29-
theorem le_lfp {a : α} (h : ∀b, f b ≤ b → a ≤ b) : a ≤ lfp f :=
44+
lemma le_lfp {a : α} (h : ∀ b, f b ≤ b → a ≤ b) : a ≤ lfp f :=
3045
le_Inf h
3146

32-
theorem lfp_eq (m : monotone f) : lfp f = f (lfp f) :=
33-
have f (lfp f) ≤ lfp f,
34-
from le_lfp $ assume b, assume h : f b ≤ b, le_trans (m (lfp_le h)) h,
35-
le_antisymm (lfp_le (m this)) this
36-
37-
theorem lfp_induct {p : α → Prop} (m : monotone f)
38-
(step : ∀a, p a → a ≤ lfp f → p (f a)) (sup : ∀s, (∀a∈s, p a) → p (Sup s)) :
39-
p (lfp f) :=
40-
let s := {a | a ≤ lfp f ∧ p a} in
41-
have p_s : p (Sup s),
42-
from sup s (assume a ⟨_, h⟩, h),
43-
have Sup s ≤ lfp f,
44-
from le_lfp $ assume a, assume h : f a ≤ a, Sup_le $ assume b ⟨b_le, _⟩, le_trans b_le (lfp_le h),
45-
have Sup s = lfp f,
46-
from le_antisymm this $ lfp_le $ le_Sup
47-
⟨le_trans (m this) $ ge_of_eq $ lfp_eq m, step _ p_s this⟩,
48-
this ▸ p_s
49-
50-
theorem monotone_lfp : monotone (@lfp α _) :=
51-
assume f g, assume : f ≤ g, le_lfp $ assume a, assume : g a ≤ a, lfp_le $ le_trans (‹f ≤ g› a) this
52-
53-
theorem le_gfp {a : α} (h : a ≤ f a) : a ≤ gfp f :=
47+
lemma lfp_fixed_point (hf : monotone f) : f (lfp f) = lfp f :=
48+
have h : f (lfp f) ≤ lfp f,
49+
from le_lfp (λ b hb, (hf (lfp_le hb)).trans hb),
50+
h.antisymm (lfp_le (hf h))
51+
52+
lemma lfp_induction {p : α → Prop} (hf : monotone f) (step : ∀ a, p a → a ≤ lfp f → p (f a))
53+
(hSup : ∀ s, (∀ a ∈ s, p a) → p (Sup s)) :
54+
p (lfp f) :=
55+
begin
56+
let s := {a | a ≤ lfp f ∧ p a},
57+
have hpSup := hSup s (λ a ha, ha.2),
58+
have h : Sup s ≤ lfp f := le_lfp (λ a ha, Sup_le (λ b hb, hb.1.trans (lfp_le ha))),
59+
rw ←h.antisymm (lfp_le (le_Sup ⟨(hf h).trans (lfp_fixed_point hf).le, step _ hpSup h⟩)),
60+
exact hpSup,
61+
end
62+
63+
lemma monotone_lfp : monotone (@lfp α _) :=
64+
λ f g h, le_lfp $ λ a ha, lfp_le $ (h a).trans ha
65+
66+
lemma le_gfp {a : α} (h : a ≤ f a) : a ≤ gfp f :=
5467
le_Sup h
5568

56-
theorem gfp_le {a : α} (h : ∀b, b ≤ f b → b ≤ a) : gfp f ≤ a :=
69+
lemma gfp_le {a : α} (h : ∀ b, b ≤ f b → b ≤ a) : gfp f ≤ a :=
5770
Sup_le h
5871

59-
theorem gfp_eq (m : monotone f) : gfp f = f (gfp f) :=
60-
have gfp f ≤ f (gfp f),
61-
from gfp_le $ assume b, assume h : b ≤ f b, le_trans h (m (le_gfp h)),
62-
le_antisymm this (le_gfp (m this))
63-
64-
theorem gfp_induct {p : α → Prop} (m : monotone f)
65-
(step : ∀a, p a → gfp f ≤ a → p (f a)) (inf : ∀s, (∀a∈s, p a) → p (Inf s)) :
66-
p (gfp f) :=
67-
let s := {a | gfp f ≤ a ∧ p a} in
68-
have p_s : p (Inf s),
69-
from inf s (assume a ⟨_, h⟩, h),
70-
have gfp f ≤ Inf s,
71-
from gfp_le $ assume a, assume h : a ≤ f a, le_Inf $ assume b ⟨le_b, _⟩, le_trans (le_gfp h) le_b,
72-
have Inf s = gfp f,
73-
from le_antisymm (le_gfp $ Inf_le
74-
⟨le_trans (le_of_eq $ gfp_eq m) (m this), step _ p_s this⟩) this,
75-
this ▸ p_s
76-
77-
theorem monotone_gfp : monotone (@gfp α _) :=
78-
assume f g, assume : f ≤ g, gfp_le $ assume a, assume : a ≤ f a, le_gfp $ le_trans this (‹f ≤ g› a)
72+
lemma gfp_fixed_point (hf : monotone f) : f (gfp f) = gfp f :=
73+
have h : gfp f ≤ f (gfp f),
74+
from gfp_le $ λ a ha, ha.trans (hf (le_gfp ha)),
75+
(le_gfp (hf h)).antisymm h
76+
77+
lemma gfp_induction {p : α → Prop} (hf : monotone f)
78+
(step : ∀ a, p a → gfp f ≤ a → p (f a)) (hInf : ∀ s, (∀ a ∈ s, p a) → p (Inf s)) :
79+
p (gfp f) :=
80+
begin
81+
let s := {a | gfp f ≤ a ∧ p a},
82+
have hpInf := hInf s (λ a ha, ha.2),
83+
have h : gfp f ≤ Inf s := gfp_le (λ a ha, le_Inf (λ b hb, (le_gfp ha).trans hb.1)),
84+
rw h.antisymm (le_gfp (Inf_le ⟨(gfp_fixed_point hf).ge.trans (hf h), step _ hpInf h⟩)),
85+
exact hpInf,
86+
end
87+
88+
lemma monotone_gfp : monotone (@gfp α _) :=
89+
λ f g h, gfp_le $ λ a ha, le_gfp $ ha.trans (h a)
7990

8091
end fixedpoint
8192

8293
section fixedpoint_eqn
8394
variables [complete_lattice α] [complete_lattice β] {f : β → α} {g : α → β}
8495

8596
-- Rolling rule
86-
theorem lfp_comp (m_f : monotone f) (m_g : monotone g) : lfp (f ∘ g) = f (lfp (g ∘ f)) :=
87-
le_antisymm
88-
(lfp_le $ m_f $ ge_of_eq $ lfp_eq $ m_g.comp m_f)
89-
(le_lfp $ assume a fg_le,
90-
le_trans (m_f $ lfp_le $ show (g ∘ f) (g a) ≤ g a, from m_g fg_le) fg_le)
91-
92-
theorem gfp_comp (m_f : monotone f) (m_g : monotone g) : gfp (f ∘ g) = f (gfp (g ∘ f)) :=
93-
le_antisymm
94-
(gfp_le $ assume a fg_le,
95-
le_trans fg_le $ m_f $ le_gfp $ show g a ≤ (g ∘ f) (g a), from m_g fg_le)
96-
(le_gfp $ m_f $ le_of_eq $ gfp_eq $ m_g.comp m_f)
97+
lemma lfp_comp (hf : monotone f) (hg : monotone g) : lfp (f ∘ g) = f (lfp (g ∘ f)) :=
98+
le_antisymm (lfp_le $ hf (lfp_fixed_point (hg.comp hf)).le)
99+
(le_lfp $ λ a ha, (hf $ lfp_le $ show (g ∘ f) (g a) ≤ g a, from hg ha).trans ha)
100+
101+
lemma gfp_comp (hf : monotone f) (hg : monotone g) : gfp (f ∘ g) = f (gfp (g ∘ f)) :=
102+
(gfp_le $ λ a ha, ha.trans $ hf $ le_gfp $ show g a ≤ (g ∘ f) (g a), from hg ha).antisymm
103+
(le_gfp $ hf (gfp_fixed_point (hg.comp hf)).ge)
97104

98105
-- Diagonal rule
99-
theorem lfp_lfp {h : α → α → α} (m : ∀⦃a b c d⦄, a ≤ b → c ≤ d → h a c ≤ h b d) :
100-
lfp (lfp ∘ h) = lfp (λx, h x x) :=
101-
let f := lfp (lfp ∘ h) in
102-
have f_eq : f = lfp (h f),
103-
from lfp_eq $ monotone.comp monotone_lfp (assume a b h x, m h (le_refl _)) ,
104-
le_antisymm
105-
(lfp_le $ lfp_le $ ge_of_eq $ lfp_eq $ assume a b h, m h h)
106-
(lfp_le $ ge_of_eq $
107-
calc f = lfp (h f) : f_eq
108-
... = h f (lfp (h f)) : lfp_eq $ assume a b h, m (le_refl _) h
109-
... = h f f : congr_arg (h f) f_eq.symm)
110-
111-
theorem gfp_gfp {h : α → α → α} (m : ∀⦃a b c d⦄, a ≤ b → c ≤ d → h a c ≤ h b d) :
112-
gfp (gfp ∘ h) = gfp (λx, h x x) :=
113-
let f := gfp (gfp ∘ h) in
114-
have f_eq : f = gfp (h f),
115-
from gfp_eq $ monotone.comp monotone_gfp (assume a b h x, m h (le_refl _)),
116-
le_antisymm
117-
(le_gfp $ le_of_eq $
118-
calc f = gfp (h f) : f_eq
119-
... = h f (gfp (h f)) : gfp_eq $ assume a b h, m (le_refl _) h
120-
... = h f f : congr_arg (h f) f_eq.symm)
121-
(le_gfp $ le_gfp $ le_of_eq $ gfp_eq $ assume a b h, m h h)
106+
lemma lfp_lfp {h : α → α → α} (m : ∀ ⦃a b c d⦄, a ≤ b → c ≤ d → h a c ≤ h b d) :
107+
lfp (lfp ∘ h) = lfp (λ x, h x x) :=
108+
begin
109+
let a := lfp (lfp ∘ h),
110+
refine (lfp_le _).antisymm (lfp_le (eq.le _)),
111+
{ exact lfp_le (lfp_fixed_point (λ a b hab, m hab hab)).le },
112+
have ha : (lfp ∘ h) a = a := lfp_fixed_point
113+
((monotone_lfp : monotone (_ : _ → α)).comp (λ b c hbc x, m hbc le_rfl)),
114+
calc h a a = h a (lfp (h a)) : congr_arg (h a) ha.symm
115+
... = (lfp ∘ h) a : lfp_fixed_point $ λ b c hbc, m le_rfl hbc
116+
... = a : ha,
117+
end
118+
119+
lemma gfp_gfp {h : α → α → α} (m : ∀ ⦃a b c d⦄, a ≤ b → c ≤ d → h a c ≤ h b d) :
120+
gfp (gfp ∘ h) = gfp (λ x, h x x) :=
121+
begin
122+
let a := gfp (gfp ∘ h),
123+
refine (le_gfp (eq.ge _)).antisymm (le_gfp (le_gfp (gfp_fixed_point (λ a b hab, m hab hab)).ge)),
124+
have ha : (gfp ∘ h) a = a := gfp_fixed_point
125+
((monotone_gfp : monotone (_ : _ → α)).comp (λ b c hbc x, m hbc le_rfl)),
126+
calc h a a = h a (gfp (h a)) : congr_arg (h a) ha.symm
127+
... = (gfp ∘ h) a : gfp_fixed_point $ λ b c hbc, m le_rfl hbc
128+
... = a : ha,
129+
end
122130

123131
end fixedpoint_eqn
124132

@@ -131,84 +139,72 @@ def next (x : α) : α := lfp (λ z, x ⊔ f z)
131139

132140
variable {f}
133141

134-
theorem prev_le {x : α} : prev f x ≤ x := gfp_le $ λ z hz, le_trans hz inf_le_left
142+
lemma prev_le {x : α} : prev f x ≤ x := gfp_le $ λ z hz, hz.trans inf_le_left
135143

136-
lemma prev_eq (hf : monotone f) {a : α} (h : f a ≤ a) : prev f a = f (prev f a) :=
137-
calc prev f a = a ⊓ f (prev f a) :
138-
gfp_eq $ show monotone (λz, a ⊓ f z), from assume x y h, inf_le_inf_left _ (hf h)
139-
... = f (prev f a) :
140-
inf_of_le_right $ le_trans (hf prev_le) h
144+
lemma prev_eq (hf : monotone f) {a : α} (h : f a ≤ a) : f (prev f a) = prev f a :=
145+
calc f (prev f a) = a ⊓ f (prev f a) : (inf_of_le_right $ (hf prev_le).trans h).symm
146+
... = prev f a : gfp_fixed_point $ λ x y h, inf_le_inf_left _ (hf h)
141147

142148
def prev_fixed (hf : monotone f) (a : α) (h : f a ≤ a) : fixed_points f :=
143-
⟨prev f a, (prev_eq hf h).symm
149+
⟨prev f a, prev_eq hf h⟩
144150

145-
theorem next_le {x : α} : x ≤ next f x := le_lfp $ λ z hz, le_trans le_sup_left hz
151+
lemma le_next {x : α} : x ≤ next f x := le_lfp $ λ z hz, le_sup_left.trans hz
146152

147-
lemma next_eq (hf : monotone f) {a : α} (h : a ≤ f a) : next f a = f (next f a) :=
148-
calc next f a = a ⊔ f (next f a) :
149-
lfp_eq $ show monotone (λz, a ⊔ f z), from assume x y h, sup_le_sup_left (hf h) _
150-
... = f (next f a) :
151-
sup_of_le_right $ le_trans h (hf next_le)
153+
lemma next_eq (hf : monotone f) {a : α} (h : a ≤ f a) : f (next f a) = next f a :=
154+
calc f (next f a) = a ⊔ f (next f a) : (sup_of_le_right $ h.trans (hf le_next)).symm
155+
... = next f a : lfp_fixed_point $ λ x y h, sup_le_sup_left (hf h) _
152156

153157
def next_fixed (hf : monotone f) (a : α) (h : a ≤ f a) : fixed_points f :=
154-
⟨next f a, (next_eq hf h).symm
158+
⟨next f a, next_eq hf h⟩
155159

156160
variable f
157161

158-
theorem sup_le_f_of_fixed_points (x y : fixed_points f) : x.1 ⊔ y.1 ≤ f (x.1 ⊔ y.1) :=
159-
sup_le
160-
(x.2 ▸ (hf $ show x.1 ≤ f x.1 ⊔ y.1, from x.2.symm ▸ le_sup_left))
161-
(y.2 ▸ (hf $ show y.1 ≤ x.1 ⊔ f y.1, from y.2.symm ▸ le_sup_right))
162+
lemma sup_le_f_of_fixed_points (x y : fixed_points f) : x.1 ⊔ y.1 ≤ f (x.1 ⊔ y.1) :=
163+
sup_le (x.2.ge.trans (hf le_sup_left)) (y.2.ge.trans (hf le_sup_right))
162164

163-
theorem f_le_inf_of_fixed_points (x y : fixed_points f) : f (x.1 ⊓ y.1) ≤ x.1 ⊓ y.1 :=
164-
le_inf
165-
(x.2 ▸ (hf $ show f (x.1) ⊓ y.1 ≤ x.1, from x.2.symm ▸ inf_le_left))
166-
(y.2 ▸ (hf $ show x.1 ⊓ f (y.1) ≤ y.1, from y.2.symm ▸ inf_le_right))
165+
lemma f_le_inf_of_fixed_points (x y : fixed_points f) : f (x.1 ⊓ y.1) ≤ x.1 ⊓ y.1 :=
166+
le_inf ((hf inf_le_left).trans x.2.le) ((hf inf_le_right).trans y.2.le)
167167

168-
theorem Sup_le_f_of_fixed_points (A : set α) (HA : A ⊆ fixed_points f) : Sup A ≤ f (Sup A) :=
169-
Sup_le $ λ x hxA, (HA hxA) ▸ (hf $ le_Sup hxA)
168+
lemma Sup_le_f_of_fixed_points (A : set α) (hA : A ⊆ fixed_points f) : Sup A ≤ f (Sup A) :=
169+
Sup_le $ λ x hx, (hA hx) ▸ (hf $ le_Sup hx)
170170

171-
theorem f_le_Inf_of_fixed_points (A : set α) (HA : A ⊆ fixed_points f) : f (Inf A) ≤ Inf A :=
172-
le_Inf $ λ x hxA, (HA hxA) ▸ (hf $ Inf_le hxA)
171+
lemma f_le_Inf_of_fixed_points (A : set α) (hA : A ⊆ fixed_points f) : f (Inf A) ≤ Inf A :=
172+
le_Inf $ λ x hx, (hA hx) ▸ (hf $ Inf_le hx)
173173

174-
/-- The fixed points of `f` form a complete lattice.
174+
/-- Knaster-Tarski Theorem: The fixed points of `f` form a complete lattice.
175175
This cannot be an instance, since it depends on the monotonicity of `f`. -/
176176
protected def complete_lattice : complete_lattice (fixed_points f) :=
177-
{ le := λx y, x.1 ≤ y.1,
178-
le_refl := λ x, le_refl x,
177+
{ le := (≤),
178+
le_refl := le_refl,
179179
le_trans := λ x y z, le_trans,
180-
le_antisymm := λ x y hx hy, subtype.eq $ le_antisymm hx hy,
180+
le_antisymm := λ x y, le_antisymm,
181181

182182
sup := λ x y, next_fixed hf (x.1 ⊔ y.1) (sup_le_f_of_fixed_points f hf x y),
183-
le_sup_left := λ x y, show x.1 ≤ _, from le_trans le_sup_left next_le,
184-
le_sup_right := λ x y, show y.1 ≤ _, from le_trans le_sup_right next_le,
183+
le_sup_left := λ x y, (le_sup_left.trans le_next : x.1 ≤ _),
184+
le_sup_right := λ x y, (le_sup_right.trans le_next : y.1 ≤ _),
185185
sup_le := λ x y z hxz hyz, lfp_le $ sup_le (sup_le hxz hyz) (z.2.symm ▸ le_refl z.1),
186186

187187
inf := λ x y, prev_fixed hf (x.1 ⊓ y.1) (f_le_inf_of_fixed_points f hf x y),
188-
inf_le_left := λ x y, show _ ≤ x.1, from le_trans prev_le inf_le_left,
189-
inf_le_right := λ x y, show _ ≤ y.1, from le_trans prev_le inf_le_right,
188+
inf_le_left := λ x y, (prev_le.trans inf_le_left : _ ≤ x.1),
189+
inf_le_right := λ x y, (prev_le.trans inf_le_right : _ ≤ y.1),
190190
le_inf := λ x y z hxy hxz, le_gfp $ le_inf (le_inf hxy hxz) (x.2.symm ▸ le_refl x),
191191

192192
top := prev_fixed hf ⊤ le_top,
193-
le_top := λ ⟨x, H⟩, le_gfp $ le_inf le_top (H.symm ▸ le_refl x),
193+
le_top := λ ⟨x, hx⟩, le_gfp $ le_inf le_top (hx.symm ▸ le_rfl),
194194

195195
bot := next_fixed hf ⊥ bot_le,
196-
bot_le := λ ⟨x, H⟩, lfp_le $ sup_le bot_le (H.symm ▸ le_refl x),
196+
bot_le := λ ⟨x, hx⟩, lfp_le $ sup_le bot_le (hx.symm ▸ le_rfl),
197197

198198
Sup := λ A, next_fixed hf (Sup $ subtype.val '' A)
199199
(Sup_le_f_of_fixed_points f hf (subtype.val '' A) (λ z ⟨x, hx⟩, hx.2 ▸ x.2)),
200-
le_Sup := λ A x hxA, show x.1 ≤ _, from le_trans
201-
(le_Sup $ show x.1 ∈ subtype.val '' A, from ⟨x, hxA, rfl⟩)
202-
next_le,
203-
Sup_le := λ A x Hx, lfp_le $ sup_le
204-
(Sup_le $ λ z ⟨y, hyA, hyz⟩, hyz ▸ Hx y hyA) (x.2.symm ▸ le_refl x),
200+
le_Sup := λ A x hx, (le_Sup $ show x.1 ∈ subtype.val '' A, from ⟨x, hx, rfl⟩).trans le_next,
201+
Sup_le := λ A x hx, lfp_le $ sup_le (Sup_le $ λ z ⟨y, hyA, hyz⟩, hyz ▸ hx y hyA)
202+
(x.2.symm ▸ le_rfl),
205203

206204
Inf := λ A, prev_fixed hf (Inf $ subtype.val '' A)
207205
(f_le_Inf_of_fixed_points f hf (subtype.val '' A) (λ z ⟨x, hx⟩, hx.2 ▸ x.2)),
208-
le_Inf := λ A x Hx, le_gfp $ le_inf
209-
(le_Inf $ λ z ⟨y, hyA, hyz⟩, hyz ▸ Hx y hyA) (x.2.symm ▸ le_refl x.1),
210-
Inf_le := λ A x hxA, show _ ≤ x.1, from le_trans
211-
prev_le
212-
(Inf_le $ show x.1 ∈ subtype.val '' A, from ⟨x, hxA, rfl⟩) }
206+
le_Inf := λ A x hx, le_gfp $ le_inf (le_Inf $ λ z ⟨y, hyA, hyz⟩, hyz ▸ hx y hyA)
207+
(x.2.symm ▸ le_rfl),
208+
Inf_le := λ A x hx, prev_le.trans (Inf_le $ show x.1 ∈ subtype.val '' A, from ⟨x, hx, rfl⟩)}
213209

214210
end fixed_points

0 commit comments

Comments
 (0)