--- a/src/HOL/Complex.thy Mon Sep 05 23:51:16 2011 +0200
+++ b/src/HOL/Complex.thy Mon Sep 05 17:05:00 2011 -0700
@@ -12,15 +12,11 @@
datatype complex = Complex real real
-primrec
- Re :: "complex \<Rightarrow> real"
-where
- Re: "Re (Complex x y) = x"
+primrec Re :: "complex \<Rightarrow> real"
+ where Re: "Re (Complex x y) = x"
-primrec
- Im :: "complex \<Rightarrow> real"
-where
- Im: "Im (Complex x y) = y"
+primrec Im :: "complex \<Rightarrow> real"
+ where Im: "Im (Complex x y) = y"
lemma complex_surj [simp]: "Complex (Re z) (Im z) = z"
by (induct z) simp
@@ -37,17 +33,17 @@
instantiation complex :: ab_group_add
begin
-definition
- complex_zero_def: "0 = Complex 0 0"
+definition complex_zero_def:
+ "0 = Complex 0 0"
-definition
- complex_add_def: "x + y = Complex (Re x + Re y) (Im x + Im y)"
+definition complex_add_def:
+ "x + y = Complex (Re x + Re y) (Im x + Im y)"
-definition
- complex_minus_def: "- x = Complex (- Re x) (- Im x)"
+definition complex_minus_def:
+ "- x = Complex (- Re x) (- Im x)"
-definition
- complex_diff_def: "x - (y\<Colon>complex) = x + - y"
+definition complex_diff_def:
+ "x - (y\<Colon>complex) = x + - y"
lemma Complex_eq_0 [simp]: "Complex a b = 0 \<longleftrightarrow> a = 0 \<and> b = 0"
by (simp add: complex_zero_def)
@@ -94,25 +90,23 @@
end
-
subsection {* Multiplication and Division *}
instantiation complex :: field_inverse_zero
begin
-definition
- complex_one_def: "1 = Complex 1 0"
+definition complex_one_def:
+ "1 = Complex 1 0"
-definition
- complex_mult_def: "x * y =
- Complex (Re x * Re y - Im x * Im y) (Re x * Im y + Im x * Re y)"
+definition complex_mult_def:
+ "x * y = Complex (Re x * Re y - Im x * Im y) (Re x * Im y + Im x * Re y)"
-definition
- complex_inverse_def: "inverse x =
+definition complex_inverse_def:
+ "inverse x =
Complex (Re x / ((Re x)\<twosuperior> + (Im x)\<twosuperior>)) (- Im x / ((Re x)\<twosuperior> + (Im x)\<twosuperior>))"
-definition
- complex_divide_def: "x / (y\<Colon>complex) = x * inverse y"
+definition complex_divide_def:
+ "x / (y\<Colon>complex) = x * inverse y"
lemma Complex_eq_1 [simp]: "(Complex a b = 1) = (a = 1 \<and> b = 0)"
by (simp add: complex_one_def)
@@ -147,10 +141,10 @@
instance
by intro_classes (simp_all add: complex_mult_def
- right_distrib left_distrib right_diff_distrib left_diff_distrib
- complex_inverse_def complex_divide_def
- power2_eq_square add_divide_distrib [symmetric]
- complex_eq_iff)
+ right_distrib left_distrib right_diff_distrib left_diff_distrib
+ complex_inverse_def complex_divide_def
+ power2_eq_square add_divide_distrib [symmetric]
+ complex_eq_iff)
end
@@ -160,8 +154,8 @@
instantiation complex :: number_ring
begin
-definition number_of_complex where
- complex_number_of_def: "number_of w = (of_int w \<Colon> complex)"
+definition complex_number_of_def:
+ "number_of w = (of_int w \<Colon> complex)"
instance
by intro_classes (simp only: complex_number_of_def)
@@ -169,26 +163,26 @@
end
lemma complex_Re_of_nat [simp]: "Re (of_nat n) = of_nat n"
-by (induct n) simp_all
+ by (induct n) simp_all
lemma complex_Im_of_nat [simp]: "Im (of_nat n) = 0"
-by (induct n) simp_all
+ by (induct n) simp_all
lemma complex_Re_of_int [simp]: "Re (of_int z) = of_int z"
-by (cases z rule: int_diff_cases) simp
+ by (cases z rule: int_diff_cases) simp
lemma complex_Im_of_int [simp]: "Im (of_int z) = 0"
-by (cases z rule: int_diff_cases) simp
+ by (cases z rule: int_diff_cases) simp
lemma complex_Re_number_of [simp]: "Re (number_of v) = number_of v"
-unfolding number_of_eq by (rule complex_Re_of_int)
+ unfolding number_of_eq by (rule complex_Re_of_int)
lemma complex_Im_number_of [simp]: "Im (number_of v) = 0"
-unfolding number_of_eq by (rule complex_Im_of_int)
+ unfolding number_of_eq by (rule complex_Im_of_int)
lemma Complex_eq_number_of [simp]:
"(Complex a b = number_of w) = (a = number_of w \<and> b = 0)"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
subsection {* Scalar Multiplication *}
@@ -196,8 +190,8 @@
instantiation complex :: real_field
begin
-definition
- complex_scaleR_def: "scaleR r x = Complex (r * Re x) (r * Im x)"
+definition complex_scaleR_def:
+ "scaleR r x = Complex (r * Re x) (r * Im x)"
lemma complex_scaleR [simp]:
"scaleR r (Complex a b) = Complex (r * a) (r * b)"
@@ -231,34 +225,33 @@
subsection{* Properties of Embedding from Reals *}
-abbreviation
- complex_of_real :: "real \<Rightarrow> complex" where
- "complex_of_real \<equiv> of_real"
+abbreviation complex_of_real :: "real \<Rightarrow> complex"
+ where "complex_of_real \<equiv> of_real"
lemma complex_of_real_def: "complex_of_real r = Complex r 0"
-by (simp add: of_real_def complex_scaleR_def)
+ by (simp add: of_real_def complex_scaleR_def)
lemma Re_complex_of_real [simp]: "Re (complex_of_real z) = z"
-by (simp add: complex_of_real_def)
+ by (simp add: complex_of_real_def)
lemma Im_complex_of_real [simp]: "Im (complex_of_real z) = 0"
-by (simp add: complex_of_real_def)
+ by (simp add: complex_of_real_def)
lemma Complex_add_complex_of_real [simp]:
- "Complex x y + complex_of_real r = Complex (x+r) y"
-by (simp add: complex_of_real_def)
+ shows "Complex x y + complex_of_real r = Complex (x+r) y"
+ by (simp add: complex_of_real_def)
lemma complex_of_real_add_Complex [simp]:
- "complex_of_real r + Complex x y = Complex (r+x) y"
-by (simp add: complex_of_real_def)
+ shows "complex_of_real r + Complex x y = Complex (r+x) y"
+ by (simp add: complex_of_real_def)
lemma Complex_mult_complex_of_real:
- "Complex x y * complex_of_real r = Complex (x*r) (y*r)"
-by (simp add: complex_of_real_def)
+ shows "Complex x y * complex_of_real r = Complex (x*r) (y*r)"
+ by (simp add: complex_of_real_def)
lemma complex_of_real_mult_Complex:
- "complex_of_real r * Complex x y = Complex (r*x) (r*y)"
-by (simp add: complex_of_real_def)
+ shows "complex_of_real r * Complex x y = Complex (r*x) (r*y)"
+ by (simp add: complex_of_real_def)
subsection {* Vector Norm *}
@@ -269,9 +262,8 @@
definition complex_norm_def:
"norm z = sqrt ((Re z)\<twosuperior> + (Im z)\<twosuperior>)"
-abbreviation
- cmod :: "complex \<Rightarrow> real" where
- "cmod \<equiv> norm"
+abbreviation cmod :: "complex \<Rightarrow> real"
+ where "cmod \<equiv> norm"
definition complex_sgn_def:
"sgn x = x /\<^sub>R cmod x"
@@ -313,29 +305,30 @@
end
lemma cmod_unit_one [simp]: "cmod (Complex (cos a) (sin a)) = 1"
-by simp
+ by simp
lemma cmod_complex_polar [simp]:
- "cmod (complex_of_real r * Complex (cos a) (sin a)) = abs r"
-by (simp add: norm_mult)
+ "cmod (complex_of_real r * Complex (cos a) (sin a)) = abs r"
+ by (simp add: norm_mult)
lemma complex_Re_le_cmod: "Re x \<le> cmod x"
-unfolding complex_norm_def
-by (rule real_sqrt_sum_squares_ge1)
+ unfolding complex_norm_def
+ by (rule real_sqrt_sum_squares_ge1)
lemma complex_mod_minus_le_complex_mod [simp]: "- cmod x \<le> cmod x"
-by (rule order_trans [OF _ norm_ge_zero], simp)
+ by (rule order_trans [OF _ norm_ge_zero], simp)
lemma complex_mod_triangle_ineq2 [simp]: "cmod(b + a) - cmod b \<le> cmod a"
-by (rule ord_le_eq_trans [OF norm_triangle_ineq2], simp)
+ by (rule ord_le_eq_trans [OF norm_triangle_ineq2], simp)
lemmas real_sum_squared_expand = power2_sum [where 'a=real]
lemma abs_Re_le_cmod: "\<bar>Re x\<bar> \<le> cmod x"
-by (cases x) simp
+ by (cases x) simp
lemma abs_Im_le_cmod: "\<bar>Im x\<bar> \<le> cmod x"
-by (cases x) simp
+ by (cases x) simp
+
subsection {* Completeness of the Complexes *}
@@ -357,25 +350,25 @@
lemmas Cauchy_Im = bounded_linear.Cauchy [OF bounded_linear_Im]
lemma tendsto_Complex [tendsto_intros]:
- assumes "(f ---> a) net" and "(g ---> b) net"
- shows "((\<lambda>x. Complex (f x) (g x)) ---> Complex a b) net"
+ assumes "(f ---> a) F" and "(g ---> b) F"
+ shows "((\<lambda>x. Complex (f x) (g x)) ---> Complex a b) F"
proof (rule tendstoI)
fix r :: real assume "0 < r"
hence "0 < r / sqrt 2" by (simp add: divide_pos_pos)
- have "eventually (\<lambda>x. dist (f x) a < r / sqrt 2) net"
- using `(f ---> a) net` and `0 < r / sqrt 2` by (rule tendstoD)
+ have "eventually (\<lambda>x. dist (f x) a < r / sqrt 2) F"
+ using `(f ---> a) F` and `0 < r / sqrt 2` by (rule tendstoD)
moreover
- have "eventually (\<lambda>x. dist (g x) b < r / sqrt 2) net"
- using `(g ---> b) net` and `0 < r / sqrt 2` by (rule tendstoD)
+ have "eventually (\<lambda>x. dist (g x) b < r / sqrt 2) F"
+ using `(g ---> b) F` and `0 < r / sqrt 2` by (rule tendstoD)
ultimately
- show "eventually (\<lambda>x. dist (Complex (f x) (g x)) (Complex a b) < r) net"
+ show "eventually (\<lambda>x. dist (Complex (f x) (g x)) (Complex a b) < r) F"
by (rule eventually_elim2)
(simp add: dist_norm real_sqrt_sum_squares_less)
qed
lemma LIMSEQ_Complex:
"\<lbrakk>X ----> a; Y ----> b\<rbrakk> \<Longrightarrow> (\<lambda>n. Complex (X n) (Y n)) ----> Complex a b"
-by (rule tendsto_Complex)
+ by (rule tendsto_Complex)
instance complex :: banach
proof
@@ -394,133 +387,131 @@
subsection {* The Complex Number @{term "\<i>"} *}
-definition
- "ii" :: complex ("\<i>") where
- i_def: "ii \<equiv> Complex 0 1"
+definition "ii" :: complex ("\<i>")
+ where i_def: "ii \<equiv> Complex 0 1"
lemma complex_Re_i [simp]: "Re ii = 0"
-by (simp add: i_def)
+ by (simp add: i_def)
lemma complex_Im_i [simp]: "Im ii = 1"
-by (simp add: i_def)
+ by (simp add: i_def)
lemma Complex_eq_i [simp]: "(Complex x y = ii) = (x = 0 \<and> y = 1)"
-by (simp add: i_def)
+ by (simp add: i_def)
lemma complex_i_not_zero [simp]: "ii \<noteq> 0"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_i_not_one [simp]: "ii \<noteq> 1"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_i_not_number_of [simp]: "ii \<noteq> number_of w"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma i_mult_Complex [simp]: "ii * Complex a b = Complex (- b) a"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma Complex_mult_i [simp]: "Complex a b * ii = Complex (- b) a"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma i_complex_of_real [simp]: "ii * complex_of_real r = Complex 0 r"
-by (simp add: i_def complex_of_real_def)
+ by (simp add: i_def complex_of_real_def)
lemma complex_of_real_i [simp]: "complex_of_real r * ii = Complex 0 r"
-by (simp add: i_def complex_of_real_def)
+ by (simp add: i_def complex_of_real_def)
lemma i_squared [simp]: "ii * ii = -1"
-by (simp add: i_def)
+ by (simp add: i_def)
lemma power2_i [simp]: "ii\<twosuperior> = -1"
-by (simp add: power2_eq_square)
+ by (simp add: power2_eq_square)
lemma inverse_i [simp]: "inverse ii = - ii"
-by (rule inverse_unique, simp)
+ by (rule inverse_unique, simp)
subsection {* Complex Conjugation *}
-definition
- cnj :: "complex \<Rightarrow> complex" where
+definition cnj :: "complex \<Rightarrow> complex" where
"cnj z = Complex (Re z) (- Im z)"
lemma complex_cnj [simp]: "cnj (Complex a b) = Complex a (- b)"
-by (simp add: cnj_def)
+ by (simp add: cnj_def)
lemma complex_Re_cnj [simp]: "Re (cnj x) = Re x"
-by (simp add: cnj_def)
+ by (simp add: cnj_def)
lemma complex_Im_cnj [simp]: "Im (cnj x) = - Im x"
-by (simp add: cnj_def)
+ by (simp add: cnj_def)
lemma complex_cnj_cancel_iff [simp]: "(cnj x = cnj y) = (x = y)"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_cnj_cnj [simp]: "cnj (cnj z) = z"
-by (simp add: cnj_def)
+ by (simp add: cnj_def)
lemma complex_cnj_zero [simp]: "cnj 0 = 0"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_cnj_zero_iff [iff]: "(cnj z = 0) = (z = 0)"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_cnj_add: "cnj (x + y) = cnj x + cnj y"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_cnj_diff: "cnj (x - y) = cnj x - cnj y"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_cnj_minus: "cnj (- x) = - cnj x"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_cnj_one [simp]: "cnj 1 = 1"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_cnj_mult: "cnj (x * y) = cnj x * cnj y"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_cnj_inverse: "cnj (inverse x) = inverse (cnj x)"
-by (simp add: complex_inverse_def)
+ by (simp add: complex_inverse_def)
lemma complex_cnj_divide: "cnj (x / y) = cnj x / cnj y"
-by (simp add: complex_divide_def complex_cnj_mult complex_cnj_inverse)
+ by (simp add: complex_divide_def complex_cnj_mult complex_cnj_inverse)
lemma complex_cnj_power: "cnj (x ^ n) = cnj x ^ n"
-by (induct n, simp_all add: complex_cnj_mult)
+ by (induct n, simp_all add: complex_cnj_mult)
lemma complex_cnj_of_nat [simp]: "cnj (of_nat n) = of_nat n"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_cnj_of_int [simp]: "cnj (of_int z) = of_int z"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_cnj_number_of [simp]: "cnj (number_of w) = number_of w"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_cnj_scaleR: "cnj (scaleR r x) = scaleR r (cnj x)"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_mod_cnj [simp]: "cmod (cnj z) = cmod z"
-by (simp add: complex_norm_def)
+ by (simp add: complex_norm_def)
lemma complex_cnj_complex_of_real [simp]: "cnj (of_real x) = of_real x"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_cnj_i [simp]: "cnj ii = - ii"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_add_cnj: "z + cnj z = complex_of_real (2 * Re z)"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_diff_cnj: "z - cnj z = complex_of_real (2 * Im z) * ii"
-by (simp add: complex_eq_iff)
+ by (simp add: complex_eq_iff)
lemma complex_mult_cnj: "z * cnj z = complex_of_real ((Re z)\<twosuperior> + (Im z)\<twosuperior>)"
-by (simp add: complex_eq_iff power2_eq_square)
+ by (simp add: complex_eq_iff power2_eq_square)
lemma complex_mod_mult_cnj: "cmod (z * cnj z) = (cmod z)\<twosuperior>"
-by (simp add: norm_mult power2_eq_square)
+ by (simp add: norm_mult power2_eq_square)
lemma bounded_linear_cnj: "bounded_linear cnj"
using complex_cnj_add complex_cnj_scaleR
@@ -537,34 +528,33 @@
text {*------------ Argand -------------*}
-definition
- arg :: "complex => real" where
+definition arg :: "complex => real" where
"arg z = (SOME a. Re(sgn z) = cos a & Im(sgn z) = sin a & -pi < a & a \<le> pi)"
lemma sgn_eq: "sgn z = z / complex_of_real (cmod z)"
-by (simp add: complex_sgn_def divide_inverse scaleR_conv_of_real mult_commute)
+ by (simp add: sgn_div_norm divide_inverse scaleR_conv_of_real mult_commute)
lemma i_mult_eq: "ii * ii = complex_of_real (-1)"
-by (simp add: i_def complex_of_real_def)
+ by (simp add: i_def complex_of_real_def)
lemma i_mult_eq2 [simp]: "ii * ii = -(1::complex)"
-by (simp add: i_def complex_one_def)
+ by (simp add: i_def complex_one_def)
lemma complex_eq_cancel_iff2 [simp]:
- "(Complex x y = complex_of_real xa) = (x = xa & y = 0)"
-by (simp add: complex_of_real_def)
+ shows "(Complex x y = complex_of_real xa) = (x = xa & y = 0)"
+ by (simp add: complex_of_real_def)
lemma Re_sgn [simp]: "Re(sgn z) = Re(z)/cmod z"
-by (simp add: complex_sgn_def divide_inverse)
+ by (simp add: complex_sgn_def divide_inverse)
lemma Im_sgn [simp]: "Im(sgn z) = Im(z)/cmod z"
-by (simp add: complex_sgn_def divide_inverse)
+ by (simp add: complex_sgn_def divide_inverse)
lemma complex_inverse_complex_split:
"inverse(complex_of_real x + ii * complex_of_real y) =
complex_of_real(x/(x ^ 2 + y ^ 2)) -
ii * complex_of_real(y/(x ^ 2 + y ^ 2))"
-by (simp add: complex_of_real_def i_def diff_minus divide_inverse)
+ by (simp add: complex_of_real_def i_def diff_minus divide_inverse)
(*----------------------------------------------------------------------------*)
(* Many of the theorems below need to be moved elsewhere e.g. Transc. Also *)
@@ -638,10 +628,10 @@
done
lemma Re_rcis [simp]: "Re(rcis r a) = r * cos a"
-by (simp add: rcis_def cis_def)
+ by (simp add: rcis_def cis_def)
lemma Im_rcis [simp]: "Im(rcis r a) = r * sin a"
-by (simp add: rcis_def cis_def)
+ by (simp add: rcis_def cis_def)
lemma sin_cos_squared_add2_mult: "(r * cos a)\<twosuperior> + (r * sin a)\<twosuperior> = r\<twosuperior>"
proof -
@@ -651,44 +641,44 @@
qed
lemma complex_mod_rcis [simp]: "cmod(rcis r a) = abs r"
-by (simp add: rcis_def cis_def sin_cos_squared_add2_mult)
+ by (simp add: rcis_def cis_def sin_cos_squared_add2_mult)
lemma complex_mod_sqrt_Re_mult_cnj: "cmod z = sqrt (Re (z * cnj z))"
-by (simp add: cmod_def power2_eq_square)
+ by (simp add: cmod_def power2_eq_square)
lemma complex_In_mult_cnj_zero [simp]: "Im (z * cnj z) = 0"
-by simp
+ by simp
lemma cis_rcis_eq: "cis a = rcis 1 a"
-by (simp add: rcis_def)
+ by (simp add: rcis_def)
lemma rcis_mult: "rcis r1 a * rcis r2 b = rcis (r1*r2) (a + b)"
-by (simp add: rcis_def cis_def cos_add sin_add right_distrib right_diff_distrib
- complex_of_real_def)
+ by (simp add: rcis_def cis_def cos_add sin_add right_distrib
+ right_diff_distrib complex_of_real_def)
lemma cis_mult: "cis a * cis b = cis (a + b)"
-by (simp add: cis_rcis_eq rcis_mult)
+ by (simp add: cis_rcis_eq rcis_mult)
lemma cis_zero [simp]: "cis 0 = 1"
-by (simp add: cis_def complex_one_def)
+ by (simp add: cis_def complex_one_def)
lemma rcis_zero_mod [simp]: "rcis 0 a = 0"
-by (simp add: rcis_def)
+ by (simp add: rcis_def)
lemma rcis_zero_arg [simp]: "rcis r 0 = complex_of_real r"
-by (simp add: rcis_def)
+ by (simp add: rcis_def)
lemma complex_of_real_minus_one:
"complex_of_real (-(1::real)) = -(1::complex)"
-by (simp add: complex_of_real_def complex_one_def)
+ by (simp add: complex_of_real_def complex_one_def)
lemma complex_i_mult_minus [simp]: "ii * (ii * x) = - x"
-by (simp add: mult_assoc [symmetric])
+ by (simp add: mult_assoc [symmetric])
lemma cis_real_of_nat_Suc_mult:
"cis (real (Suc n) * a) = cis a * cis (real n * a)"
-by (simp add: cis_def real_of_nat_Suc left_distrib cos_add sin_add right_distrib)
+ by (simp add: cis_def real_of_nat_Suc left_distrib cos_add sin_add right_distrib)
lemma DeMoivre: "(cis a) ^ n = cis (real n * a)"
apply (induct_tac "n")
@@ -696,16 +686,16 @@
done
lemma DeMoivre2: "(rcis r a) ^ n = rcis (r ^ n) (real n * a)"
-by (simp add: rcis_def power_mult_distrib DeMoivre)
+ by (simp add: rcis_def power_mult_distrib DeMoivre)
lemma cis_inverse [simp]: "inverse(cis a) = cis (-a)"
-by (simp add: cis_def complex_inverse_complex_split diff_minus)
+ by (simp add: cis_def complex_inverse_complex_split diff_minus)
lemma rcis_inverse: "inverse(rcis r a) = rcis (1/r) (-a)"
-by (simp add: divide_inverse rcis_def)
+ by (simp add: divide_inverse rcis_def)
lemma cis_divide: "cis a / cis b = cis (a - b)"
-by (simp add: complex_divide_def cis_mult diff_minus)
+ by (simp add: complex_divide_def cis_mult diff_minus)
lemma rcis_divide: "rcis r1 a / rcis r2 b = rcis (r1/r2) (a - b)"
apply (simp add: complex_divide_def)
@@ -714,16 +704,16 @@
done
lemma Re_cis [simp]: "Re(cis a) = cos a"
-by (simp add: cis_def)
+ by (simp add: cis_def)
lemma Im_cis [simp]: "Im(cis a) = sin a"
-by (simp add: cis_def)
+ by (simp add: cis_def)
lemma cos_n_Re_cis_pow_n: "cos (real n * a) = Re(cis a ^ n)"
-by (auto simp add: DeMoivre)
+ by (auto simp add: DeMoivre)
lemma sin_n_Im_cis_pow_n: "sin (real n * a) = Im(cis a ^ n)"
-by (auto simp add: DeMoivre)
+ by (auto simp add: DeMoivre)
lemma complex_expi_Ex: "\<exists>a r. z = complex_of_real r * expi a"
apply (insert rcis_Ex [of z])
@@ -732,7 +722,7 @@
done
lemma expi_two_pi_i [simp]: "expi((2::complex) * complex_of_real pi * ii) = 1"
-by (simp add: expi_def cis_def)
+ by (simp add: expi_def cis_def)
text {* Legacy theorem names *}
--- a/src/HOL/Series.thy Mon Sep 05 23:51:16 2011 +0200
+++ b/src/HOL/Series.thy Mon Sep 05 17:05:00 2011 -0700
@@ -304,8 +304,7 @@
lemma sums_group:
fixes f :: "nat \<Rightarrow> 'a::real_normed_field"
- shows "[|summable f; 0 < k |] ==> (%n. setsum f {n*k..<n*k+k}) sums (suminf f)"
-apply (drule summable_sums)
+ shows "\<lbrakk>f sums s; 0 < k\<rbrakk> \<Longrightarrow> (\<lambda>n. setsum f {n*k..<n*k+k}) sums s"
apply (simp only: sums_def sumr_group)
apply (unfold LIMSEQ_iff, safe)
apply (drule_tac x="r" in spec, safe)
@@ -380,7 +379,7 @@
apply assumption
apply simp
apply (drule_tac k="k" in summable_ignore_initial_segment)
-apply (drule_tac k="Suc (Suc 0)" in sums_group, simp)
+apply (drule_tac k="Suc (Suc 0)" in sums_group [OF summable_sums], simp)
apply simp
apply (frule sums_unique)
apply (drule sums_summable)
@@ -435,7 +434,7 @@
by (simp add: summable_def sums_def convergent_def)
lemma summable_LIMSEQ_zero:
- fixes f :: "nat \<Rightarrow> 'a::real_normed_field"
+ fixes f :: "nat \<Rightarrow> 'a::real_normed_vector"
shows "summable f \<Longrightarrow> f ----> 0"
apply (drule summable_convergent_sumr_iff [THEN iffD1])
apply (drule convergent_Cauchy)
--- a/src/HOL/Transcendental.thy Mon Sep 05 23:51:16 2011 +0200
+++ b/src/HOL/Transcendental.thy Mon Sep 05 17:05:00 2011 -0700
@@ -54,7 +54,7 @@
x}, then it sums absolutely for @{term z} with @{term "\<bar>z\<bar> < \<bar>x\<bar>"}.*}
lemma powser_insidea:
- fixes x z :: "'a::{real_normed_field,banach}"
+ fixes x z :: "'a::real_normed_field"
assumes 1: "summable (\<lambda>n. f n * x ^ n)"
assumes 2: "norm z < norm x"
shows "summable (\<lambda>n. norm (f n * z ^ n))"
@@ -65,7 +65,7 @@
hence "convergent (\<lambda>n. f n * x ^ n)"
by (rule convergentI)
hence "Cauchy (\<lambda>n. f n * x ^ n)"
- by (simp add: Cauchy_convergent_iff)
+ by (rule convergent_Cauchy)
hence "Bseq (\<lambda>n. f n * x ^ n)"
by (rule Cauchy_Bseq)
then obtain K where 3: "0 < K" and 4: "\<forall>n. norm (f n * x ^ n) \<le> K"
@@ -1430,62 +1430,34 @@
sums sin x"
proof -
have "(\<lambda>n. \<Sum>k = n * 2..<n * 2 + 2. sin_coeff k * x ^ k) sums sin x"
- unfolding sin_def
- by (rule sin_converges [THEN sums_summable, THEN sums_group], simp)
+ by (rule sin_converges [THEN sums_group], simp)
thus ?thesis unfolding One_nat_def sin_coeff_def by (simp add: mult_ac)
qed
-text {* FIXME: This is a long, ugly proof! *}
-lemma sin_gt_zero: "[|0 < x; x < 2 |] ==> 0 < sin x"
-apply (subgoal_tac
- "(\<lambda>n. \<Sum>k = n * 2..<n * 2 + 2.
- -1 ^ k / real (fact (2 * k + 1)) * x ^ (2 * k + 1))
- sums (\<Sum>n. -1 ^ n / real (fact (2 * n + 1)) * x ^ (2 * n + 1))")
- prefer 2
- apply (rule sin_paired [THEN sums_summable, THEN sums_group], simp)
-apply (rotate_tac 2)
-apply (drule sin_paired [THEN sums_unique, THEN ssubst])
-unfolding One_nat_def
-apply (auto simp del: fact_Suc)
-apply (frule sums_unique)
-apply (auto simp del: fact_Suc)
-apply (rule_tac n1 = 0 in series_pos_less [THEN [2] order_le_less_trans])
-apply (auto simp del: fact_Suc)
-apply (erule sums_summable)
-apply (case_tac "m=0")
-apply (simp (no_asm_simp))
-apply (subgoal_tac "6 * (x * (x * x) / real (Suc (Suc (Suc (Suc (Suc (Suc 0))))))) < 6 * x")
-apply (simp only: mult_less_cancel_left, simp)
-apply (simp (no_asm_simp) add: numeral_2_eq_2 [symmetric] mult_assoc [symmetric])
-apply (subgoal_tac "x*x < 2*3", simp)
-apply (rule mult_strict_mono)
-apply (auto simp add: real_0_less_add_iff real_of_nat_Suc simp del: fact_Suc)
-apply (subst fact_Suc)
-apply (subst fact_Suc)
-apply (subst fact_Suc)
-apply (subst fact_Suc)
-apply (subst real_of_nat_mult)
-apply (subst real_of_nat_mult)
-apply (subst real_of_nat_mult)
-apply (subst real_of_nat_mult)
-apply (simp (no_asm) add: divide_inverse del: fact_Suc)
-apply (auto simp add: mult_assoc [symmetric] simp del: fact_Suc)
-apply (rule_tac c="real (Suc (Suc (4*m)))" in mult_less_imp_less_right)
-apply (auto simp add: mult_assoc simp del: fact_Suc)
-apply (rule_tac c="real (Suc (Suc (Suc (4*m))))" in mult_less_imp_less_right)
-apply (auto simp add: mult_assoc mult_less_cancel_left simp del: fact_Suc)
-apply (subgoal_tac "x * (x * x ^ (4*m)) = (x ^ (4*m)) * (x * x)")
-apply (erule ssubst)+
-apply (auto simp del: fact_Suc)
-apply (subgoal_tac "0 < x ^ (4 * m) ")
- prefer 2 apply (simp only: zero_less_power)
-apply (simp (no_asm_simp) add: mult_less_cancel_left)
-apply (rule mult_strict_mono)
-apply (simp_all (no_asm_simp))
-done
-
-lemma sin_gt_zero1: "[|0 < x; x < 2 |] ==> 0 < sin x"
- by (rule sin_gt_zero)
+lemma sin_gt_zero:
+ assumes "0 < x" and "x < 2" shows "0 < sin x"
+proof -
+ let ?f = "\<lambda>n. \<Sum>k = n*2..<n*2+2. -1 ^ k / real (fact (2*k+1)) * x^(2*k+1)"
+ have pos: "\<forall>n. 0 < ?f n"
+ proof
+ fix n :: nat
+ let ?k2 = "real (Suc (Suc (4 * n)))"
+ let ?k3 = "real (Suc (Suc (Suc (4 * n))))"
+ have "x * x < ?k2 * ?k3"
+ using assms by (intro mult_strict_mono', simp_all)
+ hence "x * x * x * x ^ (n * 4) < ?k2 * ?k3 * x * x ^ (n * 4)"
+ by (intro mult_strict_right_mono zero_less_power `0 < x`)
+ thus "0 < ?f n"
+ by (simp del: mult_Suc,
+ simp add: less_divide_eq mult_pos_pos field_simps del: mult_Suc)
+ qed
+ have sums: "?f sums sin x"
+ by (rule sin_paired [THEN sums_group], simp)
+ show "0 < sin x"
+ unfolding sums_unique [OF sums]
+ using sums_summable [OF sums] pos
+ by (rule suminf_gt_zero)
+qed
lemma cos_double_less_one: "[| 0 < x; x < 2 |] ==> cos (2 * x) < 1"
apply (cut_tac x = x in sin_gt_zero)
@@ -1496,8 +1468,7 @@
"(%n. -1 ^ n /(real (fact (2 * n))) * x ^ (2 * n)) sums cos x"
proof -
have "(\<lambda>n. \<Sum>k = n * 2..<n * 2 + 2. cos_coeff k * x ^ k) sums cos x"
- unfolding cos_def
- by (rule cos_converges [THEN sums_summable, THEN sums_group], simp)
+ by (rule cos_converges [THEN sums_group], simp)
thus ?thesis unfolding cos_coeff_def by (simp add: mult_ac)
qed
@@ -2230,14 +2201,26 @@
lemma arctan_zero_zero [simp]: "arctan 0 = 0"
by (insert arctan_tan [of 0], simp)
-lemma cos_arctan_not_zero [simp]: "cos(arctan x) \<noteq> 0"
-apply (auto simp add: cos_zero_iff)
-apply (case_tac "n")
-apply (case_tac [3] "n")
-apply (cut_tac [2] y = x in arctan_ubound)
-apply (cut_tac [4] y = x in arctan_lbound)
-apply (auto simp add: real_of_nat_Suc left_distrib mult_less_0_iff)
-done
+lemma cos_arctan_not_zero [simp]: "cos (arctan x) \<noteq> 0"
+ by (intro less_imp_neq [symmetric] cos_gt_zero_pi
+ arctan_lbound arctan_ubound)
+
+lemma cos_arctan: "cos (arctan x) = 1 / sqrt (1 + x\<twosuperior>)"
+proof (rule power2_eq_imp_eq)
+ have "0 < 1 + x\<twosuperior>" by (simp add: add_pos_nonneg)
+ show "0 \<le> 1 / sqrt (1 + x\<twosuperior>)" by simp
+ show "0 \<le> cos (arctan x)"
+ by (intro less_imp_le cos_gt_zero_pi arctan_lbound arctan_ubound)
+ have "(cos (arctan x))\<twosuperior> * (1 + (tan (arctan x))\<twosuperior>) = 1"
+ unfolding tan_def by (simp add: right_distrib power_divide)
+ thus "(cos (arctan x))\<twosuperior> = (1 / sqrt (1 + x\<twosuperior>))\<twosuperior>"
+ using `0 < 1 + x\<twosuperior>` by (simp add: power_divide eq_divide_eq)
+qed
+
+lemma sin_arctan: "sin (arctan x) = x / sqrt (1 + x\<twosuperior>)"
+ using add_pos_nonneg [OF zero_less_one zero_le_power2 [of x]]
+ using tan_arctan [of x] unfolding tan_def cos_arctan
+ by (simp add: eq_divide_eq)
lemma tan_sec: "cos x \<noteq> 0 ==> 1 + tan(x) ^ 2 = inverse(cos x) ^ 2"
apply (rule power_inverse [THEN subst])