src/HOL/Complex/Complex.thy
author paulson
Sun Feb 15 10:46:37 2004 +0100 (2004-02-15)
changeset 14387 e96d5c42c4b0
parent 14377 f454b3004f8f
child 14421 ee97b6463cb4
permissions -rw-r--r--
Polymorphic treatment of binary arithmetic using axclasses
paulson@13957
     1
(*  Title:       Complex.thy
paulson@13957
     2
    Author:      Jacques D. Fleuriot
paulson@13957
     3
    Copyright:   2001 University of Edinburgh
paulson@14387
     4
    Conversion to Isar and new proofs by Lawrence C Paulson, 2003/4
paulson@13957
     5
*)
paulson@13957
     6
paulson@14377
     7
header {* Complex Numbers: Rectangular and Polar Representations *}
paulson@14373
     8
paulson@14323
     9
theory Complex = HLog:
paulson@13957
    10
paulson@14373
    11
datatype complex = Complex real real
paulson@13957
    12
paulson@14323
    13
instance complex :: zero ..
paulson@14323
    14
instance complex :: one ..
paulson@14323
    15
instance complex :: plus ..
paulson@14323
    16
instance complex :: times ..
paulson@14323
    17
instance complex :: minus ..
paulson@14323
    18
instance complex :: inverse ..
paulson@14323
    19
instance complex :: power ..
paulson@13957
    20
paulson@13957
    21
consts
paulson@14373
    22
  "ii"    :: complex    ("\<i>")
paulson@14373
    23
paulson@14373
    24
consts Re :: "complex => real"
paulson@14373
    25
primrec "Re (Complex x y) = x"
paulson@14373
    26
paulson@14373
    27
consts Im :: "complex => real"
paulson@14373
    28
primrec "Im (Complex x y) = y"
paulson@14373
    29
paulson@14373
    30
lemma complex_surj [simp]: "Complex (Re z) (Im z) = z"
paulson@14373
    31
  by (induct z) simp
paulson@13957
    32
paulson@13957
    33
constdefs
paulson@13957
    34
paulson@13957
    35
  (*----------- modulus ------------*)
paulson@13957
    36
paulson@14323
    37
  cmod :: "complex => real"
paulson@14323
    38
  "cmod z == sqrt(Re(z) ^ 2 + Im(z) ^ 2)"
paulson@13957
    39
paulson@14323
    40
  (*----- injection from reals -----*)
paulson@14323
    41
paulson@14323
    42
  complex_of_real :: "real => complex"
paulson@14373
    43
  "complex_of_real r == Complex r 0"
paulson@14323
    44
paulson@13957
    45
  (*------- complex conjugate ------*)
paulson@13957
    46
paulson@14323
    47
  cnj :: "complex => complex"
paulson@14373
    48
  "cnj z == Complex (Re z) (-Im z)"
paulson@13957
    49
paulson@14323
    50
  (*------------ Argand -------------*)
paulson@13957
    51
paulson@14323
    52
  sgn :: "complex => complex"
paulson@13957
    53
  "sgn z == z / complex_of_real(cmod z)"
paulson@13957
    54
paulson@14323
    55
  arg :: "complex => real"
paulson@14354
    56
  "arg z == @a. Re(sgn z) = cos a & Im(sgn z) = sin a & -pi < a & a \<le> pi"
paulson@14323
    57
paulson@13957
    58
paulson@14323
    59
defs (overloaded)
paulson@14323
    60
paulson@14323
    61
  complex_zero_def:
paulson@14373
    62
  "0 == Complex 0 0"
paulson@13957
    63
paulson@14323
    64
  complex_one_def:
paulson@14373
    65
  "1 == Complex 1 0"
paulson@14323
    66
paulson@14373
    67
  i_def: "ii == Complex 0 1"
paulson@14323
    68
paulson@14373
    69
  complex_minus_def: "- z == Complex (- Re z) (- Im z)"
paulson@14323
    70
paulson@14323
    71
  complex_inverse_def:
paulson@14373
    72
   "inverse z ==
paulson@14373
    73
    Complex (Re z / ((Re z)\<twosuperior> + (Im z)\<twosuperior>)) (- Im z / ((Re z)\<twosuperior> + (Im z)\<twosuperior>))"
paulson@13957
    74
paulson@14323
    75
  complex_add_def:
paulson@14373
    76
    "z + w == Complex (Re z + Re w) (Im z + Im w)"
paulson@13957
    77
paulson@14323
    78
  complex_diff_def:
paulson@14373
    79
    "z - w == z + - (w::complex)"
paulson@13957
    80
paulson@14374
    81
  complex_mult_def:
paulson@14373
    82
    "z * w == Complex (Re z * Re w - Im z * Im w) (Re z * Im w + Im z * Re w)"
paulson@13957
    83
paulson@14373
    84
  complex_divide_def: "w / (z::complex) == w * inverse z"
paulson@14323
    85
paulson@13957
    86
paulson@13957
    87
constdefs
paulson@13957
    88
paulson@13957
    89
  (* abbreviation for (cos a + i sin a) *)
paulson@14323
    90
  cis :: "real => complex"
paulson@14377
    91
  "cis a == Complex (cos a) (sin a)"
paulson@13957
    92
paulson@13957
    93
  (* abbreviation for r*(cos a + i sin a) *)
paulson@14323
    94
  rcis :: "[real, real] => complex"
paulson@13957
    95
  "rcis r a == complex_of_real r * cis a"
paulson@13957
    96
paulson@13957
    97
  (* e ^ (x + iy) *)
paulson@14323
    98
  expi :: "complex => complex"
paulson@13957
    99
  "expi z == complex_of_real(exp (Re z)) * cis (Im z)"
paulson@14323
   100
paulson@14323
   101
paulson@14373
   102
lemma complex_equality [intro?]: "Re z = Re w ==> Im z = Im w ==> z = w"
paulson@14373
   103
  by (induct z, induct w) simp
paulson@14323
   104
paulson@14374
   105
lemma Re [simp]: "Re(Complex x y) = x"
paulson@14373
   106
by simp
paulson@14323
   107
paulson@14374
   108
lemma Im [simp]: "Im(Complex x y) = y"
paulson@14373
   109
by simp
paulson@14323
   110
paulson@14323
   111
lemma complex_Re_Im_cancel_iff: "(w=z) = (Re(w) = Re(z) & Im(w) = Im(z))"
paulson@14373
   112
by (induct w, induct z, simp)
paulson@14323
   113
paulson@14374
   114
lemma complex_Re_zero [simp]: "Re 0 = 0"
paulson@14374
   115
by (simp add: complex_zero_def)
paulson@14374
   116
paulson@14374
   117
lemma complex_Im_zero [simp]: "Im 0 = 0"
paulson@14373
   118
by (simp add: complex_zero_def)
paulson@14323
   119
paulson@14374
   120
lemma complex_Re_one [simp]: "Re 1 = 1"
paulson@14374
   121
by (simp add: complex_one_def)
paulson@14323
   122
paulson@14374
   123
lemma complex_Im_one [simp]: "Im 1 = 0"
paulson@14373
   124
by (simp add: complex_one_def)
paulson@14323
   125
paulson@14374
   126
lemma complex_Re_i [simp]: "Re(ii) = 0"
paulson@14373
   127
by (simp add: i_def)
paulson@14323
   128
paulson@14374
   129
lemma complex_Im_i [simp]: "Im(ii) = 1"
paulson@14373
   130
by (simp add: i_def)
paulson@14323
   131
paulson@14374
   132
lemma Re_complex_of_real [simp]: "Re(complex_of_real z) = z"
paulson@14373
   133
by (simp add: complex_of_real_def)
paulson@14323
   134
paulson@14374
   135
lemma Im_complex_of_real [simp]: "Im(complex_of_real z) = 0"
paulson@14373
   136
by (simp add: complex_of_real_def)
paulson@14323
   137
paulson@14323
   138
paulson@14374
   139
subsection{*Unary Minus*}
paulson@14323
   140
paulson@14377
   141
lemma complex_minus [simp]: "- (Complex x y) = Complex (-x) (-y)"
paulson@14373
   142
by (simp add: complex_minus_def)
paulson@14323
   143
paulson@14374
   144
lemma complex_Re_minus [simp]: "Re (-z) = - Re z"
paulson@14373
   145
by (simp add: complex_minus_def)
paulson@14323
   146
paulson@14374
   147
lemma complex_Im_minus [simp]: "Im (-z) = - Im z"
paulson@14374
   148
by (simp add: complex_minus_def)
paulson@14323
   149
paulson@14323
   150
paulson@14323
   151
subsection{*Addition*}
paulson@14323
   152
paulson@14377
   153
lemma complex_add [simp]:
paulson@14377
   154
     "Complex x1 y1 + Complex x2 y2 = Complex (x1+x2) (y1+y2)"
paulson@14373
   155
by (simp add: complex_add_def)
paulson@14323
   156
paulson@14374
   157
lemma complex_Re_add [simp]: "Re(x + y) = Re(x) + Re(y)"
paulson@14373
   158
by (simp add: complex_add_def)
paulson@14323
   159
paulson@14374
   160
lemma complex_Im_add [simp]: "Im(x + y) = Im(x) + Im(y)"
paulson@14373
   161
by (simp add: complex_add_def)
paulson@14323
   162
paulson@14323
   163
lemma complex_add_commute: "(u::complex) + v = v + u"
paulson@14373
   164
by (simp add: complex_add_def add_commute)
paulson@14323
   165
paulson@14323
   166
lemma complex_add_assoc: "((u::complex) + v) + w = u + (v + w)"
paulson@14373
   167
by (simp add: complex_add_def add_assoc)
paulson@14323
   168
paulson@14323
   169
lemma complex_add_zero_left: "(0::complex) + z = z"
paulson@14373
   170
by (simp add: complex_add_def complex_zero_def)
paulson@14323
   171
paulson@14323
   172
lemma complex_add_zero_right: "z + (0::complex) = z"
paulson@14373
   173
by (simp add: complex_add_def complex_zero_def)
paulson@14323
   174
paulson@14373
   175
lemma complex_add_minus_left: "-z + z = (0::complex)"
paulson@14373
   176
by (simp add: complex_add_def complex_minus_def complex_zero_def)
paulson@14323
   177
paulson@14323
   178
lemma complex_diff:
paulson@14373
   179
      "Complex x1 y1 - Complex x2 y2 = Complex (x1-x2) (y1-y2)"
paulson@14373
   180
by (simp add: complex_add_def complex_minus_def complex_diff_def)
paulson@14323
   181
paulson@14374
   182
lemma complex_Re_diff [simp]: "Re(x - y) = Re(x) - Re(y)"
paulson@14374
   183
by (simp add: complex_diff_def)
paulson@14374
   184
paulson@14374
   185
lemma complex_Im_diff [simp]: "Im(x - y) = Im(x) - Im(y)"
paulson@14374
   186
by (simp add: complex_diff_def)
paulson@14374
   187
paulson@14374
   188
paulson@14323
   189
subsection{*Multiplication*}
paulson@14323
   190
paulson@14377
   191
lemma complex_mult [simp]:
paulson@14373
   192
     "Complex x1 y1 * Complex x2 y2 = Complex (x1*x2 - y1*y2) (x1*y2 + y1*x2)"
paulson@14373
   193
by (simp add: complex_mult_def)
paulson@14323
   194
paulson@14323
   195
lemma complex_mult_commute: "(w::complex) * z = z * w"
paulson@14373
   196
by (simp add: complex_mult_def mult_commute add_commute)
paulson@14323
   197
paulson@14323
   198
lemma complex_mult_assoc: "((u::complex) * v) * w = u * (v * w)"
paulson@14374
   199
by (simp add: complex_mult_def mult_ac add_ac
paulson@14373
   200
              right_diff_distrib right_distrib left_diff_distrib left_distrib)
paulson@14323
   201
paulson@14323
   202
lemma complex_mult_one_left: "(1::complex) * z = z"
paulson@14373
   203
by (simp add: complex_mult_def complex_one_def)
paulson@14323
   204
paulson@14323
   205
lemma complex_mult_one_right: "z * (1::complex) = z"
paulson@14373
   206
by (simp add: complex_mult_def complex_one_def)
paulson@14323
   207
paulson@14323
   208
paulson@14323
   209
subsection{*Inverse*}
paulson@14323
   210
paulson@14377
   211
lemma complex_inverse [simp]:
paulson@14373
   212
     "inverse (Complex x y) = Complex (x/(x ^ 2 + y ^ 2)) (-y/(x ^ 2 + y ^ 2))"
paulson@14373
   213
by (simp add: complex_inverse_def)
paulson@14335
   214
paulson@14354
   215
lemma complex_mult_inv_left: "z \<noteq> (0::complex) ==> inverse(z) * z = 1"
paulson@14374
   216
apply (induct z)
paulson@14374
   217
apply (rename_tac x y)
paulson@14374
   218
apply (auto simp add: complex_mult complex_inverse complex_one_def
paulson@14353
   219
       complex_zero_def add_divide_distrib [symmetric] power2_eq_square mult_ac)
paulson@14334
   220
apply (drule_tac y = y in real_sum_squares_not_zero)
paulson@14334
   221
apply (drule_tac [2] x = x in real_sum_squares_not_zero2, auto)
paulson@14323
   222
done
paulson@14323
   223
paulson@14335
   224
paulson@14335
   225
subsection {* The field of complex numbers *}
paulson@14335
   226
paulson@14335
   227
instance complex :: field
paulson@14335
   228
proof
paulson@14335
   229
  fix z u v w :: complex
paulson@14335
   230
  show "(u + v) + w = u + (v + w)"
paulson@14374
   231
    by (rule complex_add_assoc)
paulson@14335
   232
  show "z + w = w + z"
paulson@14374
   233
    by (rule complex_add_commute)
paulson@14335
   234
  show "0 + z = z"
paulson@14374
   235
    by (rule complex_add_zero_left)
paulson@14335
   236
  show "-z + z = 0"
paulson@14374
   237
    by (rule complex_add_minus_left)
paulson@14335
   238
  show "z - w = z + -w"
paulson@14335
   239
    by (simp add: complex_diff_def)
paulson@14335
   240
  show "(u * v) * w = u * (v * w)"
paulson@14374
   241
    by (rule complex_mult_assoc)
paulson@14335
   242
  show "z * w = w * z"
paulson@14374
   243
    by (rule complex_mult_commute)
paulson@14335
   244
  show "1 * z = z"
paulson@14374
   245
    by (rule complex_mult_one_left)
paulson@14341
   246
  show "0 \<noteq> (1::complex)"
paulson@14373
   247
    by (simp add: complex_zero_def complex_one_def)
paulson@14335
   248
  show "(u + v) * w = u * w + v * w"
paulson@14373
   249
    by (simp add: complex_mult_def complex_add_def left_distrib real_diff_def add_ac)
paulson@14341
   250
  show "z+u = z+v ==> u=v"
paulson@14341
   251
    proof -
paulson@14374
   252
      assume eq: "z+u = z+v"
paulson@14341
   253
      hence "(-z + z) + u = (-z + z) + v" by (simp only: eq complex_add_assoc)
paulson@14373
   254
      thus "u = v" by (simp add: complex_add_minus_left complex_add_zero_left)
paulson@14341
   255
    qed
paulson@14335
   256
  assume neq: "w \<noteq> 0"
paulson@14335
   257
  thus "z / w = z * inverse w"
paulson@14335
   258
    by (simp add: complex_divide_def)
paulson@14335
   259
  show "inverse w * w = 1"
paulson@14374
   260
    by (simp add: neq complex_mult_inv_left)
paulson@14335
   261
qed
paulson@14335
   262
paulson@14373
   263
instance complex :: division_by_zero
paulson@14373
   264
proof
paulson@14373
   265
  show inv: "inverse 0 = (0::complex)"
paulson@14373
   266
    by (simp add: complex_inverse_def complex_zero_def)
paulson@14373
   267
  fix x :: complex
paulson@14374
   268
  show "x/0 = 0"
paulson@14373
   269
    by (simp add: complex_divide_def inv)
paulson@14373
   270
qed
paulson@14335
   271
paulson@14323
   272
paulson@14323
   273
subsection{*Embedding Properties for @{term complex_of_real} Map*}
paulson@14323
   274
paulson@14377
   275
lemma Complex_add_complex_of_real [simp]:
paulson@14377
   276
     "Complex x y + complex_of_real r = Complex (x+r) y"
paulson@14377
   277
by (simp add: complex_of_real_def)
paulson@14377
   278
paulson@14377
   279
lemma complex_of_real_add_Complex [simp]:
paulson@14377
   280
     "complex_of_real r + Complex x y = Complex (r+x) y"
paulson@14377
   281
by (simp add: i_def complex_of_real_def)
paulson@14377
   282
paulson@14377
   283
lemma Complex_mult_complex_of_real:
paulson@14377
   284
     "Complex x y * complex_of_real r = Complex (x*r) (y*r)"
paulson@14377
   285
by (simp add: complex_of_real_def)
paulson@14377
   286
paulson@14377
   287
lemma complex_of_real_mult_Complex:
paulson@14377
   288
     "complex_of_real r * Complex x y = Complex (r*x) (r*y)"
paulson@14377
   289
by (simp add: i_def complex_of_real_def)
paulson@14377
   290
paulson@14377
   291
lemma i_complex_of_real [simp]: "ii * complex_of_real r = Complex 0 r"
paulson@14377
   292
by (simp add: i_def complex_of_real_def)
paulson@14377
   293
paulson@14377
   294
lemma complex_of_real_i [simp]: "complex_of_real r * ii = Complex 0 r"
paulson@14377
   295
by (simp add: i_def complex_of_real_def)
paulson@14377
   296
paulson@14374
   297
lemma complex_of_real_one [simp]: "complex_of_real 1 = 1"
paulson@14373
   298
by (simp add: complex_one_def complex_of_real_def)
paulson@14323
   299
paulson@14374
   300
lemma complex_of_real_zero [simp]: "complex_of_real 0 = 0"
paulson@14373
   301
by (simp add: complex_zero_def complex_of_real_def)
paulson@14323
   302
paulson@14374
   303
lemma complex_of_real_eq_iff [iff]:
paulson@14348
   304
     "(complex_of_real x = complex_of_real y) = (x = y)"
paulson@14374
   305
by (simp add: complex_of_real_def)
paulson@14323
   306
paulson@14323
   307
lemma complex_of_real_minus: "complex_of_real(-x) = - complex_of_real x"
paulson@14373
   308
by (simp add: complex_of_real_def complex_minus)
paulson@14323
   309
paulson@14348
   310
lemma complex_of_real_inverse:
paulson@14374
   311
     "complex_of_real(inverse x) = inverse(complex_of_real x)"
paulson@14348
   312
apply (case_tac "x=0", simp)
paulson@14374
   313
apply (simp add: complex_inverse complex_of_real_def real_divide_def
paulson@14353
   314
                 inverse_mult_distrib power2_eq_square)
paulson@14323
   315
done
paulson@14323
   316
paulson@14348
   317
lemma complex_of_real_add:
paulson@14373
   318
     "complex_of_real x + complex_of_real y = complex_of_real (x + y)"
paulson@14373
   319
by (simp add: complex_add complex_of_real_def)
paulson@14323
   320
paulson@14348
   321
lemma complex_of_real_diff:
paulson@14373
   322
     "complex_of_real x - complex_of_real y = complex_of_real (x - y)"
paulson@14374
   323
by (simp add: complex_of_real_minus [symmetric] complex_diff_def 
paulson@14374
   324
              complex_of_real_add)
paulson@14323
   325
paulson@14348
   326
lemma complex_of_real_mult:
paulson@14373
   327
     "complex_of_real x * complex_of_real y = complex_of_real (x * y)"
paulson@14373
   328
by (simp add: complex_mult complex_of_real_def)
paulson@14323
   329
paulson@14323
   330
lemma complex_of_real_divide:
paulson@14323
   331
      "complex_of_real x / complex_of_real y = complex_of_real(x/y)"
paulson@14373
   332
apply (simp add: complex_divide_def)
paulson@14373
   333
apply (case_tac "y=0", simp)
paulson@14374
   334
apply (simp add: complex_of_real_mult [symmetric] complex_of_real_inverse 
paulson@14374
   335
                 real_divide_def)
paulson@14323
   336
done
paulson@14323
   337
paulson@14377
   338
lemma complex_mod [simp]: "cmod (Complex x y) = sqrt(x ^ 2 + y ^ 2)"
paulson@14373
   339
by (simp add: cmod_def)
paulson@14323
   340
paulson@14374
   341
lemma complex_mod_zero [simp]: "cmod(0) = 0"
paulson@14373
   342
by (simp add: cmod_def)
paulson@14323
   343
paulson@14348
   344
lemma complex_mod_one [simp]: "cmod(1) = 1"
paulson@14353
   345
by (simp add: cmod_def power2_eq_square)
paulson@14323
   346
paulson@14374
   347
lemma complex_mod_complex_of_real [simp]: "cmod(complex_of_real x) = abs x"
paulson@14373
   348
by (simp add: complex_of_real_def power2_eq_square complex_mod)
paulson@14323
   349
paulson@14348
   350
lemma complex_of_real_abs:
paulson@14348
   351
     "complex_of_real (abs x) = complex_of_real(cmod(complex_of_real x))"
paulson@14373
   352
by simp
paulson@14348
   353
paulson@14323
   354
paulson@14377
   355
subsection{*The Functions @{term Re} and @{term Im}*}
paulson@14377
   356
paulson@14377
   357
lemma complex_Re_mult_eq: "Re (w * z) = Re w * Re z - Im w * Im z"
paulson@14377
   358
by (induct z, induct w, simp add: complex_mult)
paulson@14377
   359
paulson@14377
   360
lemma complex_Im_mult_eq: "Im (w * z) = Re w * Im z + Im w * Re z"
paulson@14377
   361
by (induct z, induct w, simp add: complex_mult)
paulson@14377
   362
paulson@14377
   363
lemma Re_i_times [simp]: "Re(ii * z) = - Im z"
paulson@14377
   364
by (simp add: complex_Re_mult_eq) 
paulson@14377
   365
paulson@14377
   366
lemma Re_times_i [simp]: "Re(z * ii) = - Im z"
paulson@14377
   367
by (simp add: complex_Re_mult_eq) 
paulson@14377
   368
paulson@14377
   369
lemma Im_i_times [simp]: "Im(ii * z) = Re z"
paulson@14377
   370
by (simp add: complex_Im_mult_eq) 
paulson@14377
   371
paulson@14377
   372
lemma Im_times_i [simp]: "Im(z * ii) = Re z"
paulson@14377
   373
by (simp add: complex_Im_mult_eq) 
paulson@14377
   374
paulson@14377
   375
lemma complex_Re_mult: "[| Im w = 0; Im z = 0 |] ==> Re(w * z) = Re(w) * Re(z)"
paulson@14377
   376
by (simp add: complex_Re_mult_eq)
paulson@14377
   377
paulson@14377
   378
lemma complex_Re_mult_complex_of_real [simp]:
paulson@14377
   379
     "Re (z * complex_of_real c) = Re(z) * c"
paulson@14377
   380
by (simp add: complex_Re_mult_eq)
paulson@14377
   381
paulson@14377
   382
lemma complex_Im_mult_complex_of_real [simp]:
paulson@14377
   383
     "Im (z * complex_of_real c) = Im(z) * c"
paulson@14377
   384
by (simp add: complex_Im_mult_eq)
paulson@14377
   385
paulson@14377
   386
lemma complex_Re_mult_complex_of_real2 [simp]:
paulson@14377
   387
     "Re (complex_of_real c * z) = c * Re(z)"
paulson@14377
   388
by (simp add: complex_Re_mult_eq)
paulson@14377
   389
paulson@14377
   390
lemma complex_Im_mult_complex_of_real2 [simp]:
paulson@14377
   391
     "Im (complex_of_real c * z) = c * Im(z)"
paulson@14377
   392
by (simp add: complex_Im_mult_eq)
paulson@14377
   393
 
paulson@14377
   394
paulson@14323
   395
subsection{*Conjugation is an Automorphism*}
paulson@14323
   396
paulson@14373
   397
lemma complex_cnj: "cnj (Complex x y) = Complex x (-y)"
paulson@14373
   398
by (simp add: cnj_def)
paulson@14323
   399
paulson@14374
   400
lemma complex_cnj_cancel_iff [simp]: "(cnj x = cnj y) = (x = y)"
paulson@14373
   401
by (simp add: cnj_def complex_Re_Im_cancel_iff)
paulson@14323
   402
paulson@14374
   403
lemma complex_cnj_cnj [simp]: "cnj (cnj z) = z"
paulson@14373
   404
by (simp add: cnj_def)
paulson@14323
   405
paulson@14374
   406
lemma complex_cnj_complex_of_real [simp]:
paulson@14373
   407
     "cnj (complex_of_real x) = complex_of_real x"
paulson@14373
   408
by (simp add: complex_of_real_def complex_cnj)
paulson@14323
   409
paulson@14374
   410
lemma complex_mod_cnj [simp]: "cmod (cnj z) = cmod z"
paulson@14373
   411
by (induct z, simp add: complex_cnj complex_mod power2_eq_square)
paulson@14323
   412
paulson@14323
   413
lemma complex_cnj_minus: "cnj (-z) = - cnj z"
paulson@14373
   414
by (simp add: cnj_def complex_minus complex_Re_minus complex_Im_minus)
paulson@14323
   415
paulson@14323
   416
lemma complex_cnj_inverse: "cnj(inverse z) = inverse(cnj z)"
paulson@14373
   417
by (induct z, simp add: complex_cnj complex_inverse power2_eq_square)
paulson@14323
   418
paulson@14323
   419
lemma complex_cnj_add: "cnj(w + z) = cnj(w) + cnj(z)"
paulson@14373
   420
by (induct w, induct z, simp add: complex_cnj complex_add)
paulson@14323
   421
paulson@14323
   422
lemma complex_cnj_diff: "cnj(w - z) = cnj(w) - cnj(z)"
paulson@14373
   423
by (simp add: complex_diff_def complex_cnj_add complex_cnj_minus)
paulson@14323
   424
paulson@14323
   425
lemma complex_cnj_mult: "cnj(w * z) = cnj(w) * cnj(z)"
paulson@14373
   426
by (induct w, induct z, simp add: complex_cnj complex_mult)
paulson@14323
   427
paulson@14323
   428
lemma complex_cnj_divide: "cnj(w / z) = (cnj w)/(cnj z)"
paulson@14373
   429
by (simp add: complex_divide_def complex_cnj_mult complex_cnj_inverse)
paulson@14323
   430
paulson@14374
   431
lemma complex_cnj_one [simp]: "cnj 1 = 1"
paulson@14373
   432
by (simp add: cnj_def complex_one_def)
paulson@14323
   433
paulson@14323
   434
lemma complex_add_cnj: "z + cnj z = complex_of_real (2 * Re(z))"
paulson@14373
   435
by (induct z, simp add: complex_add complex_cnj complex_of_real_def)
paulson@14323
   436
paulson@14323
   437
lemma complex_diff_cnj: "z - cnj z = complex_of_real (2 * Im(z)) * ii"
paulson@14373
   438
apply (induct z)
paulson@14374
   439
apply (simp add: complex_add complex_cnj complex_of_real_def complex_diff_def
paulson@14354
   440
                 complex_minus i_def complex_mult)
paulson@14323
   441
done
paulson@14323
   442
paulson@14354
   443
lemma complex_cnj_zero [simp]: "cnj 0 = 0"
paulson@14334
   444
by (simp add: cnj_def complex_zero_def)
paulson@14323
   445
paulson@14374
   446
lemma complex_cnj_zero_iff [iff]: "(cnj z = 0) = (z = 0)"
paulson@14373
   447
by (induct z, simp add: complex_zero_def complex_cnj)
paulson@14323
   448
paulson@14323
   449
lemma complex_mult_cnj: "z * cnj z = complex_of_real (Re(z) ^ 2 + Im(z) ^ 2)"
paulson@14374
   450
by (induct z,
paulson@14374
   451
    simp add: complex_cnj complex_mult complex_of_real_def power2_eq_square)
paulson@14323
   452
paulson@14323
   453
paulson@14323
   454
subsection{*Modulus*}
paulson@14323
   455
paulson@14374
   456
lemma complex_mod_eq_zero_cancel [simp]: "(cmod x = 0) = (x = 0)"
paulson@14373
   457
apply (induct x)
paulson@14374
   458
apply (auto intro: real_sum_squares_cancel real_sum_squares_cancel2
paulson@14373
   459
            simp add: complex_mod complex_zero_def power2_eq_square)
paulson@14323
   460
done
paulson@14323
   461
paulson@14374
   462
lemma complex_mod_complex_of_real_of_nat [simp]:
paulson@14373
   463
     "cmod (complex_of_real(real (n::nat))) = real n"
paulson@14373
   464
by simp
paulson@14323
   465
paulson@14374
   466
lemma complex_mod_minus [simp]: "cmod (-x) = cmod(x)"
paulson@14373
   467
by (induct x, simp add: complex_mod complex_minus power2_eq_square)
paulson@14323
   468
paulson@14323
   469
lemma complex_mod_mult_cnj: "cmod(z * cnj(z)) = cmod(z) ^ 2"
paulson@14373
   470
apply (induct z, simp add: complex_mod complex_cnj complex_mult)
paulson@14373
   471
apply (simp add: power2_eq_square real_abs_def)
paulson@14323
   472
done
paulson@14323
   473
paulson@14373
   474
lemma complex_mod_squared: "cmod(Complex x y) ^ 2 = x ^ 2 + y ^ 2"
paulson@14373
   475
by (simp add: cmod_def)
paulson@14323
   476
paulson@14374
   477
lemma complex_mod_ge_zero [simp]: "0 \<le> cmod x"
paulson@14373
   478
by (simp add: cmod_def)
paulson@14323
   479
paulson@14374
   480
lemma abs_cmod_cancel [simp]: "abs(cmod x) = cmod x"
paulson@14374
   481
by (simp add: abs_if linorder_not_less)
paulson@14323
   482
paulson@14323
   483
lemma complex_mod_mult: "cmod(x*y) = cmod(x) * cmod(y)"
paulson@14373
   484
apply (induct x, induct y)
paulson@14377
   485
apply (auto simp add: complex_mult complex_mod real_sqrt_mult_distrib2[symmetric])
paulson@14348
   486
apply (rule_tac n = 1 in power_inject_base)
paulson@14353
   487
apply (auto simp add: power2_eq_square [symmetric] simp del: realpow_Suc)
paulson@14374
   488
apply (auto simp add: real_diff_def power2_eq_square right_distrib left_distrib 
paulson@14374
   489
                      add_ac mult_ac)
paulson@14323
   490
done
paulson@14323
   491
paulson@14377
   492
lemma cmod_unit_one [simp]: "cmod (Complex (cos a) (sin a)) = 1"
paulson@14377
   493
by (simp add: cmod_def) 
paulson@14377
   494
paulson@14377
   495
lemma cmod_complex_polar [simp]:
paulson@14377
   496
     "cmod (complex_of_real r * Complex (cos a) (sin a)) = abs r"
paulson@14377
   497
by (simp only: cmod_unit_one complex_mod_mult, simp) 
paulson@14377
   498
paulson@14374
   499
lemma complex_mod_add_squared_eq:
paulson@14374
   500
     "cmod(x + y) ^ 2 = cmod(x) ^ 2 + cmod(y) ^ 2 + 2 * Re(x * cnj y)"
paulson@14373
   501
apply (induct x, induct y)
paulson@14323
   502
apply (auto simp add: complex_add complex_mod_squared complex_mult complex_cnj real_diff_def simp del: realpow_Suc)
paulson@14353
   503
apply (auto simp add: right_distrib left_distrib power2_eq_square mult_ac add_ac)
paulson@14323
   504
done
paulson@14323
   505
paulson@14374
   506
lemma complex_Re_mult_cnj_le_cmod [simp]: "Re(x * cnj y) \<le> cmod(x * cnj y)"
paulson@14373
   507
apply (induct x, induct y)
paulson@14323
   508
apply (auto simp add: complex_mod complex_mult complex_cnj real_diff_def simp del: realpow_Suc)
paulson@14323
   509
done
paulson@14323
   510
paulson@14374
   511
lemma complex_Re_mult_cnj_le_cmod2 [simp]: "Re(x * cnj y) \<le> cmod(x * y)"
paulson@14373
   512
by (insert complex_Re_mult_cnj_le_cmod [of x y], simp add: complex_mod_mult)
paulson@14323
   513
paulson@14374
   514
lemma real_sum_squared_expand:
paulson@14374
   515
     "((x::real) + y) ^ 2 = x ^ 2 + y ^ 2 + 2 * x * y"
paulson@14373
   516
by (simp add: left_distrib right_distrib power2_eq_square)
paulson@14323
   517
paulson@14374
   518
lemma complex_mod_triangle_squared [simp]:
paulson@14374
   519
     "cmod (x + y) ^ 2 \<le> (cmod(x) + cmod(y)) ^ 2"
paulson@14373
   520
by (simp add: real_sum_squared_expand complex_mod_add_squared_eq real_mult_assoc complex_mod_mult [symmetric])
paulson@14323
   521
paulson@14374
   522
lemma complex_mod_minus_le_complex_mod [simp]: "- cmod x \<le> cmod x"
paulson@14373
   523
by (rule order_trans [OF _ complex_mod_ge_zero], simp)
paulson@14323
   524
paulson@14374
   525
lemma complex_mod_triangle_ineq [simp]: "cmod (x + y) \<le> cmod(x) + cmod(y)"
paulson@14334
   526
apply (rule_tac n = 1 in realpow_increasing)
paulson@14323
   527
apply (auto intro:  order_trans [OF _ complex_mod_ge_zero]
paulson@14353
   528
            simp add: power2_eq_square [symmetric])
paulson@14323
   529
done
paulson@14323
   530
paulson@14374
   531
lemma complex_mod_triangle_ineq2 [simp]: "cmod(b + a) - cmod b \<le> cmod a"
paulson@14373
   532
by (insert complex_mod_triangle_ineq [THEN add_right_mono, of b a"-cmod b"], simp)
paulson@14323
   533
paulson@14323
   534
lemma complex_mod_diff_commute: "cmod (x - y) = cmod (y - x)"
paulson@14373
   535
apply (induct x, induct y)
paulson@14353
   536
apply (auto simp add: complex_diff complex_mod right_diff_distrib power2_eq_square left_diff_distrib add_ac mult_ac)
paulson@14323
   537
done
paulson@14323
   538
paulson@14374
   539
lemma complex_mod_add_less:
paulson@14374
   540
     "[| cmod x < r; cmod y < s |] ==> cmod (x + y) < r + s"
paulson@14334
   541
by (auto intro: order_le_less_trans complex_mod_triangle_ineq)
paulson@14323
   542
paulson@14374
   543
lemma complex_mod_mult_less:
paulson@14374
   544
     "[| cmod x < r; cmod y < s |] ==> cmod (x * y) < r * s"
paulson@14334
   545
by (auto intro: real_mult_less_mono' simp add: complex_mod_mult)
paulson@14323
   546
paulson@14374
   547
lemma complex_mod_diff_ineq [simp]: "cmod(a) - cmod(b) \<le> cmod(a + b)"
paulson@14323
   548
apply (rule linorder_cases [of "cmod(a)" "cmod (b)"])
paulson@14323
   549
apply auto
paulson@14334
   550
apply (rule order_trans [of _ 0], rule order_less_imp_le)
paulson@14374
   551
apply (simp add: compare_rls, simp)
paulson@14323
   552
apply (simp add: compare_rls)
paulson@14323
   553
apply (rule complex_mod_minus [THEN subst])
paulson@14323
   554
apply (rule order_trans)
paulson@14323
   555
apply (rule_tac [2] complex_mod_triangle_ineq)
paulson@14373
   556
apply (auto simp add: add_ac)
paulson@14323
   557
done
paulson@14323
   558
paulson@14374
   559
lemma complex_Re_le_cmod [simp]: "Re z \<le> cmod z"
paulson@14373
   560
by (induct z, simp add: complex_mod del: realpow_Suc)
paulson@14323
   561
paulson@14354
   562
lemma complex_mod_gt_zero: "z \<noteq> 0 ==> 0 < cmod z"
paulson@14373
   563
apply (insert complex_mod_ge_zero [of z])
paulson@14334
   564
apply (drule order_le_imp_less_or_eq, auto)
paulson@14323
   565
done
paulson@14323
   566
paulson@14323
   567
paulson@14323
   568
subsection{*A Few More Theorems*}
paulson@14323
   569
paulson@14323
   570
lemma complex_mod_inverse: "cmod(inverse x) = inverse(cmod x)"
paulson@14373
   571
apply (case_tac "x=0", simp)
paulson@14323
   572
apply (rule_tac c1 = "cmod x" in real_mult_left_cancel [THEN iffD1])
paulson@14323
   573
apply (auto simp add: complex_mod_mult [symmetric])
paulson@14323
   574
done
paulson@14323
   575
paulson@14373
   576
lemma complex_mod_divide: "cmod(x/y) = cmod(x)/(cmod y)"
paulson@14377
   577
by (simp add: complex_divide_def real_divide_def complex_mod_mult complex_mod_inverse)
paulson@14323
   578
paulson@14354
   579
paulson@14354
   580
subsection{*Exponentiation*}
paulson@14354
   581
paulson@14354
   582
primrec
paulson@14354
   583
     complexpow_0:   "z ^ 0       = 1"
paulson@14354
   584
     complexpow_Suc: "z ^ (Suc n) = (z::complex) * (z ^ n)"
paulson@14354
   585
paulson@14354
   586
paulson@14354
   587
instance complex :: ringpower
paulson@14354
   588
proof
paulson@14354
   589
  fix z :: complex
paulson@14354
   590
  fix n :: nat
paulson@14354
   591
  show "z^0 = 1" by simp
paulson@14354
   592
  show "z^(Suc n) = z * (z^n)" by simp
paulson@14354
   593
qed
paulson@14323
   594
paulson@14323
   595
paulson@14354
   596
lemma complex_of_real_pow: "complex_of_real (x ^ n) = (complex_of_real x) ^ n"
paulson@14323
   597
apply (induct_tac "n")
paulson@14354
   598
apply (auto simp add: complex_of_real_mult [symmetric])
paulson@14323
   599
done
paulson@14323
   600
paulson@14354
   601
lemma complex_cnj_pow: "cnj(z ^ n) = cnj(z) ^ n"
paulson@14323
   602
apply (induct_tac "n")
paulson@14354
   603
apply (auto simp add: complex_cnj_mult)
paulson@14323
   604
done
paulson@14323
   605
paulson@14354
   606
lemma complex_mod_complexpow: "cmod(x ^ n) = cmod(x) ^ n"
paulson@14354
   607
apply (induct_tac "n")
paulson@14354
   608
apply (auto simp add: complex_mod_mult)
paulson@14354
   609
done
paulson@14354
   610
paulson@14374
   611
lemma complexpow_minus:
paulson@14374
   612
     "(-x::complex) ^ n = (if even n then (x ^ n) else -(x ^ n))"
paulson@14354
   613
by (induct_tac "n", auto)
paulson@14354
   614
paulson@14354
   615
lemma complexpow_i_squared [simp]: "ii ^ 2 = -(1::complex)"
paulson@14354
   616
by (simp add: i_def complex_mult complex_one_def complex_minus numeral_2_eq_2)
paulson@14354
   617
paulson@14354
   618
lemma complex_i_not_zero [simp]: "ii \<noteq> 0"
paulson@14373
   619
by (simp add: i_def complex_zero_def)
paulson@14354
   620
paulson@14354
   621
paulson@14354
   622
subsection{*The Function @{term sgn}*}
paulson@14323
   623
paulson@14374
   624
lemma sgn_zero [simp]: "sgn 0 = 0"
paulson@14373
   625
by (simp add: sgn_def)
paulson@14323
   626
paulson@14374
   627
lemma sgn_one [simp]: "sgn 1 = 1"
paulson@14373
   628
by (simp add: sgn_def)
paulson@14323
   629
paulson@14323
   630
lemma sgn_minus: "sgn (-z) = - sgn(z)"
paulson@14373
   631
by (simp add: sgn_def)
paulson@14323
   632
paulson@14374
   633
lemma sgn_eq: "sgn z = z / complex_of_real (cmod z)"
paulson@14377
   634
by (simp add: sgn_def)
paulson@14323
   635
paulson@14323
   636
lemma i_mult_eq: "ii * ii = complex_of_real (-1)"
paulson@14373
   637
by (simp add: i_def complex_of_real_def complex_mult complex_add)
paulson@14323
   638
paulson@14374
   639
lemma i_mult_eq2 [simp]: "ii * ii = -(1::complex)"
paulson@14373
   640
by (simp add: i_def complex_one_def complex_mult complex_minus)
paulson@14323
   641
paulson@14374
   642
lemma complex_eq_cancel_iff2 [simp]:
paulson@14377
   643
     "(Complex x y = complex_of_real xa) = (x = xa & y = 0)"
paulson@14377
   644
by (simp add: complex_of_real_def) 
paulson@14323
   645
paulson@14374
   646
lemma complex_eq_cancel_iff2a [simp]:
paulson@14377
   647
     "(Complex x y = complex_of_real xa) = (x = xa & y = 0)"
paulson@14377
   648
by (simp add: complex_of_real_def)
paulson@14323
   649
paulson@14377
   650
lemma Complex_eq_0 [simp]: "(Complex x y = 0) = (x = 0 & y = 0)"
paulson@14377
   651
by (simp add: complex_zero_def)
paulson@14323
   652
paulson@14377
   653
lemma Complex_eq_1 [simp]: "(Complex x y = 1) = (x = 1 & y = 0)"
paulson@14377
   654
by (simp add: complex_one_def)
paulson@14323
   655
paulson@14377
   656
lemma Complex_eq_i [simp]: "(Complex x y = ii) = (x = 0 & y = 1)"
paulson@14377
   657
by (simp add: i_def)
paulson@14323
   658
paulson@14374
   659
lemma Re_sgn [simp]: "Re(sgn z) = Re(z)/cmod z"
paulson@14373
   660
apply (induct z)
paulson@14373
   661
apply (simp add: sgn_def complex_divide_def complex_of_real_inverse [symmetric])
paulson@14373
   662
apply (simp add: complex_of_real_def complex_mult real_divide_def)
paulson@14323
   663
done
paulson@14323
   664
paulson@14374
   665
lemma Im_sgn [simp]: "Im(sgn z) = Im(z)/cmod z"
paulson@14373
   666
apply (induct z)
paulson@14373
   667
apply (simp add: sgn_def complex_divide_def complex_of_real_inverse [symmetric])
paulson@14373
   668
apply (simp add: complex_of_real_def complex_mult real_divide_def)
paulson@14323
   669
done
paulson@14323
   670
paulson@14323
   671
lemma complex_inverse_complex_split:
paulson@14323
   672
     "inverse(complex_of_real x + ii * complex_of_real y) =
paulson@14323
   673
      complex_of_real(x/(x ^ 2 + y ^ 2)) -
paulson@14323
   674
      ii * complex_of_real(y/(x ^ 2 + y ^ 2))"
paulson@14374
   675
by (simp add: complex_of_real_def i_def complex_mult complex_add
paulson@14373
   676
         complex_diff_def complex_minus complex_inverse real_divide_def)
paulson@14323
   677
paulson@14323
   678
(*----------------------------------------------------------------------------*)
paulson@14323
   679
(* Many of the theorems below need to be moved elsewhere e.g. Transc. Also *)
paulson@14323
   680
(* many of the theorems are not used - so should they be kept?                *)
paulson@14323
   681
(*----------------------------------------------------------------------------*)
paulson@14323
   682
paulson@14354
   683
lemma complex_of_real_zero_iff [simp]: "(complex_of_real y = 0) = (y = 0)"
paulson@14354
   684
by (auto simp add: complex_zero_def complex_of_real_def)
paulson@14354
   685
paulson@14354
   686
lemma cos_arg_i_mult_zero_pos:
paulson@14377
   687
   "0 < y ==> cos (arg(Complex 0 y)) = 0"
paulson@14373
   688
apply (simp add: arg_def abs_if)
paulson@14334
   689
apply (rule_tac a = "pi/2" in someI2, auto)
paulson@14334
   690
apply (rule order_less_trans [of _ 0], auto)
paulson@14323
   691
done
paulson@14323
   692
paulson@14354
   693
lemma cos_arg_i_mult_zero_neg:
paulson@14377
   694
   "y < 0 ==> cos (arg(Complex 0 y)) = 0"
paulson@14373
   695
apply (simp add: arg_def abs_if)
paulson@14334
   696
apply (rule_tac a = "- pi/2" in someI2, auto)
paulson@14334
   697
apply (rule order_trans [of _ 0], auto)
paulson@14323
   698
done
paulson@14323
   699
paulson@14374
   700
lemma cos_arg_i_mult_zero [simp]:
paulson@14377
   701
     "y \<noteq> 0 ==> cos (arg(Complex 0 y)) = 0"
paulson@14377
   702
by (auto simp add: linorder_neq_iff cos_arg_i_mult_zero_pos cos_arg_i_mult_zero_neg)
paulson@14323
   703
paulson@14323
   704
paulson@14323
   705
subsection{*Finally! Polar Form for Complex Numbers*}
paulson@14323
   706
paulson@14374
   707
lemma complex_split_polar:
paulson@14377
   708
     "\<exists>r a. z = complex_of_real r * (Complex (cos a) (sin a))"
paulson@14377
   709
apply (induct z) 
paulson@14377
   710
apply (auto simp add: polar_Ex complex_of_real_mult_Complex)
paulson@14323
   711
done
paulson@14323
   712
paulson@14354
   713
lemma rcis_Ex: "\<exists>r a. z = rcis r a"
paulson@14377
   714
apply (induct z) 
paulson@14377
   715
apply (simp add: rcis_def cis_def polar_Ex complex_of_real_mult_Complex)
paulson@14323
   716
done
paulson@14323
   717
paulson@14374
   718
lemma Re_rcis [simp]: "Re(rcis r a) = r * cos a"
paulson@14373
   719
by (simp add: rcis_def cis_def)
paulson@14323
   720
paulson@14348
   721
lemma Im_rcis [simp]: "Im(rcis r a) = r * sin a"
paulson@14373
   722
by (simp add: rcis_def cis_def)
paulson@14323
   723
paulson@14377
   724
lemma sin_cos_squared_add2_mult: "(r * cos a)\<twosuperior> + (r * sin a)\<twosuperior> = r\<twosuperior>"
paulson@14377
   725
proof -
paulson@14377
   726
  have "(r * cos a)\<twosuperior> + (r * sin a)\<twosuperior> = r\<twosuperior> * ((cos a)\<twosuperior> + (sin a)\<twosuperior>)"
paulson@14377
   727
    by (simp only: power_mult_distrib right_distrib) 
paulson@14377
   728
  thus ?thesis by simp
paulson@14377
   729
qed
paulson@14323
   730
paulson@14374
   731
lemma complex_mod_rcis [simp]: "cmod(rcis r a) = abs r"
paulson@14377
   732
by (simp add: rcis_def cis_def sin_cos_squared_add2_mult)
paulson@14323
   733
paulson@14323
   734
lemma complex_mod_sqrt_Re_mult_cnj: "cmod z = sqrt (Re (z * cnj z))"
paulson@14373
   735
apply (simp add: cmod_def)
paulson@14323
   736
apply (rule real_sqrt_eq_iff [THEN iffD2])
paulson@14323
   737
apply (auto simp add: complex_mult_cnj)
paulson@14323
   738
done
paulson@14323
   739
paulson@14374
   740
lemma complex_Re_cnj [simp]: "Re(cnj z) = Re z"
paulson@14373
   741
by (induct z, simp add: complex_cnj)
paulson@14323
   742
paulson@14374
   743
lemma complex_Im_cnj [simp]: "Im(cnj z) = - Im z"
paulson@14374
   744
by (induct z, simp add: complex_cnj)
paulson@14374
   745
paulson@14374
   746
lemma complex_In_mult_cnj_zero [simp]: "Im (z * cnj z) = 0"
paulson@14373
   747
by (induct z, simp add: complex_cnj complex_mult)
paulson@14323
   748
paulson@14323
   749
paulson@14323
   750
(*---------------------------------------------------------------------------*)
paulson@14323
   751
(*  (r1 * cis a) * (r2 * cis b) = r1 * r2 * cis (a + b)                      *)
paulson@14323
   752
(*---------------------------------------------------------------------------*)
paulson@14323
   753
paulson@14323
   754
lemma cis_rcis_eq: "cis a = rcis 1 a"
paulson@14373
   755
by (simp add: rcis_def)
paulson@14323
   756
paulson@14374
   757
lemma rcis_mult: "rcis r1 a * rcis r2 b = rcis (r1*r2) (a + b)"
paulson@14377
   758
by (simp add: rcis_def cis_def complex_of_real_mult_Complex cos_add sin_add right_distrib right_diff_distrib)
paulson@14323
   759
paulson@14323
   760
lemma cis_mult: "cis a * cis b = cis (a + b)"
paulson@14373
   761
by (simp add: cis_rcis_eq rcis_mult)
paulson@14323
   762
paulson@14374
   763
lemma cis_zero [simp]: "cis 0 = 1"
paulson@14377
   764
by (simp add: cis_def complex_one_def)
paulson@14323
   765
paulson@14374
   766
lemma rcis_zero_mod [simp]: "rcis 0 a = 0"
paulson@14373
   767
by (simp add: rcis_def)
paulson@14323
   768
paulson@14374
   769
lemma rcis_zero_arg [simp]: "rcis r 0 = complex_of_real r"
paulson@14373
   770
by (simp add: rcis_def)
paulson@14323
   771
paulson@14323
   772
lemma complex_of_real_minus_one:
paulson@14323
   773
   "complex_of_real (-(1::real)) = -(1::complex)"
paulson@14377
   774
by (simp add: complex_of_real_def complex_one_def complex_minus)
paulson@14323
   775
paulson@14374
   776
lemma complex_i_mult_minus [simp]: "ii * (ii * x) = - x"
paulson@14373
   777
by (simp add: complex_mult_assoc [symmetric])
paulson@14323
   778
paulson@14323
   779
paulson@14323
   780
lemma cis_real_of_nat_Suc_mult:
paulson@14323
   781
   "cis (real (Suc n) * a) = cis a * cis (real n * a)"
paulson@14377
   782
by (simp add: cis_def real_of_nat_Suc left_distrib cos_add sin_add right_distrib)
paulson@14323
   783
paulson@14323
   784
lemma DeMoivre: "(cis a) ^ n = cis (real n * a)"
paulson@14323
   785
apply (induct_tac "n")
paulson@14323
   786
apply (auto simp add: cis_real_of_nat_Suc_mult)
paulson@14323
   787
done
paulson@14323
   788
paulson@14374
   789
lemma DeMoivre2: "(rcis r a) ^ n = rcis (r ^ n) (real n * a)"
paulson@14374
   790
by (simp add: rcis_def power_mult_distrib DeMoivre complex_of_real_pow)
paulson@14323
   791
paulson@14374
   792
lemma cis_inverse [simp]: "inverse(cis a) = cis (-a)"
paulson@14374
   793
by (simp add: cis_def complex_inverse_complex_split complex_of_real_minus 
paulson@14374
   794
              complex_diff_def)
paulson@14323
   795
paulson@14323
   796
lemma rcis_inverse: "inverse(rcis r a) = rcis (1/r) (-a)"
paulson@14377
   797
by (simp add: divide_inverse_zero rcis_def complex_of_real_inverse)
paulson@14323
   798
paulson@14323
   799
lemma cis_divide: "cis a / cis b = cis (a - b)"
paulson@14373
   800
by (simp add: complex_divide_def cis_mult real_diff_def)
paulson@14323
   801
paulson@14354
   802
lemma rcis_divide: "rcis r1 a / rcis r2 b = rcis (r1/r2) (a - b)"
paulson@14373
   803
apply (simp add: complex_divide_def)
paulson@14373
   804
apply (case_tac "r2=0", simp)
paulson@14373
   805
apply (simp add: rcis_inverse rcis_mult real_diff_def)
paulson@14323
   806
done
paulson@14323
   807
paulson@14374
   808
lemma Re_cis [simp]: "Re(cis a) = cos a"
paulson@14373
   809
by (simp add: cis_def)
paulson@14323
   810
paulson@14374
   811
lemma Im_cis [simp]: "Im(cis a) = sin a"
paulson@14373
   812
by (simp add: cis_def)
paulson@14323
   813
paulson@14323
   814
lemma cos_n_Re_cis_pow_n: "cos (real n * a) = Re(cis a ^ n)"
paulson@14334
   815
by (auto simp add: DeMoivre)
paulson@14323
   816
paulson@14323
   817
lemma sin_n_Im_cis_pow_n: "sin (real n * a) = Im(cis a ^ n)"
paulson@14334
   818
by (auto simp add: DeMoivre)
paulson@14323
   819
paulson@14323
   820
lemma expi_add: "expi(a + b) = expi(a) * expi(b)"
paulson@14374
   821
by (simp add: expi_def complex_Re_add exp_add complex_Im_add 
paulson@14374
   822
              cis_mult [symmetric] complex_of_real_mult mult_ac)
paulson@14323
   823
paulson@14374
   824
lemma expi_zero [simp]: "expi (0::complex) = 1"
paulson@14373
   825
by (simp add: expi_def)
paulson@14323
   826
paulson@14374
   827
lemma complex_expi_Ex: "\<exists>a r. z = complex_of_real r * expi a"
paulson@14373
   828
apply (insert rcis_Ex [of z])
paulson@14323
   829
apply (auto simp add: expi_def rcis_def complex_mult_assoc [symmetric] complex_of_real_mult)
paulson@14334
   830
apply (rule_tac x = "ii * complex_of_real a" in exI, auto)
paulson@14323
   831
done
paulson@14323
   832
paulson@14323
   833
paulson@14387
   834
subsection{*Numerals and Arithmetic*}
paulson@14387
   835
paulson@14387
   836
instance complex :: number ..
paulson@14387
   837
paulson@14387
   838
primrec (*the type constraint is essential!*)
paulson@14387
   839
  number_of_Pls: "number_of bin.Pls = 0"
paulson@14387
   840
  number_of_Min: "number_of bin.Min = - (1::complex)"
paulson@14387
   841
  number_of_BIT: "number_of(w BIT x) = (if x then 1 else 0) +
paulson@14387
   842
	                               (number_of w) + (number_of w)"
paulson@14387
   843
paulson@14387
   844
declare number_of_Pls [simp del]
paulson@14387
   845
        number_of_Min [simp del]
paulson@14387
   846
        number_of_BIT [simp del]
paulson@14387
   847
paulson@14387
   848
instance complex :: number_ring
paulson@14387
   849
proof
paulson@14387
   850
  show "Numeral0 = (0::complex)" by (rule number_of_Pls)
paulson@14387
   851
  show "-1 = - (1::complex)" by (rule number_of_Min)
paulson@14387
   852
  fix w :: bin and x :: bool
paulson@14387
   853
  show "(number_of (w BIT x) :: complex) =
paulson@14387
   854
        (if x then 1 else 0) + number_of w + number_of w"
paulson@14387
   855
    by (rule number_of_BIT)
paulson@14387
   856
qed
paulson@14387
   857
paulson@14387
   858
paulson@14387
   859
text{*Collapse applications of @{term complex_of_real} to @{term number_of}*}
paulson@14387
   860
lemma complex_number_of [simp]: "complex_of_real (number_of w) = number_of w"
paulson@14387
   861
apply (induct w) 
paulson@14387
   862
apply (simp_all only: number_of complex_of_real_add [symmetric] 
paulson@14387
   863
                      complex_of_real_minus, simp_all) 
paulson@14387
   864
done
paulson@14387
   865
paulson@14387
   866
text{*This theorem is necessary because theorems such as
paulson@14387
   867
   @{text iszero_number_of_0} only hold for ordered rings. They cannot
paulson@14387
   868
   be generalized to fields in general because they fail for finite fields.
paulson@14387
   869
   They work for type complex because the reals can be embedded in them.*}
paulson@14387
   870
lemma iszero_complex_number_of [simp]:
paulson@14387
   871
     "iszero (number_of w :: complex) = iszero (number_of w :: real)"
paulson@14387
   872
by (simp only: complex_of_real_zero_iff complex_number_of [symmetric] 
paulson@14387
   873
               iszero_def)  
paulson@14387
   874
paulson@14387
   875
paulson@14387
   876
(*These allow simplification of expressions involving mixed numbers.
paulson@14387
   877
  Convert???
paulson@14387
   878
Goalw [complex_number_of_def] 
paulson@14387
   879
  "((number_of xa :: complex) + ii * number_of ya =  
paulson@14387
   880
        number_of xb) =  
paulson@14387
   881
   (((number_of xa :: complex) = number_of xb) &  
paulson@14387
   882
    ((number_of ya :: complex) = 0))"
paulson@14387
   883
by (auto_tac (claset(), HOL_ss addsimps [complex_eq_cancel_iff2,
paulson@14387
   884
    complex_of_real_zero_iff]));
paulson@14387
   885
qed "complex_number_of_eq_cancel_iff2";
paulson@14387
   886
Addsimps [complex_number_of_eq_cancel_iff2];
paulson@14387
   887
paulson@14387
   888
Goalw [complex_number_of_def] 
paulson@14387
   889
  "((number_of xa :: complex) + number_of ya * ii = \
paulson@14387
   890
\       number_of xb) = \
paulson@14387
   891
\  (((number_of xa :: complex) = number_of xb) & \
paulson@14387
   892
\   ((number_of ya :: complex) = 0))";
paulson@14387
   893
by (auto_tac (claset(), HOL_ss addsimps [complex_eq_cancel_iff2a,
paulson@14387
   894
    complex_of_real_zero_iff]));
paulson@14387
   895
qed "complex_number_of_eq_cancel_iff2a";
paulson@14387
   896
Addsimps [complex_number_of_eq_cancel_iff2a];
paulson@14387
   897
paulson@14387
   898
Goalw [complex_number_of_def] 
paulson@14387
   899
  "((number_of xa :: complex) + ii * number_of ya = \
paulson@14387
   900
\    ii * number_of yb) = \
paulson@14387
   901
\  (((number_of xa :: complex) = 0) & \
paulson@14387
   902
\   ((number_of ya :: complex) = number_of yb))";
paulson@14387
   903
by (auto_tac (claset(), HOL_ss addsimps [complex_eq_cancel_iff3,
paulson@14387
   904
    complex_of_real_zero_iff]));
paulson@14387
   905
qed "complex_number_of_eq_cancel_iff3";
paulson@14387
   906
Addsimps [complex_number_of_eq_cancel_iff3];
paulson@14387
   907
paulson@14387
   908
Goalw [complex_number_of_def] 
paulson@14387
   909
  "((number_of xa :: complex) + number_of ya * ii= \
paulson@14387
   910
\    ii * number_of yb) = \
paulson@14387
   911
\  (((number_of xa :: complex) = 0) & \
paulson@14387
   912
\   ((number_of ya :: complex) = number_of yb))";
paulson@14387
   913
by (auto_tac (claset(), HOL_ss addsimps [complex_eq_cancel_iff3a,
paulson@14387
   914
    complex_of_real_zero_iff]));
paulson@14387
   915
qed "complex_number_of_eq_cancel_iff3a";
paulson@14387
   916
Addsimps [complex_number_of_eq_cancel_iff3a];
paulson@14387
   917
*)
paulson@14387
   918
paulson@14387
   919
lemma complex_number_of_cnj [simp]: "cnj(number_of v :: complex) = number_of v"
paulson@14387
   920
apply (subst complex_number_of [symmetric])
paulson@14387
   921
apply (rule complex_cnj_complex_of_real)
paulson@14387
   922
done
paulson@14387
   923
paulson@14387
   924
lemma complex_number_of_cmod: 
paulson@14387
   925
      "cmod(number_of v :: complex) = abs (number_of v :: real)"
paulson@14387
   926
by (simp only: complex_number_of [symmetric] complex_mod_complex_of_real)
paulson@14387
   927
paulson@14387
   928
lemma complex_number_of_Re [simp]: "Re(number_of v :: complex) = number_of v"
paulson@14387
   929
by (simp only: complex_number_of [symmetric] Re_complex_of_real)
paulson@14387
   930
paulson@14387
   931
lemma complex_number_of_Im [simp]: "Im(number_of v :: complex) = 0"
paulson@14387
   932
by (simp only: complex_number_of [symmetric] Im_complex_of_real)
paulson@14387
   933
paulson@14387
   934
lemma expi_two_pi_i [simp]: "expi((2::complex) * complex_of_real pi * ii) = 1"
paulson@14387
   935
by (simp add: expi_def complex_Re_mult_eq complex_Im_mult_eq cis_def)
paulson@14387
   936
paulson@14387
   937
paulson@14387
   938
(*examples:
paulson@14387
   939
print_depth 22
paulson@14387
   940
set timing;
paulson@14387
   941
set trace_simp;
paulson@14387
   942
fun test s = (Goal s, by (Simp_tac 1)); 
paulson@14387
   943
paulson@14387
   944
test "23 * ii + 45 * ii= (x::complex)";
paulson@14387
   945
paulson@14387
   946
test "5 * ii + 12 - 45 * ii= (x::complex)";
paulson@14387
   947
test "5 * ii + 40 - 12 * ii + 9 = (x::complex) + 89 * ii";
paulson@14387
   948
test "5 * ii + 40 - 12 * ii + 9 - 78 = (x::complex) + 89 * ii";
paulson@14387
   949
paulson@14387
   950
test "l + 10 * ii + 90 + 3*l +  9 + 45 * ii= (x::complex)";
paulson@14387
   951
test "87 + 10 * ii + 90 + 3*7 +  9 + 45 * ii= (x::complex)";
paulson@14387
   952
paulson@14387
   953
paulson@14387
   954
fun test s = (Goal s; by (Asm_simp_tac 1)); 
paulson@14387
   955
paulson@14387
   956
test "x*k = k*(y::complex)";
paulson@14387
   957
test "k = k*(y::complex)"; 
paulson@14387
   958
test "a*(b*c) = (b::complex)";
paulson@14387
   959
test "a*(b*c) = d*(b::complex)*(x*a)";
paulson@14387
   960
paulson@14387
   961
paulson@14387
   962
test "(x*k) / (k*(y::complex)) = (uu::complex)";
paulson@14387
   963
test "(k) / (k*(y::complex)) = (uu::complex)"; 
paulson@14387
   964
test "(a*(b*c)) / ((b::complex)) = (uu::complex)";
paulson@14387
   965
test "(a*(b*c)) / (d*(b::complex)*(x*a)) = (uu::complex)";
paulson@14387
   966
paulson@14387
   967
(*FIXME: what do we do about this?*)
paulson@14387
   968
test "a*(b*c)/(y*z) = d*(b::complex)*(x*a)/z";
paulson@14387
   969
*)
paulson@14387
   970
paulson@14323
   971
paulson@14323
   972
ML
paulson@14323
   973
{*
paulson@14323
   974
val complex_zero_def = thm"complex_zero_def";
paulson@14323
   975
val complex_one_def = thm"complex_one_def";
paulson@14323
   976
val complex_minus_def = thm"complex_minus_def";
paulson@14323
   977
val complex_diff_def = thm"complex_diff_def";
paulson@14323
   978
val complex_divide_def = thm"complex_divide_def";
paulson@14323
   979
val complex_mult_def = thm"complex_mult_def";
paulson@14323
   980
val complex_add_def = thm"complex_add_def";
paulson@14323
   981
val complex_of_real_def = thm"complex_of_real_def";
paulson@14323
   982
val i_def = thm"i_def";
paulson@14323
   983
val expi_def = thm"expi_def";
paulson@14323
   984
val cis_def = thm"cis_def";
paulson@14323
   985
val rcis_def = thm"rcis_def";
paulson@14323
   986
val cmod_def = thm"cmod_def";
paulson@14323
   987
val cnj_def = thm"cnj_def";
paulson@14323
   988
val sgn_def = thm"sgn_def";
paulson@14323
   989
val arg_def = thm"arg_def";
paulson@14323
   990
val complexpow_0 = thm"complexpow_0";
paulson@14323
   991
val complexpow_Suc = thm"complexpow_Suc";
paulson@14323
   992
paulson@14323
   993
val Re = thm"Re";
paulson@14323
   994
val Im = thm"Im";
paulson@14323
   995
val complex_Re_Im_cancel_iff = thm"complex_Re_Im_cancel_iff";
paulson@14323
   996
val complex_Re_zero = thm"complex_Re_zero";
paulson@14323
   997
val complex_Im_zero = thm"complex_Im_zero";
paulson@14323
   998
val complex_Re_one = thm"complex_Re_one";
paulson@14323
   999
val complex_Im_one = thm"complex_Im_one";
paulson@14323
  1000
val complex_Re_i = thm"complex_Re_i";
paulson@14323
  1001
val complex_Im_i = thm"complex_Im_i";
paulson@14323
  1002
val Re_complex_of_real = thm"Re_complex_of_real";
paulson@14323
  1003
val Im_complex_of_real = thm"Im_complex_of_real";
paulson@14323
  1004
val complex_minus = thm"complex_minus";
paulson@14323
  1005
val complex_Re_minus = thm"complex_Re_minus";
paulson@14323
  1006
val complex_Im_minus = thm"complex_Im_minus";
paulson@14323
  1007
val complex_add = thm"complex_add";
paulson@14323
  1008
val complex_Re_add = thm"complex_Re_add";
paulson@14323
  1009
val complex_Im_add = thm"complex_Im_add";
paulson@14323
  1010
val complex_add_commute = thm"complex_add_commute";
paulson@14323
  1011
val complex_add_assoc = thm"complex_add_assoc";
paulson@14323
  1012
val complex_add_zero_left = thm"complex_add_zero_left";
paulson@14323
  1013
val complex_add_zero_right = thm"complex_add_zero_right";
paulson@14323
  1014
val complex_diff = thm"complex_diff";
paulson@14323
  1015
val complex_mult = thm"complex_mult";
paulson@14323
  1016
val complex_mult_one_left = thm"complex_mult_one_left";
paulson@14323
  1017
val complex_mult_one_right = thm"complex_mult_one_right";
paulson@14323
  1018
val complex_inverse = thm"complex_inverse";
paulson@14323
  1019
val complex_of_real_one = thm"complex_of_real_one";
paulson@14323
  1020
val complex_of_real_zero = thm"complex_of_real_zero";
paulson@14323
  1021
val complex_of_real_eq_iff = thm"complex_of_real_eq_iff";
paulson@14323
  1022
val complex_of_real_minus = thm"complex_of_real_minus";
paulson@14323
  1023
val complex_of_real_inverse = thm"complex_of_real_inverse";
paulson@14323
  1024
val complex_of_real_add = thm"complex_of_real_add";
paulson@14323
  1025
val complex_of_real_diff = thm"complex_of_real_diff";
paulson@14323
  1026
val complex_of_real_mult = thm"complex_of_real_mult";
paulson@14323
  1027
val complex_of_real_divide = thm"complex_of_real_divide";
paulson@14323
  1028
val complex_of_real_pow = thm"complex_of_real_pow";
paulson@14323
  1029
val complex_mod = thm"complex_mod";
paulson@14323
  1030
val complex_mod_zero = thm"complex_mod_zero";
paulson@14323
  1031
val complex_mod_one = thm"complex_mod_one";
paulson@14323
  1032
val complex_mod_complex_of_real = thm"complex_mod_complex_of_real";
paulson@14323
  1033
val complex_of_real_abs = thm"complex_of_real_abs";
paulson@14323
  1034
val complex_cnj = thm"complex_cnj";
paulson@14323
  1035
val complex_cnj_cancel_iff = thm"complex_cnj_cancel_iff";
paulson@14323
  1036
val complex_cnj_cnj = thm"complex_cnj_cnj";
paulson@14323
  1037
val complex_cnj_complex_of_real = thm"complex_cnj_complex_of_real";
paulson@14323
  1038
val complex_mod_cnj = thm"complex_mod_cnj";
paulson@14323
  1039
val complex_cnj_minus = thm"complex_cnj_minus";
paulson@14323
  1040
val complex_cnj_inverse = thm"complex_cnj_inverse";
paulson@14323
  1041
val complex_cnj_add = thm"complex_cnj_add";
paulson@14323
  1042
val complex_cnj_diff = thm"complex_cnj_diff";
paulson@14323
  1043
val complex_cnj_mult = thm"complex_cnj_mult";
paulson@14323
  1044
val complex_cnj_divide = thm"complex_cnj_divide";
paulson@14323
  1045
val complex_cnj_one = thm"complex_cnj_one";
paulson@14323
  1046
val complex_cnj_pow = thm"complex_cnj_pow";
paulson@14323
  1047
val complex_add_cnj = thm"complex_add_cnj";
paulson@14323
  1048
val complex_diff_cnj = thm"complex_diff_cnj";
paulson@14323
  1049
val complex_cnj_zero = thm"complex_cnj_zero";
paulson@14323
  1050
val complex_cnj_zero_iff = thm"complex_cnj_zero_iff";
paulson@14323
  1051
val complex_mult_cnj = thm"complex_mult_cnj";
paulson@14323
  1052
val complex_mod_eq_zero_cancel = thm"complex_mod_eq_zero_cancel";
paulson@14323
  1053
val complex_mod_complex_of_real_of_nat = thm"complex_mod_complex_of_real_of_nat";
paulson@14323
  1054
val complex_mod_minus = thm"complex_mod_minus";
paulson@14323
  1055
val complex_mod_mult_cnj = thm"complex_mod_mult_cnj";
paulson@14323
  1056
val complex_mod_squared = thm"complex_mod_squared";
paulson@14323
  1057
val complex_mod_ge_zero = thm"complex_mod_ge_zero";
paulson@14323
  1058
val abs_cmod_cancel = thm"abs_cmod_cancel";
paulson@14323
  1059
val complex_mod_mult = thm"complex_mod_mult";
paulson@14323
  1060
val complex_mod_add_squared_eq = thm"complex_mod_add_squared_eq";
paulson@14323
  1061
val complex_Re_mult_cnj_le_cmod = thm"complex_Re_mult_cnj_le_cmod";
paulson@14323
  1062
val complex_Re_mult_cnj_le_cmod2 = thm"complex_Re_mult_cnj_le_cmod2";
paulson@14323
  1063
val real_sum_squared_expand = thm"real_sum_squared_expand";
paulson@14323
  1064
val complex_mod_triangle_squared = thm"complex_mod_triangle_squared";
paulson@14323
  1065
val complex_mod_minus_le_complex_mod = thm"complex_mod_minus_le_complex_mod";
paulson@14323
  1066
val complex_mod_triangle_ineq = thm"complex_mod_triangle_ineq";
paulson@14323
  1067
val complex_mod_triangle_ineq2 = thm"complex_mod_triangle_ineq2";
paulson@14323
  1068
val complex_mod_diff_commute = thm"complex_mod_diff_commute";
paulson@14323
  1069
val complex_mod_add_less = thm"complex_mod_add_less";
paulson@14323
  1070
val complex_mod_mult_less = thm"complex_mod_mult_less";
paulson@14323
  1071
val complex_mod_diff_ineq = thm"complex_mod_diff_ineq";
paulson@14323
  1072
val complex_Re_le_cmod = thm"complex_Re_le_cmod";
paulson@14323
  1073
val complex_mod_gt_zero = thm"complex_mod_gt_zero";
paulson@14323
  1074
val complex_mod_complexpow = thm"complex_mod_complexpow";
paulson@14323
  1075
val complexpow_minus = thm"complexpow_minus";
paulson@14323
  1076
val complex_mod_inverse = thm"complex_mod_inverse";
paulson@14323
  1077
val complex_mod_divide = thm"complex_mod_divide";
paulson@14323
  1078
val complexpow_i_squared = thm"complexpow_i_squared";
paulson@14323
  1079
val complex_i_not_zero = thm"complex_i_not_zero";
paulson@14323
  1080
val sgn_zero = thm"sgn_zero";
paulson@14323
  1081
val sgn_one = thm"sgn_one";
paulson@14323
  1082
val sgn_minus = thm"sgn_minus";
paulson@14323
  1083
val sgn_eq = thm"sgn_eq";
paulson@14323
  1084
val i_mult_eq = thm"i_mult_eq";
paulson@14323
  1085
val i_mult_eq2 = thm"i_mult_eq2";
paulson@14323
  1086
val Re_sgn = thm"Re_sgn";
paulson@14323
  1087
val Im_sgn = thm"Im_sgn";
paulson@14323
  1088
val complex_inverse_complex_split = thm"complex_inverse_complex_split";
paulson@14323
  1089
val cos_arg_i_mult_zero = thm"cos_arg_i_mult_zero";
paulson@14323
  1090
val complex_of_real_zero_iff = thm"complex_of_real_zero_iff";
paulson@14323
  1091
val rcis_Ex = thm"rcis_Ex";
paulson@14323
  1092
val Re_rcis = thm"Re_rcis";
paulson@14323
  1093
val Im_rcis = thm"Im_rcis";
paulson@14323
  1094
val complex_mod_rcis = thm"complex_mod_rcis";
paulson@14323
  1095
val complex_mod_sqrt_Re_mult_cnj = thm"complex_mod_sqrt_Re_mult_cnj";
paulson@14323
  1096
val complex_Re_cnj = thm"complex_Re_cnj";
paulson@14323
  1097
val complex_Im_cnj = thm"complex_Im_cnj";
paulson@14323
  1098
val complex_In_mult_cnj_zero = thm"complex_In_mult_cnj_zero";
paulson@14323
  1099
val complex_Re_mult = thm"complex_Re_mult";
paulson@14323
  1100
val complex_Re_mult_complex_of_real = thm"complex_Re_mult_complex_of_real";
paulson@14323
  1101
val complex_Im_mult_complex_of_real = thm"complex_Im_mult_complex_of_real";
paulson@14323
  1102
val complex_Re_mult_complex_of_real2 = thm"complex_Re_mult_complex_of_real2";
paulson@14323
  1103
val complex_Im_mult_complex_of_real2 = thm"complex_Im_mult_complex_of_real2";
paulson@14323
  1104
val cis_rcis_eq = thm"cis_rcis_eq";
paulson@14323
  1105
val rcis_mult = thm"rcis_mult";
paulson@14323
  1106
val cis_mult = thm"cis_mult";
paulson@14323
  1107
val cis_zero = thm"cis_zero";
paulson@14323
  1108
val rcis_zero_mod = thm"rcis_zero_mod";
paulson@14323
  1109
val rcis_zero_arg = thm"rcis_zero_arg";
paulson@14323
  1110
val complex_of_real_minus_one = thm"complex_of_real_minus_one";
paulson@14323
  1111
val complex_i_mult_minus = thm"complex_i_mult_minus";
paulson@14323
  1112
val cis_real_of_nat_Suc_mult = thm"cis_real_of_nat_Suc_mult";
paulson@14323
  1113
val DeMoivre = thm"DeMoivre";
paulson@14323
  1114
val DeMoivre2 = thm"DeMoivre2";
paulson@14323
  1115
val cis_inverse = thm"cis_inverse";
paulson@14323
  1116
val rcis_inverse = thm"rcis_inverse";
paulson@14323
  1117
val cis_divide = thm"cis_divide";
paulson@14323
  1118
val rcis_divide = thm"rcis_divide";
paulson@14323
  1119
val Re_cis = thm"Re_cis";
paulson@14323
  1120
val Im_cis = thm"Im_cis";
paulson@14323
  1121
val cos_n_Re_cis_pow_n = thm"cos_n_Re_cis_pow_n";
paulson@14323
  1122
val sin_n_Im_cis_pow_n = thm"sin_n_Im_cis_pow_n";
paulson@14323
  1123
val expi_add = thm"expi_add";
paulson@14323
  1124
val expi_zero = thm"expi_zero";
paulson@14323
  1125
val complex_Re_mult_eq = thm"complex_Re_mult_eq";
paulson@14323
  1126
val complex_Im_mult_eq = thm"complex_Im_mult_eq";
paulson@14323
  1127
val complex_expi_Ex = thm"complex_expi_Ex";
paulson@14323
  1128
*}
paulson@14323
  1129
paulson@13957
  1130
end
paulson@13957
  1131
paulson@13957
  1132