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 |
| 2 | |
| 3 | /-! |
| 4 | # Curvature matrices in dimension three |
| 5 | |
| 6 | The cyclic pairs `(1, 2)`, `(2, 0)`, `(0, 1)` identify a curvature tensor in an |
| 7 | orthonormal three-frame with a three-by-three matrix. Pair interchange gives |
| 8 | matrix symmetry. Skew symmetry in the two pairs gives the factors two and four |
| 9 | in the scalar and full squared-norm contractions. |
| 10 | |
| 11 | These are the coordinate calculations used in the three-dimensional spectral |
| 12 | identities of Morgan--Tian, Theorem 4.8, p. 66, and Corollary 4.33, p. 80 |
| 13 | (`MT2007` in `references/bibliography.bib`). |
| 14 | -/ |
| 15 | |
| 16 | open scoped BigOperators |
| 17 | |
| 18 | namespace Poincare.Geometry.Curvature.Operator |
| 19 | |
| 20 | /-- First index of the cyclic oriented coordinate two-planes. -/ |
| 21 | def pairFirst : Fin 3 → Fin 3 := ![1, 2, 0] |
| 22 | |
| 23 | /-- Second index of the cyclic oriented coordinate two-planes. -/ |
| 24 | def pairSecond : Fin 3 → Fin 3 := ![2, 0, 1] |
| 25 | |
| 26 | /-- Curvature tensor evaluated on the cyclic oriented coordinate two-planes. -/ |
| 27 | def curvatureMatrix (R : Fin 3 → Fin 3 → Fin 3 → Fin 3 → ℝ) : |
| 28 | Matrix (Fin 3) (Fin 3) ℝ := |
| 29 | fun i j => R (pairFirst i) (pairSecond i) (pairFirst j) (pairSecond j) |
| 30 | |
| 31 | /-- The two-form space is represented by the cyclic oriented coordinate planes. |
| 32 | The matrix is converted through Mathlib's Euclidean linear-map API so that |
| 33 | the resulting operator can be consumed by the finite spectral bridge. -/ |
| 34 | noncomputable def curvatureOperator (R : Fin 3 → Fin 3 → Fin 3 → Fin 3 → ℝ) : |
| 35 | EuclideanSpace ℝ (Fin 3) →ₗ[ℝ] EuclideanSpace ℝ (Fin 3) := |
| 36 | (curvatureMatrix R).toEuclideanLin |
| 37 | |
| 38 | /-- Interchanging the two curvature pairs makes the curvature matrix symmetric. -/ |
| 39 | theorem curvatureMatrix_isSymm |
| 40 | (R : Fin 3 → Fin 3 → Fin 3 → Fin 3 → ℝ) |
| 41 | (hpair : ∀ i j k l, R i j k l = R k l i j) : |
| 42 | (curvatureMatrix R).IsSymm := by |
| 43 | ext i j |
| 44 | exact hpair _ _ _ _ |
| 45 | |
| 46 | /-- Pair interchange makes the induced two-form curvature operator symmetric. -/ |
| 47 | theorem curvatureOperator_isSymmetric |
| 48 | (R : Fin 3 → Fin 3 → Fin 3 → Fin 3 → ℝ) |
| 49 | (hpair : ∀ i j k l, R i j k l = R k l i j) : |
| 50 | (curvatureOperator R).IsSymmetric := by |
| 51 | exact Matrix.isSymmetric_toEuclideanLin_iff.mpr |
| 52 | (Matrix.isHermitian_iff_isSymm.mpr (curvatureMatrix_isSymm R hpair)) |
| 53 | |
| 54 | /-- The operator's Rayleigh value is the matrix quadratic form. -/ |
| 55 | theorem curvatureOperator_rayleigh |
| 56 | (R : Fin 3 → Fin 3 → Fin 3 → Fin 3 → ℝ) (v : EuclideanSpace ℝ (Fin 3)) : |
| 57 | inner ℝ v (curvatureOperator R v) = |
| 58 | dotProduct v ((curvatureMatrix R).mulVec v) := by |
| 59 | simp [curvatureOperator, Matrix.toLpLin_apply, EuclideanSpace.inner_eq_star_dotProduct] |
| 60 | exact dotProduct_comm _ _ |
| 61 | |
| 62 | private theorem skew_sum_sq (f : Fin 3 → Fin 3 → ℝ) |
| 63 | (hskew : ∀ i j, f i j = -f j i) : |
| 64 | (∑ i, ∑ j, f i j ^ 2) = 2 * ∑ a, f (pairFirst a) (pairSecond a) ^ 2 := by |
| 65 | have hdiag (i) : f i i = 0 := by linarith [hskew i i] |
| 66 | simp [Fin.sum_univ_succ, pairFirst, pairSecond, hdiag] |
| 67 | rw [hskew 1 0, hskew 0 2, hskew 2 1] |
| 68 | ring |
| 69 | |
| 70 | /-- The scalar contraction counts each unoriented coordinate two-plane twice. -/ |
| 71 | theorem scalar_contraction_eq_twice_trace |
| 72 | (R : Fin 3 → Fin 3 → Fin 3 → Fin 3 → ℝ) |
| 73 | (hfirst : ∀ i j k l, R i j k l = -R j i k l) |
| 74 | (hlast : ∀ i j k l, R i j k l = -R i j l k) : |
| 75 | (∑ i, ∑ j, R i j i j) = 2 * Matrix.trace (curvatureMatrix R) := by |
| 76 | have hdiag (i) : R i i i i = 0 := by linarith [hfirst i i i i] |
| 77 | have hswap (i j) : R i j i j = R j i j i := by |
| 78 | rw [hfirst i j i j, hlast j i i j, neg_neg] |
| 79 | simp [Matrix.trace, curvatureMatrix, Fin.sum_univ_succ, pairFirst, pairSecond, hdiag] |
| 80 | rw [hswap 1 0, hswap 0 2, hswap 2 1] |
| 81 | ring |
| 82 | |
| 83 | /-- The full four-index squared norm counts each curvature-matrix entry four times. -/ |
| 84 | theorem norm_contraction_eq_four_frobeniusSq |
| 85 | (R : Fin 3 → Fin 3 → Fin 3 → Fin 3 → ℝ) |
| 86 | (hfirst : ∀ i j k l, R i j k l = -R j i k l) |
| 87 | (hlast : ∀ i j k l, R i j k l = -R i j l k) : |
| 88 | (∑ i, ∑ j, ∑ k, ∑ l, R i j k l ^ 2) = |
| 89 | 4 * ∑ i, ∑ j, curvatureMatrix R i j ^ 2 := by |
| 90 | have hlastsum (i j) := skew_sum_sq (fun k l => R i j k l) (hlast i j) |
| 91 | have hfirstsum (a) := skew_sum_sq |
| 92 | (fun i j => R i j (pairFirst a) (pairSecond a)) |
| 93 | (fun i j => hfirst i j (pairFirst a) (pairSecond a)) |
| 94 | calc |
| 95 | (∑ i, ∑ j, ∑ k, ∑ l, R i j k l ^ 2) = |
| 96 | 2 * ∑ a, ∑ i, ∑ j, R i j (pairFirst a) (pairSecond a) ^ 2 := by |
| 97 | simp_rw [hlastsum] |
| 98 | simp only [Fin.sum_univ_succ, Fin.sum_univ_zero] |
| 99 | ring |
| 100 | _ = 4 * ∑ i, ∑ j, curvatureMatrix R i j ^ 2 := by |
| 101 | simp_rw [hfirstsum] |
| 102 | simp only [curvatureMatrix, Fin.sum_univ_succ, Fin.sum_univ_zero] |
| 103 | ring |
| 104 | |
| 105 | /-- The Euclidean linear operator associated to a matrix has the same trace. -/ |
| 106 | theorem matrix_trace_toEuclideanLin (A : Matrix (Fin 3) (Fin 3) ℝ) : |
| 107 | LinearMap.trace ℝ (EuclideanSpace ℝ (Fin 3)) A.toEuclideanLin = A.trace := by |
| 108 | rw [Matrix.toEuclideanLin_eq_toLin_orthonormal, Matrix.trace_toLin_eq] |
| 109 | |
| 110 | /-- For a symmetric matrix the Frobenius square equals its energy in every |
| 111 | orthonormal basis, in particular its ordered eigenvector basis. -/ |
| 112 | theorem matrix_frobeniusSq_eq_basis_energy |
| 113 | (A : Matrix (Fin 3) (Fin 3) ℝ) (hA : A.IsSymm) |
| 114 | (b : OrthonormalBasis (Fin 3) ℝ (EuclideanSpace ℝ (Fin 3))) : |
| 115 | (∑ i, ∑ j, A i j ^ 2) = ∑ i, ‖A.toEuclideanLin (b i)‖ ^ 2 := by |
| 116 | have hsym : A.toEuclideanLin.IsSymmetric := |
| 117 | Matrix.isSymmetric_toEuclideanLin_iff.mpr (Matrix.isHermitian_iff_isSymm.mpr hA) |
| 118 | have henergy (c : OrthonormalBasis (Fin 3) ℝ (EuclideanSpace ℝ (Fin 3))) : |
| 119 | LinearMap.trace ℝ (EuclideanSpace ℝ (Fin 3)) |
| 120 | (A.toEuclideanLin * A.toEuclideanLin) = |
| 121 | ∑ i, ‖A.toEuclideanLin (c i)‖ ^ 2 := by |
| 122 | rw [LinearMap.trace_eq_sum_inner _ c] |
| 123 | apply Finset.sum_congr rfl |
| 124 | intro i _ |
| 125 | rw [Module.End.mul_apply, ← hsym] |
| 126 | exact real_inner_self_eq_norm_sq _ |
| 127 | rw [← henergy b, henergy (EuclideanSpace.basisFun (Fin 3) ℝ)] |
| 128 | simp [EuclideanSpace.norm_sq_eq, Matrix.toLpLin_apply, |
| 129 | EuclideanSpace.basisFun_apply, Matrix.mulVec_single, Matrix.col] |
| 130 | exact Finset.sum_comm |
| 131 | |
| 132 | /-- The operator trace is the cyclic curvature-matrix trace. -/ |
| 133 | theorem curvatureOperator_trace |
| 134 | (R : Fin 3 → Fin 3 → Fin 3 → Fin 3 → ℝ) : |
| 135 | LinearMap.trace ℝ (EuclideanSpace ℝ (Fin 3)) (curvatureOperator R) = |
| 136 | Matrix.trace (curvatureMatrix R) := by |
| 137 | exact matrix_trace_toEuclideanLin (curvatureMatrix R) |
| 138 | |
| 139 | /-- The sum of squared operator values on an orthonormal basis equals the |
| 140 | matrix Frobenius square. -/ |
| 141 | theorem curvatureOperator_energy |
| 142 | (R : Fin 3 → Fin 3 → Fin 3 → Fin 3 → ℝ) |
| 143 | (hpair : ∀ i j k l, R i j k l = R k l i j) |
| 144 | (b : OrthonormalBasis (Fin 3) ℝ (EuclideanSpace ℝ (Fin 3))) : |
| 145 | (∑ i, ‖curvatureOperator R (b i)‖ ^ 2) = |
| 146 | ∑ i, ∑ j, (curvatureMatrix R i j) ^ 2 := by |
| 147 | symm |
| 148 | exact matrix_frobeniusSq_eq_basis_energy (curvatureMatrix R) |
| 149 | (curvatureMatrix_isSymm R hpair) b |
| 150 | |
| 151 | /-- The scalar contraction is twice the trace of the two-form operator. -/ |
| 152 | theorem curvatureOperator_scalar_identity |
| 153 | (R : Fin 3 → Fin 3 → Fin 3 → Fin 3 → ℝ) |
| 154 | (hfirst : ∀ i j k l, R i j k l = -R j i k l) |
| 155 | (hlast : ∀ i j k l, R i j k l = -R i j l k) : |
| 156 | (∑ i, ∑ j, R i j i j) = |
| 157 | 2 * LinearMap.trace ℝ (EuclideanSpace ℝ (Fin 3)) (curvatureOperator R) := by |
| 158 | rw [scalar_contraction_eq_twice_trace R hfirst hlast, curvatureOperator_trace] |
| 159 | |
| 160 | /-- The squared full curvature contraction is four times the operator energy |
| 161 | in any orthonormal basis. -/ |
| 162 | theorem curvatureOperator_normSq_identity |
| 163 | (R : Fin 3 → Fin 3 → Fin 3 → Fin 3 → ℝ) |
| 164 | (hfirst : ∀ i j k l, R i j k l = -R j i k l) |
| 165 | (hlast : ∀ i j k l, R i j k l = -R i j l k) |
| 166 | (hpair : ∀ i j k l, R i j k l = R k l i j) |
| 167 | (b : OrthonormalBasis (Fin 3) ℝ (EuclideanSpace ℝ (Fin 3))) : |
| 168 | (∑ i, ∑ j, ∑ k, ∑ l, R i j k l ^ 2) = |
| 169 | 4 * ∑ i, ‖curvatureOperator R (b i)‖ ^ 2 := by |
| 170 | rw [norm_contraction_eq_four_frobeniusSq R hfirst hlast, |
| 171 | curvatureOperator_energy R hpair b] |
| 172 | |
| 173 | end Poincare.Geometry.Curvature.Operator |