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.Existence.Analysis.Basic.ClosedIntervalDerivativeBounds |
| 2 | import Mathlib.Topology.UniformSpace.Cauchy |
| 3 | |
| 4 | /-! |
| 5 | # Terminal limits from uniform time-derivative bounds |
| 6 | |
| 7 | The mean-value estimate on each closed subinterval gives a Lipschitz |
| 8 | curve on the half-open interval. Completeness supplies its full left |
| 9 | limit, with the same quantitative estimate. Uniform bounds over a |
| 10 | spatial set give uniform convergence there. This is the terminal-limit |
| 11 | calculus for Morgan-Tian Theorem 12.5, pp. 296-297. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped Topology NNReal |
| 18 | |
| 19 | /-- An interior derivative bound and continuity at the initial endpoint |
| 20 | give a Lipschitz curve on a half-open interval (Theorem 12.5, pp. 296-297). -/ |
| 21 | theorem lipschitzOnWith_of_interior_deriv_bound_Ico |
| 22 | {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 23 | {f : ℝ → E} {a b C : ℝ} (hC : 0 ≤ C) |
| 24 | (hf : ContinuousOn f (Ico a b)) |
| 25 | (hd : ∀ t ∈ Ioo a b, DifferentiableAt ℝ f t) |
| 26 | (hb : ∀ t ∈ Ioo a b, ‖deriv f t‖ ≤ C) : |
| 27 | LipschitzOnWith ⟨C, hC⟩ f (Ico a b) := by |
| 28 | apply LipschitzOnWith.of_dist_le_mul |
| 29 | intro s hs t ht |
| 30 | let u := (max s t + b) / 2 |
| 31 | have hsu : s ≤ u := by dsimp [u]; linarith [le_max_left s t, max_lt hs.2 ht.2] |
| 32 | have htu : t ≤ u := by dsimp [u]; linarith [le_max_right s t, max_lt hs.2 ht.2] |
| 33 | have hub : u < b := by dsimp [u]; linarith [max_lt hs.2 ht.2] |
| 34 | have hau : a < u := by |
| 35 | dsimp [u] |
| 36 | linarith [hs.1, le_max_left s t, max_lt hs.2 ht.2] |
| 37 | have hsub : Icc a u ⊆ Ico a b := fun _ hv => ⟨hv.1, hv.2.trans_lt hub⟩ |
| 38 | have hsub' : Ioo a u ⊆ Ioo a b := fun _ hv => ⟨hv.1, hv.2.trans hub⟩ |
| 39 | change dist (f s) (f t) ≤ C * dist s t |
| 40 | simpa only [dist_eq_norm, Real.norm_eq_abs] using |
| 41 | norm_sub_le_of_interior_deriv_bound_Icc hau hC (hf.mono hsub) |
| 42 | (fun v hv => hd v (hsub' hv)) (fun v hv => hb v (hsub' hv)) |
| 43 | ⟨ht.1, htu⟩ ⟨hs.1, hsu⟩ |
| 44 | |
| 45 | /-- A Banach-valued Lipschitz curve has a full terminal left limit with |
| 46 | the original Lipschitz modulus (Theorem 12.5, pp. 296-297). -/ |
| 47 | theorem LipschitzOnWith.exists_terminal_limit |
| 48 | {E : Type*} [NormedAddCommGroup E] [CompleteSpace E] |
| 49 | {f : ℝ → E} {a b : ℝ} {C : ℝ≥0} (hab : a < b) |
| 50 | (hf : LipschitzOnWith C f (Ico a b)) : |
| 51 | ∃ z : E, Tendsto f (𝓝[<] b) (𝓝 z) ∧ |
| 52 | ∀ t ∈ Ico a b, ‖f t - z‖ ≤ C * (b - t) := by |
| 53 | have hc : Cauchy (𝓝[<] b) := cauchy_nhds.mono nhdsWithin_le_nhds |
| 54 | obtain ⟨z, hz⟩ := cauchy_map_iff_exists_tendsto.mp |
| 55 | (hc.map_of_le hf.uniformContinuousOn (le_principal_iff.mpr (Ico_mem_nhdsLT hab))) |
| 56 | refine ⟨z, hz, ?_⟩ |
| 57 | intro t ht |
| 58 | have hl : Tendsto (fun s => ‖f t - f s‖) (𝓝[<] b) (𝓝 ‖f t - z‖) := |
| 59 | (tendsto_const_nhds.sub hz).norm |
| 60 | have hr : Tendsto (fun s : ℝ => (C : ℝ) * |t - s|) |
| 61 | (𝓝[<] b) (𝓝 ((C : ℝ) * |t - b|)) := |
| 62 | tendsto_const_nhds.mul |
| 63 | (tendsto_const_nhds.sub (tendsto_id.mono_left nhdsWithin_le_nhds)).abs |
| 64 | have h := le_of_tendsto_of_tendsto hl hr (show ∀ᶠ s in 𝓝[<] b, |
| 65 | ‖f t - f s‖ ≤ (C : ℝ) * |t - s| from by |
| 66 | filter_upwards [Ico_mem_nhdsLT hab] with s hs |
| 67 | simpa only [dist_eq_norm, Real.norm_eq_abs] using hf.dist_le_mul t ht s hs) |
| 68 | simpa only [abs_of_neg (sub_neg.mpr ht.2), neg_sub] using h |
| 69 | |
| 70 | /-- A spatially uniform terminal modulus gives convergence uniformly on |
| 71 | that spatial set (Theorem 12.5, pp. 296-297). -/ |
| 72 | theorem tendstoUniformlyOn_of_terminal_norm_bound |
| 73 | {X E : Type*} [NormedAddCommGroup E] |
| 74 | {f : ℝ → X → E} {g : X → E} {a b C : ℝ} {K : Set X} |
| 75 | (hab : a < b) |
| 76 | (hbound : ∀ t ∈ Ico a b, ∀ x ∈ K, ‖f t x - g x‖ ≤ C * (b - t)) : |
| 77 | TendstoUniformlyOn f g (𝓝[<] b) K := by |
| 78 | have hsmall : Tendsto (fun t : ℝ => C * (b - t)) (𝓝[<] b) (𝓝 0) := by |
| 79 | have hc : ContinuousAt (fun t : ℝ => C * (b - t)) b := by fun_prop |
| 80 | simpa only [sub_self, mul_zero] using hc.tendsto.mono_left nhdsWithin_le_nhds |
| 81 | apply Metric.tendstoUniformlyOn_iff.mpr |
| 82 | intro ε hε |
| 83 | filter_upwards [Ico_mem_nhdsLT hab, hsmall.eventually (gt_mem_nhds hε)] with t ht hεt |
| 84 | intro x hx |
| 85 | rw [dist_comm, dist_eq_norm] |
| 86 | exact (hbound t ht x hx).trans_lt hεt |