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.Geometry.RicciFlow.Generalized.BoundedDistance.Predecessors.Necks.Ends.ChainShapeInterval |
| 3 | import Mathlib.Order.Monotone.Basic |
| 4 | |
| 5 | /-! |
| 6 | # Coherent limits of finite neck chains |
| 7 | |
| 8 | Literal retention on nested finite active intervals determines a chain |
| 9 | on their union. Every frozen field uses at most two indices and thus |
| 10 | comes from one finite stage. This is the limit construction for |
| 11 | Morgan--Tian A.17-A.19, pp. 506-508; covering-chain plan K2 in |
| 12 | tasks/M25/case-local/maximal-chain-plan.md. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set |
| 18 | open scoped Manifold ContDiff ENNReal |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.BalancedNeckChain |
| 23 | |
| 24 | /-- A coherent sequence of finite chains gives a chain on the exact union |
| 25 | of their active indices, retaining every active neck literally. |
| 26 | MT A.17-A.19, pp. 506-508; covering-chain plan K2. -/ |
| 27 | theorem exists_coherent_finite_limit |
| 28 | {M : Type u} [TopologicalSpace M] |
| 29 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 30 | [IsManifold (𝓡 3) ∞ M] |
| 31 | {g : RiemannianMetric 3 M} {epsilon : ℝ} |
| 32 | (C : ℕ → BalancedNeckChain g epsilon) (a b : ℕ → ℤ) |
| 33 | (hshape : ∀ n, (C n).shape = ChainShape.finite (a n) (b n)) |
| 34 | (hmono : ∀ n, (C n).shape.active ⊆ (C (n + 1)).shape.active) |
| 35 | (hretain : ∀ n, ∀ i ∈ (C n).shape.active, |
| 36 | (C (n + 1)).neck i = (C n).neck i) |
| 37 | (hsource : ∀ n, (C n).source_necks = (C 0).source_necks) : |
| 38 | ∃ D : BalancedNeckChain g epsilon, |
| 39 | D.shape.active = (⋃ n, (C n).shape.active) ∧ |
| 40 | D.source_necks = (C 0).source_necks ∧ |
| 41 | ∀ n, ∀ i ∈ (C n).shape.active, D.neck i = (C n).neck i := by |
| 42 | classical |
| 43 | have hmonoAll : Monotone (fun n => (C n).shape.active) := monotone_nat_of_le_succ hmono |
| 44 | have hretainAll {n m : ℕ} (hnm : n ≤ m) {i : ℤ} (hi : i ∈ (C n).shape.active) : |
| 45 | (C m).neck i = (C n).neck i := by |
| 46 | induction m, hnm using Nat.le_induction with |
| 47 | | base => rfl |
| 48 | | succ m hnm ih => exact (hretain m i (hmonoAll hnm hi)).trans ih |
| 49 | let A := ⋃ n, (C n).shape.active |
| 50 | have hAnonempty : A.Nonempty := by |
| 51 | obtain ⟨i, hi⟩ := (C 0).active_nonempty |
| 52 | exact ⟨i, mem_iUnion.mpr ⟨0, hi⟩⟩ |
| 53 | have hcommon {i j : ℤ} (hi : i ∈ A) (hj : j ∈ A) : |
| 54 | ∃ n, i ∈ (C n).shape.active ∧ j ∈ (C n).shape.active := by |
| 55 | obtain ⟨n, hn⟩ := mem_iUnion.mp hi |
| 56 | obtain ⟨m, hm⟩ := mem_iUnion.mp hj |
| 57 | exact ⟨max n m, hmonoAll (Nat.le_max_left _ _) hn, |
| 58 | hmonoAll (Nat.le_max_right _ _) hm⟩ |
| 59 | have hAord : OrdConnected A := by |
| 60 | constructor |
| 61 | intro i hi j hj z hz |
| 62 | obtain ⟨n, hni, hnj⟩ := hcommon hi hj |
| 63 | have hiI : i ∈ Icc (a n) (b n) := by simpa only [hshape n, ChainShape.active] using hni |
| 64 | have hjI : j ∈ Icc (a n) (b n) := by simpa only [hshape n, ChainShape.active] using hnj |
| 65 | refine mem_iUnion.mpr ⟨n, ?_⟩ |
| 66 | simpa only [hshape n, ChainShape.active] using |
| 67 | (show z ∈ Icc (a n) (b n) from ⟨hiI.1.trans hz.1, hz.2.trans hjI.2⟩) |
| 68 | obtain ⟨shape, hactive⟩ := ChainShape.exists_active_eq_of_ordConnected A hAnonempty hAord |
| 69 | let neck : ℤ → EpsilonNeck g := fun i => |
| 70 | if h : i ∈ A then (C (mem_iUnion.mp h).choose).neck i else (C 0).neck i |
| 71 | have hneck (n : ℕ) (i : ℤ) (hi : i ∈ (C n).shape.active) : neck i = (C n).neck i := by |
| 72 | have hA : i ∈ A := mem_iUnion.mpr ⟨n, hi⟩ |
| 73 | dsimp only [neck] |
| 74 | rw [dif_pos hA] |
| 75 | let k := (mem_iUnion.mp hA).choose |
| 76 | have hk : i ∈ (C k).shape.active := (mem_iUnion.mp hA).choose_spec |
| 77 | exact (hretainAll (Nat.le_max_left k n) hk).symm.trans |
| 78 | (hretainAll (Nat.le_max_right k n) hi) |
| 79 | let D : BalancedNeckChain g epsilon := |
| 80 | { shape := shape |
| 81 | neck := neck |
| 82 | source_necks := (C 0).source_necks |
| 83 | selected := by |
| 84 | intro i hi |
| 85 | rw [hactive] at hi |
| 86 | obtain ⟨n, hn⟩ := mem_iUnion.mp hi |
| 87 | rw [hneck n i hn, ← hsource n] |
| 88 | exact (C n).selected i hn |
| 89 | active_nonempty := hactive ▸ hAnonempty |
| 90 | epsilon_eq := by |
| 91 | intro i hi |
| 92 | rw [hactive] at hi |
| 93 | obtain ⟨n, hn⟩ := mem_iUnion.mp hi |
| 94 | rw [hneck n i hn] |
| 95 | exact (C n).epsilon_eq i hn |
| 96 | centers_distinct := by |
| 97 | intro i hi j hj hij |
| 98 | rw [hactive] at hi hj |
| 99 | obtain ⟨n, hni, hnj⟩ := hcommon hi hj |
| 100 | rw [hneck n i hni, hneck n j hnj] |
| 101 | exact (C n).centers_distinct hni hnj hij |
| 102 | adjacent_overlap := by |
| 103 | intro i hi hj |
| 104 | rw [hactive] at hi hj |
| 105 | obtain ⟨n, hni, hnj⟩ := hcommon hi hj |
| 106 | rw [hneck n i hni, hneck n (i + 1) hnj] |
| 107 | exact (C n).adjacent_overlap i hni hnj |
| 108 | overlap_contains_quarters := by |
| 109 | intro i hi hj |
| 110 | rw [hactive] at hi hj |
| 111 | obtain ⟨n, hni, hnj⟩ := hcommon hi hj |
| 112 | rw [hneck n i hni, hneck n (i + 1) hnj] |
| 113 | exact (C n).overlap_contains_quarters i hni hnj |
| 114 | overlap_within_three_quarters := by |
| 115 | intro i hi hj |
| 116 | rw [hactive] at hi hj |
| 117 | obtain ⟨n, hni, hnj⟩ := hcommon hi hj |
| 118 | rw [hneck n i hni, hneck n (i + 1) hnj] |
| 119 | exact (C n).overlap_within_three_quarters i hni hnj |
| 120 | later_disjoint_negative_end := by |
| 121 | intro i hi j hj hij |
| 122 | rw [hactive] at hi hj |
| 123 | obtain ⟨n, hni, hnj⟩ := hcommon hi hj |
| 124 | rw [hneck n i hni, hneck n j hnj] |
| 125 | exact (C n).later_disjoint_negative_end i hni j hnj hij |
| 126 | balanced_center_distance := by |
| 127 | intro i hi hj |
| 128 | rw [hactive] at hi hj |
| 129 | obtain ⟨n, hni, hnj⟩ := hcommon hi hj |
| 130 | rw [hneck n i hni, hneck n (i + 1) hnj] |
| 131 | exact (C n).balanced_center_distance i hni hnj } |
| 132 | exact ⟨D, hactive, rfl, hneck⟩ |
| 133 | |
| 134 | end PoincareMT.BalancedNeckChain |