:: Binary Operations on Numbers
:: by Library Committee
::
:: Copyright (c) 2004-2019 Association of Mizar Users

scheme :: BINOP_2:sch 1
FuncDefUniq{ F1() -> non empty set , F2() -> non empty set , F3( Element of F1()) -> object } :
for f1, f2 being Function of F1(),F2() st ( for x being Element of F1() holds f1 . x = F3(x) ) & ( for x being Element of F1() holds f2 . x = F3(x) ) holds
f1 = f2
proof end;

scheme :: BINOP_2:sch 2
BinOpDefuniq{ F1() -> non empty set , F2( Element of F1(), Element of F1()) -> object } :
for o1, o2 being BinOp of F1() st ( for a, b being Element of F1() holds o1 . (a,b) = F2(a,b) ) & ( for a, b being Element of F1() holds o2 . (a,b) = F2(a,b) ) holds
o1 = o2
proof end;

scheme :: BINOP_2:sch 3
CFuncDefUniq{ F1( object ) -> object } :
for f1, f2 being Function of COMPLEX,COMPLEX st ( for x being Complex holds f1 . x = F1(x) ) & ( for x being Complex holds f2 . x = F1(x) ) holds
f1 = f2
proof end;

scheme :: BINOP_2:sch 4
RFuncDefUniq{ F1( Real) -> object } :
for f1, f2 being Function of REAL,REAL st ( for x being Real holds f1 . x = F1(x) ) & ( for x being Real holds f2 . x = F1(x) ) holds
f1 = f2
proof end;

registration
cluster -> rational for Element of RAT ;
coherence
for b1 being Element of RAT holds b1 is rational
by RAT_1:def 2;
end;

scheme :: BINOP_2:sch 5
WFuncDefUniq{ F1( Rational) -> object } :
for f1, f2 being Function of RAT,RAT st ( for x being Rational holds f1 . x = F1(x) ) & ( for x being Rational holds f2 . x = F1(x) ) holds
f1 = f2
proof end;

scheme :: BINOP_2:sch 6
IFuncDefUniq{ F1( Integer) -> object } :
for f1, f2 being Function of INT,INT st ( for x being Integer holds f1 . x = F1(x) ) & ( for x being Integer holds f2 . x = F1(x) ) holds
f1 = f2
proof end;

scheme :: BINOP_2:sch 7
NFuncDefUniq{ F1( Nat) -> object } :
for f1, f2 being sequence of NAT st ( for x being Nat holds f1 . x = F1(x) ) & ( for x being Nat holds f2 . x = F1(x) ) holds
f1 = f2
proof end;

scheme :: BINOP_2:sch 8
CBinOpDefuniq{ F1( Complex, Complex) -> object } :
for o1, o2 being BinOp of COMPLEX st ( for a, b being Complex holds o1 . (a,b) = F1(a,b) ) & ( for a, b being Complex holds o2 . (a,b) = F1(a,b) ) holds
o1 = o2
proof end;

scheme :: BINOP_2:sch 9
RBinOpDefuniq{ F1( Real, Real) -> object } :
for o1, o2 being BinOp of REAL st ( for a, b being Real holds o1 . (a,b) = F1(a,b) ) & ( for a, b being Real holds o2 . (a,b) = F1(a,b) ) holds
o1 = o2
proof end;

scheme :: BINOP_2:sch 10
WBinOpDefuniq{ F1( Rational, Rational) -> object } :
for o1, o2 being BinOp of RAT st ( for a, b being Rational holds o1 . (a,b) = F1(a,b) ) & ( for a, b being Rational holds o2 . (a,b) = F1(a,b) ) holds
o1 = o2
proof end;

scheme :: BINOP_2:sch 11
IBinOpDefuniq{ F1( Integer, Integer) -> object } :
for o1, o2 being BinOp of INT st ( for a, b being Integer holds o1 . (a,b) = F1(a,b) ) & ( for a, b being Integer holds o2 . (a,b) = F1(a,b) ) holds
o1 = o2
proof end;

scheme :: BINOP_2:sch 12
NBinOpDefuniq{ F1( Nat, Nat) -> object } :
for o1, o2 being BinOp of NAT st ( for a, b being Nat holds o1 . (a,b) = F1(a,b) ) & ( for a, b being Nat holds o2 . (a,b) = F1(a,b) ) holds
o1 = o2
proof end;

scheme :: BINOP_2:sch 13
CLambda2D{ F1( Complex, Complex) -> Complex } :
ex f being Function of ,COMPLEX st
for x, y being Complex holds f . (x,y) = F1(x,y)
proof end;

scheme :: BINOP_2:sch 14
RLambda2D{ F1( Real, Real) -> Real } :
ex f being Function of ,REAL st
for x, y being Real holds f . (x,y) = F1(x,y)
proof end;

scheme :: BINOP_2:sch 15
WLambda2D{ F1( Rational, Rational) -> Rational } :
ex f being Function of ,RAT st
for x, y being Rational holds f . (x,y) = F1(x,y)
proof end;

scheme :: BINOP_2:sch 16
ILambda2D{ F1( Integer, Integer) -> Integer } :
ex f being Function of ,INT st
for x, y being Integer holds f . (x,y) = F1(x,y)
proof end;

scheme :: BINOP_2:sch 17
NLambda2D{ F1( Nat, Nat) -> Nat } :
ex f being Function of ,NAT st
for x, y being Nat holds f . (x,y) = F1(x,y)
proof end;

scheme :: BINOP_2:sch 18
CLambdaD{ F1( Complex) -> Complex } :
ex f being Function of COMPLEX,COMPLEX st
for x being Complex holds f . x = F1(x)
proof end;

scheme :: BINOP_2:sch 19
RLambdaD{ F1( Real) -> Real } :
ex f being Function of REAL,REAL st
for x being Real holds f . x = F1(x)
proof end;

scheme :: BINOP_2:sch 20
WLambdaD{ F1( Rational) -> Rational } :
ex f being Function of RAT,RAT st
for x being Rational holds f . x = F1(x)
proof end;

scheme :: BINOP_2:sch 21
ILambdaD{ F1( Integer) -> Integer } :
ex f being Function of INT,INT st
for x being Integer holds f . x = F1(x)
proof end;

scheme :: BINOP_2:sch 22
NLambdaD{ F1( Nat) -> Nat } :
ex f being sequence of NAT st
for x being Nat holds f . x = F1(x)
proof end;

:: definition
:: let n1,n2;
:: redefine func n1+n2 -> Element of NAT;
:: coherence by ORDINAL1:def 12;
:: redefine func n1*n2 -> Element of NAT;
:: coherence by ORDINAL1:def 12;
:: end;
definition
func compcomplex -> UnOp of COMPLEX means :: BINOP_2:def 1
for c being Complex holds it . c = - c;
existence
ex b1 being UnOp of COMPLEX st
for c being Complex holds b1 . c = - c
from uniqueness
for b1, b2 being UnOp of COMPLEX st ( for c being Complex holds b1 . c = - c ) & ( for c being Complex holds b2 . c = - c ) holds
b1 = b2
from
func invcomplex -> UnOp of COMPLEX means :: BINOP_2:def 2
for c being Complex holds it . c = c " ;
existence
ex b1 being UnOp of COMPLEX st
for c being Complex holds b1 . c = c "
from uniqueness
for b1, b2 being UnOp of COMPLEX st ( for c being Complex holds b1 . c = c " ) & ( for c being Complex holds b2 . c = c " ) holds
b1 = b2
from
func addcomplex -> BinOp of COMPLEX means :Def3: :: BINOP_2:def 3
for c1, c2 being Complex holds it . (c1,c2) = c1 + c2;
existence
ex b1 being BinOp of COMPLEX st
for c1, c2 being Complex holds b1 . (c1,c2) = c1 + c2
from uniqueness
for b1, b2 being BinOp of COMPLEX st ( for c1, c2 being Complex holds b1 . (c1,c2) = c1 + c2 ) & ( for c1, c2 being Complex holds b2 . (c1,c2) = c1 + c2 ) holds
b1 = b2
from
func diffcomplex -> BinOp of COMPLEX means :: BINOP_2:def 4
for c1, c2 being Complex holds it . (c1,c2) = c1 - c2;
existence
ex b1 being BinOp of COMPLEX st
for c1, c2 being Complex holds b1 . (c1,c2) = c1 - c2
from uniqueness
for b1, b2 being BinOp of COMPLEX st ( for c1, c2 being Complex holds b1 . (c1,c2) = c1 - c2 ) & ( for c1, c2 being Complex holds b2 . (c1,c2) = c1 - c2 ) holds
b1 = b2
from
func multcomplex -> BinOp of COMPLEX means :Def5: :: BINOP_2:def 5
for c1, c2 being Complex holds it . (c1,c2) = c1 * c2;
existence
ex b1 being BinOp of COMPLEX st
for c1, c2 being Complex holds b1 . (c1,c2) = c1 * c2
from uniqueness
for b1, b2 being BinOp of COMPLEX st ( for c1, c2 being Complex holds b1 . (c1,c2) = c1 * c2 ) & ( for c1, c2 being Complex holds b2 . (c1,c2) = c1 * c2 ) holds
b1 = b2
from
func divcomplex -> BinOp of COMPLEX means :: BINOP_2:def 6
for c1, c2 being Complex holds it . (c1,c2) = c1 / c2;
existence
ex b1 being BinOp of COMPLEX st
for c1, c2 being Complex holds b1 . (c1,c2) = c1 / c2
from uniqueness
for b1, b2 being BinOp of COMPLEX st ( for c1, c2 being Complex holds b1 . (c1,c2) = c1 / c2 ) & ( for c1, c2 being Complex holds b2 . (c1,c2) = c1 / c2 ) holds
b1 = b2
from
end;

:: deftheorem defines compcomplex BINOP_2:def 1 :
for b1 being UnOp of COMPLEX holds
( b1 = compcomplex iff for c being Complex holds b1 . c = - c );

:: deftheorem defines invcomplex BINOP_2:def 2 :
for b1 being UnOp of COMPLEX holds
( b1 = invcomplex iff for c being Complex holds b1 . c = c " );

:: deftheorem Def3 defines addcomplex BINOP_2:def 3 :
for b1 being BinOp of COMPLEX holds
( b1 = addcomplex iff for c1, c2 being Complex holds b1 . (c1,c2) = c1 + c2 );

:: deftheorem defines diffcomplex BINOP_2:def 4 :
for b1 being BinOp of COMPLEX holds
( b1 = diffcomplex iff for c1, c2 being Complex holds b1 . (c1,c2) = c1 - c2 );

:: deftheorem Def5 defines multcomplex BINOP_2:def 5 :
for b1 being BinOp of COMPLEX holds
( b1 = multcomplex iff for c1, c2 being Complex holds b1 . (c1,c2) = c1 * c2 );

:: deftheorem defines divcomplex BINOP_2:def 6 :
for b1 being BinOp of COMPLEX holds
( b1 = divcomplex iff for c1, c2 being Complex holds b1 . (c1,c2) = c1 / c2 );

definition
func compreal -> UnOp of REAL means :: BINOP_2:def 7
for r being Real holds it . r = - r;
existence
ex b1 being UnOp of REAL st
for r being Real holds b1 . r = - r
from uniqueness
for b1, b2 being UnOp of REAL st ( for r being Real holds b1 . r = - r ) & ( for r being Real holds b2 . r = - r ) holds
b1 = b2
from
func invreal -> UnOp of REAL means :: BINOP_2:def 8
for r being Real holds it . r = r " ;
existence
ex b1 being UnOp of REAL st
for r being Real holds b1 . r = r "
from uniqueness
for b1, b2 being UnOp of REAL st ( for r being Real holds b1 . r = r " ) & ( for r being Real holds b2 . r = r " ) holds
b1 = b2
from
func addreal -> BinOp of REAL means :Def9: :: BINOP_2:def 9
for r1, r2 being Real holds it . (r1,r2) = r1 + r2;
existence
ex b1 being BinOp of REAL st
for r1, r2 being Real holds b1 . (r1,r2) = r1 + r2
from uniqueness
for b1, b2 being BinOp of REAL st ( for r1, r2 being Real holds b1 . (r1,r2) = r1 + r2 ) & ( for r1, r2 being Real holds b2 . (r1,r2) = r1 + r2 ) holds
b1 = b2
from
func diffreal -> BinOp of REAL means :: BINOP_2:def 10
for r1, r2 being Real holds it . (r1,r2) = r1 - r2;
existence
ex b1 being BinOp of REAL st
for r1, r2 being Real holds b1 . (r1,r2) = r1 - r2
from uniqueness
for b1, b2 being BinOp of REAL st ( for r1, r2 being Real holds b1 . (r1,r2) = r1 - r2 ) & ( for r1, r2 being Real holds b2 . (r1,r2) = r1 - r2 ) holds
b1 = b2
from
func multreal -> BinOp of REAL means :Def11: :: BINOP_2:def 11
for r1, r2 being Real holds it . (r1,r2) = r1 * r2;
existence
ex b1 being BinOp of REAL st
for r1, r2 being Real holds b1 . (r1,r2) = r1 * r2
from uniqueness
for b1, b2 being BinOp of REAL st ( for r1, r2 being Real holds b1 . (r1,r2) = r1 * r2 ) & ( for r1, r2 being Real holds b2 . (r1,r2) = r1 * r2 ) holds
b1 = b2
from
func divreal -> BinOp of REAL means :: BINOP_2:def 12
for r1, r2 being Real holds it . (r1,r2) = r1 / r2;
existence
ex b1 being BinOp of REAL st
for r1, r2 being Real holds b1 . (r1,r2) = r1 / r2
from uniqueness
for b1, b2 being BinOp of REAL st ( for r1, r2 being Real holds b1 . (r1,r2) = r1 / r2 ) & ( for r1, r2 being Real holds b2 . (r1,r2) = r1 / r2 ) holds
b1 = b2
from
end;

:: deftheorem defines compreal BINOP_2:def 7 :
for b1 being UnOp of REAL holds
( b1 = compreal iff for r being Real holds b1 . r = - r );

:: deftheorem defines invreal BINOP_2:def 8 :
for b1 being UnOp of REAL holds
( b1 = invreal iff for r being Real holds b1 . r = r " );

:: deftheorem Def9 defines addreal BINOP_2:def 9 :
for b1 being BinOp of REAL holds
( b1 = addreal iff for r1, r2 being Real holds b1 . (r1,r2) = r1 + r2 );

:: deftheorem defines diffreal BINOP_2:def 10 :
for b1 being BinOp of REAL holds
( b1 = diffreal iff for r1, r2 being Real holds b1 . (r1,r2) = r1 - r2 );

:: deftheorem Def11 defines multreal BINOP_2:def 11 :
for b1 being BinOp of REAL holds
( b1 = multreal iff for r1, r2 being Real holds b1 . (r1,r2) = r1 * r2 );

:: deftheorem defines divreal BINOP_2:def 12 :
for b1 being BinOp of REAL holds
( b1 = divreal iff for r1, r2 being Real holds b1 . (r1,r2) = r1 / r2 );

definition
func comprat -> UnOp of RAT means :: BINOP_2:def 13
for w being Rational holds it . w = - w;
existence
ex b1 being UnOp of RAT st
for w being Rational holds b1 . w = - w
from uniqueness
for b1, b2 being UnOp of RAT st ( for w being Rational holds b1 . w = - w ) & ( for w being Rational holds b2 . w = - w ) holds
b1 = b2
from
func invrat -> UnOp of RAT means :: BINOP_2:def 14
for w being Rational holds it . w = w " ;
existence
ex b1 being UnOp of RAT st
for w being Rational holds b1 . w = w "
from uniqueness
for b1, b2 being UnOp of RAT st ( for w being Rational holds b1 . w = w " ) & ( for w being Rational holds b2 . w = w " ) holds
b1 = b2
from
func addrat -> BinOp of RAT means :Def15: :: BINOP_2:def 15
for w1, w2 being Rational holds it . (w1,w2) = w1 + w2;
existence
ex b1 being BinOp of RAT st
for w1, w2 being Rational holds b1 . (w1,w2) = w1 + w2
from uniqueness
for b1, b2 being BinOp of RAT st ( for w1, w2 being Rational holds b1 . (w1,w2) = w1 + w2 ) & ( for w1, w2 being Rational holds b2 . (w1,w2) = w1 + w2 ) holds
b1 = b2
from
func diffrat -> BinOp of RAT means :: BINOP_2:def 16
for w1, w2 being Rational holds it . (w1,w2) = w1 - w2;
existence
ex b1 being BinOp of RAT st
for w1, w2 being Rational holds b1 . (w1,w2) = w1 - w2
from uniqueness
for b1, b2 being BinOp of RAT st ( for w1, w2 being Rational holds b1 . (w1,w2) = w1 - w2 ) & ( for w1, w2 being Rational holds b2 . (w1,w2) = w1 - w2 ) holds
b1 = b2
from
func multrat -> BinOp of RAT means :Def17: :: BINOP_2:def 17
for w1, w2 being Rational holds it . (w1,w2) = w1 * w2;
existence
ex b1 being BinOp of RAT st
for w1, w2 being Rational holds b1 . (w1,w2) = w1 * w2
from uniqueness
for b1, b2 being BinOp of RAT st ( for w1, w2 being Rational holds b1 . (w1,w2) = w1 * w2 ) & ( for w1, w2 being Rational holds b2 . (w1,w2) = w1 * w2 ) holds
b1 = b2
from
func divrat -> BinOp of RAT means :: BINOP_2:def 18
for w1, w2 being Rational holds it . (w1,w2) = w1 / w2;
existence
ex b1 being BinOp of RAT st
for w1, w2 being Rational holds b1 . (w1,w2) = w1 / w2
from uniqueness
for b1, b2 being BinOp of RAT st ( for w1, w2 being Rational holds b1 . (w1,w2) = w1 / w2 ) & ( for w1, w2 being Rational holds b2 . (w1,w2) = w1 / w2 ) holds
b1 = b2
from
end;

:: deftheorem defines comprat BINOP_2:def 13 :
for b1 being UnOp of RAT holds
( b1 = comprat iff for w being Rational holds b1 . w = - w );

:: deftheorem defines invrat BINOP_2:def 14 :
for b1 being UnOp of RAT holds
( b1 = invrat iff for w being Rational holds b1 . w = w " );

:: deftheorem Def15 defines addrat BINOP_2:def 15 :
for b1 being BinOp of RAT holds
( b1 = addrat iff for w1, w2 being Rational holds b1 . (w1,w2) = w1 + w2 );

:: deftheorem defines diffrat BINOP_2:def 16 :
for b1 being BinOp of RAT holds
( b1 = diffrat iff for w1, w2 being Rational holds b1 . (w1,w2) = w1 - w2 );

:: deftheorem Def17 defines multrat BINOP_2:def 17 :
for b1 being BinOp of RAT holds
( b1 = multrat iff for w1, w2 being Rational holds b1 . (w1,w2) = w1 * w2 );

:: deftheorem defines divrat BINOP_2:def 18 :
for b1 being BinOp of RAT holds
( b1 = divrat iff for w1, w2 being Rational holds b1 . (w1,w2) = w1 / w2 );

definition
func compint -> UnOp of INT means :: BINOP_2:def 19
for i being Integer holds it . i = - i;
existence
ex b1 being UnOp of INT st
for i being Integer holds b1 . i = - i
from uniqueness
for b1, b2 being UnOp of INT st ( for i being Integer holds b1 . i = - i ) & ( for i being Integer holds b2 . i = - i ) holds
b1 = b2
from
func addint -> BinOp of INT means :Def20: :: BINOP_2:def 20
for i1, i2 being Integer holds it . (i1,i2) = i1 + i2;
existence
ex b1 being BinOp of INT st
for i1, i2 being Integer holds b1 . (i1,i2) = i1 + i2
from uniqueness
for b1, b2 being BinOp of INT st ( for i1, i2 being Integer holds b1 . (i1,i2) = i1 + i2 ) & ( for i1, i2 being Integer holds b2 . (i1,i2) = i1 + i2 ) holds
b1 = b2
from
func diffint -> BinOp of INT means :: BINOP_2:def 21
for i1, i2 being Integer holds it . (i1,i2) = i1 - i2;
existence
ex b1 being BinOp of INT st
for i1, i2 being Integer holds b1 . (i1,i2) = i1 - i2
from uniqueness
for b1, b2 being BinOp of INT st ( for i1, i2 being Integer holds b1 . (i1,i2) = i1 - i2 ) & ( for i1, i2 being Integer holds b2 . (i1,i2) = i1 - i2 ) holds
b1 = b2
from
func multint -> BinOp of INT means :Def22: :: BINOP_2:def 22
for i1, i2 being Integer holds it . (i1,i2) = i1 * i2;
existence
ex b1 being BinOp of INT st
for i1, i2 being Integer holds b1 . (i1,i2) = i1 * i2
from uniqueness
for b1, b2 being BinOp of INT st ( for i1, i2 being Integer holds b1 . (i1,i2) = i1 * i2 ) & ( for i1, i2 being Integer holds b2 . (i1,i2) = i1 * i2 ) holds
b1 = b2
from
end;

:: deftheorem defines compint BINOP_2:def 19 :
for b1 being UnOp of INT holds
( b1 = compint iff for i being Integer holds b1 . i = - i );

:: deftheorem Def20 defines addint BINOP_2:def 20 :
for b1 being BinOp of INT holds
( b1 = addint iff for i1, i2 being Integer holds b1 . (i1,i2) = i1 + i2 );

:: deftheorem defines diffint BINOP_2:def 21 :
for b1 being BinOp of INT holds
( b1 = diffint iff for i1, i2 being Integer holds b1 . (i1,i2) = i1 - i2 );

:: deftheorem Def22 defines multint BINOP_2:def 22 :
for b1 being BinOp of INT holds
( b1 = multint iff for i1, i2 being Integer holds b1 . (i1,i2) = i1 * i2 );

definition
func addnat -> BinOp of NAT means :Def23: :: BINOP_2:def 23
for n1, n2 being Nat holds it . (n1,n2) = n1 + n2;
existence
ex b1 being BinOp of NAT st
for n1, n2 being Nat holds b1 . (n1,n2) = n1 + n2
from uniqueness
for b1, b2 being BinOp of NAT st ( for n1, n2 being Nat holds b1 . (n1,n2) = n1 + n2 ) & ( for n1, n2 being Nat holds b2 . (n1,n2) = n1 + n2 ) holds
b1 = b2
from
func multnat -> BinOp of NAT means :Def24: :: BINOP_2:def 24
for n1, n2 being Nat holds it . (n1,n2) = n1 * n2;
existence
ex b1 being BinOp of NAT st
for n1, n2 being Nat holds b1 . (n1,n2) = n1 * n2
from uniqueness
for b1, b2 being BinOp of NAT st ( for n1, n2 being Nat holds b1 . (n1,n2) = n1 * n2 ) & ( for n1, n2 being Nat holds b2 . (n1,n2) = n1 * n2 ) holds
b1 = b2
from
end;

:: deftheorem Def23 defines addnat BINOP_2:def 23 :
for b1 being BinOp of NAT holds
( b1 = addnat iff for n1, n2 being Nat holds b1 . (n1,n2) = n1 + n2 );

:: deftheorem Def24 defines multnat BINOP_2:def 24 :
for b1 being BinOp of NAT holds
( b1 = multnat iff for n1, n2 being Nat holds b1 . (n1,n2) = n1 * n2 );

registration
coherence
proof end;
coherence
proof end;
coherence
proof end;
coherence
proof end;
coherence
proof end;
coherence
proof end;
coherence
proof end;
coherence
proof end;
coherence
proof end;
coherence
proof end;
end;

Lm1:
;

Lm2:
proof end;

Lm3:
proof end;

Lm4:
proof end;

Lm5:
proof end;

Lm6:
proof end;

Lm7:
;

Lm8:
proof end;

Lm9:
proof end;

Lm10:
proof end;

Lm11:
proof end;

Lm12:
proof end;

registration
coherence by ;
coherence by ;
coherence by ;
coherence by ;
coherence by ;
coherence by ;
coherence by ;
coherence by ;
coherence by ;
coherence by ;
end;

theorem :: BINOP_2:1

theorem :: BINOP_2:2

theorem :: BINOP_2:3

theorem :: BINOP_2:4

theorem :: BINOP_2:5

theorem :: BINOP_2:6

theorem :: BINOP_2:7

theorem :: BINOP_2:8

theorem :: BINOP_2:9

theorem :: BINOP_2:10

registration
let f be real-valued Function;
let a, b be object ;
cluster f . (a,b) -> real ;
coherence
f . (a,b) is real
;
end;