src/HOL/Analysis/Complex_Analysis_Basics.thy
 changeset 68255 009f783d1bac parent 68239 0764ee22a4d1 child 68296 69d680e94961
```     1.1 --- a/src/HOL/Analysis/Complex_Analysis_Basics.thy	Mon May 21 18:36:30 2018 +0200
1.2 +++ b/src/HOL/Analysis/Complex_Analysis_Basics.thy	Mon May 21 22:52:16 2018 +0100
1.3 @@ -32,7 +32,7 @@
1.4  lemma fact_cancel:
1.5    fixes c :: "'a::real_field"
1.6    shows "of_nat (Suc n) * c / (fact (Suc n)) = c / (fact n)"
1.7 -  by (simp add: of_nat_mult del: of_nat_Suc times_nat.simps)
1.8 +  using of_nat_neq_0 by force
1.9
1.10  lemma bilinear_times:
1.11    fixes c::"'a::real_algebra" shows "bilinear (\<lambda>x y::'a. x*y)"
1.12 @@ -41,34 +41,6 @@
1.13  lemma linear_cnj: "linear cnj"
1.14    using bounded_linear.linear[OF bounded_linear_cnj] .
1.15
1.16 -lemma tendsto_Re_upper:
1.17 -  assumes "~ (trivial_limit F)"
1.18 -          "(f \<longlongrightarrow> l) F"
1.19 -          "eventually (\<lambda>x. Re(f x) \<le> b) F"
1.20 -    shows  "Re(l) \<le> b"
1.21 -  by (metis assms tendsto_le [OF _ tendsto_const]  tendsto_Re)
1.22 -
1.23 -lemma tendsto_Re_lower:
1.24 -  assumes "~ (trivial_limit F)"
1.25 -          "(f \<longlongrightarrow> l) F"
1.26 -          "eventually (\<lambda>x. b \<le> Re(f x)) F"
1.27 -    shows  "b \<le> Re(l)"
1.28 -  by (metis assms tendsto_le [OF _ _ tendsto_const]  tendsto_Re)
1.29 -
1.30 -lemma tendsto_Im_upper:
1.31 -  assumes "~ (trivial_limit F)"
1.32 -          "(f \<longlongrightarrow> l) F"
1.33 -          "eventually (\<lambda>x. Im(f x) \<le> b) F"
1.34 -    shows  "Im(l) \<le> b"
1.35 -  by (metis assms tendsto_le [OF _ tendsto_const]  tendsto_Im)
1.36 -
1.37 -lemma tendsto_Im_lower:
1.38 -  assumes "~ (trivial_limit F)"
1.39 -          "(f \<longlongrightarrow> l) F"
1.40 -          "eventually (\<lambda>x. b \<le> Im(f x)) F"
1.41 -    shows  "b \<le> Im(l)"
1.42 -  by (metis assms tendsto_le [OF _ _ tendsto_const]  tendsto_Im)
1.43 -
1.44  lemma lambda_zero: "(\<lambda>h::'a::mult_zero. 0) = ( * ) 0"
1.45    by auto
1.46
1.47 @@ -116,48 +88,48 @@
1.48
1.49  lemma DERIV_zero_connected_constant:
1.50    fixes f :: "'a::{real_normed_field,euclidean_space} \<Rightarrow> 'a"
1.51 -  assumes "connected s"
1.52 -      and "open s"
1.53 -      and "finite k"
1.54 -      and "continuous_on s f"
1.55 -      and "\<forall>x\<in>(s - k). DERIV f x :> 0"
1.56 -    obtains c where "\<And>x. x \<in> s \<Longrightarrow> f(x) = c"
1.57 +  assumes "connected S"
1.58 +      and "open S"
1.59 +      and "finite K"
1.60 +      and "continuous_on S f"
1.61 +      and "\<forall>x\<in>(S - K). DERIV f x :> 0"
1.62 +    obtains c where "\<And>x. x \<in> S \<Longrightarrow> f(x) = c"
1.63  using has_derivative_zero_connected_constant [OF assms(1-4)] assms
1.64  by (metis DERIV_const has_derivative_const Diff_iff at_within_open frechet_derivative_at has_field_derivative_def)
1.65
1.66  lemmas DERIV_zero_constant = has_field_derivative_zero_constant
1.67
1.68  lemma DERIV_zero_unique:
1.69 -  assumes "convex s"
1.70 -      and d0: "\<And>x. x\<in>s \<Longrightarrow> (f has_field_derivative 0) (at x within s)"
1.71 -      and "a \<in> s"
1.72 -      and "x \<in> s"
1.73 +  assumes "convex S"
1.74 +      and d0: "\<And>x. x\<in>S \<Longrightarrow> (f has_field_derivative 0) (at x within S)"
1.75 +      and "a \<in> S"
1.76 +      and "x \<in> S"
1.77      shows "f x = f a"
1.78    by (rule has_derivative_zero_unique [OF assms(1) _ assms(4,3)])
1.79       (metis d0 has_field_derivative_imp_has_derivative lambda_zero)
1.80
1.81  lemma DERIV_zero_connected_unique:
1.82 -  assumes "connected s"
1.83 -      and "open s"
1.84 -      and d0: "\<And>x. x\<in>s \<Longrightarrow> DERIV f x :> 0"
1.85 -      and "a \<in> s"
1.86 -      and "x \<in> s"
1.87 +  assumes "connected S"
1.88 +      and "open S"
1.89 +      and d0: "\<And>x. x\<in>S \<Longrightarrow> DERIV f x :> 0"
1.90 +      and "a \<in> S"
1.91 +      and "x \<in> S"
1.92      shows "f x = f a"
1.93      by (rule has_derivative_zero_unique_connected [OF assms(2,1) _ assms(5,4)])
1.94         (metis has_field_derivative_def lambda_zero d0)
1.95
1.96  lemma DERIV_transform_within:
1.97 -  assumes "(f has_field_derivative f') (at a within s)"
1.98 -      and "0 < d" "a \<in> s"
1.99 -      and "\<And>x. x\<in>s \<Longrightarrow> dist x a < d \<Longrightarrow> f x = g x"
1.100 -    shows "(g has_field_derivative f') (at a within s)"
1.101 +  assumes "(f has_field_derivative f') (at a within S)"
1.102 +      and "0 < d" "a \<in> S"
1.103 +      and "\<And>x. x\<in>S \<Longrightarrow> dist x a < d \<Longrightarrow> f x = g x"
1.104 +    shows "(g has_field_derivative f') (at a within S)"
1.105    using assms unfolding has_field_derivative_def
1.106    by (blast intro: has_derivative_transform_within)
1.107
1.108  lemma DERIV_transform_within_open:
1.109    assumes "DERIV f a :> f'"
1.110 -      and "open s" "a \<in> s"
1.111 -      and "\<And>x. x\<in>s \<Longrightarrow> f x = g x"
1.112 +      and "open S" "a \<in> S"
1.113 +      and "\<And>x. x\<in>S \<Longrightarrow> f x = g x"
1.114      shows "DERIV g a :> f'"
1.115    using assms unfolding has_field_derivative_def
1.116  by (metis has_derivative_transform_within_open)
1.117 @@ -270,8 +242,6 @@
1.118
1.119  subsection\<open>Holomorphic functions\<close>
1.120
1.121 -subsection\<open>Holomorphic functions\<close>
1.122 -
1.123  definition holomorphic_on :: "[complex \<Rightarrow> complex, complex set] \<Rightarrow> bool"
1.124             (infixl "(holomorphic'_on)" 50)
1.125    where "f holomorphic_on s \<equiv> \<forall>x\<in>s. f field_differentiable (at x within s)"
1.126 @@ -455,20 +425,29 @@
1.127    unfolding DERIV_deriv_iff_field_differentiable[symmetric]
1.128    by (auto intro!: DERIV_imp_deriv derivative_eq_intros)
1.129
1.130 -lemma deriv_cmult [simp]:
1.131 +lemma deriv_cmult:
1.132    "f field_differentiable at z \<Longrightarrow> deriv (\<lambda>w. c * f w) z = c * deriv f z"
1.133 -  unfolding DERIV_deriv_iff_field_differentiable[symmetric]
1.134 -  by (auto intro!: DERIV_imp_deriv derivative_eq_intros)
1.135 +  by simp
1.136
1.137 -lemma deriv_cmult_right [simp]:
1.138 +lemma deriv_cmult_right:
1.139    "f field_differentiable at z \<Longrightarrow> deriv (\<lambda>w. f w * c) z = deriv f z * c"
1.140 +  by simp
1.141 +
1.142 +lemma deriv_inverse [simp]:
1.143 +  "\<lbrakk>f field_differentiable at z; f z \<noteq> 0\<rbrakk>
1.144 +   \<Longrightarrow> deriv (\<lambda>w. inverse (f w)) z = - deriv f z / f z ^ 2"
1.145    unfolding DERIV_deriv_iff_field_differentiable[symmetric]
1.146 -  by (auto intro!: DERIV_imp_deriv derivative_eq_intros)
1.147 +  by (safe intro!: DERIV_imp_deriv derivative_eq_intros) (auto simp: divide_simps power2_eq_square)
1.148
1.149 -lemma deriv_cdivide_right [simp]:
1.150 +lemma deriv_divide [simp]:
1.151 +  "\<lbrakk>f field_differentiable at z; g field_differentiable at z; g z \<noteq> 0\<rbrakk>
1.152 +   \<Longrightarrow> deriv (\<lambda>w. f w / g w) z = (deriv f z * g z - f z * deriv g z) / g z ^ 2"
1.153 +  by (simp add: field_class.field_divide_inverse field_differentiable_inverse)
1.154 +     (simp add: divide_simps power2_eq_square)
1.155 +
1.156 +lemma deriv_cdivide_right:
1.157    "f field_differentiable at z \<Longrightarrow> deriv (\<lambda>w. f w / c) z = deriv f z / c"
1.158 -  unfolding Fields.field_class.field_divide_inverse
1.159 -  by (blast intro: deriv_cmult_right)
1.160 +  by (simp add: field_class.field_divide_inverse)
1.161
1.162  lemma complex_derivative_transform_within_open:
1.163    "\<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>
1.164 @@ -480,10 +459,9 @@
1.165  lemma deriv_compose_linear:
1.166    "f field_differentiable at (c * z) \<Longrightarrow> deriv (\<lambda>w. f (c * w)) z = c * deriv f (c * z)"
1.167  apply (rule DERIV_imp_deriv)
1.168 -apply (simp add: DERIV_deriv_iff_field_differentiable [symmetric])
1.169 -apply (drule DERIV_chain' [of "times c" c z UNIV f "deriv f (c * z)", OF DERIV_cmult_Id])
1.171 -done
1.172 +  unfolding DERIV_deriv_iff_field_differentiable [symmetric]
1.173 +  by (metis (full_types) DERIV_chain2 DERIV_cmult_Id mult.commute)
1.174 +
1.175
1.176  lemma nonzero_deriv_nonconstant:
1.177    assumes df: "DERIV f \<xi> :> df" and S: "open S" "\<xi> \<in> S" and "df \<noteq> 0"
1.178 @@ -494,10 +472,8 @@
1.179  lemma holomorphic_nonconstant:
1.180    assumes holf: "f holomorphic_on S" and "open S" "\<xi> \<in> S" "deriv f \<xi> \<noteq> 0"
1.181      shows "\<not> f constant_on S"
1.182 -    apply (rule nonzero_deriv_nonconstant [of f "deriv f \<xi>" \<xi> S])
1.183 -    using assms
1.184 -    apply (auto simp: holomorphic_derivI)
1.185 -    done
1.186 +  by (rule nonzero_deriv_nonconstant [of f "deriv f \<xi>" \<xi> S])
1.187 +    (use assms in \<open>auto simp: holomorphic_derivI\<close>)
1.188
1.189  subsection\<open>Caratheodory characterization\<close>
1.190
1.191 @@ -516,53 +492,52 @@
1.192  subsection\<open>Analyticity on a set\<close>
1.193
1.194  definition analytic_on (infixl "(analytic'_on)" 50)
1.195 -  where
1.196 -   "f analytic_on s \<equiv> \<forall>x \<in> s. \<exists>e. 0 < e \<and> f holomorphic_on (ball x e)"
1.197 +  where "f analytic_on S \<equiv> \<forall>x \<in> S. \<exists>e. 0 < e \<and> f holomorphic_on (ball x e)"
1.198
1.199  named_theorems analytic_intros "introduction rules for proving analyticity"
1.200
1.201 -lemma analytic_imp_holomorphic: "f analytic_on s \<Longrightarrow> f holomorphic_on s"
1.202 +lemma analytic_imp_holomorphic: "f analytic_on S \<Longrightarrow> f holomorphic_on S"
1.203    by (simp add: at_within_open [OF _ open_ball] analytic_on_def holomorphic_on_def)
1.204       (metis centre_in_ball field_differentiable_at_within)
1.205
1.206 -lemma analytic_on_open: "open s \<Longrightarrow> f analytic_on s \<longleftrightarrow> f holomorphic_on s"
1.207 +lemma analytic_on_open: "open S \<Longrightarrow> f analytic_on S \<longleftrightarrow> f holomorphic_on S"
1.208  apply (auto simp: analytic_imp_holomorphic)
1.209  apply (auto simp: analytic_on_def holomorphic_on_def)
1.210  by (metis holomorphic_on_def holomorphic_on_subset open_contains_ball)
1.211
1.212  lemma analytic_on_imp_differentiable_at:
1.213 -  "f analytic_on s \<Longrightarrow> x \<in> s \<Longrightarrow> f field_differentiable (at x)"
1.214 +  "f analytic_on S \<Longrightarrow> x \<in> S \<Longrightarrow> f field_differentiable (at x)"
1.215   apply (auto simp: analytic_on_def holomorphic_on_def)
1.216  by (metis open_ball centre_in_ball field_differentiable_within_open)
1.217
1.218 -lemma analytic_on_subset: "f analytic_on s \<Longrightarrow> t \<subseteq> s \<Longrightarrow> f analytic_on t"
1.219 +lemma analytic_on_subset: "f analytic_on S \<Longrightarrow> T \<subseteq> S \<Longrightarrow> f analytic_on T"
1.220    by (auto simp: analytic_on_def)
1.221
1.222 -lemma analytic_on_Un: "f analytic_on (s \<union> t) \<longleftrightarrow> f analytic_on s \<and> f analytic_on t"
1.223 +lemma analytic_on_Un: "f analytic_on (S \<union> T) \<longleftrightarrow> f analytic_on S \<and> f analytic_on T"
1.224    by (auto simp: analytic_on_def)
1.225
1.226 -lemma analytic_on_Union: "f analytic_on (\<Union>s) \<longleftrightarrow> (\<forall>t \<in> s. f analytic_on t)"
1.227 +lemma analytic_on_Union: "f analytic_on (\<Union>\<T>) \<longleftrightarrow> (\<forall>T \<in> \<T>. f analytic_on T)"
1.228    by (auto simp: analytic_on_def)
1.229
1.230 -lemma analytic_on_UN: "f analytic_on (\<Union>i\<in>I. s i) \<longleftrightarrow> (\<forall>i\<in>I. f analytic_on (s i))"
1.231 +lemma analytic_on_UN: "f analytic_on (\<Union>i\<in>I. S i) \<longleftrightarrow> (\<forall>i\<in>I. f analytic_on (S i))"
1.232    by (auto simp: analytic_on_def)
1.233
1.234  lemma analytic_on_holomorphic:
1.235 -  "f analytic_on s \<longleftrightarrow> (\<exists>t. open t \<and> s \<subseteq> t \<and> f holomorphic_on t)"
1.236 +  "f analytic_on S \<longleftrightarrow> (\<exists>T. open T \<and> S \<subseteq> T \<and> f holomorphic_on T)"
1.237    (is "?lhs = ?rhs")
1.238  proof -
1.239 -  have "?lhs \<longleftrightarrow> (\<exists>t. open t \<and> s \<subseteq> t \<and> f analytic_on t)"
1.240 +  have "?lhs \<longleftrightarrow> (\<exists>T. open T \<and> S \<subseteq> T \<and> f analytic_on T)"
1.241    proof safe
1.242 -    assume "f analytic_on s"
1.243 -    then show "\<exists>t. open t \<and> s \<subseteq> t \<and> f analytic_on t"
1.244 +    assume "f analytic_on S"
1.245 +    then show "\<exists>T. open T \<and> S \<subseteq> T \<and> f analytic_on T"
1.247 -      apply (rule exI [where x="\<Union>{u. open u \<and> f analytic_on u}"], auto)
1.248 +      apply (rule exI [where x="\<Union>{U. open U \<and> f analytic_on U}"], auto)
1.249        apply (metis open_ball analytic_on_open centre_in_ball)
1.250        by (metis analytic_on_def)
1.251    next
1.252 -    fix t
1.253 -    assume "open t" "s \<subseteq> t" "f analytic_on t"
1.254 -    then show "f analytic_on s"
1.255 +    fix T
1.256 +    assume "open T" "S \<subseteq> T" "f analytic_on T"
1.257 +    then show "f analytic_on S"
1.258          by (metis analytic_on_subset)
1.259    qed
1.260    also have "... \<longleftrightarrow> ?rhs"
1.261 @@ -570,26 +545,26 @@
1.262    finally show ?thesis .
1.263  qed
1.264
1.265 -lemma analytic_on_linear [analytic_intros,simp]: "(( * ) c) analytic_on s"
1.266 +lemma analytic_on_linear [analytic_intros,simp]: "(( * ) c) analytic_on S"
1.267    by (auto simp add: analytic_on_holomorphic)
1.268
1.269 -lemma analytic_on_const [analytic_intros,simp]: "(\<lambda>z. c) analytic_on s"
1.270 +lemma analytic_on_const [analytic_intros,simp]: "(\<lambda>z. c) analytic_on S"
1.271    by (metis analytic_on_def holomorphic_on_const zero_less_one)
1.272
1.273 -lemma analytic_on_ident [analytic_intros,simp]: "(\<lambda>x. x) analytic_on s"
1.274 +lemma analytic_on_ident [analytic_intros,simp]: "(\<lambda>x. x) analytic_on S"
1.275    by (simp add: analytic_on_def gt_ex)
1.276
1.277 -lemma analytic_on_id [analytic_intros]: "id analytic_on s"
1.278 +lemma analytic_on_id [analytic_intros]: "id analytic_on S"
1.279    unfolding id_def by (rule analytic_on_ident)
1.280
1.281  lemma analytic_on_compose:
1.282 -  assumes f: "f analytic_on s"
1.283 -      and g: "g analytic_on (f ` s)"
1.284 -    shows "(g o f) analytic_on s"
1.285 +  assumes f: "f analytic_on S"
1.286 +      and g: "g analytic_on (f ` S)"
1.287 +    shows "(g o f) analytic_on S"
1.288  unfolding analytic_on_def
1.289  proof (intro ballI)
1.290    fix x
1.291 -  assume x: "x \<in> s"
1.292 +  assume x: "x \<in> S"
1.293    then obtain e where e: "0 < e" and fh: "f holomorphic_on ball x e" using f
1.294      by (metis analytic_on_def)
1.295    obtain e' where e': "0 < e'" and gh: "g holomorphic_on ball (f x) e'" using g
1.296 @@ -607,22 +582,22 @@
1.297  qed
1.298
1.299  lemma analytic_on_compose_gen:
1.300 -  "f analytic_on s \<Longrightarrow> g analytic_on t \<Longrightarrow> (\<And>z. z \<in> s \<Longrightarrow> f z \<in> t)
1.301 -             \<Longrightarrow> g o f analytic_on s"
1.302 +  "f analytic_on S \<Longrightarrow> g analytic_on T \<Longrightarrow> (\<And>z. z \<in> S \<Longrightarrow> f z \<in> T)
1.303 +             \<Longrightarrow> g o f analytic_on S"
1.304  by (metis analytic_on_compose analytic_on_subset image_subset_iff)
1.305
1.306  lemma analytic_on_neg [analytic_intros]:
1.307 -  "f analytic_on s \<Longrightarrow> (\<lambda>z. -(f z)) analytic_on s"
1.308 +  "f analytic_on S \<Longrightarrow> (\<lambda>z. -(f z)) analytic_on S"
1.309  by (metis analytic_on_holomorphic holomorphic_on_minus)
1.310
1.312 -  assumes f: "f analytic_on s"
1.313 -      and g: "g analytic_on s"
1.314 -    shows "(\<lambda>z. f z + g z) analytic_on s"
1.315 +  assumes f: "f analytic_on S"
1.316 +      and g: "g analytic_on S"
1.317 +    shows "(\<lambda>z. f z + g z) analytic_on S"
1.318  unfolding analytic_on_def
1.319  proof (intro ballI)
1.320    fix z
1.321 -  assume z: "z \<in> s"
1.322 +  assume z: "z \<in> S"
1.323    then obtain e where e: "0 < e" and fh: "f holomorphic_on ball z e" using f
1.324      by (metis analytic_on_def)
1.325    obtain e' where e': "0 < e'" and gh: "g holomorphic_on ball z e'" using g
1.326 @@ -636,13 +611,13 @@
1.327  qed
1.328
1.329  lemma analytic_on_diff [analytic_intros]:
1.330 -  assumes f: "f analytic_on s"
1.331 -      and g: "g analytic_on s"
1.332 -    shows "(\<lambda>z. f z - g z) analytic_on s"
1.333 +  assumes f: "f analytic_on S"
1.334 +      and g: "g analytic_on S"
1.335 +    shows "(\<lambda>z. f z - g z) analytic_on S"
1.336  unfolding analytic_on_def
1.337  proof (intro ballI)
1.338    fix z
1.339 -  assume z: "z \<in> s"
1.340 +  assume z: "z \<in> S"
1.341    then obtain e where e: "0 < e" and fh: "f holomorphic_on ball z e" using f
1.342      by (metis analytic_on_def)
1.343    obtain e' where e': "0 < e'" and gh: "g holomorphic_on ball z e'" using g
1.344 @@ -656,13 +631,13 @@
1.345  qed
1.346
1.347  lemma analytic_on_mult [analytic_intros]:
1.348 -  assumes f: "f analytic_on s"
1.349 -      and g: "g analytic_on s"
1.350 -    shows "(\<lambda>z. f z * g z) analytic_on s"
1.351 +  assumes f: "f analytic_on S"
1.352 +      and g: "g analytic_on S"
1.353 +    shows "(\<lambda>z. f z * g z) analytic_on S"
1.354  unfolding analytic_on_def
1.355  proof (intro ballI)
1.356    fix z
1.357 -  assume z: "z \<in> s"
1.358 +  assume z: "z \<in> S"
1.359    then obtain e where e: "0 < e" and fh: "f holomorphic_on ball z e" using f
1.360      by (metis analytic_on_def)
1.361    obtain e' where e': "0 < e'" and gh: "g holomorphic_on ball z e'" using g
1.362 @@ -676,13 +651,13 @@
1.363  qed
1.364
1.365  lemma analytic_on_inverse [analytic_intros]:
1.366 -  assumes f: "f analytic_on s"
1.367 -      and nz: "(\<And>z. z \<in> s \<Longrightarrow> f z \<noteq> 0)"
1.368 -    shows "(\<lambda>z. inverse (f z)) analytic_on s"
1.369 +  assumes f: "f analytic_on S"
1.370 +      and nz: "(\<And>z. z \<in> S \<Longrightarrow> f z \<noteq> 0)"
1.371 +    shows "(\<lambda>z. inverse (f z)) analytic_on S"
1.372  unfolding analytic_on_def
1.373  proof (intro ballI)
1.374    fix z
1.375 -  assume z: "z \<in> s"
1.376 +  assume z: "z \<in> S"
1.377    then obtain e where e: "0 < e" and fh: "f holomorphic_on ball z e" using f
1.378      by (metis analytic_on_def)
1.379    have "continuous_on (ball z e) f"
1.380 @@ -698,19 +673,19 @@
1.381  qed
1.382
1.383  lemma analytic_on_divide [analytic_intros]:
1.384 -  assumes f: "f analytic_on s"
1.385 -      and g: "g analytic_on s"
1.386 -      and nz: "(\<And>z. z \<in> s \<Longrightarrow> g z \<noteq> 0)"
1.387 -    shows "(\<lambda>z. f z / g z) analytic_on s"
1.388 +  assumes f: "f analytic_on S"
1.389 +      and g: "g analytic_on S"
1.390 +      and nz: "(\<And>z. z \<in> S \<Longrightarrow> g z \<noteq> 0)"
1.391 +    shows "(\<lambda>z. f z / g z) analytic_on S"
1.392  unfolding divide_inverse
1.393  by (metis analytic_on_inverse analytic_on_mult f g nz)
1.394
1.395  lemma analytic_on_power [analytic_intros]:
1.396 -  "f analytic_on s \<Longrightarrow> (\<lambda>z. (f z) ^ n) analytic_on s"
1.397 +  "f analytic_on S \<Longrightarrow> (\<lambda>z. (f z) ^ n) analytic_on S"
1.398  by (induct n) (auto simp: analytic_on_mult)
1.399
1.400  lemma analytic_on_sum [analytic_intros]:
1.401 -  "(\<And>i. i \<in> I \<Longrightarrow> (f i) analytic_on s) \<Longrightarrow> (\<lambda>x. sum (\<lambda>i. f i x) I) analytic_on s"
1.402 +  "(\<And>i. i \<in> I \<Longrightarrow> (f i) analytic_on S) \<Longrightarrow> (\<lambda>x. sum (\<lambda>i. f i x) I) analytic_on S"
1.403    by (induct I rule: infinite_finite_induct) (auto simp: analytic_on_const analytic_on_add)
1.404
1.405  lemma deriv_left_inverse:
1.406 @@ -727,10 +702,10 @@
1.407      using assms
1.408      by (metis analytic_on_imp_differentiable_at analytic_on_open complex_derivative_chain image_subset_iff)
1.409    also have "... = deriv id w"
1.410 -    apply (rule complex_derivative_transform_within_open [where s=S])
1.411 -    apply (rule assms holomorphic_on_compose_gen holomorphic_intros)+
1.412 -    apply simp
1.413 -    done
1.414 +  proof (rule complex_derivative_transform_within_open [where s=S])
1.415 +    show "g \<circ> f holomorphic_on S"
1.416 +      by (rule assms holomorphic_on_compose_gen holomorphic_intros)+
1.417 +  qed (use assms in auto)
1.418    also have "... = 1"
1.419      by simp
1.420    finally show ?thesis .
1.421 @@ -811,23 +786,23 @@
1.422
1.423  (* TODO: Could probably be simplified using Uniform_Limit *)
1.424  lemma has_complex_derivative_sequence:
1.425 -  fixes s :: "complex set"
1.426 -  assumes cvs: "convex s"
1.427 -      and df:  "\<And>n x. x \<in> s \<Longrightarrow> (f n has_field_derivative f' n x) (at x within s)"
1.428 -      and conv: "\<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. n \<ge> N \<longrightarrow> x \<in> s \<longrightarrow> norm (f' n x - g' x) \<le> e"
1.429 -      and "\<exists>x l. x \<in> s \<and> ((\<lambda>n. f n x) \<longlongrightarrow> l) sequentially"
1.430 -    shows "\<exists>g. \<forall>x \<in> s. ((\<lambda>n. f n x) \<longlongrightarrow> g x) sequentially \<and>
1.431 -                       (g has_field_derivative (g' x)) (at x within s)"
1.432 +  fixes S :: "complex set"
1.433 +  assumes cvs: "convex S"
1.434 +      and df:  "\<And>n x. x \<in> S \<Longrightarrow> (f n has_field_derivative f' n x) (at x within S)"
1.435 +      and conv: "\<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. n \<ge> N \<longrightarrow> x \<in> S \<longrightarrow> norm (f' n x - g' x) \<le> e"
1.436 +      and "\<exists>x l. x \<in> S \<and> ((\<lambda>n. f n x) \<longlongrightarrow> l) sequentially"
1.437 +    shows "\<exists>g. \<forall>x \<in> S. ((\<lambda>n. f n x) \<longlongrightarrow> g x) sequentially \<and>
1.438 +                       (g has_field_derivative (g' x)) (at x within S)"
1.439  proof -
1.440 -  from assms obtain x l where x: "x \<in> s" and tf: "((\<lambda>n. f n x) \<longlongrightarrow> l) sequentially"
1.441 +  from assms obtain x l where x: "x \<in> S" and tf: "((\<lambda>n. f n x) \<longlongrightarrow> l) sequentially"
1.442      by blast
1.443    { fix e::real assume e: "e > 0"
1.444 -    then obtain N where N: "\<forall>n\<ge>N. \<forall>x. x \<in> s \<longrightarrow> cmod (f' n x - g' x) \<le> e"
1.445 +    then obtain N where N: "\<forall>n\<ge>N. \<forall>x. x \<in> S \<longrightarrow> cmod (f' n x - g' x) \<le> e"
1.446        by (metis conv)
1.447 -    have "\<exists>N. \<forall>n\<ge>N. \<forall>x\<in>s. \<forall>h. cmod (f' n x * h - g' x * h) \<le> e * cmod h"
1.448 +    have "\<exists>N. \<forall>n\<ge>N. \<forall>x\<in>S. \<forall>h. cmod (f' n x * h - g' x * h) \<le> e * cmod h"
1.449      proof (rule exI [of _ N], clarify)
1.450        fix n y h
1.451 -      assume "N \<le> n" "y \<in> s"
1.452 +      assume "N \<le> n" "y \<in> S"
1.453        then have "cmod (f' n y - g' y) \<le> e"
1.454          by (metis N)
1.455        then have "cmod h * cmod (f' n y - g' y) \<le> cmod h * e"
1.456 @@ -841,30 +816,30 @@
1.457    proof (rule has_derivative_sequence [OF cvs _ _ x])
1.458      show "(\<lambda>n. f n x) \<longlonglongrightarrow> l"
1.459        by (rule tf)
1.460 -  next show "\<And>e. e > 0 \<Longrightarrow> \<forall>\<^sub>F n in sequentially. \<forall>x\<in>s. \<forall>h. cmod (f' n x * h - g' x * h) \<le> e * cmod h"
1.461 +  next show "\<And>e. e > 0 \<Longrightarrow> \<forall>\<^sub>F n in sequentially. \<forall>x\<in>S. \<forall>h. cmod (f' n x * h - g' x * h) \<le> e * cmod h"
1.462        unfolding eventually_sequentially by (blast intro: **)
1.463    qed (metis has_field_derivative_def df)
1.464  qed
1.465
1.466  lemma has_complex_derivative_series:
1.467 -  fixes s :: "complex set"
1.468 -  assumes cvs: "convex s"
1.469 -      and df:  "\<And>n x. x \<in> s \<Longrightarrow> (f n has_field_derivative f' n x) (at x within s)"
1.470 -      and conv: "\<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. n \<ge> N \<longrightarrow> x \<in> s
1.471 +  fixes S :: "complex set"
1.472 +  assumes cvs: "convex S"
1.473 +      and df:  "\<And>n x. x \<in> S \<Longrightarrow> (f n has_field_derivative f' n x) (at x within S)"
1.474 +      and conv: "\<And>e. 0 < e \<Longrightarrow> \<exists>N. \<forall>n x. n \<ge> N \<longrightarrow> x \<in> S
1.475                  \<longrightarrow> cmod ((\<Sum>i<n. f' i x) - g' x) \<le> e"
1.476 -      and "\<exists>x l. x \<in> s \<and> ((\<lambda>n. f n x) sums l)"
1.477 -    shows "\<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))"
1.478 +      and "\<exists>x l. x \<in> S \<and> ((\<lambda>n. f n x) sums l)"
1.479 +    shows "\<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))"
1.480  proof -
1.481 -  from assms obtain x l where x: "x \<in> s" and sf: "((\<lambda>n. f n x) sums l)"
1.482 +  from assms obtain x l where x: "x \<in> S" and sf: "((\<lambda>n. f n x) sums l)"
1.483      by blast
1.484    { fix e::real assume e: "e > 0"
1.485 -    then obtain N where N: "\<forall>n x. n \<ge> N \<longrightarrow> x \<in> s
1.486 +    then obtain N where N: "\<forall>n x. n \<ge> N \<longrightarrow> x \<in> S
1.487              \<longrightarrow> cmod ((\<Sum>i<n. f' i x) - g' x) \<le> e"
1.488        by (metis conv)
1.489 -    have "\<exists>N. \<forall>n\<ge>N. \<forall>x\<in>s. \<forall>h. cmod ((\<Sum>i<n. h * f' i x) - g' x * h) \<le> e * cmod h"
1.490 +    have "\<exists>N. \<forall>n\<ge>N. \<forall>x\<in>S. \<forall>h. cmod ((\<Sum>i<n. h * f' i x) - g' x * h) \<le> e * cmod h"
1.491      proof (rule exI [of _ N], clarify)
1.492        fix n y h
1.493 -      assume "N \<le> n" "y \<in> s"
1.494 +      assume "N \<le> n" "y \<in> S"
1.495        then have "cmod ((\<Sum>i<n. f' i y) - g' y) \<le> e"
1.496          by (metis N)
1.497        then have "cmod h * cmod ((\<Sum>i<n. f' i y) - g' y) \<le> cmod h * e"
1.498 @@ -877,12 +852,12 @@
1.499    unfolding has_field_derivative_def
1.500    proof (rule has_derivative_series [OF cvs _ _ x])
1.501      fix n x
1.502 -    assume "x \<in> s"
1.503 -    then show "((f n) has_derivative (\<lambda>z. z * f' n x)) (at x within s)"
1.504 +    assume "x \<in> S"
1.505 +    then show "((f n) has_derivative (\<lambda>z. z * f' n x)) (at x within S)"
1.506        by (metis df has_field_derivative_def mult_commute_abs)
1.507    next show " ((\<lambda>n. f n x) sums l)"
1.508      by (rule sf)
1.509 -  next show "\<And>e. e>0 \<Longrightarrow> \<forall>\<^sub>F n in sequentially. \<forall>x\<in>s. \<forall>h. cmod ((\<Sum>i<n. h * f' i x) - g' x * h) \<le> e * cmod h"
1.510 +  next show "\<And>e. e>0 \<Longrightarrow> \<forall>\<^sub>F n in sequentially. \<forall>x\<in>S. \<forall>h. cmod ((\<Sum>i<n. h * f' i x) - g' x * h) \<le> e * cmod h"
1.511        unfolding eventually_sequentially by (blast intro: **)
1.512    qed
1.513  qed
1.514 @@ -890,23 +865,23 @@
1.515
1.516  lemma field_differentiable_series:
1.517    fixes f :: "nat \<Rightarrow> 'a::{real_normed_field,banach} \<Rightarrow> 'a"
1.518 -  assumes "convex s" "open s"
1.519 -  assumes "\<And>n x. x \<in> s \<Longrightarrow> (f n has_field_derivative f' n x) (at x)"
1.520 -  assumes "uniformly_convergent_on s (\<lambda>n x. \<Sum>i<n. f' i x)"
1.521 -  assumes "x0 \<in> s" "summable (\<lambda>n. f n x0)" and x: "x \<in> s"
1.522 +  assumes "convex S" "open S"
1.523 +  assumes "\<And>n x. x \<in> S \<Longrightarrow> (f n has_field_derivative f' n x) (at x)"
1.524 +  assumes "uniformly_convergent_on S (\<lambda>n x. \<Sum>i<n. f' i x)"
1.525 +  assumes "x0 \<in> S" "summable (\<lambda>n. f n x0)" and x: "x \<in> S"
1.526    shows  "(\<lambda>x. \<Sum>n. f n x) field_differentiable (at x)"
1.527  proof -
1.528 -  from assms(4) obtain g' where A: "uniform_limit s (\<lambda>n x. \<Sum>i<n. f' i x) g' sequentially"
1.529 +  from assms(4) obtain g' where A: "uniform_limit S (\<lambda>n x. \<Sum>i<n. f' i x) g' sequentially"
1.530      unfolding uniformly_convergent_on_def by blast
1.531 -  from x and \<open>open s\<close> have s: "at x within s = at x" by (rule at_within_open)
1.532 -  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)"
1.533 -    by (intro has_field_derivative_series[of s f f' g' x0] assms A has_field_derivative_at_within)
1.534 -  then obtain g where g: "\<And>x. x \<in> s \<Longrightarrow> (\<lambda>n. f n x) sums g x"
1.535 -    "\<And>x. x \<in> s \<Longrightarrow> (g has_field_derivative g' x) (at x within s)" by blast
1.536 +  from x and \<open>open S\<close> have S: "at x within S = at x" by (rule at_within_open)
1.537 +  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)"
1.538 +    by (intro has_field_derivative_series[of S f f' g' x0] assms A has_field_derivative_at_within)
1.539 +  then obtain g where g: "\<And>x. x \<in> S \<Longrightarrow> (\<lambda>n. f n x) sums g x"
1.540 +    "\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative g' x) (at x within S)" by blast
1.541    from g(2)[OF x] have g': "(g has_derivative ( * ) (g' x)) (at x)"
1.542 -    by (simp add: has_field_derivative_def s)
1.543 +    by (simp add: has_field_derivative_def S)
1.544    have "((\<lambda>x. \<Sum>n. f n x) has_derivative ( * ) (g' x)) (at x)"
1.545 -    by (rule has_derivative_transform_within_open[OF g' \<open>open s\<close> x])
1.546 +    by (rule has_derivative_transform_within_open[OF g' \<open>open S\<close> x])
1.547         (insert g, auto simp: sums_iff)
1.548    thus "(\<lambda>x. \<Sum>n. f n x) field_differentiable (at x)" unfolding differentiable_def
1.549      by (auto simp: summable_def field_differentiable_def has_field_derivative_def)
1.550 @@ -915,11 +890,11 @@
1.551  subsection\<open>Bound theorem\<close>
1.552
1.553  lemma field_differentiable_bound:
1.554 -  fixes s :: "'a::real_normed_field set"
1.555 -  assumes cvs: "convex s"
1.556 -      and df:  "\<And>z. z \<in> s \<Longrightarrow> (f has_field_derivative f' z) (at z within s)"
1.557 -      and dn:  "\<And>z. z \<in> s \<Longrightarrow> norm (f' z) \<le> B"
1.558 -      and "x \<in> s"  "y \<in> s"
1.559 +  fixes S :: "'a::real_normed_field set"
1.560 +  assumes cvs: "convex S"
1.561 +      and df:  "\<And>z. z \<in> S \<Longrightarrow> (f has_field_derivative f' z) (at z within S)"
1.562 +      and dn:  "\<And>z. z \<in> S \<Longrightarrow> norm (f' z) \<le> B"
1.563 +      and "x \<in> S"  "y \<in> S"
1.564      shows "norm(f x - f y) \<le> B * norm(x - y)"
1.565    apply (rule differentiable_bound [OF cvs])
1.566    apply (erule df [unfolded has_field_derivative_def])
1.567 @@ -941,35 +916,31 @@
1.568    apply (auto simp:  bounded_linear_mult_right)
1.569    done
1.570
1.571 -lemmas has_complex_derivative_inverse_basic = has_field_derivative_inverse_basic
1.572 -
1.573  lemma has_field_derivative_inverse_strong:
1.574    fixes f :: "'a::{euclidean_space,real_normed_field} \<Rightarrow> 'a"
1.575    shows "DERIV f x :> f' \<Longrightarrow>
1.576           f' \<noteq> 0 \<Longrightarrow>
1.577 -         open s \<Longrightarrow>
1.578 -         x \<in> s \<Longrightarrow>
1.579 -         continuous_on s f \<Longrightarrow>
1.580 -         (\<And>z. z \<in> s \<Longrightarrow> g (f z) = z)
1.581 +         open S \<Longrightarrow>
1.582 +         x \<in> S \<Longrightarrow>
1.583 +         continuous_on S f \<Longrightarrow>
1.584 +         (\<And>z. z \<in> S \<Longrightarrow> g (f z) = z)
1.585           \<Longrightarrow> DERIV g (f x) :> inverse (f')"
1.586    unfolding has_field_derivative_def
1.587 -  apply (rule has_derivative_inverse_strong [of s x f g ])
1.588 +  apply (rule has_derivative_inverse_strong [of S x f g ])
1.589    by auto
1.590 -lemmas has_complex_derivative_inverse_strong = has_field_derivative_inverse_strong
1.591
1.592  lemma has_field_derivative_inverse_strong_x:
1.593    fixes f :: "'a::{euclidean_space,real_normed_field} \<Rightarrow> 'a"
1.594    shows  "DERIV f (g y) :> f' \<Longrightarrow>
1.595            f' \<noteq> 0 \<Longrightarrow>
1.596 -          open s \<Longrightarrow>
1.597 -          continuous_on s f \<Longrightarrow>
1.598 -          g y \<in> s \<Longrightarrow> f(g y) = y \<Longrightarrow>
1.599 -          (\<And>z. z \<in> s \<Longrightarrow> g (f z) = z)
1.600 +          open S \<Longrightarrow>
1.601 +          continuous_on S f \<Longrightarrow>
1.602 +          g y \<in> S \<Longrightarrow> f(g y) = y \<Longrightarrow>
1.603 +          (\<And>z. z \<in> S \<Longrightarrow> g (f z) = z)
1.604            \<Longrightarrow> DERIV g y :> inverse (f')"
1.605    unfolding has_field_derivative_def
1.606 -  apply (rule has_derivative_inverse_strong_x [of s g y f])
1.607 +  apply (rule has_derivative_inverse_strong_x [of S g y f])
1.608    by auto
1.609 -lemmas has_complex_derivative_inverse_strong_x = has_field_derivative_inverse_strong_x
1.610
1.611  subsection \<open>Taylor on Complex Numbers\<close>
1.612
1.613 @@ -979,19 +950,19 @@
1.614  by (induct n) auto
1.615
1.616  lemma field_taylor:
1.617 -  assumes s: "convex s"
1.618 -      and f: "\<And>i x. x \<in> s \<Longrightarrow> i \<le> n \<Longrightarrow> (f i has_field_derivative f (Suc i) x) (at x within s)"
1.619 -      and B: "\<And>x. x \<in> s \<Longrightarrow> norm (f (Suc n) x) \<le> B"
1.620 -      and w: "w \<in> s"
1.621 -      and z: "z \<in> s"
1.622 +  assumes S: "convex S"
1.623 +      and f: "\<And>i x. x \<in> S \<Longrightarrow> i \<le> n \<Longrightarrow> (f i has_field_derivative f (Suc i) x) (at x within S)"
1.624 +      and B: "\<And>x. x \<in> S \<Longrightarrow> norm (f (Suc n) x) \<le> B"
1.625 +      and w: "w \<in> S"
1.626 +      and z: "z \<in> S"
1.627      shows "norm(f 0 z - (\<Sum>i\<le>n. f i w * (z-w) ^ i / (fact i)))
1.628            \<le> B * norm(z - w)^(Suc n) / fact n"
1.629  proof -
1.630 -  have wzs: "closed_segment w z \<subseteq> s" using assms
1.631 +  have wzs: "closed_segment w z \<subseteq> S" using assms
1.632      by (metis convex_contains_segment)
1.633    { fix u
1.634      assume "u \<in> closed_segment w z"
1.635 -    then have "u \<in> s"
1.636 +    then have "u \<in> S"
1.637        by (metis wzs subsetD)
1.638      have "(\<Sum>i\<le>n. f i u * (- of_nat i * (z-u)^(i - 1)) / (fact i) +
1.639                        f (Suc i) u * (z-u)^i / (fact i)) =
1.640 @@ -1033,16 +1004,16 @@
1.641      qed
1.642      then have "((\<lambda>v. (\<Sum>i\<le>n. f i v * (z - v)^i / (fact i)))
1.643                  has_field_derivative f (Suc n) u * (z-u) ^ n / (fact n))
1.644 -               (at u within s)"
1.645 +               (at u within S)"
1.646        apply (intro derivative_eq_intros)
1.647 -      apply (blast intro: assms \<open>u \<in> s\<close>)
1.648 +      apply (blast intro: assms \<open>u \<in> S\<close>)
1.649        apply (rule refl)+
1.650        apply (auto simp: field_simps)
1.651        done
1.652    } note sum_deriv = this
1.653    { fix u
1.654      assume u: "u \<in> closed_segment w z"
1.655 -    then have us: "u \<in> s"
1.656 +    then have us: "u \<in> S"
1.657        by (metis wzs subsetD)
1.658      have "norm (f (Suc n) u) * norm (z - u) ^ n \<le> norm (f (Suc n) u) * norm (u - z) ^ n"
1.659        by (metis norm_minus_commute order_refl)
1.660 @@ -1063,7 +1034,7 @@
1.661    also have "... \<le> B * norm (z - w) ^ n / (fact n) * norm (w - z)"
1.662      apply (rule field_differentiable_bound
1.663        [where f' = "\<lambda>w. f (Suc n) w * (z - w)^n / (fact n)"
1.664 -         and s = "closed_segment w z", OF convex_closed_segment])
1.665 +         and S = "closed_segment w z", OF convex_closed_segment])
1.666      apply (auto simp: ends_in_segment DERIV_subset [OF sum_deriv wzs]
1.667                    norm_divide norm_mult norm_power divide_le_cancel cmod_bound)
1.668      done
1.669 @@ -1073,11 +1044,11 @@
1.670  qed
1.671
1.672  lemma complex_taylor:
1.673 -  assumes s: "convex s"
1.674 -      and f: "\<And>i x. x \<in> s \<Longrightarrow> i \<le> n \<Longrightarrow> (f i has_field_derivative f (Suc i) x) (at x within s)"
1.675 -      and B: "\<And>x. x \<in> s \<Longrightarrow> cmod (f (Suc n) x) \<le> B"
1.676 -      and w: "w \<in> s"
1.677 -      and z: "z \<in> s"
1.678 +  assumes S: "convex S"
1.679 +      and f: "\<And>i x. x \<in> S \<Longrightarrow> i \<le> n \<Longrightarrow> (f i has_field_derivative f (Suc i) x) (at x within S)"
1.680 +      and B: "\<And>x. x \<in> S \<Longrightarrow> cmod (f (Suc n) x) \<le> B"
1.681 +      and w: "w \<in> S"
1.682 +      and z: "z \<in> S"
1.683      shows "cmod(f 0 z - (\<Sum>i\<le>n. f i w * (z-w) ^ i / (fact i)))
1.684            \<le> B * cmod(z - w)^(Suc n) / fact n"
1.685    using assms by (rule field_taylor)
```