src/HOL/Log.thy
author wenzelm
Thu May 24 17:25:53 2012 +0200 (2012-05-24)
changeset 47988 e4b69e10b990
parent 47595 836b4c4d7c86
child 49962 a8cc904a6820
permissions -rw-r--r--
tuned proofs;
paulson@12224
     1
(*  Title       : Log.thy
paulson@12224
     2
    Author      : Jacques D. Fleuriot
avigad@16819
     3
                  Additional contributions by Jeremy Avigad
paulson@12224
     4
    Copyright   : 2000,2001 University of Edinburgh
paulson@12224
     5
*)
paulson@12224
     6
paulson@14411
     7
header{*Logarithms: Standard Version*}
paulson@14411
     8
nipkow@15131
     9
theory Log
nipkow@15140
    10
imports Transcendental
nipkow@15131
    11
begin
paulson@12224
    12
wenzelm@19765
    13
definition
wenzelm@21404
    14
  powr  :: "[real,real] => real"     (infixr "powr" 80) where
paulson@14411
    15
    --{*exponentation with real exponent*}
wenzelm@19765
    16
  "x powr a = exp(a * ln x)"
paulson@12224
    17
wenzelm@21404
    18
definition
wenzelm@21404
    19
  log :: "[real,real] => real" where
nipkow@15053
    20
    --{*logarithm of @{term x} to base @{term a}*}
wenzelm@19765
    21
  "log a x = ln x / ln a"
paulson@12224
    22
paulson@14411
    23
paulson@14411
    24
paulson@14411
    25
lemma powr_one_eq_one [simp]: "1 powr a = 1"
paulson@14411
    26
by (simp add: powr_def)
paulson@14411
    27
paulson@14411
    28
lemma powr_zero_eq_one [simp]: "x powr 0 = 1"
paulson@14411
    29
by (simp add: powr_def)
paulson@14411
    30
paulson@14411
    31
lemma powr_one_gt_zero_iff [simp]: "(x powr 1 = x) = (0 < x)"
paulson@14411
    32
by (simp add: powr_def)
paulson@14411
    33
declare powr_one_gt_zero_iff [THEN iffD2, simp]
paulson@14411
    34
paulson@14411
    35
lemma powr_mult: 
paulson@14411
    36
      "[| 0 < x; 0 < y |] ==> (x * y) powr a = (x powr a) * (y powr a)"
paulson@14411
    37
by (simp add: powr_def exp_add [symmetric] ln_mult right_distrib)
paulson@14411
    38
paulson@14411
    39
lemma powr_gt_zero [simp]: "0 < x powr a"
paulson@14411
    40
by (simp add: powr_def)
paulson@14411
    41
avigad@16819
    42
lemma powr_ge_pzero [simp]: "0 <= x powr y"
avigad@16819
    43
by (rule order_less_imp_le, rule powr_gt_zero)
avigad@16819
    44
paulson@14411
    45
lemma powr_not_zero [simp]: "x powr a \<noteq> 0"
paulson@14411
    46
by (simp add: powr_def)
paulson@14411
    47
paulson@14411
    48
lemma powr_divide:
paulson@14411
    49
     "[| 0 < x; 0 < y |] ==> (x / y) powr a = (x powr a)/(y powr a)"
paulson@14430
    50
apply (simp add: divide_inverse positive_imp_inverse_positive powr_mult)
paulson@14411
    51
apply (simp add: powr_def exp_minus [symmetric] exp_add [symmetric] ln_inverse)
paulson@14411
    52
done
paulson@14411
    53
avigad@16819
    54
lemma powr_divide2: "x powr a / x powr b = x powr (a - b)"
avigad@16819
    55
  apply (simp add: powr_def)
avigad@16819
    56
  apply (subst exp_diff [THEN sym])
avigad@16819
    57
  apply (simp add: left_diff_distrib)
avigad@16819
    58
done
avigad@16819
    59
paulson@14411
    60
lemma powr_add: "x powr (a + b) = (x powr a) * (x powr b)"
paulson@14411
    61
by (simp add: powr_def exp_add [symmetric] left_distrib)
paulson@14411
    62
noschinl@45930
    63
lemma powr_mult_base:
noschinl@45930
    64
  "0 < x \<Longrightarrow>x * x powr y = x powr (1 + y)"
noschinl@45930
    65
using assms by (auto simp: powr_add)
noschinl@45930
    66
paulson@14411
    67
lemma powr_powr: "(x powr a) powr b = x powr (a * b)"
paulson@14411
    68
by (simp add: powr_def)
paulson@14411
    69
paulson@14411
    70
lemma powr_powr_swap: "(x powr a) powr b = (x powr b) powr a"
huffman@36777
    71
by (simp add: powr_powr mult_commute)
paulson@14411
    72
paulson@14411
    73
lemma powr_minus: "x powr (-a) = inverse (x powr a)"
paulson@14411
    74
by (simp add: powr_def exp_minus [symmetric])
paulson@14411
    75
paulson@14411
    76
lemma powr_minus_divide: "x powr (-a) = 1/(x powr a)"
paulson@14430
    77
by (simp add: divide_inverse powr_minus)
paulson@14411
    78
paulson@14411
    79
lemma powr_less_mono: "[| a < b; 1 < x |] ==> x powr a < x powr b"
paulson@14411
    80
by (simp add: powr_def)
paulson@14411
    81
paulson@14411
    82
lemma powr_less_cancel: "[| x powr a < x powr b; 1 < x |] ==> a < b"
paulson@14411
    83
by (simp add: powr_def)
paulson@14411
    84
paulson@14411
    85
lemma powr_less_cancel_iff [simp]: "1 < x ==> (x powr a < x powr b) = (a < b)"
paulson@14411
    86
by (blast intro: powr_less_cancel powr_less_mono)
paulson@14411
    87
paulson@14411
    88
lemma powr_le_cancel_iff [simp]: "1 < x ==> (x powr a \<le> x powr b) = (a \<le> b)"
paulson@14411
    89
by (simp add: linorder_not_less [symmetric])
paulson@14411
    90
paulson@14411
    91
lemma log_ln: "ln x = log (exp(1)) x"
paulson@14411
    92
by (simp add: log_def)
paulson@14411
    93
hoelzl@45916
    94
lemma DERIV_log: assumes "x > 0" shows "DERIV (\<lambda>y. log b y) x :> 1 / (ln b * x)"
hoelzl@45916
    95
proof -
hoelzl@45916
    96
  def lb \<equiv> "1 / ln b"
hoelzl@45916
    97
  moreover have "DERIV (\<lambda>y. lb * ln y) x :> lb / x"
hoelzl@45916
    98
    using `x > 0` by (auto intro!: DERIV_intros)
hoelzl@45916
    99
  ultimately show ?thesis
hoelzl@45916
   100
    by (simp add: log_def)
hoelzl@45916
   101
qed
hoelzl@45916
   102
hoelzl@45916
   103
lemmas DERIV_log[THEN DERIV_chain2, THEN DERIV_cong, DERIV_intros]
paulson@33716
   104
paulson@14411
   105
lemma powr_log_cancel [simp]:
paulson@14411
   106
     "[| 0 < a; a \<noteq> 1; 0 < x |] ==> a powr (log a x) = x"
paulson@14411
   107
by (simp add: powr_def log_def)
paulson@14411
   108
paulson@14411
   109
lemma log_powr_cancel [simp]: "[| 0 < a; a \<noteq> 1 |] ==> log a (a powr y) = y"
paulson@14411
   110
by (simp add: log_def powr_def)
paulson@14411
   111
paulson@14411
   112
lemma log_mult: 
paulson@14411
   113
     "[| 0 < a; a \<noteq> 1; 0 < x; 0 < y |]  
paulson@14411
   114
      ==> log a (x * y) = log a x + log a y"
paulson@14430
   115
by (simp add: log_def ln_mult divide_inverse left_distrib)
paulson@14411
   116
paulson@14411
   117
lemma log_eq_div_ln_mult_log: 
paulson@14411
   118
     "[| 0 < a; a \<noteq> 1; 0 < b; b \<noteq> 1; 0 < x |]  
paulson@14411
   119
      ==> log a x = (ln b/ln a) * log b x"
paulson@14430
   120
by (simp add: log_def divide_inverse)
paulson@14411
   121
paulson@14411
   122
text{*Base 10 logarithms*}
paulson@14411
   123
lemma log_base_10_eq1: "0 < x ==> log 10 x = (ln (exp 1) / ln 10) * ln x"
paulson@14411
   124
by (simp add: log_def)
paulson@14411
   125
paulson@14411
   126
lemma log_base_10_eq2: "0 < x ==> log 10 x = (log 10 (exp 1)) * ln x"
paulson@14411
   127
by (simp add: log_def)
paulson@14411
   128
paulson@14411
   129
lemma log_one [simp]: "log a 1 = 0"
paulson@14411
   130
by (simp add: log_def)
paulson@14411
   131
paulson@14411
   132
lemma log_eq_one [simp]: "[| 0 < a; a \<noteq> 1 |] ==> log a a = 1"
paulson@14411
   133
by (simp add: log_def)
paulson@14411
   134
paulson@14411
   135
lemma log_inverse:
paulson@14411
   136
     "[| 0 < a; a \<noteq> 1; 0 < x |] ==> log a (inverse x) = - log a x"
paulson@14411
   137
apply (rule_tac a1 = "log a x" in add_left_cancel [THEN iffD1])
paulson@14411
   138
apply (simp add: log_mult [symmetric])
paulson@14411
   139
done
paulson@14411
   140
paulson@14411
   141
lemma log_divide:
paulson@14411
   142
     "[|0 < a; a \<noteq> 1; 0 < x; 0 < y|] ==> log a (x/y) = log a x - log a y"
paulson@14430
   143
by (simp add: log_mult divide_inverse log_inverse)
paulson@14411
   144
paulson@14411
   145
lemma log_less_cancel_iff [simp]:
paulson@14411
   146
     "[| 1 < a; 0 < x; 0 < y |] ==> (log a x < log a y) = (x < y)"
paulson@14411
   147
apply safe
paulson@14411
   148
apply (rule_tac [2] powr_less_cancel)
paulson@14411
   149
apply (drule_tac a = "log a x" in powr_less_mono, auto)
paulson@14411
   150
done
paulson@14411
   151
hoelzl@36622
   152
lemma log_inj: assumes "1 < b" shows "inj_on (log b) {0 <..}"
hoelzl@36622
   153
proof (rule inj_onI, simp)
hoelzl@36622
   154
  fix x y assume pos: "0 < x" "0 < y" and *: "log b x = log b y"
hoelzl@36622
   155
  show "x = y"
hoelzl@36622
   156
  proof (cases rule: linorder_cases)
hoelzl@36622
   157
    assume "x < y" hence "log b x < log b y"
hoelzl@36622
   158
      using log_less_cancel_iff[OF `1 < b`] pos by simp
hoelzl@36622
   159
    thus ?thesis using * by simp
hoelzl@36622
   160
  next
hoelzl@36622
   161
    assume "y < x" hence "log b y < log b x"
hoelzl@36622
   162
      using log_less_cancel_iff[OF `1 < b`] pos by simp
hoelzl@36622
   163
    thus ?thesis using * by simp
hoelzl@36622
   164
  qed simp
hoelzl@36622
   165
qed
hoelzl@36622
   166
paulson@14411
   167
lemma log_le_cancel_iff [simp]:
paulson@14411
   168
     "[| 1 < a; 0 < x; 0 < y |] ==> (log a x \<le> log a y) = (x \<le> y)"
paulson@14411
   169
by (simp add: linorder_not_less [symmetric])
paulson@14411
   170
hoelzl@47593
   171
lemma zero_less_log_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> 0 < log a x \<longleftrightarrow> 1 < x"
hoelzl@47593
   172
  using log_less_cancel_iff[of a 1 x] by simp
hoelzl@47593
   173
hoelzl@47593
   174
lemma zero_le_log_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> 0 \<le> log a x \<longleftrightarrow> 1 \<le> x"
hoelzl@47593
   175
  using log_le_cancel_iff[of a 1 x] by simp
hoelzl@47593
   176
hoelzl@47593
   177
lemma log_less_zero_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> log a x < 0 \<longleftrightarrow> x < 1"
hoelzl@47593
   178
  using log_less_cancel_iff[of a x 1] by simp
hoelzl@47593
   179
hoelzl@47593
   180
lemma log_le_zero_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> log a x \<le> 0 \<longleftrightarrow> x \<le> 1"
hoelzl@47593
   181
  using log_le_cancel_iff[of a x 1] by simp
hoelzl@47593
   182
hoelzl@47593
   183
lemma one_less_log_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> 1 < log a x \<longleftrightarrow> a < x"
hoelzl@47593
   184
  using log_less_cancel_iff[of a a x] by simp
hoelzl@47593
   185
hoelzl@47593
   186
lemma one_le_log_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> 1 \<le> log a x \<longleftrightarrow> a \<le> x"
hoelzl@47593
   187
  using log_le_cancel_iff[of a a x] by simp
hoelzl@47593
   188
hoelzl@47593
   189
lemma log_less_one_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> log a x < 1 \<longleftrightarrow> x < a"
hoelzl@47593
   190
  using log_less_cancel_iff[of a x a] by simp
hoelzl@47593
   191
hoelzl@47593
   192
lemma log_le_one_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> log a x \<le> 1 \<longleftrightarrow> x \<le> a"
hoelzl@47593
   193
  using log_le_cancel_iff[of a x a] by simp
paulson@14411
   194
paulson@15085
   195
lemma powr_realpow: "0 < x ==> x powr (real n) = x^n"
paulson@15085
   196
  apply (induct n, simp)
paulson@15085
   197
  apply (subgoal_tac "real(Suc n) = real n + 1")
paulson@15085
   198
  apply (erule ssubst)
paulson@15085
   199
  apply (subst powr_add, simp, simp)
paulson@15085
   200
done
paulson@15085
   201
hoelzl@47594
   202
lemma powr_realpow2: "0 <= x ==> 0 < n ==> x^n = (if (x = 0) then 0 else x powr (real n))"
paulson@15085
   203
  apply (case_tac "x = 0", simp, simp)
paulson@15085
   204
  apply (rule powr_realpow [THEN sym], simp)
paulson@15085
   205
done
paulson@15085
   206
hoelzl@47594
   207
lemma powr_int:
hoelzl@47594
   208
  assumes "x > 0"
hoelzl@47594
   209
  shows "x powr i = (if i \<ge> 0 then x ^ nat i else 1 / x ^ nat (-i))"
hoelzl@47594
   210
proof cases
hoelzl@47594
   211
  assume "i < 0"
hoelzl@47594
   212
  have r: "x powr i = 1 / x powr (-i)" by (simp add: powr_minus field_simps)
hoelzl@47594
   213
  show ?thesis using `i < 0` `x > 0` by (simp add: r field_simps powr_realpow[symmetric])
hoelzl@47594
   214
qed (simp add: assms powr_realpow[symmetric])
hoelzl@47594
   215
hoelzl@47594
   216
lemma powr_numeral: "0 < x \<Longrightarrow> x powr numeral n = x^numeral n"
hoelzl@47594
   217
  using powr_realpow[of x "numeral n"] by simp
hoelzl@47594
   218
hoelzl@47594
   219
lemma powr_neg_numeral: "0 < x \<Longrightarrow> x powr neg_numeral n = 1 / x^numeral n"
hoelzl@47594
   220
  using powr_int[of x "neg_numeral n"] by simp
hoelzl@47594
   221
noschinl@45930
   222
lemma root_powr_inverse:
noschinl@45930
   223
  "0 < n \<Longrightarrow> 0 < x \<Longrightarrow> root n x = x powr (1/n)"
noschinl@45930
   224
by (auto simp: root_def powr_realpow[symmetric] powr_powr)
noschinl@45930
   225
paulson@33716
   226
lemma ln_powr: "0 < x ==> 0 < y ==> ln(x powr y) = y * ln x"
paulson@15085
   227
by (unfold powr_def, simp)
paulson@15085
   228
paulson@33716
   229
lemma log_powr: "0 < x ==> 0 \<le> y ==> log b (x powr y) = y * log b x"
paulson@33716
   230
  apply (case_tac "y = 0")
paulson@33716
   231
  apply force
paulson@33716
   232
  apply (auto simp add: log_def ln_powr field_simps)
paulson@33716
   233
done
paulson@33716
   234
paulson@33716
   235
lemma log_nat_power: "0 < x ==> log b (x^n) = real n * log b x"
paulson@33716
   236
  apply (subst powr_realpow [symmetric])
paulson@33716
   237
  apply (auto simp add: log_powr)
paulson@33716
   238
done
paulson@33716
   239
paulson@15085
   240
lemma ln_bound: "1 <= x ==> ln x <= x"
paulson@15085
   241
  apply (subgoal_tac "ln(1 + (x - 1)) <= x - 1")
paulson@15085
   242
  apply simp
paulson@15085
   243
  apply (rule ln_add_one_self_le_self, simp)
paulson@15085
   244
done
paulson@15085
   245
paulson@15085
   246
lemma powr_mono: "a <= b ==> 1 <= x ==> x powr a <= x powr b"
paulson@15085
   247
  apply (case_tac "x = 1", simp)
paulson@15085
   248
  apply (case_tac "a = b", simp)
paulson@15085
   249
  apply (rule order_less_imp_le)
paulson@15085
   250
  apply (rule powr_less_mono, auto)
paulson@15085
   251
done
paulson@15085
   252
paulson@15085
   253
lemma ge_one_powr_ge_zero: "1 <= x ==> 0 <= a ==> 1 <= x powr a"
paulson@15085
   254
  apply (subst powr_zero_eq_one [THEN sym])
paulson@15085
   255
  apply (rule powr_mono, assumption+)
paulson@15085
   256
done
paulson@15085
   257
paulson@15085
   258
lemma powr_less_mono2: "0 < a ==> 0 < x ==> x < y ==> x powr a <
paulson@15085
   259
    y powr a"
paulson@15085
   260
  apply (unfold powr_def)
paulson@15085
   261
  apply (rule exp_less_mono)
paulson@15085
   262
  apply (rule mult_strict_left_mono)
paulson@15085
   263
  apply (subst ln_less_cancel_iff, assumption)
paulson@15085
   264
  apply (rule order_less_trans)
paulson@15085
   265
  prefer 2
paulson@15085
   266
  apply assumption+
paulson@15085
   267
done
paulson@15085
   268
avigad@16819
   269
lemma powr_less_mono2_neg: "a < 0 ==> 0 < x ==> x < y ==> y powr a <
avigad@16819
   270
    x powr a"
avigad@16819
   271
  apply (unfold powr_def)
avigad@16819
   272
  apply (rule exp_less_mono)
avigad@16819
   273
  apply (rule mult_strict_left_mono_neg)
avigad@16819
   274
  apply (subst ln_less_cancel_iff)
avigad@16819
   275
  apply assumption
avigad@16819
   276
  apply (rule order_less_trans)
avigad@16819
   277
  prefer 2
avigad@16819
   278
  apply assumption+
avigad@16819
   279
done
avigad@16819
   280
avigad@16819
   281
lemma powr_mono2: "0 <= a ==> 0 < x ==> x <= y ==> x powr a <= y powr a"
paulson@15085
   282
  apply (case_tac "a = 0", simp)
paulson@15085
   283
  apply (case_tac "x = y", simp)
paulson@15085
   284
  apply (rule order_less_imp_le)
paulson@15085
   285
  apply (rule powr_less_mono2, auto)
paulson@15085
   286
done
paulson@15085
   287
hoelzl@47595
   288
lemma powr_inj:
hoelzl@47595
   289
  "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> a powr x = a powr y \<longleftrightarrow> x = y"
hoelzl@47595
   290
  unfolding powr_def exp_inj_iff by simp
hoelzl@47595
   291
avigad@16819
   292
lemma ln_powr_bound: "1 <= x ==> 0 < a ==> ln x <= (x powr a) / a"
avigad@16819
   293
  apply (rule mult_imp_le_div_pos)
avigad@16819
   294
  apply (assumption)
avigad@16819
   295
  apply (subst mult_commute)
paulson@33716
   296
  apply (subst ln_powr [THEN sym])
avigad@16819
   297
  apply auto
avigad@16819
   298
  apply (rule ln_bound)
avigad@16819
   299
  apply (erule ge_one_powr_ge_zero)
avigad@16819
   300
  apply (erule order_less_imp_le)
avigad@16819
   301
done
avigad@16819
   302
wenzelm@41550
   303
lemma ln_powr_bound2:
wenzelm@41550
   304
  assumes "1 < x" and "0 < a"
wenzelm@41550
   305
  shows "(ln x) powr a <= (a powr a) * x"
avigad@16819
   306
proof -
wenzelm@41550
   307
  from assms have "ln x <= (x powr (1 / a)) / (1 / a)"
avigad@16819
   308
    apply (intro ln_powr_bound)
avigad@16819
   309
    apply (erule order_less_imp_le)
avigad@16819
   310
    apply (rule divide_pos_pos)
avigad@16819
   311
    apply simp_all
avigad@16819
   312
    done
avigad@16819
   313
  also have "... = a * (x powr (1 / a))"
avigad@16819
   314
    by simp
avigad@16819
   315
  finally have "(ln x) powr a <= (a * (x powr (1 / a))) powr a"
avigad@16819
   316
    apply (intro powr_mono2)
wenzelm@41550
   317
    apply (rule order_less_imp_le, rule assms)
avigad@16819
   318
    apply (rule ln_gt_zero)
wenzelm@41550
   319
    apply (rule assms)
avigad@16819
   320
    apply assumption
avigad@16819
   321
    done
avigad@16819
   322
  also have "... = (a powr a) * ((x powr (1 / a)) powr a)"
avigad@16819
   323
    apply (rule powr_mult)
wenzelm@41550
   324
    apply (rule assms)
avigad@16819
   325
    apply (rule powr_gt_zero)
avigad@16819
   326
    done
avigad@16819
   327
  also have "(x powr (1 / a)) powr a = x powr ((1 / a) * a)"
avigad@16819
   328
    by (rule powr_powr)
avigad@16819
   329
  also have "... = x"
avigad@16819
   330
    apply simp
avigad@16819
   331
    apply (subgoal_tac "a ~= 0")
wenzelm@41550
   332
    using assms apply auto
avigad@16819
   333
    done
avigad@16819
   334
  finally show ?thesis .
avigad@16819
   335
qed
avigad@16819
   336
huffman@45915
   337
lemma tendsto_powr [tendsto_intros]:
huffman@45915
   338
  "\<lbrakk>(f ---> a) F; (g ---> b) F; 0 < a\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x powr g x) ---> a powr b) F"
huffman@45915
   339
  unfolding powr_def by (intro tendsto_intros)
huffman@45915
   340
noschinl@45892
   341
(* FIXME: generalize by replacing d by with g x and g ---> d? *)
noschinl@45892
   342
lemma tendsto_zero_powrI:
noschinl@45892
   343
  assumes "eventually (\<lambda>x. 0 < f x ) F" and "(f ---> 0) F"
noschinl@45892
   344
  assumes "0 < d"
noschinl@45892
   345
  shows "((\<lambda>x. f x powr d) ---> 0) F"
noschinl@45892
   346
proof (rule tendstoI)
noschinl@45892
   347
  fix e :: real assume "0 < e"
noschinl@45892
   348
  def Z \<equiv> "e powr (1 / d)"
noschinl@45892
   349
  with `0 < e` have "0 < Z" by simp
noschinl@45892
   350
  with assms have "eventually (\<lambda>x. 0 < f x \<and> dist (f x) 0 < Z) F"
noschinl@45892
   351
    by (intro eventually_conj tendstoD)
noschinl@45892
   352
  moreover
noschinl@45892
   353
  from assms have "\<And>x. 0 < x \<and> dist x 0 < Z \<Longrightarrow> x powr d < Z powr d"
noschinl@45892
   354
    by (intro powr_less_mono2) (auto simp: dist_real_def)
noschinl@45892
   355
  with assms `0 < e` have "\<And>x. 0 < x \<and> dist x 0 < Z \<Longrightarrow> dist (x powr d) 0 < e"
noschinl@45892
   356
    unfolding dist_real_def Z_def by (auto simp: powr_powr)
noschinl@45892
   357
  ultimately
noschinl@45892
   358
  show "eventually (\<lambda>x. dist (f x powr d) 0 < e) F" by (rule eventually_elim1)
noschinl@45892
   359
qed
noschinl@45892
   360
noschinl@45892
   361
lemma tendsto_neg_powr:
noschinl@45892
   362
  assumes "s < 0" and "real_tendsto_inf f F"
noschinl@45892
   363
  shows "((\<lambda>x. f x powr s) ---> 0) F"
noschinl@45892
   364
proof (rule tendstoI)
noschinl@45892
   365
  fix e :: real assume "0 < e"
noschinl@45892
   366
  def Z \<equiv> "e powr (1 / s)"
noschinl@45892
   367
  from assms have "eventually (\<lambda>x. Z < f x) F" by (simp add: real_tendsto_inf_def)
noschinl@45892
   368
  moreover
noschinl@45892
   369
  from assms have "\<And>x. Z < x \<Longrightarrow> x powr s < Z powr s"
noschinl@45892
   370
    by (auto simp: Z_def intro!: powr_less_mono2_neg)
noschinl@45892
   371
  with assms `0 < e` have "\<And>x. Z < x \<Longrightarrow> dist (x powr s) 0 < e"
noschinl@45892
   372
    by (simp add: powr_powr Z_def dist_real_def)
noschinl@45892
   373
  ultimately
noschinl@45892
   374
  show "eventually (\<lambda>x. dist (f x powr s) 0 < e) F" by (rule eventually_elim1)
wenzelm@41550
   375
qed
avigad@16819
   376
paulson@12224
   377
end