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.FlowBox.Connector |
| 2 | import PoincareLib.Analysis.ODE.LocalFlow.FlowBox.FirstReturn |
| 3 | import PoincareLib.Analysis.ODE.LocalFlow.FlowBox.SupportedChange |
| 4 | import PoincareLib.Analysis.ODE.Plane.NoPeriodicOrbit |
| 5 | |
| 6 | /-! |
| 7 | # Escape of complete nonvanishing planar trajectories |
| 8 | |
| 9 | A bounded orbit has an isolated transverse return. Changing the field in |
| 10 | a thin flow box closes that return without creating a zero. The resulting |
| 11 | closed integral-curve segment contradicts the periodic-orbit obstruction. |
| 12 | -/ |
| 13 | |
| 14 | noncomputable section |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set Filter Metric |
| 19 | open scoped ContDiff Topology |
| 20 | |
| 21 | namespace Poincare.ODE.Plane |
| 22 | |
| 23 | open Poincare.ODE.LocalFlow |
| 24 | |
| 25 | /-- Every complete trajectory of a smooth nowhere-zero planar field has |
| 26 | unbounded forward image. -/ |
| 27 | theorem not_isBounded_global_integralCurve |
| 28 | {V : EuclideanSpace ℝ (Fin 2) → EuclideanSpace ℝ (Fin 2)} |
| 29 | (hV : ContDiff ℝ ∞ V) (hne : ∀ x, V x ≠ 0) |
| 30 | {γ : ℝ → EuclideanSpace ℝ (Fin 2)} |
| 31 | (hγ : ∀ t, HasDerivAt γ (V (γ t)) t) : |
| 32 | ¬ Bornology.IsBounded (γ '' Ici 0) := by |
| 33 | intro hbounded |
| 34 | obtain ⟨e, ε, hε, hbox, hp, he, hi, hflow, _⟩ := |
| 35 | exists_flowBox_transverse_returns hV hne (fun t _ => hγ t) hbounded |
| 36 | let r := ε / 2 |
| 37 | have hr : 0 < r := half_pos hε |
| 38 | have hrε : r < ε := half_lt_self hε |
| 39 | have hreturns := flowBox_transverse_returns_of_clusterPt hV hγ e hflow hr hrε hbox hp |
| 40 | obtain ⟨a, b, s₁, s₂, R, h, _, hab, hrR, hh, hhε, hs₁, hs₂, |
| 41 | hrect, heqa, heqb, havoid⟩ := |
| 42 | exists_isolated_flowBox_return hV hγ e hflow hr hrε hbox hreturns |
| 43 | let R' := (r + R) / 2 |
| 44 | have hrR' : r < R' := by dsimp [R']; linarith |
| 45 | have hR'R : R' < R := by dsimp [R']; linarith |
| 46 | have hR' : 0 < R' := hr.trans hrR' |
| 47 | obtain ⟨W, κ, hW, _, hWvert, hWfix, hκ, hκbound, hκlo, hκhi⟩ := |
| 48 | exists_vertical_field_connector hr hrR' (half_pos hh) |
| 49 | (abs_le.mpr hs₁) (abs_le.mpr hs₂) |
| 50 | let K : Set (ℝ × ℝ) := Icc (-R') R' ×ˢ Icc (-(h / 2)) (h / 2) |
| 51 | have hKs : K ⊆ e.source := by |
| 52 | intro z hz |
| 53 | exact hrect ⟨⟨by linarith [hz.1.1], by linarith [hz.1.2]⟩, |
| 54 | ⟨by linarith [hz.2.1], by linarith [hz.2.2]⟩⟩ |
| 55 | have hKo : K ⊆ Ioo (-R) R ×ˢ Ioo (-h) h := by |
| 56 | intro z hz |
| 57 | exact ⟨⟨by linarith [hz.1.1], by linarith [hz.1.2]⟩, |
| 58 | ⟨by linarith [hz.2.1], by linarith [hz.2.2]⟩⟩ |
| 59 | have hv : ∀ z ∈ e.source, fderiv ℝ e z (0, 1) = V (e z) := by |
| 60 | rintro ⟨s, t⟩ hz |
| 61 | have hd := (he.contDiffAt (e.open_source.mem_nhds hz)).differentiableAt (by simp) |
| 62 | exact (hd.hasFDerivAt.comp_hasDerivAt t |
| 63 | ((hasDerivAt_const t s).prodMk (hasDerivAt_id t))).unique (hflow s t hz) |
| 64 | obtain ⟨Z, hZ, hZne, hZfix, hZe⟩ := |
| 65 | exists_supported_vectorField_change e he hi hV hne hv |
| 66 | (isCompact_Icc.prod isCompact_Icc) hKs hW |
| 67 | (fun z hz => by have := congrArg Prod.snd hz; rw [hWvert] at this; norm_num at this) |
| 68 | (fun z hz => hWfix z (by |
| 69 | by_contra hn |
| 70 | push Not at hn |
| 71 | exact hz ⟨abs_le.mp hn.1.le, abs_le.mp hn.2.le⟩)) |
| 72 | have hZγ (t : ℝ) (ht : t ∈ Icc (a + h) (b - h)) : Z (γ t) = V (γ t) := |
| 73 | hZfix _ (fun htK => havoid t ht (image_mono hKo htK)) |
| 74 | have hκsource (u : ℝ) (hu : u ∈ Icc (-h) h) : κ u ∈ e.source := by |
| 75 | apply hrect |
| 76 | have hbnd := abs_le.mp (hκbound u).2 |
| 77 | exact ⟨⟨by linarith [hbnd.1], by linarith [hbnd.2]⟩, |
| 78 | by simpa only [(hκbound u).1] using hu⟩ |
| 79 | let β : ℝ → EuclideanSpace ℝ (Fin 2) := fun t => e (κ (t - b)) |
| 80 | have hβ (t : ℝ) (ht : t ∈ Icc (b - h) (b + h)) : |
| 81 | HasDerivAt β (Z (β t)) t := by |
| 82 | have hsrc := hκsource (t - b) ⟨by linarith [ht.1], by linarith [ht.2]⟩ |
| 83 | have hd := (he.contDiffAt (e.open_source.mem_nhds hsrc)).differentiableAt (by simp) |
| 84 | have hc : HasDerivAt (fun u => e (κ u)) (Z (e (κ (t - b)))) (t - b) := by |
| 85 | rw [hZe _ hsrc] |
| 86 | exact hd.hasFDerivAt.comp_hasDerivAt _ (hκ _) |
| 87 | simpa only [β, Function.comp_def, one_smul, id_eq] using |
| 88 | hc.scomp t ((hasDerivAt_id t).sub_const b) |
| 89 | have hβγ : β =ᶠ[𝓝 (b - h)] γ := by |
| 90 | have hnh : Ioo (b - ε) (b - h / 2) ∈ 𝓝 (b - h) := |
| 91 | Ioo_mem_nhds (by linarith) (by linarith) |
| 92 | filter_upwards [hnh] with t ht |
| 93 | have hu : t - b ∈ Ioo (-ε) ε := ⟨by linarith [ht.1], by linarith [ht.2]⟩ |
| 94 | dsimp only [β] |
| 95 | rw [hκlo _ (by linarith [ht.2])] |
| 96 | symm |
| 97 | simpa only [add_sub_cancel] using heqb (t - b) hu |
| 98 | let q : ℝ → EuclideanSpace ℝ (Fin 2) := fun t => if t ≤ b - h then γ t else β t |
| 99 | have hqleft (t : ℝ) (ht : t ≤ b - h) : q =ᶠ[𝓝 t] γ := by |
| 100 | rcases lt_or_eq_of_le ht with ht | rfl |
| 101 | · filter_upwards [eventually_lt_nhds ht] with s hs |
| 102 | exact if_pos hs.le |
| 103 | · filter_upwards [hβγ] with s hs |
| 104 | dsimp only [q] |
| 105 | split_ifs <;> simp_all |
| 106 | have hqright (t : ℝ) (ht : b - h < t) : q =ᶠ[𝓝 t] β := by |
| 107 | filter_upwards [eventually_gt_nhds ht] with s hs |
| 108 | exact if_neg (not_le.mpr hs) |
| 109 | have hq : ∀ t ∈ Icc (a + h) (b + h), HasDerivAt q (Z (q t)) t := by |
| 110 | intro t ht |
| 111 | by_cases hb : t ≤ b - h |
| 112 | · have heq := hqleft t hb |
| 113 | rw [heq.self_of_nhds, hZγ t ⟨ht.1, hb⟩] |
| 114 | exact (hγ t).congr_of_eventuallyEq heq |
| 115 | · have hb' := lt_of_not_ge hb |
| 116 | have heq := hqright t hb' |
| 117 | rw [heq.self_of_nhds] |
| 118 | exact (hβ t ⟨hb'.le, ht.2⟩).congr_of_eventuallyEq heq |
| 119 | have hclosed : q (a + h) = q (b + h) := by |
| 120 | have hhI : h ∈ Ioo (-ε) ε := ⟨by linarith, by linarith⟩ |
| 121 | rw [show q (a + h) = γ (a + h) from if_pos (by linarith), heqa h hhI] |
| 122 | rw [show q (b + h) = β (b + h) from if_neg (by linarith)] |
| 123 | simp only [β, add_sub_cancel_left, hκhi h (by linarith)] |
| 124 | have hinj := injOn_integralCurve_Icc_of_nonvanishing hZ hZne hq |
| 125 | have htimes := hinj ⟨le_rfl, by linarith⟩ ⟨by linarith, le_rfl⟩ hclosed |
| 126 | linarith |
| 127 | |
| 128 | end Poincare.ODE.Plane |