Title: CS500 Theory of Computation
1CS500 - Theory of Computation
2Write (I) Regular expression (II) DFA diagram and
(III) Formal definition for the following
language All binary strings with at least five
0s.
I 10 10 10 10 101 (0U1)
1
1
1
1
1
0
0
0
0
e
d
c
a
b
II
III (?,Q,A,q0,?) ? 0,1 Q a,b,c,d,e,f A
f q0 a ? ?(a,1) a, ?(a,0) b
?(b,1) b, ?(b,0) c ?(c,1) c,
?(c,0) d ?(d,1) d, ?(d,0) e
?(e,1) e, ?(d,0) f ?(f,1)
f, ?(f,0) f
0,1
0
f
3Write (I) Regular expression (II) DFA diagram and
(III) Formal definition for the following
language All binary strings which sum to 2
modulo 6.
I 01010(101010101010)
0
0
0
0
0
1
1
1
1
e
II
d
c
a
b
III (?,Q,A,q0,?) ? 0,1 Q a,b,c,d,e,f A
c q0 a ? ?(a,0) a, ?(a,1) b
?(b,0) b, ?(b,1) c ?(c,0) c,
?(c,1) d ?(d,0) d, ?(d,1) e
?(d,0) e, ?(d,1) f ?(d,0)
f, ?(d,1) a
1
0
1
f
4Write (I) Regular expression (II) DFA diagram and
(III) Formal definition for the following
language All monotonically non-decreasing
strings from the alphabet 0,1,2,3.
e
0,1,2,3
I 0123
0,1,2
3
0
0
2
0,1
1
2
3
II
c
d
3
a
b
2
1
3
III (?,Q,F,q0,?) ? 0,1,2,3 Q a,b,c,d,e A
a,b,c,d q0 a ? ?(a,0) a, ?(a,1)
b, ?(a,2) c, ?(a,3) d ?(b,0)
e, ?(b,1) b, ?(b,2) c, ?(b,3) d
?(c,0) e, ?(c,1) e, ?(c,2) c,
?(c,3) d ?(d,0) e, ?(d,1) e,
?(d,2) e, ?(d,3) d ?(e,0) e,
?(e,1) e, ?(e,2) e, ?(e,3) e
52. Draw a DFA diagram that accepts the same
language as the following NFA
A
B
C
D
Solution next page.
6a,c
a
0
0
1
1
1
1
c,d
b,d
0
0
0
1
1
0
0,1
1
0
c
0
0,1
1
d
73. A) Show that the following language L is not
regular L all binary strings w such that the
number of 1s in w is at least 2 times the number
of 0s in w.
Let n be any constant Choose the string w12n0n.
Note w?L and w? n, let x,y,z be any possible
partition of w such that xy?n and ygt0 Note
this results in y being a string of 1s. Let
i0 xyiz 12n-y0n, which is not in L because
2n-y lt 2(n). The contrapositive of the
pumping lemma implies that L is not regular.
83. B) Show that the following language L is not
regular L all binary strings w such that the
number of 1s in w is perfect cube
Let n be any constant Choose the string w1n3.
Note w?L and w? n, let x,y,z be any possible
partition of w such that xy?n and ygt0 Note
this results in y being a string of 1s. Let
i2 xyiz 1n3y. (n1)3gtn3 y gt n3 n gt
n3 implies xyiz ? L. The contrapositive of the
pumping lemma implies that L is not regular.