src/HOL/Hyperreal/HLog.thy
author nipkow
Mon Aug 16 14:22:27 2004 +0200 (2004-08-16)
changeset 15131 c69542757a4d
parent 14468 6be497cacab5
child 15140 322485b816ac
permissions -rw-r--r--
New theory header syntax.
paulson@13958
     1
(*  Title       : HLog.thy
paulson@13958
     2
    Author      : Jacques D. Fleuriot
paulson@13958
     3
    Copyright   : 2000,2001 University of Edinburgh
paulson@13958
     4
*)
paulson@13958
     5
paulson@14411
     6
header{*Logarithms: Non-Standard Version*}
paulson@14411
     7
nipkow@15131
     8
theory HLog
nipkow@15131
     9
import Log HTranscendental
nipkow@15131
    10
begin
paulson@14411
    11
paulson@14411
    12
paulson@14411
    13
(* should be in NSA.ML *)
paulson@14411
    14
lemma epsilon_ge_zero [simp]: "0 \<le> epsilon"
paulson@14411
    15
by (simp add: epsilon_def hypreal_zero_num hypreal_le)
paulson@14411
    16
paulson@14411
    17
lemma hpfinite_witness: "epsilon : {x. 0 \<le> x & x : HFinite}"
paulson@14411
    18
by auto
paulson@13958
    19
paulson@13958
    20
paulson@13958
    21
constdefs
paulson@13958
    22
paulson@14411
    23
    powhr  :: "[hypreal,hypreal] => hypreal"     (infixr "powhr" 80)
paulson@13958
    24
    "x powhr a == ( *f* exp) (a * ( *f* ln) x)"
paulson@13958
    25
  
paulson@14411
    26
    hlog :: "[hypreal,hypreal] => hypreal"
paulson@14411
    27
    "hlog a x == Abs_hypreal(\<Union>A \<in> Rep_hypreal(a).\<Union>X \<in> Rep_hypreal(x).
paulson@13958
    28
			     hyprel `` {%n. log (A n) (X n)})"
paulson@13958
    29
paulson@14411
    30
paulson@14411
    31
lemma powhr: 
paulson@14411
    32
    "(Abs_hypreal(hyprel `` {X})) powhr (Abs_hypreal(hyprel `` {Y})) =  
paulson@14411
    33
     Abs_hypreal(hyprel `` {%n.  (X n) powr (Y n)})"
paulson@14411
    34
by (simp add: powhr_def starfun hypreal_mult powr_def)
paulson@14411
    35
paulson@14411
    36
lemma powhr_one_eq_one [simp]: "1 powhr a = 1"
paulson@14468
    37
apply (cases a)
paulson@14411
    38
apply (simp add: powhr hypreal_one_num)
paulson@14411
    39
done
paulson@14411
    40
paulson@14411
    41
lemma powhr_mult:
paulson@14411
    42
     "[| 0 < x; 0 < y |] ==> (x * y) powhr a = (x powhr a) * (y powhr a)"
paulson@14468
    43
apply (cases x, cases y, cases a)
paulson@14411
    44
apply (simp add: powhr hypreal_zero_num hypreal_mult hypreal_less, ultra)
paulson@14411
    45
apply (simp add: powr_mult) 
paulson@14411
    46
done
paulson@14411
    47
paulson@14411
    48
lemma powhr_gt_zero [simp]: "0 < x powhr a"
paulson@14468
    49
apply (cases a, cases x)
paulson@14411
    50
apply (simp add: hypreal_zero_def powhr hypreal_less hypreal_zero_num)
paulson@14411
    51
done
paulson@14411
    52
paulson@14411
    53
lemma powhr_not_zero [simp]: "x powhr a \<noteq> 0"
paulson@14411
    54
by (rule powhr_gt_zero [THEN hypreal_not_refl2, THEN not_sym])
paulson@14411
    55
paulson@14411
    56
lemma hypreal_divide: 
paulson@14411
    57
     "(Abs_hypreal(hyprel `` {X}))/(Abs_hypreal(hyprel `` {Y})) =  
paulson@14411
    58
      (Abs_hypreal(hyprel `` {%n. (X n)/(Y n)}))"
paulson@14430
    59
by (simp add: divide_inverse hypreal_zero_num hypreal_inverse hypreal_mult) 
paulson@14411
    60
paulson@14411
    61
lemma powhr_divide:
paulson@14411
    62
     "[| 0 < x; 0 < y |] ==> (x / y) powhr a = (x powhr a)/(y powhr a)"
paulson@14468
    63
apply (cases x, cases y, cases a)
paulson@14411
    64
apply (simp add: powhr hypreal_divide hypreal_zero_num hypreal_less, ultra)
paulson@14411
    65
apply (simp add: powr_divide)
paulson@14411
    66
done
paulson@14411
    67
paulson@14411
    68
lemma powhr_add: "x powhr (a + b) = (x powhr a) * (x powhr b)"
paulson@14468
    69
apply (cases x, cases b, cases a)
paulson@14411
    70
apply (simp add: powhr hypreal_add hypreal_mult powr_add)
paulson@14411
    71
done
paulson@14411
    72
paulson@14411
    73
lemma powhr_powhr: "(x powhr a) powhr b = x powhr (a * b)"
paulson@14468
    74
apply (cases x, cases b, cases a)
paulson@14411
    75
apply (simp add: powhr hypreal_mult powr_powr)
paulson@14411
    76
done
paulson@14411
    77
paulson@14411
    78
lemma powhr_powhr_swap: "(x powhr a) powhr b = (x powhr b) powhr a"
paulson@14468
    79
apply (cases x, cases b, cases a)
paulson@14411
    80
apply (simp add: powhr powr_powr_swap)
paulson@14411
    81
done
paulson@14411
    82
paulson@14411
    83
lemma powhr_minus: "x powhr (-a) = inverse (x powhr a)"
paulson@14468
    84
apply (cases x, cases a)
paulson@14411
    85
apply (simp add: powhr hypreal_minus hypreal_inverse hypreal_less powr_minus)
paulson@14411
    86
done
paulson@14411
    87
paulson@14411
    88
lemma powhr_minus_divide: "x powhr (-a) = 1/(x powhr a)"
paulson@14430
    89
by (simp add: divide_inverse powhr_minus)
paulson@14411
    90
paulson@14411
    91
lemma powhr_less_mono: "[| a < b; 1 < x |] ==> x powhr a < x powhr b"
paulson@14468
    92
apply (cases x, cases a, cases b)
paulson@14411
    93
apply (simp add: powhr hypreal_one_num hypreal_less, ultra)
paulson@14411
    94
done
paulson@14411
    95
paulson@14411
    96
lemma powhr_less_cancel: "[| x powhr a < x powhr b; 1 < x |] ==> a < b"
paulson@14468
    97
apply (cases x, cases a, cases b)
paulson@14411
    98
apply (simp add: powhr hypreal_one_num hypreal_less, ultra)
paulson@14411
    99
done
paulson@14411
   100
paulson@14411
   101
lemma powhr_less_cancel_iff [simp]:
paulson@14411
   102
     "1 < x ==> (x powhr a < x powhr b) = (a < b)"
paulson@14411
   103
by (blast intro: powhr_less_cancel powhr_less_mono)
paulson@14411
   104
paulson@14411
   105
lemma powhr_le_cancel_iff [simp]:
paulson@14411
   106
     "1 < x ==> (x powhr a \<le> x powhr b) = (a \<le> b)"
paulson@14411
   107
by (simp add: linorder_not_less [symmetric])
paulson@14411
   108
paulson@14411
   109
lemma hlog: 
paulson@14411
   110
     "hlog (Abs_hypreal(hyprel `` {X})) (Abs_hypreal(hyprel `` {Y})) =  
paulson@14411
   111
      Abs_hypreal(hyprel `` {%n. log (X n) (Y n)})"
paulson@14411
   112
apply (simp add: hlog_def)
paulson@14411
   113
apply (rule arg_cong [where f=Abs_hypreal], auto, ultra)
paulson@14411
   114
done
paulson@14411
   115
paulson@14411
   116
lemma hlog_starfun_ln: "( *f* ln) x = hlog (( *f* exp) 1) x"
paulson@14468
   117
apply (cases x)
paulson@14411
   118
apply (simp add: starfun hlog log_ln hypreal_one_num)
paulson@14411
   119
done
paulson@14411
   120
paulson@14411
   121
lemma powhr_hlog_cancel [simp]:
paulson@14411
   122
     "[| 0 < a; a \<noteq> 1; 0 < x |] ==> a powhr (hlog a x) = x"
paulson@14468
   123
apply (cases x, cases a)
paulson@14411
   124
apply (simp add: hlog powhr hypreal_zero_num hypreal_less hypreal_one_num, ultra)
paulson@14411
   125
done
paulson@14411
   126
paulson@14411
   127
lemma hlog_powhr_cancel [simp]:
paulson@14411
   128
     "[| 0 < a; a \<noteq> 1 |] ==> hlog a (a powhr y) = y"
paulson@14468
   129
apply (cases y, cases a)
paulson@14411
   130
apply (simp add: hlog powhr hypreal_zero_num hypreal_less hypreal_one_num, ultra)
paulson@14411
   131
apply (auto intro: log_powr_cancel) 
paulson@14411
   132
done
paulson@14411
   133
paulson@14411
   134
lemma hlog_mult:
paulson@14411
   135
     "[| 0 < a; a \<noteq> 1; 0 < x; 0 < y  |]  
paulson@14411
   136
      ==> hlog a (x * y) = hlog a x + hlog a y"
paulson@14468
   137
apply (cases x, cases y, cases a)
paulson@14411
   138
apply (simp add: hlog powhr hypreal_zero_num hypreal_one_num hypreal_less hypreal_add hypreal_mult, ultra)
paulson@14411
   139
apply (simp add: log_mult)
paulson@14411
   140
done
paulson@14411
   141
paulson@14411
   142
lemma hlog_as_starfun:
paulson@14411
   143
     "[| 0 < a; a \<noteq> 1 |] ==> hlog a x = ( *f* ln) x / ( *f* ln) a"
paulson@14468
   144
apply (cases x, cases a)
paulson@14411
   145
apply (simp add: hlog starfun hypreal_zero_num hypreal_one_num hypreal_divide log_def)
paulson@14411
   146
done
paulson@14411
   147
paulson@14411
   148
lemma hlog_eq_div_starfun_ln_mult_hlog:
paulson@14411
   149
     "[| 0 < a; a \<noteq> 1; 0 < b; b \<noteq> 1; 0 < x |]  
paulson@14411
   150
      ==> hlog a x = (( *f* ln) b/( *f*ln) a) * hlog b x"
paulson@14468
   151
apply (cases x, cases a, cases b)
paulson@14411
   152
apply (simp add: hlog starfun hypreal_zero_num hypreal_one_num hypreal_less hypreal_divide hypreal_mult, ultra)
paulson@14411
   153
apply (auto dest: log_eq_div_ln_mult_log) 
paulson@14411
   154
done
paulson@14411
   155
paulson@14411
   156
lemma powhr_as_starfun: "x powhr a = ( *f* exp) (a * ( *f* ln) x)"
paulson@14468
   157
apply (cases a, cases x)
paulson@14411
   158
apply (simp add: powhr starfun hypreal_mult powr_def)
paulson@14411
   159
done
paulson@14411
   160
paulson@14411
   161
lemma HInfinite_powhr:
paulson@14411
   162
     "[| x : HInfinite; 0 < x; a : HFinite - Infinitesimal;  
paulson@14411
   163
         0 < a |] ==> x powhr a : HInfinite"
paulson@14411
   164
apply (auto intro!: starfun_ln_ge_zero starfun_ln_HInfinite HInfinite_HFinite_not_Infinitesimal_mult2 starfun_exp_HInfinite 
paulson@14411
   165
       simp add: order_less_imp_le HInfinite_gt_zero_gt_one powhr_as_starfun zero_le_mult_iff)
paulson@14411
   166
done
paulson@14411
   167
paulson@14411
   168
lemma hlog_hrabs_HInfinite_Infinitesimal:
paulson@14411
   169
     "[| x : HFinite - Infinitesimal; a : HInfinite; 0 < a |]  
paulson@14411
   170
      ==> hlog a (abs x) : Infinitesimal"
paulson@14411
   171
apply (frule HInfinite_gt_zero_gt_one)
paulson@14411
   172
apply (auto intro!: starfun_ln_HFinite_not_Infinitesimal
paulson@14411
   173
            HInfinite_inverse_Infinitesimal Infinitesimal_HFinite_mult2 
paulson@14411
   174
        simp add: starfun_ln_HInfinite not_Infinitesimal_not_zero 
paulson@14430
   175
          hlog_as_starfun hypreal_not_refl2 [THEN not_sym] divide_inverse)
paulson@14411
   176
done
paulson@14411
   177
paulson@14411
   178
lemma hlog_HInfinite_as_starfun:
paulson@14411
   179
     "[| a : HInfinite; 0 < a |] ==> hlog a x = ( *f* ln) x / ( *f* ln) a"
paulson@14411
   180
by (rule hlog_as_starfun, auto)
paulson@14411
   181
paulson@14411
   182
lemma hlog_one [simp]: "hlog a 1 = 0"
paulson@14468
   183
apply (cases a)
paulson@14411
   184
apply (simp add: hypreal_one_num hypreal_zero_num hlog)
paulson@14411
   185
done
paulson@14411
   186
paulson@14411
   187
lemma hlog_eq_one [simp]: "[| 0 < a; a \<noteq> 1 |] ==> hlog a a = 1"
paulson@14468
   188
apply (cases a)
paulson@14411
   189
apply (simp add: hypreal_one_num hypreal_zero_num hlog hypreal_less, ultra)
paulson@14411
   190
apply (auto intro: log_eq_one) 
paulson@14411
   191
done
paulson@14411
   192
paulson@14411
   193
lemma hlog_inverse:
paulson@14411
   194
     "[| 0 < a; a \<noteq> 1; 0 < x |] ==> hlog a (inverse x) = - hlog a x"
paulson@14411
   195
apply (rule add_left_cancel [of "hlog a x", THEN iffD1])
paulson@14411
   196
apply (simp add: hlog_mult [symmetric])
paulson@14411
   197
done
paulson@14411
   198
paulson@14411
   199
lemma hlog_divide:
paulson@14411
   200
     "[| 0 < a; a \<noteq> 1; 0 < x; 0 < y|] ==> hlog a (x/y) = hlog a x - hlog a y"
paulson@14430
   201
by (simp add: hlog_mult hlog_inverse divide_inverse)
paulson@14411
   202
paulson@14411
   203
lemma hlog_less_cancel_iff [simp]:
paulson@14411
   204
     "[| 1 < a; 0 < x; 0 < y |] ==> (hlog a x < hlog a y) = (x < y)"
paulson@14468
   205
apply (cases a, cases x, cases y)
paulson@14411
   206
apply (auto simp add: hlog hypreal_less hypreal_zero_num hypreal_one_num, ultra+)
paulson@14411
   207
done
paulson@14411
   208
paulson@14411
   209
lemma hlog_le_cancel_iff [simp]:
paulson@14411
   210
     "[| 1 < a; 0 < x; 0 < y |] ==> (hlog a x \<le> hlog a y) = (x \<le> y)"
paulson@14411
   211
by (simp add: linorder_not_less [symmetric])
paulson@14411
   212
paulson@14411
   213
paulson@14411
   214
ML
paulson@14411
   215
{*
paulson@14411
   216
val powhr = thm "powhr";
paulson@14411
   217
val powhr_one_eq_one = thm "powhr_one_eq_one";
paulson@14411
   218
val powhr_mult = thm "powhr_mult";
paulson@14411
   219
val powhr_gt_zero = thm "powhr_gt_zero";
paulson@14411
   220
val powhr_not_zero = thm "powhr_not_zero";
paulson@14411
   221
val hypreal_divide = thm "hypreal_divide";
paulson@14411
   222
val powhr_divide = thm "powhr_divide";
paulson@14411
   223
val powhr_add = thm "powhr_add";
paulson@14411
   224
val powhr_powhr = thm "powhr_powhr";
paulson@14411
   225
val powhr_powhr_swap = thm "powhr_powhr_swap";
paulson@14411
   226
val powhr_minus = thm "powhr_minus";
paulson@14411
   227
val powhr_minus_divide = thm "powhr_minus_divide";
paulson@14411
   228
val powhr_less_mono = thm "powhr_less_mono";
paulson@14411
   229
val powhr_less_cancel = thm "powhr_less_cancel";
paulson@14411
   230
val powhr_less_cancel_iff = thm "powhr_less_cancel_iff";
paulson@14411
   231
val powhr_le_cancel_iff = thm "powhr_le_cancel_iff";
paulson@14411
   232
val hlog = thm "hlog";
paulson@14411
   233
val hlog_starfun_ln = thm "hlog_starfun_ln";
paulson@14411
   234
val powhr_hlog_cancel = thm "powhr_hlog_cancel";
paulson@14411
   235
val hlog_powhr_cancel = thm "hlog_powhr_cancel";
paulson@14411
   236
val hlog_mult = thm "hlog_mult";
paulson@14411
   237
val hlog_as_starfun = thm "hlog_as_starfun";
paulson@14411
   238
val hlog_eq_div_starfun_ln_mult_hlog = thm "hlog_eq_div_starfun_ln_mult_hlog";
paulson@14411
   239
val powhr_as_starfun = thm "powhr_as_starfun";
paulson@14411
   240
val HInfinite_powhr = thm "HInfinite_powhr";
paulson@14411
   241
val hlog_hrabs_HInfinite_Infinitesimal = thm "hlog_hrabs_HInfinite_Infinitesimal";
paulson@14411
   242
val hlog_HInfinite_as_starfun = thm "hlog_HInfinite_as_starfun";
paulson@14411
   243
val hlog_one = thm "hlog_one";
paulson@14411
   244
val hlog_eq_one = thm "hlog_eq_one";
paulson@14411
   245
val hlog_inverse = thm "hlog_inverse";
paulson@14411
   246
val hlog_divide = thm "hlog_divide";
paulson@14411
   247
val hlog_less_cancel_iff = thm "hlog_less_cancel_iff";
paulson@14411
   248
val hlog_le_cancel_iff = thm "hlog_le_cancel_iff";
paulson@14411
   249
*}
paulson@14411
   250
paulson@14411
   251
end