:: Basic Algebraic Structures
:: by Library Committee
::
:: Copyright (c) 2007-2018 Association of Mizar Users

definition
attr c1 is strict ;
sel addF c1 -> BinOp of the carrier of c1;
end;

registration
let D be non empty set ;
let o be BinOp of D;
cluster addMagma(# D,o #) -> non empty ;
coherence
not addMagma(# D,o #) is empty
;
end;

registration
let T be trivial set ;
let f be BinOp of T;
cluster addMagma(# T,f #) -> trivial ;
coherence
;
end;

registration
let N be non trivial set ;
let b be BinOp of N;
cluster addMagma(# N,b #) -> non trivial ;
coherence
not addMagma(# N,b #) is trivial
;
end;

definition
let x, y be Element of M;
func x + y -> Element of M equals :: ALGSTR_0:def 1
the addF of M . (x,y);
coherence
the addF of M . (x,y) is Element of M
;
end;

:: deftheorem defines + ALGSTR_0:def 1 :
for x, y being Element of M holds x + y = the addF of M . (x,y);

definition
coherence
;
end;

:: deftheorem defines Trivial-addMagma ALGSTR_0:def 2 :

registration
coherence ;
end;

registration
existence
( b1 is strict & b1 is 1 -element )
proof end;
end;

definition
let x be Element of M;
attr x is left_add-cancelable means :: ALGSTR_0:def 3
for y, z being Element of M st x + y = x + z holds
y = z;
attr x is right_add-cancelable means :: ALGSTR_0:def 4
for y, z being Element of M st y + x = z + x holds
y = z;
end;

:: deftheorem defines left_add-cancelable ALGSTR_0:def 3 :
for x being Element of M holds
( x is left_add-cancelable iff for y, z being Element of M st x + y = x + z holds
y = z );

:: deftheorem defines right_add-cancelable ALGSTR_0:def 4 :
for x being Element of M holds
( x is right_add-cancelable iff for y, z being Element of M st y + x = z + x holds
y = z );

definition
let x be Element of M;
end;

:: deftheorem defines add-cancelable ALGSTR_0:def 5 :
for x being Element of M holds

registration
coherence
for b1 being Element of M st b1 is right_add-cancelable & b1 is left_add-cancelable holds
;
coherence
for b1 being Element of M st b1 is add-cancelable holds
;
end;

definition
attr M is left_add-cancelable means :Def6: :: ALGSTR_0:def 6
for x being Element of M holds x is left_add-cancelable ;
attr M is right_add-cancelable means :Def7: :: ALGSTR_0:def 7
for x being Element of M holds x is right_add-cancelable ;
end;

:: deftheorem Def6 defines left_add-cancelable ALGSTR_0:def 6 :
( M is left_add-cancelable iff for x being Element of M holds x is left_add-cancelable );

:: deftheorem Def7 defines right_add-cancelable ALGSTR_0:def 7 :
( M is right_add-cancelable iff for x being Element of M holds x is right_add-cancelable );

definition
end;

:: deftheorem defines add-cancelable ALGSTR_0:def 8 :

registration
coherence
;
coherence
;
end;

registration
coherence
proof end;
end;

registration
existence
( b1 is add-cancelable & b1 is strict & b1 is 1 -element )
proof end;
end;

registration
cluster -> left_add-cancelable for Element of M;
coherence
for b1 being Element of M holds b1 is left_add-cancelable
by Def6;
end;

registration
cluster -> right_add-cancelable for Element of M;
coherence
for b1 being Element of M holds b1 is right_add-cancelable
by Def7;
end;

definition end;

registration
let D be non empty set ;
let o be BinOp of D;
let d be Element of D;
cluster addLoopStr(# D,o,d #) -> non empty ;
coherence
not addLoopStr(# D,o,d #) is empty
;
end;

registration
let T be trivial set ;
let f be BinOp of T;
let t be Element of T;
cluster addLoopStr(# T,f,t #) -> trivial ;
coherence
;
end;

registration
let N be non trivial set ;
let b be BinOp of N;
let m be Element of N;
cluster addLoopStr(# N,b,m #) -> non trivial ;
coherence
not addLoopStr(# N,b,m #) is trivial
;
end;

definition
coherence
;
end;

:: deftheorem defines Trivial-addLoopStr ALGSTR_0:def 9 :

registration
coherence ;
end;

registration
existence
( b1 is strict & b1 is 1 -element )
proof end;
end;

definition
let x be Element of M;
attr x is left_complementable means :: ALGSTR_0:def 10
ex y being Element of M st y + x = 0. M;
attr x is right_complementable means :: ALGSTR_0:def 11
ex y being Element of M st x + y = 0. M;
end;

:: deftheorem defines left_complementable ALGSTR_0:def 10 :
for x being Element of M holds
( x is left_complementable iff ex y being Element of M st y + x = 0. M );

:: deftheorem defines right_complementable ALGSTR_0:def 11 :
for x being Element of M holds
( x is right_complementable iff ex y being Element of M st x + y = 0. M );

definition
let x be Element of M;
end;

:: deftheorem defines complementable ALGSTR_0:def 12 :
for x being Element of M holds
( x is complementable iff ( x is right_complementable & x is left_complementable ) );

registration
coherence
for b1 being Element of M st b1 is right_complementable & b1 is left_complementable holds
b1 is complementable
;
coherence
for b1 being Element of M st b1 is complementable holds
( b1 is right_complementable & b1 is left_complementable )
;
end;

definition
let x be Element of M;
assume A1: ( x is left_complementable & x is right_add-cancelable ) ;
func - x -> Element of M means :: ALGSTR_0:def 13
it + x = 0. M;
existence
ex b1 being Element of M st b1 + x = 0. M
by A1;
uniqueness
for b1, b2 being Element of M st b1 + x = 0. M & b2 + x = 0. M holds
b1 = b2
by A1;
end;

:: deftheorem defines - ALGSTR_0:def 13 :
for x being Element of M st x is left_complementable & x is right_add-cancelable holds
for b3 being Element of M holds
( b3 = - x iff b3 + x = 0. M );

definition
let v, w be Element of V;
func v - w -> Element of V equals :: ALGSTR_0:def 14
v + (- w);
correctness
coherence
v + (- w) is Element of V
;
;
end;

:: deftheorem defines - ALGSTR_0:def 14 :
for v, w being Element of V holds v - w = v + (- w);

registration
coherence
proof end;
end;

definition
attr M is left_complementable means :Def15: :: ALGSTR_0:def 15
for x being Element of M holds x is left_complementable ;
attr M is right_complementable means :Def16: :: ALGSTR_0:def 16
for x being Element of M holds x is right_complementable ;
end;

:: deftheorem Def15 defines left_complementable ALGSTR_0:def 15 :
( M is left_complementable iff for x being Element of M holds x is left_complementable );

:: deftheorem Def16 defines right_complementable ALGSTR_0:def 16 :
( M is right_complementable iff for x being Element of M holds x is right_complementable );

definition
end;

:: deftheorem defines complementable ALGSTR_0:def 17 :
( M is complementable iff ( M is right_complementable & M is left_complementable ) );

registration
coherence
for b1 being addLoopStr st b1 is right_complementable & b1 is left_complementable holds
b1 is complementable
;
coherence
for b1 being addLoopStr st b1 is complementable holds
( b1 is right_complementable & b1 is left_complementable )
;
end;

registration
coherence
proof end;
end;

registration
existence
( b1 is complementable & b1 is add-cancelable & b1 is strict & b1 is 1 -element )
proof end;
end;

registration
let M be left_complementable addLoopStr ;
cluster -> left_complementable for Element of M;
coherence
for b1 being Element of M holds b1 is left_complementable
by Def15;
end;

registration
let M be right_complementable addLoopStr ;
cluster -> right_complementable for Element of M;
coherence
for b1 being Element of M holds b1 is right_complementable
by Def16;
end;

definition
attr c1 is strict ;
struct multMagma -> 1-sorted ;
aggr multMagma(# carrier, multF #) -> multMagma ;
sel multF c1 -> BinOp of the carrier of c1;
end;

registration
let D be non empty set ;
let o be BinOp of D;
cluster multMagma(# D,o #) -> non empty ;
coherence
not multMagma(# D,o #) is empty
;
end;

registration
let T be trivial set ;
let f be BinOp of T;
cluster multMagma(# T,f #) -> trivial ;
coherence
multMagma(# T,f #) is trivial
;
end;

registration
let N be non trivial set ;
let b be BinOp of N;
cluster multMagma(# N,b #) -> non trivial ;
coherence
not multMagma(# N,b #) is trivial
;
end;

definition
let M be multMagma ;
let x, y be Element of M;
func x * y -> Element of M equals :: ALGSTR_0:def 18
the multF of M . (x,y);
coherence
the multF of M . (x,y) is Element of M
;
end;

:: deftheorem defines * ALGSTR_0:def 18 :
for M being multMagma
for x, y being Element of M holds x * y = the multF of M . (x,y);

definition
coherence
multMagma(# ,op2 #) is multMagma
;
end;

:: deftheorem defines Trivial-multMagma ALGSTR_0:def 19 :

registration
coherence ;
end;

registration
existence
ex b1 being multMagma st
( b1 is strict & b1 is 1 -element )
proof end;
end;

definition
let M be multMagma ;
let x be Element of M;
attr x is left_mult-cancelable means :: ALGSTR_0:def 20
for y, z being Element of M st x * y = x * z holds
y = z;
attr x is right_mult-cancelable means :: ALGSTR_0:def 21
for y, z being Element of M st y * x = z * x holds
y = z;
end;

:: deftheorem defines left_mult-cancelable ALGSTR_0:def 20 :
for M being multMagma
for x being Element of M holds
( x is left_mult-cancelable iff for y, z being Element of M st x * y = x * z holds
y = z );

:: deftheorem defines right_mult-cancelable ALGSTR_0:def 21 :
for M being multMagma
for x being Element of M holds
( x is right_mult-cancelable iff for y, z being Element of M st y * x = z * x holds
y = z );

definition
let M be multMagma ;
let x be Element of M;
end;

:: deftheorem defines mult-cancelable ALGSTR_0:def 22 :
for M being multMagma
for x being Element of M holds
( x is mult-cancelable iff ( x is right_mult-cancelable & x is left_mult-cancelable ) );

registration
let M be multMagma ;
coherence
for b1 being Element of M st b1 is right_mult-cancelable & b1 is left_mult-cancelable holds
b1 is mult-cancelable
;
coherence
for b1 being Element of M st b1 is mult-cancelable holds
( b1 is right_mult-cancelable & b1 is left_mult-cancelable )
;
end;

definition
let M be multMagma ;
attr M is left_mult-cancelable means :Def23: :: ALGSTR_0:def 23
for x being Element of M holds x is left_mult-cancelable ;
attr M is right_mult-cancelable means :Def24: :: ALGSTR_0:def 24
for x being Element of M holds x is right_mult-cancelable ;
end;

:: deftheorem Def23 defines left_mult-cancelable ALGSTR_0:def 23 :
for M being multMagma holds
( M is left_mult-cancelable iff for x being Element of M holds x is left_mult-cancelable );

:: deftheorem Def24 defines right_mult-cancelable ALGSTR_0:def 24 :
for M being multMagma holds
( M is right_mult-cancelable iff for x being Element of M holds x is right_mult-cancelable );

definition
let M be multMagma ;
end;

:: deftheorem defines mult-cancelable ALGSTR_0:def 25 :
for M being multMagma holds
( M is mult-cancelable iff ( M is left_mult-cancelable & M is right_mult-cancelable ) );

registration
coherence
for b1 being multMagma st b1 is right_mult-cancelable & b1 is left_mult-cancelable holds
b1 is mult-cancelable
;
coherence
for b1 being multMagma st b1 is mult-cancelable holds
( b1 is right_mult-cancelable & b1 is left_mult-cancelable )
;
end;

registration
coherence
proof end;
end;

registration
existence
ex b1 being multMagma st
( b1 is mult-cancelable & b1 is strict & b1 is 1 -element )
proof end;
end;

registration
let M be left_mult-cancelable multMagma ;
cluster -> left_mult-cancelable for Element of M;
coherence
for b1 being Element of M holds b1 is left_mult-cancelable
by Def23;
end;

registration
let M be right_mult-cancelable multMagma ;
cluster -> right_mult-cancelable for Element of M;
coherence
for b1 being Element of M holds b1 is right_mult-cancelable
by Def24;
end;

definition end;

registration
let D be non empty set ;
let o be BinOp of D;
let d be Element of D;
cluster multLoopStr(# D,o,d #) -> non empty ;
coherence
not multLoopStr(# D,o,d #) is empty
;
end;

registration
let T be trivial set ;
let f be BinOp of T;
let t be Element of T;
cluster multLoopStr(# T,f,t #) -> trivial ;
coherence
multLoopStr(# T,f,t #) is trivial
;
end;

registration
let N be non trivial set ;
let b be BinOp of N;
let m be Element of N;
cluster multLoopStr(# N,b,m #) -> non trivial ;
coherence
not multLoopStr(# N,b,m #) is trivial
;
end;

definition
coherence
multLoopStr(# ,op2,op0 #) is multLoopStr
;
end;

:: deftheorem defines Trivial-multLoopStr ALGSTR_0:def 26 :

registration
coherence ;
end;

registration
existence
ex b1 being multLoopStr st
( b1 is strict & b1 is 1 -element )
proof end;
end;

registration end;

definition
let M be multLoopStr ;
let x be Element of M;
attr x is left_invertible means :: ALGSTR_0:def 27
ex y being Element of M st y * x = 1. M;
attr x is right_invertible means :: ALGSTR_0:def 28
ex y being Element of M st x * y = 1. M;
end;

:: deftheorem defines left_invertible ALGSTR_0:def 27 :
for M being multLoopStr
for x being Element of M holds
( x is left_invertible iff ex y being Element of M st y * x = 1. M );

:: deftheorem defines right_invertible ALGSTR_0:def 28 :
for M being multLoopStr
for x being Element of M holds
( x is right_invertible iff ex y being Element of M st x * y = 1. M );

definition
let M be multLoopStr ;
let x be Element of M;
attr x is invertible means :: ALGSTR_0:def 29
( x is right_invertible & x is left_invertible );
end;

:: deftheorem defines invertible ALGSTR_0:def 29 :
for M being multLoopStr
for x being Element of M holds
( x is invertible iff ( x is right_invertible & x is left_invertible ) );

registration
let M be multLoopStr ;
coherence
for b1 being Element of M st b1 is right_invertible & b1 is left_invertible holds
b1 is invertible
;
coherence
for b1 being Element of M st b1 is invertible holds
( b1 is right_invertible & b1 is left_invertible )
;
end;

definition
let M be multLoopStr ;
let x be Element of M;
assume that
A1: x is left_invertible and
A2: x is right_mult-cancelable ;
func / x -> Element of M means :: ALGSTR_0:def 30
it * x = 1. M;
existence
ex b1 being Element of M st b1 * x = 1. M
by A1;
uniqueness
for b1, b2 being Element of M st b1 * x = 1. M & b2 * x = 1. M holds
b1 = b2
by A2;
end;

:: deftheorem defines / ALGSTR_0:def 30 :
for M being multLoopStr
for x being Element of M st x is left_invertible & x is right_mult-cancelable holds
for b3 being Element of M holds
( b3 = / x iff b3 * x = 1. M );

definition
let M be multLoopStr ;
attr M is left_invertible means :Def31: :: ALGSTR_0:def 31
for x being Element of M holds x is left_invertible ;
attr M is right_invertible means :Def32: :: ALGSTR_0:def 32
for x being Element of M holds x is right_invertible ;
end;

:: deftheorem Def31 defines left_invertible ALGSTR_0:def 31 :
for M being multLoopStr holds
( M is left_invertible iff for x being Element of M holds x is left_invertible );

:: deftheorem Def32 defines right_invertible ALGSTR_0:def 32 :
for M being multLoopStr holds
( M is right_invertible iff for x being Element of M holds x is right_invertible );

definition
let M be multLoopStr ;
attr M is invertible means :: ALGSTR_0:def 33
( M is right_invertible & M is left_invertible );
end;

:: deftheorem defines invertible ALGSTR_0:def 33 :
for M being multLoopStr holds
( M is invertible iff ( M is right_invertible & M is left_invertible ) );

registration
coherence
for b1 being multLoopStr st b1 is right_invertible & b1 is left_invertible holds
b1 is invertible
;
coherence
for b1 being multLoopStr st b1 is invertible holds
( b1 is right_invertible & b1 is left_invertible )
;
end;

registration
coherence
proof end;
end;

registration
existence
ex b1 being multLoopStr st
( b1 is invertible & b1 is mult-cancelable & b1 is strict & b1 is 1 -element )
proof end;
end;

registration
let M be left_invertible multLoopStr ;
cluster -> left_invertible for Element of M;
coherence
for b1 being Element of M holds b1 is left_invertible
by Def31;
end;

registration
let M be right_invertible multLoopStr ;
cluster -> right_invertible for Element of M;
coherence
for b1 being Element of M holds b1 is right_invertible
by Def32;
end;

definition end;

registration
let D be non empty set ;
let o be BinOp of D;
let d, e be Element of D;
cluster multLoopStr_0(# D,o,d,e #) -> non empty ;
coherence
not multLoopStr_0(# D,o,d,e #) is empty
;
end;

registration
let T be trivial set ;
let f be BinOp of T;
let s, t be Element of T;
cluster multLoopStr_0(# T,f,s,t #) -> trivial ;
coherence
multLoopStr_0(# T,f,s,t #) is trivial
;
end;

registration
let N be non trivial set ;
let b be BinOp of N;
let m, n be Element of N;
cluster multLoopStr_0(# N,b,m,n #) -> non trivial ;
coherence
not multLoopStr_0(# N,b,m,n #) is trivial
;
end;

definition
coherence
multLoopStr_0(# ,op2,op0,op0 #) is multLoopStr_0
;
end;

:: deftheorem defines Trivial-multLoopStr_0 ALGSTR_0:def 34 :

registration
coherence ;
end;

registration
existence
ex b1 being multLoopStr_0 st
( b1 is strict & b1 is 1 -element )
proof end;
end;

canceled;

::\$CD
definition
let M be multLoopStr_0 ;
attr M is almost_left_cancelable means :: ALGSTR_0:def 35
for x being Element of M st x <> 0. M holds
x is left_mult-cancelable ;
attr M is almost_right_cancelable means :: ALGSTR_0:def 36
for x being Element of M st x <> 0. M holds
x is right_mult-cancelable ;
end;

:: deftheorem defines almost_left_cancelable ALGSTR_0:def 35 :
for M being multLoopStr_0 holds
( M is almost_left_cancelable iff for x being Element of M st x <> 0. M holds
x is left_mult-cancelable );

:: deftheorem defines almost_right_cancelable ALGSTR_0:def 36 :
for M being multLoopStr_0 holds
( M is almost_right_cancelable iff for x being Element of M st x <> 0. M holds
x is right_mult-cancelable );

definition
let M be multLoopStr_0 ;
end;

:: deftheorem defines almost_cancelable ALGSTR_0:def 37 :
for M being multLoopStr_0 holds
( M is almost_cancelable iff ( M is almost_left_cancelable & M is almost_right_cancelable ) );

registration
coherence
for b1 being multLoopStr_0 st b1 is almost_right_cancelable & b1 is almost_left_cancelable holds
b1 is almost_cancelable
;
coherence
for b1 being multLoopStr_0 st b1 is almost_cancelable holds
( b1 is almost_right_cancelable & b1 is almost_left_cancelable )
;
end;

registration end;

registration
existence
ex b1 being multLoopStr_0 st
( b1 is almost_cancelable & b1 is strict & b1 is 1 -element )
proof end;
end;

definition
let M be multLoopStr_0 ;
attr M is almost_left_invertible means :: ALGSTR_0:def 38
for x being Element of M st x <> 0. M holds
x is left_invertible ;
attr M is almost_right_invertible means :: ALGSTR_0:def 39
for x being Element of M st x <> 0. M holds
x is right_invertible ;
end;

:: deftheorem defines almost_left_invertible ALGSTR_0:def 38 :
for M being multLoopStr_0 holds
( M is almost_left_invertible iff for x being Element of M st x <> 0. M holds
x is left_invertible );

:: deftheorem defines almost_right_invertible ALGSTR_0:def 39 :
for M being multLoopStr_0 holds
( M is almost_right_invertible iff for x being Element of M st x <> 0. M holds
x is right_invertible );

definition
let M be multLoopStr_0 ;
end;

:: deftheorem defines almost_invertible ALGSTR_0:def 40 :
for M being multLoopStr_0 holds
( M is almost_invertible iff ( M is almost_right_invertible & M is almost_left_invertible ) );

registration
coherence
for b1 being multLoopStr_0 st b1 is almost_right_invertible & b1 is almost_left_invertible holds
b1 is almost_invertible
;
coherence
for b1 being multLoopStr_0 st b1 is almost_invertible holds
( b1 is almost_right_invertible & b1 is almost_left_invertible )
;
end;

registration end;

registration
existence
ex b1 being multLoopStr_0 st
( b1 is almost_invertible & b1 is almost_cancelable & b1 is strict & b1 is 1 -element )
proof end;
end;

definition end;

registration
let D be non empty set ;
let o, o1 be BinOp of D;
let d, e be Element of D;
cluster doubleLoopStr(# D,o,o1,d,e #) -> non empty ;
coherence
not doubleLoopStr(# D,o,o1,d,e #) is empty
;
end;

registration
let T be trivial set ;
let f, f1 be BinOp of T;
let s, t be Element of T;
cluster doubleLoopStr(# T,f,f1,s,t #) -> trivial ;
coherence
doubleLoopStr(# T,f,f1,s,t #) is trivial
;
end;

registration
let N be non trivial set ;
let b, b1 be BinOp of N;
let m, n be Element of N;
cluster doubleLoopStr(# N,b,b1,m,n #) -> non trivial ;
coherence
not doubleLoopStr(# N,b,b1,m,n #) is trivial
;
end;

definition
coherence
doubleLoopStr(# ,op2,op2,op0,op0 #) is doubleLoopStr
;
end;

:: deftheorem defines Trivial-doubleLoopStr ALGSTR_0:def 41 :

registration
coherence ;
end;

registration
existence
ex b1 being doubleLoopStr st
( b1 is strict & b1 is 1 -element )
proof end;
end;

definition
let M be multLoopStr ;
let x, y be Element of M;
func x / y -> Element of M equals :: ALGSTR_0:def 42
x * (/ y);
coherence
x * (/ y) is Element of M
;
end;

:: deftheorem defines / ALGSTR_0:def 42 :
for M being multLoopStr
for x, y being Element of M holds x / y = x * (/ y);