text‹By John Harrison et al. Ported from HOL Light by L C Paulson (2015)›
theory Complex_Transcendental imports
Complex_Analysis_Basics Summation_Tests "HOL-Library.Periodic_Fun" begin
subsection‹Möbius transformations›
(* TODO: Figure out what to do with Möbius transformations *) definition✐‹tag important›"moebius a b c d ≡ (λz. (a*z+b) / (c*z+d :: 'a :: field))"
theorem moebius_inverse: assumes"a * d ≠ b * c""c * z + d ≠ 0" shows"moebius d (-b) (-c) a (moebius a b c d z) = z" proof - from assms have"(-c) * moebius a b c d z + a ≠ 0"unfolding moebius_def by (simp add: field_simps) with assms show ?thesis unfolding moebius_def by (simp add: moebius_def divide_simps) (simp add: algebra_simps)? qed
lemma moebius_inverse': assumes"a * d ≠ b * c""c * z - a ≠ 0" shows"moebius a b c d (moebius d (-b) (-c) a z) = z" using assms moebius_inverse[of d a "-b""-c" z] by (auto simp: algebra_simps)
lemma cmod_add_real_less: assumes"Im z ≠ 0""r≠0" shows"cmod (z + r) < cmod z + ∣r∣" proof (cases z) case (Complex x y) thenhave"0 < y * y" using assms mult_neg_neg by force with assms have"r * x / ∣r∣ < sqrt (x*x + y*y)" by (simp add: real_less_rsqrt power2_eq_square) thenshow ?thesis using assms Complex apply (simp add: cmod_def) apply (rule power2_less_imp_less, auto) apply (simp add: power2_eq_square field_simps) done qed
lemma cmod_diff_real_less: "Im z ≠ 0 ==> x≠0 ==> cmod (z - x) < cmod z + ∣x∣" using cmod_add_real_less [of z "-x"] by simp
lemma cmod_square_less_1_plus: assumes"Im z = 0 ==>∣Re z∣ < 1" shows"(cmod z)2 < 1 + cmod (1 - z2)" proof (cases "Im z = 0 ∨ Re z = 0") case True with assms abs_square_less_1 show ?thesis by (force simp add: Re_power2 Im_power2 cmod_def) next case False with cmod_diff_real_less [of "1 - z2""1"] show ?thesis by (simp add: norm_power Im_power2) qed
lemma norm_exp_imaginary: "norm(exp z) = 1 ==> Re z = 0" by simp
lemma field_differentiable_within_exp: "exp field_differentiable (at z within s)" using DERIV_exp field_differentiable_at_within field_differentiable_def by blast
lemma continuous_within_exp: fixes z::"'a::{real_normed_field,banach}" shows"continuous (at z within s) exp" by (simp add: continuous_at_imp_continuous_within)
lemma assumes"0\<le>u""u\<le>1" showscmod_sin_le_exp:"cmod(sin(u*\<^sub>Rz))\<le>exp\<bar>Imz\<bar>" andcmod_cos_le_exp:"cmod(cos(u*\<^sub>Rz))\<le>exp\<bar>Imz\<bar>" proof- havemono:"\<And>uwz::real.w\<le>u\<Longrightarrow>z\<le>u\<Longrightarrow>(w+z)/2\<le>u" bysimp have*:"(cmod(exp(\<i>*(u*z)))+cmod(exp(-(\<i>*(u*z)))))/2\<le>exp\<bar>Imz\<bar>" proof(rulemono) show"cmod(exp(\<i>*(u*z)))\<le>exp\<bar>Imz\<bar>" usingassms by(autosimp:abs_ifmult_left_le_one_lenot_lessintro:order_trans[of_0]) show"cmod(exp(-(\<i>*(u*z))))\<le>exp\<bar>Imz\<bar>" usingassms by(autosimp:abs_ifmult_left_le_one_lemult_nonneg_nonposintro:order_trans[of_0]) qed have"cmod(sin(u*\<^sub>Rz))=cmod(exp(\<i>*(u*z))-exp(-(\<i>*(u*z))))/2" by(autosimp:scaleR_conv_of_realnorm_multnorm_powersin_exp_eqnorm_divide) alsohave"\<dots>\<le>(cmod(exp(\<i>*(u*z)))+cmod(exp(-(\<i>*(u*z)))))/2" by(introdivide_right_mononorm_triangle_ineq4)simp alsohave"\<dots>\<le>exp\<bar>Imz\<bar>"
by (rule *) finallyshow"cmod (sin (u *R z)) ≤ exp ∣Im z∣" . have"cmod (cos (u *R z)) = cmod (exp (i * (u * z)) + exp (- (i * (u * z)))) / 2" by (auto simp: scaleR_conv_of_real norm_mult norm_power cos_exp_eq norm_divide) alsohave"…≤ (cmod (exp (i * (u * z))) + cmod (exp (- (i * (u * z)))) ) / 2" by (intro divide_right_mono norm_triangle_ineq) simp alsohave"…≤ exp ∣Im z∣" by (rule *) finallyshow"cmod (cos (u *R z)) ≤ exp ∣Im z∣" . qed
lemma Taylor_sin: "norm(sin z - (∑k≤n. complex_of_real (sin_coeff k) * z ^ k)) ≤ exp∣Im z∣ * (norm z) ^ (Suc n) / (fact n)" proof - have mono: "∧u w z::real. w ≤ u ==> z ≤ u ==> w + z ≤ u*2" by arith have *: "cmod (sin z - (∑i≤n. (-1) ^ (i div 2) * (if even i then sin 0 else cos 0) * z ^ i / (fact i))) ≤ exp ∣Im z∣ * cmod z ^ Suc n / (fact n)" proof (rule complex_Taylor [of "closed_segment 0 z" n "λk x. (-1)^(k div 2) * (if even k then sin x else cos x)" "exp∣Im z∣"0 z, simplified]) fix k x show"((λx. (- 1) ^ (k div 2) * (if even k then sin x else cos x)) has_field_derivative (- 1) ^ (Suc k div 2) * (if odd k then sin x else cos x)) (at x within closed_segment 0 z)" by (cases "even k") (intro derivative_eq_intros | simp add: power_Suc)+ next fix x assume"x ∈ closed_segment 0 z" thenshow"cmod ((- 1) ^ (Suc n div 2) * (if odd n then sin x else cos x)) ≤ exp ∣Im z∣" by (auto simp: closed_segment_def norm_mult norm_power cmod_sin_le_exp cmod_cos_le_exp) qed have **: "∧k. complex_of_real (sin_coeff k) * z ^ k = (-1)^(k div 2) * (if even k then sin 0 else cos 0) * z^k / of_nat (fact k)" by (auto simp: sin_coeff_def elim!: oddE) show ?thesis by (simp add: ** order_trans [OF _ *]) qed
lemma Taylor_cos: "norm(cos z - (∑k≤n. complex_of_real (cos_coeff k) * z ^ k)) ≤ exp∣Im z∣ * (norm z) ^ Suc n / (fact n)" proof - have mono: "∧u w z::real. w ≤ u ==> z ≤ u ==> w + z ≤ u*2" by arith have *: "cmod (cos z - (∑i≤n. (-1) ^ (Suc i div 2) * (if even i then cos 0 else sin 0) * z ^ i / (fact i))) ≤ exp ∣Im z∣ * cmod z ^ Suc n / (fact n)" 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, simplified]) fix k x assume"x ∈ closed_segment 0 z""k ≤ n" show"((λx. (- 1) ^ (Suc k div 2) * (if even k then cos x else sin x)) has_field_derivative (- 1) ^ Suc (k div 2) * (if odd k then cos x else sin x)) (at x within closed_segment 0 z)" by (cases "even k") (intro derivative_eq_intros | simp add: power_Suc)+ next fix x assume"x ∈ closed_segment 0 z" thenshow"cmod ((- 1) ^ Suc (n div 2) * (if odd n then cos x else sin x)) ≤ exp ∣Im z∣" by (auto simp: closed_segment_def norm_mult norm_power cmod_sin_le_exp cmod_cos_le_exp) qed have **: "∧k. complex_of_real (cos_coeff k) * z ^ k = (-1)^(Suc k div 2) * (if even k then cos 0 else sin 0) * z^k / of_nat (fact k)" by (auto simp: cos_coeff_def elim!: evenE) show ?thesis by (simp add: ** order_trans [OF _ *]) qed
text‹Apparently redundant. But many arguments involve integers.› lemma ln3_gt_1: "ln 3 > (1::real)" by (simp add: less_trans [OF ln_272_gt_1])
subsection‹The argument of a complex number (HOL Light version)›
definition✐‹tag important› is_Arg :: "[complex,real] → bool" where"is_Arg z r ≡ z = of_real(norm z) * exp(i * of_real r)"
definition✐‹tag important› Arg2pi :: "complex → real" where"Arg2pi z ≡ if z = 0 then 0 else THE t. 0 ≤ t ∧ t < 2*pi ∧ is_Arg z t"
lemma is_Arg_2pi_iff: "is_Arg z (r + of_int k * (2 * pi)) ⟷ is_Arg z r" by (simp add: algebra_simps is_Arg_def)
lemma is_Arg_eqI: assumes"is_Arg z r"and"is_Arg z s"and"abs (r-s) < 2*pi"and"z ≠ 0" shows"r = s" using assms unfolding is_Arg_def by (metis Im_i_times Re_complex_of_real exp_complex_eqI mult_cancel_left mult_eq_0_iff)
text‹This function returns the angle of a complex number from its representation in polar coordinates.
to periodicity, its range is arbitrary. term‹Arg2pi› follows HOL Light in adopting the interval ‹[0,2π)›.
we have the same periodicity issue with logarithms, and it is usual to adopt the same interval
the complex logarithm and argument functions. Further on down, we shall define both functions for the interval ‹(-π,π]›.
present version is provided for compatibility.›
lemma Arg2pi_0 [simp]: "Arg2pi(0) = 0" by (simp add: Arg2pi_def)
lemma Arg2pi_unique_lemma: assumes"is_Arg z t" and"is_Arg z t'" and"0 ≤ t""t < 2*pi" and"0 ≤ t'""t' < 2*pi" and"z ≠ 0" shows"t' = t" using is_Arg_eqI assms by force
lemma Arg2pi: "0 ≤ Arg2pi z ∧ Arg2pi z < 2*pi ∧ is_Arg z (Arg2pi z)" proof (cases "z=0") case True thenshow ?thesis by (simp add: Arg2pi_def is_Arg_def) next case False obtain t where t: "0 ≤ t""t < 2*pi" and ReIm: "Re z / cmod z = cos t""Im z / cmod z = sin t" using sincos_total_2pi [OF complex_unit_circle [OF False]] by blast thenhave z: "is_Arg z t" unfolding is_Arg_def using t False ReIm by (intro complex_eqI) (auto simp: exp_Euler sin_of_real cos_of_real field_split_simps) show ?thesis apply (simp add: Arg2pi_def False) apply (rule theI [where a=t]) using t z False apply (auto intro: Arg2pi_unique_lemma) done qed
corollary✐‹tag unimportant› shows Arg2pi_ge_0: "0 ≤ Arg2pi z" and Arg2pi_lt_2pi: "Arg2pi z < 2*pi" and Arg2pi_eq: "z = of_real(norm z) * exp(i * of_real(Arg2pi z))" using Arg2pi is_Arg_def by auto
lemma Arg2pi_unique: "[of_real r * exp(i * of_real a) = z; 0 < r; 0 ≤ a; a < 2*pi]==> Arg2pi z = a" by (rule Arg2pi_unique_lemma [unfolded is_Arg_def, OF _ Arg2pi_eq]) (use Arg2pi [of z] in‹auto simp: norm_mult›)
lemma cos_Arg2pi: "cmod z * cos (Arg2pi z) = Re z"and sin_Arg2pi: "cmod z * sin (Arg2pi z) = Im z" using Arg2pi_eq [of z] cis_conv_exp Re_rcis Im_rcis unfolding rcis_def by metis+
lemma Arg2pi_minus: assumes"z ≠ 0"shows"Arg2pi (-z) = (if Arg2pi z < pi then Arg2pi z + pi else Arg2pi z - pi)" apply (rule Arg2pi_unique [of "norm z", OF complex_eqI]) using cos_Arg2pi sin_Arg2pi Arg2pi_ge_0 Arg2pi_lt_2pi [of z] assms by (auto simp: Re_exp Im_exp)
lemma Arg2pi_times_of_real2 [simp]: "0 < r ==> Arg2pi (z * of_real r) = Arg2pi z" by (metis Arg2pi_times_of_real mult.commute)
lemma Arg2pi_divide_of_real [simp]: "0 < r ==> Arg2pi (z / of_real r) = Arg2pi z" by (metis Arg2pi_times_of_real2 less_irrefl nonzero_eq_divide_eq of_real_eq_0_iff)
lemma Arg2pi_le_pi: "Arg2pi z ≤ pi ⟷ 0 ≤ Im z" proof (cases "z=0") case False have"0 ≤ Im z ⟷ 0 ≤ Im (of_real (cmod z) * exp (i * complex_of_real (Arg2pi z)))" by (metis Arg2pi_eq) alsohave"… = (0 ≤ Im (exp (i * complex_of_real (Arg2pi z))))" using False by (simp add: zero_le_mult_iff) alsohave"…⟷ Arg2pi z ≤ pi" by (simp add: Im_exp) (metis Arg2pi_ge_0 Arg2pi_lt_2pi sin_lt_zero sin_ge_zero not_le) finallyshow ?thesis by blast qed auto
lemma Arg2pi_lt_pi: "0 < Arg2pi z ∧ Arg2pi z < pi ⟷ 0 < Im z" using Arg2pi_le_pi [of z] by (smt (verit, del_insts) Arg2pi_0 Arg2pi_le_pi Arg2pi_minus uminus_complex.simps(2) zero_complex.simps(2))
lemma Arg2pi_eq_0: "Arg2pi z = 0 ⟷ z ∈ℝ∧ 0 ≤ Re z" proof (cases "z=0") case False thenhave"z ∈ℝ∧ 0 ≤ Re z ⟷ z ∈ℝ∧ 0 ≤ Re (exp (i * complex_of_real (Arg2pi z)))" by (metis cis.sel(1) cis_conv_exp cos_Arg2pi norm_ge_zero norm_le_zero_iff zero_le_mult_iff) alsohave"…⟷ Arg2pi z = 0" proof - have [simp]: "Arg2pi z = 0 ==> z ∈ℝ" using Arg2pi_eq [of z] by (auto simp: Reals_def) moreoverhave"[z ∈ℝ; 0 ≤ cos (Arg2pi z)]==> Arg2pi z = 0" by (smt (verit, ccfv_SIG) Arg2pi_ge_0 Arg2pi_le_pi Arg2pi_lt_pi complex_is_Real_iff cos_pi) ultimatelyshow ?thesis by (auto simp: Re_exp) qed finallyshow ?thesis by blast qed auto
corollary✐‹tag unimportant› Arg2pi_gt_0: assumes"z ∉ℝ\<ge>0" shows"Arg2pi z > 0" using Arg2pi_eq_0 Arg2pi_ge_0 assms dual_order.strict_iff_order unfolding nonneg_Reals_def by fastforce
lemma Arg2pi_eq_pi: "Arg2pi z = pi ⟷ z ∈ℝ∧ Re z < 0" using Arg2pi_le_pi [of z] Arg2pi_lt_pi [of z] Arg2pi_eq_0 [of z] Arg2pi_ge_0 [of z] by (fastforce simp: complex_is_Real_iff)
lemma Arg2pi_eq_0_pi: "Arg2pi z = 0 ∨ Arg2pi z = pi ⟷ z ∈ℝ" using Arg2pi_eq_0 Arg2pi_eq_pi not_le by auto
lemma Arg2pi_of_real: "Arg2pi (of_real r) = (if r<0 then pi else 0)" using Arg2pi_eq_0_pi Arg2pi_eq_pi by fastforce
lemma Arg2pi_real: "z ∈ℝ==> Arg2pi z = (if 0 ≤ Re z then 0 else pi)" using Arg2pi_eq_0 Arg2pi_eq_0_pi by auto
lemma Arg2pi_inverse: "Arg2pi(inverse z) = (if z ∈ℝ then Arg2pi z else 2*pi - Arg2pi z)" proof (cases "z=0") case False show ?thesis apply (rule Arg2pi_unique [of "inverse (norm z)"]) using Arg2pi_eq False Arg2pi_ge_0 [of z] Arg2pi_lt_2pi [of z] Arg2pi_eq_0 [of z] by (auto simp: Arg2pi_real in_Reals_norm exp_diff field_simps) qed auto
lemma Arg2pi_eq_iff: assumes"w ≠ 0""z ≠ 0" shows"Arg2pi w = Arg2pi z ⟷ (∃x. 0 < x ∧ w = of_real x * z)" (is"?lhs = ?rhs") proof assume ?lhs thenhave"(cmod w) * (z / cmod z) = w" by (metis Arg2pi_eq assms(2) mult_eq_0_iff nonzero_mult_div_cancel_left) thenshow ?rhs by (metis assms divide_pos_pos of_real_divide times_divide_eq_left times_divide_eq_right zero_less_norm_iff) qed auto
lemma Arg2pi_inverse_eq_0: "Arg2pi(inverse z) = 0 ⟷ Arg2pi z = 0" by (metis Arg2pi_eq_0 Arg2pi_inverse inverse_inverse_eq)
lemma Arg2pi_le_div_sum: assumes"w ≠ 0""z ≠ 0""Arg2pi w ≤ Arg2pi z" shows"Arg2pi z = Arg2pi w + Arg2pi(z / w)" by (simp add: Arg2pi_divide assms)
lemma Arg2pi_le_div_sum_eq: assumes"w ≠ 0""z ≠ 0" shows"Arg2pi w ≤ Arg2pi z ⟷ Arg2pi z = Arg2pi w + Arg2pi(z / w)" using assms by (auto simp: Arg2pi_ge_0 intro: Arg2pi_le_div_sum)
lemma Arg2pi_diff: assumes"w ≠ 0""z ≠ 0" shows"Arg2pi w - Arg2pi z = (if Arg2pi z ≤ Arg2pi w then Arg2pi(w / z) else Arg2pi(w/z) - 2*pi)" using assms Arg2pi_divide Arg2pi_inverse [of "w/z"] Arg2pi_eq_0_pi by (force simp add: Arg2pi_ge_0 Arg2pi_divide not_le split: if_split_asm)
lemma Arg2pi_add: assumes"w ≠ 0""z ≠ 0" shows"Arg2pi w + Arg2pi z = (if Arg2pi w + Arg2pi z < 2*pi then Arg2pi(w * z) else Arg2pi(w * z) + 2*pi)" using assms Arg2pi_diff [of "w*z" z] Arg2pi_le_div_sum_eq [of z "w*z"] Arg2pi [of "w * z"] by auto
lemma Arg2pi_times: assumes"w ≠ 0""z ≠ 0" shows"Arg2pi (w * z) = (if Arg2pi w + Arg2pi z < 2*pi then Arg2pi w + Arg2pi z else (Arg2pi w + Arg2pi z) - 2*pi)" using Arg2pi_add [OF assms] by auto
lemma Arg2pi_cnj_eq_inverse: assumes"z ≠ 0"shows"Arg2pi (cnj z) = Arg2pi (inverse z)" proof - have"∃r>0. of_real r / z = cnj z" by (metis assms complex_norm_square nonzero_mult_div_cancel_left zero_less_norm_iff zero_less_power) thenshow ?thesis by (metis Arg2pi_times_of_real2 divide_inverse_commute) qed
lemma Arg2pi_cnj: "Arg2pi(cnj z) = (if z ∈ℝ then Arg2pi z else 2*pi - Arg2pi z)" by (metis Arg2pi_cnj_eq_inverse Arg2pi_inverse Reals_cnj_iff complex_cnj_zero)
lemma Arg2pi_exp: "0 ≤ Im z ==> Im z < 2*pi ==> Arg2pi(exp z) = Im z" by (simp add: Arg2pi_unique exp_eq_polar)
lemma complex_split_polar: obtains r a::real where"z = complex_of_real r * (cos a + i * sin a)""0 ≤ r""0 ≤ a""a < 2*pi" using Arg2pi cis.ctr cis_conv_exp unfolding Complex_eq is_Arg_def by fastforce
lemma Re_Im_le_cmod: "Im w * sin φ + Re w * cos φ ≤ cmod w" proof (cases w rule: complex_split_polar) case (1 r a) with sin_cos_le1 [of a φ] show ?thesis apply (simp add: norm_mult cmod_unit_one) by (metis (no_types, opaque_lifting) abs_le_D1 distrib_left mult.commute mult.left_commute mult_left_le) qed
subsection✐‹tag unimportant›\<open>Analytic properties of tangent function›
lemma field_differentiable_at_tan: "cos z ≠ 0 ==> tan field_differentiable at z" unfolding field_differentiable_def using DERIV_tan by blast
lemma field_differentiable_within_tan: "cos z ≠ 0 ==> tan field_differentiable (at z within s)" using field_differentiable_at_tan field_differentiable_at_within by blast
lemma continuous_within_tan: "cos z ≠ 0 ==> continuous (at z within s) tan" using continuous_at_imp_continuous_within isCont_tan by blast
lemma continuous_on_tan [continuous_intros]: "(∧z. z ∈ s ==> cos z ≠ 0) ==> continuous_on s tan" by (simp add: continuous_at_imp_continuous_on)
lemma holomorphic_on_tan: "(∧z. z ∈ s ==> cos z ≠ 0) ==> tan holomorphic_on s" by (simp add: field_differentiable_within_tan holomorphic_on_def)
subsection‹The principal branch of the Complex logarithm›
lemma field_differentiable_at_Ln: "z ∉ℝ\<le>0==> Ln field_differentiable at z" using field_differentiable_def has_field_derivative_Ln by blast
lemma field_differentiable_within_Ln: "z ∉ℝ\<le>0 ==> Ln field_differentiable (at z within S)" using field_differentiable_at_Ln field_differentiable_within_subset by blast
lemma isCont_Ln' [simp,continuous_intros]: "[isCont f z; f z ∉ℝ\<le>0]==> isCont (λx. Ln (f x)) z" by (blast intro: isCont_o2 [OF _ continuous_at_Ln])
lemma continuous_within_Ln [continuous_intros]: "z ∉ℝ\<le>0==> continuous (at z within S) Ln" using continuous_at_Ln continuous_at_imp_continuous_within by blast
lemma continuous_on_Ln [continuous_intros]: "(∧z. z ∈ S ==> z ∉ℝ\<le>0) ==> continuous_on S Ln" by (simp add: continuous_at_imp_continuous_on continuous_within_Ln)
lemma continuous_on_Ln' [continuous_intros]: "continuous_on S f ==> (∧z. z ∈ S ==> f z ∉ℝ\<le>0) ==> continuous_on S (λx. Ln (f x))" by (rule continuous_on_compose2[OF continuous_on_Ln, of "UNIV - nonpos_Reals" S f]) auto
lemma holomorphic_on_Ln' [holomorphic_intros]: "(∧z. z ∈ A ==> f z ∉ℝ\<le>0) ==> f holomorphic_on A ==> (λz. Ln (f z)) holomorphic_on A" using holomorphic_on_compose_gen[OF _ holomorphic_on_Ln, of f A "- ℝ\<le>0"] by (auto simp: o_def)
lemma analytic_on_ln [analytic_intros]: assumes"f analytic_on A""f ` A ∩ℝ\<le>0 = {}" shows"(λw. ln (f w)) analytic_on A" proof - have *: "ln analytic_on (-ℝ\<le>0)" by (subst analytic_on_open) (auto intro!: holomorphic_intros) have"(ln ∘ f) analytic_on A" by (rule analytic_on_compose_gen[OF assms(1) *]) (use assms(2) in auto) thus ?thesis by (simp add: o_def) qed
lemma Im_Ln_pos_le: assumes"z ≠ 0" shows"0 ≤ Im(Ln z) ∧ Im(Ln z) ≤ pi ⟷ 0 ≤ Im(z)" proof -
{ fix w assume"w = Ln z" thenhave w: "Im w ≤ pi""- pi < Im w" using Im_Ln_le_pi [of z] mpi_less_Im_Ln [of z] assms by auto thenhave"0 ≤ Im w ∧ Im w ≤ pi ⟷ 0 ≤ Im(exp w)" using sin_ge_zero [of "- (Im w)"] sin_ge_zero [of "abs(Im w)"] sin_zero_pi_iff [of "Im w"] by (force simp: Im_exp zero_le_mult_iff sin_ge_zero) } thenshow ?thesis using assms by auto qed
lemma Im_Ln_pos_lt: assumes"z ≠ 0" shows"0 < Im(Ln z) ∧ Im(Ln z) < pi ⟷ 0 < Im(z)" using Im_Ln_pos_le [OF assms] assms by (smt (verit, best) Arg2pi_exp Arg2pi_lt_pi exp_Ln)
text‹A reference to the set of positive real numbers› lemmaIm_Ln_eq_0:"z\<noteq>0\<Longrightarrow>(Im(Lnz)=0\<longleftrightarrow>0<Re(z)\<and>Im(z)=0)" usingIm_Ln_pos_leIm_Ln_pos_ltRe_Ln_pos_ltbyfastforce
(* TODO: could be generalised perhaps, but then one would have to do without the ln *) lemma uniformly_convergent_on_prod_aux: fixes f :: "nat → complex → complex" assumes norm_f: "∧n x. x ∈ A ==> norm (f n x) < 1" assumes cont: "∧n. continuous_on A (f n)" assumes conv: "uniformly_convergent_on A (λN x. ∑n<N. ln (1 + f n x))" assumes A: "compact A" shows"uniformly_convergent_on A (λN x. ∏n<N. 1 + f n x)" proof - from conv obtain S where S: "uniform_limit A (λN x. ∑n<N. ln (1 + f n x)) S sequentially" by (auto simp: uniformly_convergent_on_def) have cont': "continuous_on A S" proof (rule uniform_limit_theorem[OF _ S]) have"f n x + 1 ∉ℝ\<le>0"if"x ∈ A"for n x proof assume"f n x + 1 ∈ℝ\<le>0" thenobtain t where t: "t ≤ 0""f n x = of_real (t - 1)" by (metis add_diff_cancel nonpos_Reals_cases of_real_1 of_real_diff) moreoverhave"norm …≥ 1" using t by (subst norm_of_real) auto ultimatelyshow False using norm_f[of x n] that by auto qed thus"∀F n in sequentially. continuous_on A (λx. ∑n<n. Ln (1 + f n x))" by (auto intro!: always_eventually continuous_intros cont simp: add_ac) qed auto
define B where"B = {x + y |x y. x ∈ S ` A ∧ y ∈ cball 0 1}" have"compact B" unfolding B_def by (intro compact_sums compact_continuous_image cont' A) auto
have"uniformly_convergent_on A (λN x. exp ((∑n<N. ln (1 + f n x))))" using conv proof (rule uniformly_convergent_on_compose_uniformly_continuous_on) show"closed B" using‹compact B›by (auto dest: compact_imp_closed) show"uniformly_continuous_on B exp" by (intro compact_uniformly_continuous continuous_intros ‹compact B›)
have"eventually (λN. ∀x∈A. dist (∑n<N. Ln (1 + f n x)) (S x) < 1) sequentially" using S unfolding uniform_limit_iff by simp thus"eventually (λN. ∀x∈A. (∑n<N. Ln (1 + f n x)) ∈ B) sequentially" proof eventually_elim case (elim N) show"∀x∈A. (∑n<N. Ln (1 + f n x)) ∈ B" proof safe fix x assume x: "x ∈ A" have"(∑n<N. Ln (1 + f n x)) = S x + ((∑n<N. Ln (1 + f n x)) - S x)" by auto moreoverhave"((∑n<N. Ln (1 + f n x)) - S x) ∈ ball 0 1" using elim x by (auto simp: dist_norm norm_minus_commute) ultimatelyshow"(∑n<N. Ln (1 + f n x)) ∈ B" unfolding B_def using x by fastforce qed qed qed alsohave"?this ⟷ uniformly_convergent_on A (λN x. ∏n<N. 1 + f n x)" proof (intro uniformly_convergent_cong refl always_eventually allI ballI) fix N :: nat and x assume x: "x ∈ A" have"exp (∑n<N. ln (1 + f n x)) = (∏n<N. exp (ln (1 + f n x)))" by (simp add: exp_sum) alsohave"… = (∏n<N. 1 + f n x)" using norm_f[of x] x by (smt (verit, best) add.right_neutral add_diff_cancel exp_Ln norm_minus_commute norm_one prod.cong) finallyshow"exp (∑n<N. ln (1 + f n x)) = (∏n<N. 1 + f n x)" . qed finallyshow ?thesis . qed
text‹Theorem 17.6 by Bak and Newman, Complex Analysis [roughly]› lemma uniformly_convergent_on_prod: fixes f :: "nat → complex → complex" assumes cont: "∧n. continuous_on A (f n)" assumes A: "compact A" assumes conv_sum: "uniformly_convergent_on A (λN x. ∑n<N. norm (f n x))" shows"uniformly_convergent_on A (λN x. ∏n<N. 1 + f n x)" proof - obtain M where M: "∧n x. n ≥ M ==> x ∈ A ==> norm (f n x) < 1 / 2" proof - from conv_sum have"uniformly_Cauchy_on A (λN x. ∑n<N. norm (f n x))" using uniformly_convergent_Cauchy by blast moreoverhave"(1 / 2 :: real) > 0" by simp ultimatelyobtain M where M: "∧x m n. x ∈ A ==> m ≥ M ==> n ≥ M ==> dist (∑k<m. norm (f k x)) (∑k<n. norm (f k x)) < 1 / 2" unfolding uniformly_Cauchy_on_def by fast show ?thesis proof (rule that[of M]) fix n x assume nx: "n ≥ M""x ∈ A" have"dist (∑k<Suc n. norm (f k x)) (∑k<n. norm (f k x)) < 1 / 2" by (rule M) (use nx in auto) alsohave"dist (∑k<Suc n. norm (f k x)) (∑k<n. norm (f k x)) = norm (f n x)" by (simp add: dist_norm) finallyshow"norm (f n x) < 1 / 2" . qed qed
have conv: "uniformly_convergent_on A (λN x. ∑n<N. ln (1 + f (n + M) x))" proof (rule uniformly_summable_comparison_test) show"norm (ln (1 + f (n + M) x)) ≤ 2 * norm (f (n + M) x)"if"x ∈ A"for n x by (rule norm_Ln_le) (use M[of "n + M" x] that in auto) have *: "filterlim (λn. n + M) at_top at_top" by (rule filterlim_add_const_nat_at_top) have"uniformly_convergent_on A (λN x. 2 * ((∑n<N+M. norm (f n x)) - (∑n<M. norm (f n x))))" by (intro uniformly_convergent_mult uniformly_convergent_minus
uniformly_convergent_on_compose[OF conv_sum *] uniformly_convergent_on_const) alsohave"(λN x. 2 * ((∑n<N+M. norm (f n x)) - (∑n<M. norm (f n x)))) = (λN x. ∑n<N. 2 * norm (f (n + M) x))" (is"?lhs = ?rhs") proof (intro ext) fix N x have"(∑n<N+M. norm (f n x)) - (∑n<M. norm (f n x)) = (∑n∈{..<N+M}-{..<M}. norm (f n x))" by (subst sum_diff) auto alsohave"… = (∑n<N. norm (f (n + M) x))" by (intro sum.reindex_bij_witness[of _ "λn. n + M""λn. n - M"]) auto finallyshow"?lhs N x = ?rhs N x" by (simp add: sum_distrib_left) qed finallyshow"uniformly_convergent_on A (λN x. ∑n<N. 2 * cmod (f (n + M) x))" . qed
have conv': "uniformly_convergent_on A (λN x. ∏n<N. 1 + f (n + M) x)" proof (rule uniformly_convergent_on_prod_aux) show"norm (f (n + M) x) < 1"if"x ∈ A"for n x using M[of "n + M" x] that by simp qed (use M assms conv in auto)
thenobtain S where S: "uniform_limit A (λN x. ∏n<N. 1 + f (n + M) x) S sequentially" by (auto simp: uniformly_convergent_on_def) have cont': "continuous_on A S" by (intro uniform_limit_theorem[OF _ S] always_eventually ballI allI continuous_intros cont) auto
have"uniform_limit A (λN x. (∏n<M. 1 + f n x) * (∏n<N. 1 + f (n + M) x)) (λx. (∏n<M. 1 + f n x) * S x) sequentially" proof (rule uniform_lim_mult[OF uniform_limit_const S]) show"bounded (S ` A)" by (intro compact_imp_bounded compact_continuous_image A cont') show"bounded ((λx. ∏n<M. 1 + f n x) ` A)" by (intro compact_imp_bounded compact_continuous_image A continuous_intros cont) qed hence"uniformly_convergent_on A (λN x. (∏n<M. 1 + f n x) * (∏n<N. 1 + f (n + M) x))" by (auto simp: uniformly_convergent_on_def) alsohave"(λN x. (∏n<M. 1 + f n x) * (∏n<N. 1 + f (n + M) x)) = (λN x. (∏n<M+N. 1 + f n x))" proof (intro ext) fix N :: nat and x :: complex have"(∏n<N. 1 + f (n + M) x) = (∏n∈{M..<M+N}. 1 + f n x)" by (intro prod.reindex_bij_witness[of _ "λn. n - M""λn. n + M"]) auto alsohave"(∏n<M. 1 + f n x) * … = (∏n∈{..<M}∪{M..<M+N}. 1 + f n x)" by (subst prod.union_disjoint) auto alsohave"{..<M} ∪ {M..<M+N} = {..<M+N}" by auto finallyshow"(∏n<M. 1 + f n x) * (∏n<N. 1 + f (n + M) x) = (∏n<M+N. 1 + f n x)" . qed finallyhave"uniformly_convergent_on A (λN x. ∏n<M + N. 1 + f n x)" by simp hence"uniformly_convergent_on A (λN x. ∏n<M + (N - M). 1 + f n x)" by (rule uniformly_convergent_on_compose) (rule filterlim_minus_const_nat_at_top) alsohave"?this ⟷ ?thesis" proof (rule uniformly_convergent_cong) show"eventually (λx. ∀y∈A. (∏n<M + (x - M). 1 + f n y) = (∏n<x. 1 + f n y)) at_top" using eventually_ge_at_top[of M] by eventually_elim auto qed auto finallyshow ?thesis . qed
lemma uniformly_convergent_on_prod': fixes f :: "nat → complex → complex" assumes cont: "∧n. continuous_on A (f n)" assumes A: "compact A" assumes conv_sum: "uniformly_convergent_on A (λN x. ∑n<N. norm (f n x - 1))" shows"uniformly_convergent_on A (λN x. ∏n<N. f n x)" proof - have"uniformly_convergent_on A (λN x. ∏n<N. 1 + (f n x - 1))" by (rule uniformly_convergent_on_prod) (use assms in‹auto intro!: continuous_intros›) thus ?thesis by simp qed
text‹Prop 17.6 of Bak and Newman, Complex Analysis, p. 243.
Only this version is for the reals. Can the two proofs be consolidated?› lemma uniformly_convergent_on_prod_real: fixes u :: "nat → real → real" assumes contu: "∧k. continuous_on K (u k)" and uconv: "uniformly_convergent_on K (λn x. ∑k<n. ∣u k x∣)" and K: "compact K" shows"uniformly_convergent_on K (λn x. ∏k<n. 1 + u k x)" proof - define f where"f ≡ λk. complex_of_real ∘ u k ∘ Re" define L where"L ≡ complex_of_real ` K" have"compact L" by (simp add: ‹compact K› L_def compact_continuous_image) have"Re ` complex_of_real ` X = X"for X by (auto simp: image_iff) with contu have contf: "∧k. continuous_on L (f k)" unfolding f_def L_def by (intro continuous_intros) auto obtain S where S: "∧ε. ε>0 ==>∀F n in sequentially. ∀x∈K. dist (∑k<n. ∣u k x∣) (S x) < ε" using uconv unfolding uniformly_convergent_on_def uniform_limit_iff by presburger have"∀F n in sequentially. ∀z∈L. dist (∑k<n. cmod (f k z)) ((of_real ∘ S ∘ Re) z) < ε" if"ε>0"for ε using S [OF that] by eventually_elim (simp add: L_def f_def) thenhave uconvf: "uniformly_convergent_on L (λn z. ∑k<n. norm (f k z))" unfolding uniformly_convergent_on_def uniform_limit_iff by blast obtain P where P: "∧ε. ε>0 ==>∀F n in sequentially. ∀z∈L. dist (∏k<n. 1 + f k z) (P z) < ε" using uniformly_convergent_on_prod [OF contf ‹compact L› uconvf] unfolding uniformly_convergent_on_def uniform_limit_iff by blast have§: "∣(∏k<n. 1 + u k x) - Re (P x)∣≤ cmod ((∏k<n. 1 + of_real (u k x)) - P x)"for n x proof - have"(∏k∈N. of_real (1 + u k x)) = (∏k∈N. 1 + of_real (u k x))"for N by force thenshow ?thesis by (metis Re_complex_of_real abs_Re_le_cmod minus_complex.sel(1) of_real_prod) qed have"∀F n in sequentially. ∀x∈K. dist (∏k<n. 1 + u k x) ((Re ∘ P ∘ of_real) x) < ε" if"ε>0"for ε using P [OF that] by eventually_elim (simp add: L_def f_def dist_norm le_less_trans [OF §]) thenshow ?thesis unfolding uniformly_convergent_on_def uniform_limit_iff by blast qed
subsection‹The Argument of a Complex Number›
text‹Unlike in HOL Light, it's defined for the same interval as the complex logarithm: ‹(-π,π]›.›
lemma Arg_eq_Im_Ln: assumes"z ≠ 0"shows"Arg z = Im (Ln z)" proof (rule cis_Arg_unique) show"sgn z = cis (Im (Ln z))" by (metis assms exp_Ln exp_eq_polar nonzero_mult_div_cancel_left norm_eq_zero
norm_exp_eq_Re of_real_eq_0_iff sgn_eq) show"- pi < Im (Ln z)" by (simp add: assms mpi_less_Im_Ln) show"Im (Ln z) ≤ pi" by (simp add: Im_Ln_le_pi assms) qed
text‹The 1990s definition of argument coincides with the more recent one› lemma✐‹tag important› Arg_def: shows"Arg z = (if z = 0 then 0 else Im (Ln z))" by (simp add: Arg_eq_Im_Ln Arg_zero)
lemma Arg_of_real [simp]: "Arg (of_real r) = (if r<0 then pi else 0)" by (simp add: Im_Ln_eq_pi Arg_def)
lemma mpi_less_Arg: "-pi < Arg z"and Arg_le_pi: "Arg z ≤ pi" by (auto simp: Arg_def mpi_less_Im_Ln Im_Ln_le_pi)
lemma Arg_eq: assumes"z ≠ 0" shows"z = of_real(norm z) * exp(i * Arg z)" using cis_conv_exp rcis_cmod_Arg rcis_def by force
lemma is_Arg_Arg: "z ≠ 0 ==> is_Arg z (Arg z)" by (simp add: Arg_eq is_Arg_def)
lemma Argument_exists: assumes"z ≠ 0"and R: "R = {r-pi<..r+pi}" obtains s where"is_Arg z s""s∈R" proof - let ?rp = "r - Arg z + pi" define k where"k ≡⌊?rp / (2 * pi)⌋" have"(Arg z + of_int k * (2 * pi)) ∈ R" using floor_divide_lower [of "2*pi" ?rp] floor_divide_upper [of "2*pi" ?rp] by (auto simp: k_def algebra_simps R) thenshow ?thesis using Arg_eq ‹z ≠ 0› is_Arg_2pi_iff is_Arg_def that by blast qed
lemma Argument_exists_unique: assumes"z ≠ 0"and R: "R = {r-pi<..r+pi}" obtains s where"is_Arg z s""s∈R""∧t. [is_Arg z t; t∈R]==> s=t" proof - obtain s where s: "is_Arg z s""s∈R" using Argument_exists [OF assms] . moreoverhave"∧t. [is_Arg z t; t∈R]==> s=t" using assms s by (auto simp: is_Arg_eqI) ultimatelyshow thesis using that by blast qed
lemma Argument_Ex1: assumes"z ≠ 0"and R: "R = {r-pi<..r+pi}" shows"∃!s. is_Arg z s ∧ s ∈ R" using Argument_exists_unique [OF assms] by metis
lemma Arg_divide: assumes"w ≠ 0""z ≠ 0" shows"is_Arg (z / w) (Arg z - Arg w)" using Arg_eq [of z] Arg_eq [of w] Arg_eq [of "norm(z / w)"] assms by (auto simp: is_Arg_def norm_divide field_simps exp_diff Arg_of_real)
lemma Arg_unique_lemma: assumes"is_Arg z t""is_Arg z t'" and"- pi < t""t ≤ pi" and"- pi < t'""t' ≤ pi" and"z ≠ 0" shows"t' = t" using is_Arg_eqI assms by force
lemma complex_norm_eq_1_exp_eq: "norm z = 1 ⟷ exp(i * (Arg z)) = z" by (metis Arg2pi_eq Arg_eq complex_norm_eq_1_exp norm_eq_zero norm_exp_i_times)
lemma Arg_unique: "[of_real r * exp(i * a) = z; 0 < r; -pi < a; a ≤ pi]==> Arg z = a" by (rule Arg_unique_lemma [unfolded is_Arg_def, OF _ Arg_eq])
(use mpi_less_Arg Arg_le_pi in‹auto simp: norm_mult›)
lemma Arg_minus: assumes"z ≠ 0" shows"Arg (-z) = (if Arg z ≤ 0 then Arg z + pi else Arg z - pi)" proof - have [simp]: "cmod z * cos (Arg z) = Re z" using assms Arg_eq [of z] by (metis Re_exp exp_Ln norm_exp_eq_Re Arg_def) have [simp]: "cmod z * sin (Arg z) = Im z" using assms Arg_eq [of z] by (metis Im_exp exp_Ln norm_exp_eq_Re Arg_def) show ?thesis using mpi_less_Arg [of z] Arg_le_pi [of z] assms by (intro Arg_unique [of "norm z", OF complex_eqI]) (auto simp: Re_exp Im_exp) qed
lemma Arg_1 [simp]: "Arg 1 = 0" by (rule Arg_unique[of 1]) auto
lemma Arg_numeral [simp]: "Arg (numeral n) = 0" by (rule Arg_unique[of "numeral n"]) auto
lemma Arg_times_of_real [simp]: assumes"0 < r"shows"Arg (of_real r * z) = Arg z" using Arg_def Ln_times_of_real assms by auto
lemma Arg_times_of_real2 [simp]: "0 < r ==> Arg (z * of_real r) = Arg z" by (metis Arg_times_of_real mult.commute)
lemma Arg_divide_of_real [simp]: "0 < r ==> Arg (z / of_real r) = Arg z" by (metis Arg_times_of_real2 less_irrefl nonzero_eq_divide_eq of_real_eq_0_iff)
lemma Arg_less_0: "0 ≤ Arg z ⟷ 0 ≤ Im z" using Im_Ln_le_pi Im_Ln_pos_le by (simp add: Arg_def)
text‹converse fails because the argument can equal $\pi$.› lemma Arg_uminus: "Arg z < 0 ==> Arg (-z) > 0" by (smt (verit) Arg_bounded Arg_minus Complex.Arg_def)
lemma Arg_eq_pi: "Arg z = pi ⟷ Re z < 0 ∧ Im z = 0" by (auto simp: Arg_def Im_Ln_eq_pi)
lemma Arg_lt_pi: "0 < Arg z ∧ Arg z < pi ⟷ 0 < Im z" using Arg_less_0 [of z] Im_Ln_pos_lt by (auto simp: order.order_iff_strict Arg_def)
lemma Arg_eq_0: "Arg z = 0 ⟷ z ∈ℝ∧ 0 ≤ Re z" using Arg_def Im_Ln_eq_0 complex_eq_iff complex_is_Real_iff by auto
lemma Arg_neg_iff: "Arg x < 0 ⟷ Im x < 0" using Arg_less_0 linorder_not_le by blast
lemma Arg_pos_iff: "Arg x > 0 ⟷ Im x > 0 ∨ (Im x = 0 ∧ Re x < 0)" by (metis Arg_eq_pi Arg_le_pi Arg_lt_pi order_less_le pi_gt_zero)
corollary✐‹tag unimportant› Arg_ne_0: assumes"z ∉ℝ\<ge>0"shows"Arg z ≠ 0" using assms by (auto simp: nonneg_Reals_def Arg_eq_0)
lemma Arg_eq_pi_iff: "Arg z = pi ⟷ z ∈ℝ∧ Re z < 0" using Arg_eq_pi complex_is_Real_iff by blast
lemma Arg_eq_0_iff: "Arg z = 0 ⟷ z ∈ℝ∧ Re z ≥ 0" using Arg_eq_0 complex_is_Real_iff by blast
lemma Arg_eq_0_pi: "Arg z = 0 ∨ Arg z = pi ⟷ z ∈ℝ" using Arg_eq_pi_iff Arg_eq_0 by force
lemma Arg_real: "z ∈ℝ==> Arg z = (if 0 ≤ Re z then 0 else pi)" using Arg_eq_0 Arg_eq_0_pi by auto
lemma Arg_inverse: "Arg(inverse z) = (if z ∈ℝ then Arg z else - Arg z)" proof (cases "z ∈ℝ") case False thenshow ?thesis by (simp add: Arg_def Ln_inverse complex_is_Real_iff complex_nonpos_Reals_iff) qed (use Arg_real Re_inverse in auto)
lemma Arg_eq_iff: assumes"w ≠ 0""z ≠ 0" shows"Arg w = Arg z ⟷ (∃x. 0 < x ∧ w = of_real x * z)" (is"?lhs = ?rhs") proof assume ?lhs thenhave"w = (cmod w / cmod z) * z" by (metis Arg_eq assms divide_divide_eq_right eq_divide_eq exp_not_eq_zero of_real_divide) thenshow ?rhs using assms divide_pos_pos zero_less_norm_iff by blast qed auto
lemma Arg_inverse_eq_0: "Arg(inverse z) = 0 ⟷ Arg z = 0" by (metis Arg_eq_0 Arg_inverse inverse_inverse_eq)
lemma Arg_cnj_eq_inverse: "z≠0 ==> Arg (cnj z) = Arg (inverse z)" using Arg2pi_cnj_eq_inverse Arg2pi_eq_iff Arg_eq_iff by auto
lemma Arg_cnj: "Arg(cnj z) = (if z ∈ℝ then Arg z else - Arg z)" by (metis Arg_cnj_eq_inverse Arg_inverse Reals_0 complex_cnj_zero)
lemma Arg_exp: "-pi < Im z ==> Im z ≤ pi ==> Arg(exp z) = Im z" by (simp add: Arg_eq_Im_Ln)
lemma Arg_cis: "x ∈ {-pi<..pi} ==> Arg (cis x) = x" unfolding cis_conv_exp by (subst Arg_exp) auto
lemma Arg_rcis: "x ∈ {-pi<..pi} ==> r > 0 ==> Arg (rcis r x) = x" unfolding rcis_def by (subst Arg_times_of_real) (auto simp: Arg_cis)
lemma Ln_Arg: "z≠0 ==> Ln(z) = ln(norm z) + i * Arg(z)" by (metis Arg_def Re_Ln complex_eq)
lemma Ln_of_real': assumes"x ≠ 0" shows"Ln (of_real x) = of_real (ln ∣x∣) + (if x < 0 then pi else 0) * i" by (subst Ln_Arg) (use assms in auto)
lemma continuous_at_Arg: assumes"z ∉ℝ\<le>0" shows"continuous (at z) Arg" proof - have"(λz. Im (Ln z)) ←-z→ Arg z" using Arg_def assms continuous_at by fastforce thenshow ?thesis unfolding continuous_at by (smt (verit, del_insts) Arg_eq_Im_Ln Lim_transform_away_at assms nonpos_Reals_zero_I) qed
lemma continuous_within_Arg: "z ∉ℝ\<le>0==> continuous (at z within S) Arg" using continuous_at_Arg continuous_at_imp_continuous_within by blast
lemma continuous_on_Arg: "continuous_on (-ℝ\<le>0) Arg" using continuous_at_Arg by (simp add: continuous_at_imp_continuous_on)
lemma continuous_on_Arg' [continuous_intros]: assumes"continuous_on A f""∧z. z ∈ A ==> f z ∉ℝ\<le>0" shows"continuous_on A (λx. Arg (f x))" by (rule continuous_on_compose2[OF continuous_on_Arg assms(1)]) (use assms(2) in auto)
lemma Arg_Re_pos: "∣Arg z∣ < pi / 2 ⟷ Re z > 0 ∨ z = 0" using Arg_def Re_Ln_pos_lt by auto
lemma Arg_Re_nonneg: "∣Arg z∣≤ pi / 2 ⟷ Re z ≥ 0" using Re_Ln_pos_le[of z] by (cases "z = 0") (auto simp: Arg_eq_Im_Ln Arg_zero)
lemma Arg_times: assumes"Arg z + Arg w ∈ {-pi<..pi}""z ≠ 0""w ≠ 0" shows"Arg (z * w) = Arg z + Arg w" using Arg_eq_Im_Ln Ln_times_simple assms by auto
lemma Arg_unique': "r > 0 ==> φ ∈ {-pi<..pi} ==> x = rcis r φ ==> Arg x = φ" by (rule Arg_unique[of r]) (auto simp: rcis_def cis_conv_exp)
lemma Arg_times': assumes"w ≠ 0""z ≠ 0" defines"x ≡ Arg w + Arg z" shows"Arg (w * z) = x + (if x ∈ {-pi<..pi} then 0 else if x > pi then -2*pi else 2*pi)" proof (rule Arg_unique'[of "norm w * norm z"]) show"w * z = rcis (cmod w * cmod z) (x + (if x ∈ {- pi<..pi} then 0 else if x > pi then -2*pi else 2*pi))" by (subst (13) rcis_cmod_Arg [symmetric])
(use assms in‹auto simp: rcis_def simp flip: cis_mult cis_divide cis_inverse›) show"x + (if x ∈ {- pi<..pi} then 0 else if pi < x then - 2 * pi else 2 * pi) ∈ {- pi<..pi}" using Arg_bounded[of w] Arg_bounded[of z] by (auto simp: x_def) qed (use assms in auto)
lemma Arg_divide': assumes [simp]: "z ≠ 0""w ≠ 0" shows"Arg (z / w) = Arg z - Arg w + (if Arg z - Arg w > pi then -2 * pi else if Arg z - Arg w ≤ -pi then 2 * pi else 0)"
(is"_ = ?rhs") proof - have"Arg (z * inverse w) = ?rhs" by (subst Arg_times')
(use Arg_bounded[of w] Arg_bounded[of z] in‹auto simp: Arg_inverse elim!: Reals_cases split: if_splits›)+ alsohave"z * inverse w = z / w" by (simp add: field_simps) finallyshow ?thesis . qed
subsection‹The Unwinding Number and the Ln product Formula›
text‹Note that in this special case the unwinding number is -1, 0 or 1. But it's always an integer.›
lemma is_Arg_exp_Im: "is_Arg (exp z) (Im z)" using exp_eq_polar is_Arg_def norm_exp_eq_Re by auto
lemma is_Arg_exp_diff_2pi: assumes"is_Arg (exp z) θ" shows"∃k. Im z - of_int k * (2 * pi) = θ" proof (intro exI is_Arg_eqI) let ?k = "⌊(Im z - θ) / (2 * pi)⌋" show"is_Arg (exp z) (Im z - real_of_int ?k * (2 * pi))" by (metis diff_add_cancel is_Arg_2pi_iff is_Arg_exp_Im) show"∣Im z - real_of_int ?k * (2 * pi) - θ∣ < 2 * pi" using floor_divide_upper [of "2*pi""Im z - θ"] floor_divide_lower [of "2*pi""Im z - θ"] by (auto simp: algebra_simps abs_if) qed (auto simp: is_Arg_exp_Im assms)
lemma Arg_exp_diff_2pi: "∃k. Im z - of_int k * (2 * pi) = Arg (exp z)" using is_Arg_exp_diff_2pi [OF is_Arg_Arg] by auto
definition✐‹tag important› unwinding :: "complex → int"where "unwinding z ≡ THE k. of_int k = (z - Ln(exp z)) / (of_real(2*pi) * i)"
lemma unwinding: "of_int (unwinding z) = (z - Ln(exp z)) / (of_real(2*pi) * i)" using unwinding_in_Ints [of z] unfolding unwinding_def Ints_def by force
lemma unwinding_2pi: "(2*pi) * i * unwinding(z) = z - Ln(exp z)" by (simp add: unwinding)
lemma Ln_times_unwinding: "w ≠ 0 ==> z ≠ 0 ==> Ln(w * z) = Ln(w) + Ln(z) - (2*pi) * i * unwinding(Ln w + Ln z)" using unwinding_2pi by (simp add: exp_add)
lemma arg_conv_arctan: assumes"Re z > 0" shows"Arg z = arctan (Im z / Re z)" proof (rule cis_Arg_unique) show"sgn z = cis (arctan (Im z / Re z))" proof (rule complex_eqI) have"Re (cis (arctan (Im z / Re z))) = 1 / sqrt (1 + (Im z)2 / (Re z)2)" by (simp add: cos_arctan power_divide) alsohave"1 + Im z ^ 2 / Re z ^ 2 = norm z ^ 2 / Re z ^ 2" using assms by (simp add: cmod_def field_simps) alsohave"1 / sqrt … = Re z / norm z" using assms by (simp add: real_sqrt_divide) finallyshow"Re (sgn z) = Re (cis (arctan (Im z / Re z)))" by simp next have"Im (cis (arctan (Im z / Re z))) = Im z / (Re z * sqrt (1 + (Im z)2 / (Re z)2))" by (simp add: sin_arctan field_simps) alsohave"1 + Im z ^ 2 / Re z ^ 2 = norm z ^ 2 / Re z ^ 2" using assms by (simp add: cmod_def field_simps) alsohave"Im z / (Re z * sqrt …) = Im z / norm z" using assms by (simp add: real_sqrt_divide) finallyshow"Im (sgn z) = Im (cis (arctan (Im z / Re z)))" by simp qed next show"arctan (Im z / Re z) > -pi" by (smt (verit, ccfv_SIG) arctan field_sum_of_halves) next show"arctan (Im z / Re z) ≤ pi" by (smt (verit, best) arctan field_sum_of_halves) qed
subsection‹Characterisation of @{term "Im (Ln z)"} (Wenda Li)›
lemma Im_Ln_eq: assumes"z≠0" shows"Im (Ln z) = (if Re z≠0 then if Re z>0 then arctan (Im z/Re z) else if Im z≥0 then arctan (Im z/Re z) + pi else arctan (Im z/Re z) - pi else if Im z>0 then pi/2 else -pi/2)" proof - have eq_arctan_pos: "Im (Ln z) = arctan (Im z/Re z)" when "Re z>0"for z by (metis Arg_eq_Im_Ln arg_conv_arctan order_less_irrefl that zero_complex.simps(1)) have ?thesis when "Re z=0" using Im_Ln_eq_pi_half[OF ‹z≠0›] that using assms complex_eq_iff by auto moreoverhave ?thesis when "Re z>0" using eq_arctan_pos[OF that] that by auto moreoverhave ?thesis when "Re z<0""Im z≥0" proof - have"Im (Ln (- z)) = arctan (Im (- z) / Re (- z))" by (simp add: eq_arctan_pos that(1)) moreoverhave"Ln (- z) = Ln z - i * complex_of_real pi" using Ln_minus assms that by fastforce ultimatelyshow ?thesis using that by auto qed moreoverhave ?thesis when "Re z<0""Im z<0" proof - have"Im (Ln (- z)) = arctan (Im (- z) / Re (- z))" by (simp add: eq_arctan_pos that(1)) moreoverhave"Ln (- z) = Ln z + i * complex_of_real pi" using Ln_minus assms that by auto ultimatelyshow ?thesis using that by auto qed ultimatelyshow ?thesis by linarith qed
subsection✐‹tag unimportant›\<open>Relation between Ln and Arg2pi, andhence continuity of Arg2pi›
lemma Arg2pi_Ln: "0 < Arg2pi z ==> Arg2pi z = Im(Ln(-z)) + pi" by (smt (verit, best) Arg2pi_0 Arg2pi_exp Arg2pi_minus Arg_exp Arg_minus Im_Ln_le_pi
exp_Ln mpi_less_Im_Ln neg_equal_0_iff_equal)
lemma continuous_at_Arg2pi: assumes"z ∉ℝ\<ge>0" shows"continuous (at z) Arg2pi" proof - have"isCont (λz. Im (Ln (- z)) + pi) z" by (rule Complex.isCont_Im isCont_Ln' continuous_intros | simp add: assms complex_is_Real_iff)+ moreover consider "Re z < 0" | "Im z ≠ 0"using assms using complex_nonneg_Reals_iff not_le by blast ultimatelyhave"(λz. Im (Ln (- z)) + pi) ←-z→ Arg2pi z" by (simp add: Arg2pi_Ln Arg2pi_gt_0 assms continuous_within) thenshow ?thesis unfolding continuous_at by (metis (mono_tags, lifting) Arg2pi_Ln Arg2pi_gt_0 Compl_iff Lim_transform_within_open assms
closed_nonneg_Reals_complex open_Compl) qed
text‹Relation between Arg2pi and arctangent in upper halfplane› lemmaArg2pi_arctan_upperhalf: assumes"0<Imz" shows"Arg2piz=pi/2-arctan(Rez/Imz)" proof(cases"z=0") caseFalse show?thesis proof(ruleArg2pi_unique[of"normz"]) show"(cmodz)*exp(\<i>*(pi/2-arctan(Rez/Imz)))=z" apply(rulecomplex_eqI) usingassmsnorm_complex_def[ofz,symmetric] unfoldingexp_Eulercos_diffsin_diffsin_of_realcos_of_real by(simp_alladd:field_simpsreal_sqrt_dividesin_arctancos_arctan) qed(useFalsearctan[of"Rez/Imz"]inauto) qed(useassmsinauto)
(*Seemingly impossible to use DERIV_power_int without introducing the assumption z\<in>S*) lemma has_field_derivative_powr_of_int: fixes z :: complex assumes gderiv: "(g has_field_derivative gd) (at z within S)"and"g z ≠ 0" shows"((λz. g z powr of_int n) has_field_derivative (n * g z powr (of_int n - 1) * gd)) (at z within S)" proof - obtain e where"e>0"and e_dist: "∀y∈S. dist z y < e ⟶ g y ≠ 0" using DERIV_continuous assms continuous_within_avoid gderiv by blast define D where"D = of_int n * g z powr (of_int (n - 1)) * gd" define E where"E = of_int n * g z powi (n - 1) * gd" have"((λz. g z powr of_int n) has_field_derivative D) (at z within S) ⟷ ((λz. g z powr of_int n) has_field_derivative E) (at z within S)" using assms complex_powr_of_int D_def E_def by presburger alsohave"…⟷ ((λz. g z powi n) has_field_derivative E) (at z within S)" proof (rule has_field_derivative_cong_eventually) show"∀F x in at z within S. g x powr of_int n = g x powi n" unfolding eventually_at by (metis ‹0 < e› complex_powr_of_int dist_commute e_dist) qed (simp add: assms complex_powr_of_int) alsohave"((λz. g z powi n) has_field_derivative E) (at z within S)" unfolding E_def using gderiv assms by (auto intro!: derivative_eq_intros) finallyshow ?thesis by (simp add: D_def) qed
lemma field_differentiable_powr_of_int: fixes z :: complex assumes"g field_differentiable (at z within S)"and"g z ≠ 0" shows"(λz. g z powr of_int n) field_differentiable (at z within S)" using has_field_derivative_powr_of_int assms field_differentiable_def by blast
lemma holomorphic_on_powr_of_int [holomorphic_intros]: assumes"f holomorphic_on S"and"∧z. z∈S ==> f z ≠ 0" shows"(λz. (f z) powr of_int n) holomorphic_on S" using assms field_differentiable_powr_of_int holomorphic_on_def by auto
lemma has_field_derivative_powr_right [derivative_intros]: "w ≠ 0 ==> ((λz. w powr z) has_field_derivative Ln w * w powr z) (at z)" unfolding powr_def by (intro derivative_eq_intros | simp)+
lemma field_differentiable_powr_right [derivative_intros]: fixes w::complex shows"w ≠ 0 ==> (λz. w powr z) field_differentiable (at z)" using field_differentiable_def has_field_derivative_powr_right by blast
lemma holomorphic_on_powr_right [holomorphic_intros]: assumes"f holomorphic_on S" shows"(λz. w powr (f z)) holomorphic_on S" proof (cases "w = 0") case False with assms show ?thesis unfolding holomorphic_on_def field_differentiable_def by (metis (full_types) DERIV_chain' has_field_derivative_powr_right) qed simp
lemma holomorphic_on_divide_gen [holomorphic_intros]: assumes"f holomorphic_on S""g holomorphic_on S"and"∧z z'. [z ∈ S; z' ∈ S]==> g z = 0 ⟷ g z' = 0" shows"(λz. f z / g z) holomorphic_on S" by (metis (no_types, lifting) assms division_ring_divide_zero holomorphic_on_divide holomorphic_transform)
lemma tendsto_powr_complex: fixes f g :: "_ → complex" assumes a: "a ∉ℝ\<le>0" assumes f: "(f ---> a) F"and g: "(g ---> b) F" shows"((λz. f z powr g z) ---> a powr b) F" proof - from a have [simp]: "a ≠ 0"by auto from f g a have"((λz. exp (g z * ln (f z))) ---> a powr b) F" (is ?P) by (auto intro!: tendsto_intros simp: powr_def) also { have"eventually (λz. z ≠ 0) (nhds a)" by (intro t1_space_nhds) simp_all with f have"eventually (λz. f z ≠ 0) F"using filterlim_iff by blast
} hence"?P ⟷ ((λz. f z powr g z) ---> a powr b) F" by (intro tendsto_cong refl) (simp_all add: powr_def mult_ac) finallyshow ?thesis . qed
lemma tendsto_powr_complex_0: fixes f g :: "'a → complex" assumes f: "(f ---> 0) F"and g: "(g ---> b) F"and b: "Re b > 0" shows"((λz. f z powr g z) ---> 0) F" proof (rule tendsto_norm_zero_cancel) define h where "h = (λz. if f z = 0 then 0 else exp (Re (g z) * ln (cmod (f z)) + abs (Im (g z)) * pi))"
{ fix z :: 'a assume z: "f z ≠ 0" define c where"c = abs (Im (g z)) * pi" from mpi_less_Im_Ln[OF z] Im_Ln_le_pi[OF z] have"abs (Im (Ln (f z))) ≤ pi"by simp from mult_left_mono[OF this, of "abs (Im (g z))"] have"abs (Im (g z) * Im (ln (f z))) ≤ c"by (simp add: abs_mult c_def) hence"-Im (g z) * Im (ln (f z)) ≤ c"by simp hence"norm (f z powr g z) ≤ h z"by (simp add: powr_def field_simps h_def c_def)
} hence le: "norm (f z powr g z) ≤ h z"for z by (simp add: h_def)
have g': "(g ---> b) (inf F (principal {z. f z ≠ 0}))" by (rule tendsto_mono[OF _ g]) simp_all have"((λx. norm (f x)) ---> 0) (inf F (principal {z. f z ≠ 0}))" by (subst tendsto_norm_zero_iff, rule tendsto_mono[OF _ f]) simp_all moreover { have"filterlim (λx. norm (f x)) (principal {0<..}) (principal {z. f z ≠ 0})" by (auto simp: filterlim_def) hence"filterlim (λx. norm (f x)) (principal {0<..}) (inf F (principal {z. f z ≠ 0}))" by (rule filterlim_mono) simp_all
} ultimatelyhave norm: "filterlim (λx. norm (f x)) (at_right 0) (inf F (principal {z. f z ≠ 0}))" by (simp add: filterlim_inf at_within_def)
have A: "LIM x inf F (principal {z. f z ≠ 0}). Re (g x) * -ln (cmod (f x)) :> at_top" by (rule filterlim_tendsto_pos_mult_at_top tendsto_intros g' b
filterlim_compose[OF filterlim_uminus_at_top_at_bot] filterlim_compose[OF ln_at_0] norm)+ have B: "LIM x inf F (principal {z. f z ≠ 0}). -∣Im (g x)∣ * pi + -(Re (g x) * ln (cmod (f x))) :> at_top" by (rule filterlim_tendsto_add_at_top tendsto_intros g')+ (insert A, simp_all) have C: "(h ---> 0) F"unfolding h_def by (intro filterlim_If tendsto_const filterlim_compose[OF exp_at_bot])
(insert B, auto simp: filterlim_uminus_at_bot algebra_simps) show"((λx. norm (f x powr g x)) ---> 0) F" by (rule Lim_null_comparison[OF always_eventually C]) (insert le, auto) qed
lemma tendsto_powr_complex' [tendsto_intros]: fixes f g :: "_ → complex" assumes"a ∉ℝ\<le>0∨ (a = 0 ∧ Re b > 0)"and"(f ---> a) F""(g ---> b) F" shows"((λz. f z powr g z) ---> a powr b) F" using assms tendsto_powr_complex tendsto_powr_complex_0 by fastforce
lemma tendsto_neg_powr_complex_of_real: assumes"filterlim f at_top F"and"Re s < 0" shows"((λx. complex_of_real (f x) powr s) ---> 0) F" proof - have"((λx. norm (complex_of_real (f x) powr s)) ---> 0) F" proof (rule Lim_transform_eventually) from assms(1) have"eventually (λx. f x ≥ 0) F" by (auto simp: filterlim_at_top) thus"eventually (λx. f x powr Re s = norm (of_real (f x) powr s)) F" by eventually_elim (simp add: norm_powr_real_powr) from assms show"((λx. f x powr Re s) ---> 0) F" by (intro tendsto_neg_powr) qed thus ?thesis by (simp add: tendsto_norm_zero_iff) qed
lemma tendsto_neg_powr_complex_of_nat: assumes"filterlim f at_top F"and"Re s < 0" shows"((λx. of_nat (f x) powr s) ---> 0) F" using tendsto_neg_powr_complex_of_real [of "real o f" F s] proof - have"((λx. of_real (real (f x)) powr s) ---> 0) F"using assms(2) by (intro filterlim_compose[OF _ tendsto_neg_powr_complex_of_real]
filterlim_compose[OF _ assms(1)] filterlim_real_sequentially filterlim_ident) auto thus ?thesis by simp qed
lemma continuous_powr_complex [continuous_intros]: assumes"continuous F f""continuous F g" assumes"Re (f (netlimit F)) ≥ 0 ∨ Im (f (netlimit F)) ≠ 0" assumes"f (netlimit F) = 0 ⟶ Re (g (netlimit F)) > 0" shows"continuous F (λz. f z powr g z :: complex)" using assms unfolding continuous_def by (intro tendsto_powr_complex')
(auto simp: complex_nonpos_Reals_iff complex_eq_iff)
lemma continuous_powr_real [continuous_intros]: assumes"continuous F f""continuous F g" assumes"f (netlimit F) = 0 ⟶ g (netlimit F) > 0 ∧ (∀F z in F. 0 ≤ f z)" shows"continuous F (λz. f z powr g z :: real)" using assms unfolding continuous_def by (intro tendsto_intros) auto
lemma isCont_powr_complex [continuous_intros]: assumes"f z ∉ℝ\<le>0""isCont f z""isCont g z" shows"isCont (λz. f z powr g z :: complex) z" using assms unfolding isCont_def by (intro tendsto_powr_complex) simp_all
lemma continuous_on_powr_complex [continuous_intros]: assumes"A ⊆ {z. Re (f z) ≥ 0 ∨ Im (f z) ≠ 0}" assumes"∧z. z ∈ A ==> f z = 0 ==> Re (g z) > 0" assumes"continuous_on A f""continuous_on A g" shows"continuous_on A (λz. f z powr g z)" unfolding continuous_on_def proof fix z assume z: "z ∈ A" show"((λz. f z powr g z) ---> f z powr g z) (at z within A)" proof (cases "f z = 0") case False from assms(1,2) z have"Re (f z) ≥ 0 ∨ Im (f z) ≠ 0""f z = 0 ⟶ Re (g z) > 0"by auto with assms(3,4) z show ?thesis by (intro tendsto_powr_complex')
(auto elim!: nonpos_Reals_cases simp: complex_eq_iff continuous_on_def) next case True with assms z show ?thesis by (auto intro!: tendsto_powr_complex_0 simp: continuous_on_def) qed qed
lemma analytic_on_powr [analytic_intros]: assumes"f analytic_on X""g analytic_on X""∧x. x ∈ X ==> f x ∉ℝ\<le>0" shows"(λx. f x powr g x) analytic_on X" proof - from assms(1) obtain X1 where X1: "open X1""X ⊆ X1""f analytic_on X1" unfolding analytic_on_holomorphic by blast from assms(2) obtain X2 where X2: "open X2""X ⊆ X2""g analytic_on X2" unfolding analytic_on_holomorphic by blast have X: "open (X2 ∩ (X1 ∩ f -` (-ℝ\<le>0)))" by (rule open_Int[OF _ continuous_open_preimage])
(use X1 X2 in‹auto intro!: holomorphic_on_imp_continuous_on analytic_imp_holomorphic›) have X': "X ⊆ X2 ∩ (X1 ∩ f -` (-ℝ\<le>0))" using assms(3) X1(2) X2(2) by blast note [holomorphic_intros] =
analytic_imp_holomorphic[OF analytic_on_subset[OF X1(3)]]
analytic_imp_holomorphic[OF analytic_on_subset[OF X2(3)]] have"(λx. exp (ln (f x) * g x)) holomorphic_on (X2 ∩ (X1 ∩ f -` (-ℝ\<le>0)))" by (intro holomorphic_intros) auto alsohave"?this ⟷ (λx. f x powr g x) holomorphic_on (X2 ∩ (X1 ∩ f -` (-ℝ\<le>0)))" by (intro holomorphic_cong) (auto simp: powr_def mult.commute) finallyshow ?thesis using X X' unfolding analytic_on_holomorphic by blast qed
lemma holomorphic_on_powr [holomorphic_intros]: assumes"f holomorphic_on X""g holomorphic_on X""∧x. x ∈ X ==> f x ∉ℝ\<le>0" shows"(λx. f x powr g x) holomorphic_on X" proof - have [simp]: "f x ≠ 0"if"x ∈ X"for x using assms(3)[OF that] by auto have"(λx. exp (ln (f x) * g x)) holomorphic_on X" by (auto intro!: holomorphic_intros assms(1,2)) (use assms(3) in auto) alsohave"?this ⟷ ?thesis" by (intro holomorphic_cong) (use assms(3) in‹auto simp: powr_def mult_ac›) finallyshow ?thesis . qed
lemma field_differentiable_at_Arctan: "(Re z = 0 ==>∣Im z∣ < 1) ==> Arctan field_differentiable at z" using has_field_derivative_Arctan by (auto simp: field_differentiable_def)
lemma field_differentiable_within_Arctan: "(Re z = 0 ==>∣Im z∣ < 1) ==> Arctan field_differentiable (at z within s)" using field_differentiable_at_Arctan field_differentiable_at_within by blast
lemma continuous_at_Arctan: "(Re z = 0 ==>∣Im z∣ < 1) ==> continuous (at z) Arctan" by (simp add: field_differentiable_imp_continuous_at field_differentiable_within_Arctan)
lemma continuous_within_Arctan: "(Re z = 0 ==>∣Im z∣ < 1) ==> continuous (at z within s) Arctan" using continuous_at_Arctan continuous_at_imp_continuous_within by blast
lemma continuous_on_Arctan [continuous_intros]: "(∧z. z ∈ s ==> Re z = 0 ==>∣Im z∣ < 1) ==> continuous_on s Arctan" by (auto simp: continuous_at_imp_continuous_on continuous_within_Arctan)
lemma holomorphic_on_Arctan: "(∧z. z ∈ s ==> Re z = 0 ==>∣Im z∣ < 1) ==> Arctan holomorphic_on s" by (simp add: field_differentiable_within_Arctan holomorphic_on_def)
theorem Arctan_series: assumes z: "norm (z :: complex) < 1" defines"g ≡ λn. if odd n then -i*i^n / n else 0" defines"h ≡ λz n. (-1)^n / of_nat (2*n+1) * (z::complex)^(2*n+1)" shows"(λn. g n * z^n) sums Arctan z" and"h z sums Arctan z" proof - define G where [abs_def]: "G z = (∑n. g n * z^n)"for z have summable: "summable (λn. g n * u^n)"if"norm u < 1"for u proof (cases "u = 0") case False have"(λn. ereal (norm (h u n) / norm (h u (Suc n)))) = (λn. ereal (inverse (norm u)^2) * ereal ((2 + inverse (real (Suc n))) / (2 - inverse (real (Suc n)))))" proof fix n have"ereal (norm (h u n) / norm (h u (Suc n))) = ereal (inverse (norm u)^2) * ereal (((2*Suc n+1) / (Suc n)) / ((2*Suc n-1) / (Suc n)))" by (simp add: h_def norm_mult norm_power norm_divide field_split_simps
power2_eq_square eval_nat_numeral del: of_nat_add of_nat_Suc) alsohave"of_nat (2*Suc n+1) / of_nat (Suc n) = (2::real) + inverse (real (Suc n))" by (auto simp: field_split_simps simp del: of_nat_Suc) simp_all? alsohave"of_nat (2*Suc n-1) / of_nat (Suc n) = (2::real) - inverse (real (Suc n))" by (auto simp: field_split_simps simp del: of_nat_Suc) simp_all? finallyshow"ereal (norm (h u n) / norm (h u (Suc n))) = ereal (inverse (norm u)^2) * ereal ((2 + inverse (real (Suc n))) / (2 - inverse (real (Suc n))))" . qed alsohave"…<---- ereal (inverse (norm u)^2) * ereal ((2 + 0) / (2 - 0))" by (intro tendsto_intros LIMSEQ_inverse_real_of_nat) simp_all finallyhave"liminf (λn. ereal (cmod (h u n) / cmod (h u (Suc n)))) = inverse (norm u)^2" by (intro lim_imp_Liminf) simp_all moreoverfrom power_strict_mono[OF that, of 2] False have"inverse (norm u)^2 > 1" by (simp add: field_split_simps) ultimatelyhave A: "liminf (λn. ereal (cmod (h u n) / cmod (h u (Suc n)))) > 1"by simp from False have"summable (h u)" by (intro summable_norm_cancel[OF ratio_test_convergence[OF _ A]])
(auto simp: h_def norm_divide norm_mult norm_power simp del: of_nat_Suc
intro!: mult_pos_pos divide_pos_pos always_eventually) thus"summable (λn. g n * u^n)" by (subst summable_mono_reindex[of "λn. 2*n+1", symmetric])
(auto simp: power_mult strict_mono_def g_def h_def elim!: oddE) qed (simp add: h_def)
have"∃c. ∀u∈ball 0 1. Arctan u - G u = c" proof (rule has_field_derivative_zero_constant) fix u :: complex assume"u ∈ ball 0 1" hence u: "norm u < 1"by (simp) define K where"K = (norm u + 1) / 2" from u and abs_Im_le_cmod[of u] have Im_u: "∣Im u∣ < 1"by linarith from u have K: "0 ≤ K""norm u < K""K < 1"by (simp_all add: K_def) hence"(G has_field_derivative (∑n. diffs g n * u ^ n)) (at u)"unfolding G_def by (intro termdiffs_strong[of _ "of_real K"] summable) simp_all alsohave"(λn. diffs g n * u^n) = (λn. if even n then (i*u)^n else 0)" by (intro ext) (simp_all del: of_nat_Suc add: g_def diffs_def power_mult_distrib) alsohave"suminf … = (∑n. (-(u^2))^n)" by (subst suminf_mono_reindex[of "λn. 2*n", symmetric])
(auto elim!: evenE simp: strict_mono_def power_mult power_mult_distrib) alsofrom u have"norm u^2 < 1^2"by (intro power_strict_mono) simp_all hence"(∑n. (-(u^2))^n) = inverse (1 + u^2)" by (subst suminf_geometric) (simp_all add: norm_power inverse_eq_divide) finallyhave"(G has_field_derivative inverse (1 + u2)) (at u)" . from DERIV_diff[OF has_field_derivative_Arctan this] Im_u u show"((λu. Arctan u - G u) has_field_derivative 0) (at u within ball 0 1)" by (simp_all add: at_within_open[OF _ open_ball]) qed simp_all thenobtain c where c: "∧u. norm u < 1 ==> Arctan u - G u = c"by auto from this[of 0] have"c = 0"by (simp add: G_def g_def) with c z have"Arctan z = G z"by simp with summable[OF z] show"(λn. g n * z^n) sums Arctan z"unfolding G_def by (simp add: sums_iff) thus"h z sums Arctan z"by (subst (asm) sums_mono_reindex[of "λn. 2*n+1", symmetric])
(auto elim!: oddE simp: strict_mono_def power_mult g_def h_def) qed
text‹A quickly-converging series for the logarithm, based on the arctangent.› theorem ln_series_quadratic: assumes x: "x > (0::real)" shows"(λn. (2*((x - 1) / (x + 1)) ^ (2*n+1) / of_nat (2*n+1))) sums ln x" proof - define y :: complex where"y = of_real ((x-1)/(x+1))" from x have x': "complex_of_real x ≠ of_real (-1)"by (subst of_real_eq_iff) auto from x have"∣x - 1∣ < ∣x + 1∣"by linarith hence"norm (complex_of_real (x - 1) / complex_of_real (x + 1)) < 1" by (simp add: norm_divide del: of_real_add of_real_diff) hence"norm (i * y) < 1"unfolding y_def by (subst norm_mult) simp hence"(λn. (-2*i) * ((-1)^n / of_nat (2*n+1) * (i*y)^(2*n+1))) sums ((-2*i) * Arctan (i*y))" by (intro Arctan_series sums_mult) simp_all alsohave"(λn. (-2*i) * ((-1)^n / of_nat (2*n+1) * (i*y)^(2*n+1))) = (λn. (-2*i) * ((-1)^n * (i*y*(-y2)^n)/of_nat (2*n+1)))" by (intro ext) (simp_all add: power_mult power_mult_distrib) alsohave"… = (λn. 2*y* ((-1) * (-y2))^n/of_nat (2*n+1))" by (intro ext, subst power_mult_distrib) (simp add: algebra_simps power_mult) alsohave"… = (λn. 2*y^(2*n+1) / of_nat (2*n+1))" by (subst power_add, subst power_mult) (simp add: mult_ac) alsohave"… = (λn. of_real (2*((x-1)/(x+1))^(2*n+1) / of_nat (2*n+1)))" by (intro ext) (simp add: y_def) alsohave"i * y = (of_real x - 1) / (-i * (of_real x + 1))" by (subst divide_divide_eq_left [symmetric]) (simp add: y_def) alsohave"… = moebius 1 (-1) (-i) (-i) (of_real x)"by (simp add: moebius_def algebra_simps) alsofrom x' have"-2*i*Arctan … = Ln (of_real x)"by (intro Ln_conv_Arctan [symmetric]) simp_all alsofrom x have"… = ln x"by (rule Ln_of_real) finallyshow ?thesis by (subst (asm) sums_of_real_iff) qed
subsection✐‹tag unimportant›‹Real arctangent›
lemma Im_Arctan_of_real [simp]: "Im (Arctan (of_real x)) = 0" proof - have ne: "1 + x2≠ 0" by (metis power_one sum_power2_eq_zero_iff zero_neq_one) have ne1: "1 + i * complex_of_real x ≠ 0" using Complex_eq complex_eq_cancel_iff2 by fastforce have"Re (Ln ((1 - i * x) * inverse (1 + i * x))) = 0" apply (rule norm_exp_imaginary) using ne apply (simp add: ne1 cmod_def) apply (auto simp: field_split_simps) apply algebra done thenshow ?thesis unfolding Arctan_def divide_complex_def by (simp add: complex_eq_iff) qed
lemma arctan_eq_Re_Arctan: "arctan x = Re (Arctan (of_real x))" proof (rule arctan_unique) have"(1 - i * x) / (1 + i * x) ∉ℝ\<le>0" by (auto simp: Im_complex_div_lemma complex_nonpos_Reals_iff) thenshow"- (pi / 2) < Re (Arctan (complex_of_real x))" by (simp add: Arctan_def Im_Ln_less_pi) next have *: " (1 - i*x) / (1 + i*x) ≠ 0" by (simp add: field_split_simps) ( simp add: complex_eq_iff) show"Re (Arctan (complex_of_real x)) < pi / 2" using mpi_less_Im_Ln [OF *] by (simp add: Arctan_def) next have"tan (Re (Arctan (of_real x))) = Re (tan (Arctan (of_real x)))" by (metis Im_Arctan_of_real Re_complex_of_real complex_is_Real_iff of_real_Re tan_of_real) alsohave"… = x" proof - have"(complex_of_real x)2≠ - 1" by (smt (verit, best) Im_complex_of_real imaginary_unit.sel(2) of_real_minus power2_eq_iff power2_i) thenshow ?thesis by simp qed finallyshow"tan (Re (Arctan (complex_of_real x))) = x" . qed
lemma Arcsin_body_lemma: "i * z + csqrt(1 - z2) ≠ 0" using power2_csqrt [of "1 - z2"] by (metis add.inverse_unique diff_0 diff_add_cancel mult.left_commute mult_minus1_right power2_i power2_minus power_mult_distrib zero_neq_one)
lemma Arcsin_range_lemma: "∣Re z∣ < 1 ==> 0 < Re(i * z + csqrt(1 - z2))" using Complex.cmod_power2 [of z, symmetric] by (simp add: real_less_rsqrt algebra_simps Re_power2 cmod_square_less_1_plus)
lemma Re_Arcsin: "Re(Arcsin z) = Im (Ln (i * z + csqrt(1 - z2)))" by (simp add: Arcsin_def)
lemma Im_Arcsin: "Im(Arcsin z) = - ln (cmod (i * z + csqrt (1 - z2)))" by (simp add: Arcsin_def Arcsin_body_lemma)
lemma one_minus_z2_notin_nonpos_Reals: assumes"Im z = 0 ==>∣Re z∣ < 1" shows"1 - z2∉ℝ\<le>0" proof (cases "Im z = 0") case True with assms show ?thesis by (simp add: complex_nonpos_Reals_iff flip: abs_square_less_1) next case False have"¬ (Im z)2≤ - 1" using False power2_less_eq_zero_iff by fastforce with False show ?thesis by (auto simp add: complex_nonpos_Reals_iff Re_power2 Im_power2) qed
lemma isCont_Arcsin_lemma: assumes le0: "Re (i * z + csqrt (1 - z2)) ≤ 0"and"(Im z = 0 ==>∣Re z∣ < 1)" shows False proof (cases "Im z = 0") case True thenshow ?thesis using assms by (fastforce simp: cmod_def abs_square_less_1 [symmetric]) next case False have leim: "(cmod (1 - z2) + (1 - Re (z2))) / 2 ≤ (Im z)2" using le0 sqrt_le_D by fastforce have neq: "(cmod z)2≠ 1 + cmod (1 - z2)" proof (clarsimp simp add: cmod_def) assume"(Re z)2 + (Im z)2 = 1 + sqrt ((1 - Re (z2))2 + (Im (z2))2)" thenhave"((Re z)2 + (Im z)2 - 1)2 = ((1 - Re (z2))2 + (Im (z2))2)" by simp thenshow False using False by (simp add: power2_eq_square algebra_simps) qed moreoverhave2: "(Im z)2 = (1 + ((Im z)2 + cmod (1 - z2)) - (Re z)2) / 2" using leim cmod_power2 [of z] norm_triangle_ineq2 [of "z^2"1] by (simp add: norm_power Re_power2 norm_minus_commute [of 1]) ultimatelyshow False by (simp add: Re_power2 Im_power2 cmod_power2) qed
lemma isCont_Arcsin: assumes"(Im z = 0 ==>∣Re z∣ < 1)" shows"isCont Arcsin z" proof - have1: "i * z + csqrt (1 - z2) ∉ℝ\<le>0" by (metis isCont_Arcsin_lemma assms complex_nonpos_Reals_iff) have2: "1 - z2∉ℝ\<le>0" by (simp add: one_minus_z2_notin_nonpos_Reals assms) show ?thesis using assms unfolding Arcsin_def by (intro isCont_Ln' isCont_csqrt' continuous_intros 12) qed
lemma field_differentiable_at_Arcsin: "(Im z = 0 ==>∣Re z∣ < 1) ==> Arcsin field_differentiable at z" using field_differentiable_def has_field_derivative_Arcsin by blast
lemma field_differentiable_within_Arcsin: "(Im z = 0 ==>∣Re z∣ < 1) ==> Arcsin field_differentiable (at z within s)" using field_differentiable_at_Arcsin field_differentiable_within_subset by blast
lemma continuous_within_Arcsin: "(Im z = 0 ==>∣Re z∣ < 1) ==> continuous (at z within s) Arcsin" using continuous_at_imp_continuous_within isCont_Arcsin by blast
lemma continuous_on_Arcsin [continuous_intros]: "(∧z. z ∈ s ==> Im z = 0 ==>∣Re z∣ < 1) ==> continuous_on s Arcsin" by (simp add: continuous_at_imp_continuous_on)
lemma holomorphic_on_Arcsin: "(∧z. z ∈ s ==> Im z = 0 ==>∣Re z∣ < 1) ==> Arcsin holomorphic_on s" by (simp add: field_differentiable_within_Arcsin holomorphic_on_def)
lemma field_differentiable_at_Arccos: "(Im z = 0 ==>∣Re z∣ < 1) ==> Arccos field_differentiable at z" using field_differentiable_def has_field_derivative_Arccos by blast
lemma field_differentiable_within_Arccos: "(Im z = 0 ==>∣Re z∣ < 1) ==> Arccos field_differentiable (at z within s)" using field_differentiable_at_Arccos field_differentiable_within_subset by blast
lemma continuous_within_Arccos: "(Im z = 0 ==>∣Re z∣ < 1) ==> continuous (at z within s) Arccos" using continuous_at_imp_continuous_within isCont_Arccos by blast
lemma continuous_on_Arccos [continuous_intros]: "(∧z. z ∈ s ==> Im z = 0 ==>∣Re z∣ < 1) ==> continuous_on s Arccos" by (simp add: continuous_at_imp_continuous_on)
lemma holomorphic_on_Arccos: "(∧z. z ∈ s ==> Im z = 0 ==>∣Re z∣ < 1) ==> Arccos holomorphic_on s" by (simp add: field_differentiable_within_Arccos holomorphic_on_def)
subsection✐‹tag unimportant›\<open>Upper and Lower Bounds for Inverse Sine and Cosine›
corollary bij_betw_roots_unity: "bij_betw (λj. exp(2 * of_real pi * i * of_nat j / of_nat n)) {..<n} {exp(2 * of_real pi * i * of_nat j / of_nat n) | j. j < n}" by (auto simp: bij_betw_def inj_on_def complex_root_unity_eq)
lemma complex_root_unity_eq_1: fixes j::nat and k::nat assumes"1 ≤ n" shows"exp(2 * of_real pi * i * of_nat j / of_nat n) = 1 ⟷ n dvd j" proof - have"1 = exp(2 * of_real pi * i * (of_nat n / of_nat n))" using assms by simp thenhave"exp(2 * of_real pi * i * (of_nat j / of_nat n)) = 1 ⟷ j mod n = n mod n" using complex_root_unity_eq [of n j n] assms by simp thenshow ?thesis by auto qed
lemma finite_complex_roots_unity_explicit: "finite {exp(2 * of_real pi * i * of_nat j / of_nat n) | j::nat. j < n}" by simp
lemma card_complex_roots_unity_explicit: "card {exp(2 * of_real pi * i * of_nat j / of_nat n) | j::nat. j < n} = n" by (simp add: Finite_Set.bij_betw_same_card [OF bij_betw_roots_unity, symmetric])
lemma card_complex_roots_unity: "1 ≤ n ==> card {z::complex. z^n = 1} = n" by (simp add: card_complex_roots_unity_explicit complex_roots_unity)
lemma complex_not_root_unity: "1 ≤ n ==>∃u::complex. norm u = 1 ∧ u^n ≠ 1" apply (rule_tac x="exp (of_real pi * i * of_real (1 / n))"in exI) apply (auto simp: Re_complex_div_eq_0 exp_of_nat_mult [symmetric] mult_ac exp_Euler) done
subsection‹Normalisation of angles›
text‹
The following operation normalises an angle $\varphi$, i.e.\ returns the unique
$\psi$ in the range $(-\pi, \pi]$ such that
$\varphi\equiv\psi\hskip.5em(\text{mod}\ 2\pi)$.
This is the same convention used by the const‹Arg› function. › definition normalize_angle :: "real → real"where "normalize_angle x = x - ⌈x / (2 * pi) - 1 / 2⌉ * (2 * pi)"
lemma normalize_angle_id [simp]: assumes"x ∈ {-pi<..pi}" shows"normalize_angle x = x" proof - have"-1 < x / (2 * pi) - 1 / 2""x / (2 * pi) - 1 / 2 ≤ 0" using assms pi_gt3 by (auto simp: field_simps) hence"ceiling (x / (2 * pi) - 1 / 2) = 0" by linarith thus ?thesis by (simp add: normalize_angle_def) qed
lemma normalize_angle_normalized: "normalize_angle x ∈ {-pi<..pi}" proof - have"-1 < x / (2 * pi) - 1 / 2 - ceiling (x / (2 * pi) - 1 / 2)" by linarith moreoverhave"x / (2 * pi) - 1 / 2 - ceiling (x / (2 * pi) - 1 / 2) ≤ 0" by linarith ultimatelyshow ?thesis using pi_gt3 by (auto simp: field_simps normalize_angle_def) qed
lemma rcis_normalize_angle [simp]: "rcis r (normalize_angle x) = rcis r x" by (simp add: rcis_def)
lemma normalize_angle_lbound [intro]: "normalize_angle x > -pi" and normalize_angle_ubound [intro]: "normalize_angle x ≤ pi" using normalize_angle_normalized[of x] by auto
lemma normalize_angle_idem [simp]: "normalize_angle (normalize_angle x) = normalize_angle x" by (rule normalize_angle_id) (use normalize_angle_normalized[of x] in auto)
lemma Arg_rcis': "r > 0 ==> Arg (rcis r φ) = normalize_angle φ" by (rule Arg_unique'[of r]) auto
subsection‹Convexity of circular sectors in the complex plane›
text‹
In this section we will show that if we have two non-zero points $w$ and $z$ in the complex plane
whose arguments differ by less than $\pi$, then the argument of any point on the line connecting
$w$ and $z$ lies between the arguments of $w$ and $z$. Moreover, the norm of any such point is
no greater than the norms of $w$ and $z$.
Geometrically, this means that if we have a sector around the origin with a central angle
less than $\pi$ (minus the origin itself) then that region is convex. ›
lemma Arg_closed_segment_aux1: assumes"x ≠ 0""y ≠ 0""Re x > 0""Re x = Re y" assumes"z ∈ closed_segment x y" shows"Arg z ∈ closed_segment (Arg x) (Arg y)" using assms proof (induction"Arg x""Arg y" arbitrary: x y rule: linorder_wlog) case (le x y) from le have"Re z = Re x""Im z ∈ closed_segment (Im x) (Im y)" by (auto simp: closed_segment_same_Re) thenobtain t where t: "t ∈ {0..1}""Im z = linepath (Im x) (Im y) t" by (metis image_iff linepath_image_01) have *: "Im x ≤ Im y" using le by (auto simp: arg_conv_arctan arctan_le_iff field_simps) have"Im x / Re x ≤ linepath (Im x) (Im y) t / Re x" using le t * by (intro divide_right_mono linepath_real_ge_left) auto hence"Arg x ≤ Arg z" using t le ‹Re z = Re x›by (auto simp: arg_conv_arctan arctan_le_iff) moreoverhave"Im y / Re x ≥ linepath (Im x) (Im y) t / Re x" using le t * by (intro divide_right_mono linepath_real_le_right) auto hence"Arg y ≥ Arg z" using t le ‹Re z = Re x›by (auto simp: arg_conv_arctan arctan_le_iff) ultimatelyshow ?case using le by (auto simp: closed_segment_same_Re closed_segment_eq_real_ivl) next case (sym x y) have"Arg z ∈ closed_segment (Arg y) (Arg x)" by (rule sym(1))
(use sym(2-) in‹simp_all add: dist_commute closed_segment_commute›) thus ?case by (simp add: closed_segment_commute) qed
lemma Arg_closed_segment_aux1': fixes r1 r2 φ1 φ2 :: real defines"x ≡ rcis r1 φ1"and"y ≡ rcis r2 φ2" assumes"z ∈ closed_segment x y" assumes"r1 > 0""r2 > 0""Re x = Re y""Re x ≥ 0""Re x = 0 ⟶ Im x * Im y > 0" assumes"dist φ1 φ2 < pi" obtains r φ where"r ∈ {0<..max r1 r2}""φ ∈ closed_segment φ1 φ2""z = rcis r φ" proof (cases "Re x = 0") case True have [simp]: "cos φ1 = 0""cos φ2 = 0" using assms True by auto have"sin φ1 = 1 ∧ sin φ2 = 1 ∨ sin φ1 = -1 ∧ sin φ2 = -1" using sin_cos_squared_add[of φ1] sin_cos_squared_add[of φ2] assms by (auto simp: zero_less_mult_iff power2_eq_1_iff) thus ?thesis proof (elim disjE conjE) assume [simp]: "sin φ1 = 1""sin φ2 = 1" have xy_eq: "x = of_real r1 * i""y = of_real r2 * i" by (auto simp: complex_eq_iff x_def y_def) hence z: "Re z = 0""Im z ∈ closed_segment r1 r2" using‹z ∈ closed_segment x y ›by (auto simp: xy_eq closed_segment_same_Re) have"closed_segment r1 r2 ⊆ {0<..max r1 r2}" by (rule closed_segment_subset) (use assms in auto) with z have"Im z ∈ {0<..max r1 r2}" by blast show ?thesis by (rule that[of "Im z" φ1])
(use z ‹Im z ∈ {0<..max r1 r2}›in‹auto simp: complex_eq_iff›) next assume [simp]: "sin φ1 = -1""sin φ2 = -1" have xy_eq: "x = -of_real r1 * i""y = -of_real r2 * i" by (auto simp: complex_eq_iff x_def y_def) hence z: "Re z = 0""Im z ∈ closed_segment (-r1) (-r2)" using‹z ∈ closed_segment x y ›by (auto simp: xy_eq closed_segment_same_Re) have"closed_segment (-r1) (-r2) ⊆ {-max r1 r2..<0}" by (rule closed_segment_subset) (use assms in auto) with z have"-Im z ∈ {0<..max r1 r2}" by auto show ?thesis by (rule that[of "-Im z" φ1])
(use z ‹-Im z ∈ {0<..max r1 r2}›in‹auto simp: complex_eq_iff›) qed next case False hence Re_pos: "Re x > 0" using‹Re x ≥ 0›by linarith define n :: int where"n = ⌈φ1 / (2 * pi) - 1 / 2⌉" define n' :: int where"n' = ⌈φ2 / (2 * pi) - 1 / 2⌉"
have"Re z = Re x" using assms by (auto simp: closed_segment_same_Re)
have Arg_z: "Arg z ∈ closed_segment (Arg x) (Arg y)" by (rule Arg_closed_segment_aux1) (use assms Re_pos in‹simp_all add: dist_norm›)
have"z ∈ closed_segment x y" by fact alsohave"…⊆ cball 0 (max r1 r2)" using _ _ convex_cball by (rule closed_segment_subset) (use assms in auto) finallyhave"norm z ≤ max r1 r2" by auto moreoverhave"z ≠ 0" by (intro notI) (use‹Re x > 0›‹Re z = Re x›in auto) ultimatelyhave norm_z: "norm z ∈ {0<..max r1 r2}" by simp
have Arg_x: "Arg x = φ1 - 2 * pi * of_int n" using assms by (simp add: x_def Arg_rcis' normalize_angle_def n_def) have Arg_y: "Arg y = φ2 - 2 * pi * of_int n'" using assms by (simp add: x_def Arg_rcis' normalize_angle_def n'_def) have Arg_bounds: "∣Arg x∣≤ pi/2""∣Arg y∣≤ pi/2" by (subst Arg_Re_nonneg; use assms in simp)+
have"pi * of_int (2 * ∣n - n'∣ - 1) = 2 * pi * of_int (∣n - n'∣) - pi" by (simp add: algebra_simps) alsohave"… = ∣2 * pi * of_int (n - n')∣ - pi / 2 - pi / 2" by (simp add: abs_mult) alsohave"…≤∣2 * pi * of_int (n - n') + Arg x - Arg y∣" using Arg_bounds pi_gt_zero by linarith alsohave"…≤ dist φ1 φ2" using Arg_x Arg_y unfolding dist_norm real_norm_def by (simp add: algebra_simps) alsohave"… < pi * 1" using assms by simp finallyhave"2 * ∣n - n'∣ - 1 < 1" by (subst (asm) mult_less_cancel_left_pos) auto hence [simp]: "n' = n" by presburger
show ?thesis using norm_z proof (rule that[of "norm z""Arg z + 2 * pi * of_int n"]) have"2 * pi * of_int n + Arg z ∈ ((+) (2 * pi * of_int n)) ` closed_segment (Arg x) (Arg y)" using Arg_z by blast alsohave"… = closed_segment (2 * pi * real_of_int n + Arg x) (2 * pi * real_of_int n + Arg y)" by (rule closed_segment_translation [symmetric]) alsohave"2 * pi * real_of_int n + Arg x = φ1" by (simp add: Arg_x) alsohave"2 * pi * real_of_int n + Arg y = φ2" by (simp add: Arg_y) finallyshow"Arg z + 2 * pi * real_of_int n ∈ closed_segment φ1 φ2" by (simp add: add_ac) next have"z = rcis (norm z) (Arg z)" by (simp add: rcis_cmod_Arg) alsohave"… = rcis (cmod z) (Arg z + 2 * pi * real_of_int n)" by (simp add: rcis_def flip: cis_mult) finallyshow"z = …" . qed qed
lemma Arg_closed_segment': fixes r1 r2 φ1 φ2 :: real defines"x ≡ rcis r1 φ1"and"y ≡ rcis r2 φ2" assumes"r1 > 0""r2 > 0""dist φ1 φ2 < pi""z ∈ closed_segment x y" obtains r φ where"r ∈ {0<..max r1 r2}""φ ∈ closed_segment φ1 φ2""z = rcis r φ" proof - define u_aux :: real where "u_aux = (if Im x = Im y then pi/2 else arctan (Re (x-y) / Im (x-y)))" define u :: real where "u = (if Re (x * cis u_aux) < 0 then if u_aux ≤ 0 then u_aux + pi else u_aux - pi else u_aux)"
have"u_aux ∈ {-pi/2<..pi/2}" using arctan_lbound[of "Re (x-y) / Im (x-y)"] arctan_ubound[of "Re (x-y) / Im (x-y)"] by (auto simp: u_aux_def) have u_bounds: "u ∈ {-pi<..pi}" using‹u_aux ∈ _›by (auto simp: u_def)
have u_aux: "(Re x - Re y) * cos u_aux = (Im x - Im y) * sin u_aux" proof (cases "Im x = Im y") case False hence"tan u_aux = (Re x - Re y) / (Im x - Im y)"and"cos u_aux ≠ 0" by (auto simp: u_aux_def tan_arctan) thus ?thesis using False by (simp add: tan_def divide_simps mult_ac split: if_splits) qed (auto simp: u_aux_def) hence"Re (x * cis u_aux) = Re (y * cis u_aux)" by (auto simp: algebra_simps) hence same_Re: "Re (x * cis u) = Re (y * cis u)" by (auto simp: u_def)
have Re_nonneg: "Re (x * cis u) ≥ 0" by (auto simp: u_def)
have"linear (λw. w * cis u)" by (intro linearI) (auto simp: algebra_simps) hence"closed_segment (x * cis u) (y * cis u) = (λw. w * cis u) ` closed_segment x y" by (intro closed_segment_linear_image) hence z'_in: "z * cis u ∈ closed_segment (x * cis u) (y * cis u)" using assms by blast
obtain r φ where rφ: "r ∈ {0<..max r1 r2}""φ ∈ closed_segment (φ1 + u) (φ2 + u)""z * cis u = rcis r φ" proof (rule Arg_closed_segment_aux1'[of "z * cis u" r1 "φ1 + u" r2 "φ2 + u"]) show"z * cis u ∈ closed_segment (rcis r1 (φ1 + u)) (rcis r2 (φ2 + u))" using z'_inby (simp add: x_def y_def rcis_def mult.assoc flip: cis_mult) next show"r1 > 0""r2 > 0" by fact+ next show"Re (rcis r1 (φ1 + u)) = Re (rcis r2 (φ2 + u))" using same_Re by (simp add: x_def y_def cos_add field_simps) next show"Re (rcis r1 (φ1 + u)) ≥ 0" using‹r1 > 0› Re_nonneg by (auto intro!: mult_nonneg_nonneg simp: cos_add x_def) next show"dist (φ1 + u) (φ2 + u) < pi" using assms by (simp add: dist_norm) next show"Re (rcis r1 (φ1 + u)) = 0 ⟶ 0 < Im (rcis r1 (φ1 + u)) * Im (rcis r2 (φ2 + u))" proof assume *: "Re (rcis r1 (φ1 + u)) = 0" hence"cos (φ1 + u) = 0" using assms by simp thenobtain n1 where"φ1 + u = real_of_int n1 * pi + pi / 2" by (subst (asm) cos_zero_iff_int2) auto hence n1: "φ1 = real_of_int n1 * pi + pi / 2 - u" by linarith
have"Re (rcis r1 (φ1 + u)) = 0" by fact alsohave"rcis r1 (φ1 + u) = x * cis u" by (simp add: x_def rcis_def cis_mult) alsohave"Re (x * cis u) = Re (y * cis u)" by (fact same_Re) alsohave"y * cis u = rcis r2 (φ2 + u)" by (simp add: y_def rcis_def cis_mult) finallyhave"cos (φ2 + u) = 0" using assms by simp thenobtain n2 where"φ2 + u = real_of_int n2 * pi + pi / 2" by (subst (asm) cos_zero_iff_int2) auto hence n2: "φ2 = real_of_int n2 * pi + pi / 2 - u" by linarith
have"pi * real_of_int ∣n2 - n1∣ = ∣real_of_int (n2 - n1) * pi∣" by (simp add: abs_mult) alsohave"… = dist φ1 φ2" by (simp add: n1 n2 dist_norm ring_distribs) alsohave"… < pi * 1" using‹dist φ1 φ2 < pi›by simp finallyhave"real_of_int ∣n2 - n1∣ < 1" by (subst (asm) mult_less_cancel_left_pos) auto hence"n1 = n2" by linarith
have"Im (rcis r1 (φ1 + u)) * Im (rcis r2 (φ2 + u)) = r1 * r2 * cos (real_of_int n2 * pi) ^ 2" by (simp add: n1 n2 sin_add ‹n1 = n2› power2_eq_square) alsohave"cos (real_of_int n2 * pi) ^ 2 = (cos (2 * (real_of_int n2 * pi)) + 1) / 2" by (subst cos_double_cos) auto alsohave"2 * (real_of_int n2 * pi) = 2 * pi * real_of_int n2" by (simp add: mult_ac) alsohave"(cos … + 1) / 2 = 1" by (subst cos_int_2pin) auto alsohave"r1 * r2 * 1 > 0" using assms by simp finallyshow"Im (rcis r1 (φ1 + u)) * Im (rcis r2 (φ2 + u)) > 0" . qed qed
show ?thesis proof (rule that[of r "φ - u"]) show"r ∈ {0<..max r1 r2}" by fact next have"u + (φ - u) ∈ closed_segment (φ1 + u) (φ2 + u)" using rφ by simp alsohave"… = (+) u ` closed_segment φ1 φ2" by (subst (12) add.commute, rule closed_segment_translation) finallyshow"φ - u ∈ closed_segment φ1 φ2" by (subst (asm) inj_image_mem_iff) auto next show"z = rcis r (φ - u)" using rφ by (simp add: rcis_def field_simps flip: cis_divide) qed qed
lemma Arg_closed_segment: assumes"x ≠ 0""y ≠ 0""dist (Arg x) (Arg y) < pi""z ∈ closed_segment x y" shows"Arg z ∈ closed_segment (Arg x) (Arg y)" proof - define r1 φ1where"r1 = norm x"and"φ1 = Arg x" define r2 φ2where"r2 = norm y"and"φ2 = Arg y" notedefs = r1_def r2_def φ1_def φ2_def obtain r φ where *: "r ∈ {0<..max r1 r2}""φ ∈ closed_segment φ1 φ2""z = rcis r φ" by (rule Arg_closed_segment'[of r1 r2 φ1 φ2 z])
(use assms in‹auto simp: defs rcis_cmod_Arg›) have"Arg z = φ" proof (rule Arg_unique') show"z = rcis r φ""r > 0" using * by auto next have"φ ∈ closed_segment φ1 φ2" by (fact *) alsohave"…⊆ {-pi<..pi}" by (rule closed_segment_subset)
(use assms * Arg_bounded[of x] Arg_bounded[of y] in‹auto simp: defs›) finallyshow"φ ∈ {-pi<..pi}" by auto qed with * show ?thesis by (simp add: defs) qed
subsection‹Complex cones›
text‹
We introduce the following notation to describe the set of all complex numbers of the form
$c e^{ix}$ where $c\geq 0$ and $x\in [a, b]$. › definition complex_cone :: "real → real → complex set"where "complex_cone a b = (λ(r,a). rcis r a) ` ({0..} × closed_segment a b)"
lemma in_complex_cone_iff: "z ∈ complex_cone a b ⟷ (∃x∈closed_segment a b. z = rcis (norm z) x)" by (auto simp: complex_cone_def image_iff)
lemma zero_in_complex_cone [simp, intro]: "0 ∈ complex_cone a b" by (auto simp: in_complex_cone_iff)
lemma in_complex_cone_iff_Arg: assumes"a ∈ {-pi<..pi}""b ∈ {-pi<..pi}" shows"z ∈ complex_cone a b ⟷ z = 0 ∨ Arg z ∈ closed_segment a b" proof assume"z ∈ complex_cone a b" thenobtain r x where *: "x ∈ closed_segment a b""z = rcis r x""r ≥ 0" by (auto simp: complex_cone_def) have"closed_segment a b ⊆ {-pi<..pi}" by (rule closed_segment_subset) (use assms in auto) with * have **: "x ∈ {-pi<..pi}" by auto show"z = 0 ∨ Arg z ∈ closed_segment a b" proof (cases "z = 0") case False with * have"r ≠ 0" by auto with * have [simp]: "r > 0" by simp show ?thesis by (use * ** in‹auto simp: Arg_rcis›) qed auto next assume"z = 0 ∨ Arg z ∈ closed_segment a b" thus"z ∈ complex_cone a b" proof assume *: "Arg z ∈ closed_segment a b" have"z = rcis (norm z) (Arg z)" by (simp_all add: rcis_cmod_Arg) thus ?thesis using * unfolding in_complex_cone_iff by blast qed auto qed
lemma complex_cone_rotate: "complex_cone (c + a) (c + b) = (*) (cis c) ` complex_cone a b" proof - have *: "(*) (cis c) ` complex_cone a b ⊆ complex_cone (c + a) (c + b)"for c a b by (auto simp: closed_segment_translation in_complex_cone_iff norm_mult rcis_def simp flip: cis_mult)
have"complex_cone (c + a) (c + b) = (*) (cis c) ` (*) (cis (-c)) ` complex_cone (c + a) (c + b)" by (simp add: image_image field_simps flip: cis_inverse) alsohave"…⊆ (*) (cis c) ` complex_cone ((-c) + (c + a)) ((-c) + (c + b))" by (intro image_mono *) alsohave"… = (*) (cis c) ` complex_cone a b" by simp finallyshow ?thesis using *[of c a b] by blast qed
lemma complex_cone_subset: "a ∈ closed_segment a' b' ==> b ∈ closed_segment a' b' ==> complex_cone a b ⊆ complex_cone a' b'" unfolding complex_cone_def by (intro image_mono Sigma_mono order.refl, unfold subset_closed_segment) auto
lemma complex_cone_commute: "complex_cone a b = complex_cone b a" by (simp add: complex_cone_def closed_segment_commute)
lemma complex_cone_eq_UNIV: assumes"dist a b ≥ 2*pi" shows"complex_cone a b = UNIV" using assms proof (induction a b rule: linorder_wlog) case (le a b) have"bij ((*) (cis (a+pi)))" by (rule bij_betwI[of _ _ _ "(*) (cis (-a-pi))"])
(auto simp: field_simps simp flip: cis_inverse cis_divide cis_mult) hence"UNIV = (*) (cis (a+pi)) ` UNIV" unfolding bij_betw_def by blast alsohave"UNIV ⊆ complex_cone (-pi) pi" proof safe fix z :: complex have"z = rcis (norm z) (Arg z)""norm z ≥ 0""Arg z ∈ closed_segment (-pi) pi" using Arg_bounded[of z] by (auto simp: closed_segment_eq_real_ivl rcis_cmod_Arg) thus"z ∈ complex_cone (-pi) pi" unfolding in_complex_cone_iff by blast qed alsohave"(*) (cis (a + pi)) ` complex_cone (- pi) pi = complex_cone a (a + 2 * pi)" using complex_cone_rotate[of "a+pi""-pi" pi] by (simp add: add_ac) alsohave"…⊆ complex_cone a b" by (rule complex_cone_subset) (use le in‹auto simp: closed_segment_eq_real_ivl1 dist_norm›) finallyshow ?caseby blast qed (simp_all add: complex_cone_commute dist_commute)
text‹
A surprisingly tough argument: cones in the complex plane are closed. › lemma closed_complex_cone [continuous_intros, intro]: "closed (complex_cone a b)" proof (induction a b rule: linorder_wlog) case (sym a b) thus ?case by (simp add: complex_cone_commute) next case (le a b) show ?case proof (cases "b - a < 2 * pi") case False hence"complex_cone a b = UNIV" by (intro complex_cone_eq_UNIV) (auto simp: dist_norm) thus ?thesis by simp next case True define c where"c = (b - a) / 2" define d where"d = (b + a) / 2" have ab_eq: "a = d - c""b = c + d" by (simp_all add: c_def d_def field_simps) have"c ≥ 0""c < pi" using True le by (simp_all add: c_def)
define e where"e = (if c ≤ pi / 2 then 1 else sin c)" have"e > 0" proof (cases "c ≤ pi / 2") case False have"0 < pi / 2" by simp alsohave"pi / 2 < c" using False by simp finallyhave"c > 0" . moreoverhave"c < pi" using True by (simp add: c_def) ultimatelyshow ?thesis using False by (auto simp: e_def intro!: sin_gt_zero) qed (auto simp: e_def)
define A where"A = -ball 0 1 - {z. Re z < 0} ∩ ({z. Im z < e} ∩ {z. Im z > -e})"
have"closed (A ∩ (Arg -` {-c..c}))" proof (intro continuous_closed_preimage) show"closed A"unfolding A_def by (intro closed_Diff closed_Compl open_Int open_halfspace_Re_lt
open_halfspace_Im_lt open_halfspace_Im_gt open_ball) show"continuous_on A Arg" unfolding A_def using‹e > 0› by (intro continuous_intros) (auto elim!: nonpos_Reals_cases) qed auto
alsohave"A ∩ (Arg -` {-c..c}) = (Arg -` {-c..c} - {z. Re z < 0} ∩ ({z. Im z < e} ∩ {z. Im z > -e})) - ball 0 1" by (auto simp: A_def)
alsohave"… = Arg -` {-c..c} - ball 0 1" proof (intro equalityI subsetI) fix z assume z: "z ∈ Arg -` {-c..c} - ball 0 1" define r where"r = norm z" define x where"x = Arg z" have"∣x∣≤ c" using z by (auto simp: x_def) alsonote‹c < pi› finallyhave"∣x∣ < pi" .
have False if *: "Re z < 0""Im z < e""Im z > -e" proof - have"r ≥ 1" using z by (auto simp: r_def) have z_eq: "z = rcis r x" by (simp add: r_def x_def rcis_cmod_Arg) from * and‹r ≥ 1›have"cos x < 0" by (simp add: z_eq mult_less_0_iff) with‹∣x∣ < pi›have"∣x∣ > pi / 2" using cos_ge_zero[of x] by linarith hence"c > pi / 2" using‹∣x∣≤ c›by linarith
have"sin c ≤ sin ∣x∣" proof - have"sin (pi - c) ≤ sin (pi - ∣x∣)" by (rule sin_monotone_2pi_le)
(use‹∣x∣≤ c›‹∣x∣ < pi›‹∣x∣ > pi / 2›‹c < pi›in‹auto simp: field_simps›) thus ?thesis by simp qed alsohave"sin ∣x∣≤ 1 * ∣sin x∣" by (auto simp: abs_if) alsohave"1 * ∣sin x∣≤ r * ∣sin x∣" by (rule mult_right_mono) (use‹r ≥ 1›in auto) alsohave"r * ∣sin x∣ = ∣Im z∣" using‹r ≥ 1›by (simp add: z_eq abs_mult) alsohave"∣Im z∣ < e" using * by linarith finallyshow False using‹c > pi / 2›by (auto simp: e_def split: if_splits)
qed thus"z ∈ Arg -` {-c..c} - {z. Re z < 0} ∩ ({z. Im z < e} ∩ {z. Im z > -e}) - ball 0 1" using z by blast qed auto
finallyhave"closed (complex_cone (-c) c - ball 0 1)" .
moreoverhave"closed (complex_cone (-c) c ∩ cball 0 1)" proof - have"compact ((λ(r,x). rcis r x) ` ({0..1} × closed_segment (-c) c))" by (intro compact_continuous_image)
(auto intro!: continuous_intros compact_Times simp: case_prod_unfold) alsohave"((λ(r,x). rcis r x) ` ({0..1} × closed_segment (-c) c)) = complex_cone (-c) c ∩ cball 0 1" by (auto simp: in_complex_cone_iff image_def) finallyshow ?thesis by (rule compact_imp_closed) qed
ultimatelyhave"closed (complex_cone (-c) c - ball 0 1 ∪ complex_cone (-c) c ∩ cball 0 1)" by (intro closed_Un) alsohave"… = complex_cone (-c) c" by auto finallyhave"closed (complex_cone (-c) c)" .
hence"closed ((*) (cis d) ` complex_cone (-c) c)" by (intro closed_injective_linear_image) auto alsohave"… = complex_cone a b" using complex_cone_rotate[of d "-c" c] by (simp add: ab_eq add_ac) finallyshow ?thesis . qed qed
lemma norm_eq_Re_iff: "norm z = Re z ⟷ z ∈ℝ\<ge>0" proof assume"norm z = Re z" hence"norm z ^ 2 = Re z ^ 2" by simp hence"Im z = 0" by (auto simp: cmod_def) moreoverhave"Re z ≥ 0" by (subst ‹norm z = Re z› [symmetric]) auto ultimatelyshow"z ∈ℝ\<ge>0" by (auto simp: complex_nonneg_Reals_iff) qed (auto elim!: nonneg_Reals_cases)
end
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.778Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.