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.Curvature.Integral.Hypersurface |
| 2 | import PoincareLib.Geometry.Riemannian.ScalarOperators.Composition |
| 3 | |
| 4 | /-! |
| 5 | # Level-function cutoffs in the hypersurface Bochner identity |
| 6 | |
| 7 | For a cutoff depending only on the level function, the flux term is the |
| 8 | mean curvature times the level speed. Coarea will turn this volume integral |
| 9 | into the boundary terms in Petrunin, Section 2.2, author manuscript p. 4. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | |
| 15 | open Set MeasureTheory Filter |
| 16 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 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 | /-- The trace of the second fundamental form is the tangential Hessian trace |
| 27 | divided by the length of the gradient. -/ |
| 28 | lemma hessian_mean_curvature (D : LeviCivitaData g) |
| 29 | {f : M → ℝ} (hf : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ f) (x : M) |
| 30 | (hreg : 0 < g.inner x (D.gradient f x) (D.gradient f x)) : |
| 31 | let q := g.inner x (D.gradient f x) (D.gradient f x) |
| 32 | let u := (Real.sqrt q)⁻¹ • D.gradient f x |
| 33 | let P := fun v : TangentSpace (𝓡 n) x => v - (g.inner x u v) • u |
| 34 | (∑ i, D.hessian f x (P (g.orthonormalBasis x i)) |
| 35 | (P (g.orthonormalBasis x i)) / Real.sqrt q) = |
| 36 | (D.laplacian f x - D.hessian f x u u) / Real.sqrt q := by |
| 37 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 38 | ⟨g.toRiemannianMetric⟩ |
| 39 | let A := D.connection (D.gradient f) x |
| 40 | have hA (v w : TangentSpace (𝓡 n) x) : inner ℝ (A v) w = inner ℝ v (A w) := by |
| 41 | change g.inner x (A v) w = g.inner x v (A w) |
| 42 | rw [g.symm x v] |
| 43 | exact (D.hessian_eq_inner_connection_gradient (hf x) v w).symm.trans |
| 44 | ((D.hessian_symm hf x v w).trans (D.hessian_eq_inner_connection_gradient (hf x) w v)) |
| 45 | let q := g.inner x (D.gradient f x) (D.gradient f x) |
| 46 | let u := (Real.sqrt q)⁻¹ • D.gradient f x |
| 47 | have hu : inner ℝ u u = 1 := by |
| 48 | change g.inner x u u = 1 |
| 49 | simp only [u, map_smul, smul_apply, smul_eq_mul] |
| 50 | change (Real.sqrt q)⁻¹ * ((Real.sqrt q)⁻¹ * q) = 1 |
| 51 | have hs : (Real.sqrt q) ^ 2 = q := Real.sq_sqrt hreg.le |
| 52 | have hr : Real.sqrt q ≠ 0 := (Real.sqrt_pos.2 hreg).ne' |
| 53 | field_simp |
| 54 | exact hs.symm |
| 55 | have h := Poincare.LinearAlgebra.trace_orthogonal_restriction |
| 56 | (g.orthonormalBasis x) A hA u hu |
| 57 | have hinner (v w : TangentSpace (𝓡 n) x) : inner ℝ v w = g.inner x v w := rfl |
| 58 | simp only [hinner, A] at h |
| 59 | dsimp only |
| 60 | rw [← Finset.sum_div] |
| 61 | congr 1 |
| 62 | simp_rw [D.hessian_eq_inner_connection_gradient (hf x)] |
| 63 | rw [D.laplacian_eq_sum_inner_connection_gradient (hf x)] |
| 64 | exact h |
| 65 | |
| 66 | variable [MeasurableSpace M] [BorelSpace M] [T3Space M] |
| 67 | |
| 68 | /-- Specializing the weighted hypersurface identity to a cutoff of the level |
| 69 | function identifies its flux with the mean curvature. -/ |
| 70 | theorem integral_hypersurface_bochner_level_cutoff (D : LeviCivitaData g) |
| 71 | {f : M → ℝ} {η : ℝ → ℝ} |
| 72 | (hf : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ f) (hη : ContDiff ℝ ∞ η) |
| 73 | (hc : HasCompactSupport (η ∘ f)) |
| 74 | (hreg : ∀ x ∈ tsupport (η ∘ f), 0 < g.inner x (D.gradient f x) (D.gradient f x)) : |
| 75 | let q := fun x => g.inner x (D.gradient f x) (D.gradient f x) |
| 76 | let u := fun x => (Real.sqrt (q x))⁻¹ • D.gradient f x |
| 77 | let P := fun (x : M) (v : TangentSpace (𝓡 n) x) => v - (g.inner x (u x) v) • u x |
| 78 | let B := fun (x : M) (v w : TangentSpace (𝓡 n) x) => |
| 79 | D.hessian f x (P x v) (P x w) / Real.sqrt (q x) |
| 80 | let H := fun x => ∑ i, B x (g.orthonormalBasis x i) (g.orthonormalBasis x i) |
| 81 | let G := fun x => (H x) ^ 2 - |
| 82 | ∑ i, ∑ j, (B x (g.orthonormalBasis x i) (g.orthonormalBasis x j)) ^ 2 |
| 83 | (∫ x, η (f x) * (G x - D.ricci x (u x) (u x)) ∂g.volumeMeasure) = |
| 84 | ∫ x, -(deriv η (f x)) * H x * Real.sqrt (q x) ∂g.volumeMeasure := by |
| 85 | dsimp only |
| 86 | have hi := D.integral_hypersurface_bochner (hη.contMDiff.comp hf) hf hc hreg |
| 87 | dsimp only [Function.comp_apply] at hi |
| 88 | rw [hi] |
| 89 | apply integral_congr_ae |
| 90 | filter_upwards [] with x |
| 91 | have hchain := D.gradient_comp ((hf x).mdifferentiableAt (by simp)) |
| 92 | (hη.differentiable (by simp) (f x)) |
| 93 | by_cases hx : x ∈ tsupport (η ∘ f) |
| 94 | · rw [hessian_mean_curvature D hf x (hreg x hx), hchain] |
| 95 | simp only [map_smul, smul_apply, smul_eq_mul] |
| 96 | rw [g.symm x (D.gradient f x), D.inner_gradient, |
| 97 | D.mvfderiv_gradient_normSq (hf x)] |
| 98 | simp_rw [D.hessian_eq_inner_connection_gradient (hf x)] |
| 99 | simp only [map_smul, smul_apply, smul_eq_mul] |
| 100 | have hs := Real.sq_sqrt (hreg x hx).le |
| 101 | have hr := (Real.sqrt_pos.2 (hreg x hx)).ne' |
| 102 | field_simp [(hreg x hx).ne'] |
| 103 | rw [hs] |
| 104 | ring |
| 105 | · rw [D.gradient_eq_zero_of_notMem_tsupport hx] |
| 106 | simp only [map_zero, zero_apply, zero_div, mul_zero, sub_zero] |
| 107 | by_cases hq : g.inner x (D.gradient f x) (D.gradient f x) = 0 |
| 108 | · simp [hq] |
| 109 | · have hz := congrArg (fun v => g.inner x v (D.gradient f x)) hchain |
| 110 | rw [D.gradient_eq_zero_of_notMem_tsupport hx] at hz |
| 111 | simp only [map_zero, zero_apply, map_smul, smul_apply, smul_eq_mul] at hz |
| 112 | have hηz : deriv η (f x) = 0 := (mul_eq_zero.mp hz.symm).resolve_right hq |
| 113 | simp [hηz] |
| 114 | |
| 115 | end PoincareMT.LeviCivitaData |