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.Instances.Real |
| 3 | import Mathlib.Geometry.Manifold.IsManifold.InteriorBoundary |
| 4 | import Mathlib.Topology.Connected.Basic |
| 5 | import Mathlib.Topology.Algebra.Module.FiniteDimension |
| 6 | |
| 7 | /-! |
| 8 | # Relatively compact smooth domains |
| 9 | |
| 10 | A smooth-domain structure equips the actual closure subtype with a compact |
| 11 | smooth manifold-with-boundary structure whose inclusion is a smooth embedding. |
| 12 | Its intrinsic interior is the given open connected domain, and its intrinsic |
| 13 | boundary is nonempty. The boundary image is exactly the ambient frontier. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set |
| 19 | open scoped Manifold ContDiff |
| 20 | |
| 21 | /-- Intrinsic interior may be tested in any compatible smooth chart. -/ |
| 22 | theorem ModelWithCorners.isInteriorPoint_iff_of_mem_maximalAtlas |
| 23 | {𝕜 : Type*} [NontriviallyNormedField 𝕜] |
| 24 | {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] |
| 25 | {H : Type*} [TopologicalSpace H] {I : ModelWithCorners 𝕜 E H} |
| 26 | {M : Type*} [TopologicalSpace M] [ChartedSpace H M] {k : WithTop ℕ∞} |
| 27 | {e : OpenPartialHomeomorph M H} {x : M} |
| 28 | (hk : k ≠ 0) (he : e ∈ IsManifold.maximalAtlas I k M) (hx : x ∈ e.source) : |
| 29 | I.IsInteriorPoint x ↔ e.extend I x ∈ interior (e.extend I).target := by |
| 30 | have hd : IsLocalDiffeomorphAt I I k e x := by |
| 31 | refine ⟨{ toPartialEquiv := e.toPartialEquiv |
| 32 | open_source := e.open_source |
| 33 | open_target := e.open_target |
| 34 | contMDiffOn_toFun := contMDiffOn_of_mem_maximalAtlas he |
| 35 | contMDiffOn_invFun := contMDiffOn_symm_of_mem_maximalAtlas he }, |
| 36 | hx, fun _ _ => rfl⟩ |
| 37 | have hi := hd.isInteriorPoint_iff hk |
| 38 | change I.IsInteriorPoint x ↔ I (e x) ∈ interior (range I) at hi |
| 39 | refine hi.trans ⟨fun h => e.mem_interior_extend_target (e.mapsTo hx) h, fun h => ?_⟩ |
| 40 | exact e.interior_extend_target_subset_interior_range h |
| 41 | |
| 42 | namespace Poincare.Manifold |
| 43 | |
| 44 | /-- The ordinary geometric data of a nonempty connected relatively compact |
| 45 | open smooth domain with nonempty boundary. No analytic estimates are included. -/ |
| 46 | structure SmoothDomain (n : ℕ) [NeZero n] {M : Type*} [TopologicalSpace M] |
| 47 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 48 | (Ω : Set M) where |
| 49 | isOpen : IsOpen Ω |
| 50 | isConnected : IsConnected Ω |
| 51 | isCompact_closure : IsCompact (closure Ω) |
| 52 | chartedSpace : ChartedSpace (EuclideanHalfSpace n) (closure Ω) |
| 53 | isManifold : letI := chartedSpace; IsManifold (𝓡∂ n) ∞ (closure Ω) |
| 54 | isSmoothEmbedding : letI := chartedSpace; |
| 55 | _root_.Manifold.IsSmoothEmbedding (𝓡∂ n) (𝓡 n) ∞ |
| 56 | (Subtype.val : closure Ω → M) |
| 57 | image_interior : letI := chartedSpace; |
| 58 | Subtype.val '' (𝓡∂ n).interior (closure Ω) = Ω |
| 59 | boundary_nonempty : letI := chartedSpace; |
| 60 | ((𝓡∂ n).boundary (closure Ω)).Nonempty |
| 61 | |
| 62 | namespace SmoothDomain |
| 63 | |
| 64 | variable {n : ℕ} [NeZero n] {M : Type*} [TopologicalSpace M] |
| 65 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 66 | {Ω : Set M} (D : SmoothDomain n Ω) |
| 67 | |
| 68 | include D |
| 69 | |
| 70 | /-- Intrinsic interior for the chosen half-space atlas on the closure. -/ |
| 71 | def intrinsicInterior : Set (closure Ω) := |
| 72 | letI := D.chartedSpace |
| 73 | (𝓡∂ n).interior (closure Ω) |
| 74 | |
| 75 | /-- Intrinsic boundary for the chosen half-space atlas on the closure. -/ |
| 76 | def intrinsicBoundary : Set (closure Ω) := |
| 77 | letI := D.chartedSpace |
| 78 | (𝓡∂ n).boundary (closure Ω) |
| 79 | |
| 80 | theorem intrinsicBoundary_eq_compl : D.intrinsicBoundary = D.intrinsicInteriorᶜ := by |
| 81 | let := D.chartedSpace |
| 82 | exact (ModelWithCorners.compl_interior (I := 𝓡∂ n) (M := closure Ω)).symm |
| 83 | |
| 84 | @[simp] theorem image_intrinsicInterior : Subtype.val '' D.intrinsicInterior = Ω := |
| 85 | D.image_interior |
| 86 | |
| 87 | /-- The intrinsic boundary is precisely the ambient topological frontier. -/ |
| 88 | @[simp] theorem image_boundary : |
| 89 | Subtype.val '' D.intrinsicBoundary = frontier Ω := by |
| 90 | rw [D.intrinsicBoundary_eq_compl, compl_eq_univ_sdiff, |
| 91 | Set.image_sdiff Subtype.val_injective, image_univ, Subtype.range_val, |
| 92 | D.image_intrinsicInterior, D.isOpen.frontier_eq] |
| 93 | |
| 94 | @[simp] theorem mem_intrinsicInterior_iff (x : closure Ω) : |
| 95 | x ∈ D.intrinsicInterior ↔ (x : M) ∈ Ω := by |
| 96 | have hm := Set.ext_iff.mp D.image_intrinsicInterior (x : M) |
| 97 | constructor |
| 98 | · exact fun hx => hm.mp ⟨x, hx, rfl⟩ |
| 99 | · intro hx |
| 100 | obtain ⟨y, hy, hyx⟩ := hm.mpr hx |
| 101 | exact Subtype.val_injective hyx ▸ hy |
| 102 | |
| 103 | @[simp] theorem mem_intrinsicBoundary_iff (x : closure Ω) : |
| 104 | x ∈ D.intrinsicBoundary ↔ (x : M) ∈ frontier Ω := by |
| 105 | rw [← D.image_boundary, Set.mem_image] |
| 106 | constructor |
| 107 | · exact fun hx => ⟨x, hx, rfl⟩ |
| 108 | · rintro ⟨y, hy, hyx⟩ |
| 109 | exact Subtype.val_injective hyx ▸ hy |
| 110 | |
| 111 | theorem nonempty : Ω.Nonempty := D.isConnected.nonempty |
| 112 | |
| 113 | theorem isCompact_frontier : IsCompact (frontier Ω) := |
| 114 | D.isCompact_closure.of_isClosed_subset isClosed_frontier frontier_subset_closure |
| 115 | |
| 116 | theorem frontier_nonempty : (frontier Ω).Nonempty := by |
| 117 | rw [← D.image_boundary] |
| 118 | exact D.boundary_nonempty.image Subtype.val |
| 119 | |
| 120 | theorem isConnected_closure : IsConnected (closure Ω) := D.isConnected.closure |
| 121 | |
| 122 | theorem compactSpace_closure : CompactSpace (closure Ω) := |
| 123 | isCompact_iff_compactSpace.mp D.isCompact_closure |
| 124 | |
| 125 | theorem connectedSpace_domain : ConnectedSpace Ω := |
| 126 | isConnected_iff_connectedSpace.mp D.isConnected |
| 127 | |
| 128 | theorem connectedSpace_closure : ConnectedSpace (closure Ω) := |
| 129 | isConnected_iff_connectedSpace.mp D.isConnected_closure |
| 130 | |
| 131 | theorem contMDiff_inclusion : |
| 132 | letI := D.chartedSpace |
| 133 | ContMDiff (𝓡∂ n) (𝓡 n) ∞ (Subtype.val : closure Ω → M) := by |
| 134 | let := D.chartedSpace |
| 135 | exact D.isSmoothEmbedding.contMDiff |
| 136 | |
| 137 | /-- Boundary and ambient charts make the inclusion a linear change of |
| 138 | coordinates followed by the standard half-space inclusion. -/ |
| 139 | theorem exists_compatible_charts (x : closure Ω) : |
| 140 | letI := D.chartedSpace |
| 141 | ∃ (φ : OpenPartialHomeomorph (closure Ω) (EuclideanHalfSpace n)) |
| 142 | (ψ : OpenPartialHomeomorph M (EuclideanSpace ℝ (Fin n))) |
| 143 | (A : EuclideanSpace ℝ (Fin n) ≃L[ℝ] EuclideanSpace ℝ (Fin n)), |
| 144 | x ∈ φ.source ∧ (x : M) ∈ ψ.source ∧ |
| 145 | φ ∈ IsManifold.maximalAtlas (𝓡∂ n) ∞ (closure Ω) ∧ |
| 146 | ψ ∈ IsManifold.maximalAtlas (𝓡 n) ∞ M ∧ |
| 147 | φ.source ⊆ Subtype.val ⁻¹' ψ.source ∧ |
| 148 | EqOn (ψ ∘ Subtype.val) (A ∘ (𝓡∂ n) ∘ φ) φ.source := by |
| 149 | let := D.chartedSpace |
| 150 | have h := D.isSmoothEmbedding.isImmersion.isImmersionAt x |
| 151 | let L : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin n) := |
| 152 | h.equiv.toLinearMap.comp (LinearMap.inl ℝ _ _) |
| 153 | have hL : Function.Injective L := by |
| 154 | intro u v huv |
| 155 | exact congrArg Prod.fst (h.equiv.injective huv) |
| 156 | let A := (LinearEquiv.ofBijective L |
| 157 | ⟨hL, LinearMap.injective_iff_surjective.mp hL⟩).toContinuousLinearEquiv |
| 158 | refine ⟨h.domChart, h.codChart, A, h.mem_domChart_source, |
| 159 | h.mem_codChart_source, h.domChart_mem_maximalAtlas, |
| 160 | h.codChart_mem_maximalAtlas, h.source_subset_preimage_source, ?_⟩ |
| 161 | intro y hy |
| 162 | have hz := h.writtenInCharts |
| 163 | ((h.domChart.extend (𝓡∂ n)).map_source (by simpa only |
| 164 | [OpenPartialHomeomorph.extend_source] using hy)) |
| 165 | dsimp only [Function.comp_apply] at hz |
| 166 | rw [h.domChart.extend_left_inv hy] at hz |
| 167 | exact hz |
| 168 | |
| 169 | /-- A smooth domain is locally a half-space in smooth ambient coordinates. -/ |
| 170 | theorem exists_flattening_chart (x : closure Ω) : |
| 171 | ∃ (ψ : OpenPartialHomeomorph M (EuclideanSpace ℝ (Fin n))) |
| 172 | (A : EuclideanSpace ℝ (Fin n) ≃L[ℝ] EuclideanSpace ℝ (Fin n)), |
| 173 | (x : M) ∈ ψ.source ∧ ψ ∈ IsManifold.maximalAtlas (𝓡 n) ∞ M ∧ |
| 174 | ∀ y ∈ ψ.source, |
| 175 | (y ∈ closure Ω ↔ 0 ≤ (A.symm (ψ y)) 0) ∧ |
| 176 | (y ∈ Ω ↔ 0 < (A.symm (ψ y)) 0) ∧ |
| 177 | (y ∈ frontier Ω ↔ (A.symm (ψ y)) 0 = 0) := by |
| 178 | let := D.chartedSpace |
| 179 | let := D.isManifold |
| 180 | obtain ⟨φ, ψ, A, hxφ, hxψ, hφ, hψ, hsource, hcoord⟩ := D.exists_compatible_charts x |
| 181 | obtain ⟨U, hU, hUφ⟩ := |
| 182 | D.isSmoothEmbedding.isEmbedding.isInducing.isOpen_iff.mp φ.open_source |
| 183 | obtain ⟨W, hW, hWφ⟩ := |
| 184 | (𝓡∂ n).isClosedEmbedding.isEmbedding.isInducing.isOpen_iff.mp φ.open_target |
| 185 | let V := U ∩ (ψ.source ∩ ψ ⁻¹' (A.symm ⁻¹' W)) |
| 186 | have hV : IsOpen V := hU.inter (ψ.isOpen_inter_preimage (hW.preimage A.symm.continuous)) |
| 187 | have hcoord' (z : closure Ω) (hz : z ∈ φ.source) : |
| 188 | A.symm (ψ z) = (𝓡∂ n) (φ z) := by |
| 189 | rw [show ψ z = A ((𝓡∂ n) (φ z)) from hcoord hz] |
| 190 | exact A.symm_apply_apply _ |
| 191 | have hxU : (x : M) ∈ U := by |
| 192 | change x ∈ Subtype.val ⁻¹' U |
| 193 | rwa [hUφ] |
| 194 | have hxW : A.symm (ψ x) ∈ W := by |
| 195 | rw [hcoord' x hxφ] |
| 196 | change φ x ∈ (𝓡∂ n) ⁻¹' W |
| 197 | rw [hWφ] |
| 198 | exact φ.map_source hxφ |
| 199 | have hxV : (x : M) ∈ V := ⟨hxU, hxψ, hxW⟩ |
| 200 | refine ⟨ψ.restr V, A, ?_, restr_mem_maximalAtlas (contDiffGroupoid ∞ (𝓡 n)) hψ hV, ?_⟩ |
| 201 | · rw [ψ.restr_source' V hV] |
| 202 | exact ⟨hxψ, hxV⟩ |
| 203 | intro y hy |
| 204 | rw [ψ.restr_source' V hV] at hy |
| 205 | change (y ∈ closure Ω ↔ 0 ≤ (A.symm (ψ y)) 0) ∧ |
| 206 | (y ∈ Ω ↔ 0 < (A.symm (ψ y)) 0) ∧ |
| 207 | (y ∈ frontier Ω ↔ (A.symm (ψ y)) 0 = 0) |
| 208 | have hyφ (hyΩ : y ∈ closure Ω) : (⟨y, hyΩ⟩ : closure Ω) ∈ φ.source := by |
| 209 | rw [← hUφ] |
| 210 | exact hy.2.1 |
| 211 | have hclosure : y ∈ closure Ω ↔ 0 ≤ (A.symm (ψ y)) 0 := by |
| 212 | constructor |
| 213 | · intro hyΩ |
| 214 | rw [hcoord' ⟨y, hyΩ⟩ (hyφ hyΩ)] |
| 215 | exact (φ ⟨y, hyΩ⟩).property |
| 216 | · intro hz |
| 217 | let z : EuclideanHalfSpace n := ⟨A.symm (ψ y), hz⟩ |
| 218 | have hzφ : z ∈ φ.target := by |
| 219 | rw [← hWφ] |
| 220 | exact hy.2.2.2 |
| 221 | have hzin := φ.map_target hzφ |
| 222 | have heq : ψ (φ.symm z) = ψ y := by |
| 223 | rw [show ψ (φ.symm z) = A ((𝓡∂ n) (φ (φ.symm z))) from hcoord hzin, |
| 224 | φ.right_inv hzφ] |
| 225 | exact A.apply_symm_apply _ |
| 226 | have hval : (φ.symm z : M) = y := ψ.injOn (hsource hzin) hy.1 heq |
| 227 | exact hval ▸ (φ.symm z).property |
| 228 | have hinterior : y ∈ Ω ↔ 0 < (A.symm (ψ y)) 0 := by |
| 229 | by_cases hyΩ : y ∈ closure Ω |
| 230 | · rw [← D.mem_intrinsicInterior_iff ⟨y, hyΩ⟩] |
| 231 | change (𝓡∂ n).IsInteriorPoint (⟨y, hyΩ⟩ : closure Ω) ↔ _ |
| 232 | rw [hcoord' ⟨y, hyΩ⟩ (hyφ hyΩ)] |
| 233 | have hi := ModelWithCorners.isInteriorPoint_iff_of_mem_maximalAtlas |
| 234 | (I := 𝓡∂ n) (by simp : (∞ : WithTop ℕ∞) ≠ 0) hφ (hyφ hyΩ) |
| 235 | refine hi.trans ⟨fun h => ?_, fun h => ?_⟩ |
| 236 | · have h' := φ.interior_extend_target_subset_interior_range h |
| 237 | simpa only [OpenPartialHomeomorph.extend_coe, Function.comp_apply, |
| 238 | interior_range_modelWithCornersEuclideanHalfSpace, mem_ofPred_eq] using h' |
| 239 | · apply φ.mem_interior_extend_target (φ.mapsTo (hyφ hyΩ)) |
| 240 | rwa [interior_range_modelWithCornersEuclideanHalfSpace, mem_ofPred_eq] |
| 241 | · exact ⟨fun h => (hyΩ (subset_closure h)).elim, |
| 242 | fun h => (hyΩ (hclosure.mpr h.le)).elim⟩ |
| 243 | refine ⟨hclosure, hinterior, ?_⟩ |
| 244 | rw [D.isOpen.frontier_eq, mem_sdiff, hclosure, hinterior] |
| 245 | exact ⟨fun h => le_antisymm (le_of_not_gt h.2) h.1, fun h => by simp [h]⟩ |
| 246 | |
| 247 | /-- The inverse form of boundary flattening, suitable for coordinate integrals. -/ |
| 248 | theorem exists_flattening_parametrization (x : closure Ω) : |
| 249 | ∃ e : OpenPartialHomeomorph (EuclideanSpace ℝ (Fin n)) M, |
| 250 | (x : M) ∈ e.target ∧ |
| 251 | ContMDiffOn (𝓡 n) (𝓡 n) ∞ e e.source ∧ |
| 252 | ContMDiffOn (𝓡 n) (𝓡 n) ∞ e.symm e.target ∧ |
| 253 | ∀ z ∈ e.source, |
| 254 | (e z ∈ closure Ω ↔ 0 ≤ z 0) ∧ |
| 255 | (e z ∈ Ω ↔ 0 < z 0) ∧ |
| 256 | (e z ∈ frontier Ω ↔ z 0 = 0) := by |
| 257 | obtain ⟨ψ, A, hx, hψ, hflat⟩ := D.exists_flattening_chart x |
| 258 | let e := A.toHomeomorph.toOpenPartialHomeomorph.trans ψ.symm |
| 259 | have hs : e.source = A ⁻¹' ψ.target := by |
| 260 | simp [e] |
| 261 | have ht : e.target = ψ.source := by |
| 262 | simp [e] |
| 263 | have he : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e e.source := by |
| 264 | apply (contMDiffOn_symm_of_mem_maximalAtlas hψ).comp |
| 265 | (A.contDiff.contMDiff.contMDiffOn) ?_ |
| 266 | intro z hz |
| 267 | exact hs ▸ hz |
| 268 | have hei : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e.symm e.target := by |
| 269 | apply A.symm.contDiff.contMDiff.comp_contMDiffOn |
| 270 | ((contMDiffOn_of_mem_maximalAtlas hψ).mono ?_) |
| 271 | exact ht ▸ Subset.rfl |
| 272 | refine ⟨e, ht ▸ hx, he, hei, ?_⟩ |
| 273 | intro z hz |
| 274 | have hzA : A z ∈ ψ.target := by simpa only [hs, mem_preimage] using hz |
| 275 | have h := hflat (ψ.symm (A z)) (ψ.map_target hzA) |
| 276 | simpa only [ψ.right_inv hzA, A.symm_apply_apply, e, |
| 277 | OpenPartialHomeomorph.trans_apply, Homeomorph.toOpenPartialHomeomorph_apply, |
| 278 | ContinuousLinearEquiv.coe_toHomeomorph] using h |
| 279 | |
| 280 | end SmoothDomain |
| 281 | |
| 282 | end Poincare.Manifold |