I believe this language isn’t context free, because there is no chance that a PDA could compare 2 blocks of 0’s and 1’s of the same length and also remember it’s length for later use.
Unfortunately, I have no idea how to prove it.
I tried using the pumping lemma to no avail…
I’ve also tried to assume by contradiction that the language is context free and use the fact that the intersection of a context free language with a regular language is also context free (by finding some mysterious regular language L), and surprisingly (or not) – all my efforts were in vain…
Any help would be appreciated
Is the language { 0n1n0k | k != n} context free?
No, the language L = { 0n1n0k | k!=n } is not a context free language. Also, Class of Regular Languages is subset of class Context free languages.
You Idea using
PDAis correct and obvious way to show that language is not context free.And we can’t draw
PDAfor language 0n1n0k because after matching prefix 0n to 1n stack become empty, then we don’t have stored information to check weather suffix 0K are equal tonor not.HINT: For formal proofs
And the complement of a context-sensitive language is itself context-sensitive.
For Pumping Lemma:
L1 and L2 both are non-context-free Language. and union of two non-context free languages are non-context-free.( that can easily proof by grammar)
Also, The union, concatenation of two context-sensitive languages is context-sensitive.