src/HOL/Complex/Complex.thy
author paulson
Tue Dec 23 16:53:33 2003 +0100 (2003-12-23)
changeset 14323 27724f528f82
parent 13957 10dbf16be15f
child 14334 6137d24eef79
permissions -rw-r--r--
converting Complex/Complex.ML to Isar
paulson@13957
     1
(*  Title:       Complex.thy
paulson@13957
     2
    Author:      Jacques D. Fleuriot
paulson@13957
     3
    Copyright:   2001 University of Edinburgh
paulson@13957
     4
    Description: Complex numbers
paulson@13957
     5
*)
paulson@13957
     6
paulson@14323
     7
theory Complex = HLog:
paulson@13957
     8
paulson@13957
     9
typedef complex = "{p::(real*real). True}"
paulson@14323
    10
  by blast
paulson@13957
    11
paulson@14323
    12
instance complex :: zero ..
paulson@14323
    13
instance complex :: one ..
paulson@14323
    14
instance complex :: plus ..
paulson@14323
    15
instance complex :: times ..
paulson@14323
    16
instance complex :: minus ..
paulson@14323
    17
instance complex :: inverse ..
paulson@14323
    18
instance complex :: power ..
paulson@13957
    19
paulson@13957
    20
consts
paulson@14323
    21
  "ii"    :: complex        ("ii")
paulson@13957
    22
paulson@13957
    23
constdefs
paulson@13957
    24
paulson@13957
    25
  (*--- real and Imaginary parts ---*)
paulson@14323
    26
paulson@14323
    27
  Re :: "complex => real"
paulson@13957
    28
  "Re(z) == fst(Rep_complex z)"
paulson@13957
    29
paulson@14323
    30
  Im :: "complex => real"
paulson@13957
    31
  "Im(z) == snd(Rep_complex z)"
paulson@13957
    32
paulson@13957
    33
  (*----------- modulus ------------*)
paulson@13957
    34
paulson@14323
    35
  cmod :: "complex => real"
paulson@14323
    36
  "cmod z == sqrt(Re(z) ^ 2 + Im(z) ^ 2)"
paulson@13957
    37
paulson@14323
    38
  (*----- injection from reals -----*)
paulson@14323
    39
paulson@14323
    40
  complex_of_real :: "real => complex"
paulson@13957
    41
  "complex_of_real r == Abs_complex(r,0::real)"
paulson@14323
    42
paulson@13957
    43
  (*------- complex conjugate ------*)
paulson@13957
    44
paulson@14323
    45
  cnj :: "complex => complex"
paulson@13957
    46
  "cnj z == Abs_complex(Re z, -Im z)"
paulson@13957
    47
paulson@14323
    48
  (*------------ Argand -------------*)
paulson@13957
    49
paulson@14323
    50
  sgn :: "complex => complex"
paulson@13957
    51
  "sgn z == z / complex_of_real(cmod z)"
paulson@13957
    52
paulson@14323
    53
  arg :: "complex => real"
paulson@13957
    54
  "arg z == @a. Re(sgn z) = cos a & Im(sgn z) = sin a & -pi < a & a <= pi"
paulson@14323
    55
paulson@13957
    56
paulson@14323
    57
defs (overloaded)
paulson@14323
    58
paulson@14323
    59
  complex_zero_def:
paulson@13957
    60
  "0 == Abs_complex(0::real,0)"
paulson@13957
    61
paulson@14323
    62
  complex_one_def:
paulson@13957
    63
  "1 == Abs_complex(1,0::real)"
paulson@13957
    64
paulson@14323
    65
  (*------ imaginary unit ----------*)
paulson@14323
    66
paulson@14323
    67
  i_def:
paulson@13957
    68
  "ii == Abs_complex(0::real,1)"
paulson@13957
    69
paulson@13957
    70
  (*----------- negation -----------*)
paulson@14323
    71
paulson@14323
    72
  complex_minus_def:
paulson@14323
    73
  "- (z::complex) == Abs_complex(-Re z, -Im z)"
paulson@13957
    74
paulson@14323
    75
paulson@13957
    76
  (*----------- inverse -----------*)
paulson@14323
    77
  complex_inverse_def:
paulson@13957
    78
  "inverse (z::complex) == Abs_complex(Re(z)/(Re(z) ^ 2 + Im(z) ^ 2),
paulson@13957
    79
                            -Im(z)/(Re(z) ^ 2 + Im(z) ^ 2))"
paulson@13957
    80
paulson@14323
    81
  complex_add_def:
paulson@13957
    82
  "w + (z::complex) == Abs_complex(Re(w) + Re(z),Im(w) + Im(z))"
paulson@13957
    83
paulson@14323
    84
  complex_diff_def:
paulson@13957
    85
  "w - (z::complex) == w + -(z::complex)"
paulson@13957
    86
paulson@14323
    87
  complex_mult_def:
paulson@13957
    88
  "w * (z::complex) == Abs_complex(Re(w) * Re(z) - Im(w) * Im(z),
paulson@13957
    89
			Re(w) * Im(z) + Im(w) * Re(z))"
paulson@13957
    90
paulson@13957
    91
paulson@13957
    92
  (*----------- division ----------*)
paulson@14323
    93
  complex_divide_def:
paulson@13957
    94
  "w / (z::complex) == w * inverse z"
paulson@14323
    95
paulson@13957
    96
paulson@13957
    97
primrec
paulson@14323
    98
     complexpow_0:   "z ^ 0       = complex_of_real 1"
paulson@14323
    99
     complexpow_Suc: "z ^ (Suc n) = (z::complex) * (z ^ n)"
paulson@13957
   100
paulson@13957
   101
paulson@13957
   102
constdefs
paulson@13957
   103
paulson@13957
   104
  (* abbreviation for (cos a + i sin a) *)
paulson@14323
   105
  cis :: "real => complex"
paulson@13957
   106
  "cis a == complex_of_real(cos a) + ii * complex_of_real(sin a)"
paulson@13957
   107
paulson@13957
   108
  (* abbreviation for r*(cos a + i sin a) *)
paulson@14323
   109
  rcis :: "[real, real] => complex"
paulson@13957
   110
  "rcis r a == complex_of_real r * cis a"
paulson@13957
   111
paulson@13957
   112
  (* e ^ (x + iy) *)
paulson@14323
   113
  expi :: "complex => complex"
paulson@13957
   114
  "expi z == complex_of_real(exp (Re z)) * cis (Im z)"
paulson@14323
   115
paulson@14323
   116
paulson@14323
   117
lemma inj_Rep_complex: "inj Rep_complex"
paulson@14323
   118
apply (rule inj_on_inverseI)
paulson@14323
   119
apply (rule Rep_complex_inverse)
paulson@14323
   120
done
paulson@14323
   121
paulson@14323
   122
lemma inj_Abs_complex: "inj Abs_complex"
paulson@14323
   123
apply (rule inj_on_inverseI)
paulson@14323
   124
apply (rule Abs_complex_inverse)
paulson@14323
   125
apply (simp (no_asm) add: complex_def)
paulson@14323
   126
done
paulson@14323
   127
declare inj_Abs_complex [THEN injD, simp]
paulson@14323
   128
paulson@14323
   129
lemma Abs_complex_cancel_iff: "(Abs_complex x = Abs_complex y) = (x = y)"
paulson@14323
   130
apply (auto dest: inj_Abs_complex [THEN injD])
paulson@14323
   131
done
paulson@14323
   132
declare Abs_complex_cancel_iff [simp]
paulson@14323
   133
paulson@14323
   134
lemma pair_mem_complex: "(x,y) : complex"
paulson@14323
   135
apply (unfold complex_def)
paulson@14323
   136
apply auto
paulson@14323
   137
done
paulson@14323
   138
declare pair_mem_complex [simp]
paulson@14323
   139
paulson@14323
   140
lemma Abs_complex_inverse2: "Rep_complex (Abs_complex (x,y)) = (x,y)"
paulson@14323
   141
apply (simp (no_asm) add: Abs_complex_inverse)
paulson@14323
   142
done
paulson@14323
   143
declare Abs_complex_inverse2 [simp]
paulson@14323
   144
paulson@14323
   145
lemma eq_Abs_complex: "(!!x y. z = Abs_complex(x,y) ==> P) ==> P"
paulson@14323
   146
apply (rule_tac p = "Rep_complex z" in PairE)
paulson@14323
   147
apply (drule_tac f = "Abs_complex" in arg_cong)
paulson@14323
   148
apply (force simp add: Rep_complex_inverse)
paulson@14323
   149
done
paulson@14323
   150
paulson@14323
   151
lemma Re: "Re(Abs_complex(x,y)) = x"
paulson@14323
   152
apply (unfold Re_def)
paulson@14323
   153
apply (simp (no_asm))
paulson@14323
   154
done
paulson@14323
   155
declare Re [simp]
paulson@14323
   156
paulson@14323
   157
lemma Im: "Im(Abs_complex(x,y)) = y"
paulson@14323
   158
apply (unfold Im_def)
paulson@14323
   159
apply (simp (no_asm))
paulson@14323
   160
done
paulson@14323
   161
declare Im [simp]
paulson@14323
   162
paulson@14323
   163
lemma Abs_complex_cancel: "Abs_complex(Re(z),Im(z)) = z"
paulson@14323
   164
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
   165
apply (simp (no_asm_simp))
paulson@14323
   166
done
paulson@14323
   167
declare Abs_complex_cancel [simp]
paulson@14323
   168
paulson@14323
   169
lemma complex_Re_Im_cancel_iff: "(w=z) = (Re(w) = Re(z) & Im(w) = Im(z))"
paulson@14323
   170
apply (rule_tac z = "w" in eq_Abs_complex)
paulson@14323
   171
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
   172
apply (auto dest: inj_Abs_complex [THEN injD])
paulson@14323
   173
done
paulson@14323
   174
paulson@14323
   175
lemma complex_Re_zero: "Re 0 = 0"
paulson@14323
   176
apply (unfold complex_zero_def)
paulson@14323
   177
apply (simp (no_asm))
paulson@14323
   178
done
paulson@14323
   179
paulson@14323
   180
lemma complex_Im_zero: "Im 0 = 0"
paulson@14323
   181
apply (unfold complex_zero_def)
paulson@14323
   182
apply (simp (no_asm))
paulson@14323
   183
done
paulson@14323
   184
declare complex_Re_zero [simp] complex_Im_zero [simp]
paulson@14323
   185
paulson@14323
   186
lemma complex_Re_one: "Re 1 = 1"
paulson@14323
   187
apply (unfold complex_one_def)
paulson@14323
   188
apply (simp (no_asm))
paulson@14323
   189
done
paulson@14323
   190
declare complex_Re_one [simp]
paulson@14323
   191
paulson@14323
   192
lemma complex_Im_one: "Im 1 = 0"
paulson@14323
   193
apply (unfold complex_one_def)
paulson@14323
   194
apply (simp (no_asm))
paulson@14323
   195
done
paulson@14323
   196
declare complex_Im_one [simp]
paulson@14323
   197
paulson@14323
   198
lemma complex_Re_i: "Re(ii) = 0"
paulson@14323
   199
apply (unfold i_def)
paulson@14323
   200
apply auto
paulson@14323
   201
done
paulson@14323
   202
declare complex_Re_i [simp]
paulson@14323
   203
paulson@14323
   204
lemma complex_Im_i: "Im(ii) = 1"
paulson@14323
   205
apply (unfold i_def)
paulson@14323
   206
apply auto
paulson@14323
   207
done
paulson@14323
   208
declare complex_Im_i [simp]
paulson@14323
   209
paulson@14323
   210
lemma Re_complex_of_real_zero: "Re(complex_of_real 0) = 0"
paulson@14323
   211
apply (unfold complex_of_real_def)
paulson@14323
   212
apply (simp (no_asm))
paulson@14323
   213
done
paulson@14323
   214
declare Re_complex_of_real_zero [simp]
paulson@14323
   215
paulson@14323
   216
lemma Im_complex_of_real_zero: "Im(complex_of_real 0) = 0"
paulson@14323
   217
apply (unfold complex_of_real_def)
paulson@14323
   218
apply (simp (no_asm))
paulson@14323
   219
done
paulson@14323
   220
declare Im_complex_of_real_zero [simp]
paulson@14323
   221
paulson@14323
   222
lemma Re_complex_of_real_one: "Re(complex_of_real 1) = 1"
paulson@14323
   223
apply (unfold complex_of_real_def)
paulson@14323
   224
apply (simp (no_asm))
paulson@14323
   225
done
paulson@14323
   226
declare Re_complex_of_real_one [simp]
paulson@14323
   227
paulson@14323
   228
lemma Im_complex_of_real_one: "Im(complex_of_real 1) = 0"
paulson@14323
   229
apply (unfold complex_of_real_def)
paulson@14323
   230
apply (simp (no_asm))
paulson@14323
   231
done
paulson@14323
   232
declare Im_complex_of_real_one [simp]
paulson@14323
   233
paulson@14323
   234
lemma Re_complex_of_real: "Re(complex_of_real z) = z"
paulson@14323
   235
apply (unfold complex_of_real_def)
paulson@14323
   236
apply auto
paulson@14323
   237
done
paulson@14323
   238
declare Re_complex_of_real [simp]
paulson@14323
   239
paulson@14323
   240
lemma Im_complex_of_real: "Im(complex_of_real z) = 0"
paulson@14323
   241
apply (unfold complex_of_real_def)
paulson@14323
   242
apply auto
paulson@14323
   243
done
paulson@14323
   244
declare Im_complex_of_real [simp]
paulson@14323
   245
paulson@14323
   246
paulson@14323
   247
subsection{*Negation*}
paulson@14323
   248
paulson@14323
   249
lemma complex_minus: "- Abs_complex(x,y) = Abs_complex(-x,-y)"
paulson@14323
   250
apply (unfold complex_minus_def)
paulson@14323
   251
apply (simp (no_asm))
paulson@14323
   252
done
paulson@14323
   253
paulson@14323
   254
lemma complex_Re_minus: "Re (-z) = - Re z"
paulson@14323
   255
apply (unfold Re_def)
paulson@14323
   256
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
   257
apply (auto simp add: complex_minus)
paulson@14323
   258
done
paulson@14323
   259
paulson@14323
   260
lemma complex_Im_minus: "Im (-z) = - Im z"
paulson@14323
   261
apply (unfold Im_def)
paulson@14323
   262
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
   263
apply (auto simp add: complex_minus)
paulson@14323
   264
done
paulson@14323
   265
paulson@14323
   266
lemma complex_minus_minus: "- (- z) = (z::complex)"
paulson@14323
   267
apply (unfold complex_minus_def)
paulson@14323
   268
apply (simp (no_asm))
paulson@14323
   269
done
paulson@14323
   270
declare complex_minus_minus [simp]
paulson@14323
   271
paulson@14323
   272
lemma inj_complex_minus: "inj(%r::complex. -r)"
paulson@14323
   273
apply (rule inj_onI)
paulson@14323
   274
apply (drule_tac f = "uminus" in arg_cong)
paulson@14323
   275
apply simp
paulson@14323
   276
done
paulson@14323
   277
paulson@14323
   278
lemma complex_minus_zero: "-(0::complex) = 0"
paulson@14323
   279
apply (unfold complex_zero_def)
paulson@14323
   280
apply (simp (no_asm) add: complex_minus)
paulson@14323
   281
done
paulson@14323
   282
declare complex_minus_zero [simp]
paulson@14323
   283
paulson@14323
   284
lemma complex_minus_zero_iff: "(-x = 0) = (x = (0::complex))"
paulson@14323
   285
apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323
   286
apply (auto dest: inj_Abs_complex [THEN injD]
paulson@14323
   287
            simp add: complex_zero_def complex_minus)
paulson@14323
   288
done
paulson@14323
   289
declare complex_minus_zero_iff [simp]
paulson@14323
   290
paulson@14323
   291
lemma complex_minus_zero_iff2: "(0 = -x) = (x = (0::real))"
paulson@14323
   292
apply (auto dest: sym)
paulson@14323
   293
done
paulson@14323
   294
declare complex_minus_zero_iff2 [simp]
paulson@14323
   295
paulson@14323
   296
lemma complex_minus_not_zero_iff: "(-x ~= 0) = (x ~= (0::complex))"
paulson@14323
   297
apply auto
paulson@14323
   298
done
paulson@14323
   299
paulson@14323
   300
paulson@14323
   301
subsection{*Addition*}
paulson@14323
   302
paulson@14323
   303
lemma complex_add:
paulson@14323
   304
      "Abs_complex(x1,y1) + Abs_complex(x2,y2) = Abs_complex(x1+x2,y1+y2)"
paulson@14323
   305
apply (unfold complex_add_def)
paulson@14323
   306
apply (simp (no_asm))
paulson@14323
   307
done
paulson@14323
   308
paulson@14323
   309
lemma complex_Re_add: "Re(x + y) = Re(x) + Re(y)"
paulson@14323
   310
apply (unfold Re_def)
paulson@14323
   311
apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323
   312
apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323
   313
apply (auto simp add: complex_add)
paulson@14323
   314
done
paulson@14323
   315
paulson@14323
   316
lemma complex_Im_add: "Im(x + y) = Im(x) + Im(y)"
paulson@14323
   317
apply (unfold Im_def)
paulson@14323
   318
apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323
   319
apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323
   320
apply (auto simp add: complex_add)
paulson@14323
   321
done
paulson@14323
   322
paulson@14323
   323
lemma complex_add_commute: "(u::complex) + v = v + u"
paulson@14323
   324
apply (unfold complex_add_def)
paulson@14323
   325
apply (simp (no_asm) add: real_add_commute)
paulson@14323
   326
done
paulson@14323
   327
paulson@14323
   328
lemma complex_add_assoc: "((u::complex) + v) + w = u + (v + w)"
paulson@14323
   329
apply (unfold complex_add_def)
paulson@14323
   330
apply (simp (no_asm) add: real_add_assoc)
paulson@14323
   331
done
paulson@14323
   332
paulson@14323
   333
lemma complex_add_left_commute: "(x::complex) + (y + z) = y + (x + z)"
paulson@14323
   334
apply (unfold complex_add_def)
paulson@14323
   335
apply (simp (no_asm) add: real_add_left_commute)
paulson@14323
   336
done
paulson@14323
   337
paulson@14323
   338
lemmas complex_add_ac = complex_add_assoc complex_add_commute
paulson@14323
   339
                      complex_add_left_commute
paulson@14323
   340
paulson@14323
   341
lemma complex_add_zero_left: "(0::complex) + z = z"
paulson@14323
   342
apply (unfold complex_add_def complex_zero_def)
paulson@14323
   343
apply (simp (no_asm))
paulson@14323
   344
done
paulson@14323
   345
declare complex_add_zero_left [simp]
paulson@14323
   346
paulson@14323
   347
lemma complex_add_zero_right: "z + (0::complex) = z"
paulson@14323
   348
apply (unfold complex_add_def complex_zero_def)
paulson@14323
   349
apply (simp (no_asm))
paulson@14323
   350
done
paulson@14323
   351
declare complex_add_zero_right [simp]
paulson@14323
   352
paulson@14323
   353
lemma complex_add_minus_right_zero:
paulson@14323
   354
      "z + -z = (0::complex)"
paulson@14323
   355
apply (unfold complex_add_def complex_minus_def complex_zero_def)
paulson@14323
   356
apply (simp (no_asm))
paulson@14323
   357
done
paulson@14323
   358
declare complex_add_minus_right_zero [simp]
paulson@14323
   359
paulson@14323
   360
lemma complex_add_minus_left_zero:
paulson@14323
   361
      "-z + z = (0::complex)"
paulson@14323
   362
apply (unfold complex_add_def complex_minus_def complex_zero_def)
paulson@14323
   363
apply (simp (no_asm))
paulson@14323
   364
done
paulson@14323
   365
declare complex_add_minus_left_zero [simp]
paulson@14323
   366
paulson@14323
   367
lemma complex_add_minus_cancel: "z + (- z + w) = (w::complex)"
paulson@14323
   368
apply (simp (no_asm) add: complex_add_assoc [symmetric])
paulson@14323
   369
done
paulson@14323
   370
paulson@14323
   371
lemma complex_minus_add_cancel: "(-z) + (z + w) = (w::complex)"
paulson@14323
   372
apply (simp (no_asm) add: complex_add_assoc [symmetric])
paulson@14323
   373
done
paulson@14323
   374
paulson@14323
   375
declare complex_add_minus_cancel [simp] complex_minus_add_cancel [simp]
paulson@14323
   376
paulson@14323
   377
lemma complex_add_minus_eq_minus: "x + y = (0::complex) ==> x = -y"
paulson@14323
   378
apply (auto simp add: complex_Re_Im_cancel_iff complex_Re_add complex_Im_add complex_Re_minus complex_Im_minus)
paulson@14323
   379
done
paulson@14323
   380
paulson@14323
   381
lemma complex_minus_add_distrib: "-(x + y) = -x + -(y::complex)"
paulson@14323
   382
apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323
   383
apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323
   384
apply (auto simp add: complex_minus complex_add)
paulson@14323
   385
done
paulson@14323
   386
declare complex_minus_add_distrib [simp]
paulson@14323
   387
paulson@14323
   388
lemma complex_add_left_cancel: "((x::complex) + y = x + z) = (y = z)"
paulson@14323
   389
apply (safe)
paulson@14323
   390
apply (drule_tac f = "%t.-x + t" in arg_cong)
paulson@14323
   391
apply (simp add: complex_add_assoc [symmetric])
paulson@14323
   392
done
paulson@14323
   393
declare complex_add_left_cancel [iff]
paulson@14323
   394
paulson@14323
   395
lemma complex_add_right_cancel: "(y + (x::complex)= z + x) = (y = z)"
paulson@14323
   396
apply (simp (no_asm) add: complex_add_commute)
paulson@14323
   397
done
paulson@14323
   398
declare complex_add_right_cancel [simp]
paulson@14323
   399
paulson@14323
   400
lemma complex_eq_minus_iff: "((x::complex) = y) = (0 = x + - y)"
paulson@14323
   401
apply (safe)
paulson@14323
   402
apply (rule_tac [2] x1 = "-y" in complex_add_right_cancel [THEN iffD1])
paulson@14323
   403
apply auto
paulson@14323
   404
done
paulson@14323
   405
paulson@14323
   406
lemma complex_eq_minus_iff2: "((x::complex) = y) = (x + - y = 0)"
paulson@14323
   407
apply (safe)
paulson@14323
   408
apply (rule_tac [2] x1 = "-y" in complex_add_right_cancel [THEN iffD1])
paulson@14323
   409
apply auto
paulson@14323
   410
done
paulson@14323
   411
paulson@14323
   412
lemma complex_diff_0: "(0::complex) - x = -x"
paulson@14323
   413
apply (simp (no_asm) add: complex_diff_def)
paulson@14323
   414
done
paulson@14323
   415
paulson@14323
   416
lemma complex_diff_0_right: "x - (0::complex) = x"
paulson@14323
   417
apply (simp (no_asm) add: complex_diff_def)
paulson@14323
   418
done
paulson@14323
   419
paulson@14323
   420
lemma complex_diff_self: "x - x = (0::complex)"
paulson@14323
   421
apply (simp (no_asm) add: complex_diff_def)
paulson@14323
   422
done
paulson@14323
   423
paulson@14323
   424
declare complex_diff_0 [simp] complex_diff_0_right [simp] complex_diff_self [simp]
paulson@14323
   425
paulson@14323
   426
lemma complex_diff:
paulson@14323
   427
      "Abs_complex(x1,y1) - Abs_complex(x2,y2) = Abs_complex(x1-x2,y1-y2)"
paulson@14323
   428
apply (unfold complex_diff_def)
paulson@14323
   429
apply (simp (no_asm) add: complex_add complex_minus)
paulson@14323
   430
done
paulson@14323
   431
paulson@14323
   432
lemma complex_diff_eq_eq: "((x::complex) - y = z) = (x = z + y)"
paulson@14323
   433
apply (auto simp add: complex_diff_def complex_add_assoc)
paulson@14323
   434
done
paulson@14323
   435
paulson@14323
   436
paulson@14323
   437
subsection{*Multiplication*}
paulson@14323
   438
paulson@14323
   439
lemma complex_mult:
paulson@14323
   440
      "Abs_complex(x1,y1) * Abs_complex(x2,y2) =
paulson@14323
   441
       Abs_complex(x1*x2 - y1*y2,x1*y2 + y1*x2)"
paulson@14323
   442
apply (unfold complex_mult_def)
paulson@14323
   443
apply (simp (no_asm))
paulson@14323
   444
done
paulson@14323
   445
paulson@14323
   446
lemma complex_mult_commute: "(w::complex) * z = z * w"
paulson@14323
   447
apply (unfold complex_mult_def)
paulson@14323
   448
apply (simp (no_asm) add: real_mult_commute real_add_commute)
paulson@14323
   449
done
paulson@14323
   450
paulson@14323
   451
lemma complex_mult_assoc: "((u::complex) * v) * w = u * (v * w)"
paulson@14323
   452
apply (unfold complex_mult_def)
paulson@14323
   453
apply (simp (no_asm) add: complex_Re_Im_cancel_iff real_mult_assoc real_diff_mult_distrib2 real_add_mult_distrib2 real_diff_mult_distrib real_add_mult_distrib real_mult_left_commute)
paulson@14323
   454
done
paulson@14323
   455
paulson@14323
   456
lemma complex_mult_left_commute: "(x::complex) * (y * z) = y * (x * z)"
paulson@14323
   457
apply (unfold complex_mult_def)
paulson@14323
   458
apply (simp (no_asm) add: complex_Re_Im_cancel_iff real_mult_left_commute real_diff_mult_distrib2 real_add_mult_distrib2)
paulson@14323
   459
done
paulson@14323
   460
paulson@14323
   461
lemmas complex_mult_ac = complex_mult_assoc complex_mult_commute
paulson@14323
   462
                      complex_mult_left_commute
paulson@14323
   463
paulson@14323
   464
lemma complex_mult_one_left: "(1::complex) * z = z"
paulson@14323
   465
apply (unfold complex_one_def)
paulson@14323
   466
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
   467
apply (simp (no_asm_simp) add: complex_mult)
paulson@14323
   468
done
paulson@14323
   469
declare complex_mult_one_left [simp]
paulson@14323
   470
paulson@14323
   471
lemma complex_mult_one_right: "z * (1::complex) = z"
paulson@14323
   472
apply (simp (no_asm) add: complex_mult_commute)
paulson@14323
   473
done
paulson@14323
   474
declare complex_mult_one_right [simp]
paulson@14323
   475
paulson@14323
   476
lemma complex_mult_zero_left: "(0::complex) * z = 0"
paulson@14323
   477
apply (unfold complex_zero_def)
paulson@14323
   478
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
   479
apply (simp (no_asm_simp) add: complex_mult)
paulson@14323
   480
done
paulson@14323
   481
declare complex_mult_zero_left [simp]
paulson@14323
   482
paulson@14323
   483
lemma complex_mult_zero_right: "z * 0 = (0::complex)"
paulson@14323
   484
apply (simp (no_asm) add: complex_mult_commute)
paulson@14323
   485
done
paulson@14323
   486
declare complex_mult_zero_right [simp]
paulson@14323
   487
paulson@14323
   488
lemma complex_divide_zero: "0 / z = (0::complex)"
paulson@14323
   489
apply (unfold complex_divide_def)
paulson@14323
   490
apply auto
paulson@14323
   491
done
paulson@14323
   492
declare complex_divide_zero [simp]
paulson@14323
   493
paulson@14323
   494
lemma complex_minus_mult_eq1: "-(x * y) = -x * (y::complex)"
paulson@14323
   495
apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323
   496
apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323
   497
apply (auto simp add: complex_mult complex_minus real_diff_def)
paulson@14323
   498
done
paulson@14323
   499
paulson@14323
   500
lemma complex_minus_mult_eq2: "-(x * y) = x * -(y::complex)"
paulson@14323
   501
apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323
   502
apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323
   503
apply (auto simp add: complex_mult complex_minus real_diff_def)
paulson@14323
   504
done
paulson@14323
   505
paulson@14323
   506
declare complex_minus_mult_eq1 [symmetric, simp] complex_minus_mult_eq2 [symmetric, simp]
paulson@14323
   507
paulson@14323
   508
lemma complex_mult_minus_one: "-(1::complex) * z = -z"
paulson@14323
   509
apply (simp (no_asm))
paulson@14323
   510
done
paulson@14323
   511
declare complex_mult_minus_one [simp]
paulson@14323
   512
paulson@14323
   513
lemma complex_mult_minus_one_right: "z * -(1::complex) = -z"
paulson@14323
   514
apply (subst complex_mult_commute)
paulson@14323
   515
apply (simp (no_asm))
paulson@14323
   516
done
paulson@14323
   517
declare complex_mult_minus_one_right [simp]
paulson@14323
   518
paulson@14323
   519
lemma complex_minus_mult_cancel: "-x * -y = x * (y::complex)"
paulson@14323
   520
apply (simp (no_asm))
paulson@14323
   521
done
paulson@14323
   522
declare complex_minus_mult_cancel [simp]
paulson@14323
   523
paulson@14323
   524
lemma complex_minus_mult_commute: "-x * y = x * -(y::complex)"
paulson@14323
   525
apply (simp (no_asm))
paulson@14323
   526
done
paulson@14323
   527
paulson@14323
   528
lemma complex_add_mult_distrib: "((z1::complex) + z2) * w = (z1 * w) + (z2 * w)"
paulson@14323
   529
apply (rule_tac z = "z1" in eq_Abs_complex)
paulson@14323
   530
apply (rule_tac z = "z2" in eq_Abs_complex)
paulson@14323
   531
apply (rule_tac z = "w" in eq_Abs_complex)
paulson@14323
   532
apply (auto simp add: complex_mult complex_add real_add_mult_distrib real_diff_def real_add_ac)
paulson@14323
   533
done
paulson@14323
   534
paulson@14323
   535
lemma complex_add_mult_distrib2: "(w::complex) * (z1 + z2) = (w * z1) + (w * z2)"
paulson@14323
   536
apply (rule_tac z1 = "z1 + z2" in complex_mult_commute [THEN ssubst])
paulson@14323
   537
apply (simp (no_asm) add: complex_add_mult_distrib)
paulson@14323
   538
apply (simp (no_asm) add: complex_mult_commute)
paulson@14323
   539
done
paulson@14323
   540
paulson@14323
   541
lemma complex_zero_not_eq_one: "(0::complex) ~= 1"
paulson@14323
   542
apply (unfold complex_zero_def complex_one_def)
paulson@14323
   543
apply (simp (no_asm) add: complex_Re_Im_cancel_iff)
paulson@14323
   544
done
paulson@14323
   545
declare complex_zero_not_eq_one [simp]
paulson@14323
   546
declare complex_zero_not_eq_one [THEN not_sym, simp]
paulson@14323
   547
paulson@14323
   548
paulson@14323
   549
subsection{*Inverse*}
paulson@14323
   550
paulson@14323
   551
lemma complex_inverse: "inverse (Abs_complex(x,y)) =
paulson@14323
   552
     Abs_complex(x/(x ^ 2 + y ^ 2),-y/(x ^ 2 + y ^ 2))"
paulson@14323
   553
apply (unfold complex_inverse_def)
paulson@14323
   554
apply (simp (no_asm))
paulson@14323
   555
done
paulson@14323
   556
paulson@14323
   557
lemma COMPLEX_INVERSE_ZERO: "inverse 0 = (0::complex)"
paulson@14323
   558
apply (unfold complex_inverse_def complex_zero_def)
paulson@14323
   559
apply auto
paulson@14323
   560
done
paulson@14323
   561
paulson@14323
   562
lemma COMPLEX_DIVISION_BY_ZERO: "a / (0::complex) = 0"
paulson@14323
   563
apply (simp (no_asm) add: complex_divide_def COMPLEX_INVERSE_ZERO)
paulson@14323
   564
done
paulson@14323
   565
paulson@14323
   566
lemma complex_mult_inv_left: "z ~= (0::complex) ==> inverse(z) * z = 1"
paulson@14323
   567
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
   568
apply (auto simp add: complex_mult complex_inverse complex_one_def complex_zero_def real_add_divide_distrib [symmetric] real_power_two mult_ac)
paulson@14323
   569
apply (drule_tac y = "y" in real_sum_squares_not_zero)
paulson@14323
   570
apply (drule_tac [2] x = "x" in real_sum_squares_not_zero2)
paulson@14323
   571
apply auto
paulson@14323
   572
done
paulson@14323
   573
declare complex_mult_inv_left [simp]
paulson@14323
   574
paulson@14323
   575
lemma complex_mult_inv_right: "z ~= (0::complex) ==> z * inverse(z) = 1"
paulson@14323
   576
apply (auto intro: complex_mult_commute [THEN subst])
paulson@14323
   577
done
paulson@14323
   578
declare complex_mult_inv_right [simp]
paulson@14323
   579
paulson@14323
   580
lemma complex_mult_left_cancel: "(c::complex) ~= 0 ==> (c*a=c*b) = (a=b)"
paulson@14323
   581
apply auto
paulson@14323
   582
apply (drule_tac f = "%x. x*inverse c" in arg_cong)
paulson@14323
   583
apply (simp add: complex_mult_ac)
paulson@14323
   584
done
paulson@14323
   585
paulson@14323
   586
lemma complex_mult_right_cancel: "(c::complex) ~= 0 ==> (a*c=b*c) = (a=b)"
paulson@14323
   587
apply (safe)
paulson@14323
   588
apply (drule_tac f = "%x. x*inverse c" in arg_cong)
paulson@14323
   589
apply (simp add: complex_mult_ac)
paulson@14323
   590
done
paulson@14323
   591
paulson@14323
   592
lemma complex_inverse_not_zero: "z ~= 0 ==> inverse(z::complex) ~= 0"
paulson@14323
   593
apply (safe)
paulson@14323
   594
apply (frule complex_mult_right_cancel [THEN iffD2])
paulson@14323
   595
apply (erule_tac [2] V = "inverse z = 0" in thin_rl)
paulson@14323
   596
apply (assumption , auto)
paulson@14323
   597
done
paulson@14323
   598
declare complex_inverse_not_zero [simp]
paulson@14323
   599
paulson@14323
   600
lemma complex_mult_not_zero: "!!x. [| x ~= 0; y ~= (0::complex) |] ==> x * y ~= 0"
paulson@14323
   601
apply (safe)
paulson@14323
   602
apply (drule_tac f = "%z. inverse x*z" in arg_cong)
paulson@14323
   603
apply (simp add: complex_mult_assoc [symmetric])
paulson@14323
   604
done
paulson@14323
   605
paulson@14323
   606
lemmas complex_mult_not_zeroE = complex_mult_not_zero [THEN notE, standard]
paulson@14323
   607
paulson@14323
   608
lemma complex_inverse_inverse: "inverse(inverse (x::complex)) = x"
paulson@14323
   609
apply (case_tac "x = 0", simp add: COMPLEX_INVERSE_ZERO)
paulson@14323
   610
apply (rule_tac c1 = "inverse x" in complex_mult_right_cancel [THEN iffD1])
paulson@14323
   611
apply (erule complex_inverse_not_zero)
paulson@14323
   612
apply (auto dest: complex_inverse_not_zero)
paulson@14323
   613
done
paulson@14323
   614
declare complex_inverse_inverse [simp]
paulson@14323
   615
paulson@14323
   616
lemma complex_inverse_one: "inverse(1::complex) = 1"
paulson@14323
   617
apply (unfold complex_one_def)
paulson@14323
   618
apply (simp (no_asm) add: complex_inverse)
paulson@14323
   619
done
paulson@14323
   620
declare complex_inverse_one [simp]
paulson@14323
   621
paulson@14323
   622
lemma complex_minus_inverse: "inverse(-x) = -inverse(x::complex)"
paulson@14323
   623
apply (case_tac "x = 0", simp add: COMPLEX_INVERSE_ZERO)
paulson@14323
   624
apply (rule_tac c1 = "-x" in complex_mult_right_cancel [THEN iffD1])
paulson@14323
   625
apply force
paulson@14323
   626
apply (subst complex_mult_inv_left)
paulson@14323
   627
apply auto
paulson@14323
   628
done
paulson@14323
   629
paulson@14323
   630
lemma complex_inverse_distrib: "inverse(x*y) = inverse x * inverse (y::complex)"
paulson@14323
   631
apply (case_tac "x = 0", simp add: COMPLEX_INVERSE_ZERO)
paulson@14323
   632
apply (case_tac "y = 0", simp add: COMPLEX_INVERSE_ZERO)
paulson@14323
   633
apply (rule_tac c1 = "x*y" in complex_mult_left_cancel [THEN iffD1])
paulson@14323
   634
apply (auto simp add: complex_mult_not_zero complex_mult_ac)
paulson@14323
   635
apply (auto simp add: complex_mult_not_zero complex_mult_assoc [symmetric])
paulson@14323
   636
done
paulson@14323
   637
paulson@14323
   638
paulson@14323
   639
subsection{*Division*}
paulson@14323
   640
paulson@14323
   641
(*adding some of these theorems to simpset as for reals:
paulson@14323
   642
  not 100% convinced for some*)
paulson@14323
   643
paulson@14323
   644
lemma complex_times_divide1_eq: "(x::complex) * (y/z) = (x*y)/z"
paulson@14323
   645
apply (simp (no_asm) add: complex_divide_def complex_mult_assoc)
paulson@14323
   646
done
paulson@14323
   647
paulson@14323
   648
lemma complex_times_divide2_eq: "(y/z) * (x::complex) = (y*x)/z"
paulson@14323
   649
apply (simp (no_asm) add: complex_divide_def complex_mult_ac)
paulson@14323
   650
done
paulson@14323
   651
paulson@14323
   652
declare complex_times_divide1_eq [simp] complex_times_divide2_eq [simp]
paulson@14323
   653
paulson@14323
   654
lemma complex_divide_divide1_eq: "(x::complex) / (y/z) = (x*z)/y"
paulson@14323
   655
apply (simp (no_asm) add: complex_divide_def complex_inverse_distrib complex_mult_ac)
paulson@14323
   656
done
paulson@14323
   657
paulson@14323
   658
lemma complex_divide_divide2_eq: "((x::complex) / y) / z = x/(y*z)"
paulson@14323
   659
apply (simp (no_asm) add: complex_divide_def complex_inverse_distrib complex_mult_assoc)
paulson@14323
   660
done
paulson@14323
   661
paulson@14323
   662
declare complex_divide_divide1_eq [simp] complex_divide_divide2_eq [simp]
paulson@14323
   663
paulson@14323
   664
(** As with multiplication, pull minus signs OUT of the / operator **)
paulson@14323
   665
paulson@14323
   666
lemma complex_minus_divide_eq: "(-x) / (y::complex) = - (x/y)"
paulson@14323
   667
apply (simp (no_asm) add: complex_divide_def)
paulson@14323
   668
done
paulson@14323
   669
declare complex_minus_divide_eq [simp]
paulson@14323
   670
paulson@14323
   671
lemma complex_divide_minus_eq: "(x / -(y::complex)) = - (x/y)"
paulson@14323
   672
apply (simp (no_asm) add: complex_divide_def complex_minus_inverse)
paulson@14323
   673
done
paulson@14323
   674
declare complex_divide_minus_eq [simp]
paulson@14323
   675
paulson@14323
   676
lemma complex_add_divide_distrib: "(x+y)/(z::complex) = x/z + y/z"
paulson@14323
   677
apply (simp (no_asm) add: complex_divide_def complex_add_mult_distrib)
paulson@14323
   678
done
paulson@14323
   679
paulson@14323
   680
subsection{*Embedding Properties for @{term complex_of_real} Map*}
paulson@14323
   681
paulson@14323
   682
lemma inj_complex_of_real: "inj complex_of_real"
paulson@14323
   683
apply (rule inj_onI)
paulson@14323
   684
apply (auto dest: inj_Abs_complex [THEN injD] simp add: complex_of_real_def)
paulson@14323
   685
done
paulson@14323
   686
paulson@14323
   687
lemma complex_of_real_one:
paulson@14323
   688
      "complex_of_real 1 = 1"
paulson@14323
   689
apply (unfold complex_one_def complex_of_real_def)
paulson@14323
   690
apply (rule refl)
paulson@14323
   691
done
paulson@14323
   692
declare complex_of_real_one [simp]
paulson@14323
   693
paulson@14323
   694
lemma complex_of_real_zero:
paulson@14323
   695
      "complex_of_real 0 = 0"
paulson@14323
   696
apply (unfold complex_zero_def complex_of_real_def)
paulson@14323
   697
apply (rule refl)
paulson@14323
   698
done
paulson@14323
   699
declare complex_of_real_zero [simp]
paulson@14323
   700
paulson@14323
   701
lemma complex_of_real_eq_iff: "(complex_of_real x = complex_of_real y) = (x = y)"
paulson@14323
   702
apply (auto dest: inj_complex_of_real [THEN injD])
paulson@14323
   703
done
paulson@14323
   704
declare complex_of_real_eq_iff [iff]
paulson@14323
   705
paulson@14323
   706
lemma complex_of_real_minus: "complex_of_real(-x) = - complex_of_real x"
paulson@14323
   707
apply (simp (no_asm) add: complex_of_real_def complex_minus)
paulson@14323
   708
done
paulson@14323
   709
paulson@14323
   710
lemma complex_of_real_inverse: "complex_of_real(inverse x) = inverse(complex_of_real x)"
paulson@14323
   711
apply (case_tac "x=0")
paulson@14323
   712
apply (simp add: DIVISION_BY_ZERO COMPLEX_INVERSE_ZERO)
paulson@14323
   713
apply (simp add: complex_inverse complex_of_real_def real_divide_def real_inverse_distrib real_power_two)
paulson@14323
   714
done
paulson@14323
   715
paulson@14323
   716
lemma complex_of_real_add: "complex_of_real x + complex_of_real y = complex_of_real (x + y)"
paulson@14323
   717
apply (simp (no_asm) add: complex_add complex_of_real_def)
paulson@14323
   718
done
paulson@14323
   719
paulson@14323
   720
lemma complex_of_real_diff: "complex_of_real x - complex_of_real y = complex_of_real (x - y)"
paulson@14323
   721
apply (simp (no_asm) add: complex_of_real_minus [symmetric] complex_diff_def complex_of_real_add)
paulson@14323
   722
done
paulson@14323
   723
paulson@14323
   724
lemma complex_of_real_mult: "complex_of_real x * complex_of_real y = complex_of_real (x * y)"
paulson@14323
   725
apply (simp (no_asm) add: complex_mult complex_of_real_def)
paulson@14323
   726
done
paulson@14323
   727
paulson@14323
   728
lemma complex_of_real_divide:
paulson@14323
   729
      "complex_of_real x / complex_of_real y = complex_of_real(x/y)"
paulson@14323
   730
apply (unfold complex_divide_def)
paulson@14323
   731
apply (case_tac "y=0")
paulson@14323
   732
apply (simp (no_asm_simp) add: DIVISION_BY_ZERO COMPLEX_INVERSE_ZERO)
paulson@14323
   733
apply (simp (no_asm_simp) add: complex_of_real_mult [symmetric] complex_of_real_inverse real_divide_def)
paulson@14323
   734
done
paulson@14323
   735
paulson@14323
   736
lemma complex_of_real_pow: "complex_of_real (x ^ n) = (complex_of_real x) ^ n"
paulson@14323
   737
apply (induct_tac "n")
paulson@14323
   738
apply (auto simp add: complex_of_real_mult [symmetric])
paulson@14323
   739
done
paulson@14323
   740
paulson@14323
   741
lemma complex_mod: "cmod (Abs_complex(x,y)) = sqrt(x ^ 2 + y ^ 2)"
paulson@14323
   742
apply (unfold cmod_def)
paulson@14323
   743
apply (simp (no_asm))
paulson@14323
   744
done
paulson@14323
   745
paulson@14323
   746
lemma complex_mod_zero: "cmod(0) = 0"
paulson@14323
   747
apply (unfold cmod_def)
paulson@14323
   748
apply (simp (no_asm))
paulson@14323
   749
done
paulson@14323
   750
declare complex_mod_zero [simp]
paulson@14323
   751
paulson@14323
   752
lemma complex_mod_one: "cmod(1) = 1"
paulson@14323
   753
apply (unfold cmod_def)
paulson@14323
   754
apply (simp add: );  
paulson@14323
   755
done
paulson@14323
   756
declare complex_mod_one [simp]
paulson@14323
   757
paulson@14323
   758
lemma complex_mod_complex_of_real: "cmod(complex_of_real x) = abs x"
paulson@14323
   759
apply (unfold complex_of_real_def)
paulson@14323
   760
apply (simp (no_asm) add: complex_mod)
paulson@14323
   761
done
paulson@14323
   762
declare complex_mod_complex_of_real [simp]
paulson@14323
   763
paulson@14323
   764
lemma complex_of_real_abs: "complex_of_real (abs x) = complex_of_real(cmod(complex_of_real x))"
paulson@14323
   765
apply (simp (no_asm))
paulson@14323
   766
done
paulson@14323
   767
paulson@14323
   768
paulson@14323
   769
subsection{*Conjugation is an Automorphism*}
paulson@14323
   770
paulson@14323
   771
lemma complex_cnj: "cnj (Abs_complex(x,y)) = Abs_complex(x,-y)"
paulson@14323
   772
apply (unfold cnj_def)
paulson@14323
   773
apply (simp (no_asm))
paulson@14323
   774
done
paulson@14323
   775
paulson@14323
   776
lemma inj_cnj: "inj cnj"
paulson@14323
   777
apply (rule inj_onI)
paulson@14323
   778
apply (auto simp add: cnj_def Abs_complex_cancel_iff complex_Re_Im_cancel_iff)
paulson@14323
   779
done
paulson@14323
   780
paulson@14323
   781
lemma complex_cnj_cancel_iff: "(cnj x = cnj y) = (x = y)"
paulson@14323
   782
apply (auto dest: inj_cnj [THEN injD])
paulson@14323
   783
done
paulson@14323
   784
declare complex_cnj_cancel_iff [simp]
paulson@14323
   785
paulson@14323
   786
lemma complex_cnj_cnj: "cnj (cnj z) = z"
paulson@14323
   787
apply (unfold cnj_def)
paulson@14323
   788
apply (simp (no_asm))
paulson@14323
   789
done
paulson@14323
   790
declare complex_cnj_cnj [simp]
paulson@14323
   791
paulson@14323
   792
lemma complex_cnj_complex_of_real: "cnj (complex_of_real x) = complex_of_real x"
paulson@14323
   793
apply (unfold complex_of_real_def)
paulson@14323
   794
apply (simp (no_asm) add: complex_cnj)
paulson@14323
   795
done
paulson@14323
   796
declare complex_cnj_complex_of_real [simp]
paulson@14323
   797
paulson@14323
   798
lemma complex_mod_cnj: "cmod (cnj z) = cmod z"
paulson@14323
   799
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
   800
apply (simp (no_asm_simp) add: complex_cnj complex_mod real_power_two)
paulson@14323
   801
done
paulson@14323
   802
declare complex_mod_cnj [simp]
paulson@14323
   803
paulson@14323
   804
lemma complex_cnj_minus: "cnj (-z) = - cnj z"
paulson@14323
   805
apply (unfold cnj_def)
paulson@14323
   806
apply (simp (no_asm) add: complex_minus complex_Re_minus complex_Im_minus)
paulson@14323
   807
done
paulson@14323
   808
paulson@14323
   809
lemma complex_cnj_inverse: "cnj(inverse z) = inverse(cnj z)"
paulson@14323
   810
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
   811
apply (simp (no_asm_simp) add: complex_cnj complex_inverse real_power_two)
paulson@14323
   812
done
paulson@14323
   813
paulson@14323
   814
lemma complex_cnj_add: "cnj(w + z) = cnj(w) + cnj(z)"
paulson@14323
   815
apply (rule_tac z = "w" in eq_Abs_complex)
paulson@14323
   816
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
   817
apply (simp (no_asm_simp) add: complex_cnj complex_add)
paulson@14323
   818
done
paulson@14323
   819
paulson@14323
   820
lemma complex_cnj_diff: "cnj(w - z) = cnj(w) - cnj(z)"
paulson@14323
   821
apply (unfold complex_diff_def)
paulson@14323
   822
apply (simp (no_asm) add: complex_cnj_add complex_cnj_minus)
paulson@14323
   823
done
paulson@14323
   824
paulson@14323
   825
lemma complex_cnj_mult: "cnj(w * z) = cnj(w) * cnj(z)"
paulson@14323
   826
apply (rule_tac z = "w" in eq_Abs_complex)
paulson@14323
   827
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
   828
apply (simp (no_asm_simp) add: complex_cnj complex_mult)
paulson@14323
   829
done
paulson@14323
   830
paulson@14323
   831
lemma complex_cnj_divide: "cnj(w / z) = (cnj w)/(cnj z)"
paulson@14323
   832
apply (unfold complex_divide_def)
paulson@14323
   833
apply (simp (no_asm) add: complex_cnj_mult complex_cnj_inverse)
paulson@14323
   834
done
paulson@14323
   835
paulson@14323
   836
lemma complex_cnj_one: "cnj 1 = 1"
paulson@14323
   837
apply (unfold cnj_def complex_one_def)
paulson@14323
   838
apply (simp (no_asm))
paulson@14323
   839
done
paulson@14323
   840
declare complex_cnj_one [simp]
paulson@14323
   841
paulson@14323
   842
lemma complex_cnj_pow: "cnj(z ^ n) = cnj(z) ^ n"
paulson@14323
   843
apply (induct_tac "n")
paulson@14323
   844
apply (auto simp add: complex_cnj_mult)
paulson@14323
   845
done
paulson@14323
   846
paulson@14323
   847
lemma complex_add_cnj: "z + cnj z = complex_of_real (2 * Re(z))"
paulson@14323
   848
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
   849
apply (simp (no_asm_simp) add: complex_add complex_cnj complex_of_real_def)
paulson@14323
   850
done
paulson@14323
   851
paulson@14323
   852
lemma complex_diff_cnj: "z - cnj z = complex_of_real (2 * Im(z)) * ii"
paulson@14323
   853
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
   854
apply (simp (no_asm_simp) add: complex_add complex_cnj complex_of_real_def complex_diff_def complex_minus i_def complex_mult)
paulson@14323
   855
done
paulson@14323
   856
paulson@14323
   857
lemma complex_cnj_zero: "cnj 0 = 0"
paulson@14323
   858
apply (simp add: cnj_def complex_zero_def) 
paulson@14323
   859
done
paulson@14323
   860
declare complex_cnj_zero [simp]
paulson@14323
   861
paulson@14323
   862
lemma complex_cnj_zero_iff: "(cnj z = 0) = (z = 0)"
paulson@14323
   863
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
   864
apply (auto simp add: complex_zero_def complex_cnj)
paulson@14323
   865
done
paulson@14323
   866
declare complex_cnj_zero_iff [iff]
paulson@14323
   867
paulson@14323
   868
lemma complex_mult_cnj: "z * cnj z = complex_of_real (Re(z) ^ 2 + Im(z) ^ 2)"
paulson@14323
   869
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
   870
apply (auto simp add: complex_cnj complex_mult complex_of_real_def real_power_two)
paulson@14323
   871
done
paulson@14323
   872
paulson@14323
   873
paulson@14323
   874
subsection{*Algebra*}
paulson@14323
   875
paulson@14323
   876
lemma complex_mult_zero_iff: "(x*y = (0::complex)) = (x = 0 | y = 0)"
paulson@14323
   877
apply auto
paulson@14323
   878
apply (auto intro: ccontr dest: complex_mult_not_zero)
paulson@14323
   879
done
paulson@14323
   880
declare complex_mult_zero_iff [iff]
paulson@14323
   881
paulson@14323
   882
lemma complex_add_left_cancel_zero: "(x + y = x) = (y = (0::complex))"
paulson@14323
   883
apply (unfold complex_zero_def)
paulson@14323
   884
apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323
   885
apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323
   886
apply (auto simp add: complex_add)
paulson@14323
   887
done
paulson@14323
   888
declare complex_add_left_cancel_zero [simp]
paulson@14323
   889
paulson@14323
   890
lemma complex_diff_mult_distrib:
paulson@14323
   891
      "((z1::complex) - z2) * w = (z1 * w) - (z2 * w)"
paulson@14323
   892
apply (unfold complex_diff_def)
paulson@14323
   893
apply (simp (no_asm) add: complex_add_mult_distrib)
paulson@14323
   894
done
paulson@14323
   895
paulson@14323
   896
lemma complex_diff_mult_distrib2:
paulson@14323
   897
      "(w::complex) * (z1 - z2) = (w * z1) - (w * z2)"
paulson@14323
   898
apply (unfold complex_diff_def)
paulson@14323
   899
apply (simp (no_asm) add: complex_add_mult_distrib2)
paulson@14323
   900
done
paulson@14323
   901
paulson@14323
   902
paulson@14323
   903
subsection{*Modulus*}
paulson@14323
   904
paulson@14323
   905
(*
paulson@14323
   906
Goal "[| sqrt(x) = 0; 0 <= x |] ==> x = 0"
paulson@14323
   907
by (auto_tac (claset() addIs [real_sqrt_eq_zero_cancel],
paulson@14323
   908
    simpset()));
paulson@14323
   909
qed "real_sqrt_eq_zero_cancel2";
paulson@14323
   910
*)
paulson@14323
   911
paulson@14323
   912
lemma complex_mod_eq_zero_cancel: "(cmod x = 0) = (x = 0)"
paulson@14323
   913
apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323
   914
apply (auto intro: real_sum_squares_cancel real_sum_squares_cancel2 simp add: complex_mod complex_zero_def real_power_two)
paulson@14323
   915
done
paulson@14323
   916
declare complex_mod_eq_zero_cancel [simp]
paulson@14323
   917
paulson@14323
   918
lemma complex_mod_complex_of_real_of_nat: "cmod (complex_of_real(real (n::nat))) = real n"
paulson@14323
   919
apply (simp (no_asm))
paulson@14323
   920
done
paulson@14323
   921
declare complex_mod_complex_of_real_of_nat [simp]
paulson@14323
   922
paulson@14323
   923
lemma complex_mod_minus: "cmod (-x) = cmod(x)"
paulson@14323
   924
apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323
   925
apply (simp (no_asm_simp) add: complex_mod complex_minus real_power_two)
paulson@14323
   926
done
paulson@14323
   927
declare complex_mod_minus [simp]
paulson@14323
   928
paulson@14323
   929
lemma complex_mod_mult_cnj: "cmod(z * cnj(z)) = cmod(z) ^ 2"
paulson@14323
   930
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
   931
apply (simp (no_asm_simp) add: complex_mod complex_cnj complex_mult);
paulson@14323
   932
apply (simp (no_asm) add: real_power_two real_abs_def)
paulson@14323
   933
done
paulson@14323
   934
paulson@14323
   935
lemma complex_mod_squared: "cmod(Abs_complex(x,y)) ^ 2 = x ^ 2 + y ^ 2"
paulson@14323
   936
apply (unfold cmod_def)
paulson@14323
   937
apply auto
paulson@14323
   938
done
paulson@14323
   939
paulson@14323
   940
lemma complex_mod_ge_zero: "0 <= cmod x"
paulson@14323
   941
apply (unfold cmod_def)
paulson@14323
   942
apply (auto intro: real_sqrt_ge_zero)
paulson@14323
   943
done
paulson@14323
   944
declare complex_mod_ge_zero [simp]
paulson@14323
   945
paulson@14323
   946
lemma abs_cmod_cancel: "abs(cmod x) = cmod x"
paulson@14323
   947
apply (auto intro: abs_eqI1)
paulson@14323
   948
done
paulson@14323
   949
declare abs_cmod_cancel [simp]
paulson@14323
   950
paulson@14323
   951
lemma complex_mod_mult: "cmod(x*y) = cmod(x) * cmod(y)"
paulson@14323
   952
apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323
   953
apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323
   954
apply (auto simp add: complex_mult complex_mod real_sqrt_mult_distrib2 [symmetric] simp del: realpow_Suc)
paulson@14323
   955
apply (rule_tac n = "1" in realpow_Suc_cancel_eq)
paulson@14323
   956
apply (auto simp add: real_power_two [symmetric] simp del: realpow_Suc)
paulson@14323
   957
apply (auto simp add: real_diff_def real_power_two real_add_mult_distrib2 real_add_mult_distrib real_add_ac real_mult_ac)
paulson@14323
   958
done
paulson@14323
   959
paulson@14323
   960
lemma complex_mod_add_squared_eq: "cmod(x + y) ^ 2 = cmod(x) ^ 2 + cmod(y) ^ 2 + 2 * Re(x * cnj y)"
paulson@14323
   961
apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323
   962
apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323
   963
apply (auto simp add: complex_add complex_mod_squared complex_mult complex_cnj real_diff_def simp del: realpow_Suc)
paulson@14323
   964
apply (auto simp add: real_add_mult_distrib2 real_add_mult_distrib real_power_two real_mult_ac real_add_ac)
paulson@14323
   965
done
paulson@14323
   966
paulson@14323
   967
lemma complex_Re_mult_cnj_le_cmod: "Re(x * cnj y) <= cmod(x * cnj y)"
paulson@14323
   968
apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323
   969
apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323
   970
apply (auto simp add: complex_mod complex_mult complex_cnj real_diff_def simp del: realpow_Suc)
paulson@14323
   971
done
paulson@14323
   972
declare complex_Re_mult_cnj_le_cmod [simp]
paulson@14323
   973
paulson@14323
   974
lemma complex_Re_mult_cnj_le_cmod2: "Re(x * cnj y) <= cmod(x * y)"
paulson@14323
   975
apply (cut_tac x = "x" and y = "y" in complex_Re_mult_cnj_le_cmod)
paulson@14323
   976
apply (simp add: complex_mod_mult)
paulson@14323
   977
done
paulson@14323
   978
declare complex_Re_mult_cnj_le_cmod2 [simp]
paulson@14323
   979
paulson@14323
   980
lemma real_sum_squared_expand: "((x::real) + y) ^ 2 = x ^ 2 + y ^ 2 + 2 * x * y"
paulson@14323
   981
apply (simp (no_asm) add: real_add_mult_distrib real_add_mult_distrib2 real_power_two)
paulson@14323
   982
done
paulson@14323
   983
paulson@14323
   984
lemma complex_mod_triangle_squared: "cmod (x + y) ^ 2 <= (cmod(x) + cmod(y)) ^ 2"
paulson@14323
   985
apply (simp (no_asm) add: real_sum_squared_expand complex_mod_add_squared_eq real_mult_assoc complex_mod_mult [symmetric])
paulson@14323
   986
done
paulson@14323
   987
declare complex_mod_triangle_squared [simp]
paulson@14323
   988
paulson@14323
   989
lemma complex_mod_minus_le_complex_mod: "- cmod x <= cmod x"
paulson@14323
   990
apply (rule order_trans [OF _ complex_mod_ge_zero]) 
paulson@14323
   991
apply (simp (no_asm))
paulson@14323
   992
done
paulson@14323
   993
declare complex_mod_minus_le_complex_mod [simp]
paulson@14323
   994
paulson@14323
   995
lemma complex_mod_triangle_ineq: "cmod (x + y) <= cmod(x) + cmod(y)"
paulson@14323
   996
apply (rule_tac n = "1" in realpow_increasing)
paulson@14323
   997
apply (auto intro:  order_trans [OF _ complex_mod_ge_zero]
paulson@14323
   998
            simp add: real_power_two [symmetric])
paulson@14323
   999
done
paulson@14323
  1000
declare complex_mod_triangle_ineq [simp]
paulson@14323
  1001
paulson@14323
  1002
lemma complex_mod_triangle_ineq2: "cmod(b + a) - cmod b <= cmod a"
paulson@14323
  1003
apply (cut_tac x1 = "b" and y1 = "a" and z = "-cmod b" in complex_mod_triangle_ineq [THEN real_add_le_mono1])
paulson@14323
  1004
apply (simp (no_asm))
paulson@14323
  1005
done
paulson@14323
  1006
declare complex_mod_triangle_ineq2 [simp]
paulson@14323
  1007
paulson@14323
  1008
lemma complex_mod_diff_commute: "cmod (x - y) = cmod (y - x)"
paulson@14323
  1009
apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323
  1010
apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323
  1011
apply (auto simp add: complex_diff complex_mod real_diff_mult_distrib2 real_power_two real_diff_mult_distrib real_add_ac real_mult_ac)
paulson@14323
  1012
done
paulson@14323
  1013
paulson@14323
  1014
lemma complex_mod_add_less: "[| cmod x < r; cmod y < s |] ==> cmod (x + y) < r + s"
paulson@14323
  1015
apply (auto intro: order_le_less_trans complex_mod_triangle_ineq)
paulson@14323
  1016
done
paulson@14323
  1017
paulson@14323
  1018
lemma complex_mod_mult_less: "[| cmod x < r; cmod y < s |] ==> cmod (x * y) < r * s"
paulson@14323
  1019
apply (auto intro: real_mult_less_mono' simp add: complex_mod_mult)
paulson@14323
  1020
done
paulson@14323
  1021
paulson@14323
  1022
lemma complex_mod_diff_ineq: "cmod(a) - cmod(b) <= cmod(a + b)"
paulson@14323
  1023
apply (rule linorder_cases [of "cmod(a)" "cmod (b)"])
paulson@14323
  1024
apply auto
paulson@14323
  1025
apply (rule order_trans [of _ 0] , rule order_less_imp_le)
paulson@14323
  1026
apply (simp add: compare_rls)
paulson@14323
  1027
apply (simp add: );  
paulson@14323
  1028
apply (simp add: compare_rls)
paulson@14323
  1029
apply (rule complex_mod_minus [THEN subst])
paulson@14323
  1030
apply (rule order_trans)
paulson@14323
  1031
apply (rule_tac [2] complex_mod_triangle_ineq)
paulson@14323
  1032
apply (auto simp add: complex_add_ac)
paulson@14323
  1033
done
paulson@14323
  1034
declare complex_mod_diff_ineq [simp]
paulson@14323
  1035
paulson@14323
  1036
lemma complex_Re_le_cmod: "Re z <= cmod z"
paulson@14323
  1037
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
  1038
apply (auto simp add: complex_mod simp del: realpow_Suc)
paulson@14323
  1039
done
paulson@14323
  1040
declare complex_Re_le_cmod [simp]
paulson@14323
  1041
paulson@14323
  1042
lemma complex_mod_gt_zero: "z ~= 0 ==> 0 < cmod z"
paulson@14323
  1043
apply (cut_tac x = "z" in complex_mod_ge_zero)
paulson@14323
  1044
apply (drule order_le_imp_less_or_eq)
paulson@14323
  1045
apply auto
paulson@14323
  1046
done
paulson@14323
  1047
paulson@14323
  1048
paulson@14323
  1049
subsection{*A Few More Theorems*}
paulson@14323
  1050
paulson@14323
  1051
lemma complex_mod_complexpow: "cmod(x ^ n) = cmod(x) ^ n"
paulson@14323
  1052
apply (induct_tac "n")
paulson@14323
  1053
apply (auto simp add: complex_mod_mult)
paulson@14323
  1054
done
paulson@14323
  1055
paulson@14323
  1056
lemma complexpow_minus: "(-x::complex) ^ n = (if even n then (x ^ n) else -(x ^ n))"
paulson@14323
  1057
apply (induct_tac "n")
paulson@14323
  1058
apply auto
paulson@14323
  1059
done
paulson@14323
  1060
paulson@14323
  1061
lemma complex_inverse_minus: "inverse (-x) = - inverse (x::complex)"
paulson@14323
  1062
apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323
  1063
apply (simp (no_asm_simp) add: complex_inverse complex_minus real_power_two)
paulson@14323
  1064
done
paulson@14323
  1065
paulson@14323
  1066
lemma complex_divide_one: "x / (1::complex) = x"
paulson@14323
  1067
apply (unfold complex_divide_def)
paulson@14323
  1068
apply (simp (no_asm))
paulson@14323
  1069
done
paulson@14323
  1070
declare complex_divide_one [simp]
paulson@14323
  1071
paulson@14323
  1072
lemma complex_mod_inverse: "cmod(inverse x) = inverse(cmod x)"
paulson@14323
  1073
apply (case_tac "x=0", simp add: COMPLEX_INVERSE_ZERO)
paulson@14323
  1074
apply (rule_tac c1 = "cmod x" in real_mult_left_cancel [THEN iffD1])
paulson@14323
  1075
apply (auto simp add: complex_mod_mult [symmetric])
paulson@14323
  1076
done
paulson@14323
  1077
paulson@14323
  1078
lemma complex_mod_divide:
paulson@14323
  1079
      "cmod(x/y) = cmod(x)/(cmod y)"
paulson@14323
  1080
apply (unfold complex_divide_def real_divide_def)
paulson@14323
  1081
apply (auto simp add: complex_mod_mult complex_mod_inverse)
paulson@14323
  1082
done
paulson@14323
  1083
paulson@14323
  1084
lemma complex_inverse_divide:
paulson@14323
  1085
      "inverse(x/y) = y/(x::complex)"
paulson@14323
  1086
apply (unfold complex_divide_def)
paulson@14323
  1087
apply (auto simp add: complex_inverse_distrib complex_mult_commute)
paulson@14323
  1088
done
paulson@14323
  1089
declare complex_inverse_divide [simp]
paulson@14323
  1090
paulson@14323
  1091
lemma complexpow_mult: "((r::complex) * s) ^ n = (r ^ n) * (s ^ n)"
paulson@14323
  1092
apply (induct_tac "n")
paulson@14323
  1093
apply (auto simp add: complex_mult_ac)
paulson@14323
  1094
done
paulson@14323
  1095
paulson@14323
  1096
paulson@14323
  1097
subsection{*More Exponentiation*}
paulson@14323
  1098
paulson@14323
  1099
lemma complexpow_zero: "(0::complex) ^ (Suc n) = 0"
paulson@14323
  1100
apply auto
paulson@14323
  1101
done
paulson@14323
  1102
declare complexpow_zero [simp]
paulson@14323
  1103
paulson@14323
  1104
lemma complexpow_not_zero [rule_format (no_asm)]: "r ~= (0::complex) --> r ^ n ~= 0"
paulson@14323
  1105
apply (induct_tac "n")
paulson@14323
  1106
apply (auto simp add: complex_mult_not_zero)
paulson@14323
  1107
done
paulson@14323
  1108
declare complexpow_not_zero [simp]
paulson@14323
  1109
declare complexpow_not_zero [intro]
paulson@14323
  1110
paulson@14323
  1111
lemma complexpow_zero_zero: "r ^ n = (0::complex) ==> r = 0"
paulson@14323
  1112
apply (blast intro: ccontr dest: complexpow_not_zero)
paulson@14323
  1113
done
paulson@14323
  1114
paulson@14323
  1115
lemma complexpow_i_squared: "ii ^ 2 = -(1::complex)"
paulson@14323
  1116
apply (unfold i_def)
paulson@14323
  1117
apply (auto simp add: complex_mult complex_one_def complex_minus numeral_2_eq_2)
paulson@14323
  1118
done
paulson@14323
  1119
declare complexpow_i_squared [simp]
paulson@14323
  1120
paulson@14323
  1121
lemma complex_i_not_zero: "ii ~= 0"
paulson@14323
  1122
apply (unfold i_def complex_zero_def)
paulson@14323
  1123
apply auto
paulson@14323
  1124
done
paulson@14323
  1125
declare complex_i_not_zero [simp]
paulson@14323
  1126
paulson@14323
  1127
lemma complex_mult_eq_zero_cancel1: "x * y ~= (0::complex) ==> x ~= 0"
paulson@14323
  1128
apply auto
paulson@14323
  1129
done
paulson@14323
  1130
paulson@14323
  1131
lemma complex_mult_eq_zero_cancel2: "x * y ~= 0 ==> y ~= (0::complex)"
paulson@14323
  1132
apply auto
paulson@14323
  1133
done
paulson@14323
  1134
paulson@14323
  1135
lemma complex_mult_not_eq_zero_iff: "(x * y ~= 0) = (x ~= 0 & y ~= (0::complex))"
paulson@14323
  1136
apply auto
paulson@14323
  1137
done
paulson@14323
  1138
declare complex_mult_not_eq_zero_iff [iff]
paulson@14323
  1139
paulson@14323
  1140
lemma complexpow_inverse: "inverse ((r::complex) ^ n) = (inverse r) ^ n"
paulson@14323
  1141
apply (induct_tac "n")
paulson@14323
  1142
apply (auto simp add: complex_inverse_distrib)
paulson@14323
  1143
done
paulson@14323
  1144
paulson@14323
  1145
(*---------------------------------------------------------------------------*)
paulson@14323
  1146
(* sgn                                                                       *)
paulson@14323
  1147
(*---------------------------------------------------------------------------*)
paulson@14323
  1148
paulson@14323
  1149
lemma sgn_zero: "sgn 0 = 0"
paulson@14323
  1150
paulson@14323
  1151
apply (unfold sgn_def)
paulson@14323
  1152
apply (simp (no_asm))
paulson@14323
  1153
done
paulson@14323
  1154
declare sgn_zero [simp]
paulson@14323
  1155
paulson@14323
  1156
lemma sgn_one: "sgn 1 = 1"
paulson@14323
  1157
apply (unfold sgn_def)
paulson@14323
  1158
apply (simp (no_asm))
paulson@14323
  1159
done
paulson@14323
  1160
declare sgn_one [simp]
paulson@14323
  1161
paulson@14323
  1162
lemma sgn_minus: "sgn (-z) = - sgn(z)"
paulson@14323
  1163
apply (unfold sgn_def)
paulson@14323
  1164
apply auto
paulson@14323
  1165
done
paulson@14323
  1166
paulson@14323
  1167
lemma sgn_eq:
paulson@14323
  1168
    "sgn z = z / complex_of_real (cmod z)"
paulson@14323
  1169
apply (unfold sgn_def)
paulson@14323
  1170
apply (simp (no_asm))
paulson@14323
  1171
done
paulson@14323
  1172
paulson@14323
  1173
lemma complex_split: "EX x y. z = complex_of_real(x) + ii * complex_of_real(y)"
paulson@14323
  1174
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
  1175
apply (auto simp add: complex_of_real_def i_def complex_mult complex_add)
paulson@14323
  1176
done
paulson@14323
  1177
paulson@14323
  1178
lemma Re_complex_i: "Re(complex_of_real(x) + ii * complex_of_real(y)) = x"
paulson@14323
  1179
apply (auto simp add: complex_of_real_def i_def complex_mult complex_add)
paulson@14323
  1180
done
paulson@14323
  1181
declare Re_complex_i [simp]
paulson@14323
  1182
paulson@14323
  1183
lemma Im_complex_i: "Im(complex_of_real(x) + ii * complex_of_real(y)) = y"
paulson@14323
  1184
apply (auto simp add: complex_of_real_def i_def complex_mult complex_add)
paulson@14323
  1185
done
paulson@14323
  1186
declare Im_complex_i [simp]
paulson@14323
  1187
paulson@14323
  1188
lemma i_mult_eq: "ii * ii = complex_of_real (-1)"
paulson@14323
  1189
apply (unfold i_def complex_of_real_def)
paulson@14323
  1190
apply (auto simp add: complex_mult complex_add)
paulson@14323
  1191
done
paulson@14323
  1192
paulson@14323
  1193
lemma i_mult_eq2: "ii * ii = -(1::complex)"
paulson@14323
  1194
apply (unfold i_def complex_one_def)
paulson@14323
  1195
apply (simp (no_asm) add: complex_mult complex_minus)
paulson@14323
  1196
done
paulson@14323
  1197
declare i_mult_eq2 [simp]
paulson@14323
  1198
paulson@14323
  1199
lemma cmod_i: "cmod (complex_of_real(x) + ii * complex_of_real(y)) =
paulson@14323
  1200
      sqrt (x ^ 2 + y ^ 2)"
paulson@14323
  1201
apply (auto simp add: complex_mult complex_add i_def complex_of_real_def cmod_def)
paulson@14323
  1202
done
paulson@14323
  1203
paulson@14323
  1204
lemma complex_eq_Re_eq:
paulson@14323
  1205
     "complex_of_real xa + ii * complex_of_real ya =
paulson@14323
  1206
      complex_of_real xb + ii * complex_of_real yb
paulson@14323
  1207
       ==> xa = xb"
paulson@14323
  1208
apply (unfold complex_of_real_def i_def)
paulson@14323
  1209
apply (auto simp add: complex_mult complex_add)
paulson@14323
  1210
done
paulson@14323
  1211
paulson@14323
  1212
lemma complex_eq_Im_eq:
paulson@14323
  1213
     "complex_of_real xa + ii * complex_of_real ya =
paulson@14323
  1214
      complex_of_real xb + ii * complex_of_real yb
paulson@14323
  1215
       ==> ya = yb"
paulson@14323
  1216
apply (unfold complex_of_real_def i_def)
paulson@14323
  1217
apply (auto simp add: complex_mult complex_add)
paulson@14323
  1218
done
paulson@14323
  1219
paulson@14323
  1220
lemma complex_eq_cancel_iff: "(complex_of_real xa + ii * complex_of_real ya =
paulson@14323
  1221
       complex_of_real xb + ii * complex_of_real yb) = ((xa = xb) & (ya = yb))"
paulson@14323
  1222
apply (auto intro: complex_eq_Im_eq complex_eq_Re_eq)
paulson@14323
  1223
done
paulson@14323
  1224
declare complex_eq_cancel_iff [iff]
paulson@14323
  1225
paulson@14323
  1226
lemma complex_eq_cancel_iffA: "(complex_of_real xa + complex_of_real ya * ii =
paulson@14323
  1227
       complex_of_real xb + complex_of_real yb * ii ) = ((xa = xb) & (ya = yb))"
paulson@14323
  1228
apply (auto simp add: complex_mult_commute)
paulson@14323
  1229
done
paulson@14323
  1230
declare complex_eq_cancel_iffA [iff]
paulson@14323
  1231
paulson@14323
  1232
lemma complex_eq_cancel_iffB: "(complex_of_real xa + complex_of_real ya * ii =
paulson@14323
  1233
       complex_of_real xb + ii * complex_of_real yb) = ((xa = xb) & (ya = yb))"
paulson@14323
  1234
apply (auto simp add: complex_mult_commute)
paulson@14323
  1235
done
paulson@14323
  1236
declare complex_eq_cancel_iffB [iff]
paulson@14323
  1237
paulson@14323
  1238
lemma complex_eq_cancel_iffC: "(complex_of_real xa + ii * complex_of_real ya  =
paulson@14323
  1239
       complex_of_real xb + complex_of_real yb * ii) = ((xa = xb) & (ya = yb))"
paulson@14323
  1240
apply (auto simp add: complex_mult_commute)
paulson@14323
  1241
done
paulson@14323
  1242
declare complex_eq_cancel_iffC [iff]
paulson@14323
  1243
paulson@14323
  1244
lemma complex_eq_cancel_iff2: "(complex_of_real x + ii * complex_of_real y =
paulson@14323
  1245
      complex_of_real xa) = (x = xa & y = 0)"
paulson@14323
  1246
apply (cut_tac xa = "x" and ya = "y" and xb = "xa" and yb = "0" in complex_eq_cancel_iff)
paulson@14323
  1247
apply (simp del: complex_eq_cancel_iff)
paulson@14323
  1248
done
paulson@14323
  1249
declare complex_eq_cancel_iff2 [simp]
paulson@14323
  1250
paulson@14323
  1251
lemma complex_eq_cancel_iff2a: "(complex_of_real x + complex_of_real y * ii =
paulson@14323
  1252
      complex_of_real xa) = (x = xa & y = 0)"
paulson@14323
  1253
apply (auto simp add: complex_mult_commute)
paulson@14323
  1254
done
paulson@14323
  1255
declare complex_eq_cancel_iff2a [simp]
paulson@14323
  1256
paulson@14323
  1257
lemma complex_eq_cancel_iff3: "(complex_of_real x + ii * complex_of_real y =
paulson@14323
  1258
      ii * complex_of_real ya) = (x = 0 & y = ya)"
paulson@14323
  1259
apply (cut_tac xa = "x" and ya = "y" and xb = "0" and yb = "ya" in complex_eq_cancel_iff)
paulson@14323
  1260
apply (simp del: complex_eq_cancel_iff)
paulson@14323
  1261
done
paulson@14323
  1262
declare complex_eq_cancel_iff3 [simp]
paulson@14323
  1263
paulson@14323
  1264
lemma complex_eq_cancel_iff3a: "(complex_of_real x + complex_of_real y * ii =
paulson@14323
  1265
      ii * complex_of_real ya) = (x = 0 & y = ya)"
paulson@14323
  1266
apply (auto simp add: complex_mult_commute)
paulson@14323
  1267
done
paulson@14323
  1268
declare complex_eq_cancel_iff3a [simp]
paulson@14323
  1269
paulson@14323
  1270
lemma complex_split_Re_zero:
paulson@14323
  1271
     "complex_of_real x + ii * complex_of_real y = 0
paulson@14323
  1272
      ==> x = 0"
paulson@14323
  1273
apply (unfold complex_of_real_def i_def complex_zero_def)
paulson@14323
  1274
apply (auto simp add: complex_mult complex_add)
paulson@14323
  1275
done
paulson@14323
  1276
paulson@14323
  1277
lemma complex_split_Im_zero:
paulson@14323
  1278
     "complex_of_real x + ii * complex_of_real y = 0
paulson@14323
  1279
      ==> y = 0"
paulson@14323
  1280
apply (unfold complex_of_real_def i_def complex_zero_def)
paulson@14323
  1281
apply (auto simp add: complex_mult complex_add)
paulson@14323
  1282
done
paulson@14323
  1283
paulson@14323
  1284
lemma Re_sgn:
paulson@14323
  1285
      "Re(sgn z) = Re(z)/cmod z"
paulson@14323
  1286
apply (unfold sgn_def complex_divide_def)
paulson@14323
  1287
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
  1288
apply (auto simp add: complex_of_real_inverse [symmetric])
paulson@14323
  1289
apply (auto simp add: complex_of_real_def complex_mult real_divide_def)
paulson@14323
  1290
done
paulson@14323
  1291
declare Re_sgn [simp]
paulson@14323
  1292
paulson@14323
  1293
lemma Im_sgn:
paulson@14323
  1294
      "Im(sgn z) = Im(z)/cmod z"
paulson@14323
  1295
apply (unfold sgn_def complex_divide_def)
paulson@14323
  1296
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
  1297
apply (auto simp add: complex_of_real_inverse [symmetric])
paulson@14323
  1298
apply (auto simp add: complex_of_real_def complex_mult real_divide_def)
paulson@14323
  1299
done
paulson@14323
  1300
declare Im_sgn [simp]
paulson@14323
  1301
paulson@14323
  1302
lemma complex_inverse_complex_split:
paulson@14323
  1303
     "inverse(complex_of_real x + ii * complex_of_real y) =
paulson@14323
  1304
      complex_of_real(x/(x ^ 2 + y ^ 2)) -
paulson@14323
  1305
      ii * complex_of_real(y/(x ^ 2 + y ^ 2))"
paulson@14323
  1306
apply (unfold complex_of_real_def i_def)
paulson@14323
  1307
apply (auto simp add: complex_mult complex_add complex_diff_def complex_minus complex_inverse real_divide_def)
paulson@14323
  1308
done
paulson@14323
  1309
paulson@14323
  1310
(*----------------------------------------------------------------------------*)
paulson@14323
  1311
(* Many of the theorems below need to be moved elsewhere e.g. Transc. Also *)
paulson@14323
  1312
(* many of the theorems are not used - so should they be kept?                *)
paulson@14323
  1313
(*----------------------------------------------------------------------------*)
paulson@14323
  1314
paulson@14323
  1315
lemma Re_mult_i_eq:
paulson@14323
  1316
    "Re (ii * complex_of_real y) = 0"
paulson@14323
  1317
apply (unfold i_def complex_of_real_def)
paulson@14323
  1318
apply (auto simp add: complex_mult)
paulson@14323
  1319
done
paulson@14323
  1320
declare Re_mult_i_eq [simp]
paulson@14323
  1321
paulson@14323
  1322
lemma Im_mult_i_eq:
paulson@14323
  1323
    "Im (ii * complex_of_real y) = y"
paulson@14323
  1324
apply (unfold i_def complex_of_real_def)
paulson@14323
  1325
apply (auto simp add: complex_mult)
paulson@14323
  1326
done
paulson@14323
  1327
declare Im_mult_i_eq [simp]
paulson@14323
  1328
paulson@14323
  1329
lemma complex_mod_mult_i:
paulson@14323
  1330
    "cmod (ii * complex_of_real y) = abs y"
paulson@14323
  1331
apply (unfold i_def complex_of_real_def)
paulson@14323
  1332
apply (auto simp add: complex_mult complex_mod real_power_two)
paulson@14323
  1333
done
paulson@14323
  1334
declare complex_mod_mult_i [simp]
paulson@14323
  1335
paulson@14323
  1336
lemma cos_arg_i_mult_zero:
paulson@14323
  1337
   "0 < y ==> cos (arg(ii * complex_of_real y)) = 0"
paulson@14323
  1338
apply (unfold arg_def)
paulson@14323
  1339
apply (auto simp add: abs_eqI2)
paulson@14323
  1340
apply (rule_tac a = "pi/2" in someI2)
paulson@14323
  1341
apply auto
paulson@14323
  1342
apply (rule order_less_trans [of _ 0])
paulson@14323
  1343
apply auto
paulson@14323
  1344
done
paulson@14323
  1345
declare cos_arg_i_mult_zero [simp]
paulson@14323
  1346
paulson@14323
  1347
lemma cos_arg_i_mult_zero2:
paulson@14323
  1348
   "y < 0 ==> cos (arg(ii * complex_of_real y)) = 0"
paulson@14323
  1349
apply (unfold arg_def)
paulson@14323
  1350
apply (auto simp add: abs_minus_eqI2)
paulson@14323
  1351
apply (rule_tac a = "- pi/2" in someI2)
paulson@14323
  1352
apply auto
paulson@14323
  1353
apply (rule order_trans [of _ 0])
paulson@14323
  1354
apply auto
paulson@14323
  1355
done
paulson@14323
  1356
declare cos_arg_i_mult_zero2 [simp]
paulson@14323
  1357
paulson@14323
  1358
lemma complex_of_real_not_zero_iff:
paulson@14323
  1359
      "(complex_of_real y ~= 0) = (y ~= 0)"
paulson@14323
  1360
apply (unfold complex_zero_def complex_of_real_def)
paulson@14323
  1361
apply auto
paulson@14323
  1362
done
paulson@14323
  1363
declare complex_of_real_not_zero_iff [simp]
paulson@14323
  1364
paulson@14323
  1365
lemma complex_of_real_zero_iff: "(complex_of_real y = 0) = (y = 0)"
paulson@14323
  1366
apply auto
paulson@14323
  1367
apply (rule ccontr , drule complex_of_real_not_zero_iff [THEN iffD2])
paulson@14323
  1368
apply simp
paulson@14323
  1369
done
paulson@14323
  1370
declare complex_of_real_zero_iff [simp]
paulson@14323
  1371
paulson@14323
  1372
lemma cos_arg_i_mult_zero3: "y ~= 0 ==> cos (arg(ii * complex_of_real y)) = 0"
paulson@14323
  1373
apply (cut_tac x = "y" and y = "0" in linorder_less_linear)
paulson@14323
  1374
apply auto
paulson@14323
  1375
done
paulson@14323
  1376
declare cos_arg_i_mult_zero3 [simp]
paulson@14323
  1377
paulson@14323
  1378
paulson@14323
  1379
subsection{*Finally! Polar Form for Complex Numbers*}
paulson@14323
  1380
paulson@14323
  1381
lemma complex_split_polar: "EX r a. z = complex_of_real r *
paulson@14323
  1382
      (complex_of_real(cos a) + ii * complex_of_real(sin a))"
paulson@14323
  1383
apply (cut_tac z = "z" in complex_split)
paulson@14323
  1384
apply (auto simp add: polar_Ex complex_add_mult_distrib2 complex_of_real_mult complex_mult_ac)
paulson@14323
  1385
done
paulson@14323
  1386
paulson@14323
  1387
lemma rcis_Ex: "EX r a. z = rcis r a"
paulson@14323
  1388
apply (unfold rcis_def cis_def)
paulson@14323
  1389
apply (rule complex_split_polar)
paulson@14323
  1390
done
paulson@14323
  1391
paulson@14323
  1392
lemma Re_complex_polar: "Re(complex_of_real r *
paulson@14323
  1393
      (complex_of_real(cos a) + ii * complex_of_real(sin a))) = r * cos a"
paulson@14323
  1394
apply (auto simp add: complex_add_mult_distrib2 complex_of_real_mult complex_mult_ac)
paulson@14323
  1395
done
paulson@14323
  1396
declare Re_complex_polar [simp]
paulson@14323
  1397
paulson@14323
  1398
lemma Re_rcis: "Re(rcis r a) = r * cos a"
paulson@14323
  1399
apply (unfold rcis_def cis_def)
paulson@14323
  1400
apply auto
paulson@14323
  1401
done
paulson@14323
  1402
declare Re_rcis [simp]
paulson@14323
  1403
paulson@14323
  1404
lemma Im_complex_polar: "Im(complex_of_real r *
paulson@14323
  1405
      (complex_of_real(cos a) + ii * complex_of_real(sin a))) = r * sin a"
paulson@14323
  1406
apply (auto simp add: complex_add_mult_distrib2 complex_of_real_mult complex_mult_ac)
paulson@14323
  1407
done
paulson@14323
  1408
declare Im_complex_polar [simp]
paulson@14323
  1409
paulson@14323
  1410
lemma Im_rcis: "Im(rcis r a) = r * sin a"
paulson@14323
  1411
apply (unfold rcis_def cis_def)
paulson@14323
  1412
apply auto
paulson@14323
  1413
done
paulson@14323
  1414
declare Im_rcis [simp]
paulson@14323
  1415
paulson@14323
  1416
lemma complex_mod_complex_polar: "cmod (complex_of_real r *
paulson@14323
  1417
      (complex_of_real(cos a) + ii * complex_of_real(sin a))) = abs r"
paulson@14323
  1418
apply (auto simp add: complex_add_mult_distrib2 cmod_i complex_of_real_mult real_add_mult_distrib2 [symmetric] realpow_mult complex_mult_ac real_mult_ac simp del: realpow_Suc)
paulson@14323
  1419
done
paulson@14323
  1420
declare complex_mod_complex_polar [simp]
paulson@14323
  1421
paulson@14323
  1422
lemma complex_mod_rcis: "cmod(rcis r a) = abs r"
paulson@14323
  1423
apply (unfold rcis_def cis_def)
paulson@14323
  1424
apply auto
paulson@14323
  1425
done
paulson@14323
  1426
declare complex_mod_rcis [simp]
paulson@14323
  1427
paulson@14323
  1428
lemma complex_mod_sqrt_Re_mult_cnj: "cmod z = sqrt (Re (z * cnj z))"
paulson@14323
  1429
apply (unfold cmod_def)
paulson@14323
  1430
apply (rule real_sqrt_eq_iff [THEN iffD2])
paulson@14323
  1431
apply (auto simp add: complex_mult_cnj)
paulson@14323
  1432
done
paulson@14323
  1433
paulson@14323
  1434
lemma complex_Re_cnj: "Re(cnj z) = Re z"
paulson@14323
  1435
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
  1436
apply (auto simp add: complex_cnj)
paulson@14323
  1437
done
paulson@14323
  1438
declare complex_Re_cnj [simp]
paulson@14323
  1439
paulson@14323
  1440
lemma complex_Im_cnj: "Im(cnj z) = - Im z"
paulson@14323
  1441
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
  1442
apply (auto simp add: complex_cnj)
paulson@14323
  1443
done
paulson@14323
  1444
declare complex_Im_cnj [simp]
paulson@14323
  1445
paulson@14323
  1446
lemma complex_In_mult_cnj_zero: "Im (z * cnj z) = 0"
paulson@14323
  1447
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
  1448
apply (auto simp add: complex_cnj complex_mult)
paulson@14323
  1449
done
paulson@14323
  1450
declare complex_In_mult_cnj_zero [simp]
paulson@14323
  1451
paulson@14323
  1452
lemma complex_Re_mult: "[| Im w = 0; Im z = 0 |] ==> Re(w * z) = Re(w) * Re(z)"
paulson@14323
  1453
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
  1454
apply (rule_tac z = "w" in eq_Abs_complex)
paulson@14323
  1455
apply (auto simp add: complex_mult)
paulson@14323
  1456
done
paulson@14323
  1457
paulson@14323
  1458
lemma complex_Re_mult_complex_of_real: "Re (z * complex_of_real c) = Re(z) * c"
paulson@14323
  1459
apply (unfold complex_of_real_def)
paulson@14323
  1460
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
  1461
apply (auto simp add: complex_mult)
paulson@14323
  1462
done
paulson@14323
  1463
declare complex_Re_mult_complex_of_real [simp]
paulson@14323
  1464
paulson@14323
  1465
lemma complex_Im_mult_complex_of_real: "Im (z * complex_of_real c) = Im(z) * c"
paulson@14323
  1466
apply (unfold complex_of_real_def)
paulson@14323
  1467
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
  1468
apply (auto simp add: complex_mult)
paulson@14323
  1469
done
paulson@14323
  1470
declare complex_Im_mult_complex_of_real [simp]
paulson@14323
  1471
paulson@14323
  1472
lemma complex_Re_mult_complex_of_real2: "Re (complex_of_real c * z) = c * Re(z)"
paulson@14323
  1473
apply (unfold complex_of_real_def)
paulson@14323
  1474
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
  1475
apply (auto simp add: complex_mult)
paulson@14323
  1476
done
paulson@14323
  1477
declare complex_Re_mult_complex_of_real2 [simp]
paulson@14323
  1478
paulson@14323
  1479
lemma complex_Im_mult_complex_of_real2: "Im (complex_of_real c * z) = c * Im(z)"
paulson@14323
  1480
apply (unfold complex_of_real_def)
paulson@14323
  1481
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
  1482
apply (auto simp add: complex_mult)
paulson@14323
  1483
done
paulson@14323
  1484
declare complex_Im_mult_complex_of_real2 [simp]
paulson@14323
  1485
paulson@14323
  1486
(*---------------------------------------------------------------------------*)
paulson@14323
  1487
(*  (r1 * cis a) * (r2 * cis b) = r1 * r2 * cis (a + b)                      *)
paulson@14323
  1488
(*---------------------------------------------------------------------------*)
paulson@14323
  1489
paulson@14323
  1490
lemma cis_rcis_eq: "cis a = rcis 1 a"
paulson@14323
  1491
apply (unfold rcis_def)
paulson@14323
  1492
apply (simp (no_asm))
paulson@14323
  1493
done
paulson@14323
  1494
paulson@14323
  1495
lemma rcis_mult:
paulson@14323
  1496
  "rcis r1 a * rcis r2 b = rcis (r1*r2) (a + b)"
paulson@14323
  1497
apply (unfold rcis_def cis_def)
paulson@14323
  1498
apply (auto simp add: cos_add sin_add complex_add_mult_distrib2 complex_add_mult_distrib complex_mult_ac complex_add_ac)
paulson@14323
  1499
apply (auto simp add: complex_add_mult_distrib2 [symmetric] complex_mult_assoc [symmetric] complex_of_real_mult complex_of_real_add complex_add_assoc [symmetric] i_mult_eq simp del: i_mult_eq2)
paulson@14323
  1500
apply (auto simp add: complex_add_ac)
paulson@14323
  1501
apply (auto simp add: complex_add_assoc [symmetric] complex_of_real_add real_add_mult_distrib2 real_diff_def mult_ac add_ac)
paulson@14323
  1502
done
paulson@14323
  1503
paulson@14323
  1504
lemma cis_mult: "cis a * cis b = cis (a + b)"
paulson@14323
  1505
apply (simp (no_asm) add: cis_rcis_eq rcis_mult)
paulson@14323
  1506
done
paulson@14323
  1507
paulson@14323
  1508
lemma cis_zero: "cis 0 = 1"
paulson@14323
  1509
apply (unfold cis_def)
paulson@14323
  1510
apply auto
paulson@14323
  1511
done
paulson@14323
  1512
declare cis_zero [simp]
paulson@14323
  1513
paulson@14323
  1514
lemma cis_zero2: "cis 0 = complex_of_real 1"
paulson@14323
  1515
apply (unfold cis_def)
paulson@14323
  1516
apply auto
paulson@14323
  1517
done
paulson@14323
  1518
declare cis_zero2 [simp]
paulson@14323
  1519
paulson@14323
  1520
lemma rcis_zero_mod: "rcis 0 a = 0"
paulson@14323
  1521
apply (unfold rcis_def)
paulson@14323
  1522
apply (simp (no_asm))
paulson@14323
  1523
done
paulson@14323
  1524
declare rcis_zero_mod [simp]
paulson@14323
  1525
paulson@14323
  1526
lemma rcis_zero_arg: "rcis r 0 = complex_of_real r"
paulson@14323
  1527
apply (unfold rcis_def)
paulson@14323
  1528
apply (simp (no_asm))
paulson@14323
  1529
done
paulson@14323
  1530
declare rcis_zero_arg [simp]
paulson@14323
  1531
paulson@14323
  1532
lemma complex_of_real_minus_one:
paulson@14323
  1533
   "complex_of_real (-(1::real)) = -(1::complex)"
paulson@14323
  1534
apply (unfold complex_of_real_def complex_one_def)
paulson@14323
  1535
apply (simp (no_asm) add: complex_minus)
paulson@14323
  1536
done
paulson@14323
  1537
paulson@14323
  1538
lemma complex_i_mult_minus: "ii * (ii * x) = - x"
paulson@14323
  1539
apply (simp (no_asm) add: complex_mult_assoc [symmetric])
paulson@14323
  1540
done
paulson@14323
  1541
declare complex_i_mult_minus [simp]
paulson@14323
  1542
paulson@14323
  1543
lemma complex_i_mult_minus2: "ii * ii * x = - x"
paulson@14323
  1544
apply (simp (no_asm))
paulson@14323
  1545
done
paulson@14323
  1546
declare complex_i_mult_minus2 [simp]
paulson@14323
  1547
paulson@14323
  1548
lemma cis_real_of_nat_Suc_mult:
paulson@14323
  1549
   "cis (real (Suc n) * a) = cis a * cis (real n * a)"
paulson@14323
  1550
apply (unfold cis_def)
paulson@14323
  1551
apply (auto simp add: real_of_nat_Suc real_add_mult_distrib cos_add sin_add complex_add_mult_distrib complex_add_mult_distrib2 complex_of_real_add complex_of_real_mult complex_mult_ac complex_add_ac)
paulson@14323
  1552
apply (auto simp add: complex_add_mult_distrib2 [symmetric] complex_mult_assoc [symmetric] i_mult_eq complex_of_real_mult complex_of_real_add complex_add_assoc [symmetric] complex_of_real_minus [symmetric] real_diff_def mult_ac simp del: i_mult_eq2)
paulson@14323
  1553
done
paulson@14323
  1554
paulson@14323
  1555
lemma DeMoivre: "(cis a) ^ n = cis (real n * a)"
paulson@14323
  1556
apply (induct_tac "n")
paulson@14323
  1557
apply (auto simp add: cis_real_of_nat_Suc_mult)
paulson@14323
  1558
done
paulson@14323
  1559
paulson@14323
  1560
lemma DeMoivre2:
paulson@14323
  1561
   "(rcis r a) ^ n = rcis (r ^ n) (real n * a)"
paulson@14323
  1562
apply (unfold rcis_def)
paulson@14323
  1563
apply (auto simp add: complexpow_mult DeMoivre complex_of_real_pow)
paulson@14323
  1564
done
paulson@14323
  1565
paulson@14323
  1566
lemma cis_inverse: "inverse(cis a) = cis (-a)"
paulson@14323
  1567
apply (unfold cis_def)
paulson@14323
  1568
apply (auto simp add: complex_inverse_complex_split complex_of_real_minus complex_diff_def)
paulson@14323
  1569
done
paulson@14323
  1570
declare cis_inverse [simp]
paulson@14323
  1571
paulson@14323
  1572
lemma rcis_inverse: "inverse(rcis r a) = rcis (1/r) (-a)"
paulson@14323
  1573
apply (case_tac "r=0")
paulson@14323
  1574
apply (simp (no_asm_simp) add: DIVISION_BY_ZERO COMPLEX_INVERSE_ZERO)
paulson@14323
  1575
apply (auto simp add: complex_inverse_complex_split complex_add_mult_distrib2 complex_of_real_mult rcis_def cis_def real_power_two complex_mult_ac real_mult_ac)
paulson@14323
  1576
apply (auto simp add: real_add_mult_distrib2 [symmetric] complex_of_real_minus complex_diff_def)
paulson@14323
  1577
done
paulson@14323
  1578
paulson@14323
  1579
lemma cis_divide: "cis a / cis b = cis (a - b)"
paulson@14323
  1580
apply (unfold complex_divide_def)
paulson@14323
  1581
apply (auto simp add: cis_mult real_diff_def)
paulson@14323
  1582
done
paulson@14323
  1583
paulson@14323
  1584
lemma rcis_divide:
paulson@14323
  1585
 "rcis r1 a / rcis r2 b = rcis (r1/r2) (a - b)"
paulson@14323
  1586
apply (unfold complex_divide_def)
paulson@14323
  1587
apply (case_tac "r2=0")
paulson@14323
  1588
apply (simp (no_asm_simp) add: DIVISION_BY_ZERO COMPLEX_INVERSE_ZERO)
paulson@14323
  1589
apply (auto simp add: rcis_inverse rcis_mult real_diff_def)
paulson@14323
  1590
done
paulson@14323
  1591
paulson@14323
  1592
lemma Re_cis: "Re(cis a) = cos a"
paulson@14323
  1593
apply (unfold cis_def)
paulson@14323
  1594
apply auto
paulson@14323
  1595
done
paulson@14323
  1596
declare Re_cis [simp]
paulson@14323
  1597
paulson@14323
  1598
lemma Im_cis: "Im(cis a) = sin a"
paulson@14323
  1599
apply (unfold cis_def)
paulson@14323
  1600
apply auto
paulson@14323
  1601
done
paulson@14323
  1602
declare Im_cis [simp]
paulson@14323
  1603
paulson@14323
  1604
lemma cos_n_Re_cis_pow_n: "cos (real n * a) = Re(cis a ^ n)"
paulson@14323
  1605
apply (auto simp add: DeMoivre)
paulson@14323
  1606
done
paulson@14323
  1607
paulson@14323
  1608
lemma sin_n_Im_cis_pow_n: "sin (real n * a) = Im(cis a ^ n)"
paulson@14323
  1609
apply (auto simp add: DeMoivre)
paulson@14323
  1610
done
paulson@14323
  1611
paulson@14323
  1612
lemma expi_Im_split:
paulson@14323
  1613
    "expi (ii * complex_of_real y) =
paulson@14323
  1614
     complex_of_real (cos y) + ii * complex_of_real (sin y)"
paulson@14323
  1615
apply (unfold expi_def cis_def)
paulson@14323
  1616
apply auto
paulson@14323
  1617
done
paulson@14323
  1618
paulson@14323
  1619
lemma expi_Im_cis:
paulson@14323
  1620
    "expi (ii * complex_of_real y) = cis y"
paulson@14323
  1621
apply (unfold expi_def)
paulson@14323
  1622
apply auto
paulson@14323
  1623
done
paulson@14323
  1624
paulson@14323
  1625
lemma expi_add: "expi(a + b) = expi(a) * expi(b)"
paulson@14323
  1626
apply (unfold expi_def)
paulson@14323
  1627
apply (auto simp add: complex_Re_add exp_add complex_Im_add cis_mult [symmetric] complex_of_real_mult complex_mult_ac)
paulson@14323
  1628
done
paulson@14323
  1629
paulson@14323
  1630
lemma expi_complex_split:
paulson@14323
  1631
     "expi(complex_of_real x + ii * complex_of_real y) =
paulson@14323
  1632
      complex_of_real (exp(x)) * cis y"
paulson@14323
  1633
apply (unfold expi_def)
paulson@14323
  1634
apply auto
paulson@14323
  1635
done
paulson@14323
  1636
paulson@14323
  1637
lemma expi_zero: "expi (0::complex) = 1"
paulson@14323
  1638
apply (unfold expi_def)
paulson@14323
  1639
apply auto
paulson@14323
  1640
done
paulson@14323
  1641
declare expi_zero [simp]
paulson@14323
  1642
paulson@14323
  1643
lemma complex_Re_mult_eq: "Re (w * z) = Re w * Re z - Im w * Im z"
paulson@14323
  1644
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
  1645
apply (rule_tac z = "w" in eq_Abs_complex)
paulson@14323
  1646
apply (auto simp add: complex_mult)
paulson@14323
  1647
done
paulson@14323
  1648
paulson@14323
  1649
lemma complex_Im_mult_eq:
paulson@14323
  1650
     "Im (w * z) = Re w * Im z + Im w * Re z"
paulson@14323
  1651
apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323
  1652
apply (rule_tac z = "w" in eq_Abs_complex)
paulson@14323
  1653
apply (auto simp add: complex_mult)
paulson@14323
  1654
done
paulson@14323
  1655
paulson@14323
  1656
lemma complex_expi_Ex: 
paulson@14323
  1657
   "EX a r. z = complex_of_real r * expi a"
paulson@14323
  1658
apply (cut_tac z = "z" in rcis_Ex)
paulson@14323
  1659
apply (auto simp add: expi_def rcis_def complex_mult_assoc [symmetric] complex_of_real_mult)
paulson@14323
  1660
apply (rule_tac x = "ii * complex_of_real a" in exI)
paulson@14323
  1661
apply auto
paulson@14323
  1662
done
paulson@14323
  1663
paulson@14323
  1664
paulson@14323
  1665
(****
paulson@14323
  1666
Goal "[| - pi < a; a <= pi |] ==> (-pi < a & a <= 0) | (0 <= a & a <= pi)"
paulson@14323
  1667
by Auto_tac;
paulson@14323
  1668
qed "lemma_split_interval";
paulson@14323
  1669
paulson@14323
  1670
Goalw [arg_def]
paulson@14323
  1671
  "[| r ~= 0; - pi < a; a <= pi |] \
paulson@14323
  1672
\  ==> arg(complex_of_real r * \
paulson@14323
  1673
\      (complex_of_real(cos a) + ii * complex_of_real(sin a))) = a";
paulson@14323
  1674
by Auto_tac;
paulson@14323
  1675
by (cut_inst_tac [("x","0"),("y","r")] linorder_less_linear 1);
paulson@14323
  1676
by (auto_tac (claset(),simpset() addsimps (map (full_rename_numerals thy)
paulson@14323
  1677
    [rabs_eqI2,rabs_minus_eqI2,real_minus_rinv]) [real_divide_def,
paulson@14323
  1678
    real_minus_mult_eq2 RS sym] real_mult_ac));
paulson@14323
  1679
by (auto_tac (claset(),simpset() addsimps [real_mult_assoc RS sym]));
paulson@14323
  1680
by (dtac lemma_split_interval 1 THEN safe);
paulson@14323
  1681
****)
paulson@14323
  1682
paulson@14323
  1683
paulson@14323
  1684
ML
paulson@14323
  1685
{*
paulson@14323
  1686
val complex_zero_def = thm"complex_zero_def";
paulson@14323
  1687
val complex_one_def = thm"complex_one_def";
paulson@14323
  1688
val complex_minus_def = thm"complex_minus_def";
paulson@14323
  1689
val complex_diff_def = thm"complex_diff_def";
paulson@14323
  1690
val complex_divide_def = thm"complex_divide_def";
paulson@14323
  1691
val complex_mult_def = thm"complex_mult_def";
paulson@14323
  1692
val complex_add_def = thm"complex_add_def";
paulson@14323
  1693
val complex_of_real_def = thm"complex_of_real_def";
paulson@14323
  1694
val i_def = thm"i_def";
paulson@14323
  1695
val expi_def = thm"expi_def";
paulson@14323
  1696
val cis_def = thm"cis_def";
paulson@14323
  1697
val rcis_def = thm"rcis_def";
paulson@14323
  1698
val cmod_def = thm"cmod_def";
paulson@14323
  1699
val cnj_def = thm"cnj_def";
paulson@14323
  1700
val sgn_def = thm"sgn_def";
paulson@14323
  1701
val arg_def = thm"arg_def";
paulson@14323
  1702
val complexpow_0 = thm"complexpow_0";
paulson@14323
  1703
val complexpow_Suc = thm"complexpow_Suc";
paulson@14323
  1704
paulson@14323
  1705
val inj_Rep_complex = thm"inj_Rep_complex";
paulson@14323
  1706
val inj_Abs_complex = thm"inj_Abs_complex";
paulson@14323
  1707
val Abs_complex_cancel_iff = thm"Abs_complex_cancel_iff";
paulson@14323
  1708
val pair_mem_complex = thm"pair_mem_complex";
paulson@14323
  1709
val Abs_complex_inverse2 = thm"Abs_complex_inverse2";
paulson@14323
  1710
val eq_Abs_complex = thm"eq_Abs_complex";
paulson@14323
  1711
val Re = thm"Re";
paulson@14323
  1712
val Im = thm"Im";
paulson@14323
  1713
val Abs_complex_cancel = thm"Abs_complex_cancel";
paulson@14323
  1714
val complex_Re_Im_cancel_iff = thm"complex_Re_Im_cancel_iff";
paulson@14323
  1715
val complex_Re_zero = thm"complex_Re_zero";
paulson@14323
  1716
val complex_Im_zero = thm"complex_Im_zero";
paulson@14323
  1717
val complex_Re_one = thm"complex_Re_one";
paulson@14323
  1718
val complex_Im_one = thm"complex_Im_one";
paulson@14323
  1719
val complex_Re_i = thm"complex_Re_i";
paulson@14323
  1720
val complex_Im_i = thm"complex_Im_i";
paulson@14323
  1721
val Re_complex_of_real_zero = thm"Re_complex_of_real_zero";
paulson@14323
  1722
val Im_complex_of_real_zero = thm"Im_complex_of_real_zero";
paulson@14323
  1723
val Re_complex_of_real_one = thm"Re_complex_of_real_one";
paulson@14323
  1724
val Im_complex_of_real_one = thm"Im_complex_of_real_one";
paulson@14323
  1725
val Re_complex_of_real = thm"Re_complex_of_real";
paulson@14323
  1726
val Im_complex_of_real = thm"Im_complex_of_real";
paulson@14323
  1727
val complex_minus = thm"complex_minus";
paulson@14323
  1728
val complex_Re_minus = thm"complex_Re_minus";
paulson@14323
  1729
val complex_Im_minus = thm"complex_Im_minus";
paulson@14323
  1730
val complex_minus_minus = thm"complex_minus_minus";
paulson@14323
  1731
val inj_complex_minus = thm"inj_complex_minus";
paulson@14323
  1732
val complex_minus_zero = thm"complex_minus_zero";
paulson@14323
  1733
val complex_minus_zero_iff = thm"complex_minus_zero_iff";
paulson@14323
  1734
val complex_minus_zero_iff2 = thm"complex_minus_zero_iff2";
paulson@14323
  1735
val complex_minus_not_zero_iff = thm"complex_minus_not_zero_iff";
paulson@14323
  1736
val complex_add = thm"complex_add";
paulson@14323
  1737
val complex_Re_add = thm"complex_Re_add";
paulson@14323
  1738
val complex_Im_add = thm"complex_Im_add";
paulson@14323
  1739
val complex_add_commute = thm"complex_add_commute";
paulson@14323
  1740
val complex_add_assoc = thm"complex_add_assoc";
paulson@14323
  1741
val complex_add_left_commute = thm"complex_add_left_commute";
paulson@14323
  1742
val complex_add_zero_left = thm"complex_add_zero_left";
paulson@14323
  1743
val complex_add_zero_right = thm"complex_add_zero_right";
paulson@14323
  1744
val complex_add_minus_right_zero = thm"complex_add_minus_right_zero";
paulson@14323
  1745
val complex_add_minus_left_zero = thm"complex_add_minus_left_zero";
paulson@14323
  1746
val complex_add_minus_cancel = thm"complex_add_minus_cancel";
paulson@14323
  1747
val complex_minus_add_cancel = thm"complex_minus_add_cancel";
paulson@14323
  1748
val complex_add_minus_eq_minus = thm"complex_add_minus_eq_minus";
paulson@14323
  1749
val complex_minus_add_distrib = thm"complex_minus_add_distrib";
paulson@14323
  1750
val complex_add_left_cancel = thm"complex_add_left_cancel";
paulson@14323
  1751
val complex_add_right_cancel = thm"complex_add_right_cancel";
paulson@14323
  1752
val complex_eq_minus_iff = thm"complex_eq_minus_iff";
paulson@14323
  1753
val complex_eq_minus_iff2 = thm"complex_eq_minus_iff2";
paulson@14323
  1754
val complex_diff_0 = thm"complex_diff_0";
paulson@14323
  1755
val complex_diff_0_right = thm"complex_diff_0_right";
paulson@14323
  1756
val complex_diff_self = thm"complex_diff_self";
paulson@14323
  1757
val complex_diff = thm"complex_diff";
paulson@14323
  1758
val complex_diff_eq_eq = thm"complex_diff_eq_eq";
paulson@14323
  1759
val complex_mult = thm"complex_mult";
paulson@14323
  1760
val complex_mult_commute = thm"complex_mult_commute";
paulson@14323
  1761
val complex_mult_assoc = thm"complex_mult_assoc";
paulson@14323
  1762
val complex_mult_left_commute = thm"complex_mult_left_commute";
paulson@14323
  1763
val complex_mult_one_left = thm"complex_mult_one_left";
paulson@14323
  1764
val complex_mult_one_right = thm"complex_mult_one_right";
paulson@14323
  1765
val complex_mult_zero_left = thm"complex_mult_zero_left";
paulson@14323
  1766
val complex_mult_zero_right = thm"complex_mult_zero_right";
paulson@14323
  1767
val complex_divide_zero = thm"complex_divide_zero";
paulson@14323
  1768
val complex_minus_mult_eq1 = thm"complex_minus_mult_eq1";
paulson@14323
  1769
val complex_minus_mult_eq2 = thm"complex_minus_mult_eq2";
paulson@14323
  1770
val complex_mult_minus_one = thm"complex_mult_minus_one";
paulson@14323
  1771
val complex_mult_minus_one_right = thm"complex_mult_minus_one_right";
paulson@14323
  1772
val complex_minus_mult_cancel = thm"complex_minus_mult_cancel";
paulson@14323
  1773
val complex_minus_mult_commute = thm"complex_minus_mult_commute";
paulson@14323
  1774
val complex_add_mult_distrib = thm"complex_add_mult_distrib";
paulson@14323
  1775
val complex_add_mult_distrib2 = thm"complex_add_mult_distrib2";
paulson@14323
  1776
val complex_zero_not_eq_one = thm"complex_zero_not_eq_one";
paulson@14323
  1777
val complex_inverse = thm"complex_inverse";
paulson@14323
  1778
val COMPLEX_INVERSE_ZERO = thm"COMPLEX_INVERSE_ZERO";
paulson@14323
  1779
val COMPLEX_DIVISION_BY_ZERO = thm"COMPLEX_DIVISION_BY_ZERO";
paulson@14323
  1780
val complex_mult_inv_left = thm"complex_mult_inv_left";
paulson@14323
  1781
val complex_mult_inv_right = thm"complex_mult_inv_right";
paulson@14323
  1782
val complex_mult_left_cancel = thm"complex_mult_left_cancel";
paulson@14323
  1783
val complex_mult_right_cancel = thm"complex_mult_right_cancel";
paulson@14323
  1784
val complex_inverse_not_zero = thm"complex_inverse_not_zero";
paulson@14323
  1785
val complex_mult_not_zero = thm"complex_mult_not_zero";
paulson@14323
  1786
val complex_inverse_inverse = thm"complex_inverse_inverse";
paulson@14323
  1787
val complex_inverse_one = thm"complex_inverse_one";
paulson@14323
  1788
val complex_minus_inverse = thm"complex_minus_inverse";
paulson@14323
  1789
val complex_inverse_distrib = thm"complex_inverse_distrib";
paulson@14323
  1790
val complex_times_divide1_eq = thm"complex_times_divide1_eq";
paulson@14323
  1791
val complex_times_divide2_eq = thm"complex_times_divide2_eq";
paulson@14323
  1792
val complex_divide_divide1_eq = thm"complex_divide_divide1_eq";
paulson@14323
  1793
val complex_divide_divide2_eq = thm"complex_divide_divide2_eq";
paulson@14323
  1794
val complex_minus_divide_eq = thm"complex_minus_divide_eq";
paulson@14323
  1795
val complex_divide_minus_eq = thm"complex_divide_minus_eq";
paulson@14323
  1796
val complex_add_divide_distrib = thm"complex_add_divide_distrib";
paulson@14323
  1797
val inj_complex_of_real = thm"inj_complex_of_real";
paulson@14323
  1798
val complex_of_real_one = thm"complex_of_real_one";
paulson@14323
  1799
val complex_of_real_zero = thm"complex_of_real_zero";
paulson@14323
  1800
val complex_of_real_eq_iff = thm"complex_of_real_eq_iff";
paulson@14323
  1801
val complex_of_real_minus = thm"complex_of_real_minus";
paulson@14323
  1802
val complex_of_real_inverse = thm"complex_of_real_inverse";
paulson@14323
  1803
val complex_of_real_add = thm"complex_of_real_add";
paulson@14323
  1804
val complex_of_real_diff = thm"complex_of_real_diff";
paulson@14323
  1805
val complex_of_real_mult = thm"complex_of_real_mult";
paulson@14323
  1806
val complex_of_real_divide = thm"complex_of_real_divide";
paulson@14323
  1807
val complex_of_real_pow = thm"complex_of_real_pow";
paulson@14323
  1808
val complex_mod = thm"complex_mod";
paulson@14323
  1809
val complex_mod_zero = thm"complex_mod_zero";
paulson@14323
  1810
val complex_mod_one = thm"complex_mod_one";
paulson@14323
  1811
val complex_mod_complex_of_real = thm"complex_mod_complex_of_real";
paulson@14323
  1812
val complex_of_real_abs = thm"complex_of_real_abs";
paulson@14323
  1813
val complex_cnj = thm"complex_cnj";
paulson@14323
  1814
val inj_cnj = thm"inj_cnj";
paulson@14323
  1815
val complex_cnj_cancel_iff = thm"complex_cnj_cancel_iff";
paulson@14323
  1816
val complex_cnj_cnj = thm"complex_cnj_cnj";
paulson@14323
  1817
val complex_cnj_complex_of_real = thm"complex_cnj_complex_of_real";
paulson@14323
  1818
val complex_mod_cnj = thm"complex_mod_cnj";
paulson@14323
  1819
val complex_cnj_minus = thm"complex_cnj_minus";
paulson@14323
  1820
val complex_cnj_inverse = thm"complex_cnj_inverse";
paulson@14323
  1821
val complex_cnj_add = thm"complex_cnj_add";
paulson@14323
  1822
val complex_cnj_diff = thm"complex_cnj_diff";
paulson@14323
  1823
val complex_cnj_mult = thm"complex_cnj_mult";
paulson@14323
  1824
val complex_cnj_divide = thm"complex_cnj_divide";
paulson@14323
  1825
val complex_cnj_one = thm"complex_cnj_one";
paulson@14323
  1826
val complex_cnj_pow = thm"complex_cnj_pow";
paulson@14323
  1827
val complex_add_cnj = thm"complex_add_cnj";
paulson@14323
  1828
val complex_diff_cnj = thm"complex_diff_cnj";
paulson@14323
  1829
val complex_cnj_zero = thm"complex_cnj_zero";
paulson@14323
  1830
val complex_cnj_zero_iff = thm"complex_cnj_zero_iff";
paulson@14323
  1831
val complex_mult_cnj = thm"complex_mult_cnj";
paulson@14323
  1832
val complex_mult_zero_iff = thm"complex_mult_zero_iff";
paulson@14323
  1833
val complex_add_left_cancel_zero = thm"complex_add_left_cancel_zero";
paulson@14323
  1834
val complex_diff_mult_distrib = thm"complex_diff_mult_distrib";
paulson@14323
  1835
val complex_diff_mult_distrib2 = thm"complex_diff_mult_distrib2";
paulson@14323
  1836
val complex_mod_eq_zero_cancel = thm"complex_mod_eq_zero_cancel";
paulson@14323
  1837
val complex_mod_complex_of_real_of_nat = thm"complex_mod_complex_of_real_of_nat";
paulson@14323
  1838
val complex_mod_minus = thm"complex_mod_minus";
paulson@14323
  1839
val complex_mod_mult_cnj = thm"complex_mod_mult_cnj";
paulson@14323
  1840
val complex_mod_squared = thm"complex_mod_squared";
paulson@14323
  1841
val complex_mod_ge_zero = thm"complex_mod_ge_zero";
paulson@14323
  1842
val abs_cmod_cancel = thm"abs_cmod_cancel";
paulson@14323
  1843
val complex_mod_mult = thm"complex_mod_mult";
paulson@14323
  1844
val complex_mod_add_squared_eq = thm"complex_mod_add_squared_eq";
paulson@14323
  1845
val complex_Re_mult_cnj_le_cmod = thm"complex_Re_mult_cnj_le_cmod";
paulson@14323
  1846
val complex_Re_mult_cnj_le_cmod2 = thm"complex_Re_mult_cnj_le_cmod2";
paulson@14323
  1847
val real_sum_squared_expand = thm"real_sum_squared_expand";
paulson@14323
  1848
val complex_mod_triangle_squared = thm"complex_mod_triangle_squared";
paulson@14323
  1849
val complex_mod_minus_le_complex_mod = thm"complex_mod_minus_le_complex_mod";
paulson@14323
  1850
val complex_mod_triangle_ineq = thm"complex_mod_triangle_ineq";
paulson@14323
  1851
val complex_mod_triangle_ineq2 = thm"complex_mod_triangle_ineq2";
paulson@14323
  1852
val complex_mod_diff_commute = thm"complex_mod_diff_commute";
paulson@14323
  1853
val complex_mod_add_less = thm"complex_mod_add_less";
paulson@14323
  1854
val complex_mod_mult_less = thm"complex_mod_mult_less";
paulson@14323
  1855
val complex_mod_diff_ineq = thm"complex_mod_diff_ineq";
paulson@14323
  1856
val complex_Re_le_cmod = thm"complex_Re_le_cmod";
paulson@14323
  1857
val complex_mod_gt_zero = thm"complex_mod_gt_zero";
paulson@14323
  1858
val complex_mod_complexpow = thm"complex_mod_complexpow";
paulson@14323
  1859
val complexpow_minus = thm"complexpow_minus";
paulson@14323
  1860
val complex_inverse_minus = thm"complex_inverse_minus";
paulson@14323
  1861
val complex_divide_one = thm"complex_divide_one";
paulson@14323
  1862
val complex_mod_inverse = thm"complex_mod_inverse";
paulson@14323
  1863
val complex_mod_divide = thm"complex_mod_divide";
paulson@14323
  1864
val complex_inverse_divide = thm"complex_inverse_divide";
paulson@14323
  1865
val complexpow_mult = thm"complexpow_mult";
paulson@14323
  1866
val complexpow_zero = thm"complexpow_zero";
paulson@14323
  1867
val complexpow_not_zero = thm"complexpow_not_zero";
paulson@14323
  1868
val complexpow_zero_zero = thm"complexpow_zero_zero";
paulson@14323
  1869
val complexpow_i_squared = thm"complexpow_i_squared";
paulson@14323
  1870
val complex_i_not_zero = thm"complex_i_not_zero";
paulson@14323
  1871
val complex_mult_eq_zero_cancel1 = thm"complex_mult_eq_zero_cancel1";
paulson@14323
  1872
val complex_mult_eq_zero_cancel2 = thm"complex_mult_eq_zero_cancel2";
paulson@14323
  1873
val complex_mult_not_eq_zero_iff = thm"complex_mult_not_eq_zero_iff";
paulson@14323
  1874
val complexpow_inverse = thm"complexpow_inverse";
paulson@14323
  1875
val sgn_zero = thm"sgn_zero";
paulson@14323
  1876
val sgn_one = thm"sgn_one";
paulson@14323
  1877
val sgn_minus = thm"sgn_minus";
paulson@14323
  1878
val sgn_eq = thm"sgn_eq";
paulson@14323
  1879
val complex_split = thm"complex_split";
paulson@14323
  1880
val Re_complex_i = thm"Re_complex_i";
paulson@14323
  1881
val Im_complex_i = thm"Im_complex_i";
paulson@14323
  1882
val i_mult_eq = thm"i_mult_eq";
paulson@14323
  1883
val i_mult_eq2 = thm"i_mult_eq2";
paulson@14323
  1884
val cmod_i = thm"cmod_i";
paulson@14323
  1885
val complex_eq_Re_eq = thm"complex_eq_Re_eq";
paulson@14323
  1886
val complex_eq_Im_eq = thm"complex_eq_Im_eq";
paulson@14323
  1887
val complex_eq_cancel_iff = thm"complex_eq_cancel_iff";
paulson@14323
  1888
val complex_eq_cancel_iffA = thm"complex_eq_cancel_iffA";
paulson@14323
  1889
val complex_eq_cancel_iffB = thm"complex_eq_cancel_iffB";
paulson@14323
  1890
val complex_eq_cancel_iffC = thm"complex_eq_cancel_iffC";
paulson@14323
  1891
val complex_eq_cancel_iff2 = thm"complex_eq_cancel_iff2";
paulson@14323
  1892
val complex_eq_cancel_iff2a = thm"complex_eq_cancel_iff2a";
paulson@14323
  1893
val complex_eq_cancel_iff3 = thm"complex_eq_cancel_iff3";
paulson@14323
  1894
val complex_eq_cancel_iff3a = thm"complex_eq_cancel_iff3a";
paulson@14323
  1895
val complex_split_Re_zero = thm"complex_split_Re_zero";
paulson@14323
  1896
val complex_split_Im_zero = thm"complex_split_Im_zero";
paulson@14323
  1897
val Re_sgn = thm"Re_sgn";
paulson@14323
  1898
val Im_sgn = thm"Im_sgn";
paulson@14323
  1899
val complex_inverse_complex_split = thm"complex_inverse_complex_split";
paulson@14323
  1900
val Re_mult_i_eq = thm"Re_mult_i_eq";
paulson@14323
  1901
val Im_mult_i_eq = thm"Im_mult_i_eq";
paulson@14323
  1902
val complex_mod_mult_i = thm"complex_mod_mult_i";
paulson@14323
  1903
val cos_arg_i_mult_zero = thm"cos_arg_i_mult_zero";
paulson@14323
  1904
val cos_arg_i_mult_zero2 = thm"cos_arg_i_mult_zero2";
paulson@14323
  1905
val complex_of_real_not_zero_iff = thm"complex_of_real_not_zero_iff";
paulson@14323
  1906
val complex_of_real_zero_iff = thm"complex_of_real_zero_iff";
paulson@14323
  1907
val cos_arg_i_mult_zero3 = thm"cos_arg_i_mult_zero3";
paulson@14323
  1908
val complex_split_polar = thm"complex_split_polar";
paulson@14323
  1909
val rcis_Ex = thm"rcis_Ex";
paulson@14323
  1910
val Re_complex_polar = thm"Re_complex_polar";
paulson@14323
  1911
val Re_rcis = thm"Re_rcis";
paulson@14323
  1912
val Im_complex_polar = thm"Im_complex_polar";
paulson@14323
  1913
val Im_rcis = thm"Im_rcis";
paulson@14323
  1914
val complex_mod_complex_polar = thm"complex_mod_complex_polar";
paulson@14323
  1915
val complex_mod_rcis = thm"complex_mod_rcis";
paulson@14323
  1916
val complex_mod_sqrt_Re_mult_cnj = thm"complex_mod_sqrt_Re_mult_cnj";
paulson@14323
  1917
val complex_Re_cnj = thm"complex_Re_cnj";
paulson@14323
  1918
val complex_Im_cnj = thm"complex_Im_cnj";
paulson@14323
  1919
val complex_In_mult_cnj_zero = thm"complex_In_mult_cnj_zero";
paulson@14323
  1920
val complex_Re_mult = thm"complex_Re_mult";
paulson@14323
  1921
val complex_Re_mult_complex_of_real = thm"complex_Re_mult_complex_of_real";
paulson@14323
  1922
val complex_Im_mult_complex_of_real = thm"complex_Im_mult_complex_of_real";
paulson@14323
  1923
val complex_Re_mult_complex_of_real2 = thm"complex_Re_mult_complex_of_real2";
paulson@14323
  1924
val complex_Im_mult_complex_of_real2 = thm"complex_Im_mult_complex_of_real2";
paulson@14323
  1925
val cis_rcis_eq = thm"cis_rcis_eq";
paulson@14323
  1926
val rcis_mult = thm"rcis_mult";
paulson@14323
  1927
val cis_mult = thm"cis_mult";
paulson@14323
  1928
val cis_zero = thm"cis_zero";
paulson@14323
  1929
val cis_zero2 = thm"cis_zero2";
paulson@14323
  1930
val rcis_zero_mod = thm"rcis_zero_mod";
paulson@14323
  1931
val rcis_zero_arg = thm"rcis_zero_arg";
paulson@14323
  1932
val complex_of_real_minus_one = thm"complex_of_real_minus_one";
paulson@14323
  1933
val complex_i_mult_minus = thm"complex_i_mult_minus";
paulson@14323
  1934
val complex_i_mult_minus2 = thm"complex_i_mult_minus2";
paulson@14323
  1935
val cis_real_of_nat_Suc_mult = thm"cis_real_of_nat_Suc_mult";
paulson@14323
  1936
val DeMoivre = thm"DeMoivre";
paulson@14323
  1937
val DeMoivre2 = thm"DeMoivre2";
paulson@14323
  1938
val cis_inverse = thm"cis_inverse";
paulson@14323
  1939
val rcis_inverse = thm"rcis_inverse";
paulson@14323
  1940
val cis_divide = thm"cis_divide";
paulson@14323
  1941
val rcis_divide = thm"rcis_divide";
paulson@14323
  1942
val Re_cis = thm"Re_cis";
paulson@14323
  1943
val Im_cis = thm"Im_cis";
paulson@14323
  1944
val cos_n_Re_cis_pow_n = thm"cos_n_Re_cis_pow_n";
paulson@14323
  1945
val sin_n_Im_cis_pow_n = thm"sin_n_Im_cis_pow_n";
paulson@14323
  1946
val expi_Im_split = thm"expi_Im_split";
paulson@14323
  1947
val expi_Im_cis = thm"expi_Im_cis";
paulson@14323
  1948
val expi_add = thm"expi_add";
paulson@14323
  1949
val expi_complex_split = thm"expi_complex_split";
paulson@14323
  1950
val expi_zero = thm"expi_zero";
paulson@14323
  1951
val complex_Re_mult_eq = thm"complex_Re_mult_eq";
paulson@14323
  1952
val complex_Im_mult_eq = thm"complex_Im_mult_eq";
paulson@14323
  1953
val complex_expi_Ex = thm"complex_expi_Ex";
paulson@14323
  1954
paulson@14323
  1955
val complex_add_ac = thms"complex_add_ac";
paulson@14323
  1956
val complex_mult_ac = thms"complex_mult_ac";
paulson@14323
  1957
*}
paulson@14323
  1958
paulson@13957
  1959
end
paulson@13957
  1960
paulson@13957
  1961