1.24k likes | 1.45k Views
CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012. Content - More Properties of Regular Languages (RL) - Standard Representations of RL - Elementary Questions about RL
E N D
CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012
Content • - More Properties of Regular Languages (RL)- Standard Representations of RL • - Elementary Questions about RL • - Non-Regular Languages • - The Pigeonhole Principle • - The Pumping Lemma • Applications of the Pumping Lemma • NFA-DFA repetition
More Properties of Regular Languages Based on C Busch, RPI, Models of Computation
We have shown Regular languages are closed under Union Concatenation Star operation Reverse
Namely, for regular languages and : Union Concatenation Star operation Reverse Regular Languages
We will show that Regular languages are also closed under Complement Intersection
Complement Intersection Regular Languages Namely, for regular languages and :
Theorem For regular language the complement is regular. Complement Proof Take DFA that accepts and exchange: • non-acceptingstates accepting states • Resulting DFA accepts
Theorem For regular languages and the intersection is regular. Proof Apply DeMorgan’s Law: Intersection
regular regular regular regular regular
Standard Representations of Regular Languages
Regular Expression DFA Regular Language NFA Regular Grammar Regular Language Representations
Given regular language and string how can we check if ? Take the DFA that accepts and check if is accepted. Membership Question Question: Answer:
DFA DFA
Given regular language how can we check if is empty: ? Take the DFA that accepts . Check if there is a path from the initial state to a final state. Empty Language Question Question: Answer:
DFA DFA
Finiteness Question Given regular language how can we check if is finite? Question: Answer: Take the DFA that accepts . Check if there is a walk with a cycle from the initial state to a final state.
DFA is infinite DFA is finite
Given regular languages and how can we check if ? Find if Equality Question Question: Answer:
Non-regular languages Regular languages
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 !
pigeons pigeonholes
A pigeonhole must contain at least two pigeons
pigeonholes pigeons ........... ...........
The Pigeonhole Principle pigeons pigeonholes There is a pigeonhole with at least 2 pigeons ...........
In walks of strings: no state is repeated
In walks of strings: a state is repeated
If the walk of string has length then a state is repeated
Pigeonhole principle for any DFA: If in a walk of a string transitionsstates of DFA then a state is repeated
In other words for a string transitions are pigeons states are pigeonholes
In general A string has length number of states A state must be repeated in the walk of walk of ...... ......
The Pumping Lemmafor Regular Languages see alsohttp://www.math.uu.se/~salling/Movies/Nonregularity.mov
Take an infinite regular language DFA that accepts states
Take string with There is a walk with label ......... walk
If string has length ( number of states) then, from the pigeonhole principle: a state is repeated in the walk ...... ...... walk
Write ...... ......
...... ...... Lengths: (from pigeon principle, as q is the first repetition in sequence) (there is a walk in the graph)
Observation: The string is accepted ...... ......
Observation: The string is accepted ...... ......
Observation: The string is accepted ...... ......
Generally: The string is accepted ...... ......