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.LinearAlgebra.Multilinear.Curry |
| 2 | import Mathlib.Analysis.Normed.Module.RCLike.Basic |
| 3 | import Mathlib.Analysis.InnerProductSpace.Basic |
| 4 | |
| 5 | /-! |
| 6 | # Orthonormal tests for alternating four-linear forms |
| 7 | |
| 8 | Gram-Schmidt reduces a repeated-pair evaluation of an alternating |
| 9 | four-linear form to an orthonormal pair with a nonnegative scale factor. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | namespace MultilinearMap |
| 15 | |
| 16 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 17 | |
| 18 | /-- The repeated-pair evaluation scales by the square of the planar determinant. -/ |
| 19 | theorem sectional_scale |
| 20 | (A : MultilinearMap ℝ (fun _ : Fin 4 => E) ℝ) |
| 21 | (hfirst : ∀ a b c d, A ![a, b, c, d] = -A ![b, a, c, d]) |
| 22 | (hlast : ∀ a b c d, A ![a, b, c, d] = -A ![a, b, d, c]) |
| 23 | (p q : E) (r d s : ℝ) : |
| 24 | A ![r • p, d • p + s • q, r • p, d • p + s • q] = |
| 25 | r ^ 2 * s ^ 2 * A ![p, q, p, q] := by |
| 26 | have hs0 (a b c f : E) (z : ℝ) : |
| 27 | A ![z • a, b, c, f] = z * A ![a, b, c, f] := by |
| 28 | simpa only [Matrix.vecCons, smul_eq_mul] using A.cons_smul ![b, c, f] z a |
| 29 | have hs1 (a b c f : E) (z : ℝ) : |
| 30 | A ![a, z • b, c, f] = z * A ![a, b, c, f] := by |
| 31 | simpa only [MultilinearMap.curryLeft_apply, Matrix.vecCons, smul_eq_mul] using |
| 32 | (A.curryLeft a).cons_smul ![c, f] z b |
| 33 | have hs2 (a b c f : E) (z : ℝ) : |
| 34 | A ![a, b, z • c, f] = z * A ![a, b, c, f] := by |
| 35 | simpa only [MultilinearMap.curryLeft_apply, Matrix.vecCons, smul_eq_mul] using |
| 36 | ((A.curryLeft a).curryLeft b).cons_smul ![f] z c |
| 37 | have hs3 (a b c f : E) (z : ℝ) : |
| 38 | A ![a, b, c, z • f] = z * A ![a, b, c, f] := by |
| 39 | simpa only [MultilinearMap.curryLeft_apply, Matrix.vecCons, smul_eq_mul] using |
| 40 | (((A.curryLeft a).curryLeft b).curryLeft c).cons_smul ![] z f |
| 41 | have ha1 (a b c f z : E) : |
| 42 | A ![a, b + c, f, z] = A ![a, b, f, z] + A ![a, c, f, z] := by |
| 43 | simpa only [MultilinearMap.curryLeft_apply, Matrix.vecCons] using |
| 44 | (A.curryLeft a).cons_add ![f, z] b c |
| 45 | have ha3 (a b c f z : E) : |
| 46 | A ![a, b, c, f + z] = A ![a, b, c, f] + A ![a, b, c, z] := by |
| 47 | simpa only [MultilinearMap.curryLeft_apply, Matrix.vecCons] using |
| 48 | (((A.curryLeft a).curryLeft b).curryLeft c).cons_add ![] f z |
| 49 | have hf (a b c : E) : A ![a, a, b, c] = 0 := by |
| 50 | linarith only [hfirst a a b c] |
| 51 | have hl (a b c : E) : A ![a, b, c, c] = 0 := by |
| 52 | linarith only [hlast a b c c] |
| 53 | simp only [hs0, hs2, ha1, ha3, hs1, hs3, hf, hl] |
| 54 | ring |
| 55 | |
| 56 | /-- Nonnegativity on orthonormal pairs implies nonnegativity on every pair. -/ |
| 57 | theorem sectional_nonneg_of_orthonormal |
| 58 | (A : MultilinearMap ℝ (fun _ : Fin 4 => E) ℝ) |
| 59 | (hfirst : ∀ a b c d, A ![a, b, c, d] = -A ![b, a, c, d]) |
| 60 | (hlast : ∀ a b c d, A ![a, b, c, d] = -A ![a, b, d, c]) |
| 61 | (hunit : ∀ p q : E, ‖p‖ = 1 → ‖q‖ = 1 → inner ℝ p q = 0 → |
| 62 | 0 ≤ A ![p, q, p, q]) (u v : E) : 0 ≤ A ![u, v, u, v] := by |
| 63 | by_cases hu : u = 0 |
| 64 | · subst u |
| 65 | rw [A.map_coord_zero (0 : Fin 4) rfl] |
| 66 | let r := ‖u‖ |
| 67 | let p := r⁻¹ • u |
| 68 | have hp : ‖p‖ = 1 := norm_smul_inv_norm (𝕜 := ℝ) hu |
| 69 | have hup : u = r • p := by |
| 70 | simp [p, r, smul_smul, mul_inv_cancel₀ (norm_ne_zero_iff.mpr hu)] |
| 71 | let d := inner ℝ p v |
| 72 | let w := v - d • p |
| 73 | have hvw : v = d • p + w := by dsimp only [w]; abel |
| 74 | have hpw : inner ℝ p w = 0 := by |
| 75 | simp [w, d, inner_sub_right, inner_smul_right, hp] |
| 76 | by_cases hw : w = 0 |
| 77 | · have hv0 : v = d • p + (0 : ℝ) • (0 : E) := by simpa [hw] using hvw |
| 78 | rw [congrArg₂ (fun a b => A ![a, b, a, b]) hup hv0, |
| 79 | sectional_scale A hfirst hlast p 0 r d 0] |
| 80 | simp |
| 81 | let s := ‖w‖ |
| 82 | let q := s⁻¹ • w |
| 83 | have hq : ‖q‖ = 1 := norm_smul_inv_norm (𝕜 := ℝ) hw |
| 84 | have hpq : inner ℝ p q = 0 := by simp [q, inner_smul_right, hpw] |
| 85 | have hwq : w = s • q := by |
| 86 | simp [q, s, smul_smul, mul_inv_cancel₀ (norm_ne_zero_iff.mpr hw)] |
| 87 | have hvq : v = d • p + s • q := by rw [← hwq]; exact hvw |
| 88 | rw [congrArg₂ (fun a b => A ![a, b, a, b]) hup hvq, |
| 89 | sectional_scale A hfirst hlast p q r d s] |
| 90 | exact mul_nonneg (mul_nonneg (sq_nonneg r) (sq_nonneg s)) (hunit p q hp hq hpq) |
| 91 | |
| 92 | end MultilinearMap |