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.Heat.GaussianEvolution |
| 2 | import Mathlib.MeasureTheory.Group.IntegralConvolution |
| 3 | import Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 4 | |
| 5 | /-! |
| 6 | # Gaussian semigroup and spatial regularity |
| 7 | |
| 8 | The semigroup identity lets positive-time evolution be split into two |
| 9 | successive regularizations. This is used to bootstrap spatial differentiability. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open MeasureTheory ProbabilityTheory Filter |
| 15 | open scoped Topology NNReal ContDiff |
| 16 | |
| 17 | namespace Poincare.Analysis.Heat |
| 18 | |
| 19 | theorem integrable_lipschitz_gaussianReal {L : ℝ≥0} {f : ℝ → ℝ} |
| 20 | (hf : LipschitzWith L f) (m : ℝ) (v : ℝ≥0) : Integrable f (gaussianReal m v) := by |
| 21 | have hi : Integrable (fun z : ℝ ↦ |z|) (gaussianReal m v) := by |
| 22 | simpa only [id_eq, Real.norm_eq_abs] using |
| 23 | (memLp_id_gaussianReal (μ := m) (v := v) 1).integrable (by norm_num) |>.norm |
| 24 | apply ((integrable_const |f 0|).add (hi.const_mul (L : ℝ))).mono' |
| 25 | hf.continuous.aestronglyMeasurable |
| 26 | filter_upwards [] with z |
| 27 | have h := hf.dist_le_mul z 0 |
| 28 | simp only [Real.dist_eq, sub_zero] at h |
| 29 | have htri := abs_add_le (f 0) (f z - f 0) |
| 30 | simp only [add_sub_cancel] at htri |
| 31 | exact htri.trans (add_le_add_right h _) |
| 32 | |
| 33 | theorem gaussianAverage_eq_integral_gaussianReal {f : ℝ → ℝ} |
| 34 | (hf : Continuous f) {t : ℝ} (ht : 0 ≤ t) (x : ℝ) : |
| 35 | gaussianAverage f t x = ∫ z, f (x + z) ∂gaussianReal 0 ⟨2 * t, by positivity⟩ := by |
| 36 | have hmap : (gaussianReal 0 1).map (fun z ↦ Real.sqrt (2 * t) * z) = |
| 37 | gaussianReal 0 ⟨2 * t, by positivity⟩ := by |
| 38 | rw [gaussianReal_map_const_mul] |
| 39 | simp only [mul_zero, mul_one] |
| 40 | congr 1 |
| 41 | apply Subtype.ext |
| 42 | exact Real.sq_sqrt (by positivity) |
| 43 | have hc : Continuous (fun z ↦ f (x + z)) := hf.comp (by fun_prop) |
| 44 | rw [← hmap, integral_map (by fun_prop) hc.aestronglyMeasurable] |
| 45 | rfl |
| 46 | |
| 47 | theorem gaussianAverage_semigroup {L : ℝ≥0} {f : ℝ → ℝ} |
| 48 | (hf : LipschitzWith L f) {s t : ℝ} (hs : 0 ≤ s) (ht : 0 ≤ t) (x : ℝ) : |
| 49 | gaussianAverage (gaussianAverage f t) s x = gaussianAverage f (s + t) x := by |
| 50 | let vs : ℝ≥0 := ⟨2 * s, by positivity⟩ |
| 51 | let vt : ℝ≥0 := ⟨2 * t, by positivity⟩ |
| 52 | have hfc : LipschitzWith L (fun z ↦ f (x + z)) := by |
| 53 | apply LipschitzWith.of_dist_le_mul |
| 54 | intro z w |
| 55 | simpa only [Real.dist_eq, add_sub_add_left_eq_sub] using hf.dist_le_mul (x + z) (x + w) |
| 56 | have hi : Integrable (fun z ↦ f (x + z)) ((gaussianReal 0 vs) ∗ (gaussianReal 0 vt)) := by |
| 57 | rw [gaussianReal_conv_gaussianReal] |
| 58 | exact integrable_lipschitz_gaussianReal hfc _ _ |
| 59 | calc |
| 60 | gaussianAverage (gaussianAverage f t) s x = |
| 61 | ∫ z, gaussianAverage f t (x + z) ∂gaussianReal 0 vs := |
| 62 | gaussianAverage_eq_integral_gaussianReal (lipschitzWith_gaussianAverage hf t).continuous hs x |
| 63 | _ = ∫ z, ∫ w, f (x + (z + w)) ∂gaussianReal 0 vt ∂gaussianReal 0 vs := by |
| 64 | apply integral_congr_ae |
| 65 | filter_upwards [] with z |
| 66 | rw [gaussianAverage_eq_integral_gaussianReal hf.continuous ht] |
| 67 | simp only [add_assoc, vt] |
| 68 | _ = ∫ z, f (x + z) ∂((gaussianReal 0 vs) ∗ (gaussianReal 0 vt)) := (integral_conv hi).symm |
| 69 | _ = gaussianAverage f (s + t) x := by |
| 70 | rw [gaussianReal_conv_gaussianReal, zero_add, |
| 71 | gaussianAverage_eq_integral_gaussianReal hf.continuous (add_nonneg hs ht)] |
| 72 | congr 2 |
| 73 | apply Subtype.ext |
| 74 | change 2 * s + 2 * t = 2 * (s + t) |
| 75 | ring |
| 76 | |
| 77 | theorem contDiff_gaussianAverage {L : ℝ≥0} {f : ℝ → ℝ} |
| 78 | (hf : LipschitzWith L f) (hdf : Differentiable ℝ f) |
| 79 | {t : ℝ} (ht : 0 < t) : ContDiff ℝ ∞ (gaussianAverage f t) := by |
| 80 | have hn (n : ℕ) : ∀ {L : ℝ≥0} {f : ℝ → ℝ}, LipschitzWith L f → |
| 81 | Differentiable ℝ f → ∀ {t : ℝ}, 0 < t → ContDiff ℝ n (gaussianAverage f t) := by |
| 82 | intro L f hf hdf t ht |
| 83 | induction n generalizing L f t with |
| 84 | | zero => exact contDiff_zero.mpr (lipschitzWith_gaussianAverage hf t).continuous |
| 85 | | succ n ih => |
| 86 | have hh : 0 < t / 2 := by positivity |
| 87 | have hd : Differentiable ℝ (gaussianAverage f (t / 2)) := |
| 88 | fun x ↦ (hasDerivAt_gaussianAverage hf hdf _ x).differentiableAt |
| 89 | have hdd : Differentiable ℝ (deriv (gaussianAverage f (t / 2))) := |
| 90 | fun x ↦ (hasDerivAt_gaussianAverage_twice hf hdf hh x).differentiableAt |
| 91 | have heq : deriv (gaussianAverage f t) = |
| 92 | gaussianAverage (deriv (gaussianAverage f (t / 2))) (t / 2) := by |
| 93 | have hsplit : gaussianAverage f t = |
| 94 | gaussianAverage (gaussianAverage f (t / 2)) (t / 2) := by |
| 95 | funext x |
| 96 | rw [gaussianAverage_semigroup hf hh.le hh.le, add_halves] |
| 97 | rw [hsplit] |
| 98 | funext x |
| 99 | exact (hasDerivAt_gaussianAverage (lipschitzWith_gaussianAverage hf _) hd _ x).deriv |
| 100 | rw [Nat.cast_add, Nat.cast_one] |
| 101 | apply contDiff_succ_iff_deriv.mpr |
| 102 | refine ⟨fun x ↦ (hasDerivAt_gaussianAverage hf hdf t x).differentiableAt, ?_, ?_⟩ |
| 103 | · simp |
| 104 | · rw [heq] |
| 105 | exact ih (lipschitzWith_deriv_gaussianAverage hf hdf hh) hdd hh |
| 106 | exact contDiff_infty.mpr fun n ↦ hn n hf hdf ht |
| 107 | |
| 108 | theorem exists_lipschitzWith_iterate_deriv_gaussianAverage (k : ℕ) |
| 109 | {L : ℝ≥0} {f : ℝ → ℝ} (hf : LipschitzWith L f) (hdf : Differentiable ℝ f) |
| 110 | {t : ℝ} (ht : 0 < t) : |
| 111 | ∃ C : ℝ≥0, LipschitzWith C (deriv^[k] (gaussianAverage f t)) := by |
| 112 | induction k generalizing L f t with |
| 113 | | zero => exact ⟨L, lipschitzWith_gaussianAverage hf t⟩ |
| 114 | | succ k ih => |
| 115 | have hh : 0 < t / 2 := by positivity |
| 116 | have hd : Differentiable ℝ (gaussianAverage f (t / 2)) := |
| 117 | fun x ↦ (hasDerivAt_gaussianAverage hf hdf _ x).differentiableAt |
| 118 | have hdd : Differentiable ℝ (deriv (gaussianAverage f (t / 2))) := |
| 119 | fun x ↦ (hasDerivAt_gaussianAverage_twice hf hdf hh x).differentiableAt |
| 120 | have heq : deriv (gaussianAverage f t) = |
| 121 | gaussianAverage (deriv (gaussianAverage f (t / 2))) (t / 2) := by |
| 122 | have hsplit : gaussianAverage f t = |
| 123 | gaussianAverage (gaussianAverage f (t / 2)) (t / 2) := by |
| 124 | funext x |
| 125 | rw [gaussianAverage_semigroup hf hh.le hh.le, add_halves] |
| 126 | rw [hsplit] |
| 127 | funext x |
| 128 | exact (hasDerivAt_gaussianAverage (lipschitzWith_gaussianAverage hf _) hd _ x).deriv |
| 129 | rw [Function.iterate_succ_apply, heq] |
| 130 | exact ih (lipschitzWith_deriv_gaussianAverage hf hdf hh) hdd hh |
| 131 | |
| 132 | end Poincare.Analysis.Heat |