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 PoincareLib.Analysis.Parabolic.CompactMaximum |
| 2 | import Mathlib.Analysis.Calculus.Deriv.Inv |
| 3 | import Mathlib.Analysis.Calculus.Deriv.Pow |
| 4 | |
| 5 | /-! Adapted from Mapher `PoincareMT/Proofs/M15/Mathlib/CompactCubicComparison.lean` at |
| 6 | `0c5d5c4e1ecbc12703b1994e226df1b15d2e8d39`. See the source mapping in |
| 7 | `references/ricci-flow/mapher/noncollapse/import.json`. -/ |
| 8 | |
| 9 | /-! |
| 10 | # Compact comparison for a cubic norm reaction |
| 11 | |
| 12 | Morgan-Tian Proposition 4.11, pp. 67-68, as used in Theorem 8.10, |
| 13 | pp. 176-177. A reciprocal barrier for the squared norm reduces the |
| 14 | cubic reaction to the existing compact linear maximum principle. |
| 15 | See `references/ricci-flow/mapher/noncollapse/derivations/2026-09-21-compact-curvature.md`. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | |
| 20 | open Set Filter |
| 21 | open scoped Topology |
| 22 | |
| 23 | namespace Poincare.Parabolic |
| 24 | |
| 25 | /-- A compact nonnegative norm with a cubic squared-energy reaction at |
| 26 | spatial maxima stays below two on a uniform short interval. Source: |
| 27 | Proposition 4.11, pp. 67-68; all derivatives are within the closed interval. -/ |
| 28 | theorem norm_le_two_of_sq_deriv_le_cube_at_max |
| 29 | {A : Type*} [TopologicalSpace A] [CompactSpace A] |
| 30 | {N D : A → ℝ → ℝ} {C b : ℝ} |
| 31 | (hC : 0 < C) (hb : 0 ≤ b) (hbC : b ≤ 1 / (2 * C)) |
| 32 | (hN : ContinuousOn (Function.uncurry N) (univ ×ˢ Icc 0 b)) |
| 33 | (hnonneg : ∀ q t, t ∈ Icc 0 b → 0 ≤ N q t) |
| 34 | (hderiv : ∀ q t, t ∈ Ioc 0 b → |
| 35 | HasDerivWithinAt (fun s => N q s ^ 2) (D q t) (Icc 0 b) t) |
| 36 | (hmax : ∀ q t, t ∈ Ioc 0 b → |
| 37 | (∀ p, N p t ≤ N q t) → D q t ≤ C * N q t ^ 3) |
| 38 | (hinit : ∀ q, N q 0 ≤ 1) : |
| 39 | ∀ q t, t ∈ Icc 0 b → N q t ≤ 2 := by |
| 40 | let p : ℝ → ℝ := fun t => 1 / (1 - C * t) |
| 41 | have hden (t : ℝ) (ht : t ∈ Icc 0 b) : 1 / 2 ≤ 1 - C * t := by |
| 42 | have hbt := mul_le_mul_of_nonneg_left ht.2 hC.le |
| 43 | have hbC' := (le_div_iff₀ (mul_pos (by norm_num : (0 : ℝ) < 2) hC)).mp hbC |
| 44 | linarith |
| 45 | have hdenpos (t : ℝ) (ht : t ∈ Icc 0 b) : 0 < 1 - C * t := |
| 46 | lt_of_lt_of_le (by norm_num) (hden t ht) |
| 47 | have hppos (t : ℝ) (ht : t ∈ Icc 0 b) : 0 < p t := |
| 48 | one_div_pos.mpr (hdenpos t ht) |
| 49 | have hptwo (t : ℝ) (ht : t ∈ Icc 0 b) : p t ≤ 2 := by |
| 50 | apply (div_le_iff₀ (hdenpos t ht)).mpr |
| 51 | linarith [hden t ht] |
| 52 | have hpc : ContinuousOn (fun q : A × ℝ => p q.2) (univ ×ˢ Icc 0 b) := |
| 53 | continuousOn_const.div |
| 54 | (continuous_const.sub (continuous_const.mul continuous_snd)).continuousOn |
| 55 | (fun q hq => (hdenpos q.2 hq.2).ne') |
| 56 | have hpd (t : ℝ) (ht : t ∈ Icc 0 b) : |
| 57 | HasDerivAt (fun s => p s ^ 2) (2 * C * p t ^ 3) t := by |
| 58 | have hd : HasDerivAt p (C / (1 - C * t)^2) t := by |
| 59 | simpa only [p, one_div, id_eq, mul_one, neg_neg] using! |
| 60 | (((hasDerivAt_id t).const_mul C).const_sub 1).inv (hdenpos t ht).ne' |
| 61 | convert! hd.pow 2 using 1 |
| 62 | dsimp [p] |
| 63 | field_simp [(hdenpos t ht).ne'] |
| 64 | obtain ⟨K, hK⟩ := |
| 65 | ((isCompact_univ : IsCompact (univ : Set A)).prod isCompact_Icc).bddAbove_image hN |
| 66 | have hKpos : 0 < max K 1 := zero_lt_one.trans_le (le_max_right _ _) |
| 67 | have hbound (q : A) (t : ℝ) (ht : t ∈ Icc 0 b) : N q t ≤ max K 1 := |
| 68 | (hK (mem_image_of_mem (Function.uncurry N) |
| 69 | (show (q, t) ∈ univ ×ˢ Icc 0 b from ⟨mem_univ q, ht⟩))).trans (le_max_left _ _) |
| 70 | have hF := nonpos_of_deriv_le_mul_at_max |
| 71 | (F := fun q t => N q t ^ 2 - p t ^ 2) |
| 72 | (F' := fun q t => D q t - 2 * C * p t ^ 3) |
| 73 | (a := 0) (b := b) (K := 3 * C * max K 1) |
| 74 | (by simpa only [Function.uncurry, Pi.sub_apply, Pi.pow_apply] using! |
| 75 | (hN.pow 2).sub (hpc.pow 2)) |
| 76 | (fun q t ht => (hderiv q t ht).sub (hpd t ⟨ht.1.le, ht.2⟩).hasDerivWithinAt) |
| 77 | (fun q t ht hpos hspace => by |
| 78 | have ht' : t ∈ Icc 0 b := ⟨ht.1.le, ht.2⟩ |
| 79 | have hNq := hnonneg q t ht' |
| 80 | have hp := (hppos t ht').le |
| 81 | have hpN : p t ≤ N q t := by nlinarith |
| 82 | have hNmax (z : A) : N z t ≤ N q t := by |
| 83 | have hz := hspace z |
| 84 | nlinarith [hnonneg z t ht'] |
| 85 | have hD := hmax q t ht hNmax |
| 86 | have hNK := hbound q t ht' |
| 87 | have hpK := hpN.trans hNK |
| 88 | have hquad : N q t ^ 2 + N q t * p t + p t ^ 2 ≤ |
| 89 | 3 * max K 1 * (N q t + p t) := by |
| 90 | nlinarith [mul_le_mul_of_nonneg_right hNK hNq, |
| 91 | mul_le_mul_of_nonneg_right hNK hp, mul_le_mul_of_nonneg_right hpK hp, |
| 92 | mul_nonneg hKpos.le hNq, mul_nonneg hKpos.le hp] |
| 93 | have hpoly : N q t ^ 3 - p t ^ 3 ≤ |
| 94 | 3 * max K 1 * (N q t ^ 2 - p t ^ 2) := by |
| 95 | calc |
| 96 | _ = (N q t - p t) * (N q t ^ 2 + N q t * p t + p t ^ 2) := by ring |
| 97 | _ ≤ (N q t - p t) * (3 * max K 1 * (N q t + p t)) := |
| 98 | mul_le_mul_of_nonneg_left hquad (sub_nonneg.mpr hpN) |
| 99 | _ = _ := by ring |
| 100 | nlinarith [mul_le_mul_of_nonneg_left hpoly hC.le, |
| 101 | mul_nonneg hC.le (pow_nonneg hp 3)]) |
| 102 | (fun q => by |
| 103 | have hq := pow_le_pow_left₀ (hnonneg q 0 ⟨le_rfl, hb⟩) (hinit q) 2 |
| 104 | simpa only [p, mul_zero, sub_zero, div_one, one_pow, sub_nonpos] using hq) |
| 105 | intro q t ht |
| 106 | have h := hF q t ht |
| 107 | have hp := pow_le_pow_left₀ (hppos t ht).le (hptwo t ht) 2 |
| 108 | nlinarith |
| 109 | |
| 110 | end Poincare.Parabolic |