:: ALG_1 semantic presentation

theorem Th1: :: ALG_1:1
for b1, b2 being non empty set
for b3 being FinSequence of b1
for b4 being Function of b1,b2 holds
( dom (b4 * b3) = dom b3 & len (b4 * b3) = len b3 & ( for b5 being Nat st b5 in dom (b4 * b3) holds
(b4 * b3) . b5 = b4 . (b3 . b5) ) )
proof end;

theorem Th2: :: ALG_1:2
for b1 being Universal_Algebra
for b2 being non empty Subset of b1 st b2 = the carrier of b1 holds
Opers b1,b2 = the charact of b1
proof end;

theorem Th3: :: ALG_1:3
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2 holds b3 * (<*> the carrier of b1) = <*> the carrier of b2
proof end;

theorem Th4: :: ALG_1:4
for b1 being Universal_Algebra
for b2 being FinSequence of b1 holds (id the carrier of b1) * b2 = b2
proof end;

theorem Th5: :: ALG_1:5
for b1, b2, b3 being Universal_Algebra
for b4 being Function of b1,b2
for b5 being Function of b2,b3
for b6 being FinSequence of b1 holds b5 * (b4 * b6) = (b5 * b4) * b6
proof end;

definition
let c1, c2 be Universal_Algebra;
let c3 be Function of c1,c2;
pred c3 is_homomorphism c1,c2 means :Def1: :: ALG_1:def 1
( a1,a2 are_similar & ( for b1 being Nat st b1 in dom the charact of a1 holds
for b2 being operation of a1
for b3 being operation of a2 st b2 = the charact of a1 . b1 & b3 = the charact of a2 . b1 holds
for b4 being FinSequence of a1 st b4 in dom b2 holds
a3 . (b2 . b4) = b3 . (a3 * b4) ) );
end;

:: deftheorem Def1 defines is_homomorphism ALG_1:def 1 :
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2 holds
( b3 is_homomorphism b1,b2 iff ( b1,b2 are_similar & ( for b4 being Nat st b4 in dom the charact of b1 holds
for b5 being operation of b1
for b6 being operation of b2 st b5 = the charact of b1 . b4 & b6 = the charact of b2 . b4 holds
for b7 being FinSequence of b1 st b7 in dom b5 holds
b3 . (b5 . b7) = b6 . (b3 * b7) ) ) );

definition
let c1, c2 be Universal_Algebra;
let c3 be Function of c1,c2;
pred c3 is_monomorphism c1,c2 means :Def2: :: ALG_1:def 2
( a3 is_homomorphism a1,a2 & a3 is one-to-one );
pred c3 is_epimorphism c1,c2 means :Def3: :: ALG_1:def 3
( a3 is_homomorphism a1,a2 & rng a3 = the carrier of a2 );
end;

:: deftheorem Def2 defines is_monomorphism ALG_1:def 2 :
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2 holds
( b3 is_monomorphism b1,b2 iff ( b3 is_homomorphism b1,b2 & b3 is one-to-one ) );

:: deftheorem Def3 defines is_epimorphism ALG_1:def 3 :
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2 holds
( b3 is_epimorphism b1,b2 iff ( b3 is_homomorphism b1,b2 & rng b3 = the carrier of b2 ) );

definition
let c1, c2 be Universal_Algebra;
let c3 be Function of c1,c2;
pred c3 is_isomorphism c1,c2 means :Def4: :: ALG_1:def 4
( a3 is_monomorphism a1,a2 & a3 is_epimorphism a1,a2 );
end;

:: deftheorem Def4 defines is_isomorphism ALG_1:def 4 :
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2 holds
( b3 is_isomorphism b1,b2 iff ( b3 is_monomorphism b1,b2 & b3 is_epimorphism b1,b2 ) );

definition
let c1, c2 be Universal_Algebra;
pred c1,c2 are_isomorphic means :Def5: :: ALG_1:def 5
ex b1 being Function of a1,a2 st b1 is_isomorphism a1,a2;
end;

:: deftheorem Def5 defines are_isomorphic ALG_1:def 5 :
for b1, b2 being Universal_Algebra holds
( b1,b2 are_isomorphic iff ex b3 being Function of b1,b2 st b3 is_isomorphism b1,b2 );

theorem Th6: :: ALG_1:6
for b1 being Universal_Algebra holds id the carrier of b1 is_homomorphism b1,b1
proof end;

theorem Th7: :: ALG_1:7
for b1, b2, b3 being Universal_Algebra
for b4 being Function of b1,b2
for b5 being Function of b2,b3 st b4 is_homomorphism b1,b2 & b5 is_homomorphism b2,b3 holds
b5 * b4 is_homomorphism b1,b3
proof end;

theorem Th8: :: ALG_1:8
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2 holds
( b3 is_isomorphism b1,b2 iff ( b3 is_homomorphism b1,b2 & rng b3 = the carrier of b2 & b3 is one-to-one ) )
proof end;

theorem Th9: :: ALG_1:9
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2 st b3 is_isomorphism b1,b2 holds
( dom b3 = the carrier of b1 & rng b3 = the carrier of b2 )
proof end;

theorem Th10: :: ALG_1:10
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2
for b4 being Function of b2,b1 st b3 is_isomorphism b1,b2 & b4 = b3 " holds
b4 is_homomorphism b2,b1
proof end;

theorem Th11: :: ALG_1:11
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2
for b4 being Function of b2,b1 st b3 is_isomorphism b1,b2 & b4 = b3 " holds
b4 is_isomorphism b2,b1
proof end;

theorem Th12: :: ALG_1:12
for b1, b2, b3 being Universal_Algebra
for b4 being Function of b1,b2
for b5 being Function of b2,b3 st b4 is_isomorphism b1,b2 & b5 is_isomorphism b2,b3 holds
b5 * b4 is_isomorphism b1,b3
proof end;

theorem Th13: :: ALG_1:13
for b1 being Universal_Algebra holds b1,b1 are_isomorphic
proof end;

theorem Th14: :: ALG_1:14
for b1, b2 being Universal_Algebra st b1,b2 are_isomorphic holds
b2,b1 are_isomorphic
proof end;

theorem Th15: :: ALG_1:15
for b1, b2, b3 being Universal_Algebra st b1,b2 are_isomorphic & b2,b3 are_isomorphic holds
b1,b3 are_isomorphic
proof end;

definition
let c1, c2 be Universal_Algebra;
let c3 be Function of c1,c2;
assume E17: c3 is_homomorphism c1,c2 ;
func Image c3 -> strict SubAlgebra of a2 means :Def6: :: ALG_1:def 6
the carrier of a4 = a3 .: the carrier of a1;
existence
ex b1 being strict SubAlgebra of c2 st the carrier of b1 = c3 .: the carrier of c1
proof end;
uniqueness
for b1, b2 being strict SubAlgebra of c2 st the carrier of b1 = c3 .: the carrier of c1 & the carrier of b2 = c3 .: the carrier of c1 holds
b1 = b2
proof end;
end;

:: deftheorem Def6 defines Image ALG_1:def 6 :
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2 st b3 is_homomorphism b1,b2 holds
for b4 being strict SubAlgebra of b2 holds
( b4 = Image b3 iff the carrier of b4 = b3 .: the carrier of b1 );

theorem Th16: :: ALG_1:16
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2 st b3 is_homomorphism b1,b2 holds
rng b3 = the carrier of (Image b3)
proof end;

theorem Th17: :: ALG_1:17
for b1 being Universal_Algebra
for b2 being strict Universal_Algebra
for b3 being Function of b1,b2 st b3 is_homomorphism b1,b2 holds
( b3 is_epimorphism b1,b2 iff Image b3 = b2 )
proof end;

definition
let c1 be 1-sorted ;
mode Relation of a1 is Relation of the carrier of a1;
mode Equivalence_Relation of a1 is Equivalence_Relation of the carrier of a1;
end;

definition
let c1 be non empty set ;
let c2 be Relation of c1;
canceled;
canceled;
func ExtendRel c2 -> Relation of a1 * means :Def9: :: ALG_1:def 9
for b1, b2 being FinSequence of a1 holds
( [b1,b2] in a3 iff ( len b1 = len b2 & ( for b3 being Nat st b3 in dom b1 holds
[(b1 . b3),(b2 . b3)] in a2 ) ) );
existence
ex b1 being Relation of c1 * st
for b2, b3 being FinSequence of c1 holds
( [b2,b3] in b1 iff ( len b2 = len b3 & ( for b4 being Nat st b4 in dom b2 holds
[(b2 . b4),(b3 . b4)] in c2 ) ) )
proof end;
uniqueness
for b1, b2 being Relation of c1 * st ( for b3, b4 being FinSequence of c1 holds
( [b3,b4] in b1 iff ( len b3 = len b4 & ( for b5 being Nat st b5 in dom b3 holds
[(b3 . b5),(b4 . b5)] in c2 ) ) ) ) & ( for b3, b4 being FinSequence of c1 holds
( [b3,b4] in b2 iff ( len b3 = len b4 & ( for b5 being Nat st b5 in dom b3 holds
[(b3 . b5),(b4 . b5)] in c2 ) ) ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def7 ALG_1:def 7 :
canceled;

:: deftheorem Def8 ALG_1:def 8 :
canceled;

:: deftheorem Def9 defines ExtendRel ALG_1:def 9 :
for b1 being non empty set
for b2 being Relation of b1
for b3 being Relation of b1 * holds
( b3 = ExtendRel b2 iff for b4, b5 being FinSequence of b1 holds
( [b4,b5] in b3 iff ( len b4 = len b5 & ( for b6 being Nat st b6 in dom b4 holds
[(b4 . b6),(b5 . b6)] in b2 ) ) ) );

theorem Th18: :: ALG_1:18
for b1 being non empty set holds ExtendRel (id b1) = id (b1 * )
proof end;

definition
let c1 be Universal_Algebra;
mode Congruence of c1 -> Equivalence_Relation of a1 means :Def10: :: ALG_1:def 10
for b1 being Nat
for b2 being operation of a1 st b1 in dom the charact of a1 & b2 = the charact of a1 . b1 holds
for b3, b4 being FinSequence of a1 st b3 in dom b2 & b4 in dom b2 & [b3,b4] in ExtendRel a2 holds
[(b2 . b3),(b2 . b4)] in a2;
existence
ex b1 being Equivalence_Relation of c1 st
for b2 being Nat
for b3 being operation of c1 st b2 in dom the charact of c1 & b3 = the charact of c1 . b2 holds
for b4, b5 being FinSequence of c1 st b4 in dom b3 & b5 in dom b3 & [b4,b5] in ExtendRel b1 holds
[(b3 . b4),(b3 . b5)] in b1
proof end;
end;

:: deftheorem Def10 defines Congruence ALG_1:def 10 :
for b1 being Universal_Algebra
for b2 being Equivalence_Relation of b1 holds
( b2 is Congruence of b1 iff for b3 being Nat
for b4 being operation of b1 st b3 in dom the charact of b1 & b4 = the charact of b1 . b3 holds
for b5, b6 being FinSequence of b1 st b5 in dom b4 & b6 in dom b4 & [b5,b6] in ExtendRel b2 holds
[(b4 . b5),(b4 . b6)] in b2 );

definition
let c1 be non empty set ;
let c2 be Equivalence_Relation of c1;
let c3 be FinSequence of Class c2;
let c4 be FinSequence of c1;
pred c4 is_representatives_FS c3 means :Def11: :: ALG_1:def 11
( len a4 = len a3 & ( for b1 being Nat st b1 in dom a4 holds
Class a2,(a4 . b1) = a3 . b1 ) );
end;

:: deftheorem Def11 defines is_representatives_FS ALG_1:def 11 :
for b1 being non empty set
for b2 being Equivalence_Relation of b1
for b3 being FinSequence of Class b2
for b4 being FinSequence of b1 holds
( b4 is_representatives_FS b3 iff ( len b4 = len b3 & ( for b5 being Nat st b5 in dom b4 holds
Class b2,(b4 . b5) = b3 . b5 ) ) );

theorem Th19: :: ALG_1:19
for b1 being non empty set
for b2 being Equivalence_Relation of b1
for b3 being FinSequence of Class b2 ex b4 being FinSequence of b1 st b4 is_representatives_FS b3
proof end;

definition
let c1 be Universal_Algebra;
let c2 be Congruence of c1;
let c3 be operation of c1;
func QuotOp c3,c2 -> non empty homogeneous quasi_total PartFunc of (Class a2) * , Class a2 means :Def12: :: ALG_1:def 12
( dom a4 = (arity a3) -tuples_on (Class a2) & ( for b1 being FinSequence of Class a2 st b1 in dom a4 holds
for b2 being FinSequence of the carrier of a1 st b2 is_representatives_FS b1 holds
a4 . b1 = Class a2,(a3 . b2) ) );
existence
ex b1 being non empty homogeneous quasi_total PartFunc of (Class c2) * , Class c2 st
( dom b1 = (arity c3) -tuples_on (Class c2) & ( for b2 being FinSequence of Class c2 st b2 in dom b1 holds
for b3 being FinSequence of the carrier of c1 st b3 is_representatives_FS b2 holds
b1 . b2 = Class c2,(c3 . b3) ) )
proof end;
uniqueness
for b1, b2 being non empty homogeneous quasi_total PartFunc of (Class c2) * , Class c2 st dom b1 = (arity c3) -tuples_on (Class c2) & ( for b3 being FinSequence of Class c2 st b3 in dom b1 holds
for b4 being FinSequence of the carrier of c1 st b4 is_representatives_FS b3 holds
b1 . b3 = Class c2,(c3 . b4) ) & dom b2 = (arity c3) -tuples_on (Class c2) & ( for b3 being FinSequence of Class c2 st b3 in dom b2 holds
for b4 being FinSequence of the carrier of c1 st b4 is_representatives_FS b3 holds
b2 . b3 = Class c2,(c3 . b4) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def12 defines QuotOp ALG_1:def 12 :
for b1 being Universal_Algebra
for b2 being Congruence of b1
for b3 being operation of b1
for b4 being non empty homogeneous quasi_total PartFunc of (Class b2) * , Class b2 holds
( b4 = QuotOp b3,b2 iff ( dom b4 = (arity b3) -tuples_on (Class b2) & ( for b5 being FinSequence of Class b2 st b5 in dom b4 holds
for b6 being FinSequence of the carrier of b1 st b6 is_representatives_FS b5 holds
b4 . b5 = Class b2,(b3 . b6) ) ) );

definition
let c1 be Universal_Algebra;
let c2 be Congruence of c1;
func QuotOpSeq c1,c2 -> PFuncFinSequence of (Class a2) means :Def13: :: ALG_1:def 13
( len a3 = len the charact of a1 & ( for b1 being Nat st b1 in dom a3 holds
for b2 being operation of a1 st the charact of a1 . b1 = b2 holds
a3 . b1 = QuotOp b2,a2 ) );
existence
ex b1 being PFuncFinSequence of (Class c2) st
( len b1 = len the charact of c1 & ( for b2 being Nat st b2 in dom b1 holds
for b3 being operation of c1 st the charact of c1 . b2 = b3 holds
b1 . b2 = QuotOp b3,c2 ) )
proof end;
uniqueness
for b1, b2 being PFuncFinSequence of (Class c2) st len b1 = len the charact of c1 & ( for b3 being Nat st b3 in dom b1 holds
for b4 being operation of c1 st the charact of c1 . b3 = b4 holds
b1 . b3 = QuotOp b4,c2 ) & len b2 = len the charact of c1 & ( for b3 being Nat st b3 in dom b2 holds
for b4 being operation of c1 st the charact of c1 . b3 = b4 holds
b2 . b3 = QuotOp b4,c2 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def13 defines QuotOpSeq ALG_1:def 13 :
for b1 being Universal_Algebra
for b2 being Congruence of b1
for b3 being PFuncFinSequence of (Class b2) holds
( b3 = QuotOpSeq b1,b2 iff ( len b3 = len the charact of b1 & ( for b4 being Nat st b4 in dom b3 holds
for b5 being operation of b1 st the charact of b1 . b4 = b5 holds
b3 . b4 = QuotOp b5,b2 ) ) );

theorem Th20: :: ALG_1:20
for b1 being Universal_Algebra
for b2 being Congruence of b1 holds UAStr(# (Class b2),(QuotOpSeq b1,b2) #) is strict Universal_Algebra
proof end;

definition
let c1 be Universal_Algebra;
let c2 be Congruence of c1;
func QuotUnivAlg c1,c2 -> strict Universal_Algebra equals :: ALG_1:def 14
UAStr(# (Class a2),(QuotOpSeq a1,a2) #);
coherence
UAStr(# (Class c2),(QuotOpSeq c1,c2) #) is strict Universal_Algebra
by Th20;
end;

:: deftheorem Def14 defines QuotUnivAlg ALG_1:def 14 :
for b1 being Universal_Algebra
for b2 being Congruence of b1 holds QuotUnivAlg b1,b2 = UAStr(# (Class b2),(QuotOpSeq b1,b2) #);

definition
let c1 be Universal_Algebra;
let c2 be Congruence of c1;
func Nat_Hom c1,c2 -> Function of a1,(QuotUnivAlg a1,a2) means :Def15: :: ALG_1:def 15
for b1 being Element of a1 holds a3 . b1 = Class a2,b1;
existence
ex b1 being Function of c1,(QuotUnivAlg c1,c2) st
for b2 being Element of c1 holds b1 . b2 = Class c2,b2
proof end;
uniqueness
for b1, b2 being Function of c1,(QuotUnivAlg c1,c2) st ( for b3 being Element of c1 holds b1 . b3 = Class c2,b3 ) & ( for b3 being Element of c1 holds b2 . b3 = Class c2,b3 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def15 defines Nat_Hom ALG_1:def 15 :
for b1 being Universal_Algebra
for b2 being Congruence of b1
for b3 being Function of b1,(QuotUnivAlg b1,b2) holds
( b3 = Nat_Hom b1,b2 iff for b4 being Element of b1 holds b3 . b4 = Class b2,b4 );

theorem Th21: :: ALG_1:21
for b1 being Universal_Algebra
for b2 being Congruence of b1 holds Nat_Hom b1,b2 is_homomorphism b1, QuotUnivAlg b1,b2
proof end;

theorem Th22: :: ALG_1:22
for b1 being Universal_Algebra
for b2 being Congruence of b1 holds Nat_Hom b1,b2 is_epimorphism b1, QuotUnivAlg b1,b2
proof end;

definition
let c1, c2 be Universal_Algebra;
let c3 be Function of c1,c2;
assume E28: c3 is_homomorphism c1,c2 ;
func Cng c3 -> Congruence of a1 means :Def16: :: ALG_1:def 16
for b1, b2 being Element of a1 holds
( [b1,b2] in a4 iff a3 . b1 = a3 . b2 );
existence
ex b1 being Congruence of c1 st
for b2, b3 being Element of c1 holds
( [b2,b3] in b1 iff c3 . b2 = c3 . b3 )
proof end;
uniqueness
for b1, b2 being Congruence of c1 st ( for b3, b4 being Element of c1 holds
( [b3,b4] in b1 iff c3 . b3 = c3 . b4 ) ) & ( for b3, b4 being Element of c1 holds
( [b3,b4] in b2 iff c3 . b3 = c3 . b4 ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def16 defines Cng ALG_1:def 16 :
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2 st b3 is_homomorphism b1,b2 holds
for b4 being Congruence of b1 holds
( b4 = Cng b3 iff for b5, b6 being Element of b1 holds
( [b5,b6] in b4 iff b3 . b5 = b3 . b6 ) );

definition
let c1, c2 be Universal_Algebra;
let c3 be Function of c1,c2;
assume E29: c3 is_homomorphism c1,c2 ;
func HomQuot c3 -> Function of (QuotUnivAlg a1,(Cng a3)),a2 means :Def17: :: ALG_1:def 17
for b1 being Element of a1 holds a4 . (Class (Cng a3),b1) = a3 . b1;
existence
ex b1 being Function of (QuotUnivAlg c1,(Cng c3)),c2 st
for b2 being Element of c1 holds b1 . (Class (Cng c3),b2) = c3 . b2
proof end;
uniqueness
for b1, b2 being Function of (QuotUnivAlg c1,(Cng c3)),c2 st ( for b3 being Element of c1 holds b1 . (Class (Cng c3),b3) = c3 . b3 ) & ( for b3 being Element of c1 holds b2 . (Class (Cng c3),b3) = c3 . b3 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def17 defines HomQuot ALG_1:def 17 :
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2 st b3 is_homomorphism b1,b2 holds
for b4 being Function of (QuotUnivAlg b1,(Cng b3)),b2 holds
( b4 = HomQuot b3 iff for b5 being Element of b1 holds b4 . (Class (Cng b3),b5) = b3 . b5 );

theorem Th23: :: ALG_1:23
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2 st b3 is_homomorphism b1,b2 holds
( HomQuot b3 is_homomorphism QuotUnivAlg b1,(Cng b3),b2 & HomQuot b3 is_monomorphism QuotUnivAlg b1,(Cng b3),b2 )
proof end;

theorem Th24: :: ALG_1:24
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2 st b3 is_epimorphism b1,b2 holds
HomQuot b3 is_isomorphism QuotUnivAlg b1,(Cng b3),b2
proof end;

theorem Th25: :: ALG_1:25
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2 st b3 is_epimorphism b1,b2 holds
QuotUnivAlg b1,(Cng b3),b2 are_isomorphic
proof end;