src/HOL/Library/Landau_Symbols.thy
author wenzelm
Fri, 20 Sep 2024 19:51:08 +0200
changeset 80914 d97fdabd9e2b
parent 80653 b98f1057da0e
child 81107 ad5fc948e053
permissions -rw-r--r--
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
     1
(*
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
     2
  File:   Landau_Symbols_Definition.thy
74543
ee039c11fb6f updated email address
Manuel Eberl <manuel@pruvisto.org>
parents: 74324
diff changeset
     3
  Author: Manuel Eberl <manuel@pruvisto.org>
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
     4
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
     5
  Landau symbols for reasoning about the asymptotic growth of functions.
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
     6
*)
69272
15e9ed5b28fb isabelle update_cartouches -t;
wenzelm
parents: 68696
diff changeset
     7
section \<open>Definition of Landau symbols\<close>
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
     8
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
     9
theory Landau_Symbols
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
    10
imports
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    11
  Complex_Main
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    12
begin
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    13
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    14
lemma eventually_subst':
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    15
  "eventually (\<lambda>x. f x = g x) F \<Longrightarrow> eventually (\<lambda>x. P x (f x)) F = eventually (\<lambda>x. P x (g x)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    16
  by (rule eventually_subst, erule eventually_rev_mp) simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    17
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    18
69272
15e9ed5b28fb isabelle update_cartouches -t;
wenzelm
parents: 68696
diff changeset
    19
subsection \<open>Definition of Landau symbols\<close>
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    20
69272
15e9ed5b28fb isabelle update_cartouches -t;
wenzelm
parents: 68696
diff changeset
    21
text \<open>
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
    22
  Our Landau symbols are sign-oblivious, i.e. any function always has the same growth
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
    23
  as its absolute. This has the advantage of making some cancelling rules for sums nicer, but
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    24
  introduces some problems in other places. Nevertheless, we found this definition more convenient
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    25
  to work with.
69272
15e9ed5b28fb isabelle update_cartouches -t;
wenzelm
parents: 68696
diff changeset
    26
\<close>
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    27
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
    28
definition bigo :: "'a filter \<Rightarrow> ('a \<Rightarrow> ('b :: real_normed_field)) \<Rightarrow> ('a \<Rightarrow> 'b) set"
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69272
diff changeset
    29
    (\<open>(1O[_]'(_'))\<close>)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
    30
  where "bigo F g = {f. (\<exists>c>0. eventually (\<lambda>x. norm (f x) \<le> c * norm (g x)) F)}"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    31
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
    32
definition smallo :: "'a filter \<Rightarrow> ('a \<Rightarrow> ('b :: real_normed_field)) \<Rightarrow> ('a \<Rightarrow> 'b) set"
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69272
diff changeset
    33
    (\<open>(1o[_]'(_'))\<close>)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    34
  where "smallo F g = {f. (\<forall>c>0. eventually (\<lambda>x. norm (f x) \<le> c * norm (g x)) F)}"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    35
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
    36
definition bigomega :: "'a filter \<Rightarrow> ('a \<Rightarrow> ('b :: real_normed_field)) \<Rightarrow> ('a \<Rightarrow> 'b) set"
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69272
diff changeset
    37
    (\<open>(1\<Omega>[_]'(_'))\<close>)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
    38
  where "bigomega F g = {f. (\<exists>c>0. eventually (\<lambda>x. norm (f x) \<ge> c * norm (g x)) F)}"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    39
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
    40
definition smallomega :: "'a filter \<Rightarrow> ('a \<Rightarrow> ('b :: real_normed_field)) \<Rightarrow> ('a \<Rightarrow> 'b) set"
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69272
diff changeset
    41
    (\<open>(1\<omega>[_]'(_'))\<close>)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    42
  where "smallomega F g = {f. (\<forall>c>0. eventually (\<lambda>x. norm (f x) \<ge> c * norm (g x)) F)}"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    43
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
    44
definition bigtheta :: "'a filter \<Rightarrow> ('a \<Rightarrow> ('b :: real_normed_field)) \<Rightarrow> ('a \<Rightarrow> 'b) set"
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69272
diff changeset
    45
    (\<open>(1\<Theta>[_]'(_'))\<close>)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    46
  where "bigtheta F g = bigo F g \<inter> bigomega F g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    47
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69272
diff changeset
    48
abbreviation bigo_at_top (\<open>(2O'(_'))\<close>) where
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
    49
  "O(g) \<equiv> bigo at_top g"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    50
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69272
diff changeset
    51
abbreviation smallo_at_top (\<open>(2o'(_'))\<close>) where
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    52
  "o(g) \<equiv> smallo at_top g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    53
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69272
diff changeset
    54
abbreviation bigomega_at_top (\<open>(2\<Omega>'(_'))\<close>) where
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    55
  "\<Omega>(g) \<equiv> bigomega at_top g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    56
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69272
diff changeset
    57
abbreviation smallomega_at_top (\<open>(2\<omega>'(_'))\<close>) where
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    58
  "\<omega>(g) \<equiv> smallomega at_top g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    59
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69272
diff changeset
    60
abbreviation bigtheta_at_top (\<open>(2\<Theta>'(_'))\<close>) where
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    61
  "\<Theta>(g) \<equiv> bigtheta at_top g"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
    62
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    63
69272
15e9ed5b28fb isabelle update_cartouches -t;
wenzelm
parents: 68696
diff changeset
    64
text \<open>The following is a set of properties that all Landau symbols satisfy.\<close>
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    65
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    66
named_theorems landau_divide_simps
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    67
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    68
locale landau_symbol =
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    69
  fixes L  :: "'a filter \<Rightarrow> ('a \<Rightarrow> ('b :: real_normed_field)) \<Rightarrow> ('a \<Rightarrow> 'b) set"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    70
  and   L'  :: "'c filter \<Rightarrow> ('c \<Rightarrow> ('b :: real_normed_field)) \<Rightarrow> ('c \<Rightarrow> 'b) set"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    71
  and   Lr  :: "'a filter \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> ('a \<Rightarrow> real) set"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    72
  assumes bot': "L bot f = UNIV"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    73
  assumes filter_mono': "F1 \<le> F2 \<Longrightarrow> L F2 f \<subseteq> L F1 f"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
    74
  assumes in_filtermap_iff:
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    75
    "f' \<in> L (filtermap h' F') g' \<longleftrightarrow> (\<lambda>x. f' (h' x)) \<in> L' F' (\<lambda>x. g' (h' x))"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
    76
  assumes filtercomap:
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    77
    "f' \<in> L F'' g' \<Longrightarrow> (\<lambda>x. f' (h' x)) \<in> L' (filtercomap h' F'') (\<lambda>x. g' (h' x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    78
  assumes sup: "f \<in> L F1 g \<Longrightarrow> f \<in> L F2 g \<Longrightarrow> f \<in> L (sup F1 F2) g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    79
  assumes in_cong: "eventually (\<lambda>x. f x = g x) F \<Longrightarrow> f \<in> L F (h) \<longleftrightarrow> g \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    80
  assumes cong: "eventually (\<lambda>x. f x = g x) F \<Longrightarrow> L F (f) = L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    81
  assumes cong_bigtheta: "f \<in> \<Theta>[F](g) \<Longrightarrow> L F (f) = L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    82
  assumes in_cong_bigtheta: "f \<in> \<Theta>[F](g) \<Longrightarrow> f \<in> L F (h) \<longleftrightarrow> g \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    83
  assumes cmult [simp]: "c \<noteq> 0 \<Longrightarrow> L F (\<lambda>x. c * f x) = L F (f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    84
  assumes cmult_in_iff [simp]: "c \<noteq> 0 \<Longrightarrow> (\<lambda>x. c * f x) \<in> L F (g) \<longleftrightarrow> f \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    85
  assumes mult_left [simp]: "f \<in> L F (g) \<Longrightarrow> (\<lambda>x. h x * f x) \<in> L F (\<lambda>x. h x * g x)"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
    86
  assumes inverse: "eventually (\<lambda>x. f x \<noteq> 0) F \<Longrightarrow> eventually (\<lambda>x. g x \<noteq> 0) F \<Longrightarrow>
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    87
                        f \<in> L F (g) \<Longrightarrow> (\<lambda>x. inverse (g x)) \<in> L F (\<lambda>x. inverse (f x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    88
  assumes subsetI: "f \<in> L F (g) \<Longrightarrow> L F (f) \<subseteq> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    89
  assumes plus_subset1: "f \<in> o[F](g) \<Longrightarrow> L F (g) \<subseteq> L F (\<lambda>x. f x + g x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    90
  assumes trans: "f \<in> L F (g) \<Longrightarrow> g \<in> L F (h) \<Longrightarrow> f \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    91
  assumes compose: "f \<in> L F (g) \<Longrightarrow> filterlim h' F G \<Longrightarrow> (\<lambda>x. f (h' x)) \<in> L' G (\<lambda>x. g (h' x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    92
  assumes norm_iff [simp]: "(\<lambda>x. norm (f x)) \<in> Lr F (\<lambda>x. norm (g x)) \<longleftrightarrow> f \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    93
  assumes abs [simp]: "Lr Fr (\<lambda>x. \<bar>fr x\<bar>) = Lr Fr fr"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    94
  assumes abs_in_iff [simp]: "(\<lambda>x. \<bar>fr x\<bar>) \<in> Lr Fr gr \<longleftrightarrow> fr \<in> Lr Fr gr"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    95
begin
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    96
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    97
lemma bot [simp]: "f \<in> L bot g" by (simp add: bot')
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
    98
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
    99
lemma filter_mono: "F1 \<le> F2 \<Longrightarrow> f \<in> L F2 g \<Longrightarrow> f \<in> L F1 g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   100
  using filter_mono'[of F1 F2] by blast
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   101
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   102
lemma cong_ex:
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   103
  "eventually (\<lambda>x. f1 x = f2 x) F \<Longrightarrow> eventually (\<lambda>x. g1 x = g2 x) F \<Longrightarrow>
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   104
     f1 \<in> L F (g1) \<longleftrightarrow> f2 \<in> L F (g2)"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   105
  by (subst cong, assumption, subst in_cong, assumption, rule refl)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   106
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   107
lemma cong_ex_bigtheta:
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   108
  "f1 \<in> \<Theta>[F](f2) \<Longrightarrow> g1 \<in> \<Theta>[F](g2) \<Longrightarrow> f1 \<in> L F (g1) \<longleftrightarrow> f2 \<in> L F (g2)"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   109
  by (subst cong_bigtheta, assumption, subst in_cong_bigtheta, assumption, rule refl)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   110
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   111
lemma bigtheta_trans1:
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   112
  "f \<in> L F (g) \<Longrightarrow> g \<in> \<Theta>[F](h) \<Longrightarrow> f \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   113
  by (subst cong_bigtheta[symmetric])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   114
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   115
lemma bigtheta_trans2:
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   116
  "f \<in> \<Theta>[F](g) \<Longrightarrow> g \<in> L F (h) \<Longrightarrow> f \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   117
  by (subst in_cong_bigtheta)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   118
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   119
lemma cmult' [simp]: "c \<noteq> 0 \<Longrightarrow> L F (\<lambda>x. f x * c) = L F (f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   120
  by (subst mult.commute) (rule cmult)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   121
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   122
lemma cmult_in_iff' [simp]: "c \<noteq> 0 \<Longrightarrow> (\<lambda>x. f x * c) \<in> L F (g) \<longleftrightarrow> f \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   123
  by (subst mult.commute) (rule cmult_in_iff)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   124
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   125
lemma cdiv [simp]: "c \<noteq> 0 \<Longrightarrow> L F (\<lambda>x. f x / c) = L F (f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   126
  using cmult'[of "inverse c" F f] by (simp add: field_simps)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   127
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   128
lemma cdiv_in_iff' [simp]: "c \<noteq> 0 \<Longrightarrow> (\<lambda>x. f x / c) \<in> L F (g) \<longleftrightarrow> f \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   129
  using cmult_in_iff'[of "inverse c" f] by (simp add: field_simps)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   130
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   131
lemma uminus [simp]: "L F (\<lambda>x. -g x) = L F (g)" using cmult[of "-1"] by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   132
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   133
lemma uminus_in_iff [simp]: "(\<lambda>x. -f x) \<in> L F (g) \<longleftrightarrow> f \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   134
  using cmult_in_iff[of "-1"] by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   135
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   136
lemma const: "c \<noteq> 0 \<Longrightarrow> L F (\<lambda>_. c) = L F (\<lambda>_. 1)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   137
  by (subst (2) cmult[symmetric]) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   138
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   139
(* Simplifier loops without the NO_MATCH *)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   140
lemma const' [simp]: "NO_MATCH 1 c \<Longrightarrow> c \<noteq> 0 \<Longrightarrow> L F (\<lambda>_. c) = L F (\<lambda>_. 1)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   141
  by (rule const)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   142
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   143
lemma const_in_iff: "c \<noteq> 0 \<Longrightarrow> (\<lambda>_. c) \<in> L F (f) \<longleftrightarrow> (\<lambda>_. 1) \<in> L F (f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   144
  using cmult_in_iff'[of c "\<lambda>_. 1"] by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   145
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   146
lemma const_in_iff' [simp]: "NO_MATCH 1 c \<Longrightarrow> c \<noteq> 0 \<Longrightarrow> (\<lambda>_. c) \<in> L F (f) \<longleftrightarrow> (\<lambda>_. 1) \<in> L F (f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   147
  by (rule const_in_iff)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   148
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   149
lemma plus_subset2: "g \<in> o[F](f) \<Longrightarrow> L F (f) \<subseteq> L F (\<lambda>x. f x + g x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   150
  by (subst add.commute) (rule plus_subset1)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   151
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   152
lemma mult_right [simp]: "f \<in> L F (g) \<Longrightarrow> (\<lambda>x. f x * h x) \<in> L F (\<lambda>x. g x * h x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   153
  using mult_left by (simp add: mult.commute)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   154
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   155
lemma mult: "f1 \<in> L F (g1) \<Longrightarrow> f2 \<in> L F (g2) \<Longrightarrow> (\<lambda>x. f1 x * f2 x) \<in> L F (\<lambda>x. g1 x * g2 x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   156
  by (rule trans, erule mult_left, erule mult_right)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   157
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   158
lemma inverse_cancel:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   159
  assumes "eventually (\<lambda>x. f x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   160
  assumes "eventually (\<lambda>x. g x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   161
  shows   "(\<lambda>x. inverse (f x)) \<in> L F (\<lambda>x. inverse (g x)) \<longleftrightarrow> g \<in> L F (f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   162
proof
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   163
  assume "(\<lambda>x. inverse (f x)) \<in> L F (\<lambda>x. inverse (g x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   164
  from inverse[OF _ _ this] assms show "g \<in> L F (f)" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   165
qed (intro inverse assms)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   166
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   167
lemma divide_right:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   168
  assumes "eventually (\<lambda>x. h x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   169
  assumes "f \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   170
  shows   "(\<lambda>x. f x / h x) \<in> L F (\<lambda>x. g x / h x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   171
  by (subst (1 2) divide_inverse) (intro mult_right inverse assms)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   172
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   173
lemma divide_right_iff:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   174
  assumes "eventually (\<lambda>x. h x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   175
  shows   "(\<lambda>x. f x / h x) \<in> L F (\<lambda>x. g x / h x) \<longleftrightarrow> f \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   176
proof
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   177
  assume "(\<lambda>x. f x / h x) \<in> L F (\<lambda>x. g x / h x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   178
  from mult_right[OF this, of h] assms show "f \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   179
    by (subst (asm) cong_ex[of _ f F _ g]) (auto elim!: eventually_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   180
qed (simp add: divide_right assms)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   181
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   182
lemma divide_left:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   183
  assumes "eventually (\<lambda>x. f x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   184
  assumes "eventually (\<lambda>x. g x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   185
  assumes "g \<in> L F(f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   186
  shows   "(\<lambda>x. h x / f x) \<in> L F (\<lambda>x. h x / g x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   187
  by (subst (1 2) divide_inverse) (intro mult_left inverse assms)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   188
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   189
lemma divide_left_iff:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   190
  assumes "eventually (\<lambda>x. f x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   191
  assumes "eventually (\<lambda>x. g x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   192
  assumes "eventually (\<lambda>x. h x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   193
  shows   "(\<lambda>x. h x / f x) \<in> L F (\<lambda>x. h x / g x) \<longleftrightarrow> g \<in> L F (f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   194
proof
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   195
  assume A: "(\<lambda>x. h x / f x) \<in> L F (\<lambda>x. h x / g x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   196
  from assms have B: "eventually (\<lambda>x. h x / f x / h x = inverse (f x)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   197
    by eventually_elim (simp add: divide_inverse)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   198
  from assms have C: "eventually (\<lambda>x. h x / g x / h x = inverse (g x)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   199
    by eventually_elim (simp add: divide_inverse)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   200
  from divide_right[OF assms(3) A] assms show "g \<in> L F (f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   201
    by (subst (asm) cong_ex[OF B C]) (simp add: inverse_cancel)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   202
qed (simp add: divide_left assms)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   203
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   204
lemma divide:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   205
  assumes "eventually (\<lambda>x. g1 x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   206
  assumes "eventually (\<lambda>x. g2 x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   207
  assumes "f1 \<in> L F (f2)" "g2 \<in> L F (g1)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   208
  shows   "(\<lambda>x. f1 x / g1 x) \<in> L F (\<lambda>x. f2 x / g2 x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   209
  by (subst (1 2) divide_inverse) (intro mult inverse assms)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   210
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   211
lemma divide_eq1:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   212
  assumes "eventually (\<lambda>x. h x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   213
  shows   "f \<in> L F (\<lambda>x. g x / h x) \<longleftrightarrow> (\<lambda>x. f x * h x) \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   214
proof-
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   215
  have "f \<in> L F (\<lambda>x. g x / h x) \<longleftrightarrow> (\<lambda>x. f x * h x / h x) \<in> L F (\<lambda>x. g x / h x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   216
    using assms by (intro in_cong) (auto elim: eventually_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   217
  thus ?thesis by (simp only: divide_right_iff assms)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   218
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   219
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   220
lemma divide_eq2:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   221
  assumes "eventually (\<lambda>x. h x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   222
  shows   "(\<lambda>x. f x / h x) \<in> L F (\<lambda>x. g x) \<longleftrightarrow> f \<in> L F (\<lambda>x. g x * h x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   223
proof-
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   224
  have "L F (\<lambda>x. g x) = L F (\<lambda>x. g x * h x / h x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   225
    using assms by (intro cong) (auto elim: eventually_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   226
  thus ?thesis by (simp only: divide_right_iff assms)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   227
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   228
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   229
lemma inverse_eq1:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   230
  assumes "eventually (\<lambda>x. g x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   231
  shows   "f \<in> L F (\<lambda>x. inverse (g x)) \<longleftrightarrow> (\<lambda>x. f x * g x) \<in> L F (\<lambda>_. 1)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   232
  using divide_eq1[of g F f "\<lambda>_. 1"] by (simp add: divide_inverse assms)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   233
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   234
lemma inverse_eq2:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   235
  assumes "eventually (\<lambda>x. f x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   236
  shows   "(\<lambda>x. inverse (f x)) \<in> L F (g) \<longleftrightarrow> (\<lambda>x. 1) \<in> L F (\<lambda>x. f x * g x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   237
  using divide_eq2[of f F "\<lambda>_. 1" g] by (simp add: divide_inverse assms mult_ac)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   238
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   239
lemma inverse_flip:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   240
  assumes "eventually (\<lambda>x. g x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   241
  assumes "eventually (\<lambda>x. h x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   242
  assumes "(\<lambda>x. inverse (g x)) \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   243
  shows   "(\<lambda>x. inverse (h x)) \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   244
using assms by (simp add: divide_eq1 divide_eq2 inverse_eq_divide mult.commute)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   245
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   246
lemma lift_trans:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   247
  assumes "f \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   248
  assumes "(\<lambda>x. t x (g x)) \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   249
  assumes "\<And>f g. f \<in> L F (g) \<Longrightarrow> (\<lambda>x. t x (f x)) \<in> L F (\<lambda>x. t x (g x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   250
  shows   "(\<lambda>x. t x (f x)) \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   251
  by (rule trans[OF assms(3)[OF assms(1)] assms(2)])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   252
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   253
lemma lift_trans':
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   254
  assumes "f \<in> L F (\<lambda>x. t x (g x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   255
  assumes "g \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   256
  assumes "\<And>g h. g \<in> L F (h) \<Longrightarrow> (\<lambda>x. t x (g x)) \<in> L F (\<lambda>x. t x (h x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   257
  shows   "f \<in> L F (\<lambda>x. t x (h x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   258
  by (rule trans[OF assms(1) assms(3)[OF assms(2)]])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   259
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   260
lemma lift_trans_bigtheta:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   261
  assumes "f \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   262
  assumes "(\<lambda>x. t x (g x)) \<in> \<Theta>[F](h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   263
  assumes "\<And>f g. f \<in> L F (g) \<Longrightarrow> (\<lambda>x. t x (f x)) \<in> L F (\<lambda>x. t x (g x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   264
  shows   "(\<lambda>x. t x (f x)) \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   265
  using cong_bigtheta[OF assms(2)] assms(3)[OF assms(1)] by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   266
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   267
lemma lift_trans_bigtheta':
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   268
  assumes "f \<in> L F (\<lambda>x. t x (g x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   269
  assumes "g \<in> \<Theta>[F](h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   270
  assumes "\<And>g h. g \<in> \<Theta>[F](h) \<Longrightarrow> (\<lambda>x. t x (g x)) \<in> \<Theta>[F](\<lambda>x. t x (h x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   271
  shows   "f \<in> L F (\<lambda>x. t x (h x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   272
  using cong_bigtheta[OF assms(3)[OF assms(2)]] assms(1)  by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   273
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   274
lemma (in landau_symbol) mult_in_1:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   275
  assumes "f \<in> L F (\<lambda>_. 1)" "g \<in> L F (\<lambda>_. 1)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   276
  shows   "(\<lambda>x. f x * g x) \<in> L F (\<lambda>_. 1)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   277
  using mult[OF assms] by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   278
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   279
lemma (in landau_symbol) of_real_cancel:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   280
  "(\<lambda>x. of_real (f x)) \<in> L F (\<lambda>x. of_real (g x)) \<Longrightarrow> f \<in> Lr F g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   281
  by (subst (asm) norm_iff [symmetric], subst (asm) (1 2) norm_of_real) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   282
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   283
lemma (in landau_symbol) of_real_iff:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   284
  "(\<lambda>x. of_real (f x)) \<in> L F (\<lambda>x. of_real (g x)) \<longleftrightarrow> f \<in> Lr F g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   285
  by (subst norm_iff [symmetric], subst (1 2) norm_of_real) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   286
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   287
lemmas [landau_divide_simps] =
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   288
  inverse_cancel divide_left_iff divide_eq1 divide_eq2 inverse_eq1 inverse_eq2
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   289
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   290
end
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   291
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   292
69272
15e9ed5b28fb isabelle update_cartouches -t;
wenzelm
parents: 68696
diff changeset
   293
text \<open>
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   294
  The symbols $O$ and $o$ and $\Omega$ and $\omega$ are dual, so for many rules, replacing $O$ with
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   295
  $\Omega$, $o$ with $\omega$, and $\leq$ with $\geq$ in a theorem yields another valid theorem.
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   296
  The following locale captures this fact.
69272
15e9ed5b28fb isabelle update_cartouches -t;
wenzelm
parents: 68696
diff changeset
   297
\<close>
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   298
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   299
locale landau_pair =
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   300
  fixes L l :: "'a filter \<Rightarrow> ('a \<Rightarrow> ('b :: real_normed_field)) \<Rightarrow> ('a \<Rightarrow> 'b) set"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   301
  fixes L' l' :: "'c filter \<Rightarrow> ('c \<Rightarrow> ('b :: real_normed_field)) \<Rightarrow> ('c \<Rightarrow> 'b) set"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   302
  fixes Lr lr :: "'a filter \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> ('a \<Rightarrow> real) set"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   303
  and   R :: "real \<Rightarrow> real \<Rightarrow> bool"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   304
  assumes L_def: "L F g = {f. \<exists>c>0. eventually (\<lambda>x. R (norm (f x)) (c * norm (g x))) F}"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   305
  and     l_def: "l F g = {f. \<forall>c>0. eventually (\<lambda>x. R (norm (f x)) (c * norm (g x))) F}"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   306
  and     L'_def: "L' F' g' = {f. \<exists>c>0. eventually (\<lambda>x. R (norm (f x)) (c * norm (g' x))) F'}"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   307
  and     l'_def: "l' F' g' = {f. \<forall>c>0. eventually (\<lambda>x. R (norm (f x)) (c * norm (g' x))) F'}"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   308
  and     Lr_def: "Lr F'' g'' = {f. \<exists>c>0. eventually (\<lambda>x. R (norm (f x)) (c * norm (g'' x))) F''}"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   309
  and     lr_def: "lr F'' g'' = {f. \<forall>c>0. eventually (\<lambda>x. R (norm (f x)) (c * norm (g'' x))) F''}"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   310
  and     R:     "R = (\<le>) \<or> R = (\<ge>)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   311
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   312
interpretation landau_o:
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   313
    landau_pair bigo smallo bigo smallo bigo smallo "(\<le>)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   314
  by unfold_locales (auto simp: bigo_def smallo_def intro!: ext)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   315
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   316
interpretation landau_omega:
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   317
    landau_pair bigomega smallomega bigomega smallomega bigomega smallomega "(\<ge>)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   318
  by unfold_locales (auto simp: bigomega_def smallomega_def intro!: ext)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   319
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   320
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   321
context landau_pair
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   322
begin
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   323
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   324
lemmas R_E = disjE [OF R, case_names le ge]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   325
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   326
lemma bigI:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   327
  "c > 0 \<Longrightarrow> eventually (\<lambda>x. R (norm (f x)) (c * norm (g x))) F \<Longrightarrow> f \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   328
  unfolding L_def by blast
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   329
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   330
lemma bigE:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   331
  assumes "f \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   332
  obtains c where "c > 0" "eventually (\<lambda>x. R (norm (f x)) (c * (norm (g x)))) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   333
  using assms unfolding L_def by blast
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   334
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   335
lemma smallI:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   336
  "(\<And>c. c > 0 \<Longrightarrow> eventually (\<lambda>x. R (norm (f x)) (c * (norm (g x)))) F) \<Longrightarrow> f \<in> l F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   337
  unfolding l_def by blast
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   338
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   339
lemma smallD:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   340
  "f \<in> l F (g) \<Longrightarrow> c > 0 \<Longrightarrow> eventually (\<lambda>x. R (norm (f x)) (c * (norm (g x)))) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   341
  unfolding l_def by blast
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   342
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   343
lemma bigE_nonneg_real:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   344
  assumes "f \<in> Lr F (g)" "eventually (\<lambda>x. f x \<ge> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   345
  obtains c where "c > 0" "eventually (\<lambda>x. R (f x) (c * \<bar>g x\<bar>)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   346
proof-
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   347
  from assms(1) obtain c where c: "c > 0" "eventually (\<lambda>x. R (norm (f x)) (c * norm (g x))) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   348
    by (auto simp: Lr_def)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   349
  from c(2) assms(2) have "eventually (\<lambda>x. R (f x) (c * \<bar>g x\<bar>)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   350
    by eventually_elim simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   351
  from c(1) and this show ?thesis by (rule that)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   352
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   353
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   354
lemma smallD_nonneg_real:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   355
  assumes "f \<in> lr F (g)" "eventually (\<lambda>x. f x \<ge> 0) F" "c > 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   356
  shows   "eventually (\<lambda>x. R (f x) (c * \<bar>g x\<bar>)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   357
  using assms by (auto simp: lr_def dest!: spec[of _ c] elim: eventually_elim2)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   358
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   359
lemma small_imp_big: "f \<in> l F (g) \<Longrightarrow> f \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   360
  by (rule bigI[OF _ smallD, of 1]) simp_all
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   361
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   362
lemma small_subset_big: "l F (g) \<subseteq> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   363
  using small_imp_big by blast
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   364
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   365
lemma R_refl [simp]: "R x x" using R by auto
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   366
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   367
lemma R_linear: "\<not>R x y \<Longrightarrow> R y x"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   368
  using R by auto
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   369
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   370
lemma R_trans [trans]: "R a b \<Longrightarrow> R b c \<Longrightarrow> R a c"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   371
  using R by auto
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   372
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   373
lemma R_mult_left_mono: "R a b \<Longrightarrow> c \<ge> 0 \<Longrightarrow> R (c*a) (c*b)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   374
  using R by (auto simp: mult_left_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   375
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   376
lemma R_mult_right_mono: "R a b \<Longrightarrow> c \<ge> 0 \<Longrightarrow> R (a*c) (b*c)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   377
  using R by (auto simp: mult_right_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   378
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   379
lemma big_trans:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   380
  assumes "f \<in> L F (g)" "g \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   381
  shows   "f \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   382
proof-
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   383
  from assms obtain c d where *: "0 < c" "0 < d"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   384
    and **: "\<forall>\<^sub>F x in F. R (norm (f x)) (c * norm (g x))"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   385
            "\<forall>\<^sub>F x in F. R (norm (g x)) (d * norm (h x))"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   386
    by (elim bigE)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   387
  from ** have "eventually (\<lambda>x. R (norm (f x)) (c * d * (norm (h x)))) F"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   388
  proof eventually_elim
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   389
    fix x assume "R (norm (f x)) (c * (norm (g x)))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   390
    also assume "R (norm (g x)) (d * (norm (h x)))"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   391
    with \<open>0 < c\<close> have "R (c * (norm (g x))) (c * (d * (norm (h x))))"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   392
      by (intro R_mult_left_mono) simp_all
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   393
    finally show "R (norm (f x)) (c * d * (norm (h x)))"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   394
      by (simp add: algebra_simps)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   395
  qed
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   396
  with * show ?thesis by (intro bigI[of "c*d"]) simp_all
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   397
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   398
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   399
lemma big_small_trans:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   400
  assumes "f \<in> L F (g)" "g \<in> l F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   401
  shows   "f \<in> l F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   402
proof (rule smallI)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   403
  fix c :: real assume c: "c > 0"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   404
  from assms(1) obtain d where d: "d > 0" and *: "\<forall>\<^sub>F x in F. R (norm (f x)) (d * norm (g x))"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   405
    by (elim bigE)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   406
  from assms(2) c d have "eventually (\<lambda>x. R (norm (g x)) (c * inverse d * norm (h x))) F"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   407
    by (intro smallD) simp_all
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   408
  with * show "eventually (\<lambda>x. R (norm (f x)) (c * (norm (h x)))) F"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   409
  proof eventually_elim
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   410
    case (elim x)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   411
    show ?case
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   412
      by (use elim(1) in \<open>rule R_trans\<close>) (use elim(2) R d in \<open>auto simp: field_simps\<close>)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   413
  qed
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   414
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   415
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   416
lemma small_big_trans:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   417
  assumes "f \<in> l F (g)" "g \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   418
  shows   "f \<in> l F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   419
proof (rule smallI)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   420
  fix c :: real assume c: "c > 0"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   421
  from assms(2) obtain d where d: "d > 0" and *: "\<forall>\<^sub>F x in F. R (norm (g x)) (d * norm (h x))"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   422
    by (elim bigE)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   423
  from assms(1) c d have "eventually (\<lambda>x. R (norm (f x)) (c * inverse d * norm (g x))) F"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   424
    by (intro smallD) simp_all
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   425
  with * show "eventually (\<lambda>x. R (norm (f x)) (c * norm (h x))) F"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   426
    by eventually_elim (rotate_tac 2, erule R_trans, insert R c d, auto simp: field_simps)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   427
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   428
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   429
lemma small_trans:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   430
  "f \<in> l F (g) \<Longrightarrow> g \<in> l F (h) \<Longrightarrow> f \<in> l F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   431
  by (rule big_small_trans[OF small_imp_big])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   432
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   433
lemma small_big_trans':
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   434
  "f \<in> l F (g) \<Longrightarrow> g \<in> L F (h) \<Longrightarrow> f \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   435
  by (rule small_imp_big[OF small_big_trans])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   436
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   437
lemma big_small_trans':
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   438
  "f \<in> L F (g) \<Longrightarrow> g \<in> l F (h) \<Longrightarrow> f \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   439
  by (rule small_imp_big[OF big_small_trans])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   440
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   441
lemma big_subsetI [intro]: "f \<in> L F (g) \<Longrightarrow> L F (f) \<subseteq> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   442
  by (intro subsetI) (drule (1) big_trans)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   443
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   444
lemma small_subsetI [intro]: "f \<in> L F (g) \<Longrightarrow> l F (f) \<subseteq> l F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   445
  by (intro subsetI) (drule (1) small_big_trans)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   446
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   447
lemma big_refl [simp]: "f \<in> L F (f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   448
  by (rule bigI[of 1]) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   449
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   450
lemma small_refl_iff: "f \<in> l F (f) \<longleftrightarrow> eventually (\<lambda>x. f x = 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   451
proof (rule iffI[OF _ smallI])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   452
  assume f: "f \<in> l F f"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   453
  have "(1/2::real) > 0" "(2::real) > 0" by simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   454
  from smallD[OF f this(1)] smallD[OF f this(2)]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   455
    show "eventually (\<lambda>x. f x = 0) F" by eventually_elim (insert R, auto)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   456
next
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   457
  fix c :: real assume "c > 0" "eventually (\<lambda>x. f x = 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   458
  from this(2) show "eventually (\<lambda>x. R (norm (f x)) (c * norm (f x))) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   459
    by eventually_elim simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   460
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   461
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   462
lemma big_small_asymmetric: "f \<in> L F (g) \<Longrightarrow> g \<in> l F (f) \<Longrightarrow> eventually (\<lambda>x. f x = 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   463
  by (drule (1) big_small_trans) (simp add: small_refl_iff)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   464
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   465
lemma small_big_asymmetric: "f \<in> l F (g) \<Longrightarrow> g \<in> L F (f) \<Longrightarrow> eventually (\<lambda>x. f x = 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   466
  by (drule (1) small_big_trans) (simp add: small_refl_iff)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   467
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   468
lemma small_asymmetric: "f \<in> l F (g) \<Longrightarrow> g \<in> l F (f) \<Longrightarrow> eventually (\<lambda>x. f x = 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   469
  by (drule (1) small_trans) (simp add: small_refl_iff)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   470
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   471
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   472
lemma plus_aux:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   473
  assumes "f \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   474
  shows "g \<in> L F (\<lambda>x. f x + g x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   475
proof (rule R_E)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   476
  assume R: "R = (\<le>)"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   477
  have A: "1/2 > (0::real)" by simp
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   478
  have B: "1/2 * (norm (g x)) \<le> norm (f x + g x)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   479
    if "norm (f x) \<le> 1/2 * norm (g x)" for x
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   480
  proof -
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   481
    from that have "1/2 * (norm (g x)) \<le> (norm (g x)) - (norm (f x))"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   482
      by simp
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   483
    also have "norm (g x) - norm (f x) \<le> norm (f x + g x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   484
      by (subst add.commute) (rule norm_diff_ineq)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   485
    finally show ?thesis by simp
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   486
  qed
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   487
  show "g \<in> L F (\<lambda>x. f x + g x)"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   488
    apply (rule bigI[of "2"])
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   489
     apply simp
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   490
    apply (use landau_o.smallD[OF assms A] in eventually_elim)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   491
    apply (use B in \<open>simp add: R algebra_simps\<close>)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   492
    done
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   493
next
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   494
  assume R: "R = (\<lambda>x y. x \<ge> y)"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   495
  show "g \<in> L F (\<lambda>x. f x + g x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   496
  proof (rule bigI[of "1/2"])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   497
    show "eventually (\<lambda>x. R (norm (g x)) (1/2 * norm (f x + g x))) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   498
      using landau_o.smallD[OF assms zero_less_one]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   499
    proof eventually_elim
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   500
      case (elim x)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   501
      have "norm (f x + g x) \<le> norm (f x) + norm (g x)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   502
        by (rule norm_triangle_ineq)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   503
      also note elim
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   504
      finally show ?case by (simp add: R)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   505
    qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   506
  qed simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   507
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   508
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   509
end
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   510
75462
7448423e5dba Renamed the misleading has_field_derivative_iff_has_vector_derivative. Inserted a number of minor lemmas
paulson <lp15@cam.ac.uk>
parents: 74543
diff changeset
   511
lemma summable_comparison_test_bigo:
7448423e5dba Renamed the misleading has_field_derivative_iff_has_vector_derivative. Inserted a number of minor lemmas
paulson <lp15@cam.ac.uk>
parents: 74543
diff changeset
   512
  fixes f :: "nat \<Rightarrow> real"
7448423e5dba Renamed the misleading has_field_derivative_iff_has_vector_derivative. Inserted a number of minor lemmas
paulson <lp15@cam.ac.uk>
parents: 74543
diff changeset
   513
  assumes "summable (\<lambda>n. norm (g n))" "f \<in> O(g)"
7448423e5dba Renamed the misleading has_field_derivative_iff_has_vector_derivative. Inserted a number of minor lemmas
paulson <lp15@cam.ac.uk>
parents: 74543
diff changeset
   514
  shows   "summable f"
7448423e5dba Renamed the misleading has_field_derivative_iff_has_vector_derivative. Inserted a number of minor lemmas
paulson <lp15@cam.ac.uk>
parents: 74543
diff changeset
   515
proof -
7448423e5dba Renamed the misleading has_field_derivative_iff_has_vector_derivative. Inserted a number of minor lemmas
paulson <lp15@cam.ac.uk>
parents: 74543
diff changeset
   516
  from \<open>f \<in> O(g)\<close> obtain C where C: "eventually (\<lambda>x. norm (f x) \<le> C * norm (g x)) at_top"
7448423e5dba Renamed the misleading has_field_derivative_iff_has_vector_derivative. Inserted a number of minor lemmas
paulson <lp15@cam.ac.uk>
parents: 74543
diff changeset
   517
    by (auto elim: landau_o.bigE)
7448423e5dba Renamed the misleading has_field_derivative_iff_has_vector_derivative. Inserted a number of minor lemmas
paulson <lp15@cam.ac.uk>
parents: 74543
diff changeset
   518
  thus ?thesis
7448423e5dba Renamed the misleading has_field_derivative_iff_has_vector_derivative. Inserted a number of minor lemmas
paulson <lp15@cam.ac.uk>
parents: 74543
diff changeset
   519
    by (rule summable_comparison_test_ev) (insert assms, auto intro: summable_mult)
7448423e5dba Renamed the misleading has_field_derivative_iff_has_vector_derivative. Inserted a number of minor lemmas
paulson <lp15@cam.ac.uk>
parents: 74543
diff changeset
   520
qed
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   521
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   522
lemma bigomega_iff_bigo: "g \<in> \<Omega>[F](f) \<longleftrightarrow> f \<in> O[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   523
proof
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   524
  assume "f \<in> O[F](g)"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   525
  then obtain c where "0 < c" "\<forall>\<^sub>F x in F. norm (f x) \<le> c * norm (g x)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   526
    by (rule landau_o.bigE)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   527
  then show "g \<in> \<Omega>[F](f)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   528
    by (intro landau_omega.bigI[of "inverse c"]) (simp_all add: field_simps)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   529
next
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   530
  assume "g \<in> \<Omega>[F](f)"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   531
  then obtain c where "0 < c" "\<forall>\<^sub>F x in F. c * norm (f x) \<le> norm (g x)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   532
    by (rule landau_omega.bigE)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   533
  then show "f \<in> O[F](g)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   534
    by (intro landau_o.bigI[of "inverse c"]) (simp_all add: field_simps)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   535
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   536
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   537
lemma smallomega_iff_smallo: "g \<in> \<omega>[F](f) \<longleftrightarrow> f \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   538
proof
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   539
  assume "f \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   540
  from landau_o.smallD[OF this, of "inverse c" for c]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   541
    show "g \<in> \<omega>[F](f)" by (intro landau_omega.smallI) (simp_all add: field_simps)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   542
next
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   543
  assume "g \<in> \<omega>[F](f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   544
  from landau_omega.smallD[OF this, of "inverse c" for c]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   545
    show "f \<in> o[F](g)" by (intro landau_o.smallI) (simp_all add: field_simps)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   546
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   547
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   548
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   549
context landau_pair
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   550
begin
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   551
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   552
lemma big_mono:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   553
  "eventually (\<lambda>x. R (norm (f x)) (norm (g x))) F \<Longrightarrow> f \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   554
  by (rule bigI[OF zero_less_one]) simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   555
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   556
lemma big_mult:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   557
  assumes "f1 \<in> L F (g1)" "f2 \<in> L F (g2)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   558
  shows   "(\<lambda>x. f1 x * f2 x) \<in> L F (\<lambda>x. g1 x * g2 x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   559
proof-
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   560
  from assms obtain c1 c2 where *: "c1 > 0" "c2 > 0"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   561
    and **: "\<forall>\<^sub>F x in F. R (norm (f1 x)) (c1 * norm (g1 x))"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   562
            "\<forall>\<^sub>F x in F. R (norm (f2 x)) (c2 * norm (g2 x))"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   563
    by (elim bigE)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   564
  from * have "c1 * c2 > 0" by simp
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   565
  moreover have "eventually (\<lambda>x. R (norm (f1 x * f2 x)) (c1 * c2 * norm (g1 x * g2 x))) F"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   566
    using **
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   567
  proof eventually_elim
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   568
    case (elim x)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   569
    show ?case
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   570
    proof (cases rule: R_E)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   571
      case le
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   572
      have "norm (f1 x) * norm (f2 x) \<le> (c1 * norm (g1 x)) * (c2 * norm (g2 x))"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   573
        using elim le * by (intro mult_mono mult_nonneg_nonneg) auto
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   574
      with le show ?thesis by (simp add: le norm_mult mult_ac)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   575
    next
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   576
      case ge
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   577
      have "(c1 * norm (g1 x)) * (c2 * norm (g2 x)) \<le> norm (f1 x) * norm (f2 x)"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   578
        using elim ge * by (intro mult_mono mult_nonneg_nonneg) auto
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   579
      with ge show ?thesis by (simp_all add: norm_mult mult_ac)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   580
    qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   581
  qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   582
  ultimately show ?thesis by (rule bigI)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   583
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   584
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   585
lemma small_big_mult:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   586
  assumes "f1 \<in> l F (g1)" "f2 \<in> L F (g2)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   587
  shows   "(\<lambda>x. f1 x * f2 x) \<in> l F (\<lambda>x. g1 x * g2 x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   588
proof (rule smallI)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   589
  fix c1 :: real assume c1: "c1 > 0"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   590
  from assms(2) obtain c2 where c2: "c2 > 0"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   591
    and *: "\<forall>\<^sub>F x in F. R (norm (f2 x)) (c2 * norm (g2 x))" by (elim bigE)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   592
  from assms(1) c1 c2 have "eventually (\<lambda>x. R (norm (f1 x)) (c1 * inverse c2 * norm (g1 x))) F"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   593
    by (auto intro!: smallD)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   594
  with * show "eventually (\<lambda>x. R (norm (f1 x * f2 x)) (c1 * norm (g1 x * g2 x))) F"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   595
  proof eventually_elim
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   596
    case (elim x)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   597
    show ?case
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   598
    proof (cases rule: R_E)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   599
      case le
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   600
      have "norm (f1 x) * norm (f2 x) \<le> (c1 * inverse c2 * norm (g1 x)) * (c2 * norm (g2 x))"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   601
        using elim le c1 c2 by (intro mult_mono mult_nonneg_nonneg) auto
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   602
      with le c2 show ?thesis by (simp add: le norm_mult field_simps)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   603
    next
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   604
      case ge
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   605
      have "norm (f1 x) * norm (f2 x) \<ge> (c1 * inverse c2 * norm (g1 x)) * (c2 * norm (g2 x))"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   606
        using elim ge c1 c2 by (intro mult_mono mult_nonneg_nonneg) auto
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   607
      with ge c2 show ?thesis by (simp add: ge norm_mult field_simps)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   608
    qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   609
  qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   610
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   611
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   612
lemma big_small_mult:
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   613
  "f1 \<in> L F (g1) \<Longrightarrow> f2 \<in> l F (g2) \<Longrightarrow> (\<lambda>x. f1 x * f2 x) \<in> l F (\<lambda>x. g1 x * g2 x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   614
  by (subst (1 2) mult.commute) (rule small_big_mult)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   615
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   616
lemma small_mult: "f1 \<in> l F (g1) \<Longrightarrow> f2 \<in> l F (g2) \<Longrightarrow> (\<lambda>x. f1 x * f2 x) \<in> l F (\<lambda>x. g1 x * g2 x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   617
  by (rule small_big_mult, assumption, rule small_imp_big)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   618
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   619
lemmas mult = big_mult small_big_mult big_small_mult small_mult
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   620
77200
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   621
lemma big_power:
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   622
  assumes "f \<in> L F (g)"
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   623
  shows   "(\<lambda>x. f x ^ m) \<in> L F (\<lambda>x. g x ^ m)"
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   624
  using assms by (induction m) (auto intro: mult)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   625
77200
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   626
lemma (in landau_pair) small_power:
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   627
  assumes "f \<in> l F (g)" "m > 0"
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   628
  shows   "(\<lambda>x. f x ^ m) \<in> l F (\<lambda>x. g x ^ m)"
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   629
proof -
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   630
  have "(\<lambda>x. f x * f x ^ (m - 1)) \<in> l F (\<lambda>x. g x * g x ^ (m - 1))"
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   631
    by (intro small_big_mult assms big_power[OF small_imp_big])
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   632
  thus ?thesis
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   633
    using assms by (cases m) (simp_all add: mult_ac)
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   634
qed
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   635
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   636
lemma big_power_increasing:
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   637
  assumes "(\<lambda>_. 1) \<in> L F f" "m \<le> n"
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   638
  shows   "(\<lambda>x. f x ^ m) \<in> L F (\<lambda>x. f x ^ n)"
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   639
proof -
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   640
  have "(\<lambda>x. f x ^ m * 1 ^ (n - m)) \<in> L F (\<lambda>x. f x ^ m * f x ^ (n - m))"
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   641
    using assms by (intro mult big_power) auto
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   642
  also have "(\<lambda>x. f x ^ m * f x ^ (n - m)) = (\<lambda>x. f x ^ (m + (n - m)))"
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   643
    by (subst power_add [symmetric]) (rule refl)
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   644
  also have "m + (n - m) = n"
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   645
    using assms by simp
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   646
  finally show ?thesis by simp
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   647
qed
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   648
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   649
lemma small_power_increasing:
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   650
  assumes "(\<lambda>_. 1) \<in> l F f" "m < n"
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   651
  shows   "(\<lambda>x. f x ^ m) \<in> l F (\<lambda>x. f x ^ n)"
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   652
proof -
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   653
  note [trans] = small_big_trans
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   654
  have "(\<lambda>x. f x ^ m * 1) \<in> l F (\<lambda>x. f x ^ m * f x)"
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   655
    using assms by (intro big_small_mult) auto
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   656
  also have "(\<lambda>x. f x ^ m * f x) = (\<lambda>x. f x ^ Suc m)"
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   657
    by (simp add: mult_ac)
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   658
  also have "\<dots> \<in> L F (\<lambda>x. f x ^ n)"
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   659
    using assms by (intro big_power_increasing[OF small_imp_big]) auto
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   660
  finally show ?thesis by simp
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   661
qed
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
   662
  
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   663
sublocale big: landau_symbol L L' Lr
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   664
proof
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   665
  have L: "L = bigo \<or> L = bigomega"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   666
    by (rule R_E) (auto simp: bigo_def L_def bigomega_def fun_eq_iff)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   667
  have A: "(\<lambda>x. c * f x) \<in> L F f" if "c \<noteq> 0" for c :: 'b and F and f :: "'a \<Rightarrow> 'b"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   668
    using that by (intro bigI[of "norm c"]) (simp_all add: norm_mult)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   669
  show "L F (\<lambda>x. c * f x) = L F f" if "c \<noteq> 0" for c :: 'b and F and f :: "'a \<Rightarrow> 'b"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   670
    using \<open>c \<noteq> 0\<close> and A[of c f] and A[of "inverse c" "\<lambda>x. c * f x"]
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   671
    by (intro equalityI big_subsetI) (simp_all add: field_simps)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   672
  show "((\<lambda>x. c * f x) \<in> L F g) = (f \<in> L F g)" if "c \<noteq> 0"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   673
    for c :: 'b and F and f g :: "'a \<Rightarrow> 'b"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   674
  proof -
69272
15e9ed5b28fb isabelle update_cartouches -t;
wenzelm
parents: 68696
diff changeset
   675
    from \<open>c \<noteq> 0\<close> and A[of c f] and A[of "inverse c" "\<lambda>x. c * f x"]
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   676
    have "(\<lambda>x. c * f x) \<in> L F f" "f \<in> L F (\<lambda>x. c * f x)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   677
      by (simp_all add: field_simps)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   678
    then show ?thesis by (intro iffI) (erule (1) big_trans)+
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   679
  qed
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   680
  show "(\<lambda>x. inverse (g x)) \<in> L F (\<lambda>x. inverse (f x))"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   681
    if *: "f \<in> L F (g)" and **: "eventually (\<lambda>x. f x \<noteq> 0) F" "eventually (\<lambda>x. g x \<noteq> 0) F"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   682
    for f g :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   683
  proof -
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   684
    from * obtain c where c: "c > 0" and ***: "\<forall>\<^sub>F x in F. R (norm (f x)) (c * norm (g x))"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   685
      by (elim bigE)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   686
    from ** *** have "eventually (\<lambda>x. R (norm (inverse (g x))) (c * norm (inverse (f x)))) F"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   687
      by eventually_elim (rule R_E, simp_all add: field_simps norm_inverse norm_divide c)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   688
    with c show ?thesis by (rule bigI)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   689
  qed
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   690
  show "L F g \<subseteq> L F (\<lambda>x. f x + g x)" if "f \<in> o[F](g)" for f g :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   691
    using plus_aux that by (blast intro!: big_subsetI)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   692
  show "L F (f) = L F (g)" if "eventually (\<lambda>x. f x = g x) F" for f g :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   693
    unfolding L_def by (subst eventually_subst'[OF that]) (rule refl)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   694
  show "f \<in> L F (h) \<longleftrightarrow> g \<in> L F (h)" if "eventually (\<lambda>x. f x = g x) F"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   695
    for f g h :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   696
    unfolding L_def mem_Collect_eq
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   697
    by (subst (1) eventually_subst'[OF that]) (rule refl)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   698
  show "L F f \<subseteq> L F g" if "f \<in> L F g" for f g :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   699
    using that by (rule big_subsetI)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   700
  show "L F (f) = L F (g)" if "f \<in> \<Theta>[F](g)" for f g :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   701
    using L that unfolding bigtheta_def
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   702
    by (intro equalityI big_subsetI) (auto simp: bigomega_iff_bigo)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   703
  show "f \<in> L F (h) \<longleftrightarrow> g \<in> L F (h)" if "f \<in> \<Theta>[F](g)" for f g h :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   704
    by (rule disjE[OF L])
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   705
      (use that in \<open>auto simp: bigtheta_def bigomega_iff_bigo intro: landau_o.big_trans\<close>)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   706
  show "(\<lambda>x. h x * f x) \<in> L F (\<lambda>x. h x * g x)" if "f \<in> L F g" for f g h :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   707
    using that by (intro big_mult) simp
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   708
  show "f \<in> L F (h)" if "f \<in> L F g" "g \<in> L F h" for f g h :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   709
    using that by (rule big_trans)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   710
  show "(\<lambda>x. f (h x)) \<in> L' G (\<lambda>x. g (h x))"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   711
    if "f \<in> L F g" and "filterlim h F G"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   712
    for f g :: "'a \<Rightarrow> 'b" and h :: "'c \<Rightarrow> 'a" and F G
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   713
    using that by (auto simp: L_def L'_def filterlim_iff)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   714
  show "f \<in> L (sup F G) g" if "f \<in> L F g" "f \<in> L G g"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   715
    for f g :: "'a \<Rightarrow> 'b" and F G :: "'a filter"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   716
  proof -
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   717
    from that [THEN bigE] obtain c1 c2
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   718
      where *: "c1 > 0" "c2 > 0"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   719
        and **: "\<forall>\<^sub>F x in F. R (norm (f x)) (c1 * norm (g x))"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   720
                "\<forall>\<^sub>F x in G. R (norm (f x)) (c2 * norm (g x))" .
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   721
    define c where "c = (if R c1 c2 then c2 else c1)"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   722
    from * have c: "R c1 c" "R c2 c" "c > 0"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   723
      by (auto simp: c_def dest: R_linear)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   724
    with ** have "eventually (\<lambda>x. R (norm (f x)) (c * norm (g x))) F"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   725
                 "eventually (\<lambda>x. R (norm (f x)) (c * norm (g x))) G"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   726
      by (force elim: eventually_mono intro: R_trans[OF _ R_mult_right_mono])+
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   727
    with c show "f \<in> L (sup F G) g"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   728
      by (auto simp: L_def eventually_sup)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   729
  qed
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   730
  show "((\<lambda>x. f (h x)) \<in> L' (filtercomap h F) (\<lambda>x. g (h x)))" if "(f \<in> L F g)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   731
    for f g :: "'a \<Rightarrow> 'b" and h :: "'c \<Rightarrow> 'a" and F G :: "'a filter"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   732
    using that unfolding L_def L'_def by auto
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   733
qed (auto simp: L_def Lr_def eventually_filtermap L'_def
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   734
          intro: filter_leD exI[of _ "1::real"])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   735
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   736
sublocale small: landau_symbol l l' lr
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   737
proof
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   738
  have A: "(\<lambda>x. c * f x) \<in> L F f" if "c \<noteq> 0" for c :: 'b and f :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   739
    using that by (intro bigI[of "norm c"]) (simp_all add: norm_mult)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   740
  show "l F (\<lambda>x. c * f x) = l F f" if "c \<noteq> 0" for c :: 'b and f :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   741
    using that and A[of c f] and A[of "inverse c" "\<lambda>x. c * f x"]
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   742
    by (intro equalityI small_subsetI) (simp_all add: field_simps)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   743
  show "((\<lambda>x. c * f x) \<in> l F g) = (f \<in> l F g)" if "c \<noteq> 0" for c :: 'b and f g :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   744
  proof -
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   745
    from that and A[of c f] and A[of "inverse c" "\<lambda>x. c * f x"]
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   746
    have "(\<lambda>x. c * f x) \<in> L F f" "f \<in> L F (\<lambda>x. c * f x)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   747
      by (simp_all add: field_simps)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   748
    then show ?thesis
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   749
      by (intro iffI) (erule (1) big_small_trans)+
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   750
  qed
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   751
  show "l F g \<subseteq> l F (\<lambda>x. f x + g x)" if "f \<in> o[F](g)" for f g :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   752
    using plus_aux that by (blast intro!: small_subsetI)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   753
  show "(\<lambda>x. inverse (g x)) \<in> l F (\<lambda>x. inverse (f x))"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   754
    if A: "f \<in> l F (g)" and B: "eventually (\<lambda>x. f x \<noteq> 0) F" "eventually (\<lambda>x. g x \<noteq> 0) F"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   755
    for f g :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   756
  proof (rule smallI)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   757
    fix c :: real assume c: "c > 0"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   758
    from B smallD[OF A c]
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   759
    show "eventually (\<lambda>x. R (norm (inverse (g x))) (c * norm (inverse (f x)))) F"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   760
      by eventually_elim (rule R_E, simp_all add: field_simps norm_inverse norm_divide)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   761
  qed
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   762
  show "l F (f) = l F (g)" if "eventually (\<lambda>x. f x = g x) F" for f g :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   763
    unfolding l_def by (subst eventually_subst'[OF that]) (rule refl)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   764
  show "f \<in> l F (h) \<longleftrightarrow> g \<in> l F (h)" if "eventually (\<lambda>x. f x = g x) F" for f g h :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   765
    unfolding l_def mem_Collect_eq by (subst (1) eventually_subst'[OF that]) (rule refl)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   766
  show "l F f \<subseteq> l F g" if "f \<in> l F g" for f g :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   767
    using that by (intro small_subsetI small_imp_big)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   768
  show "l F (f) = l F (g)" if "f \<in> \<Theta>[F](g)" for f g :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   769
  proof -
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   770
    have L: "L = bigo \<or> L = bigomega"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   771
      by (rule R_E) (auto simp: bigo_def L_def bigomega_def fun_eq_iff)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   772
    with that show ?thesis unfolding bigtheta_def
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   773
      by (intro equalityI small_subsetI) (auto simp: bigomega_iff_bigo)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   774
  qed
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   775
  show "f \<in> l F (h) \<longleftrightarrow> g \<in> l F (h)" if "f \<in> \<Theta>[F](g)" for f g h :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   776
  proof -
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   777
    have l: "l = smallo \<or> l = smallomega"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   778
      by (rule R_E) (auto simp: smallo_def l_def smallomega_def fun_eq_iff)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   779
    show ?thesis
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   780
      by (rule disjE[OF l])
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   781
        (use that in \<open>auto simp: bigtheta_def bigomega_iff_bigo smallomega_iff_smallo
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   782
          intro: landau_o.big_small_trans landau_o.small_big_trans\<close>)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   783
  qed
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   784
  show "(\<lambda>x. h x * f x) \<in> l F (\<lambda>x. h x * g x)" if "f \<in> l F g" for f g h :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   785
    using that by (intro big_small_mult) simp
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   786
  show "f \<in> l F (h)" if "f \<in> l F g" "g \<in> l F h" for f g h :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   787
    using that by (rule small_trans)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   788
  show "(\<lambda>x. f (h x)) \<in> l' G (\<lambda>x. g (h x))" if "f \<in> l F g" and "filterlim h F G"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   789
    for f g :: "'a \<Rightarrow> 'b" and h :: "'c \<Rightarrow> 'a" and F G
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   790
    using that by (auto simp: l_def l'_def filterlim_iff)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   791
  show "((\<lambda>x. f (h x)) \<in> l' (filtercomap h F) (\<lambda>x. g (h x)))" if "f \<in> l F g"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   792
    for f g :: "'a \<Rightarrow> 'b" and h :: "'c \<Rightarrow> 'a" and F G :: "'a filter"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   793
    using that unfolding l_def l'_def by auto
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   794
qed (auto simp: l_def lr_def eventually_filtermap l'_def eventually_sup intro: filter_leD)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   795
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   796
69272
15e9ed5b28fb isabelle update_cartouches -t;
wenzelm
parents: 68696
diff changeset
   797
text \<open>These rules allow chaining of Landau symbol propositions in Isar with "also".\<close>
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   798
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   799
lemma big_mult_1:    "f \<in> L F (g) \<Longrightarrow> (\<lambda>_. 1) \<in> L F (h) \<Longrightarrow> f \<in> L F (\<lambda>x. g x * h x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   800
  and big_mult_1':   "(\<lambda>_. 1) \<in> L F (g) \<Longrightarrow> f \<in> L F (h) \<Longrightarrow> f \<in> L F (\<lambda>x. g x * h x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   801
  and small_mult_1:  "f \<in> l F (g) \<Longrightarrow> (\<lambda>_. 1) \<in> L F (h) \<Longrightarrow> f \<in> l F (\<lambda>x. g x * h x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   802
  and small_mult_1': "(\<lambda>_. 1) \<in> L F (g) \<Longrightarrow> f \<in> l F (h) \<Longrightarrow> f \<in> l F (\<lambda>x. g x * h x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   803
  and small_mult_1'':  "f \<in> L F (g) \<Longrightarrow> (\<lambda>_. 1) \<in> l F (h) \<Longrightarrow> f \<in> l F (\<lambda>x. g x * h x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   804
  and small_mult_1''': "(\<lambda>_. 1) \<in> l F (g) \<Longrightarrow> f \<in> L F (h) \<Longrightarrow> f \<in> l F (\<lambda>x. g x * h x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   805
  by (drule (1) big.mult big_small_mult small_big_mult, simp)+
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   806
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   807
lemma big_1_mult:    "f \<in> L F (g) \<Longrightarrow> h \<in> L F (\<lambda>_. 1) \<Longrightarrow> (\<lambda>x. f x * h x) \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   808
  and big_1_mult':   "h \<in> L F (\<lambda>_. 1) \<Longrightarrow> f \<in> L F (g) \<Longrightarrow> (\<lambda>x. f x * h x) \<in> L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   809
  and small_1_mult:  "f \<in> l F (g) \<Longrightarrow> h \<in> L F (\<lambda>_. 1) \<Longrightarrow> (\<lambda>x. f x * h x) \<in> l F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   810
  and small_1_mult': "h \<in> L F (\<lambda>_. 1) \<Longrightarrow> f \<in> l F (g) \<Longrightarrow> (\<lambda>x. f x * h x) \<in> l F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   811
  and small_1_mult'':  "f \<in> L F (g) \<Longrightarrow> h \<in> l F (\<lambda>_. 1) \<Longrightarrow> (\<lambda>x. f x * h x) \<in> l F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   812
  and small_1_mult''': "h \<in> l F (\<lambda>_. 1) \<Longrightarrow> f \<in> L F (g) \<Longrightarrow> (\<lambda>x. f x * h x) \<in> l F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   813
  by (drule (1) big.mult big_small_mult small_big_mult, simp)+
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   814
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   815
lemmas mult_1_trans =
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   816
  big_mult_1 big_mult_1' small_mult_1 small_mult_1' small_mult_1'' small_mult_1'''
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   817
  big_1_mult big_1_mult' small_1_mult small_1_mult' small_1_mult'' small_1_mult'''
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   818
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   819
lemma big_equal_iff_bigtheta: "L F (f) = L F (g) \<longleftrightarrow> f \<in> \<Theta>[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   820
proof
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   821
  have L: "L = bigo \<or> L = bigomega"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   822
    by (rule R_E) (auto simp: fun_eq_iff L_def bigo_def bigomega_def)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   823
  fix f g :: "'a \<Rightarrow> 'b" assume "L F (f) = L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   824
  with big_refl[of f F] big_refl[of g F] have "f \<in> L F (g)" "g \<in> L F (f)" by simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   825
  thus "f \<in> \<Theta>[F](g)" using L unfolding bigtheta_def by (auto simp: bigomega_iff_bigo)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   826
qed (rule big.cong_bigtheta)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   827
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   828
lemma big_prod:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   829
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<in> L F (g x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   830
  shows   "(\<lambda>y. \<Prod>x\<in>A. f x y) \<in> L F (\<lambda>y. \<Prod>x\<in>A. g x y)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   831
  using assms by (induction A rule: infinite_finite_induct) (auto intro!: big.mult)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   832
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   833
lemma big_prod_in_1:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   834
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<in> L F (\<lambda>_. 1)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   835
  shows   "(\<lambda>y. \<Prod>x\<in>A. f x y) \<in> L F (\<lambda>_. 1)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   836
  using assms by (induction A rule: infinite_finite_induct) (auto intro!: big.mult_in_1)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   837
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   838
end
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   839
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   840
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   841
context landau_symbol
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   842
begin
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   843
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   844
lemma plus_absorb1:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   845
  assumes "f \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   846
  shows   "L F (\<lambda>x. f x + g x) = L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   847
proof (intro equalityI)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   848
  from plus_subset1 and assms show "L F g \<subseteq> L F (\<lambda>x. f x + g x)" .
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   849
  from landau_o.small.plus_subset1[OF assms] and assms have "(\<lambda>x. -f x) \<in> o[F](\<lambda>x. f x + g x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   850
    by (auto simp: landau_o.small.uminus_in_iff)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   851
  from plus_subset1[OF this] show "L F (\<lambda>x. f x + g x) \<subseteq> L F (g)" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   852
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   853
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   854
lemma plus_absorb2: "g \<in> o[F](f) \<Longrightarrow> L F (\<lambda>x. f x + g x) = L F (f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   855
  using plus_absorb1[of g F f] by (simp add: add.commute)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   856
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   857
lemma diff_absorb1: "f \<in> o[F](g) \<Longrightarrow> L F (\<lambda>x. f x - g x) = L F (g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   858
  by (simp only: diff_conv_add_uminus plus_absorb1 landau_o.small.uminus uminus)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   859
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   860
lemma diff_absorb2: "g \<in> o[F](f) \<Longrightarrow> L F (\<lambda>x. f x - g x) = L F (f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   861
  by (simp only: diff_conv_add_uminus plus_absorb2 landau_o.small.uminus_in_iff)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   862
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   863
lemmas absorb = plus_absorb1 plus_absorb2 diff_absorb1 diff_absorb2
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   864
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   865
end
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   866
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   867
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   868
lemma bigthetaI [intro]: "f \<in> O[F](g) \<Longrightarrow> f \<in> \<Omega>[F](g) \<Longrightarrow> f \<in> \<Theta>[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   869
  unfolding bigtheta_def bigomega_def by blast
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   870
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   871
lemma bigthetaD1 [dest]: "f \<in> \<Theta>[F](g) \<Longrightarrow> f \<in> O[F](g)"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   872
  and bigthetaD2 [dest]: "f \<in> \<Theta>[F](g) \<Longrightarrow> f \<in> \<Omega>[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   873
  unfolding bigtheta_def bigo_def bigomega_def by blast+
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   874
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   875
lemma bigtheta_refl [simp]: "f \<in> \<Theta>[F](f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   876
  unfolding bigtheta_def by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   877
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   878
lemma bigtheta_sym: "f \<in> \<Theta>[F](g) \<longleftrightarrow> g \<in> \<Theta>[F](f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   879
  unfolding bigtheta_def by (auto simp: bigomega_iff_bigo)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   880
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   881
lemmas landau_flip =
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   882
  bigomega_iff_bigo[symmetric] smallomega_iff_smallo[symmetric]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   883
  bigomega_iff_bigo smallomega_iff_smallo bigtheta_sym
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   884
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   885
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   886
interpretation landau_theta: landau_symbol bigtheta bigtheta bigtheta
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   887
proof
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   888
  fix f g :: "'a \<Rightarrow> 'b" and F
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   889
  assume "f \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   890
  hence "O[F](g) \<subseteq> O[F](\<lambda>x. f x + g x)" "\<Omega>[F](g) \<subseteq> \<Omega>[F](\<lambda>x. f x + g x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   891
    by (rule landau_o.big.plus_subset1 landau_omega.big.plus_subset1)+
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   892
  thus "\<Theta>[F](g) \<subseteq> \<Theta>[F](\<lambda>x. f x + g x)" unfolding bigtheta_def by blast
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   893
next
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   894
  fix f g :: "'a \<Rightarrow> 'b" and F
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   895
  assume "f \<in> \<Theta>[F](g)"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   896
  thus A: "\<Theta>[F](f) = \<Theta>[F](g)"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   897
    apply (subst (1 2) bigtheta_def)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   898
    apply (subst landau_o.big.cong_bigtheta landau_omega.big.cong_bigtheta, assumption)+
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   899
    apply (rule refl)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   900
    done
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   901
  thus "\<Theta>[F](f) \<subseteq> \<Theta>[F](g)" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   902
  fix h :: "'a \<Rightarrow> 'b"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   903
  show "f \<in> \<Theta>[F](h) \<longleftrightarrow> g \<in> \<Theta>[F](h)" by (subst (1 2) bigtheta_sym) (simp add: A)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   904
next
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   905
  fix f g h :: "'a \<Rightarrow> 'b" and F
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   906
  assume "f \<in> \<Theta>[F](g)" "g \<in> \<Theta>[F](h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   907
  thus "f \<in> \<Theta>[F](h)" unfolding bigtheta_def
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   908
    by (blast intro: landau_o.big.trans landau_omega.big.trans)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   909
next
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   910
  fix f :: "'a \<Rightarrow> 'b" and F1 F2 :: "'a filter"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   911
  assume "F1 \<le> F2"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   912
  thus "\<Theta>[F2](f) \<subseteq> \<Theta>[F1](f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   913
    by (auto simp: bigtheta_def intro: landau_o.big.filter_mono landau_omega.big.filter_mono)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   914
qed (auto simp: bigtheta_def landau_o.big.norm_iff
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   915
                landau_o.big.cmult landau_omega.big.cmult
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   916
                landau_o.big.cmult_in_iff landau_omega.big.cmult_in_iff
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   917
                landau_o.big.in_cong landau_omega.big.in_cong
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   918
                landau_o.big.mult landau_omega.big.mult
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   919
                landau_o.big.inverse landau_omega.big.inverse
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   920
                landau_o.big.compose landau_omega.big.compose
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   921
                landau_o.big.bot' landau_omega.big.bot'
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   922
                landau_o.big.in_filtermap_iff landau_omega.big.in_filtermap_iff
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   923
                landau_o.big.sup landau_omega.big.sup
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   924
                landau_o.big.filtercomap landau_omega.big.filtercomap
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   925
          dest: landau_o.big.cong landau_omega.big.cong)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   926
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   927
lemmas landau_symbols =
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   928
  landau_o.big.landau_symbol_axioms landau_o.small.landau_symbol_axioms
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   929
  landau_omega.big.landau_symbol_axioms landau_omega.small.landau_symbol_axioms
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   930
  landau_theta.landau_symbol_axioms
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   931
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   932
lemma bigoI [intro]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   933
  assumes "eventually (\<lambda>x. (norm (f x)) \<le> c * (norm (g x))) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   934
  shows   "f \<in> O[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   935
proof (rule landau_o.bigI)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   936
  show "max 1 c > 0" by simp
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   937
  have "c * (norm (g x)) \<le> max 1 c * (norm (g x))" for x
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   938
    by (simp add: mult_right_mono)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   939
  with assms show "eventually (\<lambda>x. (norm (f x)) \<le> max 1 c * (norm (g x))) F"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   940
    by (auto elim!: eventually_mono dest: order.trans)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   941
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   942
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   943
lemma smallomegaD [dest]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   944
  assumes "f \<in> \<omega>[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   945
  shows   "eventually (\<lambda>x. (norm (f x)) \<ge> c * (norm (g x))) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   946
proof (cases "c > 0")
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   947
  case False
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   948
  show ?thesis
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   949
    by (intro always_eventually allI, rule order.trans[of _ 0])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   950
       (insert False, auto intro!: mult_nonpos_nonneg)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   951
qed (blast dest: landau_omega.smallD[OF assms, of c])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   952
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   953
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   954
lemma bigthetaI':
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   955
  assumes "c1 > 0" "c2 > 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   956
  assumes "eventually (\<lambda>x. c1 * (norm (g x)) \<le> (norm (f x)) \<and> (norm (f x)) \<le> c2 * (norm (g x))) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   957
  shows   "f \<in> \<Theta>[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   958
apply (rule bigthetaI)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   959
apply (rule landau_o.bigI[OF assms(2)]) using assms(3) apply (eventually_elim, simp)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   960
apply (rule landau_omega.bigI[OF assms(1)]) using assms(3) apply (eventually_elim, simp)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   961
done
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   962
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   963
lemma bigthetaI_cong: "eventually (\<lambda>x. f x = g x) F \<Longrightarrow> f \<in> \<Theta>[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   964
  by (intro bigthetaI'[of 1 1]) (auto elim!: eventually_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   965
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   966
lemma (in landau_symbol) ev_eq_trans1:
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   967
  "f \<in> L F (\<lambda>x. g x (h x)) \<Longrightarrow> eventually (\<lambda>x. h x = h' x) F \<Longrightarrow> f \<in> L F (\<lambda>x. g x (h' x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   968
  by (rule bigtheta_trans1[OF _ bigthetaI_cong]) (auto elim!: eventually_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   969
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   970
lemma (in landau_symbol) ev_eq_trans2:
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   971
  "eventually (\<lambda>x. f x = f' x) F \<Longrightarrow> (\<lambda>x. g x (f' x)) \<in> L F (h) \<Longrightarrow> (\<lambda>x. g x (f x)) \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   972
  by (rule bigtheta_trans2[OF bigthetaI_cong]) (auto elim!: eventually_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   973
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   974
declare landau_o.smallI landau_omega.bigI landau_omega.smallI [intro]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   975
declare landau_o.bigE landau_omega.bigE [elim]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   976
declare landau_o.smallD
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   977
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   978
lemma (in landau_symbol) bigtheta_trans1':
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   979
  "f \<in> L F (g) \<Longrightarrow> h \<in> \<Theta>[F](g) \<Longrightarrow> f \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   980
  by (subst cong_bigtheta[symmetric]) (simp add: bigtheta_sym)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   981
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   982
lemma (in landau_symbol) bigtheta_trans2':
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   983
  "g \<in> \<Theta>[F](f) \<Longrightarrow> g \<in> L F (h) \<Longrightarrow> f \<in> L F (h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   984
  by (rule bigtheta_trans2, subst bigtheta_sym)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   985
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   986
lemma bigo_bigomega_trans:      "f \<in> O[F](g) \<Longrightarrow> h \<in> \<Omega>[F](g) \<Longrightarrow> f \<in> O[F](h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   987
  and bigo_smallomega_trans:    "f \<in> O[F](g) \<Longrightarrow> h \<in> \<omega>[F](g) \<Longrightarrow> f \<in> o[F](h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   988
  and smallo_bigomega_trans:    "f \<in> o[F](g) \<Longrightarrow> h \<in> \<Omega>[F](g) \<Longrightarrow> f \<in> o[F](h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   989
  and smallo_smallomega_trans:  "f \<in> o[F](g) \<Longrightarrow> h \<in> \<omega>[F](g) \<Longrightarrow> f \<in> o[F](h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   990
  and bigomega_bigo_trans:      "f \<in> \<Omega>[F](g) \<Longrightarrow> h \<in> O[F](g) \<Longrightarrow> f \<in> \<Omega>[F](h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   991
  and bigomega_smallo_trans:    "f \<in> \<Omega>[F](g) \<Longrightarrow> h \<in> o[F](g) \<Longrightarrow> f \<in> \<omega>[F](h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   992
  and smallomega_bigo_trans:    "f \<in> \<omega>[F](g) \<Longrightarrow> h \<in> O[F](g) \<Longrightarrow> f \<in> \<omega>[F](h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   993
  and smallomega_smallo_trans:  "f \<in> \<omega>[F](g) \<Longrightarrow> h \<in> o[F](g) \<Longrightarrow> f \<in> \<omega>[F](h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   994
  by (unfold bigomega_iff_bigo smallomega_iff_smallo)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
   995
     (erule (1) landau_o.big_trans landau_o.big_small_trans landau_o.small_big_trans
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   996
                landau_o.big_trans landau_o.small_trans)+
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   997
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   998
lemmas landau_trans_lift [trans] =
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
   999
  landau_symbols[THEN landau_symbol.lift_trans]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1000
  landau_symbols[THEN landau_symbol.lift_trans']
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1001
  landau_symbols[THEN landau_symbol.lift_trans_bigtheta]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1002
  landau_symbols[THEN landau_symbol.lift_trans_bigtheta']
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1003
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1004
lemmas landau_mult_1_trans [trans] =
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1005
  landau_o.mult_1_trans landau_omega.mult_1_trans
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1006
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1007
lemmas landau_trans [trans] =
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1008
  landau_symbols[THEN landau_symbol.bigtheta_trans1]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1009
  landau_symbols[THEN landau_symbol.bigtheta_trans2]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1010
  landau_symbols[THEN landau_symbol.bigtheta_trans1']
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1011
  landau_symbols[THEN landau_symbol.bigtheta_trans2']
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1012
  landau_symbols[THEN landau_symbol.ev_eq_trans1]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1013
  landau_symbols[THEN landau_symbol.ev_eq_trans2]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1014
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1015
  landau_o.big_trans landau_o.small_trans landau_o.small_big_trans landau_o.big_small_trans
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1016
  landau_omega.big_trans landau_omega.small_trans
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1017
    landau_omega.small_big_trans landau_omega.big_small_trans
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1018
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1019
  bigo_bigomega_trans bigo_smallomega_trans smallo_bigomega_trans smallo_smallomega_trans
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1020
  bigomega_bigo_trans bigomega_smallo_trans smallomega_bigo_trans smallomega_smallo_trans
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1021
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1022
lemma bigtheta_inverse [simp]:
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1023
  shows "(\<lambda>x. inverse (f x)) \<in> \<Theta>[F](\<lambda>x. inverse (g x)) \<longleftrightarrow> f \<in> \<Theta>[F](g)"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1024
proof -
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1025
  have "(\<lambda>x. inverse (f x)) \<in> O[F](\<lambda>x. inverse (g x))"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1026
    if A: "f \<in> \<Theta>[F](g)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1027
    for f g :: "'a \<Rightarrow> 'b" and F
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1028
  proof -
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1029
    from A obtain c1 c2 :: real where *: "c1 > 0" "c2 > 0"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1030
      and **: "\<forall>\<^sub>F x in F. norm (f x) \<le> c1 * norm (g x)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1031
              "\<forall>\<^sub>F x in F. c2 * norm (g x) \<le> norm (f x)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1032
      unfolding bigtheta_def by (elim landau_o.bigE landau_omega.bigE IntE)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1033
    from \<open>c2 > 0\<close> have c2: "inverse c2 > 0" by simp
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1034
    from ** have "eventually (\<lambda>x. norm (inverse (f x)) \<le> inverse c2 * norm (inverse (g x))) F"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1035
    proof eventually_elim
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1036
      fix x assume A: "norm (f x) \<le> c1 * norm (g x)" "c2 * norm (g x) \<le> norm (f x)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1037
      from A * have "f x = 0 \<longleftrightarrow> g x = 0"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1038
        by (auto simp: field_simps mult_le_0_iff)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1039
      with A * show "norm (inverse (f x)) \<le> inverse c2 * norm (inverse (g x))"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1040
        by (force simp: field_simps norm_inverse norm_divide)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1041
    qed
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1042
    with c2 show ?thesis by (rule landau_o.bigI)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1043
  qed
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1044
  then show ?thesis
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1045
    unfolding bigtheta_def
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1046
    by (force simp: bigomega_iff_bigo bigtheta_sym)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1047
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1048
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1049
lemma bigtheta_divide:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1050
  assumes "f1 \<in> \<Theta>(f2)" "g1 \<in> \<Theta>(g2)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1051
  shows   "(\<lambda>x. f1 x / g1 x) \<in> \<Theta>(\<lambda>x. f2 x / g2 x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1052
  by (subst (1 2) divide_inverse, intro landau_theta.mult) (simp_all add: bigtheta_inverse assms)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1053
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1054
lemma eventually_nonzero_bigtheta:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1055
  assumes "f \<in> \<Theta>[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1056
  shows   "eventually (\<lambda>x. f x \<noteq> 0) F \<longleftrightarrow> eventually (\<lambda>x. g x \<noteq> 0) F"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1057
proof -
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1058
  have "eventually (\<lambda>x. g x \<noteq> 0) F"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1059
    if A: "f \<in> \<Theta>[F](g)" and B: "eventually (\<lambda>x. f x \<noteq> 0) F"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1060
    for f g :: "'a \<Rightarrow> 'b"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1061
  proof -
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1062
    from A obtain c1 c2 where
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1063
      "\<forall>\<^sub>F x in F. norm (f x) \<le> c1 * norm (g x)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1064
      "\<forall>\<^sub>F x in F. c2 * norm (g x) \<le> norm (f x)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1065
      unfolding bigtheta_def by (elim landau_o.bigE landau_omega.bigE IntE)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1066
    with B show ?thesis by eventually_elim auto
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1067
  qed
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1068
  with assms show ?thesis by (force simp: bigtheta_sym)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1069
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1070
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1071
69272
15e9ed5b28fb isabelle update_cartouches -t;
wenzelm
parents: 68696
diff changeset
  1072
subsection \<open>Landau symbols and limits\<close>
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1073
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1074
lemma bigoI_tendsto_norm:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1075
  fixes f g
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1076
  assumes "((\<lambda>x. norm (f x / g x)) \<longlongrightarrow> c) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1077
  assumes "eventually (\<lambda>x. g x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1078
  shows   "f \<in> O[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1079
proof (rule bigoI)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1080
  from assms have "eventually (\<lambda>x. dist (norm (f x / g x)) c < 1) F"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1081
    using tendstoD by force
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1082
  thus "eventually (\<lambda>x. (norm (f x)) \<le> (norm c + 1) * (norm (g x))) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1083
    unfolding dist_real_def using assms(2)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1084
  proof eventually_elim
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1085
    case (elim x)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1086
    have "(norm (f x)) - norm c * (norm (g x)) \<le> norm ((norm (f x)) - c * (norm (g x)))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1087
      unfolding norm_mult [symmetric] using norm_triangle_ineq2[of "norm (f x)" "c * norm (g x)"]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1088
      by (simp add: norm_mult abs_mult)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1089
    also from elim have "\<dots> = norm (norm (g x)) * norm (norm (f x / g x) - c)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1090
      unfolding norm_mult [symmetric] by (simp add: algebra_simps norm_divide)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1091
    also from elim have "norm (norm (f x / g x) - c) \<le> 1" by simp
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1092
    hence "norm (norm (g x)) * norm (norm (f x / g x) - c) \<le> norm (norm (g x)) * 1"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1093
      by (rule mult_left_mono) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1094
    finally show ?case by (simp add: algebra_simps)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1095
  qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1096
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1097
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1098
lemma bigoI_tendsto:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1099
  assumes "((\<lambda>x. f x / g x) \<longlongrightarrow> c) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1100
  assumes "eventually (\<lambda>x. g x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1101
  shows   "f \<in> O[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1102
  using assms by (rule bigoI_tendsto_norm[OF tendsto_norm])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1103
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1104
lemma bigomegaI_tendsto_norm:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1105
  assumes c_not_0:  "(c::real) \<noteq> 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1106
  assumes lim:      "((\<lambda>x. norm (f x / g x)) \<longlongrightarrow> c) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1107
  shows   "f \<in> \<Omega>[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1108
proof (cases "F = bot")
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1109
  case False
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1110
  show ?thesis
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1111
  proof (rule landau_omega.bigI)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1112
    from lim  have "c \<ge> 0" by (rule tendsto_lowerbound) (insert False, simp_all)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1113
    with c_not_0 have "c > 0" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1114
    with c_not_0 show "c/2 > 0" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1115
    from lim have ev: "\<And>\<epsilon>. \<epsilon> > 0 \<Longrightarrow> eventually (\<lambda>x. norm (norm (f x / g x) - c) < \<epsilon>) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1116
      by (subst (asm) tendsto_iff) (simp add: dist_real_def)
69272
15e9ed5b28fb isabelle update_cartouches -t;
wenzelm
parents: 68696
diff changeset
  1117
    from ev[OF \<open>c/2 > 0\<close>] show "eventually (\<lambda>x. (norm (f x)) \<ge> c/2 * (norm (g x))) F"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1118
    proof (eventually_elim)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1119
      fix x assume B: "norm (norm (f x / g x) - c) < c / 2"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1120
      from B have g: "g x \<noteq> 0" by auto
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1121
      from B have "-c/2 < -norm (norm (f x / g x) - c)" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1122
      also have "... \<le> norm (f x / g x) - c" by simp
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1123
      finally show "(norm (f x)) \<ge> c/2 * (norm (g x))" using g
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1124
        by (simp add: field_simps norm_mult norm_divide)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1125
    qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1126
  qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1127
qed simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1128
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1129
lemma bigomegaI_tendsto:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1130
  assumes c_not_0:  "(c::real) \<noteq> 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1131
  assumes lim:      "((\<lambda>x. f x / g x) \<longlongrightarrow> c) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1132
  shows   "f \<in> \<Omega>[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1133
  by (rule bigomegaI_tendsto_norm[OF _ tendsto_norm, of c]) (insert assms, simp_all)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1134
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1135
lemma smallomegaI_filterlim_at_top_norm:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1136
  assumes lim: "filterlim (\<lambda>x. norm (f x / g x)) at_top F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1137
  shows   "f \<in> \<omega>[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1138
proof (rule landau_omega.smallI)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1139
  fix c :: real assume c_pos: "c > 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1140
  from lim have ev: "eventually (\<lambda>x. norm (f x / g x) \<ge> c) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1141
    by (subst (asm) filterlim_at_top) simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1142
  thus "eventually (\<lambda>x. (norm (f x)) \<ge> c * (norm (g x))) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1143
  proof eventually_elim
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1144
    fix x assume A: "norm (f x / g x) \<ge> c"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1145
    from A c_pos have "g x \<noteq> 0" by auto
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1146
    with A show "(norm (f x)) \<ge> c * (norm (g x))" by (simp add: field_simps norm_divide)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1147
  qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1148
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1149
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1150
lemma smallomegaI_filterlim_at_infinity:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1151
  assumes lim: "filterlim (\<lambda>x. f x / g x) at_infinity F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1152
  shows   "f \<in> \<omega>[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1153
proof (rule smallomegaI_filterlim_at_top_norm)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1154
  from lim show "filterlim (\<lambda>x. norm (f x / g x)) at_top F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1155
    by (rule filterlim_at_infinity_imp_norm_at_top)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1156
qed
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1157
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1158
lemma smallomegaD_filterlim_at_top_norm:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1159
  assumes "f \<in> \<omega>[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1160
  assumes "eventually (\<lambda>x. g x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1161
  shows   "LIM x F. norm (f x / g x) :> at_top"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1162
proof (subst filterlim_at_top_gt, clarify)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1163
  fix c :: real assume c: "c > 0"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1164
  from landau_omega.smallD[OF assms(1) this] assms(2)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1165
    show "eventually (\<lambda>x. norm (f x / g x) \<ge> c) F"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1166
    by eventually_elim (simp add: field_simps norm_divide)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1167
qed
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1168
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1169
lemma smallomegaD_filterlim_at_infinity:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1170
  assumes "f \<in> \<omega>[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1171
  assumes "eventually (\<lambda>x. g x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1172
  shows   "LIM x F. f x / g x :> at_infinity"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1173
  using assms by (intro filterlim_norm_at_top_imp_at_infinity smallomegaD_filterlim_at_top_norm)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1174
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1175
lemma smallomega_1_conv_filterlim: "f \<in> \<omega>[F](\<lambda>_. 1) \<longleftrightarrow> filterlim f at_infinity F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1176
  by (auto intro: smallomegaI_filterlim_at_infinity dest: smallomegaD_filterlim_at_infinity)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1177
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1178
lemma smalloI_tendsto:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1179
  assumes lim: "((\<lambda>x. f x / g x) \<longlongrightarrow> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1180
  assumes "eventually (\<lambda>x. g x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1181
  shows   "f \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1182
proof (rule landau_o.smallI)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1183
  fix c :: real assume c_pos: "c > 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1184
  from c_pos and lim have ev: "eventually (\<lambda>x. norm (f x / g x) < c) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1185
    by (subst (asm) tendsto_iff) (simp add: dist_real_def)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1186
  with assms(2) show "eventually (\<lambda>x. (norm (f x)) \<le> c * (norm (g x))) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1187
    by eventually_elim (simp add: field_simps norm_divide)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1188
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1189
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1190
lemma smalloD_tendsto:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1191
  assumes "f \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1192
  shows   "((\<lambda>x. f x / g x) \<longlongrightarrow> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1193
unfolding tendsto_iff
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1194
proof clarify
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1195
  fix e :: real assume e: "e > 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1196
  hence "e/2 > 0" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1197
  from landau_o.smallD[OF assms this] show "eventually (\<lambda>x. dist (f x / g x) 0 < e) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1198
  proof eventually_elim
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1199
    fix x assume "(norm (f x)) \<le> e/2 * (norm (g x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1200
    with e have "dist (f x / g x) 0 \<le> e/2"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1201
      by (cases "g x = 0") (simp_all add: dist_real_def norm_divide field_simps)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1202
    also from e have "... < e" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1203
    finally show "dist (f x / g x) 0 < e" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1204
  qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1205
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1206
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1207
lemma bigthetaI_tendsto_norm:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1208
  assumes c_not_0: "(c::real) \<noteq> 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1209
  assumes lim:     "((\<lambda>x. norm (f x / g x)) \<longlongrightarrow> c) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1210
  shows   "f \<in> \<Theta>[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1211
proof (rule bigthetaI)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1212
  from c_not_0 have "\<bar>c\<bar> > 0" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1213
  with lim have "eventually (\<lambda>x. norm (norm (f x / g x) - c) < \<bar>c\<bar>) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1214
    by (subst (asm) tendsto_iff) (simp add: dist_real_def)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1215
  hence g: "eventually (\<lambda>x. g x \<noteq> 0) F" by eventually_elim (auto simp add: field_simps)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1216
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1217
  from lim g show "f \<in> O[F](g)" by (rule bigoI_tendsto_norm)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1218
  from c_not_0 and lim show "f \<in> \<Omega>[F](g)" by (rule bigomegaI_tendsto_norm)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1219
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1220
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1221
lemma bigthetaI_tendsto:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1222
  assumes c_not_0: "(c::real) \<noteq> 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1223
  assumes lim:     "((\<lambda>x. f x / g x) \<longlongrightarrow> c) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1224
  shows   "f \<in> \<Theta>[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1225
  using assms by (intro bigthetaI_tendsto_norm[OF _ tendsto_norm, of "c"]) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1226
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1227
lemma tendsto_add_smallo:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1228
  assumes "(f1 \<longlongrightarrow> a) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1229
  assumes "f2 \<in> o[F](f1)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1230
  shows   "((\<lambda>x. f1 x + f2 x) \<longlongrightarrow> a) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1231
proof (subst filterlim_cong[OF refl refl])
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1232
  from landau_o.smallD[OF assms(2) zero_less_one]
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1233
    have "eventually (\<lambda>x. norm (f2 x) \<le> norm (f1 x)) F" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1234
  thus "eventually (\<lambda>x. f1 x + f2 x = f1 x * (1 + f2 x / f1 x)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1235
    by eventually_elim (auto simp: field_simps)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1236
next
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1237
  from assms(1) show "((\<lambda>x. f1 x * (1 + f2 x / f1 x)) \<longlongrightarrow> a) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1238
    by (force intro: tendsto_eq_intros smalloD_tendsto[OF assms(2)])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1239
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1240
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1241
lemma tendsto_diff_smallo:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1242
  shows "(f1 \<longlongrightarrow> a) F \<Longrightarrow> f2 \<in> o[F](f1) \<Longrightarrow> ((\<lambda>x. f1 x - f2 x) \<longlongrightarrow> a) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1243
  using tendsto_add_smallo[of f1 a F "\<lambda>x. -f2 x"] by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1244
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1245
lemma tendsto_add_smallo_iff:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1246
  assumes "f2 \<in> o[F](f1)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1247
  shows   "(f1 \<longlongrightarrow> a) F \<longleftrightarrow> ((\<lambda>x. f1 x + f2 x) \<longlongrightarrow> a) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1248
proof
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1249
  assume "((\<lambda>x. f1 x + f2 x) \<longlongrightarrow> a) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1250
  hence "((\<lambda>x. f1 x + f2 x - f2 x) \<longlongrightarrow> a) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1251
    by (rule tendsto_diff_smallo) (simp add: landau_o.small.plus_absorb2 assms)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1252
  thus "(f1 \<longlongrightarrow> a) F" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1253
qed (rule tendsto_add_smallo[OF _ assms])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1254
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1255
lemma tendsto_diff_smallo_iff:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1256
  shows "f2 \<in> o[F](f1) \<Longrightarrow> (f1 \<longlongrightarrow> a) F \<longleftrightarrow> ((\<lambda>x. f1 x - f2 x) \<longlongrightarrow> a) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1257
  using tendsto_add_smallo_iff[of "\<lambda>x. -f2 x" F f1 a] by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1258
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1259
lemma tendsto_divide_smallo:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1260
  assumes "((\<lambda>x. f1 x / g1 x) \<longlongrightarrow> a) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1261
  assumes "f2 \<in> o[F](f1)" "g2 \<in> o[F](g1)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1262
  assumes "eventually (\<lambda>x. g1 x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1263
  shows   "((\<lambda>x. (f1 x + f2 x) / (g1 x + g2 x)) \<longlongrightarrow> a) F" (is "(?f \<longlongrightarrow> _) _")
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1264
proof (subst tendsto_cong)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1265
  let ?f' = "\<lambda>x. (f1 x / g1 x) * (1 + f2 x / f1 x) / (1 + g2 x / g1 x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1266
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1267
  have "(?f' \<longlongrightarrow> a * (1 + 0) / (1 + 0)) F"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1268
  by (rule tendsto_mult tendsto_divide tendsto_add assms tendsto_const
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1269
        smalloD_tendsto[OF assms(2)] smalloD_tendsto[OF assms(3)])+ simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1270
  thus "(?f' \<longlongrightarrow> a) F" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1271
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1272
  have "(1/2::real) > 0" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1273
  from landau_o.smallD[OF assms(2) this] landau_o.smallD[OF assms(3) this]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1274
    have "eventually (\<lambda>x. norm (f2 x) \<le> norm (f1 x)/2) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1275
         "eventually (\<lambda>x. norm (g2 x) \<le> norm (g1 x)/2) F" by simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1276
  with assms(4) show "eventually (\<lambda>x. ?f x = ?f' x) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1277
  proof eventually_elim
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1278
    fix x assume A: "norm (f2 x) \<le> norm (f1 x)/2" and
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1279
                 B: "norm (g2 x) \<le> norm (g1 x)/2" and C: "g1 x \<noteq> 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1280
    show "?f x = ?f' x"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1281
    proof (cases "f1 x = 0")
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1282
      assume D: "f1 x \<noteq> 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1283
      from D have "f1 x + f2 x = f1 x * (1 + f2 x/f1 x)" by (simp add: field_simps)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1284
      moreover from C have "g1 x + g2 x = g1 x * (1 + g2 x/g1 x)" by (simp add: field_simps)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1285
      ultimately have "?f x = (f1 x * (1 + f2 x/f1 x)) / (g1 x * (1 + g2 x/g1 x))" by (simp only:)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1286
      also have "... = ?f' x" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1287
      finally show ?thesis .
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1288
    qed (insert A, simp)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1289
  qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1290
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1291
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1292
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1293
lemma bigo_powr:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1294
  fixes f :: "'a \<Rightarrow> real"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1295
  assumes "f \<in> O[F](g)" "p \<ge> 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1296
  shows   "(\<lambda>x. \<bar>f x\<bar> powr p) \<in> O[F](\<lambda>x. \<bar>g x\<bar> powr p)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1297
proof-
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1298
  from assms(1) obtain c where c: "c > 0" and *: "\<forall>\<^sub>F x in F. norm (f x) \<le> c * norm (g x)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1299
    by (elim landau_o.bigE landau_omega.bigE IntE)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1300
  from assms(2) * have "eventually (\<lambda>x. (norm (f x)) powr p \<le> (c * norm (g x)) powr p) F"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1301
    by (auto elim!: eventually_mono intro!: powr_mono2)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1302
  with c show "(\<lambda>x. \<bar>f x\<bar> powr p) \<in> O[F](\<lambda>x. \<bar>g x\<bar> powr p)"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1303
    by (intro bigoI[of _ "c powr p"]) (simp_all add: powr_mult)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1304
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1305
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1306
lemma smallo_powr:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1307
  fixes f :: "'a \<Rightarrow> real"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1308
  assumes "f \<in> o[F](g)" "p > 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1309
  shows   "(\<lambda>x. \<bar>f x\<bar> powr p) \<in> o[F](\<lambda>x. \<bar>g x\<bar> powr p)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1310
proof (rule landau_o.smallI)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1311
  fix c :: real assume c: "c > 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1312
  hence "c powr (1/p) > 0" by simp
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1313
  from landau_o.smallD[OF assms(1) this]
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1314
  show "eventually (\<lambda>x. norm (\<bar>f x\<bar> powr p) \<le> c * norm (\<bar>g x\<bar> powr p)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1315
  proof eventually_elim
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1316
    fix x assume "(norm (f x)) \<le> c powr (1 / p) * (norm (g x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1317
    with assms(2) have "(norm (f x)) powr p \<le> (c powr (1 / p) * (norm (g x))) powr p"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1318
      by (intro powr_mono2) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1319
    also from assms(2) c have "... = c * (norm (g x)) powr p"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1320
      by (simp add: field_simps powr_mult powr_powr)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1321
    finally show "norm (\<bar>f x\<bar> powr p) \<le> c * norm (\<bar>g x\<bar> powr p)" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1322
  qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1323
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1324
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1325
lemma smallo_powr_nonneg:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1326
  fixes f :: "'a \<Rightarrow> real"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1327
  assumes "f \<in> o[F](g)" "p > 0" "eventually (\<lambda>x. f x \<ge> 0) F" "eventually (\<lambda>x. g x \<ge> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1328
  shows   "(\<lambda>x. f x powr p) \<in> o[F](\<lambda>x. g x powr p)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1329
proof -
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1330
  from assms(3) have "(\<lambda>x. f x powr p) \<in> \<Theta>[F](\<lambda>x. \<bar>f x\<bar> powr p)"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1331
    by (intro bigthetaI_cong) (auto elim!: eventually_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1332
  also have "(\<lambda>x. \<bar>f x\<bar> powr p) \<in> o[F](\<lambda>x. \<bar>g x\<bar> powr p)" by (intro smallo_powr) fact+
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1333
  also from assms(4) have "(\<lambda>x. \<bar>g x\<bar> powr p) \<in> \<Theta>[F](\<lambda>x. g x powr p)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1334
    by (intro bigthetaI_cong) (auto elim!: eventually_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1335
  finally show ?thesis .
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1336
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1337
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1338
lemma bigtheta_powr:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1339
  fixes f :: "'a \<Rightarrow> real"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1340
  shows "f \<in> \<Theta>[F](g) \<Longrightarrow> (\<lambda>x. \<bar>f x\<bar> powr p) \<in> \<Theta>[F](\<lambda>x. \<bar>g x\<bar> powr p)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1341
apply (cases "p < 0")
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1342
apply (subst bigtheta_inverse[symmetric], subst (1 2) powr_minus[symmetric])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1343
unfolding bigtheta_def apply (auto simp: bigomega_iff_bigo intro!: bigo_powr)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1344
done
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1345
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1346
lemma bigo_powr_nonneg:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1347
  fixes f :: "'a \<Rightarrow> real"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1348
  assumes "f \<in> O[F](g)" "p \<ge> 0" "eventually (\<lambda>x. f x \<ge> 0) F" "eventually (\<lambda>x. g x \<ge> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1349
  shows   "(\<lambda>x. f x powr p) \<in> O[F](\<lambda>x. g x powr p)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1350
proof -
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1351
  from assms(3) have "(\<lambda>x. f x powr p) \<in> \<Theta>[F](\<lambda>x. \<bar>f x\<bar> powr p)"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1352
    by (intro bigthetaI_cong) (auto elim!: eventually_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1353
  also have "(\<lambda>x. \<bar>f x\<bar> powr p) \<in> O[F](\<lambda>x. \<bar>g x\<bar> powr p)" by (intro bigo_powr) fact+
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1354
  also from assms(4) have "(\<lambda>x. \<bar>g x\<bar> powr p) \<in> \<Theta>[F](\<lambda>x. g x powr p)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1355
    by (intro bigthetaI_cong) (auto elim!: eventually_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1356
  finally show ?thesis .
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1357
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1358
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1359
lemma zero_in_smallo [simp]: "(\<lambda>_. 0) \<in> o[F](f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1360
  by (intro landau_o.smallI) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1361
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1362
lemma zero_in_bigo [simp]: "(\<lambda>_. 0) \<in> O[F](f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1363
  by (intro landau_o.bigI[of 1]) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1364
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1365
lemma in_bigomega_zero [simp]: "f \<in> \<Omega>[F](\<lambda>x. 0)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1366
  by (rule landau_omega.bigI[of 1]) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1367
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1368
lemma in_smallomega_zero [simp]: "f \<in> \<omega>[F](\<lambda>x. 0)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1369
  by (simp add: smallomega_iff_smallo)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1370
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1371
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1372
lemma in_smallo_zero_iff [simp]: "f \<in> o[F](\<lambda>_. 0) \<longleftrightarrow> eventually (\<lambda>x. f x = 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1373
proof
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1374
  assume "f \<in> o[F](\<lambda>_. 0)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1375
  from landau_o.smallD[OF this, of 1] show "eventually (\<lambda>x. f x = 0) F" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1376
next
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1377
  assume "eventually (\<lambda>x. f x = 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1378
  hence "\<forall>c>0. eventually (\<lambda>x. (norm (f x)) \<le> c * \<bar>0\<bar>) F" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1379
  thus "f \<in> o[F](\<lambda>_. 0)" unfolding smallo_def by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1380
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1381
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1382
lemma in_bigo_zero_iff [simp]: "f \<in> O[F](\<lambda>_. 0) \<longleftrightarrow> eventually (\<lambda>x. f x = 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1383
proof
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1384
  assume "f \<in> O[F](\<lambda>_. 0)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1385
  thus "eventually (\<lambda>x. f x = 0) F" by (elim landau_o.bigE) simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1386
next
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1387
  assume "eventually (\<lambda>x. f x = 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1388
  hence "eventually (\<lambda>x. (norm (f x)) \<le> 1 * \<bar>0\<bar>) F" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1389
  thus "f \<in> O[F](\<lambda>_. 0)" by (intro landau_o.bigI[of 1]) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1390
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1391
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1392
lemma zero_in_smallomega_iff [simp]: "(\<lambda>_. 0) \<in> \<omega>[F](f) \<longleftrightarrow> eventually (\<lambda>x. f x = 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1393
  by (simp add: smallomega_iff_smallo)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1394
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1395
lemma zero_in_bigomega_iff [simp]: "(\<lambda>_. 0) \<in> \<Omega>[F](f) \<longleftrightarrow> eventually (\<lambda>x. f x = 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1396
  by (simp add: bigomega_iff_bigo)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1397
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1398
lemma zero_in_bigtheta_iff [simp]: "(\<lambda>_. 0) \<in> \<Theta>[F](f) \<longleftrightarrow> eventually (\<lambda>x. f x = 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1399
  unfolding bigtheta_def by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1400
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1401
lemma in_bigtheta_zero_iff [simp]: "f \<in> \<Theta>[F](\<lambda>x. 0) \<longleftrightarrow> eventually (\<lambda>x. f x = 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1402
  unfolding bigtheta_def by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1403
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1404
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1405
lemma cmult_in_bigo_iff    [simp]:  "(\<lambda>x. c * f x) \<in> O[F](g) \<longleftrightarrow> c = 0 \<or> f \<in> O[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1406
  and cmult_in_bigo_iff'   [simp]:  "(\<lambda>x. f x * c) \<in> O[F](g) \<longleftrightarrow> c = 0 \<or> f \<in> O[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1407
  and cmult_in_smallo_iff  [simp]:  "(\<lambda>x. c * f x) \<in> o[F](g) \<longleftrightarrow> c = 0 \<or> f \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1408
  and cmult_in_smallo_iff' [simp]: "(\<lambda>x. f x * c) \<in> o[F](g) \<longleftrightarrow> c = 0 \<or> f \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1409
  by (cases "c = 0", simp, simp)+
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1410
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1411
lemma bigo_const [simp]: "(\<lambda>_. c) \<in> O[F](\<lambda>_. 1)" by (rule bigoI[of _ "norm c"]) simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1412
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1413
lemma bigo_const_iff [simp]: "(\<lambda>_. c1) \<in> O[F](\<lambda>_. c2) \<longleftrightarrow> F = bot \<or> c1 = 0 \<or> c2 \<noteq> 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1414
  by (cases "c1 = 0"; cases "c2 = 0")
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1415
     (auto simp: bigo_def eventually_False intro: exI[of _ 1] exI[of _ "norm c1 / norm c2"])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1416
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1417
lemma bigomega_const_iff [simp]: "(\<lambda>_. c1) \<in> \<Omega>[F](\<lambda>_. c2) \<longleftrightarrow> F = bot \<or> c1 \<noteq> 0 \<or> c2 = 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1418
  by (cases "c1 = 0"; cases "c2 = 0")
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1419
     (auto simp: bigomega_def eventually_False mult_le_0_iff
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1420
           intro: exI[of _ 1] exI[of _ "norm c1 / norm c2"])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1421
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1422
lemma smallo_real_nat_transfer:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1423
  "(f :: real \<Rightarrow> real) \<in> o(g) \<Longrightarrow> (\<lambda>x::nat. f (real x)) \<in> o(\<lambda>x. g (real x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1424
  by (rule landau_o.small.compose[OF _ filterlim_real_sequentially])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1425
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1426
lemma bigo_real_nat_transfer:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1427
  "(f :: real \<Rightarrow> real) \<in> O(g) \<Longrightarrow> (\<lambda>x::nat. f (real x)) \<in> O(\<lambda>x. g (real x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1428
  by (rule landau_o.big.compose[OF _ filterlim_real_sequentially])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1429
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1430
lemma smallomega_real_nat_transfer:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1431
  "(f :: real \<Rightarrow> real) \<in> \<omega>(g) \<Longrightarrow> (\<lambda>x::nat. f (real x)) \<in> \<omega>(\<lambda>x. g (real x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1432
  by (rule landau_omega.small.compose[OF _ filterlim_real_sequentially])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1433
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1434
lemma bigomega_real_nat_transfer:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1435
  "(f :: real \<Rightarrow> real) \<in> \<Omega>(g) \<Longrightarrow> (\<lambda>x::nat. f (real x)) \<in> \<Omega>(\<lambda>x. g (real x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1436
  by (rule landau_omega.big.compose[OF _ filterlim_real_sequentially])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1437
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1438
lemma bigtheta_real_nat_transfer:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1439
  "(f :: real \<Rightarrow> real) \<in> \<Theta>(g) \<Longrightarrow> (\<lambda>x::nat. f (real x)) \<in> \<Theta>(\<lambda>x. g (real x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1440
  unfolding bigtheta_def using bigo_real_nat_transfer bigomega_real_nat_transfer by blast
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1441
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1442
lemmas landau_real_nat_transfer [intro] =
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1443
  bigo_real_nat_transfer smallo_real_nat_transfer bigomega_real_nat_transfer
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1444
  smallomega_real_nat_transfer bigtheta_real_nat_transfer
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1445
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1446
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1447
lemma landau_symbol_if_at_top_eq [simp]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1448
  assumes "landau_symbol L L' Lr"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1449
  shows   "L at_top (\<lambda>x::'a::linordered_semidom. if x = a then f x else g x) = L at_top (g)"
80175
200107cdd3ac Some new simprules – and patches for proofs
paulson <lp15@cam.ac.uk>
parents: 77491
diff changeset
  1450
  apply (rule landau_symbol.cong[OF assms])
200107cdd3ac Some new simprules – and patches for proofs
paulson <lp15@cam.ac.uk>
parents: 77491
diff changeset
  1451
  by (auto simp add: frequently_def eventually_at_top_linorder dest!: spec [where x= "a + 1"])
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1452
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1453
lemmas landau_symbols_if_at_top_eq [simp] = landau_symbols[THEN landau_symbol_if_at_top_eq]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1454
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1455
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1456
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1457
lemma sum_in_smallo:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1458
  assumes "f \<in> o[F](h)" "g \<in> o[F](h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1459
  shows   "(\<lambda>x. f x + g x) \<in> o[F](h)" "(\<lambda>x. f x - g x) \<in> o[F](h)"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1460
proof -
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1461
  have "(\<lambda>x. f x + g x) \<in> o[F](h)" if "f \<in> o[F](h)" "g \<in> o[F](h)" for f g
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1462
  proof (rule landau_o.smallI)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1463
    fix c :: real assume "c > 0"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1464
    hence "c/2 > 0" by simp
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1465
    from that[THEN landau_o.smallD[OF _ this]]
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1466
    show "eventually (\<lambda>x. norm (f x + g x) \<le> c * (norm (h x))) F"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1467
      by eventually_elim (auto intro: order.trans[OF norm_triangle_ineq])
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1468
  qed
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1469
  from this[of f g] this[of f "\<lambda>x. -g x"] assms
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1470
    show "(\<lambda>x. f x + g x) \<in> o[F](h)" "(\<lambda>x. f x - g x) \<in> o[F](h)" by simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1471
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1472
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1473
lemma big_sum_in_smallo:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1474
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1475
  shows   "(\<lambda>x. sum (\<lambda>y. f y x) A) \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1476
  using assms by (induction A rule: infinite_finite_induct) (auto intro: sum_in_smallo)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1477
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1478
lemma sum_in_bigo:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1479
  assumes "f \<in> O[F](h)" "g \<in> O[F](h)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1480
  shows   "(\<lambda>x. f x + g x) \<in> O[F](h)" "(\<lambda>x. f x - g x) \<in> O[F](h)"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1481
proof -
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1482
  have "(\<lambda>x. f x + g x) \<in> O[F](h)" if "f \<in> O[F](h)" "g \<in> O[F](h)" for f g
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1483
  proof -
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1484
    from that obtain c1 c2 where *: "c1 > 0" "c2 > 0"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1485
      and **: "\<forall>\<^sub>F x in F. norm (f x) \<le> c1 * norm (h x)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1486
              "\<forall>\<^sub>F x in F. norm (g x) \<le> c2 * norm (h x)"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1487
      by (elim landau_o.bigE)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1488
    from ** have "eventually (\<lambda>x. norm (f x + g x) \<le> (c1 + c2) * (norm (h x))) F"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1489
      by eventually_elim (auto simp: algebra_simps intro: order.trans[OF norm_triangle_ineq])
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1490
    then show ?thesis by (rule bigoI)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1491
  qed
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1492
  from assms this[of f g] this[of f "\<lambda>x. - g x"]
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1493
  show "(\<lambda>x. f x + g x) \<in> O[F](h)" "(\<lambda>x. f x - g x) \<in> O[F](h)" by simp_all
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1494
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1495
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1496
lemma big_sum_in_bigo:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1497
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<in> O[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1498
  shows   "(\<lambda>x. sum (\<lambda>y. f y x) A) \<in> O[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1499
  using assms by (induction A rule: infinite_finite_induct) (auto intro: sum_in_bigo)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1500
80653
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1501
lemma smallo_multiples:
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1502
  assumes f: "f \<in> o(real)" and "k>0"
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1503
  shows "(\<lambda>n. f (k * n)) \<in> o(real)"
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1504
proof (clarsimp simp: smallo_def)
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1505
  fix c::real
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1506
  assume "c>0"
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1507
  then have "c/k > 0"
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1508
    by (simp add: assms)
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1509
  with assms have "\<forall>\<^sub>F n in sequentially. \<bar>f n\<bar> \<le> c / real k * n"
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1510
    by (force simp: smallo_def del: divide_const_simps)
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1511
  then obtain N where "\<And>n. n\<ge>N \<Longrightarrow> \<bar>f n\<bar> \<le> c/k * n"
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1512
    by (meson eventually_at_top_linorder)
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1513
  then have "\<And>m. (k*m)\<ge>N \<Longrightarrow> \<bar>f (k*m)\<bar> \<le> c/k * (k*m)"
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1514
    by blast
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1515
  with \<open>k>0\<close> have "\<forall>\<^sub>F m in sequentially. \<bar>f (k*m)\<bar> \<le> c/k * (k*m)"
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1516
    by (smt (verit, del_insts) One_nat_def Suc_leI eventually_at_top_linorderI mult_1_left mult_le_mono)
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1517
  then show "\<forall>\<^sub>F n in sequentially. \<bar>f (k * n)\<bar> \<le> c * n"
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1518
    by eventually_elim (use \<open>k>0\<close> in auto)
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1519
qed
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1520
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1521
lemma maxmin_in_smallo:
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1522
  assumes "f \<in> o[F](h)" "g \<in> o[F](h)"
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1523
  shows   "(\<lambda>k. max (f k) (g k)) \<in> o[F](h)" "(\<lambda>k. min (f k) (g k)) \<in> o[F](h)"
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1524
proof -
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1525
  { fix c::real
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1526
    assume "c>0"
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1527
    with assms smallo_def
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1528
    have "\<forall>\<^sub>F x in F. norm (f x) \<le> c * norm(h x)" "\<forall>\<^sub>F x in F. norm(g x) \<le> c * norm(h x)"
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1529
      by (auto simp: smallo_def)
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1530
    then have "\<forall>\<^sub>F x in F. norm (max (f x) (g x)) \<le> c * norm(h x) \<and> norm (min (f x) (g x)) \<le> c * norm(h x)"
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1531
      by (smt (verit) eventually_elim2 max_def min_def)
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1532
  } with assms   
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1533
  show "(\<lambda>x. max (f x) (g x)) \<in> o[F](h)" "(\<lambda>x. min (f x) (g x)) \<in> o[F](h)"
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1534
    by (smt (verit) eventually_elim2 landau_o.smallI)+
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1535
qed
b98f1057da0e New library material; also fixed the spelling error powr_ge_pzero -> powr_ge_zero
paulson <lp15@cam.ac.uk>
parents: 80175
diff changeset
  1536
77491
9d431c939a7f More of Eberl's material
paulson <lp15@cam.ac.uk>
parents: 77490
diff changeset
  1537
lemma le_imp_bigo_real:
9d431c939a7f More of Eberl's material
paulson <lp15@cam.ac.uk>
parents: 77490
diff changeset
  1538
  assumes "c \<ge> 0" "eventually (\<lambda>x. f x \<le> c * (g x :: real)) F" "eventually (\<lambda>x. 0 \<le> f x) F"
9d431c939a7f More of Eberl's material
paulson <lp15@cam.ac.uk>
parents: 77490
diff changeset
  1539
  shows   "f \<in> O[F](g)"
9d431c939a7f More of Eberl's material
paulson <lp15@cam.ac.uk>
parents: 77490
diff changeset
  1540
proof -
9d431c939a7f More of Eberl's material
paulson <lp15@cam.ac.uk>
parents: 77490
diff changeset
  1541
  have "eventually (\<lambda>x. norm (f x) \<le> c * norm (g x)) F"
9d431c939a7f More of Eberl's material
paulson <lp15@cam.ac.uk>
parents: 77490
diff changeset
  1542
    using assms(2,3)
9d431c939a7f More of Eberl's material
paulson <lp15@cam.ac.uk>
parents: 77490
diff changeset
  1543
  proof eventually_elim
9d431c939a7f More of Eberl's material
paulson <lp15@cam.ac.uk>
parents: 77490
diff changeset
  1544
    case (elim x)
9d431c939a7f More of Eberl's material
paulson <lp15@cam.ac.uk>
parents: 77490
diff changeset
  1545
    have "norm (f x) \<le> c * g x" using elim by simp
9d431c939a7f More of Eberl's material
paulson <lp15@cam.ac.uk>
parents: 77490
diff changeset
  1546
    also have "\<dots> \<le> c * norm (g x)" by (intro mult_left_mono assms) auto
9d431c939a7f More of Eberl's material
paulson <lp15@cam.ac.uk>
parents: 77490
diff changeset
  1547
    finally show ?case .
9d431c939a7f More of Eberl's material
paulson <lp15@cam.ac.uk>
parents: 77490
diff changeset
  1548
  qed
9d431c939a7f More of Eberl's material
paulson <lp15@cam.ac.uk>
parents: 77490
diff changeset
  1549
  thus ?thesis by (intro bigoI[of _ c]) auto
9d431c939a7f More of Eberl's material
paulson <lp15@cam.ac.uk>
parents: 77490
diff changeset
  1550
qed
9d431c939a7f More of Eberl's material
paulson <lp15@cam.ac.uk>
parents: 77490
diff changeset
  1551
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1552
context landau_symbol
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1553
begin
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1554
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1555
lemma mult_cancel_left:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1556
  assumes "f1 \<in> \<Theta>[F](g1)" and "eventually (\<lambda>x. g1 x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1557
  notes   [trans] = bigtheta_trans1 bigtheta_trans2
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1558
  shows   "(\<lambda>x. f1 x * f2 x) \<in> L F (\<lambda>x. g1 x * g2 x) \<longleftrightarrow> f2 \<in> L F (g2)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1559
proof
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1560
  assume A: "(\<lambda>x. f1 x * f2 x) \<in> L F (\<lambda>x. g1 x * g2 x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1561
  from assms have nz: "eventually (\<lambda>x. f1 x \<noteq> 0) F" by (simp add: eventually_nonzero_bigtheta)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1562
  hence "f2 \<in> \<Theta>[F](\<lambda>x. f1 x * f2 x / f1 x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1563
    by (intro bigthetaI_cong) (auto elim!: eventually_mono)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1564
  also from A assms nz have "(\<lambda>x. f1 x * f2 x / f1 x) \<in> L F (\<lambda>x. g1 x * g2 x / f1 x)"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1565
    by (intro divide_right) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1566
  also from assms nz have "(\<lambda>x. g1 x * g2 x / f1 x) \<in> \<Theta>[F](\<lambda>x. g1 x * g2 x / g1 x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1567
    by (intro landau_theta.mult landau_theta.divide) (simp_all add: bigtheta_sym)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1568
  also from assms have "(\<lambda>x. g1 x * g2 x / g1 x) \<in> \<Theta>[F](g2)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1569
    by (intro bigthetaI_cong) (auto elim!: eventually_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1570
  finally show "f2 \<in> L F (g2)" .
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1571
next
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1572
  assume "f2 \<in> L F (g2)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1573
  hence "(\<lambda>x. f1 x * f2 x) \<in> L F (\<lambda>x. f1 x * g2 x)" by (rule mult_left)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1574
  also have "(\<lambda>x. f1 x * g2 x) \<in> \<Theta>[F](\<lambda>x. g1 x * g2 x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1575
    by (intro landau_theta.mult_right assms)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1576
  finally show "(\<lambda>x. f1 x * f2 x) \<in> L F (\<lambda>x. g1 x * g2 x)" .
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1577
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1578
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1579
lemma mult_cancel_right:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1580
  assumes "f2 \<in> \<Theta>[F](g2)" and "eventually (\<lambda>x. g2 x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1581
  shows   "(\<lambda>x. f1 x * f2 x) \<in> L F (\<lambda>x. g1 x * g2 x) \<longleftrightarrow> f1 \<in> L F (g1)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1582
  by (subst (1 2) mult.commute) (rule mult_cancel_left[OF assms])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1583
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1584
lemma divide_cancel_right:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1585
  assumes "f2 \<in> \<Theta>[F](g2)" and "eventually (\<lambda>x. g2 x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1586
  shows   "(\<lambda>x. f1 x / f2 x) \<in> L F (\<lambda>x. g1 x / g2 x) \<longleftrightarrow> f1 \<in> L F (g1)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1587
  by (subst (1 2) divide_inverse, intro mult_cancel_right bigtheta_inverse) (simp_all add: assms)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1588
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1589
lemma divide_cancel_left:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1590
  assumes "f1 \<in> \<Theta>[F](g1)" and "eventually (\<lambda>x. g1 x \<noteq> 0) F"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1591
  shows   "(\<lambda>x. f1 x / f2 x) \<in> L F (\<lambda>x. g1 x / g2 x) \<longleftrightarrow>
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1592
             (\<lambda>x. inverse (f2 x)) \<in> L F (\<lambda>x. inverse (g2 x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1593
  by (simp only: divide_inverse mult_cancel_left[OF assms])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1594
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1595
end
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1596
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1597
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1598
lemma powr_smallo_iff:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1599
  assumes "filterlim g at_top F" "F \<noteq> bot"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1600
  shows   "(\<lambda>x. g x powr p :: real) \<in> o[F](\<lambda>x. g x powr q) \<longleftrightarrow> p < q"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1601
proof-
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1602
  from assms have "eventually (\<lambda>x. g x \<ge> 1) F" by (force simp: filterlim_at_top)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1603
  hence A: "eventually (\<lambda>x. g x \<noteq> 0) F" by eventually_elim simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1604
  have B: "(\<lambda>x. g x powr q) \<in> O[F](\<lambda>x. g x powr p) \<Longrightarrow> (\<lambda>x. g x powr p) \<notin> o[F](\<lambda>x. g x powr q)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1605
  proof
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1606
    assume "(\<lambda>x. g x powr q) \<in> O[F](\<lambda>x. g x powr p)" "(\<lambda>x. g x powr p) \<in> o[F](\<lambda>x. g x powr q)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1607
    from landau_o.big_small_asymmetric[OF this] have "eventually (\<lambda>x. g x = 0) F" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1608
    with A have "eventually (\<lambda>_::'a. False) F" by eventually_elim simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1609
    thus False by (simp add: eventually_False assms)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1610
  qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1611
  show ?thesis
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1612
  proof (cases p q rule: linorder_cases)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1613
    assume "p < q"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1614
    hence "(\<lambda>x. g x powr p) \<in> o[F](\<lambda>x. g x powr q)" using assms A
68406
6beb45f6cf67 utilize 'flip'
nipkow
parents: 68246
diff changeset
  1615
      by (auto intro!: smalloI_tendsto tendsto_neg_powr simp flip: powr_diff)
69272
15e9ed5b28fb isabelle update_cartouches -t;
wenzelm
parents: 68696
diff changeset
  1616
    with \<open>p < q\<close> show ?thesis by auto
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1617
  next
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1618
    assume "p = q"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1619
    hence "(\<lambda>x. g x powr q) \<in> O[F](\<lambda>x. g x powr p)" by (auto intro!: bigthetaD1)
69272
15e9ed5b28fb isabelle update_cartouches -t;
wenzelm
parents: 68696
diff changeset
  1620
    with B \<open>p = q\<close> show ?thesis by auto
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1621
  next
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1622
    assume "p > q"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1623
    hence "(\<lambda>x. g x powr q) \<in> O[F](\<lambda>x. g x powr p)" using assms A
68406
6beb45f6cf67 utilize 'flip'
nipkow
parents: 68246
diff changeset
  1624
      by (auto intro!: smalloI_tendsto tendsto_neg_powr landau_o.small_imp_big simp flip: powr_diff)
69272
15e9ed5b28fb isabelle update_cartouches -t;
wenzelm
parents: 68696
diff changeset
  1625
    with B \<open>p > q\<close> show ?thesis by auto
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1626
  qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1627
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1628
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1629
lemma powr_bigo_iff:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1630
  assumes "filterlim g at_top F" "F \<noteq> bot"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1631
  shows   "(\<lambda>x. g x powr p :: real) \<in> O[F](\<lambda>x. g x powr q) \<longleftrightarrow> p \<le> q"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1632
proof-
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1633
  from assms have "eventually (\<lambda>x. g x \<ge> 1) F" by (force simp: filterlim_at_top)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1634
  hence A: "eventually (\<lambda>x. g x \<noteq> 0) F" by eventually_elim simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1635
  have B: "(\<lambda>x. g x powr q) \<in> o[F](\<lambda>x. g x powr p) \<Longrightarrow> (\<lambda>x. g x powr p) \<notin> O[F](\<lambda>x. g x powr q)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1636
  proof
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1637
    assume "(\<lambda>x. g x powr q) \<in> o[F](\<lambda>x. g x powr p)" "(\<lambda>x. g x powr p) \<in> O[F](\<lambda>x. g x powr q)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1638
    from landau_o.small_big_asymmetric[OF this] have "eventually (\<lambda>x. g x = 0) F" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1639
    with A have "eventually (\<lambda>_::'a. False) F" by eventually_elim simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1640
    thus False by (simp add: eventually_False assms)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1641
  qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1642
  show ?thesis
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1643
  proof (cases p q rule: linorder_cases)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1644
    assume "p < q"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1645
    hence "(\<lambda>x. g x powr p) \<in> o[F](\<lambda>x. g x powr q)" using assms A
68406
6beb45f6cf67 utilize 'flip'
nipkow
parents: 68246
diff changeset
  1646
      by (auto intro!: smalloI_tendsto tendsto_neg_powr simp flip: powr_diff)
69272
15e9ed5b28fb isabelle update_cartouches -t;
wenzelm
parents: 68696
diff changeset
  1647
    with \<open>p < q\<close> show ?thesis by (auto intro: landau_o.small_imp_big)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1648
  next
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1649
    assume "p = q"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1650
    hence "(\<lambda>x. g x powr q) \<in> O[F](\<lambda>x. g x powr p)" by (auto intro!: bigthetaD1)
69272
15e9ed5b28fb isabelle update_cartouches -t;
wenzelm
parents: 68696
diff changeset
  1651
    with B \<open>p = q\<close> show ?thesis by auto
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1652
  next
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1653
    assume "p > q"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1654
    hence "(\<lambda>x. g x powr q) \<in> o[F](\<lambda>x. g x powr p)" using assms A
68406
6beb45f6cf67 utilize 'flip'
nipkow
parents: 68246
diff changeset
  1655
      by (auto intro!: smalloI_tendsto tendsto_neg_powr simp flip: powr_diff)
69272
15e9ed5b28fb isabelle update_cartouches -t;
wenzelm
parents: 68696
diff changeset
  1656
    with B \<open>p > q\<close> show ?thesis by (auto intro: landau_o.small_imp_big)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1657
  qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1658
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1659
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1660
lemma powr_bigtheta_iff:
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1661
  assumes "filterlim g at_top F" "F \<noteq> bot"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1662
  shows   "(\<lambda>x. g x powr p :: real) \<in> \<Theta>[F](\<lambda>x. g x powr q) \<longleftrightarrow> p = q"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1663
  using assms unfolding bigtheta_def by (auto simp: bigomega_iff_bigo powr_bigo_iff)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1664
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1665
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1666
subsection \<open>Flatness of real functions\<close>
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1667
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1668
text \<open>
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1669
  Given two real-valued functions $f$ and $g$, we say that $f$ is flatter than $g$ if
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1670
  any power of $f(x)$ is asymptotically dominated by any positive power of $g(x)$. This is
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1671
  a useful notion since, given two products of powers of functions sorted by flatness, we can
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1672
  compare them asymptotically by simply comparing the exponent lists lexicographically.
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1673
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1674
  A simple sufficient criterion for flatness it that $\ln f(x) \in o(\ln g(x))$, which we show
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1675
  now.
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1676
\<close>
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1677
lemma ln_smallo_imp_flat:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1678
  fixes f g :: "real \<Rightarrow> real"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1679
  assumes lim_f: "filterlim f at_top at_top"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1680
  assumes lim_g: "filterlim g at_top at_top"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1681
  assumes ln_o_ln: "(\<lambda>x. ln (f x)) \<in> o(\<lambda>x. ln (g x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1682
  assumes q: "q > 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1683
  shows   "(\<lambda>x. f x powr p) \<in> o(\<lambda>x. g x powr q)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1684
proof (rule smalloI_tendsto)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1685
  from lim_f have "eventually (\<lambda>x. f x > 0) at_top"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1686
    by (simp add: filterlim_at_top_dense)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1687
  hence f_nz: "eventually (\<lambda>x. f x \<noteq> 0) at_top" by eventually_elim simp
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1688
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1689
  from lim_g have g_gt_1: "eventually (\<lambda>x. g x > 1) at_top"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1690
    by (simp add: filterlim_at_top_dense)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1691
  hence g_nz: "eventually (\<lambda>x. g x \<noteq> 0) at_top" by eventually_elim simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1692
  thus "eventually (\<lambda>x. g x powr q \<noteq> 0) at_top"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1693
    by eventually_elim simp
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1694
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1695
  have eq: "eventually (\<lambda>x. q * (p/q * (ln (f x) / ln (g x)) - 1) * ln (g x) =
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1696
                          p * ln (f x) - q * ln (g x)) at_top"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1697
    using g_gt_1 by eventually_elim (insert q, simp_all add: field_simps)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1698
  have "filterlim (\<lambda>x. q * (p/q * (ln (f x) / ln (g x)) - 1) * ln (g x)) at_bot at_top"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1699
    by (insert q)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1700
       (rule filterlim_tendsto_neg_mult_at_bot tendsto_mult
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1701
              tendsto_const tendsto_diff smalloD_tendsto[OF ln_o_ln] lim_g
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1702
              filterlim_compose[OF ln_at_top] | simp)+
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1703
  hence "filterlim (\<lambda>x. p * ln (f x) - q * ln (g x)) at_bot at_top"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1704
    by (subst (asm) filterlim_cong[OF refl refl eq])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1705
  hence *: "((\<lambda>x. exp (p * ln (f x) - q * ln (g x))) \<longlongrightarrow> 0) at_top"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1706
    by (rule filterlim_compose[OF exp_at_bot])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1707
  have eq: "eventually (\<lambda>x. exp (p * ln (f x) - q * ln (g x)) = f x powr p / g x powr q) at_top"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1708
    using f_nz g_nz by eventually_elim (simp add: powr_def exp_diff)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1709
  show "((\<lambda>x. f x powr p / g x powr q) \<longlongrightarrow> 0) at_top"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1710
    using * by (subst (asm) filterlim_cong[OF refl refl eq])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1711
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1712
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1713
lemma ln_smallo_imp_flat':
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1714
  fixes f g :: "real \<Rightarrow> real"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1715
  assumes lim_f: "filterlim f at_top at_top"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1716
  assumes lim_g: "filterlim g at_top at_top"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1717
  assumes ln_o_ln: "(\<lambda>x. ln (f x)) \<in> o(\<lambda>x. ln (g x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1718
  assumes q: "q < 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1719
  shows   "(\<lambda>x. g x powr q) \<in> o(\<lambda>x. f x powr p)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1720
proof -
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1721
  from lim_f lim_g have "eventually (\<lambda>x. f x > 0) at_top" "eventually (\<lambda>x. g x > 0) at_top"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1722
    by (simp_all add: filterlim_at_top_dense)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1723
  hence "eventually (\<lambda>x. f x \<noteq> 0) at_top" "eventually (\<lambda>x. g x \<noteq> 0) at_top"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1724
    by (auto elim: eventually_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1725
  moreover from assms have "(\<lambda>x. f x powr -p) \<in> o(\<lambda>x. g x powr -q)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1726
    by (intro ln_smallo_imp_flat assms) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1727
  ultimately show ?thesis unfolding powr_minus
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1728
    by (simp add: landau_o.small.inverse_cancel)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1729
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1730
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1731
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1732
subsection \<open>Asymptotic Equivalence\<close>
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1733
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1734
named_theorems asymp_equiv_intros
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1735
named_theorems asymp_equiv_simps
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1736
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1737
definition asymp_equiv :: "('a \<Rightarrow> ('b :: real_normed_field)) \<Rightarrow> 'a filter \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> bool"
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69272
diff changeset
  1738
  (\<open>_ \<sim>[_] _\<close> [51, 10, 51] 50)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1739
  where "f \<sim>[F] g \<longleftrightarrow> ((\<lambda>x. if f x = 0 \<and> g x = 0 then 1 else f x / g x) \<longlongrightarrow> 1) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1740
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1741
abbreviation (input) asymp_equiv_at_top where
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1742
  "asymp_equiv_at_top f g \<equiv> f \<sim>[at_top] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1743
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1744
bundle asymp_equiv_notation
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1745
begin
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1746
notation asymp_equiv_at_top (infix \<open>\<sim>\<close> 50)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1747
end
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1748
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1749
lemma asymp_equivI: "((\<lambda>x. if f x = 0 \<and> g x = 0 then 1 else f x / g x) \<longlongrightarrow> 1) F \<Longrightarrow> f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1750
  by (simp add: asymp_equiv_def)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1751
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1752
lemma asymp_equivD: "f \<sim>[F] g \<Longrightarrow> ((\<lambda>x. if f x = 0 \<and> g x = 0 then 1 else f x / g x) \<longlongrightarrow> 1) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1753
  by (simp add: asymp_equiv_def)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1754
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1755
lemma asymp_equiv_filtermap_iff:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1756
  "f \<sim>[filtermap h F] g \<longleftrightarrow> (\<lambda>x. f (h x)) \<sim>[F] (\<lambda>x. g (h x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1757
  by (simp add: asymp_equiv_def filterlim_filtermap)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1758
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1759
lemma asymp_equiv_refl [simp, asymp_equiv_intros]: "f \<sim>[F] f"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1760
proof (intro asymp_equivI)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1761
  have "eventually (\<lambda>x. 1 = (if f x = 0 \<and> f x = 0 then 1 else f x / f x)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1762
    by (intro always_eventually) simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1763
  moreover have "((\<lambda>_. 1) \<longlongrightarrow> 1) F" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1764
  ultimately show "((\<lambda>x. if f x = 0 \<and> f x = 0 then 1 else f x / f x) \<longlongrightarrow> 1) F"
70688
3d894e1cfc75 new material on Analysis, plus some rearrangements
paulson <lp15@cam.ac.uk>
parents: 70532
diff changeset
  1765
    by (simp add: tendsto_eventually)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1766
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1767
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1768
lemma asymp_equiv_symI:
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1769
  assumes "f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1770
  shows   "g \<sim>[F] f"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1771
  using tendsto_inverse[OF asymp_equivD[OF assms]]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1772
  by (auto intro!: asymp_equivI simp: if_distrib conj_commute cong: if_cong)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1773
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1774
lemma asymp_equiv_sym: "f \<sim>[F] g \<longleftrightarrow> g \<sim>[F] f"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1775
  by (blast intro: asymp_equiv_symI)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1776
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1777
lemma asymp_equivI':
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1778
  assumes "((\<lambda>x. f x / g x) \<longlongrightarrow> 1) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1779
  shows   "f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1780
proof (cases "F = bot")
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1781
  case False
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1782
  have "eventually (\<lambda>x. f x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1783
  proof (rule ccontr)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1784
    assume "\<not>eventually (\<lambda>x. f x \<noteq> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1785
    hence "frequently (\<lambda>x. f x = 0) F" by (simp add: frequently_def)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1786
    hence "frequently (\<lambda>x. f x / g x = 0) F" by (auto elim!: frequently_elim1)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1787
    from limit_frequently_eq[OF False this assms] show False by simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1788
  qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1789
  hence "eventually (\<lambda>x. f x / g x = (if f x = 0 \<and> g x = 0 then 1 else f x / g x)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1790
    by eventually_elim simp
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1791
  with assms show "f \<sim>[F] g" unfolding asymp_equiv_def
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1792
    by (rule Lim_transform_eventually)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1793
qed (simp_all add: asymp_equiv_def)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1794
77277
c6b50597abbc More of Eberl's contributions: memomorphic functions
paulson <lp15@cam.ac.uk>
parents: 77200
diff changeset
  1795
lemma tendsto_imp_asymp_equiv_const:
c6b50597abbc More of Eberl's contributions: memomorphic functions
paulson <lp15@cam.ac.uk>
parents: 77200
diff changeset
  1796
  assumes "(f \<longlongrightarrow> c) F" "c \<noteq> 0"
c6b50597abbc More of Eberl's contributions: memomorphic functions
paulson <lp15@cam.ac.uk>
parents: 77200
diff changeset
  1797
  shows   "f \<sim>[F] (\<lambda>_. c)"
c6b50597abbc More of Eberl's contributions: memomorphic functions
paulson <lp15@cam.ac.uk>
parents: 77200
diff changeset
  1798
  by (rule asymp_equivI' tendsto_eq_intros assms refl)+ (use assms in auto)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1799
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1800
lemma asymp_equiv_cong:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1801
  assumes "eventually (\<lambda>x. f1 x = f2 x) F" "eventually (\<lambda>x. g1 x = g2 x) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1802
  shows   "f1 \<sim>[F] g1 \<longleftrightarrow> f2 \<sim>[F] g2"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1803
  unfolding asymp_equiv_def
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1804
proof (rule tendsto_cong, goal_cases)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1805
  case 1
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1806
  from assms show ?case by eventually_elim simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1807
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1808
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1809
lemma asymp_equiv_eventually_zeros:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1810
  fixes f g :: "'a \<Rightarrow> 'b :: real_normed_field"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1811
  assumes "f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1812
  shows   "eventually (\<lambda>x. f x = 0 \<longleftrightarrow> g x = 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1813
proof -
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1814
  let ?h = "\<lambda>x. if f x = 0 \<and> g x = 0 then 1 else f x / g x"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1815
  have "eventually (\<lambda>x. x \<noteq> 0) (nhds (1::'b))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1816
    by (rule t1_space_nhds) auto
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1817
  hence "eventually (\<lambda>x. x \<noteq> 0) (filtermap ?h F)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1818
    using assms unfolding asymp_equiv_def filterlim_def
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1819
    by (rule filter_leD [rotated])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1820
  hence "eventually (\<lambda>x. ?h x \<noteq> 0) F" by (simp add: eventually_filtermap)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1821
  thus ?thesis by eventually_elim (auto split: if_splits)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1822
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1823
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1824
lemma asymp_equiv_transfer:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1825
  assumes "f1 \<sim>[F] g1" "eventually (\<lambda>x. f1 x = f2 x) F" "eventually (\<lambda>x. g1 x = g2 x) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1826
  shows   "f2 \<sim>[F] g2"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1827
  using assms(1) asymp_equiv_cong[OF assms(2,3)] by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1828
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1829
lemma asymp_equiv_transfer_trans [trans]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1830
  assumes "(\<lambda>x. f x (h1 x)) \<sim>[F] (\<lambda>x. g x (h1 x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1831
  assumes "eventually (\<lambda>x. h1 x = h2 x) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1832
  shows   "(\<lambda>x. f x (h2 x)) \<sim>[F] (\<lambda>x. g x (h2 x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1833
  by (rule asymp_equiv_transfer[OF assms(1)]) (insert assms(2), auto elim!: eventually_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1834
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1835
lemma asymp_equiv_trans [trans]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1836
  fixes f g h
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1837
  assumes "f \<sim>[F] g" "g \<sim>[F] h"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1838
  shows   "f \<sim>[F] h"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1839
proof -
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1840
  let ?T = "\<lambda>f g x. if f x = 0 \<and> g x = 0 then 1 else f x / g x"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1841
  from tendsto_mult[OF assms[THEN asymp_equivD]]
70532
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
  1842
  have "((\<lambda>x. ?T f g x * ?T g h x) \<longlongrightarrow> 1) F" by simp
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
  1843
  moreover from assms[THEN asymp_equiv_eventually_zeros]
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
  1844
  have "eventually (\<lambda>x. ?T f g x * ?T g h x = ?T f h x) F" by eventually_elim simp
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1845
  ultimately show ?thesis unfolding asymp_equiv_def by (rule Lim_transform_eventually)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1846
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1847
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1848
lemma asymp_equiv_trans_lift1 [trans]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1849
  assumes "a \<sim>[F] f b" "b \<sim>[F] c" "\<And>c d. c \<sim>[F] d \<Longrightarrow> f c \<sim>[F] f d"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1850
  shows   "a \<sim>[F] f c"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1851
  using assms by (blast intro: asymp_equiv_trans)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1852
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1853
lemma asymp_equiv_trans_lift2 [trans]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1854
  assumes "f a \<sim>[F] b" "a \<sim>[F] c" "\<And>c d. c \<sim>[F] d \<Longrightarrow> f c \<sim>[F] f d"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1855
  shows   "f c \<sim>[F] b"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1856
  using asymp_equiv_symI[OF assms(3)[OF assms(2)]] assms(1)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1857
  by (blast intro: asymp_equiv_trans)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1858
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1859
lemma asymp_equivD_const:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1860
  assumes "f \<sim>[F] (\<lambda>_. c)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1861
  shows   "(f \<longlongrightarrow> c) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1862
proof (cases "c = 0")
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1863
  case False
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1864
  with tendsto_mult_right[OF asymp_equivD[OF assms], of c] show ?thesis by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1865
next
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1866
  case True
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1867
  with asymp_equiv_eventually_zeros[OF assms] show ?thesis
70365
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
  1868
    by (simp add: tendsto_eventually)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1869
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1870
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1871
lemma asymp_equiv_refl_ev:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1872
  assumes "eventually (\<lambda>x. f x = g x) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1873
  shows   "f \<sim>[F] g"
70365
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
  1874
  by (intro asymp_equivI tendsto_eventually)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1875
     (insert assms, auto elim!: eventually_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1876
77200
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
  1877
lemma asymp_equiv_nhds_iff: "f \<sim>[nhds (z :: 'a :: t1_space)] g \<longleftrightarrow> f \<sim>[at z] g \<and> f z = g z"
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
  1878
  by (auto simp: asymp_equiv_def tendsto_nhds_iff)
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
  1879
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1880
lemma asymp_equiv_sandwich:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1881
  fixes f g h :: "'a \<Rightarrow> 'b :: {real_normed_field, order_topology, linordered_field}"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1882
  assumes "eventually (\<lambda>x. f x \<ge> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1883
  assumes "eventually (\<lambda>x. f x \<le> g x) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1884
  assumes "eventually (\<lambda>x. g x \<le> h x) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1885
  assumes "f \<sim>[F] h"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1886
  shows   "g \<sim>[F] f" "g \<sim>[F] h"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1887
proof -
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1888
  show "g \<sim>[F] f"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1889
  proof (rule asymp_equivI, rule tendsto_sandwich)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1890
    from assms(1-3) asymp_equiv_eventually_zeros[OF assms(4)]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1891
      show "eventually (\<lambda>n. (if h n = 0 \<and> f n = 0 then 1 else h n / f n) \<ge>
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1892
                              (if g n = 0 \<and> f n = 0 then 1 else g n / f n)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1893
        by eventually_elim (auto intro!: divide_right_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1894
    from assms(1-3) asymp_equiv_eventually_zeros[OF assms(4)]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1895
      show "eventually (\<lambda>n. 1 \<le>
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1896
                              (if g n = 0 \<and> f n = 0 then 1 else g n / f n)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1897
        by eventually_elim (auto intro!: divide_right_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1898
  qed (insert asymp_equiv_symI[OF assms(4)], simp_all add: asymp_equiv_def)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1899
  also note \<open>f \<sim>[F] h\<close>
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1900
  finally show "g \<sim>[F] h" .
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1901
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1902
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1903
lemma asymp_equiv_imp_eventually_same_sign:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1904
  fixes f g :: "real \<Rightarrow> real"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1905
  assumes "f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1906
  shows   "eventually (\<lambda>x. sgn (f x) = sgn (g x)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1907
proof -
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1908
  from assms have "((\<lambda>x. sgn (if f x = 0 \<and> g x = 0 then 1 else f x / g x)) \<longlongrightarrow> sgn 1) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1909
    unfolding asymp_equiv_def by (rule tendsto_sgn) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1910
  from order_tendstoD(1)[OF this, of "1/2"]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1911
    have "eventually (\<lambda>x. sgn (if f x = 0 \<and> g x = 0 then 1 else f x / g x) > 1/2) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1912
    by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1913
  thus "eventually (\<lambda>x. sgn (f x) = sgn (g x)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1914
  proof eventually_elim
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1915
    case (elim x)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1916
    thus ?case
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1917
      by (cases "f x" "0 :: real" rule: linorder_cases;
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1918
          cases "g x" "0 :: real" rule: linorder_cases) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1919
  qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1920
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1921
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1922
lemma
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1923
  fixes f g :: "_ \<Rightarrow> real"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1924
  assumes "f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1925
  shows   asymp_equiv_eventually_same_sign: "eventually (\<lambda>x. sgn (f x) = sgn (g x)) F" (is ?th1)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1926
    and   asymp_equiv_eventually_neg_iff:   "eventually (\<lambda>x. f x < 0 \<longleftrightarrow> g x < 0) F" (is ?th2)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1927
    and   asymp_equiv_eventually_pos_iff:   "eventually (\<lambda>x. f x > 0 \<longleftrightarrow> g x > 0) F" (is ?th3)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1928
proof -
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1929
  from assms have "filterlim (\<lambda>x. if f x = 0 \<and> g x = 0 then 1 else f x / g x) (nhds 1) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1930
    by (rule asymp_equivD)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1931
  from order_tendstoD(1)[OF this zero_less_one]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1932
    show ?th1 ?th2 ?th3
70817
dd675800469d dedicated fact collections for algebraic simplification rules potentially splitting goals
haftmann
parents: 70688
diff changeset
  1933
    by (eventually_elim; force simp: sgn_if field_split_simps split: if_splits)+
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1934
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1935
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1936
lemma asymp_equiv_tendsto_transfer:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1937
  assumes "f \<sim>[F] g" and "(f \<longlongrightarrow> c) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1938
  shows   "(g \<longlongrightarrow> c) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1939
proof -
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1940
  let ?h = "\<lambda>x. (if g x = 0 \<and> f x = 0 then 1 else g x / f x) * f x"
70532
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
  1941
  from assms(1) have "g \<sim>[F] f" by (rule asymp_equiv_symI)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1942
  hence "filterlim (\<lambda>x. if g x = 0 \<and> f x = 0 then 1 else g x / f x) (nhds 1) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1943
    by (rule asymp_equivD)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1944
  from tendsto_mult[OF this assms(2)] have "(?h \<longlongrightarrow> c) F" by simp
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1945
  moreover
70532
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
  1946
  have "eventually (\<lambda>x. ?h x = g x) F"
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
  1947
    using asymp_equiv_eventually_zeros[OF assms(1)] by eventually_elim simp
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
  1948
  ultimately show ?thesis
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
  1949
    by (rule Lim_transform_eventually)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1950
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1951
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1952
lemma tendsto_asymp_equiv_cong:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1953
  assumes "f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1954
  shows   "(f \<longlongrightarrow> c) F \<longleftrightarrow> (g \<longlongrightarrow> c) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1955
proof -
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1956
  have "(f \<longlongrightarrow> c * 1) F" if fg: "f \<sim>[F] g" and "(g \<longlongrightarrow> c) F" for f g :: "'a \<Rightarrow> 'b"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1957
  proof -
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1958
    from that have *: "((\<lambda>x. g x * (if f x = 0 \<and> g x = 0 then 1 else f x / g x)) \<longlongrightarrow> c * 1) F"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1959
      by (intro tendsto_intros asymp_equivD)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1960
    have "eventually (\<lambda>x. g x * (if f x = 0 \<and> g x = 0 then 1 else f x / g x) = f x) F"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1961
      using asymp_equiv_eventually_zeros[OF fg] by eventually_elim simp
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1962
    with * show ?thesis by (rule Lim_transform_eventually)
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1963
  qed
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1964
  from this[of f g] this[of g f] assms show ?thesis by (auto simp: asymp_equiv_sym)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1965
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1966
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1967
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1968
lemma smallo_imp_eventually_sgn:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1969
  fixes f g :: "real \<Rightarrow> real"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1970
  assumes "g \<in> o(f)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1971
  shows   "eventually (\<lambda>x. sgn (f x + g x) = sgn (f x)) at_top"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1972
proof -
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1973
  have "0 < (1/2 :: real)" by simp
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1974
  from landau_o.smallD[OF assms, OF this]
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1975
    have "eventually (\<lambda>x. \<bar>g x\<bar> \<le> 1/2 * \<bar>f x\<bar>) at_top" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1976
  thus ?thesis
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1977
  proof eventually_elim
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1978
    case (elim x)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1979
    thus ?case
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  1980
      by (cases "f x" "0::real" rule: linorder_cases;
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1981
          cases "f x + g x" "0::real" rule: linorder_cases) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1982
  qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1983
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1984
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1985
context
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1986
begin
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1987
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1988
private lemma asymp_equiv_add_rightI:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1989
  assumes "f \<sim>[F] g" "h \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1990
  shows   "(\<lambda>x. f x + h x) \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1991
proof -
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1992
  let ?T = "\<lambda>f g x. if f x = 0 \<and> g x = 0 then 1 else f x / g x"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1993
  from landau_o.smallD[OF assms(2) zero_less_one]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1994
    have ev: "eventually (\<lambda>x. g x = 0 \<longrightarrow> h x = 0) F" by eventually_elim auto
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1995
  have "(\<lambda>x. f x + h x) \<sim>[F] g \<longleftrightarrow> ((\<lambda>x. ?T f g x + h x / g x) \<longlongrightarrow> 1) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1996
    unfolding asymp_equiv_def using ev
70817
dd675800469d dedicated fact collections for algebraic simplification rules potentially splitting goals
haftmann
parents: 70688
diff changeset
  1997
    by (intro tendsto_cong) (auto elim!: eventually_mono simp: field_split_simps)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1998
  also have "\<dots> \<longleftrightarrow> ((\<lambda>x. ?T f g x + h x / g x) \<longlongrightarrow> 1 + 0) F" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  1999
  also have \<dots> by (intro tendsto_intros asymp_equivD assms smalloD_tendsto)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2000
  finally show "(\<lambda>x. f x + h x) \<sim>[F] g" .
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2001
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2002
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2003
lemma asymp_equiv_add_right [asymp_equiv_simps]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2004
  assumes "h \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2005
  shows   "(\<lambda>x. f x + h x) \<sim>[F] g \<longleftrightarrow> f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2006
proof
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2007
  assume "(\<lambda>x. f x + h x) \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2008
  from asymp_equiv_add_rightI[OF this, of "\<lambda>x. -h x"] assms show "f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2009
    by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2010
qed (simp_all add: asymp_equiv_add_rightI assms)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2011
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2012
end
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2013
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  2014
lemma asymp_equiv_add_left [asymp_equiv_simps]:
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2015
  assumes "h \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2016
  shows   "(\<lambda>x. h x + f x) \<sim>[F] g \<longleftrightarrow> f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2017
  using asymp_equiv_add_right[OF assms] by (simp add: add.commute)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2018
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2019
lemma asymp_equiv_add_right' [asymp_equiv_simps]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2020
  assumes "h \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2021
  shows   "g \<sim>[F] (\<lambda>x. f x + h x) \<longleftrightarrow> g \<sim>[F] f"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2022
  using asymp_equiv_add_right[OF assms] by (simp add: asymp_equiv_sym)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  2023
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2024
lemma asymp_equiv_add_left' [asymp_equiv_simps]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2025
  assumes "h \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2026
  shows   "g \<sim>[F] (\<lambda>x. h x + f x) \<longleftrightarrow> g \<sim>[F] f"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2027
  using asymp_equiv_add_left[OF assms] by (simp add: asymp_equiv_sym)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2028
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2029
lemma smallo_imp_asymp_equiv:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2030
  assumes "(\<lambda>x. f x - g x) \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2031
  shows   "f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2032
proof -
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2033
  from assms have "(\<lambda>x. f x - g x + g x) \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2034
    by (subst asymp_equiv_add_left) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2035
  thus ?thesis by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2036
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2037
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2038
lemma asymp_equiv_uminus [asymp_equiv_intros]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2039
  "f \<sim>[F] g \<Longrightarrow> (\<lambda>x. -f x) \<sim>[F] (\<lambda>x. -g x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2040
  by (simp add: asymp_equiv_def cong: if_cong)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2041
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2042
lemma asymp_equiv_uminus_iff [asymp_equiv_simps]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2043
  "(\<lambda>x. -f x) \<sim>[F] g \<longleftrightarrow> f \<sim>[F] (\<lambda>x. -g x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2044
  by (simp add: asymp_equiv_def cong: if_cong)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2045
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2046
lemma asymp_equiv_mult [asymp_equiv_intros]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2047
  fixes f1 f2 g1 g2 :: "'a \<Rightarrow> 'b :: real_normed_field"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2048
  assumes "f1 \<sim>[F] g1" "f2 \<sim>[F] g2"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2049
  shows   "(\<lambda>x. f1 x * f2 x) \<sim>[F] (\<lambda>x. g1 x * g2 x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2050
proof -
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2051
  let ?T = "\<lambda>f g x. if f x = 0 \<and> g x = 0 then 1 else f x / g x"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2052
  let ?S = "\<lambda>x. (if f1 x = 0 \<and> g1 x = 0 then 1 - ?T f2 g2 x
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2053
                   else if f2 x = 0 \<and> g2 x = 0 then 1 - ?T f1 g1 x else 0)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2054
  let ?S' = "\<lambda>x. ?T (\<lambda>x. f1 x * f2 x) (\<lambda>x. g1 x * g2 x) x - ?T f1 g1 x * ?T f2 g2 x"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  2055
  have A: "((\<lambda>x. 1 - ?T f g x) \<longlongrightarrow> 0) F" if "f \<sim>[F] g" for f g :: "'a \<Rightarrow> 'b"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  2056
    by (rule tendsto_eq_intros refl asymp_equivD[OF that])+ simp_all
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  2057
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  2058
  from assms have *: "((\<lambda>x. ?T f1 g1 x * ?T f2 g2 x) \<longlongrightarrow> 1 * 1) F"
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  2059
    by (intro tendsto_mult asymp_equivD)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2060
  {
70532
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
  2061
    have "(?S \<longlongrightarrow> 0) F"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2062
      by (intro filterlim_If assms[THEN A, THEN tendsto_mono[rotated]])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2063
         (auto intro: le_infI1 le_infI2)
70532
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
  2064
    moreover have "eventually (\<lambda>x. ?S x = ?S' x) F"
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
  2065
      using assms[THEN asymp_equiv_eventually_zeros] by eventually_elim auto
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2066
    ultimately have "(?S' \<longlongrightarrow> 0) F" by (rule Lim_transform_eventually)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2067
  }
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  2068
  with * have "(?T (\<lambda>x. f1 x * f2 x) (\<lambda>x. g1 x * g2 x) \<longlongrightarrow> 1 * 1) F"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2069
    by (rule Lim_transform)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  2070
  then show ?thesis by (simp add: asymp_equiv_def)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2071
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2072
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2073
lemma asymp_equiv_power [asymp_equiv_intros]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2074
  "f \<sim>[F] g \<Longrightarrow> (\<lambda>x. f x ^ n) \<sim>[F] (\<lambda>x. g x ^ n)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2075
  by (induction n) (simp_all add: asymp_equiv_mult)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2076
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2077
lemma asymp_equiv_inverse [asymp_equiv_intros]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2078
  assumes "f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2079
  shows   "(\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2080
proof -
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2081
  from tendsto_inverse[OF asymp_equivD[OF assms]]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2082
    have "((\<lambda>x. if f x = 0 \<and> g x = 0 then 1 else g x / f x) \<longlongrightarrow> 1) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2083
    by (simp add: if_distrib cong: if_cong)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2084
  also have "(\<lambda>x. if f x = 0 \<and> g x = 0 then 1 else g x / f x) =
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2085
               (\<lambda>x. if f x = 0 \<and> g x = 0 then 1 else inverse (f x) / inverse (g x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2086
    by (intro ext) (simp add: field_simps)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2087
  finally show ?thesis by (simp add: asymp_equiv_def)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2088
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2089
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2090
lemma asymp_equiv_inverse_iff [asymp_equiv_simps]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2091
  "(\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x)) \<longleftrightarrow> f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2092
proof
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2093
  assume "(\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2094
  hence "(\<lambda>x. inverse (inverse (f x))) \<sim>[F] (\<lambda>x. inverse (inverse (g x)))" (is ?P)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2095
    by (rule asymp_equiv_inverse)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2096
  also have "?P \<longleftrightarrow> f \<sim>[F] g" by (intro asymp_equiv_cong) simp_all
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2097
  finally show "f \<sim>[F] g" .
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2098
qed (simp_all add: asymp_equiv_inverse)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2099
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2100
lemma asymp_equiv_divide [asymp_equiv_intros]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2101
  assumes "f1 \<sim>[F] g1" "f2 \<sim>[F] g2"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2102
  shows   "(\<lambda>x. f1 x / f2 x) \<sim>[F] (\<lambda>x. g1 x / g2 x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2103
  using asymp_equiv_mult[OF assms(1) asymp_equiv_inverse[OF assms(2)]] by (simp add: field_simps)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2104
77490
2c86ea8961b5 Some new lemmas. Some tidying up
paulson <lp15@cam.ac.uk>
parents: 77277
diff changeset
  2105
lemma asymp_equivD_strong:
2c86ea8961b5 Some new lemmas. Some tidying up
paulson <lp15@cam.ac.uk>
parents: 77277
diff changeset
  2106
  assumes "f \<sim>[F] g" "eventually (\<lambda>x. f x \<noteq> 0 \<or> g x \<noteq> 0) F"
2c86ea8961b5 Some new lemmas. Some tidying up
paulson <lp15@cam.ac.uk>
parents: 77277
diff changeset
  2107
  shows   "((\<lambda>x. f x / g x) \<longlongrightarrow> 1) F"
2c86ea8961b5 Some new lemmas. Some tidying up
paulson <lp15@cam.ac.uk>
parents: 77277
diff changeset
  2108
proof -
2c86ea8961b5 Some new lemmas. Some tidying up
paulson <lp15@cam.ac.uk>
parents: 77277
diff changeset
  2109
  from assms(1) have "((\<lambda>x. if f x = 0 \<and> g x = 0 then 1 else f x / g x) \<longlongrightarrow> 1) F"
2c86ea8961b5 Some new lemmas. Some tidying up
paulson <lp15@cam.ac.uk>
parents: 77277
diff changeset
  2110
    by (rule asymp_equivD)
2c86ea8961b5 Some new lemmas. Some tidying up
paulson <lp15@cam.ac.uk>
parents: 77277
diff changeset
  2111
  also have "?this \<longleftrightarrow> ?thesis"
2c86ea8961b5 Some new lemmas. Some tidying up
paulson <lp15@cam.ac.uk>
parents: 77277
diff changeset
  2112
    by (intro filterlim_cong eventually_mono[OF assms(2)]) auto
2c86ea8961b5 Some new lemmas. Some tidying up
paulson <lp15@cam.ac.uk>
parents: 77277
diff changeset
  2113
  finally show ?thesis .
2c86ea8961b5 Some new lemmas. Some tidying up
paulson <lp15@cam.ac.uk>
parents: 77277
diff changeset
  2114
qed
2c86ea8961b5 Some new lemmas. Some tidying up
paulson <lp15@cam.ac.uk>
parents: 77277
diff changeset
  2115
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2116
lemma asymp_equiv_compose [asymp_equiv_intros]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2117
  assumes "f \<sim>[G] g" "filterlim h G F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2118
  shows   "f \<circ> h \<sim>[F] g \<circ> h"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2119
proof -
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2120
  let ?T = "\<lambda>f g x. if f x = 0 \<and> g x = 0 then 1 else f x / g x"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2121
  have "f \<circ> h \<sim>[F] g \<circ> h \<longleftrightarrow> ((?T f g \<circ> h) \<longlongrightarrow> 1) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2122
    by (simp add: asymp_equiv_def o_def)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2123
  also have "\<dots> \<longleftrightarrow> (?T f g \<longlongrightarrow> 1) (filtermap h F)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2124
    by (rule tendsto_compose_filtermap)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2125
  also have "\<dots>"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2126
    by (rule tendsto_mono[of _ G]) (insert assms, simp_all add: asymp_equiv_def filterlim_def)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2127
  finally show ?thesis .
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2128
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2129
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2130
lemma asymp_equiv_compose':
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2131
  assumes "f \<sim>[G] g" "filterlim h G F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2132
  shows   "(\<lambda>x. f (h x)) \<sim>[F] (\<lambda>x. g (h x))"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2133
  using asymp_equiv_compose[OF assms] by (simp add: o_def)
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  2134
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2135
lemma asymp_equiv_powr_real [asymp_equiv_intros]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2136
  fixes f g :: "'a \<Rightarrow> real"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2137
  assumes "f \<sim>[F] g" "eventually (\<lambda>x. f x \<ge> 0) F" "eventually (\<lambda>x. g x \<ge> 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2138
  shows   "(\<lambda>x. f x powr y) \<sim>[F] (\<lambda>x. g x powr y)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2139
proof -
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2140
  let ?T = "\<lambda>f g x. if f x = 0 \<and> g x = 0 then 1 else f x / g x"
70532
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
  2141
  have "((\<lambda>x. ?T f g x powr y) \<longlongrightarrow> 1 powr y) F"
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
  2142
    by (intro tendsto_intros asymp_equivD[OF assms(1)]) simp_all
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
  2143
  hence "((\<lambda>x. ?T f g x powr y) \<longlongrightarrow> 1) F" by simp
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
  2144
  moreover have "eventually (\<lambda>x. ?T f g x powr y = ?T (\<lambda>x. f x powr y) (\<lambda>x. g x powr y) x) F"
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2145
    using asymp_equiv_eventually_zeros[OF assms(1)] assms(2,3)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2146
    by eventually_elim (auto simp: powr_divide)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2147
  ultimately show ?thesis unfolding asymp_equiv_def by (rule Lim_transform_eventually)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2148
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2149
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2150
lemma asymp_equiv_norm [asymp_equiv_intros]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2151
  fixes f g :: "'a \<Rightarrow> 'b :: real_normed_field"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2152
  assumes "f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2153
  shows   "(\<lambda>x. norm (f x)) \<sim>[F] (\<lambda>x. norm (g x))"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  2154
  using tendsto_norm[OF asymp_equivD[OF assms]]
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2155
  by (simp add: if_distrib asymp_equiv_def norm_divide cong: if_cong)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2156
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2157
lemma asymp_equiv_abs_real [asymp_equiv_intros]:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2158
  fixes f g :: "'a \<Rightarrow> real"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2159
  assumes "f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2160
  shows   "(\<lambda>x. \<bar>f x\<bar>) \<sim>[F] (\<lambda>x. \<bar>g x\<bar>)"
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  2161
  using tendsto_rabs[OF asymp_equivD[OF assms]]
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2162
  by (simp add: if_distrib asymp_equiv_def cong: if_cong)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2163
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2164
lemma asymp_equiv_imp_eventually_le:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2165
  assumes "f \<sim>[F] g" "c > 1"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2166
  shows   "eventually (\<lambda>x. norm (f x) \<le> c * norm (g x)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2167
proof -
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2168
  from order_tendstoD(2)[OF asymp_equivD[OF asymp_equiv_norm[OF assms(1)]] assms(2)]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2169
       asymp_equiv_eventually_zeros[OF assms(1)]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2170
    show ?thesis by eventually_elim (auto split: if_splits simp: field_simps)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2171
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2172
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2173
lemma asymp_equiv_imp_eventually_ge:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2174
  assumes "f \<sim>[F] g" "c < 1"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2175
  shows   "eventually (\<lambda>x. norm (f x) \<ge> c * norm (g x)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2176
proof -
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2177
  from order_tendstoD(1)[OF asymp_equivD[OF asymp_equiv_norm[OF assms(1)]] assms(2)]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2178
       asymp_equiv_eventually_zeros[OF assms(1)]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2179
    show ?thesis by eventually_elim (auto split: if_splits simp: field_simps)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2180
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2181
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2182
lemma asymp_equiv_imp_bigo:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2183
  assumes "f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2184
  shows   "f \<in> O[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2185
proof (rule bigoI)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2186
  have "(3/2::real) > 1" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2187
  from asymp_equiv_imp_eventually_le[OF assms this]
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2188
    show "eventually (\<lambda>x. norm (f x) \<le> 3/2 * norm (g x)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2189
    by eventually_elim simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2190
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2191
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2192
lemma asymp_equiv_imp_bigomega:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2193
  "f \<sim>[F] g \<Longrightarrow> f \<in> \<Omega>[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2194
  using asymp_equiv_imp_bigo[of g F f] by (simp add: asymp_equiv_sym bigomega_iff_bigo)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2195
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2196
lemma asymp_equiv_imp_bigtheta:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2197
  "f \<sim>[F] g \<Longrightarrow> f \<in> \<Theta>[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2198
  by (intro bigthetaI asymp_equiv_imp_bigo asymp_equiv_imp_bigomega)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2199
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2200
lemma asymp_equiv_at_infinity_transfer:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2201
  assumes "f \<sim>[F] g" "filterlim f at_infinity F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2202
  shows   "filterlim g at_infinity F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2203
proof -
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2204
  from assms(1) have "g \<in> \<Theta>[F](f)" by (rule asymp_equiv_imp_bigtheta[OF asymp_equiv_symI])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2205
  also from assms have "f \<in> \<omega>[F](\<lambda>_. 1)" by (simp add: smallomega_1_conv_filterlim)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2206
  finally show ?thesis by (simp add: smallomega_1_conv_filterlim)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2207
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2208
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2209
lemma asymp_equiv_at_top_transfer:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2210
  fixes f g :: "_ \<Rightarrow> real"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2211
  assumes "f \<sim>[F] g" "filterlim f at_top F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2212
  shows   "filterlim g at_top F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2213
proof (rule filterlim_at_infinity_imp_filterlim_at_top)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2214
  show "filterlim g at_infinity F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2215
    by (rule asymp_equiv_at_infinity_transfer[OF assms(1) filterlim_mono[OF assms(2)]])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2216
       (auto simp: at_top_le_at_infinity)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2217
  from assms(2) have "eventually (\<lambda>x. f x > 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2218
    using filterlim_at_top_dense by blast
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2219
  with asymp_equiv_eventually_pos_iff[OF assms(1)] show "eventually (\<lambda>x. g x > 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2220
    by eventually_elim blast
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2221
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2222
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2223
lemma asymp_equiv_at_bot_transfer:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2224
  fixes f g :: "_ \<Rightarrow> real"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2225
  assumes "f \<sim>[F] g" "filterlim f at_bot F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2226
  shows   "filterlim g at_bot F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2227
  unfolding filterlim_uminus_at_bot
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2228
  by (rule asymp_equiv_at_top_transfer[of "\<lambda>x. -f x" F "\<lambda>x. -g x"])
74324
308e74afab83 tuned proofs;
wenzelm
parents: 70817
diff changeset
  2229
     (insert assms, auto simp: filterlim_uminus_at_bot asymp_equiv_uminus)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2230
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2231
lemma asymp_equivI'_const:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2232
  assumes "((\<lambda>x. f x / g x) \<longlongrightarrow> c) F" "c \<noteq> 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2233
  shows   "f \<sim>[F] (\<lambda>x. c * g x)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2234
  using tendsto_mult[OF assms(1) tendsto_const[of "inverse c"]] assms(2)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2235
  by (intro asymp_equivI') (simp add: field_simps)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2236
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2237
lemma asymp_equivI'_inverse_const:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2238
  assumes "((\<lambda>x. f x / g x) \<longlongrightarrow> inverse c) F" "c \<noteq> 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2239
  shows   "(\<lambda>x. c * f x) \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2240
  using tendsto_mult[OF assms(1) tendsto_const[of "c"]] assms(2)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2241
  by (intro asymp_equivI') (simp add: field_simps)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2242
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2243
lemma filterlim_at_bot_imp_at_infinity: "filterlim f at_bot F \<Longrightarrow> filterlim f at_infinity F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2244
  for f :: "_ \<Rightarrow> real" using at_bot_le_at_infinity filterlim_mono by blast
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2245
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2246
lemma asymp_equiv_imp_diff_smallo:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2247
  assumes "f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2248
  shows   "(\<lambda>x. f x - g x) \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2249
proof (rule landau_o.smallI)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2250
  fix c :: real assume "c > 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2251
  hence c: "min c 1 > 0" by simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2252
  let ?h = "\<lambda>x. if f x = 0 \<and> g x = 0 then 1 else f x / g x"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2253
  from assms have "((\<lambda>x. ?h x - 1) \<longlongrightarrow> 1 - 1) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2254
    by (intro tendsto_diff asymp_equivD tendsto_const)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2255
  from tendstoD[OF this c] show "eventually (\<lambda>x. norm (f x - g x) \<le> c * norm (g x)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2256
  proof eventually_elim
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2257
    case (elim x)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2258
    from elim have "norm (f x - g x) \<le> norm (f x / g x - 1) * norm (g x)"
70817
dd675800469d dedicated fact collections for algebraic simplification rules potentially splitting goals
haftmann
parents: 70688
diff changeset
  2259
      by (subst norm_mult [symmetric]) (auto split: if_splits simp add: algebra_simps)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2260
    also have "norm (f x / g x - 1) * norm (g x) \<le> c * norm (g x)" using elim
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2261
      by (auto split: if_splits simp: mult_right_mono)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2262
    finally show ?case .
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2263
  qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2264
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2265
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2266
lemma asymp_equiv_altdef:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2267
  "f \<sim>[F] g \<longleftrightarrow> (\<lambda>x. f x - g x) \<in> o[F](g)"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2268
  by (rule iffI[OF asymp_equiv_imp_diff_smallo smallo_imp_asymp_equiv])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2269
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2270
lemma asymp_equiv_0_left_iff [simp]: "(\<lambda>_. 0) \<sim>[F] f \<longleftrightarrow> eventually (\<lambda>x. f x = 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2271
  and asymp_equiv_0_right_iff [simp]: "f \<sim>[F] (\<lambda>_. 0) \<longleftrightarrow> eventually (\<lambda>x. f x = 0) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2272
  by (simp_all add: asymp_equiv_altdef landau_o.small_refl_iff)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2273
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2274
lemma asymp_equiv_sandwich_real:
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2275
  fixes f g l u :: "'a \<Rightarrow> real"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2276
  assumes "l \<sim>[F] g" "u \<sim>[F] g" "eventually (\<lambda>x. f x \<in> {l x..u x}) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2277
  shows   "f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2278
  unfolding asymp_equiv_altdef
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2279
proof (rule landau_o.smallI)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2280
  fix c :: real assume c: "c > 0"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2281
  have "eventually (\<lambda>x. norm (f x - g x) \<le> max (norm (l x - g x)) (norm (u x - g x))) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2282
    using assms(3) by eventually_elim auto
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2283
  moreover have "eventually (\<lambda>x. norm (l x - g x) \<le> c * norm (g x)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2284
                "eventually (\<lambda>x. norm (u x - g x) \<le> c * norm (g x)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2285
    using assms(1,2) by (auto simp: asymp_equiv_altdef dest: landau_o.smallD[OF _ c])
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2286
  hence "eventually (\<lambda>x. max (norm (l x - g x)) (norm (u x - g x)) \<le> c * norm (g x)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2287
    by eventually_elim simp
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2288
  ultimately show "eventually (\<lambda>x. norm (f x - g x) \<le> c * norm (g x)) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2289
    by eventually_elim (rule order.trans)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2290
qed
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2291
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2292
lemma asymp_equiv_sandwich_real':
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2293
  fixes f g l u :: "'a \<Rightarrow> real"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2294
  assumes "f \<sim>[F] l" "f \<sim>[F] u" "eventually (\<lambda>x. g x \<in> {l x..u x}) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2295
  shows   "f \<sim>[F] g"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2296
  using asymp_equiv_sandwich_real[of l F f u g] assms by (simp add: asymp_equiv_sym)
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2297
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2298
lemma asymp_equiv_sandwich_real'':
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2299
  fixes f g l u :: "'a \<Rightarrow> real"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2300
  assumes "l1 \<sim>[F] u1" "u1 \<sim>[F] l2" "l2 \<sim>[F] u2"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2301
          "eventually (\<lambda>x. f x \<in> {l1 x..u1 x}) F" "eventually (\<lambda>x. g x \<in> {l2 x..u2 x}) F"
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2302
  shows   "f \<sim>[F] g"
77200
8f2e6186408f Some more new material and some tidying of existing proofs
paulson <lp15@cam.ac.uk>
parents: 75462
diff changeset
  2303
  by (meson assms asymp_equiv_sandwich_real asymp_equiv_sandwich_real' asymp_equiv_trans)
68246
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2304
b48bab511939 Moved Landau_Symbols from the AFP to HOL-Library
Manuel Eberl <eberlm@in.tum.de>
parents:
diff changeset
  2305
end