• retagged by
1,365 views
0 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?

1 Answer

Best answer
3 3 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
Position:
Show:

Related questions

3 3 votes
0 0 answers
394
394 views
Deepak Poonia asked Nov 20, 2024
394 views
Show that $L = \{a^nb^m,n< 2m \}$ is a deterministic context-free language.
1 1 vote
1 1 answer
589
589 views
vedantk asked Jan 10, 2024
589 views
If it’s DCFL then also construct the DPDA ?
0 0 votes
1 1 answer
645
645 views
raj_uddeshya157 asked Dec 27, 2023
645 views
Can
Can $\Sigma^{*}$ be called DCFL? If yes, what would the state transition diagram of its PDA look like?
1 1 vote
2 2 answers
1.4k
1.4k views
ggwon asked Dec 29, 2022
1,398 views
L = {$a^{n+m}b^{n}a^{m} | n,m \geq 0$}Is the above language DCFL or CFL ?