src/HOL/Complex/Complex.thy
changeset 24506 020db6ec334a
parent 23477 f4b83f03cac9
child 24520 40b220403257
equal deleted inserted replaced
24505:9e6d91f8bb73 24506:020db6ec334a
   297 
   297 
   298 abbreviation
   298 abbreviation
   299   cmod :: "complex \<Rightarrow> real" where
   299   cmod :: "complex \<Rightarrow> real" where
   300     "cmod \<equiv> norm"
   300     "cmod \<equiv> norm"
   301 
   301 
       
   302 instance complex :: sgn
       
   303   complex_sgn_def: "sgn x == x /\<^sub>R cmod x" ..
       
   304 
   302 lemmas cmod_def = complex_norm_def
   305 lemmas cmod_def = complex_norm_def
   303 
   306 
   304 lemma complex_norm [simp]: "cmod (Complex x y) = sqrt (x\<twosuperior> + y\<twosuperior>)"
   307 lemma complex_norm [simp]: "cmod (Complex x y) = sqrt (x\<twosuperior> + y\<twosuperior>)"
   305 by (simp add: complex_norm_def)
   308 by (simp add: complex_norm_def)
   306 
   309 
   318     by (induct x)
   321     by (induct x)
   319        (simp add: power_mult_distrib right_distrib [symmetric] real_sqrt_mult)
   322        (simp add: power_mult_distrib right_distrib [symmetric] real_sqrt_mult)
   320   show "norm (x * y) = norm x * norm y"
   323   show "norm (x * y) = norm x * norm y"
   321     by (induct x, induct y)
   324     by (induct x, induct y)
   322        (simp add: real_sqrt_mult [symmetric] power2_eq_square ring_simps)
   325        (simp add: real_sqrt_mult [symmetric] power2_eq_square ring_simps)
   323 qed
   326   show "sgn x = x /\<^sub>R cmod x" by(simp add: complex_sgn_def)
       
   327 qed (* FIXME junk *) (rule refl)+
   324 
   328 
   325 lemma cmod_unit_one [simp]: "cmod (Complex (cos a) (sin a)) = 1"
   329 lemma cmod_unit_one [simp]: "cmod (Complex (cos a) (sin a)) = 1"
   326 by simp
   330 by simp
   327 
   331 
   328 lemma cmod_complex_polar [simp]:
   332 lemma cmod_complex_polar [simp]:
   527 definition
   531 definition
   528   arg :: "complex => real" where
   532   arg :: "complex => real" where
   529   "arg z = (SOME a. Re(sgn z) = cos a & Im(sgn z) = sin a & -pi < a & a \<le> pi)"
   533   "arg z = (SOME a. Re(sgn z) = cos a & Im(sgn z) = sin a & -pi < a & a \<le> pi)"
   530 
   534 
   531 lemma sgn_eq: "sgn z = z / complex_of_real (cmod z)"
   535 lemma sgn_eq: "sgn z = z / complex_of_real (cmod z)"
   532 by (simp add: sgn_def divide_inverse scaleR_conv_of_real mult_commute)
   536 by (simp add: complex_sgn_def divide_inverse scaleR_conv_of_real mult_commute)
   533 
   537 
   534 lemma i_mult_eq: "ii * ii = complex_of_real (-1)"
   538 lemma i_mult_eq: "ii * ii = complex_of_real (-1)"
   535 by (simp add: i_def complex_of_real_def)
   539 by (simp add: i_def complex_of_real_def)
   536 
   540 
   537 lemma i_mult_eq2 [simp]: "ii * ii = -(1::complex)"
   541 lemma i_mult_eq2 [simp]: "ii * ii = -(1::complex)"
   540 lemma complex_eq_cancel_iff2 [simp]:
   544 lemma complex_eq_cancel_iff2 [simp]:
   541      "(Complex x y = complex_of_real xa) = (x = xa & y = 0)"
   545      "(Complex x y = complex_of_real xa) = (x = xa & y = 0)"
   542 by (simp add: complex_of_real_def)
   546 by (simp add: complex_of_real_def)
   543 
   547 
   544 lemma Re_sgn [simp]: "Re(sgn z) = Re(z)/cmod z"
   548 lemma Re_sgn [simp]: "Re(sgn z) = Re(z)/cmod z"
   545 unfolding sgn_def by (simp add: divide_inverse)
   549 by (simp add: complex_sgn_def divide_inverse)
   546 
   550 
   547 lemma Im_sgn [simp]: "Im(sgn z) = Im(z)/cmod z"
   551 lemma Im_sgn [simp]: "Im(sgn z) = Im(z)/cmod z"
   548 unfolding sgn_def by (simp add: divide_inverse)
   552 by (simp add: complex_sgn_def divide_inverse)
   549 
   553 
   550 lemma complex_inverse_complex_split:
   554 lemma complex_inverse_complex_split:
   551      "inverse(complex_of_real x + ii * complex_of_real y) =
   555      "inverse(complex_of_real x + ii * complex_of_real y) =
   552       complex_of_real(x/(x ^ 2 + y ^ 2)) -
   556       complex_of_real(x/(x ^ 2 + y ^ 2)) -
   553       ii * complex_of_real(y/(x ^ 2 + y ^ 2))"
   557       ii * complex_of_real(y/(x ^ 2 + y ^ 2))"