CFL - Pushdown Automata Flashcards
When is a word accepted by a PDA?
When it has been read, stack is empty, and automaton is in a final state
What is the main theorem?
Class of languages accepted by pushdown automata
is exactly the class of Context-free languages
What is a PDA?
A sextuple
M = (K, Σ, Γ, ∆, s, F), where:
K is a finite set of states
Σ as an alphabet of input symbols
Γ as an alphabet of stack symbols
s ∈ K is the initial state
F ⊆ K is the set of final states
∆ is a transition relation, a finite set, and may not be a function as a PDA is nondeterministic
∆ ⊆
(K × Σ∗ × Γ∗) × (K × Γ∗)
What is a configuration?
Any tuple:
(q, w, γ) ∈ K × Σ∗ × Γ∗
q ∈ K represents a current state of M, and w ∈ Σ∗ is
unread part of the input,
and γ is a content of the stack
read top-down
What is a transition relation?
acts between two configurations
and hence |- M is a certain binary relation
defined on K × Σ∗ × Γ∗
|-M ⊆ (K × Σ∗ × Γ∗)^2
Given a PDA, a binary relation is a transition relation iff:
For any p, q ∈ K,
u, x ∈ Σ∗,
α, β, γ
(p, ux, βα) |-M
(q, x, γα)
iff
((p, u, β), (q, γ)) ∈ ∆
Define the language L(M)
L(M) = {w ∈ Σ∗ :
(s, w, e) |-M∗ (p, e, e) for certain p ∈ F}
M accepts w ∈ Σ∗
iff. w ∈ L(M)
M accepts w ∈ Σ∗
iff computation
in M such that it starts with w and with empty stack ((s, w, e))
and it ends in a final state after reading w and emptying all
of the stack
((p, e, e) for certain p ∈ F )
PDA-FA Theorem
The class FA of finite automata is a proper subset of the
class PDA of pushdown automata, i.e.
FA ⊂ PDA
Proof of PDA-FA Theorem
Show that every FA automaton is a PDA automaton that operates on an empty stack (Slide 20, Lecture 10)
Show the transition for “Push a”
((p, u, e), (q, a))
Show the transition for “Pop a”
((p, u, a), (q, e))
Show the transition for “Compare and pop a”
((p, a, a), (q, e))
Show the transition for “Compare a with b and pop b”
((p, a, b), (q, e))
What does
((p, u, B)), (q, r)) ∈ Δ mean?
M in state p:
1) reads u
2) replaces B with r at the top of the stack
3) goes to the state q
Lemma 1 of PDA main theorem
Each CFL is accepted by some PD automaton