180k views
5 votes
Give a counter-example to show that the following construction fails to prove that the class of context-free languages is closed under star. Let A be a CFL that is generated by the CFG G.

a) The language L=w^2 ∣w∈A is context-free.

b) The language L∗ =ww∣w∈A is context-free.

c) The language L′ =w^k ∣w∈A,k≥0 is context-free.

d) The language L∗ =w∣w∈A is context-free.

User StfBln
by
8.0k points

1 Answer

3 votes

Final answer:

To show that the class of context-free languages is not closed under the star operation, we can use a counter-example with the language L=w^2. Taking w to be a string generated by a context-free grammar G, we can show that L is not context-free using the pumping lemma for context-free languages. Therefore, option a) fails to prove the closure of context-free languages under star.

Step-by-step explanation:

To show that the class of context-free languages is not closed under the star operation, we need to find a counter-example. Let's consider the language A=w^k, where w is a string generated by a context-free grammar G and k≥0.

If we take the language L=w^2, where w∈A, we can see that L is not context-free. To prove this, we can use the pumping lemma for context-free languages which states that if L is context-free, there exists a constant p such that any string s in L with |s|≥p can be split into five parts u, v, x, y, and z, satisfying the conditions: s=uvxyz, |vxy|≤p, |vy|≥1, and for all i≥0, the string uvikxykz is also in L. If we choose the string s=w2∈L, we will find that it cannot be split according to the conditions of the lemma, thus proving that L is not context-free.

Therefore, option a) fails to prove that the class of context-free languages is closed under star since the language L=w^2, where w∈A, is not context-free.

User Nguyen Phong Thien
by
8.4k points