src/HOL/Limits.thy
author hoelzl
Fri Mar 22 10:41:42 2013 +0100 (2013-03-22)
changeset 51471 cad22a3cc09c
parent 51360 c4367ed99b5e
child 51472 adb441e4b9e9
permissions -rw-r--r--
move topological_space to its own theory
huffman@31349
     1
(*  Title       : Limits.thy
huffman@31349
     2
    Author      : Brian Huffman
huffman@31349
     3
*)
huffman@31349
     4
huffman@31349
     5
header {* Filters and Limits *}
huffman@31349
     6
huffman@31349
     7
theory Limits
huffman@36822
     8
imports RealVector
huffman@31349
     9
begin
huffman@31349
    10
hoelzl@50324
    11
definition at_infinity :: "'a::real_normed_vector filter" where
hoelzl@50324
    12
  "at_infinity = Abs_filter (\<lambda>P. \<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x)"
hoelzl@50324
    13
huffman@31447
    14
huffman@36656
    15
lemma eventually_nhds_metric:
huffman@36656
    16
  "eventually P (nhds a) \<longleftrightarrow> (\<exists>d>0. \<forall>x. dist x a < d \<longrightarrow> P x)"
huffman@36656
    17
unfolding eventually_nhds open_dist
huffman@31447
    18
apply safe
huffman@31447
    19
apply fast
huffman@31492
    20
apply (rule_tac x="{x. dist x a < d}" in exI, simp)
huffman@31447
    21
apply clarsimp
huffman@31447
    22
apply (rule_tac x="d - dist x a" in exI, clarsimp)
huffman@31447
    23
apply (simp only: less_diff_eq)
huffman@31447
    24
apply (erule le_less_trans [OF dist_triangle])
huffman@31447
    25
done
huffman@31447
    26
huffman@36656
    27
lemma eventually_at:
huffman@36656
    28
  fixes a :: "'a::metric_space"
huffman@36656
    29
  shows "eventually P (at a) \<longleftrightarrow> (\<exists>d>0. \<forall>x. x \<noteq> a \<and> dist x a < d \<longrightarrow> P x)"
huffman@36656
    30
unfolding at_def eventually_within eventually_nhds_metric by auto
hoelzl@50327
    31
lemma eventually_within_less: (* COPY FROM Topo/eventually_within *)
hoelzl@50327
    32
  "eventually P (at a within S) \<longleftrightarrow> (\<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)"
hoelzl@50327
    33
  unfolding eventually_within eventually_at dist_nz by auto
hoelzl@50327
    34
hoelzl@50327
    35
lemma eventually_within_le: (* COPY FROM Topo/eventually_within_le *)
hoelzl@50327
    36
  "eventually P (at a within S) \<longleftrightarrow> (\<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a <= d \<longrightarrow> P x)"
hoelzl@50327
    37
  unfolding eventually_within_less by auto (metis dense order_le_less_trans)
hoelzl@50327
    38
hoelzl@50324
    39
lemma eventually_at_infinity:
hoelzl@50325
    40
  "eventually P at_infinity \<longleftrightarrow> (\<exists>b. \<forall>x. b \<le> norm x \<longrightarrow> P x)"
hoelzl@50324
    41
unfolding at_infinity_def
hoelzl@50324
    42
proof (rule eventually_Abs_filter, rule is_filter.intro)
hoelzl@50324
    43
  fix P Q :: "'a \<Rightarrow> bool"
hoelzl@50324
    44
  assume "\<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x" and "\<exists>s. \<forall>x. s \<le> norm x \<longrightarrow> Q x"
hoelzl@50324
    45
  then obtain r s where
hoelzl@50324
    46
    "\<forall>x. r \<le> norm x \<longrightarrow> P x" and "\<forall>x. s \<le> norm x \<longrightarrow> Q x" by auto
hoelzl@50324
    47
  then have "\<forall>x. max r s \<le> norm x \<longrightarrow> P x \<and> Q x" by simp
hoelzl@50324
    48
  then show "\<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x \<and> Q x" ..
hoelzl@50324
    49
qed auto
huffman@31392
    50
hoelzl@50325
    51
lemma at_infinity_eq_at_top_bot:
hoelzl@50325
    52
  "(at_infinity \<Colon> real filter) = sup at_top at_bot"
hoelzl@50325
    53
  unfolding sup_filter_def at_infinity_def eventually_at_top_linorder eventually_at_bot_linorder
hoelzl@50325
    54
proof (intro arg_cong[where f=Abs_filter] ext iffI)
hoelzl@50325
    55
  fix P :: "real \<Rightarrow> bool" assume "\<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x"
hoelzl@50325
    56
  then guess r ..
hoelzl@50325
    57
  then have "(\<forall>x\<ge>r. P x) \<and> (\<forall>x\<le>-r. P x)" by auto
hoelzl@50325
    58
  then show "(\<exists>r. \<forall>x\<ge>r. P x) \<and> (\<exists>r. \<forall>x\<le>r. P x)" by auto
hoelzl@50325
    59
next
hoelzl@50325
    60
  fix P :: "real \<Rightarrow> bool" assume "(\<exists>r. \<forall>x\<ge>r. P x) \<and> (\<exists>r. \<forall>x\<le>r. P x)"
hoelzl@50325
    61
  then obtain p q where "\<forall>x\<ge>p. P x" "\<forall>x\<le>q. P x" by auto
hoelzl@50325
    62
  then show "\<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x"
hoelzl@50325
    63
    by (intro exI[of _ "max p (-q)"])
hoelzl@50325
    64
       (auto simp: abs_real_def)
hoelzl@50325
    65
qed
hoelzl@50325
    66
hoelzl@50325
    67
lemma at_top_le_at_infinity:
hoelzl@50325
    68
  "at_top \<le> (at_infinity :: real filter)"
hoelzl@50325
    69
  unfolding at_infinity_eq_at_top_bot by simp
hoelzl@50325
    70
hoelzl@50325
    71
lemma at_bot_le_at_infinity:
hoelzl@50325
    72
  "at_bot \<le> (at_infinity :: real filter)"
hoelzl@50325
    73
  unfolding at_infinity_eq_at_top_bot by simp
hoelzl@50325
    74
huffman@31355
    75
subsection {* Boundedness *}
huffman@31355
    76
huffman@44081
    77
definition Bfun :: "('a \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a filter \<Rightarrow> bool"
huffman@44195
    78
  where "Bfun f F = (\<exists>K>0. eventually (\<lambda>x. norm (f x) \<le> K) F)"
huffman@31355
    79
huffman@31487
    80
lemma BfunI:
huffman@44195
    81
  assumes K: "eventually (\<lambda>x. norm (f x) \<le> K) F" shows "Bfun f F"
huffman@31355
    82
unfolding Bfun_def
huffman@31355
    83
proof (intro exI conjI allI)
huffman@31355
    84
  show "0 < max K 1" by simp
huffman@31355
    85
next
huffman@44195
    86
  show "eventually (\<lambda>x. norm (f x) \<le> max K 1) F"
huffman@31355
    87
    using K by (rule eventually_elim1, simp)
huffman@31355
    88
qed
huffman@31355
    89
huffman@31355
    90
lemma BfunE:
huffman@44195
    91
  assumes "Bfun f F"
huffman@44195
    92
  obtains B where "0 < B" and "eventually (\<lambda>x. norm (f x) \<le> B) F"
huffman@31355
    93
using assms unfolding Bfun_def by fast
huffman@31355
    94
huffman@31355
    95
huffman@31349
    96
subsection {* Convergence to Zero *}
huffman@31349
    97
huffman@44081
    98
definition Zfun :: "('a \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a filter \<Rightarrow> bool"
huffman@44195
    99
  where "Zfun f F = (\<forall>r>0. eventually (\<lambda>x. norm (f x) < r) F)"
huffman@31349
   100
huffman@31349
   101
lemma ZfunI:
huffman@44195
   102
  "(\<And>r. 0 < r \<Longrightarrow> eventually (\<lambda>x. norm (f x) < r) F) \<Longrightarrow> Zfun f F"
huffman@44081
   103
  unfolding Zfun_def by simp
huffman@31349
   104
huffman@31349
   105
lemma ZfunD:
huffman@44195
   106
  "\<lbrakk>Zfun f F; 0 < r\<rbrakk> \<Longrightarrow> eventually (\<lambda>x. norm (f x) < r) F"
huffman@44081
   107
  unfolding Zfun_def by simp
huffman@31349
   108
huffman@31355
   109
lemma Zfun_ssubst:
huffman@44195
   110
  "eventually (\<lambda>x. f x = g x) F \<Longrightarrow> Zfun g F \<Longrightarrow> Zfun f F"
huffman@44081
   111
  unfolding Zfun_def by (auto elim!: eventually_rev_mp)
huffman@31355
   112
huffman@44195
   113
lemma Zfun_zero: "Zfun (\<lambda>x. 0) F"
huffman@44081
   114
  unfolding Zfun_def by simp
huffman@31349
   115
huffman@44195
   116
lemma Zfun_norm_iff: "Zfun (\<lambda>x. norm (f x)) F = Zfun (\<lambda>x. f x) F"
huffman@44081
   117
  unfolding Zfun_def by simp
huffman@31349
   118
huffman@31349
   119
lemma Zfun_imp_Zfun:
huffman@44195
   120
  assumes f: "Zfun f F"
huffman@44195
   121
  assumes g: "eventually (\<lambda>x. norm (g x) \<le> norm (f x) * K) F"
huffman@44195
   122
  shows "Zfun (\<lambda>x. g x) F"
huffman@31349
   123
proof (cases)
huffman@31349
   124
  assume K: "0 < K"
huffman@31349
   125
  show ?thesis
huffman@31349
   126
  proof (rule ZfunI)
huffman@31349
   127
    fix r::real assume "0 < r"
huffman@31349
   128
    hence "0 < r / K"
huffman@31349
   129
      using K by (rule divide_pos_pos)
huffman@44195
   130
    then have "eventually (\<lambda>x. norm (f x) < r / K) F"
huffman@31487
   131
      using ZfunD [OF f] by fast
huffman@44195
   132
    with g show "eventually (\<lambda>x. norm (g x) < r) F"
noschinl@46887
   133
    proof eventually_elim
noschinl@46887
   134
      case (elim x)
huffman@31487
   135
      hence "norm (f x) * K < r"
huffman@31349
   136
        by (simp add: pos_less_divide_eq K)
noschinl@46887
   137
      thus ?case
noschinl@46887
   138
        by (simp add: order_le_less_trans [OF elim(1)])
huffman@31349
   139
    qed
huffman@31349
   140
  qed
huffman@31349
   141
next
huffman@31349
   142
  assume "\<not> 0 < K"
huffman@31349
   143
  hence K: "K \<le> 0" by (simp only: not_less)
huffman@31355
   144
  show ?thesis
huffman@31355
   145
  proof (rule ZfunI)
huffman@31355
   146
    fix r :: real
huffman@31355
   147
    assume "0 < r"
huffman@44195
   148
    from g show "eventually (\<lambda>x. norm (g x) < r) F"
noschinl@46887
   149
    proof eventually_elim
noschinl@46887
   150
      case (elim x)
noschinl@46887
   151
      also have "norm (f x) * K \<le> norm (f x) * 0"
huffman@31355
   152
        using K norm_ge_zero by (rule mult_left_mono)
noschinl@46887
   153
      finally show ?case
huffman@31355
   154
        using `0 < r` by simp
huffman@31355
   155
    qed
huffman@31355
   156
  qed
huffman@31349
   157
qed
huffman@31349
   158
huffman@44195
   159
lemma Zfun_le: "\<lbrakk>Zfun g F; \<forall>x. norm (f x) \<le> norm (g x)\<rbrakk> \<Longrightarrow> Zfun f F"
huffman@44081
   160
  by (erule_tac K="1" in Zfun_imp_Zfun, simp)
huffman@31349
   161
huffman@31349
   162
lemma Zfun_add:
huffman@44195
   163
  assumes f: "Zfun f F" and g: "Zfun g F"
huffman@44195
   164
  shows "Zfun (\<lambda>x. f x + g x) F"
huffman@31349
   165
proof (rule ZfunI)
huffman@31349
   166
  fix r::real assume "0 < r"
huffman@31349
   167
  hence r: "0 < r / 2" by simp
huffman@44195
   168
  have "eventually (\<lambda>x. norm (f x) < r/2) F"
huffman@31487
   169
    using f r by (rule ZfunD)
huffman@31349
   170
  moreover
huffman@44195
   171
  have "eventually (\<lambda>x. norm (g x) < r/2) F"
huffman@31487
   172
    using g r by (rule ZfunD)
huffman@31349
   173
  ultimately
huffman@44195
   174
  show "eventually (\<lambda>x. norm (f x + g x) < r) F"
noschinl@46887
   175
  proof eventually_elim
noschinl@46887
   176
    case (elim x)
huffman@31487
   177
    have "norm (f x + g x) \<le> norm (f x) + norm (g x)"
huffman@31349
   178
      by (rule norm_triangle_ineq)
huffman@31349
   179
    also have "\<dots> < r/2 + r/2"
noschinl@46887
   180
      using elim by (rule add_strict_mono)
noschinl@46887
   181
    finally show ?case
huffman@31349
   182
      by simp
huffman@31349
   183
  qed
huffman@31349
   184
qed
huffman@31349
   185
huffman@44195
   186
lemma Zfun_minus: "Zfun f F \<Longrightarrow> Zfun (\<lambda>x. - f x) F"
huffman@44081
   187
  unfolding Zfun_def by simp
huffman@31349
   188
huffman@44195
   189
lemma Zfun_diff: "\<lbrakk>Zfun f F; Zfun g F\<rbrakk> \<Longrightarrow> Zfun (\<lambda>x. f x - g x) F"
huffman@44081
   190
  by (simp only: diff_minus Zfun_add Zfun_minus)
huffman@31349
   191
huffman@31349
   192
lemma (in bounded_linear) Zfun:
huffman@44195
   193
  assumes g: "Zfun g F"
huffman@44195
   194
  shows "Zfun (\<lambda>x. f (g x)) F"
huffman@31349
   195
proof -
huffman@31349
   196
  obtain K where "\<And>x. norm (f x) \<le> norm x * K"
huffman@31349
   197
    using bounded by fast
huffman@44195
   198
  then have "eventually (\<lambda>x. norm (f (g x)) \<le> norm (g x) * K) F"
huffman@31355
   199
    by simp
huffman@31487
   200
  with g show ?thesis
huffman@31349
   201
    by (rule Zfun_imp_Zfun)
huffman@31349
   202
qed
huffman@31349
   203
huffman@31349
   204
lemma (in bounded_bilinear) Zfun:
huffman@44195
   205
  assumes f: "Zfun f F"
huffman@44195
   206
  assumes g: "Zfun g F"
huffman@44195
   207
  shows "Zfun (\<lambda>x. f x ** g x) F"
huffman@31349
   208
proof (rule ZfunI)
huffman@31349
   209
  fix r::real assume r: "0 < r"
huffman@31349
   210
  obtain K where K: "0 < K"
huffman@31349
   211
    and norm_le: "\<And>x y. norm (x ** y) \<le> norm x * norm y * K"
huffman@31349
   212
    using pos_bounded by fast
huffman@31349
   213
  from K have K': "0 < inverse K"
huffman@31349
   214
    by (rule positive_imp_inverse_positive)
huffman@44195
   215
  have "eventually (\<lambda>x. norm (f x) < r) F"
huffman@31487
   216
    using f r by (rule ZfunD)
huffman@31349
   217
  moreover
huffman@44195
   218
  have "eventually (\<lambda>x. norm (g x) < inverse K) F"
huffman@31487
   219
    using g K' by (rule ZfunD)
huffman@31349
   220
  ultimately
huffman@44195
   221
  show "eventually (\<lambda>x. norm (f x ** g x) < r) F"
noschinl@46887
   222
  proof eventually_elim
noschinl@46887
   223
    case (elim x)
huffman@31487
   224
    have "norm (f x ** g x) \<le> norm (f x) * norm (g x) * K"
huffman@31349
   225
      by (rule norm_le)
huffman@31487
   226
    also have "norm (f x) * norm (g x) * K < r * inverse K * K"
noschinl@46887
   227
      by (intro mult_strict_right_mono mult_strict_mono' norm_ge_zero elim K)
huffman@31349
   228
    also from K have "r * inverse K * K = r"
huffman@31349
   229
      by simp
noschinl@46887
   230
    finally show ?case .
huffman@31349
   231
  qed
huffman@31349
   232
qed
huffman@31349
   233
huffman@31349
   234
lemma (in bounded_bilinear) Zfun_left:
huffman@44195
   235
  "Zfun f F \<Longrightarrow> Zfun (\<lambda>x. f x ** a) F"
huffman@44081
   236
  by (rule bounded_linear_left [THEN bounded_linear.Zfun])
huffman@31349
   237
huffman@31349
   238
lemma (in bounded_bilinear) Zfun_right:
huffman@44195
   239
  "Zfun f F \<Longrightarrow> Zfun (\<lambda>x. a ** f x) F"
huffman@44081
   240
  by (rule bounded_linear_right [THEN bounded_linear.Zfun])
huffman@31349
   241
huffman@44282
   242
lemmas Zfun_mult = bounded_bilinear.Zfun [OF bounded_bilinear_mult]
huffman@44282
   243
lemmas Zfun_mult_right = bounded_bilinear.Zfun_right [OF bounded_bilinear_mult]
huffman@44282
   244
lemmas Zfun_mult_left = bounded_bilinear.Zfun_left [OF bounded_bilinear_mult]
huffman@31349
   245
huffman@44195
   246
lemma tendsto_Zfun_iff: "(f ---> a) F = Zfun (\<lambda>x. f x - a) F"
huffman@44081
   247
  by (simp only: tendsto_iff Zfun_def dist_norm)
huffman@31349
   248
huffman@44253
   249
huffman@44251
   250
lemma metric_tendsto_imp_tendsto:
huffman@44251
   251
  assumes f: "(f ---> a) F"
huffman@44251
   252
  assumes le: "eventually (\<lambda>x. dist (g x) b \<le> dist (f x) a) F"
huffman@44251
   253
  shows "(g ---> b) F"
huffman@44251
   254
proof (rule tendstoI)
huffman@44251
   255
  fix e :: real assume "0 < e"
huffman@44251
   256
  with f have "eventually (\<lambda>x. dist (f x) a < e) F" by (rule tendstoD)
huffman@44251
   257
  with le show "eventually (\<lambda>x. dist (g x) b < e) F"
huffman@44251
   258
    using le_less_trans by (rule eventually_elim2)
huffman@44251
   259
qed
huffman@44205
   260
subsubsection {* Distance and norms *}
huffman@36662
   261
huffman@31565
   262
lemma tendsto_dist [tendsto_intros]:
huffman@44195
   263
  assumes f: "(f ---> l) F" and g: "(g ---> m) F"
huffman@44195
   264
  shows "((\<lambda>x. dist (f x) (g x)) ---> dist l m) F"
huffman@31565
   265
proof (rule tendstoI)
huffman@31565
   266
  fix e :: real assume "0 < e"
huffman@31565
   267
  hence e2: "0 < e/2" by simp
huffman@31565
   268
  from tendstoD [OF f e2] tendstoD [OF g e2]
huffman@44195
   269
  show "eventually (\<lambda>x. dist (dist (f x) (g x)) (dist l m) < e) F"
noschinl@46887
   270
  proof (eventually_elim)
noschinl@46887
   271
    case (elim x)
huffman@31565
   272
    then show "dist (dist (f x) (g x)) (dist l m) < e"
huffman@31565
   273
      unfolding dist_real_def
huffman@31565
   274
      using dist_triangle2 [of "f x" "g x" "l"]
huffman@31565
   275
      using dist_triangle2 [of "g x" "l" "m"]
huffman@31565
   276
      using dist_triangle3 [of "l" "m" "f x"]
huffman@31565
   277
      using dist_triangle [of "f x" "m" "g x"]
huffman@31565
   278
      by arith
huffman@31565
   279
  qed
huffman@31565
   280
qed
huffman@31565
   281
huffman@36662
   282
lemma norm_conv_dist: "norm x = dist x 0"
huffman@44081
   283
  unfolding dist_norm by simp
huffman@36662
   284
huffman@31565
   285
lemma tendsto_norm [tendsto_intros]:
huffman@44195
   286
  "(f ---> a) F \<Longrightarrow> ((\<lambda>x. norm (f x)) ---> norm a) F"
huffman@44081
   287
  unfolding norm_conv_dist by (intro tendsto_intros)
huffman@36662
   288
huffman@36662
   289
lemma tendsto_norm_zero:
huffman@44195
   290
  "(f ---> 0) F \<Longrightarrow> ((\<lambda>x. norm (f x)) ---> 0) F"
huffman@44081
   291
  by (drule tendsto_norm, simp)
huffman@36662
   292
huffman@36662
   293
lemma tendsto_norm_zero_cancel:
huffman@44195
   294
  "((\<lambda>x. norm (f x)) ---> 0) F \<Longrightarrow> (f ---> 0) F"
huffman@44081
   295
  unfolding tendsto_iff dist_norm by simp
huffman@36662
   296
huffman@36662
   297
lemma tendsto_norm_zero_iff:
huffman@44195
   298
  "((\<lambda>x. norm (f x)) ---> 0) F \<longleftrightarrow> (f ---> 0) F"
huffman@44081
   299
  unfolding tendsto_iff dist_norm by simp
huffman@31349
   300
huffman@44194
   301
lemma tendsto_rabs [tendsto_intros]:
huffman@44195
   302
  "(f ---> (l::real)) F \<Longrightarrow> ((\<lambda>x. \<bar>f x\<bar>) ---> \<bar>l\<bar>) F"
huffman@44194
   303
  by (fold real_norm_def, rule tendsto_norm)
huffman@44194
   304
huffman@44194
   305
lemma tendsto_rabs_zero:
huffman@44195
   306
  "(f ---> (0::real)) F \<Longrightarrow> ((\<lambda>x. \<bar>f x\<bar>) ---> 0) F"
huffman@44194
   307
  by (fold real_norm_def, rule tendsto_norm_zero)
huffman@44194
   308
huffman@44194
   309
lemma tendsto_rabs_zero_cancel:
huffman@44195
   310
  "((\<lambda>x. \<bar>f x\<bar>) ---> (0::real)) F \<Longrightarrow> (f ---> 0) F"
huffman@44194
   311
  by (fold real_norm_def, rule tendsto_norm_zero_cancel)
huffman@44194
   312
huffman@44194
   313
lemma tendsto_rabs_zero_iff:
huffman@44195
   314
  "((\<lambda>x. \<bar>f x\<bar>) ---> (0::real)) F \<longleftrightarrow> (f ---> 0) F"
huffman@44194
   315
  by (fold real_norm_def, rule tendsto_norm_zero_iff)
huffman@44194
   316
huffman@44194
   317
subsubsection {* Addition and subtraction *}
huffman@44194
   318
huffman@31565
   319
lemma tendsto_add [tendsto_intros]:
huffman@31349
   320
  fixes a b :: "'a::real_normed_vector"
huffman@44195
   321
  shows "\<lbrakk>(f ---> a) F; (g ---> b) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x + g x) ---> a + b) F"
huffman@44081
   322
  by (simp only: tendsto_Zfun_iff add_diff_add Zfun_add)
huffman@31349
   323
huffman@44194
   324
lemma tendsto_add_zero:
huffman@44194
   325
  fixes f g :: "'a::type \<Rightarrow> 'b::real_normed_vector"
huffman@44195
   326
  shows "\<lbrakk>(f ---> 0) F; (g ---> 0) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x + g x) ---> 0) F"
huffman@44194
   327
  by (drule (1) tendsto_add, simp)
huffman@44194
   328
huffman@31565
   329
lemma tendsto_minus [tendsto_intros]:
huffman@31349
   330
  fixes a :: "'a::real_normed_vector"
huffman@44195
   331
  shows "(f ---> a) F \<Longrightarrow> ((\<lambda>x. - f x) ---> - a) F"
huffman@44081
   332
  by (simp only: tendsto_Zfun_iff minus_diff_minus Zfun_minus)
huffman@31349
   333
huffman@31349
   334
lemma tendsto_minus_cancel:
huffman@31349
   335
  fixes a :: "'a::real_normed_vector"
huffman@44195
   336
  shows "((\<lambda>x. - f x) ---> - a) F \<Longrightarrow> (f ---> a) F"
huffman@44081
   337
  by (drule tendsto_minus, simp)
huffman@31349
   338
hoelzl@50330
   339
lemma tendsto_minus_cancel_left:
hoelzl@50330
   340
    "(f ---> - (y::_::real_normed_vector)) F \<longleftrightarrow> ((\<lambda>x. - f x) ---> y) F"
hoelzl@50330
   341
  using tendsto_minus_cancel[of f "- y" F]  tendsto_minus[of f "- y" F]
hoelzl@50330
   342
  by auto
hoelzl@50330
   343
huffman@31565
   344
lemma tendsto_diff [tendsto_intros]:
huffman@31349
   345
  fixes a b :: "'a::real_normed_vector"
huffman@44195
   346
  shows "\<lbrakk>(f ---> a) F; (g ---> b) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x - g x) ---> a - b) F"
huffman@44081
   347
  by (simp add: diff_minus tendsto_add tendsto_minus)
huffman@31349
   348
huffman@31588
   349
lemma tendsto_setsum [tendsto_intros]:
huffman@31588
   350
  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c::real_normed_vector"
huffman@44195
   351
  assumes "\<And>i. i \<in> S \<Longrightarrow> (f i ---> a i) F"
huffman@44195
   352
  shows "((\<lambda>x. \<Sum>i\<in>S. f i x) ---> (\<Sum>i\<in>S. a i)) F"
huffman@31588
   353
proof (cases "finite S")
huffman@31588
   354
  assume "finite S" thus ?thesis using assms
huffman@44194
   355
    by (induct, simp add: tendsto_const, simp add: tendsto_add)
huffman@31588
   356
next
huffman@31588
   357
  assume "\<not> finite S" thus ?thesis
huffman@31588
   358
    by (simp add: tendsto_const)
huffman@31588
   359
qed
huffman@31588
   360
hoelzl@50999
   361
lemmas real_tendsto_sandwich = tendsto_sandwich[where 'b=real]
hoelzl@50999
   362
huffman@44194
   363
subsubsection {* Linear operators and multiplication *}
huffman@44194
   364
huffman@44282
   365
lemma (in bounded_linear) tendsto:
huffman@44195
   366
  "(g ---> a) F \<Longrightarrow> ((\<lambda>x. f (g x)) ---> f a) F"
huffman@44081
   367
  by (simp only: tendsto_Zfun_iff diff [symmetric] Zfun)
huffman@31349
   368
huffman@44194
   369
lemma (in bounded_linear) tendsto_zero:
huffman@44195
   370
  "(g ---> 0) F \<Longrightarrow> ((\<lambda>x. f (g x)) ---> 0) F"
huffman@44194
   371
  by (drule tendsto, simp only: zero)
huffman@44194
   372
huffman@44282
   373
lemma (in bounded_bilinear) tendsto:
huffman@44195
   374
  "\<lbrakk>(f ---> a) F; (g ---> b) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x ** g x) ---> a ** b) F"
huffman@44081
   375
  by (simp only: tendsto_Zfun_iff prod_diff_prod
huffman@44081
   376
                 Zfun_add Zfun Zfun_left Zfun_right)
huffman@31349
   377
huffman@44194
   378
lemma (in bounded_bilinear) tendsto_zero:
huffman@44195
   379
  assumes f: "(f ---> 0) F"
huffman@44195
   380
  assumes g: "(g ---> 0) F"
huffman@44195
   381
  shows "((\<lambda>x. f x ** g x) ---> 0) F"
huffman@44194
   382
  using tendsto [OF f g] by (simp add: zero_left)
huffman@31355
   383
huffman@44194
   384
lemma (in bounded_bilinear) tendsto_left_zero:
huffman@44195
   385
  "(f ---> 0) F \<Longrightarrow> ((\<lambda>x. f x ** c) ---> 0) F"
huffman@44194
   386
  by (rule bounded_linear.tendsto_zero [OF bounded_linear_left])
huffman@44194
   387
huffman@44194
   388
lemma (in bounded_bilinear) tendsto_right_zero:
huffman@44195
   389
  "(f ---> 0) F \<Longrightarrow> ((\<lambda>x. c ** f x) ---> 0) F"
huffman@44194
   390
  by (rule bounded_linear.tendsto_zero [OF bounded_linear_right])
huffman@44194
   391
huffman@44282
   392
lemmas tendsto_of_real [tendsto_intros] =
huffman@44282
   393
  bounded_linear.tendsto [OF bounded_linear_of_real]
huffman@44282
   394
huffman@44282
   395
lemmas tendsto_scaleR [tendsto_intros] =
huffman@44282
   396
  bounded_bilinear.tendsto [OF bounded_bilinear_scaleR]
huffman@44282
   397
huffman@44282
   398
lemmas tendsto_mult [tendsto_intros] =
huffman@44282
   399
  bounded_bilinear.tendsto [OF bounded_bilinear_mult]
huffman@44194
   400
huffman@44568
   401
lemmas tendsto_mult_zero =
huffman@44568
   402
  bounded_bilinear.tendsto_zero [OF bounded_bilinear_mult]
huffman@44568
   403
huffman@44568
   404
lemmas tendsto_mult_left_zero =
huffman@44568
   405
  bounded_bilinear.tendsto_left_zero [OF bounded_bilinear_mult]
huffman@44568
   406
huffman@44568
   407
lemmas tendsto_mult_right_zero =
huffman@44568
   408
  bounded_bilinear.tendsto_right_zero [OF bounded_bilinear_mult]
huffman@44568
   409
huffman@44194
   410
lemma tendsto_power [tendsto_intros]:
huffman@44194
   411
  fixes f :: "'a \<Rightarrow> 'b::{power,real_normed_algebra}"
huffman@44195
   412
  shows "(f ---> a) F \<Longrightarrow> ((\<lambda>x. f x ^ n) ---> a ^ n) F"
huffman@44194
   413
  by (induct n) (simp_all add: tendsto_const tendsto_mult)
huffman@44194
   414
huffman@44194
   415
lemma tendsto_setprod [tendsto_intros]:
huffman@44194
   416
  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c::{real_normed_algebra,comm_ring_1}"
huffman@44195
   417
  assumes "\<And>i. i \<in> S \<Longrightarrow> (f i ---> L i) F"
huffman@44195
   418
  shows "((\<lambda>x. \<Prod>i\<in>S. f i x) ---> (\<Prod>i\<in>S. L i)) F"
huffman@44194
   419
proof (cases "finite S")
huffman@44194
   420
  assume "finite S" thus ?thesis using assms
huffman@44194
   421
    by (induct, simp add: tendsto_const, simp add: tendsto_mult)
huffman@44194
   422
next
huffman@44194
   423
  assume "\<not> finite S" thus ?thesis
huffman@44194
   424
    by (simp add: tendsto_const)
huffman@44194
   425
qed
huffman@44194
   426
huffman@44194
   427
subsubsection {* Inverse and division *}
huffman@31355
   428
huffman@31355
   429
lemma (in bounded_bilinear) Zfun_prod_Bfun:
huffman@44195
   430
  assumes f: "Zfun f F"
huffman@44195
   431
  assumes g: "Bfun g F"
huffman@44195
   432
  shows "Zfun (\<lambda>x. f x ** g x) F"
huffman@31355
   433
proof -
huffman@31355
   434
  obtain K where K: "0 \<le> K"
huffman@31355
   435
    and norm_le: "\<And>x y. norm (x ** y) \<le> norm x * norm y * K"
huffman@31355
   436
    using nonneg_bounded by fast
huffman@31355
   437
  obtain B where B: "0 < B"
huffman@44195
   438
    and norm_g: "eventually (\<lambda>x. norm (g x) \<le> B) F"
huffman@31487
   439
    using g by (rule BfunE)
huffman@44195
   440
  have "eventually (\<lambda>x. norm (f x ** g x) \<le> norm (f x) * (B * K)) F"
noschinl@46887
   441
  using norm_g proof eventually_elim
noschinl@46887
   442
    case (elim x)
huffman@31487
   443
    have "norm (f x ** g x) \<le> norm (f x) * norm (g x) * K"
huffman@31355
   444
      by (rule norm_le)
huffman@31487
   445
    also have "\<dots> \<le> norm (f x) * B * K"
huffman@31487
   446
      by (intro mult_mono' order_refl norm_g norm_ge_zero
noschinl@46887
   447
                mult_nonneg_nonneg K elim)
huffman@31487
   448
    also have "\<dots> = norm (f x) * (B * K)"
huffman@31355
   449
      by (rule mult_assoc)
huffman@31487
   450
    finally show "norm (f x ** g x) \<le> norm (f x) * (B * K)" .
huffman@31355
   451
  qed
huffman@31487
   452
  with f show ?thesis
huffman@31487
   453
    by (rule Zfun_imp_Zfun)
huffman@31355
   454
qed
huffman@31355
   455
huffman@31355
   456
lemma (in bounded_bilinear) flip:
huffman@31355
   457
  "bounded_bilinear (\<lambda>x y. y ** x)"
huffman@44081
   458
  apply default
huffman@44081
   459
  apply (rule add_right)
huffman@44081
   460
  apply (rule add_left)
huffman@44081
   461
  apply (rule scaleR_right)
huffman@44081
   462
  apply (rule scaleR_left)
huffman@44081
   463
  apply (subst mult_commute)
huffman@44081
   464
  using bounded by fast
huffman@31355
   465
huffman@31355
   466
lemma (in bounded_bilinear) Bfun_prod_Zfun:
huffman@44195
   467
  assumes f: "Bfun f F"
huffman@44195
   468
  assumes g: "Zfun g F"
huffman@44195
   469
  shows "Zfun (\<lambda>x. f x ** g x) F"
huffman@44081
   470
  using flip g f by (rule bounded_bilinear.Zfun_prod_Bfun)
huffman@31355
   471
huffman@31355
   472
lemma Bfun_inverse_lemma:
huffman@31355
   473
  fixes x :: "'a::real_normed_div_algebra"
huffman@31355
   474
  shows "\<lbrakk>r \<le> norm x; 0 < r\<rbrakk> \<Longrightarrow> norm (inverse x) \<le> inverse r"
huffman@44081
   475
  apply (subst nonzero_norm_inverse, clarsimp)
huffman@44081
   476
  apply (erule (1) le_imp_inverse_le)
huffman@44081
   477
  done
huffman@31355
   478
huffman@31355
   479
lemma Bfun_inverse:
huffman@31355
   480
  fixes a :: "'a::real_normed_div_algebra"
huffman@44195
   481
  assumes f: "(f ---> a) F"
huffman@31355
   482
  assumes a: "a \<noteq> 0"
huffman@44195
   483
  shows "Bfun (\<lambda>x. inverse (f x)) F"
huffman@31355
   484
proof -
huffman@31355
   485
  from a have "0 < norm a" by simp
huffman@31355
   486
  hence "\<exists>r>0. r < norm a" by (rule dense)
huffman@31355
   487
  then obtain r where r1: "0 < r" and r2: "r < norm a" by fast
huffman@44195
   488
  have "eventually (\<lambda>x. dist (f x) a < r) F"
huffman@31487
   489
    using tendstoD [OF f r1] by fast
huffman@44195
   490
  hence "eventually (\<lambda>x. norm (inverse (f x)) \<le> inverse (norm a - r)) F"
noschinl@46887
   491
  proof eventually_elim
noschinl@46887
   492
    case (elim x)
huffman@31487
   493
    hence 1: "norm (f x - a) < r"
huffman@31355
   494
      by (simp add: dist_norm)
huffman@31487
   495
    hence 2: "f x \<noteq> 0" using r2 by auto
huffman@31487
   496
    hence "norm (inverse (f x)) = inverse (norm (f x))"
huffman@31355
   497
      by (rule nonzero_norm_inverse)
huffman@31355
   498
    also have "\<dots> \<le> inverse (norm a - r)"
huffman@31355
   499
    proof (rule le_imp_inverse_le)
huffman@31355
   500
      show "0 < norm a - r" using r2 by simp
huffman@31355
   501
    next
huffman@31487
   502
      have "norm a - norm (f x) \<le> norm (a - f x)"
huffman@31355
   503
        by (rule norm_triangle_ineq2)
huffman@31487
   504
      also have "\<dots> = norm (f x - a)"
huffman@31355
   505
        by (rule norm_minus_commute)
huffman@31355
   506
      also have "\<dots> < r" using 1 .
huffman@31487
   507
      finally show "norm a - r \<le> norm (f x)" by simp
huffman@31355
   508
    qed
huffman@31487
   509
    finally show "norm (inverse (f x)) \<le> inverse (norm a - r)" .
huffman@31355
   510
  qed
huffman@31355
   511
  thus ?thesis by (rule BfunI)
huffman@31355
   512
qed
huffman@31355
   513
huffman@31565
   514
lemma tendsto_inverse [tendsto_intros]:
huffman@31355
   515
  fixes a :: "'a::real_normed_div_algebra"
huffman@44195
   516
  assumes f: "(f ---> a) F"
huffman@31355
   517
  assumes a: "a \<noteq> 0"
huffman@44195
   518
  shows "((\<lambda>x. inverse (f x)) ---> inverse a) F"
huffman@31355
   519
proof -
huffman@31355
   520
  from a have "0 < norm a" by simp
huffman@44195
   521
  with f have "eventually (\<lambda>x. dist (f x) a < norm a) F"
huffman@31355
   522
    by (rule tendstoD)
huffman@44195
   523
  then have "eventually (\<lambda>x. f x \<noteq> 0) F"
huffman@31355
   524
    unfolding dist_norm by (auto elim!: eventually_elim1)
huffman@44627
   525
  with a have "eventually (\<lambda>x. inverse (f x) - inverse a =
huffman@44627
   526
    - (inverse (f x) * (f x - a) * inverse a)) F"
huffman@44627
   527
    by (auto elim!: eventually_elim1 simp: inverse_diff_inverse)
huffman@44627
   528
  moreover have "Zfun (\<lambda>x. - (inverse (f x) * (f x - a) * inverse a)) F"
huffman@44627
   529
    by (intro Zfun_minus Zfun_mult_left
huffman@44627
   530
      bounded_bilinear.Bfun_prod_Zfun [OF bounded_bilinear_mult]
huffman@44627
   531
      Bfun_inverse [OF f a] f [unfolded tendsto_Zfun_iff])
huffman@44627
   532
  ultimately show ?thesis
huffman@44627
   533
    unfolding tendsto_Zfun_iff by (rule Zfun_ssubst)
huffman@31355
   534
qed
huffman@31355
   535
huffman@31565
   536
lemma tendsto_divide [tendsto_intros]:
huffman@31355
   537
  fixes a b :: "'a::real_normed_field"
huffman@44195
   538
  shows "\<lbrakk>(f ---> a) F; (g ---> b) F; b \<noteq> 0\<rbrakk>
huffman@44195
   539
    \<Longrightarrow> ((\<lambda>x. f x / g x) ---> a / b) F"
huffman@44282
   540
  by (simp add: tendsto_mult tendsto_inverse divide_inverse)
huffman@31355
   541
huffman@44194
   542
lemma tendsto_sgn [tendsto_intros]:
huffman@44194
   543
  fixes l :: "'a::real_normed_vector"
huffman@44195
   544
  shows "\<lbrakk>(f ---> l) F; l \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. sgn (f x)) ---> sgn l) F"
huffman@44194
   545
  unfolding sgn_div_norm by (simp add: tendsto_intros)
huffman@44194
   546
hoelzl@50346
   547
lemma filterlim_at_bot_at_right:
hoelzl@50346
   548
  fixes f :: "real \<Rightarrow> 'b::linorder"
hoelzl@50346
   549
  assumes mono: "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y"
hoelzl@50346
   550
  assumes bij: "\<And>x. P x \<Longrightarrow> f (g x) = x" "\<And>x. P x \<Longrightarrow> Q (g x)"
hoelzl@50346
   551
  assumes Q: "eventually Q (at_right a)" and bound: "\<And>b. Q b \<Longrightarrow> a < b"
hoelzl@50346
   552
  assumes P: "eventually P at_bot"
hoelzl@50346
   553
  shows "filterlim f at_bot (at_right a)"
hoelzl@50346
   554
proof -
hoelzl@50346
   555
  from P obtain x where x: "\<And>y. y \<le> x \<Longrightarrow> P y"
hoelzl@50346
   556
    unfolding eventually_at_bot_linorder by auto
hoelzl@50346
   557
  show ?thesis
hoelzl@50346
   558
  proof (intro filterlim_at_bot_le[THEN iffD2] allI impI)
hoelzl@50346
   559
    fix z assume "z \<le> x"
hoelzl@50346
   560
    with x have "P z" by auto
hoelzl@50346
   561
    have "eventually (\<lambda>x. x \<le> g z) (at_right a)"
hoelzl@50346
   562
      using bound[OF bij(2)[OF `P z`]]
hoelzl@50346
   563
      by (auto simp add: eventually_within_less dist_real_def intro!:  exI[of _ "g z - a"])
hoelzl@50346
   564
    with Q show "eventually (\<lambda>x. f x \<le> z) (at_right a)"
hoelzl@50346
   565
      by eventually_elim (metis bij `P z` mono)
hoelzl@50346
   566
  qed
hoelzl@50346
   567
qed
hoelzl@50346
   568
hoelzl@50346
   569
lemma filterlim_at_top_at_left:
hoelzl@50346
   570
  fixes f :: "real \<Rightarrow> 'b::linorder"
hoelzl@50346
   571
  assumes mono: "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y"
hoelzl@50346
   572
  assumes bij: "\<And>x. P x \<Longrightarrow> f (g x) = x" "\<And>x. P x \<Longrightarrow> Q (g x)"
hoelzl@50346
   573
  assumes Q: "eventually Q (at_left a)" and bound: "\<And>b. Q b \<Longrightarrow> b < a"
hoelzl@50346
   574
  assumes P: "eventually P at_top"
hoelzl@50346
   575
  shows "filterlim f at_top (at_left a)"
hoelzl@50346
   576
proof -
hoelzl@50346
   577
  from P obtain x where x: "\<And>y. x \<le> y \<Longrightarrow> P y"
hoelzl@50346
   578
    unfolding eventually_at_top_linorder by auto
hoelzl@50346
   579
  show ?thesis
hoelzl@50346
   580
  proof (intro filterlim_at_top_ge[THEN iffD2] allI impI)
hoelzl@50346
   581
    fix z assume "x \<le> z"
hoelzl@50346
   582
    with x have "P z" by auto
hoelzl@50346
   583
    have "eventually (\<lambda>x. g z \<le> x) (at_left a)"
hoelzl@50346
   584
      using bound[OF bij(2)[OF `P z`]]
hoelzl@50346
   585
      by (auto simp add: eventually_within_less dist_real_def intro!:  exI[of _ "a - g z"])
hoelzl@50346
   586
    with Q show "eventually (\<lambda>x. z \<le> f x) (at_left a)"
hoelzl@50346
   587
      by eventually_elim (metis bij `P z` mono)
hoelzl@50346
   588
  qed
hoelzl@50346
   589
qed
hoelzl@50323
   590
hoelzl@50325
   591
lemma filterlim_at_infinity:
hoelzl@50325
   592
  fixes f :: "_ \<Rightarrow> 'a\<Colon>real_normed_vector"
hoelzl@50325
   593
  assumes "0 \<le> c"
hoelzl@50325
   594
  shows "(LIM x F. f x :> at_infinity) \<longleftrightarrow> (\<forall>r>c. eventually (\<lambda>x. r \<le> norm (f x)) F)"
hoelzl@50325
   595
  unfolding filterlim_iff eventually_at_infinity
hoelzl@50325
   596
proof safe
hoelzl@50325
   597
  fix P :: "'a \<Rightarrow> bool" and b
hoelzl@50325
   598
  assume *: "\<forall>r>c. eventually (\<lambda>x. r \<le> norm (f x)) F"
hoelzl@50325
   599
    and P: "\<forall>x. b \<le> norm x \<longrightarrow> P x"
hoelzl@50325
   600
  have "max b (c + 1) > c" by auto
hoelzl@50325
   601
  with * have "eventually (\<lambda>x. max b (c + 1) \<le> norm (f x)) F"
hoelzl@50325
   602
    by auto
hoelzl@50325
   603
  then show "eventually (\<lambda>x. P (f x)) F"
hoelzl@50325
   604
  proof eventually_elim
hoelzl@50325
   605
    fix x assume "max b (c + 1) \<le> norm (f x)"
hoelzl@50325
   606
    with P show "P (f x)" by auto
hoelzl@50325
   607
  qed
hoelzl@50325
   608
qed force
hoelzl@50325
   609
hoelzl@50322
   610
lemma filterlim_real_sequentially: "LIM x sequentially. real x :> at_top"
hoelzl@50322
   611
  unfolding filterlim_at_top
hoelzl@50247
   612
  apply (intro allI)
hoelzl@50247
   613
  apply (rule_tac c="natceiling (Z + 1)" in eventually_sequentiallyI)
hoelzl@50247
   614
  apply (auto simp: natceiling_le_eq)
hoelzl@50247
   615
  done
hoelzl@50247
   616
hoelzl@50347
   617
subsection {* Relate @{const at}, @{const at_left} and @{const at_right} *}
hoelzl@50347
   618
hoelzl@50347
   619
text {*
hoelzl@50347
   620
hoelzl@50347
   621
This lemmas are useful for conversion between @{term "at x"} to @{term "at_left x"} and
hoelzl@50347
   622
@{term "at_right x"} and also @{term "at_right 0"}.
hoelzl@50347
   623
hoelzl@50347
   624
*}
hoelzl@50347
   625
hoelzl@51471
   626
lemmas filterlim_split_at_real = filterlim_split_at[where 'a=real]
hoelzl@50323
   627
hoelzl@50347
   628
lemma filtermap_nhds_shift: "filtermap (\<lambda>x. x - d) (nhds a) = nhds (a - d::real)"
hoelzl@50347
   629
  unfolding filter_eq_iff eventually_filtermap eventually_nhds_metric
hoelzl@50347
   630
  by (intro allI ex_cong) (auto simp: dist_real_def field_simps)
hoelzl@50347
   631
hoelzl@50347
   632
lemma filtermap_nhds_minus: "filtermap (\<lambda>x. - x) (nhds a) = nhds (- a::real)"
hoelzl@50347
   633
  unfolding filter_eq_iff eventually_filtermap eventually_nhds_metric
hoelzl@50347
   634
  apply (intro allI ex_cong)
hoelzl@50347
   635
  apply (auto simp: dist_real_def field_simps)
hoelzl@50347
   636
  apply (erule_tac x="-x" in allE)
hoelzl@50347
   637
  apply simp
hoelzl@50347
   638
  done
hoelzl@50347
   639
hoelzl@50347
   640
lemma filtermap_at_shift: "filtermap (\<lambda>x. x - d) (at a) = at (a - d::real)"
hoelzl@50347
   641
  unfolding at_def filtermap_nhds_shift[symmetric]
hoelzl@50347
   642
  by (simp add: filter_eq_iff eventually_filtermap eventually_within)
hoelzl@50347
   643
hoelzl@50347
   644
lemma filtermap_at_right_shift: "filtermap (\<lambda>x. x - d) (at_right a) = at_right (a - d::real)"
hoelzl@50347
   645
  unfolding filtermap_at_shift[symmetric]
hoelzl@50347
   646
  by (simp add: filter_eq_iff eventually_filtermap eventually_within)
hoelzl@50323
   647
hoelzl@50347
   648
lemma at_right_to_0: "at_right (a::real) = filtermap (\<lambda>x. x + a) (at_right 0)"
hoelzl@50347
   649
  using filtermap_at_right_shift[of "-a" 0] by simp
hoelzl@50347
   650
hoelzl@50347
   651
lemma filterlim_at_right_to_0:
hoelzl@50347
   652
  "filterlim f F (at_right (a::real)) \<longleftrightarrow> filterlim (\<lambda>x. f (x + a)) F (at_right 0)"
hoelzl@50347
   653
  unfolding filterlim_def filtermap_filtermap at_right_to_0[of a] ..
hoelzl@50347
   654
hoelzl@50347
   655
lemma eventually_at_right_to_0:
hoelzl@50347
   656
  "eventually P (at_right (a::real)) \<longleftrightarrow> eventually (\<lambda>x. P (x + a)) (at_right 0)"
hoelzl@50347
   657
  unfolding at_right_to_0[of a] by (simp add: eventually_filtermap)
hoelzl@50347
   658
hoelzl@50347
   659
lemma filtermap_at_minus: "filtermap (\<lambda>x. - x) (at a) = at (- a::real)"
hoelzl@50347
   660
  unfolding at_def filtermap_nhds_minus[symmetric]
hoelzl@50347
   661
  by (simp add: filter_eq_iff eventually_filtermap eventually_within)
hoelzl@50347
   662
hoelzl@50347
   663
lemma at_left_minus: "at_left (a::real) = filtermap (\<lambda>x. - x) (at_right (- a))"
hoelzl@50347
   664
  by (simp add: filter_eq_iff eventually_filtermap eventually_within filtermap_at_minus[symmetric])
hoelzl@50323
   665
hoelzl@50347
   666
lemma at_right_minus: "at_right (a::real) = filtermap (\<lambda>x. - x) (at_left (- a))"
hoelzl@50347
   667
  by (simp add: filter_eq_iff eventually_filtermap eventually_within filtermap_at_minus[symmetric])
hoelzl@50347
   668
hoelzl@50347
   669
lemma filterlim_at_left_to_right:
hoelzl@50347
   670
  "filterlim f F (at_left (a::real)) \<longleftrightarrow> filterlim (\<lambda>x. f (- x)) F (at_right (-a))"
hoelzl@50347
   671
  unfolding filterlim_def filtermap_filtermap at_left_minus[of a] ..
hoelzl@50347
   672
hoelzl@50347
   673
lemma eventually_at_left_to_right:
hoelzl@50347
   674
  "eventually P (at_left (a::real)) \<longleftrightarrow> eventually (\<lambda>x. P (- x)) (at_right (-a))"
hoelzl@50347
   675
  unfolding at_left_minus[of a] by (simp add: eventually_filtermap)
hoelzl@50347
   676
hoelzl@50346
   677
lemma at_top_mirror: "at_top = filtermap uminus (at_bot :: real filter)"
hoelzl@50346
   678
  unfolding filter_eq_iff eventually_filtermap eventually_at_top_linorder eventually_at_bot_linorder
hoelzl@50346
   679
  by (metis le_minus_iff minus_minus)
hoelzl@50346
   680
hoelzl@50346
   681
lemma at_bot_mirror: "at_bot = filtermap uminus (at_top :: real filter)"
hoelzl@50346
   682
  unfolding at_top_mirror filtermap_filtermap by (simp add: filtermap_ident)
hoelzl@50346
   683
hoelzl@50346
   684
lemma filterlim_at_top_mirror: "(LIM x at_top. f x :> F) \<longleftrightarrow> (LIM x at_bot. f (-x::real) :> F)"
hoelzl@50346
   685
  unfolding filterlim_def at_top_mirror filtermap_filtermap ..
hoelzl@50346
   686
hoelzl@50346
   687
lemma filterlim_at_bot_mirror: "(LIM x at_bot. f x :> F) \<longleftrightarrow> (LIM x at_top. f (-x::real) :> F)"
hoelzl@50346
   688
  unfolding filterlim_def at_bot_mirror filtermap_filtermap ..
hoelzl@50346
   689
hoelzl@50323
   690
lemma filterlim_uminus_at_top_at_bot: "LIM x at_bot. - x :: real :> at_top"
hoelzl@50323
   691
  unfolding filterlim_at_top eventually_at_bot_dense
hoelzl@50346
   692
  by (metis leI minus_less_iff order_less_asym)
hoelzl@50323
   693
hoelzl@50323
   694
lemma filterlim_uminus_at_bot_at_top: "LIM x at_top. - x :: real :> at_bot"
hoelzl@50323
   695
  unfolding filterlim_at_bot eventually_at_top_dense
hoelzl@50346
   696
  by (metis leI less_minus_iff order_less_asym)
hoelzl@50323
   697
hoelzl@50346
   698
lemma filterlim_uminus_at_top: "(LIM x F. f x :> at_top) \<longleftrightarrow> (LIM x F. - (f x) :: real :> at_bot)"
hoelzl@50346
   699
  using filterlim_compose[OF filterlim_uminus_at_bot_at_top, of f F]
hoelzl@50346
   700
  using filterlim_compose[OF filterlim_uminus_at_top_at_bot, of "\<lambda>x. - f x" F]
hoelzl@50346
   701
  by auto
hoelzl@50346
   702
hoelzl@50346
   703
lemma filterlim_uminus_at_bot: "(LIM x F. f x :> at_bot) \<longleftrightarrow> (LIM x F. - (f x) :: real :> at_top)"
hoelzl@50346
   704
  unfolding filterlim_uminus_at_top by simp
hoelzl@50323
   705
hoelzl@50347
   706
lemma filterlim_inverse_at_top_right: "LIM x at_right (0::real). inverse x :> at_top"
hoelzl@50347
   707
  unfolding filterlim_at_top_gt[where c=0] eventually_within at_def
hoelzl@50347
   708
proof safe
hoelzl@50347
   709
  fix Z :: real assume [arith]: "0 < Z"
hoelzl@50347
   710
  then have "eventually (\<lambda>x. x < inverse Z) (nhds 0)"
hoelzl@50347
   711
    by (auto simp add: eventually_nhds_metric dist_real_def intro!: exI[of _ "\<bar>inverse Z\<bar>"])
hoelzl@50347
   712
  then show "eventually (\<lambda>x. x \<in> - {0} \<longrightarrow> x \<in> {0<..} \<longrightarrow> Z \<le> inverse x) (nhds 0)"
hoelzl@50347
   713
    by (auto elim!: eventually_elim1 simp: inverse_eq_divide field_simps)
hoelzl@50347
   714
qed
hoelzl@50347
   715
hoelzl@50347
   716
lemma filterlim_inverse_at_top:
hoelzl@50347
   717
  "(f ---> (0 :: real)) F \<Longrightarrow> eventually (\<lambda>x. 0 < f x) F \<Longrightarrow> LIM x F. inverse (f x) :> at_top"
hoelzl@50347
   718
  by (intro filterlim_compose[OF filterlim_inverse_at_top_right])
hoelzl@50347
   719
     (simp add: filterlim_def eventually_filtermap le_within_iff at_def eventually_elim1)
hoelzl@50347
   720
hoelzl@50347
   721
lemma filterlim_inverse_at_bot_neg:
hoelzl@50347
   722
  "LIM x (at_left (0::real)). inverse x :> at_bot"
hoelzl@50347
   723
  by (simp add: filterlim_inverse_at_top_right filterlim_uminus_at_bot filterlim_at_left_to_right)
hoelzl@50347
   724
hoelzl@50347
   725
lemma filterlim_inverse_at_bot:
hoelzl@50347
   726
  "(f ---> (0 :: real)) F \<Longrightarrow> eventually (\<lambda>x. f x < 0) F \<Longrightarrow> LIM x F. inverse (f x) :> at_bot"
hoelzl@50347
   727
  unfolding filterlim_uminus_at_bot inverse_minus_eq[symmetric]
hoelzl@50347
   728
  by (rule filterlim_inverse_at_top) (simp_all add: tendsto_minus_cancel_left[symmetric])
hoelzl@50347
   729
hoelzl@50325
   730
lemma tendsto_inverse_0:
hoelzl@50325
   731
  fixes x :: "_ \<Rightarrow> 'a\<Colon>real_normed_div_algebra"
hoelzl@50325
   732
  shows "(inverse ---> (0::'a)) at_infinity"
hoelzl@50325
   733
  unfolding tendsto_Zfun_iff diff_0_right Zfun_def eventually_at_infinity
hoelzl@50325
   734
proof safe
hoelzl@50325
   735
  fix r :: real assume "0 < r"
hoelzl@50325
   736
  show "\<exists>b. \<forall>x. b \<le> norm x \<longrightarrow> norm (inverse x :: 'a) < r"
hoelzl@50325
   737
  proof (intro exI[of _ "inverse (r / 2)"] allI impI)
hoelzl@50325
   738
    fix x :: 'a
hoelzl@50325
   739
    from `0 < r` have "0 < inverse (r / 2)" by simp
hoelzl@50325
   740
    also assume *: "inverse (r / 2) \<le> norm x"
hoelzl@50325
   741
    finally show "norm (inverse x) < r"
hoelzl@50325
   742
      using * `0 < r` by (subst nonzero_norm_inverse) (simp_all add: inverse_eq_divide field_simps)
hoelzl@50325
   743
  qed
hoelzl@50325
   744
qed
hoelzl@50325
   745
hoelzl@50347
   746
lemma at_right_to_top: "(at_right (0::real)) = filtermap inverse at_top"
hoelzl@50347
   747
proof (rule antisym)
hoelzl@50347
   748
  have "(inverse ---> (0::real)) at_top"
hoelzl@50347
   749
    by (metis tendsto_inverse_0 filterlim_mono at_top_le_at_infinity order_refl)
hoelzl@50347
   750
  then show "filtermap inverse at_top \<le> at_right (0::real)"
hoelzl@50347
   751
    unfolding at_within_eq
hoelzl@50347
   752
    by (intro le_withinI) (simp_all add: eventually_filtermap eventually_gt_at_top filterlim_def)
hoelzl@50347
   753
next
hoelzl@50347
   754
  have "filtermap inverse (filtermap inverse (at_right (0::real))) \<le> filtermap inverse at_top"
hoelzl@50347
   755
    using filterlim_inverse_at_top_right unfolding filterlim_def by (rule filtermap_mono)
hoelzl@50347
   756
  then show "at_right (0::real) \<le> filtermap inverse at_top"
hoelzl@50347
   757
    by (simp add: filtermap_ident filtermap_filtermap)
hoelzl@50347
   758
qed
hoelzl@50347
   759
hoelzl@50347
   760
lemma eventually_at_right_to_top:
hoelzl@50347
   761
  "eventually P (at_right (0::real)) \<longleftrightarrow> eventually (\<lambda>x. P (inverse x)) at_top"
hoelzl@50347
   762
  unfolding at_right_to_top eventually_filtermap ..
hoelzl@50347
   763
hoelzl@50347
   764
lemma filterlim_at_right_to_top:
hoelzl@50347
   765
  "filterlim f F (at_right (0::real)) \<longleftrightarrow> (LIM x at_top. f (inverse x) :> F)"
hoelzl@50347
   766
  unfolding filterlim_def at_right_to_top filtermap_filtermap ..
hoelzl@50347
   767
hoelzl@50347
   768
lemma at_top_to_right: "at_top = filtermap inverse (at_right (0::real))"
hoelzl@50347
   769
  unfolding at_right_to_top filtermap_filtermap inverse_inverse_eq filtermap_ident ..
hoelzl@50347
   770
hoelzl@50347
   771
lemma eventually_at_top_to_right:
hoelzl@50347
   772
  "eventually P at_top \<longleftrightarrow> eventually (\<lambda>x. P (inverse x)) (at_right (0::real))"
hoelzl@50347
   773
  unfolding at_top_to_right eventually_filtermap ..
hoelzl@50347
   774
hoelzl@50347
   775
lemma filterlim_at_top_to_right:
hoelzl@50347
   776
  "filterlim f F at_top \<longleftrightarrow> (LIM x (at_right (0::real)). f (inverse x) :> F)"
hoelzl@50347
   777
  unfolding filterlim_def at_top_to_right filtermap_filtermap ..
hoelzl@50347
   778
hoelzl@50325
   779
lemma filterlim_inverse_at_infinity:
hoelzl@50325
   780
  fixes x :: "_ \<Rightarrow> 'a\<Colon>{real_normed_div_algebra, division_ring_inverse_zero}"
hoelzl@50325
   781
  shows "filterlim inverse at_infinity (at (0::'a))"
hoelzl@50325
   782
  unfolding filterlim_at_infinity[OF order_refl]
hoelzl@50325
   783
proof safe
hoelzl@50325
   784
  fix r :: real assume "0 < r"
hoelzl@50325
   785
  then show "eventually (\<lambda>x::'a. r \<le> norm (inverse x)) (at 0)"
hoelzl@50325
   786
    unfolding eventually_at norm_inverse
hoelzl@50325
   787
    by (intro exI[of _ "inverse r"])
hoelzl@50325
   788
       (auto simp: norm_conv_dist[symmetric] field_simps inverse_eq_divide)
hoelzl@50325
   789
qed
hoelzl@50325
   790
hoelzl@50325
   791
lemma filterlim_inverse_at_iff:
hoelzl@50325
   792
  fixes g :: "'a \<Rightarrow> 'b\<Colon>{real_normed_div_algebra, division_ring_inverse_zero}"
hoelzl@50325
   793
  shows "(LIM x F. inverse (g x) :> at 0) \<longleftrightarrow> (LIM x F. g x :> at_infinity)"
hoelzl@50325
   794
  unfolding filterlim_def filtermap_filtermap[symmetric]
hoelzl@50325
   795
proof
hoelzl@50325
   796
  assume "filtermap g F \<le> at_infinity"
hoelzl@50325
   797
  then have "filtermap inverse (filtermap g F) \<le> filtermap inverse at_infinity"
hoelzl@50325
   798
    by (rule filtermap_mono)
hoelzl@50325
   799
  also have "\<dots> \<le> at 0"
hoelzl@50325
   800
    using tendsto_inverse_0
hoelzl@50325
   801
    by (auto intro!: le_withinI exI[of _ 1]
hoelzl@50325
   802
             simp: eventually_filtermap eventually_at_infinity filterlim_def at_def)
hoelzl@50325
   803
  finally show "filtermap inverse (filtermap g F) \<le> at 0" .
hoelzl@50325
   804
next
hoelzl@50325
   805
  assume "filtermap inverse (filtermap g F) \<le> at 0"
hoelzl@50325
   806
  then have "filtermap inverse (filtermap inverse (filtermap g F)) \<le> filtermap inverse (at 0)"
hoelzl@50325
   807
    by (rule filtermap_mono)
hoelzl@50325
   808
  with filterlim_inverse_at_infinity show "filtermap g F \<le> at_infinity"
hoelzl@50325
   809
    by (auto intro: order_trans simp: filterlim_def filtermap_filtermap)
hoelzl@50325
   810
qed
hoelzl@50325
   811
hoelzl@50419
   812
lemma tendsto_inverse_0_at_top:
hoelzl@50419
   813
  "LIM x F. f x :> at_top \<Longrightarrow> ((\<lambda>x. inverse (f x) :: real) ---> 0) F"
hoelzl@50419
   814
 by (metis at_top_le_at_infinity filterlim_at filterlim_inverse_at_iff filterlim_mono order_refl)
hoelzl@50419
   815
hoelzl@50324
   816
text {*
hoelzl@50324
   817
hoelzl@50324
   818
We only show rules for multiplication and addition when the functions are either against a real
hoelzl@50324
   819
value or against infinity. Further rules are easy to derive by using @{thm filterlim_uminus_at_top}.
hoelzl@50324
   820
hoelzl@50324
   821
*}
hoelzl@50324
   822
hoelzl@50324
   823
lemma filterlim_tendsto_pos_mult_at_top: 
hoelzl@50324
   824
  assumes f: "(f ---> c) F" and c: "0 < c"
hoelzl@50324
   825
  assumes g: "LIM x F. g x :> at_top"
hoelzl@50324
   826
  shows "LIM x F. (f x * g x :: real) :> at_top"
hoelzl@50324
   827
  unfolding filterlim_at_top_gt[where c=0]
hoelzl@50324
   828
proof safe
hoelzl@50324
   829
  fix Z :: real assume "0 < Z"
hoelzl@50324
   830
  from f `0 < c` have "eventually (\<lambda>x. c / 2 < f x) F"
hoelzl@50324
   831
    by (auto dest!: tendstoD[where e="c / 2"] elim!: eventually_elim1
hoelzl@50324
   832
             simp: dist_real_def abs_real_def split: split_if_asm)
hoelzl@50346
   833
  moreover from g have "eventually (\<lambda>x. (Z / c * 2) \<le> g x) F"
hoelzl@50324
   834
    unfolding filterlim_at_top by auto
hoelzl@50346
   835
  ultimately show "eventually (\<lambda>x. Z \<le> f x * g x) F"
hoelzl@50324
   836
  proof eventually_elim
hoelzl@50346
   837
    fix x assume "c / 2 < f x" "Z / c * 2 \<le> g x"
hoelzl@50346
   838
    with `0 < Z` `0 < c` have "c / 2 * (Z / c * 2) \<le> f x * g x"
hoelzl@50346
   839
      by (intro mult_mono) (auto simp: zero_le_divide_iff)
hoelzl@50346
   840
    with `0 < c` show "Z \<le> f x * g x"
hoelzl@50324
   841
       by simp
hoelzl@50324
   842
  qed
hoelzl@50324
   843
qed
hoelzl@50324
   844
hoelzl@50324
   845
lemma filterlim_at_top_mult_at_top: 
hoelzl@50324
   846
  assumes f: "LIM x F. f x :> at_top"
hoelzl@50324
   847
  assumes g: "LIM x F. g x :> at_top"
hoelzl@50324
   848
  shows "LIM x F. (f x * g x :: real) :> at_top"
hoelzl@50324
   849
  unfolding filterlim_at_top_gt[where c=0]
hoelzl@50324
   850
proof safe
hoelzl@50324
   851
  fix Z :: real assume "0 < Z"
hoelzl@50346
   852
  from f have "eventually (\<lambda>x. 1 \<le> f x) F"
hoelzl@50324
   853
    unfolding filterlim_at_top by auto
hoelzl@50346
   854
  moreover from g have "eventually (\<lambda>x. Z \<le> g x) F"
hoelzl@50324
   855
    unfolding filterlim_at_top by auto
hoelzl@50346
   856
  ultimately show "eventually (\<lambda>x. Z \<le> f x * g x) F"
hoelzl@50324
   857
  proof eventually_elim
hoelzl@50346
   858
    fix x assume "1 \<le> f x" "Z \<le> g x"
hoelzl@50346
   859
    with `0 < Z` have "1 * Z \<le> f x * g x"
hoelzl@50346
   860
      by (intro mult_mono) (auto simp: zero_le_divide_iff)
hoelzl@50346
   861
    then show "Z \<le> f x * g x"
hoelzl@50324
   862
       by simp
hoelzl@50324
   863
  qed
hoelzl@50324
   864
qed
hoelzl@50324
   865
hoelzl@50419
   866
lemma filterlim_tendsto_pos_mult_at_bot:
hoelzl@50419
   867
  assumes "(f ---> c) F" "0 < (c::real)" "filterlim g at_bot F"
hoelzl@50419
   868
  shows "LIM x F. f x * g x :> at_bot"
hoelzl@50419
   869
  using filterlim_tendsto_pos_mult_at_top[OF assms(1,2), of "\<lambda>x. - g x"] assms(3)
hoelzl@50419
   870
  unfolding filterlim_uminus_at_bot by simp
hoelzl@50419
   871
hoelzl@50324
   872
lemma filterlim_tendsto_add_at_top: 
hoelzl@50324
   873
  assumes f: "(f ---> c) F"
hoelzl@50324
   874
  assumes g: "LIM x F. g x :> at_top"
hoelzl@50324
   875
  shows "LIM x F. (f x + g x :: real) :> at_top"
hoelzl@50324
   876
  unfolding filterlim_at_top_gt[where c=0]
hoelzl@50324
   877
proof safe
hoelzl@50324
   878
  fix Z :: real assume "0 < Z"
hoelzl@50324
   879
  from f have "eventually (\<lambda>x. c - 1 < f x) F"
hoelzl@50324
   880
    by (auto dest!: tendstoD[where e=1] elim!: eventually_elim1 simp: dist_real_def)
hoelzl@50346
   881
  moreover from g have "eventually (\<lambda>x. Z - (c - 1) \<le> g x) F"
hoelzl@50324
   882
    unfolding filterlim_at_top by auto
hoelzl@50346
   883
  ultimately show "eventually (\<lambda>x. Z \<le> f x + g x) F"
hoelzl@50324
   884
    by eventually_elim simp
hoelzl@50324
   885
qed
hoelzl@50324
   886
hoelzl@50347
   887
lemma LIM_at_top_divide:
hoelzl@50347
   888
  fixes f g :: "'a \<Rightarrow> real"
hoelzl@50347
   889
  assumes f: "(f ---> a) F" "0 < a"
hoelzl@50347
   890
  assumes g: "(g ---> 0) F" "eventually (\<lambda>x. 0 < g x) F"
hoelzl@50347
   891
  shows "LIM x F. f x / g x :> at_top"
hoelzl@50347
   892
  unfolding divide_inverse
hoelzl@50347
   893
  by (rule filterlim_tendsto_pos_mult_at_top[OF f]) (rule filterlim_inverse_at_top[OF g])
hoelzl@50347
   894
hoelzl@50324
   895
lemma filterlim_at_top_add_at_top: 
hoelzl@50324
   896
  assumes f: "LIM x F. f x :> at_top"
hoelzl@50324
   897
  assumes g: "LIM x F. g x :> at_top"
hoelzl@50324
   898
  shows "LIM x F. (f x + g x :: real) :> at_top"
hoelzl@50324
   899
  unfolding filterlim_at_top_gt[where c=0]
hoelzl@50324
   900
proof safe
hoelzl@50324
   901
  fix Z :: real assume "0 < Z"
hoelzl@50346
   902
  from f have "eventually (\<lambda>x. 0 \<le> f x) F"
hoelzl@50324
   903
    unfolding filterlim_at_top by auto
hoelzl@50346
   904
  moreover from g have "eventually (\<lambda>x. Z \<le> g x) F"
hoelzl@50324
   905
    unfolding filterlim_at_top by auto
hoelzl@50346
   906
  ultimately show "eventually (\<lambda>x. Z \<le> f x + g x) F"
hoelzl@50324
   907
    by eventually_elim simp
hoelzl@50324
   908
qed
hoelzl@50324
   909
hoelzl@50331
   910
lemma tendsto_divide_0:
hoelzl@50331
   911
  fixes f :: "_ \<Rightarrow> 'a\<Colon>{real_normed_div_algebra, division_ring_inverse_zero}"
hoelzl@50331
   912
  assumes f: "(f ---> c) F"
hoelzl@50331
   913
  assumes g: "LIM x F. g x :> at_infinity"
hoelzl@50331
   914
  shows "((\<lambda>x. f x / g x) ---> 0) F"
hoelzl@50331
   915
  using tendsto_mult[OF f filterlim_compose[OF tendsto_inverse_0 g]] by (simp add: divide_inverse)
hoelzl@50331
   916
hoelzl@50331
   917
lemma linear_plus_1_le_power:
hoelzl@50331
   918
  fixes x :: real
hoelzl@50331
   919
  assumes x: "0 \<le> x"
hoelzl@50331
   920
  shows "real n * x + 1 \<le> (x + 1) ^ n"
hoelzl@50331
   921
proof (induct n)
hoelzl@50331
   922
  case (Suc n)
hoelzl@50331
   923
  have "real (Suc n) * x + 1 \<le> (x + 1) * (real n * x + 1)"
hoelzl@50331
   924
    by (simp add: field_simps real_of_nat_Suc mult_nonneg_nonneg x)
hoelzl@50331
   925
  also have "\<dots> \<le> (x + 1)^Suc n"
hoelzl@50331
   926
    using Suc x by (simp add: mult_left_mono)
hoelzl@50331
   927
  finally show ?case .
hoelzl@50331
   928
qed simp
hoelzl@50331
   929
hoelzl@50331
   930
lemma filterlim_realpow_sequentially_gt1:
hoelzl@50331
   931
  fixes x :: "'a :: real_normed_div_algebra"
hoelzl@50331
   932
  assumes x[arith]: "1 < norm x"
hoelzl@50331
   933
  shows "LIM n sequentially. x ^ n :> at_infinity"
hoelzl@50331
   934
proof (intro filterlim_at_infinity[THEN iffD2] allI impI)
hoelzl@50331
   935
  fix y :: real assume "0 < y"
hoelzl@50331
   936
  have "0 < norm x - 1" by simp
hoelzl@50331
   937
  then obtain N::nat where "y < real N * (norm x - 1)" by (blast dest: reals_Archimedean3)
hoelzl@50331
   938
  also have "\<dots> \<le> real N * (norm x - 1) + 1" by simp
hoelzl@50331
   939
  also have "\<dots> \<le> (norm x - 1 + 1) ^ N" by (rule linear_plus_1_le_power) simp
hoelzl@50331
   940
  also have "\<dots> = norm x ^ N" by simp
hoelzl@50331
   941
  finally have "\<forall>n\<ge>N. y \<le> norm x ^ n"
hoelzl@50331
   942
    by (metis order_less_le_trans power_increasing order_less_imp_le x)
hoelzl@50331
   943
  then show "eventually (\<lambda>n. y \<le> norm (x ^ n)) sequentially"
hoelzl@50331
   944
    unfolding eventually_sequentially
hoelzl@50331
   945
    by (auto simp: norm_power)
hoelzl@50331
   946
qed simp
hoelzl@50331
   947
hoelzl@51471
   948
hoelzl@51471
   949
(* Unfortunately eventually_within was overwritten by Multivariate_Analysis.
hoelzl@51471
   950
   Hence it was references as Limits.within, but now it is Basic_Topology.eventually_within *)
hoelzl@51471
   951
lemmas eventually_within = eventually_within
hoelzl@51471
   952
huffman@31349
   953
end
hoelzl@50324
   954