Infinite Languages and Pumping Lemma

Decision, Computation and Language
Pumping Lemma
Dr. Muhammad S Khan
([email protected])
Ashton Building, Room G22
http://www.csc.liv.ac.uk/~khan/comp218
Exercise
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
2
Exercise
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
3
Regular Languages
Regular languages has at least three different
descriptions:
Languages accepted by DFA
Languages accepted by NFA
Languages defined by regular expressions
NOT every language is a regular language
Powerful technique for showing certain languages
not to be regular: Pumping Lemma
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
4
Limitation of FSA
Cannot recognise
𝐿 = {0𝑛 1𝑛 : 𝑛 = 1,2,3, … }
Palindromes 𝑀 = 𝑀 𝑅
RADAR
KAYAK
NOON
EYE
DEED
ROTATOR
Only finite number of states, so it can’t count
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
5
Infinite Languages
First of all, we note one very important point:
Every finite language is regular
How do we form an infinite regular language?
The union or concatenation of two finite languages will still
be a finite language;
thus, any infinite regular language must be formed from a
regular expression which uses Kleene Closure or Loop.
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
6
Algorithm for infinite languages
So, the input to the algorithm is a DFA, represented
(say) as a list of states and transitions. The algorithm
should look out for a cycle (or loop), a sequence of
states that are connected by transitions that form a
loop.
Furthermore, the cycle should be accessible
(reachable from the initial state), and there should
be a way to get from some state on the cycle, to an
accepting state.
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
7
Pumping Lemma
Every infinite regular language must have as a subset,
some set of words of the form π‘₯𝑦 𝑖 𝑧, for all 𝑖 β‰₯ 0,
where π‘₯, 𝑦 and 𝑧 are strings which correspond to π‘₯, 𝑦
and 𝑧 respectively.
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
8
The Pumping Lemma
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
9
Proof of Pumping Lemma
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
10
Reminder: accepting/rejecting paths notation
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
11
Reminder: accepting/rejecting paths notation
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
12
Proof of Pumping Lemma
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
13
Proof contd.
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
14
Proof
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
15
Proof (cont.)
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
16
Proof (cont.)
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
17
Summary
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
18
Example
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
19
Another example
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
20
The Pumping Lemma as an Adversarial Game
M S Khan (Univ. of Liverpool)
COMP218 Decision, Computation and Language
21