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
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 PDA
is correct and obvious way to show that language is not context free.
And we can't draw PDA
for 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 to n
or not.
HINT: For formal proofs
L = {0n1n0k | k!=n } now complement of L is L'.
L' = {{0n1n0n} that is well known context sensitive language (can be proof).
And the complement of a context-sensitive language is itself context-sensitive.
For Pumping Lemma:
L = {0n1n0k | k!=n } is Union of L1 and L2, Where
L1 = {0n1n0k | k > n } and L2 = {0n1n0k | k < n },L = L1 U L2
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With