Lecture 18 - Pushdown Automata - Examples
Lecture 18 - Pushdown Automata - Examples
Automata -
Examples
Robb T.
Koether
Homework
Pushdown Automata - Examples
Review
Lecture 18
Examples of
PDAs Section 2.2
Assignment
Robb T. Koether
Hampden-Sydney College
Pushdown
Automata -
Examples
Robb T.
Koether
Homework
Review
1 Homework Review
Examples of
PDAs
Assignment
2 Examples of PDAs
3 Assignment
Homework Review
Pushdown
Automata -
Examples
Robb T.
Koether
Homework
Review
Exercise 2.10, page 129.
Examples of
PDAs Give an informal description of a pushdown automaton that
Assignment
recognizes the language
Pushdown
Automata -
Examples
Robb T.
Koether
Homework
Review
Solution
Examples of The language A is the union of the languages
PDAs
Assignment
{ai bi ck | i, k ≥ 0}
and
{ai bk ck | i, k ≥ 0}.
Homework Review
Pushdown
Automata -
Examples
Robb T.
Koether
Homework
Review
Solution
Examples of A PDA for the first of these languages is
PDAs
Assignment a, ε → a b, a → ε c, ε → ε
ε, ε → $ ε, ε → ε ε, $ → ε
Homework Review
Pushdown
Automata -
Examples
Robb T.
Koether
Homework
Review
Solution
Examples of A PDA for the second language is
PDAs
Assignment a, ε → ε b, ε → b c, b → ε
ε, ε → $ ε, ε → ε ε, $ → ε
Homework Review
Pushdown
Automata -
Examples
Robb T.
Koether
Solution
Homework
Therefore, a PDA for the language A is
Review
Examples of
PDAs a, ε → a b, a → ε c, ε → ε
Assignment
ε, ε → $ ε, ε → ε ε, $ → ε
ε, ε → ε
a, ε → ε b, ε → b c, b → ε
ε, ε → ε ε, ε → ε ε, ε → $ ε, $ → ε
Examples
Pushdown
Automata -
Examples
Robb T.
Koether
Homework
Review
Assignment
Design a PDA that accepts the language
Pushdown
Automata -
Examples
Robb T.
Koether Example (Pushdown automaton)
Homework
The strategy will be to keep the excess symbols, either
Review a’s or b’s, on the stack.
Examples of
PDAs One state will represent an excess of a’s.
Assignment
Another state will represent an excess of b’s.
We can tell when the excess switches from one symbol
to the other because at that point the stack will be
empty.
In fact, when the stack is empty, we may return to the
start state.
Examples
Pushdown
Automata -
Examples Example (Pushdown automaton)
Robb T.
Koether a, ε → a
b, a → ε
Homework
Review a>b
Examples of
PDAs
a, ε → $ b. $ → ε
Assignment
b, ε → $ a. $ → ε
a<b
a, b → ε
b, ε → b
Examples
Pushdown
Automata -
Examples
Robb T.
Koether
Homework
Review
Assignment
Note that this solution is inspired by the grammar
S → SS | aSb | bSa | ε
Examples
Pushdown
Automata -
Examples
Robb T.
Koether
Example (Pushdown automata)
Homework
Review Let Σ = {a, (, )}. Design a PDA whose language is
Examples of
PDAs
Assignment
{w | w contains balanced parentheses}.
Pushdown
Automata -
Examples
Robb T.
Read Section 2.2, pages 112 - 114.
Koether
Problems 21, 22, 23, 24, page 130.
Homework
Review
Let Σ = {a, (, ), [, ]}. Design a PDA whose language is
Examples of
PDAs {w | w contains balanced parentheses and brackets}.
Assignment
{an bm cm dn | m, n ≥ 0}.
{an bm | n 6= m}.