Pushdown Automata (PDA)

A PDA is a finite automaton plus a stack. It's a 7-tuple (Q, Σ, Γ, δ, q₀, Z₀, F), where Γ is the stack alphabet, Z₀ the initial stack symbol and δ: Q × (Σ ∪ {ε}) × Γ → finite subsets of Q × Γ*.

PDA for L = {aⁿbⁿ | n ≥ 1}

Text
δ(q0, a, Z0) = (q0, aZ0)     push a
δ(q0, a, a)  = (q0, aa)      push a
δ(q0, b, a)  = (q1, ε)       first b: pop a
δ(q1, b, a)  = (q1, ε)       pop a for each b
δ(q1, ε, Z0) = (qf, Z0)      accept by final state
a, Z0 / aZ0a, a / aab, a / εb, a / εε, Z0 / Z0startq0q1qf
PDA for aⁿbⁿ: push an a for every a, pop one for every b (label = input, pop / push)

Instantaneous Descriptions for aabb

Text
(q0, aabb, Z0) ⊢ (q0, abb, aZ0) ⊢ (q0, bb, aaZ0) ⊢ (q1, b, aZ0) ⊢ (q1, ε, Z0) ⊢ (qf, ε, Z0)
Accepted.

Acceptance

A PDA can accept by final state or by empty stack. The two are equivalent in power.

DPDA vs NPDA

DPDANPDA
At most one move in any configurationMultiple choices allowed
Accepts deterministic CFLs (e.g. wcwᴿ)Accepts all CFLs (e.g. wwᴿ)
Less powerfulMore powerful
RememberUnlike finite automata, NPDAs are strictly more powerful than DPDAs.
Track your progress through the Theory of Computation course