Exercise 1
Problem 1 (Sudkamp Ch6: Problem 30)
Let M be the following NFA-
b
, a
q0
q1
a
b
b
q2
q3
b
a
a) Use subset construction algorithm to construct a state diagram of an equivalent DFA
b) Give a regular expression for L (M)
Solution:
a) Give the input transition function t for M.
t
a
b
q0
{q1 }
{q1 , q 2 , q3 }
q1
{q1 , q3 }
q2
{q0 , q1 , q3 }
{q2 }
q3
{q0 , q1 , q3 }
{q2 , q3 }
1
b) Use subset construction algorithm to construct a state diagram of a DFA that is
equivalent to M.
a
a
{q0, q1}
{q1}
b
a,b
b
{q1, q3}
b
a
a
{q1, q2,q3}
{q0, q1, q3}
b
b
a
c) Give a regular expression for L (M).
( a)(b * (b a ) ab * )
Problem 2 (Sudkamp CH7 Problem 5)
Given the following NFA M
a
a
a
q1
q0
q2
b
b
a) Construct a regular grammar from M that generates L (M)
b) Give a regular expression for L (M)
2
Solutions:
(a) Construct a regular grammar from M that generates L (M)
G : S aA
A aA aB bS
B bA
(b) Give a regular expression for L (M)
For final state q0:
a
a
a
q1
q0
q2
b
b
aa*b
ba*a
aa*a
q2
q0
ba*b
aa*b, aa*a(ba*a)*ba*b
q0
G1: (aa *b aa * a(ba * a) * ba *b) * (a b (a a(ba ) * ba *b)) *
For final state q2:
a
a
q0
a
q1
qq22
b
b
aa*b
ba*a
aa*a
q0
qq22
*
ba b
G2:
(aa *b) * aa * a(ba * a ba *b(aa *b)* aa * a) * (a b) * a a(ba ba *b(a b) * a a) *
So G G1 G2
= (a b (a a(ba ) * ba *b)) * (a b) * a a(ba ba *b(a b) * a a) *
3
© Copyright 2026 Paperzz