22 |
22 |
23 powhr :: "[hypreal,hypreal] => hypreal" (infixr "powhr" 80) |
23 powhr :: "[hypreal,hypreal] => hypreal" (infixr "powhr" 80) |
24 "x powhr a == ( *f* exp) (a * ( *f* ln) x)" |
24 "x powhr a == ( *f* exp) (a * ( *f* ln) x)" |
25 |
25 |
26 hlog :: "[hypreal,hypreal] => hypreal" |
26 hlog :: "[hypreal,hypreal] => hypreal" |
27 "hlog a x == Abs_hypreal(\<Union>A \<in> Rep_hypreal(a).\<Union>X \<in> Rep_hypreal(x). |
27 "hlog a x == Abs_star(\<Union>A \<in> Rep_star(a).\<Union>X \<in> Rep_star(x). |
28 hyprel `` {%n. log (A n) (X n)})" |
28 starrel `` {%n. log (A n) (X n)})" |
29 |
29 |
30 |
30 |
31 lemma powhr: |
31 lemma powhr: |
32 "(Abs_hypreal(hyprel `` {X})) powhr (Abs_hypreal(hyprel `` {Y})) = |
32 "(Abs_star(starrel `` {X})) powhr (Abs_star(starrel `` {Y})) = |
33 Abs_hypreal(hyprel `` {%n. (X n) powr (Y n)})" |
33 Abs_star(starrel `` {%n. (X n) powr (Y n)})" |
34 by (simp add: powhr_def starfun hypreal_mult powr_def) |
34 by (simp add: powhr_def starfun hypreal_mult powr_def) |
35 |
35 |
36 lemma powhr_one_eq_one [simp]: "1 powhr a = 1" |
36 lemma powhr_one_eq_one [simp]: "1 powhr a = 1" |
37 apply (cases a) |
37 apply (rule_tac z=a in eq_Abs_star) |
38 apply (simp add: powhr hypreal_one_num) |
38 apply (simp add: powhr hypreal_one_num) |
39 done |
39 done |
40 |
40 |
41 lemma powhr_mult: |
41 lemma powhr_mult: |
42 "[| 0 < x; 0 < y |] ==> (x * y) powhr a = (x powhr a) * (y powhr a)" |
42 "[| 0 < x; 0 < y |] ==> (x * y) powhr a = (x powhr a) * (y powhr a)" |
43 apply (cases x, cases y, cases a) |
43 apply (rule_tac z=x in eq_Abs_star, rule_tac z=y in eq_Abs_star, rule_tac z=a in eq_Abs_star) |
44 apply (simp add: powhr hypreal_zero_num hypreal_mult hypreal_less, ultra) |
44 apply (simp add: powhr hypreal_zero_num hypreal_mult hypreal_less, ultra) |
45 apply (simp add: powr_mult) |
45 apply (simp add: powr_mult) |
46 done |
46 done |
47 |
47 |
48 lemma powhr_gt_zero [simp]: "0 < x powhr a" |
48 lemma powhr_gt_zero [simp]: "0 < x powhr a" |
49 apply (cases a, cases x) |
49 apply (rule_tac z=a in eq_Abs_star, rule_tac z=x in eq_Abs_star) |
50 apply (simp add: hypreal_zero_def powhr hypreal_less hypreal_zero_num) |
50 apply (simp add: hypreal_zero_def powhr hypreal_less hypreal_zero_num) |
51 done |
51 done |
52 |
52 |
53 lemma powhr_not_zero [simp]: "x powhr a \<noteq> 0" |
53 lemma powhr_not_zero [simp]: "x powhr a \<noteq> 0" |
54 by (rule powhr_gt_zero [THEN hypreal_not_refl2, THEN not_sym]) |
54 by (rule powhr_gt_zero [THEN hypreal_not_refl2, THEN not_sym]) |
55 |
55 |
56 lemma hypreal_divide: |
56 lemma hypreal_divide: |
57 "(Abs_hypreal(hyprel `` {X}))/(Abs_hypreal(hyprel `` {Y})) = |
57 "(Abs_star(starrel `` {X}))/(Abs_star(starrel `` {Y})) = |
58 (Abs_hypreal(hyprel `` {%n. (X n)/(Y n)}))" |
58 (Abs_star(starrel `` {%n. (X n::real)/(Y n)}))" |
59 by (simp add: divide_inverse hypreal_zero_num hypreal_inverse hypreal_mult) |
59 by (simp add: divide_inverse hypreal_zero_num hypreal_inverse hypreal_mult) |
60 |
60 |
61 lemma powhr_divide: |
61 lemma powhr_divide: |
62 "[| 0 < x; 0 < y |] ==> (x / y) powhr a = (x powhr a)/(y powhr a)" |
62 "[| 0 < x; 0 < y |] ==> (x / y) powhr a = (x powhr a)/(y powhr a)" |
63 apply (cases x, cases y, cases a) |
63 apply (rule_tac z=x in eq_Abs_star, rule_tac z=y in eq_Abs_star, rule_tac z=a in eq_Abs_star) |
64 apply (simp add: powhr hypreal_divide hypreal_zero_num hypreal_less, ultra) |
64 apply (simp add: powhr hypreal_divide hypreal_zero_num hypreal_less, ultra) |
65 apply (simp add: powr_divide) |
65 apply (simp add: powr_divide) |
66 done |
66 done |
67 |
67 |
68 lemma powhr_add: "x powhr (a + b) = (x powhr a) * (x powhr b)" |
68 lemma powhr_add: "x powhr (a + b) = (x powhr a) * (x powhr b)" |
69 apply (cases x, cases b, cases a) |
69 apply (rule_tac z=x in eq_Abs_star, rule_tac z=b in eq_Abs_star, rule_tac z=a in eq_Abs_star) |
70 apply (simp add: powhr hypreal_add hypreal_mult powr_add) |
70 apply (simp add: powhr hypreal_add hypreal_mult powr_add) |
71 done |
71 done |
72 |
72 |
73 lemma powhr_powhr: "(x powhr a) powhr b = x powhr (a * b)" |
73 lemma powhr_powhr: "(x powhr a) powhr b = x powhr (a * b)" |
74 apply (cases x, cases b, cases a) |
74 apply (rule_tac z=x in eq_Abs_star, rule_tac z=b in eq_Abs_star, rule_tac z=a in eq_Abs_star) |
75 apply (simp add: powhr hypreal_mult powr_powr) |
75 apply (simp add: powhr hypreal_mult powr_powr) |
76 done |
76 done |
77 |
77 |
78 lemma powhr_powhr_swap: "(x powhr a) powhr b = (x powhr b) powhr a" |
78 lemma powhr_powhr_swap: "(x powhr a) powhr b = (x powhr b) powhr a" |
79 apply (cases x, cases b, cases a) |
79 apply (rule_tac z=x in eq_Abs_star, rule_tac z=b in eq_Abs_star, rule_tac z=a in eq_Abs_star) |
80 apply (simp add: powhr powr_powr_swap) |
80 apply (simp add: powhr powr_powr_swap) |
81 done |
81 done |
82 |
82 |
83 lemma powhr_minus: "x powhr (-a) = inverse (x powhr a)" |
83 lemma powhr_minus: "x powhr (-a) = inverse (x powhr a)" |
84 apply (cases x, cases a) |
84 apply (rule_tac z=x in eq_Abs_star, rule_tac z=a in eq_Abs_star) |
85 apply (simp add: powhr hypreal_minus hypreal_inverse hypreal_less powr_minus) |
85 apply (simp add: powhr hypreal_minus hypreal_inverse hypreal_less powr_minus) |
86 done |
86 done |
87 |
87 |
88 lemma powhr_minus_divide: "x powhr (-a) = 1/(x powhr a)" |
88 lemma powhr_minus_divide: "x powhr (-a) = 1/(x powhr a)" |
89 by (simp add: divide_inverse powhr_minus) |
89 by (simp add: divide_inverse powhr_minus) |
90 |
90 |
91 lemma powhr_less_mono: "[| a < b; 1 < x |] ==> x powhr a < x powhr b" |
91 lemma powhr_less_mono: "[| a < b; 1 < x |] ==> x powhr a < x powhr b" |
92 apply (cases x, cases a, cases b) |
92 apply (rule_tac z=x in eq_Abs_star, rule_tac z=a in eq_Abs_star, rule_tac z=b in eq_Abs_star) |
93 apply (simp add: powhr hypreal_one_num hypreal_less, ultra) |
93 apply (simp add: powhr hypreal_one_num hypreal_less, ultra) |
94 done |
94 done |
95 |
95 |
96 lemma powhr_less_cancel: "[| x powhr a < x powhr b; 1 < x |] ==> a < b" |
96 lemma powhr_less_cancel: "[| x powhr a < x powhr b; 1 < x |] ==> a < b" |
97 apply (cases x, cases a, cases b) |
97 apply (rule_tac z=x in eq_Abs_star, rule_tac z=a in eq_Abs_star, rule_tac z=b in eq_Abs_star) |
98 apply (simp add: powhr hypreal_one_num hypreal_less, ultra) |
98 apply (simp add: powhr hypreal_one_num hypreal_less, ultra) |
99 done |
99 done |
100 |
100 |
101 lemma powhr_less_cancel_iff [simp]: |
101 lemma powhr_less_cancel_iff [simp]: |
102 "1 < x ==> (x powhr a < x powhr b) = (a < b)" |
102 "1 < x ==> (x powhr a < x powhr b) = (a < b)" |
105 lemma powhr_le_cancel_iff [simp]: |
105 lemma powhr_le_cancel_iff [simp]: |
106 "1 < x ==> (x powhr a \<le> x powhr b) = (a \<le> b)" |
106 "1 < x ==> (x powhr a \<le> x powhr b) = (a \<le> b)" |
107 by (simp add: linorder_not_less [symmetric]) |
107 by (simp add: linorder_not_less [symmetric]) |
108 |
108 |
109 lemma hlog: |
109 lemma hlog: |
110 "hlog (Abs_hypreal(hyprel `` {X})) (Abs_hypreal(hyprel `` {Y})) = |
110 "hlog (Abs_star(starrel `` {X})) (Abs_star(starrel `` {Y})) = |
111 Abs_hypreal(hyprel `` {%n. log (X n) (Y n)})" |
111 Abs_star(starrel `` {%n. log (X n) (Y n)})" |
112 apply (simp add: hlog_def) |
112 apply (simp add: hlog_def) |
113 apply (rule arg_cong [where f=Abs_hypreal], auto, ultra) |
113 apply (rule arg_cong [where f=Abs_star], auto, ultra) |
114 done |
114 done |
115 |
115 |
116 lemma hlog_starfun_ln: "( *f* ln) x = hlog (( *f* exp) 1) x" |
116 lemma hlog_starfun_ln: "( *f* ln) x = hlog (( *f* exp) 1) x" |
117 apply (cases x) |
117 apply (rule_tac z=x in eq_Abs_star) |
118 apply (simp add: starfun hlog log_ln hypreal_one_num) |
118 apply (simp add: starfun hlog log_ln hypreal_one_num) |
119 done |
119 done |
120 |
120 |
121 lemma powhr_hlog_cancel [simp]: |
121 lemma powhr_hlog_cancel [simp]: |
122 "[| 0 < a; a \<noteq> 1; 0 < x |] ==> a powhr (hlog a x) = x" |
122 "[| 0 < a; a \<noteq> 1; 0 < x |] ==> a powhr (hlog a x) = x" |
123 apply (cases x, cases a) |
123 apply (rule_tac z=x in eq_Abs_star, rule_tac z=a in eq_Abs_star) |
124 apply (simp add: hlog powhr hypreal_zero_num hypreal_less hypreal_one_num, ultra) |
124 apply (simp add: hlog powhr hypreal_zero_num hypreal_less hypreal_one_num, ultra) |
125 done |
125 done |
126 |
126 |
127 lemma hlog_powhr_cancel [simp]: |
127 lemma hlog_powhr_cancel [simp]: |
128 "[| 0 < a; a \<noteq> 1 |] ==> hlog a (a powhr y) = y" |
128 "[| 0 < a; a \<noteq> 1 |] ==> hlog a (a powhr y) = y" |
129 apply (cases y, cases a) |
129 apply (rule_tac z=y in eq_Abs_star, rule_tac z=a in eq_Abs_star) |
130 apply (simp add: hlog powhr hypreal_zero_num hypreal_less hypreal_one_num, ultra) |
130 apply (simp add: hlog powhr hypreal_zero_num hypreal_less hypreal_one_num, ultra) |
131 apply (auto intro: log_powr_cancel) |
131 apply (auto intro: log_powr_cancel) |
132 done |
132 done |
133 |
133 |
134 lemma hlog_mult: |
134 lemma hlog_mult: |
135 "[| 0 < a; a \<noteq> 1; 0 < x; 0 < y |] |
135 "[| 0 < a; a \<noteq> 1; 0 < x; 0 < y |] |
136 ==> hlog a (x * y) = hlog a x + hlog a y" |
136 ==> hlog a (x * y) = hlog a x + hlog a y" |
137 apply (cases x, cases y, cases a) |
137 apply (rule_tac z=x in eq_Abs_star, rule_tac z=y in eq_Abs_star, rule_tac z=a in eq_Abs_star) |
138 apply (simp add: hlog powhr hypreal_zero_num hypreal_one_num hypreal_less hypreal_add hypreal_mult, ultra) |
138 apply (simp add: hlog powhr hypreal_zero_num hypreal_one_num hypreal_less hypreal_add hypreal_mult, ultra) |
139 apply (simp add: log_mult) |
139 apply (simp add: log_mult) |
140 done |
140 done |
141 |
141 |
142 lemma hlog_as_starfun: |
142 lemma hlog_as_starfun: |
143 "[| 0 < a; a \<noteq> 1 |] ==> hlog a x = ( *f* ln) x / ( *f* ln) a" |
143 "[| 0 < a; a \<noteq> 1 |] ==> hlog a x = ( *f* ln) x / ( *f* ln) a" |
144 apply (cases x, cases a) |
144 apply (rule_tac z=x in eq_Abs_star, rule_tac z=a in eq_Abs_star) |
145 apply (simp add: hlog starfun hypreal_zero_num hypreal_one_num hypreal_divide log_def) |
145 apply (simp add: hlog starfun hypreal_zero_num hypreal_one_num hypreal_divide log_def) |
146 done |
146 done |
147 |
147 |
148 lemma hlog_eq_div_starfun_ln_mult_hlog: |
148 lemma hlog_eq_div_starfun_ln_mult_hlog: |
149 "[| 0 < a; a \<noteq> 1; 0 < b; b \<noteq> 1; 0 < x |] |
149 "[| 0 < a; a \<noteq> 1; 0 < b; b \<noteq> 1; 0 < x |] |
150 ==> hlog a x = (( *f* ln) b/( *f*ln) a) * hlog b x" |
150 ==> hlog a x = (( *f* ln) b/( *f*ln) a) * hlog b x" |
151 apply (cases x, cases a, cases b) |
151 apply (rule_tac z=x in eq_Abs_star, rule_tac z=a in eq_Abs_star, rule_tac z=b in eq_Abs_star) |
152 apply (simp add: hlog starfun hypreal_zero_num hypreal_one_num hypreal_less hypreal_divide hypreal_mult, ultra) |
152 apply (simp add: hlog starfun hypreal_zero_num hypreal_one_num hypreal_less hypreal_divide hypreal_mult, ultra) |
153 apply (auto dest: log_eq_div_ln_mult_log) |
153 apply (auto dest: log_eq_div_ln_mult_log) |
154 done |
154 done |
155 |
155 |
156 lemma powhr_as_starfun: "x powhr a = ( *f* exp) (a * ( *f* ln) x)" |
156 lemma powhr_as_starfun: "x powhr a = ( *f* exp) (a * ( *f* ln) x)" |
157 apply (cases a, cases x) |
157 apply (rule_tac z=a in eq_Abs_star, rule_tac z=x in eq_Abs_star) |
158 apply (simp add: powhr starfun hypreal_mult powr_def) |
158 apply (simp add: powhr starfun hypreal_mult powr_def) |
159 done |
159 done |
160 |
160 |
161 lemma HInfinite_powhr: |
161 lemma HInfinite_powhr: |
162 "[| x : HInfinite; 0 < x; a : HFinite - Infinitesimal; |
162 "[| x : HInfinite; 0 < x; a : HFinite - Infinitesimal; |