0% found this document useful (0 votes)
28 views21 pages

Toa-Lecture Notes-20 - Pumping Lemma

The document discusses three topics related to decidability of regular languages: emptiness, equivalence, and finiteness. It explains how to check if a regular language is empty, if two regular languages are equivalent, and if a regular language is finite using formal methods like finite automata.

Uploaded by

Ali Ahmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views21 pages

Toa-Lecture Notes-20 - Pumping Lemma

The document discusses three topics related to decidability of regular languages: emptiness, equivalence, and finiteness. It explains how to check if a regular language is empty, if two regular languages are equivalent, and if a regular language is finite using formal methods like finite automata.

Uploaded by

Ali Ahmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 21

Decidability of Regular

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)

• Checking Emptiness (Formal Method through


FA)
– Paint the start state blue
– From every blue state, follow edge that leads out of it
and paint the destination state blue, then delete this
edge from the machine
– Repeat above step until no new state is painted blue
– When the procedure has stopped , if any of the final
states are painted blue, then the machine accepts
some words and if not it does not
Decidability of Regular Languages
(Equivalence)
• Checking Equivalence of Regular languages
– Given two regular languages L1 and L2 defined by
either of RE or FA
– Build FA for L1’ and L2’
– Create FAs for L1 ∩ L2’ and L2 ∩ L1’
– Build automaton for (L1 ∩ L2’)+(L2 ∩ L1’)
– This machine accepts the language of all words that
are in L1 but not in L2 or else in L2 but not in L1.
– If L1 and L2 are the same language, this machine
cannot accept any words. If this machine accepts a
single word even the Λ then L1 is not equal to L2
• L1 and L2
• FA1 and FA2
• FA1’ and FA2’
• FA1 ∩ FA2’ and FA2 ∩ FA1’
• FA3 U FA4
• FA5
Decidability of Regular Languages
(Equivalence)
• Equivalence
a,b a a,b
a
b b
p1+- p2 q1- q2+
FA1 FA1’

a,b a,b
b b
r1+- r2 s1- s2+

a a
a b a b

FA2 r3+ FA2’ s3


Decidability of Regular Languages
(Equivalence)
• Equivalence of Regular Languages
– (L1 ∩ L2’) + (L2 ∩ L1’) = (L1’ + L2)’ + (L2’ + L1)’

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

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

You might also like