src/HOL/Complex_Analysis/Complex_Singularities.thy
changeset 77226 69956724ad4f
parent 77223 607e1e345e8f
child 77228 8c093a4b8ccf
equal deleted inserted replaced
77223:607e1e345e8f 77226:69956724ad4f
   128 lemma is_pole_basic':
   128 lemma is_pole_basic':
   129   assumes "f holomorphic_on A" "open A" "0 \<in> A" "f 0 \<noteq> 0" "n > 0"
   129   assumes "f holomorphic_on A" "open A" "0 \<in> A" "f 0 \<noteq> 0" "n > 0"
   130   shows   "is_pole (\<lambda>w. f w / w ^ n) 0"
   130   shows   "is_pole (\<lambda>w. f w / w ^ n) 0"
   131   using is_pole_basic[of f A 0] assms by simp
   131   using is_pole_basic[of f A 0] assms by simp
   132 
   132 
       
   133 lemma is_pole_compose: 
       
   134   assumes "is_pole f w" "g \<midarrow>z\<rightarrow> w" "eventually (\<lambda>z. g z \<noteq> w) (at z)"
       
   135   shows   "is_pole (\<lambda>x. f (g x)) z"
       
   136   using assms(1) unfolding is_pole_def
       
   137   by (rule filterlim_compose) (use assms in \<open>auto simp: filterlim_at\<close>)
       
   138 
       
   139 lemma is_pole_plus_const_iff:
       
   140   "is_pole f z \<longleftrightarrow> is_pole (\<lambda>x. f x + c) z"
       
   141 proof 
       
   142   assume "is_pole f z"
       
   143   then have "filterlim f at_infinity (at z)" unfolding is_pole_def .
       
   144   moreover have "((\<lambda>_. c) \<longlongrightarrow> c) (at z)" by auto
       
   145   ultimately have " LIM x (at z). f x + c :> at_infinity"
       
   146     using tendsto_add_filterlim_at_infinity'[of f "at z"] by auto
       
   147   then show "is_pole (\<lambda>x. f x + c) z" unfolding is_pole_def .
       
   148 next
       
   149   assume "is_pole (\<lambda>x. f x + c) z"
       
   150   then have "filterlim (\<lambda>x. f x + c) at_infinity (at z)" 
       
   151     unfolding is_pole_def .
       
   152   moreover have "((\<lambda>_. -c) \<longlongrightarrow> -c) (at z)" by auto
       
   153   ultimately have " LIM x (at z). f x :> at_infinity"
       
   154     using tendsto_add_filterlim_at_infinity'[of "(\<lambda>x. f x + c)"
       
   155         "at z" "(\<lambda>_. - c)" "-c"] 
       
   156     by auto
       
   157   then show "is_pole f z" unfolding is_pole_def .
       
   158 qed
       
   159 
       
   160 lemma is_pole_minus_const_iff:
       
   161   "is_pole (\<lambda>x. f x - c) z \<longleftrightarrow> is_pole f z"
       
   162   using is_pole_plus_const_iff [of f z "-c"] by simp
       
   163 
       
   164 lemma is_pole_alt:
       
   165   "is_pole f x  = (\<forall>B>0. \<exists>U. open U \<and> x\<in>U \<and> (\<forall>y\<in>U. y\<noteq>x \<longrightarrow> norm (f y)\<ge>B))"
       
   166   unfolding is_pole_def
       
   167   unfolding filterlim_at_infinity[of 0,simplified] eventually_at_topological
       
   168   by auto
       
   169 
       
   170 lemma is_pole_mult_analytic_nonzero1:
       
   171   assumes "is_pole g x" "f analytic_on {x}" "f x \<noteq> 0"
       
   172   shows   "is_pole (\<lambda>x. f x * g x) x"
       
   173   unfolding is_pole_def
       
   174 proof (rule tendsto_mult_filterlim_at_infinity)
       
   175   show "f \<midarrow>x\<rightarrow> f x"
       
   176     using assms by (simp add: analytic_at_imp_isCont isContD)
       
   177 qed (use assms in \<open>auto simp: is_pole_def\<close>)
       
   178 
       
   179 lemma is_pole_mult_analytic_nonzero2:
       
   180   assumes "is_pole f x" "g analytic_on {x}" "g x \<noteq> 0"
       
   181   shows   "is_pole (\<lambda>x. f x * g x) x"
       
   182   by (subst mult.commute, rule is_pole_mult_analytic_nonzero1) (use assms in auto)
       
   183 
       
   184 lemma is_pole_mult_analytic_nonzero1_iff:
       
   185   assumes "f analytic_on {x}" "f x \<noteq> 0"
       
   186   shows   "is_pole (\<lambda>x. f x * g x) x \<longleftrightarrow> is_pole g x"
       
   187 proof
       
   188   assume "is_pole g x"
       
   189   thus "is_pole (\<lambda>x. f x * g x) x"
       
   190     by (intro is_pole_mult_analytic_nonzero1 assms)
       
   191 next
       
   192   assume "is_pole (\<lambda>x. f x * g x) x"
       
   193   hence "is_pole (\<lambda>x. inverse (f x) * (f x * g x)) x"
       
   194     by (rule is_pole_mult_analytic_nonzero1)
       
   195        (use assms in \<open>auto intro!: analytic_intros\<close>)
       
   196   also have "?this \<longleftrightarrow> is_pole g x"
       
   197   proof (rule is_pole_cong)
       
   198     have "eventually (\<lambda>x. f x \<noteq> 0) (at x)"
       
   199       using assms by (simp add: analytic_at_neq_imp_eventually_neq)
       
   200     thus "eventually (\<lambda>x. inverse (f x) * (f x * g x) = g x) (at x)"
       
   201       by eventually_elim auto
       
   202   qed auto
       
   203   finally show "is_pole g x" .
       
   204 qed
       
   205 
       
   206 lemma is_pole_mult_analytic_nonzero2_iff:
       
   207   assumes "g analytic_on {x}" "g x \<noteq> 0"
       
   208   shows   "is_pole (\<lambda>x. f x * g x) x \<longleftrightarrow> is_pole f x"
       
   209   by (subst mult.commute, rule is_pole_mult_analytic_nonzero1_iff) (fact assms)+
       
   210 
   133 text \<open>The proposition
   211 text \<open>The proposition
   134               \<^term>\<open>\<exists>x. ((f::complex\<Rightarrow>complex) \<longlongrightarrow> x) (at z) \<or> is_pole f z\<close>
   212               \<^term>\<open>\<exists>x. ((f::complex\<Rightarrow>complex) \<longlongrightarrow> x) (at z) \<or> is_pole f z\<close>
   135 can be interpreted as the complex function \<^term>\<open>f\<close> has a non-essential singularity at \<^term>\<open>z\<close>
   213 can be interpreted as the complex function \<^term>\<open>f\<close> has a non-essential singularity at \<^term>\<open>z\<close>
   136 (i.e. the singularity is either removable or a pole).\<close>
   214 (i.e. the singularity is either removable or a pole).\<close>
   137 definition not_essential::"[complex \<Rightarrow> complex, complex] \<Rightarrow> bool" where
   215 definition not_essential::"[complex \<Rightarrow> complex, complex] \<Rightarrow> bool" where
   138   "not_essential f z = (\<exists>x. f\<midarrow>z\<rightarrow>x \<or> is_pole f z)"
   216   "not_essential f z = (\<exists>x. f\<midarrow>z\<rightarrow>x \<or> is_pole f z)"
   139 
   217 
   140 definition isolated_singularity_at::"[complex \<Rightarrow> complex, complex] \<Rightarrow> bool" where
   218 definition isolated_singularity_at::"[complex \<Rightarrow> complex, complex] \<Rightarrow> bool" where
   141   "isolated_singularity_at f z = (\<exists>r>0. f analytic_on ball z r-{z})"
   219   "isolated_singularity_at f z = (\<exists>r>0. f analytic_on ball z r-{z})"
   142 
   220 
       
   221 lemma not_essential_cong:
       
   222   assumes "eventually (\<lambda>x. f x = g x) (at z)" "z = z'"
       
   223   shows   "not_essential f z \<longleftrightarrow> not_essential g z'"
       
   224   unfolding not_essential_def using assms filterlim_cong is_pole_cong by fastforce
       
   225 
       
   226 lemma isolated_singularity_at_cong:
       
   227   assumes "eventually (\<lambda>x. f x = g x) (at z)" "z = z'"
       
   228   shows   "isolated_singularity_at f z \<longleftrightarrow> isolated_singularity_at g z'"
       
   229 proof -
       
   230   have "isolated_singularity_at g z"
       
   231     if "isolated_singularity_at f z" "eventually (\<lambda>x. f x = g x) (at z)" for f g
       
   232   proof -
       
   233     from that(1) obtain r where r: "r > 0" "f analytic_on ball z r - {z}"
       
   234       by (auto simp: isolated_singularity_at_def)
       
   235     from that(2) obtain r' where r': "r' > 0" "\<forall>x\<in>ball z r'-{z}. f x = g x"
       
   236       unfolding eventually_at_filter eventually_nhds_metric by (auto simp: dist_commute)
       
   237 
       
   238     have "f holomorphic_on ball z r - {z}"
       
   239       using r(2) by (subst (asm) analytic_on_open) auto
       
   240     hence "f holomorphic_on ball z (min r r') - {z}"
       
   241       by (rule holomorphic_on_subset) auto
       
   242     also have "?this \<longleftrightarrow> g holomorphic_on ball z (min r r') - {z}"
       
   243       using r' by (intro holomorphic_cong) auto
       
   244     also have "\<dots> \<longleftrightarrow> g analytic_on ball z (min r r') - {z}"
       
   245       by (subst analytic_on_open) auto
       
   246     finally show ?thesis
       
   247       unfolding isolated_singularity_at_def
       
   248       by (intro exI[of _ "min r r'"]) (use \<open>r > 0\<close> \<open>r' > 0\<close> in auto)
       
   249   qed
       
   250   from this[of f g] this[of g f] assms show ?thesis
       
   251     by (auto simp: eq_commute)
       
   252 qed
       
   253   
   143 lemma removable_singularity:
   254 lemma removable_singularity:
   144   assumes "f holomorphic_on A - {x}" "open A"
   255   assumes "f holomorphic_on A - {x}" "open A"
   145   assumes "f \<midarrow>x\<rightarrow> c"
   256   assumes "f \<midarrow>x\<rightarrow> c"
   146   shows   "(\<lambda>y. if y = x then c else f y) holomorphic_on A" (is "?g holomorphic_on _")
   257   shows   "(\<lambda>y. if y = x then c else f y) holomorphic_on A" (is "?g holomorphic_on _")
   147 proof -
   258 proof -
   793   assumes "f holomorphic_on s-{z}" "open s" "z\<in>s"
   904   assumes "f holomorphic_on s-{z}" "open s" "z\<in>s"
   794   shows "isolated_singularity_at f z"
   905   shows "isolated_singularity_at f z"
   795   using assms unfolding isolated_singularity_at_def
   906   using assms unfolding isolated_singularity_at_def
   796   by (metis analytic_on_holomorphic centre_in_ball insert_Diff openE open_delete subset_insert_iff)
   907   by (metis analytic_on_holomorphic centre_in_ball insert_Diff openE open_delete subset_insert_iff)
   797 
   908 
       
   909 lemma isolated_singularity_at_altdef:
       
   910   "isolated_singularity_at f z \<longleftrightarrow> eventually (\<lambda>z. f analytic_on {z}) (at z)"
       
   911 proof
       
   912   assume "isolated_singularity_at f z"
       
   913   then obtain r where r: "r > 0" "f analytic_on ball z r - {z}"
       
   914     unfolding isolated_singularity_at_def by blast
       
   915   have "eventually (\<lambda>w. w \<in> ball z r - {z}) (at z)"
       
   916     using r(1) by (intro eventually_at_in_open) auto
       
   917   thus "eventually (\<lambda>z. f analytic_on {z}) (at z)"
       
   918     by eventually_elim (use r analytic_on_subset in auto)
       
   919 next
       
   920   assume "eventually (\<lambda>z. f analytic_on {z}) (at z)"
       
   921   then obtain A where A: "open A" "z \<in> A" "\<And>w. w \<in> A - {z} \<Longrightarrow> f analytic_on {w}"
       
   922     unfolding eventually_at_topological by blast
       
   923   then show "isolated_singularity_at f z"
       
   924     by (meson analytic_imp_holomorphic analytic_on_analytic_at isolated_singularity_at_holomorphic)
       
   925 qed
       
   926 
   798 lemma isolated_singularity_at_shift:
   927 lemma isolated_singularity_at_shift:
   799   assumes "isolated_singularity_at (\<lambda>x. f (x + w)) z"
   928   assumes "isolated_singularity_at (\<lambda>x. f (x + w)) z"
   800   shows   "isolated_singularity_at f (z + w)"
   929   shows   "isolated_singularity_at f (z + w)"
   801 proof -
   930 proof -
   802   from assms obtain r where r: "r > 0" and ana: "(\<lambda>x. f (x + w)) analytic_on ball z r - {z}"
   931   from assms obtain r where r: "r > 0" and ana: "(\<lambda>x. f (x + w)) analytic_on ball z r - {z}"
   861     using assms continuous_on_eq_continuous_at isContD by blast
   990     using assms continuous_on_eq_continuous_at isContD by blast
   862   thus ?thesis
   991   thus ?thesis
   863     by (auto simp: not_essential_def)
   992     by (auto simp: not_essential_def)
   864 qed
   993 qed
   865 
   994 
       
   995 lemma not_essential_analytic:
       
   996   assumes "f analytic_on {z}"
       
   997   shows   "not_essential f z"
       
   998   using analytic_at assms not_essential_holomorphic by blast
       
   999 
       
  1000 lemma not_essential_id [singularity_intros]: "not_essential (\<lambda>w. w) z"
       
  1001   by (simp add: not_essential_analytic)
       
  1002 
       
  1003 lemma is_pole_imp_not_essential [intro]: "is_pole f z \<Longrightarrow> not_essential f z"
       
  1004   by (auto simp: not_essential_def)
       
  1005 
       
  1006 lemma tendsto_imp_not_essential [intro]: "f \<midarrow>z\<rightarrow> c \<Longrightarrow> not_essential f z"
       
  1007   by (auto simp: not_essential_def)
       
  1008 
   866 lemma eventually_not_pole:
  1009 lemma eventually_not_pole:
   867   assumes "isolated_singularity_at f z"
  1010   assumes "isolated_singularity_at f z"
   868   shows   "eventually (\<lambda>w. \<not>is_pole f w) (at z)"
  1011   shows   "eventually (\<lambda>w. \<not>is_pole f w) (at z)"
   869 proof -
  1012 proof -
   870   from assms obtain r where "r > 0" and r: "f analytic_on ball z r - {z}"
  1013   from assms obtain r where "r > 0" and r: "f analytic_on ball z r - {z}"
   899   have "not_essential (\<lambda>w. -1 * f w) z"
  1042   have "not_essential (\<lambda>w. -1 * f w) z"
   900     by (intro assms singularity_intros)
  1043     by (intro assms singularity_intros)
   901   thus ?thesis by simp
  1044   thus ?thesis by simp
   902 qed
  1045 qed
   903 
  1046 
   904 subsubsection \<open>The order of non-essential singularities (i.e. removable singularities or poles)\<close>
  1047 lemma isolated_singularity_at_analytic:
       
  1048   assumes "f analytic_on {z}"
       
  1049   shows   "isolated_singularity_at f z"
       
  1050 proof -
       
  1051   from assms obtain r where r: "r > 0" "f holomorphic_on ball z r"
       
  1052     by (auto simp: analytic_on_def)
       
  1053   show ?thesis
       
  1054     by (rule isolated_singularity_at_holomorphic[of f "ball z r"])
       
  1055        (use \<open>r > 0\<close> in \<open>auto intro!: holomorphic_on_subset[OF r(2)]\<close>)
       
  1056 qed
       
  1057 
       
  1058 subsection \<open>The order of non-essential singularities (i.e. removable singularities or poles)\<close>
   905 
  1059 
   906 definition\<^marker>\<open>tag important\<close> zorder :: "(complex \<Rightarrow> complex) \<Rightarrow> complex \<Rightarrow> int" where
  1060 definition\<^marker>\<open>tag important\<close> zorder :: "(complex \<Rightarrow> complex) \<Rightarrow> complex \<Rightarrow> int" where
   907   "zorder f z = (THE n. (\<exists>h r. r>0 \<and> h holomorphic_on cball z r \<and> h z\<noteq>0
  1061   "zorder f z = (THE n. (\<exists>h r. r>0 \<and> h holomorphic_on cball z r \<and> h z\<noteq>0
   908                    \<and> (\<forall>w\<in>cball z r - {z}. f w =  h w * (w-z) powr (of_int n)
  1062                    \<and> (\<forall>w\<in>cball z r - {z}. f w =  h w * (w-z) powr (of_int n)
   909                    \<and> h w \<noteq>0)))"
  1063                    \<and> h w \<noteq>0)))"
  1656   qed
  1810   qed
  1657   then show "zorder f z = zorder g z'" "zor_poly f z = zor_poly g z'"
  1811   then show "zorder f z = zorder g z'" "zor_poly f z = zor_poly g z'"
  1658       using \<open>z=z'\<close> unfolding P_def zorder_def zor_poly_def by auto
  1812       using \<open>z=z'\<close> unfolding P_def zorder_def zor_poly_def by auto
  1659 qed
  1813 qed
  1660 
  1814 
       
  1815 lemma zorder_times_analytic':
       
  1816   assumes "isolated_singularity_at f z" "not_essential f z"
       
  1817   assumes "g analytic_on {z}" "frequently (\<lambda>z. f z * g z \<noteq> 0) (at z)"
       
  1818   shows   "zorder (\<lambda>x. f x * g x) z = zorder f z + zorder g z"
       
  1819 proof (rule zorder_times)
       
  1820   show "isolated_singularity_at g z" "not_essential g z"
       
  1821     by (intro isolated_singularity_at_analytic not_essential_analytic assms)+
       
  1822 qed (use assms in auto)
       
  1823 
       
  1824 lemma zorder_cmult:
       
  1825   assumes "c \<noteq> 0"
       
  1826   shows   "zorder (\<lambda>z. c * f z) z = zorder f z"
       
  1827 proof -
       
  1828   define P where
       
  1829     "P = (\<lambda>f n h r. 0 < r \<and> h holomorphic_on cball z r \<and>
       
  1830               h z \<noteq> 0 \<and> (\<forall>w\<in>cball z r - {z}. f w = h w * (w - z) powr of_int n \<and> h w \<noteq> 0))"
       
  1831   have *: "P (\<lambda>x. c * f x) n (\<lambda>x. c * h x) r" if "P f n h r" "c \<noteq> 0" for f n h r c
       
  1832     using that unfolding P_def by (auto intro!: holomorphic_intros)
       
  1833   have "(\<exists>h r. P (\<lambda>x. c * f x) n h r) \<longleftrightarrow> (\<exists>h r. P f n h r)" for n
       
  1834     using *[of f n _ _ c] *[of "\<lambda>x. c * f x" n _ _ "inverse c"] \<open>c \<noteq> 0\<close>
       
  1835     by (fastforce simp: field_simps)
       
  1836   hence "(THE n. \<exists>h r. P (\<lambda>x. c * f x) n h r) = (THE n. \<exists>h r. P f n h r)"
       
  1837     by simp
       
  1838   thus ?thesis
       
  1839     by (simp add: zorder_def P_def)
       
  1840 qed
       
  1841 
  1661 lemma zorder_nonzero_div_power:
  1842 lemma zorder_nonzero_div_power:
  1662   assumes sz: "open s" "z \<in> s" "f holomorphic_on s" "f z \<noteq> 0" and "n > 0"
  1843   assumes sz: "open s" "z \<in> s" "f holomorphic_on s" "f z \<noteq> 0" and "n > 0"
  1663   shows  "zorder (\<lambda>w. f w / (w - z) ^ n) z = - n"
  1844   shows  "zorder (\<lambda>w. f w / (w - z) ^ n) z = - n"
  1664   using zorder_eqI [OF sz] by (simp add: powr_minus_divide)
  1845   using zorder_eqI [OF sz] by (simp add: powr_minus_divide)
  1665 
  1846 
  2267       apply (subst complex_powr_of_int)
  2448       apply (subst complex_powr_of_int)
  2268       using deriv_f_eq that unfolding D_def by auto
  2449       using deriv_f_eq that unfolding D_def by auto
  2269   qed
  2450   qed
  2270 qed
  2451 qed
  2271 
  2452 
       
  2453 
       
  2454 lemma deriv_divide_is_pole: \<comment>\<open>Generalises @{thm zorder_deriv}\<close>
       
  2455   fixes f g::"complex \<Rightarrow> complex" and z::complex
       
  2456   assumes f_iso:"isolated_singularity_at f z"
       
  2457       and f_ness:"not_essential f z" 
       
  2458       and fg_nconst: "\<exists>\<^sub>Fw in (at z). deriv f w *  f w \<noteq> 0"
       
  2459       and f_ord:"zorder f z \<noteq>0"
       
  2460     shows "is_pole (\<lambda>z. deriv f z / f z) z"
       
  2461 proof (rule neg_zorder_imp_is_pole)
       
  2462   define ff where "ff=(\<lambda>w. deriv f w / f w)"
       
  2463   show "isolated_singularity_at ff z" 
       
  2464     using f_iso f_ness unfolding ff_def
       
  2465     by (auto intro:singularity_intros)
       
  2466   show "not_essential ff z" 
       
  2467     unfolding ff_def using f_ness f_iso
       
  2468     by (auto intro:singularity_intros)
       
  2469 
       
  2470   have "zorder ff z =  zorder (deriv f) z - zorder f z"
       
  2471     unfolding ff_def using f_iso f_ness fg_nconst
       
  2472     apply (rule_tac zorder_divide)
       
  2473     by (auto intro:singularity_intros)
       
  2474   moreover have "zorder (deriv f) z = zorder f z - 1"
       
  2475   proof (rule zorder_deriv_minus_1)
       
  2476     show " \<exists>\<^sub>F w in at z. f w \<noteq> 0"
       
  2477       using fg_nconst frequently_elim1 by fastforce
       
  2478   qed (use f_iso f_ness f_ord in auto)
       
  2479   ultimately show "zorder ff z < 0" by auto
       
  2480     
       
  2481   show "\<exists>\<^sub>F w in at z. ff w \<noteq> 0" 
       
  2482     unfolding ff_def using fg_nconst by auto
       
  2483 qed
       
  2484 
       
  2485 lemma is_pole_deriv_divide_is_pole:
       
  2486   fixes f g::"complex \<Rightarrow> complex" and z::complex
       
  2487   assumes f_iso:"isolated_singularity_at f z"
       
  2488       and "is_pole f z" 
       
  2489     shows "is_pole (\<lambda>z. deriv f z / f z) z"
       
  2490 proof (rule deriv_divide_is_pole[OF f_iso])
       
  2491   show "not_essential f z" 
       
  2492     using \<open>is_pole f z\<close> unfolding not_essential_def by auto
       
  2493   show "\<exists>\<^sub>F w in at z. deriv f w * f w \<noteq> 0"
       
  2494     apply (rule isolated_pole_imp_nzero_times)
       
  2495     using assms by auto
       
  2496   show "zorder f z \<noteq> 0"
       
  2497     using isolated_pole_imp_neg_zorder assms by fastforce
       
  2498 qed
       
  2499 
       
  2500 subsection \<open>Isolated zeroes\<close>
       
  2501 
       
  2502 definition isolated_zero :: "(complex \<Rightarrow> complex) \<Rightarrow> complex \<Rightarrow> bool" where
       
  2503   "isolated_zero f z \<longleftrightarrow> f z = 0 \<and> eventually (\<lambda>z. f z \<noteq> 0) (at z)"
       
  2504 
       
  2505 lemma isolated_zero_altdef: "isolated_zero f z \<longleftrightarrow> f z = 0 \<and> \<not>z islimpt {z. f z = 0}"
       
  2506   unfolding isolated_zero_def eventually_at_filter eventually_nhds islimpt_def by blast
       
  2507 
       
  2508 lemma isolated_zero_mult1:
       
  2509   assumes "isolated_zero f x" "isolated_zero g x"
       
  2510   shows   "isolated_zero (\<lambda>x. f x * g x) x"
       
  2511 proof -
       
  2512   have "eventually (\<lambda>x. f x \<noteq> 0) (at x)" "eventually (\<lambda>x. g x \<noteq> 0) (at x)"
       
  2513     using assms unfolding isolated_zero_def by auto
       
  2514   hence "eventually (\<lambda>x. f x * g x \<noteq> 0) (at x)"
       
  2515     by eventually_elim auto
       
  2516   with assms show ?thesis
       
  2517     by (auto simp: isolated_zero_def)
       
  2518 qed
       
  2519 
       
  2520 lemma isolated_zero_mult2:
       
  2521   assumes "isolated_zero f x" "g x \<noteq> 0" "g analytic_on {x}"
       
  2522   shows   "isolated_zero (\<lambda>x. f x * g x) x"
       
  2523 proof -
       
  2524   have "eventually (\<lambda>x. f x \<noteq> 0) (at x)"
       
  2525     using assms unfolding isolated_zero_def by auto
       
  2526   moreover have "eventually (\<lambda>x. g x \<noteq> 0) (at x)"
       
  2527     using analytic_at_neq_imp_eventually_neq[of g x 0] assms by auto
       
  2528   ultimately have "eventually (\<lambda>x. f x * g x \<noteq> 0) (at x)"
       
  2529     by eventually_elim auto
       
  2530   thus ?thesis
       
  2531     using assms(1) by (auto simp: isolated_zero_def)
       
  2532 qed
       
  2533 
       
  2534 lemma isolated_zero_mult3:
       
  2535   assumes "isolated_zero f x" "g x \<noteq> 0" "g analytic_on {x}"
       
  2536   shows   "isolated_zero (\<lambda>x. g x * f x) x"
       
  2537   using isolated_zero_mult2[OF assms] by (simp add: mult_ac)
       
  2538   
       
  2539 lemma isolated_zero_prod:
       
  2540   assumes "\<And>x. x \<in> I \<Longrightarrow> isolated_zero (f x) z" "I \<noteq> {}" "finite I"
       
  2541   shows   "isolated_zero (\<lambda>y. \<Prod>x\<in>I. f x y) z"
       
  2542   using assms(3,2,1) by (induction rule: finite_ne_induct) (auto intro: isolated_zero_mult1)
       
  2543 
       
  2544 lemma non_isolated_zero':
       
  2545   assumes "isolated_singularity_at f z" "not_essential f z" "f z = 0" "\<not>isolated_zero f z"
       
  2546   shows   "eventually (\<lambda>z. f z = 0) (at z)"
       
  2547 proof (rule not_essential_frequently_0_imp_eventually_0)
       
  2548   from assms show "frequently (\<lambda>z. f z = 0) (at z)"
       
  2549     by (auto simp: frequently_def isolated_zero_def)
       
  2550 qed fact+
       
  2551 
       
  2552 lemma non_isolated_zero:
       
  2553   assumes "\<not>isolated_zero f z" "f analytic_on {z}" "f z = 0"
       
  2554   shows   "eventually (\<lambda>z. f z = 0) (nhds z)"
       
  2555 proof -
       
  2556   have "eventually (\<lambda>z. f z = 0) (at z)"
       
  2557     by (rule non_isolated_zero')
       
  2558        (use assms in \<open>auto intro: not_essential_analytic isolated_singularity_at_analytic\<close>)
       
  2559   with \<open>f z = 0\<close> show ?thesis
       
  2560     unfolding eventually_at_filter by (auto elim!: eventually_mono)
       
  2561 qed
       
  2562 
       
  2563 lemma not_essential_compose:
       
  2564   assumes "not_essential f (g z)" "g analytic_on {z}"
       
  2565   shows   "not_essential (\<lambda>x. f (g x)) z"
       
  2566 proof (cases "isolated_zero (\<lambda>w. g w - g z) z")
       
  2567   case False
       
  2568   hence "eventually (\<lambda>w. g w - g z = 0) (nhds z)"
       
  2569     by (rule non_isolated_zero) (use assms in \<open>auto intro!: analytic_intros\<close>)
       
  2570   hence "not_essential (\<lambda>x. f (g x)) z \<longleftrightarrow> not_essential (\<lambda>_. f (g z)) z"
       
  2571     by (intro not_essential_cong refl)
       
  2572        (auto elim!: eventually_mono simp: eventually_at_filter)
       
  2573   thus ?thesis
       
  2574     by (simp add: not_essential_const)
       
  2575 next
       
  2576   case True
       
  2577   hence ev: "eventually (\<lambda>w. g w \<noteq> g z) (at z)"
       
  2578     by (auto simp: isolated_zero_def)
       
  2579   from assms consider c where "f \<midarrow>g z\<rightarrow> c" | "is_pole f (g z)"
       
  2580     by (auto simp: not_essential_def)  
       
  2581   have "isCont g z"
       
  2582     by (rule analytic_at_imp_isCont) fact
       
  2583   hence lim: "g \<midarrow>z\<rightarrow> g z"
       
  2584     using isContD by blast
       
  2585 
       
  2586   from assms(1) consider c where "f \<midarrow>g z\<rightarrow> c" | "is_pole f (g z)"
       
  2587     unfolding not_essential_def by blast
       
  2588   thus ?thesis
       
  2589   proof cases
       
  2590     fix c assume "f \<midarrow>g z\<rightarrow> c"
       
  2591     hence "(\<lambda>x. f (g x)) \<midarrow>z\<rightarrow> c"
       
  2592       by (rule filterlim_compose) (use lim ev in \<open>auto simp: filterlim_at\<close>)
       
  2593     thus ?thesis
       
  2594       by (auto simp: not_essential_def)
       
  2595   next
       
  2596     assume "is_pole f (g z)"
       
  2597     hence "is_pole (\<lambda>x. f (g x)) z"
       
  2598       by (rule is_pole_compose) fact+
       
  2599     thus ?thesis
       
  2600       by (auto simp: not_essential_def)
       
  2601   qed
       
  2602 qed
       
  2603   
       
  2604 subsection \<open>Isolated points\<close>
       
  2605 
       
  2606 definition isolated_points_of :: "complex set \<Rightarrow> complex set" where
       
  2607   "isolated_points_of A = {z\<in>A. eventually (\<lambda>w. w \<notin> A) (at z)}"
       
  2608 
       
  2609 lemma isolated_points_of_altdef: "isolated_points_of A = {z\<in>A. \<not>z islimpt A}"
       
  2610   unfolding isolated_points_of_def islimpt_def eventually_at_filter eventually_nhds by blast
       
  2611 
       
  2612 lemma isolated_points_of_empty [simp]: "isolated_points_of {} = {}"
       
  2613   and isolated_points_of_UNIV [simp]:  "isolated_points_of UNIV = {}"
       
  2614   by (auto simp: isolated_points_of_def)
       
  2615 
       
  2616 lemma isolated_points_of_open_is_empty [simp]: "open A \<Longrightarrow> isolated_points_of A = {}"
       
  2617   unfolding isolated_points_of_altdef 
       
  2618   by (simp add: interior_limit_point interior_open)
       
  2619 
       
  2620 lemma isolated_points_of_subset: "isolated_points_of A \<subseteq> A"
       
  2621   by (auto simp: isolated_points_of_def)
       
  2622 
       
  2623 lemma isolated_points_of_discrete:
       
  2624   assumes "discrete A"
       
  2625   shows   "isolated_points_of A = A"
       
  2626   using assms by (auto simp: isolated_points_of_def discrete_altdef)
       
  2627 
       
  2628 lemmas uniform_discreteI1 = uniformI1
       
  2629 lemmas uniform_discreteI2 = uniformI2
       
  2630 
       
  2631 lemma isolated_singularity_at_compose:
       
  2632   assumes "isolated_singularity_at f (g z)" "g analytic_on {z}"
       
  2633   shows   "isolated_singularity_at (\<lambda>x. f (g x)) z"
       
  2634 proof (cases "isolated_zero (\<lambda>w. g w - g z) z")
       
  2635   case False
       
  2636   hence "eventually (\<lambda>w. g w - g z = 0) (nhds z)"
       
  2637     by (rule non_isolated_zero) (use assms in \<open>auto intro!: analytic_intros\<close>)
       
  2638   hence "isolated_singularity_at (\<lambda>x. f (g x)) z \<longleftrightarrow> isolated_singularity_at (\<lambda>_. f (g z)) z"
       
  2639     by (intro isolated_singularity_at_cong refl)
       
  2640        (auto elim!: eventually_mono simp: eventually_at_filter)
       
  2641   thus ?thesis
       
  2642     by (simp add: isolated_singularity_at_const)
       
  2643 next
       
  2644   case True
       
  2645   from assms(1) obtain r where r: "r > 0" "f analytic_on ball (g z) r - {g z}"
       
  2646     by (auto simp: isolated_singularity_at_def)
       
  2647   hence holo_f: "f holomorphic_on ball (g z) r - {g z}"
       
  2648     by (subst (asm) analytic_on_open) auto
       
  2649   from assms(2) obtain r' where r': "r' > 0" "g holomorphic_on ball z r'"
       
  2650     by (auto simp: analytic_on_def)
       
  2651 
       
  2652   have "continuous_on (ball z r') g"
       
  2653     using holomorphic_on_imp_continuous_on r' by blast
       
  2654   hence "isCont g z"
       
  2655     using r' by (subst (asm) continuous_on_eq_continuous_at) auto
       
  2656   hence "g \<midarrow>z\<rightarrow> g z"
       
  2657     using isContD by blast
       
  2658   hence "eventually (\<lambda>w. g w \<in> ball (g z) r) (at z)"
       
  2659     using \<open>r > 0\<close> unfolding tendsto_def by force
       
  2660   moreover have "eventually (\<lambda>w. g w \<noteq> g z) (at z)" using True
       
  2661     by (auto simp: isolated_zero_def elim!: eventually_mono)
       
  2662   ultimately have "eventually (\<lambda>w. g w \<in> ball (g z) r - {g z}) (at z)"
       
  2663     by eventually_elim auto
       
  2664   then obtain r'' where r'': "r'' > 0" "\<forall>w\<in>ball z r''-{z}. g w \<in> ball (g z) r - {g z}"
       
  2665     unfolding eventually_at_filter eventually_nhds_metric ball_def
       
  2666     by (auto simp: dist_commute)
       
  2667   have "f \<circ> g holomorphic_on ball z (min r' r'') - {z}"
       
  2668   proof (rule holomorphic_on_compose_gen)
       
  2669     show "g holomorphic_on ball z (min r' r'') - {z}"
       
  2670       by (rule holomorphic_on_subset[OF r'(2)]) auto
       
  2671     show "f holomorphic_on ball (g z) r - {g z}"
       
  2672       by fact
       
  2673     show "g ` (ball z (min r' r'') - {z}) \<subseteq> ball (g z) r - {g z}"
       
  2674       using r'' by force
       
  2675   qed
       
  2676   hence "f \<circ> g analytic_on ball z (min r' r'') - {z}"
       
  2677     by (subst analytic_on_open) auto
       
  2678   thus ?thesis using \<open>r' > 0\<close> \<open>r'' > 0\<close>
       
  2679     by (auto simp: isolated_singularity_at_def o_def intro!: exI[of _ "min r' r''"])
       
  2680 qed
       
  2681 
       
  2682 lemma is_pole_power_int_0:
       
  2683   assumes "f analytic_on {x}" "isolated_zero f x" "n < 0"
       
  2684   shows   "is_pole (\<lambda>x. f x powi n) x"
       
  2685 proof -
       
  2686   have "f \<midarrow>x\<rightarrow> f x"
       
  2687     using assms(1) by (simp add: analytic_at_imp_isCont isContD)
       
  2688   with assms show ?thesis
       
  2689     unfolding is_pole_def
       
  2690     by (intro filterlim_power_int_neg_at_infinity) (auto simp: isolated_zero_def)
       
  2691 qed
       
  2692 
       
  2693 lemma isolated_zero_imp_not_constant_on:
       
  2694   assumes "isolated_zero f x" "x \<in> A" "open A"
       
  2695   shows   "\<not>f constant_on A"
       
  2696 proof
       
  2697   assume "f constant_on A"
       
  2698   then obtain c where c: "\<And>x. x \<in> A \<Longrightarrow> f x = c"
       
  2699     by (auto simp: constant_on_def)
       
  2700   from assms and c[of x] have [simp]: "c = 0"
       
  2701     by (auto simp: isolated_zero_def)
       
  2702   have "eventually (\<lambda>x. f x \<noteq> 0) (at x)"
       
  2703     using assms by (auto simp: isolated_zero_def)
       
  2704   moreover have "eventually (\<lambda>x. x \<in> A) (at x)"
       
  2705     using assms by (intro eventually_at_in_open') auto
       
  2706   ultimately have "eventually (\<lambda>x. False) (at x)"
       
  2707     by eventually_elim (use c in auto)
       
  2708   thus False
       
  2709     by simp
       
  2710 qed
       
  2711 
  2272 end
  2712 end