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.Surgery.CanonicalInduction.Positive.PositiveGradientReaction |
| 2 | import PoincareLib.Geometry.RicciFlow.Curvature.Evolution.Scalar.Coefficients |
| 3 | |
| 4 | /-! |
| 5 | # Hamilton's positive scalar-gradient barrier |
| 6 | |
| 7 | The actual scalar `G/R + 240(S-R^2/3) - beta R^2` combines the quotient |
| 8 | estimate, contracted Bianchi, and Hamilton's quartic. Its parabolic upper |
| 9 | bound depends only on scalar curvature and the weighted Ricci defect. |
| 10 | This is the gradient argument in Hamilton (1982), Section 11, used in |
| 11 | Morgan--Tian, Theorem 4.23, pp. 74-75. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | -- Pointwise metric and tensor component expressions agree definitionally. |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set |
| 19 | open scoped Manifold ContDiff Bundle BigOperators Topology |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.M47Positive |
| 24 | |
| 25 | section GeneralDimension |
| 26 | |
| 27 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 29 | {g : RiemannianMetric n M} |
| 30 | |
| 31 | /-- The actual scalar-gradient barrier is smooth on every positive |
| 32 | scalar slice, for the maximum argument in Morgan--Tian, Theorem 4.23, |
| 33 | pp. 74-75. -/ |
| 34 | theorem contMDiff_scalar_gradient_barrier (D : LeviCivitaData g) |
| 35 | (hD : D.CurvatureTensorCalculus) (hR : ∀ x, 0 < D.scalarCurvature x) (beta : ℝ) : |
| 36 | ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun x => |
| 37 | g.inner x (D.gradient D.scalarCurvature x) (D.gradient D.scalarCurvature x) / |
| 38 | D.scalarCurvature x + 240 * (D.ricciNormSq x - D.scalarCurvature x ^ 2 / 3) - |
| 39 | beta * D.scalarCurvature x ^ 2) := by |
| 40 | have hRs := hD.contMDiff_scalarCurvature |
| 41 | have hSs := RicciFlow.contMDiff_ricciNormSq D hD |
| 42 | have hGs := contMDiff_gradient_energy D hRs |
| 43 | have hc (c : ℝ) : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun _ : M => c) := contMDiff_const |
| 44 | have hdefect := hSs.sub ((hc (1 / 3)).smul (hRs.pow 2)) |
| 45 | have h := ((hGs.div₀ hRs (fun y => (hR y).ne')).add |
| 46 | ((hc 240).smul hdefect)).sub ((hc beta).smul (hRs.pow 2)) |
| 47 | convert h using 1 |
| 48 | funext y |
| 49 | change _ = g.inner y (D.gradient D.scalarCurvature y) (D.gradient D.scalarCurvature y) / |
| 50 | D.scalarCurvature y + 240 * (D.ricciNormSq y - (1 / 3) * D.scalarCurvature y ^ 2) - |
| 51 | beta * D.scalarCurvature y ^ 2 |
| 52 | ring |
| 53 | |
| 54 | /-- Joint continuity of the actual barrier uses only the original flow |
| 55 | strip, as required by the compact comparison in Morgan--Tian, |
| 56 | Theorem 4.23, pp. 74-75. -/ |
| 57 | theorem continuousOn_scalar_gradient_barrier |
| 58 | (hC : RicciFlowCurvatureTheory.{u}) {J : Set ℝ} (F : RicciFlow n M J) |
| 59 | (hR : ∀ t ∈ J, ∀ x, 0 < (F.connection t).scalarCurvature x) (beta : ℝ) : |
| 60 | ContinuousOn (fun p : ℝ × M => (F.metric p.1).inner p.2 |
| 61 | ((F.connection p.1).gradient (F.connection p.1).scalarCurvature p.2) |
| 62 | ((F.connection p.1).gradient (F.connection p.1).scalarCurvature p.2) / |
| 63 | (F.connection p.1).scalarCurvature p.2 + |
| 64 | 240 * ((F.connection p.1).ricciNormSq p.2 - |
| 65 | (F.connection p.1).scalarCurvature p.2 ^ 2 / 3) - |
| 66 | beta * (F.connection p.1).scalarCurvature p.2 ^ 2) (J ×ˢ univ) := by |
| 67 | have hRjoint := (hC.scalar_regular n M J F).continuousOn |
| 68 | have hSjoint := RicciFlowAnalysis.continuousOn_flow_ricciNormSq F |
| 69 | have hGjoint := continuousOn_scalar_gradient_energy hC F |
| 70 | exact ((hGjoint.div hRjoint (fun p hp => (hR p.1 hp.1 p.2).ne')).add |
| 71 | (continuousOn_const.mul (hSjoint.sub ((hRjoint.pow 2).div_const 3)))).sub |
| 72 | (continuousOn_const.mul (hRjoint.pow 2)) |
| 73 | |
| 74 | /-- The barrier has an ordinary time derivative at every interior |
| 75 | original time with positive scalar curvature. This is the time |
| 76 | regularity for Morgan--Tian, Theorem 4.23, pp. 74-75. -/ |
| 77 | theorem differentiableAt_scalar_gradient_barrier |
| 78 | (hC : RicciFlowCurvatureTheory.{u}) {J : Set ℝ} (F : RicciFlow n M J) |
| 79 | {t : ℝ} (ht : t ∈ interior J) (x : M) |
| 80 | (hR : 0 < (F.connection t).scalarCurvature x) (beta : ℝ) : |
| 81 | DifferentiableAt ℝ (fun s => (F.metric s).inner x |
| 82 | ((F.connection s).gradient (F.connection s).scalarCurvature x) |
| 83 | ((F.connection s).gradient (F.connection s).scalarCurvature x) / |
| 84 | (F.connection s).scalarCurvature x + |
| 85 | 240 * ((F.connection s).ricciNormSq x - (F.connection s).scalarCurvature x ^ 2 / 3) - |
| 86 | beta * (F.connection s).scalarCurvature x ^ 2) t := by |
| 87 | have hdR := (hC.scalar_evolution n M J F t (interior_subset ht) x).hasDerivAt |
| 88 | (mem_interior_iff_mem_nhds.mp ht) |
| 89 | have hdS := F.hasDerivAt_ricciNormSq hC ht x |
| 90 | have hdG := hasDerivAt_scalar_gradient_energy hC F ht x |
| 91 | exact (((hdG.div hdR hR.ne').add |
| 92 | ((hdS.sub ((hdR.pow 2).div_const 3)).const_mul 240)).sub |
| 93 | ((hdR.pow 2).const_mul beta)).differentiableAt |
| 94 | |
| 95 | end GeneralDimension |
| 96 | |
| 97 | variable {M : Type u} [TopologicalSpace M] |
| 98 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 99 | [T2Space M] |
| 100 | |
| 101 | /-- The actual Hamilton barrier has the scalar-defect reaction upper |
| 102 | bound after applying contracted Bianchi and the positive Ricci spectrum. |
| 103 | This is the parabolic estimate in Hamilton (1982), Section 11, and |
| 104 | Morgan--Tian, Theorem 4.23, pp. 74-75. -/ |
| 105 | theorem scalar_gradient_barrier_evolution_le |
| 106 | (hC : RicciFlowCurvatureTheory.{u}) {J : Set ℝ} (F : RicciFlow 3 M J) |
| 107 | {t : ℝ} (ht : t ∈ interior J) |
| 108 | (hR : ∀ y, 0 < (F.connection t).scalarCurvature y) (x : M) |
| 109 | (hRic : ∀ v : TangentSpace (𝓡 3) x, (F.metric t).inner x v v = 1 → |
| 110 | 0 ≤ (F.connection t).ricci x v v) |
| 111 | {beta : ℝ} (hbeta : 0 ≤ beta) (hbeta1 : beta ≤ 1) : |
| 112 | let H := fun s y => (F.metric s).inner y |
| 113 | ((F.connection s).gradient (F.connection s).scalarCurvature y) |
| 114 | ((F.connection s).gradient (F.connection s).scalarCurvature y) / |
| 115 | (F.connection s).scalarCurvature y + |
| 116 | 240 * ((F.connection s).ricciNormSq y - (F.connection s).scalarCurvature y ^ 2 / 3) - |
| 117 | beta * (F.connection s).scalarCurvature y ^ 2 |
| 118 | deriv (fun s => H s x) t ≤ (F.connection t).laplacian (H t) x + |
| 119 | 960 * (F.connection t).scalarCurvature x * |
| 120 | ((F.connection t).ricciNormSq x - (F.connection t).scalarCurvature x ^ 2 / 3) - |
| 121 | (4 * beta / 3) * (F.connection t).scalarCurvature x ^ 3 := by |
| 122 | dsimp only |
| 123 | let D := F.connection t |
| 124 | let R := D.scalarCurvature |
| 125 | let S := D.ricciNormSq |
| 126 | let G := fun y => (F.metric t).inner y (D.gradient R y) (D.gradient R y) |
| 127 | let q := fun s y => (F.metric s).inner y |
| 128 | ((F.connection s).gradient (F.connection s).scalarCurvature y) |
| 129 | ((F.connection s).gradient (F.connection s).scalarCurvature y) / |
| 130 | (F.connection s).scalarCurvature y |
| 131 | let H := fun s y => q s y + |
| 132 | 240 * ((F.connection s).ricciNormSq y - (F.connection s).scalarCurvature y ^ 2 / 3) - |
| 133 | beta * (F.connection s).scalarCurvature y ^ 2 |
| 134 | let A := ∑ k, ∑ i, ∑ j, (D.covariantTensorDerivative D.ricciEvaluation x |
| 135 | ![(F.metric t).orthonormalBasis x k, (F.metric t).orthonormalBasis x i, |
| 136 | (F.metric t).orthonormalBasis x j]) ^ 2 |
| 137 | let C := ∑ i, ∑ j, D.ricci x ((F.metric t).orthonormalBasis x i) |
| 138 | ((F.metric t).orthonormalBasis x j) * |
| 139 | (∑ a, ∑ c, D.curvatureTensor x ((F.metric t).orthonormalBasis x i) |
| 140 | ((F.metric t).orthonormalBasis x a) ((F.metric t).orthonormalBasis x j) |
| 141 | ((F.metric t).orthonormalBasis x c) * |
| 142 | D.ricci x ((F.metric t).orthonormalBasis x a) ((F.metric t).orthonormalBasis x c)) |
| 143 | let V := (F.metric t).inner x (D.gradient R x) (D.gradient S x) |
| 144 | have hD := hC.tensor_calculus 3 M (F.metric t) D |
| 145 | have hRs := hD.contMDiff_scalarCurvature |
| 146 | have hSs := RicciFlow.contMDiff_ricciNormSq D hD |
| 147 | have hGs := contMDiff_gradient_energy D hRs |
| 148 | have hqs : ContMDiff (𝓡 3) 𝓘(ℝ, ℝ) ∞ (q t) := |
| 149 | hGs.div₀ hRs (fun y => (hR y).ne') |
| 150 | have hc (c : ℝ) : ContMDiff (𝓡 3) 𝓘(ℝ, ℝ) ∞ (fun _ : M => c) := contMDiff_const |
| 151 | have hdef : ContMDiff (𝓡 3) 𝓘(ℝ, ℝ) ∞ (fun y => S y - R y ^ 2 / 3) := by |
| 152 | convert hSs.sub ((hc (1 / 3)).smul (hRs.pow 2)) using 1 |
| 153 | funext y |
| 154 | change S y - R y ^ 2 / 3 = S y - (1 / 3) * R y ^ 2 |
| 155 | ring |
| 156 | have hnorm := ricci_norm_bounds_of_nonneg D hD x hRic |
| 157 | have hG : 0 ≤ G x := by |
| 158 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 159 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 160 | change 0 ≤ inner ℝ (D.gradient R x) (D.gradient R x) |
| 161 | exact real_inner_self_nonneg |
| 162 | have hS : 0 ≤ S x := (div_nonneg (sq_nonneg _) (by norm_num)).trans hnorm.1 |
| 163 | have hRx : 0 < R x := hR x |
| 164 | have hV := scalar_ricci_gradient_pairing_le D hD x (hR x) hnorm.2 |
| 165 | have hV' : 4 / R x * V ≤ 4 * (A + G x) := by |
| 166 | have h := mul_le_mul_of_nonneg_left hV (show 0 ≤ 4 / R x by positivity) |
| 167 | change 4 / R x * V ≤ 4 / R x * (R x * (A + G x)) at h |
| 168 | have hid : 4 / R x * (R x * (A + G x)) = 4 * (A + G x) := by |
| 169 | field_simp [hRx.ne'] |
| 170 | rwa [hid] at h |
| 171 | have hquot := scalar_gradient_quotient_evolution_le hC F ht hR x |
| 172 | have hQ : deriv (fun s => q s x) t ≤ D.laplacian (q t) x + 4 * A + 4 * G x := by |
| 173 | have hnon : 0 ≤ 2 * S x * G x / R x ^ 2 := by positivity |
| 174 | change deriv (fun s => q s x) t ≤ D.laplacian (q t) x + |
| 175 | 4 / R x * V - 2 * S x * G x / R x ^ 2 at hquot |
| 176 | linarith only [hquot, hV', hnon] |
| 177 | have hdR := (hC.scalar_evolution 3 M J F t (interior_subset ht) x).hasDerivAt |
| 178 | (mem_interior_iff_mem_nhds.mp ht) |
| 179 | have hdS := F.hasDerivAt_ricciNormSq hC ht x |
| 180 | have hdG := hasDerivAt_scalar_gradient_energy hC F ht x |
| 181 | have hdq := (hdG.div hdR hRx.ne').differentiableAt.hasDerivAt |
| 182 | have htime := (((hdq.add ((hdS.sub ((hdR.pow 2).div_const 3)).const_mul 240))).sub |
| 183 | ((hdR.pow 2).const_mul beta)).deriv |
| 184 | norm_num only [Nat.cast_ofNat, Nat.reduceSub, pow_one] at htime |
| 185 | change deriv (fun s => H s x) t = deriv (fun s => q s x) t + |
| 186 | 240 * (D.laplacian S x - 2 * A + 4 * C - |
| 187 | (2 * R x * (D.laplacian R x + 2 * S x)) / 3) - |
| 188 | beta * (2 * R x * (D.laplacian R x + 2 * S x)) at htime |
| 189 | have hspace : D.laplacian (H t) x = D.laplacian (q t) x + |
| 190 | 240 * (D.laplacian S x - (2 * R x * D.laplacian R x + 2 * G x) / 3) - |
| 191 | beta * (2 * R x * D.laplacian R x + 2 * G x) := by |
| 192 | have h240 : ContMDiff (𝓡 3) 𝓘(ℝ, ℝ) ∞ (fun y => 240 * (S y - R y ^ 2 / 3)) := |
| 193 | (hc 240).smul hdef |
| 194 | have hbetaR : ContMDiff (𝓡 3) 𝓘(ℝ, ℝ) ∞ (fun y => beta * R y ^ 2) := |
| 195 | (hc beta).smul (hRs.pow 2) |
| 196 | have hsum : ContMDiff (𝓡 3) 𝓘(ℝ, ℝ) ∞ (fun y => q t y + 240 * (S y - R y ^ 2 / 3)) := |
| 197 | hqs.add h240 |
| 198 | have hthird : ContMDiff (𝓡 3) 𝓘(ℝ, ℝ) ∞ (fun y => (1 / 3 : ℝ) * R y ^ 2) := |
| 199 | (hc (1 / 3)).smul (hRs.pow 2) |
| 200 | change D.laplacian (fun y => q t y + 240 * (S y - R y ^ 2 / 3) - beta * R y ^ 2) x = _ |
| 201 | rw [D.laplacian_sub hsum hbetaR, |
| 202 | D.laplacian_add hqs h240, D.laplacian_const_mul, |
| 203 | D.laplacian_const_mul] |
| 204 | have hdivide : (fun y => S y - R y ^ 2 / 3) = |
| 205 | fun y => S y - (1 / 3 : ℝ) * R y ^ 2 := by funext y; ring |
| 206 | rw [hdivide, D.laplacian_sub hSs hthird, |
| 207 | D.laplacian_const_mul, D.laplacian_sq hRs] |
| 208 | ring |
| 209 | have hA := scalar_gradient_le_ricci_derivative D hD x |
| 210 | have hbetaG := mul_le_mul_of_nonneg_right hbeta1 hG |
| 211 | have hreact := ricci_defect_reaction_le D hD x (hR x) hRic |
| 212 | have hscalar := mul_le_mul_of_nonneg_left hnorm.1 |
| 213 | (show 0 ≤ 4 * beta * R x by positivity) |
| 214 | change deriv (fun s => H s x) t ≤ D.laplacian (H t) x + |
| 215 | 960 * R x * (S x - R x ^ 2 / 3) - (4 * beta / 3) * R x ^ 3 |
| 216 | change (7 / 20 : ℝ) * G x ≤ A at hA |
| 217 | change 4 * C - (4 / 3) * R x * S x ≤ 4 * R x * (S x - R x ^ 2 / 3) at hreact |
| 218 | nlinarith only [htime, hspace, hQ, hA, hG, hbetaG, hreact, hscalar] |
| 219 | |
| 220 | end PoincareMT.M47Positive |