Consider the Boolean function F = (x1 + x3 + x4)(x2 + x3 + x4)(x1 + x2 + x4)(x1 + x3 + x4)(x1 + x2 + x3). An underlined variable is complemented.
Find an assignment of x1, x2, x3 and x4 that will make F = 1.
The puzzle
Problem 1. Find an assignment that makes F = 1. You are not allowed to transform the expression into any other form, including SOP, K-map and so on.
- Explain the strategy that you used clearly.
- Write down the assignment to X.
Problem 2. Write function F in sum-of-products form. Find an assignment of x1, x2, x3 and x4 that will make F = 1. As before, no transformations are allowed.
- Explain the strategy that you used clearly.
- Write down the assignment to X.
Problem 3. Use the sum-of-products form of F that you found in Problem 2. Find an assignment of x1, x2, x3 and x4 that will make F = 0.
Questions.
- Which assignment to F was easier, assignment done on the SOP or the POS form? Why?
- Which assignment to F was harder, assigning 1 to F in Problem 2 or assigning 0 to F in Problem 3? Why?
- Compare the difficulty of Problem 1 and Problem 3.
- Are your solution strategies general enough for any F given to you?
Try it yourself before reading on. The answers follow.
Why this puzzle matters
The puzzle looks like a classroom exercise, but it is a small version of one of the most important problems in computing: Boolean satisfiability, usually called SAT. Given a formula, is there any assignment of the inputs that makes it true? Equivalence checkers, automatic test pattern generators and formal property checkers all solve problems of this kind, millions of times a day, on formulas with millions of variables.
The lesson of the puzzle is that the form of the expression decides how hard the question is. Making a product-of-sums (POS) expression equal 1 needs a search. Making a sum-of-products (SOP) expression equal 1 is trivial. And the hard case simply moves: making an SOP expression equal 0 is as hard as making a POS expression equal 1.
The answers in brief
- Problem 1: x1 = 1, x2 = 1, x3 = 0, x4 = 0 makes F = 1. It is one of eight solutions.
- Problem 2: pick any one product term of the SOP form and make all its literals true, for example x1 = 0, x2 = 0, x3 = 1 (x4 can be anything).
- Problem 3: x1 = x2 = x3 = x4 = 0 makes F = 0.
Deep dive: the numbers and details
This part works through each problem step by step. Skip it if the short answers are all you need.
Problem 1: making a POS expression equal 1
A product of sums is 1 only when every sum (clause) is 1, and a clause is 1 when at least one of its literals is 1. The strategy is to choose values that satisfy as many clauses as possible at once, then check the rest, backing up if a clause cannot be satisfied.
- x1 appears true in clauses 3 and 4. Set x1 = 1: clauses 3 and 4 are satisfied. Clauses 1 and 5 lose their x1-bar literal, leaving (x3-bar + x4-bar) and (x2 + x3-bar).
- x2 appears true in clauses 2 and 5. Set x2 = 1: clauses 2 and 5 are satisfied.
- Only clause 1 is left: (x3-bar + x4-bar). Set x3 = 0: it is satisfied.
- x4 no longer matters for any clause; set x4 = 0.
Check: (0 + 1 + 1)(1 + 0 + 1)(1 + 0 + 0)(1 + 0 + 0)(0 + 1 + 1) = 1. So x1 = 1, x2 = 1, x3 = 0, x4 = 0.
This is the core of the DPLL procedure that SAT solvers use: assign a variable, simplify the clauses, propagate any clause reduced to a single literal (unit propagation), and backtrack on a conflict. The Oxford Logic and Proof lecture notes on DPLL describe it formally.
Problem 2: the SOP form
Evaluating F on all 16 input combinations gives F = 1 for eight of them (written x1 x2 x3 x4): 0010, 0011, 0101, 0111, 1000, 1100, 1101 and 1110, that is minterms 2, 3, 5, 7, 8, 12, 13 and 14. Grouping adjacent minterms gives a minimal SOP:
F = x1'x2'x3 + x1'x2x4 + x1x3'x4' + x1x2x4' + x1x2x3'
Five terms is the minimum. Minterm 8 (1000) and minterm 14 (1110) each have only one neighbor in the on-set, minterm 12, so they need two different terms that both use 12. That leaves minterm 13 needing a fifth term (x1x2x3' or, equally, x2x3'x4).
Making an SOP equal 1 needs no search at all: pick any term and make each of its literals true. From x1'x2'x3, set x1 = 0, x2 = 0, x3 = 1, and x4 can be either value. Check with the POS form: (1 + 0 + 1)(0 + 1 + 1)(0 + 1 + 0)(0 + 1 + 0)(1 + 0 + 0) = 1 when x4 = 0.
Problem 3: making the SOP equal 0
Now every product term must be 0, so each term needs at least one false literal. That is a satisfiability problem again, just written differently: "make every term contain a false literal" is the same as "make every clause of the complement true".
- Set x1 = 0: terms 3, 4 and 5 (which contain x1) are 0.
- Terms 1 and 2 remain: x1'x2'x3 needs x2 = 1 or x3 = 0, and x1'x2x4 needs x2 = 0 or x4 = 0.
- Set x3 = 0 and x4 = 0: both are 0, and x2 can be anything.
So x1 = x2 = x3 = x4 = 0 gives F = 0. Check with the POS form: clause 4 is (0 + 0 + 0) = 0, so F = 0.
Answers to the questions
- Easier form for F = 1: the SOP. One true term is enough, so you can read an answer straight off the expression. For F = 0 the reverse holds: in a POS form, one false clause is enough, which means setting all of one clause's literals to 0.
- Harder: assigning 0 to the SOP in Problem 3. Every term must be killed at once, and choices made for one term can affect others, so in general it needs search and backtracking.
- Problem 1 versus Problem 3: they are the same kind of problem. Both ask for an assignment that meets a set of "at least one of these literals" constraints at once. Each is the dual of the other.
- Generality: the search strategy (assign, simplify, propagate, backtrack) works for any F, but its worst case grows exponentially with the number of variables. Satisfiability of a POS (CNF) formula is NP-complete, so no known method is fast for every input. The easy cases (F = 1 on an SOP, F = 0 on a POS) stay easy, but converting between the forms can make the expression exponentially larger, so you cannot dodge the hard case by converting first.
The numbers behind "exponential"
With 4 variables there are 2^4 = 16 assignments, and brute force is fine. With 40 variables there are about 1.1 x 10^12. With 100 variables there are about 1.3 x 10^30, far beyond any brute force. Practical SAT solvers handle large industrial formulas only because unit propagation, clause learning and good variable ordering prune almost all of that space.
Interview angle
- "How would you find an input that sets this output to 1?" is a test pattern generation question in disguise. Mention justification and backtracking.
- "Why do equivalence checkers use SAT?" Two circuits are equivalent if their XOR (a miter) can never be 1, which is an unsatisfiability question.

Your comments will be moderated before it appears here.