% 
% hw1.tex
%
%   This is a LaTeX template to get you started
%   making problem-set solutions
%
 
\documentclass[11pt]{article}

\usepackage{amssymb,amsmath,pstricks,framed}
\usepackage{color}

\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\textheight}{9.0in}
\setlength{\textwidth}{6.5in}
\setlength{\topmargin}{-0.5in}

% *** GRAPHICS RELATED PACKAGES ***
%

\usepackage[pdftex]{graphicx}
 \graphicspath{{./}}
 \DeclareGraphicsExtensions{.pdf,.jpeg,.png}

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

\begin{document}
\maketitle

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 1}

We are on the island of knights and knaves . You meet three residents, Alex, Bill, and Claudia who make the following statements:
\begin{align*}
&\text{Alex says: ``Bill is a knave and Claudia is a knight"}\\
&\text{Bill says: ``Claudia is a knight and Alex is a knight"}\\
&\text{Claudia says: ``I like cookies"}
\end{align*}
Does Claudia really like cookies?


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 2}


A very special island is inhabited only by knights and knaves. Knights always tell the truth, and knaves always lie. You meet three inhabitants: Alex, John and Sally. Alex says, ``At least one of the following is true: that Sally is a knave or that I am a knight." John says, "Alex could claim that I am a knave." Sally claims, ``Neither Alex nor John are knights." Can you find who is a knight and who is a knave?


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 3}

Find the output/ truth table for this logic gate circuit. Convert it into a Boolean expression

\begin{figure}[!h]
\centering
\includegraphics[width=3in]{HW3_1}
\end{figure}


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


Find the output/ truth table for this logic gate circuit. Can you find a simpler logic gate that would perform the same operation on $A$ and $B$?

\begin{figure}[!h]
\centering
\includegraphics[width=4in]{HW3_2}
\end{figure}



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

Let us play a logical game. You find yourself in front of three rooms whose doors are closed.
Behind each door, there could be a Lady or a Tiger. There is only one Lady and two Tigers.
There is one sign on each door; you are told
that the sign on the door of the room containing the Lady is true, and that at least one of the other two signs is false Here are the signs: 

\begin{framed}
\begin{minipage}[c]{.30\linewidth}
\centering
\begin{framed}
Room I \\
A Tiger is in room II
\end{framed}
\end{minipage}
\begin{minipage}[c]{.30\linewidth}
\centering
\begin{framed}
Room II \\
A Tiger is in this room
\end{framed}
\end{minipage}
\begin{minipage}[c]{.30\linewidth}
\centering
\begin{framed}
Room III \\
A Tiger is in room I
\end{framed}
\end{minipage}
\end{framed}

\noindent Can you find what is inside each room?


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

Which answer in the list below is the correct answer to this question?
\begin{itemize}
\item [1)] All of the below
\item [2)] None of the below
\item [3)]All of the above
\item [4)] One of the above
\item [5)] None of the above
\item [6)] None of the above
\end{itemize}

\end{document}

