Search code examples
boolean-logiccircuit

How to efficiently reduce this logic sentence?


I have a sentence that describes a circuit, like this:

I x (Q1 x Q0 + not Q1 x not Q0) + not I x (not Q1 x Q0 + Q1 x not Q0)

I have translated it like this:

I and ((Q1 and Q0) or (!Q1 and !Q0)) or !I and ((!Q1 and Q0) or (Q1 and !Q0)) ->
I and ((Q1 and Q0) or !(Q1 or Q0)) or !I and ((!Q1 and Q0) or (Q1 and !Q0)) ->
I and (!(Q1 xor Q0)) or !I and (Q1 xor Q0)

but I get stuck at this point, is there an easy way to make it even more compact or I'll have to solve the bit-by-bit table?


Solution

  • Reduction

    1. I and ((Q1 and Q0) or (!Q1 and !Q0)) or !I and ((!Q1 and Q0) or (Q1 and !Q0))
       ≡
    2. I and ((Q1 and Q0) or !(Q1 or Q0)) or !I and ((!Q1 and Q0) or (Q1 and !Q0))
       ≡
    3. I and !(!(Q1 and Q1) and (Q1 or Q0)) or !I and ((!Q1 and Q0) or (Q1 and !Q0))
       ≡
    4. I and !(Q0 xor Q1) or !I and (Q0 xor Q1)
       ≡
    5. I xor (Q0 xor Q1)
       ≡
    6. I xor Q0 xor Q1
    

    Reasons

    1 ≡ 2: De Morgan

    2 ≡ 3: De Morgan

    3 ≡ 4: Def of xor

    4 ≡ 5: Def of xor

    5 ≡ 6: Associativity of xor