Skip to content

Commit 0a8df7a

Browse files
committed
feat(Order/OmegaCompletePartialOrder): least fixed point and Scott induction
Add `lfp` for ω-Scott continuous endofunctions on an ωCPO with `⊥`, defined as the supremum of the iteration chain from `⊥`, together with its basic API (`map_lfp`, `isFixedPt_lfp`, `lfp_le_fixed`, `isLeast_lfp`) and a Scott induction principle `lfp_induction`. Also add corresponding induction principles for `Part.fix`: `fix_scott_induction` (ω-Scott continuous functional, admissible predicate) and `fix_scott_induction_pointwise` (no continuity hypothesis, conclusion of the form `Part.fix g x = some y → P x y`), supported by a helper `exists_approx_eq_of_fix_eq_some`.
1 parent 98261a9 commit 0a8df7a

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed

Mathlib/Control/LawfulFix.lean

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,15 @@ theorem fix_le {X : (a : _) → Part <| β a} (hX : f X ≤ X) : Part.fix f ≤
148148

149149
variable {g : ((a : _) → Part <| β a) → (a : _) → Part <| β a}
150150

151+
/-- If `y ∈ Part.fix g x`, then `y` is already in some finite approximation of `g` at `x`.
152+
The monotone analogue is `Part.Fix.mem_iff`. -/
153+
theorem exists_mem_approx_of_mem_fix {x} {y : β x}
154+
(h : y ∈ Part.fix g x) : ∃ n, y ∈ Fix.approx g n x := by
155+
by_cases h' : ∃ i, (Fix.approx g i x).Dom
156+
· exact ⟨_, (Part.fix_def g h') ▸ h⟩
157+
· rw [Part.fix_def' g h'] at h
158+
exact absurd h (Part.notMem_none _)
159+
151160
theorem fix_eq_ωSup_of_ωScottContinuous (hc : ωScottContinuous g) : Part.fix g =
152161
ωSup (approxChain (⟨g,hc.monotone⟩ : ((a : _) → Part <| β a) →o (a : _) → Part <| β a)) := by
153162
rw [← fix_eq_ωSup]
@@ -165,6 +174,33 @@ theorem fix_eq_of_ωScottContinuous (hc : ωScottContinuous g) :
165174
intro i
166175
exists i.succ
167176

177+
/-- **Scott induction** for `Part.fix`: for an ω-Scott continuous functional `g` and a
178+
predicate `p` that holds at `⊥`, is preserved by `g`, and is closed under ωSup of chains,
179+
`p` holds at `Part.fix g`. -/
180+
theorem fix_scott_induction {p : (∀ a, Part (β a)) → Prop} (hc : ωScottContinuous g)
181+
(h_bot : p ⊥) (h_step : ∀ f, p f → p (g f))
182+
(h_sup : ∀ c : Chain (∀ a, Part (β a)), (∀ n, p (c n)) → p (ωSup c)) :
183+
p (Part.fix g) := by
184+
rw [fix_eq_ωSup_of_ωScottContinuous hc]
185+
apply h_sup
186+
intro n
187+
induction n with
188+
| zero => exact h_bot
189+
| succ k ih => exact h_step _ ih
190+
191+
/-- Pointwise Scott induction for `Part.fix`: to prove `P x y` whenever `y ∈ Part.fix g x`,
192+
it suffices that for any approximation `f` on which `P` holds pointwise, `g f` still satisfies
193+
`P` pointwise. No continuity hypothesis is needed. -/
194+
theorem fix_scott_induction_pointwise {P : ∀ a, β a → Prop}
195+
(h_step : ∀ f, (∀ x y, y ∈ f x → P x y) → ∀ x y, y ∈ g f x → P x y)
196+
{x} {y : β x} (h : y ∈ Part.fix g x) : P x y := by
197+
obtain ⟨n, hn⟩ := exists_mem_approx_of_mem_fix h
198+
suffices key : ∀ n x (y : β x), y ∈ Fix.approx g n x → P x y from key _ _ _ hn
199+
intro n
200+
induction n with
201+
| zero => intro _ _ hh; exact absurd hh (Part.notMem_none _)
202+
| succ _ ih => exact h_step _ ih
203+
168204
end Part
169205

170206
namespace Part

Mathlib/Order/OmegaCompletePartialOrder.lean

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ supremum helps define the meaning of recursive procedures.
5454
* [Chain-complete posets and directed sets with applications][markowsky1976]
5555
* [Recursive definitions of partial functions and their computations][cadiou1972]
5656
* [Semantics of Programming Languages: Structures and Techniques][gunter1992]
57+
* [Denotational Semantics][pitts2012denotational]
5758
-/
5859

5960
@[expose] public section
@@ -854,6 +855,45 @@ theorem ωSup_iterate_le_fixedPoint (h : x ≤ f x) {a : α}
854855
obtain h_a := Eq.le h_a
855856
exact ωSup_iterate_le_prefixedPoint f x h h_a h_x_le_a
856857

858+
section OrderBot
859+
860+
variable [OrderBot α] (f : α →𝒄 α)
861+
862+
/-- The least fixed point of an ω-Scott continuous function on an ω-complete partial order
863+
with a bottom element, defined as the supremum of the chain `⊥, f ⊥, f (f ⊥), …`. -/
864+
def lfp : α := ωSup (iterateChain f.toOrderHom ⊥ bot_le)
865+
866+
/-- `lfp f` is a fixed point of `f`. -/
867+
theorem map_lfp : f (lfp f) = lfp f :=
868+
ωSup_iterate_mem_fixedPoint f ⊥ bot_le
869+
870+
theorem isFixedPt_lfp : IsFixedPt f (lfp f) := map_lfp f
871+
872+
/-- `lfp f` is below every fixed point of `f`. -/
873+
theorem lfp_le_fixed {a : α} (h : f a = a) : lfp f ≤ a :=
874+
ωSup_iterate_le_fixedPoint f ⊥ bot_le h bot_le
875+
876+
/-- `lfp f` is the least fixed point of `f`. -/
877+
theorem isLeast_lfp : IsLeast (fixedPoints f) (lfp f) :=
878+
⟨isFixedPt_lfp f, fun _ ha => lfp_le_fixed f ha⟩
879+
880+
/-- **Scott induction** for `lfp`: to prove a predicate `p` of `lfp f`, it suffices to show
881+
`p ⊥`, that `p` is preserved by `f`, and that `p` is closed under ωSup of chains. -/
882+
theorem lfp_induction {p : α → Prop} (h_bot : p ⊥) (h_step : ∀ a, p a → p (f a))
883+
(h_sup : ∀ c : Chain α, (∀ n, p (c n)) → p (ωSup c)) : p (lfp f) := by
884+
apply h_sup
885+
intro n
886+
induction n with
887+
| zero => exact h_bot
888+
| succ k ih =>
889+
have hstep : iterateChain f.toOrderHom ⊥ bot_le (k + 1) =
890+
f (iterateChain f.toOrderHom ⊥ bot_le k) :=
891+
Function.iterate_succ_apply' ..
892+
rw [hstep]
893+
exact h_step _ ih
894+
895+
end OrderBot
896+
857897
end fixedPoints
858898

859899
end OmegaCompletePartialOrder

docs/references.bib

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4621,6 +4621,15 @@ @Book{ picado2012
46214621
doi = {10.1007/978-3-0348-0154-6}
46224622
}
46234623

4624+
@Misc{ pitts2012denotational,
4625+
title = {Denotational Semantics},
4626+
author = {Pitts, Andrew M.},
4627+
year = {2012},
4628+
note = {Lecture notes, Computer Laboratory, University of
4629+
Cambridge},
4630+
url = {https://www.cl.cam.ac.uk/teaching/1112/DenotSem/dens-notes-bw.pdf}
4631+
}
4632+
46244633
@Misc{ poeschel2017siegelsternberg,
46254634
title = {On the Siegel-Sternberg linearization theorem},
46264635
author = {Jürgen Pöschel},

0 commit comments

Comments
 (0)