*This preview shows
pages
1–9. Sign up
to
view the full content.*

This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*
**Unformatted text preview: **Harvard CS121 and CSCI E-207 Lecture 3: Doing Proofs Harry Lewis September 10, 2009 Reading: Sipser, Chapter 0 Harvard CS 121 & CSCI E-207 September 10, 2009 Formal Inductive Definitions Like recursive data structures and recursive procedures when programming. Strings and their length : is a string of length 0. If x is a string of length n and , then x is a string of length n + 1 . (i.e. start with and add one symbol at a time, like aaba , but we dont write the initial unless the string is empty) 1 Harvard CS 121 & CSCI E-207 September 10, 2009 Inductive definitions of string operations The concatenation of x and y , defined by induction on | y | . [ | y | = 0 ] x = x [ | y | = n + 1 ] write y = z for some | z | = n , define x ( z ) = ( x z ) The reversal of x , defined by induction on | x | : [ | x | = 0 ] R = [ | x | = n + 1 ] ( y ) R = y R , for any | y | = n , 2 Harvard CS 121 & CSCI E-207 September 10, 2009 Inductive definitions of string operations The concatenation of x and y , defined by induction on | y | . [ | y | = 0 ] x = x [ | y | = n + 1 ] write y = z for some | z | = n , define x ( z ) = ( x z ) , The reversal of x , defined by induction on | x | : [ | x | = 0 ] R = [ | x | = n + 1 ] ( y ) R = y R , for any | y | = n , 3 Harvard CS 121 & CSCI E-207 September 10, 2009 A Proof by Induction Proposition: ( x y ) z = x ( y z ) for all x,y,z * . (So it doesnt matter what order we concatenate, so we can just write xyz in the future) Proof by induction on | z | . . . 4 Harvard CS 121 & CSCI E-207 September 10, 2009 Proof that ( x y ) z = x ( y z ) , cont. 5 Harvard CS 121 & CSCI E-207 September 10, 2009 Proofs by Induction To prove P ( n ) for all n N : 1. Base Case: Prove P (0) . 2. Induction Hypothesis: Assume that P ( k ) holds for all k n (where n is fixed but arbitrary) 3. Induction Step: Given induction hypothesis, prove that P ( n + 1) holds. If we prove the Base Case and the Induction Step, then we have proved that P ( n ) holds for n = 0 , 1 , 2 ,... (i.e., for all n N ) 6 Harvard CS 121 & CSCI E-207 September 10, 2009 What is a proof? A proof is a formal argument of the truth of some mathematical statement. Formal means that the successive statements are unambiguous, and the steps interlock in a logical vise-grip. Formal also means that the argument could, in principle, be put in syntax that a machine could check. But proofs are meant to be read by human beings, and ordinary conventions and courtesies of human communication should be observed!...

View
Full
Document