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.Geometry.Manifold.Flow.Uniqueness |
| 2 | import Mathlib.Algebra.Order.Floor.Ring |
| 3 | |
| 4 | /-! # Forward manifold integral curves from finite continuation -/ |
| 5 | |
| 6 | noncomputable section |
| 7 | set_option autoImplicit false |
| 8 | set_option backward.isDefEq.respectTransparency false |
| 9 | |
| 10 | open Set Filter |
| 11 | open scoped Manifold ContDiff Bundle Topology |
| 12 | |
| 13 | namespace Poincare.Manifold |
| 14 | |
| 15 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] [T2Space M] |
| 16 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 17 | |
| 18 | /-- Arbitrarily long finite integral curves glue by uniqueness to one forward |
| 19 | curve, preserving any common range constraint. -/ |
| 20 | theorem exists_forward_integralCurve_of_finite_integralCurves |
| 21 | {X : (x : M) → TangentSpace (𝓡 n) x} {U K : Set M} (hU : IsOpen U) |
| 22 | (hX : ContMDiffOn (𝓡 n) ((𝓡 n).prod (𝓡 n)) 1 (T% X) U) {x : M} |
| 23 | (hfinite : ∀ k : ℕ, ∃ a b : ℝ, a < 0 ∧ (k : ℝ) + 1 < b ∧ |
| 24 | ∃ α : ℝ → M, α 0 = x ∧ (∀ t ∈ Ioo a b, α t ∈ U) ∧ |
| 25 | IsMIntegralCurveOn (I := 𝓡 n) α X (Ioo a b) ∧ |
| 26 | ∀ t ∈ Icc 0 ((k : ℝ) + 1), α t ∈ K) : |
| 27 | ∃ a < 0, ∃ γ : ℝ → M, γ 0 = x ∧ (∀ t ∈ Ioi a, γ t ∈ U) ∧ |
| 28 | IsMIntegralCurveOn (I := 𝓡 n) γ X (Ioi a) ∧ |
| 29 | ∀ t : ℝ, 0 ≤ t → γ t ∈ K := by |
| 30 | choose a b ha hb α hinit hαU hα hK using hfinite |
| 31 | have hagree (i j : ℕ) : EqOn (α i) (α j) |
| 32 | (Ioo (max (a i) (a j)) (min ((i : ℝ) + 1) ((j : ℝ) + 1))) := by |
| 33 | have hi : Ioo (max (a i) (a j)) (min ((i : ℝ) + 1) ((j : ℝ) + 1)) ⊆ |
| 34 | Ioo (a i) (b i) := Ioo_subset_Ioo (le_max_left _ _) |
| 35 | ((min_le_left _ _).trans (hb i).le) |
| 36 | have hj : Ioo (max (a i) (a j)) (min ((i : ℝ) + 1) ((j : ℝ) + 1)) ⊆ |
| 37 | Ioo (a j) (b j) := Ioo_subset_Ioo (le_max_right _ _) |
| 38 | ((min_le_right _ _).trans (hb j).le) |
| 39 | exact eqOn_of_isMIntegralCurveOn hU hX isOpen_Ioo isPreconnected_Ioo |
| 40 | (show 0 ∈ Ioo (max (a i) (a j)) (min ((i : ℝ) + 1) ((j : ℝ) + 1)) from |
| 41 | ⟨max_lt (ha i) (ha j), lt_min (by positivity) (by positivity)⟩) |
| 42 | (fun t ht => hαU i t (hi ht)) ((hα i).mono hi) ((hα j).mono hj) |
| 43 | ((hinit i).trans (hinit j).symm) |
| 44 | let γ : ℝ → M := fun t => if t < 0 then α 0 t else α ⌈t⌉₊ t |
| 45 | have heq (k : ℕ) : EqOn γ (α k) (Ioo (max (a 0) (a k)) ((k : ℝ) + 1)) := by |
| 46 | intro t ht |
| 47 | dsimp only [γ] |
| 48 | split_ifs with ht0 |
| 49 | · exact hagree 0 k ⟨ht.1, lt_min (by simpa using ht0.trans zero_lt_one) ht.2⟩ |
| 50 | · exact hagree ⌈t⌉₊ k ⟨(max_lt (ha _) (ha _)).trans_le (le_of_not_gt ht0), |
| 51 | lt_min (by linarith [Nat.le_ceil t]) ht.2⟩ |
| 52 | have hnear (t : ℝ) (ht : t ∈ Ioi (a 0)) : |
| 53 | ∃ k : ℕ, t ∈ Ioo (a k) (b k) ∧ γ =ᶠ[𝓝 t] α k := by |
| 54 | by_cases ht0 : t < 0 |
| 55 | · refine ⟨0, ⟨ht, ht0.trans (by linarith [hb 0] : 0 < b 0)⟩, ?_⟩ |
| 56 | filter_upwards [isOpen_Iio.mem_nhds ht0] with s hs |
| 57 | exact if_pos hs |
| 58 | · have ht0' := le_of_not_gt ht0 |
| 59 | have htI : t ∈ Ioo (max (a 0) (a ⌈t⌉₊)) ((⌈t⌉₊ : ℝ) + 1) := |
| 60 | ⟨(max_lt (ha _) (ha _)).trans_le ht0', by linarith [Nat.le_ceil t]⟩ |
| 61 | refine ⟨⌈t⌉₊, ⟨(ha _).trans_le ht0', htI.2.trans (hb _)⟩, ?_⟩ |
| 62 | exact Filter.Eventually.mono (isOpen_Ioo.mem_nhds htI) fun _ hs => heq _ hs |
| 63 | refine ⟨a 0, ha 0, γ, ?_, ?_, ?_, ?_⟩ |
| 64 | · simp [γ, hinit] |
| 65 | · intro t ht |
| 66 | obtain ⟨k, hk, he⟩ := hnear t ht |
| 67 | rw [he.self_of_nhds] |
| 68 | exact hαU k t hk |
| 69 | · intro t ht |
| 70 | obtain ⟨k, hk, he⟩ := hnear t ht |
| 71 | have hd := (((hα k).isMIntegralCurveAt (isOpen_Ioo.mem_nhds hk)).hasMFDerivAt.congr_of_eventuallyEq |
| 72 | he).hasMFDerivWithinAt (s := Ioi (a 0)) |
| 73 | convert hd using 1 |
| 74 | rw [he.self_of_nhds] |
| 75 | · intro t ht |
| 76 | rw [show γ t = α ⌈t⌉₊ t from if_neg (not_lt.mpr ht)] |
| 77 | exact hK _ t ⟨ht, by linarith [Nat.le_ceil t]⟩ |
| 78 | |
| 79 | end Poincare.Manifold |