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.SmoothInverse |
| 2 | import Mathlib.Geometry.Manifold.LocalDiffeomorph |
| 3 | |
| 4 | /-! |
| 5 | # Smooth inverse charts on open injectivity domains |
| 6 | |
| 7 | An injective smooth map with nonsingular differential on an open set |
| 8 | has a smooth inverse on its image. The inverse is selected only on that |
| 9 | image. This is the chart step of Morgan--Tian, Claim 16.6 and |
| 10 | Corollary 16.7, pp. 371-372; see derivation 20. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped Manifold ContDiff Topology |
| 18 | |
| 19 | namespace Poincare |
| 20 | |
| 21 | variable {n : ℕ} {M N : Type*} [Nonempty M] [TopologicalSpace M] [TopologicalSpace N] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) N] |
| 24 | [IsManifold (𝓡 n) ∞ M] [IsManifold (𝓡 n) ∞ N] |
| 25 | |
| 26 | omit [Nonempty M] in |
| 27 | /-- The image of an open nonsingularity domain is open, without an |
| 28 | injectivity assumption. -/ |
| 29 | theorem isOpen_image_of_mfderiv_bijective {f : M → N} {U : Set M} |
| 30 | (hU : IsOpen U) (hf : ContMDiffOn (𝓡 n) (𝓡 n) ∞ f U) |
| 31 | (hD : ∀ x ∈ U, Function.Bijective (mfderiv (𝓡 n) (𝓡 n) f x)) : |
| 32 | IsOpen (f '' U) := by |
| 33 | apply isOpen_iff_mem_nhds.mpr |
| 34 | rintro _ ⟨x, hx, rfl⟩ |
| 35 | rw [← map_nhds_eq_of_contMDiffAt_mfderiv_bijective |
| 36 | (hf.contMDiffAt (hU.mem_nhds hx)) (hD x hx)] |
| 37 | exact image_mem_map (hU.mem_nhds hx) |
| 38 | |
| 39 | /-- The inverse chosen on an injectivity domain is smooth at all image |
| 40 | points when the original differential is nonsingular. -/ |
| 41 | theorem contMDiffOn_invFunOn_of_mfderiv_bijective {f : M → N} {U : Set M} |
| 42 | (hU : IsOpen U) (hf : ContMDiffOn (𝓡 n) (𝓡 n) ∞ f U) (hinj : InjOn f U) |
| 43 | (hD : ∀ x ∈ U, Function.Bijective (mfderiv (𝓡 n) (𝓡 n) f x)) : |
| 44 | ContMDiffOn (𝓡 n) (𝓡 n) ∞ (Function.invFunOn f U) (f '' U) := by |
| 45 | rintro _ ⟨x, hx, rfl⟩ |
| 46 | apply ContMDiffAt.contMDiffWithinAt |
| 47 | apply contMDiffAt_of_local_left_inverse (hf.contMDiffAt (hU.mem_nhds hx)) (hD x hx) |
| 48 | filter_upwards [hU.mem_nhds hx] with z hz |
| 49 | exact hinj.leftInvOn_invFunOn hz |
| 50 | |
| 51 | /-- The actual smooth map, restricted to its open injectivity domain, |
| 52 | defines a partial diffeomorphism onto its literal image. -/ |
| 53 | noncomputable def partialDiffeomorphOfInjOn |
| 54 | (f : M → N) (U : Set M) (hU : IsOpen U) |
| 55 | (hf : ContMDiffOn (𝓡 n) (𝓡 n) ∞ f U) (hinj : InjOn f U) |
| 56 | (hD : ∀ x ∈ U, Function.Bijective (mfderiv (𝓡 n) (𝓡 n) f x)) : |
| 57 | PartialDiffeomorph (𝓡 n) (𝓡 n) M N ∞ where |
| 58 | toFun := f |
| 59 | invFun := Function.invFunOn f U |
| 60 | source := U |
| 61 | target := f '' U |
| 62 | map_source' := fun _ hx => mem_image_of_mem f hx |
| 63 | map_target' := fun _ hx => Function.invFunOn_mem hx |
| 64 | left_inv' := hinj.leftInvOn_invFunOn |
| 65 | right_inv' := fun _ hx => Function.invFunOn_eq hx |
| 66 | open_source := hU |
| 67 | open_target := isOpen_image_of_mfderiv_bijective hU hf hD |
| 68 | contMDiffOn_toFun := hf |
| 69 | contMDiffOn_invFun := contMDiffOn_invFunOn_of_mfderiv_bijective hU hf hinj hD |
| 70 | |
| 71 | end Poincare |