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.Corners.ComponentAssembly |
| 2 | import PoincareLib.Geometry.Curvature.Integral.Induction.Surface |
| 3 | open Set MeasureTheory |
| 4 | open Poincare.Geometry.Manifold.RegularLevel |
| 5 | open scoped Manifold ContDiff Bundle Topology |
| 6 | |
| 7 | /-! |
| 8 | # Weighted scalar bounds on regular surface levels |
| 9 | |
| 10 | The induced sectional estimate and intrinsic surface Gauss-Bonnet bound |
| 11 | discharge the two-dimensional input to the regular-slab induction. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | private theorem surface_sectional_lower_bound_of_orthonormal |
| 18 | {S : Type*} [TopologicalSpace S] |
| 19 | [ChartedSpace (EuclideanSpace ℝ (Fin 2)) S] [IsManifold (𝓡 2) ∞ S] |
| 20 | {g : PoincareMT.RiemannianMetric 2 S} (D : PoincareMT.LeviCivitaData g) |
| 21 | (x : S) {K : ℝ} (hK : 0 ≤ K) |
| 22 | (hbound : ∀ u v : TangentSpace (𝓡 2) x, |
| 23 | g.inner x u u = 1 → g.inner x v v = 1 → g.inner x u v = 0 → |
| 24 | -K ≤ D.sectionalCurvature x u v) : |
| 25 | ∀ u v : TangentSpace (𝓡 2) x, -K ≤ D.sectionalCurvature x u v := by |
| 26 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 2) : S → Type _) := |
| 27 | ⟨g.toRiemannianMetric⟩ |
| 28 | have hd : Module.finrank ℝ (TangentSpace (𝓡 2) x) = 2 := by |
| 29 | rw [VectorBundle.finrank_eq ℝ (EuclideanSpace ℝ (Fin 2)), finrank_euclideanSpace] |
| 30 | simp |
| 31 | let b : OrthonormalBasis (Fin 2) ℝ (TangentSpace (𝓡 2) x) := |
| 32 | (g.orthonormalBasis x).reindex (finCongr hd) |
| 33 | have hb (i j : Fin 2) : g.inner x (b i) (b j) = if i = j then 1 else 0 := |
| 34 | b.inner_eq_ite i j |
| 35 | have hp := hbound (b 0) (b 1) (by simp [hb]) (by simp [hb]) (by simp [hb]) |
| 36 | intro u v |
| 37 | by_cases hz : g.inner x u u * g.inner x v v - (g.inner x u v)^2 = 0 |
| 38 | · rw [D.sectionalCurvature_eq_zero_of_gramDet_eq_zero x u v hz] |
| 39 | linarith |
| 40 | · rw [D.sectionalCurvature_eq_half_scalarCurvature x u v hz, |
| 41 | D.scalarCurvature_eq_twice_sectionalCurvature x b] |
| 42 | linarith |
| 43 | |
| 44 | theorem PoincareMT.LeviCivitaData.integral_regularLevel_surface_pos_scalar_le |
| 45 | {M : Type*} [TopologicalSpace M] [T3Space M] |
| 46 | [MeasurableSpace M] [BorelSpace M] |
| 47 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 48 | {g : PoincareMT.RiemannianMetric 3 M} (D : PoincareMT.LeviCivitaData g) |
| 49 | {f : M → ℝ} (hf : ContMDiff (𝓡 3) 𝓘(ℝ, ℝ) ∞ f) |
| 50 | (t : ℝ) (hcompact : IsCompact (f ⁻¹' {t})) |
| 51 | (hreg : ∀ x, f x = t → mfderiv (𝓡 3) 𝓘(ℝ, ℝ) f x ≠ 0) |
| 52 | {K : M → ℝ} (hKc : ContinuousOn K (g.regularDomain hf)) |
| 53 | (hK : ∀ x, f x = t → 0 ≤ K x) |
| 54 | (hsec : ∀ x, f x = t → ∀ v w : TangentSpace (𝓡 3) x, |
| 55 | -K x ≤ D.sectionalCurvature x v w) |
| 56 | {β : ℝ} (hβ : 0 ≤ β) |
| 57 | (hhess : ∀ x, f x = t → ∀ v : TangentSpace (𝓡 3) x, |
| 58 | g.inner x (D.gradient f x) v = 0 → |
| 59 | D.hessian f x v v / Real.sqrt (D.levelQ f x) ≤ β * g.inner x v v) |
| 60 | (N : ℕ) : |
| 61 | let U := g.regularDomain hf |
| 62 | let hr := g.regularDomain_regular hf |
| 63 | letI : Fact (Module.finrank ℝ (EuclideanSpace ℝ (Fin 3)) = 3) := |
| 64 | ⟨finrank_euclideanSpace_fin⟩ |
| 65 | letI := openLevelSetChartedSpace hf U hr 2 t |
| 66 | letI := isManifold_openLevelSet hf U hr 2 t |
| 67 | let L := openLevelSet f U t |
| 68 | let gL := g.regularLevelMetric hf U hr t |
| 69 | Nat.card (ConnectedComponents L) ≤ N → |
| 70 | (∫ z, max 0 (gL.leviCivitaData.scalarCurvature z) |
| 71 | ∂g.regularLevelVolume hf U hr t) ≤ |
| 72 | 8 * Real.pi * (N : ℝ) + 2 * |
| 73 | ∫ z, D.levelSectionalError f K β (openLevelIncl f U t z) |
| 74 | ∂g.regularLevelVolume hf U hr t := by |
| 75 | classical |
| 76 | let U := g.regularDomain hf |
| 77 | let hr := g.regularDomain_regular hf |
| 78 | let : Fact (Module.finrank ℝ (EuclideanSpace ℝ (Fin 3)) = 3) := |
| 79 | ⟨finrank_euclideanSpace_fin⟩ |
| 80 | let := openLevelSetChartedSpace hf U hr 2 t |
| 81 | let := isManifold_openLevelSet hf U hr 2 t |
| 82 | let L := openLevelSet f U t |
| 83 | let gL := g.regularLevelMetric hf U hr t |
| 84 | let DL := gL.leviCivitaData |
| 85 | let incl := openLevelIncl f U t |
| 86 | let E := fun z : L => D.levelSectionalError f K β (incl z) |
| 87 | dsimp only |
| 88 | intro hcount |
| 89 | have hsub : f ⁻¹' {t} ⊆ (U : Set M) := |
| 90 | fun x hx => (g.mem_regularDomain_iff hf x).mpr (hreg x hx) |
| 91 | have hLc : IsCompact (univ : Set L) := by |
| 92 | apply (isEmbedding_openLevelIncl f U t).isCompact_iff.mpr |
| 93 | rw [image_univ, range_openLevelIncl, inter_eq_right.mpr hsub] |
| 94 | exact hcompact |
| 95 | let : CompactSpace L := isCompact_univ_iff.mp hLc |
| 96 | have hEc : Continuous E := |
| 97 | (D.continuousOn_levelSectionalError_regularDomain hf hKc β).comp_continuous |
| 98 | (contMDiff_openLevelIncl hf U hr 2 t).continuous (fun z => z.1.2) |
| 99 | have hEn (z : L) : 0 ≤ E z := |
| 100 | D.levelSectionalError_nonneg f K hβ (hK (incl z) z.2) |
| 101 | have hEs (z : L) : ∀ u v : TangentSpace (𝓡 2) z, |
| 102 | -E z ≤ DL.sectionalCurvature z u v := by |
| 103 | apply surface_sectional_lower_bound_of_orthonormal DL z (hEn z) |
| 104 | intro u v hu hv huv |
| 105 | have htan (w : TangentSpace (𝓡 2) z) : |
| 106 | g.inner (incl z) (D.gradient f (incl z)) |
| 107 | (mfderiv (𝓡 2) (𝓡 3) incl z w) = 0 := by |
| 108 | have hk : mfderiv (𝓡 3) 𝓘(ℝ, ℝ) f (incl z) |
| 109 | (mfderiv (𝓡 2) (𝓡 3) incl z w) = 0 := by |
| 110 | change mfderiv (𝓡 2) (𝓡 3) incl z w ∈ |
| 111 | (mfderiv (𝓡 3) 𝓘(ℝ, ℝ) f (incl z)).ker |
| 112 | rw [← range_mfderiv_openLevelIncl hf U hr 2 t z] |
| 113 | exact ⟨w, rfl⟩ |
| 114 | rw [D.inner_gradient] |
| 115 | have hk' := congrArg (fun q => NormedSpace.fromTangentSpace (f (incl z)) q) hk |
| 116 | convert hk' using 1 <;> |
| 117 | simp only [mvfderiv, ContinuousLinearMap.coe_comp, Function.comp_apply, map_zero]; rfl |
| 118 | have hs := D.regularLevel_sectionalCurvature_lower_bound (m := 1) |
| 119 | hf U hr t (K (incl z)) β hβ DL z |
| 120 | (fun a b _ _ _ => hsec (incl z) z.2 a b) |
| 121 | (fun w => hhess (incl z) z.2 _ (htan w)) u v hu hv huv |
| 122 | change -(K (incl z) + (max 0 (-D.levelMeanCurvature f (incl z)) + |
| 123 | (2:ℝ) * β) * β) ≤ DL.sectionalCurvature z u v |
| 124 | norm_num at hs |
| 125 | linarith only [hs] |
| 126 | have hb := DL.integral_pos_scalarCurvature_surface_le_components hEc hEn hEs |
| 127 | have hc : (Nat.card (ConnectedComponents L) : ℝ) ≤ N := by exact_mod_cast hcount |
| 128 | have hb' := hb.trans (add_le_add |
| 129 | (mul_le_mul_of_nonneg_left hc (by positivity : 0 ≤ 8 * Real.pi)) le_rfl) |
| 130 | exact hb' |
| 131 | |
| 132 |