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 Mathlib.Topology.UniformSpace.LocallyUniformConvergence |
| 2 | import Mathlib.Topology.MetricSpace.Pseudo.Basic |
| 3 | import Mathlib.Topology.Order.OrderClosed |
| 4 | import Mathlib.Topology.Instances.Real.Lemmas |
| 5 | import Mathlib.Tactic.FunProp |
| 6 | import Mathlib.Tactic.Linarith |
| 7 | import Mathlib.Tactic.NormNum |
| 8 | import Mathlib.Tactic.Positivity |
| 9 | |
| 10 | /-! |
| 11 | # Preserving the selected sequence through terminal time |
| 12 | |
| 13 | Compact-uniform convergence at negative times and a uniform time-Lipschitz |
| 14 | bound near zero imply compact-uniform convergence through zero. The proof |
| 15 | uses the original sequence and a continuous limit, with no further extraction. |
| 16 | It applies separately to the terminal metric jets in Morgan--Tian, |
| 17 | Theorem 9.64, pp. 225/229. |
| 18 | -/ |
| 19 | |
| 20 | set_option autoImplicit false |
| 21 | |
| 22 | open Set Filter |
| 23 | open scoped Topology |
| 24 | |
| 25 | namespace PoincareMT.AncientCompactness |
| 26 | |
| 27 | variable {X Y : Type*} [TopologicalSpace X] [PseudoMetricSpace Y] |
| 28 | |
| 29 | /-- An eventual common time-Lipschitz bound passes from an interior pointwise |
| 30 | limit to its continuous values at both endpoints. -/ |
| 31 | theorem time_lipschitz_of_interior_tendsto |
| 32 | {f : ℕ → ℝ → Y} {g : ℝ → Y} {a b L : ℝ} (hab : a < b) |
| 33 | (hg : ContinuousOn g (Icc a b)) |
| 34 | (hconv : ∀ t ∈ Ioo a b, Tendsto (fun k => f k t) atTop (𝓝 (g t))) |
| 35 | (hL : ∀ᶠ k in atTop, ∀ s ∈ Icc a b, ∀ t ∈ Icc a b, |
| 36 | dist (f k s) (f k t) ≤ L * |s - t|) : |
| 37 | ∀ s ∈ Icc a b, ∀ t ∈ Icc a b, dist (g s) (g t) ≤ L * |s - t| := by |
| 38 | have hdist : ContinuousOn (fun p : ℝ × ℝ => dist (g p.1) (g p.2)) |
| 39 | (Icc a b ×ˢ Icc a b) := by |
| 40 | have hfst : ContinuousOn (fun p : ℝ × ℝ => g p.1) (Icc a b ×ˢ Icc a b) := |
| 41 | hg.comp continuousOn_fst (fun _ hp => hp.1) |
| 42 | have hsnd : ContinuousOn (fun p : ℝ × ℝ => g p.2) (Icc a b ×ˢ Icc a b) := |
| 43 | hg.comp continuousOn_snd (fun _ hp => hp.2) |
| 44 | exact fun p hp => Filter.Tendsto.dist (hfst p hp) (hsnd p hp) |
| 45 | intro s hs t ht |
| 46 | have hclosure : (s, t) ∈ closure (Ioo a b ×ˢ Ioo a b) := by |
| 47 | rw [closure_prod_eq, closure_Ioo hab.ne] |
| 48 | exact ⟨hs, ht⟩ |
| 49 | apply ContinuousWithinAt.closure_le hclosure |
| 50 | ((hdist (s, t) ⟨hs, ht⟩).mono (prod_mono Ioo_subset_Icc_self Ioo_subset_Icc_self)) |
| 51 | (show ContinuousWithinAt (fun p : ℝ × ℝ => L * |p.1 - p.2|) |
| 52 | (Ioo a b ×ˢ Ioo a b) (s, t) by fun_prop) |
| 53 | intro p hp |
| 54 | apply le_of_tendsto ((hconv p.1 hp.1).dist (hconv p.2 hp.2)) |
| 55 | exact hL.mono (fun k hk => hk p.1 ⟨hp.1.1.le, hp.1.2.le⟩ |
| 56 | p.2 ⟨hp.2.1.le, hp.2.2.le⟩) |
| 57 | |
| 58 | /-- Compact-uniform interior convergence extends through zero along the same |
| 59 | sequence. The time-Lipschitz constants and eventual thresholds may depend on |
| 60 | the compact spatial set; they are only needed on the last unit time interval. -/ |
| 61 | theorem tendstoUniformlyOn_past_of_time_lipschitz |
| 62 | {f : ℕ → ℝ × X → Y} {g : ℝ × X → Y} {U : Set X} |
| 63 | (hconv : ∀ K : Set (ℝ × X), IsCompact K → K ⊆ Iio 0 ×ˢ U → |
| 64 | TendstoUniformlyOn f g atTop K) |
| 65 | (hg : ∀ x ∈ U, ContinuousOn (fun t : ℝ => g (t, x)) (Icc (-1) 0)) |
| 66 | (htime : ∀ V : Set X, IsCompact V → V ⊆ U → |
| 67 | ∃ L : ℝ, 0 ≤ L ∧ ∀ᶠ k in atTop, |
| 68 | ∀ x ∈ V, ∀ s ∈ Icc (-1) 0, ∀ t ∈ Icc (-1) 0, |
| 69 | dist (f k (s, x)) (f k (t, x)) ≤ L * |s - t|) |
| 70 | {K : Set (ℝ × X)} (hK : IsCompact K) (hKU : K ⊆ Iic 0 ×ˢ U) : |
| 71 | TendstoUniformlyOn f g atTop K := by |
| 72 | let V : Set X := Prod.snd '' K |
| 73 | have hV : IsCompact V := hK.image continuous_snd |
| 74 | have hVU : V ⊆ U := by |
| 75 | rintro _ ⟨z, hz, rfl⟩ |
| 76 | exact (hKU hz).2 |
| 77 | obtain ⟨L, hL, hLip⟩ := htime V hV hVU |
| 78 | have hgLip (x : X) (hx : x ∈ V) : |
| 79 | ∀ s ∈ Icc (-1) 0, ∀ t ∈ Icc (-1) 0, |
| 80 | dist (g (s, x)) (g (t, x)) ≤ L * |s - t| := by |
| 81 | apply time_lipschitz_of_interior_tendsto (f := fun k t => f k (t, x)) |
| 82 | (by norm_num) (hg x (hVU hx)) |
| 83 | · intro t ht |
| 84 | exact (hconv {(t, x)} isCompact_singleton |
| 85 | (singleton_subset_iff.mpr ⟨ht.2, hVU hx⟩)).tendsto_at (mem_singleton _) |
| 86 | · exact hLip.mono (fun k hk => hk x hx) |
| 87 | rw [Metric.tendstoUniformlyOn_iff] |
| 88 | intro ε hε |
| 89 | let δ : ℝ := min (1 / 2) (ε / (4 * (L + 1))) |
| 90 | have hδ : 0 < δ := lt_min (by norm_num) (by positivity) |
| 91 | have hδone : δ ≤ 1 := (min_le_left _ _).trans (by norm_num) |
| 92 | have hδsmall : 2 * L * δ < ε / 2 := by |
| 93 | have hd := (le_div_iff₀ (by positivity : 0 < 4 * (L + 1))).mp |
| 94 | (show δ ≤ ε / (4 * (L + 1)) from min_le_right _ _) |
| 95 | nlinarith |
| 96 | let shift : ℝ × X → ℝ × X := fun z => (min z.1 (-δ), z.2) |
| 97 | have hshift : Continuous shift := (continuous_fst.min continuous_const).prodMk continuous_snd |
| 98 | have hshiftU : shift '' K ⊆ Iio 0 ×ˢ U := by |
| 99 | rintro _ ⟨z, hz, rfl⟩ |
| 100 | change min z.1 (-δ) < 0 ∧ z.2 ∈ U |
| 101 | exact ⟨lt_of_le_of_lt (min_le_right _ _) (by linarith), (hKU hz).2⟩ |
| 102 | have hshiftconv := (Metric.tendstoUniformlyOn_iff.mp |
| 103 | (hconv (shift '' K) (hK.image hshift) hshiftU)) (ε / 2) (by positivity) |
| 104 | filter_upwards [hLip, hshiftconv] with k hk hkc z hz |
| 105 | have hxV : z.2 ∈ V := mem_image_of_mem Prod.snd hz |
| 106 | have hnear_f : dist (f k z) (f k (shift z)) ≤ L * δ := by |
| 107 | by_cases hfar : z.1 ≤ -δ |
| 108 | · simp only [shift, min_eq_left hfar, Prod.mk.eta, dist_self] |
| 109 | positivity |
| 110 | · have ht : z.1 ∈ Icc (-1) 0 := ⟨by linarith, (hKU hz).1⟩ |
| 111 | have hs : -δ ∈ Icc (-1) 0 := ⟨by linarith, by linarith⟩ |
| 112 | have hdiff : |z.1 - -δ| ≤ δ := by |
| 113 | rw [abs_of_nonneg (by linarith)] |
| 114 | linarith [ht.2] |
| 115 | simpa only [shift, min_eq_right (le_of_not_ge hfar), Prod.mk.eta] using |
| 116 | (hk z.2 hxV z.1 ht (-δ) hs).trans (mul_le_mul_of_nonneg_left hdiff hL) |
| 117 | have hnear_g : dist (g (shift z)) (g z) ≤ L * δ := by |
| 118 | by_cases hfar : z.1 ≤ -δ |
| 119 | · simp only [shift, min_eq_left hfar, Prod.mk.eta, dist_self] |
| 120 | positivity |
| 121 | · have ht : z.1 ∈ Icc (-1) 0 := ⟨by linarith, (hKU hz).1⟩ |
| 122 | have hs : -δ ∈ Icc (-1) 0 := ⟨by linarith, by linarith⟩ |
| 123 | have hdiff : |z.1 - -δ| ≤ δ := by |
| 124 | rw [abs_of_nonneg (by linarith)] |
| 125 | linarith [ht.2] |
| 126 | simpa only [shift, min_eq_right (le_of_not_ge hfar), Prod.mk.eta, dist_comm] using |
| 127 | (hgLip z.2 hxV z.1 ht (-δ) hs).trans (mul_le_mul_of_nonneg_left hdiff hL) |
| 128 | have hinterior := hkc (shift z) (mem_image_of_mem shift hz) |
| 129 | have htriangle := dist_triangle (f k z) (f k (shift z)) (g z) |
| 130 | have htriangle' := dist_triangle (f k (shift z)) (g (shift z)) (g z) |
| 131 | rw [dist_comm] at hinterior ⊢ |
| 132 | linarith |
| 133 | |
| 134 | /-- Locally uniform interior convergence gives the same compact convergence |
| 135 | through zero under compact-local time-Lipschitz bounds. -/ |
| 136 | theorem tendstoUniformlyOn_past_of_locallyUniformlyOn |
| 137 | {f : ℕ → ℝ × X → Y} {g : ℝ × X → Y} {U : Set X} |
| 138 | (hconv : TendstoLocallyUniformlyOn f g atTop (Iio 0 ×ˢ U)) |
| 139 | (hg : ∀ x ∈ U, ContinuousOn (fun t : ℝ => g (t, x)) (Icc (-1) 0)) |
| 140 | (htime : ∀ V : Set X, IsCompact V → V ⊆ U → |
| 141 | ∃ L : ℝ, 0 ≤ L ∧ ∀ᶠ k in atTop, |
| 142 | ∀ x ∈ V, ∀ s ∈ Icc (-1) 0, ∀ t ∈ Icc (-1) 0, |
| 143 | dist (f k (s, x)) (f k (t, x)) ≤ L * |s - t|) |
| 144 | {K : Set (ℝ × X)} (hK : IsCompact K) (hKU : K ⊆ Iic 0 ×ˢ U) : |
| 145 | TendstoUniformlyOn f g atTop K := by |
| 146 | apply tendstoUniformlyOn_past_of_time_lipschitz (g := g) (U := U) _ hg htime hK hKU |
| 147 | intro C hC hCU |
| 148 | exact (tendstoLocallyUniformlyOn_iff_tendstoUniformlyOn_of_compact hC).mp (hconv.mono hCU) |
| 149 | |
| 150 | end PoincareMT.AncientCompactness |