Xor Not

Hmm....funny how time goes by. Also, I had wrote down my solution to the boolean problem from last time, but then I lost it, and I kept on putting off working it out agian.

Anyway, lets work it out here. First, let us assume that we have managed to construct a series of boolean objects T0, T1, T01, T23, and so on, where T0 is true if exactly 0 of (A,B,C) are true, and T12 is true if exactly 1 or 2 of (A,B,C) are true and so on for the other T's. So there are in principle 16 such objects, we won't be needing them all, but I just wanted to define the general notation.

If we had these objects then we could easily express NOT A as follows:
NOT A = T0 OR (T1 AND (B OR C)) OR (T2 AND B AND C)

We can see this because exactly 1 of T0, T1, T2, T3 will be true. If T0 is true, NOT A must be true. If T1 is true, NOT A will be true if B or C is true, and false otherwise. If T2 is true, NOT A will only be true if both B and C are true. Finally if T3 is true, then NOT A is just false. Note also that we can make similar expressions for NOT B and NOT C just by permutation.

Alright, how do we go about constructing as many of these T's as possible without using more than 2 NOT gates? Well, we have some of them for free, namely:
T3 = A AND B AND C
T23 = (A AND B) OR (A AND C) OR (B AND C)
T123 = A OR B OR C

Next, we can make T01, costing us 1 NOT gate:
T01 = NOT T23

T1 and T013 are now available:
T1 = T123 AND T01
T013 = T01 OR T3

and T13
T13 = T013 AND T123

Finally we can bring out our other NOT gate
T02 = NOT T13

At last we construct T0 and T2:
T0 = T02 AND T013
T2 = T02 AND T23

This completes the construction of T0, T1, and T2, finishing the problem.

No comments: