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.Tensor.HeatTrace |
| 2 | import PoincareLib.Geometry.RicciFlow.Tensor.HeatProduct |
| 3 | |
| 4 | /-! |
| 5 | # Heat evolution of quadratic tensor contractions |
| 6 | |
| 7 | The tensor product and two metric traces give the Ricci squared-norm |
| 8 | evolution without differentiating the selected orthonormal basis. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | |
| 14 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 15 | |
| 16 | universe u |
| 17 | |
| 18 | namespace PoincareMT |
| 19 | |
| 20 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 21 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 22 | {g : RiemannianMetric n M} {J : Set ℝ} |
| 23 | |
| 24 | private noncomputable def productTwoDerivativePerm : Equiv.Perm (Fin 5) := |
| 25 | Equiv.ofBijective ![1, 2, 0, 3, 4] (by decide) |
| 26 | |
| 27 | private lemma productTwoDerivative_eq (D : LeviCivitaData g) |
| 28 | {S T : CovariantTensorEvaluation n M 2} |
| 29 | (hS : IsSmoothCovariantTensor S) (hT : IsSmoothCovariantTensor T) : |
| 30 | D.covariantTensorDerivative (tensorProduct S T) = fun x v => |
| 31 | tensorProduct (D.covariantTensorDerivative S) T x v + |
| 32 | tensorProduct S (D.covariantTensorDerivative T) x (v ∘ productTwoDerivativePerm) := by |
| 33 | funext x v |
| 34 | have hv : v = Fin.cons (v 0) (fun i : Fin 4 => v i.succ) := by |
| 35 | ext i |
| 36 | fin_cases i <;> rfl |
| 37 | conv_lhs => rw [hv] |
| 38 | rw [D.covariantTensorDerivative_tensorProduct hS hT] |
| 39 | simp only [tensorProduct] |
| 40 | congr 2 <;> congr 1 <;> ext i <;> fin_cases i <;> rfl |
| 41 | |
| 42 | lemma LeviCivitaData.tensorLaplacian_tensorProduct_two_two |
| 43 | (D : LeviCivitaData g) {S T : CovariantTensorEvaluation n M 2} |
| 44 | (hS : IsSmoothCovariantTensor S) (hT : IsSmoothCovariantTensor T) |
| 45 | (hDS : IsSmoothCovariantTensor (D.covariantTensorDerivative S)) |
| 46 | (hDT : IsSmoothCovariantTensor (D.covariantTensorDerivative T)) |
| 47 | (x : M) (a b c d : TangentSpace (𝓡 n) x) : |
| 48 | D.tensorLaplacian (tensorProduct S T) x ![a,b,c,d] = |
| 49 | D.tensorLaplacian S x ![a,b] * T x ![c,d] + |
| 50 | S x ![a,b] * D.tensorLaplacian T x ![c,d] + |
| 51 | 2 * ∑ i, D.covariantTensorDerivative S x ![g.orthonormalBasis x i,a,b] * |
| 52 | D.covariantTensorDerivative T x ![g.orthonormalBasis x i,c,d] := by |
| 53 | have hsecond (u w : TangentSpace (𝓡 n) x) : |
| 54 | D.iteratedCovariantTensorDerivative (tensorProduct S T) 2 x ![u,w,a,b,c,d] = |
| 55 | D.iteratedCovariantTensorDerivative S 2 x ![u,w,a,b] * T x ![c,d] + |
| 56 | D.covariantTensorDerivative S x ![w,a,b] * |
| 57 | D.covariantTensorDerivative T x ![u,c,d] + |
| 58 | (D.covariantTensorDerivative S x ![u,a,b] * |
| 59 | D.covariantTensorDerivative T x ![w,c,d] + |
| 60 | S x ![a,b] * D.iteratedCovariantTensorDerivative T 2 x ![u,w,c,d]) := by |
| 61 | simp only [LeviCivitaData.iteratedCovariantTensorDerivative] |
| 62 | rw [productTwoDerivative_eq D hS hT, |
| 63 | D.covariantTensorDerivative_add (isSmoothCovariantTensor_tensorProduct hDS hT) |
| 64 | ((isSmoothCovariantTensor_tensorProduct hS hDT).perm productTwoDerivativePerm)] |
| 65 | dsimp only |
| 66 | rw [D.covariantTensorDerivative_reindex] |
| 67 | have hv : Fin.cons (![u,w,a,b,c,d] 0) |
| 68 | (fun i => ![u,w,a,b,c,d] (productTwoDerivativePerm i).succ) = ![u,a,b,w,c,d] := by |
| 69 | ext i |
| 70 | fin_cases i <;> rfl |
| 71 | rw [hv] |
| 72 | have h₁ := D.covariantTensorDerivative_tensorProduct hDS hT x u ![w,a,b,c,d] |
| 73 | have h₂ := D.covariantTensorDerivative_tensorProduct hS hDT x u ![a,b,w,c,d] |
| 74 | simp only [Matrix.Fin.cons_vecCons] at h₁ h₂ |
| 75 | rw [h₁, h₂] |
| 76 | congr 2 <;> congr 1 <;> congr 1 <;> ext i <;> fin_cases i <;> rfl |
| 77 | simp only [LeviCivitaData.tensorLaplacian, Matrix.Fin.cons_vecCons] |
| 78 | simp_rw [hsecond] |
| 79 | simp only [Finset.sum_add_distrib, ← Finset.sum_mul, ← Finset.mul_sum] |
| 80 | ring |
| 81 | |
| 82 | lemma RicciFlow.tensorHeatOperator_tensorProduct_two_two |
| 83 | (F : RicciFlow n M J) {S T : ℝ → CovariantTensorEvaluation n M 2} {t : ℝ} |
| 84 | (hS : IsSmoothCovariantTensor (S t)) (hT : IsSmoothCovariantTensor (T t)) |
| 85 | (hDS : IsSmoothCovariantTensor ((F.connection t).covariantTensorDerivative (S t))) |
| 86 | (hDT : IsSmoothCovariantTensor ((F.connection t).covariantTensorDerivative (T t))) |
| 87 | (hSt : ∀ y z, DifferentiableAt ℝ (fun s => S s y z) t) |
| 88 | (hTt : ∀ y z, DifferentiableAt ℝ (fun s => T s y z) t) |
| 89 | (x : M) (a b c d : TangentSpace (𝓡 n) x) : |
| 90 | F.tensorHeatOperator (fun s => tensorProduct (S s) (T s)) t x ![a,b,c,d] = |
| 91 | F.tensorHeatOperator S t x ![a,b] * T t x ![c,d] + |
| 92 | S t x ![a,b] * F.tensorHeatOperator T t x ![c,d] - |
| 93 | 2 * ∑ i, (F.connection t).covariantTensorDerivative (S t) x |
| 94 | ![(F.metric t).orthonormalBasis x i,a,b] * |
| 95 | (F.connection t).covariantTensorDerivative (T t) x |
| 96 | ![(F.metric t).orthonormalBasis x i,c,d] := by |
| 97 | have hp (s : ℝ) : tensorProduct (S s) (T s) x ![a,b,c,d] = |
| 98 | S s x ![a,b] * T s x ![c,d] := by |
| 99 | unfold tensorProduct |
| 100 | congr 1 <;> congr 1 <;> ext i <;> fin_cases i <;> rfl |
| 101 | have ha := (F.connection t).ricciTensorAction_tensorProduct (S t) (T t) x ![a,b,c,d] |
| 102 | have hv₁ : (fun i : Fin 2 => ![a,b,c,d] (Fin.castAdd 2 i)) = ![a,b] := by |
| 103 | ext i; fin_cases i <;> rfl |
| 104 | have hv₂ : (fun i : Fin 2 => ![a,b,c,d] (Fin.natAdd 2 i)) = ![c,d] := by |
| 105 | ext i; fin_cases i <;> rfl |
| 106 | rw [hv₁, hv₂] at ha |
| 107 | simp only [RicciFlow.tensorHeatOperator, hp, deriv_fun_mul (hSt _ _) (hTt _ _), ha, |
| 108 | LeviCivitaData.tensorLaplacian_tensorProduct_two_two _ hS hT hDS hDT] |
| 109 | ring |
| 110 | |
| 111 | /-- Both inverse-metric derivative terms appear in the heat evolution of a |
| 112 | metric trace; metric compatibility removes the spatial connection terms. -/ |
| 113 | lemma RicciFlow.scalarHeatOperator_tensorTrace_two |
| 114 | (hC : RicciFlowCurvatureTheory.{u}) (F : RicciFlow n M J) |
| 115 | {T W : ℝ → CovariantTensorEvaluation n M 2} {t : ℝ} (ht : t ∈ interior J) |
| 116 | (hT : ∀ s, IsSmoothCovariantTensor (T s)) |
| 117 | (hW : ∀ (y : M) (z : Fin 2 → TangentSpace (𝓡 n) y), |
| 118 | HasDerivAt (fun s => T s y z) (W t y z) t) (x : M) : |
| 119 | deriv (fun s => ∑ i, T s x ![(F.metric s).orthonormalBasis x i, |
| 120 | (F.metric s).orthonormalBasis x i]) t - |
| 121 | (F.connection t).laplacian (fun y => ∑ i, |
| 122 | T t y ![(F.metric t).orthonormalBasis y i, (F.metric t).orthonormalBasis y i]) x = |
| 123 | ∑ i, F.tensorHeatOperator T t x ![(F.metric t).orthonormalBasis x i, |
| 124 | (F.metric t).orthonormalBasis x i] := by |
| 125 | let D := F.connection t |
| 126 | let b := (F.metric t).orthonormalBasis x |
| 127 | have hD := hC.tensor_calculus n M (F.metric t) D |
| 128 | have htime := (F.hasDerivAt_tensorTrace ht x hT (hW x) (Fin.elim0)).deriv |
| 129 | have hlap := D.sum_tensorLaplacian_eq_laplacian_trace (hT t) |
| 130 | (hD.2.2.1 _ _ (hT t)) x |
| 131 | have htuple (a c : TangentSpace (𝓡 n) x) : Fin.cons a (Fin.cons c Fin.elim0) = ![a,c] := by |
| 132 | ext i; fin_cases i <;> rfl |
| 133 | simp only [RiemannianMetric.tensorTrace, htuple] at htime |
| 134 | rw [htime, ← hlap] |
| 135 | simp only [RicciFlow.tensorHeatOperator, (hW _ _).deriv, |
| 136 | LeviCivitaData.ricciTensorAction_two, Finset.sum_add_distrib, Finset.sum_sub_distrib] |
| 137 | change (∑ i, W t x ![b i,b i]) + |
| 138 | 2 * (∑ i, ∑ j, D.ricci x (b i) (b j) * T t x ![b i,b j]) - _ = _ |
| 139 | have hs : (∑ i, ∑ j, D.ricci x (b i) (b j) * T t x ![b j,b i]) = |
| 140 | ∑ i, ∑ j, D.ricci x (b i) (b j) * T t x ![b i,b j] := by |
| 141 | rw [Finset.sum_comm] |
| 142 | apply Finset.sum_congr rfl |
| 143 | intro i _ |
| 144 | apply Finset.sum_congr rfl |
| 145 | intro j _ |
| 146 | rw [(hD.2.2.2.1 x (b j) (b i) (b i) (b j)).2.2.2] |
| 147 | dsimp only [D, b] at hs |
| 148 | rw [hs] |
| 149 | ring |
| 150 | |
| 151 | end PoincareMT |