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.RicciFlow.Soliton.Flow.Complete.Local |
| 2 | import Mathlib.Geometry.Manifold.Algebra.SmoothFunctions |
| 3 | |
| 4 | /-! # Compact local existence and gluing for smooth manifold flows -/ |
| 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] |
| 16 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 17 | {X : (x : M) → TangentSpace (𝓡 n) x} |
| 18 | |
| 19 | /-- A jointly smooth family of integral curves on a common time domain. -/ |
| 20 | structure SmoothIntegralFamily (X : (x : M) → TangentSpace (𝓡 n) x) |
| 21 | (V : Set M) (I : Set ℝ) (Φ : ℝ × M → M) : Prop where |
| 22 | smooth : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) (𝓡 n) ∞ Φ (I ×ˢ V) |
| 23 | orbit : ∀ y ∈ V, IsMIntegralCurveOn (I := 𝓡 n) (fun t => Φ (t, y)) X I |
| 24 | |
| 25 | omit [IsManifold (𝓡 n) ∞ M] in |
| 26 | theorem SmoothIntegralFamily.mono {V W : Set M} {I J : Set ℝ} {Φ : ℝ × M → M} |
| 27 | (h : SmoothIntegralFamily X V I Φ) (hW : W ⊆ V) (hJ : J ⊆ I) : |
| 28 | SmoothIntegralFamily X W J Φ := |
| 29 | ⟨h.smooth.mono (prod_mono hJ hW), fun y hy => (h.orbit y (hW hy)).mono hJ⟩ |
| 30 | |
| 31 | omit [IsManifold (𝓡 n) ∞ M] in |
| 32 | theorem SmoothIntegralFamily.smooth_orbit {V : Set M} {I : Set ℝ} {Φ : ℝ × M → M} |
| 33 | (h : SmoothIntegralFamily X V I Φ) {y : M} (hy : y ∈ V) : |
| 34 | ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) ∞ (fun t => Φ (t, y)) I := |
| 35 | h.smooth.comp (contMDiff_id.prodMk contMDiff_const).contMDiffOn (fun _ ht => ⟨ht, hy⟩) |
| 36 | |
| 37 | /-- Compact sets have a common existence time for smooth local flows. -/ |
| 38 | theorem exists_uniform_smooth_localFlows |
| 39 | (hX : ContMDiff (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ (T% X)) |
| 40 | {K : Set M} (hK : IsCompact K) : |
| 41 | ∃ δ > 0, ∀ x ∈ K, ∃ (V : Set M) (Φ : ℝ × M → M), |
| 42 | IsOpen V ∧ x ∈ V ∧ SmoothIntegralFamily X V (Ioo (-δ) δ) Φ ∧ |
| 43 | ∀ y ∈ V, Φ (0, y) = y := by |
| 44 | let P : Set M → Prop := fun S => |
| 45 | ∃ δ > 0, ∀ x ∈ S, ∃ (V : Set M) (Φ : ℝ × M → M), |
| 46 | IsOpen V ∧ x ∈ V ∧ SmoothIntegralFamily X V (Ioo (-δ) δ) Φ ∧ |
| 47 | ∀ y ∈ V, Φ (0, y) = y |
| 48 | change P K |
| 49 | refine hK.induction_on (p := P) ?_ ?_ ?_ ?_ |
| 50 | · exact ⟨1, zero_lt_one, fun _ hx => False.elim hx⟩ |
| 51 | · rintro S T hST ⟨δ, hδ, h⟩ |
| 52 | exact ⟨δ, hδ, fun x hx => h x (hST hx)⟩ |
| 53 | · rintro S T ⟨δ, hδ, hS⟩ ⟨ε, hε, hT⟩ |
| 54 | refine ⟨min δ ε, lt_min hδ hε, ?_⟩ |
| 55 | intro x hx |
| 56 | rcases hx with hx | hx |
| 57 | · obtain ⟨V, Φ, hV, hxV, hΦ, hi⟩ := hS x hx |
| 58 | exact ⟨V, Φ, hV, hxV, hΦ.mono subset_rfl |
| 59 | (Ioo_subset_Ioo (neg_le_neg (min_le_left _ _)) (min_le_left _ _)), hi⟩ |
| 60 | · obtain ⟨V, Φ, hV, hxV, hΦ, hi⟩ := hT x hx |
| 61 | exact ⟨V, Φ, hV, hxV, hΦ.mono subset_rfl |
| 62 | (Ioo_subset_Ioo (neg_le_neg (min_le_right _ _)) (min_le_right _ _)), hi⟩ |
| 63 | · intro x _ |
| 64 | obtain ⟨V, δ, Φ, hV, hxV, hδ, hs, hi, hd⟩ := exists_smooth_localFlow hX x |
| 65 | exact ⟨V, mem_nhdsWithin_of_mem_nhds (hV.mem_nhds hxV), δ, hδ, |
| 66 | fun y hy => ⟨V, Φ, hV, hy, ⟨hs, hd⟩, hi⟩⟩ |
| 67 | |
| 68 | variable [T2Space M] |
| 69 | |
| 70 | /-- Equal solution families glue on overlapping open time intervals. -/ |
| 71 | theorem SmoothIntegralFamily.glue |
| 72 | (hX : ContMDiff (𝓡 n) ((𝓡 n).prod (𝓡 n)) 1 (T% X)) |
| 73 | {V : Set M} (hV : IsOpen V) {a b c d s : ℝ} {Φ Ψ : ℝ × M → M} |
| 74 | (hΦ : SmoothIntegralFamily X V (Ioo a b) Φ) |
| 75 | (hΨ : SmoothIntegralFamily X V (Ioo c d) Ψ) |
| 76 | (hs : s ∈ Ioo a b ∩ Ioo c d) (he : ∀ y ∈ V, Φ (s, y) = Ψ (s, y)) : |
| 77 | ∃ Ξ : ℝ × M → M, SmoothIntegralFamily X V (Ioo a b ∪ Ioo c d) Ξ ∧ |
| 78 | EqOn Ξ Φ (Ioo a b ×ˢ V) ∧ EqOn Ξ Ψ (Ioo c d ×ˢ V) := by |
| 79 | classical |
| 80 | let Ξ : ℝ × M → M := fun p => if p.1 ∈ Ioo a b then Φ p else Ψ p |
| 81 | have heΦ : EqOn Ξ Φ (Ioo a b ×ˢ V) := fun _ hp => if_pos hp.1 |
| 82 | have heΨ : EqOn Ξ Ψ (Ioo c d ×ˢ V) := by |
| 83 | rintro ⟨t, y⟩ ⟨ht, hy⟩ |
| 84 | exact eqOn_piecewise_of_isMIntegralCurveOn_Ioo hX (hΦ.orbit y hy) |
| 85 | (hΨ.orbit y hy) hs (he y hy) ht |
| 86 | refine ⟨Ξ, ⟨?_, ?_⟩, heΦ, heΨ⟩ |
| 87 | · rintro ⟨t, y⟩ ⟨ht | ht, hy⟩ |
| 88 | · have hev : Ξ =ᶠ[𝓝 (t, y)] Φ := |
| 89 | Filter.Eventually.mono ((isOpen_Ioo.prod hV).mem_nhds ⟨ht, hy⟩) |
| 90 | (fun _ hp => heΦ hp) |
| 91 | exact ((hΦ.smooth.contMDiffAt ((isOpen_Ioo.prod hV).mem_nhds ⟨ht, hy⟩)).congr_of_eventuallyEq |
| 92 | hev).contMDiffWithinAt |
| 93 | · have hev : Ξ =ᶠ[𝓝 (t, y)] Ψ := |
| 94 | Filter.Eventually.mono ((isOpen_Ioo.prod hV).mem_nhds ⟨ht, hy⟩) |
| 95 | (fun _ hp => heΨ hp) |
| 96 | exact ((hΨ.smooth.contMDiffAt ((isOpen_Ioo.prod hV).mem_nhds ⟨ht, hy⟩)).congr_of_eventuallyEq |
| 97 | hev).contMDiffWithinAt |
| 98 | · intro y hy |
| 99 | exact isMIntegralCurveOn_piecewise hX (hΦ.orbit y hy) (hΨ.orbit y hy) hs (he y hy) |
| 100 | |
| 101 | omit [IsManifold (𝓡 n) ∞ M] [T2Space M] in |
| 102 | /-- A local flow can be started from a smooth time slice of a solution family. -/ |
| 103 | theorem SmoothIntegralFamily.restart |
| 104 | {V W : Set M} {a b δ s : ℝ} {Φ Ψ : ℝ × M → M} |
| 105 | (hV : IsOpen V) (hW : IsOpen W) (hs : s ∈ Ioo a b) |
| 106 | (hΦ : SmoothIntegralFamily X V (Ioo a b) Φ) |
| 107 | (hΨ : SmoothIntegralFamily X W (Ioo (-δ) δ) Ψ) : |
| 108 | IsOpen (V ∩ (fun y => Φ (s, y)) ⁻¹' W) ∧ |
| 109 | SmoothIntegralFamily X (V ∩ (fun y => Φ (s, y)) ⁻¹' W) |
| 110 | (Ioo (s - δ) (s + δ)) (fun p => Ψ (p.1 - s, Φ (s, p.2))) := by |
| 111 | have hslice (y : M) (hy : y ∈ V) : |
| 112 | ContMDiffAt (𝓡 n) (𝓡 n) ∞ (fun z => Φ (s, z)) y := |
| 113 | (hΦ.smooth.contMDiffAt ((isOpen_Ioo.prod hV).mem_nhds ⟨hs, hy⟩)).comp y |
| 114 | (contMDiffAt_const.prodMk contMDiffAt_id) |
| 115 | refine ⟨(show ContinuousOn (fun y => Φ (s, y)) V from |
| 116 | fun y hy => (hslice y hy).continuousAt.continuousWithinAt).isOpen_inter_preimage hV hW, |
| 117 | ⟨?_, ?_⟩⟩ |
| 118 | · rintro ⟨t, y⟩ ⟨ht, hy⟩ |
| 119 | have hsecond : ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) (𝓡 n) ∞ |
| 120 | (fun p : ℝ × M => Φ (s, p.2)) (t, y) := |
| 121 | (hΦ.smooth.contMDiffAt ((isOpen_Ioo.prod hV).mem_nhds |
| 122 | (show (s, y) ∈ Ioo a b ×ˢ V from ⟨hs, hy.1⟩))).comp |
| 123 | (t, y) (contMDiffAt_const.prodMk contMDiffAt_snd) |
| 124 | have hp : ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) (𝓘(ℝ, ℝ).prod (𝓡 n)) ∞ |
| 125 | (fun p : ℝ × M => (p.1 - s, Φ (s, p.2))) (t, y) := |
| 126 | (contMDiffAt_fst.sub contMDiffAt_const).prodMk hsecond |
| 127 | exact ((hΨ.smooth.contMDiffAt ((isOpen_Ioo.prod hW).mem_nhds |
| 128 | (show (t - s, Φ (s, y)) ∈ Ioo (-δ) δ ×ˢ W from |
| 129 | ⟨⟨by linarith [ht.1], by linarith [ht.2]⟩, hy.2⟩))).comp (t, y) hp).contMDiffWithinAt |
| 130 | · intro y hy |
| 131 | have hd := (hΨ.orbit _ hy.2).comp_add (-s) |
| 132 | apply hd.mono |
| 133 | intro t ht |
| 134 | constructor <;> linarith [ht.1, ht.2] |
| 135 | |
| 136 | end Poincare.Manifold |