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.BoundedDistance.GeometryImports |
| 2 | import PoincareLib.Topology.Manifold.NeckCap.Theory |
| 3 | import Mathlib.Data.Int.ConditionallyCompleteOrder |
| 4 | import Mathlib.Order.Interval.Set.OrdConnected |
| 5 | |
| 6 | /-! |
| 7 | # Integer intervals and the four chain shapes |
| 8 | |
| 9 | A nonempty order-connected integer set has attained endpoints whenever |
| 10 | bounded. It is therefore exactly one of the four active domains in |
| 11 | Morgan--Tian A.12-A.18, pp. 504-507. See the reviewed fair finite-extension |
| 12 | plan, K1, in tasks/M25/case-local/maximal-chain-plan.md. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set |
| 18 | |
| 19 | namespace PoincareMT.ChainShape |
| 20 | |
| 21 | /-- Every nonempty integer interval is the active set of a frozen chain |
| 22 | shape. MT A.12-A.18, pp. 504-507; covering-chain plan K1. -/ |
| 23 | theorem exists_active_eq_of_ordConnected (S : Set ℤ) |
| 24 | (hne : S.Nonempty) (hS : Set.OrdConnected S) : |
| 25 | ∃ shape : ChainShape, shape.active = S := by |
| 26 | classical |
| 27 | by_cases hl : BddBelow S |
| 28 | · have ha := Int.csInf_mem hne hl |
| 29 | by_cases hu : BddAbove S |
| 30 | · have hb := Int.csSup_mem hne hu |
| 31 | refine ⟨.finite (sInf S) (sSup S), ?_⟩ |
| 32 | ext x |
| 33 | exact ⟨fun hx => hS.out ha hb hx, fun hx => ⟨csInf_le hl hx, le_csSup hu hx⟩⟩ |
| 34 | · refine ⟨.forward (sInf S), ?_⟩ |
| 35 | ext x |
| 36 | constructor |
| 37 | · intro hx |
| 38 | obtain ⟨y, hy, hxy⟩ := not_bddAbove_iff.mp hu x |
| 39 | exact hS.out ha hy ⟨hx, hxy.le⟩ |
| 40 | · exact fun hx => csInf_le hl hx |
| 41 | · by_cases hu : BddAbove S |
| 42 | · have hb := Int.csSup_mem hne hu |
| 43 | refine ⟨.backward (sSup S), ?_⟩ |
| 44 | ext x |
| 45 | constructor |
| 46 | · intro hx |
| 47 | obtain ⟨y, hy, hyx⟩ := not_bddBelow_iff.mp hl x |
| 48 | exact hS.out hy hb ⟨hyx.le, hx⟩ |
| 49 | · exact fun hx => le_csSup hu hx |
| 50 | · refine ⟨.biInfinite, ?_⟩ |
| 51 | ext x |
| 52 | constructor |
| 53 | · intro _ |
| 54 | obtain ⟨y, hy, hyx⟩ := not_bddBelow_iff.mp hl x |
| 55 | obtain ⟨z, hz, hxz⟩ := not_bddAbove_iff.mp hu x |
| 56 | exact hS.out hy hz ⟨hyx.le, hxz.le⟩ |
| 57 | · exact fun _ => mem_univ x |
| 58 | |
| 59 | end PoincareMT.ChainShape |