Download presentation

Presentation is loading. Please wait.

Published byTerrance Turkington Modified over 2 years ago

1
3.2 Pumping Lemma for Regular Languages Given a language L, how do we know whether it is regular or not? If we can construct an FA to accept the language or a regular expression denoting the language, then it is a regular. But if we can not, we still can not make sure that it is not regular. So, we have develop methods to show irregular languages. We have already mentioned one method in section 3.1 to show that a language L is not regular, if the number of equivalence classes of the relation R L is infinite. The second method we shall introduce is the pumping lemma for regular languages.

2
If a language L is finite, then it is easy to figure out whether or not a given string is in L. L is finite, it is sure that we can list them all. So, L is a regular language. Theorem 2: Let L be a finite language. Then L is regular. Proof: It is easy to construct an NFA as follows to accept the finite set L={ 1, 2, …, n }. q 0 q f q 1 q 2 q n p 1 p 2 p n 11 2 n n

3
Lemma 4(The pumping lemma): Let L be an infinite regular language over an alphabet . Then there is a constant n such that for each string in L with | | n, can be written as = xyz, where |xy| n and |y| 1, and for all k 0, xy k z L. Proof : Since L is regular, by the Myhill-Nerode theorem there is a minimal DFA M = (Q, , , q 0, F) accepting L. Let n be |Q|. If L and | | n. Let =a 1 a 2 …a m, where m n. Let q i = ( q 0, a 1 a 2 …a i ), i = 1, 2, …, m. Since there are only n states in Q and m n, by the pigeon hole theorem there are two states of q 0, q 1, q 2, …, and q n are same, say 0 i j n and q i = q j.

4
q i = ( q 0, a 1 a 2 …a i ) = ( q 0, a 1 a 2 …a j ) = q j. We have that q i = ( q 0, a 1 a 2 …a i ) = ( q i, a (i+1) …a j ). Let x = a 1 a 2 …a i, y = a (i+1) …a j, and z = a (i+1) …a m. Hence, q i = ( q i, a (i+1) …a j ) = ( q i, (a (i+1) …a j ) k ), for all k 0. We have that ( q 0, xy k z) = ( q i, y k z) = ( q i, z) = ( q 0, xyz) F, for all k 0. Therefore, = xy k z, where |xy| n and |y| 1, and xy k z L, for all k 0.

5
The pumping lemma says that ( L)( L is regular and |L| is infinite ( n ) ( ( in L, | | n) ( x, y and z, |xy| n and |y| 1, = xyz)( i 0) (xy i z L))) Therefore, L is regular and |L| is infinite, we have that “ n, ” such that “ in L, | | n, x, y and z, = xyz, where |xy| n and |y| 1, and xy i z L, for all i 0.” To show that a set L is not regular by contradiction, we first assume that L were regular and n in the pumping lemma. And show that “ in L, | | n, x, y and z, = xyz, where |xy| n and |y| 1, i 0 such that xy i z L.” For a true statement ” x P(x) n Q(n) ”, where P( ) and Q( ) are two predicates, suppose that we want to show that for some y P(y) is not true. We can first assume that P(y) were true. And show there is an n such that Q(n) is false. That the predicate Q(n) is false leads to a contradiction. Hence, P(y) is not true.

6
Example 6: Let L={0 i 1 i | i>0}. Show that L is not regular. Solution : Assume that L were regular. Let n be the constant in the pumping lemma. Choose = 0 n 1 n. We have that L and | | > n. Let = xyz, where |xy| n and |y| 1. Since |xy| n and |y| 1, we have that x = 0 |x| and y = 0 |y|. It is obvious that xy i z L for i 1, since the number of 0s is not equal to that of 1s in the string xy i z. Contradict to the assumption that L is regular.

7
Example 7: Let L be the regular expressions over an alphabet ={0, 1}. Show that L is not regular. Solution : Assume that L were regular. Let n be the constant in the pumping lemma. Choose = ( n 0*)*…)*). We have that L and | | > n. Let = xyz, where |xy| n and |y| 1. Since |xy| n and |y| 1, we have that x = ( |x| and y = ( |y|. It is obvious that xy i z L for i 1, since the number of the left parentheses is not equal to that of right parentheses in the string xy i z. Contradict to the assumption that L is regular.

8
Example 8: Let L = { in {0, 1}* | i = the number of 0’s in , and j = the number of 1’s in , i, j 1 and gcd(i, j)=1}. Show that L is not regular. Solution : Assume that L were regular. Let n be the constant in the pumping lemma. Choose = 0 t 1 s, where s =2*3*5*…*p n, p n is the nth prime number and t = p n+1. We have that L and | | > n. Let = xyz, where |xy| n and |y| 1. Hence, x = 0 |x| and y = 0 |y|. Consider the case that i = 0, xy i z = xz = 0 t - |y| 1 s. Since t - |y| 1. Then xz L. Contradiction.

Similar presentations

OK

FSA Lecture 1 Finite State Machines. Creating a Automaton Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.

FSA Lecture 1 Finite State Machines. Creating a Automaton Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on water chemistry Ppt on statistics and probability books Ppt on viruses and bacteria images Ppt on lines in fashion design Ppt on condition monitoring maintenance Ppt on intelligent manufacturing journal Ppt on steel industry in india Ppt on autonomous car computer Ppt on non conventional sources of energy Ppt on earth hour toronto