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.Induction.SectionalIntegral |
| 2 | import PoincareLib.Geometry.Riemannian.Curvature.Bounds.Sectional |
| 3 | import PoincareLib.Geometry.Riemannian.Connection.Construction |
| 4 | |
| 5 | /-! # Actual sectional error on regular levels |
| 6 | |
| 7 | The Gauss estimate extends from orthonormal planes to every tangent pair and |
| 8 | produces the continuous nonnegative error used by corner induction. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | open Set |
| 13 | open Poincare.Geometry.Manifold.RegularLevel |
| 14 | open scoped Manifold ContDiff Bundle Topology |
| 15 | |
| 16 | /-- The actual Gauss error is continuous, nonnegative and bounds every |
| 17 | sectional curvature of the canonical induced regular-level metric. -/ |
| 18 | theorem PoincareMT.LeviCivitaData.regularLevel_sectionalError_bounds |
| 19 | {m : ℕ} {M : Type*} [TopologicalSpace M] [T3Space M] |
| 20 | [MeasurableSpace M] [BorelSpace M] |
| 21 | [ChartedSpace (EuclideanSpace ℝ (Fin (m + 2))) M] |
| 22 | [IsManifold (𝓡 (m + 2)) ∞ M] |
| 23 | {g : PoincareMT.RiemannianMetric (m + 2) M} |
| 24 | (D : PoincareMT.LeviCivitaData g) |
| 25 | {f : M → ℝ} (hf : ContMDiff (𝓡 (m + 2)) 𝓘(ℝ, ℝ) ∞ f) |
| 26 | (t : ℝ) {K : M → ℝ} (hKc : ContinuousOn K (g.regularDomain hf)) |
| 27 | (hK : ∀ x, f x = t → 0 ≤ K x) |
| 28 | (hsec : ∀ x, f x = t → ∀ v w : TangentSpace (𝓡 (m + 2)) x, |
| 29 | -K x ≤ D.sectionalCurvature x v w) |
| 30 | {β : ℝ} (hβ : 0 ≤ β) |
| 31 | (hhess : ∀ x, f x = t → ∀ v : TangentSpace (𝓡 (m + 2)) x, |
| 32 | g.inner x (D.gradient f x) v = 0 → |
| 33 | D.hessian f x v v / Real.sqrt (D.levelQ f x) ≤ β * g.inner x v v) : |
| 34 | let U := g.regularDomain hf |
| 35 | let hreg := g.regularDomain_regular hf |
| 36 | letI : Fact (Module.finrank ℝ (EuclideanSpace ℝ (Fin (m + 2))) = m + 2) := |
| 37 | ⟨finrank_euclideanSpace_fin⟩ |
| 38 | letI := openLevelSetChartedSpace hf U hreg (m + 1) t |
| 39 | letI := isManifold_openLevelSet hf U hreg (m + 1) t |
| 40 | let gL := PoincareMT.RiemannianMetric.regularLevelMetric hf U hreg t g |
| 41 | let E := D.levelSectionalError f K β ∘ openLevelIncl f U t |
| 42 | Continuous E ∧ ∀ z : openLevelSet f U t, 0 ≤ E z ∧ |
| 43 | ∀ v w : TangentSpace (𝓡 (m + 1)) z, |
| 44 | -E z ≤ gL.leviCivitaData.sectionalCurvature z v w := by |
| 45 | let U := g.regularDomain hf |
| 46 | let hreg := g.regularDomain_regular hf |
| 47 | let : Fact (Module.finrank ℝ (EuclideanSpace ℝ (Fin (m + 2))) = m + 2) := |
| 48 | ⟨finrank_euclideanSpace_fin⟩ |
| 49 | let := openLevelSetChartedSpace hf U hreg (m + 1) t |
| 50 | let := isManifold_openLevelSet hf U hreg (m + 1) t |
| 51 | let gL := PoincareMT.RiemannianMetric.regularLevelMetric hf U hreg t g |
| 52 | let incl := openLevelIncl f U t |
| 53 | let E := D.levelSectionalError f K β ∘ incl |
| 54 | refine ⟨(D.continuousOn_levelSectionalError_regularDomain hf hKc β).comp_continuous |
| 55 | (contMDiff_openLevelIncl hf U hreg (m + 1) t).continuous (fun z => z.1.2), ?_⟩ |
| 56 | intro z |
| 57 | have hEn : 0 ≤ E z := D.levelSectionalError_nonneg f K hβ (hK (incl z) z.2) |
| 58 | refine ⟨hEn, ?_⟩ |
| 59 | apply gL.leviCivitaData.sectionalCurvature_lower_bound_of_orthonormal z (neg_nonpos.mpr hEn) |
| 60 | intro u v hu hv huv |
| 61 | have htan (w : TangentSpace (𝓡 (m + 1)) z) : |
| 62 | g.inner (incl z) (D.gradient f (incl z)) |
| 63 | (mfderiv (𝓡 (m + 1)) (𝓡 (m + 2)) incl z w) = 0 := by |
| 64 | have hk : mfderiv (𝓡 (m + 2)) 𝓘(ℝ, ℝ) f (incl z) |
| 65 | (mfderiv (𝓡 (m + 1)) (𝓡 (m + 2)) incl z w) = 0 := by |
| 66 | change mfderiv (𝓡 (m + 1)) (𝓡 (m + 2)) incl z w ∈ |
| 67 | (mfderiv (𝓡 (m + 2)) 𝓘(ℝ, ℝ) f (incl z)).ker |
| 68 | rw [← range_mfderiv_openLevelIncl hf U hreg (m + 1) t z] |
| 69 | exact ⟨w, rfl⟩ |
| 70 | rw [D.inner_gradient] |
| 71 | have hk' := congrArg (fun q => NormedSpace.fromTangentSpace (f (incl z)) q) hk |
| 72 | convert hk' using 1 <;> |
| 73 | simp only [mvfderiv, ContinuousLinearMap.coe_comp, |
| 74 | Function.comp_apply, map_zero]; rfl |
| 75 | have hs := D.regularLevel_sectionalCurvature_lower_bound |
| 76 | hf U hreg t (K (incl z)) β hβ gL.leviCivitaData z |
| 77 | (fun a b _ _ _ => hsec (incl z) z.2 a b) |
| 78 | (fun w => hhess (incl z) z.2 _ (htan w)) u v hu hv huv |
| 79 | simpa only [E, Function.comp_apply, PoincareMT.LeviCivitaData.levelSectionalError, |
| 80 | neg_add_rev, sub_eq_add_neg, add_comm] using hs |
| 81 | |
| 82 |