advertisement

Quiz 2

Formal Language and Automata Theory 2014/11/26

Name:_______________ Reg.No.:_______ _ __________ Score:________________

1 (16pts) Given a DFA M = (Q,

,

,s,F), where Q = { k | 0

k

44 },

={5, 9}, s=1, F={43,44}, and

: Q x { 5,9 } Q with

(k,n) = (k + n) mod 45.

1.1 Which of the following states are reachable(accessible) from the initial state 1?

(a) 12 (b) 23 (c) 33 (d) 40 (e) 43

1.2 Which of the following states can reach a final state?

(a) 1 (b) 22 (c) 32 (d) 14 (e) 35

1.3 There are __________ states that are reachable from the initial state.

1.4 There are __________ states that are reachable from the initial state and can reach at

least one final state.

2 (12 pts) Let A = L(M) where M is the DFA given in the figure, and h be a homomorphism from

{0,1}* to {a,b}* with h(0) = b and h(1) = aa. Find a DFA N such that L(N) = h -1 (A). Draw a state transition diagram for N as your answer.

3 [18 pts] Find a regular expression equivalent to the following DFA by removing state 1 and 2.

3.1 What is the resulting FA after removing state 1 ?

3.2 What is the resulting FA after removing state 1 and 2 ?

3.3 What is the resulting regular expression ?

1

3. (16 pts) We want to apply the game-theoretic version of pumping lemma to show that the language P = { 1 n 01 n | n

0 } is not regular. Fill in the following procedure to derive a winning strategy for Y:

(a) Suppose D picks a number k > 0.

(b) Y choose a string xyz

P with x = ____, y = _____ and z = _______. What is the restriction the selected xyz must obey? ________________________________________________

(c) Suppose D decomposes y into uvw. What are the constraints that decomposition uvw must satisfy : ____________________________________________

(d) How should Y choose i : ____________________

Under what condition will we say that Y wins the game?

_________________________________________________

Explain briefly why Y always win the game according to the strategy you wrote at step (b) and

(d) :

_________________________________________

4. [9pts] Apply the same procedure like problem 3 to show that the language B = { 0 m 1 n | gcd(m,n) =

1 } is not regular.

(a) Suppose D picks a number k > 0.

(b) You choose a string xyz

B with x = _____, y = ____, z = ________.

(c) Suppose D decomposes y into uvw, where ______________________

(d) You choose I = _______________________ .

Since _____________________________________

_____________________________________

,Y always wins the game. B thus is not regular.

5. [20pts] Find an equivalent NFA and an equivalent DFA for each of the following regular expressions :

(a) (aaa+aa)*

(b) (ab)*a+(ba)*b. Give your answer using state transition diagram.

2

6. [24pts] Given the following DFA :

\ Q

0 1 a 3 6 b 5 3

2

6

4

3

6

6

4F

0

5

5F

2

4

6

1

6

(a) Complete the following table to determine all pairs of states that are not equivalent. Each cell of the table should be filled with a number equal to the length of a minimal string that can witness the inquivalence of the corresponding pair of states provided both states in the pair are not equivalent. [15pts]

1

2

3

4

5

6

0 1 2 3 4 5

(b) 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.

3