CMPS 260 Spring 2019
Homework #3: Nondeterministic Finite Automata
Due: 3pm, Monday, March 4

1. Present an NFA having at most five states and eight transitions that accepts the language

{ w ∈ {a,b}* : w = uabbav for some u,v ∈{a,b}*}

In other words, the language contains precisely those strings over the alphabet {a,b} having abba as a substring.

(A transition labeled by both a and b counts as two transitions.)


2. Present an NFA having at most six states that accepts the language

{ w ∈ {a,b}* : w = xbaby for some x,y ∈{a,b}*  ∨  w = xbaaa for some x ∈ {a,b}*}

In other words, the language contains precisely those strings over the alphabet {a,b} having either bab as a substring or baaa as a suffix.


3. Present an NFA having at most four states that accepts the language

{a,b}* ∪ {a,c}* ∪ {b,c}*

In other words, the language contains precisely those strings over the alphabet {a,b,c} in which at least one among the symbols a, b, and c fails to appear.


4. Present an NFA having at most seven states (note that only one accepting/final state is necessary) that accepts the language

{ w ∈ {a,b}* : w = uav for some u,v ∈{a,b}*  ∧  |v|=3 } ∪ { w ∈ {a,b}* : w = ubv for some u,v ∈{a,b}*  ∧  |v|=2 }

In other words, the language contains precisely those strings over {a,b} in which either a is the fourth-to-last symbol or b is the third-to-last symbol.


5. Present an NFA having four states and at most two transitions labeled b that accepts the language

{{ab} ∪ {aab} ∪ {aba}}*

In other words, the language contains precisely those strings over {a,b} that can be "factored" into a sequence of zero or more substrings, where each factor is either ab, aab, or aba. An example of such a string (in which vertical bars have been inserted in order to show the boundaries between adjacent factors) is

aab|ab|ab|aba|aab|aab|aba|ab


In each of the last two problems, you are given an NFA M and asked to present the (equivalent) DFA that results from applying to M the "subset construction" algorithm.

Present your answers in tabular form (such as how the NFAs are described here) rather than as (or in addition to, if you want) a transition graph. Don't forget to identify the initial state and the accepting/final states.

Your DFA's state names should make obvious which subset of the NFA's state set each one corresponds to. For example, q{0,2,3} could be the name of the state corresponding to {q0, q2, q3}.

6. The NFA is M = (Q, {a,b}, δ, q0, {q3}), where Q = {qi : 0≤i<4} and δ is as described in the table below:

ab
q0 {q1,q2} {q1}
q1 {q0} {q1}
q2 {q3} {q3}
q3 {q1}

The resulting DFA should have eight states.


7. The NFA is M = (Q, {a,b}, δ, q0, {q1}), where Q = {qi : 0≤i<4} and δ is as described in the table below:

abλ
q0 {q1}
q1 {q2} {q3}
q2 {q3}
q3 {q1} {q2}

The resulting DFA should have seven states.