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.Predecessors.Necks.Geometry.OrderedGraphSides |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Predecessors.Analysis.Geometry.FiberwiseTransitionBand |
| 4 | import Mathlib.Analysis.Calculus.Deriv.Comp |
| 5 | import Mathlib.Analysis.Calculus.Deriv.Slope |
| 6 | import Mathlib.Geometry.Manifold.ContMDiff.NormedSpace |
| 7 | |
| 8 | /-! |
| 9 | # Positive aligned transition bands |
| 10 | |
| 11 | The actual complementary-component labels orient an aligned transition. |
| 12 | Its inverse identity gives positive ordinary vertical derivative, while |
| 13 | the existing signed-band theorem supplies the exact graph-bounded target. |
| 14 | This is Morgan--Tian A.12-A.13, pp. 504-505, and the A.19 tube-coordinate |
| 15 | step, p. 507; see the reviewed tube-positive-transition plan, sections 3-5. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | |
| 20 | open Set |
| 21 | open scoped Manifold ContDiff |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace PoincareMT.EpsilonNeck |
| 26 | |
| 27 | variable {M : Type u} [TopologicalSpace M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 29 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 30 | [T3Space M] {g : RiemannianMetric 3 M} |
| 31 | |
| 32 | /-- An actual aligned adjacent pair has positive vertical derivative and |
| 33 | the full smooth transition onto its endpoint-graph region. MT A.13/A.19, |
| 34 | pp. 505/507; reviewed tube-positive-transition plan, sections 3-5. -/ |
| 35 | theorem positive_fiberwise_transition_band |
| 36 | (N N' : EpsilonNeck g) (hsep : N.IsSeparating) |
| 37 | (hquarter : N.region (N.epsilon⁻¹ / 2) N.epsilon⁻¹ ⊆ N'.carrier) |
| 38 | (hoverlap : N.carrier ∩ N'.carrier ⊆ |
| 39 | N.region (-N.epsilon⁻¹ / 2) N.epsilon⁻¹ ∩ |
| 40 | N'.region (-N'.epsilon⁻¹) (N'.epsilon⁻¹ / 2)) |
| 41 | (e e' : OpenPartialHomeomorph RoundCylinderSpace M) |
| 42 | (A : Diffeomorph (𝓡 2) (𝓡 2) UnitTwoSphere UnitTwoSphere ∞) |
| 43 | (hesource : e.source = N.cylinderDomain) |
| 44 | (hetarget : e.target = N.carrier) |
| 45 | (he'source : e'.source = N'.cylinderDomain) |
| 46 | (he'target : e'.target = N'.carrier) |
| 47 | (he : ContMDiffOn ((𝓡 2).prod 𝓘(ℝ, ℝ)) (𝓡 3) ∞ e |
| 48 | N.cylinderDomain) |
| 49 | (hei : ContMDiffOn (𝓡 3) ((𝓡 2).prod 𝓘(ℝ, ℝ)) ∞ e.symm |
| 50 | N.carrier) |
| 51 | (he' : ContMDiffOn ((𝓡 2).prod 𝓘(ℝ, ℝ)) (𝓡 3) ∞ e' |
| 52 | N'.cylinderDomain) |
| 53 | (he'i : ContMDiffOn (𝓡 3) ((𝓡 2).prod 𝓘(ℝ, ℝ)) ∞ e'.symm |
| 54 | N'.carrier) |
| 55 | (heheight : ∀ z ∈ N.cylinderDomain, |
| 56 | (N.coordinate_inverse (e z)).2 = z.2) |
| 57 | (he'height : ∀ z ∈ N'.cylinderDomain, |
| 58 | (N'.coordinate_inverse (e' z)).2 = z.2) |
| 59 | {a b : ℝ} (ha : N.epsilon⁻¹ / 2 < a) (hab : a < b) |
| 60 | (hb : b < N.epsilon⁻¹) |
| 61 | (hfirst : ∀ z : RoundCylinderSpace, z.2 ∈ Icc a b → |
| 62 | (e'.symm (e z)).1 = A z.1) : |
| 63 | let h : RoundCylinderSpace → ℝ := fun z => (e'.symm (e z)).2 |
| 64 | let T := (e.restr (univ ×ˢ Ioo a b)).trans e'.symm |
| 65 | (∀ t ∈ Icc a b, |
| 66 | ContMDiff (𝓡 2) 𝓘(ℝ, ℝ) ∞ |
| 67 | (fun q : UnitTwoSphere => h (A.symm q, t)) ∧ |
| 68 | (∀ q : UnitTwoSphere, |
| 69 | h (A.symm q, t) ∈ Ioo (-N'.epsilon⁻¹) (N'.epsilon⁻¹ / 2)) ∧ |
| 70 | range (fun q : UnitTwoSphere => N.coordinate_map (q, t)) = |
| 71 | range (fun q : UnitTwoSphere => e' (q, h (A.symm q, t)))) ∧ |
| 72 | (∀ q : UnitTwoSphere, StrictMonoOn (fun s => h (q, s)) (Icc a b)) ∧ |
| 73 | ContMDiffOn ((𝓡 2).prod 𝓘(ℝ, ℝ)) 𝓘(ℝ, ℝ) ∞ h |
| 74 | (univ ×ˢ Ioo a b) ∧ |
| 75 | (∀ q : UnitTwoSphere, ∀ s ∈ Ioo a b, |
| 76 | 0 < deriv (fun r : ℝ => h (q, r)) s) ∧ |
| 77 | T.source = univ ×ˢ Ioo a b ∧ |
| 78 | T.target = {z : RoundCylinderSpace | |
| 79 | h (A.symm z.1, a) < z.2 ∧ z.2 < h (A.symm z.1, b)} ∧ |
| 80 | T.target ⊆ N'.cylinderDomain ∧ |
| 81 | ContMDiffOn ((𝓡 2).prod 𝓘(ℝ, ℝ)) |
| 82 | ((𝓡 2).prod 𝓘(ℝ, ℝ)) ∞ T T.source ∧ |
| 83 | ContMDiffOn ((𝓡 2).prod 𝓘(ℝ, ℝ)) |
| 84 | ((𝓡 2).prod 𝓘(ℝ, ℝ)) ∞ T.symm T.target ∧ |
| 85 | (∀ z ∈ T.source, T z = (A z.1, h z) ∧ e' (T z) = e z) ∧ |
| 86 | (∀ z ∈ T.target, T.symm z = e.symm (e' z) ∧ |
| 87 | (T.symm z).1 = A.symm z.1 ∧ e (T.symm z) = e' z) := by |
| 88 | classical |
| 89 | let : ConnectedSpace UnitTwoSphere := by |
| 90 | apply isConnected_iff_connectedSpace.mp |
| 91 | exact isConnected_sphere (by rw [← Module.finrank_eq_rank]; norm_num) 0 (by norm_num) |
| 92 | let h : RoundCylinderSpace → ℝ := fun z => (e'.symm (e z)).2 |
| 93 | let T := (e.restr (univ ×ˢ Ioo a b)).trans e'.symm |
| 94 | let U := (e.trans e'.symm).source |
| 95 | have hL : 0 < N.epsilon⁻¹ := inv_pos.mpr N.epsilon_pos |
| 96 | have hL' : 0 < N'.epsilon⁻¹ := inv_pos.mpr N'.epsilon_pos |
| 97 | have hretained {t : ℝ} (ht : t ∈ Icc a b) : |
| 98 | t ∈ Ioo (N.epsilon⁻¹ / 2) N.epsilon⁻¹ := |
| 99 | ⟨ha.trans_le ht.1, ht.2.trans_lt hb⟩ |
| 100 | have hdom {z : RoundCylinderSpace} (hz : z.2 ∈ Icc a b) : z ∈ N.cylinderDomain := |
| 101 | ⟨mem_univ _, by linarith [(hretained hz).1], (hretained hz).2⟩ |
| 102 | have heold {z : RoundCylinderSpace} (hz : z.2 ∈ Icc a b) : e z ∈ N.carrier := |
| 103 | hetarget ▸ e.map_source (hesource.symm ▸ hdom hz) |
| 104 | have henew {z : RoundCylinderSpace} (hz : z.2 ∈ Icc a b) : e z ∈ N'.carrier := by |
| 105 | apply hquarter |
| 106 | refine ⟨heold hz, ?_⟩ |
| 107 | rw [heheight z (hdom hz)] |
| 108 | exact hretained hz |
| 109 | have hclosedU {z : RoundCylinderSpace} (hz : z.2 ∈ Icc a b) : z ∈ U := by |
| 110 | change z ∈ e.source ∧ e z ∈ e'.target |
| 111 | exact ⟨hesource.symm ▸ hdom hz, he'target.symm ▸ henew hz⟩ |
| 112 | have hcoord : ContMDiffOn ((𝓡 2).prod 𝓘(ℝ, ℝ)) |
| 113 | ((𝓡 2).prod 𝓘(ℝ, ℝ)) ∞ (fun z => e'.symm (e z)) U := |
| 114 | he'i.comp (he.mono (fun _ hz => hesource ▸ hz.1)) |
| 115 | (fun _ hz => he'target ▸ hz.2) |
| 116 | have hhU : ContMDiffOn ((𝓡 2).prod 𝓘(ℝ, ℝ)) 𝓘(ℝ, ℝ) ∞ h U := |
| 117 | contMDiff_snd.comp_contMDiffOn hcoord |
| 118 | have hh : ContMDiffOn ((𝓡 2).prod 𝓘(ℝ, ℝ)) 𝓘(ℝ, ℝ) ∞ h |
| 119 | (univ ×ˢ Ioo a b) := |
| 120 | hhU.mono (fun _ hz => hclosedU ⟨hz.2.1.le, hz.2.2.le⟩) |
| 121 | have hpair (z : RoundCylinderSpace) (hz : z.2 ∈ Icc a b) : |
| 122 | e'.symm (e z) = (A z.1, h z) := Prod.ext (hfirst z hz) rfl |
| 123 | have hpairDom (z : RoundCylinderSpace) (hz : z.2 ∈ Icc a b) : |
| 124 | (A z.1, h z) ∈ N'.cylinderDomain := by |
| 125 | rw [← hpair z hz] |
| 126 | exact he'source ▸ e'.map_target (he'target.symm ▸ henew hz) |
| 127 | have hforward (z : RoundCylinderSpace) (hz : z.2 ∈ Icc a b) : |
| 128 | e' (A z.1, h z) = e z := by |
| 129 | rw [← hpair z hz] |
| 130 | exact e'.right_inv (he'target.symm ▸ henew hz) |
| 131 | have hbound (z : RoundCylinderSpace) (hz : z.2 ∈ Icc a b) : |
| 132 | h z ∈ Ioo (-N'.epsilon⁻¹) (N'.epsilon⁻¹ / 2) := by |
| 133 | have hn := (hoverlap ⟨heold hz, henew hz⟩).2.2.2 |
| 134 | have hheight := he'height _ (hpairDom z hz) |
| 135 | rw [hforward z hz] at hheight |
| 136 | exact ⟨(hpairDom z hz).2.1, by simpa only [hheight] using hn⟩ |
| 137 | have hgraph (t : ℝ) (ht : t ∈ Icc a b) : |
| 138 | ContMDiff (𝓡 2) 𝓘(ℝ, ℝ) ∞ |
| 139 | (fun q : UnitTwoSphere => h (A.symm q, t)) ∧ |
| 140 | (∀ q : UnitTwoSphere, |
| 141 | h (A.symm q, t) ∈ Ioo (-N'.epsilon⁻¹) (N'.epsilon⁻¹ / 2)) ∧ |
| 142 | range (fun q : UnitTwoSphere => N.coordinate_map (q, t)) = |
| 143 | range (fun q : UnitTwoSphere => e' (q, h (A.symm q, t))) := by |
| 144 | refine ⟨hhU.comp_contMDiff (A.symm.contMDiff.prodMk contMDiff_const) |
| 145 | (fun _ => hclosedU ht), fun q => hbound (A.symm q, t) ht, ?_⟩ |
| 146 | have ht0 : t ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹ := (hdom (z := (A.symm |
| 147 | (N.coordinate_inverse N.center).1, t)) ht).2 |
| 148 | ext x |
| 149 | constructor |
| 150 | · rintro ⟨q, rfl⟩ |
| 151 | let y := N.coordinate_map (q, t) |
| 152 | have hy : y ∈ N.carrier := N.coordinate_map_mem ⟨mem_univ _, ht0⟩ |
| 153 | have hys : e.symm y ∈ N.cylinderDomain := |
| 154 | hesource ▸ e.map_target (hetarget.symm ▸ hy) |
| 155 | have hyt : (e.symm y).2 = t := by |
| 156 | have hv := heheight (e.symm y) hys |
| 157 | rw [e.right_inv (hetarget.symm ▸ hy)] at hv |
| 158 | exact hv.symm.trans (congrArg Prod.snd (N.coordinate_inverse_map _ ht0)) |
| 159 | refine ⟨A (e.symm y).1, ?_⟩ |
| 160 | change e' (A (e.symm y).1, h (A.symm (A (e.symm y).1), t)) = y |
| 161 | rw [A.symm_apply_apply] |
| 162 | rw [hforward ((e.symm y).1, t) ht] |
| 163 | rw [← hyt] |
| 164 | exact e.right_inv (hetarget.symm ▸ hy) |
| 165 | · rintro ⟨q, rfl⟩ |
| 166 | have hform : e' (q, h (A.symm q, t)) = e (A.symm q, t) := by |
| 167 | simpa only [A.apply_symm_apply] using hforward (A.symm q, t) ht |
| 168 | change e' (q, h (A.symm q, t)) ∈ range (fun p => N.coordinate_map (p, t)) |
| 169 | rw [hform] |
| 170 | refine ⟨(N.coordinate_inverse (e (A.symm q, t))).1, ?_⟩ |
| 171 | change N.coordinate_map ((N.coordinate_inverse (e (A.symm q, t))).1, t) = e (A.symm q, t) |
| 172 | have hheight := heheight (A.symm q, t) (hdom ht) |
| 173 | dsimp only at hheight |
| 174 | calc |
| 175 | N.coordinate_map ((N.coordinate_inverse (e (A.symm q, t))).1, t) = |
| 176 | N.coordinate_map (N.coordinate_inverse (e (A.symm q, t))) := |
| 177 | congrArg N.coordinate_map (Prod.ext rfl hheight.symm) |
| 178 | _ = e (A.symm q, t) := N.coordinate_map_inverse (heold (z := (A.symm q, t)) ht) |
| 179 | have hmono : ∀ q : UnitTwoSphere, StrictMonoOn (fun s => h (q, s)) (Icc a b) := by |
| 180 | intro q s hs t ht hst |
| 181 | have hsret := hretained hs |
| 182 | have hs0 : s ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹ := |
| 183 | ⟨by linarith [hsret.1], hsret.2⟩ |
| 184 | let q₀ := (N.coordinate_inverse N.center).1 |
| 185 | let S := range (fun p : UnitTwoSphere => N.coordinate_map (p, s)) |
| 186 | let y := N.coordinate_map (q₀, (s + N.epsilon⁻¹) / 2) |
| 187 | have hym : y ∈ N.region s N.epsilon⁻¹ := by |
| 188 | have hyh : (s + N.epsilon⁻¹) / 2 ∈ Ioo s N.epsilon⁻¹ := by |
| 189 | constructor <;> linarith [hsret.2] |
| 190 | have hyd : (s + N.epsilon⁻¹) / 2 ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹ := |
| 191 | ⟨hs0.1.trans hyh.1, hyh.2⟩ |
| 192 | refine ⟨N.coordinate_map_mem ⟨mem_univ _, hyd⟩, ?_⟩ |
| 193 | simpa only [y, N.coordinate_inverse_map (q₀, (s + N.epsilon⁻¹) / 2) hyd, |
| 194 | mem_Ioo] using hyh |
| 195 | obtain ⟨_, y₁, _, _, _, hpos, _, _, _, _⟩ := |
| 196 | N.exists_opposite_retained_components hsep hs0 |
| 197 | have hBe : connectedComponentIn Sᶜ y₁ = connectedComponentIn Sᶜ y := |
| 198 | connectedComponentIn_eq (hpos hym) |
| 199 | have hxpos : e (q, t) ∈ N.region s N.epsilon⁻¹ := by |
| 200 | refine ⟨heold ht, ?_⟩ |
| 201 | rw [heheight (q, t) (hdom ht)] |
| 202 | exact ⟨hst, (hretained ht).2⟩ |
| 203 | have hxB : e (q, t) ∈ connectedComponentIn Sᶜ y := hBe ▸ hpos hxpos |
| 204 | have hgs := hgraph s hs |
| 205 | have hside := (N.graph_sides_in_height_preserving_chart N' hsep hquarter hoverlap |
| 206 | e' he'source he'target he'height hsret (fun p => h (A.symm p, s)) |
| 207 | hgs.1.continuous (fun p => ⟨(hgs.2.1 p).1, |
| 208 | (hgs.2.1 p).2.trans (by linarith)⟩) hgs.2.2).2 (e (q, t)) (henew ht) |
| 209 | have hlt := hside.2.mp hxB |
| 210 | simpa only [hfirst (q, t) ht, A.symm_apply_apply] using hlt |
| 211 | have hderiv : ∀ q : UnitTwoSphere, ∀ s ∈ Ioo a b, |
| 212 | 0 < deriv (fun r : ℝ => h (q, r)) s := by |
| 213 | intro q s hs |
| 214 | have hsclosed : s ∈ Icc a b := ⟨hs.1.le, hs.2.le⟩ |
| 215 | have hha : ContMDiffAt 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ) ∞ |
| 216 | (fun r : ℝ => h (q, r)) s := |
| 217 | (hhU.contMDiffAt ((e.trans e'.symm).open_source.mem_nhds |
| 218 | (hclosedU hsclosed))).comp s |
| 219 | (contMDiff_const.prodMk contMDiff_id).contMDiffAt |
| 220 | have hhd : DifferentiableAt ℝ (fun r : ℝ => h (q, r)) s := |
| 221 | (contMDiffAt_iff_contDiffAt.mp hha).differentiableAt (by norm_num) |
| 222 | let V := (e'.trans N.coordinatePartialHomeomorph.symm).source |
| 223 | let k : ℝ → ℝ := fun v => (N.coordinate_inverse (e' (A q, v))).2 |
| 224 | have hVdom {z : RoundCylinderSpace} (hz : z ∈ V) : |
| 225 | z ∈ N'.cylinderDomain ∧ e' z ∈ N.carrier := |
| 226 | ⟨he'source ▸ hz.1, hz.2⟩ |
| 227 | have hkV : ContMDiffOn ((𝓡 2).prod 𝓘(ℝ, ℝ)) 𝓘(ℝ, ℝ) ∞ |
| 228 | (fun z => (N.coordinate_inverse (e' z)).2) V := |
| 229 | contMDiff_snd.comp_contMDiffOn (N.coordinate_inverse_smooth.comp |
| 230 | (he'.mono (fun _ hz => (hVdom hz).1)) (fun _ hz => (hVdom hz).2)) |
| 231 | have hv : (A q, h (q, s)) ∈ V := by |
| 232 | change (A q, h (q, s)) ∈ e'.source ∧ e' (A q, h (q, s)) ∈ N.carrier |
| 233 | refine ⟨he'source.symm ▸ hpairDom (q, s) hsclosed, ?_⟩ |
| 234 | rw [hforward (q, s) hsclosed] |
| 235 | exact heold hsclosed |
| 236 | have hka : ContMDiffAt 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ) ∞ k (h (q, s)) := |
| 237 | (hkV.contMDiffAt ((e'.trans N.coordinatePartialHomeomorph.symm).open_source.mem_nhds hv)).comp |
| 238 | (h (q, s)) (contMDiff_const.prodMk contMDiff_id).contMDiffAt |
| 239 | have hkd : DifferentiableAt ℝ k (h (q, s)) := |
| 240 | (contMDiffAt_iff_contDiffAt.mp hka).differentiableAt (by norm_num) |
| 241 | have hki : (fun r : ℝ => k (h (q, r))) =ᶠ[nhds s] id := by |
| 242 | filter_upwards [Ioo_mem_nhds hs.1 hs.2] with r hr |
| 243 | have hrc : r ∈ Icc a b := ⟨hr.1.le, hr.2.le⟩ |
| 244 | change (N.coordinate_inverse (e' (A q, h (q, r)))).2 = r |
| 245 | rw [hforward (q, r) hrc] |
| 246 | exact heheight (q, r) (hdom hrc) |
| 247 | have hprod : deriv k (h (q, s)) * deriv (fun r : ℝ => h (q, r)) s = 1 := by |
| 248 | rw [← deriv_comp s hkd hhd] |
| 249 | exact hki.deriv_eq.trans (by simp) |
| 250 | have hn : 0 ≤ deriv (fun r : ℝ => h (q, r)) s := by |
| 251 | have hn := (hmono q).monotoneOn.derivWithin_nonneg (x := s) |
| 252 | rwa [derivWithin_of_mem_nhds (Icc_mem_nhds hs.1 hs.2)] at hn |
| 253 | have hne : deriv (fun r : ℝ => h (q, r)) s ≠ 0 := by |
| 254 | intro hz |
| 255 | rw [hz, mul_zero] at hprod |
| 256 | exact zero_ne_one hprod |
| 257 | exact lt_of_le_of_ne hn hne.symm |
| 258 | obtain ⟨sigma, hsig, hsigmono, _, _, hsrc, htgt, htgtSub, hsmooth, hismooth, |
| 259 | hforw, hback⟩ := e.exists_fiberwise_transition_band e' A.toHomeomorph hab |
| 260 | (fun _ hz => hesource.symm ▸ hdom hz.2) |
| 261 | (fun _ hz => he'target.symm ▸ henew hz.2) hfirst |
| 262 | (hesource.symm ▸ he) (hetarget.symm ▸ hei) |
| 263 | (he'source.symm ▸ he') (he'target.symm ▸ he'i) |
| 264 | have hsigma : sigma = 1 := by |
| 265 | rcases hsig with hs | hs |
| 266 | · exact hs |
| 267 | · let q₀ := (N.coordinate_inverse N.center).1 |
| 268 | have hp := hmono q₀ ⟨le_rfl, hab.le⟩ ⟨hab.le, le_rfl⟩ hab |
| 269 | have hn := hsigmono q₀ ⟨le_rfl, hab.le⟩ ⟨hab.le, le_rfl⟩ hab |
| 270 | simp only [hs, neg_one_mul] at hn |
| 271 | exact False.elim (not_lt_of_gt hp (neg_lt_neg_iff.mp hn)) |
| 272 | subst sigma |
| 273 | refine ⟨hgraph, hmono, hh, hderiv, hsrc, ?_, ?_, hsmooth, hismooth, hforw, hback⟩ |
| 274 | · simpa only [one_mul, Diffeomorph.coe_toHomeomorph_symm] using htgt |
| 275 | · exact fun _ hz => he'source ▸ htgtSub hz |
| 276 | |
| 277 | end PoincareMT.EpsilonNeck |