Question text is in black, solutions in blue.
Q1: 30 points Q2: 30 points Q3: 30+10 points Q4: 30 points Total: 120+10 points
Here are definitions of some terms, sets, predicates, and statements used on this exam.
Question 1 deals with the following scenario:
During one cold week in December, each dog in the set S = {c, d, n, p} = {Cardie, Duncan, Nina, Pushkin} went for a walk on each day in the set Y = {Mon, Tue, Wed, Thu, Fri}. On each day, each dog chose whether to wear a coat, based on the temperature that morning.
Let Z be the set of integers {..., -3, -2, -1, 0, 1, 2, 3,...}. Let f be the function from S to Z defined so that f(x) is the "critical temperature" (in Celsius) for dog x: the meaning of this will come from Statement I below. Let t be the function from Y to Z defined so that t(y) is the outdoor temperature, in Celsius, on the morning of day y. Let W be the predicate defined so that W(x, y) means "dog x wore a coat on day y".
Question 1 also refers to the following four statements, where the variables are of type "dog", type "day", or type "integer":
The statements are:
N is the set of naturals (non-negative integers, {0, 1, 2, 3,...}.
The Koch snowflake is obtained by recursively defining the polygons S_{n} in the following way:
"Any given dog, on any given day, wore a coat if and only if the
outdoor temperature on that day was less than or equal to
the critical temperature for that dog."
Many people didn't get the "if and only if".
"∀x: (W(x, Tue) ↔ (x = d)) ∧ (W(x, Wed) ↔ (x ≠
n))"
Again, many people missed the "if and only if" in
each part. Some people, most of them correctly,
did this as a pure propositional statement by ANDing together the eight statements about
particular dogs on particular days.
"It is not the case that if Pushkin wore a coat on Monday and the
temperature on Thursday was -16, then the temperature on
Thursday was -16 and Cardie wore a coat on Monday."
Lots of people put the "if" before the "it is not the case", or
otherwise messed up the parentheses. Some did part or all
of the work of part (b) here, but if you just stated the
alternate form of part (b) I wanted some kind of justification.
"(t(Fri) = -17) ∧ ∃x:∃y:∀z: (x = y) ∧ (W(z,
Fri) ↔ ((z = x) ∨ (z = y))"
In order to say "exactly two dogs", you needed to say both "two different
dogs wore coats" and "no other dogs wore coats". This could be done
propositionally as well, using the fact that there are only
four dogs in the set. You could say "there were two
different dogs who wore coats, and two different dogs who
did not", for example.
This is much simpler if we assign boolean variables to the three atomicpropositions in the two statements, making Statement III into "¬((p ∧ q) → (q ∧ r)" and the alternate form into "p ∧ q ∧ ¬r". Then we can either do a three-variable truth table or make an equational sequence proof as follows:
Take Statement III, apply the Definition of Implication to get "¬(¬(p ∧ q) ∨ (q ∧ r))", apply DeMorgan (and Double Negation) to get "(p ∧ q) ∧ ¬(q ∧ r)", apply DeMorgan again to get "p ∧ q ∧ (¬q ∨ ¬ r)", apply the Distributive Law to get "(p ∧ q ∧ ¬q) ∨ (p ∧ q ∧ ¬r)", and finish by using Double Negation and the Right Zero rule for OR to reduce the first term to 0, then using the Left Identity rule for OR to remove it entirely, leaving the second term which is our alternate form.
The informal English argument is simplest: Statement II tells us Duncan feels most cold of all dogs, and Nina is the most resilient to cold. Cardie did not wear a coat on Monday, but Pushkin did. So by increasing critical temperature, the dogs are Nina, Cardie, Pushkin, Duncan. The two dogs not wearing coats on Friday must be Nina and Cardie. Thursday was warmer, so Cardie did not wear a coat.
Formally:
From II by Separation:
(¬W(x, Wed) ↔ (x = n)).
Specifying x to n, we get ¬W(n, Wed). Specifying x to c, we get W(c, Wed).
In statement I, specifying x in turn to Cardie and Nina, and y to Wednesday, we get (using the conclusions above): f(n) < t(Wed) ≤ f(c) (1)
In statement I, specifying x in turn to Cardie and Pushkin, and y to Monday, and using W(p, Mon) and ¬W(c,Mon) obtained by Separation from III, we get
f(c) < t(Mon) ≤ f(p) (2)
From II by Separation:
∀x : (W(x, Tue) ↔ (x = d)).
Specifying x to d, we get W(d, Tue). Specifying x to p, we get ¬W(p, Tue).
In Statement I, specifying x in turn to Duncan and Pushkin, and y to Tuesday,
we get (using the conclusions above): f(p) < t(Tue) ≤ f(d) (3)
From (1), (2) and (3) we get by transitivity f(n) < f(c) < f(p) < f(d)
Statement IV implies two dogs did not wear coats on Friday, these must
be Nina and Cardie; we must have f(c) < t(Fri) in order to satisfy that.
We then have f(c) < t(Fri) = -17 < -16 = t(Thu), thus f(c) < t(Thu).
Specifying x to c and y to Thu in Statement I we get ¬W(c, Thu)
TRUE. There are many regular expressions for the same language, and there are many languages, even over an single-letter alphabet, that are not regular. (We had the example of strings whose lengths are prime, or are perfect squares.)
TRUE. This relation is not transitive. For example R(a, ab) is true with w = a, R(ab, b) is true with w = b, but R(a, b) is false.
FALSE. The statement is true if the system has any solutions. But if the two congruences are inconsistent, such as a = 0, b = 1, and m = n = 2, then there are no solutions even though gcd(m, n) > 0.
TRUE. We can derive "P(w) → P(wa)" and "P(w) → P(wb)" by specifying the last implication to get "P(wab) → P(wa)" and "P(wbb) → P(wb)", then using Hypothecal Syllogism. Together with P(λ), this is enough for an ordinary string induction.
FALSE. This is true if the graph is a cycle, but in general the depth could be defined by some other long path that has nothing to do with any cycles.
TRUE. If δ(p, x) and δ(q, x); are always equivalent states, and p and q are either both final or both non-final, then p and q are equivalent and could still meet the conditions of this statement.
FALSE. This is the complement of a language shown in the text to not be regular, and the complement of regular languages are regular.
FALSE. The right-hand language is clearly contained in the left-hand language. But since every string in the left-hand language is either empty or ends in a, and the right-hand language contains all such strings, the two languages are equal no matter what R is.
TRUE. Any two strings that differ in their last two letters cannot be equivalent. The string a is equivalent to ba, and λ is in a class by itself.
FALSE. The equivalence class is determined by the difference modulo n between the number of a's and the number of b's. There are only n possibilities for this number, so there are only n classes.
FALSE. If w happens to be a string of n 0's, then a DFA with only n+1 states can count the number of 0's seen since the last 1, using a single state for numbers that are n or more. Even for general w of length n, we can make a DFA with 2^{n-1} + 1 states, because if the last n letters are not equal to w we only care about the last n-1 letters.
FALSE. There could be a state z from which the 2WDFA, on any letter, moves left and stays in z, so that it will hang if it ever enters this state. The first Turing machine example in lecture had such a state, but it is also possible in a 2WDFA.
TRUE. X is decidable, and therefore recognizable. X \ Y is the intersection of X and Y-bar, and the intersection of two recognizable languages is recognizable.
FALSE. It is Turing decidable. Since we can simulate a TM with a TM, we can certainly simulate a DFA with a TM, and we just report how the DFA terminates on the string (which it has to do).
TRUE. We simulate the arbitrary TM with a universal TM, recording every configuration is is ever in. If it uses a bounded amount of tape, it must repeat a configuration and enter a loop, and we can detect this.
We have E_{0}=3, since S_{0} is a triangle. For any
successive figure, a side becomes four sides (the two outermost
thirds, and the added sides of a triangle). Thus, we have
E_{n+1} = 4E_{n}.
The problem statement said to "derive" a recurrence, which
requires an argument, not just guessing from the first three values
3, 12, 48.
The found recurrence is a geometric sequence, we can thus give
the general formula E_{n} = 3*4^{n} for any natural n.
We prove this by induction. The base case (for n=0) holds, since E_{n} = 3 = 3 * 4^{0}. Assuming E_{n} = 3*4^{n} as inductive hypothesis, our recurrence gives us E_{n+1} = 4E_{n} = 4*3*4^{n} = 3*4^{n+1}, and we are done.
We deal with Q_{n} first, by induction. For the base case (n=0), we have 4^{0} + 2 = 3, and the figure is a triangle, with three acute angles.
For the inductive step, note that S_{n+1} has all acute angles of S_{n} and adds one more such angle for the new triangle created on each side, thus Q_{n+1} = Q_{n}+E_{n}=4^{n}+2+3*4^{n}=4*4^{n}+2=4^{n+1}+2 (q.e.d.).
For R_{n} we can just use the hint and get R_{n}=E_{n} - Q_{n} = 3*4^{n} - (4^{n} + 2) = 2*4^{n} - 2.
A very common mistake was to (attempt to) prove Q_{n} + R_{n} = E_{n} by induction, or rather, to use this relation and the base case to confirm that the individual formulas for Q_{n} and R_{n} are indeed correct. This is not valid reasoning, as one could find an arbitrary number of incorrect formulas for which the base case and the sum still work, e.g., Q_{n} = 2*4^{n}+1+100*n and R_{n}=4^{n}-1-100*n.
The base case (n=0) holds, as we get A_{0}(1+3/5(1-(4/9)^{0})) = A_{0}(1+3/5(1-1)) = A_{0}.
For the inductive step, A_{n+1} contains A_{n}, and E_{n} extra triangles (one for each side); each triangle has side 1/3 of the side of figure S_{n}, which in turn is 1/3^{n} of the side of S_{0}. So each new triangle has area A_{0}/3^{n+1}. We get: A_{n+1}=A_{n} + 3*4^{n}/9^{n+1}A_{0} = A_{0}(1 + 3/5(1 - (4/9)^{n}) + 3/4 * (4/9)^{n+1}) = A_{0}(1 + 3/5(1 - (4/9)^{n+1}(9/4 - 5/3 * 3/4))) = A_{0}(1 + 3/5(1 - (4/9)^{n+1}(9/4-5/4))) = A_{0}(1 + 3/5(1 - (4/9)^{n+1})).
A number of people had the idea right, but did not manage to do the arithmetic all the way, a pity since it only involved fractions and powers. Some tried to claim reaching a correct result with numbers that were clearly wrong, which in general will earn less partial credit than stopping without making false claims.
Denoting by L_{n} the side length of S_{n}, we have L_{n} = L_{0}/3^{n}. We then have P_{n} = E_{n}L_{n} = 4^{n}E_{0} * L_{0}/3^{n} = (4/3)^{n}P_{0}. Since 4/3 > 1, the exponential will grow arbitrarily large with n. In particular, for arbitrary m we have P_{n} > m for n > log_{4/3}(m/P_{0}), and by the rules of Existence and then Generalization we obtain the conclusion.
A number of solutions merely stated that the number of sides E_{n} grows exponentially (without taking into account the side length, which could potentially decrease at the same or a faster rate). Others stated that the perimeter grows as n grows (without quantifying the growth), which is insufficient since there are increasing sequences with an upper bound (and thus a limit). The other common mistake was to attempt a proof by induction on n, whereas in the formula, m is the arbitrary quantity, and the desired n depends on m.
The construction from the textbook and the one from Homework #6 are depicted in the figures (in both cases, 0 is the initial state).
For the second construction, states 1 through 4 represent (a+bb)^{*}, the transition (4, b, 1) closes the loop when constructing ((a+bb)^{*}b)^{*}.
The single most common mistake was not to do the construction from the text as given, but to try to simplify it by merging states 1 and 2, joining the loops for the inner and outer Kleene star. This happened although the problem statement asked (in emphasis) to use the construction exactly (the next problem point allowed simplification). Simplifying prematurely and without argumentation is often wrong, and it was in this case (since it breaks the required property that at any point in the construction, the initial state has no incoming transitions). Merging states 1 and 2 allows returning to 1 after an 'a' has been consumed, and then skipping the outer loop to 6. The automaton then accepts strings ending in 'a' (and in fact, any string at all), which is not true for the original regular expression.
It is easiest to start with the homework construction. We can eliminate state 4, through which there is a single path, and instead have a transition (2, b, 1). We can also eliminate states 0 and 5, with a single λ-transition each; state 1 becomes both initial and final. There is a single λ-transition, from 1 to 2, so no transitive closure to construct. We need to consider letter transitions into 1 and out of 2. Transition (2, b, 1) yields (1, b, 1), (1, b, 2), and (2, b, 2); transition (2, a, 2) yields (1, a, 2), and transition (2, b, 3) gives (1, b, 3).
The first construction is more complex. With the same arguments, we can eliminate state 5, introducing a transition (4, b, 6), and eliminate states 0 and 7, making state 1 initial and 6 final.
The states with λ-moves are 1, 2, 4, and 6. The transitive closure gives us: from 1, transitions into 2, 4, 6; from 2, into 4; from 4, into 2; from 6, into 1, 2, and 4.
This in turn gives us: for (2, a, 4): an a-move from any of {1,2,4,6} into {2,4}; for (2, b, 3): a b-move from any of {1,2,4,6} into 3; for (3, b, 4): b-moves from 3 to {2, 4}; for (4, b, 6): a b-move from any of {1, 2, 4, 6} into {1, 2, 4, 6}. Since λ is in the language, state 1 becomes final.
Many did not show their work, instead only drawing a complicated automaton with 6, 7, or 8 states. This is not a good approach for partial credit, since a wrong result will be apparent, but the understanding of the underlying construction is not. Many did not explicitly construct the transitive closure for λ-moves and missed transitions in the resulting NFA, especially since it was complex. Some stated that state 1 in the first construction can be eliminated since its only outgoing transitions are λ-moves. This is true, but requires carefully redirecting its incoming transitions, getting (6, λ, 6) and (6, λ, 2), to avoid errors like merging 1 and 2.
We work with the three-state automaton obtained above, and get: δ({1}, a) = {2}; δ({1}, b) = {1, 2, 3}. Next, δ({2}, a) = {2}, and δ({2}, b) = {1, 2, 3}. Finally, δ({1,2,3},a) = {2}, and δ({1,2,3}, b) = {1,2,3}. We have three states; {1} and {1,2,3} contain final state 1 and are thus final. In the figure we have renamed {1,2,3} to 3.
Starting from the first construction is not much more complex: we get δ({1},a) = {2,4} and δ({1}, b) = {1, 2, 4, 6}; then δ({2,4}), a) = {2, 4} and δ({2,4}, b) = {1,2,4,6}, and finally δ({1,2,4,6}, a) = {2, 4} and δ({1,2,4,6}, b) = {1,2,4,6}, so a three-state automaton having the same structure, with {1} and {1,2,4,6} final states.
The initial partition has F = {1, 3} and N = {2}. We get δ{1, a) = δ(3, a) = N, and δ(1, b) = δ(3, b) = F, so the two final states stay equivalent. The minimal automaton has two states.
Some got to cases where the next states were different for any symbol and incorrectly deduced that the automaton could not be minimized (e.g., suppose we had δ(3, b) = 1 in our case). This is not the correct approach for minimization: we start with a coarsest partition and refine it until no longer possible.
We have a single initial and a single final state, so we don't need to add new states (but we must keep the existing initial and final state, which happen to be the same). We eliminate state 2, and get a new transition (1, aa^{*}b, 1), resulting in (1, b+aa^{*}b, 1). We can simplify b+aa^{*}b = (λ+aa^{*})b = a^{*}b. The resulting language has one more Kleene star (for the loop on state 1): (a^{*}b)^{*}, which is the language of all strings that do not end in a. We can see the regular expressions is equivalent to the original one, but simpler, see also Question 2(h).
Last modified 2 January 2019