{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw3-sol

# hw3-sol - ECS 120 Theory of Computation Homework 3 Due Oct...

This preview shows pages 1–2. Sign up to view the full content.

ECS 120: Theory of Computation Homework 3 Due: Oct. 19, beginning of class or 1pm in 2131 Kemper Problem 1. 1.19 in Sipser. 0,1 0 1 0 0 1 1 q0 q1 q2 q3 1 0 1 0 1 0 0 1 q0 q1 q2 q3 q4 H 0,1 q0 q1 Problem 2. 1.48 in Sipser. Soln: A DFA cannot “count” the number of occurences of 01’a and 10’s, so we need a trick. Notice that any string s ∈ { 0 , 1 } is one and only one of the following, where n 1 and i j 1: (a) ε (b) 0 i 1 1 i 2 0 i 3 . . . 1 i n - 1 0 i n (begins and ends with a 0) (c) 1 i 1 0 i 2 1 i 3 . . . 0 i n - 1 1 i n (begins and ends with a 1) (d) 0 i 1 1 i 2 0 i 3 . . . 0 i n - 1 1 i n (begins with a 0 and ends with a 1) (e) 1 i 1 0 i 2 1 i 3 . . . 1 i n - 1 0 i n (begins with a 1 and ends with a 0) Now, strings of the form (a), (b) and (c) are in D , and strings of the form (d) and (e) are not in D (just count the number of occurences of 01 and 10 in each). Therefore, a string x ∈ { 0 , 1 } is in D if and only if x starts and ends with the same character or x = ε . So D is described by the regular expression ε 0 1 1(0 1) 1 0(0 1) 0, hence it is regular.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}