Sie sind auf Seite 1von 3

Tahir Naseem/Handout 17

-1-

Theory of Automata and Formal Languages

Lecture 17
Objectives

Non Regular Languages


General Method for showing Non Regularity
o Pumping Lemma

Non Regular Languages


Regular languages are all those languages for which
o Regular expression cannot be written
o FSA cannot be constructed
o TG cannot be constructed
If all three above mentioned conditions are fulfilled for any language then that
particular language will be non regular
Example:
L = {0n1n: n 0} is not regular.

We reason by contradiction:
o Suppose we have managed to construct a DFA M for L
o We argue something must be wrong with this DFA
o In particular, M must accept some strings outside L

Imaginary DFA for L with n states

What happens when we run M on input x = 0n+11n+1?


M better accept, because x L

0r1n+1

What happens when we run M on input x = 0n+11n+1?


M better accept, because x L
But since M has n states, it must revisit at least one of its states while reading 0n+1

Tahir Naseem/Handout 17

-2-

Theory of Automata and Formal Languages

Pigeonhole principle
Suppose you are tossing n + 1 balls into n bins. Then two balls end up in the same bin.

Here, balls are 0s, bins are states:

If you have a DFA with n states and it reads n + 1 consecutive 0s, then it must end up in the
same state twice.

0r1n+1

What happens when we run M on input x = 0n+11n+1?


o M better accept, because x L2
o But since M has n states, it must revisit at least one of its states while reading
0n+1
o But then the DFA must contain a loop with 0s

The DFA will then also accept strings that go around the loop multiple times
But such strings have more 0s than 1s, so they are not in L2!

Tahir Naseem/Handout 17

-3-

Theory of Automata and Formal Languages

General Method for showing non regularity of a language


Every regular language L has a property

an+1am

For every sufficiently long input z in L, there is a middle part in z that, even if repeated any
number of times, keeps the input inside L
Pumping Lemma:
It is a theorem that is used to prove that given language is non regular.
Definition:
If A is a regular language, then there is a number p (the pumping length) where, if s is any
string in A of length at least p, then s may be divided into three pieces, s = xyz, satisfying the
following conditions:
1. for each i 0, xyiz A,
2. |y| > 0, and
3. |xy| p.
Recall the notation where |s| represents the length of string s, yi means that i copies of y are
concatenated together, and y0 equals .

Every infinite regular language must satisfy the condition of pumping lemma.
Pumping lemma is necessary but not sufficient to prove that given regular is non
regular.

Example:
Pumping lemma for (ab)* is
x=
y = ab
z=

Das könnte Ihnen auch gefallen