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.Predecessors.Necks.Geometry.SharpDepth |
| 3 | |
| 4 | /-! |
| 5 | # Positive frontier points and the first overlap quarter |
| 6 | |
| 7 | Every exterior closure point of the positive half is approached by each |
| 8 | retained final tail. The directed distance estimate and sharp depth then |
| 9 | put the whole old positive quarter into a same-epsilon neck centered at |
| 10 | that point, with the exact old-scale balanced center bounds. These are |
| 11 | the first quantitative inputs to Morgan--Tian A.12 and A.17, pp. 504-506; |
| 12 | see `tasks/M25/case-local/positive-frontier-inventory.md`, F1-F3. |
| 13 | No separation or existence of an exterior frontier point is asserted. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set |
| 19 | open scoped Manifold ContDiff Bundle ENNReal |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.EpsilonNeck |
| 24 | |
| 25 | /-- An exterior closure point of the positive half is approached by every |
| 26 | final tail with cut below the excluded upper endpoint. MT A.12/A.17, |
| 27 | pp. 504-506; positive-frontier inventory F1. -/ |
| 28 | theorem mem_closure_final_tail_of_mem_positive_closure |
| 29 | {M : Type u} [TopologicalSpace M] |
| 30 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 31 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 32 | [T3Space M] {g : RiemannianMetric 3 M} |
| 33 | (N : EpsilonNeck g) {y : M} |
| 34 | (hy : y ∈ closure (N.region 0 N.epsilon⁻¹)) |
| 35 | (hyout : y ∉ N.carrier) {a : ℝ} (ha : a < N.epsilon⁻¹) : |
| 36 | y ∈ closure (N.region a N.epsilon⁻¹) := by |
| 37 | let : T2Space M := @T25Space.t2Space M _ (@T3Space.t25Space M _ inferInstance) |
| 38 | by_cases ha0 : a ≤ 0 |
| 39 | · have hsub : N.region 0 N.epsilon⁻¹ ⊆ N.region a N.epsilon⁻¹ := by |
| 40 | intro x hx |
| 41 | exact ⟨hx.1, ha0.trans_lt hx.2.1, hx.2.2⟩ |
| 42 | exact closure_mono hsub hy |
| 43 | have hL : 0 < N.epsilon⁻¹ := inv_pos.mpr N.epsilon_pos |
| 44 | let K := N.coordinate_map '' (univ ×ˢ Icc 0 a) |
| 45 | have hK : IsCompact K := N.isCompact_coordinate_slab (neg_lt_zero.mpr hL) ha |
| 46 | have hKsub : K ⊆ N.carrier := by |
| 47 | rintro x ⟨z, hz, rfl⟩ |
| 48 | exact N.coordinate_map_mem ⟨mem_univ _, (neg_lt_zero.mpr hL).trans_le hz.2.1, |
| 49 | hz.2.2.trans_lt ha⟩ |
| 50 | have hcover : N.region 0 N.epsilon⁻¹ ⊆ K ∪ N.region a N.epsilon⁻¹ := by |
| 51 | intro x hx |
| 52 | by_cases hxa : (N.coordinate_inverse x).2 ≤ a |
| 53 | · exact Or.inl ⟨N.coordinate_inverse x, ⟨mem_univ _, hx.2.1.le, hxa⟩, |
| 54 | N.coordinate_map_coordinate_inverse hx.1⟩ |
| 55 | · exact Or.inr ⟨hx.1, lt_of_not_ge hxa, hx.2.2⟩ |
| 56 | have hmem := closure_mono hcover hy |
| 57 | rw [closure_union, hK.isClosed.closure_eq] at hmem |
| 58 | exact hmem.resolve_left (fun hx => hyout (hKsub hx)) |
| 59 | |
| 60 | /-- The directed distance from an actual neck point to a positive |
| 61 | exterior closure point uses the remaining positive axial length. |
| 62 | MT A.12/A.17, pp. 504-506; positive-frontier inventory F2. -/ |
| 63 | theorem edist_le_positive_frontier |
| 64 | {M : Type u} [TopologicalSpace M] |
| 65 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 66 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 67 | [T3Space M] {g : RiemannianMetric 3 M} |
| 68 | (N : EpsilonNeck g) {x y : M} (hx : x ∈ N.carrier) |
| 69 | (hy : y ∈ closure (N.region 0 N.epsilon⁻¹)) |
| 70 | (hyout : y ∉ N.carrier) : |
| 71 | g.edist x y ≤ ENNReal.ofReal |
| 72 | (N.scale * Real.sqrt (1 + N.epsilon) * |
| 73 | (N.epsilon⁻¹ - (N.coordinate_inverse x).2 + |
| 74 | Real.sqrt 2 * (Real.pi + 1))) := by |
| 75 | let : T2Space M := @T25Space.t2Space M _ (@T3Space.t25Space M _ inferInstance) |
| 76 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 77 | ⟨g.toRiemannianMetric⟩ |
| 78 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin 3)) |
| 79 | (TangentSpace (𝓡 3) : M → Type _) := |
| 80 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ => rfl⟩⟩ |
| 81 | let : EMetricSpace M := EMetricSpace.ofRiemannianMetric (𝓡 3) M |
| 82 | let a := (max 0 (N.coordinate_inverse x).2 + N.epsilon⁻¹) / 2 |
| 83 | have hL : 0 < N.epsilon⁻¹ := inv_pos.mpr N.epsilon_pos |
| 84 | have hm : max 0 (N.coordinate_inverse x).2 < N.epsilon⁻¹ := |
| 85 | max_lt hL (N.coordinate_inverse_mem x hx).2.2 |
| 86 | have ha : a < N.epsilon⁻¹ := by dsimp only [a]; linarith |
| 87 | have hxa : (N.coordinate_inverse x).2 < a := by |
| 88 | dsimp only [a] |
| 89 | linarith [le_max_right 0 (N.coordinate_inverse x).2] |
| 90 | have htail := N.mem_closure_final_tail_of_mem_positive_closure hy hyout ha |
| 91 | let R := ENNReal.ofReal (N.scale * Real.sqrt (1 + N.epsilon) * |
| 92 | (N.epsilon⁻¹ - (N.coordinate_inverse x).2 + Real.sqrt 2 * (Real.pi + 1))) |
| 93 | have hbound : N.region a N.epsilon⁻¹ ⊆ {z | g.edist x z ≤ R} := by |
| 94 | intro z hz |
| 95 | have h := N.edist_le_axial_add hx hz.1 |
| 96 | have hdiff : 0 ≤ (N.coordinate_inverse z).2 - (N.coordinate_inverse x).2 := |
| 97 | sub_nonneg.mpr (hxa.trans hz.2.1).le |
| 98 | rw [abs_of_nonneg hdiff] at h |
| 99 | apply h.trans |
| 100 | apply ENNReal.ofReal_le_ofReal |
| 101 | exact mul_le_mul_of_nonneg_left |
| 102 | (add_le_add (sub_le_sub_right hz.2.2.le _) le_rfl) |
| 103 | (mul_nonneg N.scale_pos.le (Real.sqrt_nonneg _)) |
| 104 | have hclosed : IsClosed {z | g.edist x z ≤ R} := |
| 105 | isClosed_le (continuous_const.edist continuous_id) continuous_const |
| 106 | exact closure_minimal hbound hclosed htail |
| 107 | |
| 108 | /-- A same-epsilon neck centered on the old positive exterior frontier |
| 109 | contains the entire old positive quarter, with the exact old-scale |
| 110 | balanced center bounds. MT A.12/A.17 and (A.1), pp. 504-506; |
| 111 | positive-frontier inventory F3. -/ |
| 112 | theorem exists_positive_frontier_quarter_control : |
| 113 | ∃ epsilon0 : ℝ, 0 < epsilon0 ∧ epsilon0 ≤ 1 / 200 ∧ |
| 114 | ∀ {M : Type u} [TopologicalSpace M] |
| 115 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 116 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 117 | [T3Space M] {g : RiemannianMetric 3 M}, |
| 118 | ∀ (N N' : EpsilonNeck g), |
| 119 | N.epsilon ≤ epsilon0 → N'.epsilon = N.epsilon → |
| 120 | N'.center ∈ closure (N.region 0 N.epsilon⁻¹) → |
| 121 | N'.center ∉ N.carrier → |
| 122 | N.region (N.epsilon⁻¹ / 2) N.epsilon⁻¹ ⊆ N'.carrier ∧ |
| 123 | ENNReal.ofReal ((0.99 : ℝ) * N.scale * N.epsilon⁻¹) ≤ |
| 124 | g.edist N.center N'.center ∧ |
| 125 | g.edist N.center N'.center ≤ |
| 126 | ENNReal.ofReal ((1.01 : ℝ) * N.scale * N.epsilon⁻¹) := by |
| 127 | obtain ⟨epsilonS, hS, hScap, hscale⟩ := |
| 128 | exists_intersecting_scale_control.{u} (α := 1 / 100) (by norm_num) |
| 129 | let C := Real.sqrt 2 * (Real.pi + 1) |
| 130 | have hC : 0 < C := by dsimp only [C]; positivity |
| 131 | have hden : 0 < 1000 * (C + 1) := by positivity |
| 132 | refine ⟨min epsilonS (1 / (1000 * (C + 1))), |
| 133 | lt_min hS (div_pos zero_lt_one hden), (min_le_left _ _).trans hScap, ?_⟩ |
| 134 | intro M _ _ _ _ _ _ g N N' hN hepsilon hy hyout |
| 135 | let : T2Space M := @T25Space.t2Space M _ (@T3Space.t25Space M _ inferInstance) |
| 136 | let L := N.epsilon⁻¹ |
| 137 | have hL : 0 < L := inv_pos.mpr N.epsilon_pos |
| 138 | have hepos : 0 < N.epsilon := N.epsilon_pos |
| 139 | have hr : 0 < N.scale := N.scale_pos |
| 140 | have hr' : 0 < N'.scale := N'.scale_pos |
| 141 | have hNs : N.epsilon ≤ epsilonS := hN.trans (min_le_left _ _) |
| 142 | have hN's : N'.epsilon ≤ epsilonS := by rw [hepsilon]; exact hNs |
| 143 | have hcap : N.epsilon ≤ 1 / 200 := hNs.trans hScap |
| 144 | have hsmall : N.epsilon ≤ 1 / (1000 * (C + 1)) := hN.trans (min_le_right _ _) |
| 145 | have hCe : (C + 1) * N.epsilon ≤ 1 / 1000 := by |
| 146 | have h := (le_div_iff₀ hden).mp hsmall |
| 147 | nlinarith |
| 148 | have hCee : C * N.epsilon ≤ 1 / 1000 := by nlinarith [N.epsilon_pos] |
| 149 | have hCL : C ≤ L / 1000 := by |
| 150 | calc |
| 151 | C ≤ (1 / 1000) / N.epsilon := (le_div_iff₀ N.epsilon_pos).mpr hCee |
| 152 | _ = L / 1000 := by dsimp only [L]; ring |
| 153 | have hb : (99 : ℝ) / 100 ≤ Real.sqrt (1 - N.epsilon) := |
| 154 | Real.le_sqrt_of_sq_le (by nlinarith) |
| 155 | have hp : Real.sqrt (1 + N.epsilon) ≤ (101 : ℝ) / 100 := |
| 156 | Real.sqrt_le_iff.mpr ⟨by norm_num, by nlinarith⟩ |
| 157 | have hc' := (N'.mem_central_sphere_iff N'.center).mp N'.center_on_central_sphere |
| 158 | have hinter : (N.carrier ∩ N'.carrier).Nonempty := by |
| 159 | obtain ⟨z, hz', hz⟩ := mem_closure_iff.mp hy N'.carrier N'.carrier_open hc'.1 |
| 160 | exact ⟨z, hz.1, hz'⟩ |
| 161 | have hratio := (hscale N N' hNs hN's hinter).2 |
| 162 | have hratioLower : (99 : ℝ) / 100 < N'.scale / N.scale := by |
| 163 | linarith [(abs_lt.mp hratio).1] |
| 164 | have hscaleLower : (99 : ℝ) / 100 * N.scale ≤ N'.scale := |
| 165 | ((lt_div_iff₀ N.scale_pos).mp hratioLower).le |
| 166 | have hycarrier : N'.center ∈ closure N.carrier := |
| 167 | closure_mono (fun _ hx => hx.1) hy |
| 168 | have hcenters := N.edist_center_closure_bounds hycarrier hyout |
| 169 | refine ⟨?_, ?_, ?_⟩ |
| 170 | · intro x hx |
| 171 | by_contra hxout |
| 172 | have hupper := N.edist_le_positive_frontier hx.1 hy hyout |
| 173 | have hupperReal : N.scale * Real.sqrt (1 + N.epsilon) * |
| 174 | (L - (N.coordinate_inverse x).2 + C) ≤ |
| 175 | (50601 : ℝ) / 100000 * N.scale * L := by |
| 176 | calc |
| 177 | _ ≤ N.scale * Real.sqrt (1 + N.epsilon) * (L / 2 + C) := |
| 178 | mul_le_mul_of_nonneg_left (by linarith [hx.2.1]) |
| 179 | (mul_nonneg N.scale_pos.le (Real.sqrt_nonneg _)) |
| 180 | _ ≤ N.scale * (101 / 100) * (L / 2 + C) := |
| 181 | mul_le_mul_of_nonneg_right |
| 182 | (mul_le_mul_of_nonneg_left hp N.scale_pos.le) (by positivity) |
| 183 | _ ≤ N.scale * (101 / 100) * (L / 2 + L / 1000) := |
| 184 | mul_le_mul_of_nonneg_left (add_le_add le_rfl hCL) |
| 185 | (by positivity) |
| 186 | _ = _ := by ring |
| 187 | have hu : g.edist x N'.center ≤ |
| 188 | ENNReal.ofReal ((50601 : ℝ) / 100000 * N.scale * L) := |
| 189 | hupper.trans (ENNReal.ofReal_le_ofReal hupperReal) |
| 190 | have hd : ENNReal.ofReal (N'.scale * Real.sqrt (1 - N.epsilon) * L) ≤ |
| 191 | g.edist x N'.center := by |
| 192 | simpa only [axialDepth, if_neg hxout, if_pos hc'.1, hc'.2, abs_zero, |
| 193 | sub_zero, zero_sub, abs_neg, hepsilon, |
| 194 | abs_of_pos (inv_pos.mpr N.epsilon_pos)] using |
| 195 | N'.axialDepth_edist_le x N'.center |
| 196 | have hlowerReal : (9801 : ℝ) / 10000 * N.scale * L ≤ |
| 197 | N'.scale * Real.sqrt (1 - N.epsilon) * L := by |
| 198 | calc |
| 199 | _ = ((99 / 100) * N.scale) * (99 / 100) * L := by ring |
| 200 | _ ≤ _ := mul_le_mul_of_nonneg_right |
| 201 | (mul_le_mul hscaleLower hb (by norm_num) N'.scale_pos.le) hL.le |
| 202 | have hbad := ((ENNReal.ofReal_le_ofReal hlowerReal).trans hd).trans hu |
| 203 | have hstrict : ENNReal.ofReal ((50601 : ℝ) / 100000 * N.scale * L) < |
| 204 | ENNReal.ofReal ((9801 : ℝ) / 10000 * N.scale * L) := by |
| 205 | apply (ENNReal.ofReal_lt_ofReal_iff (by positivity)).mpr |
| 206 | nlinarith [mul_pos N.scale_pos hL] |
| 207 | exact (not_le_of_gt hstrict) hbad |
| 208 | · apply (ENNReal.ofReal_le_ofReal ?_).trans hcenters.1 |
| 209 | calc |
| 210 | (0.99 : ℝ) * N.scale * N.epsilon⁻¹ = N.scale * (99 / 100) * L := by |
| 211 | dsimp only [L] |
| 212 | ring |
| 213 | _ ≤ N.scale * Real.sqrt (1 - N.epsilon) * L := |
| 214 | mul_le_mul_of_nonneg_right |
| 215 | (mul_le_mul_of_nonneg_left hb N.scale_pos.le) hL.le |
| 216 | · apply hcenters.2.trans |
| 217 | apply ENNReal.ofReal_le_ofReal |
| 218 | have heone : N.epsilon ≤ 1 := hcap.trans (by norm_num) |
| 219 | have hp' : Real.sqrt (1 + N.epsilon) ≤ 1 + N.epsilon := |
| 220 | Real.sqrt_le_iff.mpr ⟨by positivity, by nlinarith [N.epsilon_pos]⟩ |
| 221 | have hesq : N.epsilon ^ 2 ≤ N.epsilon := by nlinarith [N.epsilon_pos] |
| 222 | have hfactor : Real.sqrt (1 + N.epsilon) * (1 + C * N.epsilon) ≤ |
| 223 | (1.01 : ℝ) := by |
| 224 | calc |
| 225 | _ ≤ (1 + N.epsilon) * (1 + C * N.epsilon) := |
| 226 | mul_le_mul_of_nonneg_right hp' (by positivity) |
| 227 | _ ≤ 1 + 2 * (C + 1) * N.epsilon := by |
| 228 | nlinarith [mul_le_mul_of_nonneg_left hesq hC.le, N.epsilon_pos] |
| 229 | _ ≤ _ := by nlinarith |
| 230 | have hLe : L * N.epsilon = 1 := inv_mul_cancel₀ N.epsilon_pos.ne' |
| 231 | have hsum : L + C = L * (1 + C * N.epsilon) := by |
| 232 | calc |
| 233 | L + C = L + C * (L * N.epsilon) := by rw [hLe]; ring |
| 234 | _ = _ := by ring |
| 235 | change N.scale * Real.sqrt (1 + N.epsilon) * (L + C) ≤ |
| 236 | (1.01 : ℝ) * N.scale * L |
| 237 | calc |
| 238 | _ = N.scale * L * (Real.sqrt (1 + N.epsilon) * (1 + C * N.epsilon)) := by |
| 239 | rw [hsum] |
| 240 | ring |
| 241 | _ ≤ N.scale * L * (1.01 : ℝ) := |
| 242 | mul_le_mul_of_nonneg_left hfactor (mul_nonneg N.scale_pos.le hL.le) |
| 243 | _ = _ := by ring |
| 244 | |
| 245 | end PoincareMT.EpsilonNeck |