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.Geometry.RicciFlow.Surgery.StandardCap.Existence.Analysis.Energy.FiniteNeighborEnergy |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Existence.Analysis.Energy.InteriorGronwall |
| 3 | import Mathlib.Analysis.SpecificLimits.Basic |
| 4 | |
| 5 | /-! |
| 6 | # Vanishing of uniformly bounded neighboring energies |
| 7 | |
| 8 | Finite weighted prefixes satisfy scalar Gronwall with an error tending |
| 9 | to zero. Each fixed positive summand is bounded by every sufficiently |
| 10 | long prefix, hence vanishes. Only value bounds and interior derivatives |
| 11 | are needed; no infinite sum is differentiated. This is Morgan-Tian |
| 12 | Section 12.5, pp. 309-319 and finite-neighbor-energy-closure.md. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set Filter |
| 18 | open scoped Topology BigOperators |
| 19 | |
| 20 | /-- Uniformly bounded nonnegative neighboring energies with zero initial |
| 21 | values vanish on the whole closed interval. No absolute derivative |
| 22 | majorant or endpoint derivative is required (Section 12.5, pp. 309-319). -/ |
| 23 | theorem eq_zero_of_uniformly_bounded_neighbor_energy_rates |
| 24 | {E : ℕ → ℝ → ℝ} {a b C M : ℝ} (hC : 0 ≤ C) |
| 25 | (hc : ∀ i, ContinuousOn (E i) (Icc a b)) |
| 26 | (hd : ∀ i t, t ∈ Ioo a b → DifferentiableAt ℝ (E i) t) |
| 27 | (hzero : ∀ i, E i a = 0) |
| 28 | (hn : ∀ i t, t ∈ Icc a b → 0 ≤ E i t) |
| 29 | (hb : ∀ i t, t ∈ Icc a b → E i t ≤ M) |
| 30 | (hr0 : ∀ t ∈ Ioo a b, deriv (E 0) t ≤ C * (E 0 t + E 1 t + E 2 t)) |
| 31 | (hr1 : ∀ t ∈ Ioo a b, deriv (E 1) t ≤ C * (E 0 t + E 1 t + E 2 t)) |
| 32 | (hrn : ∀ n t, t ∈ Ioo a b → |
| 33 | deriv (E (n + 2)) t ≤ C * (E (n + 1) t + E (n + 2) t + E (n + 3) t)) : |
| 34 | ∀ i, EqOn (E i) (fun _ => 0) (Icc a b) := by |
| 35 | let F : ℕ → ℝ → ℝ := fun k t => |
| 36 | ∑ i ∈ Finset.range (k + 3), (1 / 2 : ℝ) ^ i * E i t |
| 37 | have hFc (k) : ContinuousOn (F k) (Icc a b) := |
| 38 | continuousOn_finsetSum _ (fun i _ => continuousOn_const.mul (hc i)) |
| 39 | have hFd (k) (t : ℝ) (ht : t ∈ Ioo a b) : |
| 40 | HasDerivAt (F k) (∑ i ∈ Finset.range (k + 3), (1 / 2 : ℝ) ^ i * deriv (E i) t) t := |
| 41 | HasDerivAt.fun_sum (fun i _ => (hd i t ht).hasDerivAt.const_mul ((1 / 2 : ℝ) ^ i)) |
| 42 | have hF0 (k) : F k a = 0 := by simp only [F, hzero, mul_zero, Finset.sum_const_zero] |
| 43 | have hFr (k) (t : ℝ) (ht : t ∈ Ioo a b) : |
| 44 | deriv (F k) t ≤ 8 * C * F k t + 2 * C * M * (1 / 2 : ℝ) ^ (k + 3) := by |
| 45 | rw [(hFd k t ht).deriv] |
| 46 | have ht' : t ∈ Icc a b := ⟨ht.1.le, ht.2.le⟩ |
| 47 | calc |
| 48 | _ ≤ 8 * C * F k t + 2 * C * ((1 / 2 : ℝ) ^ (k + 3) * E (k + 3) t) := |
| 49 | geometric_weighted_neighbor_sum_range_le (fun i => hn i t ht') hC |
| 50 | (hr0 t ht) (hr1 t ht) (fun n => hrn n t ht) k |
| 51 | _ ≤ 8 * C * F k t + 2 * C * ((1 / 2 : ℝ) ^ (k + 3) * M) := |
| 52 | add_le_add le_rfl (mul_le_mul_of_nonneg_left |
| 53 | (mul_le_mul_of_nonneg_left (hb (k + 3) t ht') |
| 54 | (pow_nonneg (show (0 : ℝ) ≤ 1 / 2 by norm_num) (k + 3))) |
| 55 | (show 0 ≤ 2 * C by positivity)) |
| 56 | _ = _ := by ring |
| 57 | have hFg (k) (t : ℝ) (ht : t ∈ Icc a b) : |
| 58 | F k t ≤ gronwallBound 0 (8 * C) (2 * C * M * (1 / 2 : ℝ) ^ (k + 3)) (t - a) := |
| 59 | le_gronwallBound_of_interior_deriv_le (hFc k) |
| 60 | (fun s hs => (hFd k s hs).differentiableAt) (by rw [hF0]) (hFr k) t ht |
| 61 | intro i t ht |
| 62 | have hle (n : ℕ) : (1 / 2 : ℝ) ^ i * E i t ≤ |
| 63 | gronwallBound 0 (8 * C) (2 * C * M * (1 / 2 : ℝ) ^ (n + i + 3)) (t - a) := by |
| 64 | have hs : (1 / 2 : ℝ) ^ i * E i t ≤ F (n + i) t := by |
| 65 | apply Finset.single_le_sum (s := Finset.range (n + i + 3)) |
| 66 | (f := fun j => (1 / 2 : ℝ) ^ j * E j t) |
| 67 | · intro j _ |
| 68 | exact mul_nonneg (pow_nonneg (by norm_num) j) (hn j t ht) |
| 69 | · exact Finset.mem_range.mpr (by omega) |
| 70 | exact hs.trans (hFg (n + i) t ht) |
| 71 | have hp : Tendsto (fun n : ℕ => (1 / 2 : ℝ) ^ n) atTop (𝓝 0) := |
| 72 | tendsto_pow_atTop_nhds_zero_of_lt_one (by norm_num) (by norm_num) |
| 73 | have heps : Tendsto (fun n : ℕ => 2 * C * M * (1 / 2 : ℝ) ^ (n + i + 3)) |
| 74 | atTop (𝓝 0) := by |
| 75 | simpa only [pow_add, mul_zero, zero_mul] using |
| 76 | ((hp.mul_const ((1 / 2 : ℝ) ^ i)).mul_const ((1 / 2 : ℝ) ^ 3)).const_mul (2 * C * M) |
| 77 | have hg : Tendsto (fun n : ℕ => |
| 78 | gronwallBound 0 (8 * C) (2 * C * M * (1 / 2 : ℝ) ^ (n + i + 3)) (t - a)) |
| 79 | atTop (𝓝 0) := by |
| 80 | simpa only [Function.comp_def, gronwallBound_ε0_δ0] using |
| 81 | ((gronwallBound_continuous_ε 0 (8 * C) (t - a)).tendsto 0).comp heps |
| 82 | have hz : (1 / 2 : ℝ) ^ i * E i t ≤ 0 := |
| 83 | le_of_tendsto_of_tendsto' tendsto_const_nhds hg hle |
| 84 | exact le_antisymm (nonpos_of_mul_nonpos_right hz (pow_pos (by norm_num) _)) (hn i t ht) |