# mathlib3documentation

analysis.specific_limits.basic

# A collection of specific limit computations #

THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.

This file, by design, is independent of normed_space in the import hierarchy. It contains important specific limit computations in metric spaces, in ordered rings/fields, and in specific instances of these such as ℝ, ℝ≥0 and ℝ≥0∞.

theorem tendsto_coe_nat_div_add_at_top {𝕜 : Type u_1} [char_zero 𝕜] [ 𝕜] (x : 𝕜) :
filter.tendsto (λ (n : ), n / (n + x)) filter.at_top (nhds 1)

The limit of n / (n + x) is 1, for any constant x (valid in ℝ or any topological division algebra over ℝ, e.g., ℂ).

TODO: introduce a typeclass saying that 1 / n tends to 0 at top, making it possible to get this statement simultaneously on ℚ, ℝ and ℂ.

### Powers #

theorem tendsto_add_one_pow_at_top_at_top_of_pos {α : Type u_1} [archimedean α] {r : α} (h : 0 < r) :
theorem tendsto_pow_at_top_at_top_of_one_lt {α : Type u_1} [archimedean α] {r : α} (h : 1 < r) :
theorem tendsto_pow_at_top_nhds_0_of_lt_1 {𝕜 : Type u_1} [archimedean 𝕜] {r : 𝕜} (h₁ : 0 r) (h₂ : r < 1) :
filter.tendsto (λ (n : ), r ^ n) filter.at_top (nhds 0)
theorem tendsto_pow_at_top_nhds_within_0_of_lt_1 {𝕜 : Type u_1} [archimedean 𝕜] {r : 𝕜} (h₁ : 0 < r) (h₂ : r < 1) :
theorem uniformity_basis_dist_pow_of_lt_1 {α : Type u_1} {r : } (h₀ : 0 < r) (h₁ : r < 1) :
(uniformity α).has_basis (λ (k : ), true) (λ (k : ), {p : α × α | p.snd < r ^ k})
theorem geom_lt {u : } {c : } (hc : 0 c) {n : } (hn : 0 < n) (h : (k : ), k < n c * u k < u (k + 1)) :
c ^ n * u 0 < u n
theorem geom_le {u : } {c : } (hc : 0 c) (n : ) (h : (k : ), k < n c * u k u (k + 1)) :
c ^ n * u 0 u n
theorem lt_geom {u : } {c : } (hc : 0 c) {n : } (hn : 0 < n) (h : (k : ), k < n u (k + 1) < c * u k) :
u n < c ^ n * u 0
theorem le_geom {u : } {c : } (hc : 0 c) (n : ) (h : (k : ), k < n u (k + 1) c * u k) :
u n c ^ n * u 0
theorem tendsto_at_top_of_geom_le {v : } {c : } (h₀ : 0 < v 0) (hc : 1 < c) (hu : (n : ), c * v n v (n + 1)) :

If a sequence v of real numbers satisfies k * v n ≤ v (n+1) with 1 < k, then it goes to +∞.

### Geometric series #

theorem has_sum_geometric_of_lt_1 {r : } (h₁ : 0 r) (h₂ : r < 1) :
has_sum (λ (n : ), r ^ n) (1 - r)⁻¹
theorem summable_geometric_of_lt_1 {r : } (h₁ : 0 r) (h₂ : r < 1) :
summable (λ (n : ), r ^ n)
theorem tsum_geometric_of_lt_1 {r : } (h₁ : 0 r) (h₂ : r < 1) :
∑' (n : ), r ^ n = (1 - r)⁻¹
theorem has_sum_geometric_two  :
has_sum (λ (n : ), (1 / 2) ^ n) 2
theorem summable_geometric_two  :
summable (λ (n : ), (1 / 2) ^ n)
theorem summable_geometric_two_encode {ι : Type u_1} [encodable ι] :
summable (λ (i : ι), (1 / 2) ^
theorem tsum_geometric_two  :
∑' (n : ), (1 / 2) ^ n = 2
theorem sum_geometric_two_le (n : ) :
(finset.range n).sum (λ (i : ), (1 / 2) ^ i) 2
theorem tsum_geometric_inv_two  :
∑' (n : ), 2⁻¹ ^ n = 2
theorem tsum_geometric_inv_two_ge (n : ) :
∑' (i : ), ite (n i) (2⁻¹ ^ i) 0 = 2 * 2⁻¹ ^ n

The sum of 2⁻¹ ^ i for n ≤ i equals 2 * 2⁻¹ ^ n.

theorem has_sum_geometric_two' (a : ) :
has_sum (λ (n : ), a / 2 / 2 ^ n) a
theorem summable_geometric_two' (a : ) :
summable (λ (n : ), a / 2 / 2 ^ n)
theorem tsum_geometric_two' (a : ) :
∑' (n : ), a / 2 / 2 ^ n = a
theorem nnreal.has_sum_geometric {r : nnreal} (hr : r < 1) :
has_sum (λ (n : ), r ^ n) (1 - r)⁻¹

Sum of a Geometric Series

theorem nnreal.summable_geometric {r : nnreal} (hr : r < 1) :
summable (λ (n : ), r ^ n)
theorem tsum_geometric_nnreal {r : nnreal} (hr : r < 1) :
∑' (n : ), r ^ n = (1 - r)⁻¹
@[simp]
theorem ennreal.tsum_geometric (r : ennreal) :
∑' (n : ), r ^ n = (1 - r)⁻¹

The series pow r converges to (1-r)⁻¹. For r < 1 the RHS is a finite number, and for 1 ≤ r the RHS equals ∞.

### Sequences with geometrically decaying distance in metric spaces #

In this paragraph, we discuss sequences in metric spaces or emetric spaces for which the distance between two consecutive terms decays geometrically. We show that such sequences are Cauchy sequences, and bound their distances to the limit. We also discuss series with geometrically decaying terms.

theorem cauchy_seq_of_edist_le_geometric {α : Type u_1} (r C : ennreal) (hr : r < 1) (hC : C ) {f : α} (hu : (n : ), has_edist.edist (f n) (f (n + 1)) C * r ^ n) :

If edist (f n) (f (n+1)) is bounded by C * r^n, C ≠ ∞, r < 1, then f is a Cauchy sequence.

theorem edist_le_of_edist_le_geometric_of_tendsto {α : Type u_1} (r C : ennreal) {f : α} (hu : (n : ), has_edist.edist (f n) (f (n + 1)) C * r ^ n) {a : α} (ha : (nhds a)) (n : ) :
has_edist.edist (f n) a C * r ^ n / (1 - r)

If edist (f n) (f (n+1)) is bounded by C * r^n, then the distance from f n to the limit of f is bounded above by C * r^n / (1 - r).

theorem edist_le_of_edist_le_geometric_of_tendsto₀ {α : Type u_1} (r C : ennreal) {f : α} (hu : (n : ), has_edist.edist (f n) (f (n + 1)) C * r ^ n) {a : α} (ha : (nhds a)) :
has_edist.edist (f 0) a C / (1 - r)

If edist (f n) (f (n+1)) is bounded by C * r^n, then the distance from f 0 to the limit of f is bounded above by C / (1 - r).

theorem cauchy_seq_of_edist_le_geometric_two {α : Type u_1} (C : ennreal) (hC : C ) {f : α} (hu : (n : ), has_edist.edist (f n) (f (n + 1)) C / 2 ^ n) :

If edist (f n) (f (n+1)) is bounded by C * 2^-n, then f is a Cauchy sequence.

theorem edist_le_of_edist_le_geometric_two_of_tendsto {α : Type u_1} (C : ennreal) {f : α} (hu : (n : ), has_edist.edist (f n) (f (n + 1)) C / 2 ^ n) {a : α} (ha : (nhds a)) (n : ) :
has_edist.edist (f n) a 2 * C / 2 ^ n

If edist (f n) (f (n+1)) is bounded by C * 2^-n, then the distance from f n to the limit of f is bounded above by 2 * C * 2^-n.

theorem edist_le_of_edist_le_geometric_two_of_tendsto₀ {α : Type u_1} (C : ennreal) {f : α} (hu : (n : ), has_edist.edist (f n) (f (n + 1)) C / 2 ^ n) {a : α} (ha : (nhds a)) :
has_edist.edist (f 0) a 2 * C

If edist (f n) (f (n+1)) is bounded by C * 2^-n, then the distance from f 0 to the limit of f is bounded above by 2 * C.

theorem aux_has_sum_of_le_geometric {α : Type u_1} {r C : } (hr : r < 1) {f : α} (hu : (n : ), has_dist.dist (f n) (f (n + 1)) C * r ^ n) :
has_sum (λ (n : ), C * r ^ n) (C / (1 - r))
theorem cauchy_seq_of_le_geometric {α : Type u_1} (r C : ) (hr : r < 1) {f : α} (hu : (n : ), has_dist.dist (f n) (f (n + 1)) C * r ^ n) :

If dist (f n) (f (n+1)) is bounded by C * r^n, r < 1, then f is a Cauchy sequence. Note that this lemma does not assume 0 ≤ C or 0 ≤ r.

theorem dist_le_of_le_geometric_of_tendsto₀ {α : Type u_1} (r C : ) (hr : r < 1) {f : α} (hu : (n : ), has_dist.dist (f n) (f (n + 1)) C * r ^ n) {a : α} (ha : (nhds a)) :
has_dist.dist (f 0) a C / (1 - r)

If dist (f n) (f (n+1)) is bounded by C * r^n, r < 1, then the distance from f n to the limit of f is bounded above by C * r^n / (1 - r).

theorem dist_le_of_le_geometric_of_tendsto {α : Type u_1} (r C : ) (hr : r < 1) {f : α} (hu : (n : ), has_dist.dist (f n) (f (n + 1)) C * r ^ n) {a : α} (ha : (nhds a)) (n : ) :
has_dist.dist (f n) a C * r ^ n / (1 - r)

If dist (f n) (f (n+1)) is bounded by C * r^n, r < 1, then the distance from f 0 to the limit of f is bounded above by C / (1 - r).

theorem cauchy_seq_of_le_geometric_two {α : Type u_1} (C : ) {f : α} (hu₂ : (n : ), has_dist.dist (f n) (f (n + 1)) C / 2 / 2 ^ n) :

If dist (f n) (f (n+1)) is bounded by (C / 2) / 2^n, then f is a Cauchy sequence.

theorem dist_le_of_le_geometric_two_of_tendsto₀ {α : Type u_1} (C : ) {f : α} (hu₂ : (n : ), has_dist.dist (f n) (f (n + 1)) C / 2 / 2 ^ n) {a : α} (ha : (nhds a)) :
has_dist.dist (f 0) a C

If dist (f n) (f (n+1)) is bounded by (C / 2) / 2^n, then the distance from f 0 to the limit of f is bounded above by C.

theorem dist_le_of_le_geometric_two_of_tendsto {α : Type u_1} (C : ) {f : α} (hu₂ : (n : ), has_dist.dist (f n) (f (n + 1)) C / 2 / 2 ^ n) {a : α} (ha : (nhds a)) (n : ) :
has_dist.dist (f n) a C / 2 ^ n

If dist (f n) (f (n+1)) is bounded by (C / 2) / 2^n, then the distance from f n to the limit of f is bounded above by C / 2^n.

### Summability tests based on comparison with geometric series #

theorem summable_one_div_pow_of_le {m : } {f : } (hm : 1 < m) (fi : (i : ), i f i) :
summable (λ (i : ), 1 / m ^ f i)

A series whose terms are bounded by the terms of a converging geometric series converges.

### Positive sequences with small sums on countable types #

noncomputable def pos_sum_of_encodable {ε : } (hε : 0 < ε) (ι : Type u_1) [encodable ι] :
{ε' // ( (i : ι), 0 < ε' i) (c : ), has_sum ε' c c ε}

For any positive ε, define on an encodable type a positive sequence with sum less than ε

Equations
• = let f : := λ (n : ), ε / 2 / 2 ^ n in , _⟩
theorem set.countable.exists_pos_has_sum_le {ι : Type u_1} {s : set ι} (hs : s.countable) {ε : } (hε : 0 < ε) :
(ε' : ι ), ( (i : ι), 0 < ε' i) (c : ), has_sum (λ (i : s), ε' i) c c ε
theorem set.countable.exists_pos_forall_sum_le {ι : Type u_1} {s : set ι} (hs : s.countable) {ε : } (hε : 0 < ε) :
(ε' : ι ), ( (i : ι), 0 < ε' i) (t : finset ι), t s t.sum (λ (i : ι), ε' i) ε
theorem nnreal.exists_pos_sum_of_countable {ε : nnreal} (hε : ε 0) (ι : Type u_1) [countable ι] :
(ε' : ι nnreal), ( (i : ι), 0 < ε' i) (c : nnreal), has_sum ε' c c < ε
theorem ennreal.exists_pos_sum_of_countable {ε : ennreal} (hε : ε 0) (ι : Type u_1) [countable ι] :
(ε' : ι nnreal), ( (i : ι), 0 < ε' i) ∑' (i : ι), (ε' i) < ε
theorem ennreal.exists_pos_sum_of_countable' {ε : ennreal} (hε : ε 0) (ι : Type u_1) [countable ι] :
(ε' : ι ennreal), ( (i : ι), 0 < ε' i) ∑' (i : ι), ε' i < ε
theorem ennreal.exists_pos_tsum_mul_lt_of_countable {ε : ennreal} (hε : ε 0) {ι : Type u_1} [countable ι] (w : ι ennreal) (hw : (i : ι), w i ) :
(δ : ι nnreal), ( (i : ι), 0 < δ i) ∑' (i : ι), w i * (δ i) < ε

### Ceil and floor #

theorem tendsto_nat_floor_mul_div_at_top {R : Type u_4} [floor_ring R] {a : R} (ha : 0 a) :
theorem tendsto_nat_ceil_mul_div_at_top {R : Type u_4} [floor_ring R] {a : R} (ha : 0 a) :