Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit c488997

Browse files
committed
feat(analysis/special_functions/polynomial): polynomials are big O of polynomials of higher degree (#6714)
1 parent 05c491c commit c488997

File tree

6 files changed

+98
-1
lines changed

6 files changed

+98
-1
lines changed

src/analysis/asymptotics/asymptotics.lean

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,39 @@ end exists_mul_eq
12471247

12481248
/-! ### Miscellanous lemmas -/
12491249

1250+
theorem div_is_bounded_under_of_is_O {α : Type*} {l : filter α}
1251+
{f g : α → 𝕜} (h : is_O f g l) :
1252+
is_bounded_under (≤) l (λ x, ∥f x / g x∥) :=
1253+
begin
1254+
obtain ⟨c, hc⟩ := is_O_iff.mp h,
1255+
refine ⟨max c 0, eventually_map.2 (filter.mem_sets_of_superset hc (λ x hx, _))⟩,
1256+
simp only [mem_set_of_eq, normed_field.norm_div] at ⊢ hx,
1257+
by_cases hgx : g x = 0,
1258+
{ rw [hgx, norm_zero, div_zero, le_max_iff],
1259+
exact or.inr le_rfl },
1260+
{ exact le_max_iff.2 (or.inl ((div_le_iff (norm_pos_iff.2 hgx)).2 hx)) }
1261+
end
1262+
1263+
theorem is_O_iff_div_is_bounded_under {α : Type*} {l : filter α}
1264+
{f g : α → 𝕜} (hgf : ∀ᶠ x in l, g x = 0 → f x = 0) :
1265+
is_O f g l ↔ is_bounded_under (≤) l (λ x, ∥f x / g x∥) :=
1266+
begin
1267+
refine ⟨div_is_bounded_under_of_is_O, λ h, _⟩,
1268+
obtain ⟨c, hc⟩ := h,
1269+
rw filter.eventually_iff at hgf hc,
1270+
simp only [mem_set_of_eq, mem_map, normed_field.norm_div] at hc,
1271+
refine is_O_iff.2 ⟨c, filter.eventually_of_mem (inter_mem_sets hgf hc) (λ x hx, _)⟩,
1272+
by_cases hgx : g x = 0,
1273+
{ simp [hx.1 hgx, hgx] },
1274+
{ refine (div_le_iff (norm_pos_iff.2 hgx)).mp hx.2 },
1275+
end
1276+
1277+
theorem is_O_of_div_tendsto_nhds {α : Type*} {l : filter α}
1278+
{f g : α → 𝕜} (hgf : ∀ᶠ x in l, g x = 0 → f x = 0)
1279+
(c : 𝕜) (H : filter.tendsto (f / g) l (𝓝 c)) :
1280+
is_O f g l :=
1281+
(is_O_iff_div_is_bounded_under hgf).2 $ is_bounded_under_of_tendsto H
1282+
12501283
lemma is_o.tendsto_zero_of_tendsto {α E 𝕜 : Type*} [normed_group E] [normed_field 𝕜] {u : α → E}
12511284
{v : α → 𝕜} {l : filter α} {y : 𝕜} (huv : is_o u v l) (hv : tendsto v l (𝓝 y)) :
12521285
tendsto u l (𝓝 0) :=

src/analysis/normed_space/basic.lean

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,21 @@ calc
226226
... ≤ ∥g∥ + ∥h - g∥ : norm_add_le _ _
227227
... ≤ ∥g∥ + r : by { apply add_le_add_left, rw ← dist_eq_norm, exact H }
228228

229+
lemma norm_le_norm_add_const_of_dist_le {a b : α} {c : ℝ} (h : dist a b ≤ c) :
230+
∥a∥ ≤ ∥b∥ + c :=
231+
norm_le_of_mem_closed_ball h
232+
229233
lemma norm_lt_of_mem_ball {g h : α} {r : ℝ} (H : h ∈ ball g r) :
230234
∥h∥ < ∥g∥ + r :=
231235
calc
232236
∥h∥ = ∥g + (h - g)∥ : by rw [add_sub_cancel'_right]
233237
... ≤ ∥g∥ + ∥h - g∥ : norm_add_le _ _
234238
... < ∥g∥ + r : by { apply add_lt_add_left, rw ← dist_eq_norm, exact H }
235239

240+
lemma norm_lt_norm_add_const_of_dist_lt {a b : α} {c : ℝ} (h : dist a b < c) :
241+
∥a∥ < ∥b∥ + c :=
242+
norm_lt_of_mem_ball h
243+
236244
@[simp] lemma mem_sphere_iff_norm (v w : α) (r : ℝ) : w ∈ sphere v r ↔ ∥w - v∥ = r :=
237245
by simp [dist_eq_norm]
238246

@@ -469,6 +477,12 @@ lemma tendsto_iff_norm_tendsto_zero {f : ι → β} {a : filter ι} {b : β} :
469477
tendsto f a (𝓝 b) ↔ tendsto (λ e, ∥f e - b∥) a (𝓝 0) :=
470478
by { convert tendsto_iff_dist_tendsto_zero, simp [dist_eq_norm] }
471479

480+
lemma is_bounded_under_of_tendsto {l : filter ι} {f : ι → α} {c : α}
481+
(h : filter.tendsto f l (𝓝 c)) : is_bounded_under (≤) l (λ x, ∥f x∥) :=
482+
⟨∥c∥ + 1, @tendsto.eventually ι α f _ _ (λ k, ∥k∥ ≤ ∥c∥ + 1) h (filter.eventually_iff_exists_mem.mpr
483+
⟨metric.closed_ball c 1, metric.closed_ball_mem_nhds c zero_lt_one,
484+
λ y hy, norm_le_norm_add_const_of_dist_le hy⟩)⟩
485+
472486
lemma tendsto_zero_iff_norm_tendsto_zero {f : γ → β} {a : filter γ} :
473487
tendsto f a (𝓝 0) ↔ tendsto (λ e, ∥f e∥) a (𝓝 0) :=
474488
by { rw [tendsto_iff_norm_tendsto_zero], simp only [sub_zero] }

src/analysis/special_functions/polynomials.lean

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,16 @@ open_locale asymptotics topological_space
2525

2626
namespace polynomial
2727

28-
variables {𝕜 : Type*} [normed_linear_ordered_field 𝕜] [order_topology 𝕜] (P Q : polynomial 𝕜)
28+
variables {𝕜 : Type*} [normed_linear_ordered_field 𝕜] (P Q : polynomial 𝕜)
29+
30+
lemma eventually_no_roots (hP : P ≠ 0) : ∀ᶠ x in filter.at_top, ¬ P.is_root x :=
31+
begin
32+
obtain ⟨x₀, hx₀⟩ := polynomial.exists_max_root P hP,
33+
refine filter.eventually_at_top.mpr (⟨x₀ + 1, λ x hx h, _⟩),
34+
exact absurd (hx₀ x h) (not_le.mpr (lt_of_lt_of_le (lt_add_one x₀) hx)),
35+
end
36+
37+
variables [order_topology 𝕜]
2938

3039
lemma is_equivalent_at_top_lead :
3140
(λ x, eval x P) ~[at_top] (λ x, P.leading_coeff * x ^ P.nat_degree) :=
@@ -147,4 +156,17 @@ begin
147156
exact tendsto_abs_at_bot_at_top.comp (P.div_tendsto_at_bot_of_degree_gt Q hdeg hQ h.le) }
148157
end
149158

159+
theorem is_O_of_degree_le (h : P.degree ≤ Q.degree) :
160+
is_O (λ x, eval x P) (λ x, eval x Q) filter.at_top :=
161+
begin
162+
by_cases hp : P = 0,
163+
{ simpa [hp] using is_O_zero (λ x, eval x Q) filter.at_top },
164+
{ have hq : Q ≠ 0 := ne_zero_of_degree_ge_degree h hp,
165+
have hPQ : ∀ᶠ (x : 𝕜) in at_top, eval x Q = 0 → eval x P = 0 :=
166+
filter.mem_sets_of_superset (polynomial.eventually_no_roots Q hq) (λ x h h', absurd h' h),
167+
cases le_iff_lt_or_eq.mp h with h h,
168+
{ exact is_O_of_div_tendsto_nhds hPQ 0 (div_tendsto_zero_of_degree_lt P Q h) },
169+
{ exact is_O_of_div_tendsto_nhds hPQ _ (div_tendsto_leading_coeff_div_of_degree_eq P Q h) } }
170+
end
171+
150172
end polynomial

src/data/polynomial/degree/definitions.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,10 @@ coeff_eq_zero_of_degree_lt (lt_of_lt_of_le h degree_le_nat_degree)
391391
lemma ne_zero_of_degree_gt {n : with_bot ℕ} (h : n < degree p) : p ≠ 0 :=
392392
mt degree_eq_bot.2 (ne.symm (ne_of_lt (lt_of_le_of_lt bot_le h)))
393393

394+
lemma ne_zero_of_degree_ge_degree (hpq : p.degree ≤ q.degree) (hp : p ≠ 0) : q ≠ 0 :=
395+
polynomial.ne_zero_of_degree_gt (lt_of_lt_of_le (bot_lt_iff_ne_bot.mpr
396+
(by rwa [ne.def, polynomial.degree_eq_bot])) hpq : q.degree > ⊥)
397+
394398
lemma ne_zero_of_nat_degree_gt {n : ℕ} (h : n < nat_degree p) : p ≠ 0 :=
395399
λ H, by simpa [H, nat.not_lt_zero] using h
396400

src/data/polynomial/ring_division.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,14 @@ begin
324324
simp only [mem_roots hp, multiset.mem_to_finset, set.mem_set_of_eq, finset.mem_coe]
325325
end
326326

327+
lemma exists_max_root [linear_order R] (p : polynomial R) (hp : p ≠ 0) :
328+
∃ x₀, ∀ x, p.is_root x → x ≤ x₀ :=
329+
set.exists_upper_bound_image _ _ $ not_not.mp (mt (eq_zero_of_infinite_is_root p) hp)
330+
331+
lemma exists_min_root [linear_order R] (p : polynomial R) (hp : p ≠ 0) :
332+
∃ x₀, ∀ x, p.is_root x → x₀ ≤ x :=
333+
set.exists_lower_bound_image _ _ $ not_not.mp (mt (eq_zero_of_infinite_is_root p) hp)
334+
327335
lemma eq_of_infinite_eval_eq {R : Type*} [integral_domain R]
328336
(p q : polynomial R) (h : set.infinite {x | eval x p = eval x q}) : p = q :=
329337
begin

src/data/set/finite.lean

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,22 @@ lemma exists_max_image [linear_order β] (s : set α) (f : α → β) (h1 : fini
474474
| ⟨x, hx⟩ := by simpa only [exists_prop, finite.mem_to_finset]
475475
using h1.to_finset.exists_max_image f ⟨x, h1.mem_to_finset.2 hx⟩
476476

477+
theorem exists_lower_bound_image [hα : nonempty α] [linear_order β] (s : set α) (f : α → β)
478+
(h : s.finite) : ∃ (a : α), ∀ b ∈ s, f a ≤ f b :=
479+
begin
480+
by_cases hs : set.nonempty s,
481+
{ exact let ⟨x₀, H, hx₀⟩ := set.exists_min_image s f h hs in ⟨x₀, λ x hx, hx₀ x hx⟩ },
482+
{ exact nonempty.elim hα (λ a, ⟨a, λ x hx, absurd (set.nonempty_of_mem hx) hs⟩) }
483+
end
484+
485+
theorem exists_upper_bound_image [hα : nonempty α] [linear_order β] (s : set α) (f : α → β)
486+
(h : s.finite) : ∃ (a : α), ∀ b ∈ s, f b ≤ f a :=
487+
begin
488+
by_cases hs : set.nonempty s,
489+
{ exact let ⟨x₀, H, hx₀⟩ := set.exists_max_image s f h hs in ⟨x₀, λ x hx, hx₀ x hx⟩ },
490+
{ exact nonempty.elim hα (λ a, ⟨a, λ x hx, absurd (set.nonempty_of_mem hx) hs⟩) }
491+
end
492+
477493
end set
478494

479495
namespace finset

0 commit comments

Comments
 (0)