Title: Pushdown Automata
1Section 7.1
Pushdown Automata
- like NFA-? but also has a stack
- transition takes the current state, the current
input symbol, and the top-of-the-stack symbol
(which is removed from the stack) and returns a
state and a string to place in the stack - the automaton starts in the initial state,
reading the first symbol on the tape, and having
a special initial symbol on the stack - automaton accepts a string x if, after reading
all of x, it can get to an accepting state (the
stack content does not matter) - if the stack is empty, the automaton is stuck
2Section 7.1
Pushdown Automata
Example L akbk k 0
3Section 7.1
Pushdown Automata
Example L w 2 a,b w is an even-length
palindrome
4Section 7.2
Pushdown Automata
- Def A pushdown automaton (PDA) is a 7-tuple
(Q,?,?,q0,Z0,A,?) where - Q is a finite set of states
- ? is a finite input alphabet
- ? is a finite stack alphabet
- q0 2 Q is the initial state
- Z0 2 ? is the initial stack symbol
- A µ Q is the set of accepting states
- ? is the transition function from ______________
to finite subsets of Q ?
5Section 7.2
Pushdown Automata
Def Let M (Q,?,?,q0,Z0,A,?) be a PDA. A
configuration is a triple (p,x,?) where p is the
current state, x is the rest of the input (the
yet-unread part), and ? is the content of the
stack (the top is on the left). We write
(p,x,?) M (q,y,?) if we can get from the
configuration (p,x,?) to the configuration
(q,y,?) using one transition of M. Similarly we
write (p,x,?) M (q,y,?) if we can get from
(p,x,?) to (q,y,?) through a finite sequence of
transitions of M. The language accepted by M
L(M) x 2 ? ________________________
6Section 7.3
Deterministic Pushdown Automata
Def Let M (Q,?,?,q0,Z0,A,?) be a PDA. M is
deterministic (DPDA) if A language L is a
deterministic context-free language (DCFL) if
there exists a DPDA accepting L.
7Section 7.3
Deterministic Pushdown Automata
Example Give a DPDA for L akbk k 1
. Can you give a DPDA for L2 akbk
k 0 ?
8Section 7.3
Determinism vs. Nondeterminism
For finite automata For PDA There exists a
language which can be accepted by a PDA but not
by a DPDA !
9Section 7.3
Determinism vs. Nondeterminism
Example Is the language given by S ? SS
(S) ? a DCFL ?
10Section 7.3
Determinism vs. Nondeterminism
Example x 2 a,b number of as in x
number of bs in x
11Section 7.3
Determinism vs. Nondeterminism
Example x 2 a,b (numb. as in x) 2
(numb. bs in x)
12Sections 7.4 and 7.5
CFG vs. PDA
It is possible to show that every language
generated by a CFG can be accepted by a PDA and
vice versa. Thm Let G (V,?G,S,P) be a CFG.
Then there exists a PDA M (Q,?M,?,q0,Z0,A,?)
such that L(M) L(G). Thm Let M
(Q,?M,?,q0,Z0,A,?) be a PDA. Then there exists a
CFG G (V,?G,S,P) such that L(G) L(M). Which
one is easier to prove ?
13Section 7.4
CFG vs. PDA
Thm Let G (V,?G,S,P) be a CFG. Then there
exists a PDA M (Q,?M,?,q0,Z0,A,?) such that
L(M) L(G). Example S ? S T T T ? T R
R R ? (S) x