1
$\begingroup$

Consider the language definition:

$L = \{<M>| M$ is a DFA and $M$ accepts some string of the form $ww^{r}$ for some $w\in \Sigma^{*}\}$

The language $L$ is :

A) Regular

B) Context-free but not regular

C) Recursive but not context-free

D) Recursive enumerable but not recursive

Solution provided: Is to create a product machine(intersection) of $M\times P$ where $P$ is the pushdown automata which accepts all the even length palindromes, this product machine will also be a PDA as $REG \cap CFL=CFL$, now it comes down to checking emptiness of $CFL$ is decidable hence recursive, as we need to do this for any $M$ we need to able to simulate a PDA which requires at least an $LBA$

My approach: First, we create a machine $M^{r}$ which accepts the language $L^{r}$ now we do product construction(intersection) of $M \times M^{r} \times E$ where $E$ is DFA which accepts all even length strings over sigma, this product machine will be an FSM as $REG \cap REG \cap REG = REG$ so in my approach it comes down to checking emptiness of Regular language.

My doubt: How did they decide to check the emptiness of CFL we require at least an LBA and what type of machine is required in my approach as we need to check the emptiness of regular language?

$\endgroup$

2 Answers 2

2
$\begingroup$

Note that a string in $K\cap K^r$ is not necessarily a palindrome. Hence your argument can not work as a shortcut.

However, the complexity is not because of the $ww^r$ in the definition. Given $M$ one mey construct a finite state automaton $M'$ such that $M'$ accepts $w$ iff $M$ accepts $ww^R$, see How to show that a language {w|ww^R in A} is regular, A being regular? This is a simple construction, involving the simulation of $M$ on $w$ synchronously forward and backward. Checking whether $M'$ accepts any string at all is simple.

The problem is that it is even hard to think of a decent way of encoding a finite state automaton suitable for reading by a PDA while being able to compute paths in the DFA from the input.

$\endgroup$
2
  • 1
    $\begingroup$ Sorry! You are correct. My answer was too fast. Your mistake is elsewhere. Words in $L\cap L^r$ are not necessarily palindromes. $\endgroup$ Commented Dec 21, 2022 at 14:08
  • $\begingroup$ yes, I got your point. Could you also add to your answer why $LBA$ is required for checking the emptiness of a CFL $\endgroup$ Commented Dec 21, 2022 at 23:35
0
$\begingroup$

It is rather straight-forward to show that the language here is decidable.

The "solution provided"-attempt is not sound: Just because we can reduce the problem at hand to deciding non-emptyness of a PDA doesn't mean that we have to able to able to handle arbitrary PDAs here - after all, we are looking just at very specific instances here.

Whether A) or B) might be the correct answer is not even necessarily well-defined. The language at hand refers to an encoding of DFAs as finite words. If we care about decidability, using any reasonable encoding leads to the same answer anyway, and that's it. But if we are using more limited automata models, it will become important to be much clearer on how we encode stuff.

A DFA will not be able to do much meaningful stuff with encoded DFAs, even for smart encodings. On inputs having far more states than the processing DFA has, we just can't answer any "global" questions about its structure. However, we can easily cheat by including the answer in the encoding.

Making a PDA operate on a DFA is going to become more interesting. My hunch would be that the most obvious encodings of DFAs won't make this work. Cheating is still an option, but by going for a sufficiently redundant encoding of states/transitions we can probably built an encoding of DFAs which is not obviously cheating, and which enables a PDA to decide our language.

$\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.