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.BoundedSpeedSmooth |
| 2 | import PoincareLib.Analysis.ODE.Forward |
| 3 | |
| 4 | /-! |
| 5 | # Global solutions of bounded smooth vector fields |
| 6 | |
| 7 | The finite-time bounded-speed existence theorem and uniqueness give global |
| 8 | integral curves. In particular this applies to fields equal to a constant |
| 9 | outside a compact set, as in Smale, Diffeomorphisms of the 2-sphere (1959), |
| 10 | Lemma 2, pp. 622-623. |
| 11 | -/ |
| 12 | |
| 13 | noncomputable section |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Metric |
| 17 | open scoped ContDiff |
| 18 | |
| 19 | namespace Poincare.ODE |
| 20 | |
| 21 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 22 | [FiniteDimensional ℝ E] |
| 23 | |
| 24 | /-- A bounded smooth field has a forward solution starting at any point, |
| 25 | defined also on an open time neighborhood of the initial time. -/ |
| 26 | theorem exists_forward_solution_of_bounded_speed |
| 27 | {F : E → E} (hF : ContDiff ℝ ∞ F) {C : ℝ} (hC : 0 ≤ C) |
| 28 | (hbound : ∀ x, ‖F x‖ ≤ C) (x : E) : |
| 29 | ∃ δ > 0, ∃ γ : ℝ → E, γ 0 = x ∧ |
| 30 | ∀ t ∈ Ioi (-δ), HasDerivAt γ (F (γ t)) t := by |
| 31 | obtain ⟨δ, hδ, γ, hγ0, hγ, _⟩ := |
| 32 | exists_forward_solution_of_finite_solutions (U := univ) (K := univ) |
| 33 | isOpen_univ hF.contDiffOn (x := x) (by |
| 34 | intro k |
| 35 | obtain ⟨α, hα0, hα⟩ := exists_solution_of_bounded_speed |
| 36 | isOpen_univ hF.contDiffOn (p := x) (x := x) (R := C * ((k : ℝ) + 1)) |
| 37 | (T := (k : ℝ) + 1) |
| 38 | (subset_univ _) hC (fun y _ => hbound y) (by positivity) (by simp) |
| 39 | obtain ⟨ε, hε, β, hβ0, _, hβ⟩ := exists_open_solution_extension |
| 40 | isOpen_univ hF.contDiffOn (by positivity : (0 : ℝ) ≤ (k : ℝ) + 1) |
| 41 | (fun t ht => ⟨(hα t ht).1, (hα t ht).2.2⟩) |
| 42 | exact ⟨ε, hε, β, hβ0.trans hα0, hβ, fun _ _ => mem_univ _⟩) |
| 43 | exact ⟨δ, hδ, γ, hγ0, fun t ht => (hγ t ht).2⟩ |
| 44 | |
| 45 | /-- A bounded smooth field on a finite-dimensional real normed space has |
| 46 | an integral curve through any point for every real time. -/ |
| 47 | theorem exists_global_solution_of_bounded_speed |
| 48 | {F : E → E} (hF : ContDiff ℝ ∞ F) {C : ℝ} (hC : 0 ≤ C) |
| 49 | (hbound : ∀ x, ‖F x‖ ≤ C) (x : E) : |
| 50 | ∃ γ : ℝ → E, γ 0 = x ∧ ∀ t, HasDerivAt γ (F (γ t)) t := by |
| 51 | obtain ⟨δ, hδ, α, hα0, hα⟩ := |
| 52 | exists_forward_solution_of_bounded_speed hF hC hbound x |
| 53 | obtain ⟨ε, hε, β, hβ0, hβ⟩ := |
| 54 | exists_forward_solution_of_bounded_speed hF.neg hC (by simpa using hbound) x |
| 55 | have hβrev : ∀ t ∈ Iio ε, HasDerivAt (fun s => β (-s)) |
| 56 | (F (β (-t))) t := by |
| 57 | intro t ht |
| 58 | change t < ε at ht |
| 59 | have hnt : -t ∈ Ioi (-ε) := by |
| 60 | change -ε < -t |
| 61 | exact neg_lt_neg ht |
| 62 | have hd := (hβ (-t) hnt).scomp t |
| 63 | (hasDerivAt_neg t) |
| 64 | simpa only [Function.comp_def, neg_smul, one_smul, neg_neg] using hd |
| 65 | obtain ⟨γ, hγα, hγβ, hγ⟩ := exists_gluing_of_solutions (U := univ) |
| 66 | isOpen_univ hF.contDiffOn isOpen_Ioi isOpen_Iio (convex_Ioi _) (convex_Iio _) |
| 67 | (fun t ht => ⟨mem_univ _, hα t ht⟩) |
| 68 | (fun t ht => ⟨mem_univ _, hβrev t ht⟩) |
| 69 | (a := 0) ⟨by change -δ < 0; linarith, hε⟩ (by simp [hα0, hβ0]) |
| 70 | refine ⟨γ, (hγα (by change -δ < 0; linarith)).trans hα0, fun t => ?_⟩ |
| 71 | apply (hγ t ?_).2 |
| 72 | change -δ < t ∨ t < ε |
| 73 | rcases lt_or_ge (-δ) t with ht | ht |
| 74 | · exact Or.inl ht |
| 75 | · exact Or.inr (lt_of_le_of_lt ht (by linarith)) |
| 76 | |
| 77 | /-- A smooth field equal to a constant off a compact set is complete. -/ |
| 78 | theorem exists_global_solution_of_eq_const_off_compact |
| 79 | {F : E → E} (hF : ContDiff ℝ ∞ F) {K : Set E} (hK : IsCompact K) |
| 80 | {v : E} (hfix : ∀ x, x ∉ K → F x = v) (x : E) : |
| 81 | ∃ γ : ℝ → E, γ 0 = x ∧ ∀ t, HasDerivAt γ (F (γ t)) t := by |
| 82 | obtain ⟨B, hB⟩ := hK.exists_bound_of_continuousOn hF.continuous.continuousOn |
| 83 | apply exists_global_solution_of_bounded_speed hF |
| 84 | (C := max B ‖v‖) ((norm_nonneg v).trans (le_max_right _ _)) _ x |
| 85 | intro y |
| 86 | by_cases hy : y ∈ K |
| 87 | · exact (hB y hy).trans (le_max_left _ _) |
| 88 | · rw [hfix y hy] |
| 89 | exact le_max_right _ _ |
| 90 | |
| 91 | end Poincare.ODE |