Simplify (a + b) XOR (c + b)

Cano64 picture Cano64 · Mar 5, 2014 · Viewed 11.1k times · Source

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;

Answer

Michael Foukarakis picture Michael Foukarakis · Mar 5, 2014

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.