src/HOL/Complex.thy
changeset 68721 53ad5c01be3f
parent 68499 d4312962161a
child 69260 0a9688695a1b
equal deleted inserted replaced
68720:1e1818612124 68721:53ad5c01be3f
   620 lemma lim_cnj: "((\<lambda>x. cnj(f x)) \<longlongrightarrow> cnj l) F \<longleftrightarrow> (f \<longlongrightarrow> l) F"
   620 lemma lim_cnj: "((\<lambda>x. cnj(f x)) \<longlongrightarrow> cnj l) F \<longleftrightarrow> (f \<longlongrightarrow> l) F"
   621   by (simp add: tendsto_iff dist_complex_def complex_cnj_diff [symmetric] del: complex_cnj_diff)
   621   by (simp add: tendsto_iff dist_complex_def complex_cnj_diff [symmetric] del: complex_cnj_diff)
   622 
   622 
   623 lemma sums_cnj: "((\<lambda>x. cnj(f x)) sums cnj l) \<longleftrightarrow> (f sums l)"
   623 lemma sums_cnj: "((\<lambda>x. cnj(f x)) sums cnj l) \<longleftrightarrow> (f sums l)"
   624   by (simp add: sums_def lim_cnj cnj_sum [symmetric] del: cnj_sum)
   624   by (simp add: sums_def lim_cnj cnj_sum [symmetric] del: cnj_sum)
       
   625 
       
   626 lemma differentiable_cnj_iff:
       
   627   "(\<lambda>z. cnj (f z)) differentiable at x within A \<longleftrightarrow> f differentiable at x within A"
       
   628 proof
       
   629   assume "(\<lambda>z. cnj (f z)) differentiable at x within A"
       
   630   then obtain D where "((\<lambda>z. cnj (f z)) has_derivative D) (at x within A)"
       
   631     by (auto simp: differentiable_def)
       
   632   from has_derivative_cnj[OF this] show "f differentiable at x within A"
       
   633     by (auto simp: differentiable_def)
       
   634 next
       
   635   assume "f differentiable at x within A"
       
   636   then obtain D where "(f has_derivative D) (at x within A)"
       
   637     by (auto simp: differentiable_def)
       
   638   from has_derivative_cnj[OF this] show "(\<lambda>z. cnj (f z)) differentiable at x within A"
       
   639     by (auto simp: differentiable_def)
       
   640 qed
       
   641 
       
   642 lemma has_vector_derivative_cnj [derivative_intros]:
       
   643   assumes "(f has_vector_derivative f') (at z within A)"
       
   644   shows   "((\<lambda>z. cnj (f z)) has_vector_derivative cnj f') (at z within A)"
       
   645   using assms by (auto simp: has_vector_derivative_complex_iff intro: derivative_intros)
   625 
   646 
   626 
   647 
   627 subsection \<open>Basic Lemmas\<close>
   648 subsection \<open>Basic Lemmas\<close>
   628 
   649 
   629 lemma complex_eq_0: "z=0 \<longleftrightarrow> (Re z)\<^sup>2 + (Im z)\<^sup>2 = 0"
   650 lemma complex_eq_0: "z=0 \<longleftrightarrow> (Re z)\<^sup>2 + (Im z)\<^sup>2 = 0"
   776   by (simp add: norm_complex_def)
   797   by (simp add: norm_complex_def)
   777 
   798 
   778 lemma sgn_cis [simp]: "sgn (cis a) = cis a"
   799 lemma sgn_cis [simp]: "sgn (cis a) = cis a"
   779   by (simp add: sgn_div_norm)
   800   by (simp add: sgn_div_norm)
   780 
   801 
       
   802 lemma cis_2pi [simp]: "cis (2 * pi) = 1"
       
   803   by (simp add: cis.ctr complex_eq_iff)
       
   804 
   781 lemma cis_neq_zero [simp]: "cis a \<noteq> 0"
   805 lemma cis_neq_zero [simp]: "cis a \<noteq> 0"
   782   by (metis norm_cis norm_zero zero_neq_one)
   806   by (metis norm_cis norm_zero zero_neq_one)
   783 
   807 
       
   808 lemma cis_cnj: "cnj (cis t) = cis (-t)"
       
   809   by (simp add: complex_eq_iff)
       
   810 
   784 lemma cis_mult: "cis a * cis b = cis (a + b)"
   811 lemma cis_mult: "cis a * cis b = cis (a + b)"
   785   by (simp add: complex_eq_iff cos_add sin_add)
   812   by (simp add: complex_eq_iff cos_add sin_add)
   786 
   813 
   787 lemma DeMoivre: "(cis a) ^ n = cis (real n * a)"
   814 lemma DeMoivre: "(cis a) ^ n = cis (real n * a)"
   788   by (induct n) (simp_all add: algebra_simps cis_mult)
   815   by (induct n) (simp_all add: algebra_simps cis_mult)
   800   by (auto simp add: DeMoivre)
   827   by (auto simp add: DeMoivre)
   801 
   828 
   802 lemma cis_pi [simp]: "cis pi = -1"
   829 lemma cis_pi [simp]: "cis pi = -1"
   803   by (simp add: complex_eq_iff)
   830   by (simp add: complex_eq_iff)
   804 
   831 
       
   832 lemma cis_pi_half[simp]: "cis (pi / 2) = \<i>"
       
   833   by (simp add: cis.ctr complex_eq_iff)
       
   834 
       
   835 lemma cis_minus_pi_half[simp]: "cis (-(pi / 2)) = -\<i>"
       
   836   by (simp add: cis.ctr complex_eq_iff)
       
   837 
       
   838 lemma cis_multiple_2pi[simp]: "n \<in> \<int> \<Longrightarrow> cis (2 * pi * n) = 1"
       
   839   by (auto elim!: Ints_cases simp: cis.ctr one_complex.ctr)
       
   840 
   805 
   841 
   806 subsubsection \<open>$r(\cos \theta + i \sin \theta)$\<close>
   842 subsubsection \<open>$r(\cos \theta + i \sin \theta)$\<close>
   807 
   843 
   808 definition rcis :: "real \<Rightarrow> real \<Rightarrow> complex"
   844 definition rcis :: "real \<Rightarrow> real \<Rightarrow> complex"
   809   where "rcis r a = complex_of_real r * cis a"
   845   where "rcis r a = complex_of_real r * cis a"
   844 lemma rcis_divide: "rcis r1 a / rcis r2 b = rcis (r1 / r2) (a - b)"
   880 lemma rcis_divide: "rcis r1 a / rcis r2 b = rcis (r1 / r2) (a - b)"
   845   by (simp add: rcis_def cis_divide [symmetric])
   881   by (simp add: rcis_def cis_divide [symmetric])
   846 
   882 
   847 
   883 
   848 subsubsection \<open>Complex exponential\<close>
   884 subsubsection \<open>Complex exponential\<close>
       
   885 
       
   886 lemma exp_Reals_eq:
       
   887   assumes "z \<in> \<real>"
       
   888   shows   "exp z = of_real (exp (Re z))"
       
   889   using assms by (auto elim!: Reals_cases simp: exp_of_real)
   849 
   890 
   850 lemma cis_conv_exp: "cis b = exp (\<i> * b)"
   891 lemma cis_conv_exp: "cis b = exp (\<i> * b)"
   851 proof -
   892 proof -
   852   have "(\<i> * complex_of_real b) ^ n /\<^sub>R fact n =
   893   have "(\<i> * complex_of_real b) ^ n /\<^sub>R fact n =
   853       of_real (cos_coeff n * b^n) + \<i> * of_real (sin_coeff n * b^n)"
   894       of_real (cos_coeff n * b^n) + \<i> * of_real (sin_coeff n * b^n)"
   898 lemma exp_two_pi_i [simp]: "exp (2 * of_real pi * \<i>) = 1"
   939 lemma exp_two_pi_i [simp]: "exp (2 * of_real pi * \<i>) = 1"
   899   by (simp add: exp_eq_polar complex_eq_iff)
   940   by (simp add: exp_eq_polar complex_eq_iff)
   900 
   941 
   901 lemma exp_two_pi_i' [simp]: "exp (\<i> * (of_real pi * 2)) = 1"
   942 lemma exp_two_pi_i' [simp]: "exp (\<i> * (of_real pi * 2)) = 1"
   902   by (metis exp_two_pi_i mult.commute)
   943   by (metis exp_two_pi_i mult.commute)
       
   944 
       
   945 lemma continuous_on_cis [continuous_intros]:
       
   946   "continuous_on A f \<Longrightarrow> continuous_on A (\<lambda>x. cis (f x))"
       
   947   by (auto simp: cis_conv_exp intro!: continuous_intros)
   903 
   948 
   904 
   949 
   905 subsubsection \<open>Complex argument\<close>
   950 subsubsection \<open>Complex argument\<close>
   906 
   951 
   907 definition arg :: "complex \<Rightarrow> real"
   952 definition arg :: "complex \<Rightarrow> real"