HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Can we build a nondeterministic decider PDA using two PDAs accepting a language and its complement?

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
candeciderpdaslanguagepdatwoitsacceptingusingcomplement

Problem

When talking about turing machines, it can be easily shown that starting from two machines accepting $L$ and its complement $L^c$, one can build a machine which can fully decide if a word is inside $L$ or not.

But what about PDAs? starting from two different PDAs, one accepting $L$ and one accepting $L^c$ can we build another PDA, which accepts $L$, and only crashes or halts in non-final states (rejects) when $w\notin L$?

Solution

Yes, it is possible to do so. Although a given PDA may have $\varepsilon$ loops that can induce infinite computation, we can sidestep this by converting the PDA to a CFG, then back to a PDA (using the standard methods). The second PDA is guaranteed to halt on all inputs (this is not too hard to see if you know the conversion method - essentially you guarantee that either a non-terminal from the CFG is added to the stack, or a terminal is read from the input at each broad step and the nondeterminism takes care of the rest, or equivalently, CFGs can always be parsed).

So then we can take the PDA for $L$, apply this transition, and we get a machine that always halts, and only halts in an accept state if the input is in $L$.

Context

StackExchange Computer Science Q#37642, answer score: 3

Revisions (0)

No revisions yet.