%% LyX 1.1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{babel}
\usepackage{amssymb}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\providecommand{\LyX}{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{ccfonts}
\usepackage{fullpage}
\usepackage{endnotes}
\renewcommand{\bfseries}{\scshape}
\renewcommand{\footnote}{\endnote}

\makeatother
\begin{document}

\title{CSC165H, Mathematical expression and reasoning for computer science\\
week 7}

\maketitle
Gary Baumgartner and Danny Heap

heap@cs.toronto.edu

SF4306A

416-978-5899

http://www.cs.toronto.edu/\textasciitilde{}heap/165/S2005/index.shtml


\section*{Proof structure}

Today we'll discuss various flavours of proof, and how to present
them in our structured proof format. After lecture I'll post Gary
Baumgartner's notes summarizing proof structure on the web page as
a reference.


\subsubsection*{Multiple quantifier example}

Suppose we have a mystery function \( f \) and the following statement
(I have added parentheses to indicate the conventional parsing)\[
\forall e\in \mathbf{R},\, \, e>0\Rightarrow (\exists d\in \mathbf{R},d>0\wedge (\forall x\in \mathbf{R},\, \, 0<|x-a|<d\Rightarrow (|f(x)-l|<e)))\]


If we want to prove this \textbf{true}, structure the proof as follows:%
\footnote{Let \( e\in \mathbf{R} \).

\begin{quote}
Assume \( e>0 \)
\begin{quote}
Let \( d_{e}= \)(something helpful)

Then \( d_{e}\in \mathbf{R} \).
\begin{quote}
Also \( d_{e}>0 \).

Let \( x\in \mathbf{R} \).
\begin{quote}
Assume \( 0<|x-a|<d_{e} \)
\begin{quote}
\( \vdots  \)
\end{quote}
So \( |f(x)-l|<e \)

Hence \( 0<|x-a|<d_{e}\Rightarrow (|f(x)-l|<e) \) 
\end{quote}
Since \( x \) is an arbitrary element of \( \mathbf{R} \), \( \forall x\in \mathbf{R},\, \, 0<|x-a|<d_{e}\Rightarrow (|f(x)-l|<e) \)
\end{quote}
Thus \( \exists d\in \mathbf{R},d>0\wedge (\forall x\in \mathbf{R},\, \, 0<|x-a|<d\Rightarrow (|f(x)-l|<e)) \)
\end{quote}
\end{quote}
\begin{quote}
Then, \( e>0\Rightarrow (\exists d\in \mathbf{R},d>0\wedge (\forall x\in \mathbf{R},\, \, 0<|x-a|<d\Rightarrow (|f(x)-l|<e))) \)
\end{quote}
\begin{quote}
Since \( e \) is an arbitrary element of \( \mathbf{R} \), \[
\forall e\in \mathbf{R},\, \, e>0\Rightarrow (\exists d\in \mathbf{R},d>0\wedge (\forall x\in \mathbf{R},\, \, 0<|x-a|<d\Rightarrow (|f(x)-l|<e)))\]
\end{quote}
}

If we want to prove the statement \textbf{false}, we first negate
it, and then use one of our proof formats (I use the equivalences
\( \neg (p\Rightarrow q)\Leftrightarrow (\neg p\wedge q) \) and \( \neg (p\wedge q)\Leftrightarrow (p\Rightarrow \neg q) \)):\[
\exists e\in \mathbf{R},\, e>0\wedge \forall d\in \mathbf{R},\, d>0\Rightarrow \exists x\in \mathbf{R},\, \, 0<|x-a|<d\wedge |f(x)-l|\geq e\]


Of course, this negation involved several applications of rules we
already know, and now its proof may be written step-by-step. In the
middle of that proof we had a {}``\( \wedge  \)'' to prove.


\subsubsection*{Proving \protect\( \wedge \protect \)}

The \( \wedge  \) subproof has the following form:

\begin{quote}
So, \( d_{e}>0 \)

Let \( x\in \mathbf{R} \)
\begin{quote}
\( \vdots  \)
\end{quote}
Since \( x \) is an arbitrary real number, \( \forall x\in \mathbf{R},0<|x-a|<d\Rightarrow |f(x)-l|<e \).

So \( d_{e}>0 \) \( \wedge  \) \( \forall x\in \mathbf{R},0<|x-a|<d\Rightarrow |f(x)-l|<e \)...
\end{quote}
We rolled the conclusion into the statement beginning {}``Therefore,
\( \exists d \)...'' The general form to prove \( A\wedge B \)
is:

\begin{quote}
\( \vdots  \)

Then \( A \).

\( \vdots  \)

Then B.

Thus \( A\wedge B \).
\end{quote}
Don't let variables introduced while proving \( A \) {}``bleed''
over into the proof of \( B \). This tells us how to prove a bi-implication,
since it is just a conjunction of implications. To prove \( A\Leftrightarrow B \),
start from its definition:

\begin{quote}
Then \( (A\Rightarrow B)\wedge (B\Rightarrow A) \).

Thus \( A\Leftrightarrow B \).
\end{quote}

\subsubsection*{Non-boolean function example}

Last time we discussed how non-boolean functions cannot take the place
of predicates (which are analogous to boolean functions) in a proof.
How should they be used? Define \( \lfloor x\rfloor :\mathbf{R}\rightarrow \mathbf{R} \)
by:

\begin{quote}
\( \lfloor x\rfloor  \) is the largest integer \( \leq x \).
\end{quote}
Now we can form the statement:

\begin{description}
\item [Claim~1:]\( \forall x\in \mathbf{R},\, \lfloor x\rfloor <x+1 \)
\end{description}
It makes sense to apply \( \lfloor x\rfloor  \) to elements of our
domain, or variables that we have introduced, and to evaluate it in
predicates such as {}``\( < \)'' but \( \lfloor x\rfloor  \) it
self is not a variable, a sentence, nor a predicate. We can't (sensibly)
say \( \forall \lfloor x\rfloor \in \mathbf{R} \) or \( \forall x\in \mathbf{R},\, \lfloor x\rfloor \vee \lfloor x+1\rfloor  \).
The structure of \textbf{Claim~1} is a direct proof of a universally-quantified
predicate:%
\footnote{Let \( x\in \mathbf{R} \)

\begin{quote}
\( \vdots  \)
\begin{quote}
Then \( \lfloor x\rfloor <x+1 \)
\end{quote}
Since \( x \) is an arbitrary element of \( \mathbf{R} \), \( \forall x\in \mathbf{R},\, \lfloor x\rfloor <x+1 \).\end{quote}
}

\begin{quote}
Since \( x \) is an arbitrary element of \( \mathbf{R} \), \( \forall x\in \mathbf{R},\, \lfloor x\rfloor <x+1 \)
\end{quote}
Of course, we need to fill in the {}``meat'' of the {}``\( \vdots  \)''%
\footnote{Let \( x\in \mathbf{R} \)

\begin{quote}
Let \( y=\lfloor x\rfloor  \)
\begin{quote}
Then \( y \) is the largest integer \( \leq x \) (definition of
floor)

So \( y\leq x \) and \( x<x+1 \) (adding 1 to both sides of an inequality)

So \( y<x+1 \)

So \( \lfloor x\rfloor <x+1 \)
\end{quote}
Since \( x \) was an arbitrary element of \( \mathbf{R} \), \( \forall x\in \mathbf{R},\lfloor x\rfloor <x+1 \).\end{quote}
}

In some cases you need to break down a statement such as {}``\( y \)
is the largest integer \( \leq x \)'':\[
y\in \mathbf{Z}\wedge y\leq x\wedge (\forall z\in \mathbf{Z},z\leq x\Rightarrow z\leq y)\]


We didn't need the entire definition for our proof above, and in practice
we don't always have to return to definitions when dealing with functions.
For example we may have an existing result, such as:\[
\forall x\in \mathbf{R},\lfloor x\rfloor >x-1\]



\subsubsection*{Substituting known results}

Every proof would become unmanageably long if we had to include {}``inline''
all the results that it depended on. We inevitably refer to standard
results that are either universally known (among math wonks) or can
easily be looked up. Sometimes we need to prove a small technical
result in order to prove something larger. You may view the smaller
result as a helper method (usually returning boolean results) that
you use to build a larger method (your bigger proof). To make things
modular, you should be able to {}``call'' or refer to the smaller
result. An example occurs if we want to re-cycle

\begin{description}
\item [Theorem~1:]\( \forall x\in \mathbf{R},\, x>0\Rightarrow 1/(x+2)<3 \).
\end{description}
We want to use this in proving \( \forall y\in \mathbf{R},y\neq 0\Rightarrow 1/(y^{2}+2)<3 \).
The template to fill in is%
\footnote{Let \( y\in \mathbf{R} \)

\begin{quote}
Assume \( y\neq 0 \)
\begin{quote}
\( \vdots  \)

Hence \( 1/(y^{2}+2)<3 \).
\end{quote}
\end{quote}
\begin{quote}
Thus \( y\neq 0\Rightarrow 1/(y^{2}+2)<3 \).
\end{quote}
\begin{quote}
Since \( y \) is an arbitrary element of \( \mathbf{R} \), \( \forall y\in \mathbf{R},\, y\neq 0\Rightarrow 1/(y^{2}+2)<3 \).\end{quote}
}

Now we have to fill in the \( \vdots  \)%
\footnote{Let \( y\in \mathbf{R} \).

\begin{quote}
Assume \( y\neq 0 \)
\begin{quote}
Then \( y^{2}\in \mathbf{R} \) and \( y^{2}\geq 0 \) (true for all
elements of \( \mathbf{R} \)).

So \( y^{2}>0 \), since \( y^{2}\neq 0 \) and \( y^{2}\geq 0 \).
(Only real number whose square is 0 is 0)

So, by \textbf{Theorem~1}, \( 1/(y^{2}+2)<3 \).

Hence \( y\neq 0\Rightarrow 1/(y^{2}+2)<3 \)
\end{quote}
Since \( y \) is an arbitrary element of \( R \), \( \forall y\in \mathbf{R},y\neq 0\Rightarrow 1/(y^{2}+2)<3 \)\end{quote}
}


\subsubsection*{Proof by cases}

To prove \( A\Rightarrow B \), it can help to treat some \( A \)s
differently than others. For example, to prove that for all integers
\( x^{2}+x \) is even, you might proceed by noting that \( x^{2}+x \)
is equivalent to \( x(x+1) \). At this point our reasoning has to
branch: at least one of the factors \( x \) or \( x+1 \) is even
(for integer \( x \)), but we can't assume that a particular factor
is even for every integer \( x \). So we use proof by cases%
\footnote{Let \( x\in \mathbf{Z} \)

\begin{quote}
Case 1: \( x \) is even
\begin{quote}
Then \( x(x+1) \) is even
\end{quote}
\end{quote}
\begin{quote}
Case 2: \( x \) is odd
\begin{quote}
Then \( x+1 \) is even

So \( x(x+1) \) is even
\end{quote}
Since \( x \) is either even or odd, \( x(x+1) \) is even in all
cases.
\end{quote}
\begin{quote}
Since \( x \) is an arbitrary element of \( \mathbf{Z} \), \( \forall x\in \mathbf{Z},x(x+1) \)
is even.\end{quote}
}

A simple two-case \( \vee  \) can be expressed in {}``if... else/otherwise...''
style

\begin{quote}
If \( x \) is even, then \( x(x+1) \) is even.

Otherwise, \( x \) is odd, so \( x+1 \) is even, and thus \( x(x+1) \)
is even.
\end{quote}
This is a special case of an {}``OR'' clause being the antecedent
of an implication. If you want to prove \( (A_{1}\vee A_{2}\vee \cdots A_{n})\Rightarrow B \),
(this could happen if, along the way to proving \( A\Rightarrow B \)
you use the fact that \( A\Rightarrow (A_{1}\vee \cdots A_{n}) \).
Now you need to prove \( A_{1}\Rightarrow B \), \( A_{2}\Rightarrow B,\cdots ,A_{n}\Rightarrow B \).
Notice that in setting this up it is not necessary that the \( A_{i} \)
be disjoint (mutually exclusive), just that they cover \( A \) (think
of \( A \) being a subset of the union of the \( A_{i} \)). One
way to generate the cases is to break up the domain \( D \) \( = \)
\( D_{1}\cup \cdots \cup D_{n} \), so \( A_{i}=D_{i}\wedge A \).
Now you have an equivalence, \( A\Leftrightarrow A_{1}\vee \cdots \vee A_{n} \).
A very common case occurs when the domain partitions into two parts,
\( D=D_{1}\cup \neg D_{1} \), so you can rewrite \( A \) as \( (A\wedge D_{1})\vee (A\wedge \neg D_{1}) \).


\subsubsection*{Indirect proof}

Since \( p\Rightarrow q \) is equivalent to its contrapositive, \( \neg q\Rightarrow p \),
proving the latter proves the former. This is called an {}``indirect
proof.'' The outline format of an indirect proof of \( \forall x\in D,p(x)\Rightarrow q(x) \)
is%
\footnote{Let \( x\in \mathbf{D} \)

\begin{quote}
Suppose \( \neg q(x) \)
\begin{quote}
\( \vdots  \)

Then \( \neg p(x) \)
\end{quote}
\end{quote}
\begin{quote}
Then \( p(x)\Rightarrow q(x) \)
\end{quote}
\begin{quote}
Since \( x \) is an arbitrary element of \( D \), \( \forall x\in D,p(x)\Rightarrow q(x) \).\end{quote}
}

As an exercise, consider \( \forall x\in \mathbf{Z}, \) if \( x^{2} \)
is odd, then \( x \) is odd. 

\newpage

\begingroup

\setlength{\parindent}{0pt}

\setlength{\parskip}{2ex}

\renewcommand{\enotesize}{\normalsize}

\theendnotes\endgroup
\end{document}
