\documentclass[11pt]{article}
\usepackage{macros-course-lectures}

\newtheorem{falsethm}[theorem]{False Theorem}
\renewcommand{\thepage}{\arabic{page}}

%\makeslides

\begin{document}

\onlystudents

\lecture{notes2}{What is a Proof? (cont'd) \& Proof by Induction}{3 Feb 00}

%% continuing the lecture notes from lecture 1

\setcounter{section}{6}

\section{Predicates}

\onlylecture{discuss the problem set (long easy) and reading (long)

Last time we discussed overall structure for proving theorems
\begin{itemize}
\item propositions
\item definitions
\item axioms
\item deduction rules
\end{itemize}
and looked at some toy proofs to demonstrate

Today, we will look at proofs of some less obvious stuff and see how
to combine all the proof techniques discussed last time.

}

\subsection{What are predicates?}

Predicates are similar to propositions but they depend on variables. \\
$P(x,y,z)$ denotes a predicate on variables $x,y,z$. \\
For example, define: 
\begin{itemize}
\item $R(x)$: $x$ is an odd number.
\item $Q(x)$: $x > 2$.
\item $P(x)$: $x$ is a prime number.
\end{itemize}
These predicates are {\em not} propositions, because they can be true
or false depending on $x$. \\
When value of $x$ not specified, we say $x$ is \emph{unbound}.\\
Predicates are like functions from variables to propositions. 
\begin{itemize} 
\item $P(2)$ is true.
\item $R(2)$ is false.
\item $P(4) \vee R(3)$ is true.
\item $Q(3) \wedge R(4)$ is false.
\item $Q(1) \implies R(2)$ is true.
\end{itemize}

\subsection{Quantifiers}

Many propositions assert that something is true for all or some elements
of a given domain (e.g., all numbers).  The following quantifiers presume
a particular {\bf universe of discourse} has been agreed upon in
advance.  This is the set of elements values to which we can assign
the quantified variables.

\begin{itemize}
\item ``$\forall$'' means ``for all.'' $\forall x P(x)$ is a statement
that is true iff $P(x)$ is true for {\em every} $x$ in the universe of
discourse. 
\item ``$\exists$'' means ``there exists.'' $\exists x P(x)$ is true
iff $P(x)$ is true for {\em at least one} $x$ in the universe of
discourse.
\item ``$\not\exists''$ mean ``there does not exist'' (``there is no'').
\item ``$\exists !$'' means ``there exists {\em exactly} one.''
\item ``$\forall x \in S$'' means ``for every $x$ in the set $S$.''
$(\forall x \in S) P(x)$ is equivalent to $(\forall x) (x \in S
\implies P(x)).$
\end{itemize}


Quantifiers can turn predicates into propositions, e.g.
\[
\forall x, P(x) \wedge Q(x) \implies R(x).
\]
Note that each appearance of $x$ is associated with the $\forall$
quantifier.  A variable associated with a quantifier in this way
is said to be {\em bound}.  Since every variable in the above expression
is bound, it is a proposition.  If $P$, $Q$, and $R$ are the predicates
defined above, this proposition is true.

{\bf Note:} $\forall x \exists y$ is {\em different} from $\exists y \forall
x$:
\begin{itemize}
\item $S(x,y):$ student $x$ will fall asleep in class $y$.
\item $\forall y \exists x P(x,y):$ ``In every class, some student will fall asleep.''
\item $\exists x \forall y P(x,y):$ ``There exists a student who will
fall asleep in every class.''
\end{itemize}

What is the universe of discourse above?

\subsection{Deduction rules involving quantifiers}

%[[[David:  There are others, I'm sure---need more here?  Victor
%suggested we need things like ~forall x  P(x)   means exists x
%notP(x)'']]]


Negation:
\begin{itemize}
\item $(\forall x) S(x)$ is equivalent to $\neg (\exists x) \neg S(x)$:
    \begin{itemize}
    \item $(\forall x) S(x):$ For all primes $x > 2$, $x$ is odd.
    \item $\neg(\exists x) \neg S(x):$ There is no prime $x > 2$ such
that $x$ is not odd.
    \end{itemize}
\item $(\exists x) S(x)$ is equivalent to $\neg (\forall x) \neg
S(x)$.
\end{itemize}


Four main rules for manipulating quantifiers: \\
Velleman 2.2, Rosen, p. 173 \\
\begin{description}
\item[Universal Generalization UG:]  prove for every $x$ by showing proof
works for arbitrary fixed $x$ 

\item[Universal Instantiation UI:]  if true for all, true for any one 

\item[Existential Generalization EG: ] if have one, shows one exists 

\item[Existential Instantiation EI:]  if one exists, can pick one 
\end{description}
We'll introduce these as we use them. \\


Like axioms, these inference rules are really an {\em agreement} to
believe certain inferences.  For example, the constructivists (e.g.
Brouwer) {\em reject} the claim that $\neg\forall x \neg P(x)$ implies
$\exists x P(x)$.  They claim that to prove something exists, you
actually have to construct it.  Brouwer retracted his most famous
theorem after he became a constructivist, since the proof was
nonconstructive.


\section{Predicate reasoning examples}

Reading: \\
Velleman Chapter 3 \\
Rosen, Section 3.1 \\
\\
We have already been using quantifiers in sloppy ways, or hiding
them.\\
Now we can give some examples that use them explicitly and correctly.


This section gives some examples.

\subsection{Britney's birthdate}

Illustrates: Quantifier reasoning (UG, EI, EG).  Cases.

\begin{structproof}
Prove: $\forall n \in N (n^2 + n \mbox{ is even})$. \\
1. Fix $n \in N$. \\
2. $n^2 + n$ is even. 
\> \> \> \> \> ??? \\
3. QED  
\> \> \> \> \> Universal Generalization (UG) 
\end{structproof}
UG is the official fancy name for the rule that says, 
to show something is true for all elements of a set ($\forall$), 
you pick (``fix'') any arbitrary generic element and show it for
that. \\
Basic idea: you generate one proof for each possible $x$\\
The name is hard to remember, don't worry too much about it. \\
\\
Pattern: 

\begin{structproof}
Prove: $\forall x \in X (P(x))$. \\
1. Fix $x \in X$. \\
2. $P(x)$ \\
3. QED  
\> \> \> \> \> Universal Generalization (UG) 
\end{structproof}

Back to the proof: \\
To show step 2, can use cases: 

\begin{proofoverhead}
Prove: $\forall n \in N (n^2 + n \mbox{ is even})$. \\
1. Fix $n \in N$. \\
2. $n^2 + n$ is even. \\
\> 1. If $n$ is odd then $n^2 + n$ is even.    
   \> \> \> \> ??? \\
\> 2. If $n$ is even then $n^2 + n$ is even.   
   \> \> \> \> ??? \\
\> 3. QED                                      
   \> \> \> \> Cases \\
3. QED 
\end{proofoverhead}
Now fill in steps for the odd case: 

\begin{proofoverhead}
\> 1. If $n$ is odd then $n^2 + n$ is even.   \\
\> \> 1. Assume $n$ is odd. \\
\> \> 2. $n^2 + n$ is even. \\
\> \> \> 1. $\exists x \in N (n = 2x + 1)$ 
         \> \> Def.\ of ``odd'' \\
\> \> \> 2. Choose $x \in N$, $n = 2x + 1$ 
         \> \> Existential Instantiation (EI) \\
\> \> \> \> \> (If there {\em exists\/} one, you can {\em choose\/} one.) \\
\> \> \> 3. $n^2 + n = 4x^2 + 4x + 1 + 2x + 1 = 2(2x^2 + 3x + 1)$ \\
\> \> \> \> \> Algebra \\
\> \> \> 4. $\exists y \in N (n^2 + n = 2y)$ 
         \> \> Existential Generalization (EG) \\
\> \> \> \> \> (If you {\em have\/} one, then one {\em exists}.) \\
\> \> \> 5. QED                 
         \> \> Def.\ of ``even'' \\
\> \> 3. QED                    
      \> \> \> Implication 
\end{proofoverhead}
Analogously for the ``even'' case: 

\begin{proofoverhead}
\> 2. If $n$ is even then $n^2 + n$ is even.   \\
\> \> 1. Assume $n$ is even. \\
\> \> 2. $n^2 + n$ is even. \\
\> \> \> 1. $\exists x \in N (n = 2x)$ 
         \> \> Def.\ of ``even'' \\
\> \> \> 2. Choose $x \in N$, $n = 2x$ 
         \> \> EI \\
\> \> \> 3. $n^2 + n = 4x^2 + 2x = 2(2x^2 + x)$ 
         \> \> Algebra \\
\> \> \> 4. $\exists y \in N (n^2 + n = 2y)$ 
         \> \> EG \\
\> \> \> 5. QED                 
         \> \> Def.\ of ``even''. \\
\> \> 3. QED                    
      \> \> \> Implication 
\end{proofoverhead}
Or, condensing a little: 

\begin{proofoverhead}
\> 2. If $n$ is even then $n^2 + n$ is even.   \\
\> \> 1. Assume $n$ is even. \\
\> \> 2. Choose $x \in N$, $n = 2x$
      \> \> \> Def.\ of ``even'', EI \\
\> \> 3. $n^2 + n = 4x^2 + 2x = 2(2x^2 + x)$ 
      \> \> \> Algebra \\
\> \> 4. $n^2 + n$ is even. 
      \> \> \> EG, def.\ of ``even'' \\
\> \> 5. QED        
      \> \> \> Implication 
\end{proofoverhead}

\subsection{Proofs by contradiction}

Illustrates: Contradiction, more quantifiers. \\

\begin{structproof}
Prove: $\sqrt{2}$ is irrational.\\
1. $\sqrt{2}$ rational $\Rightarrow \ms{false}$ \\
2. QED 
\> \> \> \> \> Contradiction. 
\end{structproof}
Assume it's rational, play with the definitions, and try to get a
contradiction. 

\begin{proofoverhead}
Prove: $\sqrt{2}$ is irrational. \\
1. $\sqrt{2}$ rational $\Rightarrow \ms{false}$ \\
\> 1. Assume $\sqrt{2}$ rational. \\
\> 2. $\ms{false}$ \\
\> \> 1. Choose $a, b \in N^{+}$, $\sqrt{2} = {a \over b}$, lowest terms.\\
   \>\>   \> \> \> Basic properties of rationals, EI \\
\> \> 2. $2 b^2 = a^2$       
      \> \> \> Algebra \\
\> \> 3. $a^2$ is even.
      \> \> \> EG, definition of ``even'' \\
\> \> 4. $a$ is even.      
      \> \> \> ??? \\
\> \> 5. Choose $c \in N$, $a = 2c$. 
      \> \> \> Definition of ``even'', EI \\
\> \> 6. $4 c^2 = a^2 = 2b^2$ 
      \> \> \> Algebra \\
\> \> 7. $2 c^2 = b^2$       
      \> \> \> Algebra \\
\> \> 8. $b^2$ is even.
      \> \> \> EG, definition of ``even'' \\
\> \> 9. $b$ is even.
      \> \> \> ??? \\
\> \> 10. $a$ and $b$ aren't in lowest terms. 
      \> \> \> 1.2.4, 1.2.9 \\
\> \> 11. QED
      \> \> \> 1.2.1, 1.2.10, propositional logic \\
\> 3.  QED                 
   \> \> \> \> Implication. \\
2. QED  
\> \> \> \> \> Contradiction. \\
\end{proofoverhead}

\noindent
Little missing piece: Showing that $a$ and $b$ are even, because we know
their squares are even. \\
Reason is a general fact, which could itself be proved.\\
Write $P(x)$ for ``$x^2$ is even'' and $Q(x)$ for ``$x$ is even.''   

\begin{overhead}
\begin{tabbing}
XXX\=XXX\=XXX\=XXX\=XXXXXXXXXXXXXXXXXXXXX\=    \kill
Prove: $(\forall x) P(x) \implies Q(x)$\\
1. $(\forall x) \neg Q(x) \implies \neg P(x)$ \\
\>  1. Choose $x$ \>\>\>\> UI\\
\>  2. Assume $\neg Q(x)$\\
\>  3. $\neg P(x)$\\
\> \> 1. $\neg Q(x)$ means $x$ odd \>\>\> Def $Q(x)$\\
\> \> 2. so $x^2$ odd \>\>\> Britney\\
\> \> 3. which means $\neg P(x)$ \>\>\>definition of $P$ \\
\> \> 4. QED \> \> \> UG\\
\>  4. QED \>\>\>\> Direct proof\\
2. QED \>\>\>\>\> logical tautology\\
\end{tabbing}
\end{overhead}

Alternatively, we could write a proof by contradiction.

\begin{tabbing}
XXX\=XXX\=XXX\=XXX\=XXXXXXXXXXXXXXXXXXXXX\=    \kill
Assume: $x \in N$, $x^2$ is even. \\
Prove: $x$ is even. \\
1. $x \mbox{ is odd} \Rightarrow \ms{false}$ \\
\> 1. Assume $x$ is odd. \\
\> 2. $x^2$ is odd. 
   \> \> \> \> Do a proof like the one in the birthdate example. \\
\> 3. $\ms{false}$           
   \> \> \> \> Assumption, 1.2.4, Prop. logic \\
2. QED
\> \> \> \> \> Contradiction
\end{tabbing}

\subsection{De Morgan's Law}

Illustrates:  Set theory proof. 

\begin{tabbing}
XXX\=XXX\=XXX\=XXX\=XXXXXXXXXXXXXXXXXXXXX\=    \kill
Prove: $\forall A, B (\bar{A} \cap \bar{B} = \overline{A \cup B})$ \\
1. Fix $A$, $B$. \\
2. $\bar{A} \cap \bar{B} = \overline{A \cup B}$   
\> \> \> \> \> ??? \\
3. QED
\> \> \> \> \> UG 
\end{tabbing}

\noindent
To show two sets are equal, we show that they contain the same elements. \\

\begin{tabbing}
XXX\=XXX\=XXX\=XXX\=XXXXXXXXXXXXXXXXXXXXX\=    \kill
Prove: $\forall A, B (\bar{A} \cap \bar{B} = \overline{A \cup B})$. \\
1. Fix $A$, $B$. \\
2. $\bar{A} \cap \bar{B} = \bar{A \cup B}$ \\
\> 1. $\forall x (x\in \bar{A} \cap \bar{B}  \Leftrightarrow x\in\overline{A \cup B})$ \\
\> \> 1. Fix $x$. \\
\> \> 2. $x \in \bar{A} \cap \bar{B}  \Leftrightarrow x \in \overline{A \cup B}$ 
      \> \> \> ??? \\
\> \> 3. QED    
      \> \> \> UG \\
\> 2. QED           
   \> \> \> \>  Definition of set equality. \\
3. QED 
\> \> \> \> \> UG 
\end{tabbing}

\noindent
Equivalence can be shown by showing two implications, one in each
direction: 

\begin{tabbing}
XXX\=XXX\=XXX\=XXX\=XXXXXXXXXXXXXXXXXXXXX\=    \kill
\> \> 2. $x \in \bar{A} \cap \bar{B}  \Leftrightarrow x \in \overline{A \cup B}$ \\
\> \> \> 1. $x \in \bar{A} \cap \bar{B}  \Rightarrow x \in \overline{A\cup B}$ 
         \> \> ??? \\
\> \> \> 2. $x \in \bar{A \cup  B} \Rightarrow x \in \bar{A} \cap\bar{B}$ 
         \> \> ??? \\
\> \> \> 3. QED   
         \> \> Propositional logic 
\end{tabbing}
One direction:

\begin{tabbing}
XXX\=XXX\=XXX\=XXX\=XXXXXXXXXXXXXXXXXXXXX\=    \kill
\> \> \> 1. $x \in \bar{A} \cap \bar{B}  \Rightarrow x \in \bar{A \cup  B}$ \\
\> \> \> \> 1. Assume $x \in \bar{A} \cap \bar{B}$. \\
\> \> \> \> 2. $x \in \bar{A}$, $x \in \bar{B}$ 
            \> Definition of intersection. \\
\> \> \> \> 3. $x \notin A$, $x \notin B$ 
            \> Definition of complement. \\
\> \> \> \> 4. $x \notin A \cup B$ 
            \> Definition of union. \\
\> \> \> \> 5. $x \in \bar{A \cup  B}$  
            \> Definition of complement. \\
\> \> \> \> 6. QED 
            \> Implication 
\end{tabbing}
Actually, the union step could be expanded to a little proof by
contradiction:  \\
if it is in the union, it's in one of the sets, etc. \\
The other direction essentially reverses the steps: 
\begin{tabbing}
XXX\=XXX\=XXX\=XXX\=XXXXXXXXXXXXXXXXXXXXX\=    \kill
\> \> \> 2. $x \in \bar{A \cup  B} \Rightarrow x \in \bar{A} \cap\bar{B}$ \\
\> \> \> \> 1. Assume $x \in \bar{A \cup B}$. \\
\> \> \> \> 2. $x \notin A \cup B$
            \> Complement \\
\> \> \> \> 3. $x \notin A$, $x \notin B$
            \> Union \\
\> \> \> \> 4. $x \in \bar{A}$, $x \in \bar{B}$
            \> Complement \\
\> \> \> \> 5. $x \in \bar{A} \cap \bar{B}$
            \> Intersection \\
\> \> \> \> 6. QED 
            \> Implication 
\end{tabbing}


\subsection{Counterexamples}

Easiest way to avoid proving a theorem.

Prove: All natural numbers $\geq 2$ are prime. \\
\\
This turns out to be false. \\
We can show this using a ``counterexample'', $10$. \\
That's all that's needed. \\
Really, we're proving the negation, which says $\exists$ a non-prime
$\geq 2$. \\
And this follows just by exhibiting one.
%(Existential Generalization).

\section{Good proofs}

\section{What we Expect in your Proofs}

In practice, people do not write out real proofs about interesting
mathematical objects in a completely formal, step-by-step style.
(Unless they are using a computer-aided theorem prover, which really
does work step-by-step).  Rather, they work more intuitively, skipping
a lot of steps.  Proof sketch.

But it is very important to work {\em correctly}, so that all the
missing steps could really be filled in.  It can be very hard to tell
(impossible without some training) if a proof sketch is really valid.
This course is designed to provide this training.

Basic objective: As in a scientific experiment, it has to be possible
for someone else to ``replicate'' (ie, understand) your proof.

{\bf In your homework, that ``someone'' should be another 6.042 student.}

In the real world, anything that can be cited can be used without
proof.  But in homework, where everything we ask you to prove is
already known, this defeats the purpose (namely, learning how to prove
something that isn't already known).

We don't expect you to reprove arithmetic.  Anything from high school
math can be used without proof (unless stated otherwise).

Once something has been proved, you can use it again without proof,
citing the theorem.  Once it has been used so often as to become
commonplace, you can even stop citing the theorem.

{\bf Do not introduce any new axioms!}

{\bf When in doubt about whether something can be stated without proof,
prove it!}

Elements of a good proof:
\begin{itemize}
\item Correctness: first of all, a proof must be correct. Do not introduce more
assumptions than the ones already stated in the hypothesis.  Do not use 
unproved 'facts' and beware of fallacies, like the ones discussed in the 
previous lecture: 
\item Clarity: a good proof has nice structure, like a good program.
It is broken up into separate ``lemmas'' that prove key intermediate
properties.
\begin{itemize}
\item ``Top down design'' makes it easy to understand the {\em reasons} why the whole thing
works.
\item It also makes it more likely that pieces can be reused.
\end{itemize}
\item Brevity:  a proof should be free of wordy arguments and repetitions.
\item Generality: a good proof has its pieces presented abstractly and
  generally.  If you give an intermediate fact, state it as generally
  as you can.  This avoids cluttering up a key piece of a proof with
  unnecessary hypotheses and arguments.  It also makes it more likely
  you can reuse the piece.

\end{itemize}


This is exactly analogous to what you do in designing programs -- make
them general and abstract, use subroutines, etc.
 \\
\\
A difference: \\
In math, proofs are sometimes valued for being deep, hard. \\
Not much of a consideration in programming:  here, the premium is more
on how well it works and how easy it is to understand. 

\section{False Proofs}

In your life you will find many false proofs; it is good to know how
to find the problem.

If a proof is written carefully, the problem is usually obvious.  So
false proofs get tricky when they are also sloppy.

What can go wrong?
\begin{itemize}
\item Derivation of a new statement by an invalid deduction rule, such
  as $A  \implies B$, and $A$, therefore $C$!  This actually appeared
  in a famous PhD thesis on linear logic.  The Stanford student 
 was able to publish a PhD thesis based on his discovery of the error
 (and conclusion that in fact $C$ was FALSE.
\item Unstated axiom.  Gauss ``clearly if a curve enters a region, it
  has to leave.''  This was accepted as a proof for a long time; only
  a century later was it cleared up.
\item Misuse of a definition.  Using something ``obvious'' in the
  {\em intent} of the definition that doesn't actually arise from the
  formal definition.
\end{itemize}

Most common problem: gap between intuition and formalism.  

\subsection{Example}


\begin{eqnarray*}
1 & = & \sqrt{1} \\
& = & \sqrt{(-1)(-1)} \\
& = & \sqrt{-1} \sqrt{-1} \\
& = & \sqrt{-1}^2 \\
& = & -1.\\
\mbox{So, }1 & = & -1!
\end{eqnarray*}

What is wrong?  
\onlylecture{Assumption that $\sqrt{uv}=\sqrt{u}\sqrt{v}$ arises from
  our ``common usage'' of $\sqrt{\cdot}$ to be the {\em positive} square
  root.  But this isn't defined for the sqrt of a negative number
  (which is complex, so not positive or negative).}

\subsection{Some Actual Proofs...}

If you make mistakes, you won't be alone!

Rigorous logical proof systems are nice, but no one really
has the time or energy to be so careful.  We prove things in a less
formal way.   The objective is to convince everyone that a truly
rigorous proof could be built if someone took the time to do it.  
As a result, even great mathematicians can goof proofs.
\begin{itemize}
\item Andrew Wiles recently announced a proof of Fermat's Last
  Theorem.  It was several hundred pages long.  It took mathematicians
  months of hard work to discover it had a fatal flaw (so Wiles
  produced another proof of several hundred pages; this one seems to
  have convinced people for now).
\item Kempe's invalid ``proof'' of the Four Color Theorem stood for 10
years (1879--1890)
\item Gauss's 1799 Ph.D. thesis is usually referred to as being the
first rigorous proof of the Fundamental Theorem of Algebra (every
polynomial has a zero over the complex numbers).  But it contains
quotes like
\begin{quote}
  "If a branch of an algebraic curve enters a bounded region, it
   must necessarily leave it again. ... Nobody, to my knowledge,
   has ever doubted [this fact].  But if anybody desires it, then
   on another occasion I intend to give a demonstration which will
   leave no doubt."
\end{quote}
Fields Medalist Steve Smale writes about this, calling it an "immense
gap" in the proof that was not filled in until 1920, more than a hundred
years later.
\item In 1900 Poincare carelessly claimed a certain very simple topological 
characterization of the 3-dimensional sphere.  Later realizing it was 
not so obvious, he demoted the claim to the status of a "conjecture" 
in 1904.  The Poincare Conjecture is now one of the biggest open questions
in mathematics (two Fields Medals have been given out for partial progress
on it).
\item In the 1940's Paul Erdos conjectured a certain combinatorial fact about 
arithmetic progressions (every set of natural numbers of positive density 
contains arbitrarily long arithmetic progressions), and offered \$1000 for a
proof or disproof.  Endre Szemeredi proved the conjecture in 1972, but
the proof was so long and badly written that Erdos was not sure whether
to believe it.  Finally, Andras Hajnal stepped in and wrote a much clearer
version of the same proof, which was eventually published under Szemeredi's
name.  At some point during the write-up, Hajnal informed Erdos that
he was now confident enough of the proof that he was willing to buy it 
from Szemeredi for \$500.
\item  There's also the story of Newton waiting 20 years to publish
the Principia because he didn't see how to prove that one could assume all
the mass of a sphere to be concentrated at its center when calculating
gravitational attraction.  The proof ultimately required the invention 
of calculus ...

\end{itemize}

%%% Nancy's notes on lecture 2 start here...

\newpage

\section{Structured proofs and paragraph proofs}

Recall the structured proof presented yesterday to show that
$\sqrt{2}$ is irrational. \\
(slides)\\
\\
Compare with paragraph proof from notes (slide):

\begin{proof}
The proof is by contradiction.  Assume for purpose of contradiction
that $\sqrt{2}$ is rational.  Then we can write $\sqrt{2} = a/b$ where
$a$ and $b$ are integers and the fraction is in lowest terms.
Squaring both sides gives $2 = a^2 / b^2$ and so $2 b^2 = a^2$.  This
implies that $a$ is even; that is, $a$ is a multiple of $2$.  As a
result, $a^2$ is a multiple of 4.  Because of the equality $2 b^2 =
a^2$, $2 b^2$ must also be a multiple of 4.  This implies that $b^2$
is even and so $b$ must be even.  But since $a$ and $b$ are both even,
the fraction $a/b$ is not in lowest terms.  This is a contradiction,
and so the assumption that $\sqrt{2}$ is rational must be false.
\end{proof}

\noindent
It contains exactly the same information.  \\
Just written in a paragraph.

\section{Inductive proofs}

\noindent
By far the most important proof method in computer science. \\
\\
Suppose you want to prove something, $P(n)$, is true for all $n \in N$.\\
$0, 1, 2, \ldots$.\\
\\
Can prove it individually for $0,1,\ldots$.\\
But that has to stop sometime.\\
\\
The proof method of mathematical induction says that you just need
to prove it for $0$, then prove ``if it's true for $n$ then it's true
for $n+1$''. \\
\\
Why does this prove it for all $n \in N$? \\
Seems ``obvious''. \\
Like dominoes.\\
Really, it's part of how $N$ is defined.  \\
It's usually taken as an assumption (axiom) about $N$: \\
\\
Induction axiom: \\
$[P(0) \wedge \forall n \geq 0 (P(n) \Rightarrow P(n+1))] \Rightarrow
\forall n (P(n))$. \\
\\
Alternatively, see as a deduction rule. \\
The pattern is:

\begin{tabbing}
XXX\=XXX\=XXX\=XXX\=XXXXXXXXXXXXXXXXXXXXX\=    \kill
To prove: $\forall n \geq 0 (P(n))$ \\
It's enough to show:\\
1. (Base) $P(0)$ \\
2. (Inductive step) $\forall n \geq 0 (P(n) \Rightarrow P(n+1))$
\end{tabbing}

\noindent
Variant: 

\begin{tabbing}
XXX\=XXX\=XXX\=XXX\=XXXXXXXXXXXXXXXXXXXXX\=    \kill
To prove: $\forall n \geq k (P(n))$\\
It's enough to show:\\
1. (Base) $P(k)$ \\
2. (Inductive step) $\forall n \geq k (P(n) \Rightarrow P(n+1))$
\end{tabbing}

\section{An Example---Sum of Series}

The canonical first example for induction: 

\begin{tabbing}
XXX\=XXX\=XXX\=XXX\=XXXXXXXXXXXXXXXXXXXXX\=    \kill
Prove: $\forall n \geq 0 (1 + 2 + 3 + \ldots + n = \frac{n(n+1)}{2})$ 
\end{tabbing}

\noindent
Alternatively (better), can write the LHS in closed form:
\[ \sum_{i=1}^n i \mbox{ or } \sum_{1 \leq i \leq n} i
\]
Thus, we want to prove: \\
$\forall n \geq 0 (\sum_{i=1}^n i = \frac{n(n+1)}{2})$
\\
Let's stop and be sure we know what this summation means. \\
Check boundary cases (always a good idea to see if you understand a
definition).

\begin{itemize}
\item 
If $n = 1$, the sum $1 + 2 + 3 + \ldots + n = 1$.  
The sum has one term only.
\item 
If $n = 0$, then $1 + 2 + 3 + \ldots + n = 0$. 
No terms.
\end{itemize}

\noindent
Now, the induction pattern says:
\begin{tabbing}
XXX\=XXX\=XXX\=XXX\=XXXXXXXXXXXXXXXXXXXXX\=    \kill
Prove: $\forall n \geq 0 (P(n))$ \\
1. (Base) $P(0)$ \\
2. (Inductive step) $\forall n \geq 0 (P(n) \Rightarrow P(n+1))$ \\
3. QED                        
\> \> \> \> \> Induction 
\end{tabbing}

\noindent
Here, we define $P(n)$ to be the predicate $\sum_{i=1}^n i =
\frac{n(n+1)}{2}$. \\
In other words: 

\begin{tabbing}
XXX\=XXX\=XXX\=XXX\=XXXXXXXXXXXXXXXXXXXXX\=    \kill
Prove: $\forall n \geq 0 (\sum_{i=1}^n i = \frac{n(n+1)}{2})$.\\
1. (Base) $\sum_{i=1}^0 i = \frac{0(0+1)}{2}$. \\
2. (Inductive step) 
   $\forall n \geq 0 (\sum_{i=1}^n i = \frac{n(n+1)}{2} \Rightarrow
                      \sum_{i=1}^{n+1} i = \frac{(n+1)(n+2)}{2})$ \\
3. QED                              
\> \> \> \> \> Induction 
\end{tabbing}
The two steps of the proof are called the {\em base\/} and the {\em
induction step\/}. \\
Usually, the base step is pretty easy to check, but the inductive step
can involve some work and creativity. 

\noindent
Whether you give a structured or paragraph style proof, the proof must
contain, clearly, all of the following:
\begin{enumerate}
\item 
A statement that the proof is by induction.
\item 
The definition of the predicate $P(n)$.
\item 
The proof of the base step, $P(0)$ (or $P(k)$, if we're starting from
some other value $k$).
\item 
The proof of the inductive step,
$\forall n \geq 0 (P(n) \Rightarrow P(n+1)$
\end{enumerate}

\noindent
To finish this example: \\
Base:  Easy by definition and arithmetic.
\begin{tabbing}
XXX\=XXX\=XXX\=XXX\=XXXXXXXXXXXXXXXXXXXXX\=    \kill
1. (Base) $\sum_{i=1}^0 i = \frac{0(0+1)}{2}$ ($P(0)$) \\
\> 1. $\sum_{i=1}^0 i = 0$
   \> \> \> \> Definition of summation with no terms \\
\> 2. $\frac{0(0+1)}{2} = 0$
   \> \> \> \> Arithmetic \\
\> 3. QED
   \> \> \> \> By 1.1 and 1.2.
\end{tabbing}
\noindent
Inductive step uses basic logic (UG and implication). \\
What's left is the job of showing that, assuming $P(n)$, we can prove
$P(n+1)$. 

\begin{tabbing}
XXX\=XXX\=XXX\=XXX\=XXXXXXXXXXXXXXXXXXXXX\=    \kill
2. (Inductive step) 
   $\forall n \geq 0 (\sum_{i=1}^n i = \frac{n(n+1)}{2} \Rightarrow
                      \sum_{i=1}^{n+1} i = \frac{(n+1)(n+2)}{2})$ \\
\> 1. Fix $n \geq 0$. \\
\> 2. $\sum_{i=1}^n i = \frac{n(n+1)}{2} \Rightarrow 
       \sum_{i=1}^{n+1}i = \frac{(n+1)(n+2)}{2}$ \\
\> \> 1. Assume $\sum_{i=1}^n i = \frac{n(n+1)}{2}$ \\
\> \> 2. $\sum_{i=1}^{n+1}i= \frac{(n+1)(n+2)}{2}$ 
      \> \> \> ??? \\
\> \> 3. QED   
      \> \> \> Implication \\
\> 3. QED
   \> \> \> \> UG 
\end{tabbing}

\noindent
The important job is step 2, showing $P(n+1)$. \\
To do this, we just write out the equation we want to show (for
$n+1$), and play around with both sides to try to make them equal. \\
Remember that we are allowed to use the assumption $P(n)$, which is
the corresponding equation for $n$. \\
So while we are manipulating the equation for $n+1$, we look for a
place to plug in the information for $n$. \\

\begin{tabbing}
XXX\=XXX\=XXX\=XXX\=XXXXXXXXXXXXXXXXXXXXX\=    \kill
\> \> 2. $\sum_{i=1}^{n+1}i = \frac{(n+1)(n+2)}{2}$ \\
\> \> \> 1. $\sum_{i=1}^{n+1}i = (\sum_{i=1}^{n}i)  + (n+1)$ 
         \> \> Summation has one extra term. \\
\> \> \> 2. $(\sum_{i=1}^{n}i) + (n+1) = \frac{n(n+1)}{2}+ n+1$
         \> \> Inductive hypothesis $P(n)$ (2.2.1) \\
\> \> \> 3. $\frac{n(n+1)}{2} + n+1 = \frac{(n+1)(n+2)}{2}$
         \> \> Algebra \\
\> \> \> 4. QED 
         \> \> Combining the previous 3 equations.
\end{tabbing}

\noindent
This worked out nicely because the LHS of the $n+1$ equation was
easily expressible in terms of the $n$ equation. \\
Sometimes we'll have to work harder. \\
\\
Also, here the choice of $P(n)$ came directly out of the theorem
statement. \\
Sometimes it isn't so obvious.  \\
\\
See these complications in more examples today. \\
\\
In this example, note that the inductive technique did not help us to
come up with the correct expression $\frac{n(n+1)}{2}$ for the
summation, but only to prove that it is correct. \\
We'll see how to come up with such sums when we get to the analysis
methods section of the course. 

\end{document}
