Question text is in black, solutions in blue.
Q1: 10 points Q2: 20 points Q3: 20 points Q4: 30 points Q5: 20 points Q6: 20 points Total: 120 points
b
>(1) ----> ((2))
|^ |
b||L |a
|| |
V| V
(3) <---- (4)
L
(Diagram corrected 8 December 2013 -- it had (4, a, 2) instead of (2,
a, 4).)
Let n be any positive integer. Define the DFA Dn to have alphabet {a}, state set {0, 1, 2,..., n-1}, start state 0, final state set {1}, and transition function δ(i, a) = (i+1) % n where "%" is the Java modular division operator.
(P(b) ⊕ P(c)) ∧ (¬M(c) → M(b))
"Given any dog x, x is wet if and only if it either went in the swamp or went in the pond (or both)."
∀x: (M(x) → S(x)) ∧ (P(x) → ¬M(x)). Or, equivalently (and actually more literally what the English says), (∀x: M(x) → S(x)) ∧ (∀y: P(y) → ¬M(y)).
"It is not the case that all dogs are wet." Or, equivalently, "There exists a dog that is not wet."
∃z:¬ W(z), meaning "there exists a dog that is not wet". The EI rule tells us "¬W(z)", where z is some dog for which we know only that it is not wet.
We may conclude "M(d) → S(d)", meaning "if Duncan is muddy then he went in the swamp", and "P(d) → ¬M(d)", meaning "if Duncan went in the pond then he is not muddy".
There are two parts to the argument -- we show that Biscuit and Cardie
are both wet, and thus that the non-wet dog guaranteed by
Statement IV is Duncan, then show that any non-wet dog is not
muddy. Here's one way to spell out this argument fully in
English.
Let z be the dog given by EI on Statement IV, so that we know "¬W(z)".
By UI on Statement II, we have "W(z) ↔ (S(z) ∨ P(z))" and
hence "¬(S(z) ∨ P(z))", "¬S(z) ∧ ¬P(z)", and
finally "¬S(z)" by propositional rules. By UI on Statement III
and separation we have "M(z) → S(z)", which gives us "¬S(z)
→ ¬M(z)" by contrapositive, and thus "¬M(z)" by Modus
Ponens.
Now we must show that this dog z is equal to d, to get our
desired conclusion "¬M(d)". Here we argue by cases to show
"W(b) ∧ W(c)". For Case 1, assume that "P(c)" is true. Then
by UI on Statement III and MP, "¬M(c)", and by MP on Statement
I, "M(b)". By UI on Statement III and MP, we get "S(b)", and by
UI
on Statement II, Addition, and MP, we get "W(b)". Also by UI on
Statement II, Addition, and MP, we get "W(c)".
Case 2 is that P(c) is false, from which Statement I tells us that
P(b)
is true. We can follow the argument of Case 1 exactly, switching the
b's and c's, to get "W(b) ∧ W(c)" again. (Note that the
contrapositive of "¬M(c) → M(b)" is "¬M(b) → M(c)".)
So we know that the non-wet dog z cannot be either b or c, and
since the universe of discourse is {b, c, d} it must be d, and our
conclusion "¬M(d)" follows.
Let P(k) be the statememnt "If M is an ordinary NFA with k states and
fewer than k - 1 transitions, M has an unreachable state".
To
prove P(k) for all positive integers, our base case is P(1). With
k = 1, it is impossible for any M to have fewer than k - 1 =
0 transitions, so all such M's have unreachable states and P(1) is
true.
It's also useful to prove P(2), which says that any M with two
states and fewer than 2 - 1 = 1 transition has an unreachable
state. This is true because the non-start state is clearly
unreachable with no transitions. I was lenient with bad base cases
in this problem, because the k = 1 case was unnecessarily
confusing.
The IH says that any M with k states and fewer than k - 1
transitions must have an unreachable state. The inductive step is
to prove that any M' with k + 1 states and fewer than k transitions
must have an unreachable state.
Most of you asserted without proof
that M' was made from some k-state M by adding one state and one
transition.
But this isn't necessarily true -- what if the state added has more
than one transition? Here is a complete argument:
Let M' be any ordinary NFA with k + 1 states and fewer than k
transitions.
Let s be any state of M', other than the start state, that has
no transitions out of it. Such an s must exist because M'
has k non-start states and fewer than k transitions. Case 1: s has
no transitions into it -- in this case s is the desired unreachable
state.
Case 2: s has a transition into it. Let M be the ordinary NFA
obtained by deleting s and all transitions into it. Then M has
fewer than k - 1 transitions, and by the IH it has an unreachable
state t. This state t remains unreachable in M' because the new
transitions cannot be used to reach any node other than s, since s
has no transitions out. So in either case, M' has an unreachable state.
Let P(i) be the statement "b(ab)i ∈ L(N)". To prove
P(i) for all natural numbers, we must begin with P(0), "b ∈
L(N)". This is true because there is a b-transition from the start
state 1 to the final state 2.
Let i be an arbitrary natural number. The IH says that
w = b(ab)i ∈ L(N). We must prove that
b(ab)i+1 = wab is in L(N). By the IH, there is a path
labeled w from state 1 to state 2. We append the edges (2, a, 4), (4,
λ, 3), (3, λ, 1), and (1, b, 2) to this path to get a
wab-path from state 1 to state 2, proving the inductive step and
completing the induction.
We make the λ-moves transitively closed by adding (4, λ,
1). The start state remains non-final because there is no
λ-path from the start state to the final state. The letter
move (1, b, 2) of N gives us the moves (1, b, 2), (3, b, 2), and
(4, b, 2) of N'. The letter-move (1, b, 3) of N gives us (1, b,
1), (1, b, 3), (3, b, 1), (3, b, 3), (4, b, 1), and (4, b, 3) of
N'.
The letter-move (2, a, 4) of N gives us (2, a, 1), (2, a, 3), and
(2, a, 4). This gives us twelve total moves in N'.
There were many other possible constructions leading to ordinary
NFA's with the same language as N, and since I only said "construct
an NFA with the same language" I gave full credit for any of them.
The most interesting, I think, was to use state elimination on N,
killing first state 4 (producing (2, a, 3)) and then state 3
(producing (1, b, 1) and (2, a, 1)). It happens that the r.e.-NFA
we get is an ordinary NFA, and we know that state elimination
preserves the language of the machine.
Using my N' above, we get nonfinal start state {1} with a-arrow to ∅ and
b-arrow to {1, 2, 3}, then final state {1, 2, 3} with a-arrow to
{1, 3, 4} and b-arrow to itself, nonfinal state {1, 3, 4} with
a-arrow to ∅ and b-arrow to {1, 2, 3}, and finally nonfinal
state ∅ with both arrows to itself.
The simpler ordinary NFA above has nonfinal start state 1, final
state
2, and transitions (1, b, 1), (1, b, 2), and (2, a, 1). The
resulting DFA has nonfinal start state {1} with a-arrow to ∅
and b-arrow to {1, 2}, final state {1, 2} with a-arrow to {1} and
b-arrow to ∅, and nonfinal state ∅ with both arrows to
itself. This is the minimal DFA for the language.
Starting from my four-state DFA D above, first add a new final state f and a transition ({1, 2, 3}, λ, f), then kill state ∅ which requires no new transitions. We then kill {1, 3, 4}, producing a loop on {1, 2, 3} labeled ab which merges with the existing loop there to make a loop labeled "b + ab". Finally we kill {1, 2, 3} to get a regular expression of b(b + ab)*.
Method 1: The Euclidean Algorithm on 27 and 14 gives 27 = 1(14) +
13, 14 = 1(13) + 1, so 14 and 27 are relatively prime. On 95 and
14 it gives 95 = 6(14) + 11, 14 = 1(11) + 3, 11 = 3(3) + 2, 3 =
1(2) + 1, so 14 and 95 are relatively prime. On 95 and 27 it
gives 95 = 3(27) + 14 and then continues as with 27 and 14, so 27
and 95 are relatively prime. We have checked all pairs among
{14, 27, 95} and shown the set to be pairwise relatively prime.
Method 2: 14 = 2*7, 27 = 3*3*3, and 95 = 5*19. Since no
single prime appears in more than one of the three prime
factorizations, no two numbers in the set have a common factor
larger than 1, and the set is pairwise relatively prime.
The DFA Dn accepts exactly those strings ai such
that i ≡ 1 (mod n). The intersection of the three
languages is thus the set of strings ai such that i is
congruent to 1 mod 14, mod 27, and mod 95. Since the
three moduli are pairwise relatively prime from part (a), the
Chines Remainder Theorem tells us that the three congruences are
simultaneously satisfied if and only if i ≡ c (mod M),
(where M =
14*27*95) for some number c in the range from 0 through M - 1.
The regular expression is thus
ac(am)*.
What is c? What number is congruent to 1 modulo 14, 27 and 95?
Well, c = 1 clearly works. If you didn't see that, the CRT
calculation would eventually get you the same answer: Compute numbers
x, y, and z so that x ≡ 1 (mod 14), y ≡ 1 (mod 27), z
≡ 1 (mod 95), and each number is ≡ 0 modulo the other two
bases.
We could find x, for example, by computing the inverse of 14 (mod
27*95) and multiplying that by 27895. Then c would be just (x + y + z)
% M.
A prime factorization of n is a sequence of prime numbers that multiply to n -- every positive integer has one.
If we are proving "∀k:P(k)", the inductive step is to prove "P(k) → P(k+1)" for an arbitrary natural number k.
The Myhill-Nerode Theorem says that a language L has a DFA if and only if the set of equivalence classes of the L-equivalence relation is finite, and that if this set is finite, its size is equal to the number of states in the smallest DFA for L.
This is a regular expression denoting the Kleene star of the empty set, the language {λ}.
Given any λ-NFA for R, we can make a λ-NFA for R* by adding λ-moves from each final state to the start state, and making the start state final. (The second step is necessary in some cases because λ ∈ L(R*).) To get a λ-NFA meeting our normal form, assuming that the λ-NFA for R also meets our form, we add a new start state and a new final state, along with four λ-moves: new start to old start, old start to old final, old final to old start, and old final to new final.
The symbol → is for implication: "p → q" is true unless both p is true and q is false. The symbol ↔ is for equivalence: "p ↔ q" is true if p and q have the same truth value, and false if not.
A proof by contradiction of some statement p proceeds by assuming ¬p and then deriving some false statement. A proof by contrapositive of an implication "p → q" proceeds by proving the contrapositive implication "¬q → ¬p", for example by assuming ¬q and deriving ¬p.
A tree is a connected undirected graph with no cycles. A forest is an undirected graph with no cycles -- each of its connected components is a tree.
A λ-NFA is a machine with states and
transitions, where each transition is labeled either by a letter of the input alphabet or by λ.
∅ denotes the empty set, which is a set with no elements. λ denotes the empty string, which is a string with no letters.
Last modified 8 December 2013