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.RegularLevel.Straightening |
| 2 | import Mathlib.Geometry.Manifold.ContMDiff.Atlas |
| 3 | import Mathlib.Geometry.Manifold.MFDeriv.NormedSpace |
| 4 | |
| 5 | /-! |
| 6 | # Regular-level AdaptedChart |
| 7 | |
| 8 | Adapted from LeeRiemannian, `LeeLib/Geometry/LevelSetAdaptedChart.lean`. |
| 9 | See `references/geometry/lee-riemannian/` for provenance. |
| 10 | Lee, Introduction to Riemannian Manifolds, Corollary A.26 and Proposition 2.37. |
| 11 | -/ |
| 12 | |
| 13 | open Set Filter Function |
| 14 | open scoped Manifold Topology ContDiff |
| 15 | |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | noncomputable section |
| 19 | |
| 20 | namespace Poincare.Geometry.Manifold.RegularLevel |
| 21 | |
| 22 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 23 | [FiniteDimensional ℝ E] |
| 24 | {H : Type*} [TopologicalSpace H] {I : ModelWithCorners ℝ E H} |
| 25 | {M : Type*} [TopologicalSpace M] [ChartedSpace H M] [IsManifold I ∞ M] |
| 26 | [I.Boundaryless] |
| 27 | |
| 28 | /-- The differential `df_q v` of a real-valued function, as a real number. |
| 29 | |
| 30 | `TangentSpace 𝓘(ℝ, ℝ) (f q)` is definitionally `ℝ`, but instance synthesis |
| 31 | does not unfold it, so arithmetic statements about `df_q v` need this retyped |
| 32 | form. -/ |
| 33 | def mfderivReal (f : M → ℝ) (q : M) (v : TangentSpace I q) : ℝ := |
| 34 | mfderiv I 𝓘(ℝ, ℝ) f q v |
| 35 | |
| 36 | omit [FiniteDimensional ℝ E] [IsManifold I ∞ M] [I.Boundaryless] in |
| 37 | @[simp] theorem mfderivReal_def (f : M → ℝ) (q : M) (v : TangentSpace I q) : |
| 38 | mfderivReal (I := I) f q v = mfderiv I 𝓘(ℝ, ℝ) f q v := rfl |
| 39 | |
| 40 | omit [FiniteDimensional ℝ E] in |
| 41 | /-- The coordinate representative `f ∘ κ⁻¹` of a smooth function is `C^∞` at |
| 42 | each point of the chart target. -/ |
| 43 | theorem contDiffAt_comp_extChartAt_symm {f : M → ℝ} |
| 44 | (hf : ContMDiff I 𝓘(ℝ, ℝ) ∞ f) (z : M) {y : E} |
| 45 | (hy : y ∈ (extChartAt I z).target) : |
| 46 | ContDiffAt ℝ ∞ (f ∘ (extChartAt I z).symm) y := by |
| 47 | have hsymm : ContMDiffAt 𝓘(ℝ, E) I ∞ (extChartAt I z).symm y := |
| 48 | (contMDiffOn_extChartAt_symm (I := I) (n := ∞) z).contMDiffAt |
| 49 | ((isOpen_extChartAt_target (I := I) z).mem_nhds hy) |
| 50 | exact contMDiffAt_iff_contDiffAt.mp |
| 51 | (ContMDiffAt.comp y (hf ((extChartAt I z).symm y)) hsymm) |
| 52 | |
| 53 | omit [FiniteDimensional ℝ E] in |
| 54 | /-- The coordinate representative `f ∘ κ⁻¹` of a smooth function is `C^∞` on |
| 55 | the chart target. -/ |
| 56 | theorem contDiffOn_comp_extChartAt_symm {f : M → ℝ} |
| 57 | (hf : ContMDiff I 𝓘(ℝ, ℝ) ∞ f) (z : M) : |
| 58 | ContDiffOn ℝ ∞ (f ∘ (extChartAt I z).symm) (extChartAt I z).target := |
| 59 | fun _ hy => (contDiffAt_comp_extChartAt_symm hf z hy).contDiffWithinAt |
| 60 | |
| 61 | omit [FiniteDimensional ℝ E] [IsManifold I ∞ M] in |
| 62 | /-- The coordinate representative `f ∘ κ⁻¹` has the manifold differential |
| 63 | `df_y` as its (total) Fréchet derivative at `κ y`: for a boundaryless model, |
| 64 | `mfderiv` *is* the derivative of the chart representative. -/ |
| 65 | theorem hasFDerivAt_comp_extChartAt_symm {f : M → ℝ} |
| 66 | (hf : ContMDiff I 𝓘(ℝ, ℝ) ∞ f) (y : M) : |
| 67 | HasFDerivAt (f ∘ (extChartAt I y).symm) (mfderiv I 𝓘(ℝ, ℝ) f y) |
| 68 | (extChartAt I y y) := by |
| 69 | have hmd : MDifferentiableAt I 𝓘(ℝ, ℝ) f y := |
| 70 | (hf y).mdifferentiableAt (by simp) |
| 71 | have h := hmd.hasMFDerivAt.2 |
| 72 | rw [I.range_eq_univ, hasFDerivWithinAt_univ] at h |
| 73 | have hfun : writtenInExtChartAt I 𝓘(ℝ, ℝ) y f |
| 74 | = f ∘ (extChartAt I y).symm := by |
| 75 | simp [writtenInExtChartAt] |
| 76 | rwa [hfun] at h |
| 77 | |
| 78 | /-- **The adapted chart around a regular point** — the manifold layer of Lee's |
| 79 | Corollary A.26 in codimension one. |
| 80 | |
| 81 | If `f : M → ℝ` is smooth with `df_y ≠ 0`, the extended chart at `y` can be |
| 82 | corrected by a local `C^∞` diffeomorphism `G` of the model space, fixing |
| 83 | `κ y`, so that in the corrected chart `f` is **affine**: |
| 84 | `f (κ⁻¹ (G⁻¹ v)) = f y + df_y (v - κ y)` for every `v` in the target. |
| 85 | |
| 86 | In particular the level set `f ⁻¹' {f y}` corresponds to the affine hyperplane |
| 87 | slice `{v ∈ G.target | df_y (v - κ y) = 0}`: together with the smooth |
| 88 | compatibility of `G`, this exhibits `f` as the "last coordinate" of a chart — |
| 89 | the slice-chart normal form of the level set at `y`. -/ |
| 90 | theorem exists_extChartAt_openPartialHomeomorph_comp_symm_eq_affine |
| 91 | {f : M → ℝ} (hf : ContMDiff I 𝓘(ℝ, ℝ) ∞ f) (y : M) |
| 92 | (hdf : mfderiv I 𝓘(ℝ, ℝ) f y ≠ 0) : |
| 93 | ∃ G : OpenPartialHomeomorph E E, |
| 94 | G.source ⊆ (extChartAt I y).target ∧ |
| 95 | extChartAt I y y ∈ G.source ∧ |
| 96 | G (extChartAt I y y) = extChartAt I y y ∧ |
| 97 | ContDiffOn ℝ ∞ G G.source ∧ ContDiffOn ℝ ∞ G.symm G.target ∧ |
| 98 | ∀ v ∈ G.target, f ((extChartAt I y).symm (G.symm v)) |
| 99 | = f y + mfderivReal (I := I) f y (v - extChartAt I y y) := by |
| 100 | obtain ⟨G, h1, h2, h3, h4, h5, h6⟩ := |
| 101 | exists_openPartialHomeomorph_comp_symm_eq_affine |
| 102 | (isOpen_extChartAt_target (I := I) y) |
| 103 | (contDiffOn_comp_extChartAt_symm hf y) |
| 104 | (mem_extChartAt_target (I := I) y) |
| 105 | (hasFDerivAt_comp_extChartAt_symm hf y) hdf |
| 106 | refine ⟨G, h1, h2, h3, h4, h5, fun v hv => ?_⟩ |
| 107 | have h := h6 v hv |
| 108 | rw [Function.comp_apply, Function.comp_apply, extChartAt_to_inv] at h |
| 109 | rw [mfderivReal_def] |
| 110 | exact h |
| 111 | |
| 112 | end Poincare.Geometry.Manifold.RegularLevel |
| 113 | |
| 114 | end |