:: Series
:: by Konrad Raczkowski and Andrzej N\c{e}dzusiak
::
:: Received October 15, 1990
:: Copyright (c) 1990-2011 Association of Mizar Users


begin

Lm1: 1 / 1 = 1
;

theorem Th1: :: SERIES_1:1
for a being real number
for s being Real_Sequence st 0 < a & a < 1 & ( for n being Element of NAT holds s . n = a to_power (n + 1) ) holds
( s is convergent & lim s = 0 )
proof end;

theorem Th2: :: SERIES_1:2
for a being real number
for n being natural number holds (abs a) to_power n = abs (a to_power n)
proof end;

theorem Th3: :: SERIES_1:3
for a being real number
for s being Real_Sequence st abs a < 1 & ( for n being Element of NAT holds s . n = a to_power (n + 1) ) holds
( s is convergent & lim s = 0 )
proof end;

definition
let X be non empty complex-membered add-closed set ;
let s1, s2 be sequence of X;
:: original: +
redefine func s1 + s2 -> sequence of X;
coherence
s1 + s2 is sequence of X
proof end;
end;

definition
let X be complex-membered set ;
let s be sequence of X;
assume A1: ( not X is empty & X is add-closed ) ;
func Partial_Sums s -> sequence of X means :Def1: :: SERIES_1:def 1
( it . 0 = s . 0 & ( for n being Element of NAT holds it . (n + 1) = (it . n) + (s . (n + 1)) ) );
existence
ex b1 being sequence of X st
( b1 . 0 = s . 0 & ( for n being Element of NAT holds b1 . (n + 1) = (b1 . n) + (s . (n + 1)) ) )
proof end;
uniqueness
for b1, b2 being sequence of X st b1 . 0 = s . 0 & ( for n being Element of NAT holds b1 . (n + 1) = (b1 . n) + (s . (n + 1)) ) & b2 . 0 = s . 0 & ( for n being Element of NAT holds b2 . (n + 1) = (b2 . n) + (s . (n + 1)) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def1 defines Partial_Sums SERIES_1:def 1 :
for X being complex-membered set
for s being sequence of X st not X is empty & X is add-closed holds
for b3 being sequence of X holds
( b3 = Partial_Sums s iff ( b3 . 0 = s . 0 & ( for n being Element of NAT holds b3 . (n + 1) = (b3 . n) + (s . (n + 1)) ) ) );

definition
let s be Real_Sequence;
attr s is summable means :Def2: :: SERIES_1:def 2
Partial_Sums s is convergent ;
func Sum s -> Real equals :: SERIES_1:def 3
lim (Partial_Sums s);
correctness
coherence
lim (Partial_Sums s) is Real
;
;
end;

:: deftheorem Def2 defines summable SERIES_1:def 2 :
for s being Real_Sequence holds
( s is summable iff Partial_Sums s is convergent );

:: deftheorem defines Sum SERIES_1:def 3 :
for s being Real_Sequence holds Sum s = lim (Partial_Sums s);

theorem :: SERIES_1:4
canceled;

theorem :: SERIES_1:5
canceled;

theorem :: SERIES_1:6
canceled;

theorem Th7: :: SERIES_1:7
for s being Real_Sequence st s is summable holds
( s is convergent & lim s = 0 )
proof end;

Lm2: for X being non empty complex-membered add-closed set
for seq, seq1, seq2 being sequence of X holds
( seq = seq1 + seq2 iff for n being Element of NAT holds seq . n = (seq1 . n) + (seq2 . n) )
proof end;

theorem Th8: :: SERIES_1:8
for X being non empty complex-membered add-closed set
for s1, s2 being sequence of X holds (Partial_Sums s1) + (Partial_Sums s2) = Partial_Sums (s1 + s2)
proof end;

theorem Th9: :: SERIES_1:9
for s1, s2 being Real_Sequence holds (Partial_Sums s1) - (Partial_Sums s2) = Partial_Sums (s1 - s2)
proof end;

theorem :: SERIES_1:10
for s1, s2 being Real_Sequence st s1 is summable & s2 is summable holds
( s1 + s2 is summable & Sum (s1 + s2) = (Sum s1) + (Sum s2) )
proof end;

theorem :: SERIES_1:11
for s1, s2 being Real_Sequence st s1 is summable & s2 is summable holds
( s1 - s2 is summable & Sum (s1 - s2) = (Sum s1) - (Sum s2) )
proof end;

theorem Th12: :: SERIES_1:12
for r being real number
for s being Real_Sequence holds Partial_Sums (r (#) s) = r (#) (Partial_Sums s)
proof end;

theorem Th13: :: SERIES_1:13
for r being real number
for s being Real_Sequence st s is summable holds
( r (#) s is summable & Sum (r (#) s) = r * (Sum s) )
proof end;

theorem Th14: :: SERIES_1:14
for s, s1 being Real_Sequence st ( for n being Element of NAT holds s1 . n = s . 0 ) holds
Partial_Sums (s ^\ 1) = ((Partial_Sums s) ^\ 1) - s1
proof end;

theorem Th15: :: SERIES_1:15
for s being Real_Sequence st s is summable holds
for n being Element of NAT holds s ^\ n is summable
proof end;

theorem Th16: :: SERIES_1:16
for s being Real_Sequence st ex n being Element of NAT st s ^\ n is summable holds
s is summable
proof end;

theorem Th17: :: SERIES_1:17
for s1, s2 being Real_Sequence st ( for n being Element of NAT holds s1 . n <= s2 . n ) holds
for n being Element of NAT holds (Partial_Sums s1) . n <= (Partial_Sums s2) . n
proof end;

theorem :: SERIES_1:18
for s being Real_Sequence st s is summable holds
for n being Element of NAT holds Sum s = ((Partial_Sums s) . n) + (Sum (s ^\ (n + 1)))
proof end;

theorem Th19: :: SERIES_1:19
for s being Real_Sequence st ( for n being Element of NAT holds 0 <= s . n ) holds
Partial_Sums s is non-decreasing
proof end;

theorem Th20: :: SERIES_1:20
for s being Real_Sequence st ( for n being Element of NAT holds 0 <= s . n ) holds
( Partial_Sums s is bounded_above iff s is summable )
proof end;

theorem :: SERIES_1:21
for s being Real_Sequence st s is summable & ( for n being Element of NAT holds 0 <= s . n ) holds
0 <= Sum s
proof end;

theorem Th22: :: SERIES_1:22
for s2, s1 being Real_Sequence st ( for n being Element of NAT holds 0 <= s2 . n ) & s1 is summable & ex m being Element of NAT st
for n being Element of NAT st m <= n holds
s2 . n <= s1 . n holds
s2 is summable
proof end;

theorem :: SERIES_1:23
canceled;

theorem :: SERIES_1:24
for s1, s2 being Real_Sequence st ( for n being Element of NAT holds
( 0 <= s1 . n & s1 . n <= s2 . n ) ) & s2 is summable holds
( s1 is summable & Sum s1 <= Sum s2 )
proof end;

theorem Th25: :: SERIES_1:25
for s being Real_Sequence holds
( s is summable iff for r being real number st 0 < r holds
ex n being Element of NAT st
for m being Element of NAT st n <= m holds
abs (((Partial_Sums s) . m) - ((Partial_Sums s) . n)) < r )
proof end;

theorem Th26: :: SERIES_1:26
for n being Element of NAT
for a being real number st a <> 1 holds
(Partial_Sums (a GeoSeq)) . n = (1 - (a to_power (n + 1))) / (1 - a)
proof end;

theorem :: SERIES_1:27
for a being real number
for s being Real_Sequence st a <> 1 & ( for n being Element of NAT holds s . (n + 1) = a * (s . n) ) holds
for n being Element of NAT holds (Partial_Sums s) . n = ((s . 0) * (1 - (a to_power (n + 1)))) / (1 - a)
proof end;

theorem Th28: :: SERIES_1:28
for a being real number st abs a < 1 holds
( a GeoSeq is summable & Sum (a GeoSeq) = 1 / (1 - a) )
proof end;

theorem :: SERIES_1:29
for a being real number
for s being Real_Sequence st abs a < 1 & ( for n being Element of NAT holds s . (n + 1) = a * (s . n) ) holds
( s is summable & Sum s = (s . 0) / (1 - a) )
proof end;

theorem Th30: :: SERIES_1:30
for s, s1 being Real_Sequence st ( for n being Element of NAT holds
( s . n > 0 & s1 . n = (s . (n + 1)) / (s . n) ) ) & s1 is convergent & lim s1 < 1 holds
s is summable
proof end;

theorem :: SERIES_1:31
for s being Real_Sequence st ( for n being Element of NAT holds s . n > 0 ) & ex m being Element of NAT st
for n being Element of NAT st n >= m holds
(s . (n + 1)) / (s . n) >= 1 holds
not s is summable
proof end;

theorem Th32: :: SERIES_1:32
for s, s1 being Real_Sequence st ( for n being Element of NAT holds
( s . n >= 0 & s1 . n = n -root (s . n) ) ) & s1 is convergent & lim s1 < 1 holds
s is summable
proof end;

theorem Th33: :: SERIES_1:33
for s, s1 being Real_Sequence st ( for n being Element of NAT holds
( s . n >= 0 & s1 . n = n -root (s . n) ) ) & ex m being Element of NAT st
for n being Element of NAT st m <= n holds
s1 . n >= 1 holds
not s is summable
proof end;

theorem :: SERIES_1:34
for s, s1 being Real_Sequence st ( for n being Element of NAT holds
( s . n >= 0 & s1 . n = n -root (s . n) ) ) & s1 is convergent & lim s1 > 1 holds
not s is summable
proof end;

registration
let k, n be Nat;
cluster k to_power n -> natural ;
coherence
k to_power n is natural
;
end;

definition
let k, n be Nat;
:: original: to_power
redefine func k to_power n -> Element of NAT ;
coherence
k to_power n is Element of NAT
by ORDINAL1:def 13;
end;

theorem Th35: :: SERIES_1:35
for s, s1 being Real_Sequence st s is non-increasing & ( for n being Element of NAT holds
( s . n >= 0 & s1 . n = (2 to_power n) * (s . (2 to_power n)) ) ) holds
( s is summable iff s1 is summable )
proof end;

theorem :: SERIES_1:36
for p being real number
for s being Real_Sequence st p > 1 & ( for n being Element of NAT st n >= 1 holds
s . n = 1 / (n to_power p) ) holds
s is summable
proof end;

theorem :: SERIES_1:37
for p being real number
for s being Real_Sequence st p <= 1 & ( for n being Element of NAT st n >= 1 holds
s . n = 1 / (n to_power p) ) holds
not s is summable
proof end;

definition
let s be Real_Sequence;
canceled;
attr s is absolutely_summable means :Def5: :: SERIES_1:def 5
abs s is summable ;
end;

:: deftheorem SERIES_1:def 4 :
canceled;

:: deftheorem Def5 defines absolutely_summable SERIES_1:def 5 :
for s being Real_Sequence holds
( s is absolutely_summable iff abs s is summable );

theorem :: SERIES_1:38
canceled;

theorem Th39: :: SERIES_1:39
for s being Real_Sequence
for n, m being Element of NAT st n <= m holds
abs (((Partial_Sums s) . m) - ((Partial_Sums s) . n)) <= abs (((Partial_Sums (abs s)) . m) - ((Partial_Sums (abs s)) . n))
proof end;

theorem :: SERIES_1:40
for s being Real_Sequence st s is absolutely_summable holds
s is summable
proof end;

theorem :: SERIES_1:41
for s being Real_Sequence st ( for n being Element of NAT holds 0 <= s . n ) & s is summable holds
s is absolutely_summable
proof end;

theorem :: SERIES_1:42
for s, s1 being Real_Sequence st ( for n being Element of NAT holds
( s . n <> 0 & s1 . n = ((abs s) . (n + 1)) / ((abs s) . n) ) ) & s1 is convergent & lim s1 < 1 holds
s is absolutely_summable
proof end;

theorem Th43: :: SERIES_1:43
for r being real number
for s being Real_Sequence st r > 0 & ex m being Element of NAT st
for n being Element of NAT st n >= m holds
abs (s . n) >= r & s is convergent holds
lim s <> 0
proof end;

theorem :: SERIES_1:44
for s being Real_Sequence st ( for n being Element of NAT holds s . n <> 0 ) & ex m being Element of NAT st
for n being Element of NAT st n >= m holds
((abs s) . (n + 1)) / ((abs s) . n) >= 1 holds
not s is summable
proof end;

theorem :: SERIES_1:45
for s1, s being Real_Sequence st ( for n being Element of NAT holds s1 . n = n -root ((abs s) . n) ) & s1 is convergent & lim s1 < 1 holds
s is absolutely_summable
proof end;

theorem :: SERIES_1:46
for s1, s being Real_Sequence st ( for n being Element of NAT holds s1 . n = n -root ((abs s) . n) ) & ex m being Element of NAT st
for n being Element of NAT st m <= n holds
s1 . n >= 1 holds
not s is summable
proof end;

theorem :: SERIES_1:47
for s1, s being Real_Sequence st ( for n being Element of NAT holds s1 . n = n -root ((abs s) . n) ) & s1 is convergent & lim s1 > 1 holds
not s is summable
proof end;

begin

definition
let s be Real_Sequence;
let n be Nat;
func Sum (s,n) -> Real equals :: SERIES_1:def 6
(Partial_Sums s) . n;
coherence
(Partial_Sums s) . n is Real
;
end;

:: deftheorem defines Sum SERIES_1:def 6 :
for s being Real_Sequence
for n being Nat holds Sum (s,n) = (Partial_Sums s) . n;

definition
let s be Real_Sequence;
let n, m be Nat;
func Sum (s,n,m) -> Real equals :: SERIES_1:def 7
(Sum (s,n)) - (Sum (s,m));
coherence
(Sum (s,n)) - (Sum (s,m)) is Real
;
end;

:: deftheorem defines Sum SERIES_1:def 7 :
for s being Real_Sequence
for n, m being Nat holds Sum (s,n,m) = (Sum (s,n)) - (Sum (s,m));