author | huffman |
Tue, 08 May 2007 05:30:10 +0200 | |
changeset 22861 | 8ec47039614e |
parent 22852 | 2490d4b4671a |
child 22883 | 005be8dafce0 |
permissions | -rw-r--r-- |
13957 | 1 |
(* Title: Complex.thy |
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
2 |
ID: $Id$ |
13957 | 3 |
Author: Jacques D. Fleuriot |
4 |
Copyright: 2001 University of Edinburgh |
|
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
5 |
Conversion to Isar and new proofs by Lawrence C Paulson, 2003/4 |
13957 | 6 |
*) |
7 |
||
14377 | 8 |
header {* Complex Numbers: Rectangular and Polar Representations *} |
14373 | 9 |
|
15131 | 10 |
theory Complex |
22655 | 11 |
imports "../Hyperreal/Transcendental" |
15131 | 12 |
begin |
13957 | 13 |
|
14373 | 14 |
datatype complex = Complex real real |
13957 | 15 |
|
14691 | 16 |
instance complex :: "{zero, one, plus, times, minus, inverse, power}" .. |
13957 | 17 |
|
18 |
consts |
|
14373 | 19 |
"ii" :: complex ("\<i>") |
20 |
||
21 |
consts Re :: "complex => real" |
|
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
22 |
primrec Re: "Re (Complex x y) = x" |
14373 | 23 |
|
24 |
consts Im :: "complex => real" |
|
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
25 |
primrec Im: "Im (Complex x y) = y" |
14373 | 26 |
|
27 |
lemma complex_surj [simp]: "Complex (Re z) (Im z) = z" |
|
28 |
by (induct z) simp |
|
13957 | 29 |
|
14323 | 30 |
defs (overloaded) |
31 |
||
32 |
complex_zero_def: |
|
14373 | 33 |
"0 == Complex 0 0" |
13957 | 34 |
|
14323 | 35 |
complex_one_def: |
14373 | 36 |
"1 == Complex 1 0" |
14323 | 37 |
|
14373 | 38 |
i_def: "ii == Complex 0 1" |
14323 | 39 |
|
14373 | 40 |
complex_minus_def: "- z == Complex (- Re z) (- Im z)" |
14323 | 41 |
|
42 |
complex_inverse_def: |
|
14373 | 43 |
"inverse z == |
44 |
Complex (Re z / ((Re z)\<twosuperior> + (Im z)\<twosuperior>)) (- Im z / ((Re z)\<twosuperior> + (Im z)\<twosuperior>))" |
|
13957 | 45 |
|
14323 | 46 |
complex_add_def: |
14373 | 47 |
"z + w == Complex (Re z + Re w) (Im z + Im w)" |
13957 | 48 |
|
14323 | 49 |
complex_diff_def: |
14373 | 50 |
"z - w == z + - (w::complex)" |
13957 | 51 |
|
14374 | 52 |
complex_mult_def: |
14373 | 53 |
"z * w == Complex (Re z * Re w - Im z * Im w) (Re z * Im w + Im z * Re w)" |
13957 | 54 |
|
14373 | 55 |
complex_divide_def: "w / (z::complex) == w * inverse z" |
14323 | 56 |
|
13957 | 57 |
|
14373 | 58 |
lemma complex_equality [intro?]: "Re z = Re w ==> Im z = Im w ==> z = w" |
59 |
by (induct z, induct w) simp |
|
14323 | 60 |
|
61 |
lemma complex_Re_Im_cancel_iff: "(w=z) = (Re(w) = Re(z) & Im(w) = Im(z))" |
|
14373 | 62 |
by (induct w, induct z, simp) |
14323 | 63 |
|
14374 | 64 |
lemma complex_Re_zero [simp]: "Re 0 = 0" |
65 |
by (simp add: complex_zero_def) |
|
66 |
||
67 |
lemma complex_Im_zero [simp]: "Im 0 = 0" |
|
14373 | 68 |
by (simp add: complex_zero_def) |
14323 | 69 |
|
22861
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
70 |
lemma complex_zero_iff [simp]: "(Complex x y = 0) = (x = 0 \<and> y = 0)" |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
71 |
unfolding complex_zero_def by simp |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
72 |
|
14374 | 73 |
lemma complex_Re_one [simp]: "Re 1 = 1" |
74 |
by (simp add: complex_one_def) |
|
14323 | 75 |
|
14374 | 76 |
lemma complex_Im_one [simp]: "Im 1 = 0" |
14373 | 77 |
by (simp add: complex_one_def) |
14323 | 78 |
|
14374 | 79 |
lemma complex_Re_i [simp]: "Re(ii) = 0" |
14373 | 80 |
by (simp add: i_def) |
14323 | 81 |
|
14374 | 82 |
lemma complex_Im_i [simp]: "Im(ii) = 1" |
14373 | 83 |
by (simp add: i_def) |
14323 | 84 |
|
85 |
||
14374 | 86 |
subsection{*Unary Minus*} |
14323 | 87 |
|
14377 | 88 |
lemma complex_minus [simp]: "- (Complex x y) = Complex (-x) (-y)" |
14373 | 89 |
by (simp add: complex_minus_def) |
14323 | 90 |
|
14374 | 91 |
lemma complex_Re_minus [simp]: "Re (-z) = - Re z" |
14373 | 92 |
by (simp add: complex_minus_def) |
14323 | 93 |
|
14374 | 94 |
lemma complex_Im_minus [simp]: "Im (-z) = - Im z" |
95 |
by (simp add: complex_minus_def) |
|
14323 | 96 |
|
97 |
||
98 |
subsection{*Addition*} |
|
99 |
||
14377 | 100 |
lemma complex_add [simp]: |
101 |
"Complex x1 y1 + Complex x2 y2 = Complex (x1+x2) (y1+y2)" |
|
14373 | 102 |
by (simp add: complex_add_def) |
14323 | 103 |
|
14374 | 104 |
lemma complex_Re_add [simp]: "Re(x + y) = Re(x) + Re(y)" |
14373 | 105 |
by (simp add: complex_add_def) |
14323 | 106 |
|
14374 | 107 |
lemma complex_Im_add [simp]: "Im(x + y) = Im(x) + Im(y)" |
14373 | 108 |
by (simp add: complex_add_def) |
14323 | 109 |
|
110 |
lemma complex_add_commute: "(u::complex) + v = v + u" |
|
14373 | 111 |
by (simp add: complex_add_def add_commute) |
14323 | 112 |
|
113 |
lemma complex_add_assoc: "((u::complex) + v) + w = u + (v + w)" |
|
14373 | 114 |
by (simp add: complex_add_def add_assoc) |
14323 | 115 |
|
116 |
lemma complex_add_zero_left: "(0::complex) + z = z" |
|
14373 | 117 |
by (simp add: complex_add_def complex_zero_def) |
14323 | 118 |
|
119 |
lemma complex_add_zero_right: "z + (0::complex) = z" |
|
14373 | 120 |
by (simp add: complex_add_def complex_zero_def) |
14323 | 121 |
|
14373 | 122 |
lemma complex_add_minus_left: "-z + z = (0::complex)" |
123 |
by (simp add: complex_add_def complex_minus_def complex_zero_def) |
|
14323 | 124 |
|
125 |
lemma complex_diff: |
|
14373 | 126 |
"Complex x1 y1 - Complex x2 y2 = Complex (x1-x2) (y1-y2)" |
127 |
by (simp add: complex_add_def complex_minus_def complex_diff_def) |
|
14323 | 128 |
|
14374 | 129 |
lemma complex_Re_diff [simp]: "Re(x - y) = Re(x) - Re(y)" |
130 |
by (simp add: complex_diff_def) |
|
131 |
||
132 |
lemma complex_Im_diff [simp]: "Im(x - y) = Im(x) - Im(y)" |
|
133 |
by (simp add: complex_diff_def) |
|
134 |
||
135 |
||
14323 | 136 |
subsection{*Multiplication*} |
137 |
||
14377 | 138 |
lemma complex_mult [simp]: |
14373 | 139 |
"Complex x1 y1 * Complex x2 y2 = Complex (x1*x2 - y1*y2) (x1*y2 + y1*x2)" |
140 |
by (simp add: complex_mult_def) |
|
14323 | 141 |
|
142 |
lemma complex_mult_commute: "(w::complex) * z = z * w" |
|
14373 | 143 |
by (simp add: complex_mult_def mult_commute add_commute) |
14323 | 144 |
|
145 |
lemma complex_mult_assoc: "((u::complex) * v) * w = u * (v * w)" |
|
14374 | 146 |
by (simp add: complex_mult_def mult_ac add_ac |
14373 | 147 |
right_diff_distrib right_distrib left_diff_distrib left_distrib) |
14323 | 148 |
|
149 |
lemma complex_mult_one_left: "(1::complex) * z = z" |
|
14373 | 150 |
by (simp add: complex_mult_def complex_one_def) |
14323 | 151 |
|
152 |
lemma complex_mult_one_right: "z * (1::complex) = z" |
|
14373 | 153 |
by (simp add: complex_mult_def complex_one_def) |
14323 | 154 |
|
155 |
||
156 |
subsection{*Inverse*} |
|
157 |
||
14377 | 158 |
lemma complex_inverse [simp]: |
14373 | 159 |
"inverse (Complex x y) = Complex (x/(x ^ 2 + y ^ 2)) (-y/(x ^ 2 + y ^ 2))" |
160 |
by (simp add: complex_inverse_def) |
|
14335 | 161 |
|
14354
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
162 |
lemma complex_mult_inv_left: "z \<noteq> (0::complex) ==> inverse(z) * z = 1" |
14374 | 163 |
apply (induct z) |
164 |
apply (rename_tac x y) |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
165 |
apply (auto simp add: |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15140
diff
changeset
|
166 |
complex_one_def complex_zero_def add_divide_distrib [symmetric] |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15140
diff
changeset
|
167 |
power2_eq_square mult_ac) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15140
diff
changeset
|
168 |
apply (simp_all add: real_sum_squares_not_zero real_sum_squares_not_zero2) |
14323 | 169 |
done |
170 |
||
14335 | 171 |
|
172 |
subsection {* The field of complex numbers *} |
|
173 |
||
174 |
instance complex :: field |
|
175 |
proof |
|
176 |
fix z u v w :: complex |
|
177 |
show "(u + v) + w = u + (v + w)" |
|
14374 | 178 |
by (rule complex_add_assoc) |
14335 | 179 |
show "z + w = w + z" |
14374 | 180 |
by (rule complex_add_commute) |
14335 | 181 |
show "0 + z = z" |
14374 | 182 |
by (rule complex_add_zero_left) |
14335 | 183 |
show "-z + z = 0" |
14374 | 184 |
by (rule complex_add_minus_left) |
14335 | 185 |
show "z - w = z + -w" |
186 |
by (simp add: complex_diff_def) |
|
187 |
show "(u * v) * w = u * (v * w)" |
|
14374 | 188 |
by (rule complex_mult_assoc) |
14335 | 189 |
show "z * w = w * z" |
14374 | 190 |
by (rule complex_mult_commute) |
14335 | 191 |
show "1 * z = z" |
14374 | 192 |
by (rule complex_mult_one_left) |
14341
a09441bd4f1e
Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents:
14335
diff
changeset
|
193 |
show "0 \<noteq> (1::complex)" |
14373 | 194 |
by (simp add: complex_zero_def complex_one_def) |
14335 | 195 |
show "(u + v) * w = u * w + v * w" |
14421
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14387
diff
changeset
|
196 |
by (simp add: complex_mult_def complex_add_def left_distrib |
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14387
diff
changeset
|
197 |
diff_minus add_ac) |
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
198 |
show "z / w = z * inverse w" |
14335 | 199 |
by (simp add: complex_divide_def) |
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
200 |
assume "w \<noteq> 0" |
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
201 |
thus "inverse w * w = 1" |
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
202 |
by (simp add: complex_mult_inv_left) |
14335 | 203 |
qed |
204 |
||
14373 | 205 |
instance complex :: division_by_zero |
206 |
proof |
|
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
207 |
show "inverse 0 = (0::complex)" |
14373 | 208 |
by (simp add: complex_inverse_def complex_zero_def) |
209 |
qed |
|
14335 | 210 |
|
14323 | 211 |
|
20556
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
212 |
subsection{*The real algebra of complex numbers*} |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
213 |
|
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
214 |
instance complex :: scaleR .. |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
215 |
|
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
216 |
defs (overloaded) |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
217 |
complex_scaleR_def: "r *# x == Complex r 0 * x" |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
218 |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
219 |
instance complex :: real_field |
20556
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
220 |
proof |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
221 |
fix a b :: real |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
222 |
fix x y :: complex |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
223 |
show "a *# (x + y) = a *# x + a *# y" |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
224 |
by (simp add: complex_scaleR_def right_distrib) |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
225 |
show "(a + b) *# x = a *# x + b *# x" |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
226 |
by (simp add: complex_scaleR_def left_distrib [symmetric]) |
20763 | 227 |
show "a *# b *# x = (a * b) *# x" |
20556
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
228 |
by (simp add: complex_scaleR_def mult_assoc [symmetric]) |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
229 |
show "1 *# x = x" |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
230 |
by (simp add: complex_scaleR_def complex_one_def [symmetric]) |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
231 |
show "a *# x * y = a *# (x * y)" |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
232 |
by (simp add: complex_scaleR_def mult_assoc) |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
233 |
show "x * a *# y = a *# (x * y)" |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
234 |
by (simp add: complex_scaleR_def mult_left_commute) |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
235 |
qed |
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
236 |
|
2e8227b81bf1
add instance for real_algebra_1 and real_normed_div_algebra
huffman
parents:
20485
diff
changeset
|
237 |
|
14323 | 238 |
subsection{*Embedding Properties for @{term complex_of_real} Map*} |
239 |
||
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
240 |
abbreviation |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20763
diff
changeset
|
241 |
complex_of_real :: "real => complex" where |
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
242 |
"complex_of_real == of_real" |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
243 |
|
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
244 |
lemma complex_of_real_def: "complex_of_real r = Complex r 0" |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
245 |
by (simp add: of_real_def complex_scaleR_def) |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
246 |
|
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
247 |
lemma Re_complex_of_real [simp]: "Re (complex_of_real z) = z" |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
248 |
by (simp add: complex_of_real_def) |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
249 |
|
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
250 |
lemma Im_complex_of_real [simp]: "Im (complex_of_real z) = 0" |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
251 |
by (simp add: complex_of_real_def) |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
252 |
|
14377 | 253 |
lemma Complex_add_complex_of_real [simp]: |
254 |
"Complex x y + complex_of_real r = Complex (x+r) y" |
|
255 |
by (simp add: complex_of_real_def) |
|
256 |
||
257 |
lemma complex_of_real_add_Complex [simp]: |
|
258 |
"complex_of_real r + Complex x y = Complex (r+x) y" |
|
259 |
by (simp add: i_def complex_of_real_def) |
|
260 |
||
261 |
lemma Complex_mult_complex_of_real: |
|
262 |
"Complex x y * complex_of_real r = Complex (x*r) (y*r)" |
|
263 |
by (simp add: complex_of_real_def) |
|
264 |
||
265 |
lemma complex_of_real_mult_Complex: |
|
266 |
"complex_of_real r * Complex x y = Complex (r*x) (r*y)" |
|
267 |
by (simp add: i_def complex_of_real_def) |
|
268 |
||
269 |
lemma i_complex_of_real [simp]: "ii * complex_of_real r = Complex 0 r" |
|
270 |
by (simp add: i_def complex_of_real_def) |
|
271 |
||
272 |
lemma complex_of_real_i [simp]: "complex_of_real r * ii = Complex 0 r" |
|
273 |
by (simp add: i_def complex_of_real_def) |
|
274 |
||
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
275 |
lemma complex_of_real_inverse: |
14374 | 276 |
"complex_of_real(inverse x) = inverse(complex_of_real x)" |
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
277 |
by (rule of_real_inverse) |
14323 | 278 |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
279 |
lemma complex_of_real_divide: |
15013 | 280 |
"complex_of_real(x/y) = complex_of_real x / complex_of_real y" |
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
281 |
by (rule of_real_divide) |
14323 | 282 |
|
283 |
||
14377 | 284 |
subsection{*The Functions @{term Re} and @{term Im}*} |
285 |
||
286 |
lemma complex_Re_mult_eq: "Re (w * z) = Re w * Re z - Im w * Im z" |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
287 |
by (induct z, induct w, simp) |
14377 | 288 |
|
289 |
lemma complex_Im_mult_eq: "Im (w * z) = Re w * Im z + Im w * Re z" |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
290 |
by (induct z, induct w, simp) |
14377 | 291 |
|
292 |
lemma Re_i_times [simp]: "Re(ii * z) = - Im z" |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
293 |
by (simp add: complex_Re_mult_eq) |
14377 | 294 |
|
295 |
lemma Re_times_i [simp]: "Re(z * ii) = - Im z" |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
296 |
by (simp add: complex_Re_mult_eq) |
14377 | 297 |
|
298 |
lemma Im_i_times [simp]: "Im(ii * z) = Re z" |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
299 |
by (simp add: complex_Im_mult_eq) |
14377 | 300 |
|
301 |
lemma Im_times_i [simp]: "Im(z * ii) = Re z" |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
302 |
by (simp add: complex_Im_mult_eq) |
14377 | 303 |
|
304 |
lemma complex_Re_mult: "[| Im w = 0; Im z = 0 |] ==> Re(w * z) = Re(w) * Re(z)" |
|
305 |
by (simp add: complex_Re_mult_eq) |
|
306 |
||
307 |
lemma complex_Re_mult_complex_of_real [simp]: |
|
308 |
"Re (z * complex_of_real c) = Re(z) * c" |
|
309 |
by (simp add: complex_Re_mult_eq) |
|
310 |
||
311 |
lemma complex_Im_mult_complex_of_real [simp]: |
|
312 |
"Im (z * complex_of_real c) = Im(z) * c" |
|
313 |
by (simp add: complex_Im_mult_eq) |
|
314 |
||
315 |
lemma complex_Re_mult_complex_of_real2 [simp]: |
|
316 |
"Re (complex_of_real c * z) = c * Re(z)" |
|
317 |
by (simp add: complex_Re_mult_eq) |
|
318 |
||
319 |
lemma complex_Im_mult_complex_of_real2 [simp]: |
|
320 |
"Im (complex_of_real c * z) = c * Im(z)" |
|
321 |
by (simp add: complex_Im_mult_eq) |
|
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
322 |
|
14377 | 323 |
|
14323 | 324 |
subsection{*Conjugation is an Automorphism*} |
325 |
||
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
326 |
definition |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20763
diff
changeset
|
327 |
cnj :: "complex => complex" where |
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
328 |
"cnj z = Complex (Re z) (-Im z)" |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
329 |
|
14373 | 330 |
lemma complex_cnj: "cnj (Complex x y) = Complex x (-y)" |
331 |
by (simp add: cnj_def) |
|
14323 | 332 |
|
14374 | 333 |
lemma complex_cnj_cancel_iff [simp]: "(cnj x = cnj y) = (x = y)" |
14373 | 334 |
by (simp add: cnj_def complex_Re_Im_cancel_iff) |
14323 | 335 |
|
14374 | 336 |
lemma complex_cnj_cnj [simp]: "cnj (cnj z) = z" |
14373 | 337 |
by (simp add: cnj_def) |
14323 | 338 |
|
14374 | 339 |
lemma complex_cnj_complex_of_real [simp]: |
14373 | 340 |
"cnj (complex_of_real x) = complex_of_real x" |
341 |
by (simp add: complex_of_real_def complex_cnj) |
|
14323 | 342 |
|
343 |
lemma complex_cnj_minus: "cnj (-z) = - cnj z" |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
344 |
by (simp add: cnj_def) |
14323 | 345 |
|
346 |
lemma complex_cnj_inverse: "cnj(inverse z) = inverse(cnj z)" |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
347 |
by (induct z, simp add: complex_cnj power2_eq_square) |
14323 | 348 |
|
349 |
lemma complex_cnj_add: "cnj(w + z) = cnj(w) + cnj(z)" |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
350 |
by (induct w, induct z, simp add: complex_cnj) |
14323 | 351 |
|
352 |
lemma complex_cnj_diff: "cnj(w - z) = cnj(w) - cnj(z)" |
|
15013 | 353 |
by (simp add: diff_minus complex_cnj_add complex_cnj_minus) |
14323 | 354 |
|
355 |
lemma complex_cnj_mult: "cnj(w * z) = cnj(w) * cnj(z)" |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
356 |
by (induct w, induct z, simp add: complex_cnj) |
14323 | 357 |
|
358 |
lemma complex_cnj_divide: "cnj(w / z) = (cnj w)/(cnj z)" |
|
14373 | 359 |
by (simp add: complex_divide_def complex_cnj_mult complex_cnj_inverse) |
14323 | 360 |
|
14374 | 361 |
lemma complex_cnj_one [simp]: "cnj 1 = 1" |
14373 | 362 |
by (simp add: cnj_def complex_one_def) |
14323 | 363 |
|
364 |
lemma complex_add_cnj: "z + cnj z = complex_of_real (2 * Re(z))" |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
365 |
by (induct z, simp add: complex_cnj complex_of_real_def) |
14323 | 366 |
|
367 |
lemma complex_diff_cnj: "z - cnj z = complex_of_real (2 * Im(z)) * ii" |
|
14373 | 368 |
apply (induct z) |
15013 | 369 |
apply (simp add: complex_add complex_cnj complex_of_real_def diff_minus |
14354
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
370 |
complex_minus i_def complex_mult) |
14323 | 371 |
done |
372 |
||
14354
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
373 |
lemma complex_cnj_zero [simp]: "cnj 0 = 0" |
14334 | 374 |
by (simp add: cnj_def complex_zero_def) |
14323 | 375 |
|
14374 | 376 |
lemma complex_cnj_zero_iff [iff]: "(cnj z = 0) = (z = 0)" |
14373 | 377 |
by (induct z, simp add: complex_zero_def complex_cnj) |
14323 | 378 |
|
379 |
lemma complex_mult_cnj: "z * cnj z = complex_of_real (Re(z) ^ 2 + Im(z) ^ 2)" |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
380 |
by (induct z, simp add: complex_cnj complex_of_real_def power2_eq_square) |
14323 | 381 |
|
382 |
||
383 |
subsection{*Modulus*} |
|
384 |
||
22861
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
385 |
instance complex :: norm |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
386 |
complex_norm_def: "norm z \<equiv> sqrt ((Re z)\<twosuperior> + (Im z)\<twosuperior>)" .. |
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
387 |
|
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
388 |
abbreviation |
22861
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
389 |
cmod :: "complex \<Rightarrow> real" where |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
390 |
"cmod \<equiv> norm" |
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
391 |
|
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
392 |
lemmas cmod_def = complex_norm_def |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
393 |
|
22861
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
394 |
lemma complex_mod [simp]: "cmod (Complex x y) = sqrt (x\<twosuperior> + y\<twosuperior>)" |
14373 | 395 |
by (simp add: cmod_def) |
14323 | 396 |
|
22861
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
397 |
lemma complex_mod_triangle_ineq [simp]: "cmod (x + y) \<le> cmod x + cmod y" |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
398 |
apply (simp add: cmod_def) |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
399 |
apply (rule real_sqrt_sum_squares_triangle_ineq) |
14323 | 400 |
done |
401 |
||
22861
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
402 |
lemma complex_mod_mult: "cmod (x * y) = cmod x * cmod y" |
14373 | 403 |
apply (induct x, induct y) |
22861
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
404 |
apply (simp add: real_sqrt_mult_distrib [symmetric]) |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
405 |
apply (rule_tac f=sqrt in arg_cong) |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
406 |
apply (simp add: power2_sum power2_diff power_mult_distrib ring_distrib) |
14323 | 407 |
done |
408 |
||
22861
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
409 |
lemma complex_mod_complex_of_real: "cmod (complex_of_real x) = \<bar>x\<bar>" |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
410 |
by (simp add: complex_of_real_def) |
14323 | 411 |
|
22852 | 412 |
lemma complex_norm_scaleR: |
413 |
"norm (scaleR a x) = \<bar>a\<bar> * norm (x::complex)" |
|
22861
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
414 |
unfolding scaleR_conv_of_real |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
415 |
by (simp only: complex_mod_mult complex_mod_complex_of_real) |
22852 | 416 |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
417 |
instance complex :: real_normed_field |
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
418 |
proof |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
419 |
fix r :: real |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
420 |
fix x y :: complex |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
421 |
show "0 \<le> cmod x" |
22861
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
422 |
by (induct x) simp |
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
423 |
show "(cmod x = 0) = (x = 0)" |
22861
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
424 |
by (induct x) simp |
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
425 |
show "cmod (x + y) \<le> cmod x + cmod y" |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
426 |
by (rule complex_mod_triangle_ineq) |
22852 | 427 |
show "cmod (scaleR r x) = \<bar>r\<bar> * cmod x" |
428 |
by (rule complex_norm_scaleR) |
|
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
429 |
show "cmod (x * y) = cmod x * cmod y" |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
430 |
by (rule complex_mod_mult) |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
431 |
qed |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
432 |
|
22861
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
433 |
lemma complex_mod_cnj [simp]: "cmod (cnj z) = cmod z" |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
434 |
by (induct z, simp add: complex_cnj) |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
435 |
|
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
436 |
lemma complex_mod_mult_cnj: "cmod (z * cnj z) = (cmod z)\<twosuperior>" |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
437 |
by (simp add: complex_mod_mult power2_eq_square) |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
438 |
|
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
439 |
lemma cmod_unit_one [simp]: "cmod (Complex (cos a) (sin a)) = 1" |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
440 |
by simp |
14323 | 441 |
|
22861
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
442 |
lemma cmod_complex_polar [simp]: |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
443 |
"cmod (complex_of_real r * Complex (cos a) (sin a)) = abs r" |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
444 |
apply (simp only: cmod_unit_one complex_mod_mult) |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
445 |
apply (simp add: complex_mod_complex_of_real) |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
446 |
done |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
447 |
|
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
448 |
lemma complex_Re_le_cmod: "Re x \<le> cmod x" |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
449 |
unfolding complex_norm_def |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
450 |
by (rule real_sqrt_sum_squares_ge1) |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
451 |
|
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
452 |
lemma complex_mod_minus_le_complex_mod [simp]: "- cmod x \<le> cmod x" |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
453 |
by (rule order_trans [OF _ norm_ge_zero], simp) |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
454 |
|
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
455 |
lemma complex_mod_triangle_ineq2 [simp]: "cmod(b + a) - cmod b \<le> cmod a" |
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
456 |
by (rule ord_le_eq_trans [OF norm_triangle_ineq2], simp) |
14323 | 457 |
|
14374 | 458 |
lemma complex_mod_add_less: |
459 |
"[| cmod x < r; cmod y < s |] ==> cmod (x + y) < r + s" |
|
14334 | 460 |
by (auto intro: order_le_less_trans complex_mod_triangle_ineq) |
14323 | 461 |
|
14374 | 462 |
lemma complex_mod_mult_less: |
463 |
"[| cmod x < r; cmod y < s |] ==> cmod (x * y) < r * s" |
|
14334 | 464 |
by (auto intro: real_mult_less_mono' simp add: complex_mod_mult) |
14323 | 465 |
|
14374 | 466 |
lemma complex_mod_diff_ineq [simp]: "cmod(a) - cmod(b) \<le> cmod(a + b)" |
22861
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
467 |
(* TODO: generalize *) |
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
468 |
proof - |
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
469 |
have "cmod a - cmod b = cmod a - cmod (- b)" by simp |
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
470 |
also have "\<dots> \<le> cmod (a - - b)" by (rule norm_triangle_ineq2) |
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
471 |
also have "\<dots> = cmod (a + b)" by simp |
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
472 |
finally show ?thesis . |
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
473 |
qed |
14323 | 474 |
|
22861
8ec47039614e
clean up complex norm proofs, remove redundant lemmas
huffman
parents:
22852
diff
changeset
|
475 |
lemmas real_sum_squared_expand = power2_sum [where 'a=real] |
14323 | 476 |
|
14354
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
477 |
|
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
478 |
subsection{*Exponentiation*} |
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
479 |
|
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
480 |
primrec |
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
481 |
complexpow_0: "z ^ 0 = 1" |
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
482 |
complexpow_Suc: "z ^ (Suc n) = (z::complex) * (z ^ n)" |
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
483 |
|
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
484 |
|
15003 | 485 |
instance complex :: recpower |
14354
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
486 |
proof |
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
487 |
fix z :: complex |
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
488 |
fix n :: nat |
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
489 |
show "z^0 = 1" by simp |
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
490 |
show "z^(Suc n) = z * (z^n)" by simp |
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
491 |
qed |
14323 | 492 |
|
493 |
||
14354
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
494 |
lemma complex_of_real_pow: "complex_of_real (x ^ n) = (complex_of_real x) ^ n" |
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
495 |
by (rule of_real_power) |
14323 | 496 |
|
14354
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
497 |
lemma complex_cnj_pow: "cnj(z ^ n) = cnj(z) ^ n" |
14323 | 498 |
apply (induct_tac "n") |
14354
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
499 |
apply (auto simp add: complex_cnj_mult) |
14323 | 500 |
done |
501 |
||
14354
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
502 |
lemma complex_mod_complexpow: "cmod(x ^ n) = cmod(x) ^ n" |
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
503 |
by (rule norm_power) |
14354
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
504 |
|
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
505 |
lemma complexpow_i_squared [simp]: "ii ^ 2 = -(1::complex)" |
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
506 |
by (simp add: i_def complex_one_def numeral_2_eq_2) |
14354
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
507 |
|
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
508 |
lemma complex_i_not_zero [simp]: "ii \<noteq> 0" |
14373 | 509 |
by (simp add: i_def complex_zero_def) |
14354
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
510 |
|
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
511 |
|
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
512 |
subsection{*The Function @{term sgn}*} |
14323 | 513 |
|
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
514 |
definition |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
515 |
(*------------ Argand -------------*) |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
516 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20763
diff
changeset
|
517 |
sgn :: "complex => complex" where |
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
518 |
"sgn z = z / complex_of_real(cmod z)" |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
519 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20763
diff
changeset
|
520 |
definition |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20763
diff
changeset
|
521 |
arg :: "complex => real" where |
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
522 |
"arg z = (SOME a. Re(sgn z) = cos a & Im(sgn z) = sin a & -pi < a & a \<le> pi)" |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
523 |
|
14374 | 524 |
lemma sgn_zero [simp]: "sgn 0 = 0" |
14373 | 525 |
by (simp add: sgn_def) |
14323 | 526 |
|
14374 | 527 |
lemma sgn_one [simp]: "sgn 1 = 1" |
14373 | 528 |
by (simp add: sgn_def) |
14323 | 529 |
|
530 |
lemma sgn_minus: "sgn (-z) = - sgn(z)" |
|
14373 | 531 |
by (simp add: sgn_def) |
14323 | 532 |
|
14374 | 533 |
lemma sgn_eq: "sgn z = z / complex_of_real (cmod z)" |
14377 | 534 |
by (simp add: sgn_def) |
14323 | 535 |
|
536 |
lemma i_mult_eq: "ii * ii = complex_of_real (-1)" |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
537 |
by (simp add: i_def complex_of_real_def) |
14323 | 538 |
|
14374 | 539 |
lemma i_mult_eq2 [simp]: "ii * ii = -(1::complex)" |
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
540 |
by (simp add: i_def complex_one_def) |
14323 | 541 |
|
14374 | 542 |
lemma complex_eq_cancel_iff2 [simp]: |
14377 | 543 |
"(Complex x y = complex_of_real xa) = (x = xa & y = 0)" |
544 |
by (simp add: complex_of_real_def) |
|
14323 | 545 |
|
14377 | 546 |
lemma Complex_eq_0 [simp]: "(Complex x y = 0) = (x = 0 & y = 0)" |
547 |
by (simp add: complex_zero_def) |
|
14323 | 548 |
|
14377 | 549 |
lemma Complex_eq_1 [simp]: "(Complex x y = 1) = (x = 1 & y = 0)" |
550 |
by (simp add: complex_one_def) |
|
14323 | 551 |
|
14377 | 552 |
lemma Complex_eq_i [simp]: "(Complex x y = ii) = (x = 0 & y = 1)" |
553 |
by (simp add: i_def) |
|
14323 | 554 |
|
15013 | 555 |
|
556 |
||
14374 | 557 |
lemma Re_sgn [simp]: "Re(sgn z) = Re(z)/cmod z" |
15013 | 558 |
proof (induct z) |
559 |
case (Complex x y) |
|
560 |
have "sqrt (x\<twosuperior> + y\<twosuperior>) * inverse (x\<twosuperior> + y\<twosuperior>) = inverse (sqrt (x\<twosuperior> + y\<twosuperior>))" |
|
561 |
by (simp add: divide_inverse [symmetric] sqrt_divide_self_eq) |
|
562 |
thus "Re (sgn (Complex x y)) = Re (Complex x y) /cmod (Complex x y)" |
|
563 |
by (simp add: sgn_def complex_of_real_def divide_inverse) |
|
564 |
qed |
|
565 |
||
14323 | 566 |
|
14374 | 567 |
lemma Im_sgn [simp]: "Im(sgn z) = Im(z)/cmod z" |
15013 | 568 |
proof (induct z) |
569 |
case (Complex x y) |
|
570 |
have "sqrt (x\<twosuperior> + y\<twosuperior>) * inverse (x\<twosuperior> + y\<twosuperior>) = inverse (sqrt (x\<twosuperior> + y\<twosuperior>))" |
|
571 |
by (simp add: divide_inverse [symmetric] sqrt_divide_self_eq) |
|
572 |
thus "Im (sgn (Complex x y)) = Im (Complex x y) /cmod (Complex x y)" |
|
573 |
by (simp add: sgn_def complex_of_real_def divide_inverse) |
|
574 |
qed |
|
14323 | 575 |
|
576 |
lemma complex_inverse_complex_split: |
|
577 |
"inverse(complex_of_real x + ii * complex_of_real y) = |
|
578 |
complex_of_real(x/(x ^ 2 + y ^ 2)) - |
|
579 |
ii * complex_of_real(y/(x ^ 2 + y ^ 2))" |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
580 |
by (simp add: complex_of_real_def i_def diff_minus divide_inverse) |
14323 | 581 |
|
582 |
(*----------------------------------------------------------------------------*) |
|
583 |
(* Many of the theorems below need to be moved elsewhere e.g. Transc. Also *) |
|
584 |
(* many of the theorems are not used - so should they be kept? *) |
|
585 |
(*----------------------------------------------------------------------------*) |
|
586 |
||
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
587 |
lemma complex_of_real_zero_iff: "(complex_of_real y = 0) = (y = 0)" |
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
588 |
by (rule of_real_eq_0_iff) |
14354
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
589 |
|
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
590 |
lemma cos_arg_i_mult_zero_pos: |
14377 | 591 |
"0 < y ==> cos (arg(Complex 0 y)) = 0" |
14373 | 592 |
apply (simp add: arg_def abs_if) |
14334 | 593 |
apply (rule_tac a = "pi/2" in someI2, auto) |
594 |
apply (rule order_less_trans [of _ 0], auto) |
|
14323 | 595 |
done |
596 |
||
14354
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
597 |
lemma cos_arg_i_mult_zero_neg: |
14377 | 598 |
"y < 0 ==> cos (arg(Complex 0 y)) = 0" |
14373 | 599 |
apply (simp add: arg_def abs_if) |
14334 | 600 |
apply (rule_tac a = "- pi/2" in someI2, auto) |
601 |
apply (rule order_trans [of _ 0], auto) |
|
14323 | 602 |
done |
603 |
||
14374 | 604 |
lemma cos_arg_i_mult_zero [simp]: |
14377 | 605 |
"y \<noteq> 0 ==> cos (arg(Complex 0 y)) = 0" |
606 |
by (auto simp add: linorder_neq_iff cos_arg_i_mult_zero_pos cos_arg_i_mult_zero_neg) |
|
14323 | 607 |
|
608 |
||
609 |
subsection{*Finally! Polar Form for Complex Numbers*} |
|
610 |
||
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
611 |
definition |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
612 |
|
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
613 |
(* abbreviation for (cos a + i sin a) *) |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20763
diff
changeset
|
614 |
cis :: "real => complex" where |
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
615 |
"cis a = Complex (cos a) (sin a)" |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
616 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20763
diff
changeset
|
617 |
definition |
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
618 |
(* abbreviation for r*(cos a + i sin a) *) |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20763
diff
changeset
|
619 |
rcis :: "[real, real] => complex" where |
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
620 |
"rcis r a = complex_of_real r * cis a" |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
621 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20763
diff
changeset
|
622 |
definition |
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
623 |
(* e ^ (x + iy) *) |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20763
diff
changeset
|
624 |
expi :: "complex => complex" where |
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
625 |
"expi z = complex_of_real(exp (Re z)) * cis (Im z)" |
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
626 |
|
14374 | 627 |
lemma complex_split_polar: |
14377 | 628 |
"\<exists>r a. z = complex_of_real r * (Complex (cos a) (sin a))" |
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
629 |
apply (induct z) |
14377 | 630 |
apply (auto simp add: polar_Ex complex_of_real_mult_Complex) |
14323 | 631 |
done |
632 |
||
14354
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
633 |
lemma rcis_Ex: "\<exists>r a. z = rcis r a" |
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
634 |
apply (induct z) |
14377 | 635 |
apply (simp add: rcis_def cis_def polar_Ex complex_of_real_mult_Complex) |
14323 | 636 |
done |
637 |
||
14374 | 638 |
lemma Re_rcis [simp]: "Re(rcis r a) = r * cos a" |
14373 | 639 |
by (simp add: rcis_def cis_def) |
14323 | 640 |
|
14348
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset
|
641 |
lemma Im_rcis [simp]: "Im(rcis r a) = r * sin a" |
14373 | 642 |
by (simp add: rcis_def cis_def) |
14323 | 643 |
|
14377 | 644 |
lemma sin_cos_squared_add2_mult: "(r * cos a)\<twosuperior> + (r * sin a)\<twosuperior> = r\<twosuperior>" |
645 |
proof - |
|
646 |
have "(r * cos a)\<twosuperior> + (r * sin a)\<twosuperior> = r\<twosuperior> * ((cos a)\<twosuperior> + (sin a)\<twosuperior>)" |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
647 |
by (simp only: power_mult_distrib right_distrib) |
14377 | 648 |
thus ?thesis by simp |
649 |
qed |
|
14323 | 650 |
|
14374 | 651 |
lemma complex_mod_rcis [simp]: "cmod(rcis r a) = abs r" |
14377 | 652 |
by (simp add: rcis_def cis_def sin_cos_squared_add2_mult) |
14323 | 653 |
|
654 |
lemma complex_mod_sqrt_Re_mult_cnj: "cmod z = sqrt (Re (z * cnj z))" |
|
14373 | 655 |
apply (simp add: cmod_def) |
14323 | 656 |
apply (rule real_sqrt_eq_iff [THEN iffD2]) |
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
657 |
apply (auto simp add: complex_mult_cnj |
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
658 |
simp del: of_real_add) |
14323 | 659 |
done |
660 |
||
14374 | 661 |
lemma complex_Re_cnj [simp]: "Re(cnj z) = Re z" |
14373 | 662 |
by (induct z, simp add: complex_cnj) |
14323 | 663 |
|
14374 | 664 |
lemma complex_Im_cnj [simp]: "Im(cnj z) = - Im z" |
665 |
by (induct z, simp add: complex_cnj) |
|
666 |
||
667 |
lemma complex_In_mult_cnj_zero [simp]: "Im (z * cnj z) = 0" |
|
14373 | 668 |
by (induct z, simp add: complex_cnj complex_mult) |
14323 | 669 |
|
670 |
||
671 |
(*---------------------------------------------------------------------------*) |
|
672 |
(* (r1 * cis a) * (r2 * cis b) = r1 * r2 * cis (a + b) *) |
|
673 |
(*---------------------------------------------------------------------------*) |
|
674 |
||
675 |
lemma cis_rcis_eq: "cis a = rcis 1 a" |
|
14373 | 676 |
by (simp add: rcis_def) |
14323 | 677 |
|
14374 | 678 |
lemma rcis_mult: "rcis r1 a * rcis r2 b = rcis (r1*r2) (a + b)" |
15013 | 679 |
by (simp add: rcis_def cis_def cos_add sin_add right_distrib right_diff_distrib |
680 |
complex_of_real_def) |
|
14323 | 681 |
|
682 |
lemma cis_mult: "cis a * cis b = cis (a + b)" |
|
14373 | 683 |
by (simp add: cis_rcis_eq rcis_mult) |
14323 | 684 |
|
14374 | 685 |
lemma cis_zero [simp]: "cis 0 = 1" |
14377 | 686 |
by (simp add: cis_def complex_one_def) |
14323 | 687 |
|
14374 | 688 |
lemma rcis_zero_mod [simp]: "rcis 0 a = 0" |
14373 | 689 |
by (simp add: rcis_def) |
14323 | 690 |
|
14374 | 691 |
lemma rcis_zero_arg [simp]: "rcis r 0 = complex_of_real r" |
14373 | 692 |
by (simp add: rcis_def) |
14323 | 693 |
|
694 |
lemma complex_of_real_minus_one: |
|
695 |
"complex_of_real (-(1::real)) = -(1::complex)" |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
696 |
by (simp add: complex_of_real_def complex_one_def) |
14323 | 697 |
|
14374 | 698 |
lemma complex_i_mult_minus [simp]: "ii * (ii * x) = - x" |
14373 | 699 |
by (simp add: complex_mult_assoc [symmetric]) |
14323 | 700 |
|
701 |
||
702 |
lemma cis_real_of_nat_Suc_mult: |
|
703 |
"cis (real (Suc n) * a) = cis a * cis (real n * a)" |
|
14377 | 704 |
by (simp add: cis_def real_of_nat_Suc left_distrib cos_add sin_add right_distrib) |
14323 | 705 |
|
706 |
lemma DeMoivre: "(cis a) ^ n = cis (real n * a)" |
|
707 |
apply (induct_tac "n") |
|
708 |
apply (auto simp add: cis_real_of_nat_Suc_mult) |
|
709 |
done |
|
710 |
||
14374 | 711 |
lemma DeMoivre2: "(rcis r a) ^ n = rcis (r ^ n) (real n * a)" |
712 |
by (simp add: rcis_def power_mult_distrib DeMoivre complex_of_real_pow) |
|
14323 | 713 |
|
14374 | 714 |
lemma cis_inverse [simp]: "inverse(cis a) = cis (-a)" |
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
715 |
by (simp add: cis_def complex_inverse_complex_split diff_minus) |
14323 | 716 |
|
717 |
lemma rcis_inverse: "inverse(rcis r a) = rcis (1/r) (-a)" |
|
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
718 |
by (simp add: divide_inverse rcis_def complex_of_real_inverse) |
14323 | 719 |
|
720 |
lemma cis_divide: "cis a / cis b = cis (a - b)" |
|
14373 | 721 |
by (simp add: complex_divide_def cis_mult real_diff_def) |
14323 | 722 |
|
14354
988aa4648597
types complex and hcomplex are now instances of class ringpower:
paulson
parents:
14353
diff
changeset
|
723 |
lemma rcis_divide: "rcis r1 a / rcis r2 b = rcis (r1/r2) (a - b)" |
14373 | 724 |
apply (simp add: complex_divide_def) |
725 |
apply (case_tac "r2=0", simp) |
|
726 |
apply (simp add: rcis_inverse rcis_mult real_diff_def) |
|
14323 | 727 |
done |
728 |
||
14374 | 729 |
lemma Re_cis [simp]: "Re(cis a) = cos a" |
14373 | 730 |
by (simp add: cis_def) |
14323 | 731 |
|
14374 | 732 |
lemma Im_cis [simp]: "Im(cis a) = sin a" |
14373 | 733 |
by (simp add: cis_def) |
14323 | 734 |
|
735 |
lemma cos_n_Re_cis_pow_n: "cos (real n * a) = Re(cis a ^ n)" |
|
14334 | 736 |
by (auto simp add: DeMoivre) |
14323 | 737 |
|
738 |
lemma sin_n_Im_cis_pow_n: "sin (real n * a) = Im(cis a ^ n)" |
|
14334 | 739 |
by (auto simp add: DeMoivre) |
14323 | 740 |
|
741 |
lemma expi_add: "expi(a + b) = expi(a) * expi(b)" |
|
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
742 |
by (simp add: expi_def exp_add cis_mult [symmetric] mult_ac) |
14323 | 743 |
|
14374 | 744 |
lemma expi_zero [simp]: "expi (0::complex) = 1" |
14373 | 745 |
by (simp add: expi_def) |
14323 | 746 |
|
14374 | 747 |
lemma complex_expi_Ex: "\<exists>a r. z = complex_of_real r * expi a" |
14373 | 748 |
apply (insert rcis_Ex [of z]) |
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
749 |
apply (auto simp add: expi_def rcis_def complex_mult_assoc [symmetric] of_real_mult) |
14334 | 750 |
apply (rule_tac x = "ii * complex_of_real a" in exI, auto) |
14323 | 751 |
done |
752 |
||
753 |
||
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
754 |
subsection{*Numerals and Arithmetic*} |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
755 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
756 |
instance complex :: number .. |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
757 |
|
15013 | 758 |
defs (overloaded) |
20485 | 759 |
complex_number_of_def: "(number_of w :: complex) == of_int w" |
15013 | 760 |
--{*the type constraint is essential!*} |
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
761 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
762 |
instance complex :: number_ring |
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
763 |
by (intro_classes, simp add: complex_number_of_def) |
15013 | 764 |
|
765 |
||
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
766 |
text{*Collapse applications of @{term complex_of_real} to @{term number_of}*} |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
767 |
lemma complex_number_of [simp]: "complex_of_real (number_of w) = number_of w" |
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
768 |
by (rule of_real_number_of_eq) |
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
769 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
770 |
text{*This theorem is necessary because theorems such as |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
771 |
@{text iszero_number_of_0} only hold for ordered rings. They cannot |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
772 |
be generalized to fields in general because they fail for finite fields. |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
773 |
They work for type complex because the reals can be embedded in them.*} |
20557
81dd3679f92c
complex_of_real abbreviates of_real::real=>complex;
huffman
parents:
20556
diff
changeset
|
774 |
(* TODO: generalize and move to Real/RealVector.thy *) |
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
775 |
lemma iszero_complex_number_of [simp]: |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
776 |
"iszero (number_of w :: complex) = iszero (number_of w :: real)" |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
777 |
by (simp only: complex_of_real_zero_iff complex_number_of [symmetric] |
20725
72e20198f834
instance complex :: real_normed_field; cleaned up
huffman
parents:
20560
diff
changeset
|
778 |
iszero_def) |
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
779 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
780 |
lemma complex_number_of_cnj [simp]: "cnj(number_of v :: complex) = number_of v" |
15481 | 781 |
by (simp only: complex_number_of [symmetric] complex_cnj_complex_of_real) |
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
782 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
783 |
lemma complex_number_of_cmod: |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
784 |
"cmod(number_of v :: complex) = abs (number_of v :: real)" |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
785 |
by (simp only: complex_number_of [symmetric] complex_mod_complex_of_real) |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
786 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
787 |
lemma complex_number_of_Re [simp]: "Re(number_of v :: complex) = number_of v" |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
788 |
by (simp only: complex_number_of [symmetric] Re_complex_of_real) |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
789 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
790 |
lemma complex_number_of_Im [simp]: "Im(number_of v :: complex) = 0" |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
791 |
by (simp only: complex_number_of [symmetric] Im_complex_of_real) |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
792 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
793 |
lemma expi_two_pi_i [simp]: "expi((2::complex) * complex_of_real pi * ii) = 1" |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
794 |
by (simp add: expi_def complex_Re_mult_eq complex_Im_mult_eq cis_def) |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
795 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
796 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
797 |
(*examples: |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
798 |
print_depth 22 |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
799 |
set timing; |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
800 |
set trace_simp; |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
801 |
fun test s = (Goal s, by (Simp_tac 1)); |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
802 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
803 |
test "23 * ii + 45 * ii= (x::complex)"; |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
804 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
805 |
test "5 * ii + 12 - 45 * ii= (x::complex)"; |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
806 |
test "5 * ii + 40 - 12 * ii + 9 = (x::complex) + 89 * ii"; |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
807 |
test "5 * ii + 40 - 12 * ii + 9 - 78 = (x::complex) + 89 * ii"; |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
808 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
809 |
test "l + 10 * ii + 90 + 3*l + 9 + 45 * ii= (x::complex)"; |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
810 |
test "87 + 10 * ii + 90 + 3*7 + 9 + 45 * ii= (x::complex)"; |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
811 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
812 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
813 |
fun test s = (Goal s; by (Asm_simp_tac 1)); |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
814 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
815 |
test "x*k = k*(y::complex)"; |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
816 |
test "k = k*(y::complex)"; |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
817 |
test "a*(b*c) = (b::complex)"; |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
818 |
test "a*(b*c) = d*(b::complex)*(x*a)"; |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
819 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
820 |
|
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
821 |
test "(x*k) / (k*(y::complex)) = (uu::complex)"; |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
822 |
test "(k) / (k*(y::complex)) = (uu::complex)"; |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
823 |
test "(a*(b*c)) / ((b::complex)) = (uu::complex)"; |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
824 |
test "(a*(b*c)) / (d*(b::complex)*(x*a)) = (uu::complex)"; |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
825 |
|
15003 | 826 |
FIXME: what do we do about this? |
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
827 |
test "a*(b*c)/(y*z) = d*(b::complex)*(x*a)/z"; |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
828 |
*) |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
829 |
|
13957 | 830 |
end |