Problem Set 2
1. Design an NFA with no more than five states for the set n
n
{abab : n ≥ 0} U{aba : n ≥ 0} .
2. Cons Constr truc uctt an NFA NFA with with three three stat states es that that acce accept ptss the the lang langua uage ge *
{ab,abc}
. n
n
3. Find an NFA with four states for L = {a : n ≥ 0} U{b a : n ≥ 1}
.
4. Which Which of the stings stings 00,010 00,01001, 01,100 10010, 10,000 000,00 ,0000, 00,are are accept accepted ed by the 1
1
0 q
q0
1
0,1
q2 0,
following NFA? 5. Find an NFA NFA that accepts
*
{a}
and is such that if in its transition
grap graph h a sing single le edge edge is remo remove ved d (wit (witho hout ut any any othe otherr chan change ges) s),, the the resulting automaton accepts {a}. 6. An NFA NFA in which (a) there are no λ -transitions, and (b) for all q ∈ Q and all a ∈ ∑ , δ (q, a) contai contains ns at most most one elemen element, t, is someti sometimes mes called an incomplete DFA. DFA. This is reasonable since the conditions make it suck that there is never any choice of moves. For ∑ ={a,b}, convert the incomplete DFA below into a standard b
a
a
DFA.. 7. Convert to a DFA the following NFA: 0
p q r *s
1
{p,q} {r} {s} {s}
{q,s} {r} {s}
8. Convert to a DFA the following NFA: 0
1
p *q r *s
{q} {q,r} {p} {p}
9. Convert the following NFA to a DFA and informally describe the language it accepts. 0
p *q r *s *t
{p,q} {r,s} {p,r}
1
{p} {t} {t}
10. Give nondeterministic finite automata to accept the following
languages. Try to take advantage of nondeterminism as much as possible. *a) The set of strings over alphabet {0, 1,..., 9} such that the final digit has appeared before. b)The set of strings over alphabet {0, 1,..., 9} such that the final digit has not appeared before. c) The set of strings of 0’s and l’s such that there are two 0’s separated by a number of positions that is a multiple of 4. Note that 0 is an allowable multiple of 4. 11. Prove that all finite languages are regular. 12. In the box on "Dead States and DFA's Missing Some Transitions," we claim that if N is an NFA that has at most one choice of state for any state and input symbol (i.e.,δ(q, a) never has size greater than 1), then the DFA D constructed from N by the subset construction has exactly the states and transitions of N plus transitions to a new dead state whenever N is missing a transition for a given state and input symbol. Prove this contention. 13. In Example 2.13 we claimed that the NFA N is in state qi, for i - 1, 2,..., n, after reading input sequence w if and only if the ith symbol from the end of w is 1. Prove this claim. 14. Design ε-NFA's for the following languages. Try to use e-transitions to simplify your design. a )The set of strings consisting of zero or more a's followed by zero or more b's, followed by zero or more c's. b) The set of strings that consist of either 01 repeated one or more times or 010 repeated one or more times. c) The set of strings of O's and l's such that at least one of the last ten positions is a 1. 15. Use the construction of Theorem 2.2 to convert the NFA in Figure 2.10 to a DFA. Can you see a simpler answer more directly? 16. Convert the following NFA into an equivalent DFA. 1 0 q0
0 1 q2
q1 λ,0
0,1
17. Carefully complete the arguments in the proof of Theorem 2.2.
*
Show in detail that if the label of δ D (q0,ω) contains qf , then
*
δ
N
(q0,ω) also contains qf . 18. Is it true that for any NFA M = (Q,∑,δ,q 0 ,F) the complement of L(M) is equal to the set {ω∈∑*:δ*(q0 ,ω)∩F=Ø}? If so, prove it. If not, give a counter example. 19. It is true that for every NFA M = (Q,∑,δ,q 0,F) the complement of L(M) is equal to the set {ω∈∑*:δ*(q0,ω) ∩(Q-F)≠ Ø }? If so, prove it. If not, give a counterexample. 20 .Prove that for every NFA with an arbitrary number of final states, there is an equivalent NFA with only one final state. Can we make a similar claim for DFA's ? 21. Find an NFA without λ-transitions and with a single final state that accepts the set {a}∪{bn:n≥1}. 22. Let L be a regular language that does not contain λ. Show that there exists an NFA without λ-transitions and with a single final state that accepts L.