Skip to content

Commit

Permalink
feat: characterizations of IsBigO along atTop (#6198)
Browse files Browse the repository at this point in the history
This PR adds a way to characterize `IsBigO` along the `atTop` filter, for cases where we want the constant to depend on a "starting point" `n₀`.

It also adds the lemma `tendsto_nhds_of_eventually_eq`.
  • Loading branch information
dupuisf committed Aug 5, 2023
1 parent 675f2fd commit 944ee07
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Mathlib/Analysis/Asymptotics/Asymptotics.lean
Expand Up @@ -2197,6 +2197,15 @@ theorem IsLittleO.nat_cast_atTop {R : Type _} [StrictOrderedSemiring R] [Archime
(fun (n:ℕ) => f n) =o[atTop] (fun n => g n) :=
IsLittleO.comp_tendsto h tendsto_nat_cast_atTop_atTop

theorem isBigO_atTop_iff_eventually_exists {α : Type _} [SemilatticeSup α] [Nonempty α]
{f : α → E} {g : α → F} : f =O[atTop] g ↔ ∀ᶠ n₀ in atTop, ∃ c, ∀ n ≥ n₀, ‖f n‖ ≤ c * ‖g n‖ := by
rw [isBigO_iff, exists_eventually_atTop]

theorem isBigO_atTop_iff_eventually_exists_pos {α : Type _}
[SemilatticeSup α] [Nonempty α] {f : α → G} {g : α → G'} :
f =O[atTop] g ↔ ∀ᶠ n₀ in atTop, ∃ c > 0, ∀ n ≥ n₀, c * ‖f n‖ ≤ ‖g n‖ := by
simp_rw [isBigO_iff'', ← exists_prop, Subtype.exists', exists_eventually_atTop]

end Asymptotics

open Asymptotics
Expand Down
16 changes: 16 additions & 0 deletions Mathlib/Order/BoundedOrder.lean
Expand Up @@ -590,6 +590,22 @@ theorem Antitone.ball {P : β → α → Prop} {s : Set β} (hP : ∀ x ∈ s, A
Antitone fun y => ∀ x ∈ s, P x y := fun _ _ hy h x hx => hP x hx hy (h x hx)
#align antitone.ball Antitone.ball

theorem Monotone.exists {P : β → α → Prop} (hP : ∀ x, Monotone (P x)) :
Monotone fun y => ∃ x, P x y :=
fun _ _ hy ⟨x, hx⟩ ↦ ⟨x, hP x hy hx⟩

theorem Antitone.exists {P : β → α → Prop} (hP : ∀ x, Antitone (P x)) :
Antitone fun y => ∃ x, P x y :=
fun _ _ hy ⟨x, hx⟩ ↦ ⟨x, hP x hy hx⟩

theorem forall_ge_iff {P : α → Prop} {x₀ : α} (hP : Monotone P) :
(∀ x ≥ x₀, P x) ↔ P x₀ :=
fun H ↦ H x₀ le_rfl, fun H _ hx ↦ hP hx H⟩

theorem forall_le_iff {P : α → Prop} {x₀ : α} (hP : Antitone P) :
(∀ x ≤ x₀, P x) ↔ P x₀ :=
fun H ↦ H x₀ le_rfl, fun H _ hx ↦ hP hx H⟩

end Preorder

section SemilatticeSup
Expand Down
12 changes: 12 additions & 0 deletions Mathlib/Order/Filter/AtTopBot.lean
Expand Up @@ -327,6 +327,18 @@ theorem Eventually.exists_forall_of_atBot [SemilatticeInf α] [Nonempty α] {p :
eventually_atBot.mp h
#align filter.eventually.exists_forall_of_at_bot Filter.Eventually.exists_forall_of_atBot

lemma exists_eventually_atTop [SemilatticeSup α] [Nonempty α] {r : α → β → Prop} :
(∃ b, ∀ᶠ a in atTop, r a b) ↔ ∀ᶠ a₀ in atTop, ∃ b, ∀ a ≥ a₀, r a b := by
simp_rw [eventually_atTop, ← exists_swap (α := α)]
exact exists_congr fun a ↦ .symm <| forall_ge_iff <| Monotone.exists fun _ _ _ hb H n hn ↦
H n (hb.trans hn)

lemma exists_eventually_atBot [SemilatticeInf α] [Nonempty α] {r : α → β → Prop} :
(∃ b, ∀ᶠ a in atBot, r a b) ↔ ∀ᶠ a₀ in atBot, ∃ b, ∀ a ≤ a₀, r a b := by
simp_rw [eventually_atBot, ← exists_swap (α := α)]
exact exists_congr fun a ↦ .symm <| forall_le_iff <| Antitone.exists fun _ _ _ hb H n hn ↦
H n (hn.trans hb)

theorem frequently_atTop [SemilatticeSup α] [Nonempty α] {p : α → Prop} :
(∃ᶠ x in atTop, p x) ↔ ∀ a, ∃ b ≥ a, p b :=
atTop_basis.frequently_iff.trans <| by simp
Expand Down
4 changes: 4 additions & 0 deletions Mathlib/Topology/Basic.lean
Expand Up @@ -1066,6 +1066,10 @@ instance nhds_neBot {a : α} : NeBot (𝓝 a) :=
neBot_of_le (pure_le_nhds a)
#align nhds_ne_bot nhds_neBot

theorem tendsto_nhds_of_eventually_eq {f : β → α} {a : α} (h : ∀ᶠ x in l, f x = a) :
Tendsto f l (𝓝 a) :=
tendsto_const_nhds.congr' (.symm h)

/-!
### Cluster points
Expand Down

0 comments on commit 944ee07

Please sign in to comment.