Minor edits

This commit is contained in:
2024-05-23 12:40:43 -07:00
parent 7800e94834
commit f7eb30a916
7 changed files with 207 additions and 93 deletions

View File

@ -1,7 +1,7 @@
\section{Logical Algebra}
\definition{}
\textit{Logical operators} operate on the values $\{\text{True}, \text{False}\}$, \par
\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}
@ -9,7 +9,7 @@ In this handout, we'll use the following operators:
\item $\land$: and
\item $\lor$: or
\item $\rightarrow$: implies
\item $()$, parenthesis.
\item $()$: parenthesis.
\end{itemize}
The function of these is defined by \textit{truth tables}:
@ -19,10 +19,10 @@ The function of these is defined by \textit{truth tables}:
\hline
$A$ & $B$ & $A \land B$ \\
\hline
F & F & F \\
F & T & F \\
T & F & F \\
T & T & T
\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 }
@ -30,10 +30,10 @@ The function of these is defined by \textit{truth tables}:
\hline
$A$ & $B$ & $A \lor B$ \\
\hline
F & F & F \\
F & T & T \\
T & F & T \\
T & T & T
\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 }
@ -41,10 +41,10 @@ The function of these is defined by \textit{truth tables}:
\hline
$A$ & $B$ & $A \rightarrow B$ \\
\hline
F & F & T \\
F & T & T \\
T & F & F \\
T & T & T
\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 }
@ -52,8 +52,8 @@ The function of these is defined by \textit{truth tables}:
\hline
$A$ & $\lnot A$ \\
\hline
T & F \\
F & T \\
\texttt{T} & \texttt{F} \\
\texttt{F} & \texttt{T} \\
~ & ~ \\
~ & ~ \\
\end{tabular}
@ -61,30 +61,40 @@ The function of these is defined by \textit{truth tables}:
\vspace{2mm}
$A \land B$ is only true if both $A$ and $B$ are true. $A \lor B$ is true when $A$ or $B$ (or both) are true. \par
$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$ is false is when $T \rightarrow F$. This may seem counterintuitive, but it will make more sense as we progress through this handout.
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 T$
\item $F \lor T$
\item $T \land T$
\item $(T \land F) \lor T$
\item $(T \land F) \lor T$
\item $(\lnot (F \lor \lnot T) ) \rightarrow T$
\item $(F \rightarrow T) \rightarrow (\lnot F \lor \lnot T)$
\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}
After the class has done a few definable set problems, you can try to provide some intuition for $\rightarrow$ with the following example.
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}
@ -96,17 +106,13 @@ Evaluate the following.
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.
\vspace{2mm}
You can think of $[x \geq 0] \rightarrow b$ as a \say{sanity check} in a program: if $x$ isn't the kind of object we care about, return 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 $T \rightarrow F$ must be false.
\end{instructornote}
\problem{}
Evaluate the following.
\begin{itemize}
\item $A \rightarrow T$ for any $A$
\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}
@ -115,13 +121,14 @@ Evaluate the following.
\problem{}
Show that $\lnot (A \rightarrow \lnot B)$ is equivalent to $A \land B$. \par
That is, show that these give the same result for the same $A$ and $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{}
Can you express $A \lor B$ using only $\lnot$, $\rightarrow$, and $()$?
Write an expression equivalent to $A \lor B$ using only $\lnot$, $\rightarrow$, and $()$?
\begin{solution}
$((\lnot A) \rightarrow B)$
@ -131,6 +138,6 @@ Can you express $A \lor B$ using only $\lnot$, $\rightarrow$, and $()$?
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 logical expressions.
We include $\land$ and $\lor$ to simplify our expressions.
\pagebreak

View File

@ -9,27 +9,31 @@ A \textit{universe} is a set of meaningless objects. Here are a few examples:
\end{itemize}
\definition{}
A \textit{structure} consists of a universe $U$ and a set of symbols. \par
A \textit{structure} consists of a universe and a set of \textit{symbols}. \par
A structure's symbols give meaning to the objects in its universe.
\vspace{2mm}
Symbols come in three types:
\begin{itemize}
\item Constant symbols, which let us specify specific elements of our universe. \par
\item \textit{Constant symbols}, which let us specify specific elements of our universe. \par
Examples: $0, 1, \frac{1}{2}, \pi$
\vspace{2mm}
\item Function symbols, which let us navigate between elements of our universe. \par
Examples: $+, \times, \sin{x}, \sqrt{x}$
\item \textit{Function symbols}, which let us navigate between elements of our universe. \par
Examples: $+, \times, \sin{x}, \sqrt{x}$ \par
\note{In this handout, symbols we usually call \say{operators} are also called functions. \par
The only difference between $a + b$ and $+(a, b)$ is notation.}
\vspace{2mm}
\item Relation symbols, which let us compare elements of our universe. \par
\item \textit{Relation symbols}, which let us compare elements of our universe. \par
Examples: $<, >, \leq, \geq$ \par
\vspace{2mm}
\end{itemize}
The equality check $=$ is \textbf{not} a relation symbol. It is included in every structure by default.
The equality check $=$ is \textbf{not} a relation symbol. It is included in every structure by default. \par
By definition, $a = b$ is true if and only if $a$ and $b$ are the same element of our universe.
\vspace{3mm}
@ -42,7 +46,7 @@ $$
\vspace{2mm}
This is a structure with the universe $\mathbb{Z}$ that contains the following symbols:
This is a structure over the universe $\mathbb{Z}$ that provides the following symbols:
\begin{itemize}
\item Constants: \tab $\{0, 1\}$
\item Functions: \tab $\{+, -\}$
@ -51,24 +55,37 @@ This is a structure with the universe $\mathbb{Z}$ that contains the following s
\vspace{2mm}
If we look at our set of constant symbols, we see that the only integers we can directly refer to in this structure are 0 and 1. If we want any others, we must define them using the tools this structure offers.
If we look at our set of constant symbols, we see that the only integers
we can directly refer to in this structure are 0 and 1. If we want any
others, we must define them using the tools this structure offers.
\vspace{1mm}
\vspace{2mm}
To \say{define} an element of a set, we need to write a sentence that is only true for that element. For example, if we want to define 2 in the structure above, we could use the sentence $\varphi(x) = [1 + 1 = x]$. \par
Clearly, this is only true when $x = 2$.
To \say{define} an element of a set, we need to write a sentence that is only true for that element. \par
For example, if we want to define 2 in the structure above, \par
we could use the sentence \say{$2$ is the $x$ that satisfies $[1 + 1 = x]$.} \par
This is a valid definition because $2$ is the \textbf{only} element of $\mathbb{Z}$ for which $[1 + 1 = x]$
evaluates to \texttt{true}.
\problem{}
Define $-1$ in $\Bigl( \mathbb{Z} ~\big|~ \{0, 1, +, -, <\} \Bigr)$.
\begin{solution}
The sentences \say{$x$ where $[x + 1 = 0]$} and \say{$x$ where $[0 - 1 = x]$} both work.
\end{solution}
\vfill
\pagebreak
Let us formalize what we found in the previous two problems. \par
\definition{}
A \textit{formula} in a structure $S$ is a well-formed string of constants, functions, and relations. \par
\definition{Formulas}
A \textit{formula} in a structure $S$ is a well-formed string
of constants, functions, relations, \par and logical operators.
\vspace{2mm}
@ -77,15 +94,20 @@ For the sake of time, I will not provide a formal definition. It isn't particula
\vspace{2mm}
As a quick example, the formula $\phi(x) = [1 + 1 = x]$ evaluates to \texttt{true} when $x$ is 2 \par
and to \texttt{false} otherwise.
\definition{Free Variables}
A formula can contain one or more \textit{free variables.} These are denoted $\varphi{(a, b, ...)}$. \par
Formulas with free variables let us define \say{properties} that certain objects have. \par
For example, $x$ is a free variable in the formula $\varphi(x) = [x > 0]$. \par
$\varphi(3)$ is true and $\varphi(-3)$ is false. \par
For example, $x$ is a free variable in the formula above. \par
$\varphi(2)$ is \texttt{true} and $\varphi(-3)$ is \texttt{false}. \par
\vspace{2mm}
This \say{free variable} notation is much like the function notation you are used to: \par
This \say{free variable} notation is much like the function notation we are used to: \par
$\varphi(x) = [x > 0]$ is similar to $f(x) = x + 1$, since the values of $\varphi(x)$ and $f(x)$ depend on $x$.

View File

@ -4,12 +4,14 @@ Recall the logical symbols we introduced earlier: $(), \land, \lor, \lnot, \righ
We will now add two more: $\forall$ (for all) and $\exists$ (exists).
\definition{}
$\forall$ and $\exists$ are \textit{quantifiers}. They allow us to make statements about arbitrary symbols.
$\forall$ and $\exists$ are \textit{quantifiers}. They allow us to make statements about arbitrary symbols. \par
\hint{Quantifiers are aptly named: they tell us \textit{how many} symbols satisfy a certain sentence.}
\vspace{2mm}
Let's look at $\forall$ first. Let $\varphi(x)$ be a formula. \par
Then, the formula $\forall x ~ \varphi(x)$ says \say{$\varphi$ is true for all possible $x$.}
Let's look at $\forall$ first. If $\varphi(x)$ is a formula, \par
the formula $\forall x ~ \varphi(x)$ is true only if $\varphi$ is true for all $x$ in our universe.
\vspace{1mm}
@ -18,8 +20,8 @@ In English, this means \say{For any $x$, $x$ is bigger than zero,} or simply \sa
\vspace{3mm}
$\exists$ is very similar: the formula $\exists x ~ \varphi(x)$ states that there is at least one $x$ that makes $\varphi$ true. \par
For example, $\exists ~ (0 < x)$ means \say{there is a positive number in our set}.
$\exists$ is very similar: the formula $\exists x ~ \varphi(x)$ is true if ther is at least one $x$ for which $\varphi(x)$ is true. \par
For example, $\exists ~ (0 < x)$ means \say{there is a positive number in our set.}
\vspace{4mm}
@ -64,7 +66,7 @@ What's the difference between $\exists x ~ \forall y ~ (x \leq y)$ and $\forall
\hint{In $\mathbb{R}^+$, the first is false and the second is true. $\mathbb{R}^+$ does not contain zero.}
\begin{solution}
If $\exists x$ is inside $\forall y$, $x$ depends on $y$. We can have a different value of $x$ for every $y$. \par
If $\exists x$ is inside $\forall y$, $x$ depends on $y$. We may pick a different value of $x$ for every $y$. \par
If $\exists x$ is outside, $x$ is fixed \textit{before} we check all $y$.
\end{solution}
@ -98,10 +100,10 @@ Define $-1$ in $\Bigl( \mathbb{Z} ~\big|~ \{0, <\} \Bigr)$
\problem{}
Let $\varphi(x)$ be a formula. \par
Define $(\forall x ~ \varphi(x))$ using logical symbols and $\exists$.
Write a formula equivalent to $[~ \forall x ~ \varphi(x) ~]$ using only logical symbols and $\exists$.
\begin{solution}
$\Bigl(\forall x ~ \varphi(x)\Bigr)$ is true iff $\lnot \Bigl(\exists x ~ \lnot \varphi(x) \Bigr)$ is true.
$[~ \forall x ~ \varphi(x) ~]$ is true if and only if $[~ \lnot \exists x ~ \lnot \varphi(x) ~]$ is true.
\end{solution}
\vfill

View File

@ -3,37 +3,40 @@
Armed with $(), \land, \lor, \lnot, \rightarrow, \forall,$ and $\exists$, we have enough tools to define sets.
\definition{Set-Builder Notation}
Say we have a condition $c$. \par
The set of all elements that satisfy that condition can be written as follows:
$$
\{ x ~|~ \text{$c$ is true} \}
$$
This is read \say{The set of $x$ where $c$ is true} or \say{The set of $x$ that satisfy $c$.}
Say we have a sentence $\varphi(x)$. \par
The set of all elements that satisfy that sentence can be written as follows:
\begin{equation*}
\{ x ~|~ \varphi(x) \}
\end{equation*}
This is read \say{The set of $x$ where $\varphi$ is true} or \say{The set of $x$ that satisfy $\varphi$.}
\vspace{2mm}
For example, take the formula $\varphi(x) = \exists y ~ (y + y = x)$. \par
The set of all even integers can then be written
The set of all even integers can then be written as
$$
\{ x ~|~ \varphi(x) \} = \{ x ~|~ \exists y ~ (y + y = x) \}
\{ x ~|~ \exists y ~ (y + y = x) \}
$$
\definition{Definable Sets}
Let $S$ be a structure with a universe $U$. \par
We say a subset $M$ of $U$ is \textit{definable} if we can write a formula that is true for some $x$ iff $x \in M$.
We say a subset $M$ of $U$ is \textit{definable} if we
can write a formula that is true for some $x$ iff $x \in M$.
\vspace{4mm}
For example, consider the structure $\Bigl( \mathbb{Z} ~\big|~ \{+\} \Bigr)$ \par
\vspace{2mm}
For example, consider the structure $\big\langle~ \mathbb{Z} ~\big|~ \{+\} ~\big\rangle$ \par
Only even numbers satisfy the formula $\varphi(x) = \exists y ~ (y + y = x)$, \par
So we can define \say{the set of even numbers} as $\{ x ~|~ \exists y ~ (y + y = x) \}$. \par
so we can define \say{the set of even numbers} as $\{ x ~|~ \exists y ~ (y + y = x) \}$. \par
Remember---we can only use symbols that are available in our structure!
\problem{}
Is the empty set definable in any structure?
When is the empty set definable?
\begin{solution}
Always: $\{ x ~|~ \lnot (x = x) \}$
\end{solution}
\vfill
@ -44,31 +47,22 @@ Define $\{0, 1\}$ in $\Bigl( \mathbb{Z}^+_0 ~\big|~ \{<\} \Bigr)$
\begin{instructornote}
Here's an interesting fact:
A finite set of definable elements is always definable. Why? \par
An infinite set of definable elements may not be definable.
A finite set of definable elements is always definable. \note{(Why?)} \par
An infinite set of definable elements might not be definable.
\end{instructornote}
\vfill
\problem{}
Define the set of prime numbers in $\Bigl( \mathbb{Z} ~\big|~ \{\times, \div, <\} \Bigr)$
\vfill
\vfill
\pagebreak
\problem{}
Define the set of nonreal numbers in $\Bigl( \mathbb{C} ~\big|~ \{\text{real}(z)\} \Bigr)$ \par
\hint{$\text{real}(z)$ gives the real part of a complex number: $\text{real}(3 + 2i) = 3$}
\hint{$z$ is nonreal if $x \in \mathbb{C}$ and $x \notin \mathbb{R}$}
\begin{solution}
$\Bigl\{ x ~\bigl|~ \text{real}(x) \neq x \Bigr\}$
\end{solution}
\vfill
\problem{}
@ -77,7 +71,7 @@ Define $\mathbb{R}^+_0$ in $\Bigl( \mathbb{R} ~\big|~ \{\times\} \Bigr)$ \par
\vfill
\problem{}
Let $\bigtriangleup$ be a relational symbol. $a \bigtriangleup b$ holds iff $a$ divides $b$. \par
Let $\bigtriangleup$ be a relational symbol. $a \bigtriangleup b$ is true if and only if $a$ divides $b$. \par
Define the set of prime numbers in $\Bigl( \mathbb{Z}^+ ~\big|~ \{ \bigtriangleup \} \Bigr)$ \par
\vfill
@ -93,7 +87,7 @@ Define $\mathbb{Z}^+_0$ in $\Bigl( \mathbb{Z} ~\big|~ \{\times, +\} \Bigr)$
\problem{}
Define $<$ in $\Bigl( \mathbb{Z} ~\big|~ \{\times, +\} \Bigr)$ \par
\hint{We can't formally define a relation yet. Don't worry about that for now. \\
You can repharase this question as \say{given $a,b \in \mathbb{Z}$, can you write a sentence that is true iff $a < b$?}}
You can repharase this question as \say{given $a,b \in \mathbb{Z}$,\\*/ write a sentence that is only true if $a < b$?}}
\vfill
\pagebreak
@ -111,20 +105,24 @@ Define $\{-2, 2\}$ in $S$.
\vfill
\problem{}
Let $P$ be the set of all subsets of $\mathbb{Z}^+_0$. This is called a \textit{power set}. \par
Let $S$ be the structure $( P ~|~ \{\subseteq\})$ \par
Let $\mathcal{P}$ be the set of all subsets of $\mathbb{Z}^+_0$. This is called the \textit{power set} of $\mathbb{Z}^+_0$. \par
Let $S$ be the structure $( \mathcal{P} ~|~ \{\subseteq\})$ \par
\problempart{}
Show that the empty set is definable in $S$. \par
\hint{Defining $\{\}$ with $\{x ~|~ x \neq x\}$ is \textbf{not} what we need here. \\
We need $\varnothing \in P$, the \say{empty set} element in the power set of $\mathbb{Z}^+_0$.}
We need $\varnothing \in \mathcal{P}$, the \say{empty set} element in the power set of $\mathbb{Z}^+_0$.}
\vfill
\problempart{}
Let $x \Bumpeq y$ be a relation on $P$. $x \Bumpeq y$ holds if $x \cap y \neq \{\}$. \par
Let $x \Bumpeq y$ be a relation on $\mathcal{P}$. $x \Bumpeq y$ holds if $x \cap y \neq \{\}$. \par
Show that $\Bumpeq$ is definable in $S$.
\vfill
\problempart{}
Let $f$ be a function on $P$ defined by $f(x) = \mathbb{Z}^+_0 - x$. This is called the \textit{complement} of the set $x$. \par
Let $f$ be the function on $\mathcal{P}$ defined by $f(x) = \mathbb{Z}^+_0 - x$. This is called the \textit{complement} of $x$. \par
Show that $f$ is definable in $S$.
\vfill

View File

@ -7,7 +7,7 @@ This is read \say{$S$ satisfies $\varphi$}
\definition{}
Let $S$ and $T$ be structures. \par
We say $S$ and $T$ are \textit{equivalent} and write $S \equiv T$ if for any formula $\varphi$, $S \models \varphi \Longleftrightarrow T \models \varphi$. \par
We say $S$ and $T$ are \textit{equivalent} (and write $S \equiv T$) if for any formula $\varphi$, $S \models \varphi \Longleftrightarrow T \models \varphi$. \par
If $S$ and $T$ are not equivalent, we write $S \not\equiv T$.
\problem{}