[an error occurred while processing this directive]

Induction

How do proofs look, about natural numbers? For example, here are two functions which process natural numbers; how can we prove that they are equivalent (that is, that they return the same result for all inputs, regardless of how they happen to compute that result)?

; Recall:
; Def'n of NatNum:
;  - 0
;  - add1(k), where k is a NatNum.
; 
; 
; How do programs look, which use this def'n?

;; sumA: NatNum -> NatNum
;; Return the sum of the natNums in [0,n].
;;
(define (sumA n)
  (cond [(zero?     n) 0]
        [(positive? n) (+ n (sumA (sub1 n)))]))
; 
; Calling sumA(4) calls sumA(3) calls sumA(2) ... calls sumA(0).

;; sumB: NatNum -> NatNum
;; Return the sum of the natNums in [0,n].
;;
(define (sumB n)
  (* n (add1 n) 1/2))


   ; See test cases in lect15-sum-test.ss


; Clearly sumB is a better solution than sumA --
; but is it correct?  Can we prove it correct?
; (Are there some implicit assumptions?  If so, what?)

Example 1

We want to prove these two functions are equivalent. We start by making a parameterized statement:

Let P(n) be the statement "(sumA n) = (sumB n)."

Here's the battle plan of proofs by induction:

Thus we'll conclude by induction ∀ n ∈ N, P(n). Here goes:

Proof of &forall n.P(n), by induction:

Thus, by induction, P(n) holds for all n ∈ N.

Really, this is a new inference rule (particular to N):

If you know…                       Then you can conclude…
  P(0)                            }
  forall k. (P(k) → P(k+1))     }  forall n.P(n)
Read Rosen for more number examples.

By the way, a note on ∑k=1n (k) = n(n+1)/2:

      *****
      ****
      ***
      **
      *
This is the picture of ∑k=15 (k).
Visually: If I take twice this sum (another stairway-triangle), turn it around and fit the stairways together, I have a n × (n+1) rectangle.
This is the visual analog of writing
 S =   1   +    2  + … +  n-1  + n,
 S =   n   +  n-1  + … +    2  + 1
------------------------------------------ add both equations
2S = (n+1) + (n+1) + … + (n+1) + (n+1)   (n copies)
Note: For arithmetic progression: Sum is (first-term + last-term) ⋅ number-of-terms / 2. My mantra: ``first plus last times n over two.''

Example 2

board tiling, from Rosen.
P(n) = "A checkerboard 2n x 2n with one corner removed, can be exactly tiled by L-shaped tri-ominoes."

Thus, ∀ n ∈ N, n≥1, P(n).
Actually, this holds for n=0 as well; in fact the proof is unchanged! Though it probably takes more consideration of that special case, than just handling n=0 as a lemma.

Example 3

A homework exercise:
• Show: &sumk=1n 2k = 2k+1-1.
• Show: &sumk=1n bk = (bk+1-1)/(b-1).
E.g., when b=10, we have 1+10+100+1000 = 1111 = 9999/9.

…[do the proof in lecture]…

Reflection on this sum:

Note that induction doesn't provide us with any hint as to what our sums should look like, but if we have some guess then it gives us a method to prove that guess correct. The book has the formulas for (say) the sum-of-squares and sum-of-cubes. What about ∑k=1nk17, if we really needed a nice expression for this? We could guess that the answer is an 18th-degree polynomial, set up a generic polynomial with coefficients a18,…a0, and then (by plugging in 19 different values for n) come up with 19 linear equations in the 19 unknowns a18,…a0. We then solve for these coefficients. Finally, to wrap it off entirely, we could use induction to prove the formula correct (since it was intuition that an 18th-degree polynomial really would provide a solution).

(Got to here 2005.Mar.02, after covering sums and other review.)

Example 4, an inequality: Harmonic series (in Rosen p.243, Example #6):
H2k ≥ 1+(k/2).
Note that this can be re-stated as, Hn ≥ 1+lg(n)/2, though suddenly we'd want to show this for all n (not just powers-of-2).

More complicated example

If all cities connected in one direction or the other, then there is some city which is connected to all others in either one or two steps.

After some work, I found I was using the same phrases over and over, like "a city connected to all cities within one or two steps". Some select definitions make the problem not only more concise, but also more understandable:

Given a semi-connected graph G, choose an arbitrary vertex v.
Note that G-{v} is semi-connected. [Aside: Def'n of G-{v} ?]
Let h0 be "old" hub of G-{v}.

False proofs-by-induction

What's wrong with this inductive proof: P(n) is "n > 1000".
(After all, it's easy to show P(k) → P(k+1).)
Okay, we'll patch that problem; what's wrong with the induction proof of: P(n) is "n>1000 or n=0".

False proof: All horses are the same color.

Proof by induction for n>1. let P(n) be "for a set of n horses, they all have the same color".

The question is, what is wrong with the proof? (We know the conclusion is wrong; we are asking, why is this proof not really following the rule of induction. If it were, then we'd have an example that induction isn't actually a valid rule of inference!)


Q&A

[an error occurred while processing this directive] [an error occurred while processing this directive]