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 | /- |
| 2 | Copyright (c) 2026 The PoincareLib contributors. |
| 3 | -/ |
| 4 | import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ContDiff |
| 5 | |
| 6 | /-! |
| 7 | # Smooth coordinates uniform in a real parameter |
| 8 | |
| 9 | The inverse function theorem for a parameter-preserving augmented map gives |
| 10 | smooth coordinates for every sufficiently small parameter. A single ball is |
| 11 | contained in the source of all these coordinates. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Metric |
| 17 | open scoped ContDiff Topology |
| 18 | |
| 19 | namespace Poincare.Analysis |
| 20 | |
| 21 | universe u v |
| 22 | |
| 23 | variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] |
| 24 | {F : Type v} [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 25 | |
| 26 | /-- A jointly smooth family whose derivative at the origin is an isomorphism |
| 27 | in the spatial variable and zero in the parameter variable admits smooth |
| 28 | coordinates on one uniform spatial ball for every sufficiently small parameter. -/ |
| 29 | theorem exists_uniform_parametric_coordinates {H : ℝ × E → F} |
| 30 | (hH : ContDiff ℝ ∞ H) (L : E ≃L[ℝ] F) |
| 31 | (hdH : HasStrictFDerivAt H |
| 32 | ((L : E →L[ℝ] F).comp (ContinuousLinearMap.snd ℝ ℝ E)) (0, 0)) : |
| 33 | ∃ δ > 0, ∀ ε : ℝ, |ε| < δ → |
| 34 | ∃ C : OpenPartialHomeomorph E F, |
| 35 | (∀ q, C q = H (ε, q)) ∧ ball (0 : E) δ ⊆ C.source ∧ |
| 36 | ContDiffOn ℝ ∞ C C.source ∧ ContDiffOn ℝ ∞ C.symm C.target := by |
| 37 | let A (p : ℝ × E) : ℝ × F := (p.1, H p) |
| 38 | let LA := (ContinuousLinearEquiv.refl ℝ ℝ).prodCongr L |
| 39 | have hA : ContDiff ℝ ∞ A := contDiff_fst.prodMk hH |
| 40 | have hdA : HasStrictFDerivAt A (LA : (ℝ × E) →L[ℝ] (ℝ × F)) (0, 0) := by |
| 41 | exact (hasStrictFDerivAt_fst (𝕜 := ℝ) (p := (0, (0 : E)))).prodMk hdH |
| 42 | let G₀ := hdA.toOpenPartialHomeomorph A |
| 43 | let V := (fderiv ℝ A) ⁻¹' |
| 44 | range (fun B : (ℝ × E) ≃L[ℝ] (ℝ × F) => |
| 45 | (B : (ℝ × E) →L[ℝ] (ℝ × F))) |
| 46 | have hVopen : IsOpen V := |
| 47 | ContinuousLinearEquiv.isOpen.preimage (hA.continuous_fderiv (by simp)) |
| 48 | have hzeroV : (0, (0 : E)) ∈ V := ⟨LA, hdA.hasFDerivAt.fderiv.symm⟩ |
| 49 | let G := G₀.restrOpen V hVopen |
| 50 | have hzeroG : (0, (0 : E)) ∈ G.source := |
| 51 | ⟨hdA.mem_toOpenPartialHomeomorph_source, hzeroV⟩ |
| 52 | have hGmap (p : ℝ × E) : G p = (p.1, H p) := rfl |
| 53 | have hGinv : ContDiffOn ℝ ∞ G.symm G.target := by |
| 54 | intro p hp |
| 55 | have hsource := G.map_target hp |
| 56 | obtain ⟨B, hB⟩ := hsource.2 |
| 57 | change (B : (ℝ × E) →L[ℝ] (ℝ × F)) = fderiv ℝ A (G.symm p) at hB |
| 58 | apply (G.contDiffAt_symm (f₀' := B) hp ?_ hA.contDiffAt).contDiffWithinAt |
| 59 | change HasFDerivAt A (B : (ℝ × E) →L[ℝ] (ℝ × F)) (G.symm p) |
| 60 | rw [hB] |
| 61 | exact (hA.differentiable (by simp) (G.symm p)).hasFDerivAt |
| 62 | have hfirst {p : ℝ × F} (hp : p ∈ G.target) : (G.symm p).1 = p.1 := by |
| 63 | have h := congrArg Prod.fst (G.right_inv hp) |
| 64 | rwa [hGmap] at h |
| 65 | have hslice (ε : ℝ) {z : F} (hz : (ε, z) ∈ G.target) : |
| 66 | (ε, (G.symm (ε, z)).2) = G.symm (ε, z) := |
| 67 | Prod.ext (hfirst hz).symm rfl |
| 68 | obtain ⟨δ, hδ, hball⟩ := Metric.mem_nhds_iff.mp (G.open_source.mem_nhds hzeroG) |
| 69 | refine ⟨δ, hδ, ?_⟩ |
| 70 | intro ε hε |
| 71 | let C : OpenPartialHomeomorph E F := { |
| 72 | toFun := fun q => H (ε, q) |
| 73 | invFun := fun z => (G.symm (ε, z)).2 |
| 74 | source := {q | (ε, q) ∈ G.source} |
| 75 | target := {z | (ε, z) ∈ G.target} |
| 76 | map_source' := by |
| 77 | intro q hq |
| 78 | exact G.map_source hq |
| 79 | map_target' := by |
| 80 | intro z hz |
| 81 | have h := G.map_target hz |
| 82 | change (ε, (G.symm (ε, z)).2) ∈ G.source |
| 83 | rw [hslice ε hz] |
| 84 | exact h |
| 85 | left_inv' := by |
| 86 | intro q hq |
| 87 | exact congrArg Prod.snd (G.left_inv hq) |
| 88 | right_inv' := by |
| 89 | intro z hz |
| 90 | have h := congrArg Prod.snd (G.right_inv hz) |
| 91 | rw [hGmap] at h |
| 92 | change H (ε, (G.symm (ε, z)).2) = z |
| 93 | rw [hslice ε hz] |
| 94 | exact h |
| 95 | open_source := G.open_source.preimage (continuous_const.prodMk continuous_id) |
| 96 | open_target := G.open_target.preimage (continuous_const.prodMk continuous_id) |
| 97 | continuousOn_toFun := (hH.comp (contDiff_const.prodMk contDiff_id)).continuous.continuousOn |
| 98 | continuousOn_invFun := continuous_snd.comp_continuousOn |
| 99 | (G.continuousOn_symm.comp (continuous_const.prodMk continuous_id).continuousOn |
| 100 | (fun _ hz => hz)) } |
| 101 | refine ⟨C, fun _ => rfl, ?_, |
| 102 | (hH.comp (contDiff_const.prodMk contDiff_id)).contDiffOn, ?_⟩ |
| 103 | · intro q hq |
| 104 | apply hball |
| 105 | rw [← ball_prod_same] |
| 106 | exact ⟨by simpa only [mem_ball, Real.dist_eq, sub_zero] using hε, hq⟩ |
| 107 | · exact contDiff_snd.comp_contDiffOn |
| 108 | (hGinv.comp (contDiff_const.prodMk contDiff_id).contDiffOn (fun _ hz => hz)) |
| 109 | |
| 110 | end Poincare.Analysis |