Transition Rules and Transition Diagrams - Non Deterministic Push Down Automata
Transition Rules in a NPDA
-
Current state (q ∈ Q)
-
Current input symbol (a ∈ Σ ∪ {ε}) – we may consume input or take an ε-move.
-
Top of the stack symbol (X ∈ Γ, where Γ is the stack alphabet).
Based on these, the automaton nondeterministically chooses one or more possible actions.
Formal Definition of Transition Function
For NPDA, the transition function is defined as:
This means:
-
Input: (current state, current input symbol or ε, top of stack symbol)
-
Output: a set of choices, where each choice is:
-
A new state (q′)
-
A replacement for the top stack symbol (a string γ ∈ Γ*).
-
Interpretation
-
Pop: If we replace the top with ε, it means we remove the top symbol.
-
Push: If we replace the top with multiple symbols, they are pushed onto the stack (rightmost ends up on top).
-
Change: If we replace the top with another symbol, it’s like rewriting the top.
-
No change: If we replace it with the same symbol, stack remains unchanged.
Example Transition Rule
Consider the language L = {aⁿbⁿ : n ≥ 0}.L = {ab, aabb, aaabbb, aaaabbbb, ......}
-
NPDA idea: push each
a
onto stack, then pop onea
for eachb
. -
Transitions:
-
δ(q₀, a, Z₀) = { (q₀, aZ₀) }
-
On reading
a
, with bottom marker Z₀, push a.
-
-
δ(q₀, a, a) = { (q₀, aa) }
-
On reading
a
, with a on stack, push another a.
-
-
δ(q₀, b, a) = { (q₁, ε) }
-
On reading
b
, pop a.
-
-
δ(q₁, b, a) = { (q₁, ε) }
-
Continue popping A’s for each
b
.
-
-
δ(q₁, ε, Z₀) = { (q_accept, Z₀) }
-
If input finished and only bottom marker remains, accept.
-
Key Difference (NPDA vs DPDA)
-
NPDA: δ may give multiple possible next moves (nondeterministic choices).
-
DPDA: δ must give at most one move for each configuration.
Comments
Post a Comment