:: AFINSQ_1 semantic presentation

theorem Th1: :: AFINSQ_1:1
for b1 being Nat holds b1 in b1 + 1
proof end;

theorem Th2: :: AFINSQ_1:2
for b1, b2 being Nat st b1 <= b2 holds
b1 = b1 /\ b2
proof end;

theorem Th3: :: AFINSQ_1:3
for b1, b2 being Nat st b1 = b1 /\ b2 holds
b1 <= b2 by Th2;

theorem Th4: :: AFINSQ_1:4
for b1 being Nat holds b1 \/ {b1} = b1 + 1
proof end;

theorem Th5: :: AFINSQ_1:5
for b1 being Nat holds Seg b1 c= b1 + 1
proof end;

theorem Th6: :: AFINSQ_1:6
for b1 being Nat holds b1 + 1 = {0} \/ (Seg b1)
proof end;

theorem Th7: :: AFINSQ_1:7
for b1 being Function holds
( ( b1 is finite & b1 is T-Sequence-like ) iff ex b2 being Nat st dom b1 = b2 )
proof end;

registration
cluster T-Sequence-like finite set ;
existence
ex b1 being Function st
( b1 is finite & b1 is T-Sequence-like )
proof end;
end;

definition
mode XFinSequence is finite T-Sequence;
end;

registration
cluster natural -> finite set ;
coherence
for b1 being set st b1 is natural holds
b1 is finite
proof end;
let c1 be XFinSequence;
cluster dom a1 -> natural ;
coherence
dom c1 is natural
proof end;
end;

notation
let c1 be XFinSequence;
synonym len c1 for Card c1;
end;

definition
let c1 be XFinSequence;
redefine func len as len c1 -> Nat means :Def1: :: AFINSQ_1:def 1
a2 = dom a1;
coherence
len c1 is Nat
proof end;
compatibility
for b1 being Nat holds
( b1 = len c1 iff b1 = dom c1 )
proof end;
end;

:: deftheorem Def1 defines len AFINSQ_1:def 1 :
for b1 being XFinSequence
for b2 being Nat holds
( b2 = len b1 iff b2 = dom b1 );

definition
let c1 be XFinSequence;
redefine func dom as dom c1 -> Subset of NAT ;
coherence
dom c1 is Subset of NAT
proof end;
end;

theorem Th8: :: AFINSQ_1:8
for b1 being Function st ex b2 being Nat st dom b1 c= b2 holds
ex b2 being XFinSequence st b1 c= b2
proof end;

scheme :: AFINSQ_1:sch 1
s1{ F1() -> Nat, P1[ set , set ] } :
ex b1 being XFinSequence st
( dom b1 = F1() & ( for b2 being Nat st b2 in F1() holds
P1[b2,b1 . b2] ) )
provided
E7: for b1 being Nat
for b2, b3 being set st b1 in F1() & P1[b1,b2] & P1[b1,b3] holds
b2 = b3 and
E8: for b1 being Nat st b1 in F1() holds
ex b2 being set st P1[b1,b2]
proof end;

scheme :: AFINSQ_1:sch 2
s2{ F1() -> Nat, F2( set ) -> set } :
ex b1 being XFinSequence st
( len b1 = F1() & ( for b2 being Nat st b2 in F1() holds
b1 . b2 = F2(b2) ) )
proof end;

theorem Th9: :: AFINSQ_1:9
for b1 being set
for b2 being XFinSequence st b1 in b2 holds
ex b3 being Nat st
( b3 in dom b2 & b1 = [b3,(b2 . b3)] )
proof end;

theorem Th10: :: AFINSQ_1:10
for b1, b2 being XFinSequence st dom b1 = dom b2 & ( for b3 being Nat st b3 in dom b1 holds
b1 . b3 = b2 . b3 ) holds
b1 = b2
proof end;

theorem Th11: :: AFINSQ_1:11
for b1, b2 being XFinSequence st len b1 = len b2 & ( for b3 being Nat st b3 < len b1 holds
b1 . b3 = b2 . b3 ) holds
b1 = b2
proof end;

theorem Th12: :: AFINSQ_1:12
for b1 being Nat
for b2 being XFinSequence holds b2 | b1 is XFinSequence
proof end;

theorem Th13: :: AFINSQ_1:13
for b1 being Function
for b2 being XFinSequence st rng b2 c= dom b1 holds
b1 * b2 is XFinSequence
proof end;

theorem Th14: :: AFINSQ_1:14
for b1 being Nat
for b2, b3 being XFinSequence st b1 < len b2 & b3 = b2 | b1 holds
( len b3 = b1 & dom b3 = b1 )
proof end;

registration
let c1 be set ;
cluster finite T-Sequence of a1;
existence
ex b1 being T-Sequence of c1 st b1 is finite
proof end;
end;

definition
let c1 be set ;
mode XFinSequence of a1 is finite T-Sequence of a1;
end;

theorem Th15: :: AFINSQ_1:15
for b1 being set
for b2 being XFinSequence of b1 holds b2 is PartFunc of NAT ,b1
proof end;

registration
cluster {} -> T-Sequence-like ;
coherence
{} is T-Sequence-like
by ORDINAL1:45;
end;

registration
let c1 be set ;
cluster T-Sequence-like finite M5( NAT ,a1);
existence
ex b1 being PartFunc of NAT ,c1 st
( b1 is finite & b1 is T-Sequence-like )
proof end;
end;

theorem Th16: :: AFINSQ_1:16
for b1 being Nat
for b2 being set
for b3 being XFinSequence of b2 holds b3 | b1 is XFinSequence of b2
proof end;

theorem Th17: :: AFINSQ_1:17
for b1 being Nat
for b2 being non empty set ex b3 being XFinSequence of b2 st len b3 = b1
proof end;

registration
cluster empty set ;
existence
ex b1 being XFinSequence st b1 is empty
by ORDINAL1:45;
end;

theorem Th18: :: AFINSQ_1:18
for b1 being XFinSequence holds
( len b1 = 0 iff b1 = {} )
proof end;

theorem Th19: :: AFINSQ_1:19
for b1 being set holds {} is XFinSequence of b1
proof end;

registration
let c1 be set ;
cluster empty T-Sequence of a1;
existence
ex b1 being XFinSequence of c1 st b1 is empty
proof end;
end;

definition
let c1 be set ;
func <%c1%> -> set equals :: AFINSQ_1:def 2
{[0,a1]};
coherence
{[0,c1]} is set
;
end;

:: deftheorem Def2 defines <% AFINSQ_1:def 2 :
for b1 being set holds <%b1%> = {[0,b1]};

definition
let c1 be set ;
func <%> c1 -> empty XFinSequence of a1 equals :: AFINSQ_1:def 3
{} ;
coherence
{} is empty XFinSequence of c1
by Th19;
end;

:: deftheorem Def3 defines <%> AFINSQ_1:def 3 :
for b1 being set holds <%> b1 = {} ;

definition
let c1, c2 be XFinSequence;
redefine func c1 ^ c2 -> set means :Def4: :: AFINSQ_1:def 4
( dom a3 = (len a1) + (len a2) & ( for b1 being Nat st b1 in dom a1 holds
a3 . b1 = a1 . b1 ) & ( for b1 being Nat st b1 in dom a2 holds
a3 . ((len a1) + b1) = a2 . b1 ) );
compatibility
for b1 being set holds
( b1 = c1 ^ c2 iff ( dom b1 = (len c1) + (len c2) & ( for b2 being Nat st b2 in dom c1 holds
b1 . b2 = c1 . b2 ) & ( for b2 being Nat st b2 in dom c2 holds
b1 . ((len c1) + b2) = c2 . b2 ) ) )
proof end;
end;

:: deftheorem Def4 defines ^ AFINSQ_1:def 4 :
for b1, b2 being XFinSequence
for b3 being set holds
( b3 = b1 ^ b2 iff ( dom b3 = (len b1) + (len b2) & ( for b4 being Nat st b4 in dom b1 holds
b3 . b4 = b1 . b4 ) & ( for b4 being Nat st b4 in dom b2 holds
b3 . ((len b1) + b4) = b2 . b4 ) ) );

registration
let c1, c2 be XFinSequence;
cluster a1 ^ a2 -> finite ;
coherence
c1 ^ c2 is finite
proof end;
end;

theorem Th20: :: AFINSQ_1:20
for b1, b2 being XFinSequence holds len (b1 ^ b2) = (len b1) + (len b2)
proof end;

theorem Th21: :: AFINSQ_1:21
for b1 being Nat
for b2, b3 being XFinSequence st len b2 <= b1 & b1 < (len b2) + (len b3) holds
(b2 ^ b3) . b1 = b3 . (b1 - (len b2))
proof end;

theorem Th22: :: AFINSQ_1:22
for b1 being Nat
for b2, b3 being XFinSequence st len b2 <= b1 & b1 < len (b2 ^ b3) holds
(b2 ^ b3) . b1 = b3 . (b1 - (len b2))
proof end;

theorem Th23: :: AFINSQ_1:23
for b1 being Nat
for b2, b3 being XFinSequence holds
( not b1 in dom (b2 ^ b3) or b1 in dom b2 or ex b4 being Nat st
( b4 in dom b3 & b1 = (len b2) + b4 ) )
proof end;

theorem Th24: :: AFINSQ_1:24
for b1, b2 being T-Sequence holds dom b1 c= dom (b1 ^ b2)
proof end;

theorem Th25: :: AFINSQ_1:25
for b1 being set
for b2, b3 being XFinSequence st b1 in dom b2 holds
ex b4 being Nat st
( b4 = b1 & (len b3) + b4 in dom (b3 ^ b2) )
proof end;

theorem Th26: :: AFINSQ_1:26
for b1 being Nat
for b2, b3 being XFinSequence st b1 in dom b2 holds
(len b3) + b1 in dom (b3 ^ b2)
proof end;

theorem Th27: :: AFINSQ_1:27
for b1, b2 being XFinSequence holds rng b1 c= rng (b1 ^ b2)
proof end;

theorem Th28: :: AFINSQ_1:28
for b1, b2 being XFinSequence holds rng b1 c= rng (b2 ^ b1)
proof end;

theorem Th29: :: AFINSQ_1:29
for b1, b2 being XFinSequence holds rng (b1 ^ b2) = (rng b1) \/ (rng b2)
proof end;

theorem Th30: :: AFINSQ_1:30
for b1, b2, b3 being XFinSequence holds (b1 ^ b2) ^ b3 = b1 ^ (b2 ^ b3)
proof end;

theorem Th31: :: AFINSQ_1:31
for b1, b2, b3 being XFinSequence st ( b1 ^ b2 = b3 ^ b2 or b2 ^ b1 = b2 ^ b3 ) holds
b1 = b3
proof end;

theorem Th32: :: AFINSQ_1:32
for b1 being XFinSequence holds
( b1 ^ {} = b1 & {} ^ b1 = b1 )
proof end;

theorem Th33: :: AFINSQ_1:33
for b1, b2 being XFinSequence st b1 ^ b2 = {} holds
( b1 = {} & b2 = {} )
proof end;

definition
let c1 be set ;
let c2, c3 be XFinSequence of c1;
redefine func ^ as c2 ^ c3 -> T-Sequence of a1;
coherence
c2 ^ c3 is T-Sequence of c1
proof end;
end;

Lemma24: for b1, b2, b3, b4 being set st [b1,b2] in {[b3,b4]} holds
( b1 = b3 & b2 = b4 )
proof end;

definition
let c1 be set ;
redefine func <% as <%c1%> -> Function means :Def5: :: AFINSQ_1:def 5
( dom a2 = 1 & a2 . 0 = a1 );
coherence
<%c1%> is Function
by GRFUNC_1:15;
compatibility
for b1 being Function holds
( b1 = <%c1%> iff ( dom b1 = 1 & b1 . 0 = c1 ) )
proof end;
end;

:: deftheorem Def5 defines <% AFINSQ_1:def 5 :
for b1 being set
for b2 being Function holds
( b2 = <%b1%> iff ( dom b2 = 1 & b2 . 0 = b1 ) );

registration
let c1 be set ;
cluster <%a1%> -> Relation-like Function-like ;
coherence
( <%c1%> is Function-like & <%c1%> is Relation-like )
;
end;

registration
let c1 be set ;
cluster <%a1%> -> Relation-like Function-like T-Sequence-like finite ;
coherence
( <%c1%> is finite & <%c1%> is T-Sequence-like )
proof end;
end;

theorem Th34: :: AFINSQ_1:34
for b1, b2 being XFinSequence
for b3 being set st b1 ^ b2 is XFinSequence of b3 holds
( b1 is XFinSequence of b3 & b2 is XFinSequence of b3 )
proof end;

definition
let c1, c2 be set ;
func <%c1,c2%> -> set equals :: AFINSQ_1:def 6
<%a1%> ^ <%a2%>;
correctness
coherence
<%c1%> ^ <%c2%> is set
;
;
let c3 be set ;
func <%c1,c2,c3%> -> set equals :: AFINSQ_1:def 7
(<%a1%> ^ <%a2%>) ^ <%a3%>;
correctness
coherence
(<%c1%> ^ <%c2%>) ^ <%c3%> is set
;
;
end;

:: deftheorem Def6 defines <% AFINSQ_1:def 6 :
for b1, b2 being set holds <%b1,b2%> = <%b1%> ^ <%b2%>;

:: deftheorem Def7 defines <% AFINSQ_1:def 7 :
for b1, b2, b3 being set holds <%b1,b2,b3%> = (<%b1%> ^ <%b2%>) ^ <%b3%>;

registration
let c1, c2 be set ;
cluster <%a1,a2%> -> Relation-like Function-like ;
coherence
( <%c1,c2%> is Function-like & <%c1,c2%> is Relation-like )
;
let c3 be set ;
cluster <%a1,a2,a3%> -> Relation-like Function-like ;
coherence
( <%c1,c2,c3%> is Function-like & <%c1,c2,c3%> is Relation-like )
;
end;

registration
let c1, c2 be set ;
cluster <%a1,a2%> -> Relation-like Function-like T-Sequence-like finite ;
coherence
( <%c1,c2%> is finite & <%c1,c2%> is T-Sequence-like )
;
let c3 be set ;
cluster <%a1,a2,a3%> -> Relation-like Function-like T-Sequence-like finite ;
coherence
( <%c1,c2,c3%> is finite & <%c1,c2,c3%> is T-Sequence-like )
;
end;

theorem Th35: :: AFINSQ_1:35
for b1 being set holds <%b1%> = {[0,b1]} ;

theorem Th36: :: AFINSQ_1:36
for b1 being set
for b2 being XFinSequence holds
( b2 = <%b1%> iff ( dom b2 = 1 & rng b2 = {b1} ) )
proof end;

theorem Th37: :: AFINSQ_1:37
for b1 being set
for b2 being XFinSequence holds
( b2 = <%b1%> iff ( len b2 = 1 & rng b2 = {b1} ) )
proof end;

theorem Th38: :: AFINSQ_1:38
for b1 being set
for b2 being XFinSequence holds
( b2 = <%b1%> iff ( len b2 = 1 & b2 . 0 = b1 ) )
proof end;

theorem Th39: :: AFINSQ_1:39
for b1 being set
for b2 being XFinSequence holds (<%b1%> ^ b2) . 0 = b1
proof end;

theorem Th40: :: AFINSQ_1:40
for b1 being set
for b2 being XFinSequence holds (b2 ^ <%b1%>) . (len b2) = b1
proof end;

theorem Th41: :: AFINSQ_1:41
for b1, b2, b3 being set holds
( <%b1,b2,b3%> = <%b1%> ^ <%b2,b3%> & <%b1,b2,b3%> = <%b1,b2%> ^ <%b3%> ) by Th30;

theorem Th42: :: AFINSQ_1:42
for b1, b2 being set
for b3 being XFinSequence holds
( b3 = <%b1,b2%> iff ( len b3 = 2 & b3 . 0 = b1 & b3 . 1 = b2 ) )
proof end;

theorem Th43: :: AFINSQ_1:43
for b1, b2, b3 being set
for b4 being XFinSequence holds
( b4 = <%b1,b2,b3%> iff ( len b4 = 3 & b4 . 0 = b1 & b4 . 1 = b2 & b4 . 2 = b3 ) )
proof end;

theorem Th44: :: AFINSQ_1:44
for b1 being XFinSequence st b1 <> {} holds
ex b2 being XFinSequenceex b3 being set st b1 = b2 ^ <%b3%>
proof end;

definition
let c1 be non empty set ;
let c2 be Element of c1;
redefine func <% as <%c2%> -> XFinSequence of a1;
coherence
<%c2%> is XFinSequence of c1
proof end;
end;

scheme :: AFINSQ_1:sch 3
s3{ P1[ XFinSequence] } :
for b1 being XFinSequence holds P1[b1]
provided
E31: P1[ {} ] and
E32: for b1 being XFinSequence
for b2 being set st P1[b1] holds
P1[b1 ^ <%b2%>]
proof end;

theorem Th45: :: AFINSQ_1:45
for b1, b2, b3, b4 being XFinSequence st b1 ^ b2 = b3 ^ b4 & len b1 <= len b3 holds
ex b5 being XFinSequence st b1 ^ b5 = b3
proof end;

definition
let c1 be set ;
func c1 ^omega -> set means :Def8: :: AFINSQ_1:def 8
for b1 being set holds
( b1 in a2 iff b1 is XFinSequence of a1 );
existence
ex b1 being set st
for b2 being set holds
( b2 in b1 iff b2 is XFinSequence of c1 )
proof end;
uniqueness
for b1, b2 being set st ( for b3 being set holds
( b3 in b1 iff b3 is XFinSequence of c1 ) ) & ( for b3 being set holds
( b3 in b2 iff b3 is XFinSequence of c1 ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def8 defines ^omega AFINSQ_1:def 8 :
for b1, b2 being set holds
( b2 = b1 ^omega iff for b3 being set holds
( b3 in b2 iff b3 is XFinSequence of b1 ) );

registration
let c1 be set ;
cluster a1 ^omega -> non empty ;
coherence
not c1 ^omega is empty
proof end;
end;

theorem Th46: :: AFINSQ_1:46
for b1, b2 being set holds
( b1 in b2 ^omega iff b1 is XFinSequence of b2 ) by Def8;

theorem Th47: :: AFINSQ_1:47
for b1 being set holds {} in b1 ^omega
proof end;

scheme :: AFINSQ_1:sch 4
s4{ F1() -> non empty set , P1[ XFinSequence] } :
ex b1 being set st
for b2 being set holds
( b2 in b1 iff ex b3 being XFinSequence st
( b3 in F1() ^omega & P1[b3] & b2 = b3 ) )
proof end;

notation
let c1 be XFinSequence;
let c2, c3 be set ;
synonym Replace c1,c2,c3 for c1 +* c2,c3;
end;

registration
let c1 be XFinSequence;
let c2, c3 be set ;
cluster Replace a1,a2,a3 -> T-Sequence-like finite ;
coherence
( c1 +* c2,c3 is finite & c1 +* c2,c3 is T-Sequence-like )
proof end;
end;

theorem Th48: :: AFINSQ_1:48
for b1 being XFinSequence
for b2 being Nat
for b3 being set holds
( len (Replace b1,b2,b3) = len b1 & ( b2 < len b1 implies (Replace b1,b2,b3) . b2 = b3 ) & ( for b4 being Nat st b4 <> b2 holds
(Replace b1,b2,b3) . b4 = b1 . b4 ) )
proof end;

definition
let c1 be non empty set ;
let c2 be XFinSequence of c1;
let c3 be Nat;
let c4 be Element of c1;
redefine func Replace as Replace c2,c3,c4 -> XFinSequence of a1;
coherence
Replace c2,c3,c4 is XFinSequence of c1
proof end;
end;