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 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Existence.Lifetime.CanonicalGeometry.CapPersistenceNeckSets |
| 3 | import Mathlib.Topology.Connected.Clopen |
| 4 | |
| 5 | /-! |
| 6 | # Clopen component labels across an actual surgery |
| 7 | |
| 8 | Morgan--Tian Definition 15.8, pp. 361-363, and p. 393. A clopen old |
| 9 | component and its complement induce disjoint clopen sets in the new |
| 10 | slice. The actual cap boundaries prevent two old labels from merging. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set |
| 16 | open scoped Manifold ContDiff Bundle Topology |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.Proofs.M46 |
| 21 | |
| 22 | variable {g0 : StandardInitialMetric} {K : MetricSurgeryConstants} {P : SurgeryParameters} |
| 23 | {slice : ℝ → GeneralizedSliceCarrier.{u}} |
| 24 | {metric : ∀ t, RiemannianMetric 3 (slice t).carrier} {T : ℝ} |
| 25 | |
| 26 | /-- The complete neck carrier is preconnected, including both sides of |
| 27 | its central sphere, as used in the component argument on p. 393. -/ |
| 28 | theorem neck_carrier_isPreconnected |
| 29 | {M : Type*} [TopologicalSpace M] |
| 30 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 31 | {g : RiemannianMetric 3 M} (N : EpsilonNeck g) : IsPreconnected N.carrier := by |
| 32 | have heq : N.region (-N.epsilon⁻¹) N.epsilon⁻¹ = N.carrier := by |
| 33 | ext x |
| 34 | exact ⟨fun hx => hx.1, fun hx => ⟨hx, (N.coordinate_inverse_mem x hx).2⟩⟩ |
| 35 | rw [← heq] |
| 36 | exact N.region_isPreconnected le_rfl le_rfl |
| 37 | |
| 38 | /-- The central sphere is connected in the actual neck carrier, p. 393. -/ |
| 39 | theorem neck_central_sphere_isConnected |
| 40 | {M : Type*} [TopologicalSpace M] |
| 41 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 42 | {g : RiemannianMetric 3 M} (N : EpsilonNeck g) : IsConnected N.central_sphere := by |
| 43 | have hrank : 1 < Module.rank ℝ (EuclideanSpace ℝ (Fin 3)) := by |
| 44 | rw [← Module.finrank_eq_rank, finrank_euclideanSpace_fin] |
| 45 | norm_num |
| 46 | let : PreconnectedSpace UnitTwoSphere := |
| 47 | isPreconnected_iff_preconnectedSpace.mp (isPreconnected_sphere hrank 0 1) |
| 48 | refine ⟨⟨N.center, N.center_on_central_sphere⟩, ?_⟩ |
| 49 | rw [N.central_sphere_eq] |
| 50 | apply (isPreconnected_univ.prod isPreconnected_singleton).image N.coordinate_map |
| 51 | apply N.coordinate_map_smooth.continuousOn.mono |
| 52 | rintro ⟨z, s⟩ ⟨_, hs⟩ |
| 53 | have hs0 : s = 0 := hs |
| 54 | subst s |
| 55 | exact ⟨mem_univ _, neg_neg_of_pos (inv_pos.mpr N.epsilon_pos), |
| 56 | inv_pos.mpr N.epsilon_pos⟩ |
| 57 | |
| 58 | /-- The old points of a cap's actual attachment sphere. -/ |
| 59 | def preAttachment (event : SurgeryEventData g0 K P slice metric T) |
| 60 | (i : Fin event.cap_count) : Set (slice event.tMinus).carrier := |
| 61 | event.limit_identify.inverse '' (event.necks i).neck.central_sphere |
| 62 | |
| 63 | /-- Every attachment sphere belongs to the compact retained pre-region. -/ |
| 64 | theorem preAttachment_subset_retained |
| 65 | (event : SurgeryEventData g0 K P slice metric T) (i : Fin event.cap_count) : |
| 66 | preAttachment event i ⊆ event.retained_pre := by |
| 67 | intro x hx |
| 68 | apply event.retained_pre_compact.isClosed.frontier_subset |
| 69 | rw [event.pre_boundary] |
| 70 | exact mem_iUnion.mpr ⟨i, hx⟩ |
| 71 | |
| 72 | /-- The inverse terminal identification preserves attachment connectedness. -/ |
| 73 | theorem preAttachment_isConnected |
| 74 | (event : SurgeryEventData g0 K P slice metric T) (i : Fin event.cap_count) : |
| 75 | IsConnected (preAttachment event i) := |
| 76 | (neck_central_sphere_isConnected (event.necks i).neck).image |
| 77 | event.limit_identify.inverse (event.limit_identify.inverse_smooth.continuousOn.mono |
| 78 | (subset_univ _)) |
| 79 | |
| 80 | /-- The post-surgery set bearing the clopen old label S. -/ |
| 81 | def surgeryPostLabel (event : SurgeryEventData g0 K P slice metric T) |
| 82 | (S : Set (slice event.tMinus).carrier) : Set (slice T).carrier := |
| 83 | event.retention.map '' (event.retained_pre ∩ S) ∪ |
| 84 | ⋃ i : {i : Fin event.cap_count // preAttachment event i ⊆ S}, (event.caps i.1).carrier |
| 85 | |
| 86 | /-- Each closed old label has a compact actual post-label. -/ |
| 87 | theorem surgeryPostLabel_isCompact |
| 88 | (event : SurgeryEventData g0 K P slice metric T) |
| 89 | {S : Set (slice event.tMinus).carrier} (hS : IsClosed S) : |
| 90 | IsCompact (surgeryPostLabel event S) := by |
| 91 | apply IsCompact.union |
| 92 | · exact (event.retained_pre_compact.inter_right hS).image_of_continuousOn |
| 93 | (event.retention.map_smooth.continuousOn.mono inter_subset_left) |
| 94 | · exact isCompact_iUnion (fun i => (event.caps i.1).carrier_compact) |
| 95 | |
| 96 | private theorem attachment_in_retained_label |
| 97 | (event : SurgeryEventData g0 K P slice metric T) |
| 98 | {S : Set (slice event.tMinus).carrier} {i : Fin event.cap_count} |
| 99 | (hi : preAttachment event i ⊆ S) |
| 100 | {x : (slice event.tMinus).carrier} (hx : x ∈ event.retained_pre) |
| 101 | (hcap : event.retention.map x ∈ (event.caps i).carrier) : x ∈ S := by |
| 102 | have hpost : event.retention.map x ∈ event.retained_post := |
| 103 | event.retention.map_image.subset (mem_image_of_mem event.retention.map hx) |
| 104 | have hb : event.retention.map x ∈ frontier (event.caps i).carrier := by |
| 105 | rw [← event.cap_boundary i] |
| 106 | exact ⟨hpost, hcap⟩ |
| 107 | rw [← event.boundary_correspondence i] at hb |
| 108 | obtain ⟨z, hz, heq⟩ := hb |
| 109 | have heq' : z = x := event.retention.left_inverse.injOn |
| 110 | (preAttachment_subset_retained event i hz) hx heq |
| 111 | exact heq' ▸ hi hz |
| 112 | |
| 113 | /-- Opposite old labels cannot meet after the actual cap attachments. -/ |
| 114 | theorem surgeryPostLabel_disjoint |
| 115 | (event : SurgeryEventData g0 K P slice metric T) |
| 116 | (S : Set (slice event.tMinus).carrier) : |
| 117 | Disjoint (surgeryPostLabel event S) (surgeryPostLabel event Sᶜ) := by |
| 118 | apply Set.disjoint_left.mpr |
| 119 | intro y hy hz |
| 120 | rcases hy with ⟨x, hx, rfl⟩ | hy |
| 121 | · rcases hz with ⟨z, hz, heq⟩ | hz |
| 122 | · have hzx : z = x := event.retention.left_inverse.injOn hz.1 hx.1 heq |
| 123 | exact hz.2 (hzx.symm ▸ hx.2) |
| 124 | · obtain ⟨⟨i, hi⟩, hcap⟩ := mem_iUnion.mp hz |
| 125 | exact attachment_in_retained_label event hi hx.1 hcap hx.2 |
| 126 | · obtain ⟨⟨i, hi⟩, hy⟩ := mem_iUnion.mp hy |
| 127 | rcases hz with ⟨z, hz, rfl⟩ | hz |
| 128 | · exact hz.2 (attachment_in_retained_label event hi hz.1 hy) |
| 129 | · obtain ⟨⟨j, hj⟩, hz⟩ := mem_iUnion.mp hz |
| 130 | by_cases hij : i = j |
| 131 | · subst j |
| 132 | obtain ⟨x, hx⟩ := (preAttachment_isConnected event i).nonempty |
| 133 | exact hj hx (hi hx) |
| 134 | · exact Set.disjoint_left.mp (event.cap_disjoint i j hij) hy hz |
| 135 | |
| 136 | /-- The two clopen old labels cover the actual post-slice. -/ |
| 137 | theorem surgeryPostLabel_union_compl |
| 138 | (event : SurgeryEventData g0 K P slice metric T) |
| 139 | {S : Set (slice event.tMinus).carrier} (hS : IsClopen S) : |
| 140 | surgeryPostLabel event S ∪ surgeryPostLabel event Sᶜ = univ := by |
| 141 | apply eq_univ_of_forall |
| 142 | intro y |
| 143 | have hy : y ∈ event.retained_post ∪ ⋃ i, (event.caps i).carrier := |
| 144 | event.post_cover.symm ▸ mem_univ y |
| 145 | rcases hy with hy | hy |
| 146 | · rw [← event.retention.map_image] at hy |
| 147 | obtain ⟨x, hx, rfl⟩ := hy |
| 148 | by_cases hxS : x ∈ S |
| 149 | · exact Or.inl (Or.inl ⟨x, ⟨hx, hxS⟩, rfl⟩) |
| 150 | · exact Or.inr (Or.inl ⟨x, ⟨hx, hxS⟩, rfl⟩) |
| 151 | · obtain ⟨i, hy⟩ := mem_iUnion.mp hy |
| 152 | rcases disjoint_or_subset_of_isClopen |
| 153 | (preAttachment_isConnected event i).isPreconnected hS with hi | hi |
| 154 | · have hi' : preAttachment event i ⊆ Sᶜ := fun x hx hxs => |
| 155 | Set.disjoint_left.mp hi hx hxs |
| 156 | exact Or.inr (Or.inr (mem_iUnion.mpr ⟨⟨i, hi'⟩, hy⟩)) |
| 157 | · exact Or.inl (Or.inr (mem_iUnion.mpr ⟨⟨i, hi⟩, hy⟩)) |
| 158 | |
| 159 | /-- Actual retained regions and closed caps propagate clopen labels. -/ |
| 160 | theorem surgeryPostLabel_isClopen |
| 161 | (event : SurgeryEventData g0 K P slice metric T) |
| 162 | {S : Set (slice event.tMinus).carrier} (hS : IsClopen S) : |
| 163 | IsClopen (surgeryPostLabel event S) := by |
| 164 | have hclosed := (surgeryPostLabel_isCompact event hS.isClosed).isClosed |
| 165 | have hother := (surgeryPostLabel_isCompact event hS.compl.isClosed).isClosed |
| 166 | have heq : (surgeryPostLabel event S)ᶜ = surgeryPostLabel event Sᶜ := by |
| 167 | ext x |
| 168 | constructor |
| 169 | · intro hx |
| 170 | have hu : x ∈ surgeryPostLabel event S ∪ surgeryPostLabel event Sᶜ := |
| 171 | (surgeryPostLabel_union_compl event hS).symm ▸ mem_univ x |
| 172 | exact hu.resolve_left hx |
| 173 | · intro hx hxs |
| 174 | exact Set.disjoint_left.mp (surgeryPostLabel_disjoint event S) hxs hx |
| 175 | refine ⟨hclosed, ?_⟩ |
| 176 | have hopen := hother.isOpen_compl |
| 177 | rwa [← heq, compl_compl] at hopen |
| 178 | |
| 179 | /-- An attachment's label extends to its entire connected input neck. -/ |
| 180 | theorem inverse_neck_subset_of_attachment_label |
| 181 | (event : SurgeryEventData g0 K P slice metric T) |
| 182 | {S : Set (slice event.tMinus).carrier} (hS : IsClopen S) |
| 183 | (i : Fin event.cap_count) (hi : preAttachment event i ⊆ S) : |
| 184 | event.limit_identify.inverse '' (event.necks i).neck.carrier ⊆ S := by |
| 185 | have hconn := (neck_carrier_isPreconnected (event.necks i).neck).image |
| 186 | event.limit_identify.inverse (event.limit_identify.inverse_smooth.continuousOn.mono |
| 187 | (subset_univ _)) |
| 188 | apply hconn.subset_isClopen hS |
| 189 | obtain ⟨x, hx⟩ := (preAttachment_isConnected event i).nonempty |
| 190 | exact ⟨x, image_mono (event.necks i).neck.central_sphere_subset hx, hi hx⟩ |
| 191 | |
| 192 | end PoincareMT.Proofs.M46 |