CS5371 Theory of Computation: Lecture 5: Automata Theory III (Non-Regular Language, Pumping Lemma, Regular Expression)
CS5371 Theory of Computation: Lecture 5: Automata Theory III (Non-Regular Language, Pumping Lemma, Regular Expression)
CS5371 Theory of Computation: Lecture 5: Automata Theory III (Non-Regular Language, Pumping Lemma, Regular Expression)
Theory of Computation
Lecture 5: Automata Theory III
(Non-regular Language, Pumping
Lemma, Regular Expression)
Objectives
•Prove the Pumping Lemma, and use it
to show that there are non-regular
languages
•Introduce Regular Expression
–which is one way to describe a language
(or a set of strings)
Non-Regular Language?
•To understand the power of DFA, apart
from knowing what it can do, we need to
know what it cannot do
•Let’s look at the language B = {0n1n | n 0}
•If we try to find a DFA to recognize B, the
DFA needs to keep track of the number of
0’s we have seen so far
•However, number of 0’ s is unlimited…there
are unlimited number of possibilities
•So, it is NOT POSSIBLE because the DFA
just has FINITE number of states!
Pumping Lemma
Theorem: If A is a regular language,
then there is a number p (called the
pumping length) such that:
if s is a string in A of length at least p, then
s can be divided into three pieces, s = xyz,
satisfying the following three conditions:
–For each k 0, xykz 2 A
–|y| 0, and
–|xy| · p
Pumping Lemma (Proof)
•Let us assign the pumping length p to be
the number of states in the DFA that
recognize A
•Consider the sequence of states that the
DFA goes through when reading
s = s1s2…sn
•At the beginning, it is at state r0 = qstart
•Then, it goes to r1 after reading s1, then
goes to r2, then goes to r3 …
Pumping Lemma (Proof)
•When it has finished reading sp, one of the
state has been visited at least two times (why?)
•That is, ri = rj , for some 0 i j p
•Now, let x = s1s2…si,
y = si+1si+2…sj, and
z = sj+1sj+2…sn
•We can check that xykz 2 A for all k 0
(why?)
•Also, |y| 0 and |xy| p (why?)
Use of Pumping Lemma
(Example 1)
•How to prove?
Use of Pumping Lemma
(Example 2)
•Proof 1: Similar to Example 1. Let s =
0p1p and apply pumping lemma.
•Proof 2: We use the fact: the class
of regular languages is closed under
intersection (will be proved in tutorial
next Tue). That is,
If A and B are regular languages,
then A \ B is also a regular language.
Use of Pumping Lemma
(Example 2: Proof 2)
•Let A = { 0m1n | m, n ¸ 0}
•Note that A is regular (why?)
•How to prove?
Use of Pumping Lemma
(Example 4)
2
•Lemma: The language {1n | n ¸ 0} is
not regular.
•Proof:
–Let p be the pumping length.
2
–Let s = 1p .
–By pumping lemma, we have |xyz| = p2.
Also, 0 |y| |xy| p.
–p2 |xyyz| p2 + p (p+1)2
–Contradiction occurs (where??)
Use of Pumping Lemma
(Example 5)
•Lemma: The language E = { 0i1j | i j }
is not regular.