All Topics  
Pushdown automaton

 

 

 

 

 

Pushdown automaton


 
 


In automata theoryAutomata theory Summary

In theoretical computer science, automata theory is the study of abstract machines and problems they are able to solve....
, a pushdown automaton (PDA) is a finite automatonFinite state machine

A finite state machine or finite automaton is a model of behavior composed of states, transitions and actions....
 that can make use of a stackStack (data structure)

In computer science, a stack is a temporary abstract data type and data structure based on the principle of Last In First ...
 containing data.

Operation


Pushdown automata differ from normal finite state machines in two ways:
  1. They can use the top of the stack to decide which transition to take.
  2. 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 machineNondeterministic finite state machine Summary

In the theory of computation, a nondeterministic finite state machine or nondeterministic finite automaton is a finite...
, giving what is technically known as a "nondeterministic pushdown automaton" (NPDA). If a deterministic finite state machineDeterministic finite state machine

In the theory of computation, a deterministic finite state machine or deterministic finite automaton is a finite state...
 is used, then the result is a deterministic pushdown automatonDeterministic pushdown automaton

In automata theory, a deterministic pushdown automaton is a deterministic finite automaton with an additional stack of symbo...
 (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 machineTuring machine

Turing machines are extremely basic symbol-manipulating devices which despite their simplicity can be adapted to simulate ...
. A linear bounded automatonLinear bounded automaton

A linear bounded automaton is a restricted form of a non-deterministic Turing machine....
 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.

Example


The following is the formal description of the PDA which recognizes the language :

Q =

=

=

F =

(q1, , ) =

(q2, 0, ) =

(q2, 1, 0) =

(q3, 1, 0) =

(q3, , $) =

(q, w, a) = 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 (q1, , ) (q2, $) to represent (q2, $) (q1, , )


s0 = , s1 = $, t = , a = , b = $

set r0 = q2

(ii) (r0, 0, ) = (q2, 0, ) (q2, 0)


s1 = $, a = , t = $, b = 0, s2 = 0$

set r1 = q2

(iii) (r1, 0, ) = (q2, 0, ) (q2, 0)


s2 = 0$, a = , t = 0$, b = 0, s3 = 00$

set r2 = q2

(iv) (r2, 1, 0) = (q2, 1, 0) (q3, )


s3 = 00$, a = 0, t = 0$, b = , s4 = 0$

set r3 = q3

(v) (r3, 1, 0) = (q3, 1, 0) (q3, )


s4 = 0$, a = 0, t = $, b = , s5 = $

(vi) (q3, , $) (q4, )


s5 = $, a = $, t = , b = , s6 =

set r4 = q4

Since q4 is an accept state, 0011 is accepted.


In summary, computation path = (q1, q2, q2, q2, q3, q3, q4)


and (r0, r1, r2, r3, r4) = (q2, q2, q2, q3, q4)


(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) (r3, , a) = (q3, , a)


Since s4 = 0$, either a = or a = 0

In either case, (q3, , a) =

Therefore, computation comes to an end at r3 = q3 which is not an accept state. Therefore, 001 is rejected.

(c) Input string =

Set r0 = q1, r1 = q1


(r0, , ) (q1, )


Since q1 is an accept state, 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

where Q, , , 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 , m0, y1y2...yn , n0.

Construct the following transitions for the PDA:

(p1, )

(p2, )

(pm, )

(pm+1, yn)

(pm+2, yn-1)

(q2, y1)

See also

  • Stack machineStack machine

    In computer science, a stack machine is a model of computation in which the computer's memory takes the form of one or more ...
  • context-free grammarContext-free grammar

    In linguistics and computer science, a context-free grammar is a formal grammar in which every production rule is of the fo...
  • finite automaton

External links

  • on Planet Math.
  • , simulator for several types of automata including nondeterministic pushdown automata