author eberlm Sat Jul 15 14:33:56 2017 +0100 (2017-07-15) changeset 66277 512b0dc09061 parent 66276 acc3b7dd0b21 child 66278 978fb83b100c
HOL-Analysis: Infinite products
```     1.1 --- a/src/HOL/Analysis/Analysis.thy	Sat Jul 15 14:32:02 2017 +0100
1.2 +++ b/src/HOL/Analysis/Analysis.thy	Sat Jul 15 14:33:56 2017 +0100
1.3 @@ -9,6 +9,7 @@
1.4    Homeomorphism
1.5    Bounded_Continuous_Function
1.6    Function_Topology
1.7 +  Infinite_Products
1.8    Weierstrass_Theorems
1.9    Polytope
1.10    Jordan_Curve
```
```     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/src/HOL/Analysis/Infinite_Products.thy	Sat Jul 15 14:33:56 2017 +0100
2.3 @@ -0,0 +1,479 @@
2.4 +(*
2.5 +  File:      HOL/Analysis/Infinite_Product.thy
2.6 +  Author:    Manuel Eberl
2.7 +
2.8 +  Basic results about convergence and absolute convergence of infinite products
2.9 +  and their connection to summability.
2.10 +*)
2.11 +section \<open>Infinite Products\<close>
2.12 +theory Infinite_Products
2.13 +  imports Complex_Main
2.14 +begin
2.15 +
2.16 +lemma sum_le_prod:
2.17 +  fixes f :: "'a \<Rightarrow> 'b :: linordered_semidom"
2.18 +  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0"
2.19 +  shows   "sum f A \<le> (\<Prod>x\<in>A. 1 + f x)"
2.20 +  using assms
2.21 +proof (induction A rule: infinite_finite_induct)
2.22 +  case (insert x A)
2.23 +  from insert.hyps have "sum f A + f x * (\<Prod>x\<in>A. 1) \<le> (\<Prod>x\<in>A. 1 + f x) + f x * (\<Prod>x\<in>A. 1 + f x)"
2.24 +    by (intro add_mono insert mult_left_mono prod_mono) (auto intro: insert.prems)
2.25 +  with insert.hyps show ?case by (simp add: algebra_simps)
2.26 +qed simp_all
2.27 +
2.28 +lemma prod_le_exp_sum:
2.29 +  fixes f :: "'a \<Rightarrow> real"
2.30 +  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0"
2.31 +  shows   "prod (\<lambda>x. 1 + f x) A \<le> exp (sum f A)"
2.32 +  using assms
2.33 +proof (induction A rule: infinite_finite_induct)
2.34 +  case (insert x A)
2.35 +  have "(1 + f x) * (\<Prod>x\<in>A. 1 + f x) \<le> exp (f x) * exp (sum f A)"
2.36 +    using insert.prems by (intro mult_mono insert prod_nonneg exp_ge_add_one_self) auto
2.38 +qed simp_all
2.39 +
2.40 +lemma lim_ln_1_plus_x_over_x_at_0: "(\<lambda>x::real. ln (1 + x) / x) \<midarrow>0\<rightarrow> 1"
2.41 +proof (rule lhopital)
2.42 +  show "(\<lambda>x::real. ln (1 + x)) \<midarrow>0\<rightarrow> 0"
2.43 +    by (rule tendsto_eq_intros refl | simp)+
2.44 +  have "eventually (\<lambda>x::real. x \<in> {-1/2<..<1/2}) (nhds 0)"
2.45 +    by (rule eventually_nhds_in_open) auto
2.46 +  hence *: "eventually (\<lambda>x::real. x \<in> {-1/2<..<1/2}) (at 0)"
2.47 +    by (rule filter_leD [rotated]) (simp_all add: at_within_def)
2.48 +  show "eventually (\<lambda>x::real. ((\<lambda>x. ln (1 + x)) has_field_derivative inverse (1 + x)) (at x)) (at 0)"
2.49 +    using * by eventually_elim (auto intro!: derivative_eq_intros simp: field_simps)
2.50 +  show "eventually (\<lambda>x::real. ((\<lambda>x. x) has_field_derivative 1) (at x)) (at 0)"
2.51 +    using * by eventually_elim (auto intro!: derivative_eq_intros simp: field_simps)
2.52 +  show "\<forall>\<^sub>F x in at 0. x \<noteq> 0" by (auto simp: at_within_def eventually_inf_principal)
2.53 +  show "(\<lambda>x::real. inverse (1 + x) / 1) \<midarrow>0\<rightarrow> 1"
2.54 +    by (rule tendsto_eq_intros refl | simp)+
2.55 +qed auto
2.56 +
2.57 +definition convergent_prod :: "(nat \<Rightarrow> 'a :: {t2_space,comm_semiring_1}) \<Rightarrow> bool" where
2.58 +  "convergent_prod f \<longleftrightarrow> (\<exists>M L. (\<lambda>n. \<Prod>i\<le>n. f (i+M)) \<longlonglongrightarrow> L \<and> L \<noteq> 0)"
2.59 +
2.60 +lemma convergent_prod_altdef:
2.61 +  fixes f :: "nat \<Rightarrow> 'a :: {t2_space,comm_semiring_1}"
2.62 +  shows "convergent_prod f \<longleftrightarrow> (\<exists>M L. (\<forall>n\<ge>M. f n \<noteq> 0) \<and> (\<lambda>n. \<Prod>i\<le>n. f (i+M)) \<longlonglongrightarrow> L \<and> L \<noteq> 0)"
2.63 +proof
2.64 +  assume "convergent_prod f"
2.65 +  then obtain M L where *: "(\<lambda>n. \<Prod>i\<le>n. f (i+M)) \<longlonglongrightarrow> L" "L \<noteq> 0"
2.66 +    by (auto simp: convergent_prod_def)
2.67 +  have "f i \<noteq> 0" if "i \<ge> M" for i
2.68 +  proof
2.69 +    assume "f i = 0"
2.70 +    have **: "eventually (\<lambda>n. (\<Prod>i\<le>n. f (i+M)) = 0) sequentially"
2.71 +      using eventually_ge_at_top[of "i - M"]
2.72 +    proof eventually_elim
2.73 +      case (elim n)
2.74 +      with \<open>f i = 0\<close> and \<open>i \<ge> M\<close> show ?case
2.75 +        by (auto intro!: bexI[of _ "i - M"] prod_zero)
2.76 +    qed
2.77 +    have "(\<lambda>n. (\<Prod>i\<le>n. f (i+M))) \<longlonglongrightarrow> 0"
2.78 +      unfolding filterlim_iff
2.79 +      by (auto dest!: eventually_nhds_x_imp_x intro!: eventually_mono[OF **])
2.80 +    from tendsto_unique[OF _ this *(1)] and *(2)
2.81 +      show False by simp
2.82 +  qed
2.83 +  with * show "(\<exists>M L. (\<forall>n\<ge>M. f n \<noteq> 0) \<and> (\<lambda>n. \<Prod>i\<le>n. f (i+M)) \<longlonglongrightarrow> L \<and> L \<noteq> 0)"
2.84 +    by blast
2.85 +qed (auto simp: convergent_prod_def)
2.86 +
2.87 +definition abs_convergent_prod :: "(nat \<Rightarrow> _) \<Rightarrow> bool" where
2.88 +  "abs_convergent_prod f \<longleftrightarrow> convergent_prod (\<lambda>i. 1 + norm (f i - 1))"
2.89 +
2.90 +lemma abs_convergent_prodI:
2.91 +  assumes "convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"
2.92 +  shows   "abs_convergent_prod f"
2.93 +proof -
2.94 +  from assms obtain L where L: "(\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1)) \<longlonglongrightarrow> L"
2.95 +    by (auto simp: convergent_def)
2.96 +  have "L \<ge> 1"
2.97 +  proof (rule tendsto_le)
2.98 +    show "eventually (\<lambda>n. (\<Prod>i\<le>n. 1 + norm (f i - 1)) \<ge> 1) sequentially"
2.99 +    proof (intro always_eventually allI)
2.100 +      fix n
2.101 +      have "(\<Prod>i\<le>n. 1 + norm (f i - 1)) \<ge> (\<Prod>i\<le>n. 1)"
2.102 +        by (intro prod_mono) auto
2.103 +      thus "(\<Prod>i\<le>n. 1 + norm (f i - 1)) \<ge> 1" by simp
2.104 +    qed
2.105 +  qed (use L in simp_all)
2.106 +  hence "L \<noteq> 0" by auto
2.107 +  with L show ?thesis unfolding abs_convergent_prod_def convergent_prod_def
2.108 +    by (intro exI[of _ "0::nat"] exI[of _ L]) auto
2.109 +qed
2.110 +
2.111 +lemma
2.112 +  fixes f :: "nat \<Rightarrow> 'a :: {real_normed_div_algebra,idom}"
2.113 +  assumes "convergent_prod f"
2.114 +  shows   convergent_prod_imp_convergent: "convergent (\<lambda>n. \<Prod>i\<le>n. f i)"
2.115 +    and   convergent_prod_to_zero_iff:    "(\<lambda>n. \<Prod>i\<le>n. f i) \<longlonglongrightarrow> 0 \<longleftrightarrow> (\<exists>i. f i = 0)"
2.116 +proof -
2.117 +  from assms obtain M L
2.118 +    where M: "\<And>n. n \<ge> M \<Longrightarrow> f n \<noteq> 0" and "(\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L" and "L \<noteq> 0"
2.119 +    by (auto simp: convergent_prod_altdef)
2.120 +  note this(2)
2.121 +  also have "(\<lambda>n. \<Prod>i\<le>n. f (i + M)) = (\<lambda>n. \<Prod>i=M..M+n. f i)"
2.122 +    by (intro ext prod.reindex_bij_witness[of _ "\<lambda>n. n - M" "\<lambda>n. n + M"]) auto
2.123 +  finally have "(\<lambda>n. (\<Prod>i<M. f i) * (\<Prod>i=M..M+n. f i)) \<longlonglongrightarrow> (\<Prod>i<M. f i) * L"
2.124 +    by (intro tendsto_mult tendsto_const)
2.125 +  also have "(\<lambda>n. (\<Prod>i<M. f i) * (\<Prod>i=M..M+n. f i)) = (\<lambda>n. (\<Prod>i\<in>{..<M}\<union>{M..M+n}. f i))"
2.126 +    by (subst prod.union_disjoint) auto
2.127 +  also have "(\<lambda>n. {..<M} \<union> {M..M+n}) = (\<lambda>n. {..n+M})" by auto
2.128 +  finally have lim: "(\<lambda>n. prod f {..n}) \<longlonglongrightarrow> prod f {..<M} * L"
2.129 +    by (rule LIMSEQ_offset)
2.130 +  thus "convergent (\<lambda>n. \<Prod>i\<le>n. f i)"
2.131 +    by (auto simp: convergent_def)
2.132 +
2.133 +  show "(\<lambda>n. \<Prod>i\<le>n. f i) \<longlonglongrightarrow> 0 \<longleftrightarrow> (\<exists>i. f i = 0)"
2.134 +  proof
2.135 +    assume "\<exists>i. f i = 0"
2.136 +    then obtain i where "f i = 0" by auto
2.137 +    moreover with M have "i < M" by (cases "i < M") auto
2.138 +    ultimately have "(\<Prod>i<M. f i) = 0" by auto
2.139 +    with lim show "(\<lambda>n. \<Prod>i\<le>n. f i) \<longlonglongrightarrow> 0" by simp
2.140 +  next
2.141 +    assume "(\<lambda>n. \<Prod>i\<le>n. f i) \<longlonglongrightarrow> 0"
2.142 +    from tendsto_unique[OF _ this lim] and \<open>L \<noteq> 0\<close>
2.143 +    show "\<exists>i. f i = 0" by auto
2.144 +  qed
2.145 +qed
2.146 +
2.147 +lemma abs_convergent_prod_altdef:
2.148 +  "abs_convergent_prod f \<longleftrightarrow> convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"
2.149 +proof
2.150 +  assume "abs_convergent_prod f"
2.151 +  thus "convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"
2.152 +    by (auto simp: abs_convergent_prod_def intro!: convergent_prod_imp_convergent)
2.153 +qed (auto intro: abs_convergent_prodI)
2.154 +
2.155 +lemma weierstrass_prod_ineq:
2.156 +  fixes f :: "'a \<Rightarrow> real"
2.157 +  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<in> {0..1}"
2.158 +  shows   "1 - sum f A \<le> (\<Prod>x\<in>A. 1 - f x)"
2.159 +  using assms
2.160 +proof (induction A rule: infinite_finite_induct)
2.161 +  case (insert x A)
2.162 +  from insert.hyps and insert.prems
2.163 +    have "1 - sum f A + f x * (\<Prod>x\<in>A. 1 - f x) \<le> (\<Prod>x\<in>A. 1 - f x) + f x * (\<Prod>x\<in>A. 1)"
2.164 +    by (intro insert.IH add_mono mult_left_mono prod_mono) auto
2.165 +  with insert.hyps show ?case by (simp add: algebra_simps)
2.166 +qed simp_all
2.167 +
2.168 +lemma norm_prod_minus1_le_prod_minus1:
2.169 +  fixes f :: "nat \<Rightarrow> 'a :: {real_normed_div_algebra,comm_ring_1}"
2.170 +  shows "norm (prod (\<lambda>n. 1 + f n) A - 1) \<le> prod (\<lambda>n. 1 + norm (f n)) A - 1"
2.171 +proof (induction A rule: infinite_finite_induct)
2.172 +  case (insert x A)
2.173 +  from insert.hyps have
2.174 +    "norm ((\<Prod>n\<in>insert x A. 1 + f n) - 1) =
2.175 +       norm ((\<Prod>n\<in>A. 1 + f n) - 1 + f x * (\<Prod>n\<in>A. 1 + f n))"
2.176 +    by (simp add: algebra_simps)
2.177 +  also have "\<dots> \<le> norm ((\<Prod>n\<in>A. 1 + f n) - 1) + norm (f x * (\<Prod>n\<in>A. 1 + f n))"
2.178 +    by (rule norm_triangle_ineq)
2.179 +  also have "norm (f x * (\<Prod>n\<in>A. 1 + f n)) = norm (f x) * (\<Prod>x\<in>A. norm (1 + f x))"
2.180 +    by (simp add: prod_norm norm_mult)
2.181 +  also have "(\<Prod>x\<in>A. norm (1 + f x)) \<le> (\<Prod>x\<in>A. norm (1::'a) + norm (f x))"
2.182 +    by (intro prod_mono norm_triangle_ineq ballI conjI) auto
2.183 +  also have "norm (1::'a) = 1" by simp
2.184 +  also note insert.IH
2.185 +  also have "(\<Prod>n\<in>A. 1 + norm (f n)) - 1 + norm (f x) * (\<Prod>x\<in>A. 1 + norm (f x)) =
2.186 +               (\<Prod>n\<in>insert x A. 1 + norm (f n)) - 1"
2.187 +    using insert.hyps by (simp add: algebra_simps)
2.188 +  finally show ?case by - (simp_all add: mult_left_mono)
2.189 +qed simp_all
2.190 +
2.191 +lemma convergent_prod_imp_ev_nonzero:
2.192 +  fixes f :: "nat \<Rightarrow> 'a :: {t2_space,comm_semiring_1}"
2.193 +  assumes "convergent_prod f"
2.194 +  shows   "eventually (\<lambda>n. f n \<noteq> 0) sequentially"
2.195 +  using assms by (auto simp: eventually_at_top_linorder convergent_prod_altdef)
2.196 +
2.197 +lemma convergent_prod_imp_LIMSEQ:
2.198 +  fixes f :: "nat \<Rightarrow> 'a :: {real_normed_field}"
2.199 +  assumes "convergent_prod f"
2.200 +  shows   "f \<longlonglongrightarrow> 1"
2.201 +proof -
2.202 +  from assms obtain M L where L: "(\<lambda>n. \<Prod>i\<le>n. f (i+M)) \<longlonglongrightarrow> L" "\<And>n. n \<ge> M \<Longrightarrow> f n \<noteq> 0" "L \<noteq> 0"
2.203 +    by (auto simp: convergent_prod_altdef)
2.204 +  hence L': "(\<lambda>n. \<Prod>i\<le>Suc n. f (i+M)) \<longlonglongrightarrow> L" by (subst filterlim_sequentially_Suc)
2.205 +  have "(\<lambda>n. (\<Prod>i\<le>Suc n. f (i+M)) / (\<Prod>i\<le>n. f (i+M))) \<longlonglongrightarrow> L / L"
2.206 +    using L L' by (intro tendsto_divide) simp_all
2.207 +  also from L have "L / L = 1" by simp
2.208 +  also have "(\<lambda>n. (\<Prod>i\<le>Suc n. f (i+M)) / (\<Prod>i\<le>n. f (i+M))) = (\<lambda>n. f (n + Suc M))"
2.209 +    using assms L by (auto simp: fun_eq_iff atMost_Suc)
2.210 +  finally show ?thesis by (rule LIMSEQ_offset)
2.211 +qed
2.212 +
2.213 +lemma abs_convergent_prod_imp_summable:
2.214 +  fixes f :: "nat \<Rightarrow> 'a :: real_normed_div_algebra"
2.215 +  assumes "abs_convergent_prod f"
2.216 +  shows "summable (\<lambda>i. norm (f i - 1))"
2.217 +proof -
2.218 +  from assms have "convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"
2.219 +    unfolding abs_convergent_prod_def by (rule convergent_prod_imp_convergent)
2.220 +  then obtain L where L: "(\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1)) \<longlonglongrightarrow> L"
2.221 +    unfolding convergent_def by blast
2.222 +  have "convergent (\<lambda>n. \<Sum>i\<le>n. norm (f i - 1))"
2.223 +  proof (rule Bseq_monoseq_convergent)
2.224 +    have "eventually (\<lambda>n. (\<Prod>i\<le>n. 1 + norm (f i - 1)) < L + 1) sequentially"
2.225 +      using L(1) by (rule order_tendstoD) simp_all
2.226 +    hence "\<forall>\<^sub>F x in sequentially. norm (\<Sum>i\<le>x. norm (f i - 1)) \<le> L + 1"
2.227 +    proof eventually_elim
2.228 +      case (elim n)
2.229 +      have "norm (\<Sum>i\<le>n. norm (f i - 1)) = (\<Sum>i\<le>n. norm (f i - 1))"
2.230 +        unfolding real_norm_def by (intro abs_of_nonneg sum_nonneg) simp_all
2.231 +      also have "\<dots> \<le> (\<Prod>i\<le>n. 1 + norm (f i - 1))" by (rule sum_le_prod) auto
2.232 +      also have "\<dots> < L + 1" by (rule elim)
2.233 +      finally show ?case by simp
2.234 +    qed
2.235 +    thus "Bseq (\<lambda>n. \<Sum>i\<le>n. norm (f i - 1))" by (rule BfunI)
2.236 +  next
2.237 +    show "monoseq (\<lambda>n. \<Sum>i\<le>n. norm (f i - 1))"
2.238 +      by (rule mono_SucI1) auto
2.239 +  qed
2.240 +  thus "summable (\<lambda>i. norm (f i - 1))" by (simp add: summable_iff_convergent')
2.241 +qed
2.242 +
2.243 +lemma summable_imp_abs_convergent_prod:
2.244 +  fixes f :: "nat \<Rightarrow> 'a :: real_normed_div_algebra"
2.245 +  assumes "summable (\<lambda>i. norm (f i - 1))"
2.246 +  shows   "abs_convergent_prod f"
2.247 +proof (intro abs_convergent_prodI Bseq_monoseq_convergent)
2.248 +  show "monoseq (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"
2.249 +    by (intro mono_SucI1)
2.250 +       (auto simp: atMost_Suc algebra_simps intro!: mult_nonneg_nonneg prod_nonneg)
2.251 +next
2.252 +  show "Bseq (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"
2.253 +  proof (rule Bseq_eventually_mono)
2.254 +    show "eventually (\<lambda>n. norm (\<Prod>i\<le>n. 1 + norm (f i - 1)) \<le>
2.255 +            norm (exp (\<Sum>i\<le>n. norm (f i - 1)))) sequentially"
2.256 +      by (intro always_eventually allI) (auto simp: abs_prod exp_sum intro!: prod_mono)
2.257 +  next
2.258 +    from assms have "(\<lambda>n. \<Sum>i\<le>n. norm (f i - 1)) \<longlonglongrightarrow> (\<Sum>i. norm (f i - 1))"
2.259 +      using sums_def_le by blast
2.260 +    hence "(\<lambda>n. exp (\<Sum>i\<le>n. norm (f i - 1))) \<longlonglongrightarrow> exp (\<Sum>i. norm (f i - 1))"
2.261 +      by (rule tendsto_exp)
2.262 +    hence "convergent (\<lambda>n. exp (\<Sum>i\<le>n. norm (f i - 1)))"
2.263 +      by (rule convergentI)
2.264 +    thus "Bseq (\<lambda>n. exp (\<Sum>i\<le>n. norm (f i - 1)))"
2.265 +      by (rule convergent_imp_Bseq)
2.266 +  qed
2.267 +qed
2.268 +
2.269 +lemma abs_convergent_prod_conv_summable:
2.270 +  fixes f :: "nat \<Rightarrow> 'a :: real_normed_div_algebra"
2.271 +  shows "abs_convergent_prod f \<longleftrightarrow> summable (\<lambda>i. norm (f i - 1))"
2.272 +  by (blast intro: abs_convergent_prod_imp_summable summable_imp_abs_convergent_prod)
2.273 +
2.274 +lemma abs_convergent_prod_imp_LIMSEQ:
2.275 +  fixes f :: "nat \<Rightarrow> 'a :: {comm_ring_1,real_normed_div_algebra}"
2.276 +  assumes "abs_convergent_prod f"
2.277 +  shows   "f \<longlonglongrightarrow> 1"
2.278 +proof -
2.279 +  from assms have "summable (\<lambda>n. norm (f n - 1))"
2.280 +    by (rule abs_convergent_prod_imp_summable)
2.281 +  from summable_LIMSEQ_zero[OF this] have "(\<lambda>n. f n - 1) \<longlonglongrightarrow> 0"
2.282 +    by (simp add: tendsto_norm_zero_iff)
2.283 +  from tendsto_add[OF this tendsto_const[of 1]] show ?thesis by simp
2.284 +qed
2.285 +
2.286 +lemma abs_convergent_prod_imp_ev_nonzero:
2.287 +  fixes f :: "nat \<Rightarrow> 'a :: {comm_ring_1,real_normed_div_algebra}"
2.288 +  assumes "abs_convergent_prod f"
2.289 +  shows   "eventually (\<lambda>n. f n \<noteq> 0) sequentially"
2.290 +proof -
2.291 +  from assms have "f \<longlonglongrightarrow> 1"
2.292 +    by (rule abs_convergent_prod_imp_LIMSEQ)
2.293 +  hence "eventually (\<lambda>n. dist (f n) 1 < 1) at_top"
2.294 +    by (auto simp: tendsto_iff)
2.295 +  thus ?thesis by eventually_elim auto
2.296 +qed
2.297 +
2.298 +lemma convergent_prod_offset:
2.299 +  assumes "convergent_prod (\<lambda>n. f (n + m))"
2.300 +  shows   "convergent_prod f"
2.301 +proof -
2.302 +  from assms obtain M L where "(\<lambda>n. \<Prod>k\<le>n. f (k + (M + m))) \<longlonglongrightarrow> L" "L \<noteq> 0"
2.303 +    by (auto simp: convergent_prod_def add.assoc)
2.304 +  thus "convergent_prod f" unfolding convergent_prod_def by blast
2.305 +qed
2.306 +
2.307 +lemma abs_convergent_prod_offset:
2.308 +  assumes "abs_convergent_prod (\<lambda>n. f (n + m))"
2.309 +  shows   "abs_convergent_prod f"
2.310 +  using assms unfolding abs_convergent_prod_def by (rule convergent_prod_offset)
2.311 +
2.312 +lemma convergent_prod_ignore_initial_segment:
2.313 +  fixes f :: "nat \<Rightarrow> 'a :: {real_normed_field}"
2.314 +  assumes "convergent_prod f"
2.315 +  shows   "convergent_prod (\<lambda>n. f (n + m))"
2.316 +proof -
2.317 +  from assms obtain M L
2.318 +    where L: "(\<lambda>n. \<Prod>k\<le>n. f (k + M)) \<longlonglongrightarrow> L" "L \<noteq> 0" and nz: "\<And>n. n \<ge> M \<Longrightarrow> f n \<noteq> 0"
2.319 +    by (auto simp: convergent_prod_altdef)
2.320 +  define C where "C = (\<Prod>k<m. f (k + M))"
2.321 +  from nz have [simp]: "C \<noteq> 0"
2.322 +    by (auto simp: C_def)
2.323 +
2.324 +  from L(1) have "(\<lambda>n. \<Prod>k\<le>n+m. f (k + M)) \<longlonglongrightarrow> L"
2.325 +    by (rule LIMSEQ_ignore_initial_segment)
2.326 +  also have "(\<lambda>n. \<Prod>k\<le>n+m. f (k + M)) = (\<lambda>n. C * (\<Prod>k\<le>n. f (k + M + m)))"
2.327 +  proof (rule ext, goal_cases)
2.328 +    case (1 n)
2.329 +    have "{..n+m} = {..<m} \<union> {m..n+m}" by auto
2.330 +    also have "(\<Prod>k\<in>\<dots>. f (k + M)) = C * (\<Prod>k=m..n+m. f (k + M))"
2.331 +      unfolding C_def by (rule prod.union_disjoint) auto
2.332 +    also have "(\<Prod>k=m..n+m. f (k + M)) = (\<Prod>k\<le>n. f (k + m + M))"
2.333 +      by (intro ext prod.reindex_bij_witness[of _ "\<lambda>k. k + m" "\<lambda>k. k - m"]) auto
2.335 +  qed
2.336 +  finally have "(\<lambda>n. C * (\<Prod>k\<le>n. f (k + M + m)) / C) \<longlonglongrightarrow> L / C"
2.337 +    by (intro tendsto_divide tendsto_const) auto
2.338 +  hence "(\<lambda>n. \<Prod>k\<le>n. f (k + M + m)) \<longlonglongrightarrow> L / C" by simp
2.339 +  moreover from \<open>L \<noteq> 0\<close> have "L / C \<noteq> 0" by simp
2.340 +  ultimately show ?thesis unfolding convergent_prod_def by blast
2.341 +qed
2.342 +
2.343 +lemma abs_convergent_prod_ignore_initial_segment:
2.344 +  assumes "abs_convergent_prod f"
2.345 +  shows   "abs_convergent_prod (\<lambda>n. f (n + m))"
2.346 +  using assms unfolding abs_convergent_prod_def
2.347 +  by (rule convergent_prod_ignore_initial_segment)
2.348 +
2.349 +lemma summable_LIMSEQ':
2.351 +  shows   "(\<lambda>n. \<Sum>i\<le>n. f i) \<longlonglongrightarrow> suminf f"
2.352 +  using assms sums_def_le by blast
2.353 +
2.354 +lemma abs_convergent_prod_imp_convergent_prod:
2.355 +  fixes f :: "nat \<Rightarrow> 'a :: {real_normed_div_algebra,complete_space,comm_ring_1}"
2.356 +  assumes "abs_convergent_prod f"
2.357 +  shows   "convergent_prod f"
2.358 +proof -
2.359 +  from assms have "eventually (\<lambda>n. f n \<noteq> 0) sequentially"
2.360 +    by (rule abs_convergent_prod_imp_ev_nonzero)
2.361 +  then obtain N where N: "f n \<noteq> 0" if "n \<ge> N" for n
2.362 +    by (auto simp: eventually_at_top_linorder)
2.363 +  let ?P = "\<lambda>n. \<Prod>i\<le>n. f (i + N)" and ?Q = "\<lambda>n. \<Prod>i\<le>n. 1 + norm (f (i + N) - 1)"
2.364 +
2.365 +  have "Cauchy ?P"
2.366 +  proof (rule CauchyI', goal_cases)
2.367 +    case (1 \<epsilon>)
2.368 +    from assms have "abs_convergent_prod (\<lambda>n. f (n + N))"
2.369 +      by (rule abs_convergent_prod_ignore_initial_segment)
2.370 +    hence "Cauchy ?Q"
2.371 +      unfolding abs_convergent_prod_def
2.372 +      by (intro convergent_Cauchy convergent_prod_imp_convergent)
2.373 +    from CauchyD[OF this 1] obtain M where M: "norm (?Q m - ?Q n) < \<epsilon>" if "m \<ge> M" "n \<ge> M" for m n
2.374 +      by blast
2.375 +    show ?case
2.376 +    proof (rule exI[of _ M], safe, goal_cases)
2.377 +      case (1 m n)
2.378 +      have "dist (?P m) (?P n) = norm (?P n - ?P m)"
2.379 +        by (simp add: dist_norm norm_minus_commute)
2.380 +      also from 1 have "{..n} = {..m} \<union> {m<..n}" by auto
2.381 +      hence "norm (?P n - ?P m) = norm (?P m * (\<Prod>k\<in>{m<..n}. f (k + N)) - ?P m)"
2.382 +        by (subst prod.union_disjoint [symmetric]) (auto simp: algebra_simps)
2.383 +      also have "\<dots> = norm (?P m * ((\<Prod>k\<in>{m<..n}. f (k + N)) - 1))"
2.384 +        by (simp add: algebra_simps)
2.385 +      also have "\<dots> = (\<Prod>k\<le>m. norm (f (k + N))) * norm ((\<Prod>k\<in>{m<..n}. f (k + N)) - 1)"
2.386 +        by (simp add: norm_mult prod_norm)
2.387 +      also have "\<dots> \<le> ?Q m * ((\<Prod>k\<in>{m<..n}. 1 + norm (f (k + N) - 1)) - 1)"
2.388 +        using norm_prod_minus1_le_prod_minus1[of "\<lambda>k. f (k + N) - 1" "{m<..n}"]
2.389 +              norm_triangle_ineq[of 1 "f k - 1" for k]
2.390 +        by (intro mult_mono prod_mono ballI conjI norm_prod_minus1_le_prod_minus1 prod_nonneg) auto
2.391 +      also have "\<dots> = ?Q m * (\<Prod>k\<in>{m<..n}. 1 + norm (f (k + N) - 1)) - ?Q m"
2.392 +        by (simp add: algebra_simps)
2.393 +      also have "?Q m * (\<Prod>k\<in>{m<..n}. 1 + norm (f (k + N) - 1)) =
2.394 +                   (\<Prod>k\<in>{..m}\<union>{m<..n}. 1 + norm (f (k + N) - 1))"
2.395 +        by (rule prod.union_disjoint [symmetric]) auto
2.396 +      also from 1 have "{..m}\<union>{m<..n} = {..n}" by auto
2.397 +      also have "?Q n - ?Q m \<le> norm (?Q n - ?Q m)" by simp
2.398 +      also from 1 have "\<dots> < \<epsilon>" by (intro M) auto
2.399 +      finally show ?case .
2.400 +    qed
2.401 +  qed
2.402 +  hence conv: "convergent ?P" by (rule Cauchy_convergent)
2.403 +  then obtain L where L: "?P \<longlonglongrightarrow> L"
2.404 +    by (auto simp: convergent_def)
2.405 +
2.406 +  have "L \<noteq> 0"
2.407 +  proof
2.408 +    assume [simp]: "L = 0"
2.409 +    from tendsto_norm[OF L] have limit: "(\<lambda>n. \<Prod>k\<le>n. norm (f (k + N))) \<longlonglongrightarrow> 0"
2.410 +      by (simp add: prod_norm)
2.411 +
2.412 +    from assms have "(\<lambda>n. f (n + N)) \<longlonglongrightarrow> 1"
2.413 +      by (intro abs_convergent_prod_imp_LIMSEQ abs_convergent_prod_ignore_initial_segment)
2.414 +    hence "eventually (\<lambda>n. norm (f (n + N) - 1) < 1) sequentially"
2.415 +      by (auto simp: tendsto_iff dist_norm)
2.416 +    then obtain M0 where M0: "norm (f (n + N) - 1) < 1" if "n \<ge> M0" for n
2.417 +      by (auto simp: eventually_at_top_linorder)
2.418 +
2.419 +    {
2.420 +      fix M assume M: "M \<ge> M0"
2.421 +      with M0 have M: "norm (f (n + N) - 1) < 1" if "n \<ge> M" for n using that by simp
2.422 +
2.423 +      have "(\<lambda>n. \<Prod>k\<le>n. 1 - norm (f (k+M+N) - 1)) \<longlonglongrightarrow> 0"
2.424 +      proof (rule tendsto_sandwich)
2.425 +        show "eventually (\<lambda>n. (\<Prod>k\<le>n. 1 - norm (f (k+M+N) - 1)) \<ge> 0) sequentially"
2.426 +          using M by (intro always_eventually prod_nonneg allI ballI) (auto intro: less_imp_le)
2.427 +        have "norm (1::'a) - norm (f (i + M + N) - 1) \<le> norm (f (i + M + N))" for i
2.428 +          using norm_triangle_ineq3[of "f (i + M + N)" 1] by simp
2.429 +        thus "eventually (\<lambda>n. (\<Prod>k\<le>n. 1 - norm (f (k+M+N) - 1)) \<le> (\<Prod>k\<le>n. norm (f (k+M+N)))) at_top"
2.430 +          using M by (intro always_eventually allI prod_mono ballI conjI) (auto intro: less_imp_le)
2.431 +
2.432 +        define C where "C = (\<Prod>k<M. norm (f (k + N)))"
2.433 +        from N have [simp]: "C \<noteq> 0" by (auto simp: C_def)
2.434 +        from L have "(\<lambda>n. norm (\<Prod>k\<le>n+M. f (k + N))) \<longlonglongrightarrow> 0"
2.435 +          by (intro LIMSEQ_ignore_initial_segment) (simp add: tendsto_norm_zero_iff)
2.436 +        also have "(\<lambda>n. norm (\<Prod>k\<le>n+M. f (k + N))) = (\<lambda>n. C * (\<Prod>k\<le>n. norm (f (k + M + N))))"
2.437 +        proof (rule ext, goal_cases)
2.438 +          case (1 n)
2.439 +          have "{..n+M} = {..<M} \<union> {M..n+M}" by auto
2.440 +          also have "norm (\<Prod>k\<in>\<dots>. f (k + N)) = C * norm (\<Prod>k=M..n+M. f (k + N))"
2.441 +            unfolding C_def by (subst prod.union_disjoint) (auto simp: norm_mult prod_norm)
2.442 +          also have "(\<Prod>k=M..n+M. f (k + N)) = (\<Prod>k\<le>n. f (k + N + M))"
2.443 +            by (intro prod.reindex_bij_witness[of _ "\<lambda>i. i + M" "\<lambda>i. i - M"]) auto
2.445 +        qed
2.446 +        finally have "(\<lambda>n. C * (\<Prod>k\<le>n. norm (f (k + M + N))) / C) \<longlonglongrightarrow> 0 / C"
2.447 +          by (intro tendsto_divide tendsto_const) auto
2.448 +        thus "(\<lambda>n. \<Prod>k\<le>n. norm (f (k + M + N))) \<longlonglongrightarrow> 0" by simp
2.449 +      qed simp_all
2.450 +
2.451 +      have "1 - (\<Sum>i. norm (f (i + M + N) - 1)) \<le> 0"
2.452 +      proof (rule tendsto_le)
2.453 +        show "eventually (\<lambda>n. 1 - (\<Sum>k\<le>n. norm (f (k+M+N) - 1)) \<le>
2.454 +                                (\<Prod>k\<le>n. 1 - norm (f (k+M+N) - 1))) at_top"
2.455 +          using M by (intro always_eventually allI weierstrass_prod_ineq) (auto intro: less_imp_le)
2.456 +        show "(\<lambda>n. \<Prod>k\<le>n. 1 - norm (f (k+M+N) - 1)) \<longlonglongrightarrow> 0" by fact
2.457 +        show "(\<lambda>n. 1 - (\<Sum>k\<le>n. norm (f (k + M + N) - 1)))
2.458 +                  \<longlonglongrightarrow> 1 - (\<Sum>i. norm (f (i + M + N) - 1))"
2.459 +          by (intro tendsto_intros summable_LIMSEQ' summable_ignore_initial_segment
2.460 +                abs_convergent_prod_imp_summable assms)
2.461 +      qed simp_all
2.462 +      hence "(\<Sum>i. norm (f (i + M + N) - 1)) \<ge> 1" by simp
2.463 +      also have "\<dots> + (\<Sum>i<M. norm (f (i + N) - 1)) = (\<Sum>i. norm (f (i + N) - 1))"
2.464 +        by (intro suminf_split_initial_segment [symmetric] summable_ignore_initial_segment
2.465 +              abs_convergent_prod_imp_summable assms)
2.466 +      finally have "1 + (\<Sum>i<M. norm (f (i + N) - 1)) \<le> (\<Sum>i. norm (f (i + N) - 1))" by simp
2.467 +    } note * = this
2.468 +
2.469 +    have "1 + (\<Sum>i. norm (f (i + N) - 1)) \<le> (\<Sum>i. norm (f (i + N) - 1))"
2.470 +    proof (rule tendsto_le)
2.471 +      show "(\<lambda>M. 1 + (\<Sum>i<M. norm (f (i + N) - 1))) \<longlonglongrightarrow> 1 + (\<Sum>i. norm (f (i + N) - 1))"
2.472 +        by (intro tendsto_intros summable_LIMSEQ summable_ignore_initial_segment
2.473 +                abs_convergent_prod_imp_summable assms)
2.474 +      show "eventually (\<lambda>M. 1 + (\<Sum>i<M. norm (f (i + N) - 1)) \<le> (\<Sum>i. norm (f (i + N) - 1))) at_top"
2.475 +        using eventually_ge_at_top[of M0] by eventually_elim (use * in auto)
2.476 +    qed simp_all
2.477 +    thus False by simp
2.478 +  qed
2.479 +  with L show ?thesis by (auto simp: convergent_prod_def)
2.480 +qed
2.481 +
2.482 +end
```