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.Analysis.ODE.Gronwall |
| 2 | import Mathlib.Topology.UniformSpace.UniformConvergence |
| 3 | |
| 4 | /-! |
| 5 | # Uniform stability of confined ODE families |
| 6 | |
| 7 | The Gronwall estimate is uniform in the initial-data parameter. Uniform |
| 8 | vector-field and initial-data errors tending to zero therefore imply |
| 9 | uniform trajectory convergence on a fixed compact time interval. This |
| 10 | is used for the exponential adjustment in Morgan--Tian, Claim 16.6, |
| 11 | pp. 371-372; see `derivations/14-exponential-stability.md`. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped Topology NNReal |
| 18 | |
| 19 | /-- Confined trajectories of two vector fields stay uniformly close if |
| 20 | the limiting field is Lipschitz and the field difference is bounded. -/ |
| 21 | theorem dist_le_gronwall_of_vectorField_error |
| 22 | {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 23 | {F G : E → E} {U : Set E} {K : ℝ≥0} (hG : LipschitzOnWith K G U) |
| 24 | {γ η : ℝ → E} {T δ ε : ℝ} (hδ : 0 ≤ δ) (hε : 0 ≤ ε) |
| 25 | (hγ : ∀ t ∈ Icc (0 : ℝ) T, HasDerivAt γ (F (γ t)) t) |
| 26 | (hη : ∀ t ∈ Icc (0 : ℝ) T, HasDerivAt η (G (η t)) t) |
| 27 | (hγU : MapsTo γ (Icc (0 : ℝ) T) U) |
| 28 | (hηU : MapsTo η (Icc (0 : ℝ) T) U) |
| 29 | (herror : ∀ z ∈ U, dist (F z) (G z) ≤ ε) |
| 30 | (hinitial : dist (γ 0) (η 0) ≤ δ) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) T) : |
| 31 | dist (γ t) (η t) ≤ gronwallBound δ K ε T := by |
| 32 | have h := dist_le_of_approx_trajectories_ODE_of_mem |
| 33 | (v := fun _ => G) (s := fun _ => U) (εf := ε) (εg := 0) |
| 34 | (fun _ _ => hG) |
| 35 | (fun s hs => (hγ s hs).continuousAt.continuousWithinAt) |
| 36 | (fun s hs => (hγ s (Ico_subset_Icc_self hs)).hasDerivWithinAt) |
| 37 | (fun s hs => herror _ (hγU (Ico_subset_Icc_self hs))) |
| 38 | (fun _ hs => hγU (Ico_subset_Icc_self hs)) |
| 39 | (fun s hs => (hη s hs).continuousAt.continuousWithinAt) |
| 40 | (fun s hs => (hη s (Ico_subset_Icc_self hs)).hasDerivWithinAt) |
| 41 | (fun _ _ => by simp) |
| 42 | (fun _ hs => hηU (Ico_subset_Icc_self hs)) hinitial t ht |
| 43 | simp only [add_zero, sub_zero] at h |
| 44 | exact h.trans ((gronwallBound_mono hδ hε K.coe_nonneg) ht.2) |
| 45 | |
| 46 | /-- At fixed Lipschitz constant and time, vanishing initial and forcing |
| 47 | errors make the Gronwall bound tend to zero. -/ |
| 48 | theorem tendsto_gronwallBound_errors_zero |
| 49 | {ι : Type*} {l : Filter ι} {δ ε : ι → ℝ} {K T : ℝ} |
| 50 | (hδ : Tendsto δ l (𝓝 0)) (hε : Tendsto ε l (𝓝 0)) : |
| 51 | Tendsto (fun i => gronwallBound (δ i) K (ε i) T) l (𝓝 0) := by |
| 52 | by_cases hK : K = 0 |
| 53 | · simp only [hK, gronwallBound_K0] |
| 54 | simpa using hδ.add (hε.mul_const T) |
| 55 | · simp only [gronwallBound_of_K_ne_0 hK] |
| 56 | simpa using (hδ.mul_const (Real.exp (K * T))).add |
| 57 | ((hε.div_const K).mul_const (Real.exp (K * T) - 1)) |
| 58 | |
| 59 | /-- Convergence of vector fields and initial data is uniform over the |
| 60 | initial-data family and time, provided all trajectories stay in the |
| 61 | common Lipschitz region. -/ |
| 62 | theorem tendstoUniformlyOn_ode_of_vectorField_error |
| 63 | {E P ι : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 64 | {l : Filter ι} {F : ι → E → E} {G : E → E} {U : Set E} |
| 65 | {K : ℝ≥0} (hG : LipschitzOnWith K G U) |
| 66 | {γ : ι → P → ℝ → E} {η : P → ℝ → E} {V : Set P} {T : ℝ} |
| 67 | {δ ε : ι → ℝ} (hδpos : ∀ i, 0 ≤ δ i) (hεpos : ∀ i, 0 ≤ ε i) |
| 68 | (hδ : Tendsto δ l (𝓝 0)) (hε : Tendsto ε l (𝓝 0)) |
| 69 | (hγ : ∀ i p, p ∈ V → ∀ t ∈ Icc (0 : ℝ) T, |
| 70 | HasDerivAt (γ i p) (F i (γ i p t)) t) |
| 71 | (hη : ∀ p, p ∈ V → ∀ t ∈ Icc (0 : ℝ) T, |
| 72 | HasDerivAt (η p) (G (η p t)) t) |
| 73 | (hγU : ∀ i p, p ∈ V → MapsTo (γ i p) (Icc (0 : ℝ) T) U) |
| 74 | (hηU : ∀ p, p ∈ V → MapsTo (η p) (Icc (0 : ℝ) T) U) |
| 75 | (herror : ∀ i z, z ∈ U → dist (F i z) (G z) ≤ ε i) |
| 76 | (hinitial : ∀ i p, p ∈ V → dist (γ i p 0) (η p 0) ≤ δ i) : |
| 77 | TendstoUniformlyOn (fun i (z : P × ℝ) => γ i z.1 z.2) |
| 78 | (fun z => η z.1 z.2) l (V ×ˢ Icc (0 : ℝ) T) := by |
| 79 | rw [Metric.tendstoUniformlyOn_iff] |
| 80 | intro a ha |
| 81 | have hbound := tendsto_gronwallBound_errors_zero (K := (K : ℝ)) (T := T) hδ hε |
| 82 | filter_upwards [hbound.eventually (gt_mem_nhds ha)] with i hi |
| 83 | intro z hz |
| 84 | simpa only [dist_comm] using |
| 85 | (dist_le_gronwall_of_vectorField_error hG (hδpos i) (hεpos i) |
| 86 | (hγ i z.1 hz.1) (hη z.1 hz.1) (hγU i z.1 hz.1) (hηU z.1 hz.1) |
| 87 | (herror i) (hinitial i z.1 hz.1) hz.2).trans_lt hi |