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.NeckGeometry.NeckThinEnd |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.NeckGeometry.NeckFrontierLevel |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.NeckGeometry.NeckGraphSideAlignment |
| 5 | |
| 6 | /-! |
| 7 | # One actual comparison sphere for a source first-exit pair |
| 8 | |
| 9 | Morgan--Tian, Proposition A.11 and Appendix A frontier extension, |
| 10 | pp. 503--507. The original first-exit path selects the old end. Its thin |
| 11 | collar is captured in the successor; one original sphere supplies the |
| 12 | literal projection, graph, signed sides and original-path crossing. |
| 13 | All numerical thresholds precede every geometric input. No whole-neck |
| 14 | intersection, balanced chain or cylinder conclusion is assumed or claimed. |
| 15 | -/ |
| 16 | |
| 17 | noncomputable section |
| 18 | set_option autoImplicit false |
| 19 | |
| 20 | open Set |
| 21 | open scoped Manifold ContDiff Topology |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace PoincareMT.M28 |
| 26 | |
| 27 | /-- The actual first-exit pair supplies one path-selected old sphere with |
| 28 | its literal successor graph, side orientation and tested path crossing. |
| 29 | Every capture and side fact is derived from the original frozen necks. -/ |
| 30 | theorem exists_frontier_neck_sphere_sides_accuracy : |
| 31 | ∃ epsilon₀ : ℝ, 0 < epsilon₀ ∧ epsilon₀ ≤ (1 / 200 : ℝ) ∧ |
| 32 | ∀ (M : Type u) [TopologicalSpace M] |
| 33 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 34 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 35 | [T2Space M] [T3Space M] |
| 36 | (g : RiemannianMetric 3 M) (_D : LeviCivitaData g) |
| 37 | (N N' : EpsilonNeck g), |
| 38 | N.epsilon = N'.epsilon → N.epsilon ≤ epsilon₀ → |
| 39 | ∀ (γ : ℝ → M) (s c : ℝ), s < c → |
| 40 | ContinuousOn γ (Icc s c) → γ s = N.center → γ c = N'.center → |
| 41 | MapsTo γ (Ico s c) N.carrier → N'.center ∈ frontier N.carrier → |
| 42 | ∃ sigma : ℝ, (sigma = 1 ∨ sigma = -1) ∧ |
| 43 | ∃ v ∈ Ioo s c, |
| 44 | sigma * (N.coordinate_inverse (γ v)).2 = 509 * N.epsilon⁻¹ / 512 ∧ |
| 45 | (∀ t ∈ Ioo v c, 509 * N.epsilon⁻¹ / 512 < |
| 46 | sigma * (N.coordinate_inverse (γ t)).2) ∧ |
| 47 | N'.center ∈ closure (neckSignedRegion N sigma |
| 48 | (127 * N.epsilon⁻¹ / 128) N.epsilon⁻¹) ∧ |
| 49 | N'.center ∈ closure (neckSignedRegion N sigma |
| 50 | (255 * N.epsilon⁻¹ / 256) N.epsilon⁻¹) ∧ |
| 51 | neckSignedRegion N sigma (127 * N.epsilon⁻¹ / 128) N.epsilon⁻¹ ⊆ |
| 52 | N'.region (-(N'.epsilon⁻¹ / 2)) (N'.epsilon⁻¹ / 2) ∧ |
| 53 | ∃ phi : Diffeomorph (𝓡 2) (𝓡 2) UnitTwoSphere UnitTwoSphere ∞, |
| 54 | (∀ p, phi p = (N'.coordinate_inverse |
| 55 | (N.coordinate_map (p, sigma * (255 * N.epsilon⁻¹ / 256)))).1) ∧ |
| 56 | ∃ f : UnitTwoSphere → ℝ, |
| 57 | ContMDiff (𝓡 2) 𝓘(ℝ, ℝ) ∞ f ∧ |
| 58 | (∀ p, |f p| < 7 * N'.epsilon⁻¹ / 8) ∧ |
| 59 | (∀ p, N.coordinate_map (phi.symm p, sigma * (255 * N.epsilon⁻¹ / 256)) = |
| 60 | N'.coordinate_map (p, f p)) ∧ |
| 61 | range (fun p : UnitTwoSphere => |
| 62 | N.coordinate_map (p, sigma * (255 * N.epsilon⁻¹ / 256))) = |
| 63 | range (fun p : UnitTwoSphere => N'.coordinate_map (p, f p)) ∧ |
| 64 | SmoothSphereIsotopicIn N.carrier |
| 65 | (range (fun p : UnitTwoSphere => |
| 66 | N.coordinate_map (p, sigma * (255 * N.epsilon⁻¹ / 256)))) |
| 67 | N.central_sphere ∧ |
| 68 | SmoothSphereIsotopicIn N'.carrier |
| 69 | (range (fun p : UnitTwoSphere => |
| 70 | N.coordinate_map (p, sigma * (255 * N.epsilon⁻¹ / 256)))) |
| 71 | N'.central_sphere ∧ |
| 72 | ContinuousOn (neckGraphHeight N' f) N'.carrier ∧ |
| 73 | (∀ x ∈ N'.carrier, neckGraphHeight N' f x = 0 ↔ |
| 74 | x ∈ range (fun p : UnitTwoSphere => |
| 75 | N.coordinate_map (p, sigma * (255 * N.epsilon⁻¹ / 256)))) ∧ |
| 76 | IsOpen (N'.carrier ∩ neckGraphHeight N' f ⁻¹' Iio 0) ∧ |
| 77 | IsOpen (N'.carrier ∩ neckGraphHeight N' f ⁻¹' Ioi 0) ∧ |
| 78 | Disjoint (N'.carrier ∩ neckGraphHeight N' f ⁻¹' Iio 0) |
| 79 | (N'.carrier ∩ neckGraphHeight N' f ⁻¹' Ioi 0) ∧ |
| 80 | (N'.carrier ∩ neckGraphHeight N' f ⁻¹' Iio 0) ∪ |
| 81 | (N'.carrier ∩ neckGraphHeight N' f ⁻¹' Ioi 0) = |
| 82 | N'.carrier \ range (fun p : UnitTwoSphere => |
| 83 | N.coordinate_map (p, sigma * (255 * N.epsilon⁻¹ / 256))) ∧ |
| 84 | ∃ kappa : ℝ, (kappa = 1 ∨ kappa = -1) ∧ |
| 85 | 0 < kappa * neckGraphHeight N' f N'.center ∧ |
| 86 | (∀ x ∈ neckSignedRegion N sigma |
| 87 | (127 * N.epsilon⁻¹ / 128) N.epsilon⁻¹, |
| 88 | (0 < kappa * neckGraphHeight N' f x ↔ |
| 89 | 255 * N.epsilon⁻¹ / 256 < sigma * (N.coordinate_inverse x).2) ∧ |
| 90 | (kappa * neckGraphHeight N' f x < 0 ↔ |
| 91 | sigma * (N.coordinate_inverse x).2 < 255 * N.epsilon⁻¹ / 256)) ∧ |
| 92 | MapsTo γ (Icc v c) N'.carrier ∧ |
| 93 | kappa * neckGraphHeight N' f (γ v) < 0 ∧ |
| 94 | 0 < kappa * neckGraphHeight N' f (γ c) ∧ |
| 95 | (∃ t ∈ Ioo v c, γ t ∈ range (fun p : UnitTwoSphere => |
| 96 | N.coordinate_map (p, sigma * (255 * N.epsilon⁻¹ / 256)))) ∧ |
| 97 | ∀ (η : ℝ → M) (a b : ℝ), a ≤ b → |
| 98 | ContinuousOn η (Icc a b) → MapsTo η (Icc a b) N'.carrier → |
| 99 | kappa * neckGraphHeight N' f (η a) < 0 → |
| 100 | 0 < kappa * neckGraphHeight N' f (η b) → |
| 101 | ∃ t ∈ Ioo a b, η t ∈ range (fun p : UnitTwoSphere => |
| 102 | N.coordinate_map (p, sigma * (255 * N.epsilon⁻¹ / 256))) := by |
| 103 | obtain ⟨epsilonC, hCpos, hCsmall, hcapture⟩ := |
| 104 | exists_neck_narrow_region_capture_accuracy.{u} |
| 105 | obtain ⟨epsilonG, hGpos, _, hgraph⟩ := exists_buffered_neck_sphere_graph_accuracy.{u} |
| 106 | refine ⟨min epsilonC epsilonG, lt_min hCpos hGpos, |
| 107 | (min_le_left _ _).trans hCsmall, ?_⟩ |
| 108 | intro M _ _ _ _ _ _ _ g D N N' heq hsmall γ s c hsc hγ hγs hγc hinside hfront |
| 109 | let A := N.epsilon⁻¹ |
| 110 | have hA : 0 < A := inv_pos.mpr N.epsilon_pos |
| 111 | have hout : N'.center ∉ N.carrier := by |
| 112 | rw [frontier, N.carrier_open.interior_eq] at hfront |
| 113 | exact hfront.2 |
| 114 | have hγout : γ c ∉ N.carrier := by simpa only [hγc] using hout |
| 115 | obtain ⟨sigma, hsigma, w, hw, hwlevel, hwafter⟩ := |
| 116 | exists_signed_level_before_neck_exit N hsc hγ hγs hinside hγout |
| 117 | (show 0 < 511 * A / 512 by positivity) |
| 118 | (show 511 * A / 512 < N.epsilon⁻¹ by change 511 * A / 512 < A; linarith) |
| 119 | have hsignmem (t : ℝ) (ht : t ∈ Ico s c) : |
| 120 | sigma * (N.coordinate_inverse (γ t)).2 ∈ Ioo (-A) A := |
| 121 | neck_signed_axis_mem N hsigma (hinside ht) |
| 122 | have haxis : ContinuousOn |
| 123 | (fun t => sigma * (N.coordinate_inverse (γ t)).2) (Icc s w) := |
| 124 | continuousOn_const.mul (continuous_snd.comp_continuousOn |
| 125 | (N.coordinate_inverse_smooth.continuousOn.comp |
| 126 | (hγ.mono (Icc_subset_Icc le_rfl hw.2.le)) |
| 127 | (fun t ht => hinside ⟨ht.1, ht.2.trans_lt hw.2⟩))) |
| 128 | have hzero : sigma * (N.coordinate_inverse (γ s)).2 = 0 := by |
| 129 | rw [hγs, (N.mem_central_sphere_iff_of_mem_carrier |
| 130 | (N.central_sphere_subset N.center_on_central_sphere)).mp N.center_on_central_sphere, |
| 131 | mul_zero] |
| 132 | obtain ⟨v, hv, hvlevel, hvafter⟩ := exists_last_eq_of_continuousOn hw.1.le haxis |
| 133 | (show sigma * (N.coordinate_inverse (γ s)).2 ≤ 509 * A / 512 by |
| 134 | rw [hzero]; positivity) |
| 135 | (show 509 * A / 512 < sigma * (N.coordinate_inverse (γ w)).2 by |
| 136 | rw [hwlevel]; linarith) |
| 137 | have hsv : s < v := lt_of_le_of_ne hv.1 (by |
| 138 | intro he |
| 139 | subst v |
| 140 | rw [hzero] at hvlevel |
| 141 | linarith) |
| 142 | have hvc : v < c := hv.2.trans_lt hw.2 |
| 143 | have hafter (t : ℝ) (ht : t ∈ Ioo v c) : |
| 144 | 509 * A / 512 < sigma * (N.coordinate_inverse (γ t)).2 := by |
| 145 | by_cases htw : t ≤ w |
| 146 | · exact hvafter t ⟨ht.1, htw⟩ |
| 147 | · have h := hwafter t ⟨lt_of_not_ge htw, ht.2⟩ |
| 148 | linarith |
| 149 | have houtermap : MapsTo γ (Ioo w c) (neckSignedRegion N sigma (255 * A / 256) A) := by |
| 150 | intro t ht |
| 151 | have htc : t ∈ Ico s c := ⟨hw.1.le.trans ht.1.le, ht.2⟩ |
| 152 | refine ⟨hinside htc, ?_, (hsignmem t htc).2⟩ |
| 153 | have h := hwafter t ht |
| 154 | linarith |
| 155 | have hcclosure : c ∈ closure (Ioo w c) := by |
| 156 | rw [closure_Ioo hw.2.ne] |
| 157 | exact right_mem_Icc.mpr hw.2.le |
| 158 | have hcloseO : N'.center ∈ closure (neckSignedRegion N sigma (255 * A / 256) A) := by |
| 159 | have h := ((hγ c (right_mem_Icc.mpr hsc.le)).mono |
| 160 | (fun t (ht : t ∈ Ioo w c) => ⟨hw.1.le.trans ht.1.le, ht.2.le⟩)).mem_closure |
| 161 | hcclosure houtermap |
| 162 | simpa only [hγc] using h |
| 163 | have hOT : neckSignedRegion N sigma (255 * A / 256) A ⊆ |
| 164 | neckSignedRegion N sigma (127 * A / 128) A := by |
| 165 | intro x hx |
| 166 | exact ⟨hx.1, by linarith [hx.2.1], hx.2.2⟩ |
| 167 | have hcloseT := closure_mono hOT hcloseO |
| 168 | have hcap : neckSignedRegion N sigma (127 * A / 128) A ⊆ |
| 169 | N'.region (-(N'.epsilon⁻¹ / 2)) (N'.epsilon⁻¹ / 2) := by |
| 170 | rcases hsigma with hs | hs |
| 171 | · rw [hs, neckSignedRegion_one] at hcloseT ⊢ |
| 172 | exact (hcapture M g D N N' heq (hsmall.trans (min_le_left _ _)) |
| 173 | (127 * A / 128) A (by change A - 127 * A / 128 ≤ A / 128; linarith) |
| 174 | hcloseT).2 |
| 175 | · rw [hs, neckSignedRegion_neg_one] at hcloseT ⊢ |
| 176 | exact (hcapture M g D N N' heq (hsmall.trans (min_le_left _ _)) |
| 177 | (-A) (-(127 * A / 128)) |
| 178 | (by change -(127 * A / 128) - -A ≤ A / 128; linarith) hcloseT).2 |
| 179 | have ha : sigma * (255 * A / 256) ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹ := by |
| 180 | change -A < sigma * (255 * A / 256) ∧ sigma * (255 * A / 256) < A |
| 181 | rcases hsigma with rfl | rfl <;> constructor <;> nlinarith |
| 182 | have hS (p : UnitTwoSphere) : |
| 183 | N.coordinate_map (p, sigma * (255 * A / 256)) ∈ |
| 184 | neckSignedRegion N sigma (127 * A / 128) A := by |
| 185 | have hN := N.coordinate_map_mem (z := (p, sigma * (255 * A / 256))) |
| 186 | ⟨mem_univ p, ha⟩ |
| 187 | have hz := (mem_neck_slice_iff_signed_axis N hsigma ha hN).mp ⟨p, rfl⟩ |
| 188 | exact ⟨hN, by rw [hz]; linarith, by rw [hz]; linarith⟩ |
| 189 | let p0 : UnitTwoSphere := (N.coordinate_inverse N.center).1 |
| 190 | have hp0 := hcap (hS p0) |
| 191 | have hNgraph : N.epsilon ≤ epsilonG := hsmall.trans (min_le_right _ _) |
| 192 | have hN'graph : N'.epsilon ≤ epsilonG := heq ▸ hNgraph |
| 193 | obtain ⟨phi, hphi, f, hf, hbuffer, hpoint, hrange⟩ := hgraph M g D N' N |
| 194 | hN'graph hNgraph (sigma * (255 * A / 256)) ha p0 hp0.1 |
| 195 | (by apply abs_le.mpr; constructor <;> linarith [hp0.2.1, hp0.2.2, |
| 196 | inv_pos.mpr N'.epsilon_pos]) |
| 197 | have hfdom (p : UnitTwoSphere) : f p ∈ Ioo (-N'.epsilon⁻¹) N'.epsilon⁻¹ := by |
| 198 | have h := abs_lt.mp (hbuffer p) |
| 199 | constructor <;> linarith [h.1, h.2, inv_pos.mpr N'.epsilon_pos] |
| 200 | have hiso : SmoothSphereIsotopicIn N.carrier |
| 201 | (range (fun p : UnitTwoSphere => N.coordinate_map (p, sigma * (255 * A / 256)))) |
| 202 | N.central_sphere := |
| 203 | neck_graph_isotopic_central N (fun _ => sigma * (255 * A / 256)) |
| 204 | contMDiff_const (fun _ => ha) |
| 205 | have hiso' : SmoothSphereIsotopicIn N'.carrier |
| 206 | (range (fun p : UnitTwoSphere => N.coordinate_map (p, sigma * (255 * A / 256)))) |
| 207 | N'.central_sphere := by |
| 208 | rw [hrange] |
| 209 | exact neck_graph_isotopic_central N' f hf hfdom |
| 210 | have hzeroS (x : M) (hx : x ∈ N'.carrier) : neckGraphHeight N' f x = 0 ↔ |
| 211 | x ∈ range (fun p : UnitTwoSphere => N.coordinate_map (p, sigma * (255 * A / 256))) := by |
| 212 | rw [hrange] |
| 213 | exact neckGraphHeight_eq_zero_iff N' hfdom hx |
| 214 | obtain ⟨hminus, hplus, hdisjoint, hunion⟩ := neckGraphHeight_sides N' hf hfdom |
| 215 | rw [← hrange] at hunion |
| 216 | obtain ⟨kappa, hkappa, hpcenter, halign⟩ := neck_graph_side_alignment N N' hsigma |
| 217 | (lo := 127 * A / 128) (a := 255 * A / 256) (hi := A) |
| 218 | (by change -A ≤ 127 * A / 128; linarith) le_rfl (by linarith) (by linarith) |
| 219 | hf hfdom hrange (fun x hx => (hcap hx).1) hcloseO hout |
| 220 | have hvT : γ v ∈ neckSignedRegion N sigma (127 * A / 128) A := by |
| 221 | exact ⟨hinside ⟨hsv.le, hvc⟩, by rw [hvlevel]; linarith, |
| 222 | (hsignmem v ⟨hsv.le, hvc⟩).2⟩ |
| 223 | have hγN' : MapsTo γ (Icc v c) N'.carrier := by |
| 224 | intro t ht |
| 225 | by_cases htc : t = c |
| 226 | · subst t |
| 227 | rw [hγc] |
| 228 | exact N'.central_sphere_subset N'.center_on_central_sphere |
| 229 | · have htlt : t < c := lt_of_le_of_ne ht.2 htc |
| 230 | by_cases htv : t = v |
| 231 | · subst t |
| 232 | exact (hcap hvT).1 |
| 233 | · have hvlt : v < t := lt_of_le_of_ne ht.1 (Ne.symm htv) |
| 234 | exact (hcap ⟨hinside ⟨hsv.le.trans ht.1, htlt⟩, |
| 235 | by linarith [hafter t ⟨hvlt, htlt⟩], |
| 236 | (hsignmem t ⟨hsv.le.trans ht.1, htlt⟩).2⟩).1 |
| 237 | have hvneg : kappa * neckGraphHeight N' f (γ v) < 0 := |
| 238 | (halign (γ v) hvT).2.mpr (by rw [hvlevel]; linarith) |
| 239 | have hcpos : 0 < kappa * neckGraphHeight N' f (γ c) := by |
| 240 | simpa only [hγc] using hpcenter |
| 241 | have hcross : ∀ (η : ℝ → M) (a b : ℝ), a ≤ b → |
| 242 | ContinuousOn η (Icc a b) → MapsTo η (Icc a b) N'.carrier → |
| 243 | kappa * neckGraphHeight N' f (η a) < 0 → |
| 244 | 0 < kappa * neckGraphHeight N' f (η b) → |
| 245 | ∃ t ∈ Ioo a b, η t ∈ range (fun p : UnitTwoSphere => |
| 246 | N.coordinate_map (p, sigma * (255 * A / 256))) := by |
| 247 | intro η a b hab hη hηN hneg hpos |
| 248 | rw [hrange] |
| 249 | exact exists_neck_graph_crossing N' hf hfdom hab hη hηN hkappa hneg hpos |
| 250 | refine ⟨sigma, hsigma, v, ⟨hsv, hvc⟩, hvlevel, hafter, hcloseT, hcloseO, hcap, |
| 251 | phi, hphi, f, hf, hbuffer, hpoint, hrange, hiso, hiso', |
| 252 | continuousOn_neckGraphHeight N' hf, hzeroS, hminus, hplus, hdisjoint, hunion, |
| 253 | kappa, hkappa, hpcenter, halign, hγN', hvneg, hcpos, ?_, hcross⟩ |
| 254 | exact hcross γ v c hvc.le (hγ.mono (Icc_subset_Icc hsv.le le_rfl)) hγN' hvneg hcpos |
| 255 | |
| 256 | end PoincareMT.M28 |