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.Topology.Algebra.InfiniteSum.NatInt |
| 2 | import Mathlib.Topology.Algebra.InfiniteSum.Order |
| 3 | import Mathlib.Topology.Algebra.InfiniteSum.Ring |
| 4 | import Mathlib.Topology.Instances.Real.Lemmas |
| 5 | import Mathlib.Tactic.Linarith |
| 6 | import Mathlib.Tactic.NormNum |
| 7 | import Mathlib.Tactic.Ring |
| 8 | |
| 9 | /-! |
| 10 | # Summing neighboring energy rates with two boundary rows |
| 11 | |
| 12 | Summable signed rates are compared with summable nonnegative energies. |
| 13 | The two exceptional boundary rows are accounted for exactly before |
| 14 | bounding the resulting series. Geometric weights then give a uniform |
| 15 | factor eight. This is Morgan-Tian Section 12.5, pp. 309-319 and |
| 16 | weighted-neighbor-summation.md. |
| 17 | -/ |
| 18 | |
| 19 | set_option autoImplicit false |
| 20 | |
| 21 | open scoped BigOperators |
| 22 | |
| 23 | /-- A summable nearest-neighbor system with two exceptional initial rows |
| 24 | has a uniform total bound (Section 12.5, pp. 309-319). -/ |
| 25 | theorem tsum_le_of_boundary_neighbor_bounds {a b : ℕ → ℝ} {C q r : ℝ} |
| 26 | (ha : Summable a) (hb : Summable b) (hn : ∀ i, 0 ≤ a i) (hC : 0 ≤ C) (hr : 0 ≤ r) |
| 27 | (hzero : b 0 ≤ C * (a 0 + r * a 1 + r ^ 2 * a 2)) |
| 28 | (hone : b 1 ≤ C * (q * a 0 + a 1 + r * a 2)) |
| 29 | (htail : ∀ n, b (n + 2) ≤ C * (q * a (n + 1) + a (n + 2) + r * a (n + 3))) : |
| 30 | (∑' i, b i) ≤ C * (q + 1 + r + r ^ 2) * (∑' i, a i) := by |
| 31 | have ha1 : Summable (fun n => a (n + 1)) := (summable_nat_add_iff 1).2 ha |
| 32 | have ha2 : Summable (fun n => a (n + 2)) := (summable_nat_add_iff 2).2 ha |
| 33 | have ha3 : Summable (fun n => a (n + 3)) := (summable_nat_add_iff 3).2 ha |
| 34 | have hb2 : Summable (fun n => b (n + 2)) := (summable_nat_add_iff 2).2 hb |
| 35 | have hs := ((ha1.mul_left q).add ha2).add (ha3.mul_left r) |
| 36 | have ht := Summable.tsum_le_tsum htail hb2 (hs.mul_left C) |
| 37 | rw [hs.tsum_mul_left C, ((ha1.mul_left q).add ha2).tsum_add (ha3.mul_left r), |
| 38 | (ha1.mul_left q).tsum_add ha2, ha1.tsum_mul_left q, ha3.tsum_mul_left r] at ht |
| 39 | let A := ∑' i, a i |
| 40 | have hp1 := ha.sum_add_tsum_nat_add 1 |
| 41 | have hp2 := ha.sum_add_tsum_nat_add 2 |
| 42 | have hp3 := ha.sum_add_tsum_nat_add 3 |
| 43 | have hpb := hb.sum_add_tsum_nat_add 2 |
| 44 | norm_num [Finset.sum_range_succ] at hp1 hp2 hp3 hpb |
| 45 | have he1 : (∑' n, a (n + 1)) = A - a 0 := by dsimp [A]; linarith |
| 46 | have he2 : (∑' n, a (n + 2)) = A - a 0 - a 1 := by dsimp [A]; linarith |
| 47 | have he3 : (∑' n, a (n + 3)) = A - a 0 - a 1 - a 2 := by dsimp [A]; linarith |
| 48 | rw [he1, he2, he3] at ht |
| 49 | have htwo : a 2 ≤ A := ha.le_tsum 2 (fun i _ => hn i) |
| 50 | calc |
| 51 | (∑' i, b i) = b 0 + b 1 + ∑' n, b (n + 2) := hpb.symm |
| 52 | _ ≤ C * (a 0 + r * a 1 + r ^ 2 * a 2) + |
| 53 | C * (q * a 0 + a 1 + r * a 2) + |
| 54 | C * (q * (A - a 0) + (A - a 0 - a 1) + r * (A - a 0 - a 1 - a 2)) := |
| 55 | add_le_add (add_le_add hzero hone) ht |
| 56 | _ = C * ((q + 1 + r) * A - r * a 0 + r ^ 2 * a 2) := by ring |
| 57 | _ ≤ C * ((q + 1 + r) * A + r ^ 2 * A) := by |
| 58 | apply mul_le_mul_of_nonneg_left _ hC |
| 59 | nlinarith [mul_nonneg hr (hn 0), mul_le_mul_of_nonneg_left htwo (sq_nonneg r)] |
| 60 | _ = C * (q + 1 + r + r ^ 2) * A := by ring |
| 61 | |
| 62 | /-- Positive geometric weights sum the actual core/end neighbor rate |
| 63 | bounds with a factor eight (Section 12.5, pp. 309-319). -/ |
| 64 | theorem geometric_weighted_neighbor_sum_le {E R : ℕ → ℝ} {C : ℝ} |
| 65 | (hE : Summable (fun i => (1 / 2 : ℝ) ^ i * E i)) |
| 66 | (hR : Summable (fun i => (1 / 2 : ℝ) ^ i * R i)) |
| 67 | (hn : ∀ i, 0 ≤ E i) (hC : 0 ≤ C) |
| 68 | (hzero : R 0 ≤ C * (E 0 + E 1 + E 2)) |
| 69 | (hone : R 1 ≤ C * (E 0 + E 1 + E 2)) |
| 70 | (htail : ∀ n, R (n + 2) ≤ C * (E (n + 1) + E (n + 2) + E (n + 3))) : |
| 71 | (∑' i, (1 / 2 : ℝ) ^ i * R i) ≤ 8 * C * (∑' i, (1 / 2 : ℝ) ^ i * E i) := by |
| 72 | let a := fun i => (1 / 2 : ℝ) ^ i * E i |
| 73 | let b := fun i => (1 / 2 : ℝ) ^ i * R i |
| 74 | have han : ∀ i, 0 ≤ a i := fun i => mul_nonneg (pow_nonneg (by norm_num) _) (hn i) |
| 75 | have h0 : b 0 ≤ C * (a 0 + 2 * a 1 + 2 ^ 2 * a 2) := by |
| 76 | calc |
| 77 | b 0 = R 0 := by simp [b] |
| 78 | _ ≤ C * (E 0 + E 1 + E 2) := hzero |
| 79 | _ = C * (a 0 + 2 * a 1 + 2 ^ 2 * a 2) := by dsimp [a]; ring |
| 80 | have h1 : b 1 ≤ C * ((1 / 2) * a 0 + a 1 + 2 * a 2) := by |
| 81 | calc |
| 82 | b 1 = (1 / 2) * R 1 := by simp [b] |
| 83 | _ ≤ (1 / 2) * (C * (E 0 + E 1 + E 2)) := |
| 84 | mul_le_mul_of_nonneg_left hone (by norm_num) |
| 85 | _ = C * ((1 / 2) * a 0 + a 1 + 2 * a 2) := by dsimp [a]; ring |
| 86 | have ht (n : ℕ) : b (n + 2) ≤ C * ((1 / 2) * a (n + 1) + a (n + 2) + 2 * a (n + 3)) := by |
| 87 | calc |
| 88 | b (n + 2) ≤ (1 / 2 : ℝ) ^ (n + 2) * |
| 89 | (C * (E (n + 1) + E (n + 2) + E (n + 3))) := |
| 90 | mul_le_mul_of_nonneg_left (htail n) (pow_nonneg (by norm_num) _) |
| 91 | _ = C * ((1 / 2) * a (n + 1) + a (n + 2) + 2 * a (n + 3)) := by |
| 92 | dsimp [a] |
| 93 | simp only [pow_add] |
| 94 | ring |
| 95 | have hsum := tsum_le_of_boundary_neighbor_bounds hE hR han hC (by norm_num) h0 h1 ht |
| 96 | have hnonneg : 0 ≤ C * (∑' i, a i) := mul_nonneg hC (tsum_nonneg han) |
| 97 | change (∑' i, b i) ≤ 8 * C * (∑' i, a i) |
| 98 | change (∑' i, b i) ≤ C * ((1 / 2) + 1 + 2 + 2 ^ 2) * (∑' i, a i) at hsum |
| 99 | nlinarith |