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.Coarea |
| 2 | import PoincareLib.Geometry.Curvature.Integral.Induction.SectionalIntegral |
| 3 | import PoincareLib.Geometry.Curvature.Integral.AreaScaleEstimates |
| 4 | |
| 5 | /-! |
| 6 | # Integrated errors for the regular-level induction |
| 7 | |
| 8 | The reciprocal principal-curvature scale and the area growth bound give a |
| 9 | uniform slab error. Coarea replaces the level integrals of the ambient |
| 10 | curvature error by its ambient integral. Reference: Petrunin, Section 4.5, |
| 11 | Intermediate inequality, author manuscript pp. 11--12. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set MeasureTheory |
| 18 | open Poincare.Geometry.Manifold.RegularLevel |
| 19 | open scoped Manifold ContDiff Bundle Topology |
| 20 | |
| 21 | namespace PoincareMT.LeviCivitaData |
| 22 | |
| 23 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 24 | [MeasurableSpace M] [BorelSpace M] [T3Space M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin (n + 1))) M] |
| 26 | [IsManifold (𝓡 (n + 1)) ∞ M] |
| 27 | {g : RiemannianMetric (n + 1) M} |
| 28 | |
| 29 | /-- Power area growth absorbs the integrated sectional error on a proper |
| 30 | regular slab. All level integrals use the actual induced metric volume. -/ |
| 31 | theorem integral_regularLevel_sectionalError_le_with_scale |
| 32 | (D : LeviCivitaData g) |
| 33 | {f : M → ℝ} (hf : ContMDiff (𝓡 (n + 1)) 𝓘(ℝ, ℝ) ∞ f) |
| 34 | {I : Set ℝ} (hI : IsOpen I) |
| 35 | (hproper : IsProperMap (I.restrictPreimage f)) |
| 36 | (hreg : ∀ x, f x ∈ I → mfderiv (𝓡 (n + 1)) 𝓘(ℝ, ℝ) f x ≠ 0) |
| 37 | {a b α : ℝ} (ha : 0 < a) (hab : a ≤ b) |
| 38 | (hn : 2 ≤ n) (hα : 0 < α) (hslab : Icc a b ⊆ I) |
| 39 | {K : M → ℝ} (hKc : ContinuousOn K (g.regularDomain hf)) |
| 40 | (hK : ∀ x ∈ f ⁻¹' Icc a b, 0 ≤ K x) |
| 41 | (harea : ∀ t ∈ Icc a b, g.regularLevelArea hf t ≤ α * t ^ n) |
| 42 | (hhess : ∀ t ∈ Icc a b, ∀ x, f x = t → |
| 43 | ∀ v : TangentSpace (𝓡 (n + 1)) x, |
| 44 | g.inner x (D.gradient f x) v = 0 → |
| 45 | D.hessian f x v v / Real.sqrt (D.levelQ f x) ≤ (α / t) * g.inner x v v) |
| 46 | (hspeed : ∀ x ∈ f ⁻¹' Icc a b, |
| 47 | 1 / α ≤ g.tangentNorm x (g.gradient f x) ∧ |
| 48 | g.tangentNorm x (g.gradient f x) ≤ 1) : |
| 49 | (∫ t in Icc a b, 1 + ∫ z, |
| 50 | D.levelSectionalError f K (α / t) (openLevelIncl f (g.regularDomain hf) t z) |
| 51 | ∂g.regularLevelVolume hf (g.regularDomain hf) (g.regularDomain_regular hf) t) ≤ |
| 52 | (∫ x in f ⁻¹' Icc a b, K x ∂g.volumeMeasure) + |
| 53 | ((b - a) + ((n : ℝ) * (1 + α) * α ^ 3 + α ^ 2) * b ^ (n - 1)) := by |
| 54 | let U := g.regularDomain hf |
| 55 | let A := g.regularLevelArea hf |
| 56 | let J := fun t => ∫ z, K (openLevelIncl f U t z) |
| 57 | ∂g.regularLevelVolume hf U (g.regularDomain_regular hf) t |
| 58 | let N := fun t => ∫ z, max 0 (-D.levelMeanCurvature f (openLevelIncl f U t z)) |
| 59 | ∂g.regularLevelVolume hf U (g.regularDomain_regular hf) t |
| 60 | let E := fun t => ∫ z, D.levelSectionalError f K (α / t) (openLevelIncl f U t z) |
| 61 | ∂g.regularLevelVolume hf U (g.regularDomain_regular hf) t |
| 62 | have hc := Poincare.Coarea.isCompact_slab_of_isProperMap hproper hslab |
| 63 | have hU : f ⁻¹' Icc a b ⊆ U := fun x hx => |
| 64 | (g.mem_regularDomain_iff hf x).mpr (hreg x (hslab hx)) |
| 65 | have hJc : ContinuousOn J (Icc a b) := |
| 66 | g.continuousOn_regularLevelIntegral_compact_slab hf U |
| 67 | (g.regularDomain_regular hf) hc hU hKc |
| 68 | have hNc : ContinuousOn N (Icc a b) := |
| 69 | g.continuousOn_regularLevelIntegral_compact_slab hf U |
| 70 | (g.regularDomain_regular hf) hc hU |
| 71 | ((continuousOn_const (c := (0 : ℝ))).sup |
| 72 | (D.continuousOn_levelMeanCurvature_regularDomain hf).neg) |
| 73 | have hAs := (D.first_variation_regularLevelArea hf hI hproper hreg).1 |
| 74 | have hAc : ContinuousOn A (Icc a b) := hAs.continuousOn.mono hslab |
| 75 | have hDc : ContinuousOn (deriv A) (Icc a b) := |
| 76 | (hAs.continuousOn_deriv_of_isOpen hI (by simp)).mono hslab |
| 77 | have hβc : ContinuousOn (fun t : ℝ => α / t) (Icc a b) := |
| 78 | continuousOn_const.div continuousOn_id (fun t ht => (ha.trans_le ht.1).ne') |
| 79 | have hEc : ContinuousOn E (Icc a b) := by |
| 80 | apply (hJc.add ((hNc.add ((hβc.const_mul n).mul hAc)).mul hβc)).congr |
| 81 | intro t ht |
| 82 | exact D.integral_levelSectionalError_eq hf hI hproper hreg (hslab ht) hKc (α / t) |
| 83 | have hWi := (hAc.mul (hβc.pow 2)).integrableOn_compact isCompact_Icc |
| 84 | (μ := volume) |
| 85 | have hDi := (hDc.mul hβc).integrableOn_compact isCompact_Icc (μ := volume) |
| 86 | have hJi := hJc.integrableOn_compact isCompact_Icc (μ := volume) |
| 87 | have hEi := hEc.integrableOn_compact isCompact_Icc (μ := volume) |
| 88 | have hi1 : IntegrableOn (fun _ : ℝ => (1 : ℝ)) (Icc a b) volume := |
| 89 | continuousOn_const.integrableOn_compact isCompact_Icc |
| 90 | have hpoint (t : ℝ) (ht : t ∈ Icc a b) : |
| 91 | 1 + E t ≤ J t + (1 + (n : ℝ) * (1 + α) * (A t * (α / t) ^ 2) - |
| 92 | deriv A t * (α / t)) := by |
| 93 | have h := D.integral_levelSectionalError_le hf hI hproper hreg (hslab ht) |
| 94 | hα (div_nonneg hα.le (ha.trans_le ht.1).le) hKc (hhess t ht) |
| 95 | (fun x hx => hspeed x (by change f x ∈ Icc a b; rwa [hx])) |
| 96 | change E t ≤ J t + (n : ℝ) * (1 + α) * (α / t) ^ 2 * A t - |
| 97 | (α / t) * deriv A t at h |
| 98 | nlinarith only [h] |
| 99 | have hbound := setIntegral_mono_on (hi1.add hEi) |
| 100 | (hJi.add ((hi1.add (hWi.const_mul ((n : ℝ) * (1 + α)))).sub hDi)) |
| 101 | measurableSet_Icc hpoint |
| 102 | have hareaErr := Poincare.CurvatureIntegral.area_error_le_mul_pow |
| 103 | ha hab hn hα.le hAc |
| 104 | ((hAs.differentiableOn (by simp)).mono (Ioo_subset_Icc_self.trans hslab)) |
| 105 | (by apply ContinuousOn.intervalIntegrable; rwa [uIcc_of_le hab]) |
| 106 | (fun t ht => ⟨g.regularLevelArea_nonneg hf t, harea t ht⟩) |
| 107 | simp only [intervalIntegral.integral_of_le hab, ← integral_Icc_eq_integral_Ioc] at hareaErr |
| 108 | have hKbound : (∫ t in Icc a b, J t) ≤ ∫ x in f ⁻¹' Icc a b, K x ∂g.volumeMeasure := by |
| 109 | let s := fun x => g.tangentNorm x (g.gradient f x) |
| 110 | have hsc : Continuous s := g.continuous_tangentNorm_gradient hf |
| 111 | have heq := g.integral_coarea_compact_slab hf U (g.regularDomain_regular hf) |
| 112 | hc hU (hKc.mul hsc.continuousOn) |
| 113 | dsimp only [Pi.mul_apply] at heq |
| 114 | have hEq : (∫ x in f ⁻¹' Icc a b, K x * s x ∂g.volumeMeasure) = ∫ t in Icc a b, J t := by |
| 115 | rw [heq] |
| 116 | apply setIntegral_congr_fun measurableSet_Icc |
| 117 | intro t ht |
| 118 | apply integral_congr_ae |
| 119 | filter_upwards [] with z |
| 120 | exact mul_div_cancel_right₀ _ (ne_of_gt z.1.2) |
| 121 | rw [← hEq] |
| 122 | exact setIntegral_mono_on ((hKc.mul hsc.continuousOn).mono hU |>.integrableOn_compact hc) |
| 123 | ((hKc.mono hU).integrableOn_compact hc) |
| 124 | (isClosed_Icc.preimage hf.continuous).measurableSet |
| 125 | (fun x hx => by simpa only [mul_one] using |
| 126 | mul_le_mul_of_nonneg_left (hspeed x hx).2 (hK x hx)) |
| 127 | change (∫ t in Icc a b, 1 + E t) ≤ _ at hbound ⊢ |
| 128 | simp only [Pi.add_apply, Pi.sub_apply, Pi.mul_apply, Pi.pow_apply] at hbound |
| 129 | change IntegrableOn (fun t => A t * (α / t) ^ 2) (Icc a b) volume at hWi |
| 130 | change IntegrableOn (fun t => deriv A t * (α / t)) (Icc a b) volume at hDi |
| 131 | have hiP : IntegrableOn (fun t => 1 + (n : ℝ) * (1 + α) * |
| 132 | (A t * (α / t) ^ 2)) (Icc a b) volume := |
| 133 | hi1.add (hWi.const_mul ((n : ℝ) * (1 + α))) |
| 134 | have hiR : IntegrableOn (fun t => 1 + (n : ℝ) * (1 + α) * |
| 135 | (A t * (α / t) ^ 2) - deriv A t * (α / t)) (Icc a b) volume := hiP.sub hDi |
| 136 | rw [integral_add hJi hiR, integral_sub hiP hDi, |
| 137 | integral_add hi1 (hWi.const_mul ((n : ℝ) * (1 + α))), integral_const_mul, |
| 138 | integral_const, smul_eq_mul, mul_one, Measure.real, Measure.restrict_apply_univ, |
| 139 | ← Measure.real, Real.volume_real_Icc_of_le hab] at hbound |
| 140 | linarith only [hbound, hareaErr, hKbound] |
| 141 | |
| 142 | /-- The unit-scale specialization of the radius-sensitive sectional error |
| 143 | bound preserves the original interface. -/ |
| 144 | theorem integral_regularLevel_sectionalError_le_of_power_bound |
| 145 | (D : LeviCivitaData g) |
| 146 | {f : M → ℝ} (hf : ContMDiff (𝓡 (n + 1)) 𝓘(ℝ, ℝ) ∞ f) |
| 147 | {I : Set ℝ} (hI : IsOpen I) |
| 148 | (hproper : IsProperMap (I.restrictPreimage f)) |
| 149 | (hreg : ∀ x, f x ∈ I → mfderiv (𝓡 (n + 1)) 𝓘(ℝ, ℝ) f x ≠ 0) |
| 150 | {a b α : ℝ} (ha : 0 < a) (hab : a ≤ b) (hb : b ≤ 1) |
| 151 | (hn : 2 ≤ n) (hα : 0 < α) (hslab : Icc a b ⊆ I) |
| 152 | {K : M → ℝ} (hKc : ContinuousOn K (g.regularDomain hf)) |
| 153 | (hK : ∀ x ∈ f ⁻¹' Icc a b, 0 ≤ K x) |
| 154 | (harea : ∀ t ∈ Icc a b, g.regularLevelArea hf t ≤ α * t ^ n) |
| 155 | (hhess : ∀ t ∈ Icc a b, ∀ x, f x = t → |
| 156 | ∀ v : TangentSpace (𝓡 (n + 1)) x, |
| 157 | g.inner x (D.gradient f x) v = 0 → |
| 158 | D.hessian f x v v / Real.sqrt (D.levelQ f x) ≤ (α / t) * g.inner x v v) |
| 159 | (hspeed : ∀ x ∈ f ⁻¹' Icc a b, |
| 160 | 1 / α ≤ g.tangentNorm x (g.gradient f x) ∧ |
| 161 | g.tangentNorm x (g.gradient f x) ≤ 1) : |
| 162 | (∫ t in Icc a b, 1 + ∫ z, |
| 163 | D.levelSectionalError f K (α / t) (openLevelIncl f (g.regularDomain hf) t z) |
| 164 | ∂g.regularLevelVolume hf (g.regularDomain hf) (g.regularDomain_regular hf) t) ≤ |
| 165 | (∫ x in f ⁻¹' Icc a b, K x ∂g.volumeMeasure) + |
| 166 | (1 + (n : ℝ) * (1 + α) * α ^ 3 + α ^ 2) := by |
| 167 | have h := D.integral_regularLevel_sectionalError_le_with_scale hf hI hproper hreg |
| 168 | ha hab hn hα hslab hKc hK harea hhess hspeed |
| 169 | have hp : b ^ (n - 1) ≤ 1 := pow_le_one₀ (ha.trans_le hab).le hb |
| 170 | have hcoef : 0 ≤ (n : ℝ) * (1 + α) * α ^ 3 + α ^ 2 := by positivity |
| 171 | have hscale := mul_le_mul_of_nonneg_left hp hcoef |
| 172 | linarith only [h, hscale, ha, hb] |
| 173 | |
| 174 | end PoincareMT.LeviCivitaData |