:: ALG_1 semantic presentation

theorem E1: :: 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 holds
( b5 in dom (b4 * b3) implies (b4 * b3) . b5 = b4 . (b3 . b5) ) ) )
proof
let c1, c2 be non empty set ;
let c3 be FinSequence of c1;
let c4 be Function of c1,c2;
E2: rng c3 c= c1 by FINSEQ_1:def 4;
E3: ( dom c4 = c1 & rng c4 c= c2 ) by FUNCT_2:def 1, RELSET_1:12;
then E4: ( rng (c4 * c3) c= rng c4 & dom (c4 * c3) = dom c3 ) by E2, RELAT_1:45, RELAT_1:46;
thus dom (c4 * c3) = dom c3 by E2, E3, RELAT_1:46;
thus len (c4 * c3) = len c3 by E4, FINSEQ_3:31;
let c5 be Nat;
assume c5 in dom (c4 * c3) ;
hence (c4 * c3) . c5 = c4 . (c3 . c5) by FUNCT_1:22;
end;

theorem E2: :: ALG_1:2
for b1 being Universal_Algebra
for b2 being non empty Subset of b1 holds
( b2 = the carrier of b1 implies Opers b1,b2 = the charact of b1 )
proof
let c1 be Universal_Algebra;
let c2 be non empty Subset of c1;
assume E3: c2 = the carrier of c1 ;
E4: dom (Opers c1,c2) = dom the charact of c1 by UNIALG_2:def 7;
now
let c3 be Nat;
assume E5: c3 in dom the charact of c1 ;
then reconsider c4 = the charact of c1 . c3 as operation of c1 by UNIALG_2:6;
thus (Opers c1,c2) . c3 = c4 /. c2 by E4, E5, UNIALG_2:def 7
.= the charact of c1 . c3 by E3, UNIALG_2:7 ;
end;
hence Opers c1,c2 = the charact of c1 by E4, FINSEQ_1:17;
end;

theorem :: 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
let c1, c2 be Universal_Algebra;
let c3 be Function of c1,c2;
set c4 = <*> the carrier of c1;
E3: len (<*> the carrier of c1) = 0 by FINSEQ_1:25;
len (<*> the carrier of c1) = len (c3 * (<*> the carrier of c1)) by E1;
then dom (c3 * (<*> the carrier of c1)) = {} by E3, FINSEQ_1:4, FINSEQ_1:def 3;
hence c3 * (<*> the carrier of c1) = <*> the carrier of c2 by FINSEQ_1:26;
end;

theorem E3: :: ALG_1:4
for b1 being Universal_Algebra
for b2 being FinSequence of b1 holds (id the carrier of b1) * b2 = b2
proof
let c1 be Universal_Algebra;
let c2 be FinSequence of c1;
set c3 = id the carrier of c1;
E4: len ((id the carrier of c1) * c2) = len c2 by E1;
E5: dom ((id the carrier of c1) * c2) = dom c2 by E1;
E6: dom c2 = Seg (len c2) by FINSEQ_1:def 3;
now
let c4 be Nat;
assume E7: c4 in dom c2 ;
then reconsider c5 = c2 . c4 as Element of c1 by FINSEQ_2:13;
(id the carrier of c1) . c5 = c5 by FUNCT_1:35;
hence ((id the carrier of c1) * c2) . c4 = c2 . c4 by E5, E7, E1;
end;
hence (id the carrier of c1) * c2 = c2 by E4, E6, FINSEQ_2:10;
end;

theorem E4: :: 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
let c1, c2, c3 be Universal_Algebra;
let c4 be Function of c1,c2;
let c5 be Function of c2,c3;
let c6 be FinSequence of c1;
E5: len (c5 * (c4 * c6)) = len (c4 * c6) by E1;
E6: dom (c5 * (c4 * c6)) = dom (c4 * c6) by E1;
E7: len (c4 * c6) = len c6 by E1;
E8: dom (c4 * c6) = dom c6 by E1;
E9: len c6 = len ((c5 * c4) * c6) by E1;
E10: dom c6 = dom ((c5 * c4) * c6) by E1;
E11: ( dom c6 = Seg (len c6) & dom (c5 * (c4 * c6)) = Seg (len c6) & dom (c4 * c6) = Seg (len c6) & dom ((c5 * c4) * c6) = Seg (len c6) ) by E6, E8, E9, FINSEQ_1:def 3;
now
let c7 be Nat;
assume E12: c7 in dom c6 ;
then E13: c6 . c7 in the carrier of c1 by FINSEQ_2:13;
thus (c5 * (c4 * c6)) . c7 = c5 . ((c4 * c6) . c7) by E6, E8, E12, E1
.= c5 . (c4 . (c6 . c7)) by E8, E12, E1
.= (c5 * c4) . (c6 . c7) by E13, FUNCT_2:21
.= ((c5 * c4) * c6) . c7 by E10, E12, E1 ;
end;
hence c5 * (c4 * c6) = (c5 * c4) * c6 by E5, E7, E9, E11, FINSEQ_2:10;
end;

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

:: deftheorem E5 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 holds
( b4 in dom the charact of b1 implies for b5 being operation of b1
for b6 being operation of b2 holds
( ( b5 = the charact of b1 . b4 & b6 = the charact of b2 . b4 ) implies ( ( for b7 being FinSequence of b1 holds
( b7 in dom b5 implies 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 :E6: :: ALG_1:def 2
( a3 is_homomorphism a1,a2 & a3 is one-to-one );
pred c3 is_epimorphism c1,c2 means :E7: :: ALG_1:def 3
( a3 is_homomorphism a1,a2 & rng a3 = the carrier of a2 );
end;

:: deftheorem E6 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 E7 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 :E8: :: ALG_1:def 4
( a3 is_monomorphism a1,a2 & a3 is_epimorphism a1,a2 );
end;

:: deftheorem E8 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 :E9: :: ALG_1:def 5
ex b1 being Function of a1,a2 st b1 is_isomorphism a1,a2;
end;

:: deftheorem E9 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 E10: :: ALG_1:6
for b1 being Universal_Algebra holds id the carrier of b1 is_homomorphism b1,b1
proof
let c1 be Universal_Algebra;
thus c1,c1 are_similar ; :: according to ALG_1:def 1
let c2 be Nat;
assume c2 in dom the charact of c1 ;
let c3, c4 be operation of c1;
assume E11: ( c3 = the charact of c1 . c2 & c4 = the charact of c1 . c2 ) ;
let c5 be FinSequence of c1;
assume c5 in dom c3 ;
then ( c3 . c5 in rng c3 & rng c3 c= the carrier of c1 ) by FUNCT_1:def 5, RELSET_1:12;
then reconsider c6 = c3 . c5 as Element of c1 ;
set c7 = id the carrier of c1;
( (id the carrier of c1) * c5 = c5 & (id the carrier of c1) . c6 = c6 ) by E3, FUNCT_1:35;
hence (id the carrier of c1) . (c3 . c5) = c4 . ((id the carrier of c1) * c5) by E11;
end;

theorem E11: :: ALG_1:7
for b1, b2, b3 being Universal_Algebra
for b4 being Function of b1,b2
for b5 being Function of b2,b3 holds
( ( b4 is_homomorphism b1,b2 & b5 is_homomorphism b2,b3 ) implies ( b5 * b4 is_homomorphism b1,b3 ) )
proof
let c1, c2, c3 be Universal_Algebra;
let c4 be Function of c1,c2;
let c5 be Function of c2,c3;
set c6 = signature c1;
set c7 = signature c2;
set c8 = signature c3;
assume E12: ( c4 is_homomorphism c1,c2 & c5 is_homomorphism c2,c3 ) ;
then ( c1,c2 are_similar & c2,c3 are_similar ) by E5;
then E13: ( signature c1 = signature c2 & signature c2 = signature c3 ) by UNIALG_2:def 2;
hence signature c1 = signature c3 ; :: according to UNIALG_2:def 2,ALG_1:def 1
E14: ( len (signature c1) = len the charact of c1 & len (signature c2) = len the charact of c2 ) by UNIALG_1:def 11;
E15: ( dom the charact of c1 = Seg (len the charact of c1) & dom the charact of c2 = Seg (len the charact of c2) & dom (signature c1) = Seg (len (signature c1)) & dom (signature c2) = Seg (len (signature c2)) ) by FINSEQ_1:def 3;
let c9 be Nat;
assume E16: c9 in dom the charact of c1 ;
then reconsider c10 = the charact of c2 . c9 as operation of c2 by E13, E14, E15, UNIALG_2:6;
let c11 be operation of c1;
let c12 be operation of c3;
assume E17: ( c11 = the charact of c1 . c9 & c12 = the charact of c3 . c9 ) ;
let c13 be FinSequence of c1;
assume E18: c13 in dom c11 ;
then E19: ( c11 . c13 in rng c11 & rng c11 c= the carrier of c1 ) by FUNCT_1:def 5, RELSET_1:12;
E20: ( (signature c1) . c9 = arity c11 & (signature c2) . c9 = arity c10 ) by E13, E14, E15, E16, E17, UNIALG_1:def 11;
E21: ( dom c10 = (arity c10) -tuples_on the carrier of c2 & dom c11 = (arity c11) -tuples_on the carrier of c1 ) by UNIALG_2:2;
then c13 in { b1 where B is Element of the carrier of c1 * : len b1 = arity c11 } by E18, FINSEQ_2:def 4;
then consider c14 being Element of the carrier of c1 * such that
E22: ( c14 = c13 & len c14 = arity c11 ) ;
reconsider c15 = c4 * c13 as Element of the carrier of c2 * by FINSEQ_1:def 11;
len (c4 * c13) = arity c10 by E13, E20, E22, E1;
then c15 in { b1 where B is Element of the carrier of c2 * : len b1 = arity c10 } ;
then c4 * c13 in dom c10 by E21, FINSEQ_2:def 4;
then ( c4 . (c11 . c13) = c10 . (c4 * c13) & c5 . (c10 . (c4 * c13)) = c12 . (c5 * (c4 * c13)) ) by E12, E13, E14, E15, E16, E17, E18, E5;
hence (c5 * c4) . (c11 . c13) = c12 . (c5 * (c4 * c13)) by E19, FUNCT_2:21
.= c12 . ((c5 * c4) * c13) by E4 ;

end;

theorem E12: :: 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
let c1, c2 be Universal_Algebra;
let c3 be Function of c1,c2;
thus ( c3 is_isomorphism c1,c2 implies ( c3 is_homomorphism c1,c2 & rng c3 = the carrier of c2 & c3 is one-to-one ) )
proof
assume c3 is_isomorphism c1,c2 ;
then ( c3 is_monomorphism c1,c2 & c3 is_epimorphism c1,c2 ) by E8;
hence ( c3 is_homomorphism c1,c2 & rng c3 = the carrier of c2 & c3 is one-to-one ) by E6, E7;
end;
assume ( c3 is_homomorphism c1,c2 & rng c3 = the carrier of c2 & c3 is one-to-one ) ;
then ( c3 is_monomorphism c1,c2 & c3 is_epimorphism c1,c2 ) by E6, E7;
hence c3 is_isomorphism c1,c2 by E8;
end;

theorem E13: :: ALG_1:9
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2 holds
( b3 is_isomorphism b1,b2 implies ( dom b3 = the carrier of b1 & rng b3 = the carrier of b2 ) )
proof
let c1, c2 be Universal_Algebra;
let c3 be Function of c1,c2;
assume c3 is_isomorphism c1,c2 ;
then c3 is_epimorphism c1,c2 by E8;
hence ( dom c3 = the carrier of c1 & rng c3 = the carrier of c2 ) by E7, FUNCT_2:def 1;
end;

theorem E14: :: ALG_1:10
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2
for b4 being Function of b2,b1 holds
( ( b3 is_isomorphism b1,b2 & b4 = b3 " ) implies ( b4 is_homomorphism b2,b1 ) )
proof
let c1, c2 be Universal_Algebra;
let c3 be Function of c1,c2;
let c4 be Function of c2,c1;
assume E15: ( c3 is_isomorphism c1,c2 & c4 = c3 " ) ;
then E16: ( c3 is_homomorphism c1,c2 & rng c3 = the carrier of c2 & c3 is one-to-one ) by E12;
then E17: c1,c2 are_similar by E5;
then E18: signature c1 = signature c2 by UNIALG_2:def 2;
E19: ( len (signature c1) = len the charact of c1 & len (signature c2) = len the charact of c2 ) by UNIALG_1:def 11;
E20: ( dom (signature c1) = dom (signature c1) & dom (signature c2) = Seg (len (signature c2)) & dom the charact of c1 = Seg (len the charact of c1) & dom the charact of c2 = Seg (len the charact of c2) ) by FINSEQ_1:def 3;
now
let c5 be Nat;
assume E21: c5 in dom the charact of c2 ;
let c6 be operation of c2;
let c7 be operation of c1;
assume E22: ( c6 = the charact of c2 . c5 & c7 = the charact of c1 . c5 ) ;
let c8 be FinSequence of c2;
assume c8 in dom c6 ;
then c8 in (arity c6) -tuples_on the carrier of c2 by UNIALG_2:2;
then c8 in { b1 where B is Element of the carrier of c2 * : len b1 = arity c6 } by FINSEQ_2:def 4;
then consider c9 being Element of the carrier of c2 * such that
E23: ( c8 = c9 & len c9 = arity c6 ) ;
defpred S1[ set , set ] means c3 . a2 = c8 . a1;
E24: for b1 being Nat holds
not ( b1 in Seg (len c8) & ( for b2 being Element of c1 holds
not S1[b1,b2] ) )
proof
let c10 be Nat;
assume c10 in Seg (len c8) ;
then c10 in dom c8 by FINSEQ_1:def 3;
then c8 . c10 in the carrier of c2 by FINSEQ_2:13;
then consider c11 being set such that
E25: ( c11 in dom c3 & c3 . c11 = c8 . c10 ) by E16, FUNCT_1:def 5;
reconsider c12 = c11 as Element of c1 by E25;
take c12 ;
thus S1[c10,c12] by E25;
end;
consider c10 being FinSequence of c1 such that
E25: ( dom c10 = Seg (len c8) & ( for b1 being Nat holds
( b1 in Seg (len c8) implies S1[b1,c10 . b1] ) ) ) from FINSEQ_1:sch 5(E24);
E26: c4 * c3 = id (dom c3) by E15, E16, FUNCT_1:61
.= id the carrier of c1 by FUNCT_2:def 1 ;
E27: ( len c10 = len c8 & dom c8 = Seg (len c8) & dom (c3 * c10) = dom c10 ) by E25, E1, FINSEQ_1:def 3;
now
let c11 be Nat;
assume E28: c11 in dom c8 ;
hence c8 . c11 = c3 . (c10 . c11) by E25, E27
.= (c3 * c10) . c11 by E25, E27, E28, E1 ;

end;
then E28: c8 = c3 * c10 by E25, E27, FINSEQ_1:17;
then E29: c4 * c8 = (id the carrier of c1) * c10 by E26, E4
.= c10 by E3 ;
reconsider c11 = c10 as Element of the carrier of c1 * by FINSEQ_1:def 11;
( (signature c1) . c5 = arity c7 & (signature c2) . c5 = arity c6 ) by E18, E19, E20, E21, E22, UNIALG_1:def 11;
then c11 in { b1 where B is Element of the carrier of c1 * : len b1 = arity c7 } by E18, E23, E27;
then c11 in (arity c7) -tuples_on the carrier of c1 by FINSEQ_2:def 4;
then E30: c11 in dom c7 by UNIALG_2:2;
then E31: c4 . (c6 . c8) = c4 . (c3 . (c7 . c11)) by E16, E18, E19, E20, E21, E22, E28, E5;
E32: c7 . c11 in the carrier of c1 by E30, PARTFUN1:27;
then c7 . c11 in dom c3 by FUNCT_2:def 1;
hence c4 . (c6 . c8) = (id the carrier of c1) . (c7 . c11) by E26, E31, FUNCT_1:23
.= c7 . (c4 * c8) by E29, E32, FUNCT_1:34 ;

end;
hence c4 is_homomorphism c2,c1 by E17, E5;
end;

theorem E15: :: ALG_1:11
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2
for b4 being Function of b2,b1 holds
( ( b3 is_isomorphism b1,b2 & b4 = b3 " ) implies ( b4 is_isomorphism b2,b1 ) )
proof
let c1, c2 be Universal_Algebra;
let c3 be Function of c1,c2;
let c4 be Function of c2,c1;
assume E16: ( c3 is_isomorphism c1,c2 & c4 = c3 " ) ;
then E17: c3 is one-to-one by E12;
then E18: c4 is one-to-one by E16, FUNCT_1:62;
E19: rng c4 = dom c3 by E16, E17, FUNCT_1:55
.= the carrier of c1 by FUNCT_2:def 1 ;
c4 is_homomorphism c2,c1 by E16, E14;
hence c4 is_isomorphism c2,c1 by E18, E19, E12;
end;

theorem E16: :: ALG_1:12
for b1, b2, b3 being Universal_Algebra
for b4 being Function of b1,b2
for b5 being Function of b2,b3 holds
( ( b4 is_isomorphism b1,b2 & b5 is_isomorphism b2,b3 ) implies ( b5 * b4 is_isomorphism b1,b3 ) )
proof
let c1, c2, c3 be Universal_Algebra;
let c4 be Function of c1,c2;
let c5 be Function of c2,c3;
assume E17: ( c4 is_isomorphism c1,c2 & c5 is_isomorphism c2,c3 ) ;
then E18: ( c4 is one-to-one & c5 is one-to-one ) by E12;
E19: rng (c5 * c4) = the carrier of c3
proof
E20: dom c5 = the carrier of c2 by FUNCT_2:def 1;
rng c4 = the carrier of c2 by E17, E13;
hence rng (c5 * c4) = rng c5 by E20, RELAT_1:47
.= the carrier of c3 by E17, E13 ;

end;
E20: c5 * c4 is one-to-one by E18, FUNCT_1:46;
( c4 is_homomorphism c1,c2 & c5 is_homomorphism c2,c3 ) by E17, E12;
then c5 * c4 is_homomorphism c1,c3 by E11;
hence c5 * c4 is_isomorphism c1,c3 by E19, E20, E12;
end;

theorem :: ALG_1:13
for b1 being Universal_Algebra holds b1,b1 are_isomorphic
proof
let c1 be Universal_Algebra;
set c2 = id the carrier of c1;
E17: id the carrier of c1 is_homomorphism c1,c1 by E10;
( id the carrier of c1 is one-to-one & rng (id the carrier of c1) = the carrier of c1 ) by RELAT_1:71;
then id the carrier of c1 is_isomorphism c1,c1 by E17, E12;
hence c1,c1 are_isomorphic by E9;
end;

theorem :: ALG_1:14
for b1, b2 being Universal_Algebra holds
( b1,b2 are_isomorphic implies b2,b1 are_isomorphic )
proof
let c1, c2 be Universal_Algebra;
assume c1,c2 are_isomorphic ;
then consider c3 being Function of c1,c2 such that
E17: c3 is_isomorphism c1,c2 by E9;
E18: c3 is_epimorphism c1,c2 by E17, E8;
c3 is_monomorphism c1,c2 by E17, E8;
then E19: c3 is one-to-one by E6;
then E20: dom (c3 " ) = rng c3 by FUNCT_1:55
.= the carrier of c2 by E18, E7 ;
rng (c3 " ) = dom c3 by E19, FUNCT_1:55
.= the carrier of c1 by FUNCT_2:def 1 ;
then reconsider c4 = c3 " as Function of c2,c1 by E20, FUNCT_2:def 1, RELSET_1:11;
take c4 ; :: according to ALG_1:def 5
thus c4 is_isomorphism c2,c1 by E17, E15;
end;

theorem :: ALG_1:15
for b1, b2, b3 being Universal_Algebra holds
( ( b1,b2 are_isomorphic & b2,b3 are_isomorphic ) implies ( b1,b3 are_isomorphic ) )
proof
let c1, c2, c3 be Universal_Algebra;
assume E17: c1,c2 are_isomorphic ;
assume E18: c2,c3 are_isomorphic ;
consider c4 being Function of c1,c2 such that
E19: c4 is_isomorphism c1,c2 by E17, E9;
consider c5 being Function of c2,c3 such that
E20: c5 is_isomorphism c2,c3 by E18, E9;
c5 * c4 is_isomorphism c1,c3 by E19, E20, E16;
hence c1,c3 are_isomorphic by E9;
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 :E17: :: 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
E18: dom c3 = the carrier of c1 by FUNCT_2:def 1;
then reconsider c4 = c3 .: the carrier of c1 as non empty Subset of c2 by RELAT_1:152;
take c5 = UniAlgSetClosed c4;
c4 is opers_closed
proof
let c6 be operation of c2; :: according to UNIALG_2:def 5
consider c7 being Nat such that
E19: ( c7 in dom the charact of c2 & the charact of c2 . c7 = c6 ) by FINSEQ_2:11;
E20: c1,c2 are_similar by E17, E5;
then E21: signature c1 = signature c2 by UNIALG_2:def 2;
E22: ( len (signature c1) = len the charact of c1 & len (signature c2) = len the charact of c2 ) by UNIALG_1:def 11;
E23: ( dom the charact of c1 = Seg (len the charact of c1) & dom the charact of c2 = Seg (len the charact of c2) & dom (signature c1) = Seg (len (signature c1)) & dom (signature c1) = dom (signature c2) & dom (signature c2) = Seg (len (signature c2)) ) by E20, FINSEQ_1:def 3, UNIALG_2:def 2;
then reconsider c8 = the charact of c1 . c7 as operation of c1 by E19, E22, UNIALG_2:6;
let c9 be FinSequence of c4; :: according to UNIALG_2:def 4
assume E24: len c9 = arity c6 ;
E25: ( (signature c1) . c7 = arity c8 & (signature c2) . c7 = arity c6 ) by E19, E22, E23, UNIALG_1:def 11;
defpred S1[ set , set ] means c3 . a2 = c9 . a1;
E26: for b1 being set holds
not ( b1 in dom c9 & ( for b2 being set holds
not ( b2 in the carrier of c1 & S1[b1,b2] ) ) )
proof
let c10 be set ;
assume E27: c10 in dom c9 ;
then reconsider c11 = c10 as Nat ;
c9 . c11 in c4 by E27, FINSEQ_2:13;
then consider c12 being set such that
E28: ( c12 in dom c3 & c12 in the carrier of c1 & c3 . c12 = c9 . c11 ) by FUNCT_1:def 12;
take c12 ;
thus ( c12 in the carrier of c1 & S1[c10,c12] ) by E28;
end;
consider c10 being Function such that
E27: ( dom c10 = dom c9 & rng c10 c= the carrier of c1 & ( for b1 being set holds
( b1 in dom c9 implies S1[b1,c10 . b1] ) ) ) from WELLORD2:sch 1(E26);
dom c10 = Seg (len c9) by E27, FINSEQ_1:def 3;
then reconsider c11 = c10 as FinSequence by FINSEQ_1:def 2;
reconsider c12 = c11 as FinSequence of c1 by E27, FINSEQ_1:def 4;
reconsider c13 = c12 as Element of the carrier of c1 * by FINSEQ_1:def 11;
E28: len c13 = len c9 by E27, FINSEQ_3:31;
then c13 in { b1 where B is Element of the carrier of c1 * : len b1 = arity c8 } by E21, E24, E25;
then c13 in (arity c8) -tuples_on the carrier of c1 by FINSEQ_2:def 4;
then E29: c13 in dom c8 by UNIALG_2:2;
then E30: c3 . (c8 . c13) = c6 . (c3 * c13) by E17, E19, E22, E23, E5;
E31: len (c3 * c13) = len c13 by E1;
E32: dom (c3 * c13) = Seg (len (c3 * c13)) by FINSEQ_1:def 3;
now
let c14 be Nat;
assume E33: c14 in Seg (len c13) ;
then c14 in dom c13 by FINSEQ_1:def 3;
then c3 . (c13 . c14) = c9 . c14 by E27;
hence (c3 * c13) . c14 = c9 . c14 by E31, E32, E33, E1;
end;
then E33: c9 = c3 * c13 by E28, E31, FINSEQ_2:10;
( rng c8 c= the carrier of c1 & c8 . c13 in rng c8 ) by E29, FUNCT_1:def 5, RELSET_1:12;
hence c6 . c9 in c4 by E18, E30, E33, FUNCT_1:def 12;
end;
then c5 = UAStr(# c4,(Opers c2,c4) #) by UNIALG_2:def 9;
hence the carrier of c5 = c3 .: the carrier of c1 ;
end;
uniqueness
for b1, b2 being strict SubAlgebra of c2 holds
( ( the carrier of b1 = c3 .: the carrier of c1 & the carrier of b2 = c3 .: the carrier of c1 ) implies ( b1 = b2 ) )
proof
let c4, c5 be strict SubAlgebra of c2;
assume E18: ( the carrier of c4 = c3 .: the carrier of c1 & the carrier of c5 = c3 .: the carrier of c1 ) ;
reconsider c6 = the carrier of c4, c7 = the carrier of c5 as non empty Subset of c2 by UNIALG_2:def 8;
( the charact of c4 = Opers c2,c6 & the charact of c5 = Opers c2,c7 ) by UNIALG_2:def 8;
hence c4 = c5 by E18;
end;
end;

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

theorem :: ALG_1:16
for b1, b2 being Universal_Algebra
for b3 being Function of b1,b2 holds
( b3 is_homomorphism b1,b2 implies rng b3 = the carrier of (Image b3) )
proof
let c1, c2 be Universal_Algebra;
let c3 be Function of c1,c2;
assume E18: c3 is_homomorphism c1,c2 ;
dom c3 = the carrier of c1 by FUNCT_2:def 1;
then rng c3 = c3 .: the carrier of c1 by RELAT_1:146;
hence rng c3 = the carrier of (Image c3) by E18, E17;
end;

theorem :: ALG_1:17
for b1 being Universal_Algebra
for b2 being strict Universal_Algebra
for b3 being Function of b1,b2 holds
( b3 is_homomorphism b1,b2 implies ( b3 is_epimorphism b1,b2 iff Image b3 = b2 ) )
proof
let c1 be Universal_Algebra;
let c2 be strict Universal_Algebra;
let c3 be Function of c1,c2;
assume E18: c3 is_homomorphism c1,c2 ;
thus ( c3 is_epimorphism c1,c2 implies Image c3 = c2 )
proof
assume c3 is_epimorphism c1,c2 ;
then E19: the carrier of c2 = rng c3 by E7
.= c3 .: (dom c3) by RELAT_1:146
.= c3 .: the carrier of c1 by FUNCT_2:def 1
.= the carrier of (Image c3) by E18, E17 ;
reconsider c4 = the carrier of (Image c3) as non empty Subset of c2 by UNIALG_2:def 8;
the charact of (Image c3) = Opers c2,c4 by UNIALG_2:def 8;
hence Image c3 = c2 by E19, E2;
end;
assume Image c3 = c2 ;
then the carrier of c2 = c3 .: the carrier of c1 by E18, E17
.= c3 .: (dom c3) by FUNCT_2:def 1
.= rng c3 by RELAT_1:146 ;
hence c3 is_epimorphism c1,c2 by E18, E7;
end;

definition
let c1 be 1-sorted ;
mode Relation is Relation of the carrier of a1;
mode Equivalence_Relation 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 :E18: :: 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 holds
( b3 in dom b1 implies [(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 holds
( b4 in dom b2 implies [(b2 . b4),(b3 . b4)] in c2 ) ) ) )
proof
defpred S1[ set , set ] means for b1, b2 being FinSequence of c1 holds
( ( b1 = a1 & b2 = a2 ) implies ( ( len b1 = len b2 & ( for b3 being Nat holds
( b3 in dom b1 implies [(b1 . b3),(b2 . b3)] in c2 ) ) ) ) );
consider c3 being Relation of c1 * ,c1 * such that
E18: for b1, b2 being set holds
( [b1,b2] in c3 iff ( b1 in c1 * & b2 in c1 * & S1[b1,b2] ) ) from RELSET_1:sch 1();
take c3 ;
let c4, c5 be FinSequence of c1;
thus ( [c4,c5] in c3 implies ( len c4 = len c5 & ( for b1 being Nat holds
( b1 in dom c4 implies [(c4 . b1),(c5 . b1)] in c2 ) ) ) ) by E18;
assume E19: ( len c4 = len c5 & ( for b1 being Nat holds
( b1 in dom c4 implies [(c4 . b1),(c5 . b1)] in c2 ) ) ) ;
E20: ( c4 in c1 * & c5 in c1 * ) by FINSEQ_1:def 11;
S1[c4,c5] by E19;
hence [c4,c5] in c3 by E18, E20;
end;
uniqueness
for b1, b2 being Relation of c1 * holds
( ( ( for b3, b4 being FinSequence of c1 holds
( [b3,b4] in b1 iff ( len b3 = len b4 & ( for b5 being Nat holds
( b5 in dom b3 implies [(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 holds
( b5 in dom b3 implies [(b3 . b5),(b4 . b5)] in c2 ) ) ) ) ) ) implies ( b1 = b2 ) )
proof
let c3, c4 be Relation of c1 * ;
assume that
E18: for b1, b2 being FinSequence of c1 holds
( [b1,b2] in c3 iff ( len b1 = len b2 & ( for b3 being Nat holds
( b3 in dom b1 implies [(b1 . b3),(b2 . b3)] in c2 ) ) ) ) and
E19: for b1, b2 being FinSequence of c1 holds
( [b1,b2] in c4 iff ( len b1 = len b2 & ( for b3 being Nat holds
( b3 in dom b1 implies [(b1 . b3),(b2 . b3)] in c2 ) ) ) ) ;
for b1, b2 being set holds
( [b1,b2] in c3 iff [b1,b2] in c4 )
proof
let c5, c6 be set ;
thus ( [c5,c6] in c3 implies [c5,c6] in c4 )
proof
assume E20: [c5,c6] in c3 ;
then reconsider c7 = c5, c8 = c6 as Element of c1 * by ZFMISC_1:106;
( len c7 = len c8 & ( for b1 being Nat holds
( b1 in dom c7 implies [(c7 . b1),(c8 . b1)] in c2 ) ) ) by E18, E20;
hence [c5,c6] in c4 by E19;
end;
assume E20: [c5,c6] in c4 ;
then reconsider c7 = c5, c8 = c6 as Element of c1 * by ZFMISC_1:106;
( len c7 = len c8 & ( for b1 being Nat holds
( b1 in dom c7 implies [(c7 . b1),(c8 . b1)] in c2 ) ) ) by E19, E20;
hence [c5,c6] in c3 by E18;
end;
hence c3 = c4 by RELAT_1:def 2;
end;
end;

:: deftheorem ALG_1:def 7 :
canceled;

:: deftheorem ALG_1:def 8 :
canceled;

:: deftheorem E18 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 holds
( b6 in dom b4 implies [(b4 . b6),(b5 . b6)] in b2 ) ) ) ) );

theorem E19: :: ALG_1:18
for b1 being non empty set holds ExtendRel (id b1) = id (b1 * )
proof
let c1 be non empty set ;
set c2 = ExtendRel (id c1);
set c3 = id (c1 * );
for b1, b2 being set holds
( [b1,b2] in ExtendRel (id c1) iff [b1,b2] in id (c1 * ) )
proof
let c4, c5 be set ;
thus ( [c4,c5] in ExtendRel (id c1) implies [c4,c5] in id (c1 * ) )
proof
assume E20: [c4,c5] in ExtendRel (id c1) ;
then reconsider c6 = c4, c7 = c5 as Element of c1 * by ZFMISC_1:106;
E21: ( len c6 = len c7</