CS 390 Solutions to Test II


November 9, 2004





1(a). Find an $DFA$ that recognizes the same language as the following $NFA$:



State $q$ $a$ $b$ State $q$ $a$ $b$
$1$ {$2, 3$} $\emptyset$ $4$ $\emptyset$ $\emptyset$
$2$ {$2, 5$} {$4$} $5$ {$4$} $\emptyset$
$3$ $\emptyset$ {$5$}      



The initial state is $1$ and the accepting states are $4$ and $5$.



Answer:






2. Construct an $NFA-\Lambda$ that accepts the language corresponding to
$(ab^{*} + b)^{*}$ from the simplest $NFA$'s. DO NOT SIMPLIFY.



Answer:








3. For the following $NFA-\Lambda$, answer the questions below:



State $q$ $a$ $b$ $\Lambda$
$1$ {$3$} $\emptyset$ {$2$}
$2$ $\emptyset$ {$2$} {$4$}
$3$ $\emptyset$ {$4$} {$1$}
$4$ $\emptyset$ $\emptyset$ $\emptyset$



(a) Find $\Lambda (\{1, 3\})$

Answer:

$\{1, 2, 3, 4\}$

(b) Find $\delta^{*} (1, ab)$

Answer:

$\{2, 4\}$


4. Prove by structural(general) induction that for DFA, $\delta^{*} (q, xy) = \delta^{*} ( \delta^{*}(q,x), y)$.



Note that the set of strings $\Sigma $ over the alphabet $\{a, b\}$ and $\delta^{*}$ for DFA are defined recursively as follows:



Basis Clause: $a \in \Sigma$ and $b \in \Sigma$
Inductive Clause: If any string $x$ in $\Sigma $, then $xa$ and $xb$ are in $\Sigma $.
Extremal Clause: Nothing is in $\Sigma $ unless it is obtained by Basis and Inductive Clauses .



Basis Clause: $\delta^{*} (q, \Lambda ) $ = $q$
Inductive Clause: For any state $q$ and any string $y$ in $\Sigma $ and any symbol $a$ of $\Sigma $,
$\delta^{*} (q, ya) = \delta (\delta^{*} (q, y), a)$.



Proof:
Basis Step: $y = \Lambda$.
If $y = \Lambda$, then $\delta^{*} (q, xy)$ = $\delta^{*} (q, x)$.
Also $\delta^{*} (\delta^{*} (q,x), y) = \delta^{*} (\delta^{*} (q,x), \Lambda)
= \delta^{*} (q, x)$ by the definition of $\delta^{*}$.
Hence $\delta^{*} (q, xy) = \delta^{*} ( \delta^{*}(q,x), y)$ if $y = \Lambda$.
Inductive Step: Assume that for any string $y$ $\delta^{*} (q, xy) = \delta^{*} ( \delta^{*}(q,x), y)$.
We are going to show that $\delta^{*} (q, xya) = \delta^{*} ( \delta^{*}(q,x), ya)$ for any symbol a of the alphabet.
$\delta^{*} ( \delta^{*}(q,x), ya) = \delta (\delta^{*}( \delta^{*}(q,x), y), a)$ by the definition of $\delta^{*}$.
= $\delta ( \delta^{*}(q,xy), a)$ by the induction hypothesis.
= $\delta^{*} (q, xya)$ by the definition of $\delta^{*}$.