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.Surgery.Singular.RegularLimit.Ends.Topology |
| 2 | import PoincareLib.Geometry.Riemannian.Connection.Uniqueness |
| 3 | |
| 4 | /-! |
| 5 | # Caps are precompact when scalar curvature is proper |
| 6 | |
| 7 | The scalar ratio on a cap confines it to a bounded positive scalar interval. |
| 8 | Properness then makes its closure compact, without any completeness assumption. |
| 9 | Every terminal end eventually avoids each such cap. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set |
| 15 | open scoped Manifold ContDiff Bundle Topology |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT |
| 20 | |
| 21 | namespace CapCertificate |
| 22 | |
| 23 | variable {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 25 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 26 | [T2Space M] [T3Space M] {g : RiemannianMetric 3 M} |
| 27 | |
| 28 | /-- A cap lies in a compact scalar sublevel, so its closure is compact. -/ |
| 29 | theorem isCompact_closure_of_scalar_proper (N : CapCertificate g) |
| 30 | (D : LeviCivitaData g) |
| 31 | (hproper : ∀ C : Set ℝ, IsCompact C → IsCompact (D.scalarCurvature ⁻¹' C)) : |
| 32 | IsCompact (closure N.carrier) := by |
| 33 | obtain ⟨p, hp⟩ := N.core_nonempty |
| 34 | have hpN : p ∈ N.carrier := by |
| 35 | rw [N.core_eq_interior_closed_core] at hp |
| 36 | have hpclosed := interior_subset hp |
| 37 | rw [N.closed_core_eq_complement_end] at hpclosed |
| 38 | exact hpclosed.1 |
| 39 | obtain ⟨b, _, hb⟩ := N.scalar_ratio |
| 40 | let C := D.scalarCurvature ⁻¹' Icc 0 (b * N.connection.scalarCurvature p) |
| 41 | have hC : IsCompact C := hproper _ isCompact_Icc |
| 42 | apply hC.of_isClosed_subset isClosed_closure |
| 43 | apply closure_minimal _ hC.isClosed |
| 44 | intro x hx |
| 45 | change 0 ≤ D.scalarCurvature x ∧ D.scalarCurvature x ≤ _ |
| 46 | rw [← N.connection.scalarCurvature_eq D x] |
| 47 | exact ⟨(N.scalar_pos x hx).le, hb p hpN x hx⟩ |
| 48 | |
| 49 | end CapCertificate |
| 50 | |
| 51 | namespace TerminalEnd |
| 52 | |
| 53 | variable {F : GeneralizedRicciFlowData.{u}} {T : ℝ} |
| 54 | {E : GeneralizedFlowExtension F T} {K : TerminalComponentPath E} |
| 55 | |
| 56 | /-- Ambient compact sets are eventually disjoint from every chosen end tail. -/ |
| 57 | theorem exists_tail_disjoint_compact (e : TerminalEnd K) |
| 58 | {L : Set (E.extended.slice T).carrier} (hL : IsCompact L) : |
| 59 | ∃ n : ℕ, ∀ m : ℕ, n ≤ m → Disjoint (Subtype.val '' e.tail m) L := by |
| 60 | have hK : IsClosed K.component := by |
| 61 | rw [K.component_eq] |
| 62 | exact isClosed_connectedComponent |
| 63 | have hpre := hK.isClosedEmbedding_subtypeVal.isCompact_preimage hL |
| 64 | obtain ⟨n, hn⟩ := e.exhaustion.exists_superset_of_isCompact hpre |
| 65 | refine ⟨n, fun m hnm => Set.disjoint_left.mpr ?_⟩ |
| 66 | rintro _ ⟨x, hx, rfl⟩ hxL |
| 67 | exact e.tail_subset_compl_exhaustion m hx (e.exhaustion.subset hnm (hn hxL)) |
| 68 | |
| 69 | theorem exists_tail_disjoint_cap (e : TerminalEnd K) |
| 70 | (hproper : ∀ C : Set ℝ, IsCompact C → |
| 71 | IsCompact ((E.extended.connection T).scalarCurvature ⁻¹' C)) |
| 72 | (N : CapCertificate (E.extended.metric T)) : |
| 73 | ∃ n : ℕ, ∀ m : ℕ, n ≤ m → Disjoint (Subtype.val '' e.tail m) N.carrier := by |
| 74 | obtain ⟨n, hn⟩ := e.exists_tail_disjoint_compact |
| 75 | (N.isCompact_closure_of_scalar_proper (E.extended.connection T) hproper) |
| 76 | exact ⟨n, fun m hnm => (hn m hnm).mono_right subset_closure⟩ |
| 77 | |
| 78 | end TerminalEnd |
| 79 | |
| 80 | end PoincareMT |