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.Harnack.Matrix.Evolution.Quadratic |
| 3 | import PoincareLib.Geometry.RicciFlow.Harnack.Matrix.Evolution.QuadraticReaction |
| 4 | import PoincareLib.Geometry.RicciFlow.Harnack.Matrix.Evolution.M |
| 5 | import PoincareLib.Geometry.RicciFlow.Harnack.Finite |
| 6 | |
| 7 | /-! |
| 8 | # Heat contractions of Hamilton's quadratic |
| 9 | |
| 10 | The geometric tensor heat equations and the prescribed first jets give the |
| 11 | reaction in Chow et al., Part II, Theorem 15.16, (15.56)-(15.58), pp. 278-279. |
| 12 | The first jets are evaluated in the metric's orthonormal basis at the point. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | set_option maxHeartbeats 800000 |
| 18 | |
| 19 | open scoped Manifold ContDiff Bundle BigOperators |
| 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 | {J : Set ℝ} |
| 30 | |
| 31 | /-- The mixed heat contraction loses its curvature derivatives when the |
| 32 | two-form has Hamilton's prescribed first jet. -/ |
| 33 | lemma hamiltonP_heat_quadratic_cancellation |
| 34 | (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 35 | {t : ℝ} (ht : t ∈ interior J) (k : ℝ) (x : M) |
| 36 | (U : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → |
| 37 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) |
| 38 | (W : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) : |
| 39 | let D := F.connection t |
| 40 | let b := (F.metric t).orthonormalBasis x |
| 41 | let R := fun a c d e => D.curvatureTensor x (b a) (b c) (b d) (b e) |
| 42 | let Ric := fun a c => D.ricci x (b a) (b c) |
| 43 | let P := fun a c d => hamiltonP D x (b a) (b c) (b d) |
| 44 | let V := fun e a c => |
| 45 | ((Ric e a + k * (if e = a then 1 else 0)) * W c - |
| 46 | W a * (Ric e c + k * (if e = c then 1 else 0))) / 2 |
| 47 | 2 * (∑ a, ∑ c, ∑ d, |
| 48 | F.tensorHeatOperator (fun s y z => hamiltonP (F.connection s) y |
| 49 | (z 0) (z 1) (z 2)) t x ![b a, b c, b d] * U a c * W d) + |
| 50 | 4 * k * (∑ a, ∑ c, ∑ d, P a c d * U a c * W d) - |
| 51 | 4 * (∑ e, ∑ a, ∑ c, ∑ d, ∑ f, |
| 52 | D.covariantTensorDerivative D.riemannEvaluation x ![b e, b a, b c, b d, b f] * |
| 53 | V e a c * U d f) = |
| 54 | 4 * (∑ a, ∑ c, ∑ d, ∑ e, ∑ f, |
| 55 | (R a e c f * P e f d + R a e d f * P e c f + R c e d f * P a e f) * |
| 56 | U a c * W d) := by |
| 57 | have hc := hamiltonP_geometric_prescribed_jet_cancellation (F.connection t) |
| 58 | (hC.tensor_calculus n M (F.metric t) (F.connection t)) k x U W |
| 59 | dsimp only at hc ⊢ |
| 60 | rw [tensorHeatOperator_hamiltonP hC F ht] |
| 61 | simp only [hamiltonPReaction, Matrix.cons_val_zero, Matrix.cons_val_one, |
| 62 | Matrix.cons_val_two, Matrix.head_cons, Matrix.tail_cons, |
| 63 | add_mul, sub_mul, Finset.sum_add_distrib, |
| 64 | Finset.sum_sub_distrib, Finset.sum_mul, mul_assoc, ← Finset.mul_sum] at hc ⊢ |
| 65 | linarith only [hc] |
| 66 | |
| 67 | /-- The two-tensor heat contraction and prescribed spatial jets cancel the |
| 68 | derivative, Ricci-square, and reciprocal-time terms. -/ |
| 69 | lemma hamiltonM_heat_quadratic_cancellation |
| 70 | (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 71 | (T₀ : ℝ) {t : ℝ} (ht : t ∈ interior J) (hτ : t - T₀ ≠ 0) (x : M) |
| 72 | (W : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) : |
| 73 | let D := F.connection t |
| 74 | let b := (F.metric t).orthonormalBasis x |
| 75 | let R := fun a c d e => D.curvatureTensor x (b a) (b c) (b d) (b e) |
| 76 | let Ric := fun a c => D.ricci x (b a) (b c) |
| 77 | let P := fun a c d => hamiltonP D x (b a) (b c) (b d) |
| 78 | let Q := fun a c => hamiltonM D (t - T₀) x (b a) (b c) |
| 79 | let dP := fun e a c d => D.covariantTensorDerivative |
| 80 | (fun y z => hamiltonP D y (z 0) (z 1) (z 2)) x ![b e, b a, b c, b d] |
| 81 | let k := (2 * (t - T₀))⁻¹ |
| 82 | let V := fun e a c => |
| 83 | ((Ric e a + k * (if e = a then 1 else 0)) * W c - |
| 84 | W a * (Ric e c + k * (if e = c then 1 else 0))) / 2 |
| 85 | (∑ a, ∑ c, F.tensorHeatOperator (fun s y z => |
| 86 | hamiltonM (F.connection s) (s - T₀) y (z 0) (z 1)) t x ![b a, b c] * W a * W c) + |
| 87 | 4 * k * (∑ a, ∑ c, Q a c * W a * W c) - |
| 88 | 4 * (∑ e, ∑ a, ∑ c, ∑ d, dP e a c d * V e a c * W d) - |
| 89 | 2 * (∑ e, ∑ a, ∑ c, ∑ d, ∑ f, R a c d f * V e a c * V e d f) = |
| 90 | 2 * (∑ a, ∑ c, ∑ b, ∑ d, R a c b d * Q c d * W a * W b) - |
| 91 | 2 * (∑ a, ∑ c, ∑ d, ∑ b, P a c d * P b d c * W a * W b) + |
| 92 | (∑ a, ∑ b, ∑ c, ∑ d, P c d a * P c d b * W a * W b) := by |
| 93 | let I := Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) |
| 94 | let D := F.connection t |
| 95 | let b := (F.metric t).orthonormalBasis x |
| 96 | let R := fun a c d e => D.curvatureTensor x (b a) (b c) (b d) (b e) |
| 97 | let Ric := fun a c => D.ricci x (b a) (b c) |
| 98 | let P := fun a c d => hamiltonP D x (b a) (b c) (b d) |
| 99 | let Q := fun a c => hamiltonM D (t - T₀) x (b a) (b c) |
| 100 | let dP := fun e a c d => D.covariantTensorDerivative |
| 101 | (fun y z => hamiltonP D y (z 0) (z 1) (z 2)) x ![b e, b a, b c, b d] |
| 102 | have hc := hamiltonM_geometric_prescribed_jet_cancellation D |
| 103 | (hC.tensor_calculus n M (F.metric t) D) (t - T₀) x W |
| 104 | have hheat := congrArg (fun A : I → I → ℝ => ∑ a, ∑ c, A a c * W a * W c) |
| 105 | (funext fun a => funext fun c => |
| 106 | tensorHeatOperator_hamiltonM hC F T₀ ht hτ x (b a) (b c)) |
| 107 | have hderiv : |
| 108 | (∑ a, ∑ b, ∑ c, ∑ d, Ric c d * (dP c d a b + dP c d b a) * W a * W b) = |
| 109 | ∑ e, ∑ a, ∑ c, ∑ d, Ric e a * (dP e a c d + dP e a d c) * W c * W d := by |
| 110 | let σ : (I × I × I × I) ≃ (I × I × I × I) := |
| 111 | { toFun := fun (a, b, c, d) => (c, d, a, b) |
| 112 | invFun := fun (a, b, c, d) => (c, d, a, b) |
| 113 | left_inv := by rintro ⟨a, b, c, d⟩; rfl |
| 114 | right_inv := by rintro ⟨a, b, c, d⟩; rfl } |
| 115 | have he := Fintype.sum_equiv σ |
| 116 | (fun (a, b, c, d) => Ric c d * (dP c d a b + dP c d b a) * W a * W b) |
| 117 | (fun (e, a, c, d) => Ric e a * (dP e a c d + dP e a d c) * W c * W d) |
| 118 | (by rintro ⟨a, b, c, d⟩; rfl) |
| 119 | simpa only [Fintype.sum_prod_type] using he |
| 120 | have hcube : |
| 121 | (∑ a, ∑ b, ∑ e, ∑ c, ∑ d, Ric e c * Ric e d * R a d b c * W a * W b) = |
| 122 | ∑ e, ∑ a, ∑ c, ∑ d, ∑ f, R a c d f * Ric e a * W c * Ric e d * W f := by |
| 123 | let σ : (I × I × I × I × I) ≃ (I × I × I × I × I) := |
| 124 | { toFun := fun (a, b, e, c, d) => (e, d, a, c, b) |
| 125 | invFun := fun (e, a, c, d, f) => (c, f, e, d, a) |
| 126 | left_inv := by rintro ⟨a, b, e, c, d⟩; rfl |
| 127 | right_inv := by rintro ⟨e, a, c, d, f⟩; rfl } |
| 128 | have hswap (a c d f) : R a c d f = R c a f d := by |
| 129 | have hs := (hC.tensor_calculus n M (F.metric t) D).2.2.2.1 |
| 130 | dsimp only [R] |
| 131 | rw [(hs x _ _ _ _).2.1, (hs x _ _ _ _).1, |
| 132 | (hs x _ _ _ _).2.1, (hs x _ _ _ _).1, neg_neg] |
| 133 | have he := Fintype.sum_equiv σ |
| 134 | (fun (a, b, e, c, d) => Ric e c * Ric e d * R a d b c * W a * W b) |
| 135 | (fun (e, a, c, d, f) => R a c d f * Ric e a * W c * Ric e d * W f) |
| 136 | (by rintro ⟨a, b, e, c, d⟩; dsimp [σ]; rw [hswap a d b c]; ring) |
| 137 | simpa only [Fintype.sum_prod_type] using he |
| 138 | have hlinear : |
| 139 | (∑ a, ∑ b, ∑ c, ∑ d, R a c b d * Q c d * W a * W b) = |
| 140 | ∑ a, ∑ c, ∑ b, ∑ d, R a c b d * Q c d * W a * W b := by |
| 141 | exact Finset.sum_congr rfl fun _ _ => Finset.sum_comm |
| 142 | have hnegative : |
| 143 | (∑ a, ∑ b, ∑ c, ∑ d, P a c d * P b d c * W a * W b) = |
| 144 | ∑ a, ∑ c, ∑ d, ∑ b, P a c d * P b d c * W a * W b := by |
| 145 | apply Finset.sum_congr rfl |
| 146 | intro a _ |
| 147 | rw [Finset.sum_comm] |
| 148 | apply Finset.sum_congr rfl |
| 149 | intro c _ |
| 150 | exact Finset.sum_comm |
| 151 | have htime : (2 * (t - T₀) ^ 2)⁻¹ = 2 * ((2 * (t - T₀))⁻¹) ^ 2 := by |
| 152 | field_simp |
| 153 | have htime_term (r w v : ℝ) : r / (2 * (t - T₀) ^ 2) * w * v = |
| 154 | 2 * ((2 * (t - T₀))⁻¹) ^ 2 * (r * w * v) := by |
| 155 | rw [div_eq_mul_inv, htime] |
| 156 | ring |
| 157 | dsimp only [D, b, R, Ric, P, Q, dP] at hderiv hcube hlinear hnegative hc hheat |
| 158 | dsimp only at hc hheat ⊢ |
| 159 | simp only [add_mul, sub_mul, Finset.sum_add_distrib, Finset.sum_sub_distrib, |
| 160 | htime_term, ← Finset.mul_sum] at hheat |
| 161 | simp only [div_eq_mul_inv, add_mul, sub_mul, Finset.sum_add_distrib, |
| 162 | Finset.sum_mul, mul_assoc, ← Finset.mul_sum] |
| 163 | at hc hheat hderiv hcube hlinear hnegative ⊢ |
| 164 | linarith only [hc, hheat, hderiv, hcube, hlinear, hnegative] |
| 165 | |
| 166 | /-- At a point of the Hamilton cone, the actual geometric heat contractions, |
| 167 | with Hamilton's prescribed test jets, have nonnegative reaction. -/ |
| 168 | lemma hamilton_heat_quadratic_nonneg_of_block |
| 169 | (hC : RicciFlowCurvatureTheory.{u}) {T₀ T₁ : ℝ} |
| 170 | (F : RicciFlow n M (Set.Ioo T₀ T₁)) {t : ℝ} (ht : t ∈ Set.Ioo T₀ T₁) (x : M) |
| 171 | (U : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → |
| 172 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) |
| 173 | (W : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) |
| 174 | (hU : ∀ a c, U a c = -U c a) (hQ : HamiltonBlockPos F t x (t - T₀)) : |
| 175 | let D := F.connection t |
| 176 | let b := (F.metric t).orthonormalBasis x |
| 177 | let R := fun a c d e => D.curvatureTensor x (b a) (b c) (b d) (b e) |
| 178 | let Ric := fun a c => D.ricci x (b a) (b c) |
| 179 | let P := fun a c d => hamiltonP D x (b a) (b c) (b d) |
| 180 | let Q := fun a c => hamiltonM D (t - T₀) x (b a) (b c) |
| 181 | let dP := fun e a c d => D.covariantTensorDerivative |
| 182 | (fun y z => hamiltonP D y (z 0) (z 1) (z 2)) x ![b e, b a, b c, b d] |
| 183 | let k := (2 * (t - T₀))⁻¹ |
| 184 | let V := fun e a c => |
| 185 | ((Ric e a + k * (if e = a then 1 else 0)) * W c - |
| 186 | W a * (Ric e c + k * (if e = c then 1 else 0))) / 2 |
| 187 | 0 ≤ (∑ a, ∑ c, F.tensorHeatOperator (fun s y z => |
| 188 | hamiltonM (F.connection s) (s - T₀) y (z 0) (z 1)) t x ![b a, b c] * W a * W c) + |
| 189 | 2 * (∑ a, ∑ c, ∑ d, |
| 190 | F.tensorHeatOperator (fun s y z => hamiltonP (F.connection s) y |
| 191 | (z 0) (z 1) (z 2)) t x ![b a, b c, b d] * U a c * W d) + |
| 192 | (∑ a, ∑ c, ∑ d, ∑ e, |
| 193 | F.tensorHeatOperator (fun s => (F.connection s).riemannEvaluation) |
| 194 | t x ![b a, b c, b d, b e] * U a c * U d e) + |
| 195 | 4 * k * ((∑ a, ∑ c, Q a c * W a * W c) + |
| 196 | (∑ a, ∑ c, ∑ d, P a c d * U a c * W d)) - |
| 197 | 4 * (∑ e, ∑ a, ∑ c, ∑ d, dP e a c d * V e a c * W d) - |
| 198 | 4 * (∑ e, ∑ a, ∑ c, ∑ d, ∑ f, |
| 199 | D.covariantTensorDerivative D.riemannEvaluation x ![b e, b a, b c, b d, b f] * |
| 200 | V e a c * U d f) - |
| 201 | 2 * (∑ e, ∑ a, ∑ c, ∑ d, ∑ f, R a c d f * V e a c * V e d f) := by |
| 202 | let D := F.connection t |
| 203 | let b := (F.metric t).orthonormalBasis x |
| 204 | let R := fun a c d e => D.curvatureTensor x (b a) (b c) (b d) (b e) |
| 205 | let P := fun a c d => hamiltonP D x (b a) (b c) (b d) |
| 206 | let Q := fun a c => hamiltonM D (t - T₀) x (b a) (b c) |
| 207 | have hD := hC.tensor_calculus n M (F.metric t) D |
| 208 | have hfirst (a c d e) : R a c d e = -R c a d e := by |
| 209 | dsimp only [R] |
| 210 | rw [(hD.2.2.2.1 x _ _ _ _).2.1, (hD.2.2.2.1 x _ _ _ _).1, |
| 211 | (hD.2.2.2.1 x _ _ _ _).2.1] |
| 212 | have hlast (a c d e) : R a c d e = -R a c e d := (hD.2.2.2.1 x _ _ _ _).1 |
| 213 | have hpair (a c d e) : R a c d e = R d e a c := (hD.2.2.2.1 x _ _ _ _).2.1 |
| 214 | have hbianchi (a c d e) : R a c d e + R c d a e + R d a c e = 0 := |
| 215 | (hD.2.2.2.1 x _ _ _ _).2.2.1 |
| 216 | have hP (a c d) : P a c d = -P c a d := hamiltonP_skew D x _ _ _ |
| 217 | have hn := hamilton_reaction_collected_nonneg R P Q U W |
| 218 | hfirst hlast hpair hbianchi hP hU hQ |
| 219 | have ht' : t ∈ interior (Set.Ioo T₀ T₁) := by simpa only [interior_Ioo] using ht |
| 220 | have hm := hamiltonM_heat_quadratic_cancellation hC F T₀ ht' |
| 221 | (ne_of_gt (sub_pos.mpr ht.1)) x W |
| 222 | have hp := hamiltonP_heat_quadratic_cancellation hC F ht' ((2 * (t - T₀))⁻¹) x U W |
| 223 | dsimp only [R, P, Q, D, b] at hn |
| 224 | dsimp only at hn hm hp ⊢ |
| 225 | simp_rw [F.tensorHeatOperator_riemann hC ht'] |
| 226 | simp only [LeviCivitaData.curvatureB, mul_assoc, ← Finset.mul_sum] at hn hm hp ⊢ |
| 227 | linarith only [hn, hm, hp] |
| 228 | |
| 229 | /-- In a null Hamilton direction the test-field time correction vanishes, |
| 230 | leaving precisely the heat and spatial-jet contractions. -/ |
| 231 | lemma hamilton_heat_quadratic_nonneg_at_null |
| 232 | (hC : RicciFlowCurvatureTheory.{u}) {T₀ T₁ : ℝ} |
| 233 | (F : RicciFlow n M (Set.Ioo T₀ T₁)) {t : ℝ} (ht : t ∈ Set.Ioo T₀ T₁) (x : M) |
| 234 | (U : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → |
| 235 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) |
| 236 | (W : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) |
| 237 | (hU : ∀ a c, U a c = -U c a) (hQ : HamiltonBlockPos F t x (t - T₀)) |
| 238 | (hnull : let D := F.connection t |
| 239 | let b := (F.metric t).orthonormalBasis x |
| 240 | (∑ a, ∑ c, hamiltonM D (t - T₀) x (b a) (b c) * W a * W c) + |
| 241 | 2 * (∑ a, ∑ c, ∑ d, hamiltonP D x (b a) (b c) (b d) * U a c * W d) + |
| 242 | (∑ a, ∑ c, ∑ d, ∑ e, |
| 243 | D.curvatureTensor x (b a) (b c) (b d) (b e) * U a c * U d e) = 0) : |
| 244 | let D := F.connection t |
| 245 | let b := (F.metric t).orthonormalBasis x |
| 246 | let Ric := fun a c => D.ricci x (b a) (b c) |
| 247 | let k := (2 * (t - T₀))⁻¹ |
| 248 | let V := fun e a c => |
| 249 | ((Ric e a + k * (if e = a then 1 else 0)) * W c - |
| 250 | W a * (Ric e c + k * (if e = c then 1 else 0))) / 2 |
| 251 | 0 ≤ (∑ a, ∑ c, F.tensorHeatOperator (fun s y z => |
| 252 | hamiltonM (F.connection s) (s - T₀) y (z 0) (z 1)) t x ![b a, b c] * W a * W c) + |
| 253 | 2 * (∑ a, ∑ c, ∑ d, |
| 254 | F.tensorHeatOperator (fun s y z => hamiltonP (F.connection s) y |
| 255 | (z 0) (z 1) (z 2)) t x ![b a, b c, b d] * U a c * W d) + |
| 256 | (∑ a, ∑ c, ∑ d, ∑ e, |
| 257 | F.tensorHeatOperator (fun s => (F.connection s).riemannEvaluation) |
| 258 | t x ![b a, b c, b d, b e] * U a c * U d e) - |
| 259 | 4 * (∑ e, ∑ a, ∑ c, ∑ d, |
| 260 | D.covariantTensorDerivative (fun y z => hamiltonP D y (z 0) (z 1) (z 2)) |
| 261 | x ![b e, b a, b c, b d] * V e a c * W d) - |
| 262 | 4 * (∑ e, ∑ a, ∑ c, ∑ d, ∑ f, |
| 263 | D.covariantTensorDerivative D.riemannEvaluation x ![b e, b a, b c, b d, b f] * |
| 264 | V e a c * U d f) - |
| 265 | 2 * (∑ e, ∑ a, ∑ c, ∑ d, ∑ f, |
| 266 | D.curvatureTensor x (b a) (b c) (b d) (b f) * V e a c * V e d f) := by |
| 267 | have h := hamilton_heat_quadratic_nonneg_of_block hC F ht x U W hU hQ |
| 268 | have hz := hamiltonBlock_vector_contraction_zero |
| 269 | (fun a c d e => (F.connection t).curvatureTensor x |
| 270 | ((F.metric t).orthonormalBasis x a) ((F.metric t).orthonormalBasis x c) |
| 271 | ((F.metric t).orthonormalBasis x d) ((F.metric t).orthonormalBasis x e)) |
| 272 | (fun a c d => hamiltonP (F.connection t) x ((F.metric t).orthonormalBasis x a) |
| 273 | ((F.metric t).orthonormalBasis x c) ((F.metric t).orthonormalBasis x d)) |
| 274 | (fun a c => hamiltonM (F.connection t) (t - T₀) x ((F.metric t).orthonormalBasis x a) |
| 275 | ((F.metric t).orthonormalBasis x c)) U W hQ hnull |
| 276 | dsimp only at h ⊢ |
| 277 | simpa only [hz, mul_zero, add_zero] using h |
| 278 | |
| 279 | end Poincare.RicciFlow.Harnack |