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.Generalized.BoundedDistance.GeometryImports |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Cylinders.CylinderSphereSides |
| 3 | |
| 4 | /-! |
| 5 | # Opposite ordering of disjoint selected cylinder spheres |
| 6 | |
| 7 | Morgan--Tian Claim 10.3, pp. 248-249. The two actual isotopy transports |
| 8 | fix common low and high cylinder tails. Connectedness of the transported |
| 9 | half-cylinders and their exact closures then give opposite ordering of |
| 10 | disjoint selected spheres. No separator or orientation premise is added. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set |
| 16 | open scoped Manifold ContDiff Topology |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.M28 |
| 21 | |
| 22 | variable {X : Type u} [TopologicalSpace X] |
| 23 | |
| 24 | private theorem signedHeight_opposite_order |
| 25 | (φ₀ φ₁ : X ≃ₜ (UnitTwoSphere × Ioo (0 : ℝ) 1)) |
| 26 | (hdisj : ∀ x, cylinderSignedHeight φ₀ x = 0 → cylinderSignedHeight φ₁ x ≠ 0) |
| 27 | (hlow : ∃ x, cylinderSignedHeight φ₀ x < 0 ∧ cylinderSignedHeight φ₁ x < 0) |
| 28 | (hhigh : ∃ x, 0 < cylinderSignedHeight φ₀ x ∧ 0 < cylinderSignedHeight φ₁ x) : |
| 29 | ((∀ x, cylinderSignedHeight φ₁ x = 0 → 0 < cylinderSignedHeight φ₀ x) ∧ |
| 30 | (∀ x, cylinderSignedHeight φ₀ x = 0 → cylinderSignedHeight φ₁ x < 0)) ∨ |
| 31 | ((∀ x, cylinderSignedHeight φ₁ x = 0 → cylinderSignedHeight φ₀ x < 0) ∧ |
| 32 | (∀ x, cylinderSignedHeight φ₀ x = 0 → 0 < cylinderSignedHeight φ₁ x)) := by |
| 33 | have hne : ∀ x ∈ {x | cylinderSignedHeight φ₁ x = 0}, |
| 34 | cylinderSignedHeight φ₀ x ≠ 0 := by |
| 35 | intro x hx hh |
| 36 | exact hdisj x hh hx |
| 37 | rcases (isPreconnected_cylinderSignedHeight_zero φ₁).mapsTo_Ioi_or_Iio |
| 38 | (continuous_cylinderSignedHeight φ₀).continuousOn hne with hpos | hneg |
| 39 | · refine Or.inl ⟨fun x hx => hpos hx, ?_⟩ |
| 40 | have havoid : ∀ x ∈ {x | cylinderSignedHeight φ₀ x < 0}, |
| 41 | cylinderSignedHeight φ₁ x ≠ 0 := by |
| 42 | intro x hx hh |
| 43 | change cylinderSignedHeight φ₀ x < 0 at hx |
| 44 | have hpositive : 0 < cylinderSignedHeight φ₀ x := hpos hh |
| 45 | exact (not_lt_of_ge hpositive.le) hx |
| 46 | have hsubset : {x | cylinderSignedHeight φ₀ x < 0} ⊆ |
| 47 | {x | cylinderSignedHeight φ₁ x < 0} := |
| 48 | fun _ hx => (isPreconnected_cylinderSignedHeight_negative φ₀).gt_of_ne |
| 49 | (continuous_cylinderSignedHeight φ₁).continuousOn havoid hlow hx |
| 50 | have hclosure := closure_mono hsubset |
| 51 | rw [closure_cylinderSignedHeight_negative, closure_cylinderSignedHeight_negative] at hclosure |
| 52 | intro x hx |
| 53 | exact lt_of_le_of_ne (hclosure (show cylinderSignedHeight φ₀ x ≤ 0 from hx.le)) |
| 54 | (hdisj x hx) |
| 55 | · refine Or.inr ⟨fun x hx => hneg hx, ?_⟩ |
| 56 | have havoid : ∀ x ∈ {x | 0 < cylinderSignedHeight φ₀ x}, |
| 57 | cylinderSignedHeight φ₁ x ≠ 0 := by |
| 58 | intro x hx hh |
| 59 | change 0 < cylinderSignedHeight φ₀ x at hx |
| 60 | have hnegative : cylinderSignedHeight φ₀ x < 0 := hneg hh |
| 61 | exact (not_lt_of_ge hnegative.le) hx |
| 62 | have hsubset : {x | 0 < cylinderSignedHeight φ₀ x} ⊆ |
| 63 | {x | 0 < cylinderSignedHeight φ₁ x} := |
| 64 | fun _ hx => (isPreconnected_cylinderSignedHeight_positive φ₀).lt_of_ne |
| 65 | (continuous_cylinderSignedHeight φ₁).continuousOn havoid hhigh hx |
| 66 | have hclosure := closure_mono hsubset |
| 67 | rw [closure_cylinderSignedHeight_positive, closure_cylinderSignedHeight_positive] at hclosure |
| 68 | intro x hx |
| 69 | exact lt_of_le_of_ne (hclosure (show 0 ≤ cylinderSignedHeight φ₀ x from hx.ge)) |
| 70 | (Ne.symm (hdisj x hx)) |
| 71 | |
| 72 | /-- Opposite order for two already chosen cylinder coordinate systems. |
| 73 | Common low and high points keep their orientations coherent when this |
| 74 | lemma is used on several pairs. Source: Claim 10.8, p. 254; |
| 75 | M28 derivation 123. -/ |
| 76 | theorem cylinderSignedHeight_opposite_order |
| 77 | (phi0 phi1 : X ≃ₜ (UnitTwoSphere × Ioo (0 : ℝ) 1)) |
| 78 | (hdisj : ∀ x, cylinderSignedHeight phi0 x = 0 → cylinderSignedHeight phi1 x ≠ 0) |
| 79 | (hlow : ∃ x, cylinderSignedHeight phi0 x < 0 ∧ cylinderSignedHeight phi1 x < 0) |
| 80 | (hhigh : ∃ x, 0 < cylinderSignedHeight phi0 x ∧ 0 < cylinderSignedHeight phi1 x) : |
| 81 | ((∀ x, cylinderSignedHeight phi1 x = 0 → 0 < cylinderSignedHeight phi0 x) ∧ |
| 82 | (∀ x, cylinderSignedHeight phi0 x = 0 → cylinderSignedHeight phi1 x < 0)) ∨ |
| 83 | ((∀ x, cylinderSignedHeight phi1 x = 0 → cylinderSignedHeight phi0 x < 0) ∧ |
| 84 | (∀ x, cylinderSignedHeight phi0 x = 0 → 0 < cylinderSignedHeight phi1 x)) := |
| 85 | signedHeight_opposite_order phi0 phi1 hdisj hlow hhigh |
| 86 | |
| 87 | variable {M : Type u} [TopologicalSpace M] {U : TopologicalSpace.Opens M} |
| 88 | |
| 89 | /-- A total readout of the actual signed height. Its exterior values are |
| 90 | irrelevant; continuity is asserted only on the true cylinder carrier. -/ |
| 91 | noncomputable def ambientCylinderSignedHeight |
| 92 | (φ : U ≃ₜ (UnitTwoSphere × Ioo (0 : ℝ) 1)) (x : M) : ℝ := by |
| 93 | classical |
| 94 | exact if hx : x ∈ U then cylinderSignedHeight φ ⟨x, hx⟩ else 0 |
| 95 | |
| 96 | /-- The ambient readout has the literal transported coordinate on its domain. -/ |
| 97 | theorem ambientCylinderSignedHeight_apply |
| 98 | (φ : U ≃ₜ (UnitTwoSphere × Ioo (0 : ℝ) 1)) {x : M} (hx : x ∈ U) : |
| 99 | ambientCylinderSignedHeight φ x = cylinderSignedHeight φ ⟨x, hx⟩ := by |
| 100 | simp only [ambientCylinderSignedHeight, dif_pos hx] |
| 101 | |
| 102 | /-- No regularity of the arbitrary outside-carrier values is used. -/ |
| 103 | theorem continuousOn_ambientCylinderSignedHeight |
| 104 | (φ : U ≃ₜ (UnitTwoSphere × Ioo (0 : ℝ) 1)) : |
| 105 | ContinuousOn (ambientCylinderSignedHeight φ) (U : Set M) := by |
| 106 | rw [continuousOn_iff_continuous_domRestrict] |
| 107 | change Continuous (fun x : U => ambientCylinderSignedHeight φ (x : M)) |
| 108 | have heq : (fun x : U => ambientCylinderSignedHeight φ (x : M)) = |
| 109 | cylinderSignedHeight φ := by |
| 110 | funext x |
| 111 | exact ambientCylinderSignedHeight_apply φ x.property |
| 112 | rw [heq] |
| 113 | exact continuous_cylinderSignedHeight φ |
| 114 | |
| 115 | end PoincareMT.M28 |
| 116 | |
| 117 | namespace PoincareMT.OpenCylinderModel |
| 118 | |
| 119 | open M28 |
| 120 | |
| 121 | variable {M : Type u} [TopologicalSpace M] |
| 122 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] {U : TopologicalSpace.Opens M} |
| 123 | |
| 124 | /-- Two disjoint actual isotopic spheres admit continuous ambient signed |
| 125 | heights with common fixed tail signs and opposite sphere order. The signs, |
| 126 | order and cutoffs are produced before any path (Claim 10.3). -/ |
| 127 | theorem exists_ordered_isotopic_sphere_heights |
| 128 | (T : OpenCylinderModel (U : Set M)) {S₀ S₁ : Set M} |
| 129 | (hS₀ : SmoothSphereIsotopicIn (U : Set M) S₀ T.middleSphere) |
| 130 | (hS₁ : SmoothSphereIsotopicIn (U : Set M) S₁ T.middleSphere) |
| 131 | (hdisj : Disjoint S₀ S₁) : |
| 132 | ∃ (h₀ h₁ : M → ℝ) (a b : ℝ), |
| 133 | 0 < a ∧ a < 1 / 2 ∧ 1 / 2 < b ∧ b < 1 ∧ |
| 134 | ContinuousOn h₀ (U : Set M) ∧ ContinuousOn h₁ (U : Set M) ∧ |
| 135 | (∀ x ∈ U, h₀ x = 0 ↔ x ∈ S₀) ∧ |
| 136 | (∀ x ∈ U, h₁ x = 0 ↔ x ∈ S₁) ∧ |
| 137 | (∀ x ∈ U, (T.inverse x).2 < a → h₀ x < 0 ∧ h₁ x < 0) ∧ |
| 138 | (∀ x ∈ U, b < (T.inverse x).2 → 0 < h₀ x ∧ 0 < h₁ x) ∧ |
| 139 | (((∀ x ∈ U, x ∈ S₁ → 0 < h₀ x) ∧ |
| 140 | (∀ x ∈ U, x ∈ S₀ → h₁ x < 0)) ∨ |
| 141 | ((∀ x ∈ U, x ∈ S₁ → h₀ x < 0) ∧ |
| 142 | (∀ x ∈ U, x ∈ S₀ → 0 < h₁ x))) := by |
| 143 | obtain ⟨φ₀, a₀, b₀, ha₀, ha₀half, hb₀half, hb₀, hs₀, ht₀⟩ := |
| 144 | T.exists_isotopic_sphere_coordinates hS₀ |
| 145 | obtain ⟨φ₁, a₁, b₁, ha₁, ha₁half, hb₁half, hb₁, hs₁, ht₁⟩ := |
| 146 | T.exists_isotopic_sphere_coordinates hS₁ |
| 147 | let h₀ : M → ℝ := ambientCylinderSignedHeight φ₀ |
| 148 | let h₁ : M → ℝ := ambientCylinderSignedHeight φ₁ |
| 149 | let a : ℝ := min a₀ a₁ |
| 150 | let b : ℝ := max b₀ b₁ |
| 151 | have ha : 0 < a := lt_min ha₀ ha₁ |
| 152 | have hahalf : a < 1 / 2 := (min_le_left _ _).trans_lt ha₀half |
| 153 | have hbhalf : 1 / 2 < b := hb₀half.trans_le (le_max_left _ _) |
| 154 | have hb : b < 1 := max_lt hb₀ hb₁ |
| 155 | have hz₀ (x : M) (hx : x ∈ U) : h₀ x = 0 ↔ x ∈ S₀ := by |
| 156 | dsimp only [h₀] |
| 157 | rw [ambientCylinderSignedHeight_apply φ₀ hx] |
| 158 | exact sub_eq_zero.trans (hs₀ ⟨x, hx⟩) |
| 159 | have hz₁ (x : M) (hx : x ∈ U) : h₁ x = 0 ↔ x ∈ S₁ := by |
| 160 | dsimp only [h₁] |
| 161 | rw [ambientCylinderSignedHeight_apply φ₁ hx] |
| 162 | exact sub_eq_zero.trans (hs₁ ⟨x, hx⟩) |
| 163 | have hlow (x : M) (hx : x ∈ U) (hh : (T.inverse x).2 < a) : |
| 164 | h₀ x < 0 ∧ h₁ x < 0 := by |
| 165 | dsimp only [h₀, h₁] |
| 166 | rw [ambientCylinderSignedHeight_apply φ₀ hx, ambientCylinderSignedHeight_apply φ₁ hx] |
| 167 | change ((φ₀ ⟨x, hx⟩).2 : ℝ) - 1 / 2 < 0 ∧ |
| 168 | ((φ₁ ⟨x, hx⟩).2 : ℝ) - 1 / 2 < 0 |
| 169 | rw [ht₀ ⟨x, hx⟩ (Or.inl (hh.trans_le (min_le_left _ _))), |
| 170 | ht₁ ⟨x, hx⟩ (Or.inl (hh.trans_le (min_le_right _ _)))] |
| 171 | exact ⟨sub_neg.mpr (hh.trans hahalf), sub_neg.mpr (hh.trans hahalf)⟩ |
| 172 | have hhigh (x : M) (hx : x ∈ U) (hh : b < (T.inverse x).2) : |
| 173 | 0 < h₀ x ∧ 0 < h₁ x := by |
| 174 | dsimp only [h₀, h₁] |
| 175 | rw [ambientCylinderSignedHeight_apply φ₀ hx, ambientCylinderSignedHeight_apply φ₁ hx] |
| 176 | change 0 < ((φ₀ ⟨x, hx⟩).2 : ℝ) - 1 / 2 ∧ |
| 177 | 0 < ((φ₁ ⟨x, hx⟩).2 : ℝ) - 1 / 2 |
| 178 | rw [ht₀ ⟨x, hx⟩ (Or.inr ((le_max_left _ _).trans_lt hh)), |
| 179 | ht₁ ⟨x, hx⟩ (Or.inr ((le_max_right _ _).trans_lt hh))] |
| 180 | exact ⟨sub_pos.mpr (hbhalf.trans hh), sub_pos.mpr (hbhalf.trans hh)⟩ |
| 181 | have hne (x : U) (hx₀ : cylinderSignedHeight φ₀ x = 0) : |
| 182 | cylinderSignedHeight φ₁ x ≠ 0 := by |
| 183 | intro hx₁ |
| 184 | exact Set.disjoint_left.mp hdisj |
| 185 | ((hs₀ x).mp (sub_eq_zero.mp hx₀)) ((hs₁ x).mp (sub_eq_zero.mp hx₁)) |
| 186 | have hcommonlow : ∃ x : U, |
| 187 | cylinderSignedHeight φ₀ x < 0 ∧ cylinderSignedHeight φ₁ x < 0 := by |
| 188 | obtain ⟨x, hx⟩ := T.tail_nonempty false ha (hahalf.trans (by norm_num)) |
| 189 | have hx' := (T.mem_tail_iff_m28 false ha (hahalf.trans (by norm_num))).mp hx |
| 190 | refine ⟨⟨x, hx'.1⟩, ?_⟩ |
| 191 | simpa only [h₀, h₁, ambientCylinderSignedHeight_apply _ hx'.1] using hlow x hx'.1 hx'.2 |
| 192 | have hcommonhigh : ∃ x : U, |
| 193 | 0 < cylinderSignedHeight φ₀ x ∧ 0 < cylinderSignedHeight φ₁ x := by |
| 194 | have hbpos : 0 < b := (by norm_num : (0 : ℝ) < 1 / 2).trans hbhalf |
| 195 | obtain ⟨x, hx⟩ := T.tail_nonempty true hbpos hb |
| 196 | have hx' := (T.mem_tail_iff_m28 true hbpos hb).mp hx |
| 197 | refine ⟨⟨x, hx'.1⟩, ?_⟩ |
| 198 | simpa only [h₀, h₁, ambientCylinderSignedHeight_apply _ hx'.1] using hhigh x hx'.1 hx'.2 |
| 199 | refine ⟨h₀, h₁, a, b, ha, hahalf, hbhalf, hb, |
| 200 | continuousOn_ambientCylinderSignedHeight φ₀, |
| 201 | continuousOn_ambientCylinderSignedHeight φ₁, hz₀, hz₁, hlow, hhigh, ?_⟩ |
| 202 | rcases signedHeight_opposite_order φ₀ φ₁ hne hcommonlow hcommonhigh with horder | horder |
| 203 | · left |
| 204 | constructor |
| 205 | · intro x hx hs |
| 206 | dsimp only [h₀] |
| 207 | rw [ambientCylinderSignedHeight_apply φ₀ hx] |
| 208 | exact horder.1 ⟨x, hx⟩ (sub_eq_zero.mpr ((hs₁ ⟨x, hx⟩).mpr hs)) |
| 209 | · intro x hx hs |
| 210 | dsimp only [h₁] |
| 211 | rw [ambientCylinderSignedHeight_apply φ₁ hx] |
| 212 | exact horder.2 ⟨x, hx⟩ (sub_eq_zero.mpr ((hs₀ ⟨x, hx⟩).mpr hs)) |
| 213 | · right |
| 214 | constructor |
| 215 | · intro x hx hs |
| 216 | dsimp only [h₀] |
| 217 | rw [ambientCylinderSignedHeight_apply φ₀ hx] |
| 218 | exact horder.1 ⟨x, hx⟩ (sub_eq_zero.mpr ((hs₁ ⟨x, hx⟩).mpr hs)) |
| 219 | · intro x hx hs |
| 220 | dsimp only [h₁] |
| 221 | rw [ambientCylinderSignedHeight_apply φ₁ hx] |
| 222 | exact horder.2 ⟨x, hx⟩ (sub_eq_zero.mpr ((hs₀ ⟨x, hx⟩).mpr hs)) |
| 223 | |
| 224 | end PoincareMT.OpenCylinderModel |