3

I read that acceptance of languages by DPDA using empty stack is a subset of languages accepted by DPDA using final state because of prefix property. I understood this statement by taking an example of regular language a*. Here if we use stack then we can't decide when to pop the symbols from stack. If we pop all the symbols(prefix belonging to language) then stack will become empty and we can't process the input further(left over input). So we can't accept a* using dpda by stack.

I read another statement that NPDA using stack can accept all languages which NPDA using final state will accept. Here we can have many copies of machine running simultaneously and we can non deterministically check if the input is accepted or not. But what if prefix like aa of input aaaaa is accepted by one of the machine ? Will all the machines stop and say yes (that is we can't proceed with the input further) or will some of the machines still continue with the remaining input even if one of them halts?

Zephyr
  • 1,003
  • 3
  • 17
  • 34

1 Answers1

3

A nondeterministic PDA for any triple $\langle q,a,A\rangle$ may have more than one moves/transitions and so the NPDA may have different computation paths/branches depending on what choice the NPDA makes (see this definition for details). So, for any input $x$ if at least one of these sequence of choices leads to an accepting configuration then we say the NDPA accepts $x$. In this case whether or not other possible computation branches lead to an accepting configuration does not matter. At least one accepting path is enough to accept the input $x$.

Now, regarding the question in your comment:

Now what if that one branch is the one which accepts the prefix of the language ? What happens to other branches?

You presumably mean "the prefix of a string", in particular, say $x=aaaaa$ and its prefix $y=aa$. For a NPDA $x$ and $y$ are two different inputs, the NPDA may accept or reject both strings or accept only one of them. This absolutely has nothing to do with the prefix property of a language.


Example: a PDA accepting the set of odd length $a$s and and empty string. The basic idea is to keep track of how many $a$s are read, even or odd number of $a$s, using the stack symbols.

$\delta(q,a, Z_0) = (q,Z_{odd})$
$\delta(q,a, Z_{odd}) = (q,Z_{even})$
$\delta(q,a, Z_{even}) = (q,Z_{odd})$
$\delta(q,\epsilon, Z_{odd}) = (q_1,\epsilon)$
$\delta(q_1,\epsilon, Z_0) = (q_1,\epsilon)$
$\delta(q_1,\epsilon, Z_{even}) = (q_1,\epsilon)$
$\delta(q_1,\epsilon, Z_{odd}) = (q_1,\epsilon)$

This PDA is not deterministic due to the following two transitions:

$\delta(q,a, Z_{odd}) = (q,Z_{even})$
$\delta(q,\epsilon, Z_{odd}) = (q_1,\epsilon)$

In other words it has two choices when it is in the state $q$ and the topmost stack symbol is $Z_{odd}$.

Now suppose this PDA reads $aaaaa$. After reading the third $a$ it may enter the state $\delta(q,\epsilon, Z_{odd}) = (q_1,\epsilon)$ which will empty the stack but the rest of the input are not read, and so this branch does not accept the input. However, the PDA has another choice, namely $\delta(q,a, Z_{odd}) = (q,Z_{even})$ which leads to accepting the $aaaaa$.

fade2black
  • 9,905
  • 2
  • 26
  • 36