begin
theorem
canceled;
theorem Th2:
theorem Th3:
theorem
canceled;
theorem
canceled;
theorem
canceled;
theorem
theorem
canceled;
theorem
theorem
theorem
canceled;
theorem
theorem
theorem
theorem
canceled;
theorem
theorem
canceled;
theorem
canceled;
theorem
theorem
theorem
theorem
canceled;
theorem
canceled;
theorem
canceled;
theorem
canceled;
theorem
canceled;
theorem
canceled;
theorem
canceled;
theorem
canceled;
theorem
canceled;
theorem
canceled;
theorem
canceled;
theorem
theorem
canceled;
theorem
canceled;
theorem
canceled;
theorem
canceled;
theorem
canceled;
theorem
canceled;
:: deftheorem BINARITH:def 1 :
canceled;
:: deftheorem BINARITH:def 2 :
canceled;
:: deftheorem BINARITH:def 3 :
canceled;
:: deftheorem defines 'not' BINARITH:def 4 :
for n being Nat
for x, b3 being Tuple of n, BOOLEAN holds
( b3 = 'not' x iff for i being Nat st i in Seg n holds
b3 /. i = 'not' (x /. i) );
:: deftheorem Def5 defines carry BINARITH:def 5 :
for n being non empty Nat
for x, y, b4 being Tuple of n, BOOLEAN holds
( b4 = carry (x,y) iff ( b4 /. 1 = FALSE & ( for i being Nat st 1 <= i & i < n holds
b4 /. (i + 1) = (((x /. i) '&' (y /. i)) 'or' ((x /. i) '&' (b4 /. i))) 'or' ((y /. i) '&' (b4 /. i)) ) ) );
definition
let n be
Nat;
let x be
Tuple of
n,
BOOLEAN ;
func Binary x -> Tuple of
n,
NAT means :
Def6:
for
i being
Nat st
i in Seg n holds
it /. i = IFEQ (
(x /. i),
FALSE,
0,
(2 to_power (i -' 1)));
existence
ex b1 being Tuple of n, NAT st
for i being Nat st i in Seg n holds
b1 /. i = IFEQ ((x /. i),FALSE,0,(2 to_power (i -' 1)))
uniqueness
for b1, b2 being Tuple of n, NAT st ( for i being Nat st i in Seg n holds
b1 /. i = IFEQ ((x /. i),FALSE,0,(2 to_power (i -' 1))) ) & ( for i being Nat st i in Seg n holds
b2 /. i = IFEQ ((x /. i),FALSE,0,(2 to_power (i -' 1))) ) holds
b1 = b2
end;
:: deftheorem Def6 defines Binary BINARITH:def 6 :
for n being Nat
for x being Tuple of n, BOOLEAN
for b3 being Tuple of n, NAT holds
( b3 = Binary x iff for i being Nat st i in Seg n holds
b3 /. i = IFEQ ((x /. i),FALSE,0,(2 to_power (i -' 1))) );
:: deftheorem defines Absval BINARITH:def 7 :
for n being Nat
for x being Tuple of n, BOOLEAN holds Absval x = addnat $$ (Binary x);
definition
let n be non
zero Nat;
let x,
y be
Tuple of
n,
BOOLEAN ;
func x + y -> Tuple of
n,
BOOLEAN means :
Def8:
for
i being
Nat st
i in Seg n holds
it /. i = ((x /. i) 'xor' (y /. i)) 'xor' ((carry (x,y)) /. i);
existence
ex b1 being Tuple of n, BOOLEAN st
for i being Nat st i in Seg n holds
b1 /. i = ((x /. i) 'xor' (y /. i)) 'xor' ((carry (x,y)) /. i)
uniqueness
for b1, b2 being Tuple of n, BOOLEAN st ( for i being Nat st i in Seg n holds
b1 /. i = ((x /. i) 'xor' (y /. i)) 'xor' ((carry (x,y)) /. i) ) & ( for i being Nat st i in Seg n holds
b2 /. i = ((x /. i) 'xor' (y /. i)) 'xor' ((carry (x,y)) /. i) ) holds
b1 = b2
end;
:: deftheorem Def8 defines + BINARITH:def 8 :
for n being non zero Nat
for x, y, b4 being Tuple of n, BOOLEAN holds
( b4 = x + y iff for i being Nat st i in Seg n holds
b4 /. i = ((x /. i) 'xor' (y /. i)) 'xor' ((carry (x,y)) /. i) );
:: deftheorem defines add_ovfl BINARITH:def 9 :
for n being non zero Nat
for z1, z2 being Tuple of n, BOOLEAN holds add_ovfl (z1,z2) = (((z1 /. n) '&' (z2 /. n)) 'or' ((z1 /. n) '&' ((carry (z1,z2)) /. n))) 'or' ((z2 /. n) '&' ((carry (z1,z2)) /. n));
:: deftheorem Def10 defines are_summable BINARITH:def 10 :
for n being non zero Nat
for z1, z2 being Tuple of n, BOOLEAN holds
( z1,z2 are_summable iff add_ovfl (z1,z2) = FALSE );
theorem Th40:
theorem Th41:
theorem Th42:
theorem Th43:
theorem Th44:
theorem Th45:
theorem Th46:
theorem Th47:
theorem