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 Mathlib.Probability.Distributions.Gaussian.Real |
| 2 | import Mathlib.Analysis.Calculus.ParametricIntegral |
| 3 | import Mathlib.Analysis.Calculus.FDeriv.Measurable |
| 4 | |
| 5 | /-! |
| 6 | # Gaussian averaging of Lipschitz functions |
| 7 | |
| 8 | The real-coordinate averaging estimates needed for the dimension-one case of |
| 9 | Chow et al., Part III, Proposition 26.49, equation (26.134) and Remark 26.51, |
| 10 | printed pp. 378-379 (PDF pp. 399-400). |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open MeasureTheory ProbabilityTheory Filter |
| 16 | open scoped Topology NNReal |
| 17 | |
| 18 | namespace Poincare.Analysis.Heat |
| 19 | |
| 20 | theorem integrable_abs_standardGaussian : |
| 21 | Integrable (fun z : ℝ ↦ |z|) (gaussianReal 0 1) := by |
| 22 | simpa only [id_eq, Real.norm_eq_abs] using |
| 23 | (memLp_id_gaussianReal (μ := 0) (v := 1) 1).integrable (by norm_num) |>.norm |
| 24 | |
| 25 | theorem integral_sq_standardGaussian : |
| 26 | (∫ z : ℝ, z ^ 2 ∂gaussianReal 0 1) = 1 := by |
| 27 | have h := variance_fun_id_gaussianReal (μ := 0) (v := 1) |
| 28 | rw [variance_eq_integral measurable_id'.aemeasurable] at h |
| 29 | simpa only [integral_id_gaussianReal, sub_zero, NNReal.coe_one] using h |
| 30 | |
| 31 | theorem integral_abs_standardGaussian_le_one : |
| 32 | (∫ z : ℝ, |z| ∂gaussianReal 0 1) ≤ 1 := by |
| 33 | have hsq : Integrable (fun z : ℝ ↦ z ^ 2) (gaussianReal 0 1) := by |
| 34 | simpa only [id_eq, Real.norm_eq_abs, sq_abs] using |
| 35 | (memLp_id_gaussianReal (μ := 0) (v := 1) 2).integrable_norm_pow (by norm_num) |
| 36 | have h := integral_mono integrable_abs_standardGaussian |
| 37 | ((hsq.add (integrable_const (1 : ℝ))).div_const 2) |
| 38 | (fun z ↦ show |z| ≤ (z ^ 2 + 1) / 2 by nlinarith [sq_nonneg (|z| - 1), sq_abs z]) |
| 39 | simpa only [Pi.add_apply, integral_div, integral_add hsq (integrable_const (1 : ℝ)), |
| 40 | integral_sq_standardGaussian, integral_const, probReal_univ, smul_eq_mul, |
| 41 | one_mul, show (1 + 1) / (2 : ℝ) = 1 by norm_num] using h |
| 42 | |
| 43 | /-- Gaussian averaging at spatial scale `sqrt (2 * t)`. -/ |
| 44 | noncomputable def gaussianAverage (f : ℝ → ℝ) (t x : ℝ) : ℝ := |
| 45 | ∫ z, f (x + Real.sqrt (2 * t) * z) ∂ProbabilityTheory.gaussianReal 0 1 |
| 46 | |
| 47 | theorem integrable_gaussianAverage {L : ℝ≥0} {f : ℝ → ℝ} |
| 48 | (hf : LipschitzWith L f) (t x : ℝ) : |
| 49 | Integrable (fun z ↦ f (x + Real.sqrt (2 * t) * z)) (gaussianReal 0 1) := by |
| 50 | apply ((integrable_const |f x|).add |
| 51 | (integrable_abs_standardGaussian.const_mul ((L : ℝ) * Real.sqrt (2 * t)))).mono' |
| 52 | (hf.continuous.comp (by fun_prop)).aestronglyMeasurable |
| 53 | filter_upwards [] with z |
| 54 | have h := hf.dist_le_mul (x + Real.sqrt (2 * t) * z) x |
| 55 | simp only [Real.dist_eq, add_sub_cancel_left, abs_mul, |
| 56 | abs_of_nonneg (Real.sqrt_nonneg _)] at h |
| 57 | rw [Real.norm_eq_abs] |
| 58 | simp only [Function.comp_apply, Pi.add_apply] |
| 59 | have htri := abs_add_le (f x) (f (x + Real.sqrt (2 * t) * z) - f x) |
| 60 | simp only [add_sub_cancel] at htri |
| 61 | nlinarith |
| 62 | |
| 63 | theorem lipschitzWith_gaussianAverage {L : ℝ≥0} {f : ℝ → ℝ} |
| 64 | (hf : LipschitzWith L f) (t : ℝ) : LipschitzWith L (gaussianAverage f t) := by |
| 65 | apply LipschitzWith.of_dist_le_mul |
| 66 | intro x y |
| 67 | have hbound : ∀ᵐ z ∂gaussianReal 0 1, |
| 68 | ‖f (x + Real.sqrt (2 * t) * z) - f (y + Real.sqrt (2 * t) * z)‖ ≤ |
| 69 | (L : ℝ) * dist x y := by |
| 70 | filter_upwards [] with z |
| 71 | simpa only [Real.dist_eq, Real.norm_eq_abs, add_sub_add_right_eq_sub] using |
| 72 | hf.dist_le_mul (x + Real.sqrt (2 * t) * z) (y + Real.sqrt (2 * t) * z) |
| 73 | have h := norm_integral_le_of_norm_le_const hbound |
| 74 | rw [integral_sub (integrable_gaussianAverage hf t x) |
| 75 | (integrable_gaussianAverage hf t y)] at h |
| 76 | simpa only [gaussianAverage, dist_eq_norm, probReal_univ, mul_one] using h |
| 77 | |
| 78 | theorem abs_gaussianAverage_sub_le {L : ℝ≥0} {f : ℝ → ℝ} |
| 79 | (hf : LipschitzWith L f) (t x : ℝ) : |
| 80 | |gaussianAverage f t x - f x| ≤ (L : ℝ) * Real.sqrt (2 * t) := by |
| 81 | have hbound : ∀ᵐ z ∂gaussianReal 0 1, |
| 82 | ‖f (x + Real.sqrt (2 * t) * z) - f x‖ ≤ |
| 83 | ((L : ℝ) * Real.sqrt (2 * t)) * |z| := by |
| 84 | filter_upwards [] with z |
| 85 | simpa only [Real.dist_eq, Real.norm_eq_abs, add_sub_cancel_left, abs_mul, |
| 86 | abs_of_nonneg (Real.sqrt_nonneg _), mul_assoc] using |
| 87 | hf.dist_le_mul (x + Real.sqrt (2 * t) * z) x |
| 88 | have h := norm_integral_le_of_norm_le |
| 89 | (integrable_abs_standardGaussian.const_mul ((L : ℝ) * Real.sqrt (2 * t))) hbound |
| 90 | rw [integral_sub (integrable_gaussianAverage hf t x) (integrable_const _), |
| 91 | integral_const_mul] at h |
| 92 | have havg : |gaussianAverage f t x - f x| ≤ |
| 93 | ((L : ℝ) * Real.sqrt (2 * t)) * ∫ z : ℝ, |z| ∂gaussianReal 0 1 := by |
| 94 | simpa [gaussianAverage, Real.norm_eq_abs] using h |
| 95 | exact havg.trans (by |
| 96 | simpa using mul_le_mul_of_nonneg_left integral_abs_standardGaussian_le_one |
| 97 | (show 0 ≤ (L : ℝ) * Real.sqrt (2 * t) by positivity)) |
| 98 | |
| 99 | theorem gaussianAverage_estimates {L : ℝ≥0} {f : ℝ → ℝ} |
| 100 | (hf : LipschitzWith L f) {t : ℝ} (ht : 0 ≤ t) : |
| 101 | (∀ x, Integrable (fun z ↦ f (x + Real.sqrt (2 * t) * z)) |
| 102 | (ProbabilityTheory.gaussianReal 0 1)) ∧ |
| 103 | LipschitzWith L (gaussianAverage f t) ∧ |
| 104 | (∀ x, |gaussianAverage f t x - f x| ≤ (L : ℝ) * Real.sqrt (2 * t)) := by |
| 105 | have _ := ht |
| 106 | exact ⟨integrable_gaussianAverage hf t, lipschitzWith_gaussianAverage hf t, |
| 107 | abs_gaussianAverage_sub_le hf t⟩ |
| 108 | |
| 109 | theorem tendstoUniformly_gaussianAverage {L : ℝ≥0} {f : ℝ → ℝ} |
| 110 | (hf : LipschitzWith L f) : |
| 111 | TendstoUniformly (gaussianAverage f) f (𝓝[>] (0 : ℝ)) := by |
| 112 | have hlim : Tendsto (fun t : ℝ ↦ (L : ℝ) * Real.sqrt (2 * t)) |
| 113 | (𝓝[>] (0 : ℝ)) (𝓝 0) := by |
| 114 | have hcont : Continuous (fun t : ℝ ↦ (L : ℝ) * Real.sqrt (2 * t)) := by fun_prop |
| 115 | simpa using (hcont.tendsto 0).mono_left (nhdsWithin_le_nhds (s := Set.Ioi 0)) |
| 116 | apply Metric.tendstoUniformly_iff.mpr |
| 117 | intro ε hε |
| 118 | filter_upwards [hlim.eventually (gt_mem_nhds hε)] with t ht |
| 119 | intro x |
| 120 | rw [Real.dist_eq, abs_sub_comm] |
| 121 | exact (abs_gaussianAverage_sub_le hf t x).trans_lt ht |
| 122 | |
| 123 | /-- For differentiable Lipschitz initial data, spatial differentiation passes |
| 124 | under the Gaussian integral with an integrable constant majorant. -/ |
| 125 | theorem hasDerivAt_gaussianAverage {L : ℝ≥0} {f : ℝ → ℝ} |
| 126 | (hf : LipschitzWith L f) (hdf : Differentiable ℝ f) (t x : ℝ) : |
| 127 | HasDerivAt (gaussianAverage f t) (gaussianAverage (deriv f) t x) x := by |
| 128 | have h := hasDerivAt_integral_of_dominated_loc_of_deriv_le |
| 129 | (μ := gaussianReal 0 1) (s := Set.univ) (bound := fun _ : ℝ ↦ (L : ℝ)) |
| 130 | (F := fun a z : ℝ ↦ f (a + Real.sqrt (2 * t) * z)) |
| 131 | (F' := fun a z : ℝ ↦ deriv f (a + Real.sqrt (2 * t) * z)) |
| 132 | (x₀ := x) (Filter.univ_mem) ?_ (integrable_gaussianAverage hf t x) ?_ ?_ |
| 133 | (integrable_const _) ?_ |
| 134 | · exact h.2 |
| 135 | · exact Filter.Eventually.of_forall fun a ↦ |
| 136 | (integrable_gaussianAverage hf t a).aestronglyMeasurable |
| 137 | · exact ((measurable_deriv f).comp (by fun_prop)).aestronglyMeasurable |
| 138 | · exact Filter.Eventually.of_forall fun z a _ ↦ norm_deriv_le_of_lipschitz hf |
| 139 | · filter_upwards [] with z |
| 140 | intro a _ |
| 141 | simpa only [mul_one, Function.comp_def, id_eq] using! |
| 142 | (hdf (a + Real.sqrt (2 * t) * z)).hasDerivAt.comp a |
| 143 | ((hasDerivAt_id a).add_const (Real.sqrt (2 * t) * z)) |
| 144 | |
| 145 | /-- The actual spatial derivative of the differentiable Gaussian average |
| 146 | retains the initial Lipschitz bound. -/ |
| 147 | theorem abs_deriv_gaussianAverage_le {L : ℝ≥0} {f : ℝ → ℝ} |
| 148 | (hf : LipschitzWith L f) (t x : ℝ) : |
| 149 | |deriv (gaussianAverage f t) x| ≤ (L : ℝ) := by |
| 150 | simpa only [Real.norm_eq_abs] using |
| 151 | norm_deriv_le_of_lipschitz (x₀ := x) (lipschitzWith_gaussianAverage hf t) |
| 152 | |
| 153 | end Poincare.Analysis.Heat |