\documentclass{article}
\input{preamble.tex}
\usepackage{url}
\title{Day 5}
\date{Friday May 25, 2012}
\newcommand{\df}{\textbf}
 \def\Display{\@empty}
\newcommand{\Hide}[2]{\ifx \Display\undefined \strut \\ \vspace{#1} \\ \strut  \else {\color{blue} #2} \fi  }
\begin{document}
	\maketitle
	
	\section{Quantifiers}
	
	So far, we have done math with the expectation that atoms are always either true or false. In reality though, we would like to talk about atoms like
	\[
		x > 2
	\]
	Whose truth depends on the value of $x$. Then we can make entire statements that depend on variables. Such statements are called \df{formulas}, or \df{properties}; that is, a formula is a statement whose truth may depend on the values of certain variables. 
	
	We often write formulas as if they were a function; so we might write
	\[
		\phi(x) := x > 2
	\]
	There I'm saying the formula $\phi(x)$ stands for the formula $x > 2$. Then $\phi(2)$ is an atom we are already used to, that is $2 > 2$ and is false. But $\phi(3)$ is true.
	
	There are two questions that we like to ask about formulas:
	\begin{enumerate}
		\item Are they true no matter what $x$ is?
		\item Are they true for any value of $x$?
	\end{enumerate}
	
	The first question is asking a \df{universal} question, that is whether a formula is true for every value of $x$. The second question is asking an \df{existential} question, that is whether a formula is ever true. 
	
	The act of transforming the formula $\phi(x)$ to one of the above is called \df{quantification}. That is, we are interested in how often the formula is true: always, sometimes, or never?
	
	\subsection{Domain of Discourse}
	
	When we ask these questions, you might ask what does it mean to be true for every value of $x$. For instance, consider the formula:
	\[
		x^2 \geq 0
	\]
	Is this true for every value of $x$? Not really, since there are complex numbers with the property that $x^2 < 0$. So, we need to be careful. 
	
	The objects that we are considering when quantify a formula is called the \df{domain of discourse}. Every quantified statement has some domain of discourse, whether it's explicit or implicit. 
	
	\begin{rmk}
		It is conventional if the domain of discourse is not given or understood from context then we just assume it is the real numbers. 
	\end{rmk}
	
	\subsection{Notation}
	
	If $\phi(x)$ is a formula with variable $x$, and we wish to quantify it in the universal way (that is: we want to say that $\phi(x)$ holds for every $x$) then we write
	\[
		\A x \stt \phi(x)
	\]
	We read the symbol $\A$ as ``for all'' So the above statement is read ``For all x, $\phi(x)$ holds'' or some variation. 
	
	If we want to quantify it with the variable $x$ in the existential way (that is: we want to say $\phi(x)$ holds for some $x$) then we write
	\[
		\E x \stt \phi(x)
	\]
	
	We read the symbol $\E$ as ``there exists'' So the above statement is read ``There exists an $x$ such that $\phi(x)$ holds.''
	
	\subsubsection{Specifying The Domain of Discourse}
	
	We would like to be able to express the domain of discourse in the quantifier to eliminate any confusion or ambiguities. Recall we had the following symbols for our different number systems.
	\begin{center}
	\begin{tabular}{| c | c |} \hline
		Reals & $\R$ \\ \hline
		Rationals & $\Q$ \\ \hline
		Integers & $\Z$ \\ \hline
		Naturals & $\N$ \\ \hline
	\end{tabular}
	\end{center}
	
	If we wanted to specify the domain of discourse was $S$ for $S$ one of the systems above, we would write
	\[
		\A x \in S \stt \phi(x)
	\]

	For instance, if one wanted to quantify over the real numbers, you would write
	\[
		\A x \in \R \stt \phi(x)
	\]

	\subsubsection{Free versus Bound Variables}
	
	In $\phi(x)$ we are specifying a variable $x$ that we could quantify using a quantifier if we wish. We could also plug in values in for $x$ to make statements. For example, 
	\[
		\phi(x) := x > 2
	\]
	
	We can plug in for $x$ and get a statement like $\phi(2)$ which is $2 > 2$. We say such a variable is \df{free}. 
	
	If we bound $x$, to form the statement $\A x \stt \phi(x)$, which has no free variable in it.
	
	\begin{rmk}
		This is similar to something you might have seen before in concepts. You may have a function $f(x) = x^2$ and you might take the definite integral of $f(x)$ from $0$ to $1$:
		\[
			\int_0^1 f(x) \; dx
		\]
		Notice this value is not a function, but a number. Just as $\phi(x)$ is a formula with a free variable $x$, when we quantify out the $x$ we are left with a statement $\A x \stt \phi(x)$
	\end{rmk}
	
	\begin{dfn}[Bound Variables]
		If we have a quantified statement like $\A x \st \phi(x)$, we say that the variable $x$ is \df{bound}. This is because it is tethered to the quantifier, and only makes sense in it's scope. 
	\end{dfn}

	\begin{rmk}
		Bound variables only live in the scope of their quantifier!! Outside of that, they have no means.
	\end{rmk}
	
	\begin{eg}
		Consider
		\[
			(x > 0) \oand (\A x\in \R \stt x^2 > 0)
		\]
		Here, there is a free variable, $x$. And $x$ is also a bound variable in the scope of the universal quantifier. But, they are different $x$'s!! The $x$ inside of the universal quantifier is completely different than the free one outside. 
	\end{eg}
	
	\begin{fact}[Principle of Alpha Conversion]
		If $\A x \stt \phi(x)$ is some statement, then we can change the bound variable to whatever we want, as long as that variable doesn't occur in $\phi(x)$ elsewhere. 
		
		That is to say, if $y$ doesn't occur anywhere in $\phi(x)$ then instead of writing $\A x \stt \phi(x)$ we might as well write $\A y \stt \phi(y)$
	\end{fact}
	
	Why? Well, consider the following psedocode
	\begin{quote}
	\begin{verbatim}
for (i=0; i<10; i++) {
   print i;
}
print i;
	\end{verbatim}
	\end{quote}
	
	Notice that $i$ is a bound variable; it only exists in the scope of the for all statement! Therefore, the last ``print i'' statement does not make sense as that is a different $i$ in the for loop!
	
	Furthermore, this is made more clear by using the principle of alpha conversion on that code. 
	
	\begin{quote}
	\begin{verbatim}
for (j=0; j<10; j++) {
   print j;
}
print i;
	\end{verbatim}
	\end{quote}


	\begin{rmk}
		I am so so so so picky about variables. Please be careful. 
	\end{rmk}

	
	\subsection{Some examples}
	
	Let's write some example of some universal statements, and try to decide whether they are true or false.
	
	\begin{eg}
		\[
			\A n\in\N \stt (n+1) > 0 
		\]
		\Hide{1cm}{This is true! It's saying the successor of any natural number is larger than $0$}
	\end{eg}


	\begin{eg}
		\[
			\E x\in \R \stt x^2 < 0
		\]
		\Hide{1cm}{This is false! There is no real number that you can square to get a negative number!}
	\end{eg}
	
	\subsection{Proofs Involving Quantifiers}
	
	\subsubsection{Proving Universal Quantifiers}
	
	How do we prove a statement about universal quantifiers directly? That is, how would we prove
	\[
		\A x \stt \phi(x)
	\]
	
	The idea is this: to prove $\phi(x)$ is true for every $x$ we take $x$ to be an \df{arbitrary} element in our domain of discourse. But what do we mean by arbitrary? We mean that we do not assume any special properties of $x$ except that it is in the domain of discourse!
	
	So we have the following ``proof skeleton''
	
	\[
		\A x\in S \stt \phi(x)
	\]
	\begin{proof}
		Let $x$ be an arbitrary element in $S$. 
		
		\ldots \textit{Here is the ``meat'' of the proof where you prove $\phi(x)$} \ldots
		
		Thus, we have $\phi(x)$; as $x$ was taken arbitrary we then have $\phi(x)$ for any $x$. 
	\end{proof}


	\subsubsection{Proving Existential Quantifiers}
	
	Remember what $\E x \stt \phi(x)$ is intended to mean: it should mean that there is an $x$ such that $\phi(x)$ holds. So how should we prove something like that?
	\[
		\E x \stt \phi(x)
	\]
	The idea is this: to prove $\phi(x)$ is true, we need to give an $x$ in the domain of discourse for which $\phi(x)$ holds. 
	
	So we have the following ``proof skeleton''
	
	\[
		\E x \stt \phi(x)
	\]
	\begin{proof}
		Define $x$ to be Blah. \textit{Blah is something specific in the domain of discourse}
		
		\ldots \textit{This is where you prove that $\phi(x)$ holds} \ldots
		
		Therefore we have $\phi(x)$. Therefore, there exists some $x$ such that $\phi(x)$. 
	\end{proof}

	\subsubsection{Using a Universal Quantifier}
	
	We might also be in the situation where a universal quantifier is in our context. How do we use that $\A x \stt \phi(x)$ is true?
	
	\Hide{2cm}{
		We allow ourselves to add $\phi(y)$ in our context for any $y$ in the domain of discourse that we wish!
	}

	\subsubsection{Using an Existential Quantifier}
	
	We might also be in the situation where we have an existential quantifier in our context! How do we use that?
	
	\Hide{2cm}{
		We allow ourselves to take an $y$ in the domain of discourse that is otherwise arbitrary, except that $\phi(y)$ is true. We call this $y$ a \df{witness} to the existential. 
	}
	
	\subsection{Some Proof Examples}
	
	\begin{eg}
		Let $\phi(x)$ be a formula depending only on $x$. Then
		\[
			(\A x \in \N \st \phi(x)) \to (\E x \in \N \st \phi(x))
		\]
		\begin{proof}
			\Hide{1in}{
				We are proving an implication, so we assume $\A x \st \phi(x)$ and prove $\E x \st \phi(x)$. As we have $\A x \st \phi(x)$ we know, in particular, that $\phi(1)$ holds as $1$ is a natural number. Therefore, we know $\E x \st \phi(x)$. 	
			}
		\end{proof}
	\end{eg}
	
	\begin{eg}
		Let $\phi(x)$ be a formula depending on $x$ and $\psi(x,y)$ depend on $x$ and $y$. Let the domain of discourse be $\N$ Then 
		\[
			(\A x \st \phi(x) \oor  \E y \st \psi(x,y) ) \bimp (\A x \st \E y \stt \phi(x) \oor \psi(x,y))
		\]
		
		\begin{proof}
			\Hide{2.5in}{
				There are two directions.
				
				\noindent $(\Rightarrow)$ We assume $\A x \st \phi(x) \oor \E y \st \psi(x,y)$. We want to prove $\A x \st \E y \st \phi(x) \oor \psi(x,y)$. Well, we take an arbitrary $z$ in the domain of discourse, and we hope to prove $\E y \st \phi(z) \oor \psi(z,y)$. As we have $\A x \st \phi(x) \oor \E y \st \psi(x,y)$, we can plug in $z$ for $x$. So we have $\phi(z) \oor \E y \st \psi(z,y)$. 
				
				Thus we do cases. 
				
				Case 1: Suppose $\phi(z)$. Then let $y:= 0$. Then we have $\phi(z)$, so we have $\phi(z) \oor \psi(z,0)$. Thus we have $\E y \st \phi(z) \oor \psi(z,y)$. 
				
				Case 2: Suppose $\E y \st \psi(z,y)$. Let $w$ witness this, ie. $\psi(z,w)$. In particular, $\phi(z) \oor \psi(z,w)$, so $\E y \st \phi(z) \oor \psi(z,y)$
				
				\noindent $(\Leftarrow)$ We assume $(\A x \st \E y \stt \phi(x) \oor \psi(x,y))$ and want to prove $(\A x \st \phi(x) \oor  \E y \st \psi(x,y) )$. Take $z$ to be arbitrary. Then we want $\phi(z) \oor (\E y\st\psi(z,y))$.
				
				Well, from $\A x \st \E y \stt \phi(x) \oor \psi(x,y)$ we have $\E y \stt \phi(z) \oor \psi(z,y)$. Take a witness $w$; Then we have $\phi(z) \oor \psi(z,w)$. Do cases. 
				
				Case 1: $\phi(z)$ Then we have $\phi(z) \oor \E y\st\psi(z,y)$. 
				
				Case 2: $\psi(z,w)$. Then we have $\E y\st\psi(z,y)$. So we have $\phi(z)\oor\E y\st \psi(z,y)$
			}
		\end{proof}
	\end{eg}
	
	\subsection{Negating Quantifiers}
	
	We saw yesterday that it is important to be able to negate statements to do proofs by contradiction, contraposition, or cases on whether a statement is true or false. 
	
	Therefore, we need to know how to negate statements of the form
	\begin{alignat*}{2}
		\A x\in S \stt \phi(x) &&\qquad \E x\in S \stt \phi(x)
	\end{alignat*}

	Let's first consider the universal statement. $\A x\in S \stt \phi(x)$ is true means $\phi(y)$ is true for any value of the domain of discourse. Said another way: If $y$ is in the domain of discourse then $\phi(y)$. 
	
	So, the negation should be to find a $y$ in the domain of discourse such that $\phi(y)$ fails; ie. $\neg\phi(y)$. 
	
	\[
		\neg(\A x \in S \stt \phi(x)) \bimp \E x \in S \stt \neg \phi(x)
	\]
	
	
	Similarly, $\E x \in S \stt \phi(x)$ is true means that we can find something in our domain of discourse that ``works.'' For it to be false, there must be something in the domain of discourse that ``doesn't work''.
	
	\[
		\neg (\E x \in S \stt \phi(x)) \bimp \A x\in S \stt \neg \phi(x)
	\]
	
	\section{Basic Proofs}
	
	Now, we have done some logic, we have a good idea how to proof very abstract stuff. Better, however, is proving concrete things. Fortunately, none of the skills above will go to waste!
	
	\begin{eg}
		We have already seen some basic proofs a few days ago when we talked about inequality.
		
		How would you phrase the following in quantifiers?
		\begin{itemize}
			\item AGM inequality
			
			\Hide{1cm}{ $\A x\in \R \st \A y\in \R \stt (x\geq 0 \oand y\geq 0) \to \left(\frac{x+y}{2} \geq \sqrt{xy}\right)$ }
			\item Monotonicity of Square Roots
			
			\Hide{1cm}{ $\A x\in \R \st \A y\in \R \stt (y \geq 0 \oand x\geq 0) \to ( (x > y) \to (\sqrt{x} > \sqrt{y}) )$ }
		\end{itemize}
		
		Let us do another proof of the monotonicity of square roots.
		
		\begin{proof}
			Let $x$ and $y$ be arbitrary real numbers, and assume that $y\geq 0$ and $x\geq 0$. Then I want to show that \[x > y \to \sqrt{x} > \sqrt{y}\]
			
			We prove the contrapositive. That is, we assume that $\sqrt{x} \leq \sqrt{y} \to x \leq y$
			
			Well, assume $\sqrt{x} \leq \sqrt{y}$. We square both sides, and get $x \leq y$, which is what we wanted!
		\end{proof}
		
	\end{eg}
		
	\begin{eg}
			\begin{itemize}
				\item $\E x\in \R \stt x^2 < x$
				\begin{proof}
					\Hide{2cm}{ Take $x = \frac{1}{2}$. Then $x^2 = \frac{1}{4} < \frac{1}{2} = x$. }
				\end{proof}
				\item $\A x\in \R \st \E y\in \R \stt x^3 = y$
				\begin{proof}
					\Hide{2cm}{Let $x$ be an arbitrary real number. Want to show that $\E y\in \R \stt x^3 = y$. Let $y = x^3$. }
				\end{proof}
				\item $\A x\in \R \st \E y\in \R \stt x = y^3$
				\begin{proof}
					\Hide{2cm}{Let $x$ be an arbitrary real number. Want to show that $\E y \in \R \stt x = y^3$. Well, let $y = \sqrt[3](x)$. Then $y^3 = x$}
				\end{proof}
				\item $\A n\in \N \st \E m\in \R \stt (n = 2m) \oor n=(2m+1)$
				\begin{proof}
					\Hide{2cm}{Let $n$ be an arbitrary natural number. We do cases on whether $n$ is even or odd. If $n$ is even, it is divisible by $2$. Therefore, we can let $m$ be the quotient when you divide by $2$, so then $n = 2m$. Otherwise, $n$ is odd. But, $n-1$ is even, so then we can find an $m$ such that $2m = n-1$. But then $n = 2m+1$. }
				\end{proof}
				\item $\A q_1\in \Q \st \A q_2 \in \Q \st \E q\in \Q \stt q_1 < q < q_2$
				\begin{proof}
					\Hide{2cm}{This is false. Let $q_1 = q_2 = 0$. Then we want to show $\A q\in \Q \stt \neg (q_1 < q < q_2)$ This is obvious; there is nothing between $0$ and $0$. }
				\end{proof}
				\item $\A q_1\in \Q \st \A q_2 \in \Q \st \E q\in \Q \stt (q_1\neq q_2) \to (q_1 < q < q_2)$
				\begin{proof}
					\Hide{2cm}{Let $q_1$ and $q_2$ be arbitrary rational numbers. Then let $q:= \frac{q_1 + q_2}{2}$. We can prove that that is between the two. Try to work this out on your own. }
				\end{proof}

			\end{itemize}

	\end{eg}













	
\end{document}


