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.CylinderTripleCoordinates |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Cylinders.CylinderComponentSide |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Spheres.CoherentSphereOrder |
| 5 | |
| 6 | /-! |
| 7 | # Actual middle-sphere crossing heights from source geometry |
| 8 | |
| 9 | The three actual isotopies produce coherently oriented coordinates. |
| 10 | Identify the full initial component with one half, use the connecting |
| 11 | set to determine the remaining sphere order, and orient the final height. |
| 12 | Source: Morgan--Tian Claim 10.8, p. 254; M28 derivation 124. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set |
| 18 | open scoped Manifold ContDiff Topology |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.M28 |
| 23 | |
| 24 | variable {X : Type*} [TopologicalSpace X] |
| 25 | |
| 26 | private theorem cylinderSignedHeight_middle_signs_reverse |
| 27 | (phiS phiC phiH : X ≃ₜ (UnitTwoSphere × Ioo (0 : ℝ) 1)) |
| 28 | (hCneg : ∀ x, cylinderSignedHeight phiC x = 0 → cylinderSignedHeight phiS x < 0) |
| 29 | (hHneg : ∀ x, cylinderSignedHeight phiH x = 0 → cylinderSignedHeight phiS x < 0) |
| 30 | (hCH : ∀ x, cylinderSignedHeight phiC x = 0 → cylinderSignedHeight phiH x ≠ 0) |
| 31 | (hlow : ∃ x, cylinderSignedHeight phiS x < 0 ∧ |
| 32 | cylinderSignedHeight phiC x < 0 ∧ cylinderSignedHeight phiH x < 0) |
| 33 | (hhigh : ∃ x, 0 < cylinderSignedHeight phiS x ∧ |
| 34 | 0 < cylinderSignedHeight phiC x ∧ 0 < cylinderSignedHeight phiH x) |
| 35 | {b q z p : X} (hb : cylinderSignedHeight phiS b = 0) |
| 36 | (hq : cylinderSignedHeight phiC q = 0) (hz : cylinderSignedHeight phiH z = 0) |
| 37 | {K P : Set X} (hK : IsPreconnected K) (hbK : b ∈ K) (hqK : q ∈ K) |
| 38 | (havoidK : ∀ x ∈ K, cylinderSignedHeight phiH x ≠ 0) |
| 39 | (hP : IsPreconnected P) (hzP : z ∈ P) (hpP : p ∈ P) |
| 40 | (havoidP : ∀ x ∈ P, cylinderSignedHeight phiC x ≠ 0) : |
| 41 | 0 < cylinderSignedHeight phiC b ∧ cylinderSignedHeight phiC p < 0 := by |
| 42 | obtain ⟨l, hlS, hlC, hlH⟩ := hlow |
| 43 | obtain ⟨r, hrS, hrC, hrH⟩ := hhigh |
| 44 | have hSC : ∀ x, cylinderSignedHeight phiS x = 0 → |
| 45 | cylinderSignedHeight phiC x ≠ 0 := by |
| 46 | intro x hxS hxC |
| 47 | have h := hCneg x hxC |
| 48 | rw [hxS] at h |
| 49 | exact lt_irrefl _ h |
| 50 | have hSH : ∀ x, cylinderSignedHeight phiS x = 0 → |
| 51 | cylinderSignedHeight phiH x ≠ 0 := by |
| 52 | intro x hxS hxH |
| 53 | have h := hHneg x hxH |
| 54 | rw [hxS] at h |
| 55 | exact lt_irrefl _ h |
| 56 | have hbC : 0 < cylinderSignedHeight phiC b := by |
| 57 | rcases cylinderSignedHeight_opposite_order phiS phiC hSC |
| 58 | ⟨l, hlS, hlC⟩ ⟨r, hrS, hrC⟩ with h | h |
| 59 | · exact False.elim ((not_lt_of_ge (h.1 q hq).le) (hCneg q hq)) |
| 60 | · exact h.2 b hb |
| 61 | have hbH : 0 < cylinderSignedHeight phiH b := by |
| 62 | rcases cylinderSignedHeight_opposite_order phiS phiH hSH |
| 63 | ⟨l, hlS, hlH⟩ ⟨r, hrS, hrH⟩ with h | h |
| 64 | · exact False.elim ((not_lt_of_ge (h.1 z hz).le) (hHneg z hz)) |
| 65 | · exact h.2 b hb |
| 66 | have hqH : 0 < cylinderSignedHeight phiH q := |
| 67 | hK.lt_of_ne (continuous_cylinderSignedHeight phiH).continuousOn |
| 68 | havoidK ⟨b, hbK, hbH⟩ hqK |
| 69 | have hHC : ∀ x, cylinderSignedHeight phiH x = 0 → |
| 70 | cylinderSignedHeight phiC x < 0 := by |
| 71 | rcases cylinderSignedHeight_opposite_order phiC phiH hCH |
| 72 | ⟨l, hlC, hlH⟩ ⟨r, hrC, hrH⟩ with h | h |
| 73 | · exact False.elim ((not_lt_of_ge hqH.le) (h.2 q hq)) |
| 74 | · exact h.1 |
| 75 | exact ⟨hbC, hP.gt_of_ne (continuous_cylinderSignedHeight phiC).continuousOn |
| 76 | havoidP ⟨z, hzP, hHC z hz⟩ hpP⟩ |
| 77 | |
| 78 | end PoincareMT.M28 |
| 79 | |
| 80 | namespace PoincareMT.OpenCylinderModel |
| 81 | |
| 82 | open M28 |
| 83 | |
| 84 | variable {M : Type u} [TopologicalSpace M] |
| 85 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] {U : TopologicalSpace.Opens M} |
| 86 | |
| 87 | /-- The actual three isotopies, initial full component, and connected |
| 88 | source sets produce a continuous height with opposite endpoint signs. |
| 89 | Its zero set is exactly the middle sphere, so every endpoint path must |
| 90 | cross that sphere. No coherent-coordinate or ordering premise is added. |
| 91 | Source: Claim 10.8, p. 254; M28 derivation 124. -/ |
| 92 | theorem exists_middle_sphere_crossing_height |
| 93 | (T : OpenCylinderModel (U : Set M)) {S C H F : Set M} |
| 94 | (hS : SmoothSphereIsotopicIn (U : Set M) S T.middleSphere) |
| 95 | (hC : SmoothSphereIsotopicIn (U : Set M) C T.middleSphere) |
| 96 | (hH : SmoothSphereIsotopicIn (U : Set M) H T.middleSphere) |
| 97 | (hF : IsConnected F) (hFU : F ⊆ (U : Set M) \ S) |
| 98 | (hcomponent : ∀ x ∈ F, connectedComponentIn ((U : Set M) \ S) x = F) |
| 99 | (hSC : Disjoint S C) (hCH : Disjoint C H) |
| 100 | (hHoutside : ∀ x ∈ H, x ∉ S ∧ x ∉ F) |
| 101 | {b q z p : U} (hbS : (b : M) ∈ S) (hqC : (q : M) ∈ C) |
| 102 | (hqF : (q : M) ∉ F) (hzHmem : (z : M) ∈ H) |
| 103 | {K P : Set U} (hK : IsPreconnected K) (hbK : b ∈ K) (hqK : q ∈ K) |
| 104 | (havoidK : ∀ x ∈ K, (x : M) ∉ H) |
| 105 | (hP : IsPreconnected P) (hzP : z ∈ P) (hpP : p ∈ P) |
| 106 | (havoidP : ∀ x ∈ P, (x : M) ∉ C) : |
| 107 | ∃ h : U → ℝ, Continuous h ∧ |
| 108 | (∀ x : U, h x = 0 ↔ (x : M) ∈ C) ∧ h b < 0 ∧ 0 < h p := by |
| 109 | obtain ⟨phiS, phiC, phiH, hzS, hzC, hzH, hlow, hhigh⟩ := |
| 110 | T.exists_three_isotopic_sphere_coordinates hS hC hH |
| 111 | have hb0 := (hzS b).mpr hbS |
| 112 | have hq0 := (hzC q).mpr hqC |
| 113 | have hz0 := (hzH z).mpr hzHmem |
| 114 | have hCavoid : ∀ x ∈ {x : U | cylinderSignedHeight phiC x = 0}, |
| 115 | cylinderSignedHeight phiS x ≠ 0 := by |
| 116 | intro x hxC hxS |
| 117 | exact Set.disjoint_left.mp hSC ((hzS x).mp hxS) ((hzC x).mp hxC) |
| 118 | have hCHzero : ∀ x : U, cylinderSignedHeight phiC x = 0 → |
| 119 | cylinderSignedHeight phiH x ≠ 0 := by |
| 120 | intro x hxC hxH |
| 121 | exact Set.disjoint_left.mp hCH ((hzC x).mp hxC) ((hzH x).mp hxH) |
| 122 | have hKavoid : ∀ x ∈ K, cylinderSignedHeight phiH x ≠ 0 := |
| 123 | fun x hx hh => havoidK x hx ((hzH x).mp hh) |
| 124 | have hPavoid : ∀ x ∈ P, cylinderSignedHeight phiC x ≠ 0 := |
| 125 | fun x hx hh => havoidP x hx ((hzC x).mp hh) |
| 126 | rcases cylinderSignedHeight_component_half phiS hzS hF hFU hcomponent |
| 127 | with hnegative | hpositive |
| 128 | · have hqS : 0 < cylinderSignedHeight phiS q := by |
| 129 | rcases lt_or_gt_of_ne (hCavoid q hq0) with h | h |
| 130 | · exact False.elim (hqF ((hnegative q).mp h)) |
| 131 | · exact h |
| 132 | have hCpos : ∀ x : U, cylinderSignedHeight phiC x = 0 → |
| 133 | 0 < cylinderSignedHeight phiS x := by |
| 134 | intro x hx |
| 135 | exact (isPreconnected_cylinderSignedHeight_zero phiC).lt_of_ne |
| 136 | (continuous_cylinderSignedHeight phiS).continuousOn hCavoid ⟨q, hq0, hqS⟩ hx |
| 137 | have hHpos : ∀ x : U, cylinderSignedHeight phiH x = 0 → |
| 138 | 0 < cylinderSignedHeight phiS x := by |
| 139 | intro x hx |
| 140 | have hout := hHoutside x ((hzH x).mp hx) |
| 141 | have hne : cylinderSignedHeight phiS x ≠ 0 := fun hh => hout.1 ((hzS x).mp hh) |
| 142 | rcases lt_or_gt_of_ne hne with h | h |
| 143 | · exact False.elim (hout.2 ((hnegative x).mp h)) |
| 144 | · exact h |
| 145 | obtain ⟨hb, hp⟩ := cylinderSignedHeight_middle_signs phiS phiC phiH |
| 146 | hCpos hHpos hCHzero hlow hhigh hb0 hq0 hz0 hK hbK hqK hKavoid hP hzP hpP hPavoid |
| 147 | exact ⟨cylinderSignedHeight phiC, continuous_cylinderSignedHeight phiC, hzC, hb, hp⟩ |
| 148 | · have hqS : cylinderSignedHeight phiS q < 0 := by |
| 149 | rcases lt_or_gt_of_ne (hCavoid q hq0) with h | h |
| 150 | · exact h |
| 151 | · exact False.elim (hqF ((hpositive q).mp h)) |
| 152 | have hCneg : ∀ x : U, cylinderSignedHeight phiC x = 0 → |
| 153 | cylinderSignedHeight phiS x < 0 := by |
| 154 | intro x hx |
| 155 | exact (isPreconnected_cylinderSignedHeight_zero phiC).gt_of_ne |
| 156 | (continuous_cylinderSignedHeight phiS).continuousOn hCavoid ⟨q, hq0, hqS⟩ hx |
| 157 | have hHneg : ∀ x : U, cylinderSignedHeight phiH x = 0 → |
| 158 | cylinderSignedHeight phiS x < 0 := by |
| 159 | intro x hx |
| 160 | have hout := hHoutside x ((hzH x).mp hx) |
| 161 | have hne : cylinderSignedHeight phiS x ≠ 0 := fun hh => hout.1 ((hzS x).mp hh) |
| 162 | rcases lt_or_gt_of_ne hne with h | h |
| 163 | · exact h |
| 164 | · exact False.elim (hout.2 ((hpositive x).mp h)) |
| 165 | obtain ⟨hb, hp⟩ := cylinderSignedHeight_middle_signs_reverse phiS phiC phiH |
| 166 | hCneg hHneg hCHzero hlow hhigh hb0 hq0 hz0 hK hbK hqK hKavoid hP hzP hpP hPavoid |
| 167 | refine ⟨fun x => -cylinderSignedHeight phiC x, |
| 168 | (continuous_cylinderSignedHeight phiC).neg, ?_, neg_lt_zero.mpr hb, neg_pos.mpr hp⟩ |
| 169 | intro x |
| 170 | exact neg_eq_zero.trans (hzC x) |
| 171 | |
| 172 | end PoincareMT.OpenCylinderModel |