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.TimeDerivative |
| 2 | import PoincareLib.Geometry.RicciFlow.Tensor.TimeRegularity |
| 3 | import PoincareLib.Geometry.RicciFlow.Tensor.RicciAction |
| 4 | import PoincareLib.Geometry.Riemannian.Tensor.Commutation.Laplacian |
| 5 | |
| 6 | set_option autoImplicit false |
| 7 | set_option backward.isDefEq.respectTransparency false |
| 8 | |
| 9 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 10 | |
| 11 | universe u |
| 12 | |
| 13 | namespace PoincareMT.RicciFlow |
| 14 | |
| 15 | open PoincareMT |
| 16 | open PoincareMT.LeviCivitaData |
| 17 | |
| 18 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 19 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 20 | {J : Set ℝ} {g : RiemannianMetric n M} |
| 21 | |
| 22 | noncomputable def tensorHeatOperator (F : RicciFlow n M J) |
| 23 | {k : ℕ} (T : ℝ → CovariantTensorEvaluation n M k) (t : ℝ) |
| 24 | (x : M) (v : Fin k → TangentSpace (𝓡 n) x) : ℝ := |
| 25 | deriv (fun s => T s x v) t + |
| 26 | (F.connection t).ricciTensorAction (T t) x v - |
| 27 | (F.connection t).tensorLaplacian (T t) x v |
| 28 | |
| 29 | private lemma connection_deriv_inner |
| 30 | (hC : RicciFlowCurvatureTheory.{u}) (F : RicciFlow n M J) |
| 31 | {t : ℝ} (ht : t ∈ interior J) (x : M) |
| 32 | (u z e : TangentSpace (𝓡 n) x) : |
| 33 | let D := F.connection t |
| 34 | let A := fun q : TangentSpace (𝓡 n) x => deriv (fun s => |
| 35 | (F.connection s).connection |
| 36 | (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) q) x) t |
| 37 | (F.metric t).inner x (A z u) e = |
| 38 | -D.covariantTensorDerivative D.ricciEvaluation x ![u, z, e] - |
| 39 | D.covariantTensorDerivative D.ricciEvaluation x ![z, u, e] + |
| 40 | D.covariantTensorDerivative D.ricciEvaluation x ![e, u, z] := by |
| 41 | dsimp only |
| 42 | exact F.inner_deriv_connection_extend ht (hC.tensor_calculus n M (F.metric t) (F.connection t)) |
| 43 | x u z e |
| 44 | |
| 45 | private lemma tensor_slot_left_eq_sum |
| 46 | (g : RiemannianMetric n M) |
| 47 | {T : CovariantTensorEvaluation n M 2} (hT : IsSmoothCovariantTensor T) |
| 48 | (x : M) (q w : TangentSpace (𝓡 n) x) : |
| 49 | T x ![q, w] = ∑ i, g.inner x q (g.orthonormalBasis x i) * |
| 50 | T x ![g.orthonormalBasis x i, w] := by |
| 51 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 52 | ⟨g.toRiemannianMetric⟩ |
| 53 | obtain ⟨B, hB⟩ := hT.1 x |
| 54 | let L := B.toLinearMap ![(0 : TangentSpace (𝓡 n) x), w] 0 |
| 55 | have hL (z : TangentSpace (𝓡 n) x) : L z = T x ![z, w] := by |
| 56 | simp only [L, MultilinearMap.toLinearMap_apply] |
| 57 | rw [hB] |
| 58 | congr 1 |
| 59 | funext i |
| 60 | fin_cases i <;> rfl |
| 61 | have h := congrArg L ((g.orthonormalBasis x).sum_repr' q) |
| 62 | simp only [map_sum, map_smul, smul_eq_mul] at h |
| 63 | simp only [hL] at h |
| 64 | rw [← h] |
| 65 | apply Finset.sum_congr rfl |
| 66 | intro i _ |
| 67 | rw [real_inner_comm] |
| 68 | rfl |
| 69 | |
| 70 | private lemma tensor_slot_right_eq_sum |
| 71 | (g : RiemannianMetric n M) |
| 72 | {T : CovariantTensorEvaluation n M 2} (hT : IsSmoothCovariantTensor T) |
| 73 | (x : M) (v q : TangentSpace (𝓡 n) x) : |
| 74 | T x ![v, q] = ∑ i, g.inner x q (g.orthonormalBasis x i) * |
| 75 | T x ![v, g.orthonormalBasis x i] := by |
| 76 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 77 | ⟨g.toRiemannianMetric⟩ |
| 78 | obtain ⟨B, hB⟩ := hT.1 x |
| 79 | let L := B.toLinearMap ![v, (0 : TangentSpace (𝓡 n) x)] 1 |
| 80 | have hL (z : TangentSpace (𝓡 n) x) : L z = T x ![v, z] := by |
| 81 | simp only [L, MultilinearMap.toLinearMap_apply] |
| 82 | rw [hB] |
| 83 | congr 1 |
| 84 | funext i |
| 85 | fin_cases i <;> rfl |
| 86 | have h := congrArg L ((g.orthonormalBasis x).sum_repr' q) |
| 87 | simp only [map_sum, map_smul, smul_eq_mul] at h |
| 88 | simp only [hL] at h |
| 89 | rw [← h] |
| 90 | apply Finset.sum_congr rfl |
| 91 | intro i _ |
| 92 | rw [real_inner_comm] |
| 93 | rfl |
| 94 | |
| 95 | lemma tensorHeatOperator_covariantTensorDerivative_commutator_two |
| 96 | (hC : RicciFlowCurvatureTheory.{u}) (F : RicciFlow n M J) |
| 97 | {T : ℝ → CovariantTensorEvaluation n M 2} {t : ℝ} (ht : t ∈ interior J) |
| 98 | (hT : ∀ s, IsSmoothCovariantTensor (T s)) |
| 99 | (hreg : ∀ (y : M) (X Y : (z : M) → TangentSpace (𝓡 n) z), |
| 100 | ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% X) y → |
| 101 | ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Y) y → |
| 102 | ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 103 | (fun p : ℝ × M => T p.1 p.2 ![X p.2, Y p.2]) (t, y)) |
| 104 | (x : M) (u v w : TangentSpace (𝓡 n) x) : |
| 105 | tensorHeatOperator F (fun s => (F.connection s).covariantTensorDerivative (T s)) t x ![u, v, w] - |
| 106 | (F.connection t).covariantTensorDerivative (tensorHeatOperator F T t) x ![u, v, w] = |
| 107 | 2 * ∑ i, ∑ j, (F.connection t).curvatureTensor x u |
| 108 | ((F.metric t).orthonormalBasis x i) v ((F.metric t).orthonormalBasis x j) * |
| 109 | (F.connection t).covariantTensorDerivative (T t) x |
| 110 | ![(F.metric t).orthonormalBasis x i, (F.metric t).orthonormalBasis x j, w] + |
| 111 | 2 * ∑ i, ∑ j, (F.connection t).curvatureTensor x u |
| 112 | ((F.metric t).orthonormalBasis x i) w ((F.metric t).orthonormalBasis x j) * |
| 113 | (F.connection t).covariantTensorDerivative (T t) x |
| 114 | ![(F.metric t).orthonormalBasis x i, v, (F.metric t).orthonormalBasis x j] := by |
| 115 | have hW (y : M) (z : Fin 2 → TangentSpace (𝓡 n) y) : |
| 116 | HasDerivAt (fun s => T s y z) (deriv (fun s => T s y z) t) t := by |
| 117 | let X := FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (z 0) |
| 118 | let Y := FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (z 1) |
| 119 | have hX := FiberBundle.contMDiffAt_extend (𝓡 n) (EuclideanSpace ℝ (Fin n)) (k := ∞) (z 0) |
| 120 | have hY := FiberBundle.contMDiffAt_extend (𝓡 n) (EuclideanSpace ℝ (Fin n)) (k := ∞) (z 1) |
| 121 | have hp : ContMDiffAt 𝓘(ℝ, ℝ) (𝓘(ℝ, ℝ).prod (𝓡 n)) ∞ |
| 122 | (fun s : ℝ => (s, y)) t := contMDiffAt_id.prodMk contMDiffAt_const |
| 123 | have hs := ((hreg y X Y hX hY).comp t hp).contDiffAt |
| 124 | have hz : ![z 0, z 1] = z := by ext i; fin_cases i <;> rfl |
| 125 | have hc : ContDiffAt ℝ ∞ (fun s => T s y z) t := by |
| 126 | convert hs using 1 <;> ext s <;> simp [X, Y, hz, |
| 127 | FiberBundle.extend_apply_self] |
| 128 | exact (hc.differentiableAt (by simp)).hasDerivAt |
| 129 | let D := F.connection t |
| 130 | let g := F.metric t |
| 131 | let W : ℝ → CovariantTensorEvaluation n M 2 := fun s y z => |
| 132 | deriv (fun r => T r y z) s |
| 133 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 134 | ⟨g.toRiemannianMetric⟩ |
| 135 | have hCals := hC.tensor_calculus n M g D |
| 136 | have hWs : IsSmoothCovariantTensor (W t) := |
| 137 | isSmoothCovariantTensor_timeDerivative hT hreg hW |
| 138 | have hLaps : IsSmoothCovariantTensor (D.tensorLaplacian (T t)) := |
| 139 | (hCals.2.2.1 _ _ (hCals.2.2.1 _ _ (hT t))).tensorTrace |
| 140 | have htime := hasDerivAt_covariantTensorDerivative_time F (W := W) ht x hT hreg hW u v w |
| 141 | have htime' := htime.deriv |
| 142 | have hricci := D.covariantTensorDerivative_ricciTensorAction_two hCals (hT t) x u v w |
| 143 | have hlap := D.covariantTensorDerivative_tensorLaplacian_commutator_two hCals (hT t) x u v w |
| 144 | have hheatder : D.covariantTensorDerivative (tensorHeatOperator F T t) x ![u, v, w] = |
| 145 | D.covariantTensorDerivative (W t) x ![u, v, w] + |
| 146 | D.covariantTensorDerivative (D.ricciTensorAction (T t)) x ![u, v, w] - |
| 147 | D.covariantTensorDerivative (D.tensorLaplacian (T t)) x ![u, v, w] := by |
| 148 | change D.covariantTensorDerivative (fun y z => W t y z + |
| 149 | D.ricciTensorAction (T t) y z - D.tensorLaplacian (T t) y z) x ![u, v, w] = _ |
| 150 | rw [D.covariantTensorDerivative_sub |
| 151 | (hWs.add (D.isSmoothCovariantTensor_ricciTensorAction_two hCals (hT t))) hLaps] |
| 152 | rw [D.covariantTensorDerivative_add hWs |
| 153 | (D.isSmoothCovariantTensor_ricciTensorAction_two hCals (hT t))] |
| 154 | let A := fun q : TangentSpace (𝓡 n) x => deriv (fun s => |
| 155 | (F.connection s).connection (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) q) x) t |
| 156 | have hl := tensor_slot_left_eq_sum g (hT t) x (A v u) w |
| 157 | have hr := tensor_slot_right_eq_sum g (hT t) x v (A w u) |
| 158 | have ha (q e : TangentSpace (𝓡 n) x) := connection_deriv_inner hC F ht x u q e |
| 159 | dsimp only at ha |
| 160 | dsimp only [g, A] at hl hr |
| 161 | simp_rw [ha] at hl hr |
| 162 | have hact : D.ricciTensorAction (D.covariantTensorDerivative (T t)) x ![u, v, w] = |
| 163 | ∑ i, (D.ricci x u (g.orthonormalBasis x i) * |
| 164 | D.covariantTensorDerivative (T t) x ![g.orthonormalBasis x i, v, w] + |
| 165 | D.ricci x v (g.orthonormalBasis x i) * |
| 166 | D.covariantTensorDerivative (T t) x ![u, g.orthonormalBasis x i, w] + |
| 167 | D.ricci x w (g.orthonormalBasis x i) * |
| 168 | D.covariantTensorDerivative (T t) x ![u, v, g.orthonormalBasis x i]) := by |
| 169 | have h0 (e : TangentSpace (𝓡 n) x) : Function.update ![u, v, w] 0 e = ![e, v, w] := by |
| 170 | ext j; fin_cases j <;> simp |
| 171 | have h1 (e : TangentSpace (𝓡 n) x) : Function.update ![u, v, w] 1 e = ![u, e, w] := by |
| 172 | ext j; fin_cases j <;> simp |
| 173 | have h2 (e : TangentSpace (𝓡 n) x) : Function.update ![u, v, w] 2 e = ![u, v, e] := by |
| 174 | ext j; fin_cases j <;> simp |
| 175 | unfold ricciTensorAction |
| 176 | change (∑ j : Fin 3, ∑ i, D.ricci x (![u, v, w] j) (g.orthonormalBasis x i) * |
| 177 | D.covariantTensorDerivative (T t) x |
| 178 | (Function.update ![u, v, w] j (g.orthonormalBasis x i))) = _ |
| 179 | rw [Fin.sum_univ_three] |
| 180 | simp only [Matrix.cons_val_zero, |
| 181 | Matrix.cons_val_one, Matrix.cons_val_two, h0, h1, h2, Finset.sum_add_distrib, g] |
| 182 | rfl |
| 183 | change deriv (fun s => (F.connection s).covariantTensorDerivative (T s) x ![u, v, w]) t + |
| 184 | D.ricciTensorAction (D.covariantTensorDerivative (T t)) x ![u, v, w] - |
| 185 | D.tensorLaplacian (D.covariantTensorDerivative (T t)) x ![u, v, w] - |
| 186 | D.covariantTensorDerivative (tensorHeatOperator F T t) x ![u, v, w] = _ |
| 187 | rw [htime', hheatder, hricci, hact, hl, hr] |
| 188 | dsimp only at hlap |
| 189 | simp only [sub_mul, neg_mul, add_mul, Finset.sum_add_distrib, |
| 190 | Finset.sum_sub_distrib, Finset.sum_neg_distrib] at hlap ⊢ |
| 191 | dsimp only [D, g] at hlap ⊢ |
| 192 | linear_combination hlap |
| 193 | |
| 194 | end PoincareMT.RicciFlow |