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.SmoothTransition |
| 2 | import Mathlib.Tactic.FieldSimp |
| 3 | import Mathlib.Tactic.Linarith |
| 4 | import Mathlib.Tactic.Positivity |
| 5 | import Mathlib.Tactic.Ring |
| 6 | |
| 7 | /-! |
| 8 | # The smooth scalar functions used in surgery |
| 9 | |
| 10 | The profile and two cutoffs implement the scalar choices on Morgan--Tian, |
| 11 | pp. 331-332. They impose no geometric assumption and carry no admission. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open scoped ContDiff |
| 17 | |
| 18 | namespace PoincareMT.MetricSurgery |
| 19 | |
| 20 | noncomputable def smoothProfile (C q epsilon s : ℝ) : ℝ := |
| 21 | C * epsilon * expNegInvGlue (s / q) |
| 22 | |
| 23 | theorem smoothProfile_contDiff (C q epsilon : ℝ) : |
| 24 | ContDiff ℝ ∞ (smoothProfile C q epsilon) := |
| 25 | contDiff_const.mul (expNegInvGlue.contDiff.comp (contDiff_id.div_const q)) |
| 26 | |
| 27 | theorem smoothProfile_eq_zero {C q epsilon s : ℝ} (hq : 0 < q) (hs : s ≤ 0) : |
| 28 | smoothProfile C q epsilon s = 0 := by |
| 29 | rw [smoothProfile, expNegInvGlue.zero_of_nonpos |
| 30 | (div_nonpos_of_nonpos_of_nonneg hs hq.le), mul_zero] |
| 31 | |
| 32 | theorem smoothProfile_eq_exp {C q epsilon s : ℝ} (hq : 0 < q) (hs : 0 < s) : |
| 33 | smoothProfile C q epsilon s = C * epsilon * Real.exp (-q / s) := by |
| 34 | have hsq : ¬ s / q ≤ 0 := not_le.mpr (div_pos hs hq) |
| 35 | simp only [smoothProfile, expNegInvGlue, if_neg hsq, inv_div] |
| 36 | rw [neg_div] |
| 37 | |
| 38 | theorem smoothProfile_nonneg {C q epsilon : ℝ} |
| 39 | (hC : 0 ≤ C) (hepsilon : 0 ≤ epsilon) (s : ℝ) : |
| 40 | 0 ≤ smoothProfile C q epsilon s := |
| 41 | mul_nonneg (mul_nonneg hC hepsilon) (expNegInvGlue.nonneg _) |
| 42 | |
| 43 | theorem smoothProfile_pos {C q epsilon s : ℝ} |
| 44 | (hC : 0 < C) (hq : 0 < q) (hepsilon : 0 < epsilon) (hs : 0 < s) : |
| 45 | 0 < smoothProfile C q epsilon s := |
| 46 | mul_pos (mul_pos hC hepsilon) (expNegInvGlue.pos_of_pos (div_pos hs hq)) |
| 47 | |
| 48 | noncomputable def conformalFactor (C q epsilon s : ℝ) : ℝ := |
| 49 | Real.exp (-2 * smoothProfile C q epsilon s) |
| 50 | |
| 51 | theorem conformalFactor_contDiff (C q epsilon : ℝ) : |
| 52 | ContDiff ℝ ∞ (conformalFactor C q epsilon) := |
| 53 | (contDiff_const.mul (smoothProfile_contDiff C q epsilon)).exp |
| 54 | |
| 55 | theorem conformalFactor_pos (C q epsilon s : ℝ) : |
| 56 | 0 < conformalFactor C q epsilon s := Real.exp_pos _ |
| 57 | |
| 58 | theorem conformalFactor_le_one {C q epsilon : ℝ} |
| 59 | (hC : 0 ≤ C) (hepsilon : 0 ≤ epsilon) (s : ℝ) : |
| 60 | conformalFactor C q epsilon s ≤ 1 := by |
| 61 | apply Real.exp_le_one_iff.mpr |
| 62 | have hf := smoothProfile_nonneg (q := q) hC hepsilon s |
| 63 | linarith |
| 64 | |
| 65 | theorem conformalFactor_eq_one {C q epsilon s : ℝ} |
| 66 | (hq : 0 < q) (hs : s ≤ 0) : conformalFactor C q epsilon s = 1 := by |
| 67 | simp [conformalFactor, smoothProfile_eq_zero hq hs] |
| 68 | |
| 69 | noncomputable def neckCutoff (s : ℝ) : ℝ := |
| 70 | 1 - Real.smoothTransition (2 * s - 5 / 2) |
| 71 | |
| 72 | theorem neckCutoff_contDiff : ContDiff ℝ ∞ neckCutoff := |
| 73 | contDiff_const.sub (Real.smoothTransition.contDiff.comp |
| 74 | ((contDiff_const.mul contDiff_id).sub contDiff_const)) |
| 75 | |
| 76 | theorem neckCutoff_nonneg (s : ℝ) : 0 ≤ neckCutoff s := |
| 77 | sub_nonneg.mpr (Real.smoothTransition.le_one _) |
| 78 | |
| 79 | theorem neckCutoff_le_one (s : ℝ) : neckCutoff s ≤ 1 := |
| 80 | sub_le_self _ (Real.smoothTransition.nonneg _) |
| 81 | |
| 82 | theorem neckCutoff_eq_one {s : ℝ} (hs : s ≤ 5 / 4) : neckCutoff s = 1 := by |
| 83 | rw [neckCutoff, Real.smoothTransition.zero_of_nonpos (by linarith), sub_zero] |
| 84 | |
| 85 | theorem neckCutoff_eq_zero {s : ℝ} (hs : 7 / 4 ≤ s) : neckCutoff s = 0 := by |
| 86 | rw [neckCutoff, Real.smoothTransition.one_of_one_le (by linarith), sub_self] |
| 87 | |
| 88 | noncomputable def tipCutoff (A r s : ℝ) : ℝ := |
| 89 | 1 - Real.smoothTransition (4 * (s - (A - 3 * r / 4)) / r) |
| 90 | |
| 91 | theorem tipCutoff_contDiff (A r : ℝ) : ContDiff ℝ ∞ (tipCutoff A r) := |
| 92 | contDiff_const.sub (Real.smoothTransition.contDiff.comp |
| 93 | ((contDiff_const.mul (contDiff_id.sub contDiff_const)).div_const r)) |
| 94 | |
| 95 | theorem tipCutoff_nonneg (A r s : ℝ) : 0 ≤ tipCutoff A r s := |
| 96 | sub_nonneg.mpr (Real.smoothTransition.le_one _) |
| 97 | |
| 98 | theorem tipCutoff_le_one (A r s : ℝ) : tipCutoff A r s ≤ 1 := |
| 99 | sub_le_self _ (Real.smoothTransition.nonneg _) |
| 100 | |
| 101 | theorem tipCutoff_eq_one {A r s : ℝ} (hr : 0 < r) (hs : s ≤ A - 3 * r / 4) : |
| 102 | tipCutoff A r s = 1 := by |
| 103 | rw [tipCutoff, Real.smoothTransition.zero_of_nonpos ?_, sub_zero] |
| 104 | exact div_nonpos_of_nonpos_of_nonneg (by linarith) hr.le |
| 105 | |
| 106 | theorem tipCutoff_eq_zero {A r s : ℝ} (hr : 0 < r) (hs : A - r / 2 ≤ s) : |
| 107 | tipCutoff A r s = 0 := by |
| 108 | rw [tipCutoff, Real.smoothTransition.one_of_one_le ?_, sub_self] |
| 109 | apply (le_div_iff₀ hr).mpr |
| 110 | linarith |
| 111 | |
| 112 | end PoincareMT.MetricSurgery |