-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathSpecificAsymptotics.lean
More file actions
211 lines (169 loc) Β· 9.14 KB
/
SpecificAsymptotics.lean
File metadata and controls
211 lines (169 loc) Β· 9.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/-
Copyright (c) 2021 Anatole Dedecker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anatole Dedecker
-/
module
public import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent
public import Mathlib.Analysis.SpecialFunctions.Pow.Continuity
/-!
# A collection of specific asymptotic results
This file contains specific lemmas about asymptotics which don't have their place in the general
theory developed in `Mathlib/Analysis/Asymptotics/Defs.lean` and
`Mathlib/Analysis/Asymptotics/Lemmas.lean`.
-/
public section
open Filter Asymptotics
open Topology
section NormedField
/-- If `f : π β E` is bounded in a punctured neighborhood of `a`, then `f(x) = o((x - a)β»ΒΉ)` as
`x β a`, `x β a`. -/
theorem Filter.IsBoundedUnder.isLittleO_sub_self_inv {π E : Type*} [NormedField π] [Norm E] {a : π}
{f : π β E} (h : IsBoundedUnder (Β· β€ Β·) (π[β ] a) (norm β f)) :
f =o[π[β ] a] fun x => (x - a)β»ΒΉ := by
refine (h.isBigO_const (one_ne_zero' β)).trans_isLittleO (isLittleO_const_left.2 <| Or.inr ?_)
simp only [Function.comp_def, norm_inv]
exact (tendsto_norm_sub_self_nhdsNE a).inv_tendsto_nhdsGT_zero
end NormedField
section NormedRing
variable {R : Type*} [NormedRing R] [NormMulClass R] {p q : β}
open Bornology
theorem Asymptotics.isLittleO_pow_pow_cobounded_of_lt (hpq : p < q) :
(Β· ^ p) =o[cobounded R] (Β· ^ q) := by
rw [β Nat.add_sub_of_le hpq.le]
simpa [pow_add] using (isBigO_refl (fun x β¦ x ^ p) (cobounded R)).mul_isLittleO
((isLittleO_const_id_cobounded (1 : R)).pow (Nat.sub_pos_of_lt hpq))
theorem Asymptotics.isBigO_pow_pow_cobounded_of_le (hpq : p β€ q) :
(Β· ^ p) =O[cobounded R] (Β· ^ q) := by
rcases hpq.eq_or_lt with rfl | h
Β· exact isBigO_refl ..
Β· exact (isLittleO_pow_pow_cobounded_of_lt h).isBigO
end NormedRing
section LinearOrderedField
variable {π : Type*} [Field π] [LinearOrder π] [IsStrictOrderedRing π]
theorem pow_div_pow_eventuallyEq_atTop {p q : β} :
(fun x : π => x ^ p / x ^ q) =αΆ [atTop] fun x => x ^ ((p : β€) - q) := by
apply (eventually_gt_atTop (0 : π)).mono fun x hx => _
intro x hx
simp [zpow_subβ hx.ne']
theorem pow_div_pow_eventuallyEq_atBot {p q : β} :
(fun x : π => x ^ p / x ^ q) =αΆ [atBot] fun x => x ^ ((p : β€) - q) := by
apply (eventually_lt_atBot (0 : π)).mono fun x hx => _
intro x hx
simp [zpow_subβ hx.ne]
theorem tendsto_pow_div_pow_atTop_atTop {p q : β} (hpq : q < p) :
Tendsto (fun x : π => x ^ p / x ^ q) atTop atTop := by
rw [tendsto_congr' pow_div_pow_eventuallyEq_atTop]
apply tendsto_zpow_atTop_atTop
lia
theorem tendsto_pow_div_pow_atTop_zero [TopologicalSpace π] [OrderTopology π] {p q : β}
(hpq : p < q) : Tendsto (fun x : π => x ^ p / x ^ q) atTop (π 0) := by
rw [tendsto_congr' pow_div_pow_eventuallyEq_atTop]
apply tendsto_zpow_atTop_zero
lia
end LinearOrderedField
section NormedLinearOrderedField
variable {π : Type*} [NormedField π]
theorem Asymptotics.isLittleO_pow_pow_atTop_of_lt
[LinearOrder π] [IsStrictOrderedRing π] [OrderTopology π] {p q : β} (hpq : p < q) :
(fun x : π => x ^ p) =o[atTop] fun x => x ^ q := by
refine (isLittleO_iff_tendsto' ?_).mpr (tendsto_pow_div_pow_atTop_zero hpq)
exact (eventually_gt_atTop 0).mono fun x hx hxq => (pow_ne_zero q hx.ne' hxq).elim
theorem Asymptotics.IsBigO.trans_tendsto_norm_atTop {Ξ± : Type*} {u v : Ξ± β π} {l : Filter Ξ±}
(huv : u =O[l] v) (hu : Tendsto (fun x => βu xβ) l atTop) :
Tendsto (fun x => βv xβ) l atTop := by
rcases huv.exists_pos with β¨c, hc, hcuvβ©
rw [IsBigOWith] at hcuv
convert Tendsto.atTop_div_const hc (tendsto_atTop_mono' l hcuv hu)
rw [mul_div_cancel_leftβ _ hc.ne.symm]
end NormedLinearOrderedField
section Real
theorem Asymptotics.IsEquivalent.rpow {Ξ± : Type*} {u v : Ξ± β β} {l : Filter Ξ±}
(hv : 0 β€ v) (h : u ~[l] v) {r : β} :
u ^ r ~[l] v ^ r := by
obtain β¨Ο, hΟ, huΟvβ© := IsEquivalent.exists_eq_mul h
rw [isEquivalent_iff_exists_eq_mul]
have hΟr : Tendsto ((fun x β¦ x ^ r) β Ο) l (π 1) := by
rw [β Real.one_rpow r]
exact Tendsto.comp (Real.continuousAt_rpow_const _ _ (by left; norm_num)) hΟ
use (Β· ^ r) β Ο, hΟr
conv => enter [3]; change fun x β¦ Ο x ^ r * v x ^ r
filter_upwards [Tendsto.eventually_const_lt (zero_lt_one) hΟ, huΟv] with x hΟ_pos huv'
simp [β Real.mul_rpow (le_of_lt hΟ_pos) (hv x), huv']
theorem Asymptotics.IsEquivalent.log {Ξ± : Type*} {l : Filter Ξ±} {f g : Ξ± β β} (hfg : f ~[l] g)
(g_tendsto : Tendsto g l atTop) :
(fun n β¦ Real.log (f n)) ~[l] (fun n β¦ Real.log (g n)) := by
have hg := g_tendsto.eventually_ne_atTop 0
have hf := hfg.symm.tendsto_atTop g_tendsto |>.eventually_ne_atTop 0
rw [isEquivalent_iff_tendsto_one hg] at hfg
have := hfg.log (by norm_num) |>.congr' <| by
filter_upwards [hf, hg] with n hf hg using Real.log_div hf hg
exact IsLittleO.isEquivalent <| calc
(fun n β¦ Real.log (f n) - Real.log (g n)) =o[l] fun _ β¦ (1 : β) := by simpa
_ =o[l] fun n β¦ Real.log (g n) := isLittleO_one_left_iff β |>.mpr <|
tendsto_norm_atTop_atTop.comp <| Real.tendsto_log_atTop.comp g_tendsto
open Finset
theorem Asymptotics.IsLittleO.sum_range {Ξ± : Type*} [NormedAddCommGroup Ξ±] {f : β β Ξ±} {g : β β β}
(h : f =o[atTop] g) (hg : 0 β€ g) (h'g : Tendsto (fun n => β i β range n, g i) atTop atTop) :
(fun n => β i β range n, f i) =o[atTop] fun n => β i β range n, g i := by
have A : β i, βg iβ = g i := fun i => Real.norm_of_nonneg (hg i)
have B : β n, ββ i β range n, g iβ = β i β range n, g i := fun n => by
rwa [Real.norm_eq_abs, abs_sum_of_nonneg']
apply isLittleO_iff.2 fun Ξ΅ Ξ΅pos => _
intro Ξ΅ Ξ΅pos
obtain β¨N, hNβ© : β N : β, β b : β, N β€ b β βf bβ β€ Ξ΅ / 2 * g b := by
simpa only [A, eventually_atTop] using isLittleO_iff.mp h (half_pos Ξ΅pos)
have : (fun _ : β => β i β range N, f i) =o[atTop] fun n : β => β i β range n, g i := by
apply isLittleO_const_left.2
exact Or.inr (h'g.congr fun n => (B n).symm)
filter_upwards [isLittleO_iff.1 this (half_pos Ξ΅pos), Ici_mem_atTop N] with n hn Nn
calc
ββ i β range n, f iβ = β(β i β range N, f i) + β i β Ico N n, f iβ := by
rw [sum_range_add_sum_Ico _ Nn]
_ β€ ββ i β range N, f iβ + ββ i β Ico N n, f iβ := norm_add_le _ _
_ β€ ββ i β range N, f iβ + β i β Ico N n, Ξ΅ / 2 * g i :=
(add_le_add le_rfl (norm_sum_le_of_le _ fun i hi => hN _ (mem_Ico.1 hi).1))
_ β€ ββ i β range N, f iβ + β i β range n, Ξ΅ / 2 * g i := by
gcongr
Β· exact fun i _ _ β¦ mul_nonneg (half_pos Ξ΅pos).le (hg i)
Β· rw [range_eq_Ico]
exact Ico_subset_Ico (zero_le _) le_rfl
_ β€ Ξ΅ / 2 * ββ i β range n, g iβ + Ξ΅ / 2 * β i β range n, g i := by rw [β mul_sum]; gcongr
_ = Ξ΅ * ββ i β range n, g iβ := by
simp only [B]
ring
theorem Asymptotics.isLittleO_sum_range_of_tendsto_zero {Ξ± : Type*} [NormedAddCommGroup Ξ±]
{f : β β Ξ±} (h : Tendsto f atTop (π 0)) :
(fun n => β i β range n, f i) =o[atTop] fun n => (n : β) := by
have := ((isLittleO_one_iff β).2 h).sum_range fun i => zero_le_one
simp only [sum_const, card_range, Nat.smul_one_eq_cast] at this
exact this tendsto_natCast_atTop_atTop
/-- The Cesaro average of a converging sequence converges to the same limit. -/
theorem Filter.Tendsto.cesaro_smul {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] {u : β β E}
{l : E} (h : Tendsto u atTop (π l)) :
Tendsto (fun n : β => (nβ»ΒΉ : β) β’ β i β range n, u i) atTop (π l) := by
rw [β tendsto_sub_nhds_zero_iff, β isLittleO_one_iff β]
have := Asymptotics.isLittleO_sum_range_of_tendsto_zero (tendsto_sub_nhds_zero_iff.2 h)
apply ((isBigO_refl (fun n : β => (n : β)β»ΒΉ) atTop).smul_isLittleO this).congr' _ _
Β· filter_upwards [Ici_mem_atTop 1] with n npos
have nposβ : (0 : β) < n := Nat.cast_pos.2 npos
simp only [smul_sub, sum_sub_distrib, sum_const, card_range, sub_right_inj]
rw [β Nat.cast_smul_eq_nsmul β, smul_smul, inv_mul_cancelβ nposβ.ne', one_smul]
Β· filter_upwards [Ici_mem_atTop 1] with n npos
have nposβ : (0 : β) < n := Nat.cast_pos.2 npos
rw [smul_eq_mul, inv_mul_cancelβ nposβ.ne']
/-- The Cesaro average of a converging sequence converges to the same limit. -/
theorem Filter.Tendsto.cesaro {u : β β β} {l : β} (h : Tendsto u atTop (π l)) :
Tendsto (fun n : β => (nβ»ΒΉ : β) * β i β range n, u i) atTop (π l) :=
h.cesaro_smul
end Real
section NormedLinearOrderedField
variable {R : Type*} [NormedField R] [LinearOrder R] [IsStrictOrderedRing R]
[OrderTopology R] [FloorRing R]
theorem Asymptotics.isEquivalent_nat_floor :
(fun (x : R) β¦ ββxββ) ~[atTop] (fun x β¦ x) :=
isEquivalent_of_tendsto_one tendsto_nat_floor_div_atTop
theorem Asymptotics.isEquivalent_nat_ceil :
(fun (x : R) β¦ ββxββ) ~[atTop] (fun x β¦ x) :=
isEquivalent_of_tendsto_one tendsto_nat_ceil_div_atTop
end NormedLinearOrderedField