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 Mathlib.Geometry.Manifold.ContMDiffMFDeriv |
| 2 | import Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 3 | |
| 4 | /-! |
| 5 | # Smoothness of a manifold curve from its actual tangent velocity |
| 6 | |
| 7 | The local ODE regularity argument in Morgan-Tian Definition 6.7 and |
| 8 | Lemma 6.8, pp. 108-109. Extended target charts convert a smooth actual |
| 9 | velocity into the ordinary derivative criterion. Corners in the target |
| 10 | do not require an open chart image. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | -- Model tangent fibers are their given normed vector model. |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set Filter |
| 18 | open scoped Manifold ContDiff Bundle Topology |
| 19 | |
| 20 | variable {E H M : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 21 | [TopologicalSpace H] {I : ModelWithCorners ℝ E H} |
| 22 | [TopologicalSpace M] [ChartedSpace H M] [IsManifold I ∞ M] |
| 23 | {γ : ℝ → M} {J : Set ℝ} |
| 24 | |
| 25 | /-- A Ck actual tangent velocity gives a C(k+1) curve on an open |
| 26 | parameter set, the regularity step in Lemma 6.8, pp. 108-109. -/ |
| 27 | theorem contMDiffOn_succ_of_curveVelocity (hJ : IsOpen J) |
| 28 | (hγ : MDifferentiableOn (𝓘(ℝ, ℝ)) I γ J) (k : ℕ) |
| 29 | (hV : ContMDiffOn (𝓘(ℝ, ℝ)) I.tangent k |
| 30 | (fun t => Bundle.TotalSpace.mk' E (γ t) |
| 31 | (mfderiv (𝓘(ℝ, ℝ)) I γ t (1 : ℝ))) J) : |
| 32 | ContMDiffOn (𝓘(ℝ, ℝ)) I ((k : ℕ∞ω) + 1) γ J := by |
| 33 | intro s hs |
| 34 | let c := extChartAt I (γ s) |
| 35 | let O := J ∩ γ ⁻¹' (chartAt H (γ s)).source |
| 36 | have hO : IsOpen O := hγ.continuousOn.isOpen_inter_preimage hJ (chartAt H (γ s)).open_source |
| 37 | have hsO : s ∈ O := ⟨hs, mem_chart_source H (γ s)⟩ |
| 38 | have hc : ContMDiffOn I (𝓘(ℝ, E)) ∞ c (chartAt H (γ s)).source := contMDiffOn_extChartAt |
| 39 | have hγd (t : ℝ) (ht : t ∈ O) : MDifferentiableAt (𝓘(ℝ, ℝ)) I γ t := |
| 40 | (hγ t ht.1).mdifferentiableAt (hJ.mem_nhds ht.1) |
| 41 | have hcd (t : ℝ) (ht : t ∈ O) : MDifferentiableAt I (𝓘(ℝ, E)) c (γ t) := |
| 42 | ((hc _ ht.2).contMDiffAt ((chartAt H (γ s)).open_source.mem_nhds ht.2)).mdifferentiableAt |
| 43 | (by simp) |
| 44 | have hcoord : DifferentiableOn ℝ (c ∘ γ) O := |
| 45 | fun t ht => ((hcd t ht).comp t (hγd t ht)).differentiableAt.differentiableWithinAt |
| 46 | have htc := hc.contMDiffOn_tangentMapWithin (m := (k : ℕ∞ω)) |
| 47 | (by exact_mod_cast (le_top : (k : ℕ∞) + 1 ≤ ⊤)) |
| 48 | (chartAt H (γ s)).open_source.uniqueMDiffOn |
| 49 | have hvcoord := (contMDiff_snd_tangentBundle_modelSpace E (𝓘(ℝ, E))).comp_contMDiffOn |
| 50 | (htc.comp (hV.mono inter_subset_left) (fun _ ht => ht.2)) |
| 51 | have hderiv : ContDiffOn ℝ k (deriv (c ∘ γ)) O := by |
| 52 | apply hvcoord.contDiffOn.congr |
| 53 | intro t ht |
| 54 | change deriv (c ∘ γ) t = mfderivWithin I (𝓘(ℝ, E)) c (chartAt H (γ s)).source (γ t) |
| 55 | (mfderiv (𝓘(ℝ, ℝ)) I γ t (1 : ℝ)) |
| 56 | rw [mfderivWithin_of_mem_nhds ((chartAt H (γ s)).open_source.mem_nhds ht.2)] |
| 57 | have hd := mfderiv_comp_apply t (hcd t ht) (hγd t ht) (1 : ℝ) |
| 58 | rw [mfderiv_eq_fderiv] at hd |
| 59 | change deriv (c ∘ γ) t = _ at hd |
| 60 | exact hd |
| 61 | have hregular : ContDiffOn ℝ ((k : ℕ∞ω) + 1) (c ∘ γ) O := |
| 62 | (contDiffOn_succ_iff_deriv_of_isOpen hO).mpr ⟨hcoord, by simp, hderiv⟩ |
| 63 | exact (contMDiffAt_iff_target.mpr ⟨(hγd s hsO).continuousAt, |
| 64 | (hregular.contMDiffOn s hsO).contMDiffAt (hO.mem_nhds hsO)⟩).contMDiffWithinAt |
| 65 | |
| 66 | /-- A differentiable solution of a jointly smooth tangent field is |
| 67 | smooth on its open parameter set, the interior ODE bootstrap used in |
| 68 | Definition 6.7 and Lemma 6.8, pp. 108-109. -/ |
| 69 | theorem contMDiffOn_of_smooth_curveVelocity (hJ : IsOpen J) |
| 70 | (hγ : MDifferentiableOn (𝓘(ℝ, ℝ)) I γ J) |
| 71 | (V : ℝ → ∀ q : M, TangentSpace I q) {U : Set (ℝ × M)} |
| 72 | (hV : ContMDiffOn ((𝓘(ℝ, ℝ)).prod I) I.tangent ∞ |
| 73 | (fun z => Bundle.TotalSpace.mk' E z.2 (V z.1 z.2)) U) |
| 74 | (hgraph : ∀ t ∈ J, (t, γ t) ∈ U) |
| 75 | (hderiv : ∀ t ∈ J, mfderiv (𝓘(ℝ, ℝ)) I γ t (1 : ℝ) = V t (γ t)) : |
| 76 | ContMDiffOn (𝓘(ℝ, ℝ)) I ∞ γ J := by |
| 77 | rw [contMDiffOn_infty] |
| 78 | intro k |
| 79 | induction k with |
| 80 | | zero => exact contMDiffOn_zero_iff.mpr hγ.continuousOn |
| 81 | | succ k hk => |
| 82 | have hv := (hV.of_le (ENat.natCast_le_of_coe_top_le_withTop le_rfl k)).comp |
| 83 | (contMDiffOn_id.prodMk hk) hgraph |
| 84 | have hactual : ContMDiffOn (𝓘(ℝ, ℝ)) I.tangent k |
| 85 | (fun t => Bundle.TotalSpace.mk' E (γ t) |
| 86 | (mfderiv (𝓘(ℝ, ℝ)) I γ t (1 : ℝ))) J := by |
| 87 | apply hv.congr |
| 88 | intro t ht |
| 89 | simp only [Function.comp_apply, id_eq, hderiv t ht] |
| 90 | exact contMDiffOn_succ_of_curveVelocity hJ hγ k hactual |