retagged by
648 views
0 votes
0 votes

L = {0^n 1^2n 0^n+m , n,m>=0}

Is this Language CFL or non CFL?

According to me

  1. we can write this as 0^n 1^n 1^n 0^n 0^m
  2. Then we will keep on pushing 0’s and as and when we get 1 we keep on popping 0’s, now once the stack is empty and input is 1 we keep on pushing 1 and again as and when we get 0’s as input we keep on popping 1 till the stack is empty and then on seeing any number of 0’s we don’t push anything and when we reach the end of the string we simply move to the final state.

Is this logic correct?

retagged by

1 Answer

Best answer
2 votes
2 votes
Logic seems correct. To verify whether a language is context-free, you can use the pumping lemma for context-free languages. This states that if a language is context-free, there exists a number p (the "pumping length") such that any string s in the language with length greater than p can be written as s = xyz, where |xy| <= p, |y| > 0, and for all i >= 0, xy^iz is also in the language.

If we apply the pumping lemma to the language L, we can see that it does not satisfy the conditions of the lemma. In particular, it is not possible to pump any string in L to obtain a longer string that is also in the language. Therefore, L is not a context-free language.
selected by

Related questions

1 votes
1 votes
1 answer
1
0 votes
0 votes
0 answers
2
raj_uddeshya157 asked Dec 27, 2023
86 views
Can $\Sigma^{*}$ be called DCFL? If yes, what would the state transition diagram of its PDA look like?
1 votes
1 votes
2 answers
3
ggwon asked Dec 29, 2022
766 views
L = {$a^{n+m}b^{n}a^{m} | n,m \geq 0$}Is the above language DCFL or CFL ?
2 votes
2 votes
1 answer
4
Souvik33 asked Nov 23, 2022
327 views
If L and $L^{c}$ both are CFL, the L must be DCFL a. TRUE b.FALSE