        \problemdata       % Takes 5 *mandatory* arguments
        {exactly2}             % latex-friendly label for the prob.
        {logic}  % The topic(s) of the problem content.
        {Velleman}               % Source (if known)
        {F01 PS1-1, F97 PS1-3} % Usage (list ones you are aware of).
        {}        % Last revision info (author, date).

\begin{problem}
Find a compound proposition involving the proposition variables
$p$, $q$, and $r$ that is false when exactly two of $p$, $q$, and $r$ are
false.  The compound proposition is true otherwise.

\solution{
We'll just negate a compound proposition that is \emph{true}
when exactly two of the variables $p,q$ and $r$ are false.  But exactly
two variables are false iff exactly one variable is true.  So we divide
the proposition in three subclauses, one for each variable that might be
the only true one.  Altogether this gives us:
\[ \neg ((\neg p \wedge \neg q \wedge r) \vee (\neg p \wedge q \wedge \neg r) 
\vee (p \wedge \neg q \wedge \neg r)).\]

Using DeMorgan's laws (see Rosen), we could rewrite this formula equivalently
as
\[((p \vee q \vee \neg r ) \wedge (p \vee \neg q \vee r ) \wedge 
   (\neg p \vee q \vee r )).
\]

Another equivalent formula is
\[
((p \wedge q) \vee (q \wedge r) \vee (p \wedge r)  \vee (\neg p \wedge \neg q \wedge \neg r)).
\]
The disjunction ($\vee$) of the first three clauses is true exactly when
some pair of variables are both true.  The last clause is true precisely
when no variables are true.  So the formula is false exactly when only one
variable is true.
}
\end{problem}