assignment 1, due - nju.edu.cn

6
Assignment 1, Due: Oct 17th Sep 2017 Name: Major: Grade: ID: Problem 1 Provide DFAs for the following languages. (a). The set of strings x in with 011 as a substring. {0,1} (b). The set of strings x in such that the substring 012 appears in x for an even number of {0,1,2} times. (c). The set of all strings in such that each block of five consecutive symbols contain at least {0,1} two 0's.

Upload: others

Post on 11-Feb-2022

5 views

Category:

Documents


0 download

TRANSCRIPT

Assignment 1, Due: Oct 17th Sep 2017 Name: Major: Grade: ID: Problem 1 Provide DFAs for the following languages.

(a). The set of strings x in with 011 as a substring. {0,1} ∗

(b). The set of strings x in such that the substring 012 appears in x for an even number of {0,1,2} ∗

times.

(c). The set of all strings in such that each block of five consecutive symbols contain at least {0,1} ∗

two 0's.

Problem 2 Consider the following ε-NFA

(a). Compute the -closure of each state. (b) Give all the strings of length three or less accepted by the automaton. (c) Convert the automaton to a DFA.

Problem 3 Write regular expressions for the following languages: (a) The set of all strings with at most one pair of consecutive 1's. (b) The set of all strings of 0's and 1's and not containing 101 as a substring. (c) The set of strings of 0's and 1's whose number of 0's is divisible by five and whose number of 1's is even.

ε

Problem 4 Give a DFA as figure below, please give the regular expression for the following : (1) R kij

(2) (3) (4) (5) (6)Please give the RE for this DFA R 033 R 0

12 R 412 R 0

11 R 411

Problem 6 Let L1 and L2 be language over a common alphabet .Define the interleave of L1 and L2 to be . Prove that if L1 and L2 are In(L1,L2) = {s1t1s2t2...sn|si,ti ∈ ,s1s2...sn ∈ L1,t1t2...tn ∈ L2} regular, then is also regular In(L1,L2)

Problem 5 Prove that the following are not regular languages.

(a) . {0n1m| n ≤ m}(b) . {1n|n is prime}(c) {0n1m|The greatest common divisor of m and n is 1}

Problem 7 Consider the following language L over the alphabet . = {a,b,c}

L = {akblcm│k,l,m ≥ 0 and if k = 1 then l = m}.

It is known that even though L is non-regular,it still satisfies the conditions of the pumping lemma for regular languages. (a). Assume that the pumping lemma constant n is sufficiently large, say n > 4.Consider the following three strings in L: blcm,abmcm,a2blcm, and a3blcm

where and . For each of these strings,show that there does exist a way of decomposing l > n m > nthem into xyz such that the decomposition satisfies the pumping lemma, in that (1) (2)y ≠ ε ; |xy|

and, (3)for all ≤ n; i ≥ 0,xyiz ∈ L.(b).In general, it can be shown that a decomposition consistent with the pumping lemma can be obtained for any string which is longer than n. This means that although L is non-regular, w ∈ Lwe cannot use the pumping lemma to show that L is non-regular. Explain why this does not contradict the pumping lemma. (c)Show that the language L is non-regular. (Hint: Clearly, by part(a), you cannot directly use the pumping lemma. Consider using closure properties of regular languages to convert L into a language where you can indeed use the pumping lemma.)

Problem 9 Textbook Exercise 4.2.12

Problem 8 Textbook Exercise 4.2.11