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.Curvature.Calculus |
| 2 | import PoincareLib.Geometry.RicciFlow.Splitting.CurvatureNullity |
| 3 | import PoincareLib.Geometry.RicciFlow.Curvature.Theory |
| 4 | import PoincareLib.Geometry.Riemannian.Tensor.MaximumPrinciple.Contact |
| 5 | import PoincareLib.Geometry.Riemannian.Tensor.RicciDerivative |
| 6 | import PoincareLib.Geometry.Riemannian.ScalarOperators.Locality |
| 7 | |
| 8 | /-! |
| 9 | # Covariant derivatives of local Ricci-null sections |
| 10 | |
| 11 | The second covariant derivative on a local Ricci-null section is twice its |
| 12 | Ricci derivative energy. The Ricci-flow equation and a one-sided terminal |
| 13 | minimum force the trace of these nonnegative energies to vanish. |
| 14 | |
| 15 | This is the null-distribution calculation in Kleiner--Lott, Appendix A, |
| 16 | Theorem A.7, p. 2841, using the frozen M04 Ricci evolution identity. |
| 17 | -/ |
| 18 | |
| 19 | set_option autoImplicit false |
| 20 | set_option backward.isDefEq.respectTransparency false |
| 21 | |
| 22 | open Set Filter |
| 23 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 24 | |
| 25 | universe u |
| 26 | |
| 27 | namespace PoincareMT.RicciFlow.Splitting |
| 28 | |
| 29 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 30 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 31 | {g : RiemannianMetric n M} |
| 32 | |
| 33 | /-- Differentiating a local Ricci-null pairing retains the covariant |
| 34 | derivative of its null input. -/ |
| 35 | lemma covariantRicciDerivative_on_null_section |
| 36 | (D : LeviCivitaData g) (hD : D.CurvatureTensorCalculus) |
| 37 | (V : (y : M) → TangentSpace (𝓡 n) y) {x : M} |
| 38 | (hV : ContMDiffAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ (T% V) x) |
| 39 | (hnull : ∀ᶠ y in 𝓝 x, ∀ w, D.ricci y (V y) w = 0) |
| 40 | (a w : TangentSpace (𝓡 n) x) : |
| 41 | D.covariantTensorDerivative D.ricciEvaluation x ![a, V x, w] = |
| 42 | -D.ricci x (D.connection V x a) w := by |
| 43 | let W := FiberBundle.extend (EuclideanSpace ℝ (Fin n)) w |
| 44 | have hW := FiberBundle.contMDiffAt_extend (𝓡 n) (EuclideanSpace ℝ (Fin n)) (k := ∞) w |
| 45 | have heq : (fun y => D.ricci y (V y) (W y)) =ᶠ[𝓝 x] fun _ => 0 := |
| 46 | hnull.mono fun y hy => hy (W y) |
| 47 | have h := D.covariantTensorDerivative_two_on_fields hD.2.1 V W x |
| 48 | (hV.mdifferentiableAt (by simp)) (hW.mdifferentiableAt (by simp)) a |
| 49 | simp only [LeviCivitaData.ricciEvaluation, Matrix.cons_val_zero, Matrix.cons_val_one, |
| 50 | W, FiberBundle.extend_apply_self] at h |
| 51 | rw [Poincare.mvfderiv_eq_of_eventuallyEq heq, mvfderiv_const] at h |
| 52 | simpa only [zero_apply, hnull.self_of_nhds _, sub_zero, zero_sub] using h |
| 53 | |
| 54 | /-- The diagonal second derivative of Ricci on a local null section equals |
| 55 | twice the Ricci energy of its covariant derivative. -/ |
| 56 | theorem secondCovariantRicciDerivative_null_section |
| 57 | (D : LeviCivitaData g) (hD : D.CurvatureTensorCalculus) |
| 58 | (V : (y : M) → TangentSpace (𝓡 n) y) {x : M} |
| 59 | (hV : ContMDiffAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ (T% V) x) |
| 60 | (hnull : ∀ᶠ y in 𝓝 x, ∀ w, D.ricci y (V y) w = 0) |
| 61 | (a : TangentSpace (𝓡 n) x) : |
| 62 | D.covariantTensorDerivative (D.covariantTensorDerivative D.ricciEvaluation) |
| 63 | x ![a, a, V x, V x] = |
| 64 | 2 * D.ricci x (D.connection V x a) (D.connection V x a) := by |
| 65 | have hsym (y : M) (u v : TangentSpace (𝓡 n) y) : |
| 66 | D.ricci y u v = D.ricci y v u := (hD.2.2.2.1 y u v u v).2.2.2 |
| 67 | let Y := FiberBundle.extend (EuclideanSpace ℝ (Fin n)) a |
| 68 | let W : Fin 2 → (y : M) → TangentSpace (𝓡 n) y := fun _ => V |
| 69 | have hessian_zero : D.hessian (fun y => D.ricci y (V y) (V y)) x a a = 0 := by |
| 70 | rw [D.hessian_eq_of_eventuallyEq (hnull.mono fun y hy => hy (V y))] |
| 71 | simp [LeviCivitaData.hessian, LeviCivitaData.hessianOnFields, mvfderiv_const] |
| 72 | have h := D.secondCovariantTensorDerivative_on_fields hD.2.1 W x (fun _ => hV) a a |
| 73 | dsimp only [W] at h |
| 74 | simp only [Fin.sum_univ_two, LeviCivitaData.ricciEvaluation, |
| 75 | Function.update_self, Function.update_of_ne (by decide : (1 : Fin 2) ≠ 0), |
| 76 | Function.update_of_ne (by decide : (0 : Fin 2) ≠ 1)] at h |
| 77 | have hsum_deriv : mvfderiv (𝓡 n) (fun y => |
| 78 | D.ricci y (D.covariantDerivativeOnFields Y V y) (V y) + |
| 79 | D.ricci y (V y) (D.covariantDerivativeOnFields Y V y)) x a = 0 := by |
| 80 | have he : (fun y => D.ricci y (D.covariantDerivativeOnFields Y V y) (V y) + |
| 81 | D.ricci y (V y) (D.covariantDerivativeOnFields Y V y)) =ᶠ[𝓝 x] fun _ => 0 := by |
| 82 | filter_upwards [hnull] with y hy |
| 83 | simp only [hsym y _ (V y), hy, add_zero] |
| 84 | rw [Poincare.mvfderiv_eq_of_eventuallyEq he, mvfderiv_const] |
| 85 | rfl |
| 86 | have htuples (v z : TangentSpace (𝓡 n) x) : |
| 87 | Fin.cons a (Function.update (fun _ : Fin 2 => v) 0 z) = ![a, z, v] ∧ |
| 88 | Fin.cons a (Function.update (fun _ : Fin 2 => v) 1 z) = ![a, v, z] := by |
| 89 | constructor <;> ext i <;> fin_cases i <;> rfl |
| 90 | rw [(htuples _ _).1, (htuples _ _).2] at h |
| 91 | have hleft := covariantRicciDerivative_on_null_section D hD V hV hnull a |
| 92 | (D.connection V x a) |
| 93 | have hright := D.covariantTensorDerivative_ricciEvaluation_symm hD x a |
| 94 | (D.connection V x a) (V x) |
| 95 | have hmiddle : D.ricci x (D.connection V x (D.connection Y x a)) (V x) + |
| 96 | D.ricci x (V x) (D.connection V x (D.connection Y x a)) = 0 := by |
| 97 | simp only [hsym x _ (V x), hnull.self_of_nhds, add_zero] |
| 98 | have heval : Fin.cons a (Fin.cons a (fun _ : Fin 2 => V x)) = ![a, a, V x, V x] := by |
| 99 | ext i |
| 100 | fin_cases i <;> rfl |
| 101 | rw [heval] at h |
| 102 | rw [hessian_zero, hsum_deriv, hmiddle, hright, hleft] at h |
| 103 | linarith |
| 104 | |
| 105 | /-- The rough Ricci Laplacian on a local null section is a nonnegative sum |
| 106 | of covariant derivative energies when Ricci is positive semidefinite. -/ |
| 107 | theorem tensorLaplacian_ricci_null_section |
| 108 | (D : LeviCivitaData g) (hD : D.CurvatureTensorCalculus) |
| 109 | (V : (y : M) → TangentSpace (𝓡 n) y) {x : M} |
| 110 | (hV : ContMDiffAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ (T% V) x) |
| 111 | (hnull : ∀ᶠ y in 𝓝 x, ∀ w, D.ricci y (V y) w = 0) : |
| 112 | D.tensorLaplacian D.ricciEvaluation x ![V x, V x] = |
| 113 | 2 * ∑ i, D.ricci x (D.connection V x (g.orthonormalBasis x i)) |
| 114 | (D.connection V x (g.orthonormalBasis x i)) := by |
| 115 | rw [Finset.mul_sum] |
| 116 | unfold LeviCivitaData.tensorLaplacian |
| 117 | apply Finset.sum_congr rfl |
| 118 | intro i _ |
| 119 | exact secondCovariantRicciDerivative_null_section D hD V hV hnull _ |
| 120 | |
| 121 | /-- Every spatial covariant derivative of a smooth local terminal Ricci-null |
| 122 | section is Ricci-null. The terminal derivative sign comes from nonnegativity |
| 123 | at earlier times, and its value is the frozen M04 Ricci-flow equation. -/ |
| 124 | theorem ricci_connection_eq_zero_of_terminal_null |
| 125 | (hC : RicciFlowCurvatureCalculus.{u}) {a b : ℝ} (hab : a < b) |
| 126 | (F : RicciFlow n M (Icc a b)) |
| 127 | (hsec : ∀ t ∈ Icc a b, (F.connection t).NonnegativeSectionalCurvature) |
| 128 | (V : (y : M) → TangentSpace (𝓡 n) y) {x : M} |
| 129 | (hV : ContMDiffAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ (T% V) x) |
| 130 | (hnull : ∀ᶠ y in 𝓝 x, (F.connection b).ricci y (V y) (V y) = 0) |
| 131 | (u w : TangentSpace (𝓡 n) x) : |
| 132 | (F.connection b).ricci x ((F.connection b).connection V x u) w = 0 := by |
| 133 | let D := F.connection b |
| 134 | let g := F.metric b |
| 135 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 136 | ⟨g.toRiemannianMetric⟩ |
| 137 | have hb : b ∈ Icc a b := ⟨hab.le, le_rfl⟩ |
| 138 | have hD : D.CurvatureTensorCalculus := hC.tensor_calculus n M g D |
| 139 | have hRic (t : ℝ) (ht : t ∈ Icc a b) (y : M) (v : TangentSpace (𝓡 n) y) : |
| 140 | 0 ≤ (F.connection t).ricci y v v := |
| 141 | Finset.sum_nonneg fun i _ => hsec t ht y v ((F.metric t).orthonormalBasis y i) |
| 142 | have hn : ∀ᶠ y in 𝓝 x, ∀ z, D.ricci y (V y) z = 0 := by |
| 143 | filter_upwards [hnull] with y hy |
| 144 | exact ricci_eq_zero_of_nonneg_of_self_eq_zero D hD y (hRic b hb y) hy |
| 145 | have hd := hC.ricci_evolution n M (Icc a b) F b hb x (V x) (V x) |
| 146 | have hmin : IsLocalMinOn (fun t => (F.connection t).ricci x (V x) (V x)) |
| 147 | (Icc a b) b := by |
| 148 | rw [IsLocalMinOn] |
| 149 | filter_upwards [self_mem_nhdsWithin] with t ht |
| 150 | simpa only [hnull.self_of_nhds] using hRic t ht x (V x) |
| 151 | have hcone : a - b ∈ posTangentConeAt (Icc a b) b := |
| 152 | sub_mem_posTangentConeAt_of_segment_subset |
| 153 | ((convex_Icc a b).segment_subset hb ⟨le_rfl, hab.le⟩) |
| 154 | have hsign := hmin.hasFDerivWithinAt_nonneg hd.hasFDerivWithinAt hcone |
| 155 | simp only [ContinuousLinearMap.toSpanSingleton_apply, smul_eq_mul] at hsign |
| 156 | have hreact : D.ricciReaction x (V x) (V x) = 0 := |
| 157 | ricciReaction_eq_zero_of_ricci_self_eq_zero D hD x (hsec b hb x) |
| 158 | hnull.self_of_nhds (V x) |
| 159 | have henergy := tensorLaplacian_ricci_null_section D hD V hV hn |
| 160 | change 0 ≤ (a - b) * (D.tensorLaplacian D.ricciEvaluation x ![V x, V x] + |
| 161 | D.ricciReaction x (V x) (V x)) at hsign |
| 162 | rw [hreact, add_zero, henergy] at hsign |
| 163 | have hsum : (∑ i, D.ricci x (D.connection V x (g.orthonormalBasis x i)) |
| 164 | (D.connection V x (g.orthonormalBasis x i))) = 0 := by |
| 165 | have hnonneg := Finset.sum_nonneg fun i (_ : i ∈ Finset.univ) => |
| 166 | hRic b hb x (D.connection V x (g.orthonormalBasis x i)) |
| 167 | nlinarith |
| 168 | have hdiag (i) : D.ricci x (D.connection V x (g.orthonormalBasis x i)) |
| 169 | (D.connection V x (g.orthonormalBasis x i)) = 0 := |
| 170 | (Finset.sum_eq_zero_iff_of_nonneg (fun j _ => hRic b hb x |
| 171 | (D.connection V x (g.orthonormalBasis x j)))).mp hsum i (Finset.mem_univ i) |
| 172 | have hbasis (i) : D.ricci x (D.connection V x (g.orthonormalBasis x i)) w = 0 := |
| 173 | ricci_eq_zero_of_nonneg_of_self_eq_zero D hD x (hRic b hb x) (hdiag i) w |
| 174 | let B := ∑ i, D.curvatureTensor_bilinear_first_third x |
| 175 | (g.orthonormalBasis x i) (g.orthonormalBasis x i) |
| 176 | have hB (v z : TangentSpace (𝓡 n) x) : B v z = D.ricci x v z := by |
| 177 | simp [B, LeviCivitaData.ricci, LinearMap.sum_apply, g] |
| 178 | let L := (B.flip w).comp (D.connection V x).toLinearMap |
| 179 | have hL (v : TangentSpace (𝓡 n) x) : L v = D.ricci x (D.connection V x v) w := by |
| 180 | change B ((D.connection V x) v) w = _ |
| 181 | exact hB _ _ |
| 182 | have hLb (i) : L (g.orthonormalBasis x i) = 0 := (hL _).trans (hbasis i) |
| 183 | have hLu : L u = 0 := by |
| 184 | rw [← (g.orthonormalBasis x).sum_repr' u] |
| 185 | simp only [map_sum, map_smul, hLb, smul_zero, Finset.sum_const_zero] |
| 186 | exact (hL u).symm.trans hLu |
| 187 | |
| 188 | end PoincareMT.RicciFlow.Splitting |