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.Analysis.ODE.BoundedSpeed |
| 2 | import PoincareLib.Analysis.ODE.LocalFlow.Continuation |
| 3 | |
| 4 | /-! |
| 5 | # Smooth flows from a speed bound |
| 6 | |
| 7 | The bounded-speed confinement estimate supplies a reference orbit. Local |
| 8 | existence at its endpoints and smooth dependence along a compact interval |
| 9 | produce a jointly smooth flow around that orbit. |
| 10 | -/ |
| 11 | |
| 12 | noncomputable section |
| 13 | |
| 14 | namespace Poincare.ODE |
| 15 | |
| 16 | open Set Metric |
| 17 | open scoped ContDiff Topology |
| 18 | |
| 19 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 20 | [FiniteDimensional ℝ E] |
| 21 | |
| 22 | /-- A closed-interval solution of a smooth vector field extends to an open |
| 23 | time neighborhood of the entire interval, with the original orbit preserved. -/ |
| 24 | theorem exists_open_solution_extension |
| 25 | {U : Set E} (hU : IsOpen U) {F : E → E} (hF : ContDiffOn ℝ ∞ F U) |
| 26 | {α : ℝ → E} {T : ℝ} (hT : 0 ≤ T) |
| 27 | (hα : ∀ t ∈ Icc 0 T, α t ∈ U ∧ HasDerivWithinAt α (F (α t)) (Icc 0 T) t) : |
| 28 | ∃ δ > 0, ∃ γ : ℝ → E, γ 0 = α 0 ∧ EqOn γ α (Icc 0 T) ∧ |
| 29 | ∀ t ∈ Ioo (-δ) (T + δ), γ t ∈ U ∧ HasDerivAt γ (F (γ t)) t := by |
| 30 | have h0mem : (0 : ℝ) ∈ Icc 0 T := ⟨le_rfl, hT⟩ |
| 31 | have hTmem : T ∈ Icc 0 T := ⟨hT, le_rfl⟩ |
| 32 | obtain ⟨Vl, δl, Φl, _, hxl, _, hδl, _, hinitl, hmapsl, hderivl⟩ := |
| 33 | LocalFlow.exists_smooth_localFlow hU hF (hα 0 h0mem).1 |
| 34 | obtain ⟨Vr, δr, Φr, _, hxr, _, hδr, _, hinitr, hmapsr, hderivr⟩ := |
| 35 | LocalFlow.exists_smooth_localFlow hU hF (hα T hTmem).1 |
| 36 | let ε : ℝ := min δl δr / 2 |
| 37 | have hε : 0 < ε := half_pos (lt_min hδl hδr) |
| 38 | have hεltl : ε < δl := (half_lt_self (lt_min hδl hδr)).trans_le (min_le_left _ _) |
| 39 | have hεltr : ε < δr := (half_lt_self (lt_min hδl hδr)).trans_le (min_le_right _ _) |
| 40 | let βl : ℝ → E := fun t => Φl (α 0, t) |
| 41 | let βr : ℝ → E := fun t => Φr (α T, t - T) |
| 42 | have hβl0 : βl 0 = α 0 := hinitl (α 0) hxl |
| 43 | have hβrT : βr T = α T := by simpa only [βr, sub_self] using hinitr (α T) hxr |
| 44 | have hβl : ∀ t ∈ Icc (-ε) 0, βl t ∈ U ∧ HasDerivAt βl (F (βl t)) t := by |
| 45 | intro t ht |
| 46 | have hr : t ∈ Ioo (-δl) δl := ⟨by linarith [ht.1], by linarith [ht.2]⟩ |
| 47 | exact ⟨hmapsl _ hxl _ hr, hderivl _ hxl _ hr⟩ |
| 48 | have hβr : ∀ t ∈ Icc T (T + ε), βr t ∈ U ∧ HasDerivAt βr (F (βr t)) t := by |
| 49 | intro t ht |
| 50 | have hr : t - T ∈ Ioo (-δr) δr := ⟨by linarith [ht.1], by linarith [ht.2]⟩ |
| 51 | refine ⟨hmapsr _ hxr _ hr, ?_⟩ |
| 52 | simpa only [βr, one_smul, Function.comp_def, id_eq] using |
| 53 | (hderivr _ hxr _ hr).scomp t ((hasDerivAt_id t).sub_const T) |
| 54 | let η : ℝ → E := fun t => if t ≤ 0 then βl t else α t |
| 55 | have hη : ∀ t ∈ Icc (-ε) T, η t ∈ U ∧ |
| 56 | HasDerivWithinAt η (F (η t)) (Icc (-ε) T) t := by |
| 57 | have hd := hasDerivWithinAt_glue (by linarith : -ε ≤ 0) hT |
| 58 | (fun t ht => (hβl t ht).2.hasDerivWithinAt) |
| 59 | (fun t ht => (hα t ht).2) hβl0.symm |
| 60 | intro t ht |
| 61 | refine ⟨?_, hd t ht⟩ |
| 62 | by_cases ht0 : t ≤ 0 |
| 63 | · simpa only [η, if_pos ht0] using (hβl t ⟨ht.1, ht0⟩).1 |
| 64 | · simpa only [η, if_neg ht0] using (hα t ⟨le_of_not_ge ht0, ht.2⟩).1 |
| 65 | have hηT : η T = α T := by |
| 66 | by_cases ht0 : T ≤ 0 |
| 67 | · have hzero : T = 0 := le_antisymm ht0 hT |
| 68 | subst T |
| 69 | simpa only [η, if_pos le_rfl] using hβl0 |
| 70 | · exact if_neg ht0 |
| 71 | let γ : ℝ → E := fun t => if t ≤ T then η t else βr t |
| 72 | have hγ : ∀ t ∈ Icc (-ε) (T + ε), γ t ∈ U ∧ |
| 73 | HasDerivWithinAt γ (F (γ t)) (Icc (-ε) (T + ε)) t := by |
| 74 | have hd := hasDerivWithinAt_glue (by linarith : -ε ≤ T) |
| 75 | (by linarith : T ≤ T + ε) (fun t ht => (hη t ht).2) |
| 76 | (fun t ht => (hβr t ht).2.hasDerivWithinAt) (hβrT.trans hηT.symm) |
| 77 | intro t ht |
| 78 | refine ⟨?_, hd t ht⟩ |
| 79 | by_cases htT : t ≤ T |
| 80 | · simpa only [γ, if_pos htT] using (hη t ⟨ht.1, htT⟩).1 |
| 81 | · simpa only [γ, if_neg htT] using (hβr t ⟨le_of_not_ge htT, ht.2⟩).1 |
| 82 | refine ⟨ε, hε, γ, ?_, ?_, ?_⟩ |
| 83 | · simp only [γ, η, if_pos hT, if_pos le_rfl, hβl0] |
| 84 | · intro t ht |
| 85 | change (if t ≤ T then η t else βr t) = α t |
| 86 | rw [if_pos ht.2] |
| 87 | by_cases ht0 : t ≤ 0 |
| 88 | · have htzero : t = 0 := le_antisymm ht0 ht.1 |
| 89 | subst t |
| 90 | simpa only [η, if_pos le_rfl] using hβl0 |
| 91 | · exact if_neg ht0 |
| 92 | · intro t ht |
| 93 | exact ⟨(hγ t (Ioo_subset_Icc_self ht)).1, |
| 94 | (hγ t (Ioo_subset_Icc_self ht)).2.hasDerivAt (Icc_mem_nhds ht.1 ht.2)⟩ |
| 95 | |
| 96 | /-- A speed bound constructs a smooth flow near an initial point throughout |
| 97 | any prescribed time interval whose displacement stays in a compact ball |
| 98 | contained in the vector field's domain. -/ |
| 99 | theorem exists_smooth_flow_of_bounded_speed |
| 100 | {U : Set E} (hU : IsOpen U) {F : E → E} (hF : ContDiffOn ℝ ∞ F U) |
| 101 | {p x : E} {R C T : ℝ} (hball : closedBall p R ⊆ U) |
| 102 | (hC : 0 ≤ C) (hbound : ∀ y ∈ U, ‖F y‖ ≤ C) (hT : 0 ≤ T) |
| 103 | (hmargin : dist x p + C * T ≤ R) : |
| 104 | ∃ (V : Set E) (δ : ℝ) (Φ : E × ℝ → E), IsOpen V ∧ x ∈ V ∧ 0 < δ ∧ |
| 105 | ContDiffOn ℝ ∞ Φ (V ×ˢ Ioo (-δ) (T + δ)) ∧ |
| 106 | (∀ y ∈ V, Φ (y, 0) = y) ∧ |
| 107 | (∀ y ∈ V, ∀ t ∈ Ioo (-δ) (T + δ), Φ (y, t) ∈ U ∧ |
| 108 | HasDerivAt (fun s => Φ (y, s)) (F (Φ (y, t))) t) ∧ |
| 109 | ∀ t ∈ Icc 0 T, dist (Φ (x, t)) p ≤ dist x p + C * t := by |
| 110 | obtain ⟨α, hα0, hα⟩ := |
| 111 | exists_solution_of_bounded_speed hU hF hball hC hbound hT hmargin |
| 112 | obtain ⟨ε, hε, γ, hγ0, _, hγopen⟩ := |
| 113 | exists_open_solution_extension hU hF hT (fun t ht => ⟨(hα t ht).1, (hα t ht).2.2⟩) |
| 114 | have hγx : γ 0 = x := hγ0.trans hα0 |
| 115 | have h0mem : (0 : ℝ) ∈ Icc 0 T := ⟨le_rfl, hT⟩ |
| 116 | have hsub : Icc 0 T ⊆ Ioo (-ε) (T + ε) := |
| 117 | fun t ht => ⟨by linarith [ht.1], by linarith [ht.2]⟩ |
| 118 | obtain ⟨V, δ, Φ, hV, hxV, hδ, hs, hi, hf⟩ := |
| 119 | LocalFlow.exists_smooth_flow_along_compact_interval hU hF isOpen_Ioo |
| 120 | (convex_Ioo _ _) hγopen hT hsub |
| 121 | rw [hγx] at hxV |
| 122 | refine ⟨V, δ, Φ, hV, hxV, hδ, hs, hi, hf, ?_⟩ |
| 123 | have htime : Icc 0 T ⊆ Ioo (-δ) (T + δ) := |
| 124 | fun t ht => ⟨by linarith [ht.1], by linarith [ht.2]⟩ |
| 125 | have hlip := (convex_Icc (0 : ℝ) T).lipschitzOnWith_of_nnnorm_hasDerivWithin_le |
| 126 | (C := ⟨C, hC⟩) (fun t ht => (hf x hxV t (htime ht)).2.hasDerivWithinAt) |
| 127 | (fun t ht => show ‖F (Φ (x, t))‖₊ ≤ ⟨C, hC⟩ from |
| 128 | hbound _ (hf x hxV t (htime ht)).1) |
| 129 | intro t ht |
| 130 | have hb : dist (Φ (x, t)) (Φ (x, 0)) ≤ C * dist t 0 := hlip.dist_le_mul t ht 0 h0mem |
| 131 | rw [hi x hxV, Real.dist_eq, sub_zero, abs_of_nonneg ht.1] at hb |
| 132 | have hh := dist_triangle (Φ (x, t)) x p |
| 133 | linarith |
| 134 | |
| 135 | end Poincare.ODE |