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.CompactCoverage |
| 2 | import PoincareLib.Geometry.RicciFlow.Compactness.GeometricLimit.Overlap.UniformDistance |
| 3 | import PoincareLib.Topology.Exhaustion |
| 4 | |
| 5 | /-! |
| 6 | # Connectedness retained by geometric overlaps |
| 7 | |
| 8 | Compact coordinate sets with disjoint quotient images have disjoint source |
| 9 | images eventually. Finite source-ball covers therefore transfer the |
| 10 | connectedness of the approximating balls to the overlap quotient. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | open Set Filter Metric |
| 15 | open scoped Topology NNReal |
| 16 | |
| 17 | namespace PoincareMT.ChartDistance |
| 18 | |
| 19 | theorem quotient_locallyConnected_of_charts |
| 20 | {ι : Type*} {X : ι → Type*} [∀ i, TopologicalSpace (X i)] |
| 21 | [∀ i, LocallyConnectedSpace (X i)] (O : Poincare.Gluing.OverlapSystem X) : |
| 22 | LocallyConnectedSpace (Quotient O.setoid) := by |
| 23 | apply locallyConnectedSpace_iff_subsets_isOpen_isConnected.mpr |
| 24 | intro q U hU |
| 25 | induction q using Quotient.inductionOn with |
| 26 | | h q => |
| 27 | have hpre : O.include q.1 ⁻¹' U ∈ 𝓝 q.2 := |
| 28 | (O.include_isOpenEmbedding q.1).continuous.continuousAt.preimage_mem_nhds hU |
| 29 | obtain ⟨V, ⟨hV, hqV, hVc⟩, hVU⟩ := |
| 30 | (LocallyConnectedSpace.open_connected_basis q.2).mem_iff.mp hpre |
| 31 | exact ⟨O.include q.1 '' V, image_subset_iff.mpr hVU, |
| 32 | O.include_isOpenMap q.1 V hV, mem_image_of_mem _ hqV, |
| 33 | hVc.image _ (O.include_isOpenEmbedding q.1).continuous.continuousOn⟩ |
| 34 | |
| 35 | variable {ι : Type*} {X : ι → Type*} [∀ i, MetricSpace (X i)] |
| 36 | {M : ℕ → Type*} [∀ k, MetricSpace (M k)] |
| 37 | {e : ∀ k i, X i → M k} {D : ∀ i j, C(X i × X j, ℝ)} |
| 38 | (hD : ∀ i j, TendstoLocallyUniformly |
| 39 | (fun k (p : X i × X j) => dist (e k i p.1) (e k j p.2)) (D i j) atTop) |
| 40 | |
| 41 | include hD |
| 42 | |
| 43 | theorem eventually_disjoint_source_images |
| 44 | {i j : ι} {K : Set (X i)} {S : Set (X j)} |
| 45 | (hK : IsCompact K) (hS : IsCompact S) |
| 46 | (hzero : ∀ x ∈ K, ∀ y ∈ S, D i j (x, y) ≠ 0) : |
| 47 | ∀ᶠ k in atTop, Disjoint (e k i '' K) (e k j '' S) := by |
| 48 | by_cases hne : (K ×ˢ S).Nonempty |
| 49 | · obtain ⟨p, hp, hmin⟩ := (hK.prod hS).exists_isMinOn hne (D i j).continuous.continuousOn |
| 50 | have hpoint := fun i j x y => |
| 51 | (hD i j).tendstoLocallyUniformlyOn.tendsto_at (mem_univ (x, y)) |
| 52 | have hpos : 0 < D i j p := lt_of_le_of_ne |
| 53 | (nonneg hpoint i j p.1 p.2) (hzero p.1 hp.1 p.2 hp.2).symm |
| 54 | filter_upwards [eventually_dist_sub_limit_lt_on_compact hD |
| 55 | (K ×ˢ S) (hK.prod hS) hpos] with k hk |
| 56 | rw [disjoint_left] |
| 57 | rintro z ⟨x, hx, rfl⟩ ⟨y, hy, heq⟩ |
| 58 | have h := hk (x, y) ⟨hx, hy⟩ |
| 59 | rw [heq, dist_self, zero_sub, abs_neg, abs_of_nonneg (nonneg hpoint i j x y)] at h |
| 60 | exact (not_lt_of_ge (hmin ⟨hx, hy⟩)) h |
| 61 | · have hempty : K = ∅ ∨ S = ∅ := by |
| 62 | simpa only [prod_nonempty_iff, not_and_or, not_nonempty_iff_eq_empty] using hne |
| 63 | rcases hempty with rfl | rfl <;> simp |
| 64 | |
| 65 | theorem quotient_preconnected_of_source_ball_covers |
| 66 | (O : Poincare.Gluing.OverlapSystem X) |
| 67 | (hrel : ∀ i j (x : X i) (y : X j), O.Rel ⟨i, x⟩ ⟨j, y⟩ ↔ D i j (x, y) = 0) |
| 68 | (L : ι → ℝ≥0) (he : ∀ k i, LipschitzWith (L i) (e k i)) |
| 69 | (hconn : ∀ k (p : M k) r, IsPreconnected (ball p r)) |
| 70 | {i₀ : ι} (p : X i₀) |
| 71 | (hcover : ∀ R : ℝ, 0 < R → ∃ s : Finset ι, ∃ K : ∀ j, Set (X j), |
| 72 | (∀ j ∈ s, IsCompact (K j)) ∧ |
| 73 | ∀ᶠ k in atTop, ball (e k i₀ p) R ⊆ ⋃ j ∈ s, e k j '' K j) : |
| 74 | PreconnectedSpace (Quotient O.setoid) := by |
| 75 | classical |
| 76 | have hpoint := fun i j x y => |
| 77 | (hD i j).tendstoLocallyUniformlyOn.tendsto_at (mem_univ (x, y)) |
| 78 | have hfull : ∀ S : Set (Quotient O.setoid), IsClopen S → O.include i₀ p ∈ S → S = univ := by |
| 79 | intro S hS hp |
| 80 | apply eq_univ_of_forall |
| 81 | intro q |
| 82 | induction q using Quotient.inductionOn with |
| 83 | | h q => |
| 84 | by_contra hq |
| 85 | let R := max (D i₀ q.1 (p, q.2) + 1) 1 |
| 86 | have hR : 0 < R := lt_of_lt_of_le zero_lt_one (le_max_right _ _) |
| 87 | have hqR : D i₀ q.1 (p, q.2) < R := |
| 88 | lt_of_lt_of_le (lt_add_one _) (le_max_left _ _) |
| 89 | obtain ⟨s, K, hK, hcov⟩ := hcover R hR |
| 90 | let A := fun i => K i ∩ O.include i ⁻¹' S |
| 91 | let B := fun i => K i ∩ O.include i ⁻¹' Sᶜ |
| 92 | have hA (i) (hi : i ∈ s) : IsCompact (A i) := |
| 93 | (hK i hi).inter_right (hS.isClosed.preimage (O.include_isOpenEmbedding i).continuous) |
| 94 | have hB (i) (hi : i ∈ s) : IsCompact (B i) := |
| 95 | (hK i hi).inter_right (hS.compl.isClosed.preimage (O.include_isOpenEmbedding i).continuous) |
| 96 | let a := fun k => ⋃ i ∈ s, e k i '' A i |
| 97 | let b := fun k => ⋃ i ∈ s, e k i '' B i |
| 98 | have hdisj : ∀ᶠ k in atTop, Disjoint (a k) (b k) := by |
| 99 | have hh : ∀ i ∈ s, ∀ᶠ k in atTop, ∀ j ∈ s, |
| 100 | Disjoint (e k i '' A i) (e k j '' B j) := by |
| 101 | intro i hi |
| 102 | apply s.eventually_all.mpr |
| 103 | intro j hj |
| 104 | apply eventually_disjoint_source_images hD (hA i hi) (hB j hj) |
| 105 | intro x hx y hy hzero |
| 106 | have heq : O.include i x = O.include j y := |
| 107 | Quotient.sound ((hrel i j x y).mpr hzero) |
| 108 | exact hy.2 (heq ▸ hx.2) |
| 109 | filter_upwards [s.eventually_all.mpr hh] with k hk |
| 110 | simp only [a, b, disjoint_iUnion_left, disjoint_iUnion_right] |
| 111 | exact fun j hj i hi => hk i hi j hj |
| 112 | have hnot (i : ι) (x : X i) (C : ∀ j, Set (X j)) |
| 113 | (hC : ∀ j ∈ s, IsCompact (C j)) |
| 114 | (hzero : ∀ j ∈ s, ∀ y ∈ C j, D i j (x, y) ≠ 0) : |
| 115 | ∀ᶠ k in atTop, e k i x ∉ ⋃ j ∈ s, e k j '' C j := by |
| 116 | apply not_frequently.mp |
| 117 | intro hf |
| 118 | simp only [mem_iUnion, exists_prop] at hf |
| 119 | obtain ⟨j, hj, hfreq⟩ := s.frequently_exists.mp hf |
| 120 | obtain ⟨y, hy, hz⟩ := exists_zero_of_frequently_mem_image hpoint L he (hC j hj) hfreq |
| 121 | exact hzero j hj y hy hz |
| 122 | have hpnot : ∀ᶠ k in atTop, e k i₀ p ∉ b k := by |
| 123 | apply hnot i₀ p B hB |
| 124 | intro j _ y hy hz |
| 125 | have heq : O.include i₀ p = O.include j y := |
| 126 | Quotient.sound ((hrel i₀ j p y).mpr hz) |
| 127 | exact hy.2 (heq ▸ hp) |
| 128 | have hqnot : ∀ᶠ k in atTop, e k q.1 q.2 ∉ a k := by |
| 129 | apply hnot q.1 q.2 A hA |
| 130 | intro j _ y hy hz |
| 131 | have heq : O.include q.1 q.2 = O.include j y := |
| 132 | Quotient.sound ((hrel q.1 j q.2 y).mpr hz) |
| 133 | apply hq |
| 134 | change O.include q.1 q.2 ∈ S |
| 135 | rw [heq] |
| 136 | exact hy.2 |
| 137 | have hqball : ∀ᶠ k in atTop, e k q.1 q.2 ∈ ball (e k i₀ p) R := by |
| 138 | simpa only [mem_ball, dist_comm] using |
| 139 | (hpoint i₀ q.1 p q.2).eventually (gt_mem_nhds hqR) |
| 140 | obtain ⟨k, hcovk, hdisjk, hpk, hqk, hqballk⟩ := |
| 141 | (hcov.and (hdisj.and (hpnot.and (hqnot.and hqball)))).exists |
| 142 | have hab : ball (e k i₀ p) R ⊆ a k ∪ b k := by |
| 143 | intro z hz |
| 144 | obtain ⟨i, hi, x, hx, rfl⟩ := by |
| 145 | simpa only [mem_iUnion, exists_prop, mem_image] using hcovk hz |
| 146 | by_cases hxS : O.include i x ∈ S |
| 147 | · exact Or.inl (mem_iUnion.mpr ⟨i, mem_iUnion.mpr ⟨hi, x, ⟨hx, hxS⟩, rfl⟩⟩) |
| 148 | · exact Or.inr (mem_iUnion.mpr ⟨i, mem_iUnion.mpr ⟨hi, x, ⟨hx, hxS⟩, rfl⟩⟩) |
| 149 | have haClosed : IsClosed (a k) := |
| 150 | (s.finite_toSet.isCompact_biUnion fun i hi => |
| 151 | (hA i hi).image (he k i).continuous).isClosed |
| 152 | have hbClosed : IsClosed (b k) := |
| 153 | (s.finite_toSet.isCompact_biUnion fun i hi => |
| 154 | (hB i hi).image (he k i).continuous).isClosed |
| 155 | rcases isPreconnected_iff_subset_of_disjoint_closed.mp (hconn k (e k i₀ p) R) |
| 156 | (a k) (b k) haClosed hbClosed hab |
| 157 | (by rw [hdisjk.inter_eq, inter_empty]) with ha | hb |
| 158 | · exact hqk (ha hqballk) |
| 159 | · exact hpk (hb (mem_ball_self hR)) |
| 160 | apply preconnectedSpace_iff_clopen.mpr |
| 161 | intro S hS |
| 162 | by_cases hp : O.include i₀ p ∈ S |
| 163 | · exact Or.inr (hfull S hS hp) |
| 164 | · left |
| 165 | have h := congrArg compl (hfull Sᶜ hS.compl hp) |
| 166 | simpa only [compl_compl, compl_univ] using h |
| 167 | |
| 168 | end PoincareMT.ChartDistance |