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 PoincareLib.Geometry.Riemannian.Metric.Pullback |
| 3 | import Mathlib.Geometry.Manifold.IntegralCurve.UniformTime |
| 4 | |
| 5 | /-! # Smooth local flows in manifold charts -/ |
| 6 | |
| 7 | noncomputable section |
| 8 | set_option autoImplicit false |
| 9 | set_option backward.isDefEq.respectTransparency false |
| 10 | |
| 11 | open Set Filter Bundle |
| 12 | open scoped Manifold ContDiff Bundle Topology |
| 13 | |
| 14 | namespace Poincare.Manifold |
| 15 | |
| 16 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 17 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 18 | |
| 19 | /-- A smooth vector field has a jointly smooth local flow through each point. -/ |
| 20 | theorem exists_smooth_localFlow |
| 21 | {X : (x : M) → TangentSpace (𝓡 n) x} |
| 22 | (hX : ContMDiff (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ (T% X)) (x : M) : |
| 23 | ∃ (V : Set M) (δ : ℝ) (Φ : ℝ × M → M), |
| 24 | IsOpen V ∧ x ∈ V ∧ 0 < δ ∧ |
| 25 | ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) (𝓡 n) ∞ Φ (Ioo (-δ) δ ×ˢ V) ∧ |
| 26 | (∀ y ∈ V, Φ (0, y) = y) ∧ |
| 27 | ∀ y ∈ V, IsMIntegralCurveOn (I := 𝓡 n) (fun t => Φ (t, y)) X (Ioo (-δ) δ) := by |
| 28 | let E := EuclideanSpace ℝ (Fin n) |
| 29 | let c := extChartAt (𝓡 n) x |
| 30 | have hchart : ContMDiffOn (𝓡 n) (𝓡 n) ∞ c c.source := by |
| 31 | simpa only [c, extChartAt_source] using |
| 32 | (contMDiffOn_extChartAt (I := 𝓡 n) (x := x) (n := ∞)) |
| 33 | have hc (y : M) (hy : y ∈ c.source) : ContMDiffAt (𝓡 n) (𝓡 n) ∞ c y := |
| 34 | hchart.contMDiffAt (extChartAt_source_mem_nhds' hy) |
| 35 | have hci (z : E) (hz : z ∈ c.target) : ContMDiffAt (𝓡 n) (𝓡 n) ∞ c.symm z := |
| 36 | (contMDiffWithinAt_extChartAt_symm_target (n := ∞) x hz).contMDiffAt |
| 37 | (extChartAt_target_mem_nhds' hz) |
| 38 | let F : E → E := fun z => mfderiv (𝓡 n) (𝓡 n) c (c.symm z) (X (c.symm z)) |
| 39 | have hF : ContDiffOn ℝ ∞ F c.target := by |
| 40 | intro z hz |
| 41 | have hd := ((hc _ (c.map_target hz)).mfderiv_const (m := ∞) (by simp)).clm_apply_of_inCoordinates |
| 42 | (hX _) (hc _ (c.map_target hz)) |
| 43 | have hs := (contMDiff_snd_tangentBundle_modelSpace E (𝓡 n)).contMDiffAt.comp _ hd |
| 44 | exact (contMDiffAt_iff_contDiffAt.mp (hs.comp z (hci z hz))).contDiffWithinAt |
| 45 | have hpush (z : E) (hz : z ∈ c.target) : |
| 46 | mfderiv (𝓡 n) (𝓡 n) c.symm z (F z) = X (c.symm z) := by |
| 47 | have h := congrArg (fun L => L (X (c.symm z))) |
| 48 | (mfderivWithin_extChartAt_symm_comp_mfderiv_extChartAt' (I := 𝓡 n) |
| 49 | (c.map_target hz)) |
| 50 | simp only [ModelWithCorners.range_eq_univ, mfderivWithin_univ, |
| 51 | ContinuousLinearMap.comp_apply] at h |
| 52 | change mfderiv (𝓡 n) (𝓡 n) c.symm (c (c.symm z)) (F z) = X (c.symm z) at h |
| 53 | have hz' : c (c.symm z) = z := c.right_inv hz |
| 54 | rw [hz'] at h |
| 55 | exact h |
| 56 | obtain ⟨B, δ, q, hB, hxB, hBc, hδ, hq, hq0, hqmem, hqtime⟩ := |
| 57 | Poincare.ODE.LocalFlow.exists_smooth_localFlow (isOpen_extChartAt_target x) hF |
| 58 | (mem_extChartAt_target x) |
| 59 | let V := c.source ∩ c ⁻¹' B |
| 60 | have hV : IsOpen V := |
| 61 | hchart.continuousOn.isOpen_inter_preimage (isOpen_extChartAt_source x) hB |
| 62 | let Φ : ℝ × M → M := fun p => c.symm (q (c p.2, p.1)) |
| 63 | have hΦ : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) (𝓡 n) ∞ Φ (Ioo (-δ) δ ×ˢ V) := by |
| 64 | rintro ⟨t, y⟩ ⟨ht, hy⟩ |
| 65 | have hp : ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) |
| 66 | ((𝓡 n).prod 𝓘(ℝ, ℝ)) ∞ (fun p : ℝ × M => (c p.2, p.1)) (t, y) := |
| 67 | ((hc y hy.1).comp (t, y) contMDiffAt_snd).prodMk contMDiffAt_fst |
| 68 | have hqm : ContMDiffAt ((𝓡 n).prod 𝓘(ℝ, ℝ)) (𝓡 n) ∞ q (c y, t) := by |
| 69 | have hqd := hq.contDiffAt ((hB.prod isOpen_Ioo).mem_nhds |
| 70 | (show (c y, t) ∈ B ×ˢ Ioo (-δ) δ from ⟨hy.2, ht⟩)) |
| 71 | rw [← modelWithCornersSelf_prod, chartedSpaceSelf_prod] |
| 72 | exact hqd.contMDiffAt |
| 73 | exact ((hci _ (hqmem _ hy.2 t ht)).comp (t, y) (hqm.comp (t, y) hp)).contMDiffWithinAt |
| 74 | refine ⟨V, δ, Φ, hV, ⟨mem_extChartAt_source x, hxB⟩, hδ, hΦ, ?_, ?_⟩ |
| 75 | · intro y hy |
| 76 | change c.symm (q (c y, 0)) = y |
| 77 | rw [hq0 _ hy.2, c.left_inv hy.1] |
| 78 | · intro y hy t ht |
| 79 | have hd := ((hci _ (hqmem _ hy.2 t ht)).mdifferentiableAt (by simp)).hasMFDerivAt.comp t |
| 80 | (hqtime _ hy.2 t ht).hasFDerivAt.hasMFDerivAt |
| 81 | apply HasMFDerivAt.hasMFDerivWithinAt |
| 82 | apply hd.congr_mfderiv |
| 83 | apply ContinuousLinearMap.ext |
| 84 | intro a |
| 85 | change ℝ at a |
| 86 | change mfderiv (𝓡 n) (𝓡 n) c.symm (q (c y, t)) (a • F (q (c y, t))) = |
| 87 | a • X (c.symm (q (c y, t))) |
| 88 | rw [map_smul, hpush _ (hqmem _ hy.2 t ht)] |
| 89 | |
| 90 | end Poincare.Manifold |