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.Transition |
| 2 | |
| 3 | /-! |
| 4 | # Source transitions on the limiting overlap |
| 5 | |
| 6 | Near a zero-distance pair, the original coordinate inverses are eventually |
| 7 | defined on one fixed neighborhood and stay in a compact coordinate set. |
| 8 | Their values converge to the transition constructed from the distance limit. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | open Set Filter Metric |
| 13 | open scoped Topology NNReal |
| 14 | |
| 15 | namespace PoincareMT.ChartDistance |
| 16 | |
| 17 | variable {ι : Type*} {X : ι → Type*} [∀ i, MetricSpace (X i)] |
| 18 | [∀ i, LocallyCompactSpace (X i)] [∀ i, Nonempty (X i)] |
| 19 | {M : ℕ → Type*} [∀ k, MetricSpace (M k)] |
| 20 | {e : ∀ k i, X i → M k} {D : ∀ i j, X i × X j → ℝ} |
| 21 | (hD : ∀ i j x y, Tendsto (fun k => dist (e k i x) (e k j y)) atTop |
| 22 | (𝓝 (D i j (x, y)))) |
| 23 | (L : ι → ℝ≥0) (he : ∀ k i, LipschitzWith (L i) (e k i)) |
| 24 | (c : ι → ℝ) (hc : ∀ i, 0 < c i) |
| 25 | (hlower : ∀ k i x y, c i * dist x y ≤ dist (e k i x) (e k i y)) |
| 26 | (hopen : ∀ k i, Topology.IsOpenEmbedding (e k i)) |
| 27 | (hconn : ∀ k (p : M k) r, IsPreconnected (ball p r)) |
| 28 | |
| 29 | include hD he hc hlower hopen hconn in |
| 30 | theorem exists_source_transition_neighborhood {i j : ι} {x : X i} |
| 31 | (hx : x ∈ overlap D i j) : |
| 32 | ∃ U : Set (X i), IsOpen U ∧ x ∈ U ∧ ∃ K : Set (X j), IsCompact K ∧ |
| 33 | ∀ᶠ k in atTop, ∀ x' ∈ U, |
| 34 | e k i x' ∈ e k j '' K ∧ Function.invFun (e k j) (e k i x') ∈ K := by |
| 35 | classical |
| 36 | obtain ⟨y, hxy⟩ := hx |
| 37 | obtain ⟨r, hr, hK⟩ := exists_isCompact_closedBall y |
| 38 | let δ : ℝ := (c j * r / 2) / ((L i : ℝ) + 1) |
| 39 | have hδ : 0 < δ := div_pos (half_pos (mul_pos (hc j) hr)) (by positivity) |
| 40 | refine ⟨ball x δ, isOpen_ball, mem_ball_self hδ, closedBall y r, hK, ?_⟩ |
| 41 | have hnear : ∀ᶠ k in atTop, dist (e k i x) (e k j y) < c j * r / 2 := by |
| 42 | have hlim := hD i j x y |
| 43 | rw [hxy] at hlim |
| 44 | exact hlim.eventually (gt_mem_nhds (half_pos (mul_pos (hc j) hr))) |
| 45 | filter_upwards [hnear] with k hk x' hx' |
| 46 | have hdist : dist (e k i x') (e k j y) < c j * r := by |
| 47 | have hnear' : ((L i : ℝ) + 1) * dist x' x < c j * r / 2 := by |
| 48 | have := (lt_div_iff₀ (by positivity : 0 < (L i : ℝ) + 1)).mp hx' |
| 49 | simpa only [mul_comm] using this |
| 50 | have htri := dist_triangle (e k i x') (e k i x) (e k j y) |
| 51 | have hupper := (he k i).dist_le_mul x' x |
| 52 | nlinarith [dist_nonneg (x := x') (y := x)] |
| 53 | have himage : e k i x' ∈ e k j '' closedBall y r := |
| 54 | image_mono ball_subset_closedBall |
| 55 | (ball_subset_image_of_lower_bound (hopen k j) hr hK |
| 56 | (fun z => hlower k j z y) (hconn k _ _) (hc j) hdist) |
| 57 | refine ⟨himage, ?_⟩ |
| 58 | obtain ⟨z, hz, heq⟩ := himage |
| 59 | rw [← heq, Function.leftInverse_invFun (hopen k j).injective] |
| 60 | exact hz |
| 61 | |
| 62 | include hD he hc hlower hopen hconn in |
| 63 | theorem exists_compact_source_transition_target {i j : ι} {C : Set (X i)} |
| 64 | (hC : IsCompact C) (hCoverlap : C ⊆ overlap D i j) : |
| 65 | ∃ K : Set (X j), IsCompact K ∧ ∀ᶠ k in atTop, ∀ x ∈ C, |
| 66 | e k i x ∈ e k j '' K ∧ Function.invFun (e k j) (e k i x) ∈ K := by |
| 67 | refine hC.induction_on (p := fun S => ∃ K : Set (X j), IsCompact K ∧ |
| 68 | ∀ᶠ k in atTop, ∀ x ∈ S, |
| 69 | e k i x ∈ e k j '' K ∧ Function.invFun (e k j) (e k i x) ∈ K) ?_ ?_ ?_ ?_ |
| 70 | · exact ⟨∅, isCompact_empty, Eventually.of_forall (by simp)⟩ |
| 71 | · intro S T hST hT |
| 72 | obtain ⟨K, hK, hrep⟩ := hT |
| 73 | exact ⟨K, hK, hrep.mono fun k hk x hx => hk x (hST hx)⟩ |
| 74 | · intro S T hS hT |
| 75 | obtain ⟨K, hK, hrepK⟩ := hS |
| 76 | obtain ⟨K', hK', hrepK'⟩ := hT |
| 77 | refine ⟨K ∪ K', hK.union hK', ?_⟩ |
| 78 | filter_upwards [hrepK, hrepK'] with k hk hk' x hx |
| 79 | rcases hx with hx | hx |
| 80 | · exact ⟨image_mono subset_union_left (hk x hx).1, |
| 81 | Or.inl (hk x hx).2⟩ |
| 82 | · exact ⟨image_mono subset_union_right (hk' x hx).1, |
| 83 | Or.inr (hk' x hx).2⟩ |
| 84 | · intro x hx |
| 85 | obtain ⟨U, hU, hxU, K, hK, hrep⟩ := |
| 86 | exists_source_transition_neighborhood hD L he c hc hlower hopen hconn (hCoverlap hx) |
| 87 | exact ⟨U, mem_nhdsWithin_of_mem_nhds (hU.mem_nhds hxU), K, hK, hrep⟩ |
| 88 | |
| 89 | include hD he hc hlower hopen hconn in |
| 90 | theorem tendsto_source_transition {i j : ι} {x : X i} |
| 91 | (hx : x ∈ overlap D i j) : |
| 92 | Tendsto (fun k => Function.invFun (e k j) (e k i x)) atTop |
| 93 | (𝓝 (transition D i j x)) := by |
| 94 | obtain ⟨U, _, hxU, K, _, hK⟩ := |
| 95 | exists_source_transition_neighborhood hD L he c hc hlower hopen hconn hx |
| 96 | have hlim := hD i j x (transition D i j x) |
| 97 | rw [transition_zero D hx] at hlim |
| 98 | apply tendsto_iff_dist_tendsto_zero.mpr |
| 99 | apply squeeze_zero' (Eventually.of_forall fun _ => dist_nonneg) _ |
| 100 | (show Tendsto (fun k => dist (e k i x) (e k j (transition D i j x)) / c j) |
| 101 | atTop (𝓝 0) from by simpa using hlim.div_const (c j)) |
| 102 | filter_upwards [hK] with k hk |
| 103 | have himage : e k i x ∈ range (e k j) := image_subset_range _ _ (hk x hxU).1 |
| 104 | have h := hlower k j (Function.invFun (e k j) (e k i x)) (transition D i j x) |
| 105 | rw [Function.invFun_eq himage] at h |
| 106 | exact (le_div_iff₀ (hc j)).2 (by simpa only [mul_comm] using h) |
| 107 | |
| 108 | include hD he hc hlower hopen hconn in |
| 109 | theorem tendstoLocallyUniformlyOn_source_transition |
| 110 | (hlocal : ∀ i j, TendstoLocallyUniformly |
| 111 | (fun k (p : X i × X j) => dist (e k i p.1) (e k j p.2)) (D i j) atTop) |
| 112 | (i j : ι) : |
| 113 | TendstoLocallyUniformlyOn (fun k x => Function.invFun (e k j) (e k i x)) |
| 114 | (transition D i j) atTop (overlap D i j) := by |
| 115 | have hgraph := (hlocal i j).tendstoLocallyUniformlyOn.comp |
| 116 | (fun x => (x, transition D i j x)) (mapsTo_univ _ _) |
| 117 | (continuousOn_id.prodMk (lipschitzOn_transition hD L he c hc hlower i j).continuousOn) |
| 118 | apply Metric.tendstoLocallyUniformlyOn_iff.mpr |
| 119 | intro ε hε x hx |
| 120 | obtain ⟨U, hU, hxU, K, _, hK⟩ := |
| 121 | exists_source_transition_neighborhood hD L he c hc hlower hopen hconn hx |
| 122 | obtain ⟨V, hV, hconv⟩ := Metric.tendstoLocallyUniformlyOn_iff.mp hgraph |
| 123 | (c j * ε) (mul_pos (hc j) hε) x hx |
| 124 | refine ⟨V ∩ U ∩ overlap D i j, |
| 125 | inter_mem (inter_mem hV (mem_nhdsWithin_of_mem_nhds (hU.mem_nhds hxU))) |
| 126 | self_mem_nhdsWithin, ?_⟩ |
| 127 | filter_upwards [hconv, hK] with k hk hrep z hz |
| 128 | have hrange : e k i z ∈ range (e k j) := image_subset_range _ _ (hrep z hz.1.2).1 |
| 129 | have hbound := hlower k j (transition D i j z) (Function.invFun (e k j) (e k i z)) |
| 130 | rw [Function.invFun_eq hrange, dist_comm (e k j _)] at hbound |
| 131 | have hsmall := hk z hz.1.1 |
| 132 | change dist (D i j (z, transition D i j z)) |
| 133 | (dist (e k i z) (e k j (transition D i j z))) < c j * ε at hsmall |
| 134 | rw [transition_zero D hz.2, Real.dist_eq, zero_sub, abs_neg, |
| 135 | abs_of_nonneg dist_nonneg] at hsmall |
| 136 | exact (mul_lt_mul_iff_right₀ (hc j)).mp (hbound.trans_lt hsmall) |
| 137 | |
| 138 | end PoincareMT.ChartDistance |