-1
$\begingroup$

Classify the language $L = \{xx^Rw\ \big|\ (|x| \geq 0\ \wedge |w|\gt 0)\ where\ x,w\in\Sigma^*\}$ as one of:

  1. Regular but not Context-Free
  2. Context-Free but not Regular
  3. Decidable but not Context-Free

Most generally, $\Sigma^*$ can be any regular language (say $(a+b)^*$).

My first thought is that it can't be regular because palindromes themselves are not regular but I'm unsure if it is context-free or not. My hunch is to attempt the pumping lemma for CFL's to show that it is not context-free and, if that works, try to show that $L$ is decidable.

However, this approach feels prone to confirmation bias so I'm seeking some intuition by observing one's thought process in approaching such problems.

$\endgroup$
3
  • 3
    $\begingroup$ Hint: think about exactly what strings are in $L$. Not just, "Oh, it's strings that begin with a palindrome, followed by anything at all" but take, say, $\Sigma = \{a,b\}$, start listing the strings in $\Sigma^*$ in lexicographic order and, for each one, figure out whether it's in $L$ or not. See if you can find a pattern. $\endgroup$ Dec 12, 2015 at 22:15
  • 2
    $\begingroup$ "My hunch is to attempt the pumping lemma" -- then do so! What happens when you try that? $\endgroup$
    – Raphael
    Dec 13, 2015 at 0:46
  • $\begingroup$ Welcome to Computer Science! Your question is a very basic one. Since you did not include much of an attempt to solve it on your own, we have little to work with. Let me direct you towards our reference questions which cover your problem in detail. Please work through the related questions listed there, try to solve your problem again and edit to include your attempts along with the specific problems you encountered. Your question may then be reopened. Good luck! $\endgroup$
    – D.W.
    Dec 14, 2015 at 1:24

1 Answer 1

2
$\begingroup$

Somewhat surprisingly, the language is regular. The key idea here is that you aren't given a $x$ and a $w$, but rather you want all words that can be expressed as $xx^Rw$ for some $x, w$. The only constraints are that $|\,x\,|\ge 0$ and $|\,w\,|>0$.

Hint Since you have free choice of $x$, why not choose $x=\epsilon$, the empty string. Then what will $xx^rw$ have to be?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.