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.Tube.SourceGeometry.Geometry.SourceOrientedListIndices |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.SourceGeometry.Geometry.SourceCenterDistinct |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.SourceGeometry.Limits.SourceActualLaterCuts |
| 5 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.SourceGeometry.Geometry.SourceLiteralChainAssembly |
| 6 | import PoincareLib.Topology.Manifold.NeckCap.Chain.Union |
| 7 | |
| 8 | /-! |
| 9 | # The actual finite balanced source chain |
| 10 | |
| 11 | Every field of the chain is filled from the one oriented source list and |
| 12 | the whole regional minimum. The literal neck function and source set are |
| 13 | retained, so the original path coverage passes to the actual carrier union. |
| 14 | See derivation 54, MT Claim 10.4 and the signed overlap route, step 6. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set |
| 21 | open scoped Manifold ContDiff Bundle Topology ENNReal |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace PoincareMT.M28 |
| 26 | |
| 27 | open PoincareMT.EpsilonNeck |
| 28 | |
| 29 | /-- Construct the actual balanced chain from the selected minimizer. Its |
| 30 | neck function is the literal source list, not an unrelated finite chain. -/ |
| 31 | theorem exists_actual_source_balanced_chain_accuracy : |
| 32 | ∃ epsilon₀ : ℝ, 0 < epsilon₀ ∧ epsilon₀ ≤ (1 / 10000 : ℝ) ∧ |
| 33 | ∀ {epsilon C A D₀ D : ℝ} (E : SameTimeCounterexample.{u} epsilon C A D₀ D) |
| 34 | (S : CounterexampleNeckSegment E), |
| 35 | 0 < E.flow.scalar ⟨E.time, E.basepoint⟩ → epsilon ≤ epsilon₀ → |
| 36 | ∃ (L : SourceOrientedList S) (B : BalancedNeckChain (E.flow.metric E.time) epsilon), |
| 37 | B.shape = ChainShape.finite 0 (L.nodes.length - 1) ∧ |
| 38 | B.neck = neckOfList (L.nodes.map Prod.snd) (L.nodes.head L.nonempty).2 ∧ |
| 39 | B.source_necks = S.cover.necks ∧ S.cover.X ⊆ B.unionOpen := by |
| 40 | obtain ⟨epsilonL, hLpos, hLsmall, hL⟩ := exists_source_oriented_list_accuracy.{u} |
| 41 | obtain ⟨epsilonK, hKpos, _, hK⟩ := exists_actual_later_negative_cut_accuracy.{u} |
| 42 | refine ⟨min epsilonL epsilonK, lt_min hLpos hKpos, |
| 43 | (min_le_left _ _).trans hLsmall, ?_⟩ |
| 44 | intro epsilon C A D₀ D E S hbase hsmall |
| 45 | obtain ⟨L⟩ := hL E S hbase (hsmall.trans (min_le_left _ _)) |
| 46 | let l := L.nodes.map Prod.snd |
| 47 | let fallback := (L.nodes.head L.nonempty).2 |
| 48 | have hactive : (Icc (0 : ℤ) (l.length - 1)).Nonempty := by |
| 49 | simpa only [l, List.length_map, SourceOrientedList.active] using L.active_nonempty |
| 50 | have hactive_iff (i : ℤ) : i ∈ Icc (0 : ℤ) (l.length - 1) ↔ i ∈ L.active := by |
| 51 | simp only [l, List.length_map, SourceOrientedList.active] |
| 52 | have hneck (i : ℤ) : neckOfList l fallback i = (L.node i).2 := |
| 53 | L.neckOfList_eq_node i |
| 54 | have hsource (i : ℤ) (hi : i ∈ Icc (0 : ℤ) (l.length - 1)) : |
| 55 | ∃ N ∈ S.cover.necks, (neckOfList l fallback i).SameUpToReversal N := by |
| 56 | obtain ⟨N, hN, hchoice, _⟩ := L.node_provenance ((hactive_iff i).mp hi) |
| 57 | refine ⟨N, hN, ?_⟩ |
| 58 | rw [hneck] |
| 59 | rcases hchoice with h | h |
| 60 | · simpa only [h] using SameUpToReversal.refl N |
| 61 | · simpa only [h] using N.reversed_sameUpToReversal |
| 62 | have heps (i : ℤ) (hi : i ∈ Icc (0 : ℤ) (l.length - 1)) : |
| 63 | (neckOfList l fallback i).epsilon = epsilon := by |
| 64 | rw [hneck] |
| 65 | exact L.node_epsilon ((hactive_iff i).mp hi) |
| 66 | have hedge (i : ℤ) (hi : i ∈ Icc (0 : ℤ) (l.length - 1)) |
| 67 | (hnext : i + 1 ∈ Icc (0 : ℤ) (l.length - 1)) : |
| 68 | SourceEdgePacket (neckOfList l fallback i) (neckOfList l fallback (i + 1)) epsilon := by |
| 69 | obtain ⟨_, _, _, H⟩ := L.node_edge ((hactive_iff i).mp hi) |
| 70 | ((hactive_iff (i + 1)).mp hnext) |
| 71 | simpa only [hneck] using H |
| 72 | have hcenter_ne (i j : ℤ) (hi : i ∈ L.active) (hj : j ∈ L.active) |
| 73 | (hij : i < j) : (L.node i).2.center ≠ (L.node j).2.center := by |
| 74 | have hnext : i + 1 ∈ L.active := by |
| 75 | change 0 ≤ i + 1 ∧ i + 1 ≤ (L.nodes.length : ℤ) - 1 |
| 76 | have := hi.1 |
| 77 | have := hj.2 |
| 78 | omega |
| 79 | obtain ⟨_, _, H, _⟩ := L.node_edge hi hnext |
| 80 | have hnextj : (L.node (i + 1)).1 ≤ (L.node j).1 := by |
| 81 | by_cases h : i + 1 = j |
| 82 | · simp only [h, le_refl] |
| 83 | · exact (L.node_time_lt hnext hj (by omega)).le |
| 84 | exact H.center_ne_later_center |
| 85 | (S.lower_pos.le.trans (L.node_time_mem hi).1) |
| 86 | (L.node_time_lt hi hnext (by omega)) hnextj |
| 87 | ((L.node_time_mem hj).2.trans S.upper_lt_one.le) |
| 88 | S.path_smooth S.source_region.path_mem S.source_region.finite_length |
| 89 | S.source_region.minimizing (L.node_center hj) |
| 90 | have hdistinct (i : ℤ) (hi : i ∈ Icc (0 : ℤ) (l.length - 1)) |
| 91 | (j : ℤ) (hj : j ∈ Icc (0 : ℤ) (l.length - 1)) (hij : i ≠ j) : |
| 92 | (neckOfList l fallback i).center ≠ (neckOfList l fallback j).center := by |
| 93 | rw [hneck, hneck] |
| 94 | rcases lt_or_gt_of_ne hij with h | h |
| 95 | · exact hcenter_ne i j ((hactive_iff i).mp hi) ((hactive_iff j).mp hj) h |
| 96 | · exact (hcenter_ne j i ((hactive_iff j).mp hj) ((hactive_iff i).mp hi) h).symm |
| 97 | have hcut (i : ℤ) (hi : i ∈ Icc (0 : ℤ) (l.length - 1)) |
| 98 | (j : ℤ) (hj : j ∈ Icc (0 : ℤ) (l.length - 1)) (hij : i < j) : |
| 99 | ∃ s ∈ Ioo (-epsilon⁻¹) 0, |
| 100 | Disjoint (neckOfList l fallback j).carrier |
| 101 | ((neckOfList l fallback i).region (-epsilon⁻¹) s) := by |
| 102 | have hA : 0 < epsilon⁻¹ := inv_pos.mpr (S.cover_epsilon ▸ S.cover.epsilon_pos) |
| 103 | refine ⟨-epsilon⁻¹ / 2, ⟨by linarith, by linarith⟩, ?_⟩ |
| 104 | rw [hneck, hneck] |
| 105 | have hi' := (hactive_iff i).mp hi |
| 106 | have hj' := (hactive_iff j).mp hj |
| 107 | have hnext : i + 1 ∈ L.active := by |
| 108 | change 0 ≤ i + 1 ∧ i + 1 ≤ (L.nodes.length : ℤ) - 1 |
| 109 | have := hi'.1 |
| 110 | have := hj'.2 |
| 111 | omega |
| 112 | obtain ⟨R, hR, H₀, Hpacket⟩ := L.node_edge hi' hnext |
| 113 | by_cases hadj : j = i + 1 |
| 114 | · simpa only [hadj] using Hpacket.later_negative_cut |
| 115 | · have hnext₂ : i + 2 ∈ L.active := by |
| 116 | change 0 ≤ i + 2 ∧ i + 2 ≤ (L.nodes.length : ℤ) - 1 |
| 117 | have := hi'.1 |
| 118 | have := hj'.2 |
| 119 | omega |
| 120 | obtain ⟨V, hV, H₁, _⟩ := L.node_edge hnext |
| 121 | (by simpa only [add_assoc, show (1 : ℤ) + 1 = 2 by norm_num] using hnext₂) |
| 122 | obtain ⟨N₀, hN₀, hNchoice, _⟩ := L.node_provenance hi' |
| 123 | obtain ⟨P₀, hP₀, hPchoice, _⟩ := L.node_provenance hj' |
| 124 | have htime₂ : (L.node (i + 2)).1 ≤ (L.node j).1 := by |
| 125 | by_cases h : i + 2 = j |
| 126 | · simp only [h, le_refl] |
| 127 | · exact (L.node_time_lt hnext₂ hj' (by omega)).le |
| 128 | apply hK E S hbase (hsmall.trans (min_le_right _ _)) N₀ hN₀ P₀ hP₀ |
| 129 | (L.node i).2 (L.node j).2 (L.node (i + 1)).2 R (L.node (i + 2)).2 V |
| 130 | hNchoice hPchoice (L.node i).1 (L.node_time_mem hi') |
| 131 | (L.node j).1 (L.node_time_mem hj') (L.node (i + 1)).1 (L.node (i + 2)).1 |
| 132 | (L.node_time_lt hi' hnext (by omega)) (L.node_time_lt hnext hnext₂ (by omega)) |
| 133 | htime₂ H₀ ?_ (L.node_center hj') |
| 134 | simpa only [add_assoc, show (1 : ℤ) + 1 = 2 by norm_num] using H₁ |
| 135 | obtain ⟨B, hshape, hnecks, hsources⟩ := |
| 136 | exists_literal_source_balanced_chain_of_edge_packets l fallback epsilon hactive |
| 137 | S.cover.necks hsource heps hdistinct hedge hcut |
| 138 | refine ⟨L, B, by simpa only [l, List.length_map] using hshape, hnecks, hsources, ?_⟩ |
| 139 | rw [S.cover_set] |
| 140 | rintro x ⟨t, ht, rfl⟩ |
| 141 | obtain ⟨p, hp, hx⟩ := L.covers ht |
| 142 | obtain ⟨k, hk⟩ := List.mem_iff_get.mp hp |
| 143 | let i : ℤ := k.val |
| 144 | have hi : i ∈ L.active := by |
| 145 | change 0 ≤ (k.val : ℤ) ∧ (k.val : ℤ) ≤ (L.nodes.length : ℤ) - 1 |
| 146 | have := k.isLt |
| 147 | omega |
| 148 | have hnode : L.node i = p := by |
| 149 | change L.nodes.getD (k.val : ℤ).toNat (L.nodes.head L.nonempty) = p |
| 150 | simpa only [Int.toNat_natCast] using |
| 151 | (List.getD_eq_get L.nodes (L.nodes.head L.nonempty) k).trans hk |
| 152 | change S.path t ∈ ⋃ j : {j // j ∈ B.shape.active}, (B.neck j.1).carrier |
| 153 | refine mem_iUnion.mpr ⟨⟨i, ?_⟩, ?_⟩ |
| 154 | · rw [hshape] |
| 155 | exact (hactive_iff i).mpr hi |
| 156 | · rw [hnecks, hneck, hnode] |
| 157 | exact hx |
| 158 | |
| 159 | end PoincareMT.M28 |