\documentclass[11pt]{article}
\usepackage{amsmath,amssymb,epsfig}
\setlength{\textwidth}{7in}
\setlength{\topmargin}{-0.575in}
\setlength{\textheight}{9.25in}
\setlength{\oddsidemargin}{-.25in}
\setlength{\evensidemargin}{-.25in}
\reversemarginpar
\setlength{\marginparsep}{-15mm}
\newcommand{\rmv}[1]{}
\newcommand{\bemph}[1]{{\bfseries\itshape#1}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\imply}{\to}
\newcommand{\bic}{\leftrightarrow}
% Here the user must define certain strings for this homework assignment
%
\def\CourseCode{COMP 1002} % e.g. B38
\def\AssignmentNo{1} % e.g. 1
\def\DateHandedOut{Winter 2019} % e.g. September 18, 2002
\def\DateDue{Jan 24, 2019} % e.g. October 1, 2002
\def\TimeDue{10:00pm} % e.g. 11 am
\begin{document}
\noindent
\rmv{Computer Science }
\CourseCode \hfill \DateHandedOut\\
\begin{center}
Homework Assignment \#\AssignmentNo\\
Due: \DateDue, by \TimeDue\\
(Type it up and upload on D2L)\\
\textbf{YOUR NAME HERE} \\
\end{center}
\hrule\smallskip
\begin{enumerate}
\item \textbf{Translations} \marginpar{[50]}
Consider the following propositions: \\
$p$: I do assignments \\
$q$: I miss labs \\
$r$: I get good marks on the midterm \\
$s$: I get an $A$ in this class .
Using these propositions as definitions of $p,q$, $r$ and $s$, answer the following questions.
\begin{enumerate}
\item Write in English a sentence corresponding to $p \wedge \neg q \to r \wedge s $.
{\em Solution: \\
}
\item Write a \emph{contrapositive} of the formula in a) (in logic notation), and simplify it by moving negations onto variables using de Morgan's law and double negations rule. Then write an English sentence corresponding to your final (simplified) formula.
{\em Solution: \\
}
\item Write a \emph{negation} of the formula in a) (in logic notation), and simplify it until all negations are on variables. Then write an English translation of the resulting formula.
{\em Solution: \\
}
\item Write a logic formula for ``I get $A$ in this class only if I do assignments''.
{\em Solution: \\
}
\item Consider the formula $(p \to r) \wedge (\neg q \wedge r \to s)$. Suppose that you got $A$ in this class, and you did assignments. What values of $r$ and what values of $q$ would make this formula true? List all such pairs of values.
{\em Solution: \\
}
\end{enumerate}
\item \textbf{Puzzles}\marginpar{[20]}\\
Recall the island of knights and knaves, where knights never lie, whereas
knaves lie always (that is, every statement made by a knight is true, every statement made by a
knave is false). You meet two inhabitants of the island (call them Alice and Bob). Suppose that
Alice says ``Both Bob and I are knights" and Bob says ``Alice is a knave''. Which of them (if any) is a knight? A knave?
{\em Solution: \\
}
\item \textbf{Equivalences} \marginpar{[30]}
\begin{enumerate}
\item Show that $(p \to r) \vee (q \to r)$ is logically equivalent to $(p \wedge q) \to r$ by writing (one common) truth table for both of these formulas, and checking that the columns for $(p \to r) \vee (q \to r)$ and for $(p \wedge q) \to r$ are the same.
{\em Solution: \\
}
\item Now, show that they are equivalent by applying logical equivalences from the table in lab 1 to both of them until you get the same expression. Hint: remember that $A \to B \equiv \neg A \vee B$.
{\em Solution: \\
}
\end{enumerate}
\end{enumerate}
\end{document}