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.LocalFlow.Smooth |
| 2 | |
| 3 | /-! |
| 4 | # Uniform local existence times on compact sets |
| 5 | |
| 6 | Compactness supplies a common local existence interval for all initial points |
| 7 | in a compact subset of a smooth vector field's domain. Closed-interval solutions |
| 8 | can be concatenated without a global completeness hypothesis. |
| 9 | -/ |
| 10 | |
| 11 | noncomputable section |
| 12 | |
| 13 | namespace Poincare.ODE |
| 14 | |
| 15 | open Set Filter |
| 16 | open scoped ContDiff Topology |
| 17 | |
| 18 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 19 | |
| 20 | /-- Concatenating two solutions at a common endpoint preserves the differential |
| 21 | equation on the entire closed interval. -/ |
| 22 | theorem hasDerivWithinAt_glue |
| 23 | {a c b : ℝ} (hac : a ≤ c) (hcb : c ≤ b) |
| 24 | {F : ℝ → E → E} {γ₁ γ₂ : ℝ → E} |
| 25 | (h₁ : ∀ t ∈ Icc a c, HasDerivWithinAt γ₁ (F t (γ₁ t)) (Icc a c) t) |
| 26 | (h₂ : ∀ t ∈ Icc c b, HasDerivWithinAt γ₂ (F t (γ₂ t)) (Icc c b) t) |
| 27 | (hjoin : γ₂ c = γ₁ c) : |
| 28 | ∀ t ∈ Icc a b, HasDerivWithinAt |
| 29 | (fun s => if s ≤ c then γ₁ s else γ₂ s) |
| 30 | (F t (if t ≤ c then γ₁ t else γ₂ t)) (Icc a b) t := by |
| 31 | let γ : ℝ → E := fun t => if t ≤ c then γ₁ t else γ₂ t |
| 32 | change ∀ t ∈ Icc a b, HasDerivWithinAt γ (F t (γ t)) (Icc a b) t |
| 33 | intro t ht |
| 34 | rcases lt_trichotomy t c with htc | he | hct |
| 35 | · have hval : γ t = γ₁ t := if_pos htc.le |
| 36 | have hset : (Icc a c : Set ℝ) =ᶠ[𝓝 t] Icc a b := by |
| 37 | rw [Filter.eventuallyEq_set] |
| 38 | filter_upwards [isOpen_Iio.mem_nhds htc] with s hs |
| 39 | exact ⟨fun h => ⟨h.1, h.2.trans hcb⟩, fun h => ⟨h.1, hs.le⟩⟩ |
| 40 | have heq : γ =ᶠ[𝓝[Icc a b] t] γ₁ := by |
| 41 | filter_upwards [nhdsWithin_le_nhds (isOpen_Iio.mem_nhds htc)] with s hs |
| 42 | exact if_pos hs.le |
| 43 | rw [hval] |
| 44 | exact ((h₁ t ⟨ht.1, htc.le⟩).congr_set hset).congr_of_eventuallyEq heq hval |
| 45 | · subst t |
| 46 | have hval : γ c = γ₁ c := if_pos le_rfl |
| 47 | have hleft : HasDerivWithinAt γ (F c (γ c)) (Icc a c) c := by |
| 48 | rw [hval] |
| 49 | exact (h₁ c ⟨hac, le_rfl⟩).congr (fun s hs => if_pos hs.2) hval |
| 50 | have hright : HasDerivWithinAt γ (F c (γ c)) (Icc c b) c := by |
| 51 | rw [hval, ← hjoin] |
| 52 | refine (h₂ c ⟨le_rfl, hcb⟩).congr (fun s hs => ?_) (hval.trans hjoin.symm) |
| 53 | by_cases hsc : s ≤ c |
| 54 | · have he : s = c := le_antisymm hsc hs.1 |
| 55 | subst s |
| 56 | exact hval.trans hjoin.symm |
| 57 | · exact if_neg hsc |
| 58 | simpa only [Icc_union_Icc_eq_Icc hac hcb] using hleft.union hright |
| 59 | · have hval : γ t = γ₂ t := if_neg hct.not_ge |
| 60 | have hset : (Icc c b : Set ℝ) =ᶠ[𝓝 t] Icc a b := by |
| 61 | rw [Filter.eventuallyEq_set] |
| 62 | filter_upwards [isOpen_Ioi.mem_nhds hct] with s hs |
| 63 | exact ⟨fun h => ⟨hac.trans h.1, h.2⟩, fun h => ⟨hs.le, h.2⟩⟩ |
| 64 | have heq : γ =ᶠ[𝓝[Icc a b] t] γ₂ := by |
| 65 | filter_upwards [nhdsWithin_le_nhds (isOpen_Ioi.mem_nhds hct)] with s hs |
| 66 | exact if_neg hs.not_ge |
| 67 | rw [hval] |
| 68 | exact ((h₂ t ⟨hct.le, ht.2⟩).congr_set hset).congr_of_eventuallyEq heq hval |
| 69 | |
| 70 | /-- A common local existence time works for every initial point in a compact |
| 71 | subset of the open domain of a smooth vector field. -/ |
| 72 | theorem exists_uniform_local_solutions [FiniteDimensional ℝ E] |
| 73 | {U K : Set E} (hU : IsOpen U) (hK : IsCompact K) (hKU : K ⊆ U) |
| 74 | {F : E → E} (hF : ContDiffOn ℝ ∞ F U) : |
| 75 | ∃ δ > 0, ∀ x ∈ K, ∃ γ : ℝ → E, γ 0 = x ∧ |
| 76 | ∀ t ∈ Ioo (-δ) δ, γ t ∈ U ∧ HasDerivAt γ (F (γ t)) t := by |
| 77 | let P : Set E → Prop := fun S => ∃ δ > 0, ∀ x ∈ S, ∃ γ : ℝ → E, γ 0 = x ∧ |
| 78 | ∀ t ∈ Ioo (-δ) δ, γ t ∈ U ∧ HasDerivAt γ (F (γ t)) t |
| 79 | change P K |
| 80 | refine hK.induction_on (p := P) ?_ ?_ ?_ ?_ |
| 81 | · exact ⟨1, zero_lt_one, fun _ hx => False.elim hx⟩ |
| 82 | · rintro S T hST ⟨δ, hδ, h⟩ |
| 83 | exact ⟨δ, hδ, fun x hx => h x (hST hx)⟩ |
| 84 | · rintro S T ⟨δ, hδ, hS⟩ ⟨ε, hε, hT⟩ |
| 85 | refine ⟨min δ ε, lt_min hδ hε, ?_⟩ |
| 86 | intro x hx |
| 87 | rcases hx with hx | hx |
| 88 | · obtain ⟨γ, hinit, hγ⟩ := hS x hx |
| 89 | exact ⟨γ, hinit, fun t ht => hγ t |
| 90 | ⟨lt_of_le_of_lt (neg_le_neg (min_le_left _ _)) ht.1, |
| 91 | ht.2.trans_le (min_le_left _ _)⟩⟩ |
| 92 | · obtain ⟨γ, hinit, hγ⟩ := hT x hx |
| 93 | exact ⟨γ, hinit, fun t ht => hγ t |
| 94 | ⟨lt_of_le_of_lt (neg_le_neg (min_le_right _ _)) ht.1, |
| 95 | ht.2.trans_le (min_le_right _ _)⟩⟩ |
| 96 | · intro x hx |
| 97 | obtain ⟨V, δ, Φ, hV, hxV, _, hδ, _, hinit, hmaps, hderiv⟩ := |
| 98 | LocalFlow.exists_smooth_localFlow hU hF (hKU hx) |
| 99 | refine ⟨V, mem_nhdsWithin_of_mem_nhds (hV.mem_nhds hxV), δ, hδ, ?_⟩ |
| 100 | intro y hy |
| 101 | exact ⟨fun t => Φ (y, t), hinit y hy, fun t ht => |
| 102 | ⟨hmaps y hy t ht, hderiv y hy t ht⟩⟩ |
| 103 | |
| 104 | end Poincare.ODE |