Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simplify (a + b) XOR (c + b) [closed]

Is it possible to simplify (a+b)xor(c+b)? What is the contribution of b to the final result? Note that I'm mixing boolean algebra with arithmetic, xor is a bitwise exclusive or on corresponding bits and + is a standard addition on 8 bits, that wraps around when overflown. a, b, c are unsigned char;

like image 586
Cano64 Avatar asked Mar 05 '14 15:03

Cano64


2 Answers

We can use an SMT solver to test our hypothesis that your formula can be simplified. You can head over to http://rise4fun.com:

x = BitVec('x', 8)
y = BitVec('y', 8)
z = BitVec('z', 8)

print simplify((x + z) ^ (y + z))

and the result, anticlimactically, is:

x + z ^ y + z

Which means your formula cannot be further simplified.

like image 117
Michael Foukarakis Avatar answered Oct 18 '22 03:10

Michael Foukarakis


(a+b)xor(c+b) 
--------------
=((not(a+b))*(c+b))+((a+b)*(not(c+b))) 
-----------------------
=((not a)*(not b)*(c+b))+((a+b)*(not c)*(not b)) 
----
=((not a)(not b)*c) + (a*(not c)(not b)) 
----
=(not b)((not a)c + a(not c)) 
----
=(not b)(a xor c)
----
like image 37
anonymous Avatar answered Oct 18 '22 04:10

anonymous