Undergraduate Course
ELEMENTS OF COMPUTATION THEORY
College of Computer Science
Chapter 2
Zhejiang University
FallWinter, 2007
P 60
2.1.1 Let
M
be a deterministic ﬁnite automaton. Under exactly what cir
cumstances is
e
∈
L
(
M
)
? Prove your answer.
Solution:
e
∈
L
(
M
)
if and only if
s
∈
F
.
/
Suppose
e
∈
L
(
M
)
. Then, by deﬁnition of
L
(
M
)
,
(
s,e
)
‘
*
M
(
q,e
)
, where
q
∈
F
.
Because it is not the case that
(
s,e
)
‘
M
(
q,w
)
for any conﬁguration
(
q,w
)
(
w
6
=
e
).
(
s,e
)
‘
*
M
(
q,e
)
must be in the reﬂexive transitive closure of
‘
M
by virtue of reﬂexivity

that is,
(
s,e
) = (
q,e
)
.
Therefore,
s
=
q
and thus
s
∈
F
.
/
Suppose
s
∈
F
. Because
‘
*
M
is reﬂexive,
(
s,e
)
‘
*
M
(
s,e
)
. Because
s
∈
F
, we have
e
∈
L
(
M
)
by deﬁnition of
L
(
M
)
.
2.1.2 Describe informally the languages accepted by the following DFA.
Solution:
(c) All strings with the same number of
a
s and
b
s and in which no preﬁx has more than
two
b
s than
a
s, or
a
s than
b
s.
(d)All strings with the same number of
a
s and
b
s and in which no preﬁx has more than
one more
a
than
b
, or viceversa.
2.1.3 Construct DFA accepting each of the following languages.
(c)
{
w
∈ {
a,b
}
*
:
w
has neither
aa
nor
bb
as a substring
}
.
(e)
{
w
∈ {
a,b
}
*
:
w
has both
ab
and
ba
as a substring
}
.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentSolution:
(c)
M
= (
K,
Σ
,δ,sF
)
, where
K
=
{
q
0
,q
1
,q
2
,q
3
}
,
Σ =
{
a,b
}
,
s
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '09
 XiaogangJin
 Computer Science

Click to edit the document details