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.InnerProductSpace.Calculus |
| 2 | import Mathlib.Analysis.SpecialFunctions.Sqrt |
| 3 | |
| 4 | /-! |
| 5 | # A smooth approximation to the norm |
| 6 | |
| 7 | The function `sqrt (norm x ^ 2 + e ^ 2)` avoids differentiating the norm |
| 8 | at zero. It is used for the radial distance argument in Morgan-Tian |
| 9 | Lemma 12.2, printed pp. 294-295; see the M34 radial-distance derivation. |
| 10 | The statements hold on every real inner product space. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open scoped ContDiff |
| 16 | |
| 17 | namespace Poincare |
| 18 | |
| 19 | variable {E : Type*} [NormedAddCommGroup E] |
| 20 | |
| 21 | /-- Smooth positive regularization of the norm used in the distance |
| 22 | argument for Morgan-Tian Lemma 12.2, pp. 294-295. -/ |
| 23 | noncomputable def regularizedNorm (e : ℝ) (x : E) : ℝ := |
| 24 | Real.sqrt (‖x‖ ^ 2 + e ^ 2) |
| 25 | |
| 26 | /-- A positive regularization parameter makes the square root strictly |
| 27 | positive everywhere (Lemma 12.2 distance argument, pp. 294-295). -/ |
| 28 | theorem regularizedNorm_pos {e : ℝ} (he : 0 < e) (x : E) : |
| 29 | 0 < regularizedNorm e x := by |
| 30 | unfold regularizedNorm |
| 31 | positivity |
| 32 | |
| 33 | /-- The regularized norm bounds the ordinary norm from above |
| 34 | (Lemma 12.2 distance argument, pp. 294-295). -/ |
| 35 | theorem norm_le_regularizedNorm (e : ℝ) (x : E) : |
| 36 | ‖x‖ ≤ regularizedNorm e x := by |
| 37 | calc |
| 38 | ‖x‖ = Real.sqrt (‖x‖ ^ 2) := (Real.sqrt_sq (norm_nonneg x)).symm |
| 39 | _ ≤ regularizedNorm e x := Real.sqrt_le_sqrt (le_add_of_nonneg_right (sq_nonneg e)) |
| 40 | |
| 41 | /-- The error at the origin is exactly the positive regularization |
| 42 | parameter (Lemma 12.2 distance argument, pp. 294-295). -/ |
| 43 | theorem regularizedNorm_zero {e : ℝ} (he : 0 ≤ e) : |
| 44 | regularizedNorm e (0 : E) = e := by |
| 45 | simp only [regularizedNorm, norm_zero, zero_pow (by decide : 2 ≠ 0), zero_add, |
| 46 | Real.sqrt_sq he] |
| 47 | |
| 48 | variable [InnerProductSpace ℝ E] |
| 49 | |
| 50 | /-- Smoothness holds at the origin as well as away from it |
| 51 | (Lemma 12.2 distance argument, pp. 294-295). -/ |
| 52 | theorem regularizedNorm_contDiff {e : ℝ} (he : 0 < e) : |
| 53 | ContDiff ℝ ∞ (regularizedNorm e : E → ℝ) := by |
| 54 | exact ((contDiff_norm_sq ℝ).add contDiff_const).sqrt (fun _ => by positivity) |
| 55 | |
| 56 | /-- The differential of the regularized norm has a nonzero denominator |
| 57 | at every point (Lemma 12.2 distance argument, pp. 294-295). -/ |
| 58 | theorem regularizedNorm_hasFDerivAt {e : ℝ} (he : 0 < e) (x : E) : |
| 59 | HasFDerivAt (regularizedNorm e) |
| 60 | ((regularizedNorm e x)⁻¹ • innerSL ℝ x) x := by |
| 61 | have hpos : 0 < ‖x‖ ^ 2 + e ^ 2 := by positivity |
| 62 | convert! ((hasStrictFDerivAt_norm_sq x).hasFDerivAt.add_const (e ^ 2)).sqrt |
| 63 | hpos.ne' using 1 |
| 64 | ext v |
| 65 | simp only [smul_apply, smul_eq_mul, innerSL_apply_apply, regularizedNorm, two_smul] |
| 66 | change (Real.sqrt (‖x‖ ^ 2 + e ^ 2))⁻¹ * inner ℝ x v = |
| 67 | 1 / (2 * Real.sqrt (‖x‖ ^ 2 + e ^ 2)) * (inner ℝ x v + inner ℝ x v) |
| 68 | field_simp |
| 69 | ring |
| 70 | |
| 71 | end Poincare |