...

/

Pushdown Automata and Determinism

Pushdown Automata and Determinism

Learn about the formal definition of deterministic PDA.

We'll cover the following...

Let’s consider the following PDA, which accepts the language L={nb(w)=na(w)+1w(a+b)}L = \{n_b(w) = n_a(w) + 1\mid w \in (a+b)^*\}.

Press + to interact
PDA accepting the language L
PDA accepting the language L

In the diagram above, we initiated the stack with an XX, which effectively increments the count of bb’s in a string accepted by the PDA. Using such a stack “start symbol” can be helpful for other purposes as well.

The following PDA for Leq={na(w)=nb(w)w(a+b)}L_{eq} = \{n_a(w) = n_b(w) \:|\: w \in (a+b)^* \} uses a start symbol, SS, to know when the stack has “hit bottom” (i.e., when SS is at the top of the stack, it is the only symbol on the stack). Furthermore, whenever an SS is on the top of the stack in this machine, it means that an equal number of aa’s and bb’s have been encountered so far up to that point.

Press + to interact
Accepts Leq using a stack start symbol/bottom marker
Accepts Leq using a stack start symbol/bottom marker

Compare the transitions in state q1q_1 above with those from the first figure for language LL. The following transitions have replaced a,λXa,\lambda\to X from the PDA for the language LL:

Since SS is always on the bottom of the stack in this machine, we know that when it is at the top of the stack, nothing else is on the stack, so we can push an XX to account for the symbol aa just read. The transition a,YXYa,Y \to XY is omitted because, like before, XX's and YY's do not appear on the stack simultaneously in this PDA. The two replacement transitions mentioned above are equivalent to a,λXa,\lambda\to X in that their net effect is to add an XX to the stack when reading an ...

Access this course and 1400+ top-rated courses and projects.