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.Soliton.ThreeDimensional.Compact.TensorNorm |
| 2 | import PoincareLib.Geometry.RicciFlow.Soliton.ThreeDimensional.Compact.RicciContraction |
| 3 | import PoincareLib.Geometry.RicciFlow.Curvature.Evolution.Ricci |
| 4 | import PoincareLib.Geometry.Riemannian.Curvature.Scalar.Regularity |
| 5 | import PoincareLib.Geometry.Riemannian.ScalarOperators.Product |
| 6 | |
| 7 | /-! |
| 8 | # The geometric evolution of the Ricci squared norm |
| 9 | |
| 10 | Two traces of the actual Ricci tensor product yield its scalar heat equation. |
| 11 | In dimension three the curvature contraction becomes the cubic Ricci trace |
| 12 | polynomial. All evolution inputs are fields of the original curvature theory. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.RicciFlow |
| 23 | |
| 24 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 26 | {J : Set ℝ} |
| 27 | |
| 28 | private noncomputable def ricciNormPerm : Equiv.Perm (Fin 4) := |
| 29 | Equiv.ofBijective ![2, 0, 3, 1] (by decide) |
| 30 | |
| 31 | theorem contMDiff_ricciNormSq {g : RiemannianMetric n M} |
| 32 | (D : LeviCivitaData g) (hD : D.CurvatureTensorCalculus) : |
| 33 | ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ D.ricciNormSq := by |
| 34 | let U : CovariantTensorEvaluation n M 4 := fun y z => |
| 35 | tensorProduct D.ricciEvaluation D.ricciEvaluation y (z ∘ ricciNormPerm) |
| 36 | have hU : IsSmoothCovariantTensor U := |
| 37 | (isSmoothCovariantTensor_tensorProduct hD.2.1 hD.2.1).perm ricciNormPerm |
| 38 | have h := ((hU.tensorTrace (g := g)).tensorTrace (g := g)).2 Set.univ isOpen_univ |
| 39 | (fun i => Fin.elim0 i) (fun i => Fin.elim0 i) |
| 40 | rw [contMDiffOn_univ] at h |
| 41 | convert h using 1 |
| 42 | ext x |
| 43 | change (∑ i, ∑ j, (D.ricci x (g.orthonormalBasis x i) (g.orthonormalBasis x j)) ^ 2) = |
| 44 | ∑ i, ∑ j, D.ricci x (g.orthonormalBasis x i) (g.orthonormalBasis x j) * |
| 45 | D.ricci x (g.orthonormalBasis x i) (g.orthonormalBasis x j) |
| 46 | simp only [pow_two] |
| 47 | |
| 48 | /-- The scalar heat equation for the actual Ricci squared norm. -/ |
| 49 | theorem hasDerivAt_ricciNormSq |
| 50 | (hC : RicciFlowCurvatureTheory.{u}) (F : RicciFlow n M J) |
| 51 | {t : ℝ} (ht : t ∈ interior J) (x : M) : |
| 52 | let D := F.connection t |
| 53 | let b := (F.metric t).orthonormalBasis x |
| 54 | HasDerivAt (fun s => (F.connection s).ricciNormSq x) |
| 55 | (D.laplacian D.ricciNormSq x - |
| 56 | 2 * (∑ k, ∑ i, ∑ j, |
| 57 | (D.covariantTensorDerivative D.ricciEvaluation x ![b k,b i,b j]) ^ 2) + |
| 58 | 4 * (∑ i, ∑ j, D.ricci x (b i) (b j) * |
| 59 | (∑ a, ∑ c, D.curvatureTensor x (b i) (b a) (b j) (b c) * |
| 60 | D.ricci x (b a) (b c)))) t := by |
| 61 | classical |
| 62 | let D := F.connection t |
| 63 | let b := (F.metric t).orthonormalBasis x |
| 64 | let S : ℝ → CovariantTensorEvaluation n M 2 := fun s => (F.connection s).ricciEvaluation |
| 65 | let U : ℝ → CovariantTensorEvaluation n M 4 := fun s y z => |
| 66 | tensorProduct (S s) (S s) y (z ∘ ricciNormPerm) |
| 67 | let V : ℝ → CovariantTensorEvaluation n M 2 := fun s => (F.metric s).tensorTrace (U s) |
| 68 | have hD (s : ℝ) := hC.tensor_calculus n M (F.metric s) (F.connection s) |
| 69 | have hS (y : M) (z : Fin 2 → TangentSpace (𝓡 n) y) : |
| 70 | DifferentiableAt ℝ (fun s => S s y z) t := |
| 71 | ((hC.ricci_evolution n M J F t (interior_subset ht) y (z 0) (z 1)).hasDerivAt |
| 72 | (mem_interior_iff_mem_nhds.mp ht)).differentiableAt |
| 73 | have hU (s : ℝ) : IsSmoothCovariantTensor (U s) := |
| 74 | (isSmoothCovariantTensor_tensorProduct (hD s).2.1 (hD s).2.1).perm ricciNormPerm |
| 75 | have hUt (y : M) (z : Fin 4 → TangentSpace (𝓡 n) y) : |
| 76 | HasDerivAt (fun s => U s y z) (deriv (fun s => U s y z) t) t := |
| 77 | ((hS y _).mul (hS y _)).hasDerivAt |
| 78 | have hV (s : ℝ) : IsSmoothCovariantTensor (V s) := (hU s).tensorTrace |
| 79 | have hVt (y : M) (z : Fin 2 → TangentSpace (𝓡 n) y) : |
| 80 | HasDerivAt (fun s => V s y z) (deriv (fun s => V s y z) t) t := |
| 81 | (F.hasDerivAt_tensorTrace (W := fun s y z => deriv (fun r => U r y z) s) |
| 82 | ht y hU (hUt y) z).differentiableAt.hasDerivAt |
| 83 | have hnorm (s : ℝ) (y : M) : |
| 84 | (∑ i, V s y ![(F.metric s).orthonormalBasis y i, |
| 85 | (F.metric s).orthonormalBasis y i]) = (F.connection s).ricciNormSq y := by |
| 86 | change (∑ i, ∑ j, (F.connection s).ricci y |
| 87 | ((F.metric s).orthonormalBasis y i) ((F.metric s).orthonormalBasis y j) * |
| 88 | (F.connection s).ricci y ((F.metric s).orthonormalBasis y i) |
| 89 | ((F.metric s).orthonormalBasis y j)) = _ |
| 90 | simp only [LeviCivitaData.ricciNormSq, pow_two] |
| 91 | have htime := F.hasDerivAt_tensorTrace (W := fun s y z => deriv (fun r => V r y z) s) |
| 92 | ht x hV (hVt x) Fin.elim0 |
| 93 | have htime' : DifferentiableAt ℝ (fun s => (F.connection s).ricciNormSq x) t := by |
| 94 | have hfn : (fun s => (F.metric s).tensorTrace (V s) x Fin.elim0) = |
| 95 | (fun s => (F.connection s).ricciNormSq x) := funext fun s => hnorm s x |
| 96 | rw [← hfn] |
| 97 | exact htime.differentiableAt |
| 98 | have heq := F.scalarHeatOperator_tensorTrace_two hC ht hV |
| 99 | (W := fun s y z => deriv (fun r => V r y z) s) hVt x |
| 100 | simp only [hnorm] at heq |
| 101 | have hheat (i j : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x))) : |
| 102 | F.tensorHeatOperator U t x ![b j,b j,b i,b i] = |
| 103 | 4 * D.ricci x (b i) (b j) * |
| 104 | (∑ a, ∑ c, D.curvatureTensor x (b i) (b a) (b j) (b c) * |
| 105 | D.ricci x (b a) (b c)) - |
| 106 | 2 * ∑ k, (D.covariantTensorDerivative D.ricciEvaluation x ![b k,b i,b j]) ^ 2 := by |
| 107 | change F.tensorHeatOperator |
| 108 | (fun s y z => tensorProduct (S s) (S s) y (z ∘ ricciNormPerm)) t x _ = _ |
| 109 | rw [F.tensorHeatOperator_reindex] |
| 110 | have hv : ![b j,b j,b i,b i] ∘ ricciNormPerm = ![b i,b j,b i,b j] := by |
| 111 | ext k; fin_cases k <;> rfl |
| 112 | rw [hv, F.tensorHeatOperator_tensorProduct_two_two (hD t).2.1 (hD t).2.1 |
| 113 | ((hD t).2.2.1 _ _ (hD t).2.1) ((hD t).2.2.1 _ _ (hD t).2.1) hS hS] |
| 114 | dsimp only [S] |
| 115 | rw [F.tensorHeatOperator_ricci hC ht] |
| 116 | simp only [LeviCivitaData.ricciEvaluation, Matrix.cons_val_zero, Matrix.cons_val_one, |
| 117 | ← pow_two] |
| 118 | dsimp only [D, b] |
| 119 | ring |
| 120 | have htrace (i : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x))) : |
| 121 | F.tensorHeatOperator V t x ![b i,b i] = |
| 122 | ∑ j, F.tensorHeatOperator U t x ![b j,b j,b i,b i] := |
| 123 | F.tensorHeatOperator_tensorTrace_four hC ht hU |
| 124 | (W := fun s y z => deriv (fun r => U r y z) s) hUt x (b i) (b i) |
| 125 | change _ = ∑ i, F.tensorHeatOperator V t x ![b i,b i] at heq |
| 126 | simp_rw [htrace, hheat] at heq |
| 127 | have hsum : (∑ i, ∑ j, ∑ k, |
| 128 | (D.covariantTensorDerivative D.ricciEvaluation x ![b k,b i,b j]) ^ 2) = |
| 129 | ∑ k, ∑ i, ∑ j, |
| 130 | (D.covariantTensorDerivative D.ricciEvaluation x ![b k,b i,b j]) ^ 2 := by |
| 131 | calc |
| 132 | _ = ∑ i, ∑ k, ∑ j, |
| 133 | (D.covariantTensorDerivative D.ricciEvaluation x ![b k,b i,b j]) ^ 2 := by |
| 134 | apply Finset.sum_congr rfl |
| 135 | intro i _ |
| 136 | exact Finset.sum_comm |
| 137 | _ = _ := Finset.sum_comm |
| 138 | simp only [Finset.sum_sub_distrib, mul_assoc, ← Finset.mul_sum, hsum] at heq |
| 139 | apply htime'.hasDerivAt.congr_deriv |
| 140 | dsimp only [D, b] at heq |
| 141 | linarith only [heq] |
| 142 | |
| 143 | /-- The normalized Ricci anisotropy obeys the scalar quotient heat equation. |
| 144 | Subtracting `1 / 3` leaves the same differential operators. -/ |
| 145 | theorem normalizedRicciNormSq_heat_equation |
| 146 | (hC : RicciFlowCurvatureTheory.{u}) (F : RicciFlow n M J) |
| 147 | {t : ℝ} (ht : t ∈ interior J) |
| 148 | (hR : ∀ y : M, 0 < (F.connection t).scalarCurvature y) (x : M) : |
| 149 | let D := F.connection t |
| 150 | let b := (F.metric t).orthonormalBasis x |
| 151 | let q := fun s y => (F.connection s).ricciNormSq y / (F.connection s).scalarCurvature y ^ 2 |
| 152 | deriv (fun s => q s x) t = D.laplacian (q t) x + |
| 153 | (2 / D.scalarCurvature x ^ 2) * |
| 154 | (F.metric t).inner x (D.gradient (q t) x) |
| 155 | (D.gradient (fun y => D.scalarCurvature y ^ 2) x) + |
| 156 | (-2 * (∑ k, ∑ i, ∑ j, |
| 157 | (D.covariantTensorDerivative D.ricciEvaluation x ![b k,b i,b j]) ^ 2) + |
| 158 | 4 * (∑ i, ∑ j, D.ricci x (b i) (b j) * |
| 159 | (∑ a, ∑ c, D.curvatureTensor x (b i) (b a) (b j) (b c) * |
| 160 | D.ricci x (b a) (b c))) - |
| 161 | 4 * q t x * D.scalarCurvature x * D.ricciNormSq x + |
| 162 | 2 * q t x * (F.metric t).inner x |
| 163 | (D.gradient D.scalarCurvature x) (D.gradient D.scalarCurvature x)) / |
| 164 | D.scalarCurvature x ^ 2 := by |
| 165 | let D := F.connection t |
| 166 | let q := fun s y => (F.connection s).ricciNormSq y / (F.connection s).scalarCurvature y ^ 2 |
| 167 | have hD := hC.tensor_calculus n M (F.metric t) D |
| 168 | have hRs := hD.contMDiff_scalarCurvature |
| 169 | have hSs := contMDiff_ricciNormSq D hD |
| 170 | have hqs : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ (q t) := |
| 171 | hSs.div₀ (hRs.pow 2) (fun y => pow_ne_zero _ (hR y).ne') |
| 172 | have hdR := (hC.scalar_evolution n M J F t (interior_subset ht) x).hasDerivAt |
| 173 | (mem_interior_iff_mem_nhds.mp ht) |
| 174 | have hdS := F.hasDerivAt_ricciNormSq hC ht x |
| 175 | dsimp only at hdS |
| 176 | have hdq := hdS.div (hdR.pow 2) (pow_ne_zero 2 (hR x).ne') |
| 177 | change HasDerivAt (fun s => q s x) _ t at hdq |
| 178 | simp only [Pi.pow_apply, Nat.cast_ofNat, Nat.reduceSub, pow_one] at hdq |
| 179 | have hprod : (fun y => q t y * D.scalarCurvature y ^ 2) = D.ricciNormSq := by |
| 180 | funext y |
| 181 | exact div_mul_cancel₀ _ (pow_ne_zero 2 (hR y).ne') |
| 182 | have hL := D.laplacian_mul hqs (hRs.pow 2) x |
| 183 | rw [hprod, D.laplacian_sq hRs] at hL |
| 184 | change deriv (fun s => q s x) t = _ |
| 185 | rw [hdq.deriv] |
| 186 | dsimp only [D] at hL ⊢ |
| 187 | rw [hL] |
| 188 | dsimp only [q] |
| 189 | field_simp [(hR x).ne'] |
| 190 | ring |
| 191 | |
| 192 | end PoincareMT.RicciFlow |