# Is the complement of $ww^R$ context-free?

Identify the language given by $L = \{ x \in (0,1)^* : x \neq ww^R, w \in (0,1)^*\}$. Note: $w^R$ is the reverse of the string $w$.

Closure property can/should be applied only in the cases when the actual language is not specified. Otherwise, you may arrive at wrong conclusions. The language in question is fully specified, so I doubt whether one can directly apply closure property on $ww^R$, which you say, is its complement or vice versa. The given answer is CFL. But I don't seem to have arrived at it satisfactorily.

-
What kind of answer are you looking for? The language given is the complement of the language of all even-length palindromes over $\{0, 1\}$. The complement over the universe $\{0, 1\}^*$ is the language of all odd-length words and even-length non-palindromes. If you want a CFG, first make one for odd-length words, then for non-palindromes, and take the union. –  Patrick87 Nov 27 '12 at 19:18
@Patrick87. thanks. u mean L is CFG only? am i right? –  user1771809 Nov 27 '12 at 19:26
What are you asking for? The language $L$ is context-free, and so is its complement. However, you cannot apply closure properties, since CFL are not closed under complement. Do you need a proof that $L$ is context-free? –  A.Schulz Nov 27 '12 at 20:27
@user1771809 Yes, $L$ is context-free, so there is a CFG which generates it. –  Patrick87 Nov 27 '12 at 20:54
@A.Schulz yes i am looking for a proof. i get confused when i saw a complement of CFG as CFG itself. –  user1771809 Nov 28 '12 at 18:43

If you want to show that $L$ is context-free, you can proceed as follows:
Build a push-down automaton $P$ that accepts $L$. $P$ will read the input and put all the read characters on its stack. At some point it guesses (non-deterministically!) that half of the input has been read. Then it reads the remaining input and checks it a against its stack. If $P$ finds a mismatching character it accepts, if it does find not a mismatch, or the guess for the middle of the word was wrong, it rejects.
No it is not using "complementation". The PDA I sketched accepts $L$ not $\bar L$. Maybe the non-determinism confuses you. The PDA accepts, if there exists at least one accepting run. So you can "guess", when half of the input has been read. If your guess was wrong you reject. But there is one correct guess, if $x\in L$. –  A.Schulz Dec 12 '12 at 17:49