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.Harnack.Matrix.Positivity.Reaction |
| 2 | import Mathlib.Analysis.InnerProductSpace.PiL2 |
| 3 | |
| 4 | /-! |
| 5 | # Normalized Hamilton test directions |
| 6 | |
| 7 | Homogeneity reduces positivity to skew/vector coefficients on one Euclidean |
| 8 | unit sphere, the compact fiber parameter used in the first-contact argument. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | |
| 14 | open scoped BigOperators |
| 15 | |
| 16 | namespace Poincare.RicciFlow.Harnack |
| 17 | |
| 18 | variable {I : Type*} [Fintype I] |
| 19 | |
| 20 | /-- Normalized skew/vector tests suffice for positive semidefiniteness of |
| 21 | the full Hamilton block, including its redundant two-form coordinates. -/ |
| 22 | theorem hamiltonBlock_posSemidef_of_unit_skew_quadratic_nonneg |
| 23 | (R : I → I → I → I → ℝ) (P : I → I → I → ℝ) (M : I → I → ℝ) |
| 24 | (hR : ∀ a b c d, R a b c d = R c d a b) |
| 25 | (hfirst : ∀ a b c d, R a b c d = -R b a c d) |
| 26 | (hlast : ∀ a b c d, R a b c d = -R a b d c) |
| 27 | (hP : ∀ a b c, P a b c = -P b a c) |
| 28 | (hM : ∀ a b, M a b = M b a) |
| 29 | (hQ : ∀ z : EuclideanSpace ℝ ((I × I) ⊕ I), ‖z‖ = 1 → |
| 30 | (∀ a b, z (Sum.inl (a, b)) = -z (Sum.inl (b, a))) → |
| 31 | 0 ≤ (∑ a, ∑ b, M a b * z (Sum.inr a) * z (Sum.inr b)) + |
| 32 | 2 * (∑ a, ∑ b, ∑ c, |
| 33 | P a b c * z (Sum.inl (a, b)) * z (Sum.inr c)) + |
| 34 | (∑ a, ∑ b, ∑ c, ∑ d, |
| 35 | R a b c d * z (Sum.inl (a, b)) * z (Sum.inl (c, d)))) : |
| 36 | (Matrix.fromBlocks |
| 37 | (fun ac bd : I × I => R ac.1 ac.2 bd.1 bd.2) |
| 38 | (fun (ac : I × I) d => P ac.1 ac.2 d) |
| 39 | (fun c (bd : I × I) => P bd.1 bd.2 c) M).PosSemidef := by |
| 40 | apply hamiltonBlock_posSemidef_of_skew_quadratic_nonneg R P M hR hfirst hlast hP hM |
| 41 | intro U W hU |
| 42 | let z : EuclideanSpace ℝ ((I × I) ⊕ I) := |
| 43 | WithLp.toLp 2 (Sum.elim (fun ab => U ab.1 ab.2) W) |
| 44 | by_cases hz : z = 0 |
| 45 | · have hu (a b) : U a b = 0 := congrArg (fun z : EuclideanSpace ℝ ((I × I) ⊕ I) => |
| 46 | z (Sum.inl (a, b))) hz |
| 47 | have hw (a) : W a = 0 := congrArg (fun z : EuclideanSpace ℝ ((I × I) ⊕ I) => |
| 48 | z (Sum.inr a)) hz |
| 49 | simp only [hu, hw, mul_zero, Finset.sum_const_zero, add_zero, le_refl] |
| 50 | · have hn : ‖z‖ ≠ 0 := norm_ne_zero_iff.mpr hz |
| 51 | let v : EuclideanSpace ℝ ((I × I) ⊕ I) := ‖z‖⁻¹ • z |
| 52 | have hv : ‖v‖ = 1 := by |
| 53 | simp only [v, norm_smul, norm_inv, norm_norm, inv_mul_cancel₀ hn] |
| 54 | have hskew (a b) : v (Sum.inl (a, b)) = -v (Sum.inl (b, a)) := by |
| 55 | change ‖z‖⁻¹ * U a b = -(‖z‖⁻¹ * U b a) |
| 56 | rw [hU a b, mul_neg] |
| 57 | have h := hQ v hv hskew |
| 58 | change 0 ≤ (∑ a, ∑ b, M a b * (‖z‖⁻¹ * W a) * (‖z‖⁻¹ * W b)) + |
| 59 | 2 * (∑ a, ∑ b, ∑ c, P a b c * (‖z‖⁻¹ * U a b) * (‖z‖⁻¹ * W c)) + |
| 60 | (∑ a, ∑ b, ∑ c, ∑ d, |
| 61 | R a b c d * (‖z‖⁻¹ * U a b) * (‖z‖⁻¹ * U c d)) at h |
| 62 | have hmul (a b c : ℝ) : a * (‖z‖⁻¹ * b) * (‖z‖⁻¹ * c) = |
| 63 | ‖z‖⁻¹ ^ 2 * (a * b * c) := by ring |
| 64 | simp only [hmul, ← Finset.mul_sum] at h |
| 65 | have heq (a b c : ℝ) : |
| 66 | ‖z‖⁻¹ ^ 2 * a + 2 * (‖z‖⁻¹ ^ 2 * b) + ‖z‖⁻¹ ^ 2 * c = |
| 67 | ‖z‖⁻¹ ^ 2 * (a + 2 * b + c) := by ring |
| 68 | rw [heq] at h |
| 69 | exact (mul_nonneg_iff_of_pos_left (sq_pos_of_ne_zero (inv_ne_zero hn))).mp h |
| 70 | |
| 71 | end Poincare.RicciFlow.Harnack |