src/HOL/Multivariate_Analysis/Cauchy_Integral_Thm.thy
changeset 63040 eb4ddd18d635
parent 62843 313d3b697c9a
child 63092 a949b2a5f51d
equal deleted inserted replaced
63039:1a20fd9cf281 63040:eb4ddd18d635
  1939            a' \<in> convex hull {a,b,c} \<and> b' \<in> convex hull {a,b,c} \<and> c' \<in> convex hull {a,b,c} \<and>
  1939            a' \<in> convex hull {a,b,c} \<and> b' \<in> convex hull {a,b,c} \<and> c' \<in> convex hull {a,b,c} \<and>
  1940            dist a' b' \<le> K/2  \<and>  dist b' c' \<le> K/2  \<and>  dist c' a' \<le> K/2  \<and>
  1940            dist a' b' \<le> K/2  \<and>  dist b' c' \<le> K/2  \<and>  dist c' a' \<le> K/2  \<and>
  1941            e * (K/2)^2 \<le> norm(contour_integral(linepath a' b') f + contour_integral(linepath b' c') f + contour_integral(linepath c' a') f)"
  1941            e * (K/2)^2 \<le> norm(contour_integral(linepath a' b') f + contour_integral(linepath b' c') f + contour_integral(linepath c' a') f)"
  1942 proof -
  1942 proof -
  1943   note divide_le_eq_numeral1 [simp del]
  1943   note divide_le_eq_numeral1 [simp del]
  1944   def a' \<equiv> "midpoint b c"
  1944   define a' where "a' = midpoint b c"
  1945   def b' \<equiv> "midpoint c a"
  1945   define b' where "b' = midpoint c a"
  1946   def c' \<equiv> "midpoint a b"
  1946   define c' where "c' = midpoint a b"
  1947   have fabc: "continuous_on (closed_segment a b) f" "continuous_on (closed_segment b c) f" "continuous_on (closed_segment c a) f"
  1947   have fabc: "continuous_on (closed_segment a b) f" "continuous_on (closed_segment b c) f" "continuous_on (closed_segment c a) f"
  1948     using f continuous_on_subset segments_subset_convex_hull by metis+
  1948     using f continuous_on_subset segments_subset_convex_hull by metis+
  1949   have fcont': "continuous_on (closed_segment c' b') f"
  1949   have fcont': "continuous_on (closed_segment c' b') f"
  1950                "continuous_on (closed_segment a' c') f"
  1950                "continuous_on (closed_segment a' c') f"
  1951                "continuous_on (closed_segment b' a') f"
  1951                "continuous_on (closed_segment b' a') f"
  2143     by (metis assms holomorphic_on_imp_continuous_on)
  2143     by (metis assms holomorphic_on_imp_continuous_on)
  2144   let ?pathint = "\<lambda>x y. contour_integral(linepath x y) f"
  2144   let ?pathint = "\<lambda>x y. contour_integral(linepath x y) f"
  2145   { fix y::complex
  2145   { fix y::complex
  2146     assume fy: "(f has_contour_integral y) (linepath a b +++ linepath b c +++ linepath c a)"
  2146     assume fy: "(f has_contour_integral y) (linepath a b +++ linepath b c +++ linepath c a)"
  2147        and ynz: "y \<noteq> 0"
  2147        and ynz: "y \<noteq> 0"
  2148     def K \<equiv> "1 + max (dist a b) (max (dist b c) (dist c a))"
  2148     define K where "K = 1 + max (dist a b) (max (dist b c) (dist c a))"
  2149     def e \<equiv> "norm y / K^2"
  2149     define e where "e = norm y / K^2"
  2150     have K1: "K \<ge> 1"  by (simp add: K_def max.coboundedI1)
  2150     have K1: "K \<ge> 1"  by (simp add: K_def max.coboundedI1)
  2151     then have K: "K > 0" by linarith
  2151     then have K: "K > 0" by linarith
  2152     have [iff]: "dist a b \<le> K" "dist b c \<le> K" "dist c a \<le> K"
  2152     have [iff]: "dist a b \<le> K" "dist b c \<le> K" "dist c a \<le> K"
  2153       by (simp_all add: K_def)
  2153       by (simp_all add: K_def)
  2154     have e: "e > 0"
  2154     have e: "e > 0"
  2155       unfolding e_def using ynz K1 by simp
  2155       unfolding e_def using ynz K1 by simp
  2156     def At \<equiv> "\<lambda>x y z n. convex hull {x,y,z} \<subseteq> convex hull {a,b,c} \<and>
  2156     define At where "At x y z n \<longleftrightarrow>
  2157                          dist x y \<le> K/2^n \<and> dist y z \<le> K/2^n \<and> dist z x \<le> K/2^n \<and>
  2157         convex hull {x,y,z} \<subseteq> convex hull {a,b,c} \<and>
  2158                          norm(?pathint x y + ?pathint y z + ?pathint z x) \<ge> e*(K/2^n)^2"
  2158         dist x y \<le> K/2^n \<and> dist y z \<le> K/2^n \<and> dist z x \<le> K/2^n \<and>
       
  2159         norm(?pathint x y + ?pathint y z + ?pathint z x) \<ge> e*(K/2^n)^2"
       
  2160       for x y z n
  2159     have At0: "At a b c 0"
  2161     have At0: "At a b c 0"
  2160       using fy
  2162       using fy
  2161       by (simp add: At_def e_def has_chain_integral_chain_integral3)
  2163       by (simp add: At_def e_def has_chain_integral_chain_integral3)
  2162     { fix x y z n
  2164     { fix x y z n
  2163       assume At: "At x y z n"
  2165       assume At: "At x y z n"
  2356         by blast
  2358         by blast
  2357       { fix d1
  2359       { fix d1
  2358         assume d1_pos: "0 < d1"
  2360         assume d1_pos: "0 < d1"
  2359            and d1: "\<And>x x'. \<lbrakk>x\<in>convex hull {a, b, c}; x'\<in>convex hull {a, b, c}; cmod (x' - x) < d1\<rbrakk>
  2361            and d1: "\<And>x x'. \<lbrakk>x\<in>convex hull {a, b, c}; x'\<in>convex hull {a, b, c}; cmod (x' - x) < d1\<rbrakk>
  2360                            \<Longrightarrow> cmod (f x' - f x) < cmod y / (24 * C)"
  2362                            \<Longrightarrow> cmod (f x' - f x) < cmod y / (24 * C)"
  2361         def e      \<equiv> "min 1 (min (d1/(4*C)) ((norm y / 24 / C) / B))"
  2363         define e where "e = min 1 (min (d1/(4*C)) ((norm y / 24 / C) / B))"
  2362         def shrink \<equiv> "\<lambda>x. x - e *\<^sub>R (x - d)"
  2364         define shrink where "shrink x = x - e *\<^sub>R (x - d)" for x
  2363         let ?pathint = "\<lambda>x y. contour_integral(linepath x y) f"
  2365         let ?pathint = "\<lambda>x y. contour_integral(linepath x y) f"
  2364         have e: "0 < e" "e \<le> 1" "e \<le> d1 / (4 * C)" "e \<le> cmod y / 24 / C / B"
  2366         have e: "0 < e" "e \<le> 1" "e \<le> d1 / (4 * C)" "e \<le> cmod y / 24 / C / B"
  2365           using d1_pos \<open>C>0\<close> \<open>B>0\<close> ynz by (simp_all add: e_def)
  2367           using d1_pos \<open>C>0\<close> \<open>B>0\<close> ynz by (simp_all add: e_def)
  2366         then have eCB: "24 * e * C * B \<le> cmod y"
  2368         then have eCB: "24 * e * C * B \<le> cmod y"
  2367           using \<open>C>0\<close> \<open>B>0\<close>  by (simp add: field_simps)
  2369           using \<open>C>0\<close> \<open>B>0\<close>  by (simp add: field_simps)
  2980 proof -
  2982 proof -
  2981   have "\<forall>z. \<exists>e. z \<in> path_image p \<longrightarrow> 0 < e \<and> ball z e \<subseteq> s"
  2983   have "\<forall>z. \<exists>e. z \<in> path_image p \<longrightarrow> 0 < e \<and> ball z e \<subseteq> s"
  2982     using open_contains_ball os p(2) by blast
  2984     using open_contains_ball os p(2) by blast
  2983   then obtain ee where ee: "\<And>z. z \<in> path_image p \<Longrightarrow> 0 < ee z \<and> ball z (ee z) \<subseteq> s"
  2985   then obtain ee where ee: "\<And>z. z \<in> path_image p \<Longrightarrow> 0 < ee z \<and> ball z (ee z) \<subseteq> s"
  2984     by metis
  2986     by metis
  2985   def cover \<equiv> "(\<lambda>z. ball z (ee z/3)) ` (path_image p)"
  2987   define cover where "cover = (\<lambda>z. ball z (ee z/3)) ` (path_image p)"
  2986   have "compact (path_image p)"
  2988   have "compact (path_image p)"
  2987     by (metis p(1) compact_path_image)
  2989     by (metis p(1) compact_path_image)
  2988   moreover have "path_image p \<subseteq> (\<Union>c\<in>path_image p. ball c (ee c / 3))"
  2990   moreover have "path_image p \<subseteq> (\<Union>c\<in>path_image p. ball c (ee c / 3))"
  2989     using ee by auto
  2991     using ee by auto
  2990   ultimately have "\<exists>D \<subseteq> cover. finite D \<and> path_image p \<subseteq> \<Union>D"
  2992   ultimately have "\<exists>D \<subseteq> cover. finite D \<and> path_image p \<subseteq> \<Union>D"
  2999     using D by auto
  3001     using D by auto
  3000   have pi: "\<And>i. i \<in> k \<Longrightarrow> p i \<in> path_image p"
  3002   have pi: "\<And>i. i \<in> k \<Longrightarrow> p i \<in> path_image p"
  3001     using k  by (auto simp: path_image_def)
  3003     using k  by (auto simp: path_image_def)
  3002   then have eepi: "\<And>i. i \<in> k \<Longrightarrow> 0 < ee((p i))"
  3004   then have eepi: "\<And>i. i \<in> k \<Longrightarrow> 0 < ee((p i))"
  3003     by (metis ee)
  3005     by (metis ee)
  3004   def e \<equiv> "Min((ee o p) ` k)"
  3006   define e where "e = Min((ee o p) ` k)"
  3005   have fin_eep: "finite ((ee o p) ` k)"
  3007   have fin_eep: "finite ((ee o p) ` k)"
  3006     using k  by blast
  3008     using k  by blast
  3007   have enz: "0 < e"
  3009   have enz: "0 < e"
  3008     using ee k  by (simp add: kne e_def Min_gr_iff [OF fin_eep] eepi)
  3010     using ee k  by (simp add: kne e_def Min_gr_iff [OF fin_eep] eepi)
  3009   have "uniformly_continuous_on {0..1} p"
  3011   have "uniformly_continuous_on {0..1} p"
  3473                       (\<forall>f. f holomorphic_on UNIV - {z} \<longrightarrow> contour_integral h2 f = contour_integral h1 f)"
  3475                       (\<forall>f. f holomorphic_on UNIV - {z} \<longrightarrow> contour_integral h2 f = contour_integral h1 f)"
  3474     using contour_integral_nearby_ends [of "UNIV - {z}" \<gamma>] assms by (auto simp: open_delete)
  3476     using contour_integral_nearby_ends [of "UNIV - {z}" \<gamma>] assms by (auto simp: open_delete)
  3475   then obtain h where h: "polynomial_function h \<and> pathstart h = pathstart \<gamma> \<and> pathfinish h = pathfinish \<gamma> \<and>
  3477   then obtain h where h: "polynomial_function h \<and> pathstart h = pathstart \<gamma> \<and> pathfinish h = pathfinish \<gamma> \<and>
  3476                           (\<forall>t \<in> {0..1}. norm(h t - \<gamma> t) < d/2)"
  3478                           (\<forall>t \<in> {0..1}. norm(h t - \<gamma> t) < d/2)"
  3477     using path_approx_polynomial_function [OF \<open>path \<gamma>\<close>, of "d/2"] d by auto
  3479     using path_approx_polynomial_function [OF \<open>path \<gamma>\<close>, of "d/2"] d by auto
  3478   def nn \<equiv> "1/(2* pi*ii) * contour_integral h (\<lambda>w. 1/(w - z))"
  3480   define nn where "nn = 1/(2* pi*ii) * contour_integral h (\<lambda>w. 1/(w - z))"
  3479   have "\<exists>n. \<forall>e > 0. \<exists>p. valid_path p \<and> z \<notin> path_image p \<and>
  3481   have "\<exists>n. \<forall>e > 0. \<exists>p. valid_path p \<and> z \<notin> path_image p \<and>
  3480                         pathstart p = pathstart \<gamma> \<and>  pathfinish p = pathfinish \<gamma> \<and>
  3482                         pathstart p = pathstart \<gamma> \<and>  pathfinish p = pathfinish \<gamma> \<and>
  3481                         (\<forall>t \<in> {0..1}. norm(\<gamma> t - p t) < e) \<and>
  3483                         (\<forall>t \<in> {0..1}. norm(\<gamma> t - p t) < e) \<and>
  3482                         contour_integral p (\<lambda>w. 1/(w - z)) = 2 * pi * ii * n"
  3484                         contour_integral p (\<lambda>w. 1/(w - z)) = 2 * pi * ii * n"
  3483                     (is "\<exists>n. \<forall>e > 0. ?PP e n")
  3485                     (is "\<exists>n. \<forall>e > 0. ?PP e n")
  3922     using z by (auto simp: path_image_def)
  3924     using z by (auto simp: path_image_def)
  3923   have [simp]: "z \<notin> \<gamma> ` {0..1}"
  3925   have [simp]: "z \<notin> \<gamma> ` {0..1}"
  3924     using path_image_def z by auto
  3926     using path_image_def z by auto
  3925   have gpd: "\<gamma> piecewise_C1_differentiable_on {0..1}"
  3927   have gpd: "\<gamma> piecewise_C1_differentiable_on {0..1}"
  3926     using \<gamma> valid_path_def by blast
  3928     using \<gamma> valid_path_def by blast
  3927   def r \<equiv> "(w - z) / (\<gamma> 0 - z)"
  3929   define r where "r = (w - z) / (\<gamma> 0 - z)"
  3928   have [simp]: "r \<noteq> 0"
  3930   have [simp]: "r \<noteq> 0"
  3929     using w z by (auto simp: r_def)
  3931     using w z by (auto simp: r_def)
  3930   have "Arg r \<le> 2*pi"
  3932   have "Arg r \<le> 2*pi"
  3931     by (simp add: Arg less_eq_real_def)
  3933     by (simp add: Arg less_eq_real_def)
  3932   also have "... \<le> Im (integral {0..1} (\<lambda>x. vector_derivative \<gamma> (at x) / (\<gamma> x - z)))"
  3934   also have "... \<le> Im (integral {0..1} (\<lambda>x. vector_derivative \<gamma> (at x) / (\<gamma> x - z)))"
  3942     apply (intro continuous_intros indefinite_integral_continuous winding_number_exp_integral [OF gpd]; simp)
  3944     apply (intro continuous_intros indefinite_integral_continuous winding_number_exp_integral [OF gpd]; simp)
  3943     done
  3945     done
  3944   then obtain t where t:     "t \<in> {0..1}"
  3946   then obtain t where t:     "t \<in> {0..1}"
  3945                   and eqArg: "Im (integral {0..t} (\<lambda>x. vector_derivative \<gamma> (at x)/(\<gamma> x - z))) = Arg r"
  3947                   and eqArg: "Im (integral {0..t} (\<lambda>x. vector_derivative \<gamma> (at x)/(\<gamma> x - z))) = Arg r"
  3946     by blast
  3948     by blast
  3947   def i \<equiv> "integral {0..t} (\<lambda>x. vector_derivative \<gamma> (at x) / (\<gamma> x - z))"
  3949   define i where "i = integral {0..t} (\<lambda>x. vector_derivative \<gamma> (at x) / (\<gamma> x - z))"
  3948   have iArg: "Arg r = Im i"
  3950   have iArg: "Arg r = Im i"
  3949     using eqArg by (simp add: i_def)
  3951     using eqArg by (simp add: i_def)
  3950   have gpdt: "\<gamma> piecewise_C1_differentiable_on {0..t}"
  3952   have gpdt: "\<gamma> piecewise_C1_differentiable_on {0..t}"
  3951     by (metis atLeastAtMost_iff atLeastatMost_subset_iff order_refl piecewise_C1_differentiable_on_subset gpd t)
  3953     by (metis atLeastAtMost_iff atLeastatMost_subset_iff order_refl piecewise_C1_differentiable_on_subset gpd t)
  3952   have "exp (- i) * (\<gamma> t - z) = \<gamma> 0 - z"
  3954   have "exp (- i) * (\<gamma> t - z) = \<gamma> 0 - z"
  4431   { assume wnz_12: "\<bar>Re (winding_number \<gamma> z)\<bar> > 1/2"
  4433   { assume wnz_12: "\<bar>Re (winding_number \<gamma> z)\<bar> > 1/2"
  4432     have "isCont (winding_number \<gamma>) z"
  4434     have "isCont (winding_number \<gamma>) z"
  4433       by (metis continuous_at_winding_number valid_path_imp_path \<gamma> z)
  4435       by (metis continuous_at_winding_number valid_path_imp_path \<gamma> z)
  4434     then obtain d where "d>0" and d: "\<And>x'. dist x' z < d \<Longrightarrow> dist (winding_number \<gamma> x') (winding_number \<gamma> z) < \<bar>Re(winding_number \<gamma> z)\<bar> - 1/2"
  4436     then obtain d where "d>0" and d: "\<And>x'. dist x' z < d \<Longrightarrow> dist (winding_number \<gamma> x') (winding_number \<gamma> z) < \<bar>Re(winding_number \<gamma> z)\<bar> - 1/2"
  4435       using continuous_at_eps_delta wnz_12 diff_gt_0_iff_gt by blast
  4437       using continuous_at_eps_delta wnz_12 diff_gt_0_iff_gt by blast
  4436     def z' \<equiv> "z - (d / (2 * cmod a)) *\<^sub>R a"
  4438     define z' where "z' = z - (d / (2 * cmod a)) *\<^sub>R a"
  4437     have *: "a \<bullet> z' \<le> b - d / 3 * cmod a"
  4439     have *: "a \<bullet> z' \<le> b - d / 3 * cmod a"
  4438       unfolding z'_def inner_mult_right' divide_inverse
  4440       unfolding z'_def inner_mult_right' divide_inverse
  4439       apply (simp add: divide_simps algebra_simps dot_square_norm power2_eq_square anz)
  4441       apply (simp add: divide_simps algebra_simps dot_square_norm power2_eq_square anz)
  4440       apply (metis \<open>0 < d\<close> add_increasing azb less_eq_real_def mult_nonneg_nonneg mult_right_mono norm_ge_zero norm_numeral)
  4442       apply (metis \<open>0 < d\<close> add_increasing azb less_eq_real_def mult_nonneg_nonneg mult_right_mono norm_ge_zero norm_numeral)
  4441       done
  4443       done
  4610                       norm(g1 u - k((t1,u))) < d \<and> norm(g2 u - k((t2,u))) < d) \<and>
  4612                       norm(g1 u - k((t1,u))) < d \<and> norm(g2 u - k((t2,u))) < d) \<and>
  4611                       linked_paths atends g1 g2
  4613                       linked_paths atends g1 g2
  4612                       \<longrightarrow> contour_integral g2 f = contour_integral g1 f)))"
  4614                       \<longrightarrow> contour_integral g2 f = contour_integral g1 f)))"
  4613     by metis
  4615     by metis
  4614   note ee_rule = ee [THEN conjunct2, rule_format]
  4616   note ee_rule = ee [THEN conjunct2, rule_format]
  4615   def C \<equiv> "(\<lambda>t. ball t (ee t / 3)) ` {0..1}"
  4617   define C where "C = (\<lambda>t. ball t (ee t / 3)) ` {0..1}"
  4616   have "\<forall>t \<in> C. open t" by (simp add: C_def)
  4618   have "\<forall>t \<in> C. open t" by (simp add: C_def)
  4617   moreover have "{0..1} \<subseteq> \<Union>C"
  4619   moreover have "{0..1} \<subseteq> \<Union>C"
  4618     using ee [THEN conjunct1] by (auto simp: C_def dist_norm)
  4620     using ee [THEN conjunct1] by (auto simp: C_def dist_norm)
  4619   ultimately obtain C' where C': "C' \<subseteq> C" "finite C'" and C'01: "{0..1} \<subseteq> \<Union>C'"
  4621   ultimately obtain C' where C': "C' \<subseteq> C" "finite C'" and C'01: "{0..1} \<subseteq> \<Union>C'"
  4620     by (rule compactE [OF compact_interval])
  4622     by (rule compactE [OF compact_interval])
  4621   def kk \<equiv> "{t \<in> {0..1}. ball t (ee t / 3) \<in> C'}"
  4623   define kk where "kk = {t \<in> {0..1}. ball t (ee t / 3) \<in> C'}"
  4622   have kk01: "kk \<subseteq> {0..1}" by (auto simp: kk_def)
  4624   have kk01: "kk \<subseteq> {0..1}" by (auto simp: kk_def)
  4623   def e \<equiv> "Min (ee ` kk)"
  4625   define e where "e = Min (ee ` kk)"
  4624   have C'_eq: "C' = (\<lambda>t. ball t (ee t / 3)) ` kk"
  4626   have C'_eq: "C' = (\<lambda>t. ball t (ee t / 3)) ` kk"
  4625     using C' by (auto simp: kk_def C_def)
  4627     using C' by (auto simp: kk_def C_def)
  4626   have ee_pos[simp]: "\<And>t. t \<in> {0..1} \<Longrightarrow> ee t > 0"
  4628   have ee_pos[simp]: "\<And>t. t \<in> {0..1} \<Longrightarrow> ee t > 0"
  4627     by (simp add: kk_def ee)
  4629     by (simp add: kk_def ee)
  4628   moreover have "finite kk"
  4630   moreover have "finite kk"
  4983     have [simp]: "\<bar>r\<bar> = r" using \<open>r > 0\<close> by linarith
  4985     have [simp]: "\<bar>r\<bar> = r" using \<open>r > 0\<close> by linarith
  4984     have [simp]: "cmod (complex_of_real t - complex_of_real s) = t-s"
  4986     have [simp]: "cmod (complex_of_real t - complex_of_real s) = t-s"
  4985       by (metis "2" abs_of_pos diff_gt_0_iff_gt norm_of_real of_real_diff)
  4987       by (metis "2" abs_of_pos diff_gt_0_iff_gt norm_of_real of_real_diff)
  4986     have "finite (part_circlepath z r s t -` {y} \<inter> {0..1})" if "y \<in> k" for y
  4988     have "finite (part_circlepath z r s t -` {y} \<inter> {0..1})" if "y \<in> k" for y
  4987     proof -
  4989     proof -
  4988       def w \<equiv> "(y - z)/of_real r / exp(ii * of_real s)"
  4990       define w where "w = (y - z)/of_real r / exp(ii * of_real s)"
  4989       have fin: "finite (of_real -` {z. cmod z \<le> 1 \<and> exp (\<i> * complex_of_real (t - s) * z) = w})"
  4991       have fin: "finite (of_real -` {z. cmod z \<le> 1 \<and> exp (\<i> * complex_of_real (t - s) * z) = w})"
  4990         apply (rule finite_vimageI [OF finite_bounded_log2])
  4992         apply (rule finite_vimageI [OF finite_bounded_log2])
  4991         using \<open>s < t\<close> apply (auto simp: inj_of_real)
  4993         using \<open>s < t\<close> apply (auto simp: inj_of_real)
  4992         done
  4994         done
  4993       show ?thesis
  4995       show ?thesis
  5203   have *: "x \<in> (\<lambda>u. z + (cmod (x - z)) * exp (\<i> * (of_real u * (of_real pi * 2)))) ` {0..1}" for x
  5205   have *: "x \<in> (\<lambda>u. z + (cmod (x - z)) * exp (\<i> * (of_real u * (of_real pi * 2)))) ` {0..1}" for x
  5204   proof (cases "x = z")
  5206   proof (cases "x = z")
  5205     case True then show ?thesis by force
  5207     case True then show ?thesis by force
  5206   next
  5208   next
  5207     case False
  5209     case False
  5208     def w \<equiv> "x - z"
  5210     define w where "w = x - z"
  5209     then have "w \<noteq> 0" by (simp add: False)
  5211     then have "w \<noteq> 0" by (simp add: False)
  5210     have **: "\<And>t. \<lbrakk>Re w = cos t * cmod w; Im w = sin t * cmod w\<rbrakk> \<Longrightarrow> w = of_real (cmod w) * exp (\<i> * t)"
  5212     have **: "\<And>t. \<lbrakk>Re w = cos t * cmod w; Im w = sin t * cmod w\<rbrakk> \<Longrightarrow> w = of_real (cmod w) * exp (\<i> * t)"
  5211       using cis_conv_exp complex_eq_iff by auto
  5213       using cis_conv_exp complex_eq_iff by auto
  5212     show ?thesis
  5214     show ?thesis
  5213       apply (rule sincos_total_2pi [of "Re(w/of_real(norm w))" "Im(w/of_real(norm w))"])
  5215       apply (rule sincos_total_2pi [of "Re(w/of_real(norm w))" "Im(w/of_real(norm w))"])
  5277     using assms winding_number_circlepath_centre by auto
  5279     using assms winding_number_circlepath_centre by auto
  5278 next
  5280 next
  5279   case False
  5281   case False
  5280   have [simp]: "r > 0"
  5282   have [simp]: "r > 0"
  5281     using assms le_less_trans norm_ge_zero by blast
  5283     using assms le_less_trans norm_ge_zero by blast
  5282   def r' \<equiv> "norm(w - z)"
  5284   define r' where "r' = norm(w - z)"
  5283   have "r' < r"
  5285   have "r' < r"
  5284     by (simp add: assms r'_def)
  5286     by (simp add: assms r'_def)
  5285   have disjo: "cball z r' \<inter> sphere z r = {}"
  5287   have disjo: "cball z r' \<inter> sphere z r = {}"
  5286     using \<open>r' < r\<close> by (force simp: cball_def sphere_def)
  5288     using \<open>r' < r\<close> by (force simp: cball_def sphere_def)
  5287   have "winding_number(circlepath z r) w = winding_number(circlepath z r) z"
  5289   have "winding_number(circlepath z r) w = winding_number(circlepath z r) z"
  5377   then show lintg: "l contour_integrable_on \<gamma>"
  5379   then show lintg: "l contour_integrable_on \<gamma>"
  5378     apply (simp add: contour_integrable_on)
  5380     apply (simp add: contour_integrable_on)
  5379     apply (blast intro: integrable_uniform_limit_real)
  5381     apply (blast intro: integrable_uniform_limit_real)
  5380     done
  5382     done
  5381   { fix e::real
  5383   { fix e::real
  5382     def B' \<equiv> "B+1"
  5384     define B' where "B' = B + 1"
  5383     have B': "B' > 0" "B' > B" using  \<open>0 \<le> B\<close> by (auto simp: B'_def)
  5385     have B': "B' > 0" "B' > B" using  \<open>0 \<le> B\<close> by (auto simp: B'_def)
  5384     assume "0 < e"
  5386     assume "0 < e"
  5385     then have ev_no': "\<forall>\<^sub>F n in F. \<forall>x\<in>path_image \<gamma>. 2 * cmod (f n x - l x) < e / B'"
  5387     then have ev_no': "\<forall>\<^sub>F n in F. \<forall>x\<in>path_image \<gamma>. 2 * cmod (f n x - l x) < e / B'"
  5386       using ev_no [of "e / B' / 2"] B' by (simp add: field_simps)
  5388       using ev_no [of "e / B' / 2"] B' by (simp add: field_simps)
  5387     have ie: "integral {0..1::real} (\<lambda>x. e / 2) < e" using \<open>0 < e\<close> by simp
  5389     have ie: "integral {0..1::real} (\<lambda>x. e / 2) < e" using \<open>0 < e\<close> by simp
  5461     have *: "cmod ((inverse (x - u) ^ k - inverse (x - w) ^ k) / ((u - w) * k) - inverse (x - w) ^ Suc k)   < e"
  5463     have *: "cmod ((inverse (x - u) ^ k - inverse (x - w) ^ k) / ((u - w) * k) - inverse (x - w) ^ Suc k)   < e"
  5462             if x: "x \<in> path_image \<gamma>" and "u \<noteq> w" and uwd: "cmod (u - w) < d/2"
  5464             if x: "x \<in> path_image \<gamma>" and "u \<noteq> w" and uwd: "cmod (u - w) < d/2"
  5463                 and uw_less: "cmod (u - w) < e * (d / 2) ^ (k+2) / (1 + real k)"
  5465                 and uw_less: "cmod (u - w) < e * (d / 2) ^ (k+2) / (1 + real k)"
  5464             for u x
  5466             for u x
  5465     proof -
  5467     proof -
  5466       def ff \<equiv> "\<lambda>n::nat. \<lambda>w. if n = 0 then inverse(x - w)^k
  5468       define ff where [abs_def]:
  5467                               else if n = 1 then k / (x - w)^(Suc k)
  5469         "ff n w =
  5468                               else (k * of_real(Suc k)) / (x - w)^(k + 2)"
  5470           (if n = 0 then inverse(x - w)^k
       
  5471            else if n = 1 then k / (x - w)^(Suc k)
       
  5472            else (k * of_real(Suc k)) / (x - w)^(k + 2))" for n :: nat and w
  5469       have km1: "\<And>z::complex. z \<noteq> 0 \<Longrightarrow> z ^ (k - Suc 0) = z ^ k / z"
  5473       have km1: "\<And>z::complex. z \<noteq> 0 \<Longrightarrow> z ^ (k - Suc 0) = z ^ k / z"
  5470         by (simp add: field_simps) (metis Suc_pred \<open>k \<noteq> 0\<close> neq0_conv power_Suc)
  5474         by (simp add: field_simps) (metis Suc_pred \<open>k \<noteq> 0\<close> neq0_conv power_Suc)
  5471       have ff1: "(ff i has_field_derivative ff (Suc i) z) (at z within ball w (d / 2))"
  5475       have ff1: "(ff i has_field_derivative ff (Suc i) z) (at z within ball w (d / 2))"
  5472               if "z \<in> ball w (d / 2)" "i \<le> 1" for i z
  5476               if "z \<in> ball w (d / 2)" "i \<le> 1" for i z
  5473       proof -
  5477       proof -
  6283 proof (rule ccontr)
  6287 proof (rule ccontr)
  6284   assume fz: "f z \<noteq> 0"
  6288   assume fz: "f z \<noteq> 0"
  6285   with inf [unfolded Lim_at_infinity, rule_format, of "norm(f z)/2"]
  6289   with inf [unfolded Lim_at_infinity, rule_format, of "norm(f z)/2"]
  6286   obtain B where B: "\<And>x. B \<le> cmod x \<Longrightarrow> norm (f x) * 2 < cmod (f z)"
  6290   obtain B where B: "\<And>x. B \<le> cmod x \<Longrightarrow> norm (f x) * 2 < cmod (f z)"
  6287     by (auto simp: dist_norm)
  6291     by (auto simp: dist_norm)
  6288   def R \<equiv> "1 + \<bar>B\<bar> + norm z"
  6292   define R where "R = 1 + \<bar>B\<bar> + norm z"
  6289   have "R > 0" unfolding R_def 
  6293   have "R > 0" unfolding R_def 
  6290   proof -
  6294   proof -
  6291     have "0 \<le> cmod z + \<bar>B\<bar>"
  6295     have "0 \<le> cmod z + \<bar>B\<bar>"
  6292       by (metis (full_types) add_nonneg_nonneg norm_ge_zero real_norm_def)
  6296       by (metis (full_types) add_nonneg_nonneg norm_ge_zero real_norm_def)
  6293     then show "0 < 1 + \<bar>B\<bar> + cmod z"
  6297     then show "0 < 1 + \<bar>B\<bar> + cmod z"
  6382     apply (rule continuous_intros continuous_on_subset [OF contg])+
  6386     apply (rule continuous_intros continuous_on_subset [OF contg])+
  6383     using \<open>0 < r\<close> by auto
  6387     using \<open>0 < r\<close> by auto
  6384   have 2: "((\<lambda>u. 1 / (2 * of_real pi * \<i>) * g u / (u - w) ^ 1) has_contour_integral g w) (circlepath z r)"
  6388   have 2: "((\<lambda>u. 1 / (2 * of_real pi * \<i>) * g u / (u - w) ^ 1) has_contour_integral g w) (circlepath z r)"
  6385        if w: "w \<in> ball z r" for w
  6389        if w: "w \<in> ball z r" for w
  6386   proof -
  6390   proof -
  6387     def d \<equiv> "(r - norm(w - z))"
  6391     define d where "d = (r - norm(w - z))"
  6388     have "0 < d"  "d \<le> r" using w by (auto simp: norm_minus_commute d_def dist_norm)
  6392     have "0 < d"  "d \<le> r" using w by (auto simp: norm_minus_commute d_def dist_norm)
  6389     have dle: "\<And>u. cmod (z - u) = r \<Longrightarrow> d \<le> cmod (u - w)"
  6393     have dle: "\<And>u. cmod (z - u) = r \<Longrightarrow> d \<le> cmod (u - w)"
  6390       unfolding d_def by (metis add_diff_eq diff_add_cancel norm_diff_ineq norm_minus_commute)
  6394       unfolding d_def by (metis add_diff_eq diff_add_cancel norm_diff_ineq norm_minus_commute)
  6391     have ev_int: "\<forall>\<^sub>F n in F. (\<lambda>u. f n u / (u - w)) contour_integrable_on circlepath z r"
  6395     have ev_int: "\<forall>\<^sub>F n in F. (\<lambda>u. f n u / (u - w)) contour_integrable_on circlepath z r"
  6392       apply (rule eventually_mono [OF cont])
  6396       apply (rule eventually_mono [OF cont])
  6466       then have f': "f' n w = 1 / (2 * of_real pi * \<i>) * ?conint (\<lambda>u. f n u / (u - w)\<^sup>2)"
  6470       then have f': "f' n w = 1 / (2 * of_real pi * \<i>) * ?conint (\<lambda>u. f n u / (u - w)\<^sup>2)"
  6467         using DERIV_unique [OF fnd] w by blast
  6471         using DERIV_unique [OF fnd] w by blast
  6468       show ?thesis
  6472       show ?thesis
  6469         by (simp add: f' Cauchy_contour_integral_circlepath_2 [OF g w] derg [OF w] divide_simps)
  6473         by (simp add: f' Cauchy_contour_integral_circlepath_2 [OF g w] derg [OF w] divide_simps)
  6470     qed
  6474     qed
  6471     def d \<equiv> "(r - norm(w - z))^2"
  6475     define d where "d = (r - norm(w - z))^2"
  6472     have "d > 0"
  6476     have "d > 0"
  6473       using w by (simp add: dist_commute dist_norm d_def)
  6477       using w by (simp add: dist_commute dist_norm d_def)
  6474     have dle: "\<And>y. r = cmod (z - y) \<Longrightarrow> d \<le> cmod ((y - w)\<^sup>2)"
  6478     have dle: "\<And>y. r = cmod (z - y) \<Longrightarrow> d \<le> cmod ((y - w)\<^sup>2)"
  6475       apply (simp add: d_def norm_power)
  6479       apply (simp add: d_def norm_power)
  6476       apply (rule power_mono)
  6480       apply (rule power_mono)
  7080     using has_vector_derivative_polynomial_function [OF \<gamma>] by blast
  7084     using has_vector_derivative_polynomial_function [OF \<gamma>] by blast
  7081   then have "bounded(path_image \<gamma>')"
  7085   then have "bounded(path_image \<gamma>')"
  7082     by (simp add: path_image_def compact_imp_bounded compact_continuous_image continuous_on_polymonial_function)
  7086     by (simp add: path_image_def compact_imp_bounded compact_continuous_image continuous_on_polymonial_function)
  7083   then obtain B where "B>0" and B: "\<And>x. x \<in> path_image \<gamma>' \<Longrightarrow> norm x \<le> B"
  7087   then obtain B where "B>0" and B: "\<And>x. x \<in> path_image \<gamma>' \<Longrightarrow> norm x \<le> B"
  7084     using bounded_pos by force
  7088     using bounded_pos by force
  7085   def d \<equiv> "\<lambda>z w. if w = z then deriv f z else (f w - f z)/(w - z)"
  7089   define d where [abs_def]: "d z w = (if w = z then deriv f z else (f w - f z)/(w - z))" for z w
  7086   def v \<equiv> "{w. w \<notin> path_image \<gamma> \<and> winding_number \<gamma> w = 0}"
  7090   define v where "v = {w. w \<notin> path_image \<gamma> \<and> winding_number \<gamma> w = 0}"
  7087   have "path \<gamma>" "valid_path \<gamma>" using \<gamma>
  7091   have "path \<gamma>" "valid_path \<gamma>" using \<gamma>
  7088     by (auto simp: path_polynomial_function valid_path_polynomial_function)
  7092     by (auto simp: path_polynomial_function valid_path_polynomial_function)
  7089   then have ov: "open v"
  7093   then have ov: "open v"
  7090     by (simp add: v_def open_winding_number_levelsets loop)
  7094     by (simp add: v_def open_winding_number_levelsets loop)
  7091   have uv_Un: "u \<union> v = UNIV"
  7095   have uv_Un: "u \<union> v = UNIV"
  7118     using \<open>valid_path \<gamma>\<close> pasz
  7122     using \<open>valid_path \<gamma>\<close> pasz
  7119     apply (auto simp: u open_delete)
  7123     apply (auto simp: u open_delete)
  7120     apply (rule continuous_intros holomorphic_intros continuous_on_subset [OF conf] holomorphic_on_subset [OF holf] |
  7124     apply (rule continuous_intros holomorphic_intros continuous_on_subset [OF conf] holomorphic_on_subset [OF holf] |
  7121                 force simp add: that)+
  7125                 force simp add: that)+
  7122     done
  7126     done
  7123   def h \<equiv> "\<lambda>z. if z \<in> u then contour_integral \<gamma> (d z) else contour_integral \<gamma> (\<lambda>w. f w/(w - z))"
  7127   define h where
       
  7128     "h z = (if z \<in> u then contour_integral \<gamma> (d z) else contour_integral \<gamma> (\<lambda>w. f w/(w - z)))" for z
  7124   have U: "\<And>z. z \<in> u \<Longrightarrow> ((d z) has_contour_integral h z) \<gamma>"
  7129   have U: "\<And>z. z \<in> u \<Longrightarrow> ((d z) has_contour_integral h z) \<gamma>"
  7125     apply (simp add: h_def)
  7130     apply (simp add: h_def)
  7126     apply (rule has_contour_integral_integral [OF contour_integrable_holomorphic_simple [where s=u]])
  7131     apply (rule has_contour_integral_integral [OF contour_integrable_holomorphic_simple [where s=u]])
  7127     using u pasz \<open>valid_path \<gamma>\<close>
  7132     using u pasz \<open>valid_path \<gamma>\<close>
  7128     apply (auto intro: holomorphic_on_imp_continuous_on hol_d)
  7133     apply (auto intro: holomorphic_on_imp_continuous_on hol_d)