| author | paulson <lp15@cam.ac.uk> | 
| Tue, 02 Nov 2021 17:01:47 +0000 | |
| changeset 74668 | 2d9d02beaf96 | 
| parent 73466 | ee1c4962671c | 
| child 75711 | 32d45952c12d | 
| permissions | -rw-r--r-- | 
| 
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 | 3  | 
|
4  | 
Basic results about convergence and absolute convergence of infinite products  | 
|
5  | 
and their connection to summability.  | 
|
6  | 
*)  | 
|
7  | 
section \<open>Infinite Products\<close>  | 
|
8  | 
theory Infinite_Products  | 
|
| 68585 | 9  | 
imports Topology_Euclidean_Space Complex_Transcendental  | 
| 66277 | 10  | 
begin  | 
| 
68424
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
11  | 
|
| 70136 | 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 | 14  | 
lemma sum_le_prod:  | 
15  | 
fixes f :: "'a \<Rightarrow> 'b :: linordered_semidom"  | 
|
16  | 
assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0"  | 
|
17  | 
shows "sum f A \<le> (\<Prod>x\<in>A. 1 + f x)"  | 
|
18  | 
using assms  | 
|
19  | 
proof (induction A rule: infinite_finite_induct)  | 
|
20  | 
case (insert x A)  | 
|
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)"  | 
|
22  | 
by (intro add_mono insert mult_left_mono prod_mono) (auto intro: insert.prems)  | 
|
23  | 
with insert.hyps show ?case by (simp add: algebra_simps)  | 
|
24  | 
qed simp_all  | 
|
25  | 
||
26  | 
lemma prod_le_exp_sum:  | 
|
27  | 
fixes f :: "'a \<Rightarrow> real"  | 
|
28  | 
assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0"  | 
|
29  | 
shows "prod (\<lambda>x. 1 + f x) A \<le> exp (sum f A)"  | 
|
30  | 
using assms  | 
|
31  | 
proof (induction A rule: infinite_finite_induct)  | 
|
32  | 
case (insert x A)  | 
|
33  | 
have "(1 + f x) * (\<Prod>x\<in>A. 1 + f x) \<le> exp (f x) * exp (sum f A)"  | 
|
34  | 
using insert.prems by (intro mult_mono insert prod_nonneg exp_ge_add_one_self) auto  | 
|
35  | 
with insert.hyps show ?case by (simp add: algebra_simps exp_add)  | 
|
36  | 
qed simp_all  | 
|
37  | 
||
38  | 
lemma lim_ln_1_plus_x_over_x_at_0: "(\<lambda>x::real. ln (1 + x) / x) \<midarrow>0\<rightarrow> 1"  | 
|
39  | 
proof (rule lhopital)  | 
|
40  | 
show "(\<lambda>x::real. ln (1 + x)) \<midarrow>0\<rightarrow> 0"  | 
|
41  | 
by (rule tendsto_eq_intros refl | simp)+  | 
|
42  | 
  have "eventually (\<lambda>x::real. x \<in> {-1/2<..<1/2}) (nhds 0)"
 | 
|
43  | 
by (rule eventually_nhds_in_open) auto  | 
|
44  | 
  hence *: "eventually (\<lambda>x::real. x \<in> {-1/2<..<1/2}) (at 0)"
 | 
|
45  | 
by (rule filter_leD [rotated]) (simp_all add: at_within_def)  | 
|
46  | 
show "eventually (\<lambda>x::real. ((\<lambda>x. ln (1 + x)) has_field_derivative inverse (1 + x)) (at x)) (at 0)"  | 
|
47  | 
using * by eventually_elim (auto intro!: derivative_eq_intros simp: field_simps)  | 
|
48  | 
show "eventually (\<lambda>x::real. ((\<lambda>x. x) has_field_derivative 1) (at x)) (at 0)"  | 
|
49  | 
using * by eventually_elim (auto intro!: derivative_eq_intros simp: field_simps)  | 
|
50  | 
show "\<forall>\<^sub>F x in at 0. x \<noteq> 0" by (auto simp: at_within_def eventually_inf_principal)  | 
|
51  | 
show "(\<lambda>x::real. inverse (1 + x) / 1) \<midarrow>0\<rightarrow> 1"  | 
|
52  | 
by (rule tendsto_eq_intros refl | simp)+  | 
|
53  | 
qed auto  | 
|
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 | 57  | 
definition\<^marker>\<open>tag important\<close> raw_has_prod :: "[nat \<Rightarrow> 'a::{t2_space, comm_semiring_1}, nat, 'a] \<Rightarrow> bool" 
 | 
| 68361 | 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 | 61  | 
text\<^marker>\<open>tag important\<close> \<open>%whitespace\<close>  | 
62  | 
definition\<^marker>\<open>tag important\<close>  | 
|
| 68651 | 63  | 
  has_prod :: "(nat \<Rightarrow> 'a::{t2_space, comm_semiring_1}) \<Rightarrow> 'a \<Rightarrow> bool" (infixr "has'_prod" 80)
 | 
| 68361 | 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 | 66  | 
definition\<^marker>\<open>tag important\<close> convergent_prod :: "(nat \<Rightarrow> 'a :: {t2_space,comm_semiring_1}) \<Rightarrow> bool" where
 | 
| 68361 | 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 | 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 | 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 | 80  | 
|
| 68361 | 81  | 
lemma raw_has_prod_nonzero [simp]: "\<not> raw_has_prod f M 0"  | 
82  | 
by (simp add: raw_has_prod_def)  | 
|
| 68071 | 83  | 
|
| 68361 | 84  | 
lemma raw_has_prod_eq_0:  | 
85  | 
  fixes f :: "nat \<Rightarrow> 'a::{semidom,t2_space}"
 | 
|
86  | 
assumes p: "raw_has_prod f m p" and i: "f i = 0" "i \<ge> m"  | 
|
| 68136 | 87  | 
shows "p = 0"  | 
88  | 
proof -  | 
|
89  | 
have eq0: "(\<Prod>k\<le>n. f (k+m)) = 0" if "i - m \<le> n" for n  | 
|
| 68361 | 90  | 
proof -  | 
91  | 
have "\<exists>k\<le>n. f (k + m) = 0"  | 
|
92  | 
using i that by auto  | 
|
93  | 
then show ?thesis  | 
|
94  | 
by auto  | 
|
95  | 
qed  | 
|
| 68136 | 96  | 
have "(\<lambda>n. \<Prod>i\<le>n. f (i + m)) \<longlonglongrightarrow> 0"  | 
97  | 
by (rule LIMSEQ_offset [where k = "i-m"]) (simp add: eq0)  | 
|
98  | 
with p show ?thesis  | 
|
| 68361 | 99  | 
unfolding raw_has_prod_def  | 
| 68136 | 100  | 
using LIMSEQ_unique by blast  | 
101  | 
qed  | 
|
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 | 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 | 108  | 
by (simp add: has_prod_def)  | 
| 68136 | 109  | 
|
110  | 
lemma has_prod_unique2:  | 
|
| 68361 | 111  | 
  fixes f :: "nat \<Rightarrow> 'a::{semidom,t2_space}"
 | 
| 68136 | 112  | 
assumes "f has_prod a" "f has_prod b" shows "a = b"  | 
113  | 
using assms  | 
|
| 68361 | 114  | 
by (auto simp: has_prod_def raw_has_prod_eq_0) (meson raw_has_prod_def sequentially_bot tendsto_unique)  | 
| 68136 | 115  | 
|
116  | 
lemma has_prod_unique:  | 
|
| 68361 | 117  | 
  fixes f :: "nat \<Rightarrow> 'a :: {semidom,t2_space}"
 | 
| 68136 | 118  | 
shows "f has_prod s \<Longrightarrow> s = prodinf f"  | 
119  | 
by (simp add: has_prod_unique2 prodinf_def the_equality)  | 
|
| 68071 | 120  | 
|
| 66277 | 121  | 
lemma convergent_prod_altdef:  | 
122  | 
  fixes f :: "nat \<Rightarrow> 'a :: {t2_space,comm_semiring_1}"
 | 
|
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)"  | 
|
124  | 
proof  | 
|
125  | 
assume "convergent_prod f"  | 
|
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 | 128  | 
have "f i \<noteq> 0" if "i \<ge> M" for i  | 
129  | 
proof  | 
|
130  | 
assume "f i = 0"  | 
|
131  | 
have **: "eventually (\<lambda>n. (\<Prod>i\<le>n. f (i+M)) = 0) sequentially"  | 
|
132  | 
using eventually_ge_at_top[of "i - M"]  | 
|
133  | 
proof eventually_elim  | 
|
134  | 
case (elim n)  | 
|
135  | 
with \<open>f i = 0\<close> and \<open>i \<ge> M\<close> show ?case  | 
|
136  | 
by (auto intro!: bexI[of _ "i - M"] prod_zero)  | 
|
137  | 
qed  | 
|
138  | 
have "(\<lambda>n. (\<Prod>i\<le>n. f (i+M))) \<longlonglongrightarrow> 0"  | 
|
139  | 
unfolding filterlim_iff  | 
|
140  | 
by (auto dest!: eventually_nhds_x_imp_x intro!: eventually_mono[OF **])  | 
|
141  | 
from tendsto_unique[OF _ this *(1)] and *(2)  | 
|
142  | 
show False by simp  | 
|
143  | 
qed  | 
|
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)"  | 
|
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 | 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 | 151  | 
definition\<^marker>\<open>tag important\<close> abs_convergent_prod :: "(nat \<Rightarrow> _) \<Rightarrow> bool" where  | 
| 66277 | 152  | 
"abs_convergent_prod f \<longleftrightarrow> convergent_prod (\<lambda>i. 1 + norm (f i - 1))"  | 
153  | 
||
154  | 
lemma abs_convergent_prodI:  | 
|
155  | 
assumes "convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"  | 
|
156  | 
shows "abs_convergent_prod f"  | 
|
157  | 
proof -  | 
|
158  | 
from assms obtain L where L: "(\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1)) \<longlonglongrightarrow> L"  | 
|
159  | 
by (auto simp: convergent_def)  | 
|
160  | 
have "L \<ge> 1"  | 
|
161  | 
proof (rule tendsto_le)  | 
|
162  | 
show "eventually (\<lambda>n. (\<Prod>i\<le>n. 1 + norm (f i - 1)) \<ge> 1) sequentially"  | 
|
163  | 
proof (intro always_eventually allI)  | 
|
164  | 
fix n  | 
|
165  | 
have "(\<Prod>i\<le>n. 1 + norm (f i - 1)) \<ge> (\<Prod>i\<le>n. 1)"  | 
|
166  | 
by (intro prod_mono) auto  | 
|
167  | 
thus "(\<Prod>i\<le>n. 1 + norm (f i - 1)) \<ge> 1" by simp  | 
|
168  | 
qed  | 
|
169  | 
qed (use L in simp_all)  | 
|
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 | 172  | 
by (intro exI[of _ "0::nat"] exI[of _ L]) auto  | 
173  | 
qed  | 
|
174  | 
||
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 | 177  | 
assumes "convergent_prod f"  | 
| 
73005
 
83b114a6545f
A few more simprules for iff-reasoning
 
paulson <lp15@cam.ac.uk> 
parents: 
73004 
diff
changeset
 | 
178  | 
shows convergent_prod_imp_convergent: "convergent (\<lambda>n. \<Prod>i\<le>n. f i)"  | 
| 
 
83b114a6545f
A few more simprules for iff-reasoning
 
paulson <lp15@cam.ac.uk> 
parents: 
73004 
diff
changeset
 | 
179  | 
and convergent_prod_to_zero_iff [simp]: "(\<lambda>n. \<Prod>i\<le>n. f i) \<longlonglongrightarrow> 0 \<longleftrightarrow> (\<exists>i. f i = 0)"  | 
| 66277 | 180  | 
proof -  | 
181  | 
from assms obtain M L  | 
|
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"  | 
|
183  | 
by (auto simp: convergent_prod_altdef)  | 
|
184  | 
note this(2)  | 
|
185  | 
also have "(\<lambda>n. \<Prod>i\<le>n. f (i + M)) = (\<lambda>n. \<Prod>i=M..M+n. f i)"  | 
|
186  | 
by (intro ext prod.reindex_bij_witness[of _ "\<lambda>n. n - M" "\<lambda>n. n + M"]) auto  | 
|
187  | 
finally have "(\<lambda>n. (\<Prod>i<M. f i) * (\<Prod>i=M..M+n. f i)) \<longlonglongrightarrow> (\<Prod>i<M. f i) * L"  | 
|
188  | 
by (intro tendsto_mult tendsto_const)  | 
|
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))"
 | 
|
190  | 
by (subst prod.union_disjoint) auto  | 
|
191  | 
  also have "(\<lambda>n. {..<M} \<union> {M..M+n}) = (\<lambda>n. {..n+M})" by auto
 | 
|
192  | 
  finally have lim: "(\<lambda>n. prod f {..n}) \<longlonglongrightarrow> prod f {..<M} * L" 
 | 
|
193  | 
by (rule LIMSEQ_offset)  | 
|
194  | 
thus "convergent (\<lambda>n. \<Prod>i\<le>n. f i)"  | 
|
195  | 
by (auto simp: convergent_def)  | 
|
196  | 
||
197  | 
show "(\<lambda>n. \<Prod>i\<le>n. f i) \<longlonglongrightarrow> 0 \<longleftrightarrow> (\<exists>i. f i = 0)"  | 
|
198  | 
proof  | 
|
199  | 
assume "\<exists>i. f i = 0"  | 
|
200  | 
then obtain i where "f i = 0" by auto  | 
|
201  | 
moreover with M have "i < M" by (cases "i < M") auto  | 
|
202  | 
ultimately have "(\<Prod>i<M. f i) = 0" by auto  | 
|
203  | 
with lim show "(\<lambda>n. \<Prod>i\<le>n. f i) \<longlonglongrightarrow> 0" by simp  | 
|
204  | 
next  | 
|
205  | 
assume "(\<lambda>n. \<Prod>i\<le>n. f i) \<longlonglongrightarrow> 0"  | 
|
206  | 
from tendsto_unique[OF _ this lim] and \<open>L \<noteq> 0\<close>  | 
|
207  | 
show "\<exists>i. f i = 0" by auto  | 
|
208  | 
qed  | 
|
209  | 
qed  | 
|
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 | 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 | 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 | 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 | 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 | 252  | 
proof  | 
253  | 
assume "abs_convergent_prod f"  | 
|
254  | 
thus "convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"  | 
|
255  | 
by (auto simp: abs_convergent_prod_def intro!: convergent_prod_imp_convergent)  | 
|
256  | 
qed (auto intro: abs_convergent_prodI)  | 
|
257  | 
||
| 69529 | 258  | 
lemma Weierstrass_prod_ineq:  | 
| 66277 | 259  | 
fixes f :: "'a \<Rightarrow> real"  | 
260  | 
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<in> {0..1}"
 | 
|
261  | 
shows "1 - sum f A \<le> (\<Prod>x\<in>A. 1 - f x)"  | 
|
262  | 
using assms  | 
|
263  | 
proof (induction A rule: infinite_finite_induct)  | 
|
264  | 
case (insert x A)  | 
|
265  | 
from insert.hyps and insert.prems  | 
|
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)"  | 
|
267  | 
by (intro insert.IH add_mono mult_left_mono prod_mono) auto  | 
|
268  | 
with insert.hyps show ?case by (simp add: algebra_simps)  | 
|
269  | 
qed simp_all  | 
|
270  | 
||
271  | 
lemma norm_prod_minus1_le_prod_minus1:  | 
|
272  | 
  fixes f :: "nat \<Rightarrow> 'a :: {real_normed_div_algebra,comm_ring_1}"  
 | 
|
273  | 
shows "norm (prod (\<lambda>n. 1 + f n) A - 1) \<le> prod (\<lambda>n. 1 + norm (f n)) A - 1"  | 
|
274  | 
proof (induction A rule: infinite_finite_induct)  | 
|
275  | 
case (insert x A)  | 
|
276  | 
from insert.hyps have  | 
|
277  | 
"norm ((\<Prod>n\<in>insert x A. 1 + f n) - 1) =  | 
|
278  | 
norm ((\<Prod>n\<in>A. 1 + f n) - 1 + f x * (\<Prod>n\<in>A. 1 + f n))"  | 
|
279  | 
by (simp add: algebra_simps)  | 
|
280  | 
also have "\<dots> \<le> norm ((\<Prod>n\<in>A. 1 + f n) - 1) + norm (f x * (\<Prod>n\<in>A. 1 + f n))"  | 
|
281  | 
by (rule norm_triangle_ineq)  | 
|
282  | 
also have "norm (f x * (\<Prod>n\<in>A. 1 + f n)) = norm (f x) * (\<Prod>x\<in>A. norm (1 + f x))"  | 
|
283  | 
by (simp add: prod_norm norm_mult)  | 
|
284  | 
also have "(\<Prod>x\<in>A. norm (1 + f x)) \<le> (\<Prod>x\<in>A. norm (1::'a) + norm (f x))"  | 
|
285  | 
by (intro prod_mono norm_triangle_ineq ballI conjI) auto  | 
|
286  | 
also have "norm (1::'a) = 1" by simp  | 
|
287  | 
also note insert.IH  | 
|
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 | 290  | 
using insert.hyps by (simp add: algebra_simps)  | 
291  | 
finally show ?case by - (simp_all add: mult_left_mono)  | 
|
292  | 
qed simp_all  | 
|
293  | 
||
294  | 
lemma convergent_prod_imp_ev_nonzero:  | 
|
295  | 
  fixes f :: "nat \<Rightarrow> 'a :: {t2_space,comm_semiring_1}"
 | 
|
296  | 
assumes "convergent_prod f"  | 
|
297  | 
shows "eventually (\<lambda>n. f n \<noteq> 0) sequentially"  | 
|
298  | 
using assms by (auto simp: eventually_at_top_linorder convergent_prod_altdef)  | 
|
299  | 
||
300  | 
lemma convergent_prod_imp_LIMSEQ:  | 
|
301  | 
  fixes f :: "nat \<Rightarrow> 'a :: {real_normed_field}"
 | 
|
302  | 
assumes "convergent_prod f"  | 
|
303  | 
shows "f \<longlonglongrightarrow> 1"  | 
|
304  | 
proof -  | 
|
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"  | 
|
306  | 
by (auto simp: convergent_prod_altdef)  | 
|
307  | 
hence L': "(\<lambda>n. \<Prod>i\<le>Suc n. f (i+M)) \<longlonglongrightarrow> L" by (subst filterlim_sequentially_Suc)  | 
|
308  | 
have "(\<lambda>n. (\<Prod>i\<le>Suc n. f (i+M)) / (\<Prod>i\<le>n. f (i+M))) \<longlonglongrightarrow> L / L"  | 
|
309  | 
using L L' by (intro tendsto_divide) simp_all  | 
|
310  | 
also from L have "L / L = 1" by simp  | 
|
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))"  | 
|
312  | 
using assms L by (auto simp: fun_eq_iff atMost_Suc)  | 
|
313  | 
finally show ?thesis by (rule LIMSEQ_offset)  | 
|
314  | 
qed  | 
|
315  | 
||
316  | 
lemma abs_convergent_prod_imp_summable:  | 
|
317  | 
fixes f :: "nat \<Rightarrow> 'a :: real_normed_div_algebra"  | 
|
318  | 
assumes "abs_convergent_prod f"  | 
|
319  | 
shows "summable (\<lambda>i. norm (f i - 1))"  | 
|
320  | 
proof -  | 
|
321  | 
from assms have "convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"  | 
|
322  | 
unfolding abs_convergent_prod_def by (rule convergent_prod_imp_convergent)  | 
|
323  | 
then obtain L where L: "(\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1)) \<longlonglongrightarrow> L"  | 
|
324  | 
unfolding convergent_def by blast  | 
|
325  | 
have "convergent (\<lambda>n. \<Sum>i\<le>n. norm (f i - 1))"  | 
|
326  | 
proof (rule Bseq_monoseq_convergent)  | 
|
327  | 
have "eventually (\<lambda>n. (\<Prod>i\<le>n. 1 + norm (f i - 1)) < L + 1) sequentially"  | 
|
328  | 
using L(1) by (rule order_tendstoD) simp_all  | 
|
329  | 
hence "\<forall>\<^sub>F x in sequentially. norm (\<Sum>i\<le>x. norm (f i - 1)) \<le> L + 1"  | 
|
330  | 
proof eventually_elim  | 
|
331  | 
case (elim n)  | 
|
332  | 
have "norm (\<Sum>i\<le>n. norm (f i - 1)) = (\<Sum>i\<le>n. norm (f i - 1))"  | 
|
333  | 
unfolding real_norm_def by (intro abs_of_nonneg sum_nonneg) simp_all  | 
|
334  | 
also have "\<dots> \<le> (\<Prod>i\<le>n. 1 + norm (f i - 1))" by (rule sum_le_prod) auto  | 
|
335  | 
also have "\<dots> < L + 1" by (rule elim)  | 
|
336  | 
finally show ?case by simp  | 
|
337  | 
qed  | 
|
338  | 
thus "Bseq (\<lambda>n. \<Sum>i\<le>n. norm (f i - 1))" by (rule BfunI)  | 
|
339  | 
next  | 
|
340  | 
show "monoseq (\<lambda>n. \<Sum>i\<le>n. norm (f i - 1))"  | 
|
341  | 
by (rule mono_SucI1) auto  | 
|
342  | 
qed  | 
|
343  | 
thus "summable (\<lambda>i. norm (f i - 1))" by (simp add: summable_iff_convergent')  | 
|
344  | 
qed  | 
|
345  | 
||
346  | 
lemma summable_imp_abs_convergent_prod:  | 
|
347  | 
fixes f :: "nat \<Rightarrow> 'a :: real_normed_div_algebra"  | 
|
348  | 
assumes "summable (\<lambda>i. norm (f i - 1))"  | 
|
349  | 
shows "abs_convergent_prod f"  | 
|
350  | 
proof (intro abs_convergent_prodI Bseq_monoseq_convergent)  | 
|
351  | 
show "monoseq (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"  | 
|
352  | 
by (intro mono_SucI1)  | 
|
353  | 
(auto simp: atMost_Suc algebra_simps intro!: mult_nonneg_nonneg prod_nonneg)  | 
|
354  | 
next  | 
|
355  | 
show "Bseq (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"  | 
|
356  | 
proof (rule Bseq_eventually_mono)  | 
|
357  | 
show "eventually (\<lambda>n. norm (\<Prod>i\<le>n. 1 + norm (f i - 1)) \<le>  | 
|
358  | 
norm (exp (\<Sum>i\<le>n. norm (f i - 1)))) sequentially"  | 
|
359  | 
by (intro always_eventually allI) (auto simp: abs_prod exp_sum intro!: prod_mono)  | 
|
360  | 
next  | 
|
361  | 
from assms have "(\<lambda>n. \<Sum>i\<le>n. norm (f i - 1)) \<longlonglongrightarrow> (\<Sum>i. norm (f i - 1))"  | 
|
362  | 
using sums_def_le by blast  | 
|
363  | 
hence "(\<lambda>n. exp (\<Sum>i\<le>n. norm (f i - 1))) \<longlonglongrightarrow> exp (\<Sum>i. norm (f i - 1))"  | 
|
364  | 
by (rule tendsto_exp)  | 
|
365  | 
hence "convergent (\<lambda>n. exp (\<Sum>i\<le>n. norm (f i - 1)))"  | 
|
366  | 
by (rule convergentI)  | 
|
367  | 
thus "Bseq (\<lambda>n. exp (\<Sum>i\<le>n. norm (f i - 1)))"  | 
|
368  | 
by (rule convergent_imp_Bseq)  | 
|
369  | 
qed  | 
|
370  | 
qed  | 
|
371  | 
||
| 68651 | 372  | 
theorem abs_convergent_prod_conv_summable:  | 
| 66277 | 373  | 
fixes f :: "nat \<Rightarrow> 'a :: real_normed_div_algebra"  | 
374  | 
shows "abs_convergent_prod f \<longleftrightarrow> summable (\<lambda>i. norm (f i - 1))"  | 
|
375  | 
by (blast intro: abs_convergent_prod_imp_summable summable_imp_abs_convergent_prod)  | 
|
376  | 
||
377  | 
lemma abs_convergent_prod_imp_LIMSEQ:  | 
|
378  | 
  fixes f :: "nat \<Rightarrow> 'a :: {comm_ring_1,real_normed_div_algebra}"
 | 
|
379  | 
assumes "abs_convergent_prod f"  | 
|
380  | 
shows "f \<longlonglongrightarrow> 1"  | 
|
381  | 
proof -  | 
|
382  | 
from assms have "summable (\<lambda>n. norm (f n - 1))"  | 
|
383  | 
by (rule abs_convergent_prod_imp_summable)  | 
|
384  | 
from summable_LIMSEQ_zero[OF this] have "(\<lambda>n. f n - 1) \<longlonglongrightarrow> 0"  | 
|
385  | 
by (simp add: tendsto_norm_zero_iff)  | 
|
386  | 
from tendsto_add[OF this tendsto_const[of 1]] show ?thesis by simp  | 
|
387  | 
qed  | 
|
388  | 
||
389  | 
lemma abs_convergent_prod_imp_ev_nonzero:  | 
|
390  | 
  fixes f :: "nat \<Rightarrow> 'a :: {comm_ring_1,real_normed_div_algebra}"
 | 
|
391  | 
assumes "abs_convergent_prod f"  | 
|
392  | 
shows "eventually (\<lambda>n. f n \<noteq> 0) sequentially"  | 
|
393  | 
proof -  | 
|
394  | 
from assms have "f \<longlonglongrightarrow> 1"  | 
|
395  | 
by (rule abs_convergent_prod_imp_LIMSEQ)  | 
|
396  | 
hence "eventually (\<lambda>n. dist (f n) 1 < 1) at_top"  | 
|
397  | 
by (auto simp: tendsto_iff)  | 
|
398  | 
thus ?thesis by eventually_elim auto  | 
|
399  | 
qed  | 
|
400  | 
||
| 70136 | 401  | 
subsection\<^marker>\<open>tag unimportant\<close> \<open>Ignoring initial segments\<close>  | 
| 68651 | 402  | 
|
| 66277 | 403  | 
lemma convergent_prod_offset:  | 
404  | 
assumes "convergent_prod (\<lambda>n. f (n + m))"  | 
|
405  | 
shows "convergent_prod f"  | 
|
406  | 
proof -  | 
|
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 | 411  | 
qed  | 
412  | 
||
413  | 
lemma abs_convergent_prod_offset:  | 
|
414  | 
assumes "abs_convergent_prod (\<lambda>n. f (n + m))"  | 
|
415  | 
shows "abs_convergent_prod f"  | 
|
416  | 
using assms unfolding abs_convergent_prod_def by (rule convergent_prod_offset)  | 
|
417  | 
||
| 
68424
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
418  | 
|
| 68361 | 419  | 
lemma raw_has_prod_ignore_initial_segment:  | 
420  | 
fixes f :: "nat \<Rightarrow> 'a :: real_normed_field"  | 
|
421  | 
assumes "raw_has_prod f M p" "N \<ge> M"  | 
|
422  | 
obtains q where "raw_has_prod f N q"  | 
|
| 66277 | 423  | 
proof -  | 
| 68361 | 424  | 
have p: "(\<lambda>n. \<Prod>k\<le>n. f (k + M)) \<longlonglongrightarrow> p" and "p \<noteq> 0"  | 
425  | 
using assms by (auto simp: raw_has_prod_def)  | 
|
426  | 
then have nz: "\<And>n. n \<ge> M \<Longrightarrow> f n \<noteq> 0"  | 
|
427  | 
using assms by (auto simp: raw_has_prod_eq_0)  | 
|
428  | 
define C where "C = (\<Prod>k<N-M. f (k + M))"  | 
|
| 66277 | 429  | 
from nz have [simp]: "C \<noteq> 0"  | 
430  | 
by (auto simp: C_def)  | 
|
431  | 
||
| 68361 | 432  | 
from p have "(\<lambda>i. \<Prod>k\<le>i + (N-M). f (k + M)) \<longlonglongrightarrow> p"  | 
| 66277 | 433  | 
by (rule LIMSEQ_ignore_initial_segment)  | 
| 68361 | 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 | 435  | 
proof (rule ext, goal_cases)  | 
436  | 
case (1 n)  | 
|
| 68361 | 437  | 
    have "{..n+(N-M)} = {..<(N-M)} \<union> {(N-M)..n+(N-M)}" by auto
 | 
438  | 
also have "(\<Prod>k\<in>\<dots>. f (k + M)) = C * (\<Prod>k=(N-M)..n+(N-M). f (k + M))"  | 
|
| 66277 | 439  | 
unfolding C_def by (rule prod.union_disjoint) auto  | 
| 68361 | 440  | 
also have "(\<Prod>k=(N-M)..n+(N-M). f (k + M)) = (\<Prod>k\<le>n. f (k + (N-M) + M))"  | 
441  | 
by (intro ext prod.reindex_bij_witness[of _ "\<lambda>k. k + (N-M)" "\<lambda>k. k - (N-M)"]) auto  | 
|
442  | 
finally show ?case  | 
|
443  | 
using \<open>N \<ge> M\<close> by (simp add: add_ac)  | 
|
| 66277 | 444  | 
qed  | 
| 68361 | 445  | 
finally have "(\<lambda>n. C * (\<Prod>k\<le>n. f (k + N)) / C) \<longlonglongrightarrow> p / C"  | 
| 66277 | 446  | 
by (intro tendsto_divide tendsto_const) auto  | 
| 68361 | 447  | 
hence "(\<lambda>n. \<Prod>k\<le>n. f (k + N)) \<longlonglongrightarrow> p / C" by simp  | 
448  | 
moreover from \<open>p \<noteq> 0\<close> have "p / C \<noteq> 0" by simp  | 
|
449  | 
ultimately show ?thesis  | 
|
450  | 
using raw_has_prod_def that by blast  | 
|
| 66277 | 451  | 
qed  | 
452  | 
||
| 70136 | 453  | 
corollary\<^marker>\<open>tag unimportant\<close> convergent_prod_ignore_initial_segment:  | 
| 68361 | 454  | 
fixes f :: "nat \<Rightarrow> 'a :: real_normed_field"  | 
455  | 
assumes "convergent_prod f"  | 
|
456  | 
shows "convergent_prod (\<lambda>n. f (n + m))"  | 
|
457  | 
using assms  | 
|
458  | 
unfolding convergent_prod_def  | 
|
459  | 
apply clarify  | 
|
460  | 
apply (erule_tac N="M+m" in raw_has_prod_ignore_initial_segment)  | 
|
461  | 
apply (auto simp add: raw_has_prod_def add_ac)  | 
|
462  | 
done  | 
|
463  | 
||
| 70136 | 464  | 
corollary\<^marker>\<open>tag unimportant\<close> convergent_prod_ignore_nonzero_segment:  | 
| 68136 | 465  | 
fixes f :: "nat \<Rightarrow> 'a :: real_normed_field"  | 
466  | 
assumes f: "convergent_prod f" and nz: "\<And>i. i \<ge> M \<Longrightarrow> f i \<noteq> 0"  | 
|
| 68361 | 467  | 
shows "\<exists>p. raw_has_prod f M p"  | 
| 68136 | 468  | 
using convergent_prod_ignore_initial_segment [OF f]  | 
469  | 
by (metis convergent_LIMSEQ_iff convergent_prod_iff_convergent le_add_same_cancel2 nz prod_defs(1) zero_order(1))  | 
|
470  | 
||
| 70136 | 471  | 
corollary\<^marker>\<open>tag unimportant\<close> abs_convergent_prod_ignore_initial_segment:  | 
| 66277 | 472  | 
assumes "abs_convergent_prod f"  | 
473  | 
shows "abs_convergent_prod (\<lambda>n. f (n + m))"  | 
|
474  | 
using assms unfolding abs_convergent_prod_def  | 
|
475  | 
by (rule convergent_prod_ignore_initial_segment)  | 
|
476  | 
||
| 68651 | 477  | 
subsection\<open>More elementary properties\<close>  | 
478  | 
||
479  | 
theorem abs_convergent_prod_imp_convergent_prod:  | 
|
| 66277 | 480  | 
  fixes f :: "nat \<Rightarrow> 'a :: {real_normed_div_algebra,complete_space,comm_ring_1}"
 | 
481  | 
assumes "abs_convergent_prod f"  | 
|
482  | 
shows "convergent_prod f"  | 
|
483  | 
proof -  | 
|
484  | 
from assms have "eventually (\<lambda>n. f n \<noteq> 0) sequentially"  | 
|
485  | 
by (rule abs_convergent_prod_imp_ev_nonzero)  | 
|
486  | 
then obtain N where N: "f n \<noteq> 0" if "n \<ge> N" for n  | 
|
487  | 
by (auto simp: eventually_at_top_linorder)  | 
|
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)"  | 
|
489  | 
||
490  | 
have "Cauchy ?P"  | 
|
491  | 
proof (rule CauchyI', goal_cases)  | 
|
492  | 
case (1 \<epsilon>)  | 
|
493  | 
from assms have "abs_convergent_prod (\<lambda>n. f (n + N))"  | 
|
494  | 
by (rule abs_convergent_prod_ignore_initial_segment)  | 
|
495  | 
hence "Cauchy ?Q"  | 
|
496  | 
unfolding abs_convergent_prod_def  | 
|
497  | 
by (intro convergent_Cauchy convergent_prod_imp_convergent)  | 
|
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  | 
|
499  | 
by blast  | 
|
500  | 
show ?case  | 
|
501  | 
proof (rule exI[of _ M], safe, goal_cases)  | 
|
502  | 
case (1 m n)  | 
|
503  | 
have "dist (?P m) (?P n) = norm (?P n - ?P m)"  | 
|
504  | 
by (simp add: dist_norm norm_minus_commute)  | 
|
505  | 
      also from 1 have "{..n} = {..m} \<union> {m<..n}" by auto
 | 
|
506  | 
      hence "norm (?P n - ?P m) = norm (?P m * (\<Prod>k\<in>{m<..n}. f (k + N)) - ?P m)"
 | 
|
507  | 
by (subst prod.union_disjoint [symmetric]) (auto simp: algebra_simps)  | 
|
508  | 
      also have "\<dots> = norm (?P m * ((\<Prod>k\<in>{m<..n}. f (k + N)) - 1))"
 | 
|
509  | 
by (simp add: algebra_simps)  | 
|
510  | 
      also have "\<dots> = (\<Prod>k\<le>m. norm (f (k + N))) * norm ((\<Prod>k\<in>{m<..n}. f (k + N)) - 1)"
 | 
|
511  | 
by (simp add: norm_mult prod_norm)  | 
|
512  | 
      also have "\<dots> \<le> ?Q m * ((\<Prod>k\<in>{m<..n}. 1 + norm (f (k + N) - 1)) - 1)"
 | 
|
513  | 
        using norm_prod_minus1_le_prod_minus1[of "\<lambda>k. f (k + N) - 1" "{m<..n}"]
 | 
|
514  | 
norm_triangle_ineq[of 1 "f k - 1" for k]  | 
|
515  | 
by (intro mult_mono prod_mono ballI conjI norm_prod_minus1_le_prod_minus1 prod_nonneg) auto  | 
|
516  | 
      also have "\<dots> = ?Q m * (\<Prod>k\<in>{m<..n}. 1 + norm (f (k + N) - 1)) - ?Q m"
 | 
|
517  | 
by (simp add: algebra_simps)  | 
|
518  | 
      also have "?Q m * (\<Prod>k\<in>{m<..n}. 1 + norm (f (k + N) - 1)) = 
 | 
|
519  | 
                   (\<Prod>k\<in>{..m}\<union>{m<..n}. 1 + norm (f (k + N) - 1))"
 | 
|
520  | 
by (rule prod.union_disjoint [symmetric]) auto  | 
|
521  | 
      also from 1 have "{..m}\<union>{m<..n} = {..n}" by auto
 | 
|
522  | 
also have "?Q n - ?Q m \<le> norm (?Q n - ?Q m)" by simp  | 
|
523  | 
also from 1 have "\<dots> < \<epsilon>" by (intro M) auto  | 
|
524  | 
finally show ?case .  | 
|
525  | 
qed  | 
|
526  | 
qed  | 
|
527  | 
hence conv: "convergent ?P" by (rule Cauchy_convergent)  | 
|
528  | 
then obtain L where L: "?P \<longlonglongrightarrow> L"  | 
|
529  | 
by (auto simp: convergent_def)  | 
|
530  | 
||
531  | 
have "L \<noteq> 0"  | 
|
532  | 
proof  | 
|
533  | 
assume [simp]: "L = 0"  | 
|
534  | 
from tendsto_norm[OF L] have limit: "(\<lambda>n. \<Prod>k\<le>n. norm (f (k + N))) \<longlonglongrightarrow> 0"  | 
|
535  | 
by (simp add: prod_norm)  | 
|
536  | 
||
537  | 
from assms have "(\<lambda>n. f (n + N)) \<longlonglongrightarrow> 1"  | 
|
538  | 
by (intro abs_convergent_prod_imp_LIMSEQ abs_convergent_prod_ignore_initial_segment)  | 
|
539  | 
hence "eventually (\<lambda>n. norm (f (n + N) - 1) < 1) sequentially"  | 
|
540  | 
by (auto simp: tendsto_iff dist_norm)  | 
|
541  | 
then obtain M0 where M0: "norm (f (n + N) - 1) < 1" if "n \<ge> M0" for n  | 
|
542  | 
by (auto simp: eventually_at_top_linorder)  | 
|
543  | 
||
544  | 
    {
 | 
|
545  | 
fix M assume M: "M \<ge> M0"  | 
|
546  | 
with M0 have M: "norm (f (n + N) - 1) < 1" if "n \<ge> M" for n using that by simp  | 
|
547  | 
||
548  | 
have "(\<lambda>n. \<Prod>k\<le>n. 1 - norm (f (k+M+N) - 1)) \<longlonglongrightarrow> 0"  | 
|
549  | 
proof (rule tendsto_sandwich)  | 
|
550  | 
show "eventually (\<lambda>n. (\<Prod>k\<le>n. 1 - norm (f (k+M+N) - 1)) \<ge> 0) sequentially"  | 
|
551  | 
using M by (intro always_eventually prod_nonneg allI ballI) (auto intro: less_imp_le)  | 
|
552  | 
have "norm (1::'a) - norm (f (i + M + N) - 1) \<le> norm (f (i + M + N))" for i  | 
|
553  | 
using norm_triangle_ineq3[of "f (i + M + N)" 1] by simp  | 
|
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"  | 
|
555  | 
using M by (intro always_eventually allI prod_mono ballI conjI) (auto intro: less_imp_le)  | 
|
556  | 
||
557  | 
define C where "C = (\<Prod>k<M. norm (f (k + N)))"  | 
|
558  | 
from N have [simp]: "C \<noteq> 0" by (auto simp: C_def)  | 
|
559  | 
from L have "(\<lambda>n. norm (\<Prod>k\<le>n+M. f (k + N))) \<longlonglongrightarrow> 0"  | 
|
560  | 
by (intro LIMSEQ_ignore_initial_segment) (simp add: tendsto_norm_zero_iff)  | 
|
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))))"  | 
|
562  | 
proof (rule ext, goal_cases)  | 
|
563  | 
case (1 n)  | 
|
564  | 
          have "{..n+M} = {..<M} \<union> {M..n+M}" by auto
 | 
|
565  | 
also have "norm (\<Prod>k\<in>\<dots>. f (k + N)) = C * norm (\<Prod>k=M..n+M. f (k + N))"  | 
|
566  | 
unfolding C_def by (subst prod.union_disjoint) (auto simp: norm_mult prod_norm)  | 
|
567  | 
also have "(\<Prod>k=M..n+M. f (k + N)) = (\<Prod>k\<le>n. f (k + N + M))"  | 
|
568  | 
by (intro prod.reindex_bij_witness[of _ "\<lambda>i. i + M" "\<lambda>i. i - M"]) auto  | 
|
569  | 
finally show ?case by (simp add: add_ac prod_norm)  | 
|
570  | 
qed  | 
|
571  | 
finally have "(\<lambda>n. C * (\<Prod>k\<le>n. norm (f (k + M + N))) / C) \<longlonglongrightarrow> 0 / C"  | 
|
572  | 
by (intro tendsto_divide tendsto_const) auto  | 
|
573  | 
thus "(\<lambda>n. \<Prod>k\<le>n. norm (f (k + M + N))) \<longlonglongrightarrow> 0" by simp  | 
|
574  | 
qed simp_all  | 
|
575  | 
||
576  | 
have "1 - (\<Sum>i. norm (f (i + M + N) - 1)) \<le> 0"  | 
|
577  | 
proof (rule tendsto_le)  | 
|
578  | 
show "eventually (\<lambda>n. 1 - (\<Sum>k\<le>n. norm (f (k+M+N) - 1)) \<le>  | 
|
579  | 
(\<Prod>k\<le>n. 1 - norm (f (k+M+N) - 1))) at_top"  | 
|
| 69529 | 580  | 
using M by (intro always_eventually allI Weierstrass_prod_ineq) (auto intro: less_imp_le)  | 
| 66277 | 581  | 
show "(\<lambda>n. \<Prod>k\<le>n. 1 - norm (f (k+M+N) - 1)) \<longlonglongrightarrow> 0" by fact  | 
582  | 
show "(\<lambda>n. 1 - (\<Sum>k\<le>n. norm (f (k + M + N) - 1)))  | 
|
583  | 
\<longlonglongrightarrow> 1 - (\<Sum>i. norm (f (i + M + N) - 1))"  | 
|
584  | 
by (intro tendsto_intros summable_LIMSEQ' summable_ignore_initial_segment  | 
|
585  | 
abs_convergent_prod_imp_summable assms)  | 
|
586  | 
qed simp_all  | 
|
587  | 
hence "(\<Sum>i. norm (f (i + M + N) - 1)) \<ge> 1" by simp  | 
|
588  | 
also have "\<dots> + (\<Sum>i<M. norm (f (i + N) - 1)) = (\<Sum>i. norm (f (i + N) - 1))"  | 
|
589  | 
by (intro suminf_split_initial_segment [symmetric] summable_ignore_initial_segment  | 
|
590  | 
abs_convergent_prod_imp_summable assms)  | 
|
591  | 
finally have "1 + (\<Sum>i<M. norm (f (i + N) - 1)) \<le> (\<Sum>i. norm (f (i + N) - 1))" by simp  | 
|
592  | 
} note * = this  | 
|
593  | 
||
594  | 
have "1 + (\<Sum>i. norm (f (i + N) - 1)) \<le> (\<Sum>i. norm (f (i + N) - 1))"  | 
|
595  | 
proof (rule tendsto_le)  | 
|
596  | 
show "(\<lambda>M. 1 + (\<Sum>i<M. norm (f (i + N) - 1))) \<longlonglongrightarrow> 1 + (\<Sum>i. norm (f (i + N) - 1))"  | 
|
597  | 
by (intro tendsto_intros summable_LIMSEQ summable_ignore_initial_segment  | 
|
598  | 
abs_convergent_prod_imp_summable assms)  | 
|
599  | 
show "eventually (\<lambda>M. 1 + (\<Sum>i<M. norm (f (i + N) - 1)) \<le> (\<Sum>i. norm (f (i + N) - 1))) at_top"  | 
|
600  | 
using eventually_ge_at_top[of M0] by eventually_elim (use * in auto)  | 
|
601  | 
qed simp_all  | 
|
602  | 
thus False by simp  | 
|
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 | 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 | 609  | 
assumes "raw_has_prod f M p"  | 
610  | 
obtains i where "i<M" "f i = 0" | p where "raw_has_prod f 0 p"  | 
|
| 68136 | 611  | 
proof -  | 
612  | 
have "(\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> p" "p \<noteq> 0"  | 
|
| 68361 | 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 | 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 | 628  | 
  then have "raw_has_prod f 0 (prod f {..<M} * p)" if "\<forall>i<M. f i \<noteq> 0"
 | 
629  | 
using \<open>p \<noteq> 0\<close> assms that by (auto simp: raw_has_prod_def)  | 
|
| 68136 | 630  | 
then show thesis  | 
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 | 634  | 
corollary convergent_prod_offset_0:  | 
635  | 
  fixes f :: "nat \<Rightarrow> 'a :: {idom,topological_semigroup_mult,t2_space}"
 | 
|
636  | 
assumes "convergent_prod f" "\<And>i. f i \<noteq> 0"  | 
|
| 68361 | 637  | 
shows "\<exists>p. raw_has_prod f 0 p"  | 
638  | 
using assms convergent_prod_def raw_has_prod_cases by blast  | 
|
| 68136 | 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 | 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"  | 
| 73466 | 689  | 
    with f have "\<not> (\<lambda>n. prod f {..n}) \<longlonglongrightarrow> 0"
 | 
690  | 
by simp  | 
|
| 
68064
 
b249fab48c76
type class generalisations; some work on infinite products
 
paulson <lp15@cam.ac.uk> 
parents: 
66277 
diff
changeset
 | 
691  | 
    then have "\<not> (\<lambda>n. prod g {..n}) \<longlonglongrightarrow> 0"
 | 
| 73466 | 692  | 
using * \<open>C \<noteq> 0\<close> filterlim_cong by fastforce  | 
| 
68064
 
b249fab48c76
type class generalisations; some work on infinite products
 
paulson <lp15@cam.ac.uk> 
parents: 
66277 
diff
changeset
 | 
693  | 
then show "convergent_prod g"  | 
| 
 
b249fab48c76
type class generalisations; some work on infinite products
 
paulson <lp15@cam.ac.uk> 
parents: 
66277 
diff
changeset
 | 
694  | 
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
 | 
695  | 
next  | 
| 
 
b249fab48c76
type class generalisations; some work on infinite products
 
paulson <lp15@cam.ac.uk> 
parents: 
66277 
diff
changeset
 | 
696  | 
assume cg: "convergent_prod g"  | 
| 
 
b249fab48c76
type class generalisations; some work on infinite products
 
paulson <lp15@cam.ac.uk> 
parents: 
66277 
diff
changeset
 | 
697  | 
    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
 | 
698  | 
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
 | 
699  | 
then show "convergent_prod f"  | 
| 
 
b249fab48c76
type class generalisations; some work on infinite products
 
paulson <lp15@cam.ac.uk> 
parents: 
66277 
diff
changeset
 | 
700  | 
using "*" tendsto_mult_left filterlim_cong  | 
| 
 
b249fab48c76
type class generalisations; some work on infinite products
 
paulson <lp15@cam.ac.uk> 
parents: 
66277 
diff
changeset
 | 
701  | 
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
 | 
702  | 
qed  | 
| 66277 | 703  | 
qed  | 
704  | 
||
| 68071 | 705  | 
lemma has_prod_finite:  | 
| 68361 | 706  | 
  fixes f :: "nat \<Rightarrow> 'a::{semidom,t2_space}"
 | 
| 68071 | 707  | 
assumes [simp]: "finite N"  | 
708  | 
and f: "\<And>n. n \<notin> N \<Longrightarrow> f n = 1"  | 
|
709  | 
shows "f has_prod (\<Prod>n\<in>N. f n)"  | 
|
710  | 
proof -  | 
|
711  | 
  have eq: "prod f {..n + Suc (Max N)} = prod f N" for n
 | 
|
712  | 
proof (rule prod.mono_neutral_right)  | 
|
713  | 
    show "N \<subseteq> {..n + Suc (Max N)}"
 | 
|
| 68138 | 714  | 
by (auto simp: le_Suc_eq trans_le_add2)  | 
| 68071 | 715  | 
    show "\<forall>i\<in>{..n + Suc (Max N)} - N. f i = 1"
 | 
716  | 
using f by blast  | 
|
717  | 
qed auto  | 
|
718  | 
show ?thesis  | 
|
719  | 
proof (cases "\<forall>n\<in>N. f n \<noteq> 0")  | 
|
720  | 
case True  | 
|
721  | 
then have "prod f N \<noteq> 0"  | 
|
722  | 
by simp  | 
|
723  | 
    moreover have "(\<lambda>n. prod f {..n}) \<longlonglongrightarrow> prod f N"
 | 
|
724  | 
by (rule LIMSEQ_offset[of _ "Suc (Max N)"]) (simp add: eq atLeast0LessThan del: add_Suc_right)  | 
|
725  | 
ultimately show ?thesis  | 
|
| 68361 | 726  | 
by (simp add: raw_has_prod_def has_prod_def)  | 
| 68071 | 727  | 
next  | 
728  | 
case False  | 
|
729  | 
then obtain k where "k \<in> N" "f k = 0"  | 
|
730  | 
by auto  | 
|
731  | 
    let ?Z = "{n \<in> N. f n = 0}"
 | 
|
732  | 
have maxge: "Max ?Z \<ge> n" if "f n = 0" for n  | 
|
733  | 
using Max_ge [of ?Z] \<open>finite N\<close> \<open>f n = 0\<close>  | 
|
734  | 
by (metis (mono_tags) Collect_mem_eq f finite_Collect_conjI mem_Collect_eq zero_neq_one)  | 
|
735  | 
    let ?q = "prod f {Suc (Max ?Z)..Max N}"
 | 
|
736  | 
have [simp]: "?q \<noteq> 0"  | 
|
737  | 
using maxge Suc_n_not_le_n le_trans by force  | 
|
| 68076 | 738  | 
have eq: "(\<Prod>i\<le>n + Max N. f (Suc (i + Max ?Z))) = ?q" for n  | 
739  | 
proof -  | 
|
740  | 
      have "(\<Prod>i\<le>n + Max N. f (Suc (i + Max ?Z))) = prod f {Suc (Max ?Z)..n + Max N + Suc (Max ?Z)}" 
 | 
|
741  | 
proof (rule prod.reindex_cong [where l = "\<lambda>i. i + Suc (Max ?Z)", THEN sym])  | 
|
742  | 
        show "{Suc (Max ?Z)..n + Max N + Suc (Max ?Z)} = (\<lambda>i. i + Suc (Max ?Z)) ` {..n + Max N}"
 | 
|
743  | 
using le_Suc_ex by fastforce  | 
|
744  | 
qed (auto simp: inj_on_def)  | 
|
| 68138 | 745  | 
also have "\<dots> = ?q"  | 
| 68076 | 746  | 
by (rule prod.mono_neutral_right)  | 
747  | 
(use Max.coboundedI [OF \<open>finite N\<close>] f in \<open>force+\<close>)  | 
|
748  | 
finally show ?thesis .  | 
|
749  | 
qed  | 
|
| 68361 | 750  | 
have q: "raw_has_prod f (Suc (Max ?Z)) ?q"  | 
751  | 
proof (simp add: raw_has_prod_def)  | 
|
| 68076 | 752  | 
show "(\<lambda>n. \<Prod>i\<le>n. f (Suc (i + Max ?Z))) \<longlonglongrightarrow> ?q"  | 
753  | 
by (rule LIMSEQ_offset[of _ "(Max N)"]) (simp add: eq)  | 
|
754  | 
qed  | 
|
| 68071 | 755  | 
show ?thesis  | 
756  | 
unfolding has_prod_def  | 
|
757  | 
proof (intro disjI2 exI conjI)  | 
|
758  | 
show "prod f N = 0"  | 
|
759  | 
using \<open>f k = 0\<close> \<open>k \<in> N\<close> \<open>finite N\<close> prod_zero by blast  | 
|
760  | 
show "f (Max ?Z) = 0"  | 
|
761  | 
using Max_in [of ?Z] \<open>finite N\<close> \<open>f k = 0\<close> \<open>k \<in> N\<close> by auto  | 
|
762  | 
qed (use q in auto)  | 
|
763  | 
qed  | 
|
764  | 
qed  | 
|
765  | 
||
| 70136 | 766  | 
corollary\<^marker>\<open>tag unimportant\<close> has_prod_0:  | 
| 68361 | 767  | 
  fixes f :: "nat \<Rightarrow> 'a::{semidom,t2_space}"
 | 
| 68071 | 768  | 
assumes "\<And>n. f n = 1"  | 
769  | 
shows "f has_prod 1"  | 
|
770  | 
by (simp add: assms has_prod_cong)  | 
|
771  | 
||
| 68361 | 772  | 
lemma prodinf_zero[simp]: "prodinf (\<lambda>n. 1::'a::real_normed_field) = 1"  | 
773  | 
using has_prod_unique by force  | 
|
774  | 
||
| 68071 | 775  | 
lemma convergent_prod_finite:  | 
776  | 
  fixes f :: "nat \<Rightarrow> 'a::{idom,t2_space}"
 | 
|
777  | 
assumes "finite N" "\<And>n. n \<notin> N \<Longrightarrow> f n = 1"  | 
|
778  | 
shows "convergent_prod f"  | 
|
779  | 
proof -  | 
|
| 68361 | 780  | 
have "\<exists>n p. raw_has_prod f n p"  | 
| 68071 | 781  | 
using assms has_prod_def has_prod_finite by blast  | 
782  | 
then show ?thesis  | 
|
783  | 
by (simp add: convergent_prod_def)  | 
|
784  | 
qed  | 
|
785  | 
||
| 68127 | 786  | 
lemma has_prod_If_finite_set:  | 
787  | 
  fixes f :: "nat \<Rightarrow> 'a::{idom,t2_space}"
 | 
|
788  | 
shows "finite A \<Longrightarrow> (\<lambda>r. if r \<in> A then f r else 1) has_prod (\<Prod>r\<in>A. f r)"  | 
|
789  | 
using has_prod_finite[of A "(\<lambda>r. if r \<in> A then f r else 1)"]  | 
|
790  | 
by simp  | 
|
791  | 
||
792  | 
lemma has_prod_If_finite:  | 
|
793  | 
  fixes f :: "nat \<Rightarrow> 'a::{idom,t2_space}"
 | 
|
794  | 
  shows "finite {r. P r} \<Longrightarrow> (\<lambda>r. if P r then f r else 1) has_prod (\<Prod>r | P r. f r)"
 | 
|
795  | 
  using has_prod_If_finite_set[of "{r. P r}"] by simp
 | 
|
796  | 
||
797  | 
lemma convergent_prod_If_finite_set[simp, intro]:  | 
|
798  | 
  fixes f :: "nat \<Rightarrow> 'a::{idom,t2_space}"
 | 
|
799  | 
shows "finite A \<Longrightarrow> convergent_prod (\<lambda>r. if r \<in> A then f r else 1)"  | 
|
800  | 
by (simp add: convergent_prod_finite)  | 
|
801  | 
||
802  | 
lemma convergent_prod_If_finite[simp, intro]:  | 
|
803  | 
  fixes f :: "nat \<Rightarrow> 'a::{idom,t2_space}"
 | 
|
804  | 
  shows "finite {r. P r} \<Longrightarrow> convergent_prod (\<lambda>r. if P r then f r else 1)"
 | 
|
805  | 
using convergent_prod_def has_prod_If_finite has_prod_def by fastforce  | 
|
806  | 
||
807  | 
lemma has_prod_single:  | 
|
808  | 
  fixes f :: "nat \<Rightarrow> 'a::{idom,t2_space}"
 | 
|
809  | 
shows "(\<lambda>r. if r = i then f r else 1) has_prod f i"  | 
|
810  | 
using has_prod_If_finite[of "\<lambda>r. r = i"] by simp  | 
|
811  | 
||
| 68136 | 812  | 
context  | 
813  | 
fixes f :: "nat \<Rightarrow> 'a :: real_normed_field"  | 
|
814  | 
begin  | 
|
815  | 
||
816  | 
lemma convergent_prod_imp_has_prod:  | 
|
817  | 
assumes "convergent_prod f"  | 
|
818  | 
shows "\<exists>p. f has_prod p"  | 
|
819  | 
proof -  | 
|
| 68361 | 820  | 
obtain M p where p: "raw_has_prod f M p"  | 
| 68136 | 821  | 
using assms convergent_prod_def by blast  | 
822  | 
then have "p \<noteq> 0"  | 
|
| 68361 | 823  | 
using raw_has_prod_nonzero by blast  | 
| 68136 | 824  | 
with p have fnz: "f i \<noteq> 0" if "i \<ge> M" for i  | 
| 68361 | 825  | 
using raw_has_prod_eq_0 that by blast  | 
| 68136 | 826  | 
define C where "C = (\<Prod>n<M. f n)"  | 
827  | 
show ?thesis  | 
|
828  | 
proof (cases "\<forall>n\<le>M. f n \<noteq> 0")  | 
|
829  | 
case True  | 
|
830  | 
then have "C \<noteq> 0"  | 
|
831  | 
by (simp add: C_def)  | 
|
832  | 
then show ?thesis  | 
|
833  | 
by (meson True assms convergent_prod_offset_0 fnz has_prod_def nat_le_linear)  | 
|
834  | 
next  | 
|
835  | 
case False  | 
|
836  | 
let ?N = "GREATEST n. f n = 0"  | 
|
837  | 
have 0: "f ?N = 0"  | 
|
838  | 
using fnz False  | 
|
839  | 
by (metis (mono_tags, lifting) GreatestI_ex_nat nat_le_linear)  | 
|
840  | 
have "f i \<noteq> 0" if "i > ?N" for i  | 
|
841  | 
by (metis (mono_tags, lifting) Greatest_le_nat fnz leD linear that)  | 
|
| 68361 | 842  | 
then have "\<exists>p. raw_has_prod f (Suc ?N) p"  | 
| 68136 | 843  | 
using assms by (auto simp: intro!: convergent_prod_ignore_nonzero_segment)  | 
844  | 
then show ?thesis  | 
|
845  | 
unfolding has_prod_def using 0 by blast  | 
|
846  | 
qed  | 
|
847  | 
qed  | 
|
848  | 
||
849  | 
lemma convergent_prod_has_prod [intro]:  | 
|
850  | 
shows "convergent_prod f \<Longrightarrow> f has_prod (prodinf f)"  | 
|
851  | 
unfolding prodinf_def  | 
|
852  | 
by (metis convergent_prod_imp_has_prod has_prod_unique theI')  | 
|
853  | 
||
854  | 
lemma convergent_prod_LIMSEQ:  | 
|
855  | 
shows "convergent_prod f \<Longrightarrow> (\<lambda>n. \<Prod>i\<le>n. f i) \<longlonglongrightarrow> prodinf f"  | 
|
856  | 
by (metis convergent_LIMSEQ_iff convergent_prod_has_prod convergent_prod_imp_convergent  | 
|
| 68361 | 857  | 
convergent_prod_to_zero_iff raw_has_prod_eq_0 has_prod_def prodinf_eq_lim zero_le)  | 
| 68136 | 858  | 
|
| 68651 | 859  | 
theorem has_prod_iff: "f has_prod x \<longleftrightarrow> convergent_prod f \<and> prodinf f = x"  | 
| 68136 | 860  | 
proof  | 
861  | 
assume "f has_prod x"  | 
|
862  | 
then show "convergent_prod f \<and> prodinf f = x"  | 
|
863  | 
apply safe  | 
|
864  | 
using convergent_prod_def has_prod_def apply blast  | 
|
865  | 
using has_prod_unique by blast  | 
|
866  | 
qed auto  | 
|
867  | 
||
868  | 
lemma convergent_prod_has_prod_iff: "convergent_prod f \<longleftrightarrow> f has_prod prodinf f"  | 
|
869  | 
by (auto simp: has_prod_iff convergent_prod_has_prod)  | 
|
870  | 
||
871  | 
lemma prodinf_finite:  | 
|
872  | 
assumes N: "finite N"  | 
|
873  | 
and f: "\<And>n. n \<notin> N \<Longrightarrow> f n = 1"  | 
|
874  | 
shows "prodinf f = (\<Prod>n\<in>N. f n)"  | 
|
875  | 
using has_prod_finite[OF assms, THEN has_prod_unique] by simp  | 
|
| 68127 | 876  | 
|
| 66277 | 877  | 
end  | 
| 68136 | 878  | 
|
| 70136 | 879  | 
subsection\<^marker>\<open>tag unimportant\<close> \<open>Infinite products on ordered topological monoids\<close>  | 
| 68361 | 880  | 
|
881  | 
lemma LIMSEQ_prod_0:  | 
|
882  | 
  fixes f :: "nat \<Rightarrow> 'a::{semidom,topological_space}"
 | 
|
883  | 
assumes "f i = 0"  | 
|
884  | 
  shows "(\<lambda>n. prod f {..n}) \<longlonglongrightarrow> 0"
 | 
|
885  | 
proof (subst tendsto_cong)  | 
|
886  | 
  show "\<forall>\<^sub>F n in sequentially. prod f {..n} = 0"
 | 
|
887  | 
proof  | 
|
888  | 
    show "prod f {..n} = 0" if "n \<ge> i" for n
 | 
|
889  | 
using that assms by auto  | 
|
890  | 
qed  | 
|
891  | 
qed auto  | 
|
892  | 
||
893  | 
lemma LIMSEQ_prod_nonneg:  | 
|
894  | 
  fixes f :: "nat \<Rightarrow> 'a::{linordered_semidom,linorder_topology}"
 | 
|
895  | 
  assumes 0: "\<And>n. 0 \<le> f n" and a: "(\<lambda>n. prod f {..n}) \<longlonglongrightarrow> a"
 | 
|
896  | 
shows "a \<ge> 0"  | 
|
897  | 
by (simp add: "0" prod_nonneg LIMSEQ_le_const [OF a])  | 
|
898  | 
||
899  | 
||
900  | 
context  | 
|
901  | 
  fixes f :: "nat \<Rightarrow> 'a::{linordered_semidom,linorder_topology}"
 | 
|
902  | 
begin  | 
|
903  | 
||
904  | 
lemma has_prod_le:  | 
|
905  | 
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"  | 
|
906  | 
shows "a \<le> b"  | 
|
907  | 
proof (cases "a=0 \<or> b=0")  | 
|
908  | 
case True  | 
|
909  | 
then show ?thesis  | 
|
910  | 
proof  | 
|
911  | 
assume [simp]: "a=0"  | 
|
912  | 
have "b \<ge> 0"  | 
|
913  | 
proof (rule LIMSEQ_prod_nonneg)  | 
|
914  | 
      show "(\<lambda>n. prod g {..n}) \<longlonglongrightarrow> b"
 | 
|
915  | 
using g by (auto simp: has_prod_def raw_has_prod_def LIMSEQ_prod_0)  | 
|
916  | 
qed (use le order_trans in auto)  | 
|
917  | 
then show ?thesis  | 
|
918  | 
by auto  | 
|
919  | 
next  | 
|
920  | 
assume [simp]: "b=0"  | 
|
921  | 
then obtain i where "g i = 0"  | 
|
922  | 
using g by (auto simp: prod_defs)  | 
|
923  | 
then have "f i = 0"  | 
|
924  | 
using antisym le by force  | 
|
925  | 
then have "a=0"  | 
|
926  | 
using f by (auto simp: prod_defs LIMSEQ_prod_0 LIMSEQ_unique)  | 
|
927  | 
then show ?thesis  | 
|
928  | 
by auto  | 
|
929  | 
qed  | 
|
930  | 
next  | 
|
931  | 
case False  | 
|
932  | 
then show ?thesis  | 
|
933  | 
using assms  | 
|
934  | 
unfolding has_prod_def raw_has_prod_def  | 
|
935  | 
by (force simp: LIMSEQ_prod_0 intro!: LIMSEQ_le prod_mono)  | 
|
936  | 
qed  | 
|
937  | 
||
938  | 
lemma prodinf_le:  | 
|
939  | 
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"  | 
|
940  | 
shows "prodinf f \<le> prodinf g"  | 
|
941  | 
using has_prod_le [OF assms] has_prod_unique f g by blast  | 
|
942  | 
||
| 68136 | 943  | 
end  | 
| 68361 | 944  | 
|
945  | 
||
946  | 
lemma prod_le_prodinf:  | 
|
947  | 
  fixes f :: "nat \<Rightarrow> 'a::{linordered_idom,linorder_topology}"
 | 
|
948  | 
assumes "f has_prod a" "\<And>i. 0 \<le> f i" "\<And>i. i\<ge>n \<Longrightarrow> 1 \<le> f i"  | 
|
949  | 
  shows "prod f {..<n} \<le> prodinf f"
 | 
|
950  | 
by(rule has_prod_le[OF has_prod_If_finite_set]) (use assms has_prod_unique in auto)  | 
|
951  | 
||
952  | 
lemma prodinf_nonneg:  | 
|
953  | 
  fixes f :: "nat \<Rightarrow> 'a::{linordered_idom,linorder_topology}"
 | 
|
954  | 
assumes "f has_prod a" "\<And>i. 1 \<le> f i"  | 
|
955  | 
shows "1 \<le> prodinf f"  | 
|
956  | 
using prod_le_prodinf[of f a 0] assms  | 
|
957  | 
by (metis order_trans prod_ge_1 zero_le_one)  | 
|
958  | 
||
959  | 
lemma prodinf_le_const:  | 
|
960  | 
fixes f :: "nat \<Rightarrow> real"  | 
|
961  | 
  assumes "convergent_prod f" "\<And>n. prod f {..<n} \<le> x" 
 | 
|
962  | 
shows "prodinf f \<le> x"  | 
|
963  | 
by (metis lessThan_Suc_atMost assms convergent_prod_LIMSEQ LIMSEQ_le_const2)  | 
|
964  | 
||
| 
73005
 
83b114a6545f
A few more simprules for iff-reasoning
 
paulson <lp15@cam.ac.uk> 
parents: 
73004 
diff
changeset
 | 
965  | 
lemma prodinf_eq_one_iff [simp]:  | 
| 68361 | 966  | 
fixes f :: "nat \<Rightarrow> real"  | 
967  | 
assumes f: "convergent_prod f" and ge1: "\<And>n. 1 \<le> f n"  | 
|
968  | 
shows "prodinf f = 1 \<longleftrightarrow> (\<forall>n. f n = 1)"  | 
|
969  | 
proof  | 
|
970  | 
assume "prodinf f = 1"  | 
|
971  | 
then have "(\<lambda>n. \<Prod>i<n. f i) \<longlonglongrightarrow> 1"  | 
|
972  | 
using convergent_prod_LIMSEQ[of f] assms by (simp add: LIMSEQ_lessThan_iff_atMost)  | 
|
973  | 
  then have "\<And>i. (\<Prod>n\<in>{i}. f n) \<le> 1"
 | 
|
974  | 
proof (rule LIMSEQ_le_const)  | 
|
975  | 
have "1 \<le> prod f n" for n  | 
|
976  | 
by (simp add: ge1 prod_ge_1)  | 
|
977  | 
    have "prod f {..<n} = 1" for n
 | 
|
978  | 
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)  | 
|
979  | 
    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
 | 
980  | 
by (metis mult.left_neutral order_refl prod.cong prod.neutral_const prod.lessThan_Suc)  | 
| 68361 | 981  | 
    then show "\<exists>N. \<forall>n\<ge>N. (\<Prod>n\<in>{i}. f n) \<le> prod f {..<n}" for i
 | 
982  | 
by blast  | 
|
983  | 
qed  | 
|
984  | 
with ge1 show "\<forall>n. f n = 1"  | 
|
985  | 
by (auto intro!: antisym)  | 
|
986  | 
qed (metis prodinf_zero fun_eq_iff)  | 
|
987  | 
||
988  | 
lemma prodinf_pos_iff:  | 
|
989  | 
fixes f :: "nat \<Rightarrow> real"  | 
|
990  | 
assumes "convergent_prod f" "\<And>n. 1 \<le> f n"  | 
|
991  | 
shows "1 < prodinf f \<longleftrightarrow> (\<exists>i. 1 < f i)"  | 
|
992  | 
using prod_le_prodinf[of f 1] prodinf_eq_one_iff  | 
|
993  | 
by (metis convergent_prod_has_prod assms less_le prodinf_nonneg)  | 
|
994  | 
||
995  | 
lemma less_1_prodinf2:  | 
|
996  | 
fixes f :: "nat \<Rightarrow> real"  | 
|
997  | 
assumes "convergent_prod f" "\<And>n. 1 \<le> f n" "1 < f i"  | 
|
998  | 
shows "1 < prodinf f"  | 
|
999  | 
proof -  | 
|
1000  | 
have "1 < (\<Prod>n<Suc i. f n)"  | 
|
1001  | 
using assms by (intro less_1_prod2[where i=i]) auto  | 
|
1002  | 
also have "\<dots> \<le> prodinf f"  | 
|
1003  | 
by (intro prod_le_prodinf) (use assms order_trans zero_le_one in \<open>blast+\<close>)  | 
|
1004  | 
finally show ?thesis .  | 
|
1005  | 
qed  | 
|
1006  | 
||
1007  | 
lemma less_1_prodinf:  | 
|
1008  | 
fixes f :: "nat \<Rightarrow> real"  | 
|
1009  | 
shows "\<lbrakk>convergent_prod f; \<And>n. 1 < f n\<rbrakk> \<Longrightarrow> 1 < prodinf f"  | 
|
1010  | 
by (intro less_1_prodinf2[where i=1]) (auto intro: less_imp_le)  | 
|
1011  | 
||
1012  | 
lemma prodinf_nonzero:  | 
|
1013  | 
  fixes f :: "nat \<Rightarrow> 'a :: {idom,topological_semigroup_mult,t2_space}"
 | 
|
1014  | 
assumes "convergent_prod f" "\<And>i. f i \<noteq> 0"  | 
|
1015  | 
shows "prodinf f \<noteq> 0"  | 
|
1016  | 
by (metis assms convergent_prod_offset_0 has_prod_unique raw_has_prod_def has_prod_def)  | 
|
1017  | 
||
1018  | 
lemma less_0_prodinf:  | 
|
1019  | 
fixes f :: "nat \<Rightarrow> real"  | 
|
1020  | 
assumes f: "convergent_prod f" and 0: "\<And>i. f i > 0"  | 
|
1021  | 
shows "0 < prodinf f"  | 
|
1022  | 
proof -  | 
|
1023  | 
have "prodinf f \<noteq> 0"  | 
|
1024  | 
by (metis assms less_irrefl prodinf_nonzero)  | 
|
1025  | 
moreover have "0 < (\<Prod>n<i. f n)" for i  | 
|
1026  | 
by (simp add: 0 prod_pos)  | 
|
1027  | 
then have "prodinf f \<ge> 0"  | 
|
1028  | 
using convergent_prod_LIMSEQ [OF f] LIMSEQ_prod_nonneg 0 less_le by blast  | 
|
1029  | 
ultimately show ?thesis  | 
|
1030  | 
by auto  | 
|
1031  | 
qed  | 
|
1032  | 
||
1033  | 
lemma prod_less_prodinf2:  | 
|
1034  | 
fixes f :: "nat \<Rightarrow> real"  | 
|
1035  | 
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"  | 
|
1036  | 
  shows "prod f {..<n} < prodinf f"
 | 
|
1037  | 
proof -  | 
|
1038  | 
  have "prod f {..<n} \<le> prod f {..<i}"
 | 
|
1039  | 
by (rule prod_mono2) (use assms less_le in auto)  | 
|
1040  | 
  then have "prod f {..<n} < f i * prod f {..<i}"
 | 
|
1041  | 
    using mult_less_le_imp_less[of 1 "f i" "prod f {..<n}" "prod f {..<i}"] assms
 | 
|
1042  | 
by (simp add: prod_pos)  | 
|
1043  | 
  moreover have "prod f {..<Suc i} \<le> prodinf f"
 | 
|
1044  | 
using prod_le_prodinf[of f _ "Suc i"]  | 
|
1045  | 
by (meson "0" "1" Suc_leD convergent_prod_has_prod f \<open>n \<le> i\<close> le_trans less_eq_real_def)  | 
|
1046  | 
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
 | 
1047  | 
by (metis le_less_trans mult.commute not_le prod.lessThan_Suc)  | 
| 68361 | 1048  | 
qed  | 
1049  | 
||
1050  | 
lemma prod_less_prodinf:  | 
|
1051  | 
fixes f :: "nat \<Rightarrow> real"  | 
|
1052  | 
assumes f: "convergent_prod f" and 1: "\<And>m. m\<ge>n \<Longrightarrow> 1 < f m" and 0: "\<And>m. 0 < f m"  | 
|
1053  | 
  shows "prod f {..<n} < prodinf f"
 | 
|
1054  | 
by (meson "0" "1" f le_less prod_less_prodinf2)  | 
|
1055  | 
||
1056  | 
lemma raw_has_prodI_bounded:  | 
|
1057  | 
fixes f :: "nat \<Rightarrow> real"  | 
|
1058  | 
assumes pos: "\<And>n. 1 \<le> f n"  | 
|
1059  | 
and le: "\<And>n. (\<Prod>i<n. f i) \<le> x"  | 
|
1060  | 
shows "\<exists>p. raw_has_prod f 0 p"  | 
|
1061  | 
unfolding raw_has_prod_def add_0_right  | 
|
1062  | 
proof (rule exI LIMSEQ_incseq_SUP conjI)+  | 
|
1063  | 
  show "bdd_above (range (\<lambda>n. prod f {..n}))"
 | 
|
1064  | 
by (metis bdd_aboveI2 le lessThan_Suc_atMost)  | 
|
1065  | 
  then have "(SUP i. prod f {..i}) > 0"
 | 
|
1066  | 
by (metis UNIV_I cSUP_upper less_le_trans pos prod_pos zero_less_one)  | 
|
1067  | 
  then show "(SUP i. prod f {..i}) \<noteq> 0"
 | 
|
1068  | 
by auto  | 
|
1069  | 
  show "incseq (\<lambda>n. prod f {..n})"
 | 
|
1070  | 
using pos order_trans [OF zero_le_one] by (auto simp: mono_def intro!: prod_mono2)  | 
|
1071  | 
qed  | 
|
1072  | 
||
1073  | 
lemma convergent_prodI_nonneg_bounded:  | 
|
1074  | 
fixes f :: "nat \<Rightarrow> real"  | 
|
1075  | 
assumes "\<And>n. 1 \<le> f n" "\<And>n. (\<Prod>i<n. f i) \<le> x"  | 
|
1076  | 
shows "convergent_prod f"  | 
|
1077  | 
using convergent_prod_def raw_has_prodI_bounded [OF assms] by blast  | 
|
1078  | 
||
1079  | 
||
| 70136 | 1080  | 
subsection\<^marker>\<open>tag unimportant\<close> \<open>Infinite products on topological spaces\<close>  | 
| 68361 | 1081  | 
|
1082  | 
context  | 
|
1083  | 
  fixes f g :: "nat \<Rightarrow> 'a::{t2_space,topological_semigroup_mult,idom}"
 | 
|
1084  | 
begin  | 
|
1085  | 
||
1086  | 
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)"  | 
|
1087  | 
by (force simp add: prod.distrib tendsto_mult raw_has_prod_def)  | 
|
1088  | 
||
1089  | 
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)"  | 
|
1090  | 
by (simp add: raw_has_prod_mult has_prod_def)  | 
|
1091  | 
||
1092  | 
end  | 
|
1093  | 
||
1094  | 
||
1095  | 
context  | 
|
1096  | 
fixes f g :: "nat \<Rightarrow> 'a::real_normed_field"  | 
|
1097  | 
begin  | 
|
1098  | 
||
1099  | 
lemma has_prod_mult:  | 
|
1100  | 
assumes f: "f has_prod a" and g: "g has_prod b"  | 
|
1101  | 
shows "(\<lambda>n. f n * g n) has_prod (a * b)"  | 
|
1102  | 
using f [unfolded has_prod_def]  | 
|
1103  | 
proof (elim disjE exE conjE)  | 
|
1104  | 
assume f0: "raw_has_prod f 0 a"  | 
|
1105  | 
show ?thesis  | 
|
1106  | 
using g [unfolded has_prod_def]  | 
|
1107  | 
proof (elim disjE exE conjE)  | 
|
1108  | 
assume g0: "raw_has_prod g 0 b"  | 
|
1109  | 
with f0 show ?thesis  | 
|
1110  | 
by (force simp add: has_prod_def prod.distrib tendsto_mult raw_has_prod_def)  | 
|
1111  | 
next  | 
|
1112  | 
fix j q  | 
|
1113  | 
assume "b = 0" and "g j = 0" and q: "raw_has_prod g (Suc j) q"  | 
|
1114  | 
obtain p where p: "raw_has_prod f (Suc j) p"  | 
|
1115  | 
using f0 raw_has_prod_ignore_initial_segment by blast  | 
|
1116  | 
then have "Ex (raw_has_prod (\<lambda>n. f n * g n) (Suc j))"  | 
|
1117  | 
using q raw_has_prod_mult by blast  | 
|
1118  | 
then show ?thesis  | 
|
1119  | 
using \<open>b = 0\<close> \<open>g j = 0\<close> has_prod_0_iff by fastforce  | 
|
1120  | 
qed  | 
|
1121  | 
next  | 
|
1122  | 
fix i p  | 
|
1123  | 
assume "a = 0" and "f i = 0" and p: "raw_has_prod f (Suc i) p"  | 
|
1124  | 
show ?thesis  | 
|
1125  | 
using g [unfolded has_prod_def]  | 
|
1126  | 
proof (elim disjE exE conjE)  | 
|
1127  | 
assume g0: "raw_has_prod g 0 b"  | 
|
1128  | 
obtain q where q: "raw_has_prod g (Suc i) q"  | 
|
1129  | 
using g0 raw_has_prod_ignore_initial_segment by blast  | 
|
1130  | 
then have "Ex (raw_has_prod (\<lambda>n. f n * g n) (Suc i))"  | 
|
1131  | 
using raw_has_prod_mult p by blast  | 
|
1132  | 
then show ?thesis  | 
|
1133  | 
using \<open>a = 0\<close> \<open>f i = 0\<close> has_prod_0_iff by fastforce  | 
|
1134  | 
next  | 
|
1135  | 
fix j q  | 
|
1136  | 
assume "b = 0" and "g j = 0" and q: "raw_has_prod g (Suc j) q"  | 
|
1137  | 
obtain p' where p': "raw_has_prod f (Suc (max i j)) p'"  | 
|
1138  | 
by (metis raw_has_prod_ignore_initial_segment max_Suc_Suc max_def p)  | 
|
1139  | 
moreover  | 
|
1140  | 
obtain q' where q': "raw_has_prod g (Suc (max i j)) q'"  | 
|
1141  | 
by (metis raw_has_prod_ignore_initial_segment max.cobounded2 max_Suc_Suc q)  | 
|
1142  | 
ultimately show ?thesis  | 
|
1143  | 
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)  | 
|
1144  | 
qed  | 
|
1145  | 
qed  | 
|
1146  | 
||
1147  | 
lemma convergent_prod_mult:  | 
|
1148  | 
assumes f: "convergent_prod f" and g: "convergent_prod g"  | 
|
1149  | 
shows "convergent_prod (\<lambda>n. f n * g n)"  | 
|
1150  | 
unfolding convergent_prod_def  | 
|
1151  | 
proof -  | 
|
1152  | 
obtain M p N q where p: "raw_has_prod f M p" and q: "raw_has_prod g N q"  | 
|
1153  | 
using convergent_prod_def f g by blast+  | 
|
1154  | 
then obtain p' q' where p': "raw_has_prod f (max M N) p'" and q': "raw_has_prod g (max M N) q'"  | 
|
1155  | 
by (meson raw_has_prod_ignore_initial_segment max.cobounded1 max.cobounded2)  | 
|
1156  | 
then show "\<exists>M p. raw_has_prod (\<lambda>n. f n * g n) M p"  | 
|
1157  | 
using raw_has_prod_mult by blast  | 
|
1158  | 
qed  | 
|
1159  | 
||
1160  | 
lemma prodinf_mult: "convergent_prod f \<Longrightarrow> convergent_prod g \<Longrightarrow> prodinf f * prodinf g = (\<Prod>n. f n * g n)"  | 
|
1161  | 
by (intro has_prod_unique has_prod_mult convergent_prod_has_prod)  | 
|
1162  | 
||
1163  | 
end  | 
|
1164  | 
||
1165  | 
context  | 
|
1166  | 
fixes f :: "'i \<Rightarrow> nat \<Rightarrow> 'a::real_normed_field"  | 
|
1167  | 
and I :: "'i set"  | 
|
1168  | 
begin  | 
|
1169  | 
||
1170  | 
lemma has_prod_prod: "(\<And>i. i \<in> I \<Longrightarrow> (f i) has_prod (x i)) \<Longrightarrow> (\<lambda>n. \<Prod>i\<in>I. f i n) has_prod (\<Prod>i\<in>I. x i)"  | 
|
1171  | 
by (induct I rule: infinite_finite_induct) (auto intro!: has_prod_mult)  | 
|
1172  | 
||
1173  | 
lemma prodinf_prod: "(\<And>i. i \<in> I \<Longrightarrow> convergent_prod (f i)) \<Longrightarrow> (\<Prod>n. \<Prod>i\<in>I. f i n) = (\<Prod>i\<in>I. \<Prod>n. f i n)"  | 
|
1174  | 
using has_prod_unique[OF has_prod_prod, OF convergent_prod_has_prod] by simp  | 
|
1175  | 
||
1176  | 
lemma convergent_prod_prod: "(\<And>i. i \<in> I \<Longrightarrow> convergent_prod (f i)) \<Longrightarrow> convergent_prod (\<lambda>n. \<Prod>i\<in>I. f i n)"  | 
|
1177  | 
using convergent_prod_has_prod_iff has_prod_prod prodinf_prod by force  | 
|
1178  | 
||
1179  | 
end  | 
|
1180  | 
||
| 70136 | 1181  | 
subsection\<^marker>\<open>tag unimportant\<close> \<open>Infinite summability on real normed fields\<close>  | 
| 68361 | 1182  | 
|
1183  | 
context  | 
|
1184  | 
fixes f :: "nat \<Rightarrow> 'a::real_normed_field"  | 
|
1185  | 
begin  | 
|
1186  | 
||
1187  | 
lemma raw_has_prod_Suc_iff: "raw_has_prod f M (a * f M) \<longleftrightarrow> raw_has_prod (\<lambda>n. f (Suc n)) M a \<and> f M \<noteq> 0"  | 
|
1188  | 
proof -  | 
|
1189  | 
have "raw_has_prod f M (a * f M) \<longleftrightarrow> (\<lambda>i. \<Prod>j\<le>Suc i. f (j+M)) \<longlonglongrightarrow> a * f M \<and> a * f M \<noteq> 0"  | 
|
| 71827 | 1190  | 
by (subst filterlim_sequentially_Suc) (simp add: raw_has_prod_def)  | 
| 68361 | 1191  | 
also have "\<dots> \<longleftrightarrow> (\<lambda>i. (\<Prod>j\<le>i. f (Suc j + M)) * f M) \<longlonglongrightarrow> a * f M \<and> a * f M \<noteq> 0"  | 
| 
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
 | 
1192  | 
by (simp add: ac_simps atMost_Suc_eq_insert_0 image_Suc_atMost prod.atLeast1_atMost_eq lessThan_Suc_atMost  | 
| 
 
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
 | 
1193  | 
del: prod.cl_ivl_Suc)  | 
| 68361 | 1194  | 
also have "\<dots> \<longleftrightarrow> raw_has_prod (\<lambda>n. f (Suc n)) M a \<and> f M \<noteq> 0"  | 
1195  | 
proof safe  | 
|
1196  | 
assume tends: "(\<lambda>i. (\<Prod>j\<le>i. f (Suc j + M)) * f M) \<longlonglongrightarrow> a * f M" and 0: "a * f M \<noteq> 0"  | 
|
1197  | 
with tendsto_divide[OF tends tendsto_const, of "f M"]  | 
|
1198  | 
show "raw_has_prod (\<lambda>n. f (Suc n)) M a"  | 
|
1199  | 
by (simp add: raw_has_prod_def)  | 
|
1200  | 
qed (auto intro: tendsto_mult_right simp: raw_has_prod_def)  | 
|
1201  | 
finally show ?thesis .  | 
|
1202  | 
qed  | 
|
1203  | 
||
1204  | 
lemma has_prod_Suc_iff:  | 
|
1205  | 
assumes "f 0 \<noteq> 0" shows "(\<lambda>n. f (Suc n)) has_prod a \<longleftrightarrow> f has_prod (a * f 0)"  | 
|
1206  | 
proof (cases "a = 0")  | 
|
1207  | 
case True  | 
|
1208  | 
then show ?thesis  | 
|
1209  | 
proof (simp add: has_prod_def, safe)  | 
|
1210  | 
fix i x  | 
|
1211  | 
assume "f (Suc i) = 0" and "raw_has_prod (\<lambda>n. f (Suc n)) (Suc i) x"  | 
|
1212  | 
then obtain y where "raw_has_prod f (Suc (Suc i)) y"  | 
|
1213  | 
by (metis (no_types) raw_has_prod_eq_0 Suc_n_not_le_n raw_has_prod_Suc_iff raw_has_prod_ignore_initial_segment raw_has_prod_nonzero linear)  | 
|
1214  | 
then show "\<exists>i. f i = 0 \<and> Ex (raw_has_prod f (Suc i))"  | 
|
1215  | 
using \<open>f (Suc i) = 0\<close> by blast  | 
|
1216  | 
next  | 
|
1217  | 
fix i x  | 
|
1218  | 
assume "f i = 0" and x: "raw_has_prod f (Suc i) x"  | 
|
1219  | 
then obtain j where j: "i = Suc j"  | 
|
1220  | 
by (metis assms not0_implies_Suc)  | 
|
1221  | 
moreover have "\<exists> y. raw_has_prod (\<lambda>n. f (Suc n)) i y"  | 
|
1222  | 
using x by (auto simp: raw_has_prod_def)  | 
|
1223  | 
then show "\<exists>i. f (Suc i) = 0 \<and> Ex (raw_has_prod (\<lambda>n. f (Suc n)) (Suc i))"  | 
|
1224  | 
using \<open>f i = 0\<close> j by blast  | 
|
1225  | 
qed  | 
|
1226  | 
next  | 
|
1227  | 
case False  | 
|
1228  | 
then show ?thesis  | 
|
1229  | 
by (auto simp: has_prod_def raw_has_prod_Suc_iff assms)  | 
|
1230  | 
qed  | 
|
1231  | 
||
| 
73005
 
83b114a6545f
A few more simprules for iff-reasoning
 
paulson <lp15@cam.ac.uk> 
parents: 
73004 
diff
changeset
 | 
1232  | 
lemma convergent_prod_Suc_iff [simp]:  | 
| 
68452
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1233  | 
shows "convergent_prod (\<lambda>n. f (Suc n)) = convergent_prod f"  | 
| 68361 | 1234  | 
proof  | 
1235  | 
assume "convergent_prod f"  | 
|
| 
68452
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1236  | 
then obtain M L where M_nz:"\<forall>n\<ge>M. f n \<noteq> 0" and  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1237  | 
M_L:"(\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L" and "L \<noteq> 0"  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1238  | 
unfolding convergent_prod_altdef by auto  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1239  | 
have "(\<lambda>n. \<Prod>i\<le>n. f (Suc (i + M))) \<longlonglongrightarrow> L / f M"  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1240  | 
proof -  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1241  | 
    have "(\<lambda>n. \<Prod>i\<in>{0..Suc n}. f (i + M)) \<longlonglongrightarrow> L"
 | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1242  | 
using M_L  | 
| 71827 | 1243  | 
apply (subst (asm) filterlim_sequentially_Suc[symmetric])  | 
| 
68452
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1244  | 
using atLeast0AtMost by auto  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1245  | 
    then have "(\<lambda>n. f M * (\<Prod>i\<in>{0..n}. f (Suc (i + M)))) \<longlonglongrightarrow> L"
 | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1246  | 
apply (subst (asm) prod.atLeast0_atMost_Suc_shift)  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1247  | 
by simp  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1248  | 
    then have "(\<lambda>n. (\<Prod>i\<in>{0..n}. f (Suc (i + M)))) \<longlonglongrightarrow> L/f M"
 | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1249  | 
apply (drule_tac tendsto_divide)  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1250  | 
using M_nz[rule_format,of M,simplified] by auto  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1251  | 
then show ?thesis unfolding atLeast0AtMost .  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1252  | 
qed  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1253  | 
then show "convergent_prod (\<lambda>n. f (Suc n))" unfolding convergent_prod_altdef  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1254  | 
apply (rule_tac exI[where x=M])  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1255  | 
apply (rule_tac exI[where x="L/f M"])  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1256  | 
using M_nz \<open>L\<noteq>0\<close> by auto  | 
| 68361 | 1257  | 
next  | 
1258  | 
assume "convergent_prod (\<lambda>n. f (Suc n))"  | 
|
| 
68452
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1259  | 
then obtain M where "\<exists>L. (\<forall>n\<ge>M. f (Suc n) \<noteq> 0) \<and> (\<lambda>n. \<Prod>i\<le>n. f (Suc (i + M))) \<longlonglongrightarrow> L \<and> L \<noteq> 0"  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1260  | 
unfolding convergent_prod_altdef by auto  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1261  | 
then show "convergent_prod f" unfolding convergent_prod_altdef  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1262  | 
apply (rule_tac exI[where x="Suc M"])  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1263  | 
using Suc_le_D by auto  | 
| 68361 | 1264  | 
qed  | 
1265  | 
||
1266  | 
lemma raw_has_prod_inverse:  | 
|
1267  | 
assumes "raw_has_prod f M a" shows "raw_has_prod (\<lambda>n. inverse (f n)) M (inverse a)"  | 
|
1268  | 
using assms unfolding raw_has_prod_def by (auto dest: tendsto_inverse simp: prod_inversef [symmetric])  | 
|
1269  | 
||
1270  | 
lemma has_prod_inverse:  | 
|
1271  | 
assumes "f has_prod a" shows "(\<lambda>n. inverse (f n)) has_prod (inverse a)"  | 
|
1272  | 
using assms raw_has_prod_inverse unfolding has_prod_def by auto  | 
|
1273  | 
||
1274  | 
lemma convergent_prod_inverse:  | 
|
1275  | 
assumes "convergent_prod f"  | 
|
1276  | 
shows "convergent_prod (\<lambda>n. inverse (f n))"  | 
|
1277  | 
using assms unfolding convergent_prod_def by (blast intro: raw_has_prod_inverse elim: )  | 
|
1278  | 
||
1279  | 
end  | 
|
1280  | 
||
| 
68424
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1281  | 
context  | 
| 68361 | 1282  | 
fixes f :: "nat \<Rightarrow> 'a::real_normed_field"  | 
1283  | 
begin  | 
|
1284  | 
||
1285  | 
lemma raw_has_prod_Suc_iff': "raw_has_prod f M a \<longleftrightarrow> raw_has_prod (\<lambda>n. f (Suc n)) M (a / f M) \<and> f M \<noteq> 0"  | 
|
1286  | 
by (metis raw_has_prod_eq_0 add.commute add.left_neutral raw_has_prod_Suc_iff raw_has_prod_nonzero le_add1 nonzero_mult_div_cancel_right times_divide_eq_left)  | 
|
1287  | 
||
1288  | 
lemma has_prod_divide: "f has_prod a \<Longrightarrow> g has_prod b \<Longrightarrow> (\<lambda>n. f n / g n) has_prod (a / b)"  | 
|
1289  | 
unfolding divide_inverse by (intro has_prod_inverse has_prod_mult)  | 
|
1290  | 
||
1291  | 
lemma convergent_prod_divide:  | 
|
1292  | 
assumes f: "convergent_prod f" and g: "convergent_prod g"  | 
|
1293  | 
shows "convergent_prod (\<lambda>n. f n / g n)"  | 
|
1294  | 
using f g has_prod_divide has_prod_iff by blast  | 
|
1295  | 
||
1296  | 
lemma prodinf_divide: "convergent_prod f \<Longrightarrow> convergent_prod g \<Longrightarrow> prodinf f / prodinf g = (\<Prod>n. f n / g n)"  | 
|
1297  | 
by (intro has_prod_unique has_prod_divide convergent_prod_has_prod)  | 
|
1298  | 
||
1299  | 
lemma prodinf_inverse: "convergent_prod f \<Longrightarrow> (\<Prod>n. inverse (f n)) = inverse (\<Prod>n. f n)"  | 
|
1300  | 
by (intro has_prod_unique [symmetric] has_prod_inverse convergent_prod_has_prod)  | 
|
1301  | 
||
| 
68452
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1302  | 
lemma has_prod_Suc_imp:  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1303  | 
assumes "(\<lambda>n. f (Suc n)) has_prod a"  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1304  | 
shows "f has_prod (a * f 0)"  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1305  | 
proof -  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1306  | 
have "f has_prod (a * f 0)" when "raw_has_prod (\<lambda>n. f (Suc n)) 0 a"  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1307  | 
apply (cases "f 0=0")  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1308  | 
using that unfolding has_prod_def raw_has_prod_Suc  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1309  | 
by (auto simp add: raw_has_prod_Suc_iff)  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1310  | 
moreover have "f has_prod (a * f 0)" when  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1311  | 
"(\<exists>i q. a = 0 \<and> f (Suc i) = 0 \<and> raw_has_prod (\<lambda>n. f (Suc n)) (Suc i) q)"  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1312  | 
proof -  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1313  | 
from that  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1314  | 
obtain i q where "a = 0" "f (Suc i) = 0" "raw_has_prod (\<lambda>n. f (Suc n)) (Suc i) q"  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1315  | 
by auto  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1316  | 
then show ?thesis unfolding has_prod_def  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1317  | 
by (auto intro!:exI[where x="Suc i"] simp:raw_has_prod_Suc)  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1318  | 
qed  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1319  | 
ultimately show "f has_prod (a * f 0)" using assms unfolding 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
 | 
1320  | 
qed  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1321  | 
|
| 68361 | 1322  | 
lemma has_prod_iff_shift:  | 
1323  | 
assumes "\<And>i. i < n \<Longrightarrow> f i \<noteq> 0"  | 
|
1324  | 
shows "(\<lambda>i. f (i + n)) has_prod a \<longleftrightarrow> f has_prod (a * (\<Prod>i<n. f i))"  | 
|
1325  | 
using assms  | 
|
1326  | 
proof (induct n arbitrary: a)  | 
|
1327  | 
case 0  | 
|
1328  | 
then show ?case by simp  | 
|
1329  | 
next  | 
|
1330  | 
case (Suc n)  | 
|
1331  | 
then have "(\<lambda>i. f (Suc i + n)) has_prod a \<longleftrightarrow> (\<lambda>i. f (i + n)) has_prod (a * f n)"  | 
|
1332  | 
by (subst has_prod_Suc_iff) auto  | 
|
1333  | 
with Suc show ?case  | 
|
1334  | 
by (simp add: ac_simps)  | 
|
1335  | 
qed  | 
|
1336  | 
||
| 70136 | 1337  | 
corollary\<^marker>\<open>tag unimportant\<close> has_prod_iff_shift':  | 
| 68361 | 1338  | 
assumes "\<And>i. i < n \<Longrightarrow> f i \<noteq> 0"  | 
1339  | 
shows "(\<lambda>i. f (i + n)) has_prod (a / (\<Prod>i<n. f i)) \<longleftrightarrow> f has_prod a"  | 
|
1340  | 
by (simp add: assms has_prod_iff_shift)  | 
|
1341  | 
||
1342  | 
lemma has_prod_one_iff_shift:  | 
|
1343  | 
assumes "\<And>i. i < n \<Longrightarrow> f i = 1"  | 
|
1344  | 
shows "(\<lambda>i. f (i+n)) has_prod a \<longleftrightarrow> (\<lambda>i. f i) has_prod a"  | 
|
1345  | 
by (simp add: assms has_prod_iff_shift)  | 
|
1346  | 
||
| 73004 | 1347  | 
lemma convergent_prod_iff_shift [simp]:  | 
| 68361 | 1348  | 
shows "convergent_prod (\<lambda>i. f (i + n)) \<longleftrightarrow> convergent_prod f"  | 
1349  | 
apply safe  | 
|
1350  | 
using convergent_prod_offset apply blast  | 
|
1351  | 
using convergent_prod_ignore_initial_segment convergent_prod_def by blast  | 
|
1352  | 
||
1353  | 
lemma has_prod_split_initial_segment:  | 
|
1354  | 
assumes "f has_prod a" "\<And>i. i < n \<Longrightarrow> f i \<noteq> 0"  | 
|
1355  | 
shows "(\<lambda>i. f (i + n)) has_prod (a / (\<Prod>i<n. f i))"  | 
|
1356  | 
using assms has_prod_iff_shift' by blast  | 
|
1357  | 
||
1358  | 
lemma prodinf_divide_initial_segment:  | 
|
1359  | 
assumes "convergent_prod f" "\<And>i. i < n \<Longrightarrow> f i \<noteq> 0"  | 
|
1360  | 
shows "(\<Prod>i. f (i + n)) = (\<Prod>i. f i) / (\<Prod>i<n. f i)"  | 
|
1361  | 
by (rule has_prod_unique[symmetric]) (auto simp: assms has_prod_iff_shift)  | 
|
1362  | 
||
1363  | 
lemma prodinf_split_initial_segment:  | 
|
1364  | 
assumes "convergent_prod f" "\<And>i. i < n \<Longrightarrow> f i \<noteq> 0"  | 
|
1365  | 
shows "prodinf f = (\<Prod>i. f (i + n)) * (\<Prod>i<n. f i)"  | 
|
1366  | 
by (auto simp add: assms prodinf_divide_initial_segment)  | 
|
1367  | 
||
1368  | 
lemma prodinf_split_head:  | 
|
1369  | 
assumes "convergent_prod f" "f 0 \<noteq> 0"  | 
|
1370  | 
shows "(\<Prod>n. f (Suc n)) = prodinf f / f 0"  | 
|
1371  | 
using prodinf_split_initial_segment[of 1] assms by simp  | 
|
1372  | 
||
1373  | 
end  | 
|
1374  | 
||
| 
68424
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1375  | 
context  | 
| 68361 | 1376  | 
fixes f :: "nat \<Rightarrow> 'a::real_normed_field"  | 
1377  | 
begin  | 
|
1378  | 
||
| 
73005
 
83b114a6545f
A few more simprules for iff-reasoning
 
paulson <lp15@cam.ac.uk> 
parents: 
73004 
diff
changeset
 | 
1379  | 
lemma convergent_prod_inverse_iff [simp]: "convergent_prod (\<lambda>n. inverse (f n)) \<longleftrightarrow> convergent_prod f"  | 
| 68361 | 1380  | 
by (auto dest: convergent_prod_inverse)  | 
1381  | 
||
| 
73005
 
83b114a6545f
A few more simprules for iff-reasoning
 
paulson <lp15@cam.ac.uk> 
parents: 
73004 
diff
changeset
 | 
1382  | 
lemma convergent_prod_const_iff [simp]:  | 
| 68361 | 1383  | 
  fixes c :: "'a :: {real_normed_field}"
 | 
1384  | 
shows "convergent_prod (\<lambda>_. c) \<longleftrightarrow> c = 1"  | 
|
1385  | 
proof  | 
|
1386  | 
assume "convergent_prod (\<lambda>_. c)"  | 
|
1387  | 
then show "c = 1"  | 
|
1388  | 
using convergent_prod_imp_LIMSEQ LIMSEQ_unique by blast  | 
|
1389  | 
next  | 
|
1390  | 
assume "c = 1"  | 
|
1391  | 
then show "convergent_prod (\<lambda>_. c)"  | 
|
1392  | 
by auto  | 
|
1393  | 
qed  | 
|
1394  | 
||
1395  | 
lemma has_prod_power: "f has_prod a \<Longrightarrow> (\<lambda>i. f i ^ n) has_prod (a ^ n)"  | 
|
1396  | 
by (induction n) (auto simp: has_prod_mult)  | 
|
1397  | 
||
1398  | 
lemma convergent_prod_power: "convergent_prod f \<Longrightarrow> convergent_prod (\<lambda>i. f i ^ n)"  | 
|
1399  | 
by (induction n) (auto simp: convergent_prod_mult)  | 
|
1400  | 
||
1401  | 
lemma prodinf_power: "convergent_prod f \<Longrightarrow> prodinf (\<lambda>i. f i ^ n) = prodinf f ^ n"  | 
|
1402  | 
by (metis has_prod_unique convergent_prod_imp_has_prod has_prod_power)  | 
|
1403  | 
||
1404  | 
end  | 
|
1405  | 
||
| 
68424
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1406  | 
|
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1407  | 
subsection\<open>Exponentials and logarithms\<close>  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1408  | 
|
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1409  | 
context  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1410  | 
  fixes f :: "nat \<Rightarrow> 'a::{real_normed_field,banach}"
 | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1411  | 
begin  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1412  | 
|
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1413  | 
lemma sums_imp_has_prod_exp:  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1414  | 
assumes "f sums s"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1415  | 
shows "raw_has_prod (\<lambda>i. exp (f i)) 0 (exp s)"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1416  | 
using assms continuous_on_exp [of UNIV "\<lambda>x::'a. x"]  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1417  | 
  using continuous_on_tendsto_compose [of UNIV exp "(\<lambda>n. sum f {..n})" s]
 | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1418  | 
by (simp add: prod_defs sums_def_le exp_sum)  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1419  | 
|
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1420  | 
lemma convergent_prod_exp:  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1421  | 
assumes "summable f"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1422  | 
shows "convergent_prod (\<lambda>i. exp (f i))"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1423  | 
using sums_imp_has_prod_exp assms unfolding summable_def convergent_prod_def by blast  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1424  | 
|
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1425  | 
lemma prodinf_exp:  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1426  | 
assumes "summable f"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1427  | 
shows "prodinf (\<lambda>i. exp (f i)) = exp (suminf f)"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1428  | 
proof -  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1429  | 
have "f sums suminf f"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1430  | 
using assms by blast  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1431  | 
then have "(\<lambda>i. exp (f i)) has_prod exp (suminf f)"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1432  | 
by (simp add: has_prod_def sums_imp_has_prod_exp)  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1433  | 
then show ?thesis  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1434  | 
by (rule has_prod_unique [symmetric])  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1435  | 
qed  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1436  | 
|
| 68361 | 1437  | 
end  | 
| 
68424
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1438  | 
|
| 68651 | 1439  | 
theorem convergent_prod_iff_summable_real:  | 
| 68585 | 1440  | 
fixes a :: "nat \<Rightarrow> real"  | 
1441  | 
assumes "\<And>n. a n > 0"  | 
|
1442  | 
shows "convergent_prod (\<lambda>k. 1 + a k) \<longleftrightarrow> summable a" (is "?lhs = ?rhs")  | 
|
1443  | 
proof  | 
|
1444  | 
assume ?lhs  | 
|
1445  | 
then obtain p where "raw_has_prod (\<lambda>k. 1 + a k) 0 p"  | 
|
1446  | 
by (metis assms add_less_same_cancel2 convergent_prod_offset_0 not_one_less_zero)  | 
|
1447  | 
then have to_p: "(\<lambda>n. \<Prod>k\<le>n. 1 + a k) \<longlonglongrightarrow> p"  | 
|
1448  | 
by (auto simp: raw_has_prod_def)  | 
|
1449  | 
moreover have le: "(\<Sum>k\<le>n. a k) \<le> (\<Prod>k\<le>n. 1 + a k)" for n  | 
|
1450  | 
by (rule sum_le_prod) (use assms less_le in force)  | 
|
1451  | 
have "(\<Prod>k\<le>n. 1 + a k) \<le> p" for n  | 
|
1452  | 
proof (rule incseq_le [OF _ to_p])  | 
|
1453  | 
show "incseq (\<lambda>n. \<Prod>k\<le>n. 1 + a k)"  | 
|
1454  | 
using assms by (auto simp: mono_def order.strict_implies_order intro!: prod_mono2)  | 
|
1455  | 
qed  | 
|
1456  | 
with le have "(\<Sum>k\<le>n. a k) \<le> p" for n  | 
|
1457  | 
by (metis order_trans)  | 
|
1458  | 
with assms bounded_imp_summable show ?rhs  | 
|
1459  | 
by (metis not_less order.asym)  | 
|
1460  | 
next  | 
|
1461  | 
assume R: ?rhs  | 
|
1462  | 
have "(\<Prod>k\<le>n. 1 + a k) \<le> exp (suminf a)" for n  | 
|
1463  | 
proof -  | 
|
1464  | 
have "(\<Prod>k\<le>n. 1 + a k) \<le> exp (\<Sum>k\<le>n. a k)" for n  | 
|
1465  | 
by (rule prod_le_exp_sum) (use assms less_le in force)  | 
|
1466  | 
moreover have "exp (\<Sum>k\<le>n. a k) \<le> exp (suminf a)" for n  | 
|
1467  | 
unfolding exp_le_cancel_iff  | 
|
1468  | 
by (meson sum_le_suminf R assms finite_atMost less_eq_real_def)  | 
|
1469  | 
ultimately show ?thesis  | 
|
1470  | 
by (meson order_trans)  | 
|
1471  | 
qed  | 
|
1472  | 
then obtain L where L: "(\<lambda>n. \<Prod>k\<le>n. 1 + a k) \<longlonglongrightarrow> L"  | 
|
1473  | 
by (metis assms bounded_imp_convergent_prod convergent_prod_iff_nz_lim le_add_same_cancel1 le_add_same_cancel2 less_le not_le zero_le_one)  | 
|
1474  | 
moreover have "L \<noteq> 0"  | 
|
1475  | 
proof  | 
|
1476  | 
assume "L = 0"  | 
|
1477  | 
with L have "(\<lambda>n. \<Prod>k\<le>n. 1 + a k) \<longlonglongrightarrow> 0"  | 
|
1478  | 
by simp  | 
|
1479  | 
moreover have "(\<Prod>k\<le>n. 1 + a k) > 1" for n  | 
|
1480  | 
by (simp add: assms less_1_prod)  | 
|
1481  | 
ultimately show False  | 
|
1482  | 
by (meson Lim_bounded2 not_one_le_zero less_imp_le)  | 
|
1483  | 
qed  | 
|
1484  | 
ultimately show ?lhs  | 
|
1485  | 
using assms convergent_prod_iff_nz_lim  | 
|
1486  | 
by (metis add_less_same_cancel1 less_le not_le zero_less_one)  | 
|
1487  | 
qed  | 
|
1488  | 
||
| 
68452
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1489  | 
lemma exp_suminf_prodinf_real:  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1490  | 
fixes f :: "nat \<Rightarrow> real"  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1491  | 
assumes ge0:"\<And>n. f n \<ge> 0" and ac: "abs_convergent_prod (\<lambda>n. exp (f n))"  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1492  | 
shows "prodinf (\<lambda>i. exp (f i)) = exp (suminf f)"  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1493  | 
proof -  | 
| 68517 | 1494  | 
have "summable f"  | 
| 
68452
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1495  | 
using ac unfolding abs_convergent_prod_conv_summable  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1496  | 
proof (elim summable_comparison_test')  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1497  | 
fix n  | 
| 68517 | 1498  | 
have "\<bar>f n\<bar> = f n"  | 
1499  | 
by (simp add: ge0)  | 
|
1500  | 
also have "\<dots> \<le> exp (f n) - 1"  | 
|
1501  | 
by (metis diff_diff_add exp_ge_add_one_self ge_iff_diff_ge_0)  | 
|
1502  | 
finally show "norm (f n) \<le> norm (exp (f n) - 1)"  | 
|
1503  | 
by simp  | 
|
| 
68452
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1504  | 
qed  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1505  | 
then show ?thesis  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1506  | 
by (simp add: prodinf_exp)  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1507  | 
qed  | 
| 
 
c027dfbfad30
more on infinite products. Also subgroup_imp_subset -> subgroup.subset
 
paulson <lp15@cam.ac.uk> 
parents: 
68426 
diff
changeset
 | 
1508  | 
|
| 
68424
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1509  | 
lemma has_prod_imp_sums_ln_real:  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1510  | 
fixes f :: "nat \<Rightarrow> real"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1511  | 
assumes "raw_has_prod f 0 p" and 0: "\<And>x. f x > 0"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1512  | 
shows "(\<lambda>i. ln (f i)) sums (ln p)"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1513  | 
proof -  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1514  | 
have "p > 0"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1515  | 
using assms unfolding prod_defs by (metis LIMSEQ_prod_nonneg less_eq_real_def)  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1516  | 
then show ?thesis  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1517  | 
  using assms continuous_on_ln [of "{0<..}" "\<lambda>x. x"]
 | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1518  | 
  using continuous_on_tendsto_compose [of "{0<..}" ln "(\<lambda>n. prod f {..n})" p]
 | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1519  | 
by (auto simp: prod_defs sums_def_le ln_prod order_tendstoD)  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1520  | 
qed  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1521  | 
|
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1522  | 
lemma summable_ln_real:  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1523  | 
fixes f :: "nat \<Rightarrow> real"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1524  | 
assumes f: "convergent_prod f" and 0: "\<And>x. f x > 0"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1525  | 
shows "summable (\<lambda>i. ln (f i))"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1526  | 
proof -  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1527  | 
obtain M p where "raw_has_prod f M p"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1528  | 
using f convergent_prod_def by blast  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1529  | 
then consider i where "i<M" "f i = 0" | p where "raw_has_prod f 0 p"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1530  | 
using raw_has_prod_cases by blast  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1531  | 
then show ?thesis  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1532  | 
proof cases  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1533  | 
case 1  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1534  | 
with 0 show ?thesis  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1535  | 
by (metis less_irrefl)  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1536  | 
next  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1537  | 
case 2  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1538  | 
then show ?thesis  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1539  | 
using "0" has_prod_imp_sums_ln_real summable_def by blast  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1540  | 
qed  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1541  | 
qed  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1542  | 
|
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1543  | 
lemma suminf_ln_real:  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1544  | 
fixes f :: "nat \<Rightarrow> real"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1545  | 
assumes f: "convergent_prod f" and 0: "\<And>x. f x > 0"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1546  | 
shows "suminf (\<lambda>i. ln (f i)) = ln (prodinf f)"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1547  | 
proof -  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1548  | 
have "f has_prod prodinf f"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1549  | 
by (simp add: f has_prod_iff)  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1550  | 
then have "raw_has_prod f 0 (prodinf f)"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1551  | 
by (metis "0" has_prod_def less_irrefl)  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1552  | 
then have "(\<lambda>i. ln (f i)) sums ln (prodinf f)"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1553  | 
using "0" has_prod_imp_sums_ln_real by blast  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1554  | 
then show ?thesis  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1555  | 
by (rule sums_unique [symmetric])  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1556  | 
qed  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1557  | 
|
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1558  | 
lemma prodinf_exp_real:  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1559  | 
fixes f :: "nat \<Rightarrow> real"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1560  | 
assumes f: "convergent_prod f" and 0: "\<And>x. f x > 0"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1561  | 
shows "prodinf f = exp (suminf (\<lambda>i. ln (f i)))"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1562  | 
by (simp add: "0" f less_0_prodinf suminf_ln_real)  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1563  | 
|
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1564  | 
|
| 68651 | 1565  | 
theorem Ln_prodinf_complex:  | 
| 68585 | 1566  | 
fixes z :: "nat \<Rightarrow> complex"  | 
1567  | 
assumes z: "\<And>j. z j \<noteq> 0" and \<xi>: "\<xi> \<noteq> 0"  | 
|
1568  | 
shows "((\<lambda>n. \<Prod>j\<le>n. z j) \<longlonglongrightarrow> \<xi>) \<longleftrightarrow> (\<exists>k. (\<lambda>n. (\<Sum>j\<le>n. Ln (z j))) \<longlonglongrightarrow> Ln \<xi> + of_int k * (of_real(2*pi) * \<i>))" (is "?lhs = ?rhs")  | 
|
1569  | 
proof  | 
|
1570  | 
assume L: ?lhs  | 
|
1571  | 
have pnz: "(\<Prod>j\<le>n. z j) \<noteq> 0" for n  | 
|
1572  | 
using z by auto  | 
|
1573  | 
define \<Theta> where "\<Theta> \<equiv> Arg \<xi> + 2*pi"  | 
|
1574  | 
then have "\<Theta> > pi"  | 
|
1575  | 
using Arg_def mpi_less_Im_Ln by fastforce  | 
|
1576  | 
have \<xi>_eq: "\<xi> = cmod \<xi> * exp (\<i> * \<Theta>)"  | 
|
1577  | 
using Arg_def Arg_eq \<xi> unfolding \<Theta>_def by (simp add: algebra_simps exp_add)  | 
|
1578  | 
  define \<theta> where "\<theta> \<equiv> \<lambda>n. THE t. is_Arg (\<Prod>j\<le>n. z j) t \<and> t \<in> {\<Theta>-pi<..\<Theta>+pi}"
 | 
|
1579  | 
  have uniq: "\<exists>!s. is_Arg (\<Prod>j\<le>n. z j) s \<and> s \<in> {\<Theta>-pi<..\<Theta>+pi}" for n
 | 
|
1580  | 
using Argument_exists_unique [OF pnz] by metis  | 
|
1581  | 
  have \<theta>: "is_Arg (\<Prod>j\<le>n. z j) (\<theta> n)" and \<theta>_interval: "\<theta> n \<in> {\<Theta>-pi<..\<Theta>+pi}" for n
 | 
|
1582  | 
unfolding \<theta>_def  | 
|
1583  | 
using theI' [OF uniq] by metis+  | 
|
1584  | 
have \<theta>_pos: "\<And>j. \<theta> j > 0"  | 
|
1585  | 
using \<theta>_interval \<open>\<Theta> > pi\<close> by simp (meson diff_gt_0_iff_gt less_trans)  | 
|
1586  | 
have "(\<Prod>j\<le>n. z j) = cmod (\<Prod>j\<le>n. z j) * exp (\<i> * \<theta> n)" for n  | 
|
1587  | 
using \<theta> by (auto simp: is_Arg_def)  | 
|
1588  | 
then have eq: "(\<lambda>n. \<Prod>j\<le>n. z j) = (\<lambda>n. cmod (\<Prod>j\<le>n. z j) * exp (\<i> * \<theta> n))"  | 
|
1589  | 
by simp  | 
|
1590  | 
then have "(\<lambda>n. (cmod (\<Prod>j\<le>n. z j)) * exp (\<i> * (\<theta> n))) \<longlonglongrightarrow> \<xi>"  | 
|
1591  | 
using L by force  | 
|
1592  | 
then obtain k where k: "(\<lambda>j. \<theta> j - of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>"  | 
|
1593  | 
using L by (subst (asm) \<xi>_eq) (auto simp add: eq z \<xi> polar_convergence)  | 
|
1594  | 
moreover have "\<forall>\<^sub>F n in sequentially. k n = 0"  | 
|
1595  | 
proof -  | 
|
1596  | 
    have *: "kj = 0" if "dist (vj - real_of_int kj * 2) V < 1" "vj \<in> {V - 1<..V + 1}" for kj vj V
 | 
|
1597  | 
using that by (auto simp: dist_norm)  | 
|
1598  | 
have "\<forall>\<^sub>F j in sequentially. dist (\<theta> j - of_int (k j) * (2 * pi)) \<Theta> < pi"  | 
|
1599  | 
using tendstoD [OF k] pi_gt_zero by blast  | 
|
1600  | 
then show ?thesis  | 
|
1601  | 
proof (rule eventually_mono)  | 
|
1602  | 
fix j  | 
|
1603  | 
assume d: "dist (\<theta> j - real_of_int (k j) * (2 * pi)) \<Theta> < pi"  | 
|
1604  | 
show "k j = 0"  | 
|
1605  | 
by (rule * [of "\<theta> j/pi" _ "\<Theta>/pi"])  | 
|
1606  | 
(use \<theta>_interval [of j] d in \<open>simp_all add: divide_simps dist_norm\<close>)  | 
|
1607  | 
qed  | 
|
1608  | 
qed  | 
|
1609  | 
ultimately have \<theta>to\<Theta>: "\<theta> \<longlonglongrightarrow> \<Theta>"  | 
|
1610  | 
apply (simp only: tendsto_def)  | 
|
1611  | 
apply (erule all_forward imp_forward asm_rl)+  | 
|
1612  | 
apply (drule (1) eventually_conj)  | 
|
1613  | 
apply (auto elim: eventually_mono)  | 
|
1614  | 
done  | 
|
1615  | 
then have to0: "(\<lambda>n. \<bar>\<theta> (Suc n) - \<theta> n\<bar>) \<longlonglongrightarrow> 0"  | 
|
1616  | 
by (metis (full_types) diff_self filterlim_sequentially_Suc tendsto_diff tendsto_rabs_zero)  | 
|
1617  | 
have "\<exists>k. Im (\<Sum>j\<le>n. Ln (z j)) - of_int k * (2*pi) = \<theta> n" for n  | 
|
1618  | 
proof (rule is_Arg_exp_diff_2pi)  | 
|
1619  | 
show "is_Arg (exp (\<Sum>j\<le>n. Ln (z j))) (\<theta> n)"  | 
|
1620  | 
using pnz \<theta> by (simp add: is_Arg_def exp_sum prod_norm)  | 
|
1621  | 
qed  | 
|
1622  | 
then have "\<exists>k. (\<Sum>j\<le>n. Im (Ln (z j))) = \<theta> n + of_int k * (2*pi)" for n  | 
|
1623  | 
by (simp add: algebra_simps)  | 
|
1624  | 
then obtain k where k: "\<And>n. (\<Sum>j\<le>n. Im (Ln (z j))) = \<theta> n + of_int (k n) * (2*pi)"  | 
|
1625  | 
by metis  | 
|
1626  | 
obtain K where "\<forall>\<^sub>F n in sequentially. k n = K"  | 
|
1627  | 
proof -  | 
|
1628  | 
have k_le: "(2*pi) * \<bar>k (Suc n) - k n\<bar> \<le> \<bar>\<theta> (Suc n) - \<theta> n\<bar> + \<bar>Im (Ln (z (Suc n)))\<bar>" for n  | 
|
1629  | 
proof -  | 
|
1630  | 
have "(\<Sum>j\<le>Suc n. Im (Ln (z j))) - (\<Sum>j\<le>n. Im (Ln (z j))) = Im (Ln (z (Suc n)))"  | 
|
1631  | 
by simp  | 
|
1632  | 
then show ?thesis  | 
|
1633  | 
using k [of "Suc n"] k [of n] by (auto simp: abs_if algebra_simps)  | 
|
1634  | 
qed  | 
|
1635  | 
have "z \<longlonglongrightarrow> 1"  | 
|
1636  | 
using L \<xi> convergent_prod_iff_nz_lim z by (blast intro: convergent_prod_imp_LIMSEQ)  | 
|
1637  | 
with z have "(\<lambda>n. Ln (z n)) \<longlonglongrightarrow> Ln 1"  | 
|
1638  | 
using isCont_tendsto_compose [OF continuous_at_Ln] nonpos_Reals_one_I by blast  | 
|
1639  | 
then have "(\<lambda>n. Ln (z n)) \<longlonglongrightarrow> 0"  | 
|
1640  | 
by simp  | 
|
1641  | 
then have "(\<lambda>n. \<bar>Im (Ln (z (Suc n)))\<bar>) \<longlonglongrightarrow> 0"  | 
|
1642  | 
by (metis LIMSEQ_unique \<open>z \<longlonglongrightarrow> 1\<close> continuous_at_Ln filterlim_sequentially_Suc isCont_tendsto_compose nonpos_Reals_one_I tendsto_Im tendsto_rabs_zero_iff zero_complex.simps(2))  | 
|
1643  | 
then have "\<forall>\<^sub>F n in sequentially. \<bar>Im (Ln (z (Suc n)))\<bar> < 1"  | 
|
1644  | 
by (simp add: order_tendsto_iff)  | 
|
1645  | 
moreover have "\<forall>\<^sub>F n in sequentially. \<bar>\<theta> (Suc n) - \<theta> n\<bar> < 1"  | 
|
1646  | 
using to0 by (simp add: order_tendsto_iff)  | 
|
1647  | 
ultimately have "\<forall>\<^sub>F n in sequentially. (2*pi) * \<bar>k (Suc n) - k n\<bar> < 1 + 1"  | 
|
1648  | 
proof (rule eventually_elim2)  | 
|
1649  | 
fix n  | 
|
1650  | 
assume "\<bar>Im (Ln (z (Suc n)))\<bar> < 1" and "\<bar>\<theta> (Suc n) - \<theta> n\<bar> < 1"  | 
|
1651  | 
with k_le [of n] show "2 * pi * real_of_int \<bar>k (Suc n) - k n\<bar> < 1 + 1"  | 
|
1652  | 
by linarith  | 
|
1653  | 
qed  | 
|
1654  | 
then have "\<forall>\<^sub>F n in sequentially. real_of_int\<bar>k (Suc n) - k n\<bar> < 1"  | 
|
1655  | 
proof (rule eventually_mono)  | 
|
1656  | 
fix n :: "nat"  | 
|
1657  | 
assume "2 * pi * \<bar>k (Suc n) - k n\<bar> < 1 + 1"  | 
|
1658  | 
then have "\<bar>k (Suc n) - k n\<bar> < 2 / (2*pi)"  | 
|
1659  | 
by (simp add: field_simps)  | 
|
1660  | 
also have "... < 1"  | 
|
1661  | 
using pi_ge_two by auto  | 
|
1662  | 
finally show "real_of_int \<bar>k (Suc n) - k n\<bar> < 1" .  | 
|
1663  | 
qed  | 
|
1664  | 
then obtain N where N: "\<And>n. n\<ge>N \<Longrightarrow> \<bar>k (Suc n) - k n\<bar> = 0"  | 
|
1665  | 
using eventually_sequentially less_irrefl of_int_abs by fastforce  | 
|
1666  | 
have "k (N+i) = k N" for i  | 
|
1667  | 
proof (induction i)  | 
|
1668  | 
case (Suc i)  | 
|
1669  | 
with N [of "N+i"] show ?case  | 
|
1670  | 
by auto  | 
|
1671  | 
qed simp  | 
|
1672  | 
then have "\<And>n. n\<ge>N \<Longrightarrow> k n = k N"  | 
|
1673  | 
using le_Suc_ex by auto  | 
|
1674  | 
then show ?thesis  | 
|
1675  | 
by (force simp add: eventually_sequentially intro: that)  | 
|
1676  | 
qed  | 
|
1677  | 
with \<theta>to\<Theta> have "(\<lambda>n. (\<Sum>j\<le>n. Im (Ln (z j)))) \<longlonglongrightarrow> \<Theta> + of_int K * (2*pi)"  | 
|
| 
70365
 
4df0628e8545
a few new lemmas and a bit of tidying
 
paulson <lp15@cam.ac.uk> 
parents: 
70136 
diff
changeset
 | 
1678  | 
by (simp add: k tendsto_add tendsto_mult tendsto_eventually)  | 
| 68585 | 1679  | 
moreover have "(\<lambda>n. (\<Sum>k\<le>n. Re (Ln (z k)))) \<longlonglongrightarrow> Re (Ln \<xi>)"  | 
1680  | 
using assms continuous_imp_tendsto [OF isCont_ln tendsto_norm [OF L]]  | 
|
1681  | 
by (simp add: o_def flip: prod_norm ln_prod)  | 
|
1682  | 
ultimately show ?rhs  | 
|
1683  | 
by (rule_tac x="K+1" in exI) (auto simp: tendsto_complex_iff \<Theta>_def Arg_def assms algebra_simps)  | 
|
1684  | 
next  | 
|
1685  | 
assume ?rhs  | 
|
1686  | 
then obtain r where r: "(\<lambda>n. (\<Sum>k\<le>n. Ln (z k))) \<longlonglongrightarrow> Ln \<xi> + of_int r * (of_real(2*pi) * \<i>)" ..  | 
|
1687  | 
have "(\<lambda>n. exp (\<Sum>k\<le>n. Ln (z k))) \<longlonglongrightarrow> \<xi>"  | 
|
1688  | 
using assms continuous_imp_tendsto [OF isCont_exp r] exp_integer_2pi [of r]  | 
|
1689  | 
by (simp add: o_def exp_add algebra_simps)  | 
|
1690  | 
moreover have "exp (\<Sum>k\<le>n. Ln (z k)) = (\<Prod>k\<le>n. z k)" for n  | 
|
1691  | 
by (simp add: exp_sum add_eq_0_iff assms)  | 
|
1692  | 
ultimately show ?lhs  | 
|
1693  | 
by auto  | 
|
1694  | 
qed  | 
|
1695  | 
||
1696  | 
text\<open>Prop 17.2 of Bak and Newman, Complex Analysis, p.242\<close>  | 
|
1697  | 
proposition convergent_prod_iff_summable_complex:  | 
|
1698  | 
fixes z :: "nat \<Rightarrow> complex"  | 
|
1699  | 
assumes "\<And>k. z k \<noteq> 0"  | 
|
1700  | 
shows "convergent_prod (\<lambda>k. z k) \<longleftrightarrow> summable (\<lambda>k. Ln (z k))" (is "?lhs = ?rhs")  | 
|
1701  | 
proof  | 
|
1702  | 
assume ?lhs  | 
|
1703  | 
then obtain p where p: "(\<lambda>n. \<Prod>k\<le>n. z k) \<longlonglongrightarrow> p" and "p \<noteq> 0"  | 
|
1704  | 
using convergent_prod_LIMSEQ prodinf_nonzero add_eq_0_iff assms by fastforce  | 
|
1705  | 
then show ?rhs  | 
|
1706  | 
using Ln_prodinf_complex assms  | 
|
1707  | 
by (auto simp: prodinf_nonzero summable_def sums_def_le)  | 
|
1708  | 
next  | 
|
1709  | 
assume R: ?rhs  | 
|
1710  | 
have "(\<Prod>k\<le>n. z k) = exp (\<Sum>k\<le>n. Ln (z k))" for n  | 
|
1711  | 
by (simp add: exp_sum add_eq_0_iff assms)  | 
|
1712  | 
then have "(\<lambda>n. \<Prod>k\<le>n. z k) \<longlonglongrightarrow> exp (suminf (\<lambda>k. Ln (z k)))"  | 
|
1713  | 
using continuous_imp_tendsto [OF isCont_exp summable_LIMSEQ' [OF R]] by (simp add: o_def)  | 
|
1714  | 
then show ?lhs  | 
|
1715  | 
by (subst convergent_prod_iff_convergent) (auto simp: convergent_def tendsto_Lim assms add_eq_0_iff)  | 
|
1716  | 
qed  | 
|
1717  | 
||
| 
68586
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1718  | 
text\<open>Prop 17.3 of Bak and Newman, Complex Analysis\<close>  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1719  | 
proposition summable_imp_convergent_prod_complex:  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1720  | 
fixes z :: "nat \<Rightarrow> complex"  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1721  | 
assumes z: "summable (\<lambda>k. norm (z k))" and non0: "\<And>k. z k \<noteq> -1"  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1722  | 
shows "convergent_prod (\<lambda>k. 1 + z k)"  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1723  | 
proof -  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1724  | 
note if_cong [cong] power_Suc [simp del]  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1725  | 
obtain N where N: "\<And>k. k\<ge>N \<Longrightarrow> norm (z k) < 1/2"  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1726  | 
using summable_LIMSEQ_zero [OF z]  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1727  | 
by (metis diff_zero dist_norm half_gt_zero_iff less_numeral_extra(1) lim_sequentially tendsto_norm_zero_iff)  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1728  | 
have "norm (Ln (1 + z k)) \<le> 2 * norm (z k)" if "k \<ge> N" for k  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1729  | 
proof (cases "z k = 0")  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1730  | 
case False  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1731  | 
let ?f = "\<lambda>i. cmod ((- 1) ^ i * z k ^ i / of_nat (Suc i))"  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1732  | 
have normf: "norm (?f n) \<le> (1 / 2) ^ n" for n  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1733  | 
proof -  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1734  | 
have "norm (?f n) = cmod (z k) ^ n / cmod (1 + of_nat n)"  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1735  | 
by (auto simp: norm_divide norm_mult norm_power)  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1736  | 
also have "\<dots> \<le> cmod (z k) ^ n"  | 
| 
70817
 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 
haftmann 
parents: 
70365 
diff
changeset
 | 
1737  | 
by (auto simp: field_split_simps mult_le_cancel_left1 in_Reals_norm)  | 
| 
68586
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1738  | 
also have "\<dots> \<le> (1 / 2) ^ n"  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1739  | 
using N [OF that] by (simp add: power_mono)  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1740  | 
finally show "norm (?f n) \<le> (1 / 2) ^ n" .  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1741  | 
qed  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1742  | 
have summablef: "summable ?f"  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1743  | 
by (intro normf summable_comparison_test' [OF summable_geometric [of "1/2"]]) auto  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1744  | 
have "(\<lambda>n. (- 1) ^ Suc n / of_nat n * z k ^ n) sums Ln (1 + z k)"  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1745  | 
using Ln_series [of "z k"] N that by fastforce  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1746  | 
then have *: "(\<lambda>i. z k * (((- 1) ^ i * z k ^ i) / (Suc i))) sums Ln (1 + z k)"  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1747  | 
using sums_split_initial_segment [where n= 1] by (force simp: power_Suc mult_ac)  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1748  | 
then have "norm (Ln (1 + z k)) = norm (suminf (\<lambda>i. z k * (((- 1) ^ i * z k ^ i) / (Suc i))))"  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1749  | 
using sums_unique by force  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1750  | 
also have "\<dots> = norm (z k * suminf (\<lambda>i. ((- 1) ^ i * z k ^ i) / (Suc i)))"  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1751  | 
apply (subst suminf_mult)  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1752  | 
using * False  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1753  | 
by (auto simp: sums_summable intro: summable_mult_D [of "z k"])  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1754  | 
also have "\<dots> = norm (z k) * norm (suminf (\<lambda>i. ((- 1) ^ i * z k ^ i) / (Suc i)))"  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1755  | 
by (simp add: norm_mult)  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1756  | 
also have "\<dots> \<le> norm (z k) * suminf (\<lambda>i. norm (((- 1) ^ i * z k ^ i) / (Suc i)))"  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1757  | 
by (intro mult_left_mono summable_norm summablef) auto  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1758  | 
also have "\<dots> \<le> norm (z k) * suminf (\<lambda>i. (1/2) ^ i)"  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1759  | 
by (intro mult_left_mono suminf_le) (use summable_geometric [of "1/2"] summablef normf in auto)  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1760  | 
also have "\<dots> \<le> norm (z k) * 2"  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1761  | 
using suminf_geometric [of "1/2::real"] by simp  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1762  | 
finally show ?thesis  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1763  | 
by (simp add: mult_ac)  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1764  | 
qed simp  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1765  | 
then have "summable (\<lambda>k. Ln (1 + z k))"  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1766  | 
by (metis summable_comparison_test summable_mult z)  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1767  | 
with non0 show ?thesis  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1768  | 
by (simp add: add_eq_0_iff convergent_prod_iff_summable_complex)  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1769  | 
qed  | 
| 
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1770  | 
|
| 68616 | 1771  | 
lemma summable_Ln_complex:  | 
1772  | 
fixes z :: "nat \<Rightarrow> complex"  | 
|
1773  | 
assumes "convergent_prod z" "\<And>k. z k \<noteq> 0"  | 
|
1774  | 
shows "summable (\<lambda>k. Ln (z k))"  | 
|
1775  | 
using convergent_prod_def assms convergent_prod_iff_summable_complex by blast  | 
|
1776  | 
||
| 
68586
 
006da53a8ac1
infinite products: the final piece
 
paulson <lp15@cam.ac.uk> 
parents: 
68585 
diff
changeset
 | 
1777  | 
|
| 70136 | 1778  | 
subsection\<^marker>\<open>tag unimportant\<close> \<open>Embeddings from the reals into some complete real normed field\<close>  | 
| 
68424
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1779  | 
|
| 68426 | 1780  | 
lemma tendsto_eq_of_real_lim:  | 
| 
68424
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1781  | 
  assumes "(\<lambda>n. of_real (f n) :: 'a::{complete_space,real_normed_field}) \<longlonglongrightarrow> q"
 | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1782  | 
shows "q = of_real (lim f)"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1783  | 
proof -  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1784  | 
have "convergent (\<lambda>n. of_real (f n) :: 'a)"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1785  | 
using assms convergent_def by blast  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1786  | 
then have "convergent f"  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1787  | 
unfolding convergent_def  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1788  | 
by (simp add: convergent_eq_Cauchy Cauchy_def)  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1789  | 
then show ?thesis  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1790  | 
by (metis LIMSEQ_unique assms convergentD sequentially_bot tendsto_Lim tendsto_of_real)  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1791  | 
qed  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1792  | 
|
| 68426 | 1793  | 
lemma tendsto_eq_of_real:  | 
| 
68424
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1794  | 
  assumes "(\<lambda>n. of_real (f n) :: 'a::{complete_space,real_normed_field}) \<longlonglongrightarrow> q"
 | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1795  | 
obtains r where "q = of_real r"  | 
| 68426 | 1796  | 
using tendsto_eq_of_real_lim assms by blast  | 
| 
68424
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1797  | 
|
| 
73005
 
83b114a6545f
A few more simprules for iff-reasoning
 
paulson <lp15@cam.ac.uk> 
parents: 
73004 
diff
changeset
 | 
1798  | 
lemma has_prod_of_real_iff [simp]:  | 
| 
68424
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1799  | 
  "(\<lambda>n. of_real (f n) :: 'a::{complete_space,real_normed_field}) has_prod of_real c \<longleftrightarrow> f has_prod c"
 | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1800  | 
(is "?lhs = ?rhs")  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1801  | 
proof  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1802  | 
assume ?lhs  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1803  | 
then show ?rhs  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1804  | 
apply (auto simp: prod_defs LIMSEQ_prod_0 tendsto_of_real_iff simp flip: of_real_prod)  | 
| 68426 | 1805  | 
using tendsto_eq_of_real  | 
| 
68424
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1806  | 
by (metis of_real_0 tendsto_of_real_iff)  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1807  | 
next  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1808  | 
assume ?rhs  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1809  | 
with tendsto_of_real_iff show ?lhs  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1810  | 
by (fastforce simp: prod_defs simp flip: of_real_prod)  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1811  | 
qed  | 
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1812  | 
|
| 
 
02e5a44ffe7d
the last of the infinite product proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
68361 
diff
changeset
 | 
1813  | 
end  |