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.Analysis.SpecialFunctions.Gaussian.FourierTransform |
| 2 | import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics |
| 3 | import Mathlib.MeasureTheory.Integral.Bochner.Set |
| 4 | |
| 5 | /-! Adapted from Mapher `PoincareMT/Proofs/M15/Mathlib/GaussianTail.lean` at |
| 6 | `0c5d5c4e1ecbc12703b1994e226df1b15d2e8d39`. See the source mapping in |
| 7 | `references/ricci-flow/mapher/noncollapse/import.json`. -/ |
| 8 | |
| 9 | /-! |
| 10 | # Gaussian tails for the large-vector estimate |
| 11 | |
| 12 | The half-Gaussian domination argument used in the corrected proof of |
| 13 | Morgan-Tian Lemma 8.9, pp. 175-176. See also Kleiner-Lott, section 26, |
| 14 | equations (26.12)-(26.13), p. 49, and |
| 15 | `references/ricci-flow/mapher/noncollapse/derivations/2026-09-20-gaussian-tail.md`. |
| 16 | The measure-theoretic estimate is stated for an arbitrary measurable energy; |
| 17 | the decay threshold uses Mathlib's exponential-versus-power asymptotics. |
| 18 | -/ |
| 19 | |
| 20 | set_option autoImplicit false |
| 21 | |
| 22 | open Filter MeasureTheory |
| 23 | open scoped Topology |
| 24 | |
| 25 | namespace MeasureTheory |
| 26 | |
| 27 | /-- Half-exponential domination on a measurable energy superlevel set. |
| 28 | This is the integral estimate in the corrected Lemma 8.9, pp. 175-176. -/ |
| 29 | theorem setIntegral_exp_neg_le_half {α : Type*} [MeasurableSpace α] |
| 30 | {μ : Measure α} {f : α → ℝ} {s : Set α} {a : ℝ} |
| 31 | (hf : Measurable f) (hs : MeasurableSet s) |
| 32 | (hint : Integrable (fun x => Real.exp (-f x / 2)) μ) |
| 33 | (ha : ∀ x ∈ s, a ≤ f x) : |
| 34 | IntegrableOn (fun x => Real.exp (-f x)) s μ ∧ |
| 35 | (∫ x in s, Real.exp (-f x) ∂μ) ≤ |
| 36 | Real.exp (-a / 2) * ∫ x, Real.exp (-f x / 2) ∂μ := by |
| 37 | have hpoint (x : α) (hx : x ∈ s) : |
| 38 | Real.exp (-f x) ≤ Real.exp (-a / 2) * Real.exp (-f x / 2) := by |
| 39 | calc |
| 40 | Real.exp (-f x) = Real.exp (-f x / 2) * Real.exp (-f x / 2) := by |
| 41 | rw [← Real.exp_add] |
| 42 | congr 1 |
| 43 | ring |
| 44 | _ ≤ Real.exp (-a / 2) * Real.exp (-f x / 2) := |
| 45 | mul_le_mul_of_nonneg_right |
| 46 | (Real.exp_le_exp.mpr (by linarith [ha x hx])) (Real.exp_pos _).le |
| 47 | have hbig : IntegrableOn |
| 48 | (fun x => Real.exp (-a / 2) * Real.exp (-f x / 2)) s μ := |
| 49 | (hint.const_mul _).integrableOn |
| 50 | have hsmall : IntegrableOn (fun x => Real.exp (-f x)) s μ := by |
| 51 | apply hbig.mono' hf.neg.exp.aestronglyMeasurable.restrict |
| 52 | filter_upwards [ae_restrict_mem hs] with x hx |
| 53 | rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] |
| 54 | exact hpoint x hx |
| 55 | refine ⟨hsmall, ?_⟩ |
| 56 | calc |
| 57 | (∫ x in s, Real.exp (-f x) ∂μ) ≤ |
| 58 | ∫ x in s, Real.exp (-a / 2) * Real.exp (-f x / 2) ∂μ := |
| 59 | setIntegral_mono_on hsmall hbig hs hpoint |
| 60 | _ = Real.exp (-a / 2) * ∫ x in s, Real.exp (-f x / 2) ∂μ := |
| 61 | integral_const_mul _ _ |
| 62 | _ ≤ Real.exp (-a / 2) * ∫ x, Real.exp (-f x / 2) ∂μ := |
| 63 | mul_le_mul_of_nonneg_left |
| 64 | (setIntegral_le_integral hint (Filter.Eventually.of_forall |
| 65 | (fun x => (Real.exp_pos (-f x / 2)).le))) (Real.exp_pos _).le |
| 66 | |
| 67 | /-- A Gaussian tail bound in a finite-dimensional real inner-product space, |
| 68 | with its canonical volume. Source: the repaired Lemma 8.9, pp. 175-176. -/ |
| 69 | theorem setIntegral_exp_neg_norm_sq_le {E : Type*} [NormedAddCommGroup E] |
| 70 | [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] |
| 71 | [MeasurableSpace E] [BorelSpace E] |
| 72 | {s : Set E} (hs : MeasurableSet s) {A : ℝ} |
| 73 | (hA : 0 ≤ A) (haway : ∀ x ∈ s, A ≤ ‖x‖) : |
| 74 | (∫ x in s, Real.exp (-‖x‖ ^ 2)) ≤ |
| 75 | Real.exp (-A ^ 2 / 2) * |
| 76 | Real.rpow (2 * Real.pi) ((Module.finrank ℝ E : ℝ) / 2) := by |
| 77 | have heval : (∫ x : E, Real.exp (-‖x‖ ^ 2 / 2)) = |
| 78 | Real.rpow (2 * Real.pi) ((Module.finrank ℝ E : ℝ) / 2) := by |
| 79 | have h := GaussianFourier.integral_rexp_neg_mul_sq_norm |
| 80 | (V := E) (b := (1 / 2 : ℝ)) (by norm_num) |
| 81 | convert h using 1 |
| 82 | · congr 1 |
| 83 | funext x |
| 84 | congr 1 |
| 85 | ring |
| 86 | · congr 1 |
| 87 | ring |
| 88 | have hint : Integrable (fun x : E => Real.exp (-‖x‖ ^ 2 / 2)) := by |
| 89 | by_contra h |
| 90 | rw [integral_undef h] at heval |
| 91 | exact (ne_of_gt (Real.rpow_pos_of_pos |
| 92 | (mul_pos (by norm_num) Real.pi_pos) _)) heval.symm |
| 93 | have htail := setIntegral_exp_neg_le_half (measurable_norm.pow_const 2) hs hint |
| 94 | (fun x hx => pow_le_pow_left₀ hA (haway x hx) 2) |
| 95 | rw [heval] at htail |
| 96 | exact htail.2 |
| 97 | |
| 98 | end MeasureTheory |
| 99 | |
| 100 | namespace Real |
| 101 | |
| 102 | /-- A negative reciprocal exponential is eventually bounded by any real |
| 103 | power, with a closed positive threshold. This chooses the dimensional |
| 104 | smallness constant in Morgan-Tian Lemma 8.9, pp. 175-176. -/ |
| 105 | theorem exists_pos_exp_neg_div_le_rpow (C p : ℝ) {b : ℝ} (hb : 0 < b) : |
| 106 | ∃ δ : ℝ, 0 < δ ∧ ∀ ε : ℝ, 0 < ε → ε ≤ δ → |
| 107 | C * Real.exp (-b / ε) ≤ Real.rpow ε p := by |
| 108 | have hlim : Tendsto |
| 109 | (fun ε : ℝ => C * (Real.rpow ε⁻¹ p * Real.exp (-b * ε⁻¹))) |
| 110 | (𝓝[>] (0 : ℝ)) (𝓝 0) := by |
| 111 | simpa only [Function.comp_def, mul_zero, Real.rpow_eq_pow] using tendsto_const_nhds.mul |
| 112 | ((tendsto_rpow_mul_exp_neg_mul_atTop_nhds_zero p b hb).comp |
| 113 | tendsto_inv_nhdsGT_zero) |
| 114 | have hsmall : ∀ᶠ ε : ℝ in 𝓝[>] (0 : ℝ), |
| 115 | C * (Real.rpow ε⁻¹ p * Real.exp (-b * ε⁻¹)) < 1 := |
| 116 | hlim.eventually (gt_mem_nhds zero_lt_one) |
| 117 | obtain ⟨η, hη, hbound⟩ := mem_nhdsGT_iff_exists_Ioo_subset.mp hsmall |
| 118 | change 0 < η at hη |
| 119 | refine ⟨η / 2, by linarith, ?_⟩ |
| 120 | intro ε hε hεη |
| 121 | have hlt : C * (Real.rpow ε⁻¹ p * Real.exp (-b * ε⁻¹)) < 1 := |
| 122 | hbound ⟨hε, by linarith⟩ |
| 123 | have hid : C * (Real.rpow ε⁻¹ p * Real.exp (-b * ε⁻¹)) = |
| 124 | (C * Real.exp (-b / ε)) / Real.rpow ε p := by |
| 125 | simp only [Real.rpow_eq_pow, Real.inv_rpow hε.le, div_eq_mul_inv] |
| 126 | ring |
| 127 | rw [hid] at hlt |
| 128 | have h := (div_le_iff₀ (Real.rpow_pos_of_pos hε p)).mp hlt.le |
| 129 | simpa only [one_mul, Real.rpow_eq_pow] using h |
| 130 | |
| 131 | end Real |