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.SmoothEmbedding |
| 2 | import Mathlib.Geometry.Manifold.ContMDiff.Atlas |
| 3 | import Mathlib.Topology.Homeomorph.Lemmas |
| 4 | |
| 5 | /-! |
| 6 | # Reparametrizing smooth embeddings |
| 7 | |
| 8 | Precomposition by a diffeomorphism transports the immersion source charts. |
| 9 | Two smooth embeddings with the same range have a smooth reparametrization: |
| 10 | their range homeomorphism is smooth by the immersion composition criterion. |
| 11 | -/ |
| 12 | |
| 13 | noncomputable section |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set |
| 18 | open scoped Manifold ContDiff |
| 19 | |
| 20 | namespace Manifold |
| 21 | |
| 22 | variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] |
| 23 | {E F G : Type*} |
| 24 | [NormedAddCommGroup E] [NormedSpace 𝕜 E] |
| 25 | [NormedAddCommGroup F] [NormedSpace 𝕜 F] |
| 26 | [NormedAddCommGroup G] [NormedSpace 𝕜 G] |
| 27 | {M N : Type*} [TopologicalSpace M] [ChartedSpace E M] |
| 28 | [TopologicalSpace N] [ChartedSpace G N] {n : ℕ∞ω} |
| 29 | [IsManifold 𝓘(𝕜, E) n M] {f g : M → N} |
| 30 | |
| 31 | /-- A change of source coordinates preserves an immersion with its given |
| 32 | normal complement. -/ |
| 33 | theorem IsImmersionOfComplement.comp_diffeomorph |
| 34 | (hf : IsImmersionOfComplement F 𝓘(𝕜, E) 𝓘(𝕜, G) n f) |
| 35 | (e : Diffeomorph 𝓘(𝕜, E) 𝓘(𝕜, E) M M n) : |
| 36 | IsImmersionOfComplement F 𝓘(𝕜, E) 𝓘(𝕜, G) n (f ∘ e) := by |
| 37 | intro x |
| 38 | let h := hf (e x) |
| 39 | let d := e.toHomeomorph.toOpenPartialHomeomorph.trans h.domChart |
| 40 | have hd : d ∈ IsManifold.maximalAtlas 𝓘(𝕜, E) n M := by |
| 41 | apply d.mem_maximalAtlas_of_contMDiffOn |
| 42 | · exact (contMDiffOn_of_mem_maximalAtlas h.domChart_mem_maximalAtlas).comp |
| 43 | e.contMDiff.contMDiffOn (fun y hy => hy.2) |
| 44 | · exact e.symm.contMDiff.comp_contMDiffOn |
| 45 | ((contMDiffOn_symm_of_mem_maximalAtlas h.domChart_mem_maximalAtlas).mono |
| 46 | inter_subset_left) |
| 47 | have hx : x ∈ d.source := ⟨mem_univ _, h.mem_domChart_source⟩ |
| 48 | have hsource (y : M) (hy : y ∈ d.source) : f (e y) ∈ h.codChart.source := |
| 49 | h.source_subset_preimage_source hy.2 |
| 50 | apply IsImmersionAtOfComplement.mk_of_charts h.equiv d h.codChart hx (hsource x hx) |
| 51 | hd h.codChart_mem_maximalAtlas hsource |
| 52 | intro v hv |
| 53 | have hv' : v ∈ h.domChart.target := by |
| 54 | have hvt : v ∈ d.target := by simpa using hv |
| 55 | exact hvt.1 |
| 56 | change h.codChart (f (e (e.symm (h.domChart.symm v)))) = h.equiv (v, 0) |
| 57 | rw [e.apply_symm_apply] |
| 58 | exact h.writtenInCharts (by simpa using hv') |
| 59 | |
| 60 | /-- Reparametrizing the source of a smooth embedding by a diffeomorphism |
| 61 | preserves its smooth embedding property. -/ |
| 62 | theorem IsSmoothEmbedding.comp_diffeomorph |
| 63 | (hf : IsSmoothEmbedding 𝓘(𝕜, E) 𝓘(𝕜, G) n f) |
| 64 | (e : Diffeomorph 𝓘(𝕜, E) 𝓘(𝕜, E) M M n) : |
| 65 | IsSmoothEmbedding 𝓘(𝕜, E) 𝓘(𝕜, G) n (f ∘ e) := |
| 66 | ⟨(hf.isImmersion.isImmersionOfComplement_complement.comp_diffeomorph e).isImmersion, |
| 67 | hf.isEmbedding.comp e.toHomeomorph.isEmbedding⟩ |
| 68 | |
| 69 | omit [IsManifold 𝓘(𝕜, E) n M] in |
| 70 | /-- Equal images of smooth embeddings give an actual smooth change of |
| 71 | parameter, with a pointwise identity between the two maps. -/ |
| 72 | theorem IsSmoothEmbedding.exists_reparametrizing_diffeomorph |
| 73 | (hf : IsSmoothEmbedding 𝓘(𝕜, E) 𝓘(𝕜, G) n f) |
| 74 | (hg : IsSmoothEmbedding 𝓘(𝕜, E) 𝓘(𝕜, G) n g) |
| 75 | (hrange : range f = range g) : |
| 76 | ∃ e : Diffeomorph 𝓘(𝕜, E) 𝓘(𝕜, E) M M n, ∀ x, g (e x) = f x := by |
| 77 | let e : M ≃ₜ M := hf.isEmbedding.toHomeomorph.trans |
| 78 | ((Homeomorph.setCongr hrange).trans hg.isEmbedding.toHomeomorph.symm) |
| 79 | have heq (x : M) : g (e x) = f x := by |
| 80 | have h := congrArg Subtype.val (hg.isEmbedding.toHomeomorph.apply_symm_apply |
| 81 | ((Homeomorph.setCongr hrange) (hf.isEmbedding.toHomeomorph x))) |
| 82 | exact h |
| 83 | have hinv (x : M) : f (e.symm x) = g x := by |
| 84 | rw [← heq (e.symm x), e.apply_symm_apply] |
| 85 | have hsmooth : ContMDiff 𝓘(𝕜, E) 𝓘(𝕜, E) n e := by |
| 86 | apply (ContMDiff.iff_comp_isImmersion hg.isImmersion).mpr |
| 87 | refine ⟨e.continuous, ?_⟩ |
| 88 | have he : g ∘ e = f := funext heq |
| 89 | rw [he] |
| 90 | exact hf.contMDiff |
| 91 | have hinverse : ContMDiff 𝓘(𝕜, E) 𝓘(𝕜, E) n e.symm := by |
| 92 | apply (ContMDiff.iff_comp_isImmersion hf.isImmersion).mpr |
| 93 | refine ⟨e.symm.continuous, ?_⟩ |
| 94 | have he : f ∘ e.symm = g := funext hinv |
| 95 | rw [he] |
| 96 | exact hg.contMDiff |
| 97 | exact ⟨{ e.toEquiv with contMDiff_toFun := hsmooth, contMDiff_invFun := hinverse }, heq⟩ |
| 98 | |
| 99 | end Manifold |