Non regular Languages
• A language that cannot be defined by a
regular expression
• L={^,ab,aabb,aaabbb,aaaabbbb,aaaaabb
bbb,…}
• 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
infinitely many words. Then there exist
some three strings x, y and z (where y is
not null) such that all the strings of the
form xynz for n =1,2 ,… are words in L”
Pumping Lemma
• Proof
• If L is a regular Language then there is an FA
that accepts exactly the words in L.
• Let w be some word in L that has more letters
in it than there are states in the FA.
• When this string is executed on FA , the path it
traces cannot visit a new state for each letter
of the string because there are more letters
than states.
• Therefore, it must at some point revisit a state
that has already been visited.
Pumping Lemma
• The word w can be broken into three parts
– X: Consisting of all letters of w starting at the
beginning that lead up to the first state that is
revisited. X can be null if the path for w revisits the
start state as its first revisit
– Y: It starts at the letter after the substring x. It
denotes the substring of w that travels around the
circuit coming back to the same state the circuit
began with. Because there must be a circuit hence y
cannot be null even if it loops around just once
– Z: This is the rest of the string of w after substring y.
It can be null. It may also loop around the y-circuit or
any other
Pumping Lemma
• Thus w = xyz and w is accepted by this
machine
• Path for xyyz
Pumping Lemma
• Example
a
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