Presentation is loading. Please wait.

Presentation is loading. Please wait.

Transparency No. 2-1 Formal Language and Automata Theory Homework 3.

Similar presentations


Presentation on theme: "Transparency No. 2-1 Formal Language and Automata Theory Homework 3."— Presentation transcript:

1 Transparency No. 2-1 Formal Language and Automata Theory Homework 3

2 Homework Transparency No. 2-2 NFA-  and NFA-  to DFA 1. Let N1 be an NFA allowing empty transition as shown in the table: 1.1 If N1=(Q, , ,S,F) then Q= _______________  = _______________  = _______________  S = _______________  F = ________________ 1.2 Draw a state transition diagram for N1. 1.3 Find all strings which have length  2 and are accepted by N1. 1.4 Find the empty-transition closure(EC) of {p},{q},{r}and {p,q}, respectively. 1.5 Find a DFA M1 equivalent to N1. Remember to name each state of M2 with the corresponding state subset of N1 and M1 should not contain useless state.. Q\  U{  } 01  >pqrq >qFp,rqr rF-q-

3 Homework Transparency No. 2-3 Reqular expressios to NFA 2. Regular expressions to NFA conversions: 2.1 Find an NFA N21 with no more than 4 states for the language L= { a n | n  0 } U {b n a | n  1} 2.2 Find an NFA N22 with no more than 3 states accepting the language represented by the regular expression: (ab + abc)* 2.3 Find an NFA N23 with no more than 5 states accepting the language which represented by the regular expression: aba(b*) + ab(a*). Note that you can use empty transition in you NFA.

4 Homework Transparency No. 2-4 FA to regular expressions 3. For each of the following automata, derive a regular expression equivalent to it. Note you should give the whole process instead of just a regular expression as your answer.  

5 Homework Transparency No. 2-5 4. Closure properties of NFA 4. Given the NFA M : 4.1 Find a NFA M1 such that L(M1) = { xyz | x,z  {a,b}* and y  L(M)}. 4.2 Find a NFA M2 such that L(M2) = { xy | x  {a,b}* and y  L(M)}. 4.3 Find a NFA M3 such that L(M3) = { yz | y  L(M) and z  {a,b}* }. Give your answers using state transition diagram.

6 Homework Transparency No. 2-6 Regular languages are closed under the shuffling operation 5. If x = x 1 x 2 … x m and y = y 1 y 2 … y n are two strings of length m and n, respectively. Then a shuffling of x and y is an order-preserving permutation of x 1 x 2 … x m and y 1 y 2 … y n, i.e., a string z = z 1 z 2 … z m+n of length m+n s.t. there are positions 1  s 1 <s 2 <…<s m  m+n, 1  t 1 <t 2 <…<t n  m+n, with { s 1,…, s m, t 1,…, t n } = {1,…,m+n} and x = x s1 x s2 … x sm and y = y t1 y t2 …y tn. For two strings x and y, let (x || y) denotes the set of all shufflings of x and y. For example, if x = a and y = 01, then x||y = { a01, 0a1, 01a}. And if x = ab and y = 01, then x || y = {a} (b || 01) U {0} ( ab || 1) = {a}{b01,0b1,01b} U {0}{1ab, a1b, ab1} = {ab01,a0b1, a01b, 01ab, 0a1b.0ab1}. We can extend the definition of || to languages by the equation: A || B = def U x  A and y  B (x || y )

7 Homework Transparency No. 2-7 5.1 What is the set baba || 01 ? 5.2 give an inductive (or recursive) definition of (x||y). 5.3 if A= {aa, bbb }, then what is A || A ? It can be shown that regular languages are closed under ||, i.e., if A and B are regular languages, then so is A || B. The intuition is that, given two FA M1, M2 accepting A and B, respectively, consider a new machine M3 with M1 and M2 as consulting machines such that for each input symbol a, M3 uses either M1 or M2 non-deterministically to consume the symbol and the other machine remain unchanged of state. Finally M3 accepts if both submachine stay at their final state when the input string is used up. Accordingly, if M1 = (Q1, ,  1, S1, F1) and M2 = (Q2, ,  2, S2, F2), we have M3 = (Q3, ,  3, S3, F3) where Q3 = Q1XQ2, S3 = S1xS2, F3 = F1XF2 and  3 = { ( (p,s), a, (q,s)) | (p,a,q)   1 and s  Q2 } U { ( (p,s), a, (p,t)) | p  Q1 and (s,a,t)   2 }.

8 Homework Transparency No. 2-8 Regular languages are closed under || operation 5.4. Given the following two DFAs : Construction a NFAs M3 such that L(M3) = L(M1) || L(M2). Use state transition table for your answer. M1ab >pFqr qrp rFpq M2ab >sts tFst M3ab >ps qs rs pt F qt rt F


Download ppt "Transparency No. 2-1 Formal Language and Automata Theory Homework 3."

Similar presentations


Ads by Google