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.Measure.GaussianTails.Series |
| 2 | import Mathlib.MeasureTheory.Integral.Lebesgue.Countable |
| 3 | import Mathlib.MeasureTheory.Integral.Bochner.Set |
| 4 | import Mathlib.Algebra.Order.Floor.Semiring |
| 5 | |
| 6 | /-! # Gaussian integral bounds from polynomial sublevel volumes -/ |
| 7 | |
| 8 | set_option autoImplicit false |
| 9 | |
| 10 | open Set MeasureTheory |
| 11 | open scoped ENNReal NNReal |
| 12 | |
| 13 | namespace Poincare.Analysis |
| 14 | |
| 15 | variable {X : Type*} [MeasurableSpace X] {μ : Measure X} {d : X → ℝ} |
| 16 | |
| 17 | theorem lintegral_gaussian_le_of_sublevel_volume |
| 18 | (hd : Measurable d) (hd0 : ∀ x, 0 ≤ d x) |
| 19 | {n : ℕ} {a C : ℝ} (ha : 0 < a) (hC : 0 ≤ C) |
| 20 | (hvol : ∀ m : ℕ, μ {x | d x < (m : ℝ) + 1} ≤ |
| 21 | ENNReal.ofReal (C * ((m : ℝ) + 1) ^ n)) : |
| 22 | ∫⁻ x, ENNReal.ofReal (Real.exp (-a * (d x) ^ 2)) ∂μ ≤ |
| 23 | ENNReal.ofReal (C * gaussianShellSum n a) := by |
| 24 | let f : ℕ → X → ℝ≥0∞ := fun m => {x | d x < (m : ℝ) + 1}.indicator |
| 25 | (fun _ => ENNReal.ofReal (Real.exp (-a * (m : ℝ) ^ 2))) |
| 26 | have hmeas (m : ℕ) : Measurable (f m) := |
| 27 | measurable_const.indicator (measurableSet_lt hd measurable_const) |
| 28 | have hbound (x : X) : ENNReal.ofReal (Real.exp (-a * (d x) ^ 2)) ≤ ∑' m, f m x := by |
| 29 | apply le_trans _ (ENNReal.le_tsum (⌊d x⌋₊)) |
| 30 | dsimp only [f] |
| 31 | rw [indicator_of_mem (s := {y | d y < (⌊d x⌋₊ : ℝ) + 1}) |
| 32 | (Nat.lt_floor_add_one (d x))] |
| 33 | apply ENNReal.ofReal_le_ofReal |
| 34 | apply Real.exp_le_exp.mpr |
| 35 | exact mul_le_mul_of_nonpos_left |
| 36 | (sq_le_sq₀ (by positivity) (hd0 x) |>.mpr (Nat.floor_le (hd0 x))) (by linarith) |
| 37 | calc |
| 38 | (∫⁻ x, ENNReal.ofReal (Real.exp (-a * (d x) ^ 2)) ∂μ) ≤ ∫⁻ x, ∑' m, f m x ∂μ := |
| 39 | lintegral_mono hbound |
| 40 | _ = ∑' m, ∫⁻ x, f m x ∂μ := lintegral_tsum (fun m => (hmeas m).aemeasurable) |
| 41 | _ ≤ ∑' m : ℕ, ENNReal.ofReal (Real.exp (-a * (m : ℝ) ^ 2)) * |
| 42 | ENNReal.ofReal (C * ((m : ℝ) + 1) ^ n) := by |
| 43 | apply ENNReal.tsum_le_tsum |
| 44 | intro m |
| 45 | rw [lintegral_indicator (measurableSet_lt hd measurable_const)] |
| 46 | simp only [lintegral_const, Measure.restrict_apply_univ] |
| 47 | gcongr |
| 48 | exact hvol m |
| 49 | _ = ENNReal.ofReal (C * gaussianShellSum n a) := by |
| 50 | simp_rw [← ENNReal.ofReal_mul (Real.exp_nonneg _)] |
| 51 | rw [← ENNReal.ofReal_tsum_of_nonneg (fun _ => by positivity)] |
| 52 | · congr 1 |
| 53 | rw [gaussianShellSum, ← tsum_mul_left] |
| 54 | apply tsum_congr |
| 55 | intro m |
| 56 | ring |
| 57 | · convert! (summable_gaussian_shells n ha).mul_left C using 1 |
| 58 | ext m |
| 59 | ring |
| 60 | |
| 61 | theorem lintegral_gaussian_tail_le_of_sublevel_volume |
| 62 | (hd : Measurable d) (hd0 : ∀ x, 0 ≤ d x) |
| 63 | {n : ℕ} {a C R : ℝ} (ha : 0 < a) (hC : 0 ≤ C) (hR : 0 ≤ R) |
| 64 | (hvol : ∀ m : ℕ, μ {x | d x < (m : ℝ) + 1} ≤ |
| 65 | ENNReal.ofReal (C * ((m : ℝ) + 1) ^ n)) : |
| 66 | ∫⁻ x in {x | R ≤ d x}, ENNReal.ofReal (Real.exp (-a * (d x) ^ 2)) ∂μ ≤ |
| 67 | ENNReal.ofReal (Real.exp (-a / 2 * R ^ 2) * (C * gaussianShellSum n (a / 2))) := by |
| 68 | rw [← lintegral_indicator (measurableSet_le measurable_const hd)] |
| 69 | calc |
| 70 | (∫⁻ x, {x | R ≤ d x}.indicator |
| 71 | (fun x => ENNReal.ofReal (Real.exp (-a * (d x) ^ 2))) x ∂μ) ≤ |
| 72 | ∫⁻ x, ENNReal.ofReal (Real.exp (-a / 2 * R ^ 2)) * |
| 73 | ENNReal.ofReal (Real.exp (-(a / 2) * (d x) ^ 2)) ∂μ := by |
| 74 | apply lintegral_mono |
| 75 | intro x |
| 76 | dsimp only |
| 77 | by_cases hx : R ≤ d x |
| 78 | · rw [indicator_of_mem (s := {x | R ≤ d x}) hx, |
| 79 | ← ENNReal.ofReal_mul (Real.exp_nonneg _), ← Real.exp_add] |
| 80 | apply ENNReal.ofReal_le_ofReal |
| 81 | apply Real.exp_le_exp.mpr |
| 82 | have hs : R ^ 2 ≤ (d x) ^ 2 := (sq_le_sq₀ hR (hd0 x)).mpr hx |
| 83 | nlinarith |
| 84 | · rw [indicator_of_notMem (s := {x | R ≤ d x}) hx] |
| 85 | exact zero_le |
| 86 | _ = ENNReal.ofReal (Real.exp (-a / 2 * R ^ 2)) * |
| 87 | ∫⁻ x, ENNReal.ofReal (Real.exp (-(a / 2) * (d x) ^ 2)) ∂μ := |
| 88 | lintegral_const_mul' _ _ ENNReal.ofReal_ne_top |
| 89 | _ ≤ ENNReal.ofReal (Real.exp (-a / 2 * R ^ 2)) * |
| 90 | ENNReal.ofReal (C * gaussianShellSum n (a / 2)) := by |
| 91 | gcongr |
| 92 | exact lintegral_gaussian_le_of_sublevel_volume hd hd0 |
| 93 | (by linarith : 0 < a / 2) hC hvol |
| 94 | _ = _ := (ENNReal.ofReal_mul (Real.exp_nonneg _)).symm |
| 95 | |
| 96 | end Poincare.Analysis |