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.Flow.Basic |
| 2 | |
| 3 | /-! |
| 4 | Adapted from Mapher `PoincareMT/Definitions/Ch15/SurgeryContinuation.lean` at |
| 5 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. Declaration bodies are retained; |
| 6 | see `references/ricci-flow/mapher/surgery-adapters-port.json`. |
| 7 | -/ |
| 8 | |
| 9 | /-! |
| 10 | # Surgery continuation and preservation of the old flow |
| 11 | |
| 12 | The finite singular endpoint has a last ordinary slab. The extension keeps |
| 13 | the old metric flow and retained-region maps, performs one surgery at that |
| 14 | endpoint, and continues maximally on the resulting compact slice. Its new |
| 15 | endpoint may be infinite, including after extinction. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | |
| 20 | open scoped Manifold ContDiff Bundle ENNReal Topology |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT |
| 25 | |
| 26 | /-- The last ordinary interval before the next finite singular time. -/ |
| 27 | structure SurgeryPreterminalSlab (F : SurgeryFlowData.{u}) (T : ℝ) where |
| 28 | start : ℝ |
| 29 | start_mem : start ∈ F.time_domain |
| 30 | start_lt : start < T |
| 31 | start_initial_or_surgery : start = 0 ∨ start ∈ F.surgery_times |
| 32 | time_subset : Set.Ico start T ⊆ F.time_domain |
| 33 | surgery_free : Disjoint F.surgery_times (Set.Ioo start T) |
| 34 | flow : RicciFlow 3 (F.slice start).carrier (Set.Ico start T) |
| 35 | identify : ∀ t : Set.Ico start T, |
| 36 | Diffeomorph (𝓡 3) (𝓡 3) (F.slice start).carrier (F.slice t.1).carrier ∞ |
| 37 | initial_identify : ∀ x, identify ⟨start, ⟨le_rfl, start_lt⟩⟩ x = x |
| 38 | metric_pullback : ∀ t x v w, |
| 39 | (F.metric t.1).inner (identify t x) |
| 40 | (mfderiv (𝓡 3) (𝓡 3) (identify t) x v) |
| 41 | (mfderiv (𝓡 3) (𝓡 3) (identify t) x w) = |
| 42 | (flow.metric t.1).inner x v w |
| 43 | transport_compatibility : ∀ a b hab hJ habs, |
| 44 | ∀ s t : ℝ, ∀ hs : s ∈ Set.Icc a b, ∀ ht : t ∈ Set.Icc a b, |
| 45 | ∀ hs' : s ∈ Set.Ico start T, ∀ ht' : t ∈ Set.Ico start T, ∀ x, |
| 46 | (F.regular_slabs a b hab hJ habs).transport ⟨s, hs⟩ ⟨t, ht⟩ |
| 47 | (identify ⟨s, hs'⟩ x) = identify ⟨t, ht'⟩ x |
| 48 | curvature_unbounded : ∀ L : ℝ, ∀ s : ℝ, s < T → |
| 49 | ∃ t ∈ Set.Ioo (max start s) T, ∃ x : (F.slice start).carrier, |
| 50 | L < (flow.connection t).curvatureTensorNorm x |
| 51 | terminal_event : SurgeryEventData F.standard_initial F.local_constants F.parameters |
| 52 | F.slice F.metric T |
| 53 | terminal_vanishing_event : SurgeryVanishingEventData F.parameters F.slice F.metric T |
| 54 | |
| 55 | structure SurgeryContinuationInput (F : SurgeryFlowData.{u}) (T : ℝ) where |
| 56 | terminal_pos : 0 < T |
| 57 | time_domain_eq : F.time_domain = Set.Ico 0 T |
| 58 | last_slab : SurgeryPreterminalSlab F T |
| 59 | admissible : SurgeryFlowAdmissible F |
| 60 | pinched : SurgeryFlowPinched F |
| 61 | canonical : SurgeryCanonicalAssumption F |
| 62 | noncollapsed : SurgeryNoncollapsed F |
| 63 | |
| 64 | /-- Extension means equality of metric flow up to the displayed smooth |
| 65 | identifications, including the actual old surgery identifications. -/ |
| 66 | structure SurgeryFlowExtension (F : SurgeryFlowData.{u}) where |
| 67 | extended : SurgeryFlowData.{u} |
| 68 | old_times : F.time_domain ⊆ extended.time_domain |
| 69 | standard_initial_eq : extended.standard_initial = F.standard_initial |
| 70 | local_constants_eq : extended.local_constants = F.local_constants |
| 71 | parameters_eq : extended.parameters = F.parameters |
| 72 | identify : ∀ t ∈ F.time_domain, |
| 73 | Diffeomorph (𝓡 3) (𝓡 3) (F.slice t).carrier (extended.slice t).carrier ∞ |
| 74 | metric_pullback : ∀ t ht x v w, |
| 75 | (extended.metric t).inner (identify t ht x) |
| 76 | (mfderiv (𝓡 3) (𝓡 3) (identify t ht) x v) |
| 77 | (mfderiv (𝓡 3) (𝓡 3) (identify t ht) x w) = (F.metric t).inner x v w |
| 78 | old_surgery_times : ∀ t ∈ F.time_domain, |
| 79 | t ∈ extended.surgery_times ↔ t ∈ F.surgery_times |
| 80 | ordinary_compatibility : ∀ a b hab hJ habs, |
| 81 | ∀ hJ' : Set.Icc a b ⊆ extended.time_domain, |
| 82 | ∀ habs' : Disjoint extended.surgery_times (Set.Ioc a b), |
| 83 | ∀ s t : Set.Icc a b, ∀ x : (F.slice s.1).carrier, |
| 84 | (extended.regular_slabs a b hab hJ' habs').transport s t |
| 85 | (identify s.1 (hJ s.2) x) = |
| 86 | identify t.1 (hJ t.2) |
| 87 | ((F.regular_slabs a b hab hJ habs).transport s t x) |
| 88 | old_event_reference : ∀ T hT [Nonempty (F.slice T).carrier] |
| 89 | [Nonempty (extended.slice T).carrier], ∀ hT' : T ∈ extended.surgery_times, |
| 90 | (extended.event T hT').tMinus = (F.event T hT).tMinus |
| 91 | old_retained_post : ∀ T hT hT' [Nonempty (F.slice T).carrier] |
| 92 | [Nonempty (extended.slice T).carrier], |
| 93 | identify T (F.surgery_times_subset hT) '' (F.event T hT).retained_post = |
| 94 | (extended.event T hT').retained_post |
| 95 | old_retained_pre : ∀ T hT hT' [Nonempty (F.slice T).carrier] |
| 96 | [Nonempty (extended.slice T).carrier], |
| 97 | ∀ t : Set.Ico (F.event T hT).tMinus T, |
| 98 | ∀ ht : t.1 ∈ F.time_domain, |
| 99 | ∀ ht' : t.1 ∈ Set.Ico (extended.event T hT').tMinus T, |
| 100 | (fun x => ((extended.event T hT').pre_identify ⟨t.1, ht'⟩).symm |
| 101 | (identify t.1 ht ((F.event T hT).pre_identify t x))) '' |
| 102 | (F.event T hT).retained_pre = (extended.event T hT').retained_pre |
| 103 | old_retention : ∀ T hT hT' [Nonempty (F.slice T).carrier] |
| 104 | [Nonempty (extended.slice T).carrier], |
| 105 | ∀ t : Set.Ico (F.event T hT).tMinus T, |
| 106 | ∀ ht : t.1 ∈ F.time_domain, |
| 107 | ∀ ht' : t.1 ∈ Set.Ico (extended.event T hT').tMinus T, |
| 108 | ∀ x ∈ (F.event T hT).retained_pre, |
| 109 | identify T (F.surgery_times_subset hT) ((F.event T hT).retention.map x) = |
| 110 | (extended.event T hT').retention.map |
| 111 | (((extended.event T hT').pre_identify ⟨t.1, ht'⟩).symm |
| 112 | (identify t.1 ht ((F.event T hT).pre_identify t x))) |
| 113 | old_vanishing_reference : ∀ T hT [IsEmpty (F.slice T).carrier] |
| 114 | [IsEmpty (extended.slice T).carrier], ∀ hT' : T ∈ extended.surgery_times, |
| 115 | (extended.vanishing_event T hT').tMinus = (F.vanishing_event T hT).tMinus |
| 116 | |
| 117 | /-! The nonempty terminal operation is the singular-limit surgery built from |
| 118 | the last ordinary slab. Its source event contains the actual M21 results for |
| 119 | every selected neck; the transport fields below identify those necks, caps, |
| 120 | local results, and the disappearing region with the extension event. -/ |
| 121 | structure SurgeryTerminalNonemptyOperationCertificate |
| 122 | {F : SurgeryFlowData.{u}} {T : ℝ} |
| 123 | (I : SurgeryContinuationInput F T) |
| 124 | (E : SurgeryFlowExtension F) |
| 125 | (hT : T ∈ E.extended.surgery_times) |
| 126 | (hsource : Nonempty (F.slice T).carrier) |
| 127 | (hpost : Nonempty (E.extended.slice T).carrier) where |
| 128 | post_identify : Diffeomorph (𝓡 3) (𝓡 3) (F.slice T).carrier |
| 129 | (E.extended.slice T).carrier ∞ |
| 130 | post_metric_pullback : ∀ x v w, |
| 131 | (E.extended.metric T).inner (post_identify x) |
| 132 | (mfderiv (𝓡 3) (𝓡 3) post_identify x v) |
| 133 | (mfderiv (𝓡 3) (𝓡 3) post_identify x w) = |
| 134 | (F.metric T).inner x v w |
| 135 | source_tMinus_eq_start : I.last_slab.terminal_event.tMinus = I.last_slab.start |
| 136 | source_tMinus_mem : I.last_slab.terminal_event.tMinus ∈ F.time_domain |
| 137 | source_pre_flow_eq : HEq I.last_slab.terminal_event.pre_flow I.last_slab.flow |
| 138 | source_pre_identify_eq : HEq I.last_slab.terminal_event.pre_identify I.last_slab.identify |
| 139 | source_vanishing_tMinus_eq_start : |
| 140 | I.last_slab.terminal_vanishing_event.tMinus = I.last_slab.start |
| 141 | source_vanishing_pre_flow_eq : |
| 142 | HEq I.last_slab.terminal_vanishing_event.pre_flow I.last_slab.flow |
| 143 | source_vanishing_pre_identify_eq : |
| 144 | HEq I.last_slab.terminal_vanishing_event.pre_identify I.last_slab.identify |
| 145 | event_tMinus_eq_source : ∀ [Nonempty (E.extended.slice T).carrier], |
| 146 | (E.extended.event T hT).tMinus = I.last_slab.terminal_event.tMinus |
| 147 | event_pre_flow_eq_source : ∀ [Nonempty (E.extended.slice T).carrier], |
| 148 | HEq (E.extended.event T hT).pre_flow I.last_slab.terminal_event.pre_flow |
| 149 | event_pre_identify_eq_source : ∀ [Nonempty (E.extended.slice T).carrier], |
| 150 | HEq (E.extended.event T hT).pre_identify |
| 151 | I.last_slab.terminal_event.pre_identify |
| 152 | retained_post_transport : ∀ [Nonempty (E.extended.slice T).carrier], |
| 153 | post_identify '' I.last_slab.terminal_event.retained_post = |
| 154 | (E.extended.event T hT).retained_post |
| 155 | retained_pre_transport : ∀ [Nonempty (E.extended.slice T).carrier], |
| 156 | HEq (E.identify I.last_slab.terminal_event.tMinus source_tMinus_mem '' |
| 157 | I.last_slab.terminal_event.retained_pre) |
| 158 | ((E.extended.event T hT).retained_pre) |
| 159 | |
| 160 | /-- The selected neck family and all local M21 outputs are transported to |
| 161 | the corresponding family in the extension event. -/ |
| 162 | cap_count_eq : I.last_slab.terminal_event.cap_count = |
| 163 | (E.extended.event T hT).cap_count |
| 164 | limit_identify : Diffeomorph (𝓡 3) (𝓡 3) |
| 165 | I.last_slab.terminal_event.terminal.carrier |
| 166 | (E.extended.event T hT).terminal.carrier ∞ |
| 167 | limit_metric_pullback : ∀ x v w, |
| 168 | (E.extended.event T hT).limit_metric.inner (limit_identify x) |
| 169 | (mfderiv (𝓡 3) (𝓡 3) limit_identify x v) |
| 170 | (mfderiv (𝓡 3) (𝓡 3) limit_identify x w) = |
| 171 | I.last_slab.terminal_event.limit_metric.inner x v w |
| 172 | neck_carrier_transport : ∀ i : Fin I.last_slab.terminal_event.cap_count, |
| 173 | limit_identify '' (I.last_slab.terminal_event.necks i).neck.carrier = |
| 174 | ((E.extended.event T hT).necks (Fin.cast cap_count_eq i)).neck.carrier |
| 175 | cap_carrier_transport : ∀ i : Fin I.last_slab.terminal_event.cap_count, |
| 176 | post_identify '' (I.last_slab.terminal_event.caps i).carrier = |
| 177 | ((E.extended.event T hT).caps (Fin.cast cap_count_eq i)).carrier |
| 178 | local_result_output_identify : ∀ i : Fin I.last_slab.terminal_event.cap_count, |
| 179 | Diffeomorph (𝓡 3) (𝓡 3) |
| 180 | (I.last_slab.terminal_event.local_result i).output.carrier |
| 181 | ((E.extended.event T hT).local_result (Fin.cast cap_count_eq i)).output.carrier ∞ |
| 182 | local_result_collapse_transport : ∀ i : Fin I.last_slab.terminal_event.cap_count, |
| 183 | ∀ x : I.last_slab.terminal_event.terminal.carrier, |
| 184 | post_identify |
| 185 | (I.last_slab.terminal_event.local_embed i |
| 186 | ((I.last_slab.terminal_event.local_result i).collapse x)) = |
| 187 | (E.extended.event T hT).local_embed (Fin.cast cap_count_eq i) |
| 188 | (((E.extended.event T hT).local_result (Fin.cast cap_count_eq i)).collapse |
| 189 | (limit_identify x) |
| 190 | ) |
| 191 | boundary_transport : ∀ i : Fin I.last_slab.terminal_event.cap_count, |
| 192 | post_identify '' (I.last_slab.terminal_event.retained_post ∩ |
| 193 | (I.last_slab.terminal_event.caps i).carrier) = |
| 194 | (E.extended.event T hT).retained_post ∩ |
| 195 | ((E.extended.event T hT).caps (Fin.cast cap_count_eq i)).carrier |
| 196 | disappearing_start_eq : I.last_slab.terminal_event.disappearing_start = |
| 197 | (E.extended.event T hT).disappearing_start |
| 198 | disappearing_cover_transport : |
| 199 | HEq I.last_slab.terminal_event.disappearing_cover |
| 200 | (E.extended.event T hT).disappearing_cover |
| 201 | |
| 202 | /-! The vanishing terminal branch has no post-surgery carrier. It retains the |
| 203 | source singular-limit event and explicitly transports only the vanishing data |
| 204 | and its disappearing-region cover. -/ |
| 205 | structure SurgeryTerminalVanishingOperationCertificate |
| 206 | {F : SurgeryFlowData.{u}} {T : ℝ} |
| 207 | (I : SurgeryContinuationInput F T) |
| 208 | (E : SurgeryFlowExtension F) |
| 209 | (hT : T ∈ E.extended.surgery_times) |
| 210 | (hsource : IsEmpty (F.slice T).carrier) |
| 211 | (hempty : IsEmpty (E.extended.slice T).carrier) where |
| 212 | source_tMinus_eq_start : I.last_slab.terminal_vanishing_event.tMinus = I.last_slab.start |
| 213 | source_tMinus_mem : I.last_slab.terminal_vanishing_event.tMinus ∈ F.time_domain |
| 214 | source_pre_flow_eq : HEq I.last_slab.terminal_vanishing_event.pre_flow I.last_slab.flow |
| 215 | source_pre_identify_eq : |
| 216 | HEq I.last_slab.terminal_vanishing_event.pre_identify I.last_slab.identify |
| 217 | vanishing_tMinus_eq_source : |
| 218 | (E.extended.vanishing_event T hT).tMinus = |
| 219 | I.last_slab.terminal_vanishing_event.tMinus |
| 220 | vanishing_pre_flow_eq_source : |
| 221 | HEq (E.extended.vanishing_event T hT).pre_flow |
| 222 | I.last_slab.terminal_vanishing_event.pre_flow |
| 223 | vanishing_pre_identify_eq_source : |
| 224 | HEq (E.extended.vanishing_event T hT).pre_identify |
| 225 | I.last_slab.terminal_vanishing_event.pre_identify |
| 226 | disappearing_start_eq : |
| 227 | I.last_slab.terminal_vanishing_event.disappearing_start = |
| 228 | (E.extended.vanishing_event T hT).disappearing_start |
| 229 | disappearing_cover_transport : |
| 230 | HEq I.last_slab.terminal_vanishing_event.disappearing_cover |
| 231 | (E.extended.vanishing_event T hT).disappearing_cover |
| 232 | |
| 233 | /-- The cutoff scale is chosen uniformly before the flow and singular time. |
| 234 | Its dependence on the canonical parameters is explicit. -/ |
| 235 | structure SurgeryContinuationScales (K : MetricSurgeryConstants) where |
| 236 | epsilon₀ : ℝ |
| 237 | epsilon₀_pos : 0 < epsilon₀ |
| 238 | epsilon₀_le : epsilon₀ ≤ 1 / 200 |
| 239 | C₀ : ℝ → ℝ |
| 240 | C₀_pos : ∀ epsilon : ℝ, 0 < epsilon → 0 < C₀ epsilon |
| 241 | delta₀ : ℝ → ℝ → ℝ |
| 242 | delta₀_pos : ∀ epsilon C : ℝ, 0 < epsilon → epsilon ≤ epsilon₀ → |
| 243 | C₀ epsilon ≤ C → 0 < delta₀ epsilon C |
| 244 | delta₀_le : ∀ epsilon C : ℝ, 0 < epsilon → epsilon ≤ epsilon₀ → |
| 245 | C₀ epsilon ≤ C → delta₀ epsilon C ≤ min K.delta₀ (epsilon / 6) |
| 246 | h : ℝ → ℝ → ℝ → ℝ → ℝ |
| 247 | h_pos : ∀ epsilon C r delta : ℝ, |
| 248 | 0 < epsilon → epsilon ≤ epsilon₀ → C₀ epsilon ≤ C → 0 < r → |
| 249 | 0 < delta → delta ≤ delta₀ epsilon C → 0 < h epsilon C r delta |
| 250 | h_bound : ∀ epsilon C r delta : ℝ, |
| 251 | 0 < epsilon → epsilon ≤ epsilon₀ → C₀ epsilon ≤ C → 0 < r → |
| 252 | 0 < delta → delta ≤ delta₀ epsilon C → |
| 253 | h epsilon C r delta ≤ min (delta ^ 2 * r) (K.R₀ ^ (-1 / 2 : ℝ)) |
| 254 | |
| 255 | structure SurgeryContinuationConclusion {F : SurgeryFlowData.{u}} |
| 256 | {T : ℝ} (I : SurgeryContinuationInput F T) where |
| 257 | extension : SurgeryFlowExtension F |
| 258 | end_time : ℝ≥0∞ |
| 259 | extends_past : ENNReal.ofReal T < end_time |
| 260 | time_domain_eq : extension.extended.time_domain = |
| 261 | {t : ℝ | 0 ≤ t ∧ ENNReal.ofReal t < end_time} |
| 262 | surgery_at_terminal : T ∈ extension.extended.surgery_times |
| 263 | terminal_operation : |
| 264 | (∃ hsource : Nonempty (F.slice T).carrier, |
| 265 | ∃ hpost : Nonempty (extension.extended.slice T).carrier, |
| 266 | Nonempty (SurgeryTerminalNonemptyOperationCertificate I extension |
| 267 | surgery_at_terminal hsource hpost)) ∨ |
| 268 | (∃ hsource : IsEmpty (F.slice T).carrier, |
| 269 | ∃ hempty : IsEmpty (extension.extended.slice T).carrier, |
| 270 | Nonempty (SurgeryTerminalVanishingOperationCertificate I extension |
| 271 | surgery_at_terminal hsource hempty)) |
| 272 | post_terminal_interval : ∃ d : ℝ, 0 < d ∧ |
| 273 | Set.Ioo T (T + d) ⊆ extension.extended.time_domain ∧ |
| 274 | Disjoint extension.extended.surgery_times (Set.Ioo T (T + d)) |
| 275 | admissible : SurgeryFlowAdmissible extension.extended |
| 276 | pinched : SurgeryFlowPinched extension.extended |
| 277 | canonical : SurgeryCanonicalAssumption extension.extended |
| 278 | noncollapsed : SurgeryNoncollapsed extension.extended |
| 279 | terminal_reference_after : ∀ [Nonempty (extension.extended.slice T).carrier], |
| 280 | I.last_slab.start ≤ (extension.extended.event T surgery_at_terminal).tMinus |
| 281 | terminal_vanishing_reference_after : ∀ [IsEmpty (extension.extended.slice T).carrier], |
| 282 | I.last_slab.start ≤ (extension.extended.vanishing_event T surgery_at_terminal).tMinus |
| 283 | |
| 284 | end PoincareMT |