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.Smooth |
| 2 | import Mathlib.Geometry.Manifold.VectorField.Pullback |
| 3 | import Mathlib.Geometry.Manifold.IntegralCurve.ExistUnique |
| 4 | import Mathlib.Geometry.Manifold.Instances.Real |
| 5 | |
| 6 | /-! |
| 7 | # Smooth local flows on manifolds |
| 8 | |
| 9 | Pull the actual vector field back through an inverse chart, solve its ordinary |
| 10 | ODE, and transport the solution back. The time interval is common to an open |
| 11 | neighborhood of initial points. |
| 12 | -/ |
| 13 | |
| 14 | noncomputable section |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Manifold ContDiff Bundle Topology |
| 20 | |
| 21 | namespace Poincare.Manifold |
| 22 | |
| 23 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | |
| 26 | /-- A smooth vector field on an open manifold domain has a smooth local flow |
| 27 | on a common time interval for all initial points in a neighborhood. -/ |
| 28 | theorem exists_smooth_localFlow_on_open |
| 29 | {X : (x : M) → TangentSpace (𝓡 n) x} {U : Set M} (hU : IsOpen U) |
| 30 | (hX : ContMDiffOn (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ (T% X) U) |
| 31 | {x : M} (hx : x ∈ U) : |
| 32 | ∃ (V : Set M) (δ : ℝ) (Φ : ℝ × M → M), |
| 33 | IsOpen V ∧ x ∈ V ∧ V ⊆ U ∧ 0 < δ ∧ |
| 34 | ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) (𝓡 n) ∞ Φ (Ioo (-δ) δ ×ˢ V) ∧ |
| 35 | (∀ y ∈ V, Φ (0, y) = y) ∧ |
| 36 | ∀ y ∈ V, (∀ t ∈ Ioo (-δ) δ, Φ (t, y) ∈ U) ∧ |
| 37 | IsMIntegralCurveOn (I := 𝓡 n) (fun t => Φ (t, y)) X (Ioo (-δ) δ) := by |
| 38 | let c := extChartAt (𝓡 n) x |
| 39 | have hc (z : EuclideanSpace ℝ (Fin n)) (hz : z ∈ c.target) : |
| 40 | ContMDiffAt (𝓡 n) (𝓡 n) ∞ c.symm z := |
| 41 | (contMDiffWithinAt_extChartAt_symm_target (n := ∞) x hz).contMDiffAt |
| 42 | (extChartAt_target_mem_nhds' hz) |
| 43 | have hi (z : EuclideanSpace ℝ (Fin n)) (hz : z ∈ c.target) : |
| 44 | (mfderiv (𝓡 n) (𝓡 n) c.symm z).IsInvertible := by |
| 45 | simpa only [ModelWithCorners.range_eq_univ, mfderivWithin_univ] using |
| 46 | isInvertible_mfderivWithin_extChartAt_symm hz |
| 47 | have hchart : ContMDiffOn (𝓡 n) (𝓡 n) ∞ c c.source := by |
| 48 | simpa only [c, extChartAt_source] using |
| 49 | (contMDiffOn_extChartAt (I := 𝓡 n) (x := x) (n := ∞)) |
| 50 | let A := c.target ∩ c.symm ⁻¹' U |
| 51 | have hAo : IsOpen A := |
| 52 | (show ContinuousOn c.symm c.target from fun z hz => |
| 53 | (hc z hz).continuousAt.continuousWithinAt).isOpen_inter_preimage |
| 54 | (isOpen_extChartAt_target x) hU |
| 55 | have hxA : c x ∈ A := ⟨mem_extChartAt_target x, |
| 56 | by simpa only [mem_preimage, c.left_inv (mem_extChartAt_source x)] using hx⟩ |
| 57 | let F := VectorField.mpullback (𝓡 n) (𝓡 n) c.symm X |
| 58 | have hF : ContDiffOn ℝ ∞ F A := by |
| 59 | intro z hz |
| 60 | apply (contMDiffAt_vectorSpace_iff_contDiffAt.mp ?_).contDiffWithinAt |
| 61 | exact (hX.contMDiffAt (hU.mem_nhds hz.2)).mpullback_vectorField_preimage |
| 62 | (hc z hz.1) (hi z hz.1) (by simp) |
| 63 | have hpush (z : EuclideanSpace ℝ (Fin n)) (hz : z ∈ A) : |
| 64 | mfderiv (𝓡 n) (𝓡 n) c.symm z (F z) = X (c.symm z) := by |
| 65 | exact (hi z hz.1).self_apply_inverse _ |
| 66 | obtain ⟨B, δ, q, hBo, hxB, hBA, hδ, hq, hq0, hqU, hqd⟩ := |
| 67 | Poincare.ODE.LocalFlow.exists_smooth_localFlow hAo hF hxA |
| 68 | let V := c.source ∩ c ⁻¹' B |
| 69 | have hVo : IsOpen V := hchart.continuousOn.isOpen_inter_preimage |
| 70 | (isOpen_extChartAt_source x) hBo |
| 71 | have hVU : V ⊆ U := by |
| 72 | intro y hy |
| 73 | have hm := (hBA hy.2).2 |
| 74 | simpa only [mem_preimage, c.left_inv hy.1] using hm |
| 75 | let Φ : ℝ × M → M := fun z => c.symm (q (c z.2, z.1)) |
| 76 | have hpoint (t : ℝ) (y : M) (hy : y ∈ V) (ht : t ∈ Ioo (-δ) δ) : |
| 77 | q (c y, t) ∈ A := hqU _ hy.2 t ht |
| 78 | have hsmooth : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) (𝓡 n) ∞ Φ |
| 79 | (Ioo (-δ) δ ×ˢ V) := by |
| 80 | rintro ⟨t, y⟩ ⟨ht, hy⟩ |
| 81 | have hcd := hchart.contMDiffAt (extChartAt_source_mem_nhds' hy.1) |
| 82 | have hpair : ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) |
| 83 | ((𝓡 n).prod 𝓘(ℝ, ℝ)) ∞ (fun z : ℝ × M => (c z.2, z.1)) (t, y) := |
| 84 | (hcd.comp (t, y) contMDiffAt_snd).prodMk contMDiffAt_fst |
| 85 | have hqm : ContMDiffAt ((𝓡 n).prod 𝓘(ℝ, ℝ)) (𝓡 n) ∞ q (c y, t) := by |
| 86 | have hqt : ContDiffAt ℝ ∞ q (c y, t) := |
| 87 | hq.contDiffAt ((hBo.prod isOpen_Ioo).mem_nhds ⟨hy.2, ht⟩) |
| 88 | rw [← modelWithCornersSelf_prod, chartedSpaceSelf_prod] |
| 89 | exact hqt.contMDiffAt |
| 90 | exact ((hc _ (hpoint t y hy ht).1).comp (t, y) |
| 91 | (hqm.comp (t, y) hpair)).contMDiffWithinAt |
| 92 | refine ⟨V, δ, Φ, hVo, ⟨mem_extChartAt_source x, hxB⟩, hVU, hδ, hsmooth, ?_, ?_⟩ |
| 93 | · intro y hy |
| 94 | change c.symm (q (c y, 0)) = y |
| 95 | rw [hq0 _ hy.2, c.left_inv hy.1] |
| 96 | · intro y hy |
| 97 | refine ⟨fun t ht => (hpoint t y hy ht).2, ?_⟩ |
| 98 | intro t ht |
| 99 | have hd := ((hc _ (hpoint t y hy ht).1).mdifferentiableAt (by simp)).hasMFDerivAt.comp t |
| 100 | (hqd _ hy.2 t ht).hasFDerivAt.hasMFDerivAt |
| 101 | apply HasMFDerivAt.hasMFDerivWithinAt |
| 102 | apply hd.congr_mfderiv |
| 103 | apply ContinuousLinearMap.ext |
| 104 | intro a |
| 105 | change mfderiv (𝓡 n) (𝓡 n) c.symm (q (c y, t)) (a • F (q (c y, t))) = |
| 106 | a • X (c.symm (q (c y, t))) |
| 107 | rw [map_smul, hpush _ (hpoint t y hy ht)] |
| 108 | |
| 109 | /-- A common local time works for smooth local flows near every point of a |
| 110 | compact subset. The spatial neighborhoods may vary. -/ |
| 111 | theorem exists_uniform_smooth_local_flows |
| 112 | {X : (x : M) → TangentSpace (𝓡 n) x} {U K : Set M} (hU : IsOpen U) |
| 113 | (hK : IsCompact K) (hKU : K ⊆ U) |
| 114 | (hX : ContMDiffOn (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ (T% X) U) : |
| 115 | ∃ δ > 0, ∀ x ∈ K, ∃ (V : Set M) (Φ : ℝ × M → M), |
| 116 | IsOpen V ∧ x ∈ V ∧ |
| 117 | ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) (𝓡 n) ∞ Φ (Ioo (-δ) δ ×ˢ V) ∧ |
| 118 | (∀ y ∈ V, Φ (0, y) = y) ∧ |
| 119 | ∀ y ∈ V, (∀ t ∈ Ioo (-δ) δ, Φ (t, y) ∈ U) ∧ |
| 120 | IsMIntegralCurveOn (I := 𝓡 n) (fun t => Φ (t, y)) X (Ioo (-δ) δ) := by |
| 121 | let P : Set M → Prop := fun S => ∃ δ > 0, ∀ x ∈ S, ∃ (V : Set M) (Φ : ℝ × M → M), |
| 122 | IsOpen V ∧ x ∈ V ∧ |
| 123 | ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) (𝓡 n) ∞ Φ (Ioo (-δ) δ ×ˢ V) ∧ |
| 124 | (∀ y ∈ V, Φ (0, y) = y) ∧ |
| 125 | ∀ y ∈ V, (∀ t ∈ Ioo (-δ) δ, Φ (t, y) ∈ U) ∧ |
| 126 | IsMIntegralCurveOn (I := 𝓡 n) (fun t => Φ (t, y)) X (Ioo (-δ) δ) |
| 127 | change P K |
| 128 | refine hK.induction_on (p := P) ?_ ?_ ?_ ?_ |
| 129 | · exact ⟨1, zero_lt_one, fun _ hx => False.elim hx⟩ |
| 130 | · rintro S T hST ⟨δ, hδ, h⟩ |
| 131 | exact ⟨δ, hδ, fun x hx => h x (hST hx)⟩ |
| 132 | · rintro S T ⟨δ, hδ, hS⟩ ⟨ε, hε, hT⟩ |
| 133 | refine ⟨min δ ε, lt_min hδ hε, ?_⟩ |
| 134 | intro x hx |
| 135 | rcases hx with hx | hx |
| 136 | · obtain ⟨V, Φ, hV, hxV, hs, hinit, horbit⟩ := hS x hx |
| 137 | have hsub : Ioo (-min δ ε) (min δ ε) ⊆ Ioo (-δ) δ := |
| 138 | Ioo_subset_Ioo (neg_le_neg (min_le_left _ _)) (min_le_left _ _) |
| 139 | exact ⟨V, Φ, hV, hxV, hs.mono (prod_mono_left hsub), hinit, |
| 140 | fun y hy => ⟨fun t ht => (horbit y hy).1 t (hsub ht), (horbit y hy).2.mono hsub⟩⟩ |
| 141 | · obtain ⟨V, Φ, hV, hxV, hs, hinit, horbit⟩ := hT x hx |
| 142 | have hsub : Ioo (-min δ ε) (min δ ε) ⊆ Ioo (-ε) ε := |
| 143 | Ioo_subset_Ioo (neg_le_neg (min_le_right _ _)) (min_le_right _ _) |
| 144 | exact ⟨V, Φ, hV, hxV, hs.mono (prod_mono_left hsub), hinit, |
| 145 | fun y hy => ⟨fun t ht => (horbit y hy).1 t (hsub ht), (horbit y hy).2.mono hsub⟩⟩ |
| 146 | · intro x hx |
| 147 | obtain ⟨V, δ, Φ, hV, hxV, _, hδ, hs, hinit, horbit⟩ := |
| 148 | exists_smooth_localFlow_on_open hU hX (hKU hx) |
| 149 | refine ⟨V, mem_nhdsWithin_of_mem_nhds (hV.mem_nhds hxV), δ, hδ, ?_⟩ |
| 150 | exact fun y hy => ⟨V, Φ, hV, hy, hs, hinit, horbit⟩ |
| 151 | |
| 152 | /-- A common local time works for every initial point of a compact set in the |
| 153 | domain of a smooth vector field. -/ |
| 154 | theorem exists_uniform_local_integralCurves |
| 155 | {X : (x : M) → TangentSpace (𝓡 n) x} {U K : Set M} (hU : IsOpen U) |
| 156 | (hK : IsCompact K) (hKU : K ⊆ U) |
| 157 | (hX : ContMDiffOn (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ (T% X) U) : |
| 158 | ∃ δ > 0, ∀ x ∈ K, ∃ γ : ℝ → M, γ 0 = x ∧ |
| 159 | (∀ t ∈ Ioo (-δ) δ, γ t ∈ U) ∧ |
| 160 | IsMIntegralCurveOn (I := 𝓡 n) γ X (Ioo (-δ) δ) := by |
| 161 | obtain ⟨δ, hδ, hlocal⟩ := exists_uniform_smooth_local_flows hU hK hKU hX |
| 162 | refine ⟨δ, hδ, ?_⟩ |
| 163 | intro x hx |
| 164 | obtain ⟨V, Φ, _, hxV, _, hinit, horbit⟩ := hlocal x hx |
| 165 | exact ⟨fun t => Φ (t, x), hinit x hxV, horbit x hxV⟩ |
| 166 | |
| 167 | end Poincare.Manifold |