:: ENDALG semantic presentation

definition
let c1 be Universal_Algebra;
func UAEnd c1 -> FUNCTION_DOMAIN of the carrier of a1,the carrier of a1 means :Def1: :: ENDALG:def 1
for b1 being Function of a1,a1 holds
( b1 in a2 iff b1 is_homomorphism a1,a1 );
existence
ex b1 being FUNCTION_DOMAIN of the carrier of c1,the carrier of c1 st
for b2 being Function of c1,c1 holds
( b2 in b1 iff b2 is_homomorphism c1,c1 )
proof end;
uniqueness
for b1, b2 being FUNCTION_DOMAIN of the carrier of c1,the carrier of c1 st ( for b3 being Function of c1,c1 holds
( b3 in b1 iff b3 is_homomorphism c1,c1 ) ) & ( for b3 being Function of c1,c1 holds
( b3 in b2 iff b3 is_homomorphism c1,c1 ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def1 defines UAEnd ENDALG:def 1 :
for b1 being Universal_Algebra
for b2 being FUNCTION_DOMAIN of the carrier of b1,the carrier of b1 holds
( b2 = UAEnd b1 iff for b3 being Function of b1,b1 holds
( b3 in b2 iff b3 is_homomorphism b1,b1 ) );

theorem Th1: :: ENDALG:1
for b1 being Universal_Algebra holds UAEnd b1 c= Funcs the carrier of b1,the carrier of b1
proof end;

theorem Th2: :: ENDALG:2
canceled;

theorem Th3: :: ENDALG:3
for b1 being Universal_Algebra holds id the carrier of b1 in UAEnd b1
proof end;

theorem Th4: :: ENDALG:4
for b1 being Universal_Algebra
for b2, b3 being Element of UAEnd b1 holds b2 * b3 in UAEnd b1
proof end;

definition
let c1 be Universal_Algebra;
func UAEndComp c1 -> BinOp of UAEnd a1 means :Def2: :: ENDALG:def 2
for b1, b2 being Element of UAEnd a1 holds a2 . b1,b2 = b2 * b1;
existence
ex b1 being BinOp of UAEnd c1 st
for b2, b3 being Element of UAEnd c1 holds b1 . b2,b3 = b3 * b2
proof end;
uniqueness
for b1, b2 being BinOp of UAEnd c1 st ( for b3, b4 being Element of UAEnd c1 holds b1 . b3,b4 = b4 * b3 ) & ( for b3, b4 being Element of UAEnd c1 holds b2 . b3,b4 = b4 * b3 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def2 defines UAEndComp ENDALG:def 2 :
for b1 being Universal_Algebra
for b2 being BinOp of UAEnd b1 holds
( b2 = UAEndComp b1 iff for b3, b4 being Element of UAEnd b1 holds b2 . b3,b4 = b4 * b3 );

definition
let c1 be Universal_Algebra;
func UAEndMonoid c1 -> strict multLoopStr means :Def3: :: ENDALG:def 3
( the carrier of a2 = UAEnd a1 & the mult of a2 = UAEndComp a1 & the unity of a2 = id the carrier of a1 );
existence
ex b1 being strict multLoopStr st
( the carrier of b1 = UAEnd c1 & the mult of b1 = UAEndComp c1 & the unity of b1 = id the carrier of c1 )
proof end;
uniqueness
for b1, b2 being strict multLoopStr st the carrier of b1 = UAEnd c1 & the mult of b1 = UAEndComp c1 & the unity of b1 = id the carrier of c1 & the carrier of b2 = UAEnd c1 & the mult of b2 = UAEndComp c1 & the unity of b2 = id the carrier of c1 holds
b1 = b2
;
end;

:: deftheorem Def3 defines UAEndMonoid ENDALG:def 3 :
for b1 being Universal_Algebra
for b2 being strict multLoopStr holds
( b2 = UAEndMonoid b1 iff ( the carrier of b2 = UAEnd b1 & the mult of b2 = UAEndComp b1 & the unity of b2 = id the carrier of b1 ) );

registration
let c1 be Universal_Algebra;
cluster UAEndMonoid a1 -> non empty strict ;
coherence
not UAEndMonoid c1 is empty
proof end;
end;

E6: now
let c1 be Universal_Algebra;
set c2 = UAEndMonoid c1;
let c3, c4 be Element of (UAEndMonoid c1);
assume E7: c4 = id the carrier of c1 ;
reconsider c5 = c4, c6 = c3 as Element of UAEnd c1 by Def3;
thus c3 * c4 = the mult of (UAEndMonoid c1) . c3,c4
.= (UAEndComp c1) . c6,c5 by Def3
.= c5 * c6 by Def2
.= c3 by E7, FUNCT_2:74 ;
thus c4 * c3 = the mult of (UAEndMonoid c1) . c4,c3
.= (UAEndComp c1) . c5,c6 by Def3
.= c6 * c5 by Def2
.= c3 by E7, FUNCT_2:74 ;
end;

registration
let c1 be Universal_Algebra;
cluster UAEndMonoid a1 -> non empty unital associative strict ;
coherence
( UAEndMonoid c1 is unital & UAEndMonoid c1 is associative )
proof end;
end;

theorem Th5: :: ENDALG:5
for b1 being Universal_Algebra
for b2, b3 being Element of (UAEndMonoid b1)
for b4, b5 being Element of UAEnd b1 st b2 = b4 & b3 = b5 holds
b2 * b3 = b5 * b4
proof end;

theorem Th6: :: ENDALG:6
for b1 being Universal_Algebra holds id the carrier of b1 = 1. (UAEndMonoid b1)
proof end;

definition
let c1 be non empty non void ManySortedSign ;
let c2 be non-empty MSAlgebra of c1;
func MSAEnd c2 -> MSFunctionSet of the Sorts of a2,the Sorts of a2 means :Def4: :: ENDALG:def 4
( ( for b1 being Element of a3 holds b1 is ManySortedFunction of a2,a2 ) & ( for b1 being ManySortedFunction of a2,a2 holds
( b1 in a3 iff b1 is_homomorphism a2,a2 ) ) );
existence
ex b1 being MSFunctionSet of the Sorts of c2,the Sorts of c2 st
( ( for b2 being Element of b1 holds b2 is ManySortedFunction of c2,c2 ) & ( for b2 being ManySortedFunction of c2,c2 holds
( b2 in b1 iff b2 is_homomorphism c2,c2 ) ) )
proof end;
uniqueness
for b1, b2 being MSFunctionSet of the Sorts of c2,the Sorts of c2 st ( for b3 being Element of b1 holds b3 is ManySortedFunction of c2,c2 ) & ( for b3 being ManySortedFunction of c2,c2 holds
( b3 in b1 iff b3 is_homomorphism c2,c2 ) ) & ( for b3 being Element of b2 holds b3 is ManySortedFunction of c2,c2 ) & ( for b3 being ManySortedFunction of c2,c2 holds
( b3 in b2 iff b3 is_homomorphism c2,c2 ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def4 defines MSAEnd ENDALG:def 4 :
for b1 being non empty non void ManySortedSign
for b2 being non-empty MSAlgebra of b1
for b3 being MSFunctionSet of the Sorts of b2,the Sorts of b2 holds
( b3 = MSAEnd b2 iff ( ( for b4 being Element of b3 holds b4 is ManySortedFunction of b2,b2 ) & ( for b4 being ManySortedFunction of b2,b2 holds
( b4 in b3 iff b4 is_homomorphism b2,b2 ) ) ) );

theorem Th7: :: ENDALG:7
canceled;

theorem Th8: :: ENDALG:8
canceled;

theorem Th9: :: ENDALG:9
for b1 being non empty non void ManySortedSign
for b2 being non-empty MSAlgebra of b1 holds MSAEnd b2 c= product (MSFuncs the Sorts of b2,the Sorts of b2)
proof end;

theorem Th10: :: ENDALG:10
for b1 being non empty non void ManySortedSign
for b2 being non-empty MSAlgebra of b1 holds id the Sorts of b2 in MSAEnd b2
proof end;

theorem Th11: :: ENDALG:11
for b1 being non empty non void ManySortedSign
for b2 being non-empty MSAlgebra of b1
for b3, b4 being Element of MSAEnd b2 holds b3 ** b4 in MSAEnd b2
proof end;

theorem Th12: :: ENDALG:12
for b1 being Universal_Algebra
for b2 being ManySortedFunction of (MSAlg b1),(MSAlg b1)
for b3 being Element of UAEnd b1 st b2 = {0} --> b3 holds
b2 in MSAEnd (MSAlg b1)
proof end;

definition
let c1 be non empty non void ManySortedSign ;
let c2 be non-empty MSAlgebra of c1;
func MSAEndComp c2 -> BinOp of MSAEnd a2 means :Def5: :: ENDALG:def 5
for b1, b2 being Element of MSAEnd a2 holds a3 . b1,b2 = b2 ** b1;
existence
ex b1 being BinOp of MSAEnd c2 st
for b2, b3 being Element of MSAEnd c2 holds b1 . b2,b3 = b3 ** b2
proof end;
uniqueness
for b1, b2 being BinOp of MSAEnd c2 st ( for b3, b4 being Element of MSAEnd c2 holds b1 . b3,b4 = b4 ** b3 ) & ( for b3, b4 being Element of MSAEnd c2 holds b2 . b3,b4 = b4 ** b3 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def5 defines MSAEndComp ENDALG:def 5 :
for b1 being non empty non void ManySortedSign
for b2 being non-empty MSAlgebra of b1
for b3 being BinOp of MSAEnd b2 holds
( b3 = MSAEndComp b2 iff for b4, b5 being Element of MSAEnd b2 holds b3 . b4,b5 = b5 ** b4 );

definition
let c1 be non empty non void ManySortedSign ;
let c2 be non-empty MSAlgebra of c1;
func MSAEndMonoid c2 -> strict multLoopStr means :Def6: :: ENDALG:def 6
( the carrier of a3 = MSAEnd a2 & the mult of a3 = MSAEndComp a2 & the unity of a3 = id the Sorts of a2 );
existence
ex b1 being strict multLoopStr st
( the carrier of b1 = MSAEnd c2 & the mult of b1 = MSAEndComp c2 & the unity of b1 = id the Sorts of c2 )
proof end;
uniqueness
for b1, b2 being strict multLoopStr st the carrier of b1 = MSAEnd c2 & the mult of b1 = MSAEndComp c2 & the unity of b1 = id the Sorts of c2 & the carrier of b2 = MSAEnd c2 & the mult of b2 = MSAEndComp c2 & the unity of b2 = id the Sorts of c2 holds
b1 = b2
;
end;

:: deftheorem Def6 defines MSAEndMonoid ENDALG:def 6 :
for b1 being non empty non void ManySortedSign
for b2 being non-empty MSAlgebra of b1
for b3 being strict multLoopStr holds
( b3 = MSAEndMonoid b2 iff ( the carrier of b3 = MSAEnd b2 & the mult of b3 = MSAEndComp b2 & the unity of b3 = id the Sorts of b2 ) );

registration
let c1 be non empty non void ManySortedSign ;
let c2 be non-empty MSAlgebra of c1;
cluster MSAEndMonoid a2 -> non empty strict ;
coherence
not MSAEndMonoid c2 is empty
proof end;
end;

E15: now
let c1 be non empty non void ManySortedSign ;
let c2 be non-empty MSAlgebra of c1;
set c3 = MSAEndMonoid c2;
let c4, c5 be Element of (MSAEndMonoid c2);
assume E16: c5 = id the Sorts of c2 ;
reconsider c6 = c5, c7 = c4 as Element of MSAEnd c2 by Def6;
thus c4 * c5 = the mult of (MSAEndMonoid c2) . c4,c5
.= (MSAEndComp c2) . c7,c6 by Def6
.= c6 ** c7 by Def5
.= c4 by E16, MSUALG_3:4 ;
thus c5 * c4 = the mult of (MSAEndMonoid c2) . c5,c4
.= (MSAEndComp c2) . c6,c7 by Def6
.= c7 ** c6 by Def5
.= c4 by E16, MSUALG_3:3 ;
end;

registration
let c1 be non empty non void ManySortedSign ;
let c2 be non-empty MSAlgebra of c1;
cluster MSAEndMonoid a2 -> non empty unital associative strict ;
coherence
( MSAEndMonoid c2 is unital & MSAEndMonoid c2 is associative )
proof end;
end;

theorem Th13: :: ENDALG:13
for b1 being non empty non void ManySortedSign
for b2 being non-empty MSAlgebra of b1
for b3, b4 being Element of (MSAEndMonoid b2)
for b5, b6 being Element of MSAEnd b2 st b3 = b5 & b4 = b6 holds
b3 * b4 = b6 ** b5
proof end;

theorem Th14: :: ENDALG:14
for b1 being non empty non void ManySortedSign
for b2 being non-empty MSAlgebra of b1 holds id the Sorts of b2 = 1. (MSAEndMonoid b2)
proof end;

theorem Th15: :: ENDALG:15
canceled;

theorem Th16: :: ENDALG:16
for b1 being Universal_Algebra
for b2 being Element of UAEnd b1 holds {0} --> b2 is ManySortedFunction of (MSAlg b1),(MSAlg b1)
proof end;

Lemma19: for b1 being Universal_Algebra
for b2 being Function st dom b2 = UAEnd b1 & ( for b3 being set st b3 in UAEnd b1 holds
b2 . b3 = {0} --> b3 ) holds
rng b2 = MSAEnd (MSAlg b1)
proof end;

definition
let c1, c2 be non empty multLoopStr ;
let c3 be Function of c1,c2;
canceled;
attr a3 is unity-preserving means :Def8: :: ENDALG:def 8
a3 . (1. a1) = 1. a2;
end;

:: deftheorem Def7 ENDALG:def 7 :
canceled;

:: deftheorem Def8 defines unity-preserving ENDALG:def 8 :
for b1, b2 being non empty multLoopStr
for b3 being Function of b1,b2 holds
( b3 is unity-preserving iff b3 . (1. b1) = 1. b2 );

registration
cluster non empty left_unital multLoopStr ;
existence
ex b1 being non empty multLoopStr st b1 is left_unital
proof end;
end;

registration
let c1, c2 be non empty left_unital multLoopStr ;
cluster multiplicative unity-preserving M4(the carrier of a1,the carrier of a2);
existence
ex b1 being Function of c1,c2 st
( b1 is multiplicative & b1 is unity-preserving )
proof end;
end;

definition
let c1, c2 be non empty left_unital multLoopStr ;
mode Homomorphism of a1,a2 is multiplicative unity-preserving Function of a1,a2;
end;

definition
let c1, c2 be non empty left_unital multLoopStr ;
let c3 be Function of c1,c2;
pred c3 is_monomorphism means :Def9: :: ENDALG:def 9
a3 is one-to-one;
pred c3 is_epimorphism means :Def10: :: ENDALG:def 10
rng a3 = the carrier of a2;
end;

:: deftheorem Def9 defines is_monomorphism ENDALG:def 9 :
for b1, b2 being non empty left_unital multLoopStr
for b3 being Function of b1,b2 holds
( b3 is_monomorphism iff b3 is one-to-one );

:: deftheorem Def10 defines is_epimorphism ENDALG:def 10 :
for b1, b2 being non empty left_unital multLoopStr
for b3 being Function of b1,b2 holds
( b3 is_epimorphism iff rng b3 = the carrier of b2 );

definition
let c1, c2 be non empty left_unital multLoopStr ;
let c3 be Function of c1,c2;
pred c3 is_isomorphism means :Def11: :: ENDALG:def 11
( a3 is_epimorphism & a3 is_monomorphism );
end;

:: deftheorem Def11 defines is_isomorphism ENDALG:def 11 :
for b1, b2 being non empty left_unital multLoopStr
for b3 being Function of b1,b2 holds
( b3 is_isomorphism iff ( b3 is_epimorphism & b3 is_monomorphism ) );

theorem Th17: :: ENDALG:17
for b1 being non empty left_unital multLoopStr holds id the carrier of b1 is Homomorphism of b1,b1
proof end;

definition
let c1, c2 be non empty left_unital multLoopStr ;
pred c1,c2 are_isomorphic means :Def12: :: ENDALG:def 12
ex b1 being Homomorphism of a1,a2 st b1 is_isomorphism ;
reflexivity
for b1 being non empty left_unital multLoopStr ex b2 being Homomorphism of b1,b1 st b2 is_isomorphism
proof end;
end;

:: deftheorem Def12 defines are_isomorphic ENDALG:def 12 :
for b1, b2 being non empty left_unital multLoopStr holds
( b1,b2 are_isomorphic iff ex b3 being Homomorphism of b1,b2 st b3 is_isomorphism );

theorem Th18: :: ENDALG:18
for b1 being Universal_Algebra
for b2 being Function st dom b2 = UAEnd b1 & ( for b3 being set st b3 in UAEnd b1 holds
b2 . b3 = {0} --> b3 ) holds
b2 is Homomorphism of (UAEndMonoid b1),(MSAEndMonoid (MSAlg b1))
proof end;

theorem Th19: :: ENDALG:19
for b1 being Universal_Algebra
for b2 being Homomorphism of (UAEndMonoid b1),(MSAEndMonoid (MSAlg b1)) st ( for b3 being set st b3 in UAEnd b1 holds
b2 . b3 = {0} --> b3 ) holds
b2 is_isomorphism
proof end;

theorem Th20: :: ENDALG:20
for b1 being Universal_Algebra holds UAEndMonoid b1, MSAEndMonoid (MSAlg b1) are_isomorphic
proof end;