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 | # Nonsingular smooth manifold maps are local diffeomorphisms |
| 6 | |
| 7 | The Euclidean inverse function theorem in source and target charts constructs |
| 8 | the local homeomorphism. The manifold local-left-inverse theorem supplies |
| 9 | smoothness of its inverse. |
| 10 | -/ |
| 11 | |
| 12 | noncomputable section |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped ContDiff Manifold Topology |
| 18 | |
| 19 | namespace Poincare |
| 20 | |
| 21 | variable {n : ℕ} {M N : Type*} [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 | /-- A smooth map on an open domain, with bijective derivative at every point |
| 27 | of that domain, is a local diffeomorphism there. -/ |
| 28 | theorem isLocalDiffeomorphOn_of_contMDiffOn_bijective_mfderiv |
| 29 | {f : M → N} {U : Set M} (hU : IsOpen U) |
| 30 | (hf : ContMDiffOn (𝓡 n) (𝓡 n) ∞ f U) |
| 31 | (hbij : ∀ x ∈ U, Function.Bijective (mfderiv (𝓡 n) (𝓡 n) f x)) : |
| 32 | IsLocalDiffeomorphOn (𝓡 n) (𝓡 n) ∞ f U := by |
| 33 | intro x |
| 34 | let c := chartAt (EuclideanSpace ℝ (Fin n)) (x : M) |
| 35 | let d := chartAt (EuclideanSpace ℝ (Fin n)) (f x) |
| 36 | let F := writtenInExtChartAt (𝓡 n) (𝓡 n) (x : M) f |
| 37 | have hfx := hf.contMDiffAt (hU.mem_nhds x.property) |
| 38 | have hF : ContDiffAt ℝ ∞ F (c x) := by |
| 39 | simpa [F, c, writtenInExtChartAt, contDiffWithinAt_univ] using |
| 40 | (contMDiffAt_iff.mp hfx).2 |
| 41 | have hderiv : mfderiv (𝓡 n) (𝓡 n) f x = fderiv ℝ F (c x) := by |
| 42 | rw [mfderiv, if_pos (hfx.mdifferentiableAt (by simp))] |
| 43 | simp [F, c] |
| 44 | have hFbij : Function.Bijective (fderiv ℝ F (c x)) := by |
| 45 | rw [← hderiv] |
| 46 | exact hbij x x.property |
| 47 | let A := ContinuousLinearEquiv.ofBijective (fderiv ℝ F (c x)) |
| 48 | (LinearMap.ker_eq_bot.mpr hFbij.1) (LinearMap.range_eq_top.mpr hFbij.2) |
| 49 | have hdF : HasFDerivAt F A.toContinuousLinearMap (c x) := |
| 50 | (hF.differentiableAt (by simp)).hasFDerivAt |
| 51 | let Q := hF.toOpenPartialHomeomorph F hdF (by simp) |
| 52 | let H := (c.trans (Q.trans d.symm)).restr (U ∩ f ⁻¹' d.source) |
| 53 | have hFc (z : M) (hz : z ∈ c.source) : F (c z) = d (f z) := by |
| 54 | change d (f (c.symm (c z))) = d (f z) |
| 55 | rw [c.left_inv hz] |
| 56 | have hxH : (x : M) ∈ H.source := by |
| 57 | rw [OpenPartialHomeomorph.restr_source, OpenPartialHomeomorph.trans_source, |
| 58 | OpenPartialHomeomorph.trans_source] |
| 59 | refine ⟨⟨mem_chart_source _ _, ⟨hF.mem_toOpenPartialHomeomorph_source hdF (by simp), |
| 60 | ?_⟩⟩, ?_⟩ |
| 61 | · change F (c x) ∈ d.target |
| 62 | rw [hFc x (mem_chart_source _ _)] |
| 63 | exact d.map_source (mem_chart_source _ _) |
| 64 | · apply mem_interior_iff_mem_nhds.mpr |
| 65 | exact inter_mem (hU.mem_nhds x.property) |
| 66 | (hfx.continuousAt.preimage_mem_nhds (d.open_source.mem_nhds (mem_chart_source _ _))) |
| 67 | have hsub : H.source ⊆ U := fun z hz => (interior_subset hz.2).1 |
| 68 | have heq : EqOn f H H.source := by |
| 69 | intro z hz |
| 70 | have hsrc : f z ∈ d.source := (interior_subset hz.2).2 |
| 71 | change f z = d.symm (F (c z)) |
| 72 | rw [hFc z hz.1.1, d.left_inv hsrc] |
| 73 | have hH : ContMDiffOn (𝓡 n) (𝓡 n) ∞ H H.source := |
| 74 | (hf.mono hsub).congr heq.symm |
| 75 | have hHi : ContMDiffOn (𝓡 n) (𝓡 n) ∞ H.symm H.target := by |
| 76 | intro y hy |
| 77 | have hz := H.symm.map_source hy |
| 78 | have hfy : f (H.symm y) = y := (heq hz).trans (H.right_inv hy) |
| 79 | have hleft : ∀ᶠ z in 𝓝 (H.symm y), H.symm (f z) = z := by |
| 80 | filter_upwards [H.open_source.mem_nhds hz] with z hzs |
| 81 | rw [heq hzs] |
| 82 | exact H.left_inv hzs |
| 83 | have hs := contMDiffAt_of_local_left_inverse |
| 84 | (hf.contMDiffAt (hU.mem_nhds (hsub hz))) (hbij _ (hsub hz)) hleft |
| 85 | rw [hfy] at hs |
| 86 | exact hs.contMDiffWithinAt |
| 87 | let Φ : PartialDiffeomorph (𝓡 n) (𝓡 n) M N ∞ := { |
| 88 | toPartialEquiv := H.toPartialEquiv |
| 89 | open_source := H.open_source |
| 90 | open_target := H.open_target |
| 91 | contMDiffOn_toFun := hH |
| 92 | contMDiffOn_invFun := hHi } |
| 93 | exact ⟨Φ, hxH, heq⟩ |
| 94 | |
| 95 | /-- A globally smooth map between manifolds with bijective derivatives is a |
| 96 | local diffeomorphism. -/ |
| 97 | theorem isLocalDiffeomorph_of_contMDiff_bijective_mfderiv |
| 98 | {f : M → N} (hf : ContMDiff (𝓡 n) (𝓡 n) ∞ f) |
| 99 | (hbij : ∀ x, Function.Bijective (mfderiv (𝓡 n) (𝓡 n) f x)) : |
| 100 | IsLocalDiffeomorph (𝓡 n) (𝓡 n) ∞ f := by |
| 101 | intro x |
| 102 | exact isLocalDiffeomorphOn_of_contMDiffOn_bijective_mfderiv isOpen_univ |
| 103 | hf.contMDiffOn (fun y _ => hbij y) ⟨x, mem_univ x⟩ |
| 104 | |
| 105 | end Poincare |