:: ALTCAT_1 semantic presentation

registration
let c1 be functional set ;
cluster -> functional Element of bool a1;
coherence
for b1 being Subset of c1 holds b1 is functional
proof
let c2 be Subset of c1;
let c3 be set ; :: according to FRAENKEL:def 1
assume c3 in c2 ;
hence c3 is Function by FRAENKEL:def 1;
end;
end;

registration
let c1 be Function-yielding Function;
let c2 be set ;
cluster a1 | a2 -> Function-yielding ;
correctness
coherence
c1 | c2 is Function-yielding
;
by MSUHOM_1:3;
end;

registration
let c1 be Function;
cluster {a1} -> functional ;
coherence
{c1} is functional
proof
let c2 be set ; :: according to FRAENKEL:def 1
assume c2 in {c1} ;
hence c2 is Function by TARSKI:def 1;
end;
end;

theorem Th1: :: ALTCAT_1:1
canceled;

theorem Th2: :: ALTCAT_1:2
for b1 being set holds id b1 in Funcs b1,b1
proof
let c1 be set ;
( dom (id c1) = c1 & rng (id c1) = c1 ) by RELAT_1:71;
hence id c1 in Funcs c1,c1 by FUNCT_2:def 2;
end;

theorem Th3: :: ALTCAT_1:3
Funcs {} ,{} = {(id {} )}
proof
hereby :: according to TARSKI:def 3,XBOOLE_0:def 10
let c1 be set ;
assume c1 in Funcs {} ,{} ;
then reconsider c2 = c1 as Function of {} , {} by FUNCT_2:121;
now
let c3, c4 be set ;
hereby
assume [c3,c4] in c2 ;
then E3: c3 in dom c2 by RELAT_1:def 4;
hence c3 in {} by FUNCT_2:def 1;
thus c3 = c4 by E3, FUNCT_2:def 1;
end;
thus ( c3 in {} & c3 = c4 implies [c3,c4] in c2 ) ;
end;
then c2 = id {} by RELAT_1:def 10;
hence c1 in {(id {} )} by TARSKI:def 1;
end;
id {} in Funcs {} ,{} by Th2;
hence {(id {} )} c= Funcs {} ,{} by ZFMISC_1:37;
end;

theorem Th4: :: ALTCAT_1:4
for b1, b2, b3 being set
for b4, b5 being Function holds
( b4 in Funcs b1,b2 & b5 in Funcs b2,b3 implies b5 * b4 in Funcs b1,b3 )
proof
let c1, c2, c3 be set ;
let c4, c5 be Function;
E4: rng (c5 * c4) c= rng c5 by RELAT_1:45;
assume ( c4 in Funcs c1,c2 & c5 in Funcs c2,c3 ) ;
then ( ex b1 being Function st
( b1 = c4 & dom b1 = c1 & rng b1 c= c2 ) & ex b1 being Function st
( b1 = c5 & dom b1 = c2 & rng b1 c= c3 ) ) by FUNCT_2:def 2;
then ( dom (c5 * c4) = c1 & rng (c5 * c4) c= c3 ) by E4, RELAT_1:46, XBOOLE_1:1;
hence c5 * c4 in Funcs c1,c3 by FUNCT_2:def 2;
end;

theorem Th5: :: ALTCAT_1:5
for b1, b2, b3 being set holds
not ( Funcs b1,b2 <> {} & Funcs b2,b3 <> {} & not Funcs b1,b3 <> {} )
proof
let c1, c2, c3 be set ;
assume that
E5: Funcs c1,c2 <> {} and
E6: Funcs c2,c3 <> {} ;
consider c4 being set such that
E7: c4 in Funcs c1,c2 by E5, XBOOLE_0:def 1;
consider c5 being set such that
E8: c5 in Funcs c2,c3 by E6, XBOOLE_0:def 1;
reconsider c6 = c4 as Function of c1,c2 by E7, FUNCT_2:121;
reconsider c7 = c5 as Function of c2,c3 by E8, FUNCT_2:121;
c7 * c6 in Funcs c1,c3 by E7, E8, Th4;
hence Funcs c1,c3 <> {} ;
end;

theorem Th6: :: ALTCAT_1:6
canceled;

theorem Th7: :: ALTCAT_1:7
for b1, b2 being set
for b3 being ManySortedSet of [:b2,b1:]
for b4 being Subset of b1
for b5 being Subset of b2
for b6, b7 being set holds
( b6 in b4 & b7 in b5 implies b3 . b7,b6 = (b3 | [:b5,b4:]) . b7,b6 )
proof
let c1, c2 be set ;
let c3 be ManySortedSet of [:c2,c1:];
let c4 be Subset of c1;
let c5 be Subset of c2;
let c6, c7 be set ;
assume ( c6 in c4 & c7 in c5 ) ;
then E5: [c7,c6] in [:c5,c4:] by ZFMISC_1:106;
thus c3 . c7,c6 = c3 . [c7,c6]
.= (c3 | [:c5,c4:]) . [c7,c6] by E5, FUNCT_1:72
.= (c3 | [:c5,c4:]) . c7,c6 ;
end;

scheme :: ALTCAT_1:sch 1
s1{ F1() -> set , F2() -> set , F3( set , set ) -> set } :
ex b1 being ManySortedSet of [:F1(),F2():] st
for b2, b3 being set holds
( b2 in F1() & b3 in F2() implies b1 . b2,b3 = F3(b2,b3) )
proof
deffunc H1( set ) -> set = F3((a1 `1 ),(a1 `2 ));
consider c1 being Function such that
E5: dom c1 = [:F1(),F2():] and
E6: for b1 being set holds
( b1 in [:F1(),F2():] implies c1 . b1 = H1(b1) ) from FUNCT_1:sch 3();
reconsider c2 = c1 as ManySortedSet of [:F1(),F2():] by E5, PBOOLE:def 3;
take c2 ;
let c3, c4 be set ;
assume ( c3 in F1() & c4 in F2() ) ;
then E7: [c3,c4] in [:F1(),F2():] by ZFMISC_1:106;
E8: ( [c3,c4] `1 = c3 & [c3,c4] `2 = c4 ) by MCART_1:7;
thus c2 . c3,c4 = c2 . [c3,c4]
.= F3(c3,c4) by E6, E7, E8 ;
end;

scheme :: ALTCAT_1:sch 2
s2{ F1() -> non empty set , F2() -> non empty set , F3( set , set ) -> set } :
ex b1 being ManySortedSet of [:F1(),F2():] st
for b2 being Element of F1()
for b3 being Element of F2() holds b1 . b2,b3 = F3(b2,b3)
proof
consider c1 being ManySortedSet of [:F1(),F2():] such that
E5: for b1, b2 being set holds
( b1 in F1() & b2 in F2() implies c1 . b1,b2 = F3(b1,b2) ) from ALTCAT_1:sch 1();
take c1 ;
thus for b1 being Element of F1()
for b2 being Element of F2() holds c1 . b1,b2 = F3(b1,b2) by E5;
end;

scheme :: ALTCAT_1:sch 3
s3{ F1() -> set , F2() -> set , F3() -> set , F4( set , set , set ) -> set } :
ex b1 being ManySortedSet of [:F1(),F2(),F3():] st
for b2, b3, b4 being set holds
( b2 in F1() & b3 in F2() & b4 in F3() implies b1 . b2,b3,b4 = F4(b2,b3,b4) )
proof
deffunc H1( set ) -> set = F4(((a1 `1 ) `1 ),((a1 `1 ) `2 ),(a1 `2 ));
consider c1 being Function such that
E5: dom c1 = [:F1(),F2(),F3():] and
E6: for b1 being set holds
( b1 in [:F1(),F2(),F3():] implies c1 . b1 = H1(b1) ) from FUNCT_1:sch 3();
reconsider c2 = c1 as ManySortedSet of [:F1(),F2(),F3():] by E5, PBOOLE:def 3;
take c2 ;
let c3, c4, c5 be set ;
assume ( c3 in F1() & c4 in F2() & c5 in F3() ) ;
then E7: [c3,c4,c5] in [:F1(),F2(),F3():] by MCART_1:73;
( [c3,c4] `1 = c3 & [c3,c4] `2 = c4 ) by MCART_1:7;
then E8: ( ([[c3,c4],c5] `1 ) `1 = c3 & ([[c3,c4],c5] `1 ) `2 = c4 & [[c3,c4],c5] `2 = c5 ) by MCART_1:7;
E9: [c3,c4,c5] = [[c3,c4],c5] by MCART_1:def 3;
thus c2 . c3,c4,c5 = c2 . [c3,c4,c5] by MULTOP_1:def 1
.= F4(c3,c4,c5) by E6, E7, E8, E9 ;
end;

scheme :: ALTCAT_1:sch 4
s4{ F1() -> non empty set , F2() -> non empty set , F3() -> non empty set , F4( set , set , set ) -> set } :
ex b1 being ManySortedSet of [:F1(),F2(),F3():] st
for b2 being Element of F1()
for b3 being Element of F2()
for b4 being Element of F3() holds b1 . b2,b3,b4 = F4(b2,b3,b4)
proof
consider c1 being ManySortedSet of [:F1(),F2(),F3():] such that
E5: for b1, b2, b3 being set holds
( b1 in F1() & b2 in F2() & b3 in F3() implies c1 . b1,b2,b3 = F4(b1,b2,b3) ) from ALTCAT_1:sch 3();
take c1 ;
thus for b1 being Element of F1()
for b2 being Element of F2()
for b3 being Element of F3() holds c1 . b1,b2,b3 = F4(b1,b2,b3) by E5;
end;

theorem Th8: :: ALTCAT_1:8
for b1, b2 being set
for b3, b4 being ManySortedSet of [:b1,b2:] holds
( ( for b5, b6 being set holds
( b5 in b1 & b6 in b2 implies b3 . b5,b6 = b4 . b5,b6 ) ) implies b4 = b3 )
proof
let c1, c2 be set ;
let c3, c4 be ManySortedSet of [:c1,c2:];
assume E6: for b1, b2 being set holds
( b1 in c1 & b2 in c2 implies c3 . b1,b2 = c4 . b1,b2 ) ;
E7: ( dom c4 = [:c1,c2:] & dom c3 = [:c1,c2:] ) by PBOOLE:def 3;
now
let c5 be set ;
assume E8: c5 in [:c1,c2:] ;
then reconsider c6 = c1, c7 = c2 as non empty set by ZFMISC_1:113;
consider c8 being Element of c6, c9 being Element of c7 such that
E9: c5 = [c8,c9] by E8, DOMAIN_1:9;
thus c3 . c5 = c3 . c8,c9 by E9
.= c4 . c8,c9 by E6
.= c4 . c5 by E9 ;
end;
hence c4 = c3 by E7, FUNCT_1:9;
end;

theorem Th9: :: ALTCAT_1:9
for b1, b2 being non empty set
for b3, b4 being ManySortedSet of [:b1,b2:] holds
( ( for b5 being Element of b1
for b6 being Element of b2 holds b3 . b5,b6 = b4 . b5,b6 ) implies b4 = b3 )
proof
let c1, c2 be non empty set ;
let c3, c4 be ManySortedSet of [:c1,c2:];
assume for b1 being Element of c1
for b2 being Element of c2 holds c3 . b1,b2 = c4 . b1,b2 ;
then for b1, b2 being set holds
( b1 in c1 & b2 in c2 implies c3 . b1,b2 = c4 . b1,b2 ) ;
hence c4 = c3 by Th8;
end;

theorem Th10: :: ALTCAT_1:10
for b1 being set
for b2, b3 being ManySortedSet of [:b1,b1,b1:] holds
( ( for b4, b5, b6 being set holds
( b4 in b1 & b5 in b1 & b6 in b1 implies b2 . b4,b5,b6 = b3 . b4,b5,b6 ) ) implies b3 = b2 )
proof
let c1 be set ;
let c2, c3 be ManySortedSet of [:c1,c1,c1:];
assume E8: for b1, b2, b3 being set holds
( b1 in c1 & b2 in c1 & b3 in c1 implies c2 . b1,b2,b3 = c3 . b1,b2,b3 ) ;
E9: ( dom c3 = [:c1,c1,c1:] & dom c2 = [:c1,c1,c1:] ) by PBOOLE:def 3;
now
let c4 be set ;
assume E10: c4 in [:c1,c1,c1:] ;
then reconsider c5 = c1 as non empty set by MCART_1:35;
consider c6, c7, c8 being Element of c5 such that
E11: c4 = [c6,c7,c8] by E10, DOMAIN_1:15;
thus c3 . c4 = c3 . c6,c7,c8 by E11, MULTOP_1:def 1
.= c2 . c6,c7,c8 by E8
.= c2 . c4 by E11, MULTOP_1:def 1 ;
end;
hence c3 = c2 by E9, FUNCT_1:9;
end;

theorem Th11: :: ALTCAT_1:11
for b1, b2, b3 being set holds b1,b2 :-> b3 = [b1,b2] .--> b3
proof
let c1, c2, c3 be set ;
E9: {[c1,c2]} = [:{c1},{c2}:] by ZFMISC_1:35;
( dom ([c1,c2] .--> c3) = {[c1,c2]} & rng ([c1,c2] .--> c3) = {c3} ) by CQC_LANG:5;
then [c1,c2] .--> c3 is Function of [:{c1},{c2}:],{c3} by E9, FUNCT_2:def 1, RELSET_1:11;
hence c1,c2 :-> c3 = [c1,c2] .--> c3 by FUNCT_2:def 5;
end;

theorem Th12: :: ALTCAT_1:12
for b1, b2, b3 being set holds (b1,b2 :-> b3) . b1,b2 = b3
proof
let c1, c2, c3 be set ;
thus (c1,c2 :-> c3) . c1,c2 = (c1,c2 :-> c3) . [c1,c2]
.= ([c1,c2] .--> c3) . [c1,c2] by Th11
.= c3 by CQC_LANG:6 ;
end;

definition
attr a1 is strict;
struct AltGraph -> 1-sorted ;
aggr AltGraph(# carrier, Arrows #) -> AltGraph ;
sel Arrows c1 -> ManySortedSet of [:the carrier of a1,the carrier of a1:];
end;

definition
let c1 be AltGraph ;
mode object is Element of a1;
end;

definition
let c1 be AltGraph ;
let c2, c3 be object of c1;
canceled;
func <^c2,c3^> -> set equals :: ALTCAT_1:def 2
the Arrows of a1 . a2,a3;
correctness
coherence
the Arrows of c1 . c2,c3 is set
;
;
end;

:: deftheorem Def1 ALTCAT_1:def 1 :
canceled;

:: deftheorem Def2 defines <^ ALTCAT_1:def 2 :
for b1 being AltGraph
for b2, b3 being object of b1 holds <^b2,b3^> = the Arrows of b1 . b2,b3;

definition
let c1 be AltGraph ;
let c2, c3 be object of c1;
mode Morphism is Element of <^a2,a3^>;
end;

definition
let c1 be AltGraph ;
canceled;
attr a1 is transitive means :Def4: :: ALTCAT_1:def 4
for b1, b2, b3 being object of a1 holds
not ( <^b1,b2^> <> {} & <^b2,b3^> <> {} & not <^b1,b3^> <> {} );
end;

:: deftheorem Def3 ALTCAT_1:def 3 :
canceled;

:: deftheorem Def4 defines transitive ALTCAT_1:def 4 :
for b1 being AltGraph holds
( b1 is transitive iff for b2, b3, b4 being object of b1 holds
not ( <^b2,b3^> <> {} & <^b3,b4^> <> {} & not <^b2,b4^> <> {} ) );

definition
let c1 be set ;
let c2 be ManySortedSet of [:c1,c1:];
func {|c2|} -> ManySortedSet of [:a1,a1,a1:] means :Def5: :: ALTCAT_1:def 5
for b1, b2, b3 being set holds
( b1 in a1 & b2 in a1 & b3 in a1 implies a3 . b1,b2,b3 = a2 . b1,b3 );
existence
ex b1 being ManySortedSet of [:c1,c1,c1:] st
for b2, b3, b4 being set holds
( b2 in c1 & b3 in c1 & b4 in c1 implies b1 . b2,b3,b4 = c2 . b2,b4 )
proof
deffunc H1( set , set , set ) -> set = c2 . a1,a3;
ex b1 being ManySortedSet of [:c1,c1,c1:] st
for b2, b3, b4 being set holds
( b2 in c1 & b3 in c1 & b4 in c1 implies b1 . b2,b3,b4 = H1(b2,b3,b4) ) from ALTCAT_1:sch 3();
hence ex b1 being ManySortedSet of [:c1,c1,c1:] st
for b2, b3, b4 being set holds
( b2 in c1 & b3 in c1 & b4 in c1 implies b1 . b2,b3,b4 = c2 . b2,b4 ) ;
end;
uniqueness
for b1, b2 being ManySortedSet of [:c1,c1,c1:] holds
( ( for b3, b4, b5 being set holds
( b3 in c1 & b4 in c1 & b5 in c1 implies b1 . b3,b4,b5 = c2 . b3,b5 ) ) & ( for b3, b4, b5 being set holds
( b3 in c1 & b4 in c1 & b5 in c1 implies b2 . b3,b4,b5 = c2 . b3,b5 ) ) implies b1 = b2 )
proof
let c3, c4 be ManySortedSet of [:c1,c1,c1:];
assume that
E11: for b1, b2, b3 being set holds
( b1 in c1 & b2 in c1 & b3 in c1 implies c3 . b1,b2,b3 = c2 . b1,b3 ) and
E12: for b1, b2, b3 being set holds
( b1 in c1 & b2 in c1 & b3 in c1 implies c4 . b1,b2,b3 = c2 . b1,b3 ) ;
now
let c5, c6, c7 be set ;
assume E13: ( c5 in c1 & c6 in c1 & c7 in c1 ) ;
hence c3 . c5,c6,c7 = c2 . c5,c7 by E11
.= c4 . c5,c6,c7 by E12, E13 ;

end;
hence c3 = c4 by Th10;
end;
let c3 be ManySortedSet of [:c1,c1:];
func {|c2,c3|} -> ManySortedSet of [:a1,a1,a1:] means :Def6: :: ALTCAT_1:def 6
for b1, b2, b3 being set holds
( b1 in a1 & b2 in a1 & b3 in a1 implies a4 . b1,b2,b3 = [:(a3 . b2,b3),(a2 . b1,b2):] );
existence
ex b1 being ManySortedSet of [:c1,c1,c1:] st
for b2, b3, b4 being set holds
( b2 in c1 & b3 in c1 & b4 in c1 implies b1 . b2,b3,b4 = [:(c3 . b3,b4),(c2 . b2,b3):] )
proof
deffunc H1( set , set , set ) -> set = [:(c3 . a2,a3),(c2 . a1,a2):];
ex b1 being ManySortedSet of [:c1,c1,c1:] st
for b2, b3, b4 being set holds
( b2 in c1 & b3 in c1 & b4 in c1 implies b1 . b2,b3,b4 = H1(b2,b3,b4) ) from ALTCAT_1:sch 3();
hence ex b1 being ManySortedSet of [:c1,c1,c1:] st
for b2, b3, b4 being set holds
( b2 in c1 & b3 in c1 & b4 in c1 implies b1 . b2,b3,b4 = [:(c3 . b3,b4),(c2 . b2,b3):] ) ;
end;
uniqueness
for b1, b2 being ManySortedSet of [:c1,c1,c1:] holds
( ( for b3, b4, b5 being set holds
( b3 in c1 & b4 in c1 & b5 in c1 implies b1 . b3,b4,b5 = [:(c3 . b4,b5),(c2 . b3,b4):] ) ) & ( for b3, b4, b5 being set holds
( b3 in c1 & b4 in c1 & b5 in c1 implies b2 . b3,b4,b5 = [:(c3 . b4,b5),(c2 . b3,b4):] ) ) implies b1 = b2 )
proof
let c4, c5 be ManySortedSet of [:c1,c1,c1:];
assume that
E11: for b1, b2, b3 being set holds
( b1 in c1 & b2 in c1 & b3 in c1 implies c4 . b1,b2,b3 = [:(c3 . b2,b3),(c2 . b1,b2):] ) and
E12: for b1, b2, b3 being set holds
( b1 in c1 & b2 in c1 & b3 in c1 implies c5 . b1,b2,b3 = [:(c3 . b2,b3),(c2 . b1,b2):] ) ;
now
let c6, c7, c8 be set ;
assume E13: ( c6 in c1 & c7 in c1 & c8 in c1 ) ;
hence c4 . c6,c7,c8 = [:(c3 . c7,c8),(c2 . c6,c7):] by E11
.= c5 . c6,c7,c8 by E12, E13 ;

end;
hence c4 = c5 by Th10;
end;
end;

:: deftheorem Def5 defines {| ALTCAT_1:def 5 :
for b1 being set
for b2 being ManySortedSet of [:b1,b1:]
for b3 being ManySortedSet of [:b1,b1,b1:] holds
( b3 = {|b2|} iff for b4, b5, b6 being set holds
( b4 in b1 & b5 in b1 & b6 in b1 implies b3 . b4,b5,b6 = b2 . b4,b6 ) );

:: deftheorem Def6 defines {| ALTCAT_1:def 6 :
for b1 being set
for b2, b3 being ManySortedSet of [:b1,b1:]
for b4 being ManySortedSet of [:b1,b1,b1:] holds
( b4 = {|b2,b3|} iff for b5, b6, b7 being set holds
( b5 in b1 & b6 in b1 & b7 in b1 implies b4 . b5,b6,b7 = [:(b3 . b6,b7),(b2 . b5,b6):] ) );

definition
let c1 be set ;
let c2 be ManySortedSet of [:c1,c1:];
mode BinComp is ManySortedFunction of {|a2,a2|},{|a2|};
end;

definition
let c1 be non empty set ;
let c2 be ManySortedSet of [:c1,c1:];
let c3 be BinComp of c2;
let c4, c5, c6 be Element of c1;
redefine func . as c3 . c4,c5,c6 -> Function of [:(a2 . a5,a6),(a2 . a4,a5):],a2 . a4,a6;
coherence
c3 . c4,c5,c6 is Function of [:(c2 . c5,c6),(c2 . c4,c5):],c2 . c4,c6
proof
E13: c3 . [c4,c5,c6] = c3 . c4,c5,c6 by MULTOP_1:def 1;
E14: {|c2,c2|} . [c4,c5,c6] = {|c2,c2|} . c4,c5,c6 by MULTOP_1:def 1
.= [:(c2 . c5,c6),(c2 . c4,c5):] by Def6 ;
{|c2|} . [c4,c5,c6] = {|c2|} . c4,c5,c6 by MULTOP_1:def 1
.= c2 . c4,c6 by Def5 ;
hence c3 . c4,c5,c6 is Function of [:(c2 . c5,c6),(c2 . c4,c5):],c2 . c4,c6 by E13, E14, PBOOLE:def 18;
end;
end;

definition
let c1 be non empty set ;
let c2 be ManySortedSet of [:c1,c1:];
let c3 be BinComp of c2;
attr a3 is associative means :Def7: :: ALTCAT_1:def 7
for b1, b2, b3, b4 being Element of a1
for b5, b6, b7 being set holds
( b5 in a2 . b1,b2 & b6 in a2 . b2,b3 & b7 in a2 . b3,b4 implies (a3 . b1,b3,b4) . b7,((a3 . b1,b2,b3) . b6,b5) = (a3 . b1,b2,b4) . ((a3 . b2,b3,b4) . b7,b6),b5 );
attr a3 is with_right_units means :Def8: :: ALTCAT_1:def 8
for b1 being Element of a1 holds
ex b2 being set st
( b2 in a2 . b1,b1 & ( for b3 being Element of a1
for b4 being set holds
( b4 in a2 . b1,b3 implies (a3 . b1,b1,b3) . b4,b2 = b4 ) ) );
attr a3 is with_left_units means :Def9: :: ALTCAT_1:def 9
for b1 being Element of a1 holds
ex b2 being set st
( b2 in a2 . b1,b1 & ( for b3 being Element of a1
for b4 being set holds
( b4 in a2 . b3,b1 implies (a3 . b3,b1,b1) . b2,b4 = b4 ) ) );
end;

:: deftheorem Def7 defines associative ALTCAT_1:def 7 :
for b1 being non empty set
for b2 being ManySortedSet of [:b1,b1:]
for b3 being BinComp of b2 holds
( b3 is associative iff for b4, b5, b6, b7 being Element of b1
for b8, b9, b10 being set holds
( b8 in b2 . b4,b5 & b9 in b2 . b5,b6 & b10 in b2 . b6,b7 implies (b3 . b4,b6,b7) . b10,((b3 . b4,b5,b6) . b9,b8) = (b3 . b4,b5,b7) . ((b3 . b5,b6,b7) . b10,b9),b8 ) );

:: deftheorem Def8 defines with_right_units ALTCAT_1:def 8 :
for b1 being non empty set
for b2 being ManySortedSet of [:b1,b1:]
for b3 being BinComp of b2 holds
( b3 is with_right_units iff for b4 being Element of b1 holds
ex b5 being set st
( b5 in b2 . b4,b4 & ( for b6 being Element of b1
for b7 being set holds
( b7 in b2 . b4,b6 implies (b3 . b4,b4,b6) . b7,b5 = b7 ) ) ) );

:: deftheorem Def9 defines with_left_units ALTCAT_1:def 9 :
for b1 being non empty set
for b2 being ManySortedSet of [:b1,b1:]
for b3 being BinComp of b2 holds
( b3 is with_left_units iff for b4 being Element of b1 holds
ex b5 being set st
( b5 in b2 . b4,b4 & ( for b6 being Element of b1
for b7 being set holds
( b7 in b2 . b6,b4 implies (b3 . b6,b4,b4) . b5,b7 = b7 ) ) ) );

definition
attr a1 is strict;
struct AltCatStr -> AltGraph ;
aggr AltCatStr(# carrier, Arrows, Comp #) -> AltCatStr ;
sel Comp c1 -> BinComp of the Arrows of a1;
end;

registration
cluster non empty strict AltCatStr ;
existence
ex b1 being AltCatStr st
( b1 is strict & not b1 is empty )
proof
consider c1 being non empty set , c2 being ManySortedSet of [:c1,c1:], c3 being BinComp of c2;
take AltCatStr(# c1,c2,c3 #) ;
thus AltCatStr(# c1,c2,c3 #) is strict ;
thus not the carrier of AltCatStr(# c1,c2,c3 #) is empty ; :: according to STRUCT_0:def 1
end;
end;

definition
let c1 be non empty AltCatStr ;
let c2, c3, c4 be object of c1;
assume E16: ( <^c2,c3^> <> {} & <^c3,c4^> <> {} ) ;
let c5 be Morphism of c2,c3;
let c6 be Morphism of c3,c4;
func c6 * c5 -> Morphism of a2,a4 equals :Def10: :: ALTCAT_1:def 10
(the Comp of a1 . a2,a3,a4) . a6,a5;
coherence
(the Comp of c1 . c2,c3,c4) . c6,c5 is Morphism of c2,c4
proof
reconsider c7 = <^c2,c3^>, c8 = <^c3,c4^> as non empty set by E16;
reconsider c9 = the Comp of c1 . c2,c3,c4 as Function of [:c8,c7:],<^c2,c4^> ;
reconsider c10 = c6 as Element of c8 ;
reconsider c11 = c5 as Element of c7 ;
c9 . c10,c11 is Element of <^c2,c4^> ;
hence (the Comp of c1 . c2,c3,c4) . c6,c5 is Morphism of c2,c4 ;
end;
correctness
;
end;

:: deftheorem Def10 defines * ALTCAT_1:def 10 :
for b1 being non empty AltCatStr
for b2, b3, b4 being object of b1 holds
( <^b2,b3^> <> {} & <^b3,b4^> <> {} implies for b5 being Morphism of b2,b3
for b6 being Morphism of b3,b4 holds b6 * b5 = (the Comp of b1 . b2,b3,b4) . b6,b5 );

definition
let c1 be Function;
attr a1 is compositional means :Def11: :: ALTCAT_1:def 11
for b1 being set holds
not ( b1 in dom a1 & ( for b2, b3 being Function holds
not ( b1 = [b3,b2] & a1 . b1 = b3 * b2 ) ) );
end;

:: deftheorem Def11 defines compositional ALTCAT_1:def 11 :
for b1 being Function holds
( b1 is compositional iff for b2 being set holds
not ( b2 in dom b1 & ( for b3, b4 being Function holds
not ( b2 = [b4,b3] & b1 . b2 = b4 * b3 ) ) ) );

registration
let c1, c2 be functional set ;
cluster compositional ManySortedSet of [:a1,a2:];
existence
ex b1 being ManySortedFunction of [:c1,c2:] st b1 is compositional
proof
per cases not ( not c1 = {} & not c2 = {} & not ( c1 <> {} & c2 <> {} ) ) ;
suppose E18: ( c1 = {} or c2 = {} ) ;
set c3 = [0] [:c1,c2:];
E19: dom ([0] [:c1,c2:]) = [:c1,c2:] by PBOOLE:def 3;
[0] [:c1,c2:] is Function-yielding
proof
let c4 be set ; :: according to FUNCOP_1:def 6
thus not ( c4 in dom ([0] [:c1,c2:]) & not ([0] [:c1,c2:]) . c4 is set ) by E18, E19, ZFMISC_1:113;
end;
then reconsider c4 = [0] [:c1,c2:] as ManySortedFunction of [:c1,c2:] ;
take c4 ;
let c5 be set ; :: according to ALTCAT_1:def 11
thus not ( c5 in dom c4 & ( for b1, b2 being Function holds
not ( c5 = [b2,b1] & c4 . c5 = b2 * b1 ) ) ) by E18, E19, ZFMISC_1:113;
end;
suppose ( c1 <> {} & c2 <> {} ) ;
then reconsider c3 = c1, c4 = c2 as non empty functional set ;
deffunc H1( Element of c3, Element of c4) -> set = a1 * a2;
consider c5 being ManySortedSet of [:c3,c4:] such that
E18: for b1 being Element of c3
for b2 being Element of c4 holds c5 . b1,b2 = H1(b1,b2) from ALTCAT_1:sch 2();
c5 is Function-yielding
proof
let c6 be set ; :: according to FUNCOP_1:def 6
assume c6 in dom c5 ;
then E19: c6 in [:c3,c4:] by PBOOLE:def 3;
then E20: ( c6 `1 in c3 & c6 `2 in c4 ) by MCART_1:10;
then reconsider c7 = c6 `1 , c8 = c6 `2 as Function by FRAENKEL:def 1;
c6 = [c7,c8] by E19, MCART_1:24;
then c5 . c6 = c5 . c7,c8
.= c7 * c8 by E18, E20 ;
hence c5 . c6 is Function ;
end;
then reconsider c6 = c5 as ManySortedFunction of [:c1,c2:] ;
take c6 ;
let c7 be set ; :: according to ALTCAT_1:def 11
assume c7 in dom c6 ;
then E19: c7 in [:c3,c4:] by PBOOLE:def 3;
then E20: ( c7 `1 in c3 & c7 `2 in c4 ) by MCART_1:10;
then reconsider c8 = c7 `1 , c9 = c7 `2 as Function by FRAENKEL:def 1;
take c9 ;
take c8 ;
thus c7 = [c8,c9] by E19, MCART_1:24;
c7 = [c8,c9] by E19, MCART_1:24;
hence c6 . c7 = c6 . c8,c9
.= c8 * c9 by E18, E20 ;

end;
end;
end;
end;

theorem Th13: :: ALTCAT_1:13
for b1, b2 being functional set
for b3 being compositional ManySortedSet of [:b1,b2:]
for b4, b5 being Function holds
( b4 in b1 & b5 in b2 implies b3 . b4,b5 = b4 * b5 )
proof
let c1, c2 be functional set ;
let c3 be compositional ManySortedSet of [:c1,c2:];
let c4, c5 be Function;
assume E19: ( c4 in c1 & c5 in c2 ) ;
dom c3 = [:c1,c2:] by PBOOLE:def 3;
then [c4,c5] in dom c3 by E19, ZFMISC_1:106;
then consider c6, c7 being Function such that
E20: [c4,c5] = [c7,c6] and
E21: c3 . [c4,c5] = c7 * c6 by Def11;
( c4 = c7 & c5 = c6 ) by E20, ZFMISC_1:33;
hence c3 . c4,c5 = c4 * c5 by E21;
end;

definition
let c1, c2 be functional set ;
func FuncComp c1,c2 ->