Zulip Chat Archive

Stream: new members

Topic: Specializing filters to sequences


view this post on Zulip Jalex Stark (Mar 03 2020 at 19:53):

I am trying to show that the big oh relation defined in analysis.asymptotics is the same as the one I know as a working computer scientist. The hope would be to use my definition for proving some ``atomic'' inequalities like

\forall \eps : \R, \eps > 0 \i (\lamdba n, log n) is_o (\lambda n, n^\eps)

and then use the abstract API in mathlib for facts like "is_o is a partial order"

import tactic
import data.nat.basic
import analysis.complex.exponential
import analysis.asymptotics


noncomputable theory
open_locale classical


def is_O' (f g :   ) : Prop := asymptotics.is_O f g (filter.at_top)

def is_O (f g :   ) : Prop :=  c N : ,  x :  , (N:)  x  f x  c * g x

theorem is_O_eq_is_O' (f g :    ) : is_O f g   is_O' f g :=
begin
rw [is_O, is_O', asymptotics.is_O],
intro,
cases a with c a,
cases a with N a,
use c,
refine asymptotics.is_O_with_of_le' filter.at_top _,
end

view this post on Zulip Yury G. Kudryashov (Mar 03 2020 at 19:57):

I'd first simp only [is_O', asymptotics.is_O, filter.mem_at_top_sets]

view this post on Zulip Jalex Stark (Mar 03 2020 at 20:00):

That brings me to lean is_O f g → (∃ (c : ℝ), asymptotics.is_O_with c f g filter.at_top)

view this post on Zulip Yury G. Kudryashov (Mar 03 2020 at 20:02):

BTW, why do you want C N : nat?

view this post on Zulip Jalex Stark (Mar 03 2020 at 20:02):

That's just how a computer scientist would state it. The arguments are the same with c N : \R

view this post on Zulip Yury G. Kudryashov (Mar 03 2020 at 20:03):

import analysis.asymptotics
open filter
open_locale filter

lemma is_O_iff {f g :   } :
  asymptotics.is_O f g at_top   (c N : ),  x :  , N  x  abs (f x)  c * abs (g x) :=
by simp only [asymptotics.is_O, asymptotics.is_O_with, eventually_at_top, real.norm_eq_abs]

view this post on Zulip Jalex Stark (Mar 03 2020 at 20:03):

The computer scientist also wants the functions to be \N \to \N but that seems like more work

view this post on Zulip Jalex Stark (Mar 03 2020 at 20:04):

hmm I have open_locale filter but it says unknown identifier 'eventually_at_top'

view this post on Zulip Yury G. Kudryashov (Mar 03 2020 at 20:05):

Fixed.

view this post on Zulip Jalex Stark (Mar 03 2020 at 20:05):

Awesome, thanks!

view this post on Zulip Yury G. Kudryashov (Mar 03 2020 at 20:09):

More generally:

lemma is_O_at_top_iff {α : Type*} [lattice.semilattice_sup α] [nonempty α]
  {E : Type*} [has_norm E] {f g : α  E} :
  asymptotics.is_O f g at_top   c N,  x : α, N  x  f x  c * g x :=
by simp only [asymptotics.is_O, asymptotics.is_O_with, eventually_at_top]

Feel free to prove a similar fact about is_o, and PR both of them.


Last updated: May 12 2021 at 23:13 UTC