Question text is in black, solutions in blue. Grading notes are in blue bold-face.
Q1: 30 points Q2: 30 points Q3: 30 points Q4: 30 points Total: 120 points
∀x:SN(x) → GT(x)
Most got this right, except for a few ↔ or ∧ in place
of the →.
Pushkin ran off if and only if some other dog ran off, and Pushkin did not sit nicely.
I took off a point if I couldn’t tell that you had the last
“¬SN(p)”
outside of the ↔.
The best way to write this was probably to move that phrase to the beginning, but a
comma was also usually convincing.
¬(SN(d) ∨ S(m)) ∧ ((RO(d) ∧ GT(m)) ∨ (RO(m) ∧ GT(d)))
This was evidently the hardest translation. As we told several people
on Piazza, this statement says what it says (that one dog ran off and
the other got a treat) and doesn’t say what it doesn’t say (anything about
a dog not running off or not getting a treat). The most common error here
was to xor the two ands instead of or-ing them.
∃u:∃v: (u ≠ v) ∧ SN(u) ∧ SN(v)
Most people got this right — some missed saying that the two dogs were different.
Every dog who did not run off got a treat.
Most got this right.
There are seven. There are four where ¬SN(d), ¬SN(m), GT(d), and RO(m) are
all true. There are four where ¬SN(d), ¬SN(m), GT(m), and RO(d) are all true.
This double counts the one where ¬SN(d), ¬SN(m), GT(d), GT(m), RO(d), and RO(m)
are all true, so the total is 4 + 4 - 1 = 7. We could also verify this by directly checking
the 16 cases with ¬SN(d) and ¬SN(m) with a truth table.
I gave full credit for counting the cases correctly for an incorrect translation.
Let x be an arbitrary dog. We must prove that either x ran off or x got a treat.
If x = d or x = m, we know from Statement III that at least one of GT(x) and RO(x) is true.
If x = p, Statement II tells us that RO(x) is true, since some dog other than p (either d or m) ran off.
If x = b or x = c, we know that SN(x) is true because there are at least two dogs who sat nicely,
and they do not include d or m (by III) or p (by II). This leaves only b and c to be those two
dogs. Then by specializing I to x, we derive GT(x).
These were mostly either correct or fairly confused. I gave substantial credit for figuring out
which two dogs sat nicely.
Let P(n) be the statement “S contains a string of length n”. P(0) is
true because λ is in any star language. We use odd-even induction
for all n with n ≥ 2. The base cases are P(2), which is true because of
“aa”, and P(3), which is true because of “ddd”. If we assume P(n), so
that some string w of length n is in S, then P(n+2) is true because
the string waa is in S.
There were several valid ways to prove this, not all involving induction. For example,
you could say “Let n be an arbitrary natural, with n ≠ 1. If n = 0, let the string be λ.
If n ≥ 2 and n is even, let the string be (aa)n/2. If n
≥
2 and n is odd, let the string be
(ddd)(aa)(n-3)/2.”
Let n ≥ 3 and consider any string w in S of length n. Since n > 0,
w has a last letter. If this letter is a, b, or c, then w must be of
the form uaa, ubb, or ucc for some string u in S of length n-2. If the
last letter is d or e, then w must be of the form vddd or veee for some
string v in S of length n-3. So for every string in S of length n-3,
there are exactly two strings in S of length n, and for every string in
S of length n-2, there are exactly three strings in S of length n. It
follows that the number of strings in S of length n is exactly 3f(n-3) +
2f(n-2), as claimed.
Here it’s important that the argument actually talk about strings.
As suggested, we use strong induction on all natural n. For the base
cases, f(0) = 1 because λ is in S (since S is a star language).
This matches the formula, as [20+2 + (-1)0(3(0) + 5)]/9 = (4+5)/9 = 1.
We have f(1) = 0 because there is no way to make a string of length 1 by
concatenating strings of length 2 or 3. This matches the formula, because
[21+2 + (-1)1(3(1) + 5)]/9 = (8-8)/9 = 0. Finally, f(2) = 3 because
the only strings of length 2 in S are aa, bb, and cc. This matches the
formula because [22+2 + (-1)2(3(2) + 5)]/9 = (16 + 11)/9 = 3.
For the inductive case, we assume that f(n-3) and f(n-2) match the
formula, and compute f(0):
2[2n-1 + (-1)n-3(3(n-3) + 5)]/9 +
3[2n + (-1)n-2(3(n-2) + 5)]/9 =
(1/9)[2n + 3(2n) + (-1)n(-6(n-3) -10 + 9(n-2) + 15)] =
(1/9)[2n+2 + (-1)n(-6n + 18 - 10 + 9n -18 + 15)] =
(1/9)[2n+2 + (-1)n(3n + 5)]
Some potentially tricky arithmetic here (and I took off points for leaving
out too many steps). Note that it’s important to do all three base cases,
and that those base case arguments need to involve both the given formula
and a count of the strings of that size in S.
The MN Theorem tells us that the number of equivalence classes is
equal to the number of states in the minimal DFA for the language.
So let’s design a DFA for S. We have state 0 which is the start state
and the only final state. We make a loop for each of the possible strings
that should bring us back to 0, so we have δ(0, a) = 1, δ(1, a) = 0,
δ(0, b) = 2, δ(2, b) = 0, δ(0, c) = 3, δ(3, c) = 0,
δ(0, d) = 4, δ(4, d) = 5, δ(5, d) = 0, δ(0, e) = 6,
δ(6, e) = 7, δ(7, e) = 0. All other values of δ are 8, including
δ(8, x) for any letter x, so that 8 is a death state.
If we minimize this nine-state DFA, our first partition is F = {0} and
N = {1,2,3,4,5,6,7,8}. The behaviors of the states in N are then FNNNN
for 1, NFNNN, for 2, NNFNN for 3, NNNNN for 4, NNNFN for 5, NNNNN for 6,
NNNNF for 7, and NNNNN for 8. We then make a new transition where the only
non-singleton class is X = {4, 6, 8}. (We will name the other classes 0, 1,
2, 3, 5, and 7.) Now the behaviors of the states in X are XXX5X, XXXX7, and
XXXXX. The third partition thus has only singleton classes. We have proved
that this nine-state DFA is minimal, and thus that S has exactly nine
equivalence classes.
Quoting the MN Theorem works if you have the minimal DFA for the language.
I gave a lot of credit for having the correct DFA without a minimization proof.
Some people left off the death state.
We add three λ-moves (1, λ, 4), (1, λ, 5), and (2, λ, 4) to make the
transitive closure.
(1, b, 3) makes itself only.
(2, a, 4) makes itself and (1, a, 4).
(3, b, 5) makes itself and (3, b, 4).
(4, a, 3) makes itself, (1, a, 3), (2, a, 3), and (5, a, 3).
(4, b, 5) makes itself, (1, b, 5), (2, b, 5), (5, b, 5), (1, b, 4), (2, b, 4), (4, b, 4), and (5, b, 4).
State 1 becomes final as it has a λ-path to 4.
The constructed DFA has the following six states:
{1} (final) with a-move to {3, 4} and b-move to {3, 4, 5}
{3, 4} (final) with a-move to {3}, b-move to {4, 5}
{3, 4, 5} (final) with a-move to {3}, b-move to {4, 5}
{3} (non-final) with a-move to ∅, b-move to {4, 5}
{4, 5} (final) with a-move to {3}, b-move to {4, 5}
∅ with both moves to ∅
We begin with a partition of F = {1, 34, 345, 45} and N = {3, E}. The behaviors of the states in F are FF for 1, NF for 34, NF for 345, and NF for 45. The behaviors of the states in N are NF for 3 and NN for E. So 1, 3, and E must be in classes by themselves. If we let X be the class {34, 345, 45} we find that all three states have behavior 3X, so they can be merged into a single state X. The minimal DFA thus has four states 1, X, 3, and E. 1 has both moves to X, X has an a-move to 3 and a b-move to itself, 3 has an a-move to E and a b-move to X, and E has both moves to E. 1 is the start state and 1 and X are the final states.
We take D’ and add an additional state f with λ-moves from 1 and X. (We don’t need a new start state since there are no moves into 1.) We first eliminate E, creating no new transitions. We then eliminate 2, creating the new transition (X, ab, X) which merges with the existing (X, b, X) to make (X, ab + b, X). Finally, eliminating X gives us the single transition (1, λ + (a+b)(ab+b)*, f) (after merging with (1, λ, f)) and from this we read off the regular expression “λ + (a+b)(ab+b)*”.
The λ-NFA has state set {i, p, q, r, s, f}, with start state i and final state f. The transitions are (i, a, p), (i, b, p), (i, λ, f), (p, λ, q), (q, b, s), (q, λ, s), (q, a, r), (r, b, s), (s, λ, q), and (s, λ, f).
We add three λ-moves (1, λ, 4), (1, λ, 5), and (2, λ, 4) to make the
transitive closure.
(1, b, 3) makes itself only.
(2, a, 4) makes itself, (1, a, 4), (1, a, 5), and (2, a, 5).
(3, b, 5) makes itself and (3, b, 4).
(4, a, 3) makes itself, (1, a, 3), (2, a, 3), and (5, a, 3).
State 1 becomes final as it has a λ-path to 4.
The constructed DFA has the following five states:
Start state {1} (final) with a-move to {3, 4, 5} and b-move to {3}
{3, 4, 5} (final) with a-move to {3}, b-move to {4, 5}
{3} (non-final) with a-move to ∅, b-move to {4, 5}
{4, 5} (final) with a-move to {3}, b-move to ∅
∅ with both moves to ∅
We begin with a partition of F = {1, 345, 45} and N = {3, E}. The behaviors of the states in F are FN for 1, NF for 345, and FF for 45. These three states must thus all be separated. The behaviors of the states in N are NF for 3 and NN for E. So the DFA D is already minimal.
We take D = D’ and add an additional state f with λ-moves from 1, 345, and 45. (We don’t need a new start state since there are no moves into 1.) We first eliminate E, creating no new transitions. We then eliminate 3, creating the new transitions (1, bb, 45), (45, ab, 45), and (345, ab, 45). The last of these merges with an existing transition to make (345, b + ab, 45). We then eliminate 345, creating (1, a, f) (which merges with an existing transition to make (1, λ + a, f)) and (1, a(b+ab), 45) (which merges with an existing transition to make (1, bb + a(b + ab), 45). Now eliminating 45 gives us a final regular expression of λ + a + (bb + a(b + ab)(ab)*.
The λ-NFA has state set {i, m, n, o, p, q, r, s, f}, with start state i and final state f. The transitions are (i, a, m), (i, b, n), (n, b, p), (m, b, p), (m, a, o), (o, b, p), (i, λ, f), (i, a, f), (p, λ, q), (q, b, s), (q, λ, s), (q, a, r), (r, b, s), (s, λ, q), and (s, λ, f).
TRUE. We proved LBS to be such a language.
TRUE. In homework we saw how to build a DFA for any finite language.
TRUE. If M is empty, LM and ML are also empty, no matter what L is. Since the empty set is regular, we can choose L to be any non-regular language.
TRUE. X can be any non-regular language and Y can be Σ*, which is regular.
FALSE. Each denotes the set of all possible strings over {0, 1}.
FALSE. We proved in lecture that a multitape TM can be simulated by an ordinary one.
FALSE. It is not reflexive and thus not a partial order.
TRUE. If we have k nodes in the set A and 14 - k in the set B, the maximum possible number of edges is k(14 - k), which is maximized at 49 when k = 7.
TRUE. We know h3 is non-negative since it is the minimum of two non-negative functions. And we know it is bounded above by the true distance because at least one of h1 or h2 is.
FALSE. The number of edges in each tree is the number of nodes in v’s connected component, minus 1.
FALSE. For any natural x, 5x is congruent to either 0 or 5, modulo 10.
TRUE. We are given that x is congruent to 1 modulo 6 and to 3 modulo 5. By the Chinese Remainder Theorem this determines the value of x modulo 30, and by inspection this value is 13. So x is of the form 30k + 13 for some natural k, and thus x > 12.
FALSE. The converse is equivalent to the inverse, and the contrapositive to the original statement. These two statements could have any combination of truth values.
TRUE. Let A = {aa} and B = {a}.
FALSE. We must have n = e + 1.
Last modified 19 May 2020