Skip to content
PostTheory Of Computation / Lecture

07-TOC-PDA

2024-11-13
Back to Blog

TOC-PDA ​

To access the infinite memory space, an NFA is upgraded by a stack. A stack has these basic operations.

  • Push
  • Pop

The computational model combines a finite state machine and a stack is called pushdown automata (PDA).

Pushdown automata

PDA ​

A pushdown automaton is a 6-tuple (Q,Σ,Γ,δ,q0,F), where

  • Q is the finite set of states;
  • Σ is the finite input alphabet;
  • Γ is the finite stack alphabet;
  • δ:Q×Σϵ×Γϵ→P(Q×Γϵ) is the transition function;
  • q0∈Q is the initial state;
  • F⊆Q is the set of final states;

The transition function δ:Q×Σϵ×Γϵ→P(Q×Γϵ) is understood as

Transition Function ​

If:

  • The current state is q∈Q
  • The next input symbol is s∈Σϵ
  • The symbol on top of the stack is r∈Γϵ

Then:

  • The next state is q′∈Q
  • The new stack symbol on the top is r′∈Γϵ

PDA is defined from NFA.

  • ϵ is included in Σϵ and Γϵ.
  • The domain of δ is the power set P(Q×Γϵ).
  • PDA has multiple choices for the next state.

Computation on PDA ​

An input string w=w1w2⋯wn is accepted by a PDA M if there exists a sequence of states t0,t1,⋯,tn∈Q and a sequence of strings r0,r1,⋯,rn∈Γ∗ such that:

  1. t0=q0 (where t0 is the initial state);
  2. r0=ε (the stack is empty initially);
  3. tn∈F (tn is a final state); and
  4. For i=0,⋯,n,(ti+1,b)∈δ(ti,wi+1,a),where ri=sa and ri+1=sb for some a,b∈Γε and s∈Γ∗.

The last condition explains a transition.

  • Each string ri is the content of the stack.
  • The leftmost symbol in ri is at the bottom of the stack.
  • The rightmost symbol in ri is at the top of the stack (a and b).
  • The PDA consumes wi+1, changes the stack symbol from a to b, and shifts to state ti+1.

Example ​

A PDA for 0n1n

PDA