CSC 8510 Theory of Computing
Solutions to selected exercises on pages 83-88
Here are solutions to some of the exercises that I suggested; I've made some fairly obvious substitutions for the (unavailable) Greek letters: S = capital sigma, d = delta, e = empty string.
1.1
a The start state of M1 is
q1.
b The set of accept states of M1
is {q2}.
c The start state of M2 is
q1.
d The set of accept states of M2
is {q1, q4}.
e M1, given aabb, goes through
q1 (start), q2, q3, q1,
q1.
f M1 does not accept the string
aabb.
g M2 does accept the empty
string.
1.2 Formal descriptions of M1 and M2
are:
M1 =
({q1, q2, q3}, {a,b}, D1,
q1, {q2}), where
D1 =
{d(q1,a)=q2, d(q1,b)=q1,
d(q2,a)=q3, d(q2,b)=q3,
d(q3,a)=q2, d(q3,b)=q1}
M2 =
({q1, q2, q3, q4}, {a,
b}, D2, q1, {q1, q4}), where
D2 =
{d(q1,a)=q1, d(q1,b)=q2,
d(q2,a)=q3, d(q2,b)=q4,
d(q3,a)=q2, d(q3,b)=q1,
d(q3,a)=q3, d(q3,b)=q4}
1.3, 1.4, 1.5 -- I don't have good tools to draw pictures on this PC. Ask me in class and I'll do some.
1.10
a Actually, there's practically nothing to do here. A DFA
has a transition from every state for every possible input symbol (by
definition), so any string over those symbols that you give to a DFA
will end up in some state. The strings that end in a final
state will be accepted, so in the complement of the language they
should be rejected; the strings that end up in a nonfinal state will
be rejected, so in the complement they should be accepted. Just
reversing the final and nonfinal states does this.
b The NFA shown in (a) of exercise 1.12 accepts the
string "a"; if the final and nonfinal states were reversed, it would
still accept "a". However, the class of languages recognized by NFAs
(which is the same as the class of languages recognized by DFAs)
is closed under complement--it just takes a little more work
to get the right machine. First, convert the NFA to a DFA, then
reverse the final and nonfinal states in that DFA.
1.15 Note: "S" is capital sigma, "e" is the empty string.
|
Expression |
Members |
Nonmembers |
|---|---|---|
|
a*b* |
e ab |
ba aba |
|
a(ba)*b |
ab abab |
b bbab |
|
a*+b* |
a bbb |
ab ba |
|
(aaa)* |
e aaa |
a aa |
|
S*aS*bS*aS* |
aba bbabba |
bab aabb |
|
aba+bab |
aba bab |
aaa b |
|
(e+a)b |
a ab |
e aab |
|
(a+ba+bb)S* |
ba aabbaa |
e b |