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.Limits.SelectedSegmentRayLimits |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Limits.SelectedSphereRadiusBarrier |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Angles.Geometry.CrossSegmentComparison |
| 5 | import Mathlib.Analysis.SpecificLimits.Basic |
| 6 | |
| 7 | /-! |
| 8 | # Corresponding-side comparison at the actual missing end |
| 9 | |
| 10 | Finite vertices on one retained ray, the same fixed-wall segments, and |
| 11 | compact original-A prefixes produce the missing-end comparison. A |
| 12 | single common hyperfilter and shortened-ray uniqueness identify the |
| 13 | second side. No angle limit or completeness is assumed. |
| 14 | Source: Morgan--Tian Lemma 10.21, p. 259; M28 derivation 151. |
| 15 | -/ |
| 16 | |
| 17 | noncomputable section |
| 18 | set_option autoImplicit false |
| 19 | set_option backward.isDefEq.respectTransparency false |
| 20 | |
| 21 | open Set Filter |
| 22 | open scoped Manifold ContDiff Bundle Topology ENNReal |
| 23 | |
| 24 | universe u |
| 25 | |
| 26 | namespace PoincareMT.M28 |
| 27 | |
| 28 | private theorem continuousOn_Icc_of_unit_metric |
| 29 | {Y : Type*} [MetricSpace Y] {eta : ℝ → Y} {L : ℝ} |
| 30 | (hmetric : ∀ s ∈ Icc (0 : ℝ) L, ∀ t ∈ Icc (0 : ℝ) L, |
| 31 | dist (eta s) (eta t) = |s - t|) : |
| 32 | ContinuousOn eta (Icc (0 : ℝ) L) := by |
| 33 | apply continuousOn_iff_continuous_domRestrict.mpr |
| 34 | have h : Isometry (fun t : Icc (0 : ℝ) L => eta t.1) := by |
| 35 | apply Isometry.of_dist_eq |
| 36 | intro s t |
| 37 | change dist (eta s.1) (eta t.1) = dist s.1 t.1 |
| 38 | simpa only [Real.dist_eq] using hmetric s.1 s.2 t.1 t.2 |
| 39 | exact h.continuous |
| 40 | |
| 41 | variable {M : Type u} [TopologicalSpace M] [T2Space M] |
| 42 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 43 | [IsManifold (𝓡 3) ∞ M] |
| 44 | {g : RiemannianMetric 3 M} {X : Set M} |
| 45 | |
| 46 | /-- Actual shortened rays satisfy the missing-end corresponding-side |
| 47 | inequality, using the same completion point, metric and fixed-wall |
| 48 | segment provider. This supplies comparison monotonicity rather than |
| 49 | assuming an angular limit. Source: Lemma 10.21, p. 259; derivation151. -/ |
| 50 | theorem corresponding_side_lower_at_selected_end |
| 51 | (T : EpsilonTubeCertificate g X) (C : OpenCylinderModel T.carrier) |
| 52 | (U : TopologicalSpace.Opens M) [PreconnectedSpace U] |
| 53 | (hU : (U : Set M) = C.tail true (1 / 2)) (f : M → ℝ) |
| 54 | (hfinite : ∀ p q : U, intrinsicEDist g (U : Set M) (p : M) (q : M) ≠ ⊤) |
| 55 | (D : LeviCivitaData (intrinsicOpenMetric g U)) |
| 56 | (hsec : D.NonnegativeSectionalCurvature) : |
| 57 | letI := intrinsicOpenMetricSpace g U hfinite |
| 58 | ∀ (E : UniformSpace.Completion U) (alpha : ℝ), 0 < alpha → |
| 59 | (∀ eta : ℝ, 0 < eta → ∃ c : ℝ, 1 / 2 < c ∧ c < 1 ∧ |
| 60 | ∀ x : U, c < (C.inverse x).2 → |
| 61 | dist (x : UniformSpace.Completion U) E < eta) → |
| 62 | (∀ x : U, dist (x : UniformSpace.Completion U) E < alpha → 0 < f x) → |
| 63 | (∀ p q : U, 0 < f p → 0 < f q → |
| 64 | ∃ mu : ℝ → U, mu 0 = p ∧ mu 1 = q ∧ Continuous mu ∧ |
| 65 | (∀ t : ℝ, (3 / 4 : ℝ) ≤ (C.inverse (mu t)).2) ∧ |
| 66 | ∀ s ∈ Icc (0 : ℝ) 1, ∀ t ∈ Icc (0 : ℝ) 1, |
| 67 | (intrinsicOpenMetric g U).edist (mu s) (mu t) = |
| 68 | ENNReal.ofReal |s - t| * (intrinsicOpenMetric g U).edist p q) → |
| 69 | ∀ {a b : ℝ} {gamma mu : ℝ → U}, |
| 70 | (∀ s ∈ Ico (0 : ℝ) a, ∀ t ∈ Ico (0 : ℝ) a, |
| 71 | dist (gamma s) (gamma t) = |s - t|) → |
| 72 | (∀ s ∈ Ico (0 : ℝ) b, ∀ t ∈ Ico (0 : ℝ) b, |
| 73 | dist (mu s) (mu t) = |s - t|) → |
| 74 | (∀ s ∈ Ico (0 : ℝ) a, |
| 75 | dist (gamma s : UniformSpace.Completion U) E = a - s) → |
| 76 | (∀ s ∈ Ico (0 : ℝ) b, |
| 77 | dist (mu s : UniformSpace.Completion U) E = b - s) → |
| 78 | ∀ {A B : ℝ}, 0 < A → A < a → A < alpha / 4 → |
| 79 | 0 < B → B < b → B < alpha / 4 → |
| 80 | ∀ s ∈ Ioc (0 : ℝ) A, ∀ t ∈ Ioc (0 : ℝ) B, |
| 81 | dist (gamma (a - s)) (mu (b - t)) ^ 2 ≥ s ^ 2 + t ^ 2 - |
| 82 | 2 * s * t * ((A ^ 2 + B ^ 2 - |
| 83 | dist (gamma (a - A)) (mu (b - B)) ^ 2) / (2 * A * B)) := by |
| 84 | classical |
| 85 | let := intrinsicOpenMetricSpace g U hfinite |
| 86 | let : RegularSpace U := @UniformSpace.to_regularSpace U |
| 87 | (intrinsicOpenMetricSpace g U hfinite).toUniformSpace |
| 88 | let : T0Space U := @MetricSpace.instT0Space U (intrinsicOpenMetricSpace g U hfinite) |
| 89 | let : T3Space U := ⟨⟩ |
| 90 | intro E alpha halpha htail hbarrier hsegments |
| 91 | a b gamma mu hgamma hmu hgammaRadius hmuRadius A B hA hAa hAalpha hB hBb hBalpha |
| 92 | let gU := intrinsicOpenMetric g U |
| 93 | let r : U → ℝ := fun x => dist (x : UniformSpace.Completion U) E |
| 94 | have hedist (x y : U) : gU.edist x y = ENNReal.ofReal (dist x y) := by |
| 95 | rw [intrinsicOpenMetric_edist, ← intrinsicOpenMetricSpace_edist g U hfinite, |
| 96 | edist_dist] |
| 97 | have hedistReal (x y : U) : (gU.edist x y).toReal = dist x y := by |
| 98 | rw [hedist, ENNReal.toReal_ofReal dist_nonneg] |
| 99 | have htriangle (x y : U) : |
| 100 | |r x - r y| ≤ dist x y ∧ dist x y ≤ r x + r y := by |
| 101 | constructor |
| 102 | · simpa only [UniformSpace.Completion.dist_eq] using |
| 103 | abs_dist_sub_le (x : UniformSpace.Completion U) (y : UniformSpace.Completion U) E |
| 104 | · simpa only [UniformSpace.Completion.dist_eq] using |
| 105 | dist_triangle_right (x : UniformSpace.Completion U) (y : UniformSpace.Completion U) E |
| 106 | let h : ℕ → ℝ := fun n => min A B / ((n : ℝ) + 2) |
| 107 | have hmin : 0 < min A B := lt_min hA hB |
| 108 | have hhpos (n : ℕ) : 0 < h n := by |
| 109 | dsimp [h] |
| 110 | exact div_pos hmin (by positivity) |
| 111 | have hhmin (n : ℕ) : h n < min A B := by |
| 112 | dsimp [h] |
| 113 | apply (div_lt_iff₀ (by positivity : (0 : ℝ) < (n : ℝ) + 2)).mpr |
| 114 | have hden : (1 : ℝ) < (n : ℝ) + 2 := by |
| 115 | have hn : (0 : ℝ) ≤ n := Nat.cast_nonneg n |
| 116 | linarith |
| 117 | simpa only [mul_one] using mul_lt_mul_of_pos_left hden hmin |
| 118 | have hhA (n : ℕ) : h n < A := (hhmin n).trans_le (min_le_left _ _) |
| 119 | have hhB (n : ℕ) : h n < B := (hhmin n).trans_le (min_le_right _ _) |
| 120 | have hhzero : Tendsto h atTop (𝓝 (0 : ℝ)) := by |
| 121 | simpa only [h, Function.comp_def, Nat.cast_add, Nat.cast_ofNat] using |
| 122 | (tendsto_const_div_atTop_nhds_zero_nat (min A B)).comp (tendsto_add_atTop_nat 2) |
| 123 | let q : ℕ → U := fun n => gamma (a - h n) |
| 124 | let p : U := mu (b - B) |
| 125 | have hqtime (n : ℕ) : a - h n ∈ Ico (0 : ℝ) a := by |
| 126 | constructor <;> linarith [hhA n, hhpos n] |
| 127 | have hqRadius (n : ℕ) : r (q n) = h n := by |
| 128 | dsimp [q, r] |
| 129 | rw [hgammaRadius _ (hqtime n)] |
| 130 | ring |
| 131 | have hpRadius : r p = B := by |
| 132 | dsimp [p, r] |
| 133 | rw [hmuRadius _ ⟨by linarith, by linarith⟩] |
| 134 | ring |
| 135 | have hpalpha : r p < alpha := by rw [hpRadius]; linarith |
| 136 | have hqalpha (n : ℕ) : r (q n) < alpha := by |
| 137 | rw [hqRadius] |
| 138 | linarith [hhA n] |
| 139 | let length : ℕ → ℝ := fun n => dist p (q n) |
| 140 | have hlengthBounds (n : ℕ) : B - h n ≤ length n ∧ length n ≤ B + h n := by |
| 141 | have hlo := (le_abs_self (r p - r (q n))).trans (htriangle p (q n)).1 |
| 142 | have hup := (htriangle p (q n)).2 |
| 143 | rw [hpRadius, hqRadius] at hlo hup |
| 144 | exact ⟨hlo, hup⟩ |
| 145 | have hlengthPos (n : ℕ) : 0 < length n := |
| 146 | (sub_pos.mpr (hhB n)).trans_le (hlengthBounds n).1 |
| 147 | have hlength : Tendsto length atTop (𝓝 B) := by |
| 148 | have hlo : Tendsto (fun n => B - h n) atTop (𝓝 B) := by |
| 149 | simpa only [sub_zero] using (tendsto_const_nhds (x := B)).sub hhzero |
| 150 | have hup : Tendsto (fun n => B + h n) atTop (𝓝 B) := by |
| 151 | simpa only [add_zero] using (tendsto_const_nhds (x := B)).add hhzero |
| 152 | exact tendsto_of_tendsto_of_tendsto_of_le_of_le hlo hup |
| 153 | (fun n => (hlengthBounds n).1) (fun n => (hlengthBounds n).2) |
| 154 | choose segment hsegment0 hsegment1 _hsegmentContinuous hsegmentLower |
| 155 | hsegmentMetric hsegmentRadius using fun n => |
| 156 | exists_intrinsic_segment_below_completion_radius_barrier T C U f hfinite |
| 157 | E alpha hbarrier hsegments p (q n) hpalpha (hqalpha n) |
| 158 | let arc : ℕ → ℝ → U := fun n t => segment n (t / length n) |
| 159 | have harc0 (n : ℕ) : arc n 0 = p := by |
| 160 | simpa only [arc, zero_div] using hsegment0 n |
| 161 | have harc1 (n : ℕ) : arc n (length n) = q n := by |
| 162 | simpa only [arc, div_self (hlengthPos n).ne'] using hsegment1 n |
| 163 | have hparameter (n : ℕ) (t : ℝ) (ht : t ∈ Icc (0 : ℝ) (length n)) : |
| 164 | t / length n ∈ Icc (0 : ℝ) 1 := |
| 165 | ⟨div_nonneg ht.1 (hlengthPos n).le, (div_le_one (hlengthPos n)).mpr ht.2⟩ |
| 166 | have harcMetric (n : ℕ) (s : ℝ) (hs : s ∈ Icc (0 : ℝ) (length n)) |
| 167 | (t : ℝ) (ht : t ∈ Icc (0 : ℝ) (length n)) : |
| 168 | dist (arc n s) (arc n t) = |s - t| := by |
| 169 | change dist (segment n (s / length n)) (segment n (t / length n)) = _ |
| 170 | rw [hsegmentMetric n _ (hparameter n s hs) _ (hparameter n t ht)] |
| 171 | change |s / length n - t / length n| * length n = |s - t| |
| 172 | rw [← sub_div, abs_div, abs_of_pos (hlengthPos n), |
| 173 | div_mul_cancel₀ _ (hlengthPos n).ne'] |
| 174 | have harcLower (n : ℕ) (t : ℝ) (_ht : t ∈ Icc (0 : ℝ) (length n)) : |
| 175 | (3 / 4 : ℝ) ≤ (C.inverse (arc n t)).2 := |
| 176 | hsegmentLower n (t / length n) |
| 177 | have harcRadius (n : ℕ) (t : ℝ) (ht : t ∈ Icc (0 : ℝ) (length n)) : |
| 178 | r (arc n t) ≤ B + h n := by |
| 179 | have hh := hsegmentRadius n (t / length n) (hparameter n t ht) |
| 180 | change r (arc n t) ≤ r p + r (q n) at hh |
| 181 | simpa only [hpRadius, hqRadius] using hh |
| 182 | have hdefect : Tendsto (fun n => dist (q n : UniformSpace.Completion U) E) |
| 183 | atTop (𝓝 0) := by |
| 184 | change Tendsto (fun n => r (q n)) atTop (𝓝 0) |
| 185 | simpa only [hqRadius] using hhzero |
| 186 | have harcLimit := selected_segment_tendsto_shortened_ray T C U hU hfinite |
| 187 | E htail hB hBb hmu hmuRadius hlengthPos hlength hdefect harc0 harc1 |
| 188 | harcMetric harcLower |
| 189 | have hfiniteComparison (n : ℕ) : |
| 190 | ∀ u ∈ Icc (0 : ℝ) (A - h n), ∀ v ∈ Icc (0 : ℝ) (length n), |
| 191 | dist (gamma (a - (h n + u))) (arc n (length n - v)) ^ 2 ≥ |
| 192 | u ^ 2 + v ^ 2 - 2 * u * v * |
| 193 | (((A - h n) ^ 2 + length n ^ 2 - dist (gamma (a - A)) p ^ 2) / |
| 194 | (2 * (A - h n) * length n)) := by |
| 195 | let left : ℝ → U := fun u => gamma (a - (h n + u)) |
| 196 | let right : ℝ → U := fun v => arc n (length n - v) |
| 197 | have hfirstPos : 0 < A - h n := sub_pos.mpr (hhA n) |
| 198 | have hleftTime (u : ℝ) (hu : u ∈ Icc (0 : ℝ) (A - h n)) : |
| 199 | a - (h n + u) ∈ Ico (0 : ℝ) a := by |
| 200 | constructor <;> linarith [hu.1, hu.2, hhpos n] |
| 201 | have hrightTime (v : ℝ) (hv : v ∈ Icc (0 : ℝ) (length n)) : |
| 202 | length n - v ∈ Icc (0 : ℝ) (length n) := by |
| 203 | constructor <;> linarith [hv.1, hv.2] |
| 204 | have hleftMetric : ∀ u ∈ Icc (0 : ℝ) (A - h n), |
| 205 | ∀ v ∈ Icc (0 : ℝ) (A - h n), dist (left u) (left v) = |u - v| := by |
| 206 | intro u hu v hv |
| 207 | change dist (gamma (a - (h n + u))) (gamma (a - (h n + v))) = _ |
| 208 | rw [hgamma _ (hleftTime u hu) _ (hleftTime v hv), |
| 209 | show a - (h n + u) - (a - (h n + v)) = -(u - v) by ring, abs_neg] |
| 210 | have hrightMetric : ∀ u ∈ Icc (0 : ℝ) (length n), |
| 211 | ∀ v ∈ Icc (0 : ℝ) (length n), dist (right u) (right v) = |u - v| := by |
| 212 | intro u hu v hv |
| 213 | change dist (arc n (length n - u)) (arc n (length n - v)) = _ |
| 214 | rw [harcMetric n _ (hrightTime u hu) _ (hrightTime v hv), |
| 215 | show length n - u - (length n - v) = -(u - v) by ring, abs_neg] |
| 216 | have hleftRadius (u : ℝ) (hu : u ∈ Icc (0 : ℝ) (A - h n)) : |
| 217 | r (left u) < alpha := by |
| 218 | dsimp [left, r] |
| 219 | rw [hgammaRadius _ (hleftTime u hu)] |
| 220 | linarith [hu.2] |
| 221 | have hrightRadius (v : ℝ) (hv : v ∈ Icc (0 : ℝ) (length n)) : |
| 222 | r (right v) < alpha := by |
| 223 | have hbnd := harcRadius n _ (hrightTime v hv) |
| 224 | change r (right v) ≤ B + h n at hbnd |
| 225 | linarith [hhB n] |
| 226 | obtain ⟨zeta, hzeta, hzetaEq, _hzetaSmooth, hzetaSpeed⟩ := |
| 227 | exists_geodesic_eq_intrinsic_metric_segment_real g U hfinite hfirstPos |
| 228 | (continuousOn_Icc_of_unit_metric hleftMetric) hleftMetric |
| 229 | obtain ⟨eta, heta, hetaEq, _hetaSmooth, hetaSpeed⟩ := |
| 230 | exists_geodesic_eq_intrinsic_metric_segment_real g U hfinite (hlengthPos n) |
| 231 | (continuousOn_Icc_of_unit_metric hrightMetric) hrightMetric |
| 232 | have hzeroLeft : (0 : ℝ) ∈ Icc (0 : ℝ) (A - h n) := ⟨le_rfl, hfirstPos.le⟩ |
| 233 | have hzeroRight : (0 : ℝ) ∈ Icc (0 : ℝ) (length n) := |
| 234 | ⟨le_rfl, (hlengthPos n).le⟩ |
| 235 | have hendLeft : A - h n ∈ Icc (0 : ℝ) (A - h n) := ⟨hfirstPos.le, le_rfl⟩ |
| 236 | have hendRight : length n ∈ Icc (0 : ℝ) (length n) := |
| 237 | ⟨(hlengthPos n).le, le_rfl⟩ |
| 238 | have hleft0 : left 0 = q n := by simp only [left, q, add_zero] |
| 239 | have hright0 : right 0 = q n := by |
| 240 | simpa only [right, sub_zero] using harc1 n |
| 241 | have hbase : zeta 0 = eta 0 := |
| 242 | (hzetaEq hzeroLeft).trans (hleft0.trans (hright0.symm.trans (hetaEq hzeroRight).symm)) |
| 243 | have hzetaDist : ∀ u ∈ Icc (0 : ℝ) (A - h n), |
| 244 | gU.edist (zeta 0) (zeta u) = ENNReal.ofReal u := by |
| 245 | intro u hu |
| 246 | rw [hedist, hzetaEq hzeroLeft, hzetaEq hu, hleftMetric 0 hzeroLeft u hu, |
| 247 | zero_sub, abs_neg, abs_of_nonneg hu.1] |
| 248 | have hetaDist : ∀ v ∈ Icc (0 : ℝ) (length n), |
| 249 | gU.edist (eta 0) (eta v) = ENNReal.ofReal v := by |
| 250 | intro v hv |
| 251 | rw [hedist, hetaEq hzeroRight, hetaEq hv, hrightMetric 0 hzeroRight v hv, |
| 252 | zero_sub, abs_neg, abs_of_nonneg hv.1] |
| 253 | have hjoin : ∀ u ∈ Icc (0 : ℝ) (A - h n), |
| 254 | ∀ v ∈ Icc (0 : ℝ) (length n), ∃ nu : ℝ → U, |
| 255 | gU.IsGeodesicOn nu (Icc 0 1) ∧ nu 0 = zeta u ∧ nu 1 = eta v ∧ |
| 256 | ∀ s ∈ Icc (0 : ℝ) 1, ∀ t ∈ Icc (0 : ℝ) 1, |
| 257 | gU.edist (nu s) (nu t) = |
| 258 | ENNReal.ofReal (|s - t| * (gU.edist (zeta u) (eta v)).toReal) := by |
| 259 | intro u hu v hv |
| 260 | have hzu : r (zeta u) < alpha := by rw [hzetaEq hu]; exact hleftRadius u hu |
| 261 | have hev : r (eta v) < alpha := by rw [hetaEq hv]; exact hrightRadius v hv |
| 262 | obtain ⟨nu, hnu0, hnu1, hnu, _hsmooth, _hlower, hmetric, _hradius⟩ := |
| 263 | exists_smooth_intrinsic_segment_below_completion_radius_barrier |
| 264 | T C U f hfinite E alpha hbarrier hsegments (zeta u) (eta v) hzu hev |
| 265 | exact ⟨nu, hnu, hnu0, hnu1, hmetric⟩ |
| 266 | intro u hu v hv |
| 267 | have hc := Comparison.corresponding_side_lower_of_cross_segments gU D hsec |
| 268 | hfirstPos (hlengthPos n) hzeta heta hzetaSpeed hetaSpeed hbase |
| 269 | hzetaDist hetaDist hjoin u hu v hv |
| 270 | rw [hedistReal, hedistReal, hzetaEq hu, hetaEq hv, |
| 271 | hzetaEq hendLeft, hetaEq hendRight] at hc |
| 272 | simpa only [left, right, show h n + (A - h n) = A by ring, |
| 273 | sub_self, harc0 n] using hc |
| 274 | intro s hs t ht |
| 275 | have hpointLimit : Tendsto (fun n => arc n (B - t)) |
| 276 | (hyperfilter ℕ : Filter ℕ) (𝓝 (mu (b - t))) := by |
| 277 | have hh := harcLimit (B - t) ⟨by linarith [ht.2], by linarith [ht.1]⟩ |
| 278 | simpa only [show b - B + (B - t) = b - t by ring] using hh |
| 279 | have hleftLimit : Tendsto (fun n => dist (gamma (a - s)) (arc n (B - t)) ^ 2) |
| 280 | (hyperfilter ℕ : Filter ℕ) (𝓝 (dist (gamma (a - s)) (mu (b - t)) ^ 2)) := |
| 281 | ((tendsto_const_nhds (x := gamma (a - s))).dist hpointLimit).pow 2 |
| 282 | have hAlimit : Tendsto (fun n => A - h n) atTop (𝓝 A) := by |
| 283 | simpa only [sub_zero] using (tendsto_const_nhds (x := A)).sub hhzero |
| 284 | have hslimit : Tendsto (fun n => s - h n) atTop (𝓝 s) := by |
| 285 | simpa only [sub_zero] using (tendsto_const_nhds (x := s)).sub hhzero |
| 286 | have htlimit : Tendsto (fun n => length n - (B - t)) atTop (𝓝 t) := by |
| 287 | have hh := hlength.sub (tendsto_const_nhds (x := B - t)) |
| 288 | simpa only [show B - (B - t) = t by ring] using hh |
| 289 | have hcoefficient : |
| 290 | Tendsto (fun n => ((A - h n) ^ 2 + length n ^ 2 - |
| 291 | dist (gamma (a - A)) p ^ 2) / (2 * (A - h n) * length n)) |
| 292 | atTop (𝓝 ((A ^ 2 + B ^ 2 - dist (gamma (a - A)) p ^ 2) / (2 * A * B))) := by |
| 293 | exact (((hAlimit.pow 2).add (hlength.pow 2)).sub tendsto_const_nhds).div |
| 294 | ((tendsto_const_nhds.mul hAlimit).mul hlength) (by positivity) |
| 295 | have hrightLimit : |
| 296 | Tendsto (fun n => (s - h n) ^ 2 + (length n - (B - t)) ^ 2 - |
| 297 | 2 * (s - h n) * (length n - (B - t)) * |
| 298 | (((A - h n) ^ 2 + length n ^ 2 - dist (gamma (a - A)) p ^ 2) / |
| 299 | (2 * (A - h n) * length n))) |
| 300 | (hyperfilter ℕ : Filter ℕ) |
| 301 | (𝓝 (s ^ 2 + t ^ 2 - 2 * s * t * |
| 302 | ((A ^ 2 + B ^ 2 - dist (gamma (a - A)) p ^ 2) / (2 * A * B)))) := |
| 303 | (((hslimit.pow 2).add (htlimit.pow 2)).sub |
| 304 | (((tendsto_const_nhds.mul hslimit).mul htlimit).mul hcoefficient)).mono_left |
| 305 | Nat.hyperfilter_le_atTop |
| 306 | have htimes : ∀ᶠ n in atTop, |
| 307 | s - h n ∈ Icc (0 : ℝ) (A - h n) ∧ |
| 308 | length n - (B - t) ∈ Icc (0 : ℝ) (length n) := by |
| 309 | filter_upwards [hhzero.eventually (gt_mem_nhds hs.1), |
| 310 | hlength.eventually (lt_mem_nhds (by linarith [ht.1] : B - t < B))] with n hn hnL |
| 311 | constructor <;> constructor <;> linarith [hs.2, ht.2] |
| 312 | have heventual : ∀ᶠ n in (hyperfilter ℕ : Filter ℕ), |
| 313 | (s - h n) ^ 2 + (length n - (B - t)) ^ 2 - |
| 314 | 2 * (s - h n) * (length n - (B - t)) * |
| 315 | (((A - h n) ^ 2 + length n ^ 2 - dist (gamma (a - A)) p ^ 2) / |
| 316 | (2 * (A - h n) * length n)) ≤ |
| 317 | dist (gamma (a - s)) (arc n (B - t)) ^ 2 := by |
| 318 | apply (htimes.mono ?_).filter_mono Nat.hyperfilter_le_atTop |
| 319 | intro n hn |
| 320 | have hc := hfiniteComparison n (s - h n) hn.1 (length n - (B - t)) hn.2 |
| 321 | simpa only [show h n + (s - h n) = s by ring, |
| 322 | show length n - (length n - (B - t)) = B - t by ring] using hc |
| 323 | exact le_of_tendsto_of_tendsto hrightLimit hleftLimit heventual |
| 324 | |
| 325 | end PoincareMT.M28 |