Search code examples
logicboolean-logicxorboolean-expression

Rewrite boolean expression with XOR


I am new to logic design, and am trying to teach myself. I understand that XOR indicates the output will be 0 only when the inputs are the same. Additionally, I understand that given two inputs called A and B, ((~A AND B) OR (A + ~B)) equates to A XOR B.

I am trying to learn how to convert a boolean expression without XOR into a boolean expression with at least one XOR and perhaps other gates.

Say I have the boolean expression: (~A AND ~B AND ~C) OR (A AND B AND C). I am attempting to convert this expression into one that contains at least one XOR.

However, I am having a hard time understanding where to place the ~C and C, and operations. I tried the following:

((~A AND B) OR (A AND ~B)) AND (~C AND C) but it is not equivalent.

((~A AND B) OR (A AND ~B)) OR (~C OR C) but it is not equivalent.

((~A AND B) OR (A AND ~B)) OR (~C AND C) but it is not equivalent.

((~A AND B) OR (A AND ~B)) AND (~C OR C) but it is not equivalent.

What I am missing here? Can anyone please explain how to take the original boolean expression, and implement it with XOR?

I love teaching myself, and learning new things, but this is driving me crazy after hours.


Solution

  • A form with plenty XOR operations is the ANF (algebraic normal form, Zhegalkin normal form, or Reed–Muller expansion):

    ~((A AND B) XOR (A AND C) XOR (B AND C) XOR A XOR B XOR C)
    

    I've got this asking WolframAlpha.