author | paulson |
Fri, 25 Sep 2009 13:47:28 +0100 | |
changeset 32707 | 836ec9d0a0c8 |
parent 31336 | e17f13cd1280 |
child 32877 | 6f09346c7c08 |
permissions | -rw-r--r-- |
10751 | 1 |
(* Title : Series.thy |
2 |
Author : Jacques D. Fleuriot |
|
3 |
Copyright : 1998 University of Cambridge |
|
14416 | 4 |
|
5 |
Converted to Isar and polished by lcp |
|
15539 | 6 |
Converted to setsum and polished yet more by TNN |
16819 | 7 |
Additional contributions by Jeremy Avigad |
10751 | 8 |
*) |
9 |
||
14416 | 10 |
header{*Finite Summation and Infinite Series*} |
10751 | 11 |
|
15131 | 12 |
theory Series |
29197
6d4cb27ed19c
adapted HOL source structure to distribution layout
haftmann
parents:
28952
diff
changeset
|
13 |
imports SEQ |
15131 | 14 |
begin |
15561 | 15 |
|
19765 | 16 |
definition |
20692 | 17 |
sums :: "(nat \<Rightarrow> 'a::real_normed_vector) \<Rightarrow> 'a \<Rightarrow> bool" |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21141
diff
changeset
|
18 |
(infixr "sums" 80) where |
19765 | 19 |
"f sums s = (%n. setsum f {0..<n}) ----> s" |
10751 | 20 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21141
diff
changeset
|
21 |
definition |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21141
diff
changeset
|
22 |
summable :: "(nat \<Rightarrow> 'a::real_normed_vector) \<Rightarrow> bool" where |
19765 | 23 |
"summable f = (\<exists>s. f sums s)" |
14416 | 24 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21141
diff
changeset
|
25 |
definition |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21141
diff
changeset
|
26 |
suminf :: "(nat \<Rightarrow> 'a::real_normed_vector) \<Rightarrow> 'a" where |
20688 | 27 |
"suminf f = (THE s. f sums s)" |
14416 | 28 |
|
15546 | 29 |
syntax |
20692 | 30 |
"_suminf" :: "idt \<Rightarrow> 'a \<Rightarrow> 'a" ("\<Sum>_. _" [0, 10] 10) |
15546 | 31 |
translations |
20770 | 32 |
"\<Sum>i. b" == "CONST suminf (%i. b)" |
15546 | 33 |
|
14416 | 34 |
|
15539 | 35 |
lemma sumr_diff_mult_const: |
36 |
"setsum f {0..<n} - (real n*r) = setsum (%i. f i - r) {0..<n::nat}" |
|
15536 | 37 |
by (simp add: diff_minus setsum_addf real_of_nat_def) |
38 |
||
15542 | 39 |
lemma real_setsum_nat_ivl_bounded: |
40 |
"(!!p. p < n \<Longrightarrow> f(p) \<le> K) |
|
41 |
\<Longrightarrow> setsum f {0..<n::nat} \<le> real n * K" |
|
42 |
using setsum_bounded[where A = "{0..<n}"] |
|
43 |
by (auto simp:real_of_nat_def) |
|
14416 | 44 |
|
15539 | 45 |
(* Generalize from real to some algebraic structure? *) |
46 |
lemma sumr_minus_one_realpow_zero [simp]: |
|
15543 | 47 |
"(\<Sum>i=0..<2*n. (-1) ^ Suc i) = (0::real)" |
15251 | 48 |
by (induct "n", auto) |
14416 | 49 |
|
15539 | 50 |
(* FIXME this is an awful lemma! *) |
51 |
lemma sumr_one_lb_realpow_zero [simp]: |
|
52 |
"(\<Sum>n=Suc 0..<n. f(n) * (0::real) ^ n) = 0" |
|
20692 | 53 |
by (rule setsum_0', simp) |
14416 | 54 |
|
15543 | 55 |
lemma sumr_group: |
15539 | 56 |
"(\<Sum>m=0..<n::nat. setsum f {m * k ..< m*k + k}) = setsum f {0 ..< n * k}" |
15543 | 57 |
apply (subgoal_tac "k = 0 | 0 < k", auto) |
15251 | 58 |
apply (induct "n") |
15539 | 59 |
apply (simp_all add: setsum_add_nat_ivl add_commute) |
14416 | 60 |
done |
15539 | 61 |
|
20692 | 62 |
lemma sumr_offset3: |
63 |
"setsum f {0::nat..<n+k} = (\<Sum>m=0..<n. f (m+k)) + setsum f {0..<k}" |
|
64 |
apply (subst setsum_shift_bounds_nat_ivl [symmetric]) |
|
65 |
apply (simp add: setsum_add_nat_ivl add_commute) |
|
66 |
done |
|
67 |
||
16819 | 68 |
lemma sumr_offset: |
20692 | 69 |
fixes f :: "nat \<Rightarrow> 'a::ab_group_add" |
70 |
shows "(\<Sum>m=0..<n. f(m+k)) = setsum f {0..<n+k} - setsum f {0..<k}" |
|
71 |
by (simp add: sumr_offset3) |
|
16819 | 72 |
|
73 |
lemma sumr_offset2: |
|
74 |
"\<forall>f. (\<Sum>m=0..<n::nat. f(m+k)::real) = setsum f {0..<n+k} - setsum f {0..<k}" |
|
20692 | 75 |
by (simp add: sumr_offset) |
16819 | 76 |
|
77 |
lemma sumr_offset4: |
|
20692 | 78 |
"\<forall>n f. setsum f {0::nat..<n+k} = (\<Sum>m=0..<n. f (m+k)::real) + setsum f {0..<k}" |
79 |
by (clarify, rule sumr_offset3) |
|
16819 | 80 |
|
81 |
(* |
|
82 |
lemma sumr_from_1_from_0: "0 < n ==> |
|
83 |
(\<Sum>n=Suc 0 ..< Suc n. if even(n) then 0 else |
|
84 |
((- 1) ^ ((n - (Suc 0)) div 2))/(real (fact n))) * a ^ n = |
|
85 |
(\<Sum>n=0..<Suc n. if even(n) then 0 else |
|
86 |
((- 1) ^ ((n - (Suc 0)) div 2))/(real (fact n))) * a ^ n" |
|
87 |
by (rule_tac n1 = 1 in sumr_split_add [THEN subst], auto) |
|
88 |
*) |
|
14416 | 89 |
|
90 |
subsection{* Infinite Sums, by the Properties of Limits*} |
|
91 |
||
92 |
(*---------------------- |
|
93 |
suminf is the sum |
|
94 |
---------------------*) |
|
95 |
lemma sums_summable: "f sums l ==> summable f" |
|
96 |
by (simp add: sums_def summable_def, blast) |
|
97 |
||
98 |
lemma summable_sums: "summable f ==> f sums (suminf f)" |
|
20688 | 99 |
apply (simp add: summable_def suminf_def sums_def) |
100 |
apply (blast intro: theI LIMSEQ_unique) |
|
14416 | 101 |
done |
102 |
||
103 |
lemma summable_sumr_LIMSEQ_suminf: |
|
15539 | 104 |
"summable f ==> (%n. setsum f {0..<n}) ----> (suminf f)" |
20688 | 105 |
by (rule summable_sums [unfolded sums_def]) |
14416 | 106 |
|
32707
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
107 |
lemma suminf_eq_lim: "suminf f = lim (%n. setsum f {0..<n})" |
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
108 |
by (simp add: suminf_def sums_def lim_def) |
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
109 |
|
14416 | 110 |
(*------------------- |
111 |
sum is unique |
|
112 |
------------------*) |
|
113 |
lemma sums_unique: "f sums s ==> (s = suminf f)" |
|
114 |
apply (frule sums_summable [THEN summable_sums]) |
|
115 |
apply (auto intro!: LIMSEQ_unique simp add: sums_def) |
|
116 |
done |
|
117 |
||
32707
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
118 |
lemma sums_iff: "f sums x \<longleftrightarrow> summable f \<and> (suminf f = x)" |
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
119 |
by (metis summable_sums sums_summable sums_unique) |
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
120 |
|
16819 | 121 |
lemma sums_split_initial_segment: "f sums s ==> |
122 |
(%n. f(n + k)) sums (s - (SUM i = 0..< k. f i))" |
|
123 |
apply (unfold sums_def); |
|
124 |
apply (simp add: sumr_offset); |
|
125 |
apply (rule LIMSEQ_diff_const) |
|
126 |
apply (rule LIMSEQ_ignore_initial_segment) |
|
127 |
apply assumption |
|
128 |
done |
|
129 |
||
130 |
lemma summable_ignore_initial_segment: "summable f ==> |
|
131 |
summable (%n. f(n + k))" |
|
132 |
apply (unfold summable_def) |
|
133 |
apply (auto intro: sums_split_initial_segment) |
|
134 |
done |
|
135 |
||
136 |
lemma suminf_minus_initial_segment: "summable f ==> |
|
137 |
suminf f = s ==> suminf (%n. f(n + k)) = s - (SUM i = 0..< k. f i)" |
|
138 |
apply (frule summable_ignore_initial_segment) |
|
139 |
apply (rule sums_unique [THEN sym]) |
|
140 |
apply (frule summable_sums) |
|
141 |
apply (rule sums_split_initial_segment) |
|
142 |
apply auto |
|
143 |
done |
|
144 |
||
145 |
lemma suminf_split_initial_segment: "summable f ==> |
|
146 |
suminf f = (SUM i = 0..< k. f i) + suminf (%n. f(n + k))" |
|
147 |
by (auto simp add: suminf_minus_initial_segment) |
|
148 |
||
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
149 |
lemma suminf_exist_split: fixes r :: real assumes "0 < r" and "summable a" |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
150 |
shows "\<exists> N. \<forall> n \<ge> N. \<bar> \<Sum> i. a (i + n) \<bar> < r" |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
151 |
proof - |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
152 |
from LIMSEQ_D[OF summable_sumr_LIMSEQ_suminf[OF `summable a`] `0 < r`] |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
153 |
obtain N :: nat where "\<forall> n \<ge> N. norm (setsum a {0..<n} - suminf a) < r" by auto |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
154 |
thus ?thesis unfolding suminf_minus_initial_segment[OF `summable a` refl] abs_minus_commute real_norm_def |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
155 |
by auto |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
156 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
157 |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
158 |
lemma sums_Suc: assumes sumSuc: "(\<lambda> n. f (Suc n)) sums l" shows "f sums (l + f 0)" |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
159 |
proof - |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
160 |
from sumSuc[unfolded sums_def] |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
161 |
have "(\<lambda>i. \<Sum>n = Suc 0..<Suc i. f n) ----> l" unfolding setsum_reindex[OF inj_Suc] image_Suc_atLeastLessThan[symmetric] comp_def . |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
162 |
from LIMSEQ_add_const[OF this, where b="f 0"] |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
163 |
have "(\<lambda>i. \<Sum>n = 0..<Suc i. f n) ----> l + f 0" unfolding add_commute setsum_head_upt_Suc[OF zero_less_Suc] . |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
164 |
thus ?thesis unfolding sums_def by (rule LIMSEQ_imp_Suc) |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
165 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
166 |
|
14416 | 167 |
lemma series_zero: |
15539 | 168 |
"(\<forall>m. n \<le> m --> f(m) = 0) ==> f sums (setsum f {0..<n})" |
31336
e17f13cd1280
generalize constants in SEQ.thy to class metric_space
huffman
parents:
31017
diff
changeset
|
169 |
apply (simp add: sums_def LIMSEQ_iff diff_minus[symmetric], safe) |
14416 | 170 |
apply (rule_tac x = n in exI) |
15542 | 171 |
apply (clarsimp simp add:setsum_diff[symmetric] cong:setsum_ivl_cong) |
14416 | 172 |
done |
173 |
||
23121 | 174 |
lemma sums_zero: "(\<lambda>n. 0) sums 0" |
175 |
unfolding sums_def by (simp add: LIMSEQ_const) |
|
15539 | 176 |
|
23121 | 177 |
lemma summable_zero: "summable (\<lambda>n. 0)" |
178 |
by (rule sums_zero [THEN sums_summable]) |
|
16819 | 179 |
|
23121 | 180 |
lemma suminf_zero: "suminf (\<lambda>n. 0) = 0" |
181 |
by (rule sums_zero [THEN sums_unique, symmetric]) |
|
16819 | 182 |
|
23119 | 183 |
lemma (in bounded_linear) sums: |
184 |
"(\<lambda>n. X n) sums a \<Longrightarrow> (\<lambda>n. f (X n)) sums (f a)" |
|
185 |
unfolding sums_def by (drule LIMSEQ, simp only: setsum) |
|
186 |
||
187 |
lemma (in bounded_linear) summable: |
|
188 |
"summable (\<lambda>n. X n) \<Longrightarrow> summable (\<lambda>n. f (X n))" |
|
189 |
unfolding summable_def by (auto intro: sums) |
|
190 |
||
191 |
lemma (in bounded_linear) suminf: |
|
192 |
"summable (\<lambda>n. X n) \<Longrightarrow> f (\<Sum>n. X n) = (\<Sum>n. f (X n))" |
|
23121 | 193 |
by (intro sums_unique sums summable_sums) |
23119 | 194 |
|
20692 | 195 |
lemma sums_mult: |
196 |
fixes c :: "'a::real_normed_algebra" |
|
197 |
shows "f sums a \<Longrightarrow> (\<lambda>n. c * f n) sums (c * a)" |
|
23127 | 198 |
by (rule mult_right.sums) |
14416 | 199 |
|
20692 | 200 |
lemma summable_mult: |
201 |
fixes c :: "'a::real_normed_algebra" |
|
23121 | 202 |
shows "summable f \<Longrightarrow> summable (%n. c * f n)" |
23127 | 203 |
by (rule mult_right.summable) |
16819 | 204 |
|
20692 | 205 |
lemma suminf_mult: |
206 |
fixes c :: "'a::real_normed_algebra" |
|
207 |
shows "summable f \<Longrightarrow> suminf (\<lambda>n. c * f n) = c * suminf f"; |
|
23127 | 208 |
by (rule mult_right.suminf [symmetric]) |
16819 | 209 |
|
20692 | 210 |
lemma sums_mult2: |
211 |
fixes c :: "'a::real_normed_algebra" |
|
212 |
shows "f sums a \<Longrightarrow> (\<lambda>n. f n * c) sums (a * c)" |
|
23127 | 213 |
by (rule mult_left.sums) |
16819 | 214 |
|
20692 | 215 |
lemma summable_mult2: |
216 |
fixes c :: "'a::real_normed_algebra" |
|
217 |
shows "summable f \<Longrightarrow> summable (\<lambda>n. f n * c)" |
|
23127 | 218 |
by (rule mult_left.summable) |
16819 | 219 |
|
20692 | 220 |
lemma suminf_mult2: |
221 |
fixes c :: "'a::real_normed_algebra" |
|
222 |
shows "summable f \<Longrightarrow> suminf f * c = (\<Sum>n. f n * c)" |
|
23127 | 223 |
by (rule mult_left.suminf) |
16819 | 224 |
|
20692 | 225 |
lemma sums_divide: |
226 |
fixes c :: "'a::real_normed_field" |
|
227 |
shows "f sums a \<Longrightarrow> (\<lambda>n. f n / c) sums (a / c)" |
|
23127 | 228 |
by (rule divide.sums) |
14416 | 229 |
|
20692 | 230 |
lemma summable_divide: |
231 |
fixes c :: "'a::real_normed_field" |
|
232 |
shows "summable f \<Longrightarrow> summable (\<lambda>n. f n / c)" |
|
23127 | 233 |
by (rule divide.summable) |
16819 | 234 |
|
20692 | 235 |
lemma suminf_divide: |
236 |
fixes c :: "'a::real_normed_field" |
|
237 |
shows "summable f \<Longrightarrow> suminf (\<lambda>n. f n / c) = suminf f / c" |
|
23127 | 238 |
by (rule divide.suminf [symmetric]) |
16819 | 239 |
|
23121 | 240 |
lemma sums_add: "\<lbrakk>X sums a; Y sums b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n + Y n) sums (a + b)" |
241 |
unfolding sums_def by (simp add: setsum_addf LIMSEQ_add) |
|
16819 | 242 |
|
23121 | 243 |
lemma summable_add: "\<lbrakk>summable X; summable Y\<rbrakk> \<Longrightarrow> summable (\<lambda>n. X n + Y n)" |
244 |
unfolding summable_def by (auto intro: sums_add) |
|
16819 | 245 |
|
246 |
lemma suminf_add: |
|
23121 | 247 |
"\<lbrakk>summable X; summable Y\<rbrakk> \<Longrightarrow> suminf X + suminf Y = (\<Sum>n. X n + Y n)" |
248 |
by (intro sums_unique sums_add summable_sums) |
|
14416 | 249 |
|
23121 | 250 |
lemma sums_diff: "\<lbrakk>X sums a; Y sums b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n - Y n) sums (a - b)" |
251 |
unfolding sums_def by (simp add: setsum_subtractf LIMSEQ_diff) |
|
252 |
||
253 |
lemma summable_diff: "\<lbrakk>summable X; summable Y\<rbrakk> \<Longrightarrow> summable (\<lambda>n. X n - Y n)" |
|
254 |
unfolding summable_def by (auto intro: sums_diff) |
|
14416 | 255 |
|
256 |
lemma suminf_diff: |
|
23121 | 257 |
"\<lbrakk>summable X; summable Y\<rbrakk> \<Longrightarrow> suminf X - suminf Y = (\<Sum>n. X n - Y n)" |
258 |
by (intro sums_unique sums_diff summable_sums) |
|
14416 | 259 |
|
23121 | 260 |
lemma sums_minus: "X sums a ==> (\<lambda>n. - X n) sums (- a)" |
261 |
unfolding sums_def by (simp add: setsum_negf LIMSEQ_minus) |
|
16819 | 262 |
|
23121 | 263 |
lemma summable_minus: "summable X \<Longrightarrow> summable (\<lambda>n. - X n)" |
264 |
unfolding summable_def by (auto intro: sums_minus) |
|
16819 | 265 |
|
23121 | 266 |
lemma suminf_minus: "summable X \<Longrightarrow> (\<Sum>n. - X n) = - (\<Sum>n. X n)" |
267 |
by (intro sums_unique [symmetric] sums_minus summable_sums) |
|
14416 | 268 |
|
269 |
lemma sums_group: |
|
15539 | 270 |
"[|summable f; 0 < k |] ==> (%n. setsum f {n*k..<n*k+k}) sums (suminf f)" |
14416 | 271 |
apply (drule summable_sums) |
20692 | 272 |
apply (simp only: sums_def sumr_group) |
31336
e17f13cd1280
generalize constants in SEQ.thy to class metric_space
huffman
parents:
31017
diff
changeset
|
273 |
apply (unfold LIMSEQ_iff, safe) |
20692 | 274 |
apply (drule_tac x="r" in spec, safe) |
275 |
apply (rule_tac x="no" in exI, safe) |
|
276 |
apply (drule_tac x="n*k" in spec) |
|
277 |
apply (erule mp) |
|
278 |
apply (erule order_trans) |
|
279 |
apply simp |
|
14416 | 280 |
done |
281 |
||
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
282 |
text{*A summable series of positive terms has limit that is at least as |
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
283 |
great as any partial sum.*} |
14416 | 284 |
|
20692 | 285 |
lemma series_pos_le: |
286 |
fixes f :: "nat \<Rightarrow> real" |
|
287 |
shows "\<lbrakk>summable f; \<forall>m\<ge>n. 0 \<le> f m\<rbrakk> \<Longrightarrow> setsum f {0..<n} \<le> suminf f" |
|
14416 | 288 |
apply (drule summable_sums) |
289 |
apply (simp add: sums_def) |
|
15539 | 290 |
apply (cut_tac k = "setsum f {0..<n}" in LIMSEQ_const) |
291 |
apply (erule LIMSEQ_le, blast) |
|
20692 | 292 |
apply (rule_tac x="n" in exI, clarify) |
15539 | 293 |
apply (rule setsum_mono2) |
294 |
apply auto |
|
14416 | 295 |
done |
296 |
||
297 |
lemma series_pos_less: |
|
20692 | 298 |
fixes f :: "nat \<Rightarrow> real" |
299 |
shows "\<lbrakk>summable f; \<forall>m\<ge>n. 0 < f m\<rbrakk> \<Longrightarrow> setsum f {0..<n} < suminf f" |
|
300 |
apply (rule_tac y="setsum f {0..<Suc n}" in order_less_le_trans) |
|
301 |
apply simp |
|
302 |
apply (erule series_pos_le) |
|
303 |
apply (simp add: order_less_imp_le) |
|
304 |
done |
|
305 |
||
306 |
lemma suminf_gt_zero: |
|
307 |
fixes f :: "nat \<Rightarrow> real" |
|
308 |
shows "\<lbrakk>summable f; \<forall>n. 0 < f n\<rbrakk> \<Longrightarrow> 0 < suminf f" |
|
309 |
by (drule_tac n="0" in series_pos_less, simp_all) |
|
310 |
||
311 |
lemma suminf_ge_zero: |
|
312 |
fixes f :: "nat \<Rightarrow> real" |
|
313 |
shows "\<lbrakk>summable f; \<forall>n. 0 \<le> f n\<rbrakk> \<Longrightarrow> 0 \<le> suminf f" |
|
314 |
by (drule_tac n="0" in series_pos_le, simp_all) |
|
315 |
||
316 |
lemma sumr_pos_lt_pair: |
|
317 |
fixes f :: "nat \<Rightarrow> real" |
|
318 |
shows "\<lbrakk>summable f; |
|
319 |
\<forall>d. 0 < f (k + (Suc(Suc 0) * d)) + f (k + ((Suc(Suc 0) * d) + 1))\<rbrakk> |
|
320 |
\<Longrightarrow> setsum f {0..<k} < suminf f" |
|
30082
43c5b7bfc791
make more proofs work whether or not One_nat_def is a simp rule
huffman
parents:
29803
diff
changeset
|
321 |
unfolding One_nat_def |
20692 | 322 |
apply (subst suminf_split_initial_segment [where k="k"]) |
323 |
apply assumption |
|
324 |
apply simp |
|
325 |
apply (drule_tac k="k" in summable_ignore_initial_segment) |
|
326 |
apply (drule_tac k="Suc (Suc 0)" in sums_group, simp) |
|
327 |
apply simp |
|
328 |
apply (frule sums_unique) |
|
329 |
apply (drule sums_summable) |
|
330 |
apply simp |
|
331 |
apply (erule suminf_gt_zero) |
|
332 |
apply (simp add: add_ac) |
|
14416 | 333 |
done |
334 |
||
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
335 |
text{*Sum of a geometric progression.*} |
14416 | 336 |
|
17149
e2b19c92ef51
Lemmas on dvd, power and finite summation added or strengthened.
ballarin
parents:
16819
diff
changeset
|
337 |
lemmas sumr_geometric = geometric_sum [where 'a = real] |
14416 | 338 |
|
20692 | 339 |
lemma geometric_sums: |
31017 | 340 |
fixes x :: "'a::{real_normed_field}" |
20692 | 341 |
shows "norm x < 1 \<Longrightarrow> (\<lambda>n. x ^ n) sums (1 / (1 - x))" |
342 |
proof - |
|
343 |
assume less_1: "norm x < 1" |
|
344 |
hence neq_1: "x \<noteq> 1" by auto |
|
345 |
hence neq_0: "x - 1 \<noteq> 0" by simp |
|
346 |
from less_1 have lim_0: "(\<lambda>n. x ^ n) ----> 0" |
|
347 |
by (rule LIMSEQ_power_zero) |
|
22719
c51667189bd3
lemma geometric_sum no longer needs class division_by_zero
huffman
parents:
21404
diff
changeset
|
348 |
hence "(\<lambda>n. x ^ n / (x - 1) - 1 / (x - 1)) ----> 0 / (x - 1) - 1 / (x - 1)" |
20692 | 349 |
using neq_0 by (intro LIMSEQ_divide LIMSEQ_diff LIMSEQ_const) |
350 |
hence "(\<lambda>n. (x ^ n - 1) / (x - 1)) ----> 1 / (1 - x)" |
|
351 |
by (simp add: nonzero_minus_divide_right [OF neq_0] diff_divide_distrib) |
|
352 |
thus "(\<lambda>n. x ^ n) sums (1 / (1 - x))" |
|
353 |
by (simp add: sums_def geometric_sum neq_1) |
|
354 |
qed |
|
355 |
||
356 |
lemma summable_geometric: |
|
31017 | 357 |
fixes x :: "'a::{real_normed_field}" |
20692 | 358 |
shows "norm x < 1 \<Longrightarrow> summable (\<lambda>n. x ^ n)" |
359 |
by (rule geometric_sums [THEN sums_summable]) |
|
14416 | 360 |
|
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
361 |
text{*Cauchy-type criterion for convergence of series (c.f. Harrison)*} |
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
362 |
|
15539 | 363 |
lemma summable_convergent_sumr_iff: |
364 |
"summable f = convergent (%n. setsum f {0..<n})" |
|
14416 | 365 |
by (simp add: summable_def sums_def convergent_def) |
366 |
||
20689 | 367 |
lemma summable_LIMSEQ_zero: "summable f \<Longrightarrow> f ----> 0" |
368 |
apply (drule summable_convergent_sumr_iff [THEN iffD1]) |
|
20692 | 369 |
apply (drule convergent_Cauchy) |
31336
e17f13cd1280
generalize constants in SEQ.thy to class metric_space
huffman
parents:
31017
diff
changeset
|
370 |
apply (simp only: Cauchy_iff LIMSEQ_iff, safe) |
20689 | 371 |
apply (drule_tac x="r" in spec, safe) |
372 |
apply (rule_tac x="M" in exI, safe) |
|
373 |
apply (drule_tac x="Suc n" in spec, simp) |
|
374 |
apply (drule_tac x="n" in spec, simp) |
|
375 |
done |
|
376 |
||
32707
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
377 |
lemma suminf_le: |
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
378 |
fixes x :: real |
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
379 |
shows "summable f \<Longrightarrow> (!!n. setsum f {0..<n} \<le> x) \<Longrightarrow> suminf f \<le> x" |
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
380 |
by (simp add: summable_convergent_sumr_iff suminf_eq_lim lim_le) |
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
381 |
|
14416 | 382 |
lemma summable_Cauchy: |
20848 | 383 |
"summable (f::nat \<Rightarrow> 'a::banach) = |
384 |
(\<forall>e > 0. \<exists>N. \<forall>m \<ge> N. \<forall>n. norm (setsum f {m..<n}) < e)" |
|
31336
e17f13cd1280
generalize constants in SEQ.thy to class metric_space
huffman
parents:
31017
diff
changeset
|
385 |
apply (simp only: summable_convergent_sumr_iff Cauchy_convergent_iff [symmetric] Cauchy_iff, safe) |
20410 | 386 |
apply (drule spec, drule (1) mp) |
387 |
apply (erule exE, rule_tac x="M" in exI, clarify) |
|
388 |
apply (rule_tac x="m" and y="n" in linorder_le_cases) |
|
389 |
apply (frule (1) order_trans) |
|
390 |
apply (drule_tac x="n" in spec, drule (1) mp) |
|
391 |
apply (drule_tac x="m" in spec, drule (1) mp) |
|
392 |
apply (simp add: setsum_diff [symmetric]) |
|
393 |
apply simp |
|
394 |
apply (drule spec, drule (1) mp) |
|
395 |
apply (erule exE, rule_tac x="N" in exI, clarify) |
|
396 |
apply (rule_tac x="m" and y="n" in linorder_le_cases) |
|
20552
2c31dd358c21
generalized types of many constants to work over arbitrary vector spaces;
huffman
parents:
20432
diff
changeset
|
397 |
apply (subst norm_minus_commute) |
20410 | 398 |
apply (simp add: setsum_diff [symmetric]) |
399 |
apply (simp add: setsum_diff [symmetric]) |
|
14416 | 400 |
done |
401 |
||
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
402 |
text{*Comparison test*} |
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
403 |
|
20692 | 404 |
lemma norm_setsum: |
405 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" |
|
406 |
shows "norm (setsum f A) \<le> (\<Sum>i\<in>A. norm (f i))" |
|
407 |
apply (case_tac "finite A") |
|
408 |
apply (erule finite_induct) |
|
409 |
apply simp |
|
410 |
apply simp |
|
411 |
apply (erule order_trans [OF norm_triangle_ineq add_left_mono]) |
|
412 |
apply simp |
|
413 |
done |
|
414 |
||
14416 | 415 |
lemma summable_comparison_test: |
20848 | 416 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
417 |
shows "\<lbrakk>\<exists>N. \<forall>n\<ge>N. norm (f n) \<le> g n; summable g\<rbrakk> \<Longrightarrow> summable f" |
|
20692 | 418 |
apply (simp add: summable_Cauchy, safe) |
419 |
apply (drule_tac x="e" in spec, safe) |
|
420 |
apply (rule_tac x = "N + Na" in exI, safe) |
|
14416 | 421 |
apply (rotate_tac 2) |
422 |
apply (drule_tac x = m in spec) |
|
423 |
apply (auto, rotate_tac 2, drule_tac x = n in spec) |
|
20848 | 424 |
apply (rule_tac y = "\<Sum>k=m..<n. norm (f k)" in order_le_less_trans) |
425 |
apply (rule norm_setsum) |
|
15539 | 426 |
apply (rule_tac y = "setsum g {m..<n}" in order_le_less_trans) |
22998 | 427 |
apply (auto intro: setsum_mono simp add: abs_less_iff) |
14416 | 428 |
done |
429 |
||
20848 | 430 |
lemma summable_norm_comparison_test: |
431 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
|
432 |
shows "\<lbrakk>\<exists>N. \<forall>n\<ge>N. norm (f n) \<le> g n; summable g\<rbrakk> |
|
433 |
\<Longrightarrow> summable (\<lambda>n. norm (f n))" |
|
434 |
apply (rule summable_comparison_test) |
|
435 |
apply (auto) |
|
436 |
done |
|
437 |
||
14416 | 438 |
lemma summable_rabs_comparison_test: |
20692 | 439 |
fixes f :: "nat \<Rightarrow> real" |
440 |
shows "\<lbrakk>\<exists>N. \<forall>n\<ge>N. \<bar>f n\<bar> \<le> g n; summable g\<rbrakk> \<Longrightarrow> summable (\<lambda>n. \<bar>f n\<bar>)" |
|
14416 | 441 |
apply (rule summable_comparison_test) |
15543 | 442 |
apply (auto) |
14416 | 443 |
done |
444 |
||
23084 | 445 |
text{*Summability of geometric series for real algebras*} |
446 |
||
447 |
lemma complete_algebra_summable_geometric: |
|
31017 | 448 |
fixes x :: "'a::{real_normed_algebra_1,banach}" |
23084 | 449 |
shows "norm x < 1 \<Longrightarrow> summable (\<lambda>n. x ^ n)" |
450 |
proof (rule summable_comparison_test) |
|
451 |
show "\<exists>N. \<forall>n\<ge>N. norm (x ^ n) \<le> norm x ^ n" |
|
452 |
by (simp add: norm_power_ineq) |
|
453 |
show "norm x < 1 \<Longrightarrow> summable (\<lambda>n. norm x ^ n)" |
|
454 |
by (simp add: summable_geometric) |
|
455 |
qed |
|
456 |
||
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
457 |
text{*Limit comparison property for series (c.f. jrh)*} |
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
458 |
|
14416 | 459 |
lemma summable_le: |
20692 | 460 |
fixes f g :: "nat \<Rightarrow> real" |
461 |
shows "\<lbrakk>\<forall>n. f n \<le> g n; summable f; summable g\<rbrakk> \<Longrightarrow> suminf f \<le> suminf g" |
|
14416 | 462 |
apply (drule summable_sums)+ |
20692 | 463 |
apply (simp only: sums_def, erule (1) LIMSEQ_le) |
14416 | 464 |
apply (rule exI) |
15539 | 465 |
apply (auto intro!: setsum_mono) |
14416 | 466 |
done |
467 |
||
468 |
lemma summable_le2: |
|
20692 | 469 |
fixes f g :: "nat \<Rightarrow> real" |
470 |
shows "\<lbrakk>\<forall>n. \<bar>f n\<bar> \<le> g n; summable g\<rbrakk> \<Longrightarrow> summable f \<and> suminf f \<le> suminf g" |
|
20848 | 471 |
apply (subgoal_tac "summable f") |
472 |
apply (auto intro!: summable_le) |
|
22998 | 473 |
apply (simp add: abs_le_iff) |
20848 | 474 |
apply (rule_tac g="g" in summable_comparison_test, simp_all) |
14416 | 475 |
done |
476 |
||
19106
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
477 |
(* specialisation for the common 0 case *) |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
478 |
lemma suminf_0_le: |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
479 |
fixes f::"nat\<Rightarrow>real" |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
480 |
assumes gt0: "\<forall>n. 0 \<le> f n" and sm: "summable f" |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
481 |
shows "0 \<le> suminf f" |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
482 |
proof - |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
483 |
let ?g = "(\<lambda>n. (0::real))" |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
484 |
from gt0 have "\<forall>n. ?g n \<le> f n" by simp |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
485 |
moreover have "summable ?g" by (rule summable_zero) |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
486 |
moreover from sm have "summable f" . |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
487 |
ultimately have "suminf ?g \<le> suminf f" by (rule summable_le) |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
488 |
then show "0 \<le> suminf f" by (simp add: suminf_zero) |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
489 |
qed |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
490 |
|
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
491 |
|
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
492 |
text{*Absolute convergence imples normal convergence*} |
20848 | 493 |
lemma summable_norm_cancel: |
494 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
|
495 |
shows "summable (\<lambda>n. norm (f n)) \<Longrightarrow> summable f" |
|
20692 | 496 |
apply (simp only: summable_Cauchy, safe) |
497 |
apply (drule_tac x="e" in spec, safe) |
|
498 |
apply (rule_tac x="N" in exI, safe) |
|
499 |
apply (drule_tac x="m" in spec, safe) |
|
20848 | 500 |
apply (rule order_le_less_trans [OF norm_setsum]) |
501 |
apply (rule order_le_less_trans [OF abs_ge_self]) |
|
20692 | 502 |
apply simp |
14416 | 503 |
done |
504 |
||
20848 | 505 |
lemma summable_rabs_cancel: |
506 |
fixes f :: "nat \<Rightarrow> real" |
|
507 |
shows "summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> summable f" |
|
508 |
by (rule summable_norm_cancel, simp) |
|
509 |
||
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
510 |
text{*Absolute convergence of series*} |
20848 | 511 |
lemma summable_norm: |
512 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
|
513 |
shows "summable (\<lambda>n. norm (f n)) \<Longrightarrow> norm (suminf f) \<le> (\<Sum>n. norm (f n))" |
|
514 |
by (auto intro: LIMSEQ_le LIMSEQ_norm summable_norm_cancel |
|
515 |
summable_sumr_LIMSEQ_suminf norm_setsum) |
|
516 |
||
14416 | 517 |
lemma summable_rabs: |
20692 | 518 |
fixes f :: "nat \<Rightarrow> real" |
519 |
shows "summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> \<bar>suminf f\<bar> \<le> (\<Sum>n. \<bar>f n\<bar>)" |
|
20848 | 520 |
by (fold real_norm_def, rule summable_norm) |
14416 | 521 |
|
522 |
subsection{* The Ratio Test*} |
|
523 |
||
20848 | 524 |
lemma norm_ratiotest_lemma: |
22852 | 525 |
fixes x y :: "'a::real_normed_vector" |
20848 | 526 |
shows "\<lbrakk>c \<le> 0; norm x \<le> c * norm y\<rbrakk> \<Longrightarrow> x = 0" |
527 |
apply (subgoal_tac "norm x \<le> 0", simp) |
|
528 |
apply (erule order_trans) |
|
529 |
apply (simp add: mult_le_0_iff) |
|
530 |
done |
|
531 |
||
14416 | 532 |
lemma rabs_ratiotest_lemma: "[| c \<le> 0; abs x \<le> c * abs y |] ==> x = (0::real)" |
20848 | 533 |
by (erule norm_ratiotest_lemma, simp) |
14416 | 534 |
|
535 |
lemma le_Suc_ex: "(k::nat) \<le> l ==> (\<exists>n. l = k + n)" |
|
536 |
apply (drule le_imp_less_or_eq) |
|
537 |
apply (auto dest: less_imp_Suc_add) |
|
538 |
done |
|
539 |
||
540 |
lemma le_Suc_ex_iff: "((k::nat) \<le> l) = (\<exists>n. l = k + n)" |
|
541 |
by (auto simp add: le_Suc_ex) |
|
542 |
||
543 |
(*All this trouble just to get 0<c *) |
|
544 |
lemma ratio_test_lemma2: |
|
20848 | 545 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
546 |
shows "\<lbrakk>\<forall>n\<ge>N. norm (f (Suc n)) \<le> c * norm (f n)\<rbrakk> \<Longrightarrow> 0 < c \<or> summable f" |
|
14416 | 547 |
apply (simp (no_asm) add: linorder_not_le [symmetric]) |
548 |
apply (simp add: summable_Cauchy) |
|
15543 | 549 |
apply (safe, subgoal_tac "\<forall>n. N < n --> f (n) = 0") |
550 |
prefer 2 |
|
551 |
apply clarify |
|
30082
43c5b7bfc791
make more proofs work whether or not One_nat_def is a simp rule
huffman
parents:
29803
diff
changeset
|
552 |
apply(erule_tac x = "n - Suc 0" in allE) |
15543 | 553 |
apply (simp add:diff_Suc split:nat.splits) |
20848 | 554 |
apply (blast intro: norm_ratiotest_lemma) |
14416 | 555 |
apply (rule_tac x = "Suc N" in exI, clarify) |
15543 | 556 |
apply(simp cong:setsum_ivl_cong) |
14416 | 557 |
done |
558 |
||
559 |
lemma ratio_test: |
|
20848 | 560 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
561 |
shows "\<lbrakk>c < 1; \<forall>n\<ge>N. norm (f (Suc n)) \<le> c * norm (f n)\<rbrakk> \<Longrightarrow> summable f" |
|
14416 | 562 |
apply (frule ratio_test_lemma2, auto) |
20848 | 563 |
apply (rule_tac g = "%n. (norm (f N) / (c ^ N))*c ^ n" |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
564 |
in summable_comparison_test) |
14416 | 565 |
apply (rule_tac x = N in exI, safe) |
566 |
apply (drule le_Suc_ex_iff [THEN iffD1]) |
|
22959 | 567 |
apply (auto simp add: power_add field_power_not_zero) |
15539 | 568 |
apply (induct_tac "na", auto) |
20848 | 569 |
apply (rule_tac y = "c * norm (f (N + n))" in order_trans) |
14416 | 570 |
apply (auto intro: mult_right_mono simp add: summable_def) |
20848 | 571 |
apply (rule_tac x = "norm (f N) * (1/ (1 - c)) / (c ^ N)" in exI) |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
572 |
apply (rule sums_divide) |
27108 | 573 |
apply (rule sums_mult) |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
574 |
apply (auto intro!: geometric_sums) |
14416 | 575 |
done |
576 |
||
23111 | 577 |
subsection {* Cauchy Product Formula *} |
578 |
||
579 |
(* Proof based on Analysis WebNotes: Chapter 07, Class 41 |
|
580 |
http://www.math.unl.edu/~webnotes/classes/class41/prp77.htm *) |
|
581 |
||
582 |
lemma setsum_triangle_reindex: |
|
583 |
fixes n :: nat |
|
584 |
shows "(\<Sum>(i,j)\<in>{(i,j). i+j < n}. f i j) = (\<Sum>k=0..<n. \<Sum>i=0..k. f i (k - i))" |
|
585 |
proof - |
|
586 |
have "(\<Sum>(i, j)\<in>{(i, j). i + j < n}. f i j) = |
|
587 |
(\<Sum>(k, i)\<in>(SIGMA k:{0..<n}. {0..k}). f i (k - i))" |
|
588 |
proof (rule setsum_reindex_cong) |
|
589 |
show "inj_on (\<lambda>(k,i). (i, k - i)) (SIGMA k:{0..<n}. {0..k})" |
|
590 |
by (rule inj_on_inverseI [where g="\<lambda>(i,j). (i+j, i)"], auto) |
|
591 |
show "{(i,j). i + j < n} = (\<lambda>(k,i). (i, k - i)) ` (SIGMA k:{0..<n}. {0..k})" |
|
592 |
by (safe, rule_tac x="(a+b,a)" in image_eqI, auto) |
|
593 |
show "\<And>a. (\<lambda>(k, i). f i (k - i)) a = split f ((\<lambda>(k, i). (i, k - i)) a)" |
|
594 |
by clarify |
|
595 |
qed |
|
596 |
thus ?thesis by (simp add: setsum_Sigma) |
|
597 |
qed |
|
598 |
||
599 |
lemma Cauchy_product_sums: |
|
600 |
fixes a b :: "nat \<Rightarrow> 'a::{real_normed_algebra,banach}" |
|
601 |
assumes a: "summable (\<lambda>k. norm (a k))" |
|
602 |
assumes b: "summable (\<lambda>k. norm (b k))" |
|
603 |
shows "(\<lambda>k. \<Sum>i=0..k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))" |
|
604 |
proof - |
|
605 |
let ?S1 = "\<lambda>n::nat. {0..<n} \<times> {0..<n}" |
|
606 |
let ?S2 = "\<lambda>n::nat. {(i,j). i + j < n}" |
|
607 |
have S1_mono: "\<And>m n. m \<le> n \<Longrightarrow> ?S1 m \<subseteq> ?S1 n" by auto |
|
608 |
have S2_le_S1: "\<And>n. ?S2 n \<subseteq> ?S1 n" by auto |
|
609 |
have S1_le_S2: "\<And>n. ?S1 (n div 2) \<subseteq> ?S2 n" by auto |
|
610 |
have finite_S1: "\<And>n. finite (?S1 n)" by simp |
|
611 |
with S2_le_S1 have finite_S2: "\<And>n. finite (?S2 n)" by (rule finite_subset) |
|
612 |
||
613 |
let ?g = "\<lambda>(i,j). a i * b j" |
|
614 |
let ?f = "\<lambda>(i,j). norm (a i) * norm (b j)" |
|
615 |
have f_nonneg: "\<And>x. 0 \<le> ?f x" |
|
616 |
by (auto simp add: mult_nonneg_nonneg) |
|
617 |
hence norm_setsum_f: "\<And>A. norm (setsum ?f A) = setsum ?f A" |
|
618 |
unfolding real_norm_def |
|
619 |
by (simp only: abs_of_nonneg setsum_nonneg [rule_format]) |
|
620 |
||
621 |
have "(\<lambda>n. (\<Sum>k=0..<n. a k) * (\<Sum>k=0..<n. b k)) |
|
622 |
----> (\<Sum>k. a k) * (\<Sum>k. b k)" |
|
623 |
by (intro LIMSEQ_mult summable_sumr_LIMSEQ_suminf |
|
624 |
summable_norm_cancel [OF a] summable_norm_cancel [OF b]) |
|
625 |
hence 1: "(\<lambda>n. setsum ?g (?S1 n)) ----> (\<Sum>k. a k) * (\<Sum>k. b k)" |
|
626 |
by (simp only: setsum_product setsum_Sigma [rule_format] |
|
627 |
finite_atLeastLessThan) |
|
628 |
||
629 |
have "(\<lambda>n. (\<Sum>k=0..<n. norm (a k)) * (\<Sum>k=0..<n. norm (b k))) |
|
630 |
----> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))" |
|
631 |
using a b by (intro LIMSEQ_mult summable_sumr_LIMSEQ_suminf) |
|
632 |
hence "(\<lambda>n. setsum ?f (?S1 n)) ----> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))" |
|
633 |
by (simp only: setsum_product setsum_Sigma [rule_format] |
|
634 |
finite_atLeastLessThan) |
|
635 |
hence "convergent (\<lambda>n. setsum ?f (?S1 n))" |
|
636 |
by (rule convergentI) |
|
637 |
hence Cauchy: "Cauchy (\<lambda>n. setsum ?f (?S1 n))" |
|
638 |
by (rule convergent_Cauchy) |
|
639 |
have "Zseq (\<lambda>n. setsum ?f (?S1 n - ?S2 n))" |
|
640 |
proof (rule ZseqI, simp only: norm_setsum_f) |
|
641 |
fix r :: real |
|
642 |
assume r: "0 < r" |
|
643 |
from CauchyD [OF Cauchy r] obtain N |
|
644 |
where "\<forall>m\<ge>N. \<forall>n\<ge>N. norm (setsum ?f (?S1 m) - setsum ?f (?S1 n)) < r" .. |
|
645 |
hence "\<And>m n. \<lbrakk>N \<le> n; n \<le> m\<rbrakk> \<Longrightarrow> norm (setsum ?f (?S1 m - ?S1 n)) < r" |
|
646 |
by (simp only: setsum_diff finite_S1 S1_mono) |
|
647 |
hence N: "\<And>m n. \<lbrakk>N \<le> n; n \<le> m\<rbrakk> \<Longrightarrow> setsum ?f (?S1 m - ?S1 n) < r" |
|
648 |
by (simp only: norm_setsum_f) |
|
649 |
show "\<exists>N. \<forall>n\<ge>N. setsum ?f (?S1 n - ?S2 n) < r" |
|
650 |
proof (intro exI allI impI) |
|
651 |
fix n assume "2 * N \<le> n" |
|
652 |
hence n: "N \<le> n div 2" by simp |
|
653 |
have "setsum ?f (?S1 n - ?S2 n) \<le> setsum ?f (?S1 n - ?S1 (n div 2))" |
|
654 |
by (intro setsum_mono2 finite_Diff finite_S1 f_nonneg |
|
655 |
Diff_mono subset_refl S1_le_S2) |
|
656 |
also have "\<dots> < r" |
|
657 |
using n div_le_dividend by (rule N) |
|
658 |
finally show "setsum ?f (?S1 n - ?S2 n) < r" . |
|
659 |
qed |
|
660 |
qed |
|
661 |
hence "Zseq (\<lambda>n. setsum ?g (?S1 n - ?S2 n))" |
|
662 |
apply (rule Zseq_le [rule_format]) |
|
663 |
apply (simp only: norm_setsum_f) |
|
664 |
apply (rule order_trans [OF norm_setsum setsum_mono]) |
|
665 |
apply (auto simp add: norm_mult_ineq) |
|
666 |
done |
|
667 |
hence 2: "(\<lambda>n. setsum ?g (?S1 n) - setsum ?g (?S2 n)) ----> 0" |
|
668 |
by (simp only: LIMSEQ_Zseq_iff setsum_diff finite_S1 S2_le_S1 diff_0_right) |
|
669 |
||
670 |
with 1 have "(\<lambda>n. setsum ?g (?S2 n)) ----> (\<Sum>k. a k) * (\<Sum>k. b k)" |
|
671 |
by (rule LIMSEQ_diff_approach_zero2) |
|
672 |
thus ?thesis by (simp only: sums_def setsum_triangle_reindex) |
|
673 |
qed |
|
674 |
||
675 |
lemma Cauchy_product: |
|
676 |
fixes a b :: "nat \<Rightarrow> 'a::{real_normed_algebra,banach}" |
|
677 |
assumes a: "summable (\<lambda>k. norm (a k))" |
|
678 |
assumes b: "summable (\<lambda>k. norm (b k))" |
|
679 |
shows "(\<Sum>k. a k) * (\<Sum>k. b k) = (\<Sum>k. \<Sum>i=0..k. a i * b (k - i))" |
|
23441 | 680 |
using a b |
23111 | 681 |
by (rule Cauchy_product_sums [THEN sums_unique]) |
682 |
||
14416 | 683 |
end |