Download presentation
Presentation is loading. Please wait.
Published byΧάρων Γκόφας Modified over 6 years ago
1
Cpt S 317: Spring 2009 Sampath Kumar S, AP/CSE, SECE
Pumping Lemma for CFG Sampath Kumar S, AP/CSE, SECE School of EECS, WSU
2
Pumping Lemma for CFG Lemma:
1/17/2019 Lemma: Assume L is a context-free language, there is a pumping length n such that any string w ∈ L of length ≥ n can be written as |W| ≥ n We can break W into 5 strings, W = u v x y z, such that: |vxy| ≤ n |vy| ≠ ε For all k ≥ 0, the string uvkxykz ∈ L. Note: Select k such that the resulting string is not in L. Sampath Kumar S, AP/CSE, SECE
3
Applications of Pumping Lemma:
1/17/2019 Applications of Pumping Lemma: Pumping lemma is used to check whether a grammar is context free or not. Sampath Kumar S, AP/CSE, SECE
4
1/17/2019 Problems to Discuss: 120. Find out whether the language L= {0n1n2n |n ≥ 1} is context free or not. Solution At first, we assume that L is CFL. At first, choose a number n of the pumping lemma. Then, take z as 0n1n2n. Break z into uvwxy, where |vwx| ≤ n and |vx| ≠ ε. Sampath Kumar S, AP/CSE, SECE
5
1/17/2019 Sol. to problem 120: Hence vwx cannot involve both 0s and 2s, since the last 0 and the first 2 are at least (n+1) positions apart. There are two cases − Case 1 − vwx has no 2s. Then vx has only 0’s and 1’s. Then vwy, which would have to be in L, has n 2’s, but fewer than n 0’s or 1’s. Case 2 − vwx has no 0s. Now assume k as 2 and apply it in uvkxykz which in ∉ L. Hence, L is not a context-free language. Sampath Kumar S, AP/CSE, SECE
6
1/17/2019 Problems to Discuss: 121. Prove that L = {ww|w ∈ {a,b}} is not CFL Prove that L = {0n1n2n3n|n>1} is not CFL Prove that L = {anbnci|i<n} is not CFL 124. Prove that L = {a2i|i>1} is not CFL Sampath Kumar S, AP/CSE, SECE
7
1/17/2019 Sampath Kumar S, AP/CSE, SECE
8
1/17/2019 நன்றி Sampath Kumar S, AP/CSE, SECE
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.