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