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.Topology.OpenPartialHomeomorph.Composition |
| 2 | |
| 3 | /-! |
| 4 | # Restricting both sides of an open transition |
| 5 | |
| 6 | The inclusion chart of an open subset conjugates an ambient partial |
| 7 | homeomorphism to a transition between copies of the subset. This is the |
| 8 | topological restriction used in the compact double of Morgan-Tian |
| 9 | Theorem 12.5, p. 297; see the compact-double derivation in the task records. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set Topology |
| 15 | |
| 16 | universe u |
| 17 | |
| 18 | namespace OpenPartialHomeomorph |
| 19 | |
| 20 | variable {X : Type u} [TopologicalSpace X] (e : OpenPartialHomeomorph X X) |
| 21 | {U : Set X} (hU : IsOpen U) [Nonempty U] |
| 22 | |
| 23 | /-- Conjugation by an open inclusion restricts both sides of a transition |
| 24 | (Morgan-Tian Theorem 12.5, p. 297, compact-double derivation). -/ |
| 25 | noncomputable def onOpenSubset : OpenPartialHomeomorph U U := |
| 26 | let j := hU.isOpenEmbedding_subtypeVal.toOpenPartialHomeomorph |
| 27 | (j.trans e).trans j.symm |
| 28 | |
| 29 | /-- If the ambient target is retained, restriction introduces no further |
| 30 | source condition (Theorem 12.5, p. 297, compact-double derivation). -/ |
| 31 | theorem onOpenSubset_source (htarget : e.target ⊆ U) : |
| 32 | (e.onOpenSubset hU).source = (Subtype.val : U → X) ⁻¹' e.source := by |
| 33 | ext x |
| 34 | simp only [onOpenSubset, trans_source, mem_inter_iff, mem_preimage, |
| 35 | IsOpenEmbedding.toOpenPartialHomeomorph_source, mem_univ, true_and, |
| 36 | trans_apply, IsOpenEmbedding.toOpenPartialHomeomorph_apply, symm_source, |
| 37 | IsOpenEmbedding.toOpenPartialHomeomorph_target, Subtype.range_coe] |
| 38 | exact and_iff_left_of_imp (fun hx => htarget (e.map_source hx)) |
| 39 | |
| 40 | /-- The restricted transition has the ambient value wherever that value |
| 41 | lies in the open subset (Theorem 12.5, p. 297, compact-double derivation). -/ |
| 42 | theorem onOpenSubset_apply_coe (x : U) (hx : e (x : X) ∈ U) : |
| 43 | ((e.onOpenSubset hU x : U) : X) = e (x : X) := by |
| 44 | simp only [onOpenSubset, trans_apply, IsOpenEmbedding.toOpenPartialHomeomorph_apply] |
| 45 | exact IsOpenEmbedding.toOpenPartialHomeomorph_right_inv Subtype.val |
| 46 | hU.isOpenEmbedding_subtypeVal (by simpa only [Subtype.range_coe] using hx) |
| 47 | |
| 48 | /-- Inversion commutes with restriction to both open subsets |
| 49 | (Theorem 12.5, p. 297, compact-double derivation). -/ |
| 50 | theorem onOpenSubset_symm : (e.onOpenSubset hU).symm = e.symm.onOpenSubset hU := by |
| 51 | simp only [onOpenSubset, trans_symm_eq_symm_trans_symm, symm_symm, trans_assoc] |
| 52 | |
| 53 | /-- A self-inverse ambient transition remains self-inverse after restriction |
| 54 | (Theorem 12.5, p. 297, compact-double derivation). -/ |
| 55 | theorem onOpenSubset_symm_eq (he : e.symm = e) : |
| 56 | (e.onOpenSubset hU).symm = e.onOpenSubset hU := by |
| 57 | rw [onOpenSubset_symm, he] |
| 58 | |
| 59 | end OpenPartialHomeomorph |