3
Jaypee Institute of Informtion Technology University Noida Computer Science Deprtment Problem Set 1 PART A PROBLEM 1 (2+2+2+2 points) Suppose A, B Σ * are languages. In each of the following cases, briefly prove or give a counterex- ample to (i) C D and (ii) D C . (A) C =(A B) * and D = A * B * (B) C = A * and D = A * (C) C =(A B) * and D = A * B * (D) C =(AB) * and D = A * B * Solution. PROBLEM 2 (4 points, suggested length of 1/4 of a page) Show that if A, B Σ * are regular languages, then the language A t B defined by A t B = {u 1 w 1 u 2 w 2 ··· u n w n : u 1 ,w 1 ,...,u n ,w n Σ * , u 1 ··· u n A, and w 1 ··· w n B} is also regular by providing the 5-tuple representation of an NFA recognizing A t B in terms of DFAs for A and B. (Hint: look at the cross-product construction.) Solution. PROBLEM 3 (Challenge! 3 points) An equivalence relation on Σ * is called a congruence if for any two strings u, w Σ * and any letter σ Σ, if u w then . The relation is said to be closed with respect to the language A Σ * if for any strings u A and w Σ * , if u w then w A. Show that A is regular if and only if there is a congruence with finitely many equivalence classes that is closed with respect to A. Solution.

Tutorial

  • Upload
    sunny

  • View
    214

  • Download
    1

Embed Size (px)

DESCRIPTION

theory of computation

Citation preview

Page 1: Tutorial

Jaypee Institute of Informtion Technology University Noida

Computer Science Deprtment Problem Set 1

PART A

PROBLEM 1 (2+2+2+2 points)

Suppose A,B ⊆ Σ∗ are languages. In each of the following cases, briefly prove or give a counterex-ample to (i) C ⊆ D and (ii) D ⊆ C.

(A) C = (A ∩B)∗ and D = A∗ ∩B∗

(B) C = A∗

and D = A∗

(C) C = (A ∪B)∗ and D = A∗ ∪B∗

(D) C = (AB)∗ and D = A∗B∗

Solution.

PROBLEM 2 (4 points, suggested length of 1/4 of a page)

Show that if A,B ⊆ Σ∗ are regular languages, then the language A tB defined by

A tB = {u1w1u2w2 · · ·unwn : u1, w1, . . . , un, wn ∈ Σ∗, u1 · · ·un ∈ A, and w1 · · ·wn ∈ B}

is also regular by providing the 5-tuple representation of an NFA recognizing A t B in terms ofDFAs for A and B. (Hint: look at the cross-product construction.)

Solution.

PROBLEM 3 (Challenge! 3 points)

An equivalence relation ∼ on Σ∗ is called a congruence if for any two strings u,w ∈ Σ∗ and anyletter σ ∈ Σ, if u ∼ w then uσ ∼ wσ. The relation ∼ is said to be closed with respect to thelanguage A ⊆ Σ∗ if for any strings u ∈ A and w ∈ Σ∗, if u ∼ w then w ∈ A.

Show that A is regular if and only if there is a congruence with finitely many equivalence classesthat is closed with respect to A.

Solution.

Page 2: Tutorial

PART B

PROBLEM 4 (3+3+3 points, suggested length of 1/3 of a page)

Are the following statements true or false? Justify your answers with a proof or counterexample.

(A) If L ⊆ {a, b}∗ is a regular language, then the language that consists of all the strings in L whichdo not contain ba is regular.

(B) Let D be a DFA. Then, D contains a cycle if and only if L(D) is infinite.

(C) Complementing all states in a DFA M (making the final states non-final and vice-versa) willresult in a new DFA M ′ such that L(M ′) = Σ∗ − L(M).

Solution.

PROBLEM 5 (6 points, suggested length of 1/3 of a page)

Let Sn ⊆ {a, b, c}∗ be the language of strings of length n where b appears an even number of times.If sn = |Sn|, show that

sn = 3n−1 + sn−1

Use this fact to find the value of sn in closed form (i.e. in terms of only of n).

Solution.

PART C

PROBLEM 6 (3+3+3 points)

Describe informally the language represented by the following regular expressions and DFA.

(A) ((a ∪ b ∪ c)(a ∪ b ∪ c)b)∗(a ∪ b ∪ c)(a ∪ b ∪ c)

(B) b∅∗a ∪ ab ∪ ba∅ba

(C) ll l

lh

l..........................

���

�������

����@@R

@@R@@I

@@I

a

a

b

b

b

baa

Solution.

Page 3: Tutorial

PROBLEM 7 (6 points)

Convert the following NFA into a DFA using subset construction. Provide a formal description(5-tuple) and digram for full credit.

0 1 3

2

a

a

a

b

b

b

Solution.