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.TubeSides |
| 2 | |
| 3 | /-! |
| 4 | # The escaping direction of a capped terminal tube |
| 5 | |
| 6 | The original end eventually avoids the compact cap. Its direction in the |
| 7 | actual attached cylinder is therefore opposite the cap attachment side. |
| 8 | This uses the supplied attachment itself and no neck overlap threshold. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open Set |
| 14 | open scoped Manifold ContDiff Topology |
| 15 | |
| 16 | universe u |
| 17 | |
| 18 | namespace PoincareMT.TerminalEnd |
| 19 | |
| 20 | variable {G : GeneralizedRicciFlowData.{u}} {T : ℝ} |
| 21 | {E : GeneralizedFlowExtension G T} {K : TerminalComponentPath E} (e : TerminalEnd K) |
| 22 | |
| 23 | theorem exists_cappedTube_direction |
| 24 | (hproper : ∀ D : Set ℝ, IsCompact D → |
| 25 | IsCompact ((E.extended.connection T).scalarCurvature ⁻¹' D)) |
| 26 | (Y : CappedTubeCertificate (E.extended.metric T)) (n : ℕ) |
| 27 | (htail : Subtype.val '' e.tail n ⊆ Y.carrier) : |
| 28 | ∀ a ∈ Ioo (0 : ℝ) 1, ∃ k : ℕ, n ≤ k ∧ |
| 29 | ∀ m : ℕ, k ≤ m → |
| 30 | Subtype.val '' e.tail m ⊆ Y.tube.cylinder.tail (!Y.attachment_side) a := by |
| 31 | obtain ⟨k, hk⟩ := e.exists_tail_disjoint_cap hproper Y.cap |
| 32 | let m := max n k |
| 33 | have hsub : Subtype.val '' e.tail m ⊆ Y.tube.carrier := by |
| 34 | intro x hx |
| 35 | have hxY := htail (image_mono (e.nested (le_max_left _ _)) hx) |
| 36 | rw [Y.carrier_eq_union] at hxY |
| 37 | exact hxY.resolve_left (fun h => disjoint_left.mp (hk m (le_max_right _ _)) hx h) |
| 38 | let tube : EpsilonTubeCertificate (E.extended.metric T) (Subtype.val '' e.tail m) := |
| 39 | { Y.tube with contains_X := hsub } |
| 40 | obtain ⟨side, hside⟩ := e.exists_tube_direction m tube |
| 41 | have hne : side ≠ Y.attachment_side := by |
| 42 | intro heq |
| 43 | obtain ⟨a, ha, hcap⟩ := Y.attachment.tube_tail |
| 44 | obtain ⟨l, _, hl⟩ := hside a ha |
| 45 | apply e.tail_image_not_subset_compact l |
| 46 | (Y.cap.isCompact_closure_of_scalar_proper (E.extended.connection T) hproper) |
| 47 | apply (hl l le_rfl).trans |
| 48 | exact (show tube.cylinder.tail side a ⊆ Y.cap.carrier by |
| 49 | simpa only [tube, heq] using hcap).trans subset_closure |
| 50 | have heq : side = !Y.attachment_side := by |
| 51 | cases side <;> cases h : Y.attachment_side <;> simp_all |
| 52 | intro a ha |
| 53 | obtain ⟨l, hml, hl⟩ := hside a ha |
| 54 | refine ⟨l, (le_max_left n k).trans hml, ?_⟩ |
| 55 | simpa only [tube, heq] using hl |
| 56 | |
| 57 | end PoincareMT.TerminalEnd |