Professional Documents
Culture Documents
L4 - Irregular Languages
L4 - Irregular Languages
L4 - Irregular Languages
Quick Recap:
- DFAs
- Nondeterminism
- NFA → DFA
- Closure under and
- Regular expressions → finite automata
- Finite automata → regular expressions
Today :
- Limitations of DFAs/NFAs ; Proving languages
aren’t regular
Non-Regular Languages
How do we show a language is not regular?
- Remember, to show a language is regular, we give a DFA.
- To show a language is not regular, we must give a proof.
- It is not enough to say that you couldn’t find a DFA for it,
therefore the language isn’t regular.
0101 0110
]
}
2)
3) 𝑖
Informally: is regular → every long string in can be pumped and the result stays in .
Proof: Let DFA recognize . Let be the number of states in . Pick where .
𝑠=¿ 𝑥 𝑦 𝑧 𝑀 𝑦
𝑞𝑗 𝑞𝑗
𝑞𝑗 The path that follows
will repeat a state when reading 𝑥 𝑧 when reading .
because is so long.
𝑥 𝑦 𝑦 𝑧
𝑞𝑗 𝑞𝑗 𝑞 𝑗 is also accepted
Method for Proving Non-regularity
Pumping Lemma: For every regular language , there is a
such that if and then where
1) for all
2)
3)
a) Imagine that a Demon claims A is regular , gives you some and claims the pumping lemma is
satisfied for this
b) You task : suitably choose an such that
c) Demon’s task : suggest some split in to that satisfies (2) and (3)
d) Your task : choose an to show that does not belong to A
Basically, you will need to show that you always emerge victorious !
Example 1 of Proving Non-regularity
Pumping Lemma: For every regular language , there is a
such that if and then where
1) for all
2)
3)
Let
Show: is not regular
Proof by Contradiction: (or Demon game )
Assume (to get a contradiction) that is regular.
The Demon gives a that satisfies pumping lemma 𝑠=¿000 ⋯ 000111 ⋯ 111
You choose . 𝑥𝑦 𝑧
Now Demon gives split satisfying the (2) and (3) conditions. ≤𝑝
Here is your trump card : Due to condition (3), is always an all-zero string !
Hence you choose
But has excess 0s and thus , hence beating the Demon.
Example 2 of Proving Non-regularity
Pumping Lemma: For every regular language , there is a
such that if and then where
1) for all
2)
3)
Let Say .
Proof by Contradiction:
𝑠=¿000 ⋯ 000000 ⋯ 000
The Demon gives as above. Need to choose . Which ?
𝑥𝑦 𝑧
≤𝑝 𝑦 =00
Suppose you pick .
Now the Demon gives you the following split
And now you are screwed. No matter what you choose, stays in the language A.
(This is also sometimes referred to as - can be pumped
Should we give up then ?
Example 2 of Proving Non-regularity
Pumping Lemma: For every regular language , there is a
such that if and then where
1) for all
2)
3)
Let Say .
Show: is not regular
Proof by Contradiction:
Give .
Now no matter how the Demon chooses the split , by condition (3), will contain
only .
𝑠=¿000 ⋯ 001000 ⋯ 001
𝑥𝑦 𝑧
So again choose and you win since ≤𝑝
Example 3 of Proving Non-regularity
Pumping Lemma: For every regular language , there is a
such that if and then where
1) for all
2)
3)
Let
Show: is not regular 𝑠=¿𝑎𝑎𝑎 ⋯ 𝑎𝑎𝑎𝑎𝑎𝑎 ⋯ 𝑎𝑎𝑎
Proof by Contradiction: 𝑥𝑦 𝑧
≤𝑝
Demon gives you
Pick .
Now no matter how the Demon chooses the split , by condition (3), will contain at most .
You choose . The string contains many which is strictly less than
Further, by condition (2), and hence number of in is strictly between !
Example 4 of Proving Non-regularity