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.StandardCap.Existence.Lifetime.CanonicalGeometry.CapPersistenceRegularCore |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Existence.Lifetime.CanonicalGeometry.CapPersistenceNeckSets |
| 3 | |
| 4 | /-! |
| 5 | # The two actual sides of the cap boundary collar |
| 6 | |
| 7 | Each connected punctured half of the boundary neck lies either in the |
| 8 | open core or in the end. Actual accumulation from both regions forces |
| 9 | opposite sides, without assuming an axial orientation. Source: Morgan-Tian |
| 10 | Proposition 9.79(3), p. 234, and Theorem 12.28, pp. 323-324. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set |
| 16 | open scoped Manifold ContDiff Bundle |
| 17 | |
| 18 | namespace PoincareMT.CapCertificate |
| 19 | |
| 20 | variable {M : Type*} [TopologicalSpace M] |
| 21 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 22 | [MeasurableSpace M] [BorelSpace M] [T3Space M] |
| 23 | {g : RiemannianMetric 3 M} (N : CapCertificate g) |
| 24 | |
| 25 | /-- A preconnected part of the cap avoiding its actual boundary lies |
| 26 | wholly in one of the two actual open regions (Proposition 9.79(3)). -/ |
| 27 | theorem subset_core_or_end_of_preconnected {S : Set M} |
| 28 | (hS : IsPreconnected S) (hSV : S ⊆ N.carrier) |
| 29 | (hboundary : Disjoint S N.boundary_sphere) : |
| 30 | S ⊆ N.core ∨ S ⊆ N.end_neck.carrier := by |
| 31 | have hcore : IsOpen N.core := by rw [N.core_eq_interior_closed_core]; exact isOpen_interior |
| 32 | apply hS.subset_or_subset hcore N.end_neck.carrier_open N.core_disjoint_end_neck |
| 33 | intro x hx |
| 34 | by_cases hxy : x ∈ N.closed_core |
| 35 | · apply Or.inl |
| 36 | rw [N.core_eq_interior_closed_core] |
| 37 | by_contra hnot |
| 38 | have hfront : x ∈ frontier N.closed_core := ⟨subset_closure hxy, hnot⟩ |
| 39 | exact Set.disjoint_left.mp hboundary hx (N.core_frontier_eq_boundary ▸ hfront) |
| 40 | · apply Or.inr |
| 41 | by_contra hnot |
| 42 | apply hxy |
| 43 | rw [N.closed_core_eq_complement_end] |
| 44 | exact ⟨hSV hx, hnot⟩ |
| 45 | |
| 46 | /-- Each half-interval not crossing zero has a single actual collar |
| 47 | side. No regularity is asserted for inverse coordinates off the neck. -/ |
| 48 | theorem boundary_neck_region_subset_core_or_end {a b : ℝ} |
| 49 | (ha : -N.boundary_neck.epsilon⁻¹ ≤ a) (hb : b ≤ N.boundary_neck.epsilon⁻¹) |
| 50 | (hsign : b ≤ 0 ∨ 0 ≤ a) : |
| 51 | N.boundary_neck.region a b ⊆ N.core ∨ |
| 52 | N.boundary_neck.region a b ⊆ N.end_neck.carrier := by |
| 53 | apply N.subset_core_or_end_of_preconnected |
| 54 | (N.boundary_neck.region_isPreconnected ha hb) |
| 55 | (fun _ hx => N.boundary_neck_subset hx.1) |
| 56 | apply Set.disjoint_left.mpr |
| 57 | intro x hx hxB |
| 58 | have hx0 := (N.boundary_neck.mem_central_sphere_iff_of_mem hx.1).mp |
| 59 | (N.boundary_eq_neck_sphere ▸ hxB) |
| 60 | rcases hsign with hs | hs |
| 61 | · have ht := hx.2.2 |
| 62 | rw [hx0] at ht |
| 63 | exact (not_lt_of_ge hs) ht |
| 64 | · have ht := hx.2.1 |
| 65 | rw [hx0] at ht |
| 66 | exact (not_lt_of_ge hs) ht |
| 67 | |
| 68 | /-- A centered boundary-neck strip has opposite core and end halves. |
| 69 | The orientation is derived from the actual regular core and end |
| 70 | attachment, not added as data (Proposition 9.79(3)). -/ |
| 71 | theorem boundary_neck_opposite_sides {r : ℝ} (hr : 0 < r) |
| 72 | (hrN : r ≤ N.boundary_neck.epsilon⁻¹) : |
| 73 | (N.boundary_neck.region (-r) 0 ⊆ N.core ∧ |
| 74 | N.boundary_neck.region 0 r ⊆ N.end_neck.carrier) ∨ |
| 75 | (N.boundary_neck.region 0 r ⊆ N.core ∧ |
| 76 | N.boundary_neck.region (-r) 0 ⊆ N.end_neck.carrier) := by |
| 77 | have he : 0 < N.boundary_neck.epsilon⁻¹ := inv_pos.mpr N.boundary_neck.epsilon_pos |
| 78 | have hA := N.boundary_neck_region_subset_core_or_end (neg_le_neg hrN) he.le |
| 79 | (Or.inl le_rfl) |
| 80 | have hB := N.boundary_neck_region_subset_core_or_end (neg_nonpos.mpr he.le) hrN |
| 81 | (Or.inr le_rfl) |
| 82 | have hcB : N.boundary_neck.center ∈ N.boundary_sphere := |
| 83 | N.boundary_eq_neck_sphere.symm ▸ N.boundary_neck.center_on_central_sphere |
| 84 | have hcN := N.boundary_neck.central_sphere_subset N.boundary_neck.center_on_central_sphere |
| 85 | have hc0 := (N.boundary_neck.mem_central_sphere_iff_of_mem hcN).mp |
| 86 | N.boundary_neck.center_on_central_sphere |
| 87 | have hc : N.boundary_neck.center ∈ N.boundary_neck.region (-r) r := by |
| 88 | exact ⟨hcN, by rw [hc0]; exact neg_neg_of_pos hr, by rw [hc0]; exact hr⟩ |
| 89 | have hhalves {x : M} (hx : x ∈ N.boundary_neck.region (-r) r) |
| 90 | (hxB : x ∉ N.boundary_sphere) : |
| 91 | x ∈ N.boundary_neck.region (-r) 0 ∪ N.boundary_neck.region 0 r := by |
| 92 | have hn : (N.boundary_neck.coordinate_inverse x).2 ≠ 0 := by |
| 93 | intro hzero |
| 94 | apply hxB |
| 95 | rw [N.boundary_eq_neck_sphere] |
| 96 | exact (N.boundary_neck.mem_central_sphere_iff_of_mem hx.1).mpr hzero |
| 97 | rcases lt_or_gt_of_ne hn with hneg | hpos |
| 98 | · exact Or.inl ⟨hx.1, hx.2.1, hneg⟩ |
| 99 | · exact Or.inr ⟨hx.1, hpos, hx.2.2⟩ |
| 100 | have hcore : ∃ x ∈ N.boundary_neck.region (-r) 0 ∪ N.boundary_neck.region 0 r, |
| 101 | x ∈ N.core := by |
| 102 | obtain ⟨x, hx, hxc⟩ := mem_closure_iff.mp (N.boundary_subset_closure_core hcB) |
| 103 | _ (N.boundary_neck.region_isOpen (-r) r) hc |
| 104 | refine ⟨x, hhalves hx ?_, hxc⟩ |
| 105 | intro hxB |
| 106 | have hxfront : x ∈ frontier N.closed_core := N.core_frontier_eq_boundary.symm ▸ hxB |
| 107 | exact hxfront.2 (N.core_eq_interior_closed_core ▸ hxc) |
| 108 | have hend : ∃ x ∈ N.boundary_neck.region (-r) 0 ∪ N.boundary_neck.region 0 r, |
| 109 | x ∈ N.end_neck.carrier := by |
| 110 | have hcfront : N.boundary_neck.center ∈ frontier N.end_neck.carrier := |
| 111 | (N.boundary_eq_end_frontier ▸ hcB).2 |
| 112 | obtain ⟨x, hx, hxe⟩ := mem_closure_iff.mp (frontier_subset_closure hcfront) |
| 113 | _ (N.boundary_neck.region_isOpen (-r) r) hc |
| 114 | refine ⟨x, hhalves hx ?_, hxe⟩ |
| 115 | intro hxB |
| 116 | have hy := N.boundary_subset_closed_core hxB |
| 117 | rw [N.closed_core_eq_complement_end] at hy |
| 118 | exact hy.2 hxe |
| 119 | rcases hA with hAc | hAe |
| 120 | · rcases hB with hBc | hBe |
| 121 | · obtain ⟨x, hx, hxe⟩ := hend |
| 122 | exact False.elim (Set.disjoint_left.mp N.core_disjoint_end_neck |
| 123 | (hx.elim (fun h => hAc h) (fun h => hBc h)) hxe) |
| 124 | · exact Or.inl ⟨hAc, hBe⟩ |
| 125 | · rcases hB with hBc | hBe |
| 126 | · exact Or.inr ⟨hBc, hAe⟩ |
| 127 | · obtain ⟨x, hx, hxc⟩ := hcore |
| 128 | exact False.elim (Set.disjoint_left.mp N.core_disjoint_end_neck hxc |
| 129 | (hx.elim (fun h => hAe h) (fun h => hBe h))) |
| 130 | |
| 131 | end PoincareMT.CapCertificate |