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 Mathlib.Geometry.Manifold.ContMDiffMFDeriv |
| 2 | import Mathlib.Geometry.Manifold.Instances.Real |
| 3 | import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ContDiff |
| 4 | import Mathlib.Analysis.InnerProductSpace.PiL2 |
| 5 | |
| 6 | /-! |
| 7 | # Openness at a nonsingular smooth point |
| 8 | |
| 9 | For a map between Euclidean manifolds without boundary, an invertible derivative |
| 10 | and local smoothness imply equality of the image and target neighborhood filters. |
| 11 | The proof applies the Euclidean inverse function theorem in the preferred charts. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped Manifold ContDiff 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 | set_option backward.isDefEq.respectTransparency false in |
| 27 | theorem map_nhds_eq_of_contMDiffAt_mfderiv_bijective {f : M → N} {x : M} |
| 28 | (hf : ContMDiffAt (𝓡 n) (𝓡 n) ∞ f x) |
| 29 | (hbij : Function.Bijective (mfderiv (𝓡 n) (𝓡 n) f x)) : |
| 30 | map f (𝓝 x) = 𝓝 (f x) := by |
| 31 | let c := extChartAt (𝓡 n) x |
| 32 | let d := extChartAt (𝓡 n) (f x) |
| 33 | let F := writtenInExtChartAt (𝓡 n) (𝓡 n) x f |
| 34 | have hF : ContDiffAt ℝ 1 F (c x) := by |
| 35 | simpa [F, c, writtenInExtChartAt, contDiffWithinAt_univ] using |
| 36 | (contMDiffAt_iff.mp (hf.of_le (by simp : (1 : ℕ∞ω) ≤ ∞))).2 |
| 37 | have hderiv : mfderiv (𝓡 n) (𝓡 n) f x = fderiv ℝ F (c x) := by |
| 38 | rw [mfderiv, if_pos (hf.mdifferentiableAt (by simp))] |
| 39 | simp [F, c] |
| 40 | have hFbij : Function.Bijective (fderiv ℝ F (c x)) := by |
| 41 | rwa [hderiv] at hbij |
| 42 | let e := ContinuousLinearEquiv.ofBijective (fderiv ℝ F (c x)) |
| 43 | (LinearMap.ker_eq_bot.mpr hFbij.1) (LinearMap.range_eq_top.mpr hFbij.2) |
| 44 | have hstrict : HasStrictFDerivAt F (e : EuclideanSpace ℝ (Fin n) →L[ℝ] |
| 45 | EuclideanSpace ℝ (Fin n)) (c x) := |
| 46 | hF.hasStrictFDerivAt' (hF.differentiableAt (by norm_num)).hasFDerivAt (by norm_num) |
| 47 | have hcmap : map c.symm (𝓝 (c x)) = 𝓝 x := by |
| 48 | simpa [c] using map_extChartAt_symm_nhdsWithin_range (I := 𝓡 n) x |
| 49 | have hdmap : map d.symm (𝓝 (d (f x))) = 𝓝 (f x) := by |
| 50 | simpa [d] using map_extChartAt_symm_nhdsWithin_range (I := 𝓡 n) (f x) |
| 51 | have hfc : Tendsto (f ∘ c.symm) (𝓝 (c x)) (𝓝 (f x)) := |
| 52 | hf.continuousAt.tendsto.comp hcmap.le |
| 53 | have heq : d.symm ∘ F =ᶠ[𝓝 (c x)] f ∘ c.symm := by |
| 54 | filter_upwards [hfc.eventually |
| 55 | ((isOpen_extChartAt_source (I := 𝓡 n) (f x)).mem_nhds |
| 56 | (mem_extChartAt_source (I := 𝓡 n) (f x)))] with y hy |
| 57 | exact d.left_inv hy |
| 58 | have hFx : F (c x) = d (f x) := by simp [F, c, d, writtenInExtChartAt] |
| 59 | calc |
| 60 | map f (𝓝 x) = map (f ∘ c.symm) (𝓝 (c x)) := by rw [← map_map, hcmap] |
| 61 | _ = map (d.symm ∘ F) (𝓝 (c x)) := map_congr heq.symm |
| 62 | _ = map d.symm (map F (𝓝 (c x))) := (map_map ..).symm |
| 63 | _ = map d.symm (𝓝 (F (c x))) := by rw [hstrict.map_nhds_eq_of_equiv] |
| 64 | _ = 𝓝 (f x) := by rw [hFx, hdmap] |
| 65 | |
| 66 | end Poincare |