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.Surgery.Continuation.TerminalPolicy |
| 2 | |
| 3 | /-! |
| 4 | # Whole compact components at a surgery event |
| 5 | |
| 6 | Morgan--Tian Definition 15.8, pp. 361-362: a compact terminal component |
| 7 | meeting the low-curvature core is retained whole. These checked consequences |
| 8 | identify the actual pre/post components and the terminal limit metric. |
| 9 | They supply neither an ordinary history nor a uniform volume seed. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open scoped Manifold ContDiff Bundle ENNReal Topology |
| 15 | |
| 16 | universe u |
| 17 | |
| 18 | namespace PoincareMT |
| 19 | |
| 20 | variable {g₀ : StandardInitialMetric} {K : MetricSurgeryConstants} |
| 21 | {P : SurgeryParameters} {slice : ℝ → GeneralizedSliceCarrier.{u}} |
| 22 | {metric : ∀ t, RiemannianMetric 3 (slice t).carrier} {T : ℝ} |
| 23 | {E : SurgeryEventData g₀ K P slice metric T} |
| 24 | |
| 25 | /-- The actual inverse limit map takes a compact terminal component onto |
| 26 | a whole component of the pre-surgery carrier. -/ |
| 27 | theorem SurgeryEventData.limit_inverse_image_component |
| 28 | (E : SurgeryEventData g₀ K P slice metric T) |
| 29 | {x : E.terminal.carrier} (hC : IsCompact (connectedComponent x)) : |
| 30 | E.limit_identify.inverse '' connectedComponent x = |
| 31 | connectedComponent (E.limit_identify.inverse x) := by |
| 32 | let : LocallyConnectedSpace E.terminal.carrier := |
| 33 | ChartedSpace.locallyConnectedSpace (EuclideanSpace ℝ (Fin 3)) E.terminal.carrier |
| 34 | have hg : Continuous E.limit_identify.inverse := |
| 35 | continuousOn_univ.1 E.limit_identify.inverse_smooth.continuousOn |
| 36 | have hgU (z : E.terminal.carrier) : E.limit_identify.inverse z ∈ E.regular_limit := by |
| 37 | exact E.limit_identify.inverse_image.subset ⟨z, Set.mem_univ z, rfl⟩ |
| 38 | have hset : E.limit_identify.inverse '' connectedComponent x = |
| 39 | E.regular_limit ∩ E.limit_identify.map ⁻¹' connectedComponent x := by |
| 40 | ext z |
| 41 | constructor |
| 42 | · rintro ⟨y, hy, rfl⟩ |
| 43 | exact ⟨hgU y, by |
| 44 | simpa only [Set.mem_preimage, E.limit_identify.right_inverse (Set.mem_univ y)] using hy⟩ |
| 45 | · rintro ⟨hz, hfz⟩ |
| 46 | exact ⟨E.limit_identify.map z, hfz, E.limit_identify.left_inverse hz⟩ |
| 47 | have hopen : IsOpen (E.limit_identify.inverse '' connectedComponent x) := by |
| 48 | rw [hset] |
| 49 | exact E.limit_identify.map_smooth.continuousOn.isOpen_inter_preimage |
| 50 | E.regular_limit_open isOpen_connectedComponent |
| 51 | have hcompact := hC.image hg |
| 52 | have hconnected := (isConnected_connectedComponent (x := x)).image E.limit_identify.inverse |
| 53 | hg.continuousOn |
| 54 | have hx : E.limit_identify.inverse x ∈ E.limit_identify.inverse '' connectedComponent x := |
| 55 | ⟨x, mem_connectedComponent, rfl⟩ |
| 56 | exact Set.Subset.antisymm (hconnected.subset_connectedComponent hx) |
| 57 | ((show IsClopen _ from ⟨hcompact.isClosed, hopen⟩).connectedComponent_subset hx) |
| 58 | |
| 59 | /-- A compact terminal component meeting the cutoff core corresponds to a |
| 60 | whole pre-component in the interior of the retained region. -/ |
| 61 | theorem SurgeryEventTerminalPolicy.compact_pre_component_subset_interior |
| 62 | (policy : SurgeryEventTerminalPolicy E) |
| 63 | {x : E.terminal.carrier} (hC : IsCompact (connectedComponent x)) |
| 64 | (hlow : ∃ y ∈ connectedComponent x, |
| 65 | E.limit_connection.scalarCurvature y ≤ (P.delta T * P.r T)⁻¹ ^ 2) : |
| 66 | connectedComponent (E.limit_identify.inverse x) ⊆ interior E.retained_pre := by |
| 67 | let : LocallyConnectedSpace (slice E.tMinus).carrier := |
| 68 | ChartedSpace.locallyConnectedSpace (EuclideanSpace ℝ (Fin 3)) (slice E.tMinus).carrier |
| 69 | apply isOpen_connectedComponent.subset_interior_iff.2 |
| 70 | rw [← E.limit_inverse_image_component hC] |
| 71 | rintro z ⟨y, hy, rfl⟩ |
| 72 | obtain ⟨w, hw, hwy⟩ := policy.compact_component_retained hC hlow hy |
| 73 | rw [← hwy, E.limit_identify.left_inverse (E.retained_pre_subset hw)] |
| 74 | exact hw |
| 75 | |
| 76 | /-- The retained image of such a whole pre-component misses every inserted |
| 77 | cap, including its boundary. -/ |
| 78 | theorem SurgeryEventTerminalPolicy.compact_retention_image_disjoint_cap |
| 79 | (policy : SurgeryEventTerminalPolicy E) |
| 80 | {x : E.terminal.carrier} (hC : IsCompact (connectedComponent x)) |
| 81 | (hlow : ∃ y ∈ connectedComponent x, |
| 82 | E.limit_connection.scalarCurvature y ≤ (P.delta T * P.r T)⁻¹ ^ 2) |
| 83 | (i : Fin E.cap_count) : |
| 84 | Disjoint (E.retention.map '' connectedComponent (E.limit_identify.inverse x)) |
| 85 | (E.caps i).carrier := by |
| 86 | have hD := policy.compact_pre_component_subset_interior hC hlow |
| 87 | refine Set.disjoint_left.2 ?_ |
| 88 | rintro z ⟨y, hy, rfl⟩ hcap |
| 89 | have hyret := interior_subset (hD hy) |
| 90 | have hpost : E.retention.map y ∈ E.retained_post := by |
| 91 | exact E.retention.map_image.subset ⟨y, hyret, rfl⟩ |
| 92 | have hboundary : E.retention.map y ∈ frontier (E.caps i).carrier := by |
| 93 | rw [← E.cap_boundary i] |
| 94 | exact ⟨hpost, hcap⟩ |
| 95 | rw [← E.boundary_correspondence i] at hboundary |
| 96 | obtain ⟨w, hw, heq⟩ := hboundary |
| 97 | have hwfront : w ∈ frontier E.retained_pre := by |
| 98 | rw [E.pre_boundary] |
| 99 | exact Set.mem_iUnion.2 ⟨i, hw⟩ |
| 100 | have hwret : w ∈ E.retained_pre := |
| 101 | E.retained_pre_compact.isClosed.closure_eq ▸ frontier_subset_closure hwfront |
| 102 | have hwy : w = y := by |
| 103 | have := congrArg E.retention.inverse heq |
| 104 | simpa only [E.retention.left_inverse hwret, E.retention.left_inverse hyret] using this |
| 105 | subst w |
| 106 | exact (mem_frontier_iff_notMem_interior hyret).1 hwfront (hD hy) |
| 107 | |
| 108 | /-- The literal retention map takes the whole pre-component onto a whole |
| 109 | post-component. Openness follows from the cap-free inverse image. -/ |
| 110 | theorem SurgeryEventTerminalPolicy.compact_retention_image_component |
| 111 | (policy : SurgeryEventTerminalPolicy E) |
| 112 | {x : E.terminal.carrier} (hC : IsCompact (connectedComponent x)) |
| 113 | (hlow : ∃ y ∈ connectedComponent x, |
| 114 | E.limit_connection.scalarCurvature y ≤ (P.delta T * P.r T)⁻¹ ^ 2) : |
| 115 | E.retention.map '' connectedComponent (E.limit_identify.inverse x) = |
| 116 | connectedComponent (E.retention.map (E.limit_identify.inverse x)) := by |
| 117 | let : LocallyConnectedSpace (slice E.tMinus).carrier := |
| 118 | ChartedSpace.locallyConnectedSpace (EuclideanSpace ℝ (Fin 3)) (slice E.tMinus).carrier |
| 119 | let O : Set (slice T).carrier := (⋃ i, (E.caps i).carrier)ᶜ |
| 120 | have hO : IsOpen O := |
| 121 | (isClosed_iUnion_of_finite fun i => (E.caps i).carrier_compact.isClosed).isOpen_compl |
| 122 | have hOret : O ⊆ E.retained_post := by |
| 123 | intro z hz |
| 124 | have hcover : z ∈ E.retained_post ∪ (⋃ i, (E.caps i).carrier) := by |
| 125 | rw [E.post_cover] |
| 126 | exact Set.mem_univ z |
| 127 | exact hcover.resolve_right hz |
| 128 | have hD : connectedComponent (E.limit_identify.inverse x) ⊆ E.retained_pre := |
| 129 | (policy.compact_pre_component_subset_interior hC hlow).trans interior_subset |
| 130 | have ha := E.retention.map_smooth.continuousOn.mono hD |
| 131 | have hset : E.retention.map '' connectedComponent (E.limit_identify.inverse x) = |
| 132 | O ∩ E.retention.inverse ⁻¹' connectedComponent (E.limit_identify.inverse x) := by |
| 133 | ext z |
| 134 | constructor |
| 135 | · intro hz |
| 136 | obtain ⟨y, hy, rfl⟩ := hz |
| 137 | constructor |
| 138 | · intro hcap |
| 139 | obtain ⟨i, hi⟩ := Set.mem_iUnion.1 hcap |
| 140 | exact Set.disjoint_left.1 |
| 141 | (policy.compact_retention_image_disjoint_cap hC hlow i) ⟨y, hy, rfl⟩ hi |
| 142 | · simpa only [Set.mem_preimage, E.retention.left_inverse (hD hy)] using hy |
| 143 | · rintro ⟨hzO, hzD⟩ |
| 144 | exact ⟨E.retention.inverse z, hzD, E.retention.right_inverse (hOret hzO)⟩ |
| 145 | have hopen : IsOpen (E.retention.map '' connectedComponent (E.limit_identify.inverse x)) := by |
| 146 | rw [hset] |
| 147 | exact (E.retention.inverse_smooth.continuousOn.mono hOret).isOpen_inter_preimage |
| 148 | hO isOpen_connectedComponent |
| 149 | have hcompactD : IsCompact (connectedComponent (E.limit_identify.inverse x)) := by |
| 150 | rw [← E.limit_inverse_image_component hC] |
| 151 | exact hC.image (continuousOn_univ.1 E.limit_identify.inverse_smooth.continuousOn) |
| 152 | have hcompact := hcompactD.image_of_continuousOn ha |
| 153 | have hconnected := (isConnected_connectedComponent |
| 154 | (x := E.limit_identify.inverse x)).image E.retention.map ha |
| 155 | have hx : E.retention.map (E.limit_identify.inverse x) ∈ |
| 156 | E.retention.map '' connectedComponent (E.limit_identify.inverse x) := |
| 157 | ⟨E.limit_identify.inverse x, mem_connectedComponent, rfl⟩ |
| 158 | exact Set.Subset.antisymm (hconnected.subset_connectedComponent hx) |
| 159 | ((show IsClopen _ from ⟨hcompact.isClosed, hopen⟩).connectedComponent_subset hx) |
| 160 | |
| 161 | /-- The whole post-component is inside the retained post-region, including |
| 162 | the open-region guard used by the regular-history construction. -/ |
| 163 | theorem SurgeryEventTerminalPolicy.compact_post_component_subset_interior |
| 164 | (policy : SurgeryEventTerminalPolicy E) |
| 165 | {x : E.terminal.carrier} (hC : IsCompact (connectedComponent x)) |
| 166 | (hlow : ∃ y ∈ connectedComponent x, |
| 167 | E.limit_connection.scalarCurvature y ≤ (P.delta T * P.r T)⁻¹ ^ 2) : |
| 168 | connectedComponent (E.retention.map (E.limit_identify.inverse x)) ⊆ |
| 169 | interior E.retained_post := by |
| 170 | let : LocallyConnectedSpace (slice T).carrier := |
| 171 | ChartedSpace.locallyConnectedSpace (EuclideanSpace ℝ (Fin 3)) (slice T).carrier |
| 172 | apply isOpen_connectedComponent.subset_interior_iff.2 |
| 173 | rw [← policy.compact_retention_image_component hC hlow] |
| 174 | rintro z ⟨y, hy, rfl⟩ |
| 175 | exact E.retention.map_image.subset ⟨y, |
| 176 | interior_subset (policy.compact_pre_component_subset_interior hC hlow hy), rfl⟩ |
| 177 | |
| 178 | /-- The terminal and post components are identified by the literal event |
| 179 | maps, with inverse `limit_identify.map o retention.inverse`. -/ |
| 180 | def SurgeryEventTerminalPolicy.compactComponentEquivalence |
| 181 | (policy : SurgeryEventTerminalPolicy E) |
| 182 | {x : E.terminal.carrier} (hC : IsCompact (connectedComponent x)) |
| 183 | (hlow : ∃ y ∈ connectedComponent x, |
| 184 | E.limit_connection.scalarCurvature y ≤ (P.delta T * P.r T)⁻¹ ^ 2) : |
| 185 | SurgeryRegionEquivalence E.terminal (slice T) (connectedComponent x) |
| 186 | (connectedComponent (E.retention.map (E.limit_identify.inverse x))) := by |
| 187 | have hD : connectedComponent (E.limit_identify.inverse x) ⊆ E.retained_pre := |
| 188 | (policy.compact_pre_component_subset_interior hC hlow).trans interior_subset |
| 189 | have hG : Set.MapsTo E.limit_identify.inverse (connectedComponent x) |
| 190 | (connectedComponent (E.limit_identify.inverse x)) := by |
| 191 | intro z hz |
| 192 | exact (E.limit_inverse_image_component hC).subset ⟨z, hz, rfl⟩ |
| 193 | have hB : Set.MapsTo E.retention.inverse |
| 194 | (connectedComponent (E.retention.map (E.limit_identify.inverse x))) |
| 195 | (connectedComponent (E.limit_identify.inverse x)) := by |
| 196 | intro z hz |
| 197 | obtain ⟨y, hy, rfl⟩ := (policy.compact_retention_image_component hC hlow).symm.subset hz |
| 198 | simpa only [E.retention.left_inverse (hD hy)] using hy |
| 199 | refine |
| 200 | { map := E.retention.map ∘ E.limit_identify.inverse |
| 201 | inverse := E.limit_identify.map ∘ E.retention.inverse |
| 202 | map_image := ?_ |
| 203 | inverse_image := ?_ |
| 204 | left_inverse := ?_ |
| 205 | right_inverse := ?_ |
| 206 | map_smooth := ?_ |
| 207 | inverse_smooth := ?_ } |
| 208 | · change (fun z => E.retention.map (E.limit_identify.inverse z)) '' connectedComponent x = _ |
| 209 | rw [← Set.image_image E.retention.map E.limit_identify.inverse (connectedComponent x), |
| 210 | E.limit_inverse_image_component hC, |
| 211 | policy.compact_retention_image_component hC hlow] |
| 212 | · ext z |
| 213 | constructor |
| 214 | · rintro ⟨y, hy, rfl⟩ |
| 215 | obtain ⟨w, hw, heq⟩ := (E.limit_inverse_image_component hC).symm.subset (hB hy) |
| 216 | change E.limit_identify.map (E.retention.inverse y) ∈ connectedComponent x |
| 217 | rw [← heq, E.limit_identify.right_inverse (Set.mem_univ w)] |
| 218 | exact hw |
| 219 | · intro hz |
| 220 | refine ⟨E.retention.map (E.limit_identify.inverse z), ?_, ?_⟩ |
| 221 | · exact (policy.compact_retention_image_component hC hlow).subset |
| 222 | ⟨E.limit_identify.inverse z, hG hz, rfl⟩ |
| 223 | · simp only [Function.comp_apply, E.retention.left_inverse (hD (hG hz)), |
| 224 | E.limit_identify.right_inverse (Set.mem_univ z)] |
| 225 | · intro z hz |
| 226 | simp only [Function.comp_apply, E.retention.left_inverse (hD (hG hz)), |
| 227 | E.limit_identify.right_inverse (Set.mem_univ z)] |
| 228 | · intro z hz |
| 229 | simp only [Function.comp_apply, |
| 230 | E.limit_identify.left_inverse (E.retained_pre_subset (hD (hB hz)))] |
| 231 | exact E.retention.right_inverse (interior_subset |
| 232 | (policy.compact_post_component_subset_interior hC hlow hz)) |
| 233 | · exact E.retention.map_smooth.comp |
| 234 | (E.limit_identify.inverse_smooth.mono (Set.subset_univ _)) (fun _ hz => hD (hG hz)) |
| 235 | · exact E.limit_identify.map_smooth.comp |
| 236 | (E.retention.inverse_smooth.mono |
| 237 | ((policy.compact_post_component_subset_interior hC hlow).trans interior_subset)) |
| 238 | (fun _ hz => E.retained_pre_subset (hD (hB hz))) |
| 239 | |
| 240 | /-- On the retained compact component, the actual post-surgery metric pulls |
| 241 | back to the terminal limit metric, through the actual manifold differential. -/ |
| 242 | theorem SurgeryEventTerminalPolicy.compact_component_metric |
| 243 | (policy : SurgeryEventTerminalPolicy E) |
| 244 | {x : E.terminal.carrier} (hC : IsCompact (connectedComponent x)) |
| 245 | (hlow : ∃ y ∈ connectedComponent x, |
| 246 | E.limit_connection.scalarCurvature y ≤ (P.delta T * P.r T)⁻¹ ^ 2) |
| 247 | (z : E.terminal.carrier) (hz : z ∈ connectedComponent x) |
| 248 | (v w : TangentSpace (𝓡 3) z) : |
| 249 | (metric T).inner (E.retention.map (E.limit_identify.inverse z)) |
| 250 | (mfderiv (𝓡 3) (𝓡 3) (E.retention.map ∘ E.limit_identify.inverse) z v) |
| 251 | (mfderiv (𝓡 3) (𝓡 3) (E.retention.map ∘ E.limit_identify.inverse) z w) = |
| 252 | E.limit_metric.inner z v w := by |
| 253 | have hzD := (E.limit_inverse_image_component hC).subset ⟨z, hz, rfl⟩ |
| 254 | have hzint := policy.compact_pre_component_subset_interior hC hlow hzD |
| 255 | have hzret := interior_subset hzint |
| 256 | have hzU := E.retained_pre_subset hzret |
| 257 | have hg : MDifferentiableAt (𝓡 3) (𝓡 3) E.limit_identify.inverse z := |
| 258 | (contMDiffOn_univ.1 E.limit_identify.inverse_smooth).mdifferentiable (by simp) z |
| 259 | have hf : MDifferentiableAt (𝓡 3) (𝓡 3) E.limit_identify.map |
| 260 | (E.limit_identify.inverse z) := |
| 261 | (E.limit_identify.map_smooth.contMDiffAt |
| 262 | (E.regular_limit_open.mem_nhds hzU)).mdifferentiableAt (by simp) |
| 263 | have ha : MDifferentiableAt (𝓡 3) (𝓡 3) E.retention.map |
| 264 | (E.limit_identify.inverse z) := |
| 265 | (E.retention.map_smooth.contMDiffAt (mem_interior_iff_mem_nhds.1 hzint)).mdifferentiableAt |
| 266 | (by simp) |
| 267 | have hcomp : E.limit_identify.map ∘ E.limit_identify.inverse = id := by |
| 268 | funext y |
| 269 | exact E.limit_identify.right_inverse (Set.mem_univ y) |
| 270 | have hd := mfderiv_comp z hf hg |
| 271 | rw [hcomp, mfderiv_id] at hd |
| 272 | have hv (q : TangentSpace (𝓡 3) z) : |
| 273 | mfderiv (𝓡 3) (𝓡 3) E.limit_identify.map (E.limit_identify.inverse z) |
| 274 | (mfderiv (𝓡 3) (𝓡 3) E.limit_identify.inverse z q) = q := |
| 275 | (congrArg (fun A => A q) hd).symm |
| 276 | have he := E.retained_metric (E.limit_identify.inverse z) hzret |
| 277 | (mfderiv (𝓡 3) (𝓡 3) E.limit_identify.inverse z v) |
| 278 | (mfderiv (𝓡 3) (𝓡 3) E.limit_identify.inverse z w) |
| 279 | rw [hv v, hv w, E.limit_identify.right_inverse (Set.mem_univ z)] at he |
| 280 | simpa only [mfderiv_comp z ha hg, ContinuousLinearMap.comp_apply] using he |
| 281 | |
| 282 | end PoincareMT |