Download presentation

Presentation is loading. Please wait.

Published byJamil Gotts Modified about 1 year ago

1
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

2
Midterm Take home? Vote now. Date: 1.During the week before Spring break (out March 3, due March 6)? Don’t have to worry over the break 2.After Spring break (4 days within March 16-23)? 1 more week of content but 2 more weeks to solve problems I will hold Skype/Google Hangout office hours over the break Think about it, vote on Thursday.

3
Pumping Lemma Goal: Give a sufficient condition for showing non-regularity Consider that L is an infinite regular language Let M be a DFA, L(M)=L Let’s say M has p states There must be some String w in L s.t. |w|>p By the pigeon-hole principle: Some state was visited at least twice! Taking that loop another time must give another string in the language. M p 3 x2

4
Pumping Lemma If L is a regular language then there is some number p (called pumping length) where if w is a string in L s.t. |w|>p then w can be divided into 3 pieces: w=xyz which satisfy: 1.For each i≥0, L 2.|y|>0 3.|xy|≤p Example: Consider: By condition 3 we know: Thus for i=2 we have more a’s than b’s, so L cannot be regular M p 3 x y z ℕ

5
Pumping Lemma 1.For each i≥0, L 2.|y|>0 3.|xy|≤p Show: is not regular Consider By condition 3 we know y, this leaves 4 cases: 1.y 2.y 3.y 4.y Problem: in all of these I only change the first half! I needed to “remember” the first half of the string.

6
Pumping Lemma 1.For each i≥0, L 2.|y|>0 3.|xy|≤p Show: is not regular Consider where q is a prime greater than p y may have only a’s, let y= where m≤p For i=p+1 we have Clearly, p(m+1) is not prime For let then So

7
Pumping Lemma 1.For each i≥0, L 2.|y|>0 3.|xy|≤p Consider: This language is pumpable but not regular 3 cases: 1.If then let x=ε, y=a 2.If then let x=ε, y=c 3.If then let x=ε, y=c Thus every string is pumpable Nonregular: Then use pumping Lemma!

8
Myhill-Nerode Theorem Gives a necessary and sufficient condition for regularity! Idea: If two strings terminate in the same state in a DFA then their membership must be equivalent for any suffix. If and meet at state q then for any string, ends in the same state as We say and have no distinguishing extensions M q

9
Myhill-Nerode Theorem Recall Equivalence Relation: A relation ~ is called an equivalence relation if: Reflexive: Symmetric: Transitive: The relation if and have no distinguishing extensions in language L forms an equivalence relation. Recall Equivalence Class: For equivalence relation ~, equivalence class Myhill Nerode Theorem: L is regular iff has a finite number of equivalence classes under relation

10
Myhill-Nerode Theorem Myhill Nerode Theorem: L is regular iff has a finite number of equivalence classes under relation Given a finite set of equivalence classes, construct a DFA: Each equivalence class becomes a state: If character takes a string from equivalence class to then add a transition from the state for to the state for. Accept states are those for equivalence classes of strings in the language.

11
Myhill-Nerode Theorem Extra Credit: Use the Myhill-Nerode Theorem to show the following languages are non-regular: ℕ

12
Language Reversal Theorem: The regular languages are closed under reversal. Proof: Construction. Given a regular language L, show that the language is also regular. Let M be a DFA for L, construct M’ to be a NFA for L: M M’ q0q0 ε ε

13
Half Let Show that HALF preserves regularity. e.g. if “RingoStarr” is in L, then “Ringo” is in HALF(L) Let M be a DFA for language L Intuition: follow the transitions of M for string v. “Check” that there is a path from v to an accept state that consumes |v| characters. How do we do this “check”? M

14
Half Let Show that HALF preserves regularity. Intuition: follow the transitions of M for string v. “Check” that there is a path from v to an accept state that consumes |v| characters. How do we do this “check”? Use the machine for LR M M’ ε ε Σ Σ Σ Σ Σ F={(q,q)}

15
Double Let Show that DOUBLE preserves regularity. e.g. if “BamBam” is in L, then “Bam” is in DOUBLE(L) Let M be a DFA for language L Intuition: Run L on w, in parallel non-deterministically “guess” the end state in machine M on w and check if starting from that guess puts the machine in an accept state MM “Guess”

16
Double Let Intuition: Run L on w, in parallel non-deterministically “guess” the end state in machine M on w and check if starting from that guess puts the machine in an accept state M … Accept if: M ends in state M ends in an accept state MMM 2 MM 1 ε ε ε

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google