990 likes | 1.21k Vues
CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 4 Mälardalen University 2005. Content - More Properties of Regular Languages (RL) - Standard Representations of RL - Elementary Questions about RL - Non-Regular Languages - The Pigeonhole Principle
E N D
CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 4 Mälardalen University 2005
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
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 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 change: • non-final states final states • 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 Expressions DFAs Regular Languages NFAs Regular Grammars Standard Representations of Regular Languages
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 Question: Answer:
DFA DFA
Given regular language how can we check if is finite? Question: Answer: Take the DFA that accepts Check if there is a walk with 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 Question: Answer:
Non-regular languages Regular languages Chomsky’s Language Hierarchy
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 ...... ......
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 ...... ......