review
play

Review Languages and Grammars Alphabets, strings, languages - PDF document

Review Languages and Grammars Alphabets, strings, languages Regular Languages CS 301 - Lecture 7 Deterministic Finite Automata Nondeterministic Finite Automata More Pumping Lemma Equivalence of NFA and DFA Minimizing a


  1. Review • Languages and Grammars – Alphabets, strings, languages • Regular Languages CS 301 - Lecture 7 – Deterministic Finite Automata – Nondeterministic Finite Automata More Pumping Lemma – Equivalence of NFA and DFA – Minimizing a DFA Fall 2008 – Regular Expressions – Regular Grammars – Properties of Regular Languages – Pumping lemma for Regular Languages • Today: – More pumping lemma for regular languages The Pumping Lemma: n n Theorem: The language L { a b : n 0 } = ≥ • Given a infinite regular language L is not regular m • there exists an integer | w ≥ | m • for any string with length w ∈ L w = x y z • we can write Proof: Use the Pumping Lemma | x y | m | y | 1 • with and ≤ ≥ i i 0 , 1 , 2 , ... x y z L • such that: = ∈ 1

  2. n n n n L { a b : n 0 } L { a b : n 0 } = ≥ = ≥ m Let be the integer in the Pumping Lemma Assume for contradiction L that is a regular language Pick a string such that: w w ∈ L | w ≥ | m length L Since is infinite we can apply the Pumping Lemma m b m w = a We pick m m m b m k a b x y z x y z a y a , k 1 Write: = = = ≥ From the Pumping Lemma i | x y | m , | y | 1 it must be that length ≤ ≥ x y z L From the Pumping Lemma: ∈ m m i 0 , 1 , 2 , ... = m m xyz a b a ... aa ... aa ... ab ... b = = x y z 2 x y z L Thus: ∈ k y a , k 1 Thus: = ≥ 2

  3. m b m k m k m + x y z a y a , k 1 a b L = = ≥ ∈ 2 x y z L From the Pumping Lemma: ∈ n n BUT: L { a b : n 0 } = ≥ m m + k 2 xy z a ... aa ... aa ... aa ... ab ... b L = ∈ m k m + a b L ∉ x y y z CONTRADICTION!!! m k m + a b L Thus: ∈ L Therefore: Our assumption that n n Non-regular languages { a b : n 0 } ≥ is a regular language is not true Regular languages Conclusion: L is not a regular language 3

  4. More Applications Non-regular languages R L { vv : v *} = ∈ Σ of Regular languages the Pumping Lemma R L { vv : v *} = ∈ Σ Theorem: The language R L { vv : v *} { a , b } Σ = = ∈ Σ Assume for contradiction is not regular L that is a regular language Proof: Use the Pumping Lemma Since is infinite L we can apply the Pumping Lemma 4

  5. m m m m a b b a x y z Write R = L { vv : v *} = ∈ Σ m Let be the integer in the Pumping Lemma From the Pumping Lemma | x y | m , | y | 1 it must be that length ≤ ≥ Pick a string such that: w w ∈ L and m m m m | w ≥ | m length xyz a ... aa ... a ... ab ... bb ... ba ... a = x y z m m m m w = a b b a We pick k y a , k 1 Thus: = ≥ m m m m k m m m m k x y z a b b a y a , k 1 x y z a b b a y a , k 1 = = ≥ = = ≥ 2 x y z L From the Pumping Lemma: ∈ i m m m From the Pumping Lemma: x y z L m + k ∈ 2 xy z = a ... aa ... aa ... a ... ab ... bb ... ba ... a ?¸ L i 0 , 1 , 2 , ... = x y y z 2 x y z L Thus: ∈ m k m m m + a b b a L Thus: ∈ 5

  6. m k m m m + a b b a L k 1 ∈ ≥ L Therefore: Our assumption that is a regular language is not true R BUT: L { vv : v *} = ∈ Σ m k m m m + a b b a L Conclusion: L is not a regular language ∉ CONTRADICTION!!! Non-regular languages Theorem: The language n l n l + L { a b c : n , l 0 } = ≥ n l n l + L { a b c : n , l 0 } = ≥ is not regular Regular languages Proof: Use the Pumping Lemma 6

  7. n l n l n l n l + + L { a b c : n , l 0 } L { a b c : n , l 0 } = ≥ = ≥ m Let be the integer in the Pumping Lemma Assume for contradiction L that is a regular language Pick a string such that: w w ∈ L and | w ≥ | m length L Since is infinite we can apply the Pumping Lemma m m 2 m We pick w a b c = m m 2 m m m 2 m k a b c x y z x y z a b c y a , k 1 Write = = = ≥ From the Pumping Lemma | x y | m , | y | 1 it must be that length ≤ ≥ i From the Pumping Lemma: x y z L ∈ m m 2 m i 0 , 1 , 2 , ... = xyz a ... aa ... aa ... ab ... bc ... cc ... c = y x z Thus: k Thus: y a , k 1 = ≥ 7

  8. m m 2 m k m k m 2 m − k 1 x y z a b c y a , k 1 a b c L ≥ = = ≥ ∈ From the Pumping Lemma: xz ∈ L n l n l BUT: + L { a b c : n , l 0 } = ≥ m − k m 2 m xz a ... aa ... ab ... bc ... cc ... c L = ∈ m k m 2 m − a b c L ∉ x z CONTRADICTION!!! m k m 2 m − a b c L Thus: ∈ L Therefore: Our assumption that n ! Non-regular languages L { a : n 0 } = ≥ is a regular language is not true Regular languages Conclusion: L is not a regular language 8

  9. n ! L { a : n 0 } = ≥ n ! Theorem: The language L { a : n 0 } = ≥ is not regular Assume for contradiction L that is a regular language n ! 1 2  ( n 1 ) n = ⋅ − ⋅ L Since is infinite Proof: Use the Pumping Lemma we can apply the Pumping Lemma n ! a m = ! L { a : n 0 } x y z Write = ≥ m Let be the integer in the Pumping Lemma From the Pumping Lemma | x y | m , | y | 1 it must be that length ≤ ≥ w w ∈ L Pick a string such that: m m − ! m | w ≥ | m length m ! = xyz a a ... aa ... aa ... aa ... aa ... a = x y z m ! w = a We pick k y a , 1 k m Thus: = ≤ ≤ 9

  10. m ! k m ! k x y z a y a , 1 k m x y z a y a , 1 k m = = ≤ ≤ = = ≤ ≤ 2 x y z L From the Pumping Lemma: ∈ i From the Pumping Lemma: x y z L ∈ m − ! m m + k 2 i 0 , 1 , 2 , ... = xy z a ... aa ... aa ... aa ... aa ... aa ... a L = ∈ x y y z 2 Thus: x y z L ∈ m ! k + Thus: a L ∈ m + ! k m ! m m ! k However: for m 1 + ≤ + > a L 1 k ≤ m ∈ ≤ m ! m ! ≤ + m ! m m ! < + n ! Since: L { a : n 0 } = ≥ m ! ( m 1 ) = + ( m 1 )! = + p There must exist such that: m ! k ( m 1 )! + < + m ! k p ! + = for any p m ! k p ! + ≠ 10

  11. m ! k 1 k ≤ m + a L ≤ ∈ L Therefore: Our assumption that is a regular language is not true n ! BUT: L { a : n 0 } = ≥ m ! k + a L Conclusion: L is not a regular language ∉ CONTRADICTION!!! What’s Next • Read – Linz Chapter 1, 2.1, 2.2, 2.3, (skip 2.4) 3, 4, 5.1-5.3 – JFLAP Startup, Chapter 1, 2.1, 3, 4, 6.1 • Next Lecture Topics from Chapter 5.1-5.3 – Context Free Grammars • Quiz 1 in Recitation on Wednesday 9/17 – Covers Linz 1.1, 1.2, 2.1, 2.2, 2.3 and JFLAP 1, 2.1 – Closed book, but you may bring one sheet of 8.5 x 11 inch paper with any notes you like. – Quiz will take the full hour • Homework – Homework Due Thursday 11

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend