On 2011/3/17 03:21 AM, Richard Henderson wrote: > On 03/11/2011 06:14 AM, Chung-Lin Tang wrote: >> + /* Given (xor (and A B) C), using P^Q == ~PQ | ~QP (concat as AND), >> + we can transform (AB)^C into: >> + A(~CB) | ~AC | ~BC >> + Attempt a few simplifications when B and C are both constants. */ > > I don't quite follow the step that gets you to that final form. > > P^Q == ~PQ | ~QP > > AB ^ C > == ~(AB)C | (~C)AB > == (~A)(~B)C | (~C)AB > == ?
You have to use DeMorgan's Law to distribute the ~ operator: ~(AB)C | (~C)AB == (~A | ~B)C | A(~CB) // DeMorgan's Law == ~AC | ~BC | A(~CB) // Distribute C over the |