Toa-Lecture Notes-20 - Pumping Lemma
Toa-Lecture Notes-20 - Pumping Lemma
Languages
• Decidability is concerned with three
issues
– Is the language described empty
(Emptiness)
– Do two descriptions of a language actually
describe the same language (Equivalence)
– Language defined by an FA has finitely or
infinitely many words in it
Decidability of Regular Languages
(Emptiness)
a,b a,b
b b
r1+- r2 s1- s2+
a a
a b a b
p1 or s3
q1 or r1 p1 or s1
q1 or r3 a
a a
- -
a
a,b a,b
b b b b
p2 or s2
q2 or r2
(FA1’+FA2)’ (FA2’+FA1)’
Decidability of Regular Languages
(Finiteness)
• Finiteness (through Regular Expressions)
– Scan the RE and if it contains the closure
operator “*” then the RE defines an infinite
language
– What about
Λ*, (Λ+aΛ*)(Λ*+Λ)* and (Λ+aΛ)*(Λ*+Λ)*
– Only the second defines infinite language
– If language is being defined by an FA then it can
be converted into an RE and verified for finiteness
Pumping Lemma
Non regular Languages
• A language that cannot be defined by a
regular expression
• L={^,ab,aabb,aaabbb,aaaabbbb,aaaaabbbbb,
…}
• L = {anbn for n=0 1 2 3 4 5 …}
• Or L = {anbn}
• L is a non regular language as it can not be
defined by any RE
Pumping Lemma
• Regular languages are defined by Regular
expressions and accepted by DFA, NFA
and TG.
• Non regular languages need some
powerful machines for their description
• The pumping lemma is used to prove
certain languages as non regular
Pumping Lemma
• “Let L be any regular language that has
b b
1- 2+ 3
a a b
b a
a,b
a
4 5 6+
b
W = bbbababa, bbbabbababa
Pumping Lemma
• Application
• Let L = {anbn for n=0,1,2,3, ….}
• Breakdown into three components xyz
• Y as sequence of a’s (xyyz)
• Y as all b’s (xyyz)
• Y as combination of a’s and b’s (xyyz)
• Is L Regular?
Pumping Lemma (Version 2)
• If L is an infinite language accepted by an
FA with N states. Then for all words w in L
that have more than N letters, there are
string x, y and z where y is not null and
length(x)+length(y) does not exceed N
such that w = xyz and all string of the form
xynz are in L
• Application on PRIME
Myhill-Nerode Theorem
• The pumping Lemma established the
nonregularity of a language through
contradictions.
• Myhill-Nerode Theorem proves a language
to be regular or not by constructive
algorithm
• Societies of states for certain classes of
strings
Myhill-Nerode Theorem
• “Given a language L, any two strings x and
y are in the same class if for all possible
strings z whether both xz and yz are in L or
both are not
– The language L divides the set of all possible
strings into separate (mutually exclusive)
classes
– If L is regular, the number of classes L creates is
finite
– If the number of classes L creates is finite, then
L is regular
Myhill-Nerode Theorem
• Proof of Part 1
– Is S is in a class with X and S is also in a
class with Y, then X and Y must be in the
same class
• Proof of Part 2 b
1
a
a
a,b
+
-
b b a
2
Myhill-Nerode Theorem
• Proof of Part 3
• Given the finite classes of L create an FA
• If a class contains a word of L then all the strings
in the class are words in L
• Example: Language of all words that end in a
• C1 = all strings that end in a, the final state
• C2 = all strings that do not end in a, the start state
a
b a
C2- C1+
b