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.Positivity.GeometricContact |
| 2 | import PoincareLib.Geometry.RicciFlow.Harnack.Matrix.Positivity.BasisChange |
| 3 | import PoincareLib.Geometry.RicciFlow.Harnack.Matrix.Divergence |
| 4 | import PoincareLib.Geometry.RicciFlow.Harnack.Matrix.Evolution.ReactionDerivative |
| 5 | import PoincareLib.Geometry.RicciFlow.Harnack.Finite |
| 6 | |
| 7 | /-! # Spatial null contact for the Hamilton tensor block |
| 8 | |
| 9 | The geometric curvature/mixed/two-tensor block uses a common radial frame. |
| 10 | Its two-form coordinates may have arbitrary first jets, while the vector |
| 11 | coordinates have zero first jets at the contact point. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | set_option maxHeartbeats 800000 |
| 17 | |
| 18 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 19 | open Matrix Filter |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace Poincare.RicciFlow.Harnack |
| 24 | |
| 25 | open PoincareMT |
| 26 | |
| 27 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 29 | {g : RiemannianMetric n M} |
| 30 | |
| 31 | /-- The divergence representation gives spatial smoothness and multilinearity |
| 32 | of Hamilton's two-tensor, including at zero elapsed time under total division. -/ |
| 33 | lemma hamiltonM_isSmoothCovariantTensor |
| 34 | (D : LeviCivitaData g) (hD : D.CurvatureTensorCalculus) (τ : ℝ) : |
| 35 | IsSmoothCovariantTensor (fun y (z : Fin 2 → TangentSpace (𝓡 n) y) => |
| 36 | hamiltonM D τ y (z 0) (z 1)) := by |
| 37 | let P : CovariantTensorEvaluation n M 3 := fun y z => |
| 38 | hamiltonP D y (z 0) (z 1) (z 2) |
| 39 | have hB : IsSmoothCovariantTensor (g.tensorTrace (D.covariantTensorDerivative P)) := |
| 40 | (D.covariantTensorDerivative_isSmooth (hamiltonP_isSmoothCovariantTensor D hD)).tensorTrace |
| 41 | have hC := D.isSmoothCovariantTensor_curvatureRicci hD |
| 42 | have hQ := hD.2.1.const_mul (2 * τ)⁻¹ |
| 43 | convert (hB.add hC).add hQ using 1 |
| 44 | funext y z |
| 45 | rw [hamiltonM_eq_divergence_hamiltonP D hD] |
| 46 | dsimp only [RiemannianMetric.tensorTrace, P] |
| 47 | have hz : z = ![z 0, z 1] := by ext i; fin_cases i <;> rfl |
| 48 | rw [hz] |
| 49 | simp only [Matrix.cons_val_zero, Matrix.cons_val_one] |
| 50 | have hflip (a b c d : TangentSpace (𝓡 n) y) : |
| 51 | D.curvatureTensor y a b c d = D.curvatureTensor y b a d c := by |
| 52 | rw [(hD.2.2.2.1 y a b c d).2.1, (hD.2.2.2.1 y c d a b).1, |
| 53 | (hD.2.2.2.1 y c d b a).2.1, (hD.2.2.2.1 y b a c d).1, neg_neg] |
| 54 | simp_rw [hflip (g.orthonormalBasis y _) (z 0) (g.orthonormalBasis y _) (z 1)] |
| 55 | simp [LeviCivitaData.ricciEvaluation, div_eq_mul_inv, mul_comm] |
| 56 | |
| 57 | private def blockRank {I : Type} : ((I × I) ⊕ I) → ((I × I) ⊕ I) → ℕ |
| 58 | | .inl _, .inl _ => 4 |
| 59 | | .inl _, .inr _ => 3 |
| 60 | | .inr _, .inl _ => 3 |
| 61 | | .inr _, .inr _ => 2 |
| 62 | |
| 63 | private def blockSlots {I : Type} : |
| 64 | (i j : (I × I) ⊕ I) → Fin (blockRank i j) → I |
| 65 | | .inl ab, .inl cd => ![ab.1, ab.2, cd.1, cd.2] |
| 66 | | .inl ab, .inr c => ![ab.1, ab.2, c] |
| 67 | | .inr a, .inl bc => ![bc.1, bc.2, a] |
| 68 | | .inr a, .inr b => ![a, b] |
| 69 | |
| 70 | private def blockTensor {I : Type} |
| 71 | (R : CovariantTensorEvaluation n M 4) (P : CovariantTensorEvaluation n M 3) |
| 72 | (B : CovariantTensorEvaluation n M 2) : |
| 73 | (i j : (I × I) ⊕ I) → CovariantTensorEvaluation n M (blockRank i j) |
| 74 | | .inl _, .inl _ => R |
| 75 | | .inl _, .inr _ => P |
| 76 | | .inr _, .inl _ => P |
| 77 | | .inr _, .inr _ => B |
| 78 | |
| 79 | private lemma map_vec_two {α β : Type*} (f : α → β) (a b : α) : |
| 80 | (fun l : Fin 2 => f (![a, b] l)) = ![f a, f b] := by |
| 81 | ext l; fin_cases l <;> rfl |
| 82 | |
| 83 | private lemma map_vec_three {α β : Type*} (f : α → β) (a b c : α) : |
| 84 | (fun l : Fin 3 => f (![a, b, c] l)) = ![f a, f b, f c] := by |
| 85 | ext l; fin_cases l <;> rfl |
| 86 | |
| 87 | private lemma map_vec_four {α β : Type*} (f : α → β) (a b c d : α) : |
| 88 | (fun l : Fin 4 => f (![a, b, c, d] l)) = ![f a, f b, f c, f d] := by |
| 89 | ext l; fin_cases l <;> rfl |
| 90 | |
| 91 | omit [IsManifold (𝓡 n) ∞ M] in |
| 92 | private lemma blockTensor_eq {I : Type} |
| 93 | (R : CovariantTensorEvaluation n M 4) (P : CovariantTensorEvaluation n M 3) |
| 94 | (B : CovariantTensorEvaluation n M 2) (y : M) (e : I → TangentSpace (𝓡 n) y) : |
| 95 | (fun i j => blockTensor R P B i j y (fun l => e (blockSlots i j l))) = |
| 96 | Matrix.fromBlocks (fun ab cd : I × I => R y ![e ab.1, e ab.2, e cd.1, e cd.2]) |
| 97 | (fun ab c => P y ![e ab.1, e ab.2, e c]) |
| 98 | (fun a bc => P y ![e bc.1, e bc.2, e a]) (fun a b => B y ![e a, e b]) := by |
| 99 | ext (ab | a) (cd | c) <;> |
| 100 | simp only [blockTensor, blockSlots, blockRank, |
| 101 | Matrix.fromBlocks_apply₁₁, Matrix.fromBlocks_apply₁₂, |
| 102 | Matrix.fromBlocks_apply₂₁, Matrix.fromBlocks_apply₂₂, |
| 103 | map_vec_two, map_vec_three, map_vec_four] |
| 104 | |
| 105 | /-- Spatial diffusion at a null tensor-block direction. The tangent vectors |
| 106 | `A a b` prescribe the gradients of its two-form coordinates. -/ |
| 107 | theorem tensor_block_diffusion_nonneg_at_null [T2Space M] |
| 108 | {I : Type} [Fintype I] (D : LeviCivitaData g) |
| 109 | {R : CovariantTensorEvaluation n M 4} {P : CovariantTensorEvaluation n M 3} |
| 110 | {B : CovariantTensorEvaluation n M 2} |
| 111 | (hR : IsSmoothCovariantTensor R) (hP : IsSmoothCovariantTensor P) |
| 112 | (hB : IsSmoothCovariantTensor B) |
| 113 | (x : M) (v : I → TangentSpace (𝓡 n) x) |
| 114 | (hpos : ∀ᶠ y in 𝓝 x, ∀ e : I → TangentSpace (𝓡 n) y, |
| 115 | (Matrix.fromBlocks (fun ab cd : I × I => R y ![e ab.1, e ab.2, e cd.1, e cd.2]) |
| 116 | (fun ab c => P y ![e ab.1, e ab.2, e c]) |
| 117 | (fun a bc => P y ![e bc.1, e bc.2, e a]) |
| 118 | (fun a b => B y ![e a, e b])).PosSemidef) |
| 119 | (U : I → I → ℝ) (W : I → ℝ) |
| 120 | (hnull : (∑ a, ∑ b, B x ![v a, v b] * W a * W b) + |
| 121 | 2 * (∑ a, ∑ b, ∑ c, P x ![v a, v b, v c] * U a b * W c) + |
| 122 | (∑ a, ∑ b, ∑ c, ∑ d, R x ![v a, v b, v c, v d] * U a b * U c d) = 0) |
| 123 | (A : I → I → TangentSpace (𝓡 n) x) : |
| 124 | 0 ≤ (∑ a, ∑ b, D.tensorLaplacian B x ![v a, v b] * W a * W b) + |
| 125 | 2 * (∑ a, ∑ b, ∑ c, D.tensorLaplacian P x ![v a, v b, v c] * U a b * W c) + |
| 126 | (∑ a, ∑ b, ∑ c, ∑ d, |
| 127 | D.tensorLaplacian R x ![v a, v b, v c, v d] * U a b * U c d) + |
| 128 | 4 * (∑ a, ∑ b, ∑ c, ∑ d, |
| 129 | U a b * D.covariantTensorDerivative R x ![A c d, v a, v b, v c, v d]) + |
| 130 | 4 * (∑ a, ∑ b, ∑ c, |
| 131 | W c * D.covariantTensorDerivative P x ![A a b, v a, v b, v c]) + |
| 132 | 2 * (∑ a, ∑ b, ∑ c, ∑ d, |
| 133 | R x ![v a, v b, v c, v d] * g.inner x (A a b) (A c d)) := by |
| 134 | let z : ((I × I) ⊕ I) → ℝ := Sum.elim (fun ab => U ab.1 ab.2) W |
| 135 | let V : ((I × I) ⊕ I) → TangentSpace (𝓡 n) x := |
| 136 | Sum.elim (fun ab => A ab.1 ab.2) (fun _ => 0) |
| 137 | have hT : ∀ i j : (I × I) ⊕ I, IsSmoothCovariantTensor (blockTensor R P B i j) := by |
| 138 | rintro (ab | a) (cd | c) |
| 139 | · exact hR |
| 140 | · exact hP |
| 141 | · exact hP |
| 142 | · exact hB |
| 143 | have hn : z ⬝ᵥ ((fun i j => blockTensor R P B i j x |
| 144 | (fun l => v (blockSlots i j l))) *ᵥ z) = 0 := by |
| 145 | rw [blockTensor_eq] |
| 146 | exact (hamiltonBlock_quadratic_eq |
| 147 | (fun a b c d => R x ![v a, v b, v c, v d]) |
| 148 | (fun a b c => P x ![v a, v b, v c]) |
| 149 | (fun a b => B x ![v a, v b]) U W).trans hnull |
| 150 | have hp : ∀ᶠ y in 𝓝 x, ∀ e : I → TangentSpace (𝓡 n) y, |
| 151 | Matrix.PosSemidef (fun i j => blockTensor R P B i j y |
| 152 | (fun l => e (blockSlots i j l))) := by |
| 153 | filter_upwards [hpos] with y hy e |
| 154 | rw [blockTensor_eq] |
| 155 | exact hy e |
| 156 | have h := tensor_matrix_diffusion_nonneg_at_null D blockRank (blockTensor R P B) |
| 157 | hT blockSlots x v hp z hn V |
| 158 | have hΔ : (∑ i, ∑ j, z i * D.tensorLaplacian (blockTensor R P B i j) x |
| 159 | (fun l => v (blockSlots i j l)) * z j) = |
| 160 | (∑ a, ∑ b, D.tensorLaplacian B x ![v a, v b] * W a * W b) + |
| 161 | 2 * (∑ a, ∑ b, ∑ c, D.tensorLaplacian P x ![v a, v b, v c] * U a b * W c) + |
| 162 | (∑ a, ∑ b, ∑ c, ∑ d, |
| 163 | D.tensorLaplacian R x ![v a, v b, v c, v d] * U a b * U c d) := by |
| 164 | have he := hamiltonBlock_quadratic_eq |
| 165 | (fun a b c d => D.tensorLaplacian R x ![v a, v b, v c, v d]) |
| 166 | (fun a b c => D.tensorLaplacian P x ![v a, v b, v c]) |
| 167 | (fun a b => D.tensorLaplacian B x ![v a, v b]) U W |
| 168 | convert he using 1 |
| 169 | simp only [dotProduct, mulVec, Fintype.sum_sum_type, Fintype.sum_prod_type, |
| 170 | z, Sum.elim_inl, Sum.elim_inr, blockTensor, blockSlots, blockRank, |
| 171 | map_vec_two, map_vec_three, map_vec_four, |
| 172 | Matrix.fromBlocks_apply₁₁, Matrix.fromBlocks_apply₁₂, |
| 173 | Matrix.fromBlocks_apply₂₁, Matrix.fromBlocks_apply₂₂, |
| 174 | Finset.mul_sum, Finset.sum_add_distrib, mul_add, mul_assoc] |
| 175 | rw [hΔ] at h |
| 176 | have hzero {k : ℕ} {T : CovariantTensorEvaluation n M k} |
| 177 | (hT : IsSmoothCovariantTensor T) (w : Fin k → TangentSpace (𝓡 n) x) : |
| 178 | D.covariantTensorDerivative T x (Matrix.vecCons 0 w) = 0 := by |
| 179 | obtain ⟨L, hL⟩ := (D.covariantTensorDerivative_isSmooth hT).1 x |
| 180 | change D.covariantTensorDerivative T x (Fin.cons 0 w) = 0 |
| 181 | rw [← Fin.update_cons_zero (x := (0 : TangentSpace (𝓡 n) x)), hL, L.map_update_zero] |
| 182 | simp only [Fintype.sum_sum_type, Fintype.sum_prod_type, z, V, |
| 183 | Sum.elim_inl, Sum.elim_inr, blockTensor, blockSlots, blockRank, |
| 184 | map_vec_two, map_vec_three, map_vec_four, hzero hP, hzero hB, |
| 185 | map_zero, _root_.zero_apply, mul_zero, Finset.sum_const_zero, |
| 186 | add_zero, Finset.sum_add_distrib, Matrix.Fin.cons_vecCons] at h |
| 187 | have hporder : (∑ c, ∑ a, ∑ b, |
| 188 | W c * D.covariantTensorDerivative P x ![A a b, v a, v b, v c]) = |
| 189 | ∑ a, ∑ b, ∑ c, |
| 190 | W c * D.covariantTensorDerivative P x ![A a b, v a, v b, v c] := by |
| 191 | rw [Finset.sum_comm_cycle, Finset.sum_comm_cycle] |
| 192 | rw [hporder] at h |
| 193 | linarith only [h] |
| 194 | |
| 195 | private lemma covariantTensorDerivative_cons_sum |
| 196 | (D : LeviCivitaData g) {k : ℕ} {T : CovariantTensorEvaluation n M k} |
| 197 | (hT : IsSmoothCovariantTensor T) (x : M) |
| 198 | (w : Fin k → TangentSpace (𝓡 n) x) |
| 199 | (c : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) : |
| 200 | D.covariantTensorDerivative T x |
| 201 | (Fin.cons (∑ e, c e • g.orthonormalBasis x e) w) = |
| 202 | ∑ e, c e * D.covariantTensorDerivative T x |
| 203 | (Fin.cons (g.orthonormalBasis x e) w) := by |
| 204 | classical |
| 205 | obtain ⟨L, hL⟩ := (D.covariantTensorDerivative_isSmooth hT).1 x |
| 206 | rw [← Fin.update_cons_zero (x := (0 : TangentSpace (𝓡 n) x)), hL, |
| 207 | L.map_update_sum] |
| 208 | apply Finset.sum_congr rfl |
| 209 | intro e _ |
| 210 | rw [L.map_update_smul] |
| 211 | simp only [smul_eq_mul, Fin.update_cons_zero, ← hL] |
| 212 | |
| 213 | private lemma sum_four_last {I : Type} [Fintype I] (f : I → I → I → I → ℝ) : |
| 214 | (∑ a, ∑ c, ∑ d, ∑ e, f a c d e) = ∑ e, ∑ a, ∑ c, ∑ d, f a c d e := by |
| 215 | calc |
| 216 | _ = ∑ a, ∑ e, ∑ c, ∑ d, f a c d e := by |
| 217 | apply Finset.sum_congr rfl |
| 218 | intro a _ |
| 219 | exact Finset.sum_comm_cycle |
| 220 | _ = _ := Finset.sum_comm |
| 221 | |
| 222 | private lemma sum_five_last {I : Type} [Fintype I] (f : I → I → I → I → I → ℝ) : |
| 223 | (∑ a, ∑ c, ∑ d, ∑ f', ∑ e, f a c d f' e) = |
| 224 | ∑ e, ∑ a, ∑ c, ∑ d, ∑ f', f a c d f' e := by |
| 225 | calc |
| 226 | _ = ∑ a, ∑ e, ∑ c, ∑ d, ∑ f', f a c d f' e := by |
| 227 | apply Finset.sum_congr rfl |
| 228 | intro a _ |
| 229 | exact sum_four_last (f a) |
| 230 | _ = _ := Finset.sum_comm |
| 231 | |
| 232 | /-- The geometric Hamilton diffusion inequality in the canonical basis. The |
| 233 | first jets `V` are arbitrary, so Hamilton's prescribed jets can be inserted |
| 234 | directly into the checked heat-operator contraction. -/ |
| 235 | theorem hamilton_diffusion_quadratic_nonneg_at_null [T2Space M] |
| 236 | (hC : RicciFlowCurvatureTheory.{u}) {T₀ T₁ : ℝ} |
| 237 | (F : RicciFlow n M (Set.Ioo T₀ T₁)) (t τ : ℝ) (x : M) |
| 238 | (U : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → |
| 239 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) |
| 240 | (W : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) |
| 241 | (hQ : ∀ᶠ y in 𝓝 x, HamiltonBlockPos F t y τ) |
| 242 | (hnull : let D := F.connection t |
| 243 | let b := (F.metric t).orthonormalBasis x |
| 244 | (∑ a, ∑ c, hamiltonM D τ x (b a) (b c) * W a * W c) + |
| 245 | 2 * (∑ a, ∑ c, ∑ d, hamiltonP D x (b a) (b c) (b d) * U a c * W d) + |
| 246 | (∑ a, ∑ c, ∑ d, ∑ e, |
| 247 | D.curvatureTensor x (b a) (b c) (b d) (b e) * U a c * U d e) = 0) |
| 248 | (V : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → |
| 249 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → |
| 250 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) : |
| 251 | let D := F.connection t |
| 252 | let b := (F.metric t).orthonormalBasis x |
| 253 | 0 ≤ (∑ a, ∑ c, D.tensorLaplacian (fun y z => |
| 254 | hamiltonM D τ y (z 0) (z 1)) x ![b a, b c] * W a * W c) + |
| 255 | 2 * (∑ a, ∑ c, ∑ d, |
| 256 | D.tensorLaplacian (fun y z => hamiltonP D y |
| 257 | (z 0) (z 1) (z 2)) x ![b a, b c, b d] * U a c * W d) + |
| 258 | (∑ a, ∑ c, ∑ d, ∑ e, |
| 259 | D.tensorLaplacian D.riemannEvaluation x ![b a, b c, b d, b e] * U a c * U d e) + |
| 260 | 4 * (∑ e, ∑ a, ∑ c, ∑ d, |
| 261 | D.covariantTensorDerivative (fun y z => hamiltonP D y (z 0) (z 1) (z 2)) |
| 262 | x ![b e, b a, b c, b d] * V e a c * W d) + |
| 263 | 4 * (∑ e, ∑ a, ∑ c, ∑ d, ∑ f, |
| 264 | D.covariantTensorDerivative D.riemannEvaluation x ![b e, b a, b c, b d, b f] * |
| 265 | V e a c * U d f) + |
| 266 | 2 * (∑ e, ∑ a, ∑ c, ∑ d, ∑ f, |
| 267 | D.curvatureTensor x (b a) (b c) (b d) (b f) * V e a c * V e d f) := by |
| 268 | classical |
| 269 | let D := F.connection t |
| 270 | let g := F.metric t |
| 271 | let b := g.orthonormalBasis x |
| 272 | let P : CovariantTensorEvaluation n M 3 := fun y z => hamiltonP D y (z 0) (z 1) (z 2) |
| 273 | let B : CovariantTensorEvaluation n M 2 := fun y z => hamiltonM D τ y (z 0) (z 1) |
| 274 | let A := fun a c => ∑ e, V e a c • b e |
| 275 | have hD := hC.tensor_calculus n M g D |
| 276 | have hP : IsSmoothCovariantTensor P := hamiltonP_isSmoothCovariantTensor D hD |
| 277 | have hB : IsSmoothCovariantTensor B := hamiltonM_isSmoothCovariantTensor D hD τ |
| 278 | have hp : ∀ᶠ y in 𝓝 x, ∀ e : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → |
| 279 | TangentSpace (𝓡 n) y, |
| 280 | (Matrix.fromBlocks (fun ab cd : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) × |
| 281 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) => |
| 282 | D.riemannEvaluation y ![e ab.1, e ab.2, e cd.1, e cd.2]) |
| 283 | (fun ab c => P y ![e ab.1, e ab.2, e c]) |
| 284 | (fun a bc => P y ![e bc.1, e bc.2, e a]) (fun a c => B y ![e a, e c])).PosSemidef := by |
| 285 | filter_upwards [hQ] with y hy e |
| 286 | exact tensor_block_posSemidef_of_basis g hD.1 hP hB y hy e |
| 287 | have h := tensor_block_diffusion_nonneg_at_null D hD.1 hP hB x b hp U W hnull A |
| 288 | have hfirstP (a c d) : D.covariantTensorDerivative P x ![A a c, b a, b c, b d] = |
| 289 | ∑ e, V e a c * D.covariantTensorDerivative P x ![b e, b a, b c, b d] := by |
| 290 | exact covariantTensorDerivative_cons_sum D hP x ![b a, b c, b d] (fun e => V e a c) |
| 291 | have hfirstR (a c d f) : D.covariantTensorDerivative D.riemannEvaluation x |
| 292 | ![A d f, b a, b c, b d, b f] = |
| 293 | ∑ e, V e d f * D.covariantTensorDerivative D.riemannEvaluation x |
| 294 | ![b e, b d, b f, b a, b c] := by |
| 295 | rw [D.covariantTensorDerivative_riemannEvaluation_pair_swap hD] |
| 296 | exact covariantTensorDerivative_cons_sum D hD.1 x ![b d, b f, b a, b c] |
| 297 | (fun e => V e d f) |
| 298 | have hinner (a c d f) : g.inner x (A a c) (A d f) = ∑ e, V e a c * V e d f := by |
| 299 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 300 | ⟨g.toRiemannianMetric⟩ |
| 301 | change inner ℝ (∑ e, V e a c • b e) (∑ e, V e d f • b e) = _ |
| 302 | simp only [sum_inner, inner_sum, real_inner_smul_left, real_inner_smul_right, |
| 303 | b.inner_eq_ite, mul_ite, mul_zero, mul_one, Finset.sum_ite_eq', Finset.mem_univ, |
| 304 | if_true] |
| 305 | apply Finset.sum_congr rfl |
| 306 | intro e _ |
| 307 | ring |
| 308 | dsimp only [g] at hinner |
| 309 | simp only [hfirstP, hfirstR, hinner, Finset.mul_sum] at h |
| 310 | rw [sum_four_last (fun a c d e => 4 * (W d * |
| 311 | (V e a c * D.covariantTensorDerivative P x ![b e, b a, b c, b d]))), |
| 312 | sum_five_last (fun a c d f e => 4 * (U a c * |
| 313 | (V e d f * D.covariantTensorDerivative D.riemannEvaluation x |
| 314 | ![b e, b d, b f, b a, b c]))), |
| 315 | sum_five_last (fun a c d f e => 2 * (D.riemannEvaluation x ![b a, b c, b d, b f] * |
| 316 | (V e a c * V e d f)))] at h |
| 317 | have hRorder : (∑ e, ∑ a, ∑ c, ∑ d, ∑ f, |
| 318 | 4 * (U a c * (V e d f * D.covariantTensorDerivative D.riemannEvaluation x |
| 319 | ![b e, b d, b f, b a, b c]))) = |
| 320 | ∑ e, ∑ a, ∑ c, ∑ d, ∑ f, |
| 321 | 4 * (D.covariantTensorDerivative D.riemannEvaluation x ![b e, b a, b c, b d, b f] * |
| 322 | V e a c * U d f) := by |
| 323 | apply Finset.sum_congr rfl |
| 324 | intro e _ |
| 325 | rw [Finset.sum_comm_cycle] |
| 326 | apply Finset.sum_congr rfl |
| 327 | intro d _ |
| 328 | rw [Finset.sum_comm_cycle] |
| 329 | apply Finset.sum_congr rfl |
| 330 | intro f _ |
| 331 | apply Finset.sum_congr rfl |
| 332 | intro a _ |
| 333 | apply Finset.sum_congr rfl |
| 334 | intro c _ |
| 335 | ring |
| 336 | rw [hRorder] at h |
| 337 | have hPorder : (∑ e, ∑ a, ∑ c, ∑ d, |
| 338 | 4 * (W d * (V e a c * D.covariantTensorDerivative P x ![b e, b a, b c, b d]))) = |
| 339 | 4 * (∑ e, ∑ a, ∑ c, ∑ d, |
| 340 | D.covariantTensorDerivative P x ![b e, b a, b c, b d] * V e a c * W d) := by |
| 341 | simp only [Finset.mul_sum] |
| 342 | apply Finset.sum_congr rfl |
| 343 | intro e _ |
| 344 | apply Finset.sum_congr rfl |
| 345 | intro a _ |
| 346 | apply Finset.sum_congr rfl |
| 347 | intro c _ |
| 348 | apply Finset.sum_congr rfl |
| 349 | intro d _ |
| 350 | ring |
| 351 | rw [hPorder] at h |
| 352 | have hVorder : (∑ e, ∑ a, ∑ c, ∑ d, ∑ f, |
| 353 | 2 * (D.riemannEvaluation x ![b a, b c, b d, b f] * (V e a c * V e d f))) = |
| 354 | 2 * (∑ e, ∑ a, ∑ c, ∑ d, ∑ f, |
| 355 | D.curvatureTensor x (b a) (b c) (b d) (b f) * V e a c * V e d f) := by |
| 356 | simp only [Finset.mul_sum, mul_assoc, LeviCivitaData.riemannEvaluation, |
| 357 | Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val] |
| 358 | rw [hVorder] at h |
| 359 | have hRcoeff : (∑ e, ∑ a, ∑ c, ∑ d, ∑ f, |
| 360 | 4 * (D.covariantTensorDerivative D.riemannEvaluation x ![b e, b a, b c, b d, b f] * |
| 361 | V e a c * U d f)) = |
| 362 | 4 * (∑ e, ∑ a, ∑ c, ∑ d, ∑ f, |
| 363 | D.covariantTensorDerivative D.riemannEvaluation x ![b e, b a, b c, b d, b f] * |
| 364 | V e a c * U d f) := by simp only [Finset.mul_sum] |
| 365 | rw [hRcoeff] at h |
| 366 | have hPcoeff : (∑ a, ∑ c, ∑ d, |
| 367 | 2 * (D.tensorLaplacian P x ![b a, b c, b d] * U a c * W d)) = |
| 368 | 2 * (∑ a, ∑ c, ∑ d, |
| 369 | D.tensorLaplacian P x ![b a, b c, b d] * U a c * W d) := by |
| 370 | simp only [Finset.mul_sum] |
| 371 | rw [hPcoeff] at h |
| 372 | dsimp only at ⊢ |
| 373 | linarith only [h] |
| 374 | |
| 375 | end Poincare.RicciFlow.Harnack |