# Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer.

## Presentation on theme: "Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer."— Presentation transcript:

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

Midterm Take home? Vote now. Date:
During the week before Spring break (out March 3, due March 6)? Don’t have to worry over the break 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.

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 x2 3 8 p 12 1 20

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: For each i≥0, L |y|>0 |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 x M y 3 8 p 12 1 20 z

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

Pumping Lemma For each i≥0, L |y|>0 |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

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

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

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

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.

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

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’ ε q0 ε

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

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)} Σ

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 M M “Guess”

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 ε M M Accept if: M ends in state M ends in an accept state M 1 M 2 M

Download ppt "Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer."

Similar presentations