# Are DCFLs closed under reversal?

According to this chart, DCFLs are closed under reversal.

However, I am not convinced as the intuitive proof (reversing the arrows of the controlling finite state machine and switching the pushes and pops) for this seems to depend on non-determinism in choosing the null transition to take from the initial state (since the new initial state would contain a null transition to all the old final states).

This would make the "reverse PDA" of a DPDA non-deterministic whenever there is more than a single final state in the original DPDA.

What is the fallacy in my argument? Or is there another way to go about proving this?

• Please let me know if my StackOverflow answer requires any additional explanation. The problem with your proof attempt is this: the PDA you construct isn't the only PDA for the language it accepts. There might be others, possibly arrived at differently, which are deterministic. In particular, DCFLs can be accepted by PDAs that aren't deterministic. Oct 7 '14 at 14:09
• Right, which is why I realize this is not much of a "proof" at all, it would only have meaning if the result was always a DCFL, which it is not. I guess I was just trying to prove it using the same method as is used for Regular languages and failed. Thanks for the counter example! Oct 7 '14 at 14:21
• Consider $L={b^n c^n} \cap {a b^2n c^n}$ Jan 15 '17 at 11:01
• That table also says recursive languages are closed $\lambda$-free substitution...is that correct?
– anir
Dec 25 '17 at 20:59

I looked up Hopcroft and Ullman 1979 and it say on page 281 that it is not closed under reversal. But I found no proof in my very fast look at the relevant chapter.

Searching the web does also give a negative answer, with counter example, on stackoverflow by a member of CS (notation adapted):

$$(a+b+c)^*WcW^R$$, where $$W \in (a+b)^+$$; this is non-deterministic because you don't know where the $$WcW$$ bit starts.

$$W^RcW(a+b+c)^*$$, where $$W \in (a+b)^+$$; this is deterministic because you can write a deterministic PDA to accept simple palindromes of the form $$W^RcW$$ and modify the accepting state to loop to itself on any of $$a$$, $$b$$ and $$c$$.

The trick here is that PDAs have to read input from left to right.

• This is absurd. Patrick87 provided the examples, @Raphael did half the editing work, and I get the rep. Then, we get so little for real work ... :) Oct 7 '14 at 14:40
• Think of it as a "finder's fee" :) I'm just mystified the system actually works well enough that you found that old post of mine. The system works! Hail SE! Oct 7 '14 at 16:56
• Did H&U overlook reversal for DCFL? They mention non-closure under union, concatenation, Kleene, morphism in Thm 10.5 see Exercise 10.4 (starred but with a solution). However, they note $\{ 0^i1^i2^j\mid i,j\} \cup \{ 0^i1^j2^j\mid i,j\}$ is not DCFL, so neither is $K = \{ 0^i1^i2^ja \mid i,j\} \cup \{ 0^i1^j2^jb\mid i,j\}$ by closure of DCFL under quotient with regular set, Thm 10.2. But the reversal of $K$ is a DCFL, the 'markers' $a$ and $b$ give away the information where to use the pushdown. [ Perhaps @babou can add this if he likes; he is the one collecting the reps here :) ] Oct 7 '14 at 22:31