# Pushdown automaton

In

automata theory , a**pushdown automaton**(PDA) is a finite automaton that can make use of a stack containing data.**Operation**Pushdown automata differ from normal finite state machines in two ways:

# They can use the top of the stack to decide which transition to take.

# They can manipulate the stack as part of performing a transition.Pushdown automata choose a transition by indexing a table by input signal, current state, and the top of the stack. Normal finite state machines just look at the input signal and the current state: they have no stack to work with. Pushdown automata add the stack as a parameter for choice. Given an input signal, current state, and a given symbol at the top of the stack, a transition path is chosen.

Pushdown automata can also manipulate the stack, as part of performing a transition. Normal finite state machines choose a new state, the result of following the transition. The manipulation can be to push a particular symbol to the top of the stack, or to pop off the top of the stack. The automaton can alternatively ignore the stack, and leave it as it is. The choice of manipulation (or no manipulation) is determined by the transition table.

Put together: Given an input signal, current state, and stack symbol, the automaton can follow a transition to another state, and optionally manipulate (push or pop) the stack.

The (underlying) finite automation is specifically a

nondeterministic finite state machine , giving what is technically known as a "nondeterministic pushdown automaton" (NPDA). If adeterministic finite state machine is used, then the result is adeterministic pushdown automaton (DPDA), a strictly weaker device. Nondeterminism means that there may be more than just one transition available to follow, given an input signal, state, and stack symbol.If we allow a finite automaton access to two stacks instead of just one, we obtain a more powerful device, equivalent in power to a

Turing machine . Alinear bounded automaton is a device which is more powerful than a pushdown automaton but less so than a Turing machine.Pushdown automata are equivalent to

context-free grammars : for every context-free grammar, there exists a pushdown automaton such that the language generated by the grammar is identical with the language generated by the automaton, and for every pushdown automaton there exists a context-free grammar such that the language generated by the automaton is identical with the language generated by the grammar.**Formal Definition**A PDA is formally defined as a 7-tuple:

$M=(Q,\; Sigma,\; Gamma,\; delta,\; q\_\{0\},\; Z,\; F)$where

*$,\; Q$ is a finite set of

*states*

*$,Sigma$ is a finite set which is called the*input alphabet*

*$,Gamma$ is a finite set which is called the*stack alphabet*

*$,delta$: $Q\; imes\; Sigma\_\{epsilon\}\; imes\; Gamma\_\{epsilon\}\; longrightarrow\; mathcal\{P\}(Q\; imes\; Gamma\_\{epsilon\}\; )$ is the*transition function*, where $mathcal\{P\}(S)$ denotes thepower set of $S$.

*$,q\_\{0\}in,\; Q$ is the*start state*

*$Z$ is the*initial stack symbol*

*$Fsubseteq\; Q$ is the set of*accepting states*

*$Gamma\_\{epsilon\}\; =\; Gammacup\{epsilon\}$

*$Sigma\_\{epsilon\}\; =\; Sigmacup\{epsilon\}$**"Computation Definition 1"**For any PDA, $M=(Q,\; Sigma,\; Gamma,\; delta,\; q\_\{0\},\; F)$, a computation path is an ordered

(n+1)-tuple, $(q\_\{0\},,\; q\_\{1\},\; ....,\; ,q\_\{n\})$, where $q\_\{i\}$$in$ Q, n$geq$ 0, which satisfies the following conditions:

(i) $(q\_\{i+1\},\; b\_\{i+1\})\; in\; delta\; (q\_\{i\},\; w\_\{i+1\},\; a\_\{i+1\})$ for i = 0, 1, 2,......, n-1, :where $w\_\{i+1\}in\; Sigma\_\{epsilon\},\; a\_\{i+1\},\; b\_\{i+1\}in\; Gamma\_\{epsilon\}$

(ii) $exists,\; s\_\{0\},,\; s\_\{1\},,s\_\{2\},,s\_\{3\},,cdots,,s\_\{n\},inGamma^\{*\}$ such that

:$s\_\{i\}\; =\; a\_\{i+1\}t\_\{i\},,s\_\{i+1\}\; =\; b\_\{i+1\}t\_\{i\},,\; t\_\{i\}inGamma^\{*\}$

Intuitively, a PDA, at any point in the computation process, faces multiple possibilities of whether to read a symbol from the top of the stack and replace it with another symbol, or read a symbol from the top of the stack and remove it without replacement, or not read any symbol from the stack but only push another symbol to it, or to do nothing. All these are governed by the simutaneous equations $s\_\{i\}\; =\; a\_\{i+1\}t\_\{i\}$ and $s\_\{i+1\}\; =\; b\_\{i+1\}t\_\{i\}$. $s\_\{i\}$ is called the stack content immediately before the $(i+1)^\{th\}$ transitional move and $a\_\{i+1\}$ is the symbol to be removed from the top of the stack. $s\_\{i+1\}$ is the stack content immediately after the $(i+1)^\{th\}$ transitional move and $b\_\{i+1\}$ is the symbol to be added to the stack during the $(i+1)^\{th\}$ transitional move.

Both $a\_\{i+1\}$ and $b\_\{i+1\}$ can be $epsilon$.

If $,a\_\{i+1\}\; eqepsilon$ and $,b\_\{i+1\}\; eqepsilon$, the PDA reads a symbol from the stack and replace it with another one.

If $,a\_\{i+1\}\; eqepsilon$ and $,b\_\{i+1\}\; =\; epsilon$, the PDA reads a symbol from the stack and remove it without replacement.

If $,a\_\{i+1\}\; =\; epsilon$ and $,b\_\{i+1\}\; eqepsilon$, the PDA simply adds a symbol to the stack.

If $,a\_\{i+1\}\; =\; epsilon$ and $,b\_\{i+1\}\; =\; epsilon$, the PDA leaves the stack unchanged.

Note that when n=0, the computation path is just the singleton (q

_{0}).**"Computation Definition 2"**For any input w = w

_{1}w_{2}...w_{m}, w_{i}$in,Sigma$, m$geq$0, M accepts w if $exists$ a computation path $(q\_\{0\},,\; q\_\{1\},\; ....,\; ,q\_\{n\})$ and a finite sequence r_{0}, r_{1}, r_{2},...r_{m}$in$ Q, m$leq$n, such that(i) For each i = 0, 1, 2,...m, r

_{i}is on the computation path. That is,: $exists$ f(i) where i$leq$f(i)$leq$n such that r_{i}= q_{f(i)}(ii) (q

_{f(i)+1}, b_{f(i)+1}) $in$ $delta$(r_{i}, w_{i+1}, a_{f(i)+1}) for each i = 0, 1, 2,...m-1.:where a_{f(i)+1}and b_{f(i)+1}are defined as in Computation Definition 1.(iii) (q

_{j+1}, b_{j+1}) $in$ $delta$(q_{j}, $epsilon$, a_{j+1}) if q_{j}$otin$ {r_{0}, r_{1},...r_{m}}:where a_{j+1}and b_{j+1}are defined as in Computation Definition 1.(iv) r

_{m}= q_{n}and r_{m}$in$ FNote that the above definitions do not provide a mechanism to test for an empty stack. To do so, one would need to write a special symbol on the stack at the beginning of every computation so that the PDA would recognize that the stack is effectively empty whenever it detects the special symbol. Formally, this is done by introducing the transition $delta$(q

_{0}, $epsilon,,epsilon)$ = {(q_{1}, $)} where $ is the special symbol.**Example**The following is the formal description of the PDA which recognizes the language nato $\{0^n1^n\; |\; n\; ge\; 0\; \}$:

$M=(Q,\; Sigma,\; Gamma,\; delta,\; q\_\{1\},\; F)$

Q = {q

_{1}, q_{2}, q_{3}, q_{4}}$Sigma$ = {0, 1}

$Gamma$ = {0, $}

F = {q

_{1}, q_{4}}$delta$(q

_{1}, $epsilon$, $epsilon$) = {(q_{2}, $), (q_{1}, $epsilon$)}$delta$(q

_{2}, 0, $epsilon$) = {(q_{2}, 0)}$delta$(q

_{2}, 1, 0) = {(q_{3}, $epsilon$)}$delta$(q

_{3}, 1, 0) = {(q_{3}, $epsilon$)}$delta$(q

_{3}, $epsilon$, $) = {(q_{4}, $epsilon$)}$delta$(q, w, a) = $Phi$ for any other values of state, input and stack symbols.

**Understanding the computation process**The following illustrates how the above PDA computes on different input strings.

(a) Input string = 0011: (i) write $delta$(q

_{1}, $epsilon$, $epsilon$) $ightarrow$ (q_{2}, $) to represent (q_{2}, $) $in$ $delta$(q_{1}, $epsilon$, $epsilon$):: s

_{0}= $epsilon$, s_{1}= $, t = $epsilon$, a = $epsilon$, b = $:: set r

_{0}= q_{2}: (ii) $delta$(r

_{0}, 0, $epsilon$) = $delta$(q_{2}, 0, $epsilon$) $ightarrow$ (q_{2}, 0):: s

_{1}= $, a = $epsilon$, t = $, b = 0, s_{2}= 0$:: set r

_{1}= q_{2}: (iii) $delta$(r

_{1}, 0, $epsilon$) = $delta$(q_{2}, 0, $epsilon$) $ightarrow$ (q_{2}, 0):: s

_{2}= 0$, a = $epsilon$, t = 0$, b = 0, s_{3}= 00$:: set r

_{2}= q_{2}: (iv) $delta$(r

_{2}, 1, 0) = $delta$(q_{2}, 1, 0) $ightarrow$ (q_{3}, $epsilon$):: s

_{3}= 00$, a = 0, t = 0$, b = $epsilon$, s_{4}= 0$:: set r

_{3}= q_{3}: (v) $delta$(r

_{3}, 1, 0) = $delta$(q_{3}, 1, 0) $ightarrow$ (q_{3}, $epsilon$):: s

_{4}= 0$, a = 0, t = $, b = $epsilon$, s_{5}= $: (vi) $delta$(q

_{3}, $epsilon$, $) $ightarrow$ (q_{4}, $epsilon$):: s

_{5}= $, a = $, t = $epsilon$, b = $epsilon$, s_{6}= $epsilon$:: set r

_{4}= q_{4}: Since q

_{4}is an accept state, 0011 is accepted.: In summary, computation path = (q

_{1}, q_{2}, q_{2}, q_{2}, q_{3}, q_{3}, q_{4}): and (r

_{0}, r_{1}, r_{2}, r_{3}, r_{4}) = (q_{2}, q_{2}, q_{2}, q_{3}, q_{4})(b) Input string = 001

: Computation moves (i), (ii), (iii), (iv) would have to be the same as in case (a), otherwise, the PDA would have come to a dead end before reaching (v).

: (v) $delta$(r

_{3}, $epsilon$, a) = $delta$(q_{3}, $epsilon$, a):: Since s

_{4}= 0$, either a = $epsilon$ or a = 0:: In either case, $delta$(q

_{3}, $epsilon$, a) = $Phi$:: Therefore, computation comes to an end at r

_{3}= q_{3}which is not an accept state. Therefore, 001 is rejected.(c) Input string = $epsilon$

: Set r

_{0}= q_{1}, r_{1}= q_{1}: $delta$(r

_{0}, $epsilon$, $epsilon$) $ightarrow$ (q_{1}, $epsilon$): Since q

_{1}is an accept state, $epsilon$ is accepted.**Generalized Pushdown Automaton (GPDA)**A GPDA is a PDA which writes an entire string to the stack or removes an entire string from the stack in one step.

A GPDA is formally defined as a 6-tuple $M=(Q,\; Sigma,\; Gamma,\; delta,\; q\_\{0\},\; F)$

: where Q, $Sigma,$, $Gamma,$, q

_{0}and F are defined the same way as a PDA.:$,delta$: $Q\; imes\; Sigma\_\{epsilon\}\; imes\; Gamma^\{*\}\; longrightarrow\; P(\; Q\; imes\; Gamma^\{*\}\; )$ is the transition function.

Computation rules for a GPDA are the same as a PDA except that the a

_{i+1}'s and b_{i+1}'s are now strings intead of symbols.GPDA's and PDA's are equivalent in that if a language is recognized by a PDA, it is also recognized by a GPDA and vice versa.

One can formulate an analytic proof for the equivalence of GPDA's and PDA's using the following simulation:

Let $delta$(q

_{1}, w, x_{1}x_{2}...x_{m}) $longrightarrow$ (q_{2}, y_{1}y_{2}...y_{n}) be a transition of the GPDAwhere q

_{1}, q_{2}$in$ Q, w $inSigma\_\{epsilon\},$, x_{1}x_{2}...x_{m}$inGamma^\{*\}$, m$geq$0, y_{1}y_{2}...y_{n}$inGamma^\{*\}$, n$geq$0.Construct the following transitions for the PDA:

::$delta^\{\text{'}\}$(q

_{1}, w, x_{1}) $longrightarrow$ (p_{1}, $epsilon$)::$delta^\{\text{'}\}$(p

_{1}, $epsilon$, x_{2}) $longrightarrow$ (p_{2}, $epsilon$)::::$vdots$

::$delta^\{\text{'}\}$(p

_{m-1}, $epsilon$, x_{m}) $longrightarrow$ (p_{m}, $epsilon$)::$delta^\{\text{'}\}$(p

_{m}, $epsilon$, $epsilon$ ) $longrightarrow$ (p_{m+1}, y_{n})::$delta^\{\text{'}\}$(p

_{m+1}, $epsilon$, $epsilon$ ) $longrightarrow$ (p_{m+2}, y_{n-1})::::$vdots$

::$delta^\{\text{'}\}$(p

_{m+n-1}, $epsilon$, $epsilon$ ) $longrightarrow$ (q_{2}, y_{1})**ee also***

Stack machine

*Context-free grammar

*Finite automaton

*Nondeterministic finite state machine **External links*** [

*http://planetmath.org/encyclopedia/PushdownAutomaton.html non-deterministic pushdown automaton,*] on Planet Math.

* [*http://www.jflap.org JFLAP*] , simulator for several types of automata including nondeterministic pushdown automata**References*** Section 2.2: Pushdown Automata, pp.101–114.

*Wikimedia Foundation.
2010.*

### Look at other dictionaries:

**pushdown automaton**— noun An automaton with finitely many states that also can use one unbounded stack of memory; the automaton may only push, pop, or read the top of the stack. Abbreviation: PDA … Wiktionary**Deterministic pushdown automaton**— In automata theory, a pushdown automaton is a finite automaton with an additional stack of symbols; its transitions can take the top symbol on the stack and depend on its value, and they can add new top symbols to the stack. A deterministic… … Wikipedia**Embedded pushdown automaton**— An embedded pushdown automaton or EPDA is a computational model that parse languages in the tree adjoining grammar (TAG). It is similar to the context free grammar parsing pushdown automaton, except that instead of using a stack (data structure)… … Wikipedia**Counter automaton**— In computer science, a counter automaton is a Pushdown automaton with only two symbols, A and the initial symbol in (the finite set of stack symbols). This class of automata can recognize a subset of Context free languages, for instance the… … Wikipedia**Nested stack automaton**— In automata theory, a nested stack automaton is a finite automaton that can make use of a stack containing data which can be additional stacks.[1] A nested stack automaton may read its stack, in addition to pushing or popping it. A nested stack… … Wikipedia**Deterministic automaton**— is a concept of automata theory in which the outcome of a transition from one state to another given a certain input can be predicted for every occurrence. A common deterministic automaton is a deterministic finite state machine (sometimes… … Wikipedia**Nested word**— In computer science, more specifically in automata and formal language theory, nested words are a concept proposed by Alur and Madhusudan as a joint generalization of words, as traditionally used for modelling linearly ordered structures, and of… … Wikipedia**Chomsky hierarchy**— Within the field of computer science, specifically in the area of formal languages, the Chomsky hierarchy (occasionally referred to as Chomsky–Schützenberger hierarchy) is a containment hierarchy of classes of formal grammars. This hierarchy of… … Wikipedia**Computation history**— In computer science, a computation history is a sequence of steps taken by an abstract machine in the process of computing its result. Computation histories are frequently used in proofs about the capabilities of certain machines, and… … Wikipedia**Turing machine**— For the test of artificial intelligence, see Turing test. For the instrumental rock band, see Turing Machine (band). Turing machine(s) Machina Universal Turing machine Alternating Turing machine Quantum Turing machine Read only Turing machine… … Wikipedia