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.Local |
| 2 | import PoincareLib.Geometry.Manifold.Flow.Forward |
| 3 | |
| 4 | /-! |
| 5 | # Manifold continuation from compact confinement |
| 6 | |
| 7 | A common local existence time on the compact set permits repeated extension. |
| 8 | Uniqueness glues the finite extensions to a forward integral curve. The curve |
| 9 | may pass through several source charts. |
| 10 | -/ |
| 11 | |
| 12 | noncomputable section |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped Manifold ContDiff Bundle Topology |
| 18 | |
| 19 | namespace Poincare.Manifold |
| 20 | |
| 21 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] [T2Space M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 23 | |
| 24 | /-- If every partial forward integral curve stays in a fixed compact subset |
| 25 | of the field's domain, a single forward integral curve exists there. -/ |
| 26 | theorem exists_forward_integralCurve_of_compact_confinement |
| 27 | {X : (x : M) → TangentSpace (𝓡 n) x} {U K : Set M} (hU : IsOpen U) |
| 28 | (hK : IsCompact K) (hKU : K ⊆ U) |
| 29 | (hX : ContMDiffOn (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ (T% X) U) {x : M} (hx : x ∈ K) |
| 30 | (hconf : ∀ a b : ℝ, a < 0 → 0 < b → ∀ γ : ℝ → M, γ 0 = x → |
| 31 | (∀ t ∈ Ioo a b, γ t ∈ U) → IsMIntegralCurveOn (I := 𝓡 n) γ X (Ioo a b) → |
| 32 | ∀ t ∈ Ico 0 b, γ t ∈ K) : |
| 33 | ∃ a < 0, ∃ γ : ℝ → M, γ 0 = x ∧ (∀ t ∈ Ioi a, γ t ∈ U) ∧ |
| 34 | IsMIntegralCurveOn (I := 𝓡 n) γ X (Ioi a) ∧ |
| 35 | ∀ t : ℝ, 0 ≤ t → γ t ∈ K := by |
| 36 | obtain ⟨δ, hδ, hlocal⟩ := exists_uniform_local_integralCurves hU hK hKU hX |
| 37 | let d := δ / 2 |
| 38 | have hd : 0 < d := half_pos hδ |
| 39 | have htwo : 2 * d = δ := by dsimp [d]; ring |
| 40 | have hXone := hX.of_le (show (1 : ℕ∞ω) ≤ ∞ by simp) |
| 41 | have hfinite (i : ℕ) : ∃ γ : ℝ → M, γ 0 = x ∧ |
| 42 | (∀ t ∈ Ioo (-d) ((i : ℝ) * d + d), γ t ∈ U) ∧ |
| 43 | IsMIntegralCurveOn (I := 𝓡 n) γ X (Ioo (-d) ((i : ℝ) * d + d)) := by |
| 44 | induction i with |
| 45 | | zero => |
| 46 | obtain ⟨γ, hγ0, hγU, hγ⟩ := hlocal x hx |
| 47 | have hsub : Ioo (-d) (((0 : ℕ) : ℝ) * d + d) ⊆ Ioo (-δ) δ := by |
| 48 | simp only [Nat.cast_zero, zero_mul, zero_add] |
| 49 | apply Ioo_subset_Ioo <;> linarith |
| 50 | exact ⟨γ, hγ0, fun t ht => hγU t (hsub ht), hγ.mono hsub⟩ |
| 51 | | succ i ih => |
| 52 | obtain ⟨α, hα0, hαU, hα⟩ := ih |
| 53 | let s : ℝ := i * d |
| 54 | have hs : 0 ≤ s := mul_nonneg (Nat.cast_nonneg _) hd.le |
| 55 | have hsK : α s ∈ K := |
| 56 | hconf (-d) (s + d) (neg_lt_zero.mpr hd) (by linarith) α hα0 hαU hα |
| 57 | s ⟨hs, lt_add_of_pos_right _ hd⟩ |
| 58 | obtain ⟨β, hβ0, hβU, hβ⟩ := hlocal (α s) hsK |
| 59 | let β' : ℝ → M := fun t => β (t - s) |
| 60 | have hβ'U : ∀ t ∈ Ioo (s - δ) (s + δ), β' t ∈ U := by |
| 61 | intro t ht |
| 62 | exact hβU (t - s) ⟨by linarith [ht.1], by linarith [ht.2]⟩ |
| 63 | have hβ' : IsMIntegralCurveOn (I := 𝓡 n) β' X (Ioo (s - δ) (s + δ)) := by |
| 64 | apply (hβ.comp_add (-s)).mono |
| 65 | intro t ht |
| 66 | change t + -s ∈ Ioo (-δ) δ |
| 67 | constructor <;> linarith [ht.1, ht.2] |
| 68 | obtain ⟨γ, heqα, _, hγU, hγ⟩ := exists_gluing_of_integralCurves hU hXone |
| 69 | isOpen_Ioo isOpen_Ioo (convex_Ioo _ _) (convex_Ioo _ _) hαU hβ'U hα hβ' |
| 70 | (show s ∈ Ioo (-d) (s + d) ∩ Ioo (s - δ) (s + δ) from |
| 71 | ⟨⟨by linarith, by linarith⟩, ⟨by linarith, by linarith⟩⟩) |
| 72 | (by simpa only [β', sub_self] using hβ0.symm) |
| 73 | have hsub : Ioo (-d) (((i + 1 : ℕ) : ℝ) * d + d) ⊆ |
| 74 | Ioo (-d) (s + d) ∪ Ioo (s - δ) (s + δ) := by |
| 75 | intro t ht |
| 76 | by_cases hts : t < s + d |
| 77 | · exact Or.inl ⟨ht.1, hts⟩ |
| 78 | · right |
| 79 | have hsdef : s = (i : ℝ) * d := rfl |
| 80 | simp only [Nat.cast_add, Nat.cast_one] at ht |
| 81 | constructor <;> nlinarith [ht.2, le_of_not_gt hts] |
| 82 | refine ⟨γ, (heqα ⟨by linarith, by change 0 < s + d; linarith⟩).trans hα0, |
| 83 | fun t ht => hγU t (hsub ht), hγ.mono hsub⟩ |
| 84 | apply exists_forward_integralCurve_of_finite_integralCurves hU hXone |
| 85 | intro k |
| 86 | obtain ⟨i, hi⟩ := exists_nat_gt (((k : ℝ) + 1) / d) |
| 87 | have hik : (k : ℝ) + 1 < (i : ℝ) * d := (div_lt_iff₀ hd).mp hi |
| 88 | obtain ⟨γ, hγ0, hγU, hγ⟩ := hfinite i |
| 89 | refine ⟨-d, (i : ℝ) * d + d, neg_lt_zero.mpr hd, by linarith, |
| 90 | γ, hγ0, hγU, hγ, ?_⟩ |
| 91 | intro t ht |
| 92 | exact hconf (-d) ((i : ℝ) * d + d) (neg_lt_zero.mpr hd) (by positivity) |
| 93 | γ hγ0 hγU hγ t ⟨ht.1, by linarith [ht.2]⟩ |
| 94 | |
| 95 | end Poincare.Manifold |