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.Algebra.Order.BigOperators.Ring.Finset |
| 2 | import Mathlib.Algebra.BigOperators.Fin |
| 3 | import Mathlib.Data.Fintype.BigOperators |
| 4 | import Mathlib.Analysis.SpecialFunctions.Pow.Real |
| 5 | import Mathlib.Tactic |
| 6 | |
| 7 | /-! |
| 8 | # Dimension-independent finite tensor contraction bounds |
| 9 | |
| 10 | Morgan--Tian equation (3.5), p. 41, and Proposition 4.11, pp. 67-68. |
| 11 | Finite Cauchy--Schwarz bounds a matrix contraction in the full squared |
| 12 | component norm, without a factor depending on the number of indices. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open scoped BigOperators |
| 18 | |
| 19 | /-- Enumerate a four-index tensor by its four entries. Used in the full |
| 20 | curvature norm in equation (3.5), Morgan--Tian p. 41. -/ |
| 21 | theorem Fintype.sum_fun_fin_four {I V : Type*} [Fintype I] [AddCommMonoid V] |
| 22 | (f : (Fin 4 → I) → V) : |
| 23 | ∑ a, f a = ∑ i, ∑ j, ∑ k, ∑ l, f ![i, j, k, l] := by |
| 24 | classical |
| 25 | let e : (I × I × I × I) ≃ (Fin 4 → I) := |
| 26 | { toFun := fun a => ![a.1, a.2.1, a.2.2.1, a.2.2.2] |
| 27 | invFun := fun a => (a 0, a 1, a 2, a 3) |
| 28 | left_inv := fun _ => rfl |
| 29 | right_inv := fun a => by funext i; fin_cases i <;> rfl } |
| 30 | rw [← e.sum_comp f] |
| 31 | simp only [Fintype.sum_prod_type] |
| 32 | rfl |
| 33 | |
| 34 | namespace PoincareMT.M45 |
| 35 | |
| 36 | /-- The squared full norm of a contraction is bounded by the product |
| 37 | of the squared full norms. Equation (3.5) and Proposition 4.11, pp. 41, 67-68. -/ |
| 38 | theorem sum_sq_contraction_le {I J K : Type*} [Fintype I] [Fintype J] [Fintype K] |
| 39 | (A : I → K → ℝ) (B : J → K → ℝ) : |
| 40 | (∑ i, ∑ j, (∑ k, A i k * B j k) ^ 2) ≤ |
| 41 | (∑ i, ∑ k, A i k ^ 2) * (∑ j, ∑ k, B j k ^ 2) := by |
| 42 | calc |
| 43 | _ ≤ ∑ i, ∑ j, (∑ k, A i k ^ 2) * (∑ k, B j k ^ 2) := by |
| 44 | apply Finset.sum_le_sum |
| 45 | intro i _ |
| 46 | apply Finset.sum_le_sum |
| 47 | intro j _ |
| 48 | exact Finset.sum_mul_sq_le_sq_mul_sq Finset.univ (A i) (B j) |
| 49 | _ = _ := by |
| 50 | simp_rw [← Finset.mul_sum] |
| 51 | rw [← Finset.sum_mul] |
| 52 | |
| 53 | /-- Pairing a tensor of norm N with one of norm at most N squared |
| 54 | costs at most N cubed. Proposition 4.11, pp. 67-68. -/ |
| 55 | theorem abs_sum_mul_le_cube {I : Type*} [Fintype I] |
| 56 | (R B : I → ℝ) {N : ℝ} (hN : 0 ≤ N) |
| 57 | (hR : ∑ i, R i ^ 2 = N ^ 2) (hB : ∑ i, B i ^ 2 ≤ N ^ 4) : |
| 58 | |∑ i, R i * B i| ≤ N ^ 3 := by |
| 59 | have hCS := Finset.sum_mul_sq_le_sq_mul_sq Finset.univ R B |
| 60 | rw [hR] at hCS |
| 61 | have hbound := hCS.trans (mul_le_mul_of_nonneg_left hB (sq_nonneg N)) |
| 62 | have hsq : |∑ i, R i * B i| ^ 2 ≤ (N ^ 3) ^ 2 := by |
| 63 | rw [sq_abs] |
| 64 | nlinarith only [hbound] |
| 65 | nlinarith only [hsq, abs_nonneg (∑ i, R i * B i), pow_nonneg hN 3] |
| 66 | |
| 67 | /-- The four signed quadratic curvature contractions give coefficient |
| 68 | 16 in the squared-energy inequality. Proposition 4.11, pp. 67-68. -/ |
| 69 | theorem four_contraction_energy_le {I : Type*} [Fintype I] |
| 70 | (R B₁ B₂ B₃ B₄ : I → ℝ) {N : ℝ} (hN : 0 ≤ N) |
| 71 | (hR : ∑ i, R i ^ 2 = N ^ 2) |
| 72 | (h₁ : ∑ i, B₁ i ^ 2 ≤ N ^ 4) (h₂ : ∑ i, B₂ i ^ 2 ≤ N ^ 4) |
| 73 | (h₃ : ∑ i, B₃ i ^ 2 ≤ N ^ 4) (h₄ : ∑ i, B₄ i ^ 2 ≤ N ^ 4) : |
| 74 | 4 * (∑ i, R i * (B₁ i - B₂ i - B₃ i + B₄ i)) ≤ 16 * N ^ 3 := by |
| 75 | have h1 := abs_le.mp (abs_sum_mul_le_cube R B₁ hN hR h₁) |
| 76 | have h2 := abs_le.mp (abs_sum_mul_le_cube R B₂ hN hR h₂) |
| 77 | have h3 := abs_le.mp (abs_sum_mul_le_cube R B₃ hN hR h₃) |
| 78 | have h4 := abs_le.mp (abs_sum_mul_le_cube R B₄ hN hR h₄) |
| 79 | simp only [mul_add, mul_sub, Finset.sum_add_distrib, Finset.sum_sub_distrib] |
| 80 | linarith |
| 81 | |
| 82 | /-- The curvature B contraction is a product of two flattened copies |
| 83 | of the same tensor. Its squared full norm is at most the fourth power |
| 84 | of the curvature norm. Equation (3.5), p. 41. -/ |
| 85 | theorem curvature_contraction_sq_le {I : Type*} [Fintype I] |
| 86 | (R : I → I → I → I → ℝ) : |
| 87 | (∑ i, ∑ j, ∑ k, ∑ l, (∑ p, ∑ q, R i p j q * R k p l q) ^ 2) ≤ |
| 88 | (∑ i, ∑ j, ∑ k, ∑ l, R i j k l ^ 2) ^ 2 := by |
| 89 | have h := sum_sq_contraction_le |
| 90 | (fun (i p : I × I) => R i.1 p.1 i.2 p.2) |
| 91 | (fun (i p : I × I) => R i.1 p.1 i.2 p.2) |
| 92 | simp only [Fintype.sum_prod_type] at h |
| 93 | have heq : (∑ i, ∑ j, ∑ p, ∑ q, R i p j q ^ 2) = |
| 94 | ∑ i, ∑ j, ∑ k, ∑ l, R i j k l ^ 2 := by |
| 95 | apply Finset.sum_congr rfl |
| 96 | intro i _ |
| 97 | rw [Finset.sum_comm] |
| 98 | rw [heq] at h |
| 99 | simpa only [pow_two] using h |
| 100 | |
| 101 | end PoincareMT.M45 |