Propositional formula, consisting of $p, q, r$ is true iff only one of them is true

1.4k Views Asked by At

I have some difficulties in building a formula $\phi(p, q, r)$, which is true iff only one of the variables is true.

I suppose that it's reasonably to start trying, using the truth table, but building a formula from it actually seems to be a tough job.

In some point of view, the exact formula should contain the $\oplus$ function - for example, $a_{1} \oplus a_{2} \oplus \ldots \oplus a_{n} $ is true iff formula consists only of an odd number of true variables.

Could somebody give me a clue, how to cope with it?

2

There are 2 best solutions below

1
On

The simplest formula is obviously, $$ ( p \land \lnot q\land \lnot r) \lor ( \lnot p \land \lnot q\land r) \lor ( \lnot p \land q\land \lnot r) $$

Maybe there is a more succinct and elegant formula but I can't seem to unearth it.

0
On

As you observe, $p\oplus q\oplus r$ is true when only one of the variables is true, or when all three are true. Therefore, $(p\oplus q\oplus r) \wedge \neg(p\wedge q\wedge r)$ would fit your needs.