:: FINSOP_1 semantic presentation

definition
let c1 be non empty set ;
let c2 be Nat;
let c3 be Element of c1;
redefine func |-> as c2 |-> c3 -> FinSequence of a1;
coherence
c2 |-> c3 is FinSequence of c1
by FINSEQ_2:77;
end;

definition
let c1 be non empty set ;
let c2 be FinSequence of c1;
let c3 be BinOp of c1;
assume E1: ( c3 has_a_unity or len c2 >= 1 ) ;
func c3 "**" c2 -> Element of a1 means :Def1: :: FINSOP_1:def 1
a4 = the_unity_wrt a3 if ( a3 has_a_unity & len a2 = 0 )
otherwise ex b1 being Function of NAT ,a1 st
( b1 . 1 = a2 . 1 & ( for b2 being Nat st 0 <> b2 & b2 < len a2 holds
b1 . (b2 + 1) = a3 . (b1 . b2),(a2 . (b2 + 1)) ) & a4 = b1 . (len a2) );
existence
( ( c3 has_a_unity & len c2 = 0 implies ex b1 being Element of c1 st b1 = the_unity_wrt c3 ) & ( ( not c3 has_a_unity or not len c2 = 0 ) implies ex b1 being Element of c1ex b2 being Function of NAT ,c1 st
( b2 . 1 = c2 . 1 & ( for b3 being Nat st 0 <> b3 & b3 < len c2 holds
b2 . (b3 + 1) = c3 . (b2 . b3),(c2 . (b3 + 1)) ) & b1 = b2 . (len c2) ) ) )
proof end;
uniqueness
for b1, b2 being Element of c1 holds
( ( c3 has_a_unity & len c2 = 0 & b1 = the_unity_wrt c3 & b2 = the_unity_wrt c3 implies b1 = b2 ) & ( ( not c3 has_a_unity or not len c2 = 0 ) & ex b3 being Function of NAT ,c1 st
( b3 . 1 = c2 . 1 & ( for b4 being Nat st 0 <> b4 & b4 < len c2 holds
b3 . (b4 + 1) = c3 . (b3 . b4),(c2 . (b4 + 1)) ) & b1 = b3 . (len c2) ) & ex b3 being Function of NAT ,c1 st
( b3 . 1 = c2 . 1 & ( for b4 being Nat st 0 <> b4 & b4 < len c2 holds
b3 . (b4 + 1) = c3 . (b3 . b4),(c2 . (b4 + 1)) ) & b2 = b3 . (len c2) ) implies b1 = b2 ) )
proof end;
consistency
for b1 being Element of c1 holds verum
;
end;

:: deftheorem Def1 defines "**" FINSOP_1:def 1 :
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being BinOp of b1 st ( b3 has_a_unity or len b2 >= 1 ) holds
for b4 being Element of b1 holds
( ( b3 has_a_unity & len b2 = 0 implies ( b4 = b3 "**" b2 iff b4 = the_unity_wrt b3 ) ) & ( ( not b3 has_a_unity or not len b2 = 0 ) implies ( b4 = b3 "**" b2 iff ex b5 being Function of NAT ,b1 st
( b5 . 1 = b2 . 1 & ( for b6 being Nat st 0 <> b6 & b6 < len b2 holds
b5 . (b6 + 1) = b3 . (b5 . b6),(b2 . (b6 + 1)) ) & b4 = b5 . (len b2) ) ) ) );

theorem Th1: :: FINSOP_1:1
canceled;

theorem Th2: :: FINSOP_1:2
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being BinOp of b1 st len b2 >= 1 holds
ex b4 being Function of NAT ,b1 st
( b4 . 1 = b2 . 1 & ( for b5 being Nat st 0 <> b5 & b5 < len b2 holds
b4 . (b5 + 1) = b3 . (b4 . b5),(b2 . (b5 + 1)) ) & b3 "**" b2 = b4 . (len b2) ) by Def1;

theorem Th3: :: FINSOP_1:3
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1
for b4 being BinOp of b1 st len b3 >= 1 & ex b5 being Function of NAT ,b1 st
( b5 . 1 = b3 . 1 & ( for b6 being Nat st 0 <> b6 & b6 < len b3 holds
b5 . (b6 + 1) = b4 . (b5 . b6),(b3 . (b6 + 1)) ) & b2 = b5 . (len b3) ) holds
b2 = b4 "**" b3 by Def1;

definition
let c1, c2 be non empty set ;
let c3 be Element of c1;
redefine func --> as c2 --> c3 -> Function of a2,a1;
coherence
c2 --> c3 is Function of c2,c1
by FUNCOP_1:58;
end;

definition
let c1 be non empty set ;
let c2 be Function of NAT ,c1;
let c3 be FinSequence of c1;
redefine func +* as c2 +* c3 -> Function of NAT ,a1;
coherence
c2 +* c3 is Function of NAT ,c1
proof end;
end;

definition
let c1 be FinSequence;
redefine func dom as dom c1 -> Element of Fin NAT ;
coherence
dom c1 is Element of Fin NAT
proof end;
end;

Lemma3: for b1 being non empty set
for b2 being FinSequence of b1
for b3 being BinOp of b1 st len b2 >= 1 & b3 is associative & b3 is commutative holds
b3 "**" b2 = b3 $$ (dom b2),((NAT --> (the_unity_wrt b3)) +* b2)
proof end;

Lemma4: for b1 being non empty set
for b2 being FinSequence of b1
for b3 being BinOp of b1 st len b2 = 0 & b3 has_a_unity & b3 is associative & b3 is commutative holds
b3 "**" b2 = b3 $$ (dom b2),((NAT --> (the_unity_wrt b3)) +* b2)
proof end;

theorem Th4: :: FINSOP_1:4
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being BinOp of b1 st ( b3 has_a_unity or len b2 >= 1 ) & b3 is associative & b3 is commutative holds
b3 "**" b2 = b3 $$ (dom b2),((NAT --> (the_unity_wrt b3)) +* b2)
proof end;

Lemma5: for b1 being non empty set
for b2 being BinOp of b1 st b2 has_a_unity holds
b2 "**" (<*> b1) = the_unity_wrt b2
proof end;

Lemma6: for b1 being non empty set
for b2 being Element of b1
for b3 being BinOp of b1 holds b3 "**" <*b2*> = b2
proof end;

Lemma7: for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1
for b4 being BinOp of b1 st len b3 >= 1 holds
b4 "**" (b3 ^ <*b2*>) = b4 . (b4 "**" b3),b2
proof end;

Lemma8: for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1
for b4 being BinOp of b1 st b4 has_a_unity & len b3 = 0 holds
b4 "**" (b3 ^ <*b2*>) = b4 . (b4 "**" b3),b2
proof end;

theorem Th5: :: FINSOP_1:5
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1
for b4 being BinOp of b1 st ( b4 has_a_unity or len b3 >= 1 ) holds
b4 "**" (b3 ^ <*b2*>) = b4 . (b4 "**" b3),b2
proof end;

theorem Th6: :: FINSOP_1:6
for b1 being non empty set
for b2, b3 being FinSequence of b1
for b4 being BinOp of b1 st b4 is associative & ( b4 has_a_unity or ( len b2 >= 1 & len b3 >= 1 ) ) holds
b4 "**" (b2 ^ b3) = b4 . (b4 "**" b2),(b4 "**" b3)
proof end;

theorem Th7: :: FINSOP_1:7
for b1 being non empty set
for b2 being Element of b1
for b3 being FinSequence of b1
for b4 being BinOp of b1 st b4 is associative & ( b4 has_a_unity or len b3 >= 1 ) holds
b4 "**" (<*b2*> ^ b3) = b4 . b2,(b4 "**" b3)
proof end;

Lemma12: for b1 being non empty set
for b2, b3 being FinSequence of b1
for b4 being BinOp of b1 st b4 is associative & b4 is commutative holds
for b5 being Permutation of dom b2 st len b2 >= 1 & len b2 = len b3 & ( for b6 being Nat st b6 in dom b3 holds
b3 . b6 = b2 . (b5 . b6) ) holds
b4 "**" b2 = b4 "**" b3
proof end;

Lemma13: for b1 being non empty set
for b2, b3 being FinSequence of b1
for b4 being BinOp of b1
for b5 being Permutation of dom b2 st b4 has_a_unity & len b2 = 0 & b3 = b2 * b5 holds
b4 "**" b2 = b4 "**" b3
proof end;

theorem Th8: :: FINSOP_1:8
for b1 being non empty set
for b2, b3 being FinSequence of b1
for b4 being BinOp of b1
for b5 being Permutation of dom b2 st b4 is commutative & b4 is associative & ( b4 has_a_unity or len b2 >= 1 ) & b3 = b2 * b5 holds
b4 "**" b2 = b4 "**" b3
proof end;

Lemma15: for b1 being non empty set
for b2, b3 being FinSequence of b1
for b4 being BinOp of b1 st b4 is associative & b4 is commutative & b2 is one-to-one & b3 is one-to-one & rng b2 = rng b3 & len b2 >= 1 holds
b4 "**" b2 = b4 "**" b3
proof end;

Lemma16: for b1 being non empty set
for b2, b3 being FinSequence of b1
for b4 being BinOp of b1 st len b2 = 0 & b4 has_a_unity & b2 is one-to-one & b3 is one-to-one & rng b2 = rng b3 holds
b4 "**" b2 = b4 "**" b3
proof end;

theorem Th9: :: FINSOP_1:9
for b1 being non empty set
for b2, b3 being FinSequence of b1
for b4 being BinOp of b1 st ( b4 has_a_unity or len b2 >= 1 ) & b4 is associative & b4 is commutative & b2 is one-to-one & b3 is one-to-one & rng b2 = rng b3 holds
b4 "**" b2 = b4 "**" b3
proof end;

Lemma17: for b1 being non empty set
for b2 being FinSequence of b1
for b3 being BinOp of b1 st len b2 = 1 holds
b3 "**" b2 = b2 . 1
proof end;

Lemma18: for b1 being non empty set
for b2, b3, b4 being FinSequence of b1
for b5 being BinOp of b1 st b5 is associative & b5 is commutative & len b2 >= 1 & len b2 = len b3 & len b2 = len b4 & ( for b6 being Nat st b6 in dom b2 holds
b4 . b6 = b5 . (b2 . b6),(b3 . b6) ) holds
b5 "**" b4 = b5 . (b5 "**" b2),(b5 "**" b3)
proof end;

Lemma19: for b1 being non empty set
for b2, b3, b4 being FinSequence of b1
for b5 being BinOp of b1 st b5 has_a_unity & len b2 = 0 & len b2 = len b3 & len b2 = len b4 holds
b5 "**" b2 = b5 . (b5 "**" b3),(b5 "**" b4)
proof end;

theorem Th10: :: FINSOP_1:10
for b1 being non empty set
for b2, b3, b4 being FinSequence of b1
for b5 being BinOp of b1 st b5 is associative & b5 is commutative & ( b5 has_a_unity or len b2 >= 1 ) & len b2 = len b3 & len b2 = len b4 & ( for b6 being Nat st b6 in dom b2 holds
b2 . b6 = b5 . (b3 . b6),(b4 . b6) ) holds
b5 "**" b2 = b5 . (b5 "**" b3),(b5 "**" b4)
proof end;

theorem Th11: :: FINSOP_1:11
for b1 being non empty set
for b2 being BinOp of b1 st b2 has_a_unity holds
b2 "**" (<*> b1) = the_unity_wrt b2 by Lemma5;

theorem Th12: :: FINSOP_1:12
for b1 being non empty set
for b2 being Element of b1
for b3 being BinOp of b1 holds b3 "**" <*b2*> = b2 by Lemma6;

theorem Th13: :: FINSOP_1:13
for b1 being non empty set
for b2, b3 being Element of b1
for b4 being BinOp of b1 holds b4 "**" <*b2,b3*> = b4 . b2,b3
proof end;

theorem Th14: :: FINSOP_1:14
for b1 being non empty set
for b2, b3 being Element of b1
for b4 being BinOp of b1 st b4 is commutative holds
b4 "**" <*b2,b3*> = b4 "**" <*b3,b2*>
proof end;

theorem Th15: :: FINSOP_1:15
for b1 being non empty set
for b2, b3, b4 being Element of b1
for b5 being BinOp of b1 holds b5 "**" <*b2,b3,b4*> = b5 . (b5 . b2,b3),b4
proof end;

theorem Th16: :: FINSOP_1:16
for b1 being non empty set
for b2, b3, b4 being Element of b1
for b5 being BinOp of b1 st b5 is commutative holds
b5 "**" <*b2,b3,b4*> = b5 "**" <*b3,b2,b4*>
proof end;

theorem Th17: :: FINSOP_1:17
for b1 being non empty set
for b2 being Element of b1
for b3 being BinOp of b1 holds b3 "**" (1 |-> b2) = b2
proof end;

theorem Th18: :: FINSOP_1:18
for b1 being non empty set
for b2 being Element of b1
for b3 being BinOp of b1 holds b3 "**" (2 |-> b2) = b3 . b2,b2
proof end;

theorem Th19: :: FINSOP_1:19
for b1 being non empty set
for b2 being Element of b1
for b3 being BinOp of b1
for b4, b5 being Nat st b3 is associative & ( b3 has_a_unity or ( b4 <> 0 & b5 <> 0 ) ) holds
b3 "**" ((b4 + b5) |-> b2) = b3 . (b3 "**" (b4 |-> b2)),(b3 "**" (b5 |-> b2))
proof end;

theorem Th20: :: FINSOP_1:20
for b1 being non empty set
for b2 being Element of b1
for b3 being BinOp of b1
for b4, b5 being Nat st b3 is associative & ( b3 has_a_unity or ( b4 <> 0 & b5 <> 0 ) ) holds
b3 "**" ((b4 * b5) |-> b2) = b3 "**" (b5 |-> (b3 "**" (b4 |-> b2)))
proof end;

theorem Th21: :: FINSOP_1:21
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being BinOp of b1 st len b2 = 1 holds
b3 "**" b2 = b2 . 1 by Lemma17;

theorem Th22: :: FINSOP_1:22
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being BinOp of b1 st len b2 = 2 holds
b3 "**" b2 = b3 . (b2 . 1),(b2 . 2)
proof end;