:: BINARI_2 semantic presentation
Lemma1:
for b1 being Nat
for b2, b3 being Tuple of b1,BOOLEAN st len b2 = b1 & len b3 = b1 & ( for b4 being Nat st b4 in Seg b1 holds
b2 /. b4 = b3 /. b4 ) holds
b2 = b3
definition
let c1 be
Nat;
func Bin1 c1 -> Tuple of
a1,
BOOLEAN means :
Def1:
:: BINARI_2:def 1
for
b1 being
Nat st
b1 in Seg a1 holds
a2 /. b1 = IFEQ b1,1,
TRUE ,
FALSE ;
existence
ex b1 being Tuple of c1,BOOLEAN st
for b2 being Nat st b2 in Seg c1 holds
b1 /. b2 = IFEQ b2,1,TRUE ,FALSE
uniqueness
for b1, b2 being Tuple of c1,BOOLEAN st ( for b3 being Nat st b3 in Seg c1 holds
b1 /. b3 = IFEQ b3,1,TRUE ,FALSE ) & ( for b3 being Nat st b3 in Seg c1 holds
b2 /. b3 = IFEQ b3,1,TRUE ,FALSE ) holds
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
b1 being non
empty Nat for
b2,
b3 being
Tuple of
b1,
BOOLEAN for
b4,
b5 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
b1 being non
empty Nat for
b2,
b3 being
Tuple of
b1,
BOOLEAN for
b4,
b5 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 c1 be non
empty Nat;
let c2,
c3 be
Tuple of
c1,
BOOLEAN ;
func c2 - c3 -> Tuple of
a1,
BOOLEAN means :
Def6:
:: BINARI_2:def 6
for
b1 being
Nat st
b1 in Seg a1 holds
a4 /. b1 = ((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 st b2 in Seg c1 holds
b1 /. b2 = ((c2 /. b2) 'xor' ((Neg2 c3) /. b2)) 'xor' ((carry c2,(Neg2 c3)) /. b2)
uniqueness
for b1, b2 being Tuple of c1,BOOLEAN st ( for b3 being Nat st b3 in Seg c1 holds
b1 /. b3 = ((c2 /. b3) 'xor' ((Neg2 c3) /. b3)) 'xor' ((carry c2,(Neg2 c3)) /. b3) ) & ( for b3 being Nat st b3 in Seg c1 holds
b2 /. b3 = ((c2 /. b3) 'xor' ((Neg2 c3) /. b3)) 'xor' ((carry c2,(Neg2 c3)) /. b3) ) holds
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
b1 being non
empty Nat for
b2,
b3 being
Tuple of
b1,
BOOLEAN for
b4,
b5 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*>))