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.Constructions |
| 3 | import Mathlib.Geometry.Manifold.ContMDiff.NormedSpace |
| 4 | |
| 5 | /-! |
| 6 | # Smooth slices of product coordinates |
| 7 | |
| 8 | A slice of a smooth open partial homeomorphism is a smooth embedding. |
| 9 | The proof uses the chart normal form of Mathlib's immersion definition. |
| 10 | This supports Morgan--Tian Definition 2.18, p. 31, and Lemma A.13, p. 505. |
| 11 | |
| 12 | Adapted from Mapher, `PoincareMT/Proofs/M25/Mathlib/SmoothSlice.lean`, |
| 13 | commit `56d9cc710a322b1e69daa9353c1758b861c0e3fe`. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set |
| 19 | open scoped Manifold ContDiff |
| 20 | |
| 21 | namespace OpenPartialHomeomorph |
| 22 | |
| 23 | variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] |
| 24 | {E F G : Type*} |
| 25 | [NormedAddCommGroup E] [NormedSpace 𝕜 E] |
| 26 | [NormedAddCommGroup F] [NormedSpace 𝕜 F] |
| 27 | [NormedAddCommGroup G] [NormedSpace 𝕜 G] |
| 28 | {M N : Type*} [TopologicalSpace M] [ChartedSpace E M] |
| 29 | [TopologicalSpace N] [ChartedSpace G N] {n : ℕ∞ω} |
| 30 | [IsManifold 𝓘(𝕜, E) n M] [IsManifold 𝓘(𝕜, G) n N] |
| 31 | |
| 32 | /-- A full product slice in smooth coordinates is a smooth embedding. |
| 33 | The complement and its linear identification are explicit, as required by |
| 34 | the immersion normal form. -/ |
| 35 | theorem isSmoothEmbedding_slice (e : OpenPartialHomeomorph (M × F) N) |
| 36 | (he : ContMDiffOn (𝓘(𝕜, E).prod 𝓘(𝕜, F)) 𝓘(𝕜, G) n e e.source) |
| 37 | (hi : ContMDiffOn 𝓘(𝕜, G) (𝓘(𝕜, E).prod 𝓘(𝕜, F)) n e.symm e.target) |
| 38 | (L : (E × F) ≃L[𝕜] G) (c : F) (hc : ∀ x : M, (x, c) ∈ e.source) : |
| 39 | Manifold.IsSmoothEmbedding 𝓘(𝕜, E) 𝓘(𝕜, G) n (fun x => e (x, c)) := by |
| 40 | refine ⟨?_, e.isEmbedding_restrict.comp |
| 41 | ((isEmbedding_prodMkLeft c).codRestrict e.source hc)⟩ |
| 42 | apply Manifold.IsImmersionOfComplement.isImmersion (F := F) |
| 43 | intro x |
| 44 | let d := chartAt E x |
| 45 | let p := d.prod (Homeomorph.addRight (-c)).toOpenPartialHomeomorph |
| 46 | let b := (e.symm.trans p).trans L.toHomeomorph.toOpenPartialHomeomorph |
| 47 | have hp : ContMDiffOn (𝓘(𝕜, E).prod 𝓘(𝕜, F)) 𝓘(𝕜, E × F) n p p.source := by |
| 48 | have hshift : ContMDiff 𝓘(𝕜, F) 𝓘(𝕜, F) n (fun y : F => y + -c) := |
| 49 | (contDiff_id.add contDiff_const).contMDiff |
| 50 | exact ((contMDiffOn_chart (I := 𝓘(𝕜, E)) (x := x)).comp |
| 51 | contMDiffOn_fst (fun y hy => hy.1)).prodMk_space |
| 52 | (hshift.comp_contMDiffOn contMDiffOn_snd) |
| 53 | have hp' : ContMDiffOn 𝓘(𝕜, E × F) (𝓘(𝕜, E).prod 𝓘(𝕜, F)) n |
| 54 | p.symm p.target := by |
| 55 | have hshift : ContMDiff 𝓘(𝕜, E × F) 𝓘(𝕜, F) n |
| 56 | (fun y : E × F => y.2 + -(-c)) := |
| 57 | (contDiff_snd.add contDiff_const).contMDiff |
| 58 | exact ((contMDiffOn_chart_symm (I := 𝓘(𝕜, E)) (x := x)).comp |
| 59 | contDiff_fst.contMDiff.contMDiffOn (fun y hy => hy.1)).prodMk hshift.contMDiffOn |
| 60 | have hb : b ∈ IsManifold.maximalAtlas 𝓘(𝕜, G) n N := by |
| 61 | apply b.mem_maximalAtlas_of_contMDiffOn |
| 62 | · change ContMDiffOn 𝓘(𝕜, G) 𝓘(𝕜, G) n (L ∘ p ∘ e.symm) b.source |
| 63 | apply L.contDiff.contMDiff.comp_contMDiffOn |
| 64 | exact hp.comp (hi.mono (fun y hy => hy.1.1)) (fun y hy => hy.1.2) |
| 65 | · change ContMDiffOn 𝓘(𝕜, G) 𝓘(𝕜, G) n (e ∘ p.symm ∘ L.symm) b.target |
| 66 | exact he.comp |
| 67 | (hp'.comp L.symm.contDiff.contMDiff.contMDiffOn (fun y hy => hy.2.1)) |
| 68 | (fun y hy => hy.2.2) |
| 69 | have hsource (y : M) (hy : y ∈ d.source) : e (y, c) ∈ b.source := by |
| 70 | refine ⟨⟨e.map_source (hc y), ?_⟩, Set.mem_univ _⟩ |
| 71 | change e.symm (e (y, c)) ∈ p.source |
| 72 | rw [e.left_inv (hc y)] |
| 73 | exact ⟨hy, Set.mem_univ _⟩ |
| 74 | apply Manifold.IsImmersionAtOfComplement.mk_of_charts L d b |
| 75 | (mem_chart_source E x) (hsource x (mem_chart_source E x)) |
| 76 | (IsManifold.chart_mem_maximalAtlas x) hb hsource |
| 77 | intro v hv |
| 78 | have hv' : v ∈ d.target := by simpa using hv |
| 79 | change L (p (e.symm (e (d.symm v, c)))) = L (v, 0) |
| 80 | rw [e.left_inv (hc _)] |
| 81 | congr 1 |
| 82 | change (d (d.symm v), c + -c) = (v, 0) |
| 83 | rw [d.right_inv hv', add_neg_cancel] |
| 84 | |
| 85 | end OpenPartialHomeomorph |