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.TwoDimensional.Compact.Regularity.Smooth |
| 2 | import PoincareLib.Geometry.Riemannian.Hessian.Commutation |
| 3 | |
| 4 | /-! |
| 5 | # Differential identities of a shrinking surface |
| 6 | |
| 7 | Commutation of the scalar Hessian gives `dR = R df`. The soliton equation |
| 8 | then makes `R + |grad f|^2 - 2 lambda f` constant. The statements retain an |
| 9 | arbitrary constant soliton scale, so they apply to asymptotic-limit slices. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 16 | open Bundle |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.LeviCivitaData |
| 21 | |
| 22 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 24 | {g : RiemannianMetric n M} |
| 25 | |
| 26 | /-- Covariant differentiation of a scalar multiple of the parallel metric. -/ |
| 27 | theorem covariantTensorDerivative_scalar_mul_metric (D : LeviCivitaData g) |
| 28 | {a : M → ℝ} (ha : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ a) |
| 29 | (x : M) (v b c : TangentSpace (𝓡 n) x) : |
| 30 | D.covariantTensorDerivative (fun y w => a y * g.inner y (w 0) (w 1)) x ![v, b, c] = |
| 31 | mvfderiv (𝓡 n) a x v * g.inner x b c := by |
| 32 | have hb := FiberBundle.contMDiffAt_extend (𝓡 n) (EuclideanSpace ℝ (Fin n)) (k := ∞) b |
| 33 | have hc := FiberBundle.contMDiffAt_extend (𝓡 n) (EuclideanSpace ℝ (Fin n)) (k := ∞) c |
| 34 | have hinner := ((g.contMDiff x).clm_bundle_apply hb).clm_bundle_apply hc |
| 35 | have hinner' : ContMDiffAt (𝓡 n) 𝓘(ℝ, ℝ) ∞ |
| 36 | (fun y => g.inner y (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) b y) |
| 37 | (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) c y)) x := by |
| 38 | simpa using (contMDiffAt_totalSpace.mp hinner).2 |
| 39 | have hprod := mvfderiv_fun_mul ((ha x).mdifferentiableAt (by simp)) |
| 40 | (hinner'.mdifferentiableAt (by simp)) |
| 41 | have hg := D.mvfderiv_metric_extend x v b c |
| 42 | simp only [covariantTensorDerivative, Fin.sum_univ_two] |
| 43 | simp |
| 44 | rw [hprod] |
| 45 | simp only [add_apply, smul_apply, |
| 46 | smul_eq_mul, FiberBundle.extend_apply_self] |
| 47 | rw [hg] |
| 48 | ring |
| 49 | |
| 50 | end PoincareMT.LeviCivitaData |
| 51 | |
| 52 | namespace PoincareMT.LeviCivitaData |
| 53 | |
| 54 | variable {M : Type u} [TopologicalSpace M] |
| 55 | [ChartedSpace (EuclideanSpace ℝ (Fin 2)) M] [IsManifold (𝓡 2) ∞ M] |
| 56 | {g : RiemannianMetric 2 M} |
| 57 | |
| 58 | /-- The pure-trace Hessian formula for any constant surface soliton scale. -/ |
| 59 | theorem hessian_eq_of_surface_soliton (D : LeviCivitaData g) |
| 60 | {f : M → ℝ} {lambda : ℝ} |
| 61 | (hsol : ∀ x, ∀ v w : TangentSpace (𝓡 2) x, |
| 62 | D.ricci x v w + D.hessian f x v w = lambda * g.inner x v w) |
| 63 | (x : M) (v w : TangentSpace (𝓡 2) x) : |
| 64 | D.hessian f x v w = (lambda - (1 / 2 : ℝ) * D.scalarCurvature x) * g.inner x v w := by |
| 65 | have h := hsol x v w |
| 66 | rw [D.ricci_eq_half_scalarCurvature_mul_inner] at h |
| 67 | linarith |
| 68 | |
| 69 | /-- Surface soliton potentials with two derivatives are smooth at any constant scale. -/ |
| 70 | theorem contMDiff_of_C2_surface_soliton (D : LeviCivitaData g) |
| 71 | {f : M → ℝ} {lambda : ℝ} (hf : ContMDiff (𝓡 2) 𝓘(ℝ, ℝ) 2 f) |
| 72 | (hsol : ∀ x, ∀ v w : TangentSpace (𝓡 2) x, |
| 73 | D.ricci x v w + D.hessian f x v w = lambda * g.inner x v w) : |
| 74 | ContMDiff (𝓡 2) 𝓘(ℝ, ℝ) ∞ f := by |
| 75 | apply D.contMDiff_of_C2_hessian_eq_smooth_mul_metric hf |
| 76 | (a := fun x => lambda - (1 / 2 : ℝ) * D.scalarCurvature x) |
| 77 | · exact contMDiff_const.sub (contMDiff_const.mul D.contMDiff_scalarCurvature) |
| 78 | · exact D.hessian_eq_of_surface_soliton hsol |
| 79 | |
| 80 | /-- The differential scalar-curvature identity of a surface gradient soliton. -/ |
| 81 | theorem mvfderiv_scalarCurvature_of_surface_soliton (D : LeviCivitaData g) |
| 82 | {f : M → ℝ} {lambda : ℝ} (hf : ContMDiff (𝓡 2) 𝓘(ℝ, ℝ) 2 f) |
| 83 | (hsol : ∀ x, ∀ v w : TangentSpace (𝓡 2) x, |
| 84 | D.ricci x v w + D.hessian f x v w = lambda * g.inner x v w) |
| 85 | (x : M) (v : TangentSpace (𝓡 2) x) : |
| 86 | mvfderiv (𝓡 2) D.scalarCurvature x v = |
| 87 | D.scalarCurvature x * mvfderiv (𝓡 2) f x v := by |
| 88 | have hfs := D.contMDiff_of_C2_surface_soliton hf hsol |
| 89 | let a := fun y => lambda - (1 / 2 : ℝ) * D.scalarCurvature y |
| 90 | have ha : ContMDiff (𝓡 2) 𝓘(ℝ, ℝ) ∞ a := |
| 91 | contMDiff_const.sub (contMDiff_const.mul D.contMDiff_scalarCurvature) |
| 92 | have heq : (fun y (w : Fin 2 → TangentSpace (𝓡 2) y) => D.hessian f y (w 0) (w 1)) = |
| 93 | (fun y w => a y * g.inner y (w 0) (w 1)) := by |
| 94 | funext y w |
| 95 | exact D.hessian_eq_of_surface_soliton hsol y (w 0) (w 1) |
| 96 | have hda (w : TangentSpace (𝓡 2) x) : |
| 97 | mvfderiv (𝓡 2) a x w = -(1 / 2 : ℝ) * mvfderiv (𝓡 2) D.scalarCurvature x w := by |
| 98 | dsimp only [a] |
| 99 | rw [mvfderiv_fun_sub (g := fun _ : M => lambda) |
| 100 | (g' := fun y => (1 / 2 : ℝ) * D.scalarCurvature y) mdifferentiableAt_const |
| 101 | ((contMDiff_const.mul D.contMDiff_scalarCurvature x).mdifferentiableAt (by simp))] |
| 102 | simp [PoincareMT.mvfderiv_const_mul, mvfderiv_const] |
| 103 | have hcomm (u w z : TangentSpace (𝓡 2) x) := |
| 104 | D.covariantTensorDerivative_hessian_commutator hfs x u w z |
| 105 | simp_rw [heq, D.covariantTensorDerivative_scalar_mul_metric ha, hda] at hcomm |
| 106 | have hcurv (u w z : TangentSpace (𝓡 2) x) : |
| 107 | mvfderiv (𝓡 2) f x (D.curvature x u w z) = |
| 108 | D.scalarCurvature x / 2 * |
| 109 | (mvfderiv (𝓡 2) f x u * g.inner x w z - |
| 110 | g.inner x u z * mvfderiv (𝓡 2) f x w) := by |
| 111 | rw [← D.inner_gradient, g.symm] |
| 112 | change D.curvatureTensor x u w (D.gradient f x) z = _ |
| 113 | rw [D.curvatureTensor_eq_half_scalarCurvature] |
| 114 | rw [g.symm x u (D.gradient f x), g.symm x w (D.gradient f x), |
| 115 | D.inner_gradient, D.inner_gradient] |
| 116 | simp_rw [hcurv] at hcomm |
| 117 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 2) : M → Type _) := |
| 118 | ⟨g.toRiemannianMetric⟩ |
| 119 | have hd : Module.finrank ℝ (TangentSpace (𝓡 2) x) = 2 := by |
| 120 | rw [VectorBundle.finrank_eq ℝ (EuclideanSpace ℝ (Fin 2)), finrank_euclideanSpace] |
| 121 | simp |
| 122 | let b : OrthonormalBasis (Fin 2) ℝ (TangentSpace (𝓡 2) x) := |
| 123 | (g.orthonormalBasis x).reindex (finCongr hd) |
| 124 | have hb (i j : Fin 2) : g.inner x (b i) (b j) = if i = j then 1 else 0 := |
| 125 | b.inner_eq_ite i j |
| 126 | have hframe (i : Fin 2) : mvfderiv (𝓡 2) D.scalarCurvature x (b i) = |
| 127 | D.scalarCurvature x * mvfderiv (𝓡 2) f x (b i) := by |
| 128 | fin_cases i |
| 129 | · have h := hcomm (b 0) (b 1) (b 1) |
| 130 | norm_num [hb] at h |
| 131 | change mvfderiv (𝓡 2) D.scalarCurvature x (b 0) = |
| 132 | D.scalarCurvature x * mvfderiv (𝓡 2) f x (b 0) |
| 133 | linear_combination 2 * h |
| 134 | · have h := hcomm (b 1) (b 0) (b 0) |
| 135 | norm_num [hb] at h |
| 136 | change mvfderiv (𝓡 2) D.scalarCurvature x (b 1) = |
| 137 | D.scalarCurvature x * mvfderiv (𝓡 2) f x (b 1) |
| 138 | linear_combination 2 * h |
| 139 | have hlinear : (mvfderiv (𝓡 2) D.scalarCurvature x).toLinearMap = |
| 140 | (D.scalarCurvature x • mvfderiv (𝓡 2) f x).toLinearMap := by |
| 141 | apply b.toBasis.ext |
| 142 | exact hframe |
| 143 | exact congrArg (fun L => L v) hlinear |
| 144 | |
| 145 | /-- Hamilton's scalar quantity has zero differential at any constant soliton scale. -/ |
| 146 | theorem mvfderiv_hamilton_of_surface_soliton (D : LeviCivitaData g) |
| 147 | {f : M → ℝ} {lambda : ℝ} (hf : ContMDiff (𝓡 2) 𝓘(ℝ, ℝ) 2 f) |
| 148 | (hsol : ∀ x, ∀ v w : TangentSpace (𝓡 2) x, |
| 149 | D.ricci x v w + D.hessian f x v w = lambda * g.inner x v w) |
| 150 | (x : M) (v : TangentSpace (𝓡 2) x) : |
| 151 | mvfderiv (𝓡 2) (fun y => D.scalarCurvature y + |
| 152 | g.inner y (D.gradient f y) (D.gradient f y) - 2 * lambda * f y) x v = 0 := by |
| 153 | have hfs := D.contMDiff_of_C2_surface_soliton hf hsol |
| 154 | have hgrad := D.contMDiffAt_gradient (hfs x) |
| 155 | have hnorm : ContMDiffAt (𝓡 2) 𝓘(ℝ, ℝ) ∞ |
| 156 | (fun y => g.inner y (D.gradient f y) (D.gradient f y)) x := by |
| 157 | simpa using (contMDiffAt_totalSpace.mp |
| 158 | (((g.contMDiff x).clm_bundle_apply hgrad).clm_bundle_apply hgrad)).2 |
| 159 | rw [mvfderiv_fun_sub |
| 160 | (g := fun y => D.scalarCurvature y + g.inner y (D.gradient f y) (D.gradient f y)) |
| 161 | (g' := fun y => 2 * lambda * f y) |
| 162 | (((D.contMDiff_scalarCurvature x).add hnorm).mdifferentiableAt (by simp)) |
| 163 | (((contMDiffAt_const (c := 2 * lambda)).mul (hfs x)).mdifferentiableAt (by simp)), |
| 164 | mvfderiv_fun_add ((D.contMDiff_scalarCurvature x).mdifferentiableAt (by simp)) |
| 165 | (hnorm.mdifferentiableAt (by simp))] |
| 166 | simp only [sub_apply, add_apply, PoincareMT.mvfderiv_const_mul] |
| 167 | rw [D.mvfderiv_scalarCurvature_of_surface_soliton hf hsol, |
| 168 | D.mvfderiv_gradient_normSq_of_C2 (hf x), D.hessian_eq_of_surface_soliton hsol, |
| 169 | g.symm x v, D.inner_gradient] |
| 170 | ring |
| 171 | |
| 172 | /-- The exponential weight cancels the scalar-curvature differential. -/ |
| 173 | theorem mvfderiv_weighted_scalar_of_surface_soliton (D : LeviCivitaData g) |
| 174 | {f : M → ℝ} {lambda : ℝ} (hf : ContMDiff (𝓡 2) 𝓘(ℝ, ℝ) 2 f) |
| 175 | (hsol : ∀ x, ∀ v w : TangentSpace (𝓡 2) x, |
| 176 | D.ricci x v w + D.hessian f x v w = lambda * g.inner x v w) |
| 177 | (x : M) (v : TangentSpace (𝓡 2) x) : |
| 178 | mvfderiv (𝓡 2) (fun y => D.scalarCurvature y * Real.exp (-f y)) x v = 0 := by |
| 179 | have hfs := D.contMDiff_of_C2_surface_soliton hf hsol |
| 180 | have hexp : ContMDiff (𝓡 2) 𝓘(ℝ, ℝ) ∞ (fun y => Real.exp (-f y)) := |
| 181 | Real.contDiff_exp.contMDiff.comp hfs.neg |
| 182 | have hdexp : mvfderiv (𝓡 2) (fun y => Real.exp (-f y)) x v = |
| 183 | -Real.exp (-f x) * mvfderiv (𝓡 2) f x v := by |
| 184 | change mvfderiv (𝓡 2) (Real.exp ∘ fun y => -f y) x v = _ |
| 185 | rw [mvfderiv_comp x Real.differentiableAt_exp.mdifferentiableAt |
| 186 | ((hfs.neg x).mdifferentiableAt (by simp))] |
| 187 | simp only [ContinuousLinearMap.comp_apply, mvfderiv, mfderiv_eq_fderiv] |
| 188 | rw [(Real.hasDerivAt_exp (-f x)).hasFDerivAt.fderiv] |
| 189 | change mvfderiv (𝓡 2) (-f) x v * Real.exp (-f x) = |
| 190 | -Real.exp (-f x) * mvfderiv (𝓡 2) f x v |
| 191 | rw [mvfderiv_neg (g := f)] |
| 192 | simp only [neg_apply] |
| 193 | ring |
| 194 | rw [mvfderiv_fun_mul ((D.contMDiff_scalarCurvature x).mdifferentiableAt (by simp)) |
| 195 | ((hexp x).mdifferentiableAt (by simp))] |
| 196 | simp only [add_apply, smul_apply, smul_eq_mul] |
| 197 | rw [hdexp, D.mvfderiv_scalarCurvature_of_surface_soliton hf hsol] |
| 198 | ring |
| 199 | |
| 200 | end PoincareMT.LeviCivitaData |