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.Analysis.Calculus.MeanValue.LowerDerivative |
| 2 | import Mathlib.Analysis.Calculus.Deriv.Inv |
| 3 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.IntegrationByParts |
| 4 | import Mathlib.Tactic |
| 5 | |
| 6 | /-! |
| 7 | # Area estimates for the hypersurface induction |
| 8 | |
| 9 | These one-variable estimates justify the substitution `beta(t) = alpha / t` |
| 10 | in Petrunin, Section 4.5, author manuscript pp. 11--12. They use the area |
| 11 | growth bound itself; no bound on the area derivative is assumed. Identifying |
| 12 | the function with the areas of regular levels is a separate geometric step. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set MeasureTheory |
| 19 | |
| 20 | namespace Poincare.CurvatureIntegral |
| 21 | |
| 22 | /-- Integration by parts bounds the negative weighted area derivative by |
| 23 | the lower boundary area. The other boundary and integral have favorable signs. -/ |
| 24 | lemma neg_integral_deriv_mul_reciprocal_le |
| 25 | {A : ℝ → ℝ} {a b α : ℝ} (ha : 0 < a) (hab : a ≤ b) (hα : 0 ≤ α) |
| 26 | (hc : ContinuousOn A (Icc a b)) |
| 27 | (hd : DifferentiableOn ℝ A (Ioo a b)) |
| 28 | (hi : IntervalIntegrable (deriv A) volume a b) |
| 29 | (hA : ∀ t ∈ Icc a b, 0 ≤ A t) : |
| 30 | -(∫ t in a..b, deriv A t * (α / t)) ≤ A a * (α / a) := by |
| 31 | have hu : ContinuousOn (fun t : ℝ => α / t) (uIcc a b) := by |
| 32 | rw [uIcc_of_le hab] |
| 33 | exact continuousOn_const.div continuousOn_id (fun t ht => (ha.trans_le ht.1).ne') |
| 34 | have hu' : ContinuousOn (fun t : ℝ => -α / t ^ 2) (uIcc a b) := by |
| 35 | rw [uIcc_of_le hab] |
| 36 | exact continuousOn_const.div (continuousOn_id.pow 2) |
| 37 | (fun t ht => pow_ne_zero _ (ha.trans_le ht.1).ne') |
| 38 | have hc' : ContinuousOn A (uIcc a b) := by rwa [uIcc_of_le hab] |
| 39 | have hparts := intervalIntegral.integral_mul_deriv_eq_deriv_mul_of_hasDerivAt |
| 40 | hu hc' |
| 41 | (fun t ht => by |
| 42 | have ht' : t ∈ Ioo a b := by simpa only [min_eq_left hab, max_eq_right hab] using ht |
| 43 | convert (hasDerivAt_const t α).div (hasDerivAt_id t) (ha.trans ht'.1).ne' using 1 <;> |
| 44 | first | rfl | simp) |
| 45 | (fun t ht => by |
| 46 | have ht' : t ∈ Ioo a b := by simpa only [min_eq_left hab, max_eq_right hab] using ht |
| 47 | exact (hd t ht').differentiableAt (isOpen_Ioo.mem_nhds ht') |>.hasDerivAt) |
| 48 | hu'.intervalIntegrable hi |
| 49 | have hneg : (∫ t in a..b, (-α / t ^ 2) * A t) ≤ 0 := by |
| 50 | have h := intervalIntegral.integral_nonneg (μ := volume) hab |
| 51 | (f := fun t => -((-α / t ^ 2) * A t)) |
| 52 | (fun t ht => neg_nonneg.mpr (mul_nonpos_of_nonpos_of_nonneg |
| 53 | (div_nonpos_of_nonpos_of_nonneg (neg_nonpos.mpr hα) (sq_nonneg t)) (hA t ht))) |
| 54 | simpa only [intervalIntegral.integral_neg, neg_nonneg] using h |
| 55 | have hb := mul_nonneg (div_nonneg hα (ha.trans_le hab).le) (hA b ⟨hab, le_rfl⟩) |
| 56 | simp_rw [mul_comm (α / _) (deriv A _)] at hparts |
| 57 | nlinarith |
| 58 | |
| 59 | /-- The area growth bound cancels the square of the reciprocal level scale. |
| 60 | The assumption `2 ≤ m` is exactly the dimension range of this induction step. -/ |
| 61 | lemma area_mul_reciprocal_sq_le |
| 62 | {A : ℝ → ℝ} {t α : ℝ} {m : ℕ} (ht : 0 < t) (ht1 : t ≤ 1) |
| 63 | (hm : 2 ≤ m) (hα : 0 ≤ α) (hA : A t ≤ α * t ^ m) : |
| 64 | A t * (α / t) ^ 2 ≤ α ^ 3 := by |
| 65 | have hpow : t ^ m ≤ t ^ 2 := pow_le_pow_of_le_one ht.le ht1 hm |
| 66 | have hAt : A t ≤ α * t ^ 2 := hA.trans (mul_le_mul_of_nonneg_left hpow hα) |
| 67 | calc |
| 68 | A t * (α / t) ^ 2 ≤ (α * t ^ 2) * (α / t) ^ 2 := |
| 69 | mul_le_mul_of_nonneg_right hAt (sq_nonneg _) |
| 70 | _ = α ^ 3 := by field_simp |
| 71 | |
| 72 | /-- The area integral in the intermediate inequality is uniformly bounded. -/ |
| 73 | lemma integral_area_mul_reciprocal_sq_le |
| 74 | {A : ℝ → ℝ} {a b α : ℝ} {m : ℕ} (ha : 0 < a) (hab : a ≤ b) |
| 75 | (hb : b ≤ 1) (hm : 2 ≤ m) (hα : 0 ≤ α) |
| 76 | (hc : ContinuousOn A (Icc a b)) |
| 77 | (hA : ∀ t ∈ Icc a b, A t ≤ α * t ^ m) : |
| 78 | (∫ t in a..b, A t * (α / t) ^ 2) ≤ α ^ 3 * (b - a) := by |
| 79 | have hi : IntervalIntegrable (fun t => A t * (α / t) ^ 2) volume a b := by |
| 80 | apply ContinuousOn.intervalIntegrable |
| 81 | rw [uIcc_of_le hab] |
| 82 | exact hc.mul ((continuousOn_const.div continuousOn_id |
| 83 | (fun t ht => (ha.trans_le ht.1).ne')).pow 2) |
| 84 | have h := intervalIntegral.integral_mono_on hab hi intervalIntegrable_const |
| 85 | (fun t ht => area_mul_reciprocal_sq_le (ha.trans_le ht.1) (ht.2.trans hb) hm hα (hA t ht)) |
| 86 | simpa only [intervalIntegral.integral_const, smul_eq_mul, mul_comm (b - a)] using h |
| 87 | |
| 88 | /-- The weighted derivative contribution also has a bound independent of the |
| 89 | inner radius; rapid decreases of the area need no separate pointwise estimate. -/ |
| 90 | lemma neg_integral_deriv_mul_reciprocal_le_of_power_bound |
| 91 | {A : ℝ → ℝ} {a b α : ℝ} {m : ℕ} (ha : 0 < a) (hab : a ≤ b) |
| 92 | (hb : b ≤ 1) (hm : 1 ≤ m) (hα : 0 ≤ α) |
| 93 | (hc : ContinuousOn A (Icc a b)) |
| 94 | (hd : DifferentiableOn ℝ A (Ioo a b)) |
| 95 | (hi : IntervalIntegrable (deriv A) volume a b) |
| 96 | (hA : ∀ t ∈ Icc a b, 0 ≤ A t) |
| 97 | (hleft : A a ≤ α * a ^ m) : |
| 98 | -(∫ t in a..b, deriv A t * (α / t)) ≤ α ^ 2 := by |
| 99 | have hpow : a ^ m ≤ a := by |
| 100 | simpa only [pow_one] using pow_le_pow_of_le_one ha.le (hab.trans hb) hm |
| 101 | calc |
| 102 | -(∫ t in a..b, deriv A t * (α / t)) ≤ A a * (α / a) := |
| 103 | neg_integral_deriv_mul_reciprocal_le ha hab hα hc hd hi hA |
| 104 | _ ≤ (α * a) * (α / a) := mul_le_mul_of_nonneg_right |
| 105 | (hleft.trans (mul_le_mul_of_nonneg_left hpow hα)) (div_nonneg hα ha.le) |
| 106 | _ = α ^ 2 := by field_simp |
| 107 | |
| 108 | /-- Substituting the area and principal-curvature bounds in Petrunin's |
| 109 | intermediate inequality gives a constant independent of both slab endpoints. -/ |
| 110 | lemma area_error_le_of_power_bound |
| 111 | {A : ℝ → ℝ} {a b α : ℝ} {m : ℕ} (ha : 0 < a) (hab : a ≤ b) |
| 112 | (hb : b ≤ 1) (hm : 2 ≤ m) (hα : 0 ≤ α) |
| 113 | (hc : ContinuousOn A (Icc a b)) |
| 114 | (hd : DifferentiableOn ℝ A (Ioo a b)) |
| 115 | (hi : IntervalIntegrable (deriv A) volume a b) |
| 116 | (hA : ∀ t ∈ Icc a b, 0 ≤ A t ∧ A t ≤ α * t ^ m) : |
| 117 | (b - a) + m * (1 + α) * (∫ t in a..b, A t * (α / t) ^ 2) - |
| 118 | (∫ t in a..b, deriv A t * (α / t)) ≤ |
| 119 | 1 + m * (1 + α) * α ^ 3 + α ^ 2 := by |
| 120 | have harea := integral_area_mul_reciprocal_sq_le ha hab hb hm hα hc |
| 121 | (fun t ht => (hA t ht).2) |
| 122 | have hderiv := neg_integral_deriv_mul_reciprocal_le_of_power_bound |
| 123 | ha hab hb (by omega : 1 ≤ m) hα hc hd hi |
| 124 | (fun t ht => (hA t ht).1) (hA a ⟨le_rfl, hab⟩).2 |
| 125 | have hlen : b - a ≤ 1 := by linarith |
| 126 | have harea' : (∫ t in a..b, A t * (α / t) ^ 2) ≤ α ^ 3 := |
| 127 | harea.trans (by nlinarith [pow_nonneg hα 3]) |
| 128 | have hcoef : 0 ≤ (m : ℝ) * (1 + α) := mul_nonneg (Nat.cast_nonneg _) (by linarith) |
| 129 | have hmul := mul_le_mul_of_nonneg_left harea' hcoef |
| 130 | linarith |
| 131 | |
| 132 | /-- A suitable outer level absorbs the remaining boundary derivative in |
| 133 | the main inequality. Only the area bound and nonnegativity at the endpoints |
| 134 | enter the mean-value argument. -/ |
| 135 | lemma le_mul_one_add_of_forall_le_sub_deriv |
| 136 | {A : ℝ → ℝ} {b α C K S : ℝ} {m : ℕ} |
| 137 | (hb : 0 < b) (hb1 : b ≤ 1) (hm : 1 ≤ m) (hα : 0 ≤ α) (hK : 0 ≤ K) |
| 138 | (hc : ContinuousOn A (Icc b (3 * b / 2))) |
| 139 | (hd : DifferentiableOn ℝ A (Ioo b (3 * b / 2))) |
| 140 | (hleft : A b ≤ α * b ^ m) (hright : 0 ≤ A (3 * b / 2)) |
| 141 | (hS : ∀ t ∈ Ioo b (3 * b / 2), S ≤ C * (1 + K) - deriv A t) : |
| 142 | S ≤ (C + 2 * α) * (1 + K) := by |
| 143 | obtain ⟨t, ht, hderiv⟩ := Poincare.Analysis.exists_neg_deriv_le_of_power_bound |
| 144 | hb hm hc hd hleft hright |
| 145 | have hp : b ^ (m - 1) ≤ 1 := pow_le_one₀ hb.le hb1 |
| 146 | have hscale : 2 * α * b ^ (m - 1) ≤ 2 * α := by nlinarith |
| 147 | have h := hS t ht |
| 148 | nlinarith [mul_nonneg hα hK] |
| 149 | |
| 150 | end Poincare.CurvatureIntegral |