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.CapGeometry.CapOverlapCompactEnd |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Cylinders.CylinderSphereCoordinates |
| 4 | |
| 5 | /-! |
| 6 | # Compact capture of the actual attached tube end |
| 7 | |
| 8 | Morgan--Tian Claim 10.3, printed pp. 248-249. A selected sphere disjoint |
| 9 | from the cap excludes one tube end from the connected overlap. The |
| 10 | previously produced compact overlap end must therefore approach the |
| 11 | attached tube end. Connectedness then captures an entire attached tail |
| 12 | in the actual compact cap recut. See the six-step compact-set derivation |
| 13 | in the recentered-confinement task record. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set |
| 19 | open scoped Manifold ContDiff Bundle Topology |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.OpenCylinderModel |
| 24 | |
| 25 | variable {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] {U : Set M} |
| 27 | |
| 28 | private theorem half_tail_not_subset_compact (T : OpenCylinderModel U) |
| 29 | (side : Bool) {K : Set M} (hK : IsCompact K) (hKU : K ⊆ U) : |
| 30 | ∃ x ∈ T.tail side (1 / 2), x ∉ K := by |
| 31 | obtain ⟨a, b, ha, _, hb, hcapture⟩ := T.exists_compactSlab_capturing hK hKU |
| 32 | cases side |
| 33 | · obtain ⟨x, hx⟩ := T.tail_nonempty false |
| 34 | (lt_min ha (by norm_num : (0 : ℝ) < 1 / 2)) |
| 35 | ((min_le_right a (1 / 2 : ℝ)).trans_lt (by norm_num)) |
| 36 | have hx' := (T.mem_tail_iff_m28 false (lt_min ha (by norm_num)) |
| 37 | ((min_le_right a (1 / 2 : ℝ)).trans_lt (by norm_num))).mp hx |
| 38 | refine ⟨x, (T.mem_tail_iff_m28 false (by norm_num) (by norm_num)).mpr |
| 39 | ⟨hx'.1, hx'.2.trans_le (min_le_right _ _)⟩, ?_⟩ |
| 40 | intro hxK |
| 41 | have hslab := (T.mem_compactSlab_iff ha hb).mp (hcapture hxK) |
| 42 | exact (not_lt_of_ge hslab.2.1) (hx'.2.trans_le (min_le_left _ _)) |
| 43 | · obtain ⟨x, hx⟩ := T.tail_nonempty true |
| 44 | ((by norm_num : (0 : ℝ) < 1 / 2).trans_le (le_max_right b (1 / 2 : ℝ))) |
| 45 | (max_lt hb (by norm_num : (1 / 2 : ℝ) < 1)) |
| 46 | have hx' := (T.mem_tail_iff_m28 true |
| 47 | ((by norm_num : (0 : ℝ) < 1 / 2).trans_le (le_max_right b (1 / 2 : ℝ))) |
| 48 | (max_lt hb (by norm_num))).mp hx |
| 49 | refine ⟨x, (T.mem_tail_iff_m28 true (by norm_num) (by norm_num)).mpr |
| 50 | ⟨hx'.1, (le_max_right _ _).trans_lt hx'.2⟩, ?_⟩ |
| 51 | intro hxK |
| 52 | have hslab := (T.mem_compactSlab_iff ha hb).mp (hcapture hxK) |
| 53 | exact (not_lt_of_ge hslab.2.2) ((le_max_left _ _).trans_lt hx'.2) |
| 54 | |
| 55 | end PoincareMT.OpenCylinderModel |
| 56 | |
| 57 | namespace PoincareMT.CapTubeAttachment |
| 58 | |
| 59 | variable {M : Type u} [TopologicalSpace M] |
| 60 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 61 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 62 | [T2Space M] [T3Space M] {g : RiemannianMetric 3 M} |
| 63 | {X : Set M} {cap : CapCertificate g} {tube : EpsilonTubeCertificate g X} |
| 64 | {side : Bool} |
| 65 | |
| 66 | /-- The actual attached tube end has a compact closure inside the cap |
| 67 | whenever an actual cylinder-isotopic sphere is cap-disjoint. End matching |
| 68 | is proved from the overlap cylinder and cap recuts (Claim 10.3). -/ |
| 69 | theorem exists_compact_attached_tail (A : CapTubeAttachment cap tube side) |
| 70 | {S : Set M} (hS : SmoothSphereIsotopicIn tube.carrier S tube.cylinder.middleSphere) |
| 71 | (hcapS : Disjoint cap.carrier S) : |
| 72 | ∃ a : ℝ, 0 < a ∧ a < 1 ∧ |
| 73 | IsCompact (closure (tube.cylinder.tail side a)) ∧ |
| 74 | closure (tube.cylinder.tail side a) ⊆ cap.carrier := by |
| 75 | classical |
| 76 | let U : TopologicalSpace.Opens M := ⟨tube.carrier, tube.carrier_open⟩ |
| 77 | let O : Set M := cap.carrier ∩ tube.carrier |
| 78 | let E := A.overlap_model |
| 79 | let T := tube.cylinder |
| 80 | obtain ⟨φ, lo, hi, hlo, hlohalf, hhalfhi, hhi, hsphere, hfix⟩ := |
| 81 | T.exists_isotopic_sphere_coordinates (U := U) hS |
| 82 | have hs : IsConnected (Metric.sphere (0 : EuclideanSpace ℝ (Fin 3)) 1) := |
| 83 | isConnected_sphere (by rw [← Module.finrank_eq_rank]; norm_num) _ (by norm_num) |
| 84 | let : ConnectedSpace UnitTwoSphere := Subtype.connectedSpace hs |
| 85 | let : ConnectedSpace (Ioo (0 : ℝ) 1) := Subtype.connectedSpace (isConnected_Ioo zero_lt_one) |
| 86 | let : ConnectedSpace O := E.homeomorph.surjective.connectedSpace E.homeomorph.continuous |
| 87 | let ι : O → U := fun x => ⟨x, x.property.2⟩ |
| 88 | let f : O → ℝ := fun x => ((φ (ι x)).2 : ℝ) |
| 89 | have hι : Continuous ι := continuous_subtype_val.subtype_mk _ |
| 90 | have hf : Continuous f := continuous_subtype_val.comp |
| 91 | ((continuous_snd.comp φ.continuous).comp hι) |
| 92 | have hfne : ∀ x ∈ (univ : Set O), f x ≠ 1 / 2 := by |
| 93 | intro x _ heq |
| 94 | exact disjoint_left.mp hcapS x.property.1 ((hsphere (ι x)).mp heq) |
| 95 | obtain ⟨a₀, ha₀, hattached⟩ := A.tube_tail |
| 96 | have hbound : ∃ b : ℝ, 0 < b ∧ b < 1 ∧ |
| 97 | ∀ x ∈ O, if side then b ≤ (T.inverse x).2 else (T.inverse x).2 ≤ b := by |
| 98 | cases side |
| 99 | · obtain ⟨p, hp⟩ := T.tail_nonempty false (lt_min ha₀.1 hlo) |
| 100 | ((min_le_left a₀ lo).trans_lt ha₀.2) |
| 101 | have hp' := (T.mem_tail_iff_m28 false (lt_min ha₀.1 hlo) |
| 102 | ((min_le_left a₀ lo).trans_lt ha₀.2)).mp hp |
| 103 | have hpT : p ∈ T.tail false a₀ := (T.mem_tail_iff_m28 false ha₀.1 ha₀.2).mpr |
| 104 | ⟨hp'.1, hp'.2.trans_le (min_le_left _ _)⟩ |
| 105 | let pO : O := ⟨p, hattached hpT, hp'.1⟩ |
| 106 | have hpheight : f pO < 1 / 2 := by |
| 107 | change ((φ (ι pO)).2 : ℝ) < 1 / 2 |
| 108 | rw [hfix (ι pO) (Or.inl (hp'.2.trans_le (min_le_right _ _)))] |
| 109 | exact (hp'.2.trans_le (min_le_right _ _)).trans hlohalf |
| 110 | have hnegative (x : O) : f x < 1 / 2 := |
| 111 | isPreconnected_univ.gt_of_ne hf.continuousOn hfne |
| 112 | ⟨pO, mem_univ _, hpheight⟩ (mem_univ x) |
| 113 | refine ⟨hi, (by norm_num : (0 : ℝ) < 1 / 2).trans hhalfhi, hhi, ?_⟩ |
| 114 | intro x hx |
| 115 | by_contra h |
| 116 | have hxhi : hi < (T.inverse x).2 := lt_of_not_ge h |
| 117 | have hfx := hnegative ⟨x, hx⟩ |
| 118 | change ((φ (ι ⟨x, hx⟩)).2 : ℝ) < 1 / 2 at hfx |
| 119 | rw [hfix (ι ⟨x, hx⟩) (Or.inr hxhi)] at hfx |
| 120 | exact (not_lt_of_ge (hhalfhi.trans hxhi).le) hfx |
| 121 | · obtain ⟨p, hp⟩ := T.tail_nonempty true |
| 122 | (ha₀.1.trans_le (le_max_left a₀ hi)) (max_lt ha₀.2 hhi) |
| 123 | have hp' := (T.mem_tail_iff_m28 true |
| 124 | (ha₀.1.trans_le (le_max_left a₀ hi)) (max_lt ha₀.2 hhi)).mp hp |
| 125 | have hpT : p ∈ T.tail true a₀ := (T.mem_tail_iff_m28 true ha₀.1 ha₀.2).mpr |
| 126 | ⟨hp'.1, (le_max_left _ _).trans_lt hp'.2⟩ |
| 127 | let pO : O := ⟨p, hattached hpT, hp'.1⟩ |
| 128 | have hpheight : 1 / 2 < f pO := by |
| 129 | change 1 / 2 < ((φ (ι pO)).2 : ℝ) |
| 130 | rw [hfix (ι pO) (Or.inr ((le_max_right _ _).trans_lt hp'.2))] |
| 131 | exact hhalfhi.trans ((le_max_right _ _).trans_lt hp'.2) |
| 132 | have hpositive (x : O) : 1 / 2 < f x := |
| 133 | isPreconnected_univ.lt_of_ne hf.continuousOn hfne |
| 134 | ⟨pO, mem_univ _, hpheight⟩ (mem_univ x) |
| 135 | refine ⟨lo, hlo, hlohalf.trans (by norm_num), ?_⟩ |
| 136 | intro x hx |
| 137 | by_contra h |
| 138 | have hxlo : (T.inverse x).2 < lo := lt_of_not_ge h |
| 139 | have hfx := hpositive ⟨x, hx⟩ |
| 140 | change 1 / 2 < ((φ (ι ⟨x, hx⟩)).2 : ℝ) at hfx |
| 141 | rw [hfix (ι ⟨x, hx⟩) (Or.inl hxlo)] at hfx |
| 142 | exact (not_lt_of_ge (hxlo.trans hlohalf).le) hfx |
| 143 | obtain ⟨b, hb, hb', hbound⟩ := hbound |
| 144 | obtain ⟨q, _, _, hWcompact, hWcap, overlapSide, hcapture⟩ := |
| 145 | A.exists_compact_overlap_end |
| 146 | let W := closure (cap.closed_core ∪ cap.end_neck.region (-cap.epsilon⁻¹) q) |
| 147 | obtain ⟨mlo, mhi, hmlo, _, hmhi, hmiddle⟩ := |
| 148 | T.exists_compactSlab_capturing E.isCompact_middleSphere |
| 149 | (E.middleSphere_subset.trans inter_subset_right) |
| 150 | have hfinish {a : ℝ} (ha : 0 < a) (ha' : a < 1) |
| 151 | (hAO : T.tail side a ⊆ O) |
| 152 | (havoid : ∀ x ∈ T.tail side a, (E.inverse x).2 ≠ 1 / 2) |
| 153 | (hmeet : (T.tail side a ∩ E.tail overlapSide (1 / 2)).Nonempty) : |
| 154 | IsCompact (closure (T.tail side a)) ∧ closure (T.tail side a) ⊆ cap.carrier := by |
| 155 | have hcontinuous : ContinuousOn (fun x => (E.inverse x).2) (T.tail side a) := |
| 156 | (continuous_snd.comp_continuousOn E.inverse_smooth.continuousOn).mono hAO |
| 157 | obtain ⟨x₀, hx₀, hx₀E⟩ := hmeet |
| 158 | have hx₀' := (E.mem_tail_iff_m28 overlapSide (by norm_num) (by norm_num)).mp hx₀E |
| 159 | have hsub : T.tail side a ⊆ W := by |
| 160 | intro x hx |
| 161 | apply hcapture |
| 162 | apply (E.mem_tail_iff_m28 overlapSide (by norm_num) (by norm_num)).mpr |
| 163 | refine ⟨hAO hx, ?_⟩ |
| 164 | cases overlapSide |
| 165 | · exact (T.isPreconnected_tail side ha ha').gt_of_ne hcontinuous havoid |
| 166 | ⟨x₀, hx₀, hx₀'.2⟩ hx |
| 167 | · exact (T.isPreconnected_tail side ha ha').lt_of_ne hcontinuous havoid |
| 168 | ⟨x₀, hx₀, hx₀'.2⟩ hx |
| 169 | have hcl : closure (T.tail side a) ⊆ W := closure_minimal hsub isClosed_closure |
| 170 | exact ⟨hWcompact.of_isClosed_subset isClosed_closure hcl, hcl.trans hWcap⟩ |
| 171 | cases side |
| 172 | · obtain ⟨a, ha, hamax⟩ := exists_between (lt_min ha₀.1 (lt_min hmlo hb)) |
| 173 | have haa₀ : a < a₀ := hamax.trans_le (min_le_left _ _) |
| 174 | have hamlo : a < mlo := (hamax.trans_le (min_le_right _ _)).trans_le (min_le_left _ _) |
| 175 | have hab : a < b := (hamax.trans_le (min_le_right _ _)).trans_le (min_le_right _ _) |
| 176 | have ha' : a < 1 := hab.trans hb' |
| 177 | have hAO : T.tail false a ⊆ O := by |
| 178 | intro x hx |
| 179 | have hx' := (T.mem_tail_iff_m28 false ha ha').mp hx |
| 180 | exact ⟨hattached ((T.mem_tail_iff_m28 false ha₀.1 ha₀.2).mpr |
| 181 | ⟨hx'.1, hx'.2.trans haa₀⟩), hx'.1⟩ |
| 182 | have havoid : ∀ x ∈ T.tail false a, (E.inverse x).2 ≠ 1 / 2 := by |
| 183 | intro x hx heq |
| 184 | have hxmiddle := (E.mem_middleSphere_iff (hAO hx)).mpr heq |
| 185 | have hslab := (T.mem_compactSlab_iff hmlo hmhi).mp (hmiddle hxmiddle) |
| 186 | have hx' := (T.mem_tail_iff_m28 false ha ha').mp hx |
| 187 | exact (not_lt_of_ge hslab.2.1) (hx'.2.trans hamlo) |
| 188 | let K := W ∩ T.compactSlab a b |
| 189 | have hK : IsCompact K := hWcompact.inter (T.isCompact_compactSlab ha hb') |
| 190 | have hKO : K ⊆ O := by |
| 191 | intro x hx |
| 192 | exact ⟨hWcap hx.1, T.compactSlab_subset ha hb' hx.2⟩ |
| 193 | obtain ⟨x, hxE, hxK⟩ := E.half_tail_not_subset_compact overlapSide hK hKO |
| 194 | have hxO := E.tail_subset_m28 overlapSide (by norm_num) (by norm_num) hxE |
| 195 | have hxW := hcapture hxE |
| 196 | have hxT : x ∈ T.tail false a := by |
| 197 | apply (T.mem_tail_iff_m28 false ha ha').mpr |
| 198 | refine ⟨hxO.2, ?_⟩ |
| 199 | by_contra h |
| 200 | apply hxK |
| 201 | exact ⟨hxW, (T.mem_compactSlab_iff ha hb').mpr |
| 202 | ⟨hxO.2, le_of_not_gt h, hbound x hxO⟩⟩ |
| 203 | exact ⟨a, ha, ha', hfinish ha ha' hAO havoid ⟨x, hxT, hxE⟩⟩ |
| 204 | · obtain ⟨a, hmaxa, ha'⟩ := exists_between (max_lt ha₀.2 (max_lt hmhi hb')) |
| 205 | have ha₀a : a₀ < a := (le_max_left _ _).trans_lt hmaxa |
| 206 | have hmhi_a : mhi < a := (le_max_left _ _).trans_lt |
| 207 | ((le_max_right _ _).trans_lt hmaxa) |
| 208 | have hba : b < a := (le_max_right _ _).trans_lt |
| 209 | ((le_max_right _ _).trans_lt hmaxa) |
| 210 | have ha : 0 < a := hb.trans hba |
| 211 | have hAO : T.tail true a ⊆ O := by |
| 212 | intro x hx |
| 213 | have hx' := (T.mem_tail_iff_m28 true ha ha').mp hx |
| 214 | exact ⟨hattached ((T.mem_tail_iff_m28 true ha₀.1 ha₀.2).mpr |
| 215 | ⟨hx'.1, ha₀a.trans hx'.2⟩), hx'.1⟩ |
| 216 | have havoid : ∀ x ∈ T.tail true a, (E.inverse x).2 ≠ 1 / 2 := by |
| 217 | intro x hx heq |
| 218 | have hxmiddle := (E.mem_middleSphere_iff (hAO hx)).mpr heq |
| 219 | have hslab := (T.mem_compactSlab_iff hmlo hmhi).mp (hmiddle hxmiddle) |
| 220 | have hx' := (T.mem_tail_iff_m28 true ha ha').mp hx |
| 221 | exact (not_lt_of_ge hslab.2.2) (hmhi_a.trans hx'.2) |
| 222 | let K := W ∩ T.compactSlab b a |
| 223 | have hK : IsCompact K := hWcompact.inter (T.isCompact_compactSlab hb ha') |
| 224 | have hKO : K ⊆ O := by |
| 225 | intro x hx |
| 226 | exact ⟨hWcap hx.1, T.compactSlab_subset hb ha' hx.2⟩ |
| 227 | obtain ⟨x, hxE, hxK⟩ := E.half_tail_not_subset_compact overlapSide hK hKO |
| 228 | have hxO := E.tail_subset_m28 overlapSide (by norm_num) (by norm_num) hxE |
| 229 | have hxW := hcapture hxE |
| 230 | have hxT : x ∈ T.tail true a := by |
| 231 | apply (T.mem_tail_iff_m28 true ha ha').mpr |
| 232 | refine ⟨hxO.2, ?_⟩ |
| 233 | by_contra h |
| 234 | apply hxK |
| 235 | exact ⟨hxW, (T.mem_compactSlab_iff hb ha').mpr |
| 236 | ⟨hxO.2, hbound x hxO, le_of_not_gt h⟩⟩ |
| 237 | exact ⟨a, ha, ha', hfinish ha ha' hAO havoid ⟨x, hxT, hxE⟩⟩ |
| 238 | |
| 239 | end PoincareMT.CapTubeAttachment |