author | wenzelm |
Tue, 13 Mar 2012 16:40:06 +0100 | |
changeset 46904 | f30e941b4512 |
parent 44727 | d45acd50a894 |
child 47108 | 2a1953f0d20d |
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 |
41970 | 8 |
*) |
10751 | 9 |
|
14416 | 10 |
header{*Finite Summation and Infinite Series*} |
10751 | 11 |
|
15131 | 12 |
theory Series |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
13 |
imports SEQ Deriv |
15131 | 14 |
begin |
15561 | 15 |
|
19765 | 16 |
definition |
41970 | 17 |
sums :: "(nat \<Rightarrow> 'a::{topological_space, comm_monoid_add}) \<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 |
41970 | 22 |
summable :: "(nat \<Rightarrow> 'a::{topological_space, comm_monoid_add}) \<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 |
41970 | 26 |
suminf :: "(nat \<Rightarrow> 'a::{topological_space, comm_monoid_add}) \<Rightarrow> 'a" where |
20688 | 27 |
"suminf f = (THE s. f sums s)" |
14416 | 28 |
|
44289 | 29 |
notation suminf (binder "\<Sum>" 10) |
15546 | 30 |
|
14416 | 31 |
|
32877
6f09346c7c08
New lemmas connected with the reals and infinite series
paulson
parents:
32707
diff
changeset
|
32 |
lemma [trans]: "f=g ==> g sums z ==> f sums z" |
6f09346c7c08
New lemmas connected with the reals and infinite series
paulson
parents:
32707
diff
changeset
|
33 |
by simp |
6f09346c7c08
New lemmas connected with the reals and infinite series
paulson
parents:
32707
diff
changeset
|
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 |
|
14416 | 81 |
subsection{* Infinite Sums, by the Properties of Limits*} |
82 |
||
83 |
(*---------------------- |
|
41970 | 84 |
suminf is the sum |
14416 | 85 |
---------------------*) |
86 |
lemma sums_summable: "f sums l ==> summable f" |
|
41970 | 87 |
by (simp add: sums_def summable_def, blast) |
14416 | 88 |
|
41970 | 89 |
lemma summable_sums: |
46904 | 90 |
fixes f :: "nat \<Rightarrow> 'a::{t2_space, comm_monoid_add}" |
91 |
assumes "summable f" |
|
92 |
shows "f sums (suminf f)" |
|
41970 | 93 |
proof - |
46904 | 94 |
from assms obtain s where s: "(\<lambda>n. setsum f {0..<n}) ----> s" |
95 |
unfolding summable_def sums_def [abs_def] .. |
|
96 |
then show ?thesis unfolding sums_def [abs_def] suminf_def |
|
41970 | 97 |
by (rule theI, auto intro!: tendsto_unique[OF trivial_limit_sequentially]) |
98 |
qed |
|
14416 | 99 |
|
41970 | 100 |
lemma summable_sumr_LIMSEQ_suminf: |
101 |
fixes f :: "nat \<Rightarrow> 'a::{t2_space, comm_monoid_add}" |
|
102 |
shows "summable f \<Longrightarrow> (\<lambda>n. setsum f {0..<n}) ----> suminf f" |
|
20688 | 103 |
by (rule summable_sums [unfolded sums_def]) |
14416 | 104 |
|
32707
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
105 |
lemma suminf_eq_lim: "suminf f = lim (%n. setsum f {0..<n})" |
41970 | 106 |
by (simp add: suminf_def sums_def lim_def) |
32707
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
107 |
|
14416 | 108 |
(*------------------- |
41970 | 109 |
sum is unique |
14416 | 110 |
------------------*) |
41970 | 111 |
lemma sums_unique: |
112 |
fixes f :: "nat \<Rightarrow> 'a::{t2_space, comm_monoid_add}" |
|
113 |
shows "f sums s \<Longrightarrow> (s = suminf f)" |
|
114 |
apply (frule sums_summable[THEN summable_sums]) |
|
115 |
apply (auto intro!: tendsto_unique[OF trivial_limit_sequentially] simp add: sums_def) |
|
14416 | 116 |
done |
117 |
||
41970 | 118 |
lemma sums_iff: |
119 |
fixes f :: "nat \<Rightarrow> 'a::{t2_space, comm_monoid_add}" |
|
120 |
shows "f sums x \<longleftrightarrow> summable f \<and> (suminf f = x)" |
|
32707
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
121 |
by (metis summable_sums sums_summable sums_unique) |
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
122 |
|
41970 | 123 |
lemma sums_split_initial_segment: |
124 |
fixes f :: "nat \<Rightarrow> 'a::real_normed_vector" |
|
125 |
shows "f sums s ==> (\<lambda>n. f(n + k)) sums (s - (SUM i = 0..< k. f i))" |
|
126 |
apply (unfold sums_def) |
|
127 |
apply (simp add: sumr_offset) |
|
44710 | 128 |
apply (rule tendsto_diff [OF _ tendsto_const]) |
16819 | 129 |
apply (rule LIMSEQ_ignore_initial_segment) |
130 |
apply assumption |
|
131 |
done |
|
132 |
||
41970 | 133 |
lemma summable_ignore_initial_segment: |
134 |
fixes f :: "nat \<Rightarrow> 'a::real_normed_vector" |
|
135 |
shows "summable f ==> summable (%n. f(n + k))" |
|
16819 | 136 |
apply (unfold summable_def) |
137 |
apply (auto intro: sums_split_initial_segment) |
|
138 |
done |
|
139 |
||
41970 | 140 |
lemma suminf_minus_initial_segment: |
141 |
fixes f :: "nat \<Rightarrow> 'a::real_normed_vector" |
|
142 |
shows "summable f ==> |
|
16819 | 143 |
suminf f = s ==> suminf (%n. f(n + k)) = s - (SUM i = 0..< k. f i)" |
144 |
apply (frule summable_ignore_initial_segment) |
|
145 |
apply (rule sums_unique [THEN sym]) |
|
146 |
apply (frule summable_sums) |
|
147 |
apply (rule sums_split_initial_segment) |
|
148 |
apply auto |
|
149 |
done |
|
150 |
||
41970 | 151 |
lemma suminf_split_initial_segment: |
152 |
fixes f :: "nat \<Rightarrow> 'a::real_normed_vector" |
|
153 |
shows "summable f ==> |
|
154 |
suminf f = (SUM i = 0..< k. f i) + (\<Sum>n. f(n + k))" |
|
16819 | 155 |
by (auto simp add: suminf_minus_initial_segment) |
156 |
||
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
157 |
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
|
158 |
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
|
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 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
|
161 |
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
|
162 |
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
|
163 |
by auto |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
164 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
165 |
|
41970 | 166 |
lemma sums_Suc: |
167 |
fixes f :: "nat \<Rightarrow> 'a::real_normed_vector" |
|
168 |
assumes sumSuc: "(\<lambda> n. f (Suc n)) sums l" shows "f sums (l + f 0)" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
169 |
proof - |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
170 |
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
|
171 |
have "(\<lambda>i. \<Sum>n = Suc 0..<Suc i. f n) ----> l" unfolding setsum_reindex[OF inj_Suc] image_Suc_atLeastLessThan[symmetric] comp_def . |
44710 | 172 |
from tendsto_add[OF this tendsto_const, where b="f 0"] |
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
173 |
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
|
174 |
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
|
175 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset
|
176 |
|
41970 | 177 |
lemma series_zero: |
178 |
fixes f :: "nat \<Rightarrow> 'a::{t2_space, comm_monoid_add}" |
|
179 |
assumes "\<forall>m. n \<le> m \<longrightarrow> f m = 0" |
|
180 |
shows "f sums (setsum f {0..<n})" |
|
181 |
proof - |
|
182 |
{ fix k :: nat have "setsum f {0..<k + n} = setsum f {0..<n}" |
|
183 |
using assms by (induct k) auto } |
|
184 |
note setsum_const = this |
|
185 |
show ?thesis |
|
186 |
unfolding sums_def |
|
187 |
apply (rule LIMSEQ_offset[of _ n]) |
|
188 |
unfolding setsum_const |
|
44568
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
huffman
parents:
44289
diff
changeset
|
189 |
apply (rule tendsto_const) |
41970 | 190 |
done |
191 |
qed |
|
14416 | 192 |
|
41970 | 193 |
lemma sums_zero[simp, intro]: "(\<lambda>n. 0) sums 0" |
44568
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
huffman
parents:
44289
diff
changeset
|
194 |
unfolding sums_def by (simp add: tendsto_const) |
15539 | 195 |
|
41970 | 196 |
lemma summable_zero[simp, intro]: "summable (\<lambda>n. 0)" |
23121 | 197 |
by (rule sums_zero [THEN sums_summable]) |
16819 | 198 |
|
41970 | 199 |
lemma suminf_zero[simp]: "suminf (\<lambda>n. 0::'a::{t2_space, comm_monoid_add}) = 0" |
23121 | 200 |
by (rule sums_zero [THEN sums_unique, symmetric]) |
41970 | 201 |
|
23119 | 202 |
lemma (in bounded_linear) sums: |
203 |
"(\<lambda>n. X n) sums a \<Longrightarrow> (\<lambda>n. f (X n)) sums (f a)" |
|
44568
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
huffman
parents:
44289
diff
changeset
|
204 |
unfolding sums_def by (drule tendsto, simp only: setsum) |
23119 | 205 |
|
206 |
lemma (in bounded_linear) summable: |
|
207 |
"summable (\<lambda>n. X n) \<Longrightarrow> summable (\<lambda>n. f (X n))" |
|
208 |
unfolding summable_def by (auto intro: sums) |
|
209 |
||
210 |
lemma (in bounded_linear) suminf: |
|
211 |
"summable (\<lambda>n. X n) \<Longrightarrow> f (\<Sum>n. X n) = (\<Sum>n. f (X n))" |
|
23121 | 212 |
by (intro sums_unique sums summable_sums) |
23119 | 213 |
|
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
41970
diff
changeset
|
214 |
lemmas sums_of_real = bounded_linear.sums [OF bounded_linear_of_real] |
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
41970
diff
changeset
|
215 |
lemmas summable_of_real = bounded_linear.summable [OF bounded_linear_of_real] |
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
41970
diff
changeset
|
216 |
lemmas suminf_of_real = bounded_linear.suminf [OF bounded_linear_of_real] |
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
41970
diff
changeset
|
217 |
|
20692 | 218 |
lemma sums_mult: |
219 |
fixes c :: "'a::real_normed_algebra" |
|
220 |
shows "f sums a \<Longrightarrow> (\<lambda>n. c * f n) sums (c * a)" |
|
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
41970
diff
changeset
|
221 |
by (rule bounded_linear.sums [OF bounded_linear_mult_right]) |
14416 | 222 |
|
20692 | 223 |
lemma summable_mult: |
224 |
fixes c :: "'a::real_normed_algebra" |
|
23121 | 225 |
shows "summable f \<Longrightarrow> summable (%n. c * f n)" |
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
41970
diff
changeset
|
226 |
by (rule bounded_linear.summable [OF bounded_linear_mult_right]) |
16819 | 227 |
|
20692 | 228 |
lemma suminf_mult: |
229 |
fixes c :: "'a::real_normed_algebra" |
|
41970 | 230 |
shows "summable f \<Longrightarrow> suminf (\<lambda>n. c * f n) = c * suminf f" |
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
41970
diff
changeset
|
231 |
by (rule bounded_linear.suminf [OF bounded_linear_mult_right, symmetric]) |
16819 | 232 |
|
20692 | 233 |
lemma sums_mult2: |
234 |
fixes c :: "'a::real_normed_algebra" |
|
235 |
shows "f sums a \<Longrightarrow> (\<lambda>n. f n * c) sums (a * c)" |
|
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
41970
diff
changeset
|
236 |
by (rule bounded_linear.sums [OF bounded_linear_mult_left]) |
16819 | 237 |
|
20692 | 238 |
lemma summable_mult2: |
239 |
fixes c :: "'a::real_normed_algebra" |
|
240 |
shows "summable f \<Longrightarrow> summable (\<lambda>n. f n * c)" |
|
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
41970
diff
changeset
|
241 |
by (rule bounded_linear.summable [OF bounded_linear_mult_left]) |
16819 | 242 |
|
20692 | 243 |
lemma suminf_mult2: |
244 |
fixes c :: "'a::real_normed_algebra" |
|
245 |
shows "summable f \<Longrightarrow> suminf f * c = (\<Sum>n. f n * c)" |
|
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
41970
diff
changeset
|
246 |
by (rule bounded_linear.suminf [OF bounded_linear_mult_left]) |
16819 | 247 |
|
20692 | 248 |
lemma sums_divide: |
249 |
fixes c :: "'a::real_normed_field" |
|
250 |
shows "f sums a \<Longrightarrow> (\<lambda>n. f n / c) sums (a / c)" |
|
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
41970
diff
changeset
|
251 |
by (rule bounded_linear.sums [OF bounded_linear_divide]) |
14416 | 252 |
|
20692 | 253 |
lemma summable_divide: |
254 |
fixes c :: "'a::real_normed_field" |
|
255 |
shows "summable f \<Longrightarrow> summable (\<lambda>n. f n / c)" |
|
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
41970
diff
changeset
|
256 |
by (rule bounded_linear.summable [OF bounded_linear_divide]) |
16819 | 257 |
|
20692 | 258 |
lemma suminf_divide: |
259 |
fixes c :: "'a::real_normed_field" |
|
260 |
shows "summable f \<Longrightarrow> suminf (\<lambda>n. f n / c) = suminf f / c" |
|
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
41970
diff
changeset
|
261 |
by (rule bounded_linear.suminf [OF bounded_linear_divide, symmetric]) |
16819 | 262 |
|
41970 | 263 |
lemma sums_add: |
264 |
fixes a b :: "'a::real_normed_field" |
|
265 |
shows "\<lbrakk>X sums a; Y sums b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n + Y n) sums (a + b)" |
|
44568
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
huffman
parents:
44289
diff
changeset
|
266 |
unfolding sums_def by (simp add: setsum_addf tendsto_add) |
16819 | 267 |
|
41970 | 268 |
lemma summable_add: |
269 |
fixes X Y :: "nat \<Rightarrow> 'a::real_normed_field" |
|
270 |
shows "\<lbrakk>summable X; summable Y\<rbrakk> \<Longrightarrow> summable (\<lambda>n. X n + Y n)" |
|
23121 | 271 |
unfolding summable_def by (auto intro: sums_add) |
16819 | 272 |
|
273 |
lemma suminf_add: |
|
41970 | 274 |
fixes X Y :: "nat \<Rightarrow> 'a::real_normed_field" |
275 |
shows "\<lbrakk>summable X; summable Y\<rbrakk> \<Longrightarrow> suminf X + suminf Y = (\<Sum>n. X n + Y n)" |
|
23121 | 276 |
by (intro sums_unique sums_add summable_sums) |
14416 | 277 |
|
41970 | 278 |
lemma sums_diff: |
279 |
fixes X Y :: "nat \<Rightarrow> 'a::real_normed_field" |
|
280 |
shows "\<lbrakk>X sums a; Y sums b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n - Y n) sums (a - b)" |
|
44568
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
huffman
parents:
44289
diff
changeset
|
281 |
unfolding sums_def by (simp add: setsum_subtractf tendsto_diff) |
23121 | 282 |
|
41970 | 283 |
lemma summable_diff: |
284 |
fixes X Y :: "nat \<Rightarrow> 'a::real_normed_field" |
|
285 |
shows "\<lbrakk>summable X; summable Y\<rbrakk> \<Longrightarrow> summable (\<lambda>n. X n - Y n)" |
|
23121 | 286 |
unfolding summable_def by (auto intro: sums_diff) |
14416 | 287 |
|
288 |
lemma suminf_diff: |
|
41970 | 289 |
fixes X Y :: "nat \<Rightarrow> 'a::real_normed_field" |
290 |
shows "\<lbrakk>summable X; summable Y\<rbrakk> \<Longrightarrow> suminf X - suminf Y = (\<Sum>n. X n - Y n)" |
|
23121 | 291 |
by (intro sums_unique sums_diff summable_sums) |
14416 | 292 |
|
41970 | 293 |
lemma sums_minus: |
294 |
fixes X :: "nat \<Rightarrow> 'a::real_normed_field" |
|
295 |
shows "X sums a ==> (\<lambda>n. - X n) sums (- a)" |
|
44568
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
huffman
parents:
44289
diff
changeset
|
296 |
unfolding sums_def by (simp add: setsum_negf tendsto_minus) |
16819 | 297 |
|
41970 | 298 |
lemma summable_minus: |
299 |
fixes X :: "nat \<Rightarrow> 'a::real_normed_field" |
|
300 |
shows "summable X \<Longrightarrow> summable (\<lambda>n. - X n)" |
|
23121 | 301 |
unfolding summable_def by (auto intro: sums_minus) |
16819 | 302 |
|
41970 | 303 |
lemma suminf_minus: |
304 |
fixes X :: "nat \<Rightarrow> 'a::real_normed_field" |
|
305 |
shows "summable X \<Longrightarrow> (\<Sum>n. - X n) = - (\<Sum>n. X n)" |
|
23121 | 306 |
by (intro sums_unique [symmetric] sums_minus summable_sums) |
14416 | 307 |
|
308 |
lemma sums_group: |
|
41970 | 309 |
fixes f :: "nat \<Rightarrow> 'a::real_normed_field" |
44727
d45acd50a894
modify lemma sums_group, and shorten proofs that use it
huffman
parents:
44726
diff
changeset
|
310 |
shows "\<lbrakk>f sums s; 0 < k\<rbrakk> \<Longrightarrow> (\<lambda>n. setsum f {n*k..<n*k+k}) sums s" |
20692 | 311 |
apply (simp only: sums_def sumr_group) |
31336
e17f13cd1280
generalize constants in SEQ.thy to class metric_space
huffman
parents:
31017
diff
changeset
|
312 |
apply (unfold LIMSEQ_iff, safe) |
20692 | 313 |
apply (drule_tac x="r" in spec, safe) |
314 |
apply (rule_tac x="no" in exI, safe) |
|
315 |
apply (drule_tac x="n*k" in spec) |
|
316 |
apply (erule mp) |
|
317 |
apply (erule order_trans) |
|
318 |
apply simp |
|
14416 | 319 |
done |
320 |
||
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
321 |
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
|
322 |
great as any partial sum.*} |
14416 | 323 |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
324 |
lemma pos_summable: |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
325 |
fixes f:: "nat \<Rightarrow> real" |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
326 |
assumes pos: "!!n. 0 \<le> f n" and le: "!!n. setsum f {0..<n} \<le> x" |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
327 |
shows "summable f" |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
328 |
proof - |
41970 | 329 |
have "convergent (\<lambda>n. setsum f {0..<n})" |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
330 |
proof (rule Bseq_mono_convergent) |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
331 |
show "Bseq (\<lambda>n. setsum f {0..<n})" |
33536 | 332 |
by (rule f_inc_g_dec_Beq_f [of "(\<lambda>n. setsum f {0..<n})" "\<lambda>n. x"]) |
41970 | 333 |
(auto simp add: le pos) |
334 |
next |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
335 |
show "\<forall>m n. m \<le> n \<longrightarrow> setsum f {0..<m} \<le> setsum f {0..<n}" |
41970 | 336 |
by (auto intro: setsum_mono2 pos) |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
337 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
338 |
then obtain L where "(%n. setsum f {0..<n}) ----> L" |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
339 |
by (blast dest: convergentD) |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
340 |
thus ?thesis |
41970 | 341 |
by (force simp add: summable_def sums_def) |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
342 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
343 |
|
20692 | 344 |
lemma series_pos_le: |
345 |
fixes f :: "nat \<Rightarrow> real" |
|
346 |
shows "\<lbrakk>summable f; \<forall>m\<ge>n. 0 \<le> f m\<rbrakk> \<Longrightarrow> setsum f {0..<n} \<le> suminf f" |
|
14416 | 347 |
apply (drule summable_sums) |
348 |
apply (simp add: sums_def) |
|
44568
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
huffman
parents:
44289
diff
changeset
|
349 |
apply (cut_tac k = "setsum f {0..<n}" in tendsto_const) |
15539 | 350 |
apply (erule LIMSEQ_le, blast) |
20692 | 351 |
apply (rule_tac x="n" in exI, clarify) |
15539 | 352 |
apply (rule setsum_mono2) |
353 |
apply auto |
|
14416 | 354 |
done |
355 |
||
356 |
lemma series_pos_less: |
|
20692 | 357 |
fixes f :: "nat \<Rightarrow> real" |
358 |
shows "\<lbrakk>summable f; \<forall>m\<ge>n. 0 < f m\<rbrakk> \<Longrightarrow> setsum f {0..<n} < suminf f" |
|
359 |
apply (rule_tac y="setsum f {0..<Suc n}" in order_less_le_trans) |
|
360 |
apply simp |
|
361 |
apply (erule series_pos_le) |
|
362 |
apply (simp add: order_less_imp_le) |
|
363 |
done |
|
364 |
||
365 |
lemma suminf_gt_zero: |
|
366 |
fixes f :: "nat \<Rightarrow> real" |
|
367 |
shows "\<lbrakk>summable f; \<forall>n. 0 < f n\<rbrakk> \<Longrightarrow> 0 < suminf f" |
|
368 |
by (drule_tac n="0" in series_pos_less, simp_all) |
|
369 |
||
370 |
lemma suminf_ge_zero: |
|
371 |
fixes f :: "nat \<Rightarrow> real" |
|
372 |
shows "\<lbrakk>summable f; \<forall>n. 0 \<le> f n\<rbrakk> \<Longrightarrow> 0 \<le> suminf f" |
|
373 |
by (drule_tac n="0" in series_pos_le, simp_all) |
|
374 |
||
375 |
lemma sumr_pos_lt_pair: |
|
376 |
fixes f :: "nat \<Rightarrow> real" |
|
377 |
shows "\<lbrakk>summable f; |
|
378 |
\<forall>d. 0 < f (k + (Suc(Suc 0) * d)) + f (k + ((Suc(Suc 0) * d) + 1))\<rbrakk> |
|
379 |
\<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
|
380 |
unfolding One_nat_def |
20692 | 381 |
apply (subst suminf_split_initial_segment [where k="k"]) |
382 |
apply assumption |
|
383 |
apply simp |
|
384 |
apply (drule_tac k="k" in summable_ignore_initial_segment) |
|
44727
d45acd50a894
modify lemma sums_group, and shorten proofs that use it
huffman
parents:
44726
diff
changeset
|
385 |
apply (drule_tac k="Suc (Suc 0)" in sums_group [OF summable_sums], simp) |
20692 | 386 |
apply simp |
387 |
apply (frule sums_unique) |
|
388 |
apply (drule sums_summable) |
|
389 |
apply simp |
|
390 |
apply (erule suminf_gt_zero) |
|
391 |
apply (simp add: add_ac) |
|
14416 | 392 |
done |
393 |
||
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
394 |
text{*Sum of a geometric progression.*} |
14416 | 395 |
|
17149
e2b19c92ef51
Lemmas on dvd, power and finite summation added or strengthened.
ballarin
parents:
16819
diff
changeset
|
396 |
lemmas sumr_geometric = geometric_sum [where 'a = real] |
14416 | 397 |
|
20692 | 398 |
lemma geometric_sums: |
31017 | 399 |
fixes x :: "'a::{real_normed_field}" |
20692 | 400 |
shows "norm x < 1 \<Longrightarrow> (\<lambda>n. x ^ n) sums (1 / (1 - x))" |
401 |
proof - |
|
402 |
assume less_1: "norm x < 1" |
|
403 |
hence neq_1: "x \<noteq> 1" by auto |
|
404 |
hence neq_0: "x - 1 \<noteq> 0" by simp |
|
405 |
from less_1 have lim_0: "(\<lambda>n. x ^ n) ----> 0" |
|
406 |
by (rule LIMSEQ_power_zero) |
|
22719
c51667189bd3
lemma geometric_sum no longer needs class division_by_zero
huffman
parents:
21404
diff
changeset
|
407 |
hence "(\<lambda>n. x ^ n / (x - 1) - 1 / (x - 1)) ----> 0 / (x - 1) - 1 / (x - 1)" |
44568
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
huffman
parents:
44289
diff
changeset
|
408 |
using neq_0 by (intro tendsto_intros) |
20692 | 409 |
hence "(\<lambda>n. (x ^ n - 1) / (x - 1)) ----> 1 / (1 - x)" |
410 |
by (simp add: nonzero_minus_divide_right [OF neq_0] diff_divide_distrib) |
|
411 |
thus "(\<lambda>n. x ^ n) sums (1 / (1 - x))" |
|
412 |
by (simp add: sums_def geometric_sum neq_1) |
|
413 |
qed |
|
414 |
||
415 |
lemma summable_geometric: |
|
31017 | 416 |
fixes x :: "'a::{real_normed_field}" |
20692 | 417 |
shows "norm x < 1 \<Longrightarrow> summable (\<lambda>n. x ^ n)" |
418 |
by (rule geometric_sums [THEN sums_summable]) |
|
14416 | 419 |
|
36409 | 420 |
lemma half: "0 < 1 / (2::'a::{number_ring,linordered_field_inverse_zero})" |
41970 | 421 |
by arith |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
422 |
|
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
423 |
lemma power_half_series: "(\<lambda>n. (1/2::real)^Suc n) sums 1" |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
424 |
proof - |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
425 |
have 2: "(\<lambda>n. (1/2::real)^n) sums 2" using geometric_sums [of "1/2::real"] |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
426 |
by auto |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
427 |
have "(\<lambda>n. (1/2::real)^Suc n) = (\<lambda>n. (1 / 2) ^ n / 2)" |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
428 |
by simp |
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
41970
diff
changeset
|
429 |
thus ?thesis using sums_divide [OF 2, of 2] |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
430 |
by simp |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
431 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
432 |
|
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
433 |
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
|
434 |
|
15539 | 435 |
lemma summable_convergent_sumr_iff: |
436 |
"summable f = convergent (%n. setsum f {0..<n})" |
|
14416 | 437 |
by (simp add: summable_def sums_def convergent_def) |
438 |
||
41970 | 439 |
lemma summable_LIMSEQ_zero: |
44726 | 440 |
fixes f :: "nat \<Rightarrow> 'a::real_normed_vector" |
41970 | 441 |
shows "summable f \<Longrightarrow> f ----> 0" |
20689 | 442 |
apply (drule summable_convergent_sumr_iff [THEN iffD1]) |
20692 | 443 |
apply (drule convergent_Cauchy) |
31336
e17f13cd1280
generalize constants in SEQ.thy to class metric_space
huffman
parents:
31017
diff
changeset
|
444 |
apply (simp only: Cauchy_iff LIMSEQ_iff, safe) |
20689 | 445 |
apply (drule_tac x="r" in spec, safe) |
446 |
apply (rule_tac x="M" in exI, safe) |
|
447 |
apply (drule_tac x="Suc n" in spec, simp) |
|
448 |
apply (drule_tac x="n" in spec, simp) |
|
449 |
done |
|
450 |
||
32707
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
451 |
lemma suminf_le: |
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
452 |
fixes x :: real |
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
453 |
shows "summable f \<Longrightarrow> (!!n. setsum f {0..<n} \<le> x) \<Longrightarrow> suminf f \<le> x" |
41970 | 454 |
by (simp add: summable_convergent_sumr_iff suminf_eq_lim lim_le) |
32707
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
455 |
|
14416 | 456 |
lemma summable_Cauchy: |
41970 | 457 |
"summable (f::nat \<Rightarrow> 'a::banach) = |
20848 | 458 |
(\<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
|
459 |
apply (simp only: summable_convergent_sumr_iff Cauchy_convergent_iff [symmetric] Cauchy_iff, safe) |
20410 | 460 |
apply (drule spec, drule (1) mp) |
461 |
apply (erule exE, rule_tac x="M" in exI, clarify) |
|
462 |
apply (rule_tac x="m" and y="n" in linorder_le_cases) |
|
463 |
apply (frule (1) order_trans) |
|
464 |
apply (drule_tac x="n" in spec, drule (1) mp) |
|
465 |
apply (drule_tac x="m" in spec, drule (1) mp) |
|
466 |
apply (simp add: setsum_diff [symmetric]) |
|
467 |
apply simp |
|
468 |
apply (drule spec, drule (1) mp) |
|
469 |
apply (erule exE, rule_tac x="N" in exI, clarify) |
|
470 |
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
|
471 |
apply (subst norm_minus_commute) |
20410 | 472 |
apply (simp add: setsum_diff [symmetric]) |
473 |
apply (simp add: setsum_diff [symmetric]) |
|
14416 | 474 |
done |
475 |
||
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
476 |
text{*Comparison test*} |
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
477 |
|
20692 | 478 |
lemma norm_setsum: |
479 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" |
|
480 |
shows "norm (setsum f A) \<le> (\<Sum>i\<in>A. norm (f i))" |
|
481 |
apply (case_tac "finite A") |
|
482 |
apply (erule finite_induct) |
|
483 |
apply simp |
|
484 |
apply simp |
|
485 |
apply (erule order_trans [OF norm_triangle_ineq add_left_mono]) |
|
486 |
apply simp |
|
487 |
done |
|
488 |
||
14416 | 489 |
lemma summable_comparison_test: |
20848 | 490 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
491 |
shows "\<lbrakk>\<exists>N. \<forall>n\<ge>N. norm (f n) \<le> g n; summable g\<rbrakk> \<Longrightarrow> summable f" |
|
20692 | 492 |
apply (simp add: summable_Cauchy, safe) |
493 |
apply (drule_tac x="e" in spec, safe) |
|
494 |
apply (rule_tac x = "N + Na" in exI, safe) |
|
14416 | 495 |
apply (rotate_tac 2) |
496 |
apply (drule_tac x = m in spec) |
|
497 |
apply (auto, rotate_tac 2, drule_tac x = n in spec) |
|
20848 | 498 |
apply (rule_tac y = "\<Sum>k=m..<n. norm (f k)" in order_le_less_trans) |
499 |
apply (rule norm_setsum) |
|
15539 | 500 |
apply (rule_tac y = "setsum g {m..<n}" in order_le_less_trans) |
22998 | 501 |
apply (auto intro: setsum_mono simp add: abs_less_iff) |
14416 | 502 |
done |
503 |
||
20848 | 504 |
lemma summable_norm_comparison_test: |
505 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
|
506 |
shows "\<lbrakk>\<exists>N. \<forall>n\<ge>N. norm (f n) \<le> g n; summable g\<rbrakk> |
|
507 |
\<Longrightarrow> summable (\<lambda>n. norm (f n))" |
|
508 |
apply (rule summable_comparison_test) |
|
509 |
apply (auto) |
|
510 |
done |
|
511 |
||
14416 | 512 |
lemma summable_rabs_comparison_test: |
20692 | 513 |
fixes f :: "nat \<Rightarrow> real" |
514 |
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 | 515 |
apply (rule summable_comparison_test) |
15543 | 516 |
apply (auto) |
14416 | 517 |
done |
518 |
||
23084 | 519 |
text{*Summability of geometric series for real algebras*} |
520 |
||
521 |
lemma complete_algebra_summable_geometric: |
|
31017 | 522 |
fixes x :: "'a::{real_normed_algebra_1,banach}" |
23084 | 523 |
shows "norm x < 1 \<Longrightarrow> summable (\<lambda>n. x ^ n)" |
524 |
proof (rule summable_comparison_test) |
|
525 |
show "\<exists>N. \<forall>n\<ge>N. norm (x ^ n) \<le> norm x ^ n" |
|
526 |
by (simp add: norm_power_ineq) |
|
527 |
show "norm x < 1 \<Longrightarrow> summable (\<lambda>n. norm x ^ n)" |
|
528 |
by (simp add: summable_geometric) |
|
529 |
qed |
|
530 |
||
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
531 |
text{*Limit comparison property for series (c.f. jrh)*} |
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
532 |
|
14416 | 533 |
lemma summable_le: |
20692 | 534 |
fixes f g :: "nat \<Rightarrow> real" |
535 |
shows "\<lbrakk>\<forall>n. f n \<le> g n; summable f; summable g\<rbrakk> \<Longrightarrow> suminf f \<le> suminf g" |
|
14416 | 536 |
apply (drule summable_sums)+ |
20692 | 537 |
apply (simp only: sums_def, erule (1) LIMSEQ_le) |
14416 | 538 |
apply (rule exI) |
15539 | 539 |
apply (auto intro!: setsum_mono) |
14416 | 540 |
done |
541 |
||
542 |
lemma summable_le2: |
|
20692 | 543 |
fixes f g :: "nat \<Rightarrow> real" |
544 |
shows "\<lbrakk>\<forall>n. \<bar>f n\<bar> \<le> g n; summable g\<rbrakk> \<Longrightarrow> summable f \<and> suminf f \<le> suminf g" |
|
20848 | 545 |
apply (subgoal_tac "summable f") |
546 |
apply (auto intro!: summable_le) |
|
22998 | 547 |
apply (simp add: abs_le_iff) |
20848 | 548 |
apply (rule_tac g="g" in summable_comparison_test, simp_all) |
14416 | 549 |
done |
550 |
||
19106
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
551 |
(* 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
|
552 |
lemma suminf_0_le: |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
553 |
fixes f::"nat\<Rightarrow>real" |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
554 |
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
|
555 |
shows "0 \<le> suminf f" |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
556 |
proof - |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
557 |
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
|
558 |
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
|
559 |
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
|
560 |
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
|
561 |
ultimately have "suminf ?g \<le> suminf f" by (rule summable_le) |
44289 | 562 |
then show "0 \<le> suminf f" by simp |
41970 | 563 |
qed |
19106
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
564 |
|
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
565 |
|
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
566 |
text{*Absolute convergence imples normal convergence*} |
20848 | 567 |
lemma summable_norm_cancel: |
568 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
|
569 |
shows "summable (\<lambda>n. norm (f n)) \<Longrightarrow> summable f" |
|
20692 | 570 |
apply (simp only: summable_Cauchy, safe) |
571 |
apply (drule_tac x="e" in spec, safe) |
|
572 |
apply (rule_tac x="N" in exI, safe) |
|
573 |
apply (drule_tac x="m" in spec, safe) |
|
20848 | 574 |
apply (rule order_le_less_trans [OF norm_setsum]) |
575 |
apply (rule order_le_less_trans [OF abs_ge_self]) |
|
20692 | 576 |
apply simp |
14416 | 577 |
done |
578 |
||
20848 | 579 |
lemma summable_rabs_cancel: |
580 |
fixes f :: "nat \<Rightarrow> real" |
|
581 |
shows "summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> summable f" |
|
582 |
by (rule summable_norm_cancel, simp) |
|
583 |
||
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
584 |
text{*Absolute convergence of series*} |
20848 | 585 |
lemma summable_norm: |
586 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
|
587 |
shows "summable (\<lambda>n. norm (f n)) \<Longrightarrow> norm (suminf f) \<le> (\<Sum>n. norm (f n))" |
|
44568
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
huffman
parents:
44289
diff
changeset
|
588 |
by (auto intro: LIMSEQ_le tendsto_norm summable_norm_cancel |
20848 | 589 |
summable_sumr_LIMSEQ_suminf norm_setsum) |
590 |
||
14416 | 591 |
lemma summable_rabs: |
20692 | 592 |
fixes f :: "nat \<Rightarrow> real" |
593 |
shows "summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> \<bar>suminf f\<bar> \<le> (\<Sum>n. \<bar>f n\<bar>)" |
|
20848 | 594 |
by (fold real_norm_def, rule summable_norm) |
14416 | 595 |
|
596 |
subsection{* The Ratio Test*} |
|
597 |
||
20848 | 598 |
lemma norm_ratiotest_lemma: |
22852 | 599 |
fixes x y :: "'a::real_normed_vector" |
20848 | 600 |
shows "\<lbrakk>c \<le> 0; norm x \<le> c * norm y\<rbrakk> \<Longrightarrow> x = 0" |
601 |
apply (subgoal_tac "norm x \<le> 0", simp) |
|
602 |
apply (erule order_trans) |
|
603 |
apply (simp add: mult_le_0_iff) |
|
604 |
done |
|
605 |
||
14416 | 606 |
lemma rabs_ratiotest_lemma: "[| c \<le> 0; abs x \<le> c * abs y |] ==> x = (0::real)" |
20848 | 607 |
by (erule norm_ratiotest_lemma, simp) |
14416 | 608 |
|
609 |
lemma le_Suc_ex: "(k::nat) \<le> l ==> (\<exists>n. l = k + n)" |
|
610 |
apply (drule le_imp_less_or_eq) |
|
611 |
apply (auto dest: less_imp_Suc_add) |
|
612 |
done |
|
613 |
||
614 |
lemma le_Suc_ex_iff: "((k::nat) \<le> l) = (\<exists>n. l = k + n)" |
|
615 |
by (auto simp add: le_Suc_ex) |
|
616 |
||
617 |
(*All this trouble just to get 0<c *) |
|
618 |
lemma ratio_test_lemma2: |
|
20848 | 619 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
620 |
shows "\<lbrakk>\<forall>n\<ge>N. norm (f (Suc n)) \<le> c * norm (f n)\<rbrakk> \<Longrightarrow> 0 < c \<or> summable f" |
|
14416 | 621 |
apply (simp (no_asm) add: linorder_not_le [symmetric]) |
622 |
apply (simp add: summable_Cauchy) |
|
15543 | 623 |
apply (safe, subgoal_tac "\<forall>n. N < n --> f (n) = 0") |
624 |
prefer 2 |
|
625 |
apply clarify |
|
30082
43c5b7bfc791
make more proofs work whether or not One_nat_def is a simp rule
huffman
parents:
29803
diff
changeset
|
626 |
apply(erule_tac x = "n - Suc 0" in allE) |
15543 | 627 |
apply (simp add:diff_Suc split:nat.splits) |
20848 | 628 |
apply (blast intro: norm_ratiotest_lemma) |
14416 | 629 |
apply (rule_tac x = "Suc N" in exI, clarify) |
44710 | 630 |
apply(simp cong del: setsum_cong cong: setsum_ivl_cong) |
14416 | 631 |
done |
632 |
||
633 |
lemma ratio_test: |
|
20848 | 634 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
635 |
shows "\<lbrakk>c < 1; \<forall>n\<ge>N. norm (f (Suc n)) \<le> c * norm (f n)\<rbrakk> \<Longrightarrow> summable f" |
|
14416 | 636 |
apply (frule ratio_test_lemma2, auto) |
41970 | 637 |
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
|
638 |
in summable_comparison_test) |
14416 | 639 |
apply (rule_tac x = N in exI, safe) |
640 |
apply (drule le_Suc_ex_iff [THEN iffD1]) |
|
22959 | 641 |
apply (auto simp add: power_add field_power_not_zero) |
15539 | 642 |
apply (induct_tac "na", auto) |
20848 | 643 |
apply (rule_tac y = "c * norm (f (N + n))" in order_trans) |
14416 | 644 |
apply (auto intro: mult_right_mono simp add: summable_def) |
20848 | 645 |
apply (rule_tac x = "norm (f N) * (1/ (1 - c)) / (c ^ N)" in exI) |
41970 | 646 |
apply (rule sums_divide) |
27108 | 647 |
apply (rule sums_mult) |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
648 |
apply (auto intro!: geometric_sums) |
14416 | 649 |
done |
650 |
||
23111 | 651 |
subsection {* Cauchy Product Formula *} |
652 |
||
653 |
(* Proof based on Analysis WebNotes: Chapter 07, Class 41 |
|
654 |
http://www.math.unl.edu/~webnotes/classes/class41/prp77.htm *) |
|
655 |
||
656 |
lemma setsum_triangle_reindex: |
|
657 |
fixes n :: nat |
|
658 |
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))" |
|
659 |
proof - |
|
660 |
have "(\<Sum>(i, j)\<in>{(i, j). i + j < n}. f i j) = |
|
661 |
(\<Sum>(k, i)\<in>(SIGMA k:{0..<n}. {0..k}). f i (k - i))" |
|
662 |
proof (rule setsum_reindex_cong) |
|
663 |
show "inj_on (\<lambda>(k,i). (i, k - i)) (SIGMA k:{0..<n}. {0..k})" |
|
664 |
by (rule inj_on_inverseI [where g="\<lambda>(i,j). (i+j, i)"], auto) |
|
665 |
show "{(i,j). i + j < n} = (\<lambda>(k,i). (i, k - i)) ` (SIGMA k:{0..<n}. {0..k})" |
|
666 |
by (safe, rule_tac x="(a+b,a)" in image_eqI, auto) |
|
667 |
show "\<And>a. (\<lambda>(k, i). f i (k - i)) a = split f ((\<lambda>(k, i). (i, k - i)) a)" |
|
668 |
by clarify |
|
669 |
qed |
|
670 |
thus ?thesis by (simp add: setsum_Sigma) |
|
671 |
qed |
|
672 |
||
673 |
lemma Cauchy_product_sums: |
|
674 |
fixes a b :: "nat \<Rightarrow> 'a::{real_normed_algebra,banach}" |
|
675 |
assumes a: "summable (\<lambda>k. norm (a k))" |
|
676 |
assumes b: "summable (\<lambda>k. norm (b k))" |
|
677 |
shows "(\<lambda>k. \<Sum>i=0..k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))" |
|
678 |
proof - |
|
679 |
let ?S1 = "\<lambda>n::nat. {0..<n} \<times> {0..<n}" |
|
680 |
let ?S2 = "\<lambda>n::nat. {(i,j). i + j < n}" |
|
681 |
have S1_mono: "\<And>m n. m \<le> n \<Longrightarrow> ?S1 m \<subseteq> ?S1 n" by auto |
|
682 |
have S2_le_S1: "\<And>n. ?S2 n \<subseteq> ?S1 n" by auto |
|
683 |
have S1_le_S2: "\<And>n. ?S1 (n div 2) \<subseteq> ?S2 n" by auto |
|
684 |
have finite_S1: "\<And>n. finite (?S1 n)" by simp |
|
685 |
with S2_le_S1 have finite_S2: "\<And>n. finite (?S2 n)" by (rule finite_subset) |
|
686 |
||
687 |
let ?g = "\<lambda>(i,j). a i * b j" |
|
688 |
let ?f = "\<lambda>(i,j). norm (a i) * norm (b j)" |
|
689 |
have f_nonneg: "\<And>x. 0 \<le> ?f x" |
|
690 |
by (auto simp add: mult_nonneg_nonneg) |
|
691 |
hence norm_setsum_f: "\<And>A. norm (setsum ?f A) = setsum ?f A" |
|
692 |
unfolding real_norm_def |
|
693 |
by (simp only: abs_of_nonneg setsum_nonneg [rule_format]) |
|
694 |
||
695 |
have "(\<lambda>n. (\<Sum>k=0..<n. a k) * (\<Sum>k=0..<n. b k)) |
|
696 |
----> (\<Sum>k. a k) * (\<Sum>k. b k)" |
|
44568
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
huffman
parents:
44289
diff
changeset
|
697 |
by (intro tendsto_mult summable_sumr_LIMSEQ_suminf |
23111 | 698 |
summable_norm_cancel [OF a] summable_norm_cancel [OF b]) |
699 |
hence 1: "(\<lambda>n. setsum ?g (?S1 n)) ----> (\<Sum>k. a k) * (\<Sum>k. b k)" |
|
700 |
by (simp only: setsum_product setsum_Sigma [rule_format] |
|
701 |
finite_atLeastLessThan) |
|
702 |
||
703 |
have "(\<lambda>n. (\<Sum>k=0..<n. norm (a k)) * (\<Sum>k=0..<n. norm (b k))) |
|
704 |
----> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))" |
|
44568
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
huffman
parents:
44289
diff
changeset
|
705 |
using a b by (intro tendsto_mult summable_sumr_LIMSEQ_suminf) |
23111 | 706 |
hence "(\<lambda>n. setsum ?f (?S1 n)) ----> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))" |
707 |
by (simp only: setsum_product setsum_Sigma [rule_format] |
|
708 |
finite_atLeastLessThan) |
|
709 |
hence "convergent (\<lambda>n. setsum ?f (?S1 n))" |
|
710 |
by (rule convergentI) |
|
711 |
hence Cauchy: "Cauchy (\<lambda>n. setsum ?f (?S1 n))" |
|
712 |
by (rule convergent_Cauchy) |
|
36657 | 713 |
have "Zfun (\<lambda>n. setsum ?f (?S1 n - ?S2 n)) sequentially" |
714 |
proof (rule ZfunI, simp only: eventually_sequentially norm_setsum_f) |
|
23111 | 715 |
fix r :: real |
716 |
assume r: "0 < r" |
|
717 |
from CauchyD [OF Cauchy r] obtain N |
|
718 |
where "\<forall>m\<ge>N. \<forall>n\<ge>N. norm (setsum ?f (?S1 m) - setsum ?f (?S1 n)) < r" .. |
|
719 |
hence "\<And>m n. \<lbrakk>N \<le> n; n \<le> m\<rbrakk> \<Longrightarrow> norm (setsum ?f (?S1 m - ?S1 n)) < r" |
|
720 |
by (simp only: setsum_diff finite_S1 S1_mono) |
|
721 |
hence N: "\<And>m n. \<lbrakk>N \<le> n; n \<le> m\<rbrakk> \<Longrightarrow> setsum ?f (?S1 m - ?S1 n) < r" |
|
722 |
by (simp only: norm_setsum_f) |
|
723 |
show "\<exists>N. \<forall>n\<ge>N. setsum ?f (?S1 n - ?S2 n) < r" |
|
724 |
proof (intro exI allI impI) |
|
725 |
fix n assume "2 * N \<le> n" |
|
726 |
hence n: "N \<le> n div 2" by simp |
|
727 |
have "setsum ?f (?S1 n - ?S2 n) \<le> setsum ?f (?S1 n - ?S1 (n div 2))" |
|
728 |
by (intro setsum_mono2 finite_Diff finite_S1 f_nonneg |
|
729 |
Diff_mono subset_refl S1_le_S2) |
|
730 |
also have "\<dots> < r" |
|
731 |
using n div_le_dividend by (rule N) |
|
732 |
finally show "setsum ?f (?S1 n - ?S2 n) < r" . |
|
733 |
qed |
|
734 |
qed |
|
36657 | 735 |
hence "Zfun (\<lambda>n. setsum ?g (?S1 n - ?S2 n)) sequentially" |
736 |
apply (rule Zfun_le [rule_format]) |
|
23111 | 737 |
apply (simp only: norm_setsum_f) |
738 |
apply (rule order_trans [OF norm_setsum setsum_mono]) |
|
739 |
apply (auto simp add: norm_mult_ineq) |
|
740 |
done |
|
741 |
hence 2: "(\<lambda>n. setsum ?g (?S1 n) - setsum ?g (?S2 n)) ----> 0" |
|
36660
1cc4ab4b7ff7
make (X ----> L) an abbreviation for (X ---> L) sequentially
huffman
parents:
36657
diff
changeset
|
742 |
unfolding tendsto_Zfun_iff diff_0_right |
36657 | 743 |
by (simp only: setsum_diff finite_S1 S2_le_S1) |
23111 | 744 |
|
745 |
with 1 have "(\<lambda>n. setsum ?g (?S2 n)) ----> (\<Sum>k. a k) * (\<Sum>k. b k)" |
|
746 |
by (rule LIMSEQ_diff_approach_zero2) |
|
747 |
thus ?thesis by (simp only: sums_def setsum_triangle_reindex) |
|
748 |
qed |
|
749 |
||
750 |
lemma Cauchy_product: |
|
751 |
fixes a b :: "nat \<Rightarrow> 'a::{real_normed_algebra,banach}" |
|
752 |
assumes a: "summable (\<lambda>k. norm (a k))" |
|
753 |
assumes b: "summable (\<lambda>k. norm (b k))" |
|
754 |
shows "(\<Sum>k. a k) * (\<Sum>k. b k) = (\<Sum>k. \<Sum>i=0..k. a i * b (k - i))" |
|
23441 | 755 |
using a b |
23111 | 756 |
by (rule Cauchy_product_sums [THEN sums_unique]) |
757 |
||
14416 | 758 |
end |