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.CurveShortening.Ramp.LocalFlow.Periodic.GaussianDeriv |
| 2 | import Mathlib.MeasureTheory.Integral.IntegralEqImproper |
| 3 | |
| 4 | /-! |
| 5 | # The actual first-derivative Gaussian kernel on the circle |
| 6 | |
| 7 | Bochner integration by parts gives the first-derivative formula and its |
| 8 | period-independent inverse-square-root time bound. MT2007 Claim 19.1, |
| 9 | p. 437 and Lemma 19.24, pp. 454-455; see |
| 10 | `2026-09-21-gaussian-first-derivative-bound.md`. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open MeasureTheory |
| 16 | |
| 17 | namespace PoincareMT.M63 |
| 18 | |
| 19 | variable {L : ℝ} [Fact (0 < L)] |
| 20 | {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 21 | |
| 22 | /-- The actual first Gaussian kernel is integrable in the uniform function |
| 23 | norm, without completeness of the target. MT2007 Claim 19.1, p. 437; |
| 24 | Gaussian first-derivative derivation, statement 1. -/ |
| 25 | theorem integrable_periodicGaussianFirstKernel (t : ℝ) (f : C(AddCircle L, E)) : |
| 26 | Integrable (fun s : ℝ => ((-2 * s) * gaussianHeatKernel 1 s) • |
| 27 | periodicTranslation (2 * Real.sqrt t * s) f) := by |
| 28 | have hK1 : Integrable (fun s : ℝ => (-2 * s) * gaussianHeatKernel 1 s) := by |
| 29 | convert! (integrable_mul_exp_neg_mul_sq (by norm_num : (0 : ℝ) < 1)).const_mul |
| 30 | (-2 * (Real.sqrt (Real.pi / 1))⁻¹) using 1 |
| 31 | funext s |
| 32 | dsimp only [gaussianHeatKernel] |
| 33 | ring |
| 34 | have hKc : Continuous (gaussianHeatKernel 1) := |
| 35 | continuous_iff_continuousAt.mpr (fun _ => gaussianHeatKernel_hasDerivAt.continuousAt) |
| 36 | have hc : Continuous (fun s : ℝ => ((-2 * s) * gaussianHeatKernel 1 s) • |
| 37 | periodicTranslation (2 * Real.sqrt t * s) f) := |
| 38 | ((continuous_const.mul continuous_id).mul hKc).smul |
| 39 | (continuous_periodicTranslation.comp |
| 40 | ((continuous_const.mul continuous_id).prodMk continuous_const)) |
| 41 | apply (hK1.norm.mul_const ‖f‖).mono' hc.stronglyMeasurable.aestronglyMeasurable |
| 42 | filter_upwards [] with s |
| 43 | rw [norm_smul, (periodicTranslation _).norm_map] |
| 44 | |
| 45 | variable [CompleteSpace E] |
| 46 | |
| 47 | /-- The Gaussian average of an actual continuous derivative has the |
| 48 | literal first-kernel formula and the bound C/sqrt(t), with C independent |
| 49 | of period and target dimension. MT2007 Lemma 19.24, pp. 454-455; |
| 50 | Gaussian first-derivative derivation, statement 2. -/ |
| 51 | theorem periodicGaussianHeat_derivative_formula_bound {t : ℝ} (ht : 0 < t) |
| 52 | (f g : C(AddCircle L, E)) |
| 53 | (hf : ∀ x : ℝ, HasDerivAt (fun y : ℝ => f (y : AddCircle L)) (g (x : AddCircle L)) x) : |
| 54 | (∀ x : ℝ, periodicGaussianHeat t g (x : AddCircle L) = |
| 55 | (2 * Real.sqrt t)⁻¹ • ∫ s : ℝ, ((-2 * s) * gaussianHeatKernel 1 s) • |
| 56 | f ((x : AddCircle L) - ((2 * Real.sqrt t * s : ℝ) : AddCircle L))) ∧ |
| 57 | ‖periodicGaussianHeat t g‖ ≤ |
| 58 | ((∫ s : ℝ, ‖(-2 * s) * gaussianHeatKernel 1 s‖) / (2 * Real.sqrt t)) * ‖f‖ := by |
| 59 | let A := 2 * Real.sqrt t |
| 60 | have hA : 0 < A := by dsimp [A]; positivity |
| 61 | have hK1 : Integrable (fun s : ℝ => (-2 * s) * gaussianHeatKernel 1 s) := by |
| 62 | convert! (integrable_mul_exp_neg_mul_sq (by norm_num : (0 : ℝ) < 1)).const_mul |
| 63 | (-2 * (Real.sqrt (Real.pi / 1))⁻¹) using 1 |
| 64 | funext s |
| 65 | dsimp only [gaussianHeatKernel] |
| 66 | ring |
| 67 | have hi (h : C(AddCircle L, E)) (x : ℝ) : |
| 68 | Integrable (fun s : ℝ => gaussianHeatKernel 1 s • |
| 69 | h ((x : AddCircle L) - ((A * s : ℝ) : AddCircle L))) := |
| 70 | (ContinuousMap.evalCLM ℝ (x : AddCircle L)).integrable_comp |
| 71 | (integrable_periodicGaussian t h) |
| 72 | have hi1 (x : ℝ) : Integrable (fun s : ℝ => ((-2 * s) * gaussianHeatKernel 1 s) • |
| 73 | f ((x : AddCircle L) - ((A * s : ℝ) : AddCircle L))) := |
| 74 | (ContinuousMap.evalCLM ℝ (x : AddCircle L)).integrable_comp |
| 75 | (integrable_periodicGaussianFirstKernel t f) |
| 76 | have hformula (x : ℝ) : periodicGaussianHeat t g (x : AddCircle L) = |
| 77 | A⁻¹ • ∫ s : ℝ, ((-2 * s) * gaussianHeatKernel 1 s) • |
| 78 | f ((x : AddCircle L) - ((A * s : ℝ) : AddCircle L)) := by |
| 79 | have hv (s : ℝ) : HasDerivAt |
| 80 | (fun r : ℝ => f ((x : AddCircle L) - ((A * r : ℝ) : AddCircle L))) |
| 81 | ((-A) • g ((x : AddCircle L) - ((A * s : ℝ) : AddCircle L))) s := by |
| 82 | simpa only [Function.comp_def, id_eq, mul_one, QuotientAddGroup.mk_sub] using |
| 83 | (hf (x - A * s)).scomp s (((hasDerivAt_id s).const_mul A).const_sub x) |
| 84 | have hiv : Integrable (fun s : ℝ => gaussianHeatKernel 1 s • |
| 85 | ((-A) • g ((x : AddCircle L) - ((A * s : ℝ) : AddCircle L)))) := by |
| 86 | convert! (hi g x).smul (-A) using 1 |
| 87 | funext s |
| 88 | exact smul_comm _ _ _ |
| 89 | have h := integral_bilinear_hasDerivAt_right_eq_neg_left_of_integrable |
| 90 | (L := ContinuousLinearMap.lsmul ℝ ℝ) |
| 91 | (u := gaussianHeatKernel 1) (u' := fun s => (-2 * s) * gaussianHeatKernel 1 s) |
| 92 | (v := fun s : ℝ => f ((x : AddCircle L) - ((A * s : ℝ) : AddCircle L))) |
| 93 | (v' := fun s : ℝ => (-A) • g ((x : AddCircle L) - ((A * s : ℝ) : AddCircle L))) |
| 94 | (fun s _ => by simpa only [mul_one] using |
| 95 | (gaussianHeatKernel_hasDerivAt (b := 1) (x := s))) |
| 96 | (fun s _ => hv s) hiv (hi1 x) (hi f x) |
| 97 | simp only [ContinuousLinearMap.lsmul_apply] at h |
| 98 | simp_rw [smul_comm (gaussianHeatKernel 1 _) (-A)] at h |
| 99 | rw [integral_smul] at h |
| 100 | have heq : A • periodicGaussianHeat t g (x : AddCircle L) = |
| 101 | ∫ s : ℝ, ((-2 * s) * gaussianHeatKernel 1 s) • |
| 102 | f ((x : AddCircle L) - ((A * s : ℝ) : AddCircle L)) := by |
| 103 | rw [periodicGaussianHeat_apply] |
| 104 | simpa only [A, neg_smul, neg_inj] using h |
| 105 | calc |
| 106 | _ = A⁻¹ • (A • periodicGaussianHeat t g (x : AddCircle L)) := by |
| 107 | rw [smul_smul, inv_mul_cancel₀ hA.ne', one_smul] |
| 108 | _ = _ := congrArg (fun z => A⁻¹ • z) heq |
| 109 | refine ⟨hformula, (ContinuousMap.norm_le _ (by positivity)).mpr ?_⟩ |
| 110 | intro x |
| 111 | obtain ⟨x, rfl⟩ := QuotientAddGroup.mk_surjective x |
| 112 | rw [hformula, norm_smul, Real.norm_eq_abs, abs_of_pos (inv_pos.mpr hA)] |
| 113 | have hnorm : ‖∫ s : ℝ, ((-2 * s) * gaussianHeatKernel 1 s) • |
| 114 | f ((x : AddCircle L) - ((A * s : ℝ) : AddCircle L))‖ ≤ |
| 115 | (∫ s : ℝ, ‖(-2 * s) * gaussianHeatKernel 1 s‖) * ‖f‖ := by |
| 116 | calc |
| 117 | _ ≤ ∫ s : ℝ, ‖(-2 * s) * gaussianHeatKernel 1 s‖ * ‖f‖ := by |
| 118 | apply norm_integral_le_of_norm_le (hK1.norm.mul_const ‖f‖) |
| 119 | filter_upwards [] with s |
| 120 | rw [norm_smul] |
| 121 | exact mul_le_mul_of_nonneg_left (ContinuousMap.norm_coe_le_norm f _) (norm_nonneg _) |
| 122 | _ = _ := integral_mul_const _ _ |
| 123 | calc |
| 124 | _ ≤ A⁻¹ * ((∫ s : ℝ, ‖(-2 * s) * gaussianHeatKernel 1 s‖) * ‖f‖) := |
| 125 | mul_le_mul_of_nonneg_left hnorm (inv_nonneg.mpr hA.le) |
| 126 | _ = _ := by dsimp only [A]; ring |
| 127 | |
| 128 | end PoincareMT.M63 |