Structural recursively defined set R, prove P(b) for each base case - - PowerPoint PPT Presentation

structural
SMART_READER_LITE
LIVE PREVIEW

Structural recursively defined set R, prove P(b) for each base case - - PowerPoint PPT Presentation

Mathematics for Computer Science Structural Induction MIT 6.042J/18.062J To prove P(x) holds for all x in Structural recursively defined set R, prove P(b) for each base case b R Induction P(c(x)) for each constructor, c, assuming


slide-1
SLIDE 1

1

Albert R Meyer, February 29, 2012

Mathematics for Computer Science

MIT 6.042J/18.062J

Structural Induction

lec 5M.1 Albert R Meyer, February 29, 2012

Structural Induction To prove P(x) holds for all x in recursively defined set R, prove

  • P(b) for each base case b ∈ R
  • P(c(x)) for each constructor, c,

assuming ind. hyp. P(x)

7W.2 Albert R Meyer, February 29, 2012

E ⊆ Even

by structural induction

  • n x ∈ E with ind. hyp.

“x is even”

  • 0 is even
  • if n is even, then so is

n+2, -n

lec 5M.3 Albert R Meyer, February 29, 2012

Matched Paren Strings M

Lemma: Every s in M has the

same number of ]’s and [’s.

Proof by structural induction

  • n the definition of M

lec 5M.4

slide-2
SLIDE 2

2

Albert R Meyer, February 29, 2012

Matched Paren Strings M

Lemma: Every s in M has the

same number of ]’s and [’s.

Let EQ ::= {strings with same number of ] and [} Lemma (restated): M ⊆ EQ

lec 5M.5

Structural Induction on M

Proof:

  • Ind. Hyp. P(s) ::= (s ∈ EQ)

Base case (s = λ):

λ has 0 ]’s and 0 [’s, so P(λ) is true.

base case is OK

Albert R Meyer, February 29, 2012 lec 5M.6 Albert R Meyer, February 29, 2012 lec 5M.7

Structural Induction on M

Constructor step: s = [r]t can assume P(r) and P(t)

#] in s = #] in r + #] in t + 1 #[ in s = #[ in r + #[ in t + 1 so = = by P(r) = by P(t)

so P(s) is true constrct case is OK

Albert R Meyer, February 29, 2012

Structural Induction on M

so by struct. induct.

QED

lec 5M.8

M ⊆EQ

slide-3
SLIDE 3

3

Albert R Meyer, February 29, 2012

The 18.01 Functions, F18

Lemma.

F18 is closed under taking derivatives: if f ∈ F18, then f´∈ F18

Class Problem

lec 5M.11

slide-4
SLIDE 4

MIT OpenCourseWare http://ocw.mit.edu

6.042J / 18.062J Mathematics for Computer Science

Spring 2015 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.