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.InverseFunction |
| 2 | |
| 3 | /-! |
| 4 | # Smooth inverses initially given only within an image |
| 5 | |
| 6 | A smooth left inverse within the image forces the differential of an |
| 7 | equal-dimensional chart to be invertible. Its image is then open, so |
| 8 | the inverse is smooth at image points. Used for the M36 comparison |
| 9 | charts in Morgan--Tian, Claim 16.6, pp. 371-372. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | |
| 15 | open Set Filter |
| 16 | open scoped Manifold ContDiff Topology |
| 17 | |
| 18 | namespace Poincare |
| 19 | |
| 20 | variable {n : ℕ} {M N : Type*} [TopologicalSpace M] [TopologicalSpace N] |
| 21 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) N] |
| 23 | [IsManifold (𝓡 n) ∞ M] [IsManifold (𝓡 n) ∞ N] |
| 24 | |
| 25 | omit [IsManifold (𝓡 n) ∞ M] [IsManifold (𝓡 n) ∞ N] in |
| 26 | /-- A smooth left inverse within the image of an open equal-dimensional |
| 27 | chart makes the chart differential bijective. -/ |
| 28 | theorem mfderiv_bijective_of_smooth_leftInvOn |
| 29 | {f : M → N} {inverse : N → M} {U : Set M} (hU : IsOpen U) |
| 30 | (hf : ContMDiffOn (𝓡 n) (𝓡 n) ∞ f U) |
| 31 | (hi : ContMDiffOn (𝓡 n) (𝓡 n) ∞ inverse (f '' U)) |
| 32 | (hleft : LeftInvOn inverse f U) {x : M} (hx : x ∈ U) : |
| 33 | Function.Bijective (mfderiv (𝓡 n) (𝓡 n) f x) := by |
| 34 | have hfx := (hf x hx).contMDiffAt (hU.mem_nhds hx) |
| 35 | have hunique := hU.uniqueMDiffWithinAt (I := 𝓡 n) hx |
| 36 | have hcomp := mfderivWithin_comp (I := 𝓡 n) (I' := 𝓡 n) (I'' := 𝓡 n) x |
| 37 | ((hi _ (mem_image_of_mem f hx)).mdifferentiableWithinAt (by simp)) |
| 38 | ((hf x hx).mdifferentiableWithinAt (by simp)) (mapsTo_image f U) hunique |
| 39 | have hid : mfderivWithin (𝓡 n) (𝓡 n) (inverse ∘ f) U x = |
| 40 | ContinuousLinearMap.id ℝ (TangentSpace (𝓡 n) x) := by |
| 41 | exact (mfderivWithin_congr_of_mem (I := 𝓡 n) (I' := 𝓡 n) |
| 42 | (f₁ := inverse ∘ f) (f := id) (fun _ hy => hleft hy) hx).trans |
| 43 | (mfderivWithin_id hunique) |
| 44 | rw [hid, mfderivWithin_eq_mfderiv hunique |
| 45 | (hfx.mdifferentiableAt (by simp))] at hcomp |
| 46 | have hleftD : Function.LeftInverse |
| 47 | (mfderivWithin (𝓡 n) (𝓡 n) inverse (f '' U) (f x)) |
| 48 | (mfderiv (𝓡 n) (𝓡 n) f x) := by |
| 49 | intro v |
| 50 | exact (congrArg (fun L => L v) hcomp).symm |
| 51 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) x) := by |
| 52 | unfold TangentSpace |
| 53 | infer_instance |
| 54 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) (f x)) := by |
| 55 | unfold TangentSpace |
| 56 | infer_instance |
| 57 | have hfin : Module.finrank ℝ (TangentSpace (𝓡 n) x) = |
| 58 | Module.finrank ℝ (TangentSpace (𝓡 n) (f x)) := rfl |
| 59 | exact ⟨hleftD.injective, |
| 60 | (LinearMap.injective_iff_surjective_of_finrank_eq_finrank hfin).mp hleftD.injective⟩ |
| 61 | |
| 62 | /-- A smooth chart with a smooth left inverse within its image has open |
| 63 | image; inverse smoothness within the image suffices for this conclusion. -/ |
| 64 | theorem isOpen_image_of_smooth_leftInvOn |
| 65 | {f : M → N} {inverse : N → M} {U : Set M} (hU : IsOpen U) |
| 66 | (hf : ContMDiffOn (𝓡 n) (𝓡 n) ∞ f U) |
| 67 | (hi : ContMDiffOn (𝓡 n) (𝓡 n) ∞ inverse (f '' U)) |
| 68 | (hleft : LeftInvOn inverse f U) : IsOpen (f '' U) := by |
| 69 | apply isOpen_iff_mem_nhds.mpr |
| 70 | rintro _ ⟨x, hx, rfl⟩ |
| 71 | rw [← map_nhds_eq_of_contMDiffAt_mfderiv_bijective |
| 72 | ((hf x hx).contMDiffAt (hU.mem_nhds hx)) |
| 73 | (mfderiv_bijective_of_smooth_leftInvOn hU hf hi hleft hx)] |
| 74 | exact image_mem_map (hU.mem_nhds hx) |
| 75 | |
| 76 | /-- The given inverse is smooth at each image point once the open image |
| 77 | has been obtained from the smooth left inverse. -/ |
| 78 | theorem contMDiffAt_inverse_of_smooth_leftInvOn |
| 79 | {f : M → N} {inverse : N → M} {U : Set M} (hU : IsOpen U) |
| 80 | (hf : ContMDiffOn (𝓡 n) (𝓡 n) ∞ f U) |
| 81 | (hi : ContMDiffOn (𝓡 n) (𝓡 n) ∞ inverse (f '' U)) |
| 82 | (hleft : LeftInvOn inverse f U) {y : N} (hy : y ∈ f '' U) : |
| 83 | ContMDiffAt (𝓡 n) (𝓡 n) ∞ inverse y := |
| 84 | (hi y hy).contMDiffAt ((isOpen_image_of_smooth_leftInvOn hU hf hi hleft).mem_nhds hy) |
| 85 | |
| 86 | end Poincare |