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.Coverage |
| 2 | import Mathlib.Topology.OpenPartialHomeomorph.Basic |
| 3 | |
| 4 | /-! |
| 5 | # Actual transition domains of the distance limit |
| 6 | |
| 7 | Two coordinates overlap exactly when their limiting source distance is zero. |
| 8 | The unique partner gives a transition on this open domain. The triangle |
| 9 | inequality gives its continuity, inverse, and cocycle identities. |
| 10 | This is the overlap construction in Morgan--Tian, Theorem 5.6, pp. 86--87. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | open Set Filter Metric |
| 15 | open scoped Topology NNReal |
| 16 | |
| 17 | namespace PoincareMT.ChartDistance |
| 18 | |
| 19 | variable {ι : Type*} {X : ι → Type*} |
| 20 | |
| 21 | /-- The actual overlap consists of coordinates with a zero-distance partner. -/ |
| 22 | def overlap (D : ∀ i j, X i × X j → ℝ) (i j : ι) : Set (X i) := |
| 23 | {x | ∃ y, D i j (x, y) = 0} |
| 24 | |
| 25 | /-- Choose the partner only where the distance limit identifies the points. -/ |
| 26 | noncomputable def transition [∀ i, Nonempty (X i)] |
| 27 | (D : ∀ i j, X i × X j → ℝ) (i j : ι) (x : X i) : X j := by |
| 28 | classical |
| 29 | exact if h : x ∈ overlap D i j then Classical.choose h else Classical.ofNonempty |
| 30 | |
| 31 | theorem transition_zero [∀ i, Nonempty (X i)] |
| 32 | (D : ∀ i j, X i × X j → ℝ) {i j : ι} {x : X i} |
| 33 | (hx : x ∈ overlap D i j) : D i j (x, transition D i j x) = 0 := by |
| 34 | classical |
| 35 | simpa only [transition, dif_pos hx] using Classical.choose_spec hx |
| 36 | |
| 37 | variable [∀ i, MetricSpace (X i)] |
| 38 | {M : ℕ → Type*} [∀ k, MetricSpace (M k)] |
| 39 | {e : ∀ k i, X i → M k} {D : ∀ i j, X i × X j → ℝ} |
| 40 | (hD : ∀ i j x y, Tendsto (fun k => dist (e k i x) (e k j y)) atTop |
| 41 | (𝓝 (D i j (x, y)))) |
| 42 | (L : ι → ℝ≥0) (he : ∀ k i, LipschitzWith (L i) (e k i)) |
| 43 | (c : ι → ℝ) (hc : ∀ i, 0 < c i) |
| 44 | (hlower : ∀ k i x y, c i * dist x y ≤ dist (e k i x) (e k i y)) |
| 45 | |
| 46 | include hD in |
| 47 | omit [∀ i, MetricSpace (X i)] in |
| 48 | theorem overlap_self (i : ι) : overlap D i i = univ := by |
| 49 | ext x |
| 50 | exact ⟨fun _ => mem_univ _, fun _ => ⟨x, self hD i x⟩⟩ |
| 51 | |
| 52 | include hD he hlower hc in |
| 53 | theorem isOpen_overlap [∀ i, LocallyCompactSpace (X i)] |
| 54 | (hopen : ∀ k i, Topology.IsOpenEmbedding (e k i)) |
| 55 | (hconn : ∀ k (p : M k) r, IsPreconnected (ball p r)) (i j : ι) : |
| 56 | IsOpen (overlap D i j) := by |
| 57 | apply isOpen_iff_mem_nhds.mpr |
| 58 | rintro x ⟨y, hxy⟩ |
| 59 | exact exists_zero_nhds hD L he hopen c hc hlower hconn hxy |
| 60 | |
| 61 | variable [∀ i, Nonempty (X i)] |
| 62 | |
| 63 | include hD hlower hc in |
| 64 | theorem zero_iff_transition {i j : ι} {x : X i} {y : X j} : |
| 65 | D i j (x, y) = 0 ↔ x ∈ overlap D i j ∧ transition D i j x = y := by |
| 66 | constructor |
| 67 | · intro h |
| 68 | have hx : x ∈ overlap D i j := ⟨y, h⟩ |
| 69 | exact ⟨hx, zero_unique hD c hc hlower (transition_zero D hx) h⟩ |
| 70 | · rintro ⟨hx, rfl⟩ |
| 71 | exact transition_zero D hx |
| 72 | |
| 73 | include hD in |
| 74 | omit [∀ i, MetricSpace (X i)] in |
| 75 | theorem transition_mem {i j : ι} {x : X i} (hx : x ∈ overlap D i j) : |
| 76 | transition D i j x ∈ overlap D j i := |
| 77 | ⟨x, (comm hD j i _ _).trans (transition_zero D hx)⟩ |
| 78 | |
| 79 | include hD hlower hc in |
| 80 | theorem transition_inverse {i j : ι} {x : X i} (hx : x ∈ overlap D i j) : |
| 81 | transition D j i (transition D i j x) = x := |
| 82 | (zero_iff_transition hD c hc hlower).mp |
| 83 | ((comm hD j i _ _).trans (transition_zero D hx)) |>.2 |
| 84 | |
| 85 | include hD hlower hc in |
| 86 | theorem transition_self (i : ι) (x : X i) : transition D i i x = x := |
| 87 | (zero_iff_transition hD c hc hlower).mp (self hD i x) |>.2 |
| 88 | |
| 89 | include hD he hlower hc in |
| 90 | theorem lipschitzOn_transition (i j : ι) : |
| 91 | LipschitzOnWith (Real.toNNReal ((L i : ℝ) / c j)) |
| 92 | (transition D i j) (overlap D i j) := by |
| 93 | apply LipschitzOnWith.of_dist_le' |
| 94 | intro x hx y hy |
| 95 | have hx0 := transition_zero D hx |
| 96 | have hy0 := transition_zero D hy |
| 97 | have h1 := triangle hD j i j (transition D i j x) x (transition D i j y) |
| 98 | have h2 := triangle hD i i j x y (transition D i j y) |
| 99 | rw [(comm hD j i _ _).trans hx0, zero_add] at h1 |
| 100 | rw [hy0, add_zero] at h2 |
| 101 | have h := (lower hD c hlower j _ _).trans |
| 102 | (h1.trans (h2.trans (upper hD L he i x y))) |
| 103 | calc |
| 104 | dist (transition D i j x) (transition D i j y) ≤ |
| 105 | ((L i : ℝ) * dist x y) / c j := |
| 106 | (le_div_iff₀ (hc j)).2 (by simpa only [mul_comm] using h) |
| 107 | _ = (L i : ℝ) / c j * dist x y := by ring |
| 108 | |
| 109 | include hD he hlower hc in |
| 110 | /-- The transition homeomorphism is constructed on precisely the partner |
| 111 | domain, which can be empty for disjoint limiting charts. -/ |
| 112 | noncomputable def overlapHomeomorph [∀ i, LocallyCompactSpace (X i)] |
| 113 | (hopen : ∀ k i, Topology.IsOpenEmbedding (e k i)) |
| 114 | (hconn : ∀ k (p : M k) r, IsPreconnected (ball p r)) (i j : ι) : |
| 115 | OpenPartialHomeomorph (X i) (X j) where |
| 116 | toFun := transition D i j |
| 117 | invFun := transition D j i |
| 118 | source := overlap D i j |
| 119 | target := overlap D j i |
| 120 | map_source' := fun _ hx => transition_mem hD hx |
| 121 | map_target' := fun _ hx => transition_mem hD hx |
| 122 | left_inv' := fun _ hx => transition_inverse hD c hc hlower hx |
| 123 | right_inv' := fun _ hx => transition_inverse hD c hc hlower hx |
| 124 | open_source := isOpen_overlap hD L he c hc hlower hopen hconn i j |
| 125 | open_target := isOpen_overlap hD L he c hc hlower hopen hconn j i |
| 126 | continuousOn_toFun := (lipschitzOn_transition hD L he c hc hlower i j).continuousOn |
| 127 | continuousOn_invFun := (lipschitzOn_transition hD L he c hc hlower j i).continuousOn |
| 128 | |
| 129 | include hD hlower hc in |
| 130 | /-- Both membership in the composite overlap and its cocycle equation follow |
| 131 | from the same zero-distance relation. -/ |
| 132 | theorem transition_cocycle {i j l : ι} {x : X i} |
| 133 | (hx : x ∈ overlap D i j) (hy : transition D i j x ∈ overlap D j l) : |
| 134 | x ∈ overlap D i l ∧ |
| 135 | transition D j l (transition D i j x) = transition D i l x := by |
| 136 | have h := zero_trans hD (transition_zero D hx) (transition_zero D hy) |
| 137 | obtain ⟨hx', heq⟩ := (zero_iff_transition hD c hc hlower).mp h |
| 138 | exact ⟨hx', heq.symm⟩ |
| 139 | |
| 140 | end PoincareMT.ChartDistance |