CMPSCI 601: Theory of Computation

David Mix Barrington

Fall, 2004

Homework Assignment #1

Solutions posted Thu 4 Nov 2004

Covers Lectures 1-5

Question text in black, solutions in blue.

These problems deal with four formal languages over the alphabet {0,1}. Define the following function f from {0,1}* to the integers: f(λ) = 0 and for any string w, f(w0) = f(w) - 1 and f(w1) = f(w) + 1. (Recall that λ is the empty string.)

A is defined to be the language {w: f(w) = 0}.

B is the language {w: f(w) = 0 and for all v, if v is a prefix of w then f(v) ≥ 0}.

C is the language {w: w is in B and for all v, if v is a prefix of w then f(v) ≤ 3}.

Finally, D is the language {w: w is in B and for all v, if v is a prefix of w then f(v) ≤ 1}. (This said "f(w) ≤ 1" before, which makes D the same language as B.)

(Recall that string u is a prefix of string v if there is a string x such that ux = v.)

Last modified 4 November 2004