\section{Quantifiers}

Recall the logical symbols we introduced earlier: $(), \land, \lor, \lnot, \rightarrow$ \par
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.

\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$.}

\vspace{1mm}

For example, take the formula $\forall x ~ (0 < x)$. \par
In English, this means \say{For any $x$, $x$ is bigger than zero,} or simply \say{Any $x$ is positive.}

\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}.

\vspace{4mm}

\problem{}
Which of the following are true in $\mathbb{Z}$? \par
Which are true in $\mathbb{R}^+_0$? \par
\hint{$\mathbb{R}^+_0$ is the set of positive real numbers and zero.} \par

\begin{itemize}[itemsep = 1mm]

	\item $\forall x ~ (x \geq 0)$
	\item $\lnot (\exists x ~ (x = 0))$

	\item $\forall x ~ [\exists y ~ (y \times y = x)]$

	\item $\forall xy ~ \exists z ~ (x < z < y)$ \tab \note{This is a compact way to write $\forall x ~ (\forall y ~ (\exists z ~ (x < z < y)))$}

	\item $\lnot \exists x ~ ( \forall y ~ (x < y) )$ %\tab~\tab \note{Solution is below.}
\end{itemize}

%\begin{examplesolution}
%	Here is a solution to the last part: $\lnot \exists x ~ ( \forall y ~ (x < y) )$ \par
%
%	\vspace{4mm}
%
%	Reading this term-by-term, we get \tab \say{not exists $x$ where (for all $y$ ($x$ smaller than $y$))} \par
%	If we add some grammar, we get \tab \say{There isn't an $x$ where all $y$ are bigger than $x$} \par
%	which we can rephrase as \tab~\tab \say{There isn't a minimum value} \par
%
%	\vspace{4mm}
%
%	Which is true in $\mathbb{Z}$ and false in $\mathbb{R}^+_0$
%\end{examplesolution}


\vfill
\pagebreak

\problem{}
Does the order of $\forall$ and $\exists$ in a formula matter? \par
What's the difference between $\exists x ~ \forall y ~ (x \leq y)$ and $\forall y ~ \exists x ~ (x \leq y)$? \par
\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 outside, $x$ is fixed \textit{before} we check all $y$.
\end{solution}


\vfill

\problem{}
Define 0 in $\Bigl( \mathbb{Z} ~\big|~ \{\times\} \Bigr)$


\vfill


\problem{}
Define 1 in $\Bigl( \mathbb{Z} ~\big|~ \{\times\} \Bigr)$


\vfill
\pagebreak


\problem{}
Define $-1$ in $\Bigl( \mathbb{Z} ~\big|~ \{0, <\} \Bigr)$

\vfill

%\problem{}
%Define $2$ in $\Bigl( \mathbb{Z} ~\big|~ \{0, <\} \Bigr)$

%\vfill

\problem{}
Let $\varphi(x)$ be a formula. \par
Define $(\forall x ~ \varphi(x))$ using 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.
\end{solution}

\vfill
\pagebreak