Unit 4 - Pda-Basics
Unit 4 - Pda-Basics
NOTES
Pushdown Automata: Definition Formal Definition of Pushdown Automata, A Graphical Notation for PDA‟s,
Instantaneous Descriptions of a PDA,
Languages of PDA: Acceptance by Final State, Acceptance by Empty Stack, From Empty Stack to Final State, From
Final State to Empty Stack
Equivalence of PDA‟s and CFG‟s: From Grammars to Pushdown Automata, From PDA‟s to Grammars
Deterministic Pushdown Automata: Definition of a Deterministic PDA, Regular Languages and Deterministic
PDA‟s, DPDA‟s and Context-Free Languages, DPDA‟s and Ambiguous Grammars
Properties of Context-Free Languages: Normal Forms for Context-Free Grammars, The Pumping Lemma for
Context-Free Languages, Closure Properties of Context-Free Languages, Decision Properties of CFL‟s
It is observed that FA have limited capability. (in the sense that the class of languages accepted or
characterized by them is small). This is due to the "finite memory" (number of states) and "no external memory"
involved with them. A PDA is simply an NFA augmented with an "external stack memory". The addition of a
stack provides the PDA with a last-in, first-out memory management cpapability. This "Stack" or "pushdown
store" can be used to record a potentially unbounded information. It is due to this memory management
capability with the help of the stack that a PDA can overcome the memory limitations that prevents a FA to
accept many interesting languages like . Although, a PDA can store an unbounded amount of
information on the stack, its access to the information on the stack is limited. It can push an element onto the
top of the stack and pop off an element from the top of the stack. To read down into the stack the top elements
must be popped off and are lost. Due to this limited access to the information on the stack, a PDA still has
some limitations and cannot accept some other interesting languages.
As shown in figure, a PDA has three components: an input tape with read only head, a finite control and a
pushdown store.
The input head is read-only and may only move from left to right, one symbol (or cell) at a time. In each step,
the PDA pops the top symbol off the stack; based on this symbol, the input symbol it is currently reading, and
its present state, it can push a sequence of symbols onto the stack, move its read-only head one cell (or
symbol) to the right, and enter a new state, as defined by the transition rules of the PDA.
PDA are nondeterministic, by default. That is, - transitions are also allowed in which the PDA can pop and
push, and change state without reading the next input symbol or moving its read-only head. Besides this, there
may be multiple options for possible next moves.
go to state
pop z off the stack
push onto the stack (where ) (The usual convention is that if , then
go to state
pop z off the stack
Final states are indicated by double circles and the start state is indicated by an arrow to it from nowhere.
A configuration or an instantaneous description (ID) of PDA at any moment during its computation is an
element of describing the current state, the portion of the input remaining to be read (i.e.
under and to the right of the read head), and the current stack contents. Only these three elements can
affect the computation from that point on and, hence, are parts of the ID.
The start or inital configuartion (or ID) on input is . That is, the PDA always starts in its
start state, with its read head pointing to the leftmost input symbol and the stack containing only the
start/initial stack symbol, .
The "next move relation" one figure describes how the PDA can move from one configuration to another
in one step.
Formally,
iff
'a' may be or an input symbol.
Let I, J, K be IDs of a PDA. We define we write I K, if ID I can become K after exactly i moves. The
IK
I J if such that I J.
That is, is the reflexive, transitive closure of . We say that I J if the ID J follows from the ID I in
zero or more moves.
Consider the PDA . Informally, the PDA M is said to accept its input by final
state if it enters any final state in zero or more moves after reading its entire input, starting in the start
configuration on input .
2. Acceptance by empty stack (or Null stack) : The PDA M accepts its input by empty stack if starting in the
start configuration on input , it ever empties the stack w/o pushing anything back on after reading the entire
input. Formally, we define N(M), the language accepted by empty stack, to be
{ | for some }
Note that the set of final states, F is irrelevant in this case and we usually let the F to be the empty set i.e. F =
Q.
Informally, whenever the PDA M sees an input a in the start state with the start symbol z on the top of the
stack it pushes a onto the stack and changes state to . (to remember that it has seen the first 'a'). On state
if it sees anymore a, it simply pushes it onto the stack. Note that when M is on state , the symbol on the
top of the stack can only be a. On state if it sees the first b with a on the top of the stack, then it needs to
start comparison of numbers of a's and b's, since all the a's at the begining of the input have already been
pushed onto the stack. It start this process by popping off the a from the top of the stack and enters in state q3
(to remember that the comparison process has begun). On state , it expects only b's in the input (if it sees
any more a in the input thus the input will not be in the proper form of anbn). Hence there is no more on input a
when it is in state . On state it pops off an a from the top of the stack for every b in the input. When it
sees the last b on state q3 (i.e. when the input is exaushted), then the last a from the stack will be popped off
and the start symbol z is exposed. This is the only possible case when the input (i.e. on -input ) the PDA M
Let the input be aabb. we start with the start configuration and proceed to the subsequent IDs using the
transition function defined
( using transition 1 )
( using transition 2 )
( using transition 3 )
( using transition 4 ), ( using transition 5 ) , is final state. Hence , accept. So the
string aabb is rightly accepted by M
we can show the computation of the PDA on a given input using the IDs and next move relations. For example,
following are the computation on two input strings.
Hence the PDA gets stuck and the string aabab is not accepted.
Example 2 : We give an example of a PDA M that accepts the set of balanced strings of parentheses [] by
empty stack.
The PDA M is given below.
where is defined as
Informally, whenever it sees a [, it will push the ] onto the stack. (first two transitions), and whenever it sees a ]
and the top of the stack symbol is [, it will pop the symbol [ off the stack. (The third transition). The fourth
transition is used when the input is exhausted in order to pop z off the stack ( to empty the stack) and accept.
Note that there is only one state and no final state. The following is a sequence of configurations leading to the
acceptance of the string [ [ ] [ ] ] [ ].
It turns out that the two definitions of acceptance of a language by a PDA - accpetance by final state and empty
stack- are equivalent in the sense that if a language can be accepted by empty stack by some PDA, it can also
be accepted by final state by some other PDA and vice versa. Hence it doesn't matter which one we use, since