:: BINARITH semantic presentation
Lemma1:
for b1, b2 being Nat holds addnat . b1,b2 = b1 + b2
by BINOP_2:def 23;
theorem Th1: :: BINARITH:1
canceled;
theorem Th2: :: BINARITH:2
theorem Th3: :: BINARITH:3
theorem Th4: :: BINARITH:4
canceled;
theorem Th5: :: BINARITH:5
:: deftheorem Def1 defines 'or' BINARITH:def 1 :
:: deftheorem Def2 defines 'xor' BINARITH:def 2 :
theorem Th6: :: BINARITH:6
canceled;
theorem Th7: :: BINARITH:7
theorem Th8: :: BINARITH:8
canceled;
theorem Th9: :: BINARITH:9
theorem Th10: :: BINARITH:10
theorem Th11: :: BINARITH:11
canceled;
theorem Th12: :: BINARITH:12
theorem Th13: :: BINARITH:13
theorem Th14: :: BINARITH:14
theorem Th15: :: BINARITH:15
theorem Th16: :: BINARITH:16
theorem Th17: :: BINARITH:17
theorem Th18: :: BINARITH:18
theorem Th19: :: BINARITH:19
theorem Th20: :: BINARITH:20
theorem Th21: :: BINARITH:21
theorem Th22: :: BINARITH:22
theorem Th23: :: BINARITH:23
theorem Th24: :: BINARITH:24
theorem Th25: :: BINARITH:25
theorem Th26: :: BINARITH:26
theorem Th27: :: BINARITH:27
theorem Th28: :: BINARITH:28
canceled;
theorem Th29: :: BINARITH:29
canceled;
theorem Th30: :: BINARITH:30
canceled;
theorem Th31: :: BINARITH:31
canceled;
theorem Th32: :: BINARITH:32
canceled;
theorem Th33: :: BINARITH:33
theorem Th34: :: BINARITH:34
theorem Th35: :: BINARITH:35
theorem Th36: :: BINARITH:36
theorem Th37: :: BINARITH:37
theorem Th38: :: BINARITH:38
:: deftheorem Def3 defines -' BINARITH:def 3 :
for b
1, b
2 being
natural number holds
( ( b
1 - b
2 >= 0 implies b
1 -' b
2 = b
1 - b
2 ) & ( not b
1 - b
2 >= 0 implies b
1 -' b
2 = 0 ) );
theorem Th39: :: BINARITH:39
:: deftheorem Def4 defines 'not' BINARITH:def 4 :
:: deftheorem Def5 defines carry BINARITH:def 5 :
definition
let c
1 be
Nat;
let c
2 be
Tuple of c
1,
BOOLEAN ;
func Binary c
2 -> Tuple of a
1,
NAT means :
Def6:
:: BINARITH:def 6
for b
1 being
Nat holds
( b
1 in Seg a
1 implies a
3 /. b
1 = IFEQ (a2 /. b1),
FALSE ,0,
(2 to_power (b1 -' 1)) );
existence
ex b1 being Tuple of c1,NAT st
for b2 being Nat holds
( b2 in Seg c1 implies b1 /. b2 = IFEQ (c2 /. b2),FALSE ,0,(2 to_power (b2 -' 1)) )
uniqueness
for b1, b2 being Tuple of c1,NAT holds
( ( for b3 being Nat holds
( b3 in Seg c1 implies b1 /. b3 = IFEQ (c2 /. b3),FALSE ,0,(2 to_power (b3 -' 1)) ) ) & ( for b3 being Nat holds
( b3 in Seg c1 implies b2 /. b3 = IFEQ (c2 /. b3),FALSE ,0,(2 to_power (b3 -' 1)) ) ) implies b1 = b2 )
end;
:: deftheorem Def6 defines Binary BINARITH:def 6 :
:: deftheorem Def7 defines Absval BINARITH:def 7 :
definition
let c
1 be non
empty Nat;
let c
2, c
3 be
Tuple of c
1,
BOOLEAN ;
func c
2 + c
3 -> Tuple of a
1,
BOOLEAN means :
Def8:
:: BINARITH:def 8
for b
1 being
Nat holds
( b
1 in Seg a
1 implies a
4 /. b
1 = ((a2 /. b1) 'xor' (a3 /. b1)) 'xor' ((carry a2,a3) /. b1) );
existence
ex b1 being Tuple of c1,BOOLEAN st
for b2 being Nat holds
( b2 in Seg c1 implies b1 /. b2 = ((c2 /. b2) 'xor' (c3 /. b2)) 'xor' ((carry c2,c3) /. b2) )
uniqueness
for b1, b2 being Tuple of c1,BOOLEAN holds
( ( for b3 being Nat holds
( b3 in Seg c1 implies b1 /. b3 = ((c2 /. b3) 'xor' (c3 /. b3)) 'xor' ((carry c2,c3) /. b3) ) ) & ( for b3 being Nat holds
( b3 in Seg c1 implies b2 /. b3 = ((c2 /. b3) 'xor' (c3 /. b3)) 'xor' ((carry c2,c3) /. b3) ) ) implies b1 = b2 )
end;
:: deftheorem Def8 defines + BINARITH:def 8 :
:: deftheorem Def9 defines add_ovfl BINARITH:def 9 :
:: deftheorem Def10 defines are_summable BINARITH:def 10 :
theorem Th40: :: BINARITH:40
theorem Th41: :: BINARITH:41
theorem Th42: :: BINARITH:42
theorem Th43: :: BINARITH:43
theorem Th44: :: BINARITH:44
theorem Th45: :: BINARITH:45
theorem Th46: :: BINARITH:46
theorem Th47: :: BINARITH:47
theorem Th48: :: BINARITH:48
theorem Th49: :: BINARITH:49
theorem Th50: :: BINARITH:50
theorem Th51: :: BINARITH:51
theorem Th52: :: BINARITH:52
theorem Th53: :: BINARITH:53
theorem Th54: :: BINARITH:54
for b
1, b
2 being
Nat holds
( b
1 -' b
2 = 0 implies b
1 <= b
2 )
theorem Th55: :: BINARITH:55
for b
1, b
2, b
3 being
Nat holds
( b
1 <= b
2 implies
(b2 + b3) -' b
1 = (b2 + b3) - b
1 )
theorem Th56: :: BINARITH:56
for b
1, b
2, b
3 being
Nat holds
( b
1 <= b
2 implies
(b2 + b3) -' b
1 = (b2 -' b1) + b
3 )