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.Calculus.Deriv.MeanValue |
| 2 | import Mathlib.Analysis.SpecialFunctions.ExpDeriv |
| 3 | import Mathlib.Analysis.SpecialFunctions.Sqrt |
| 4 | |
| 5 | /-! Adapted from Mapher `PoincareMT/Proofs/M15/Mathlib/WeightedSpeed.lean` at |
| 6 | `0c5d5c4e1ecbc12703b1994e226df1b15d2e8d39`. See the source mapping in |
| 7 | `references/ricci-flow/mapher/noncollapse/import.json`. -/ |
| 8 | |
| 9 | /-! |
| 10 | # Scalar comparison for the weighted velocity |
| 11 | |
| 12 | The corrected argument for Morgan-Tian Claims 8.6-8.7, pp. 173-174, in |
| 13 | square-root time. The derivation is recorded in |
| 14 | `references/ricci-flow/mapher/noncollapse/derivations/2026-09-20-weighted-speed.md`. |
| 15 | Actual derivatives on the open interval and continuity at both endpoints |
| 16 | are required. Regularization handles zeros of the squared speed. |
| 17 | -/ |
| 18 | |
| 19 | set_option autoImplicit false |
| 20 | |
| 21 | open Filter Set |
| 22 | open scoped Topology |
| 23 | |
| 24 | namespace Real |
| 25 | |
| 26 | /-- An integrating-factor bound for a time-weighted linear differential |
| 27 | inequality. This is the scalar comparison in corrected Claim 8.6, p. 173. -/ |
| 28 | theorem le_exp_sq_mul_of_deriv_le {v v' : ℝ → ℝ} {a b S : ℝ} |
| 29 | (ha : 0 ≤ a) (hb : 0 ≤ b) (hS : 0 ≤ S) |
| 30 | (hv : ContinuousOn v (Icc 0 S)) |
| 31 | (hv' : ∀ s ∈ Ioo 0 S, HasDerivAt v (v' s) s) |
| 32 | (hbound : ∀ s ∈ Ioo 0 S, v' s ≤ 2 * a * s * v s + 2 * b * s ^ 2) : |
| 33 | ∀ s ∈ Icc 0 S, |
| 34 | v s ≤ exp (a * s ^ 2) * (v 0 + (2 / 3 : ℝ) * b * s ^ 3) := by |
| 35 | let f := fun s => exp (-a * s ^ 2) * v s - (2 / 3 : ℝ) * b * s ^ 3 |
| 36 | let f' := fun s => exp (-a * s ^ 2) * (v' s - 2 * a * s * v s) - |
| 37 | 2 * b * s ^ 2 |
| 38 | have hf : ContinuousOn f (Icc 0 S) := by |
| 39 | dsimp [f] |
| 40 | fun_prop |
| 41 | have hf' (s : ℝ) (hs : s ∈ Ioo 0 S) : HasDerivAt f (f' s) s := by |
| 42 | convert (((((hasDerivAt_id s).pow 2).const_mul (-a)).exp.mul (hv' s hs)).sub |
| 43 | (((hasDerivAt_id s).pow 3).const_mul ((2 / 3 : ℝ) * b))) using 1 <;> |
| 44 | first | rfl | (dsimp [f, f']; ring) |
| 45 | have hf'_nonpos (s : ℝ) (hs : s ∈ Ioo 0 S) : f' s ≤ 0 := by |
| 46 | have he : exp (-a * s ^ 2) ≤ 1 := exp_le_one_iff.mpr (by nlinarith [sq_nonneg s]) |
| 47 | have h₁ := mul_le_mul_of_nonneg_left (hbound s hs) (exp_pos (-a * s ^ 2)).le |
| 48 | have h₂ := mul_le_mul_of_nonneg_right he |
| 49 | (mul_nonneg (mul_nonneg (by norm_num : (0 : ℝ) ≤ 2) hb) (sq_nonneg s)) |
| 50 | dsimp [f'] |
| 51 | nlinarith |
| 52 | have hanti : AntitoneOn f (Icc 0 S) := by |
| 53 | apply antitoneOn_of_hasDerivWithinAt_nonpos (convex_Icc 0 S) hf |
| 54 | · intro s hs |
| 55 | exact (hf' s (by simpa only [interior_Icc] using hs)).hasDerivWithinAt |
| 56 | · intro s hs |
| 57 | exact hf'_nonpos s (by simpa only [interior_Icc] using hs) |
| 58 | intro s hs |
| 59 | have h := hanti ⟨le_rfl, hS⟩ hs hs.1 |
| 60 | dsimp [f] at h |
| 61 | norm_num at h |
| 62 | have hstep : exp (-a * s ^ 2) * v s ≤ v 0 + (2 / 3 : ℝ) * b * s ^ 3 := by |
| 63 | simpa only [neg_mul] using h |
| 64 | have hcancel : exp (a * s ^ 2) * exp (-a * s ^ 2) = 1 := by |
| 65 | rw [← exp_add] |
| 66 | simp |
| 67 | have hmul := mul_le_mul_of_nonneg_left hstep (exp_pos (a * s ^ 2)).le |
| 68 | rw [← mul_assoc, hcancel, one_mul] at hmul |
| 69 | exact hmul |
| 70 | |
| 71 | /-- A square-root energy bound that remains valid at zeros of the energy. |
| 72 | This supplies the scalar comparison in corrected Claim 8.6, p. 173. -/ |
| 73 | theorem sqrt_le_exp_sq_mul_of_deriv_le {q q' : ℝ → ℝ} {a b S : ℝ} |
| 74 | (ha : 0 ≤ a) (hb : 0 ≤ b) (hS : 0 ≤ S) |
| 75 | (hq : ContinuousOn q (Icc 0 S)) (hq_nonneg : ∀ s ∈ Icc 0 S, 0 ≤ q s) |
| 76 | (hq' : ∀ s ∈ Ioo 0 S, HasDerivAt q (q' s) s) |
| 77 | (hbound : ∀ s ∈ Ioo 0 S, |
| 78 | q' s ≤ 4 * a * s * q s + 4 * b * s ^ 2 * sqrt (q s)) : |
| 79 | ∀ s ∈ Icc 0 S, |
| 80 | sqrt (q s) ≤ exp (a * s ^ 2) * (sqrt (q 0) + (2 / 3 : ℝ) * b * s ^ 3) := by |
| 81 | intro s hs |
| 82 | have hregularized (η : ℝ) (hη : 0 < η) : |
| 83 | sqrt (q s) ≤ exp (a * s ^ 2) * |
| 84 | (sqrt (q 0 + η ^ 2) + (2 / 3 : ℝ) * b * s ^ 3) := by |
| 85 | have hpositive (t : ℝ) (ht : t ∈ Icc 0 S) : 0 < q t + η ^ 2 := |
| 86 | add_pos_of_nonneg_of_pos (hq_nonneg t ht) (sq_pos_of_pos hη) |
| 87 | have hv' (t : ℝ) (ht : t ∈ Ioo 0 S) : |
| 88 | HasDerivAt (fun t => sqrt (q t + η ^ 2)) |
| 89 | (q' t / (2 * sqrt (q t + η ^ 2))) t := |
| 90 | ((hq' t ht).add_const (η ^ 2)).sqrt (ne_of_gt (hpositive t (Ioo_subset_Icc_self ht))) |
| 91 | have hvbound (t : ℝ) (ht : t ∈ Ioo 0 S) : |
| 92 | q' t / (2 * sqrt (q t + η ^ 2)) ≤ |
| 93 | 2 * a * t * sqrt (q t + η ^ 2) + 2 * b * t ^ 2 := by |
| 94 | apply (div_le_iff₀ (mul_pos (by norm_num) (sqrt_pos.mpr |
| 95 | (hpositive t (Ioo_subset_Icc_self ht))))).2 |
| 96 | have hqv : q t ≤ sqrt (q t + η ^ 2) ^ 2 := by |
| 97 | rw [sq_sqrt (hpositive t (Ioo_subset_Icc_self ht)).le] |
| 98 | nlinarith [sq_nonneg η] |
| 99 | have hroot : sqrt (q t) ≤ sqrt (q t + η ^ 2) := |
| 100 | sqrt_le_sqrt (le_add_of_nonneg_right (sq_nonneg η)) |
| 101 | have h₁ := mul_le_mul_of_nonneg_left hqv |
| 102 | (mul_nonneg (mul_nonneg (by norm_num : (0 : ℝ) ≤ 4) ha) ht.1.le) |
| 103 | have h₂ := mul_le_mul_of_nonneg_left hroot |
| 104 | (mul_nonneg (mul_nonneg (by norm_num : (0 : ℝ) ≤ 4) hb) (sq_nonneg t)) |
| 105 | nlinarith [hbound t ht] |
| 106 | exact (sqrt_le_sqrt (le_add_of_nonneg_right (sq_nonneg η))).trans |
| 107 | (le_exp_sq_mul_of_deriv_le ha hb hS (hq.add continuousOn_const).sqrt |
| 108 | hv' hvbound s hs) |
| 109 | have hlim : Tendsto |
| 110 | (fun η : ℝ => exp (a * s ^ 2) * |
| 111 | (sqrt (q 0 + η ^ 2) + (2 / 3 : ℝ) * b * s ^ 3)) |
| 112 | (𝓝[>] (0 : ℝ)) |
| 113 | (𝓝 (exp (a * s ^ 2) * (sqrt (q 0) + (2 / 3 : ℝ) * b * s ^ 3))) := by |
| 114 | have hc : ContinuousAt |
| 115 | (fun η : ℝ => exp (a * s ^ 2) * |
| 116 | (sqrt (q 0 + η ^ 2) + (2 / 3 : ℝ) * b * s ^ 3)) 0 := by |
| 117 | fun_prop |
| 118 | have ht : Tendsto |
| 119 | (fun η : ℝ => exp (a * s ^ 2) * |
| 120 | (sqrt (q 0 + η ^ 2) + (2 / 3 : ℝ) * b * s ^ 3)) (𝓝 (0 : ℝ)) |
| 121 | (𝓝 (exp (a * s ^ 2) * (sqrt (q 0) + (2 / 3 : ℝ) * b * s ^ 3))) := by |
| 122 | simpa using hc.tendsto |
| 123 | exact ht.mono_left nhdsWithin_le_nhds |
| 124 | apply le_of_tendsto_of_tendsto tendsto_const_nhds hlim |
| 125 | filter_upwards [self_mem_nhdsWithin] with η hη |
| 126 | exact hregularized η hη |
| 127 | |
| 128 | end Real |