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.Manifold.RegularLevel.ChartedSpace |
| 2 | import Mathlib.Topology.Connected.LocallyConnected |
| 3 | |
| 4 | /-! # Finitely many components of a compact regular level -/ |
| 5 | |
| 6 | noncomputable section |
| 7 | set_option autoImplicit false |
| 8 | |
| 9 | open Set |
| 10 | open scoped Manifold ContDiff |
| 11 | |
| 12 | namespace Poincare.Geometry.Manifold.RegularLevel |
| 13 | |
| 14 | /-- A compact regular level has finitely many connected components. -/ |
| 15 | theorem finite_connectedComponents_of_compact_regular_level |
| 16 | {n : Nat} {M : Type*} [TopologicalSpace M] |
| 17 | [ChartedSpace (EuclideanSpace Real (Fin (n + 1))) M] |
| 18 | [IsManifold (𝓡 (n + 1)) ∞ M] |
| 19 | {f : M -> Real} (hf : ContMDiff (𝓡 (n + 1)) 𝓘(Real, Real) ∞ f) |
| 20 | (c : Real) (hc : IsCompact (f ⁻¹' {c})) |
| 21 | (hreg : ∀ x, f x = c -> mfderiv (𝓡 (n + 1)) 𝓘(Real, Real) f x ≠ 0) : |
| 22 | Finite (ConnectedComponents (f ⁻¹' {c} : Set M)) := by |
| 23 | let : Fact (Module.finrank Real (EuclideanSpace Real (Fin (n + 1))) = n + 1) := |
| 24 | ⟨by simp⟩ |
| 25 | let := levelSetChartedSpace hf n c hreg |
| 26 | let : CompactSpace (f ⁻¹' {c} : Set M) := isCompact_iff_compactSpace.mp hc |
| 27 | let : LocallyConnectedSpace (f ⁻¹' {c} : Set M) := |
| 28 | ChartedSpace.locallyConnectedSpace (EuclideanSpace Real (Fin n)) _ |
| 29 | infer_instance |
| 30 | |
| 31 | end Poincare.Geometry.Manifold.RegularLevel |