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.NeckFrontierSphere |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.SourceGeometry.Geometry.SourceFrontierSelection |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.NeckGeometry.NeckBalancedDistance |
| 5 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.NeckGeometry.NeckBalancedScale |
| 6 | import PoincareLib.Topology.Manifold.NeckCap.Chain.Extension.Reversal |
| 7 | |
| 8 | /-! |
| 9 | # Signed quarter capture along the selected source path |
| 10 | |
| 11 | The finite first-exit list from Claim 10.4 is retained. At each successive |
| 12 | frontier, the A.11 sphere packet supplies one of the two axial orientations; |
| 13 | the corresponding signed outer quarter is contained in the successor carrier. |
| 14 | The orientation is exported rather than silently identified with the original |
| 15 | coordinate direction. This is the first-quarter continuation used before the |
| 16 | global tube assembly. |
| 17 | -/ |
| 18 | |
| 19 | set_option autoImplicit false |
| 20 | |
| 21 | open Set |
| 22 | open scoped Manifold ContDiff Bundle Topology ENNReal |
| 23 | |
| 24 | universe u |
| 25 | |
| 26 | namespace PoincareMT.M28.CounterexampleNeckSegment |
| 27 | |
| 28 | variable {M : Type u} [TopologicalSpace M] |
| 29 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 30 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 31 | [T2Space M] [T3Space M] {g : RiemannianMetric 3 M} |
| 32 | |
| 33 | private theorem old_positive_quarter_edist_le (N : EpsilonNeck g) |
| 34 | (hε : N.epsilon ≤ 1 / 1000) {x y : M} |
| 35 | (hx : x ∈ N.region (N.epsilon⁻¹ / 2) N.epsilon⁻¹) |
| 36 | (hy : y ∈ N.region (N.epsilon⁻¹ / 2) N.epsilon⁻¹) : |
| 37 | g.edist x y ≤ ENNReal.ofReal ((0.51 : ℝ) * N.scale * N.epsilon⁻¹) := by |
| 38 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 39 | ⟨g.toRiemannianMetric⟩ |
| 40 | let z := N.coordinate_inverse x |
| 41 | let w := N.coordinate_inverse y |
| 42 | have hz : z.2 ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹ := |
| 43 | (N.coordinate_inverse_mem x hx.1).2 |
| 44 | have hw : w.2 ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹ := |
| 45 | (N.coordinate_inverse_mem y hy.1).2 |
| 46 | have hxy : g.edist x y ≤ ENNReal.ofReal |
| 47 | (N.scale * Real.sqrt (1 + N.epsilon) * Real.sqrt 2 * Real.pi) + |
| 48 | ENNReal.ofReal (N.scale * Real.sqrt (1 + N.epsilon) * |w.2 - z.2|) := by |
| 49 | calc |
| 50 | _ = g.edist (N.coordinate_map (z.1, z.2)) |
| 51 | (N.coordinate_map (w.1, w.2)) := by |
| 52 | rw [Prod.eta, Prod.eta, N.coordinate_map_coordinate_inverse hx.1, |
| 53 | N.coordinate_map_coordinate_inverse hy.1] |
| 54 | _ ≤ g.edist (N.coordinate_map (z.1, z.2)) |
| 55 | (N.coordinate_map (w.1, z.2)) + |
| 56 | g.edist (N.coordinate_map (w.1, z.2)) |
| 57 | (N.coordinate_map (w.1, w.2)) := Manifold.riemannianEDist_triangle |
| 58 | _ ≤ _ := add_le_add (N.edist_coordinate_map_slice_le z.1 w.1 hz) |
| 59 | (N.edist_coordinate_map_axis_le w.1 hz hw) |
| 60 | have haxis : |w.2 - z.2| ≤ N.epsilon⁻¹ / 2 := by |
| 61 | apply abs_le.mpr |
| 62 | dsimp [z, w] |
| 63 | constructor <;> linarith [hx.2.1, hx.2.2, hy.2.1, hy.2.2] |
| 64 | have hinv : (1000 : ℝ) ≤ N.epsilon⁻¹ := by |
| 65 | have h := mul_le_mul_of_nonneg_right hε (inv_pos.mpr N.epsilon_pos).le |
| 66 | rw [mul_inv_cancel₀ N.epsilon_pos.ne'] at h |
| 67 | linarith |
| 68 | have hroot : Real.sqrt (1 + N.epsilon) ≤ (1.001 : ℝ) := by |
| 69 | have hs := Real.sq_sqrt (show 0 ≤ 1 + N.epsilon by linarith [N.epsilon_pos]) |
| 70 | nlinarith [Real.sqrt_nonneg (1 + N.epsilon)] |
| 71 | have hsphere : Real.sqrt (1 + N.epsilon) * Real.sqrt 2 ≤ 2 := by |
| 72 | have hsq : (Real.sqrt (1 + N.epsilon) * Real.sqrt 2) ^ 2 = |
| 73 | (1 + N.epsilon) * 2 := by |
| 74 | rw [mul_pow, Real.sq_sqrt (by linarith [N.epsilon_pos]), |
| 75 | Real.sq_sqrt (by norm_num : (0 : ℝ) ≤ 2)] |
| 76 | nlinarith [N.epsilon_lt_half, |
| 77 | mul_nonneg (Real.sqrt_nonneg (1 + N.epsilon)) (Real.sqrt_nonneg 2)] |
| 78 | have hnum : Real.sqrt (1 + N.epsilon) * Real.sqrt 2 * Real.pi + |
| 79 | Real.sqrt (1 + N.epsilon) * |w.2 - z.2| ≤ |
| 80 | (0.51 : ℝ) * N.epsilon⁻¹ := by |
| 81 | have h1 := mul_le_mul_of_nonneg_right hsphere Real.pi_pos.le |
| 82 | have h2 := mul_le_mul hroot haxis (abs_nonneg _) (by norm_num : (0 : ℝ) ≤ 1.001) |
| 83 | nlinarith [Real.pi_le_four] |
| 84 | apply hxy.trans |
| 85 | have ha : 0 ≤ N.scale * Real.sqrt (1 + N.epsilon) * Real.sqrt 2 * Real.pi := by |
| 86 | exact mul_nonneg (mul_nonneg (mul_nonneg N.scale_pos.le |
| 87 | (Real.sqrt_nonneg _)) (Real.sqrt_nonneg _)) Real.pi_pos.le |
| 88 | have hb : 0 ≤ N.scale * Real.sqrt (1 + N.epsilon) * |w.2 - z.2| := by |
| 89 | exact mul_nonneg (mul_nonneg N.scale_pos.le (Real.sqrt_nonneg _)) (abs_nonneg _) |
| 90 | rw [← ENNReal.ofReal_add ha hb] |
| 91 | apply ENNReal.ofReal_le_ofReal |
| 92 | nlinarith [mul_le_mul_of_nonneg_left hnum N.scale_pos.le] |
| 93 | |
| 94 | private theorem old_positive_quarter_closure_edist_le (N : EpsilonNeck g) |
| 95 | (hε : N.epsilon ≤ 1 / 1000) {x y : M} |
| 96 | (hx : x ∈ N.region (N.epsilon⁻¹ / 2) N.epsilon⁻¹) |
| 97 | (hy : y ∈ closure (N.region (N.epsilon⁻¹ / 2) N.epsilon⁻¹)) : |
| 98 | g.edist x y ≤ ENNReal.ofReal ((0.51 : ℝ) * N.scale * N.epsilon⁻¹) := by |
| 99 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 100 | ⟨g.toRiemannianMetric⟩ |
| 101 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin 3)) |
| 102 | (TangentSpace (𝓡 3) : M → Type _) := |
| 103 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ => rfl⟩⟩ |
| 104 | let : EMetricSpace M := EMetricSpace.ofRiemannianMetric (𝓡 3) M |
| 105 | exact closure_minimal (fun z hz => old_positive_quarter_edist_le N hε hx hz) |
| 106 | (isClosed_le (continuous_const.edist continuous_id) continuous_const) hy |
| 107 | |
| 108 | private theorem exists_positive_quarter_subset_accuracy : |
| 109 | ∃ epsilon₀ : ℝ, 0 < epsilon₀ ∧ epsilon₀ ≤ (1 / 1000 : ℝ) ∧ |
| 110 | ∀ {M : Type u} [TopologicalSpace M] |
| 111 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 112 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 113 | [T2Space M] [T3Space M] {g : RiemannianMetric 3 M}, |
| 114 | ∀ (N N' : EpsilonNeck g), N.epsilon ≤ epsilon₀ → |
| 115 | N'.epsilon = N.epsilon → |
| 116 | N'.center ∈ closure (N.region (N.epsilon⁻¹ / 2) N.epsilon⁻¹) → |
| 117 | N.region (N.epsilon⁻¹ / 2) N.epsilon⁻¹ ⊆ N'.carrier := by |
| 118 | obtain ⟨epsilonS, hSpos, hSsmall, hscale⟩ := |
| 119 | PoincareMT.M28.exists_neck_balanced_scale_accuracy.{u} |
| 120 | refine ⟨min epsilonS (1 / 1000), lt_min hSpos (by norm_num), |
| 121 | min_le_right _ _, ?_⟩ |
| 122 | intro M _ _ _ _ _ _ _ g N N' hε heq hcenter x hx |
| 123 | have hsmall : N.epsilon ≤ 1 / 1000 := hε.trans (min_le_right _ _) |
| 124 | have hmeet : (N.carrier ∩ N'.carrier).Nonempty := by |
| 125 | obtain ⟨y, hy, hy'⟩ := mem_closure_iff.mp hcenter N'.carrier |
| 126 | N'.carrier_open (N'.central_sphere_subset N'.center_on_central_sphere) |
| 127 | exact ⟨y, hy'.1, hy⟩ |
| 128 | obtain ⟨hsN, hsN'⟩ := hscale M g N.connection N N' |
| 129 | (hε.trans (min_le_left _ _)) |
| 130 | (heq ▸ hε.trans (min_le_left _ _)) hmeet |
| 131 | by_contra hout |
| 132 | have hxout : x ∉ N'.region (-((999 / 1000 : ℝ) * N'.epsilon⁻¹)) |
| 133 | ((999 / 1000 : ℝ) * N'.epsilon⁻¹) := by |
| 134 | intro hx' |
| 135 | exact hout hx'.1 |
| 136 | have hlower0 := N'.edist_central_lower_of_not_mem_region |
| 137 | (r := (999 / 1000 : ℝ) * N'.epsilon⁻¹) |
| 138 | (mul_pos (by norm_num) (inv_pos.mpr N'.epsilon_pos)) (by |
| 139 | have hA : 0 < N'.epsilon⁻¹ := inv_pos.mpr N'.epsilon_pos |
| 140 | nlinarith) N'.center_on_central_sphere hxout |
| 141 | have hrootLower : (999 / 1000 : ℝ) ≤ Real.sqrt (1 - N'.epsilon) := by |
| 142 | have hs := Real.sq_sqrt (show 0 ≤ 1 - N'.epsilon by linarith) |
| 143 | nlinarith [Real.sqrt_nonneg (1 - N'.epsilon)] |
| 144 | have hcoef : (0.99 : ℝ) ≤ Real.sqrt (1 - N'.epsilon) * (999 / 1000) := by |
| 145 | nlinarith only [hrootLower] |
| 146 | have hlower : ENNReal.ofReal ((0.99 : ℝ) * N'.scale * N'.epsilon⁻¹) ≤ |
| 147 | g.edist N'.center x := by |
| 148 | apply (ENNReal.ofReal_le_ofReal ?_).trans hlower0 |
| 149 | have h := mul_le_mul_of_nonneg_right |
| 150 | (mul_le_mul_of_nonneg_left hcoef N'.scale_pos.le) |
| 151 | (inv_pos.mpr N'.epsilon_pos).le |
| 152 | nlinarith only [h] |
| 153 | have hupper := old_positive_quarter_closure_edist_le N hsmall hx hcenter |
| 154 | have hlower' : ENNReal.ofReal ((0.99 : ℝ) * N'.scale * N'.epsilon⁻¹) ≤ |
| 155 | g.edist x N'.center := by |
| 156 | simpa only [RiemannianMetric.edist, Manifold.riemannianEDist_comm] using hlower |
| 157 | have hlt : ENNReal.ofReal ((0.51 : ℝ) * N.scale * N.epsilon⁻¹) < |
| 158 | ENNReal.ofReal ((0.99 : ℝ) * N'.scale * N'.epsilon⁻¹) := by |
| 159 | rw [heq] |
| 160 | have hqpos : 0 < (0.99 : ℝ) * N'.scale * N.epsilon⁻¹ := by |
| 161 | exact mul_pos (mul_pos (by norm_num) N'.scale_pos) |
| 162 | (inv_pos.mpr N.epsilon_pos) |
| 163 | apply (ENNReal.ofReal_lt_ofReal_iff hqpos).mpr |
| 164 | have hratio : (999 / 1000 : ℝ) * N.scale < N'.scale := by |
| 165 | nlinarith only [hsN', N.scale_pos, N'.scale_pos] |
| 166 | have hscale : (0.51 : ℝ) * N.scale < 0.99 * N'.scale := by |
| 167 | nlinarith only [hratio, N.scale_pos, N'.scale_pos] |
| 168 | have hmul := mul_lt_mul_of_pos_right hscale |
| 169 | (inv_pos.mpr N.epsilon_pos) |
| 170 | nlinarith only [hmul] |
| 171 | exact (not_lt_of_ge (hlower'.trans hupper)) hlt |
| 172 | |
| 173 | variable {epsilon C A D₀ D : ℝ} |
| 174 | {E : SameTimeCounterexample.{u} epsilon C A D₀ D} |
| 175 | |
| 176 | /-- Every first-exit edge of the actual retained source path carries a signed |
| 177 | outer quarter of the old neck into the successor carrier. The sign is chosen |
| 178 | by the actual exit and is part of the output. -/ |
| 179 | theorem exists_source_frontier_quarter_accuracy (S : CounterexampleNeckSegment E) : |
| 180 | ∃ epsilon₀ : ℝ, 0 < epsilon₀ ∧ epsilon₀ ≤ (1 / 200 : ℝ) ∧ |
| 181 | ∀ (_hsmall : epsilon ≤ epsilon₀), ∃ N : ℝ → EpsilonNeck (E.flow.metric E.time), |
| 182 | (∀ s ∈ Icc S.lower S.upper, |
| 183 | N s ∈ S.cover.necks ∧ (N s).center = S.path s) ∧ |
| 184 | ∃ l : List ℝ, |
| 185 | (∀ s ∈ S.lower :: l, s ∈ Icc S.lower S.upper) ∧ |
| 186 | (S.lower :: l).IsChain (fun s t => |
| 187 | s < t ∧ S.path t ∈ frontier (N s).carrier ∧ |
| 188 | MapsTo S.path (Ico s t) (N s).carrier) ∧ |
| 189 | (∀ s t, s ∈ S.lower :: l → t ∈ S.lower :: l → |
| 190 | s < t → S.path t ∈ frontier (N s).carrier → |
| 191 | MapsTo S.path (Ico s t) (N s).carrier → |
| 192 | ∃ sigma : ℝ, (sigma = 1 ∨ sigma = -1) ∧ |
| 193 | (N t).center ∈ closure (neckSignedRegion (N s) sigma |
| 194 | ((N s).epsilon⁻¹ / 2) (N s).epsilon⁻¹) ∧ |
| 195 | neckSignedRegion (N s) sigma ((N s).epsilon⁻¹ / 2) |
| 196 | (N s).epsilon⁻¹ ⊆ (N t).carrier) := by |
| 197 | obtain ⟨epsilonF, hFpos, hFsmall, hF⟩ := |
| 198 | exists_frontier_neck_sphere_sides_accuracy.{u} |
| 199 | obtain ⟨epsilonQ, hQpos, hQsmall, hQ⟩ := |
| 200 | exists_positive_quarter_subset_accuracy.{u} |
| 201 | let epsilon₀ := min epsilonF epsilonQ |
| 202 | refine ⟨epsilon₀, lt_min hFpos hQpos, |
| 203 | (min_le_left _ _).trans hFsmall, ?_⟩ |
| 204 | intro hsmall |
| 205 | obtain ⟨N, hN, l, hlmem, hlchain, _, _⟩ := |
| 206 | S.exists_frontier_neck_selection |
| 207 | refine ⟨N, hN, l, hlmem, hlchain, ?_⟩ |
| 208 | intro s t hs ht hst hfront hmap |
| 209 | have hsI : s ∈ Icc S.lower S.upper := hlmem s hs |
| 210 | have htI : t ∈ Icc S.lower S.upper := hlmem t ht |
| 211 | have hsc : (N s).epsilon = epsilon := |
| 212 | (S.cover.neck_epsilon (N s) (hN s hsI).1).trans S.cover_epsilon |
| 213 | have htc : (N t).epsilon = epsilon := |
| 214 | (S.cover.neck_epsilon (N t) (hN t htI).1).trans S.cover_epsilon |
| 215 | have heq : (N s).epsilon = (N t).epsilon := hsc.trans htc.symm |
| 216 | have hcenter : (N s).center = S.path s := (hN s hsI).2 |
| 217 | have hcentert : (N t).center = S.path t := (hN t htI).2 |
| 218 | have hcont : ContinuousOn S.path (Icc s t) := by |
| 219 | apply (S.path_smooth.continuousOn.mono |
| 220 | (Icc_subset_Icc S.lower_pos.le S.upper_lt_one.le)).mono |
| 221 | exact Icc_subset_Icc hsI.1 htI.2 |
| 222 | have hout : (N t).center ∉ (N s).carrier := by |
| 223 | rw [hcentert] |
| 224 | rw [frontier, (N s).carrier_open.interior_eq] at hfront |
| 225 | exact hfront.2 |
| 226 | have hfront' : (N t).center ∈ frontier (N s).carrier := by |
| 227 | rw [hcentert] |
| 228 | exact hfront |
| 229 | obtain ⟨sigma, hsigma, v, hv, hlevel, hafter, hcloseT, hcloseO, hcap, -⟩ := |
| 230 | hF (E.flow.slice E.time).carrier (E.flow.metric E.time) |
| 231 | (E.flow.connection E.time) (N s) (N t) heq |
| 232 | (by |
| 233 | have hsF : (N s).epsilon ≤ epsilonF := by |
| 234 | rw [hsc] |
| 235 | exact hsmall.trans (min_le_left _ _) |
| 236 | simpa only [hsc] using hsF) S.path s t hst |
| 237 | hcont hcenter.symm hcentert.symm hmap hfront' |
| 238 | have hsQ : (N s).epsilon ≤ epsilonQ := by |
| 239 | rw [hsc] |
| 240 | exact hsmall.trans (min_le_right _ _) |
| 241 | have hquarterData : |
| 242 | (N t).center ∈ closure (neckSignedRegion (N s) sigma |
| 243 | ((N s).epsilon⁻¹ / 2) (N s).epsilon⁻¹) ∧ |
| 244 | neckSignedRegion (N s) sigma ((N s).epsilon⁻¹ / 2) |
| 245 | (N s).epsilon⁻¹ ⊆ (N t).carrier := by |
| 246 | rcases hsigma with rfl | rfl |
| 247 | · have hcloseQ : (N t).center ∈ closure |
| 248 | ((N s).region ((N s).epsilon⁻¹ / 2) (N s).epsilon⁻¹) := by |
| 249 | have hcloseRaw : (N t).center ∈ closure |
| 250 | (neckSignedRegion (N s) 1 |
| 251 | (255 * (N s).epsilon⁻¹ / 256) (N s).epsilon⁻¹) := by |
| 252 | simpa only [show (255 : ℝ) / 256 = 255 / 256 by rfl] using hcloseO |
| 253 | have hsubset : |
| 254 | (N s).region (255 * (N s).epsilon⁻¹ / 256) |
| 255 | (N s).epsilon⁻¹ ⊆ |
| 256 | (N s).region ((N s).epsilon⁻¹ / 2) (N s).epsilon⁻¹ := by |
| 257 | intro x hx |
| 258 | have hA : 0 < (N s).epsilon⁻¹ := inv_pos.mpr (N s).epsilon_pos |
| 259 | exact ⟨hx.1, by linarith [hx.2.1, hA], hx.2.2⟩ |
| 260 | exact closure_mono hsubset (by |
| 261 | simpa only [neckSignedRegion_one] using hcloseRaw) |
| 262 | refine ⟨?_, ?_⟩ |
| 263 | · simpa only [neckSignedRegion_one] using hcloseQ |
| 264 | · simpa only [neckSignedRegion_one] using |
| 265 | (hQ (N s) (N t) hsQ heq.symm hcloseQ) |
| 266 | · have hcloseQ : (N t).center ∈ closure |
| 267 | ((N s).reversed.region ((N s).reversed.epsilon⁻¹ / 2) |
| 268 | (N s).reversed.epsilon⁻¹) := by |
| 269 | have hcloseRaw : (N t).center ∈ closure |
| 270 | (neckSignedRegion (N s) (-1) |
| 271 | (255 * (N s).epsilon⁻¹ / 256) (N s).epsilon⁻¹) := hcloseO |
| 272 | have hcloseN : (N t).center ∈ closure |
| 273 | ((N s).region (-((N s).epsilon⁻¹)) |
| 274 | (-((N s).epsilon⁻¹ / 2))) := by |
| 275 | have hsubset : |
| 276 | (N s).region (-((N s).epsilon⁻¹)) |
| 277 | (-((255 * (N s).epsilon⁻¹ / 256))) ⊆ |
| 278 | (N s).region (-((N s).epsilon⁻¹)) |
| 279 | (-((N s).epsilon⁻¹ / 2)) := by |
| 280 | intro x hx |
| 281 | have hA : 0 < (N s).epsilon⁻¹ := inv_pos.mpr (N s).epsilon_pos |
| 282 | exact ⟨hx.1, hx.2.1, by linarith [hx.2.2, hA]⟩ |
| 283 | apply closure_mono hsubset |
| 284 | simpa only [neckSignedRegion_neg_one] using hcloseRaw |
| 285 | simpa only [EpsilonNeck.reversed_region, |
| 286 | EpsilonNeck.reversed_epsilon] using hcloseN |
| 287 | have hQrev := hQ (N s).reversed (N t) hsQ |
| 288 | (by simpa only [EpsilonNeck.reversed_epsilon] using heq.symm) hcloseQ |
| 289 | refine ⟨?_, ?_⟩ |
| 290 | · simpa only [neckSignedRegion_neg_one, EpsilonNeck.reversed_region, |
| 291 | EpsilonNeck.reversed_epsilon] using hcloseQ |
| 292 | · simpa only [neckSignedRegion_neg_one, EpsilonNeck.reversed_region, |
| 293 | EpsilonNeck.reversed_epsilon] using hQrev |
| 294 | have hcloseQuarter := hquarterData.1 |
| 295 | have hquarter := hquarterData.2 |
| 296 | refine ⟨sigma, hsigma, ?_, ?_⟩ |
| 297 | · exact hcloseQuarter |
| 298 | · exact hquarter |
| 299 | |
| 300 | end PoincareMT.M28.CounterexampleNeckSegment |