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.Derivatives |
| 2 | import PoincareLib.Geometry.Riemannian.Curvature.ContractedBianchi |
| 3 | import PoincareLib.Geometry.Riemannian.Tensor.Commutation |
| 4 | import PoincareLib.Geometry.Riemannian.Tensor.Commutation.CurvatureAction |
| 5 | import PoincareLib.Geometry.Riemannian.Tensor.Trace |
| 6 | import PoincareLib.Geometry.Riemannian.ScalarOperators.Scaling |
| 7 | |
| 8 | /-! |
| 9 | # The divergence of Hamilton's three-tensor |
| 10 | |
| 11 | Contracted Bianchi and the covariant Ricci commutator identify Hamilton's |
| 12 | two-tensor with the divergence of P plus curvature and elapsed-time terms. |
| 13 | This is Chow et al., Part II, (15.47), printed p. 274 (PDF p. 301), the |
| 14 | starting point for the two-tensor evolution in Lemma 15.19. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open scoped Manifold ContDiff Bundle BigOperators |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.LeviCivitaData |
| 25 | |
| 26 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 28 | {g : RiemannianMetric n M} |
| 29 | |
| 30 | /-- Contracted Bianchi on an arbitrary tangent input. -/ |
| 31 | lemma sum_covariantTensorDerivative_ricci_divergence |
| 32 | (D : LeviCivitaData g) (hD : D.CurvatureTensorCalculus) |
| 33 | (x : M) (v : TangentSpace (𝓡 n) x) : |
| 34 | (∑ i, D.covariantTensorDerivative D.ricciEvaluation x |
| 35 | ![g.orthonormalBasis x i, v, g.orthonormalBasis x i]) = |
| 36 | mvfderiv (𝓡 n) D.scalarCurvature x v / 2 := by |
| 37 | rw [← D.sum_covariantTensorDerivative_ricci_eq_scalar_derivative hD x v] |
| 38 | simp_rw [D.covariantTensorDerivative_ricciEvaluation_eq_sum_riemann hD] |
| 39 | exact double_contraction_second_bianchi |
| 40 | (fun a b c d e => D.covariantTensorDerivative D.riemannEvaluation x ![a, b, c, d, e]) |
| 41 | (g.orthonormalBasis x) |
| 42 | (D.covariantTensorDerivative_riemannEvaluation_skew_first hD x) |
| 43 | (D.covariantTensorDerivative_riemannEvaluation_skew_last hD x) |
| 44 | (D.covariantTensorDerivative_curvature_second_bianchi hD x) v |
| 45 | |
| 46 | /-- Differentiated contracted Bianchi, with the connection correction on |
| 47 | the remaining covariant input retained. -/ |
| 48 | lemma sum_secondCovariantTensorDerivative_ricci_divergence |
| 49 | (D : LeviCivitaData g) (hD : D.CurvatureTensorCalculus) |
| 50 | (x : M) (u v : TangentSpace (𝓡 n) x) : |
| 51 | (∑ i, D.covariantTensorDerivative (D.covariantTensorDerivative D.ricciEvaluation) x |
| 52 | ![u, g.orthonormalBasis x i, g.orthonormalBasis x i, v]) = |
| 53 | D.hessian D.scalarCurvature x u v / 2 := by |
| 54 | let A := D.covariantTensorDerivative D.ricciEvaluation |
| 55 | have hA := hD.2.2.1 2 D.ricciEvaluation hD.2.1 |
| 56 | have htrace : g.tensorTrace A = |
| 57 | fun y z => mvfderiv (𝓡 n) D.scalarCurvature y (z 0) / 2 := by |
| 58 | funext y z |
| 59 | have hz : z = ![z 0] := by ext i; fin_cases i; rfl |
| 60 | rw [hz] |
| 61 | change (∑ i, A y ![g.orthonormalBasis y i, g.orthonormalBasis y i, z 0]) = _ |
| 62 | calc |
| 63 | _ = ∑ i, D.covariantTensorDerivative D.ricciEvaluation y |
| 64 | ![g.orthonormalBasis y i, z 0, g.orthonormalBasis y i] := |
| 65 | Finset.sum_congr rfl fun i _ => |
| 66 | D.covariantTensorDerivative_ricciEvaluation_symm hD y _ _ _ |
| 67 | _ = _ := D.sum_covariantTensorDerivative_ricci_divergence hD y (z 0) |
| 68 | have h := D.covariantTensorDerivative_tensorTrace hA x u ![v] |
| 69 | change D.covariantTensorDerivative (g.tensorTrace A) x ![u, v] = _ at h |
| 70 | rw [htrace] at h |
| 71 | simp only [Matrix.Fin.cons_vecCons] at h |
| 72 | rw [← h] |
| 73 | simp [covariantTensorDerivative, hessian, hessianOnFields, |
| 74 | mvfderiv_const_mul, div_eq_mul_inv, mul_comm, mul_sub] |
| 75 | |
| 76 | /-- Contracting the Ricci commutator contributes one Ricci square and one |
| 77 | curvature-Ricci contraction, with the retained curvature convention. -/ |
| 78 | lemma sum_secondCovariantTensorDerivative_ricci_swap |
| 79 | (D : LeviCivitaData g) (hD : D.CurvatureTensorCalculus) |
| 80 | (x : M) (u v : TangentSpace (𝓡 n) x) : |
| 81 | let b := g.orthonormalBasis x |
| 82 | (∑ i, D.covariantTensorDerivative (D.covariantTensorDerivative D.ricciEvaluation) x |
| 83 | ![b i, u, b i, v]) = |
| 84 | D.hessian D.scalarCurvature x u v / 2 + |
| 85 | (∑ i, D.ricci x u (b i) * D.ricci x (b i) v) - |
| 86 | ∑ i, ∑ j, D.curvatureTensor x (b i) u (b j) v * D.ricci x (b i) (b j) := by |
| 87 | let b := g.orthonormalBasis x |
| 88 | have hfirst (a c d e : TangentSpace (𝓡 n) x) : |
| 89 | D.curvatureTensor x a c d e = -D.curvatureTensor x c a d e := by |
| 90 | rw [(hD.2.2.2.1 x a c d e).2.1, (hD.2.2.2.1 x d e a c).1, |
| 91 | (hD.2.2.2.1 x d e c a).2.1] |
| 92 | have hleft (i) : D.ricci x (D.curvature x (b i) u (b i)) v = |
| 93 | ∑ j, D.curvatureTensor x (b i) u (b j) (b i) * D.ricci x (b j) v := by |
| 94 | have h := D.tensor_curvature_slot_eq_sum hD.2.1 x ![b i, v] 0 (b i) u (b i) |
| 95 | have hu (w : TangentSpace (𝓡 n) x) : Function.update ![b i, v] 0 w = ![w, v] := by |
| 96 | ext k; fin_cases k <;> simp |
| 97 | simpa only [hu, ricciEvaluation, Matrix.cons_val_zero, Matrix.cons_val_one] using h |
| 98 | have hright (i) : D.ricci x (b i) (D.curvature x (b i) u v) = |
| 99 | ∑ j, D.curvatureTensor x (b i) u (b j) v * D.ricci x (b i) (b j) := by |
| 100 | have h := D.tensor_curvature_slot_eq_sum hD.2.1 x ![b i, v] 1 (b i) u v |
| 101 | have hu (w : TangentSpace (𝓡 n) x) : Function.update ![b i, v] 1 w = ![b i, w] := by |
| 102 | ext k; fin_cases k <;> simp |
| 103 | simpa only [hu, ricciEvaluation, Matrix.cons_val_zero, Matrix.cons_val_one] using h |
| 104 | have hleftsum : (∑ i, D.ricci x (D.curvature x (b i) u (b i)) v) = |
| 105 | -(∑ j, D.ricci x u (b j) * D.ricci x (b j) v) := by |
| 106 | simp_rw [hleft] |
| 107 | rw [Finset.sum_comm, ← Finset.sum_neg_distrib] |
| 108 | apply Finset.sum_congr rfl |
| 109 | intro j _ |
| 110 | rw [← Finset.sum_mul] |
| 111 | have hc : (∑ i, D.curvatureTensor x (b i) u (b j) (b i)) = -D.ricci x u (b j) := by |
| 112 | simp_rw [hfirst (b _) u] |
| 113 | rw [Finset.sum_neg_distrib] |
| 114 | rfl |
| 115 | rw [hc, neg_mul] |
| 116 | have hcomm := congrArg (fun f : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ => |
| 117 | ∑ i, f i) (funext fun i => |
| 118 | D.covariantTensorDerivative_commutator_two hD.2.1 x (b i) u (b i) v) |
| 119 | simp only [Finset.sum_sub_distrib, Finset.sum_neg_distrib, ricciEvaluation, |
| 120 | Matrix.cons_val_zero, Matrix.cons_val_one] at hcomm |
| 121 | rw [hleftsum] at hcomm |
| 122 | simp_rw [hright] at hcomm |
| 123 | have hdiv := D.sum_secondCovariantTensorDerivative_ricci_divergence hD x u v |
| 124 | dsimp only at ⊢ |
| 125 | dsimp only [b] at hcomm |
| 126 | linarith only [hcomm, hdiv] |
| 127 | |
| 128 | end PoincareMT.LeviCivitaData |
| 129 | |
| 130 | namespace Poincare.RicciFlow.Harnack |
| 131 | |
| 132 | open PoincareMT |
| 133 | |
| 134 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 135 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 136 | {g : RiemannianMetric n M} |
| 137 | |
| 138 | /-- Hamilton's two-tensor as the divergence of P, equation (15.47). -/ |
| 139 | theorem hamiltonM_eq_divergence_hamiltonP |
| 140 | (D : LeviCivitaData g) (hD : D.CurvatureTensorCalculus) |
| 141 | (τ : ℝ) (x : M) (u v : TangentSpace (𝓡 n) x) : |
| 142 | let b := g.orthonormalBasis x |
| 143 | hamiltonM D τ x u v = |
| 144 | (∑ i, D.covariantTensorDerivative |
| 145 | (fun y z => hamiltonP D y (z 0) (z 1) (z 2)) x ![b i, b i, u, v]) + |
| 146 | (∑ i, ∑ j, D.curvatureTensor x (b i) u (b j) v * D.ricci x (b i) (b j)) + |
| 147 | D.ricci x u v / (2 * τ) := by |
| 148 | dsimp only |
| 149 | simp_rw [covariantTensorDerivative_hamiltonP D hD] |
| 150 | rw [Finset.sum_sub_distrib, D.sum_secondCovariantTensorDerivative_ricci_swap hD] |
| 151 | simp only [hamiltonM, LeviCivitaData.tensorLaplacian, |
| 152 | LeviCivitaData.iteratedCovariantTensorDerivative, Matrix.Fin.cons_vecCons] |
| 153 | ring |
| 154 | |
| 155 | end Poincare.RicciFlow.Harnack |