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.SourceGeometry.Geometry.SourceEdgeCommonOrientation |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.IntrinsicGeometry.IntrinsicMinimizerSubsegments |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.NeckGeometry.NeckAxialLength |
| 5 | import PoincareLib.Geometry.RicciFlow.CanonicalNeighborhood.Neck.Geodesic.Intrinsic |
| 6 | |
| 7 | /-! |
| 8 | # Opposite orientations at the two actual frontier exits |
| 9 | |
| 10 | Morgan--Tian Claim 10.4, pp. 249-251. Both common packets use the same |
| 11 | original neck and the actual first-exit pieces of a regional minimum. |
| 12 | Equal old-neck orientations would give a same-height intrinsic shortcut |
| 13 | across the original center. Reflection is used only to select the earlier |
| 14 | packet; every length estimate is on the original clock. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | |
| 19 | open Set |
| 20 | open scoped Manifold ContDiff Bundle Topology ENNReal |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.M28 |
| 25 | |
| 26 | open PoincareMT.EpsilonNeck |
| 27 | |
| 28 | variable {M : Type u} [TopologicalSpace M] |
| 29 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 30 | {g : RiemannianMetric 3 M} |
| 31 | |
| 32 | private theorem neck_reversed_reversed (N : EpsilonNeck g) : |
| 33 | N.reversed.reversed = N := by |
| 34 | have hcoordinate : (RoundCylinderReflection.domain N.epsilon).trans |
| 35 | ((RoundCylinderReflection.domain N.epsilon).trans N.coordinate) = N.coordinate := by |
| 36 | apply Homeomorph.ext |
| 37 | intro z |
| 38 | change N.coordinate (RoundCylinderReflection.domain N.epsilon |
| 39 | (RoundCylinderReflection.domain N.epsilon z)) = N.coordinate z |
| 40 | congr 1 |
| 41 | change (z.1, (⟨-(-(z.2 : ℝ)), |
| 42 | RoundCylinderReflection.neg_mem_interval |
| 43 | (RoundCylinderReflection.neg_mem_interval z.2.property)⟩ : |
| 44 | Ioo (-N.epsilon⁻¹) N.epsilon⁻¹)) = z |
| 45 | exact Prod.ext (by rfl) (Subtype.ext (neg_neg _)) |
| 46 | have hmap : (N.coordinate_map ∘ RoundCylinderReflection.space) ∘ |
| 47 | RoundCylinderReflection.space = N.coordinate_map := by |
| 48 | funext z |
| 49 | exact congrArg N.coordinate_map (RoundCylinderReflection.space_involutive z) |
| 50 | have hinverse : RoundCylinderReflection.space ∘ |
| 51 | (RoundCylinderReflection.space ∘ N.coordinate_inverse) = N.coordinate_inverse := by |
| 52 | funext x |
| 53 | exact RoundCylinderReflection.space_involutive (N.coordinate_inverse x) |
| 54 | cases N |
| 55 | dsimp only at hcoordinate |
| 56 | simp only [reversed, hmap, hinverse] |
| 57 | congr 1 |
| 58 | |
| 59 | variable [MeasurableSpace M] [BorelSpace M] [T2Space M] [T3Space M] |
| 60 | |
| 61 | private theorem frontier_old_orientations_opposite |
| 62 | {N Pminus Pplus Nminus Qminus Nplus Qplus : EpsilonNeck g} |
| 63 | {γ : ℝ → M} {a b u t v : ℝ} |
| 64 | (Hplus : SourceEdgeCommonOrientationPacket Nplus Pplus Qplus (γ := γ) t v) |
| 65 | (Hminus : SourceEdgeCommonOrientationPacket Nminus Pminus Qminus |
| 66 | (γ := fun s => γ (-s)) (-t) (-u)) |
| 67 | (hplus : Nplus = N ∨ Nplus = N.reversed) |
| 68 | (hminus : Nminus = N ∨ Nminus = N.reversed) |
| 69 | (hε : N.epsilon ≤ 1 / 1000) {U : Set M} (hNU : N.carrier ⊆ U) |
| 70 | (hau : a ≤ u) (htv : t < v) (hvb : v ≤ b) |
| 71 | (hγ : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 γ (Icc a b)) |
| 72 | (hγU : MapsTo γ (Icc a b) U) |
| 73 | (hfinite : g.pathELength γ a b ≠ ⊤) |
| 74 | (hmin : g.pathELength γ a b = intrinsicEDist g U (γ a) (γ b)) : |
| 75 | Nminus = Nplus.reversed := by |
| 76 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 77 | ⟨g.toRiemannianMetric⟩ |
| 78 | have hplusε : Nplus.epsilon = N.epsilon := by |
| 79 | rcases hplus with h | h <;> simp only [h, reversed_epsilon] |
| 80 | have hplusU : Nplus.carrier ⊆ U := by |
| 81 | rcases hplus with h | h <;> simpa only [h, reversed_carrier] using hNU |
| 82 | have hApos : 0 < Nplus.epsilon⁻¹ := inv_pos.mpr Nplus.epsilon_pos |
| 83 | have hA : (1000 : ℝ) ≤ Nplus.epsilon⁻¹ := by |
| 84 | have h := mul_le_mul_of_nonneg_right (hplusε.trans_le hε) hApos.le |
| 85 | rw [mul_inv_cancel₀ Nplus.epsilon_pos.ne'] at h |
| 86 | linarith only [h] |
| 87 | have hbad (hequal : Nminus = Nplus) : False := by |
| 88 | obtain ⟨d, hd, hdlevel, _, _⟩ := Hplus.transition |
| 89 | obtain ⟨e, he, helevel, _, _⟩ := Hminus.transition |
| 90 | have huc : u < -e := by linarith only [he.2] |
| 91 | have hct : -e < t := by linarith only [he.1] |
| 92 | have hcd : -e < d := hct.trans hd.1 |
| 93 | have hclevel : (Nplus.coordinate_inverse (γ (-e))).2 = |
| 94 | (509 : ℝ) * Nplus.epsilon⁻¹ / 512 := by |
| 95 | change (Nminus.coordinate_inverse (γ (-e))).2 = |
| 96 | (509 : ℝ) * Nminus.epsilon⁻¹ / 512 at helevel |
| 97 | simpa only [hequal] using helevel |
| 98 | have hcdN : MapsTo γ (Icc (-e) d) Nplus.carrier := by |
| 99 | intro s hs |
| 100 | by_cases hst : s ≤ t |
| 101 | · have hs' : -s ∈ Ico (-t) (-u) := |
| 102 | ⟨neg_le_neg hst, by linarith only [hs.1, huc]⟩ |
| 103 | have h := Hminus.edge hs' |
| 104 | simpa only [hequal, neg_neg] using h |
| 105 | · exact Hplus.edge ⟨(lt_of_not_ge hst).le, hs.2.trans_lt hd.2⟩ |
| 106 | have hcN : γ (-e) ∈ Nplus.carrier := hcdN (left_mem_Icc.mpr hcd.le) |
| 107 | have hdN : γ d ∈ Nplus.carrier := hcdN (right_mem_Icc.mpr hcd.le) |
| 108 | have hminimum := pathELength_eq_intrinsicEDist_subsegment g |
| 109 | (hau.trans huc.le) hcd.le (hd.2.le.trans hvb) hγ hγU hfinite hmin |
| 110 | have hupper := (intrinsicEDist_mono_of_subset (g := g) hplusU).trans |
| 111 | (Nplus.intrinsicEDist_le_axial_add hcN hdN) |
| 112 | rw [hdlevel, hclevel, sub_self, abs_zero, zero_add] at hupper |
| 113 | have hroot : Real.sqrt (1 + Nplus.epsilon) ≤ (2 : ℝ) := by |
| 114 | apply (Real.sqrt_le_iff).mpr |
| 115 | exact ⟨by norm_num, by linarith only [Nplus.epsilon_lt_half]⟩ |
| 116 | have hsqrt2 : Real.sqrt 2 ≤ (2 : ℝ) := |
| 117 | (Real.sqrt_le_iff).mpr ⟨by norm_num, by norm_num⟩ |
| 118 | have hsphere : Real.sqrt 2 * (Real.pi + 1) ≤ (10 : ℝ) := by |
| 119 | calc |
| 120 | _ ≤ 2 * (Real.pi + 1) := |
| 121 | mul_le_mul_of_nonneg_right hsqrt2 (by positivity) |
| 122 | _ ≤ 10 := by linarith only [Real.pi_le_four] |
| 123 | have hcoefficient : Real.sqrt (1 + Nplus.epsilon) * |
| 124 | (Real.sqrt 2 * (Real.pi + 1)) ≤ (20 : ℝ) := by |
| 125 | have h := mul_le_mul hroot hsphere |
| 126 | (by positivity : 0 ≤ Real.sqrt 2 * (Real.pi + 1)) (by norm_num) |
| 127 | norm_num at h |
| 128 | exact h |
| 129 | have hscaled : Nplus.scale * Real.sqrt (1 + Nplus.epsilon) * |
| 130 | (Real.sqrt 2 * (Real.pi + 1)) ≤ 20 * Nplus.scale := by |
| 131 | have h := mul_le_mul_of_nonneg_left hcoefficient Nplus.scale_pos.le |
| 132 | nlinarith only [h] |
| 133 | have hshort : intrinsicEDist g U (γ (-e)) (γ d) ≤ |
| 134 | ENNReal.ofReal (20 * Nplus.scale) := |
| 135 | hupper.trans (ENNReal.ofReal_le_ofReal hscaled) |
| 136 | have htzero : (Nplus.coordinate_inverse (γ t)).2 = 0 := by |
| 137 | rw [Hplus.center_N] |
| 138 | exact (Nplus.mem_central_sphere_iff_of_mem_carrier |
| 139 | (Nplus.central_sphere_subset Nplus.center_on_central_sphere)).mp |
| 140 | Nplus.center_on_central_sphere |
| 141 | have hcost := path_axial_displacement_le Nplus hct.le |
| 142 | (hγ.mono (Icc_subset_Icc (hau.trans huc.le) (htv.le.trans hvb))) |
| 143 | (fun s hs => hcdN ⟨hs.1, hs.2.trans hd.1.le⟩) |
| 144 | rw [htzero, zero_sub, abs_neg, hclevel, |
| 145 | abs_of_pos (by positivity : 0 < (509 : ℝ) * Nplus.epsilon⁻¹ / 512)] at hcost |
| 146 | have hlong : ENNReal.ofReal ((Nplus.scale / 2) * |
| 147 | ((509 : ℝ) * Nplus.epsilon⁻¹ / 512)) ≤ g.pathELength γ (-e) d := |
| 148 | hcost.trans (Manifold.pathELength_mono le_rfl hd.1.le) |
| 149 | rw [hminimum] at hlong |
| 150 | have hgap : 20 * Nplus.scale < (Nplus.scale / 2) * |
| 151 | ((509 : ℝ) * Nplus.epsilon⁻¹ / 512) := by |
| 152 | have h : (20 : ℝ) < (1 / 2 : ℝ) * |
| 153 | ((509 : ℝ) * Nplus.epsilon⁻¹ / 512) := by linarith only [hA] |
| 154 | have hs := mul_lt_mul_of_pos_left h Nplus.scale_pos |
| 155 | nlinarith only [hs] |
| 156 | have hpositive : 0 < (Nplus.scale / 2) * |
| 157 | ((509 : ℝ) * Nplus.epsilon⁻¹ / 512) := by |
| 158 | have := Nplus.scale_pos |
| 159 | have := inv_pos.mpr Nplus.epsilon_pos |
| 160 | positivity |
| 161 | exact (not_lt_of_ge (hlong.trans hshort)) |
| 162 | ((ENNReal.ofReal_lt_ofReal_iff hpositive).mpr hgap) |
| 163 | rcases hplus with hp | hp <;> rcases hminus with hm | hm |
| 164 | · exact False.elim (hbad (hm.trans hp.symm)) |
| 165 | · rw [hm, hp] |
| 166 | · rw [hm, hp, neck_reversed_reversed] |
| 167 | · exact False.elim (hbad (hm.trans hp.symm)) |
| 168 | |
| 169 | /-- The same original neck has oppositely oriented common packets at its |
| 170 | two actual first exits on a finite regional minimum. The frontier necks |
| 171 | are retained as supplied, and no axial sign or reflected minimum is an |
| 172 | input (Claim 10.4, pp. 249-251). -/ |
| 173 | theorem exists_neck_frontier_orientation_pair_accuracy : |
| 174 | ∃ epsilon₀ : ℝ, 0 < epsilon₀ ∧ epsilon₀ ≤ (1 / 1000 : ℝ) ∧ |
| 175 | ∀ {M : Type u} [TopologicalSpace M] |
| 176 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 177 | [MeasurableSpace M] [BorelSpace M] [T2Space M] [T3Space M] |
| 178 | {g : RiemannianMetric 3 M}, |
| 179 | ∀ (N Pminus Pplus : EpsilonNeck g), N.epsilon ≤ epsilon₀ → |
| 180 | Pminus.epsilon = N.epsilon → Pplus.epsilon = N.epsilon → |
| 181 | ∀ {U : Set M}, N.carrier ⊆ U → |
| 182 | ∀ {γ : ℝ → M} {a b u t v : ℝ}, a ≤ u → u < t → t < v → v ≤ b → |
| 183 | ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 γ (Icc a b) → MapsTo γ (Icc a b) U → |
| 184 | g.pathELength γ a b ≠ ⊤ → |
| 185 | g.pathELength γ a b = intrinsicEDist g U (γ a) (γ b) → |
| 186 | γ t = N.center → γ u = Pminus.center → γ v = Pplus.center → |
| 187 | MapsTo γ (Ioc u t) N.carrier → MapsTo γ (Ico t v) N.carrier → |
| 188 | Pminus.center ∈ frontier N.carrier → Pplus.center ∈ frontier N.carrier → |
| 189 | ∃ Nplus Qplus Nminus Qminus : EpsilonNeck g, |
| 190 | (Nplus = N ∨ Nplus = N.reversed) ∧ |
| 191 | (Nminus = N ∨ Nminus = N.reversed) ∧ |
| 192 | SourceEdgeCommonOrientationPacket Nplus Pplus Qplus (γ := γ) t v ∧ |
| 193 | SourceEdgeCommonOrientationPacket Nminus Pminus Qminus |
| 194 | (γ := fun s => γ (-s)) (-t) (-u) ∧ Nminus = Nplus.reversed := by |
| 195 | obtain ⟨epsilon₀, hpos, hsmall, hpacket⟩ := |
| 196 | exists_source_edge_common_orientation_packet.{u} |
| 197 | have hsmall' : epsilon₀ ≤ (1 / 1000 : ℝ) := hsmall.trans (by norm_num) |
| 198 | refine ⟨epsilon₀, hpos, hsmall', ?_⟩ |
| 199 | intro M _ _ _ _ _ _ _ g N Pminus Pplus hε hminusε hplusε U hNU |
| 200 | γ a b u t v hau hut htv hvb hγ hγU hfinite hmin hc hcm hcp |
| 201 | hleft hright hfrontminus hfrontplus |
| 202 | obtain ⟨Nplus, Qplus, hplus, Hplus⟩ := hpacket N Pplus hε hplusε htv |
| 203 | (hγ.mono (Icc_subset_Icc (hau.trans hut.le) hvb)) hc hcp hright hfrontplus |
| 204 | let η : ℝ → M := fun s => γ (-s) |
| 205 | have hneg : MapsTo (fun s : ℝ => -s) (Icc (-t) (-u)) (Icc a b) := by |
| 206 | intro s hs |
| 207 | constructor <;> linarith only [hs.1, hs.2, hau, htv, hvb] |
| 208 | have hη : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 η (Icc (-t) (-u)) := |
| 209 | hγ.comp (show ContMDiff 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ) 1 (fun s : ℝ => -s) from |
| 210 | contMDiff_id.neg).contMDiffOn hneg |
| 211 | have hηcenter : η (-t) = N.center := by simpa only [η, neg_neg] using hc |
| 212 | have hηminus : η (-u) = Pminus.center := by simpa only [η, neg_neg] using hcm |
| 213 | have hηedge : MapsTo η (Ico (-t) (-u)) N.carrier := by |
| 214 | intro s hs |
| 215 | have hs' : -s ∈ Ioc u t := by |
| 216 | constructor <;> linarith only [hs.1, hs.2] |
| 217 | exact hleft hs' |
| 218 | obtain ⟨Nminus, Qminus, hminus, Hminus⟩ := hpacket N Pminus hε hminusε |
| 219 | (neg_lt_neg hut) hη hηcenter hηminus hηedge hfrontminus |
| 220 | refine ⟨Nplus, Qplus, Nminus, Qminus, hplus, hminus, Hplus, Hminus, ?_⟩ |
| 221 | exact frontier_old_orientations_opposite Hplus Hminus hplus hminus |
| 222 | (hε.trans hsmall') hNU hau htv hvb hγ hγU hfinite hmin |
| 223 | |
| 224 | end PoincareMT.M28 |