Search code examples
mathboolean-logicboolean-expressionboolean-operations

Simplifying 5-var Boolean SOP Expression using the Laws and Properties


I have this question that is messing me up because I am not getting that where should I start, which terms should I pick at the beginning? Because this confusing expression does not even let me take the common as it makes no sense. Also, it does not even let me remove compliments (using the Laws) as it also does not make any sense. Please help me in this, at least just guide me what should I do? From where should I start? I would be really grateful.

The Explanation of Symbols I used to write the expression:

! : NOT Gate

+ : OR Gate

. (dot) : AND Gate

Boolean Expression:

A.!B.E + !(B.C).D.!E + !(C.D).E+!A.D.!E + A.!(C.D).E + A.E + A.B.!E + !(A.C) + B.C.!D

I have used an online expression simplifier and that gave me the following answer:

!A + B + !C + D + E

But how the above long expression has been simplified in this short one? I know the Laws and Properties but I am not getting that how should I start simplifying the long one? Which terms should I see first? Kindly anyone please help me.


Solution

  • (This is a direct answer to your comment, and a side-ways answer to your main question. In short, use a different method to get the desired simplified expression.)

    You have a complicated expression, but one that uses only 5 logical variables. In this problem it would be much easier to build a truth table, which would have just 2^5 = 32 rows. You could look at the results and use those to build a simplified, equivalent expression. This does not use "the laws and properties" that your original question requires, but it is a standard technique to simplify Boolean expressions.

    You should have learned how to build a truth table in just about any Discrete Mathematics class. In short, you make a table where each element in each row is a T for True or F for False. The rows contain all possible combinations of Ts and Fs. For 5 variables this would use 2^5 = 32 rows. For each row, you assign the first value to A, the second to B, etc. You then evaluate the expression for those values and write the result at the end of the line.

    This can be done by hand, but your expression is complicated enough that we could avoid that. Here is a Python 3 script that prints the desired table. Note that Python has the product() function which simplifies getting all possible combinations of Ts and Fs. This script used B[] to convert a Boolean value to a single character T or F.

    from itertools import product
    
    """Make a truth table for the Boolean expression
        A.!B.E + !(B.C).D.!E + !(C.D).E+!A.D.!E + A.!(C.D).E + A.E + A.B.!E + !(A.C) + B.C.!D
    """
    B = ('F', 'T')
    print('A B C D E : Result')
    print('- - - - - : ------')
    for a, b, c, d, e in product((True, False), repeat=5):
        print(B[a], B[b], B[c], B[d], B[e], end=' : ')
        print(B[
                (a and not b and e)
                or (not (b and c) and d and not e)
                or (not (c and d) and e)
                or (not a and d and not e)
                or (a and not (c and d) and e)
                or (a and e)
                or (a and b and not e)
                or (not (a and c))
                or (b and c and not d)
        ])
    

    Here are the results:

    A B C D E : Result
    - - - - - : ------
    T T T T T : T
    T T T T F : T
    T T T F T : T
    T T T F F : T
    T T F T T : T
    T T F T F : T
    T T F F T : T
    T T F F F : T
    T F T T T : T
    T F T T F : T
    T F T F T : T
    T F T F F : F
    T F F T T : T
    T F F T F : T
    T F F F T : T
    T F F F F : T
    F T T T T : T
    F T T T F : T
    F T T F T : T
    F T T F F : T
    F T F T T : T
    F T F T F : T
    F T F F T : T
    F T F F F : T
    F F T T T : T
    F F T T F : T
    F F T F T : T
    F F T F F : T
    F F F T T : T
    F F F T F : T
    F F F F T : T
    F F F F F : T
    

    We see that the result is always T except for the single line T F T F F. This means your expression is true unless A is True, B is False, C is True, and D and E are False. So we can simplify your expression (using your notation) to

    !(A.!B.C.!D.!E)
    

    A simple use of DeMorgan's laws changes this to normal form:

    !A + B + !C + D + E
    

    which is what you wanted.