:: CALCUL_2 semantic presentation

definition
let c1, c2 be natural number ;
func seq c1,c2 -> set equals :: CALCUL_2:def 1
{ b1 where B is Nat : ( 1 + a1 <= b1 & b1 <= a2 + a1 ) } ;
coherence
{ b1 where B is Nat : ( 1 + c1 <= b1 & b1 <= c2 + c1 ) } is set
;
end;

:: deftheorem Def1 defines seq CALCUL_2:def 1 :
for b1, b2 being natural number holds seq b1,b2 = { b3 where B is Nat : ( 1 + b1 <= b3 & b3 <= b2 + b1 ) } ;

definition
let c1, c2 be natural number ;
redefine func seq as seq c1,c2 -> Subset of NAT ;
coherence
seq c1,c2 is Subset of NAT
proof end;
end;

theorem Th1: :: CALCUL_2:1
for b1, b2, b3 being natural number holds
( b1 in seq b2,b3 iff ( 1 + b2 <= b1 & b1 <= b3 + b2 ) )
proof end;

theorem Th2: :: CALCUL_2:2
for b1 being natural number holds seq b1,0 = {}
proof end;

theorem Th3: :: CALCUL_2:3
for b1, b2 being natural number holds
( b1 = 0 or b1 + b2 in seq b2,b1 )
proof end;

theorem Th4: :: CALCUL_2:4
for b1, b2, b3 being natural number holds
( b1 <= b2 iff seq b3,b1 c= seq b3,b2 )
proof end;

theorem Th5: :: CALCUL_2:5
for b1, b2 being natural number holds (seq b1,b2) \/ {((b1 + b2) + 1)} = seq b1,(b2 + 1)
proof end;

theorem Th6: :: CALCUL_2:6
for b1, b2 being Nat holds seq b1,b2,b2 are_equipotent
proof end;

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

registration
let c1 be FinSequence of CQC-WFF ;
cluster Card a1 -> finite ;
coherence
len c1 is finite
by CARD_1:69;
end;

theorem Th7: :: CALCUL_2:7
for b1, b2 being Nat holds seq b1,b2 c= Seg (b1 + b2)
proof end;

theorem Th8: :: CALCUL_2:8
for b1, b2 being Nat holds Seg b1 misses seq b1,b2
proof end;

theorem Th9: :: CALCUL_2:9
for b1, b2 being FinSequence holds Seg (len (b1 ^ b2)) = (Seg (len b1)) \/ (seq (len b1),(len b2))
proof end;

theorem Th10: :: CALCUL_2:10
for b1, b2 being FinSequence of CQC-WFF holds len (Sgm (seq (len b1),(len b2))) = len b2
proof end;

theorem Th11: :: CALCUL_2:11
for b1, b2 being FinSequence of CQC-WFF holds dom (Sgm (seq (len b1),(len b2))) = dom b2
proof end;

theorem Th12: :: CALCUL_2:12
for b1, b2 being FinSequence of CQC-WFF holds rng (Sgm (seq (len b1),(len b2))) = seq (len b1),(len b2)
proof end;

theorem Th13: :: CALCUL_2:13
for b1 being Nat
for b2, b3 being FinSequence of CQC-WFF st b1 in dom (Sgm (seq (len b2),(len b3))) holds
(Sgm (seq (len b2),(len b3))) . b1 = (len b2) + b1
proof end;

theorem Th14: :: CALCUL_2:14
for b1, b2 being FinSequence of CQC-WFF holds seq (len b1),(len b2) c= dom (b1 ^ b2)
proof end;

theorem Th15: :: CALCUL_2:15
for b1, b2 being FinSequence of CQC-WFF holds dom ((b1 ^ b2) | (seq (len b1),(len b2))) = seq (len b1),(len b2)
proof end;

theorem Th16: :: CALCUL_2:16
for b1, b2 being FinSequence of CQC-WFF holds Seq ((b1 ^ b2) | (seq (len b1),(len b2))) = (Sgm (seq (len b1),(len b2))) * (b1 ^ b2)
proof end;

theorem Th17: :: CALCUL_2:17
for b1, b2 being FinSequence of CQC-WFF holds dom (Seq ((b1 ^ b2) | (seq (len b1),(len b2)))) = dom b2
proof end;

theorem Th18: :: CALCUL_2:18
for b1, b2 being FinSequence of CQC-WFF holds b1 is_Subsequence_of b2 ^ b1
proof end;

definition
let c1 be non empty set ;
let c2 be FinSequence of c1;
let c3 be Permutation of dom c2;
func Per c2,c3 -> FinSequence of a1 equals :: CALCUL_2:def 2
a3 * a2;
coherence
c3 * c2 is FinSequence of c1
proof end;
end;

:: deftheorem Def2 defines Per CALCUL_2:def 2 :
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Permutation of dom b2 holds Per b2,b3 = b3 * b2;

theorem Th19: :: CALCUL_2:19
for b1 being FinSequence of CQC-WFF
for b2 being Permutation of dom b1 holds dom (Per b1,b2) = dom b1
proof end;

theorem Th20: :: CALCUL_2:20
for b1 being Element of CQC-WFF
for b2, b3 being FinSequence of CQC-WFF st |- b2 ^ <*b1*> holds
|- (b3 ^ b2) ^ <*b1*>
proof end;

definition
let c1 be FinSequence of CQC-WFF ;
func Begin c1 -> Element of CQC-WFF means :Def3: :: CALCUL_2:def 3
a2 = a1 . 1 if 1 <= len a1
otherwise a2 = VERUM ;
existence
( ( 1 <= len c1 implies ex b1 being Element of CQC-WFF st b1 = c1 . 1 ) & ( not 1 <= len c1 implies ex b1 being Element of CQC-WFF st b1 = VERUM ) )
proof end;
uniqueness
for b1, b2 being Element of CQC-WFF holds
( ( 1 <= len c1 & b1 = c1 . 1 & b2 = c1 . 1 implies b1 = b2 ) & ( not 1 <= len c1 & b1 = VERUM & b2 = VERUM implies b1 = b2 ) )
;
consistency
for b1 being Element of CQC-WFF holds verum
;
end;

:: deftheorem Def3 defines Begin CALCUL_2:def 3 :
for b1 being FinSequence of CQC-WFF
for b2 being Element of CQC-WFF holds
( ( 1 <= len b1 implies ( b2 = Begin b1 iff b2 = b1 . 1 ) ) & ( not 1 <= len b1 implies ( b2 = Begin b1 iff b2 = VERUM ) ) );

definition
let c1 be FinSequence of CQC-WFF ;
assume E20: 1 <= len c1 ;
func Impl c1 -> Element of CQC-WFF means :Def4: :: CALCUL_2:def 4
ex b1 being FinSequence of CQC-WFF st
( a2 = b1 . (len a1) & len b1 = len a1 & ( b1 . 1 = Begin a1 or len a1 = 0 ) & ( for b2 being Nat st 1 <= b2 & b2 < len a1 holds
ex b3, b4 being Element of CQC-WFF st
( b3 = a1 . (b2 + 1) & b4 = b1 . b2 & b1 . (b2 + 1) = b3 => b4 ) ) );
existence
ex b1 being Element of CQC-WFF ex b2 being FinSequence of CQC-WFF st
( b1 = b2 . (len c1) & len b2 = len c1 & ( b2 . 1 = Begin c1 or len c1 = 0 ) & ( for b3 being Nat st 1 <= b3 & b3 < len c1 holds
ex b4, b5 being Element of CQC-WFF st
( b4 = c1 . (b3 + 1) & b5 = b2 . b3 & b2 . (b3 + 1) = b4 => b5 ) ) )
proof end;
uniqueness
for b1, b2 being Element of CQC-WFF st ex b3 being FinSequence of CQC-WFF st
( b1 = b3 . (len c1) & len b3 = len c1 & ( b3 . 1 = Begin c1 or len c1 = 0 ) & ( for b4 being Nat st 1 <= b4 & b4 < len c1 holds
ex b5, b6 being Element of CQC-WFF st
( b5 = c1 . (b4 + 1) & b6 = b3 . b4 & b3 . (b4 + 1) = b5 => b6 ) ) ) & ex b3 being FinSequence of CQC-WFF st
( b2 = b3 . (len c1) & len b3 = len c1 & ( b3 . 1 = Begin c1 or len c1 = 0 ) & ( for b4 being Nat st 1 <= b4 & b4 < len c1 holds
ex b5, b6 being Element of CQC-WFF st
( b5 = c1 . (b4 + 1) & b6 = b3 . b4 & b3 . (b4 + 1) = b5 => b6 ) ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def4 defines Impl CALCUL_2:def 4 :
for b1 being FinSequence of CQC-WFF st 1 <= len b1 holds
for b2 being Element of CQC-WFF holds
( b2 = Impl b1 iff ex b3 being FinSequence of CQC-WFF st
( b2 = b3 . (len b1) & len b3 = len b1 & ( b3 . 1 = Begin b1 or len b1 = 0 ) & ( for b4 being Nat st 1 <= b4 & b4 < len b1 holds
ex b5, b6 being Element of CQC-WFF st
( b5 = b1 . (b4 + 1) & b6 = b3 . b4 & b3 . (b4 + 1) = b5 => b6 ) ) ) );

theorem Th21: :: CALCUL_2:21
for b1 being Element of CQC-WFF
for b2 being FinSequence of CQC-WFF holds |- (b2 ^ <*b1*>) ^ <*b1*>
proof end;

theorem Th22: :: CALCUL_2:22
for b1, b2 being Element of CQC-WFF
for b3 being FinSequence of CQC-WFF st |- b3 ^ <*(b1 '&' b2)*> holds
|- b3 ^ <*b1*>
proof end;

theorem Th23: :: CALCUL_2:23
for b1, b2 being Element of CQC-WFF
for b3 being FinSequence of CQC-WFF st |- b3 ^ <*(b1 '&' b2)*> holds
|- b3 ^ <*b2*>
proof end;

theorem Th24: :: CALCUL_2:24
for b1, b2 being Element of CQC-WFF
for b3 being FinSequence of CQC-WFF st |- b3 ^ <*b1*> & |- (b3 ^ <*b1*>) ^ <*b2*> holds
|- b3 ^ <*b2*>
proof end;

theorem Th25: :: CALCUL_2:25
for b1, b2 being Element of CQC-WFF
for b3 being FinSequence of CQC-WFF st |- b3 ^ <*b1*> & |- b3 ^ <*('not' b1)*> holds
|- b3 ^ <*b2*>
proof end;

theorem Th26: :: CALCUL_2:26
for b1, b2 being Element of CQC-WFF
for b3 being FinSequence of CQC-WFF st |- (b3 ^ <*b1*>) ^ <*b2*> & |- (b3 ^ <*('not' b1)*>) ^ <*b2*> holds
|- b3 ^ <*b2*>
proof end;

theorem Th27: :: CALCUL_2:27
for b1, b2 being Element of CQC-WFF
for b3 being FinSequence of CQC-WFF st |- (b3 ^ <*b1*>) ^ <*b2*> holds
|- b3 ^ <*(b1 => b2)*>
proof end;

theorem Th28: :: CALCUL_2:28
for b1, b2 being FinSequence of CQC-WFF st 1 <= len b1 & |- b2 ^ b1 holds
|- b2 ^ <*(Impl (Rev b1))*>
proof end;

theorem Th29: :: CALCUL_2:29
for b1 being Element of CQC-WFF
for b2 being FinSequence of CQC-WFF
for b3 being Permutation of dom b2 st |- (Per b2,b3) ^ <*(Impl (Rev (b2 ^ <*b1*>)))*> holds
|- (Per b2,b3) ^ <*b1*>
proof end;

theorem Th30: :: CALCUL_2:30
for b1 being Element of CQC-WFF
for b2 being FinSequence of CQC-WFF
for b3 being Permutation of dom b2 st |- b2 ^ <*b1*> holds
|- (Per b2,b3) ^ <*b1*>
proof end;

notation
let c1 be Nat;
let c2 be set ;
synonym IdFinS c2,c1 for c1 |-> c2;
end;

theorem Th31: :: CALCUL_2:31
for b1 being Nat
for b2 being set st 1 <= b1 holds
rng (IdFinS b2,b1) = rng <*b2*>
proof end;

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

theorem Th32: :: CALCUL_2:32
for b1, b2 being Element of CQC-WFF
for b3 being Nat
for b4 being FinSequence of CQC-WFF st 1 <= b3 & |- (b4 ^ (IdFinS b1,b3)) ^ <*b2*> holds
|- (b4 ^ <*b1*>) ^ <*b2*>
proof end;