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.Compactness.GeometricLimit.BoundaryCoverage |
| 2 | |
| 3 | /-! |
| 4 | # Static source-ball coverage by an actual embedding |
| 5 | |
| 6 | Compact closure and actual boundary distance prevent escape from the |
| 7 | image of a terminal exhaustion stage. Source: MT Theorem 5.9, pp. 88-89; |
| 8 | derivations/terminal-germs-completeness.md, Stage A4. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | |
| 14 | open Set |
| 15 | open scoped Manifold ContDiff Bundle ENNReal Topology |
| 16 | |
| 17 | universe u v |
| 18 | |
| 19 | namespace PoincareMT.M47 |
| 20 | |
| 21 | /-- Boundary avoidance covers an actual Riemannian ball. Neither metric |
| 22 | completeness nor any time interval is assumed. -/ |
| 23 | theorem terminalGerms_ball_subset_image |
| 24 | {M : Type u} [TopologicalSpace M] |
| 25 | {N : Type v} [TopologicalSpace N] [T2Space N] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) N] [IsManifold (𝓡 3) ∞ N] |
| 27 | (g : RiemannianMetric 3 N) {U V : Set M} {f : M → N} |
| 28 | (hf : Topology.IsOpenEmbedding (fun x : U => f x)) |
| 29 | (hV : IsOpen V) (hcompact : IsCompact (closure V)) |
| 30 | (hVU : closure V ⊆ U) {p : M} (hp : p ∈ V) {A : ℝ} (hA : 0 < A) |
| 31 | (hboundary : ∀ x ∈ frontier V, |
| 32 | ENNReal.ofReal A ≤ g.edist (f p) (f x)) : |
| 33 | g.ball (f p) A ⊆ f '' V := by |
| 34 | have hcont : ContinuousOn f U := |
| 35 | continuousOn_iff_continuous_domRestrict.mpr hf.continuous |
| 36 | have himage : f '' V = (fun x : U => f x) '' (Subtype.val ⁻¹' V) := by |
| 37 | ext y |
| 38 | constructor |
| 39 | · rintro ⟨x, hx, rfl⟩ |
| 40 | exact ⟨⟨x, hVU (subset_closure hx)⟩, hx, rfl⟩ |
| 41 | · rintro ⟨x, hx, rfl⟩ |
| 42 | exact ⟨x, hx, rfl⟩ |
| 43 | have hopen : IsOpen (f '' V) := by |
| 44 | rw [himage] |
| 45 | exact hf.isOpenMap _ (hV.preimage continuous_subtype_val) |
| 46 | have hclosed : IsClosed (f '' closure V) := |
| 47 | (hcompact.image_of_continuousOn (hcont.mono hVU)).isClosed |
| 48 | have hclosure : closure (f '' V) ⊆ f '' closure V := |
| 49 | closure_minimal (image_mono subset_closure) hclosed |
| 50 | apply (g.isPreconnected_ball (f p) A).subset_of_closure_inter_subset hopen |
| 51 | · refine ⟨f p, ?_, mem_image_of_mem f hp⟩ |
| 52 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : N → Type _) := |
| 53 | ⟨g.toRiemannianMetric⟩ |
| 54 | change g.edist (f p) (f p) < ENNReal.ofReal A |
| 55 | simpa only [RiemannianMetric.edist, Manifold.riemannianEDist_self] using |
| 56 | ENNReal.ofReal_pos.mpr hA |
| 57 | · rintro y ⟨hyclosure, hyball⟩ |
| 58 | obtain ⟨x, hx, rfl⟩ := hclosure hyclosure |
| 59 | have hxV : x ∈ V := by |
| 60 | by_contra hxV |
| 61 | have hfront : x ∈ frontier V := by |
| 62 | rw [frontier, hV.interior_eq] |
| 63 | exact ⟨hx, hxV⟩ |
| 64 | exact (not_lt_of_ge (hboundary x hfront)) hyball |
| 65 | exact mem_image_of_mem f hxV |
| 66 | |
| 67 | end PoincareMT.M47 |