

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


The pumping lemma for context-free languages (Bar-Hillel lemma): Let L be a CFL, then there exists p > 0 such that if z ∈ L and |z| ≥ p, then z can be written as uvwxy where
Pumping Lemma for CFL can be used to prove that some languages are not context free.
Exercise 1: Σ = {a, b, c} L = {anbncn^ | n ≥ 0 }
Exercise 2: Σ = {a, b, c} L = {anbmcn^ | n ≥ m}
Exercise 3: Σ = {a, b, c} L = {aibj^ ck^ | i ≤ j ≤ k}
Exercise 4: Σ = {a, b} L = {ww | w ∈ {a, b}∗}
Exercise 5: Σ = {a, b} L = {ap^ | p prime }
We can decide the if a string w is the member of a context free language L. An efficient way to do this is the dynamic-programming (table filling) CYK (Cocke-Younger-Kasami) Algorithm. How can we decide if string w = a 1 a 2 a 3 a 4 a 5 is in L? We need the CNF grammar for L to do this, and fill out the following table.
x 15 x 14 x 25 x 13 x 24 x 35 x 12 x 23 x 34 x 45 x 11 x 22 x 33 x 44 x 55 a 1 a 2 a 3 a 4 a 5
Exercise 1: Use the CYK algorithm to determine if baaba ∈ L(G) holds, where the productions of your grammar G are
S → AB | BC A → BA | a B → CC | b C → AB | a
Exercise 2: Use the CYK algorithm to determine if cabab ∈ L(G) holds, where the productions of your grammar G are
S → AB | b A → CB | AA | a B → AS | b C → BS | c