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.Rigidity.GlobalExtrema |
| 2 | import PoincareLib.Geometry.RicciFlow.Soliton.TwoDimensional.Compact.Rigidity.Extrema |
| 3 | import PoincareLib.Geometry.Riemannian.Measure.Coarea.Variation.Area |
| 4 | import Mathlib.Analysis.Calculus.MeanValue |
| 5 | |
| 6 | /-! |
| 7 | # Constant coarea density of a shrinking surface |
| 8 | |
| 9 | The surface soliton equation makes the regular level area proportional to the |
| 10 | gradient length. Thus the volume pushed forward by the potential has constant |
| 11 | density on each interval of regular values. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set MeasureTheory Filter |
| 18 | open Poincare.Geometry.Manifold.RegularLevel |
| 19 | open scoped Manifold ContDiff Topology |
| 20 | |
| 21 | namespace PoincareMT.LeviCivitaData |
| 22 | |
| 23 | variable {M : Type*} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin 2)) M] [IsManifold (𝓡 2) ∞ M] |
| 25 | {g : RiemannianMetric 2 M} |
| 26 | |
| 27 | /-- The regular-level curvature divided by the normal speed is determined by |
| 28 | the scalar curvature and the squared gradient length. -/ |
| 29 | theorem levelMeanCurvature_div_speed_of_surface_soliton (D : LeviCivitaData g) |
| 30 | {f : M → ℝ} {lambda : ℝ} (hf : ContMDiff (𝓡 2) 𝓘(ℝ, ℝ) ∞ f) |
| 31 | (hsol : ∀ x, ∀ v w : TangentSpace (𝓡 2) x, |
| 32 | D.ricci x v w + D.hessian f x v w = lambda * g.inner x v w) |
| 33 | (x : M) (hreg : 0 < D.levelQ f x) : |
| 34 | D.levelMeanCurvature f x / g.tangentNorm x (g.gradient f x) = |
| 35 | (lambda - D.scalarCurvature x / 2) / D.levelQ f x := by |
| 36 | rw [D.levelMeanCurvature_eq_scalarOperators hf x hreg] |
| 37 | have hcross : g.inner x (D.gradient (D.levelQ f) x) (D.gradient f x) = |
| 38 | 2 * (lambda - (1 / 2 : ℝ) * D.scalarCurvature x) * D.levelQ f x := by |
| 39 | rw [D.inner_gradient] |
| 40 | unfold levelQ |
| 41 | rw [D.mvfderiv_gradient_normSq (hf x), |
| 42 | D.hessian_eq_of_surface_soliton hsol] |
| 43 | ring |
| 44 | rw [hcross] |
| 45 | have hlap := D.scalar_add_laplacian_of_surface_soliton hsol x |
| 46 | change (_ / Real.sqrt (D.levelQ f x)) / Real.sqrt (D.levelQ f x) = _ |
| 47 | have hs := Real.sq_sqrt hreg.le |
| 48 | have hn := (Real.sqrt_pos.mpr hreg).ne' |
| 49 | field_simp |
| 50 | rw [hs, show D.laplacian f x = 2 * lambda - D.scalarCurvature x by linarith] |
| 51 | ring |
| 52 | |
| 53 | variable [MeasurableSpace M] [BorelSpace M] [T3Space M] |
| 54 | |
| 55 | /-- First variation in a scalar profile for the curvature and gradient energy. -/ |
| 56 | theorem hasDerivAt_regularLevelArea_of_surface_soliton (D : LeviCivitaData g) |
| 57 | {f : M → ℝ} {lambda : ℝ} (hf : ContMDiff (𝓡 2) 𝓘(ℝ, ℝ) ∞ f) |
| 58 | (hsol : ∀ x, ∀ v w : TangentSpace (𝓡 2) x, |
| 59 | D.ricci x v w + D.hessian f x v w = lambda * g.inner x v w) |
| 60 | {I : Set ℝ} (hI : IsOpen I) (hproper : IsProperMap (I.restrictPreimage f)) |
| 61 | (hreg : ∀ x, f x ∈ I → mfderiv (𝓡 2) 𝓘(ℝ, ℝ) f x ≠ 0) |
| 62 | {q r : ℝ → ℝ} |
| 63 | (hQ : ∀ x, f x ∈ I → D.levelQ f x = q (f x)) |
| 64 | (hR : ∀ x, f x ∈ I → D.scalarCurvature x = r (f x)) |
| 65 | {t : ℝ} (ht : t ∈ I) : |
| 66 | HasDerivAt (g.regularLevelArea hf) |
| 67 | ((lambda - r t / 2) / q t * g.regularLevelArea hf t) t := by |
| 68 | apply ((D.first_variation_regularLevelArea hf hI hproper hreg).2 t ht).congr_deriv |
| 69 | have heq : (fun z : openLevelSet f (g.regularDomain hf) t => |
| 70 | D.levelMeanCurvature f (openLevelIncl f (g.regularDomain hf) t z) / |
| 71 | g.tangentNorm (openLevelIncl f (g.regularDomain hf) t z) |
| 72 | (g.gradient f (openLevelIncl f (g.regularDomain hf) t z))) = |
| 73 | fun _ => (lambda - r t / 2) / q t := by |
| 74 | funext z |
| 75 | have hzt : f (openLevelIncl f (g.regularDomain hf) t z) = t := z.2 |
| 76 | have hz : f (openLevelIncl f (g.regularDomain hf) t z) ∈ I := by rw [hzt]; exact ht |
| 77 | rw [D.levelMeanCurvature_div_speed_of_surface_soliton hf hsol _ |
| 78 | (Real.sqrt_pos.mp ((g.tangentNorm_gradient_pos_iff f _).mpr (hreg _ hz))), |
| 79 | hQ _ hz, hR _ hz, hzt] |
| 80 | rw [heq, integral_const] |
| 81 | simp only [smul_eq_mul, RiemannianMetric.regularLevelArea, mul_comm] |
| 82 | |
| 83 | /-- The level area divided by the gradient length is constant throughout an |
| 84 | interval of proper regular values. -/ |
| 85 | theorem exists_const_regularLevelArea_div_sqrt_of_surface_soliton |
| 86 | (D : LeviCivitaData g) {f : M → ℝ} {lambda a b : ℝ} |
| 87 | (hf : ContMDiff (𝓡 2) 𝓘(ℝ, ℝ) ∞ f) |
| 88 | (hsol : ∀ x, ∀ v w : TangentSpace (𝓡 2) x, |
| 89 | D.ricci x v w + D.hessian f x v w = lambda * g.inner x v w) |
| 90 | (hproper : IsProperMap ((Ioo a b).restrictPreimage f)) |
| 91 | (hreg : ∀ x, f x ∈ Ioo a b → mfderiv (𝓡 2) 𝓘(ℝ, ℝ) f x ≠ 0) |
| 92 | {q r : ℝ → ℝ} |
| 93 | (hQ : ∀ x, f x ∈ Ioo a b → D.levelQ f x = q (f x)) |
| 94 | (hR : ∀ x, f x ∈ Ioo a b → D.scalarCurvature x = r (f x)) |
| 95 | (hq : ∀ t ∈ Ioo a b, 0 < q t) |
| 96 | (hqd : ∀ t ∈ Ioo a b, HasDerivAt q (2 * lambda - r t) t) : |
| 97 | ∃ c : ℝ, ∀ t ∈ Ioo a b, |
| 98 | g.regularLevelArea hf t / Real.sqrt (q t) = c := by |
| 99 | have hd (t : ℝ) (ht : t ∈ Ioo a b) : |
| 100 | HasDerivAt (fun s => g.regularLevelArea hf s / Real.sqrt (q s)) 0 t := by |
| 101 | have hA := D.hasDerivAt_regularLevelArea_of_surface_soliton hf hsol isOpen_Ioo |
| 102 | hproper hreg hQ hR ht |
| 103 | have hs := (hqd t ht).sqrt (hq t ht).ne' |
| 104 | apply (hA.div hs (Real.sqrt_pos.mpr (hq t ht)).ne').congr_deriv |
| 105 | have he := Real.sq_sqrt (hq t ht).le |
| 106 | have hn := (Real.sqrt_pos.mpr (hq t ht)).ne' |
| 107 | field_simp |
| 108 | rw [he, div_self (hq t ht).ne'] |
| 109 | ring |
| 110 | exact isOpen_Ioo.exists_is_const_of_deriv_eq_zero (convex_Ioo a b).isPreconnected |
| 111 | (fun t ht => (hd t ht).differentiableAt.differentiableWithinAt) |
| 112 | (fun t ht => (hd t ht).deriv) |
| 113 | |
| 114 | end PoincareMT.LeviCivitaData |