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.DivergenceReaction |
| 3 | import PoincareLib.Geometry.RicciFlow.Harnack.Matrix.Evolution.TimeCorrection |
| 4 | import PoincareLib.Geometry.RicciFlow.Tensor.HeatLinearity |
| 5 | import PoincareLib.Geometry.RicciFlow.Evolution.CurvatureRicci |
| 6 | |
| 7 | /-! # Decomposition of Hamilton's two-tensor heat evolution |
| 8 | |
| 9 | The divergence formula splits the actual heat operator of M into its three |
| 10 | terms. Time differentiability is derived from M04 and inverse-metric trace |
| 11 | differentiation. This is the assembly step for Chow et al., Part II, |
| 12 | Lemma 15.19, equations (15.47)-(15.55), printed pp. 274-276. |
| 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 Topology |
| 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 | private lemma differentiableAt_trace |
| 32 | (F : RicciFlow n M J) {k : ℕ} |
| 33 | {T : ℝ → CovariantTensorEvaluation n M (k + 2)} |
| 34 | {t : ℝ} (ht : t ∈ interior J) (x : M) |
| 35 | (hT : ∀ s, IsSmoothCovariantTensor (T s)) |
| 36 | (hd : ∀ z, DifferentiableAt ℝ (fun s => T s x z) t) |
| 37 | (v : Fin k → TangentSpace (𝓡 n) x) : |
| 38 | DifferentiableAt ℝ (fun s => (F.metric s).tensorTrace (T s) x v) t := by |
| 39 | exact (F.hasDerivAt_tensorTrace |
| 40 | (W := fun _ y z => deriv (fun s => T s y z) t) ht x hT |
| 41 | (fun z => (hd z).hasDerivAt) v).differentiableAt |
| 42 | |
| 43 | lemma differentiableAt_curvatureRicci |
| 44 | (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 45 | {t : ℝ} (ht : t ∈ interior J) (x : M) |
| 46 | (v : Fin 2 → TangentSpace (𝓡 n) x) : |
| 47 | DifferentiableAt ℝ (fun s => |
| 48 | ∑ i, ∑ j, (F.connection s).curvatureTensor x (v 0) |
| 49 | ((F.metric s).orthonormalBasis x i) (v 1) ((F.metric s).orthonormalBasis x j) * |
| 50 | (F.connection s).ricci x ((F.metric s).orthonormalBasis x i) |
| 51 | ((F.metric s).orthonormalBasis x j)) t := by |
| 52 | let σ : Equiv.Perm (Fin 6) := Equiv.ofBijective ![4, 0, 5, 2, 1, 3] (by decide) |
| 53 | let S : ℝ → CovariantTensorEvaluation n M 6 := fun s y z => |
| 54 | tensorProduct (F.connection s).riemannEvaluation (F.connection s).ricciEvaluation |
| 55 | y (z ∘ σ) |
| 56 | have hS (s : ℝ) : IsSmoothCovariantTensor (S s) := |
| 57 | (isSmoothCovariantTensor_tensorProduct |
| 58 | (hC.tensor_calculus n M (F.metric s) (F.connection s)).1 |
| 59 | (hC.tensor_calculus n M (F.metric s) (F.connection s)).2.1).perm σ |
| 60 | have hd (z : Fin 6 → TangentSpace (𝓡 n) x) : |
| 61 | DifferentiableAt ℝ (fun s => S s x z) t := by |
| 62 | exact ((hC.curvature_evolution n M J F t (interior_subset ht) x |
| 63 | (z (σ 0)) (z (σ 1)) (z (σ 2)) (z (σ 3))).hasDerivAt |
| 64 | (mem_interior_iff_mem_nhds.mp ht)).differentiableAt.mul |
| 65 | ((hC.ricci_evolution n M J F t (interior_subset ht) x |
| 66 | (z (σ 4)) (z (σ 5))).hasDerivAt |
| 67 | (mem_interior_iff_mem_nhds.mp ht)).differentiableAt |
| 68 | have h := differentiableAt_trace F ht x |
| 69 | (fun s => (hS s).tensorTrace (g := F.metric s)) |
| 70 | (fun z => differentiableAt_trace F ht x hS hd z) v |
| 71 | simpa only [S, σ, ← LeviCivitaData.curvatureRicci_eq_double_trace] using h |
| 72 | |
| 73 | lemma tensorHeatOperator_hamiltonM_decomposition |
| 74 | (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 75 | (T₀ : ℝ) {t : ℝ} (ht : t ∈ interior J) (hτ : t - T₀ ≠ 0) |
| 76 | (x : M) (a b : TangentSpace (𝓡 n) x) : |
| 77 | let P : ℝ → CovariantTensorEvaluation n M 3 := fun s y z => |
| 78 | hamiltonP (F.connection s) y (z 0) (z 1) (z 2) |
| 79 | let C : ℝ → CovariantTensorEvaluation n M 2 := fun s y z => |
| 80 | ∑ i, ∑ j, (F.connection s).curvatureTensor y (z 0) |
| 81 | ((F.metric s).orthonormalBasis y i) (z 1) ((F.metric s).orthonormalBasis y j) * |
| 82 | (F.connection s).ricci y ((F.metric s).orthonormalBasis y i) |
| 83 | ((F.metric s).orthonormalBasis y j) |
| 84 | F.tensorHeatOperator (fun s y z => hamiltonM (F.connection s) (s - T₀) y |
| 85 | (z 0) (z 1)) t x ![a, b] = |
| 86 | F.tensorHeatOperator (fun s => (F.metric s).tensorTrace |
| 87 | ((F.connection s).covariantTensorDerivative (P s))) t x ![a, b] + |
| 88 | F.tensorHeatOperator C t x ![a, b] + |
| 89 | F.tensorHeatOperator (fun s y z => |
| 90 | (F.connection s).ricciEvaluation y z / (2 * (s - T₀))) t x ![a, b] := by |
| 91 | let P : ℝ → CovariantTensorEvaluation n M 3 := fun s y z => |
| 92 | hamiltonP (F.connection s) y (z 0) (z 1) (z 2) |
| 93 | let B : ℝ → CovariantTensorEvaluation n M 2 := fun s => |
| 94 | (F.metric s).tensorTrace ((F.connection s).covariantTensorDerivative (P s)) |
| 95 | let C : ℝ → CovariantTensorEvaluation n M 2 := fun s y z => |
| 96 | ∑ i, ∑ j, (F.connection s).curvatureTensor y (z 0) |
| 97 | ((F.metric s).orthonormalBasis y i) (z 1) ((F.metric s).orthonormalBasis y j) * |
| 98 | (F.connection s).ricci y ((F.metric s).orthonormalBasis y i) |
| 99 | ((F.metric s).orthonormalBasis y j) |
| 100 | let Q : ℝ → CovariantTensorEvaluation n M 2 := fun s y z => |
| 101 | (F.connection s).ricciEvaluation y z / (2 * (s - T₀)) |
| 102 | have hD (s) := hC.tensor_calculus n M (F.metric s) (F.connection s) |
| 103 | have hB : IsSmoothCovariantTensor (B t) := |
| 104 | ((hD t).2.2.1 _ _ (hamiltonP_isSmoothCovariantTensor _ (hD t))).tensorTrace |
| 105 | have hCs : IsSmoothCovariantTensor (C t) := |
| 106 | (F.connection t).isSmoothCovariantTensor_curvatureRicci (hD t) |
| 107 | have hQ : IsSmoothCovariantTensor (Q t) := by |
| 108 | simpa only [Q, div_eq_mul_inv, mul_comm] using |
| 109 | (hD t).2.1.const_mul (2 * (t - T₀))⁻¹ |
| 110 | have hdB : DifferentiableAt ℝ (fun s => B s x ![a, b]) t := |
| 111 | (hasDerivAt_divergence_hamiltonP hC F ht x a b).differentiableAt |
| 112 | have hdC : DifferentiableAt ℝ (fun s => C s x ![a, b]) t := |
| 113 | differentiableAt_curvatureRicci hC F ht x ![a, b] |
| 114 | have hdQ : DifferentiableAt ℝ (fun s => Q s x ![a, b]) t := |
| 115 | ((hC.ricci_evolution n M J F t (interior_subset ht) x a b).hasDerivAt |
| 116 | (mem_interior_iff_mem_nhds.mp ht)).differentiableAt.div |
| 117 | (differentiableAt_const _ |>.mul (differentiableAt_id.sub_const T₀)) |
| 118 | (mul_ne_zero (by norm_num) hτ) |
| 119 | have heq : (fun s y z => hamiltonM (F.connection s) (s - T₀) y (z 0) (z 1)) = |
| 120 | (fun s y z => (B s y z + C s y z) + Q s y z) := by |
| 121 | funext s y z |
| 122 | have hz : z = ![z 0, z 1] := by ext i; fin_cases i <;> rfl |
| 123 | rw [hz] |
| 124 | rw [hamiltonM_eq_divergence_hamiltonP _ (hD s)] |
| 125 | dsimp only [B, C, Q, P, RiemannianMetric.tensorTrace] |
| 126 | apply congrArg (fun r : ℝ => _ + r + _) |
| 127 | apply Finset.sum_congr rfl |
| 128 | intro i _ |
| 129 | apply Finset.sum_congr rfl |
| 130 | intro j _ |
| 131 | have hs := (hD s).2.2.2.1 |
| 132 | rw [(hs y _ _ _ _).2.1, (hs y _ _ _ _).1, |
| 133 | (hs y _ _ _ _).2.1, (hs y _ _ _ _).1, neg_neg] |
| 134 | rw [heq, F.tensorHeatOperator_add (hB.add hCs) hQ |
| 135 | ((hD t).2.2.1 _ _ (hB.add hCs)) ((hD t).2.2.1 _ _ hQ) |
| 136 | x ![a, b] (hdB.add hdC) hdQ, |
| 137 | F.tensorHeatOperator_add hB hCs ((hD t).2.2.1 _ _ hB) |
| 138 | ((hD t).2.2.1 _ _ hCs) x ![a, b] hdB hdC] |
| 139 | |
| 140 | /-- The three linear curvature contractions in the heat decomposition combine |
| 141 | into the curvature action on Hamilton's two-tensor. -/ |
| 142 | lemma curvature_contraction_hamiltonM |
| 143 | {g : RiemannianMetric n M} (D : LeviCivitaData g) |
| 144 | (hD : D.CurvatureTensorCalculus) (τ : ℝ) |
| 145 | (x : M) (a b : TangentSpace (𝓡 n) x) : |
| 146 | let e := g.orthonormalBasis x |
| 147 | let P : CovariantTensorEvaluation n M 3 := fun y z => |
| 148 | hamiltonP D y (z 0) (z 1) (z 2) |
| 149 | (∑ i, ∑ j, D.curvatureTensor x a (e i) b (e j) * |
| 150 | hamiltonM D τ x (e i) (e j)) = |
| 151 | (∑ k, ∑ i, ∑ j, D.curvatureTensor x a (e i) b (e j) * |
| 152 | D.covariantTensorDerivative P x ![e k, e k, e i, e j]) + |
| 153 | (∑ i, ∑ j, ∑ k, ∑ l, D.curvatureTensor x a (e i) b (e j) * |
| 154 | D.curvatureTensor x (e i) (e k) (e j) (e l) * D.ricci x (e k) (e l)) + |
| 155 | (∑ i, ∑ j, D.curvatureTensor x a (e i) b (e j) * |
| 156 | (D.ricci x (e i) (e j) / (2 * τ))) := by |
| 157 | dsimp only |
| 158 | have hslot (i j k l) : |
| 159 | D.curvatureTensor x (g.orthonormalBasis x k) (g.orthonormalBasis x i) |
| 160 | (g.orthonormalBasis x l) (g.orthonormalBasis x j) = |
| 161 | D.curvatureTensor x (g.orthonormalBasis x i) (g.orthonormalBasis x k) |
| 162 | (g.orthonormalBasis x j) (g.orthonormalBasis x l) := by |
| 163 | have hs := hD.2.2.2.1 |
| 164 | rw [(hs x _ _ _ _).2.1, (hs x _ _ _ _).1, |
| 165 | (hs x _ _ _ _).2.1, (hs x _ _ _ _).1, neg_neg] |
| 166 | simp_rw [hamiltonM_eq_divergence_hamiltonP D hD, hslot] |
| 167 | simp only [mul_add, Finset.mul_sum, Finset.sum_add_distrib, mul_assoc] |
| 168 | congr 2 |
| 169 | conv_rhs => rw [Finset.sum_comm] |
| 170 | apply Finset.sum_congr rfl |
| 171 | intro i _ |
| 172 | exact Finset.sum_comm |
| 173 | |
| 174 | /-- Hamilton's two-tensor evolution, Chow et al., Part II, Lemma 15.19, |
| 175 | equation (15.46), printed p. 274. The divergence, product, and reciprocal-time |
| 176 | evolutions cancel the gradient and curvature-quadratic terms. -/ |
| 177 | theorem tensorHeatOperator_hamiltonM |
| 178 | (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 179 | (T₀ : ℝ) {t : ℝ} (ht : t ∈ interior J) (hτ : t - T₀ ≠ 0) |
| 180 | (x : M) (a b : TangentSpace (𝓡 n) x) : |
| 181 | let D := F.connection t |
| 182 | let e := (F.metric t).orthonormalBasis x |
| 183 | let P : CovariantTensorEvaluation n M 3 := fun y z => |
| 184 | hamiltonP D y (z 0) (z 1) (z 2) |
| 185 | F.tensorHeatOperator (fun s y z => hamiltonM (F.connection s) (s - T₀) y |
| 186 | (z 0) (z 1)) t x ![a, b] = |
| 187 | 2 * (∑ i, ∑ j, D.curvatureTensor x a (e i) b (e j) * |
| 188 | hamiltonM D (t - T₀) x (e i) (e j)) + |
| 189 | 2 * (∑ i, ∑ j, D.ricci x (e i) (e j) * |
| 190 | (D.covariantTensorDerivative P x ![e i, e j, a, b] + |
| 191 | D.covariantTensorDerivative P x ![e i, e j, b, a])) + |
| 192 | (∑ i, ∑ j, hamiltonP D x (e i) (e j) a * hamiltonP D x (e i) (e j) b) - |
| 193 | 2 * (∑ i, ∑ j, hamiltonP D x a (e i) (e j) * hamiltonP D x b (e j) (e i)) + |
| 194 | 2 * (∑ i, ∑ j, ∑ k, D.ricci x (e i) (e j) * D.ricci x (e i) (e k) * |
| 195 | D.curvatureTensor x a (e k) b (e j)) - |
| 196 | D.ricci x a b / (2 * (t - T₀) ^ 2) := by |
| 197 | have hM := tensorHeatOperator_hamiltonM_decomposition hC F T₀ ht hτ x a b |
| 198 | have hP := tensorHeatOperator_divergence_hamiltonP_reaction hC F ht x a b |
| 199 | have hCprod := tensorHeatOperator_curvatureRicci hC F ht x a b |
| 200 | have hQ := tensorHeatOperator_ricci_timeCorrection hC F T₀ ht hτ x a b |
| 201 | have hcontract := curvature_contraction_hamiltonM (F.connection t) |
| 202 | (hC.tensor_calculus n M (F.metric t) (F.connection t)) (t - T₀) x a b |
| 203 | dsimp only at hM hP hCprod hQ hcontract ⊢ |
| 204 | linarith only [hM, hP, hCprod, hQ, hcontract] |
| 205 | |
| 206 | end Poincare.RicciFlow.Harnack |