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.CapAttachedEnd |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Cylinders.CylinderSphereOrder |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.CapGeometry.CapScalarBand |
| 5 | |
| 6 | /-! |
| 7 | # The actual compact cap side of a selected sphere |
| 8 | |
| 9 | Morgan--Tian Claim 10.3, printed pp. 248-249. Compact attached-tail |
| 10 | capture and the literal cap-tail attachment trap the closed cap side in |
| 11 | a compact recut together with a finite tube slab. Its complement is open |
| 12 | in the actual full carrier, which proves ambient compactness. Its frontier |
| 13 | is contained in the actual selected sphere, giving the confinement barrier. |
| 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.CappedTubeCertificate |
| 24 | |
| 25 | open M28 |
| 26 | |
| 27 | variable {M : Type u} [TopologicalSpace M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 29 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 30 | [T2Space M] [T3Space M] {g : RiemannianMetric 3 M} |
| 31 | |
| 32 | /-- A cap-disjoint sphere with its actual tube isotopy bounds an actual |
| 33 | compact cap side. The cap lies in its interior and every frontier point |
| 34 | lies on the supplied sphere; no compact-side hypothesis is used (Claim 10.3). -/ |
| 35 | theorem exists_preconnected_compact_cap_side (T : CappedTubeCertificate g) {S : Set M} |
| 36 | (hS : SmoothSphereIsotopicIn T.tube.carrier S T.tube.cylinder.middleSphere) |
| 37 | (hcapS : Disjoint T.cap.carrier S) : |
| 38 | ∃ C : Set M, IsCompact C ∧ IsPreconnected C ∧ C ⊆ T.carrier ∧ |
| 39 | T.cap.carrier ⊆ interior C ∧ S ⊆ C ∧ frontier C ⊆ S := by |
| 40 | classical |
| 41 | let U : TopologicalSpace.Opens M := ⟨T.tube.carrier, T.tube.carrier_open⟩ |
| 42 | let E := T.attachment.overlap_model |
| 43 | let O : Set M := T.cap.carrier ∩ T.tube.carrier |
| 44 | obtain ⟨φ, lo, hi, hlo, hlohalf, hhalfhi, hhi, hsphere, hfix⟩ := |
| 45 | T.tube.cylinder.exists_isotopic_sphere_coordinates (U := U) hS |
| 46 | let h : M → ℝ := fun x => if T.attachment_side then |
| 47 | -ambientCylinderSignedHeight φ x else ambientCylinderSignedHeight φ x |
| 48 | have hcontinuous : ContinuousOn h T.tube.carrier := by |
| 49 | cases hs : T.attachment_side |
| 50 | · change ContinuousOn (fun x => if T.attachment_side then |
| 51 | -ambientCylinderSignedHeight φ x else ambientCylinderSignedHeight φ x) T.tube.carrier |
| 52 | rw [hs] |
| 53 | change ContinuousOn (ambientCylinderSignedHeight φ) (U : Set M) |
| 54 | exact continuousOn_ambientCylinderSignedHeight φ |
| 55 | · change ContinuousOn (fun x => if T.attachment_side then |
| 56 | -ambientCylinderSignedHeight φ x else ambientCylinderSignedHeight φ x) T.tube.carrier |
| 57 | rw [hs] |
| 58 | change ContinuousOn (fun x => -ambientCylinderSignedHeight φ x) (U : Set M) |
| 59 | exact (continuousOn_ambientCylinderSignedHeight φ).neg |
| 60 | have hzero (x : M) (hx : x ∈ T.tube.carrier) : h x = 0 ↔ x ∈ S := by |
| 61 | simp only [h, ambientCylinderSignedHeight_apply φ hx, cylinderSignedHeight] |
| 62 | split_ifs <;> simpa only [neg_eq_zero, sub_eq_zero] using hsphere ⟨x, hx⟩ |
| 63 | have hlow (x : M) (hx : x ∈ T.tube.carrier) |
| 64 | (hheight : (T.tube.cylinder.inverse x).2 < lo) : |
| 65 | if T.attachment_side then 0 < h x else h x < 0 := by |
| 66 | have hread := hfix ⟨x, hx⟩ (Or.inl hheight) |
| 67 | have hh : (T.tube.cylinder.inverse x).2 < 1 / 2 := hheight.trans hlohalf |
| 68 | cases hs : T.attachment_side <;> |
| 69 | simp [h, hs, |
| 70 | ambientCylinderSignedHeight_apply φ hx, cylinderSignedHeight, hread] <;> linarith |
| 71 | have hhigh (x : M) (hx : x ∈ T.tube.carrier) |
| 72 | (hheight : hi < (T.tube.cylinder.inverse x).2) : |
| 73 | if T.attachment_side then h x < 0 else 0 < h x := by |
| 74 | have hread := hfix ⟨x, hx⟩ (Or.inr hheight) |
| 75 | have hh : 1 / 2 < (T.tube.cylinder.inverse x).2 := hhalfhi.trans hheight |
| 76 | cases hs : T.attachment_side <;> |
| 77 | simp [h, hs, |
| 78 | ambientCylinderSignedHeight_apply φ hx, cylinderSignedHeight, hread] <;> linarith |
| 79 | have hST : S ⊆ T.tube.carrier := by |
| 80 | obtain ⟨H, _, hH, hzero, _⟩ := hS |
| 81 | rw [← hzero] |
| 82 | exact (hH 0 (by simp)).2 |
| 83 | obtain ⟨a, ha, ha', hTailCompact, hTailCap⟩ := |
| 84 | T.attachment.exists_compact_attached_tail hS hcapS |
| 85 | have hconn : IsPreconnected O := by |
| 86 | have hs : IsConnected (Metric.sphere (0 : EuclideanSpace ℝ (Fin 3)) 1) := |
| 87 | isConnected_sphere (by rw [← Module.finrank_eq_rank]; norm_num) _ (by norm_num) |
| 88 | let : ConnectedSpace UnitTwoSphere := Subtype.connectedSpace hs |
| 89 | let : ConnectedSpace (Ioo (0 : ℝ) 1) := |
| 90 | Subtype.connectedSpace (isConnected_Ioo zero_lt_one) |
| 91 | let : ConnectedSpace O := E.homeomorph.surjective.connectedSpace E.homeomorph.continuous |
| 92 | exact isPreconnected_iff_preconnectedSpace.mpr inferInstance |
| 93 | have hne : ∀ x ∈ O, h x ≠ 0 := by |
| 94 | intro x hx heq |
| 95 | exact disjoint_left.mp hcapS hx.1 ((hzero x hx.2).mp heq) |
| 96 | have hseed : ∃ x ∈ O, h x < 0 := by |
| 97 | cases hs : T.attachment_side |
| 98 | · obtain ⟨x, hx⟩ := T.tube.cylinder.tail_nonempty false (lt_min ha hlo) |
| 99 | ((min_le_left a lo).trans_lt ha') |
| 100 | have hx' := (T.tube.cylinder.mem_tail_iff_m28 false (lt_min ha hlo) |
| 101 | ((min_le_left a lo).trans_lt ha')).mp hx |
| 102 | have hxa := (T.tube.cylinder.mem_tail_iff_m28 false ha ha').mpr |
| 103 | ⟨hx'.1, hx'.2.trans_le (min_le_left _ _)⟩ |
| 104 | have hxcap : x ∈ T.cap.carrier := by |
| 105 | apply hTailCap |
| 106 | exact subset_closure (by simpa only [hs] using hxa) |
| 107 | exact ⟨x, ⟨hxcap, hx'.1⟩, by |
| 108 | simpa [hs] using |
| 109 | hlow x hx'.1 (hx'.2.trans_le (min_le_right _ _))⟩ |
| 110 | · obtain ⟨x, hx⟩ := T.tube.cylinder.tail_nonempty true |
| 111 | (ha.trans_le (le_max_left a hi)) (max_lt ha' hhi) |
| 112 | have hx' := (T.tube.cylinder.mem_tail_iff_m28 true |
| 113 | (ha.trans_le (le_max_left a hi)) (max_lt ha' hhi)).mp hx |
| 114 | have hxa := (T.tube.cylinder.mem_tail_iff_m28 true ha ha').mpr |
| 115 | ⟨hx'.1, (le_max_left _ _).trans_lt hx'.2⟩ |
| 116 | have hxcap : x ∈ T.cap.carrier := by |
| 117 | apply hTailCap |
| 118 | exact subset_closure (by simpa only [hs] using hxa) |
| 119 | exact ⟨x, ⟨hxcap, hx'.1⟩, by |
| 120 | simpa [hs] using |
| 121 | hhigh x hx'.1 ((le_max_right _ _).trans_lt hx'.2)⟩ |
| 122 | have hnegative (x : M) (hx : x ∈ O) : h x < 0 := |
| 123 | hconn.gt_of_ne (hcontinuous.mono inter_subset_right) hne hseed hx |
| 124 | let P := T.tube.carrier ∩ h ⁻¹' Ioi (0 : ℝ) |
| 125 | have hP : IsOpen P := hcontinuous.isOpen_inter_preimage T.tube.carrier_open isOpen_Ioi |
| 126 | let C := T.carrier \ P |
| 127 | have hcapC : T.cap.carrier ⊆ C := by |
| 128 | intro x hx |
| 129 | refine ⟨T.cap_subset hx, ?_⟩ |
| 130 | intro hxP |
| 131 | exact (not_lt_of_ge (hnegative x ⟨hx, hxP.1⟩).le) hxP.2 |
| 132 | have hSC : S ⊆ C := by |
| 133 | intro x hx |
| 134 | refine ⟨T.tube_subset (hST hx), ?_⟩ |
| 135 | intro hxP |
| 136 | have hz := (hzero x (hST hx)).mpr hx |
| 137 | exact (ne_of_gt hxP.2) hz |
| 138 | obtain ⟨q₀, hq₀, hq₀L, houtside⟩ := T.exists_recut_complement_subset_tube |
| 139 | obtain ⟨q₁, _, hq₁L, hcaptureTail⟩ := |
| 140 | T.cap.exists_recut_capturing_compact hTailCompact hTailCap |
| 141 | let q := max q₀ q₁ |
| 142 | have hq : 0 < q := hq₀.trans_le (le_max_left _ _) |
| 143 | have hqL : q < T.cap.epsilon⁻¹ := max_lt hq₀L hq₁L |
| 144 | let W := closure (T.cap.closed_core ∪ T.cap.end_neck.region (-T.cap.epsilon⁻¹) q) |
| 145 | obtain ⟨_, hWcompact, hWcap⟩ := T.cap.open_precompact_recut |
| 146 | ((neg_neg_of_pos (inv_pos.mpr T.cap.epsilon_pos)).trans hq) hqL |
| 147 | have hrecut₀ : T.cap.closed_core ∪ T.cap.end_neck.region (-T.cap.epsilon⁻¹) q₀ ⊆ W := by |
| 148 | rintro x (hx | hx) |
| 149 | · exact subset_closure (Or.inl hx) |
| 150 | · exact subset_closure (Or.inr ⟨hx.1, hx.2.1, hx.2.2.trans_le (le_max_left _ _)⟩) |
| 151 | have hTailW : T.tube.cylinder.tail T.attachment_side a ⊆ W := by |
| 152 | intro x hx |
| 153 | rcases hcaptureTail (subset_closure hx) with hxcore | hxend |
| 154 | · exact subset_closure (Or.inl hxcore) |
| 155 | · exact subset_closure (Or.inr |
| 156 | ⟨hxend.1, hxend.2.1, hxend.2.2.trans_le (le_max_right _ _)⟩) |
| 157 | have houtsideW {x : M} (hx : x ∈ T.carrier) (hxW : x ∉ W) : x ∈ T.tube.carrier := |
| 158 | houtside ⟨hx, fun hh => hxW (hrecut₀ hh)⟩ |
| 159 | have hcompact : IsCompact C := by |
| 160 | have hbounded : ∃ l r : ℝ, 0 < l ∧ r < 1 ∧ |
| 161 | C ⊆ W ∪ T.tube.cylinder.compactSlab l r := by |
| 162 | cases hs : T.attachment_side |
| 163 | · refine ⟨a, hi, ha, hhi, ?_⟩ |
| 164 | intro x hx |
| 165 | by_cases hxW : x ∈ W |
| 166 | · exact Or.inl hxW |
| 167 | · have hxT := houtsideW hx.1 hxW |
| 168 | have hax : a ≤ (T.tube.cylinder.inverse x).2 := by |
| 169 | by_contra hh |
| 170 | apply hxW |
| 171 | apply hTailW |
| 172 | simpa only [hs] using (T.tube.cylinder.mem_tail_iff_m28 false ha ha').mpr |
| 173 | ⟨hxT, lt_of_not_ge hh⟩ |
| 174 | have hxhi : (T.tube.cylinder.inverse x).2 ≤ hi := by |
| 175 | by_contra hh |
| 176 | apply hx.2 |
| 177 | refine ⟨hxT, ?_⟩ |
| 178 | simpa [hs] using hhigh x hxT (lt_of_not_ge hh) |
| 179 | exact Or.inr ((T.tube.cylinder.mem_compactSlab_iff ha hhi).mpr ⟨hxT, hax, hxhi⟩) |
| 180 | · refine ⟨lo, a, hlo, ha', ?_⟩ |
| 181 | intro x hx |
| 182 | by_cases hxW : x ∈ W |
| 183 | · exact Or.inl hxW |
| 184 | · have hxT := houtsideW hx.1 hxW |
| 185 | have hxa : (T.tube.cylinder.inverse x).2 ≤ a := by |
| 186 | by_contra hh |
| 187 | apply hxW |
| 188 | apply hTailW |
| 189 | simpa only [hs] using (T.tube.cylinder.mem_tail_iff_m28 true ha ha').mpr |
| 190 | ⟨hxT, lt_of_not_ge hh⟩ |
| 191 | have hlox : lo ≤ (T.tube.cylinder.inverse x).2 := by |
| 192 | by_contra hh |
| 193 | apply hx.2 |
| 194 | refine ⟨hxT, ?_⟩ |
| 195 | simpa [hs] using hlow x hxT (lt_of_not_ge hh) |
| 196 | exact Or.inr ((T.tube.cylinder.mem_compactSlab_iff hlo ha').mpr ⟨hxT, hlox, hxa⟩) |
| 197 | obtain ⟨l, r, hl, hr, hcapture⟩ := hbounded |
| 198 | have hbuffer : W ∪ T.tube.cylinder.compactSlab l r ⊆ T.carrier := |
| 199 | union_subset (hWcap.trans T.cap_subset) |
| 200 | ((T.tube.cylinder.compactSlab_subset hl hr).trans T.tube_subset) |
| 201 | have heq : C = (W ∪ T.tube.cylinder.compactSlab l r) \ P := by |
| 202 | apply Subset.antisymm |
| 203 | · intro x hx |
| 204 | exact ⟨hcapture hx, hx.2⟩ |
| 205 | · intro x hx |
| 206 | exact ⟨hbuffer hx.1, hx.2⟩ |
| 207 | rw [heq] |
| 208 | exact (hWcompact.union (T.tube.cylinder.isCompact_compactSlab hl hr)).diff hP |
| 209 | have hcapInterior : T.cap.carrier ⊆ interior C := |
| 210 | interior_maximal hcapC T.cap.carrier_open |
| 211 | let Half := T.tube.carrier ∩ h ⁻¹' Iic (0 : ℝ) |
| 212 | have hHalf : IsPreconnected Half := by |
| 213 | cases hs : T.attachment_side |
| 214 | · have hpc : IsPreconnected {x : U | cylinderSignedHeight φ x ≤ 0} := by |
| 215 | rw [← closure_cylinderSignedHeight_negative φ] |
| 216 | exact (isPreconnected_cylinderSignedHeight_negative φ).closure |
| 217 | have himage := hpc.image (Subtype.val : U → M) continuous_subtype_val.continuousOn |
| 218 | convert himage using 1 |
| 219 | ext x |
| 220 | constructor |
| 221 | · intro hx |
| 222 | refine ⟨⟨x, hx.1⟩, ?_, rfl⟩ |
| 223 | have hxheight : h x ≤ 0 := hx.2 |
| 224 | simpa [h, hs, ambientCylinderSignedHeight_apply φ hx.1] using hxheight |
| 225 | · rintro ⟨x, hx, rfl⟩ |
| 226 | refine ⟨x.property, ?_⟩ |
| 227 | change h (x : M) ≤ 0 |
| 228 | simpa [h, hs, ambientCylinderSignedHeight_apply φ x.property] using hx |
| 229 | · have hpc : IsPreconnected {x : U | 0 ≤ cylinderSignedHeight φ x} := by |
| 230 | rw [← closure_cylinderSignedHeight_positive φ] |
| 231 | exact (isPreconnected_cylinderSignedHeight_positive φ).closure |
| 232 | have himage := hpc.image (Subtype.val : U → M) continuous_subtype_val.continuousOn |
| 233 | convert himage using 1 |
| 234 | ext x |
| 235 | constructor |
| 236 | · intro hx |
| 237 | refine ⟨⟨x, hx.1⟩, ?_, rfl⟩ |
| 238 | have hxheight : h x ≤ 0 := hx.2 |
| 239 | simpa [h, hs, ambientCylinderSignedHeight_apply φ hx.1] using hxheight |
| 240 | · rintro ⟨x, hx, rfl⟩ |
| 241 | refine ⟨x.property, ?_⟩ |
| 242 | change h (x : M) ≤ 0 |
| 243 | simpa [h, hs, ambientCylinderSignedHeight_apply φ x.property] using hx |
| 244 | have hCeq : C = T.cap.carrier ∪ Half := by |
| 245 | ext x |
| 246 | constructor |
| 247 | · intro hx |
| 248 | by_cases hxcap : x ∈ T.cap.carrier |
| 249 | · exact Or.inl hxcap |
| 250 | · have hxT : x ∈ T.tube.carrier := by |
| 251 | have hxU := hx.1 |
| 252 | rw [T.carrier_eq_union] at hxU |
| 253 | exact hxU.resolve_left hxcap |
| 254 | have hn : h x ≤ 0 := le_of_not_gt (fun hh => hx.2 ⟨hxT, hh⟩) |
| 255 | exact Or.inr ⟨hxT, hn⟩ |
| 256 | · rintro (hxcap | hxHalf) |
| 257 | · exact hcapC hxcap |
| 258 | · refine ⟨T.tube_subset hxHalf.1, ?_⟩ |
| 259 | intro hxP |
| 260 | have hn : h x ≤ 0 := hxHalf.2 |
| 261 | have hp : 0 < h x := hxP.2 |
| 262 | exact (not_lt_of_ge hn) hp |
| 263 | have hpreconnected : IsPreconnected C := by |
| 264 | rw [hCeq] |
| 265 | obtain ⟨x, hxO, hxneg⟩ := hseed |
| 266 | exact IsPreconnected.union' ⟨x, hxO.1, hxO.2, hxneg.le⟩ |
| 267 | T.cap.isPreconnected_carrier hHalf |
| 268 | refine ⟨C, hcompact, hpreconnected, sdiff_subset, hcapInterior, hSC, ?_⟩ |
| 269 | intro x hxfront |
| 270 | have hxC : x ∈ C := hcompact.isClosed.frontier_subset hxfront |
| 271 | have hxU := hxC.1 |
| 272 | have hxnot : x ∉ interior C := hxfront.2 |
| 273 | by_cases hxcap : x ∈ T.cap.carrier |
| 274 | · exact False.elim (hxnot (hcapInterior hxcap)) |
| 275 | · have hxT : x ∈ T.tube.carrier := by |
| 276 | rw [T.carrier_eq_union] at hxU |
| 277 | exact hxU.resolve_left hxcap |
| 278 | have hnonpos : h x ≤ 0 := le_of_not_gt (fun hh => hxC.2 ⟨hxT, hh⟩) |
| 279 | by_cases hz : h x = 0 |
| 280 | · exact (hzero x hxT).mp hz |
| 281 | · have hlt : h x < 0 := lt_of_le_of_ne hnonpos hz |
| 282 | let V := T.tube.carrier ∩ h ⁻¹' Iio (0 : ℝ) |
| 283 | have hV : IsOpen V := hcontinuous.isOpen_inter_preimage T.tube.carrier_open isOpen_Iio |
| 284 | have hVC : V ⊆ C := by |
| 285 | intro y hy |
| 286 | refine ⟨T.tube_subset hy.1, ?_⟩ |
| 287 | intro hyP |
| 288 | have hn : h y < 0 := hy.2 |
| 289 | have hp : 0 < h y := hyP.2 |
| 290 | exact (not_lt_of_ge hn.le) hp |
| 291 | exact False.elim (hxnot (interior_maximal hVC hV ⟨hxT, hlt⟩)) |
| 292 | |
| 293 | /-- The compact cap-side interface used by the one-neck confinement |
| 294 | consumer. The stronger producer also proves preconnectedness for ordering |
| 295 | two actual cap sides (Claim 10.3). -/ |
| 296 | theorem exists_compact_cap_side (T : CappedTubeCertificate g) {S : Set M} |
| 297 | (hS : SmoothSphereIsotopicIn T.tube.carrier S T.tube.cylinder.middleSphere) |
| 298 | (hcapS : Disjoint T.cap.carrier S) : |
| 299 | ∃ C : Set M, IsCompact C ∧ C ⊆ T.carrier ∧ |
| 300 | T.cap.carrier ⊆ interior C ∧ S ⊆ C ∧ frontier C ⊆ S := by |
| 301 | obtain ⟨C, hC, _, hCU, hcap, hS', hfront⟩ := |
| 302 | T.exists_preconnected_compact_cap_side hS hcapS |
| 303 | exact ⟨C, hC, hCU, hcap, hS', hfront⟩ |
| 304 | |
| 305 | end PoincareMT.CappedTubeCertificate |