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 | # The three-dimensional curvature reaction |
| 5 | |
| 6 | The cyclic moving-frame reaction in dimension three is the quadratic matrix |
| 7 | polynomial `2 (A^2 + adj A)`. The factor two is the normalization for which |
| 8 | the scalar curvature is twice the cyclic operator trace. |
| 9 | -/ |
| 10 | |
| 11 | open Matrix |
| 12 | open scoped BigOperators ContDiff NNReal |
| 13 | |
| 14 | noncomputable section |
| 15 | |
| 16 | local instance : NormedAddCommGroup (Matrix (Fin 3) (Fin 3) ℝ) := |
| 17 | Matrix.normedAddCommGroup |
| 18 | local instance : NormedSpace ℝ (Matrix (Fin 3) (Fin 3) ℝ) := |
| 19 | Matrix.normedSpace |
| 20 | |
| 21 | namespace Poincare.Geometry.Curvature.Operator |
| 22 | |
| 23 | /-- Congruence by a change of orthonormal frame. -/ |
| 24 | def curvatureOperatorCongr {ι : Type*} [Fintype ι] |
| 25 | (U A : Matrix ι ι ℝ) : Matrix ι ι ℝ := Uᴴ * A * U |
| 26 | |
| 27 | /-- The cyclic three-dimensional curvature reaction. -/ |
| 28 | def curvatureReaction (A : Matrix (Fin 3) (Fin 3) ℝ) : Matrix (Fin 3) (Fin 3) ℝ := |
| 29 | (2 : ℝ) • (A * A + Matrix.adjugate A) |
| 30 | |
| 31 | /-- The adjugate in dimension three is the second characteristic polynomial. -/ |
| 32 | theorem adjugate_fin3_eq_trace_polynomial |
| 33 | {A : Matrix (Fin 3) (Fin 3) ℝ} (hA : A.IsSymm) : |
| 34 | Matrix.adjugate A = |
| 35 | A * A - A.trace • A + |
| 36 | ((A.trace ^ 2 - (A * A).trace) / 2) • (1 : Matrix (Fin 3) (Fin 3) ℝ) := by |
| 37 | have h10 : A 1 0 = A 0 1 := congrFun (congrFun hA 0) 1 |
| 38 | have h20 : A 2 0 = A 0 2 := congrFun (congrFun hA 0) 2 |
| 39 | have h21 : A 2 1 = A 1 2 := congrFun (congrFun hA 1) 2 |
| 40 | ext i j |
| 41 | fin_cases i <;> fin_cases j <;> |
| 42 | simp [Matrix.adjugate_apply, Matrix.det_fin_three, Matrix.mul_apply, Matrix.trace, |
| 43 | Fin.sum_univ_succ, h10, h20, h21] |
| 44 | all_goals ring |
| 45 | |
| 46 | /-- Trace-polynomial form of the retained factor-two reaction. -/ |
| 47 | theorem curvatureReaction_eq_trace_polynomial |
| 48 | {A : Matrix (Fin 3) (Fin 3) ℝ} (hA : A.IsSymm) : |
| 49 | curvatureReaction A = |
| 50 | (4 : ℝ) • (A * A) - (2 * A.trace) • A + |
| 51 | (A.trace ^ 2 - (A * A).trace) • (1 : Matrix (Fin 3) (Fin 3) ℝ) := by |
| 52 | rw [curvatureReaction, adjugate_fin3_eq_trace_polynomial hA] |
| 53 | ext i j |
| 54 | simp only [Matrix.smul_apply, Matrix.sub_apply, Matrix.add_apply, Matrix.one_apply, |
| 55 | Matrix.mul_apply] |
| 56 | ring |
| 57 | |
| 58 | /-- Diagonal entries of the cyclic reaction in an eigenbasis. -/ |
| 59 | theorem curvatureReaction_diagonal (lam mu nu : ℝ) : |
| 60 | curvatureReaction (Matrix.diagonal ![lam, mu, nu]) = |
| 61 | Matrix.diagonal ![2 * (lam ^ 2 + mu * nu), |
| 62 | 2 * (mu ^ 2 + lam * nu), 2 * (nu ^ 2 + lam * mu)] := by |
| 63 | have hp0 : (∏ j ∈ Finset.univ.erase (0 : Fin 3), ![lam, mu, nu] j) = mu * nu := by |
| 64 | have h : Finset.univ.erase (0 : Fin 3) = ({1, 2} : Finset (Fin 3)) := by |
| 65 | ext j |
| 66 | fin_cases j <;> simp |
| 67 | rw [h] |
| 68 | simp [mul_comm] |
| 69 | have hp1 : (∏ j ∈ Finset.univ.erase (1 : Fin 3), ![lam, mu, nu] j) = lam * nu := by |
| 70 | have h : Finset.univ.erase (1 : Fin 3) = ({0, 2} : Finset (Fin 3)) := by |
| 71 | ext j |
| 72 | fin_cases j <;> simp |
| 73 | rw [h] |
| 74 | simp [mul_comm] |
| 75 | have hp2 : (∏ j ∈ Finset.univ.erase (2 : Fin 3), ![lam, mu, nu] j) = lam * mu := by |
| 76 | have h : Finset.univ.erase (2 : Fin 3) = ({0, 1} : Finset (Fin 3)) := by |
| 77 | ext j |
| 78 | fin_cases j <;> simp |
| 79 | rw [h] |
| 80 | simp [mul_comm] |
| 81 | ext i j |
| 82 | fin_cases i <;> fin_cases j <;> |
| 83 | simp [curvatureReaction, Matrix.adjugate_apply, Matrix.det_fin_three, Matrix.mul_apply, |
| 84 | Fin.sum_univ_succ, hp0, hp1, hp2] |
| 85 | all_goals ring |
| 86 | |
| 87 | private theorem curvatureOperatorCongr_mul |
| 88 | {ι : Type*} [Fintype ι] [DecidableEq ι] |
| 89 | (U : Matrix.unitaryGroup ι ℝ) (A B : Matrix ι ι ℝ) : |
| 90 | curvatureOperatorCongr (U : Matrix ι ι ℝ) (A * B) = |
| 91 | curvatureOperatorCongr (U : Matrix ι ι ℝ) A * |
| 92 | curvatureOperatorCongr (U : Matrix ι ι ℝ) B := by |
| 93 | have hU : (U : Matrix ι ι ℝ) * (U : Matrix ι ι ℝ)ᴴ = 1 := U.property.2 |
| 94 | simp only [curvatureOperatorCongr, Matrix.mul_assoc, |
| 95 | ← Matrix.mul_assoc (U : Matrix ι ι ℝ) (U : Matrix ι ι ℝ)ᴴ, hU, one_mul] |
| 96 | |
| 97 | private theorem trace_curvatureOperatorCongr |
| 98 | {ι : Type*} [Fintype ι] [DecidableEq ι] |
| 99 | (U : Matrix.unitaryGroup ι ℝ) (A : Matrix ι ι ℝ) : |
| 100 | (curvatureOperatorCongr (U : Matrix ι ι ℝ) A).trace = A.trace := by |
| 101 | have hU : (U : Matrix ι ι ℝ) * (U : Matrix ι ι ℝ)ᴴ = 1 := U.property.2 |
| 102 | rw [curvatureOperatorCongr, Matrix.trace_mul_cycle, hU, one_mul] |
| 103 | |
| 104 | /-- The reaction is equivariant under orthonormal frame changes. -/ |
| 105 | theorem curvatureReaction_congr |
| 106 | (U : Matrix.unitaryGroup (Fin 3) ℝ) |
| 107 | {A : Matrix (Fin 3) (Fin 3) ℝ} (hA : A.IsHermitian) : |
| 108 | curvatureReaction (curvatureOperatorCongr (U : Matrix (Fin 3) (Fin 3) ℝ) A) = |
| 109 | curvatureOperatorCongr (U : Matrix (Fin 3) (Fin 3) ℝ) (curvatureReaction A) := by |
| 110 | have hUA : (curvatureOperatorCongr (U : Matrix (Fin 3) (Fin 3) ℝ) A).IsHermitian := by |
| 111 | change ((U : Matrix (Fin 3) (Fin 3) ℝ)ᴴ * A * U).IsHermitian |
| 112 | exact Matrix.isHermitian_conjTranspose_mul_mul (U : Matrix (Fin 3) (Fin 3) ℝ) hA |
| 113 | rw [curvatureReaction_eq_trace_polynomial |
| 114 | (Matrix.isHermitian_iff_isSymm.mp hUA), |
| 115 | curvatureReaction_eq_trace_polynomial (Matrix.isHermitian_iff_isSymm.mp hA), |
| 116 | ← curvatureOperatorCongr_mul, trace_curvatureOperatorCongr, |
| 117 | trace_curvatureOperatorCongr] |
| 118 | simp only [curvatureOperatorCongr, Matrix.mul_add, Matrix.add_mul, |
| 119 | Matrix.mul_sub, Matrix.sub_mul, Matrix.mul_smul, Matrix.smul_mul, |
| 120 | Matrix.mul_one] |
| 121 | have hUU : (U : Matrix (Fin 3) (Fin 3) ℝ)ᴴ * U = 1 := by |
| 122 | simpa only [Matrix.star_eq_conjTranspose] using U.property.1 |
| 123 | rw [hUU] |
| 124 | |
| 125 | private theorem contDiff_matrix_entry (a b : Fin 3) : |
| 126 | ContDiff ℝ ∞ (fun A : Matrix (Fin 3) (Fin 3) ℝ => A a b) := by |
| 127 | have ho : ContDiff ℝ ∞ (fun A : Matrix (Fin 3) (Fin 3) ℝ => A a) := |
| 128 | contDiff_apply ℝ _ a |
| 129 | have hi : ContDiff ℝ ∞ (fun x : Fin 3 → ℝ => x b) := |
| 130 | contDiff_apply ℝ _ b |
| 131 | simpa [Function.comp_def] using hi.comp ho |
| 132 | |
| 133 | private theorem contDiff_matrix_det_update (a b : Fin 3) : |
| 134 | ContDiff ℝ ∞ (fun A : Matrix (Fin 3) (Fin 3) ℝ => |
| 135 | (A.updateRow b (Pi.single a (1 : ℝ))).det) := by |
| 136 | simp only [Matrix.det_apply'] |
| 137 | apply ContDiff.sum |
| 138 | intro σ hσ |
| 139 | refine contDiff_const.mul ?_ |
| 140 | apply contDiff_prod |
| 141 | intro i hi |
| 142 | by_cases h : σ i = b |
| 143 | · by_cases e : a = i |
| 144 | · simpa [Matrix.updateRow_apply, h, e] using |
| 145 | (contDiff_const : ContDiff ℝ ∞ |
| 146 | (fun _ : Matrix (Fin 3) (Fin 3) ℝ => (1 : ℝ))) |
| 147 | · simpa [Matrix.updateRow_apply, h, e] using |
| 148 | (contDiff_const : ContDiff ℝ ∞ |
| 149 | (fun _ : Matrix (Fin 3) (Fin 3) ℝ => (0 : ℝ))) |
| 150 | · have hb : b ≠ σ i := by |
| 151 | intro e |
| 152 | apply h |
| 153 | exact e.symm |
| 154 | simpa [Matrix.updateRow_apply, h, hb] using contDiff_matrix_entry (σ i) i |
| 155 | |
| 156 | private theorem contDiff_reaction_entry (a b : Fin 3) : |
| 157 | ContDiff ℝ ∞ (fun A : Matrix (Fin 3) (Fin 3) ℝ => curvatureReaction A a b) := by |
| 158 | unfold curvatureReaction |
| 159 | change ContDiff ℝ ∞ (fun A : Matrix (Fin 3) (Fin 3) ℝ => |
| 160 | 2 * ((∑ c, A a c * A c b) + Matrix.adjugate A a b)) |
| 161 | simp only [Matrix.adjugate_apply] |
| 162 | refine contDiff_const.mul ?_ |
| 163 | apply (ContDiff.sum (fun c _ => |
| 164 | (contDiff_matrix_entry a c).mul (contDiff_matrix_entry c b))).add |
| 165 | exact contDiff_matrix_det_update a b |
| 166 | |
| 167 | /-- The reaction is smooth as a map on the full matrix space. -/ |
| 168 | theorem contDiff_curvatureReaction : |
| 169 | ContDiff ℝ ∞ (fun A : Matrix (Fin 3) (Fin 3) ℝ => curvatureReaction A) := by |
| 170 | let f : Matrix (Fin 3) (Fin 3) ℝ → Matrix (Fin 3) (Fin 3) ℝ := curvatureReaction |
| 171 | have hentries : ∀ a b, ContDiff ℝ ∞ (fun A => f A a b) := by |
| 172 | intro a b |
| 173 | exact contDiff_reaction_entry a b |
| 174 | have hsum : ContDiff ℝ ∞ (fun A => |
| 175 | ∑ a, ∑ b, (f A a b) • (Matrix.single a b (1 : ℝ))) := by |
| 176 | apply ContDiff.sum |
| 177 | intro a ha |
| 178 | apply ContDiff.sum |
| 179 | intro b hb |
| 180 | exact (hentries a b).smul contDiff_const |
| 181 | have heq : (fun A => f A) = (fun A => |
| 182 | ∑ a, ∑ b, (f A a b) • (Matrix.single a b (1 : ℝ))) := by |
| 183 | funext A |
| 184 | ext a b |
| 185 | change f A a b = ∑ x, ∑ y, (f A x y • (Matrix.single x y (1 : ℝ))) a b |
| 186 | fin_cases a <;> fin_cases b <;> |
| 187 | simp [Matrix.single_apply, Fin.sum_univ_succ] |
| 188 | change ContDiff ℝ ∞ (fun A => f A) |
| 189 | rw [heq] |
| 190 | exact hsum |
| 191 | |
| 192 | /-- On every compact convex set the reaction has a uniform local Lipschitz bound. -/ |
| 193 | theorem exists_lipschitzOnWith_curvatureReaction |
| 194 | (K : Set (Matrix (Fin 3) (Fin 3) ℝ)) (hK : IsCompact K) |
| 195 | (hconv : Convex ℝ K) : |
| 196 | ∃ C : ℝ≥0, LipschitzOnWith C curvatureReaction K := by |
| 197 | exact contDiff_curvatureReaction.contDiffOn.exists_lipschitzOnWith |
| 198 | (by simp) hconv hK |
| 199 | |
| 200 | end Poincare.Geometry.Curvature.Operator |
| 201 |