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.Algebra.BigOperators.Field |
| 2 | import Mathlib.Algebra.BigOperators.Group.Finset.Sigma |
| 3 | import Mathlib.Data.Real.Basic |
| 4 | import Mathlib.Tactic.Ring |
| 5 | |
| 6 | /-! |
| 7 | # Contractions of Hamilton's Harnack tensors |
| 8 | |
| 9 | Finite orthonormal-frame algebra for the trace in Chow et al., *The Ricci |
| 10 | Flow: Techniques and Applications*, Part II, Corollary 15.3, equation (15.18) |
| 11 | (PDF pages 290-291), and Kleiner-Lott, Appendix F, pp. 2850-2851. |
| 12 | Curvature uses the latter's slot convention, with Ricci given by |
| 13 | `Ric k l = ∑ i, Rm k i l i`, as in the frozen metric definitions. |
| 14 | The derivative array below represents covariant Ricci |
| 15 | derivatives; its contraction hypotheses are the two contracted Bianchi |
| 16 | identities. Geometric realization of those identities is a separate step. |
| 17 | -/ |
| 18 | |
| 19 | open scoped BigOperators |
| 20 | |
| 21 | namespace Poincare.RicciFlow.Harnack |
| 22 | |
| 23 | variable {I : Type*} |
| 24 | |
| 25 | /-- The antisymmetrized covariant derivative of a symmetric two-tensor is |
| 26 | skew in its first two indices. -/ |
| 27 | lemma ricciDerivative_skew (A : I → I → I → ℝ) (i j k : I) : |
| 28 | A i j k - A j i k = -(A j i k - A i j k) := by |
| 29 | ring |
| 30 | |
| 31 | /-- Symmetry of the last two slots gives the cyclic identity for Hamilton's |
| 32 | three-tensor, defined by equation (15.5). -/ |
| 33 | lemma ricciDerivative_cyclic (A : I → I → I → ℝ) |
| 34 | (hA : ∀ i j k, A i j k = A i k j) (i j k : I) : |
| 35 | (A i j k - A j i k) + (A j k i - A k j i) + |
| 36 | (A k i j - A i k j) = 0 := by |
| 37 | rw [hA j i k, hA k j i, hA i k j] |
| 38 | ring |
| 39 | |
| 40 | variable [Fintype I] |
| 41 | |
| 42 | /-- Tracing Hamilton's three-tensor gives minus one half of the scalar |
| 43 | gradient, once the contracted Bianchi identities have been supplied. -/ |
| 44 | lemma ricciDerivative_trace (A : I → I → I → ℝ) (dR : I → ℝ) |
| 45 | (hdiv : ∀ i, ∑ p, A p i p = dR i / 2) |
| 46 | (htrace : ∀ i, ∑ p, A i p p = dR i) (i : I) : |
| 47 | ∑ p, (A p i p - A i p p) = -(dR i / 2) := by |
| 48 | rw [Finset.sum_sub_distrib, hdiv, htrace] |
| 49 | ring |
| 50 | |
| 51 | /-- The mixed term in the trace of the Harnack quadratic is the negative |
| 52 | scalar-gradient pairing. -/ |
| 53 | lemma ricciDerivative_trace_pairing (A : I → I → I → ℝ) (dR V : I → ℝ) |
| 54 | (hdiv : ∀ i, ∑ p, A p i p = dR i / 2) |
| 55 | (htrace : ∀ i, ∑ p, A i p p = dR i) : |
| 56 | 2 * (∑ i, (∑ p, (A p i p - A i p p)) * V i) = |
| 57 | -(∑ i, dR i * V i) := by |
| 58 | simp_rw [ricciDerivative_trace A dR hdiv htrace] |
| 59 | rw [Finset.mul_sum, ← Finset.sum_neg_distrib] |
| 60 | apply Finset.sum_congr rfl |
| 61 | intro i _ |
| 62 | ring |
| 63 | |
| 64 | /-- The curvature-Ricci term in Hamilton's two-tensor contracts to the |
| 65 | squared Ricci norm. -/ |
| 66 | lemma curvatureRicci_trace (Rm : I → I → I → I → ℝ) (Ric : I → I → ℝ) |
| 67 | (hRic : ∀ k l, ∑ i, Rm k i l i = Ric k l) : |
| 68 | (∑ i, ∑ k, ∑ l, Rm k i l i * Ric k l) = |
| 69 | ∑ k, ∑ l, (Ric k l) ^ 2 := by |
| 70 | rw [Finset.sum_comm] |
| 71 | apply Finset.sum_congr rfl |
| 72 | intro k _ |
| 73 | rw [Finset.sum_comm] |
| 74 | apply Finset.sum_congr rfl |
| 75 | intro l _ |
| 76 | rw [← Finset.sum_mul, hRic, pow_two] |
| 77 | |
| 78 | /-- Symmetry identifies the trace of the square of Ricci with its squared |
| 79 | norm in an orthonormal frame. -/ |
| 80 | lemma ricciSquare_trace (Ric : I → I → ℝ) |
| 81 | (hsymm : ∀ i k, Ric i k = Ric k i) : |
| 82 | (∑ i, ∑ k, Ric i k * Ric k i) = ∑ i, ∑ k, (Ric i k) ^ 2 := by |
| 83 | apply Finset.sum_congr rfl |
| 84 | intro i _ |
| 85 | apply Finset.sum_congr rfl |
| 86 | intro k _ |
| 87 | rw [← hsymm i k, pow_two] |
| 88 | |
| 89 | /-- The two algebraic reaction terms in Hamilton's two-tensor have trace |
| 90 | equal to the squared Ricci norm. -/ |
| 91 | lemma harnackReaction_trace (Rm : I → I → I → I → ℝ) (Ric : I → I → ℝ) |
| 92 | (hRic : ∀ k l, ∑ i, Rm k i l i = Ric k l) |
| 93 | (hsymm : ∀ i k, Ric i k = Ric k i) : |
| 94 | (∑ i, (2 * (∑ k, ∑ l, Rm k i l i * Ric k l) - |
| 95 | ∑ k, Ric i k * Ric k i)) = ∑ i, ∑ k, (Ric i k) ^ 2 := by |
| 96 | rw [Finset.sum_sub_distrib, ← Finset.mul_sum, |
| 97 | curvatureRicci_trace Rm Ric hRic, ricciSquare_trace Ric hsymm] |
| 98 | ring |
| 99 | |
| 100 | /-- The trace of Hamilton's two-tensor, equation (15.9), in a frame in |
| 101 | which the Laplacian and Hessian contractions are known. -/ |
| 102 | lemma harnackTwoTensor_trace (Rm : I → I → I → I → ℝ) |
| 103 | (Ric LapRic HessR : I → I → ℝ) (lapR τ : ℝ) |
| 104 | (hRic : ∀ k l, ∑ i, Rm k i l i = Ric k l) |
| 105 | (hsymm : ∀ i k, Ric i k = Ric k i) |
| 106 | (hLap : ∑ i, LapRic i i = lapR) (hHess : ∑ i, HessR i i = lapR) : |
| 107 | (∑ i, (LapRic i i - HessR i i / 2 + |
| 108 | (2 * (∑ k, ∑ l, Rm k i l i * Ric k l) - |
| 109 | ∑ k, Ric i k * Ric k i) + Ric i i / (2 * τ))) = |
| 110 | lapR / 2 + (∑ i, ∑ k, (Ric i k) ^ 2) + (∑ i, Ric i i) / (2 * τ) := by |
| 111 | simp only [Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.sum_div] |
| 112 | rw [hLap, hHess, ← Finset.mul_sum, curvatureRicci_trace Rm Ric hRic, |
| 113 | ricciSquare_trace Ric hsymm] |
| 114 | ring |
| 115 | |
| 116 | end Poincare.RicciFlow.Harnack |