46 |
46 |
47 |
47 |
48 subsection{*Nonstandard Extension of Square Root Function*} |
48 subsection{*Nonstandard Extension of Square Root Function*} |
49 |
49 |
50 lemma STAR_sqrt_zero [simp]: "( *f* sqrt) 0 = 0" |
50 lemma STAR_sqrt_zero [simp]: "( *f* sqrt) 0 = 0" |
51 by (simp add: starfun hypreal_zero_num) |
51 by (simp add: starfun star_n_zero_num) |
52 |
52 |
53 lemma STAR_sqrt_one [simp]: "( *f* sqrt) 1 = 1" |
53 lemma STAR_sqrt_one [simp]: "( *f* sqrt) 1 = 1" |
54 by (simp add: starfun hypreal_one_num) |
54 by (simp add: starfun star_n_one_num) |
55 |
55 |
56 lemma hypreal_sqrt_pow2_iff: "(( *f* sqrt)(x) ^ 2 = x) = (0 \<le> x)" |
56 lemma hypreal_sqrt_pow2_iff: "(( *f* sqrt)(x) ^ 2 = x) = (0 \<le> x)" |
57 apply (rule_tac z=x in eq_Abs_star) |
57 apply (cases x) |
58 apply (auto simp add: hypreal_le hypreal_zero_num starfun hrealpow |
58 apply (auto simp add: star_n_le star_n_zero_num starfun hrealpow star_n_eq_iff |
59 simp del: hpowr_Suc realpow_Suc) |
59 simp del: hpowr_Suc realpow_Suc) |
60 done |
60 done |
61 |
61 |
62 lemma hypreal_sqrt_gt_zero_pow2: "0 < x ==> ( *f* sqrt) (x) ^ 2 = x" |
62 lemma hypreal_sqrt_gt_zero_pow2: "!!x. 0 < x ==> ( *f* sqrt) (x) ^ 2 = x" |
63 apply (rule_tac z=x in eq_Abs_star) |
63 by (transfer, simp) |
64 apply (auto intro: FreeUltrafilterNat_subset |
|
65 simp add: hypreal_less starfun hrealpow hypreal_zero_num |
|
66 simp del: hpowr_Suc realpow_Suc) |
|
67 done |
|
68 |
64 |
69 lemma hypreal_sqrt_pow2_gt_zero: "0 < x ==> 0 < ( *f* sqrt) (x) ^ 2" |
65 lemma hypreal_sqrt_pow2_gt_zero: "0 < x ==> 0 < ( *f* sqrt) (x) ^ 2" |
70 by (frule hypreal_sqrt_gt_zero_pow2, auto) |
66 by (frule hypreal_sqrt_gt_zero_pow2, auto) |
71 |
67 |
72 lemma hypreal_sqrt_not_zero: "0 < x ==> ( *f* sqrt) (x) \<noteq> 0" |
68 lemma hypreal_sqrt_not_zero: "0 < x ==> ( *f* sqrt) (x) \<noteq> 0" |
79 apply (cut_tac n1 = 2 and a1 = "( *f* sqrt) x" in power_inverse [symmetric]) |
75 apply (cut_tac n1 = 2 and a1 = "( *f* sqrt) x" in power_inverse [symmetric]) |
80 apply (auto dest: hypreal_sqrt_gt_zero_pow2) |
76 apply (auto dest: hypreal_sqrt_gt_zero_pow2) |
81 done |
77 done |
82 |
78 |
83 lemma hypreal_sqrt_mult_distrib: |
79 lemma hypreal_sqrt_mult_distrib: |
84 "[|0 < x; 0 <y |] ==> ( *f* sqrt)(x*y) = ( *f* sqrt)(x) * ( *f* sqrt)(y)" |
80 "!!x y. [|0 < x; 0 <y |] ==> |
85 apply (rule_tac z=x in eq_Abs_star, rule_tac z=y in eq_Abs_star) |
81 ( *f* sqrt)(x*y) = ( *f* sqrt)(x) * ( *f* sqrt)(y)" |
86 apply (simp add: hypreal_zero_def starfun hypreal_mult hypreal_less hypreal_zero_num, ultra) |
82 apply transfer |
87 apply (auto intro: real_sqrt_mult_distrib) |
83 apply (auto intro: real_sqrt_mult_distrib) |
88 done |
84 done |
89 |
85 |
90 lemma hypreal_sqrt_mult_distrib2: |
86 lemma hypreal_sqrt_mult_distrib2: |
91 "[|0\<le>x; 0\<le>y |] ==> |
87 "[|0\<le>x; 0\<le>y |] ==> |
106 by (auto simp add: order_le_less) |
102 by (auto simp add: order_le_less) |
107 |
103 |
108 lemma hypreal_sqrt_sum_squares [simp]: |
104 lemma hypreal_sqrt_sum_squares [simp]: |
109 "(( *f* sqrt)(x*x + y*y + z*z) @= 0) = (x*x + y*y + z*z @= 0)" |
105 "(( *f* sqrt)(x*x + y*y + z*z) @= 0) = (x*x + y*y + z*z @= 0)" |
110 apply (rule hypreal_sqrt_approx_zero2) |
106 apply (rule hypreal_sqrt_approx_zero2) |
111 apply (rule hypreal_le_add_order)+ |
107 apply (rule add_nonneg_nonneg)+ |
112 apply (auto simp add: zero_le_square) |
108 apply (auto simp add: zero_le_square) |
113 done |
109 done |
114 |
110 |
115 lemma hypreal_sqrt_sum_squares2 [simp]: |
111 lemma hypreal_sqrt_sum_squares2 [simp]: |
116 "(( *f* sqrt)(x*x + y*y) @= 0) = (x*x + y*y @= 0)" |
112 "(( *f* sqrt)(x*x + y*y) @= 0) = (x*x + y*y @= 0)" |
117 apply (rule hypreal_sqrt_approx_zero2) |
113 apply (rule hypreal_sqrt_approx_zero2) |
118 apply (rule hypreal_le_add_order) |
114 apply (rule add_nonneg_nonneg) |
119 apply (auto simp add: zero_le_square) |
115 apply (auto simp add: zero_le_square) |
120 done |
116 done |
121 |
117 |
122 lemma hypreal_sqrt_gt_zero: "0 < x ==> 0 < ( *f* sqrt)(x)" |
118 lemma hypreal_sqrt_gt_zero: "!!x. 0 < x ==> 0 < ( *f* sqrt)(x)" |
123 apply (rule_tac z=x in eq_Abs_star) |
119 apply transfer |
124 apply (auto simp add: starfun hypreal_zero_def hypreal_less hypreal_zero_num, ultra) |
|
125 apply (auto intro: real_sqrt_gt_zero) |
120 apply (auto intro: real_sqrt_gt_zero) |
126 done |
121 done |
127 |
122 |
128 lemma hypreal_sqrt_ge_zero: "0 \<le> x ==> 0 \<le> ( *f* sqrt)(x)" |
123 lemma hypreal_sqrt_ge_zero: "0 \<le> x ==> 0 \<le> ( *f* sqrt)(x)" |
129 by (auto intro: hypreal_sqrt_gt_zero simp add: order_le_less) |
124 by (auto intro: hypreal_sqrt_gt_zero simp add: order_le_less) |
130 |
125 |
131 lemma hypreal_sqrt_hrabs [simp]: "( *f* sqrt)(x ^ 2) = abs(x)" |
126 lemma hypreal_sqrt_hrabs [simp]: "!!x. ( *f* sqrt)(x ^ 2) = abs(x)" |
132 apply (rule_tac z=x in eq_Abs_star) |
127 by (transfer, simp) |
133 apply (simp add: starfun hypreal_hrabs hypreal_mult numeral_2_eq_2) |
128 |
134 done |
129 lemma hypreal_sqrt_hrabs2 [simp]: "!!x. ( *f* sqrt)(x*x) = abs(x)" |
135 |
130 by (transfer, simp) |
136 lemma hypreal_sqrt_hrabs2 [simp]: "( *f* sqrt)(x*x) = abs(x)" |
|
137 apply (rule hrealpow_two [THEN subst]) |
|
138 apply (rule numeral_2_eq_2 [THEN subst]) |
|
139 apply (rule hypreal_sqrt_hrabs) |
|
140 done |
|
141 |
131 |
142 lemma hypreal_sqrt_hyperpow_hrabs [simp]: |
132 lemma hypreal_sqrt_hyperpow_hrabs [simp]: |
143 "( *f* sqrt)(x pow (hypnat_of_nat 2)) = abs(x)" |
133 "!!x. ( *f* sqrt)(x pow (hypnat_of_nat 2)) = abs(x)" |
144 apply (rule_tac z=x in eq_Abs_star) |
134 by (unfold hyperpow_def, transfer, simp) |
145 apply (simp add: starfun hypreal_hrabs hypnat_of_nat_eq hyperpow) |
|
146 done |
|
147 |
135 |
148 lemma star_sqrt_HFinite: "\<lbrakk>x \<in> HFinite; 0 \<le> x\<rbrakk> \<Longrightarrow> ( *f* sqrt) x \<in> HFinite" |
136 lemma star_sqrt_HFinite: "\<lbrakk>x \<in> HFinite; 0 \<le> x\<rbrakk> \<Longrightarrow> ( *f* sqrt) x \<in> HFinite" |
149 apply (rule HFinite_square_iff [THEN iffD1]) |
137 apply (rule HFinite_square_iff [THEN iffD1]) |
150 apply (simp only: hypreal_sqrt_mult_distrib2 [symmetric], simp) |
138 apply (simp only: hypreal_sqrt_mult_distrib2 [symmetric], simp) |
151 done |
139 done |
158 apply (rule_tac [3] hypreal_sqrt_mult_distrib2 [THEN subst]) |
146 apply (rule_tac [3] hypreal_sqrt_mult_distrib2 [THEN subst]) |
159 apply (rule_tac [5] hypreal_sqrt_mult_distrib2 [THEN subst]) |
147 apply (rule_tac [5] hypreal_sqrt_mult_distrib2 [THEN subst]) |
160 apply (auto simp add: st_hrabs st_zero_le star_sqrt_HFinite) |
148 apply (auto simp add: st_hrabs st_zero_le star_sqrt_HFinite) |
161 done |
149 done |
162 |
150 |
163 lemma hypreal_sqrt_sum_squares_ge1 [simp]: "x \<le> ( *f* sqrt)(x ^ 2 + y ^ 2)" |
151 lemma hypreal_sqrt_sum_squares_ge1 [simp]: "!!x y. x \<le> ( *f* sqrt)(x ^ 2 + y ^ 2)" |
164 apply (rule_tac z=x in eq_Abs_star, rule_tac z=y in eq_Abs_star) |
152 by (transfer, simp) |
165 apply (simp add: starfun hypreal_add hrealpow hypreal_le |
|
166 del: hpowr_Suc realpow_Suc) |
|
167 done |
|
168 |
153 |
169 lemma HFinite_hypreal_sqrt: |
154 lemma HFinite_hypreal_sqrt: |
170 "[| 0 \<le> x; x \<in> HFinite |] ==> ( *f* sqrt) x \<in> HFinite" |
155 "[| 0 \<le> x; x \<in> HFinite |] ==> ( *f* sqrt) x \<in> HFinite" |
171 apply (auto simp add: order_le_less) |
156 apply (auto simp add: order_le_less) |
172 apply (rule HFinite_square_iff [THEN iffD1]) |
157 apply (rule HFinite_square_iff [THEN iffD1]) |
241 by (blast intro: HInfinite_hypreal_sqrt HInfinite_hypreal_sqrt_imp_HInfinite) |
226 by (blast intro: HInfinite_hypreal_sqrt HInfinite_hypreal_sqrt_imp_HInfinite) |
242 |
227 |
243 lemma HInfinite_sqrt_sum_squares [simp]: |
228 lemma HInfinite_sqrt_sum_squares [simp]: |
244 "(( *f* sqrt)(x*x + y*y) \<in> HInfinite) = (x*x + y*y \<in> HInfinite)" |
229 "(( *f* sqrt)(x*x + y*y) \<in> HInfinite) = (x*x + y*y \<in> HInfinite)" |
245 apply (rule HInfinite_hypreal_sqrt_iff) |
230 apply (rule HInfinite_hypreal_sqrt_iff) |
246 apply (rule hypreal_le_add_order) |
231 apply (rule add_nonneg_nonneg) |
247 apply (auto simp add: zero_le_square) |
232 apply (auto simp add: zero_le_square) |
248 done |
233 done |
249 |
234 |
250 lemma HFinite_exp [simp]: |
235 lemma HFinite_exp [simp]: |
251 "sumhr (0, whn, %n. inverse (real (fact n)) * x ^ n) \<in> HFinite" |
236 "sumhr (0, whn, %n. inverse (real (fact n)) * x ^ n) \<in> HFinite" |
252 by (auto intro!: NSBseq_HFinite_hypreal NSconvergent_NSBseq |
237 by (auto intro!: NSBseq_HFinite_hypreal NSconvergent_NSBseq |
253 simp add: starfunNat_sumr [symmetric] starfunNat hypnat_omega_def |
238 simp add: starfunNat_sumr [symmetric] starfun hypnat_omega_def |
254 convergent_NSconvergent_iff [symmetric] |
239 convergent_NSconvergent_iff [symmetric] |
255 summable_convergent_sumr_iff [symmetric] summable_exp) |
240 summable_convergent_sumr_iff [symmetric] summable_exp) |
256 |
241 |
257 lemma exphr_zero [simp]: "exphr 0 = 1" |
242 lemma exphr_zero [simp]: "exphr 0 = 1" |
258 apply (simp add: exphr_def sumhr_split_add |
243 apply (simp add: exphr_def sumhr_split_add |
259 [OF hypnat_one_less_hypnat_omega, symmetric]) |
244 [OF hypnat_one_less_hypnat_omega, symmetric]) |
260 apply (simp add: sumhr hypnat_zero_def starfunNat hypnat_one_def hypnat_add |
245 apply (simp add: sumhr star_n_zero_num starfun star_n_one_num star_n_add |
261 hypnat_omega_def hypreal_add |
246 hypnat_omega_def |
262 del: hypnat_add_zero_left) |
247 del: OrderedGroup.add_0) |
263 apply (simp add: hypreal_one_num [symmetric]) |
248 apply (simp add: star_n_one_num [symmetric]) |
264 done |
249 done |
265 |
250 |
266 lemma coshr_zero [simp]: "coshr 0 = 1" |
251 lemma coshr_zero [simp]: "coshr 0 = 1" |
267 apply (simp add: coshr_def sumhr_split_add |
252 apply (simp add: coshr_def sumhr_split_add |
268 [OF hypnat_one_less_hypnat_omega, symmetric]) |
253 [OF hypnat_one_less_hypnat_omega, symmetric]) |
269 apply (simp add: sumhr hypnat_zero_def hypnat_one_def hypnat_omega_def) |
254 apply (simp add: sumhr star_n_zero_num star_n_one_num hypnat_omega_def) |
270 apply (simp add: hypreal_one_def [symmetric] hypreal_zero_def [symmetric]) |
255 apply (simp add: star_n_one_num [symmetric] star_n_zero_num [symmetric]) |
271 done |
256 done |
272 |
257 |
273 lemma STAR_exp_zero_approx_one [simp]: "( *f* exp) 0 @= 1" |
258 lemma STAR_exp_zero_approx_one [simp]: "( *f* exp) 0 @= 1" |
274 by (simp add: hypreal_zero_def hypreal_one_def starfun hypreal_one_num) |
259 by (simp add: star_n_zero_num star_n_one_num starfun) |
275 |
260 |
276 lemma STAR_exp_Infinitesimal: "x \<in> Infinitesimal ==> ( *f* exp) x @= 1" |
261 lemma STAR_exp_Infinitesimal: "x \<in> Infinitesimal ==> ( *f* exp) x @= 1" |
277 apply (case_tac "x = 0") |
262 apply (case_tac "x = 0") |
278 apply (cut_tac [2] x = 0 in DERIV_exp) |
263 apply (cut_tac [2] x = 0 in DERIV_exp) |
279 apply (auto simp add: NSDERIV_DERIV_iff [symmetric] nsderiv_def) |
264 apply (auto simp add: NSDERIV_DERIV_iff [symmetric] nsderiv_def) |
287 done |
272 done |
288 |
273 |
289 lemma STAR_exp_epsilon [simp]: "( *f* exp) epsilon @= 1" |
274 lemma STAR_exp_epsilon [simp]: "( *f* exp) epsilon @= 1" |
290 by (auto intro: STAR_exp_Infinitesimal) |
275 by (auto intro: STAR_exp_Infinitesimal) |
291 |
276 |
292 lemma STAR_exp_add: "( *f* exp)(x + y) = ( *f* exp) x * ( *f* exp) y" |
277 lemma STAR_exp_add: "!!x y. ( *f* exp)(x + y) = ( *f* exp) x * ( *f* exp) y" |
293 apply (rule_tac z=x in eq_Abs_star, rule_tac z=y in eq_Abs_star) |
278 by (transfer, rule exp_add) |
294 apply (simp add: starfun hypreal_add hypreal_mult exp_add) |
|
295 done |
|
296 |
279 |
297 lemma exphr_hypreal_of_real_exp_eq: "exphr x = hypreal_of_real (exp x)" |
280 lemma exphr_hypreal_of_real_exp_eq: "exphr x = hypreal_of_real (exp x)" |
298 apply (simp add: exphr_def) |
281 apply (simp add: exphr_def) |
299 apply (rule st_hypreal_of_real [THEN subst]) |
282 apply (rule st_hypreal_of_real [THEN subst]) |
300 apply (rule approx_st_eq, auto) |
283 apply (rule approx_st_eq, auto) |
301 apply (rule approx_minus_iff [THEN iffD2]) |
284 apply (rule approx_minus_iff [THEN iffD2]) |
302 apply (simp only: mem_infmal_iff [symmetric]) |
285 apply (simp only: mem_infmal_iff [symmetric]) |
303 apply (auto simp add: mem_infmal_iff [symmetric] hypreal_of_real_def star_of_def star_n_def hypnat_zero_def hypnat_omega_def sumhr hypreal_minus hypreal_add) |
286 apply (auto simp add: mem_infmal_iff [symmetric] star_of_def star_n_zero_num hypnat_omega_def sumhr star_n_minus star_n_add) |
304 apply (rule NSLIMSEQ_zero_Infinitesimal_hypreal) |
287 apply (rule NSLIMSEQ_zero_Infinitesimal_hypreal) |
305 apply (insert exp_converges [of x]) |
288 apply (insert exp_converges [of x]) |
306 apply (simp add: sums_def) |
289 apply (simp add: sums_def) |
307 apply (drule LIMSEQ_const [THEN [2] LIMSEQ_add, where b = "- exp x"]) |
290 apply (drule LIMSEQ_const [THEN [2] LIMSEQ_add, where b = "- exp x"]) |
308 apply (simp add: LIMSEQ_NSLIMSEQ_iff) |
291 apply (simp add: LIMSEQ_NSLIMSEQ_iff) |
309 done |
292 done |
310 |
293 |
311 lemma starfun_exp_ge_add_one_self [simp]: "0 \<le> x ==> (1 + x) \<le> ( *f* exp) x" |
294 lemma starfun_exp_ge_add_one_self [simp]: "!!x. 0 \<le> x ==> (1 + x) \<le> ( *f* exp) x" |
312 apply (rule_tac z=x in eq_Abs_star) |
295 by (transfer, rule exp_ge_add_one_self_aux) |
313 apply (simp add: starfun hypreal_add hypreal_le hypreal_zero_num hypreal_one_num, ultra) |
|
314 apply (erule exp_ge_add_one_self_aux) |
|
315 done |
|
316 |
296 |
317 (* exp (oo) is infinite *) |
297 (* exp (oo) is infinite *) |
318 lemma starfun_exp_HInfinite: |
298 lemma starfun_exp_HInfinite: |
319 "[| x \<in> HInfinite; 0 \<le> x |] ==> ( *f* exp) x \<in> HInfinite" |
299 "[| x \<in> HInfinite; 0 \<le> x |] ==> ( *f* exp) x \<in> HInfinite" |
320 apply (frule starfun_exp_ge_add_one_self) |
300 apply (frule starfun_exp_ge_add_one_self) |
321 apply (rule HInfinite_ge_HInfinite, assumption) |
301 apply (rule HInfinite_ge_HInfinite, assumption) |
322 apply (rule order_trans [of _ "1+x"], auto) |
302 apply (rule order_trans [of _ "1+x"], auto) |
323 done |
303 done |
324 |
304 |
325 lemma starfun_exp_minus: "( *f* exp) (-x) = inverse(( *f* exp) x)" |
305 lemma starfun_exp_minus: "!!x. ( *f* exp) (-x) = inverse(( *f* exp) x)" |
326 apply (rule_tac z=x in eq_Abs_star) |
306 by (transfer, rule exp_minus) |
327 apply (simp add: starfun hypreal_inverse hypreal_minus exp_minus) |
|
328 done |
|
329 |
307 |
330 (* exp (-oo) is infinitesimal *) |
308 (* exp (-oo) is infinitesimal *) |
331 lemma starfun_exp_Infinitesimal: |
309 lemma starfun_exp_Infinitesimal: |
332 "[| x \<in> HInfinite; x \<le> 0 |] ==> ( *f* exp) x \<in> Infinitesimal" |
310 "[| x \<in> HInfinite; x \<le> 0 |] ==> ( *f* exp) x \<in> Infinitesimal" |
333 apply (subgoal_tac "\<exists>y. x = - y") |
311 apply (subgoal_tac "\<exists>y. x = - y") |
334 apply (rule_tac [2] x = "- x" in exI) |
312 apply (rule_tac [2] x = "- x" in exI) |
335 apply (auto intro!: HInfinite_inverse_Infinitesimal starfun_exp_HInfinite |
313 apply (auto intro!: HInfinite_inverse_Infinitesimal starfun_exp_HInfinite |
336 simp add: starfun_exp_minus HInfinite_minus_iff) |
314 simp add: starfun_exp_minus HInfinite_minus_iff) |
337 done |
315 done |
338 |
316 |
339 lemma starfun_exp_gt_one [simp]: "0 < x ==> 1 < ( *f* exp) x" |
317 lemma starfun_exp_gt_one [simp]: "!!x. 0 < x ==> 1 < ( *f* exp) x" |
340 apply (rule_tac z=x in eq_Abs_star) |
318 by (transfer, simp) |
341 apply (simp add: starfun hypreal_one_num hypreal_zero_num hypreal_less, ultra) |
|
342 done |
|
343 |
319 |
344 (* needs derivative of inverse function |
320 (* needs derivative of inverse function |
345 TRY a NS one today!!! |
321 TRY a NS one today!!! |
346 |
322 |
347 Goal "x @= 1 ==> ( *f* ln) x @= 1" |
323 Goal "x @= 1 ==> ( *f* ln) x @= 1" |
352 Goalw [nsderiv_def] "0r < x ==> NSDERIV ln x :> inverse x"; |
328 Goalw [nsderiv_def] "0r < x ==> NSDERIV ln x :> inverse x"; |
353 |
329 |
354 *) |
330 *) |
355 |
331 |
356 |
332 |
357 lemma starfun_ln_exp [simp]: "( *f* ln) (( *f* exp) x) = x" |
333 lemma starfun_ln_exp [simp]: "!!x. ( *f* ln) (( *f* exp) x) = x" |
358 apply (rule_tac z=x in eq_Abs_star) |
334 by (transfer, simp) |
359 apply (simp add: starfun) |
335 |
360 done |
336 lemma starfun_exp_ln_iff [simp]: "!!x. (( *f* exp)(( *f* ln) x) = x) = (0 < x)" |
361 |
337 by (transfer, simp) |
362 lemma starfun_exp_ln_iff [simp]: "(( *f* exp)(( *f* ln) x) = x) = (0 < x)" |
|
363 apply (rule_tac z=x in eq_Abs_star) |
|
364 apply (simp add: starfun hypreal_zero_num hypreal_less) |
|
365 done |
|
366 |
338 |
367 lemma starfun_exp_ln_eq: "( *f* exp) u = x ==> ( *f* ln) x = u" |
339 lemma starfun_exp_ln_eq: "( *f* exp) u = x ==> ( *f* ln) x = u" |
368 by (auto simp add: starfun) |
340 by auto |
369 |
341 |
370 lemma starfun_ln_less_self [simp]: "0 < x ==> ( *f* ln) x < x" |
342 lemma starfun_ln_less_self [simp]: "!!x. 0 < x ==> ( *f* ln) x < x" |
371 apply (rule_tac z=x in eq_Abs_star) |
343 by (transfer, simp) |
372 apply (simp add: starfun hypreal_zero_num hypreal_less, ultra) |
344 |
373 done |
345 lemma starfun_ln_ge_zero [simp]: "!!x. 1 \<le> x ==> 0 \<le> ( *f* ln) x" |
374 |
346 by (transfer, simp) |
375 lemma starfun_ln_ge_zero [simp]: "1 \<le> x ==> 0 \<le> ( *f* ln) x" |
347 |
376 apply (rule_tac z=x in eq_Abs_star) |
348 lemma starfun_ln_gt_zero [simp]: "!!x .1 < x ==> 0 < ( *f* ln) x" |
377 apply (simp add: starfun hypreal_zero_num hypreal_le hypreal_one_num, ultra) |
349 by (transfer, simp) |
378 done |
350 |
379 |
351 lemma starfun_ln_not_eq_zero [simp]: "!!x. [| 0 < x; x \<noteq> 1 |] ==> ( *f* ln) x \<noteq> 0" |
380 lemma starfun_ln_gt_zero [simp]: "1 < x ==> 0 < ( *f* ln) x" |
352 by (transfer, simp) |
381 apply (rule_tac z=x in eq_Abs_star) |
|
382 apply (simp add: starfun hypreal_zero_num hypreal_less hypreal_one_num, ultra) |
|
383 done |
|
384 |
|
385 lemma starfun_ln_not_eq_zero [simp]: "[| 0 < x; x \<noteq> 1 |] ==> ( *f* ln) x \<noteq> 0" |
|
386 apply (rule_tac z=x in eq_Abs_star) |
|
387 apply (auto simp add: starfun hypreal_zero_num hypreal_less hypreal_one_num, ultra) |
|
388 done |
|
389 |
353 |
390 lemma starfun_ln_HFinite: "[| x \<in> HFinite; 1 \<le> x |] ==> ( *f* ln) x \<in> HFinite" |
354 lemma starfun_ln_HFinite: "[| x \<in> HFinite; 1 \<le> x |] ==> ( *f* ln) x \<in> HFinite" |
391 apply (rule HFinite_bounded) |
355 apply (rule HFinite_bounded) |
392 apply assumption |
356 apply assumption |
393 apply (simp_all add: starfun_ln_less_self order_less_imp_le) |
357 apply (simp_all add: starfun_ln_less_self order_less_imp_le) |
394 done |
358 done |
395 |
359 |
396 lemma starfun_ln_inverse: "0 < x ==> ( *f* ln) (inverse x) = -( *f* ln) x" |
360 lemma starfun_ln_inverse: "!!x. 0 < x ==> ( *f* ln) (inverse x) = -( *f* ln) x" |
397 apply (rule_tac z=x in eq_Abs_star) |
361 by (transfer, rule ln_inverse) |
398 apply (simp add: starfun hypreal_zero_num hypreal_minus hypreal_inverse hypreal_less, ultra) |
|
399 apply (simp add: ln_inverse) |
|
400 done |
|
401 |
362 |
402 lemma starfun_exp_HFinite: "x \<in> HFinite ==> ( *f* exp) x \<in> HFinite" |
363 lemma starfun_exp_HFinite: "x \<in> HFinite ==> ( *f* exp) x \<in> HFinite" |
403 apply (rule_tac z=x in eq_Abs_star) |
364 apply (cases x) |
404 apply (auto simp add: starfun HFinite_FreeUltrafilterNat_iff) |
365 apply (auto simp add: starfun HFinite_FreeUltrafilterNat_iff) |
405 apply (rule bexI, rule_tac [2] lemma_starrel_refl, auto) |
366 apply (rule bexI [OF _ Rep_star_star_n], auto) |
406 apply (rule_tac x = "exp u" in exI) |
367 apply (rule_tac x = "exp u" in exI) |
407 apply (ultra, arith) |
368 apply (ultra, arith) |
408 done |
369 done |
409 |
370 |
410 lemma starfun_exp_add_HFinite_Infinitesimal_approx: |
371 lemma starfun_exp_add_HFinite_Infinitesimal_approx: |
468 lemma HFinite_sin [simp]: |
427 lemma HFinite_sin [simp]: |
469 "sumhr (0, whn, %n. (if even(n) then 0 else |
428 "sumhr (0, whn, %n. (if even(n) then 0 else |
470 ((- 1) ^ ((n - 1) div 2))/(real (fact n))) * x ^ n) |
429 ((- 1) ^ ((n - 1) div 2))/(real (fact n))) * x ^ n) |
471 \<in> HFinite" |
430 \<in> HFinite" |
472 apply (auto intro!: NSBseq_HFinite_hypreal NSconvergent_NSBseq |
431 apply (auto intro!: NSBseq_HFinite_hypreal NSconvergent_NSBseq |
473 simp add: starfunNat_sumr [symmetric] starfunNat hypnat_omega_def |
432 simp add: starfunNat_sumr [symmetric] starfun hypnat_omega_def |
474 convergent_NSconvergent_iff [symmetric] |
433 convergent_NSconvergent_iff [symmetric] |
475 summable_convergent_sumr_iff [symmetric]) |
434 summable_convergent_sumr_iff [symmetric]) |
476 apply (simp only: One_nat_def summable_sin) |
435 apply (simp only: One_nat_def summable_sin) |
477 done |
436 done |
478 |
437 |
479 lemma STAR_sin_zero [simp]: "( *f* sin) 0 = 0" |
438 lemma STAR_sin_zero [simp]: "( *f* sin) 0 = 0" |
480 by (simp add: starfun hypreal_zero_num) |
439 by (transfer, simp) |
481 |
440 |
482 lemma STAR_sin_Infinitesimal [simp]: "x \<in> Infinitesimal ==> ( *f* sin) x @= x" |
441 lemma STAR_sin_Infinitesimal [simp]: "x \<in> Infinitesimal ==> ( *f* sin) x @= x" |
483 apply (case_tac "x = 0") |
442 apply (case_tac "x = 0") |
484 apply (cut_tac [2] x = 0 in DERIV_sin) |
443 apply (cut_tac [2] x = 0 in DERIV_sin) |
485 apply (auto simp add: NSDERIV_DERIV_iff [symmetric] nsderiv_def hypreal_of_real_zero) |
444 apply (auto simp add: NSDERIV_DERIV_iff [symmetric] nsderiv_def) |
486 apply (drule bspec [where x = x], auto) |
445 apply (drule bspec [where x = x], auto) |
487 apply (drule approx_mult1 [where c = x]) |
446 apply (drule approx_mult1 [where c = x]) |
488 apply (auto intro: Infinitesimal_subset_HFinite [THEN subsetD] |
447 apply (auto intro: Infinitesimal_subset_HFinite [THEN subsetD] |
489 simp add: mult_assoc) |
448 simp add: mult_assoc) |
490 done |
449 done |
492 lemma HFinite_cos [simp]: |
451 lemma HFinite_cos [simp]: |
493 "sumhr (0, whn, %n. (if even(n) then |
452 "sumhr (0, whn, %n. (if even(n) then |
494 ((- 1) ^ (n div 2))/(real (fact n)) else |
453 ((- 1) ^ (n div 2))/(real (fact n)) else |
495 0) * x ^ n) \<in> HFinite" |
454 0) * x ^ n) \<in> HFinite" |
496 by (auto intro!: NSBseq_HFinite_hypreal NSconvergent_NSBseq |
455 by (auto intro!: NSBseq_HFinite_hypreal NSconvergent_NSBseq |
497 simp add: starfunNat_sumr [symmetric] starfunNat hypnat_omega_def |
456 simp add: starfunNat_sumr [symmetric] starfun hypnat_omega_def |
498 convergent_NSconvergent_iff [symmetric] |
457 convergent_NSconvergent_iff [symmetric] |
499 summable_convergent_sumr_iff [symmetric] summable_cos) |
458 summable_convergent_sumr_iff [symmetric] summable_cos) |
500 |
459 |
501 lemma STAR_cos_zero [simp]: "( *f* cos) 0 = 1" |
460 lemma STAR_cos_zero [simp]: "( *f* cos) 0 = 1" |
502 by (simp add: starfun hypreal_zero_num hypreal_one_num) |
461 by (simp add: starfun star_n_zero_num star_n_one_num) |
503 |
462 |
504 lemma STAR_cos_Infinitesimal [simp]: "x \<in> Infinitesimal ==> ( *f* cos) x @= 1" |
463 lemma STAR_cos_Infinitesimal [simp]: "x \<in> Infinitesimal ==> ( *f* cos) x @= 1" |
505 apply (case_tac "x = 0") |
464 apply (case_tac "x = 0") |
506 apply (cut_tac [2] x = 0 in DERIV_cos) |
465 apply (cut_tac [2] x = 0 in DERIV_cos) |
507 apply (auto simp add: NSDERIV_DERIV_iff [symmetric] nsderiv_def hypreal_of_real_zero) |
466 apply (auto simp add: NSDERIV_DERIV_iff [symmetric] nsderiv_def) |
508 apply (drule bspec [where x = x]) |
467 apply (drule bspec [where x = x]) |
509 apply (auto simp add: hypreal_of_real_zero hypreal_of_real_one) |
468 apply auto |
510 apply (drule approx_mult1 [where c = x]) |
469 apply (drule approx_mult1 [where c = x]) |
511 apply (auto intro: Infinitesimal_subset_HFinite [THEN subsetD] |
470 apply (auto intro: Infinitesimal_subset_HFinite [THEN subsetD] |
512 simp add: mult_assoc hypreal_of_real_one) |
471 simp add: mult_assoc) |
513 apply (rule approx_add_right_cancel [where d = "-1"], auto) |
472 apply (rule approx_add_right_cancel [where d = "-1"], auto) |
514 done |
473 done |
515 |
474 |
516 lemma STAR_tan_zero [simp]: "( *f* tan) 0 = 0" |
475 lemma STAR_tan_zero [simp]: "( *f* tan) 0 = 0" |
517 by (simp add: starfun hypreal_zero_num) |
476 by (simp add: starfun star_n_zero_num) |
518 |
477 |
519 lemma STAR_tan_Infinitesimal: "x \<in> Infinitesimal ==> ( *f* tan) x @= x" |
478 lemma STAR_tan_Infinitesimal: "x \<in> Infinitesimal ==> ( *f* tan) x @= x" |
520 apply (case_tac "x = 0") |
479 apply (case_tac "x = 0") |
521 apply (cut_tac [2] x = 0 in DERIV_tan) |
480 apply (cut_tac [2] x = 0 in DERIV_tan) |
522 apply (auto simp add: NSDERIV_DERIV_iff [symmetric] nsderiv_def hypreal_of_real_zero) |
481 apply (auto simp add: NSDERIV_DERIV_iff [symmetric] nsderiv_def) |
523 apply (drule bspec [where x = x], auto) |
482 apply (drule bspec [where x = x], auto) |
524 apply (drule approx_mult1 [where c = x]) |
483 apply (drule approx_mult1 [where c = x]) |
525 apply (auto intro: Infinitesimal_subset_HFinite [THEN subsetD] |
484 apply (auto intro: Infinitesimal_subset_HFinite [THEN subsetD] |
526 simp add: mult_assoc) |
485 simp add: mult_assoc) |
527 done |
486 done |
598 apply (rule mult_commute [THEN subst]) |
557 apply (rule mult_commute [THEN subst]) |
599 apply (erule STAR_sin_pi_divide_HNatInfinite_approx_pi) |
558 apply (erule STAR_sin_pi_divide_HNatInfinite_approx_pi) |
600 done |
559 done |
601 |
560 |
602 lemma starfunNat_pi_divide_n_Infinitesimal: |
561 lemma starfunNat_pi_divide_n_Infinitesimal: |
603 "N \<in> HNatInfinite ==> ( *fNat* (%x. pi / real x)) N \<in> Infinitesimal" |
562 "N \<in> HNatInfinite ==> ( *f* (%x. pi / real x)) N \<in> Infinitesimal" |
604 by (auto intro!: Infinitesimal_HFinite_mult2 |
563 by (auto intro!: Infinitesimal_HFinite_mult2 |
605 simp add: starfunNat_mult [symmetric] divide_inverse |
564 simp add: starfun_mult [symmetric] divide_inverse |
606 starfunNat_inverse [symmetric] starfunNat_real_of_nat) |
565 starfun_inverse [symmetric] starfunNat_real_of_nat) |
607 |
566 |
608 lemma STAR_sin_pi_divide_n_approx: |
567 lemma STAR_sin_pi_divide_n_approx: |
609 "N \<in> HNatInfinite ==> |
568 "N \<in> HNatInfinite ==> |
610 ( *f* sin) (( *fNat* (%x. pi / real x)) N) @= |
569 ( *f* sin) (( *f* (%x. pi / real x)) N) @= |
611 hypreal_of_real pi/(hypreal_of_hypnat N)" |
570 hypreal_of_real pi/(hypreal_of_hypnat N)" |
612 by (auto intro!: STAR_sin_Infinitesimal Infinitesimal_HFinite_mult2 |
571 apply (simp add: starfunNat_real_of_nat [symmetric]) |
613 simp add: starfunNat_mult [symmetric] divide_inverse |
572 apply (rule STAR_sin_Infinitesimal) |
614 starfunNat_inverse_real_of_nat_eq) |
573 apply (simp add: divide_inverse) |
|
574 apply (rule Infinitesimal_HFinite_mult2) |
|
575 apply (subst starfun_inverse) |
|
576 apply (erule starfunNat_inverse_real_of_nat_Infinitesimal) |
|
577 apply simp |
|
578 done |
615 |
579 |
616 lemma NSLIMSEQ_sin_pi: "(%n. real n * sin (pi / real n)) ----NS> pi" |
580 lemma NSLIMSEQ_sin_pi: "(%n. real n * sin (pi / real n)) ----NS> pi" |
617 apply (auto simp add: NSLIMSEQ_def starfunNat_mult [symmetric] starfunNat_real_of_nat) |
581 apply (auto simp add: NSLIMSEQ_def starfun_mult [symmetric] starfunNat_real_of_nat) |
618 apply (rule_tac f1 = sin in starfun_stafunNat_o2 [THEN subst]) |
582 apply (rule_tac f1 = sin in starfun_o2 [THEN subst]) |
619 apply (auto simp add: starfunNat_mult [symmetric] starfunNat_real_of_nat divide_inverse) |
583 apply (auto simp add: starfun_mult [symmetric] starfunNat_real_of_nat divide_inverse) |
620 apply (rule_tac f1 = inverse in starfun_stafunNat_o2 [THEN subst]) |
584 apply (rule_tac f1 = inverse in starfun_o2 [THEN subst]) |
621 apply (auto dest: STAR_sin_pi_divide_HNatInfinite_approx_pi |
585 apply (auto dest: STAR_sin_pi_divide_HNatInfinite_approx_pi |
622 simp add: starfunNat_real_of_nat mult_commute divide_inverse) |
586 simp add: starfunNat_real_of_nat mult_commute divide_inverse) |
623 done |
587 done |
624 |
588 |
625 lemma NSLIMSEQ_cos_one: "(%n. cos (pi / real n))----NS> 1" |
589 lemma NSLIMSEQ_cos_one: "(%n. cos (pi / real n))----NS> 1" |
626 apply (simp add: NSLIMSEQ_def, auto) |
590 apply (simp add: NSLIMSEQ_def, auto) |
627 apply (rule_tac f1 = cos in starfun_stafunNat_o2 [THEN subst]) |
591 apply (rule_tac f1 = cos in starfun_o2 [THEN subst]) |
628 apply (rule STAR_cos_Infinitesimal) |
592 apply (rule STAR_cos_Infinitesimal) |
629 apply (auto intro!: Infinitesimal_HFinite_mult2 |
593 apply (auto intro!: Infinitesimal_HFinite_mult2 |
630 simp add: starfunNat_mult [symmetric] divide_inverse |
594 simp add: starfun_mult [symmetric] divide_inverse |
631 starfunNat_inverse [symmetric] starfunNat_real_of_nat) |
595 starfun_inverse [symmetric] starfunNat_real_of_nat) |
632 done |
596 done |
633 |
597 |
634 lemma NSLIMSEQ_sin_cos_pi: |
598 lemma NSLIMSEQ_sin_cos_pi: |
635 "(%n. real n * sin (pi / real n) * cos (pi / real n)) ----NS> pi" |
599 "(%n. real n * sin (pi / real n) * cos (pi / real n)) ----NS> pi" |
636 by (insert NSLIMSEQ_mult [OF NSLIMSEQ_sin_pi NSLIMSEQ_cos_one], simp) |
600 by (insert NSLIMSEQ_mult [OF NSLIMSEQ_sin_pi NSLIMSEQ_cos_one], simp) |