143 lines
4.5 KiB
TeX
143 lines
4.5 KiB
TeX
\section{Logical Algebra}
|
|
|
|
\definition{}
|
|
\textit{Logical operators} operate on the values $\{\texttt{true}, \texttt{false}\}$, \par
|
|
just like algebraic operators operate on numbers. \par
|
|
In this handout, we'll use the following operators:
|
|
\begin{itemize}
|
|
\item $\lnot$: not
|
|
\item $\land$: and
|
|
\item $\lor$: or
|
|
\item $\rightarrow$: implies
|
|
\item $()$: parenthesis.
|
|
\end{itemize}
|
|
|
|
The function of these is defined by \textit{truth tables}:
|
|
\begin{center}
|
|
\begin{tabular}{ c | c | c }
|
|
\multicolumn{3}{ c }{and} \\
|
|
\hline
|
|
$A$ & $B$ & $A \land B$ \\
|
|
\hline
|
|
\texttt{F} & \texttt{F} & \texttt{F} \\
|
|
\texttt{F} & \texttt{T} & \texttt{F} \\
|
|
\texttt{T} & \texttt{F} & \texttt{F} \\
|
|
\texttt{T}& \texttt{T} & \texttt{T}
|
|
\end{tabular}
|
|
\hfill
|
|
\begin{tabular}{ c | c | c }
|
|
\multicolumn{3}{ c }{or} \\
|
|
\hline
|
|
$A$ & $B$ & $A \lor B$ \\
|
|
\hline
|
|
\texttt{F} & \texttt{F} & \texttt{F} \\
|
|
\texttt{F} & \texttt{T} & \texttt{T} \\
|
|
\texttt{T} & \texttt{F} & \texttt{T} \\
|
|
\texttt{T} & \texttt{T} & \texttt{T}
|
|
\end{tabular}
|
|
\hfill
|
|
\begin{tabular}{ c | c | c }
|
|
\multicolumn{3}{ c }{implies} \\
|
|
\hline
|
|
$A$ & $B$ & $A \rightarrow B$ \\
|
|
\hline
|
|
\texttt{F} & \texttt{F} & \texttt{T} \\
|
|
\texttt{F} & \texttt{T} & \texttt{T} \\
|
|
\texttt{T} & \texttt{F} & \texttt{F} \\
|
|
\texttt{T} & \texttt{T} & \texttt{T}
|
|
\end{tabular}
|
|
\hfill
|
|
\begin{tabular}{ c | c }
|
|
\multicolumn{2}{ c }{not} \\
|
|
\hline
|
|
$A$ & $\lnot A$ \\
|
|
\hline
|
|
\texttt{T} & \texttt{F} \\
|
|
\texttt{F} & \texttt{T} \\
|
|
~ & ~ \\
|
|
~ & ~ \\
|
|
\end{tabular}
|
|
\end{center}
|
|
|
|
\vspace{2mm}
|
|
|
|
$A \land B$ is \texttt{true} only if both $A$ and $B$ are \texttt{true}. $A \lor B$ is \texttt{true} if $A$ or $B$ (or both) are \texttt{true}. \par
|
|
$\lnot A$ is the opposite of $A$, which is why it looks like a \say{negative} sign. \par
|
|
|
|
\vspace{2mm}
|
|
|
|
$A \rightarrow B$ is a bit harder to understand. Read aloud, this is \say{$A$ implies $B$.} \par
|
|
The only time $\rightarrow$ produces \texttt{false} is when $\texttt{true} \rightarrow \texttt{false}$.
|
|
This fact may seem counterintuitive, but will make more sense as we progress through this handout. \par
|
|
\hint{
|
|
Think about it---if event $\alpha$ implies $\beta$, it is impossible for $\alpha$ to occur without $\beta$. \par
|
|
This is the only impossibility. All other variants are valid.
|
|
}
|
|
|
|
\problem{}
|
|
Evaluate the following.
|
|
\begin{itemize}
|
|
\item $\lnot \texttt{T}$
|
|
\item $\texttt{F} \lor \texttt{T}$
|
|
\item $\texttt{T} \land \texttt{T}$
|
|
\item $(\texttt{T} \land \texttt{F}) \lor \texttt{T}$
|
|
\item $(\texttt{T} \land \texttt{F}) \lor \texttt{T}$
|
|
\item $(\lnot (\texttt{F} \lor \lnot \texttt{T}) ) \rightarrow \texttt{T}$
|
|
\item $(\texttt{F} \rightarrow \texttt{T}) \rightarrow (\lnot \texttt{F} \lor \lnot \texttt{T})$
|
|
\end{itemize}
|
|
|
|
\vfill
|
|
\pagebreak
|
|
\begin{instructornote}
|
|
We can also think of $[x \geq 0] \rightarrow b$ as follows:
|
|
if $x$ isn't the kind of object we care about, we evaluate true and
|
|
check the next one. If $x$ \textit{is} the kind of object we care about
|
|
and $b$ is false, we have a counterexample to $[x \geq 0] \rightarrow b$,
|
|
and thus $\texttt{T} \rightarrow \texttt{F}$ must be false.
|
|
|
|
|
|
\vspace{2mm}
|
|
|
|
Say we have the sentence $\forall x ~ (a \rightarrow b)$. \par
|
|
For example, take $\varphi = \forall x ~ ([x \geq 0] \rightarrow [\exists y ~ y^2 = x])$. \par
|
|
$\varphi$ holds whenever any positive $x$ has a square root.
|
|
|
|
\vspace{2mm}
|
|
|
|
If $(\text{F} \rightarrow *)$ returned false, statements like the above would be hard to write. \par
|
|
If $x$ is negative, $\varphi$ doesn't care whether or not it has a root. In this case, $\text{F} \rightarrow *$ must be true to avoid making whole $\forall$ false.
|
|
\end{instructornote}
|
|
|
|
|
|
\problem{}
|
|
Evaluate the following.
|
|
\begin{itemize}
|
|
\item $A \rightarrow \texttt{T}$ for any $A$
|
|
\item $(\lnot (A \rightarrow B)) \rightarrow A$ for any $A, B$
|
|
\item $(A \rightarrow B) \rightarrow (\lnot B \rightarrow \lnot A)$ for any $A, B$
|
|
\end{itemize}
|
|
|
|
\vfill
|
|
|
|
\problem{}
|
|
Show that $\lnot (A \rightarrow \lnot B)$ is equivalent to $A \land B$. \par
|
|
That is, show that these expressions always evaluate to the same value given
|
|
the same $A$ and $B$. \par
|
|
\hint{Use a truth table}
|
|
|
|
\vfill
|
|
|
|
\problem{}
|
|
Write an expression equivalent to $A \lor B$ using only $\lnot$, $\rightarrow$, and $()$?
|
|
|
|
\begin{solution}
|
|
$((\lnot A) \rightarrow B)$
|
|
\end{solution}
|
|
|
|
\vfill
|
|
|
|
Note that both $\land$ and $\lor$ can be defined using the other logical symbols. \par
|
|
The only logical symbols we \textit{need} are $\lnot$, $\rightarrow$, and $()$. \par
|
|
We include $\land$ and $\lor$ to simplify our expressions.
|
|
|
|
\pagebreak |