Isn't $L=\{ww|w \in \{0,1\}^*\}$ a Non Deterministic Context Free Language?

5.6k Views Asked by At

My book says that it is not a Non Deterministic CFL.
If $ww^R$ can be a N-CFL, then why not the one in the question?
I think it might be a printing mistake, not sure.

2

There are 2 best solutions below

0
On

The problem is that $L=\big\{ww:w\in\{0,1\}^*\big\}$ isn’t context-free at all. You can use the pumping lemma to prove this. Suppose that $L$ is context-free, and let $p$ be the pumping length. Let $s=0^p1^p0^p1^p\in L$. Then we can decompose $s$ as $uvwxy$ so that $|vwx|\le p$, $|vx|\ge 1$, and $s_k=uv^kwx^ky\in L$ for $k\ge 0$. However, it’s not hard to see that no matter where in $s$ the string $vwx$ occurs, $s_0\notin L$. Thus, $L$ cannot be context-free.

0
On

It's a context sensitive language. $ww^r$ is context free because you can use a pda to compare the first alphabet of $w^r$ with the last alphabet of w. But in case of ww you cannot do any comparison because only the last alphabet of first w is on top of stack.