Open In App

Introduction of Pushdown Automata

Last Updated : 16 Oct, 2024
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

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. This article describes pushdown automata in detail.

Pushdown Automata

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 the stack)
  • q0 is the initial state
  • Z is the initial pushdown symbol (which is initially present in the stack)
  • F is the set of final states
  • δ is a transition function that maps Q x {Σ ∪ ∈} x Γ into Q x Γ*. In a given state, the PDA will read the input symbol and stack symbol (top of the stack) move to a new state, and change the symbol of the stack.

Instantaneous Description (ID) 

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

An 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 δ is given by : 

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

PDA Transition Table

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. 

Push Down Automata State Diagram:

PDA Example

State Diagram for above Push Down Automata

  
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.
  • The expressive power of non-deterministic PDA is more as compared to expressive deterministic PDA as some languages are accepted by NPDA but not by deterministic PDA which will be discussed in the next article.
  • The pushdown automata can either be implemented using acceptance by empty stack or acceptance 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 the 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 the same. Hence option (B) is correct. 

Conclusion

In conclusion, Pushdown Automata (PDA) are an important concept in computer science and formal language theory. They extend the capabilities of finite automata by using a stack, which allows them to handle a broader range of languages, particularly context-free languages. PDAs can recognize patterns and structures that simpler models cannot, making them essential for parsing and processing languages in compilers and other applications. Understanding PDAs helps in grasping how more complex systems operate and enhances our knowledge of computation and algorithms.

Frequently Asked Questions on Introduction of Pushdown Automata – FAQs

How does a PDA work?

A PDA reads an input string one symbol at a time. It can push symbols onto a stack or pop symbols off the stack based on the rules defined for the automaton.

What is the purpose of the stack in a PDA?

The stack allows the PDA to remember information from previous input symbols. This makes it capable of handling more complex languages than finite automata, which don’t have a stack.

What types of languages can a PDA recognize?

PDAs can recognize context-free languages, which include many programming languages and nested structures, like parentheses in expressions.


Next Article

Similar Reads

Article Tags :
three90RightbarBannerImg