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.Curvature.Integral.Induction.Boundary |
| 2 | import PoincareLib.Geometry.Curvature.Integral.Induction.LevelScalar |
| 3 | import PoincareLib.Geometry.Curvature.Integral.Induction.SlabError |
| 4 | |
| 5 | /-! |
| 6 | # Scalar slab estimates with their scale dependence |
| 7 | |
| 8 | The scalar estimate on the actual induced levels remains an explicit |
| 9 | lower-dimensional induction premise. Compact-slab continuity permits its |
| 10 | integration; the sectional error and endpoint area estimates then give a |
| 11 | bound retaining the level offset and endpoint powers. Reference: Petrunin, Section 4.5, |
| 12 | Intermediate inequality, author manuscript pp. 11--12. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | set_option maxHeartbeats 800000 |
| 18 | |
| 19 | open Set MeasureTheory |
| 20 | open Poincare.Geometry.Manifold.RegularLevel |
| 21 | open scoped Manifold ContDiff Bundle Topology |
| 22 | |
| 23 | namespace PoincareMT.LeviCivitaData |
| 24 | |
| 25 | variable {m : ℕ} {M : Type*} [TopologicalSpace M] |
| 26 | [MeasurableSpace M] [BorelSpace M] [T3Space M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin (m + 2))) M] |
| 28 | [IsManifold (𝓡 (m + 2)) ∞ M] |
| 29 | {g : RiemannianMetric (m + 2) M} |
| 30 | |
| 31 | /-- Petrunin's intermediate slab bound, conditional on the unweighted |
| 32 | positive scalar estimate in one lower dimension for the actual induced metrics. -/ |
| 33 | theorem integral_scalarCurvature_posPart_slab_le_of_scaled_level_induction |
| 34 | (D : LeviCivitaData g) |
| 35 | {f : M → ℝ} (hf : ContMDiff (𝓡 (m + 2)) 𝓘(ℝ, ℝ) ∞ f) |
| 36 | {I : Set ℝ} (hI : IsOpen I) |
| 37 | (hproper : IsProperMap (I.restrictPreimage f)) |
| 38 | (hreg : ∀ x, f x ∈ I → mfderiv (𝓡 (m + 2)) 𝓘(ℝ, ℝ) f x ≠ 0) |
| 39 | {a b α C κ : ℝ} (ha : 0 < a) (hab : a < b) |
| 40 | (hm : 2 ≤ m + 1) (hα : 0 < α) (hC : 0 ≤ C) (hslab : Icc a b ⊆ I) |
| 41 | {K : M → ℝ} (hKc : ContinuousOn K (g.regularDomain hf)) |
| 42 | (hK : ∀ x ∈ f ⁻¹' Icc a b, 0 ≤ K x) |
| 43 | (hsec : ∀ x ∈ f ⁻¹' Icc a b, ∀ v w : TangentSpace (𝓡 (m + 2)) x, |
| 44 | -K x ≤ D.sectionalCurvature x v w) |
| 45 | (harea : ∀ t ∈ Icc a b, g.regularLevelArea hf t ≤ α * t ^ (m + 1)) |
| 46 | (hhess : ∀ t ∈ Icc a b, ∀ x, f x = t → ∀ v : TangentSpace (𝓡 (m + 2)) x, |
| 47 | g.inner x (D.gradient f x) v = 0 → |
| 48 | D.hessian f x v v / Real.sqrt (D.levelQ f x) ≤ (α / t) * g.inner x v v) |
| 49 | (hspeed : ∀ x ∈ f ⁻¹' Icc a b, |
| 50 | 1 / α ≤ g.tangentNorm x (g.gradient f x) ∧ |
| 51 | g.tangentNorm x (g.gradient f x) ≤ 1) : |
| 52 | let U := g.regularDomain hf |
| 53 | letI : Fact (Module.finrank ℝ (EuclideanSpace ℝ (Fin (m + 2))) = m + 2) := |
| 54 | ⟨finrank_euclideanSpace_fin⟩ |
| 55 | letI (t : ℝ) := openLevelSetChartedSpace hf U (g.regularDomain_regular hf) (m + 1) t |
| 56 | letI (t : ℝ) := isManifold_openLevelSet hf U (g.regularDomain_regular hf) (m + 1) t |
| 57 | let DL := fun t => (RiemannianMetric.regularLevelMetric |
| 58 | hf U (g.regularDomain_regular hf) t g).leviCivitaData |
| 59 | (∀ t ∈ Icc a b, |
| 60 | (∫ z, max 0 ((DL t).scalarCurvature z) |
| 61 | ∂g.regularLevelVolume hf U (g.regularDomain_regular hf) t) ≤ |
| 62 | C * (κ + ∫ z, D.levelSectionalError f K (α / t) (openLevelIncl f U t z) |
| 63 | ∂g.regularLevelVolume hf U (g.regularDomain_regular hf) t)) → |
| 64 | (∫ x in f ⁻¹' Icc a b, max 0 (D.scalarCurvature x) ∂g.volumeMeasure) ≤ |
| 65 | 2 * (α * C + ((m + 2 : ℕ) : ℝ) ^ 2) * |
| 66 | (∫ x in f ⁻¹' Icc a b, K x ∂g.volumeMeasure) + |
| 67 | 2 * α * C * (κ * (b - a) + |
| 68 | (((m + 1 : ℕ) : ℝ) * (1 + α) * α ^ 3 + α ^ 2) * b ^ m) + |
| 69 | 2 * ((m + 1 : ℕ) : ℝ) * (α ^ 2 + α ^ 3) * b ^ m - |
| 70 | 2 * deriv (g.regularLevelArea hf) b := by |
| 71 | let U := g.regularDomain hf |
| 72 | let : Fact (Module.finrank ℝ (EuclideanSpace ℝ (Fin (m + 2))) = m + 2) := |
| 73 | ⟨finrank_euclideanSpace_fin⟩ |
| 74 | let (t : ℝ) := openLevelSetChartedSpace hf U (g.regularDomain_regular hf) (m + 1) t |
| 75 | let (t : ℝ) := isManifold_openLevelSet hf U (g.regularDomain_regular hf) (m + 1) t |
| 76 | let DL := fun t => (RiemannianMetric.regularLevelMetric |
| 77 | hf U (g.regularDomain_regular hf) t g).leviCivitaData |
| 78 | dsimp only |
| 79 | intro hind |
| 80 | let μ := fun t => g.regularLevelVolume hf U (g.regularDomain_regular hf) t |
| 81 | let A := g.regularLevelArea hf |
| 82 | let S := fun x => D.scalarCurvature x - |
| 83 | 2 * D.ricci x (D.levelUnitNormal f x) (D.levelUnitNormal f x) + D.levelGaussTerm f x |
| 84 | let W := fun t => ∫ z, max 0 ((DL t).scalarCurvature z) / |
| 85 | g.tangentNorm (openLevelIncl f U t z) (g.gradient f (openLevelIncl f U t z)) ∂μ t |
| 86 | let J := fun t => ∫ z, K (openLevelIncl f U t z) ∂μ t |
| 87 | let N := fun t => ∫ z, max 0 (-D.levelMeanCurvature f (openLevelIncl f U t z)) ∂μ t |
| 88 | let E := fun t => ∫ z, |
| 89 | D.levelSectionalError f K (α / t) (openLevelIncl f U t z) ∂μ t |
| 90 | have hc := Poincare.Coarea.isCompact_slab_of_isProperMap hproper hslab |
| 91 | have hU : f ⁻¹' Icc a b ⊆ U := fun x hx => |
| 92 | (g.mem_regularDomain_iff hf x).mpr (hreg x (hslab hx)) |
| 93 | have hUq : (U : Set M) ⊆ {x | 0 < D.levelQ f x} := |
| 94 | fun _ hx => Real.sqrt_pos.mp hx |
| 95 | have hSc : ContinuousOn S U := |
| 96 | (D.continuous_scalarCurvature.continuousOn.sub |
| 97 | ((D.continuousOn_ricci_levelUnitNormal hf).mono hUq |>.const_mul 2)).add |
| 98 | ((D.continuousOn_levelGaussTerm hf).mono hUq) |
| 99 | have hSquot : ContinuousOn |
| 100 | (fun x => max 0 (S x) / g.tangentNorm x (g.gradient f x)) U := |
| 101 | ((continuousOn_const (c := (0 : ℝ))).sup hSc).div |
| 102 | (g.continuous_tangentNorm_gradient hf).continuousOn (fun _ hx => ne_of_gt hx) |
| 103 | have hscalar (t : ℝ) (z : openLevelSet f U t) : |
| 104 | (DL t).scalarCurvature z = S (openLevelIncl f U t z) := |
| 105 | D.regularLevel_scalarCurvature_gauss g hf U (g.regularDomain_regular hf) t (DL t) z |
| 106 | have hWc : ContinuousOn W (Icc a b) := by |
| 107 | apply (g.continuousOn_regularLevelIntegral_compact_slab hf U |
| 108 | (g.regularDomain_regular hf) hc hU hSquot).congr |
| 109 | intro t _ |
| 110 | apply integral_congr_ae |
| 111 | filter_upwards [] with z |
| 112 | rw [hscalar] |
| 113 | have hJc : ContinuousOn J (Icc a b) := |
| 114 | g.continuousOn_regularLevelIntegral_compact_slab hf U |
| 115 | (g.regularDomain_regular hf) hc hU hKc |
| 116 | have hNc : ContinuousOn N (Icc a b) := |
| 117 | g.continuousOn_regularLevelIntegral_compact_slab hf U |
| 118 | (g.regularDomain_regular hf) hc hU |
| 119 | ((continuousOn_const (c := (0 : ℝ))).sup |
| 120 | (D.continuousOn_levelMeanCurvature_regularDomain hf).neg) |
| 121 | have hAc : ContinuousOn A (Icc a b) := |
| 122 | (D.first_variation_regularLevelArea hf hI hproper hreg).1.continuousOn.mono hslab |
| 123 | have hβc : ContinuousOn (fun t : ℝ => α / t) (Icc a b) := |
| 124 | continuousOn_const.div continuousOn_id (fun t ht => (ha.trans_le ht.1).ne') |
| 125 | have hEc : ContinuousOn E (Icc a b) := by |
| 126 | apply (hJc.add ((hNc.add ((hβc.const_mul (m + 1 : ℕ)).mul hAc)).mul hβc)).congr |
| 127 | intro t ht |
| 128 | exact D.integral_levelSectionalError_eq hf hI hproper hreg (hslab ht) hKc (α / t) |
| 129 | have hWi := hWc.integrableOn_compact isCompact_Icc (μ := volume) |
| 130 | have hEi := ((continuousOn_const (c := κ)).add hEc).integrableOn_compact |
| 131 | isCompact_Icc (μ := volume) |
| 132 | have hpoint (t : ℝ) (ht : t ∈ Icc a b) : W t ≤ α * C * (κ + E t) := by |
| 133 | have hw := D.integral_regularLevel_scalarCurvature_posPart_div_speed_le |
| 134 | hf hI hproper hreg (hslab ht) hα |
| 135 | (fun x hx => (hspeed x (by change f x ∈ Icc a b; rwa [hx])).1) |
| 136 | have hi := mul_le_mul_of_nonneg_left (hind t ht) hα.le |
| 137 | dsimp only at hw |
| 138 | change W t ≤ _ at hw |
| 139 | change α * _ ≤ α * (C * (κ + E t)) at hi |
| 140 | exact hw.trans (by simpa only [mul_assoc] using hi) |
| 141 | have hweighted := setIntegral_mono_on hWi (hEi.const_mul (α * C)) measurableSet_Icc hpoint |
| 142 | rw [integral_const_mul] at hweighted |
| 143 | have herr₀ := D.integral_regularLevel_sectionalError_le_with_scale |
| 144 | hf hI hproper hreg ha hab.le hm hα hslab hKc hK harea hhess hspeed |
| 145 | change (∫ t in Icc a b, 1 + E t) ≤ _ at herr₀ |
| 146 | have hEi₀ := hEc.integrableOn_compact isCompact_Icc (μ := volume) |
| 147 | have hi₁ : IntegrableOn (fun _ : ℝ => (1 : ℝ)) (Icc a b) volume := |
| 148 | continuousOn_const.integrableOn_compact isCompact_Icc |
| 149 | have hiκ : IntegrableOn (fun _ : ℝ => κ) (Icc a b) volume := |
| 150 | continuousOn_const.integrableOn_compact isCompact_Icc |
| 151 | have hshift : (∫ t in Icc a b, κ + E t) = |
| 152 | (κ - 1) * (b - a) + ∫ t in Icc a b, 1 + E t := by |
| 153 | rw [integral_add hiκ hEi₀, integral_add hi₁ hEi₀] |
| 154 | simp only [integral_const, smul_eq_mul, mul_one, Measure.real, |
| 155 | Measure.restrict_apply_univ] |
| 156 | rw [← Measure.real, Real.volume_real_Icc_of_le hab.le] |
| 157 | ring |
| 158 | have herr : (∫ t in Icc a b, κ + E t) ≤ |
| 159 | (∫ x in f ⁻¹' Icc a b, K x ∂g.volumeMeasure) + |
| 160 | (κ * (b - a) + (((m + 1 : ℕ) : ℝ) * (1 + α) * α ^ 3 + α ^ 2) * b ^ m) := by |
| 161 | simp only [Nat.add_sub_cancel] at herr₀ |
| 162 | rw [hshift] |
| 163 | nlinarith only [herr₀] |
| 164 | have hlevels : (∫ t in Icc a b, W t) ≤ α * C * |
| 165 | ((∫ x in f ⁻¹' Icc a b, K x ∂g.volumeMeasure) + |
| 166 | (κ * (b - a) + (((m + 1 : ℕ) : ℝ) * (1 + α) * α ^ 3 + α ^ 2) * b ^ m)) := |
| 167 | hweighted.trans (mul_le_mul_of_nonneg_left herr (mul_nonneg hα.le hC)) |
| 168 | have hendpoint (t : ℝ) (ht : t ∈ Icc a b) : (α / t) * A t ≤ α ^ 2 * b ^ m := by |
| 169 | have htpos : 0 < t := ha.trans_le ht.1 |
| 170 | have hbnd := Poincare.CurvatureIntegral.area_mul_reciprocal_le_pow htpos |
| 171 | (by omega : 1 ≤ m + 1) hα.le (harea t ht) |
| 172 | simp only [Nat.add_sub_cancel] at hbnd |
| 173 | rw [mul_comm] at hbnd |
| 174 | exact hbnd.trans (mul_le_mul_of_nonneg_left |
| 175 | (pow_le_pow_left₀ htpos.le ht.2 m) (sq_nonneg α)) |
| 176 | have hleft := mul_le_mul_of_nonneg_left (hendpoint a ⟨le_rfl, hab.le⟩) |
| 177 | (mul_nonneg (by norm_num : (0 : ℝ) ≤ 2) (Nat.cast_nonneg (m + 1))) |
| 178 | have hright := mul_le_mul_of_nonneg_left (hendpoint b ⟨hab.le, le_rfl⟩) |
| 179 | (mul_nonneg (mul_nonneg (by norm_num : (0 : ℝ) ≤ 2) |
| 180 | (Nat.cast_nonneg (m + 1))) hα.le) |
| 181 | have hboundary := D.integral_scalarCurvature_posPart_le_regularLevels_area |
| 182 | hf hI hproper hreg hab hslab hα (div_nonneg hα.le ha.le) |
| 183 | (div_nonneg hα.le (ha.trans hab).le) (hKc.mono hU) hK hsec |
| 184 | (hhess a ⟨le_rfl, hab.le⟩) (hhess b ⟨hab.le, le_rfl⟩) |
| 185 | (fun x hx => hspeed x (by change f x ∈ Icc a b; rw [hx]; exact ⟨hab.le, le_rfl⟩)) |
| 186 | dsimp only at hboundary |
| 187 | change (∫ x in f ⁻¹' Icc a b, max 0 (D.scalarCurvature x) ∂g.volumeMeasure) ≤ |
| 188 | 2 * (∫ t in Icc a b, W t) + |
| 189 | 2 * ((m + 2 : ℕ) : ℝ) ^ 2 * (∫ x in f ⁻¹' Icc a b, K x ∂g.volumeMeasure) + |
| 190 | 2 * ((m + 1 : ℕ) : ℝ) * (α / a) * A a + |
| 191 | 2 * ((m + 1 : ℕ) : ℝ) * α * (α / b) * A b - 2 * deriv A b at hboundary |
| 192 | change (∫ x in f ⁻¹' Icc a b, max 0 (D.scalarCurvature x) ∂g.volumeMeasure) ≤ |
| 193 | 2 * (α * C + ((m + 2 : ℕ) : ℝ) ^ 2) * |
| 194 | (∫ x in f ⁻¹' Icc a b, K x ∂g.volumeMeasure) + |
| 195 | 2 * α * C * (κ * (b - a) + |
| 196 | (((m + 1 : ℕ) : ℝ) * (1 + α) * α ^ 3 + α ^ 2) * b ^ m) + |
| 197 | 2 * ((m + 1 : ℕ) : ℝ) * (α ^ 2 + α ^ 3) * b ^ m - 2 * deriv A b |
| 198 | nlinarith only [hboundary, hlevels, hleft, hright] |
| 199 | |
| 200 | /-- Unit-scale specialization retaining the original scalar slab interface. -/ |
| 201 | theorem integral_scalarCurvature_posPart_slab_le_of_level_induction |
| 202 | (D : LeviCivitaData g) |
| 203 | {f : M → ℝ} (hf : ContMDiff (𝓡 (m + 2)) 𝓘(ℝ, ℝ) ∞ f) |
| 204 | {I : Set ℝ} (hI : IsOpen I) |
| 205 | (hproper : IsProperMap (I.restrictPreimage f)) |
| 206 | (hreg : ∀ x, f x ∈ I → mfderiv (𝓡 (m + 2)) 𝓘(ℝ, ℝ) f x ≠ 0) |
| 207 | {a b α C : ℝ} (ha : 0 < a) (hab : a < b) (hb : b ≤ 1) |
| 208 | (hm : 2 ≤ m + 1) (hα : 0 < α) (hC : 0 ≤ C) (hslab : Icc a b ⊆ I) |
| 209 | {K : M → ℝ} (hKc : ContinuousOn K (g.regularDomain hf)) |
| 210 | (hK : ∀ x ∈ f ⁻¹' Icc a b, 0 ≤ K x) |
| 211 | (hsec : ∀ x ∈ f ⁻¹' Icc a b, ∀ v w : TangentSpace (𝓡 (m + 2)) x, |
| 212 | -K x ≤ D.sectionalCurvature x v w) |
| 213 | (harea : ∀ t ∈ Icc a b, g.regularLevelArea hf t ≤ α * t ^ (m + 1)) |
| 214 | (hhess : ∀ t ∈ Icc a b, ∀ x, f x = t → ∀ v : TangentSpace (𝓡 (m + 2)) x, |
| 215 | g.inner x (D.gradient f x) v = 0 → |
| 216 | D.hessian f x v v / Real.sqrt (D.levelQ f x) ≤ (α / t) * g.inner x v v) |
| 217 | (hspeed : ∀ x ∈ f ⁻¹' Icc a b, |
| 218 | 1 / α ≤ g.tangentNorm x (g.gradient f x) ∧ |
| 219 | g.tangentNorm x (g.gradient f x) ≤ 1) : |
| 220 | let U := g.regularDomain hf |
| 221 | letI : Fact (Module.finrank ℝ (EuclideanSpace ℝ (Fin (m + 2))) = m + 2) := |
| 222 | ⟨finrank_euclideanSpace_fin⟩ |
| 223 | letI (t : ℝ) := openLevelSetChartedSpace hf U (g.regularDomain_regular hf) (m + 1) t |
| 224 | letI (t : ℝ) := isManifold_openLevelSet hf U (g.regularDomain_regular hf) (m + 1) t |
| 225 | let DL := fun t => (RiemannianMetric.regularLevelMetric |
| 226 | hf U (g.regularDomain_regular hf) t g).leviCivitaData |
| 227 | (∀ t ∈ Icc a b, |
| 228 | (∫ z, max 0 ((DL t).scalarCurvature z) |
| 229 | ∂g.regularLevelVolume hf U (g.regularDomain_regular hf) t) ≤ |
| 230 | C * (1 + ∫ z, D.levelSectionalError f K (α / t) (openLevelIncl f U t z) |
| 231 | ∂g.regularLevelVolume hf U (g.regularDomain_regular hf) t)) → |
| 232 | (∫ x in f ⁻¹' Icc a b, max 0 (D.scalarCurvature x) ∂g.volumeMeasure) ≤ |
| 233 | 2 * (α * C + ((m + 2 : ℕ) : ℝ) ^ 2) * |
| 234 | (∫ x in f ⁻¹' Icc a b, K x ∂g.volumeMeasure) + |
| 235 | 2 * α * C * (1 + ((m + 1 : ℕ) : ℝ) * (1 + α) * α ^ 3 + α ^ 2) + |
| 236 | 2 * ((m + 1 : ℕ) : ℝ) * (α ^ 2 + α ^ 3) - |
| 237 | 2 * deriv (g.regularLevelArea hf) b := by |
| 238 | dsimp only |
| 239 | intro hind |
| 240 | have h := D.integral_scalarCurvature_posPart_slab_le_of_scaled_level_induction |
| 241 | hf hI hproper hreg ha hab hm hα hC hslab hKc hK hsec harea hhess hspeed |
| 242 | (κ := 1) |
| 243 | dsimp only at h |
| 244 | specialize h hind |
| 245 | have hp : b ^ m ≤ 1 := pow_le_one₀ (ha.trans hab).le hb |
| 246 | let E := ((m + 1 : ℕ) : ℝ) * (1 + α) * α ^ 3 + α ^ 2 |
| 247 | have hE : 0 ≤ E := by dsimp [E]; positivity |
| 248 | have hpE := mul_le_mul_of_nonneg_left hp hE |
| 249 | have hlen : 1 * (b - a) + E * b ^ m ≤ 1 + E := by |
| 250 | linarith only [ha, hb, hpE] |
| 251 | have hleft := mul_le_mul_of_nonneg_left hlen |
| 252 | (show 0 ≤ 2 * α * C by positivity) |
| 253 | have hright := mul_le_mul_of_nonneg_left hp |
| 254 | (show 0 ≤ 2 * ((m + 1 : ℕ) : ℝ) * (α ^ 2 + α ^ 3) by positivity) |
| 255 | dsimp only [E] at hleft |
| 256 | nlinarith only [h, hleft, hright] |
| 257 | |
| 258 | end PoincareMT.LeviCivitaData |