src/HOL/Hyperreal/Log.thy
author paulson
Thu Jul 29 16:14:42 2004 +0200 (2004-07-29)
changeset 15085 5693a977a767
parent 15053 405be2b48f5b
child 15131 c69542757a4d
permissions -rw-r--r--
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson@12224
     1
(*  Title       : Log.thy
paulson@12224
     2
    Author      : Jacques D. Fleuriot
paulson@12224
     3
    Copyright   : 2000,2001 University of Edinburgh
paulson@12224
     4
*)
paulson@12224
     5
paulson@14411
     6
header{*Logarithms: Standard Version*}
paulson@14411
     7
paulson@14411
     8
theory Log = Transcendental:
paulson@12224
     9
paulson@12224
    10
constdefs
paulson@12224
    11
paulson@14411
    12
  powr  :: "[real,real] => real"     (infixr "powr" 80)
paulson@14411
    13
    --{*exponentation with real exponent*}
paulson@12224
    14
    "x powr a == exp(a * ln x)"
paulson@12224
    15
paulson@14411
    16
  log :: "[real,real] => real"
nipkow@15053
    17
    --{*logarithm of @{term x} to base @{term a}*}
paulson@12224
    18
    "log a x == ln x / ln a"
paulson@12224
    19
paulson@14411
    20
paulson@14411
    21
paulson@14411
    22
lemma powr_one_eq_one [simp]: "1 powr a = 1"
paulson@14411
    23
by (simp add: powr_def)
paulson@14411
    24
paulson@14411
    25
lemma powr_zero_eq_one [simp]: "x powr 0 = 1"
paulson@14411
    26
by (simp add: powr_def)
paulson@14411
    27
paulson@14411
    28
lemma powr_one_gt_zero_iff [simp]: "(x powr 1 = x) = (0 < x)"
paulson@14411
    29
by (simp add: powr_def)
paulson@14411
    30
declare powr_one_gt_zero_iff [THEN iffD2, simp]
paulson@14411
    31
paulson@14411
    32
lemma powr_mult: 
paulson@14411
    33
      "[| 0 < x; 0 < y |] ==> (x * y) powr a = (x powr a) * (y powr a)"
paulson@14411
    34
by (simp add: powr_def exp_add [symmetric] ln_mult right_distrib)
paulson@14411
    35
paulson@14411
    36
lemma powr_gt_zero [simp]: "0 < x powr a"
paulson@14411
    37
by (simp add: powr_def)
paulson@14411
    38
paulson@14411
    39
lemma powr_not_zero [simp]: "x powr a \<noteq> 0"
paulson@14411
    40
by (simp add: powr_def)
paulson@14411
    41
paulson@14411
    42
lemma powr_divide:
paulson@14411
    43
     "[| 0 < x; 0 < y |] ==> (x / y) powr a = (x powr a)/(y powr a)"
paulson@14430
    44
apply (simp add: divide_inverse positive_imp_inverse_positive powr_mult)
paulson@14411
    45
apply (simp add: powr_def exp_minus [symmetric] exp_add [symmetric] ln_inverse)
paulson@14411
    46
done
paulson@14411
    47
paulson@14411
    48
lemma powr_add: "x powr (a + b) = (x powr a) * (x powr b)"
paulson@14411
    49
by (simp add: powr_def exp_add [symmetric] left_distrib)
paulson@14411
    50
paulson@14411
    51
lemma powr_powr: "(x powr a) powr b = x powr (a * b)"
paulson@14411
    52
by (simp add: powr_def)
paulson@14411
    53
paulson@14411
    54
lemma powr_powr_swap: "(x powr a) powr b = (x powr b) powr a"
paulson@14411
    55
by (simp add: powr_powr real_mult_commute)
paulson@14411
    56
paulson@14411
    57
lemma powr_minus: "x powr (-a) = inverse (x powr a)"
paulson@14411
    58
by (simp add: powr_def exp_minus [symmetric])
paulson@14411
    59
paulson@14411
    60
lemma powr_minus_divide: "x powr (-a) = 1/(x powr a)"
paulson@14430
    61
by (simp add: divide_inverse powr_minus)
paulson@14411
    62
paulson@14411
    63
lemma powr_less_mono: "[| a < b; 1 < x |] ==> x powr a < x powr b"
paulson@14411
    64
by (simp add: powr_def)
paulson@14411
    65
paulson@14411
    66
lemma powr_less_cancel: "[| x powr a < x powr b; 1 < x |] ==> a < b"
paulson@14411
    67
by (simp add: powr_def)
paulson@14411
    68
paulson@14411
    69
lemma powr_less_cancel_iff [simp]: "1 < x ==> (x powr a < x powr b) = (a < b)"
paulson@14411
    70
by (blast intro: powr_less_cancel powr_less_mono)
paulson@14411
    71
paulson@14411
    72
lemma powr_le_cancel_iff [simp]: "1 < x ==> (x powr a \<le> x powr b) = (a \<le> b)"
paulson@14411
    73
by (simp add: linorder_not_less [symmetric])
paulson@14411
    74
paulson@14411
    75
lemma log_ln: "ln x = log (exp(1)) x"
paulson@14411
    76
by (simp add: log_def)
paulson@14411
    77
paulson@14411
    78
lemma powr_log_cancel [simp]:
paulson@14411
    79
     "[| 0 < a; a \<noteq> 1; 0 < x |] ==> a powr (log a x) = x"
paulson@14411
    80
by (simp add: powr_def log_def)
paulson@14411
    81
paulson@14411
    82
lemma log_powr_cancel [simp]: "[| 0 < a; a \<noteq> 1 |] ==> log a (a powr y) = y"
paulson@14411
    83
by (simp add: log_def powr_def)
paulson@14411
    84
paulson@14411
    85
lemma log_mult: 
paulson@14411
    86
     "[| 0 < a; a \<noteq> 1; 0 < x; 0 < y |]  
paulson@14411
    87
      ==> log a (x * y) = log a x + log a y"
paulson@14430
    88
by (simp add: log_def ln_mult divide_inverse left_distrib)
paulson@14411
    89
paulson@14411
    90
lemma log_eq_div_ln_mult_log: 
paulson@14411
    91
     "[| 0 < a; a \<noteq> 1; 0 < b; b \<noteq> 1; 0 < x |]  
paulson@14411
    92
      ==> log a x = (ln b/ln a) * log b x"
paulson@14430
    93
by (simp add: log_def divide_inverse)
paulson@14411
    94
paulson@14411
    95
text{*Base 10 logarithms*}
paulson@14411
    96
lemma log_base_10_eq1: "0 < x ==> log 10 x = (ln (exp 1) / ln 10) * ln x"
paulson@14411
    97
by (simp add: log_def)
paulson@14411
    98
paulson@14411
    99
lemma log_base_10_eq2: "0 < x ==> log 10 x = (log 10 (exp 1)) * ln x"
paulson@14411
   100
by (simp add: log_def)
paulson@14411
   101
paulson@14411
   102
lemma log_one [simp]: "log a 1 = 0"
paulson@14411
   103
by (simp add: log_def)
paulson@14411
   104
paulson@14411
   105
lemma log_eq_one [simp]: "[| 0 < a; a \<noteq> 1 |] ==> log a a = 1"
paulson@14411
   106
by (simp add: log_def)
paulson@14411
   107
paulson@14411
   108
lemma log_inverse:
paulson@14411
   109
     "[| 0 < a; a \<noteq> 1; 0 < x |] ==> log a (inverse x) = - log a x"
paulson@14411
   110
apply (rule_tac a1 = "log a x" in add_left_cancel [THEN iffD1])
paulson@14411
   111
apply (simp add: log_mult [symmetric])
paulson@14411
   112
done
paulson@14411
   113
paulson@14411
   114
lemma log_divide:
paulson@14411
   115
     "[|0 < a; a \<noteq> 1; 0 < x; 0 < y|] ==> log a (x/y) = log a x - log a y"
paulson@14430
   116
by (simp add: log_mult divide_inverse log_inverse)
paulson@14411
   117
paulson@14411
   118
lemma log_less_cancel_iff [simp]:
paulson@14411
   119
     "[| 1 < a; 0 < x; 0 < y |] ==> (log a x < log a y) = (x < y)"
paulson@14411
   120
apply safe
paulson@14411
   121
apply (rule_tac [2] powr_less_cancel)
paulson@14411
   122
apply (drule_tac a = "log a x" in powr_less_mono, auto)
paulson@14411
   123
done
paulson@14411
   124
paulson@14411
   125
lemma log_le_cancel_iff [simp]:
paulson@14411
   126
     "[| 1 < a; 0 < x; 0 < y |] ==> (log a x \<le> log a y) = (x \<le> y)"
paulson@14411
   127
by (simp add: linorder_not_less [symmetric])
paulson@14411
   128
paulson@14411
   129
paulson@15085
   130
subsection{*Further Results Courtesy Jeremy Avigad*}
paulson@15085
   131
paulson@15085
   132
lemma powr_realpow: "0 < x ==> x powr (real n) = x^n"
paulson@15085
   133
  apply (induct n, simp)
paulson@15085
   134
  apply (subgoal_tac "real(Suc n) = real n + 1")
paulson@15085
   135
  apply (erule ssubst)
paulson@15085
   136
  apply (subst powr_add, simp, simp)
paulson@15085
   137
done
paulson@15085
   138
paulson@15085
   139
lemma powr_realpow2: "0 <= x ==> 0 < n ==> x^n = (if (x = 0) then 0
paulson@15085
   140
  else x powr (real n))"
paulson@15085
   141
  apply (case_tac "x = 0", simp, simp)
paulson@15085
   142
  apply (rule powr_realpow [THEN sym], simp)
paulson@15085
   143
done
paulson@15085
   144
paulson@15085
   145
lemma ln_pwr: "0 < x ==> 0 < y ==> ln(x powr y) = y * ln x"
paulson@15085
   146
by (unfold powr_def, simp)
paulson@15085
   147
paulson@15085
   148
lemma ln_bound: "1 <= x ==> ln x <= x"
paulson@15085
   149
  apply (subgoal_tac "ln(1 + (x - 1)) <= x - 1")
paulson@15085
   150
  apply simp
paulson@15085
   151
  apply (rule ln_add_one_self_le_self, simp)
paulson@15085
   152
done
paulson@15085
   153
paulson@15085
   154
lemma powr_mono: "a <= b ==> 1 <= x ==> x powr a <= x powr b"
paulson@15085
   155
  apply (case_tac "x = 1", simp)
paulson@15085
   156
  apply (case_tac "a = b", simp)
paulson@15085
   157
  apply (rule order_less_imp_le)
paulson@15085
   158
  apply (rule powr_less_mono, auto)
paulson@15085
   159
done
paulson@15085
   160
paulson@15085
   161
lemma ge_one_powr_ge_zero: "1 <= x ==> 0 <= a ==> 1 <= x powr a"
paulson@15085
   162
  apply (subst powr_zero_eq_one [THEN sym])
paulson@15085
   163
  apply (rule powr_mono, assumption+)
paulson@15085
   164
done
paulson@15085
   165
paulson@15085
   166
lemma powr_less_mono2: "0 < a ==> 0 < x ==> x < y ==> x powr a <
paulson@15085
   167
    y powr a"
paulson@15085
   168
  apply (unfold powr_def)
paulson@15085
   169
  apply (rule exp_less_mono)
paulson@15085
   170
  apply (rule mult_strict_left_mono)
paulson@15085
   171
  apply (subst ln_less_cancel_iff, assumption)
paulson@15085
   172
  apply (rule order_less_trans)
paulson@15085
   173
  prefer 2
paulson@15085
   174
  apply assumption+
paulson@15085
   175
done
paulson@15085
   176
paulson@15085
   177
lemma powr_mono2: "0 <= a ==> 0 < x ==> x <= y ==> x powr a <= y powr a";
paulson@15085
   178
  apply (case_tac "a = 0", simp)
paulson@15085
   179
  apply (case_tac "x = y", simp)
paulson@15085
   180
  apply (rule order_less_imp_le)
paulson@15085
   181
  apply (rule powr_less_mono2, auto)
paulson@15085
   182
done
paulson@15085
   183
paulson@15085
   184
paulson@14411
   185
paulson@14411
   186
ML
paulson@14411
   187
{*
paulson@14411
   188
val powr_one_eq_one = thm "powr_one_eq_one";
paulson@14411
   189
val powr_zero_eq_one = thm "powr_zero_eq_one";
paulson@14411
   190
val powr_one_gt_zero_iff = thm "powr_one_gt_zero_iff";
paulson@14411
   191
val powr_mult = thm "powr_mult";
paulson@14411
   192
val powr_gt_zero = thm "powr_gt_zero";
paulson@14411
   193
val powr_not_zero = thm "powr_not_zero";
paulson@14411
   194
val powr_divide = thm "powr_divide";
paulson@14411
   195
val powr_add = thm "powr_add";
paulson@14411
   196
val powr_powr = thm "powr_powr";
paulson@14411
   197
val powr_powr_swap = thm "powr_powr_swap";
paulson@14411
   198
val powr_minus = thm "powr_minus";
paulson@14411
   199
val powr_minus_divide = thm "powr_minus_divide";
paulson@14411
   200
val powr_less_mono = thm "powr_less_mono";
paulson@14411
   201
val powr_less_cancel = thm "powr_less_cancel";
paulson@14411
   202
val powr_less_cancel_iff = thm "powr_less_cancel_iff";
paulson@14411
   203
val powr_le_cancel_iff = thm "powr_le_cancel_iff";
paulson@14411
   204
val log_ln = thm "log_ln";
paulson@14411
   205
val powr_log_cancel = thm "powr_log_cancel";
paulson@14411
   206
val log_powr_cancel = thm "log_powr_cancel";
paulson@14411
   207
val log_mult = thm "log_mult";
paulson@14411
   208
val log_eq_div_ln_mult_log = thm "log_eq_div_ln_mult_log";
paulson@14411
   209
val log_base_10_eq1 = thm "log_base_10_eq1";
paulson@14411
   210
val log_base_10_eq2 = thm "log_base_10_eq2";
paulson@14411
   211
val log_one = thm "log_one";
paulson@14411
   212
val log_eq_one = thm "log_eq_one";
paulson@14411
   213
val log_inverse = thm "log_inverse";
paulson@14411
   214
val log_divide = thm "log_divide";
paulson@14411
   215
val log_less_cancel_iff = thm "log_less_cancel_iff";
paulson@14411
   216
val log_le_cancel_iff = thm "log_le_cancel_iff";
paulson@14411
   217
*}
paulson@14411
   218
paulson@12224
   219
end