Questions 1 (a) and 3 (a) corrected on 17 December 2004.

There are five questions for 120 total points.

When your answer to a problem is a particular number, you may use
exponents, falling exponents, factorials, and/or the "choose" notation
to indicate the number. However, if the answer is *less than 100*,
you must give the number in ordinary decimal notation for full credit.

Many of the questions involve the following three regular languages
over the alphabet {a,b,c}.
The language X is denoted by the regular expression
a^{*}b^{*}c^{*}, the language Y is denoted by the
regular expression a^{*}b^{*}, and the language Z is denoted
by the regular expression a^{*}.

**Question 1 (30):**

In this problem we will construct, in a roundabout way, a DFA whose language is X.

- (a,5) Using our construction carefully and using the given regular expression, give a λ-NFA whose language is X. Your answer should have ten states and satisfy the rules of the construction. (I originally said "twelve states".)
- (b,5) Give a smaller λ-NFA whose language is X. (The fewer states you have, the easier the remaining parts of this problem will be. It is possible to have only three states.)
- (c,10) Give an ordinary NFA (with only letter moves) whose language is X, built from your answer to (b).
- (d,10) Using the subset construction and your answer to (c) or otherwise, give a DFA whose language is X.

**Question 2 (15):**
These questions involve the language Q = {a^{i}b^{j}c^{i+j}:
i,j ≥ 0}.

- (a,10) Does there exist a DFA whose language is Q? Prove your answer.
- (b,5) Describe (informally) how a Turing machine could be designed to decide whether its input string is in Q.

**Question 3 (20):**
Prove the following statements, carefully explaining your use of quantified proof
rules. The languages Y and Z are defined above. The type of variables u, v, and w
is "string over {a,b,c}" and the type of the variable n is "natural".

- (a,10) ∃u:∀v:(v∈Y→vu∈(Y-Z)). (The minus sign denotes set subtraction.) (I originally said "(Z-Y)" instead of "(Y-Z)".)
- (b,10) ∀u: (u∈Y)→[∀n:∃v:∃w: (|w|≥n)∧(w∈Y)∧(uv=w)]. (Here |w| denotes the number of letters in w. Hint: Let u be arbitrary and then use induction on n.)

**Question 4 (20)**:
This question involves certain boolean statements. For any positive natural n,
we define a compound statement P_{n} using the boolean variables
x_{1},...,x_{n}. P_{1} is the statement "1" or "true".
For n>1, P_{n} is defined recursively, as P_{n-1}∧
(x_{n-1}→x_{n}).

- (a,10) Prove, using propositional rules or a truth table, that P
_{3}implies the statement "x_{3}∨¬x_{1}". - (b,10) Prove that for any positive natural n, if P
_{n}is true and x_{n}is false, then all the variables are false. (Hint: Use induction on n, with care for the base case.) - (c,15) Let r(n) be the number of settings of the variables x
_{1},..., x_{n}that make P_{n}true. (This is the number of rows in the truth table for P_{n}that have a one for the entire statement.) Prove that for all positive naturals n, r(n) = n+1.

**Question 5 (20)**:
Let f(n) be the number of strings of length n in the language X defined above.
Let g(n) be the number of strings of length n in Y, and let h(n) be the number of
strings of length n in Z.

- (a,5) Find the value of f(4) and find a general formula for f(n). (Hint: This is a case of one of the four basic counting problems.)
- (b,5) If we choose a string of length n over the alphabet {a,b,c} at random, with all strings being equally likely, what is the probability that the string is in X? What is this value when n=4?
- (c,10) Give a combinatorial proof that for any positive natural n, f(n) = f(n-1) + g(n-1) + h(n-1).

Last modified 17 December 2004