0

I am stuck on a question. Lets say there is a string that can be created from three alphabets a,b,c the condition is number of a<= number of b<= number of c. I can solve if there are a and b (two alphabets) but I am not able to solve for 3. Any help will be appreciated. Thanks

1 Answers1

1

The basic problem here is that context-free languages are not closed under intersection.

The example you give illustrates this. Thus, $\{ w\in\{a,b,c\}^* \mid |w|_a \le |w|_b\}$ is context-free, and similarly, so is $\{ w\in\{a,b,c\}^* \mid |w|_b \le |w|_c\}$. The intersection of these two languages $\{ w\in\{a,b,c\}^* \mid |w|_a \le |w|_b \le |w|_c\}$ is not context-free.

Hendrik Jan
  • 30,578
  • 1
  • 51
  • 105
  • So that is the reason I was not able to come up with a PDA for this. I had been trying for so long every time something or the other will not work. Thanks a lot for clarifying this. – user2943731 Nov 13 '17 at 21:13