Homework

advertisement
Formal Language
and Automata Theory
Homework 4
due 11/24
Transparency No. 1
Homework
1. Homomorphism
1. Let A = L(M) where M is the DFA given in the figure, and h be a
homomorphism from {a,b}*  {a,b}* with
h(a) = ab
and
h(b) = a.
1.1 Find a DFA N1 such that L(N) = h(A),
1.2 Find a DFA N2 such that L(N) = h-1(A)
Give your answer Using state-transition diagram
b
a
0
a
b
1
b
2
a
a
3
b
Transparency No. 2
Homework
2. Pumping lemma and closure properties of regular languages
2. Using (game-theoretical version of ) pumping lemma to show the
following two sets are not regular:
2.1
A1 = { x x | x  {0,1}* }
2.2
A2 = {an bm | 0  n  m  2n+10 }
Using closure properties of regular languages to show that :
2.3 If A1 is not regular, then neither is the language A3={ xcx | x 
{0,1}* }
2.4 if the language Prime={ ap | p is a prime number } is not
regular, then neither is the language A4 = { ambnct | (m+n+t) is not
a prime number }.
Transparency No. 3
Homework
3. Testing Regular sets
3. Which of the following sets are regular ? Give your reason.
a)
b)
c)
d)
e)
f)
g)
{an b m | n  0 and m  0 }
{an b m | n  m, n  0 and m  0 }
{ak y | k  0, y  {a,b}* and y contains at least k a’s }
{xcy | x, y  {a,b}* }
{an b m | n +10  m }
{an bm | n > m and m < 20 }
{an b m | n > m > 20 }
Transparency No. 4
Homework
4 Closure property of regular languages
4. For any two strings x and y, define their difference |x – y| as follows: If x = x1 x2 … xm is
a string of length m and y = y1 y2 …yn is a string of length n, then
|x – y | =  if m n or
k if m = n and k is the size of the set { t | 1  t  m ,xt yt }
So, for example, if x = baabb and y = bbaaa then |x- y| = 3 .
Now for any language A over the alphabet {a,b}, and k  0, define the set AK = { y  {a,b}*
| x A with |x-y|  k }
4.1 If B = {b, aa, bab, aab}, then what are B0, B1 and B2 ?
4.2 It can be shown that if A is a regular language then so are A0 and A1. Can you give a
proof ? [optional;可以不做]
4.3 With a finite automata M given at the right,
a,b
b
find a NFA N such that L(N) = L(M)1 .
a
1
2
Give your answer using state transition diagram.
4.4 Show that for all k  0, Ak+1 = (Ak)1.
Hence, according to 3.2 and 3.4, if A is regular, then so are Aks for all k  0.
Transparency No. 5
Homework
5. Minimization of DFA
5. Apply the minimization algorithm to find a minimal DFA
equivalent to the right one.
5.1 Draw the chart table
2
3
4
5
6
7
8
1
2
3
4
5
6
7
5.2 Mark each cell corresponding to a pair {p,q} of states p,q that
are not equivalent with a number indicating the length of a minimal
string which witnesses their inequivalence.
5.3 Draw a state-transition table (or diagram) for the resulting DFA
and indicate clearly which equivalence class of the old DFA
corresponds to each state of the new one.
a
b
1
F
6
4
2F
7
5
3
2
8
4
1
8
5
2
6
6
3
1
7
5
2
8
4
2
Transparency No. 6
Homework
6. Minimization of DFA
6. For the given FA,
6.0 find all states which are inaccessible.
After removing all inaccessible states from
the FA, apply the minimization algorithm to
the resulting DFA to find a minimal DFA:
6.1 Draw the chart table
6.2 Mark in the table each cell {p,q} of states
p,q that are not equivalent with a number
indicating the length of a minimal string
which witnesses their inequivalence.
6.3 Draw a state-transition table (or diagram)
for the resulting DFA and indicate clearly
which equivalence class of the old DFA
corresponds to each state of the new one.
a
b
1
1
3
2F
6
3
3
5
7
4F
6
1
5
1
7
6F
2
7
7
5
3
8
4
1
Transparency No. 7
Download