src/HOL/Analysis/Infinite_Products.thy
author eberlm <eberlm@in.tum.de>
Sat, 15 Jul 2017 14:33:56 +0100
changeset 66277 512b0dc09061
child 68064 b249fab48c76
permissions -rw-r--r--
HOL-Analysis: Infinite products
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
     1
(*
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
     2
  File:      HOL/Analysis/Infinite_Product.thy
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
     3
  Author:    Manuel Eberl
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
     4
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
     5
  Basic results about convergence and absolute convergence of infinite products
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
     6
  and their connection to summability.
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
     7
*)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
     8
section \<open>Infinite Products\<close>
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
     9
theory Infinite_Products
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    10
  imports Complex_Main
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    11
begin
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    12
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    13
lemma sum_le_prod:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    14
  fixes f :: "'a \<Rightarrow> 'b :: linordered_semidom"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    15
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    16
  shows   "sum f A \<le> (\<Prod>x\<in>A. 1 + f x)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    17
  using assms
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    18
proof (induction A rule: infinite_finite_induct)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    19
  case (insert x A)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    20
  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)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    21
    by (intro add_mono insert mult_left_mono prod_mono) (auto intro: insert.prems)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    22
  with insert.hyps show ?case by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    23
qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    24
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    25
lemma prod_le_exp_sum:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    26
  fixes f :: "'a \<Rightarrow> real"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    27
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    28
  shows   "prod (\<lambda>x. 1 + f x) A \<le> exp (sum f A)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    29
  using assms
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    30
proof (induction A rule: infinite_finite_induct)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    31
  case (insert x A)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    32
  have "(1 + f x) * (\<Prod>x\<in>A. 1 + f x) \<le> exp (f x) * exp (sum f A)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    33
    using insert.prems by (intro mult_mono insert prod_nonneg exp_ge_add_one_self) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    34
  with insert.hyps show ?case by (simp add: algebra_simps exp_add)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    35
qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    36
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    37
lemma lim_ln_1_plus_x_over_x_at_0: "(\<lambda>x::real. ln (1 + x) / x) \<midarrow>0\<rightarrow> 1"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    38
proof (rule lhopital)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    39
  show "(\<lambda>x::real. ln (1 + x)) \<midarrow>0\<rightarrow> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    40
    by (rule tendsto_eq_intros refl | simp)+
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    41
  have "eventually (\<lambda>x::real. x \<in> {-1/2<..<1/2}) (nhds 0)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    42
    by (rule eventually_nhds_in_open) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    43
  hence *: "eventually (\<lambda>x::real. x \<in> {-1/2<..<1/2}) (at 0)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    44
    by (rule filter_leD [rotated]) (simp_all add: at_within_def)   
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    45
  show "eventually (\<lambda>x::real. ((\<lambda>x. ln (1 + x)) has_field_derivative inverse (1 + x)) (at x)) (at 0)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    46
    using * by eventually_elim (auto intro!: derivative_eq_intros simp: field_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    47
  show "eventually (\<lambda>x::real. ((\<lambda>x. x) has_field_derivative 1) (at x)) (at 0)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    48
    using * by eventually_elim (auto intro!: derivative_eq_intros simp: field_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    49
  show "\<forall>\<^sub>F x in at 0. x \<noteq> 0" by (auto simp: at_within_def eventually_inf_principal)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    50
  show "(\<lambda>x::real. inverse (1 + x) / 1) \<midarrow>0\<rightarrow> 1"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    51
    by (rule tendsto_eq_intros refl | simp)+
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    52
qed auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    53
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    54
definition convergent_prod :: "(nat \<Rightarrow> 'a :: {t2_space,comm_semiring_1}) \<Rightarrow> bool" where
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    55
  "convergent_prod f \<longleftrightarrow> (\<exists>M L. (\<lambda>n. \<Prod>i\<le>n. f (i+M)) \<longlonglongrightarrow> L \<and> L \<noteq> 0)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    56
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    57
lemma convergent_prod_altdef:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    58
  fixes f :: "nat \<Rightarrow> 'a :: {t2_space,comm_semiring_1}"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    59
  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)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    60
proof
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    61
  assume "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    62
  then obtain M L where *: "(\<lambda>n. \<Prod>i\<le>n. f (i+M)) \<longlonglongrightarrow> L" "L \<noteq> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    63
    by (auto simp: convergent_prod_def)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    64
  have "f i \<noteq> 0" if "i \<ge> M" for i
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    65
  proof
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    66
    assume "f i = 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    67
    have **: "eventually (\<lambda>n. (\<Prod>i\<le>n. f (i+M)) = 0) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    68
      using eventually_ge_at_top[of "i - M"]
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    69
    proof eventually_elim
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    70
      case (elim n)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    71
      with \<open>f i = 0\<close> and \<open>i \<ge> M\<close> show ?case
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    72
        by (auto intro!: bexI[of _ "i - M"] prod_zero)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    73
    qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    74
    have "(\<lambda>n. (\<Prod>i\<le>n. f (i+M))) \<longlonglongrightarrow> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    75
      unfolding filterlim_iff
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    76
      by (auto dest!: eventually_nhds_x_imp_x intro!: eventually_mono[OF **])
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    77
    from tendsto_unique[OF _ this *(1)] and *(2)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    78
      show False by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    79
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    80
  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)" 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    81
    by blast
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    82
qed (auto simp: convergent_prod_def)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    83
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    84
definition abs_convergent_prod :: "(nat \<Rightarrow> _) \<Rightarrow> bool" where
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    85
  "abs_convergent_prod f \<longleftrightarrow> convergent_prod (\<lambda>i. 1 + norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    86
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    87
lemma abs_convergent_prodI:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    88
  assumes "convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    89
  shows   "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    90
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    91
  from assms obtain L where L: "(\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1)) \<longlonglongrightarrow> L"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    92
    by (auto simp: convergent_def)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    93
  have "L \<ge> 1"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    94
  proof (rule tendsto_le)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    95
    show "eventually (\<lambda>n. (\<Prod>i\<le>n. 1 + norm (f i - 1)) \<ge> 1) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    96
    proof (intro always_eventually allI)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    97
      fix n
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    98
      have "(\<Prod>i\<le>n. 1 + norm (f i - 1)) \<ge> (\<Prod>i\<le>n. 1)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    99
        by (intro prod_mono) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   100
      thus "(\<Prod>i\<le>n. 1 + norm (f i - 1)) \<ge> 1" by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   101
    qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   102
  qed (use L in simp_all)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   103
  hence "L \<noteq> 0" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   104
  with L show ?thesis unfolding abs_convergent_prod_def convergent_prod_def
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   105
    by (intro exI[of _ "0::nat"] exI[of _ L]) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   106
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   107
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   108
lemma
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   109
  fixes f :: "nat \<Rightarrow> 'a :: {real_normed_div_algebra,idom}"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   110
  assumes "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   111
  shows   convergent_prod_imp_convergent: "convergent (\<lambda>n. \<Prod>i\<le>n. f i)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   112
    and   convergent_prod_to_zero_iff:    "(\<lambda>n. \<Prod>i\<le>n. f i) \<longlonglongrightarrow> 0 \<longleftrightarrow> (\<exists>i. f i = 0)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   113
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   114
  from assms obtain M L 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   115
    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"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   116
    by (auto simp: convergent_prod_altdef)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   117
  note this(2)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   118
  also have "(\<lambda>n. \<Prod>i\<le>n. f (i + M)) = (\<lambda>n. \<Prod>i=M..M+n. f i)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   119
    by (intro ext prod.reindex_bij_witness[of _ "\<lambda>n. n - M" "\<lambda>n. n + M"]) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   120
  finally have "(\<lambda>n. (\<Prod>i<M. f i) * (\<Prod>i=M..M+n. f i)) \<longlonglongrightarrow> (\<Prod>i<M. f i) * L"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   121
    by (intro tendsto_mult tendsto_const)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   122
  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))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   123
    by (subst prod.union_disjoint) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   124
  also have "(\<lambda>n. {..<M} \<union> {M..M+n}) = (\<lambda>n. {..n+M})" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   125
  finally have lim: "(\<lambda>n. prod f {..n}) \<longlonglongrightarrow> prod f {..<M} * L" 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   126
    by (rule LIMSEQ_offset)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   127
  thus "convergent (\<lambda>n. \<Prod>i\<le>n. f i)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   128
    by (auto simp: convergent_def)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   129
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   130
  show "(\<lambda>n. \<Prod>i\<le>n. f i) \<longlonglongrightarrow> 0 \<longleftrightarrow> (\<exists>i. f i = 0)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   131
  proof
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   132
    assume "\<exists>i. f i = 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   133
    then obtain i where "f i = 0" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   134
    moreover with M have "i < M" by (cases "i < M") auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   135
    ultimately have "(\<Prod>i<M. f i) = 0" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   136
    with lim show "(\<lambda>n. \<Prod>i\<le>n. f i) \<longlonglongrightarrow> 0" by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   137
  next
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   138
    assume "(\<lambda>n. \<Prod>i\<le>n. f i) \<longlonglongrightarrow> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   139
    from tendsto_unique[OF _ this lim] and \<open>L \<noteq> 0\<close>
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   140
    show "\<exists>i. f i = 0" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   141
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   142
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   143
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   144
lemma abs_convergent_prod_altdef:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   145
  "abs_convergent_prod f \<longleftrightarrow> convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   146
proof
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   147
  assume "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   148
  thus "convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   149
    by (auto simp: abs_convergent_prod_def intro!: convergent_prod_imp_convergent)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   150
qed (auto intro: abs_convergent_prodI)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   151
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   152
lemma weierstrass_prod_ineq:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   153
  fixes f :: "'a \<Rightarrow> real" 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   154
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<in> {0..1}"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   155
  shows   "1 - sum f A \<le> (\<Prod>x\<in>A. 1 - f x)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   156
  using assms
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   157
proof (induction A rule: infinite_finite_induct)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   158
  case (insert x A)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   159
  from insert.hyps and insert.prems 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   160
    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)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   161
    by (intro insert.IH add_mono mult_left_mono prod_mono) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   162
  with insert.hyps show ?case by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   163
qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   164
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   165
lemma norm_prod_minus1_le_prod_minus1:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   166
  fixes f :: "nat \<Rightarrow> 'a :: {real_normed_div_algebra,comm_ring_1}"  
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   167
  shows "norm (prod (\<lambda>n. 1 + f n) A - 1) \<le> prod (\<lambda>n. 1 + norm (f n)) A - 1"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   168
proof (induction A rule: infinite_finite_induct)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   169
  case (insert x A)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   170
  from insert.hyps have 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   171
    "norm ((\<Prod>n\<in>insert x A. 1 + f n) - 1) = 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   172
       norm ((\<Prod>n\<in>A. 1 + f n) - 1 + f x * (\<Prod>n\<in>A. 1 + f n))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   173
    by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   174
  also have "\<dots> \<le> norm ((\<Prod>n\<in>A. 1 + f n) - 1) + norm (f x * (\<Prod>n\<in>A. 1 + f n))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   175
    by (rule norm_triangle_ineq)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   176
  also have "norm (f x * (\<Prod>n\<in>A. 1 + f n)) = norm (f x) * (\<Prod>x\<in>A. norm (1 + f x))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   177
    by (simp add: prod_norm norm_mult)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   178
  also have "(\<Prod>x\<in>A. norm (1 + f x)) \<le> (\<Prod>x\<in>A. norm (1::'a) + norm (f x))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   179
    by (intro prod_mono norm_triangle_ineq ballI conjI) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   180
  also have "norm (1::'a) = 1" by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   181
  also note insert.IH
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   182
  also have "(\<Prod>n\<in>A. 1 + norm (f n)) - 1 + norm (f x) * (\<Prod>x\<in>A. 1 + norm (f x)) =
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   183
               (\<Prod>n\<in>insert x A. 1 + norm (f n)) - 1"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   184
    using insert.hyps by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   185
  finally show ?case by - (simp_all add: mult_left_mono)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   186
qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   187
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   188
lemma convergent_prod_imp_ev_nonzero:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   189
  fixes f :: "nat \<Rightarrow> 'a :: {t2_space,comm_semiring_1}"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   190
  assumes "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   191
  shows   "eventually (\<lambda>n. f n \<noteq> 0) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   192
  using assms by (auto simp: eventually_at_top_linorder convergent_prod_altdef)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   193
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   194
lemma convergent_prod_imp_LIMSEQ:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   195
  fixes f :: "nat \<Rightarrow> 'a :: {real_normed_field}"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   196
  assumes "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   197
  shows   "f \<longlonglongrightarrow> 1"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   198
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   199
  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"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   200
    by (auto simp: convergent_prod_altdef)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   201
  hence L': "(\<lambda>n. \<Prod>i\<le>Suc n. f (i+M)) \<longlonglongrightarrow> L" by (subst filterlim_sequentially_Suc)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   202
  have "(\<lambda>n. (\<Prod>i\<le>Suc n. f (i+M)) / (\<Prod>i\<le>n. f (i+M))) \<longlonglongrightarrow> L / L"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   203
    using L L' by (intro tendsto_divide) simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   204
  also from L have "L / L = 1" by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   205
  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))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   206
    using assms L by (auto simp: fun_eq_iff atMost_Suc)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   207
  finally show ?thesis by (rule LIMSEQ_offset)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   208
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   209
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   210
lemma abs_convergent_prod_imp_summable:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   211
  fixes f :: "nat \<Rightarrow> 'a :: real_normed_div_algebra"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   212
  assumes "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   213
  shows "summable (\<lambda>i. norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   214
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   215
  from assms have "convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))" 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   216
    unfolding abs_convergent_prod_def by (rule convergent_prod_imp_convergent)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   217
  then obtain L where L: "(\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1)) \<longlonglongrightarrow> L"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   218
    unfolding convergent_def by blast
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   219
  have "convergent (\<lambda>n. \<Sum>i\<le>n. norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   220
  proof (rule Bseq_monoseq_convergent)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   221
    have "eventually (\<lambda>n. (\<Prod>i\<le>n. 1 + norm (f i - 1)) < L + 1) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   222
      using L(1) by (rule order_tendstoD) simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   223
    hence "\<forall>\<^sub>F x in sequentially. norm (\<Sum>i\<le>x. norm (f i - 1)) \<le> L + 1"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   224
    proof eventually_elim
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   225
      case (elim n)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   226
      have "norm (\<Sum>i\<le>n. norm (f i - 1)) = (\<Sum>i\<le>n. norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   227
        unfolding real_norm_def by (intro abs_of_nonneg sum_nonneg) simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   228
      also have "\<dots> \<le> (\<Prod>i\<le>n. 1 + norm (f i - 1))" by (rule sum_le_prod) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   229
      also have "\<dots> < L + 1" by (rule elim)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   230
      finally show ?case by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   231
    qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   232
    thus "Bseq (\<lambda>n. \<Sum>i\<le>n. norm (f i - 1))" by (rule BfunI)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   233
  next
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   234
    show "monoseq (\<lambda>n. \<Sum>i\<le>n. norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   235
      by (rule mono_SucI1) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   236
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   237
  thus "summable (\<lambda>i. norm (f i - 1))" by (simp add: summable_iff_convergent')
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   238
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   239
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   240
lemma summable_imp_abs_convergent_prod:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   241
  fixes f :: "nat \<Rightarrow> 'a :: real_normed_div_algebra"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   242
  assumes "summable (\<lambda>i. norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   243
  shows   "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   244
proof (intro abs_convergent_prodI Bseq_monoseq_convergent)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   245
  show "monoseq (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   246
    by (intro mono_SucI1) 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   247
       (auto simp: atMost_Suc algebra_simps intro!: mult_nonneg_nonneg prod_nonneg)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   248
next
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   249
  show "Bseq (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   250
  proof (rule Bseq_eventually_mono)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   251
    show "eventually (\<lambda>n. norm (\<Prod>i\<le>n. 1 + norm (f i - 1)) \<le> 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   252
            norm (exp (\<Sum>i\<le>n. norm (f i - 1)))) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   253
      by (intro always_eventually allI) (auto simp: abs_prod exp_sum intro!: prod_mono)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   254
  next
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   255
    from assms have "(\<lambda>n. \<Sum>i\<le>n. norm (f i - 1)) \<longlonglongrightarrow> (\<Sum>i. norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   256
      using sums_def_le by blast
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   257
    hence "(\<lambda>n. exp (\<Sum>i\<le>n. norm (f i - 1))) \<longlonglongrightarrow> exp (\<Sum>i. norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   258
      by (rule tendsto_exp)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   259
    hence "convergent (\<lambda>n. exp (\<Sum>i\<le>n. norm (f i - 1)))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   260
      by (rule convergentI)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   261
    thus "Bseq (\<lambda>n. exp (\<Sum>i\<le>n. norm (f i - 1)))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   262
      by (rule convergent_imp_Bseq)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   263
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   264
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   265
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   266
lemma abs_convergent_prod_conv_summable:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   267
  fixes f :: "nat \<Rightarrow> 'a :: real_normed_div_algebra"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   268
  shows "abs_convergent_prod f \<longleftrightarrow> summable (\<lambda>i. norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   269
  by (blast intro: abs_convergent_prod_imp_summable summable_imp_abs_convergent_prod)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   270
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   271
lemma abs_convergent_prod_imp_LIMSEQ:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   272
  fixes f :: "nat \<Rightarrow> 'a :: {comm_ring_1,real_normed_div_algebra}"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   273
  assumes "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   274
  shows   "f \<longlonglongrightarrow> 1"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   275
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   276
  from assms have "summable (\<lambda>n. norm (f n - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   277
    by (rule abs_convergent_prod_imp_summable)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   278
  from summable_LIMSEQ_zero[OF this] have "(\<lambda>n. f n - 1) \<longlonglongrightarrow> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   279
    by (simp add: tendsto_norm_zero_iff)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   280
  from tendsto_add[OF this tendsto_const[of 1]] show ?thesis by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   281
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   282
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   283
lemma abs_convergent_prod_imp_ev_nonzero:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   284
  fixes f :: "nat \<Rightarrow> 'a :: {comm_ring_1,real_normed_div_algebra}"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   285
  assumes "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   286
  shows   "eventually (\<lambda>n. f n \<noteq> 0) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   287
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   288
  from assms have "f \<longlonglongrightarrow> 1" 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   289
    by (rule abs_convergent_prod_imp_LIMSEQ)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   290
  hence "eventually (\<lambda>n. dist (f n) 1 < 1) at_top"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   291
    by (auto simp: tendsto_iff)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   292
  thus ?thesis by eventually_elim auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   293
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   294
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   295
lemma convergent_prod_offset:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   296
  assumes "convergent_prod (\<lambda>n. f (n + m))"  
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   297
  shows   "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   298
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   299
  from assms obtain M L where "(\<lambda>n. \<Prod>k\<le>n. f (k + (M + m))) \<longlonglongrightarrow> L" "L \<noteq> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   300
    by (auto simp: convergent_prod_def add.assoc)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   301
  thus "convergent_prod f" unfolding convergent_prod_def by blast
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   302
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   303
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   304
lemma abs_convergent_prod_offset:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   305
  assumes "abs_convergent_prod (\<lambda>n. f (n + m))"  
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   306
  shows   "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   307
  using assms unfolding abs_convergent_prod_def by (rule convergent_prod_offset)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   308
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   309
lemma convergent_prod_ignore_initial_segment:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   310
  fixes f :: "nat \<Rightarrow> 'a :: {real_normed_field}"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   311
  assumes "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   312
  shows   "convergent_prod (\<lambda>n. f (n + m))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   313
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   314
  from assms obtain M L 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   315
    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"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   316
    by (auto simp: convergent_prod_altdef)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   317
  define C where "C = (\<Prod>k<m. f (k + M))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   318
  from nz have [simp]: "C \<noteq> 0" 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   319
    by (auto simp: C_def)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   320
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   321
  from L(1) have "(\<lambda>n. \<Prod>k\<le>n+m. f (k + M)) \<longlonglongrightarrow> L" 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   322
    by (rule LIMSEQ_ignore_initial_segment)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   323
  also have "(\<lambda>n. \<Prod>k\<le>n+m. f (k + M)) = (\<lambda>n. C * (\<Prod>k\<le>n. f (k + M + m)))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   324
  proof (rule ext, goal_cases)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   325
    case (1 n)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   326
    have "{..n+m} = {..<m} \<union> {m..n+m}" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   327
    also have "(\<Prod>k\<in>\<dots>. f (k + M)) = C * (\<Prod>k=m..n+m. f (k + M))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   328
      unfolding C_def by (rule prod.union_disjoint) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   329
    also have "(\<Prod>k=m..n+m. f (k + M)) = (\<Prod>k\<le>n. f (k + m + M))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   330
      by (intro ext prod.reindex_bij_witness[of _ "\<lambda>k. k + m" "\<lambda>k. k - m"]) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   331
    finally show ?case by (simp add: add_ac)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   332
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   333
  finally have "(\<lambda>n. C * (\<Prod>k\<le>n. f (k + M + m)) / C) \<longlonglongrightarrow> L / C"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   334
    by (intro tendsto_divide tendsto_const) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   335
  hence "(\<lambda>n. \<Prod>k\<le>n. f (k + M + m)) \<longlonglongrightarrow> L / C" by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   336
  moreover from \<open>L \<noteq> 0\<close> have "L / C \<noteq> 0" by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   337
  ultimately show ?thesis unfolding convergent_prod_def by blast
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   338
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   339
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   340
lemma abs_convergent_prod_ignore_initial_segment:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   341
  assumes "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   342
  shows   "abs_convergent_prod (\<lambda>n. f (n + m))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   343
  using assms unfolding abs_convergent_prod_def 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   344
  by (rule convergent_prod_ignore_initial_segment)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   345
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   346
lemma summable_LIMSEQ': 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   347
  assumes "summable (f::nat\<Rightarrow>'a::{t2_space,comm_monoid_add})"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   348
  shows   "(\<lambda>n. \<Sum>i\<le>n. f i) \<longlonglongrightarrow> suminf f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   349
  using assms sums_def_le by blast
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   350
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   351
lemma abs_convergent_prod_imp_convergent_prod:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   352
  fixes f :: "nat \<Rightarrow> 'a :: {real_normed_div_algebra,complete_space,comm_ring_1}"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   353
  assumes "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   354
  shows   "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   355
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   356
  from assms have "eventually (\<lambda>n. f n \<noteq> 0) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   357
    by (rule abs_convergent_prod_imp_ev_nonzero)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   358
  then obtain N where N: "f n \<noteq> 0" if "n \<ge> N" for n 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   359
    by (auto simp: eventually_at_top_linorder)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   360
  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)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   361
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   362
  have "Cauchy ?P"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   363
  proof (rule CauchyI', goal_cases)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   364
    case (1 \<epsilon>)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   365
    from assms have "abs_convergent_prod (\<lambda>n. f (n + N))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   366
      by (rule abs_convergent_prod_ignore_initial_segment)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   367
    hence "Cauchy ?Q"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   368
      unfolding abs_convergent_prod_def
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   369
      by (intro convergent_Cauchy convergent_prod_imp_convergent)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   370
    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
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   371
      by blast
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   372
    show ?case
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   373
    proof (rule exI[of _ M], safe, goal_cases)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   374
      case (1 m n)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   375
      have "dist (?P m) (?P n) = norm (?P n - ?P m)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   376
        by (simp add: dist_norm norm_minus_commute)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   377
      also from 1 have "{..n} = {..m} \<union> {m<..n}" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   378
      hence "norm (?P n - ?P m) = norm (?P m * (\<Prod>k\<in>{m<..n}. f (k + N)) - ?P m)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   379
        by (subst prod.union_disjoint [symmetric]) (auto simp: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   380
      also have "\<dots> = norm (?P m * ((\<Prod>k\<in>{m<..n}. f (k + N)) - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   381
        by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   382
      also have "\<dots> = (\<Prod>k\<le>m. norm (f (k + N))) * norm ((\<Prod>k\<in>{m<..n}. f (k + N)) - 1)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   383
        by (simp add: norm_mult prod_norm)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   384
      also have "\<dots> \<le> ?Q m * ((\<Prod>k\<in>{m<..n}. 1 + norm (f (k + N) - 1)) - 1)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   385
        using norm_prod_minus1_le_prod_minus1[of "\<lambda>k. f (k + N) - 1" "{m<..n}"]
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   386
              norm_triangle_ineq[of 1 "f k - 1" for k]
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   387
        by (intro mult_mono prod_mono ballI conjI norm_prod_minus1_le_prod_minus1 prod_nonneg) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   388
      also have "\<dots> = ?Q m * (\<Prod>k\<in>{m<..n}. 1 + norm (f (k + N) - 1)) - ?Q m"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   389
        by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   390
      also have "?Q m * (\<Prod>k\<in>{m<..n}. 1 + norm (f (k + N) - 1)) = 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   391
                   (\<Prod>k\<in>{..m}\<union>{m<..n}. 1 + norm (f (k + N) - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   392
        by (rule prod.union_disjoint [symmetric]) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   393
      also from 1 have "{..m}\<union>{m<..n} = {..n}" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   394
      also have "?Q n - ?Q m \<le> norm (?Q n - ?Q m)" by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   395
      also from 1 have "\<dots> < \<epsilon>" by (intro M) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   396
      finally show ?case .
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   397
    qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   398
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   399
  hence conv: "convergent ?P" by (rule Cauchy_convergent)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   400
  then obtain L where L: "?P \<longlonglongrightarrow> L"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   401
    by (auto simp: convergent_def)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   402
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   403
  have "L \<noteq> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   404
  proof
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   405
    assume [simp]: "L = 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   406
    from tendsto_norm[OF L] have limit: "(\<lambda>n. \<Prod>k\<le>n. norm (f (k + N))) \<longlonglongrightarrow> 0" 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   407
      by (simp add: prod_norm)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   408
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   409
    from assms have "(\<lambda>n. f (n + N)) \<longlonglongrightarrow> 1"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   410
      by (intro abs_convergent_prod_imp_LIMSEQ abs_convergent_prod_ignore_initial_segment)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   411
    hence "eventually (\<lambda>n. norm (f (n + N) - 1) < 1) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   412
      by (auto simp: tendsto_iff dist_norm)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   413
    then obtain M0 where M0: "norm (f (n + N) - 1) < 1" if "n \<ge> M0" for n
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   414
      by (auto simp: eventually_at_top_linorder)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   415
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   416
    {
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   417
      fix M assume M: "M \<ge> M0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   418
      with M0 have M: "norm (f (n + N) - 1) < 1" if "n \<ge> M" for n using that by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   419
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   420
      have "(\<lambda>n. \<Prod>k\<le>n. 1 - norm (f (k+M+N) - 1)) \<longlonglongrightarrow> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   421
      proof (rule tendsto_sandwich)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   422
        show "eventually (\<lambda>n. (\<Prod>k\<le>n. 1 - norm (f (k+M+N) - 1)) \<ge> 0) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   423
          using M by (intro always_eventually prod_nonneg allI ballI) (auto intro: less_imp_le)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   424
        have "norm (1::'a) - norm (f (i + M + N) - 1) \<le> norm (f (i + M + N))" for i
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   425
          using norm_triangle_ineq3[of "f (i + M + N)" 1] by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   426
        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"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   427
          using M by (intro always_eventually allI prod_mono ballI conjI) (auto intro: less_imp_le)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   428
        
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   429
        define C where "C = (\<Prod>k<M. norm (f (k + N)))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   430
        from N have [simp]: "C \<noteq> 0" by (auto simp: C_def)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   431
        from L have "(\<lambda>n. norm (\<Prod>k\<le>n+M. f (k + N))) \<longlonglongrightarrow> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   432
          by (intro LIMSEQ_ignore_initial_segment) (simp add: tendsto_norm_zero_iff)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   433
        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))))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   434
        proof (rule ext, goal_cases)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   435
          case (1 n)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   436
          have "{..n+M} = {..<M} \<union> {M..n+M}" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   437
          also have "norm (\<Prod>k\<in>\<dots>. f (k + N)) = C * norm (\<Prod>k=M..n+M. f (k + N))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   438
            unfolding C_def by (subst prod.union_disjoint) (auto simp: norm_mult prod_norm)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   439
          also have "(\<Prod>k=M..n+M. f (k + N)) = (\<Prod>k\<le>n. f (k + N + M))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   440
            by (intro prod.reindex_bij_witness[of _ "\<lambda>i. i + M" "\<lambda>i. i - M"]) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   441
          finally show ?case by (simp add: add_ac prod_norm)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   442
        qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   443
        finally have "(\<lambda>n. C * (\<Prod>k\<le>n. norm (f (k + M + N))) / C) \<longlonglongrightarrow> 0 / C"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   444
          by (intro tendsto_divide tendsto_const) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   445
        thus "(\<lambda>n. \<Prod>k\<le>n. norm (f (k + M + N))) \<longlonglongrightarrow> 0" by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   446
      qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   447
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   448
      have "1 - (\<Sum>i. norm (f (i + M + N) - 1)) \<le> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   449
      proof (rule tendsto_le)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   450
        show "eventually (\<lambda>n. 1 - (\<Sum>k\<le>n. norm (f (k+M+N) - 1)) \<le> 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   451
                                (\<Prod>k\<le>n. 1 - norm (f (k+M+N) - 1))) at_top"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   452
          using M by (intro always_eventually allI weierstrass_prod_ineq) (auto intro: less_imp_le)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   453
        show "(\<lambda>n. \<Prod>k\<le>n. 1 - norm (f (k+M+N) - 1)) \<longlonglongrightarrow> 0" by fact
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   454
        show "(\<lambda>n. 1 - (\<Sum>k\<le>n. norm (f (k + M + N) - 1)))
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   455
                  \<longlonglongrightarrow> 1 - (\<Sum>i. norm (f (i + M + N) - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   456
          by (intro tendsto_intros summable_LIMSEQ' summable_ignore_initial_segment 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   457
                abs_convergent_prod_imp_summable assms)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   458
      qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   459
      hence "(\<Sum>i. norm (f (i + M + N) - 1)) \<ge> 1" by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   460
      also have "\<dots> + (\<Sum>i<M. norm (f (i + N) - 1)) = (\<Sum>i. norm (f (i + N) - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   461
        by (intro suminf_split_initial_segment [symmetric] summable_ignore_initial_segment
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   462
              abs_convergent_prod_imp_summable assms)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   463
      finally have "1 + (\<Sum>i<M. norm (f (i + N) - 1)) \<le> (\<Sum>i. norm (f (i + N) - 1))" by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   464
    } note * = this
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   465
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   466
    have "1 + (\<Sum>i. norm (f (i + N) - 1)) \<le> (\<Sum>i. norm (f (i + N) - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   467
    proof (rule tendsto_le)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   468
      show "(\<lambda>M. 1 + (\<Sum>i<M. norm (f (i + N) - 1))) \<longlonglongrightarrow> 1 + (\<Sum>i. norm (f (i + N) - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   469
        by (intro tendsto_intros summable_LIMSEQ summable_ignore_initial_segment 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   470
                abs_convergent_prod_imp_summable assms)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   471
      show "eventually (\<lambda>M. 1 + (\<Sum>i<M. norm (f (i + N) - 1)) \<le> (\<Sum>i. norm (f (i + N) - 1))) at_top"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   472
        using eventually_ge_at_top[of M0] by eventually_elim (use * in auto)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   473
    qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   474
    thus False by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   475
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   476
  with L show ?thesis by (auto simp: convergent_prod_def)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   477
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   478
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   479
end