In automata theory, a pushdown automaton (PDA) is a finite automaton that can make use of a stack containing data. In Computer science, a stack is an Abstract data type and Data structure based on the principle of Last In First Out (LIFO
Contents |
Pushdown automata differ from normal finite state machines in two ways:
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). In the Theory of computation, a nondeterministic finite state machine or nondeterministic finite automaton (NFA is a Finite state machine where for each If a deterministic finite state machine is used, then the result is a deterministic pushdown automaton (DPDA), a strictly weaker device. In the Theory of computation, a deterministic finite state machine (also known as deterministic finite state automaton (DFSA or deterministic finite 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 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. Turing machines are basic abstract symbol-manipulating devices which despite their simplicity can be adapted to simulate the logic of any Computer Algorithm A linear bounded automaton is a device which is more powerful than a pushdown automaton but less so than a Turing machine. A linear bounded automaton (plural linear bounded automata, abbreviated LBA) is a restricted form of a Non-deterministic 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. In Formal language theory, a context-free grammar ( CFG) is a grammar in which every production rule is of the form V &rarr
A PDA is formally defined as a 7-tuple:
where
is a finite set of states
is a finite set which is called the input alphabet
is a finite set which is called the stack alphabet
:
is the transition function, where
denotes the power set of S. In Mathematics, given a set S, the power set (or powerset) of S, written \mathcal{P}(S P ( S)
is the start state
is the initial stack symbol
is the set of accepting states

Computation Definition 1
For any PDA,
, a computation path is an ordered
(n+1)-tuple,
, where qi
Q, n
0, which satisfies the following conditions:
(i)
for i = 0, 1, 2,. . . . . . , n-1,

(ii)
such that

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 si = ai + 1ti and si + 1 = bi + 1ti. si is called the stack content immediately before the (i + 1)th transitional move and ai + 1 is the symbol to be removed from the top of the stack. si + 1 is the stack content immediately after the (i + 1)th transitional move and bi + 1 is the symbol to be added to the stack during the (i + 1)th transitional move.
Both ai + 1 and bi + 1 can be ε.
If
and
, the PDA reads a symbol from the stack and replace it with another one.
If
and
, the PDA reads a symbol from the stack and remove it without replacement.
If
and
, the PDA simply adds a symbol to the stack.
If
and
, the PDA leaves the stack unchanged.
Note that when n=0, the computation path is just the singleton (q0).
Computation Definition 2
For any input w = w1w2. . . wm, wi
, m
0, M accepts w if
a computation path
and a finite sequence r0, r1, r2,. . . rm
Q, m
n, such that
(i) For each i = 0, 1, 2,. . . m, ri is on the computation path. That is,
f(i) where i
f(i)
n such that ri = qf(i)(ii) (qf(i)+1, bf(i)+1)
δ(ri, wi+1, af(i)+1) for each i = 0, 1, 2,. . . m-1.
(iii) (qj+1, bj+1)
δ(qj, ε, aj+1) if qj
{r0, r1,. . . rm}
(iv) rm = qn and rm
F
Note 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 δ(q0,
= {(q1, $)} where $ is the special symbol.
The following is the formal description of the PDA which recognizes the language
:

Q = {q1, q2, q3, q4}
Σ = {0, 1}
Γ = {0, $}
F = {q1, q4}
δ(q1, ε, ε) = {(q2, $), (q1, ε)}
δ(q2, 0, ε) = {(q2, 0)}
δ(q2, 1, 0) = {(q3, ε)}
δ(q3, 1, 0) = {(q3, ε)}
δ(q3, ε, $) = {(q4, ε)}
δ(q, w, a) = Φ for any other values of state, input and stack symbols.
The following illustrates how the above PDA computes on different input strings.
(a) Input string = 0011
(q2, $) to represent (q2, $)
δ(q1, ε, ε)
(q2, 0)
(q2, 0)
(q3, ε)
(q3, ε)
(q4, ε)(b) Input string = 001
(c) Input string = ε
(q1, ε)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 
,
, q0 and F are defined the same way as a PDA.
:
is the transition function. Computation rules for a GPDA are the same as a PDA except that the ai+1's and bi+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 δ(q1, w, x1x2. . . xm)
(q2, y1y2. . . yn) be a transition of the GPDA
where q1, q2
Q, w
, x1x2. . . xm
, m
0, y1y2. . . yn
, n
0.
Construct the following transitions for the PDA:
(p1, ε)
(p2, ε)
(pm, ε)
(pm+1, yn)
(pm+2, yn-1)
(q2, y1)| Chomsky hierarchy |
Grammars | Languages | Minimal automaton |
|---|---|---|---|
| Type-0 | Unrestricted | Recursively enumerable | Turing machine |
| n/a | (no common name) | Recursive | Decider |
| Type-1 | Context-sensitive | Context-sensitive | Linear-bounded |
| n/a | Indexed | Indexed | Nested stack |
| n/a | Tree-adjoining etc. A formal language is a set of words, ie finite strings of letters, or symbols. In Formal semantics, Computer science and Linguistics, a formal grammar (also called formation rules) is a precise description of a Formal Within the field of Computer science, specifically in the area of Formal languages, the Chomsky hierarchy (occasionally referred to as Chomsky–Schützenberger In Formal semantics, Computer science and Linguistics, a formal grammar (also called formation rules) is a precise description of a Formal A formal language is a set of words, ie finite strings of letters, or symbols. In Formal language theory an unrestricted grammar is a Formal grammar on which no restrictions are made on the left and right sides of the grammar's productions In Mathematics, Logic and Computer science, a recursively enumerable language is a type of Formal language which is also called partially Turing machines are basic abstract symbol-manipulating devices which despite their simplicity can be adapted to simulate the logic of any Computer Algorithm A recursive language in Mathematics, Logic and Computer science, is a type of Formal language which is also called recursive, A context-sensitive grammar (CSG is a Formal grammar in which the left-hand sides and right-hand sides of any Production rules may be surrounded by a context of In Theoretical computer science, a context-sensitive language is a Formal language that can be defined by a Context-sensitive grammar. A linear bounded automaton (plural linear bounded automata, abbreviated LBA) is a restricted form of a Non-deterministic Turing machine. An indexed grammar is a Formal grammar which describes Indexed languages They have three disjoint sets of symbols the usual terminals and nonterminals and the indices Indexed languages are a class of Formal languages discovered by Alfred Aho; they are described by Indexed grammars and can be recognized by Nested stack 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 Tree-adjoining grammar (TAG is a grammar formalism defined by Aravind Joshi. | (Mildly context-sensitive) | Embedded pushdown |
| Type-2 | Context-free | Context-free | Nondeterministic pushdown |
| n/a | Deterministic context-free | Deterministic context-free | Deterministic pushdown |
| Type-3 | Regular | Regular | Finite |
| n/a | Star-free | Counter-Free | |
| Each category of languages or grammars is a proper subset of the category directly above it, and any automaton in each category has an equivalent automaton in the category directly above it. In Formal grammar theory mildly context-sensitive languages are a class of Formal languages which can be efficiently parsed but still possess enough context An embedded pushdown automaton or EPDA is a Computational model that parse languages in the Tree-adjoining grammar (TAG In Formal language theory, a context-free grammar ( CFG) is a grammar in which every production rule is of the form V &rarr In Formal language theory, a context-free language is a language generated by some Context-free grammar. In Formal grammar theory the deterministic context-free grammars (DCFGs are a Proper subset of the Context-free grammars. A deterministic context-free language is a Formal language which is defined by a Deterministic context-free grammar. 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 Strictly regular grammars In Computer science, a right regular grammar (also called right linear grammar) is a Formal grammar ( N, A Regular language is said to be star-free if it can be described by a Regular expression constructed from the letters of the alphabet, the Empty set |
|||