Introduction of Pushdown Automata

We have already discussed finite automata. But finite automata can be used to accept only regular languages.
Pushdown Automata is a finite automata with extra memory called stack which helps Pushdown automata to recognize Context Free Languages.
A Pushdown Automata (PDA) can be defined as :

·         Q is the set of states

·         ∑is the set of input symbols

·         Γ is the set of pushdown symbols (which can be pushed and popped from stack)

·         q0 is the initial state

·         Z is the initial pushdown symbol (which is initially present in stack)

·         F is the set of final states

·         δ is a transition function which maps Q x {Σ ∪ ∈} x Γ into Q x Γ*. In a given state, PDA will read input symbol and stack symbol (top of the stack) and move to a new state and change the symbol of stack.

Instantaneous Description (ID)
Instantaneous Description (ID) is an informal notation of how a PDA “computes” a input string and make a decision that string is accepted or rejected.

A ID is a triple (q, w, α), where:
1. q is the current state.
2. w is the remaining input.
3.α is the stack contents, top at the left.

Turnstile notation
⊢ sign is called a “turnstile notation” and represents
one move.
⊢* sign represents a sequence of moves.
Eg- (p, b, T) ⊢ (q, w, α)
This implies that while taking a transition from state p to state q, the input symbol ‘b’ is consumed, and the top of the stack ‘T’ is replaced by a new string ‘α’

Example : Define the pushdown automata for language {anbn | n > 0}
Solution : M = where Q = { q0, q1 } and Σ = { a, b } and Γ = { A, Z } and &delta is given by :

&delta( q0, a, Z ) = { ( q0, AZ ) }
&delta( q0, a, A) = { ( q0, AA ) }
&delta( q0, b, A) = { ( q1, ∈) }
&delta( q1, b, A) = { ( q1, ∈) }
&delta( q1, ∈, Z) = { ( q1, ∈) }
Let us see how this automata works for aaabbb.

Explanation : Initially, the state of automata is q0 and symbol on stack is Z and the input is aaabbb as shown in row 1. On reading ‘a’ (shown in bold in row 2), the state will remain q0 and it will push symbol A on stack. On next ‘a’ (shown in row 3), it will push another symbol A on stack. After reading 3 a’s, the stack will be AAAZ with A on the top. After reading ‘b’ (as shown in row 5), it will pop A and move to state q1 and stack will be AAZ. When all b’s are read, the state will be q1 and stack will be Z. In row 8, on input symbol ‘∈’ and Z on stack, it will pop Z and stack will be empty. This type of acceptance is known as acceptance by empty stack.
Note :

·         The above pushdown automaton is deterministic in nature because there is only one move from a state on an input symbol and stack symbol.

·         The non-deterministic pushdown automata can have more than one move from a state on an input symbol and stack symbol.

·         It is not always possible to convert non-deterministic pushdown automata to deterministic pushdown automata.

·         Expressive Power of non-deterministic PDA is more as compared to expressive deterministic PDA as some languages which are accepted by NPDA but not by deterministic PDA which will be discussed in next article.

·         The push down automata can either be implemented using accepetance by empty stack or accepetance by final state and one can be converted to another.

Question : Which of the following pairs have DIFFERENT expressive power?

A. Deterministic finite automata(DFA) and Non-deterministic finite automata(NFA)
B. Deterministic push down automata(DPDA)and Non-deterministic push down automata(NPDA)
C. Deterministic single-tape Turing machine and Non-deterministic single-tape Turing machine
D. Single-tape Turing machine and multi-tape Turing machine

Solution : Every NFA can be converted into DFA. So, there expressive power is same. As discussed above, every NPDA can’t be converted to DPDA. So, the power of NPDA and DPDA is not same. Hence option (B) is correct.

Related Posts

© 2024 Software Engineering - Theme by WPEnjoy · Powered by WordPress