:: FINSEQ_5 semantic presentation

theorem Th1: :: FINSEQ_5:1
for b1, b2 being Nat st b1 <= b2 holds
(b2 - b1) + 1 is Nat
proof end;

theorem Th2: :: FINSEQ_5:2
for b1, b2 being Nat st b1 in Seg b2 holds
(b2 - b1) + 1 in Seg b2
proof end;

theorem Th3: :: FINSEQ_5:3
for b1 being Function
for b2, b3 being set st b1 " {b3} = {b2} holds
( b2 in dom b1 & b3 in rng b1 & b1 . b2 = b3 )
proof end;

theorem Th4: :: FINSEQ_5:4
for b1 being Function holds
( b1 is one-to-one iff for b2 being set st b2 in dom b1 holds
b1 " {(b1 . b2)} = {b2} )
proof end;

theorem Th5: :: FINSEQ_5:5
for b1 being Function
for b2, b3 being set st b1 is one-to-one & b2 in rng b1 & b3 in rng b1 & b1 " {b2} = b1 " {b3} holds
b2 = b3
proof end;

registration
cluster empty -> trivial set ;
coherence
for b1 being set st b1 is empty holds
b1 is trivial
by REALSET1:def 4;
end;

registration
let c1 be set ;
cluster <*a1*> -> trivial ;
coherence
<*c1*> is trivial
proof end;
let c2 be set ;
cluster <*a1,a2*> -> non trivial ;
coherence
not <*c1,c2*> is trivial
proof end;
end;

registration
cluster non empty one-to-one set ;
existence
ex b1 being FinSequence st
( b1 is one-to-one & not b1 is empty )
proof end;
end;

theorem Th6: :: FINSEQ_5:6
for b1 being non empty FinSequence holds
( 1 in dom b1 & len b1 in dom b1 )
proof end;

theorem Th7: :: FINSEQ_5:7
for b1 being non empty FinSequence ex b2 being Nat st b2 + 1 = len b1
proof end;

theorem Th8: :: FINSEQ_5:8
for b1 being set
for b2 being FinSequence holds len (<*b1*> ^ b2) = 1 + (len b2)
proof end;

scheme :: FINSEQ_5:sch 1
s1{ F1() -> Nat, F2( set ) -> set } :
ex b1 being FinSequence st
( len b1 = F1() & ( for b2 being Nat st b2 in dom b1 holds
b1 . b2 = F2(b2) ) )
proof end;

theorem Th9: :: FINSEQ_5:9
canceled;

theorem Th10: :: FINSEQ_5:10
for b1 being FinSequence
for b2, b3 being set st b2 in rng b1 & b3 in rng b1 & b2 .. b1 = b3 .. b1 holds
b2 = b3
proof end;

theorem Th11: :: FINSEQ_5:11
for b1 being Nat
for b2, b3 being FinSequence st b1 + 1 in dom b2 & b3 = b2 | (Seg b1) holds
b2 | (Seg (b1 + 1)) = b3 ^ <*(b2 . (b1 + 1))*>
proof end;

theorem Th12: :: FINSEQ_5:12
for b1 being Nat
for b2 being one-to-one FinSequence st b1 in dom b2 holds
(b2 . b1) .. b2 = b1
proof end;

registration
let c1 be non empty set ;
cluster non empty one-to-one FinSequence of a1;
existence
ex b1 being FinSequence of c1 st
( b1 is one-to-one & not b1 is empty )
proof end;
end;

theorem Th13: :: FINSEQ_5:13
for b1 being non empty set
for b2, b3 being FinSequence of b1 st dom b2 = dom b3 & ( for b4 being Nat st b4 in dom b2 holds
b2 /. b4 = b3 /. b4 ) holds
b2 = b3
proof end;

theorem Th14: :: FINSEQ_5:14
for b1 being non empty set
for b2, b3 being FinSequence of b1 st len b2 = len b3 & ( for b4 being Nat st 1 <= b4 & b4 <= len b2 holds
b2 /. b4 = b3 /. b4 ) holds
b2 = b3
proof end;

theorem Th15: :: FINSEQ_5:15
for b1 being non empty set
for b2 being FinSequence of b1 st len b2 = 1 holds
b2 = <*(b2 /. 1)*>
proof end;

theorem Th16: :: FINSEQ_5:16
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1 holds (<*b2*> ^ b3) /. 1 = b2
proof end;

Lemma11: for b1 being Nat
for b2 being non empty set
for b3, b4 being FinSequence of b2 st b1 in dom b3 holds
(b3 ^ b4) /. b1 = b3 /. b1
proof end;

theorem Th17: :: FINSEQ_5:17
canceled;

theorem Th18: :: FINSEQ_5:18
for b1 being Nat
for b2 being set
for b3 being FinSequence of b2 holds len (b3 | b1) <= len b3
proof end;

theorem Th19: :: FINSEQ_5:19
for b1 being Nat
for b2 being set
for b3 being FinSequence of b2 holds len (b3 | b1) <= b1
proof end;

theorem Th20: :: FINSEQ_5:20
for b1 being Nat
for b2 being set
for b3 being FinSequence of b2 holds dom (b3 | b1) c= dom b3
proof end;

theorem Th21: :: FINSEQ_5:21
for b1 being Nat
for b2 being non empty set
for b3 being FinSequence of b2 holds rng (b3 | b1) c= rng b3
proof end;

theorem Th22: :: FINSEQ_5:22
canceled;

theorem Th23: :: FINSEQ_5:23
for b1 being set
for b2 being FinSequence of b1 st not b2 is empty holds
b2 | 1 = <*(b2 /. 1)*>
proof end;

theorem Th24: :: FINSEQ_5:24
for b1 being Nat
for b2 being non empty set
for b3 being FinSequence of b2 st b1 + 1 = len b3 holds
b3 = (b3 | b1) ^ <*(b3 /. (len b3))*>
proof end;

Lemma17: for b1 being Nat
for b2 being non empty set
for b3 being FinSequence of b2 st b3 is one-to-one holds
b3 | b1 is one-to-one
proof end;

registration
let c1 be Nat;
let c2 be non empty set ;
let c3 be one-to-one FinSequence of c2;
cluster a3 | a1 -> one-to-one ;
coherence
c3 | c1 is one-to-one
by Lemma17;
end;

theorem Th25: :: FINSEQ_5:25
for b1 being Nat
for b2 being set
for b3, b4 being FinSequence of b2 st b1 <= len b3 holds
(b3 ^ b4) | b1 = b3 | b1
proof end;

theorem Th26: :: FINSEQ_5:26
for b1 being set
for b2, b3 being FinSequence of b1 holds (b2 ^ b3) | (len b2) = b2
proof end;

theorem Th27: :: FINSEQ_5:27
for b1 being non empty set
for b2 being Element of b1
for b3 being set
for b4 being FinSequence of b3 st b2 in rng b4 holds
(b4 -| b2) ^ <*b2*> = b4 | (b2 .. b4)
proof end;

theorem Th28: :: FINSEQ_5:28
for b1 being Nat
for b2 being non empty set
for b3 being FinSequence of b2 holds len (b3 /^ b1) <= len b3
proof end;

theorem Th29: :: FINSEQ_5:29
for b1, b2 being Nat
for b3 being non empty set
for b4 being FinSequence of b3 st b1 in dom (b4 /^ b2) holds
b2 + b1 in dom b4
proof end;

theorem Th30: :: FINSEQ_5:30
for b1, b2 being Nat
for b3 being non empty set
for b4 being FinSequence of b3 st b1 in dom (b4 /^ b2) holds
(b4 /^ b2) /. b1 = b4 /. (b2 + b1)
proof end;

theorem Th31: :: FINSEQ_5:31
for b1 being non empty set
for b2 being FinSequence of b1 holds b2 /^ 0 = b2
proof end;

theorem Th32: :: FINSEQ_5:32
for b1 being non empty set
for b2 being FinSequence of b1 st not b2 is empty holds
b2 = <*(b2 /. 1)*> ^ (b2 /^ 1)
proof end;

theorem Th33: :: FINSEQ_5:33
for b1 being Nat
for b2 being non empty set
for b3 being FinSequence of b2 st b1 + 1 = len b3 holds
b3 /^ b1 = <*(b3 /. (len b3))*>
proof end;

theorem Th34: :: FINSEQ_5:34
for b1, b2 being Nat
for b3 being non empty set
for b4 being FinSequence of b3 st b1 + 1 = b2 & b2 in dom b4 holds
<*(b4 /. b2)*> ^ (b4 /^ b2) = b4 /^ b1
proof end;

theorem Th35: :: FINSEQ_5:35
for b1 being Nat
for b2 being set
for b3 being FinSequence of b2 st len b3 <= b1 holds
b3 /^ b1 is empty
proof end;

theorem Th36: :: FINSEQ_5:36
for b1 being Nat
for b2 being non empty set
for b3 being FinSequence of b2 holds rng (b3 /^ b1) c= rng b3
proof end;

Lemma25: for b1 being Nat
for b2 being non empty set
for b3 being FinSequence of b2 st b3 is one-to-one holds
b3 /^ b1 is one-to-one
proof end;

registration
let c1 be Nat;
let c2 be non empty set ;
let c3 be one-to-one FinSequence of c2;
cluster a3 /^ a1 -> one-to-one ;
coherence
c3 /^ c1 is one-to-one
by Lemma25;
end;

theorem Th37: :: FINSEQ_5:37
for b1 being Nat
for b2 being non empty set
for b3 being FinSequence of b2 st b3 is one-to-one holds
rng (b3 | b1) misses rng (b3 /^ b1)
proof end;

theorem Th38: :: FINSEQ_5:38
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1 st b2 in rng b3 holds
b3 |-- b2 = b3 /^ (b2 .. b3)
proof end;

theorem Th39: :: FINSEQ_5:39
for b1 being Nat
for b2 being non empty set
for b3, b4 being FinSequence of b2 holds (b3 ^ b4) /^ ((len b3) + b1) = b4 /^ b1
proof end;

theorem Th40: :: FINSEQ_5:40
for b1 being non empty set
for b2, b3 being FinSequence of b1 holds (b2 ^ b3) /^ (len b2) = b3
proof end;

theorem Th41: :: FINSEQ_5:41
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1 st b2 in rng b3 holds
b3 /. (b2 .. b3) = b2
proof end;

theorem Th42: :: FINSEQ_5:42
for b1 being Nat
for b2 being non empty set
for b3 being FinSequence of b2 st b1 in dom b3 holds
(b3 /. b1) .. b3 <= b1
proof end;

theorem Th43: :: FINSEQ_5:43
for b1 being Nat
for b2 being non empty set
for b3 being Element of b2
for b4 being FinSequence of b2 st b3 in rng (b4 | b1) holds
b3 .. (b4 | b1) = b3 .. b4
proof end;

theorem Th44: :: FINSEQ_5:44
for b1 being Nat
for b2 being non empty set
for b3 being FinSequence of b2 st b1 in dom b3 & b3 is one-to-one holds
(b3 /. b1) .. b3 = b1
proof end;

definition
let c1 be non empty set ;
let c2 be FinSequence of c1;
let c3 be set ;
func c2 -: c3 -> FinSequence of a1 equals :: FINSEQ_5:def 1
a2 | (a3 .. a2);
correctness
coherence
c2 | (c3 .. c2) is FinSequence of c1
;
;
end;

:: deftheorem Def1 defines -: FINSEQ_5:def 1 :
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being set holds b2 -: b3 = b2 | (b3 .. b2);

theorem Th45: :: FINSEQ_5:45
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1 st b2 in rng b3 holds
len (b3 -: b2) = b2 .. b3
proof end;

theorem Th46: :: FINSEQ_5:46
for b1 being Nat
for b2 being non empty set
for b3 being Element of b2
for b4 being FinSequence of b2 st b3 in rng b4 & b1 in Seg (b3 .. b4) holds
(b4 -: b3) /. b1 = b4 /. b1
proof end;

theorem Th47: :: FINSEQ_5:47
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1 st b2 in rng b3 holds
(b3 -: b2) /. 1 = b3 /. 1
proof end;

theorem Th48: :: FINSEQ_5:48
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1 st b2 in rng b3 holds
(b3 -: b2) /. (b2 .. b3) = b2
proof end;

theorem Th49: :: FINSEQ_5:49
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1
for b4 being set st b4 in rng b3 & b2 in rng b3 & b4 .. b3 <= b2 .. b3 holds
b4 in rng (b3 -: b2)
proof end;

theorem Th50: :: FINSEQ_5:50
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1 st b2 in rng b3 holds
not b3 -: b2 is empty
proof end;

theorem Th51: :: FINSEQ_5:51
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1 holds rng (b3 -: b2) c= rng b3 by Th21;

registration
let c1 be non empty set ;
let c2 be Element of c1;
let c3 be one-to-one FinSequence of c1;
cluster a3 -: a2 -> one-to-one ;
coherence
c3 -: c2 is one-to-one
;
end;

definition
let c1 be non empty set ;
let c2 be FinSequence of c1;
let c3 be Element of c1;
func c2 :- c3 -> FinSequence of a1 equals :: FINSEQ_5:def 2
<*a3*> ^ (a2 /^ (a3 .. a2));
correctness
coherence
<*c3*> ^ (c2 /^ (c3 .. c2)) is FinSequence of c1
;
;
end;

:: deftheorem Def2 defines :- FINSEQ_5:def 2 :
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Element of b1 holds b2 :- b3 = <*b3*> ^ (b2 /^ (b3 .. b2));

theorem Th52: :: FINSEQ_5:52
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1 st b2 in rng b3 holds
ex b4 being Nat st
( b4 + 1 = b2 .. b3 & b3 :- b2 = b3 /^ b4 )
proof end;

theorem Th53: :: FINSEQ_5:53
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1 st b2 in rng b3 holds
len (b3 :- b2) = ((len b3) - (b2 .. b3)) + 1
proof end;

theorem Th54: :: FINSEQ_5:54
for b1 being Nat
for b2 being non empty set
for b3 being Element of b2
for b4 being FinSequence of b2 st b3 in rng b4 & b1 + 1 in dom (b4 :- b3) holds
b1 + (b3 .. b4) in dom b4
proof end;

registration
let c1 be non empty set ;
let c2 be Element of c1;
let c3 be FinSequence of c1;
cluster a3 :- a2 -> non empty ;
coherence
not c3 :- c2 is empty
;
end;

theorem Th55: :: FINSEQ_5:55
for b1 being Nat
for b2 being non empty set
for b3 being Element of b2
for b4 being FinSequence of b2 st b3 in rng b4 & b1 + 1 in dom (b4 :- b3) holds
(b4 :- b3) /. (b1 + 1) = b4 /. (b1 + (b3 .. b4))
proof end;

theorem Th56: :: FINSEQ_5:56
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1 holds (b3 :- b2) /. 1 = b2 by Th16;

theorem Th57: :: FINSEQ_5:57
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1 st b2 in rng b3 holds
(b3 :- b2) /. (len (b3 :- b2)) = b3 /. (len b3)
proof end;

theorem Th58: :: FINSEQ_5:58
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1 st b2 in rng b3 holds
rng (b3 :- b2) c= rng b3
proof end;

theorem Th59: :: FINSEQ_5:59
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1 st b2 in rng b3 & b3 is one-to-one holds
b3 :- b2 is one-to-one
proof end;

definition
let c1 be FinSequence;
func Rev c1 -> FinSequence means :Def3: :: FINSEQ_5:def 3
( len a2 = len a1 & ( for b1 being Nat st b1 in dom a2 holds
a2 . b1 = a1 . (((len a1) - b1) + 1) ) );
existence
ex b1 being FinSequence st
( len b1 = len c1 & ( for b2 being Nat st b2 in dom b1 holds
b1 . b2 = c1 . (((len c1) - b2) + 1) ) )
proof end;
uniqueness
for b1, b2 being FinSequence st len b1 = len c1 & ( for b3 being Nat st b3 in dom b1 holds
b1 . b3 = c1 . (((len c1) - b3) + 1) ) & len b2 = len c1 & ( for b3 being Nat st b3 in dom b2 holds
b2 . b3 = c1 . (((len c1) - b3) + 1) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def3 defines Rev FINSEQ_5:def 3 :
for b1, b2 being FinSequence holds
( b2 = Rev b1 iff ( len b2 = len b1 & ( for b3 being Nat st b3 in dom b2 holds
b2 . b3 = b1 . (((len b1) - b3) + 1) ) ) );

theorem Th60: :: FINSEQ_5:60
for b1 being FinSequence holds
( dom b1 = dom (Rev b1) & rng b1 = rng (Rev b1) )
proof end;

theorem Th61: :: FINSEQ_5:61
for b1 being Nat
for b2 being FinSequence st b1 in dom b2 holds
(Rev b2) . b1 = b2 . (((len b2) - b1) + 1)
proof end;

theorem Th62: :: FINSEQ_5:62
for b1 being FinSequence
for b2, b3 being Nat st b2 in dom b1 & b2 + b3 = (len b1) + 1 holds
b3 in dom (Rev b1)
proof end;

registration
let c1 be empty FinSequence;
cluster Rev a1 -> empty trivial ;
coherence
Rev c1 is empty
proof end;
end;

theorem Th63: :: FINSEQ_5:63
for b1 being set holds Rev <*b1*> = <*b1*>
proof end;

theorem Th64: :: FINSEQ_5:64
for b1, b2 being set holds Rev <*b1,b2*> = <*b2,b1*>
proof end;

theorem Th65: :: FINSEQ_5:65
for b1 being FinSequence holds
( b1 . 1 = (Rev b1) . (len b1) & b1 . (len b1) = (Rev b1) . 1 )
proof end;

registration
let c1 be one-to-one FinSequence;
cluster Rev a1 -> one-to-one ;
coherence
Rev c1 is one-to-one
proof end;
end;

theorem Th66: :: FINSEQ_5:66
for b1 being FinSequence
for b2 being set holds Rev (b1 ^ <*b2*>) = <*b2*> ^ (Rev b1)
proof end;

theorem Th67: :: FINSEQ_5:67
for b1, b2 being FinSequence holds Rev (b1 ^ b2) = (Rev b2) ^ (Rev b1)
proof end;

definition
let c1 be non empty set ;
let c2 be FinSequence of c1;
redefine func Rev as Rev c2 -> FinSequence of a1;
coherence
Rev c2 is FinSequence of c1
proof end;
end;

theorem Th68: :: FINSEQ_5:68
for b1 being non empty set
for b2 being FinSequence of b1 st not b2 is empty holds
( b2 /. 1 = (Rev b2) /. (len b2) & b2 /. (len b2) = (Rev b2) /. 1 )
proof end;

theorem Th69: :: FINSEQ_5:69
for b1, b2 being Nat
for b3 being non empty set
for b4 being FinSequence of b3 st b1 in dom b4 & b1 + b2 = (len b4) + 1 holds
b4 /. b1 = (Rev b4) /. b2
proof end;

definition
let c1 be non empty set ;
let c2 be FinSequence of c1;
let c3 be Element of c1;
let c4 be Nat;
func Ins c2,c4,c3 -> FinSequence of a1 equals :: FINSEQ_5:def 4
((a2 | a4) ^ <*a3*>) ^ (a2 /^ a4);
correctness
coherence
((c2 | c4) ^ <*c3*>) ^ (c2 /^ c4) is FinSequence of c1
;
;
end;

:: deftheorem Def4 defines Ins FINSEQ_5:def 4 :
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Element of b1
for b4 being Nat holds Ins b2,b4,b3 = ((b2 | b4) ^ <*b3*>) ^ (b2 /^ b4);

theorem Th70: :: FINSEQ_5:70
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1 holds Ins b3,0,b2 = <*b2*> ^ b3
proof end;

theorem Th71: :: FINSEQ_5:71
for b1 being Nat
for b2 being non empty set
for b3 being Element of b2
for b4 being FinSequence of b2 st len b4 <= b1 holds
Ins b4,b1,b3 = b4 ^ <*b3*>
proof end;

theorem Th72: :: FINSEQ_5:72
for b1 being Nat
for b2 being non empty set
for b3 being Element of b2
for b4 being FinSequence of b2 holds len (Ins b4,b1,b3) = (len b4) + 1
proof end;

theorem Th73: :: FINSEQ_5:73
for b1 being Nat
for b2 being non empty set
for b3 being Element of b2
for b4 being FinSequence of b2 holds rng (Ins b4,b1,b3) = {b3} \/ (rng b4)
proof end;

registration
let c1 be non empty set ;
let c2 be FinSequence of c1;
let c3 be Nat;
let c4 be Element of c1;
cluster Ins a2,a3,a4 -> non empty ;
coherence
not Ins c2,c3,c4 is empty
;
end;

theorem Th74: :: FINSEQ_5:74
for b1 being Nat
for b2 being non empty set
for b3 being Element of b2
for b4 being FinSequence of b2 holds b3 in rng (Ins b4,b1,b3)
proof end;

theorem Th75: :: FINSEQ_5:75
for b1, b2 being Nat
for b3 being non empty set
for b4 being Element of b3
for b5 being FinSequence of b3 st b1 in dom (b5 | b2) holds
(Ins b5,b2,b4) /. b1 = b5 /. b1
proof end;

theorem Th76: :: FINSEQ_5:76
for b1 being Nat
for b2 being non empty set
for b3 being Element of b2
for b4 being FinSequence of b2 st b1 <= len b4 holds
(Ins b4,b1,b3) /. (b1 + 1) = b3
proof end;

theorem Th77: :: FINSEQ_5:77
for b1, b2 being Nat
for b3 being non empty set
for b4 being Element of b3
for b5 being FinSequence of b3 st b1 + 1 <= b2 & b2 <= len b5 holds
(Ins b5,b1,b4) /. (b2 + 1) = b5 /. b2
proof end;

theorem Th78: :: FINSEQ_5:78
for b1 being Nat
for b2 being non empty set
for b3 being Element of b2
for b4 being FinSequence of b2 st 1 <= b1 & not b4 is empty holds
(Ins b4,b1,b3) /. 1 = b4 /. 1
proof end;

theorem Th79: :: FINSEQ_5:79
for b1 being Nat
for b2 being non empty set
for b3 being Element of b2
for b4 being FinSequence of b2 st b4 is one-to-one & not b3 in rng b4 holds
Ins b4,b1,b3 is one-to-one
proof end;

theorem Th80: :: FINSEQ_5:80
for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4 being Nat st b3 <= b4 holds
( (b2 | b3) | b4 = b2 | b3 & (b2 | b4) | b3 = b2 | b3 )
proof end;

theorem Th81: :: FINSEQ_5:81
for b1 being Nat
for b2 being non empty set holds (<*> b2) | b1 = <*> b2
proof end;

theorem Th82: :: FINSEQ_5:82
for b1 being non empty set holds Rev (<*> b1) = <*> b1
proof end;