Questions are in black, answers in blue.
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.
Whoops, I made a mistake -- there are only ten states. States are {1,...,10}, start state is 1, only final state is 10. There are three letter moves: (2,a,3), (5,b,6), and (8,c,9). Then there are λ-moves from 1 to 2, 2 to 3, 3 to 2, 3 to 4, 4 to 5, 5 to 6, 6 to 5, 6 to 7, 7 to 8, 8 to 9, 9 to 8, and 9 to 10.
States {1,2,3}, start state 1, final state set {3}, λ-moves 1 to 2 and 2 to 3, a-loop on 1, b-loop on 2, and 3-loop on 3.
Letter move (1,a,1) causes itself, (1,a,2), and (1,a,3).
Letter move (2,b,2) causes (1,b,2), (1,b,3), itself, and (2,b,3).
Letter move (3,c,3) causes (1,c,3), (2,c,3), and itself.
State 1 becomes final so the new state set is {1,3}.
Start state is {1}, a-move to {1,2,3}, b-move to {2,3}, c-move to {3}.
{1,2,3} has a-move to itself, b-move to {2,3}, c-move to {3}.
{2,3} has a-move to ∅, b-move to itself, and c-move to {3}.
{3} has a-move and b-move to emptyset, c-move to itself.
∅ has a-move, b-move, and c-move to itself.
All the states except ∅ are final.
Minimization would merge the states {1} and {1,2,3} to get a four-state DFA.
Question 2 (15): These questions involve the language Q = {aibjci+j: i,j ≥ 0}.
There does not exist such a DFA, because Q has infinitely many Myhill-Nerode equivalence classes. We can demonstrate this by giving an infinite set of strings that are pairwise Q-distinguishable. Such a set is {ai: i≥0}. If u = ai and v = aj where i≠j, we can let w = ci and then uw is in Q (because i+0=i) and vw is not in Q (because j+0≠i). So these two strings are Q-distinguishable and the given set is pairwise Q-distinguishable.
The Turing machine can first check that the string is in a*b*c* and reject if it is not. Then it returns to the left of the string and repeatedly carries out the following: Delete the first a or b, move to the right of the string, delete the final c, and move to the left again. If it has the empty string left when it has finished a pair of deletions, it accepts. If it has only a's and b's or only c's left, it rejects.
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".
Whoops, another mistake, I meant "Y - Z" instead of "Z - Y" -- the statement as given
is not true.
Let u be the string "b", let v be arbitrary, and assume that v is in Y. Then v must
be aibj for some naturals i and j, possibly zero. The string vu
is then aibj+1. This string is in Y because it is a string of zero
or more a's followed by a string of zero or more b's. It is not in Z because it contains
the letter b and no string in Z contains the letter b. So it is in Y - Z, and we have
completed a direct proof of the implication. Since v was arbitrary, we have proved
∀v:(v∈Y→vb∈(Y-Z). Since we found a u that worked, we have proved
the entire statement.
Let u be arbitrary and assume that u is in Y. Let k be the length of u. If n≤k we can prove the desired statement by letting v be λ and letting w be u -- then |w| = k ≥ n and w is in Y by the assumption on u. We prove the statement for all n with n ≥ k by induction. The base case of n = k is already proved as part of the case with n ≤ k. Assume that we have strings v and w making the statement true for a particular value of n. Let v' = vb and let w' = wb. Then uv' = w', w' is in Y, and |w'| = |w| + 1 ≥ n + 1 by the IH. This completes the induction and thus proves the statement for all n. This proves the implication, and since u was arbitrary we are done.
Question 4 (20): This question involves certain boolean statements. For any positive natural n, we define a compound statement Pn using the boolean variables x1,...,xn. P1 is the statement "1" or "true". For n>1, Pn is defined recursively, as Pn-1∧ (xn-1→xn).
P3 is the statement "(x1 → x2) ∧ (x2 → x3). Assume that P3 is true. We prove the desired statement by cases. If x1 is false, the desired statement follows by left joining. If x1 is true, x2 follows by modus ponens from the first implication of P3 (which is true by left separation). Then x3 follows by modus ponens from x2 and the second implication of P3, which is true by right separation. Both cases make the conclusion true, so we have proved the conclusion from the assumption of P3.
The base case is n=1, and P1 is the constant "true". Clearly in this case
if xn = x1 is false, all the variables are false because there
is only one variable.
Now assume as IH that if Pn is true and xn is false, then all the
variables (x1 through xn) are false. Assume that Pn+1
is true and that xn+1 is false. By the definition of Pn+1, we
know that Pn and (xn → xn+1) are both true.
Then xn must be false, because otherwise the new implication would make
xn+1 true and we know that it is false. So Pn is true and
xn is false, and the IH tells us that all the first n variables are false.
Since the last variable is false, all n+1 variables are false and we have proven the
n+1 case of the statement and completed our inductive step.
Since we are doing induction on positive naturals, the base case is n=1.
Since P1 is "true", all settings of one variable make it true and r(1) = 2.
Since 2 = 1 + 1 is the desired answer, we have proven the base case.
Now assume that r(n) = n+1 and examine the case of n+1 variables.For Pn+1
to be true, Pn and (xn → xn+1 must both be true.
If xn+1 is true, then the last implication is definitely true and the whole
statement is true if and only if Pn is. This, by the IH, happens in r(n)
= n+1 settings of the first n variables. If xn+1 is false, by the result
of part (b) we know that all the variables must be false to make Pn+1 true.
This gives us one more setting making it true, for n+2 in all. We have shown that
r(n+1) = n+2, completing the inductive step.
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.
The general solution is an instance of the fourth counting problem, since there is only one correct order for a given multiset of letters. We have n choices from three possible letters, so the solution to the fourth problem gives us (n+2 choose 2). In the case of n=4 the total is (6 choose 2) or 15.
There are 3n strings of length n in all, so the probability is (n+2 choose 2)/3n. In the case of n=4 this is 15/81 or 5/27.
Let w be an arbitrary string in X of length n, where n is an arbitrary positive natural. Let u be the first n-1 letters of w. If the last letter of w is an a, then u must be in Z, and if u is any string in Z of length n-1, then ua is in X. If the last letter of w is b, then u is in Y, and if u is in Y, then ub is in X. If the last letter of w is c, then u is in X, and if u is in X, then uc is also in X. We have divided the length-n elements of X into three disjoint subsets. One bijects with the elements of Z of length n-1, one with the elements of Y of length n-1, and the third with the elements of Z of length n-1. By the Sum Rule and the definitions of the three functions, we have that f(n) = f(n-1) + g(n-1) + h(n-1).
Last modified 17 December 2004