src/HOL/Multivariate_Analysis/Complex_Analysis_Basics.thy
changeset 62534 6855b348e828
parent 62533 bc25f3916a99
child 62540 f2fc5485e3b0
equal deleted inserted replaced
62533:bc25f3916a99 62534:6855b348e828
   275   assumes "eventually (\<lambda>x. norm(f x) \<le> Re(g x)) F" "(g \<longlongrightarrow> 0) F" shows "(f \<longlongrightarrow> 0) F"
   275   assumes "eventually (\<lambda>x. norm(f x) \<le> Re(g x)) F" "(g \<longlongrightarrow> 0) F" shows "(f \<longlongrightarrow> 0) F"
   276   by (rule Lim_null_comparison[OF assms(1)] tendsto_eq_intros assms(2))+ simp
   276   by (rule Lim_null_comparison[OF assms(1)] tendsto_eq_intros assms(2))+ simp
   277 
   277 
   278 subsection\<open>Holomorphic functions\<close>
   278 subsection\<open>Holomorphic functions\<close>
   279 
   279 
   280 definition complex_differentiable :: "['a \<Rightarrow> 'a::real_normed_field, 'a filter] \<Rightarrow> bool"
   280 definition field_differentiable :: "['a \<Rightarrow> 'a::real_normed_field, 'a filter] \<Rightarrow> bool"
   281            (infixr "(complex'_differentiable)" 50)
   281            (infixr "(field'_differentiable)" 50)
   282   where "f complex_differentiable F \<equiv> \<exists>f'. (f has_field_derivative f') F"
   282   where "f field_differentiable F \<equiv> \<exists>f'. (f has_field_derivative f') F"
   283 
   283 
   284 lemma complex_differentiable_derivI:
   284 lemma field_differentiable_derivI:
   285     "f complex_differentiable (at x) \<Longrightarrow> (f has_field_derivative deriv f x) (at x)"
   285     "f field_differentiable (at x) \<Longrightarrow> (f has_field_derivative deriv f x) (at x)"
   286 by (simp add: complex_differentiable_def DERIV_deriv_iff_has_field_derivative)
   286 by (simp add: field_differentiable_def DERIV_deriv_iff_has_field_derivative)
   287 
   287 
   288 lemma complex_differentiable_imp_continuous_at:
   288 lemma field_differentiable_imp_continuous_at:
   289     "f complex_differentiable (at x within s) \<Longrightarrow> continuous (at x within s) f"
   289     "f field_differentiable (at x within s) \<Longrightarrow> continuous (at x within s) f"
   290   by (metis DERIV_continuous complex_differentiable_def)
   290   by (metis DERIV_continuous field_differentiable_def)
   291 
   291 
   292 lemma complex_differentiable_within_subset:
   292 lemma field_differentiable_within_subset:
   293     "\<lbrakk>f complex_differentiable (at x within s); t \<subseteq> s\<rbrakk>
   293     "\<lbrakk>f field_differentiable (at x within s); t \<subseteq> s\<rbrakk>
   294      \<Longrightarrow> f complex_differentiable (at x within t)"
   294      \<Longrightarrow> f field_differentiable (at x within t)"
   295   by (metis DERIV_subset complex_differentiable_def)
   295   by (metis DERIV_subset field_differentiable_def)
   296 
   296 
   297 lemma complex_differentiable_at_within:
   297 lemma field_differentiable_at_within:
   298     "\<lbrakk>f complex_differentiable (at x)\<rbrakk>
   298     "\<lbrakk>f field_differentiable (at x)\<rbrakk>
   299      \<Longrightarrow> f complex_differentiable (at x within s)"
   299      \<Longrightarrow> f field_differentiable (at x within s)"
   300   unfolding complex_differentiable_def
   300   unfolding field_differentiable_def
   301   by (metis DERIV_subset top_greatest)
   301   by (metis DERIV_subset top_greatest)
   302 
   302 
   303 lemma complex_differentiable_linear [simp,derivative_intros]: "(op * c) complex_differentiable F"
   303 lemma field_differentiable_linear [simp,derivative_intros]: "(op * c) field_differentiable F"
   304 proof -
   304 proof -
   305   show ?thesis
   305   show ?thesis
   306     unfolding complex_differentiable_def has_field_derivative_def mult_commute_abs
   306     unfolding field_differentiable_def has_field_derivative_def mult_commute_abs
   307     by (force intro: has_derivative_mult_right)
   307     by (force intro: has_derivative_mult_right)
   308 qed
   308 qed
   309 
   309 
   310 lemma complex_differentiable_const [simp,derivative_intros]: "(\<lambda>z. c) complex_differentiable F"
   310 lemma field_differentiable_const [simp,derivative_intros]: "(\<lambda>z. c) field_differentiable F"
   311   unfolding complex_differentiable_def has_field_derivative_def
   311   unfolding field_differentiable_def has_field_derivative_def
   312   by (rule exI [where x=0])
   312   by (rule exI [where x=0])
   313      (metis has_derivative_const lambda_zero)
   313      (metis has_derivative_const lambda_zero)
   314 
   314 
   315 lemma complex_differentiable_ident [simp,derivative_intros]: "(\<lambda>z. z) complex_differentiable F"
   315 lemma field_differentiable_ident [simp,derivative_intros]: "(\<lambda>z. z) field_differentiable F"
   316   unfolding complex_differentiable_def has_field_derivative_def
   316   unfolding field_differentiable_def has_field_derivative_def
   317   by (rule exI [where x=1])
   317   by (rule exI [where x=1])
   318      (simp add: lambda_one [symmetric])
   318      (simp add: lambda_one [symmetric])
   319 
   319 
   320 lemma complex_differentiable_id [simp,derivative_intros]: "id complex_differentiable F"
   320 lemma field_differentiable_id [simp,derivative_intros]: "id field_differentiable F"
   321   unfolding id_def by (rule complex_differentiable_ident)
   321   unfolding id_def by (rule field_differentiable_ident)
   322 
   322 
   323 lemma complex_differentiable_minus [derivative_intros]:
   323 lemma field_differentiable_minus [derivative_intros]:
   324   "f complex_differentiable F \<Longrightarrow> (\<lambda>z. - (f z)) complex_differentiable F"
   324   "f field_differentiable F \<Longrightarrow> (\<lambda>z. - (f z)) field_differentiable F"
   325   using assms unfolding complex_differentiable_def
   325   using assms unfolding field_differentiable_def
   326   by (metis field_differentiable_minus)
   326   by (metis field_differentiable_minus)
   327 
   327 
   328 lemma complex_differentiable_add [derivative_intros]:
   328 lemma field_differentiable_add [derivative_intros]:
   329   assumes "f complex_differentiable F" "g complex_differentiable F"
   329   assumes "f field_differentiable F" "g field_differentiable F"
   330     shows "(\<lambda>z. f z + g z) complex_differentiable F"
   330     shows "(\<lambda>z. f z + g z) field_differentiable F"
   331   using assms unfolding complex_differentiable_def
   331   using assms unfolding field_differentiable_def
   332   by (metis field_differentiable_add)
   332   by (metis field_differentiable_add)
   333 
   333 
   334 lemma complex_differentiable_add_const [simp,derivative_intros]:
   334 lemma field_differentiable_add_const [simp,derivative_intros]:
   335      "op + c complex_differentiable F"
   335      "op + c field_differentiable F"
   336   by (simp add: complex_differentiable_add)
   336   by (simp add: field_differentiable_add)
   337 
   337 
   338 lemma complex_differentiable_setsum [derivative_intros]:
   338 lemma field_differentiable_setsum [derivative_intros]:
   339   "(\<And>i. i \<in> I \<Longrightarrow> (f i) complex_differentiable F) \<Longrightarrow> (\<lambda>z. \<Sum>i\<in>I. f i z) complex_differentiable F"
   339   "(\<And>i. i \<in> I \<Longrightarrow> (f i) field_differentiable F) \<Longrightarrow> (\<lambda>z. \<Sum>i\<in>I. f i z) field_differentiable F"
   340   by (induct I rule: infinite_finite_induct)
   340   by (induct I rule: infinite_finite_induct)
   341      (auto intro: complex_differentiable_add complex_differentiable_const)
   341      (auto intro: field_differentiable_add field_differentiable_const)
   342 
   342 
   343 lemma complex_differentiable_diff [derivative_intros]:
   343 lemma field_differentiable_diff [derivative_intros]:
   344   assumes "f complex_differentiable F" "g complex_differentiable F"
   344   assumes "f field_differentiable F" "g field_differentiable F"
   345     shows "(\<lambda>z. f z - g z) complex_differentiable F"
   345     shows "(\<lambda>z. f z - g z) field_differentiable F"
   346   using assms unfolding complex_differentiable_def
   346   using assms unfolding field_differentiable_def
   347   by (metis field_differentiable_diff)
   347   by (metis field_differentiable_diff)
   348 
   348 
   349 lemma complex_differentiable_inverse [derivative_intros]:
   349 lemma field_differentiable_inverse [derivative_intros]:
   350   assumes "f complex_differentiable (at a within s)" "f a \<noteq> 0"
   350   assumes "f field_differentiable (at a within s)" "f a \<noteq> 0"
   351   shows "(\<lambda>z. inverse (f z)) complex_differentiable (at a within s)"
   351   shows "(\<lambda>z. inverse (f z)) field_differentiable (at a within s)"
   352   using assms unfolding complex_differentiable_def
   352   using assms unfolding field_differentiable_def
   353   by (metis DERIV_inverse_fun)
   353   by (metis DERIV_inverse_fun)
   354 
   354 
   355 lemma complex_differentiable_mult [derivative_intros]:
   355 lemma field_differentiable_mult [derivative_intros]:
   356   assumes "f complex_differentiable (at a within s)"
   356   assumes "f field_differentiable (at a within s)"
   357           "g complex_differentiable (at a within s)"
   357           "g field_differentiable (at a within s)"
   358     shows "(\<lambda>z. f z * g z) complex_differentiable (at a within s)"
   358     shows "(\<lambda>z. f z * g z) field_differentiable (at a within s)"
   359   using assms unfolding complex_differentiable_def
   359   using assms unfolding field_differentiable_def
   360   by (metis DERIV_mult [of f _ a s g])
   360   by (metis DERIV_mult [of f _ a s g])
   361 
   361 
   362 lemma complex_differentiable_divide [derivative_intros]:
   362 lemma field_differentiable_divide [derivative_intros]:
   363   assumes "f complex_differentiable (at a within s)"
   363   assumes "f field_differentiable (at a within s)"
   364           "g complex_differentiable (at a within s)"
   364           "g field_differentiable (at a within s)"
   365           "g a \<noteq> 0"
   365           "g a \<noteq> 0"
   366     shows "(\<lambda>z. f z / g z) complex_differentiable (at a within s)"
   366     shows "(\<lambda>z. f z / g z) field_differentiable (at a within s)"
   367   using assms unfolding complex_differentiable_def
   367   using assms unfolding field_differentiable_def
   368   by (metis DERIV_divide [of f _ a s g])
   368   by (metis DERIV_divide [of f _ a s g])
   369 
   369 
   370 lemma complex_differentiable_power [derivative_intros]:
   370 lemma field_differentiable_power [derivative_intros]:
   371   assumes "f complex_differentiable (at a within s)"
   371   assumes "f field_differentiable (at a within s)"
   372     shows "(\<lambda>z. f z ^ n) complex_differentiable (at a within s)"
   372     shows "(\<lambda>z. f z ^ n) field_differentiable (at a within s)"
   373   using assms unfolding complex_differentiable_def
   373   using assms unfolding field_differentiable_def
   374   by (metis DERIV_power)
   374   by (metis DERIV_power)
   375 
   375 
   376 lemma complex_differentiable_transform_within:
   376 lemma field_differentiable_transform_within:
   377   "0 < d \<Longrightarrow>
   377   "0 < d \<Longrightarrow>
   378         x \<in> s \<Longrightarrow>
   378         x \<in> s \<Longrightarrow>
   379         (\<And>x'. x' \<in> s \<Longrightarrow> dist x' x < d \<Longrightarrow> f x' = g x') \<Longrightarrow>
   379         (\<And>x'. x' \<in> s \<Longrightarrow> dist x' x < d \<Longrightarrow> f x' = g x') \<Longrightarrow>
   380         f complex_differentiable (at x within s)
   380         f field_differentiable (at x within s)
   381         \<Longrightarrow> g complex_differentiable (at x within s)"
   381         \<Longrightarrow> g field_differentiable (at x within s)"
   382   unfolding complex_differentiable_def has_field_derivative_def
   382   unfolding field_differentiable_def has_field_derivative_def
   383   by (blast intro: has_derivative_transform_within)
   383   by (blast intro: has_derivative_transform_within)
   384 
   384 
   385 lemma complex_differentiable_compose_within:
   385 lemma field_differentiable_compose_within:
   386   assumes "f complex_differentiable (at a within s)"
   386   assumes "f field_differentiable (at a within s)"
   387           "g complex_differentiable (at (f a) within f`s)"
   387           "g field_differentiable (at (f a) within f`s)"
   388     shows "(g o f) complex_differentiable (at a within s)"
   388     shows "(g o f) field_differentiable (at a within s)"
   389   using assms unfolding complex_differentiable_def
   389   using assms unfolding field_differentiable_def
   390   by (metis DERIV_image_chain)
   390   by (metis DERIV_image_chain)
   391 
   391 
   392 lemma complex_differentiable_compose:
   392 lemma field_differentiable_compose:
   393   "f complex_differentiable at z \<Longrightarrow> g complex_differentiable at (f z)
   393   "f field_differentiable at z \<Longrightarrow> g field_differentiable at (f z)
   394           \<Longrightarrow> (g o f) complex_differentiable at z"
   394           \<Longrightarrow> (g o f) field_differentiable at z"
   395 by (metis complex_differentiable_at_within complex_differentiable_compose_within)
   395 by (metis field_differentiable_at_within field_differentiable_compose_within)
   396 
   396 
   397 lemma complex_differentiable_within_open:
   397 lemma field_differentiable_within_open:
   398      "\<lbrakk>a \<in> s; open s\<rbrakk> \<Longrightarrow> f complex_differentiable at a within s \<longleftrightarrow>
   398      "\<lbrakk>a \<in> s; open s\<rbrakk> \<Longrightarrow> f field_differentiable at a within s \<longleftrightarrow>
   399                           f complex_differentiable at a"
   399                           f field_differentiable at a"
   400   unfolding complex_differentiable_def
   400   unfolding field_differentiable_def
   401   by (metis at_within_open)
   401   by (metis at_within_open)
   402 
   402 
   403 subsection\<open>Caratheodory characterization\<close>
   403 subsection\<open>Caratheodory characterization\<close>
   404 
   404 
   405 lemma complex_differentiable_caratheodory_at:
   405 lemma field_differentiable_caratheodory_at:
   406   "f complex_differentiable (at z) \<longleftrightarrow>
   406   "f field_differentiable (at z) \<longleftrightarrow>
   407          (\<exists>g. (\<forall>w. f(w) - f(z) = g(w) * (w - z)) \<and> continuous (at z) g)"
   407          (\<exists>g. (\<forall>w. f(w) - f(z) = g(w) * (w - z)) \<and> continuous (at z) g)"
   408   using CARAT_DERIV [of f]
   408   using CARAT_DERIV [of f]
   409   by (simp add: complex_differentiable_def has_field_derivative_def)
   409   by (simp add: field_differentiable_def has_field_derivative_def)
   410 
   410 
   411 lemma complex_differentiable_caratheodory_within:
   411 lemma field_differentiable_caratheodory_within:
   412   "f complex_differentiable (at z within s) \<longleftrightarrow>
   412   "f field_differentiable (at z within s) \<longleftrightarrow>
   413          (\<exists>g. (\<forall>w. f(w) - f(z) = g(w) * (w - z)) \<and> continuous (at z within s) g)"
   413          (\<exists>g. (\<forall>w. f(w) - f(z) = g(w) * (w - z)) \<and> continuous (at z within s) g)"
   414   using DERIV_caratheodory_within [of f]
   414   using DERIV_caratheodory_within [of f]
   415   by (simp add: complex_differentiable_def has_field_derivative_def)
   415   by (simp add: field_differentiable_def has_field_derivative_def)
   416 
   416 
   417 subsection\<open>Holomorphic\<close>
   417 subsection\<open>Holomorphic\<close>
   418 
   418 
   419 definition holomorphic_on :: "[complex \<Rightarrow> complex, complex set] \<Rightarrow> bool"
   419 definition holomorphic_on :: "[complex \<Rightarrow> complex, complex set] \<Rightarrow> bool"
   420            (infixl "(holomorphic'_on)" 50)
   420            (infixl "(holomorphic'_on)" 50)
   421   where "f holomorphic_on s \<equiv> \<forall>x\<in>s. f complex_differentiable (at x within s)"
   421   where "f holomorphic_on s \<equiv> \<forall>x\<in>s. f field_differentiable (at x within s)"
   422 
   422 
   423 named_theorems holomorphic_intros "structural introduction rules for holomorphic_on"
   423 named_theorems holomorphic_intros "structural introduction rules for holomorphic_on"
   424 
   424 
   425 lemma holomorphic_onI [intro?]: "(\<And>x. x \<in> s \<Longrightarrow> f complex_differentiable (at x within s)) \<Longrightarrow> f holomorphic_on s"
   425 lemma holomorphic_onI [intro?]: "(\<And>x. x \<in> s \<Longrightarrow> f field_differentiable (at x within s)) \<Longrightarrow> f holomorphic_on s"
   426   by (simp add: holomorphic_on_def)
   426   by (simp add: holomorphic_on_def)
   427 
   427 
   428 lemma holomorphic_onD [dest?]: "\<lbrakk>f holomorphic_on s; x \<in> s\<rbrakk> \<Longrightarrow> f complex_differentiable (at x within s)"
   428 lemma holomorphic_onD [dest?]: "\<lbrakk>f holomorphic_on s; x \<in> s\<rbrakk> \<Longrightarrow> f field_differentiable (at x within s)"
   429   by (simp add: holomorphic_on_def)
   429   by (simp add: holomorphic_on_def)
   430 
   430 
   431 lemma holomorphic_on_imp_differentiable_at:
   431 lemma holomorphic_on_imp_differentiable_at:
   432    "\<lbrakk>f holomorphic_on s; open s; x \<in> s\<rbrakk> \<Longrightarrow> f complex_differentiable (at x)"
   432    "\<lbrakk>f holomorphic_on s; open s; x \<in> s\<rbrakk> \<Longrightarrow> f field_differentiable (at x)"
   433 using at_within_open holomorphic_on_def by fastforce
   433 using at_within_open holomorphic_on_def by fastforce
   434 
   434 
   435 lemma holomorphic_on_empty [holomorphic_intros]: "f holomorphic_on {}"
   435 lemma holomorphic_on_empty [holomorphic_intros]: "f holomorphic_on {}"
   436   by (simp add: holomorphic_on_def)
   436   by (simp add: holomorphic_on_def)
   437 
   437 
   438 lemma holomorphic_on_open:
   438 lemma holomorphic_on_open:
   439     "open s \<Longrightarrow> f holomorphic_on s \<longleftrightarrow> (\<forall>x \<in> s. \<exists>f'. DERIV f x :> f')"
   439     "open s \<Longrightarrow> f holomorphic_on s \<longleftrightarrow> (\<forall>x \<in> s. \<exists>f'. DERIV f x :> f')"
   440   by (auto simp: holomorphic_on_def complex_differentiable_def has_field_derivative_def at_within_open [of _ s])
   440   by (auto simp: holomorphic_on_def field_differentiable_def has_field_derivative_def at_within_open [of _ s])
   441 
   441 
   442 lemma holomorphic_on_imp_continuous_on:
   442 lemma holomorphic_on_imp_continuous_on:
   443     "f holomorphic_on s \<Longrightarrow> continuous_on s f"
   443     "f holomorphic_on s \<Longrightarrow> continuous_on s f"
   444   by (metis complex_differentiable_imp_continuous_at continuous_on_eq_continuous_within holomorphic_on_def)
   444   by (metis field_differentiable_imp_continuous_at continuous_on_eq_continuous_within holomorphic_on_def)
   445 
   445 
   446 lemma holomorphic_on_subset:
   446 lemma holomorphic_on_subset:
   447     "f holomorphic_on s \<Longrightarrow> t \<subseteq> s \<Longrightarrow> f holomorphic_on t"
   447     "f holomorphic_on s \<Longrightarrow> t \<subseteq> s \<Longrightarrow> f holomorphic_on t"
   448   unfolding holomorphic_on_def
   448   unfolding holomorphic_on_def
   449   by (metis complex_differentiable_within_subset subsetD)
   449   by (metis field_differentiable_within_subset subsetD)
   450 
   450 
   451 lemma holomorphic_transform: "\<lbrakk>f holomorphic_on s; \<And>x. x \<in> s \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> g holomorphic_on s"
   451 lemma holomorphic_transform: "\<lbrakk>f holomorphic_on s; \<And>x. x \<in> s \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> g holomorphic_on s"
   452   by (metis complex_differentiable_transform_within linordered_field_no_ub holomorphic_on_def)
   452   by (metis field_differentiable_transform_within linordered_field_no_ub holomorphic_on_def)
   453 
   453 
   454 lemma holomorphic_cong: "s = t ==> (\<And>x. x \<in> s \<Longrightarrow> f x = g x) \<Longrightarrow> f holomorphic_on s \<longleftrightarrow> g holomorphic_on t"
   454 lemma holomorphic_cong: "s = t ==> (\<And>x. x \<in> s \<Longrightarrow> f x = g x) \<Longrightarrow> f holomorphic_on s \<longleftrightarrow> g holomorphic_on t"
   455   by (metis holomorphic_transform)
   455   by (metis holomorphic_transform)
   456 
   456 
   457 lemma holomorphic_on_linear [simp, holomorphic_intros]: "(op * c) holomorphic_on s"
   457 lemma holomorphic_on_linear [simp, holomorphic_intros]: "(op * c) holomorphic_on s"
   458   unfolding holomorphic_on_def by (metis complex_differentiable_linear)
   458   unfolding holomorphic_on_def by (metis field_differentiable_linear)
   459 
   459 
   460 lemma holomorphic_on_const [simp, holomorphic_intros]: "(\<lambda>z. c) holomorphic_on s"
   460 lemma holomorphic_on_const [simp, holomorphic_intros]: "(\<lambda>z. c) holomorphic_on s"
   461   unfolding holomorphic_on_def by (metis complex_differentiable_const)
   461   unfolding holomorphic_on_def by (metis field_differentiable_const)
   462 
   462 
   463 lemma holomorphic_on_ident [simp, holomorphic_intros]: "(\<lambda>x. x) holomorphic_on s"
   463 lemma holomorphic_on_ident [simp, holomorphic_intros]: "(\<lambda>x. x) holomorphic_on s"
   464   unfolding holomorphic_on_def by (metis complex_differentiable_ident)
   464   unfolding holomorphic_on_def by (metis field_differentiable_ident)
   465 
   465 
   466 lemma holomorphic_on_id [simp, holomorphic_intros]: "id holomorphic_on s"
   466 lemma holomorphic_on_id [simp, holomorphic_intros]: "id holomorphic_on s"
   467   unfolding id_def by (rule holomorphic_on_ident)
   467   unfolding id_def by (rule holomorphic_on_ident)
   468 
   468 
   469 lemma holomorphic_on_compose:
   469 lemma holomorphic_on_compose:
   470   "f holomorphic_on s \<Longrightarrow> g holomorphic_on (f ` s) \<Longrightarrow> (g o f) holomorphic_on s"
   470   "f holomorphic_on s \<Longrightarrow> g holomorphic_on (f ` s) \<Longrightarrow> (g o f) holomorphic_on s"
   471   using complex_differentiable_compose_within[of f _ s g]
   471   using field_differentiable_compose_within[of f _ s g]
   472   by (auto simp: holomorphic_on_def)
   472   by (auto simp: holomorphic_on_def)
   473 
   473 
   474 lemma holomorphic_on_compose_gen:
   474 lemma holomorphic_on_compose_gen:
   475   "f holomorphic_on s \<Longrightarrow> g holomorphic_on t \<Longrightarrow> f ` s \<subseteq> t \<Longrightarrow> (g o f) holomorphic_on s"
   475   "f holomorphic_on s \<Longrightarrow> g holomorphic_on t \<Longrightarrow> f ` s \<subseteq> t \<Longrightarrow> (g o f) holomorphic_on s"
   476   by (metis holomorphic_on_compose holomorphic_on_subset)
   476   by (metis holomorphic_on_compose holomorphic_on_subset)
   477 
   477 
   478 lemma holomorphic_on_minus [holomorphic_intros]: "f holomorphic_on s \<Longrightarrow> (\<lambda>z. -(f z)) holomorphic_on s"
   478 lemma holomorphic_on_minus [holomorphic_intros]: "f holomorphic_on s \<Longrightarrow> (\<lambda>z. -(f z)) holomorphic_on s"
   479   by (metis complex_differentiable_minus holomorphic_on_def)
   479   by (metis field_differentiable_minus holomorphic_on_def)
   480 
   480 
   481 lemma holomorphic_on_add [holomorphic_intros]:
   481 lemma holomorphic_on_add [holomorphic_intros]:
   482   "\<lbrakk>f holomorphic_on s; g holomorphic_on s\<rbrakk> \<Longrightarrow> (\<lambda>z. f z + g z) holomorphic_on s"
   482   "\<lbrakk>f holomorphic_on s; g holomorphic_on s\<rbrakk> \<Longrightarrow> (\<lambda>z. f z + g z) holomorphic_on s"
   483   unfolding holomorphic_on_def by (metis complex_differentiable_add)
   483   unfolding holomorphic_on_def by (metis field_differentiable_add)
   484 
   484 
   485 lemma holomorphic_on_diff [holomorphic_intros]:
   485 lemma holomorphic_on_diff [holomorphic_intros]:
   486   "\<lbrakk>f holomorphic_on s; g holomorphic_on s\<rbrakk> \<Longrightarrow> (\<lambda>z. f z - g z) holomorphic_on s"
   486   "\<lbrakk>f holomorphic_on s; g holomorphic_on s\<rbrakk> \<Longrightarrow> (\<lambda>z. f z - g z) holomorphic_on s"
   487   unfolding holomorphic_on_def by (metis complex_differentiable_diff)
   487   unfolding holomorphic_on_def by (metis field_differentiable_diff)
   488 
   488 
   489 lemma holomorphic_on_mult [holomorphic_intros]:
   489 lemma holomorphic_on_mult [holomorphic_intros]:
   490   "\<lbrakk>f holomorphic_on s; g holomorphic_on s\<rbrakk> \<Longrightarrow> (\<lambda>z. f z * g z) holomorphic_on s"
   490   "\<lbrakk>f holomorphic_on s; g holomorphic_on s\<rbrakk> \<Longrightarrow> (\<lambda>z. f z * g z) holomorphic_on s"
   491   unfolding holomorphic_on_def by (metis complex_differentiable_mult)
   491   unfolding holomorphic_on_def by (metis field_differentiable_mult)
   492 
   492 
   493 lemma holomorphic_on_inverse [holomorphic_intros]:
   493 lemma holomorphic_on_inverse [holomorphic_intros]:
   494   "\<lbrakk>f holomorphic_on s; \<And>z. z \<in> s \<Longrightarrow> f z \<noteq> 0\<rbrakk> \<Longrightarrow> (\<lambda>z. inverse (f z)) holomorphic_on s"
   494   "\<lbrakk>f holomorphic_on s; \<And>z. z \<in> s \<Longrightarrow> f z \<noteq> 0\<rbrakk> \<Longrightarrow> (\<lambda>z. inverse (f z)) holomorphic_on s"
   495   unfolding holomorphic_on_def by (metis complex_differentiable_inverse)
   495   unfolding holomorphic_on_def by (metis field_differentiable_inverse)
   496 
   496 
   497 lemma holomorphic_on_divide [holomorphic_intros]:
   497 lemma holomorphic_on_divide [holomorphic_intros]:
   498   "\<lbrakk>f holomorphic_on s; g holomorphic_on s; \<And>z. z \<in> s \<Longrightarrow> g z \<noteq> 0\<rbrakk> \<Longrightarrow> (\<lambda>z. f z / g z) holomorphic_on s"
   498   "\<lbrakk>f holomorphic_on s; g holomorphic_on s; \<And>z. z \<in> s \<Longrightarrow> g z \<noteq> 0\<rbrakk> \<Longrightarrow> (\<lambda>z. f z / g z) holomorphic_on s"
   499   unfolding holomorphic_on_def by (metis complex_differentiable_divide)
   499   unfolding holomorphic_on_def by (metis field_differentiable_divide)
   500 
   500 
   501 lemma holomorphic_on_power [holomorphic_intros]:
   501 lemma holomorphic_on_power [holomorphic_intros]:
   502   "f holomorphic_on s \<Longrightarrow> (\<lambda>z. (f z)^n) holomorphic_on s"
   502   "f holomorphic_on s \<Longrightarrow> (\<lambda>z. (f z)^n) holomorphic_on s"
   503   unfolding holomorphic_on_def by (metis complex_differentiable_power)
   503   unfolding holomorphic_on_def by (metis field_differentiable_power)
   504 
   504 
   505 lemma holomorphic_on_setsum [holomorphic_intros]:
   505 lemma holomorphic_on_setsum [holomorphic_intros]:
   506   "(\<And>i. i \<in> I \<Longrightarrow> (f i) holomorphic_on s) \<Longrightarrow> (\<lambda>x. setsum (\<lambda>i. f i x) I) holomorphic_on s"
   506   "(\<And>i. i \<in> I \<Longrightarrow> (f i) holomorphic_on s) \<Longrightarrow> (\<lambda>x. setsum (\<lambda>i. f i x) I) holomorphic_on s"
   507   unfolding holomorphic_on_def by (metis complex_differentiable_setsum)
   507   unfolding holomorphic_on_def by (metis field_differentiable_setsum)
   508 
   508 
   509 lemma DERIV_deriv_iff_complex_differentiable:
   509 lemma DERIV_deriv_iff_field_differentiable:
   510   "DERIV f x :> deriv f x \<longleftrightarrow> f complex_differentiable at x"
   510   "DERIV f x :> deriv f x \<longleftrightarrow> f field_differentiable at x"
   511   unfolding complex_differentiable_def by (metis DERIV_imp_deriv)
   511   unfolding field_differentiable_def by (metis DERIV_imp_deriv)
   512 
   512 
   513 lemma holomorphic_derivI:
   513 lemma holomorphic_derivI:
   514      "\<lbrakk>f holomorphic_on S; open S; x \<in> S\<rbrakk>
   514      "\<lbrakk>f holomorphic_on S; open S; x \<in> S\<rbrakk>
   515       \<Longrightarrow> (f has_field_derivative deriv f x) (at x within T)"
   515       \<Longrightarrow> (f has_field_derivative deriv f x) (at x within T)"
   516 by (metis DERIV_deriv_iff_complex_differentiable at_within_open  holomorphic_on_def has_field_derivative_at_within)
   516 by (metis DERIV_deriv_iff_field_differentiable at_within_open  holomorphic_on_def has_field_derivative_at_within)
   517 
   517 
   518 lemma complex_derivative_chain:
   518 lemma complex_derivative_chain:
   519   "f complex_differentiable at x \<Longrightarrow> g complex_differentiable at (f x)
   519   "f field_differentiable at x \<Longrightarrow> g field_differentiable at (f x)
   520     \<Longrightarrow> deriv (g o f) x = deriv g (f x) * deriv f x"
   520     \<Longrightarrow> deriv (g o f) x = deriv g (f x) * deriv f x"
   521   by (metis DERIV_deriv_iff_complex_differentiable DERIV_chain DERIV_imp_deriv)
   521   by (metis DERIV_deriv_iff_field_differentiable DERIV_chain DERIV_imp_deriv)
   522 
   522 
   523 lemma deriv_linear [simp]: "deriv (\<lambda>w. c * w) = (\<lambda>z. c)"
   523 lemma deriv_linear [simp]: "deriv (\<lambda>w. c * w) = (\<lambda>z. c)"
   524   by (metis DERIV_imp_deriv DERIV_cmult_Id)
   524   by (metis DERIV_imp_deriv DERIV_cmult_Id)
   525 
   525 
   526 lemma deriv_ident [simp]: "deriv (\<lambda>w. w) = (\<lambda>z. 1)"
   526 lemma deriv_ident [simp]: "deriv (\<lambda>w. w) = (\<lambda>z. 1)"
   530   by (simp add: id_def)
   530   by (simp add: id_def)
   531 
   531 
   532 lemma deriv_const [simp]: "deriv (\<lambda>w. c) = (\<lambda>z. 0)"
   532 lemma deriv_const [simp]: "deriv (\<lambda>w. c) = (\<lambda>z. 0)"
   533   by (metis DERIV_imp_deriv DERIV_const)
   533   by (metis DERIV_imp_deriv DERIV_const)
   534 
   534 
   535 lemma complex_derivative_add [simp]:
   535 lemma deriv_add [simp]:
   536   "\<lbrakk>f complex_differentiable at z; g complex_differentiable at z\<rbrakk>
   536   "\<lbrakk>f field_differentiable at z; g field_differentiable at z\<rbrakk>
   537    \<Longrightarrow> deriv (\<lambda>w. f w + g w) z = deriv f z + deriv g z"
   537    \<Longrightarrow> deriv (\<lambda>w. f w + g w) z = deriv f z + deriv g z"
   538   unfolding DERIV_deriv_iff_complex_differentiable[symmetric]
   538   unfolding DERIV_deriv_iff_field_differentiable[symmetric]
   539   by (auto intro!: DERIV_imp_deriv derivative_intros)
   539   by (auto intro!: DERIV_imp_deriv derivative_intros)
   540 
   540 
   541 lemma complex_derivative_diff [simp]:
   541 lemma deriv_diff [simp]:
   542   "\<lbrakk>f complex_differentiable at z; g complex_differentiable at z\<rbrakk>
   542   "\<lbrakk>f field_differentiable at z; g field_differentiable at z\<rbrakk>
   543    \<Longrightarrow> deriv (\<lambda>w. f w - g w) z = deriv f z - deriv g z"
   543    \<Longrightarrow> deriv (\<lambda>w. f w - g w) z = deriv f z - deriv g z"
   544   unfolding DERIV_deriv_iff_complex_differentiable[symmetric]
   544   unfolding DERIV_deriv_iff_field_differentiable[symmetric]
   545   by (auto intro!: DERIV_imp_deriv derivative_intros)
   545   by (auto intro!: DERIV_imp_deriv derivative_intros)
   546 
   546 
   547 lemma complex_derivative_mult [simp]:
   547 lemma deriv_mult [simp]:
   548   "\<lbrakk>f complex_differentiable at z; g complex_differentiable at z\<rbrakk>
   548   "\<lbrakk>f field_differentiable at z; g field_differentiable at z\<rbrakk>
   549    \<Longrightarrow> deriv (\<lambda>w. f w * g w) z = f z * deriv g z + deriv f z * g z"
   549    \<Longrightarrow> deriv (\<lambda>w. f w * g w) z = f z * deriv g z + deriv f z * g z"
   550   unfolding DERIV_deriv_iff_complex_differentiable[symmetric]
   550   unfolding DERIV_deriv_iff_field_differentiable[symmetric]
   551   by (auto intro!: DERIV_imp_deriv derivative_eq_intros)
   551   by (auto intro!: DERIV_imp_deriv derivative_eq_intros)
   552 
   552 
   553 lemma complex_derivative_cmult [simp]:
   553 lemma deriv_cmult [simp]:
   554   "f complex_differentiable at z \<Longrightarrow> deriv (\<lambda>w. c * f w) z = c * deriv f z"
   554   "f field_differentiable at z \<Longrightarrow> deriv (\<lambda>w. c * f w) z = c * deriv f z"
   555   unfolding DERIV_deriv_iff_complex_differentiable[symmetric]
   555   unfolding DERIV_deriv_iff_field_differentiable[symmetric]
   556   by (auto intro!: DERIV_imp_deriv derivative_eq_intros)
   556   by (auto intro!: DERIV_imp_deriv derivative_eq_intros)
   557 
   557 
   558 lemma complex_derivative_cmult_right [simp]:
   558 lemma deriv_cmult_right [simp]:
   559   "f complex_differentiable at z \<Longrightarrow> deriv (\<lambda>w. f w * c) z = deriv f z * c"
   559   "f field_differentiable at z \<Longrightarrow> deriv (\<lambda>w. f w * c) z = deriv f z * c"
   560   unfolding DERIV_deriv_iff_complex_differentiable[symmetric]
   560   unfolding DERIV_deriv_iff_field_differentiable[symmetric]
   561   by (auto intro!: DERIV_imp_deriv derivative_eq_intros)
   561   by (auto intro!: DERIV_imp_deriv derivative_eq_intros)
   562 
   562 
   563 lemma complex_derivative_cdivide_right [simp]:
   563 lemma deriv_cdivide_right [simp]:
   564   "f complex_differentiable at z \<Longrightarrow> deriv (\<lambda>w. f w / c) z = deriv f z / c"
   564   "f field_differentiable at z \<Longrightarrow> deriv (\<lambda>w. f w / c) z = deriv f z / c"
   565   unfolding Fields.field_class.field_divide_inverse
   565   unfolding Fields.field_class.field_divide_inverse
   566   by (blast intro: complex_derivative_cmult_right)
   566   by (blast intro: deriv_cmult_right)
   567 
   567 
   568 lemma complex_derivative_transform_within_open:
   568 lemma complex_derivative_transform_within_open:
   569   "\<lbrakk>f holomorphic_on s; g holomorphic_on s; open s; z \<in> s; \<And>w. w \<in> s \<Longrightarrow> f w = g w\<rbrakk>
   569   "\<lbrakk>f holomorphic_on s; g holomorphic_on s; open s; z \<in> s; \<And>w. w \<in> s \<Longrightarrow> f w = g w\<rbrakk>
   570    \<Longrightarrow> deriv f z = deriv g z"
   570    \<Longrightarrow> deriv f z = deriv g z"
   571   unfolding holomorphic_on_def
   571   unfolding holomorphic_on_def
   572   by (rule DERIV_imp_deriv)
   572   by (rule DERIV_imp_deriv)
   573      (metis DERIV_deriv_iff_complex_differentiable DERIV_transform_within_open at_within_open)
   573      (metis DERIV_deriv_iff_field_differentiable DERIV_transform_within_open at_within_open)
   574 
   574 
   575 lemma complex_derivative_compose_linear:
   575 lemma deriv_compose_linear:
   576   "f complex_differentiable at (c * z) \<Longrightarrow> deriv (\<lambda>w. f (c * w)) z = c * deriv f (c * z)"
   576   "f field_differentiable at (c * z) \<Longrightarrow> deriv (\<lambda>w. f (c * w)) z = c * deriv f (c * z)"
   577 apply (rule DERIV_imp_deriv)
   577 apply (rule DERIV_imp_deriv)
   578 apply (simp add: DERIV_deriv_iff_complex_differentiable [symmetric])
   578 apply (simp add: DERIV_deriv_iff_field_differentiable [symmetric])
   579 apply (drule DERIV_chain' [of "times c" c z UNIV f "deriv f (c * z)", OF DERIV_cmult_Id])
   579 apply (drule DERIV_chain' [of "times c" c z UNIV f "deriv f (c * z)", OF DERIV_cmult_Id])
   580 apply (simp add: algebra_simps)
   580 apply (simp add: algebra_simps)
   581 done
   581 done
   582 
   582 
   583 lemma nonzero_deriv_nonconstant:
   583 lemma nonzero_deriv_nonconstant:
   600   where
   600   where
   601    "f analytic_on s \<equiv> \<forall>x \<in> s. \<exists>e. 0 < e \<and> f holomorphic_on (ball x e)"
   601    "f analytic_on s \<equiv> \<forall>x \<in> s. \<exists>e. 0 < e \<and> f holomorphic_on (ball x e)"
   602 
   602 
   603 lemma analytic_imp_holomorphic: "f analytic_on s \<Longrightarrow> f holomorphic_on s"
   603 lemma analytic_imp_holomorphic: "f analytic_on s \<Longrightarrow> f holomorphic_on s"
   604   by (simp add: at_within_open [OF _ open_ball] analytic_on_def holomorphic_on_def)
   604   by (simp add: at_within_open [OF _ open_ball] analytic_on_def holomorphic_on_def)
   605      (metis centre_in_ball complex_differentiable_at_within)
   605      (metis centre_in_ball field_differentiable_at_within)
   606 
   606 
   607 lemma analytic_on_open: "open s \<Longrightarrow> f analytic_on s \<longleftrightarrow> f holomorphic_on s"
   607 lemma analytic_on_open: "open s \<Longrightarrow> f analytic_on s \<longleftrightarrow> f holomorphic_on s"
   608 apply (auto simp: analytic_imp_holomorphic)
   608 apply (auto simp: analytic_imp_holomorphic)
   609 apply (auto simp: analytic_on_def holomorphic_on_def)
   609 apply (auto simp: analytic_on_def holomorphic_on_def)
   610 by (metis holomorphic_on_def holomorphic_on_subset open_contains_ball)
   610 by (metis holomorphic_on_def holomorphic_on_subset open_contains_ball)
   611 
   611 
   612 lemma analytic_on_imp_differentiable_at:
   612 lemma analytic_on_imp_differentiable_at:
   613   "f analytic_on s \<Longrightarrow> x \<in> s \<Longrightarrow> f complex_differentiable (at x)"
   613   "f analytic_on s \<Longrightarrow> x \<in> s \<Longrightarrow> f field_differentiable (at x)"
   614  apply (auto simp: analytic_on_def holomorphic_on_def)
   614  apply (auto simp: analytic_on_def holomorphic_on_def)
   615 by (metis Topology_Euclidean_Space.open_ball centre_in_ball complex_differentiable_within_open)
   615 by (metis Topology_Euclidean_Space.open_ball centre_in_ball field_differentiable_within_open)
   616 
   616 
   617 lemma analytic_on_subset: "f analytic_on s \<Longrightarrow> t \<subseteq> s \<Longrightarrow> f analytic_on t"
   617 lemma analytic_on_subset: "f analytic_on s \<Longrightarrow> t \<subseteq> s \<Longrightarrow> f analytic_on t"
   618   by (auto simp: analytic_on_def)
   618   by (auto simp: analytic_on_def)
   619 
   619 
   620 lemma analytic_on_Un: "f analytic_on (s \<union> t) \<longleftrightarrow> f analytic_on s \<and> f analytic_on t"
   620 lemma analytic_on_Un: "f analytic_on (s \<union> t) \<longleftrightarrow> f analytic_on s \<and> f analytic_on t"
   672   then obtain e where e: "0 < e" and fh: "f holomorphic_on ball x e" using f
   672   then obtain e where e: "0 < e" and fh: "f holomorphic_on ball x e" using f
   673     by (metis analytic_on_def)
   673     by (metis analytic_on_def)
   674   obtain e' where e': "0 < e'" and gh: "g holomorphic_on ball (f x) e'" using g
   674   obtain e' where e': "0 < e'" and gh: "g holomorphic_on ball (f x) e'" using g
   675     by (metis analytic_on_def g image_eqI x)
   675     by (metis analytic_on_def g image_eqI x)
   676   have "isCont f x"
   676   have "isCont f x"
   677     by (metis analytic_on_imp_differentiable_at complex_differentiable_imp_continuous_at f x)
   677     by (metis analytic_on_imp_differentiable_at field_differentiable_imp_continuous_at f x)
   678   with e' obtain d where d: "0 < d" and fd: "f ` ball x d \<subseteq> ball (f x) e'"
   678   with e' obtain d where d: "0 < d" and fd: "f ` ball x d \<subseteq> ball (f x) e'"
   679      by (auto simp: continuous_at_ball)
   679      by (auto simp: continuous_at_ball)
   680   have "g \<circ> f holomorphic_on ball x (min d e)"
   680   have "g \<circ> f holomorphic_on ball x (min d e)"
   681     apply (rule holomorphic_on_compose)
   681     apply (rule holomorphic_on_compose)
   682     apply (metis fh holomorphic_on_subset min.bounded_iff order_refl subset_ball)
   682     apply (metis fh holomorphic_on_subset min.bounded_iff order_refl subset_ball)
   862   obtain s where s: "open s" "z \<in> s" "f holomorphic_on s" "g holomorphic_on s"
   862   obtain s where s: "open s" "z \<in> s" "f holomorphic_on s" "g holomorphic_on s"
   863     using assms by (metis analytic_at_two)
   863     using assms by (metis analytic_at_two)
   864   show "deriv (\<lambda>w. f w + g w) z = deriv f z + deriv g z"
   864   show "deriv (\<lambda>w. f w + g w) z = deriv f z + deriv g z"
   865     apply (rule DERIV_imp_deriv [OF DERIV_add])
   865     apply (rule DERIV_imp_deriv [OF DERIV_add])
   866     using s
   866     using s
   867     apply (auto simp: holomorphic_on_open complex_differentiable_def DERIV_deriv_iff_complex_differentiable)
   867     apply (auto simp: holomorphic_on_open field_differentiable_def DERIV_deriv_iff_field_differentiable)
   868     done
   868     done
   869   show "deriv (\<lambda>w. f w - g w) z = deriv f z - deriv g z"
   869   show "deriv (\<lambda>w. f w - g w) z = deriv f z - deriv g z"
   870     apply (rule DERIV_imp_deriv [OF DERIV_diff])
   870     apply (rule DERIV_imp_deriv [OF DERIV_diff])
   871     using s
   871     using s
   872     apply (auto simp: holomorphic_on_open complex_differentiable_def DERIV_deriv_iff_complex_differentiable)
   872     apply (auto simp: holomorphic_on_open field_differentiable_def DERIV_deriv_iff_field_differentiable)
   873     done
   873     done
   874   show "deriv (\<lambda>w. f w * g w) z = f z * deriv g z + deriv f z * g z"
   874   show "deriv (\<lambda>w. f w * g w) z = f z * deriv g z + deriv f z * g z"
   875     apply (rule DERIV_imp_deriv [OF DERIV_mult'])
   875     apply (rule DERIV_imp_deriv [OF DERIV_mult'])
   876     using s
   876     using s
   877     apply (auto simp: holomorphic_on_open complex_differentiable_def DERIV_deriv_iff_complex_differentiable)
   877     apply (auto simp: holomorphic_on_open field_differentiable_def DERIV_deriv_iff_field_differentiable)
   878     done
   878     done
   879 qed
   879 qed
   880 
   880 
   881 lemma complex_derivative_cmult_at:
   881 lemma deriv_cmult_at:
   882   "f analytic_on {z} \<Longrightarrow>  deriv (\<lambda>w. c * f w) z = c * deriv f z"
   882   "f analytic_on {z} \<Longrightarrow>  deriv (\<lambda>w. c * f w) z = c * deriv f z"
   883 by (auto simp: complex_derivative_mult_at deriv_const analytic_on_const)
   883 by (auto simp: complex_derivative_mult_at deriv_const analytic_on_const)
   884 
   884 
   885 lemma complex_derivative_cmult_right_at:
   885 lemma deriv_cmult_right_at:
   886   "f analytic_on {z} \<Longrightarrow>  deriv (\<lambda>w. f w * c) z = deriv f z * c"
   886   "f analytic_on {z} \<Longrightarrow>  deriv (\<lambda>w. f w * c) z = deriv f z * c"
   887 by (auto simp: complex_derivative_mult_at deriv_const analytic_on_const)
   887 by (auto simp: complex_derivative_mult_at deriv_const analytic_on_const)
   888 
   888 
   889 subsection\<open>Complex differentiation of sequences and series\<close>
   889 subsection\<open>Complex differentiation of sequences and series\<close>
   890 
   890 
   924     by (rule tf)
   924     by (rule tf)
   925   next show "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. \<forall>x\<in>s. \<forall>h. cmod (f' n x * h - g' x * h) \<le> e * cmod h"
   925   next show "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. \<forall>x\<in>s. \<forall>h. cmod (f' n x * h - g' x * h) \<le> e * cmod h"
   926     by (blast intro: **)
   926     by (blast intro: **)
   927   qed
   927   qed
   928 qed
   928 qed
   929 
       
   930 
   929 
   931 lemma has_complex_derivative_series:
   930 lemma has_complex_derivative_series:
   932   fixes s :: "complex set"
   931   fixes s :: "complex set"
   933   assumes cvs: "convex s"
   932   assumes cvs: "convex s"
   934       and df:  "\<And>n x. x \<in> s \<Longrightarrow> (f n has_field_derivative f' n x) (at x within s)"
   933       and df:  "\<And>n x. x \<in> s \<Longrightarrow> (f n has_field_derivative f' n x) (at x within s)"
   968     by (blast intro: **)
   967     by (blast intro: **)
   969   qed
   968   qed
   970 qed
   969 qed
   971 
   970 
   972 
   971 
   973 lemma complex_differentiable_series:
   972 lemma field_differentiable_series:
   974   fixes f :: "nat \<Rightarrow> complex \<Rightarrow> complex"
   973   fixes f :: "nat \<Rightarrow> complex \<Rightarrow> complex"
   975   assumes "convex s" "open s"
   974   assumes "convex s" "open s"
   976   assumes "\<And>n x. x \<in> s \<Longrightarrow> (f n has_field_derivative f' n x) (at x)"
   975   assumes "\<And>n x. x \<in> s \<Longrightarrow> (f n has_field_derivative f' n x) (at x)"
   977   assumes "uniformly_convergent_on s (\<lambda>n x. \<Sum>i<n. f' i x)"
   976   assumes "uniformly_convergent_on s (\<lambda>n x. \<Sum>i<n. f' i x)"
   978   assumes "x0 \<in> s" "summable (\<lambda>n. f n x0)" and x: "x \<in> s"
   977   assumes "x0 \<in> s" "summable (\<lambda>n. f n x0)" and x: "x \<in> s"
   979   shows   "summable (\<lambda>n. f n x)" and "(\<lambda>x. \<Sum>n. f n x) complex_differentiable (at x)"
   978   shows   "summable (\<lambda>n. f n x)" and "(\<lambda>x. \<Sum>n. f n x) field_differentiable (at x)"
   980 proof -
   979 proof -
   981   from assms(4) obtain g' where A: "uniform_limit s (\<lambda>n x. \<Sum>i<n. f' i x) g' sequentially"
   980   from assms(4) obtain g' where A: "uniform_limit s (\<lambda>n x. \<Sum>i<n. f' i x) g' sequentially"
   982     unfolding uniformly_convergent_on_def by blast
   981     unfolding uniformly_convergent_on_def by blast
   983   from x and \<open>open s\<close> have s: "at x within s = at x" by (rule at_within_open)
   982   from x and \<open>open s\<close> have s: "at x within s = at x" by (rule at_within_open)
   984   have "\<exists>g. \<forall>x\<in>s. (\<lambda>n. f n x) sums g x \<and> (g has_field_derivative g' x) (at x within s)"
   983   have "\<exists>g. \<forall>x\<in>s. (\<lambda>n. f n x) sums g x \<and> (g has_field_derivative g' x) (at x within s)"
   989   from g(2)[OF x] have g': "(g has_derivative op * (g' x)) (at x)"
   988   from g(2)[OF x] have g': "(g has_derivative op * (g' x)) (at x)"
   990     by (simp add: has_field_derivative_def s)
   989     by (simp add: has_field_derivative_def s)
   991   have "((\<lambda>x. \<Sum>n. f n x) has_derivative op * (g' x)) (at x)"
   990   have "((\<lambda>x. \<Sum>n. f n x) has_derivative op * (g' x)) (at x)"
   992     by (rule has_derivative_transform_within_open[OF g' \<open>open s\<close> x])
   991     by (rule has_derivative_transform_within_open[OF g' \<open>open s\<close> x])
   993        (insert g, auto simp: sums_iff)
   992        (insert g, auto simp: sums_iff)
   994   thus "(\<lambda>x. \<Sum>n. f n x) complex_differentiable (at x)" unfolding differentiable_def
   993   thus "(\<lambda>x. \<Sum>n. f n x) field_differentiable (at x)" unfolding differentiable_def
   995     by (auto simp: summable_def complex_differentiable_def has_field_derivative_def)
   994     by (auto simp: summable_def field_differentiable_def has_field_derivative_def)
   996 qed
   995 qed
   997 
   996 
   998 lemma complex_differentiable_series':
   997 lemma field_differentiable_series':
   999   fixes f :: "nat \<Rightarrow> complex \<Rightarrow> complex"
   998   fixes f :: "nat \<Rightarrow> complex \<Rightarrow> complex"
  1000   assumes "convex s" "open s"
   999   assumes "convex s" "open s"
  1001   assumes "\<And>n x. x \<in> s \<Longrightarrow> (f n has_field_derivative f' n x) (at x)"
  1000   assumes "\<And>n x. x \<in> s \<Longrightarrow> (f n has_field_derivative f' n x) (at x)"
  1002   assumes "uniformly_convergent_on s (\<lambda>n x. \<Sum>i<n. f' i x)"
  1001   assumes "uniformly_convergent_on s (\<lambda>n x. \<Sum>i<n. f' i x)"
  1003   assumes "x0 \<in> s" "summable (\<lambda>n. f n x0)"
  1002   assumes "x0 \<in> s" "summable (\<lambda>n. f n x0)"
  1004   shows   "(\<lambda>x. \<Sum>n. f n x) complex_differentiable (at x0)"
  1003   shows   "(\<lambda>x. \<Sum>n. f n x) field_differentiable (at x0)"
  1005   using complex_differentiable_series[OF assms, of x0] \<open>x0 \<in> s\<close> by blast+
  1004   using field_differentiable_series[OF assms, of x0] \<open>x0 \<in> s\<close> by blast+
  1006 
  1005 
  1007 subsection\<open>Bound theorem\<close>
  1006 subsection\<open>Bound theorem\<close>
  1008 
  1007 
  1009 lemma complex_differentiable_bound:
  1008 lemma field_differentiable_bound:
  1010   fixes s :: "complex set"
  1009   fixes s :: "complex set"
  1011   assumes cvs: "convex s"
  1010   assumes cvs: "convex s"
  1012       and df:  "\<And>z. z \<in> s \<Longrightarrow> (f has_field_derivative f' z) (at z within s)"
  1011       and df:  "\<And>z. z \<in> s \<Longrightarrow> (f has_field_derivative f' z) (at z within s)"
  1013       and dn:  "\<And>z. z \<in> s \<Longrightarrow> norm (f' z) \<le> B"
  1012       and dn:  "\<And>z. z \<in> s \<Longrightarrow> norm (f' z) \<le> B"
  1014       and "x \<in> s"  "y \<in> s"
  1013       and "x \<in> s"  "y \<in> s"
  1153   finally have "cmod (f 0 z - (\<Sum>i\<le>n. f i w * (z - w) ^ i / (fact i)))
  1152   finally have "cmod (f 0 z - (\<Sum>i\<le>n. f i w * (z - w) ^ i / (fact i)))
  1154                 \<le> cmod ((\<Sum>i\<le>n. f i w * (z - w) ^ i / (fact i)) -
  1153                 \<le> cmod ((\<Sum>i\<le>n. f i w * (z - w) ^ i / (fact i)) -
  1155                         (\<Sum>i\<le>n. f i z * (z - z) ^ i / (fact i)))"
  1154                         (\<Sum>i\<le>n. f i z * (z - z) ^ i / (fact i)))"
  1156     by (simp add: norm_minus_commute)
  1155     by (simp add: norm_minus_commute)
  1157   also have "... \<le> B * cmod (z - w) ^ n / (fact n) * cmod (w - z)"
  1156   also have "... \<le> B * cmod (z - w) ^ n / (fact n) * cmod (w - z)"
  1158     apply (rule complex_differentiable_bound
  1157     apply (rule field_differentiable_bound
  1159       [where f' = "\<lambda>w. f (Suc n) w * (z - w)^n / (fact n)"
  1158       [where f' = "\<lambda>w. f (Suc n) w * (z - w)^n / (fact n)"
  1160          and s = "closed_segment w z", OF convex_closed_segment])
  1159          and s = "closed_segment w z", OF convex_closed_segment])
  1161     apply (auto simp: ends_in_segment DERIV_subset [OF sum_deriv wzs]
  1160     apply (auto simp: ends_in_segment DERIV_subset [OF sum_deriv wzs]
  1162                   norm_divide norm_mult norm_power divide_le_cancel cmod_bound)
  1161                   norm_divide norm_mult norm_power divide_le_cancel cmod_bound)
  1163     done
  1162     done