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.Analysis.SpecialFunctions.Sqrt |
| 2 | import Mathlib.Algebra.Order.BigOperators.Ring.Finset |
| 3 | import Mathlib.Tactic.FieldSimp |
| 4 | import Mathlib.Tactic.Positivity |
| 5 | import Mathlib.Tactic.Ring |
| 6 | |
| 7 | /-! |
| 8 | # Weighted finite Cauchy-Schwarz for a bilinear pairing |
| 9 | |
| 10 | Positive diagonal Gram weights turn the finite matrix squared norm into |
| 11 | a bound for evaluation on arbitrary vectors. This is the C0 metric |
| 12 | comparison in Morgan-Tian Proposition 9.79(3), p. 234; |
| 13 | neck-metric-comparison.md. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open scoped BigOperators |
| 19 | |
| 20 | /-- Finite matrix pairing is bounded by its weighted squared norm and |
| 21 | the two positive diagonal quadratic forms (Proposition 9.79, p. 234). |
| 22 | The finite index types may be empty. -/ |
| 23 | theorem weighted_matrix_pairing_sq_le |
| 24 | {ι κ : Type*} [Fintype ι] [Fintype κ] |
| 25 | (d : ι → ℝ) (e : κ → ℝ) (hd : ∀ i, 0 < d i) (he : ∀ j, 0 < e j) |
| 26 | (A : ι → κ → ℝ) (v : ι → ℝ) (w : κ → ℝ) : |
| 27 | (∑ i, ∑ j, A i j * v i * w j) ^ 2 ≤ |
| 28 | (∑ i, ∑ j, (d i)⁻¹ * (e j)⁻¹ * A i j ^ 2) * |
| 29 | (∑ i, d i * v i ^ 2) * (∑ j, e j * w j ^ 2) := by |
| 30 | classical |
| 31 | let f (p : ι × κ) := A p.1 p.2 / Real.sqrt (d p.1 * e p.2) |
| 32 | let g (p : ι × κ) := Real.sqrt (d p.1 * e p.2) * v p.1 * w p.2 |
| 33 | have hpair (i : ι) (j : κ) : f (i, j) * g (i, j) = A i j * v i * w j := by |
| 34 | dsimp [f, g] |
| 35 | have hs : Real.sqrt (d i * e j) ≠ 0 := ne_of_gt (Real.sqrt_pos.mpr (mul_pos (hd i) (he j))) |
| 36 | field_simp |
| 37 | have hf (i : ι) (j : κ) : f (i, j) ^ 2 = (d i)⁻¹ * (e j)⁻¹ * A i j ^ 2 := by |
| 38 | dsimp [f] |
| 39 | rw [div_pow, Real.sq_sqrt (mul_pos (hd i) (he j)).le] |
| 40 | field_simp |
| 41 | have hg (i : ι) (j : κ) : g (i, j) ^ 2 = (d i * v i ^ 2) * (e j * w j ^ 2) := by |
| 42 | dsimp [g] |
| 43 | rw [mul_pow, mul_pow, Real.sq_sqrt (mul_pos (hd i) (he j)).le] |
| 44 | ring |
| 45 | have h := Finset.sum_mul_sq_le_sq_mul_sq Finset.univ f g |
| 46 | simp only [Fintype.sum_prod_type, hpair, hf, hg] at h |
| 47 | rw [← Finset.sum_mul_sum] at h |
| 48 | simpa only [mul_assoc] using h |
| 49 | |
| 50 | /-- A weighted matrix squared bound controls its quadratic evaluation |
| 51 | with the same error constant (Proposition 9.79, p. 234). -/ |
| 52 | theorem abs_matrix_quadratic_le_of_weighted_sq |
| 53 | {ι : Type*} [Fintype ι] (d : ι → ℝ) (hd : ∀ i, 0 < d i) |
| 54 | (A : ι → ι → ℝ) (v : ι → ℝ) {epsilon : ℝ} (hepsilon : 0 ≤ epsilon) |
| 55 | (hA : (∑ i, ∑ j, (d i)⁻¹ * (d j)⁻¹ * A i j ^ 2) ≤ epsilon ^ 2) : |
| 56 | |∑ i, ∑ j, A i j * v i * v j| ≤ epsilon * ∑ i, d i * v i ^ 2 := by |
| 57 | have hQ : 0 ≤ ∑ i, d i * v i ^ 2 := |
| 58 | Finset.sum_nonneg fun i _ => mul_nonneg (hd i).le (sq_nonneg _) |
| 59 | apply (sq_le_sq₀ (abs_nonneg _) (mul_nonneg hepsilon hQ)).mp |
| 60 | rw [sq_abs] |
| 61 | calc |
| 62 | _ ≤ (∑ i, ∑ j, (d i)⁻¹ * (d j)⁻¹ * A i j ^ 2) * |
| 63 | (∑ i, d i * v i ^ 2) ^ 2 := by |
| 64 | simpa only [pow_two, mul_assoc] using weighted_matrix_pairing_sq_le d d hd hd A v v |
| 65 | _ ≤ epsilon ^ 2 * (∑ i, d i * v i ^ 2) ^ 2 := |
| 66 | mul_le_mul_of_nonneg_right hA (sq_nonneg _) |
| 67 | _ = (epsilon * ∑ i, d i * v i ^ 2) ^ 2 := by ring |