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.Construction.Terminal.Event.Policy |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.Continuation.Construction.Terminal.Event.Reference |
| 3 | import PoincareLib.Geometry.RicciFlow.Surgery.Continuation.Construction.Terminal.Event.StrongBoundary.Assembled |
| 4 | import PoincareLib.Geometry.RicciFlow.Surgery.Continuation.Construction.Terminal.Restart.Flow.CanonicalTail |
| 5 | |
| 6 | /-! |
| 7 | # The nonempty terminal operation in the original source coordinates |
| 8 | |
| 9 | The source identification is the last ordinary slab followed by the literal |
| 10 | restart extension. The event keeps the original controlled core and its scalar |
| 11 | threshold, including after passing to the canonical disappearing tail. |
| 12 | Source: Morgan--Tian, Definition 15.8, pp. 361-362. |
| 13 | -/ |
| 14 | |
| 15 | noncomputable section |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set TopologicalSpace |
| 20 | open scoped Manifold ContDiff Bundle Topology ENNReal |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.RepairedContinuationLimitBridge |
| 25 | |
| 26 | open Surgery.Terminal.Gluing SurgeryEventRebuild Surgery |
| 27 | |
| 28 | variable {M : Type u} [TopologicalSpace M] |
| 29 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 30 | [MeasurableSpace M] [BorelSpace M] [T2Space M] [T3Space M] [SecondCountableTopology M] |
| 31 | {G : GeneralizedRicciFlowData.{u}} {T : ℝ} {H : SingularTimeAssumptions G T M} |
| 32 | {L : RepairedSingularRegularLimitData H} {N : RepairedHornSelectionData H} |
| 33 | {F : SurgeryFlowData.{u}} {I : RepairedContinuationInput F T} |
| 34 | (B : RepairedContinuationLimitBridge H L N I) |
| 35 | (σ : Ico H.reference.tMinus T) (hclose : T - (F.parameters.h T) ^ 2 < σ.1) |
| 36 | {ι : Type u} [Fintype ι] |
| 37 | (J : ι → MetricSurgeryInput F.local_constants (N.limit.extension.extended.metric T)) |
| 38 | (R : ∀ i, MetricSurgeryResult F.standard_initial (J i)) |
| 39 | (U : Opens (N.limit.extension.extended.slice T).carrier) (hU : Nonempty U) |
| 40 | (hd : Pairwise (fun i j => Disjoint |
| 41 | ((J i).negativeHalf : Set (N.limit.extension.extended.slice T).carrier) (J j).negativeHalf)) |
| 42 | (hc : ∀ i, Disjoint (U : Set (N.limit.extension.extended.slice T).carrier) |
| 43 | (J i).neck.central_sphere) |
| 44 | (hneck : Pairwise (fun i j => Disjoint (J i).neck.carrier (J j).neck.carrier)) |
| 45 | (hUn : ∀ i, (U : Set (N.limit.extension.extended.slice T).carrier) ∩ |
| 46 | (J i).neck.carrier = (J i).negativeHalf) |
| 47 | (hfront : frontier (U : Set (N.limit.extension.extended.slice T).carrier) ⊆ |
| 48 | ⋃ i, (J i).neck.central_sphere) |
| 49 | (hcompact : IsCompact (closure (U : Set (N.limit.extension.extended.slice T).carrier))) |
| 50 | (hcore : {x | N.limit.terminal_scalar x ≤ I.rho⁻¹ ^ 2} ⊆ U) |
| 51 | (htime : ∀ i, (J i).time = T) |
| 52 | (hdelta : ∀ i, (J i).neck.epsilon = F.parameters.delta T) |
| 53 | (hscale : ∀ i, (J i).neck.scale = F.parameters.h T) |
| 54 | {lifetime : ℝ≥0∞} |
| 55 | (O : RicciFlow 3 (cutCarrier J R U hU hd hc).carrier |
| 56 | {t : ℝ | T ≤ t ∧ ENNReal.ofReal t < lifetime}) |
| 57 | (hPost : (⟨cutCarrier J R U hU hd hc, cutMetric J R U hU hd hc⟩ : SliceMetric.{u}) = |
| 58 | Splice.family F T (cutCarrier J R U hU hd hc) O T) |
| 59 | |
| 60 | local notation "cutSlice" => cutCarrier J R U hU hd hc |
| 61 | local notation "E" => B.assembleNonemptyEvent σ hclose J R U hU hd hc hneck hUn hfront |
| 62 | hcompact hcore htime hdelta hscale (Splice.family F T cutSlice O) |
| 63 | (fun t ht => Eq.symm (Splice.family_before F T cutSlice O ht)) hPost |
| 64 | local notation "W" => TerminalRestart.canonicalNonemptyEvent I cutSlice O E |
| 65 | |
| 66 | local instance : Nonempty (cutSlice).carrier := cutCarrier_nonempty J R U hU hd hc |
| 67 | |
| 68 | variable (hC : IsCompact (univ : Set (cutCarrier J R U hU hd hc).carrier)) |
| 69 | (hRP : SurgeryNoTwoSidedProjectivePlane (cutCarrier J R U hU hd hc)) |
| 70 | (hB : ENNReal.ofReal T < lifetime) |
| 71 | (hblow : lifetime ≠ ⊤ → ∀ a s : ℝ, s < lifetime.toReal → |
| 72 | ∃ t ∈ Ioo (max T s) lifetime.toReal, ∃ x : (cutCarrier J R U hU hd hc).carrier, |
| 73 | a < (O.connection t).curvatureTensorNorm x) |
| 74 | |
| 75 | local notation "compat" => B.assembleNonemptyEvent_slab_compatibility σ hclose J R U hU hd hc |
| 76 | hneck hUn hfront hcompact hcore htime hdelta hscale O hPost |
| 77 | local notation "A" => TerminalRestart.extension I cutSlice O W hC hRP hB hblow compat |
| 78 | |
| 79 | local instance : Nonempty ((A).extended.slice T).carrier := |
| 80 | TerminalRestart.slices_nonempty I cutSlice O T I.terminal_pos.le |
| 81 | |
| 82 | set_option maxHeartbeats 800000 in |
| 83 | def assembledNonemptyOperation |
| 84 | (cuts : ∀ i, SurgeryEndCut (J i).neck) |
| 85 | (hretained : closure (U : Set (N.limit.extension.extended.slice T).carrier) = |
| 86 | SurgeryTerminalCoreComponents (N.limit.extension.extended.connection T) I.rho \ |
| 87 | ⋃ i, (cuts i).tail) |
| 88 | (hcoreNe : I.controlled_core.Nonempty) |
| 89 | (hT : T ∈ (A).extended.surgery_times) : |
| 90 | RepairedNonemptyTerminalOperationCertificate I A hT inferInstance := by |
| 91 | let r := B.referenceRebaseTime σ |
| 92 | let f := I.last_slab.identify r |
| 93 | let e := Splice.identifyBefore F T cutSlice O σ.1 σ.2.2 |
| 94 | let d := f.trans e |
| 95 | letI : Nonempty (N.limit.extension.extended.slice T).carrier := hU.map Subtype.val |
| 96 | refine { |
| 97 | reference_time := σ.1 |
| 98 | reference_mem := r.2 |
| 99 | reference_h := F.parameters.h T |
| 100 | reference_h_pos := F.parameters.h_pos T I.terminal_pos.le |
| 101 | reference_h_eq := rfl |
| 102 | reference_close := hclose |
| 103 | event := W |
| 104 | event_eq := (TerminalRestart.event_terminal I cutSlice O W hT).symm |
| 105 | terminal_policy := TerminalRestart.canonicalNonemptyEvent_terminalPolicy I cutSlice O E |
| 106 | (B.assembleNonemptyEvent_terminalPolicy σ hclose J R U hU hd hc hneck hUn hfront |
| 107 | hcompact hcore htime hdelta hscale (Splice.family F T cutSlice O) |
| 108 | (fun t ht => (Splice.family_before F T cutSlice O ht).symm) hPost cuts hretained) |
| 109 | event_tMinus_mem := I.last_slab.time_subset r.2 |
| 110 | event_tMinus_slab_mem := r.2 |
| 111 | event_tMinus_eq_reference := rfl |
| 112 | reference_identify := d |
| 113 | reference_identify_eq := fun _ => rfl |
| 114 | retained_post := (W).retained_post |
| 115 | retained_post_eq := rfl |
| 116 | core_nonempty := hcoreNe |
| 117 | source_to_pre := d |
| 118 | source_to_pre_eq := fun _ => rfl |
| 119 | reference_identify_eq_source := fun _ => rfl |
| 120 | pre_identify_transport := ?_ |
| 121 | regular_limit_source := B.core_map ⁻¹' H.reference.regularLimitSet |
| 122 | regular_limit_transport := ?_ |
| 123 | controlled_core_subset_regular_limit := B.controlled_core_regular |
| 124 | controlled_core_threshold := ?_ |
| 125 | pre_flow_metric_transport := ?_ |
| 126 | disappearing_cover_rebased := fun t x hx => (W).disappearing_cover t.1 t.2 (d x) hx } |
| 127 | · intro t htF htS x |
| 128 | exact (B.assembleNonemptyEvent_pre_identify σ hclose J R U hU hd hc hneck hUn hfront |
| 129 | hcompact hcore htime hdelta hscale (Splice.family F T cutSlice O) |
| 130 | (fun t ht => (Splice.family_before F T cutSlice O ht).symm) hPost t (f x)).trans |
| 131 | (congrArg ((A).identify t.1 htF) (I.last_slab.rebaseIdentify_source r t x)) |
| 132 | · change relabel (C := fun p => Set p.1.carrier) |
| 133 | (Splice.family_before F T cutSlice O σ.2.2).symm |
| 134 | (B.reference_identify σ ⁻¹' H.reference.regularLimitSet) = |
| 135 | d '' (B.core_map ⁻¹' H.reference.regularLimitSet) |
| 136 | rw [← relabel_set_image] |
| 137 | have hsource : f '' (B.core_map ⁻¹' H.reference.regularLimitSet) = |
| 138 | B.reference_identify σ ⁻¹' H.reference.regularLimitSet := by |
| 139 | ext y |
| 140 | constructor |
| 141 | · rintro ⟨x, hx, rfl⟩ |
| 142 | change B.reference_identify σ (f x) ∈ H.reference.regularLimitSet |
| 143 | have hid : B.core_map x = B.reference_identify σ (f x) := |
| 144 | B.core_map_eq_reference_at σ x |
| 145 | exact hid ▸ hx |
| 146 | · intro hy |
| 147 | refine ⟨f.symm y, ?_, f.apply_symm_apply y⟩ |
| 148 | change B.core_map (f.symm y) ∈ H.reference.regularLimitSet |
| 149 | have hid : B.core_map (f.symm y) = B.reference_identify σ (f (f.symm y)) := |
| 150 | B.core_map_eq_reference_at σ (f.symm y) |
| 151 | rw [hid, f.apply_symm_apply] |
| 152 | exact hy |
| 153 | change e '' (B.reference_identify σ ⁻¹' H.reference.regularLimitSet) = |
| 154 | (e ∘ f) '' (B.core_map ⁻¹' H.reference.regularLimitSet) |
| 155 | rw [image_comp, hsource] |
| 156 | · intro x hx |
| 157 | change (N.limit.extension.extended.connection T).scalarCurvature |
| 158 | ((E).limit_identify.map (e (f x))) ≤ I.rho⁻¹ ^ 2 |
| 159 | have hmap := B.assembleNonemptyEvent_source_map σ hclose J R U hU hd hc hneck hUn hfront |
| 160 | hcompact hcore htime hdelta hscale (Splice.family F T cutSlice O) |
| 161 | (fun t ht => (Splice.family_before F T cutSlice O ht).symm) hPost x |
| 162 | exact (congrArg (N.limit.extension.extended.connection T).scalarCurvature hmap).trans_le |
| 163 | (B.controlled_core_terminal_scalar hx) |
| 164 | · intro t x v w |
| 165 | exact B.assembleNonemptyEvent_source_metric σ hclose J R U hU hd hc hneck hUn hfront |
| 166 | hcompact hcore htime hdelta hscale (Splice.family F T cutSlice O) |
| 167 | (fun t ht => (Splice.family_before F T cutSlice O ht).symm) hPost t.1 x v w |
| 168 | |
| 169 | end PoincareMT.RepairedContinuationLimitBridge |