173 lines
4.7 KiB
TeX
Raw Normal View History

2023-05-06 17:05:30 -07:00
\section{Logical Algebra}
\definition{}
2024-05-23 12:40:43 -07:00
\textit{Logical operators} operate on the values $\{\texttt{true}, \texttt{false}\}$, \par
2023-07-26 17:55:07 -07:00
just like algebraic operators operate on numbers. \par
In this handout, we'll use the following operators:
2023-05-06 17:05:30 -07:00
\begin{itemize}
\item $\lnot$: not
\item $\land$: and
\item $\lor$: or
\item $\rightarrow$: implies
2024-05-23 12:40:43 -07:00
\item $()$: parenthesis.
2023-05-06 17:05:30 -07:00
\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
2024-05-23 12:40:43 -07:00
\texttt{F} & \texttt{F} & \texttt{F} \\
\texttt{F} & \texttt{T} & \texttt{F} \\
\texttt{T} & \texttt{F} & \texttt{F} \\
\texttt{T}& \texttt{T} & \texttt{T}
2023-05-06 17:05:30 -07:00
\end{tabular}
\hfill
\begin{tabular}{ c | c | c }
\multicolumn{3}{ c }{or} \\
\hline
$A$ & $B$ & $A \lor B$ \\
\hline
2024-05-23 12:40:43 -07:00
\texttt{F} & \texttt{F} & \texttt{F} \\
\texttt{F} & \texttt{T} & \texttt{T} \\
\texttt{T} & \texttt{F} & \texttt{T} \\
\texttt{T} & \texttt{T} & \texttt{T}
2023-05-06 17:05:30 -07:00
\end{tabular}
\hfill
\begin{tabular}{ c | c | c }
\multicolumn{3}{ c }{implies} \\
\hline
$A$ & $B$ & $A \rightarrow B$ \\
\hline
2024-05-23 12:40:43 -07:00
\texttt{F} & \texttt{F} & \texttt{T} \\
\texttt{F} & \texttt{T} & \texttt{T} \\
\texttt{T} & \texttt{F} & \texttt{F} \\
\texttt{T} & \texttt{T} & \texttt{T}
2023-05-06 17:05:30 -07:00
\end{tabular}
\hfill
\begin{tabular}{ c | c }
\multicolumn{2}{ c }{not} \\
\hline
$A$ & $\lnot A$ \\
\hline
2024-05-23 12:40:43 -07:00
\texttt{T} & \texttt{F} \\
\texttt{F} & \texttt{T} \\
2023-05-06 17:05:30 -07:00
~ & ~ \\
~ & ~ \\
\end{tabular}
\end{center}
\vspace{2mm}
2024-05-23 12:40:43 -07:00
$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
2023-05-06 17:05:30 -07:00
$\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
2024-05-23 12:40:43 -07:00
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.
}
2023-05-06 17:05:30 -07:00
\problem{}
Evaluate the following.
\begin{itemize}
2024-05-23 12:40:43 -07:00
\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}$
2024-05-25 10:10:55 -07:00
\item $(\lnot (\texttt{F} \lor \lnot \texttt{T}) ) \rightarrow \lnot \texttt{T}$
2024-05-23 12:40:43 -07:00
\item $(\texttt{F} \rightarrow \texttt{T}) \rightarrow (\lnot \texttt{F} \lor \lnot \texttt{T})$
2023-05-06 17:05:30 -07:00
\end{itemize}
2024-05-25 10:10:55 -07:00
\begin{solution}
\texttt{F}
\texttt{T}
\texttt{T}
\texttt{T}
\texttt{F}
\texttt{T}
\end{solution}
2023-05-06 17:05:30 -07:00
\vfill
\pagebreak
2024-05-25 10:10:55 -07:00
2023-05-18 21:13:25 -07:00
\begin{instructornote}
2024-05-23 12:40:43 -07:00
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.
2023-05-18 21:13:25 -07:00
\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}
2023-05-06 17:05:30 -07:00
2023-05-09 21:23:09 -07:00
\problem{}
Evaluate the following.
\begin{itemize}
2024-05-23 12:40:43 -07:00
\item $A \rightarrow \texttt{T}$ for any $A$
2023-05-09 21:23:09 -07:00
\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}
2024-05-25 10:10:55 -07:00
\begin{instructornote}
Note that the last formula is the contrapositive of $A \rightarrow B$.
\end{instructornote}
\begin{solution}
All are true.
\end{solution}
2023-05-09 21:23:09 -07:00
\vfill
2024-05-25 10:10:55 -07:00
% Show that A -> B ^ B -> A = T iff A = B
2023-05-06 17:05:30 -07:00
\problem{}
Show that $\lnot (A \rightarrow \lnot B)$ is equivalent to $A \land B$. \par
2024-05-23 12:40:43 -07:00
That is, show that these expressions always evaluate to the same value given
the same $A$ and $B$. \par
2023-05-06 17:05:30 -07:00
\hint{Use a truth table}
\vfill
\problem{}
2024-05-23 12:40:43 -07:00
Write an expression equivalent to $A \lor B$ using only $\lnot$, $\rightarrow$, and $()$?
2023-05-06 17:05:30 -07:00
\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
2024-05-23 12:40:43 -07:00
We include $\land$ and $\lor$ to simplify our expressions.
2023-05-06 17:05:30 -07:00
\pagebreak