Professional Documents
Culture Documents
Problem B1 (40 pts). Let R be any regular language over some alphabet . Prove that
the language
L = {u | v , uv R, |u| = |v|}
is regular.
where s0 is a new state not in Q, and the transition function 2 is defined as follows: for
every a and every (p1 , p2 ) Q Q,
(q1 , q2 ) 2 ((p1 , p2 ), a)
iff
(p1 , a) = q1 and (b )((q2 , b) = p2 )
and
(q0 , f ) 2 (s0 , ) iff f F.
Then, we can show by induction on |u| that
(q1 , q2 ) 2 (s0 , u)
iff
(q0 , u) = q1 and (q2 , v) F for some v such that |u| = |v|.
1
The base case w = is easy. For the induction step, if we write w = ua with a , then we
have [
2 (s0 , ua) = 2 ((s1 , s2 ), a).
(s1 ,s2 ) 2 (s0 ,u)
(q0 , u) = s1
and if there is some v such that |u| = |v| and (s2 , v) F . Also, (q1 , q2 ) 2 ((s1 , s2 ), a)
iff
(s1 , a) = q1
and if there is some b such that
(q2 , b) = s2 .
Then, we get
(q0 , ua) = ( (q0 , u), a) = (s1 , a) = q1
and
(q2 , bv) = ((q2 , b), v) = (s2 , v) F
with |ua| = |bv| since |u| = |v|. Therefore, (q1 , q2 ) 2 (s0 , ua) iff
(q0 , ua) = q1
(q2 , bv) F
(q, q) 2 (s0 , u)
iff
(q0 , u) = q and (q, v) F for some v such that |u| = |v|,
and thus,
(q0 , uv) = ( (q0 , u), v) = (q, v) F,
so that uv L(G). This proves that L(N ) = L.
Another solution consists in first guessing the state, p, in which D will end up on input
u and to run in parallel, Dp = (Q, , , q0 , {p}), with p as only final state, with the copy, Dp0 ,
of D, where Dp0 is the NFA D with start state p, which, from any state, q, makes moves on
all input a if there is some transition from q. Formally, we can define the NFA
2
such that, for every a ,
(q1 , q2 , p) 0 ((p1 , p2 , p), a)
iff (p1 , a) = q1 and there is some b such that (p2 , b) = q2 , and
for all p Q.