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.HittingTime |
| 2 | |
| 3 | /-! |
| 4 | # Smooth dependence of a unique scalar root |
| 5 | |
| 6 | The parameter implicit-function theorem identifies any uniquely selected root |
| 7 | with a smooth local implicit function. This is the root argument used in |
| 8 | `Geometry.Manifold.Flow.HittingTime`, exposed for regular-level graphs. |
| 9 | -/ |
| 10 | |
| 11 | noncomputable section |
| 12 | set_option autoImplicit false |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | |
| 15 | open Set Filter |
| 16 | open scoped Manifold ContDiff Bundle Topology |
| 17 | |
| 18 | namespace Poincare.Manifold |
| 19 | |
| 20 | /-- A unique root with nonzero time derivative depends smoothly on the |
| 21 | manifold parameter, without assuming continuity of the selected root. -/ |
| 22 | theorem contMDiffAt_of_unique_zero |
| 23 | {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | {F : ℝ × M → ℝ} {σ : M → ℝ} {I : Set ℝ} {V : Set M} |
| 26 | (hI : IsOpen I) (hV : IsOpen V) |
| 27 | (hF : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ F (I ×ˢ V)) |
| 28 | (hroot : ∀ y ∈ V, σ y ∈ I ∧ F (σ y, y) = 0) |
| 29 | (hunique : ∀ y ∈ V, ∀ s ∈ I, F (s, y) = 0 → s = σ y) |
| 30 | {y : M} (hy : y ∈ V) {v : ℝ} (hv : v ≠ 0) |
| 31 | (hder : HasDerivAt (fun s ↦ F (s, y)) v (σ y)) : |
| 32 | ContMDiffAt (𝓡 n) 𝓘(ℝ, ℝ) ∞ σ y := by |
| 33 | let e := extChartAt (𝓡 n) y |
| 34 | have he := (contMDiffWithinAt_extChartAt_symm_target (n := ∞) y |
| 35 | (mem_extChartAt_target y)).contMDiffAt |
| 36 | (extChartAt_target_mem_nhds' (I := 𝓡 n) (mem_extChartAt_target y)) |
| 37 | let G : EuclideanSpace ℝ (Fin n) × ℝ → ℝ := fun q ↦ F (q.2, e.symm q.1) |
| 38 | let q₀ : EuclideanSpace ℝ (Fin n) × ℝ := (e y, σ y) |
| 39 | have hG : ContDiffAt ℝ ∞ G q₀ := by |
| 40 | have he' : ContMDiffAt 𝓘(ℝ, EuclideanSpace ℝ (Fin n) × ℝ) (𝓡 n) ∞ |
| 41 | (fun q ↦ e.symm q.1) q₀ := he.comp q₀ contDiffAt_fst.contMDiffAt |
| 42 | have hpair : ContMDiffAt 𝓘(ℝ, EuclideanSpace ℝ (Fin n) × ℝ) |
| 43 | (𝓘(ℝ, ℝ).prod (𝓡 n)) ∞ (fun q ↦ (q.2, e.symm q.1)) q₀ := |
| 44 | contDiffAt_snd.contMDiffAt.prodMk he' |
| 45 | have hF' := hF.contMDiffAt ((hI.prod hV).mem_nhds |
| 46 | (show (σ y, y) ∈ I ×ˢ V from ⟨(hroot y hy).1, hy⟩)) |
| 47 | have hsame : (q₀.2, e.symm q₀.1) = (σ y, y) := by |
| 48 | simp only [q₀, e.left_inv (mem_extChartAt_source y)] |
| 49 | rw [← hsame] at hF' |
| 50 | exact (hF'.comp q₀ hpair).contDiffAt |
| 51 | have hGder : HasDerivAt (fun s ↦ G (q₀.1, s)) v (σ y) := by |
| 52 | simpa only [G, q₀, e.left_inv (mem_extChartAt_source y)] using hder |
| 53 | have hpart : (fderiv ℝ G q₀).comp |
| 54 | (ContinuousLinearMap.inr ℝ (EuclideanSpace ℝ (Fin n)) ℝ) = |
| 55 | v • (ContinuousLinearMap.id ℝ ℝ) := by |
| 56 | have hd := (hG.differentiableAt (by simp)).hasFDerivAt |
| 57 | have hcomp := hd.comp (σ y) |
| 58 | ((hasFDerivAt_const q₀.1 (σ y)).prodMk (hasFDerivAt_id (σ y))) |
| 59 | have heq := hcomp.unique hGder.hasFDerivAt |
| 60 | apply ContinuousLinearMap.ext |
| 61 | intro z |
| 62 | have hz := congrArg (fun L : ℝ →L[ℝ] ℝ ↦ L z) heq |
| 63 | change fderiv ℝ G q₀ (0, z) = z * v at hz |
| 64 | change fderiv ℝ G q₀ (0, z) = v * z |
| 65 | simpa only [mul_comm] using hz |
| 66 | have hinv : ((fderiv ℝ G q₀).comp |
| 67 | (ContinuousLinearMap.inr ℝ (EuclideanSpace ℝ (Fin n)) ℝ)).IsInvertible := by |
| 68 | rw [hpart] |
| 69 | refine ⟨(LinearEquiv.smulOfNeZero ℝ ℝ v hv).toContinuousLinearEquiv, ?_⟩ |
| 70 | apply ContinuousLinearMap.ext |
| 71 | intro z |
| 72 | rfl |
| 73 | let ψ := hG.implicitFunction (by simp) hinv |
| 74 | have hψ : ContDiffAt ℝ ∞ ψ (e y) := hG.contDiffAt_implicitFunction (by simp) hinv |
| 75 | have hψzero : ψ (e y) = σ y := hG.implicitFunction_apply_self (by simp) hinv |
| 76 | have hψeq : ∀ᶠ z in 𝓝 (e y), G (z, ψ z) = G q₀ := |
| 77 | hG.eventually_apply_implicitFunction (by simp) hinv |
| 78 | have hψI : ∀ᶠ z in 𝓝 (e y), ψ z ∈ I := by |
| 79 | apply hψ.continuousAt.preimage_mem_nhds |
| 80 | rw [hψzero] |
| 81 | exact hI.mem_nhds (hroot y hy).1 |
| 82 | have hechart : ContMDiffAt (𝓡 n) (𝓡 n) ∞ e y := contMDiffAt_extChartAt |
| 83 | have hcomp : ContMDiffAt (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun z ↦ ψ (e z)) y := |
| 84 | hψ.contMDiffAt.comp y hechart |
| 85 | apply hcomp.congr_of_eventuallyEq |
| 86 | filter_upwards [hechart.continuousAt hψeq, hechart.continuousAt hψI, |
| 87 | hV.mem_nhds hy, extChartAt_source_mem_nhds' (I := 𝓡 n) (mem_extChartAt_source y)] |
| 88 | with z heq hIz hz hchartz |
| 89 | apply (hunique z hz (ψ (e z)) hIz ?_).symm |
| 90 | have hback : e.symm (e z) = z := e.left_inv hchartz |
| 91 | change F (ψ (e z), z) = 0 |
| 92 | conv_lhs => arg 1; arg 2; rw [← hback] |
| 93 | change G (e z, ψ (e z)) = 0 |
| 94 | rw [heq] |
| 95 | simpa only [G, q₀, e.left_inv (mem_extChartAt_source y)] using (hroot y hy).2 |
| 96 | |
| 97 | /-- Timewise injectivity supplies the root uniqueness needed for smooth |
| 98 | dependence on the manifold parameter. -/ |
| 99 | theorem contMDiffAt_of_unique_time_root |
| 100 | {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 101 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 102 | {F : ℝ × M → ℝ} {σ : M → ℝ} {I : Set ℝ} {V : Set M} |
| 103 | (hI : IsOpen I) (hV : IsOpen V) |
| 104 | (hF : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ F (I ×ˢ V)) |
| 105 | (hroot : ∀ y ∈ V, σ y ∈ I ∧ F (σ y, y) = 0) |
| 106 | (hinj : ∀ y ∈ V, InjOn (fun s ↦ F (s, y)) I) |
| 107 | {y : M} (hy : y ∈ V) {v : ℝ} (hv : v ≠ 0) |
| 108 | (hder : HasDerivAt (fun s ↦ F (s, y)) v (σ y)) : |
| 109 | ContMDiffAt (𝓡 n) 𝓘(ℝ, ℝ) ∞ σ y := by |
| 110 | apply contMDiffAt_of_unique_zero hI hV hF hroot ?_ hy hv hder |
| 111 | intro z hz s hs hzero |
| 112 | exact hinj z hz hs (hroot z hz).1 (hzero.trans (hroot z hz).2.symm) |
| 113 | |
| 114 | end Poincare.Manifold |