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.Volume.Surgery.Event.EventComponents |
| 2 | import PoincareLib.Geometry.RicciFlow.Volume.Surgery.Count.InitialComponents |
| 3 | import PoincareLib.Geometry.RicciFlow.Volume.Surgery.Event.FlowEventCounts |
| 4 | import PoincareLib.Geometry.RicciFlow.Volume.Surgery.Event.EventHistory |
| 5 | import PoincareLib.Geometry.RicciFlow.Volume.Surgery.Topology.ComponentCardinality |
| 6 | import PoincareLib.Geometry.RicciFlow.Volume.Surgery.Analysis.FiniteJumpBalance |
| 7 | import Mathlib.Topology.Instances.Nat |
| 8 | |
| 9 | /-! |
| 10 | Adapted from Mapher `PoincareMT/Proofs/M49/ComponentHistory.lean` at |
| 11 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. |
| 12 | |
| 13 | # Component balance along an actual finite surgery prefix |
| 14 | |
| 15 | Morgan-Tian Lemma 17.12, pp. 410-411. Ordinary identifications |
| 16 | preserve component counts. At a surgery the cap multiplicity bounds |
| 17 | component gains, and a zero-cap or vanishing event removes at least |
| 18 | one component. The finite balance counts every actual prefix event. |
| 19 | -/ |
| 20 | |
| 21 | set_option autoImplicit false |
| 22 | |
| 23 | open Set Filter |
| 24 | open scoped Manifold ContDiff Topology BigOperators |
| 25 | |
| 26 | universe u |
| 27 | |
| 28 | namespace PoincareMT.SurgeryVolume |
| 29 | |
| 30 | /-- Actual ordinary-slab identifications preserve the component count |
| 31 | (MT Lemma 17.12, pp. 410-411), including a degenerate time interval. -/ |
| 32 | theorem regular_component_count_eq (F : SurgeryFlowData.{u}) |
| 33 | {a b : ℝ} (hab : a ≤ b) (hJ : Icc a b ⊆ F.time_domain) |
| 34 | (hno : Disjoint F.surgery_times (Ioc a b)) : |
| 35 | Nat.card (ConnectedComponents (F.slice b).carrier) = |
| 36 | Nat.card (ConnectedComponents (F.slice a).carrier) := by |
| 37 | rcases lt_or_eq_of_le hab with hab | rfl |
| 38 | · let S := F.regular_slabs a b hab hJ hno |
| 39 | exact (S.identify ⟨b, hab.le, le_rfl⟩).toHomeomorph.card_connectedComponents_eq.symm |
| 40 | · rfl |
| 41 | |
| 42 | /-- Actual pre-event identifications make the component count constant |
| 43 | on a full left neighborhood (MT Lemma 17.12, pp. 410-411). -/ |
| 44 | theorem event_component_count_tendsto |
| 45 | {g0 : StandardInitialMetric} {K : MetricSurgeryConstants} {P : SurgeryParameters} |
| 46 | {slice : ℝ → GeneralizedSliceCarrier.{u}} |
| 47 | {metric : ∀ t, RiemannianMetric 3 (slice t).carrier} {T : ℝ} |
| 48 | (E : SurgeryEventData g0 K P slice metric T) : |
| 49 | Tendsto (fun t => Nat.card (ConnectedComponents (slice t).carrier)) |
| 50 | (𝓝[<] T) (𝓝 (Nat.card (ConnectedComponents (slice E.tMinus).carrier))) := by |
| 51 | apply tendsto_const_nhds.congr' |
| 52 | filter_upwards [Ioo_mem_nhdsLT E.tMinus_lt] with t ht |
| 53 | exact (E.pre_identify ⟨t, ht.1.le, ht.2⟩).toHomeomorph.card_connectedComponents_eq |
| 54 | |
| 55 | /-- A vanishing event has its own exact full-left predecessor component |
| 56 | count, without a map to the empty post-slice (MT Lemma 17.12, pp. 410-411). -/ |
| 57 | theorem vanishing_component_count_tendsto |
| 58 | {P : SurgeryParameters} {slice : ℝ → GeneralizedSliceCarrier.{u}} |
| 59 | {metric : ∀ t, RiemannianMetric 3 (slice t).carrier} {T : ℝ} |
| 60 | (E : SurgeryVanishingEventData P slice metric T) : |
| 61 | Tendsto (fun t => Nat.card (ConnectedComponents (slice t).carrier)) |
| 62 | (𝓝[<] T) (𝓝 (Nat.card (ConnectedComponents (slice E.tMinus).carrier))) := by |
| 63 | apply tendsto_const_nhds.congr' |
| 64 | filter_upwards [Ioo_mem_nhdsLT E.tMinus_lt] with t ht |
| 65 | exact (E.pre_identify ⟨t, ht.1.le, ht.2⟩).toHomeomorph.card_connectedComponents_eq |
| 66 | |
| 67 | /-- Every actual event satisfies the component gain/deletion balance |
| 68 | (MT Lemma 17.12, pp. 410-411). The zero-cap discarded-component |
| 69 | witness is explicit, and a vanishing event uses finite nonempty pre-components. -/ |
| 70 | theorem event_component_jump_balance (F : SurgeryFlowData.{u}) |
| 71 | (T : ℝ) (hT : T ∈ F.surgery_times) |
| 72 | (hdiscard : ∀ [Nonempty (F.slice T).carrier], |
| 73 | (F.event T hT).cap_count = 0 → |
| 74 | ∃ x : (F.slice (F.event T hT).tMinus).carrier, |
| 75 | connectedComponent x ⊆ (F.event T hT).retained_preᶜ) : |
| 76 | ∃ L : ℕ, |
| 77 | Tendsto (fun t => Nat.card (ConnectedComponents (F.slice t).carrier)) |
| 78 | (𝓝[<] T) (𝓝 L) ∧ |
| 79 | Nat.card (ConnectedComponents (F.slice T).carrier) + eventDeletionCount F T ≤ |
| 80 | L + eventCapCount F T := by |
| 81 | classical |
| 82 | rcases isEmpty_or_nonempty (F.slice T).carrier with hEmpty | hNonempty |
| 83 | · let := hEmpty |
| 84 | let E := F.vanishing_event T hT |
| 85 | have hpre : E.tMinus ∈ F.time_domain := |
| 86 | vanishingEventPreInterval F T hT ⟨le_rfl, E.tMinus_lt⟩ |
| 87 | let := slice_components_finite F hpre |
| 88 | let := E.pre_nonempty |
| 89 | have hpos : 1 ≤ Nat.card (ConnectedComponents (F.slice E.tMinus).carrier) := |
| 90 | Nat.succ_le_of_lt Nat.card_pos |
| 91 | have hpost : Nat.card (ConnectedComponents (F.slice T).carrier) = 0 := by |
| 92 | apply Nat.card_eq_zero.mpr |
| 93 | refine Or.inl ⟨fun c => ?_⟩ |
| 94 | obtain ⟨y, _⟩ := ConnectedComponents.surjective_coe c |
| 95 | exact isEmptyElim y |
| 96 | refine ⟨_, vanishing_component_count_tendsto E, ?_⟩ |
| 97 | simpa [eventDeletionCount_eq F T hT, eventCapCount_eq_zero_of_isEmpty F T, hpost] |
| 98 | using hpos |
| 99 | · let := hNonempty |
| 100 | let E := F.event T hT |
| 101 | have hpre : E.tMinus ∈ F.time_domain := |
| 102 | nonemptyEventPreInterval F T hT ⟨le_rfl, E.tMinus_lt⟩ |
| 103 | let := slice_components_finite F hpre |
| 104 | have hcap : eventCapCount F T = E.cap_count := eventCapCount_eq F T hT |
| 105 | refine ⟨_, event_component_count_tendsto E, ?_⟩ |
| 106 | by_cases hzero : E.cap_count = 0 |
| 107 | · obtain ⟨x, hx⟩ := hdiscard hzero |
| 108 | simpa [eventDeletionCount_eq F T hT, hcap, hzero] using |
| 109 | event_components_card_add_one_le E hzero x hx |
| 110 | · simpa [eventDeletionCount_eq F T hT, hcap, hzero] using event_components_card_le E |
| 111 | |
| 112 | /-- Initial components and all sphere cuts pay for every component |
| 113 | deletion on an included complete event prefix (MT Lemma 17.12, pp. 410-411). -/ |
| 114 | theorem component_history_balance (F : SurgeryFlowData.{u}) {b : ℝ} |
| 115 | (hb : b ∈ F.time_domain) |
| 116 | (hdiscard : ∀ (T : ℝ) (hT : T ∈ F.surgery_times), T ∈ Icc 0 b → |
| 117 | ∀ [Nonempty (F.slice T).carrier], (F.event T hT).cap_count = 0 → |
| 118 | ∃ x : (F.slice (F.event T hT).tMinus).carrier, |
| 119 | connectedComponent x ⊆ (F.event T hT).retained_preᶜ) |
| 120 | (S : Finset ℝ) (hS : (S : Set ℝ) = F.surgery_times ∩ Ioc 0 b) : |
| 121 | Nat.card (ConnectedComponents (F.slice b).carrier) + |
| 122 | ∑ T ∈ S, eventDeletionCount F T ≤ |
| 123 | Nat.card (ConnectedComponents (F.slice 0).carrier) + |
| 124 | ∑ T ∈ S, eventCapCount F T := by |
| 125 | have hmem (t : ℝ) : t ∈ S ↔ t ∈ F.surgery_times ∩ Ioc 0 b := by |
| 126 | change t ∈ (S : Set ℝ) ↔ _ |
| 127 | rw [hS] |
| 128 | apply add_sum_le_add_sum_of_finite_left_jumps S (F.time_domain_nonnegative hb) |
| 129 | (fun t ht => ((hmem t).mp ht).2) |
| 130 | · intro x hx y hy hxy hdisjoint |
| 131 | have hno : Disjoint F.surgery_times (Ioc x y) := by |
| 132 | apply disjoint_left.mpr |
| 133 | intro z hz hzxy |
| 134 | exact disjoint_left.mp hdisjoint |
| 135 | ((hmem z).mpr ⟨hz, hx.1.trans_lt hzxy.1, hzxy.2.trans hy.2⟩) hzxy |
| 136 | have hJ : Icc x y ⊆ F.time_domain := fun t ht => initialInterval_subset F hb |
| 137 | ⟨hx.1.trans ht.1, ht.2.trans hy.2⟩ |
| 138 | exact (regular_component_count_eq F hxy hJ hno).le |
| 139 | · intro T hTS |
| 140 | have hT := (hmem T).mp hTS |
| 141 | exact event_component_jump_balance F T hT.1 |
| 142 | (hdiscard T hT.1 ⟨hT.2.1.le, hT.2.2⟩) |
| 143 | |
| 144 | /-- The number of actual prefix events is bounded by the initial |
| 145 | component count plus twice the total cap multiplicity |
| 146 | (MT Lemma 17.12, pp. 410-411). -/ |
| 147 | theorem event_card_le_initial_add_twice_caps (F : SurgeryFlowData.{u}) {b : ℝ} |
| 148 | (hb : b ∈ F.time_domain) |
| 149 | (hdiscard : ∀ (T : ℝ) (hT : T ∈ F.surgery_times), T ∈ Icc 0 b → |
| 150 | ∀ [Nonempty (F.slice T).carrier], (F.event T hT).cap_count = 0 → |
| 151 | ∃ x : (F.slice (F.event T hT).tMinus).carrier, |
| 152 | connectedComponent x ⊆ (F.event T hT).retained_preᶜ) |
| 153 | (S : Finset ℝ) (hS : (S : Set ℝ) = F.surgery_times ∩ Ioc 0 b) : |
| 154 | S.card ≤ Nat.card (ConnectedComponents (F.slice 0).carrier) + |
| 155 | 2 * ∑ T ∈ S, eventCapCount F T := by |
| 156 | have hcount : S.card ≤ (∑ T ∈ S, eventCapCount F T) + |
| 157 | ∑ T ∈ S, eventDeletionCount F T := by |
| 158 | calc |
| 159 | S.card = ∑ _T ∈ S, (1 : ℕ) := by simp |
| 160 | _ ≤ ∑ T ∈ S, (eventCapCount F T + eventDeletionCount F T) := by |
| 161 | apply Finset.sum_le_sum |
| 162 | intro T hT |
| 163 | apply one_le_event_counts F T |
| 164 | have hTS : T ∈ (S : Set ℝ) := hT |
| 165 | rw [hS] at hTS |
| 166 | exact hTS.1 |
| 167 | _ = _ := Finset.sum_add_distrib |
| 168 | have hbalance := component_history_balance F hb hdiscard S hS |
| 169 | omega |
| 170 | |
| 171 | end PoincareMT.SurgeryVolume |