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.Tensor.TimeDerivative.General |
| 3 | import PoincareLib.Geometry.RicciFlow.Connection.Variation |
| 4 | import PoincareLib.Geometry.Riemannian.Tensor.Commutation.Laplacian.Three |
| 5 | import PoincareLib.Geometry.Riemannian.Tensor.MetricDuality |
| 6 | import PoincareLib.Geometry.RicciFlow.Tensor.HeatGradient |
| 7 | import PoincareLib.Geometry.RicciFlow.Tensor.RicciAction.Three |
| 8 | |
| 9 | /-! |
| 10 | # Heat-gradient commutation in a fixed frame for three-tensors |
| 11 | |
| 12 | Connection variation cancels the two off-direction differentiated Ricci |
| 13 | terms in the spatial commutator. The derivative direction retains its |
| 14 | Ricci action. This supports Chow et al., Part II, (15.48), printed p. 275. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.RicciFlow |
| 25 | |
| 26 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 28 | {J : Set ℝ} |
| 29 | |
| 30 | lemma covariantTensorDerivative_fixed_heat_commutator_three |
| 31 | (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 32 | {T W : ℝ → CovariantTensorEvaluation n M 3} {t : ℝ} (ht : t ∈ interior J) |
| 33 | (hT : ∀ s, IsSmoothCovariantTensor (T s)) |
| 34 | (hreg : ∀ (y : M) (X : Fin 3 → (z : M) → TangentSpace (𝓡 n) z), |
| 35 | (∀ i, ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 36 | (T% (X i)) y) → |
| 37 | ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 38 | (fun p : ℝ × M => T p.1 p.2 (fun i => X i p.2)) (t, y)) |
| 39 | (hW : ∀ (y : M) (z : Fin 3 → TangentSpace (𝓡 n) y), |
| 40 | HasDerivAt (fun s => T s y z) (W t y z) t) |
| 41 | (x : M) (a b c d : TangentSpace (𝓡 n) x) : |
| 42 | let D := F.connection t |
| 43 | let e := (F.metric t).orthonormalBasis x |
| 44 | deriv (fun s => (F.connection s).covariantTensorDerivative (T s) x ![a, b, c, d]) t - |
| 45 | D.tensorLaplacian (D.covariantTensorDerivative (T t)) x ![a, b, c, d] - |
| 46 | (D.covariantTensorDerivative (W t) x ![a, b, c, d] - |
| 47 | D.covariantTensorDerivative (D.tensorLaplacian (T t)) x ![a, b, c, d]) = |
| 48 | 2 * (∑ i, ∑ j, D.curvatureTensor x a (e i) b (e j) * |
| 49 | D.covariantTensorDerivative (T t) x ![e i, e j, c, d]) + |
| 50 | 2 * (∑ i, ∑ j, D.curvatureTensor x a (e i) c (e j) * |
| 51 | D.covariantTensorDerivative (T t) x ![e i, b, e j, d]) + |
| 52 | 2 * (∑ i, ∑ j, D.curvatureTensor x a (e i) d (e j) * |
| 53 | D.covariantTensorDerivative (T t) x ![e i, b, c, e j]) - |
| 54 | (∑ i, D.ricci x a (e i) * D.covariantTensorDerivative (T t) x ![e i, b, c, d]) + |
| 55 | (∑ j, D.covariantTensorDerivative D.ricciEvaluation x ![a, b, e j] * T t x ![e j, c, d]) + |
| 56 | (∑ j, D.covariantTensorDerivative D.ricciEvaluation x ![a, c, e j] * T t x ![b, e j, d]) + |
| 57 | (∑ j, D.covariantTensorDerivative D.ricciEvaluation x ![a, d, e j] * T t x ![b, c, e j]) := by |
| 58 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 59 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 60 | let D := F.connection t |
| 61 | let e := (F.metric t).orthonormalBasis x |
| 62 | let A := fun q : TangentSpace (𝓡 n) x => deriv (fun s => |
| 63 | (F.connection s).connection (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) q) x) t |
| 64 | have hD := hC.tensor_calculus n M (F.metric t) D |
| 65 | have htime := (F.hasDerivAt_covariantTensorDerivative_time_all ht x hT hreg hW a ![b, c, d]).deriv |
| 66 | have hlap := D.covariantTensorDerivative_tensorLaplacian_commutator_three hD (hT t) x a b c d |
| 67 | have hslot (r : Fin 3) : T t x (Function.update ![b, c, d] r (A (![b, c, d] r) a)) = |
| 68 | ∑ j, (-D.covariantTensorDerivative D.ricciEvaluation x ![a, ![b, c, d] r, e j] - |
| 69 | D.covariantTensorDerivative D.ricciEvaluation x ![![b, c, d] r, a, e j] + |
| 70 | D.covariantTensorDerivative D.ricciEvaluation x ![e j, a, ![b, c, d] r]) * |
| 71 | T t x (Function.update ![b, c, d] r (e j)) := by |
| 72 | rw [(hT t).update_eq_sum (F.metric t) x ![b, c, d] r (A (![b, c, d] r) a)] |
| 73 | apply Finset.sum_congr rfl |
| 74 | intro j _ |
| 75 | congr 1 |
| 76 | exact F.inner_deriv_connection_extend ht hD x a (![b, c, d] r) (e j) |
| 77 | have hup (w : TangentSpace (𝓡 n) x) : |
| 78 | Function.update ![b, c, d] 0 w = ![w, c, d] ∧ |
| 79 | Function.update ![b, c, d] 1 w = ![b, w, d] ∧ |
| 80 | Function.update ![b, c, d] 2 w = ![b, c, w] := by |
| 81 | constructor |
| 82 | · ext i; fin_cases i <;> simp |
| 83 | constructor <;> (ext i; fin_cases i <;> simp) |
| 84 | change _ = D.covariantTensorDerivative (W t) x ![a, b, c, d] - |
| 85 | ∑ r : Fin 3, T t x (Function.update ![b, c, d] r (A (![b, c, d] r) a)) at htime |
| 86 | simp_rw [hslot] at htime |
| 87 | simp only [Fin.sum_univ_three, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, |
| 88 | hup, sub_mul, add_mul, neg_mul, Finset.sum_add_distrib, Finset.sum_sub_distrib, |
| 89 | Finset.sum_neg_distrib] at htime |
| 90 | dsimp only at hlap ⊢ |
| 91 | simp only [sub_mul, Finset.sum_sub_distrib] at hlap |
| 92 | dsimp only [D, e] at htime hlap |
| 93 | simp only [Matrix.Fin.cons_vecCons, Matrix.head_cons, Matrix.tail_cons] at htime |
| 94 | linarith only [htime, hlap] |
| 95 | |
| 96 | lemma tensorHeatOperator_covariantTensorDerivative_commutator_three |
| 97 | (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 98 | {T W : ℝ → CovariantTensorEvaluation n M 3} {t : ℝ} (ht : t ∈ interior J) |
| 99 | (hT : ∀ s, IsSmoothCovariantTensor (T s)) |
| 100 | (hreg : ∀ (y : M) (X : Fin 3 → (z : M) → TangentSpace (𝓡 n) z), |
| 101 | (∀ i, ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 102 | (T% (X i)) y) → |
| 103 | ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 104 | (fun p : ℝ × M => T p.1 p.2 (fun i => X i p.2)) (t, y)) |
| 105 | (hW : ∀ (y : M) (z : Fin 3 → TangentSpace (𝓡 n) y), |
| 106 | HasDerivAt (fun s => T s y z) (W t y z) t) |
| 107 | (x : M) (a b c d : TangentSpace (𝓡 n) x) : |
| 108 | let D := F.connection t |
| 109 | let e := (F.metric t).orthonormalBasis x |
| 110 | tensorHeatOperator F (fun s => (F.connection s).covariantTensorDerivative (T s)) t x ![a, b, c, d] - |
| 111 | D.covariantTensorDerivative (tensorHeatOperator F T t) x ![a, b, c, d] = |
| 112 | 2 * (∑ i, ∑ j, D.curvatureTensor x a (e i) b (e j) * |
| 113 | D.covariantTensorDerivative (T t) x ![e i, e j, c, d]) + |
| 114 | 2 * (∑ i, ∑ j, D.curvatureTensor x a (e i) c (e j) * |
| 115 | D.covariantTensorDerivative (T t) x ![e i, b, e j, d]) + |
| 116 | 2 * (∑ i, ∑ j, D.curvatureTensor x a (e i) d (e j) * |
| 117 | D.covariantTensorDerivative (T t) x ![e i, b, c, e j]) := by |
| 118 | let D := F.connection t |
| 119 | let e := (F.metric t).orthonormalBasis x |
| 120 | have hD := hC.tensor_calculus n M (F.metric t) D |
| 121 | have hWs := isSmoothCovariantTensor_timeDerivative_all hT hreg hW |
| 122 | have hLs : IsSmoothCovariantTensor (D.tensorLaplacian (T t)) := |
| 123 | (hD.2.2.1 _ _ (hD.2.2.1 _ _ (hT t))).tensorTrace |
| 124 | have hAs := D.isSmoothCovariantTensor_ricciTensorAction_three hD (hT t) |
| 125 | have hheat : tensorHeatOperator F T t = fun y z => |
| 126 | W t y z + D.ricciTensorAction (T t) y z - D.tensorLaplacian (T t) y z := by |
| 127 | funext y z |
| 128 | exact congrArg (fun q => q + D.ricciTensorAction (T t) y z - |
| 129 | D.tensorLaplacian (T t) y z) (hW y z).deriv |
| 130 | have hder : D.covariantTensorDerivative (tensorHeatOperator F T t) x ![a, b, c, d] = |
| 131 | D.covariantTensorDerivative (W t) x ![a, b, c, d] + |
| 132 | D.covariantTensorDerivative (D.ricciTensorAction (T t)) x ![a, b, c, d] - |
| 133 | D.covariantTensorDerivative (D.tensorLaplacian (T t)) x ![a, b, c, d] := by |
| 134 | rw [hheat, D.covariantTensorDerivative_sub (hWs.add hAs) hLs, |
| 135 | D.covariantTensorDerivative_add hWs hAs] |
| 136 | have hfix := F.covariantTensorDerivative_fixed_heat_commutator_three hC ht hT hreg hW x a b c d |
| 137 | have hric := D.covariantTensorDerivative_ricciTensorAction_three hD (hT t) x a ![b, c, d] |
| 138 | have hup3 (w : TangentSpace (𝓡 n) x) : |
| 139 | Function.update ![b, c, d] 0 w = ![w, c, d] ∧ |
| 140 | Function.update ![b, c, d] 1 w = ![b, w, d] ∧ |
| 141 | Function.update ![b, c, d] 2 w = ![b, c, w] := by |
| 142 | constructor |
| 143 | · ext i; fin_cases i <;> simp |
| 144 | constructor <;> (ext i; fin_cases i <;> simp) |
| 145 | have hup4 (w : TangentSpace (𝓡 n) x) : |
| 146 | Function.update ![a, b, c, d] 0 w = ![w, b, c, d] ∧ |
| 147 | Function.update ![a, b, c, d] 1 w = ![a, w, c, d] ∧ |
| 148 | Function.update ![a, b, c, d] 2 w = ![a, b, w, d] ∧ |
| 149 | Function.update ![a, b, c, d] 3 w = ![a, b, c, w] := by |
| 150 | constructor |
| 151 | · ext i; fin_cases i <;> simp |
| 152 | constructor |
| 153 | · ext i; fin_cases i <;> simp |
| 154 | constructor <;> (ext i; fin_cases i <;> simp) |
| 155 | have hact : D.ricciTensorAction (D.covariantTensorDerivative (T t)) x ![a, b, c, d] = |
| 156 | (∑ i, D.ricci x a (e i) * D.covariantTensorDerivative (T t) x ![e i, b, c, d]) + |
| 157 | (∑ i, D.ricci x b (e i) * D.covariantTensorDerivative (T t) x ![a, e i, c, d]) + |
| 158 | (∑ i, D.ricci x c (e i) * D.covariantTensorDerivative (T t) x ![a, b, e i, d]) + |
| 159 | (∑ i, D.ricci x d (e i) * D.covariantTensorDerivative (T t) x ![a, b, c, e i]) := by |
| 160 | unfold LeviCivitaData.ricciTensorAction |
| 161 | rw [Fin.sum_univ_four] |
| 162 | simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, |
| 163 | Matrix.cons_val_three, hup4] |
| 164 | rfl |
| 165 | simp only [Fin.sum_univ_three, Matrix.cons_val_zero, Matrix.cons_val_one, |
| 166 | Matrix.cons_val_two, hup3, Matrix.Fin.cons_vecCons, Finset.sum_add_distrib] at hric |
| 167 | dsimp only at hfix ⊢ |
| 168 | change deriv (fun s => (F.connection s).covariantTensorDerivative (T s) x ![a, b, c, d]) t + |
| 169 | D.ricciTensorAction (D.covariantTensorDerivative (T t)) x ![a, b, c, d] - |
| 170 | D.tensorLaplacian (D.covariantTensorDerivative (T t)) x ![a, b, c, d] - |
| 171 | D.covariantTensorDerivative (tensorHeatOperator F T t) x ![a, b, c, d] = _ |
| 172 | rw [hder, hact] |
| 173 | dsimp only [D, e] at hric ⊢ |
| 174 | simp only [Matrix.head_cons, Matrix.tail_cons] at hric |
| 175 | linarith only [hfix, hric] |
| 176 | |
| 177 | end PoincareMT.RicciFlow |