:: Monotone Real Sequences. Subsequences
:: by Jaros{\l}aw Kotowicz
::
:: Received November 23, 1989
:: Copyright (c) 1990 Association of Mizar Users


begin

Lm1: for n, m being Element of NAT st n < m holds
ex k being Element of NAT st m = (n + 1) + k
proof end;

Lm2: for seq being Real_Sequence holds
( ( ( for n being Element of NAT holds seq . n < seq . (n + 1) ) implies for n, k being Element of NAT holds seq . n < seq . ((n + 1) + k) ) & ( ( for n, k being Element of NAT holds seq . n < seq . ((n + 1) + k) ) implies for n, m being Element of NAT st n < m holds
seq . n < seq . m ) & ( ( for n, m being Element of NAT st n < m holds
seq . n < seq . m ) implies for n being Element of NAT holds seq . n < seq . (n + 1) ) )
proof end;

Lm3: for seq being Real_Sequence holds
( ( ( for n being Element of NAT holds seq . (n + 1) < seq . n ) implies for n, k being Element of NAT holds seq . ((n + 1) + k) < seq . n ) & ( ( for n, k being Element of NAT holds seq . ((n + 1) + k) < seq . n ) implies for n, m being Element of NAT st n < m holds
seq . m < seq . n ) & ( ( for n, m being Element of NAT st n < m holds
seq . m < seq . n ) implies for n being Element of NAT holds seq . (n + 1) < seq . n ) )
proof end;

Lm4: for seq being Real_Sequence holds
( ( ( for n being Element of NAT holds seq . n <= seq . (n + 1) ) implies for n, k being Element of NAT holds seq . n <= seq . (n + k) ) & ( ( for n, k being Element of NAT holds seq . n <= seq . (n + k) ) implies for n, m being Element of NAT st n <= m holds
seq . n <= seq . m ) & ( ( for n, m being Element of NAT st n <= m holds
seq . n <= seq . m ) implies for n being Element of NAT holds seq . n <= seq . (n + 1) ) )
proof end;

Lm5: for seq being Real_Sequence holds
( ( ( for n being Element of NAT holds seq . (n + 1) <= seq . n ) implies for n, k being Element of NAT holds seq . (n + k) <= seq . n ) & ( ( for n, k being Element of NAT holds seq . (n + k) <= seq . n ) implies for n, m being Element of NAT st n <= m holds
seq . m <= seq . n ) & ( ( for n, m being Element of NAT st n <= m holds
seq . m <= seq . n ) implies for n being Element of NAT holds seq . (n + 1) <= seq . n ) )
proof end;

definition
let f be PartFunc of NAT,REAL;
redefine attr f is increasing means :Def1: :: SEQM_3:def 1
for m, n being Element of NAT st m in dom f & n in dom f & m < n holds
f . m < f . n;
compatibility
( f is increasing iff for m, n being Element of NAT st m in dom f & n in dom f & m < n holds
f . m < f . n )
proof end;
redefine attr f is decreasing means :Def2: :: SEQM_3:def 2
for m, n being Element of NAT st m in dom f & n in dom f & m < n holds
f . m > f . n;
compatibility
( f is decreasing iff for m, n being Element of NAT st m in dom f & n in dom f & m < n holds
f . m > f . n )
proof end;
redefine attr f is non-decreasing means :Def3: :: SEQM_3:def 3
for m, n being Element of NAT st m in dom f & n in dom f & m <= n holds
f . m <= f . n;
compatibility
( f is non-decreasing iff for m, n being Element of NAT st m in dom f & n in dom f & m <= n holds
f . m <= f . n )
proof end;
redefine attr f is non-increasing means :Def4: :: SEQM_3:def 4
for m, n being Element of NAT st m in dom f & n in dom f & m <= n holds
f . m >= f . n;
compatibility
( f is non-increasing iff for m, n being Element of NAT st m in dom f & n in dom f & m <= n holds
f . m >= f . n )
proof end;
end;

:: deftheorem Def1 defines increasing SEQM_3:def 1 :
for f being PartFunc of NAT,REAL holds
( f is increasing iff for m, n being Element of NAT st m in dom f & n in dom f & m < n holds
f . m < f . n );

:: deftheorem Def2 defines decreasing SEQM_3:def 2 :
for f being PartFunc of NAT,REAL holds
( f is decreasing iff for m, n being Element of NAT st m in dom f & n in dom f & m < n holds
f . m > f . n );

:: deftheorem Def3 defines non-decreasing SEQM_3:def 3 :
for f being PartFunc of NAT,REAL holds
( f is non-decreasing iff for m, n being Element of NAT st m in dom f & n in dom f & m <= n holds
f . m <= f . n );

:: deftheorem Def4 defines non-increasing SEQM_3:def 4 :
for f being PartFunc of NAT,REAL holds
( f is non-increasing iff for m, n being Element of NAT st m in dom f & n in dom f & m <= n holds
f . m >= f . n );

Lm6: for f being Real_Sequence holds
( f is increasing iff for n being Element of NAT holds f . n < f . (n + 1) )
proof end;

Lm7: for f being Real_Sequence holds
( f is decreasing iff for n being Element of NAT holds f . n > f . (n + 1) )
proof end;

Lm8: for f being Real_Sequence holds
( f is non-decreasing iff for n being Element of NAT holds f . n <= f . (n + 1) )
proof end;

Lm9: for f being Real_Sequence holds
( f is non-increasing iff for n being Element of NAT holds f . n >= f . (n + 1) )
proof end;

definition
canceled;
canceled;
let seq be Real_Sequence;
attr seq is monotone means :Def7: :: SEQM_3:def 7
( seq is non-decreasing or seq is non-increasing );
end;

:: deftheorem SEQM_3:def 5 :
canceled;

:: deftheorem SEQM_3:def 6 :
canceled;

:: deftheorem Def7 defines monotone SEQM_3:def 7 :
for seq being Real_Sequence holds
( seq is monotone iff ( seq is non-decreasing or seq is non-increasing ) );

theorem :: SEQM_3:1
canceled;

theorem :: SEQM_3:2
canceled;

theorem :: SEQM_3:3
canceled;

theorem :: SEQM_3:4
canceled;

theorem :: SEQM_3:5
canceled;

theorem :: SEQM_3:6
canceled;

theorem Th7: :: SEQM_3:7
for seq being Real_Sequence holds
( seq is increasing iff for n, m being Element of NAT st n < m holds
seq . n < seq . m )
proof end;

theorem :: SEQM_3:8
for seq being Real_Sequence holds
( seq is increasing iff for n, k being Element of NAT holds seq . n < seq . ((n + 1) + k) )
proof end;

theorem Th9: :: SEQM_3:9
for seq being Real_Sequence holds
( seq is decreasing iff for n, k being Element of NAT holds seq . ((n + 1) + k) < seq . n )
proof end;

theorem Th10: :: SEQM_3:10
for seq being Real_Sequence holds
( seq is decreasing iff for n, m being Element of NAT st n < m holds
seq . m < seq . n )
proof end;

theorem Th11: :: SEQM_3:11
for seq being Real_Sequence holds
( seq is non-decreasing iff for n, k being Element of NAT holds seq . n <= seq . (n + k) )
proof end;

theorem Th12: :: SEQM_3:12
for seq being Real_Sequence holds
( seq is non-decreasing iff for n, m being Element of NAT st n <= m holds
seq . n <= seq . m )
proof end;

theorem Th13: :: SEQM_3:13
for seq being Real_Sequence holds
( seq is non-increasing iff for n, k being Element of NAT holds seq . (n + k) <= seq . n )
proof end;

theorem Th14: :: SEQM_3:14
for seq being Real_Sequence holds
( seq is non-increasing iff for n, m being Element of NAT st n <= m holds
seq . m <= seq . n )
proof end;

theorem :: SEQM_3:15
canceled;

theorem :: SEQM_3:16
canceled;

theorem :: SEQM_3:17
canceled;

theorem :: SEQM_3:18
canceled;

theorem :: SEQM_3:19
for seq being Real_Sequence st seq is increasing holds
for n being Element of NAT st 0 < n holds
seq . 0 < seq . n by Th7;

theorem :: SEQM_3:20
for seq being Real_Sequence st seq is decreasing holds
for n being Element of NAT st 0 < n holds
seq . n < seq . 0 by Th10;

theorem Th21: :: SEQM_3:21
for seq being Real_Sequence st seq is non-decreasing holds
for n being Element of NAT holds seq . 0 <= seq . n by Th12;

theorem Th22: :: SEQM_3:22
for seq being Real_Sequence st seq is non-increasing holds
for n being Element of NAT holds seq . n <= seq . 0 by Th14;

registration
cluster Function-like constant -> non-decreasing non-increasing Element of K21(K22(NAT,REAL));
coherence
for b1 being PartFunc of NAT,REAL st b1 is constant holds
( b1 is non-decreasing & b1 is non-increasing )
proof end;
cluster Function-like non-decreasing non-increasing -> constant Element of K21(K22(NAT,REAL));
coherence
for b1 being PartFunc of NAT,REAL st b1 is non-decreasing & b1 is non-increasing holds
b1 is constant
proof end;
end;

theorem :: SEQM_3:23
canceled;

theorem :: SEQM_3:24
canceled;

theorem :: SEQM_3:25
canceled;

theorem :: SEQM_3:26
canceled;

theorem :: SEQM_3:27
canceled;

Lm10: ( incl NAT is increasing & incl NAT is natural-valued )
proof end;

Lm11: ( id NAT is increasing & id NAT is natural-valued )
;

registration
cluster Relation-like NAT -defined REAL -valued Function-like non empty total V15( NAT , REAL ) complex-valued ext-real-valued real-valued natural-valued increasing Element of K21(K22(NAT,REAL));
existence
ex b1 being Real_Sequence st
( b1 is increasing & b1 is natural-valued )
by Lm10;
end;

registration
cluster Relation-like NAT -defined NAT -valued Function-like non empty total V15( NAT , NAT ) complex-valued ext-real-valued real-valued rational-valued integer-valued natural-valued increasing Element of K21(K22(NAT,NAT));
existence
ex b1 being sequence of NAT st b1 is increasing
by Lm11;
end;

Lm12: for f being sequence of NAT holds
( f is increasing iff for n being Element of NAT holds f . n < f . (n + 1) )
proof end;

theorem :: SEQM_3:28
canceled;

theorem :: SEQM_3:29
for seq being Real_Sequence holds
( seq is sequence of NAT iff for n being Element of NAT holds seq . n is Element of NAT )
proof end;

theorem :: SEQM_3:30
canceled;

theorem :: SEQM_3:31
canceled;

registration
let Nseq be increasing sequence of NAT;
let k be Element of NAT ;
cluster Nseq ^\ k -> natural-valued increasing ;
coherence
( Nseq ^\ k is increasing & Nseq ^\ k is natural-valued )
proof end;
end;

definition
canceled;
canceled;
canceled;
let f be Real_Sequence;
redefine attr f is increasing means :: SEQM_3:def 11
for n being Element of NAT holds f . n < f . (n + 1);
compatibility
( f is increasing iff for n being Element of NAT holds f . n < f . (n + 1) )
by Lm6;
redefine attr f is decreasing means :: SEQM_3:def 12
for n being Element of NAT holds f . n > f . (n + 1);
compatibility
( f is decreasing iff for n being Element of NAT holds f . n > f . (n + 1) )
by Lm7;
redefine attr f is non-decreasing means :: SEQM_3:def 13
for n being Element of NAT holds f . n <= f . (n + 1);
compatibility
( f is non-decreasing iff for n being Element of NAT holds f . n <= f . (n + 1) )
by Lm8;
redefine attr f is non-increasing means :: SEQM_3:def 14
for n being Element of NAT holds f . n >= f . (n + 1);
compatibility
( f is non-increasing iff for n being Element of NAT holds f . n >= f . (n + 1) )
by Lm9;
end;

:: deftheorem SEQM_3:def 8 :
canceled;

:: deftheorem SEQM_3:def 9 :
canceled;

:: deftheorem SEQM_3:def 10 :
canceled;

:: deftheorem defines increasing SEQM_3:def 11 :
for f being Real_Sequence holds
( f is increasing iff for n being Element of NAT holds f . n < f . (n + 1) );

:: deftheorem defines decreasing SEQM_3:def 12 :
for f being Real_Sequence holds
( f is decreasing iff for n being Element of NAT holds f . n > f . (n + 1) );

:: deftheorem defines non-decreasing SEQM_3:def 13 :
for f being Real_Sequence holds
( f is non-decreasing iff for n being Element of NAT holds f . n <= f . (n + 1) );

:: deftheorem defines non-increasing SEQM_3:def 14 :
for f being Real_Sequence holds
( f is non-increasing iff for n being Element of NAT holds f . n >= f . (n + 1) );

theorem :: SEQM_3:32
canceled;

theorem :: SEQM_3:33
for Nseq being increasing sequence of NAT
for n being Element of NAT holds n <= Nseq . n
proof end;

theorem :: SEQM_3:34
canceled;

theorem :: SEQM_3:35
canceled;

theorem :: SEQM_3:36
canceled;

theorem Th37: :: SEQM_3:37
for k being Element of NAT
for seq, seq1 being Real_Sequence holds (seq + seq1) ^\ k = (seq ^\ k) + (seq1 ^\ k)
proof end;

theorem Th38: :: SEQM_3:38
for k being Element of NAT
for seq being Real_Sequence holds (- seq) ^\ k = - (seq ^\ k)
proof end;

theorem :: SEQM_3:39
for k being Element of NAT
for seq, seq1 being Real_Sequence holds (seq - seq1) ^\ k = (seq ^\ k) - (seq1 ^\ k)
proof end;

theorem :: SEQM_3:40
canceled;

theorem Th41: :: SEQM_3:41
for k being Element of NAT
for seq being Real_Sequence holds (seq ") ^\ k = (seq ^\ k) "
proof end;

theorem Th42: :: SEQM_3:42
for k being Element of NAT
for seq, seq1 being Real_Sequence holds (seq (#) seq1) ^\ k = (seq ^\ k) (#) (seq1 ^\ k)
proof end;

theorem :: SEQM_3:43
for k being Element of NAT
for seq, seq1 being Real_Sequence holds (seq /" seq1) ^\ k = (seq ^\ k) /" (seq1 ^\ k)
proof end;

theorem :: SEQM_3:44
for k being Element of NAT
for r being real number
for seq being Real_Sequence holds (r (#) seq) ^\ k = r (#) (seq ^\ k)
proof end;

theorem :: SEQM_3:45
canceled;

theorem :: SEQM_3:46
canceled;

theorem :: SEQM_3:47
canceled;

theorem :: SEQM_3:48
canceled;

theorem :: SEQM_3:49
for seq, seq1 being Real_Sequence st seq is increasing & seq1 is subsequence of seq holds
seq1 is increasing
proof end;

theorem :: SEQM_3:50
for seq, seq1 being Real_Sequence st seq is decreasing & seq1 is subsequence of seq holds
seq1 is decreasing
proof end;

theorem Th51: :: SEQM_3:51
for seq, seq1 being Real_Sequence st seq is non-decreasing & seq1 is subsequence of seq holds
seq1 is non-decreasing
proof end;

theorem Th52: :: SEQM_3:52
for seq, seq1 being Real_Sequence st seq is non-increasing & seq1 is subsequence of seq holds
seq1 is non-increasing
proof end;

theorem :: SEQM_3:53
for seq, seq1 being Real_Sequence st seq is monotone & seq1 is subsequence of seq holds
seq1 is monotone
proof end;

theorem :: SEQM_3:54
canceled;

theorem :: SEQM_3:55
canceled;

theorem Th56: :: SEQM_3:56
for seq, seq1 being Real_Sequence st seq is bounded_above & seq1 is subsequence of seq holds
seq1 is bounded_above
proof end;

theorem Th57: :: SEQM_3:57
for seq, seq1 being Real_Sequence st seq is bounded_below & seq1 is subsequence of seq holds
seq1 is bounded_below
proof end;

theorem :: SEQM_3:58
for seq, seq1 being Real_Sequence st seq is bounded & seq1 is subsequence of seq holds
seq1 is bounded
proof end;

theorem :: SEQM_3:59
for r being real number
for seq being Real_Sequence holds
( ( seq is increasing & 0 < r implies r (#) seq is increasing ) & ( 0 = r implies r (#) seq is constant ) & ( seq is increasing & r < 0 implies r (#) seq is decreasing ) )
proof end;

theorem :: SEQM_3:60
for r being real number
for seq being Real_Sequence holds
( ( seq is decreasing & 0 < r implies r (#) seq is decreasing ) & ( seq is decreasing & r < 0 implies r (#) seq is increasing ) )
proof end;

theorem :: SEQM_3:61
for r being real number
for seq being Real_Sequence holds
( ( seq is non-decreasing & 0 <= r implies r (#) seq is non-decreasing ) & ( seq is non-decreasing & r <= 0 implies r (#) seq is non-increasing ) )
proof end;

theorem :: SEQM_3:62
for r being real number
for seq being Real_Sequence holds
( ( seq is non-increasing & 0 <= r implies r (#) seq is non-increasing ) & ( seq is non-increasing & r <= 0 implies r (#) seq is non-decreasing ) )
proof end;

theorem Th63: :: SEQM_3:63
for seq, seq1 being Real_Sequence holds
( ( seq is increasing & seq1 is increasing implies seq + seq1 is increasing ) & ( seq is decreasing & seq1 is decreasing implies seq + seq1 is decreasing ) & ( seq is non-decreasing & seq1 is non-decreasing implies seq + seq1 is non-decreasing ) & ( seq is non-increasing & seq1 is non-increasing implies seq + seq1 is non-increasing ) )
proof end;

theorem :: SEQM_3:64
for seq, seq1 being Real_Sequence holds
( ( seq is increasing & seq1 is constant implies seq + seq1 is increasing ) & ( seq is decreasing & seq1 is constant implies seq + seq1 is decreasing ) & ( seq is non-decreasing & seq1 is constant implies seq + seq1 is non-decreasing ) & ( seq is non-increasing & seq1 is constant implies seq + seq1 is non-increasing ) )
proof end;

theorem :: SEQM_3:65
canceled;

theorem :: SEQM_3:66
canceled;

theorem :: SEQM_3:67
canceled;

theorem Th68: :: SEQM_3:68
for r being real number
for seq being Real_Sequence holds
( ( seq is bounded_above & 0 < r implies r (#) seq is bounded_above ) & ( 0 = r implies r (#) seq is bounded ) & ( seq is bounded_above & r < 0 implies r (#) seq is bounded_below ) )
proof end;

theorem :: SEQM_3:69
canceled;

theorem :: SEQM_3:70
for seq being Real_Sequence holds
( ( seq is bounded implies for r being real number holds r (#) seq is bounded ) & ( seq is bounded implies - seq is bounded ) & ( seq is bounded implies abs seq is bounded ) & ( abs seq is bounded implies seq is bounded ) )
proof end;

theorem :: SEQM_3:71
canceled;

theorem :: SEQM_3:72
canceled;

theorem :: SEQM_3:73
canceled;

theorem :: SEQM_3:74
canceled;

theorem :: SEQM_3:75
canceled;

theorem :: SEQM_3:76
canceled;

theorem :: SEQM_3:77
for seq, seq1 being Real_Sequence st seq is bounded_above & seq1 is non-increasing holds
seq + seq1 is bounded_above
proof end;

theorem :: SEQM_3:78
for seq, seq1 being Real_Sequence st seq is bounded_below & seq1 is non-decreasing holds
seq + seq1 is bounded_below
proof end;

theorem :: SEQM_3:79
canceled;

theorem :: SEQM_3:80
( incl NAT is increasing & incl NAT is natural-valued ) by Lm10;

registration
cluster -> natural-valued FinSequence of NAT ;
coherence
for b1 being FinSequence of NAT holds b1 is natural-valued
;
end;

begin

theorem Th81: :: SEQM_3:81
for r, s being Real holds
( abs (r - s) = 1 iff ( ( r > s & r = s + 1 ) or ( r < s & s = r + 1 ) ) )
proof end;

theorem :: SEQM_3:82
for i, j, n, m being Element of NAT holds
( (abs (i - j)) + (abs (n - m)) = 1 iff ( ( abs (i - j) = 1 & n = m ) or ( abs (n - m) = 1 & i = j ) ) )
proof end;

theorem :: SEQM_3:83
for n being Element of NAT holds
( n > 1 iff ex m being Element of NAT st
( n = m + 1 & m > 0 ) )
proof end;

theorem :: SEQM_3:84
for f being FinSequence
for n, m, k being Element of NAT st len f = m + 1 & n in dom f & k in Seg m & not (Del (f,n)) . k = f . k holds
(Del (f,n)) . k = f . (k + 1)
proof end;

definition
let f be FinSequence;
redefine attr f is constant means :: SEQM_3:def 15
for n, m being Element of NAT st n in dom f & m in dom f holds
f . n = f . m;
compatibility
( f is constant iff for n, m being Element of NAT st n in dom f & m in dom f holds
f . n = f . m )
proof end;
end;

:: deftheorem defines constant SEQM_3:def 15 :
for f being FinSequence holds
( f is constant iff for n, m being Element of NAT st n in dom f & m in dom f holds
f . n = f . m );

registration
cluster -> real-valued FinSequence of REAL ;
coherence
for b1 being FinSequence of REAL holds b1 is real-valued
;
end;

registration
cluster Relation-like NAT -defined REAL -valued Function-like non empty complex-valued ext-real-valued real-valued increasing V52() FinSequence-like FinSubsequence-like FinSequence of REAL ;
existence
ex b1 being FinSequence of REAL st
( not b1 is empty & b1 is increasing )
proof end;
end;

registration
cluster Relation-like NAT -defined REAL -valued Function-like constant complex-valued ext-real-valued real-valued V52() FinSequence-like FinSubsequence-like FinSequence of REAL ;
existence
ex b1 being FinSequence of REAL st b1 is constant
proof end;
end;

theorem Th85: :: SEQM_3:85
for v being FinSequence of REAL
for n, i, m being Element of NAT st v <> {} & rng v c= Seg n & v . (len v) = n & ( for k being Element of NAT st 1 <= k & k <= (len v) - 1 holds
for r, s being Real st r = v . k & s = v . (k + 1) & not abs (r - s) = 1 holds
r = s ) & i in Seg n & i + 1 in Seg n & m in dom v & v . m = i & ( for k being Element of NAT st k in dom v & v . k = i holds
k <= m ) holds
( m + 1 in dom v & v . (m + 1) = i + 1 )
proof end;

theorem :: SEQM_3:86
for v being FinSequence of REAL
for n being Element of NAT st v <> {} & rng v c= Seg n & v . 1 = 1 & v . (len v) = n & ( for k being Element of NAT st 1 <= k & k <= (len v) - 1 holds
for r, s being Real st r = v . k & s = v . (k + 1) & not abs (r - s) = 1 holds
r = s ) holds
( ( for i being Element of NAT st i in Seg n holds
ex k being Element of NAT st
( k in dom v & v . k = i ) ) & ( for m, k, i being Element of NAT
for r being Real st m in dom v & v . m = i & ( for j being Element of NAT st j in dom v & v . j = i holds
j <= m ) & m < k & k in dom v & r = v . k holds
i < r ) )
proof end;