60 hcis :: "hypreal => hcomplex" where |
60 hcis :: "hypreal => hcomplex" where |
61 "hcis = *f* cis" |
61 "hcis = *f* cis" |
62 |
62 |
63 (*----- injection from hyperreals -----*) |
63 (*----- injection from hyperreals -----*) |
64 |
64 |
65 definition |
65 abbreviation |
66 hcomplex_of_hypreal :: "hypreal => hcomplex" where |
66 hcomplex_of_hypreal :: "hypreal \<Rightarrow> hcomplex" where |
67 "hcomplex_of_hypreal = *f* complex_of_real" |
67 "hcomplex_of_hypreal \<equiv> of_hypreal" |
68 |
68 |
69 definition |
69 definition |
70 (* abbreviation for r*(cos a + i sin a) *) |
70 (* abbreviation for r*(cos a + i sin a) *) |
71 hrcis :: "[hypreal, hypreal] => hcomplex" where |
71 hrcis :: "[hypreal, hypreal] => hcomplex" where |
72 "hrcis = *f2* rcis" |
72 "hrcis = *f2* rcis" |
84 hcpow :: "[hcomplex,hypnat] => hcomplex" (infixr "hcpow" 80) where |
84 hcpow :: "[hcomplex,hypnat] => hcomplex" (infixr "hcpow" 80) where |
85 "(z::hcomplex) hcpow (n::hypnat) = ( *f2* op ^) z n" |
85 "(z::hcomplex) hcpow (n::hypnat) = ( *f2* op ^) z n" |
86 *) |
86 *) |
87 lemmas hcomplex_defs [transfer_unfold] = |
87 lemmas hcomplex_defs [transfer_unfold] = |
88 hRe_def hIm_def iii_def hcnj_def hsgn_def harg_def hcis_def |
88 hRe_def hIm_def iii_def hcnj_def hsgn_def harg_def hcis_def |
89 hcomplex_of_hypreal_def hrcis_def hexpi_def HComplex_def |
89 hrcis_def hexpi_def HComplex_def |
90 |
90 |
91 lemma Standard_hRe [simp]: "x \<in> Standard \<Longrightarrow> hRe x \<in> Standard" |
91 lemma Standard_hRe [simp]: "x \<in> Standard \<Longrightarrow> hRe x \<in> Standard" |
92 by (simp add: hcomplex_defs) |
92 by (simp add: hcomplex_defs) |
93 |
93 |
94 lemma Standard_hIm [simp]: "x \<in> Standard \<Longrightarrow> hIm x \<in> Standard" |
94 lemma Standard_hIm [simp]: "x \<in> Standard \<Longrightarrow> hIm x \<in> Standard" |
116 "\<lbrakk>r \<in> Standard; s \<in> Standard\<rbrakk> \<Longrightarrow> hrcis r s \<in> Standard" |
116 "\<lbrakk>r \<in> Standard; s \<in> Standard\<rbrakk> \<Longrightarrow> hrcis r s \<in> Standard" |
117 by (simp add: hcomplex_defs) |
117 by (simp add: hcomplex_defs) |
118 |
118 |
119 lemma Standard_HComplex [simp]: |
119 lemma Standard_HComplex [simp]: |
120 "\<lbrakk>r \<in> Standard; s \<in> Standard\<rbrakk> \<Longrightarrow> HComplex r s \<in> Standard" |
120 "\<lbrakk>r \<in> Standard; s \<in> Standard\<rbrakk> \<Longrightarrow> HComplex r s \<in> Standard" |
121 by (simp add: hcomplex_defs) |
|
122 |
|
123 lemma Standard_hcomplex_of_hypreal [simp]: |
|
124 "r \<in> Standard \<Longrightarrow> hcomplex_of_hypreal r \<in> Standard" |
|
125 by (simp add: hcomplex_defs) |
121 by (simp add: hcomplex_defs) |
126 |
122 |
127 lemma hcmod_def: "hcmod = *f* cmod" |
123 lemma hcmod_def: "hcmod = *f* cmod" |
128 by (rule hnorm_def) |
124 by (rule hnorm_def) |
129 |
125 |
201 |
197 |
202 |
198 |
203 subsection{*Subraction and Division*} |
199 subsection{*Subraction and Division*} |
204 |
200 |
205 lemma hcomplex_diff_eq_eq [simp]: "((x::hcomplex) - y = z) = (x = z + y)" |
201 lemma hcomplex_diff_eq_eq [simp]: "((x::hcomplex) - y = z) = (x = z + y)" |
|
202 (* TODO: delete *) |
206 by (rule OrderedGroup.diff_eq_eq) |
203 by (rule OrderedGroup.diff_eq_eq) |
207 |
204 |
208 lemma hcomplex_add_divide_distrib: "(x+y)/(z::hcomplex) = x/z + y/z" |
|
209 by (rule Ring_and_Field.add_divide_distrib) |
|
210 |
|
211 |
205 |
212 subsection{*Embedding Properties for @{term hcomplex_of_hypreal} Map*} |
206 subsection{*Embedding Properties for @{term hcomplex_of_hypreal} Map*} |
213 |
|
214 lemma hcomplex_of_hypreal_cancel_iff [iff]: |
|
215 "!!x y. (hcomplex_of_hypreal x = hcomplex_of_hypreal y) = (x = y)" |
|
216 by transfer (rule of_real_eq_iff) |
|
217 |
|
218 lemma hcomplex_of_hypreal_one [simp]: "hcomplex_of_hypreal 1 = 1" |
|
219 by transfer (rule of_real_1) |
|
220 |
|
221 lemma hcomplex_of_hypreal_zero [simp]: "hcomplex_of_hypreal 0 = 0" |
|
222 by transfer (rule of_real_0) |
|
223 |
|
224 lemma hcomplex_of_hypreal_minus [simp]: |
|
225 "!!x. hcomplex_of_hypreal(-x) = - hcomplex_of_hypreal x" |
|
226 by transfer (rule of_real_minus) |
|
227 |
|
228 lemma hcomplex_of_hypreal_inverse [simp]: |
|
229 "!!x. hcomplex_of_hypreal(inverse x) = inverse(hcomplex_of_hypreal x)" |
|
230 by transfer (rule of_real_inverse) |
|
231 |
|
232 lemma hcomplex_of_hypreal_add [simp]: |
|
233 "!!x y. hcomplex_of_hypreal (x + y) = |
|
234 hcomplex_of_hypreal x + hcomplex_of_hypreal y" |
|
235 by transfer (rule of_real_add) |
|
236 |
|
237 lemma hcomplex_of_hypreal_diff [simp]: |
|
238 "!!x y. hcomplex_of_hypreal (x - y) = |
|
239 hcomplex_of_hypreal x - hcomplex_of_hypreal y " |
|
240 by transfer (rule of_real_diff) |
|
241 |
|
242 lemma hcomplex_of_hypreal_mult [simp]: |
|
243 "!!x y. hcomplex_of_hypreal (x * y) = |
|
244 hcomplex_of_hypreal x * hcomplex_of_hypreal y" |
|
245 by transfer (rule of_real_mult) |
|
246 |
|
247 lemma hcomplex_of_hypreal_divide [simp]: |
|
248 "!!x y. hcomplex_of_hypreal(x/y) = |
|
249 hcomplex_of_hypreal x / hcomplex_of_hypreal y" |
|
250 by transfer (rule of_real_divide) |
|
251 |
207 |
252 lemma hRe_hcomplex_of_hypreal [simp]: "!!z. hRe(hcomplex_of_hypreal z) = z" |
208 lemma hRe_hcomplex_of_hypreal [simp]: "!!z. hRe(hcomplex_of_hypreal z) = z" |
253 by transfer (rule Re_complex_of_real) |
209 by transfer (rule Re_complex_of_real) |
254 |
210 |
255 lemma hIm_hcomplex_of_hypreal [simp]: "!!z. hIm(hcomplex_of_hypreal z) = 0" |
211 lemma hIm_hcomplex_of_hypreal [simp]: "!!z. hIm(hcomplex_of_hypreal z) = 0" |
256 by transfer (rule Im_complex_of_real) |
212 by transfer (rule Im_complex_of_real) |
257 |
|
258 lemma hcomplex_of_hypreal_zero_iff [simp]: |
|
259 "\<And>x. (hcomplex_of_hypreal x = 0) = (x = 0)" |
|
260 by transfer (rule of_real_eq_0_iff) |
|
261 |
213 |
262 lemma hcomplex_of_hypreal_epsilon_not_zero [simp]: |
214 lemma hcomplex_of_hypreal_epsilon_not_zero [simp]: |
263 "hcomplex_of_hypreal epsilon \<noteq> 0" |
215 "hcomplex_of_hypreal epsilon \<noteq> 0" |
264 by (simp add: hypreal_epsilon_not_zero) |
216 by (simp add: hypreal_epsilon_not_zero) |
265 |
217 |
278 "(\<And>x y. P (HComplex x y)) ==> P z" |
230 "(\<And>x y. P (HComplex x y)) ==> P z" |
279 by (rule hcomplex_surj [THEN subst], blast) |
231 by (rule hcomplex_surj [THEN subst], blast) |
280 |
232 |
281 |
233 |
282 subsection{*Modulus (Absolute Value) of Nonstandard Complex Number*} |
234 subsection{*Modulus (Absolute Value) of Nonstandard Complex Number*} |
283 |
|
284 lemma hcmod_zero [simp]: "hcmod(0) = 0" |
|
285 by (rule hnorm_zero) |
|
286 |
|
287 lemma hcmod_one [simp]: "hcmod(1) = 1" |
|
288 by (rule hnorm_one) |
|
289 |
|
290 lemma hcmod_hcomplex_of_hypreal [simp]: |
|
291 "!!x. hcmod(hcomplex_of_hypreal x) = abs x" |
|
292 by transfer (rule norm_of_real) |
|
293 |
235 |
294 lemma hcomplex_of_hypreal_abs: |
236 lemma hcomplex_of_hypreal_abs: |
295 "hcomplex_of_hypreal (abs x) = |
237 "hcomplex_of_hypreal (abs x) = |
296 hcomplex_of_hypreal(hcmod(hcomplex_of_hypreal x))" |
238 hcomplex_of_hypreal(hcmod(hcomplex_of_hypreal x))" |
297 by simp |
239 by simp |
393 by transfer (rule complex_mult_cnj) |
335 by transfer (rule complex_mult_cnj) |
394 |
336 |
395 |
337 |
396 subsection{*More Theorems about the Function @{term hcmod}*} |
338 subsection{*More Theorems about the Function @{term hcmod}*} |
397 |
339 |
398 lemma hcomplex_hcmod_eq_zero_cancel [simp]: "!!x. (hcmod x = 0) = (x = 0)" |
|
399 by transfer (rule norm_eq_zero) |
|
400 |
|
401 lemma hcmod_hcomplex_of_hypreal_of_nat [simp]: |
340 lemma hcmod_hcomplex_of_hypreal_of_nat [simp]: |
402 "hcmod (hcomplex_of_hypreal(hypreal_of_nat n)) = hypreal_of_nat n" |
341 "hcmod (hcomplex_of_hypreal(hypreal_of_nat n)) = hypreal_of_nat n" |
403 by simp |
342 by simp |
404 |
343 |
405 lemma hcmod_hcomplex_of_hypreal_of_hypnat [simp]: |
344 lemma hcmod_hcomplex_of_hypreal_of_hypnat [simp]: |
406 "hcmod (hcomplex_of_hypreal(hypreal_of_hypnat n)) = hypreal_of_hypnat n" |
345 "hcmod (hcomplex_of_hypreal(hypreal_of_hypnat n)) = hypreal_of_hypnat n" |
407 by simp |
346 by simp |
408 |
347 |
409 lemma hcmod_minus [simp]: "!!x. hcmod (-x) = hcmod(x)" |
|
410 by transfer (rule norm_minus_cancel) |
|
411 |
|
412 lemma hcmod_mult_hcnj: "!!z. hcmod(z * hcnj(z)) = hcmod(z) ^ 2" |
348 lemma hcmod_mult_hcnj: "!!z. hcmod(z * hcnj(z)) = hcmod(z) ^ 2" |
413 by transfer (rule complex_mod_mult_cnj) |
349 by transfer (rule complex_mod_mult_cnj) |
414 |
|
415 lemma hcmod_ge_zero [simp]: "!!x. (0::hypreal) \<le> hcmod x" |
|
416 by transfer (rule norm_ge_zero) |
|
417 |
|
418 lemma hrabs_hcmod_cancel [simp]: "abs(hcmod x) = hcmod x" |
|
419 by (simp add: abs_if linorder_not_less) |
|
420 |
|
421 lemma hcmod_mult: "!!x y. hcmod(x*y) = hcmod(x) * hcmod(y)" |
|
422 by transfer (rule complex_mod_mult) |
|
423 |
|
424 lemma hcmod_triangle_ineq [simp]: |
|
425 "!!x y. hcmod (x + y) \<le> hcmod(x) + hcmod(y)" |
|
426 by transfer (rule complex_mod_triangle_ineq) |
|
427 |
350 |
428 lemma hcmod_triangle_ineq2 [simp]: |
351 lemma hcmod_triangle_ineq2 [simp]: |
429 "!!a b. hcmod(b + a) - hcmod b \<le> hcmod a" |
352 "!!a b. hcmod(b + a) - hcmod b \<le> hcmod a" |
430 by transfer (rule complex_mod_triangle_ineq2) |
353 by transfer (rule complex_mod_triangle_ineq2) |
431 |
354 |
432 lemma hcmod_diff_commute: "!!x y. hcmod (x - y) = hcmod (y - x)" |
|
433 by transfer (rule norm_minus_commute) |
|
434 |
|
435 lemma hcmod_add_less: |
|
436 "!!x y r s. [| hcmod x < r; hcmod y < s |] ==> hcmod (x + y) < r + s" |
|
437 by transfer (rule complex_mod_add_less) |
|
438 |
|
439 lemma hcmod_mult_less: |
|
440 "!!x y r s. [| hcmod x < r; hcmod y < s |] ==> hcmod (x * y) < r * s" |
|
441 by transfer (rule complex_mod_mult_less) |
|
442 |
|
443 lemma hcmod_diff_ineq [simp]: "!!a b. hcmod(a) - hcmod(b) \<le> hcmod(a + b)" |
355 lemma hcmod_diff_ineq [simp]: "!!a b. hcmod(a) - hcmod(b) \<le> hcmod(a + b)" |
444 by transfer (rule complex_mod_diff_ineq) |
356 by transfer (rule complex_mod_diff_ineq) |
445 |
357 |
446 |
358 |
447 subsection{*A Few Nonlinear Theorems*} |
359 subsection{*A Few Nonlinear Theorems*} |
450 "!!x n. hcomplex_of_hypreal (x pow n) = (hcomplex_of_hypreal x) pow n" |
362 "!!x n. hcomplex_of_hypreal (x pow n) = (hcomplex_of_hypreal x) pow n" |
451 by transfer (rule complex_of_real_pow) |
363 by transfer (rule complex_of_real_pow) |
452 |
364 |
453 lemma hcmod_hcpow: "!!x n. hcmod(x pow n) = hcmod(x) pow n" |
365 lemma hcmod_hcpow: "!!x n. hcmod(x pow n) = hcmod(x) pow n" |
454 by transfer (rule complex_mod_complexpow) |
366 by transfer (rule complex_mod_complexpow) |
455 |
|
456 lemma hcmod_hcomplex_inverse: "!!x. hcmod(inverse x) = inverse(hcmod x)" |
|
457 by transfer (rule norm_inverse) |
|
458 |
|
459 lemma hcmod_divide: "!!x y. hcmod(x/y) = hcmod(x)/(hcmod y)" |
|
460 by transfer (rule norm_divide) |
|
461 |
367 |
462 |
368 |
463 subsection{*Exponentiation*} |
369 subsection{*Exponentiation*} |
464 |
370 |
465 lemma hcomplexpow_0 [simp]: "z ^ 0 = (1::hcomplex)" |
371 lemma hcomplexpow_0 [simp]: "z ^ 0 = (1::hcomplex)" |
732 |
638 |
733 subsection{*@{term hcomplex_of_complex}: the Injection from |
639 subsection{*@{term hcomplex_of_complex}: the Injection from |
734 type @{typ complex} to to @{typ hcomplex}*} |
640 type @{typ complex} to to @{typ hcomplex}*} |
735 |
641 |
736 lemma inj_hcomplex_of_complex: "inj(hcomplex_of_complex)" |
642 lemma inj_hcomplex_of_complex: "inj(hcomplex_of_complex)" |
737 by (rule inj_onI, simp) |
643 (* TODO: delete *) |
|
644 by (rule inj_star_of) |
738 |
645 |
739 lemma hcomplex_of_complex_i: "iii = hcomplex_of_complex ii" |
646 lemma hcomplex_of_complex_i: "iii = hcomplex_of_complex ii" |
740 by (rule iii_def) |
647 by (rule iii_def) |
741 |
648 |
742 lemma hRe_hcomplex_of_complex: |
649 lemma hRe_hcomplex_of_complex: |