% 
% hw2.tex
%
%   This is LaTeX template to get you started
%   making problem-set solutions
%
 
\documentclass[11pt]{article}
\usepackage{amsthm,amsmath, amssymb}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\textheight}{9.0in}
\setlength{\textwidth}{6.5in}
\setlength{\topmargin}{-0.5in}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{\bf Data, Logic, and Computing\\[2ex] 
       \rm\normalsize ECS 17 (Winter 2026)}
\date{\today}
\author{Patrice Koehl\\koehl@cs.ucdavis.edu}

\begin{document}
\maketitle
\section*{\underline{Homework 5}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\vspace {0.5in}
\section*{Exercise 1}

Construct a truth table for each of these compound propositions:

\begin{itemize}

\item [a)] $A = (p \lor q) \rightarrow (p \oplus q) $

\item [b)] $A = (p \leftrightarrow q) \oplus (\neg p \leftrightarrow \neg r) $ 

\item [c)] $(A = p \oplus q) \rightarrow (p \oplus \neg q) $

\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 2 }
Construct a truth table for each of these compound propositions:

\begin{itemize}

\item [a)] $A = (\neg p \leftrightarrow \neg q) \leftrightarrow (q \leftrightarrow r) $

\item [b)]  $(p \oplus q) \land (p \oplus \neg q) $

\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 3}
Show that the following is a tautology: $ \left [ (p \lor q) \land (p \rightarrow r) \land (q \rightarrow r) \right ] \rightarrow r$.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 4 }

Show that $(p \land q) \lor (\neg p \land \neg q)$ and $p \leftrightarrow q$  are equivalent. 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 5}

\begin{itemize}

\item [a)] Use  a truth table  to show that  $(p \rightarrow q) \land (p \rightarrow r) \Leftrightarrow p \rightarrow (q \land r)$

\item [b)] Use  logical equivalences to show the same thing, i.e.  that  $(p \rightarrow q) \land (p \rightarrow r) \Leftrightarrow p \rightarrow (q \land r)$

\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 6}

The Fair Maiden Rowena wishes to wed. And her father, the Evil King Berman, has devised a way to drive off suitors. He has a little quiz for them, and here it is. It's very simple:

Three boxes sit on a table. The first is made of gold, the second is made of silver, and the third is made of lead. Inside one of these boxes is a picture of the fair Rowena. It is the job of the White Knight to figure out, without opening them, which one has her picture. 

Now, to assist him in this endeavor there is an inscription on each of the boxes. The gold box says,``Rowena's picture is in this box." The silver box says, ``The picture is not in this box." The lead box says, ``The picture is not in the gold box." Only one of the statements is true. Which box holds the picture?



\end{document}

