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 PoincareLib.Geometry.RicciFlow.Pinching.OperatorReaction.Diagonal |
| 2 | |
| 3 | /-! |
| 4 | # The intrinsic operator reaction in orthonormal coordinates |
| 5 | |
| 6 | In dimension three, the adjugate is the second characteristic polynomial. |
| 7 | The trace-polynomial expression therefore defines the normalized reaction |
| 8 | without choosing a basis. |
| 9 | |
| 10 | Reference: Morgan--Tian, Lemma 4.13, pp. 68--69. |
| 11 | -/ |
| 12 | |
| 13 | namespace Poincare.HamiltonIvey |
| 14 | |
| 15 | noncomputable section |
| 16 | |
| 17 | local instance : NormedAddCommGroup ThreeMatrix := Matrix.normedAddCommGroup |
| 18 | local instance : NormedSpace ℝ ThreeMatrix := Matrix.normedSpace |
| 19 | |
| 20 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 21 | [FiniteDimensional ℝ E] |
| 22 | |
| 23 | /-- The intrinsic form of twice the sum of the square and the adjugate in |
| 24 | dimension three. -/ |
| 25 | noncomputable def endomorphismReaction |
| 26 | {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 27 | [FiniteDimensional ℝ E] (A : E →ₗ[ℝ] E) : E →ₗ[ℝ] E := |
| 28 | 4 • (A * A) - (2 * LinearMap.trace ℝ E A) • A + |
| 29 | ((LinearMap.trace ℝ E A) ^ 2 - LinearMap.trace ℝ E (A * A)) • 1 |
| 30 | |
| 31 | theorem toMatrix_endomorphismReaction (e : OrthonormalBasis (Fin 3) ℝ E) |
| 32 | (A : E →ₗ[ℝ] E) : |
| 33 | LinearMap.toMatrix e.toBasis e.toBasis (endomorphismReaction A) = |
| 34 | operatorReaction (LinearMap.toMatrix e.toBasis e.toBasis A) := by |
| 35 | rw [operatorReaction_eq_trace_polynomial] |
| 36 | simp [endomorphismReaction, LinearMap.trace_eq_matrix_trace ℝ e.toBasis, |
| 37 | LinearMap.toMatrix_mul, ← Nat.cast_smul_eq_nsmul ℝ] |
| 38 | |
| 39 | omit [FiniteDimensional ℝ E] in |
| 40 | theorem continuousOn_operatorMatrix {a b : ℝ} {A : ℝ → E →ₗ[ℝ] E} |
| 41 | (e : OrthonormalBasis (Fin 3) ℝ E) |
| 42 | (hA : ∀ v : E, ContinuousOn (fun t => A t v) (Set.Icc a b)) : |
| 43 | ContinuousOn (fun t => LinearMap.toMatrix e.toBasis e.toBasis (A t)) (Set.Icc a b) := by |
| 44 | apply continuousOn_pi.mpr |
| 45 | intro i |
| 46 | apply continuousOn_pi.mpr |
| 47 | intro j |
| 48 | simpa [LinearMap.toMatrix_apply, e.coe_toBasis_repr_apply, e.repr_apply_apply] using |
| 49 | continuousOn_const.inner (hA (e j)) |
| 50 | |
| 51 | omit [FiniteDimensional ℝ E] in |
| 52 | theorem hasDerivAt_operatorMatrix {A : ℝ → E →ₗ[ℝ] E} {D : E →ₗ[ℝ] E} |
| 53 | (e : OrthonormalBasis (Fin 3) ℝ E) {t : ℝ} |
| 54 | (hd : ∀ v : E, HasDerivAt (fun s => A s v) (D v) t) : |
| 55 | HasDerivAt (fun s => LinearMap.toMatrix e.toBasis e.toBasis (A s)) |
| 56 | (LinearMap.toMatrix e.toBasis e.toBasis D) t := by |
| 57 | apply hasDerivAt_pi.mpr |
| 58 | intro i |
| 59 | apply hasDerivAt_pi.mpr |
| 60 | intro j |
| 61 | simpa [LinearMap.toMatrix_apply, e.coe_toBasis_repr_apply, e.repr_apply_apply] using |
| 62 | (hasDerivAt_const t (e i)).inner ℝ (hd (e j)) |
| 63 | |
| 64 | end |
| 65 | |
| 66 | end Poincare.HamiltonIvey |