author | huffman |
Thu, 18 Aug 2011 13:36:58 -0700 | |
changeset 44282 | f0de18b62d63 |
parent 41970 | 47d6e13d1710 |
child 44289 | d81d09cdab9c |
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 |
|
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 |
|
32877
6f09346c7c08
New lemmas connected with the reals and infinite series
paulson
parents:
32707
diff
changeset
|
35 |
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
|
36 |
by simp |
6f09346c7c08
New lemmas connected with the reals and infinite series
paulson
parents:
32707
diff
changeset
|
37 |
|
15539 | 38 |
lemma sumr_diff_mult_const: |
39 |
"setsum f {0..<n} - (real n*r) = setsum (%i. f i - r) {0..<n::nat}" |
|
15536 | 40 |
by (simp add: diff_minus setsum_addf real_of_nat_def) |
41 |
||
15542 | 42 |
lemma real_setsum_nat_ivl_bounded: |
43 |
"(!!p. p < n \<Longrightarrow> f(p) \<le> K) |
|
44 |
\<Longrightarrow> setsum f {0..<n::nat} \<le> real n * K" |
|
45 |
using setsum_bounded[where A = "{0..<n}"] |
|
46 |
by (auto simp:real_of_nat_def) |
|
14416 | 47 |
|
15539 | 48 |
(* Generalize from real to some algebraic structure? *) |
49 |
lemma sumr_minus_one_realpow_zero [simp]: |
|
15543 | 50 |
"(\<Sum>i=0..<2*n. (-1) ^ Suc i) = (0::real)" |
15251 | 51 |
by (induct "n", auto) |
14416 | 52 |
|
15539 | 53 |
(* FIXME this is an awful lemma! *) |
54 |
lemma sumr_one_lb_realpow_zero [simp]: |
|
55 |
"(\<Sum>n=Suc 0..<n. f(n) * (0::real) ^ n) = 0" |
|
20692 | 56 |
by (rule setsum_0', simp) |
14416 | 57 |
|
15543 | 58 |
lemma sumr_group: |
15539 | 59 |
"(\<Sum>m=0..<n::nat. setsum f {m * k ..< m*k + k}) = setsum f {0 ..< n * k}" |
15543 | 60 |
apply (subgoal_tac "k = 0 | 0 < k", auto) |
15251 | 61 |
apply (induct "n") |
15539 | 62 |
apply (simp_all add: setsum_add_nat_ivl add_commute) |
14416 | 63 |
done |
15539 | 64 |
|
20692 | 65 |
lemma sumr_offset3: |
66 |
"setsum f {0::nat..<n+k} = (\<Sum>m=0..<n. f (m+k)) + setsum f {0..<k}" |
|
67 |
apply (subst setsum_shift_bounds_nat_ivl [symmetric]) |
|
68 |
apply (simp add: setsum_add_nat_ivl add_commute) |
|
69 |
done |
|
70 |
||
16819 | 71 |
lemma sumr_offset: |
20692 | 72 |
fixes f :: "nat \<Rightarrow> 'a::ab_group_add" |
73 |
shows "(\<Sum>m=0..<n. f(m+k)) = setsum f {0..<n+k} - setsum f {0..<k}" |
|
74 |
by (simp add: sumr_offset3) |
|
16819 | 75 |
|
76 |
lemma sumr_offset2: |
|
77 |
"\<forall>f. (\<Sum>m=0..<n::nat. f(m+k)::real) = setsum f {0..<n+k} - setsum f {0..<k}" |
|
20692 | 78 |
by (simp add: sumr_offset) |
16819 | 79 |
|
80 |
lemma sumr_offset4: |
|
20692 | 81 |
"\<forall>n f. setsum f {0::nat..<n+k} = (\<Sum>m=0..<n. f (m+k)::real) + setsum f {0..<k}" |
82 |
by (clarify, rule sumr_offset3) |
|
16819 | 83 |
|
14416 | 84 |
subsection{* Infinite Sums, by the Properties of Limits*} |
85 |
||
86 |
(*---------------------- |
|
41970 | 87 |
suminf is the sum |
14416 | 88 |
---------------------*) |
89 |
lemma sums_summable: "f sums l ==> summable f" |
|
41970 | 90 |
by (simp add: sums_def summable_def, blast) |
14416 | 91 |
|
41970 | 92 |
lemma summable_sums: |
93 |
fixes f :: "nat \<Rightarrow> 'a::{t2_space, comm_monoid_add}" assumes "summable f" shows "f sums (suminf f)" |
|
94 |
proof - |
|
95 |
from assms guess s unfolding summable_def sums_def_raw .. note s = this |
|
96 |
then show ?thesis unfolding sums_def_raw suminf_def |
|
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) |
|
16819 | 128 |
apply (rule LIMSEQ_diff_const) |
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 . |
41970 | 172 |
from LIMSEQ_add_const[OF this, 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 |
|
189 |
apply (rule LIMSEQ_const) |
|
190 |
done |
|
191 |
qed |
|
14416 | 192 |
|
41970 | 193 |
lemma sums_zero[simp, intro]: "(\<lambda>n. 0) sums 0" |
23121 | 194 |
unfolding sums_def by (simp add: LIMSEQ_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)" |
|
204 |
unfolding sums_def by (drule LIMSEQ, simp only: setsum) |
|
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)" |
|
23121 | 266 |
unfolding sums_def by (simp add: setsum_addf LIMSEQ_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)" |
|
23121 | 281 |
unfolding sums_def by (simp add: setsum_subtractf LIMSEQ_diff) |
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)" |
|
23121 | 296 |
unfolding sums_def by (simp add: setsum_negf LIMSEQ_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" |
310 |
shows "[|summable f; 0 < k |] ==> (%n. setsum f {n*k..<n*k+k}) sums (suminf f)" |
|
14416 | 311 |
apply (drule summable_sums) |
20692 | 312 |
apply (simp only: sums_def sumr_group) |
31336
e17f13cd1280
generalize constants in SEQ.thy to class metric_space
huffman
parents:
31017
diff
changeset
|
313 |
apply (unfold LIMSEQ_iff, safe) |
20692 | 314 |
apply (drule_tac x="r" in spec, safe) |
315 |
apply (rule_tac x="no" in exI, safe) |
|
316 |
apply (drule_tac x="n*k" in spec) |
|
317 |
apply (erule mp) |
|
318 |
apply (erule order_trans) |
|
319 |
apply simp |
|
14416 | 320 |
done |
321 |
||
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
322 |
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
|
323 |
great as any partial sum.*} |
14416 | 324 |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
325 |
lemma pos_summable: |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
326 |
fixes f:: "nat \<Rightarrow> real" |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
327 |
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
|
328 |
shows "summable f" |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
329 |
proof - |
41970 | 330 |
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
|
331 |
proof (rule Bseq_mono_convergent) |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
332 |
show "Bseq (\<lambda>n. setsum f {0..<n})" |
33536 | 333 |
by (rule f_inc_g_dec_Beq_f [of "(\<lambda>n. setsum f {0..<n})" "\<lambda>n. x"]) |
41970 | 334 |
(auto simp add: le pos) |
335 |
next |
|
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
336 |
show "\<forall>m n. m \<le> n \<longrightarrow> setsum f {0..<m} \<le> setsum f {0..<n}" |
41970 | 337 |
by (auto intro: setsum_mono2 pos) |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
338 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
339 |
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
|
340 |
by (blast dest: convergentD) |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
341 |
thus ?thesis |
41970 | 342 |
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
|
343 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
344 |
|
20692 | 345 |
lemma series_pos_le: |
346 |
fixes f :: "nat \<Rightarrow> real" |
|
347 |
shows "\<lbrakk>summable f; \<forall>m\<ge>n. 0 \<le> f m\<rbrakk> \<Longrightarrow> setsum f {0..<n} \<le> suminf f" |
|
14416 | 348 |
apply (drule summable_sums) |
349 |
apply (simp add: sums_def) |
|
15539 | 350 |
apply (cut_tac k = "setsum f {0..<n}" in LIMSEQ_const) |
351 |
apply (erule LIMSEQ_le, blast) |
|
20692 | 352 |
apply (rule_tac x="n" in exI, clarify) |
15539 | 353 |
apply (rule setsum_mono2) |
354 |
apply auto |
|
14416 | 355 |
done |
356 |
||
357 |
lemma series_pos_less: |
|
20692 | 358 |
fixes f :: "nat \<Rightarrow> real" |
359 |
shows "\<lbrakk>summable f; \<forall>m\<ge>n. 0 < f m\<rbrakk> \<Longrightarrow> setsum f {0..<n} < suminf f" |
|
360 |
apply (rule_tac y="setsum f {0..<Suc n}" in order_less_le_trans) |
|
361 |
apply simp |
|
362 |
apply (erule series_pos_le) |
|
363 |
apply (simp add: order_less_imp_le) |
|
364 |
done |
|
365 |
||
366 |
lemma suminf_gt_zero: |
|
367 |
fixes f :: "nat \<Rightarrow> real" |
|
368 |
shows "\<lbrakk>summable f; \<forall>n. 0 < f n\<rbrakk> \<Longrightarrow> 0 < suminf f" |
|
369 |
by (drule_tac n="0" in series_pos_less, simp_all) |
|
370 |
||
371 |
lemma suminf_ge_zero: |
|
372 |
fixes f :: "nat \<Rightarrow> real" |
|
373 |
shows "\<lbrakk>summable f; \<forall>n. 0 \<le> f n\<rbrakk> \<Longrightarrow> 0 \<le> suminf f" |
|
374 |
by (drule_tac n="0" in series_pos_le, simp_all) |
|
375 |
||
376 |
lemma sumr_pos_lt_pair: |
|
377 |
fixes f :: "nat \<Rightarrow> real" |
|
378 |
shows "\<lbrakk>summable f; |
|
379 |
\<forall>d. 0 < f (k + (Suc(Suc 0) * d)) + f (k + ((Suc(Suc 0) * d) + 1))\<rbrakk> |
|
380 |
\<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
|
381 |
unfolding One_nat_def |
20692 | 382 |
apply (subst suminf_split_initial_segment [where k="k"]) |
383 |
apply assumption |
|
384 |
apply simp |
|
385 |
apply (drule_tac k="k" in summable_ignore_initial_segment) |
|
386 |
apply (drule_tac k="Suc (Suc 0)" in sums_group, simp) |
|
387 |
apply simp |
|
388 |
apply (frule sums_unique) |
|
389 |
apply (drule sums_summable) |
|
390 |
apply simp |
|
391 |
apply (erule suminf_gt_zero) |
|
392 |
apply (simp add: add_ac) |
|
14416 | 393 |
done |
394 |
||
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
395 |
text{*Sum of a geometric progression.*} |
14416 | 396 |
|
17149
e2b19c92ef51
Lemmas on dvd, power and finite summation added or strengthened.
ballarin
parents:
16819
diff
changeset
|
397 |
lemmas sumr_geometric = geometric_sum [where 'a = real] |
14416 | 398 |
|
20692 | 399 |
lemma geometric_sums: |
31017 | 400 |
fixes x :: "'a::{real_normed_field}" |
20692 | 401 |
shows "norm x < 1 \<Longrightarrow> (\<lambda>n. x ^ n) sums (1 / (1 - x))" |
402 |
proof - |
|
403 |
assume less_1: "norm x < 1" |
|
404 |
hence neq_1: "x \<noteq> 1" by auto |
|
405 |
hence neq_0: "x - 1 \<noteq> 0" by simp |
|
406 |
from less_1 have lim_0: "(\<lambda>n. x ^ n) ----> 0" |
|
407 |
by (rule LIMSEQ_power_zero) |
|
22719
c51667189bd3
lemma geometric_sum no longer needs class division_by_zero
huffman
parents:
21404
diff
changeset
|
408 |
hence "(\<lambda>n. x ^ n / (x - 1) - 1 / (x - 1)) ----> 0 / (x - 1) - 1 / (x - 1)" |
20692 | 409 |
using neq_0 by (intro LIMSEQ_divide LIMSEQ_diff LIMSEQ_const) |
410 |
hence "(\<lambda>n. (x ^ n - 1) / (x - 1)) ----> 1 / (1 - x)" |
|
411 |
by (simp add: nonzero_minus_divide_right [OF neq_0] diff_divide_distrib) |
|
412 |
thus "(\<lambda>n. x ^ n) sums (1 / (1 - x))" |
|
413 |
by (simp add: sums_def geometric_sum neq_1) |
|
414 |
qed |
|
415 |
||
416 |
lemma summable_geometric: |
|
31017 | 417 |
fixes x :: "'a::{real_normed_field}" |
20692 | 418 |
shows "norm x < 1 \<Longrightarrow> summable (\<lambda>n. x ^ n)" |
419 |
by (rule geometric_sums [THEN sums_summable]) |
|
14416 | 420 |
|
36409 | 421 |
lemma half: "0 < 1 / (2::'a::{number_ring,linordered_field_inverse_zero})" |
41970 | 422 |
by arith |
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
423 |
|
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
424 |
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
|
425 |
proof - |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
426 |
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
|
427 |
by auto |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
428 |
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
|
429 |
by simp |
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
41970
diff
changeset
|
430 |
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
|
431 |
by simp |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
432 |
qed |
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset
|
433 |
|
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
434 |
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
|
435 |
|
15539 | 436 |
lemma summable_convergent_sumr_iff: |
437 |
"summable f = convergent (%n. setsum f {0..<n})" |
|
14416 | 438 |
by (simp add: summable_def sums_def convergent_def) |
439 |
||
41970 | 440 |
lemma summable_LIMSEQ_zero: |
441 |
fixes f :: "nat \<Rightarrow> 'a::real_normed_field" |
|
442 |
shows "summable f \<Longrightarrow> f ----> 0" |
|
20689 | 443 |
apply (drule summable_convergent_sumr_iff [THEN iffD1]) |
20692 | 444 |
apply (drule convergent_Cauchy) |
31336
e17f13cd1280
generalize constants in SEQ.thy to class metric_space
huffman
parents:
31017
diff
changeset
|
445 |
apply (simp only: Cauchy_iff LIMSEQ_iff, safe) |
20689 | 446 |
apply (drule_tac x="r" in spec, safe) |
447 |
apply (rule_tac x="M" in exI, safe) |
|
448 |
apply (drule_tac x="Suc n" in spec, simp) |
|
449 |
apply (drule_tac x="n" in spec, simp) |
|
450 |
done |
|
451 |
||
32707
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
452 |
lemma suminf_le: |
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
453 |
fixes x :: real |
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset
|
454 |
shows "summable f \<Longrightarrow> (!!n. setsum f {0..<n} \<le> x) \<Longrightarrow> suminf f \<le> x" |
41970 | 455 |
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
|
456 |
|
14416 | 457 |
lemma summable_Cauchy: |
41970 | 458 |
"summable (f::nat \<Rightarrow> 'a::banach) = |
20848 | 459 |
(\<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
|
460 |
apply (simp only: summable_convergent_sumr_iff Cauchy_convergent_iff [symmetric] Cauchy_iff, safe) |
20410 | 461 |
apply (drule spec, drule (1) mp) |
462 |
apply (erule exE, rule_tac x="M" in exI, clarify) |
|
463 |
apply (rule_tac x="m" and y="n" in linorder_le_cases) |
|
464 |
apply (frule (1) order_trans) |
|
465 |
apply (drule_tac x="n" in spec, drule (1) mp) |
|
466 |
apply (drule_tac x="m" in spec, drule (1) mp) |
|
467 |
apply (simp add: setsum_diff [symmetric]) |
|
468 |
apply simp |
|
469 |
apply (drule spec, drule (1) mp) |
|
470 |
apply (erule exE, rule_tac x="N" in exI, clarify) |
|
471 |
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
|
472 |
apply (subst norm_minus_commute) |
20410 | 473 |
apply (simp add: setsum_diff [symmetric]) |
474 |
apply (simp add: setsum_diff [symmetric]) |
|
14416 | 475 |
done |
476 |
||
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
477 |
text{*Comparison test*} |
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
478 |
|
20692 | 479 |
lemma norm_setsum: |
480 |
fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" |
|
481 |
shows "norm (setsum f A) \<le> (\<Sum>i\<in>A. norm (f i))" |
|
482 |
apply (case_tac "finite A") |
|
483 |
apply (erule finite_induct) |
|
484 |
apply simp |
|
485 |
apply simp |
|
486 |
apply (erule order_trans [OF norm_triangle_ineq add_left_mono]) |
|
487 |
apply simp |
|
488 |
done |
|
489 |
||
14416 | 490 |
lemma summable_comparison_test: |
20848 | 491 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
492 |
shows "\<lbrakk>\<exists>N. \<forall>n\<ge>N. norm (f n) \<le> g n; summable g\<rbrakk> \<Longrightarrow> summable f" |
|
20692 | 493 |
apply (simp add: summable_Cauchy, safe) |
494 |
apply (drule_tac x="e" in spec, safe) |
|
495 |
apply (rule_tac x = "N + Na" in exI, safe) |
|
14416 | 496 |
apply (rotate_tac 2) |
497 |
apply (drule_tac x = m in spec) |
|
498 |
apply (auto, rotate_tac 2, drule_tac x = n in spec) |
|
20848 | 499 |
apply (rule_tac y = "\<Sum>k=m..<n. norm (f k)" in order_le_less_trans) |
500 |
apply (rule norm_setsum) |
|
15539 | 501 |
apply (rule_tac y = "setsum g {m..<n}" in order_le_less_trans) |
22998 | 502 |
apply (auto intro: setsum_mono simp add: abs_less_iff) |
14416 | 503 |
done |
504 |
||
20848 | 505 |
lemma summable_norm_comparison_test: |
506 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
|
507 |
shows "\<lbrakk>\<exists>N. \<forall>n\<ge>N. norm (f n) \<le> g n; summable g\<rbrakk> |
|
508 |
\<Longrightarrow> summable (\<lambda>n. norm (f n))" |
|
509 |
apply (rule summable_comparison_test) |
|
510 |
apply (auto) |
|
511 |
done |
|
512 |
||
14416 | 513 |
lemma summable_rabs_comparison_test: |
20692 | 514 |
fixes f :: "nat \<Rightarrow> real" |
515 |
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 | 516 |
apply (rule summable_comparison_test) |
15543 | 517 |
apply (auto) |
14416 | 518 |
done |
519 |
||
23084 | 520 |
text{*Summability of geometric series for real algebras*} |
521 |
||
522 |
lemma complete_algebra_summable_geometric: |
|
31017 | 523 |
fixes x :: "'a::{real_normed_algebra_1,banach}" |
23084 | 524 |
shows "norm x < 1 \<Longrightarrow> summable (\<lambda>n. x ^ n)" |
525 |
proof (rule summable_comparison_test) |
|
526 |
show "\<exists>N. \<forall>n\<ge>N. norm (x ^ n) \<le> norm x ^ n" |
|
527 |
by (simp add: norm_power_ineq) |
|
528 |
show "norm x < 1 \<Longrightarrow> summable (\<lambda>n. norm x ^ n)" |
|
529 |
by (simp add: summable_geometric) |
|
530 |
qed |
|
531 |
||
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
532 |
text{*Limit comparison property for series (c.f. jrh)*} |
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
533 |
|
14416 | 534 |
lemma summable_le: |
20692 | 535 |
fixes f g :: "nat \<Rightarrow> real" |
536 |
shows "\<lbrakk>\<forall>n. f n \<le> g n; summable f; summable g\<rbrakk> \<Longrightarrow> suminf f \<le> suminf g" |
|
14416 | 537 |
apply (drule summable_sums)+ |
20692 | 538 |
apply (simp only: sums_def, erule (1) LIMSEQ_le) |
14416 | 539 |
apply (rule exI) |
15539 | 540 |
apply (auto intro!: setsum_mono) |
14416 | 541 |
done |
542 |
||
543 |
lemma summable_le2: |
|
20692 | 544 |
fixes f g :: "nat \<Rightarrow> real" |
545 |
shows "\<lbrakk>\<forall>n. \<bar>f n\<bar> \<le> g n; summable g\<rbrakk> \<Longrightarrow> summable f \<and> suminf f \<le> suminf g" |
|
20848 | 546 |
apply (subgoal_tac "summable f") |
547 |
apply (auto intro!: summable_le) |
|
22998 | 548 |
apply (simp add: abs_le_iff) |
20848 | 549 |
apply (rule_tac g="g" in summable_comparison_test, simp_all) |
14416 | 550 |
done |
551 |
||
19106
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
552 |
(* 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
|
553 |
lemma suminf_0_le: |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
554 |
fixes f::"nat\<Rightarrow>real" |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
555 |
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
|
556 |
shows "0 \<le> suminf f" |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
557 |
proof - |
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
558 |
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
|
559 |
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
|
560 |
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
|
561 |
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
|
562 |
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
|
563 |
then show "0 \<le> suminf f" by (simp add: suminf_zero) |
41970 | 564 |
qed |
19106
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
565 |
|
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset
|
566 |
|
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
567 |
text{*Absolute convergence imples normal convergence*} |
20848 | 568 |
lemma summable_norm_cancel: |
569 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
|
570 |
shows "summable (\<lambda>n. norm (f n)) \<Longrightarrow> summable f" |
|
20692 | 571 |
apply (simp only: summable_Cauchy, safe) |
572 |
apply (drule_tac x="e" in spec, safe) |
|
573 |
apply (rule_tac x="N" in exI, safe) |
|
574 |
apply (drule_tac x="m" in spec, safe) |
|
20848 | 575 |
apply (rule order_le_less_trans [OF norm_setsum]) |
576 |
apply (rule order_le_less_trans [OF abs_ge_self]) |
|
20692 | 577 |
apply simp |
14416 | 578 |
done |
579 |
||
20848 | 580 |
lemma summable_rabs_cancel: |
581 |
fixes f :: "nat \<Rightarrow> real" |
|
582 |
shows "summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> summable f" |
|
583 |
by (rule summable_norm_cancel, simp) |
|
584 |
||
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset
|
585 |
text{*Absolute convergence of series*} |
20848 | 586 |
lemma summable_norm: |
587 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
|
588 |
shows "summable (\<lambda>n. norm (f n)) \<Longrightarrow> norm (suminf f) \<le> (\<Sum>n. norm (f n))" |
|
589 |
by (auto intro: LIMSEQ_le LIMSEQ_norm summable_norm_cancel |
|
590 |
summable_sumr_LIMSEQ_suminf norm_setsum) |
|
591 |
||
14416 | 592 |
lemma summable_rabs: |
20692 | 593 |
fixes f :: "nat \<Rightarrow> real" |
594 |
shows "summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> \<bar>suminf f\<bar> \<le> (\<Sum>n. \<bar>f n\<bar>)" |
|
20848 | 595 |
by (fold real_norm_def, rule summable_norm) |
14416 | 596 |
|
597 |
subsection{* The Ratio Test*} |
|
598 |
||
20848 | 599 |
lemma norm_ratiotest_lemma: |
22852 | 600 |
fixes x y :: "'a::real_normed_vector" |
20848 | 601 |
shows "\<lbrakk>c \<le> 0; norm x \<le> c * norm y\<rbrakk> \<Longrightarrow> x = 0" |
602 |
apply (subgoal_tac "norm x \<le> 0", simp) |
|
603 |
apply (erule order_trans) |
|
604 |
apply (simp add: mult_le_0_iff) |
|
605 |
done |
|
606 |
||
14416 | 607 |
lemma rabs_ratiotest_lemma: "[| c \<le> 0; abs x \<le> c * abs y |] ==> x = (0::real)" |
20848 | 608 |
by (erule norm_ratiotest_lemma, simp) |
14416 | 609 |
|
610 |
lemma le_Suc_ex: "(k::nat) \<le> l ==> (\<exists>n. l = k + n)" |
|
611 |
apply (drule le_imp_less_or_eq) |
|
612 |
apply (auto dest: less_imp_Suc_add) |
|
613 |
done |
|
614 |
||
615 |
lemma le_Suc_ex_iff: "((k::nat) \<le> l) = (\<exists>n. l = k + n)" |
|
616 |
by (auto simp add: le_Suc_ex) |
|
617 |
||
618 |
(*All this trouble just to get 0<c *) |
|
619 |
lemma ratio_test_lemma2: |
|
20848 | 620 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
621 |
shows "\<lbrakk>\<forall>n\<ge>N. norm (f (Suc n)) \<le> c * norm (f n)\<rbrakk> \<Longrightarrow> 0 < c \<or> summable f" |
|
14416 | 622 |
apply (simp (no_asm) add: linorder_not_le [symmetric]) |
623 |
apply (simp add: summable_Cauchy) |
|
15543 | 624 |
apply (safe, subgoal_tac "\<forall>n. N < n --> f (n) = 0") |
625 |
prefer 2 |
|
626 |
apply clarify |
|
30082
43c5b7bfc791
make more proofs work whether or not One_nat_def is a simp rule
huffman
parents:
29803
diff
changeset
|
627 |
apply(erule_tac x = "n - Suc 0" in allE) |
15543 | 628 |
apply (simp add:diff_Suc split:nat.splits) |
20848 | 629 |
apply (blast intro: norm_ratiotest_lemma) |
14416 | 630 |
apply (rule_tac x = "Suc N" in exI, clarify) |
15543 | 631 |
apply(simp cong:setsum_ivl_cong) |
14416 | 632 |
done |
633 |
||
634 |
lemma ratio_test: |
|
20848 | 635 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
636 |
shows "\<lbrakk>c < 1; \<forall>n\<ge>N. norm (f (Suc n)) \<le> c * norm (f n)\<rbrakk> \<Longrightarrow> summable f" |
|
14416 | 637 |
apply (frule ratio_test_lemma2, auto) |
41970 | 638 |
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
|
639 |
in summable_comparison_test) |
14416 | 640 |
apply (rule_tac x = N in exI, safe) |
641 |
apply (drule le_Suc_ex_iff [THEN iffD1]) |
|
22959 | 642 |
apply (auto simp add: power_add field_power_not_zero) |
15539 | 643 |
apply (induct_tac "na", auto) |
20848 | 644 |
apply (rule_tac y = "c * norm (f (N + n))" in order_trans) |
14416 | 645 |
apply (auto intro: mult_right_mono simp add: summable_def) |
20848 | 646 |
apply (rule_tac x = "norm (f N) * (1/ (1 - c)) / (c ^ N)" in exI) |
41970 | 647 |
apply (rule sums_divide) |
27108 | 648 |
apply (rule sums_mult) |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
649 |
apply (auto intro!: geometric_sums) |
14416 | 650 |
done |
651 |
||
23111 | 652 |
subsection {* Cauchy Product Formula *} |
653 |
||
654 |
(* Proof based on Analysis WebNotes: Chapter 07, Class 41 |
|
655 |
http://www.math.unl.edu/~webnotes/classes/class41/prp77.htm *) |
|
656 |
||
657 |
lemma setsum_triangle_reindex: |
|
658 |
fixes n :: nat |
|
659 |
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))" |
|
660 |
proof - |
|
661 |
have "(\<Sum>(i, j)\<in>{(i, j). i + j < n}. f i j) = |
|
662 |
(\<Sum>(k, i)\<in>(SIGMA k:{0..<n}. {0..k}). f i (k - i))" |
|
663 |
proof (rule setsum_reindex_cong) |
|
664 |
show "inj_on (\<lambda>(k,i). (i, k - i)) (SIGMA k:{0..<n}. {0..k})" |
|
665 |
by (rule inj_on_inverseI [where g="\<lambda>(i,j). (i+j, i)"], auto) |
|
666 |
show "{(i,j). i + j < n} = (\<lambda>(k,i). (i, k - i)) ` (SIGMA k:{0..<n}. {0..k})" |
|
667 |
by (safe, rule_tac x="(a+b,a)" in image_eqI, auto) |
|
668 |
show "\<And>a. (\<lambda>(k, i). f i (k - i)) a = split f ((\<lambda>(k, i). (i, k - i)) a)" |
|
669 |
by clarify |
|
670 |
qed |
|
671 |
thus ?thesis by (simp add: setsum_Sigma) |
|
672 |
qed |
|
673 |
||
674 |
lemma Cauchy_product_sums: |
|
675 |
fixes a b :: "nat \<Rightarrow> 'a::{real_normed_algebra,banach}" |
|
676 |
assumes a: "summable (\<lambda>k. norm (a k))" |
|
677 |
assumes b: "summable (\<lambda>k. norm (b k))" |
|
678 |
shows "(\<lambda>k. \<Sum>i=0..k. a i * b (k - i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))" |
|
679 |
proof - |
|
680 |
let ?S1 = "\<lambda>n::nat. {0..<n} \<times> {0..<n}" |
|
681 |
let ?S2 = "\<lambda>n::nat. {(i,j). i + j < n}" |
|
682 |
have S1_mono: "\<And>m n. m \<le> n \<Longrightarrow> ?S1 m \<subseteq> ?S1 n" by auto |
|
683 |
have S2_le_S1: "\<And>n. ?S2 n \<subseteq> ?S1 n" by auto |
|
684 |
have S1_le_S2: "\<And>n. ?S1 (n div 2) \<subseteq> ?S2 n" by auto |
|
685 |
have finite_S1: "\<And>n. finite (?S1 n)" by simp |
|
686 |
with S2_le_S1 have finite_S2: "\<And>n. finite (?S2 n)" by (rule finite_subset) |
|
687 |
||
688 |
let ?g = "\<lambda>(i,j). a i * b j" |
|
689 |
let ?f = "\<lambda>(i,j). norm (a i) * norm (b j)" |
|
690 |
have f_nonneg: "\<And>x. 0 \<le> ?f x" |
|
691 |
by (auto simp add: mult_nonneg_nonneg) |
|
692 |
hence norm_setsum_f: "\<And>A. norm (setsum ?f A) = setsum ?f A" |
|
693 |
unfolding real_norm_def |
|
694 |
by (simp only: abs_of_nonneg setsum_nonneg [rule_format]) |
|
695 |
||
696 |
have "(\<lambda>n. (\<Sum>k=0..<n. a k) * (\<Sum>k=0..<n. b k)) |
|
697 |
----> (\<Sum>k. a k) * (\<Sum>k. b k)" |
|
698 |
by (intro LIMSEQ_mult summable_sumr_LIMSEQ_suminf |
|
699 |
summable_norm_cancel [OF a] summable_norm_cancel [OF b]) |
|
700 |
hence 1: "(\<lambda>n. setsum ?g (?S1 n)) ----> (\<Sum>k. a k) * (\<Sum>k. b k)" |
|
701 |
by (simp only: setsum_product setsum_Sigma [rule_format] |
|
702 |
finite_atLeastLessThan) |
|
703 |
||
704 |
have "(\<lambda>n. (\<Sum>k=0..<n. norm (a k)) * (\<Sum>k=0..<n. norm (b k))) |
|
705 |
----> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))" |
|
706 |
using a b by (intro LIMSEQ_mult summable_sumr_LIMSEQ_suminf) |
|
707 |
hence "(\<lambda>n. setsum ?f (?S1 n)) ----> (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))" |
|
708 |
by (simp only: setsum_product setsum_Sigma [rule_format] |
|
709 |
finite_atLeastLessThan) |
|
710 |
hence "convergent (\<lambda>n. setsum ?f (?S1 n))" |
|
711 |
by (rule convergentI) |
|
712 |
hence Cauchy: "Cauchy (\<lambda>n. setsum ?f (?S1 n))" |
|
713 |
by (rule convergent_Cauchy) |
|
36657 | 714 |
have "Zfun (\<lambda>n. setsum ?f (?S1 n - ?S2 n)) sequentially" |
715 |
proof (rule ZfunI, simp only: eventually_sequentially norm_setsum_f) |
|
23111 | 716 |
fix r :: real |
717 |
assume r: "0 < r" |
|
718 |
from CauchyD [OF Cauchy r] obtain N |
|
719 |
where "\<forall>m\<ge>N. \<forall>n\<ge>N. norm (setsum ?f (?S1 m) - setsum ?f (?S1 n)) < r" .. |
|
720 |
hence "\<And>m n. \<lbrakk>N \<le> n; n \<le> m\<rbrakk> \<Longrightarrow> norm (setsum ?f (?S1 m - ?S1 n)) < r" |
|
721 |
by (simp only: setsum_diff finite_S1 S1_mono) |
|
722 |
hence N: "\<And>m n. \<lbrakk>N \<le> n; n \<le> m\<rbrakk> \<Longrightarrow> setsum ?f (?S1 m - ?S1 n) < r" |
|
723 |
by (simp only: norm_setsum_f) |
|
724 |
show "\<exists>N. \<forall>n\<ge>N. setsum ?f (?S1 n - ?S2 n) < r" |
|
725 |
proof (intro exI allI impI) |
|
726 |
fix n assume "2 * N \<le> n" |
|
727 |
hence n: "N \<le> n div 2" by simp |
|
728 |
have "setsum ?f (?S1 n - ?S2 n) \<le> setsum ?f (?S1 n - ?S1 (n div 2))" |
|
729 |
by (intro setsum_mono2 finite_Diff finite_S1 f_nonneg |
|
730 |
Diff_mono subset_refl S1_le_S2) |
|
731 |
also have "\<dots> < r" |
|
732 |
using n div_le_dividend by (rule N) |
|
733 |
finally show "setsum ?f (?S1 n - ?S2 n) < r" . |
|
734 |
qed |
|
735 |
qed |
|
36657 | 736 |
hence "Zfun (\<lambda>n. setsum ?g (?S1 n - ?S2 n)) sequentially" |
737 |
apply (rule Zfun_le [rule_format]) |
|
23111 | 738 |
apply (simp only: norm_setsum_f) |
739 |
apply (rule order_trans [OF norm_setsum setsum_mono]) |
|
740 |
apply (auto simp add: norm_mult_ineq) |
|
741 |
done |
|
742 |
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
|
743 |
unfolding tendsto_Zfun_iff diff_0_right |
36657 | 744 |
by (simp only: setsum_diff finite_S1 S2_le_S1) |
23111 | 745 |
|
746 |
with 1 have "(\<lambda>n. setsum ?g (?S2 n)) ----> (\<Sum>k. a k) * (\<Sum>k. b k)" |
|
747 |
by (rule LIMSEQ_diff_approach_zero2) |
|
748 |
thus ?thesis by (simp only: sums_def setsum_triangle_reindex) |
|
749 |
qed |
|
750 |
||
751 |
lemma Cauchy_product: |
|
752 |
fixes a b :: "nat \<Rightarrow> 'a::{real_normed_algebra,banach}" |
|
753 |
assumes a: "summable (\<lambda>k. norm (a k))" |
|
754 |
assumes b: "summable (\<lambda>k. norm (b k))" |
|
755 |
shows "(\<Sum>k. a k) * (\<Sum>k. b k) = (\<Sum>k. \<Sum>i=0..k. a i * b (k - i))" |
|
23441 | 756 |
using a b |
23111 | 757 |
by (rule Cauchy_product_sums [THEN sums_unique]) |
758 |
||
14416 | 759 |
end |