I was just putting some thought into different languages (as I'm reviewing for final exams coming up) and I can not think of a valid pushdown automata to handle the language A = {0^n 1^n 0^n | n >= 0}. This is not a context-free language, am I correct?
-
possible duplicate of http://stackoverflow.com/questions/2617675/theory-of-computation-using-the-pumping-lemma-for-context-free-languages – nobody Apr 11 '10 at 19:58
-
2@Andrew These are separate languages :) – Tony Apr 11 '10 at 20:00
-
2@Andrew: plus, "regular" and "context-free" are entirely different *classes* of languages – SamB Apr 11 '10 at 20:12
-
1Also, these questions are both from the same asker, so I *hope* he'd know if they were the same question or not (though I admit it's not a given) – SamB Apr 11 '10 at 20:20
2 Answers
I believe you are. It looks quite similar to the language L = { a^i b^i c^i | i > 0 } which the Wikipedia article on the pumping lemma uses as an example of how to prove that a language is not context-free.

- 9,039
- 5
- 49
- 56
-
1To the original poster, I would suggest attempting to follow through the same steps of the proof referred to above with the language you're interested in. – Dale Hagglund Apr 11 '10 at 21:14
-
Think of just the {0^n 1^n} part for a second. Replace 0
with (
and 1
with )
and you've got the language of simple nested parentheses, which is a dead give-away that a language is not regular.
Adding the final 0^n makes it context-sensitive (i.e. not context-free). Keep in mind that a CFG can be decided by a finite-state computer with a single stack as its only data structure. Seeing a 0 will cause a character to be pushed onto the stack, and seeing a 1 will pop from the stack. This guarantees that there are as many 0's as 1's, but there's no way to then match more 0's.

- 71
- 4