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 | /-! |
| 6 | # Sharp reciprocal comparison for a compact family |
| 7 | |
| 8 | Morgan--Tian Proposition 4.11, pp. 67-68, and Claim 15.1, p. 353. |
| 9 | The squared-energy coefficient C gives the norm barrier 1/(1-C*t/2). |
| 10 | All derivatives are within the closed time interval. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set |
| 16 | |
| 17 | namespace Poincare.Parabolic |
| 18 | |
| 19 | /-- A cubic bound for the squared norm at spatial maxima gives the exact |
| 20 | reciprocal barrier. Proposition 4.11, pp. 67-68. -/ |
| 21 | theorem norm_le_reciprocal_of_sq_deriv_le_cube_at_max |
| 22 | {A : Type*} [TopologicalSpace A] [CompactSpace A] |
| 23 | {N D : A → ℝ → ℝ} {C b : ℝ} |
| 24 | (hC : 0 < C) (hb : 0 ≤ b) (hbC : C * b < 2) |
| 25 | (hN : ContinuousOn (Function.uncurry N) (univ ×ˢ Icc 0 b)) |
| 26 | (hnonneg : ∀ q t, t ∈ Icc 0 b → 0 ≤ N q t) |
| 27 | (hderiv : ∀ q t, t ∈ Ioc 0 b → |
| 28 | HasDerivWithinAt (fun s => N q s ^ 2) (D q t) (Icc 0 b) t) |
| 29 | (hmax : ∀ q t, t ∈ Ioc 0 b → |
| 30 | (∀ p, N p t ≤ N q t) → D q t ≤ C * N q t ^ 3) |
| 31 | (hinit : ∀ q, N q 0 ≤ 1) : |
| 32 | ∀ q t, t ∈ Icc 0 b → N q t ≤ (1 - C * t / 2)⁻¹ := by |
| 33 | let p : ℝ → ℝ := fun t => (1 - C * t / 2)⁻¹ |
| 34 | have hden (t : ℝ) (ht : t ∈ Icc 0 b) : 0 < 1 - C * t / 2 := by |
| 35 | nlinarith [mul_le_mul_of_nonneg_left ht.2 hC.le] |
| 36 | have hppos (t : ℝ) (ht : t ∈ Icc 0 b) : 0 < p t := inv_pos.mpr (hden t ht) |
| 37 | have hpc : ContinuousOn (fun q : A × ℝ => p q.2) (univ ×ˢ Icc 0 b) := |
| 38 | ((continuous_const.sub ((continuous_const.mul continuous_snd).div_const 2)).continuousOn).inv₀ |
| 39 | (fun q hq => (hden q.2 hq.2).ne') |
| 40 | have hpd (t : ℝ) (ht : t ∈ Icc 0 b) : |
| 41 | HasDerivAt (fun s => p s ^ 2) (C * p t ^ 3) t := by |
| 42 | have hd : HasDerivAt p ((C / 2) / (1 - C * t / 2) ^ 2) t := by |
| 43 | simpa only [p, id_eq, mul_one, neg_div, neg_neg] using! |
| 44 | ((((hasDerivAt_id t).const_mul C).div_const 2).const_sub 1).inv (hden t ht).ne' |
| 45 | convert! hd.pow 2 using 1 |
| 46 | dsimp [p] |
| 47 | field_simp [(hden t ht).ne'] |
| 48 | obtain ⟨K, hK⟩ := |
| 49 | ((isCompact_univ : IsCompact (univ : Set A)).prod isCompact_Icc).bddAbove_image hN |
| 50 | have hKpos : 0 < max K 1 := zero_lt_one.trans_le (le_max_right _ _) |
| 51 | have hbound (q : A) (t : ℝ) (ht : t ∈ Icc 0 b) : N q t ≤ max K 1 := |
| 52 | (hK (mem_image_of_mem (Function.uncurry N) |
| 53 | (show (q, t) ∈ univ ×ˢ Icc 0 b from ⟨mem_univ q, ht⟩))).trans (le_max_left _ _) |
| 54 | have hF := nonpos_of_deriv_le_mul_at_max |
| 55 | (F := fun q t => N q t ^ 2 - p t ^ 2) |
| 56 | (F' := fun q t => D q t - C * p t ^ 3) |
| 57 | (a := 0) (b := b) (K := 3 * C * max K 1) |
| 58 | (by simpa only [Function.uncurry, Pi.sub_apply, Pi.pow_apply] using! |
| 59 | (hN.pow 2).sub (hpc.pow 2)) |
| 60 | (fun q t ht => (hderiv q t ht).sub (hpd t ⟨ht.1.le, ht.2⟩).hasDerivWithinAt) |
| 61 | (fun q t ht hpos hspace => by |
| 62 | have ht' : t ∈ Icc 0 b := ⟨ht.1.le, ht.2⟩ |
| 63 | have hNq := hnonneg q t ht' |
| 64 | have hp := (hppos t ht').le |
| 65 | have hpN : p t ≤ N q t := by nlinarith |
| 66 | have hNmax (z : A) : N z t ≤ N q t := by |
| 67 | have hz := hspace z |
| 68 | nlinarith [hnonneg z t ht'] |
| 69 | have hD := hmax q t ht hNmax |
| 70 | have hNK := hbound q t ht' |
| 71 | have hpK := hpN.trans hNK |
| 72 | have hquad : N q t ^ 2 + N q t * p t + p t ^ 2 ≤ |
| 73 | 3 * max K 1 * (N q t + p t) := by |
| 74 | nlinarith [mul_le_mul_of_nonneg_right hNK hNq, |
| 75 | mul_le_mul_of_nonneg_right hNK hp, mul_le_mul_of_nonneg_right hpK hp, |
| 76 | mul_nonneg hKpos.le hNq, mul_nonneg hKpos.le hp] |
| 77 | have hpoly : N q t ^ 3 - p t ^ 3 ≤ |
| 78 | 3 * max K 1 * (N q t ^ 2 - p t ^ 2) := by |
| 79 | calc |
| 80 | _ = (N q t - p t) * (N q t ^ 2 + N q t * p t + p t ^ 2) := by ring |
| 81 | _ ≤ (N q t - p t) * (3 * max K 1 * (N q t + p t)) := |
| 82 | mul_le_mul_of_nonneg_left hquad (sub_nonneg.mpr hpN) |
| 83 | _ = _ := by ring |
| 84 | nlinarith [mul_le_mul_of_nonneg_left hpoly hC.le]) |
| 85 | (fun q => by |
| 86 | have hq := pow_le_pow_left₀ (hnonneg q 0 ⟨le_rfl, hb⟩) (hinit q) 2 |
| 87 | simpa only [p, mul_zero, zero_div, sub_zero, inv_one, one_pow, sub_nonpos] using hq) |
| 88 | intro q t ht |
| 89 | have h := hF q t ht |
| 90 | change N q t ≤ p t |
| 91 | nlinarith [hnonneg q t ht, hppos t ht] |
| 92 | |
| 93 | /-- The exact reciprocal comparison doubles at time 1/C for an energy |
| 94 | reaction coefficient C. Claim 15.1 uses C=16, p. 353. -/ |
| 95 | theorem norm_le_two_of_sq_deriv_le_cube_at_max_sharp |
| 96 | {A : Type*} [TopologicalSpace A] [CompactSpace A] |
| 97 | {N D : A → ℝ → ℝ} {C b : ℝ} |
| 98 | (hC : 0 < C) (hb : 0 ≤ b) (hbC : C * b ≤ 1) |
| 99 | (hN : ContinuousOn (Function.uncurry N) (univ ×ˢ Icc 0 b)) |
| 100 | (hnonneg : ∀ q t, t ∈ Icc 0 b → 0 ≤ N q t) |
| 101 | (hderiv : ∀ q t, t ∈ Ioc 0 b → |
| 102 | HasDerivWithinAt (fun s => N q s ^ 2) (D q t) (Icc 0 b) t) |
| 103 | (hmax : ∀ q t, t ∈ Ioc 0 b → |
| 104 | (∀ p, N p t ≤ N q t) → D q t ≤ C * N q t ^ 3) |
| 105 | (hinit : ∀ q, N q 0 ≤ 1) : |
| 106 | ∀ q t, t ∈ Icc 0 b → N q t ≤ 2 := by |
| 107 | intro q t ht |
| 108 | have h := norm_le_reciprocal_of_sq_deriv_le_cube_at_max hC hb |
| 109 | (lt_of_le_of_lt hbC (by norm_num)) hN hnonneg hderiv hmax hinit q t ht |
| 110 | have hden : 1 / 2 ≤ 1 - C * t / 2 := by |
| 111 | nlinarith [mul_le_mul_of_nonneg_left ht.2 hC.le] |
| 112 | apply h.trans |
| 113 | rw [inv_eq_one_div, div_le_iff₀ (by linarith : 0 < 1 - C * t / 2)] |
| 114 | linarith |
| 115 | |
| 116 | end Poincare.Parabolic |