CPTR
324 Spring 2003 Exam 1 Name ________________________
1. Definitions: Define the following terms
(3 points each)
a. alphabet
b. string
c. language
2. Matching: Choose the notation that correctly defines
each of the following: (3 points each)
_____ transition function for a DFA
_____ transition function for an NFA
_____ union of two languages A and B
_____ concatenation of two languages A and B
_____ star of a language A
a. d: Q ´ S ® S
b. d: Q ´ S ® Q
c. d: Q ´ S ® 2Q
d. d: Q ´ Se ® Se
e. d: Q ´ Se ® Q
f.
d: Q ´ Se ® 2Q
g. {w | w Î A or w Î B}
h. {w | w Î A and w Î B}
i.
{xy | x Î A or y Î B}
j.
{xy | x Î A and y Î B}
k. {w | w Ï A}
l.
{w1w2…wn | n > 0 and each wi
Î A }
m. {w1w2…wn
| n ≥ 0 and each wi Î A}
3. Let S = {a, b}. Give regular expressions for
the following languages. (For full
credit, keep them as simple as possible.)
(5 points each)
a. L1 = {wÎS* | the length of w is a multiple of 3}
b. L2 = {wÎS* | every a, if there is one, is followed immediately
by a b}
c. L3 = {wÎS* | w does not begin with aa}
6.
The procedure CONVERT(G) takes a GNFA
G and returns a regular expression that denotes L(G).
a. In the procedure, when qrip is removed from the GNFA, the transition label between qi and qj is replaced by what regular expression (refer to
diagram below)? (5 points)
b. Consider the following GNFA
with start state s and accept state a.
i.
Let qrip be state 3. What would the label of the transition from
state s to state a become? (5 points)
ii. Let qrip be state
3. What would the label of the
transition from state 2 to state 2
become? (5 points)
7. Using the construction to
convert a Regular Expression to an NFA, draw an NFA that accepts (ab)*. (5 points)
8. The Cross-product
construction was used to prove that the class of regular languages is closed
under union, intersection, and set difference.
The construction was the same except for the designation of F, the set
of final states. Give the formal
notation for the set of final states for each of the following: (The construction is given below as a
reference.) (6 points)
a.
F =
_______________________________
b. Intersection
F =
_______________________________
c. Set difference
F =
_______________________________
Cross-product construction
Let M1
= (Q1, S, d1, q1, F1)
and M2 = (Q2, S, d2, q2, F2).
Construct M =
(Q, S, d, q0, F) where
Q = Q1 ´ Q2 = {(r1, r2)
| r1 Î Q1 and r2
Î Q2},
d((r1, r2), a) = (d(r1, a), d(r2, a)) for each (r1,
r2) Î Q and each a Î S,
q0 = (q1,
q2), and
F = ….
9. Let S = {a, b}. Using the equivalence relation RL (given below for
reference) defined in the Myhill-Nerode Theorem, show that any DFA accepting L
= {wÎS* | w contains an even number of
a's and exactly one b} has at least 5 states. (10 points)
The equivalence relation RL is defined for any
language L as follows:
x RL y if and only if for all z Î S*
xz Î L Û yz Î L
10. Let S = {a, b}. Use the Pumping Lemma to show
that the following language is not
regular. (9 points)
A = {aibj | i £ j}