World's most popular travel blog for travel bloggers.

Is $a^n b^n c^n$ context-free?

, , No Comments
Problem Detail: 

I am new to grammars and I want to learn context free grammars which are the base of programming languages. After solving some problems, I encountered the language

$$\{a^nb^nc^n\mid n\geq 1\}\,.$$

Can anybody tell me if this is a context free language? I can't make any context free grammar for it and I don't know any other proof.

Asked By : muradin

Answered By : akashchandrakar

This is my approach to prove that a given language is not a CFL.

Try hard to come up with a Context free grammar for the given language. If you can come up with such a grammar, then the language is indeed a CFL.

If you can't, then you can use the pumping lemma to show that a given language is not a CFL.

Assume L is context free. Then L satisfies P.L. Then there exists n by the P.L. Let z = a^n b^n c^n Because |z|>=n and z in L, by PL there exist uvwxy s.t.

   z = uvwxy    |vwx| <= n    |vx| >= 1    forall i>=0, u v^i w x^i y in L 

But if there exist u,v,w,x,y satisfying the first three constraints, we can show that there exists an i s.t. the fourth constraint fails.

Case uvw consists only of "a". Then when i=0, the string is not in L (fewer "a"s than "b"s or "c"s).

Case vwx contains only "b"s - similar.

Case vwx contains only "c"s - similar.

Case vwx contains only two types of characters from {a,b,c}. Then uwy has more of the remaining type of characters.

The string vw cannot contain "a"s, "b"s, and "c"s, since vwx is a substring of z and has length <=n (cannot contain the last "a" and the first "c" both).i.e this is a contradiction and our assumption is wrong that L is CFL.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/33153

0 comments:

Post a Comment

Let us know your responses and feedback