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.LocalDiffeomorph |
| 3 | import Mathlib.Geometry.Manifold.ContMDiff.Atlas |
| 4 | |
| 5 | /-! |
| 6 | # Transport of immersions through local diffeomorphisms |
| 7 | |
| 8 | For manifolds without boundary, a local diffeomorphism preserves the chart |
| 9 | normal form of an immersion. Compact injective immersions therefore descend |
| 10 | to smooth embeddings through a local diffeomorphism. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set |
| 16 | open scoped Manifold ContDiff |
| 17 | |
| 18 | namespace Manifold |
| 19 | |
| 20 | variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] |
| 21 | {E G F : Type*} |
| 22 | [NormedAddCommGroup E] [NormedSpace 𝕜 E] |
| 23 | [NormedAddCommGroup G] [NormedSpace 𝕜 G] |
| 24 | [NormedAddCommGroup F] [NormedSpace 𝕜 F] |
| 25 | {M N P : Type*} [TopologicalSpace M] [ChartedSpace E M] |
| 26 | [TopologicalSpace N] [ChartedSpace G N] |
| 27 | [TopologicalSpace P] [ChartedSpace G P] |
| 28 | {n : ℕ∞ω} [IsManifold 𝓘(𝕜, G) n P] |
| 29 | {f : M → N} {p : N → P} |
| 30 | |
| 31 | /-- Postcomposition by a local diffeomorphism preserves a fixed immersion complement. -/ |
| 32 | theorem IsImmersionOfComplement.comp_localDiffeomorph |
| 33 | (hf : IsImmersionOfComplement F 𝓘(𝕜, E) 𝓘(𝕜, G) n f) |
| 34 | (hp : IsLocalDiffeomorph 𝓘(𝕜, G) 𝓘(𝕜, G) n p) : |
| 35 | IsImmersionOfComplement F 𝓘(𝕜, E) 𝓘(𝕜, G) n (p ∘ f) := by |
| 36 | intro x |
| 37 | let h := hf x |
| 38 | obtain ⟨φ, hx, heq⟩ := hp (f x) |
| 39 | let s := f ⁻¹' φ.source |
| 40 | have hs : IsOpen s := φ.open_source.preimage hf.contMDiff.continuous |
| 41 | let d := h.domChart.restr s |
| 42 | let b := φ.symm.toOpenPartialHomeomorph.trans h.codChart |
| 43 | have hdsource : d.source = h.domChart.source ∩ s := |
| 44 | h.domChart.restr_source' s hs |
| 45 | have hb : b ∈ IsManifold.maximalAtlas 𝓘(𝕜, G) n P := by |
| 46 | apply b.mem_maximalAtlas_of_contMDiffOn |
| 47 | · exact (contMDiffOn_of_mem_maximalAtlas h.codChart_mem_maximalAtlas).comp |
| 48 | (φ.symm.contMDiffOn.mono inter_subset_left) inter_subset_right |
| 49 | · exact φ.contMDiffOn.comp |
| 50 | ((contMDiffOn_symm_of_mem_maximalAtlas h.codChart_mem_maximalAtlas).mono |
| 51 | inter_subset_left) inter_subset_right |
| 52 | have hsource (y : M) (hy : y ∈ d.source) : p (f y) ∈ b.source := by |
| 53 | rw [hdsource] at hy |
| 54 | have hfy : f y ∈ φ.source := hy.2 |
| 55 | change p (f y) ∈ φ.target ∧ φ.symm (p (f y)) ∈ h.codChart.source |
| 56 | rw [heq hfy] |
| 57 | change φ (f y) ∈ φ.target ∧ φ.toPartialEquiv.symm (φ.toPartialEquiv (f y)) ∈ _ |
| 58 | rw [φ.toPartialEquiv.left_inv hfy] |
| 59 | exact ⟨φ.map_source hfy, h.source_subset_preimage_source hy.1⟩ |
| 60 | have hdx : x ∈ d.source := by rw [hdsource]; exact ⟨h.mem_domChart_source, hx⟩ |
| 61 | apply IsImmersionAtOfComplement.mk_of_charts h.equiv d b hdx (hsource x hdx) |
| 62 | (restr_mem_maximalAtlas _ h.domChart_mem_maximalAtlas hs) hb hsource |
| 63 | intro v hv |
| 64 | have hv' : v ∈ d.target := by simpa using hv |
| 65 | have hdv := d.map_target hv' |
| 66 | rw [hdsource] at hdv |
| 67 | have hfv : f (d.symm v) ∈ φ.source := hdv.2 |
| 68 | change h.codChart (φ.symm (p (f (d.symm v)))) = h.equiv (v, 0) |
| 69 | rw [heq hfv] |
| 70 | change h.codChart (φ.toPartialEquiv.symm (φ.toPartialEquiv (f (d.symm v)))) = _ |
| 71 | rw [φ.toPartialEquiv.left_inv hfv] |
| 72 | apply h.writtenInCharts |
| 73 | simpa using hv'.1 |
| 74 | |
| 75 | /-- A local diffeomorphism preserves immersions between manifolds without boundary. -/ |
| 76 | theorem IsImmersion.comp_localDiffeomorph |
| 77 | (hf : IsImmersion 𝓘(𝕜, E) 𝓘(𝕜, G) n f) |
| 78 | (hp : IsLocalDiffeomorph 𝓘(𝕜, G) 𝓘(𝕜, G) n p) : |
| 79 | IsImmersion 𝓘(𝕜, E) 𝓘(𝕜, G) n (p ∘ f) := |
| 80 | (hf.isImmersionOfComplement_complement.comp_localDiffeomorph hp).isImmersion |
| 81 | |
| 82 | /-- An injective projection of a compact smooth embedding through a local |
| 83 | diffeomorphism is again a smooth embedding. -/ |
| 84 | theorem IsSmoothEmbedding.comp_localDiffeomorph [CompactSpace M] [T2Space P] |
| 85 | (hf : IsSmoothEmbedding 𝓘(𝕜, E) 𝓘(𝕜, G) n f) |
| 86 | (hp : IsLocalDiffeomorph 𝓘(𝕜, G) 𝓘(𝕜, G) n p) |
| 87 | (hinj : Function.Injective (p ∘ f)) : |
| 88 | IsSmoothEmbedding 𝓘(𝕜, E) 𝓘(𝕜, G) n (p ∘ f) := by |
| 89 | have hi := hf.isImmersion.comp_localDiffeomorph hp |
| 90 | exact ⟨hi, (hi.contMDiff.continuous.isClosedEmbedding hinj).isEmbedding⟩ |
| 91 | |
| 92 | end Manifold |