src/HOL/Analysis/Infinite_Products.thy
author paulson <lp15@cam.ac.uk>
Fri, 25 Dec 2020 11:44:18 +0000
changeset 73004 cf14976d4fdb
parent 71827 5e315defb038
child 73005 83b114a6545f
permissions -rw-r--r--
infinite products iff simprule
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
68585
1657b9a5dd5d more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68527
diff changeset
     9
  imports Topology_Euclidean_Space Complex_Transcendental
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    10
begin
68424
02e5a44ffe7d the last of the infinite product proofs
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
    11
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70113
diff changeset
    12
subsection\<^marker>\<open>tag unimportant\<close> \<open>Preliminaries\<close>
68424
02e5a44ffe7d the last of the infinite product proofs
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
    13
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    14
lemma sum_le_prod:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    15
  fixes f :: "'a \<Rightarrow> 'b :: linordered_semidom"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    16
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    17
  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
    18
  using assms
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    19
proof (induction A rule: infinite_finite_induct)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    20
  case (insert x A)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    21
  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
    22
    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
    23
  with insert.hyps show ?case by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    24
qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    25
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    26
lemma prod_le_exp_sum:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    27
  fixes f :: "'a \<Rightarrow> real"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    28
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    29
  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
    30
  using assms
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    31
proof (induction A rule: infinite_finite_induct)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    32
  case (insert x A)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    33
  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
    34
    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
    35
  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
    36
qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    37
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    38
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
    39
proof (rule lhopital)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    40
  show "(\<lambda>x::real. ln (1 + x)) \<midarrow>0\<rightarrow> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    41
    by (rule tendsto_eq_intros refl | simp)+
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    42
  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
    43
    by (rule eventually_nhds_in_open) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    44
  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
    45
    by (rule filter_leD [rotated]) (simp_all add: at_within_def)   
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    46
  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
    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 "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
    49
    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
    50
  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
    51
  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
    52
    by (rule tendsto_eq_intros refl | simp)+
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    53
qed auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    54
68424
02e5a44ffe7d the last of the infinite product proofs
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
    55
subsection\<open>Definitions and basic properties\<close>
02e5a44ffe7d the last of the infinite product proofs
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
    56
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70113
diff changeset
    57
definition\<^marker>\<open>tag important\<close> raw_has_prod :: "[nat \<Rightarrow> 'a::{t2_space, comm_semiring_1}, nat, 'a] \<Rightarrow> bool" 
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
    58
  where "raw_has_prod f M p \<equiv> (\<lambda>n. \<Prod>i\<le>n. f (i+M)) \<longlonglongrightarrow> p \<and> p \<noteq> 0"
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    59
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    60
text\<open>The nonzero and zero cases, as in \emph{Complex Analysis} by Joseph Bak and Donald J.Newman, page 241\<close>
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70113
diff changeset
    61
text\<^marker>\<open>tag important\<close> \<open>%whitespace\<close>
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70113
diff changeset
    62
definition\<^marker>\<open>tag important\<close>
68651
Manuel Eberl <eberlm@in.tum.de>
parents: 68616
diff changeset
    63
  has_prod :: "(nat \<Rightarrow> 'a::{t2_space, comm_semiring_1}) \<Rightarrow> 'a \<Rightarrow> bool" (infixr "has'_prod" 80)
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
    64
  where "f has_prod p \<equiv> raw_has_prod f 0 p \<or> (\<exists>i q. p = 0 \<and> f i = 0 \<and> raw_has_prod f (Suc i) q)"
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    65
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70113
diff changeset
    66
definition\<^marker>\<open>tag important\<close> convergent_prod :: "(nat \<Rightarrow> 'a :: {t2_space,comm_semiring_1}) \<Rightarrow> bool" where
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
    67
  "convergent_prod f \<equiv> \<exists>M p. raw_has_prod f M p"
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    68
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70113
diff changeset
    69
definition\<^marker>\<open>tag important\<close> prodinf :: "(nat \<Rightarrow> 'a::{t2_space, comm_semiring_1}) \<Rightarrow> 'a"
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    70
    (binder "\<Prod>" 10)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    71
  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
    72
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
    73
lemmas prod_defs = raw_has_prod_def has_prod_def convergent_prod_def prodinf_def
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    74
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    75
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
    76
  by simp
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    77
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
    78
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
    79
  by presburger
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
    80
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
    81
lemma raw_has_prod_nonzero [simp]: "\<not> raw_has_prod f M 0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
    82
  by (simp add: raw_has_prod_def)
68071
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
    83
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
    84
lemma raw_has_prod_eq_0:
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
    85
  fixes f :: "nat \<Rightarrow> 'a::{semidom,t2_space}"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
    86
  assumes p: "raw_has_prod f m p" and i: "f i = 0" "i \<ge> m"
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
    87
  shows "p = 0"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
    88
proof -
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
    89
  have eq0: "(\<Prod>k\<le>n. f (k+m)) = 0" if "i - m \<le> n" for n
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
    90
  proof -
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
    91
    have "\<exists>k\<le>n. f (k + m) = 0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
    92
      using i that by auto
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
    93
    then show ?thesis
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
    94
      by auto
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
    95
  qed
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
    96
  have "(\<lambda>n. \<Prod>i\<le>n. f (i + m)) \<longlonglongrightarrow> 0"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
    97
    by (rule LIMSEQ_offset [where k = "i-m"]) (simp add: eq0)
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
    98
    with p show ?thesis
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
    99
      unfolding raw_has_prod_def
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   100
    using LIMSEQ_unique by blast
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   101
qed
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   102
68452
c027dfbfad30 more on infinite products. Also subgroup_imp_subset -> subgroup.subset
paulson <lp15@cam.ac.uk>
parents: 68426
diff changeset
   103
lemma raw_has_prod_Suc: 
c027dfbfad30 more on infinite products. Also subgroup_imp_subset -> subgroup.subset
paulson <lp15@cam.ac.uk>
parents: 68426
diff changeset
   104
  "raw_has_prod f (Suc M) a \<longleftrightarrow> raw_has_prod (\<lambda>n. f (Suc n)) M a"
c027dfbfad30 more on infinite products. Also subgroup_imp_subset -> subgroup.subset
paulson <lp15@cam.ac.uk>
parents: 68426
diff changeset
   105
  unfolding raw_has_prod_def by auto
c027dfbfad30 more on infinite products. Also subgroup_imp_subset -> subgroup.subset
paulson <lp15@cam.ac.uk>
parents: 68426
diff changeset
   106
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   107
lemma has_prod_0_iff: "f has_prod 0 \<longleftrightarrow> (\<exists>i. f i = 0 \<and> (\<exists>p. raw_has_prod f (Suc i) p))"
68071
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   108
  by (simp add: has_prod_def)
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   109
      
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   110
lemma has_prod_unique2: 
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   111
  fixes f :: "nat \<Rightarrow> 'a::{semidom,t2_space}"
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   112
  assumes "f has_prod a" "f has_prod b" shows "a = b"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   113
  using assms
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   114
  by (auto simp: has_prod_def raw_has_prod_eq_0) (meson raw_has_prod_def sequentially_bot tendsto_unique)
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   115
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   116
lemma has_prod_unique:
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   117
  fixes f :: "nat \<Rightarrow> 'a :: {semidom,t2_space}"
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   118
  shows "f has_prod s \<Longrightarrow> s = prodinf f"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   119
  by (simp add: has_prod_unique2 prodinf_def the_equality)
68071
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   120
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   121
lemma convergent_prod_altdef:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   122
  fixes f :: "nat \<Rightarrow> 'a :: {t2_space,comm_semiring_1}"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   123
  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
   124
proof
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   125
  assume "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   126
  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
   127
    by (auto simp: prod_defs)
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   128
  have "f i \<noteq> 0" if "i \<ge> M" for i
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   129
  proof
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   130
    assume "f i = 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   131
    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
   132
      using eventually_ge_at_top[of "i - M"]
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   133
    proof eventually_elim
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   134
      case (elim n)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   135
      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
   136
        by (auto intro!: bexI[of _ "i - M"] prod_zero)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   137
    qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   138
    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
   139
      unfolding filterlim_iff
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   140
      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
   141
    from tendsto_unique[OF _ this *(1)] and *(2)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   142
      show False by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   143
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   144
  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
   145
    by blast
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   146
qed (auto simp: prod_defs)
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   147
68424
02e5a44ffe7d the last of the infinite product proofs
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
   148
02e5a44ffe7d the last of the infinite product proofs
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
   149
subsection\<open>Absolutely convergent products\<close>
02e5a44ffe7d the last of the infinite product proofs
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
   150
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70113
diff changeset
   151
definition\<^marker>\<open>tag important\<close> abs_convergent_prod :: "(nat \<Rightarrow> _) \<Rightarrow> bool" where
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   152
  "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
   153
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   154
lemma abs_convergent_prodI:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   155
  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
   156
  shows   "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   157
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   158
  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
   159
    by (auto simp: convergent_def)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   160
  have "L \<ge> 1"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   161
  proof (rule tendsto_le)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   162
    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
   163
    proof (intro always_eventually allI)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   164
      fix n
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   165
      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
   166
        by (intro prod_mono) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   167
      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
   168
    qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   169
  qed (use L in simp_all)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   170
  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
   171
  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
   172
    by (intro exI[of _ "0::nat"] exI[of _ L]) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   173
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   174
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   175
lemma
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   176
  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
   177
  assumes "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   178
  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
   179
    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
   180
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   181
  from assms obtain M L 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   182
    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
   183
    by (auto simp: convergent_prod_altdef)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   184
  note this(2)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   185
  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
   186
    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
   187
  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
   188
    by (intro tendsto_mult tendsto_const)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   189
  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
   190
    by (subst prod.union_disjoint) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   191
  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
   192
  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
   193
    by (rule LIMSEQ_offset)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   194
  thus "convergent (\<lambda>n. \<Prod>i\<le>n. f i)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   195
    by (auto simp: convergent_def)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   196
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   197
  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
   198
  proof
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   199
    assume "\<exists>i. f i = 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   200
    then obtain i where "f i = 0" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   201
    moreover with M have "i < M" by (cases "i < M") auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   202
    ultimately have "(\<Prod>i<M. f i) = 0" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   203
    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
   204
  next
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   205
    assume "(\<lambda>n. \<Prod>i\<le>n. f i) \<longlonglongrightarrow> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   206
    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
   207
    show "\<exists>i. f i = 0" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   208
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   209
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   210
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   211
lemma convergent_prod_iff_nz_lim:
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   212
  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
   213
  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
   214
  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
   215
    (is "?lhs \<longleftrightarrow> ?rhs")
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   216
proof
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   217
  assume ?lhs then show ?rhs
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   218
    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
   219
next
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   220
  assume ?rhs then show ?lhs
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   221
    unfolding prod_defs
68138
c738f40e88d4 auto-tidying
paulson <lp15@cam.ac.uk>
parents: 68136
diff changeset
   222
    by (rule_tac x=0 in exI) auto
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   223
qed
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   224
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70113
diff changeset
   225
lemma\<^marker>\<open>tag important\<close> convergent_prod_iff_convergent: 
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   226
  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
   227
  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
   228
  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"
68138
c738f40e88d4 auto-tidying
paulson <lp15@cam.ac.uk>
parents: 68136
diff changeset
   229
  by (force simp: convergent_prod_iff_nz_lim assms convergent_def limI)
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   230
68527
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68517
diff changeset
   231
lemma bounded_imp_convergent_prod:
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68517
diff changeset
   232
  fixes a :: "nat \<Rightarrow> real"
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68517
diff changeset
   233
  assumes 1: "\<And>n. a n \<ge> 1" and bounded: "\<And>n. (\<Prod>i\<le>n. a i) \<le> B"
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68517
diff changeset
   234
  shows "convergent_prod a"
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68517
diff changeset
   235
proof -
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68517
diff changeset
   236
  have "bdd_above (range(\<lambda>n. \<Prod>i\<le>n. a i))"
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68517
diff changeset
   237
    by (meson bdd_aboveI2 bounded)
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68517
diff changeset
   238
  moreover have "incseq (\<lambda>n. \<Prod>i\<le>n. a i)"
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68517
diff changeset
   239
    unfolding mono_def by (metis 1 prod_mono2 atMost_subset_iff dual_order.trans finite_atMost zero_le_one)
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68517
diff changeset
   240
  ultimately obtain p where p: "(\<lambda>n. \<Prod>i\<le>n. a i) \<longlonglongrightarrow> p"
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68517
diff changeset
   241
    using LIMSEQ_incseq_SUP by blast
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68517
diff changeset
   242
  then have "p \<noteq> 0"
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68517
diff changeset
   243
    by (metis "1" not_one_le_zero prod_ge_1 LIMSEQ_le_const)
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68517
diff changeset
   244
  with 1 p show ?thesis
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68517
diff changeset
   245
    by (metis convergent_prod_iff_nz_lim not_one_le_zero)
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68517
diff changeset
   246
qed
2f4e2aab190a Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents: 68517
diff changeset
   247
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   248
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   249
lemma abs_convergent_prod_altdef:
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   250
  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
   251
  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
   252
proof
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   253
  assume "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   254
  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
   255
    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
   256
qed (auto intro: abs_convergent_prodI)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   257
69529
4ab9657b3257 capitalize proper names in lemma names
nipkow
parents: 68651
diff changeset
   258
lemma Weierstrass_prod_ineq:
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   259
  fixes f :: "'a \<Rightarrow> real" 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   260
  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
   261
  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
   262
  using assms
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   263
proof (induction A rule: infinite_finite_induct)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   264
  case (insert x A)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   265
  from insert.hyps and insert.prems 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   266
    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
   267
    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
   268
  with insert.hyps show ?case by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   269
qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   270
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   271
lemma norm_prod_minus1_le_prod_minus1:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   272
  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
   273
  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
   274
proof (induction A rule: infinite_finite_induct)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   275
  case (insert x A)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   276
  from insert.hyps have 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   277
    "norm ((\<Prod>n\<in>insert x A. 1 + f n) - 1) = 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   278
       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
   279
    by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   280
  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
   281
    by (rule norm_triangle_ineq)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   282
  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
   283
    by (simp add: prod_norm norm_mult)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   284
  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
   285
    by (intro prod_mono norm_triangle_ineq ballI conjI) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   286
  also have "norm (1::'a) = 1" by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   287
  also note insert.IH
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   288
  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
   289
             (\<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
   290
    using insert.hyps by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   291
  finally show ?case by - (simp_all add: mult_left_mono)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   292
qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   293
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   294
lemma convergent_prod_imp_ev_nonzero:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   295
  fixes f :: "nat \<Rightarrow> 'a :: {t2_space,comm_semiring_1}"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   296
  assumes "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   297
  shows   "eventually (\<lambda>n. f n \<noteq> 0) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   298
  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
   299
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   300
lemma convergent_prod_imp_LIMSEQ:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   301
  fixes f :: "nat \<Rightarrow> 'a :: {real_normed_field}"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   302
  assumes "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   303
  shows   "f \<longlonglongrightarrow> 1"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   304
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   305
  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
   306
    by (auto simp: convergent_prod_altdef)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   307
  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
   308
  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
   309
    using L L' by (intro tendsto_divide) simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   310
  also from L have "L / L = 1" by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   311
  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
   312
    using assms L by (auto simp: fun_eq_iff atMost_Suc)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   313
  finally show ?thesis by (rule LIMSEQ_offset)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   314
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   315
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   316
lemma abs_convergent_prod_imp_summable:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   317
  fixes f :: "nat \<Rightarrow> 'a :: real_normed_div_algebra"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   318
  assumes "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   319
  shows "summable (\<lambda>i. norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   320
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   321
  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
   322
    unfolding abs_convergent_prod_def by (rule convergent_prod_imp_convergent)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   323
  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
   324
    unfolding convergent_def by blast
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   325
  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
   326
  proof (rule Bseq_monoseq_convergent)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   327
    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
   328
      using L(1) by (rule order_tendstoD) simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   329
    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
   330
    proof eventually_elim
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   331
      case (elim n)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   332
      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
   333
        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
   334
      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
   335
      also have "\<dots> < L + 1" by (rule elim)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   336
      finally show ?case by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   337
    qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   338
    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
   339
  next
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   340
    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
   341
      by (rule mono_SucI1) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   342
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   343
  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
   344
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   345
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   346
lemma summable_imp_abs_convergent_prod:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   347
  fixes f :: "nat \<Rightarrow> 'a :: real_normed_div_algebra"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   348
  assumes "summable (\<lambda>i. norm (f i - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   349
  shows   "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   350
proof (intro abs_convergent_prodI Bseq_monoseq_convergent)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   351
  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
   352
    by (intro mono_SucI1) 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   353
       (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
   354
next
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   355
  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
   356
  proof (rule Bseq_eventually_mono)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   357
    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
   358
            norm (exp (\<Sum>i\<le>n. norm (f i - 1)))) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   359
      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
   360
  next
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   361
    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
   362
      using sums_def_le by blast
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   363
    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
   364
      by (rule tendsto_exp)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   365
    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
   366
      by (rule convergentI)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   367
    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
   368
      by (rule convergent_imp_Bseq)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   369
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   370
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   371
68651
Manuel Eberl <eberlm@in.tum.de>
parents: 68616
diff changeset
   372
theorem abs_convergent_prod_conv_summable:
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   373
  fixes f :: "nat \<Rightarrow> 'a :: real_normed_div_algebra"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   374
  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
   375
  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
   376
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   377
lemma abs_convergent_prod_imp_LIMSEQ:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   378
  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
   379
  assumes "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   380
  shows   "f \<longlonglongrightarrow> 1"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   381
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   382
  from assms have "summable (\<lambda>n. norm (f n - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   383
    by (rule abs_convergent_prod_imp_summable)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   384
  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
   385
    by (simp add: tendsto_norm_zero_iff)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   386
  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
   387
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   388
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   389
lemma abs_convergent_prod_imp_ev_nonzero:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   390
  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
   391
  assumes "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   392
  shows   "eventually (\<lambda>n. f n \<noteq> 0) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   393
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   394
  from assms have "f \<longlonglongrightarrow> 1" 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   395
    by (rule abs_convergent_prod_imp_LIMSEQ)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   396
  hence "eventually (\<lambda>n. dist (f n) 1 < 1) at_top"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   397
    by (auto simp: tendsto_iff)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   398
  thus ?thesis by eventually_elim auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   399
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   400
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70113
diff changeset
   401
subsection\<^marker>\<open>tag unimportant\<close> \<open>Ignoring initial segments\<close>
68651
Manuel Eberl <eberlm@in.tum.de>
parents: 68616
diff changeset
   402
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   403
lemma convergent_prod_offset:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   404
  assumes "convergent_prod (\<lambda>n. f (n + m))"  
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   405
  shows   "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   406
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   407
  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
   408
    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
   409
  thus "convergent_prod f" 
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   410
    unfolding prod_defs by blast
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   411
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   412
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   413
lemma abs_convergent_prod_offset:
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   414
  assumes "abs_convergent_prod (\<lambda>n. f (n + m))"  
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   415
  shows   "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   416
  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
   417
68424
02e5a44ffe7d the last of the infinite product proofs
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
   418
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   419
lemma raw_has_prod_ignore_initial_segment:
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   420
  fixes f :: "nat \<Rightarrow> 'a :: real_normed_field"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   421
  assumes "raw_has_prod f M p" "N \<ge> M"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   422
  obtains q where  "raw_has_prod f N q"
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   423
proof -
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   424
  have p: "(\<lambda>n. \<Prod>k\<le>n. f (k + M)) \<longlonglongrightarrow> p" and "p \<noteq> 0" 
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   425
    using assms by (auto simp: raw_has_prod_def)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   426
  then have nz: "\<And>n. n \<ge> M \<Longrightarrow> f n \<noteq> 0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   427
    using assms by (auto simp: raw_has_prod_eq_0)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   428
  define C where "C = (\<Prod>k<N-M. f (k + M))"
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   429
  from nz have [simp]: "C \<noteq> 0" 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   430
    by (auto simp: C_def)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   431
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   432
  from p have "(\<lambda>i. \<Prod>k\<le>i + (N-M). f (k + M)) \<longlonglongrightarrow> p" 
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   433
    by (rule LIMSEQ_ignore_initial_segment)
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   434
  also have "(\<lambda>i. \<Prod>k\<le>i + (N-M). f (k + M)) = (\<lambda>n. C * (\<Prod>k\<le>n. f (k + N)))"
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   435
  proof (rule ext, goal_cases)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   436
    case (1 n)
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   437
    have "{..n+(N-M)} = {..<(N-M)} \<union> {(N-M)..n+(N-M)}" by auto
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   438
    also have "(\<Prod>k\<in>\<dots>. f (k + M)) = C * (\<Prod>k=(N-M)..n+(N-M). f (k + M))"
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   439
      unfolding C_def by (rule prod.union_disjoint) auto
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   440
    also have "(\<Prod>k=(N-M)..n+(N-M). f (k + M)) = (\<Prod>k\<le>n. f (k + (N-M) + M))"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   441
      by (intro ext prod.reindex_bij_witness[of _ "\<lambda>k. k + (N-M)" "\<lambda>k. k - (N-M)"]) auto
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   442
    finally show ?case
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   443
      using \<open>N \<ge> M\<close> by (simp add: add_ac)
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   444
  qed
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   445
  finally have "(\<lambda>n. C * (\<Prod>k\<le>n. f (k + N)) / C) \<longlonglongrightarrow> p / C"
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   446
    by (intro tendsto_divide tendsto_const) auto
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   447
  hence "(\<lambda>n. \<Prod>k\<le>n. f (k + N)) \<longlonglongrightarrow> p / C" by simp
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   448
  moreover from \<open>p \<noteq> 0\<close> have "p / C \<noteq> 0" by simp
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   449
  ultimately show ?thesis
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   450
    using raw_has_prod_def that by blast 
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   451
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   452
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70113
diff changeset
   453
corollary\<^marker>\<open>tag unimportant\<close> convergent_prod_ignore_initial_segment:
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   454
  fixes f :: "nat \<Rightarrow> 'a :: real_normed_field"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   455
  assumes "convergent_prod f"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   456
  shows   "convergent_prod (\<lambda>n. f (n + m))"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   457
  using assms
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   458
  unfolding convergent_prod_def 
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   459
  apply clarify
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   460
  apply (erule_tac N="M+m" in raw_has_prod_ignore_initial_segment)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   461
  apply (auto simp add: raw_has_prod_def add_ac)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   462
  done
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   463
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70113
diff changeset
   464
corollary\<^marker>\<open>tag unimportant\<close> convergent_prod_ignore_nonzero_segment:
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   465
  fixes f :: "nat \<Rightarrow> 'a :: real_normed_field"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   466
  assumes f: "convergent_prod f" and nz: "\<And>i. i \<ge> M \<Longrightarrow> f i \<noteq> 0"
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   467
  shows "\<exists>p. raw_has_prod f M p"
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   468
  using convergent_prod_ignore_initial_segment [OF f]
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   469
  by (metis convergent_LIMSEQ_iff convergent_prod_iff_convergent le_add_same_cancel2 nz prod_defs(1) zero_order(1))
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   470
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70113
diff changeset
   471
corollary\<^marker>\<open>tag unimportant\<close> abs_convergent_prod_ignore_initial_segment:
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   472
  assumes "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   473
  shows   "abs_convergent_prod (\<lambda>n. f (n + m))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   474
  using assms unfolding abs_convergent_prod_def 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   475
  by (rule convergent_prod_ignore_initial_segment)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   476
68651
Manuel Eberl <eberlm@in.tum.de>
parents: 68616
diff changeset
   477
subsection\<open>More elementary properties\<close>
Manuel Eberl <eberlm@in.tum.de>
parents: 68616
diff changeset
   478
Manuel Eberl <eberlm@in.tum.de>
parents: 68616
diff changeset
   479
theorem abs_convergent_prod_imp_convergent_prod:
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   480
  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
   481
  assumes "abs_convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   482
  shows   "convergent_prod f"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   483
proof -
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   484
  from assms have "eventually (\<lambda>n. f n \<noteq> 0) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   485
    by (rule abs_convergent_prod_imp_ev_nonzero)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   486
  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
   487
    by (auto simp: eventually_at_top_linorder)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   488
  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
   489
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   490
  have "Cauchy ?P"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   491
  proof (rule CauchyI', goal_cases)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   492
    case (1 \<epsilon>)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   493
    from assms have "abs_convergent_prod (\<lambda>n. f (n + N))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   494
      by (rule abs_convergent_prod_ignore_initial_segment)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   495
    hence "Cauchy ?Q"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   496
      unfolding abs_convergent_prod_def
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   497
      by (intro convergent_Cauchy convergent_prod_imp_convergent)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   498
    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
   499
      by blast
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   500
    show ?case
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   501
    proof (rule exI[of _ M], safe, goal_cases)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   502
      case (1 m n)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   503
      have "dist (?P m) (?P n) = norm (?P n - ?P m)"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   504
        by (simp add: dist_norm norm_minus_commute)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   505
      also from 1 have "{..n} = {..m} \<union> {m<..n}" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   506
      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
   507
        by (subst prod.union_disjoint [symmetric]) (auto simp: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   508
      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
   509
        by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   510
      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
   511
        by (simp add: norm_mult prod_norm)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   512
      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
   513
        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
   514
              norm_triangle_ineq[of 1 "f k - 1" for k]
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   515
        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
   516
      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
   517
        by (simp add: algebra_simps)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   518
      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
   519
                   (\<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
   520
        by (rule prod.union_disjoint [symmetric]) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   521
      also from 1 have "{..m}\<union>{m<..n} = {..n}" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   522
      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
   523
      also from 1 have "\<dots> < \<epsilon>" by (intro M) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   524
      finally show ?case .
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   525
    qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   526
  qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   527
  hence conv: "convergent ?P" by (rule Cauchy_convergent)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   528
  then obtain L where L: "?P \<longlonglongrightarrow> L"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   529
    by (auto simp: convergent_def)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   530
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   531
  have "L \<noteq> 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   532
  proof
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   533
    assume [simp]: "L = 0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   534
    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
   535
      by (simp add: prod_norm)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   536
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   537
    from assms have "(\<lambda>n. f (n + N)) \<longlonglongrightarrow> 1"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   538
      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
   539
    hence "eventually (\<lambda>n. norm (f (n + N) - 1) < 1) sequentially"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   540
      by (auto simp: tendsto_iff dist_norm)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   541
    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
   542
      by (auto simp: eventually_at_top_linorder)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   543
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   544
    {
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   545
      fix M assume M: "M \<ge> M0"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   546
      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
   547
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   548
      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
   549
      proof (rule tendsto_sandwich)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   550
        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
   551
          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
   552
        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
   553
          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
   554
        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
   555
          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
   556
        
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   557
        define C where "C = (\<Prod>k<M. norm (f (k + N)))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   558
        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
   559
        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
   560
          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
   561
        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
   562
        proof (rule ext, goal_cases)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   563
          case (1 n)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   564
          have "{..n+M} = {..<M} \<union> {M..n+M}" by auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   565
          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
   566
            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
   567
          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
   568
            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
   569
          finally show ?case by (simp add: add_ac prod_norm)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   570
        qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   571
        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
   572
          by (intro tendsto_divide tendsto_const) auto
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   573
        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
   574
      qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   575
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   576
      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
   577
      proof (rule tendsto_le)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   578
        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
   579
                                (\<Prod>k\<le>n. 1 - norm (f (k+M+N) - 1))) at_top"
69529
4ab9657b3257 capitalize proper names in lemma names
nipkow
parents: 68651
diff changeset
   580
          using M by (intro always_eventually allI Weierstrass_prod_ineq) (auto intro: less_imp_le)
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   581
        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
   582
        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
   583
                  \<longlonglongrightarrow> 1 - (\<Sum>i. norm (f (i + M + N) - 1))"
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   584
          by (intro tendsto_intros summable_LIMSEQ' summable_ignore_initial_segment 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   585
                abs_convergent_prod_imp_summable assms)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   586
      qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   587
      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
   588
      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
   589
        by (intro suminf_split_initial_segment [symmetric] summable_ignore_initial_segment
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   590
              abs_convergent_prod_imp_summable assms)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   591
      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
   592
    } note * = this
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   593
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   594
    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
   595
    proof (rule tendsto_le)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   596
      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
   597
        by (intro tendsto_intros summable_LIMSEQ summable_ignore_initial_segment 
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   598
                abs_convergent_prod_imp_summable assms)
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   599
      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
   600
        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
   601
    qed simp_all
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   602
    thus False by simp
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   603
  qed
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   604
  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
   605
qed
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   606
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   607
lemma raw_has_prod_cases:
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   608
  fixes f :: "nat \<Rightarrow> 'a :: {idom,topological_semigroup_mult,t2_space}"
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   609
  assumes "raw_has_prod f M p"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   610
  obtains i where "i<M" "f i = 0" | p where "raw_has_prod f 0 p"
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   611
proof -
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   612
  have "(\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> p" "p \<noteq> 0"
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   613
    using assms unfolding raw_has_prod_def by blast+
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   614
  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
   615
    by (metis tendsto_mult_left)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   616
  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
   617
  proof -
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   618
    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
   619
      by auto
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   620
    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
   621
      by simp (subst prod.union_disjoint; force)
68138
c738f40e88d4 auto-tidying
paulson <lp15@cam.ac.uk>
parents: 68136
diff changeset
   622
    also have "\<dots> = prod f {..<M} * (\<Prod>i\<le>n. f (i + M))"
70113
c8deb8ba6d05 Fixing the main Homology theory; also moving a lot of sum/prod lemmas into their generic context
paulson <lp15@cam.ac.uk>
parents: 69565
diff changeset
   623
      by (metis (mono_tags, lifting) add.left_neutral atMost_atLeast0 prod.shift_bounds_cl_nat_ivl)
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   624
    finally show ?thesis by metis
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   625
  qed
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   626
  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
   627
    by (auto intro: LIMSEQ_offset [where k=M])
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   628
  then have "raw_has_prod f 0 (prod f {..<M} * p)" if "\<forall>i<M. f i \<noteq> 0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   629
    using \<open>p \<noteq> 0\<close> assms that by (auto simp: raw_has_prod_def)
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   630
  then show thesis
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   631
    using that by blast
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   632
qed
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   633
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   634
corollary convergent_prod_offset_0:
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   635
  fixes f :: "nat \<Rightarrow> 'a :: {idom,topological_semigroup_mult,t2_space}"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   636
  assumes "convergent_prod f" "\<And>i. f i \<noteq> 0"
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   637
  shows "\<exists>p. raw_has_prod f 0 p"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   638
  using assms convergent_prod_def raw_has_prod_cases by blast
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   639
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   640
lemma prodinf_eq_lim:
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   641
  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
   642
  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
   643
  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
   644
  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
   645
  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
   646
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   647
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
   648
  unfolding prod_defs by auto
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   649
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   650
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
   651
  unfolding prod_defs by auto
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   652
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   653
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
   654
  by presburger
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   655
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   656
lemma convergent_prod_cong:
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   657
  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
   658
  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
   659
  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
   660
proof -
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   661
  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
   662
    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
   663
  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
   664
  with g have "C \<noteq> 0"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   665
    by (simp add: f)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   666
  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
   667
    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
   668
  proof eventually_elim
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   669
    case (elim n)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   670
    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
   671
      by auto
68138
c738f40e88d4 auto-tidying
paulson <lp15@cam.ac.uk>
parents: 68136
diff changeset
   672
    also have "prod f \<dots> = prod f {..<N} * prod f {N..n}"
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   673
      by (intro prod.union_disjoint) auto
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   674
    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
   675
      by (intro prod.cong) simp_all
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   676
    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
   677
      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
   678
    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
   679
      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
   680
    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
   681
      by auto                                                                    
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   682
    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
   683
  qed
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   684
  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
   685
    by (rule convergent_cong)
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   686
  show ?thesis
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   687
  proof
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   688
    assume cf: "convergent_prod f"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   689
    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
   690
      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
   691
    then show "convergent_prod g"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   692
      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
   693
  next
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   694
    assume cg: "convergent_prod g"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   695
    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
   696
      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
   697
    then show "convergent_prod f"
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   698
      using "*" tendsto_mult_left filterlim_cong
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 66277
diff changeset
   699
      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
   700
  qed
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   701
qed
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   702
68071
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   703
lemma has_prod_finite:
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   704
  fixes f :: "nat \<Rightarrow> 'a::{semidom,t2_space}"
68071
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   705
  assumes [simp]: "finite N"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   706
    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
   707
  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
   708
proof -
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   709
  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
   710
  proof (rule prod.mono_neutral_right)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   711
    show "N \<subseteq> {..n + Suc (Max N)}"
68138
c738f40e88d4 auto-tidying
paulson <lp15@cam.ac.uk>
parents: 68136
diff changeset
   712
      by (auto simp: le_Suc_eq trans_le_add2)
68071
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   713
    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
   714
      using f by blast
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   715
  qed auto
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   716
  show ?thesis
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   717
  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
   718
    case True
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   719
    then have "prod f N \<noteq> 0"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   720
      by simp
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   721
    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
   722
      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
   723
    ultimately show ?thesis
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   724
      by (simp add: raw_has_prod_def has_prod_def)
68071
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   725
  next
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   726
    case False
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   727
    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
   728
      by auto
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   729
    let ?Z = "{n \<in> N. f n = 0}"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   730
    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
   731
      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
   732
      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
   733
    let ?q = "prod f {Suc (Max ?Z)..Max N}"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   734
    have [simp]: "?q \<noteq> 0"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   735
      using maxge Suc_n_not_le_n le_trans by force
68076
315043faa871 tidied up Infinite_Products
paulson <lp15@cam.ac.uk>
parents: 68071
diff changeset
   736
    have eq: "(\<Prod>i\<le>n + Max N. f (Suc (i + Max ?Z))) = ?q" for n
315043faa871 tidied up Infinite_Products
paulson <lp15@cam.ac.uk>
parents: 68071
diff changeset
   737
    proof -
315043faa871 tidied up Infinite_Products
paulson <lp15@cam.ac.uk>
parents: 68071
diff changeset
   738
      have "(\<Prod>i\<le>n + Max N. f (Suc (i + Max ?Z))) = prod f {Suc (Max ?Z)..n + Max N + Suc (Max ?Z)}" 
315043faa871 tidied up Infinite_Products
paulson <lp15@cam.ac.uk>
parents: 68071
diff changeset
   739
      proof (rule prod.reindex_cong [where l = "\<lambda>i. i + Suc (Max ?Z)", THEN sym])
315043faa871 tidied up Infinite_Products
paulson <lp15@cam.ac.uk>
parents: 68071
diff changeset
   740
        show "{Suc (Max ?Z)..n + Max N + Suc (Max ?Z)} = (\<lambda>i. i + Suc (Max ?Z)) ` {..n + Max N}"
315043faa871 tidied up Infinite_Products
paulson <lp15@cam.ac.uk>
parents: 68071
diff changeset
   741
          using le_Suc_ex by fastforce
315043faa871 tidied up Infinite_Products
paulson <lp15@cam.ac.uk>
parents: 68071
diff changeset
   742
      qed (auto simp: inj_on_def)
68138
c738f40e88d4 auto-tidying
paulson <lp15@cam.ac.uk>
parents: 68136
diff changeset
   743
      also have "\<dots> = ?q"
68076
315043faa871 tidied up Infinite_Products
paulson <lp15@cam.ac.uk>
parents: 68071
diff changeset
   744
        by (rule prod.mono_neutral_right)
315043faa871 tidied up Infinite_Products
paulson <lp15@cam.ac.uk>
parents: 68071
diff changeset
   745
           (use Max.coboundedI [OF \<open>finite N\<close>] f in \<open>force+\<close>)
315043faa871 tidied up Infinite_Products
paulson <lp15@cam.ac.uk>
parents: 68071
diff changeset
   746
      finally show ?thesis .
315043faa871 tidied up Infinite_Products
paulson <lp15@cam.ac.uk>
parents: 68071
diff changeset
   747
    qed
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   748
    have q: "raw_has_prod f (Suc (Max ?Z)) ?q"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   749
    proof (simp add: raw_has_prod_def)
68076
315043faa871 tidied up Infinite_Products
paulson <lp15@cam.ac.uk>
parents: 68071
diff changeset
   750
      show "(\<lambda>n. \<Prod>i\<le>n. f (Suc (i + Max ?Z))) \<longlonglongrightarrow> ?q"
315043faa871 tidied up Infinite_Products
paulson <lp15@cam.ac.uk>
parents: 68071
diff changeset
   751
        by (rule LIMSEQ_offset[of _ "(Max N)"]) (simp add: eq)
315043faa871 tidied up Infinite_Products
paulson <lp15@cam.ac.uk>
parents: 68071
diff changeset
   752
    qed
68071
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   753
    show ?thesis
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   754
      unfolding has_prod_def
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   755
    proof (intro disjI2 exI conjI)      
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   756
      show "prod f N = 0"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   757
        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
   758
      show "f (Max ?Z) = 0"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   759
        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
   760
    qed (use q in auto)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   761
  qed
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   762
qed
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   763
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70113
diff changeset
   764
corollary\<^marker>\<open>tag unimportant\<close> has_prod_0:
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   765
  fixes f :: "nat \<Rightarrow> 'a::{semidom,t2_space}"
68071
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   766
  assumes "\<And>n. f n = 1"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   767
  shows "f has_prod 1"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   768
  by (simp add: assms has_prod_cong)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   769
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   770
lemma prodinf_zero[simp]: "prodinf (\<lambda>n. 1::'a::real_normed_field) = 1"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   771
  using has_prod_unique by force
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   772
68071
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   773
lemma convergent_prod_finite:
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   774
  fixes f :: "nat \<Rightarrow> 'a::{idom,t2_space}"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   775
  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
   776
  shows "convergent_prod f"
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   777
proof -
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   778
  have "\<exists>n p. raw_has_prod f n p"
68071
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   779
    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
   780
  then show ?thesis
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   781
    by (simp add: convergent_prod_def)
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   782
qed
c18af2b0f83e a lemma about infinite products
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
   783
68127
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   784
lemma has_prod_If_finite_set:
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   785
  fixes f :: "nat \<Rightarrow> 'a::{idom,t2_space}"
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   786
  shows "finite A \<Longrightarrow> (\<lambda>r. if r \<in> A then f r else 1) has_prod (\<Prod>r\<in>A. f r)"
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   787
  using has_prod_finite[of A "(\<lambda>r. if r \<in> A then f r else 1)"]
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   788
  by simp
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   789
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   790
lemma has_prod_If_finite:
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   791
  fixes f :: "nat \<Rightarrow> 'a::{idom,t2_space}"
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   792
  shows "finite {r. P r} \<Longrightarrow> (\<lambda>r. if P r then f r else 1) has_prod (\<Prod>r | P r. f r)"
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   793
  using has_prod_If_finite_set[of "{r. P r}"] by simp
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   794
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   795
lemma convergent_prod_If_finite_set[simp, intro]:
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   796
  fixes f :: "nat \<Rightarrow> 'a::{idom,t2_space}"
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   797
  shows "finite A \<Longrightarrow> convergent_prod (\<lambda>r. if r \<in> A then f r else 1)"
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   798
  by (simp add: convergent_prod_finite)
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   799
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   800
lemma convergent_prod_If_finite[simp, intro]:
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   801
  fixes f :: "nat \<Rightarrow> 'a::{idom,t2_space}"
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   802
  shows "finite {r. P r} \<Longrightarrow> convergent_prod (\<lambda>r. if P r then f r else 1)"
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   803
  using convergent_prod_def has_prod_If_finite has_prod_def by fastforce
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   804
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   805
lemma has_prod_single:
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   806
  fixes f :: "nat \<Rightarrow> 'a::{idom,t2_space}"
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   807
  shows "(\<lambda>r. if r = i then f r else 1) has_prod f i"
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   808
  using has_prod_If_finite[of "\<lambda>r. r = i"] by simp
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   809
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   810
context
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   811
  fixes f :: "nat \<Rightarrow> 'a :: real_normed_field"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   812
begin
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   813
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   814
lemma convergent_prod_imp_has_prod: 
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   815
  assumes "convergent_prod f"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   816
  shows "\<exists>p. f has_prod p"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   817
proof -
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   818
  obtain M p where p: "raw_has_prod f M p"
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   819
    using assms convergent_prod_def by blast
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   820
  then have "p \<noteq> 0"
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   821
    using raw_has_prod_nonzero by blast
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   822
  with p have fnz: "f i \<noteq> 0" if "i \<ge> M" for i
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   823
    using raw_has_prod_eq_0 that by blast
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   824
  define C where "C = (\<Prod>n<M. f n)"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   825
  show ?thesis
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   826
  proof (cases "\<forall>n\<le>M. f n \<noteq> 0")
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   827
    case True
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   828
    then have "C \<noteq> 0"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   829
      by (simp add: C_def)
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   830
    then show ?thesis
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   831
      by (meson True assms convergent_prod_offset_0 fnz has_prod_def nat_le_linear)
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   832
  next
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   833
    case False
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   834
    let ?N = "GREATEST n. f n = 0"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   835
    have 0: "f ?N = 0"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   836
      using fnz False
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   837
      by (metis (mono_tags, lifting) GreatestI_ex_nat nat_le_linear)
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   838
    have "f i \<noteq> 0" if "i > ?N" for i
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   839
      by (metis (mono_tags, lifting) Greatest_le_nat fnz leD linear that)
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   840
    then have "\<exists>p. raw_has_prod f (Suc ?N) p"
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   841
      using assms by (auto simp: intro!: convergent_prod_ignore_nonzero_segment)
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   842
    then show ?thesis
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   843
      unfolding has_prod_def using 0 by blast
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   844
  qed
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   845
qed
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   846
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   847
lemma convergent_prod_has_prod [intro]:
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   848
  shows "convergent_prod f \<Longrightarrow> f has_prod (prodinf f)"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   849
  unfolding prodinf_def
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   850
  by (metis convergent_prod_imp_has_prod has_prod_unique theI')
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   851
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   852
lemma convergent_prod_LIMSEQ:
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   853
  shows "convergent_prod f \<Longrightarrow> (\<lambda>n. \<Prod>i\<le>n. f i) \<longlonglongrightarrow> prodinf f"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   854
  by (metis convergent_LIMSEQ_iff convergent_prod_has_prod convergent_prod_imp_convergent 
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   855
      convergent_prod_to_zero_iff raw_has_prod_eq_0 has_prod_def prodinf_eq_lim zero_le)
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   856
68651
Manuel Eberl <eberlm@in.tum.de>
parents: 68616
diff changeset
   857
theorem has_prod_iff: "f has_prod x \<longleftrightarrow> convergent_prod f \<and> prodinf f = x"
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   858
proof
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   859
  assume "f has_prod x"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   860
  then show "convergent_prod f \<and> prodinf f = x"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   861
    apply safe
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   862
    using convergent_prod_def has_prod_def apply blast
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   863
    using has_prod_unique by blast
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   864
qed auto
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   865
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   866
lemma convergent_prod_has_prod_iff: "convergent_prod f \<longleftrightarrow> f has_prod prodinf f"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   867
  by (auto simp: has_prod_iff convergent_prod_has_prod)
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   868
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   869
lemma prodinf_finite:
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   870
  assumes N: "finite N"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   871
    and f: "\<And>n. n \<notin> N \<Longrightarrow> f n = 1"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   872
  shows "prodinf f = (\<Prod>n\<in>N. f n)"
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   873
  using has_prod_finite[OF assms, THEN has_prod_unique] by simp
68127
137d5d0112bb more infinite product theorems
paulson <lp15@cam.ac.uk>
parents: 68076
diff changeset
   874
66277
512b0dc09061 HOL-Analysis: Infinite products
eberlm <eberlm@in.tum.de>
parents:
diff changeset
   875
end
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   876
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70113
diff changeset
   877
subsection\<^marker>\<open>tag unimportant\<close> \<open>Infinite products on ordered topological monoids\<close>
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   878
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   879
lemma LIMSEQ_prod_0: 
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   880
  fixes f :: "nat \<Rightarrow> 'a::{semidom,topological_space}"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   881
  assumes "f i = 0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   882
  shows "(\<lambda>n. prod f {..n}) \<longlonglongrightarrow> 0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   883
proof (subst tendsto_cong)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   884
  show "\<forall>\<^sub>F n in sequentially. prod f {..n} = 0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   885
  proof
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   886
    show "prod f {..n} = 0" if "n \<ge> i" for n
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   887
      using that assms by auto
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   888
  qed
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   889
qed auto
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   890
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   891
lemma LIMSEQ_prod_nonneg: 
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   892
  fixes f :: "nat \<Rightarrow> 'a::{linordered_semidom,linorder_topology}"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   893
  assumes 0: "\<And>n. 0 \<le> f n" and a: "(\<lambda>n. prod f {..n}) \<longlonglongrightarrow> a"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   894
  shows "a \<ge> 0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   895
  by (simp add: "0" prod_nonneg LIMSEQ_le_const [OF a])
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   896
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   897
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   898
context
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   899
  fixes f :: "nat \<Rightarrow> 'a::{linordered_semidom,linorder_topology}"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   900
begin
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   901
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   902
lemma has_prod_le:
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   903
  assumes f: "f has_prod a" and g: "g has_prod b" and le: "\<And>n. 0 \<le> f n \<and> f n \<le> g n"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   904
  shows "a \<le> b"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   905
proof (cases "a=0 \<or> b=0")
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   906
  case True
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   907
  then show ?thesis
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   908
  proof
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   909
    assume [simp]: "a=0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   910
    have "b \<ge> 0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   911
    proof (rule LIMSEQ_prod_nonneg)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   912
      show "(\<lambda>n. prod g {..n}) \<longlonglongrightarrow> b"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   913
        using g by (auto simp: has_prod_def raw_has_prod_def LIMSEQ_prod_0)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   914
    qed (use le order_trans in auto)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   915
    then show ?thesis
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   916
      by auto
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   917
  next
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   918
    assume [simp]: "b=0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   919
    then obtain i where "g i = 0"    
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   920
      using g by (auto simp: prod_defs)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   921
    then have "f i = 0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   922
      using antisym le by force
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   923
    then have "a=0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   924
      using f by (auto simp: prod_defs LIMSEQ_prod_0 LIMSEQ_unique)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   925
    then show ?thesis
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   926
      by auto
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   927
  qed
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   928
next
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   929
  case False
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   930
  then show ?thesis
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   931
    using assms
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   932
    unfolding has_prod_def raw_has_prod_def
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   933
    by (force simp: LIMSEQ_prod_0 intro!: LIMSEQ_le prod_mono)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   934
qed
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   935
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   936
lemma prodinf_le: 
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   937
  assumes f: "f has_prod a" and g: "g has_prod b" and le: "\<And>n. 0 \<le> f n \<and> f n \<le> g n"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   938
  shows "prodinf f \<le> prodinf g"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   939
  using has_prod_le [OF assms] has_prod_unique f g  by blast
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   940
68136
f022083489d0 more on infinite products
paulson <lp15@cam.ac.uk>
parents: 68127
diff changeset
   941
end
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   942
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   943
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   944
lemma prod_le_prodinf: 
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   945
  fixes f :: "nat \<Rightarrow> 'a::{linordered_idom,linorder_topology}"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   946
  assumes "f has_prod a" "\<And>i. 0 \<le> f i" "\<And>i. i\<ge>n \<Longrightarrow> 1 \<le> f i"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   947
  shows "prod f {..<n} \<le> prodinf f"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   948
  by(rule has_prod_le[OF has_prod_If_finite_set]) (use assms has_prod_unique in auto)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   949
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   950
lemma prodinf_nonneg:
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   951
  fixes f :: "nat \<Rightarrow> 'a::{linordered_idom,linorder_topology}"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   952
  assumes "f has_prod a" "\<And>i. 1 \<le> f i" 
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   953
  shows "1 \<le> prodinf f"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   954
  using prod_le_prodinf[of f a 0] assms
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   955
  by (metis order_trans prod_ge_1 zero_le_one)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   956
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   957
lemma prodinf_le_const:
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   958
  fixes f :: "nat \<Rightarrow> real"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   959
  assumes "convergent_prod f" "\<And>n. prod f {..<n} \<le> x" 
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   960
  shows "prodinf f \<le> x"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   961
  by (metis lessThan_Suc_atMost assms convergent_prod_LIMSEQ LIMSEQ_le_const2)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   962
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   963
lemma prodinf_eq_one_iff: 
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   964
  fixes f :: "nat \<Rightarrow> real"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   965
  assumes f: "convergent_prod f" and ge1: "\<And>n. 1 \<le> f n"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   966
  shows "prodinf f = 1 \<longleftrightarrow> (\<forall>n. f n = 1)"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   967
proof
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   968
  assume "prodinf f = 1" 
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   969
  then have "(\<lambda>n. \<Prod>i<n. f i) \<longlonglongrightarrow> 1"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   970
    using convergent_prod_LIMSEQ[of f] assms by (simp add: LIMSEQ_lessThan_iff_atMost)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   971
  then have "\<And>i. (\<Prod>n\<in>{i}. f n) \<le> 1"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   972
  proof (rule LIMSEQ_le_const)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   973
    have "1 \<le> prod f n" for n
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   974
      by (simp add: ge1 prod_ge_1)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   975
    have "prod f {..<n} = 1" for n
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   976
      by (metis \<open>\<And>n. 1 \<le> prod f n\<close> \<open>prodinf f = 1\<close> antisym f convergent_prod_has_prod ge1 order_trans prod_le_prodinf zero_le_one)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   977
    then have "(\<Prod>n\<in>{i}. f n) \<le> prod f {..<n}" if "n \<ge> Suc i" for i n
70113
c8deb8ba6d05 Fixing the main Homology theory; also moving a lot of sum/prod lemmas into their generic context
paulson <lp15@cam.ac.uk>
parents: 69565
diff changeset
   978
      by (metis mult.left_neutral order_refl prod.cong prod.neutral_const prod.lessThan_Suc)
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   979
    then show "\<exists>N. \<forall>n\<ge>N. (\<Prod>n\<in>{i}. f n) \<le> prod f {..<n}" for i
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   980
      by blast      
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   981
  qed
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   982
  with ge1 show "\<forall>n. f n = 1"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   983
    by (auto intro!: antisym)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   984
qed (metis prodinf_zero fun_eq_iff)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   985
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   986
lemma prodinf_pos_iff:
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   987
  fixes f :: "nat \<Rightarrow> real"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   988
  assumes "convergent_prod f" "\<And>n. 1 \<le> f n"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   989
  shows "1 < prodinf f \<longleftrightarrow> (\<exists>i. 1 < f i)"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   990
  using prod_le_prodinf[of f 1] prodinf_eq_one_iff
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   991
  by (metis convergent_prod_has_prod assms less_le prodinf_nonneg)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   992
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   993
lemma less_1_prodinf2:
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   994
  fixes f :: "nat \<Rightarrow> real"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   995
  assumes "convergent_prod f" "\<And>n. 1 \<le> f n" "1 < f i"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   996
  shows "1 < prodinf f"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   997
proof -
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   998
  have "1 < (\<Prod>n<Suc i. f n)"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
   999
    using assms  by (intro less_1_prod2[where i=i]) auto
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1000
  also have "\<dots> \<le> prodinf f"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1001
    by (intro prod_le_prodinf) (use assms order_trans zero_le_one in \<open>blast+\<close>)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1002
  finally show ?thesis .
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1003
qed
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1004
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1005
lemma less_1_prodinf:
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1006
  fixes f :: "nat \<Rightarrow> real"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1007
  shows "\<lbrakk>convergent_prod f; \<And>n. 1 < f n\<rbrakk> \<Longrightarrow> 1 < prodinf f"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1008
  by (intro less_1_prodinf2[where i=1]) (auto intro: less_imp_le)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1009
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1010
lemma prodinf_nonzero:
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1011
  fixes f :: "nat \<Rightarrow> 'a :: {idom,topological_semigroup_mult,t2_space}"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1012
  assumes "convergent_prod f" "\<And>i. f i \<noteq> 0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1013
  shows "prodinf f \<noteq> 0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1014
  by (metis assms convergent_prod_offset_0 has_prod_unique raw_has_prod_def has_prod_def)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1015
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1016
lemma less_0_prodinf:
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1017
  fixes f :: "nat \<Rightarrow> real"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1018
  assumes f: "convergent_prod f" and 0: "\<And>i. f i > 0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1019
  shows "0 < prodinf f"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1020
proof -
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1021
  have "prodinf f \<noteq> 0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1022
    by (metis assms less_irrefl prodinf_nonzero)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1023
  moreover have "0 < (\<Prod>n<i. f n)" for i
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1024
    by (simp add: 0 prod_pos)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1025
  then have "prodinf f \<ge> 0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1026
    using convergent_prod_LIMSEQ [OF f] LIMSEQ_prod_nonneg 0 less_le by blast
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1027
  ultimately show ?thesis
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1028
    by auto
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1029
qed
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1030
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1031
lemma prod_less_prodinf2:
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1032
  fixes f :: "nat \<Rightarrow> real"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1033
  assumes f: "convergent_prod f" and 1: "\<And>m. m\<ge>n \<Longrightarrow> 1 \<le> f m" and 0: "\<And>m. 0 < f m" and i: "n \<le> i" "1 < f i"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1034
  shows "prod f {..<n} < prodinf f"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1035
proof -
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1036
  have "prod f {..<n} \<le> prod f {..<i}"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1037
    by (rule prod_mono2) (use assms less_le in auto)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1038
  then have "prod f {..<n} < f i * prod f {..<i}"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1039
    using mult_less_le_imp_less[of 1 "f i" "prod f {..<n}" "prod f {..<i}"] assms
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1040
    by (simp add: prod_pos)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1041
  moreover have "prod f {..<Suc i} \<le> prodinf f"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1042
    using prod_le_prodinf[of f _ "Suc i"]
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1043
    by (meson "0" "1" Suc_leD convergent_prod_has_prod f \<open>n \<le> i\<close> le_trans less_eq_real_def)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1044
  ultimately show ?thesis
70113
c8deb8ba6d05 Fixing the main Homology theory; also moving a lot of sum/prod lemmas into their generic context
paulson <lp15@cam.ac.uk>
parents: 69565
diff changeset
  1045
    by (metis le_less_trans mult.commute not_le prod.lessThan_Suc)
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1046
qed
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1047
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1048
lemma prod_less_prodinf:
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1049
  fixes f :: "nat \<Rightarrow> real"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1050
  assumes f: "convergent_prod f" and 1: "\<And>m. m\<ge>n \<Longrightarrow> 1 < f m" and 0: "\<And>m. 0 < f m" 
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1051
  shows "prod f {..<n} < prodinf f"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1052
  by (meson "0" "1" f le_less prod_less_prodinf2)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1053
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1054
lemma raw_has_prodI_bounded:
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1055
  fixes f :: "nat \<Rightarrow> real"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1056
  assumes pos: "\<And>n. 1 \<le> f n"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1057
    and le: "\<And>n. (\<Prod>i<n. f i) \<le> x"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1058
  shows "\<exists>p. raw_has_prod f 0 p"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1059
  unfolding raw_has_prod_def add_0_right
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1060
proof (rule exI LIMSEQ_incseq_SUP conjI)+
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1061
  show "bdd_above (range (\<lambda>n. prod f {..n}))"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1062
    by (metis bdd_aboveI2 le lessThan_Suc_atMost)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1063
  then have "(SUP i. prod f {..i}) > 0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1064
    by (metis UNIV_I cSUP_upper less_le_trans pos prod_pos zero_less_one)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1065
  then show "(SUP i. prod f {..i}) \<noteq> 0"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1066
    by auto
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1067
  show "incseq (\<lambda>n. prod f {..n})"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1068
    using pos order_trans [OF zero_le_one] by (auto simp: mono_def intro!: prod_mono2)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1069
qed
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1070
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1071
lemma convergent_prodI_nonneg_bounded:
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1072
  fixes f :: "nat \<Rightarrow> real"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1073
  assumes "\<And>n. 1 \<le> f n" "\<And>n. (\<Prod>i<n. f i) \<le> x"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1074
  shows "convergent_prod f"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1075
  using convergent_prod_def raw_has_prodI_bounded [OF assms] by blast
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1076
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1077
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 70113
diff changeset
  1078
subsection\<^marker>\<open>tag unimportant\<close> \<open>Infinite products on topological spaces\<close>
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1079
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1080
context
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1081
  fixes f g :: "nat \<Rightarrow> 'a::{t2_space,topological_semigroup_mult,idom}"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1082
begin
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1083
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1084
lemma raw_has_prod_mult: "\<lbrakk>raw_has_prod f M a; raw_has_prod g M b\<rbrakk> \<Longrightarrow> raw_has_prod (\<lambda>n. f n * g n) M (a * b)"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1085
  by (force simp add: prod.distrib tendsto_mult raw_has_prod_def)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1086
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1087
lemma has_prod_mult_nz: "\<lbrakk>f has_prod a; g has_prod b; a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> (\<lambda>n. f n * g n) has_prod (a * b)"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1088
  by (simp add: raw_has_prod_mult has_prod_def)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1089
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1090
end
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1091
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1092
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1093
context
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1094
  fixes f g :: "nat \<Rightarrow> 'a::real_normed_field"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1095
begin
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1096
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1097
lemma has_prod_mult:
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1098
  assumes f: "f has_prod a" and g: "g has_prod b"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1099
  shows "(\<lambda>n. f n * g n) has_prod (a * b)"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1100
  using f [unfolded has_prod_def]
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1101
proof (elim disjE exE conjE)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1102
  assume f0: "raw_has_prod f 0 a"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1103
  show ?thesis
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1104
    using g [unfolded has_prod_def]
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1105
  proof (elim disjE exE conjE)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1106
    assume g0: "raw_has_prod g 0 b"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1107
    with f0 show ?thesis
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1108
      by (force simp add: has_prod_def prod.distrib tendsto_mult raw_has_prod_def)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1109
  next
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1110
    fix j q
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1111
    assume "b = 0" and "g j = 0" and q: "raw_has_prod g (Suc j) q"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1112
    obtain p where p: "raw_has_prod f (Suc j) p"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1113
      using f0 raw_has_prod_ignore_initial_segment by blast
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1114
    then have "Ex (raw_has_prod (\<lambda>n. f n * g n) (Suc j))"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1115
      using q raw_has_prod_mult by blast
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1116
    then show ?thesis
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1117
      using \<open>b = 0\<close> \<open>g j = 0\<close> has_prod_0_iff by fastforce
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1118
  qed
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1119
next
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1120
  fix i p
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1121
  assume "a = 0" and "f i = 0" and p: "raw_has_prod f (Suc i) p"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1122
  show ?thesis
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1123
    using g [unfolded has_prod_def]
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1124
  proof (elim disjE exE conjE)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1125
    assume g0: "raw_has_prod g 0 b"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1126
    obtain q where q: "raw_has_prod g (Suc i) q"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1127
      using g0 raw_has_prod_ignore_initial_segment by blast
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1128
    then have "Ex (raw_has_prod (\<lambda>n. f n * g n) (Suc i))"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1129
      using raw_has_prod_mult p by blast
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1130
    then show ?thesis
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1131
      using \<open>a = 0\<close> \<open>f i = 0\<close> has_prod_0_iff by fastforce
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1132
  next
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1133
    fix j q
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1134
    assume "b = 0" and "g j = 0" and q: "raw_has_prod g (Suc j) q"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1135
    obtain p' where p': "raw_has_prod f (Suc (max i j)) p'"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1136
      by (metis raw_has_prod_ignore_initial_segment max_Suc_Suc max_def p)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1137
    moreover
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1138
    obtain q' where q': "raw_has_prod g (Suc (max i j)) q'"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1139
      by (metis raw_has_prod_ignore_initial_segment max.cobounded2 max_Suc_Suc q)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1140
    ultimately show ?thesis
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1141
      using \<open>b = 0\<close> by (simp add: has_prod_def) (metis \<open>f i = 0\<close> \<open>g j = 0\<close> raw_has_prod_mult max_def)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1142
  qed
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1143
qed
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1144
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1145
lemma convergent_prod_mult:
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1146
  assumes f: "convergent_prod f" and g: "convergent_prod g"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1147
  shows "convergent_prod (\<lambda>n. f n * g n)"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1148
  unfolding convergent_prod_def
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1149
proof -
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1150
  obtain M p N q where p: "raw_has_prod f M p" and q: "raw_has_prod g N q"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1151
    using convergent_prod_def f g by blast+
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1152
  then obtain p' q' where p': "raw_has_prod f (max M N) p'" and q': "raw_has_prod g (max M N) q'"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1153
    by (meson raw_has_prod_ignore_initial_segment max.cobounded1 max.cobounded2)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1154
  then show "\<exists>M p. raw_has_prod (\<lambda>n. f n * g n) M p"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1155
    using raw_has_prod_mult by blast
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1156
qed
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1157
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1158
lemma prodinf_mult: "convergent_prod f \<Longrightarrow> convergent_prod g \<Longrightarrow> prodinf f * prodinf g = (\<Prod>n. f n * g n)"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68138
diff changeset
  1159
  by (intro has_prod_unique has_prod_mult convergent_prod_has_prod)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: