src/HOL/Multivariate_Analysis/Complex_Transcendental.thy
 author eberlm Mon Jun 13 15:23:12 2016 +0200 (2016-06-13) changeset 63295 52792bb9126e parent 63092 a949b2a5f51d child 63296 3951a15a05d1 permissions -rw-r--r--
Facts about HK integration, complex powers, Gamma function
 wenzelm@60420 ` 1` ```section \Complex Transcendental Functions\ ``` lp15@59745 ` 2` lp15@61711 ` 3` ```text\By John Harrison et al. Ported from HOL Light by L C Paulson (2015)\ ``` lp15@61711 ` 4` lp15@59745 ` 5` ```theory Complex_Transcendental ``` lp15@62534 ` 6` ```imports ``` eberlm@62049 ` 7` ``` Complex_Analysis_Basics ``` eberlm@62049 ` 8` ``` Summation ``` lp15@59745 ` 9` ```begin ``` lp15@59745 ` 10` eberlm@62049 ` 11` ```(* TODO: Figure out what to do with MÃ¶bius transformations *) ``` eberlm@62049 ` 12` ```definition "moebius a b c d = (\z. (a*z+b) / (c*z+d :: 'a :: field))" ``` eberlm@62049 ` 13` lp15@62534 ` 14` ```lemma moebius_inverse: ``` eberlm@62049 ` 15` ``` assumes "a * d \ b * c" "c * z + d \ 0" ``` eberlm@62049 ` 16` ``` shows "moebius d (-b) (-c) a (moebius a b c d z) = z" ``` eberlm@62049 ` 17` ```proof - ``` eberlm@62049 ` 18` ``` from assms have "(-c) * moebius a b c d z + a \ 0" unfolding moebius_def ``` eberlm@62049 ` 19` ``` by (simp add: field_simps) ``` eberlm@62049 ` 20` ``` with assms show ?thesis ``` eberlm@62049 ` 21` ``` unfolding moebius_def by (simp add: moebius_def divide_simps) (simp add: algebra_simps)? ``` eberlm@62049 ` 22` ```qed ``` eberlm@62049 ` 23` lp15@62534 ` 24` ```lemma moebius_inverse': ``` eberlm@62049 ` 25` ``` assumes "a * d \ b * c" "c * z - a \ 0" ``` eberlm@62049 ` 26` ``` shows "moebius a b c d (moebius d (-b) (-c) a z) = z" ``` eberlm@62049 ` 27` ``` using assms moebius_inverse[of d a "-b" "-c" z] ``` eberlm@62049 ` 28` ``` by (auto simp: algebra_simps) ``` eberlm@62049 ` 29` lp15@59870 ` 30` ```lemma cmod_add_real_less: ``` lp15@59870 ` 31` ``` assumes "Im z \ 0" "r\0" ``` wenzelm@61945 ` 32` ``` shows "cmod (z + r) < cmod z + \r\" ``` lp15@59870 ` 33` ```proof (cases z) ``` lp15@59870 ` 34` ``` case (Complex x y) ``` lp15@59870 ` 35` ``` have "r * x / \r\ < sqrt (x*x + y*y)" ``` lp15@59870 ` 36` ``` apply (rule real_less_rsqrt) ``` lp15@59870 ` 37` ``` using assms ``` lp15@59870 ` 38` ``` apply (simp add: Complex power2_eq_square) ``` lp15@59870 ` 39` ``` using not_real_square_gt_zero by blast ``` lp15@59870 ` 40` ``` then show ?thesis using assms Complex ``` lp15@59870 ` 41` ``` apply (auto simp: cmod_def) ``` lp15@59870 ` 42` ``` apply (rule power2_less_imp_less, auto) ``` lp15@59870 ` 43` ``` apply (simp add: power2_eq_square field_simps) ``` lp15@59870 ` 44` ``` done ``` lp15@59870 ` 45` ```qed ``` lp15@59870 ` 46` wenzelm@61945 ` 47` ```lemma cmod_diff_real_less: "Im z \ 0 \ x\0 \ cmod (z - x) < cmod z + \x\" ``` lp15@59870 ` 48` ``` using cmod_add_real_less [of z "-x"] ``` lp15@59870 ` 49` ``` by simp ``` lp15@59870 ` 50` lp15@59870 ` 51` ```lemma cmod_square_less_1_plus: ``` lp15@59870 ` 52` ``` assumes "Im z = 0 \ \Re z\ < 1" ``` lp15@59870 ` 53` ``` shows "(cmod z)\<^sup>2 < 1 + cmod (1 - z\<^sup>2)" ``` lp15@59870 ` 54` ``` using assms ``` lp15@59870 ` 55` ``` apply (cases "Im z = 0 \ Re z = 0") ``` lp15@59870 ` 56` ``` using abs_square_less_1 ``` lp15@59870 ` 57` ``` apply (force simp add: Re_power2 Im_power2 cmod_def) ``` lp15@59870 ` 58` ``` using cmod_diff_real_less [of "1 - z\<^sup>2" "1"] ``` lp15@59870 ` 59` ``` apply (simp add: norm_power Im_power2) ``` lp15@59870 ` 60` ``` done ``` lp15@59870 ` 61` wenzelm@60420 ` 62` ```subsection\The Exponential Function is Differentiable and Continuous\ ``` lp15@59745 ` 63` lp15@62534 ` 64` ```lemma field_differentiable_within_exp: "exp field_differentiable (at z within s)" ``` lp15@62534 ` 65` ``` using DERIV_exp field_differentiable_at_within field_differentiable_def by blast ``` lp15@59745 ` 66` lp15@59745 ` 67` ```lemma continuous_within_exp: ``` lp15@59745 ` 68` ``` fixes z::"'a::{real_normed_field,banach}" ``` lp15@59745 ` 69` ``` shows "continuous (at z within s) exp" ``` lp15@59745 ` 70` ```by (simp add: continuous_at_imp_continuous_within) ``` lp15@59745 ` 71` lp15@62381 ` 72` ```lemma holomorphic_on_exp [holomorphic_intros]: "exp holomorphic_on s" ``` lp15@62534 ` 73` ``` by (simp add: field_differentiable_within_exp holomorphic_on_def) ``` lp15@59745 ` 74` wenzelm@60420 ` 75` ```subsection\Euler and de Moivre formulas.\ ``` wenzelm@60420 ` 76` wenzelm@60420 ` 77` ```text\The sine series times @{term i}\ ``` lp15@59745 ` 78` ```lemma sin_ii_eq: "(\n. (ii * sin_coeff n) * z^n) sums (ii * sin z)" ``` lp15@59745 ` 79` ```proof - ``` lp15@59745 ` 80` ``` have "(\n. ii * sin_coeff n *\<^sub>R z^n) sums (ii * sin z)" ``` lp15@59745 ` 81` ``` using sin_converges sums_mult by blast ``` lp15@59745 ` 82` ``` then show ?thesis ``` lp15@59745 ` 83` ``` by (simp add: scaleR_conv_of_real field_simps) ``` lp15@59745 ` 84` ```qed ``` lp15@59745 ` 85` lp15@59745 ` 86` ```theorem exp_Euler: "exp(ii * z) = cos(z) + ii * sin(z)" ``` lp15@59745 ` 87` ```proof - ``` lp15@59862 ` 88` ``` have "(\n. (cos_coeff n + ii * sin_coeff n) * z^n) ``` lp15@59745 ` 89` ``` = (\n. (ii * z) ^ n /\<^sub>R (fact n))" ``` lp15@59745 ` 90` ``` proof ``` lp15@59745 ` 91` ``` fix n ``` lp15@59745 ` 92` ``` show "(cos_coeff n + ii * sin_coeff n) * z^n = (ii * z) ^ n /\<^sub>R (fact n)" ``` lp15@59745 ` 93` ``` by (auto simp: cos_coeff_def sin_coeff_def scaleR_conv_of_real field_simps elim!: evenE oddE) ``` lp15@59745 ` 94` ``` qed ``` lp15@59745 ` 95` ``` also have "... sums (exp (ii * z))" ``` lp15@59745 ` 96` ``` by (rule exp_converges) ``` lp15@59745 ` 97` ``` finally have "(\n. (cos_coeff n + ii * sin_coeff n) * z^n) sums (exp (ii * z))" . ``` lp15@59745 ` 98` ``` moreover have "(\n. (cos_coeff n + ii * sin_coeff n) * z^n) sums (cos z + ii * sin z)" ``` lp15@59745 ` 99` ``` using sums_add [OF cos_converges [of z] sin_ii_eq [of z]] ``` lp15@59745 ` 100` ``` by (simp add: field_simps scaleR_conv_of_real) ``` lp15@59745 ` 101` ``` ultimately show ?thesis ``` lp15@59745 ` 102` ``` using sums_unique2 by blast ``` lp15@59745 ` 103` ```qed ``` lp15@59745 ` 104` lp15@59745 ` 105` ```corollary exp_minus_Euler: "exp(-(ii * z)) = cos(z) - ii * sin(z)" ``` lp15@59745 ` 106` ``` using exp_Euler [of "-z"] ``` lp15@59745 ` 107` ``` by simp ``` lp15@59745 ` 108` lp15@59745 ` 109` ```lemma sin_exp_eq: "sin z = (exp(ii * z) - exp(-(ii * z))) / (2*ii)" ``` lp15@59745 ` 110` ``` by (simp add: exp_Euler exp_minus_Euler) ``` lp15@59745 ` 111` lp15@59745 ` 112` ```lemma sin_exp_eq': "sin z = ii * (exp(-(ii * z)) - exp(ii * z)) / 2" ``` lp15@59745 ` 113` ``` by (simp add: exp_Euler exp_minus_Euler) ``` lp15@59745 ` 114` lp15@59745 ` 115` ```lemma cos_exp_eq: "cos z = (exp(ii * z) + exp(-(ii * z))) / 2" ``` lp15@59745 ` 116` ``` by (simp add: exp_Euler exp_minus_Euler) ``` lp15@59745 ` 117` wenzelm@60420 ` 118` ```subsection\Relationships between real and complex trig functions\ ``` lp15@59745 ` 119` lp15@59745 ` 120` ```lemma real_sin_eq [simp]: ``` lp15@59745 ` 121` ``` fixes x::real ``` lp15@59745 ` 122` ``` shows "Re(sin(of_real x)) = sin x" ``` lp15@59745 ` 123` ``` by (simp add: sin_of_real) ``` lp15@59862 ` 124` lp15@59745 ` 125` ```lemma real_cos_eq [simp]: ``` lp15@59745 ` 126` ``` fixes x::real ``` lp15@59745 ` 127` ``` shows "Re(cos(of_real x)) = cos x" ``` lp15@59745 ` 128` ``` by (simp add: cos_of_real) ``` lp15@59745 ` 129` lp15@59745 ` 130` ```lemma DeMoivre: "(cos z + ii * sin z) ^ n = cos(n * z) + ii * sin(n * z)" ``` lp15@59745 ` 131` ``` apply (simp add: exp_Euler [symmetric]) ``` lp15@59745 ` 132` ``` by (metis exp_of_nat_mult mult.left_commute) ``` lp15@59745 ` 133` lp15@59745 ` 134` ```lemma exp_cnj: ``` lp15@59745 ` 135` ``` fixes z::complex ``` lp15@59745 ` 136` ``` shows "cnj (exp z) = exp (cnj z)" ``` lp15@59745 ` 137` ```proof - ``` lp15@59745 ` 138` ``` have "(\n. cnj (z ^ n /\<^sub>R (fact n))) = (\n. (cnj z)^n /\<^sub>R (fact n))" ``` lp15@59745 ` 139` ``` by auto ``` lp15@59745 ` 140` ``` also have "... sums (exp (cnj z))" ``` lp15@59745 ` 141` ``` by (rule exp_converges) ``` lp15@59745 ` 142` ``` finally have "(\n. cnj (z ^ n /\<^sub>R (fact n))) sums (exp (cnj z))" . ``` lp15@59745 ` 143` ``` moreover have "(\n. cnj (z ^ n /\<^sub>R (fact n))) sums (cnj (exp z))" ``` lp15@59862 ` 144` ``` by (metis exp_converges sums_cnj) ``` lp15@59745 ` 145` ``` ultimately show ?thesis ``` lp15@59745 ` 146` ``` using sums_unique2 ``` lp15@59862 ` 147` ``` by blast ``` lp15@59745 ` 148` ```qed ``` lp15@59745 ` 149` lp15@59745 ` 150` ```lemma cnj_sin: "cnj(sin z) = sin(cnj z)" ``` lp15@59745 ` 151` ``` by (simp add: sin_exp_eq exp_cnj field_simps) ``` lp15@59745 ` 152` lp15@59745 ` 153` ```lemma cnj_cos: "cnj(cos z) = cos(cnj z)" ``` lp15@59745 ` 154` ``` by (simp add: cos_exp_eq exp_cnj field_simps) ``` lp15@59745 ` 155` lp15@62534 ` 156` ```lemma field_differentiable_at_sin: "sin field_differentiable at z" ``` lp15@62534 ` 157` ``` using DERIV_sin field_differentiable_def by blast ``` lp15@62534 ` 158` lp15@62534 ` 159` ```lemma field_differentiable_within_sin: "sin field_differentiable (at z within s)" ``` lp15@62534 ` 160` ``` by (simp add: field_differentiable_at_sin field_differentiable_at_within) ``` lp15@62534 ` 161` lp15@62534 ` 162` ```lemma field_differentiable_at_cos: "cos field_differentiable at z" ``` lp15@62534 ` 163` ``` using DERIV_cos field_differentiable_def by blast ``` lp15@62534 ` 164` lp15@62534 ` 165` ```lemma field_differentiable_within_cos: "cos field_differentiable (at z within s)" ``` lp15@62534 ` 166` ``` by (simp add: field_differentiable_at_cos field_differentiable_at_within) ``` lp15@59745 ` 167` lp15@59745 ` 168` ```lemma holomorphic_on_sin: "sin holomorphic_on s" ``` lp15@62534 ` 169` ``` by (simp add: field_differentiable_within_sin holomorphic_on_def) ``` lp15@59745 ` 170` lp15@59745 ` 171` ```lemma holomorphic_on_cos: "cos holomorphic_on s" ``` lp15@62534 ` 172` ``` by (simp add: field_differentiable_within_cos holomorphic_on_def) ``` lp15@59745 ` 173` wenzelm@60420 ` 174` ```subsection\Get a nice real/imaginary separation in Euler's formula.\ ``` lp15@59745 ` 175` lp15@59862 ` 176` ```lemma Euler: "exp(z) = of_real(exp(Re z)) * ``` lp15@59745 ` 177` ``` (of_real(cos(Im z)) + ii * of_real(sin(Im z)))" ``` lp15@59745 ` 178` ```by (cases z) (simp add: exp_add exp_Euler cos_of_real exp_of_real sin_of_real) ``` lp15@59745 ` 179` lp15@59745 ` 180` ```lemma Re_sin: "Re(sin z) = sin(Re z) * (exp(Im z) + exp(-(Im z))) / 2" ``` lp15@59745 ` 181` ``` by (simp add: sin_exp_eq field_simps Re_divide Im_exp) ``` lp15@59745 ` 182` lp15@59745 ` 183` ```lemma Im_sin: "Im(sin z) = cos(Re z) * (exp(Im z) - exp(-(Im z))) / 2" ``` lp15@59745 ` 184` ``` by (simp add: sin_exp_eq field_simps Im_divide Re_exp) ``` lp15@59745 ` 185` lp15@59745 ` 186` ```lemma Re_cos: "Re(cos z) = cos(Re z) * (exp(Im z) + exp(-(Im z))) / 2" ``` lp15@59745 ` 187` ``` by (simp add: cos_exp_eq field_simps Re_divide Re_exp) ``` lp15@59745 ` 188` lp15@59745 ` 189` ```lemma Im_cos: "Im(cos z) = sin(Re z) * (exp(-(Im z)) - exp(Im z)) / 2" ``` lp15@59745 ` 190` ``` by (simp add: cos_exp_eq field_simps Im_divide Im_exp) ``` lp15@59862 ` 191` lp15@59862 ` 192` ```lemma Re_sin_pos: "0 < Re z \ Re z < pi \ Re (sin z) > 0" ``` lp15@59862 ` 193` ``` by (auto simp: Re_sin Im_sin add_pos_pos sin_gt_zero) ``` lp15@59862 ` 194` lp15@59862 ` 195` ```lemma Im_sin_nonneg: "Re z = 0 \ 0 \ Im z \ 0 \ Im (sin z)" ``` lp15@59862 ` 196` ``` by (simp add: Re_sin Im_sin algebra_simps) ``` lp15@59862 ` 197` lp15@59862 ` 198` ```lemma Im_sin_nonneg2: "Re z = pi \ Im z \ 0 \ 0 \ Im (sin z)" ``` lp15@59862 ` 199` ``` by (simp add: Re_sin Im_sin algebra_simps) ``` lp15@59862 ` 200` wenzelm@60420 ` 201` ```subsection\More on the Polar Representation of Complex Numbers\ ``` lp15@59746 ` 202` lp15@59746 ` 203` ```lemma exp_Complex: "exp(Complex r t) = of_real(exp r) * Complex (cos t) (sin t)" ``` lp15@59862 ` 204` ``` by (simp add: exp_add exp_Euler exp_of_real sin_of_real cos_of_real) ``` lp15@59746 ` 205` lp15@59746 ` 206` ```lemma exp_eq_1: "exp z = 1 \ Re(z) = 0 \ (\n::int. Im(z) = of_int (2 * n) * pi)" ``` lp15@59746 ` 207` ```apply auto ``` lp15@59746 ` 208` ```apply (metis exp_eq_one_iff norm_exp_eq_Re norm_one) ``` lp15@61609 ` 209` ```apply (metis Re_exp cos_one_2pi_int mult.commute mult.left_neutral norm_exp_eq_Re norm_one one_complex.simps(1)) ``` lp15@61609 ` 210` ```by (metis Im_exp Re_exp complex_Re_Im_cancel_iff cos_one_2pi_int sin_double Re_complex_of_real complex_Re_numeral exp_zero mult.assoc mult.left_commute mult_eq_0_iff mult_numeral_1 numeral_One of_real_0 sin_zero_iff_int2) ``` lp15@59746 ` 211` lp15@59746 ` 212` ```lemma exp_eq: "exp w = exp z \ (\n::int. w = z + (of_int (2 * n) * pi) * ii)" ``` lp15@59746 ` 213` ``` (is "?lhs = ?rhs") ``` lp15@59746 ` 214` ```proof - ``` lp15@59746 ` 215` ``` have "exp w = exp z \ exp (w-z) = 1" ``` lp15@59746 ` 216` ``` by (simp add: exp_diff) ``` lp15@59746 ` 217` ``` also have "... \ (Re w = Re z \ (\n::int. Im w - Im z = of_int (2 * n) * pi))" ``` lp15@59746 ` 218` ``` by (simp add: exp_eq_1) ``` lp15@59746 ` 219` ``` also have "... \ ?rhs" ``` lp15@59746 ` 220` ``` by (auto simp: algebra_simps intro!: complex_eqI) ``` lp15@59746 ` 221` ``` finally show ?thesis . ``` lp15@59746 ` 222` ```qed ``` lp15@59746 ` 223` wenzelm@61945 ` 224` ```lemma exp_complex_eqI: "\Im w - Im z\ < 2*pi \ exp w = exp z \ w = z" ``` lp15@59746 ` 225` ``` by (auto simp: exp_eq abs_mult) ``` lp15@59746 ` 226` lp15@59862 ` 227` ```lemma exp_integer_2pi: ``` wenzelm@61070 ` 228` ``` assumes "n \ \" ``` lp15@59746 ` 229` ``` shows "exp((2 * n * pi) * ii) = 1" ``` lp15@59746 ` 230` ```proof - ``` lp15@59746 ` 231` ``` have "exp((2 * n * pi) * ii) = exp 0" ``` lp15@59746 ` 232` ``` using assms ``` lp15@59746 ` 233` ``` by (simp only: Ints_def exp_eq) auto ``` lp15@59746 ` 234` ``` also have "... = 1" ``` lp15@59746 ` 235` ``` by simp ``` lp15@59746 ` 236` ``` finally show ?thesis . ``` lp15@59746 ` 237` ```qed ``` lp15@59746 ` 238` lp15@59746 ` 239` ```lemma sin_cos_eq_iff: "sin y = sin x \ cos y = cos x \ (\n::int. y = x + 2 * n * pi)" ``` lp15@59746 ` 240` ```proof - ``` lp15@59746 ` 241` ``` { assume "sin y = sin x" "cos y = cos x" ``` lp15@59746 ` 242` ``` then have "cos (y-x) = 1" ``` lp15@59746 ` 243` ``` using cos_add [of y "-x"] by simp ``` lp15@61609 ` 244` ``` then have "\n::int. y-x = n * 2 * pi" ``` lp15@59746 ` 245` ``` using cos_one_2pi_int by blast } ``` lp15@59746 ` 246` ``` then show ?thesis ``` lp15@59746 ` 247` ``` apply (auto simp: sin_add cos_add) ``` lp15@59746 ` 248` ``` apply (metis add.commute diff_add_cancel mult.commute) ``` lp15@59746 ` 249` ``` done ``` lp15@59746 ` 250` ```qed ``` lp15@59746 ` 251` lp15@59862 ` 252` ```lemma exp_i_ne_1: ``` lp15@59746 ` 253` ``` assumes "0 < x" "x < 2*pi" ``` lp15@59746 ` 254` ``` shows "exp(\ * of_real x) \ 1" ``` lp15@59862 ` 255` ```proof ``` lp15@59746 ` 256` ``` assume "exp (\ * of_real x) = 1" ``` lp15@59746 ` 257` ``` then have "exp (\ * of_real x) = exp 0" ``` lp15@59746 ` 258` ``` by simp ``` lp15@59746 ` 259` ``` then obtain n where "\ * of_real x = (of_int (2 * n) * pi) * \" ``` lp15@59746 ` 260` ``` by (simp only: Ints_def exp_eq) auto ``` lp15@59746 ` 261` ``` then have "of_real x = (of_int (2 * n) * pi)" ``` lp15@59746 ` 262` ``` by (metis complex_i_not_zero mult.commute mult_cancel_left of_real_eq_iff real_scaleR_def scaleR_conv_of_real) ``` lp15@59746 ` 263` ``` then have "x = (of_int (2 * n) * pi)" ``` lp15@59746 ` 264` ``` by simp ``` lp15@59746 ` 265` ``` then show False using assms ``` lp15@59746 ` 266` ``` by (cases n) (auto simp: zero_less_mult_iff mult_less_0_iff) ``` lp15@59746 ` 267` ```qed ``` lp15@59746 ` 268` lp15@59862 ` 269` ```lemma sin_eq_0: ``` lp15@59746 ` 270` ``` fixes z::complex ``` lp15@59746 ` 271` ``` shows "sin z = 0 \ (\n::int. z = of_real(n * pi))" ``` lp15@59746 ` 272` ``` by (simp add: sin_exp_eq exp_eq of_real_numeral) ``` lp15@59746 ` 273` lp15@59862 ` 274` ```lemma cos_eq_0: ``` lp15@59746 ` 275` ``` fixes z::complex ``` lp15@59746 ` 276` ``` shows "cos z = 0 \ (\n::int. z = of_real(n * pi) + of_real pi/2)" ``` lp15@59746 ` 277` ``` using sin_eq_0 [of "z - of_real pi/2"] ``` lp15@59746 ` 278` ``` by (simp add: sin_diff algebra_simps) ``` lp15@59746 ` 279` lp15@59862 ` 280` ```lemma cos_eq_1: ``` lp15@59746 ` 281` ``` fixes z::complex ``` lp15@59746 ` 282` ``` shows "cos z = 1 \ (\n::int. z = of_real(2 * n * pi))" ``` lp15@59746 ` 283` ```proof - ``` lp15@59746 ` 284` ``` have "cos z = cos (2*(z/2))" ``` lp15@59746 ` 285` ``` by simp ``` lp15@59746 ` 286` ``` also have "... = 1 - 2 * sin (z/2) ^ 2" ``` lp15@59746 ` 287` ``` by (simp only: cos_double_sin) ``` lp15@59746 ` 288` ``` finally have [simp]: "cos z = 1 \ sin (z/2) = 0" ``` lp15@59746 ` 289` ``` by simp ``` lp15@59746 ` 290` ``` show ?thesis ``` lp15@59746 ` 291` ``` by (auto simp: sin_eq_0 of_real_numeral) ``` lp15@59862 ` 292` ```qed ``` lp15@59746 ` 293` lp15@59746 ` 294` ```lemma csin_eq_1: ``` lp15@59746 ` 295` ``` fixes z::complex ``` lp15@59746 ` 296` ``` shows "sin z = 1 \ (\n::int. z = of_real(2 * n * pi) + of_real pi/2)" ``` lp15@59746 ` 297` ``` using cos_eq_1 [of "z - of_real pi/2"] ``` lp15@59746 ` 298` ``` by (simp add: cos_diff algebra_simps) ``` lp15@59746 ` 299` lp15@59746 ` 300` ```lemma csin_eq_minus1: ``` lp15@59746 ` 301` ``` fixes z::complex ``` lp15@59746 ` 302` ``` shows "sin z = -1 \ (\n::int. z = of_real(2 * n * pi) + 3/2*pi)" ``` lp15@59746 ` 303` ``` (is "_ = ?rhs") ``` lp15@59746 ` 304` ```proof - ``` lp15@59746 ` 305` ``` have "sin z = -1 \ sin (-z) = 1" ``` lp15@59746 ` 306` ``` by (simp add: equation_minus_iff) ``` lp15@59746 ` 307` ``` also have "... \ (\n::int. -z = of_real(2 * n * pi) + of_real pi/2)" ``` lp15@59746 ` 308` ``` by (simp only: csin_eq_1) ``` lp15@59746 ` 309` ``` also have "... \ (\n::int. z = - of_real(2 * n * pi) - of_real pi/2)" ``` lp15@59746 ` 310` ``` apply (rule iff_exI) ``` lp15@59746 ` 311` ``` by (metis (no_types) is_num_normalize(8) minus_minus of_real_def real_vector.scale_minus_left uminus_add_conv_diff) ``` lp15@59746 ` 312` ``` also have "... = ?rhs" ``` lp15@59746 ` 313` ``` apply (auto simp: of_real_numeral) ``` lp15@59746 ` 314` ``` apply (rule_tac [2] x="-(x+1)" in exI) ``` lp15@59746 ` 315` ``` apply (rule_tac x="-(x+1)" in exI) ``` lp15@59746 ` 316` ``` apply (simp_all add: algebra_simps) ``` lp15@59746 ` 317` ``` done ``` lp15@59746 ` 318` ``` finally show ?thesis . ``` lp15@59862 ` 319` ```qed ``` lp15@59746 ` 320` lp15@59862 ` 321` ```lemma ccos_eq_minus1: ``` lp15@59746 ` 322` ``` fixes z::complex ``` lp15@59746 ` 323` ``` shows "cos z = -1 \ (\n::int. z = of_real(2 * n * pi) + pi)" ``` lp15@59746 ` 324` ``` using csin_eq_1 [of "z - of_real pi/2"] ``` lp15@59746 ` 325` ``` apply (simp add: sin_diff) ``` lp15@59746 ` 326` ``` apply (simp add: algebra_simps of_real_numeral equation_minus_iff) ``` lp15@59862 ` 327` ``` done ``` lp15@59746 ` 328` lp15@59746 ` 329` ```lemma sin_eq_1: "sin x = 1 \ (\n::int. x = (2 * n + 1 / 2) * pi)" ``` lp15@59746 ` 330` ``` (is "_ = ?rhs") ``` lp15@59746 ` 331` ```proof - ``` lp15@59746 ` 332` ``` have "sin x = 1 \ sin (complex_of_real x) = 1" ``` lp15@59746 ` 333` ``` by (metis of_real_1 one_complex.simps(1) real_sin_eq sin_of_real) ``` lp15@59746 ` 334` ``` also have "... \ (\n::int. complex_of_real x = of_real(2 * n * pi) + of_real pi/2)" ``` lp15@59746 ` 335` ``` by (simp only: csin_eq_1) ``` lp15@59746 ` 336` ``` also have "... \ (\n::int. x = of_real(2 * n * pi) + of_real pi/2)" ``` lp15@59746 ` 337` ``` apply (rule iff_exI) ``` lp15@59746 ` 338` ``` apply (auto simp: algebra_simps of_real_numeral) ``` lp15@59746 ` 339` ``` apply (rule injD [OF inj_of_real [where 'a = complex]]) ``` lp15@59746 ` 340` ``` apply (auto simp: of_real_numeral) ``` lp15@59746 ` 341` ``` done ``` lp15@59746 ` 342` ``` also have "... = ?rhs" ``` lp15@59746 ` 343` ``` by (auto simp: algebra_simps) ``` lp15@59746 ` 344` ``` finally show ?thesis . ``` lp15@59862 ` 345` ```qed ``` lp15@59746 ` 346` lp15@59746 ` 347` ```lemma sin_eq_minus1: "sin x = -1 \ (\n::int. x = (2*n + 3/2) * pi)" (is "_ = ?rhs") ``` lp15@59746 ` 348` ```proof - ``` lp15@59746 ` 349` ``` have "sin x = -1 \ sin (complex_of_real x) = -1" ``` lp15@59746 ` 350` ``` by (metis Re_complex_of_real of_real_def scaleR_minus1_left sin_of_real) ``` lp15@59746 ` 351` ``` also have "... \ (\n::int. complex_of_real x = of_real(2 * n * pi) + 3/2*pi)" ``` lp15@59746 ` 352` ``` by (simp only: csin_eq_minus1) ``` lp15@59746 ` 353` ``` also have "... \ (\n::int. x = of_real(2 * n * pi) + 3/2*pi)" ``` lp15@59746 ` 354` ``` apply (rule iff_exI) ``` lp15@59746 ` 355` ``` apply (auto simp: algebra_simps) ``` lp15@59746 ` 356` ``` apply (rule injD [OF inj_of_real [where 'a = complex]], auto) ``` lp15@59746 ` 357` ``` done ``` lp15@59746 ` 358` ``` also have "... = ?rhs" ``` lp15@59746 ` 359` ``` by (auto simp: algebra_simps) ``` lp15@59746 ` 360` ``` finally show ?thesis . ``` lp15@59862 ` 361` ```qed ``` lp15@59746 ` 362` lp15@59746 ` 363` ```lemma cos_eq_minus1: "cos x = -1 \ (\n::int. x = (2*n + 1) * pi)" ``` lp15@59746 ` 364` ``` (is "_ = ?rhs") ``` lp15@59746 ` 365` ```proof - ``` lp15@59746 ` 366` ``` have "cos x = -1 \ cos (complex_of_real x) = -1" ``` lp15@59746 ` 367` ``` by (metis Re_complex_of_real of_real_def scaleR_minus1_left cos_of_real) ``` lp15@59746 ` 368` ``` also have "... \ (\n::int. complex_of_real x = of_real(2 * n * pi) + pi)" ``` lp15@59746 ` 369` ``` by (simp only: ccos_eq_minus1) ``` lp15@59746 ` 370` ``` also have "... \ (\n::int. x = of_real(2 * n * pi) + pi)" ``` lp15@59746 ` 371` ``` apply (rule iff_exI) ``` lp15@59746 ` 372` ``` apply (auto simp: algebra_simps) ``` lp15@59746 ` 373` ``` apply (rule injD [OF inj_of_real [where 'a = complex]], auto) ``` lp15@59746 ` 374` ``` done ``` lp15@59746 ` 375` ``` also have "... = ?rhs" ``` lp15@59746 ` 376` ``` by (auto simp: algebra_simps) ``` lp15@59746 ` 377` ``` finally show ?thesis . ``` lp15@59862 ` 378` ```qed ``` lp15@59746 ` 379` wenzelm@61945 ` 380` ```lemma dist_exp_ii_1: "norm(exp(ii * of_real t) - 1) = 2 * \sin(t / 2)\" ``` lp15@59862 ` 381` ``` apply (simp add: exp_Euler cmod_def power2_diff sin_of_real cos_of_real algebra_simps) ``` lp15@59746 ` 382` ``` using cos_double_sin [of "t/2"] ``` lp15@59746 ` 383` ``` apply (simp add: real_sqrt_mult) ``` lp15@59746 ` 384` ``` done ``` lp15@59746 ` 385` lp15@59746 ` 386` ```lemma sinh_complex: ``` lp15@59746 ` 387` ``` fixes z :: complex ``` lp15@59746 ` 388` ``` shows "(exp z - inverse (exp z)) / 2 = -ii * sin(ii * z)" ``` lp15@59746 ` 389` ``` by (simp add: sin_exp_eq divide_simps exp_minus of_real_numeral) ``` lp15@59746 ` 390` lp15@59746 ` 391` ```lemma sin_ii_times: ``` lp15@59746 ` 392` ``` fixes z :: complex ``` lp15@59746 ` 393` ``` shows "sin(ii * z) = ii * ((exp z - inverse (exp z)) / 2)" ``` lp15@59746 ` 394` ``` using sinh_complex by auto ``` lp15@59746 ` 395` lp15@59746 ` 396` ```lemma sinh_real: ``` lp15@59746 ` 397` ``` fixes x :: real ``` lp15@59746 ` 398` ``` shows "of_real((exp x - inverse (exp x)) / 2) = -ii * sin(ii * of_real x)" ``` lp15@59746 ` 399` ``` by (simp add: exp_of_real sin_ii_times of_real_numeral) ``` lp15@59746 ` 400` lp15@59746 ` 401` ```lemma cosh_complex: ``` lp15@59746 ` 402` ``` fixes z :: complex ``` lp15@59746 ` 403` ``` shows "(exp z + inverse (exp z)) / 2 = cos(ii * z)" ``` lp15@59746 ` 404` ``` by (simp add: cos_exp_eq divide_simps exp_minus of_real_numeral exp_of_real) ``` lp15@59746 ` 405` lp15@59746 ` 406` ```lemma cosh_real: ``` lp15@59746 ` 407` ``` fixes x :: real ``` lp15@59746 ` 408` ``` shows "of_real((exp x + inverse (exp x)) / 2) = cos(ii * of_real x)" ``` lp15@59746 ` 409` ``` by (simp add: cos_exp_eq divide_simps exp_minus of_real_numeral exp_of_real) ``` lp15@59746 ` 410` lp15@59746 ` 411` ```lemmas cos_ii_times = cosh_complex [symmetric] ``` lp15@59746 ` 412` lp15@59862 ` 413` ```lemma norm_cos_squared: ``` lp15@59746 ` 414` ``` "norm(cos z) ^ 2 = cos(Re z) ^ 2 + (exp(Im z) - inverse(exp(Im z))) ^ 2 / 4" ``` lp15@59746 ` 415` ``` apply (cases z) ``` lp15@59746 ` 416` ``` apply (simp add: cos_add cmod_power2 cos_of_real sin_of_real) ``` lp15@61694 ` 417` ``` apply (simp add: cos_exp_eq sin_exp_eq exp_minus exp_of_real Re_divide Im_divide power_divide) ``` lp15@59746 ` 418` ``` apply (simp only: left_diff_distrib [symmetric] power_mult_distrib) ``` lp15@59746 ` 419` ``` apply (simp add: sin_squared_eq) ``` lp15@59746 ` 420` ``` apply (simp add: power2_eq_square algebra_simps divide_simps) ``` lp15@59746 ` 421` ``` done ``` lp15@59746 ` 422` lp15@59746 ` 423` ```lemma norm_sin_squared: ``` lp15@59746 ` 424` ``` "norm(sin z) ^ 2 = (exp(2 * Im z) + inverse(exp(2 * Im z)) - 2 * cos(2 * Re z)) / 4" ``` lp15@59746 ` 425` ``` apply (cases z) ``` lp15@59746 ` 426` ``` apply (simp add: sin_add cmod_power2 cos_of_real sin_of_real cos_double_cos exp_double) ``` lp15@61694 ` 427` ``` apply (simp add: cos_exp_eq sin_exp_eq exp_minus exp_of_real Re_divide Im_divide power_divide) ``` lp15@59746 ` 428` ``` apply (simp only: left_diff_distrib [symmetric] power_mult_distrib) ``` lp15@59746 ` 429` ``` apply (simp add: cos_squared_eq) ``` lp15@59746 ` 430` ``` apply (simp add: power2_eq_square algebra_simps divide_simps) ``` lp15@59862 ` 431` ``` done ``` lp15@59746 ` 432` lp15@59746 ` 433` ```lemma exp_uminus_Im: "exp (- Im z) \ exp (cmod z)" ``` lp15@59746 ` 434` ``` using abs_Im_le_cmod linear order_trans by fastforce ``` lp15@59746 ` 435` lp15@59862 ` 436` ```lemma norm_cos_le: ``` lp15@59746 ` 437` ``` fixes z::complex ``` lp15@59746 ` 438` ``` shows "norm(cos z) \ exp(norm z)" ``` lp15@59746 ` 439` ```proof - ``` lp15@59746 ` 440` ``` have "Im z \ cmod z" ``` lp15@59746 ` 441` ``` using abs_Im_le_cmod abs_le_D1 by auto ``` lp15@59746 ` 442` ``` with exp_uminus_Im show ?thesis ``` lp15@59746 ` 443` ``` apply (simp add: cos_exp_eq norm_divide) ``` lp15@59746 ` 444` ``` apply (rule order_trans [OF norm_triangle_ineq], simp) ``` lp15@59746 ` 445` ``` apply (metis add_mono exp_le_cancel_iff mult_2_right) ``` lp15@59746 ` 446` ``` done ``` lp15@59746 ` 447` ```qed ``` lp15@59746 ` 448` lp15@59862 ` 449` ```lemma norm_cos_plus1_le: ``` lp15@59746 ` 450` ``` fixes z::complex ``` lp15@59746 ` 451` ``` shows "norm(1 + cos z) \ 2 * exp(norm z)" ``` lp15@59746 ` 452` ```proof - ``` lp15@59746 ` 453` ``` have mono: "\u w z::real. (1 \ w | 1 \ z) \ (w \ u & z \ u) \ 2 + w + z \ 4 * u" ``` lp15@59746 ` 454` ``` by arith ``` lp15@59746 ` 455` ``` have *: "Im z \ cmod z" ``` lp15@59746 ` 456` ``` using abs_Im_le_cmod abs_le_D1 by auto ``` lp15@59746 ` 457` ``` have triangle3: "\x y z. norm(x + y + z) \ norm(x) + norm(y) + norm(z)" ``` lp15@59746 ` 458` ``` by (simp add: norm_add_rule_thm) ``` lp15@59746 ` 459` ``` have "norm(1 + cos z) = cmod (1 + (exp (\ * z) + exp (- (\ * z))) / 2)" ``` lp15@59746 ` 460` ``` by (simp add: cos_exp_eq) ``` lp15@59746 ` 461` ``` also have "... = cmod ((2 + exp (\ * z) + exp (- (\ * z))) / 2)" ``` lp15@59746 ` 462` ``` by (simp add: field_simps) ``` lp15@59746 ` 463` ``` also have "... = cmod (2 + exp (\ * z) + exp (- (\ * z))) / 2" ``` lp15@59746 ` 464` ``` by (simp add: norm_divide) ``` lp15@59746 ` 465` ``` finally show ?thesis ``` lp15@59746 ` 466` ``` apply (rule ssubst, simp) ``` lp15@59746 ` 467` ``` apply (rule order_trans [OF triangle3], simp) ``` lp15@59746 ` 468` ``` using exp_uminus_Im * ``` lp15@59746 ` 469` ``` apply (auto intro: mono) ``` lp15@59746 ` 470` ``` done ``` lp15@59746 ` 471` ```qed ``` lp15@59746 ` 472` wenzelm@60420 ` 473` ```subsection\Taylor series for complex exponential, sine and cosine.\ ``` lp15@59746 ` 474` lp15@59746 ` 475` ```declare power_Suc [simp del] ``` lp15@59746 ` 476` lp15@59862 ` 477` ```lemma Taylor_exp: ``` lp15@59746 ` 478` ``` "norm(exp z - (\k\n. z ^ k / (fact k))) \ exp\Re z\ * (norm z) ^ (Suc n) / (fact n)" ``` lp15@59746 ` 479` ```proof (rule complex_taylor [of _ n "\k. exp" "exp\Re z\" 0 z, simplified]) ``` lp15@59746 ` 480` ``` show "convex (closed_segment 0 z)" ``` paulson@61518 ` 481` ``` by (rule convex_closed_segment [of 0 z]) ``` lp15@59746 ` 482` ```next ``` lp15@59746 ` 483` ``` fix k x ``` lp15@59746 ` 484` ``` assume "x \ closed_segment 0 z" "k \ n" ``` lp15@59746 ` 485` ``` show "(exp has_field_derivative exp x) (at x within closed_segment 0 z)" ``` lp15@59746 ` 486` ``` using DERIV_exp DERIV_subset by blast ``` lp15@59746 ` 487` ```next ``` lp15@59746 ` 488` ``` fix x ``` lp15@59746 ` 489` ``` assume "x \ closed_segment 0 z" ``` lp15@59746 ` 490` ``` then show "Re x \ \Re z\" ``` lp15@59746 ` 491` ``` apply (auto simp: closed_segment_def scaleR_conv_of_real) ``` lp15@59746 ` 492` ``` by (meson abs_ge_self abs_ge_zero linear mult_left_le_one_le mult_nonneg_nonpos order_trans) ``` lp15@59746 ` 493` ```next ``` lp15@59746 ` 494` ``` show "0 \ closed_segment 0 z" ``` lp15@59746 ` 495` ``` by (auto simp: closed_segment_def) ``` lp15@59746 ` 496` ```next ``` lp15@59746 ` 497` ``` show "z \ closed_segment 0 z" ``` lp15@59746 ` 498` ``` apply (simp add: closed_segment_def scaleR_conv_of_real) ``` lp15@59746 ` 499` ``` using of_real_1 zero_le_one by blast ``` lp15@59862 ` 500` ```qed ``` lp15@59746 ` 501` lp15@59862 ` 502` ```lemma ``` lp15@59746 ` 503` ``` assumes "0 \ u" "u \ 1" ``` lp15@59862 ` 504` ``` shows cmod_sin_le_exp: "cmod (sin (u *\<^sub>R z)) \ exp \Im z\" ``` lp15@59746 ` 505` ``` and cmod_cos_le_exp: "cmod (cos (u *\<^sub>R z)) \ exp \Im z\" ``` lp15@59746 ` 506` ```proof - ``` lp15@59746 ` 507` ``` have mono: "\u w z::real. w \ u \ z \ u \ w + z \ u*2" ``` lp15@59746 ` 508` ``` by arith ``` lp15@59746 ` 509` ``` show "cmod (sin (u *\<^sub>R z)) \ exp \Im z\" using assms ``` lp15@59746 ` 510` ``` apply (auto simp: scaleR_conv_of_real norm_mult norm_power sin_exp_eq norm_divide) ``` lp15@59746 ` 511` ``` apply (rule order_trans [OF norm_triangle_ineq4]) ``` lp15@59746 ` 512` ``` apply (rule mono) ``` lp15@59746 ` 513` ``` apply (auto simp: abs_if mult_left_le_one_le) ``` lp15@59746 ` 514` ``` apply (meson mult_nonneg_nonneg neg_le_0_iff_le not_le order_trans) ``` lp15@59746 ` 515` ``` apply (meson less_eq_real_def mult_nonneg_nonpos neg_0_le_iff_le order_trans) ``` lp15@59746 ` 516` ``` done ``` lp15@59746 ` 517` ``` show "cmod (cos (u *\<^sub>R z)) \ exp \Im z\" using assms ``` lp15@59746 ` 518` ``` apply (auto simp: scaleR_conv_of_real norm_mult norm_power cos_exp_eq norm_divide) ``` lp15@59746 ` 519` ``` apply (rule order_trans [OF norm_triangle_ineq]) ``` lp15@59746 ` 520` ``` apply (rule mono) ``` lp15@59746 ` 521` ``` apply (auto simp: abs_if mult_left_le_one_le) ``` lp15@59746 ` 522` ``` apply (meson mult_nonneg_nonneg neg_le_0_iff_le not_le order_trans) ``` lp15@59746 ` 523` ``` apply (meson less_eq_real_def mult_nonneg_nonpos neg_0_le_iff_le order_trans) ``` lp15@59746 ` 524` ``` done ``` lp15@59746 ` 525` ```qed ``` lp15@59862 ` 526` lp15@59862 ` 527` ```lemma Taylor_sin: ``` lp15@59862 ` 528` ``` "norm(sin z - (\k\n. complex_of_real (sin_coeff k) * z ^ k)) ``` lp15@59746 ` 529` ``` \ exp\Im z\ * (norm z) ^ (Suc n) / (fact n)" ``` lp15@59746 ` 530` ```proof - ``` lp15@59746 ` 531` ``` have mono: "\u w z::real. w \ u \ z \ u \ w + z \ u*2" ``` lp15@59746 ` 532` ``` by arith ``` lp15@59746 ` 533` ``` have *: "cmod (sin z - ``` lp15@59746 ` 534` ``` (\i\n. (-1) ^ (i div 2) * (if even i then sin 0 else cos 0) * z ^ i / (fact i))) ``` lp15@59862 ` 535` ``` \ exp \Im z\ * cmod z ^ Suc n / (fact n)" ``` lp15@61609 ` 536` ``` proof (rule complex_taylor [of "closed_segment 0 z" n ``` lp15@61609 ` 537` ``` "\k x. (-1)^(k div 2) * (if even k then sin x else cos x)" ``` lp15@60162 ` 538` ``` "exp\Im z\" 0 z, simplified]) ``` lp15@59746 ` 539` ``` fix k x ``` lp15@59746 ` 540` ``` show "((\x. (- 1) ^ (k div 2) * (if even k then sin x else cos x)) has_field_derivative ``` lp15@59746 ` 541` ``` (- 1) ^ (Suc k div 2) * (if odd k then sin x else cos x)) ``` lp15@59746 ` 542` ``` (at x within closed_segment 0 z)" ``` lp15@59746 ` 543` ``` apply (auto simp: power_Suc) ``` lp15@59746 ` 544` ``` apply (intro derivative_eq_intros | simp)+ ``` lp15@59746 ` 545` ``` done ``` lp15@59746 ` 546` ``` next ``` lp15@59746 ` 547` ``` fix x ``` lp15@59746 ` 548` ``` assume "x \ closed_segment 0 z" ``` lp15@59746 ` 549` ``` then show "cmod ((- 1) ^ (Suc n div 2) * (if odd n then sin x else cos x)) \ exp \Im z\" ``` lp15@59746 ` 550` ``` by (auto simp: closed_segment_def norm_mult norm_power cmod_sin_le_exp cmod_cos_le_exp) ``` lp15@59862 ` 551` ``` qed ``` lp15@59746 ` 552` ``` have **: "\k. complex_of_real (sin_coeff k) * z ^ k ``` lp15@59746 ` 553` ``` = (-1)^(k div 2) * (if even k then sin 0 else cos 0) * z^k / of_nat (fact k)" ``` lp15@59746 ` 554` ``` by (auto simp: sin_coeff_def elim!: oddE) ``` lp15@59746 ` 555` ``` show ?thesis ``` lp15@59746 ` 556` ``` apply (rule order_trans [OF _ *]) ``` lp15@59746 ` 557` ``` apply (simp add: **) ``` lp15@59746 ` 558` ``` done ``` lp15@59746 ` 559` ```qed ``` lp15@59746 ` 560` lp15@59862 ` 561` ```lemma Taylor_cos: ``` lp15@59862 ` 562` ``` "norm(cos z - (\k\n. complex_of_real (cos_coeff k) * z ^ k)) ``` lp15@59746 ` 563` ``` \ exp\Im z\ * (norm z) ^ Suc n / (fact n)" ``` lp15@59746 ` 564` ```proof - ``` lp15@59746 ` 565` ``` have mono: "\u w z::real. w \ u \ z \ u \ w + z \ u*2" ``` lp15@59746 ` 566` ``` by arith ``` lp15@59746 ` 567` ``` have *: "cmod (cos z - ``` lp15@59746 ` 568` ``` (\i\n. (-1) ^ (Suc i div 2) * (if even i then cos 0 else sin 0) * z ^ i / (fact i))) ``` lp15@59862 ` 569` ``` \ exp \Im z\ * cmod z ^ Suc n / (fact n)" ``` lp15@59746 ` 570` ``` proof (rule complex_taylor [of "closed_segment 0 z" n "\k x. (-1)^(Suc k div 2) * (if even k then cos x else sin x)" "exp\Im z\" 0 z, ``` lp15@59746 ` 571` ```simplified]) ``` lp15@59746 ` 572` ``` fix k x ``` lp15@59746 ` 573` ``` assume "x \ closed_segment 0 z" "k \ n" ``` lp15@59746 ` 574` ``` show "((\x. (- 1) ^ (Suc k div 2) * (if even k then cos x else sin x)) has_field_derivative ``` lp15@59746 ` 575` ``` (- 1) ^ Suc (k div 2) * (if odd k then cos x else sin x)) ``` lp15@59746 ` 576` ``` (at x within closed_segment 0 z)" ``` lp15@59746 ` 577` ``` apply (auto simp: power_Suc) ``` lp15@59746 ` 578` ``` apply (intro derivative_eq_intros | simp)+ ``` lp15@59746 ` 579` ``` done ``` lp15@59746 ` 580` ``` next ``` lp15@59746 ` 581` ``` fix x ``` lp15@59746 ` 582` ``` assume "x \ closed_segment 0 z" ``` lp15@59746 ` 583` ``` then show "cmod ((- 1) ^ Suc (n div 2) * (if odd n then cos x else sin x)) \ exp \Im z\" ``` lp15@59746 ` 584` ``` by (auto simp: closed_segment_def norm_mult norm_power cmod_sin_le_exp cmod_cos_le_exp) ``` lp15@59862 ` 585` ``` qed ``` lp15@59746 ` 586` ``` have **: "\k. complex_of_real (cos_coeff k) * z ^ k ``` lp15@59746 ` 587` ``` = (-1)^(Suc k div 2) * (if even k then cos 0 else sin 0) * z^k / of_nat (fact k)" ``` lp15@59746 ` 588` ``` by (auto simp: cos_coeff_def elim!: evenE) ``` lp15@59746 ` 589` ``` show ?thesis ``` lp15@59746 ` 590` ``` apply (rule order_trans [OF _ *]) ``` lp15@59746 ` 591` ``` apply (simp add: **) ``` lp15@59746 ` 592` ``` done ``` lp15@59746 ` 593` ```qed ``` lp15@59746 ` 594` lp15@60162 ` 595` ```declare power_Suc [simp] ``` lp15@59746 ` 596` wenzelm@60420 ` 597` ```text\32-bit Approximation to e\ ``` wenzelm@61945 ` 598` ```lemma e_approx_32: "\exp(1) - 5837465777 / 2147483648\ \ (inverse(2 ^ 32)::real)" ``` lp15@59751 ` 599` ``` using Taylor_exp [of 1 14] exp_le ``` lp15@59751 ` 600` ``` apply (simp add: setsum_left_distrib in_Reals_norm Re_exp atMost_nat_numeral fact_numeral) ``` lp15@59751 ` 601` ``` apply (simp only: pos_le_divide_eq [symmetric], linarith) ``` lp15@59751 ` 602` ``` done ``` lp15@59751 ` 603` lp15@60017 ` 604` ```lemma e_less_3: "exp 1 < (3::real)" ``` lp15@60017 ` 605` ``` using e_approx_32 ``` nipkow@62390 ` 606` ``` by (simp add: abs_if split: if_split_asm) ``` lp15@60017 ` 607` lp15@60017 ` 608` ```lemma ln3_gt_1: "ln 3 > (1::real)" ``` lp15@60017 ` 609` ``` by (metis e_less_3 exp_less_cancel_iff exp_ln_iff less_trans ln_exp) ``` lp15@60017 ` 610` lp15@60017 ` 611` wenzelm@60420 ` 612` ```subsection\The argument of a complex number\ ``` lp15@59746 ` 613` lp15@59746 ` 614` ```definition Arg :: "complex \ real" where ``` lp15@59746 ` 615` ``` "Arg z \ if z = 0 then 0 ``` lp15@59746 ` 616` ``` else THE t. 0 \ t \ t < 2*pi \ ``` lp15@59746 ` 617` ``` z = of_real(norm z) * exp(ii * of_real t)" ``` lp15@59746 ` 618` lp15@59746 ` 619` ```lemma Arg_0 [simp]: "Arg(0) = 0" ``` lp15@59746 ` 620` ``` by (simp add: Arg_def) ``` lp15@59746 ` 621` lp15@59746 ` 622` ```lemma Arg_unique_lemma: ``` lp15@59746 ` 623` ``` assumes z: "z = of_real(norm z) * exp(ii * of_real t)" ``` lp15@59746 ` 624` ``` and z': "z = of_real(norm z) * exp(ii * of_real t')" ``` lp15@59746 ` 625` ``` and t: "0 \ t" "t < 2*pi" ``` lp15@59746 ` 626` ``` and t': "0 \ t'" "t' < 2*pi" ``` lp15@59746 ` 627` ``` and nz: "z \ 0" ``` lp15@59746 ` 628` ``` shows "t' = t" ``` lp15@59746 ` 629` ```proof - ``` lp15@59746 ` 630` ``` have [dest]: "\x y z::real. x\0 \ x+y < z \ y * of_real t') = of_real (cmod z) * exp (\ * of_real t)" ``` lp15@59746 ` 633` ``` by (metis z z') ``` lp15@59746 ` 634` ``` then have "exp (\ * of_real t') = exp (\ * of_real t)" ``` lp15@59746 ` 635` ``` by (metis nz mult_left_cancel mult_zero_left z) ``` lp15@59746 ` 636` ``` then have "sin t' = sin t \ cos t' = cos t" ``` lp15@59746 ` 637` ``` apply (simp add: exp_Euler sin_of_real cos_of_real) ``` lp15@59746 ` 638` ``` by (metis Complex_eq complex.sel) ``` lp15@61609 ` 639` ``` then obtain n::int where n: "t' = t + 2 * n * pi" ``` lp15@59746 ` 640` ``` by (auto simp: sin_cos_eq_iff) ``` lp15@59746 ` 641` ``` then have "n=0" ``` lp15@59746 ` 642` ``` apply (rule_tac z=n in int_cases) ``` lp15@59746 ` 643` ``` using t t' ``` lp15@59746 ` 644` ``` apply (auto simp: mult_less_0_iff algebra_simps) ``` lp15@59746 ` 645` ``` done ``` lp15@59746 ` 646` ``` then show "t' = t" ``` lp15@59746 ` 647` ``` by (simp add: n) ``` lp15@59746 ` 648` ```qed ``` lp15@59746 ` 649` lp15@59746 ` 650` ```lemma Arg: "0 \ Arg z & Arg z < 2*pi & z = of_real(norm z) * exp(ii * of_real(Arg z))" ``` lp15@59746 ` 651` ```proof (cases "z=0") ``` lp15@59746 ` 652` ``` case True then show ?thesis ``` lp15@59746 ` 653` ``` by (simp add: Arg_def) ``` lp15@59746 ` 654` ```next ``` lp15@59746 ` 655` ``` case False ``` lp15@59746 ` 656` ``` obtain t where t: "0 \ t" "t < 2*pi" ``` lp15@59746 ` 657` ``` and ReIm: "Re z / cmod z = cos t" "Im z / cmod z = sin t" ``` lp15@59746 ` 658` ``` using sincos_total_2pi [OF complex_unit_circle [OF False]] ``` lp15@59746 ` 659` ``` by blast ``` lp15@59746 ` 660` ``` have z: "z = of_real(norm z) * exp(ii * of_real t)" ``` lp15@59746 ` 661` ``` apply (rule complex_eqI) ``` lp15@59746 ` 662` ``` using t False ReIm ``` lp15@59746 ` 663` ``` apply (auto simp: exp_Euler sin_of_real cos_of_real divide_simps) ``` lp15@59746 ` 664` ``` done ``` lp15@59746 ` 665` ``` show ?thesis ``` lp15@59746 ` 666` ``` apply (simp add: Arg_def False) ``` lp15@59746 ` 667` ``` apply (rule theI [where a=t]) ``` lp15@59746 ` 668` ``` using t z False ``` lp15@59746 ` 669` ``` apply (auto intro: Arg_unique_lemma) ``` lp15@59746 ` 670` ``` done ``` lp15@59746 ` 671` ```qed ``` lp15@59746 ` 672` lp15@59746 ` 673` ```corollary ``` lp15@59746 ` 674` ``` shows Arg_ge_0: "0 \ Arg z" ``` lp15@59746 ` 675` ``` and Arg_lt_2pi: "Arg z < 2*pi" ``` lp15@59746 ` 676` ``` and Arg_eq: "z = of_real(norm z) * exp(ii * of_real(Arg z))" ``` lp15@59746 ` 677` ``` using Arg by auto ``` lp15@59746 ` 678` lp15@59746 ` 679` ```lemma complex_norm_eq_1_exp: "norm z = 1 \ (\t. z = exp(ii * of_real t))" ``` lp15@59746 ` 680` ``` using Arg [of z] by auto ``` lp15@59746 ` 681` lp15@59746 ` 682` ```lemma Arg_unique: "\of_real r * exp(ii * of_real a) = z; 0 < r; 0 \ a; a < 2*pi\ \ Arg z = a" ``` lp15@59746 ` 683` ``` apply (rule Arg_unique_lemma [OF _ Arg_eq]) ``` lp15@59746 ` 684` ``` using Arg [of z] ``` lp15@59746 ` 685` ``` apply (auto simp: norm_mult) ``` lp15@59746 ` 686` ``` done ``` lp15@59746 ` 687` lp15@59746 ` 688` ```lemma Arg_minus: "z \ 0 \ Arg (-z) = (if Arg z < pi then Arg z + pi else Arg z - pi)" ``` lp15@59746 ` 689` ``` apply (rule Arg_unique [of "norm z"]) ``` lp15@59746 ` 690` ``` apply (rule complex_eqI) ``` lp15@59746 ` 691` ``` using Arg_ge_0 [of z] Arg_eq [of z] Arg_lt_2pi [of z] Arg_eq [of z] ``` lp15@59746 ` 692` ``` apply auto ``` lp15@59746 ` 693` ``` apply (auto simp: Re_exp Im_exp cos_diff sin_diff cis_conv_exp [symmetric]) ``` lp15@59746 ` 694` ``` apply (metis Re_rcis Im_rcis rcis_def)+ ``` lp15@59746 ` 695` ``` done ``` lp15@59746 ` 696` lp15@59746 ` 697` ```lemma Arg_times_of_real [simp]: "0 < r \ Arg (of_real r * z) = Arg z" ``` lp15@59746 ` 698` ``` apply (cases "z=0", simp) ``` lp15@59746 ` 699` ``` apply (rule Arg_unique [of "r * norm z"]) ``` lp15@59746 ` 700` ``` using Arg ``` lp15@59746 ` 701` ``` apply auto ``` lp15@59746 ` 702` ``` done ``` lp15@59746 ` 703` lp15@59746 ` 704` ```lemma Arg_times_of_real2 [simp]: "0 < r \ Arg (z * of_real r) = Arg z" ``` lp15@59746 ` 705` ``` by (metis Arg_times_of_real mult.commute) ``` lp15@59746 ` 706` lp15@59746 ` 707` ```lemma Arg_divide_of_real [simp]: "0 < r \ Arg (z / of_real r) = Arg z" ``` lp15@59746 ` 708` ``` by (metis Arg_times_of_real2 less_numeral_extra(3) nonzero_eq_divide_eq of_real_eq_0_iff) ``` lp15@59746 ` 709` lp15@59746 ` 710` ```lemma Arg_le_pi: "Arg z \ pi \ 0 \ Im z" ``` lp15@59746 ` 711` ```proof (cases "z=0") ``` lp15@59746 ` 712` ``` case True then show ?thesis ``` lp15@59746 ` 713` ``` by simp ``` lp15@59746 ` 714` ```next ``` lp15@59746 ` 715` ``` case False ``` lp15@59746 ` 716` ``` have "0 \ Im z \ 0 \ Im (of_real (cmod z) * exp (\ * complex_of_real (Arg z)))" ``` lp15@59746 ` 717` ``` by (metis Arg_eq) ``` lp15@59746 ` 718` ``` also have "... = (0 \ Im (exp (\ * complex_of_real (Arg z))))" ``` lp15@59746 ` 719` ``` using False ``` lp15@59746 ` 720` ``` by (simp add: zero_le_mult_iff) ``` lp15@59746 ` 721` ``` also have "... \ Arg z \ pi" ``` lp15@59746 ` 722` ``` by (simp add: Im_exp) (metis Arg_ge_0 Arg_lt_2pi sin_lt_zero sin_ge_zero not_le) ``` lp15@59746 ` 723` ``` finally show ?thesis ``` lp15@59746 ` 724` ``` by blast ``` lp15@59746 ` 725` ```qed ``` lp15@59746 ` 726` lp15@59746 ` 727` ```lemma Arg_lt_pi: "0 < Arg z \ Arg z < pi \ 0 < Im z" ``` lp15@59746 ` 728` ```proof (cases "z=0") ``` lp15@59746 ` 729` ``` case True then show ?thesis ``` lp15@59746 ` 730` ``` by simp ``` lp15@59746 ` 731` ```next ``` lp15@59746 ` 732` ``` case False ``` lp15@59746 ` 733` ``` have "0 < Im z \ 0 < Im (of_real (cmod z) * exp (\ * complex_of_real (Arg z)))" ``` lp15@59746 ` 734` ``` by (metis Arg_eq) ``` lp15@59746 ` 735` ``` also have "... = (0 < Im (exp (\ * complex_of_real (Arg z))))" ``` lp15@59746 ` 736` ``` using False ``` lp15@59746 ` 737` ``` by (simp add: zero_less_mult_iff) ``` lp15@59746 ` 738` ``` also have "... \ 0 < Arg z \ Arg z < pi" ``` lp15@59746 ` 739` ``` using Arg_ge_0 Arg_lt_2pi sin_le_zero sin_gt_zero ``` lp15@59746 ` 740` ``` apply (auto simp: Im_exp) ``` lp15@59746 ` 741` ``` using le_less apply fastforce ``` lp15@59746 ` 742` ``` using not_le by blast ``` lp15@59746 ` 743` ``` finally show ?thesis ``` lp15@59746 ` 744` ``` by blast ``` lp15@59746 ` 745` ```qed ``` lp15@59746 ` 746` wenzelm@61070 ` 747` ```lemma Arg_eq_0: "Arg z = 0 \ z \ \ \ 0 \ Re z" ``` lp15@59746 ` 748` ```proof (cases "z=0") ``` lp15@59746 ` 749` ``` case True then show ?thesis ``` lp15@59746 ` 750` ``` by simp ``` lp15@59746 ` 751` ```next ``` lp15@59746 ` 752` ``` case False ``` wenzelm@61070 ` 753` ``` have "z \ \ \ 0 \ Re z \ z \ \ \ 0 \ Re (of_real (cmod z) * exp (\ * complex_of_real (Arg z)))" ``` lp15@59746 ` 754` ``` by (metis Arg_eq) ``` wenzelm@61070 ` 755` ``` also have "... \ z \ \ \ 0 \ Re (exp (\ * complex_of_real (Arg z)))" ``` lp15@59746 ` 756` ``` using False ``` lp15@59746 ` 757` ``` by (simp add: zero_le_mult_iff) ``` lp15@59746 ` 758` ``` also have "... \ Arg z = 0" ``` lp15@59746 ` 759` ``` apply (auto simp: Re_exp) ``` lp15@59746 ` 760` ``` apply (metis Arg_lt_pi Arg_ge_0 Arg_le_pi cos_pi complex_is_Real_iff leD less_linear less_minus_one_simps(2) minus_minus neg_less_eq_nonneg order_refl) ``` lp15@59746 ` 761` ``` using Arg_eq [of z] ``` lp15@59746 ` 762` ``` apply (auto simp: Reals_def) ``` lp15@59746 ` 763` ``` done ``` lp15@59746 ` 764` ``` finally show ?thesis ``` lp15@59746 ` 765` ``` by blast ``` lp15@59746 ` 766` ```qed ``` lp15@59746 ` 767` lp15@61609 ` 768` ```corollary Arg_gt_0: ``` lp15@60150 ` 769` ``` assumes "z \ \ \ Re z < 0" ``` lp15@60150 ` 770` ``` shows "Arg z > 0" ``` lp15@60150 ` 771` ``` using Arg_eq_0 Arg_ge_0 assms dual_order.strict_iff_order by fastforce ``` lp15@60150 ` 772` lp15@59746 ` 773` ```lemma Arg_of_real: "Arg(of_real x) = 0 \ 0 \ x" ``` lp15@59746 ` 774` ``` by (simp add: Arg_eq_0) ``` lp15@59746 ` 775` lp15@59746 ` 776` ```lemma Arg_eq_pi: "Arg z = pi \ z \ \ \ Re z < 0" ``` lp15@59746 ` 777` ``` apply (cases "z=0", simp) ``` lp15@59746 ` 778` ``` using Arg_eq_0 [of "-z"] ``` lp15@59746 ` 779` ``` apply (auto simp: complex_is_Real_iff Arg_minus) ``` lp15@59746 ` 780` ``` apply (simp add: complex_Re_Im_cancel_iff) ``` lp15@59746 ` 781` ``` apply (metis Arg_minus pi_gt_zero add.left_neutral minus_minus minus_zero) ``` lp15@59746 ` 782` ``` done ``` lp15@59746 ` 783` lp15@59746 ` 784` ```lemma Arg_eq_0_pi: "Arg z = 0 \ Arg z = pi \ z \ \" ``` lp15@59746 ` 785` ``` using Arg_eq_0 Arg_eq_pi not_le by auto ``` lp15@59746 ` 786` lp15@59746 ` 787` ```lemma Arg_inverse: "Arg(inverse z) = (if z \ \ \ 0 \ Re z then Arg z else 2*pi - Arg z)" ``` lp15@59746 ` 788` ``` apply (cases "z=0", simp) ``` lp15@59746 ` 789` ``` apply (rule Arg_unique [of "inverse (norm z)"]) ``` lp15@61762 ` 790` ``` using Arg_ge_0 [of z] Arg_lt_2pi [of z] Arg_eq [of z] Arg_eq_0 [of z] exp_two_pi_i ``` lp15@59746 ` 791` ``` apply (auto simp: of_real_numeral algebra_simps exp_diff divide_simps) ``` lp15@59746 ` 792` ``` done ``` lp15@59746 ` 793` lp15@59746 ` 794` ```lemma Arg_eq_iff: ``` lp15@59746 ` 795` ``` assumes "w \ 0" "z \ 0" ``` lp15@59746 ` 796` ``` shows "Arg w = Arg z \ (\x. 0 < x & w = of_real x * z)" ``` lp15@59746 ` 797` ``` using assms Arg_eq [of z] Arg_eq [of w] ``` lp15@59746 ` 798` ``` apply auto ``` lp15@59746 ` 799` ``` apply (rule_tac x="norm w / norm z" in exI) ``` lp15@59746 ` 800` ``` apply (simp add: divide_simps) ``` lp15@59746 ` 801` ``` by (metis mult.commute mult.left_commute) ``` lp15@59746 ` 802` lp15@59746 ` 803` ```lemma Arg_inverse_eq_0: "Arg(inverse z) = 0 \ Arg z = 0" ``` lp15@59746 ` 804` ``` using complex_is_Real_iff ``` lp15@59746 ` 805` ``` apply (simp add: Arg_eq_0) ``` lp15@59746 ` 806` ``` apply (auto simp: divide_simps not_sum_power2_lt_zero) ``` lp15@59746 ` 807` ``` done ``` lp15@59746 ` 808` lp15@59746 ` 809` ```lemma Arg_divide: ``` lp15@59746 ` 810` ``` assumes "w \ 0" "z \ 0" "Arg w \ Arg z" ``` lp15@59746 ` 811` ``` shows "Arg(z / w) = Arg z - Arg w" ``` lp15@59746 ` 812` ``` apply (rule Arg_unique [of "norm(z / w)"]) ``` lp15@59746 ` 813` ``` using assms Arg_eq [of z] Arg_eq [of w] Arg_ge_0 [of w] Arg_lt_2pi [of z] ``` lp15@59746 ` 814` ``` apply (auto simp: exp_diff norm_divide algebra_simps divide_simps) ``` lp15@59746 ` 815` ``` done ``` lp15@59746 ` 816` lp15@59746 ` 817` ```lemma Arg_le_div_sum: ``` lp15@59746 ` 818` ``` assumes "w \ 0" "z \ 0" "Arg w \ Arg z" ``` lp15@59746 ` 819` ``` shows "Arg z = Arg w + Arg(z / w)" ``` lp15@59746 ` 820` ``` by (simp add: Arg_divide assms) ``` lp15@59746 ` 821` lp15@59746 ` 822` ```lemma Arg_le_div_sum_eq: ``` lp15@59746 ` 823` ``` assumes "w \ 0" "z \ 0" ``` lp15@59746 ` 824` ``` shows "Arg w \ Arg z \ Arg z = Arg w + Arg(z / w)" ``` lp15@59746 ` 825` ``` using assms ``` lp15@59746 ` 826` ``` by (auto simp: Arg_ge_0 intro: Arg_le_div_sum) ``` lp15@59746 ` 827` lp15@59746 ` 828` ```lemma Arg_diff: ``` lp15@59746 ` 829` ``` assumes "w \ 0" "z \ 0" ``` lp15@59746 ` 830` ``` shows "Arg w - Arg z = (if Arg z \ Arg w then Arg(w / z) else Arg(w/z) - 2*pi)" ``` lp15@59746 ` 831` ``` using assms ``` lp15@59746 ` 832` ``` apply (auto simp: Arg_ge_0 Arg_divide not_le) ``` lp15@59746 ` 833` ``` using Arg_divide [of w z] Arg_inverse [of "w/z"] ``` lp15@59746 ` 834` ``` apply auto ``` lp15@59746 ` 835` ``` by (metis Arg_eq_0 less_irrefl minus_diff_eq right_minus_eq) ``` lp15@59746 ` 836` lp15@59746 ` 837` ```lemma Arg_add: ``` lp15@59746 ` 838` ``` assumes "w \ 0" "z \ 0" ``` lp15@59746 ` 839` ``` shows "Arg w + Arg z = (if Arg w + Arg z < 2*pi then Arg(w * z) else Arg(w * z) + 2*pi)" ``` lp15@59746 ` 840` ``` using assms ``` lp15@59746 ` 841` ``` using Arg_diff [of "w*z" z] Arg_le_div_sum_eq [of z "w*z"] ``` lp15@59746 ` 842` ``` apply (auto simp: Arg_ge_0 Arg_divide not_le) ``` lp15@59746 ` 843` ``` apply (metis Arg_lt_2pi add.commute) ``` lp15@59746 ` 844` ``` apply (metis (no_types) Arg add.commute diff_0 diff_add_cancel diff_less_eq diff_minus_eq_add not_less) ``` lp15@59746 ` 845` ``` done ``` lp15@59746 ` 846` lp15@59746 ` 847` ```lemma Arg_times: ``` lp15@59746 ` 848` ``` assumes "w \ 0" "z \ 0" ``` lp15@59746 ` 849` ``` shows "Arg (w * z) = (if Arg w + Arg z < 2*pi then Arg w + Arg z ``` lp15@59746 ` 850` ``` else (Arg w + Arg z) - 2*pi)" ``` lp15@59746 ` 851` ``` using Arg_add [OF assms] ``` lp15@59746 ` 852` ``` by auto ``` lp15@59746 ` 853` lp15@59746 ` 854` ```lemma Arg_cnj: "Arg(cnj z) = (if z \ \ \ 0 \ Re z then Arg z else 2*pi - Arg z)" ``` lp15@59746 ` 855` ``` apply (cases "z=0", simp) ``` lp15@59746 ` 856` ``` apply (rule trans [of _ "Arg(inverse z)"]) ``` lp15@59746 ` 857` ``` apply (simp add: Arg_eq_iff divide_simps complex_norm_square [symmetric] mult.commute) ``` lp15@59746 ` 858` ``` apply (metis norm_eq_zero of_real_power zero_less_power2) ``` lp15@59746 ` 859` ``` apply (auto simp: of_real_numeral Arg_inverse) ``` lp15@59746 ` 860` ``` done ``` lp15@59746 ` 861` lp15@59746 ` 862` ```lemma Arg_real: "z \ \ \ Arg z = (if 0 \ Re z then 0 else pi)" ``` lp15@59746 ` 863` ``` using Arg_eq_0 Arg_eq_0_pi ``` lp15@59746 ` 864` ``` by auto ``` lp15@59746 ` 865` lp15@59746 ` 866` ```lemma Arg_exp: "0 \ Im z \ Im z < 2*pi \ Arg(exp z) = Im z" ``` lp15@61762 ` 867` ``` by (rule Arg_unique [of "exp(Re z)"]) (auto simp: exp_eq_polar) ``` lp15@61762 ` 868` lp15@61762 ` 869` ```lemma complex_split_polar: ``` lp15@61762 ` 870` ``` obtains r a::real where "z = complex_of_real r * (cos a + \ * sin a)" "0 \ r" "0 \ a" "a < 2*pi" ``` lp15@61762 ` 871` ``` using Arg cis.ctr cis_conv_exp by fastforce ``` lp15@59751 ` 872` lp15@61806 ` 873` ```lemma Re_Im_le_cmod: "Im w * sin \ + Re w * cos \ \ cmod w" ``` lp15@61806 ` 874` ```proof (cases w rule: complex_split_polar) ``` lp15@61806 ` 875` ``` case (1 r a) with sin_cos_le1 [of a \] show ?thesis ``` lp15@61806 ` 876` ``` apply (simp add: norm_mult cmod_unit_one) ``` lp15@61806 ` 877` ``` by (metis (no_types, hide_lams) abs_le_D1 distrib_left mult.commute mult.left_commute mult_left_le) ``` lp15@61806 ` 878` ```qed ``` lp15@61806 ` 879` wenzelm@60420 ` 880` ```subsection\Analytic properties of tangent function\ ``` lp15@59751 ` 881` lp15@59751 ` 882` ```lemma cnj_tan: "cnj(tan z) = tan(cnj z)" ``` lp15@59751 ` 883` ``` by (simp add: cnj_cos cnj_sin tan_def) ``` lp15@59751 ` 884` lp15@62534 ` 885` ```lemma field_differentiable_at_tan: "~(cos z = 0) \ tan field_differentiable at z" ``` lp15@62534 ` 886` ``` unfolding field_differentiable_def ``` lp15@59751 ` 887` ``` using DERIV_tan by blast ``` lp15@59751 ` 888` lp15@62534 ` 889` ```lemma field_differentiable_within_tan: "~(cos z = 0) ``` lp15@62534 ` 890` ``` \ tan field_differentiable (at z within s)" ``` lp15@62534 ` 891` ``` using field_differentiable_at_tan field_differentiable_at_within by blast ``` lp15@59751 ` 892` lp15@59751 ` 893` ```lemma continuous_within_tan: "~(cos z = 0) \ continuous (at z within s) tan" ``` lp15@59751 ` 894` ``` using continuous_at_imp_continuous_within isCont_tan by blast ``` lp15@59751 ` 895` lp15@59751 ` 896` ```lemma continuous_on_tan [continuous_intros]: "(\z. z \ s \ ~(cos z = 0)) \ continuous_on s tan" ``` lp15@59751 ` 897` ``` by (simp add: continuous_at_imp_continuous_on) ``` lp15@59751 ` 898` lp15@59751 ` 899` ```lemma holomorphic_on_tan: "(\z. z \ s \ ~(cos z = 0)) \ tan holomorphic_on s" ``` lp15@62534 ` 900` ``` by (simp add: field_differentiable_within_tan holomorphic_on_def) ``` lp15@59751 ` 901` lp15@59751 ` 902` wenzelm@60420 ` 903` ```subsection\Complex logarithms (the conventional principal value)\ ``` lp15@59751 ` 904` lp15@60020 ` 905` ```instantiation complex :: ln ``` lp15@60020 ` 906` ```begin ``` lp15@60017 ` 907` lp15@60020 ` 908` ```definition ln_complex :: "complex \ complex" ``` lp15@60020 ` 909` ``` where "ln_complex \ \z. THE w. exp w = z & -pi < Im(w) & Im(w) \ pi" ``` lp15@59751 ` 910` lp15@59751 ` 911` ```lemma ``` lp15@59751 ` 912` ``` assumes "z \ 0" ``` lp15@60020 ` 913` ``` shows exp_Ln [simp]: "exp(ln z) = z" ``` lp15@60020 ` 914` ``` and mpi_less_Im_Ln: "-pi < Im(ln z)" ``` lp15@60020 ` 915` ``` and Im_Ln_le_pi: "Im(ln z) \ pi" ``` lp15@59751 ` 916` ```proof - ``` lp15@59751 ` 917` ``` obtain \ where z: "z / (cmod z) = Complex (cos \) (sin \)" ``` lp15@59751 ` 918` ``` using complex_unimodular_polar [of "z / (norm z)"] assms ``` lp15@59751 ` 919` ``` by (auto simp: norm_divide divide_simps) ``` lp15@59751 ` 920` ``` obtain \ where \: "- pi < \" "\ \ pi" "sin \ = sin \" "cos \ = cos \" ``` lp15@59751 ` 921` ``` using sincos_principal_value [of "\"] assms ``` lp15@59751 ` 922` ``` by (auto simp: norm_divide divide_simps) ``` lp15@60020 ` 923` ``` have "exp(ln z) = z & -pi < Im(ln z) & Im(ln z) \ pi" unfolding ln_complex_def ``` lp15@59751 ` 924` ``` apply (rule theI [where a = "Complex (ln(norm z)) \"]) ``` lp15@59751 ` 925` ``` using z assms \ ``` lp15@61762 ` 926` ``` apply (auto simp: field_simps exp_complex_eqI exp_eq_polar cis.code) ``` lp15@59751 ` 927` ``` done ``` lp15@60020 ` 928` ``` then show "exp(ln z) = z" "-pi < Im(ln z)" "Im(ln z) \ pi" ``` lp15@59751 ` 929` ``` by auto ``` lp15@59751 ` 930` ```qed ``` lp15@59751 ` 931` lp15@59751 ` 932` ```lemma Ln_exp [simp]: ``` lp15@59751 ` 933` ``` assumes "-pi < Im(z)" "Im(z) \ pi" ``` lp15@60020 ` 934` ``` shows "ln(exp z) = z" ``` lp15@59751 ` 935` ``` apply (rule exp_complex_eqI) ``` lp15@59751 ` 936` ``` using assms mpi_less_Im_Ln [of "exp z"] Im_Ln_le_pi [of "exp z"] ``` lp15@59751 ` 937` ``` apply auto ``` lp15@59751 ` 938` ``` done ``` lp15@59751 ` 939` wenzelm@60420 ` 940` ```subsection\Relation to Real Logarithm\ ``` lp15@60020 ` 941` lp15@60020 ` 942` ```lemma Ln_of_real: ``` lp15@60020 ` 943` ``` assumes "0 < z" ``` lp15@60020 ` 944` ``` shows "ln(of_real z::complex) = of_real(ln z)" ``` lp15@60020 ` 945` ```proof - ``` lp15@60020 ` 946` ``` have "ln(of_real (exp (ln z))::complex) = ln (exp (of_real (ln z)))" ``` lp15@60020 ` 947` ``` by (simp add: exp_of_real) ``` lp15@60020 ` 948` ``` also have "... = of_real(ln z)" ``` lp15@60020 ` 949` ``` using assms ``` lp15@60020 ` 950` ``` by (subst Ln_exp) auto ``` lp15@60020 ` 951` ``` finally show ?thesis ``` lp15@60020 ` 952` ``` using assms by simp ``` lp15@60020 ` 953` ```qed ``` lp15@60020 ` 954` lp15@60020 ` 955` ```corollary Ln_in_Reals [simp]: "z \ \ \ Re z > 0 \ ln z \ \" ``` lp15@60020 ` 956` ``` by (auto simp: Ln_of_real elim: Reals_cases) ``` lp15@60020 ` 957` lp15@60150 ` 958` ```corollary Im_Ln_of_real [simp]: "r > 0 \ Im (ln (of_real r)) = 0" ``` lp15@60150 ` 959` ``` by (simp add: Ln_of_real) ``` lp15@60150 ` 960` wenzelm@61070 ` 961` ```lemma cmod_Ln_Reals [simp]: "z \ \ \ 0 < Re z \ cmod (ln z) = norm (ln (Re z))" ``` lp15@60150 ` 962` ``` using Ln_of_real by force ``` lp15@60150 ` 963` lp15@60020 ` 964` ```lemma Ln_1: "ln 1 = (0::complex)" ``` lp15@60020 ` 965` ```proof - ``` lp15@60020 ` 966` ``` have "ln (exp 0) = (0::complex)" ``` lp15@60020 ` 967` ``` by (metis (mono_tags, hide_lams) Ln_of_real exp_zero ln_one of_real_0 of_real_1 zero_less_one) ``` lp15@60020 ` 968` ``` then show ?thesis ``` lp15@60020 ` 969` ``` by simp ``` lp15@60020 ` 970` ```qed ``` lp15@60020 ` 971` lp15@60020 ` 972` ```instance ``` lp15@60020 ` 973` ``` by intro_classes (rule ln_complex_def Ln_1) ``` lp15@60020 ` 974` lp15@60020 ` 975` ```end ``` lp15@60020 ` 976` lp15@60020 ` 977` ```abbreviation Ln :: "complex \ complex" ``` lp15@60020 ` 978` ``` where "Ln \ ln" ``` lp15@60020 ` 979` lp15@59751 ` 980` ```lemma Ln_eq_iff: "w \ 0 \ z \ 0 \ (Ln w = Ln z \ w = z)" ``` lp15@59751 ` 981` ``` by (metis exp_Ln) ``` lp15@59751 ` 982` lp15@59751 ` 983` ```lemma Ln_unique: "exp(z) = w \ -pi < Im(z) \ Im(z) \ pi \ Ln w = z" ``` lp15@59751 ` 984` ``` using Ln_exp by blast ``` lp15@59751 ` 985` lp15@59751 ` 986` ```lemma Re_Ln [simp]: "z \ 0 \ Re(Ln z) = ln(norm z)" ``` wenzelm@63092 ` 987` ``` by (metis exp_Ln ln_exp norm_exp_eq_Re) ``` lp15@60150 ` 988` lp15@61609 ` 989` ```corollary ln_cmod_le: ``` lp15@60150 ` 990` ``` assumes z: "z \ 0" ``` lp15@60150 ` 991` ``` shows "ln (cmod z) \ cmod (Ln z)" ``` lp15@60150 ` 992` ``` using norm_exp [of "Ln z", simplified exp_Ln [OF z]] ``` lp15@60150 ` 993` ``` by (metis Re_Ln complex_Re_le_cmod z) ``` lp15@59751 ` 994` lp15@62843 ` 995` ```proposition exists_complex_root: ``` lp15@62843 ` 996` ``` fixes z :: complex ``` lp15@62843 ` 997` ``` assumes "n \ 0" obtains w where "z = w ^ n" ``` lp15@62843 ` 998` ``` apply (cases "z=0") ``` lp15@62843 ` 999` ``` using assms apply (simp add: power_0_left) ``` lp15@62843 ` 1000` ``` apply (rule_tac w = "exp(Ln z / n)" in that) ``` lp15@62843 ` 1001` ``` apply (auto simp: assms exp_of_nat_mult [symmetric]) ``` lp15@59751 ` 1002` ``` done ``` lp15@59751 ` 1003` lp15@62843 ` 1004` ```corollary exists_complex_root_nonzero: ``` lp15@62843 ` 1005` ``` fixes z::complex ``` lp15@62843 ` 1006` ``` assumes "z \ 0" "n \ 0" ``` lp15@62843 ` 1007` ``` obtains w where "w \ 0" "z = w ^ n" ``` lp15@62843 ` 1008` ``` by (metis exists_complex_root [of n z] assms power_0_left) ``` lp15@62843 ` 1009` wenzelm@60420 ` 1010` ```subsection\The Unwinding Number and the Ln-product Formula\ ``` wenzelm@60420 ` 1011` wenzelm@60420 ` 1012` ```text\Note that in this special case the unwinding number is -1, 0 or 1.\ ``` lp15@59862 ` 1013` lp15@59862 ` 1014` ```definition unwinding :: "complex \ complex" where ``` lp15@59862 ` 1015` ``` "unwinding(z) = (z - Ln(exp z)) / (of_real(2*pi) * ii)" ``` lp15@59862 ` 1016` lp15@59862 ` 1017` ```lemma unwinding_2pi: "(2*pi) * ii * unwinding(z) = z - Ln(exp z)" ``` lp15@59862 ` 1018` ``` by (simp add: unwinding_def) ``` lp15@59862 ` 1019` lp15@59862 ` 1020` ```lemma Ln_times_unwinding: ``` lp15@59862 ` 1021` ``` "w \ 0 \ z \ 0 \ Ln(w * z) = Ln(w) + Ln(z) - (2*pi) * ii * unwinding(Ln w + Ln z)" ``` lp15@59862 ` 1022` ``` using unwinding_2pi by (simp add: exp_add) ``` lp15@59862 ` 1023` lp15@59862 ` 1024` wenzelm@60420 ` 1025` ```subsection\Derivative of Ln away from the branch cut\ ``` lp15@59751 ` 1026` lp15@59751 ` 1027` ```lemma ``` paulson@62131 ` 1028` ``` assumes "z \ \\<^sub>\\<^sub>0" ``` lp15@59751 ` 1029` ``` shows has_field_derivative_Ln: "(Ln has_field_derivative inverse(z)) (at z)" ``` lp15@59751 ` 1030` ``` and Im_Ln_less_pi: "Im (Ln z) < pi" ``` lp15@59751 ` 1031` ```proof - ``` lp15@59751 ` 1032` ``` have znz: "z \ 0" ``` lp15@59751 ` 1033` ``` using assms by auto ``` paulson@62131 ` 1034` ``` then have "Im (Ln z) \ pi" ``` paulson@62131 ` 1035` ``` by (metis (no_types) Im_exp Ln_in_Reals assms complex_nonpos_Reals_iff complex_is_Real_iff exp_Ln mult_zero_right not_less pi_neq_zero sin_pi znz) ``` paulson@62131 ` 1036` ``` then show *: "Im (Ln z) < pi" using assms Im_Ln_le_pi ``` paulson@62131 ` 1037` ``` by (simp add: le_neq_trans znz) ``` lp15@62534 ` 1038` ``` have "(exp has_field_derivative z) (at (Ln z))" ``` lp15@62534 ` 1039` ``` by (metis znz DERIV_exp exp_Ln) ``` lp15@62534 ` 1040` ``` then show "(Ln has_field_derivative inverse(z)) (at z)" ``` lp15@59751 ` 1041` ``` apply (rule has_complex_derivative_inverse_strong_x ``` lp15@62534 ` 1042` ``` [where s = "{w. -pi < Im(w) \ Im(w) < pi}"]) ``` lp15@59751 ` 1043` ``` using znz * ``` lp15@62534 ` 1044` ``` apply (auto simp: Transcendental.continuous_on_exp [OF continuous_on_id] open_Collect_conj open_halfspace_Im_gt open_halfspace_Im_lt mpi_less_Im_Ln) ``` lp15@59751 ` 1045` ``` done ``` lp15@59751 ` 1046` ```qed ``` lp15@59751 ` 1047` lp15@59751 ` 1048` ```declare has_field_derivative_Ln [derivative_intros] ``` lp15@59751 ` 1049` ```declare has_field_derivative_Ln [THEN DERIV_chain2, derivative_intros] ``` lp15@59751 ` 1050` lp15@62534 ` 1051` ```lemma field_differentiable_at_Ln: "z \ \\<^sub>\\<^sub>0 \ Ln field_differentiable at z" ``` lp15@62534 ` 1052` ``` using field_differentiable_def has_field_derivative_Ln by blast ``` lp15@62534 ` 1053` lp15@62534 ` 1054` ```lemma field_differentiable_within_Ln: "z \ \\<^sub>\\<^sub>0 ``` lp15@62534 ` 1055` ``` \ Ln field_differentiable (at z within s)" ``` lp15@62534 ` 1056` ``` using field_differentiable_at_Ln field_differentiable_within_subset by blast ``` lp15@59751 ` 1057` paulson@62131 ` 1058` ```lemma continuous_at_Ln: "z \ \\<^sub>\\<^sub>0 \ continuous (at z) Ln" ``` lp15@62534 ` 1059` ``` by (simp add: field_differentiable_imp_continuous_at field_differentiable_within_Ln) ``` lp15@59751 ` 1060` lp15@59862 ` 1061` ```lemma isCont_Ln' [simp]: ``` paulson@62131 ` 1062` ``` "\isCont f z; f z \ \\<^sub>\\<^sub>0\ \ isCont (\x. Ln (f x)) z" ``` lp15@59862 ` 1063` ``` by (blast intro: isCont_o2 [OF _ continuous_at_Ln]) ``` lp15@59862 ` 1064` paulson@62131 ` 1065` ```lemma continuous_within_Ln: "z \ \\<^sub>\\<^sub>0 \ continuous (at z within s) Ln" ``` lp15@59751 ` 1066` ``` using continuous_at_Ln continuous_at_imp_continuous_within by blast ``` lp15@59751 ` 1067` paulson@62131 ` 1068` ```lemma continuous_on_Ln [continuous_intros]: "(\z. z \ s \ z \ \\<^sub>\\<^sub>0) \ continuous_on s Ln" ``` lp15@59751 ` 1069` ``` by (simp add: continuous_at_imp_continuous_on continuous_within_Ln) ``` lp15@59751 ` 1070` paulson@62131 ` 1071` ```lemma holomorphic_on_Ln: "(\z. z \ s \ z \ \\<^sub>\\<^sub>0) \ Ln holomorphic_on s" ``` lp15@62534 ` 1072` ``` by (simp add: field_differentiable_within_Ln holomorphic_on_def) ``` lp15@59751 ` 1073` lp15@59751 ` 1074` wenzelm@60420 ` 1075` ```subsection\Quadrant-type results for Ln\ ``` lp15@59751 ` 1076` lp15@59751 ` 1077` ```lemma cos_lt_zero_pi: "pi/2 < x \ x < 3*pi/2 \ cos x < 0" ``` lp15@59751 ` 1078` ``` using cos_minus_pi cos_gt_zero_pi [of "x-pi"] ``` lp15@59751 ` 1079` ``` by simp ``` lp15@59751 ` 1080` lp15@59751 ` 1081` ```lemma Re_Ln_pos_lt: ``` lp15@59751 ` 1082` ``` assumes "z \ 0" ``` wenzelm@61945 ` 1083` ``` shows "\Im(Ln z)\ < pi/2 \ 0 < Re(z)" ``` lp15@59751 ` 1084` ```proof - ``` lp15@59751 ` 1085` ``` { fix w ``` lp15@59751 ` 1086` ``` assume "w = Ln z" ``` lp15@59751 ` 1087` ``` then have w: "Im w \ pi" "- pi < Im w" ``` lp15@59751 ` 1088` ``` using Im_Ln_le_pi [of z] mpi_less_Im_Ln [of z] assms ``` lp15@59751 ` 1089` ``` by auto ``` wenzelm@61945 ` 1090` ``` then have "\Im w\ < pi/2 \ 0 < Re(exp w)" ``` lp15@59751 ` 1091` ``` apply (auto simp: Re_exp zero_less_mult_iff cos_gt_zero_pi) ``` lp15@59751 ` 1092` ``` using cos_lt_zero_pi [of "-(Im w)"] cos_lt_zero_pi [of "(Im w)"] ``` nipkow@62390 ` 1093` ``` apply (simp add: abs_if split: if_split_asm) ``` lp15@59751 ` 1094` ``` apply (metis (no_types) cos_minus cos_pi_half eq_divide_eq_numeral1(1) eq_numeral_simps(4) ``` lp15@59751 ` 1095` ``` less_numeral_extra(3) linorder_neqE_linordered_idom minus_mult_minus minus_mult_right ``` lp15@59751 ` 1096` ``` mult_numeral_1_right) ``` lp15@59751 ` 1097` ``` done ``` lp15@59751 ` 1098` ``` } ``` lp15@59751 ` 1099` ``` then show ?thesis using assms ``` lp15@59751 ` 1100` ``` by auto ``` lp15@59751 ` 1101` ```qed ``` lp15@59751 ` 1102` lp15@59751 ` 1103` ```lemma Re_Ln_pos_le: ``` lp15@59751 ` 1104` ``` assumes "z \ 0" ``` wenzelm@61945 ` 1105` ``` shows "\Im(Ln z)\ \ pi/2 \ 0 \ Re(z)" ``` lp15@59751 ` 1106` ```proof - ``` lp15@59751 ` 1107` ``` { fix w ``` lp15@59751 ` 1108` ``` assume "w = Ln z" ``` lp15@59751 ` 1109` ``` then have w: "Im w \ pi" "- pi < Im w" ``` lp15@59751 ` 1110` ``` using Im_Ln_le_pi [of z] mpi_less_Im_Ln [of z] assms ``` lp15@59751 ` 1111` ``` by auto ``` wenzelm@61945 ` 1112` ``` then have "\Im w\ \ pi/2 \ 0 \ Re(exp w)" ``` lp15@59751 ` 1113` ``` apply (auto simp: Re_exp zero_le_mult_iff cos_ge_zero) ``` lp15@59751 ` 1114` ``` using cos_lt_zero_pi [of "- (Im w)"] cos_lt_zero_pi [of "(Im w)"] not_le ``` nipkow@62390 ` 1115` ``` apply (auto simp: abs_if split: if_split_asm) ``` lp15@59751 ` 1116` ``` done ``` lp15@59751 ` 1117` ``` } ``` lp15@59751 ` 1118` ``` then show ?thesis using assms ``` lp15@59751 ` 1119` ``` by auto ``` lp15@59751 ` 1120` ```qed ``` lp15@59751 ` 1121` lp15@59751 ` 1122` ```lemma Im_Ln_pos_lt: ``` lp15@59751 ` 1123` ``` assumes "z \ 0" ``` lp15@59751 ` 1124` ``` shows "0 < Im(Ln z) \ Im(Ln z) < pi \ 0 < Im(z)" ``` lp15@59751 ` 1125` ```proof - ``` lp15@59751 ` 1126` ``` { fix w ``` lp15@59751 ` 1127` ``` assume "w = Ln z" ``` lp15@59751 ` 1128` ``` then have w: "Im w \ pi" "- pi < Im w" ``` lp15@59751 ` 1129` ``` using Im_Ln_le_pi [of z] mpi_less_Im_Ln [of z] assms ``` lp15@59751 ` 1130` ``` by auto ``` lp15@59751 ` 1131` ``` then have "0 < Im w \ Im w < pi \ 0 < Im(exp w)" ``` lp15@59751 ` 1132` ``` using sin_gt_zero [of "- (Im w)"] sin_gt_zero [of "(Im w)"] ``` lp15@59751 ` 1133` ``` apply (auto simp: Im_exp zero_less_mult_iff) ``` lp15@59751 ` 1134` ``` using less_linear apply fastforce ``` lp15@59751 ` 1135` ``` using less_linear apply fastforce ``` lp15@59751 ` 1136` ``` done ``` lp15@59751 ` 1137` ``` } ``` lp15@59751 ` 1138` ``` then show ?thesis using assms ``` lp15@59751 ` 1139` ``` by auto ``` lp15@59751 ` 1140` ```qed ``` lp15@59751 ` 1141` lp15@59751 ` 1142` ```lemma Im_Ln_pos_le: ``` lp15@59751 ` 1143` ``` assumes "z \ 0" ``` lp15@59751 ` 1144` ``` shows "0 \ Im(Ln z) \ Im(Ln z) \ pi \ 0 \ Im(z)" ``` lp15@59751 ` 1145` ```proof - ``` lp15@59751 ` 1146` ``` { fix w ``` lp15@59751 ` 1147` ``` assume "w = Ln z" ``` lp15@59751 ` 1148` ``` then have w: "Im w \ pi" "- pi < Im w" ``` lp15@59751 ` 1149` ``` using Im_Ln_le_pi [of z] mpi_less_Im_Ln [of z] assms ``` lp15@59751 ` 1150` ``` by auto ``` lp15@59751 ` 1151` ``` then have "0 \ Im w \ Im w \ pi \ 0 \ Im(exp w)" ``` lp15@59751 ` 1152` ``` using sin_ge_zero [of "- (Im w)"] sin_ge_zero [of "(Im w)"] ``` lp15@59751 ` 1153` ``` apply (auto simp: Im_exp zero_le_mult_iff sin_ge_zero) ``` lp15@59751 ` 1154` ``` apply (metis not_le not_less_iff_gr_or_eq pi_not_less_zero sin_eq_0_pi) ``` lp15@59751 ` 1155` ``` done } ``` lp15@59751 ` 1156` ``` then show ?thesis using assms ``` lp15@59751 ` 1157` ``` by auto ``` lp15@59751 ` 1158` ```qed ``` lp15@59751 ` 1159` wenzelm@61945 ` 1160` ```lemma Re_Ln_pos_lt_imp: "0 < Re(z) \ \Im(Ln z)\ < pi/2" ``` lp15@59751 ` 1161` ``` by (metis Re_Ln_pos_lt less_irrefl zero_complex.simps(1)) ``` lp15@59751 ` 1162` lp15@59751 ` 1163` ```lemma Im_Ln_pos_lt_imp: "0 < Im(z) \ 0 < Im(Ln z) \ Im(Ln z) < pi" ``` lp15@59751 ` 1164` ``` by (metis Im_Ln_pos_lt not_le order_refl zero_complex.simps(2)) ``` lp15@59751 ` 1165` paulson@62131 ` 1166` ```text\A reference to the set of positive real numbers\ ``` lp15@59751 ` 1167` ```lemma Im_Ln_eq_0: "z \ 0 \ (Im(Ln z) = 0 \ 0 < Re(z) \ Im(z) = 0)" ``` lp15@62534 ` 1168` ```by (metis Im_complex_of_real Im_exp Ln_in_Reals Re_Ln_pos_lt Re_Ln_pos_lt_imp ``` paulson@62131 ` 1169` ``` Re_complex_of_real complex_is_Real_iff exp_Ln exp_of_real pi_gt_zero) ``` lp15@59751 ` 1170` lp15@59751 ` 1171` ```lemma Im_Ln_eq_pi: "z \ 0 \ (Im(Ln z) = pi \ Re(z) < 0 \ Im(z) = 0)" ``` lp15@62534 ` 1172` ```by (metis Im_Ln_eq_0 Im_Ln_pos_le Im_Ln_pos_lt add.left_neutral complex_eq less_eq_real_def ``` paulson@62131 ` 1173` ``` mult_zero_right not_less_iff_gr_or_eq pi_ge_zero pi_neq_zero rcis_zero_arg rcis_zero_mod) ``` lp15@59751 ` 1174` lp15@59751 ` 1175` wenzelm@60420 ` 1176` ```subsection\More Properties of Ln\ ``` lp15@59751 ` 1177` paulson@62131 ` 1178` ```lemma cnj_Ln: "z \ \\<^sub>\\<^sub>0 \ cnj(Ln z) = Ln(cnj z)" ``` lp15@59751 ` 1179` ``` apply (cases "z=0", auto) ``` lp15@59751 ` 1180` ``` apply (rule exp_complex_eqI) ``` nipkow@62390 ` 1181` ``` apply (auto simp: abs_if split: if_split_asm) ``` paulson@62131 ` 1182` ``` using Im_Ln_less_pi Im_Ln_le_pi apply force ``` lp15@62534 ` 1183` ``` apply (metis complex_cnj_zero_iff diff_minus_eq_add diff_strict_mono minus_less_iff ``` paulson@62131 ` 1184` ``` mpi_less_Im_Ln mult.commute mult_2_right) ``` lp15@59751 ` 1185` ``` by (metis exp_Ln exp_cnj) ``` lp15@59751 ` 1186` paulson@62131 ` 1187` ```lemma Ln_inverse: "z \ \\<^sub>\\<^sub>0 \ Ln(inverse z) = -(Ln z)" ``` lp15@59751 ` 1188` ``` apply (cases "z=0", auto) ``` lp15@59751 ` 1189` ``` apply (rule exp_complex_eqI) ``` lp15@59751 ` 1190` ``` using mpi_less_Im_Ln [of z] mpi_less_Im_Ln [of "inverse z"] ``` nipkow@62390 ` 1191` ``` apply (auto simp: abs_if exp_minus split: if_split_asm) ``` paulson@62131 ` 1192` ``` apply (metis Im_Ln_less_pi Im_Ln_le_pi add.commute add_mono_thms_linordered_field(3) inverse_nonzero_iff_nonzero mult_2) ``` lp15@59751 ` 1193` ``` done ``` lp15@59751 ` 1194` lp15@59751 ` 1195` ```lemma Ln_minus1 [simp]: "Ln(-1) = ii * pi" ``` lp15@59751 ` 1196` ``` apply (rule exp_complex_eqI) ``` lp15@59751 ` 1197` ``` using Im_Ln_le_pi [of "-1"] mpi_less_Im_Ln [of "-1"] cis_conv_exp cis_pi ``` lp15@59751 ` 1198` ``` apply (auto simp: abs_if) ``` lp15@59751 ` 1199` ``` done ``` lp15@59751 ` 1200` lp15@59751 ` 1201` ```lemma Ln_ii [simp]: "Ln ii = ii * of_real pi/2" ``` lp15@59751 ` 1202` ``` using Ln_exp [of "ii * (of_real pi/2)"] ``` lp15@59751 ` 1203` ``` unfolding exp_Euler ``` lp15@59751 ` 1204` ``` by simp ``` lp15@59751 ` 1205` lp15@59751 ` 1206` ```lemma Ln_minus_ii [simp]: "Ln(-ii) = - (ii * pi/2)" ``` lp15@59751 ` 1207` ```proof - ``` paulson@62131 ` 1208` ``` have "Ln(-ii) = Ln(inverse ii)" by simp ``` paulson@62131 ` 1209` ``` also have "... = - (Ln ii)" using Ln_inverse by blast ``` paulson@62131 ` 1210` ``` also have "... = - (ii * pi/2)" by simp ``` lp15@59751 ` 1211` ``` finally show ?thesis . ``` lp15@59751 ` 1212` ```qed ``` lp15@59751 ` 1213` lp15@59751 ` 1214` ```lemma Ln_times: ``` lp15@59751 ` 1215` ``` assumes "w \ 0" "z \ 0" ``` lp15@59751 ` 1216` ``` shows "Ln(w * z) = ``` lp15@59751 ` 1217` ``` (if Im(Ln w + Ln z) \ -pi then ``` lp15@59751 ` 1218` ``` (Ln(w) + Ln(z)) + ii * of_real(2*pi) ``` lp15@59751 ` 1219` ``` else if Im(Ln w + Ln z) > pi then ``` lp15@59751 ` 1220` ``` (Ln(w) + Ln(z)) - ii * of_real(2*pi) ``` lp15@59751 ` 1221` ``` else Ln(w) + Ln(z))" ``` lp15@59751 ` 1222` ``` using pi_ge_zero Im_Ln_le_pi [of w] Im_Ln_le_pi [of z] ``` lp15@59751 ` 1223` ``` using assms mpi_less_Im_Ln [of w] mpi_less_Im_Ln [of z] ``` paulson@62131 ` 1224` ``` by (auto simp: exp_add exp_diff sin_double cos_double exp_Euler intro!: Ln_unique) ``` lp15@59751 ` 1225` lp15@60150 ` 1226` ```corollary Ln_times_simple: ``` lp15@59751 ` 1227` ``` "\w \ 0; z \ 0; -pi < Im(Ln w) + Im(Ln z); Im(Ln w) + Im(Ln z) \ pi\ ``` lp15@59751 ` 1228` ``` \ Ln(w * z) = Ln(w) + Ln(z)" ``` lp15@59751 ` 1229` ``` by (simp add: Ln_times) ``` lp15@59751 ` 1230` lp15@60150 ` 1231` ```corollary Ln_times_of_real: ``` lp15@60150 ` 1232` ``` "\r > 0; z \ 0\ \ Ln(of_real r * z) = ln r + Ln(z)" ``` lp15@60150 ` 1233` ``` using mpi_less_Im_Ln Im_Ln_le_pi ``` lp15@60150 ` 1234` ``` by (force simp: Ln_times) ``` lp15@60150 ` 1235` lp15@60150 ` 1236` ```corollary Ln_divide_of_real: ``` lp15@60150 ` 1237` ``` "\r > 0; z \ 0\ \ Ln(z / of_real r) = Ln(z) - ln r" ``` lp15@60150 ` 1238` ```using Ln_times_of_real [of "inverse r" z] ``` lp15@61609 ` 1239` ```by (simp add: ln_inverse Ln_of_real mult.commute divide_inverse of_real_inverse [symmetric] ``` lp15@60150 ` 1240` ``` del: of_real_inverse) ``` lp15@60150 ` 1241` lp15@59751 ` 1242` ```lemma Ln_minus: ``` lp15@59751 ` 1243` ``` assumes "z \ 0" ``` lp15@59751 ` 1244` ``` shows "Ln(-z) = (if Im(z) \ 0 \ ~(Re(z) < 0 \ Im(z) = 0) ``` lp15@59751 ` 1245` ``` then Ln(z) + ii * pi ``` lp15@59751 ` 1246` ``` else Ln(z) - ii * pi)" (is "_ = ?rhs") ``` lp15@59751 ` 1247` ``` using Im_Ln_le_pi [of z] mpi_less_Im_Ln [of z] assms ``` lp15@59751 ` 1248` ``` Im_Ln_eq_pi [of z] Im_Ln_pos_lt [of z] ``` paulson@62131 ` 1249` ``` by (fastforce simp: exp_add exp_diff exp_Euler intro!: Ln_unique) ``` lp15@59751 ` 1250` lp15@59751 ` 1251` ```lemma Ln_inverse_if: ``` lp15@59751 ` 1252` ``` assumes "z \ 0" ``` paulson@62131 ` 1253` ``` shows "Ln (inverse z) = (if z \ \\<^sub>\\<^sub>0 then -(Ln z) + \ * 2 * complex_of_real pi else -(Ln z))" ``` paulson@62131 ` 1254` ```proof (cases "z \ \\<^sub>\\<^sub>0") ``` paulson@62131 ` 1255` ``` case False then show ?thesis ``` lp15@59751 ` 1256` ``` by (simp add: Ln_inverse) ``` lp15@59751 ` 1257` ```next ``` paulson@62131 ` 1258` ``` case True ``` lp15@59751 ` 1259` ``` then have z: "Im z = 0" "Re z < 0" ``` lp15@59751 ` 1260` ``` using assms ``` paulson@62131 ` 1261` ``` apply (auto simp: complex_nonpos_Reals_iff) ``` paulson@62131 ` 1262` ``` by (metis complex_is_Real_iff le_imp_less_or_eq of_real_0 of_real_Re) ``` lp15@59751 ` 1263` ``` have "Ln(inverse z) = Ln(- (inverse (-z)))" ``` lp15@59751 ` 1264` ``` by simp ``` lp15@59751 ` 1265` ``` also have "... = Ln (inverse (-z)) + \ * complex_of_real pi" ``` lp15@59751 ` 1266` ``` using assms z ``` lp15@59751 ` 1267` ``` apply (simp add: Ln_minus) ``` lp15@59751 ` 1268` ``` apply (simp add: field_simps) ``` lp15@59751 ` 1269` ``` done ``` lp15@59751 ` 1270` ``` also have "... = - Ln (- z) + \ * complex_of_real pi" ``` lp15@59751 ` 1271` ``` apply (subst Ln_inverse) ``` lp15@62534 ` 1272` ``` using z by (auto simp add: complex_nonneg_Reals_iff) ``` lp15@59751 ` 1273` ``` also have "... = - (Ln z) + \ * 2 * complex_of_real pi" ``` lp15@59751 ` 1274` ``` apply (subst Ln_minus [OF assms]) ``` lp15@59751 ` 1275` ``` using assms z ``` lp15@59751 ` 1276` ``` apply simp ``` lp15@59751 ` 1277` ``` done ``` paulson@62131 ` 1278` ``` finally show ?thesis by (simp add: True) ``` lp15@59751 ` 1279` ```qed ``` lp15@59751 ` 1280` lp15@59751 ` 1281` ```lemma Ln_times_ii: ``` lp15@59751 ` 1282` ``` assumes "z \ 0" ``` lp15@59751 ` 1283` ``` shows "Ln(ii * z) = (if 0 \ Re(z) | Im(z) < 0 ``` lp15@59751 ` 1284` ``` then Ln(z) + ii * of_real pi/2 ``` lp15@59751 ` 1285` ``` else Ln(z) - ii * of_real(3 * pi/2))" ``` lp15@59751 ` 1286` ``` using Im_Ln_le_pi [of z] mpi_less_Im_Ln [of z] assms ``` lp15@59751 ` 1287` ``` Im_Ln_eq_pi [of z] Im_Ln_pos_lt [of z] Re_Ln_pos_le [of z] ``` paulson@62131 ` 1288` ``` by (auto simp: Ln_times) ``` lp15@59751 ` 1289` eberlm@61524 ` 1290` ```lemma Ln_of_nat: "0 < n \ Ln (of_nat n) = of_real (ln (of_nat n))" ``` eberlm@61524 ` 1291` ``` by (subst of_real_of_nat_eq[symmetric], subst Ln_of_real[symmetric]) simp_all ``` eberlm@61524 ` 1292` lp15@61609 ` 1293` ```lemma Ln_of_nat_over_of_nat: ``` eberlm@61524 ` 1294` ``` assumes "m > 0" "n > 0" ``` eberlm@61524 ` 1295` ``` shows "Ln (of_nat m / of_nat n) = of_real (ln (of_nat m) - ln (of_nat n))" ``` eberlm@61524 ` 1296` ```proof - ``` eberlm@61524 ` 1297` ``` have "of_nat m / of_nat n = (of_real (of_nat m / of_nat n) :: complex)" by simp ``` eberlm@61524 ` 1298` ``` also from assms have "Ln ... = of_real (ln (of_nat m / of_nat n))" ``` eberlm@61524 ` 1299` ``` by (simp add: Ln_of_real[symmetric]) ``` eberlm@61524 ` 1300` ``` also from assms have "... = of_real (ln (of_nat m) - ln (of_nat n))" ``` eberlm@61524 ` 1301` ``` by (simp add: ln_div) ``` eberlm@61524 ` 1302` ``` finally show ?thesis . ``` eberlm@61524 ` 1303` ```qed ``` eberlm@61524 ` 1304` lp15@59751 ` 1305` wenzelm@60420 ` 1306` ```subsection\Relation between Ln and Arg, and hence continuity of Arg\ ``` lp15@60150 ` 1307` lp15@61609 ` 1308` ```lemma Arg_Ln: ``` lp15@60150 ` 1309` ``` assumes "0 < Arg z" shows "Arg z = Im(Ln(-z)) + pi" ``` lp15@60150 ` 1310` ```proof (cases "z = 0") ``` lp15@60150 ` 1311` ``` case True ``` lp15@60150 ` 1312` ``` with assms show ?thesis ``` lp15@60150 ` 1313` ``` by simp ``` lp15@60150 ` 1314` ```next ``` lp15@60150 ` 1315` ``` case False ``` lp15@60150 ` 1316` ``` then have "z / of_real(norm z) = exp(ii * of_real(Arg z))" ``` lp15@60150 ` 1317` ``` using Arg [of z] ``` lp15@60150 ` 1318` ``` by (metis abs_norm_cancel nonzero_mult_divide_cancel_left norm_of_real zero_less_norm_iff) ``` lp15@60150 ` 1319` ``` then have "- z / of_real(norm z) = exp (\ * (of_real (Arg z) - pi))" ``` lp15@60150 ` 1320` ``` using cis_conv_exp cis_pi ``` lp15@60150 ` 1321` ``` by (auto simp: exp_diff algebra_simps) ``` lp15@60150 ` 1322` ``` then have "ln (- z / of_real(norm z)) = ln (exp (\ * (of_real (Arg z) - pi)))" ``` lp15@60150 ` 1323` ``` by simp ``` lp15@60150 ` 1324` ``` also have "... = \ * (of_real(Arg z) - pi)" ``` lp15@60150 ` 1325` ``` using Arg [of z] assms pi_not_less_zero ``` lp15@60150 ` 1326` ``` by auto ``` lp15@60150 ` 1327` ``` finally have "Arg z = Im (Ln (- z / of_real (cmod z))) + pi" ``` lp15@60150 ` 1328` ``` by simp ``` lp15@60150 ` 1329` ``` also have "... = Im (Ln (-z) - ln (cmod z)) + pi" ``` lp15@60150 ` 1330` ``` by (metis diff_0_right minus_diff_eq zero_less_norm_iff Ln_divide_of_real False) ``` lp15@60150 ` 1331` ``` also have "... = Im (Ln (-z)) + pi" ``` lp15@60150 ` 1332` ``` by simp ``` lp15@60150 ` 1333` ``` finally show ?thesis . ``` lp15@60150 ` 1334` ```qed ``` lp15@60150 ` 1335` lp15@61609 ` 1336` ```lemma continuous_at_Arg: ``` paulson@62131 ` 1337` ``` assumes "z \ \\<^sub>\\<^sub>0" ``` lp15@60150 ` 1338` ``` shows "continuous (at z) Arg" ``` lp15@60150 ` 1339` ```proof - ``` lp15@60150 ` 1340` ``` have *: "isCont (\z. Im (Ln (- z)) + pi) z" ``` lp15@60150 ` 1341` ``` by (rule Complex.isCont_Im isCont_Ln' continuous_intros | simp add: assms complex_is_Real_iff)+ ``` paulson@62131 ` 1342` ``` have [simp]: "\x. \Im x \ 0\ \ Im (Ln (- x)) + pi = Arg x" ``` paulson@62131 ` 1343` ``` using Arg_Ln Arg_gt_0 complex_is_Real_iff by auto ``` paulson@62131 ` 1344` ``` consider "Re z < 0" | "Im z \ 0" using assms ``` lp15@62534 ` 1345` ``` using complex_nonneg_Reals_iff not_le by blast ``` paulson@62131 ` 1346` ``` then have [simp]: "(\z. Im (Ln (- z)) + pi) \z\ Arg z" ``` paulson@62131 ` 1347` ``` using "*" by (simp add: isCont_def) (metis Arg_Ln Arg_gt_0 complex_is_Real_iff) ``` paulson@62131 ` 1348` ``` show ?thesis ``` paulson@62131 ` 1349` ``` apply (simp add: continuous_at) ``` paulson@62131 ` 1350` ``` apply (rule Lim_transform_within_open [where s= "-\\<^sub>\\<^sub>0" and f = "\z. Im(Ln(-z)) + pi"]) ``` paulson@62131 ` 1351` ``` apply (auto simp add: not_le Arg_Ln [OF Arg_gt_0] complex_nonneg_Reals_iff closed_def [symmetric]) ``` paulson@62131 ` 1352` ``` using assms apply (force simp add: complex_nonneg_Reals_iff) ``` paulson@62131 ` 1353` ``` done ``` lp15@60150 ` 1354` ```qed ``` lp15@60150 ` 1355` eberlm@62049 ` 1356` ```lemma Ln_series: ``` eberlm@62049 ` 1357` ``` fixes z :: complex ``` eberlm@62049 ` 1358` ``` assumes "norm z < 1" ``` eberlm@62049 ` 1359` ``` shows "(\n. (-1)^Suc n / of_nat n * z^n) sums ln (1 + z)" (is "(\n. ?f n * z^n) sums _") ``` eberlm@62049 ` 1360` ```proof - ``` eberlm@62049 ` 1361` ``` let ?F = "\z. \n. ?f n * z^n" and ?F' = "\z. \n. diffs ?f n * z^n" ``` eberlm@62049 ` 1362` ``` have r: "conv_radius ?f = 1" ``` eberlm@62049 ` 1363` ``` by (intro conv_radius_ratio_limit_nonzero[of _ 1]) ``` eberlm@62049 ` 1364` ``` (simp_all add: norm_divide LIMSEQ_Suc_n_over_n del: of_nat_Suc) ``` eberlm@62049 ` 1365` eberlm@62049 ` 1366` ``` have "\c. \z\ball 0 1. ln (1 + z) - ?F z = c" ``` eberlm@62049 ` 1367` ``` proof (rule has_field_derivative_zero_constant) ``` eberlm@62049 ` 1368` ``` fix z :: complex assume z': "z \ ball 0 1" ``` eberlm@62049 ` 1369` ``` hence z: "norm z < 1" by (simp add: dist_0_norm) ``` wenzelm@63040 ` 1370` ``` define t :: complex where "t = of_real (1 + norm z) / 2" ``` eberlm@62049 ` 1371` ``` from z have t: "norm z < norm t" "norm t < 1" unfolding t_def ``` eberlm@62049 ` 1372` ``` by (simp_all add: field_simps norm_divide del: of_real_add) ``` eberlm@62049 ` 1373` eberlm@62049 ` 1374` ``` have "Re (-z) \ norm (-z)" by (rule complex_Re_le_cmod) ``` eberlm@62049 ` 1375` ``` also from z have "... < 1" by simp ``` eberlm@62049 ` 1376` ``` finally have "((\z. ln (1 + z)) has_field_derivative inverse (1+z)) (at z)" ``` paulson@62131 ` 1377` ``` by (auto intro!: derivative_eq_intros simp: complex_nonpos_Reals_iff) ``` eberlm@62049 ` 1378` ``` moreover have "(?F has_field_derivative ?F' z) (at z)" using t r ``` eberlm@62049 ` 1379` ``` by (intro termdiffs_strong[of _ t] summable_in_conv_radius) simp_all ``` lp15@62534 ` 1380` ``` ultimately have "((\z. ln (1 + z) - ?F z) has_field_derivative (inverse (1 + z) - ?F' z)) ``` eberlm@62049 ` 1381` ``` (at z within ball 0 1)" ``` eberlm@62049 ` 1382` ``` by (intro derivative_intros) (simp_all add: at_within_open[OF z']) ``` eberlm@62049 ` 1383` ``` also have "(\n. of_nat n * ?f n * z ^ (n - Suc 0)) sums ?F' z" using t r ``` eberlm@62049 ` 1384` ``` by (intro diffs_equiv termdiff_converges[OF t(1)] summable_in_conv_radius) simp_all ``` eberlm@62049 ` 1385` ``` from sums_split_initial_segment[OF this, of 1] ``` eberlm@62049 ` 1386` ``` have "(\i. (-z) ^ i) sums ?F' z" by (simp add: power_minus[of z] del: of_nat_Suc) ``` eberlm@62049 ` 1387` ``` hence "?F' z = inverse (1 + z)" using z by (simp add: sums_iff suminf_geometric divide_inverse) ``` eberlm@62049 ` 1388` ``` also have "inverse (1 + z) - inverse (1 + z) = 0" by simp ``` eberlm@62049 ` 1389` ``` finally show "((\z. ln (1 + z) - ?F z) has_field_derivative 0) (at z within ball 0 1)" . ``` eberlm@62049 ` 1390` ``` qed simp_all ``` eberlm@62049 ` 1391` ``` then obtain c where c: "\z. z \ ball 0 1 \ ln (1 + z) - ?F z = c" by blast ``` eberlm@62049 ` 1392` ``` from c[of 0] have "c = 0" by (simp only: powser_zero) simp ``` eberlm@62049 ` 1393` ``` with c[of z] assms have "ln (1 + z) = ?F z" by (simp add: dist_0_norm) ``` eberlm@62049 ` 1394` ``` moreover have "summable (\n. ?f n * z^n)" using assms r ``` eberlm@62049 ` 1395` ``` by (intro summable_in_conv_radius) simp_all ``` eberlm@62049 ` 1396` ``` ultimately show ?thesis by (simp add: sums_iff) ``` eberlm@62049 ` 1397` ```qed ``` eberlm@62049 ` 1398` eberlm@62049 ` 1399` ```lemma Ln_approx_linear: ``` eberlm@62049 ` 1400` ``` fixes z :: complex ``` eberlm@62049 ` 1401` ``` assumes "norm z < 1" ``` eberlm@62049 ` 1402` ``` shows "norm (ln (1 + z) - z) \ norm z^2 / (1 - norm z)" ``` eberlm@62049 ` 1403` ```proof - ``` eberlm@62049 ` 1404` ``` let ?f = "\n. (-1)^Suc n / of_nat n" ``` eberlm@62049 ` 1405` ``` from assms have "(\n. ?f n * z^n) sums ln (1 + z)" using Ln_series by simp ``` eberlm@62049 ` 1406` ``` moreover have "(\n. (if n = 1 then 1 else 0) * z^n) sums z" using powser_sums_if[of 1] by simp ``` eberlm@62049 ` 1407` ``` ultimately have "(\n. (?f n - (if n = 1 then 1 else 0)) * z^n) sums (ln (1 + z) - z)" ``` eberlm@62049 ` 1408` ``` by (subst left_diff_distrib, intro sums_diff) simp_all ``` eberlm@62049 ` 1409` ``` from sums_split_initial_segment[OF this, of "Suc 1"] ``` eberlm@62049 ` 1410` ``` have "(\i. (-(z^2)) * inverse (2 + of_nat i) * (- z)^i) sums (Ln (1 + z) - z)" ``` eberlm@62049 ` 1411` ``` by (simp add: power2_eq_square mult_ac power_minus[of z] divide_inverse) ``` eberlm@62049 ` 1412` ``` hence "(Ln (1 + z) - z) = (\i. (-(z^2)) * inverse (of_nat (i+2)) * (-z)^i)" ``` eberlm@62049 ` 1413` ``` by (simp add: sums_iff) ``` eberlm@62049 ` 1414` ``` also have A: "summable (\n. norm z^2 * (inverse (real_of_nat (Suc (Suc n))) * cmod z ^ n))" ``` eberlm@62049 ` 1415` ``` by (rule summable_mult, rule summable_comparison_test_ev[OF _ summable_geometric[of "norm z"]]) ``` eberlm@62049 ` 1416` ``` (auto simp: assms field_simps intro!: always_eventually) ``` lp15@62534 ` 1417` ``` hence "norm (\i. (-(z^2)) * inverse (of_nat (i+2)) * (-z)^i) \ ``` eberlm@62049 ` 1418` ``` (\i. norm (-(z^2) * inverse (of_nat (i+2)) * (-z)^i))" ``` eberlm@62049 ` 1419` ``` by (intro summable_norm) ``` eberlm@62049 ` 1420` ``` (auto simp: norm_power norm_inverse norm_mult mult_ac simp del: of_nat_add of_nat_Suc) ``` eberlm@62049 ` 1421` ``` also have "norm ((-z)^2 * (-z)^i) * inverse (of_nat (i+2)) \ norm ((-z)^2 * (-z)^i) * 1" for i ``` eberlm@62049 ` 1422` ``` by (intro mult_left_mono) (simp_all add: divide_simps) ``` lp15@62534 ` 1423` ``` hence "(\i. norm (-(z^2) * inverse (of_nat (i+2)) * (-z)^i)) \ ``` eberlm@62049 ` 1424` ``` (\i. norm (-(z^2) * (-z)^i))" using A assms ``` eberlm@62049 ` 1425` ``` apply (simp_all only: norm_power norm_inverse norm_divide norm_mult) ``` eberlm@62049 ` 1426` ``` apply (intro suminf_le summable_mult summable_geometric) ``` eberlm@62049 ` 1427` ``` apply (auto simp: norm_power field_simps simp del: of_nat_add of_nat_Suc) ``` eberlm@62049 ` 1428` ``` done ``` eberlm@62049 ` 1429` ``` also have "... = norm z^2 * (\i. norm z^i)" using assms ``` eberlm@62049 ` 1430` ``` by (subst suminf_mult [symmetric]) (auto intro!: summable_geometric simp: norm_mult norm_power) ``` eberlm@62049 ` 1431` ``` also have "(\i. norm z^i) = inverse (1 - norm z)" using assms ``` eberlm@62049 ` 1432` ``` by (subst suminf_geometric) (simp_all add: divide_inverse) ``` eberlm@62049 ` 1433` ``` also have "norm z^2 * ... = norm z^2 / (1 - norm z)" by (simp add: divide_inverse) ``` eberlm@62049 ` 1434` ``` finally show ?thesis . ``` eberlm@62049 ` 1435` ```qed ``` eberlm@62049 ` 1436` eberlm@62049 ` 1437` wenzelm@60420 ` 1438` ```text\Relation between Arg and arctangent in upper halfplane\ ``` lp15@61609 ` 1439` ```lemma Arg_arctan_upperhalf: ``` lp15@60150 ` 1440` ``` assumes "0 < Im z" ``` lp15@60150 ` 1441` ``` shows "Arg z = pi/2 - arctan(Re z / Im z)" ``` lp15@60150 ` 1442` ```proof (cases "z = 0") ``` lp15@60150 ` 1443` ``` case True with assms show ?thesis ``` lp15@60150 ` 1444` ``` by simp ``` lp15@60150 ` 1445` ```next ``` lp15@60150 ` 1446` ``` case False ``` lp15@60150 ` 1447` ``` show ?thesis ``` lp15@60150 ` 1448` ``` apply (rule Arg_unique [of "norm z"]) ``` lp15@60150 ` 1449` ``` using False assms arctan [of "Re z / Im z"] pi_ge_two pi_half_less_two ``` lp15@60150 ` 1450` ``` apply (auto simp: exp_Euler cos_diff sin_diff) ``` lp15@60150 ` 1451` ``` using norm_complex_def [of z, symmetric] ``` paulson@62131 ` 1452` ``` apply (simp add: sin_of_real cos_of_real sin_arctan cos_arctan field_simps real_sqrt_divide) ``` lp15@60150 ` 1453` ``` apply (metis complex_eq mult.assoc ring_class.ring_distribs(2)) ``` lp15@60150 ` 1454` ``` done ``` lp15@60150 ` 1455` ```qed ``` lp15@60150 ` 1456` lp15@61609 ` 1457` ```lemma Arg_eq_Im_Ln: ``` lp15@61609 ` 1458` ``` assumes "0 \ Im z" "0 < Re z" ``` lp15@60150 ` 1459` ``` shows "Arg z = Im (Ln z)" ``` lp15@60150 ` 1460` ```proof (cases "z = 0 \ Im z = 0") ``` lp15@60150 ` 1461` ``` case True then show ?thesis ``` lp15@61609 ` 1462` ``` using assms Arg_eq_0 complex_is_Real_iff ``` lp15@60150 ` 1463` ``` apply auto ``` lp15@60150 ` 1464` ``` by (metis Arg_eq_0_pi Arg_eq_pi Im_Ln_eq_0 Im_Ln_eq_pi less_numeral_extra(3) zero_complex.simps(1)) ``` lp15@60150 ` 1465` ```next ``` lp15@61609 ` 1466` ``` case False ``` lp15@60150 ` 1467` ``` then have "Arg z > 0" ``` lp15@60150 ` 1468` ``` using Arg_gt_0 complex_is_Real_iff by blast ``` lp15@60150 ` 1469` ``` then show ?thesis ``` lp15@61609 ` 1470` ``` using assms False ``` lp15@60150 ` 1471` ``` by (subst Arg_Ln) (auto simp: Ln_minus) ``` lp15@60150 ` 1472` ```qed ``` lp15@60150 ` 1473` lp15@61609 ` 1474` ```lemma continuous_within_upperhalf_Arg: ``` lp15@60150 ` 1475` ``` assumes "z \ 0" ``` lp15@60150 ` 1476` ``` shows "continuous (at z within {z. 0 \ Im z}) Arg" ``` paulson@62131 ` 1477` ```proof (cases "z \ \\<^sub>\\<^sub>0") ``` lp15@60150 ` 1478` ``` case False then show ?thesis ``` lp15@60150 ` 1479` ``` using continuous_at_Arg continuous_at_imp_continuous_within by auto ``` lp15@60150 ` 1480` ```next ``` lp15@60150 ` 1481` ``` case True ``` lp15@60150 ` 1482` ``` then have z: "z \ \" "0 < Re z" ``` paulson@62131 ` 1483` ``` using assms by (auto simp: complex_nonneg_Reals_iff complex_is_Real_iff complex_neq_0) ``` lp15@60150 ` 1484` ``` then have [simp]: "Arg z = 0" "Im (Ln z) = 0" ``` lp15@60150 ` 1485` ``` by (auto simp: Arg_eq_0 Im_Ln_eq_0 assms complex_is_Real_iff) ``` lp15@61609 ` 1486` ``` show ?thesis ``` lp15@60150 ` 1487` ``` proof (clarsimp simp add: continuous_within Lim_within dist_norm) ``` lp15@60150 ` 1488` ``` fix e::real ``` lp15@60150 ` 1489` ``` assume "0 < e" ``` lp15@60150 ` 1490` ``` moreover have "continuous (at z) (\x. Im (Ln x))" ``` paulson@62131 ` 1491` ``` using z by (simp add: continuous_at_Ln complex_nonpos_Reals_iff) ``` lp15@60150 ` 1492` ``` ultimately ``` lp15@60150 ` 1493` ``` obtain d where d: "d>0" "\x. x \ z \ cmod (x - z) < d \ \Im (Ln x)\ < e" ``` lp15@60150 ` 1494` ``` by (auto simp: continuous_within Lim_within dist_norm) ``` lp15@60150 ` 1495` ``` { fix x ``` lp15@60150 ` 1496` ``` assume "cmod (x - z) < Re z / 2" ``` lp15@60150 ` 1497` ``` then have "\Re x - Re z\ < Re z / 2" ``` lp15@60150 ` 1498` ``` by (metis le_less_trans abs_Re_le_cmod minus_complex.simps(1)) ``` lp15@60150 ` 1499` ``` then have "0 < Re x" ``` lp15@60150 ` 1500` ``` using z by linarith ``` lp15@60150 ` 1501` ``` } ``` lp15@60150 ` 1502` ``` then show "\d>0. \x. 0 \ Im x \ x \ z \ cmod (x - z) < d \ \Arg x\ < e" ``` lp15@60150 ` 1503` ``` apply (rule_tac x="min d (Re z / 2)" in exI) ``` lp15@60150 ` 1504` ``` using z d ``` lp15@60150 ` 1505` ``` apply (auto simp: Arg_eq_Im_Ln) ``` lp15@60150 ` 1506` ``` done ``` lp15@60150 ` 1507` ``` qed ``` lp15@60150 ` 1508` ```qed ``` lp15@60150 ` 1509` lp15@60150 ` 1510` ```lemma continuous_on_upperhalf_Arg: "continuous_on ({z. 0 \ Im z} - {0}) Arg" ``` lp15@60150 ` 1511` ``` apply (auto simp: continuous_on_eq_continuous_within) ``` lp15@60150 ` 1512` ``` by (metis Diff_subset continuous_within_subset continuous_within_upperhalf_Arg) ``` lp15@60150 ` 1513` lp15@61609 ` 1514` ```lemma open_Arg_less_Int: ``` lp15@60150 ` 1515` ``` assumes "0 \ s" "t \ 2*pi" ``` lp15@60150 ` 1516` ``` shows "open ({y. s < Arg y} \ {y. Arg y < t})" ``` lp15@60150 ` 1517` ```proof - ``` paulson@62131 ` 1518` ``` have 1: "continuous_on (UNIV - \\<^sub>\\<^sub>0) Arg" ``` lp15@61609 ` 1519` ``` using continuous_at_Arg continuous_at_imp_continuous_within ``` paulson@62131 ` 1520` ``` by (auto simp: continuous_on_eq_continuous_within) ``` paulson@62131 ` 1521` ``` have 2: "open (UNIV - \\<^sub>\\<^sub>0 :: complex set)" by (simp add: open_Diff) ``` lp15@60150 ` 1522` ``` have "open ({z. s < z} \ {z. z < t})" ``` lp15@60150 ` 1523` ``` using open_lessThan [of t] open_greaterThan [of s] ``` lp15@60150 ` 1524` ``` by (metis greaterThan_def lessThan_def open_Int) ``` paulson@62131 ` 1525` ``` moreover have "{y. s < Arg y} \ {y. Arg y < t} \ - \\<^sub>\\<^sub>0" ``` paulson@62131 ` 1526` ``` using assms by (auto simp: Arg_real complex_nonneg_Reals_iff complex_is_Real_iff) ``` lp15@60150 ` 1527` ``` ultimately show ?thesis ``` lp15@61609 ` 1528` ``` using continuous_imp_open_vimage [OF 1 2, of "{z. Re z > s} \ {z. Re z < t}"] ``` lp15@60150 ` 1529` ``` by auto ``` lp15@60150 ` 1530` ```qed ``` lp15@60150 ` 1531` lp15@60150 ` 1532` ```lemma open_Arg_gt: "open {z. t < Arg z}" ``` lp15@60150 ` 1533` ```proof (cases "t < 0") ``` lp15@60150 ` 1534` ``` case True then have "{z. t < Arg z} = UNIV" ``` lp15@60150 ` 1535` ``` using Arg_ge_0 less_le_trans by auto ``` lp15@60150 ` 1536` ``` then show ?thesis ``` lp15@60150 ` 1537` ``` by simp ``` lp15@60150 ` 1538` ```next ``` lp15@60150 ` 1539` ``` case False then show ?thesis ``` lp15@60150 ` 1540` ``` using open_Arg_less_Int [of t "2*pi"] Arg_lt_2pi ``` lp15@60150 ` 1541` ``` by auto ``` lp15@60150 ` 1542` ```qed ``` lp15@60150 ` 1543` lp15@60150 ` 1544` ```lemma closed_Arg_le: "closed {z. Arg z \ t}" ``` lp15@60150 ` 1545` ``` using open_Arg_gt [of t] ``` lp15@60150 ` 1546` ``` by (simp add: closed_def Set.Collect_neg_eq [symmetric] not_le) ``` lp15@60017 ` 1547` wenzelm@60420 ` 1548` ```subsection\Complex Powers\ ``` lp15@60017 ` 1549` lp15@60017 ` 1550` ```lemma powr_to_1 [simp]: "z powr 1 = (z::complex)" ``` lp15@60020 ` 1551` ``` by (simp add: powr_def) ``` lp15@60017 ` 1552` lp15@60017 ` 1553` ```lemma powr_nat: ``` lp15@60017 ` 1554` ``` fixes n::nat and z::complex shows "z powr n = (if z = 0 then 0 else z^n)" ``` lp15@60020 ` 1555` ``` by (simp add: exp_of_nat_mult powr_def) ``` lp15@60017 ` 1556` lp15@60809 ` 1557` ```lemma powr_add_complex: ``` lp15@60017 ` 1558` ``` fixes w::complex shows "w powr (z1 + z2) = w powr z1 * w powr z2" ``` lp15@60017 ` 1559` ``` by (simp add: powr_def algebra_simps exp_add) ``` lp15@60017 ` 1560` lp15@60809 ` 1561` ```lemma powr_minus_complex: ``` lp15@60017 ` 1562` ``` fixes w::complex shows "w powr (-z) = inverse(w powr z)" ``` lp15@60017 ` 1563` ``` by (simp add: powr_def exp_minus) ``` lp15@60017 ` 1564` lp15@60809 ` 1565` ```lemma powr_diff_complex: ``` lp15@60017 ` 1566` ``` fixes w::complex shows "w powr (z1 - z2) = w powr z1 / w powr z2" ``` lp15@60017 ` 1567` ``` by (simp add: powr_def algebra_simps exp_diff) ``` lp15@60017 ` 1568` lp15@60017 ` 1569` ```lemma norm_powr_real: "w \ \ \ 0 < Re w \ norm(w powr z) = exp(Re z * ln(Re w))" ``` lp15@60020 ` 1570` ``` apply (simp add: powr_def) ``` lp15@60017 ` 1571` ``` using Im_Ln_eq_0 complex_is_Real_iff norm_complex_def ``` lp15@60017 ` 1572` ``` by auto ``` lp15@60017 ` 1573` eberlm@61524 ` 1574` ```lemma cnj_powr: ``` eberlm@61524 ` 1575` ``` assumes "Im a = 0 \ Re a \ 0" ``` eberlm@61524 ` 1576` ``` shows "cnj (a powr b) = cnj a powr cnj b" ``` eberlm@61524 ` 1577` ```proof (cases "a = 0") ``` eberlm@61524 ` 1578` ``` case False ``` paulson@62131 ` 1579` ``` with assms have "a \ \\<^sub>\\<^sub>0" by (auto simp: complex_eq_iff complex_nonpos_Reals_iff) ``` eberlm@61524 ` 1580` ``` with False show ?thesis by (simp add: powr_def exp_cnj cnj_Ln) ``` eberlm@61524 ` 1581` ```qed simp ``` eberlm@61524 ` 1582` lp15@60017 ` 1583` ```lemma powr_real_real: ``` lp15@60017 ` 1584` ``` "\w \ \; z \ \; 0 < Re w\ \ w powr z = exp(Re z * ln(Re w))" ``` lp15@60020 ` 1585` ``` apply (simp add: powr_def) ``` lp15@60017 ` 1586` ``` by (metis complex_eq complex_is_Real_iff diff_0 diff_0_right diff_minus_eq_add exp_ln exp_not_eq_zero ``` lp15@60017 ` 1587` ``` exp_of_real Ln_of_real mult_zero_right of_real_0 of_real_mult) ``` lp15@60017 ` 1588` lp15@60017 ` 1589` ```lemma powr_of_real: ``` lp15@60020 ` 1590` ``` fixes x::real and y::real ``` lp15@60020 ` 1591` ``` shows "0 < x \ of_real x powr (of_real y::complex) = of_real (x powr y)" ``` lp15@60020 ` 1592` ``` by (simp add: powr_def) (metis exp_of_real of_real_mult Ln_of_real) ``` lp15@60017 ` 1593` lp15@60017 ` 1594` ```lemma norm_powr_real_mono: ``` lp15@60020 ` 1595` ``` "\w \ \; 1 < Re w\ ``` lp15@60020 ` 1596` ``` \ cmod(w powr z1) \ cmod(w powr z2) \ Re z1 \ Re z2" ``` lp15@60020 ` 1597` ``` by (auto simp: powr_def algebra_simps Reals_def Ln_of_real) ``` lp15@60017 ` 1598` lp15@60017 ` 1599` ```lemma powr_times_real: ``` lp15@60017 ` 1600` ``` "\x \ \; y \ \; 0 \ Re x; 0 \ Re y\ ``` lp15@60017 ` 1601` ``` \ (x * y) powr z = x powr z * y powr z" ``` lp15@60020 ` 1602` ``` by (auto simp: Reals_def powr_def Ln_times exp_add algebra_simps less_eq_real_def Ln_of_real) ``` lp15@60017 ` 1603` eberlm@61524 ` 1604` ```lemma powr_neg_real_complex: ``` eberlm@61524 ` 1605` ``` shows "(- of_real x) powr a = (-1) powr (of_real (sgn x) * a) * of_real x powr (a :: complex)" ``` eberlm@61524 ` 1606` ```proof (cases "x = 0") ``` eberlm@61524 ` 1607` ``` assume x: "x \ 0" ``` eberlm@61524 ` 1608` ``` hence "(-x) powr a = exp (a * ln (-of_real x))" by (simp add: powr_def) ``` eberlm@61524 ` 1609` ``` also from x have "ln (-of_real x) = Ln (of_real x) + of_real (sgn x) * pi * \" ``` eberlm@61524 ` 1610` ``` by (simp add: Ln_minus Ln_of_real) ``` wenzelm@63092 ` 1611` ``` also from x have "exp (a * ...) = cis pi powr (of_real (sgn x) * a) * of_real x powr a" ``` eberlm@61524 ` 1612` ``` by (simp add: powr_def exp_add algebra_simps Ln_of_real cis_conv_exp) ``` eberlm@61524 ` 1613` ``` also note cis_pi ``` eberlm@61524 ` 1614` ``` finally show ?thesis by simp ``` eberlm@61524 ` 1615` ```qed simp_all ``` eberlm@61524 ` 1616` lp15@60017 ` 1617` ```lemma has_field_derivative_powr: ``` paulson@62131 ` 1618` ``` fixes z :: complex ``` paulson@62131 ` 1619` ``` shows "z \ \\<^sub>\\<^sub>0 \ ((\z. z powr s) has_field_derivative (s * z powr (s - 1))) (at z)" ``` lp15@60017 ` 1620` ``` apply (cases "z=0", auto) ``` lp15@60020 ` 1621` ``` apply (simp add: powr_def) ``` lp15@60017 ` 1622` ``` apply (rule DERIV_transform_at [where d = "norm z" and f = "\z. exp (s * Ln z)"]) ``` lp15@60020 ` 1623` ``` apply (auto simp: dist_complex_def) ``` wenzelm@63092 ` 1624` ``` apply (intro derivative_eq_intros | simp)+ ``` lp15@60017 ` 1625` ``` apply (simp add: field_simps exp_diff) ``` lp15@60017 ` 1626` ``` done ``` lp15@60017 ` 1627` paulson@62131 ` 1628` ```declare has_field_derivative_powr[THEN DERIV_chain2, derivative_intros] ``` eberlm@61524 ` 1629` eberlm@61524 ` 1630` lp15@60017 ` 1631` ```lemma has_field_derivative_powr_right: ``` lp15@60017 ` 1632` ``` "w \ 0 \ ((\z. w powr z) has_field_derivative Ln w * w powr z) (at z)" ``` lp15@60020 ` 1633` ``` apply (simp add: powr_def) ``` wenzelm@63092 ` 1634` ``` apply (intro derivative_eq_intros | simp)+ ``` lp15@60017 ` 1635` ``` done ``` lp15@60017 ` 1636` lp15@62534 ` 1637` ```lemma field_differentiable_powr_right: ``` lp15@62533 ` 1638` ``` fixes w::complex ``` lp15@62533 ` 1639` ``` shows ``` lp15@62534 ` 1640` ``` "w \ 0 \ (\z. w powr z) field_differentiable (at z)" ``` lp15@62534 ` 1641` ```using field_differentiable_def has_field_derivative_powr_right by blast ``` lp15@60017 ` 1642` lp15@60017 ` 1643` ```lemma holomorphic_on_powr_right: ``` lp15@60017 ` 1644` ``` "f holomorphic_on s \ w \ 0 \ (\z. w powr (f z)) holomorphic_on s" ``` lp15@62534 ` 1645` ``` unfolding holomorphic_on_def field_differentiable_def ``` lp15@62534 ` 1646` ```by (metis (full_types) DERIV_chain' has_field_derivative_powr_right) ``` lp15@60017 ` 1647` lp15@60017 ` 1648` ```lemma norm_powr_real_powr: ``` eberlm@63295 ` 1649` ``` "w \ \ \ 0 \ Re w \ cmod (w powr z) = Re w powr Re z" ``` eberlm@63295 ` 1650` ``` by (cases "w = 0") (auto simp add: norm_powr_real powr_def Im_Ln_eq_0 ``` eberlm@63295 ` 1651` ``` complex_is_Real_iff in_Reals_norm complex_eq_iff) ``` eberlm@63295 ` 1652` eberlm@63295 ` 1653` ```lemma tendsto_ln_complex [tendsto_intros]: ``` eberlm@63295 ` 1654` ``` assumes "(f \ a) F" "a \ \\<^sub>\\<^sub>0" ``` eberlm@63295 ` 1655` ``` shows "((\z. ln (f z :: complex)) \ ln a) F" ``` eberlm@63295 ` 1656` ``` using tendsto_compose[OF continuous_at_Ln[of a, unfolded isCont_def] assms(1)] assms(2) by simp ``` eberlm@63295 ` 1657` eberlm@63295 ` 1658` ```lemma tendsto_powr_complex: ``` eberlm@63295 ` 1659` ``` fixes f g :: "_ \ complex" ``` eberlm@63295 ` 1660` ``` assumes a: "a \ \\<^sub>\\<^sub>0" ``` eberlm@63295 ` 1661` ``` assumes f: "(f \ a) F" and g: "(g \ b) F" ``` eberlm@63295 ` 1662` ``` shows "((\z. f z powr g z) \ a powr b) F" ``` eberlm@63295 ` 1663` ```proof - ``` eberlm@63295 ` 1664` ``` from a have [simp]: "a \ 0" by auto ``` eberlm@63295 ` 1665` ``` from f g a have "((\z. exp (g z * ln (f z))) \ a powr b) F" (is ?P) ``` eberlm@63295 ` 1666` ``` by (auto intro!: tendsto_intros simp: powr_def) ``` eberlm@63295 ` 1667` ``` also { ``` eberlm@63295 ` 1668` ``` have "eventually (\z. z \ 0) (nhds a)" ``` eberlm@63295 ` 1669` ``` by (intro t1_space_nhds) simp_all ``` eberlm@63295 ` 1670` ``` with f have "eventually (\z. f z \ 0) F" using filterlim_iff by blast ``` eberlm@63295 ` 1671` ``` } ``` eberlm@63295 ` 1672` ``` hence "?P \ ((\z. f z powr g z) \ a powr b) F" ``` eberlm@63295 ` 1673` ``` by (intro tendsto_cong refl) (simp_all add: powr_def mult_ac) ``` eberlm@63295 ` 1674` ``` finally show ?thesis . ``` eberlm@63295 ` 1675` ```qed ``` eberlm@63295 ` 1676` eberlm@63295 ` 1677` ```lemma tendsto_powr_complex_0: ``` eberlm@63295 ` 1678` ``` fixes f g :: "'a \ complex" ``` eberlm@63295 ` 1679` ``` assumes f: "(f \ 0) F" and g: "(g \ b) F" and b: "Re b > 0" ``` eberlm@63295 ` 1680` ``` shows "((\z. f z powr g z) \ 0) F" ``` eberlm@63295 ` 1681` ```proof (rule tendsto_norm_zero_cancel) ``` eberlm@63295 ` 1682` ``` define h where ``` eberlm@63295 ` 1683` ``` "h = (\z. if f z = 0 then 0 else exp (Re (g z) * ln (cmod (f z)) + abs (Im (g z)) * pi))" ``` eberlm@63295 ` 1684` ``` { ``` eberlm@63295 ` 1685` ``` fix z :: 'a assume z: "f z \ 0" ``` eberlm@63295 ` 1686` ``` define c where "c = abs (Im (g z)) * pi" ``` eberlm@63295 ` 1687` ``` from mpi_less_Im_Ln[OF z] Im_Ln_le_pi[OF z] ``` eberlm@63295 ` 1688` ``` have "abs (Im (Ln (f z))) \ pi" by simp ``` eberlm@63295 ` 1689` ``` from mult_left_mono[OF this, of "abs (Im (g z))"] ``` eberlm@63295 ` 1690` ``` have "abs (Im (g z) * Im (ln (f z))) \ c" by (simp add: abs_mult c_def) ``` eberlm@63295 ` 1691` ``` hence "-Im (g z) * Im (ln (f z)) \ c" by simp ``` eberlm@63295 ` 1692` ``` hence "norm (f z powr g z) \ h z" by (simp add: powr_def field_simps h_def c_def) ``` eberlm@63295 ` 1693` ``` } ``` eberlm@63295 ` 1694` ``` hence le: "norm (f z powr g z) \ h z" for z by (cases "f x = 0") (simp_all add: h_def) ``` eberlm@63295 ` 1695` eberlm@63295 ` 1696` ``` have g': "(g \ b) (inf F (principal {z. f z \ 0}))" ``` eberlm@63295 ` 1697` ``` by (rule tendsto_mono[OF _ g]) simp_all ``` eberlm@63295 ` 1698` ``` have "((\x. norm (f x)) \ 0) (inf F (principal {z. f z \ 0}))" ``` eberlm@63295 ` 1699` ``` by (subst tendsto_norm_zero_iff, rule tendsto_mono[OF _ f]) simp_all ``` eberlm@63295 ` 1700` ``` moreover { ``` eberlm@63295 ` 1701` ``` have "filterlim (\x. norm (f x)) (principal {0<..}) (principal {z. f z \ 0})" ``` eberlm@63295 ` 1702` ``` by (auto simp: filterlim_def) ``` eberlm@63295 ` 1703` ``` hence "filterlim (\x. norm (f x)) (principal {0<..}) ``` eberlm@63295 ` 1704` ``` (inf F (principal {z. f z \ 0}))" ``` eberlm@63295 ` 1705` ``` by (rule filterlim_mono) simp_all ``` eberlm@63295 ` 1706` ``` } ``` eberlm@63295 ` 1707` ``` ultimately have norm: "filterlim (\x. norm (f x)) (at_right 0) (inf F (principal {z. f z \ 0}))" ``` eberlm@63295 ` 1708` ``` by (simp add: filterlim_inf at_within_def) ``` eberlm@63295 ` 1709` eberlm@63295 ` 1710` ``` have A: "LIM x inf F (principal {z. f z \ 0}). Re (g x) * -ln (cmod (f x)) :> at_top" ``` eberlm@63295 ` 1711` ``` by (rule filterlim_tendsto_pos_mult_at_top tendsto_intros g' b ``` eberlm@63295 ` 1712` ``` filterlim_compose[OF filterlim_uminus_at_top_at_bot] filterlim_compose[OF ln_at_0] norm)+ ``` eberlm@63295 ` 1713` ``` have B: "LIM x inf F (principal {z. f z \ 0}). ``` eberlm@63295 ` 1714` ``` -\Im (g x)\ * pi + -(Re (g x) * ln (cmod (f x))) :> at_top" ``` eberlm@63295 ` 1715` ``` by (rule filterlim_tendsto_add_at_top tendsto_intros g')+ (insert A, simp_all) ``` eberlm@63295 ` 1716` ``` have C: "(h \ 0) F" unfolding h_def ``` eberlm@63295 ` 1717` ``` by (intro filterlim_If tendsto_const filterlim_compose[OF exp_at_bot]) ``` eberlm@63295 ` 1718` ``` (insert B, auto simp: filterlim_uminus_at_bot algebra_simps) ``` eberlm@63295 ` 1719` ``` show "((\x. norm (f x powr g x)) \ 0) F" ``` eberlm@63295 ` 1720` ``` by (rule Lim_null_comparison[OF always_eventually C]) (insert le, auto) ``` eberlm@63295 ` 1721` ```qed ``` eberlm@63295 ` 1722` eberlm@63295 ` 1723` ```lemma tendsto_powr_complex' [tendsto_intros]: ``` eberlm@63295 ` 1724` ``` fixes f g :: "_ \ complex" ``` eberlm@63295 ` 1725` ``` assumes fz: "a \ \\<^sub>\\<^sub>0 \ (a = 0 \ Re b > 0)" ``` eberlm@63295 ` 1726` ``` assumes fg: "(f \ a) F" "(g \ b) F" ``` eberlm@63295 ` 1727` ``` shows "((\z. f z powr g z) \ a powr b) F" ``` eberlm@63295 ` 1728` ```proof (cases "a = 0") ``` eberlm@63295 ` 1729` ``` case True ``` eberlm@63295 ` 1730` ``` with assms show ?thesis by (auto intro!: tendsto_powr_complex_0) ``` eberlm@63295 ` 1731` ```next ``` eberlm@63295 ` 1732` ``` case False ``` eberlm@63295 ` 1733` ``` with assms show ?thesis by (auto intro!: tendsto_powr_complex elim!: nonpos_Reals_cases) ``` eberlm@63295 ` 1734` ```qed ``` eberlm@63295 ` 1735` eberlm@63295 ` 1736` ```lemma continuous_powr_complex: ``` eberlm@63295 ` 1737` ``` assumes "f (netlimit F) \ \\<^sub>\\<^sub>0" "continuous F f" "continuous F g" ``` eberlm@63295 ` 1738` ``` shows "continuous F (\z. f z powr g z :: complex)" ``` eberlm@63295 ` 1739` ``` using assms unfolding continuous_def by (intro tendsto_powr_complex) simp_all ``` eberlm@63295 ` 1740` eberlm@63295 ` 1741` ```lemma isCont_powr_complex [continuous_intros]: ``` eberlm@63295 ` 1742` ``` assumes "f z \ \\<^sub>\\<^sub>0" "isCont f z" "isCont g z" ``` eberlm@63295 ` 1743` ``` shows "isCont (\z. f z powr g z :: complex) z" ``` eberlm@63295 ` 1744` ``` using assms unfolding isCont_def by (intro tendsto_powr_complex) simp_all ``` eberlm@63295 ` 1745` eberlm@63295 ` 1746` ```lemma continuous_on_powr_complex [continuous_intros]: ``` eberlm@63295 ` 1747` ``` assumes "A \ {z. Re (f z) \ 0 \ Im (f z) \ 0}" ``` eberlm@63295 ` 1748` ``` assumes "\z. z \ A \ f z = 0 \ Re (g z) > 0" ``` eberlm@63295 ` 1749` ``` assumes "continuous_on A f" "continuous_on A g" ``` eberlm@63295 ` 1750` ``` shows "continuous_on A (\z. f z powr g z)" ``` eberlm@63295 ` 1751` ``` unfolding continuous_on_def ``` eberlm@63295 ` 1752` ```proof ``` eberlm@63295 ` 1753` ``` fix z assume z: "z \ A" ``` eberlm@63295 ` 1754` ``` show "((\z. f z powr g z) \ f z powr g z) (at z within A)" ``` eberlm@63295 ` 1755` ``` proof (cases "f z = 0") ``` eberlm@63295 ` 1756` ``` case False ``` eberlm@63295 ` 1757` ``` from assms(1,2) z have "Re (f z) \ 0 \ Im (f z) \ 0" "f z = 0 \ Re (g z) > 0" by auto ``` eberlm@63295 ` 1758` ``` with assms(3,4) z show ?thesis ``` eberlm@63295 ` 1759` ``` by (intro tendsto_powr_complex') ``` eberlm@63295 ` 1760` ``` (auto elim!: nonpos_Reals_cases simp: complex_eq_iff continuous_on_def) ``` eberlm@63295 ` 1761` ``` next ``` eberlm@63295 ` 1762` ``` case True ``` eberlm@63295 ` 1763` ``` with assms z show ?thesis ``` eberlm@63295 ` 1764` ``` by (auto intro!: tendsto_powr_complex_0 simp: continuous_on_def) ``` eberlm@63295 ` 1765` ``` qed ``` eberlm@63295 ` 1766` ```qed ``` lp15@60017 ` 1767` lp15@60150 ` 1768` wenzelm@60420 ` 1769` ```subsection\Some Limits involving Logarithms\ ``` lp15@61609 ` 1770` lp15@60150 ` 1771` ```lemma lim_Ln_over_power: ``` lp15@60150 ` 1772` ``` fixes s::complex ``` lp15@60150 ` 1773` ``` assumes "0 < Re s" ``` wenzelm@61973 ` 1774` ``` shows "((\n. Ln n / (n powr s)) \ 0) sequentially" ``` lp15@60150 ` 1775` ```proof (simp add: lim_sequentially dist_norm, clarify) ``` lp15@61609 ` 1776` ``` fix e::real ``` lp15@60150 ` 1777` ``` assume e: "0 < e" ``` lp15@60150 ` 1778` ``` have "\xo>0. \x\xo. 0 < e * 2 + (e * Re s * 2 - 2) * x + e * (Re s)\<^sup>2 * x\<^sup>2" ``` lp15@60150 ` 1779` ``` proof (rule_tac x="2/(e * (Re s)\<^sup>2)" in exI, safe) ``` lp15@60150 ` 1780` ``` show "0 < 2 / (e * (Re s)\<^sup>2)" ``` lp15@60150 ` 1781` ``` using e assms by (simp add: field_simps) ``` lp15@60150 ` 1782` ``` next ``` lp15@60150 ` 1783` ``` fix x::real ``` lp15@60150 ` 1784` ``` assume x: "2 / (e * (Re s)\<^sup>2) \ x" ``` lp15@60150 ` 1785` ``` then have "x>0" ``` lp15@60150 ` 1786` ``` using e assms ``` lp15@60150 ` 1787` ``` by (metis less_le_trans mult_eq_0_iff mult_pos_pos pos_less_divide_eq power2_eq_square ``` lp15@60150 ` 1788` ``` zero_less_numeral) ``` lp15@60150 ` 1789` ``` then show "0 < e * 2 + (e * Re s * 2 - 2) * x + e * (Re s)\<^sup>2 * x\<^sup>2" ``` lp15@60150 ` 1790` ``` using e assms x ``` lp15@60150 ` 1791` ``` apply (auto simp: field_simps) ``` lp15@60150 ` 1792` ``` apply (rule_tac y = "e * (x\<^sup>2 * (Re s)\<^sup>2)" in le_less_trans) ``` lp15@60150 ` 1793` ``` apply (auto simp: power2_eq_square field_simps add_pos_pos) ``` lp15@60150 ` 1794` ``` done ``` lp15@60150 ` 1795` ``` qed ``` lp15@60150 ` 1796` ``` then have "\xo>0. \x\xo. x / e < 1 + (Re s * x) + (1/2) * (Re s * x)^2" ``` lp15@60150 ` 1797` ``` using e by (simp add: field_simps) ``` lp15@60150 ` 1798` ``` then have "\xo>0. \x\xo. x / e < exp (Re s * x)" ``` lp15@60150 ` 1799` ``` using assms ``` lp15@60150 ` 1800` ``` by (force intro: less_le_trans [OF _ exp_lower_taylor_quadratic]) ``` lp15@60150 ` 1801` ``` then have "\xo>0. \x\xo. x < e * exp (Re s * x)" ``` lp15@60150 ` 1802` ``` using e by (auto simp: field_simps) ``` lp15@60150 ` 1803` ``` with e show "\no. \n\no. norm (Ln (of_nat n) / of_nat n powr s) < e" ``` lp15@60150 ` 1804` ``` apply (auto simp: norm_divide norm_powr_real divide_simps) ``` wenzelm@61942 ` 1805` ``` apply (rule_tac x="nat \exp xo\" in exI) ``` lp15@60150 ` 1806` ``` apply clarify ``` lp15@60150 ` 1807` ``` apply (drule_tac x="ln n" in spec) ``` lp15@61609 ` 1808` ``` apply (auto simp: exp_less_mono nat_ceiling_le_eq not_le) ``` lp15@60150 ` 1809` ``` apply (metis exp_less_mono exp_ln not_le of_nat_0_less_iff) ``` lp15@60150 ` 1810` ``` done ``` lp15@60150 ` 1811` ```qed ``` lp15@60150 ` 1812` wenzelm@61973 ` 1813` ```lemma lim_Ln_over_n: "((\n. Ln(of_nat n) / of_nat n) \ 0) sequentially" ``` lp15@60150 ` 1814` ``` using lim_Ln_over_power [of 1] ``` lp15@60150 ` 1815` ``` by simp ``` lp15@60150 ` 1816` wenzelm@61070 ` 1817` ```lemma Ln_Reals_eq: "x \ \ \ Re x > 0 \ Ln x = of_real (ln (Re x))" ``` lp15@60017 ` 1818` ``` using Ln_of_real by force ``` lp15@60017 ` 1819` wenzelm@61070 ` 1820` ```lemma powr_Reals_eq: "x \ \ \ Re x > 0 \ x powr complex_of_real y = of_real (x powr y)" ``` lp15@60150 ` 1821` ``` by (simp add: powr_of_real) ``` lp15@60150 ` 1822` lp15@60150 ` 1823` ```lemma lim_ln_over_power: ``` lp15@60150 ` 1824` ``` fixes s :: real ``` lp15@60150 ` 1825` ``` assumes "0 < s" ``` wenzelm@61973 ` 1826` ``` shows "((\n. ln n / (n powr s)) \ 0) sequentially" ``` lp15@60150 ` 1827` ``` using lim_Ln_over_power [of "of_real s", THEN filterlim_sequentially_Suc [THEN iffD2]] assms ``` lp15@60150 ` 1828` ``` apply (subst filterlim_sequentially_Suc [symmetric]) ``` lp15@60150 ` 1829` ``` apply (simp add: lim_sequentially dist_norm ``` lp15@61609 ` 1830` ``` Ln_Reals_eq norm_powr_real_powr norm_divide) ``` lp15@60150 ` 1831` ``` done ``` lp15@60150 ` 1832` wenzelm@61973 ` 1833` ```lemma lim_ln_over_n: "((\n. ln(real_of_nat n) / of_nat n) \ 0) sequentially" ``` lp15@60150 ` 1834` ``` using lim_ln_over_power [of 1, THEN filterlim_sequentially_Suc [THEN iffD2]] ``` lp15@60150 ` 1835` ``` apply (subst filterlim_sequentially_Suc [symmetric]) ``` lp15@61609 ` 1836` ``` apply (simp add: lim_sequentially dist_norm) ``` lp15@60150 ` 1837` ``` done ``` lp15@60150 ` 1838` lp15@60150 ` 1839` ```lemma lim_1_over_complex_power: ``` lp15@60150 ` 1840` ``` assumes "0 < Re s" ``` wenzelm@61973 ` 1841` ``` shows "((\n. 1 / (of_nat n powr s)) \ 0) sequentially" ``` lp15@60150 ` 1842` ```proof - ``` lp15@60150 ` 1843` ``` have "\n>0. 3 \ n \ 1 \ ln (real_of_nat n)" ``` lp15@60150 ` 1844` ``` using ln3_gt_1 ``` lp15@60150 ` 1845` ``` by (force intro: order_trans [of _ "ln 3"] ln3_gt_1) ``` wenzelm@61969 ` 1846` ``` moreover have "(\n. cmod (Ln (of_nat n) / of_nat n powr s)) \ 0" ``` lp15@60150 ` 1847` ``` using lim_Ln_over_power [OF assms] ``` lp15@60150 ` 1848` ``` by (metis tendsto_norm_zero_iff) ``` lp15@60150 ` 1849` ``` ultimately show ?thesis ``` lp15@60150 ` 1850` ``` apply (auto intro!: Lim_null_comparison [where g = "\n. norm (Ln(of_nat n) / of_nat n powr s)"]) ``` lp15@60150 ` 1851` ``` apply (auto simp: norm_divide divide_simps eventually_sequentially) ``` lp15@60150 ` 1852` ``` done ``` lp15@60150 ` 1853` ```qed ``` lp15@60150 ` 1854` lp15@60150 ` 1855` ```lemma lim_1_over_real_power: ``` lp15@60150 ` 1856` ``` fixes s :: real ``` lp15@60150 ` 1857` ``` assumes "0 < s" ``` wenzelm@61973 ` 1858` ``` shows "((\n. 1 / (of_nat n powr s)) \ 0) sequentially" ``` lp15@60150 ` 1859` ``` using lim_1_over_complex_power [of "of_real s", THEN filterlim_sequentially_Suc [THEN iffD2]] assms ``` lp15@60150 ` 1860` ``` apply (subst filterlim_sequentially_Suc [symmetric]) ``` lp15@60150 ` 1861` ``` apply (simp add: lim_sequentially dist_norm) ``` lp15@61609 ` 1862` ``` apply (simp add: Ln_Reals_eq norm_powr_real_powr norm_divide) ``` lp15@60150 ` 1863` ``` done ``` lp15@60150 ` 1864` wenzelm@61973 ` 1865` ```lemma lim_1_over_Ln: "((\n. 1 / Ln(of_nat n)) \ 0) sequentially" ``` lp15@60150 ` 1866` ```proof (clarsimp simp add: lim_sequentially dist_norm norm_divide divide_simps) ``` lp15@60150 ` 1867` ``` fix r::real ``` lp15@60150 ` 1868` ``` assume "0 < r" ``` lp15@60150 ` 1869` ``` have ir: "inverse (exp (inverse r)) > 0" ``` lp15@60150 ` 1870` ``` by simp ``` lp15@60150 ` 1871` ``` obtain n where n: "1 < of_nat n * inverse (exp (inverse r))" ``` lp15@60150 ` 1872` ``` using ex_less_of_nat_mult [of _ 1, OF ir] ``` lp15@60150 ` 1873` ``` by auto ``` lp15@60150 ` 1874` ``` then have "exp (inverse r) < of_nat n" ``` lp15@60150 ` 1875` ``` by (simp add: divide_simps) ``` lp15@60150 ` 1876` ``` then have "ln (exp (inverse r)) < ln (of_nat n)" ``` lp15@60150 ` 1877` ``` by (metis exp_gt_zero less_trans ln_exp ln_less_cancel_iff) ``` wenzelm@60420 ` 1878` ``` with \0 < r\ have "1 < r * ln (real_of_nat n)" ``` lp15@60150 ` 1879` ``` by (simp add: field_simps) ``` lp15@60150 ` 1880` ``` moreover have "n > 0" using n ``` lp15@60150 ` 1881` ``` using neq0_conv by fastforce ``` lp15@60150 ` 1882` ``` ultimately show "\no. \n. Ln (of_nat n) \ 0 \ no \ n \ 1 < r * cmod (Ln (of_nat n))" ``` wenzelm@60420 ` 1883` ``` using n \0 < r\ ``` lp15@60150 ` 1884` ``` apply (rule_tac x=n in exI) ``` lp15@60150 ` 1885` ``` apply (auto simp: divide_simps) ``` lp15@60150 ` 1886` ``` apply (erule less_le_trans, auto) ``` lp15@60150 ` 1887` ``` done ``` lp15@60150 ` 1888` ```qed ``` lp15@60150 ` 1889` wenzelm@61973 ` 1890` ```lemma lim_1_over_ln: "((\n. 1 / ln(real_of_nat n)) \ 0) sequentially" ``` wenzelm@63092 ` 1891` ``` using lim_1_over_Ln [THEN filterlim_sequentially_Suc [THEN iffD2]] ``` lp15@60150 ` 1892` ``` apply (subst filterlim_sequentially_Suc [symmetric]) ``` lp15@60150 ` 1893` ``` apply (simp add: lim_sequentially dist_norm) ``` lp15@61609 ` 1894` ``` apply (simp add: Ln_Reals_eq norm_powr_real_powr norm_divide) ``` lp15@60150 ` 1895` ``` done ``` lp15@60150 ` 1896` lp15@60017 ` 1897` wenzelm@60420 ` 1898` ```subsection\Relation between Square Root and exp/ln, hence its derivative\ ``` lp15@59751 ` 1899` lp15@59751 ` 1900` ```lemma csqrt_exp_Ln: ``` lp15@59751 ` 1901` ``` assumes "z \ 0" ``` lp15@59751 ` 1902` ``` shows "csqrt z = exp(Ln(z) / 2)" ``` lp15@59751 ` 1903` ```proof - ``` lp15@59751 ` 1904` ``` have "(exp (Ln z / 2))\<^sup>2 = (exp (Ln z))" ``` lp15@59751 ` 1905` ``` by (metis exp_double nonzero_mult_divide_cancel_left times_divide_eq_right zero_neq_numeral) ``` lp15@59751 ` 1906` ``` also have "... = z" ``` lp15@59751 ` 1907` ``` using assms exp_Ln by blast ``` lp15@59751 ` 1908` ``` finally have "csqrt z = csqrt ((exp (Ln z / 2))\<^sup>2)" ``` lp15@59751 ` 1909` ``` by simp ``` lp15@59751 ` 1910` ``` also have "... = exp (Ln z / 2)" ``` lp15@59751 ` 1911` ``` apply (subst csqrt_square) ``` lp15@59751 ` 1912` ``` using cos_gt_zero_pi [of "(Im (Ln z) / 2)"] Im_Ln_le_pi mpi_less_Im_Ln assms ``` lp15@59751 ` 1913` ``` apply (auto simp: Re_exp Im_exp zero_less_mult_iff zero_le_mult_iff, fastforce+) ``` lp15@59751 ` 1914` ``` done ``` lp15@59751 ` 1915` ``` finally show ?thesis using assms csqrt_square ``` lp15@59751 ` 1916` ``` by simp ``` lp15@59751 ` 1917` ```qed ``` lp15@59751 ` 1918` lp15@59751 ` 1919` ```lemma csqrt_inverse: ``` paulson@62131 ` 1920` ``` assumes "z \ \\<^sub>\\<^sub>0" ``` lp15@59751 ` 1921` ``` shows "csqrt (inverse z) = inverse (csqrt z)" ``` lp15@59751 ` 1922` ```proof (cases "z=0", simp) ``` paulson@62131 ` 1923` ``` assume "z \ 0" ``` lp15@59751 ` 1924` ``` then show ?thesis ``` paulson@62131 ` 1925` ``` using assms csqrt_exp_Ln Ln_inverse exp_minus ``` lp15@59751 ` 1926` ``` by (simp add: csqrt_exp_Ln Ln_inverse exp_minus) ``` lp15@59751 ` 1927` ```qed ``` lp15@59751 ` 1928` lp15@59751 ` 1929` ```lemma cnj_csqrt: ``` paulson@62131 ` 1930` ``` assumes "z \ \\<^sub>\\<^sub>0" ``` lp15@59751 ` 1931` ``` shows "cnj(csqrt z) = csqrt(cnj z)" ``` lp15@59751 ` 1932` ```proof (cases "z=0", simp) ``` paulson@62131 ` 1933` ``` assume "z \ 0" ``` lp15@59751 ` 1934` ``` then show ?thesis ``` lp15@62534 ` 1935` ``` by (simp add: assms cnj_Ln csqrt_exp_Ln exp_cnj) ``` lp15@59751 ` 1936` ```qed ``` lp15@59751 ` 1937` lp15@59751 ` 1938` ```lemma has_field_derivative_csqrt: ``` paulson@62131 ` 1939` ``` assumes "z \ \\<^sub>\\<^sub>0" ``` lp15@59751 ` 1940` ``` shows "(csqrt has_field_derivative inverse(2 * csqrt z)) (at z)" ``` lp15@59751 ` 1941` ```proof - ``` lp15@59751 ` 1942` ``` have z: "z \ 0" ``` lp15@59751 ` 1943` ``` using assms by auto ``` lp15@59751 ` 1944` ``` then have *: "inverse z = inverse (2*z) * 2" ``` lp15@59751 ` 1945` ``` by (simp add: divide_simps) ``` paulson@62131 ` 1946` ``` have [simp]: "exp (Ln z / 2) * inverse z = inverse (csqrt z)" ``` paulson@62131 ` 1947` ``` by (simp add: z field_simps csqrt_exp_Ln [symmetric]) (metis power2_csqrt power2_eq_square) ``` paulson@62131 ` 1948` ``` have "Im z = 0 \ 0 < Re z" ``` paulson@62131 ` 1949` ``` using assms complex_nonpos_Reals_iff not_less by blast ``` paulson@62131 ` 1950` ``` with z have "((\z. exp (Ln z / 2)) has_field_derivative inverse (2 * csqrt z)) (at z)" ``` paulson@62131 ` 1951` ``` by (force intro: derivative_eq_intros * simp add: assms) ``` paulson@62131 ` 1952` ``` then show ?thesis ``` paulson@62131 ` 1953` ``` apply (rule DERIV_transform_at[where d = "norm z"]) ``` paulson@62131 ` 1954` ``` apply (intro z derivative_eq_intros | simp add: assms)+ ``` lp15@59751 ` 1955` ``` using z ``` lp15@59751 ` 1956` ``` apply (metis csqrt_exp_Ln dist_0_norm less_irrefl) ``` lp15@59751 ` 1957` ``` done ``` lp15@59751 ` 1958` ```qed ``` lp15@59751 ` 1959` lp15@62534 ` 1960` ```lemma field_differentiable_at_csqrt: ``` lp15@62534 ` 1961` ``` "z \ \\<^sub>\\<^sub>0 \ csqrt field_differentiable at z" ``` lp15@62534 ` 1962` ``` using field_differentiable_def has_field_derivative_csqrt by blast ``` lp15@62534 ` 1963` lp15@62534 ` 1964` ```lemma field_differentiable_within_csqrt: ``` lp15@62534 ` 1965` ``` "z \ \\<^sub>\\<^sub>0 \ csqrt field_differentiable (at z within s)" ``` lp15@62534 ` 1966` ``` using field_differentiable_at_csqrt field_differentiable_within_subset by blast ``` lp15@59751 ` 1967` lp15@59751 ` 1968` ```lemma continuous_at_csqrt: ``` paulson@62131 ` 1969` ``` "z \ \\<^sub>\\<^sub>0 \ continuous (at z) csqrt" ``` lp15@62534 ` 1970` ``` by (simp add: field_differentiable_within_csqrt field_differentiable_imp_continuous_at) ``` lp15@59751 ` 1971` lp15@59862 ` 1972` ```corollary isCont_csqrt' [simp]: ``` paulson@62131 ` 1973` ``` "\isCont f z; f z \ \\<^sub>\\<^sub>0\ \ isCont (\x. csqrt (f x)) z" ``` lp15@59862 ` 1974` ``` by (blast intro: isCont_o2 [OF _ continuous_at_csqrt]) ``` lp15@59862 ` 1975` lp15@59751 ` 1976` ```lemma continuous_within_csqrt: ``` paulson@62131 ` 1977` ``` "z \ \\<^sub>\\<^sub>0 \ continuous (at z within s) csqrt" ``` lp15@62534 ` 1978` ``` by (simp add: field_differentiable_imp_continuous_at field_differentiable_within_csqrt) ``` lp15@59751 ` 1979` lp15@59751 ` 1980` ```lemma continuous_on_csqrt [continuous_intros]: ``` paulson@62131 ` 1981` ``` "(\z. z \ s \ z \ \\<^sub>\\<^sub>0) \ continuous_on s csqrt" ``` lp15@59751 ` 1982` ``` by (simp add: continuous_at_imp_continuous_on continuous_within_csqrt) ``` lp15@59751 ` 1983` lp15@59751 ` 1984` ```lemma holomorphic_on_csqrt: ``` paulson@62131 ` 1985` ``` "(\z. z \ s \ z \ \\<^sub>\\<^sub>0) \ csqrt holomorphic_on s" ``` lp15@62534 ` 1986` ``` by (simp add: field_differentiable_within_csqrt holomorphic_on_def) ``` lp15@59751 ` 1987` lp15@59751 ` 1988` ```lemma continuous_within_closed_nontrivial: ``` lp15@59751 ` 1989` ``` "closed s \ a \ s ==> continuous (at a within s) f" ``` lp15@59751 ` 1990` ``` using open_Compl ``` lp15@59751 ` 1991` ``` by (force simp add: continuous_def eventually_at_topological filterlim_iff open_Collect_neg) ``` lp15@59751 ` 1992` lp15@59751 ` 1993` ```lemma continuous_within_csqrt_posreal: ``` lp15@59751 ` 1994` ``` "continuous (at z within (\ \ {w. 0 \ Re(w)})) csqrt" ``` paulson@62131 ` 1995` ```proof (cases "z \ \\<^sub>\\<^sub>0") ``` lp15@62534 ` 1996` ``` case True ``` lp15@59751 ` 1997` ``` then have "Im z = 0" "Re z < 0 \ z = 0" ``` paulson@62131 ` 1998` ``` using cnj.code complex_cnj_zero_iff by (auto simp: complex_nonpos_Reals_iff) fastforce ``` lp15@59751 ` 1999` ``` then show ?thesis ``` lp15@59751 ` 2000` ``` apply (auto simp: continuous_within_closed_nontrivial [OF closed_Real_halfspace_Re_ge]) ``` lp15@59751 ` 2001` ``` apply (auto simp: continuous_within_eps_delta norm_conv_dist [symmetric]) ``` lp15@59751 ` 2002` ``` apply (rule_tac x="e^2" in exI) ``` lp15@59751 ` 2003` ``` apply (auto simp: Reals_def) ``` paulson@62131 ` 2004` ``` by (metis linear not_less real_sqrt_less_iff real_sqrt_pow2_iff real_sqrt_power) ``` paulson@62131 ` 2005` ```next ``` paulson@62131 ` 2006` ``` case False ``` paulson@62131 ` 2007` ``` then show ?thesis by (blast intro: continuous_within_csqrt) ``` lp15@59751 ` 2008` ```qed ``` lp15@59751 ` 2009` wenzelm@60420 ` 2010` ```subsection\Complex arctangent\ ``` wenzelm@60420 ` 2011` paulson@62131 ` 2012` ```text\The branch cut gives standard bounds in the real case.\ ``` lp15@59870 ` 2013` lp15@59870 ` 2014` ```definition Arctan :: "complex \ complex" where ``` lp15@59870 ` 2015` ``` "Arctan \ \z. (\/2) * Ln((1 - \*z) / (1 + \*z))" ``` lp15@59870 ` 2016` eberlm@62049 ` 2017` ```lemma Arctan_def_moebius: "Arctan z = \/2 * Ln (moebius (-\) 1 \ 1 z)" ``` eberlm@62049 ` 2018` ``` by (simp add: Arctan_def moebius_def add_ac) ``` eberlm@62049 ` 2019` eberlm@62049 ` 2020` ```lemma Ln_conv_Arctan: ``` eberlm@62049 ` 2021` ``` assumes "z \ -1" ``` eberlm@62049 ` 2022` ``` shows "Ln z = -2*\ * Arctan (moebius 1 (- 1) (- \) (- \) z)" ``` eberlm@62049 ` 2023` ```proof - ``` eberlm@62049 ` 2024` ``` have "Arctan (moebius 1 (- 1) (- \) (- \) z) = ``` eberlm@62049 ` 2025` ``` \/2 * Ln (moebius (- \) 1 \ 1 (moebius 1 (- 1) (- \) (- \) z))" ``` eberlm@62049 ` 2026` ``` by (simp add: Arctan_def_moebius) ``` eberlm@62049 ` 2027` ``` also from assms have "\ * z \ \ * (-1)" by (subst mult_left_cancel) simp ``` eberlm@62049 ` 2028` ``` hence "\ * z - -\ \ 0" by (simp add: eq_neg_iff_add_eq_0) ``` eberlm@62049 ` 2029` ``` from moebius_inverse'[OF _ this, of 1 1] ``` eberlm@62049 ` 2030` ``` have "moebius (- \) 1 \ 1 (moebius 1 (- 1) (- \) (- \) z) = z" by simp ``` eberlm@62049 ` 2031` ``` finally show ?thesis by (simp add: field_simps) ``` eberlm@62049 ` 2032` ```qed ``` eberlm@62049 ` 2033` lp15@59870 ` 2034` ```lemma Arctan_0 [simp]: "Arctan 0 = 0" ``` lp15@59870 ` 2035` ``` by (simp add: Arctan_def) ``` lp15@59870 ` 2036` lp15@59870 ` 2037` ```lemma Im_complex_div_lemma: "Im((1 - \*z) / (1 + \*z)) = 0 \ Re z = 0" ``` lp15@59870 ` 2038` ``` by (auto simp: Im_complex_div_eq_0 algebra_simps) ``` lp15@59870 ` 2039` lp15@59870 ` 2040` ```lemma Re_complex_div_lemma: "0 < Re((1 - \*z) / (1 + \*z)) \ norm z < 1" ``` lp15@59870 ` 2041` ``` by (simp add: Re_complex_div_gt_0 algebra_simps cmod_def power2_eq_square) ``` lp15@59870 ` 2042` lp15@59870 ` 2043` ```lemma tan_Arctan: ``` lp15@59870 ` 2044` ``` assumes "z\<^sup>2 \ -1" ``` lp15@59870 ` 2045` ``` shows [simp]:"tan(Arctan z) = z" ``` lp15@59870 ` 2046` ```proof - ``` lp15@59870 ` 2047` ``` have "1 + \*z \ 0" ``` lp15@59870 ` 2048` ``` by (metis assms complex_i_mult_minus i_squared minus_unique power2_eq_square power2_minus) ``` lp15@59870 ` 2049` ``` moreover ``` lp15@59870 ` 2050` ``` have "1 - \*z \ 0" ``` lp15@59870 ` 2051` ``` by (metis assms complex_i_mult_minus i_squared power2_eq_square power2_minus right_minus_eq) ``` lp15@59870 ` 2052` ``` ultimately ``` lp15@59870 ` 2053` ``` show ?thesis ``` lp15@59870 ` 2054` ``` by (simp add: Arctan_def tan_def sin_exp_eq cos_exp_eq exp_minus csqrt_exp_Ln [symmetric] ``` lp15@59870 ` 2055` ``` divide_simps power2_eq_square [symmetric]) ``` lp15@59870 ` 2056` ```qed ``` lp15@59870 ` 2057` lp15@59870 ` 2058` ```lemma Arctan_tan [simp]: ``` lp15@59870 ` 2059` ``` assumes "\Re z\ < pi/2" ``` lp15@59870 ` 2060` ``` shows "Arctan(tan z) = z" ``` lp15@59870 ` 2061` ```proof - ``` wenzelm@61945 ` 2062` ``` have ge_pi2: "\n::int. \of_int (2*n + 1) * pi/2\ \ pi/2" ``` lp15@59870 ` 2063` ``` by (case_tac n rule: int_cases) (auto simp: abs_mult) ``` lp15@59870 ` 2064` ``` have "exp (\*z)*exp (\*z) = -1 \ exp (2*\*z) = -1" ``` lp15@59870 ` 2065` ``` by (metis distrib_right exp_add mult_2) ``` lp15@59870 ` 2066` ``` also have "... \ exp (2*\*z) = exp (\*pi)" ``` lp15@59870 ` 2067` ``` using cis_conv_exp cis_pi by auto ``` lp15@59870 ` 2068` ``` also have "... \ exp (2*\*z - \*pi) = 1" ``` lp15@59870 ` 2069` ``` by (metis (no_types) diff_add_cancel diff_minus_eq_add exp_add exp_minus_inverse mult.commute) ``` lp15@59870 ` 2070` ``` also have "... \ Re(\*2*z - \*pi) = 0 \ (\n::int. Im(\*2*z - \*pi) = of_int (2 * n) * pi)" ``` lp15@59870 ` 2071` ``` by (simp add: exp_eq_1) ``` lp15@59870 ` 2072` ``` also have "... \ Im z = 0 \ (\n::int. 2 * Re z = of_int (2*n + 1) * pi)" ``` lp15@59870 ` 2073` ``` by (simp add: algebra_simps) ``` lp15@59870 ` 2074` ``` also have "... \ False" ``` lp15@59870 ` 2075` ``` using assms ge_pi2 ``` lp15@59870 ` 2076` ``` apply (auto simp: algebra_simps) ``` lp15@61609 ` 2077` ``` by (metis abs_mult_pos not_less of_nat_less_0_iff of_nat_numeral) ``` lp15@59870 ` 2078` ``` finally have *: "exp (\*z)*exp (\*z) + 1 \ 0" ``` lp15@59870 ` 2079` ``` by (auto simp: add.commute minus_unique) ``` lp15@59870 ` 2080` ``` show ?thesis ``` lp15@59870 ` 2081` ``` using assms * ``` lp15@59870 ` 2082` ``` apply (simp add: Arctan_def tan_def sin_exp_eq cos_exp_eq exp_minus divide_simps ``` lp15@59870 ` 2083` ``` ii_times_eq_iff power2_eq_square [symmetric]) ``` lp15@59870 ` 2084` ``` apply (rule Ln_unique) ``` lp15@59870 ` 2085` ``` apply (auto simp: divide_simps exp_minus) ``` lp15@59870 ` 2086` ``` apply (simp add: algebra_simps exp_double [symmetric]) ``` lp15@59870 ` 2087` ``` done ``` lp15@59870 ` 2088` ```qed ``` lp15@59870 ` 2089` lp15@59870 ` 2090` ```lemma ``` wenzelm@61945 ` 2091` ``` assumes "Re z = 0 \ \Im z\ < 1" ``` wenzelm@61945 ` 2092` ``` shows Re_Arctan_bounds: "\Re(Arctan z)\ < pi/2" ``` lp15@59870 ` 2093` ``` and has_field_derivative_Arctan: "(Arctan has_field_derivative inverse(1 + z\<^sup>2)) (at z)" ``` lp15@59870 ` 2094` ```proof - ``` lp15@59870 ` 2095` ``` have nz0: "1 + \*z \ 0" ``` lp15@59870 ` 2096` ``` using assms ``` lp15@60141 ` 2097` ``` by (metis abs_one complex_i_mult_minus diff_0_right diff_minus_eq_add ii.simps(1) ii.simps(2) ``` lp15@59870 ` 2098` ``` less_irrefl minus_diff_eq mult.right_neutral right_minus_eq) ``` lp15@59870 ` 2099` ``` have "z \ -\" using assms ``` lp15@59870 ` 2100` ``` by auto ``` lp15@59870 ` 2101` ``` then have zz: "1 + z * z \ 0" ``` lp15@59870 ` 2102` ``` by (metis abs_one assms i_squared ii.simps less_irrefl minus_unique square_eq_iff) ``` lp15@59870 ` 2103` ``` have nz1: "1 - \*z \ 0" ``` lp15@59870 ` 2104` ``` using assms by (force simp add: ii_times_eq_iff) ``` lp15@59870 ` 2105` ``` have nz2: "inverse (1 + \*z) \ 0" ``` lp15@59870 ` 2106` ``` using assms ``` lp15@59870 ` 2107` ``` by (metis Im_complex_div_lemma Re_complex_div_lemma cmod_eq_Im divide_complex_def ``` lp15@59870 ` 2108` ``` less_irrefl mult_zero_right zero_complex.simps(1) zero_complex.simps(2)) ``` lp15@59870 ` 2109` ``` have nzi: "((1 - \*z) * inverse (1 + \*z)) \ 0" ``` lp15@59870 ` 2110` ``` using nz1 nz2 by auto ``` paulson@62131 ` 2111` ``` have "Im ((1 - \*z) / (1 + \*z)) = 0 \ 0 < Re ((1 - \*z) / (1 + \*z))" ``` lp15@59870 ` 2112` ``` apply (simp add: divide_complex_def) ``` nipkow@62390 ` 2113` ``` apply (simp add: divide_simps split: if_split_asm) ``` lp15@59870 ` 2114` ``` using assms ``` lp15@59870 ` 2115` ``` apply (auto simp: algebra_simps abs_square_less_1 [unfolded power2_eq_square]) ``` lp15@59870 ` 2116` ``` done ``` paulson@62131 ` 2117` ``` then have *: "((1 - \*z) / (1 + \*z)) \ \\<^sub>\\<^sub>0" ``` paulson@62131 ` 2118` ``` by (auto simp add: complex_nonpos_Reals_iff) ``` wenzelm@61945 ` 2119` ``` show "\Re(Arctan z)\ < pi/2" ``` lp15@59870 ` 2120` ``` unfolding Arctan_def divide_complex_def ``` lp15@59870 ` 2121` ``` using mpi_less_Im_Ln [OF nzi] ``` paulson@62131 ` 2122` ``` apply (auto simp: abs_if intro!: Im_Ln_less_pi * [unfolded divide_complex_def]) ``` paulson@62131 ` 2123` ``` done ``` lp15@59870 ` 2124` ``` show "(Arctan has_field_derivative inverse(1 + z\<^sup>2)) (at z)" ``` lp15@59870 ` 2125` ``` unfolding Arctan_def scaleR_conv_of_real ``` lp15@59870 ` 2126` ``` apply (rule DERIV_cong) ``` lp15@59870 ` 2127` ``` apply (intro derivative_eq_intros | simp add: nz0 *)+ ``` lp15@59870 ` 2128` ``` using nz0 nz1 zz ``` lp15@59870 ` 2129` ``` apply (simp add: divide_simps power2_eq_square) ``` lp15@59870 ` 2130` ``` apply (auto simp: algebra_simps) ``` lp15@59870 ` 2131` ``` done ``` lp15@59870 ` 2132` ```qed ``` lp15@59870 ` 2133` lp15@62534 ` 2134` ```lemma field_differentiable_at_Arctan: "(Re z = 0 \ \Im z\ < 1) \ Arctan field_differentiable at z" ``` lp15@59870 ` 2135` ``` using has_field_derivative_Arctan ``` lp15@62534 ` 2136` ``` by (auto simp: field_differentiable_def) ``` lp15@62534 ` 2137` lp15@62534 ` 2138` ```lemma field_differentiable_within_Arctan: ``` lp15@62534 ` 2139` ``` "(Re z = 0 \ \Im z\ < 1) \ Arctan field_differentiable (at z within s)" ``` lp15@62534 ` 2140` ``` using field_differentiable_at_Arctan field_differentiable_at_within by blast ``` lp15@59870 ` 2141` lp15@59870 ` 2142` ```declare has_field_derivative_Arctan [derivative_intros] ``` lp15@59870 ` 2143` ```declare has_field_derivative_Arctan [THEN DERIV_chain2, derivative_intros] ``` lp15@59870 ` 2144` lp15@59870 ` 2145` ```lemma continuous_at_Arctan: ``` wenzelm@61945 ` 2146` ``` "(Re z = 0 \ \Im z\ < 1) \ continuous (at z) Arctan" ``` lp15@62534 ` 2147` ``` by (simp add: field_differentiable_imp_continuous_at field_differentiable_within_Arctan) ``` lp15@59870 ` 2148` lp15@59870 ` 2149` ```lemma continuous_within_Arctan: ``` wenzelm@61945 ` 2150` ``` "(Re z = 0 \ \Im z\ < 1) \ continuous (at z within s) Arctan" ``` lp15@59870 ` 2151` ``` using continuous_at_Arctan continuous_at_imp_continuous_within by blast ``` lp15@59870 ` 2152` lp15@59870 ` 2153` ```lemma continuous_on_Arctan [continuous_intros]: ``` wenzelm@61945 ` 2154` ``` "(\z. z \ s \ Re z = 0 \ \Im z\ < 1) \ continuous_on s Arctan" ``` lp15@59870 ` 2155` ``` by (auto simp: continuous_at_imp_continuous_on continuous_within_Arctan) ``` lp15@59870 ` 2156` lp15@59870 ` 2157` ```lemma holomorphic_on_Arctan: ``` wenzelm@61945 ` 2158` ``` "(\z. z \ s \ Re z = 0 \ \Im z\ < 1) \ Arctan holomorphic_on s" ``` lp15@62534 ` 2159` ``` by (simp add: field_differentiable_within_Arctan holomorphic_on_def) ``` lp15@59870 ` 2160` eberlm@62049 ` 2161` ```lemma Arctan_series: ``` eberlm@62049 ` 2162` ``` assumes z: "norm (z :: complex) < 1" ``` eberlm@62049 ` 2163` ``` defines "g \ \n. if odd n then -\*\^n / n else 0" ``` eberlm@62049 ` 2164` ``` defines "h \ \z n. (-1)^n / of_nat (2*n+1) * (z::complex)^(2*n+1)" ``` eberlm@62049 ` 2165` ``` shows "(\n. g n * z^n) sums Arctan z" ``` eberlm@62049 ` 2166` ``` and "h z sums Arctan z" ``` eberlm@62049 ` 2167` ```proof - ``` wenzelm@63040 ` 2168` ``` define G where [abs_def]: "G z = (\n. g n * z^n)" for z ``` eberlm@62049 ` 2169` ``` have summable: "summable (\n. g n * u^n)" if "norm u < 1" for u ``` eberlm@62049 ` 2170` ``` proof (cases "u = 0") ``` eberlm@62049 ` 2171` ``` assume u: "u \ 0" ``` lp15@62534 ` 2172` ``` have "(\n. ereal (norm (h u n) / norm (h u (Suc n)))) = (\n. ereal (inverse (norm u)^2) * ``` eberlm@62049 ` 2173` ``` ereal ((2 + inverse (real (Suc n))) / (2 - inverse (real (Suc n)))))" ``` eberlm@62049 ` 2174` ``` proof ``` eberlm@62049 ` 2175` ``` fix n ``` lp15@62534 ` 2176` ``` have "ereal (norm (h u n) / norm (h u (Suc n))) = ``` lp15@62534 ` 2177` ``` ereal (inverse (norm u)^2) * ereal ((of_nat (2*Suc n+1) / of_nat (Suc n)) / ``` eberlm@62049 ` 2178` ``` (of_nat (2*Suc n-1) / of_nat (Suc n)))" ``` lp15@62534 ` 2179` ``` by (simp add: h_def norm_mult norm_power norm_divide divide_simps ``` eberlm@62049 ` 2180` ``` power2_eq_square eval_nat_numeral del: of_nat_add of_nat_Suc) ``` eberlm@62049 ` 2181` ``` also have "of_nat (2*Suc n+1) / of_nat (Suc n) = (2::real) + inverse (real (Suc n))" ``` eberlm@62049 ` 2182` ``` by (auto simp: divide_simps simp del: of_nat_Suc) simp_all? ``` eberlm@62049 ` 2183` ``` also have "of_nat (2*Suc n-1) / of_nat (Suc n) = (2::real) - inverse (real (Suc n))" ``` lp15@62534 ` 2184` ``` by (auto simp: divide_simps simp del: of_nat_Suc) simp_all? ``` lp15@62534 ` 2185` ``` finally show "ereal (norm (h u n) / norm (h u (Suc n))) = ereal (inverse (norm u)^2) * ``` eberlm@62049 ` 2186` ``` ereal ((2 + inverse (real (Suc n))) / (2 - inverse (real (Suc n))))" . ``` eberlm@62049 ` 2187` ``` qed ``` eberlm@62049 ` 2188` ``` also have "\ \ ereal (inverse (norm u)^2) * ereal ((2 + 0) / (2 - 0))" ``` eberlm@62049 ` 2189` ``` by (intro tendsto_intros LIMSEQ_inverse_real_of_nat) simp_all ``` eberlm@62049 ` 2190` ``` finally have "liminf (\n. ereal (cmod (h u n) / cmod (h u (Suc n)))) = inverse (norm u)^2" ``` eberlm@62049 ` 2191` ``` by (intro lim_imp_Liminf) simp_all ``` eberlm@62049 ` 2192` ``` moreover from power_strict_mono[OF that, of 2] u have "inverse (norm u)^2 > 1" ``` eberlm@62049 ` 2193` ``` by (simp add: divide_simps) ``` eberlm@62049 ` 2194` ``` ultimately have A: "liminf (\n. ereal (cmod (h u n) / cmod (h u (Suc n)))) > 1" by simp ``` eberlm@62049 ` 2195` ``` from u have "summable (h u)" ``` eberlm@62049 ` 2196` ``` by (intro summable_norm_cancel[OF ratio_test_convergence[OF _ A]]) ``` lp15@62534 ` 2197` ``` (auto simp: h_def norm_divide norm_mult norm_power simp del: of_nat_Suc ``` eberlm@62049 ` 2198` ``` intro!: mult_pos_pos divide_pos_pos always_eventually) ``` eberlm@62049 ` 2199` ``` thus "summable (\n. g n * u^n)" ``` eberlm@62049 ` 2200` ``` by (subst summable_mono_reindex[of "\n. 2*n+1", symmetric]) ``` eberlm@62049 ` 2201` ``` (auto simp: power_mult subseq_def g_def h_def elim!: oddE) ``` eberlm@62049 ` 2202` ``` qed (simp add: h_def) ``` eberlm@62049 ` 2203` eberlm@62049 ` 2204` ``` have "\c. \u\ball 0 1. Arctan u - G u = c" ``` eberlm@62049 ` 2205` ``` proof (rule has_field_derivative_zero_constant) ``` eberlm@62049 ` 2206` ``` fix u :: complex assume "u \ ball 0 1" ``` eberlm@62049 ` 2207` ``` hence u: "norm u < 1" by (simp add: dist_0_norm) ``` wenzelm@63040 ` 2208` ``` define K where "K = (norm u + 1) / 2" ``` eberlm@62049 ` 2209` ``` from u and abs_Im_le_cmod[of u] have Im_u: "\Im u\ < 1" by linarith ``` eberlm@62049 ` 2210` ``` from u have K: "0 \ K" "norm u < K" "K < 1" by (simp_all add: K_def) ``` eberlm@62049 ` 2211` ``` hence "(G has_field_derivative (\n. diffs g n * u ^ n)) (at u)" unfolding G_def ``` eberlm@62049 ` 2212` ``` by (intro termdiffs_strong[of _ "of_real K"] summable) simp_all ``` eberlm@62049 ` 2213` ``` also have "(\n. diffs g n * u^n) = (\n. if even n then (\*u)^n else 0)" ``` eberlm@62049 ` 2214` ``` by (intro ext) (simp_all del: of_nat_Suc add: g_def diffs_def power_mult_distrib) ``` eberlm@62049 ` 2215` ``` also have "suminf \ = (\n. (-(u^2))^n)" ``` lp15@62534 ` 2216` ``` by (subst suminf_mono_reindex[of "\n. 2*n", symmetric]) ``` eberlm@62049 ` 2217` ``` (auto elim!: evenE simp: subseq_def power_mult power_mult_distrib) ``` eberlm@62049 ` 2218` ``` also from u have "norm u^2 < 1^2" by (intro power_strict_mono) simp_all ``` lp15@62534 ` 2219` ``` hence "(\n. (-(u^2))^n) = inverse (1 + u^2)" ``` eberlm@62049 ` 2220` ``` by (subst suminf_geometric) (simp_all add: norm_power inverse_eq_divide) ``` eberlm@62049 ` 2221` ``` finally have "(G has_field_derivative inverse (1 + u\<^sup>2)) (at u)" . ``` eberlm@62049 ` 2222` ``` from DERIV_diff[OF has_field_derivative_Arctan this] Im_u u ``` eberlm@62049 ` 2223` ``` show "((\u. Arctan u - G u) has_field_derivative 0) (at u within ball 0 1)" ``` eberlm@62049 ` 2224` ``` by (simp_all add: dist_0_norm at_within_open[OF _ open_ball]) ``` eberlm@62049 ` 2225` ``` qed simp_all ``` eberlm@62049 ` 2226` ``` then obtain c where c: "\u. norm u < 1 \ Arctan u - G u = c" by (auto simp: dist_0_norm) ``` eberlm@62049 ` 2227` ``` from this[of 0] have "c = 0" by (simp add: G_def g_def powser_zero) ``` eberlm@62049 ` 2228` ``` with c z have "Arctan z = G z" by simp ``` eberlm@62049 ` 2229` ``` with summable[OF z] show "(\n. g n * z^n) sums Arctan z" unfolding G_def by (simp add: sums_iff) ``` eberlm@62049 ` 2230` ``` thus "h z sums Arctan z" by (subst (asm) sums_mono_reindex[of "\n. 2*n+1", symmetric]) ``` eberlm@62049 ` 2231` ``` (auto elim!: oddE simp: subseq_def power_mult g_def h_def) ``` eberlm@62049 ` 2232` ```qed ``` eberlm@62049 ` 2233` eberlm@62049 ` 2234` ```text \A quickly-converging series for the logarithm, based on the arctangent.\ ```