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.RicciFlow.Generalized.BoundedDistance.GeometryImports |
| 2 | import Mathlib.Geometry.Manifold.LocalDiffeomorph |
| 3 | |
| 4 | /-! |
| 5 | # Smooth restriction to an actual open image |
| 6 | |
| 7 | A guarded partial diffeomorphism restricts to a diffeomorphism from an |
| 8 | open source subset onto its literal image. Both inherited source charts |
| 9 | and the canonical singleton chart on an open model domain are supported. |
| 10 | Used in Morgan--Tian Theorem 5.6, pp. 85-87; M28 derivation 132. |
| 11 | -/ |
| 12 | |
| 13 | noncomputable section |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set |
| 18 | open scoped Manifold ContDiff Topology |
| 19 | |
| 20 | universe u v |
| 21 | |
| 22 | namespace PartialDiffeomorph |
| 23 | |
| 24 | variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] |
| 25 | {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] |
| 26 | {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] |
| 27 | {H : Type*} [TopologicalSpace H] |
| 28 | {H' : Type*} [TopologicalSpace H'] |
| 29 | {I : ModelWithCorners 𝕜 E H} {J : ModelWithCorners 𝕜 F H'} |
| 30 | {M : Type u} [TopologicalSpace M] [ChartedSpace H M] |
| 31 | {N : Type v} [TopologicalSpace N] [ChartedSpace H' N] |
| 32 | |
| 33 | /-- Restrict a smooth partial diffeomorphism to an open subset of its |
| 34 | source and the literal open image, with both inherited subtype charts. -/ |
| 35 | def diffeomorphOnOpens |
| 36 | (e : PartialDiffeomorph I J M N ∞) |
| 37 | (V : TopologicalSpace.Opens M) (W : TopologicalSpace.Opens N) |
| 38 | (hV : (V : Set M) ⊆ e.source) |
| 39 | (hW : e '' (V : Set M) = (W : Set N)) : |
| 40 | V ≃ₘ⟮I, J⟯ W := by |
| 41 | let L : V ≃ₜ W := e.toOpenPartialHomeomorph.homeomorphOfImageSubsetSource hV hW |
| 42 | have htarget : (W : Set N) ⊆ e.target := by |
| 43 | intro y hy |
| 44 | rw [← hW] at hy |
| 45 | obtain ⟨x, hx, rfl⟩ := hy |
| 46 | exact e.toPartialEquiv.map_source (hV hx) |
| 47 | refine { |
| 48 | toEquiv := L.toEquiv |
| 49 | contMDiff_toFun := ?_ |
| 50 | contMDiff_invFun := ?_ } |
| 51 | · apply (ContMDiff.subtypeVal_comp_iff W (L : V → W)).mp |
| 52 | intro x |
| 53 | change ContMDiffAt I J ∞ (e ∘ (Subtype.val : V → M)) x |
| 54 | exact ((e.contMDiffOn (x : M) (hV x.property)).contMDiffAt |
| 55 | (e.open_source.mem_nhds (hV x.property))).comp x |
| 56 | (contMDiff_subtype_val (I := I) (U := V) (n := ∞)).contMDiffAt |
| 57 | · apply (ContMDiff.subtypeVal_comp_iff V (L.symm : W → V)).mp |
| 58 | intro y |
| 59 | change ContMDiffAt J I ∞ (e.symm ∘ (Subtype.val : W → N)) y |
| 60 | exact ((e.symm.contMDiffOn (y : N) (htarget y.property)).contMDiffAt |
| 61 | (e.open_target.mem_nhds (htarget y.property))).comp y |
| 62 | (contMDiff_subtype_val (I := J) (U := W) (n := ∞)).contMDiffAt |
| 63 | |
| 64 | /-- The restricted diffeomorphism has the original forward map. -/ |
| 65 | @[simp] theorem diffeomorphOnOpens_apply |
| 66 | (e : PartialDiffeomorph I J M N ∞) |
| 67 | (V : TopologicalSpace.Opens M) (W : TopologicalSpace.Opens N) |
| 68 | (hV : (V : Set M) ⊆ e.source) |
| 69 | (hW : e '' (V : Set M) = (W : Set N)) (x : V) : |
| 70 | ((diffeomorphOnOpens e V W hV hW x : W) : N) = e (x : M) := rfl |
| 71 | |
| 72 | /-- The restricted inverse is the partial inverse on its true image. -/ |
| 73 | @[simp] theorem diffeomorphOnOpens_symm_apply |
| 74 | (e : PartialDiffeomorph I J M N ∞) |
| 75 | (V : TopologicalSpace.Opens M) (W : TopologicalSpace.Opens N) |
| 76 | (hV : (V : Set M) ⊆ e.source) |
| 77 | (hW : e '' (V : Set M) = (W : Set N)) (y : W) : |
| 78 | (((diffeomorphOnOpens e V W hV hW).symm y : V) : M) = |
| 79 | e.symm (y : N) := rfl |
| 80 | |
| 81 | /-- The same restriction when the source open model domain carries its |
| 82 | canonical singleton chart, as in the source normal-chart flow APIs. -/ |
| 83 | def diffeomorphOnCanonicalSource |
| 84 | (e : PartialDiffeomorph I J H N ∞) |
| 85 | (V : TopologicalSpace.Opens H) [Nonempty V] |
| 86 | (W : TopologicalSpace.Opens N) |
| 87 | (hV : (V : Set H) ⊆ e.source) |
| 88 | (hW : e '' (V : Set H) = (W : Set N)) : |
| 89 | letI := V.isOpen.isOpenEmbedding_subtypeVal.singletonChartedSpace |
| 90 | V ≃ₘ⟮I, J⟯ W := by |
| 91 | letI := V.isOpen.isOpenEmbedding_subtypeVal.singletonChartedSpace |
| 92 | let L : V ≃ₜ W := e.toOpenPartialHomeomorph.homeomorphOfImageSubsetSource hV hW |
| 93 | have htarget : (W : Set N) ⊆ e.target := by |
| 94 | intro y hy |
| 95 | rw [← hW] at hy |
| 96 | obtain ⟨x, hx, rfl⟩ := hy |
| 97 | exact e.toPartialEquiv.map_source (hV hx) |
| 98 | have hsource : ContMDiff I I ∞ (Subtype.val : V → H) := |
| 99 | contMDiff_isOpenEmbedding (I := I) (n := ∞) |
| 100 | V.isOpen.isOpenEmbedding_subtypeVal |
| 101 | refine { |
| 102 | toEquiv := L.toEquiv |
| 103 | contMDiff_toFun := ?_ |
| 104 | contMDiff_invFun := ?_ } |
| 105 | · apply (ContMDiff.subtypeVal_comp_iff W (L : V → W)).mp |
| 106 | intro x |
| 107 | change ContMDiffAt I J ∞ (e ∘ (Subtype.val : V → H)) x |
| 108 | exact ((e.contMDiffOn (x : H) (hV x.property)).contMDiffAt |
| 109 | (e.open_source.mem_nhds (hV x.property))).comp x hsource.contMDiffAt |
| 110 | · have hraw : ContMDiff J I ∞ |
| 111 | ((Subtype.val : V → H) ∘ (L.symm : W → V)) := by |
| 112 | intro y |
| 113 | change ContMDiffAt J I ∞ (e.symm ∘ (Subtype.val : W → N)) y |
| 114 | exact ((e.symm.contMDiffOn (y : N) (htarget y.property)).contMDiffAt |
| 115 | (e.open_target.mem_nhds (htarget y.property))).comp y |
| 116 | (contMDiff_subtype_val (I := J) (U := W) (n := ∞)).contMDiffAt |
| 117 | exact ContMDiff.of_comp_isOpenEmbedding |
| 118 | V.isOpen.isOpenEmbedding_subtypeVal hraw |
| 119 | |
| 120 | /-- The singleton-source restriction has the original forward map. -/ |
| 121 | @[simp] theorem diffeomorphOnCanonicalSource_apply |
| 122 | (e : PartialDiffeomorph I J H N ∞) |
| 123 | (V : TopologicalSpace.Opens H) [Nonempty V] |
| 124 | (W : TopologicalSpace.Opens N) |
| 125 | (hV : (V : Set H) ⊆ e.source) |
| 126 | (hW : e '' (V : Set H) = (W : Set N)) (x : V) : |
| 127 | ((diffeomorphOnCanonicalSource e V W hV hW x : W) : N) = |
| 128 | e (x : H) := rfl |
| 129 | |
| 130 | end PartialDiffeomorph |