Professional Documents
Culture Documents
Fall 2008
1. Textbook, Page 83, Exercise 1.4. (a) i. {w | w has at least three as}
b b a b a a,b a
a b
a,b b
1B
b
1C
b
1D
b
2A
b
2B
b
2C
b
2D
b
3A
b
3B
b
3C
b
3D
a,b
(b)
a b
a,b b
1B
b
1C
b
1D
b
2A
b
2B
b
2C
b
2D
b
3A
b
3B
b
3C
b
3D
a,b
(c)
1
a
1B
a
b a b
1C
a
b a b
1D
a
2A (d)
2B
2C
2D
1
a
A
b
1A
1B
a a a
1C
a
2A
b
2B
2C
b
(e)
i. {w | w starts with an a}
a,b a,b
a b
a,b b
1A
1B
1C
b
2A
a b a
2B
a b a,b
2C
a
3A
a
3B
3C
(f)
1
a
A
a
1B
a a b
2B
b
(g)
a,b
A
a,b
1
a
1A
b a a b a
1B
a
2B
b
2A
2. Textbook, Page 84, Exercise 1.7. (a) The language {w | w ends with 00} with three states
0,1
0,1
0,1
2
0 0
3
0 1 0 1
4 (d) The language {0} with two states 1 (e) The language 0 1 0+ with three states
0
0 0
1
1
(g) The language {} with one state 1 (h) The language 0 with one state
3. Textbook, Page 85, Exercise 1.11. Prove that every NFA can be converted to an equivalent one that has a single accept state. As discussed in class, create a single new nal state. Create -edges from the original nal states to this new nal state. Make the original nal states non-nal. If the processing of an input word completes in one of the original nal states, the new nal state is immediately accessible without any additional symbols. Furthermore, the only way to access the new nal state is if the processing completes in one of the original nal states. Hence, all words previously accepted will remain accepted and no additional words will be accepted, meaning the two machines accept the same language and are therefore equivalent. 4. Textbook, Page 86, Exercise 1.18. Give regular expressions generating the languages of Exercise 1.6. (a) {w | w begins with a 1 and ends with a 0} 1 0 (b) {w | w contains at least three 1s} 1 1 1 (c) {w | w contains the substring 0101, i.e., w = x0101y for some x and y } 0101 (d) {w | w has length at least 3 and its third symbol is a 0} 0 (e) {w | w starts with 0 and has odd length, or starts with 1 and has even length} (0 1)() (f) {w | w doesnt contain the substring 110}
0 (10+ ) 1 (g) {w | the length of w is at most 5} ( )5 (h) {w | w is any string except 11 and 111} 0 10 0 10 110 3 + (i) {w | every odd position of w is a 1} (1) ( 1) (j) {w | w contains at least two 0s and at most one 1} 00+ 100+ 0+ 10+ 00+ 1 (k) {, 0} 0 (l) {w | w contains an even number of 0s, or contains exactly two 1s} 1 (01 01 ) 0 10 10 (m) The empty set (n) All strings except the empty string + 5. Textbook, Page 86, Exercise 1.20. (a) a b Members: ab, abb Not members: ba, bba
7
(b) a(ba) b Members: ab, ababab Not members: aba, bab (c) a b Members: aaa, bbb Not members: aabb, bbaa (d) (aaa) Members: aaa, aaaaaa Not members: a, aaaa (e) a b a Members: aba, bbaaabaabb Not members: a, b (f) aba bab Members: aba, bab Not members: ababab, ba (g) ( a)b Members: b, ab Not members: a, ba (h) (a ba bb) Members: a, bbab Not members: b,