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