Fall 2004COMP 3351 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars
Fall 2004COMP 3352 When we say: We are given a Regular Language We mean:Language is in a standard representation
Fall 2004COMP 3353 Elementary Questions about Regular Languages
Fall 2004COMP 3354 Membership Question Question:Given regular language and string how can we check if ? Answer:Take the DFA that accepts and check if is accepted
Fall 2004COMP 3355 DFA
Fall 2004COMP 3356 Given regular language how can we check if is empty: ? Take the DFA that accepts Check if there is any path from the initial state to a final state Question: Answer:
Fall 2004COMP 3357 DFA
Fall 2004COMP 3358 Given regular language how can we check if is finite? Take the DFA that accepts Check if there is a walk with cycle from the initial state to a final state Question: Answer:
Fall 2004COMP 3359 DFA is infinite DFA is finite
Fall 2004COMP Given regular languages and how can we check if ? Question: Find if Answer:
Fall 2004COMP and
Fall 2004COMP or
Fall 2004COMP Non-regular languages
Fall 2004COMP Regular languages Non-regular languages
Fall 2004COMP How can we prove that a language is not regular? Prove that there is no DFA that accepts Problem: this is not easy to prove Solution: the Pumping Lemma !!!
Fall 2004COMP The Pigeonhole Principle
Fall 2004COMP pigeons pigeonholes
Fall 2004COMP A pigeonhole must contain at least two pigeons
Fall 2004COMP pigeons pigeonholes
Fall 2004COMP The Pigeonhole Principle pigeons pigeonholes There is a pigeonhole with at least 2 pigeons
Fall 2004COMP The Pigeonhole Principle and DFAs
Fall 2004COMP DFA with states
Fall 2004COMP In walks of strings:no state is repeated
Fall 2004COMP In walks of strings:a state is repeated
Fall 2004COMP If string has length : Thus, a state must be repeated Then the transitions of string are more than the states of the DFA
Fall 2004COMP In general, for any DFA: String has length number of states A state must be repeated in the walk of walk of Repeated state
Fall 2004COMP In other words for a string : transitions are pigeons states are pigeonholes walk of Repeated state
Fall 2004COMP The Pumping Lemma
Fall 2004COMP Take an infinite regular language There exists a DFA that accepts states
Fall 2004COMP Take string with There is a walk with label : walk
Fall 2004COMP If string has length (number of states of DFA) then, from the pigeonhole principle: a state is repeated in the walk walk
Fall 2004COMP walk Let be the first state repeated in the walk of
Fall 2004COMP Write......
Fall 2004COMP Observations:lengthnumber of states of DFA length
Fall 2004COMP The string is accepted Observation:......
Fall 2004COMP The string is accepted Observation:......
Fall 2004COMP The string is accepted Observation:......
Fall 2004COMP The string is accepted In General:......
Fall 2004COMP In General: Language accepted by the DFA
Fall 2004COMP In other words, we described: The Pumping Lemma !!!
Fall 2004COMP The Pumping Lemma: Given a infinite regular language there exists an integer for any string with length we can write with and such that:
Fall 2004COMP Applications of the Pumping Lemma
Fall 2004COMP Theorem: The language is not regular. Proof: Use the Pumping Lemma
Fall 2004COMP Assume that is a regular language Since is an infinite language, we can apply the Pumping Lemma
Fall 2004COMP Let be the integer in the Pumping Lemma Pick a string such that: (1)and We pick: (2) length
Fall 2004COMP it must be that length From the Pumping Lemma Write: Thus:
Fall 2004COMP From the Pumping Lemma: Thus:
Fall 2004COMP From the Pumping Lemma: Thus:
Fall 2004COMP But: CONTRADICTION!!!
Fall 2004COMP Our assumption that is a regular language is not true Conclusion: is not a regular language Therefore:
Fall 2004COMP Regular languages Non-regular languages
Fall 2004COMP More Applications of the Pumping Lemma
Fall 2004COMP The Pumping Lemma: Given a infinite regular language there exists an integer for any string with length we can write with and such that:
Fall 2004COMP Regular languages Non-regular languages
Fall 2004COMP Theorem: The language is not regular Proof: Use the Pumping Lemma
Fall 2004COMP Assume for contradiction that is a regular language Since is infinite we can apply the Pumping Lemma
Fall 2004COMP We pick Let be the integer in the Pumping Lemma Pick a string such that: length and
Fall 2004COMP Write it must be that length From the Pumping Lemma Thus:
Fall 2004COMP From the Pumping Lemma: Thus:
Fall 2004COMP From the Pumping Lemma: Thus:
Fall 2004COMP BUT: CONTRADICTION!!!
Fall 2004COMP Our assumption that is a regular language is not true Conclusion: is not a regular language Therefore:
Fall 2004COMP Regular languages Non-regular languages
Fall 2004COMP Theorem: The language is not regular Proof: Use the Pumping Lemma
Fall 2004COMP Assume for contradiction that is a regular language Since is infinite we can apply the Pumping Lemma
Fall 2004COMP We pick Let be the integer in the Pumping Lemma Pick a string such that: length and
Fall 2004COMP Write it must be that length From the Pumping Lemma Thus:
Fall 2004COMP From the Pumping Lemma: Thus:
Fall 2004COMP From the Pumping Lemma: Thus:
Fall 2004COMP BUT: CONTRADICTION!!!
Fall 2004COMP Our assumption that is a regular language is not true Conclusion: is not a regular language Therefore:
Fall 2004COMP Regular languages Non-regular languages
Fall 2004COMP Theorem: The language is not regular Proof: Use the Pumping Lemma
Fall 2004COMP Assume for contradiction that is a regular language Since is infinite we can apply the Pumping Lemma
Fall 2004COMP We pick Let be the integer in the Pumping Lemma Pick a string such that: length
Fall 2004COMP Write it must be that length From the Pumping Lemma Thus:
Fall 2004COMP From the Pumping Lemma: Thus:
Fall 2004COMP From the Pumping Lemma: Thus:
Fall 2004COMP Since: There must exist such that:
Fall 2004COMP However:for for any
Fall 2004COMP BUT: CONTRADICTION!!!
Fall 2004COMP Our assumption that is a regular language is not true Conclusion: is not a regular language Therefore: