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.Manifold.SmoothDomain.RegularChart |
| 2 | import Mathlib.Geometry.Manifold.SmoothEmbedding |
| 3 | import Mathlib.Geometry.Manifold.Instances.Real |
| 4 | |
| 5 | /-! |
| 6 | # Regular superlevel domains as manifolds with boundary |
| 7 | |
| 8 | For a smooth scalar function whose level `c` is regular, the closed superlevel |
| 9 | `{x | c ≤ f x}` carries the canonical smooth manifold-with-boundary structure. |
| 10 | The boundary charts are obtained from `exists_manifold_superlevel_chart`; on |
| 11 | the interior one uses ordinary ambient charts. This file records the |
| 12 | source-facing package of structures used by later Morgan--Tian arguments. |
| 13 | -/ |
| 14 | |
| 15 | open Set Function |
| 16 | open scoped Topology ContDiff Manifold |
| 17 | |
| 18 | noncomputable section |
| 19 | |
| 20 | /-! Adapted from AxelWorkspace, `MorganTianLib/Foundations/RegularDomainManifold.lean`, |
| 21 | revision `f1cdb30cabdc8781d2d3dec86d3d99ab1820f30e`. |
| 22 | See `references/analysis/axel-workspace/regular-domain-reuse.md`. -/ |
| 23 | |
| 24 | namespace Poincare.Manifold |
| 25 | |
| 26 | /-! Restriction of an ambient chart to corresponding subtypes. -/ |
| 27 | |
| 28 | def subtypeRestrictImage {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] |
| 29 | (e : OpenPartialHomeomorph X Y) {S : Set X} {T : Set Y} |
| 30 | (h : e.IsImage S T) : |
| 31 | OpenPartialHomeomorph (↥(e.source ∩ S)) (↥(e.target ∩ T)) := by |
| 32 | let F : (↥(e.source ∩ S)) → (↥(e.target ∩ T)) := fun x => |
| 33 | ⟨e x, e.map_source x.2.1, (h.apply_mem_iff x.2.1).mpr x.2.2⟩ |
| 34 | let G : (↥(e.target ∩ T)) → (↥(e.source ∩ S)) := fun y => |
| 35 | ⟨e.symm y, e.symm.map_source y.2.1, (h.symm_apply_mem_iff y.2.1).mpr y.2.2⟩ |
| 36 | let p : PartialEquiv (↥(e.source ∩ S)) (↥(e.target ∩ T)) := |
| 37 | { toFun := F |
| 38 | invFun := G |
| 39 | source := Set.univ |
| 40 | target := Set.univ |
| 41 | map_source' := by simp |
| 42 | map_target' := by simp |
| 43 | left_inv' := by |
| 44 | intro x hx |
| 45 | apply Subtype.ext |
| 46 | exact e.left_inv x.2.1 |
| 47 | right_inv' := by |
| 48 | intro y hy |
| 49 | apply Subtype.ext |
| 50 | exact e.right_inv y.2.1 } |
| 51 | refine |
| 52 | { toPartialEquiv := p |
| 53 | open_source := isOpen_univ |
| 54 | open_target := isOpen_univ |
| 55 | continuousOn_toFun := ?_ |
| 56 | continuousOn_invFun := ?_ } |
| 57 | · apply Topology.IsInducing.subtypeVal.continuousOn_iff.mpr |
| 58 | apply (e.continuousOn.comp continuous_subtype_val.continuousOn (by |
| 59 | intro x hx |
| 60 | exact x.2.1)).congr |
| 61 | intro x hx |
| 62 | rfl |
| 63 | |
| 64 | · apply Topology.IsInducing.subtypeVal.continuousOn_iff.mpr |
| 65 | apply (e.symm.continuousOn.comp continuous_subtype_val.continuousOn (by |
| 66 | intro x hx |
| 67 | exact x.2.1)).congr |
| 68 | intro x hx |
| 69 | rfl |
| 70 | |
| 71 | @[simp] theorem subtypeRestrictImage_apply_coe |
| 72 | {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] |
| 73 | (e : OpenPartialHomeomorph X Y) {S : Set X} {T : Set Y} |
| 74 | (h : e.IsImage S T) (x : ↥(e.source ∩ S)) : |
| 75 | ((subtypeRestrictImage e h x : ↥(e.target ∩ T)) : Y) = e x := by |
| 76 | rfl |
| 77 | |
| 78 | @[simp] theorem subtypeRestrictImage_symm_apply_coe |
| 79 | {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] |
| 80 | (e : OpenPartialHomeomorph X Y) {S : Set X} {T : Set Y} |
| 81 | (h : e.IsImage S T) (y : ↥(e.target ∩ T)) : |
| 82 | (((subtypeRestrictImage e h).symm y : ↥(e.source ∩ S)) : X) = e.symm y := by |
| 83 | rfl |
| 84 | |
| 85 | /-! Restriction retaining full subtype types, with a designated source point |
| 86 | supplying harmless values outside the partial-homeomorphism source. -/ |
| 87 | def subtypeRestrictImageOn {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] |
| 88 | (e : OpenPartialHomeomorph X Y) {S : Set X} {T : Set Y} |
| 89 | (h : e.IsImage S T) (a : S) (ha : (a : X) ∈ e.source) : |
| 90 | OpenPartialHomeomorph S T := by |
| 91 | classical |
| 92 | have haT : e a ∈ T := (h.apply_mem_iff ha).mpr a.2 |
| 93 | let F : S → T := fun x => if hx : (x : X) ∈ e.source then |
| 94 | ⟨e x, (h.apply_mem_iff hx).mpr x.2⟩ else ⟨e a, haT⟩ |
| 95 | let G : T → S := fun y => if hy : (y : Y) ∈ e.target then |
| 96 | ⟨e.symm y, (h.symm_apply_mem_iff hy).mpr y.2⟩ else a |
| 97 | let p : PartialEquiv S T := |
| 98 | { toFun := F |
| 99 | invFun := G |
| 100 | source := Subtype.val ⁻¹' e.source |
| 101 | target := Subtype.val ⁻¹' e.target |
| 102 | map_source' := by |
| 103 | intro x hx |
| 104 | change (x : X) ∈ e.source at hx |
| 105 | change (F x : Y) ∈ e.target |
| 106 | simp [F, hx, e.map_source hx] |
| 107 | map_target' := by |
| 108 | intro y hy |
| 109 | change (y : Y) ∈ e.target at hy |
| 110 | change (G y : X) ∈ e.source |
| 111 | simp [G, hy, e.symm.map_source hy] |
| 112 | left_inv' := by |
| 113 | intro x hx |
| 114 | change (x : X) ∈ e.source at hx |
| 115 | apply Subtype.ext |
| 116 | simp [F, G, hx, e.map_source hx, e.left_inv hx] |
| 117 | right_inv' := by |
| 118 | intro y hy |
| 119 | change (y : Y) ∈ e.target at hy |
| 120 | apply Subtype.ext |
| 121 | simp [F, G, hy, e.symm.map_source hy, e.right_inv hy] } |
| 122 | refine |
| 123 | { toPartialEquiv := p |
| 124 | open_source := e.open_source.preimage continuous_subtype_val |
| 125 | open_target := e.open_target.preimage continuous_subtype_val |
| 126 | continuousOn_toFun := ?_ |
| 127 | continuousOn_invFun := ?_ } |
| 128 | · apply Topology.IsInducing.subtypeVal.continuousOn_iff.mpr |
| 129 | apply (e.continuousOn.comp continuous_subtype_val.continuousOn (by |
| 130 | intro x hx |
| 131 | exact hx)).congr |
| 132 | intro x hx |
| 133 | change (x : X) ∈ e.source at hx |
| 134 | simp [p, F, hx] |
| 135 | · apply Topology.IsInducing.subtypeVal.continuousOn_iff.mpr |
| 136 | apply (e.symm.continuousOn.comp continuous_subtype_val.continuousOn (by |
| 137 | intro y hy |
| 138 | exact hy)).congr |
| 139 | intro y hy |
| 140 | change (y : Y) ∈ e.target at hy |
| 141 | simp [p, G, hy] |
| 142 | |
| 143 | @[simp] theorem subtypeRestrictImageOn_apply_coe |
| 144 | {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] |
| 145 | (e : OpenPartialHomeomorph X Y) {S : Set X} {T : Set Y} |
| 146 | (h : e.IsImage S T) (a : S) (ha : (a : X) ∈ e.source) |
| 147 | {x : S} (hx : (x : X) ∈ e.source) : |
| 148 | ((subtypeRestrictImageOn e h a ha x : T) : Y) = e x := by |
| 149 | simp [subtypeRestrictImageOn, hx] |
| 150 | |
| 151 | @[simp] theorem subtypeRestrictImageOn_source |
| 152 | {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] |
| 153 | (e : OpenPartialHomeomorph X Y) {S : Set X} {T : Set Y} |
| 154 | (h : e.IsImage S T) (a : S) (ha : (a : X) ∈ e.source) : |
| 155 | (subtypeRestrictImageOn e h a ha).source = Subtype.val ⁻¹' e.source := by |
| 156 | rfl |
| 157 | |
| 158 | @[simp] theorem subtypeRestrictImageOn_target |
| 159 | {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] |
| 160 | (e : OpenPartialHomeomorph X Y) {S : Set X} {T : Set Y} |
| 161 | (h : e.IsImage S T) (a : S) (ha : (a : X) ∈ e.source) : |
| 162 | (subtypeRestrictImageOn e h a ha).target = Subtype.val ⁻¹' e.target := by |
| 163 | rfl |
| 164 | |
| 165 | /-! A charted-space wrapper for a chosen family of relative charts. -/ |
| 166 | @[reducible] def chartedSpaceOfRelativeCharts {S H : Type*} [TopologicalSpace S] |
| 167 | [TopologicalSpace H] (charts : S → OpenPartialHomeomorph S H) |
| 168 | (hsource : ∀ x : S, x ∈ (charts x).source) : ChartedSpace H S := |
| 169 | { atlas := Set.range charts |
| 170 | chartAt := charts |
| 171 | mem_chart_source := hsource |
| 172 | chart_mem_atlas := fun x => ⟨x, rfl⟩ } |
| 173 | |
| 174 | @[simp] theorem subtypeRestrictImageOn_symm_apply_coe |
| 175 | {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] |
| 176 | (e : OpenPartialHomeomorph X Y) {S : Set X} {T : Set Y} |
| 177 | (h : e.IsImage S T) (a : S) (ha : (a : X) ∈ e.source) |
| 178 | {y : T} (hy : (y : Y) ∈ e.target) : |
| 179 | (((subtypeRestrictImageOn e h a ha).symm y : S) : X) = e.symm y := by |
| 180 | simp [subtypeRestrictImageOn, hy] |
| 181 | |
| 182 | /-! A transition map expressed through a model with corners is the ambient |
| 183 | transition on the model range; this is the congruence used by the relative |
| 184 | atlas construction. -/ |
| 185 | theorem contDiffOn_corner_transition_of_eqOn |
| 186 | {𝕜 E H : Type*} [NontriviallyNormedField 𝕜] |
| 187 | [NormedAddCommGroup E] [NormedSpace 𝕜 E] [TopologicalSpace H] |
| 188 | (I : ModelWithCorners 𝕜 E H) {k : E → E} {kc : H → H} {s r : Set E} |
| 189 | (hs : IsOpen s) (hk : ContDiffOn 𝕜 ∞ k s) |
| 190 | (hsub : r ⊆ s) |
| 191 | (heq : EqOn (I ∘ kc ∘ I.symm) k r) : |
| 192 | ContDiffOn 𝕜 ∞ (I ∘ kc ∘ I.symm) r := by |
| 193 | apply (hk.mono hsub).congr |
| 194 | intro x hx |
| 195 | exact heq hx |
| 196 | |
| 197 | |
| 198 | end Poincare.Manifold |
| 199 |