Professional Documents
Culture Documents
Hwsol 3 PDF
Hwsol 3 PDF
b b b a,b
a a a
A B C D
a a a,b
b b
1 2 3
a a a
1A 1B 1C 1D a
b b b b
a a a
2A 2B 2C 2D a
b b b b
a a a
3A 3B 3C 3D a,b
b b b
b b b a,b
a a a
A B C D
a a a,b
b b
1 2 3
1
iii. {w| w has exactly two as and at least two bs}
a a a
1A 1B 1C 1D a
b b b b
a a a
2A 2B 2C 2D a
b b b b
a a a
3A 3B 3C 3D a,b
b b b
b a b
1 2
a
a a a a,b
b b
A B C D
b b b
1A 1B 1C 1D b
a a a a a a a a
b b b
2A 2B 2C 2D b
b a b
1 2
a
b a a,b
a
A B C
b
2
iii. {w| w has an even number of as and each a is followed by at least one b}
b b
b
1A 1B 1C
a a
a a
a a
2A b 2B 2C
b b
a,b a,b
b a
1 2 3
a a a,b
b b
A B C
a a a,b
b b
1A 1B 1C
b b
b
2A 2B 2C
a a a
b b
3A 3B 3C
a a a,b
b a b
1 2
a
3
a b
b
A B
a
b
1A 1B
a b
a a
a
2A b 2B
b
a,b
A B
a,b
b a b
1 2
a
b
1A 1B
b
a a a a
b
2B 2A
b
0,1
0 0
1 2 3
4
0,1 0,1
0 1 0 1
1 2 3 4 5
1 0 1
2 3
0
1 0 0 0
1 1
4 5 6
0
1 2
0 1 0
0
1 2 3
2
0 0
1 1 3
1
5
0
3. Textbook, Page 85, Exercise 1.11. Prove that every NFA can be converted to an equiv-
alent one that has a single accept state.
As discussed in class, create a single new final state. Create -edges from the original
final states to this new final state. Make the original final states non-final. If the
processing of an input word completes in one of the original final states, the new final
state is immediately accessible without any additional symbols. Furthermore, the only
way to access the new final state is if the processing completes in one of the original
final 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
1 1 1
(c) {w| w contains the substring 0101, i.e., w = x0101y for some x and y}
0101
(e) {w| w starts with 0 and has odd length, or starts with 1 and has even length}
(0 1)()
6
0 (10+ ) 1
( )5
0 10 0 10 110 3 +
(1) ( 1)
(k) {, 0}
(l) {w| w contains an even number of 0s, or contains exactly two 1s}
1 (01 01 ) 0 10 10
7
(b) a(ba) b
(c) a b
(d) (aaa)
(e) a b a
(g) ( a)b
Members: b, ab
Not members: a, ba
(h) (a ba bb)
Members: a, bbab
Not members: b,