
paulson@13957: (*  Title:       Complex.thy
paulson@13957:     Author:      Jacques D. Fleuriot
paulson@13957:     Copyright:   2001 University of Edinburgh
paulson@13957:     Description: Complex numbers
paulson@13957: *)
paulson@13957: 
paulson@14323: theory Complex = HLog:
paulson@13957: 
paulson@13957: typedef complex = "{p::(real*real). True}"
paulson@14323:   by blast
paulson@13957: 
paulson@14323: instance complex :: zero ..
paulson@14323: instance complex :: one ..
paulson@14323: instance complex :: plus ..
paulson@14323: instance complex :: times ..
paulson@14323: instance complex :: minus ..
paulson@14323: instance complex :: inverse ..
paulson@14323: instance complex :: power ..
paulson@13957: 
paulson@13957: consts
paulson@14323:   "ii"    :: complex        ("ii")
paulson@13957: 
paulson@13957: constdefs
paulson@13957: 
paulson@13957:   (*--- real and Imaginary parts ---*)
paulson@14323: 
paulson@14323:   Re :: "complex => real"
paulson@13957:   "Re(z) == fst(Rep_complex z)"
paulson@13957: 
paulson@14323:   Im :: "complex => real"
paulson@13957:   "Im(z) == snd(Rep_complex z)"
paulson@13957: 
paulson@13957:   (*----------- modulus ------------*)
paulson@13957: 
paulson@14323:   cmod :: "complex => real"
paulson@14323:   "cmod z == sqrt(Re(z) ^ 2 + Im(z) ^ 2)"
paulson@13957: 
paulson@14323:   (*----- injection from reals -----*)
paulson@14323: 
paulson@14323:   complex_of_real :: "real => complex"
paulson@13957:   "complex_of_real r == Abs_complex(r,0::real)"
paulson@14323: 
paulson@13957:   (*------- complex conjugate ------*)
paulson@13957: 
paulson@14323:   cnj :: "complex => complex"
paulson@13957:   "cnj z == Abs_complex(Re z, -Im z)"
paulson@13957: 
paulson@14323:   (*------------ Argand -------------*)
paulson@13957: 
paulson@14323:   sgn :: "complex => complex"
paulson@13957:   "sgn z == z / complex_of_real(cmod z)"
paulson@13957: 
paulson@14323:   arg :: "complex => real"
paulson@13957:   "arg z == @a. Re(sgn z) = cos a & Im(sgn z) = sin a & -pi < a & a <= pi"
paulson@14323: 
paulson@13957: 
paulson@14323: defs (overloaded)
paulson@14323: 
paulson@14323:   complex_zero_def:
paulson@13957:   "0 == Abs_complex(0::real,0)"
paulson@13957: 
paulson@14323:   complex_one_def:
paulson@13957:   "1 == Abs_complex(1,0::real)"
paulson@13957: 
paulson@14323:   (*------ imaginary unit ----------*)
paulson@14323: 
paulson@14323:   i_def:
paulson@13957:   "ii == Abs_complex(0::real,1)"
paulson@13957: 
paulson@13957:   (*----------- negation -----------*)
paulson@14323: 
paulson@14323:   complex_minus_def:
paulson@14323:   "- (z::complex) == Abs_complex(-Re z, -Im z)"
paulson@13957: 
paulson@14323: 
paulson@13957:   (*----------- inverse -----------*)
paulson@14323:   complex_inverse_def:
paulson@13957:   "inverse (z::complex) == Abs_complex(Re(z)/(Re(z) ^ 2 + Im(z) ^ 2),
paulson@13957:                             -Im(z)/(Re(z) ^ 2 + Im(z) ^ 2))"
paulson@13957: 
paulson@14323:   complex_add_def:
paulson@13957:   "w + (z::complex) == Abs_complex(Re(w) + Re(z),Im(w) + Im(z))"
paulson@13957: 
paulson@14323:   complex_diff_def:
paulson@13957:   "w - (z::complex) == w + -(z::complex)"
paulson@13957: 
paulson@14323:   complex_mult_def:
paulson@13957:   "w * (z::complex) == Abs_complex(Re(w) * Re(z) - Im(w) * Im(z),
paulson@13957: 			Re(w) * Im(z) + Im(w) * Re(z))"
paulson@13957: 
paulson@13957: 
paulson@13957:   (*----------- division ----------*)
paulson@14323:   complex_divide_def:
paulson@13957:   "w / (z::complex) == w * inverse z"
paulson@14323: 
paulson@13957: 
paulson@13957: primrec
paulson@14323:      complexpow_0:   "z ^ 0       = complex_of_real 1"
paulson@14323:      complexpow_Suc: "z ^ (Suc n) = (z::complex) * (z ^ n)"
paulson@13957: 
paulson@13957: 
paulson@13957: constdefs
paulson@13957: 
paulson@13957:   (* abbreviation for (cos a + i sin a) *)
paulson@14323:   cis :: "real => complex"
paulson@13957:   "cis a == complex_of_real(cos a) + ii * complex_of_real(sin a)"
paulson@13957: 
paulson@13957:   (* abbreviation for r*(cos a + i sin a) *)
paulson@14323:   rcis :: "[real, real] => complex"
paulson@13957:   "rcis r a == complex_of_real r * cis a"
paulson@13957: 
paulson@13957:   (* e ^ (x + iy) *)
paulson@14323:   expi :: "complex => complex"
paulson@13957:   "expi z == complex_of_real(exp (Re z)) * cis (Im z)"
paulson@14323: 
paulson@14323: 
paulson@14323: lemma inj_Rep_complex: "inj Rep_complex"
paulson@14323: apply (rule inj_on_inverseI)
paulson@14323: apply (rule Rep_complex_inverse)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma inj_Abs_complex: "inj Abs_complex"
paulson@14323: apply (rule inj_on_inverseI)
paulson@14323: apply (rule Abs_complex_inverse)
paulson@14323: apply (simp (no_asm) add: complex_def)
paulson@14323: done
paulson@14323: declare inj_Abs_complex [THEN injD, simp]
paulson@14323: 
paulson@14323: lemma Abs_complex_cancel_iff: "(Abs_complex x = Abs_complex y) = (x = y)"
paulson@14323: apply (auto dest: inj_Abs_complex [THEN injD])
paulson@14323: done
paulson@14323: declare Abs_complex_cancel_iff [simp]
paulson@14323: 
paulson@14323: lemma pair_mem_complex: "(x,y) : complex"
paulson@14323: apply (unfold complex_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare pair_mem_complex [simp]
paulson@14323: 
paulson@14323: lemma Abs_complex_inverse2: "Rep_complex (Abs_complex (x,y)) = (x,y)"
paulson@14323: apply (simp (no_asm) add: Abs_complex_inverse)
paulson@14323: done
paulson@14323: declare Abs_complex_inverse2 [simp]
paulson@14323: 
paulson@14323: lemma eq_Abs_complex: "(!!x y. z = Abs_complex(x,y) ==> P) ==> P"
paulson@14323: apply (rule_tac p = "Rep_complex z" in PairE)
paulson@14323: apply (drule_tac f = "Abs_complex" in arg_cong)
paulson@14323: apply (force simp add: Rep_complex_inverse)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma Re: "Re(Abs_complex(x,y)) = x"
paulson@14323: apply (unfold Re_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare Re [simp]
paulson@14323: 
paulson@14323: lemma Im: "Im(Abs_complex(x,y)) = y"
paulson@14323: apply (unfold Im_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare Im [simp]
paulson@14323: 
paulson@14323: lemma Abs_complex_cancel: "Abs_complex(Re(z),Im(z)) = z"
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (simp (no_asm_simp))
paulson@14323: done
paulson@14323: declare Abs_complex_cancel [simp]
paulson@14323: 
paulson@14323: lemma complex_Re_Im_cancel_iff: "(w=z) = (Re(w) = Re(z) & Im(w) = Im(z))"
paulson@14323: apply (rule_tac z = "w" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (auto dest: inj_Abs_complex [THEN injD])
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_Re_zero: "Re 0 = 0"
paulson@14323: apply (unfold complex_zero_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_Im_zero: "Im 0 = 0"
paulson@14323: apply (unfold complex_zero_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_Re_zero [simp] complex_Im_zero [simp]
paulson@14323: 
paulson@14323: lemma complex_Re_one: "Re 1 = 1"
paulson@14323: apply (unfold complex_one_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_Re_one [simp]
paulson@14323: 
paulson@14323: lemma complex_Im_one: "Im 1 = 0"
paulson@14323: apply (unfold complex_one_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_Im_one [simp]
paulson@14323: 
paulson@14323: lemma complex_Re_i: "Re(ii) = 0"
paulson@14323: apply (unfold i_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare complex_Re_i [simp]
paulson@14323: 
paulson@14323: lemma complex_Im_i: "Im(ii) = 1"
paulson@14323: apply (unfold i_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare complex_Im_i [simp]
paulson@14323: 
paulson@14323: lemma Re_complex_of_real_zero: "Re(complex_of_real 0) = 0"
paulson@14323: apply (unfold complex_of_real_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare Re_complex_of_real_zero [simp]
paulson@14323: 
paulson@14323: lemma Im_complex_of_real_zero: "Im(complex_of_real 0) = 0"
paulson@14323: apply (unfold complex_of_real_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare Im_complex_of_real_zero [simp]
paulson@14323: 
paulson@14323: lemma Re_complex_of_real_one: "Re(complex_of_real 1) = 1"
paulson@14323: apply (unfold complex_of_real_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare Re_complex_of_real_one [simp]
paulson@14323: 
paulson@14323: lemma Im_complex_of_real_one: "Im(complex_of_real 1) = 0"
paulson@14323: apply (unfold complex_of_real_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare Im_complex_of_real_one [simp]
paulson@14323: 
paulson@14323: lemma Re_complex_of_real: "Re(complex_of_real z) = z"
paulson@14323: apply (unfold complex_of_real_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare Re_complex_of_real [simp]
paulson@14323: 
paulson@14323: lemma Im_complex_of_real: "Im(complex_of_real z) = 0"
paulson@14323: apply (unfold complex_of_real_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare Im_complex_of_real [simp]
paulson@14323: 
paulson@14323: 
paulson@14323: subsection{*Negation*}
paulson@14323: 
paulson@14323: lemma complex_minus: "- Abs_complex(x,y) = Abs_complex(-x,-y)"
paulson@14323: apply (unfold complex_minus_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_Re_minus: "Re (-z) = - Re z"
paulson@14323: apply (unfold Re_def)
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_minus)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_Im_minus: "Im (-z) = - Im z"
paulson@14323: apply (unfold Im_def)
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_minus)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_minus_minus: "- (- z) = (z::complex)"
paulson@14323: apply (unfold complex_minus_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_minus_minus [simp]
paulson@14323: 
paulson@14323: lemma inj_complex_minus: "inj(%r::complex. -r)"
paulson@14323: apply (rule inj_onI)
paulson@14323: apply (drule_tac f = "uminus" in arg_cong)
paulson@14323: apply simp
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_minus_zero: "-(0::complex) = 0"
paulson@14323: apply (unfold complex_zero_def)
paulson@14323: apply (simp (no_asm) add: complex_minus)
paulson@14323: done
paulson@14323: declare complex_minus_zero [simp]
paulson@14323: 
paulson@14323: lemma complex_minus_zero_iff: "(-x = 0) = (x = (0::complex))"
paulson@14323: apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323: apply (auto dest: inj_Abs_complex [THEN injD]
paulson@14323:             simp add: complex_zero_def complex_minus)
paulson@14323: done
paulson@14323: declare complex_minus_zero_iff [simp]
paulson@14323: 
paulson@14323: lemma complex_minus_zero_iff2: "(0 = -x) = (x = (0::real))"
paulson@14323: apply (auto dest: sym)
paulson@14323: done
paulson@14323: declare complex_minus_zero_iff2 [simp]
paulson@14323: 
paulson@14323: lemma complex_minus_not_zero_iff: "(-x ~= 0) = (x ~= (0::complex))"
paulson@14323: apply auto
paulson@14323: done
paulson@14323: 
paulson@14323: 
paulson@14323: subsection{*Addition*}
paulson@14323: 
paulson@14323: lemma complex_add:
paulson@14323:       "Abs_complex(x1,y1) + Abs_complex(x2,y2) = Abs_complex(x1+x2,y1+y2)"
paulson@14323: apply (unfold complex_add_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_Re_add: "Re(x + y) = Re(x) + Re(y)"
paulson@14323: apply (unfold Re_def)
paulson@14323: apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_add)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_Im_add: "Im(x + y) = Im(x) + Im(y)"
paulson@14323: apply (unfold Im_def)
paulson@14323: apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_add)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_add_commute: "(u::complex) + v = v + u"
paulson@14323: apply (unfold complex_add_def)
paulson@14323: apply (simp (no_asm) add: real_add_commute)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_add_assoc: "((u::complex) + v) + w = u + (v + w)"
paulson@14323: apply (unfold complex_add_def)
paulson@14323: apply (simp (no_asm) add: real_add_assoc)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_add_left_commute: "(x::complex) + (y + z) = y + (x + z)"
paulson@14323: apply (unfold complex_add_def)
paulson@14323: apply (simp (no_asm) add: real_add_left_commute)
paulson@14323: done
paulson@14323: 
paulson@14323: lemmas complex_add_ac = complex_add_assoc complex_add_commute
paulson@14323:                       complex_add_left_commute
paulson@14323: 
paulson@14323: lemma complex_add_zero_left: "(0::complex) + z = z"
paulson@14323: apply (unfold complex_add_def complex_zero_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_add_zero_left [simp]
paulson@14323: 
paulson@14323: lemma complex_add_zero_right: "z + (0::complex) = z"
paulson@14323: apply (unfold complex_add_def complex_zero_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_add_zero_right [simp]
paulson@14323: 
paulson@14323: lemma complex_add_minus_right_zero:
paulson@14323:       "z + -z = (0::complex)"
paulson@14323: apply (unfold complex_add_def complex_minus_def complex_zero_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_add_minus_right_zero [simp]
paulson@14323: 
paulson@14323: lemma complex_add_minus_left_zero:
paulson@14323:       "-z + z = (0::complex)"
paulson@14323: apply (unfold complex_add_def complex_minus_def complex_zero_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_add_minus_left_zero [simp]
paulson@14323: 
paulson@14323: lemma complex_add_minus_cancel: "z + (- z + w) = (w::complex)"
paulson@14323: apply (simp (no_asm) add: complex_add_assoc [symmetric])
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_minus_add_cancel: "(-z) + (z + w) = (w::complex)"
paulson@14323: apply (simp (no_asm) add: complex_add_assoc [symmetric])
paulson@14323: done
paulson@14323: 
paulson@14323: declare complex_add_minus_cancel [simp] complex_minus_add_cancel [simp]
paulson@14323: 
paulson@14323: lemma complex_add_minus_eq_minus: "x + y = (0::complex) ==> x = -y"
paulson@14323: apply (auto simp add: complex_Re_Im_cancel_iff complex_Re_add complex_Im_add complex_Re_minus complex_Im_minus)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_minus_add_distrib: "-(x + y) = -x + -(y::complex)"
paulson@14323: apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_minus complex_add)
paulson@14323: done
paulson@14323: declare complex_minus_add_distrib [simp]
paulson@14323: 
paulson@14323: lemma complex_add_left_cancel: "((x::complex) + y = x + z) = (y = z)"
paulson@14323: apply (safe)
paulson@14323: apply (drule_tac f = "%t.-x + t" in arg_cong)
paulson@14323: apply (simp add: complex_add_assoc [symmetric])
paulson@14323: done
paulson@14323: declare complex_add_left_cancel [iff]
paulson@14323: 
paulson@14323: lemma complex_add_right_cancel: "(y + (x::complex)= z + x) = (y = z)"
paulson@14323: apply (simp (no_asm) add: complex_add_commute)
paulson@14323: done
paulson@14323: declare complex_add_right_cancel [simp]
paulson@14323: 
paulson@14323: lemma complex_eq_minus_iff: "((x::complex) = y) = (0 = x + - y)"
paulson@14323: apply (safe)
paulson@14323: apply (rule_tac [2] x1 = "-y" in complex_add_right_cancel [THEN iffD1])
paulson@14323: apply auto
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_eq_minus_iff2: "((x::complex) = y) = (x + - y = 0)"
paulson@14323: apply (safe)
paulson@14323: apply (rule_tac [2] x1 = "-y" in complex_add_right_cancel [THEN iffD1])
paulson@14323: apply auto
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_diff_0: "(0::complex) - x = -x"
paulson@14323: apply (simp (no_asm) add: complex_diff_def)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_diff_0_right: "x - (0::complex) = x"
paulson@14323: apply (simp (no_asm) add: complex_diff_def)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_diff_self: "x - x = (0::complex)"
paulson@14323: apply (simp (no_asm) add: complex_diff_def)
paulson@14323: done
paulson@14323: 
paulson@14323: declare complex_diff_0 [simp] complex_diff_0_right [simp] complex_diff_self [simp]
paulson@14323: 
paulson@14323: lemma complex_diff:
paulson@14323:       "Abs_complex(x1,y1) - Abs_complex(x2,y2) = Abs_complex(x1-x2,y1-y2)"
paulson@14323: apply (unfold complex_diff_def)
paulson@14323: apply (simp (no_asm) add: complex_add complex_minus)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_diff_eq_eq: "((x::complex) - y = z) = (x = z + y)"
paulson@14323: apply (auto simp add: complex_diff_def complex_add_assoc)
paulson@14323: done
paulson@14323: 
paulson@14323: 
paulson@14323: subsection{*Multiplication*}
paulson@14323: 
paulson@14323: lemma complex_mult:
paulson@14323:       "Abs_complex(x1,y1) * Abs_complex(x2,y2) =
paulson@14323:        Abs_complex(x1*x2 - y1*y2,x1*y2 + y1*x2)"
paulson@14323: apply (unfold complex_mult_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_mult_commute: "(w::complex) * z = z * w"
paulson@14323: apply (unfold complex_mult_def)
paulson@14323: apply (simp (no_asm) add: real_mult_commute real_add_commute)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_mult_assoc: "((u::complex) * v) * w = u * (v * w)"
paulson@14323: apply (unfold complex_mult_def)
paulson@14323: apply (simp (no_asm) add: complex_Re_Im_cancel_iff real_mult_assoc real_diff_mult_distrib2 real_add_mult_distrib2 real_diff_mult_distrib real_add_mult_distrib real_mult_left_commute)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_mult_left_commute: "(x::complex) * (y * z) = y * (x * z)"
paulson@14323: apply (unfold complex_mult_def)
paulson@14323: apply (simp (no_asm) add: complex_Re_Im_cancel_iff real_mult_left_commute real_diff_mult_distrib2 real_add_mult_distrib2)
paulson@14323: done
paulson@14323: 
paulson@14323: lemmas complex_mult_ac = complex_mult_assoc complex_mult_commute
paulson@14323:                       complex_mult_left_commute
paulson@14323: 
paulson@14323: lemma complex_mult_one_left: "(1::complex) * z = z"
paulson@14323: apply (unfold complex_one_def)
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (simp (no_asm_simp) add: complex_mult)
paulson@14323: done
paulson@14323: declare complex_mult_one_left [simp]
paulson@14323: 
paulson@14323: lemma complex_mult_one_right: "z * (1::complex) = z"
paulson@14323: apply (simp (no_asm) add: complex_mult_commute)
paulson@14323: done
paulson@14323: declare complex_mult_one_right [simp]
paulson@14323: 
paulson@14323: lemma complex_mult_zero_left: "(0::complex) * z = 0"
paulson@14323: apply (unfold complex_zero_def)
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (simp (no_asm_simp) add: complex_mult)
paulson@14323: done
paulson@14323: declare complex_mult_zero_left [simp]
paulson@14323: 
paulson@14323: lemma complex_mult_zero_right: "z * 0 = (0::complex)"
paulson@14323: apply (simp (no_asm) add: complex_mult_commute)
paulson@14323: done
paulson@14323: declare complex_mult_zero_right [simp]
paulson@14323: 
paulson@14323: lemma complex_divide_zero: "0 / z = (0::complex)"
paulson@14323: apply (unfold complex_divide_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare complex_divide_zero [simp]
paulson@14323: 
paulson@14323: lemma complex_minus_mult_eq1: "-(x * y) = -x * (y::complex)"
paulson@14323: apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_mult complex_minus real_diff_def)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_minus_mult_eq2: "-(x * y) = x * -(y::complex)"
paulson@14323: apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_mult complex_minus real_diff_def)
paulson@14323: done
paulson@14323: 
paulson@14323: declare complex_minus_mult_eq1 [symmetric, simp] complex_minus_mult_eq2 [symmetric, simp]
paulson@14323: 
paulson@14323: lemma complex_mult_minus_one: "-(1::complex) * z = -z"
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_mult_minus_one [simp]
paulson@14323: 
paulson@14323: lemma complex_mult_minus_one_right: "z * -(1::complex) = -z"
paulson@14323: apply (subst complex_mult_commute)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_mult_minus_one_right [simp]
paulson@14323: 
paulson@14323: lemma complex_minus_mult_cancel: "-x * -y = x * (y::complex)"
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_minus_mult_cancel [simp]
paulson@14323: 
paulson@14323: lemma complex_minus_mult_commute: "-x * y = x * -(y::complex)"
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_add_mult_distrib: "((z1::complex) + z2) * w = (z1 * w) + (z2 * w)"
paulson@14323: apply (rule_tac z = "z1" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "z2" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "w" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_mult complex_add real_add_mult_distrib real_diff_def real_add_ac)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_add_mult_distrib2: "(w::complex) * (z1 + z2) = (w * z1) + (w * z2)"
paulson@14323: apply (rule_tac z1 = "z1 + z2" in complex_mult_commute [THEN ssubst])
paulson@14323: apply (simp (no_asm) add: complex_add_mult_distrib)
paulson@14323: apply (simp (no_asm) add: complex_mult_commute)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_zero_not_eq_one: "(0::complex) ~= 1"
paulson@14323: apply (unfold complex_zero_def complex_one_def)
paulson@14323: apply (simp (no_asm) add: complex_Re_Im_cancel_iff)
paulson@14323: done
paulson@14323: declare complex_zero_not_eq_one [simp]
paulson@14323: declare complex_zero_not_eq_one [THEN not_sym, simp]
paulson@14323: 
paulson@14323: 
paulson@14323: subsection{*Inverse*}
paulson@14323: 
paulson@14323: lemma complex_inverse: "inverse (Abs_complex(x,y)) =
paulson@14323:      Abs_complex(x/(x ^ 2 + y ^ 2),-y/(x ^ 2 + y ^ 2))"
paulson@14323: apply (unfold complex_inverse_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: 
paulson@14323: lemma COMPLEX_INVERSE_ZERO: "inverse 0 = (0::complex)"
paulson@14323: apply (unfold complex_inverse_def complex_zero_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: 
paulson@14323: lemma COMPLEX_DIVISION_BY_ZERO: "a / (0::complex) = 0"
paulson@14323: apply (simp (no_asm) add: complex_divide_def COMPLEX_INVERSE_ZERO)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_mult_inv_left: "z ~= (0::complex) ==> inverse(z) * z = 1"
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_mult complex_inverse complex_one_def complex_zero_def real_add_divide_distrib [symmetric] real_power_two mult_ac)
paulson@14323: apply (drule_tac y = "y" in real_sum_squares_not_zero)
paulson@14323: apply (drule_tac [2] x = "x" in real_sum_squares_not_zero2)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare complex_mult_inv_left [simp]
paulson@14323: 
paulson@14323: lemma complex_mult_inv_right: "z ~= (0::complex) ==> z * inverse(z) = 1"
paulson@14323: apply (auto intro: complex_mult_commute [THEN subst])
paulson@14323: done
paulson@14323: declare complex_mult_inv_right [simp]
paulson@14323: 
paulson@14323: lemma complex_mult_left_cancel: "(c::complex) ~= 0 ==> (c*a=c*b) = (a=b)"
paulson@14323: apply auto
paulson@14323: apply (drule_tac f = "%x. x*inverse c" in arg_cong)
paulson@14323: apply (simp add: complex_mult_ac)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_mult_right_cancel: "(c::complex) ~= 0 ==> (a*c=b*c) = (a=b)"
paulson@14323: apply (safe)
paulson@14323: apply (drule_tac f = "%x. x*inverse c" in arg_cong)
paulson@14323: apply (simp add: complex_mult_ac)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_inverse_not_zero: "z ~= 0 ==> inverse(z::complex) ~= 0"
paulson@14323: apply (safe)
paulson@14323: apply (frule complex_mult_right_cancel [THEN iffD2])
paulson@14323: apply (erule_tac [2] V = "inverse z = 0" in thin_rl)
paulson@14323: apply (assumption , auto)
paulson@14323: done
paulson@14323: declare complex_inverse_not_zero [simp]
paulson@14323: 
paulson@14323: lemma complex_mult_not_zero: "!!x. [| x ~= 0; y ~= (0::complex) |] ==> x * y ~= 0"
paulson@14323: apply (safe)
paulson@14323: apply (drule_tac f = "%z. inverse x*z" in arg_cong)
paulson@14323: apply (simp add: complex_mult_assoc [symmetric])
paulson@14323: done
paulson@14323: 
paulson@14323: lemmas complex_mult_not_zeroE = complex_mult_not_zero [THEN notE, standard]
paulson@14323: 
paulson@14323: lemma complex_inverse_inverse: "inverse(inverse (x::complex)) = x"
paulson@14323: apply (case_tac "x = 0", simp add: COMPLEX_INVERSE_ZERO)
paulson@14323: apply (rule_tac c1 = "inverse x" in complex_mult_right_cancel [THEN iffD1])
paulson@14323: apply (erule complex_inverse_not_zero)
paulson@14323: apply (auto dest: complex_inverse_not_zero)
paulson@14323: done
paulson@14323: declare complex_inverse_inverse [simp]
paulson@14323: 
paulson@14323: lemma complex_inverse_one: "inverse(1::complex) = 1"
paulson@14323: apply (unfold complex_one_def)
paulson@14323: apply (simp (no_asm) add: complex_inverse)
paulson@14323: done
paulson@14323: declare complex_inverse_one [simp]
paulson@14323: 
paulson@14323: lemma complex_minus_inverse: "inverse(-x) = -inverse(x::complex)"
paulson@14323: apply (case_tac "x = 0", simp add: COMPLEX_INVERSE_ZERO)
paulson@14323: apply (rule_tac c1 = "-x" in complex_mult_right_cancel [THEN iffD1])
paulson@14323: apply force
paulson@14323: apply (subst complex_mult_inv_left)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_inverse_distrib: "inverse(x*y) = inverse x * inverse (y::complex)"
paulson@14323: apply (case_tac "x = 0", simp add: COMPLEX_INVERSE_ZERO)
paulson@14323: apply (case_tac "y = 0", simp add: COMPLEX_INVERSE_ZERO)
paulson@14323: apply (rule_tac c1 = "x*y" in complex_mult_left_cancel [THEN iffD1])
paulson@14323: apply (auto simp add: complex_mult_not_zero complex_mult_ac)
paulson@14323: apply (auto simp add: complex_mult_not_zero complex_mult_assoc [symmetric])
paulson@14323: done
paulson@14323: 
paulson@14323: 
paulson@14323: subsection{*Division*}
paulson@14323: 
paulson@14323: (*adding some of these theorems to simpset as for reals:
paulson@14323:   not 100% convinced for some*)
paulson@14323: 
paulson@14323: lemma complex_times_divide1_eq: "(x::complex) * (y/z) = (x*y)/z"
paulson@14323: apply (simp (no_asm) add: complex_divide_def complex_mult_assoc)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_times_divide2_eq: "(y/z) * (x::complex) = (y*x)/z"
paulson@14323: apply (simp (no_asm) add: complex_divide_def complex_mult_ac)
paulson@14323: done
paulson@14323: 
paulson@14323: declare complex_times_divide1_eq [simp] complex_times_divide2_eq [simp]
paulson@14323: 
paulson@14323: lemma complex_divide_divide1_eq: "(x::complex) / (y/z) = (x*z)/y"
paulson@14323: apply (simp (no_asm) add: complex_divide_def complex_inverse_distrib complex_mult_ac)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_divide_divide2_eq: "((x::complex) / y) / z = x/(y*z)"
paulson@14323: apply (simp (no_asm) add: complex_divide_def complex_inverse_distrib complex_mult_assoc)
paulson@14323: done
paulson@14323: 
paulson@14323: declare complex_divide_divide1_eq [simp] complex_divide_divide2_eq [simp]
paulson@14323: 
paulson@14323: (** As with multiplication, pull minus signs OUT of the / operator **)
paulson@14323: 
paulson@14323: lemma complex_minus_divide_eq: "(-x) / (y::complex) = - (x/y)"
paulson@14323: apply (simp (no_asm) add: complex_divide_def)
paulson@14323: done
paulson@14323: declare complex_minus_divide_eq [simp]
paulson@14323: 
paulson@14323: lemma complex_divide_minus_eq: "(x / -(y::complex)) = - (x/y)"
paulson@14323: apply (simp (no_asm) add: complex_divide_def complex_minus_inverse)
paulson@14323: done
paulson@14323: declare complex_divide_minus_eq [simp]
paulson@14323: 
paulson@14323: lemma complex_add_divide_distrib: "(x+y)/(z::complex) = x/z + y/z"
paulson@14323: apply (simp (no_asm) add: complex_divide_def complex_add_mult_distrib)
paulson@14323: done
paulson@14323: 
paulson@14323: subsection{*Embedding Properties for @{term complex_of_real} Map*}
paulson@14323: 
paulson@14323: lemma inj_complex_of_real: "inj complex_of_real"
paulson@14323: apply (rule inj_onI)
paulson@14323: apply (auto dest: inj_Abs_complex [THEN injD] simp add: complex_of_real_def)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_of_real_one:
paulson@14323:       "complex_of_real 1 = 1"
paulson@14323: apply (unfold complex_one_def complex_of_real_def)
paulson@14323: apply (rule refl)
paulson@14323: done
paulson@14323: declare complex_of_real_one [simp]
paulson@14323: 
paulson@14323: lemma complex_of_real_zero:
paulson@14323:       "complex_of_real 0 = 0"
paulson@14323: apply (unfold complex_zero_def complex_of_real_def)
paulson@14323: apply (rule refl)
paulson@14323: done
paulson@14323: declare complex_of_real_zero [simp]
paulson@14323: 
paulson@14323: lemma complex_of_real_eq_iff: "(complex_of_real x = complex_of_real y) = (x = y)"
paulson@14323: apply (auto dest: inj_complex_of_real [THEN injD])
paulson@14323: done
paulson@14323: declare complex_of_real_eq_iff [iff]
paulson@14323: 
paulson@14323: lemma complex_of_real_minus: "complex_of_real(-x) = - complex_of_real x"
paulson@14323: apply (simp (no_asm) add: complex_of_real_def complex_minus)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_of_real_inverse: "complex_of_real(inverse x) = inverse(complex_of_real x)"
paulson@14323: apply (case_tac "x=0")
paulson@14323: apply (simp add: DIVISION_BY_ZERO COMPLEX_INVERSE_ZERO)
paulson@14323: apply (simp add: complex_inverse complex_of_real_def real_divide_def real_inverse_distrib real_power_two)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_of_real_add: "complex_of_real x + complex_of_real y = complex_of_real (x + y)"
paulson@14323: apply (simp (no_asm) add: complex_add complex_of_real_def)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_of_real_diff: "complex_of_real x - complex_of_real y = complex_of_real (x - y)"
paulson@14323: apply (simp (no_asm) add: complex_of_real_minus [symmetric] complex_diff_def complex_of_real_add)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_of_real_mult: "complex_of_real x * complex_of_real y = complex_of_real (x * y)"
paulson@14323: apply (simp (no_asm) add: complex_mult complex_of_real_def)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_of_real_divide:
paulson@14323:       "complex_of_real x / complex_of_real y = complex_of_real(x/y)"
paulson@14323: apply (unfold complex_divide_def)
paulson@14323: apply (case_tac "y=0")
paulson@14323: apply (simp (no_asm_simp) add: DIVISION_BY_ZERO COMPLEX_INVERSE_ZERO)
paulson@14323: apply (simp (no_asm_simp) add: complex_of_real_mult [symmetric] complex_of_real_inverse real_divide_def)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_of_real_pow: "complex_of_real (x ^ n) = (complex_of_real x) ^ n"
paulson@14323: apply (induct_tac "n")
paulson@14323: apply (auto simp add: complex_of_real_mult [symmetric])
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_mod: "cmod (Abs_complex(x,y)) = sqrt(x ^ 2 + y ^ 2)"
paulson@14323: apply (unfold cmod_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_mod_zero: "cmod(0) = 0"
paulson@14323: apply (unfold cmod_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_mod_zero [simp]
paulson@14323: 
paulson@14323: lemma complex_mod_one: "cmod(1) = 1"
paulson@14323: apply (unfold cmod_def)
paulson@14323: apply (simp add: );  
paulson@14323: done
paulson@14323: declare complex_mod_one [simp]
paulson@14323: 
paulson@14323: lemma complex_mod_complex_of_real: "cmod(complex_of_real x) = abs x"
paulson@14323: apply (unfold complex_of_real_def)
paulson@14323: apply (simp (no_asm) add: complex_mod)
paulson@14323: done
paulson@14323: declare complex_mod_complex_of_real [simp]
paulson@14323: 
paulson@14323: lemma complex_of_real_abs: "complex_of_real (abs x) = complex_of_real(cmod(complex_of_real x))"
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: 
paulson@14323: 
paulson@14323: subsection{*Conjugation is an Automorphism*}
paulson@14323: 
paulson@14323: lemma complex_cnj: "cnj (Abs_complex(x,y)) = Abs_complex(x,-y)"
paulson@14323: apply (unfold cnj_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: 
paulson@14323: lemma inj_cnj: "inj cnj"
paulson@14323: apply (rule inj_onI)
paulson@14323: apply (auto simp add: cnj_def Abs_complex_cancel_iff complex_Re_Im_cancel_iff)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_cnj_cancel_iff: "(cnj x = cnj y) = (x = y)"
paulson@14323: apply (auto dest: inj_cnj [THEN injD])
paulson@14323: done
paulson@14323: declare complex_cnj_cancel_iff [simp]
paulson@14323: 
paulson@14323: lemma complex_cnj_cnj: "cnj (cnj z) = z"
paulson@14323: apply (unfold cnj_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_cnj_cnj [simp]
paulson@14323: 
paulson@14323: lemma complex_cnj_complex_of_real: "cnj (complex_of_real x) = complex_of_real x"
paulson@14323: apply (unfold complex_of_real_def)
paulson@14323: apply (simp (no_asm) add: complex_cnj)
paulson@14323: done
paulson@14323: declare complex_cnj_complex_of_real [simp]
paulson@14323: 
paulson@14323: lemma complex_mod_cnj: "cmod (cnj z) = cmod z"
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (simp (no_asm_simp) add: complex_cnj complex_mod real_power_two)
paulson@14323: done
paulson@14323: declare complex_mod_cnj [simp]
paulson@14323: 
paulson@14323: lemma complex_cnj_minus: "cnj (-z) = - cnj z"
paulson@14323: apply (unfold cnj_def)
paulson@14323: apply (simp (no_asm) add: complex_minus complex_Re_minus complex_Im_minus)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_cnj_inverse: "cnj(inverse z) = inverse(cnj z)"
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (simp (no_asm_simp) add: complex_cnj complex_inverse real_power_two)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_cnj_add: "cnj(w + z) = cnj(w) + cnj(z)"
paulson@14323: apply (rule_tac z = "w" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (simp (no_asm_simp) add: complex_cnj complex_add)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_cnj_diff: "cnj(w - z) = cnj(w) - cnj(z)"
paulson@14323: apply (unfold complex_diff_def)
paulson@14323: apply (simp (no_asm) add: complex_cnj_add complex_cnj_minus)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_cnj_mult: "cnj(w * z) = cnj(w) * cnj(z)"
paulson@14323: apply (rule_tac z = "w" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (simp (no_asm_simp) add: complex_cnj complex_mult)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_cnj_divide: "cnj(w / z) = (cnj w)/(cnj z)"
paulson@14323: apply (unfold complex_divide_def)
paulson@14323: apply (simp (no_asm) add: complex_cnj_mult complex_cnj_inverse)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_cnj_one: "cnj 1 = 1"
paulson@14323: apply (unfold cnj_def complex_one_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_cnj_one [simp]
paulson@14323: 
paulson@14323: lemma complex_cnj_pow: "cnj(z ^ n) = cnj(z) ^ n"
paulson@14323: apply (induct_tac "n")
paulson@14323: apply (auto simp add: complex_cnj_mult)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_add_cnj: "z + cnj z = complex_of_real (2 * Re(z))"
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (simp (no_asm_simp) add: complex_add complex_cnj complex_of_real_def)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_diff_cnj: "z - cnj z = complex_of_real (2 * Im(z)) * ii"
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (simp (no_asm_simp) add: complex_add complex_cnj complex_of_real_def complex_diff_def complex_minus i_def complex_mult)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_cnj_zero: "cnj 0 = 0"
paulson@14323: apply (simp add: cnj_def complex_zero_def) 
paulson@14323: done
paulson@14323: declare complex_cnj_zero [simp]
paulson@14323: 
paulson@14323: lemma complex_cnj_zero_iff: "(cnj z = 0) = (z = 0)"
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_zero_def complex_cnj)
paulson@14323: done
paulson@14323: declare complex_cnj_zero_iff [iff]
paulson@14323: 
paulson@14323: lemma complex_mult_cnj: "z * cnj z = complex_of_real (Re(z) ^ 2 + Im(z) ^ 2)"
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_cnj complex_mult complex_of_real_def real_power_two)
paulson@14323: done
paulson@14323: 
paulson@14323: 
paulson@14323: subsection{*Algebra*}
paulson@14323: 
paulson@14323: lemma complex_mult_zero_iff: "(x*y = (0::complex)) = (x = 0 | y = 0)"
paulson@14323: apply auto
paulson@14323: apply (auto intro: ccontr dest: complex_mult_not_zero)
paulson@14323: done
paulson@14323: declare complex_mult_zero_iff [iff]
paulson@14323: 
paulson@14323: lemma complex_add_left_cancel_zero: "(x + y = x) = (y = (0::complex))"
paulson@14323: apply (unfold complex_zero_def)
paulson@14323: apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_add)
paulson@14323: done
paulson@14323: declare complex_add_left_cancel_zero [simp]
paulson@14323: 
paulson@14323: lemma complex_diff_mult_distrib:
paulson@14323:       "((z1::complex) - z2) * w = (z1 * w) - (z2 * w)"
paulson@14323: apply (unfold complex_diff_def)
paulson@14323: apply (simp (no_asm) add: complex_add_mult_distrib)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_diff_mult_distrib2:
paulson@14323:       "(w::complex) * (z1 - z2) = (w * z1) - (w * z2)"
paulson@14323: apply (unfold complex_diff_def)
paulson@14323: apply (simp (no_asm) add: complex_add_mult_distrib2)
paulson@14323: done
paulson@14323: 
paulson@14323: 
paulson@14323: subsection{*Modulus*}
paulson@14323: 
paulson@14323: (*
paulson@14323: Goal "[| sqrt(x) = 0; 0 <= x |] ==> x = 0"
paulson@14323: by (auto_tac (claset() addIs [real_sqrt_eq_zero_cancel],
paulson@14323:     simpset()));
paulson@14323: qed "real_sqrt_eq_zero_cancel2";
paulson@14323: *)
paulson@14323: 
paulson@14323: lemma complex_mod_eq_zero_cancel: "(cmod x = 0) = (x = 0)"
paulson@14323: apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323: apply (auto intro: real_sum_squares_cancel real_sum_squares_cancel2 simp add: complex_mod complex_zero_def real_power_two)
paulson@14323: done
paulson@14323: declare complex_mod_eq_zero_cancel [simp]
paulson@14323: 
paulson@14323: lemma complex_mod_complex_of_real_of_nat: "cmod (complex_of_real(real (n::nat))) = real n"
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_mod_complex_of_real_of_nat [simp]
paulson@14323: 
paulson@14323: lemma complex_mod_minus: "cmod (-x) = cmod(x)"
paulson@14323: apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323: apply (simp (no_asm_simp) add: complex_mod complex_minus real_power_two)
paulson@14323: done
paulson@14323: declare complex_mod_minus [simp]
paulson@14323: 
paulson@14323: lemma complex_mod_mult_cnj: "cmod(z * cnj(z)) = cmod(z) ^ 2"
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (simp (no_asm_simp) add: complex_mod complex_cnj complex_mult);
paulson@14323: apply (simp (no_asm) add: real_power_two real_abs_def)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_mod_squared: "cmod(Abs_complex(x,y)) ^ 2 = x ^ 2 + y ^ 2"
paulson@14323: apply (unfold cmod_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_mod_ge_zero: "0 <= cmod x"
paulson@14323: apply (unfold cmod_def)
paulson@14323: apply (auto intro: real_sqrt_ge_zero)
paulson@14323: done
paulson@14323: declare complex_mod_ge_zero [simp]
paulson@14323: 
paulson@14323: lemma abs_cmod_cancel: "abs(cmod x) = cmod x"
paulson@14323: apply (auto intro: abs_eqI1)
paulson@14323: done
paulson@14323: declare abs_cmod_cancel [simp]
paulson@14323: 
paulson@14323: lemma complex_mod_mult: "cmod(x*y) = cmod(x) * cmod(y)"
paulson@14323: apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_mult complex_mod real_sqrt_mult_distrib2 [symmetric] simp del: realpow_Suc)
paulson@14323: apply (rule_tac n = "1" in realpow_Suc_cancel_eq)
paulson@14323: apply (auto simp add: real_power_two [symmetric] simp del: realpow_Suc)
paulson@14323: apply (auto simp add: real_diff_def real_power_two real_add_mult_distrib2 real_add_mult_distrib real_add_ac real_mult_ac)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_mod_add_squared_eq: "cmod(x + y) ^ 2 = cmod(x) ^ 2 + cmod(y) ^ 2 + 2 * Re(x * cnj y)"
paulson@14323: apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_add complex_mod_squared complex_mult complex_cnj real_diff_def simp del: realpow_Suc)
paulson@14323: apply (auto simp add: real_add_mult_distrib2 real_add_mult_distrib real_power_two real_mult_ac real_add_ac)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_Re_mult_cnj_le_cmod: "Re(x * cnj y) <= cmod(x * cnj y)"
paulson@14323: apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_mod complex_mult complex_cnj real_diff_def simp del: realpow_Suc)
paulson@14323: done
paulson@14323: declare complex_Re_mult_cnj_le_cmod [simp]
paulson@14323: 
paulson@14323: lemma complex_Re_mult_cnj_le_cmod2: "Re(x * cnj y) <= cmod(x * y)"
paulson@14323: apply (cut_tac x = "x" and y = "y" in complex_Re_mult_cnj_le_cmod)
paulson@14323: apply (simp add: complex_mod_mult)
paulson@14323: done
paulson@14323: declare complex_Re_mult_cnj_le_cmod2 [simp]
paulson@14323: 
paulson@14323: lemma real_sum_squared_expand: "((x::real) + y) ^ 2 = x ^ 2 + y ^ 2 + 2 * x * y"
paulson@14323: apply (simp (no_asm) add: real_add_mult_distrib real_add_mult_distrib2 real_power_two)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_mod_triangle_squared: "cmod (x + y) ^ 2 <= (cmod(x) + cmod(y)) ^ 2"
paulson@14323: apply (simp (no_asm) add: real_sum_squared_expand complex_mod_add_squared_eq real_mult_assoc complex_mod_mult [symmetric])
paulson@14323: done
paulson@14323: declare complex_mod_triangle_squared [simp]
paulson@14323: 
paulson@14323: lemma complex_mod_minus_le_complex_mod: "- cmod x <= cmod x"
paulson@14323: apply (rule order_trans [OF _ complex_mod_ge_zero]) 
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_mod_minus_le_complex_mod [simp]
paulson@14323: 
paulson@14323: lemma complex_mod_triangle_ineq: "cmod (x + y) <= cmod(x) + cmod(y)"
paulson@14323: apply (rule_tac n = "1" in realpow_increasing)
paulson@14323: apply (auto intro:  order_trans [OF _ complex_mod_ge_zero]
paulson@14323:             simp add: real_power_two [symmetric])
paulson@14323: done
paulson@14323: declare complex_mod_triangle_ineq [simp]
paulson@14323: 
paulson@14323: lemma complex_mod_triangle_ineq2: "cmod(b + a) - cmod b <= cmod a"
paulson@14323: apply (cut_tac x1 = "b" and y1 = "a" and z = "-cmod b" in complex_mod_triangle_ineq [THEN real_add_le_mono1])
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_mod_triangle_ineq2 [simp]
paulson@14323: 
paulson@14323: lemma complex_mod_diff_commute: "cmod (x - y) = cmod (y - x)"
paulson@14323: apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "y" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_diff complex_mod real_diff_mult_distrib2 real_power_two real_diff_mult_distrib real_add_ac real_mult_ac)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_mod_add_less: "[| cmod x < r; cmod y < s |] ==> cmod (x + y) < r + s"
paulson@14323: apply (auto intro: order_le_less_trans complex_mod_triangle_ineq)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_mod_mult_less: "[| cmod x < r; cmod y < s |] ==> cmod (x * y) < r * s"
paulson@14323: apply (auto intro: real_mult_less_mono' simp add: complex_mod_mult)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_mod_diff_ineq: "cmod(a) - cmod(b) <= cmod(a + b)"
paulson@14323: apply (rule linorder_cases [of "cmod(a)" "cmod (b)"])
paulson@14323: apply auto
paulson@14323: apply (rule order_trans [of _ 0] , rule order_less_imp_le)
paulson@14323: apply (simp add: compare_rls)
paulson@14323: apply (simp add: );  
paulson@14323: apply (simp add: compare_rls)
paulson@14323: apply (rule complex_mod_minus [THEN subst])
paulson@14323: apply (rule order_trans)
paulson@14323: apply (rule_tac [2] complex_mod_triangle_ineq)
paulson@14323: apply (auto simp add: complex_add_ac)
paulson@14323: done
paulson@14323: declare complex_mod_diff_ineq [simp]
paulson@14323: 
paulson@14323: lemma complex_Re_le_cmod: "Re z <= cmod z"
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_mod simp del: realpow_Suc)
paulson@14323: done
paulson@14323: declare complex_Re_le_cmod [simp]
paulson@14323: 
paulson@14323: lemma complex_mod_gt_zero: "z ~= 0 ==> 0 < cmod z"
paulson@14323: apply (cut_tac x = "z" in complex_mod_ge_zero)
paulson@14323: apply (drule order_le_imp_less_or_eq)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: 
paulson@14323: 
paulson@14323: subsection{*A Few More Theorems*}
paulson@14323: 
paulson@14323: lemma complex_mod_complexpow: "cmod(x ^ n) = cmod(x) ^ n"
paulson@14323: apply (induct_tac "n")
paulson@14323: apply (auto simp add: complex_mod_mult)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complexpow_minus: "(-x::complex) ^ n = (if even n then (x ^ n) else -(x ^ n))"
paulson@14323: apply (induct_tac "n")
paulson@14323: apply auto
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_inverse_minus: "inverse (-x) = - inverse (x::complex)"
paulson@14323: apply (rule_tac z = "x" in eq_Abs_complex)
paulson@14323: apply (simp (no_asm_simp) add: complex_inverse complex_minus real_power_two)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_divide_one: "x / (1::complex) = x"
paulson@14323: apply (unfold complex_divide_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_divide_one [simp]
paulson@14323: 
paulson@14323: lemma complex_mod_inverse: "cmod(inverse x) = inverse(cmod x)"
paulson@14323: apply (case_tac "x=0", simp add: COMPLEX_INVERSE_ZERO)
paulson@14323: apply (rule_tac c1 = "cmod x" in real_mult_left_cancel [THEN iffD1])
paulson@14323: apply (auto simp add: complex_mod_mult [symmetric])
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_mod_divide:
paulson@14323:       "cmod(x/y) = cmod(x)/(cmod y)"
paulson@14323: apply (unfold complex_divide_def real_divide_def)
paulson@14323: apply (auto simp add: complex_mod_mult complex_mod_inverse)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_inverse_divide:
paulson@14323:       "inverse(x/y) = y/(x::complex)"
paulson@14323: apply (unfold complex_divide_def)
paulson@14323: apply (auto simp add: complex_inverse_distrib complex_mult_commute)
paulson@14323: done
paulson@14323: declare complex_inverse_divide [simp]
paulson@14323: 
paulson@14323: lemma complexpow_mult: "((r::complex) * s) ^ n = (r ^ n) * (s ^ n)"
paulson@14323: apply (induct_tac "n")
paulson@14323: apply (auto simp add: complex_mult_ac)
paulson@14323: done
paulson@14323: 
paulson@14323: 
paulson@14323: subsection{*More Exponentiation*}
paulson@14323: 
paulson@14323: lemma complexpow_zero: "(0::complex) ^ (Suc n) = 0"
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare complexpow_zero [simp]
paulson@14323: 
paulson@14323: lemma complexpow_not_zero [rule_format (no_asm)]: "r ~= (0::complex) --> r ^ n ~= 0"
paulson@14323: apply (induct_tac "n")
paulson@14323: apply (auto simp add: complex_mult_not_zero)
paulson@14323: done
paulson@14323: declare complexpow_not_zero [simp]
paulson@14323: declare complexpow_not_zero [intro]
paulson@14323: 
paulson@14323: lemma complexpow_zero_zero: "r ^ n = (0::complex) ==> r = 0"
paulson@14323: apply (blast intro: ccontr dest: complexpow_not_zero)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complexpow_i_squared: "ii ^ 2 = -(1::complex)"
paulson@14323: apply (unfold i_def)
paulson@14323: apply (auto simp add: complex_mult complex_one_def complex_minus numeral_2_eq_2)
paulson@14323: done
paulson@14323: declare complexpow_i_squared [simp]
paulson@14323: 
paulson@14323: lemma complex_i_not_zero: "ii ~= 0"
paulson@14323: apply (unfold i_def complex_zero_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare complex_i_not_zero [simp]
paulson@14323: 
paulson@14323: lemma complex_mult_eq_zero_cancel1: "x * y ~= (0::complex) ==> x ~= 0"
paulson@14323: apply auto
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_mult_eq_zero_cancel2: "x * y ~= 0 ==> y ~= (0::complex)"
paulson@14323: apply auto
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_mult_not_eq_zero_iff: "(x * y ~= 0) = (x ~= 0 & y ~= (0::complex))"
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare complex_mult_not_eq_zero_iff [iff]
paulson@14323: 
paulson@14323: lemma complexpow_inverse: "inverse ((r::complex) ^ n) = (inverse r) ^ n"
paulson@14323: apply (induct_tac "n")
paulson@14323: apply (auto simp add: complex_inverse_distrib)
paulson@14323: done
paulson@14323: 
paulson@14323: (*---------------------------------------------------------------------------*)
paulson@14323: (* sgn                                                                       *)
paulson@14323: (*---------------------------------------------------------------------------*)
paulson@14323: 
paulson@14323: lemma sgn_zero: "sgn 0 = 0"
paulson@14323: 
paulson@14323: apply (unfold sgn_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare sgn_zero [simp]
paulson@14323: 
paulson@14323: lemma sgn_one: "sgn 1 = 1"
paulson@14323: apply (unfold sgn_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare sgn_one [simp]
paulson@14323: 
paulson@14323: lemma sgn_minus: "sgn (-z) = - sgn(z)"
paulson@14323: apply (unfold sgn_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: 
paulson@14323: lemma sgn_eq:
paulson@14323:     "sgn z = z / complex_of_real (cmod z)"
paulson@14323: apply (unfold sgn_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_split: "EX x y. z = complex_of_real(x) + ii * complex_of_real(y)"
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_of_real_def i_def complex_mult complex_add)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma Re_complex_i: "Re(complex_of_real(x) + ii * complex_of_real(y)) = x"
paulson@14323: apply (auto simp add: complex_of_real_def i_def complex_mult complex_add)
paulson@14323: done
paulson@14323: declare Re_complex_i [simp]
paulson@14323: 
paulson@14323: lemma Im_complex_i: "Im(complex_of_real(x) + ii * complex_of_real(y)) = y"
paulson@14323: apply (auto simp add: complex_of_real_def i_def complex_mult complex_add)
paulson@14323: done
paulson@14323: declare Im_complex_i [simp]
paulson@14323: 
paulson@14323: lemma i_mult_eq: "ii * ii = complex_of_real (-1)"
paulson@14323: apply (unfold i_def complex_of_real_def)
paulson@14323: apply (auto simp add: complex_mult complex_add)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma i_mult_eq2: "ii * ii = -(1::complex)"
paulson@14323: apply (unfold i_def complex_one_def)
paulson@14323: apply (simp (no_asm) add: complex_mult complex_minus)
paulson@14323: done
paulson@14323: declare i_mult_eq2 [simp]
paulson@14323: 
paulson@14323: lemma cmod_i: "cmod (complex_of_real(x) + ii * complex_of_real(y)) =
paulson@14323:       sqrt (x ^ 2 + y ^ 2)"
paulson@14323: apply (auto simp add: complex_mult complex_add i_def complex_of_real_def cmod_def)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_eq_Re_eq:
paulson@14323:      "complex_of_real xa + ii * complex_of_real ya =
paulson@14323:       complex_of_real xb + ii * complex_of_real yb
paulson@14323:        ==> xa = xb"
paulson@14323: apply (unfold complex_of_real_def i_def)
paulson@14323: apply (auto simp add: complex_mult complex_add)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_eq_Im_eq:
paulson@14323:      "complex_of_real xa + ii * complex_of_real ya =
paulson@14323:       complex_of_real xb + ii * complex_of_real yb
paulson@14323:        ==> ya = yb"
paulson@14323: apply (unfold complex_of_real_def i_def)
paulson@14323: apply (auto simp add: complex_mult complex_add)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_eq_cancel_iff: "(complex_of_real xa + ii * complex_of_real ya =
paulson@14323:        complex_of_real xb + ii * complex_of_real yb) = ((xa = xb) & (ya = yb))"
paulson@14323: apply (auto intro: complex_eq_Im_eq complex_eq_Re_eq)
paulson@14323: done
paulson@14323: declare complex_eq_cancel_iff [iff]
paulson@14323: 
paulson@14323: lemma complex_eq_cancel_iffA: "(complex_of_real xa + complex_of_real ya * ii =
paulson@14323:        complex_of_real xb + complex_of_real yb * ii ) = ((xa = xb) & (ya = yb))"
paulson@14323: apply (auto simp add: complex_mult_commute)
paulson@14323: done
paulson@14323: declare complex_eq_cancel_iffA [iff]
paulson@14323: 
paulson@14323: lemma complex_eq_cancel_iffB: "(complex_of_real xa + complex_of_real ya * ii =
paulson@14323:        complex_of_real xb + ii * complex_of_real yb) = ((xa = xb) & (ya = yb))"
paulson@14323: apply (auto simp add: complex_mult_commute)
paulson@14323: done
paulson@14323: declare complex_eq_cancel_iffB [iff]
paulson@14323: 
paulson@14323: lemma complex_eq_cancel_iffC: "(complex_of_real xa + ii * complex_of_real ya  =
paulson@14323:        complex_of_real xb + complex_of_real yb * ii) = ((xa = xb) & (ya = yb))"
paulson@14323: apply (auto simp add: complex_mult_commute)
paulson@14323: done
paulson@14323: declare complex_eq_cancel_iffC [iff]
paulson@14323: 
paulson@14323: lemma complex_eq_cancel_iff2: "(complex_of_real x + ii * complex_of_real y =
paulson@14323:       complex_of_real xa) = (x = xa & y = 0)"
paulson@14323: apply (cut_tac xa = "x" and ya = "y" and xb = "xa" and yb = "0" in complex_eq_cancel_iff)
paulson@14323: apply (simp del: complex_eq_cancel_iff)
paulson@14323: done
paulson@14323: declare complex_eq_cancel_iff2 [simp]
paulson@14323: 
paulson@14323: lemma complex_eq_cancel_iff2a: "(complex_of_real x + complex_of_real y * ii =
paulson@14323:       complex_of_real xa) = (x = xa & y = 0)"
paulson@14323: apply (auto simp add: complex_mult_commute)
paulson@14323: done
paulson@14323: declare complex_eq_cancel_iff2a [simp]
paulson@14323: 
paulson@14323: lemma complex_eq_cancel_iff3: "(complex_of_real x + ii * complex_of_real y =
paulson@14323:       ii * complex_of_real ya) = (x = 0 & y = ya)"
paulson@14323: apply (cut_tac xa = "x" and ya = "y" and xb = "0" and yb = "ya" in complex_eq_cancel_iff)
paulson@14323: apply (simp del: complex_eq_cancel_iff)
paulson@14323: done
paulson@14323: declare complex_eq_cancel_iff3 [simp]
paulson@14323: 
paulson@14323: lemma complex_eq_cancel_iff3a: "(complex_of_real x + complex_of_real y * ii =
paulson@14323:       ii * complex_of_real ya) = (x = 0 & y = ya)"
paulson@14323: apply (auto simp add: complex_mult_commute)
paulson@14323: done
paulson@14323: declare complex_eq_cancel_iff3a [simp]
paulson@14323: 
paulson@14323: lemma complex_split_Re_zero:
paulson@14323:      "complex_of_real x + ii * complex_of_real y = 0
paulson@14323:       ==> x = 0"
paulson@14323: apply (unfold complex_of_real_def i_def complex_zero_def)
paulson@14323: apply (auto simp add: complex_mult complex_add)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_split_Im_zero:
paulson@14323:      "complex_of_real x + ii * complex_of_real y = 0
paulson@14323:       ==> y = 0"
paulson@14323: apply (unfold complex_of_real_def i_def complex_zero_def)
paulson@14323: apply (auto simp add: complex_mult complex_add)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma Re_sgn:
paulson@14323:       "Re(sgn z) = Re(z)/cmod z"
paulson@14323: apply (unfold sgn_def complex_divide_def)
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_of_real_inverse [symmetric])
paulson@14323: apply (auto simp add: complex_of_real_def complex_mult real_divide_def)
paulson@14323: done
paulson@14323: declare Re_sgn [simp]
paulson@14323: 
paulson@14323: lemma Im_sgn:
paulson@14323:       "Im(sgn z) = Im(z)/cmod z"
paulson@14323: apply (unfold sgn_def complex_divide_def)
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_of_real_inverse [symmetric])
paulson@14323: apply (auto simp add: complex_of_real_def complex_mult real_divide_def)
paulson@14323: done
paulson@14323: declare Im_sgn [simp]
paulson@14323: 
paulson@14323: lemma complex_inverse_complex_split:
paulson@14323:      "inverse(complex_of_real x + ii * complex_of_real y) =
paulson@14323:       complex_of_real(x/(x ^ 2 + y ^ 2)) -
paulson@14323:       ii * complex_of_real(y/(x ^ 2 + y ^ 2))"
paulson@14323: apply (unfold complex_of_real_def i_def)
paulson@14323: apply (auto simp add: complex_mult complex_add complex_diff_def complex_minus complex_inverse real_divide_def)
paulson@14323: done
paulson@14323: 
paulson@14323: (*----------------------------------------------------------------------------*)
paulson@14323: (* Many of the theorems below need to be moved elsewhere e.g. Transc. Also *)
paulson@14323: (* many of the theorems are not used - so should they be kept?                *)
paulson@14323: (*----------------------------------------------------------------------------*)
paulson@14323: 
paulson@14323: lemma Re_mult_i_eq:
paulson@14323:     "Re (ii * complex_of_real y) = 0"
paulson@14323: apply (unfold i_def complex_of_real_def)
paulson@14323: apply (auto simp add: complex_mult)
paulson@14323: done
paulson@14323: declare Re_mult_i_eq [simp]
paulson@14323: 
paulson@14323: lemma Im_mult_i_eq:
paulson@14323:     "Im (ii * complex_of_real y) = y"
paulson@14323: apply (unfold i_def complex_of_real_def)
paulson@14323: apply (auto simp add: complex_mult)
paulson@14323: done
paulson@14323: declare Im_mult_i_eq [simp]
paulson@14323: 
paulson@14323: lemma complex_mod_mult_i:
paulson@14323:     "cmod (ii * complex_of_real y) = abs y"
paulson@14323: apply (unfold i_def complex_of_real_def)
paulson@14323: apply (auto simp add: complex_mult complex_mod real_power_two)
paulson@14323: done
paulson@14323: declare complex_mod_mult_i [simp]
paulson@14323: 
paulson@14323: lemma cos_arg_i_mult_zero:
paulson@14323:    "0 < y ==> cos (arg(ii * complex_of_real y)) = 0"
paulson@14323: apply (unfold arg_def)
paulson@14323: apply (auto simp add: abs_eqI2)
paulson@14323: apply (rule_tac a = "pi/2" in someI2)
paulson@14323: apply auto
paulson@14323: apply (rule order_less_trans [of _ 0])
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare cos_arg_i_mult_zero [simp]
paulson@14323: 
paulson@14323: lemma cos_arg_i_mult_zero2:
paulson@14323:    "y < 0 ==> cos (arg(ii * complex_of_real y)) = 0"
paulson@14323: apply (unfold arg_def)
paulson@14323: apply (auto simp add: abs_minus_eqI2)
paulson@14323: apply (rule_tac a = "- pi/2" in someI2)
paulson@14323: apply auto
paulson@14323: apply (rule order_trans [of _ 0])
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare cos_arg_i_mult_zero2 [simp]
paulson@14323: 
paulson@14323: lemma complex_of_real_not_zero_iff:
paulson@14323:       "(complex_of_real y ~= 0) = (y ~= 0)"
paulson@14323: apply (unfold complex_zero_def complex_of_real_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare complex_of_real_not_zero_iff [simp]
paulson@14323: 
paulson@14323: lemma complex_of_real_zero_iff: "(complex_of_real y = 0) = (y = 0)"
paulson@14323: apply auto
paulson@14323: apply (rule ccontr , drule complex_of_real_not_zero_iff [THEN iffD2])
paulson@14323: apply simp
paulson@14323: done
paulson@14323: declare complex_of_real_zero_iff [simp]
paulson@14323: 
paulson@14323: lemma cos_arg_i_mult_zero3: "y ~= 0 ==> cos (arg(ii * complex_of_real y)) = 0"
paulson@14323: apply (cut_tac x = "y" and y = "0" in linorder_less_linear)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare cos_arg_i_mult_zero3 [simp]
paulson@14323: 
paulson@14323: 
paulson@14323: subsection{*Finally! Polar Form for Complex Numbers*}
paulson@14323: 
paulson@14323: lemma complex_split_polar: "EX r a. z = complex_of_real r *
paulson@14323:       (complex_of_real(cos a) + ii * complex_of_real(sin a))"
paulson@14323: apply (cut_tac z = "z" in complex_split)
paulson@14323: apply (auto simp add: polar_Ex complex_add_mult_distrib2 complex_of_real_mult complex_mult_ac)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma rcis_Ex: "EX r a. z = rcis r a"
paulson@14323: apply (unfold rcis_def cis_def)
paulson@14323: apply (rule complex_split_polar)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma Re_complex_polar: "Re(complex_of_real r *
paulson@14323:       (complex_of_real(cos a) + ii * complex_of_real(sin a))) = r * cos a"
paulson@14323: apply (auto simp add: complex_add_mult_distrib2 complex_of_real_mult complex_mult_ac)
paulson@14323: done
paulson@14323: declare Re_complex_polar [simp]
paulson@14323: 
paulson@14323: lemma Re_rcis: "Re(rcis r a) = r * cos a"
paulson@14323: apply (unfold rcis_def cis_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare Re_rcis [simp]
paulson@14323: 
paulson@14323: lemma Im_complex_polar: "Im(complex_of_real r *
paulson@14323:       (complex_of_real(cos a) + ii * complex_of_real(sin a))) = r * sin a"
paulson@14323: apply (auto simp add: complex_add_mult_distrib2 complex_of_real_mult complex_mult_ac)
paulson@14323: done
paulson@14323: declare Im_complex_polar [simp]
paulson@14323: 
paulson@14323: lemma Im_rcis: "Im(rcis r a) = r * sin a"
paulson@14323: apply (unfold rcis_def cis_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare Im_rcis [simp]
paulson@14323: 
paulson@14323: lemma complex_mod_complex_polar: "cmod (complex_of_real r *
paulson@14323:       (complex_of_real(cos a) + ii * complex_of_real(sin a))) = abs r"
paulson@14323: apply (auto simp add: complex_add_mult_distrib2 cmod_i complex_of_real_mult real_add_mult_distrib2 [symmetric] realpow_mult complex_mult_ac real_mult_ac simp del: realpow_Suc)
paulson@14323: done
paulson@14323: declare complex_mod_complex_polar [simp]
paulson@14323: 
paulson@14323: lemma complex_mod_rcis: "cmod(rcis r a) = abs r"
paulson@14323: apply (unfold rcis_def cis_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare complex_mod_rcis [simp]
paulson@14323: 
paulson@14323: lemma complex_mod_sqrt_Re_mult_cnj: "cmod z = sqrt (Re (z * cnj z))"
paulson@14323: apply (unfold cmod_def)
paulson@14323: apply (rule real_sqrt_eq_iff [THEN iffD2])
paulson@14323: apply (auto simp add: complex_mult_cnj)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_Re_cnj: "Re(cnj z) = Re z"
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_cnj)
paulson@14323: done
paulson@14323: declare complex_Re_cnj [simp]
paulson@14323: 
paulson@14323: lemma complex_Im_cnj: "Im(cnj z) = - Im z"
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_cnj)
paulson@14323: done
paulson@14323: declare complex_Im_cnj [simp]
paulson@14323: 
paulson@14323: lemma complex_In_mult_cnj_zero: "Im (z * cnj z) = 0"
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_cnj complex_mult)
paulson@14323: done
paulson@14323: declare complex_In_mult_cnj_zero [simp]
paulson@14323: 
paulson@14323: lemma complex_Re_mult: "[| Im w = 0; Im z = 0 |] ==> Re(w * z) = Re(w) * Re(z)"
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "w" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_mult)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_Re_mult_complex_of_real: "Re (z * complex_of_real c) = Re(z) * c"
paulson@14323: apply (unfold complex_of_real_def)
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_mult)
paulson@14323: done
paulson@14323: declare complex_Re_mult_complex_of_real [simp]
paulson@14323: 
paulson@14323: lemma complex_Im_mult_complex_of_real: "Im (z * complex_of_real c) = Im(z) * c"
paulson@14323: apply (unfold complex_of_real_def)
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_mult)
paulson@14323: done
paulson@14323: declare complex_Im_mult_complex_of_real [simp]
paulson@14323: 
paulson@14323: lemma complex_Re_mult_complex_of_real2: "Re (complex_of_real c * z) = c * Re(z)"
paulson@14323: apply (unfold complex_of_real_def)
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_mult)
paulson@14323: done
paulson@14323: declare complex_Re_mult_complex_of_real2 [simp]
paulson@14323: 
paulson@14323: lemma complex_Im_mult_complex_of_real2: "Im (complex_of_real c * z) = c * Im(z)"
paulson@14323: apply (unfold complex_of_real_def)
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_mult)
paulson@14323: done
paulson@14323: declare complex_Im_mult_complex_of_real2 [simp]
paulson@14323: 
paulson@14323: (*---------------------------------------------------------------------------*)
paulson@14323: (*  (r1 * cis a) * (r2 * cis b) = r1 * r2 * cis (a + b)                      *)
paulson@14323: (*---------------------------------------------------------------------------*)
paulson@14323: 
paulson@14323: lemma cis_rcis_eq: "cis a = rcis 1 a"
paulson@14323: apply (unfold rcis_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: 
paulson@14323: lemma rcis_mult:
paulson@14323:   "rcis r1 a * rcis r2 b = rcis (r1*r2) (a + b)"
paulson@14323: apply (unfold rcis_def cis_def)
paulson@14323: apply (auto simp add: cos_add sin_add complex_add_mult_distrib2 complex_add_mult_distrib complex_mult_ac complex_add_ac)
paulson@14323: apply (auto simp add: complex_add_mult_distrib2 [symmetric] complex_mult_assoc [symmetric] complex_of_real_mult complex_of_real_add complex_add_assoc [symmetric] i_mult_eq simp del: i_mult_eq2)
paulson@14323: apply (auto simp add: complex_add_ac)
paulson@14323: apply (auto simp add: complex_add_assoc [symmetric] complex_of_real_add real_add_mult_distrib2 real_diff_def mult_ac add_ac)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma cis_mult: "cis a * cis b = cis (a + b)"
paulson@14323: apply (simp (no_asm) add: cis_rcis_eq rcis_mult)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma cis_zero: "cis 0 = 1"
paulson@14323: apply (unfold cis_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare cis_zero [simp]
paulson@14323: 
paulson@14323: lemma cis_zero2: "cis 0 = complex_of_real 1"
paulson@14323: apply (unfold cis_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare cis_zero2 [simp]
paulson@14323: 
paulson@14323: lemma rcis_zero_mod: "rcis 0 a = 0"
paulson@14323: apply (unfold rcis_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare rcis_zero_mod [simp]
paulson@14323: 
paulson@14323: lemma rcis_zero_arg: "rcis r 0 = complex_of_real r"
paulson@14323: apply (unfold rcis_def)
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare rcis_zero_arg [simp]
paulson@14323: 
paulson@14323: lemma complex_of_real_minus_one:
paulson@14323:    "complex_of_real (-(1::real)) = -(1::complex)"
paulson@14323: apply (unfold complex_of_real_def complex_one_def)
paulson@14323: apply (simp (no_asm) add: complex_minus)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_i_mult_minus: "ii * (ii * x) = - x"
paulson@14323: apply (simp (no_asm) add: complex_mult_assoc [symmetric])
paulson@14323: done
paulson@14323: declare complex_i_mult_minus [simp]
paulson@14323: 
paulson@14323: lemma complex_i_mult_minus2: "ii * ii * x = - x"
paulson@14323: apply (simp (no_asm))
paulson@14323: done
paulson@14323: declare complex_i_mult_minus2 [simp]
paulson@14323: 
paulson@14323: lemma cis_real_of_nat_Suc_mult:
paulson@14323:    "cis (real (Suc n) * a) = cis a * cis (real n * a)"
paulson@14323: apply (unfold cis_def)
paulson@14323: apply (auto simp add: real_of_nat_Suc real_add_mult_distrib cos_add sin_add complex_add_mult_distrib complex_add_mult_distrib2 complex_of_real_add complex_of_real_mult complex_mult_ac complex_add_ac)
paulson@14323: apply (auto simp add: complex_add_mult_distrib2 [symmetric] complex_mult_assoc [symmetric] i_mult_eq complex_of_real_mult complex_of_real_add complex_add_assoc [symmetric] complex_of_real_minus [symmetric] real_diff_def mult_ac simp del: i_mult_eq2)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma DeMoivre: "(cis a) ^ n = cis (real n * a)"
paulson@14323: apply (induct_tac "n")
paulson@14323: apply (auto simp add: cis_real_of_nat_Suc_mult)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma DeMoivre2:
paulson@14323:    "(rcis r a) ^ n = rcis (r ^ n) (real n * a)"
paulson@14323: apply (unfold rcis_def)
paulson@14323: apply (auto simp add: complexpow_mult DeMoivre complex_of_real_pow)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma cis_inverse: "inverse(cis a) = cis (-a)"
paulson@14323: apply (unfold cis_def)
paulson@14323: apply (auto simp add: complex_inverse_complex_split complex_of_real_minus complex_diff_def)
paulson@14323: done
paulson@14323: declare cis_inverse [simp]
paulson@14323: 
paulson@14323: lemma rcis_inverse: "inverse(rcis r a) = rcis (1/r) (-a)"
paulson@14323: apply (case_tac "r=0")
paulson@14323: apply (simp (no_asm_simp) add: DIVISION_BY_ZERO COMPLEX_INVERSE_ZERO)
paulson@14323: apply (auto simp add: complex_inverse_complex_split complex_add_mult_distrib2 complex_of_real_mult rcis_def cis_def real_power_two complex_mult_ac real_mult_ac)
paulson@14323: apply (auto simp add: real_add_mult_distrib2 [symmetric] complex_of_real_minus complex_diff_def)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma cis_divide: "cis a / cis b = cis (a - b)"
paulson@14323: apply (unfold complex_divide_def)
paulson@14323: apply (auto simp add: cis_mult real_diff_def)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma rcis_divide:
paulson@14323:  "rcis r1 a / rcis r2 b = rcis (r1/r2) (a - b)"
paulson@14323: apply (unfold complex_divide_def)
paulson@14323: apply (case_tac "r2=0")
paulson@14323: apply (simp (no_asm_simp) add: DIVISION_BY_ZERO COMPLEX_INVERSE_ZERO)
paulson@14323: apply (auto simp add: rcis_inverse rcis_mult real_diff_def)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma Re_cis: "Re(cis a) = cos a"
paulson@14323: apply (unfold cis_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare Re_cis [simp]
paulson@14323: 
paulson@14323: lemma Im_cis: "Im(cis a) = sin a"
paulson@14323: apply (unfold cis_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare Im_cis [simp]
paulson@14323: 
paulson@14323: lemma cos_n_Re_cis_pow_n: "cos (real n * a) = Re(cis a ^ n)"
paulson@14323: apply (auto simp add: DeMoivre)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma sin_n_Im_cis_pow_n: "sin (real n * a) = Im(cis a ^ n)"
paulson@14323: apply (auto simp add: DeMoivre)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma expi_Im_split:
paulson@14323:     "expi (ii * complex_of_real y) =
paulson@14323:      complex_of_real (cos y) + ii * complex_of_real (sin y)"
paulson@14323: apply (unfold expi_def cis_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: 
paulson@14323: lemma expi_Im_cis:
paulson@14323:     "expi (ii * complex_of_real y) = cis y"
paulson@14323: apply (unfold expi_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: 
paulson@14323: lemma expi_add: "expi(a + b) = expi(a) * expi(b)"
paulson@14323: apply (unfold expi_def)
paulson@14323: apply (auto simp add: complex_Re_add exp_add complex_Im_add cis_mult [symmetric] complex_of_real_mult complex_mult_ac)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma expi_complex_split:
paulson@14323:      "expi(complex_of_real x + ii * complex_of_real y) =
paulson@14323:       complex_of_real (exp(x)) * cis y"
paulson@14323: apply (unfold expi_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: 
paulson@14323: lemma expi_zero: "expi (0::complex) = 1"
paulson@14323: apply (unfold expi_def)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: declare expi_zero [simp]
paulson@14323: 
paulson@14323: lemma complex_Re_mult_eq: "Re (w * z) = Re w * Re z - Im w * Im z"
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "w" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_mult)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_Im_mult_eq:
paulson@14323:      "Im (w * z) = Re w * Im z + Im w * Re z"
paulson@14323: apply (rule_tac z = "z" in eq_Abs_complex)
paulson@14323: apply (rule_tac z = "w" in eq_Abs_complex)
paulson@14323: apply (auto simp add: complex_mult)
paulson@14323: done
paulson@14323: 
paulson@14323: lemma complex_expi_Ex: 
paulson@14323:    "EX a r. z = complex_of_real r * expi a"
paulson@14323: apply (cut_tac z = "z" in rcis_Ex)
paulson@14323: apply (auto simp add: expi_def rcis_def complex_mult_assoc [symmetric] complex_of_real_mult)
paulson@14323: apply (rule_tac x = "ii * complex_of_real a" in exI)
paulson@14323: apply auto
paulson@14323: done
paulson@14323: 
paulson@14323: 
paulson@14323: (****
paulson@14323: Goal "[| - pi < a; a <= pi |] ==> (-pi < a & a <= 0) | (0 <= a & a <= pi)"
paulson@14323: by Auto_tac;
paulson@14323: qed "lemma_split_interval";
paulson@14323: 
paulson@14323: Goalw [arg_def]
paulson@14323:   "[| r ~= 0; - pi < a; a <= pi |] \
paulson@14323: \  ==> arg(complex_of_real r * \
paulson@14323: \      (complex_of_real(cos a) + ii * complex_of_real(sin a))) = a";
paulson@14323: by Auto_tac;
paulson@14323: by (cut_inst_tac [("x","0"),("y","r")] linorder_less_linear 1);
paulson@14323: by (auto_tac (claset(),simpset() addsimps (map (full_rename_numerals thy)
paulson@14323:     [rabs_eqI2,rabs_minus_eqI2,real_minus_rinv]) [real_divide_def,
paulson@14323:     real_minus_mult_eq2 RS sym] real_mult_ac));
paulson@14323: by (auto_tac (claset(),simpset() addsimps [real_mult_assoc RS sym]));
paulson@14323: by (dtac lemma_split_interval 1 THEN safe);
paulson@14323: ****)
paulson@14323: 
paulson@14323: 
paulson@14323: ML
paulson@14323: {*
paulson@14323: val complex_zero_def = thm"complex_zero_def";
paulson@14323: val complex_one_def = thm"complex_one_def";
paulson@14323: val complex_minus_def = thm"complex_minus_def";
paulson@14323: val complex_diff_def = thm"complex_diff_def";
paulson@14323: val complex_divide_def = thm"complex_divide_def";
paulson@14323: val complex_mult_def = thm"complex_mult_def";
paulson@14323: val complex_add_def = thm"complex_add_def";
paulson@14323: val complex_of_real_def = thm"complex_of_real_def";
paulson@14323: val i_def = thm"i_def";
paulson@14323: val expi_def = thm"expi_def";
paulson@14323: val cis_def = thm"cis_def";
paulson@14323: val rcis_def = thm"rcis_def";
paulson@14323: val cmod_def = thm"cmod_def";
paulson@14323: val cnj_def = thm"cnj_def";
paulson@14323: val sgn_def = thm"sgn_def";
paulson@14323: val arg_def = thm"arg_def";
paulson@14323: val complexpow_0 = thm"complexpow_0";
paulson@14323: val complexpow_Suc = thm"complexpow_Suc";
paulson@14323: 
paulson@14323: val inj_Rep_complex = thm"inj_Rep_complex";
paulson@14323: val inj_Abs_complex = thm"inj_Abs_complex";
paulson@14323: val Abs_complex_cancel_iff = thm"Abs_complex_cancel_iff";
paulson@14323: val pair_mem_complex = thm"pair_mem_complex";
paulson@14323: val Abs_complex_inverse2 = thm"Abs_complex_inverse2";
paulson@14323: val eq_Abs_complex = thm"eq_Abs_complex";
paulson@14323: val Re = thm"Re";
paulson@14323: val Im = thm"Im";
paulson@14323: val Abs_complex_cancel = thm"Abs_complex_cancel";
paulson@14323: val complex_Re_Im_cancel_iff = thm"complex_Re_Im_cancel_iff";
paulson@14323: val complex_Re_zero = thm"complex_Re_zero";
paulson@14323: val complex_Im_zero = thm"complex_Im_zero";
paulson@14323: val complex_Re_one = thm"complex_Re_one";
paulson@14323: val complex_Im_one = thm"complex_Im_one";
paulson@14323: val complex_Re_i = thm"complex_Re_i";
paulson@14323: val complex_Im_i = thm"complex_Im_i";
paulson@14323: val Re_complex_of_real_zero = thm"Re_complex_of_real_zero";
paulson@14323: val Im_complex_of_real_zero = thm"Im_complex_of_real_zero";
paulson@14323: val Re_complex_of_real_one = thm"Re_complex_of_real_one";
paulson@14323: val Im_complex_of_real_one = thm"Im_complex_of_real_one";
paulson@14323: val Re_complex_of_real = thm"Re_complex_of_real";
paulson@14323: val Im_complex_of_real = thm"Im_complex_of_real";
paulson@14323: val complex_minus = thm"complex_minus";
paulson@14323: val complex_Re_minus = thm"complex_Re_minus";
paulson@14323: val complex_Im_minus = thm"complex_Im_minus";
paulson@14323: val complex_minus_minus = thm"complex_minus_minus";
paulson@14323: val inj_complex_minus = thm"inj_complex_minus";
paulson@14323: val complex_minus_zero = thm"complex_minus_zero";
paulson@14323: val complex_minus_zero_iff = thm"complex_minus_zero_iff";
paulson@14323: val complex_minus_zero_iff2 = thm"complex_minus_zero_iff2";
paulson@14323: val complex_minus_not_zero_iff = thm"complex_minus_not_zero_iff";
paulson@14323: val complex_add = thm"complex_add";
paulson@14323: val complex_Re_add = thm"complex_Re_add";
paulson@14323: val complex_Im_add = thm"complex_Im_add";
paulson@14323: val complex_add_commute = thm"complex_add_commute";
paulson@14323: val complex_add_assoc = thm"complex_add_assoc";
paulson@14323: val complex_add_left_commute = thm"complex_add_left_commute";
paulson@14323: val complex_add_zero_left = thm"complex_add_zero_left";
paulson@14323: val complex_add_zero_right = thm"complex_add_zero_right";
paulson@14323: val complex_add_minus_right_zero = thm"complex_add_minus_right_zero";
paulson@14323: val complex_add_minus_left_zero = thm"complex_add_minus_left_zero";
paulson@14323: val complex_add_minus_cancel = thm"complex_add_minus_cancel";
paulson@14323: val complex_minus_add_cancel = thm"complex_minus_add_cancel";
paulson@14323: val complex_add_minus_eq_minus = thm"complex_add_minus_eq_minus";
paulson@14323: val complex_minus_add_distrib = thm"complex_minus_add_distrib";
paulson@14323: val complex_add_left_cancel = thm"complex_add_left_cancel";
paulson@14323: val complex_add_right_cancel = thm"complex_add_right_cancel";
paulson@14323: val complex_eq_minus_iff = thm"complex_eq_minus_iff";
paulson@14323: val complex_eq_minus_iff2 = thm"complex_eq_minus_iff2";
paulson@14323: val complex_diff_0 = thm"complex_diff_0";
paulson@14323: val complex_diff_0_right = thm"complex_diff_0_right";
paulson@14323: val complex_diff_self = thm"complex_diff_self";
paulson@14323: val complex_diff = thm"complex_diff";
paulson@14323: val complex_diff_eq_eq = thm"complex_diff_eq_eq";
paulson@14323: val complex_mult = thm"complex_mult";
paulson@14323: val complex_mult_commute = thm"complex_mult_commute";
paulson@14323: val complex_mult_assoc = thm"complex_mult_assoc";
paulson@14323: val complex_mult_left_commute = thm"complex_mult_left_commute";
paulson@14323: val complex_mult_one_left = thm"complex_mult_one_left";
paulson@14323: val complex_mult_one_right = thm"complex_mult_one_right";
paulson@14323: val complex_mult_zero_left = thm"complex_mult_zero_left";
paulson@14323: val complex_mult_zero_right = thm"complex_mult_zero_right";
paulson@14323: val complex_divide_zero = thm"complex_divide_zero";
paulson@14323: val complex_minus_mult_eq1 = thm"complex_minus_mult_eq1";
paulson@14323: val complex_minus_mult_eq2 = thm"complex_minus_mult_eq2";
paulson@14323: val complex_mult_minus_one = thm"complex_mult_minus_one";
paulson@14323: val complex_mult_minus_one_right = thm"complex_mult_minus_one_right";
paulson@14323: val complex_minus_mult_cancel = thm"complex_minus_mult_cancel";
paulson@14323: val complex_minus_mult_commute = thm"complex_minus_mult_commute";
paulson@14323: val complex_add_mult_distrib = thm"complex_add_mult_distrib";
paulson@14323: val complex_add_mult_distrib2 = thm"complex_add_mult_distrib2";
paulson@14323: val complex_zero_not_eq_one = thm"complex_zero_not_eq_one";
paulson@14323: val complex_inverse = thm"complex_inverse";
paulson@14323: val COMPLEX_INVERSE_ZERO = thm"COMPLEX_INVERSE_ZERO";
paulson@14323: val COMPLEX_DIVISION_BY_ZERO = thm"COMPLEX_DIVISION_BY_ZERO";
paulson@14323: val complex_mult_inv_left = thm"complex_mult_inv_left";
paulson@14323: val complex_mult_inv_right = thm"complex_mult_inv_right";
paulson@14323: val complex_mult_left_cancel = thm"complex_mult_left_cancel";
paulson@14323: val complex_mult_right_cancel = thm"complex_mult_right_cancel";
paulson@14323: val complex_inverse_not_zero = thm"complex_inverse_not_zero";
paulson@14323: val complex_mult_not_zero = thm"complex_mult_not_zero";
paulson@14323: val complex_inverse_inverse = thm"complex_inverse_inverse";
paulson@14323: val complex_inverse_one = thm"complex_inverse_one";
paulson@14323: val complex_minus_inverse = thm"complex_minus_inverse";
paulson@14323: val complex_inverse_distrib = thm"complex_inverse_distrib";
paulson@14323: val complex_times_divide1_eq = thm"complex_times_divide1_eq";
paulson@14323: val complex_times_divide2_eq = thm"complex_times_divide2_eq";
paulson@14323: val complex_divide_divide1_eq = thm"complex_divide_divide1_eq";
paulson@14323: val complex_divide_divide2_eq = thm"complex_divide_divide2_eq";
paulson@14323: val complex_minus_divide_eq = thm"complex_minus_divide_eq";
paulson@14323: val complex_divide_minus_eq = thm"complex_divide_minus_eq";
paulson@14323: val complex_add_divide_distrib = thm"complex_add_divide_distrib";
paulson@14323: val inj_complex_of_real = thm"inj_complex_of_real";
paulson@14323: val complex_of_real_one = thm"complex_of_real_one";
paulson@14323: val complex_of_real_zero = thm"complex_of_real_zero";
paulson@14323: val complex_of_real_eq_iff = thm"complex_of_real_eq_iff";
paulson@14323: val complex_of_real_minus = thm"complex_of_real_minus";
paulson@14323: val complex_of_real_inverse = thm"complex_of_real_inverse";
paulson@14323: val complex_of_real_add = thm"complex_of_real_add";
paulson@14323: val complex_of_real_diff = thm"complex_of_real_diff";
paulson@14323: val complex_of_real_mult = thm"complex_of_real_mult";
paulson@14323: val complex_of_real_divide = thm"complex_of_real_divide";
paulson@14323: val complex_of_real_pow = thm"complex_of_real_pow";
paulson@14323: val complex_mod = thm"complex_mod";
paulson@14323: val complex_mod_zero = thm"complex_mod_zero";
paulson@14323: val complex_mod_one = thm"complex_mod_one";
paulson@14323: val complex_mod_complex_of_real = thm"complex_mod_complex_of_real";
paulson@14323: val complex_of_real_abs = thm"complex_of_real_abs";
paulson@14323: val complex_cnj = thm"complex_cnj";
paulson@14323: val inj_cnj = thm"inj_cnj";
paulson@14323: val complex_cnj_cancel_iff = thm"complex_cnj_cancel_iff";
paulson@14323: val complex_cnj_cnj = thm"complex_cnj_cnj";
paulson@14323: val complex_cnj_complex_of_real = thm"complex_cnj_complex_of_real";
paulson@14323: val complex_mod_cnj = thm"complex_mod_cnj";
paulson@14323: val complex_cnj_minus = thm"complex_cnj_minus";
paulson@14323: val complex_cnj_inverse = thm"complex_cnj_inverse";
paulson@14323: val complex_cnj_add = thm"complex_cnj_add";
paulson@14323: val complex_cnj_diff = thm"complex_cnj_diff";
paulson@14323: val complex_cnj_mult = thm"complex_cnj_mult";
paulson@14323: val complex_cnj_divide = thm"complex_cnj_divide";
paulson@14323: val complex_cnj_one = thm"complex_cnj_one";
paulson@14323: val complex_cnj_pow = thm"complex_cnj_pow";
paulson@14323: val complex_add_cnj = thm"complex_add_cnj";
paulson@14323: val complex_diff_cnj = thm"complex_diff_cnj";
paulson@14323: val complex_cnj_zero = thm"complex_cnj_zero";
paulson@14323: val complex_cnj_zero_iff = thm"complex_cnj_zero_iff";
paulson@14323: val complex_mult_cnj = thm"complex_mult_cnj";
paulson@14323: val complex_mult_zero_iff = thm"complex_mult_zero_iff";
paulson@14323: val complex_add_left_cancel_zero = thm"complex_add_left_cancel_zero";
paulson@14323: val complex_diff_mult_distrib = thm"complex_diff_mult_distrib";
paulson@14323: val complex_diff_mult_distrib2 = thm"complex_diff_mult_distrib2";
paulson@14323: val complex_mod_eq_zero_cancel = thm"complex_mod_eq_zero_cancel";
paulson@14323: val complex_mod_complex_of_real_of_nat = thm"complex_mod_complex_of_real_of_nat";
paulson@14323: val complex_mod_minus = thm"complex_mod_minus";
paulson@14323: val complex_mod_mult_cnj = thm"complex_mod_mult_cnj";
paulson@14323: val complex_mod_squared = thm"complex_mod_squared";
paulson@14323: val complex_mod_ge_zero = thm"complex_mod_ge_zero";
paulson@14323: val abs_cmod_cancel = thm"abs_cmod_cancel";
paulson@14323: val complex_mod_mult = thm"complex_mod_mult";
paulson@14323: val complex_mod_add_squared_eq = thm"complex_mod_add_squared_eq";
paulson@14323: val complex_Re_mult_cnj_le_cmod = thm"complex_Re_mult_cnj_le_cmod";
paulson@14323: val complex_Re_mult_cnj_le_cmod2 = thm"complex_Re_mult_cnj_le_cmod2";
paulson@14323: val real_sum_squared_expand = thm"real_sum_squared_expand";
paulson@14323: val complex_mod_triangle_squared = thm"complex_mod_triangle_squared";
paulson@14323: val complex_mod_minus_le_complex_mod = thm"complex_mod_minus_le_complex_mod";
paulson@14323: val complex_mod_triangle_ineq = thm"complex_mod_triangle_ineq";
paulson@14323: val complex_mod_triangle_ineq2 = thm"complex_mod_triangle_ineq2";
paulson@14323: val complex_mod_diff_commute = thm"complex_mod_diff_commute";
paulson@14323: val complex_mod_add_less = thm"complex_mod_add_less";
paulson@14323: val complex_mod_mult_less = thm"complex_mod_mult_less";
paulson@14323: val complex_mod_diff_ineq = thm"complex_mod_diff_ineq";
paulson@14323: val complex_Re_le_cmod = thm"complex_Re_le_cmod";
paulson@14323: val complex_mod_gt_zero = thm"complex_mod_gt_zero";
paulson@14323: val complex_mod_complexpow = thm"complex_mod_complexpow";
paulson@14323: val complexpow_minus = thm"complexpow_minus";
paulson@14323: val complex_inverse_minus = thm"complex_inverse_minus";
paulson@14323: val complex_divide_one = thm"complex_divide_one";
paulson@14323: val complex_mod_inverse = thm"complex_mod_inverse";
paulson@14323: val complex_mod_divide = thm"complex_mod_divide";
paulson@14323: val complex_inverse_divide = thm"complex_inverse_divide";
paulson@14323: val complexpow_mult = thm"complexpow_mult";
paulson@14323: val complexpow_zero = thm"complexpow_zero";
paulson@14323: val complexpow_not_zero = thm"complexpow_not_zero";
paulson@14323: val complexpow_zero_zero = thm"complexpow_zero_zero";
paulson@14323: val complexpow_i_squared = thm"complexpow_i_squared";
paulson@14323: val complex_i_not_zero = thm"complex_i_not_zero";
paulson@14323: val complex_mult_eq_zero_cancel1 = thm"complex_mult_eq_zero_cancel1";
paulson@14323: val complex_mult_eq_zero_cancel2 = thm"complex_mult_eq_zero_cancel2";
paulson@14323: val complex_mult_not_eq_zero_iff = thm"complex_mult_not_eq_zero_iff";
paulson@14323: val complexpow_inverse = thm"complexpow_inverse";
paulson@14323: val sgn_zero = thm"sgn_zero";
paulson@14323: val sgn_one = thm"sgn_one";
paulson@14323: val sgn_minus = thm"sgn_minus";
paulson@14323: val sgn_eq = thm"sgn_eq";
paulson@14323: val complex_split = thm"complex_split";
paulson@14323: val Re_complex_i = thm"Re_complex_i";
paulson@14323: val Im_complex_i = thm"Im_complex_i";
paulson@14323: val i_mult_eq = thm"i_mult_eq";
paulson@14323: val i_mult_eq2 = thm"i_mult_eq2";
paulson@14323: val cmod_i = thm"cmod_i";
paulson@14323: val complex_eq_Re_eq = thm"complex_eq_Re_eq";
paulson@14323: val complex_eq_Im_eq = thm"complex_eq_Im_eq";
paulson@14323: val complex_eq_cancel_iff = thm"complex_eq_cancel_iff";
paulson@14323: val complex_eq_cancel_iffA = thm"complex_eq_cancel_iffA";
paulson@14323: val complex_eq_cancel_iffB = thm"complex_eq_cancel_iffB";
paulson@14323: val complex_eq_cancel_iffC = thm"complex_eq_cancel_iffC";
paulson@14323: val complex_eq_cancel_iff2 = thm"complex_eq_cancel_iff2";
paulson@14323: val complex_eq_cancel_iff2a = thm"complex_eq_cancel_iff2a";
paulson@14323: val complex_eq_cancel_iff3 = thm"complex_eq_cancel_iff3";
paulson@14323: val complex_eq_cancel_iff3a = thm"complex_eq_cancel_iff3a";
paulson@14323: val complex_split_Re_zero = thm"complex_split_Re_zero";
paulson@14323: val complex_split_Im_zero = thm"complex_split_Im_zero";
paulson@14323: val Re_sgn = thm"Re_sgn";
paulson@14323: val Im_sgn = thm"Im_sgn";
paulson@14323: val complex_inverse_complex_split = thm"complex_inverse_complex_split";
paulson@14323: val Re_mult_i_eq = thm"Re_mult_i_eq";
paulson@14323: val Im_mult_i_eq = thm"Im_mult_i_eq";
paulson@14323: val complex_mod_mult_i = thm"complex_mod_mult_i";
paulson@14323: val cos_arg_i_mult_zero = thm"cos_arg_i_mult_zero";
paulson@14323: val cos_arg_i_mult_zero2 = thm"cos_arg_i_mult_zero2";
paulson@14323: val complex_of_real_not_zero_iff = thm"complex_of_real_not_zero_iff";
paulson@14323: val complex_of_real_zero_iff = thm"complex_of_real_zero_iff";
paulson@14323: val cos_arg_i_mult_zero3 = thm"cos_arg_i_mult_zero3";
paulson@14323: val complex_split_polar = thm"complex_split_polar";
paulson@14323: val rcis_Ex = thm"rcis_Ex";
paulson@14323: val Re_complex_polar = thm"Re_complex_polar";
paulson@14323: val Re_rcis = thm"Re_rcis";
paulson@14323: val Im_complex_polar = thm"Im_complex_polar";
paulson@14323: val Im_rcis = thm"Im_rcis";
paulson@14323: val complex_mod_complex_polar = thm"complex_mod_complex_polar";
paulson@14323: val complex_mod_rcis = thm"complex_mod_rcis";
paulson@14323: val complex_mod_sqrt_Re_mult_cnj = thm"complex_mod_sqrt_Re_mult_cnj";
paulson@14323: val complex_Re_cnj = thm"complex_Re_cnj";
paulson@14323: val complex_Im_cnj = thm"complex_Im_cnj";
paulson@14323: val complex_In_mult_cnj_zero = thm"complex_In_mult_cnj_zero";
paulson@14323: val complex_Re_mult = thm"complex_Re_mult";
paulson@14323: val complex_Re_mult_complex_of_real = thm"complex_Re_mult_complex_of_real";
paulson@14323: val complex_Im_mult_complex_of_real = thm"complex_Im_mult_complex_of_real";
paulson@14323: val complex_Re_mult_complex_of_real2 = thm"complex_Re_mult_complex_of_real2";
paulson@14323: val complex_Im_mult_complex_of_real2 = thm"complex_Im_mult_complex_of_real2";
paulson@14323: val cis_rcis_eq = thm"cis_rcis_eq";
paulson@14323: val rcis_mult = thm"rcis_mult";
paulson@14323: val cis_mult = thm"cis_mult";
paulson@14323: val cis_zero = thm"cis_zero";
paulson@14323: val cis_zero2 = thm"cis_zero2";
paulson@14323: val rcis_zero_mod = thm"rcis_zero_mod";
paulson@14323: val rcis_zero_arg = thm"rcis_zero_arg";
paulson@14323: val complex_of_real_minus_one = thm"complex_of_real_minus_one";
paulson@14323: val complex_i_mult_minus = thm"complex_i_mult_minus";
paulson@14323: val complex_i_mult_minus2 = thm"complex_i_mult_minus2";
paulson@14323: val cis_real_of_nat_Suc_mult = thm"cis_real_of_nat_Suc_mult";
paulson@14323: val DeMoivre = thm"DeMoivre";
paulson@14323: val DeMoivre2 = thm"DeMoivre2";
paulson@14323: val cis_inverse = thm"cis_inverse";
paulson@14323: val rcis_inverse = thm"rcis_inverse";
paulson@14323: val cis_divide = thm"cis_divide";
paulson@14323: val rcis_divide = thm"rcis_divide";
paulson@14323: val Re_cis = thm"Re_cis";
paulson@14323: val Im_cis = thm"Im_cis";
paulson@14323: val cos_n_Re_cis_pow_n = thm"cos_n_Re_cis_pow_n";
paulson@14323: val sin_n_Im_cis_pow_n = thm"sin_n_Im_cis_pow_n";
paulson@14323: val expi_Im_split = thm"expi_Im_split";
paulson@14323: val expi_Im_cis = thm"expi_Im_cis";
paulson@14323: val expi_add = thm"expi_add";
paulson@14323: val expi_complex_split = thm"expi_complex_split";
paulson@14323: val expi_zero = thm"expi_zero";
paulson@14323: val complex_Re_mult_eq = thm"complex_Re_mult_eq";
paulson@14323: val complex_Im_mult_eq = thm"complex_Im_mult_eq";
paulson@14323: val complex_expi_Ex = thm"complex_expi_Ex";
paulson@14323: 
paulson@14323: val complex_add_ac = thms"complex_add_ac";
paulson@14323: val complex_mult_ac = thms"complex_mult_ac";
paulson@14323: *}
paulson@14323: 
paulson@13957: end
paulson@13957: 
paulson@13957: 




