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.HeatGradient |
| 3 | import PoincareLib.Geometry.RicciFlow.Tensor.TimeDerivative.Trace |
| 4 | import PoincareLib.Geometry.Riemannian.Tensor.LaplacianTrace.Four |
| 5 | |
| 6 | /-! |
| 7 | # Heat evolution and partial metric traces |
| 8 | |
| 9 | The inverse-metric time derivative cancels the Ricci action on the two |
| 10 | contracted slots. Metric compatibility handles the rough Laplacian. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT |
| 21 | |
| 22 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 24 | {g : RiemannianMetric n M} {J : Set ℝ} |
| 25 | |
| 26 | lemma LeviCivitaData.tensorTrace_ricciTensorAction_four |
| 27 | (D : LeviCivitaData g) (hD : D.CurvatureTensorCalculus) |
| 28 | (T : CovariantTensorEvaluation n M 4) (x : M) |
| 29 | (u v : TangentSpace (𝓡 n) x) : |
| 30 | let b := g.orthonormalBasis x |
| 31 | g.tensorTrace (D.ricciTensorAction T) x ![u, v] = |
| 32 | D.ricciTensorAction (g.tensorTrace T) x ![u, v] + |
| 33 | 2 * ∑ i, ∑ j, D.ricci x (b i) (b j) * T x ![b i, b j, u, v] := by |
| 34 | let b := g.orthonormalBasis x |
| 35 | have hexpand (a c d e : TangentSpace (𝓡 n) x) : |
| 36 | D.ricciTensorAction T x ![a, c, d, e] = |
| 37 | (∑ j, D.ricci x a (b j) * T x ![b j, c, d, e]) + |
| 38 | (∑ j, D.ricci x c (b j) * T x ![a, b j, d, e]) + |
| 39 | (∑ j, D.ricci x d (b j) * T x ![a, c, b j, e]) + |
| 40 | (∑ j, D.ricci x e (b j) * T x ![a, c, d, b j]) := by |
| 41 | have hu (w : TangentSpace (𝓡 n) x) : |
| 42 | Function.update ![a, c, d, e] 0 w = ![w, c, d, e] ∧ |
| 43 | Function.update ![a, c, d, e] 1 w = ![a, w, d, e] ∧ |
| 44 | Function.update ![a, c, d, e] 2 w = ![a, c, w, e] ∧ |
| 45 | Function.update ![a, c, d, e] 3 w = ![a, c, d, w] := by |
| 46 | constructor |
| 47 | · ext i; fin_cases i <;> simp |
| 48 | constructor |
| 49 | · ext i; fin_cases i <;> simp |
| 50 | constructor <;> (ext i; fin_cases i <;> simp) |
| 51 | unfold LeviCivitaData.ricciTensorAction |
| 52 | rw [Fin.sum_univ_four] |
| 53 | simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, |
| 54 | Matrix.cons_val_three, hu] |
| 55 | rfl |
| 56 | have hflip : (∑ i, ∑ j, D.ricci x (b i) (b j) * T x ![b j, b i, u, v]) = |
| 57 | ∑ i, ∑ j, D.ricci x (b i) (b j) * T x ![b i, b j, u, v] := by |
| 58 | rw [Finset.sum_comm] |
| 59 | apply Finset.sum_congr rfl |
| 60 | intro i _ |
| 61 | apply Finset.sum_congr rfl |
| 62 | intro j _ |
| 63 | rw [(hD.2.2.2.1 x (b j) (b i) u v).2.2.2] |
| 64 | dsimp only |
| 65 | change (∑ i, D.ricciTensorAction T x ![b i, b i, u, v]) = _ |
| 66 | simp only [hexpand, Finset.sum_add_distrib] |
| 67 | rw [D.ricciTensorAction_two] |
| 68 | simp only [RiemannianMetric.tensorTrace, Matrix.Fin.cons_vecCons, |
| 69 | Finset.mul_sum, Finset.sum_add_distrib] |
| 70 | dsimp only [b] at hflip ⊢ |
| 71 | rw [hflip] |
| 72 | have hleft : (∑ i, ∑ j, D.ricci x u (b j) * T x ![b i, b i, b j, v]) = |
| 73 | ∑ j, ∑ i, D.ricci x u (b j) * T x ![b i, b i, b j, v] := Finset.sum_comm |
| 74 | have hright : (∑ i, ∑ j, D.ricci x v (b j) * T x ![b i, b i, u, b j]) = |
| 75 | ∑ j, ∑ i, D.ricci x v (b j) * T x ![b i, b i, u, b j] := Finset.sum_comm |
| 76 | dsimp only [b] at hleft hright |
| 77 | rw [hleft, hright] |
| 78 | simp only [← Finset.mul_sum] |
| 79 | ring |
| 80 | |
| 81 | lemma RicciFlow.tensorHeatOperator_tensorTrace_four |
| 82 | (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 83 | {T W : ℝ → CovariantTensorEvaluation n M 4} {t : ℝ} (ht : t ∈ interior J) |
| 84 | (hT : ∀ s, IsSmoothCovariantTensor (T s)) |
| 85 | (hW : ∀ (y : M) (z : Fin 4 → TangentSpace (𝓡 n) y), |
| 86 | HasDerivAt (fun s => T s y z) (W t y z) t) |
| 87 | (x : M) (u v : TangentSpace (𝓡 n) x) : |
| 88 | F.tensorHeatOperator (fun s => (F.metric s).tensorTrace (T s)) t x ![u, v] = |
| 89 | (F.metric t).tensorTrace (F.tensorHeatOperator T t) x ![u, v] := by |
| 90 | let D := F.connection t |
| 91 | let b := (F.metric t).orthonormalBasis x |
| 92 | have hD := hC.tensor_calculus n M (F.metric t) D |
| 93 | have htime := (F.hasDerivAt_tensorTrace ht x hT (hW x) ![u, v]).deriv |
| 94 | have hlap := D.tensorLaplacian_tensorTrace_four (hT t) (hD.2.2.1 _ _ (hT t)) x u v |
| 95 | have hact := D.tensorTrace_ricciTensorAction_four hD (T t) x u v |
| 96 | have htrace : (F.metric t).tensorTrace (F.tensorHeatOperator T t) x ![u, v] = |
| 97 | (F.metric t).tensorTrace (W t) x ![u, v] + |
| 98 | (F.metric t).tensorTrace (D.ricciTensorAction (T t)) x ![u, v] - |
| 99 | (F.metric t).tensorTrace (D.tensorLaplacian (T t)) x ![u, v] := by |
| 100 | simp only [RiemannianMetric.tensorTrace, RicciFlow.tensorHeatOperator, (hW _ _).deriv, |
| 101 | Finset.sum_add_distrib, Finset.sum_sub_distrib] |
| 102 | rfl |
| 103 | dsimp only at htime hact |
| 104 | simp only [Matrix.Fin.cons_vecCons] at htime |
| 105 | unfold RicciFlow.tensorHeatOperator |
| 106 | rw [htime] |
| 107 | change _ + D.ricciTensorAction ((F.metric t).tensorTrace (T t)) x ![u, v] - |
| 108 | D.tensorLaplacian ((F.metric t).tensorTrace (T t)) x ![u, v] = _ |
| 109 | rw [hlap] |
| 110 | change _ = (F.metric t).tensorTrace (F.tensorHeatOperator T t) x ![u, v] |
| 111 | rw [htrace] |
| 112 | linarith only [hact] |
| 113 | |
| 114 | end PoincareMT |