2G1505 Automata Theory
2G1505 Automata Theory
2G1505 Automata Theory
1. Convert the nondeterministic automaton given below to an equivalent deterministic one using the
subset construction. Omit inaccessible states. Draw the graph of the resulting DFA.
a b
→ q1 q1 , q 2 q3 F
q2 − q4 F
→ q3 q4 −
q4 − q1 , q 4
a b
→ {q1 , q3 } {q1 , q2 , q4 } {q3 } F
{q1 , q2 , q4 } {q1 , q2 } {q1 , q3 , q4 } F
{q1 , q3 , q4 } {q1 , q2 , q4 } {q1 , q3 , q4 } F
{q1 , q2 } {q1 , q2 } {q3 , q4 } F
{q3 , q4 } {q4 } {q1 , q4 }
{q1 , q4 } {q1 , q2 } {q1 , q3 , q4 } F
{q4 } {} {q1 , q4 }
{q3 } {q4 } {}
{} {} {}
2. For the deterministic automaton given below, apply the minimization algorithm of Lecture 14 to
compute the equvalence classes of the collapsing relation ≈ defined in Lecture 13. Show clearly the
computation steps. List the equivalence classes, and apply the quotient construction to derive a
minimized automaton. Draw its graph.
a b
→ q0 q0 q1
q1 q2 q3
q2 q2 q3
q3 q2 q4 F
q4 q0 q1
Solution: (incomplete) After applying the minimization algorithm we obtain that q0 ≈ q4 and q1 ≈ q2 .
Thus we obtain the following minimized automaton (given as a table).
a b
→ {q0 , q4 } {q0 , q4 } {q1 , q2 }
{q1 , q2 } {q1 , q2 } {q3 }
{q3 } {q1 , q2 } {q0 , q4 } F
3. Let A ⊆ Σ∗ be a language. We define its prefix closure as:
pref A = {x ∈ Σ∗ | ∃y ∈ Σ∗ . x · y ∈ A}
Prove that regular languages are closed under prefixing: if language A is regular, then so is pref A.
Solution: Let A ⊆ Σ∗ be regular. Then there must be a DFA MA = (Q, Σ, δ, s, F ) such that
L(MA ) = A. Now, based on MA , define another automaton M = (Q, Σ, δ, s, F 0 ) so that:
n o
F 0 = q ∈ Q | ∃y ∈ Σ∗ . δ̂(q, y) ∈ F
We will show that this automaton accepts the language pref A, and hence that pref A is regular.
Claim. L(M ) = pref A
Proof.
then a string is in A exactly when after reading it the stack contains only B’s (on top of ⊥). Note
that there must be at least one such B. So, we can obtain the desired behaviour by adding two
more productions:
b
hq, ⊥i ,→ hq, Bi
ε
hq, Bi ,→ hq, εi
5. Apply the Pumping Lemma for context–free languages (as a game with the Demon) to show that the
language: n o
A = an bn aj | j ≤ n
is not context–free.
Solution:
Since |vwx| ≤ k, vwx has either the shape al bm or bm al for some l, m such that l + m ≤ k. In the first
case xv 0 wx0 y must be of the shape ap bq ak for some p, q such that p + q < 2k, and thus is not in A.
In the second case, xv 2 wx2 y will either not be in L(a∗ b∗ a∗ ) at all, and thus not in A, or else xv 2 wx2 y
must be of the shape ak bp aq for some p, q such that p + q > 2k, and thus not in A. Hence, we win the
game in all cases, which shows that A is not context–free.
6. Give a detailed description (preferably as a graph) of a total Turing machine accepting the language:
n(n+1)
n
A= a b 2 |n≥0