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.Surgery.StandardCap.Persistence.Analysis.Compactness.CompactTimeModulus |
| 2 | import Mathlib.Topology.UniformSpace.UniformConvergence |
| 3 | import Mathlib.Tactic.Linarith |
| 4 | import Mathlib.Tactic.Positivity |
| 5 | |
| 6 | /-! |
| 7 | # Uniform comparison up to moving time endpoints |
| 8 | |
| 9 | Compact initial convergence and a common time modulus give uniform |
| 10 | comparison on the entire moving half-open interval, including when |
| 11 | its endpoint tends to birth. Morgan--Tian, Corollary 16.9, p. 373; |
| 12 | M44 derivation 94. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set Filter |
| 18 | open scoped Topology |
| 19 | |
| 20 | namespace Poincare |
| 21 | |
| 22 | /-- Interior and birth convergence extend to moving half-open |
| 23 | time intervals under a common actual time modulus. Source: |
| 24 | Corollary 16.9, p. 373; M44 derivation 94. -/ |
| 25 | theorem uniformly_close_on_moving_initial_intervals |
| 26 | {X Y : Type*} [PseudoMetricSpace X] [PseudoMetricSpace Y] |
| 27 | {K : Set X} (hK : IsCompact K) {H c L : ℝ} |
| 28 | (hc : 0 ≤ c) (hcH : c ≤ H) (hL : 0 ≤ L) |
| 29 | {endpoints : ℕ → ℝ} (hend : Tendsto endpoints atTop (𝓝 c)) |
| 30 | (hendH : ∀ n, endpoints n ≤ H) |
| 31 | {f : ℕ → ℝ × X → Y} {g : ℝ × X → Y} |
| 32 | (hg : ContinuousOn g (Icc (0 : ℝ) H ×ˢ K)) |
| 33 | (hbirth : TendstoUniformlyOn (fun n x => f n (0, x)) (fun x => g (0, x)) atTop K) |
| 34 | (hinterior : ∀ b : ℝ, 0 ≤ b → b < c → |
| 35 | TendstoUniformlyOn f g atTop (Icc (0 : ℝ) b ×ˢ K)) |
| 36 | (hmod : ∀ᶠ n in atTop, ∀ s ∈ Ico (0 : ℝ) (endpoints n), |
| 37 | ∀ t ∈ Ico (0 : ℝ) (endpoints n), ∀ x ∈ K, |
| 38 | dist (f n (t, x)) (f n (s, x)) ≤ L * |t - s|) : |
| 39 | ∀ epsilon : ℝ, 0 < epsilon → ∀ᶠ n in atTop, |
| 40 | ∀ t ∈ Ico (0 : ℝ) (endpoints n), ∀ x ∈ K, |
| 41 | dist (f n (t, x)) (g (t, x)) < epsilon := by |
| 42 | intro epsilon hepsilon |
| 43 | have heps3 : 0 < epsilon / 3 := by positivity |
| 44 | obtain ⟨delta, hdelta, hmodel⟩ := hg.exists_uniform_time_delta isCompact_Icc hK heps3 |
| 45 | let h := min (delta / 4) (epsilon / (6 * (L + 1))) |
| 46 | have hden : 0 < 6 * (L + 1) := by positivity |
| 47 | have hh : 0 < h := lt_min (by positivity) (div_pos hepsilon hden) |
| 48 | have hhd : 2 * h < delta := by |
| 49 | have hd : h ≤ delta / 4 := min_le_left _ _ |
| 50 | linarith only [hd, hdelta] |
| 51 | have hLh : L * (2 * h) ≤ epsilon / 3 := by |
| 52 | have he : h * (6 * (L + 1)) ≤ epsilon := |
| 53 | (le_div_iff₀ hden).mp (min_le_right _ _) |
| 54 | nlinarith only [he, hh] |
| 55 | let b := max 0 (c - h) |
| 56 | have hb : 0 ≤ b := le_max_left _ _ |
| 57 | have hbc : b ≤ c := max_le hc (sub_le_self c hh.le) |
| 58 | have hgap : c - b ≤ h := by |
| 59 | have hcb : c - h ≤ b := le_max_right _ _ |
| 60 | linarith only [hcb] |
| 61 | have hfixed : ∀ᶠ n in atTop, ∀ t ∈ Icc (0 : ℝ) b, ∀ x ∈ K, |
| 62 | dist (f n (t, x)) (g (t, x)) < epsilon / 3 := by |
| 63 | by_cases hc0 : c = 0 |
| 64 | · have hb0 : b = 0 := le_antisymm (hbc.trans_eq hc0) hb |
| 65 | filter_upwards [Metric.tendstoUniformlyOn_iff.mp hbirth (epsilon / 3) heps3] |
| 66 | with n hn |
| 67 | intro t ht x hx |
| 68 | have ht0 : t = 0 := le_antisymm (ht.2.trans_eq hb0) ht.1 |
| 69 | subst t |
| 70 | simpa only [dist_comm] using hn x hx |
| 71 | · have hbc' : b < c := max_lt (lt_of_le_of_ne hc (Ne.symm hc0)) (sub_lt_self c hh) |
| 72 | filter_upwards [Metric.tendstoUniformlyOn_iff.mp (hinterior b hb hbc') |
| 73 | (epsilon / 3) heps3] with n hn |
| 74 | intro t ht x hx |
| 75 | simpa only [dist_comm] using hn (t, x) ⟨ht, hx⟩ |
| 76 | have hupper : ∀ᶠ n in atTop, endpoints n < c + h := |
| 77 | hend.eventually (gt_mem_nhds (lt_add_of_pos_right c hh)) |
| 78 | filter_upwards [hmod, hfixed, hupper] with n hmodn hfixedn huppern |
| 79 | intro t ht x hx |
| 80 | by_cases htb : t ≤ b |
| 81 | · exact (hfixedn t ⟨ht.1, htb⟩ x hx).trans (by linarith) |
| 82 | · have hbt : b < t := lt_of_not_ge htb |
| 83 | have htime : t - b < 2 * h := by linarith only [ht.2, huppern, hgap] |
| 84 | have hbI : b ∈ Ico (0 : ℝ) (endpoints n) := ⟨hb, hbt.trans ht.2⟩ |
| 85 | have hactual : dist (f n (t, x)) (f n (b, x)) ≤ epsilon / 3 := by |
| 86 | have h := hmodn b hbI t ht x hx |
| 87 | rw [abs_of_nonneg (sub_nonneg.mpr hbt.le)] at h |
| 88 | exact h.trans ((mul_le_mul_of_nonneg_left htime.le hL).trans hLh) |
| 89 | have hstandard : dist (g (b, x)) (g (t, x)) < epsilon / 3 := by |
| 90 | apply hmodel b ⟨hb, hbc.trans hcH⟩ t ⟨ht.1, ht.2.le.trans (hendH n)⟩ _ x hx |
| 91 | rw [abs_of_neg (sub_neg.mpr hbt)] |
| 92 | linarith only [htime, hhd] |
| 93 | have hmiddle := hfixedn b ⟨hb, le_rfl⟩ x hx |
| 94 | calc |
| 95 | _ ≤ dist (f n (t, x)) (f n (b, x)) + dist (f n (b, x)) (g (t, x)) := |
| 96 | dist_triangle _ _ _ |
| 97 | _ ≤ dist (f n (t, x)) (f n (b, x)) + |
| 98 | (dist (f n (b, x)) (g (b, x)) + dist (g (b, x)) (g (t, x))) := |
| 99 | add_le_add_right (dist_triangle _ _ _) _ |
| 100 | _ < epsilon := by linarith only [hactual, hmiddle, hstandard] |
| 101 | |
| 102 | end Poincare |