# HG changeset patch # User Wenda Li # Date 1519397792 0 # Node ID 68ca05a7f1596f6c47f18e5be70fea1dc647fcfa # Parent 4ddc49205f5d904561e2a6b1b133833dc03fd93c# Parent 4fa9d5ef95bc661c5892cb1728392bef5e7858eb merged diff -r 4fa9d5ef95bc -r 68ca05a7f159 src/HOL/Analysis/Complex_Transcendental.thy --- a/src/HOL/Analysis/Complex_Transcendental.thy Fri Feb 23 10:52:31 2018 +0000 +++ b/src/HOL/Analysis/Complex_Transcendental.thy Fri Feb 23 14:56:32 2018 +0000 @@ -1861,6 +1861,12 @@ shows "0 \ x \ of_real x powr (of_real y::complex) = of_real (x powr y)" by (simp_all add: powr_def exp_eq_polar) +lemma powr_of_int: + fixes z::complex and n::int + assumes "z\(0::complex)" + shows "z powr of_int n = (if n\0 then z^nat n else inverse (z^nat (-n)))" + by (metis assms not_le of_int_of_nat powr_complexpow powr_minus) + lemma powr_Reals_eq: "\x \ \; y \ \; Re x \ 0\ \ x powr y = of_real (Re x powr Re y)" by (metis not_le of_real_Re powr_of_real) @@ -1909,6 +1915,97 @@ declare has_field_derivative_powr[THEN DERIV_chain2, derivative_intros] +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 - + define dd where "dd = of_int n * g z powr (of_int (n - 1)) * gd" + obtain e where "e>0" and e_dist:"\y\s. dist z y < e \ g y \ 0" + using DERIV_continuous[OF gderiv,THEN continuous_within_avoid] \g z\0\ by auto + have ?thesis when "n\0" + proof - + define dd' where "dd' = of_int n * g z ^ (nat n - 1) * gd" + have "dd=dd'" + proof (cases "n=0") + case False + then have "n-1 \0" using \n\0\ by auto + then have "g z powr (of_int (n - 1)) = g z ^ (nat n - 1)" + using powr_of_int[OF \g z\0\,of "n-1"] by (simp add: nat_diff_distrib') + then show ?thesis unfolding dd_def dd'_def by simp + qed (simp add:dd_def dd'_def) + then have "((\z. g z powr of_int n) has_field_derivative dd) (at z within s) + \ ((\z. g z powr of_int n) has_field_derivative dd') (at z within s)" + by simp + also have "... \ ((\z. g z ^ nat n) has_field_derivative dd') (at z within s)" + apply (rule has_field_derivative_cong_eventually) + subgoal unfolding eventually_at + apply (rule exI[where x=e]) + using powr_of_int that \e>0\ e_dist by (simp add: dist_commute) + subgoal using powr_of_int \g z\0\ that by simp + done + also have "..." unfolding dd'_def using gderiv that + by (auto intro!: derivative_eq_intros) + finally have "((\z. g z powr of_int n) has_field_derivative dd) (at z within s)" . + then show ?thesis unfolding dd_def by simp + qed + moreover have ?thesis when "n<0" + proof - + define dd' where "dd' = of_int n / g z ^ (nat (1 - n)) * gd" + have "dd=dd'" + proof - + have "g z powr of_int (n - 1) = inverse (g z ^ nat (1-n))" + using powr_of_int[OF \g z\0\,of "n-1"] that by auto + then show ?thesis + unfolding dd_def dd'_def by (simp add: divide_inverse) + qed + then have "((\z. g z powr of_int n) has_field_derivative dd) (at z within s) + \ ((\z. g z powr of_int n) has_field_derivative dd') (at z within s)" + by simp + also have "... \ ((\z. inverse (g z ^ nat (-n))) has_field_derivative dd') (at z within s)" + apply (rule has_field_derivative_cong_eventually) + subgoal unfolding eventually_at + apply (rule exI[where x=e]) + using powr_of_int that \e>0\ e_dist by (simp add: dist_commute) + subgoal using powr_of_int \g z\0\ that by simp + done + also have "..." unfolding dd'_def using gderiv that \g z\0\ + apply (auto intro!: derivative_eq_intros) + apply (simp add:divide_simps power_add[symmetric]) + apply (subgoal_tac "nat (- n) + nat (1 - n) - Suc 0 = nat (- n) + nat (- n)") + by auto + finally have "((\z. g z powr of_int n) has_field_derivative dd) (at z within s)" . + then show ?thesis unfolding dd_def by simp + qed + ultimately show ?thesis by force +qed + +lemma field_differentiable_powr_of_int: + fixes z :: complex + assumes gderiv:"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(2) field_differentiable_def gderiv by blast + +lemma holomorphic_on_powr_of_int [holomorphic_intros]: + assumes "f holomorphic_on s" "\z\s. f z\0" + shows "(\z. (f z) powr of_int n) holomorphic_on s" +proof (cases "n\0") + case True + then have "?thesis \ (\z. (f z) ^ nat n) holomorphic_on s" + apply (rule_tac holomorphic_cong) + using assms(2) by (auto simp add:powr_of_int) + moreover have "(\z. (f z) ^ nat n) holomorphic_on s" + using assms(1) by (auto intro:holomorphic_intros) + ultimately show ?thesis by auto +next + case False + then have "?thesis \ (\z. inverse (f z) ^ nat (-n)) holomorphic_on s" + apply (rule_tac holomorphic_cong) + using assms(2) by (auto simp add:powr_of_int power_inverse) + moreover have "(\z. inverse (f z) ^ nat (-n)) holomorphic_on s" + using assms by (auto intro!:holomorphic_intros) + ultimately show ?thesis by auto +qed lemma has_field_derivative_powr_right [derivative_intros]: "w \ 0 \ ((\z. w powr z) has_field_derivative Ln w * w powr z) (at z)" diff -r 4fa9d5ef95bc -r 68ca05a7f159 src/HOL/Analysis/Conformal_Mappings.thy --- a/src/HOL/Analysis/Conformal_Mappings.thy Fri Feb 23 10:52:31 2018 +0000 +++ b/src/HOL/Analysis/Conformal_Mappings.thy Fri Feb 23 14:56:32 2018 +0000 @@ -2501,8 +2501,28 @@ by (simp add: g_def) qed - - +lemma residue_holomorphic_over_power: + assumes "open A" "z0 \ A" "f holomorphic_on A" + shows "residue (\z. f z / (z - z0) ^ Suc n) z0 = (deriv ^^ n) f z0 / fact n" +proof - + let ?f = "\z. f z / (z - z0) ^ Suc n" + from assms(1,2) obtain r where r: "r > 0" "cball z0 r \ A" + by (auto simp: open_contains_cball) + have "(?f has_contour_integral 2 * pi * \ * residue ?f z0) (circlepath z0 r)" + using r assms by (intro base_residue[of A]) (auto intro!: holomorphic_intros) + moreover have "(?f has_contour_integral 2 * pi * \ / fact n * (deriv ^^ n) f z0) (circlepath z0 r)" + using assms r + by (intro Cauchy_has_contour_integral_higher_derivative_circlepath) + (auto intro!: holomorphic_on_subset[OF assms(3)] holomorphic_on_imp_continuous_on) + ultimately have "2 * pi * \ * residue ?f z0 = 2 * pi * \ / fact n * (deriv ^^ n) f z0" + by (rule has_contour_integral_unique) + thus ?thesis by (simp add: field_simps) +qed + +lemma residue_holomorphic_over_power': + assumes "open A" "0 \ A" "f holomorphic_on A" + shows "residue (\z. f z / z ^ Suc n) 0 = (deriv ^^ n) f 0 / fact n" + using residue_holomorphic_over_power[OF assms] by simp subsubsection \Cauchy's residue theorem\ @@ -2951,11 +2971,21 @@ finally show ?thesis unfolding c_def . qed -subsection \The argument principle\ +subsection \Non-essential singular points\ definition is_pole :: "('a::topological_space \ 'b::real_normed_vector) \ 'a \ bool" where "is_pole f a = (LIM x (at a). f x :> at_infinity)" +lemma is_pole_cong: + assumes "eventually (\x. f x = g x) (at a)" "a=b" + shows "is_pole f a \ is_pole g b" + unfolding is_pole_def using assms by (intro filterlim_cong,auto) + +lemma is_pole_transform: + assumes "is_pole f a" "eventually (\x. f x = g x) (at a)" "a=b" + shows "is_pole g b" + using is_pole_cong assms by auto + lemma is_pole_tendsto: fixes f::"('a::topological_space \ 'b::real_normed_div_algebra)" shows "is_pole f x \ ((inverse o f) \ 0) (at x)" @@ -3002,1049 +3032,6 @@ using not_tendsto_and_filterlim_at_infinity[of "at x" f "f x"] by auto qed - -(*order of the zero of f at z*) -definition zorder::"(complex \ complex) \ complex \ nat" where - "zorder f z = (THE n. n>0 \ (\h r. r>0 \ h holomorphic_on cball z r - \ (\w\cball z r. f w = h w * (w-z)^n \ h w \0)))" - -definition zer_poly::"[complex \ complex,complex]\complex \ complex" where - "zer_poly f z = (SOME h. \r . r>0 \ h holomorphic_on cball z r - \ (\w\cball z r. f w = h w * (w-z)^(zorder f z) \ h w \0))" - -(*order of the pole of f at z*) -definition porder::"(complex \ complex) \ complex \ nat" where - "porder f z = (let f'=(\x. if x=z then 0 else inverse (f x)) in zorder f' z)" - -definition pol_poly::"[complex \ complex,complex]\complex \ complex" where - "pol_poly f z = (let f'=(\ x. if x=z then 0 else inverse (f x)) - in inverse o zer_poly f' z)" - - -lemma holomorphic_factor_zero_unique: - fixes f::"complex \ complex" and z::complex and r::real - assumes "r>0" - and asm:"\w\ball z r. f w = (w-z)^n * g w \ g w\0 \ f w = (w - z)^m * h w \ h w\0" - and g_holo:"g holomorphic_on ball z r" and h_holo:"h holomorphic_on ball z r" - shows "n=m" -proof - - have "n>m \ False" - proof - - assume "n>m" - have "(h \ 0) (at z within ball z r)" - proof (rule Lim_transform_within[OF _ \r>0\, where f="\w. (w - z) ^ (n - m) * g w"]) - have "\w\ball z r. w\z \ h w = (w-z)^(n-m) * g w" using \n>m\ asm - by (auto simp add:field_simps power_diff) - then show "\x' \ ball z r; 0 < dist x' z;dist x' z < r\ - \ (x' - z) ^ (n - m) * g x' = h x'" for x' by auto - next - define F where "F \ at z within ball z r" - define f' where "f' \ \x. (x - z) ^ (n-m)" - have "f' z=0" using \n>m\ unfolding f'_def by auto - moreover have "continuous F f'" unfolding f'_def F_def - by (intro continuous_intros) - ultimately have "(f' \ 0) F" unfolding F_def - by (simp add: continuous_within) - moreover have "(g \ g z) F" - using holomorphic_on_imp_continuous_on[OF g_holo,unfolded continuous_on_def] \r>0\ - unfolding F_def by auto - ultimately show " ((\w. f' w * g w) \ 0) F" using tendsto_mult by fastforce - qed - moreover have "(h \ h z) (at z within ball z r)" - using holomorphic_on_imp_continuous_on[OF h_holo] - by (auto simp add:continuous_on_def \r>0\) - moreover have "at z within ball z r \ bot" using \r>0\ - by (auto simp add:trivial_limit_within islimpt_ball) - ultimately have "h z=0" by (auto intro: tendsto_unique) - thus False using asm \r>0\ by auto - qed - moreover have "m>n \ False" - proof - - assume "m>n" - have "(g \ 0) (at z within ball z r)" - proof (rule Lim_transform_within[OF _ \r>0\, where f="\w. (w - z) ^ (m - n) * h w"]) - have "\w\ball z r. w\z \ g w = (w-z)^(m-n) * h w" using \m>n\ asm - by (auto simp add:field_simps power_diff) - then show "\x' \ ball z r; 0 < dist x' z;dist x' z < r\ - \ (x' - z) ^ (m - n) * h x' = g x'" for x' by auto - next - define F where "F \ at z within ball z r" - define f' where "f' \\x. (x - z) ^ (m-n)" - have "f' z=0" using \m>n\ unfolding f'_def by auto - moreover have "continuous F f'" unfolding f'_def F_def - by (intro continuous_intros) - ultimately have "(f' \ 0) F" unfolding F_def - by (simp add: continuous_within) - moreover have "(h \ h z) F" - using holomorphic_on_imp_continuous_on[OF h_holo,unfolded continuous_on_def] \r>0\ - unfolding F_def by auto - ultimately show " ((\w. f' w * h w) \ 0) F" using tendsto_mult by fastforce - qed - moreover have "(g \ g z) (at z within ball z r)" - using holomorphic_on_imp_continuous_on[OF g_holo] - by (auto simp add:continuous_on_def \r>0\) - moreover have "at z within ball z r \ bot" using \r>0\ - by (auto simp add:trivial_limit_within islimpt_ball) - ultimately have "g z=0" by (auto intro: tendsto_unique) - thus False using asm \r>0\ by auto - qed - ultimately show "n=m" by fastforce -qed - - -lemma holomorphic_factor_zero_Ex1: - assumes "open s" "connected s" "z \ s" and - holf: "f holomorphic_on s" - and f: "f z = 0" "\w\s. f w \ 0" - shows "\!n. \g r. 0 < n \ 0 < r \ - g holomorphic_on cball z r - \ (\w\cball z r. f w = (w-z)^n * g w \ g w\0)" -proof (rule ex_ex1I) - have "\ f constant_on s" - by (metis \z\s\ constant_on_def f) - then obtain g r n where "0 < n" "0 < r" "ball z r \ s" and - g:"g holomorphic_on ball z r" - "\w. w \ ball z r \ f w = (w - z) ^ n * g w" - "\w. w \ ball z r \ g w \ 0" - by (blast intro: holomorphic_factor_zero_nonconstant[OF holf \open s\ \connected s\ \z\s\ \f z=0\]) - define r' where "r' \ r/2" - have "cball z r' \ ball z r" unfolding r'_def by (simp add: \0 < r\ cball_subset_ball_iff) - hence "cball z r' \ s" "g holomorphic_on cball z r'" - "(\w\cball z r'. f w = (w - z) ^ n * g w \ g w \ 0)" - using g \ball z r \ s\ by auto - moreover have "r'>0" unfolding r'_def using \0 by auto - ultimately show "\n g r. 0 < n \ 0 < r \ g holomorphic_on cball z r - \ (\w\cball z r. f w = (w - z) ^ n * g w \ g w \ 0)" - apply (intro exI[of _ n] exI[of _ g] exI[of _ r']) - by (simp add:\0 < n\) -next - fix m n - define fac where "fac \ \n g r. \w\cball z r. f w = (w - z) ^ n * g w \ g w \ 0" - assume n_asm:"\g r1. 0 < n \ 0 < r1 \ g holomorphic_on cball z r1 \ fac n g r1" - and m_asm:"\h r2. 0 < m \ 0 < r2 \ h holomorphic_on cball z r2 \ fac m h r2" - obtain g r1 where "0 < n" "0 < r1" and g_holo: "g holomorphic_on cball z r1" - and "fac n g r1" using n_asm by auto - obtain h r2 where "0 < m" "0 < r2" and h_holo: "h holomorphic_on cball z r2" - and "fac m h r2" using m_asm by auto - define r where "r \ min r1 r2" - have "r>0" using \r1>0\ \r2>0\ unfolding r_def by auto - moreover have "\w\ball z r. f w = (w-z)^n * g w \ g w\0 \ f w = (w - z)^m * h w \ h w\0" - using \fac m h r2\ \fac n g r1\ unfolding fac_def r_def - by fastforce - ultimately show "m=n" using g_holo h_holo - apply (elim holomorphic_factor_zero_unique[of r z f n g m h,symmetric,rotated]) - by (auto simp add:r_def) -qed - -lemma zorder_exist: - fixes f::"complex \ complex" and z::complex - defines "n\zorder f z" and "h\zer_poly f z" - assumes "open s" "connected s" "z\s" - and holo: "f holomorphic_on s" - and "f z=0" "\w\s. f w\0" - shows "\r. n>0 \ r>0 \ cball z r \ s \ h holomorphic_on cball z r - \ (\w\cball z r. f w = h w * (w-z)^n \ h w \0) " -proof - - define P where "P \ \h r n. r>0 \ h holomorphic_on cball z r - \ (\w\cball z r. ( f w = h w * (w-z)^n) \ h w \0)" - have "(\!n. n>0 \ (\ h r. P h r n))" - proof - - have "\!n. \h r. n>0 \ P h r n" - using holomorphic_factor_zero_Ex1[OF \open s\ \connected s\ \z\s\ holo \f z=0\ - \\w\s. f w\0\] unfolding P_def - apply (subst mult.commute) - by auto - thus ?thesis by auto - qed - moreover have n:"n=(THE n. n>0 \ (\h r. P h r n))" - unfolding n_def zorder_def P_def by simp - ultimately have "n>0 \ (\h r. P h r n)" - apply (drule_tac theI') - by simp - then have "n>0" and "\h r. P h r n" by auto - moreover have "h=(SOME h. \r. P h r n)" - unfolding h_def P_def zer_poly_def[of f z,folded n_def P_def] by simp - ultimately have "\r. P h r n" - apply (drule_tac someI_ex) - by simp - then obtain r1 where "P h r1 n" by auto - obtain r2 where "r2>0" "cball z r2 \ s" - using assms(3) assms(5) open_contains_cball_eq by blast - define r3 where "r3 \ min r1 r2" - have "P h r3 n" using \P h r1 n\ \r2>0\ unfolding P_def r3_def - by auto - moreover have "cball z r3 \ s" using \cball z r2 \ s\ unfolding r3_def by auto - ultimately show ?thesis using \n>0\ unfolding P_def by auto -qed - -lemma zorder_eqI: - assumes "open s" "z \ s" "g holomorphic_on s" "g z \ 0" "n > 0" - assumes "\w. w \ s \ f w = g w * (w - z) ^ n" - shows "zorder f z = n" -proof - - have "continuous_on s g" by (rule holomorphic_on_imp_continuous_on) fact - moreover have "open (-{0::complex})" by auto - ultimately have "open ((g -` (-{0})) \ s)" - unfolding continuous_on_open_vimage[OF \open s\] by blast - moreover from assms have "z \ (g -` (-{0})) \ s" by auto - ultimately obtain r where r: "r > 0" "cball z r \ (g -` (-{0})) \ s" - unfolding open_contains_cball by blast - - have "n > 0 \ r > 0 \ g holomorphic_on cball z r \ - (\w\cball z r. f w = (w - z) ^ n * g w \ g w \ 0)" (is "?P g r n") - using r assms(3,5,6) by auto - hence ex: "\g r. ?P g r n" by blast - have unique: "\!n. \g r. ?P g r n" - proof (rule holomorphic_factor_zero_Ex1) - from r have "(\w. g w * (w - z) ^ n) holomorphic_on ball z r" - by (intro holomorphic_intros holomorphic_on_subset[OF assms(3)]) auto - also have "?this \ f holomorphic_on ball z r" - using r assms by (intro holomorphic_cong refl) (auto simp: cball_def subset_iff) - finally show \ . - next - let ?w = "z + of_real r / 2" - have "?w \ ball z r" - using r by (auto simp: dist_norm) - moreover from this and r have "g ?w \ 0" and "?w \ s" - by (auto simp: cball_def ball_def subset_iff) - with assms have "f ?w \ 0" using \r > 0\ by auto - ultimately show "\w\ball z r. f w \ 0" by blast - qed (insert assms r, auto) - from unique and ex have "(THE n. \g r. ?P g r n) = n" - by (rule the1_equality) - also have "(THE n. \g r. ?P g r n) = zorder f z" - by (simp add: zorder_def mult.commute) - finally show ?thesis . -qed - -lemma simple_zeroI: - assumes "open s" "z \ s" "g holomorphic_on s" "g z \ 0" - assumes "\w. w \ s \ f w = g w * (w - z)" - shows "zorder f z = 1" - using assms(1-4) by (rule zorder_eqI) (use assms(5) in auto) - -lemma higher_deriv_power: - shows "(deriv ^^ j) (\w. (w - z) ^ n) w = - pochhammer (of_nat (Suc n - j)) j * (w - z) ^ (n - j)" -proof (induction j arbitrary: w) - case 0 - thus ?case by auto -next - case (Suc j w) - have "(deriv ^^ Suc j) (\w. (w - z) ^ n) w = deriv ((deriv ^^ j) (\w. (w - z) ^ n)) w" - by simp - also have "(deriv ^^ j) (\w. (w - z) ^ n) = - (\w. pochhammer (of_nat (Suc n - j)) j * (w - z) ^ (n - j))" - using Suc by (intro Suc.IH ext) - also { - have "(\ has_field_derivative of_nat (n - j) * - pochhammer (of_nat (Suc n - j)) j * (w - z) ^ (n - Suc j)) (at w)" - using Suc.prems by (auto intro!: derivative_eq_intros) - also have "of_nat (n - j) * pochhammer (of_nat (Suc n - j)) j = - pochhammer (of_nat (Suc n - Suc j)) (Suc j)" - by (cases "Suc j \ n", subst pochhammer_rec) - (insert Suc.prems, simp_all add: algebra_simps Suc_diff_le pochhammer_0_left) - finally have "deriv (\w. pochhammer (of_nat (Suc n - j)) j * (w - z) ^ (n - j)) w = - \ * (w - z) ^ (n - Suc j)" - by (rule DERIV_imp_deriv) - } - finally show ?case . -qed - -lemma zorder_eqI': - assumes "open s" "connected s" "z \ s" "f holomorphic_on s" - assumes zero: "\i. i < n' \ (deriv ^^ i) f z = 0" - assumes nz: "(deriv ^^ n') f z \ 0" and n: "n' > 0" - shows "zorder f z = n'" -proof - - { - assume *: "\w. w \ s \ f w = 0" - hence "eventually (\u. u \ s) (nhds z)" - using assms by (intro eventually_nhds_in_open) auto - hence "eventually (\u. f u = 0) (nhds z)" - by eventually_elim (simp_all add: *) - hence "(deriv ^^ n') f z = (deriv ^^ n') (\_. 0) z" - by (intro higher_deriv_cong_ev) auto - also have "(deriv ^^ n') (\_. 0) z = 0" - by (induction n') simp_all - finally have False using nz by contradiction - } - hence nz': "\w\s. f w \ 0" by blast - - from zero[of 0] and n have [simp]: "f z = 0" by simp - - define n g where "n = zorder f z" and "g = zer_poly f z" - from zorder_exist[OF assms(1-4) \f z = 0\ nz'] - obtain r where r: "n > 0" "r > 0" "cball z r \ s" "g holomorphic_on cball z r" - "\w\cball z r. f w = g w * (w - z) ^ n \ g w \ 0" - unfolding n_def g_def by blast - - define A where "A = (\i. of_nat (i choose n) * fact n * (deriv ^^ (i - n)) g z)" - { - fix i :: nat - have "eventually (\w. w \ ball z r) (nhds z)" - using r by (intro eventually_nhds_in_open) auto - hence "eventually (\w. f w = (w - z) ^ n * g w) (nhds z)" - by eventually_elim (use r in auto) - hence "(deriv ^^ i) f z = (deriv ^^ i) (\w. (w - z) ^ n * g w) z" - by (intro higher_deriv_cong_ev) auto - also have "\ = (\j=0..i. of_nat (i choose j) * - (deriv ^^ j) (\w. (w - z) ^ n) z * (deriv ^^ (i - j)) g z)" - using r by (intro higher_deriv_mult[of _ "ball z r"]) (auto intro!: holomorphic_intros) - also have "\ = (\j=0..i. if j = n then of_nat (i choose n) * fact n * (deriv ^^ (i - n)) g z - else 0)" - proof (intro sum.cong refl, goal_cases) - case (1 j) - have "(deriv ^^ j) (\w. (w - z) ^ n) z = - pochhammer (of_nat (Suc n - j)) j * 0 ^ (n - j)" - by (subst higher_deriv_power) auto - also have "\ = (if j = n then fact j else 0)" - by (auto simp: not_less pochhammer_0_left pochhammer_fact) - also have "of_nat (i choose j) * \ * (deriv ^^ (i - j)) g z = - (if j = n then of_nat (i choose n) * fact n * (deriv ^^ (i - n)) g z else 0)" - by simp - finally show ?case . - qed - also have "\ = (if i \ n then A i else 0)" - by (auto simp: A_def) - finally have "(deriv ^^ i) f z = \" . - } note * = this - - from *[of n] and r have "(deriv ^^ n) f z \ 0" - by (simp add: A_def) - with zero[of n] have "n \ n'" by (cases "n \ n'") auto - with nz show "n = n'" - by (auto simp: * split: if_splits) -qed - -lemma simple_zeroI': - assumes "open s" "connected s" "z \ s" - assumes "\z. z \ s \ (f has_field_derivative f' z) (at z)" - assumes "f z = 0" "f' z \ 0" - shows "zorder f z = 1" -proof - - have "deriv f z = f' z" if "z \ s" for z - using that by (intro DERIV_imp_deriv assms) auto - moreover from assms have "f holomorphic_on s" - by (subst holomorphic_on_open) auto - ultimately show ?thesis using assms - by (intro zorder_eqI'[of s]) auto -qed - -lemma porder_exist: - fixes f::"complex \ complex" and z::complex - defines "n \ porder f z" and "h \ pol_poly f z" - assumes "open s" "z \ s" - and holo:"f holomorphic_on s-{z}" - and "is_pole f z" - shows "\r. n>0 \ r>0 \ cball z r \ s \ h holomorphic_on cball z r - \ (\w\cball z r. (w\z \ f w = h w / (w-z)^n) \ h w \0)" -proof - - obtain e where "e>0" and e_ball:"ball z e \ s"and e_def: "\x\ball z e-{z}. f x\0" - proof - - have "\\<^sub>F z in at z. f z \ 0" - using \is_pole f z\ filterlim_at_infinity_imp_eventually_ne unfolding is_pole_def - by auto - then obtain e1 where "e1>0" and e1_def: "\x. x \ z \ dist x z < e1 \ f x \ 0" - using eventually_at[of "\x. f x\0" z,simplified] by auto - obtain e2 where "e2>0" and "ball z e2 \s" using \open s\ \z\s\ openE by auto - define e where "e \ min e1 e2" - have "e>0" using \e1>0\ \e2>0\ unfolding e_def by auto - moreover have "ball z e \ s" unfolding e_def using \ball z e2 \ s\ by auto - moreover have "\x\ball z e-{z}. f x\0" using e1_def \e1>0\ \e2>0\ unfolding e_def - by (simp add: DiffD1 DiffD2 dist_commute singletonI) - ultimately show ?thesis using that by auto - qed - define g where "g \ \x. if x=z then 0 else inverse (f x)" - define zo where "zo \ zorder g z" - define zp where "zp \ zer_poly g z" - have "\w\ball z e. g w \ 0" - proof - - obtain w where w:"w\ball z e-{z}" using \0 < e\ - by (metis open_ball all_not_in_conv centre_in_ball insert_Diff_single - insert_absorb not_open_singleton) - hence "w\z" "f w\0" using e_def[rule_format,of w] mem_ball - by (auto simp add:dist_commute) - then show ?thesis unfolding g_def using w by auto - qed - moreover have "g holomorphic_on ball z e" - apply (intro is_pole_inverse_holomorphic[of "ball z e",OF _ _ \is_pole f z\ e_def,folded g_def]) - using holo e_ball by auto - moreover have "g z=0" unfolding g_def by auto - ultimately obtain r where "0 < zo" "0 < r" "cball z r \ ball z e" - and zp_holo: "zp holomorphic_on cball z r" and - zp_fac: "\w\cball z r. g w = zp w * (w - z) ^ zo \ zp w \ 0" - using zorder_exist[of "ball z e" z g,simplified,folded zo_def zp_def] \e>0\ - by auto - have n:"n=zo" and h:"h=inverse o zp" - unfolding n_def zo_def porder_def h_def zp_def pol_poly_def g_def by simp_all - have "h holomorphic_on cball z r" - using zp_holo zp_fac holomorphic_on_inverse unfolding h comp_def by blast - moreover have "\w\cball z r. (w\z \ f w = h w / (w-z)^n) \ h w \0" - using zp_fac unfolding h n comp_def g_def - by (metis divide_inverse_commute field_class.field_inverse_zero inverse_inverse_eq - inverse_mult_distrib mult.commute) - moreover have "0 < n" unfolding n using \zo>0\ by simp - ultimately show ?thesis using \0 < r\ \cball z r \ ball z e\ e_ball by auto -qed - -lemma residue_porder: - fixes f::"complex \ complex" and z::complex - defines "n \ porder f z" and "h \ pol_poly f z" - assumes "open s" "z \ s" - and holo:"f holomorphic_on s - {z}" - and pole:"is_pole f z" - shows "residue f z = ((deriv ^^ (n - 1)) h z / fact (n-1))" -proof - - define g where "g \ \x. if x=z then 0 else inverse (f x)" - obtain r where "0 < n" "0 < r" and r_cball:"cball z r \ s" and h_holo: "h holomorphic_on cball z r" - and h_divide:"(\w\cball z r. (w\z \ f w = h w / (w - z) ^ n) \ h w \ 0)" - using porder_exist[OF \open s\ \z \ s\ holo pole, folded n_def h_def] by blast - have r_nonzero:"\w. w \ ball z r - {z} \ f w \ 0" - using h_divide by simp - define c where "c \ 2 * pi * \" - define der_f where "der_f \ ((deriv ^^ (n - 1)) h z / fact (n-1))" - define h' where "h' \ \u. h u / (u - z) ^ n" - have "(h' has_contour_integral c / fact (n - 1) * (deriv ^^ (n - 1)) h z) (circlepath z r)" - unfolding h'_def - proof (rule Cauchy_has_contour_integral_higher_derivative_circlepath[of z r h z "n-1", - folded c_def Suc_pred'[OF \n>0\]]) - show "continuous_on (cball z r) h" using holomorphic_on_imp_continuous_on h_holo by simp - show "h holomorphic_on ball z r" using h_holo by auto - show " z \ ball z r" using \r>0\ by auto - qed - then have "(h' has_contour_integral c * der_f) (circlepath z r)" unfolding der_f_def by auto - then have "(f has_contour_integral c * der_f) (circlepath z r)" - proof (elim has_contour_integral_eq) - fix x assume "x \ path_image (circlepath z r)" - hence "x\cball z r - {z}" using \r>0\ by auto - then show "h' x = f x" using h_divide unfolding h'_def by auto - qed - moreover have "(f has_contour_integral c * residue f z) (circlepath z r)" - using base_residue[OF \open s\ \z\s\ \r>0\ holo r_cball,folded c_def] . - ultimately have "c * der_f = c * residue f z" using has_contour_integral_unique by blast - hence "der_f = residue f z" unfolding c_def by auto - thus ?thesis unfolding der_f_def by auto -qed - -theorem argument_principle: - fixes f::"complex \ complex" and poles s:: "complex set" - defines "zeros\{p. f p=0} - poles" - assumes "open s" and - "connected s" and - f_holo:"f holomorphic_on s-poles" and - h_holo:"h holomorphic_on s" and - "valid_path g" and - loop:"pathfinish g = pathstart g" and - path_img:"path_image g \ s - (zeros \ poles)" and - homo:"\z. (z \ s) \ winding_number g z = 0" and - finite:"finite (zeros \ poles)" and - poles:"\p\poles. is_pole f p" - shows "contour_integral g (\x. deriv f x * h x / f x) = 2 * pi * \ * - ((\p\zeros. winding_number g p * h p * zorder f p) - - (\p\poles. winding_number g p * h p * porder f p))" - (is "?L=?R") -proof - - define c where "c \ 2 * complex_of_real pi * \ " - define ff where "ff \ (\x. deriv f x * h x / f x)" - define cont_pole where "cont_pole \ \ff p e. (ff has_contour_integral - c * porder f p * h p) (circlepath p e)" - define cont_zero where "cont_zero \ \ff p e. (ff has_contour_integral c * zorder f p * h p ) (circlepath p e)" - define avoid where "avoid \ \p e. \w\cball p e. w \ s \ (w \ p \ w \ zeros \ poles)" - have "\e>0. avoid p e \ (p\poles \ cont_pole ff p e) \ (p\zeros \ cont_zero ff p e)" - when "p\s" for p - proof - - obtain e1 where "e1>0" and e1_avoid:"avoid p e1" - using finite_cball_avoid[OF \open s\ finite] \p\s\ unfolding avoid_def by auto - have "\e2>0. cball p e2 \ ball p e1 \ cont_pole ff p e2" - when "p\poles" - proof - - define po where "po \ porder f p" - define pp where "pp \ pol_poly f p" - define f' where "f' \ \w. pp w / (w - p) ^ po" - define ff' where "ff' \ (\x. deriv f' x * h x / f' x)" - have "f holomorphic_on ball p e1 - {p}" - apply (intro holomorphic_on_subset[OF f_holo]) - using e1_avoid \p\poles\ unfolding avoid_def by auto - then obtain r where - "0 < po" "r>0" - "cball p r \ ball p e1" and - pp_holo:"pp holomorphic_on cball p r" and - pp_po:"(\w\cball p r. (w\p \ f w = pp w / (w - p) ^ po) \ pp w \ 0)" - using porder_exist[of "ball p e1" p f,simplified,OF \e1>0\] poles \p\poles\ - unfolding po_def pp_def - by auto - define e2 where "e2 \ r/2" - have "e2>0" using \r>0\ unfolding e2_def by auto - define anal where "anal \ \w. deriv pp w * h w / pp w" - define prin where "prin \ \w. - of_nat po * h w / (w - p)" - have "((\w. prin w + anal w) has_contour_integral - c * po * h p) (circlepath p e2)" - proof (rule has_contour_integral_add[of _ _ _ _ 0,simplified]) - have "ball p r \ s" - using \cball p r \ ball p e1\ avoid_def ball_subset_cball e1_avoid by blast - then have "cball p e2 \ s" - using \r>0\ unfolding e2_def by auto - then have "(\w. - of_nat po * h w) holomorphic_on cball p e2" - using h_holo - by (auto intro!: holomorphic_intros) - then show "(prin has_contour_integral - c * of_nat po * h p ) (circlepath p e2)" - using Cauchy_integral_circlepath_simple[folded c_def, of "\w. - of_nat po * h w"] - \e2>0\ - unfolding prin_def - by (auto simp add: mult.assoc) - have "anal holomorphic_on ball p r" unfolding anal_def - using pp_holo h_holo pp_po \ball p r \ s\ - by (auto intro!: holomorphic_intros) - then show "(anal has_contour_integral 0) (circlepath p e2)" - using e2_def \r>0\ - by (auto elim!: Cauchy_theorem_disc_simple) - qed - then have "cont_pole ff' p e2" unfolding cont_pole_def po_def - proof (elim has_contour_integral_eq) - fix w assume "w \ path_image (circlepath p e2)" - then have "w\ball p r" and "w\p" unfolding e2_def using \r>0\ by auto - define wp where "wp \ w-p" - have "wp\0" and "pp w \0" - unfolding wp_def using \w\p\ \w\ball p r\ pp_po by auto - moreover have der_f':"deriv f' w = - po * pp w / (w-p)^(po+1) + deriv pp w / (w-p)^po" - proof (rule DERIV_imp_deriv) - define der where "der \ - po * pp w / (w-p)^(po+1) + deriv pp w / (w-p)^po" - have po:"po = Suc (po - Suc 0) " using \po>0\ by auto - have "(pp has_field_derivative (deriv pp w)) (at w)" - using DERIV_deriv_iff_has_field_derivative pp_holo \w\p\ - by (meson open_ball \w \ ball p r\ ball_subset_cball holomorphic_derivI holomorphic_on_subset) - then show "(f' has_field_derivative der) (at w)" - using \w\p\ \po>0\ unfolding der_def f'_def - apply (auto intro!: derivative_eq_intros simp add:field_simps) - apply (subst (4) po) - apply (subst power_Suc) - by (auto simp add:field_simps) - qed - ultimately show "prin w + anal w = ff' w" - unfolding ff'_def prin_def anal_def - apply simp - apply (unfold f'_def) - apply (fold wp_def) - by (auto simp add:field_simps) - qed - then have "cont_pole ff p e2" unfolding cont_pole_def - proof (elim has_contour_integral_eq) - fix w assume "w \ path_image (circlepath p e2)" - then have "w\ball p r" and "w\p" unfolding e2_def using \r>0\ by auto - have "deriv f' w = deriv f w" - proof (rule complex_derivative_transform_within_open[where s="ball p r - {p}"]) - show "f' holomorphic_on ball p r - {p}" unfolding f'_def using pp_holo - by (auto intro!: holomorphic_intros) - next - have "ball p e1 - {p} \ s - poles" - using avoid_def ball_subset_cball e1_avoid - by auto - then have "ball p r - {p} \ s - poles" using \cball p r \ ball p e1\ - using ball_subset_cball by blast - then show "f holomorphic_on ball p r - {p}" using f_holo - by auto - next - show "open (ball p r - {p})" by auto - next - show "w \ ball p r - {p}" using \w\ball p r\ \w\p\ by auto - next - fix x assume "x \ ball p r - {p}" - then show "f' x = f x" - using pp_po unfolding f'_def by auto - qed - moreover have " f' w = f w " - using \w \ ball p r\ ball_subset_cball subset_iff pp_po \w\p\ - unfolding f'_def by auto - ultimately show "ff' w = ff w" - unfolding ff'_def ff_def by simp - qed - moreover have "cball p e2 \ ball p e1" - using \0 < r\ \cball p r \ ball p e1\ e2_def by auto - ultimately show ?thesis using \e2>0\ by auto - qed - then obtain e2 where e2:"p\poles \ e2>0 \ cball p e2 \ ball p e1 \ cont_pole ff p e2" - by auto - have "\e3>0. cball p e3 \ ball p e1 \ cont_zero ff p e3" - when "p\zeros" - proof - - define zo where "zo \ zorder f p" - define zp where "zp \ zer_poly f p" - define f' where "f' \ \w. zp w * (w - p) ^ zo" - define ff' where "ff' \ (\x. deriv f' x * h x / f' x)" - have "f holomorphic_on ball p e1" - proof - - have "ball p e1 \ s - poles" - using avoid_def ball_subset_cball e1_avoid that zeros_def by fastforce - thus ?thesis using f_holo by auto - qed - moreover have "f p = 0" using \p\zeros\ - using DiffD1 mem_Collect_eq zeros_def by blast - moreover have "\w\ball p e1. f w \ 0" - proof - - define p' where "p' \ p+e1/2" - have "p' \ ball p e1" and "p'\p" using \e1>0\ unfolding p'_def by (auto simp add:dist_norm) - then show "\w\ball p e1. f w \ 0" using e1_avoid unfolding avoid_def - apply (rule_tac x=p' in bexI) - by (auto simp add:zeros_def) - qed - ultimately obtain r where - "0 < zo" "r>0" - "cball p r \ ball p e1" and - pp_holo:"zp holomorphic_on cball p r" and - pp_po:"(\w\cball p r. f w = zp w * (w - p) ^ zo \ zp w \ 0)" - using zorder_exist[of "ball p e1" p f,simplified,OF \e1>0\] unfolding zo_def zp_def - by auto - define e2 where "e2 \ r/2" - have "e2>0" using \r>0\ unfolding e2_def by auto - define anal where "anal \ \w. deriv zp w * h w / zp w" - define prin where "prin \ \w. of_nat zo * h w / (w - p)" - have "((\w. prin w + anal w) has_contour_integral c * zo * h p) (circlepath p e2)" - proof (rule has_contour_integral_add[of _ _ _ _ 0,simplified]) - have "ball p r \ s" - using \cball p r \ ball p e1\ avoid_def ball_subset_cball e1_avoid by blast - then have "cball p e2 \ s" - using \r>0\ unfolding e2_def by auto - then have "(\w. of_nat zo * h w) holomorphic_on cball p e2" - using h_holo - by (auto intro!: holomorphic_intros) - then show "(prin has_contour_integral c * of_nat zo * h p ) (circlepath p e2)" - using Cauchy_integral_circlepath_simple[folded c_def, of "\w. of_nat zo * h w"] - \e2>0\ - unfolding prin_def - by (auto simp add: mult.assoc) - have "anal holomorphic_on ball p r" unfolding anal_def - using pp_holo h_holo pp_po \ball p r \ s\ - by (auto intro!: holomorphic_intros) - then show "(anal has_contour_integral 0) (circlepath p e2)" - using e2_def \r>0\ - by (auto elim!: Cauchy_theorem_disc_simple) - qed - then have "cont_zero ff' p e2" unfolding cont_zero_def zo_def - proof (elim has_contour_integral_eq) - fix w assume "w \ path_image (circlepath p e2)" - then have "w\ball p r" and "w\p" unfolding e2_def using \r>0\ by auto - define wp where "wp \ w-p" - have "wp\0" and "zp w \0" - unfolding wp_def using \w\p\ \w\ball p r\ pp_po by auto - moreover have der_f':"deriv f' w = zo * zp w * (w-p)^(zo-1) + deriv zp w * (w-p)^zo" - proof (rule DERIV_imp_deriv) - define der where "der \ zo * zp w * (w-p)^(zo-1) + deriv zp w * (w-p)^zo" - have po:"zo = Suc (zo - Suc 0) " using \zo>0\ by auto - have "(zp has_field_derivative (deriv zp w)) (at w)" - using DERIV_deriv_iff_has_field_derivative pp_holo - by (meson open_ball \w \ ball p r\ ball_subset_cball holomorphic_derivI holomorphic_on_subset) - then show "(f' has_field_derivative der) (at w)" - using \w\p\ \zo>0\ unfolding der_def f'_def - by (auto intro!: derivative_eq_intros simp add:field_simps) - qed - ultimately show "prin w + anal w = ff' w" - unfolding ff'_def prin_def anal_def - apply simp - apply (unfold f'_def) - apply (fold wp_def) - apply (auto simp add:field_simps) - by (metis Suc_diff_Suc minus_nat.diff_0 power_Suc) - qed - then have "cont_zero ff p e2" unfolding cont_zero_def - proof (elim has_contour_integral_eq) - fix w assume "w \ path_image (circlepath p e2)" - then have "w\ball p r" and "w\p" unfolding e2_def using \r>0\ by auto - have "deriv f' w = deriv f w" - proof (rule complex_derivative_transform_within_open[where s="ball p r - {p}"]) - show "f' holomorphic_on ball p r - {p}" unfolding f'_def using pp_holo - by (auto intro!: holomorphic_intros) - next - have "ball p e1 - {p} \ s - poles" - using avoid_def ball_subset_cball e1_avoid by auto - then have "ball p r - {p} \ s - poles" using \cball p r \ ball p e1\ - using ball_subset_cball by blast - then show "f holomorphic_on ball p r - {p}" using f_holo - by auto - next - show "open (ball p r - {p})" by auto - next - show "w \ ball p r - {p}" using \w\ball p r\ \w\p\ by auto - next - fix x assume "x \ ball p r - {p}" - then show "f' x = f x" - using pp_po unfolding f'_def by auto - qed - moreover have " f' w = f w " - using \w \ ball p r\ ball_subset_cball subset_iff pp_po unfolding f'_def by auto - ultimately show "ff' w = ff w" - unfolding ff'_def ff_def by simp - qed - moreover have "cball p e2 \ ball p e1" - using \0 < r\ \cball p r \ ball p e1\ e2_def by auto - ultimately show ?thesis using \e2>0\ by auto - qed - then obtain e3 where e3:"p\zeros \ e3>0 \ cball p e3 \ ball p e1 \ cont_zero ff p e3" - by auto - define e4 where "e4 \ if p\poles then e2 else if p\zeros then e3 else e1" - have "e4>0" using e2 e3 \e1>0\ unfolding e4_def by auto - moreover have "avoid p e4" using e2 e3 \e1>0\ e1_avoid unfolding e4_def avoid_def by auto - moreover have "p\poles \ cont_pole ff p e4" and "p\zeros \ cont_zero ff p e4" - by (auto simp add: e2 e3 e4_def zeros_def) - ultimately show ?thesis by auto - qed - then obtain get_e where get_e:"\p\s. get_e p>0 \ avoid p (get_e p) - \ (p\poles \ cont_pole ff p (get_e p)) \ (p\zeros \ cont_zero ff p (get_e p))" - by metis - define cont where "cont \ \p. contour_integral (circlepath p (get_e p)) ff" - define w where "w \ \p. winding_number g p" - have "contour_integral g ff = (\p\zeros \ poles. w p * cont p)" - unfolding cont_def w_def - proof (rule Cauchy_theorem_singularities[OF \open s\ \connected s\ finite _ \valid_path g\ loop - path_img homo]) - have "open (s - (zeros \ poles))" using open_Diff[OF _ finite_imp_closed[OF finite]] \open s\ by auto - then show "ff holomorphic_on s - (zeros \ poles)" unfolding ff_def using f_holo h_holo - by (auto intro!: holomorphic_intros simp add:zeros_def) - next - show "\p\s. 0 < get_e p \ (\w\cball p (get_e p). w \ s \ (w \ p \ w \ zeros \ poles))" - using get_e using avoid_def by blast - qed - also have "... = (\p\zeros. w p * cont p) + (\p\poles. w p * cont p)" - using finite - apply (subst sum.union_disjoint) - by (auto simp add:zeros_def) - also have "... = c * ((\p\zeros. w p * h p * zorder f p) - (\p\poles. w p * h p * porder f p))" - proof - - have "(\p\zeros. w p * cont p) = (\p\zeros. c * w p * h p * zorder f p)" - proof (rule sum.cong[of zeros zeros,simplified]) - fix p assume "p \ zeros" - show "w p * cont p = c * w p * h p * (zorder f p)" - proof (cases "p\s") - assume "p \ s" - have "cont p = c * h p * (zorder f p)" unfolding cont_def - apply (rule contour_integral_unique) - using get_e \p\s\ \p\zeros\ unfolding cont_zero_def - by (metis mult.assoc mult.commute) - thus ?thesis by auto - next - assume "p\s" - then have "w p=0" using homo unfolding w_def by auto - then show ?thesis by auto - qed - qed - then have "(\p\zeros. w p * cont p) = c * (\p\zeros. w p * h p * zorder f p)" - apply (subst sum_distrib_left) - by (simp add:algebra_simps) - moreover have "(\p\poles. w p * cont p) = (\p\poles. - c * w p * h p * porder f p)" - proof (rule sum.cong[of poles poles,simplified]) - fix p assume "p \ poles" - show "w p * cont p = - c * w p * h p * (porder f p)" - proof (cases "p\s") - assume "p \ s" - have "cont p = - c * h p * (porder f p)" unfolding cont_def - apply (rule contour_integral_unique) - using get_e \p\s\ \p\poles\ unfolding cont_pole_def - by (metis mult.assoc mult.commute) - thus ?thesis by auto - next - assume "p\s" - then have "w p=0" using homo unfolding w_def by auto - then show ?thesis by auto - qed - qed - then have "(\p\poles. w p * cont p) = - c * (\p\poles. w p * h p * porder f p)" - apply (subst sum_distrib_left) - by (simp add:algebra_simps) - ultimately show ?thesis by (simp add: right_diff_distrib) - qed - finally show ?thesis unfolding w_def ff_def c_def by auto -qed - -subsection \Rouche's theorem \ - -theorem Rouche_theorem: - fixes f g::"complex \ complex" and s:: "complex set" - defines "fg\(\p. f p+ g p)" - defines "zeros_fg\{p. fg p =0}" and "zeros_f\{p. f p=0}" - assumes - "open s" and "connected s" and - "finite zeros_fg" and - "finite zeros_f" and - f_holo:"f holomorphic_on s" and - g_holo:"g holomorphic_on s" and - "valid_path \" and - loop:"pathfinish \ = pathstart \" and - path_img:"path_image \ \ s " and - path_less:"\z\path_image \. cmod(f z) > cmod(g z)" and - homo:"\z. (z \ s) \ winding_number \ z = 0" - shows "(\p\zeros_fg. winding_number \ p * zorder fg p) - = (\p\zeros_f. winding_number \ p * zorder f p)" -proof - - have path_fg:"path_image \ \ s - zeros_fg" - proof - - have False when "z\path_image \" and "f z + g z=0" for z - proof - - have "cmod (f z) > cmod (g z)" using \z\path_image \\ path_less by auto - moreover have "f z = - g z" using \f z + g z =0\ by (simp add: eq_neg_iff_add_eq_0) - then have "cmod (f z) = cmod (g z)" by auto - ultimately show False by auto - qed - then show ?thesis unfolding zeros_fg_def fg_def using path_img by auto - qed - have path_f:"path_image \ \ s - zeros_f" - proof - - have False when "z\path_image \" and "f z =0" for z - proof - - have "cmod (g z) < cmod (f z) " using \z\path_image \\ path_less by auto - then have "cmod (g z) < 0" using \f z=0\ by auto - then show False by auto - qed - then show ?thesis unfolding zeros_f_def using path_img by auto - qed - define w where "w \ \p. winding_number \ p" - define c where "c \ 2 * complex_of_real pi * \" - define h where "h \ \p. g p / f p + 1" - obtain spikes - where "finite spikes" and spikes: "\x\{0..1} - spikes. \ differentiable at x" - using \valid_path \\ - by (auto simp: valid_path_def piecewise_C1_differentiable_on_def C1_differentiable_on_eq) - have h_contour:"((\x. deriv h x / h x) has_contour_integral 0) \" - proof - - have outside_img:"0 \ outside (path_image (h o \))" - proof - - have "h p \ ball 1 1" when "p\path_image \" for p - proof - - have "cmod (g p/f p) <1" using path_less[rule_format,OF that] - apply (cases "cmod (f p) = 0") - by (auto simp add: norm_divide) - then show ?thesis unfolding h_def by (auto simp add:dist_complex_def) - qed - then have "path_image (h o \) \ ball 1 1" - by (simp add: image_subset_iff path_image_compose) - moreover have " (0::complex) \ ball 1 1" by (simp add: dist_norm) - ultimately show "?thesis" - using convex_in_outside[of "ball 1 1" 0] outside_mono by blast - qed - have valid_h:"valid_path (h \ \)" - proof (rule valid_path_compose_holomorphic[OF \valid_path \\ _ _ path_f]) - show "h holomorphic_on s - zeros_f" - unfolding h_def using f_holo g_holo - by (auto intro!: holomorphic_intros simp add:zeros_f_def) - next - show "open (s - zeros_f)" using \finite zeros_f\ \open s\ finite_imp_closed - by auto - qed - have "((\z. 1/z) has_contour_integral 0) (h \ \)" - proof - - have "0 \ path_image (h \ \)" using outside_img by (simp add: outside_def) - then have "((\z. 1/z) has_contour_integral c * winding_number (h \ \) 0) (h \ \)" - using has_contour_integral_winding_number[of "h o \" 0,simplified] valid_h - unfolding c_def by auto - moreover have "winding_number (h o \) 0 = 0" - proof - - have "0 \ outside (path_image (h \ \))" using outside_img . - moreover have "path (h o \)" - using valid_h by (simp add: valid_path_imp_path) - moreover have "pathfinish (h o \) = pathstart (h o \)" - by (simp add: loop pathfinish_compose pathstart_compose) - ultimately show ?thesis using winding_number_zero_in_outside by auto - qed - ultimately show ?thesis by auto - qed - moreover have "vector_derivative (h \ \) (at x) = vector_derivative \ (at x) * deriv h (\ x)" - when "x\{0..1} - spikes" for x - proof (rule vector_derivative_chain_at_general) - show "\ differentiable at x" using that \valid_path \\ spikes by auto - next - define der where "der \ \p. (deriv g p * f p - g p * deriv f p)/(f p * f p)" - define t where "t \ \ x" - have "f t\0" unfolding zeros_f_def t_def - by (metis DiffD1 image_eqI norm_not_less_zero norm_zero path_defs(4) path_less that) - moreover have "t\s" - using contra_subsetD path_image_def path_fg t_def that by fastforce - ultimately have "(h has_field_derivative der t) (at t)" - unfolding h_def der_def using g_holo f_holo \open s\ - by (auto intro!: holomorphic_derivI derivative_eq_intros) - then show "h field_differentiable at (\ x)" - unfolding t_def field_differentiable_def by blast - qed - then have " ((/) 1 has_contour_integral 0) (h \ \) - = ((\x. deriv h x / h x) has_contour_integral 0) \" - unfolding has_contour_integral - apply (intro has_integral_spike_eq[OF negligible_finite, OF \finite spikes\]) - by auto - ultimately show ?thesis by auto - qed - then have "contour_integral \ (\x. deriv h x / h x) = 0" - using contour_integral_unique by simp - moreover have "contour_integral \ (\x. deriv fg x / fg x) = contour_integral \ (\x. deriv f x / f x) - + contour_integral \ (\p. deriv h p / h p)" - proof - - have "(\p. deriv f p / f p) contour_integrable_on \" - proof (rule contour_integrable_holomorphic_simple[OF _ _ \valid_path \\ path_f]) - show "open (s - zeros_f)" using finite_imp_closed[OF \finite zeros_f\] \open s\ - by auto - then show "(\p. deriv f p / f p) holomorphic_on s - zeros_f" - using f_holo - by (auto intro!: holomorphic_intros simp add:zeros_f_def) - qed - moreover have "(\p. deriv h p / h p) contour_integrable_on \" - using h_contour - by (simp add: has_contour_integral_integrable) - ultimately have "contour_integral \ (\x. deriv f x / f x + deriv h x / h x) = - contour_integral \ (\p. deriv f p / f p) + contour_integral \ (\p. deriv h p / h p)" - using contour_integral_add[of "(\p. deriv f p / f p)" \ "(\p. deriv h p / h p)" ] - by auto - moreover have "deriv fg p / fg p = deriv f p / f p + deriv h p / h p" - when "p\ path_image \" for p - proof - - have "fg p\0" and "f p\0" using path_f path_fg that unfolding zeros_f_def zeros_fg_def - by auto - have "h p\0" - proof (rule ccontr) - assume "\ h p \ 0" - then have "g p / f p= -1" unfolding h_def by (simp add: add_eq_0_iff2) - then have "cmod (g p/f p) = 1" by auto - moreover have "cmod (g p/f p) <1" using path_less[rule_format,OF that] - apply (cases "cmod (f p) = 0") - by (auto simp add: norm_divide) - ultimately show False by auto - qed - have der_fg:"deriv fg p = deriv f p + deriv g p" unfolding fg_def - using f_holo g_holo holomorphic_on_imp_differentiable_at[OF _ \open s\] path_img that - by auto - have der_h:"deriv h p = (deriv g p * f p - g p * deriv f p)/(f p * f p)" - proof - - define der where "der \ \p. (deriv g p * f p - g p * deriv f p)/(f p * f p)" - have "p\s" using path_img that by auto - then have "(h has_field_derivative der p) (at p)" - unfolding h_def der_def using g_holo f_holo \open s\ \f p\0\ - by (auto intro!: derivative_eq_intros holomorphic_derivI) - then show ?thesis unfolding der_def using DERIV_imp_deriv by auto - qed - show ?thesis - apply (simp only:der_fg der_h) - apply (auto simp add:field_simps \h p\0\ \f p\0\ \fg p\0\) - by (auto simp add:field_simps h_def \f p\0\ fg_def) - qed - then have "contour_integral \ (\p. deriv fg p / fg p) - = contour_integral \ (\p. deriv f p / f p + deriv h p / h p)" - by (elim contour_integral_eq) - ultimately show ?thesis by auto - qed - moreover have "contour_integral \ (\x. deriv fg x / fg x) = c * (\p\zeros_fg. w p * zorder fg p)" - unfolding c_def zeros_fg_def w_def - proof (rule argument_principle[OF \open s\ \connected s\ _ _ \valid_path \\ loop _ homo - , of _ "{}" "\_. 1",simplified]) - show "fg holomorphic_on s" unfolding fg_def using f_holo g_holo holomorphic_on_add by auto - show "path_image \ \ s - {p. fg p = 0}" using path_fg unfolding zeros_fg_def . - show " finite {p. fg p = 0}" using \finite zeros_fg\ unfolding zeros_fg_def . - qed - moreover have "contour_integral \ (\x. deriv f x / f x) = c * (\p\zeros_f. w p * zorder f p)" - unfolding c_def zeros_f_def w_def - proof (rule argument_principle[OF \open s\ \connected s\ _ _ \valid_path \\ loop _ homo - , of _ "{}" "\_. 1",simplified]) - show "f holomorphic_on s" using f_holo g_holo holomorphic_on_add by auto - show "path_image \ \ s - {p. f p = 0}" using path_f unfolding zeros_f_def . - show " finite {p. f p = 0}" using \finite zeros_f\ unfolding zeros_f_def . - qed - ultimately have " c* (\p\zeros_fg. w p * (zorder fg p)) = c* (\p\zeros_f. w p * (zorder f p))" - by auto - then show ?thesis unfolding c_def using w_def by auto -qed - - -subsection \More facts about poles and residues\ - -lemma zorder_cong: - assumes "eventually (\z. f z = g z) (nhds z)" "z = z'" - shows "zorder f z = zorder g z'" -proof - - let ?P = "(\f n h r. 0 < r \ h holomorphic_on cball z r \ - (\w\cball z r. f w = h w * (w - z) ^ n \ h w \ 0))" - have "(\n. n > 0 \ (\h r. ?P f n h r)) = (\n. n > 0 \ (\h r. ?P g n h r))" - proof (intro ext conj_cong refl iff_exI[where ?'a = "complex \ complex"], goal_cases) - case (1 n h) - have *: "\r. ?P g n h r" if "\r. ?P f n h r" and "eventually (\x. f x = g x) (nhds z)" for f g - proof - - from that(1) obtain r where "?P f n h r" by blast - moreover from that(2) obtain r' where "r' > 0" "\w. dist w z < r' \ f w = g w" - by (auto simp: eventually_nhds_metric) - hence "\w\cball z (r'/2). f w = g w" by (auto simp: dist_commute) - ultimately show ?thesis using \r' > 0\ - by (intro exI[of _ "min r (r'/2)"]) (auto simp: cball_def) - qed - from assms have eq': "eventually (\z. g z = f z) (nhds z)" - by (simp add: eq_commute) - show ?case - by (rule iffI[OF *[OF _ assms(1)] *[OF _ eq']]) - qed - with assms(2) show ?thesis unfolding zorder_def by simp -qed - -lemma porder_cong: - assumes "eventually (\z. f z = g z) (at z)" "z = z'" - shows "porder f z = porder g z'" -proof - - from assms(1) have *: "eventually (\w. w \ z \ f w = g w) (nhds z)" - by (auto simp: eventually_at_filter) - from assms(2) show ?thesis - unfolding porder_def Let_def - by (intro zorder_cong eventually_mono [OF *]) auto -qed - -lemma zer_poly_cong: - assumes "eventually (\z. f z = g z) (nhds z)" "z = z'" - shows "zer_poly f z = zer_poly g z'" - unfolding zer_poly_def -proof (rule Eps_cong, goal_cases) - case (1 h) - let ?P = "\w f. f w = h w * (w - z) ^ zorder f z \ h w \ 0" - from assms have eq': "eventually (\z. g z = f z) (nhds z)" - by (simp add: eq_commute) - have "\r>0. h holomorphic_on cball z r \ (\w\cball z r. ?P w g)" - if "r > 0" "h holomorphic_on cball z r" "\w. w \ cball z r \ ?P w f" - "eventually (\z. f z = g z) (nhds z)" for f g r - proof - - from that have [simp]: "zorder f z = zorder g z" - by (intro zorder_cong) auto - from that(4) obtain r' where r': "r' > 0" "\w. w \ ball z r' \ g w = f w" - by (auto simp: eventually_nhds_metric ball_def dist_commute) - define R where "R = min r (r' / 2)" - have "R > 0" "cball z R \ cball z r" "cball z R \ ball z r'" - using that(1) r' by (auto simp: R_def) - with that(1,2,3) r' - have "R > 0" "h holomorphic_on cball z R" "\w\cball z R. ?P w g" - by force+ - thus ?thesis by blast - qed - from this[of _ f g] and this[of _ g f] and assms and eq' - show ?case by blast -qed - -lemma pol_poly_cong: - assumes "eventually (\z. f z = g z) (at z)" "z = z'" - shows "pol_poly f z = pol_poly g z'" -proof - - from assms have *: "eventually (\w. w \ z \ f w = g w) (nhds z)" - by (auto simp: eventually_at_filter) - have "zer_poly (\x. if x = z then 0 else inverse (f x)) z = - zer_poly (\x. if x = z' then 0 else inverse (g x)) z" - by (intro zer_poly_cong eventually_mono[OF *] refl) (auto simp: assms(2)) - thus "pol_poly f z = pol_poly g z'" - by (simp add: pol_poly_def Let_def o_def fun_eq_iff assms(2)) -qed - -lemma porder_nonzero_div_power: - assumes "open s" "z \ s" "f holomorphic_on s" "f z \ 0" "n > 0" - shows "porder (\w. f w / (w - z) ^ n) z = n" -proof - - let ?s' = "(f -` (-{0}) \ s)" - have "continuous_on s f" - by (rule holomorphic_on_imp_continuous_on) fact - moreover have "open (-{0::complex})" by auto - ultimately have s': "open ?s'" - unfolding continuous_on_open_vimage[OF \open s\] by blast - show ?thesis unfolding Let_def porder_def - proof (rule zorder_eqI) - show "(\x. inverse (f x)) holomorphic_on ?s'" - using assms by (auto intro!: holomorphic_intros) - qed (insert assms s', auto simp: field_simps) -qed - lemma is_pole_inverse_power: "n > 0 \ is_pole (\z::complex. 1 / (z - a) ^ n) a" unfolding is_pole_def inverse_eq_divide [symmetric] by (intro filterlim_compose[OF filterlim_inverse_at_infinity] tendsto_intros) @@ -4083,30 +3070,1500 @@ shows "is_pole (\w. f w / w ^ n) 0" using is_pole_basic[of f A 0] assms by simp -lemma zer_poly_eq: - assumes "open s" "connected s" "z \ s" "f holomorphic_on s" "f z = 0" "\w\s. f w \ 0" - shows "eventually (\w. zer_poly f z w = f w / (w - z) ^ zorder f z) (at z)" +text \The proposition + @{term "\x. ((f::complex\complex) \ x) (at z) \ is_pole f z"} +can be interpreted as the complex function @{term f} has a non-essential singularity at @{term z} +(i.e. the singularity is either removable or a pole).\ +definition not_essential::"[complex \ complex, complex] \ bool" where + "not_essential f z = (\x. f\z\x \ is_pole f z)" + +definition isolated_singularity_at::"[complex \ complex, complex] \ bool" where + "isolated_singularity_at f z = (\r>0. f analytic_on ball z r-{z})" + +named_theorems singularity_intros "introduction rules for singularities" + +lemma holomorphic_factor_unique: + fixes f::"complex \ complex" and z::complex and r::real and m n::int + assumes "r>0" "g z\0" "h z\0" + and asm:"\w\ball z r-{z}. f w = g w * (w-z) powr n \ g w\0 \ f w = h w * (w - z) powr m \ h w\0" + and g_holo:"g holomorphic_on ball z r" and h_holo:"h holomorphic_on ball z r" + shows "n=m" +proof - + have [simp]:"at z within ball z r \ bot" using \r>0\ + by (auto simp add:at_within_ball_bot_iff) + have False when "n>m" + proof - + have "(h \ 0) (at z within ball z r)" + proof (rule Lim_transform_within[OF _ \r>0\, where f="\w. (w - z) powr (n - m) * g w"]) + have "\w\ball z r-{z}. h w = (w-z)powr(n-m) * g w" + using \n>m\ asm \r>0\ + apply (auto simp add:field_simps powr_diff) + by force + then show "\x' \ ball z r; 0 < dist x' z;dist x' z < r\ + \ (x' - z) powr (n - m) * g x' = h x'" for x' by auto + next + define F where "F \ at z within ball z r" + define f' where "f' \ \x. (x - z) powr (n-m)" + have "f' z=0" using \n>m\ unfolding f'_def by auto + moreover have "continuous F f'" unfolding f'_def F_def continuous_def + apply (subst netlimit_within) + using \n>m\ by (auto intro!:tendsto_powr_complex_0 tendsto_eq_intros) + ultimately have "(f' \ 0) F" unfolding F_def + by (simp add: continuous_within) + moreover have "(g \ g z) F" + using holomorphic_on_imp_continuous_on[OF g_holo,unfolded continuous_on_def] \r>0\ + unfolding F_def by auto + ultimately show " ((\w. f' w * g w) \ 0) F" using tendsto_mult by fastforce + qed + moreover have "(h \ h z) (at z within ball z r)" + using holomorphic_on_imp_continuous_on[OF h_holo] + by (auto simp add:continuous_on_def \r>0\) + ultimately have "h z=0" by (auto intro!: tendsto_unique) + thus False using \h z\0\ by auto + qed + moreover have False when "m>n" + proof - + have "(g \ 0) (at z within ball z r)" + proof (rule Lim_transform_within[OF _ \r>0\, where f="\w. (w - z) powr (m - n) * h w"]) + have "\w\ball z r -{z}. g w = (w-z) powr (m-n) * h w" using \m>n\ asm + apply (auto simp add:field_simps powr_diff) + by force + then show "\x' \ ball z r; 0 < dist x' z;dist x' z < r\ + \ (x' - z) powr (m - n) * h x' = g x'" for x' by auto + next + define F where "F \ at z within ball z r" + define f' where "f' \\x. (x - z) powr (m-n)" + have "f' z=0" using \m>n\ unfolding f'_def by auto + moreover have "continuous F f'" unfolding f'_def F_def continuous_def + apply (subst netlimit_within) + using \m>n\ by (auto intro!:tendsto_powr_complex_0 tendsto_eq_intros) + ultimately have "(f' \ 0) F" unfolding F_def + by (simp add: continuous_within) + moreover have "(h \ h z) F" + using holomorphic_on_imp_continuous_on[OF h_holo,unfolded continuous_on_def] \r>0\ + unfolding F_def by auto + ultimately show " ((\w. f' w * h w) \ 0) F" using tendsto_mult by fastforce + qed + moreover have "(g \ g z) (at z within ball z r)" + using holomorphic_on_imp_continuous_on[OF g_holo] + by (auto simp add:continuous_on_def \r>0\) + ultimately have "g z=0" by (auto intro!: tendsto_unique) + thus False using \g z\0\ by auto + qed + ultimately show "n=m" by fastforce +qed + +lemma holomorphic_factor_puncture: + assumes f_iso:"isolated_singularity_at f z" + and "not_essential f z" \ \@{term f} has either a removable singularity or a pole at @{term z}\ + and non_zero:"\\<^sub>Fw in (at z). f w\0" \ \@{term f} will not be constantly zero in a neighbour of @{term z}\ + shows "\!n::int. \g r. 0 < r \ g holomorphic_on cball z r \ g z\0 + \ (\w\cball z r-{z}. f w = g w * (w-z) powr n \ g w\0)" +proof - + define P where "P = (\f n g r. 0 < r \ g holomorphic_on cball z r \ g z\0 + \ (\w\cball z r - {z}. f w = g w * (w-z) powr (of_int n) \ g w\0))" + have imp_unique:"\!n::int. \g r. P f n g r" when "\n g r. P f n g r" + proof (rule ex_ex1I[OF that]) + fix n1 n2 :: int + assume g1_asm:"\g1 r1. P f n1 g1 r1" and g2_asm:"\g2 r2. P f n2 g2 r2" + define fac where "fac \ \n g r. \w\cball z r-{z}. f w = g w * (w - z) powr (of_int n) \ g w \ 0" + obtain g1 r1 where "0 < r1" and g1_holo: "g1 holomorphic_on cball z r1" and "g1 z\0" + and "fac n1 g1 r1" using g1_asm unfolding P_def fac_def by auto + obtain g2 r2 where "0 < r2" and g2_holo: "g2 holomorphic_on cball z r2" and "g2 z\0" + and "fac n2 g2 r2" using g2_asm unfolding P_def fac_def by auto + define r where "r \ min r1 r2" + have "r>0" using \r1>0\ \r2>0\ unfolding r_def by auto + moreover have "\w\ball z r-{z}. f w = g1 w * (w-z) powr n1 \ g1 w\0 + \ f w = g2 w * (w - z) powr n2 \ g2 w\0" + using \fac n1 g1 r1\ \fac n2 g2 r2\ unfolding fac_def r_def + by fastforce + ultimately show "n1=n2" using g1_holo g2_holo \g1 z\0\ \g2 z\0\ + apply (elim holomorphic_factor_unique) + by (auto simp add:r_def) + qed + + have P_exist:"\ n g r. P h n g r" when + "\z'. (h \ z') (at z)" "isolated_singularity_at h z" "\\<^sub>Fw in (at z). h w\0" + for h + proof - + from that(2) obtain r where "r>0" "h analytic_on ball z r - {z}" + unfolding isolated_singularity_at_def by auto + obtain z' where "(h \ z') (at z)" using \\z'. (h \ z') (at z)\ by auto + define h' where "h'=(\x. if x=z then z' else h x)" + have "h' holomorphic_on ball z r" + apply (rule no_isolated_singularity'[of "{z}"]) + subgoal by (metis LIM_equal Lim_at_imp_Lim_at_within \h \z\ z'\ empty_iff h'_def insert_iff) + subgoal using \h analytic_on ball z r - {z}\ analytic_imp_holomorphic h'_def holomorphic_transform + by fastforce + by auto + have ?thesis when "z'=0" + proof - + have "h' z=0" using that unfolding h'_def by auto + moreover have "\ h' constant_on ball z r" + using \\\<^sub>Fw in (at z). h w\0\ unfolding constant_on_def frequently_def eventually_at h'_def + apply simp + by (metis \0 < r\ centre_in_ball dist_commute mem_ball that) + moreover note \h' holomorphic_on ball z r\ + ultimately obtain g r1 n where "0 < n" "0 < r1" "ball z r1 \ ball z r" and + g:"g holomorphic_on ball z r1" + "\w. w \ ball z r1 \ h' w = (w - z) ^ n * g w" + "\w. w \ ball z r1 \ g w \ 0" + using holomorphic_factor_zero_nonconstant[of _ "ball z r" z thesis,simplified, + OF \h' holomorphic_on ball z r\ \r>0\ \h' z=0\ \\ h' constant_on ball z r\] + by (auto simp add:dist_commute) + define rr where "rr=r1/2" + have "P h' n g rr" + unfolding P_def rr_def + using \n>0\ \r1>0\ g by (auto simp add:powr_nat) + then have "P h n g rr" + unfolding h'_def P_def by auto + then show ?thesis unfolding P_def by blast + qed + moreover have ?thesis when "z'\0" + proof - + have "h' z\0" using that unfolding h'_def by auto + obtain r1 where "r1>0" "cball z r1 \ ball z r" "\x\cball z r1. h' x\0" + proof - + have "isCont h' z" "h' z\0" + by (auto simp add: Lim_cong_within \h \z\ z'\ \z'\0\ continuous_at h'_def) + then obtain r2 where r2:"r2>0" "\x\ball z r2. h' x\0" + using continuous_at_avoid[of z h' 0 ] unfolding ball_def by auto + define r1 where "r1=min r2 r / 2" + have "0 < r1" "cball z r1 \ ball z r" + using \r2>0\ \r>0\ unfolding r1_def by auto + moreover have "\x\cball z r1. h' x \ 0" + using r2 unfolding r1_def by simp + ultimately show ?thesis using that by auto + qed + then have "P h' 0 h' r1" using \h' holomorphic_on ball z r\ unfolding P_def by auto + then have "P h 0 h' r1" unfolding P_def h'_def by auto + then show ?thesis unfolding P_def by blast + qed + ultimately show ?thesis by auto + qed + + have ?thesis when "\x. (f \ x) (at z)" + apply (rule_tac imp_unique[unfolded P_def]) + using P_exist[OF that(1) f_iso non_zero] unfolding P_def . + moreover have ?thesis when "is_pole f z" + proof (rule imp_unique[unfolded P_def]) + obtain e where [simp]:"e>0" and e_holo:"f holomorphic_on ball z e - {z}" and e_nz: "\x\ball z e-{z}. f x\0" + proof - + have "\\<^sub>F z in at z. f z \ 0" + using \is_pole f z\ filterlim_at_infinity_imp_eventually_ne unfolding is_pole_def + by auto + then obtain e1 where e1:"e1>0" "\x\ball z e1-{z}. f x\0" + using that eventually_at[of "\x. f x\0" z UNIV,simplified] by (auto simp add:dist_commute) + obtain e2 where e2:"e2>0" "f holomorphic_on ball z e2 - {z}" + using f_iso analytic_imp_holomorphic unfolding isolated_singularity_at_def by auto + define e where "e=min e1 e2" + show ?thesis + apply (rule that[of e]) + using e1 e2 unfolding e_def by auto + qed + + define h where "h \ \x. inverse (f x)" + + have "\n g r. P h n g r" + proof - + have "h \z\ 0" + using Lim_transform_within_open assms(2) h_def is_pole_tendsto that by fastforce + moreover have "\\<^sub>Fw in (at z). h w\0" + using non_zero + apply (elim frequently_rev_mp) + unfolding h_def eventually_at by (auto intro:exI[where x=1]) + moreover have "isolated_singularity_at h z" + unfolding isolated_singularity_at_def h_def + apply (rule exI[where x=e]) + using e_holo e_nz \e>0\ by (metis Topology_Euclidean_Space.open_ball analytic_on_open + holomorphic_on_inverse open_delete) + ultimately show ?thesis + using P_exist[of h] by auto + qed + then obtain n g r + where "0 < r" and + g_holo:"g holomorphic_on cball z r" and "g z\0" and + g_fac:"(\w\cball z r-{z}. h w = g w * (w - z) powr of_int n \ g w \ 0)" + unfolding P_def by auto + have "P f (-n) (inverse o g) r" + proof - + have "f w = inverse (g w) * (w - z) powr of_int (- n)" when "w\cball z r - {z}" for w + using g_fac[rule_format,of w] that unfolding h_def + apply (auto simp add:powr_minus ) + by (metis inverse_inverse_eq inverse_mult_distrib) + then show ?thesis + unfolding P_def comp_def + using \r>0\ g_holo g_fac \g z\0\ by (auto intro:holomorphic_intros) + qed + then show "\x g r. 0 < r \ g holomorphic_on cball z r \ g z \ 0 + \ (\w\cball z r - {z}. f w = g w * (w - z) powr of_int x \ g w \ 0)" + unfolding P_def by blast + qed + ultimately show ?thesis using \not_essential f z\ unfolding not_essential_def by presburger +qed + +lemma not_essential_transform: + assumes "not_essential g z" + assumes "\\<^sub>F w in (at z). g w = f w" + shows "not_essential f z" + using assms unfolding not_essential_def + by (simp add: filterlim_cong is_pole_cong) + +lemma isolated_singularity_at_transform: + assumes "isolated_singularity_at g z" + assumes "\\<^sub>F w in (at z). g w = f w" + shows "isolated_singularity_at f z" +proof - + obtain r1 where "r1>0" and r1:"g analytic_on ball z r1 - {z}" + using assms(1) unfolding isolated_singularity_at_def by auto + obtain r2 where "r2>0" and r2:" \x. x \ z \ dist x z < r2 \ g x = f x" + using assms(2) unfolding eventually_at by auto + define r3 where "r3=min r1 r2" + have "r3>0" unfolding r3_def using \r1>0\ \r2>0\ by auto + moreover have "f analytic_on ball z r3 - {z}" + proof - + have "g holomorphic_on ball z r3 - {z}" + using r1 unfolding r3_def by (subst (asm) analytic_on_open,auto) + then have "f holomorphic_on ball z r3 - {z}" + using r2 unfolding r3_def + by (auto simp add:dist_commute elim!:holomorphic_transform) + then show ?thesis by (subst analytic_on_open,auto) + qed + ultimately show ?thesis unfolding isolated_singularity_at_def by auto +qed + +lemma not_essential_powr[singularity_intros]: + assumes "LIM w (at z). f w :> (at x)" + shows "not_essential (\w. (f w) powr (of_int n)) z" +proof - + define fp where "fp=(\w. (f w) powr (of_int n))" + have ?thesis when "n>0" + proof - + have "(\w. (f w) ^ (nat n)) \z\ x ^ nat n" + using that assms unfolding filterlim_at by (auto intro!:tendsto_eq_intros) + then have "fp \z\ x ^ nat n" unfolding fp_def + apply (elim Lim_transform_within[where d=1],simp) + by (metis less_le powr_0 powr_of_int that zero_less_nat_eq zero_power) + then show ?thesis unfolding not_essential_def fp_def by auto + qed + moreover have ?thesis when "n=0" + proof - + have "fp \z\ 1 " + apply (subst tendsto_cong[where g="\_.1"]) + using that filterlim_at_within_not_equal[OF assms,of 0] unfolding fp_def by auto + then show ?thesis unfolding fp_def not_essential_def by auto + qed + moreover have ?thesis when "n<0" + proof (cases "x=0") + case True + have "LIM w (at z). inverse ((f w) ^ (nat (-n))) :> at_infinity" + apply (subst filterlim_inverse_at_iff[symmetric],simp) + apply (rule filterlim_atI) + subgoal using assms True that unfolding filterlim_at by (auto intro!:tendsto_eq_intros) + subgoal using filterlim_at_within_not_equal[OF assms,of 0] + by (eventually_elim,insert that,auto) + done + then have "LIM w (at z). fp w :> at_infinity" + proof (elim filterlim_mono_eventually) + show "\\<^sub>F x in at z. inverse (f x ^ nat (- n)) = fp x" + using filterlim_at_within_not_equal[OF assms,of 0] unfolding fp_def + apply eventually_elim + using powr_of_int that by auto + qed auto + then show ?thesis unfolding fp_def not_essential_def is_pole_def by auto + next + case False + let ?xx= "inverse (x ^ (nat (-n)))" + have "(\w. inverse ((f w) ^ (nat (-n)))) \z\?xx" + using assms False unfolding filterlim_at by (auto intro!:tendsto_eq_intros) + then have "fp \z\?xx" + apply (elim Lim_transform_within[where d=1],simp) + unfolding fp_def by (metis inverse_zero nat_mono_iff nat_zero_as_int neg_0_less_iff_less + not_le power_eq_0_iff powr_0 powr_of_int that) + then show ?thesis unfolding fp_def not_essential_def by auto + qed + ultimately show ?thesis by linarith +qed + +lemma isolated_singularity_at_powr[singularity_intros]: + assumes "isolated_singularity_at f z" "\\<^sub>F w in (at z). f w\0" + shows "isolated_singularity_at (\w. (f w) powr (of_int n)) z" +proof - + obtain r1 where "r1>0" "f analytic_on ball z r1 - {z}" + using assms(1) unfolding isolated_singularity_at_def by auto + then have r1:"f holomorphic_on ball z r1 - {z}" + using analytic_on_open[of "ball z r1-{z}" f] by blast + obtain r2 where "r2>0" and r2:"\w. w \ z \ dist w z < r2 \ f w \ 0" + using assms(2) unfolding eventually_at by auto + define r3 where "r3=min r1 r2" + have "(\w. (f w) powr of_int n) holomorphic_on ball z r3 - {z}" + apply (rule holomorphic_on_powr_of_int) + subgoal unfolding r3_def using r1 by auto + subgoal unfolding r3_def using r2 by (auto simp add:dist_commute) + done + moreover have "r3>0" unfolding r3_def using \0 < r1\ \0 < r2\ by linarith + ultimately show ?thesis unfolding isolated_singularity_at_def + apply (subst (asm) analytic_on_open[symmetric]) + by auto +qed + +lemma non_zero_neighbour: + assumes f_iso:"isolated_singularity_at f z" + and f_ness:"not_essential f z" + and f_nconst:"\\<^sub>Fw in (at z). f w\0" + shows "\\<^sub>F w in (at z). f w\0" +proof - + obtain fn fp fr where [simp]:"fp z \ 0" and "fr > 0" + and fr: "fp holomorphic_on cball z fr" + "\w\cball z fr - {z}. f w = fp w * (w - z) powr of_int fn \ fp w \ 0" + using holomorphic_factor_puncture[OF f_iso f_ness f_nconst,THEN ex1_implies_ex] by auto + have "f w \ 0" when " w \ z" "dist w z < fr" for w + proof - + have "f w = fp w * (w - z) powr of_int fn" "fp w \ 0" + using fr(2)[rule_format, of w] using that by (auto simp add:dist_commute) + moreover have "(w - z) powr of_int fn \0" + unfolding powr_eq_0_iff using \w\z\ by auto + ultimately show ?thesis by auto + qed + then show ?thesis using \fr>0\ unfolding eventually_at by auto +qed + +lemma non_zero_neighbour_pole: + assumes "is_pole f z" + shows "\\<^sub>F w in (at z). f w\0" + using assms filterlim_at_infinity_imp_eventually_ne[of f "at z" 0] + unfolding is_pole_def by auto + +lemma non_zero_neighbour_alt: + assumes holo: "f holomorphic_on S" + and "open S" "connected S" "z \ S" "\ \ S" "f \ \ 0" + shows "\\<^sub>F w in (at z). f w\0 \ w\S" +proof (cases "f z = 0") + case True + from isolated_zeros[OF holo \open S\ \connected S\ \z \ S\ True \\ \ S\ \f \ \ 0\] + obtain r where "0 < r" "ball z r \ S" "\w \ ball z r - {z}.f w \ 0" by metis + then show ?thesis unfolding eventually_at + apply (rule_tac x=r in exI) + by (auto simp add:dist_commute) +next + case False + obtain r1 where r1:"r1>0" "\y. dist z y < r1 \ f y \ 0" + using continuous_at_avoid[of z f, OF _ False] assms(2,4) continuous_on_eq_continuous_at + holo holomorphic_on_imp_continuous_on by blast + obtain r2 where r2:"r2>0" "ball z r2 \ S" + using assms(2) assms(4) openE by blast + show ?thesis unfolding eventually_at + apply (rule_tac x="min r1 r2" in exI) + using r1 r2 by (auto simp add:dist_commute) +qed + +lemma not_essential_times[singularity_intros]: + assumes f_ness:"not_essential f z" and g_ness:"not_essential g z" + assumes f_iso:"isolated_singularity_at f z" and g_iso:"isolated_singularity_at g z" + shows "not_essential (\w. f w * g w) z" +proof - + define fg where "fg = (\w. f w * g w)" + have ?thesis when "\ ((\\<^sub>Fw in (at z). f w\0) \ (\\<^sub>Fw in (at z). g w\0))" + proof - + have "\\<^sub>Fw in (at z). fg w=0" + using that[unfolded frequently_def, simplified] unfolding fg_def + by (auto elim: eventually_rev_mp) + from tendsto_cong[OF this] have "fg \z\0" by auto + then show ?thesis unfolding not_essential_def fg_def by auto + qed + moreover have ?thesis when f_nconst:"\\<^sub>Fw in (at z). f w\0" and g_nconst:"\\<^sub>Fw in (at z). g w\0" + proof - + obtain fn fp fr where [simp]:"fp z \ 0" and "fr > 0" + and fr: "fp holomorphic_on cball z fr" + "\w\cball z fr - {z}. f w = fp w * (w - z) powr of_int fn \ fp w \ 0" + using holomorphic_factor_puncture[OF f_iso f_ness f_nconst,THEN ex1_implies_ex] by auto + obtain gn gp gr where [simp]:"gp z \ 0" and "gr > 0" + and gr: "gp holomorphic_on cball z gr" + "\w\cball z gr - {z}. g w = gp w * (w - z) powr of_int gn \ gp w \ 0" + using holomorphic_factor_puncture[OF g_iso g_ness g_nconst,THEN ex1_implies_ex] by auto + + define r1 where "r1=(min fr gr)" + have "r1>0" unfolding r1_def using \fr>0\ \gr>0\ by auto + have fg_times:"fg w = (fp w * gp w) * (w - z) powr (of_int (fn+gn))" and fgp_nz:"fp w*gp w\0" + when "w\ball z r1 - {z}" for w + proof - + have "f w = fp w * (w - z) powr of_int fn" "fp w\0" + using fr(2)[rule_format,of w] that unfolding r1_def by auto + moreover have "g w = gp w * (w - z) powr of_int gn" "gp w \ 0" + using gr(2)[rule_format, of w] that unfolding r1_def by auto + ultimately show "fg w = (fp w * gp w) * (w - z) powr (of_int (fn+gn))" "fp w*gp w\0" + unfolding fg_def by (auto simp add:powr_add) + qed + + have [intro]: "fp \z\fp z" "gp \z\gp z" + using fr(1) \fr>0\ gr(1) \gr>0\ + by (meson Topology_Euclidean_Space.open_ball ball_subset_cball centre_in_ball + continuous_on_eq_continuous_at continuous_within holomorphic_on_imp_continuous_on + holomorphic_on_subset)+ + have ?thesis when "fn+gn>0" + proof - + have "(\w. (fp w * gp w) * (w - z) ^ (nat (fn+gn))) \z\0" + using that by (auto intro!:tendsto_eq_intros) + then have "fg \z\ 0" + apply (elim Lim_transform_within[OF _ \r1>0\]) + by (metis (no_types, hide_lams) Diff_iff cball_trivial dist_commute dist_self + eq_iff_diff_eq_0 fg_times less_le linorder_not_le mem_ball mem_cball powr_of_int + that) + then show ?thesis unfolding not_essential_def fg_def by auto + qed + moreover have ?thesis when "fn+gn=0" + proof - + have "(\w. fp w * gp w) \z\fp z*gp z" + using that by (auto intro!:tendsto_eq_intros) + then have "fg \z\ fp z*gp z" + apply (elim Lim_transform_within[OF _ \r1>0\]) + apply (subst fg_times) + by (auto simp add:dist_commute that) + then show ?thesis unfolding not_essential_def fg_def by auto + qed + moreover have ?thesis when "fn+gn<0" + proof - + have "LIM w (at z). fp w * gp w / (w-z)^nat (-(fn+gn)) :> at_infinity" + apply (rule filterlim_divide_at_infinity) + apply (insert that, auto intro!:tendsto_eq_intros filterlim_atI) + using eventually_at_topological by blast + then have "is_pole fg z" unfolding is_pole_def + apply (elim filterlim_transform_within[OF _ _ \r1>0\],simp) + apply (subst fg_times,simp add:dist_commute) + apply (subst powr_of_int) + using that by (auto simp add:divide_simps) + then show ?thesis unfolding not_essential_def fg_def by auto + qed + ultimately show ?thesis unfolding not_essential_def fg_def by fastforce + qed + ultimately show ?thesis by auto +qed + +lemma not_essential_inverse[singularity_intros]: + assumes f_ness:"not_essential f z" + assumes f_iso:"isolated_singularity_at f z" + shows "not_essential (\w. inverse (f w)) z" +proof - + define vf where "vf = (\w. inverse (f w))" + have ?thesis when "\(\\<^sub>Fw in (at z). f w\0)" + proof - + have "\\<^sub>Fw in (at z). f w=0" + using that[unfolded frequently_def, simplified] by (auto elim: eventually_rev_mp) + then have "\\<^sub>Fw in (at z). vf w=0" + unfolding vf_def by auto + from tendsto_cong[OF this] have "vf \z\0" unfolding vf_def by auto + then show ?thesis unfolding not_essential_def vf_def by auto + qed + moreover have ?thesis when "is_pole f z" + proof - + have "vf \z\0" + using that filterlim_at filterlim_inverse_at_iff unfolding is_pole_def vf_def by blast + then show ?thesis unfolding not_essential_def vf_def by auto + qed + moreover have ?thesis when "\x. f\z\x " and f_nconst:"\\<^sub>Fw in (at z). f w\0" + proof - + from that obtain fz where fz:"f\z\fz" by auto + have ?thesis when "fz=0" + proof - + have "(\w. inverse (vf w)) \z\0" + using fz that unfolding vf_def by auto + moreover have "\\<^sub>F w in at z. inverse (vf w) \ 0" + using non_zero_neighbour[OF f_iso f_ness f_nconst] + unfolding vf_def by auto + ultimately have "is_pole vf z" + using filterlim_inverse_at_iff[of vf "at z"] unfolding filterlim_at is_pole_def by auto + then show ?thesis unfolding not_essential_def vf_def by auto + qed + moreover have ?thesis when "fz\0" + proof - + have "vf \z\inverse fz" + using fz that unfolding vf_def by (auto intro:tendsto_eq_intros) + then show ?thesis unfolding not_essential_def vf_def by auto + qed + ultimately show ?thesis by auto + qed + ultimately show ?thesis using f_ness unfolding not_essential_def by auto +qed + +lemma isolated_singularity_at_inverse[singularity_intros]: + assumes f_iso:"isolated_singularity_at f z" + and f_ness:"not_essential f z" + shows "isolated_singularity_at (\w. inverse (f w)) z" +proof - + define vf where "vf = (\w. inverse (f w))" + have ?thesis when "\(\\<^sub>Fw in (at z). f w\0)" + proof - + have "\\<^sub>Fw in (at z). f w=0" + using that[unfolded frequently_def, simplified] by (auto elim: eventually_rev_mp) + then have "\\<^sub>Fw in (at z). vf w=0" + unfolding vf_def by auto + then obtain d1 where "d1>0" and d1:"\x. x \ z \ dist x z < d1 \ vf x = 0" + unfolding eventually_at by auto + then have "vf holomorphic_on ball z d1-{z}" + apply (rule_tac holomorphic_transform[of "\_. 0"]) + by (auto simp add:dist_commute) + then have "vf analytic_on ball z d1 - {z}" + by (simp add: analytic_on_open open_delete) + then show ?thesis using \d1>0\ unfolding isolated_singularity_at_def vf_def by auto + qed + moreover have ?thesis when f_nconst:"\\<^sub>Fw in (at z). f w\0" + proof - + have "\\<^sub>F w in at z. f w \ 0" using non_zero_neighbour[OF f_iso f_ness f_nconst] . + then obtain d1 where d1:"d1>0" "\x. x \ z \ dist x z < d1 \ f x \ 0" + unfolding eventually_at by auto + obtain d2 where "d2>0" and d2:"f analytic_on ball z d2 - {z}" + using f_iso unfolding isolated_singularity_at_def by auto + define d3 where "d3=min d1 d2" + have "d3>0" unfolding d3_def using \d1>0\ \d2>0\ by auto + moreover have "vf analytic_on ball z d3 - {z}" + unfolding vf_def + apply (rule analytic_on_inverse) + subgoal using d2 unfolding d3_def by (elim analytic_on_subset) auto + subgoal for w using d1 unfolding d3_def by (auto simp add:dist_commute) + done + ultimately show ?thesis unfolding isolated_singularity_at_def vf_def by auto + qed + ultimately show ?thesis by auto +qed + +lemma not_essential_divide[singularity_intros]: + assumes f_ness:"not_essential f z" and g_ness:"not_essential g z" + assumes f_iso:"isolated_singularity_at f z" and g_iso:"isolated_singularity_at g z" + shows "not_essential (\w. f w / g w) z" +proof - + have "not_essential (\w. f w * inverse (g w)) z" + apply (rule not_essential_times[where g="\w. inverse (g w)"]) + using assms by (auto intro: isolated_singularity_at_inverse not_essential_inverse) + then show ?thesis by (simp add:field_simps) +qed + +lemma + assumes f_iso:"isolated_singularity_at f z" + and g_iso:"isolated_singularity_at g z" + shows isolated_singularity_at_times[singularity_intros]: + "isolated_singularity_at (\w. f w * g w) z" and + isolated_singularity_at_add[singularity_intros]: + "isolated_singularity_at (\w. f w + g w) z" +proof - + obtain d1 d2 where "d1>0" "d2>0" + and d1:"f analytic_on ball z d1 - {z}" and d2:"g analytic_on ball z d2 - {z}" + using f_iso g_iso unfolding isolated_singularity_at_def by auto + define d3 where "d3=min d1 d2" + have "d3>0" unfolding d3_def using \d1>0\ \d2>0\ by auto + + have "(\w. f w * g w) analytic_on ball z d3 - {z}" + apply (rule analytic_on_mult) + using d1 d2 unfolding d3_def by (auto elim:analytic_on_subset) + then show "isolated_singularity_at (\w. f w * g w) z" + using \d3>0\ unfolding isolated_singularity_at_def by auto + have "(\w. f w + g w) analytic_on ball z d3 - {z}" + apply (rule analytic_on_add) + using d1 d2 unfolding d3_def by (auto elim:analytic_on_subset) + then show "isolated_singularity_at (\w. f w + g w) z" + using \d3>0\ unfolding isolated_singularity_at_def by auto +qed + +lemma isolated_singularity_at_uminus[singularity_intros]: + assumes f_iso:"isolated_singularity_at f z" + shows "isolated_singularity_at (\w. - f w) z" + using assms unfolding isolated_singularity_at_def using analytic_on_neg by blast + +lemma isolated_singularity_at_id[singularity_intros]: + "isolated_singularity_at (\w. w) z" + unfolding isolated_singularity_at_def by (simp add: gt_ex) + +lemma isolated_singularity_at_minus[singularity_intros]: + assumes f_iso:"isolated_singularity_at f z" + and g_iso:"isolated_singularity_at g z" + shows "isolated_singularity_at (\w. f w - g w) z" + using isolated_singularity_at_uminus[THEN isolated_singularity_at_add[OF f_iso,of "\w. - g w"] + ,OF g_iso] by simp + +lemma isolated_singularity_at_divide[singularity_intros]: + assumes f_iso:"isolated_singularity_at f z" + and g_iso:"isolated_singularity_at g z" + and g_ness:"not_essential g z" + shows "isolated_singularity_at (\w. f w / g w) z" + using isolated_singularity_at_inverse[THEN isolated_singularity_at_times[OF f_iso, + of "\w. inverse (g w)"],OF g_iso g_ness] by (simp add:field_simps) + +lemma isolated_singularity_at_const[singularity_intros]: + "isolated_singularity_at (\w. c) z" + unfolding isolated_singularity_at_def by (simp add: gt_ex) + +lemma isolated_singularity_at_holomorphic: + assumes "f holomorphic_on s-{z}" "open s" "z\s" + shows "isolated_singularity_at f z" + using assms unfolding isolated_singularity_at_def + by (metis analytic_on_holomorphic centre_in_ball insert_Diff openE open_delete subset_insert_iff) + +subsubsection \The order of non-essential singularities (i.e. removable singularities or poles)\ + +definition zorder :: "(complex \ complex) \ complex \ int" where + "zorder f z = (THE n. (\h r. r>0 \ h holomorphic_on cball z r \ h z\0 + \ (\w\cball z r - {z}. f w = h w * (w-z) powr (of_int n) \ h w \0)))" + +definition zor_poly::"[complex \ complex,complex]\complex \ complex" where + "zor_poly f z = (SOME h. \r . r>0 \ h holomorphic_on cball z r \ h z\0 + \ (\w\cball z r-{z}. f w = h w * (w-z) powr (zorder f z) \ h w \0))" + +lemma zorder_exist: + fixes f::"complex \ complex" and z::complex + defines "n\zorder f z" and "g\zor_poly f z" + assumes f_iso:"isolated_singularity_at f z" + and f_ness:"not_essential f z" + and f_nconst:"\\<^sub>Fw in (at z). f w\0" + shows "g z\0 \ (\r. r>0 \ g holomorphic_on cball z r + \ (\w\cball z r - {z}. f w = g w * (w-z) powr n \ g w \0))" +proof - + define P where "P = (\n g r. 0 < r \ g holomorphic_on cball z r \ g z\0 + \ (\w\cball z r - {z}. f w = g w * (w-z) powr (of_int n) \ g w\0))" + have "\!n. \g r. P n g r" + using holomorphic_factor_puncture[OF assms(3-)] unfolding P_def by auto + then have "\g r. P n g r" + unfolding n_def P_def zorder_def + by (drule_tac theI',argo) + then have "\r. P n g r" + unfolding P_def zor_poly_def g_def n_def + by (drule_tac someI_ex,argo) + then obtain r1 where "P n g r1" by auto + then show ?thesis unfolding P_def by auto +qed + +lemma + fixes f::"complex \ complex" and z::complex + assumes f_iso:"isolated_singularity_at f z" + and f_ness:"not_essential f z" + and f_nconst:"\\<^sub>Fw in (at z). f w\0" + shows zorder_inverse: "zorder (\w. inverse (f w)) z = - zorder f z" + and zor_poly_inverse: "\\<^sub>Fw in (at z). zor_poly (\w. inverse (f w)) z w + = inverse (zor_poly f z w)" proof - - from zorder_exist [OF assms] obtain r where r: "r > 0" - and "\w\cball z r. f w = zer_poly f z w * (w - z) ^ zorder f z" by blast - hence *: "\w\ball z r - {z}. zer_poly f z w = f w / (w - z) ^ zorder f z" + define vf where "vf = (\w. inverse (f w))" + define fn vfn where + "fn = zorder f z" and "vfn = zorder vf z" + define fp vfp where + "fp = zor_poly f z" and "vfp = zor_poly vf z" + + obtain fr where [simp]:"fp z \ 0" and "fr > 0" + and fr: "fp holomorphic_on cball z fr" + "\w\cball z fr - {z}. f w = fp w * (w - z) powr of_int fn \ fp w \ 0" + using zorder_exist[OF f_iso f_ness f_nconst,folded fn_def fp_def] + by auto + have fr_inverse: "vf w = (inverse (fp w)) * (w - z) powr (of_int (-fn))" + and fr_nz: "inverse (fp w)\0" + when "w\ball z fr - {z}" for w + proof - + have "f w = fp w * (w - z) powr of_int fn" "fp w\0" + using fr(2)[rule_format,of w] that by auto + then show "vf w = (inverse (fp w)) * (w - z) powr (of_int (-fn))" "inverse (fp w)\0" + unfolding vf_def by (auto simp add:powr_minus) + qed + obtain vfr where [simp]:"vfp z \ 0" and "vfr>0" and vfr:"vfp holomorphic_on cball z vfr" + "(\w\cball z vfr - {z}. vf w = vfp w * (w - z) powr of_int vfn \ vfp w \ 0)" + proof - + have "isolated_singularity_at vf z" + using isolated_singularity_at_inverse[OF f_iso f_ness] unfolding vf_def . + moreover have "not_essential vf z" + using not_essential_inverse[OF f_ness f_iso] unfolding vf_def . + moreover have "\\<^sub>F w in at z. vf w \ 0" + using f_nconst unfolding vf_def by (auto elim:frequently_elim1) + ultimately show ?thesis using zorder_exist[of vf z, folded vfn_def vfp_def] that by auto + qed + + + define r1 where "r1 = min fr vfr" + have "r1>0" using \fr>0\ \vfr>0\ unfolding r1_def by simp + show "vfn = - fn" + apply (rule holomorphic_factor_unique[of r1 vfp z "\w. inverse (fp w)" vf]) + subgoal using \r1>0\ by simp + subgoal by simp + subgoal by simp + subgoal + proof (rule ballI) + fix w assume "w \ ball z r1 - {z}" + then have "w \ ball z fr - {z}" "w \ cball z vfr - {z}" unfolding r1_def by auto + from fr_inverse[OF this(1)] fr_nz[OF this(1)] vfr(2)[rule_format,OF this(2)] + show "vf w = vfp w * (w - z) powr of_int vfn \ vfp w \ 0 + \ vf w = inverse (fp w) * (w - z) powr of_int (- fn) \ inverse (fp w) \ 0" by auto + qed + subgoal using vfr(1) unfolding r1_def by (auto intro!:holomorphic_intros) + subgoal using fr unfolding r1_def by (auto intro!:holomorphic_intros) + done + + have "vfp w = inverse (fp w)" when "w\ball z r1-{z}" for w + proof - + have "w \ ball z fr - {z}" "w \ cball z vfr - {z}" "w\z" using that unfolding r1_def by auto + from fr_inverse[OF this(1)] fr_nz[OF this(1)] vfr(2)[rule_format,OF this(2)] \vfn = - fn\ \w\z\ + show ?thesis by auto + qed + then show "\\<^sub>Fw in (at z). vfp w = inverse (fp w)" + unfolding eventually_at using \r1>0\ + apply (rule_tac x=r1 in exI) + by (auto simp add:dist_commute) +qed + + +lemma + fixes f g::"complex \ complex" and z::complex + assumes f_iso:"isolated_singularity_at f z" and g_iso:"isolated_singularity_at g z" + and f_ness:"not_essential f z" and g_ness:"not_essential g z" + and fg_nconst: "\\<^sub>Fw in (at z). f w * g w\ 0" + shows zorder_times:"zorder (\w. f w * g w) z = zorder f z + zorder g z" and + zor_poly_times:"\\<^sub>Fw in (at z). zor_poly (\w. f w * g w) z w + = zor_poly f z w *zor_poly g z w" +proof - + define fg where "fg = (\w. f w * g w)" + define fn gn fgn where + "fn = zorder f z" and "gn = zorder g z" and "fgn = zorder fg z" + define fp gp fgp where + "fp = zor_poly f z" and "gp = zor_poly g z" and "fgp = zor_poly fg z" + have f_nconst:"\\<^sub>Fw in (at z). f w \ 0" and g_nconst:"\\<^sub>Fw in (at z).g w\ 0" + using fg_nconst by (auto elim!:frequently_elim1) + obtain fr where [simp]:"fp z \ 0" and "fr > 0" + and fr: "fp holomorphic_on cball z fr" + "\w\cball z fr - {z}. f w = fp w * (w - z) powr of_int fn \ fp w \ 0" + using zorder_exist[OF f_iso f_ness f_nconst,folded fp_def fn_def] by auto + obtain gr where [simp]:"gp z \ 0" and "gr > 0" + and gr: "gp holomorphic_on cball z gr" + "\w\cball z gr - {z}. g w = gp w * (w - z) powr of_int gn \ gp w \ 0" + using zorder_exist[OF g_iso g_ness g_nconst,folded gn_def gp_def] by auto + define r1 where "r1=min fr gr" + have "r1>0" unfolding r1_def using \fr>0\ \gr>0\ by auto + have fg_times:"fg w = (fp w * gp w) * (w - z) powr (of_int (fn+gn))" and fgp_nz:"fp w*gp w\0" + when "w\ball z r1 - {z}" for w + proof - + have "f w = fp w * (w - z) powr of_int fn" "fp w\0" + using fr(2)[rule_format,of w] that unfolding r1_def by auto + moreover have "g w = gp w * (w - z) powr of_int gn" "gp w \ 0" + using gr(2)[rule_format, of w] that unfolding r1_def by auto + ultimately show "fg w = (fp w * gp w) * (w - z) powr (of_int (fn+gn))" "fp w*gp w\0" + unfolding fg_def by (auto simp add:powr_add) + qed + + obtain fgr where [simp]:"fgp z \ 0" and "fgr > 0" + and fgr: "fgp holomorphic_on cball z fgr" + "\w\cball z fgr - {z}. fg w = fgp w * (w - z) powr of_int fgn \ fgp w \ 0" + proof - + have "fgp z \ 0 \ (\r>0. fgp holomorphic_on cball z r + \ (\w\cball z r - {z}. fg w = fgp w * (w - z) powr of_int fgn \ fgp w \ 0))" + apply (rule zorder_exist[of fg z, folded fgn_def fgp_def]) + subgoal unfolding fg_def using isolated_singularity_at_times[OF f_iso g_iso] . + subgoal unfolding fg_def using not_essential_times[OF f_ness g_ness f_iso g_iso] . + subgoal unfolding fg_def using fg_nconst . + done + then show ?thesis using that by blast + qed + define r2 where "r2 = min fgr r1" + have "r2>0" using \r1>0\ \fgr>0\ unfolding r2_def by simp + show "fgn = fn + gn " + apply (rule holomorphic_factor_unique[of r2 fgp z "\w. fp w * gp w" fg]) + subgoal using \r2>0\ by simp + subgoal by simp + subgoal by simp + subgoal + proof (rule ballI) + fix w assume "w \ ball z r2 - {z}" + then have "w \ ball z r1 - {z}" "w \ cball z fgr - {z}" unfolding r2_def by auto + from fg_times[OF this(1)] fgp_nz[OF this(1)] fgr(2)[rule_format,OF this(2)] + show "fg w = fgp w * (w - z) powr of_int fgn \ fgp w \ 0 + \ fg w = fp w * gp w * (w - z) powr of_int (fn + gn) \ fp w * gp w \ 0" by auto + qed + subgoal using fgr(1) unfolding r2_def r1_def by (auto intro!:holomorphic_intros) + subgoal using fr(1) gr(1) unfolding r2_def r1_def by (auto intro!:holomorphic_intros) + done + + have "fgp w = fp w *gp w" when "w\ball z r2-{z}" for w + proof - + have "w \ ball z r1 - {z}" "w \ cball z fgr - {z}" "w\z" using that unfolding r2_def by auto + from fg_times[OF this(1)] fgp_nz[OF this(1)] fgr(2)[rule_format,OF this(2)] \fgn = fn + gn\ \w\z\ + show ?thesis by auto + qed + then show "\\<^sub>Fw in (at z). fgp w = fp w * gp w" + using \r2>0\ unfolding eventually_at by (auto simp add:dist_commute) +qed + +lemma + fixes f g::"complex \ complex" and z::complex + assumes f_iso:"isolated_singularity_at f z" and g_iso:"isolated_singularity_at g z" + and f_ness:"not_essential f z" and g_ness:"not_essential g z" + and fg_nconst: "\\<^sub>Fw in (at z). f w * g w\ 0" + shows zorder_divide:"zorder (\w. f w / g w) z = zorder f z - zorder g z" and + zor_poly_divide:"\\<^sub>Fw in (at z). zor_poly (\w. f w / g w) z w + = zor_poly f z w / zor_poly g z w" +proof - + have f_nconst:"\\<^sub>Fw in (at z). f w \ 0" and g_nconst:"\\<^sub>Fw in (at z).g w\ 0" + using fg_nconst by (auto elim!:frequently_elim1) + define vg where "vg=(\w. inverse (g w))" + have "zorder (\w. f w * vg w) z = zorder f z + zorder vg z" + apply (rule zorder_times[OF f_iso _ f_ness,of vg]) + subgoal unfolding vg_def using isolated_singularity_at_inverse[OF g_iso g_ness] . + subgoal unfolding vg_def using not_essential_inverse[OF g_ness g_iso] . + subgoal unfolding vg_def using fg_nconst by (auto elim!:frequently_elim1) + done + then show "zorder (\w. f w / g w) z = zorder f z - zorder g z" + using zorder_inverse[OF g_iso g_ness g_nconst,folded vg_def] unfolding vg_def + by (auto simp add:field_simps) + + have "\\<^sub>F w in at z. zor_poly (\w. f w * vg w) z w = zor_poly f z w * zor_poly vg z w" + apply (rule zor_poly_times[OF f_iso _ f_ness,of vg]) + subgoal unfolding vg_def using isolated_singularity_at_inverse[OF g_iso g_ness] . + subgoal unfolding vg_def using not_essential_inverse[OF g_ness g_iso] . + subgoal unfolding vg_def using fg_nconst by (auto elim!:frequently_elim1) + done + then show "\\<^sub>Fw in (at z). zor_poly (\w. f w / g w) z w = zor_poly f z w / zor_poly g z w" + using zor_poly_inverse[OF g_iso g_ness g_nconst,folded vg_def] unfolding vg_def + apply eventually_elim + by (auto simp add:field_simps) +qed + +lemma zorder_exist_zero: + fixes f::"complex \ complex" and z::complex + defines "n\zorder f z" and "g\zor_poly f z" + assumes holo: "f holomorphic_on s" and + "open s" "connected s" "z\s" + and non_const: "\w\s. f w \ 0" + shows "(if f z=0 then n > 0 else n=0) \ (\r. r>0 \ cball z r \ s \ g holomorphic_on cball z r + \ (\w\cball z r. f w = g w * (w-z) ^ nat n \ g w \0))" +proof - + obtain r where "g z \ 0" and r: "r>0" "cball z r \ s" "g holomorphic_on cball z r" + "(\w\cball z r - {z}. f w = g w * (w - z) powr of_int n \ g w \ 0)" + proof - + have "g z \ 0 \ (\r>0. g holomorphic_on cball z r + \ (\w\cball z r - {z}. f w = g w * (w - z) powr of_int n \ g w \ 0))" + proof (rule zorder_exist[of f z,folded g_def n_def]) + show "isolated_singularity_at f z" unfolding isolated_singularity_at_def + using holo assms(4,6) + by (meson Diff_subset open_ball analytic_on_holomorphic holomorphic_on_subset openE) + show "not_essential f z" unfolding not_essential_def + using assms(4,6) at_within_open continuous_on holo holomorphic_on_imp_continuous_on + by fastforce + have "\\<^sub>F w in at z. f w \ 0 \ w\s" + proof - + obtain w where "w\s" "f w\0" using non_const by auto + then show ?thesis + by (rule non_zero_neighbour_alt[OF holo \open s\ \connected s\ \z\s\]) + qed + then show "\\<^sub>F w in at z. f w \ 0" + apply (elim eventually_frequentlyE) + by auto + qed + then obtain r1 where "g z \ 0" "r1>0" and r1:"g holomorphic_on cball z r1" + "(\w\cball z r1 - {z}. f w = g w * (w - z) powr of_int n \ g w \ 0)" + by auto + obtain r2 where r2: "r2>0" "cball z r2 \ s" + using assms(4,6) open_contains_cball_eq by blast + define r3 where "r3=min r1 r2" + have "r3>0" "cball z r3 \ s" using \r1>0\ r2 unfolding r3_def by auto + moreover have "g holomorphic_on cball z r3" + using r1(1) unfolding r3_def by auto + moreover have "(\w\cball z r3 - {z}. f w = g w * (w - z) powr of_int n \ g w \ 0)" + using r1(2) unfolding r3_def by auto + ultimately show ?thesis using that[of r3] \g z\0\ by auto + qed + + have if_0:"if f z=0 then n > 0 else n=0" + proof - + have "f\ z \ f z" + by (metis assms(4,6,7) at_within_open continuous_on holo holomorphic_on_imp_continuous_on) + then have "(\w. g w * (w - z) powr of_int n) \z\ f z" + apply (elim Lim_transform_within_open[where s="ball z r"]) + using r by auto + moreover have "g \z\g z" + by (metis (mono_tags, lifting) Topology_Euclidean_Space.open_ball at_within_open_subset + ball_subset_cball centre_in_ball continuous_on holomorphic_on_imp_continuous_on r(1,3) subsetCE) + ultimately have "(\w. (g w * (w - z) powr of_int n) / g w) \z\ f z/g z" + apply (rule_tac tendsto_divide) + using \g z\0\ by auto + then have powr_tendsto:"(\w. (w - z) powr of_int n) \z\ f z/g z" + apply (elim Lim_transform_within_open[where s="ball z r"]) + using r by auto + + have ?thesis when "n\0" "f z=0" + proof - + have "(\w. (w - z) ^ nat n) \z\ f z/g z" + using powr_tendsto + apply (elim Lim_transform_within[where d=r]) + by (auto simp add: powr_of_int \n\0\ \r>0\) + then have *:"(\w. (w - z) ^ nat n) \z\ 0" using \f z=0\ by simp + moreover have False when "n=0" + proof - + have "(\w. (w - z) ^ nat n) \z\ 1" + using \n=0\ by auto + then show False using * using LIM_unique zero_neq_one by blast + qed + ultimately show ?thesis using that by fastforce + qed + moreover have ?thesis when "n\0" "f z\0" + proof - + have False when "n>0" + proof - + have "(\w. (w - z) ^ nat n) \z\ f z/g z" + using powr_tendsto + apply (elim Lim_transform_within[where d=r]) + by (auto simp add: powr_of_int \n\0\ \r>0\) + moreover have "(\w. (w - z) ^ nat n) \z\ 0" + using \n>0\ by (auto intro!:tendsto_eq_intros) + ultimately show False using \f z\0\ \g z\0\ using LIM_unique divide_eq_0_iff by blast + qed + then show ?thesis using that by force + qed + moreover have False when "n<0" + proof - + have "(\w. inverse ((w - z) ^ nat (- n))) \z\ f z/g z" + "(\w.((w - z) ^ nat (- n))) \z\ 0" + subgoal using powr_tendsto powr_of_int that + by (elim Lim_transform_within_open[where s=UNIV],auto) + subgoal using that by (auto intro!:tendsto_eq_intros) + done + from tendsto_mult[OF this,simplified] + have "(\x. inverse ((x - z) ^ nat (- n)) * (x - z) ^ nat (- n)) \z\ 0" . + then have "(\x. 1::complex) \z\ 0" + by (elim Lim_transform_within_open[where s=UNIV],auto) + then show False using LIM_const_eq by fastforce + qed + ultimately show ?thesis by fastforce + qed + moreover have "f w = g w * (w-z) ^ nat n \ g w \0" when "w\cball z r" for w + proof (cases "w=z") + case True + then have "f \z\f w" + using assms(4,6) at_within_open continuous_on holo holomorphic_on_imp_continuous_on by fastforce + then have "(\w. g w * (w-z) ^ nat n) \z\f w" + proof (elim Lim_transform_within[OF _ \r>0\]) + fix x assume "0 < dist x z" "dist x z < r" + then have "x \ cball z r - {z}" "x\z" + unfolding cball_def by (auto simp add: dist_commute) + then have "f x = g x * (x - z) powr of_int n" + using r(4)[rule_format,of x] by simp + also have "... = g x * (x - z) ^ nat n" + apply (subst powr_of_int) + using if_0 \x\z\ by (auto split:if_splits) + finally show "f x = g x * (x - z) ^ nat n" . + qed + moreover have "(\w. g w * (w-z) ^ nat n) \z\ g w * (w-z) ^ nat n" + using True apply (auto intro!:tendsto_eq_intros) + by (metis open_ball at_within_open_subset ball_subset_cball centre_in_ball + continuous_on holomorphic_on_imp_continuous_on r(1) r(3) that) + ultimately have "f w = g w * (w-z) ^ nat n" using LIM_unique by blast + then show ?thesis using \g z\0\ True by auto + next + case False + then have "f w = g w * (w - z) powr of_int n \ g w \ 0" + using r(4) that by auto + then show ?thesis using False if_0 powr_of_int by (auto split:if_splits) + qed + ultimately show ?thesis using r by auto +qed + +lemma zorder_exist_pole: + fixes f::"complex \ complex" and z::complex + defines "n\zorder f z" and "g\zor_poly f z" + assumes holo: "f holomorphic_on s-{z}" and + "open s" "z\s" + and "is_pole f z" + shows "n < 0 \ g z\0 \ (\r. r>0 \ cball z r \ s \ g holomorphic_on cball z r + \ (\w\cball z r - {z}. f w = g w / (w-z) ^ nat (- n) \ g w \0))" +proof - + obtain r where "g z \ 0" and r: "r>0" "cball z r \ s" "g holomorphic_on cball z r" + "(\w\cball z r - {z}. f w = g w * (w - z) powr of_int n \ g w \ 0)" + proof - + have "g z \ 0 \ (\r>0. g holomorphic_on cball z r + \ (\w\cball z r - {z}. f w = g w * (w - z) powr of_int n \ g w \ 0))" + proof (rule zorder_exist[of f z,folded g_def n_def]) + show "isolated_singularity_at f z" unfolding isolated_singularity_at_def + using holo assms(4,5) + by (metis analytic_on_holomorphic centre_in_ball insert_Diff openE open_delete subset_insert_iff) + show "not_essential f z" unfolding not_essential_def + using assms(4,6) at_within_open continuous_on holo holomorphic_on_imp_continuous_on + by fastforce + from non_zero_neighbour_pole[OF \is_pole f z\] show "\\<^sub>F w in at z. f w \ 0" + apply (elim eventually_frequentlyE) + by auto + qed + then obtain r1 where "g z \ 0" "r1>0" and r1:"g holomorphic_on cball z r1" + "(\w\cball z r1 - {z}. f w = g w * (w - z) powr of_int n \ g w \ 0)" + by auto + obtain r2 where r2: "r2>0" "cball z r2 \ s" + using assms(4,5) open_contains_cball_eq by metis + define r3 where "r3=min r1 r2" + have "r3>0" "cball z r3 \ s" using \r1>0\ r2 unfolding r3_def by auto + moreover have "g holomorphic_on cball z r3" + using r1(1) unfolding r3_def by auto + moreover have "(\w\cball z r3 - {z}. f w = g w * (w - z) powr of_int n \ g w \ 0)" + using r1(2) unfolding r3_def by auto + ultimately show ?thesis using that[of r3] \g z\0\ by auto + qed + + have "n<0" + proof (rule ccontr) + assume " \ n < 0" + define c where "c=(if n=0 then g z else 0)" + have [simp]:"g \z\ g z" + by (metis Topology_Euclidean_Space.open_ball at_within_open ball_subset_cball centre_in_ball + continuous_on holomorphic_on_imp_continuous_on holomorphic_on_subset r(1) r(3) ) + have "\\<^sub>F x in at z. f x = g x * (x - z) ^ nat n" + unfolding eventually_at_topological + apply (rule_tac exI[where x="ball z r"]) + using r powr_of_int \\ n < 0\ by auto + moreover have "(\x. g x * (x - z) ^ nat n) \z\c" + proof (cases "n=0") + case True + then show ?thesis unfolding c_def by simp + next + case False + then have "(\x. (x - z) ^ nat n) \z\ 0" using \\ n < 0\ + by (auto intro!:tendsto_eq_intros) + from tendsto_mult[OF _ this,of g "g z",simplified] + show ?thesis unfolding c_def using False by simp + qed + ultimately have "f \z\c" using tendsto_cong by fast + then show False using \is_pole f z\ at_neq_bot not_tendsto_and_filterlim_at_infinity + unfolding is_pole_def by blast + qed + moreover have "\w\cball z r - {z}. f w = g w / (w-z) ^ nat (- n) \ g w \0" + using r(4) \n<0\ powr_of_int + by (metis Diff_iff divide_inverse eq_iff_diff_eq_0 insert_iff linorder_not_le) + ultimately show ?thesis using r(1-3) \g z\0\ by auto +qed + +lemma zorder_eqI: + assumes "open s" "z \ s" "g holomorphic_on s" "g z \ 0" + assumes fg_eq:"\w. \w \ s;w\z\ \ f w = g w * (w - z) powr n" + shows "zorder f z = n" +proof - + have "continuous_on s g" by (rule holomorphic_on_imp_continuous_on) fact + moreover have "open (-{0::complex})" by auto + ultimately have "open ((g -` (-{0})) \ s)" + unfolding continuous_on_open_vimage[OF \open s\] by blast + moreover from assms have "z \ (g -` (-{0})) \ s" by auto + ultimately obtain r where r: "r > 0" "cball z r \ s \ (g -` (-{0}))" + unfolding open_contains_cball by blast + + let ?gg= "(\w. g w * (w - z) powr n)" + define P where "P = (\n g r. 0 < r \ g holomorphic_on cball z r \ g z\0 + \ (\w\cball z r - {z}. f w = g w * (w-z) powr (of_int n) \ g w\0))" + have "P n g r" + unfolding P_def using r assms(3,4,5) by auto + then have "\g r. P n g r" by auto + moreover have unique: "\!n. \g r. P n g r" unfolding P_def + proof (rule holomorphic_factor_puncture) + have "ball z r-{z} \ s" using r using ball_subset_cball by blast + then have "?gg holomorphic_on ball z r-{z}" + using \g holomorphic_on s\ r by (auto intro!: holomorphic_intros) + then have "f holomorphic_on ball z r - {z}" + apply (elim holomorphic_transform) + using fg_eq \ball z r-{z} \ s\ by auto + then show "isolated_singularity_at f z" unfolding isolated_singularity_at_def + using analytic_on_open open_delete r(1) by blast + next + have "not_essential ?gg z" + proof (intro singularity_intros) + show "not_essential g z" + by (meson \continuous_on s g\ assms(1) assms(2) continuous_on_eq_continuous_at + isCont_def not_essential_def) + show " \\<^sub>F w in at z. w - z \ 0" by (simp add: eventually_at_filter) + then show "LIM w at z. w - z :> at 0" + unfolding filterlim_at by (auto intro:tendsto_eq_intros) + show "isolated_singularity_at g z" + by (meson Diff_subset Topology_Euclidean_Space.open_ball analytic_on_holomorphic + assms(1,2,3) holomorphic_on_subset isolated_singularity_at_def openE) + qed + then show "not_essential f z" + apply (elim not_essential_transform) + unfolding eventually_at using assms(1,2) assms(5)[symmetric] + by (metis dist_commute mem_ball openE subsetCE) + show "\\<^sub>F w in at z. f w \ 0" unfolding frequently_at + proof (rule,rule) + fix d::real assume "0 < d" + define z' where "z'=z+min d r / 2" + have "z' \ z" " dist z' z < d " + unfolding z'_def using \d>0\ \r>0\ + by (auto simp add:dist_norm) + moreover have "f z' \ 0" + proof (subst fg_eq[OF _ \z'\z\]) + have "z' \ cball z r" unfolding z'_def using \r>0\ \d>0\ by (auto simp add:dist_norm) + then show " z' \ s" using r(2) by blast + show "g z' * (z' - z) powr of_int n \ 0" + using P_def \P n g r\ \z' \ cball z r\ calculation(1) by auto + qed + ultimately show "\x\UNIV. x \ z \ dist x z < d \ f x \ 0" by auto + qed + qed + ultimately have "(THE n. \g r. P n g r) = n" + by (rule_tac the1_equality) + then show ?thesis unfolding zorder_def P_def by blast +qed + +lemma residue_pole_order: + fixes f::"complex \ complex" and z::complex + defines "n \ nat (- zorder f z)" and "h \ zor_poly f z" + assumes f_iso:"isolated_singularity_at f z" + and pole:"is_pole f z" + shows "residue f z = ((deriv ^^ (n - 1)) h z / fact (n-1))" +proof - + define g where "g \ \x. if x=z then 0 else inverse (f x)" + obtain e where [simp]:"e>0" and f_holo:"f holomorphic_on ball z e - {z}" + using f_iso analytic_imp_holomorphic unfolding isolated_singularity_at_def by blast + obtain r where "0 < n" "0 < r" and r_cball:"cball z r \ ball z e" and h_holo: "h holomorphic_on cball z r" + and h_divide:"(\w\cball z r. (w\z \ f w = h w / (w - z) ^ n) \ h w \ 0)" + proof - + obtain r where r:"zorder f z < 0" "h z \ 0" "r>0" "cball z r \ ball z e" "h holomorphic_on cball z r" + "(\w\cball z r - {z}. f w = h w / (w - z) ^ n \ h w \ 0)" + using zorder_exist_pole[OF f_holo,simplified,OF \is_pole f z\,folded n_def h_def] by auto + have "n>0" using \zorder f z < 0\ unfolding n_def by simp + moreover have "(\w\cball z r. (w\z \ f w = h w / (w - z) ^ n) \ h w \ 0)" + using \h z\0\ r(6) by blast + ultimately show ?thesis using r(3,4,5) that by blast + qed + have r_nonzero:"\w. w \ ball z r - {z} \ f w \ 0" + using h_divide by simp + define c where "c \ 2 * pi * \" + define der_f where "der_f \ ((deriv ^^ (n - 1)) h z / fact (n-1))" + define h' where "h' \ \u. h u / (u - z) ^ n" + have "(h' has_contour_integral c / fact (n - 1) * (deriv ^^ (n - 1)) h z) (circlepath z r)" + unfolding h'_def + proof (rule Cauchy_has_contour_integral_higher_derivative_circlepath[of z r h z "n-1", + folded c_def Suc_pred'[OF \n>0\]]) + show "continuous_on (cball z r) h" using holomorphic_on_imp_continuous_on h_holo by simp + show "h holomorphic_on ball z r" using h_holo by auto + show " z \ ball z r" using \r>0\ by auto + qed + then have "(h' has_contour_integral c * der_f) (circlepath z r)" unfolding der_f_def by auto + then have "(f has_contour_integral c * der_f) (circlepath z r)" + proof (elim has_contour_integral_eq) + fix x assume "x \ path_image (circlepath z r)" + hence "x\cball z r - {z}" using \r>0\ by auto + then show "h' x = f x" using h_divide unfolding h'_def by auto + qed + moreover have "(f has_contour_integral c * residue f z) (circlepath z r)" + using base_residue[of \ball z e\ z,simplified,OF \r>0\ f_holo r_cball,folded c_def] + unfolding c_def by simp + ultimately have "c * der_f = c * residue f z" using has_contour_integral_unique by blast + hence "der_f = residue f z" unfolding c_def by auto + thus ?thesis unfolding der_f_def by auto +qed + +lemma simple_zeroI: + assumes "open s" "z \ s" "g holomorphic_on s" "g z \ 0" + assumes "\w. w \ s \ f w = g w * (w - z)" + shows "zorder f z = 1" + using assms(1-4) by (rule zorder_eqI) (use assms(5) in auto) + +lemma higher_deriv_power: + shows "(deriv ^^ j) (\w. (w - z) ^ n) w = + pochhammer (of_nat (Suc n - j)) j * (w - z) ^ (n - j)" +proof (induction j arbitrary: w) + case 0 + thus ?case by auto +next + case (Suc j w) + have "(deriv ^^ Suc j) (\w. (w - z) ^ n) w = deriv ((deriv ^^ j) (\w. (w - z) ^ n)) w" + by simp + also have "(deriv ^^ j) (\w. (w - z) ^ n) = + (\w. pochhammer (of_nat (Suc n - j)) j * (w - z) ^ (n - j))" + using Suc by (intro Suc.IH ext) + also { + have "(\ has_field_derivative of_nat (n - j) * + pochhammer (of_nat (Suc n - j)) j * (w - z) ^ (n - Suc j)) (at w)" + using Suc.prems by (auto intro!: derivative_eq_intros) + also have "of_nat (n - j) * pochhammer (of_nat (Suc n - j)) j = + pochhammer (of_nat (Suc n - Suc j)) (Suc j)" + by (cases "Suc j \ n", subst pochhammer_rec) + (insert Suc.prems, simp_all add: algebra_simps Suc_diff_le pochhammer_0_left) + finally have "deriv (\w. pochhammer (of_nat (Suc n - j)) j * (w - z) ^ (n - j)) w = + \ * (w - z) ^ (n - Suc j)" + by (rule DERIV_imp_deriv) + } + finally show ?case . +qed + +lemma zorder_zero_eqI: + assumes f_holo:"f holomorphic_on s" and "open s" "z \ s" + assumes zero: "\i. i < nat n \ (deriv ^^ i) f z = 0" + assumes nz: "(deriv ^^ nat n) f z \ 0" and "n\0" + shows "zorder f z = n" +proof - + obtain r where [simp]:"r>0" and "ball z r \ s" + using \open s\ \z\s\ openE by blast + have nz':"\w\ball z r. f w \ 0" + proof (rule ccontr) + assume "\ (\w\ball z r. f w \ 0)" + then have "eventually (\u. f u = 0) (nhds z)" + using \r>0\ unfolding eventually_nhds + apply (rule_tac x="ball z r" in exI) + by auto + then have "(deriv ^^ nat n) f z = (deriv ^^ nat n) (\_. 0) z" + by (intro higher_deriv_cong_ev) auto + also have "(deriv ^^ nat n) (\_. 0) z = 0" + by (induction n) simp_all + finally show False using nz by contradiction + qed + + define zn g where "zn = zorder f z" and "g = zor_poly f z" + obtain e where e_if:"if f z = 0 then 0 < zn else zn = 0" and + [simp]:"e>0" and "cball z e \ ball z r" and + g_holo:"g holomorphic_on cball z e" and + e_fac:"(\w\cball z e. f w = g w * (w - z) ^ nat zn \ g w \ 0)" + proof - + have "f holomorphic_on ball z r" + using f_holo \ball z r \ s\ by auto + from that zorder_exist_zero[of f "ball z r" z,simplified,OF this nz',folded zn_def g_def] + show ?thesis by blast + qed + from this(1,2,5) have "zn\0" "g z\0" + subgoal by (auto split:if_splits) + subgoal using \0 < e\ ball_subset_cball centre_in_ball e_fac by blast + done + + define A where "A = (\i. of_nat (i choose (nat zn)) * fact (nat zn) * (deriv ^^ (i - nat zn)) g z)" + have deriv_A:"(deriv ^^ i) f z = (if zn \ int i then A i else 0)" for i + proof - + have "eventually (\w. w \ ball z e) (nhds z)" + using \cball z e \ ball z r\ \e>0\ by (intro eventually_nhds_in_open) auto + hence "eventually (\w. f w = (w - z) ^ (nat zn) * g w) (nhds z)" + apply eventually_elim + by (use e_fac in auto) + hence "(deriv ^^ i) f z = (deriv ^^ i) (\w. (w - z) ^ nat zn * g w) z" + by (intro higher_deriv_cong_ev) auto + also have "\ = (\j=0..i. of_nat (i choose j) * + (deriv ^^ j) (\w. (w - z) ^ nat zn) z * (deriv ^^ (i - j)) g z)" + using g_holo \e>0\ + by (intro higher_deriv_mult[of _ "ball z e"]) (auto intro!: holomorphic_intros) + also have "\ = (\j=0..i. if j = nat zn then + of_nat (i choose nat zn) * fact (nat zn) * (deriv ^^ (i - nat zn)) g z else 0)" + proof (intro sum.cong refl, goal_cases) + case (1 j) + have "(deriv ^^ j) (\w. (w - z) ^ nat zn) z = + pochhammer (of_nat (Suc (nat zn) - j)) j * 0 ^ (nat zn - j)" + by (subst higher_deriv_power) auto + also have "\ = (if j = nat zn then fact j else 0)" + by (auto simp: not_less pochhammer_0_left pochhammer_fact) + also have "of_nat (i choose j) * \ * (deriv ^^ (i - j)) g z = + (if j = nat zn then of_nat (i choose (nat zn)) * fact (nat zn) + * (deriv ^^ (i - nat zn)) g z else 0)" + by simp + finally show ?case . + qed + also have "\ = (if i \ zn then A i else 0)" + by (auto simp: A_def) + finally show "(deriv ^^ i) f z = \" . + qed + + have False when "nn\0\ by auto + with nz show False by auto + qed + moreover have "n\zn" + proof - + have "g z \ 0" using e_fac[rule_format,of z] \e>0\ by simp + then have "(deriv ^^ nat zn) f z \ 0" + using deriv_A[of "nat zn"] by(auto simp add:A_def) + then have "nat zn \ nat n" using zero[of "nat zn"] by linarith + moreover have "zn\0" using e_if by (auto split:if_splits) + ultimately show ?thesis using nat_le_eq_zle by blast + qed + ultimately show ?thesis unfolding zn_def by fastforce +qed + +lemma + assumes "eventually (\z. f z = g z) (at z)" "z = z'" + shows zorder_cong:"zorder f z = zorder g z'" and zor_poly_cong:"zor_poly f z = zor_poly g z'" +proof - + define P where "P = (\ff n h r. 0 < r \ h holomorphic_on cball z r \ h z\0 + \ (\w\cball z r - {z}. ff w = h w * (w-z) powr (of_int n) \ h w\0))" + have "(\r. P f n h r) = (\r. P g n h r)" for n h + proof - + have *: "\r. P g n h r" if "\r. P f n h r" and "eventually (\x. f x = g x) (at z)" for f g + proof - + from that(1) obtain r1 where r1_P:"P f n h r1" by auto + from that(2) obtain r2 where "r2>0" and r2_dist:"\x. x \ z \ dist x z \ r2 \ f x = g x" + unfolding eventually_at_le by auto + define r where "r=min r1 r2" + have "r>0" "h z\0" using r1_P \r2>0\ unfolding r_def P_def by auto + moreover have "h holomorphic_on cball z r" + using r1_P unfolding P_def r_def by auto + moreover have "g w = h w * (w - z) powr of_int n \ h w \ 0" when "w\cball z r - {z}" for w + proof - + have "f w = h w * (w - z) powr of_int n \ h w \ 0" + using r1_P that unfolding P_def r_def by auto + moreover have "f w=g w" using r2_dist[rule_format,of w] that unfolding r_def + by (simp add: dist_commute) + ultimately show ?thesis by simp + qed + ultimately show ?thesis unfolding P_def by auto + qed + from assms have eq': "eventually (\z. g z = f z) (at z)" + by (simp add: eq_commute) + show ?thesis + by (rule iffI[OF *[OF _ assms(1)] *[OF _ eq']]) + qed + then show "zorder f z = zorder g z'" "zor_poly f z = zor_poly g z'" + using \z=z'\ unfolding P_def zorder_def zor_poly_def by auto +qed + +lemma zorder_nonzero_div_power: + assumes "open s" "z \ s" "f holomorphic_on s" "f z \ 0" "n > 0" + shows "zorder (\w. f w / (w - z) ^ n) z = - n" + apply (rule zorder_eqI[OF \open s\ \z\s\ \f holomorphic_on s\ \f z\0\]) + apply (subst powr_of_int) + using \n>0\ by (auto simp add:field_simps) + +lemma zor_poly_eq: + assumes "isolated_singularity_at f z" "not_essential f z" "\\<^sub>F w in at z. f w \ 0" + shows "eventually (\w. zor_poly f z w = f w * (w - z) powr - zorder f z) (at z)" +proof - + obtain r where r:"r>0" + "(\w\cball z r - {z}. f w = zor_poly f z w * (w - z) powr of_int (zorder f z))" + using zorder_exist[OF assms] by blast + then have *: "\w\ball z r - {z}. zor_poly f z w = f w * (w - z) powr - zorder f z" + by (auto simp: field_simps powr_minus) + have "eventually (\w. w \ ball z r - {z}) (at z)" + using r eventually_at_ball'[of r z UNIV] by auto + thus ?thesis by eventually_elim (insert *, auto) +qed + +lemma zor_poly_zero_eq: + assumes "f holomorphic_on s" "open s" "connected s" "z \ s" "\w\s. f w \ 0" + shows "eventually (\w. zor_poly f z w = f w / (w - z) ^ nat (zorder f z)) (at z)" +proof - + obtain r where r:"r>0" + "(\w\cball z r - {z}. f w = zor_poly f z w * (w - z) ^ nat (zorder f z))" + using zorder_exist_zero[OF assms] by auto + then have *: "\w\ball z r - {z}. zor_poly f z w = f w / (w - z) ^ nat (zorder f z)" + by (auto simp: field_simps powr_minus) + have "eventually (\w. w \ ball z r - {z}) (at z)" + using r eventually_at_ball'[of r z UNIV] by auto + thus ?thesis by eventually_elim (insert *, auto) +qed + +lemma zor_poly_pole_eq: + assumes f_iso:"isolated_singularity_at f z" "is_pole f z" + shows "eventually (\w. zor_poly f z w = f w * (w - z) ^ nat (- zorder f z)) (at z)" +proof - + obtain e where [simp]:"e>0" and f_holo:"f holomorphic_on ball z e - {z}" + using f_iso analytic_imp_holomorphic unfolding isolated_singularity_at_def by blast + obtain r where r:"r>0" + "(\w\cball z r - {z}. f w = zor_poly f z w / (w - z) ^ nat (- zorder f z))" + using zorder_exist_pole[OF f_holo,simplified,OF \is_pole f z\] by auto + then have *: "\w\ball z r - {z}. zor_poly f z w = f w * (w - z) ^ nat (- zorder f z)" by (auto simp: field_simps) have "eventually (\w. w \ ball z r - {z}) (at z)" using r eventually_at_ball'[of r z UNIV] by auto thus ?thesis by eventually_elim (insert *, auto) qed -lemma pol_poly_eq: - assumes "open s" "z \ s" "f holomorphic_on s - {z}" "is_pole f z" "\w\s. f w \ 0" - shows "eventually (\w. pol_poly f z w = f w * (w - z) ^ porder f z) (at z)" +lemma zor_poly_eqI: + fixes f :: "complex \ complex" and z0 :: complex + defines "n \ zorder f z0" + assumes "isolated_singularity_at f z0" "not_essential f z0" "\\<^sub>F w in at z0. f w \ 0" + assumes lim: "((\x. f (g x) * (g x - z0) powr - n) \ c) F" + assumes g: "filterlim g (at z0) F" and "F \ bot" + shows "zor_poly f z0 z0 = c" +proof - + from zorder_exist[OF assms(2-4)] obtain r where + r: "r > 0" "zor_poly f z0 holomorphic_on cball z0 r" + "\w. w \ cball z0 r - {z0} \ f w = zor_poly f z0 w * (w - z0) powr n" + unfolding n_def by blast + from r(1) have "eventually (\w. w \ ball z0 r \ w \ z0) (at z0)" + using eventually_at_ball'[of r z0 UNIV] by auto + hence "eventually (\w. zor_poly f z0 w = f w * (w - z0) powr - n) (at z0)" + by eventually_elim (insert r, auto simp: field_simps powr_minus) + moreover have "continuous_on (ball z0 r) (zor_poly f z0)" + using r by (intro holomorphic_on_imp_continuous_on) auto + with r(1,2) have "isCont (zor_poly f z0) z0" + by (auto simp: continuous_on_eq_continuous_at) + hence "(zor_poly f z0 \ zor_poly f z0 z0) (at z0)" + unfolding isCont_def . + ultimately have "((\w. f w * (w - z0) powr - n) \ zor_poly f z0 z0) (at z0)" + by (rule Lim_transform_eventually) + hence "((\x. f (g x) * (g x - z0) powr - n) \ zor_poly f z0 z0) F" + by (rule filterlim_compose[OF _ g]) + from tendsto_unique[OF \F \ bot\ this lim] show ?thesis . +qed + +lemma zor_poly_zero_eqI: + fixes f :: "complex \ complex" and z0 :: complex + defines "n \ zorder f z0" + assumes "f holomorphic_on A" "open A" "connected A" "z0 \ A" "\z\A. f z \ 0" + assumes lim: "((\x. f (g x) / (g x - z0) ^ nat n) \ c) F" + assumes g: "filterlim g (at z0) F" and "F \ bot" + shows "zor_poly f z0 z0 = c" proof - - from porder_exist[OF assms(1-4)] obtain r where r: "r > 0" - and "\w\cball z r. w \ z \ f w = pol_poly f z w / (w - z) ^ porder f z" by blast - hence *: "\w\ball z r - {z}. pol_poly f z w = f w * (w - z) ^ porder f z" - by (auto simp: field_simps) - have "eventually (\w. w \ ball z r - {z}) (at z)" - using r eventually_at_ball'[of r z UNIV] by auto - thus ?thesis by eventually_elim (insert *, auto) + from zorder_exist_zero[OF assms(2-6)] obtain r where + r: "r > 0" "cball z0 r \ A" "zor_poly f z0 holomorphic_on cball z0 r" + "\w. w \ cball z0 r \ f w = zor_poly f z0 w * (w - z0) ^ nat n" + unfolding n_def by blast + from r(1) have "eventually (\w. w \ ball z0 r \ w \ z0) (at z0)" + using eventually_at_ball'[of r z0 UNIV] by auto + hence "eventually (\w. zor_poly f z0 w = f w / (w - z0) ^ nat n) (at z0)" + by eventually_elim (insert r, auto simp: field_simps) + moreover have "continuous_on (ball z0 r) (zor_poly f z0)" + using r by (intro holomorphic_on_imp_continuous_on) auto + with r(1,2) have "isCont (zor_poly f z0) z0" + by (auto simp: continuous_on_eq_continuous_at) + hence "(zor_poly f z0 \ zor_poly f z0 z0) (at z0)" + unfolding isCont_def . + ultimately have "((\w. f w / (w - z0) ^ nat n) \ zor_poly f z0 z0) (at z0)" + by (rule Lim_transform_eventually) + hence "((\x. f (g x) / (g x - z0) ^ nat n) \ zor_poly f z0 z0) F" + by (rule filterlim_compose[OF _ g]) + from tendsto_unique[OF \F \ bot\ this lim] show ?thesis . +qed + +lemma zor_poly_pole_eqI: + fixes f :: "complex \ complex" and z0 :: complex + defines "n \ zorder f z0" + assumes f_iso:"isolated_singularity_at f z0" and "is_pole f z0" + assumes lim: "((\x. f (g x) * (g x - z0) ^ nat (-n)) \ c) F" + assumes g: "filterlim g (at z0) F" and "F \ bot" + shows "zor_poly f z0 z0 = c" +proof - + obtain r where r: "r > 0" "zor_poly f z0 holomorphic_on cball z0 r" + proof - + have "\\<^sub>F w in at z0. f w \ 0" + using non_zero_neighbour_pole[OF \is_pole f z0\] by (auto elim:eventually_frequentlyE) + moreover have "not_essential f z0" unfolding not_essential_def using \is_pole f z0\ by simp + ultimately show ?thesis using that zorder_exist[OF f_iso,folded n_def] by auto + qed + from r(1) have "eventually (\w. w \ ball z0 r \ w \ z0) (at z0)" + using eventually_at_ball'[of r z0 UNIV] by auto + have "eventually (\w. zor_poly f z0 w = f w * (w - z0) ^ nat (-n)) (at z0)" + using zor_poly_pole_eq[OF f_iso \is_pole f z0\] unfolding n_def . + moreover have "continuous_on (ball z0 r) (zor_poly f z0)" + using r by (intro holomorphic_on_imp_continuous_on) auto + with r(1,2) have "isCont (zor_poly f z0) z0" + by (auto simp: continuous_on_eq_continuous_at) + hence "(zor_poly f z0 \ zor_poly f z0 z0) (at z0)" + unfolding isCont_def . + ultimately have "((\w. f w * (w - z0) ^ nat (-n)) \ zor_poly f z0 z0) (at z0)" + by (rule Lim_transform_eventually) + hence "((\x. f (g x) * (g x - z0) ^ nat (-n)) \ zor_poly f z0 z0) F" + by (rule filterlim_compose[OF _ g]) + from tendsto_unique[OF \F \ bot\ this lim] show ?thesis . +qed + +lemma residue_simple_pole: + assumes "isolated_singularity_at f z0" + assumes "is_pole f z0" "zorder f z0 = - 1" + shows "residue f z0 = zor_poly f z0 z0" + using assms by (subst residue_pole_order) simp_all + +lemma residue_simple_pole_limit: + assumes "isolated_singularity_at f z0" + assumes "is_pole f z0" "zorder f z0 = - 1" + assumes "((\x. f (g x) * (g x - z0)) \ c) F" + assumes "filterlim g (at z0) F" "F \ bot" + shows "residue f z0 = c" +proof - + have "residue f z0 = zor_poly f z0 z0" + by (rule residue_simple_pole assms)+ + also have "\ = c" + apply (rule zor_poly_pole_eqI) + using assms by auto + finally show ?thesis . qed lemma lhopital_complex_simple: @@ -4126,271 +4583,491 @@ with assms show ?thesis by simp qed -lemma porder_eqI: - assumes "open s" "z \ s" "g holomorphic_on s" "g z \ 0" "n > 0" - assumes "\w. w \ s - {z} \ f w = g w / (w - z) ^ n" - shows "porder f z = n" -proof - - define f' where "f' = (\x. if x = z then 0 else inverse (f x))" - define g' where "g' = (\x. inverse (g x))" - define s' where "s' = (g -` (-{0}) \ s)" - have "continuous_on s g" - by (intro holomorphic_on_imp_continuous_on) fact - hence "open s'" - unfolding s'_def using assms by (subst (asm) continuous_on_open_vimage) blast+ - have s': "z \ s'" "g' holomorphic_on s'" "g' z \ 0" using assms - by (auto simp: s'_def g'_def intro!: holomorphic_intros) - have f'_g': "f' w = g' w * (w - z) ^ n" if "w \ s'" for w - unfolding f'_def g'_def using that \n > 0\ - by (auto simp: assms(6) field_simps s'_def) - have "porder f z = zorder f' z" - by (simp add: porder_def f'_def) - also have "\ = n" using assms f'_g' - by (intro zorder_eqI[OF \open s'\ s']) (auto simp: f'_def g'_def field_simps s'_def) - finally show ?thesis . -qed - -lemma simple_poleI': - assumes "open s" "connected s" "z \ s" - assumes "\w. w \ s - {z} \ - ((\w. inverse (f w)) has_field_derivative f' w) (at w)" - assumes "f holomorphic_on s - {z}" "f' holomorphic_on s" "is_pole f z" "f' z \ 0" - shows "porder f z = 1" -proof - - define g where "g = (\w. if w = z then 0 else inverse (f w))" - from \is_pole f z\ have "eventually (\w. f w \ 0) (at z)" - unfolding is_pole_def using filterlim_at_infinity_imp_eventually_ne by blast - then obtain s'' where s'': "open s''" "z \ s''" "\w\s''-{z}. f w \ 0" - by (auto simp: eventually_at_topological) - from assms(1) and s''(1) have "open (s \ s'')" by auto - then obtain r where r: "r > 0" "ball z r \ s \ s''" - using assms(3) s''(2) by (subst (asm) open_contains_ball) blast - define s' where "s' = ball z r" - hence s': "open s'" "connected s'" "z \ s'" "s' \ s" "\w\s'-{z}. f w \ 0" - using r s'' by (auto simp: s'_def) - have s'_ne: "s' - {z} \ {}" - using r unfolding s'_def by (intro ball_minus_countable_nonempty) auto - - have "porder f z = zorder g z" - by (simp add: porder_def g_def) - also have "\ = 1" - proof (rule simple_zeroI') - fix w assume w: "w \ s'" - have [holomorphic_intros]: "g holomorphic_on s'" unfolding g_def using assms s' - by (intro is_pole_inverse_holomorphic holomorphic_on_subset[OF assms(5)]) auto - hence "(g has_field_derivative deriv g w) (at w)" - using w s' by (intro holomorphic_derivI) - also have deriv_g: "deriv g w = f' w" if "w \ s' - {z}" for w - proof - - from that have ne: "eventually (\w. w \ z) (nhds w)" - by (intro t1_space_nhds) auto - have "deriv g w = deriv (\w. inverse (f w)) w" - by (intro deriv_cong_ev refl eventually_mono [OF ne]) (auto simp: g_def) - also from assms(4)[of w] that s' have "\ = f' w" - by (auto dest: DERIV_imp_deriv) - finally show ?thesis . - qed - have "deriv g w = f' w" - by (rule analytic_continuation_open[of "s' - {z}" s' "deriv g" f']) - (insert s' assms s'_ne deriv_g w, - auto intro!: holomorphic_intros holomorphic_on_subset[OF assms(6)]) - finally show "(g has_field_derivative f' w) (at w)" . - qed (insert assms s', auto simp: g_def) - finally show ?thesis . -qed - -lemma residue_holomorphic_over_power: - assumes "open A" "z0 \ A" "f holomorphic_on A" - shows "residue (\z. f z / (z - z0) ^ Suc n) z0 = (deriv ^^ n) f z0 / fact n" -proof - - let ?f = "\z. f z / (z - z0) ^ Suc n" - from assms(1,2) obtain r where r: "r > 0" "cball z0 r \ A" - by (auto simp: open_contains_cball) - have "(?f has_contour_integral 2 * pi * \ * residue ?f z0) (circlepath z0 r)" - using r assms by (intro base_residue[of A]) (auto intro!: holomorphic_intros) - moreover have "(?f has_contour_integral 2 * pi * \ / fact n * (deriv ^^ n) f z0) (circlepath z0 r)" - using assms r - by (intro Cauchy_has_contour_integral_higher_derivative_circlepath) - (auto intro!: holomorphic_on_subset[OF assms(3)] holomorphic_on_imp_continuous_on) - ultimately have "2 * pi * \ * residue ?f z0 = 2 * pi * \ / fact n * (deriv ^^ n) f z0" - by (rule has_contour_integral_unique) - thus ?thesis by (simp add: field_simps) -qed - -lemma residue_holomorphic_over_power': - assumes "open A" "0 \ A" "f holomorphic_on A" - shows "residue (\z. f z / z ^ Suc n) 0 = (deriv ^^ n) f 0 / fact n" - using residue_holomorphic_over_power[OF assms] by simp - -lemma zer_poly_eqI: - fixes f :: "complex \ complex" and z0 :: complex - defines "n \ zorder f z0" - assumes "open A" "connected A" "z0 \ A" "f holomorphic_on A" "f z0 = 0" "\z\A. f z \ 0" - assumes lim: "((\x. f (g x) / (g x - z0) ^ n) \ c) F" - assumes g: "filterlim g (at z0) F" and "F \ bot" - shows "zer_poly f z0 z0 = c" -proof - - from zorder_exist[OF assms(2-7)] obtain r where - r: "r > 0" "cball z0 r \ A" "zer_poly f z0 holomorphic_on cball z0 r" - "\w. w \ cball z0 r \ f w = zer_poly f z0 w * (w - z0) ^ n" - unfolding n_def by blast - from r(1) have "eventually (\w. w \ ball z0 r \ w \ z0) (at z0)" - using eventually_at_ball'[of r z0 UNIV] by auto - hence "eventually (\w. zer_poly f z0 w = f w / (w - z0) ^ n) (at z0)" - by eventually_elim (insert r, auto simp: field_simps) - moreover have "continuous_on (ball z0 r) (zer_poly f z0)" - using r by (intro holomorphic_on_imp_continuous_on) auto - with r(1,2) have "isCont (zer_poly f z0) z0" - by (auto simp: continuous_on_eq_continuous_at) - hence "(zer_poly f z0 \ zer_poly f z0 z0) (at z0)" - unfolding isCont_def . - ultimately have "((\w. f w / (w - z0) ^ n) \ zer_poly f z0 z0) (at z0)" - by (rule Lim_transform_eventually) - hence "((\x. f (g x) / (g x - z0) ^ n) \ zer_poly f z0 z0) F" - by (rule filterlim_compose[OF _ g]) - from tendsto_unique[OF \F \ bot\ this lim] show ?thesis . -qed - -lemma pol_poly_eqI: - fixes f :: "complex \ complex" and z0 :: complex - defines "n \ porder f z0" - assumes "open A" "z0 \ A" "f holomorphic_on A-{z0}" "is_pole f z0" - assumes lim: "((\x. f (g x) * (g x - z0) ^ n) \ c) F" - assumes g: "filterlim g (at z0) F" and "F \ bot" - shows "pol_poly f z0 z0 = c" -proof - - from porder_exist[OF assms(2-5)] obtain r where - r: "r > 0" "cball z0 r \ A" "pol_poly f z0 holomorphic_on cball z0 r" - "\w. w \ cball z0 r - {z0} \ f w = pol_poly f z0 w / (w - z0) ^ n" - unfolding n_def by blast - from r(1) have "eventually (\w. w \ ball z0 r \ w \ z0) (at z0)" - using eventually_at_ball'[of r z0 UNIV] by auto - hence "eventually (\w. pol_poly f z0 w = f w * (w - z0) ^ n) (at z0)" - by eventually_elim (insert r, auto simp: field_simps) - moreover have "continuous_on (ball z0 r) (pol_poly f z0)" - using r by (intro holomorphic_on_imp_continuous_on) auto - with r(1,2) have "isCont (pol_poly f z0) z0" - by (auto simp: continuous_on_eq_continuous_at) - hence "(pol_poly f z0 \ pol_poly f z0 z0) (at z0)" - unfolding isCont_def . - ultimately have "((\w. f w * (w - z0) ^ n) \ pol_poly f z0 z0) (at z0)" - by (rule Lim_transform_eventually) - hence "((\x. f (g x) * (g x - z0) ^ n) \ pol_poly f z0 z0) F" - by (rule filterlim_compose[OF _ g]) - from tendsto_unique[OF \F \ bot\ this lim] show ?thesis . -qed - -lemma residue_simple_pole: - assumes "open A" "z0 \ A" "f holomorphic_on A - {z0}" - assumes "is_pole f z0" "porder f z0 = 1" - shows "residue f z0 = pol_poly f z0 z0" - using assms by (subst residue_porder[of A]) simp_all - -lemma residue_simple_pole_limit: - assumes "open A" "z0 \ A" "f holomorphic_on A - {z0}" - assumes "is_pole f z0" "porder f z0 = 1" - assumes "((\x. f (g x) * (g x - z0)) \ c) F" - assumes "filterlim g (at z0) F" "F \ bot" - shows "residue f z0 = c" -proof - - have "residue f z0 = pol_poly f z0 z0" - by (rule residue_simple_pole assms)+ - also have "\ = c" - using assms by (intro pol_poly_eqI[of A z0 f g c F]) auto - finally show ?thesis . -qed - -(* TODO: This is a mess and could be done much more easily if we had - a nice compositional theory of poles and zeros *) lemma - assumes "open s" "connected s" "z \ s" "f holomorphic_on s" "g holomorphic_on s" - assumes "(g has_field_derivative g') (at z)" + assumes f_holo:"f holomorphic_on s" and g_holo:"g holomorphic_on s" + and "open s" "connected s" "z \ s" + assumes g_deriv:"(g has_field_derivative g') (at z)" assumes "f z \ 0" "g z = 0" "g' \ 0" - shows porder_simple_pole_deriv: "porder (\w. f w / g w) z = 1" + shows porder_simple_pole_deriv: "zorder (\w. f w / g w) z = - 1" and residue_simple_pole_deriv: "residue (\w. f w / g w) z = f z / g'" proof - - have "\w\s. g w \ 0" + have [simp]:"isolated_singularity_at f z" "isolated_singularity_at g z" + using isolated_singularity_at_holomorphic[OF _ \open s\ \z\s\] f_holo g_holo + by (meson Diff_subset holomorphic_on_subset)+ + have [simp]:"not_essential f z" "not_essential g z" + unfolding not_essential_def using f_holo g_holo assms(3,5) + by (meson continuous_on_eq_continuous_at continuous_within holomorphic_on_imp_continuous_on)+ + have g_nconst:"\\<^sub>F w in at z. g w \0 " proof (rule ccontr) - assume *: "\(\w\s. g w \ 0)" - have **: "eventually (\w. w \ s) (nhds z)" - by (intro eventually_nhds_in_open assms) - from * have "deriv g z = deriv (\_. 0) z" - by (intro deriv_cong_ev eventually_mono [OF **]) auto - also have "\ = 0" by simp - also from assms have "deriv g z = g'" by (auto dest: DERIV_imp_deriv) - finally show False using \g' \ 0\ by contradiction + assume "\ (\\<^sub>F w in at z. g w \ 0)" + then have "\\<^sub>F w in nhds z. g w = 0" + unfolding eventually_at eventually_nhds frequently_at using \g z = 0\ + by (metis Topology_Euclidean_Space.open_ball UNIV_I centre_in_ball dist_commute mem_ball) + then have "deriv g z = deriv (\_. 0) z" + by (intro deriv_cong_ev) auto + then have "deriv g z = 0" by auto + then have "g' = 0" using g_deriv DERIV_imp_deriv by blast + then show False using \g'\0\ by auto + qed + + have "zorder (\w. f w / g w) z = zorder f z - zorder g z" + proof - + have "\\<^sub>F w in at z. f w \0 \ w\s" + apply (rule non_zero_neighbour_alt) + using assms by auto + with g_nconst have "\\<^sub>F w in at z. f w * g w \ 0" + by (elim frequently_rev_mp eventually_rev_mp,auto) + then show ?thesis using zorder_divide[of f z g] by auto qed - then obtain w where w: "w \ s" "g w \ 0" by blast - from isolated_zeros[OF assms(5) assms(1-3,8) w] - obtain r where r: "r > 0" "ball z r \ s" "\w. w \ ball z r - {z} \ g w \ 0" - by blast - from assms r have holo: "(\w. f w / g w) holomorphic_on ball z r - {z}" - by (auto intro!: holomorphic_intros) - - have "eventually (\w. w \ ball z r - {z}) (at z)" - using eventually_at_ball'[OF r(1), of z UNIV] by auto - hence "eventually (\w. g w \ 0) (at z)" - by eventually_elim (use r in auto) - moreover have "continuous_on s g" - by (intro holomorphic_on_imp_continuous_on) fact - with assms have "isCont g z" - by (auto simp: continuous_on_eq_continuous_at) - ultimately have "filterlim g (at 0) (at z)" - using \g z = 0\ by (auto simp: filterlim_at isCont_def) - moreover have "continuous_on s f" by (intro holomorphic_on_imp_continuous_on) fact - with assms have "isCont f z" - by (auto simp: continuous_on_eq_continuous_at) - ultimately have pole: "is_pole (\w. f w / g w) z" - unfolding is_pole_def using \f z \ 0\ - by (intro filterlim_divide_at_infinity[of _ "f z"]) (auto simp: isCont_def) - - have "continuous_on s f" by (intro holomorphic_on_imp_continuous_on) fact - moreover have "open (-{0::complex})" by auto - ultimately have "open (f -` (-{0}) \ s)" using \open s\ - by (subst (asm) continuous_on_open_vimage) blast+ - moreover have "z \ f -` (-{0}) \ s" using assms by auto - ultimately obtain r' where r': "r' > 0" "ball z r' \ f -` (-{0}) \ s" - unfolding open_contains_ball by blast - - let ?D = "\w. (f w * deriv g w - g w * deriv f w) / f w ^ 2" - show "porder (\w. f w / g w) z = 1" - proof (rule simple_poleI') - show "open (ball z (min r r'))" "connected (ball z (min r r'))" "z \ ball z (min r r')" - using r'(1) r(1) by auto - next - fix w assume "w \ ball z (min r r') - {z}" - with r' have "w \ s" "f w \ 0" by auto - have "((\w. g w / f w) has_field_derivative ?D w) (at w)" - by (rule derivative_eq_intros holomorphic_derivI[OF assms(4)] - holomorphic_derivI[OF assms(5)] | fact)+ - (simp_all add: algebra_simps power2_eq_square) - thus "((\w. inverse (f w / g w)) has_field_derivative ?D w) (at w)" - by (simp add: divide_simps) - next - from r' show "?D holomorphic_on ball z (min r r')" - by (intro holomorphic_intros holomorphic_on_subset[OF assms(4)] - holomorphic_on_subset[OF assms(5)]) auto - next - from assms have "deriv g z = g'" - by (auto dest: DERIV_imp_deriv) - with assms r' show "(f z * deriv g z - g z * deriv f z) / (f z)\<^sup>2 \ 0" - by simp - qed (insert pole holo, auto) - + moreover have "zorder f z=0" + apply (rule zorder_zero_eqI[OF f_holo \open s\ \z\s\]) + using \f z\0\ by auto + moreover have "zorder g z=1" + apply (rule zorder_zero_eqI[OF g_holo \open s\ \z\s\]) + subgoal using assms(8) by auto + subgoal using DERIV_imp_deriv assms(9) g_deriv by auto + subgoal by simp + done + ultimately show "zorder (\w. f w / g w) z = - 1" by auto + show "residue (\w. f w / g w) z = f z / g'" - proof (rule residue_simple_pole_limit) - show "porder (\w. f w / g w) z = 1" by fact - from r show "open (ball z r)" "z \ ball z r" by auto - + proof (rule residue_simple_pole_limit[where g=id and F="at z",simplified]) + show "zorder (\w. f w / g w) z = - 1" by fact + show "isolated_singularity_at (\w. f w / g w) z" + by (auto intro: singularity_intros) + show "is_pole (\w. f w / g w) z" + proof (rule is_pole_divide) + have "\\<^sub>F x in at z. g x \ 0" + apply (rule non_zero_neighbour) + using g_nconst by auto + moreover have "g \z\ 0" + using DERIV_isCont assms(8) continuous_at g_deriv by force + ultimately show "filterlim g (at 0) (at z)" unfolding filterlim_at by simp + show "isCont f z" + using assms(3,5) continuous_on_eq_continuous_at f_holo holomorphic_on_imp_continuous_on + by auto + show "f z \ 0" by fact + qed + show "filterlim id (at z) (at z)" by (simp add: filterlim_iff) have "((\w. (f w * (w - z)) / g w) \ f z / g') (at z)" proof (rule lhopital_complex_simple) show "((\w. f w * (w - z)) has_field_derivative f z) (at z)" - using assms by (auto intro!: derivative_eq_intros holomorphic_derivI[OF assms(4)]) + using assms by (auto intro!: derivative_eq_intros holomorphic_derivI[OF f_holo]) show "(g has_field_derivative g') (at z)" by fact qed (insert assms, auto) - thus "((\w. (f w / g w) * (w - z)) \ f z / g') (at z)" + then show "((\w. (f w / g w) * (w - z)) \ f z / g') (at z)" by (simp add: divide_simps) - qed (insert holo pole, auto simp: filterlim_ident) + qed +qed + +subsection \The argument principle\ + +theorem argument_principle: + fixes f::"complex \ complex" and poles s:: "complex set" + defines "pz \ {w. f w = 0 \ w \ poles}" \ \@{term "pz"} is the set of poles and zeros\ + assumes "open s" and + "connected s" and + f_holo:"f holomorphic_on s-poles" and + h_holo:"h holomorphic_on s" and + "valid_path g" and + loop:"pathfinish g = pathstart g" and + path_img:"path_image g \ s - pz" and + homo:"\z. (z \ s) \ winding_number g z = 0" and + finite:"finite pz" and + poles:"\p\poles. is_pole f p" + shows "contour_integral g (\x. deriv f x * h x / f x) = 2 * pi * \ * + (\p\pz. winding_number g p * h p * zorder f p)" + (is "?L=?R") +proof - + define c where "c \ 2 * complex_of_real pi * \ " + define ff where "ff \ (\x. deriv f x * h x / f x)" + define cont where "cont \ \ff p e. (ff has_contour_integral c * zorder f p * h p ) (circlepath p e)" + define avoid where "avoid \ \p e. \w\cball p e. w \ s \ (w \ p \ w \ pz)" + + have "\e>0. avoid p e \ (p\pz \ cont ff p e)" when "p\s" for p + proof - + obtain e1 where "e1>0" and e1_avoid:"avoid p e1" + using finite_cball_avoid[OF \open s\ finite] \p\s\ unfolding avoid_def by auto + have "\e2>0. cball p e2 \ ball p e1 \ cont ff p e2" when "p\pz" + proof - + define po where "po \ zorder f p" + define pp where "pp \ zor_poly f p" + define f' where "f' \ \w. pp w * (w - p) powr po" + define ff' where "ff' \ (\x. deriv f' x * h x / f' x)" + obtain r where "pp p\0" "r>0" and + "rw\cball p r-{p}. f w = pp w * (w - p) powr po \ pp w \ 0)" + proof - + have "isolated_singularity_at f p" + proof - + have "f holomorphic_on ball p e1 - {p}" + apply (intro holomorphic_on_subset[OF f_holo]) + using e1_avoid \p\pz\ unfolding avoid_def pz_def by force + then show ?thesis unfolding isolated_singularity_at_def + using \e1>0\ analytic_on_open open_delete by blast + qed + moreover have "not_essential f p" + proof (cases "is_pole f p") + case True + then show ?thesis unfolding not_essential_def by auto + next + case False + then have "p\s-poles" using \p\s\ poles unfolding pz_def by auto + moreover have "open (s-poles)" + using \open s\ + apply (elim open_Diff) + apply (rule finite_imp_closed) + using finite unfolding pz_def by simp + ultimately have "isCont f p" + using holomorphic_on_imp_continuous_on[OF f_holo] continuous_on_eq_continuous_at + by auto + then show ?thesis unfolding isCont_def not_essential_def by auto + qed + moreover have "\\<^sub>F w in at p. f w \ 0 " + proof (rule ccontr) + assume "\ (\\<^sub>F w in at p. f w \ 0)" + then have "\\<^sub>F w in at p. f w= 0" unfolding frequently_def by auto + then obtain rr where "rr>0" "\w\ball p rr - {p}. f w =0" + unfolding eventually_at by (auto simp add:dist_commute) + then have "ball p rr - {p} \ {w\ball p rr-{p}. f w=0}" by blast + moreover have "infinite (ball p rr - {p})" using \rr>0\ using finite_imp_not_open by fastforce + ultimately have "infinite {w\ball p rr-{p}. f w=0}" using infinite_super by blast + then have "infinite pz" + unfolding pz_def infinite_super by auto + then show False using \finite pz\ by auto + qed + ultimately obtain r where "pp p \ 0" and r:"r>0" "pp holomorphic_on cball p r" + "(\w\cball p r - {p}. f w = pp w * (w - p) powr of_int po \ pp w \ 0)" + using zorder_exist[of f p,folded po_def pp_def] by auto + define r1 where "r1=min r e1 / 2" + have "r1e1>0\ \r>0\ by auto + moreover have "r1>0" "pp holomorphic_on cball p r1" + "(\w\cball p r1 - {p}. f w = pp w * (w - p) powr of_int po \ pp w \ 0)" + unfolding r1_def using \e1>0\ r by auto + ultimately show ?thesis using that \pp p\0\ by auto + qed + + define e2 where "e2 \ r/2" + have "e2>0" using \r>0\ unfolding e2_def by auto + define anal where "anal \ \w. deriv pp w * h w / pp w" + define prin where "prin \ \w. po * h w / (w - p)" + have "((\w. prin w + anal w) has_contour_integral c * po * h p) (circlepath p e2)" + proof (rule has_contour_integral_add[of _ _ _ _ 0,simplified]) + have "ball p r \ s" + using \r avoid_def ball_subset_cball e1_avoid by (simp add: subset_eq) + then have "cball p e2 \ s" + using \r>0\ unfolding e2_def by auto + then have "(\w. po * h w) holomorphic_on cball p e2" + using h_holo by (auto intro!: holomorphic_intros) + then show "(prin has_contour_integral c * po * h p ) (circlepath p e2)" + using Cauchy_integral_circlepath_simple[folded c_def, of "\w. po * h w"] \e2>0\ + unfolding prin_def by (auto simp add: mult.assoc) + have "anal holomorphic_on ball p r" unfolding anal_def + using pp_holo h_holo pp_po \ball p r \ s\ \pp p\0\ + by (auto intro!: holomorphic_intros) + then show "(anal has_contour_integral 0) (circlepath p e2)" + using e2_def \r>0\ + by (auto elim!: Cauchy_theorem_disc_simple) + qed + then have "cont ff' p e2" unfolding cont_def po_def + proof (elim has_contour_integral_eq) + fix w assume "w \ path_image (circlepath p e2)" + then have "w\ball p r" and "w\p" unfolding e2_def using \r>0\ by auto + define wp where "wp \ w-p" + have "wp\0" and "pp w \0" + unfolding wp_def using \w\p\ \w\ball p r\ pp_po by auto + moreover have der_f':"deriv f' w = po * pp w * (w-p) powr (po - 1) + deriv pp w * (w-p) powr po" + proof (rule DERIV_imp_deriv) + have "(pp has_field_derivative (deriv pp w)) (at w)" + using DERIV_deriv_iff_has_field_derivative pp_holo \w\p\ + by (meson open_ball \w \ ball p r\ ball_subset_cball holomorphic_derivI holomorphic_on_subset) + then show " (f' has_field_derivative of_int po * pp w * (w - p) powr of_int (po - 1) + + deriv pp w * (w - p) powr of_int po) (at w)" + unfolding f'_def using \w\p\ + apply (auto intro!: derivative_eq_intros(35) DERIV_cong[OF has_field_derivative_powr_of_int]) + by (auto intro: derivative_eq_intros) + qed + ultimately show "prin w + anal w = ff' w" + unfolding ff'_def prin_def anal_def + apply simp + apply (unfold f'_def) + apply (fold wp_def) + apply (auto simp add:field_simps) + by (metis (no_types, lifting) diff_add_cancel mult.commute powr_add powr_to_1) + qed + then have "cont ff p e2" unfolding cont_def + proof (elim has_contour_integral_eq) + fix w assume "w \ path_image (circlepath p e2)" + then have "w\ball p r" and "w\p" unfolding e2_def using \r>0\ by auto + have "deriv f' w = deriv f w" + proof (rule complex_derivative_transform_within_open[where s="ball p r - {p}"]) + show "f' holomorphic_on ball p r - {p}" unfolding f'_def using pp_holo + by (auto intro!: holomorphic_intros) + next + have "ball p e1 - {p} \ s - poles" + using ball_subset_cball e1_avoid[unfolded avoid_def] unfolding pz_def + by auto + then have "ball p r - {p} \ s - poles" + apply (elim dual_order.trans) + using \r by auto + then show "f holomorphic_on ball p r - {p}" using f_holo + by auto + next + show "open (ball p r - {p})" by auto + show "w \ ball p r - {p}" using \w\ball p r\ \w\p\ by auto + next + fix x assume "x \ ball p r - {p}" + then show "f' x = f x" + using pp_po unfolding f'_def by auto + qed + moreover have " f' w = f w " + using \w \ ball p r\ ball_subset_cball subset_iff pp_po \w\p\ + unfolding f'_def by auto + ultimately show "ff' w = ff w" + unfolding ff'_def ff_def by simp + qed + moreover have "cball p e2 \ ball p e1" + using \0 < r\ \r e2_def by auto + ultimately show ?thesis using \e2>0\ by auto + qed + then obtain e2 where e2:"p\pz \ e2>0 \ cball p e2 \ ball p e1 \ cont ff p e2" + by auto + define e4 where "e4 \ if p\pz then e2 else e1" + have "e4>0" using e2 \e1>0\ unfolding e4_def by auto + moreover have "avoid p e4" using e2 \e1>0\ e1_avoid unfolding e4_def avoid_def by auto + moreover have "p\pz \ cont ff p e4" + by (auto simp add: e2 e4_def) + ultimately show ?thesis by auto + qed + then obtain get_e where get_e:"\p\s. get_e p>0 \ avoid p (get_e p) + \ (p\pz \ cont ff p (get_e p))" + by metis + define ci where "ci \ \p. contour_integral (circlepath p (get_e p)) ff" + define w where "w \ \p. winding_number g p" + have "contour_integral g ff = (\p\pz. w p * ci p)" unfolding ci_def w_def + proof (rule Cauchy_theorem_singularities[OF \open s\ \connected s\ finite _ \valid_path g\ loop + path_img homo]) + have "open (s - pz)" using open_Diff[OF _ finite_imp_closed[OF finite]] \open s\ by auto + then show "ff holomorphic_on s - pz" unfolding ff_def using f_holo h_holo + by (auto intro!: holomorphic_intros simp add:pz_def) + next + show "\p\s. 0 < get_e p \ (\w\cball p (get_e p). w \ s \ (w \ p \ w \ pz))" + using get_e using avoid_def by blast + qed + also have "... = (\p\pz. c * w p * h p * zorder f p)" + proof (rule sum.cong[of pz pz,simplified]) + fix p assume "p \ pz" + show "w p * ci p = c * w p * h p * (zorder f p)" + proof (cases "p\s") + assume "p \ s" + have "ci p = c * h p * (zorder f p)" unfolding ci_def + apply (rule contour_integral_unique) + using get_e \p\s\ \p\pz\ unfolding cont_def by (metis mult.assoc mult.commute) + thus ?thesis by auto + next + assume "p\s" + then have "w p=0" using homo unfolding w_def by auto + then show ?thesis by auto + qed + qed + also have "... = c*(\p\pz. w p * h p * zorder f p)" + unfolding sum_distrib_left by (simp add:algebra_simps) + finally have "contour_integral g ff = c * (\p\pz. w p * h p * of_int (zorder f p))" . + then show ?thesis unfolding ff_def c_def w_def by simp +qed + +subsection \Rouche's theorem \ + +theorem Rouche_theorem: + fixes f g::"complex \ complex" and s:: "complex set" + defines "fg\(\p. f p+ g p)" + defines "zeros_fg\{p. fg p =0}" and "zeros_f\{p. f p=0}" + assumes + "open s" and "connected s" and + "finite zeros_fg" and + "finite zeros_f" and + f_holo:"f holomorphic_on s" and + g_holo:"g holomorphic_on s" and + "valid_path \" and + loop:"pathfinish \ = pathstart \" and + path_img:"path_image \ \ s " and + path_less:"\z\path_image \. cmod(f z) > cmod(g z)" and + homo:"\z. (z \ s) \ winding_number \ z = 0" + shows "(\p\zeros_fg. winding_number \ p * zorder fg p) + = (\p\zeros_f. winding_number \ p * zorder f p)" +proof - + have path_fg:"path_image \ \ s - zeros_fg" + proof - + have False when "z\path_image \" and "f z + g z=0" for z + proof - + have "cmod (f z) > cmod (g z)" using \z\path_image \\ path_less by auto + moreover have "f z = - g z" using \f z + g z =0\ by (simp add: eq_neg_iff_add_eq_0) + then have "cmod (f z) = cmod (g z)" by auto + ultimately show False by auto + qed + then show ?thesis unfolding zeros_fg_def fg_def using path_img by auto + qed + have path_f:"path_image \ \ s - zeros_f" + proof - + have False when "z\path_image \" and "f z =0" for z + proof - + have "cmod (g z) < cmod (f z) " using \z\path_image \\ path_less by auto + then have "cmod (g z) < 0" using \f z=0\ by auto + then show False by auto + qed + then show ?thesis unfolding zeros_f_def using path_img by auto + qed + define w where "w \ \p. winding_number \ p" + define c where "c \ 2 * complex_of_real pi * \" + define h where "h \ \p. g p / f p + 1" + obtain spikes + where "finite spikes" and spikes: "\x\{0..1} - spikes. \ differentiable at x" + using \valid_path \\ + by (auto simp: valid_path_def piecewise_C1_differentiable_on_def C1_differentiable_on_eq) + have h_contour:"((\x. deriv h x / h x) has_contour_integral 0) \" + proof - + have outside_img:"0 \ outside (path_image (h o \))" + proof - + have "h p \ ball 1 1" when "p\path_image \" for p + proof - + have "cmod (g p/f p) <1" using path_less[rule_format,OF that] + apply (cases "cmod (f p) = 0") + by (auto simp add: norm_divide) + then show ?thesis unfolding h_def by (auto simp add:dist_complex_def) + qed + then have "path_image (h o \) \ ball 1 1" + by (simp add: image_subset_iff path_image_compose) + moreover have " (0::complex) \ ball 1 1" by (simp add: dist_norm) + ultimately show "?thesis" + using convex_in_outside[of "ball 1 1" 0] outside_mono by blast + qed + have valid_h:"valid_path (h \ \)" + proof (rule valid_path_compose_holomorphic[OF \valid_path \\ _ _ path_f]) + show "h holomorphic_on s - zeros_f" + unfolding h_def using f_holo g_holo + by (auto intro!: holomorphic_intros simp add:zeros_f_def) + next + show "open (s - zeros_f)" using \finite zeros_f\ \open s\ finite_imp_closed + by auto + qed + have "((\z. 1/z) has_contour_integral 0) (h \ \)" + proof - + have "0 \ path_image (h \ \)" using outside_img by (simp add: outside_def) + then have "((\z. 1/z) has_contour_integral c * winding_number (h \ \) 0) (h \ \)" + using has_contour_integral_winding_number[of "h o \" 0,simplified] valid_h + unfolding c_def by auto + moreover have "winding_number (h o \) 0 = 0" + proof - + have "0 \ outside (path_image (h \ \))" using outside_img . + moreover have "path (h o \)" + using valid_h by (simp add: valid_path_imp_path) + moreover have "pathfinish (h o \) = pathstart (h o \)" + by (simp add: loop pathfinish_compose pathstart_compose) + ultimately show ?thesis using winding_number_zero_in_outside by auto + qed + ultimately show ?thesis by auto + qed + moreover have "vector_derivative (h \ \) (at x) = vector_derivative \ (at x) * deriv h (\ x)" + when "x\{0..1} - spikes" for x + proof (rule vector_derivative_chain_at_general) + show "\ differentiable at x" using that \valid_path \\ spikes by auto + next + define der where "der \ \p. (deriv g p * f p - g p * deriv f p)/(f p * f p)" + define t where "t \ \ x" + have "f t\0" unfolding zeros_f_def t_def + by (metis DiffD1 image_eqI norm_not_less_zero norm_zero path_defs(4) path_less that) + moreover have "t\s" + using contra_subsetD path_image_def path_fg t_def that by fastforce + ultimately have "(h has_field_derivative der t) (at t)" + unfolding h_def der_def using g_holo f_holo \open s\ + by (auto intro!: holomorphic_derivI derivative_eq_intros) + then show "h field_differentiable at (\ x)" + unfolding t_def field_differentiable_def by blast + qed + then have " ((/) 1 has_contour_integral 0) (h \ \) + = ((\x. deriv h x / h x) has_contour_integral 0) \" + unfolding has_contour_integral + apply (intro has_integral_spike_eq[OF negligible_finite, OF \finite spikes\]) + by auto + ultimately show ?thesis by auto + qed + then have "contour_integral \ (\x. deriv h x / h x) = 0" + using contour_integral_unique by simp + moreover have "contour_integral \ (\x. deriv fg x / fg x) = contour_integral \ (\x. deriv f x / f x) + + contour_integral \ (\p. deriv h p / h p)" + proof - + have "(\p. deriv f p / f p) contour_integrable_on \" + proof (rule contour_integrable_holomorphic_simple[OF _ _ \valid_path \\ path_f]) + show "open (s - zeros_f)" using finite_imp_closed[OF \finite zeros_f\] \open s\ + by auto + then show "(\p. deriv f p / f p) holomorphic_on s - zeros_f" + using f_holo + by (auto intro!: holomorphic_intros simp add:zeros_f_def) + qed + moreover have "(\p. deriv h p / h p) contour_integrable_on \" + using h_contour + by (simp add: has_contour_integral_integrable) + ultimately have "contour_integral \ (\x. deriv f x / f x + deriv h x / h x) = + contour_integral \ (\p. deriv f p / f p) + contour_integral \ (\p. deriv h p / h p)" + using contour_integral_add[of "(\p. deriv f p / f p)" \ "(\p. deriv h p / h p)" ] + by auto + moreover have "deriv fg p / fg p = deriv f p / f p + deriv h p / h p" + when "p\ path_image \" for p + proof - + have "fg p\0" and "f p\0" using path_f path_fg that unfolding zeros_f_def zeros_fg_def + by auto + have "h p\0" + proof (rule ccontr) + assume "\ h p \ 0" + then have "g p / f p= -1" unfolding h_def by (simp add: add_eq_0_iff2) + then have "cmod (g p/f p) = 1" by auto + moreover have "cmod (g p/f p) <1" using path_less[rule_format,OF that] + apply (cases "cmod (f p) = 0") + by (auto simp add: norm_divide) + ultimately show False by auto + qed + have der_fg:"deriv fg p = deriv f p + deriv g p" unfolding fg_def + using f_holo g_holo holomorphic_on_imp_differentiable_at[OF _ \open s\] path_img that + by auto + have der_h:"deriv h p = (deriv g p * f p - g p * deriv f p)/(f p * f p)" + proof - + define der where "der \ \p. (deriv g p * f p - g p * deriv f p)/(f p * f p)" + have "p\s" using path_img that by auto + then have "(h has_field_derivative der p) (at p)" + unfolding h_def der_def using g_holo f_holo \open s\ \f p\0\ + by (auto intro!: derivative_eq_intros holomorphic_derivI) + then show ?thesis unfolding der_def using DERIV_imp_deriv by auto + qed + show ?thesis + apply (simp only:der_fg der_h) + apply (auto simp add:field_simps \h p\0\ \f p\0\ \fg p\0\) + by (auto simp add:field_simps h_def \f p\0\ fg_def) + qed + then have "contour_integral \ (\p. deriv fg p / fg p) + = contour_integral \ (\p. deriv f p / f p + deriv h p / h p)" + by (elim contour_integral_eq) + ultimately show ?thesis by auto + qed + moreover have "contour_integral \ (\x. deriv fg x / fg x) = c * (\p\zeros_fg. w p * zorder fg p)" + unfolding c_def zeros_fg_def w_def + proof (rule argument_principle[OF \open s\ \connected s\ _ _ \valid_path \\ loop _ homo + , of _ "{}" "\_. 1",simplified]) + show "fg holomorphic_on s" unfolding fg_def using f_holo g_holo holomorphic_on_add by auto + show "path_image \ \ s - {p. fg p = 0}" using path_fg unfolding zeros_fg_def . + show " finite {p. fg p = 0}" using \finite zeros_fg\ unfolding zeros_fg_def . + qed + moreover have "contour_integral \ (\x. deriv f x / f x) = c * (\p\zeros_f. w p * zorder f p)" + unfolding c_def zeros_f_def w_def + proof (rule argument_principle[OF \open s\ \connected s\ _ _ \valid_path \\ loop _ homo + , of _ "{}" "\_. 1",simplified]) + show "f holomorphic_on s" using f_holo g_holo holomorphic_on_add by auto + show "path_image \ \ s - {p. f p = 0}" using path_f unfolding zeros_f_def . + show " finite {p. f p = 0}" using \finite zeros_f\ unfolding zeros_f_def . + qed + ultimately have " c* (\p\zeros_fg. w p * (zorder fg p)) = c* (\p\zeros_f. w p * (zorder f p))" + by auto + then show ?thesis unfolding c_def using w_def by auto qed end diff -r 4fa9d5ef95bc -r 68ca05a7f159 src/HOL/Analysis/Connected.thy --- a/src/HOL/Analysis/Connected.thy Fri Feb 23 10:52:31 2018 +0000 +++ b/src/HOL/Analysis/Connected.thy Fri Feb 23 14:56:32 2018 +0000 @@ -155,6 +155,13 @@ by fast qed +lemma at_within_ball_bot_iff: + fixes x y :: "'a::{real_normed_vector,perfect_space}" + shows "at x within ball y r = bot \ (r=0 \ x \ cball y r)" + unfolding trivial_limit_within +apply (auto simp add:trivial_limit_within islimpt_ball ) +by (metis le_less_trans less_eq_real_def zero_le_dist) + lemma closure_ball [simp]: fixes x :: "'a::real_normed_vector" shows "0 < e \ closure (ball x e) = cball x e" diff -r 4fa9d5ef95bc -r 68ca05a7f159 src/HOL/Deriv.thy --- a/src/HOL/Deriv.thy Fri Feb 23 10:52:31 2018 +0000 +++ b/src/HOL/Deriv.thy Fri Feb 23 14:56:32 2018 +0000 @@ -1051,6 +1051,14 @@ by eventually_elim (auto simp: assms \f y = g y\) qed (simp_all add: assms) +lemma has_field_derivative_cong_eventually: + assumes "eventually (\x. f x = g x) (at x within s)" "f x=g x" + shows "(f has_field_derivative u) (at x within s) = (g has_field_derivative u) (at x within s)" + unfolding DERIV_iff2 + apply (rule tendsto_cong) + apply (insert assms) + by (auto elim: eventually_mono) + lemma DERIV_cong_ev: "x = y \ eventually (\x. f x = g x) (nhds x) \ u = v \ DERIV f x :> u \ DERIV g y :> v" diff -r 4fa9d5ef95bc -r 68ca05a7f159 src/HOL/Filter.thy --- a/src/HOL/Filter.thy Fri Feb 23 10:52:31 2018 +0000 +++ b/src/HOL/Filter.thy Fri Feb 23 14:56:32 2018 +0000 @@ -401,6 +401,16 @@ using eventually_conj[of P F "\x. \ P x"] by (auto simp add: frequently_def eventually_False) +lemma eventually_frequentlyE: + assumes "eventually P F" + assumes "eventually (\x. \ P x \ Q x) F" "F\bot" + shows "frequently Q F" +proof - + have "eventually Q F" + using eventually_conj[OF assms(1,2),simplified] by (auto elim:eventually_mono) + then show ?thesis using eventually_frequently[OF \F\bot\] by auto +qed + lemma eventually_const_iff: "eventually (\x. P) F \ P \ F = bot" by (cases P) (auto simp: eventually_False) diff -r 4fa9d5ef95bc -r 68ca05a7f159 src/HOL/Limits.thy --- a/src/HOL/Limits.thy Fri Feb 23 10:52:31 2018 +0000 +++ b/src/HOL/Limits.thy Fri Feb 23 14:56:32 2018 +0000 @@ -1894,6 +1894,14 @@ by fact qed +lemma filterlim_transform_within: + assumes "filterlim g G (at x within S)" + assumes "G \ F" "0x'. x' \ S \ 0 < dist x' x \ dist x' x < d \ f x' = g x') " + shows "filterlim f F (at x within S)" + using assms + apply (elim filterlim_mono_eventually) + unfolding eventually_at by auto + text \Common case assuming being away from some crucial point like 0.\ lemma Lim_transform_away_within: fixes a b :: "'a::t1_space" diff -r 4fa9d5ef95bc -r 68ca05a7f159 src/HOL/Real_Vector_Spaces.thy --- a/src/HOL/Real_Vector_Spaces.thy Fri Feb 23 10:52:31 2018 +0000 +++ b/src/HOL/Real_Vector_Spaces.thy Fri Feb 23 14:56:32 2018 +0000 @@ -1768,6 +1768,10 @@ for a :: "'a :: metric_space" by (auto simp: eventually_at_filter eventually_nhds_metric) +lemma frequently_at: "frequently P (at a within S) \ (\d>0. \x\S. x \ a \ dist x a < d \ P x)" + for a :: "'a :: metric_space" + unfolding frequently_def eventually_at by auto + lemma eventually_at_le: "eventually P (at a within S) \ (\d>0. \x\S. x \ a \ dist x a \ d \ P x)" for a :: "'a::metric_space" apply (simp only: eventually_at_filter eventually_nhds_metric) diff -r 4fa9d5ef95bc -r 68ca05a7f159 src/HOL/Topological_Spaces.thy --- a/src/HOL/Topological_Spaces.thy Fri Feb 23 10:52:31 2018 +0000 +++ b/src/HOL/Topological_Spaces.thy Fri Feb 23 14:56:32 2018 +0000 @@ -966,6 +966,24 @@ shows "a \ x" by (rule tendsto_le [OF F tendsto_const x ev]) +lemma filterlim_at_within_not_equal: + fixes f::"'a \ 'b::t2_space" + assumes "filterlim f (at a within s) F" + shows "eventually (\w. f w\s \ f w \b) F" +proof (cases "a=b") + case True + then show ?thesis using assms by (simp add: filterlim_at) +next + case False + from hausdorff[OF this] obtain U V where UV:"open U" "open V" "a \ U" "b \ V" "U \ V = {}" + by auto + have "(f \ a) F" using assms filterlim_at by auto + then have "\\<^sub>F x in F. f x \ U" using UV unfolding tendsto_def by auto + moreover have "\\<^sub>F x in F. f x \ s \ f x\a" using assms filterlim_at by auto + ultimately show ?thesis + apply eventually_elim + using UV by auto +qed subsubsection \Rules about @{const Lim}\