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.ExpDeriv |
| 2 | import Mathlib.Analysis.SpecialFunctions.Pow.Real |
| 3 | |
| 4 | /-! Adapted from Mapher `PoincareMT/Proofs/M15/Lemma8_7_ExitConstants.lean` at |
| 5 | `0c5d5c4e1ecbc12703b1994e226df1b15d2e8d39`. See the source mapping in |
| 6 | `references/ricci-flow/mapher/noncollapse/import.json`. -/ |
| 7 | |
| 8 | /-! |
| 9 | # Numerical bounds for the strict exit margin |
| 10 | |
| 11 | Morgan-Tian Claims 8.6-8.7, pp. 173-174, with the corrected cutoff and |
| 12 | scaling in `references/ricci-flow/mapher/noncollapse/derivations/2026-09-21-exit-constants.md`. |
| 13 | The small parameter is chosen before any geometric data. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Topology |
| 20 | |
| 21 | namespace PoincareMT.Generalized.Noncollapse |
| 22 | |
| 23 | /-- Choose the dimension-dependent small parameter for the two numerical |
| 24 | bounds in corrected Claims 8.6-8.7, pp. 173-174. -/ |
| 25 | theorem exists_small_epsilon_exit_bounds (n : ℕ) (A : ℝ) : |
| 26 | ∃ epsilon0 : ℝ, 0 < epsilon0 ∧ epsilon0 ≤ 1 / 2 ∧ |
| 27 | ∀ epsilon : ℝ, 0 < epsilon → epsilon ≤ epsilon0 → |
| 28 | Real.exp (2 * (n : ℝ) * epsilon) ≤ 4 / 3 ∧ |
| 29 | (2 / 3 : ℝ) * A * epsilon ^ 2 ≤ 1 / 16 := by |
| 30 | have hf : ContinuousAt (fun e : ℝ => Real.exp (2 * (n : ℝ) * e)) 0 := by fun_prop |
| 31 | have hg : ContinuousAt (fun e : ℝ => (2 / 3 : ℝ) * A * e ^ 2) 0 := by fun_prop |
| 32 | have hf' : ∀ᶠ e : ℝ in 𝓝 0, Real.exp (2 * (n : ℝ) * e) < 4 / 3 := |
| 33 | hf (Iio_mem_nhds (by norm_num)) |
| 34 | have hg' : ∀ᶠ e : ℝ in 𝓝 0, (2 / 3 : ℝ) * A * e ^ 2 < 1 / 16 := |
| 35 | hg (Iio_mem_nhds (by norm_num)) |
| 36 | have hN := hf'.and hg' |
| 37 | obtain ⟨delta, hdelta, hball⟩ := Metric.mem_nhds_iff.mp hN |
| 38 | refine ⟨min (1 / 2) (delta / 2), lt_min (by norm_num) (half_pos hdelta), |
| 39 | min_le_left _ _, ?_⟩ |
| 40 | intro epsilon hepsilon hepsilon0 |
| 41 | have hedelta : epsilon < delta := |
| 42 | (hepsilon0.trans (min_le_right _ _)).trans_lt (half_lt_self hdelta) |
| 43 | have hmem : epsilon ∈ Metric.ball (0 : ℝ) delta := by |
| 44 | simpa only [Metric.mem_ball, Real.dist_eq, sub_zero, abs_of_pos hepsilon] using hedelta |
| 45 | exact ⟨(hball hmem).1.le, (hball hmem).2.le⟩ |
| 46 | |
| 47 | /-- The corrected initial-speed cutoff gives the uniform speed used for |
| 48 | the 5r/12 displacement margin in Claims 8.6-8.7, pp. 173-174. -/ |
| 49 | theorem scaled_squareRoot_speed_le |
| 50 | (n : ℕ) {A r epsilon q s : ℝ} |
| 51 | (hA : 0 ≤ A) (hr : 0 < r) (hepsilon : 0 < epsilon) |
| 52 | (hq0 : 0 ≤ q) (hq : q ≤ 1 / (4 * Real.sqrt epsilon)) |
| 53 | (hs0 : 0 ≤ s) (hs : s ≤ Real.sqrt epsilon * r) |
| 54 | (hexp : Real.exp (2 * (n : ℝ) * epsilon) ≤ 4 / 3) |
| 55 | (hAepsilon : (2 / 3 : ℝ) * A * epsilon ^ 2 ≤ 1 / 16) : |
| 56 | Real.exp (2 * (n : ℝ) * (r⁻¹) ^ 2 * s ^ 2) * |
| 57 | (q + (2 / 3 : ℝ) * (A / r ^ 3) * s ^ 3) ≤ |
| 58 | 5 / (12 * Real.sqrt epsilon) := by |
| 59 | have hw := Real.sqrt_pos.mpr hepsilon |
| 60 | have hsquare : (r⁻¹) ^ 2 * s ^ 2 ≤ epsilon := by |
| 61 | calc |
| 62 | _ ≤ (r⁻¹) ^ 2 * (Real.sqrt epsilon * r) ^ 2 := |
| 63 | mul_le_mul_of_nonneg_left (pow_le_pow_left₀ hs0 hs 2) (sq_nonneg _) |
| 64 | _ = epsilon := by |
| 65 | rw [mul_pow, Real.sq_sqrt hepsilon.le] |
| 66 | field_simp |
| 67 | have hexp' : Real.exp (2 * (n : ℝ) * (r⁻¹) ^ 2 * s ^ 2) ≤ 4 / 3 := by |
| 68 | apply (Real.exp_le_exp.mpr ?_).trans hexp |
| 69 | nlinarith only [mul_le_mul_of_nonneg_left hsquare |
| 70 | (mul_nonneg (by norm_num : (0 : ℝ) ≤ 2) (Nat.cast_nonneg n))] |
| 71 | have hq' : q * Real.sqrt epsilon ≤ 1 / 4 := by |
| 72 | have h := (le_div_iff₀ (mul_pos (by norm_num : (0 : ℝ) < 4) hw)).mp hq |
| 73 | linarith |
| 74 | have hterm : (2 / 3 : ℝ) * (A / r ^ 3) * s ^ 3 * Real.sqrt epsilon ≤ 1 / 16 := by |
| 75 | calc |
| 76 | _ ≤ (2 / 3 : ℝ) * (A / r ^ 3) * (Real.sqrt epsilon * r) ^ 3 * |
| 77 | Real.sqrt epsilon := |
| 78 | mul_le_mul_of_nonneg_right |
| 79 | (mul_le_mul_of_nonneg_left (pow_le_pow_left₀ hs0 hs 3) (by positivity)) hw.le |
| 80 | _ = (2 / 3 : ℝ) * A * epsilon ^ 2 := by |
| 81 | calc |
| 82 | _ = (2 / 3 : ℝ) * A * ((Real.sqrt epsilon) ^ 2) ^ 2 := by |
| 83 | field_simp |
| 84 | _ = _ := by rw [Real.sq_sqrt hepsilon.le] |
| 85 | _ ≤ _ := hAepsilon |
| 86 | have hpoly : 0 ≤ q + (2 / 3 : ℝ) * (A / r ^ 3) * s ^ 3 := by positivity |
| 87 | apply (mul_le_mul_of_nonneg_right hexp' hpoly).trans |
| 88 | apply (le_div_iff₀ (mul_pos (by norm_num : (0 : ℝ) < 12) hw)).mpr |
| 89 | nlinarith only [hq', hterm] |
| 90 | |
| 91 | end PoincareMT.Generalized.Noncollapse |