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.Estimates.ScalarTrace |
| 2 | import PoincareLib.Geometry.RicciFlow.Curvature.Calculus.Tensors.TensorMetricTrace |
| 3 | import PoincareLib.Geometry.RicciFlow.Curvature.Calculus.Identities.SecondBianchi |
| 4 | import PoincareLib.Geometry.Riemannian.ScalarOperators |
| 5 | import Mathlib.Logic.Equiv.Fin.Basic |
| 6 | |
| 7 | /-! Adapted from Mapher06/Poincare-MorganTian, `PoincareMT/Proofs/M04/ScalarContractions.lean`, |
| 8 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. See the curvature import record under |
| 9 | `references/ricci-flow/mapher/curvature/`. -/ |
| 10 | |
| 11 | /-! |
| 12 | # Spatial contractions for scalar evolution |
| 13 | |
| 14 | Derivative slots remain fixed while tensor slots are permuted or traced. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | |
| 19 | open scoped Manifold ContDiff Bundle |
| 20 | open Topology Filter |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.RicciFlowAnalysis |
| 25 | |
| 26 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 28 | |
| 29 | private theorem append_one_tuple {α : Type*} (v : Fin 1 → α) (a b : α) : |
| 30 | Fin.append v ![a, b] = ![v 0, a, b] := by |
| 31 | funext i |
| 32 | fin_cases i <;> rfl |
| 33 | |
| 34 | private theorem append_two_tuple {α : Type*} (v : Fin 2 → α) (a b : α) : |
| 35 | Fin.append v ![a, b] = ![v 0, v 1, a, b] := by |
| 36 | funext i |
| 37 | fin_cases i <;> rfl |
| 38 | |
| 39 | private theorem append_three_tuple {α : Type*} (v : Fin 3 → α) (a b : α) : |
| 40 | Fin.append v ![a, b] = ![v 0, v 1, v 2, a, b] := by |
| 41 | funext i |
| 42 | fin_cases i <;> rfl |
| 43 | |
| 44 | def tensorPermute {k : ℕ} (T : CovariantTensorEvaluation n M k) |
| 45 | (s : Equiv.Perm (Fin k)) : CovariantTensorEvaluation n M k := |
| 46 | fun x v ↦ T x (v ∘ s) |
| 47 | |
| 48 | theorem isSmoothCovariantTensor_tensorPermute {k : ℕ} |
| 49 | {T : CovariantTensorEvaluation n M k} (hT : IsSmoothCovariantTensor T) |
| 50 | (s : Equiv.Perm (Fin k)) : IsSmoothCovariantTensor (tensorPermute T s) := by |
| 51 | constructor |
| 52 | · intro x |
| 53 | obtain ⟨L, hL⟩ := hT.1 x |
| 54 | exact ⟨L.domDomCongr s, fun v ↦ hL (v ∘ s)⟩ |
| 55 | · intro U hU V hV |
| 56 | exact hT.2 U hU (fun i ↦ V (s i)) (fun i ↦ hV (s i)) |
| 57 | |
| 58 | set_option backward.isDefEq.respectTransparency false in |
| 59 | theorem covariantTensorDerivative_tensorPermute {g : RiemannianMetric n M} |
| 60 | (D : LeviCivitaData g) {k : ℕ} {T : CovariantTensorEvaluation n M k} |
| 61 | (_hT : IsSmoothCovariantTensor T) (s : Equiv.Perm (Fin k)) |
| 62 | (x : M) (a : TangentSpace (𝓡 n) x) (v : Fin k → TangentSpace (𝓡 n) x) : |
| 63 | D.covariantTensorDerivative (tensorPermute T s) x (Fin.cons a v) = |
| 64 | D.covariantTensorDerivative T x (Fin.cons a (v ∘ s)) := by |
| 65 | classical |
| 66 | simp only [LeviCivitaData.covariantTensorDerivative, tensorPermute, |
| 67 | Fin.cons_zero, Fin.cons_succ] |
| 68 | congr 1 |
| 69 | refine Fintype.sum_equiv s.symm _ _ ?_ |
| 70 | intro i |
| 71 | simp only [Function.comp_def, s.apply_symm_apply] |
| 72 | apply congrArg (T x) |
| 73 | change (Function.update v i (D.connection (FiberBundle.extend _ (v i)) x a)) ∘ s = _ |
| 74 | exact Function.update_comp_equiv _ _ _ _ |
| 75 | |
| 76 | private def liftTensorPermutation {k : ℕ} (s : Equiv.Perm (Fin k)) : |
| 77 | Equiv.Perm (Fin (k + 1)) := |
| 78 | (finSuccEquiv k).trans ((Equiv.optionCongr s).trans (finSuccEquiv k).symm) |
| 79 | |
| 80 | private theorem cons_comp_lift {α : Type*} {k : ℕ} (s : Equiv.Perm (Fin k)) |
| 81 | (a : α) (v : Fin k → α) : |
| 82 | Fin.cons a v ∘ liftTensorPermutation s = Fin.cons a (v ∘ s) := by |
| 83 | funext i |
| 84 | cases i using Fin.cases <;> simp [liftTensorPermutation, Function.comp_def] |
| 85 | |
| 86 | set_option backward.isDefEq.respectTransparency false in |
| 87 | theorem secondCovariantTensorDerivative_tensorPermute {g : RiemannianMetric n M} |
| 88 | (D : LeviCivitaData g) {k : ℕ} {T : CovariantTensorEvaluation n M k} |
| 89 | (hT : IsSmoothCovariantTensor T) (s : Equiv.Perm (Fin k)) |
| 90 | (x : M) (a b : TangentSpace (𝓡 n) x) (v : Fin k → TangentSpace (𝓡 n) x) : |
| 91 | D.iteratedCovariantTensorDerivative (tensorPermute T s) 2 x |
| 92 | (Fin.cons a (Fin.cons b v)) = |
| 93 | D.iteratedCovariantTensorDerivative T 2 x (Fin.cons a (Fin.cons b (v ∘ s))) := by |
| 94 | have he : D.covariantTensorDerivative (tensorPermute T s) = |
| 95 | tensorPermute (D.covariantTensorDerivative T) (liftTensorPermutation s) := by |
| 96 | funext y w |
| 97 | conv_lhs => rw [← Fin.cons_self_tail w] |
| 98 | rw [covariantTensorDerivative_tensorPermute D hT] |
| 99 | change _ = D.covariantTensorDerivative T y (w ∘ liftTensorPermutation s) |
| 100 | conv_rhs => rw [← Fin.cons_self_tail w] |
| 101 | rw [cons_comp_lift] |
| 102 | simp only [LeviCivitaData.iteratedCovariantTensorDerivative, he] |
| 103 | rw [covariantTensorDerivative_tensorPermute D |
| 104 | (isSmoothCovariantTensor_covariantTensorDerivative D hT), cons_comp_lift] |
| 105 | |
| 106 | private def scalarTensor (f : M → ℝ) : CovariantTensorEvaluation n M 0 := |
| 107 | fun x _ ↦ f x |
| 108 | |
| 109 | private theorem derivative_scalarTensor {g : RiemannianMetric n M} |
| 110 | (D : LeviCivitaData g) (f : M → ℝ) (x : M) |
| 111 | (v : Fin 1 → TangentSpace (𝓡 n) x) : |
| 112 | D.covariantTensorDerivative (scalarTensor f) x v = mvfderiv (𝓡 n) f x (v 0) := by |
| 113 | simp [LeviCivitaData.covariantTensorDerivative, scalarTensor] |
| 114 | |
| 115 | private theorem second_derivative_scalarTensor {g : RiemannianMetric n M} |
| 116 | (D : LeviCivitaData g) (f : M → ℝ) (x : M) |
| 117 | (v : Fin 2 → TangentSpace (𝓡 n) x) : |
| 118 | D.covariantTensorDerivative (D.covariantTensorDerivative (scalarTensor f)) x v = |
| 119 | D.hessian f x (v 0) (v 1) := by |
| 120 | rw [LeviCivitaData.covariantTensorDerivative] |
| 121 | simp only [derivative_scalarTensor, Fin.sum_univ_succ, Fin.sum_univ_zero, |
| 122 | Function.update_self, LeviCivitaData.hessian, LeviCivitaData.hessianOnFields, |
| 123 | FiberBundle.extend_apply_self, add_zero] |
| 124 | rfl |
| 125 | |
| 126 | private theorem tensorTraceLast_ricci {g : RiemannianMetric n M} (D : LeviCivitaData g) : |
| 127 | tensorTraceLast g D.ricciEvaluation = scalarTensor D.scalarCurvature := by |
| 128 | funext x v |
| 129 | have hv : v = Fin.elim0 := funext fun i ↦ Fin.elim0 i |
| 130 | rw [hv] |
| 131 | simp [tensorTraceLast, scalarTensor, LeviCivitaData.ricciEvaluation, |
| 132 | LeviCivitaData.scalarCurvature] |
| 133 | |
| 134 | theorem ricci_covariantDerivative_symm {g : RiemannianMetric n M} |
| 135 | (D : LeviCivitaData g) (x : M) (a b c : TangentSpace (𝓡 n) x) : |
| 136 | D.covariantTensorDerivative D.ricciEvaluation x ![a, b, c] = |
| 137 | D.covariantTensorDerivative D.ricciEvaluation x ![a, c, b] := by |
| 138 | classical |
| 139 | let s := Equiv.swap (0 : Fin 2) 1 |
| 140 | have he : tensorPermute D.ricciEvaluation s = D.ricciEvaluation := by |
| 141 | funext y w |
| 142 | change D.ricci y (w (s 0)) (w (s 1)) = D.ricci y (w 0) (w 1) |
| 143 | simp only [s, Equiv.swap_apply_left, Equiv.swap_apply_right] |
| 144 | exact ricci_symm D y _ _ |
| 145 | have hv : ![b, c] ∘ s = ![c, b] := by |
| 146 | funext i |
| 147 | fin_cases i <;> simp [s] |
| 148 | have hp := covariantTensorDerivative_tensorPermute D |
| 149 | (isSmoothCovariantTensor_ricciEvaluation D) s x a ![b, c] |
| 150 | rw [he, hv] at hp |
| 151 | exact hp |
| 152 | |
| 153 | theorem ricci_secondCovariantDerivative_symm {g : RiemannianMetric n M} |
| 154 | (D : LeviCivitaData g) (x : M) (a b c d : TangentSpace (𝓡 n) x) : |
| 155 | D.iteratedCovariantTensorDerivative D.ricciEvaluation 2 x ![a, b, c, d] = |
| 156 | D.iteratedCovariantTensorDerivative D.ricciEvaluation 2 x ![a, b, d, c] := by |
| 157 | classical |
| 158 | let s := Equiv.swap (0 : Fin 2) 1 |
| 159 | have he : tensorPermute D.ricciEvaluation s = D.ricciEvaluation := by |
| 160 | funext y w |
| 161 | change D.ricci y (w (s 0)) (w (s 1)) = D.ricci y (w 0) (w 1) |
| 162 | simp only [s, Equiv.swap_apply_left, Equiv.swap_apply_right] |
| 163 | exact ricci_symm D y _ _ |
| 164 | have hv : ![c, d] ∘ s = ![d, c] := by |
| 165 | funext i |
| 166 | fin_cases i <;> simp [s] |
| 167 | have hp := secondCovariantTensorDerivative_tensorPermute D |
| 168 | (isSmoothCovariantTensor_ricciEvaluation D) s x a b ![c, d] |
| 169 | rw [he, hv] at hp |
| 170 | exact hp |
| 171 | |
| 172 | theorem ricci_covariantDerivative_metric_trace {g : RiemannianMetric n M} |
| 173 | (D : LeviCivitaData g) (x : M) (a : TangentSpace (𝓡 n) x) : |
| 174 | (∑ i, D.covariantTensorDerivative D.ricciEvaluation x |
| 175 | ![a, g.orthonormalBasis x i, g.orthonormalBasis x i]) = |
| 176 | mvfderiv (𝓡 n) D.scalarCurvature x a := by |
| 177 | have ht := covariantTensorDerivative_tensorTraceLast D |
| 178 | (isSmoothCovariantTensor_ricciEvaluation D) x ![a] |
| 179 | rw [tensorTraceLast_ricci, derivative_scalarTensor] at ht |
| 180 | simpa only [tensorTraceLast, append_one_tuple, Matrix.cons_val_zero] using ht.symm |
| 181 | |
| 182 | set_option maxHeartbeats 1000000 in |
| 183 | -- Commuting the second derivative with the Ricci trace needs extra elaboration. |
| 184 | set_option backward.isDefEq.respectTransparency false in |
| 185 | theorem ricci_secondCovariantDerivative_metric_trace {g : RiemannianMetric n M} |
| 186 | (D : LeviCivitaData g) (x : M) (a b : TangentSpace (𝓡 n) x) : |
| 187 | (∑ i, D.iteratedCovariantTensorDerivative D.ricciEvaluation 2 x |
| 188 | ![a, b, g.orthonormalBasis x i, g.orthonormalBasis x i]) = |
| 189 | D.hessian D.scalarCurvature x a b := by |
| 190 | have he : D.covariantTensorDerivative (tensorTraceLast g D.ricciEvaluation) = |
| 191 | tensorTraceLast g (D.covariantTensorDerivative D.ricciEvaluation) := by |
| 192 | funext y w |
| 193 | exact covariantTensorDerivative_tensorTraceLast D |
| 194 | (isSmoothCovariantTensor_ricciEvaluation D) y w |
| 195 | have ht := covariantTensorDerivative_tensorTraceLast D |
| 196 | (isSmoothCovariantTensor_covariantTensorDerivative D |
| 197 | (isSmoothCovariantTensor_ricciEvaluation D)) x ![a, b] |
| 198 | rw [← he, tensorTraceLast_ricci, second_derivative_scalarTensor] at ht |
| 199 | simpa only [tensorTraceLast, append_two_tuple, Matrix.cons_val_zero, Matrix.cons_val_one, |
| 200 | LeviCivitaData.iteratedCovariantTensorDerivative] using ht.symm |
| 201 | |
| 202 | set_option backward.isDefEq.respectTransparency false in |
| 203 | private theorem derivative_tensor_neg {g : RiemannianMetric n M} |
| 204 | (D : LeviCivitaData g) {k : ℕ} (T : CovariantTensorEvaluation n M k) |
| 205 | (x : M) (v : Fin (k + 1) → TangentSpace (𝓡 n) x) : |
| 206 | D.covariantTensorDerivative (fun y w ↦ -T y w) x v = |
| 207 | -D.covariantTensorDerivative T x v := by |
| 208 | simp only [LeviCivitaData.covariantTensorDerivative, mvfderiv_fun_neg, |
| 209 | neg_apply, Finset.sum_neg_distrib] |
| 210 | ring |
| 211 | |
| 212 | private theorem riemann_derivative_swap_first {g : RiemannianMetric n M} |
| 213 | (D : LeviCivitaData g) (x : M) (a b c d e : TangentSpace (𝓡 n) x) : |
| 214 | D.covariantTensorDerivative D.riemannEvaluation x ![a, b, c, d, e] = |
| 215 | -D.covariantTensorDerivative D.riemannEvaluation x ![a, c, b, d, e] := by |
| 216 | classical |
| 217 | let s := Equiv.swap (0 : Fin 4) 1 |
| 218 | have he : tensorPermute D.riemannEvaluation s = fun y w ↦ -D.riemannEvaluation y w := by |
| 219 | funext y w |
| 220 | change D.curvatureTensor y (w (s 0)) (w (s 1)) (w (s 2)) (w (s 3)) = _ |
| 221 | have hs : s 0 = 1 ∧ s 1 = 0 ∧ s 2 = 2 ∧ s 3 = 3 := by decide |
| 222 | rw [hs.1, hs.2.1, hs.2.2.1, hs.2.2.2] |
| 223 | exact curvatureTensor_swap_first D y (w 0) (w 1) (w 2) (w 3) |
| 224 | have hv : ![b, c, d, e] ∘ s = ![c, b, d, e] := by |
| 225 | funext i |
| 226 | fin_cases i <;> simp [s, Equiv.swap_apply_def] |
| 227 | have hp := covariantTensorDerivative_tensorPermute D |
| 228 | (isSmoothCovariantTensor_riemannEvaluation D) s x a ![b, c, d, e] |
| 229 | rw [he, derivative_tensor_neg, hv] at hp |
| 230 | change -D.covariantTensorDerivative D.riemannEvaluation x ![a, b, c, d, e] = |
| 231 | D.covariantTensorDerivative D.riemannEvaluation x ![a, c, b, d, e] at hp |
| 232 | linarith only [hp] |
| 233 | |
| 234 | private theorem riemann_derivative_swap_last {g : RiemannianMetric n M} |
| 235 | (D : LeviCivitaData g) (x : M) (a b c d e : TangentSpace (𝓡 n) x) : |
| 236 | D.covariantTensorDerivative D.riemannEvaluation x ![a, b, c, d, e] = |
| 237 | -D.covariantTensorDerivative D.riemannEvaluation x ![a, b, c, e, d] := by |
| 238 | classical |
| 239 | let s := Equiv.swap (2 : Fin 4) 3 |
| 240 | have he : tensorPermute D.riemannEvaluation s = fun y w ↦ -D.riemannEvaluation y w := by |
| 241 | funext y w |
| 242 | change D.curvatureTensor y (w (s 0)) (w (s 1)) (w (s 2)) (w (s 3)) = _ |
| 243 | have hs : s 0 = 0 ∧ s 1 = 1 ∧ s 2 = 3 ∧ s 3 = 2 := by decide |
| 244 | rw [hs.1, hs.2.1, hs.2.2.1, hs.2.2.2] |
| 245 | exact curvatureTensor_swap_last D y (w 0) (w 1) (w 3) (w 2) |
| 246 | have hv : ![b, c, d, e] ∘ s = ![b, c, e, d] := by |
| 247 | funext i |
| 248 | fin_cases i <;> simp [s, Equiv.swap_apply_def] |
| 249 | have hp := covariantTensorDerivative_tensorPermute D |
| 250 | (isSmoothCovariantTensor_riemannEvaluation D) s x a ![b, c, d, e] |
| 251 | rw [he, derivative_tensor_neg, hv] at hp |
| 252 | change -D.covariantTensorDerivative D.riemannEvaluation x ![a, b, c, d, e] = |
| 253 | D.covariantTensorDerivative D.riemannEvaluation x ![a, b, c, e, d] at hp |
| 254 | linarith only [hp] |
| 255 | |
| 256 | theorem ricci_covariantDerivative_curvature_trace {g : RiemannianMetric n M} |
| 257 | (D : LeviCivitaData g) (x : M) (a b c : TangentSpace (𝓡 n) x) : |
| 258 | D.covariantTensorDerivative D.ricciEvaluation x ![a, b, c] = |
| 259 | ∑ i, D.covariantTensorDerivative D.riemannEvaluation x |
| 260 | ![a, b, g.orthonormalBasis x i, c, g.orthonormalBasis x i] := by |
| 261 | classical |
| 262 | let s := Equiv.swap (1 : Fin 4) 2 |
| 263 | have he : tensorTraceLast g (tensorPermute D.riemannEvaluation s) = D.ricciEvaluation := by |
| 264 | funext y w |
| 265 | simp [tensorTraceLast, tensorPermute, append_two_tuple, s, Equiv.swap_apply_def, |
| 266 | LeviCivitaData.riemannEvaluation, LeviCivitaData.ricciEvaluation, |
| 267 | LeviCivitaData.ricci] |
| 268 | have hv (d e : TangentSpace (𝓡 n) x) : ![b, c, d, e] ∘ s = ![b, d, c, e] := by |
| 269 | funext i |
| 270 | fin_cases i <;> simp [s, Equiv.swap_apply_def] |
| 271 | have hterm (i) : |
| 272 | D.covariantTensorDerivative (tensorPermute D.riemannEvaluation s) x |
| 273 | ![a, b, c, g.orthonormalBasis x i, g.orthonormalBasis x i] = |
| 274 | D.covariantTensorDerivative D.riemannEvaluation x |
| 275 | ![a, b, g.orthonormalBasis x i, c, g.orthonormalBasis x i] := by |
| 276 | have hp := covariantTensorDerivative_tensorPermute D |
| 277 | (isSmoothCovariantTensor_riemannEvaluation D) s x a |
| 278 | ![b, c, g.orthonormalBasis x i, g.orthonormalBasis x i] |
| 279 | rw [hv] at hp |
| 280 | exact hp |
| 281 | have ht := covariantTensorDerivative_tensorTraceLast D |
| 282 | (isSmoothCovariantTensor_tensorPermute (isSmoothCovariantTensor_riemannEvaluation D) s) |
| 283 | x ![a, b, c] |
| 284 | rw [he] at ht |
| 285 | simpa only [tensorTraceLast, append_three_tuple, Matrix.cons_val_zero, |
| 286 | Matrix.cons_val_one, Matrix.cons_val_two, Matrix.head_cons, Matrix.tail_cons, hterm] using ht |
| 287 | |
| 288 | set_option maxHeartbeats 1200000 in |
| 289 | -- The Bianchi contraction and finite trace sums need extra elaboration. |
| 290 | theorem ricci_covariantDerivative_contracted {g : RiemannianMetric n M} |
| 291 | (D : LeviCivitaData g) (x : M) (a : TangentSpace (𝓡 n) x) : |
| 292 | (∑ i, D.covariantTensorDerivative D.ricciEvaluation x |
| 293 | ![g.orthonormalBasis x i, g.orthonormalBasis x i, a]) = |
| 294 | (1 / 2 : ℝ) * mvfderiv (𝓡 n) D.scalarCurvature x a := by |
| 295 | classical |
| 296 | let e := g.orthonormalBasis x |
| 297 | let Q := D.covariantTensorDerivative D.riemannEvaluation x |
| 298 | let K := D.covariantTensorDerivative D.ricciEvaluation x |
| 299 | have h0 : (∑ i, ∑ j, (Q ![a, e i, e j, e i, e j] + |
| 300 | Q ![e i, e j, a, e i, e j] + Q ![e j, a, e i, e i, e j])) = 0 := by |
| 301 | have he (i j) : Q ![a, e i, e j, e i, e j] + |
| 302 | Q ![e i, e j, a, e i, e j] + Q ![e j, a, e i, e i, e j] = 0 := |
| 303 | riemann_second_bianchi D x a (e i) (e j) (e i) (e j) |
| 304 | simp only [he, Finset.sum_const_zero] |
| 305 | have h1 : (∑ i, ∑ j, Q ![a, e i, e j, e i, e j]) = |
| 306 | mvfderiv (𝓡 n) D.scalarCurvature x a := by |
| 307 | calc |
| 308 | _ = ∑ i, K ![a, e i, e i] := by |
| 309 | apply Finset.sum_congr rfl |
| 310 | intro i _ |
| 311 | exact (ricci_covariantDerivative_curvature_trace D x a (e i) (e i)).symm |
| 312 | _ = _ := ricci_covariantDerivative_metric_trace D x a |
| 313 | have h2 : (∑ i, ∑ j, Q ![e i, e j, a, e i, e j]) = |
| 314 | -(∑ i, K ![e i, e i, a]) := by |
| 315 | rw [← Finset.sum_neg_distrib] |
| 316 | apply Finset.sum_congr rfl |
| 317 | intro i _ |
| 318 | calc |
| 319 | _ = -(∑ j, Q ![e i, a, e j, e i, e j]) := by |
| 320 | rw [← Finset.sum_neg_distrib] |
| 321 | apply Finset.sum_congr rfl |
| 322 | intro j _ |
| 323 | exact riemann_derivative_swap_first D x (e i) (e j) a (e i) (e j) |
| 324 | _ = -K ![e i, a, e i] := by |
| 325 | rw [← ricci_covariantDerivative_curvature_trace D x (e i) a (e i)] |
| 326 | _ = _ := congrArg Neg.neg (ricci_covariantDerivative_symm D x (e i) a (e i)) |
| 327 | have h3 : (∑ i, ∑ j, Q ![e j, a, e i, e i, e j]) = |
| 328 | -(∑ i, K ![e i, e i, a]) := by |
| 329 | rw [Finset.sum_comm, ← Finset.sum_neg_distrib] |
| 330 | apply Finset.sum_congr rfl |
| 331 | intro j _ |
| 332 | calc |
| 333 | _ = -(∑ i, Q ![e j, a, e i, e j, e i]) := by |
| 334 | rw [← Finset.sum_neg_distrib] |
| 335 | apply Finset.sum_congr rfl |
| 336 | intro i _ |
| 337 | exact riemann_derivative_swap_last D x (e j) a (e i) (e i) (e j) |
| 338 | _ = -K ![e j, a, e j] := by |
| 339 | rw [← ricci_covariantDerivative_curvature_trace D x (e j) a (e j)] |
| 340 | _ = _ := congrArg Neg.neg (ricci_covariantDerivative_symm D x (e j) a (e j)) |
| 341 | simp only [Finset.sum_add_distrib, h1, h2, h3] at h0 |
| 342 | change (∑ i, K ![e i, e i, a]) = _ |
| 343 | linarith only [h0] |
| 344 | |
| 345 | set_option maxHeartbeats 1500000 in |
| 346 | -- Differentiating the contracted identity and permuting slots needs extra elaboration. |
| 347 | set_option backward.isDefEq.respectTransparency false in |
| 348 | theorem ricci_secondCovariantDerivative_contracted {g : RiemannianMetric n M} |
| 349 | (D : LeviCivitaData g) (x : M) (a b : TangentSpace (𝓡 n) x) : |
| 350 | (∑ i, D.iteratedCovariantTensorDerivative D.ricciEvaluation 2 x |
| 351 | ![a, g.orthonormalBasis x i, g.orthonormalBasis x i, b]) = |
| 352 | (1 / 2 : ℝ) * D.hessian D.scalarCurvature x a b := by |
| 353 | classical |
| 354 | let K := D.covariantTensorDerivative D.ricciEvaluation |
| 355 | have hK : IsSmoothCovariantTensor K := |
| 356 | isSmoothCovariantTensor_covariantTensorDerivative D (isSmoothCovariantTensor_ricciEvaluation D) |
| 357 | let s := (Equiv.swap (1 : Fin 3) 2).trans (Equiv.swap (0 : Fin 3) 1) |
| 358 | let P := tensorPermute K s |
| 359 | let S0 := scalarTensor (n := n) D.scalarCurvature |
| 360 | let S1 := D.covariantTensorDerivative S0 |
| 361 | have hS0 : IsSmoothCovariantTensor S0 := by |
| 362 | dsimp only [S0] |
| 363 | rw [← tensorTraceLast_ricci D] |
| 364 | exact isSmoothCovariantTensor_tensorTraceLast g (isSmoothCovariantTensor_ricciEvaluation D) |
| 365 | have hS1 : IsSmoothCovariantTensor S1 := isSmoothCovariantTensor_covariantTensorDerivative D hS0 |
| 366 | have he : tensorTraceLast g P = fun y v ↦ (1 / 2 : ℝ) * S1 y v := by |
| 367 | funext y v |
| 368 | have hv (c : TangentSpace (𝓡 n) y) : |
| 369 | Fin.append v ![c, c] ∘ s = ![c, c, v 0] := by |
| 370 | funext i |
| 371 | fin_cases i <;> simp [s, Equiv.swap_apply_def, |
| 372 | append_one_tuple] |
| 373 | change (∑ i, K y (Fin.append v ![g.orthonormalBasis y i, g.orthonormalBasis y i] ∘ s)) = |
| 374 | (1 / 2 : ℝ) * D.covariantTensorDerivative (scalarTensor D.scalarCurvature) y v |
| 375 | simp only [hv, derivative_scalarTensor] |
| 376 | exact ricci_covariantDerivative_contracted D y (v 0) |
| 377 | let E := EuclideanSpace ℝ (Fin n) |
| 378 | let e := trivializationAt E (TangentSpace (𝓡 n) : M → Type _) x |
| 379 | let B := FiberBundle.extend E b |
| 380 | have hx : x ∈ e.baseSet := FiberBundle.mem_baseSet_trivializationAt' x |
| 381 | have hB : ContMDiffOn (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, E)) ∞ (T% B) e.baseSet := |
| 382 | contMDiffOn_extend_baseSet b |
| 383 | have hW (i : Fin 1) : ContMDiffOn (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, E)) |
| 384 | ∞ (T% (![B] i)) e.baseSet := by |
| 385 | fin_cases i |
| 386 | exact hB |
| 387 | have hf : MDifferentiableAt (𝓡 n) 𝓘(ℝ, ℝ) (fun y ↦ S1 y ![B y]) x := by |
| 388 | have hs := hS1.2 e.baseSet e.open_baseSet ![B] hW |
| 389 | have hp (y : M) : (fun i ↦ ![B] i y) = ![B y] := by |
| 390 | funext i |
| 391 | fin_cases i |
| 392 | rfl |
| 393 | simp only [hp] at hs |
| 394 | exact (hs.contMDiffAt (e.open_baseSet.mem_nhds hx)).mdifferentiableAt (by simp) |
| 395 | have hRaw (T : CovariantTensorEvaluation n M 1) : |
| 396 | D.covariantTensorDerivative T x ![a, b] = |
| 397 | mvfderiv (𝓡 n) (fun y ↦ T y ![B y]) x a - |
| 398 | T x ![D.connection B x a] := by |
| 399 | have htail (y : M) : |
| 400 | (fun i : Fin 1 ↦ FiberBundle.extend (EuclideanSpace ℝ (Fin n)) |
| 401 | (![a, b] i.succ) y) = ![B y] := by |
| 402 | funext i |
| 403 | fin_cases i |
| 404 | rfl |
| 405 | have hfun : (fun y ↦ T y (fun i : Fin 1 ↦ |
| 406 | FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (![a, b] i.succ) y)) = |
| 407 | (fun y ↦ T y ![B y]) := by |
| 408 | funext y |
| 409 | exact congrArg (T y) (htail y) |
| 410 | have hu (z : TangentSpace (𝓡 n) x) : |
| 411 | Function.update (fun j : Fin 1 ↦ ![a, b] j.succ) 0 z = ![z] := by |
| 412 | funext i |
| 413 | fin_cases i |
| 414 | simp |
| 415 | simp only [LeviCivitaData.covariantTensorDerivative, Fin.sum_univ_succ, |
| 416 | Fin.sum_univ_zero, Matrix.cons_val_zero, hu, add_zero] |
| 417 | rw [hfun] |
| 418 | rfl |
| 419 | have hscale : D.covariantTensorDerivative (fun y v ↦ (1 / 2 : ℝ) * S1 y v) x ![a, b] = |
| 420 | (1 / 2 : ℝ) * D.covariantTensorDerivative S1 x ![a, b] := by |
| 421 | rw [hRaw, hRaw] |
| 422 | have hd : mvfderiv (𝓡 n) (fun y ↦ (1 / 2 : ℝ) * S1 y ![B y]) x a = |
| 423 | (1 / 2 : ℝ) * mvfderiv (𝓡 n) (fun y ↦ S1 y ![B y]) x a := by |
| 424 | erw [mvfderiv_fun_mul (mdifferentiableAt_const (c := (1 / 2 : ℝ))) hf] |
| 425 | simp only [mvfderiv_const, add_apply, smul_apply, smul_eq_mul, zero_apply, |
| 426 | mul_zero, add_zero] |
| 427 | rw [hd] |
| 428 | ring |
| 429 | have hL : D.covariantTensorDerivative (tensorTraceLast g P) x ![a, b] = |
| 430 | (1 / 2 : ℝ) * D.hessian D.scalarCurvature x a b := by |
| 431 | rw [he, hscale] |
| 432 | change (1 / 2 : ℝ) * D.covariantTensorDerivative |
| 433 | (D.covariantTensorDerivative (scalarTensor D.scalarCurvature)) x ![a, b] = _ |
| 434 | rw [second_derivative_scalarTensor] |
| 435 | rfl |
| 436 | have hv (c d : TangentSpace (𝓡 n) x) : ![b, c, d] ∘ s = ![c, d, b] := by |
| 437 | funext i |
| 438 | fin_cases i <;> simp [s, Equiv.swap_apply_def] |
| 439 | have hterm (c : TangentSpace (𝓡 n) x) : |
| 440 | D.covariantTensorDerivative (tensorPermute K s) x ![a, b, c, c] = |
| 441 | D.covariantTensorDerivative K x ![a, c, c, b] := by |
| 442 | have hp := covariantTensorDerivative_tensorPermute D hK s x a ![b, c, c] |
| 443 | rw [hv] at hp |
| 444 | exact hp |
| 445 | have ht := covariantTensorDerivative_tensorTraceLast D |
| 446 | (isSmoothCovariantTensor_tensorPermute hK s) x ![a, b] |
| 447 | rw [hL] at ht |
| 448 | simp only [tensorTraceLast, append_two_tuple, Matrix.cons_val_zero, |
| 449 | Matrix.cons_val_one] at ht |
| 450 | simpa only [hterm, K, LeviCivitaData.iteratedCovariantTensorDerivative] using ht.symm |
| 451 | |
| 452 | end PoincareMT.RicciFlowAnalysis |
| 453 |