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.ReducedGeometry.LGeometry.Basic |
| 2 | import PoincareLib.Geometry.RicciFlow.Soliton.TwoDimensional.Compact.Differential |
| 3 | |
| 4 | /-! |
| 5 | # Covariant Ricci traces in the surface index form |
| 6 | |
| 7 | On a surface, metric compatibility and `Ric = (R / 2) g` identify the |
| 8 | covariant Ricci derivative directly. Its two contractions cancel in the |
| 9 | traced reduced-length index form without a curvature-theory service. |
| 10 | |
| 11 | Morgan--Tian, Proposition 6.43 and Claim 6.44, pp. 127--129. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle BigOperators |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.LeviCivitaData |
| 22 | |
| 23 | variable {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin 2)) M] [IsManifold (𝓡 2) ∞ M] |
| 25 | {g : RiemannianMetric 2 M} |
| 26 | |
| 27 | theorem ricciDerivativePairing_surface (D : LeviCivitaData g) (x : M) |
| 28 | (u v w : TangentSpace (𝓡 2) x) : |
| 29 | ricciDerivativePairing D x u v w = |
| 30 | mvfderiv (𝓡 2) D.scalarCurvature x u / 2 * g.inner x v w := by |
| 31 | have hRic : D.ricciEvaluation = |
| 32 | fun y z => ((1 / 2 : ℝ) * D.scalarCurvature y) * g.inner y (z 0) (z 1) := by |
| 33 | funext y z |
| 34 | simp only [ricciEvaluation, D.ricci_eq_half_scalarCurvature_mul_inner] |
| 35 | ring |
| 36 | rw [ricciDerivativePairing, hRic, |
| 37 | D.covariantTensorDerivative_scalar_mul_metric |
| 38 | (a := fun y => (1 / 2 : ℝ) * D.scalarCurvature y) |
| 39 | (contMDiff_const.mul D.contMDiff_scalarCurvature)] |
| 40 | simp only [PoincareMT.mvfderiv_const_mul] |
| 41 | ring |
| 42 | |
| 43 | theorem sum_ricciDerivativePairing_surface_divergence (D : LeviCivitaData g) |
| 44 | (x : M) (v : TangentSpace (𝓡 2) x) |
| 45 | (e : letI : Bundle.RiemannianBundle (TangentSpace (𝓡 2) : M → Type _) := |
| 46 | ⟨g.toRiemannianMetric⟩ |
| 47 | OrthonormalBasis (Fin 2) ℝ (TangentSpace (𝓡 2) x)) : |
| 48 | (∑ i, ricciDerivativePairing D x (e i) v (e i)) = |
| 49 | mvfderiv (𝓡 2) D.scalarCurvature x v / 2 := by |
| 50 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 2) : M → Type _) := |
| 51 | ⟨g.toRiemannianMetric⟩ |
| 52 | have h := congrArg (mvfderiv (𝓡 2) D.scalarCurvature x) (e.sum_repr' v) |
| 53 | simp only [map_sum, map_smul, smul_eq_mul] at h |
| 54 | simp_rw [D.ricciDerivativePairing_surface] |
| 55 | calc |
| 56 | _ = (∑ i, inner ℝ (e i) v * mvfderiv (𝓡 2) D.scalarCurvature x (e i)) / 2 := by |
| 57 | rw [Finset.sum_div] |
| 58 | apply Finset.sum_congr rfl |
| 59 | intro i _ |
| 60 | change _ * inner ℝ v (e i) = _ |
| 61 | rw [real_inner_comm v (e i)] |
| 62 | ring |
| 63 | _ = _ := by rw [h] |
| 64 | |
| 65 | theorem sum_ricciDerivativePairing_surface_trace (D : LeviCivitaData g) |
| 66 | (x : M) (v : TangentSpace (𝓡 2) x) |
| 67 | (e : letI : Bundle.RiemannianBundle (TangentSpace (𝓡 2) : M → Type _) := |
| 68 | ⟨g.toRiemannianMetric⟩ |
| 69 | OrthonormalBasis (Fin 2) ℝ (TangentSpace (𝓡 2) x)) : |
| 70 | (∑ i, ricciDerivativePairing D x v (e i) (e i)) = |
| 71 | mvfderiv (𝓡 2) D.scalarCurvature x v := by |
| 72 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 2) : M → Type _) := |
| 73 | ⟨g.toRiemannianMetric⟩ |
| 74 | have he (i : Fin 2) : g.inner x (e i) (e i) = 1 := e.inner_eq_one i |
| 75 | simp_rw [D.ricciDerivativePairing_surface, he, mul_one] |
| 76 | simp |
| 77 | ring |
| 78 | |
| 79 | /-- The covariant Ricci terms of the surface index trace cancel in every |
| 80 | orthonormal frame, including its common scalar rescalings. -/ |
| 81 | theorem sum_ricciDerivativePairing_surface_index_cancel (D : LeviCivitaData g) |
| 82 | (x : M) (v : TangentSpace (𝓡 2) x) (s f : ℝ) |
| 83 | (e : letI : Bundle.RiemannianBundle (TangentSpace (𝓡 2) : M → Type _) := |
| 84 | ⟨g.toRiemannianMetric⟩ |
| 85 | OrthonormalBasis (Fin 2) ℝ (TangentSpace (𝓡 2) x)) : |
| 86 | (∑ i, (-4 * s * ricciDerivativePairing D x (f • e i) v (f • e i) + |
| 87 | 2 * s * ricciDerivativePairing D x v (f • e i) (f • e i))) = 0 := by |
| 88 | have hfirst (i : Fin 2) : |
| 89 | ricciDerivativePairing D x (f • e i) v (f • e i) = |
| 90 | f ^ 2 * ricciDerivativePairing D x (e i) v (e i) := by |
| 91 | simp only [D.ricciDerivativePairing_surface, map_smul, smul_eq_mul] |
| 92 | ring |
| 93 | have hlast (i : Fin 2) : |
| 94 | ricciDerivativePairing D x v (f • e i) (f • e i) = |
| 95 | f ^ 2 * ricciDerivativePairing D x v (e i) (e i) := by |
| 96 | simp only [D.ricciDerivativePairing_surface, map_smul, smul_apply, smul_eq_mul] |
| 97 | ring |
| 98 | simp_rw [hfirst, hlast] |
| 99 | simp only [Finset.sum_add_distrib, ← mul_assoc, ← Finset.mul_sum] |
| 100 | rw [D.sum_ricciDerivativePairing_surface_divergence, |
| 101 | D.sum_ricciDerivativePairing_surface_trace] |
| 102 | ring |
| 103 | |
| 104 | /-- The five terms of the index density traced in a scaled adapted surface |
| 105 | frame. The frame derivative is `(fp - s * f * R)` times the unit frame. -/ |
| 106 | theorem sum_surface_indexDensity (D : LeviCivitaData g) |
| 107 | (x : M) (A : TangentSpace (𝓡 2) x) (s f fp : ℝ) |
| 108 | (e : letI : Bundle.RiemannianBundle (TangentSpace (𝓡 2) : M → Type _) := |
| 109 | ⟨g.toRiemannianMetric⟩ |
| 110 | OrthonormalBasis (Fin 2) ℝ (TangentSpace (𝓡 2) x)) : |
| 111 | (∑ i, (g.inner x ((fp - s * f * D.scalarCurvature x) • e i) |
| 112 | ((fp - s * f * D.scalarCurvature x) • e i) + |
| 113 | D.curvatureTensor x (f • e i) A A (f • e i) + |
| 114 | 2 * s ^ 2 * D.hessian D.scalarCurvature x (f • e i) (f • e i) - |
| 115 | 4 * s * ricciDerivativePairing D x (f • e i) A (f • e i) + |
| 116 | 2 * s * ricciDerivativePairing D x A (f • e i) (f • e i))) = |
| 117 | 2 * fp ^ 2 - 4 * s * f * fp * D.scalarCurvature x + |
| 118 | f ^ 2 * (2 * s ^ 2 * (D.laplacian D.scalarCurvature x + |
| 119 | D.scalarCurvature x ^ 2) - D.ricci x A A) := by |
| 120 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 2) : M → Type _) := |
| 121 | ⟨g.toRiemannianMetric⟩ |
| 122 | have he (i : Fin 2) : g.inner x (e i) (e i) = 1 := e.inner_eq_one i |
| 123 | have hnorm (i : Fin 2) : |
| 124 | g.inner x ((fp - s * f * D.scalarCurvature x) • e i) |
| 125 | ((fp - s * f * D.scalarCurvature x) • e i) = |
| 126 | (fp - s * f * D.scalarCurvature x) ^ 2 := by |
| 127 | simp only [map_smul, smul_apply, smul_eq_mul, he] |
| 128 | ring |
| 129 | have hcurv (i : Fin 2) : |
| 130 | D.curvatureTensor x (f • e i) A A (f • e i) = |
| 131 | f ^ 2 * D.curvatureTensor x (e i) A A (e i) := by |
| 132 | rw [D.curvatureTensor_smul_first, D.curvatureTensor_smul_last] |
| 133 | ring |
| 134 | have hcurv_trace : (∑ i, D.curvatureTensor x (e i) A A (e i)) = |
| 135 | -D.ricci x A A := by |
| 136 | calc |
| 137 | _ = -(∑ i, D.curvatureTensor x (e i) A (e i) A) := by |
| 138 | simp_rw [D.curvatureTensor_swap_last x _ A A _] |
| 139 | rw [Finset.sum_neg_distrib] |
| 140 | _ = -(∑ i, D.curvatureTensor x (g.orthonormalBasis x i) A |
| 141 | (g.orthonormalBasis x i) A) := by |
| 142 | exact congrArg Neg.neg (bilinear_sum_orthonormalBasis_eq |
| 143 | (D.curvatureTensor_bilinear_first_third x A A) e (g.orthonormalBasis x)) |
| 144 | _ = _ := by |
| 145 | congr 1 |
| 146 | unfold ricci |
| 147 | apply Finset.sum_congr rfl |
| 148 | intro i _ |
| 149 | rw [D.curvatureTensor_swap_first x _ A _ A, |
| 150 | D.curvatureTensor_swap_last x A _ _ A, neg_neg] |
| 151 | obtain ⟨H, hH⟩ := (D.hessian_isSmoothCovariantTensor D.contMDiff_scalarCurvature).1 x |
| 152 | let B := bilinearOfTwoTensor H |
| 153 | have hB (v w : TangentSpace (𝓡 2) x) : |
| 154 | D.hessian D.scalarCurvature x v w = B v w := hH ![v, w] |
| 155 | have hhess (i : Fin 2) : |
| 156 | D.hessian D.scalarCurvature x (f • e i) (f • e i) = |
| 157 | f ^ 2 * D.hessian D.scalarCurvature x (e i) (e i) := by |
| 158 | rw [hB, hB] |
| 159 | simp only [map_smul, LinearMap.smul_apply, smul_eq_mul] |
| 160 | ring |
| 161 | have hhess_trace : (∑ i, D.hessian D.scalarCurvature x (e i) (e i)) = |
| 162 | D.laplacian D.scalarCurvature x := by |
| 163 | simpa only [laplacian, hB] using |
| 164 | bilinear_sum_orthonormalBasis_eq B e (g.orthonormalBasis x) |
| 165 | have hcancel := D.sum_ricciDerivativePairing_surface_index_cancel x A s f e |
| 166 | simp only [Finset.sum_add_distrib, ← Finset.mul_sum] at hcancel |
| 167 | simp_rw [hnorm, hcurv, hhess] |
| 168 | simp only [Finset.sum_add_distrib, Finset.sum_sub_distrib, |
| 169 | ← mul_assoc, ← Finset.mul_sum, Finset.sum_const, Finset.card_univ, |
| 170 | Fintype.card_fin, nsmul_eq_mul] |
| 171 | rw [hcurv_trace, hhess_trace] |
| 172 | linear_combination hcancel |
| 173 | |
| 174 | end PoincareMT.LeviCivitaData |