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 | import Mathlib.Topology.IsLocalHomeomorph |
| 3 | |
| 4 | /-! |
| 5 | # A smooth nonsingular map is a local homeomorphism |
| 6 | |
| 7 | The Euclidean inverse function theorem in the actual preferred charts |
| 8 | provides local inverse branches on manifolds without boundary. This |
| 9 | turns the injective angular differential into the topological local |
| 10 | homeomorphism in Morgan--Tian, Claim 16.10, pp. 374-375; |
| 11 | see M44 derivation 46. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set Filter |
| 18 | open scoped Manifold ContDiff Topology |
| 19 | |
| 20 | namespace Poincare |
| 21 | |
| 22 | /-- A smooth map between equal-dimensional Euclidean manifolds |
| 23 | with bijective differentials is a local homeomorphism. Source: |
| 24 | the angular projection in Claim 16.10; M44 derivation 46. -/ |
| 25 | theorem isLocalHomeomorph_of_mfderiv_bijective |
| 26 | {n : ℕ} {M N : Type*} [TopologicalSpace M] [TopologicalSpace N] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) N] |
| 29 | [IsManifold (𝓡 n) ∞ M] [IsManifold (𝓡 n) ∞ N] |
| 30 | {f : M → N} (hf : ContMDiff (𝓡 n) (𝓡 n) ∞ f) |
| 31 | (hbij : ∀ x, Function.Bijective (mfderiv (𝓡 n) (𝓡 n) f x)) : |
| 32 | IsLocalHomeomorph f := by |
| 33 | rw [isLocalHomeomorph_iff_isLocalHomeomorphOn_univ] |
| 34 | apply IsLocalHomeomorphOn.mk |
| 35 | intro x _ |
| 36 | let c : OpenPartialHomeomorph M (EuclideanSpace ℝ (Fin n)) := |
| 37 | chartAt (EuclideanSpace ℝ (Fin n)) x |
| 38 | let d : OpenPartialHomeomorph N (EuclideanSpace ℝ (Fin n)) := |
| 39 | chartAt (EuclideanSpace ℝ (Fin n)) (f x) |
| 40 | let F := writtenInExtChartAt (𝓡 n) (𝓡 n) x f |
| 41 | have hF : ContDiffAt ℝ ∞ F (c x) := by |
| 42 | simpa [F, c, contDiffWithinAt_univ] using (contMDiffAt_iff.mp (hf x)).2 |
| 43 | have hderiv : mfderiv (𝓡 n) (𝓡 n) f x = fderiv ℝ F (c x) := by |
| 44 | rw [mfderiv, if_pos ((hf x).mdifferentiableAt (by simp))] |
| 45 | simp [F, c] |
| 46 | have hFbij : Function.Bijective (fderiv ℝ F (c x)) := by rw [← hderiv]; exact hbij x |
| 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 : EuclideanSpace ℝ (Fin n) →L[ℝ] |
| 50 | EuclideanSpace ℝ (Fin n)) (c x) := (hF.differentiableAt (by simp)).hasFDerivAt |
| 51 | let H := hF.toOpenPartialHomeomorph F hdF (by simp) |
| 52 | have hF_eq : F = d ∘ f ∘ c.symm := by |
| 53 | ext y |
| 54 | simp [F, c, d, writtenInExtChartAt, extChartAt, OpenPartialHomeomorph.extend] |
| 55 | let e := ((c.trans H).trans d.symm).restrOpen (f ⁻¹' d.source) |
| 56 | (d.open_source.preimage hf.continuous) |
| 57 | have hcx : x ∈ c.source := mem_chart_source _ _ |
| 58 | have hdx : f x ∈ d.source := mem_chart_source _ _ |
| 59 | have hex : x ∈ e.source := by |
| 60 | refine ⟨⟨⟨hcx, hF.mem_toOpenPartialHomeomorph_source hdF (by simp)⟩, ?_⟩, hdx⟩ |
| 61 | change F (c x) ∈ d.target |
| 62 | rw [hF_eq, Function.comp_apply, Function.comp_apply, c.left_inv hcx] |
| 63 | exact d.map_source hdx |
| 64 | refine ⟨e, hex, ?_⟩ |
| 65 | intro y hy |
| 66 | change f y = d.symm (F (c y)) |
| 67 | rw [hF_eq, Function.comp_apply, Function.comp_apply, c.left_inv hy.1.1.1, |
| 68 | d.left_inv hy.2] |
| 69 | |
| 70 | end Poincare |