[Math] Writing in CNF that only one statement can be true

conjunctive-normal-formpropositional-calculus

Consider 5 Boolean variables $x_1, x_2, x_3, x_4, x_5$.

  1. Write a propositional formula that expresses the fact that one and at most one among the Boolean variables $x_1, x_2, x_3, x_4, x_5$ is true.

  2. Compute a conjunctive normal form of this formula.

Your answer must be justified.

I thought this was straightforward as I could just define $\phi_i$ as the conjunction of $x_i$ and not the others, but I'm not seeing a nice way to put that into CNF.

Best Answer

I assume that for a) the task is to come up with a formula that says that exactly one of the variables is true.

This can be done fairly easily in DNF:

$$(x_1 \land \neg x_2 \land \neg x_3 \land \neg x_4 \land \neg x_5) \lor (\neg x_1 \land x_2 \land \neg x_3 \land \neg x_4 \land \neg x_5) \lor ...$$

(You can do the rest ... obviously you'll get $5$ terms like this)

However, how do we express this in CNF, as b) asks?

Well, you can always take a formula in DNF, and transform it into CNF by Distribution of $\lor$ over $\land$

For example:

$$(P \land Q) \lor (R \land S) \Leftrightarrow (P \lor R) \land (P \lor S) \land (Q \lor R) \land (Q \lor S)$$

(This should be reminiscent of the FOIL principle)

In your case, however, you'd get $5^5=3125$ terms .... and while many of them can be eliminated by further logical principles, this is not something you'd actually want to do ...

OK, can we do something else?

Yes, consider all possible ways in which it would be false that exactly one of the variables is true. So that would be when they are either all false, or when two or more of them are true, i.e.:

$$(\neg x_1 \land \neg x_2 \land \neg x_3 \land \neg x_4 \land \neg x_5) \lor (x_1 \land x_2) \lor (x_1 \land x_3) \lor ... \lor (x_1 \land x_5) \lor (x_2 \land x_3) \lor ...$$

(again, you can do the rest ... you'll get $1 + {5 \choose 2}=11$ terms)

OK, so since this statement is the negation of the statement you want, simply negate this statement to get the statement you want. And note: by doing a bunch of DeMorgan's, you'll get a statement nicely in CNF!

Related Question