CMPS 260 Spring 2020
Homework #3: Nondeterministic Finite Automata
Due: 4pm, Thursday, March 5

The first five problems ask you to present an NFA that accepts a specified language. Keep in mind that, in an NFA, you do not need to explicitly include a "dead" state (i.e., a state from which it is impossible to reach a final/accepting state). Rather, if a state q has no outgoing transition on a symbol a, it is as though there were a transition from q labeled a going to a dead state.

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

L1 = { u101v0  |  u,v ∈ {0,1}* }

In words, L1 contains precisely those strings over the alphabet {0,1} having 101 as a substring and 0 as a suffix.

Note that a transition labeled by both 0 and 1 counts as two transitions.


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

L2 = { w ∈ {0,1}*  |  w = x101y for some x,y ∈{0,1}*  ∨  w = x1000 for some x ∈ {0,1}*}

In words, L2 contains precisely those strings over the alphabet {0,1} having either 101 as a substring or 1000 as a suffix.

Note that a transition labeled by both 0 and 1 counts as two transitions.


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

L3 = { wc  |  w ∈ {a,b}*} ∪ { wb  |  w ∈ {a,c}*} ∪ { wa  |  w ∈ {b,c}*}

In words, L3 contains precisely those strings over the alphabet {a,b,c} ending in a symbol that appears exactly once.

Note that using λ-transitions would be helpful.


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

L4 = { waav  |  w,v ∈ {a,b}* ∧ |v| = 4} ∪ { wabbv  |  w,v ∈ {a,b}* ∧ |v| = 2}

In words, L4 contains precisely those strings over {a,b} that end either four symbols after an occurrence of aa or two symbols after an occurrence of abb


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

L5 = {{ab} ∪ {cb} ∪ {aba} ∪ {abb}}*

In words, L5 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, cb, aba, or abb. An example of such a string (in which vertical bars have been inserted in order to show the boundaries between adjacent factors) is

cb|abb|cb|ab|aba|abb|cb|aba|aba



In each of the next two problems, you are given an NFA and asked to present the (equivalent) DFA that results from applying 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 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} (or simply {0,2,3}, if you prefer) could be the name of the state corresponding to the set of states {q0, q2, q3}.

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

Transition Graphδ function
ab
q0 {q2} {q1,q2}
q1 {q2} {q0}
q2 {q3} {q3}
q3 {q2}

The resulting DFA should have seven states, including the dead state.


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

Transition Graphδ function
abλ
q0 {q1}
q1 {q2} {q1,q2} {q2}
q2 {q3}
q3 {q0} {q0}

The resulting DFA should have six states, including the dead state.