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.ODE.ODEUniformStability |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Persistence.Analysis.Compactness.FirstExit |
| 3 | import Mathlib.Analysis.SpecificLimits.Basic |
| 4 | import Mathlib.Analysis.Calculus.MeanValue |
| 5 | import Mathlib.Analysis.Normed.Module.FiniteDimension |
| 6 | |
| 7 | /-! |
| 8 | # ODE stability from a buffer around the model trajectories |
| 9 | |
| 10 | A first-exit argument derives perturbed confinement from Gronwall and |
| 11 | a strict model buffer. Used for geodesic and variational stability in |
| 12 | Morgan--Tian, Claim 16.6, pp. 371-372; see |
| 13 | `derivations/16-geodesic-field-convergence.md`. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set Filter Metric |
| 19 | open scoped Topology NNReal ContDiff |
| 20 | |
| 21 | /-- A perturbation cannot leave a model's fixed ball buffer when its |
| 22 | Gronwall error at the final time is smaller than the buffer width. -/ |
| 23 | theorem ode_mapsTo_ball_and_dist_le_of_model_buffer |
| 24 | {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 25 | {F G : E → E} {K : ℝ≥0} {R r T delta epsilon : ℝ} |
| 26 | (hG : LipschitzOnWith K G (closedBall 0 R)) |
| 27 | (hdelta : 0 ≤ delta) (hepsilon : 0 ≤ epsilon) |
| 28 | {γ η : ℝ → E} |
| 29 | (hγ : ∀ t ∈ Icc (0 : ℝ) T, HasDerivAt γ (F (γ t)) t) |
| 30 | (hη : ∀ t ∈ Icc (0 : ℝ) T, HasDerivAt η (G (η t)) t) |
| 31 | (hηnorm : ∀ t ∈ Icc (0 : ℝ) T, ‖η t‖ ≤ r) |
| 32 | (hrR : r < R) (hstart : ‖γ 0‖ < R) |
| 33 | (herror : ∀ z ∈ closedBall 0 R, dist (F z) (G z) ≤ epsilon) |
| 34 | (hinitial : dist (γ 0) (η 0) ≤ delta) |
| 35 | (hmargin : r + gronwallBound delta K epsilon T < R) : |
| 36 | MapsTo γ (Icc (0 : ℝ) T) (ball 0 R) ∧ |
| 37 | ∀ t ∈ Icc (0 : ℝ) T, |
| 38 | dist (γ t) (η t) ≤ gronwallBound delta K epsilon T := by |
| 39 | have hηU : MapsTo η (Icc (0 : ℝ) T) (closedBall 0 R) := by |
| 40 | intro t ht |
| 41 | simpa only [mem_closedBall, dist_zero_right] using (hηnorm t ht).trans hrR.le |
| 42 | have hγU : MapsTo γ (Icc (0 : ℝ) T) (ball 0 R) := by |
| 43 | intro t ht |
| 44 | by_contra hout |
| 45 | have hsub : Icc (0 : ℝ) t ⊆ Icc (0 : ℝ) T := Icc_subset_Icc le_rfl ht.2 |
| 46 | have hcont : ContinuousOn γ (Icc (0 : ℝ) t) := |
| 47 | fun s hs => (hγ s (hsub hs)).continuousAt.continuousWithinAt |
| 48 | obtain ⟨c, hc, hfront, _, hprior⟩ := hcont.exists_first_frontier_time ht.1 isOpen_ball |
| 49 | (by simpa only [mem_ball, dist_zero_right] using hstart) hout |
| 50 | have hcT : c ∈ Icc (0 : ℝ) T := ⟨hc.1.le, hc.2.trans ht.2⟩ |
| 51 | have hsubc : Icc (0 : ℝ) c ⊆ Icc (0 : ℝ) T := Icc_subset_Icc le_rfl hcT.2 |
| 52 | have hprior' : MapsTo γ (Icc (0 : ℝ) c) (closedBall 0 R) := |
| 53 | fun s hs => closure_ball_subset_closedBall (hprior hs) |
| 54 | have hdist := dist_le_gronwall_of_vectorField_error hG hdelta hepsilon |
| 55 | (fun s hs => hγ s (hsubc hs)) (fun s hs => hη s (hsubc hs)) |
| 56 | hprior' (fun s hs => hηU (hsubc hs)) herror hinitial |
| 57 | (show c ∈ Icc (0 : ℝ) c from ⟨hc.1.le, le_rfl⟩) |
| 58 | have hdistT := hdist.trans ((gronwallBound_mono hdelta hepsilon K.coe_nonneg) hcT.2) |
| 59 | have hnorm : ‖γ c‖ < R := by |
| 60 | have htri : ‖γ c‖ ≤ dist (γ c) (η c) + ‖η c‖ := by |
| 61 | simpa only [dist_eq_norm] using norm_le_norm_sub_add (γ c) (η c) |
| 62 | linarith [hηnorm c hcT] |
| 63 | have hnot : γ c ∉ ball 0 R := by |
| 64 | rw [frontier, isOpen_ball.interior_eq] at hfront |
| 65 | exact hfront.2 |
| 66 | exact hnot (by simpa only [mem_ball, dist_zero_right] using hnorm) |
| 67 | refine ⟨hγU, ?_⟩ |
| 68 | intro t ht |
| 69 | exact dist_le_gronwall_of_vectorField_error hG hdelta hepsilon hγ hη |
| 70 | (fun s hs => ball_subset_closedBall (hγU hs)) hηU herror hinitial ht |
| 71 | |
| 72 | /-- Uniformly converging vector fields and initial conditions give |
| 73 | uniformly converging trajectories if the model has a fixed ball buffer. |
| 74 | The perturbations' confinement is derived by first exit. -/ |
| 75 | theorem tendstoUniformlyOn_ode_of_model_buffer |
| 76 | {E P ι : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 77 | {l : Filter ι} {F : ι → E → E} {G : E → E} {K : ℝ≥0} {R r T : ℝ} |
| 78 | (hT : 0 ≤ T) (hrR : r < R) (hG : LipschitzOnWith K G (closedBall 0 R)) |
| 79 | {γ : ι → P → ℝ → E} {η : P → ℝ → E} {V : Set P} |
| 80 | (hγ : ∀ᶠ i in l, ∀ p ∈ V, ∀ t ∈ Icc (0 : ℝ) T, |
| 81 | HasDerivAt (γ i p) (F i (γ i p t)) t) |
| 82 | (hη : ∀ p ∈ V, ∀ t ∈ Icc (0 : ℝ) T, |
| 83 | HasDerivAt (η p) (G (η p t)) t) |
| 84 | (hηnorm : ∀ p ∈ V, ∀ t ∈ Icc (0 : ℝ) T, ‖η p t‖ ≤ r) |
| 85 | (hfield : TendstoUniformlyOn F G l (closedBall 0 R)) |
| 86 | (hinitial : TendstoUniformlyOn (fun i p => γ i p 0) (fun p => η p 0) l V) : |
| 87 | TendstoUniformlyOn (fun i (z : P × ℝ) => γ i z.1 z.2) |
| 88 | (fun z => η z.1 z.2) l (V ×ˢ Icc (0 : ℝ) T) := by |
| 89 | rw [Metric.tendstoUniformlyOn_iff] |
| 90 | intro epsilon hepsilon |
| 91 | let d (n : ℕ) : ℝ := 1 / ((n : ℝ) + 1) |
| 92 | have hd : Tendsto d atTop (𝓝 0) := tendsto_one_div_add_atTop_nhds_zero_nat |
| 93 | have hb := tendsto_gronwallBound_errors_zero (K := (K : ℝ)) (T := T) hd hd |
| 94 | obtain ⟨n, hn, hn'⟩ := ((hb.eventually (gt_mem_nhds |
| 95 | (lt_min hepsilon (sub_pos.mpr hrR)))).and |
| 96 | (hd.eventually (gt_mem_nhds (sub_pos.mpr hrR)))).exists |
| 97 | have hdpos : 0 < d n := by dsimp [d]; positivity |
| 98 | have hnε : gronwallBound (d n) K (d n) T < epsilon := hn.trans_le (min_le_left _ _) |
| 99 | have hnR : r + gronwallBound (d n) K (d n) T < R := by |
| 100 | have h := hn.trans_le (min_le_right _ _) |
| 101 | linarith |
| 102 | filter_upwards [hγ, Metric.tendstoUniformlyOn_iff.mp hfield (d n) hdpos, |
| 103 | Metric.tendstoUniformlyOn_iff.mp hinitial (d n) hdpos] with i hi hif hii |
| 104 | intro z hz |
| 105 | have hin : dist (γ i z.1 0) (η z.1 0) ≤ d n := by |
| 106 | simpa only [dist_comm] using (hii z.1 hz.1).le |
| 107 | have hstart : ‖γ i z.1 0‖ < R := by |
| 108 | have htri : ‖γ i z.1 0‖ ≤ dist (γ i z.1 0) (η z.1 0) + ‖η z.1 0‖ := by |
| 109 | simpa only [dist_eq_norm] using norm_le_norm_sub_add (γ i z.1 0) (η z.1 0) |
| 110 | have hm := hηnorm z.1 hz.1 0 ⟨le_rfl, hT⟩ |
| 111 | linarith |
| 112 | have h := ode_mapsTo_ball_and_dist_le_of_model_buffer hG hdpos.le hdpos.le |
| 113 | (hi z.1 hz.1) (hη z.1 hz.1) (hηnorm z.1 hz.1) hrR hstart |
| 114 | (fun y hy => by simpa only [dist_comm] using (hif y hy).le) hin hnR |
| 115 | simpa only [dist_comm] using (h.2 z.2 hz.2).trans_lt hnε |
| 116 | |
| 117 | /-- Compact model families supply the buffer and Lipschitz constant |
| 118 | for uniform ODE stability. Approximate confinement is a conclusion of |
| 119 | the first-exit argument, so it is not an additional hypothesis. -/ |
| 120 | theorem tendstoUniformlyOn_ode_of_compact_model |
| 121 | {E P ι : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 122 | [FiniteDimensional ℝ E] [TopologicalSpace P] |
| 123 | {l : Filter ι} {F : ι → E → E} {G : E → E} {T : ℝ} |
| 124 | (hT : 0 ≤ T) (hG : ContDiff ℝ 1 G) |
| 125 | {γ : ι → P → ℝ → E} {η : P → ℝ → E} {K : Set P} |
| 126 | (hK : IsCompact K) |
| 127 | (hηcont : ContinuousOn (fun z : P × ℝ => η z.1 z.2) (K ×ˢ Icc (0 : ℝ) T)) |
| 128 | (hγ : ∀ᶠ i in l, ∀ p ∈ K, ∀ t ∈ Icc (0 : ℝ) T, |
| 129 | HasDerivAt (γ i p) (F i (γ i p t)) t) |
| 130 | (hη : ∀ p ∈ K, ∀ t ∈ Icc (0 : ℝ) T, |
| 131 | HasDerivAt (η p) (G (η p t)) t) |
| 132 | (hfield : ∀ R : ℝ, TendstoUniformlyOn F G l (closedBall 0 R)) |
| 133 | (hinitial : TendstoUniformlyOn (fun i p => γ i p 0) (fun p => η p 0) l K) : |
| 134 | TendstoUniformlyOn (fun i (z : P × ℝ) => γ i z.1 z.2) |
| 135 | (fun z => η z.1 z.2) l (K ×ˢ Icc (0 : ℝ) T) := by |
| 136 | obtain ⟨r, hr⟩ := (hK.prod isCompact_Icc).exists_bound_of_continuousOn hηcont |
| 137 | obtain ⟨C, hC⟩ := (isCompact_closedBall (0 : E) (r + 1)).exists_bound_of_continuousOn |
| 138 | ((hG.fderiv_right (m := 0) (by simp)).continuous.continuousOn) |
| 139 | have hLip : LipschitzOnWith ⟨max C 0, le_max_right _ _⟩ G (closedBall 0 (r + 1)) := by |
| 140 | apply Convex.lipschitzOnWith_of_nnnorm_fderiv_le |
| 141 | (fun x _ => hG.differentiable one_ne_zero x) ?_ (convex_closedBall _ _) |
| 142 | intro x hx |
| 143 | exact (hC x hx).trans (le_max_left _ _) |
| 144 | exact tendstoUniformlyOn_ode_of_model_buffer hT (lt_add_one r) hLip hγ hη |
| 145 | (fun p hp t ht => hr (p, t) ⟨hp, ht⟩) (hfield (r + 1)) hinitial |