0

I been watching tutorials about how to check if a language is not context-free and in 1 video there was a language: L = {a^n b^n c^n | n ≥ 0} and they used a pumping lemma to prove that it's not context-free, I am only a beginner at CFG however I thought a language is Context-free if you are able to create a CFG for it, and this is the CFG i created for this language:

S --> aSX |  
X --> bXY | 
Y --> cY | 

Or am I not understand CFG and what I wrote doesn't make sense?

john3901
  • 13
  • 3

1 Answers1

1

The grammar you wrote can generate the word "aaa", which is not supposed to be generated, if the grammar generates exactly $L$.

ergo, the grammar is incorrect for $L$. (which is great, since $L$ is not CFL, and no grammar can generate it!)

Ran G.
  • 20,884
  • 3
  • 61
  • 117