author  hoelzl 
Tue, 18 Mar 2014 16:29:32 +0100  
changeset 56194  9ffbb4004c81 
parent 56193  c726ecfb22b6 
child 56213  e5720d3c18f0 
permissions  rwrr 
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 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

10 
header {* Finite Summation and Infinite Series *} 
10751  11 

15131  12 
theory Series 
51528
66c3a7589de7
Series.thy is based on Limits.thy and not Deriv.thy
hoelzl
parents:
51526
diff
changeset

13 
imports Limits 
15131  14 
begin 
15561  15 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

16 
definition 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

17 
sums :: "(nat \<Rightarrow> 'a::{topological_space, comm_monoid_add}) \<Rightarrow> 'a \<Rightarrow> bool" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

18 
(infixr "sums" 80) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

19 
where 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

20 
"f sums s \<longleftrightarrow> (\<lambda>n. \<Sum>i<n. f i) > s" 
14416  21 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

22 
definition summable :: "(nat \<Rightarrow> 'a::{topological_space, comm_monoid_add}) \<Rightarrow> bool" where 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

23 
"summable f \<longleftrightarrow> (\<exists>s. f sums s)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

24 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

25 
definition 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

26 
suminf :: "(nat \<Rightarrow> 'a::{topological_space, comm_monoid_add}) \<Rightarrow> 'a" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

27 
(binder "\<Sum>" 10) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

28 
where 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

29 
"suminf f = (THE s. f sums s)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

30 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

31 
lemma sums_subst[trans]: "f = g \<Longrightarrow> g sums z \<Longrightarrow> f sums z" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

32 
by simp 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

33 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

34 
lemma sums_summable: "f sums l \<Longrightarrow> summable f" 
41970  35 
by (simp add: sums_def summable_def, blast) 
14416  36 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

37 
lemma summable_iff_convergent: "summable f \<longleftrightarrow> convergent (\<lambda>n. \<Sum>i<n. f i)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

38 
by (simp add: summable_def sums_def convergent_def) 
14416  39 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

40 
lemma suminf_eq_lim: "suminf f = lim (\<lambda>n. \<Sum>i<n. f i)" 
41970  41 
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

42 

47761  43 
lemma sums_finite: 
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

44 
assumes [simp]: "finite N" and f: "\<And>n. n \<notin> N \<Longrightarrow> f n = 0" 
47761  45 
shows "f sums (\<Sum>n\<in>N. f n)" 
46 
proof  

47 
{ fix n 

48 
have "setsum f {..<n + Suc (Max N)} = setsum f N" 

49 
proof cases 

50 
assume "N = {}" 

51 
with f have "f = (\<lambda>x. 0)" by auto 

52 
then show ?thesis by simp 

53 
next 

54 
assume [simp]: "N \<noteq> {}" 

55 
show ?thesis 

56 
proof (safe intro!: setsum_mono_zero_right f) 

57 
fix i assume "i \<in> N" 

58 
then have "i \<le> Max N" by simp 

59 
then show "i < n + Suc (Max N)" by simp 

60 
qed 

61 
qed } 

62 
note eq = this 

63 
show ?thesis unfolding sums_def 

64 
by (rule LIMSEQ_offset[of _ "Suc (Max N)"]) 

65 
(simp add: eq atLeast0LessThan tendsto_const del: add_Suc_right) 

66 
qed 

67 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

68 
lemma sums_If_finite_set: "finite A \<Longrightarrow> (\<lambda>r. if r \<in> A then f r else 0) sums (\<Sum>r\<in>A. f r)" 
47761  69 
using sums_finite[of A "(\<lambda>r. if r \<in> A then f r else 0)"] by simp 
70 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

71 
lemma sums_If_finite: "finite {r. P r} \<Longrightarrow> (\<lambda>r. if P r then f r else 0) sums (\<Sum>r  P r. f r)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

72 
using sums_If_finite_set[of "{r. P r}"] by simp 
16819  73 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

74 
lemma sums_single: "(\<lambda>r. if r = i then f r else 0) sums f i" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

75 
using sums_If_finite[of "\<lambda>r. r = i"] by simp 
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29197
diff
changeset

76 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

77 
lemma series_zero: (* REMOVE *) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

78 
"(\<And>m. n \<le> m \<Longrightarrow> f m = 0) \<Longrightarrow> f sums (\<Sum>i<n. f i)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

79 
by (rule sums_finite) auto 
14416  80 

41970  81 
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

82 
unfolding sums_def by (simp add: tendsto_const) 
15539  83 

41970  84 
lemma summable_zero[simp, intro]: "summable (\<lambda>n. 0)" 
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

85 
by (rule sums_zero [THEN sums_summable]) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

86 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

87 
lemma sums_group: "f sums s \<Longrightarrow> 0 < k \<Longrightarrow> (\<lambda>n. setsum f {n * k ..< n * k + k}) sums s" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

88 
apply (simp only: sums_def setsum_nat_group tendsto_def eventually_sequentially) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

89 
apply safe 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

90 
apply (erule_tac x=S in allE) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

91 
apply safe 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

92 
apply (rule_tac x="N" in exI, safe) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

93 
apply (drule_tac x="n*k" in spec) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

94 
apply (erule mp) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

95 
apply (erule order_trans) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

96 
apply simp 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

97 
done 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

98 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

99 
context 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

100 
fixes f :: "nat \<Rightarrow> 'a::{t2_space, comm_monoid_add}" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

101 
begin 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

102 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

103 
lemma summable_sums[intro]: "summable f \<Longrightarrow> f sums (suminf f)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

104 
by (simp add: summable_def sums_def suminf_def) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

105 
(metis convergent_LIMSEQ_iff convergent_def lim_def) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

106 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

107 
lemma summable_LIMSEQ: "summable f \<Longrightarrow> (\<lambda>n. \<Sum>i<n. f i) > suminf f" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

108 
by (rule summable_sums [unfolded sums_def]) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

109 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

110 
lemma sums_unique: "f sums s \<Longrightarrow> s = suminf f" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

111 
by (metis limI suminf_eq_lim sums_def) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

112 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

113 
lemma sums_iff: "f sums x \<longleftrightarrow> summable f \<and> (suminf f = x)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

114 
by (metis summable_sums sums_summable sums_unique) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

115 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

116 
lemma suminf_finite: 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

117 
assumes N: "finite N" and f: "\<And>n. n \<notin> N \<Longrightarrow> f n = 0" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

118 
shows "suminf f = (\<Sum>n\<in>N. f n)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

119 
using sums_finite[OF assms, THEN sums_unique] by simp 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

120 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

121 
end 
16819  122 

41970  123 
lemma suminf_zero[simp]: "suminf (\<lambda>n. 0::'a::{t2_space, comm_monoid_add}) = 0" 
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

124 
by (rule sums_zero [THEN sums_unique, symmetric]) 
16819  125 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

126 
context 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

127 
fixes f :: "nat \<Rightarrow> 'a::{ordered_comm_monoid_add, linorder_topology}" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

128 
begin 
14416  129 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

130 
lemma series_pos_le: "summable f \<Longrightarrow> \<forall>m\<ge>n. 0 \<le> f m \<Longrightarrow> setsum f {..<n} \<le> suminf f" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

131 
apply (rule LIMSEQ_le_const[OF summable_LIMSEQ]) 
50999  132 
apply assumption 
133 
apply (intro exI[of _ n]) 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

134 
apply (auto intro!: setsum_mono2 simp: not_le[symmetric]) 
50999  135 
done 
14416  136 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

137 
lemma suminf_eq_zero_iff: "summable f \<Longrightarrow> \<forall>n. 0 \<le> f n \<Longrightarrow> suminf f = 0 \<longleftrightarrow> (\<forall>n. f n = 0)" 
50999  138 
proof 
139 
assume "summable f" "suminf f = 0" and pos: "\<forall>n. 0 \<le> f n" 

140 
then have "f sums 0" 

141 
by (simp add: sums_iff) 

142 
then have f: "(\<lambda>n. \<Sum>i<n. f i) > 0" 

143 
by (simp add: sums_def atLeast0LessThan) 

144 
have "\<And>i. (\<Sum>n\<in>{i}. f n) \<le> 0" 

145 
proof (rule LIMSEQ_le_const[OF f]) 

146 
fix i show "\<exists>N. \<forall>n\<ge>N. (\<Sum>n\<in>{i}. f n) \<le> setsum f {..<n}" 

147 
using pos by (intro exI[of _ "Suc i"] allI impI setsum_mono2) auto 

148 
qed 

149 
with pos show "\<forall>n. f n = 0" 

150 
by (auto intro!: antisym) 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

151 
qed (metis suminf_zero fun_eq_iff) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

152 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

153 
lemma suminf_gt_zero_iff: "summable f \<Longrightarrow> \<forall>n. 0 \<le> f n \<Longrightarrow> 0 < suminf f \<longleftrightarrow> (\<exists>i. 0 < f i)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

154 
using series_pos_le[of 0] suminf_eq_zero_iff by (simp add: less_le) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

155 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

156 
lemma suminf_gt_zero: "summable f \<Longrightarrow> \<forall>n. 0 < f n \<Longrightarrow> 0 < suminf f" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

157 
using suminf_gt_zero_iff by (simp add: less_imp_le) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

158 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

159 
lemma suminf_ge_zero: "summable f \<Longrightarrow> \<forall>n. 0 \<le> f n \<Longrightarrow> 0 \<le> suminf f" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

160 
by (drule_tac n="0" in series_pos_le) simp_all 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

161 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

162 
lemma suminf_le: "summable f \<Longrightarrow> (\<And>n. setsum f {..<n} \<le> x) \<Longrightarrow> suminf f \<le> x" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

163 
by (metis LIMSEQ_le_const2 summable_LIMSEQ) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

164 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

165 
lemma summable_le: "\<lbrakk>\<forall>n. f n \<le> g n; summable f; summable g\<rbrakk> \<Longrightarrow> suminf f \<le> suminf g" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

166 
by (rule LIMSEQ_le) (auto intro: setsum_mono summable_LIMSEQ) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

167 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

168 
end 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

169 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

170 
lemma series_pos_less: 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

171 
fixes f :: "nat \<Rightarrow> 'a::{ordered_ab_semigroup_add_imp_le, ordered_comm_monoid_add, linorder_topology}" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

172 
shows "\<lbrakk>summable f; \<forall>m\<ge>n. 0 < f m\<rbrakk> \<Longrightarrow> setsum f {..<n} < suminf f" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

173 
apply simp 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

174 
apply (rule_tac y="setsum f {..<Suc n}" in order_less_le_trans) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

175 
using add_less_cancel_left [of "setsum f {..<n}" 0 "f n"] 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

176 
apply simp 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

177 
apply (erule series_pos_le) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

178 
apply (simp add: order_less_imp_le) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

179 
done 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

180 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

181 
lemma sums_Suc_iff: 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

182 
fixes f :: "nat \<Rightarrow> 'a::real_normed_vector" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

183 
shows "(\<lambda>n. f (Suc n)) sums s \<longleftrightarrow> f sums (s + f 0)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

184 
proof  
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

185 
have "f sums (s + f 0) \<longleftrightarrow> (\<lambda>i. \<Sum>j<Suc i. f j) > s + f 0" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

186 
by (subst LIMSEQ_Suc_iff) (simp add: sums_def) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

187 
also have "\<dots> \<longleftrightarrow> (\<lambda>i. (\<Sum>j<i. f (Suc j)) + f 0) > s + f 0" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

188 
by (simp add: ac_simps setsum_reindex image_iff lessThan_Suc_eq_insert_0) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

189 
also have "\<dots> \<longleftrightarrow> (\<lambda>n. f (Suc n)) sums s" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

190 
proof 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

191 
assume "(\<lambda>i. (\<Sum>j<i. f (Suc j)) + f 0) > s + f 0" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

192 
with tendsto_add[OF this tendsto_const, of " f 0"] 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

193 
show "(\<lambda>i. f (Suc i)) sums s" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

194 
by (simp add: sums_def) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

195 
qed (auto intro: tendsto_add tendsto_const simp: sums_def) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

196 
finally show ?thesis .. 
50999  197 
qed 
198 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

199 
context 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

200 
fixes f :: "nat \<Rightarrow> 'a::real_normed_vector" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

201 
begin 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

202 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

203 
lemma sums_add: "f sums a \<Longrightarrow> g sums b \<Longrightarrow> (\<lambda>n. f n + g n) sums (a + b)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

204 
unfolding sums_def by (simp add: setsum_addf tendsto_add) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

205 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

206 
lemma summable_add: "summable f \<Longrightarrow> summable g \<Longrightarrow> summable (\<lambda>n. f n + g n)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

207 
unfolding summable_def by (auto intro: sums_add) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

208 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

209 
lemma suminf_add: "summable f \<Longrightarrow> summable g \<Longrightarrow> suminf f + suminf g = (\<Sum>n. f n + g n)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

210 
by (intro sums_unique sums_add summable_sums) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

211 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

212 
lemma sums_diff: "f sums a \<Longrightarrow> g sums b \<Longrightarrow> (\<lambda>n. f n  g n) sums (a  b)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

213 
unfolding sums_def by (simp add: setsum_subtractf tendsto_diff) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

214 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

215 
lemma summable_diff: "summable f \<Longrightarrow> summable g \<Longrightarrow> summable (\<lambda>n. f n  g n)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

216 
unfolding summable_def by (auto intro: sums_diff) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

217 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

218 
lemma suminf_diff: "summable f \<Longrightarrow> summable g \<Longrightarrow> suminf f  suminf g = (\<Sum>n. f n  g n)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

219 
by (intro sums_unique sums_diff summable_sums) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

220 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

221 
lemma sums_minus: "f sums a \<Longrightarrow> (\<lambda>n.  f n) sums ( a)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

222 
unfolding sums_def by (simp add: setsum_negf tendsto_minus) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

223 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

224 
lemma summable_minus: "summable f \<Longrightarrow> summable (\<lambda>n.  f n)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

225 
unfolding summable_def by (auto intro: sums_minus) 
20692  226 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

227 
lemma suminf_minus: "summable f \<Longrightarrow> (\<Sum>n.  f n) =  (\<Sum>n. f n)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

228 
by (intro sums_unique [symmetric] sums_minus summable_sums) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

229 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

230 
lemma sums_Suc: "(\<lambda> n. f (Suc n)) sums l \<Longrightarrow> f sums (l + f 0)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

231 
by (simp add: sums_Suc_iff) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

232 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

233 
lemma sums_iff_shift: "(\<lambda>i. f (i + n)) sums s \<longleftrightarrow> f sums (s + (\<Sum>i<n. f i))" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

234 
proof (induct n arbitrary: s) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

235 
case (Suc n) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

236 
moreover have "(\<lambda>i. f (Suc i + n)) sums s \<longleftrightarrow> (\<lambda>i. f (i + n)) sums (s + f n)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

237 
by (subst sums_Suc_iff) simp 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

238 
ultimately show ?case 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

239 
by (simp add: ac_simps) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

240 
qed simp 
20692  241 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

242 
lemma summable_iff_shift: "summable (\<lambda>n. f (n + k)) \<longleftrightarrow> summable f" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

243 
by (metis diff_add_cancel summable_def sums_iff_shift[abs_def]) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

244 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

245 
lemma sums_split_initial_segment: "f sums s \<Longrightarrow> (\<lambda>i. f (i + n)) sums (s  (\<Sum>i<n. f i))" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

246 
by (simp add: sums_iff_shift) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

247 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

248 
lemma summable_ignore_initial_segment: "summable f \<Longrightarrow> summable (\<lambda>n. f(n + k))" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

249 
by (simp add: summable_iff_shift) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

250 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

251 
lemma suminf_minus_initial_segment: "summable f \<Longrightarrow> (\<Sum>n. f (n + k)) = (\<Sum>n. f n)  (\<Sum>i<k. f i)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

252 
by (rule sums_unique[symmetric]) (auto simp: sums_iff_shift) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

253 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

254 
lemma suminf_split_initial_segment: "summable f \<Longrightarrow> suminf f = (\<Sum>n. f(n + k)) + (\<Sum>i<k. f i)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

255 
by (auto simp add: suminf_minus_initial_segment) 
20692  256 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

257 
lemma suminf_exist_split: 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

258 
fixes r :: real assumes "0 < r" and "summable f" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

259 
shows "\<exists>N. \<forall>n\<ge>N. norm (\<Sum>i. f (i + n)) < r" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

260 
proof  
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

261 
from LIMSEQ_D[OF summable_LIMSEQ[OF `summable f`] `0 < r`] 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

262 
obtain N :: nat where "\<forall> n \<ge> N. norm (setsum f {..<n}  suminf f) < r" by auto 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

263 
thus ?thesis 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

264 
by (auto simp: norm_minus_commute suminf_minus_initial_segment[OF `summable f`]) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

265 
qed 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

266 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

267 
lemma summable_LIMSEQ_zero: "summable f \<Longrightarrow> f > 0" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

268 
apply (drule summable_iff_convergent [THEN iffD1]) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

269 
apply (drule convergent_Cauchy) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

270 
apply (simp only: Cauchy_iff LIMSEQ_iff, safe) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

271 
apply (drule_tac x="r" in spec, safe) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

272 
apply (rule_tac x="M" in exI, safe) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

273 
apply (drule_tac x="Suc n" in spec, simp) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

274 
apply (drule_tac x="n" in spec, simp) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

275 
done 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

276 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

277 
end 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

278 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

279 
lemma (in bounded_linear) sums: "(\<lambda>n. X n) sums a \<Longrightarrow> (\<lambda>n. f (X n)) sums (f a)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

280 
unfolding sums_def by (drule tendsto, simp only: setsum) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

281 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

282 
lemma (in bounded_linear) summable: "summable (\<lambda>n. X n) \<Longrightarrow> summable (\<lambda>n. f (X n))" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

283 
unfolding summable_def by (auto intro: sums) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

284 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

285 
lemma (in bounded_linear) suminf: "summable (\<lambda>n. X n) \<Longrightarrow> f (\<Sum>n. X n) = (\<Sum>n. f (X n))" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

286 
by (intro sums_unique sums summable_sums) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

287 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

288 
lemmas sums_of_real = bounded_linear.sums [OF bounded_linear_of_real] 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

289 
lemmas summable_of_real = bounded_linear.summable [OF bounded_linear_of_real] 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

290 
lemmas suminf_of_real = bounded_linear.suminf [OF bounded_linear_of_real] 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

291 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

292 
context 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

293 
fixes f :: "nat \<Rightarrow> 'a::real_normed_algebra" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

294 
begin 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

295 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

296 
lemma sums_mult: "f sums a \<Longrightarrow> (\<lambda>n. c * f n) sums (c * a)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

297 
by (rule bounded_linear.sums [OF bounded_linear_mult_right]) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

298 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

299 
lemma summable_mult: "summable f \<Longrightarrow> summable (\<lambda>n. c * f n)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

300 
by (rule bounded_linear.summable [OF bounded_linear_mult_right]) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

301 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

302 
lemma suminf_mult: "summable f \<Longrightarrow> suminf (\<lambda>n. c * f n) = c * suminf f" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

303 
by (rule bounded_linear.suminf [OF bounded_linear_mult_right, symmetric]) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

304 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

305 
lemma sums_mult2: "f sums a \<Longrightarrow> (\<lambda>n. f n * c) sums (a * c)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

306 
by (rule bounded_linear.sums [OF bounded_linear_mult_left]) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

307 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

308 
lemma summable_mult2: "summable f \<Longrightarrow> summable (\<lambda>n. f n * c)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

309 
by (rule bounded_linear.summable [OF bounded_linear_mult_left]) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

310 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

311 
lemma suminf_mult2: "summable f \<Longrightarrow> suminf f * c = (\<Sum>n. f n * c)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

312 
by (rule bounded_linear.suminf [OF bounded_linear_mult_left]) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

313 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

314 
end 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

315 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

316 
context 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

317 
fixes c :: "'a::real_normed_field" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

318 
begin 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

319 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

320 
lemma sums_divide: "f sums a \<Longrightarrow> (\<lambda>n. f n / c) sums (a / c)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

321 
by (rule bounded_linear.sums [OF bounded_linear_divide]) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

322 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

323 
lemma summable_divide: "summable f \<Longrightarrow> summable (\<lambda>n. f n / c)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

324 
by (rule bounded_linear.summable [OF bounded_linear_divide]) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

325 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

326 
lemma suminf_divide: "summable f \<Longrightarrow> suminf (\<lambda>n. f n / c) = suminf f / c" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

327 
by (rule bounded_linear.suminf [OF bounded_linear_divide, symmetric]) 
14416  328 

15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset

329 
text{*Sum of a geometric progression.*} 
14416  330 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

331 
lemma geometric_sums: "norm c < 1 \<Longrightarrow> (\<lambda>n. c^n) sums (1 / (1  c))" 
20692  332 
proof  
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

333 
assume less_1: "norm c < 1" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

334 
hence neq_1: "c \<noteq> 1" by auto 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

335 
hence neq_0: "c  1 \<noteq> 0" by simp 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

336 
from less_1 have lim_0: "(\<lambda>n. c^n) > 0" 
20692  337 
by (rule LIMSEQ_power_zero) 
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

338 
hence "(\<lambda>n. c ^ n / (c  1)  1 / (c  1)) > 0 / (c  1)  1 / (c  1)" 
44568
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
huffman
parents:
44289
diff
changeset

339 
using neq_0 by (intro tendsto_intros) 
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

340 
hence "(\<lambda>n. (c ^ n  1) / (c  1)) > 1 / (1  c)" 
20692  341 
by (simp add: nonzero_minus_divide_right [OF neq_0] diff_divide_distrib) 
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

342 
thus "(\<lambda>n. c ^ n) sums (1 / (1  c))" 
20692  343 
by (simp add: sums_def geometric_sum neq_1) 
344 
qed 

345 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

346 
lemma summable_geometric: "norm c < 1 \<Longrightarrow> summable (\<lambda>n. c^n)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

347 
by (rule geometric_sums [THEN sums_summable]) 
14416  348 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

349 
lemma suminf_geometric: "norm c < 1 \<Longrightarrow> suminf (\<lambda>n. c^n) = 1 / (1  c)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

350 
by (rule sums_unique[symmetric]) (rule geometric_sums) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

351 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

352 
end 
33271
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset

353 

7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset

354 
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

355 
proof  
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset

356 
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

357 
by auto 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset

358 
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

359 
by simp 
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
41970
diff
changeset

360 
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

361 
by simp 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset

362 
qed 
7be66dee1a5a
New theory Probability, which contains a development of measure theory
paulson
parents:
32877
diff
changeset

363 

15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset

364 
text{*Cauchytype criterion for convergence of series (c.f. Harrison)*} 
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset

365 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

366 
lemma summable_Cauchy: 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

367 
fixes f :: "nat \<Rightarrow> 'a::banach" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

368 
shows "summable f \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>m\<ge>N. \<forall>n. norm (setsum f {m..<n}) < e)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

369 
apply (simp only: summable_iff_convergent Cauchy_convergent_iff [symmetric] Cauchy_iff, safe) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

370 
apply (drule spec, drule (1) mp) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

371 
apply (erule exE, rule_tac x="M" in exI, clarify) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

372 
apply (rule_tac x="m" and y="n" in linorder_le_cases) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

373 
apply (frule (1) order_trans) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

374 
apply (drule_tac x="n" in spec, drule (1) mp) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

375 
apply (drule_tac x="m" in spec, drule (1) mp) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

376 
apply (simp_all add: setsum_diff [symmetric]) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

377 
apply (drule spec, drule (1) mp) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

378 
apply (erule exE, rule_tac x="N" in exI, clarify) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

379 
apply (rule_tac x="m" and y="n" in linorder_le_cases) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

380 
apply (subst norm_minus_commute) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

381 
apply (simp_all add: setsum_diff [symmetric]) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

382 
done 
14416  383 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

384 
context 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

385 
fixes f :: "nat \<Rightarrow> 'a::banach" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

386 
begin 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

387 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

388 
text{*Absolute convergence imples normal convergence*} 
20689  389 

56194  390 
lemma summable_norm_cancel: "summable (\<lambda>n. norm (f n)) \<Longrightarrow> summable f" 
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

391 
apply (simp only: summable_Cauchy, safe) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

392 
apply (drule_tac x="e" in spec, safe) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

393 
apply (rule_tac x="N" in exI, safe) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

394 
apply (drule_tac x="m" in spec, safe) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

395 
apply (rule order_le_less_trans [OF norm_setsum]) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

396 
apply (rule order_le_less_trans [OF abs_ge_self]) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

397 
apply simp 
50999  398 
done 
32707
836ec9d0a0c8
New lemmas involving the real numbers, especially limits and series
paulson
parents:
31336
diff
changeset

399 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

400 
lemma summable_norm: "summable (\<lambda>n. norm (f n)) \<Longrightarrow> norm (suminf f) \<le> (\<Sum>n. norm (f n))" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

401 
by (auto intro: LIMSEQ_le tendsto_norm summable_norm_cancel summable_LIMSEQ norm_setsum) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

402 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

403 
text {* Comparison tests *} 
14416  404 

56194  405 
lemma summable_comparison_test: "\<exists>N. \<forall>n\<ge>N. norm (f n) \<le> g n \<Longrightarrow> summable g \<Longrightarrow> summable f" 
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

406 
apply (simp add: summable_Cauchy, safe) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

407 
apply (drule_tac x="e" in spec, safe) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

408 
apply (rule_tac x = "N + Na" in exI, safe) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

409 
apply (rotate_tac 2) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

410 
apply (drule_tac x = m in spec) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

411 
apply (auto, rotate_tac 2, drule_tac x = n in spec) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

412 
apply (rule_tac y = "\<Sum>k=m..<n. norm (f k)" in order_le_less_trans) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

413 
apply (rule norm_setsum) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

414 
apply (rule_tac y = "setsum g {m..<n}" in order_le_less_trans) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

415 
apply (auto intro: setsum_mono simp add: abs_less_iff) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

416 
done 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

417 

c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

418 
subsection {* The Ratio Test*} 
15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset

419 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

420 
lemma summable_ratio_test: 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

421 
assumes "c < 1" "\<And>n. n \<ge> N \<Longrightarrow> norm (f (Suc n)) \<le> c * norm (f n)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

422 
shows "summable f" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

423 
proof cases 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

424 
assume "0 < c" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

425 
show "summable f" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

426 
proof (rule summable_comparison_test) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

427 
show "\<exists>N'. \<forall>n\<ge>N'. norm (f n) \<le> (norm (f N) / (c ^ N)) * c ^ n" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

428 
proof (intro exI allI impI) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

429 
fix n assume "N \<le> n" then show "norm (f n) \<le> (norm (f N) / (c ^ N)) * c ^ n" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

430 
proof (induct rule: inc_induct) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

431 
case (step m) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

432 
moreover have "norm (f (Suc m)) / c ^ Suc m * c ^ n \<le> norm (f m) / c ^ m * c ^ n" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

433 
using `0 < c` `c < 1` assms(2)[OF `N \<le> m`] by (simp add: field_simps) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

434 
ultimately show ?case by simp 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

435 
qed (insert `0 < c`, simp) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

436 
qed 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

437 
show "summable (\<lambda>n. norm (f N) / c ^ N * c ^ n)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

438 
using `0 < c` `c < 1` by (intro summable_mult summable_geometric) simp 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

439 
qed 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

440 
next 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

441 
assume c: "\<not> 0 < c" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

442 
{ fix n assume "n \<ge> N" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

443 
then have "norm (f (Suc n)) \<le> c * norm (f n)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

444 
by fact 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

445 
also have "\<dots> \<le> 0" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

446 
using c by (simp add: not_less mult_nonpos_nonneg) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

447 
finally have "f (Suc n) = 0" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

448 
by auto } 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

449 
then show "summable f" 
56194  450 
by (intro sums_summable[OF sums_finite, of "{.. Suc N}"]) (auto simp: not_le Suc_less_eq2) 
56178  451 
qed 
452 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

453 
end 
14416  454 

56194  455 
lemma summable_norm_comparison_test: "\<exists>N. \<forall>n\<ge>N. norm (f n) \<le> g n \<Longrightarrow> summable g \<Longrightarrow> summable (\<lambda>n. norm (f n))" 
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

456 
by (rule summable_comparison_test) auto 
20848  457 

56194  458 
lemma summable_rabs_cancel: "summable (\<lambda>n. \<bar>f n :: real\<bar>) \<Longrightarrow> summable f" 
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

459 
by (rule summable_norm_cancel) simp 
14416  460 

23084  461 
text{*Summability of geometric series for real algebras*} 
462 

463 
lemma complete_algebra_summable_geometric: 

31017  464 
fixes x :: "'a::{real_normed_algebra_1,banach}" 
23084  465 
shows "norm x < 1 \<Longrightarrow> summable (\<lambda>n. x ^ n)" 
466 
proof (rule summable_comparison_test) 

467 
show "\<exists>N. \<forall>n\<ge>N. norm (x ^ n) \<le> norm x ^ n" 

468 
by (simp add: norm_power_ineq) 

469 
show "norm x < 1 \<Longrightarrow> summable (\<lambda>n. norm x ^ n)" 

470 
by (simp add: summable_geometric) 

471 
qed 

472 

15085
5693a977a767
removed some [iff] declarations from RealDef.thy, concerning inequalities
paulson
parents:
15053
diff
changeset

473 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

474 
text{*A summable series of positive terms has limit that is at least as 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

475 
great as any partial sum.*} 
14416  476 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

477 
lemma pos_summable: 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

478 
fixes f:: "nat \<Rightarrow> real" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

479 
assumes pos: "\<And>n. 0 \<le> f n" and le: "\<And>n. setsum f {..<n} \<le> x" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

480 
shows "summable f" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

481 
proof  
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

482 
have "convergent (\<lambda>n. setsum f {..<n})" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

483 
proof (rule Bseq_mono_convergent) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

484 
show "Bseq (\<lambda>n. setsum f {..<n})" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

485 
by (intro BseqI'[of _ x]) (auto simp add: setsum_nonneg pos intro: le) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

486 
qed (auto intro: setsum_mono2 pos) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

487 
thus ?thesis 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

488 
by (force simp add: summable_def sums_def convergent_def) 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

489 
qed 
19106
6e6b5b1fdc06
* added Library/ASeries (sum of arithmetic series with instantiation to nat and int)
kleing
parents:
17149
diff
changeset

490 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

491 
lemma summable_rabs_comparison_test: 
20848  492 
fixes f :: "nat \<Rightarrow> real" 
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

493 
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>)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

494 
by (rule summable_comparison_test) auto 
20848  495 

14416  496 
lemma summable_rabs: 
20692  497 
fixes f :: "nat \<Rightarrow> real" 
498 
shows "summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> \<bar>suminf f\<bar> \<le> (\<Sum>n. \<bar>f n\<bar>)" 

20848  499 
by (fold real_norm_def, rule summable_norm) 
14416  500 

23111  501 
subsection {* Cauchy Product Formula *} 
502 

54703  503 
text {* 
504 
Proof based on Analysis WebNotes: Chapter 07, Class 41 

505 
@{url "http://www.math.unl.edu/~webnotes/classes/class41/prp77.htm"} 

506 
*} 

23111  507 

508 
lemma setsum_triangle_reindex: 

509 
fixes n :: nat 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

510 
shows "(\<Sum>(i,j)\<in>{(i,j). i+j < n}. f i j) = (\<Sum>k<n. \<Sum>i=0..k. f i (k  i))" 
23111  511 
proof  
512 
have "(\<Sum>(i, j)\<in>{(i, j). i + j < n}. f i j) = 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

513 
(\<Sum>(k, i)\<in>(SIGMA k:{..<n}. {0..k}). f i (k  i))" 
23111  514 
proof (rule setsum_reindex_cong) 
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

515 
show "inj_on (\<lambda>(k,i). (i, k  i)) (SIGMA k:{..<n}. {0..k})" 
23111  516 
by (rule inj_on_inverseI [where g="\<lambda>(i,j). (i+j, i)"], auto) 
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

517 
show "{(i,j). i + j < n} = (\<lambda>(k,i). (i, k  i)) ` (SIGMA k:{..<n}. {0..k})" 
23111  518 
by (safe, rule_tac x="(a+b,a)" in image_eqI, auto) 
519 
show "\<And>a. (\<lambda>(k, i). f i (k  i)) a = split f ((\<lambda>(k, i). (i, k  i)) a)" 

520 
by clarify 

521 
qed 

522 
thus ?thesis by (simp add: setsum_Sigma) 

523 
qed 

524 

525 
lemma Cauchy_product_sums: 

526 
fixes a b :: "nat \<Rightarrow> 'a::{real_normed_algebra,banach}" 

527 
assumes a: "summable (\<lambda>k. norm (a k))" 

528 
assumes b: "summable (\<lambda>k. norm (b k))" 

529 
shows "(\<lambda>k. \<Sum>i=0..k. a i * b (k  i)) sums ((\<Sum>k. a k) * (\<Sum>k. b k))" 

530 
proof  

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

531 
let ?S1 = "\<lambda>n::nat. {..<n} \<times> {..<n}" 
23111  532 
let ?S2 = "\<lambda>n::nat. {(i,j). i + j < n}" 
533 
have S1_mono: "\<And>m n. m \<le> n \<Longrightarrow> ?S1 m \<subseteq> ?S1 n" by auto 

534 
have S2_le_S1: "\<And>n. ?S2 n \<subseteq> ?S1 n" by auto 

535 
have S1_le_S2: "\<And>n. ?S1 (n div 2) \<subseteq> ?S2 n" by auto 

536 
have finite_S1: "\<And>n. finite (?S1 n)" by simp 

537 
with S2_le_S1 have finite_S2: "\<And>n. finite (?S2 n)" by (rule finite_subset) 

538 

539 
let ?g = "\<lambda>(i,j). a i * b j" 

540 
let ?f = "\<lambda>(i,j). norm (a i) * norm (b j)" 

541 
have f_nonneg: "\<And>x. 0 \<le> ?f x" 

542 
by (auto simp add: mult_nonneg_nonneg) 

543 
hence norm_setsum_f: "\<And>A. norm (setsum ?f A) = setsum ?f A" 

544 
unfolding real_norm_def 

545 
by (simp only: abs_of_nonneg setsum_nonneg [rule_format]) 

546 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

547 
have "(\<lambda>n. (\<Sum>k<n. a k) * (\<Sum>k<n. b k)) > (\<Sum>k. a k) * (\<Sum>k. b k)" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

548 
by (intro tendsto_mult summable_LIMSEQ summable_norm_cancel [OF a] summable_norm_cancel [OF b]) 
23111  549 
hence 1: "(\<lambda>n. setsum ?g (?S1 n)) > (\<Sum>k. a k) * (\<Sum>k. b k)" 
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

550 
by (simp only: setsum_product setsum_Sigma [rule_format] finite_lessThan) 
23111  551 

56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

552 
have "(\<lambda>n. (\<Sum>k<n. norm (a k)) * (\<Sum>k<n. norm (b k))) > (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))" 
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

553 
using a b by (intro tendsto_mult summable_LIMSEQ) 
23111  554 
hence "(\<lambda>n. setsum ?f (?S1 n)) > (\<Sum>k. norm (a k)) * (\<Sum>k. norm (b k))" 
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56178
diff
changeset

555 
by (simp only: setsum_product setsum_Sigma [rule_format] finite_lessThan) 
23111  556 
hence "convergent (\<lambda>n. setsum ?f (?S1 n))" 
557 
by (rule convergentI) 

558 
hence Cauchy: "Cauchy (\<lambda>n. setsum ?f (?S1 n))" 

559 
by (rule convergent_Cauchy) 

36657  560 
have "Zfun (\<lambda>n. setsum ?f (?S1 n  ?S2 n)) sequentially" 
561 
proof (rule ZfunI, simp only: eventually_sequentially norm_setsum_f) 

23111  562 
fix r :: real 
563 
assume r: "0 < r" 

564 
from CauchyD [OF Cauchy r] obtain N 

565 
where "\<forall>m\<ge>N. \<forall>n\<ge>N. norm (setsum ?f (?S1 m)  setsum ?f (?S1 n)) < r" .. 

566 
hence "\<And>m n. \<lbrakk>N \<le> n; n \<le> m\<rbrakk> \<Longrightarrow> norm (setsum ?f (?S1 m  ?S1 n)) < r" 

567 
by (simp only: setsum_diff finite_S1 S1_mono) 

568 
hence N: "\<And>m n. \<lbrakk>N \<le> n; n \<le> m\<rbrakk> \<Longrightarrow> setsum ?f (?S1 m  ?S1 n) < r" 

569 
by (simp only: norm_setsum_f) 

570 
show "\<exists>N. \<forall>n\<ge>N. setsum ?f (?S1 n  ?S2 n) < r" 

571 
proof (intro exI allI impI) 

572 
fix n assume "2 * N \<le> n" 

573 
hence n: "N \<le> n div 2" by simp 

574 
have "setsum ?f (?S1 n  ?S2 n) \<le> setsum ?f (?S1 n  ?S1 (n div 2))" 

575 
by (intro setsum_mono2 finite_Diff finite_S1 f_nonneg 

576 
Diff_mono subset_refl S1_le_S2) 

577 
also have "\<dots> < r" 

578 
using n div_le_dividend by (rule N) 

579 
finally show "setsum ?f (?S1 n  ?S2 n) < r" . 

580 
qed 

581 
qed 

36657  582 
hence "Zfun (\<lambda>n. setsum ?g (?S1 n  ?S2 n)) sequentially" 
583 
apply (rule Zfun_le [rule_format]) 

23111  584 
apply (simp only: norm_setsum_f) 
585 
apply (rule order_trans [OF norm_setsum setsum_mono]) 

586 
apply (auto simp add: norm_mult_ineq) 

587 
done 

588 
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

589 
unfolding tendsto_Zfun_iff diff_0_right 
36657  590 
by (simp only: setsum_diff finite_S1 S2_le_S1) 
23111  591 

592 
with 1 have "(\<lambda>n. setsum ?g (?S2 n)) > (\<Sum>k. a k) * (\<Sum>k. b k)" 

593 
by (rule LIMSEQ_diff_approach_zero2) 

594 
thus ?thesis by (simp only: sums_def setsum_triangle_reindex) 

595 
qed 

596 

597 
lemma Cauchy_product: 

598 
fixes a b :: "nat \<Rightarrow> 'a::{real_normed_algebra,banach}" 

599 
assumes a: "summable (\<lambda>k. norm (a k))" 

600 
assumes b: "summable (\<lambda>k. norm (b k))" 

601 
shows "(\<Sum>k. a k) * (\<Sum>k. b k) = (\<Sum>k. \<Sum>i=0..k. a i * b (k  i))" 

23441  602 
using a b 
23111  603 
by (rule Cauchy_product_sums [THEN sums_unique]) 
604 

14416  605 
end 