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.Overlap.Extraction |
| 2 | import PoincareLib.Topology.Gluing.Separation |
| 3 | |
| 4 | /-! |
| 5 | # Gluing the distance-limit overlaps |
| 6 | |
| 7 | The extracted zero-distance relation supplies the local overlap system and |
| 8 | closed graphs required by the quotient construction. No ambient limit space |
| 9 | or global transitions are assumed. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | open Set Filter Metric |
| 14 | open scoped Topology NNReal |
| 15 | |
| 16 | namespace PoincareMT.ChartDistance |
| 17 | |
| 18 | variable {ι : Type*} {X : ι → Type*} [∀ i, MetricSpace (X i)] |
| 19 | [∀ i, LocallyCompactSpace (X i)] [∀ i, Nonempty (X i)] |
| 20 | {M : ℕ → Type*} [∀ k, MetricSpace (M k)] |
| 21 | {e : ∀ k i, X i → M k} {D : ∀ i j, C(X i × X j, ℝ)} |
| 22 | (hD : ∀ i j x y, Tendsto (fun k => dist (e k i x) (e k j y)) atTop |
| 23 | (𝓝 (D i j (x, y)))) |
| 24 | (L : ι → ℝ≥0) (he : ∀ k i, LipschitzWith (L i) (e k i)) |
| 25 | (c : ι → ℝ) (hc : ∀ i, 0 < c i) |
| 26 | (hlower : ∀ k i x y, c i * dist x y ≤ dist (e k i x) (e k i y)) |
| 27 | (hopen : ∀ k i, Topology.IsOpenEmbedding (e k i)) |
| 28 | (hconn : ∀ k (p : M k) r, IsPreconnected (ball p r)) |
| 29 | |
| 30 | /-- The distance-limit overlaps as input to the local quotient construction. -/ |
| 31 | noncomputable def overlapSystem : Poincare.Gluing.OverlapSystem X where |
| 32 | transition := overlapHomeomorph hD L he c hc hlower hopen hconn |
| 33 | self := fun i => by |
| 34 | apply OpenPartialHomeomorph.ext |
| 35 | · exact transition_self hD c hc hlower i |
| 36 | · exact transition_self hD c hc hlower i |
| 37 | · exact overlap_self hD i |
| 38 | inverse := fun _ _ => rfl |
| 39 | comp_source := fun _ _ _ _ hx hy => (transition_cocycle hD c hc hlower hx hy).1 |
| 40 | comp_apply := fun _ _ _ _ hx hy => (transition_cocycle hD c hc hlower hx hy).2 |
| 41 | |
| 42 | include hD in |
| 43 | theorem overlapSystem_rel_iff (i j : ι) (x : X i) (y : X j) : |
| 44 | (overlapSystem hD L he c hc hlower hopen hconn).Rel ⟨i, x⟩ ⟨j, y⟩ ↔ |
| 45 | D i j (x, y) = 0 := |
| 46 | (zero_iff_transition hD c hc hlower).symm |
| 47 | |
| 48 | include hD in |
| 49 | theorem overlapSystem_closed (i j : ι) : |
| 50 | IsClosed {p : X i × X j | |
| 51 | (overlapSystem hD L he c hc hlower hopen hconn).Rel ⟨i, p.1⟩ ⟨j, p.2⟩} := by |
| 52 | have hset : {p : X i × X j | |
| 53 | (overlapSystem hD L he c hc hlower hopen hconn).Rel ⟨i, p.1⟩ ⟨j, p.2⟩} = |
| 54 | {p | D i j p = 0} := by |
| 55 | ext p |
| 56 | exact overlapSystem_rel_iff hD L he c hc hlower hopen hconn i j p.1 p.2 |
| 57 | rw [hset] |
| 58 | exact isClosed_zero (D i j) |
| 59 | |
| 60 | include hD in |
| 61 | theorem overlapSystem_quotient_t2Space : |
| 62 | T2Space (Quotient (overlapSystem hD L he c hc hlower hopen hconn).setoid) := |
| 63 | (overlapSystem hD L he c hc hlower hopen hconn).quotient_t2Space |
| 64 | (overlapSystem_closed hD L he c hc hlower hopen hconn) |
| 65 | |
| 66 | end PoincareMT.ChartDistance |