13957
|
1 |
(* Title: NSComplex.thy
|
|
2 |
Author: Jacques D. Fleuriot
|
|
3 |
Copyright: 2001 University of Edinburgh
|
|
4 |
Description: Nonstandard Complex numbers
|
|
5 |
*)
|
|
6 |
|
|
7 |
NSComplex = NSInduct +
|
|
8 |
|
|
9 |
constdefs
|
|
10 |
hcomplexrel :: "((nat=>complex)*(nat=>complex)) set"
|
|
11 |
"hcomplexrel == {p. EX X Y. p = ((X::nat=>complex),Y) &
|
|
12 |
{n::nat. X(n) = Y(n)}: FreeUltrafilterNat}"
|
|
13 |
|
|
14 |
typedef hcomplex = "{x::nat=>complex. True}//hcomplexrel" (quotient_def)
|
|
15 |
|
|
16 |
instance
|
|
17 |
hcomplex :: {zero,one,plus,times,minus,power,inverse}
|
|
18 |
|
|
19 |
defs
|
|
20 |
hcomplex_zero_def
|
|
21 |
"0 == Abs_hcomplex(hcomplexrel `` {%n. (0::complex)})"
|
|
22 |
|
|
23 |
hcomplex_one_def
|
|
24 |
"1 == Abs_hcomplex(hcomplexrel `` {%n. (1::complex)})"
|
|
25 |
|
|
26 |
|
|
27 |
hcomplex_minus_def
|
|
28 |
"- z == Abs_hcomplex(UN X: Rep_hcomplex(z). hcomplexrel `` {%n::nat. - (X n)})"
|
|
29 |
|
|
30 |
hcomplex_diff_def
|
|
31 |
"w - z == w + -(z::hcomplex)"
|
|
32 |
|
|
33 |
constdefs
|
|
34 |
|
|
35 |
hcomplex_of_complex :: complex => hcomplex
|
|
36 |
"hcomplex_of_complex z == Abs_hcomplex(hcomplexrel `` {%n. z})"
|
|
37 |
|
|
38 |
hcinv :: hcomplex => hcomplex
|
|
39 |
"inverse(P) == Abs_hcomplex(UN X: Rep_hcomplex(P).
|
|
40 |
hcomplexrel `` {%n. inverse(X n)})"
|
|
41 |
|
|
42 |
(*--- real and Imaginary parts ---*)
|
|
43 |
|
|
44 |
hRe :: hcomplex => hypreal
|
|
45 |
"hRe(z) == Abs_hypreal(UN X:Rep_hcomplex(z). hyprel `` {%n. Re (X n)})"
|
|
46 |
|
|
47 |
hIm :: hcomplex => hypreal
|
|
48 |
"hIm(z) == Abs_hypreal(UN X:Rep_hcomplex(z). hyprel `` {%n. Im (X n)})"
|
|
49 |
|
|
50 |
|
|
51 |
(*----------- modulus ------------*)
|
|
52 |
|
|
53 |
hcmod :: hcomplex => hypreal
|
|
54 |
"hcmod z == Abs_hypreal(UN X: Rep_hcomplex(z).
|
|
55 |
hyprel `` {%n. cmod (X n)})"
|
|
56 |
|
|
57 |
(*------ imaginary unit ----------*)
|
|
58 |
|
|
59 |
iii :: hcomplex
|
|
60 |
"iii == Abs_hcomplex(hcomplexrel `` {%n. ii})"
|
|
61 |
|
|
62 |
(*------- complex conjugate ------*)
|
|
63 |
|
|
64 |
hcnj :: hcomplex => hcomplex
|
|
65 |
"hcnj z == Abs_hcomplex(UN X:Rep_hcomplex(z). hcomplexrel `` {%n. cnj (X n)})"
|
|
66 |
|
|
67 |
(*------------ Argand -------------*)
|
|
68 |
|
|
69 |
hsgn :: hcomplex => hcomplex
|
|
70 |
"hsgn z == Abs_hcomplex(UN X:Rep_hcomplex(z). hcomplexrel `` {%n. sgn(X n)})"
|
|
71 |
|
|
72 |
harg :: hcomplex => hypreal
|
|
73 |
"harg z == Abs_hypreal(UN X:Rep_hcomplex(z). hyprel `` {%n. arg(X n)})"
|
|
74 |
|
|
75 |
(* abbreviation for (cos a + i sin a) *)
|
|
76 |
hcis :: hypreal => hcomplex
|
|
77 |
"hcis a == Abs_hcomplex(UN X:Rep_hypreal(a). hcomplexrel `` {%n. cis (X n)})"
|
|
78 |
|
|
79 |
(* abbreviation for r*(cos a + i sin a) *)
|
|
80 |
hrcis :: [hypreal, hypreal] => hcomplex
|
|
81 |
"hrcis r a == hcomplex_of_hypreal r * hcis a"
|
|
82 |
|
|
83 |
(*----- injection from hyperreals -----*)
|
|
84 |
|
|
85 |
hcomplex_of_hypreal :: hypreal => hcomplex
|
|
86 |
"hcomplex_of_hypreal r == Abs_hcomplex(UN X:Rep_hypreal(r).
|
|
87 |
hcomplexrel `` {%n. complex_of_real (X n)})"
|
|
88 |
|
|
89 |
(*------------ e ^ (x + iy) ------------*)
|
|
90 |
|
|
91 |
hexpi :: hcomplex => hcomplex
|
|
92 |
"hexpi z == hcomplex_of_hypreal(( *f* exp) (hRe z)) * hcis (hIm z)"
|
|
93 |
|
|
94 |
|
|
95 |
defs
|
|
96 |
|
|
97 |
|
|
98 |
(*----------- division ----------*)
|
|
99 |
|
|
100 |
hcomplex_divide_def
|
|
101 |
"w / (z::hcomplex) == w * inverse z"
|
|
102 |
|
|
103 |
hcomplex_add_def
|
|
104 |
"w + z == Abs_hcomplex(UN X:Rep_hcomplex(w). UN Y:Rep_hcomplex(z).
|
|
105 |
hcomplexrel `` {%n. X n + Y n})"
|
|
106 |
|
|
107 |
hcomplex_mult_def
|
|
108 |
"w * z == Abs_hcomplex(UN X:Rep_hcomplex(w). UN Y:Rep_hcomplex(z).
|
|
109 |
hcomplexrel `` {%n. X n * Y n})"
|
|
110 |
|
|
111 |
|
|
112 |
primrec
|
|
113 |
hcomplexpow_0 "z ^ 0 = 1"
|
|
114 |
hcomplexpow_Suc "z ^ (Suc n) = (z::hcomplex) * (z ^ n)"
|
|
115 |
|
|
116 |
|
|
117 |
consts
|
|
118 |
"hcpow" :: [hcomplex,hypnat] => hcomplex (infixr 80)
|
|
119 |
|
|
120 |
defs
|
|
121 |
(* hypernatural powers of nonstandard complex numbers *)
|
|
122 |
hcpow_def
|
|
123 |
"(z::hcomplex) hcpow (n::hypnat)
|
|
124 |
== Abs_hcomplex(UN X:Rep_hcomplex(z). UN Y: Rep_hypnat(n).
|
|
125 |
hcomplexrel `` {%n. (X n) ^ (Y n)})"
|
|
126 |
|
|
127 |
end
|