src/HOL/Analysis/Infinite_Products.thy
author paulson <lp15@cam.ac.uk>
Thu, 03 May 2018 17:14:08 +0100
changeset 68071 c18af2b0f83e
parent 68064 b249fab48c76
child 68076 315043faa871
permissions -rw-r--r--
a lemma about infinite products
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
     1
(*File:      HOL/Analysis/Infinite_Product.thy
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
     2
  Author:    Manuel Eberl & LC Paulson
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
     3
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
     4
  Basic results about convergence and absolute convergence of infinite products
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
     5
  and their connection to summability.
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
     6
*)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
     7
section \<open>Infinite Products\<close>
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
     8
theory Infinite_Products
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
     9
  imports Complex_Main
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    10
begin
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    11
    
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    12
lemma sum_le_prod:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    13
  fixes f :: "'a \<Rightarrow> 'b :: linordered_semidom"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    14
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    15
  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
    16
  using assms
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    17
proof (induction A rule: infinite_finite_induct)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    18
  case (insert x A)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    19
  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
    20
    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
    21
  with insert.hyps show ?case by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    22
qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    23
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    24
lemma prod_le_exp_sum:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    25
  fixes f :: "'a \<Rightarrow> real"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    26
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    27
  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
    28
  using assms
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    29
proof (induction A rule: infinite_finite_induct)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    30
  case (insert x A)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    31
  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
    32
    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
    33
  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
    34
qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    35
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    36
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
    37
proof (rule lhopital)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    38
  show "(\<lambda>x::real. ln (1 + x)) \<midarrow>0\<rightarrow> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    39
    by (rule tendsto_eq_intros refl | simp)+
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    40
  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
    41
    by (rule eventually_nhds_in_open) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    42
  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
    43
    by (rule filter_leD [rotated]) (simp_all add: at_within_def)   
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    44
  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
    45
    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
    46
  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
    47
    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
    48
  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
    49
  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
    50
    by (rule tendsto_eq_intros refl | simp)+
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    51
qed auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    52
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    53
definition gen_has_prod :: "[nat \<Rightarrow> 'a::{t2_space, comm_semiring_1}, nat, 'a] \<Rightarrow> bool" 
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    54
  where "gen_has_prod f M p \<equiv> (\<lambda>n. \<Prod>i\<le>n. f (i+M)) \<longlonglongrightarrow> p \<and> p \<noteq> 0"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    55
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    56
text\<open>The nonzero and zero cases, as in \emph{Complex Analysis} by Joseph Bak and Donald J.Newman, page 241\<close>
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    57
definition has_prod :: "(nat \<Rightarrow> 'a::{t2_space, comm_semiring_1}) \<Rightarrow> 'a \<Rightarrow> bool" (infixr "has'_prod" 80)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    58
  where "f has_prod p \<equiv> gen_has_prod f 0 p \<or> (\<exists>i q. p = 0 \<and> f i = 0 \<and> gen_has_prod f (Suc i) q)"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    59
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    60
definition convergent_prod :: "(nat \<Rightarrow> 'a :: {t2_space,comm_semiring_1}) \<Rightarrow> bool" where
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    61
  "convergent_prod f \<equiv> \<exists>M p. gen_has_prod f M p"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    62
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    63
definition prodinf :: "(nat \<Rightarrow> 'a::{t2_space, comm_semiring_1}) \<Rightarrow> 'a"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    64
    (binder "\<Prod>" 10)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    65
  where "prodinf f = (THE p. f has_prod p)"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    66
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    67
lemmas prod_defs = gen_has_prod_def has_prod_def convergent_prod_def prodinf_def
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    68
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    69
lemma has_prod_subst[trans]: "f = g \<Longrightarrow> g has_prod z \<Longrightarrow> f has_prod z"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    70
  by simp
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    71
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    72
lemma has_prod_cong: "(\<And>n. f n = g n) \<Longrightarrow> f has_prod c \<longleftrightarrow> g has_prod c"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    73
  by presburger
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    74
68071
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
    75
lemma gen_has_prod_nonzero [simp]: "\<not> gen_has_prod f M 0"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
    76
  by (simp add: gen_has_prod_def)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
    77
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
    78
lemma has_prod_0_iff: "f has_prod 0 \<longleftrightarrow> (\<exists>i. f i = 0 \<and> (\<exists>p. gen_has_prod f (Suc i) p))"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
    79
  by (simp add: has_prod_def)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
    80
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    81
lemma convergent_prod_altdef:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    82
  fixes f :: "nat \<Rightarrow> 'a :: {t2_space,comm_semiring_1}"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    83
  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
    84
proof
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    85
  assume "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    86
  then obtain M L where *: "(\<lambda>n. \<Prod>i\<le>n. f (i+M)) \<longlonglongrightarrow> L" "L \<noteq> 0"
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    87
    by (auto simp: prod_defs)
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    88
  have "f i \<noteq> 0" if "i \<ge> M" for i
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    89
  proof
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    90
    assume "f i = 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    91
    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
    92
      using eventually_ge_at_top[of "i - M"]
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    93
    proof eventually_elim
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    94
      case (elim n)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    95
      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
    96
        by (auto intro!: bexI[of _ "i - M"] prod_zero)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    97
    qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    98
    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
    99
      unfolding filterlim_iff
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   100
      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
   101
    from tendsto_unique[OF _ this *(1)] and *(2)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   102
      show False by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   103
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   104
  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
   105
    by blast
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   106
qed (auto simp: prod_defs)
66277
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
definition abs_convergent_prod :: "(nat \<Rightarrow> _) \<Rightarrow> bool" where
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   109
  "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
   110
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   111
lemma abs_convergent_prodI:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   112
  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
   113
  shows   "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   114
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   115
  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
   116
    by (auto simp: convergent_def)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   117
  have "L \<ge> 1"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   118
  proof (rule tendsto_le)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   119
    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
   120
    proof (intro always_eventually allI)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   121
      fix n
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   122
      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
   123
        by (intro prod_mono) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   124
      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
   125
    qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   126
  qed (use L in simp_all)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   127
  hence "L \<noteq> 0" by auto
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   128
  with L show ?thesis unfolding abs_convergent_prod_def prod_defs
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   129
    by (intro exI[of _ "0::nat"] exI[of _ L]) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   130
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   131
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   132
lemma
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   133
  fixes f :: "nat \<Rightarrow> 'a :: {topological_semigroup_mult,t2_space,idom}"
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   134
  assumes "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   135
  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
   136
    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
   137
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   138
  from assms obtain M L 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   139
    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
   140
    by (auto simp: convergent_prod_altdef)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   141
  note this(2)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   142
  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
   143
    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
   144
  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
   145
    by (intro tendsto_mult tendsto_const)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   146
  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
   147
    by (subst prod.union_disjoint) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   148
  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
   149
  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
   150
    by (rule LIMSEQ_offset)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   151
  thus "convergent (\<lambda>n. \<Prod>i\<le>n. f i)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   152
    by (auto simp: convergent_def)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   153
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   154
  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
   155
  proof
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   156
    assume "\<exists>i. f i = 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   157
    then obtain i where "f i = 0" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   158
    moreover with M have "i < M" by (cases "i < M") auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   159
    ultimately have "(\<Prod>i<M. f i) = 0" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   160
    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
   161
  next
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   162
    assume "(\<lambda>n. \<Prod>i\<le>n. f i) \<longlonglongrightarrow> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   163
    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
   164
    show "\<exists>i. f i = 0" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   165
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   166
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   167
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   168
lemma convergent_prod_iff_nz_lim:
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   169
  fixes f :: "nat \<Rightarrow> 'a :: {topological_semigroup_mult,t2_space,idom}"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   170
  assumes "\<And>i. f i \<noteq> 0"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   171
  shows "convergent_prod f \<longleftrightarrow> (\<exists>L. (\<lambda>n. \<Prod>i\<le>n. f i) \<longlonglongrightarrow> L \<and> L \<noteq> 0)"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   172
    (is "?lhs \<longleftrightarrow> ?rhs")
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   173
proof
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   174
  assume ?lhs then show ?rhs
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   175
    using assms convergentD convergent_prod_imp_convergent convergent_prod_to_zero_iff by blast
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   176
next
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   177
  assume ?rhs then show ?lhs
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   178
    unfolding prod_defs
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   179
    by (rule_tac x="0" in exI) (auto simp: )
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   180
qed
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   181
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   182
lemma convergent_prod_iff_convergent: 
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   183
  fixes f :: "nat \<Rightarrow> 'a :: {topological_semigroup_mult,t2_space,idom}"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   184
  assumes "\<And>i. f i \<noteq> 0"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   185
  shows "convergent_prod f \<longleftrightarrow> convergent (\<lambda>n. \<Prod>i\<le>n. f i) \<and> lim (\<lambda>n. \<Prod>i\<le>n. f i) \<noteq> 0"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   186
  by (force simp add: convergent_prod_iff_nz_lim assms convergent_def limI)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   187
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   188
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   189
lemma abs_convergent_prod_altdef:
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   190
  fixes f :: "nat \<Rightarrow> 'a :: {one,real_normed_vector}"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   191
  shows  "abs_convergent_prod f \<longleftrightarrow> convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   192
proof
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   193
  assume "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   194
  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
   195
    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
   196
qed (auto intro: abs_convergent_prodI)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   197
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   198
lemma weierstrass_prod_ineq:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   199
  fixes f :: "'a \<Rightarrow> real" 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   200
  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
   201
  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
   202
  using assms
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   203
proof (induction A rule: infinite_finite_induct)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   204
  case (insert x A)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   205
  from insert.hyps and insert.prems 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   206
    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
   207
    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
   208
  with insert.hyps show ?case by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   209
qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   210
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   211
lemma norm_prod_minus1_le_prod_minus1:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   212
  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
   213
  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
   214
proof (induction A rule: infinite_finite_induct)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   215
  case (insert x A)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   216
  from insert.hyps have 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   217
    "norm ((\<Prod>n\<in>insert x A. 1 + f n) - 1) = 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   218
       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
   219
    by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   220
  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
   221
    by (rule norm_triangle_ineq)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   222
  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
   223
    by (simp add: prod_norm norm_mult)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   224
  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
   225
    by (intro prod_mono norm_triangle_ineq ballI conjI) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   226
  also have "norm (1::'a) = 1" by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   227
  also note insert.IH
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   228
  also have "(\<Prod>n\<in>A. 1 + norm (f n)) - 1 + norm (f x) * (\<Prod>x\<in>A. 1 + norm (f x)) =
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   229
             (\<Prod>n\<in>insert x A. 1 + norm (f n)) - 1"
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   230
    using insert.hyps by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   231
  finally show ?case by - (simp_all add: mult_left_mono)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   232
qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   233
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   234
lemma convergent_prod_imp_ev_nonzero:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   235
  fixes f :: "nat \<Rightarrow> 'a :: {t2_space,comm_semiring_1}"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   236
  assumes "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   237
  shows   "eventually (\<lambda>n. f n \<noteq> 0) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   238
  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
   239
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   240
lemma convergent_prod_imp_LIMSEQ:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   241
  fixes f :: "nat \<Rightarrow> 'a :: {real_normed_field}"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   242
  assumes "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   243
  shows   "f \<longlonglongrightarrow> 1"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   244
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   245
  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
   246
    by (auto simp: convergent_prod_altdef)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   247
  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
   248
  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
   249
    using L L' by (intro tendsto_divide) simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   250
  also from L have "L / L = 1" by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   251
  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
   252
    using assms L by (auto simp: fun_eq_iff atMost_Suc)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   253
  finally show ?thesis by (rule LIMSEQ_offset)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   254
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   255
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   256
lemma abs_convergent_prod_imp_summable:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   257
  fixes f :: "nat \<Rightarrow> 'a :: real_normed_div_algebra"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   258
  assumes "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   259
  shows "summable (\<lambda>i. norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   260
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   261
  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
   262
    unfolding abs_convergent_prod_def by (rule convergent_prod_imp_convergent)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   263
  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
   264
    unfolding convergent_def by blast
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   265
  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
   266
  proof (rule Bseq_monoseq_convergent)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   267
    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
   268
      using L(1) by (rule order_tendstoD) simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   269
    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
   270
    proof eventually_elim
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   271
      case (elim n)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   272
      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
   273
        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
   274
      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
   275
      also have "\<dots> < L + 1" by (rule elim)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   276
      finally show ?case by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   277
    qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   278
    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
   279
  next
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   280
    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
   281
      by (rule mono_SucI1) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   282
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   283
  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
   284
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   285
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   286
lemma summable_imp_abs_convergent_prod:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   287
  fixes f :: "nat \<Rightarrow> 'a :: real_normed_div_algebra"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   288
  assumes "summable (\<lambda>i. norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   289
  shows   "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   290
proof (intro abs_convergent_prodI Bseq_monoseq_convergent)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   291
  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
   292
    by (intro mono_SucI1) 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   293
       (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
   294
next
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   295
  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
   296
  proof (rule Bseq_eventually_mono)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   297
    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
   298
            norm (exp (\<Sum>i\<le>n. norm (f i - 1)))) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   299
      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
   300
  next
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   301
    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
   302
      using sums_def_le by blast
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   303
    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
   304
      by (rule tendsto_exp)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   305
    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
   306
      by (rule convergentI)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   307
    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
   308
      by (rule convergent_imp_Bseq)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   309
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   310
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   311
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   312
lemma abs_convergent_prod_conv_summable:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   313
  fixes f :: "nat \<Rightarrow> 'a :: real_normed_div_algebra"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   314
  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
   315
  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
   316
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   317
lemma abs_convergent_prod_imp_LIMSEQ:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   318
  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
   319
  assumes "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   320
  shows   "f \<longlonglongrightarrow> 1"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   321
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   322
  from assms have "summable (\<lambda>n. norm (f n - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   323
    by (rule abs_convergent_prod_imp_summable)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   324
  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
   325
    by (simp add: tendsto_norm_zero_iff)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   326
  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
   327
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   328
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   329
lemma abs_convergent_prod_imp_ev_nonzero:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   330
  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
   331
  assumes "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   332
  shows   "eventually (\<lambda>n. f n \<noteq> 0) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   333
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   334
  from assms have "f \<longlonglongrightarrow> 1" 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   335
    by (rule abs_convergent_prod_imp_LIMSEQ)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   336
  hence "eventually (\<lambda>n. dist (f n) 1 < 1) at_top"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   337
    by (auto simp: tendsto_iff)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   338
  thus ?thesis by eventually_elim auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   339
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   340
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   341
lemma convergent_prod_offset:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   342
  assumes "convergent_prod (\<lambda>n. f (n + m))"  
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   343
  shows   "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   344
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   345
  from assms obtain M L where "(\<lambda>n. \<Prod>k\<le>n. f (k + (M + m))) \<longlonglongrightarrow> L" "L \<noteq> 0"
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   346
    by (auto simp: prod_defs add.assoc)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   347
  thus "convergent_prod f" 
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   348
    unfolding prod_defs by blast
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   349
qed
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_offset:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   352
  assumes "abs_convergent_prod (\<lambda>n. f (n + m))"  
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   353
  shows   "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   354
  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
   355
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   356
lemma convergent_prod_ignore_initial_segment:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   357
  fixes f :: "nat \<Rightarrow> 'a :: {real_normed_field}"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   358
  assumes "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   359
  shows   "convergent_prod (\<lambda>n. f (n + m))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   360
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   361
  from assms obtain M L 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   362
    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
   363
    by (auto simp: convergent_prod_altdef)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   364
  define C where "C = (\<Prod>k<m. f (k + M))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   365
  from nz have [simp]: "C \<noteq> 0" 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   366
    by (auto simp: C_def)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   367
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   368
  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
   369
    by (rule LIMSEQ_ignore_initial_segment)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   370
  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
   371
  proof (rule ext, goal_cases)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   372
    case (1 n)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   373
    have "{..n+m} = {..<m} \<union> {m..n+m}" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   374
    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
   375
      unfolding C_def by (rule prod.union_disjoint) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   376
    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
   377
      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
   378
    finally show ?case by (simp add: add_ac)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   379
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   380
  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
   381
    by (intro tendsto_divide tendsto_const) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   382
  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
   383
  moreover from \<open>L \<noteq> 0\<close> have "L / C \<noteq> 0" by simp
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   384
  ultimately show ?thesis 
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   385
    unfolding prod_defs by blast
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   386
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   387
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   388
lemma abs_convergent_prod_ignore_initial_segment:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   389
  assumes "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   390
  shows   "abs_convergent_prod (\<lambda>n. f (n + m))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   391
  using assms unfolding abs_convergent_prod_def 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   392
  by (rule convergent_prod_ignore_initial_segment)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   393
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   394
lemma abs_convergent_prod_imp_convergent_prod:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   395
  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
   396
  assumes "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   397
  shows   "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   398
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   399
  from assms have "eventually (\<lambda>n. f n \<noteq> 0) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   400
    by (rule abs_convergent_prod_imp_ev_nonzero)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   401
  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
   402
    by (auto simp: eventually_at_top_linorder)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   403
  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
   404
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   405
  have "Cauchy ?P"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   406
  proof (rule CauchyI', goal_cases)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   407
    case (1 \<epsilon>)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   408
    from assms have "abs_convergent_prod (\<lambda>n. f (n + N))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   409
      by (rule abs_convergent_prod_ignore_initial_segment)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   410
    hence "Cauchy ?Q"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   411
      unfolding abs_convergent_prod_def
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   412
      by (intro convergent_Cauchy convergent_prod_imp_convergent)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   413
    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
   414
      by blast
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   415
    show ?case
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   416
    proof (rule exI[of _ M], safe, goal_cases)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   417
      case (1 m n)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   418
      have "dist (?P m) (?P n) = norm (?P n - ?P m)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   419
        by (simp add: dist_norm norm_minus_commute)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   420
      also from 1 have "{..n} = {..m} \<union> {m<..n}" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   421
      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
   422
        by (subst prod.union_disjoint [symmetric]) (auto simp: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   423
      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
   424
        by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   425
      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
   426
        by (simp add: norm_mult prod_norm)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   427
      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
   428
        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
   429
              norm_triangle_ineq[of 1 "f k - 1" for k]
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   430
        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
   431
      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
   432
        by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   433
      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
   434
                   (\<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
   435
        by (rule prod.union_disjoint [symmetric]) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   436
      also from 1 have "{..m}\<union>{m<..n} = {..n}" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   437
      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
   438
      also from 1 have "\<dots> < \<epsilon>" by (intro M) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   439
      finally show ?case .
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   440
    qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   441
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   442
  hence conv: "convergent ?P" by (rule Cauchy_convergent)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   443
  then obtain L where L: "?P \<longlonglongrightarrow> L"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   444
    by (auto simp: convergent_def)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   445
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   446
  have "L \<noteq> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   447
  proof
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   448
    assume [simp]: "L = 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   449
    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
   450
      by (simp add: prod_norm)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   451
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   452
    from assms have "(\<lambda>n. f (n + N)) \<longlonglongrightarrow> 1"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   453
      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
   454
    hence "eventually (\<lambda>n. norm (f (n + N) - 1) < 1) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   455
      by (auto simp: tendsto_iff dist_norm)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   456
    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
   457
      by (auto simp: eventually_at_top_linorder)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   458
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   459
    {
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   460
      fix M assume M: "M \<ge> M0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   461
      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
   462
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   463
      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
   464
      proof (rule tendsto_sandwich)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   465
        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
   466
          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
   467
        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
   468
          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
   469
        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
   470
          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
   471
        
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   472
        define C where "C = (\<Prod>k<M. norm (f (k + N)))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   473
        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
   474
        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
   475
          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
   476
        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
   477
        proof (rule ext, goal_cases)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   478
          case (1 n)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   479
          have "{..n+M} = {..<M} \<union> {M..n+M}" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   480
          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
   481
            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
   482
          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
   483
            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
   484
          finally show ?case by (simp add: add_ac prod_norm)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   485
        qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   486
        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
   487
          by (intro tendsto_divide tendsto_const) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   488
        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
   489
      qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   490
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   491
      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
   492
      proof (rule tendsto_le)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   493
        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
   494
                                (\<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
   495
          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
   496
        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
   497
        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
   498
                  \<longlonglongrightarrow> 1 - (\<Sum>i. norm (f (i + M + N) - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   499
          by (intro tendsto_intros summable_LIMSEQ' summable_ignore_initial_segment 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   500
                abs_convergent_prod_imp_summable assms)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   501
      qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   502
      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
   503
      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
   504
        by (intro suminf_split_initial_segment [symmetric] summable_ignore_initial_segment
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   505
              abs_convergent_prod_imp_summable assms)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   506
      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
   507
    } note * = this
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   508
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   509
    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
   510
    proof (rule tendsto_le)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   511
      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
   512
        by (intro tendsto_intros summable_LIMSEQ summable_ignore_initial_segment 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   513
                abs_convergent_prod_imp_summable assms)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   514
      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
   515
        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
   516
    qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   517
    thus False by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   518
  qed
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   519
  with L show ?thesis by (auto simp: prod_defs)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   520
qed
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   521
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   522
lemma convergent_prod_offset_0:
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   523
  fixes f :: "nat \<Rightarrow> 'a :: {idom,topological_semigroup_mult,t2_space}"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   524
  assumes "convergent_prod f" "\<And>i. f i \<noteq> 0"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   525
  shows "\<exists>p. gen_has_prod f 0 p"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   526
  using assms
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   527
  unfolding convergent_prod_def
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   528
proof (clarsimp simp: prod_defs)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   529
  fix M p
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   530
  assume "(\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> p" "p \<noteq> 0"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   531
  then have "(\<lambda>n. prod f {..<M} * (\<Prod>i\<le>n. f (i + M))) \<longlonglongrightarrow> prod f {..<M} * p"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   532
    by (metis tendsto_mult_left)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   533
  moreover have "prod f {..<M} * (\<Prod>i\<le>n. f (i + M)) = prod f {..n+M}" for n
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   534
  proof -
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   535
    have "{..n+M} = {..<M} \<union> {M..n+M}"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   536
      by auto
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   537
    then have "prod f {..n+M} = prod f {..<M} * prod f {M..n+M}"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   538
      by simp (subst prod.union_disjoint; force)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   539
    also have "... = prod f {..<M} * (\<Prod>i\<le>n. f (i + M))"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   540
      by (metis (mono_tags, lifting) add.left_neutral atMost_atLeast0 prod_shift_bounds_cl_nat_ivl)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   541
    finally show ?thesis by metis
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   542
  qed
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   543
  ultimately have "(\<lambda>n. prod f {..n}) \<longlonglongrightarrow> prod f {..<M} * p"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   544
    by (auto intro: LIMSEQ_offset [where k=M])
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   545
  then show "\<exists>p. (\<lambda>n. prod f {..n}) \<longlonglongrightarrow> p \<and> p \<noteq> 0"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   546
    using \<open>p \<noteq> 0\<close> assms
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   547
    by (rule_tac x="prod f {..<M} * p" in exI) auto
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   548
qed
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   549
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   550
lemma prodinf_eq_lim:
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   551
  fixes f :: "nat \<Rightarrow> 'a :: {idom,topological_semigroup_mult,t2_space}"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   552
  assumes "convergent_prod f" "\<And>i. f i \<noteq> 0"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   553
  shows "prodinf f = lim (\<lambda>n. \<Prod>i\<le>n. f i)"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   554
  using assms convergent_prod_offset_0 [OF assms]
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   555
  by (simp add: prod_defs lim_def) (metis (no_types) assms(1) convergent_prod_to_zero_iff)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   556
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   557
lemma has_prod_one[simp, intro]: "(\<lambda>n. 1) has_prod 1"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   558
  unfolding prod_defs by auto
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   559
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   560
lemma convergent_prod_one[simp, intro]: "convergent_prod (\<lambda>n. 1)"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   561
  unfolding prod_defs by auto
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   562
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   563
lemma prodinf_cong: "(\<And>n. f n = g n) \<Longrightarrow> prodinf f = prodinf g"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   564
  by presburger
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   565
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   566
lemma convergent_prod_cong:
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   567
  fixes f g :: "nat \<Rightarrow> 'a::{field,topological_semigroup_mult,t2_space}"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   568
  assumes ev: "eventually (\<lambda>x. f x = g x) sequentially" and f: "\<And>i. f i \<noteq> 0" and g: "\<And>i. g i \<noteq> 0"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   569
  shows "convergent_prod f = convergent_prod g"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   570
proof -
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   571
  from assms obtain N where N: "\<forall>n\<ge>N. f n = g n"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   572
    by (auto simp: eventually_at_top_linorder)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   573
  define C where "C = (\<Prod>k<N. f k / g k)"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   574
  with g have "C \<noteq> 0"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   575
    by (simp add: f)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   576
  have *: "eventually (\<lambda>n. prod f {..n} = C * prod g {..n}) sequentially"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   577
    using eventually_ge_at_top[of N]
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   578
  proof eventually_elim
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   579
    case (elim n)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   580
    then have "{..n} = {..<N} \<union> {N..n}"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   581
      by auto
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   582
    also have "prod f ... = prod f {..<N} * prod f {N..n}"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   583
      by (intro prod.union_disjoint) auto
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   584
    also from N have "prod f {N..n} = prod g {N..n}"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   585
      by (intro prod.cong) simp_all
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   586
    also have "prod f {..<N} * prod g {N..n} = C * (prod g {..<N} * prod g {N..n})"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   587
      unfolding C_def by (simp add: g prod_dividef)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   588
    also have "prod g {..<N} * prod g {N..n} = prod g ({..<N} \<union> {N..n})"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   589
      by (intro prod.union_disjoint [symmetric]) auto
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   590
    also from elim have "{..<N} \<union> {N..n} = {..n}"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   591
      by auto                                                                    
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   592
    finally show "prod f {..n} = C * prod g {..n}" .
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   593
  qed
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   594
  then have cong: "convergent (\<lambda>n. prod f {..n}) = convergent (\<lambda>n. C * prod g {..n})"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   595
    by (rule convergent_cong)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   596
  show ?thesis
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   597
  proof
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   598
    assume cf: "convergent_prod f"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   599
    then have "\<not> (\<lambda>n. prod g {..n}) \<longlonglongrightarrow> 0"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   600
      using tendsto_mult_left * convergent_prod_to_zero_iff f filterlim_cong by fastforce
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   601
    then show "convergent_prod g"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   602
      by (metis convergent_mult_const_iff \<open>C \<noteq> 0\<close> cong cf convergent_LIMSEQ_iff convergent_prod_iff_convergent convergent_prod_imp_convergent g)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   603
  next
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   604
    assume cg: "convergent_prod g"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   605
    have "\<exists>a. C * a \<noteq> 0 \<and> (\<lambda>n. prod g {..n}) \<longlonglongrightarrow> a"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   606
      by (metis (no_types) \<open>C \<noteq> 0\<close> cg convergent_prod_iff_nz_lim divide_eq_0_iff g nonzero_mult_div_cancel_right)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   607
    then show "convergent_prod f"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   608
      using "*" tendsto_mult_left filterlim_cong
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   609
      by (fastforce simp add: convergent_prod_iff_nz_lim f)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   610
  qed
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   611
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   612
68071
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   613
lemma has_prod_finite:
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   614
  fixes f :: "nat \<Rightarrow> 'a::{idom,t2_space}"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   615
  assumes [simp]: "finite N"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   616
    and f: "\<And>n. n \<notin> N \<Longrightarrow> f n = 1"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   617
  shows "f has_prod (\<Prod>n\<in>N. f n)"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   618
proof -
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   619
  have eq: "prod f {..n + Suc (Max N)} = prod f N" for n
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   620
  proof (rule prod.mono_neutral_right)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   621
    show "N \<subseteq> {..n + Suc (Max N)}"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   622
      by (auto simp add: le_Suc_eq trans_le_add2)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   623
    show "\<forall>i\<in>{..n + Suc (Max N)} - N. f i = 1"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   624
      using f by blast
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   625
  qed auto
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   626
  show ?thesis
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   627
  proof (cases "\<forall>n\<in>N. f n \<noteq> 0")
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   628
    case True
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   629
    then have "prod f N \<noteq> 0"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   630
      by simp
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   631
    moreover have "(\<lambda>n. prod f {..n}) \<longlonglongrightarrow> prod f N"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   632
      by (rule LIMSEQ_offset[of _ "Suc (Max N)"]) (simp add: eq atLeast0LessThan del: add_Suc_right)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   633
    ultimately show ?thesis
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   634
      by (simp add: gen_has_prod_def has_prod_def)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   635
  next
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   636
    case False
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   637
    then obtain k where "k \<in> N" "f k = 0"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   638
      by auto
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   639
    let ?Z = "{n \<in> N. f n = 0}"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   640
    have maxge: "Max ?Z \<ge> n" if "f n = 0" for n
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   641
      using Max_ge [of ?Z] \<open>finite N\<close> \<open>f n = 0\<close>
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   642
      by (metis (mono_tags) Collect_mem_eq f finite_Collect_conjI mem_Collect_eq zero_neq_one)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   643
    let ?q = "prod f {Suc (Max ?Z)..Max N}"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   644
    have [simp]: "?q \<noteq> 0"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   645
      using maxge Suc_n_not_le_n le_trans by force
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   646
    have eq1: "(\<Prod>i\<le>n + Max N. f (Suc (i + Max ?Z))) = prod f {Suc (Max ?Z)..n + (Max N) + Suc (Max ?Z)}" for n
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   647
      apply (rule sym)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   648
      apply (rule prod.reindex_cong [where l = "\<lambda>i. i + Suc (Max ?Z)"])
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   649
        apply (auto simp: )
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   650
       apply (simp add: inj_on_def)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   651
      apply (auto simp: image_iff)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   652
      using le_Suc_ex by fastforce
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   653
    have eq: "prod f {Suc (Max ?Z)..n + (Max N) + Suc (Max ?Z)} = ?q" for n
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   654
      apply (rule prod.mono_neutral_right)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   655
        apply (auto simp: )
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   656
      using Max.coboundedI assms(1) f by blast
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   657
    have q: "gen_has_prod f (Suc (Max ?Z)) ?q"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   658
      apply (auto simp: gen_has_prod_def)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   659
      apply (rule LIMSEQ_offset[of _ "(Max N)"])
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   660
      apply (simp add: eq1 eq atLeast0LessThan del: add_Suc_right)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   661
      done
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   662
    show ?thesis
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   663
      unfolding has_prod_def
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   664
    proof (intro disjI2 exI conjI)      
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   665
      show "prod f N = 0"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   666
        using \<open>f k = 0\<close> \<open>k \<in> N\<close> \<open>finite N\<close> prod_zero by blast
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   667
      show "f (Max ?Z) = 0"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   668
        using Max_in [of ?Z] \<open>finite N\<close> \<open>f k = 0\<close> \<open>k \<in> N\<close> by auto
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   669
    qed (use q in auto)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   670
  qed
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   671
qed
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   672
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   673
corollary has_prod_0:
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   674
  fixes f :: "nat \<Rightarrow> 'a::{idom,t2_space}"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   675
  assumes "\<And>n. f n = 1"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   676
  shows "f has_prod 1"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   677
  by (simp add: assms has_prod_cong)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   678
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   679
lemma convergent_prod_finite:
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   680
  fixes f :: "nat \<Rightarrow> 'a::{idom,t2_space}"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   681
  assumes "finite N" "\<And>n. n \<notin> N \<Longrightarrow> f n = 1"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   682
  shows "convergent_prod f"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   683
proof -
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   684
  have "\<exists>n p. gen_has_prod f n p"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   685
    using assms has_prod_def has_prod_finite by blast
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   686
  then show ?thesis
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   687
    by (simp add: convergent_prod_def)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   688
qed
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   689
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   690
end