\documentclass{article}
\usepackage{hyperref}

\begin{document}
\flushleft \underline{Part of Homework 2 -- MATH 2510 Spring 2018}

Prolog exercise. Consider the Prolog code \texttt{logicops.pl} at \\
\href{https://github.com/tomcuchta/math2510spring2018/blob/master/logicops.pl}{https://github.com/tomcuchta/math2510spring2018/blob/master/logicops.pl}. Copy this code to \href{https://swish.swi-prolog.org/}{SWISH}. 

The fact \texttt{p(a)} is given in the code. To write the conjunction ``$A \wedge B$" in Prolog, we write \texttt{A,B} -- this is why \texttt{conj} is defined as it is in the code. The negation symbol $\neg$ is written as \texttt{\textbackslash +}. Definition 1.6 in the text defines the disjunction $\vee$ as in $P \vee Q$ as $\neg ( \neg P \wedge \neg Q)$. This justifies the defintion of \texttt{disj} in the code.
\begin{enumerate}
\item Run the query \texttt{p(a)}. What is the result?
\item Run the query \texttt{\textbackslash + p(a)}. What is the result? 
\item Run the query \texttt{p(b)}. What is the result?
\item Run the query \texttt{\textbackslash + p(b)}. What is the result? 
\item Define \texttt{impl} to encode the symbol $\rightarrow$ as in $P \rightarrow Q$ in terms of \texttt{disj}.
\item Define \texttt{iff} to encode the symbol $\leftrightarrow$ as in $P \longleftrightarrow Q$ in terms of \texttt{impl}.
\item Run \texttt{impl(p(a),p(b)}. What is the result?
\item Run \texttt{impl(\textbackslash + p(a),p(b))}. What is the result? 
\item Run \texttt{iff(p(a),p(b))}. What is the result?
\item Run \texttt{iff(p(b),p(a))}. What is the result?
\end{enumerate}
\end{document}