Poincaré conjecture: the Lean proof, cleaned up together
The 2026 Lean proof of the Poincaré conjecture after Morgan and Tian, 3 million lines, cleaned up together: smaller, faster to build, more readable, the theorems unchanged

| 1 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Calculus.ODE.Extension.ClosedLeftNeighborhood |
| 2 | import Mathlib.Topology.Order.IntermediateValue |
| 3 | |
| 4 | /-! |
| 5 | # Propagation of properties on closed real prefixes |
| 6 | |
| 7 | Morgan-Tian Lemma 6.18, pp. 113-114. A supremum argument propagates |
| 8 | a downward-closed prefix property when common local restarts reach |
| 9 | every limiting time and pass every interior time. No closedness of |
| 10 | the set of good prefixes is assumed. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set Filter |
| 16 | open scoped Topology |
| 17 | |
| 18 | namespace PoincareMT.M14 |
| 19 | |
| 20 | /-- A relative closed neighborhood has a strict right margin at |
| 21 | every point before the ambient right endpoint, the interior-time |
| 22 | restart condition in Lemma 6.18, pp. 113-114. -/ |
| 23 | theorem right_lt_of_Icc_mem_nhdsWithin {a b c d t : ℝ} (hat : a ≤ t) (htb : t < b) |
| 24 | (hnear : Icc c d ∈ 𝓝[Icc a b] t) : t < d := by |
| 25 | obtain ⟨N, hN, htN, hsub⟩ := mem_nhdsWithin.mp hnear |
| 26 | obtain ⟨l, u, ⟨hlt, htu⟩, hln⟩ := |
| 27 | mem_nhds_iff_exists_Ioo_subset.mp (hN.mem_nhds htN) |
| 28 | obtain ⟨q, htq, hq⟩ := exists_between (lt_min htb htu) |
| 29 | exact htq.trans_le (hsub ⟨hln ⟨hlt.trans htq, hq.trans_le (min_le_right _ _)⟩, |
| 30 | hat.trans htq.le, hq.le.trans (min_le_left _ _)⟩).2 |
| 31 | |
| 32 | /-- A downward-closed real prefix property propagates to the final |
| 33 | endpoint if a common restart from any sufficiently nearby earlier |
| 34 | good prefix reaches each limit and passes every interior limit. |
| 35 | This is the closed-endpoint continuation argument of Lemma 6.18, |
| 36 | pp. 113-114. -/ |
| 37 | theorem closedPrefix_propagation {a b : ℝ} (P : ℝ → Prop) |
| 38 | (hmono : ∀ {r s : ℝ}, P r → s ∈ Icc a r → P s) |
| 39 | (hinit : ∃ r ∈ Ioc a b, P r) |
| 40 | (hstep : ∀ t ∈ Ioc a b, ∃ c d : ℝ, a ≤ c ∧ c < t ∧ t ≤ d ∧ d ≤ b ∧ |
| 41 | (t < b → t < d) ∧ ∀ r ∈ Ioo c t, P r → P d) : P b := by |
| 42 | let B := {r | r ∈ Icc a b ∧ P r} |
| 43 | obtain ⟨r₀, hr₀, hP₀⟩ := hinit |
| 44 | have hB : B.Nonempty := ⟨r₀, ⟨hr₀.1.le, hr₀.2⟩, hP₀⟩ |
| 45 | have hbound : BddAbove B := ⟨b, fun _ hr => hr.1.2⟩ |
| 46 | let t := sSup B |
| 47 | have hrt : r₀ ≤ t := le_csSup hbound ⟨⟨hr₀.1.le, hr₀.2⟩, hP₀⟩ |
| 48 | have hat : a < t := hr₀.1.trans_le hrt |
| 49 | have htb : t ≤ b := csSup_le hB (fun _ hr => hr.1.2) |
| 50 | obtain ⟨c, d, hac, hct, htd, hdb, hstrict, hrestart⟩ := hstep t ⟨hat, htb⟩ |
| 51 | obtain ⟨m, hcm, hmt⟩ := exists_between hct |
| 52 | obtain ⟨q, hq, hmq⟩ := exists_lt_of_lt_csSup hB hmt |
| 53 | have hPd : P d := hrestart m ⟨hcm, hmt⟩ |
| 54 | (hmono hq.2 ⟨hac.trans hcm.le, hmq.le⟩) |
| 55 | have hdt : d ≤ t := le_csSup hbound ⟨⟨hat.le.trans htd, hdb⟩, hPd⟩ |
| 56 | have hbt : b ≤ t := le_of_not_gt (fun hlt => (hstrict hlt).not_ge hdt) |
| 57 | have hdb' : d = b := le_antisymm hdb (hbt.trans htd) |
| 58 | exact hdb' ▸ hPd |
| 59 | |
| 60 | end PoincareMT.M14 |