:: ALGSEQ_1 semantic presentation

definition
let n be Element of NAT ;
func PSeg c1 -> set equals :: ALGSEQ_1:def 1
{ k where k is Element of NAT : k < n } ;
coherence
{ k where k is Element of NAT : k < n } is set
;
end;

:: deftheorem Def1 defines PSeg ALGSEQ_1:def 1 :
for n being Element of NAT holds PSeg n = { k where k is Element of NAT : k < n } ;

definition
let n be Element of NAT ;
redefine func PSeg as PSeg c1 -> Subset of NAT ;
coherence
PSeg n is Subset of NAT
proof end;
end;

Lemma23: for n being Element of NAT
for x being set st x in PSeg n holds
x is Element of NAT
;

theorem Th1: :: ALGSEQ_1:1
canceled;

theorem Th2: :: ALGSEQ_1:2
canceled;

theorem Th3: :: ALGSEQ_1:3
canceled;

theorem Th4: :: ALGSEQ_1:4
canceled;

theorem Th5: :: ALGSEQ_1:5
canceled;

theorem Th6: :: ALGSEQ_1:6
canceled;

theorem Th7: :: ALGSEQ_1:7
canceled;

theorem Th8: :: ALGSEQ_1:8
canceled;

theorem Th9: :: ALGSEQ_1:9
canceled;

theorem Th10: :: ALGSEQ_1:10
for k, n being Element of NAT holds
( k in PSeg n iff k < n )
proof end;

theorem Th11: :: ALGSEQ_1:11
( PSeg 0 = {} & PSeg 1 = {0} & PSeg 2 = {0,1} )
proof end;

theorem Th12: :: ALGSEQ_1:12
for n being Element of NAT holds n in PSeg (n + 1)
proof end;

theorem Th13: :: ALGSEQ_1:13
for n, m being Element of NAT holds
( n <= m iff PSeg n c= PSeg m )
proof end;

theorem Th14: :: ALGSEQ_1:14
for n, m being Element of NAT st PSeg n = PSeg m holds
n = m
proof end;

theorem Th15: :: ALGSEQ_1:15
for k, n being Element of NAT st k <= n holds
( PSeg k = (PSeg k) /\ (PSeg n) & PSeg k = (PSeg n) /\ (PSeg k) )
proof end;

theorem Th16: :: ALGSEQ_1:16
for k, n being Element of NAT st ( PSeg k = (PSeg k) /\ (PSeg n) or PSeg k = (PSeg n) /\ (PSeg k) ) holds
k <= n
proof end;

theorem Th17: :: ALGSEQ_1:17
for n being Element of NAT holds (PSeg n) \/ {n} = PSeg (n + 1)
proof end;

definition
let R be non empty ZeroStr ;
let F be sequence of R;
attr a2 is finite-Support means :Def2: :: ALGSEQ_1:def 2
ex n being Element of NAT st
for i being Element of NAT st i >= n holds
F . i = 0. R;
end;

:: deftheorem Def2 defines finite-Support ALGSEQ_1:def 2 :
for R being non empty ZeroStr
for F being sequence of R holds
( F is finite-Support iff ex n being Element of NAT st
for i being Element of NAT st i >= n holds
F . i = 0. R );

registration
let R be non empty ZeroStr ;
cluster finite-Support M4( NAT ,the carrier of a1);
existence
ex b1 being sequence of R st b1 is finite-Support
proof end;
end;

definition
let R be non empty ZeroStr ;
mode AlgSequence of a1 is finite-Support sequence of a1;
end;

definition
let R be non empty ZeroStr ;
let p be AlgSequence of R;
let k be Element of NAT ;
pred c3 is_at_least_length_of c2 means :Def3: :: ALGSEQ_1:def 3
for i being Element of NAT st i >= k holds
p . i = 0. R;
end;

:: deftheorem Def3 defines is_at_least_length_of ALGSEQ_1:def 3 :
for R being non empty ZeroStr
for p being AlgSequence of R
for k being Element of NAT holds
( k is_at_least_length_of p iff for i being Element of NAT st i >= k holds
p . i = 0. R );

Lemma43: for R being non empty ZeroStr
for p being AlgSequence of R ex m being Element of NAT st m is_at_least_length_of p
proof end;

Lemma44: for R being non empty ZeroStr
for p being AlgSequence of R ex k being Element of NAT st
( k is_at_least_length_of p & ( for n being Element of NAT st n is_at_least_length_of p holds
k <= n ) )
proof end;

Lemma46: for k, l being Element of NAT
for R being non empty ZeroStr
for p being AlgSequence of R st k is_at_least_length_of p & ( for m being Element of NAT st m is_at_least_length_of p holds
k <= m ) & l is_at_least_length_of p & ( for m being Element of NAT st m is_at_least_length_of p holds
l <= m ) holds
k = l
proof end;

definition
let R be non empty ZeroStr ;
let p be AlgSequence of R;
func len c2 -> Element of NAT means :Def4: :: ALGSEQ_1:def 4
( it is_at_least_length_of p & ( for m being Element of NAT st m is_at_least_length_of p holds
it <= m ) );
existence
ex b1 being Element of NAT st
( b1 is_at_least_length_of p & ( for m being Element of NAT st m is_at_least_length_of p holds
b1 <= m ) )
by ;
uniqueness
for b1, b2 being Element of NAT st b1 is_at_least_length_of p & ( for m being Element of NAT st m is_at_least_length_of p holds
b1 <= m ) & b2 is_at_least_length_of p & ( for m being Element of NAT st m is_at_least_length_of p holds
b2 <= m ) holds
b1 = b2
by ;
end;

:: deftheorem Def4 defines len ALGSEQ_1:def 4 :
for R being non empty ZeroStr
for p being AlgSequence of R
for b3 being Element of NAT holds
( b3 = len p iff ( b3 is_at_least_length_of p & ( for m being Element of NAT st m is_at_least_length_of p holds
b3 <= m ) ) );

theorem Th18: :: ALGSEQ_1:18
canceled;

theorem Th19: :: ALGSEQ_1:19
canceled;

theorem Th20: :: ALGSEQ_1:20
canceled;

theorem Th21: :: ALGSEQ_1:21
canceled;

theorem Th22: :: ALGSEQ_1:22
for i being Element of NAT
for R being non empty ZeroStr
for p being AlgSequence of R st i >= len p holds
p . i = 0. R
proof end;

theorem Th23: :: ALGSEQ_1:23
canceled;

theorem Th24: :: ALGSEQ_1:24
for k being Element of NAT
for R being non empty ZeroStr
for p being AlgSequence of R st ( for i being Element of NAT st i < k holds
p . i <> 0. R ) holds
len p >= k
proof end;

theorem Th25: :: ALGSEQ_1:25
for k being Element of NAT
for R being non empty ZeroStr
for p being AlgSequence of R st len p = k + 1 holds
p . k <> 0. R
proof end;

definition
let R be non empty ZeroStr ;
let p be AlgSequence of R;
func support c2 -> Subset of NAT equals :: ALGSEQ_1:def 5
PSeg (len p);
coherence
PSeg (len p) is Subset of NAT
;
end;

:: deftheorem Def5 defines support ALGSEQ_1:def 5 :
for R being non empty ZeroStr
for p being AlgSequence of R holds support p = PSeg (len p);

theorem Th26: :: ALGSEQ_1:26
canceled;

theorem Th27: :: ALGSEQ_1:27
for k being Element of NAT
for R being non empty ZeroStr
for p being AlgSequence of R holds
( k = len p iff PSeg k = support p ) by ;

scheme :: ALGSEQ_1:sch 51
s51{ F1() -> non empty ZeroStr , F2() -> Element of NAT , F3( Element of NAT ) -> Element of F1() } :
ex p being AlgSequence of F1() st
( len p <= F2() & ( for k being Element of NAT st k < F2() holds
p . k = F3(k) ) )
proof end;

theorem Th28: :: ALGSEQ_1:28
for R being non empty ZeroStr
for p, q being AlgSequence of R st len p = len q & ( for k being Element of NAT st k < len p holds
p . k = q . k ) holds
p = q
proof end;

theorem Th29: :: ALGSEQ_1:29
for R being non empty ZeroStr st the carrier of R <> {(0. R)} holds
for k being Element of NAT ex p being AlgSequence of R st len p = k
proof end;

definition
let R be non empty ZeroStr ;
let x be Element of R;
func <%c2%> -> AlgSequence of a1 means :Def6: :: ALGSEQ_1:def 6
( len it <= 1 & it . 0 = x );
existence
ex b1 being AlgSequence of R st
( len b1 <= 1 & b1 . 0 = x )
proof end;
uniqueness
for b1, b2 being AlgSequence of R st len b1 <= 1 & b1 . 0 = x & len b2 <= 1 & b2 . 0 = x holds
b1 = b2
proof end;
end;

:: deftheorem Def6 defines <% ALGSEQ_1:def 6 :
for R being non empty ZeroStr
for x being Element of R
for b3 being AlgSequence of R holds
( b3 = <%x%> iff ( len b3 <= 1 & b3 . 0 = x ) );

Lemma58: for R being non empty ZeroStr
for p being AlgSequence of R st p = <%(0. R)%> holds
len p = 0
proof end;

theorem Th30: :: ALGSEQ_1:30
canceled;

theorem Th31: :: ALGSEQ_1:31
for R being non empty ZeroStr
for p being AlgSequence of R holds
( p = <%(0. R)%> iff len p = 0 )
proof end;

theorem Th32: :: ALGSEQ_1:32
for R being non empty ZeroStr
for p being AlgSequence of R holds
( p = <%(0. R)%> iff support p = {} )
proof end;

theorem Th33: :: ALGSEQ_1:33
for i being Element of NAT
for R being non empty ZeroStr holds <%(0. R)%> . i = 0. R
proof end;

theorem Th34: :: ALGSEQ_1:34
for R being non empty ZeroStr
for p being AlgSequence of R holds
( p = <%(0. R)%> iff rng p = {(0. R)} )
proof end;