Q1: 10 points Q2: 30 points Q3: 30 points Q3: 20+10 points Q4: 30 points Total: 120+10 points
Exam text is in black, solutions in blue.
Question 2 refers to the following five statements, where the variables are of type "dog", the set of dogs includes the dog Duncan (d) and possibly others, and we use the following predicates:
The statements are:
N is the set of naturals (non-negative integers), {0, 1, 2, 3,...}
Question 3 uses a function f from N to N. The function arises in a popular video game where tiles are labeled by integers that are powers of two. The smallest tiles are labeled 2, and they are created without any points being scored. (We will assume for this exam that only tiles with label 2 are created, though actually the game also creates some with label 4.) When two tiles each with label 2k are merged, a single tile with label 2k+1 is created and the player gets 2k+1 points.
For any positive natural k, f(k) is defined to be the number of points scored in the process of creating a tile with label 2k. If k > 1, this includes the 2k points for the last merge creating the tile, plus all the points scored in the process of creating the tiles that were merged.
Question 4 uses the following two formal languages over the alphabet {a, b}. The language X is the set of all strings that do not have both two a's in a row and two b's in a row. The language Y is defined inductively as follows. Note that the text in green was omitted when the test was given.
Question 5 uses the following λ-NFA N. The alphabet is {a, b}, the state set is {1, 2, 3, 4, 5}, the start state is 1, the final state set is {5}, and the transition relation Δ is
{(1, a, 2), (1, a, 3), (2, b, 4), (3, a, 5), (4, λ, 2), (4, λ, 3), (5, a, 4)}.
Here is a diagram of N, with "L" meaning λ:
a a
>(1) ----> (3) ----> ((5))
| ^ /
| | /
| | /
| | /
|a |L / a
| | /
| | /
| | /
| | /
V b |V
(2) ----> (4)
<----
L
A language X is TR if some Turing machine M exists such that X = L(M), that is, if on any string w, M halts on X if and only if w ∈ X.
The length of a path in a weighted graph is the sum of the weights of its edges. A shortest path from x to y is one whose length is smaller than or equal to the weight of any other path from x to y.
A partial order is a binary relation R ⊆ X × X that is reflexive (∀a: R(a, a)), antisymmetric (∀a:∀b: (R(a, b) ∧ R(b, a)) → a = b), and transitive (∀a:∀b:∀c: (R(a, b) ∧ R(b, c)) → R(a, c)).
The transition function δ of a Turing machine has domain Q × Γ and range Q × Γ × {L, R}, where Q is the state set, Γ is the tape alphabet, and L and R indicate left and right moves on the tape, resspectively. If δ(p, a) = (q, b, R), for example, then if the machine is in state p and reading an a, it will change to state q, print a b over the a, and then move right.
The set S is pairwise relatively prime if for any two distinct naturals x and y in the set, the GCD of x and y is 1. That is, no natural greater than one divides any two distinct naturals in the set.
∀x: F(x) → [¬I(x) ↔ (L(x) ∨ V(x))]. Many of you had statements that incorrectly asserted things about dogs not in the forest.
If a dog is in neither the forest nor the yard, then it is either on a leash or is illegal, but not both. Equivalently, such a dog is legal if and only if it is on a leash.
¬L(d) → Y(d), or equivalently L(D) ∨ Y(d), among several other formulations.
There is no illegal dog in the yard. Equivalently, all dogs in the yard are legal.
∀x: L(x) → ¬I(x), or equivalently ¬∃x: L(x) ∧ I(x).
In each case we use the Rule of Specification, also called
Universal Instantiation.
We use Proof by Cases.
Case 1, Y(d): IV specifies to ¬I(d) ∨ ¬Y(d) as in (b) above.
This is equivalent to Y(d) → ¬I(d), from which the premise gives us
¬I(d) by Modus Ponens.
Case 2, ¬Y(d) ∧ F(d): I specifies as in (b) above, and since F(d)
is true Modus Ponens on that statement gives us ¬I(d) ↔ (L(d) ∨
V(d)). III says ¬Y(d) → L(d), which by Modus Ponens gives us
L(d), since ¬Y(d) is assumed for this case. We get L(d) ∨ V(d) by
Right Joining, and this is equivalent to ¬I(d) by a statement that we have
derived.
Case 3, ¬Y(d) ∧ ¬F(d): II and Modus Ponens now give us
L(d) ⊕ I(d). III, and the statement ¬Y(d) from the premise, give
us L(d), from which ¬I(d) follows.
Let x be an arbitrary dog. Assume that L(x) is true, and we will prove
¬I(x).
Case 1, Y(x): IV specified to x gives us ¬I(x) ∨ ¬Y(x),
and thus ¬I(x) follows from Y(x).
Case 2, ¬Y(x) ∧ F(x): I specified to x, F(x), and Modus Ponens
together
give ¬I(x) ↔ (L(x) ∨ V(x)). L(x) is assumed, so L(x) ∨ V(x)
is true by Right Joining, and thus ¬I(x) is true.
Case 3, ¬Y(x) ∧ ¬F(x): II specified to x, the premise for the
case, and Modus Ponens together give us L(x) ⊕ I(x). Since L(x) is
assumed true, I(x) must be false.
Since we proved L(x) &arr; ¬I(x) in each case, we may conclude
∀x: L(x) ↔ ¬I(x) by Generalization (also called Universal
Generalization).
We have f(1) = 0, since we are told no points accrue from the creation of a 21 = 2 tile. For a merger, the points to make a 2k+1 tile are 2k+1 plus the points to make two 2k tiles, so f(k+1) = 2k+1 + 2f(k). So f(2) = 4 + 2(0) = 4, f(3) = 8 + 2(4) = 16, f(4) = 16 + 2(16) = 48, and f(5) = 32 + 2(48) = 128.
The base case of n = 3 is given above, since 16 = 23+1. If we assume f(n) ≥ 2n+1, then f(n+1) = 2n+1 + 2f(n) ≥ 2n+1 + 2(2n+1) = 3(2n+1) ≥ 2n+2.
The formula is f(n) = (n-1)2n. For the base case of n = 1, the formula gives f(1) = (0)21, which is true because f(1) = 0 as above. Assume that f(n) = (n-1)2n. By the definition, f(n+1) = 2n+1 + 2f(n) = (by the IH) 2n+1 + 2(n-1)2n = n2n+1 by arithmetic.
Base case of induction on defintion of Y: λ ∈ X because λ has no aa or bb, much less both.
Assume that a string w in Y does not have both aa and bb. We must prove
that none of the additional strings forced to be in Y have both an aa and a bb.
If w = uaa, then w must not have any bb. Adding an a cannot create a bb.
If w = ubb, then w must not have any aa. Adding a b cannot create an aa.
To solve the remaining case, we need an additional fact: If w has an aa, it
ends in aa, and if w has a bb, it ends in bb. We prove this fact by induction:
Both statements are true vacuously for λ, the added letters in
clauses 2 and 3 of the
definition preserve both properties, and if clause 4 applies then w cannot have
either an aa or a bb, and so if the added letter creates an aa or a bb then the
new string ends with that pair.
Now we can observe that in the last case, the string w has neither an aa nor
a bb, and the new letter can create only one of them and the new string is
still in X.
Note: Without the clauses in green above, the desired statement
Y ⊆ X is false, because we can use the version of clause 4 with w = aab
to show that
aabb is in Y, and aabb is clearly not in X. If you pointed this out, you got
full credit.
This is not true, since aab is certainly not in Y (since it can't be made from aa) and it is still in X because it has no bb.
Using the Myhill-Nerode Theorem, a minimal DFA for Y will have one state for
each string in such a set. Consider the DFA with state set {1, 2, 3, 4, 5, 6},
start state 1, final state set {1, 2, 3, 4, 5}, and transition function
δ(1, a) = δ(3, a) = 2, δ(1, b) = δ(2, b) = 3,
δ(2, a) = 4, δ(3, b) = 5,
δ(4, a) = 4, δ(5, b) = 5,
δ(4, b) = δ(5, a) = δ(6, a) = δ(6, b) = 6.
Each string in the set {λ, a, b, aa, bb, aab} goes to a different
state of the DFA. Following the definition, it is easy to see that the
language of this DFA is Y -- the first aa in a string must take it to 4, and
the first bb in a string must take it to 5.
It remains to show that this DFA is minimal. On the first phase we
have a set F = {1, 2, 3, 4, 5} containing all the final states. States 1, 2,
and 3 go to F on either a or b, so we put them into a new set X. State 4 goes
to F on a and to N on b, and state 5 goes to N on a and to F on b, so they
each go into a set of size 1 and may be ignored. Analyzing X with respect
to the new partition, we find that 1 goes to X on both a and b, that 2 goes to
state 4 on a and to X on b, and that 3 goes to X on a and to sttae 5 on b.
Each of the six states has a distinct behavior, and so the DFA is minimal.
The set of two λ-moves is already transitively closed. We create our
N' with the same five states, and 5 is still the only final state since there
is no λ-path from 1 to 5. The letter moves (1, a, 2) and (1, a, 3)
causes only themselves.
The move (2, b, 4) causes six moves in all, because 2 can be reached from 4
and 4 can go to 2 or 3 on λ. The six moves are (2, b, 2), (2, b, 3),
(2, b, 4), (4, b, 2), (4, b, 3), and (4, b, 4).
The move (3, a, 5) causes itself and (4, a, 5).
The move (5, a, 4) causes itself, (5, a, 2), and (5, a 3).
Our N' thus has thirteen total letter moves.
Our nonfinal start state is {1}, which has an a-move to {2, 3} and a b-move to the nonfinal death state ∅, which of course has an a-move and a b-move to itself. State {2, 3} has an a-arrow to a final state {5} and a b-move to the nonfinal state {2, 3, 4}. State 5 has an a-move to {2, 3, 4} and a b-move to ∅. State {2, 3, 4} has an a-move to {5} and a b-move to itself. We have completed the construction, finding a DFA D with five states.
Starting from D, we need not add a start state but we must add a final state
f, make {5} nonfinal, and add a transition (5, λ, f). We can delete
the death state ∅, giving us five states to start.
Eliminating state {2, 3} creates two new transitions: ({1}, aa, {5}) and
({1}, ab, {2, 3, 4}).
Eliminating state {5} creates four new transitions: ({1}, aa, f),
({1}, aaa, {2, 3, 4}), ({2, 3, 4}, a, f), and ({2, 3, 4}, aa, {2, 3, 4}).
Two of these combine with existing transitions to form ({1}, ab + aaa,
{2, 3, 4}) and ({2, 3, 4}, b + aa, {2, 3, 4}).
Eliminating {2, 3, 4}, the last intermediate state, gives us a regular
expression of
aa + (ab + aaa)(b + aa)*a
Last modified 25 June 2014