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 | |
| 3 | /-! |
| 4 | # Tensor slot actions in null Hamilton directions |
| 5 | |
| 6 | An endomorphism acts on every tensor slot by differentiating a simultaneous |
| 7 | change of frame. At a positive-semidefinite null direction this contributes |
| 8 | zero to the Hamilton quadratic. In particular, the Ricci slot actions cancel |
| 9 | when converting covariant time differentiation into ordinary differentiation. |
| 10 | |
| 11 | Reference: Chow et al., Part II, Theorem 15.16, pp. 272-279. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | set_option maxHeartbeats 800000 |
| 17 | |
| 18 | open scoped BigOperators |
| 19 | open Matrix |
| 20 | |
| 21 | namespace Poincare.RicciFlow.Harnack |
| 22 | |
| 23 | variable {I : Type*} [Fintype I] [DecidableEq I] |
| 24 | |
| 25 | omit [DecidableEq I] in |
| 26 | /-- The infinitesimal action of a change of frame vanishes on a null |
| 27 | positive-semidefinite quadratic form. -/ |
| 28 | lemma quadratic_input_action_zero {A : Matrix I I ℝ} (hA : A.PosSemidef) |
| 29 | (z : I → ℝ) (hz : z ⬝ᵥ (A *ᵥ z) = 0) (L : Matrix I I ℝ) : |
| 30 | z ⬝ᵥ ((L * A + A * L.transpose) *ᵥ z) = 0 := by |
| 31 | have hzero : A *ᵥ z = 0 := |
| 32 | (hA.dotProduct_mulVec_zero_iff z).mp (by simpa only [star_trivial] using hz) |
| 33 | have hleft : z ᵥ* A = 0 := by |
| 34 | ext i |
| 35 | have hs (j) : A j i = A i j := by simpa only [star_trivial] using hA.1.apply i j |
| 36 | simpa only [vecMul, mulVec, dotProduct, hs, mul_comm] using congrFun hzero i |
| 37 | rw [add_mulVec, dotProduct_add, ← mulVec_mulVec, hzero, mulVec_zero, dotProduct_zero, |
| 38 | zero_add, ← mulVec_mulVec, dotProduct_mulVec, hleft, zero_dotProduct] |
| 39 | |
| 40 | /-- An arbitrary endomorphism acting on every covariant slot of the three |
| 41 | Hamilton blocks has zero contraction in a positive-semidefinite null direction. -/ |
| 42 | lemma hamiltonBlock_input_action_zero |
| 43 | (R : I → I → I → I → ℝ) (P : I → I → I → ℝ) |
| 44 | (M U C : I → I → ℝ) (W : I → ℝ) |
| 45 | (hQ : (Matrix.fromBlocks |
| 46 | (fun ac bd : I × I => R ac.1 ac.2 bd.1 bd.2) |
| 47 | (fun (ac : I × I) d => P ac.1 ac.2 d) |
| 48 | (fun c (bd : I × I) => P bd.1 bd.2 c) M).PosSemidef) |
| 49 | (hnull : (∑ a, ∑ b, M a b * W a * W b) + |
| 50 | 2 * (∑ a, ∑ b, ∑ c, P a b c * U a b * W c) + |
| 51 | (∑ a, ∑ b, ∑ c, ∑ d, R a b c d * U a b * U c d) = 0) : |
| 52 | (∑ a, ∑ b, (∑ e, (C a e * M e b + C b e * M a e)) * W a * W b) + |
| 53 | 2 * (∑ a, ∑ b, ∑ c, |
| 54 | (∑ e, (C a e * P e b c + C b e * P a e c + C c e * P a b e)) * U a b * W c) + |
| 55 | (∑ a, ∑ b, ∑ c, ∑ d, |
| 56 | (∑ e, (C a e * R e b c d + C b e * R a e c d + |
| 57 | C c e * R a b e d + C d e * R a b c e)) * U a b * U c d) = 0 := by |
| 58 | let A : Matrix ((I × I) ⊕ I) ((I × I) ⊕ I) ℝ := Matrix.fromBlocks |
| 59 | (fun ac bd => R ac.1 ac.2 bd.1 bd.2) (fun ac d => P ac.1 ac.2 d) |
| 60 | (fun c bd => P bd.1 bd.2 c) M |
| 61 | let L : Matrix ((I × I) ⊕ I) ((I × I) ⊕ I) ℝ := Matrix.fromBlocks |
| 62 | (fun ac bd => (if ac.2 = bd.2 then C ac.1 bd.1 else 0) + |
| 63 | (if ac.1 = bd.1 then C ac.2 bd.2 else 0)) 0 0 C |
| 64 | let S : Matrix ((I × I) ⊕ I) ((I × I) ⊕ I) ℝ := Matrix.fromBlocks |
| 65 | (fun ac bd => ∑ e, (C ac.1 e * R e ac.2 bd.1 bd.2 + |
| 66 | C ac.2 e * R ac.1 e bd.1 bd.2 + C bd.1 e * R ac.1 ac.2 e bd.2 + |
| 67 | C bd.2 e * R ac.1 ac.2 bd.1 e)) |
| 68 | (fun ac d => ∑ e, (C ac.1 e * P e ac.2 d + C ac.2 e * P ac.1 e d + |
| 69 | C d e * P ac.1 ac.2 e)) |
| 70 | (fun c bd => ∑ e, (C bd.1 e * P e bd.2 c + C bd.2 e * P bd.1 e c + |
| 71 | C c e * P bd.1 bd.2 e)) |
| 72 | (fun a b => ∑ e, (C a e * M e b + C b e * M a e)) |
| 73 | have hS : L * A + A * L.transpose = S := by |
| 74 | ext (ac | a) (bd | b) <;> |
| 75 | simp only [L, A, S, Matrix.mul_apply, Matrix.add_apply, Matrix.transpose_apply, |
| 76 | Fintype.sum_sum_type, Fintype.sum_prod_type, |
| 77 | Matrix.fromBlocks_apply₁₁, Matrix.fromBlocks_apply₁₂, |
| 78 | Matrix.fromBlocks_apply₂₁, Matrix.fromBlocks_apply₂₂, |
| 79 | Matrix.zero_apply, zero_mul, mul_zero, Finset.sum_const_zero, |
| 80 | add_zero, zero_add, add_mul, mul_add, ite_mul, mul_ite, |
| 81 | Finset.sum_add_distrib, Finset.sum_ite_irrel, |
| 82 | Finset.sum_ite_eq, Finset.mem_univ, if_true] |
| 83 | all_goals simp only [mul_comm, add_comm, add_assoc] |
| 84 | let z : ((I × I) ⊕ I) → ℝ := Sum.elim (fun ac => U ac.1 ac.2) W |
| 85 | have hz : z ⬝ᵥ (A *ᵥ z) = 0 := |
| 86 | (hamiltonBlock_quadratic_eq R P M U W).trans hnull |
| 87 | have h := quadratic_input_action_zero hQ z hz L |
| 88 | rw [hS] at h |
| 89 | have heval := hamiltonBlock_quadratic_eq |
| 90 | (fun a b c d => ∑ e, (C a e * R e b c d + C b e * R a e c d + |
| 91 | C c e * R a b e d + C d e * R a b c e)) |
| 92 | (fun a b c => ∑ e, (C a e * P e b c + C b e * P a e c + C c e * P a b e)) |
| 93 | (fun a b => ∑ e, (C a e * M e b + C b e * M a e)) U W |
| 94 | exact heval.symm.trans h |
| 95 | |
| 96 | end Poincare.RicciFlow.Harnack |