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.NeckGeometry.NeckFrontierDistance |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Cylinders.CylinderUniformScalar |
| 4 | import PoincareLib.Geometry.RicciFlow.CanonicalNeighborhood.Neck.Separation.Segment |
| 5 | import PoincareLib.Geometry.RicciFlow.CanonicalNeighborhood.Neck.Geodesic.Intrinsic |
| 6 | |
| 7 | /-! |
| 8 | # Stage-2 cap-boundary transport estimates |
| 9 | |
| 10 | The first two estimates needed before the literal cap-boundary contact are |
| 11 | local producers. The escape estimate starts at an arbitrary point of a neck, |
| 12 | not only at its central sphere. The cap estimate converts its intrinsic |
| 13 | diameter bound into an ambient distance bound from a core point. Neither |
| 14 | estimate assumes a tube, a path hit, a chain, or a target-shaped cap. |
| 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 | variable {M : Type u} [TopologicalSpace M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 28 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 29 | [T2Space M] [T3Space M] |
| 30 | {g : RiemannianMetric 3 M} |
| 31 | |
| 32 | private theorem edist_lower_of_axis_le_of_not_mem_carrier_local |
| 33 | (N : EpsilonNeck g) {p x : M} {a : ℝ} |
| 34 | (hp : p ∈ N.carrier) (ha : 0 ≤ a) (haL : a < N.epsilon⁻¹) |
| 35 | (haxis : |(N.coordinate_inverse p).2| ≤ a) (hx : x ∉ N.carrier) : |
| 36 | ENNReal.ofReal (N.scale * Real.sqrt (1 - N.epsilon) * |
| 37 | (N.epsilon⁻¹ - a)) ≤ g.edist p x := by |
| 38 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 39 | ⟨g.toRiemannianMetric⟩ |
| 40 | have hfactor : 0 ≤ N.scale * Real.sqrt (1 - N.epsilon) := |
| 41 | mul_nonneg N.scale_pos.le (Real.sqrt_nonneg _) |
| 42 | have hbound (s : ℝ) (hs : s ∈ Ioo a N.epsilon⁻¹) : |
| 43 | ENNReal.ofReal (N.scale * Real.sqrt (1 - N.epsilon) * (s - a)) ≤ |
| 44 | g.edist p x := by |
| 45 | by_contra h |
| 46 | have hdist : Manifold.riemannianEDist (𝓡 3) p x < |
| 47 | ENNReal.ofReal (N.scale * Real.sqrt (1 - N.epsilon) * (s - a)) := |
| 48 | lt_of_not_ge h |
| 49 | obtain ⟨γ, hγ0, hγ1, hγ, hlength⟩ := |
| 50 | Manifold.exists_lt_of_riemannianEDist_lt hdist |
| 51 | have hleft : -N.epsilon⁻¹ < -s := neg_lt_neg hs.2 |
| 52 | have hstart : γ 0 ∈ N.region (-s) s := by |
| 53 | rw [hγ0] |
| 54 | exact ⟨hp, by linarith [(abs_le.mp haxis).1, hs.1], |
| 55 | by linarith [(abs_le.mp haxis).2, hs.1]⟩ |
| 56 | have hout : γ 1 ∉ N.coordinate_map '' (univ ×ˢ Icc (-s) s) := by |
| 57 | rw [hγ1] |
| 58 | exact fun hmem => hx ((N.mem_coordinate_slab_iff hleft hs.2).mp hmem).1 |
| 59 | obtain ⟨t, ht, hcarrier, hboundary, -⟩ := |
| 60 | N.exists_initial_segment_to_slab_boundary |
| 61 | (show (0 : ℝ) ≤ 1 by norm_num) hleft hs.2 |
| 62 | hγ.continuousOn hstart hout |
| 63 | have hvalue : s - a ≤ |(N.coordinate_inverse (γ t)).2 - |
| 64 | (N.coordinate_inverse (γ 0)).2| := by |
| 65 | rw [hγ0] |
| 66 | have hb : |(N.coordinate_inverse (γ t)).2| = s := by |
| 67 | rcases hboundary with hneg | hpos |
| 68 | · rw [hneg, abs_neg, abs_of_nonneg (ha.trans hs.1.le)] |
| 69 | · rw [hpos, abs_of_nonneg (ha.trans hs.1.le)] |
| 70 | have htriangle := abs_sub_abs_le_abs_sub |
| 71 | (N.coordinate_inverse (γ t)).2 (N.coordinate_inverse p).2 |
| 72 | rw [hb] at htriangle |
| 73 | linarith |
| 74 | have hax := (ENNReal.ofReal_le_ofReal |
| 75 | (mul_le_mul_of_nonneg_left hvalue hfactor)).trans |
| 76 | (N.path_axial_displacement_le_sharp ht.1.le |
| 77 | (hγ.mono (Icc_subset_Icc le_rfl ht.2)) hcarrier) |
| 78 | have hmono : g.pathELength γ 0 t ≤ g.pathELength γ 0 1 := |
| 79 | Manifold.pathELength_mono le_rfl ht.2 |
| 80 | exact (not_lt_of_ge (hax.trans hmono)) hlength |
| 81 | have hclosed : IsClosed {s : ℝ | |
| 82 | ENNReal.ofReal (N.scale * Real.sqrt (1 - N.epsilon) * (s - a)) ≤ |
| 83 | g.edist p x} := |
| 84 | isClosed_le (ENNReal.continuous_ofReal.comp |
| 85 | (continuous_const.mul (continuous_id.sub continuous_const))) continuous_const |
| 86 | have hclosure := hclosed.closure_subset_iff.mpr (show Ioo a N.epsilon⁻¹ ⊆ |
| 87 | {s : ℝ | ENNReal.ofReal (N.scale * Real.sqrt (1 - N.epsilon) * (s - a)) ≤ |
| 88 | g.edist p x} from hbound) |
| 89 | rw [closure_Ioo haL.ne] at hclosure |
| 90 | exact hclosure ⟨haL.le, le_rfl⟩ |
| 91 | |
| 92 | /-- Leaving an epsilon-neck from an arbitrary base point costs at least the |
| 93 | axial distance to the nearer end. The strict radius condition keeps the |
| 94 | first-exit slab inside the literal carrier. -/ |
| 95 | theorem mem_carrier_of_edist_lt_escape (N : EpsilonNeck g) {x y : M} |
| 96 | (hx : x ∈ N.carrier) {r : ℝ} (_hr : 0 < r) |
| 97 | (hrA : r < N.epsilon⁻¹ - |(N.coordinate_inverse x).2|) |
| 98 | (hxy : g.edist x y < |
| 99 | ENNReal.ofReal ((N.scale * Real.sqrt (1 - N.epsilon)) * r)) : |
| 100 | y ∈ N.carrier := by |
| 101 | by_contra hy |
| 102 | have hcoord := (N.coordinate_inverse_mem x hx).2 |
| 103 | have hheight : |(N.coordinate_inverse x).2| < N.epsilon⁻¹ := by |
| 104 | rw [abs_lt] |
| 105 | constructor <;> linarith [hcoord.1, hcoord.2] |
| 106 | have hlower := edist_lower_of_axis_le_of_not_mem_carrier_local N |
| 107 | hx (abs_nonneg _) hheight (le_rfl) hy |
| 108 | have hfactor : 0 < N.scale * Real.sqrt (1 - N.epsilon) := by |
| 109 | exact mul_pos N.scale_pos (Real.sqrt_pos.mpr (by linarith [N.epsilon_lt_half])) |
| 110 | have hmul : (N.scale * Real.sqrt (1 - N.epsilon)) * r < |
| 111 | (N.scale * Real.sqrt (1 - N.epsilon)) * |
| 112 | (N.epsilon⁻¹ - |(N.coordinate_inverse x).2|) := by |
| 113 | exact mul_lt_mul_of_pos_left hrA hfactor |
| 114 | have hreal : ENNReal.ofReal ((N.scale * Real.sqrt (1 - N.epsilon)) * r) < |
| 115 | ENNReal.ofReal ((N.scale * Real.sqrt (1 - N.epsilon)) * |
| 116 | (N.epsilon⁻¹ - |(N.coordinate_inverse x).2|)) := |
| 117 | (ENNReal.ofReal_lt_ofReal_iff (by positivity)).mpr hmul |
| 118 | exact (not_lt_of_ge hreal.le) (hlower.trans_lt hxy) |
| 119 | |
| 120 | omit [MeasurableSpace M] [BorelSpace M] [T2Space M] [T3Space M] in |
| 121 | private theorem edist_le_intrinsicEDist_local (g : RiemannianMetric 3 M) |
| 122 | (U : Set M) (x y : M) : g.edist x y ≤ intrinsicEDist g U x y := by |
| 123 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 124 | ⟨g.toRiemannianMetric⟩ |
| 125 | apply le_sInf |
| 126 | rintro L ⟨γ, hγ, h0, h1, _, rfl⟩ |
| 127 | exact Manifold.riemannianEDist_le_pathELength hγ h0 h1 zero_le_one |
| 128 | |
| 129 | omit [T2Space M] in |
| 130 | private theorem cap_scalar_le_sup (K : CapCertificate g) {x : M} |
| 131 | (hx : x ∈ K.carrier) : |
| 132 | K.connection.scalarCurvature x ≤ |
| 133 | scalarCurvatureSupOn g K.connection K.carrier := by |
| 134 | obtain ⟨bound, _, hratio⟩ := K.scalar_ratio |
| 135 | have hbounded : BddAbove (range (fun z : K.carrier => |
| 136 | K.connection.scalarCurvature z.1)) := by |
| 137 | refine ⟨bound * K.connection.scalarCurvature x, ?_⟩ |
| 138 | rintro _ ⟨z, rfl⟩ |
| 139 | exact hratio x hx z.1 z.2 |
| 140 | exact le_csSup hbounded ⟨⟨x, hx⟩, rfl⟩ |
| 141 | |
| 142 | /-- The normalized scalar error `1/100` gives the numerical cap-radius |
| 143 | constant used by the escape comparison. -/ |
| 144 | theorem scalar_rpow_neg_half_le_of_normalized_error |
| 145 | {s R : ℝ} (hs : 0 < s) (hR : 0 < R) |
| 146 | (herr : |s ^ 2 * R - 1| < 1 / 100) : |
| 147 | R ^ (-1 / 2 : ℝ) ≤ (1.006 : ℝ) * s := by |
| 148 | have hprod : (0.99 : ℝ) < s ^ 2 * R := by |
| 149 | nlinarith [abs_lt.mp herr |>.1] |
| 150 | have hpowpos : 0 < R ^ (-1 / 2 : ℝ) := Real.rpow_pos_of_pos hR _ |
| 151 | have hscale : 0 < (1.006 : ℝ) * s := mul_pos (by norm_num) hs |
| 152 | by_contra hnot |
| 153 | have hlt : (1.006 : ℝ) * s < R ^ (-1 / 2 : ℝ) := lt_of_not_ge hnot |
| 154 | have hsq : ((1.006 : ℝ) * s) ^ 2 < |
| 155 | (R ^ (-1 / 2 : ℝ)) ^ 2 := by |
| 156 | nlinarith [hscale, hpowpos] |
| 157 | have hrpow : (R ^ (-1 / 2 : ℝ)) ^ 2 = R⁻¹ := by |
| 158 | rw [← Real.rpow_natCast, ← Real.rpow_mul hR.le] |
| 159 | norm_num [Real.rpow_neg_one] |
| 160 | rw [hrpow] at hsq |
| 161 | have hsqmul := mul_lt_mul_of_pos_right hsq hR |
| 162 | rw [inv_mul_cancel₀ hR.ne'] at hsqmul |
| 163 | nlinarith [hprod] |
| 164 | |
| 165 | /-- Uniform cylinder accuracy supplies the normalized scalar error at any cap |
| 166 | core point already captured by the selected neck. -/ |
| 167 | theorem exists_cap_core_normalized_scalar_accuracy : |
| 168 | ∃ epsilon₀ : ℝ, 0 < epsilon₀ ∧ epsilon₀ ≤ (1 / 200 : ℝ) ∧ |
| 169 | ∀ (M : Type u) [TopologicalSpace M] |
| 170 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 171 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 172 | [T2Space M] [T3Space M] |
| 173 | (g : RiemannianMetric 3 M) (K : CapCertificate g) |
| 174 | (N : EpsilonNeck g), |
| 175 | N.epsilon ≤ epsilon₀ → ∀ x ∈ K.core, x ∈ N.carrier → |
| 176 | |N.scale ^ 2 * K.connection.scalarCurvature x - 1| < 1 / 100 := by |
| 177 | obtain ⟨epsilon₀, hpos, hsmall, haccuracy⟩ := |
| 178 | tube.exists_cylinder_scalar_accuracy.{u} (delta := 1 / 100) (by norm_num) |
| 179 | refine ⟨epsilon₀, hpos, hsmall, ?_⟩ |
| 180 | intro M _ _ _ _ _ _ _ g K N hN x hxK hxN |
| 181 | exact haccuracy M g K.connection N hN x hxN |
| 182 | |
| 183 | /-- The normalized cylinder producer also supplies the scalar-radius estimate |
| 184 | needed by a cap comparison, but only after the point is known to lie in the |
| 185 | candidate neck. This guarded form is what the endpoint transport consumes; |
| 186 | it does not assume that one cap point belongs to all three necks. -/ |
| 187 | theorem exists_cap_core_scalar_radius_accuracy : |
| 188 | ∃ epsilon₀ : ℝ, 0 < epsilon₀ ∧ epsilon₀ ≤ (1 / 200 : ℝ) ∧ |
| 189 | ∀ (M : Type u) [TopologicalSpace M] |
| 190 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 191 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 192 | [T2Space M] [T3Space M] |
| 193 | (g : RiemannianMetric 3 M) (K : CapCertificate g) |
| 194 | (N : EpsilonNeck g), |
| 195 | N.epsilon ≤ epsilon₀ → ∀ x ∈ K.core, x ∈ N.carrier → |
| 196 | K.connection.scalarCurvature x ^ (-1 / 2 : ℝ) ≤ |
| 197 | (1.006 : ℝ) * N.scale := by |
| 198 | obtain ⟨epsilon₀, hpos, hsmall, haccuracy⟩ := |
| 199 | exists_cap_core_normalized_scalar_accuracy.{u} |
| 200 | refine ⟨epsilon₀, hpos, hsmall, ?_⟩ |
| 201 | intro M _ _ _ _ _ _ _ g K N hN x hxK hxN |
| 202 | have hxinterior : x ∈ interior K.closed_core := by |
| 203 | rw [← K.core_eq_interior_closed_core] |
| 204 | exact hxK |
| 205 | have hxclosed : x ∈ K.closed_core := interior_subset hxinterior |
| 206 | have hxKcar : x ∈ K.carrier := by |
| 207 | rw [K.closed_core_eq_complement_end] at hxclosed |
| 208 | exact hxclosed.1 |
| 209 | exact scalar_rpow_neg_half_le_of_normalized_error N.scale_pos |
| 210 | (K.scalar_pos x hxKcar) (haccuracy M g K N hN x hxK hxN) |
| 211 | |
| 212 | /-- A point in the positive tail is at the expected ambient distance from a |
| 213 | carrier point whose axial coordinate is nonnegative. The closure is handled |
| 214 | as a genuine metric closure, rather than by treating the tail endpoint as a |
| 215 | carrier point. -/ |
| 216 | theorem edist_le_of_mem_closure_tail (N : EpsilonNeck g) |
| 217 | (hε : N.epsilon ≤ 1 / 1000) {x : M} (hx : x ∈ N.carrier) |
| 218 | {A : ℝ} |
| 219 | (hxupper : (N.coordinate_inverse x).2 ≤ A) |
| 220 | {p : M} (hp : p ∈ closure (N.region ((255 : ℝ) * A / 256) A)) |
| 221 | : |
| 222 | g.edist x p ≤ ENNReal.ofReal |
| 223 | ((1.0005 : ℝ) * N.scale * |
| 224 | (A - (N.coordinate_inverse x).2 + A / 256 + 7.1)) := by |
| 225 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 226 | ⟨g.toRiemannianMetric⟩ |
| 227 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin 3)) |
| 228 | (TangentSpace (𝓡 3) : M → Type _) := |
| 229 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ => rfl⟩⟩ |
| 230 | let : EMetricSpace M := EMetricSpace.ofRiemannianMetric (𝓡 3) M |
| 231 | have hpoint (y : M) (hy : y ∈ N.region ((255 : ℝ) * A / 256) A) : |
| 232 | g.edist x y ≤ ENNReal.ofReal |
| 233 | ((1.0005 : ℝ) * N.scale * |
| 234 | (A - (N.coordinate_inverse x).2 + A / 256 + 7.1)) := by |
| 235 | have hycar : y ∈ N.carrier := hy.1 |
| 236 | have hax := N.intrinsicEDist_le_axial_add hx hycar |
| 237 | have hed := (edist_le_intrinsicEDist_local g N.carrier x y).trans hax |
| 238 | have hyheight : (N.coordinate_inverse y).2 < A := hy.2.2 |
| 239 | have hyheight' : (255 : ℝ) * A / 256 < |
| 240 | (N.coordinate_inverse y).2 := hy.2.1 |
| 241 | have hdiff : |(N.coordinate_inverse y).2 - |
| 242 | (N.coordinate_inverse x).2| ≤ |
| 243 | A - (N.coordinate_inverse x).2 + A / 256 := by |
| 244 | by_cases hxy : (N.coordinate_inverse x).2 ≤ |
| 245 | (N.coordinate_inverse y).2 |
| 246 | · rw [abs_of_nonneg (by linarith)] |
| 247 | linarith |
| 248 | · rw [abs_of_neg (by linarith [hxy])] |
| 249 | have hgap : (N.coordinate_inverse x).2 - |
| 250 | (N.coordinate_inverse y).2 ≤ A / 256 := by |
| 251 | linarith [hyheight', hxupper] |
| 252 | linarith [hgap, hxupper] |
| 253 | have hsqrt : Real.sqrt (1 + N.epsilon) ≤ (1.0005 : ℝ) := by |
| 254 | have hs := Real.sq_sqrt (show 0 ≤ 1 + N.epsilon by |
| 255 | linarith [N.epsilon_pos]) |
| 256 | nlinarith [Real.sqrt_nonneg (1 + N.epsilon)] |
| 257 | have hconst : Real.sqrt 2 * (Real.pi + 1) ≤ (7.1 : ℝ) := by |
| 258 | have hs2 : Real.sqrt 2 ≤ (1.415 : ℝ) := by |
| 259 | have hs20 : 0 ≤ Real.sqrt 2 := Real.sqrt_nonneg _ |
| 260 | have hs22 : (Real.sqrt 2) ^ 2 = 2 := by norm_num |
| 261 | nlinarith |
| 262 | have hpi : Real.pi + 1 ≤ (5 : ℝ) := by |
| 263 | nlinarith [Real.pi_le_four] |
| 264 | have hnonneg : 0 ≤ Real.pi + 1 := by |
| 265 | nlinarith [Real.pi_pos] |
| 266 | nlinarith [mul_le_mul hs2 hpi hnonneg (by norm_num : (0 : ℝ) ≤ 1.415)] |
| 267 | have hinner : |(N.coordinate_inverse y).2 - |
| 268 | (N.coordinate_inverse x).2| + Real.sqrt 2 * (Real.pi + 1) ≤ |
| 269 | A - (N.coordinate_inverse x).2 + A / 256 + 7.1 := by |
| 270 | linarith [hdiff, hconst] |
| 271 | have hnonneg : 0 ≤ |(N.coordinate_inverse y).2 - |
| 272 | (N.coordinate_inverse x).2| + Real.sqrt 2 * (Real.pi + 1) := by |
| 273 | positivity |
| 274 | have hscale := mul_le_mul_of_nonneg_left hinner N.scale_pos.le |
| 275 | have hroot := mul_le_mul_of_nonneg_right hsqrt hnonneg |
| 276 | have hfactor : N.scale * Real.sqrt (1 + N.epsilon) * |
| 277 | (|(N.coordinate_inverse y).2 - (N.coordinate_inverse x).2| + |
| 278 | Real.sqrt 2 * (Real.pi + 1)) ≤ |
| 279 | (1.0005 : ℝ) * N.scale * |
| 280 | (A - (N.coordinate_inverse x).2 + A / 256 + 7.1) := by |
| 281 | calc |
| 282 | N.scale * Real.sqrt (1 + N.epsilon) * |
| 283 | (|(N.coordinate_inverse y).2 - (N.coordinate_inverse x).2| + |
| 284 | Real.sqrt 2 * (Real.pi + 1)) ≤ |
| 285 | N.scale * ((1.0005 : ℝ) * |
| 286 | (|(N.coordinate_inverse y).2 - (N.coordinate_inverse x).2| + |
| 287 | Real.sqrt 2 * (Real.pi + 1))) := by |
| 288 | simpa only [mul_assoc] using |
| 289 | (mul_le_mul_of_nonneg_left hroot N.scale_pos.le) |
| 290 | _ ≤ N.scale * ((1.0005 : ℝ) * |
| 291 | (A - (N.coordinate_inverse x).2 + A / 256 + 7.1)) := by |
| 292 | have hscale' := mul_le_mul_of_nonneg_left hscale |
| 293 | (by norm_num : (0 : ℝ) ≤ 1.0005) |
| 294 | calc |
| 295 | N.scale * ((1.0005 : ℝ) * |
| 296 | (|(N.coordinate_inverse y).2 - (N.coordinate_inverse x).2| + |
| 297 | Real.sqrt 2 * (Real.pi + 1))) = |
| 298 | (1.0005 : ℝ) * (N.scale * |
| 299 | (|(N.coordinate_inverse y).2 - (N.coordinate_inverse x).2| + |
| 300 | Real.sqrt 2 * (Real.pi + 1))) := by ring |
| 301 | _ ≤ (1.0005 : ℝ) * (N.scale * |
| 302 | (A - (N.coordinate_inverse x).2 + A / 256 + 7.1)) := hscale' |
| 303 | _ = N.scale * ((1.0005 : ℝ) * |
| 304 | (A - (N.coordinate_inverse x).2 + A / 256 + 7.1)) := by ring |
| 305 | _ = (1.0005 : ℝ) * N.scale * |
| 306 | (A - (N.coordinate_inverse x).2 + A / 256 + 7.1) := by ring |
| 307 | exact hed.trans (ENNReal.ofReal_le_ofReal hfactor) |
| 308 | exact closure_minimal hpoint |
| 309 | (isClosed_le (continuous_const.edist continuous_id) continuous_const) hp |
| 310 | |
| 311 | /-- The successor carrier supplies a middle margin when a cap core lies near |
| 312 | the positive end of the current neck. Only the carrier half of the forward |
| 313 | transfer is used. -/ |
| 314 | theorem successor_middle_margin_of_positive_end (K : CapCertificate g) |
| 315 | (N Q : EpsilonNeck g) {A : ℝ} (hε : N.epsilon ≤ 1 / 1000) |
| 316 | (hQε : Q.epsilon = N.epsilon) (hAeq : N.epsilon⁻¹ = A) |
| 317 | (hA : 4 * K.cap_constant < A) |
| 318 | (hA₀ : (1000 : ℝ) ≤ A) |
| 319 | (hQs : (0.999 : ℝ) * N.scale < Q.scale) |
| 320 | (hQc : Q.center ∈ closure (N.region ((255 : ℝ) * A / 256) A)) |
| 321 | {x : M} (hxN : x ∈ N.carrier) |
| 322 | (hxend : A - (1.009 : ℝ) * K.cap_constant < |
| 323 | (N.coordinate_inverse x).2) |
| 324 | (hforward : N.region (A / 2) A ⊆ Q.carrier) : |
| 325 | x ∈ Q.carrier ∧ |
| 326 | |(Q.coordinate_inverse x).2| ≤ |
| 327 | Q.epsilon⁻¹ - (1.009 : ℝ) * K.cap_constant := by |
| 328 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 329 | ⟨g.toRiemannianMetric⟩ |
| 330 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin 3)) |
| 331 | (TangentSpace (𝓡 3) : M → Type _) := |
| 332 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ => rfl⟩⟩ |
| 333 | let : EMetricSpace M := EMetricSpace.ofRiemannianMetric (𝓡 3) M |
| 334 | have hApos : 0 < A := by nlinarith [K.cap_constant_pos] |
| 335 | have hCpos : 0 < K.cap_constant := K.cap_constant_pos |
| 336 | have hquarter : (1.009 : ℝ) * K.cap_constant < A / 2 := by |
| 337 | nlinarith |
| 338 | have hxcoord : (N.coordinate_inverse x).2 < A := by |
| 339 | rw [← hAeq] |
| 340 | exact (N.coordinate_inverse_mem x hxN).2.2 |
| 341 | have hxregion : x ∈ N.region (A / 2) A := by |
| 342 | refine ⟨hxN, ?_, hxcoord⟩ |
| 343 | nlinarith |
| 344 | have hxQ : x ∈ Q.carrier := hforward hxregion |
| 345 | have hxpos : 0 ≤ (N.coordinate_inverse x).2 := by |
| 346 | nlinarith [hA, hCpos] |
| 347 | have hdist := edist_le_of_mem_closure_tail N hε hxN hxcoord.le hQc |
| 348 | have hdist' : g.edist x Q.center ≤ ENNReal.ofReal |
| 349 | ((1.0005 : ℝ) * N.scale * |
| 350 | ((1.009 : ℝ) * K.cap_constant + A / 256 + 7.1)) := by |
| 351 | apply hdist.trans |
| 352 | apply ENNReal.ofReal_le_ofReal |
| 353 | have harg : A - (N.coordinate_inverse x).2 + A / 256 + 7.1 ≤ |
| 354 | (1.009 : ℝ) * K.cap_constant + A / 256 + 7.1 := by |
| 355 | linarith [hxend] |
| 356 | exact mul_le_mul_of_nonneg_left harg |
| 357 | (mul_nonneg (by norm_num) N.scale_pos.le) |
| 358 | have hradpos : 0 < A - (1.009 : ℝ) * K.cap_constant := by |
| 359 | nlinarith |
| 360 | have hradQ : A - (1.009 : ℝ) * K.cap_constant < Q.epsilon⁻¹ := by |
| 361 | rw [hQε] |
| 362 | have hinv : (1000 : ℝ) ≤ N.epsilon⁻¹ := by |
| 363 | have h := mul_le_mul_of_nonneg_right hε |
| 364 | (inv_pos.mpr N.epsilon_pos).le |
| 365 | rw [mul_inv_cancel₀ N.epsilon_pos.ne'] at h |
| 366 | nlinarith |
| 367 | rw [← hAeq] |
| 368 | nlinarith [hA, hCpos, hinv] |
| 369 | have hQeq : Q.epsilon⁻¹ = A := by |
| 370 | rw [hQε, ← hAeq] |
| 371 | by_contra hbad |
| 372 | have hnot : x ∉ Q.region (-(A - (1.009 : ℝ) * K.cap_constant)) |
| 373 | (A - (1.009 : ℝ) * K.cap_constant) := by |
| 374 | intro hxreg |
| 375 | have hboundQ : A - (1.009 : ℝ) * K.cap_constant ≤ |
| 376 | Q.epsilon⁻¹ - (1.009 : ℝ) * K.cap_constant := by |
| 377 | rw [hQeq] |
| 378 | exact hbad ⟨hxQ, |
| 379 | abs_le.mpr ⟨by linarith [hxreg.2.1, hboundQ], |
| 380 | by linarith [hxreg.2.2, hboundQ]⟩⟩ |
| 381 | have hlow := Q.edist_central_lower_of_not_mem_region hradpos hradQ |
| 382 | Q.center_on_central_sphere hnot |
| 383 | have hroot : (0.998 : ℝ) < Real.sqrt (1 - Q.epsilon) := by |
| 384 | have hs := Real.sq_sqrt (show 0 ≤ 1 - Q.epsilon by |
| 385 | linarith [Q.epsilon_pos]) |
| 386 | nlinarith [Real.sqrt_nonneg (1 - Q.epsilon)] |
| 387 | have hscale : (0.997 : ℝ) * N.scale < |
| 388 | Q.scale * Real.sqrt (1 - Q.epsilon) := by |
| 389 | have hprod := mul_lt_mul_of_pos_right hroot Q.scale_pos |
| 390 | have hq' := mul_lt_mul_of_pos_left hQs |
| 391 | (by norm_num : (0 : ℝ) < 0.998) |
| 392 | have hq : (0.997 : ℝ) * N.scale < (0.998 : ℝ) * Q.scale := by |
| 393 | nlinarith [hq', N.scale_pos] |
| 394 | nlinarith [hprod, hq] |
| 395 | have hlow' : ENNReal.ofReal ((0.997 : ℝ) * N.scale * |
| 396 | (A - (1.009 : ℝ) * K.cap_constant)) ≤ g.edist x Q.center := by |
| 397 | have hfactor : 0 ≤ (0.997 : ℝ) * N.scale * |
| 398 | (A - (1.009 : ℝ) * K.cap_constant) := |
| 399 | mul_nonneg (mul_nonneg (by norm_num) N.scale_pos.le) hradpos.le |
| 400 | have hmul := mul_le_mul_of_nonneg_right hscale.le hradpos.le |
| 401 | have hmulE : ENNReal.ofReal ((0.997 : ℝ) * N.scale * |
| 402 | (A - (1.009 : ℝ) * K.cap_constant)) ≤ |
| 403 | ENNReal.ofReal (Q.scale * Real.sqrt (1 - Q.epsilon) * |
| 404 | (A - (1.009 : ℝ) * K.cap_constant)) := by |
| 405 | have hright : 0 ≤ Q.scale * Real.sqrt (1 - Q.epsilon) * |
| 406 | (A - (1.009 : ℝ) * K.cap_constant) := |
| 407 | mul_nonneg (mul_nonneg Q.scale_pos.le (Real.sqrt_nonneg _)) hradpos.le |
| 408 | apply (ENNReal.ofReal_le_ofReal_iff hright).mpr |
| 409 | exact hmul |
| 410 | have hlowcenter : ENNReal.ofReal (Q.scale * Real.sqrt (1 - Q.epsilon) * |
| 411 | (A - (1.009 : ℝ) * K.cap_constant)) ≤ g.edist x Q.center := by |
| 412 | have heq : g.edist x Q.center = g.edist Q.center x := |
| 413 | edist_comm x Q.center |
| 414 | rw [heq] |
| 415 | exact hlow |
| 416 | exact hmulE.trans hlowcenter |
| 417 | have hupper : (0.997 : ℝ) * N.scale * |
| 418 | (A - (1.009 : ℝ) * K.cap_constant) ≤ |
| 419 | (1.0005 : ℝ) * N.scale * |
| 420 | ((1.009 : ℝ) * K.cap_constant + A / 256 + 7.1) := by |
| 421 | have hchain := hlow'.trans hdist' |
| 422 | have htail : 0 ≤ (1.009 : ℝ) * K.cap_constant + A / 256 + 7.1 := by |
| 423 | nlinarith [hApos, hCpos] |
| 424 | have hright : 0 ≤ (1.0005 : ℝ) * N.scale * |
| 425 | ((1.009 : ℝ) * K.cap_constant + A / 256 + 7.1) := |
| 426 | mul_nonneg (mul_nonneg (by norm_num) N.scale_pos.le) htail |
| 427 | have hreal := (ENNReal.ofReal_le_ofReal_iff hright).mp hchain |
| 428 | nlinarith [hreal] |
| 429 | have hupper' : N.scale * ((0.997 : ℝ) * |
| 430 | (A - (1.009 : ℝ) * K.cap_constant)) ≤ |
| 431 | N.scale * ((1.0005 : ℝ) * |
| 432 | ((1.009 : ℝ) * K.cap_constant + A / 256 + 7.1)) := by |
| 433 | simpa only [mul_assoc, mul_left_comm, mul_comm] using hupper |
| 434 | have hupper'' : ((0.997 : ℝ) * |
| 435 | (A - (1.009 : ℝ) * K.cap_constant)) * N.scale ≤ |
| 436 | ((1.0005 : ℝ) * |
| 437 | ((1.009 : ℝ) * K.cap_constant + A / 256 + 7.1)) * N.scale := by |
| 438 | simpa only [mul_comm] using hupper' |
| 439 | have hscalar := (mul_le_mul_iff_left₀ N.scale_pos).mp hupper'' |
| 440 | nlinarith [hscalar, hA, hA₀, hCpos] |
| 441 | |
| 442 | omit [T2Space M] in |
| 443 | /-- The predecessor margin is the reciprocal-band half of the endpoint |
| 444 | argument; unlike the successor branch it needs no height estimate in P. -/ |
| 445 | theorem predecessor_middle_margin_of_negative_end (K : CapCertificate g) |
| 446 | (N P : EpsilonNeck g) {A : ℝ} (hPε : P.epsilon = N.epsilon) |
| 447 | (hAeq : N.epsilon⁻¹ = A) |
| 448 | (hA : 4 * K.cap_constant < A) |
| 449 | (hrecip : N.region (-A) (-A / 2) ⊆ |
| 450 | P.region (-(0.2 : ℝ) * A) ((0.6 : ℝ) * A)) |
| 451 | {x : M} (hxN : x ∈ N.carrier) |
| 452 | (hxend : (N.coordinate_inverse x).2 < |
| 453 | -(A - (1.009 : ℝ) * K.cap_constant)) : |
| 454 | x ∈ P.carrier ∧ |
| 455 | |(P.coordinate_inverse x).2| ≤ |
| 456 | P.epsilon⁻¹ - (1.009 : ℝ) * K.cap_constant := by |
| 457 | have hCpos : 0 < K.cap_constant := K.cap_constant_pos |
| 458 | have hneg : x ∈ N.region (-A) (-A / 2) := by |
| 459 | refine ⟨hxN, ?_, ?_⟩ |
| 460 | · have hcoord := (N.coordinate_inverse_mem x hxN).2.1 |
| 461 | rw [← hAeq] |
| 462 | exact hcoord |
| 463 | · have hcoord := (N.coordinate_inverse_mem x hxN).2.2 |
| 464 | rw [← hAeq] |
| 465 | nlinarith [hcoord] |
| 466 | have hP := hrecip hneg |
| 467 | refine ⟨hP.1, ?_⟩ |
| 468 | have hrad : (0.6 : ℝ) * A ≤ |
| 469 | P.epsilon⁻¹ - (1.009 : ℝ) * K.cap_constant := by |
| 470 | rw [hPε, ← hAeq] |
| 471 | have hinv : 0 < N.epsilon⁻¹ := inv_pos.mpr N.epsilon_pos |
| 472 | have hApos : 0 < A := by nlinarith |
| 473 | nlinarith |
| 474 | exact abs_le.mpr ⟨by linarith [hP.2.1], by linarith [hP.2.2, hrad]⟩ |
| 475 | |
| 476 | omit [T2Space M] in |
| 477 | /-- A cap carrier is uniformly close to a core point once the normalized |
| 478 | scalar-to-scale estimate at that point is fixed. The estimate itself is |
| 479 | supplied by the cylinder scalar-accuracy producer. -/ |
| 480 | theorem cap_carrier_edist_le_of_core_hit (K : CapCertificate g) |
| 481 | (N : EpsilonNeck g) {x : M} (hxK : x ∈ K.core) |
| 482 | (hscale : K.connection.scalarCurvature x ^ (-1 / 2 : ℝ) ≤ |
| 483 | (1.006 : ℝ) * N.scale) : |
| 484 | ∀ y ∈ K.carrier, |
| 485 | g.edist x y ≤ ENNReal.ofReal ((1.006 : ℝ) * K.cap_constant * N.scale) := by |
| 486 | have hxinterior : x ∈ interior K.closed_core := by |
| 487 | rw [← K.core_eq_interior_closed_core] |
| 488 | exact hxK |
| 489 | have hxclosed : x ∈ K.closed_core := interior_subset hxinterior |
| 490 | have hxKcar : x ∈ K.carrier := by |
| 491 | rw [K.closed_core_eq_complement_end] at hxclosed |
| 492 | exact hxclosed.1 |
| 493 | have hsup := cap_scalar_le_sup K hxKcar |
| 494 | have hpow := Real.rpow_le_rpow_of_nonpos (K.scalar_pos x hxKcar) hsup |
| 495 | (by norm_num : (-1 / 2 : ℝ) ≤ 0) |
| 496 | have hdiam : intrinsicDiameter g K.carrier < |
| 497 | ENNReal.ofReal (K.cap_constant * |
| 498 | K.connection.scalarCurvature x ^ (-1 / 2 : ℝ)) := by |
| 499 | apply K.intrinsic_diameter_bound.trans_le |
| 500 | apply ENNReal.ofReal_le_ofReal |
| 501 | exact mul_le_mul_of_nonneg_left hpow K.cap_constant_pos.le |
| 502 | intro y hy |
| 503 | have hpair : intrinsicEDist g K.carrier x y ≤ intrinsicDiameter g K.carrier := |
| 504 | le_sSup ⟨(⟨x, hxKcar⟩, ⟨y, hy⟩), rfl⟩ |
| 505 | have hed : g.edist x y < ENNReal.ofReal (K.cap_constant * |
| 506 | K.connection.scalarCurvature x ^ (-1 / 2 : ℝ)) := |
| 507 | (edist_le_intrinsicEDist_local g K.carrier x y).trans hpair |>.trans_lt hdiam |
| 508 | have htarget : ENNReal.ofReal (K.cap_constant * |
| 509 | K.connection.scalarCurvature x ^ (-1 / 2 : ℝ)) ≤ |
| 510 | ENNReal.ofReal ((1.006 : ℝ) * K.cap_constant * N.scale) := by |
| 511 | apply ENNReal.ofReal_le_ofReal |
| 512 | calc |
| 513 | K.cap_constant * K.connection.scalarCurvature x ^ (-1 / 2 : ℝ) ≤ |
| 514 | K.cap_constant * ((1.006 : ℝ) * N.scale) := |
| 515 | mul_le_mul_of_nonneg_left hscale K.cap_constant_pos.le |
| 516 | _ = (1.006 : ℝ) * K.cap_constant * N.scale := by ring |
| 517 | exact hed.le.trans htarget |
| 518 | |
| 519 | omit [T2Space M] in |
| 520 | /-- The cap-radius estimate with the normalized scalar error as its producer |
| 521 | input. -/ |
| 522 | theorem cap_carrier_edist_le_of_core_hit_of_normalized_error |
| 523 | (K : CapCertificate g) (N : EpsilonNeck g) {x : M} |
| 524 | (hxK : x ∈ K.core) |
| 525 | (hscalar : |N.scale ^ 2 * K.connection.scalarCurvature x - 1| < 1 / 100) : |
| 526 | ∀ y ∈ K.carrier, |
| 527 | g.edist x y ≤ ENNReal.ofReal ((1.006 : ℝ) * K.cap_constant * N.scale) := by |
| 528 | have hxinterior : x ∈ interior K.closed_core := by |
| 529 | rw [← K.core_eq_interior_closed_core] |
| 530 | exact hxK |
| 531 | have hxclosed : x ∈ K.closed_core := interior_subset hxinterior |
| 532 | have hxKcar : x ∈ K.carrier := by |
| 533 | rw [K.closed_core_eq_complement_end] at hxclosed |
| 534 | exact hxclosed.1 |
| 535 | exact cap_carrier_edist_le_of_core_hit K N hxK |
| 536 | (scalar_rpow_neg_half_le_of_normalized_error N.scale_pos |
| 537 | (K.scalar_pos x hxKcar) hscalar) |
| 538 | |
| 539 | /-- If the core point has a margin from both ends of a neck, the whole cap |
| 540 | carrier stays in that neck. This is the middle case of the buffered |
| 541 | three-neck transport; endpoint cases require an additional oriented side |
| 542 | certificate from the neighboring neck. -/ |
| 543 | theorem cap_carrier_subset_of_middle_escape (K : CapCertificate g) |
| 544 | (N : EpsilonNeck g) (hε : N.epsilon ≤ 1 / 1000) {x : M} |
| 545 | (hxK : x ∈ K.core) (hxN : x ∈ N.carrier) |
| 546 | (hscale : K.connection.scalarCurvature x ^ (-1 / 2 : ℝ) ≤ |
| 547 | (1.006 : ℝ) * N.scale) |
| 548 | (hmargin : |(N.coordinate_inverse x).2| ≤ |
| 549 | N.epsilon⁻¹ - (1.009 : ℝ) * K.cap_constant) : |
| 550 | K.carrier ⊆ N.carrier := by |
| 551 | have hroot : (0.999 : ℝ) < Real.sqrt (1 - N.epsilon) := by |
| 552 | have hs := Real.sq_sqrt (show 0 ≤ 1 - N.epsilon by linarith) |
| 553 | nlinarith [Real.sqrt_nonneg (1 - N.epsilon)] |
| 554 | have hnum : (1.006 : ℝ) * K.cap_constant < |
| 555 | Real.sqrt (1 - N.epsilon) * (1.008 : ℝ) * K.cap_constant := by |
| 556 | have hstep := mul_lt_mul_of_pos_right hroot |
| 557 | (mul_pos (by norm_num : (0 : ℝ) < 1.008) K.cap_constant_pos) |
| 558 | nlinarith [hstep] |
| 559 | have hcost : (1.006 : ℝ) * K.cap_constant * N.scale < |
| 560 | (N.scale * Real.sqrt (1 - N.epsilon)) * |
| 561 | ((1.008 : ℝ) * K.cap_constant) := by |
| 562 | have hstep := mul_lt_mul_of_pos_right hnum N.scale_pos |
| 563 | nlinarith [hstep] |
| 564 | have hcostE : ENNReal.ofReal ((1.006 : ℝ) * K.cap_constant * N.scale) < |
| 565 | ENNReal.ofReal ((N.scale * Real.sqrt (1 - N.epsilon)) * |
| 566 | ((1.008 : ℝ) * K.cap_constant)) := by |
| 567 | have htargetPos : 0 < (N.scale * Real.sqrt (1 - N.epsilon)) * |
| 568 | ((1.008 : ℝ) * K.cap_constant) := by |
| 569 | exact mul_pos (mul_pos N.scale_pos (Real.sqrt_pos.mpr (by linarith))) |
| 570 | (mul_pos (by norm_num) K.cap_constant_pos) |
| 571 | apply (ENNReal.ofReal_lt_ofReal_iff htargetPos).mpr |
| 572 | exact hcost |
| 573 | have hrad : (1.008 : ℝ) * K.cap_constant < |
| 574 | N.epsilon⁻¹ - |(N.coordinate_inverse x).2| := by |
| 575 | nlinarith [hmargin, K.cap_constant_pos] |
| 576 | have hxy (y : M) (hy : y ∈ K.carrier) : |
| 577 | g.edist x y < ENNReal.ofReal ((N.scale * Real.sqrt (1 - N.epsilon)) * |
| 578 | ((1.008 : ℝ) * K.cap_constant)) := by |
| 579 | exact (cap_carrier_edist_le_of_core_hit K N hxK hscale y hy).trans_lt hcostE |
| 580 | intro y hy |
| 581 | exact mem_carrier_of_edist_lt_escape N hxN |
| 582 | (mul_pos (by norm_num) K.cap_constant_pos) hrad (hxy y hy) |
| 583 | |
| 584 | /-- A cap carrier is covered by one of two candidate necks when the core point |
| 585 | has a verified middle escape margin in one of them. This is the exact |
| 586 | consumer-side shape needed for the endpoint branches of the buffered tube. -/ |
| 587 | theorem cap_carrier_subset_union_of_middle_margin |
| 588 | (K : CapCertificate g) (N Q : EpsilonNeck g) |
| 589 | (hNε : N.epsilon ≤ 1 / 1000) (hQε : Q.epsilon ≤ 1 / 1000) |
| 590 | {x : M} (hxK : x ∈ K.core) (hxN : x ∈ N.carrier) (hxQ : x ∈ Q.carrier) |
| 591 | (hscaleN : K.connection.scalarCurvature x ^ (-1 / 2 : ℝ) ≤ |
| 592 | (1.006 : ℝ) * N.scale) |
| 593 | (hscaleQ : K.connection.scalarCurvature x ^ (-1 / 2 : ℝ) ≤ |
| 594 | (1.006 : ℝ) * Q.scale) |
| 595 | (hmargin : |
| 596 | |(N.coordinate_inverse x).2| ≤ |
| 597 | N.epsilon⁻¹ - (1.009 : ℝ) * K.cap_constant ∨ |
| 598 | |(Q.coordinate_inverse x).2| ≤ |
| 599 | Q.epsilon⁻¹ - (1.009 : ℝ) * K.cap_constant) : |
| 600 | K.carrier ⊆ N.carrier ∪ Q.carrier := by |
| 601 | rcases hmargin with hN | hQ |
| 602 | · exact fun y hy => Or.inl |
| 603 | (cap_carrier_subset_of_middle_escape K N hNε hxK hxN hscaleN hN hy) |
| 604 | · exact fun y hy => Or.inr |
| 605 | (cap_carrier_subset_of_middle_escape K Q hQε hxK hxQ hscaleQ hQ hy) |
| 606 | |
| 607 | /-- A cap whose core meets a selected neck is transported through the two |
| 608 | buffer necks and that neck. The endpoint margins are proved separately, so |
| 609 | the assembly consumes only the literal carrier and scalar-radius fields. -/ |
| 610 | theorem cap_carrier_subset_three_necks (K : CapCertificate g) |
| 611 | (P N Q : EpsilonNeck g) {A : ℝ} |
| 612 | (hε : N.epsilon ≤ 1 / 1000) (hPε : P.epsilon = N.epsilon) |
| 613 | (hQε : Q.epsilon = N.epsilon) (hAeq : N.epsilon⁻¹ = A) |
| 614 | (hA : 4 * K.cap_constant < A) (hA₀ : (1000 : ℝ) ≤ A) |
| 615 | (hQs : (0.999 : ℝ) * N.scale < Q.scale) |
| 616 | (hQc : Q.center ∈ closure (N.region ((255 : ℝ) * A / 256) A)) |
| 617 | (hforward : N.region (A / 2) A ⊆ Q.carrier) |
| 618 | (hrecip : N.region (-A) (-A / 2) ⊆ |
| 619 | P.region (-(0.2 : ℝ) * A) ((0.6 : ℝ) * A)) |
| 620 | {x : M} (hxK : x ∈ K.core) (hxN : x ∈ N.carrier) |
| 621 | (hscaleP : ∀ {z : M}, z ∈ K.core → z ∈ P.carrier → |
| 622 | K.connection.scalarCurvature z ^ (-1 / 2 : ℝ) ≤ |
| 623 | (1.006 : ℝ) * P.scale) |
| 624 | (hscaleN : ∀ {z : M}, z ∈ K.core → z ∈ N.carrier → |
| 625 | K.connection.scalarCurvature z ^ (-1 / 2 : ℝ) ≤ |
| 626 | (1.006 : ℝ) * N.scale) |
| 627 | (hscaleQ : ∀ {z : M}, z ∈ K.core → z ∈ Q.carrier → |
| 628 | K.connection.scalarCurvature z ^ (-1 / 2 : ℝ) ≤ |
| 629 | (1.006 : ℝ) * Q.scale) : |
| 630 | K.carrier ⊆ P.carrier ∪ N.carrier ∪ Q.carrier := by |
| 631 | have hPsmall : P.epsilon ≤ 1 / 1000 := by |
| 632 | rw [hPε] |
| 633 | exact hε |
| 634 | have hQsmall : Q.epsilon ≤ 1 / 1000 := by |
| 635 | rw [hQε] |
| 636 | exact hε |
| 637 | by_cases hpos : A - (1.009 : ℝ) * K.cap_constant < |
| 638 | (N.coordinate_inverse x).2 |
| 639 | · have hQmargin := successor_middle_margin_of_positive_end K N Q hε |
| 640 | hQε hAeq hA hA₀ hQs hQc hxN hpos hforward |
| 641 | have hNQ := cap_carrier_subset_union_of_middle_margin K N Q hε hQsmall |
| 642 | hxK hxN hQmargin.1 (hscaleN hxK hxN) (hscaleQ hxK hQmargin.1) |
| 643 | (Or.inr hQmargin.2) |
| 644 | intro y hy |
| 645 | rcases hNQ hy with hyN | hyQ |
| 646 | · exact Or.inl (Or.inr hyN) |
| 647 | · exact Or.inr hyQ |
| 648 | · by_cases hneg : (N.coordinate_inverse x).2 < |
| 649 | -(A - (1.009 : ℝ) * K.cap_constant) |
| 650 | · have hPmargin := predecessor_middle_margin_of_negative_end K N P |
| 651 | hPε hAeq hA hrecip hxN hneg |
| 652 | have hPN := cap_carrier_subset_union_of_middle_margin K P N hPsmall hε |
| 653 | hxK hPmargin.1 hxN (hscaleP hxK hPmargin.1) (hscaleN hxK hxN) |
| 654 | (Or.inl hPmargin.2) |
| 655 | intro y hy |
| 656 | rcases hPN hy with hyP | hyN |
| 657 | · exact Or.inl (Or.inl hyP) |
| 658 | · exact Or.inl (Or.inr hyN) |
| 659 | · have hNmargin : |
| 660 | |(N.coordinate_inverse x).2| ≤ |
| 661 | N.epsilon⁻¹ - (1.009 : ℝ) * K.cap_constant := by |
| 662 | have hupper : (N.coordinate_inverse x).2 ≤ |
| 663 | A - (1.009 : ℝ) * K.cap_constant := le_of_not_gt hpos |
| 664 | have hlower : -(A - (1.009 : ℝ) * K.cap_constant) ≤ |
| 665 | (N.coordinate_inverse x).2 := le_of_not_gt hneg |
| 666 | rw [abs_le] |
| 667 | constructor <;> linarith [hAeq] |
| 668 | exact fun y hy => Or.inl (Or.inr |
| 669 | (cap_carrier_subset_of_middle_escape K N hε hxK hxN |
| 670 | (hscaleN hxK hxN) hNmargin hy)) |
| 671 | |
| 672 | end PoincareMT.M28 |