:: BINARI_2 semantic presentation
Lemma1:
for b1 being Nat
for b2, b3 being Tuple of b1,BOOLEAN holds
( len b2 = b1 & len b3 = b1 & ( for b4 being Nat holds
( b4 in Seg b1 implies b2 /. b4 = b3 /. b4 ) ) implies b2 = b3 )
definition
let c
1 be
Nat;
func Bin1 c
1 -> Tuple of a
1,
BOOLEAN means :
Def1:
:: BINARI_2:def 1
for b
1 being
Nat holds
( b
1 in Seg a
1 implies a
2 /. b
1 = IFEQ b
1,1,
TRUE ,
FALSE );
existence
ex b1 being Tuple of c1,BOOLEAN st
for b2 being Nat holds
( b2 in Seg c1 implies b1 /. b2 = IFEQ b2,1,TRUE ,FALSE )
uniqueness
for b1, b2 being Tuple of c1,BOOLEAN holds
( ( for b3 being Nat holds
( b3 in Seg c1 implies b1 /. b3 = IFEQ b3,1,TRUE ,FALSE ) ) & ( for b3 being Nat holds
( b3 in Seg c1 implies b2 /. b3 = IFEQ b3,1,TRUE ,FALSE ) ) implies b1 = b2 )
end;
:: deftheorem Def1 defines Bin1 BINARI_2:def 1 :
:: deftheorem Def2 defines Neg2 BINARI_2:def 2 :
:: deftheorem Def3 defines Intval BINARI_2:def 3 :
:: deftheorem Def4 defines Int_add_ovfl BINARI_2:def 4 :
:: deftheorem Def5 defines Int_add_udfl BINARI_2:def 5 :
theorem Th1: :: BINARI_2:1
canceled;
theorem Th2: :: BINARI_2:2
canceled;
theorem Th3: :: BINARI_2:3
theorem Th4: :: BINARI_2:4
theorem Th5: :: BINARI_2:5
theorem Th6: :: BINARI_2:6
theorem Th7: :: BINARI_2:7
theorem Th8: :: BINARI_2:8
theorem Th9: :: BINARI_2:9
theorem Th10: :: BINARI_2:10
theorem Th11: :: BINARI_2:11
theorem Th12: :: BINARI_2:12
theorem Th13: :: BINARI_2:13
for b
1 being non
empty Natfor b
2, b
3 being
Tuple of b
1,
BOOLEAN for b
4, b
5 being
Element of
BOOLEAN holds
((Intval ((b2 ^ <*b4*>) + (b3 ^ <*b5*>))) + (IFEQ (Int_add_ovfl (b2 ^ <*b4*>),(b3 ^ <*b5*>)),FALSE ,0,(2 to_power (b1 + 1)))) - (IFEQ (Int_add_udfl (b2 ^ <*b4*>),(b3 ^ <*b5*>)),FALSE ,0,(2 to_power (b1 + 1))) = (Intval (b2 ^ <*b4*>)) + (Intval (b3 ^ <*b5*>))
theorem Th14: :: BINARI_2:14
for b
1 being non
empty Natfor b
2, b
3 being
Tuple of b
1,
BOOLEAN for b
4, b
5 being
Element of
BOOLEAN holds
Intval ((b2 ^ <*b4*>) + (b3 ^ <*b5*>)) = (((Intval (b2 ^ <*b4*>)) + (Intval (b3 ^ <*b5*>))) - (IFEQ (Int_add_ovfl (b2 ^ <*b4*>),(b3 ^ <*b5*>)),FALSE ,0,(2 to_power (b1 + 1)))) + (IFEQ (Int_add_udfl (b2 ^ <*b4*>),(b3 ^ <*b5*>)),FALSE ,0,(2 to_power (b1 + 1)))
theorem Th15: :: BINARI_2:15
theorem Th16: :: BINARI_2:16
theorem Th17: :: BINARI_2:17
theorem Th18: :: BINARI_2:18
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 :
Def6:
:: BINARI_2:def 6
for b
1 being
Nat holds
( b
1 in Seg a
1 implies a
4 /. b
1 = ((a2 /. b1) 'xor' ((Neg2 a3) /. b1)) 'xor' ((carry a2,(Neg2 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' ((Neg2 c3) /. b2)) 'xor' ((carry c2,(Neg2 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' ((Neg2 c3) /. b3)) 'xor' ((carry c2,(Neg2 c3)) /. b3) ) ) & ( for b3 being Nat holds
( b3 in Seg c1 implies b2 /. b3 = ((c2 /. b3) 'xor' ((Neg2 c3) /. b3)) 'xor' ((carry c2,(Neg2 c3)) /. b3) ) ) implies b1 = b2 )
end;
:: deftheorem Def6 defines - BINARI_2:def 6 :
theorem Th19: :: BINARI_2:19
theorem Th20: :: BINARI_2:20
theorem Th21: :: BINARI_2:21
for b
1 being non
empty Natfor b
2, b
3 being
Tuple of b
1,
BOOLEAN for b
4, b
5 being
Element of
BOOLEAN holds
(((Intval ((b2 ^ <*b4*>) - (b3 ^ <*b5*>))) + (IFEQ (Int_add_ovfl (b2 ^ <*b4*>),(Neg2 (b3 ^ <*b5*>))),FALSE ,0,(2 to_power (b1 + 1)))) - (IFEQ (Int_add_udfl (b2 ^ <*b4*>),(Neg2 (b3 ^ <*b5*>))),FALSE ,0,(2 to_power (b1 + 1)))) + (IFEQ (Int_add_ovfl ('not' (b3 ^ <*b5*>)),(Bin1 (b1 + 1))),FALSE ,0,(2 to_power (b1 + 1))) = (Intval (b2 ^ <*b4*>)) - (Intval (b3 ^ <*b5*>))