Proofs

# Proofs - Harvard CS121 and CSCI E-207 Lecture 3 Doing...

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

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

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 don’t 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 doesn’t 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

{[ snackBarMessage ]}

### Page1 / 34

Proofs - Harvard CS121 and CSCI E-207 Lecture 3 Doing...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online