- Answer the problems on the exam pages.
- There are five problems, some with multiple parts, for 110 total points. Actual scale A = 95, C = 65.
- Some useful definitions precede the questions below.
- No books, notes, calculators, or collaboration.
- In case of a numerical answer, an arithmetic expression like
"2
^{17}- 4" need not be reduced to a single integer.

Q1: 20 points Q2: 10 points Q3: 20 points Q4: 30 points Q5: 30 points Total: 110 points

Question text is in black, solutions in blue.

Here are definitions of sets, predicates, and statements used on this exam.

Remember that the score of any quantifier is always to the end of the statement it is in.

Let S be a finite set of dogs consisting of exactly the four distinct dogs Cardie (c), Duncan (d), Mia (m), and Whistle (w).

Let Z be a finite set of languages consisting of exactly the five distinct languages Chinese (C), English (E), French (F), Latin (L), and Spanish (S).

Let **N** be the set of natural numbers {0, 1, 2, 3,...}.

If a, b, and m are naturals, with m > 0, the notation "a ≡ b (mod m)" means "a is congruent to b, modulo m".

Let T be the unary relation on S defined so that T(x) means "dog x is a terrier".

Let R be the binary relation from S to Z defined so that R(x, y) means "dog x responds to commands in language y".

Let P be the binary relation on **N** defined so that P(x, y)
means
"|x - y| ≤ 3", where |z| denotes the absolute value of z.

Let Q be the binary relation on **N** defined so that Q(x, y)
means "(x = y) ∨ (y > x + 3)".

Let G be the binary relation on **N** defined so that G(x, y)
means "y = (x/2) + (x%2)", using Java notation.

**Question 1 (20):**Translate each statement as indicated, using the set of dogs D = {c, d, m, w}, the set of languages Z = {C, E, F, L, S}, the predicate T(x) meaning "dog x is a terrier", and the predicate R(x, y) meaning "dog x responds to commands in language y". In general I have used x as a variable of type "dog" (S) and y as a variable of type "language" (Z), but this should also be clear by the usage of variables in predicates.- (a, 2) (to English) (Statement I)
¬(R(c, F) → R(c, S)) ∧ ¬(¬R(c, L) ∨ R(c, S))
It is not the case that if Cardie responds to French, then she responds to Spanish, and it is not the case that Cardie either does not respond to Latin or does respond to Spanish. (Note: Many of you simiplified before translating, which was fine.)

- (b, 3) (to symbols)
(Statement II)
Cardie responds to commands both in French and in Latin.
R(c, F) ∧ R(c, L)

- (c, 2) (to English) (Statement III)
∀y: (y ≠ C) ↔ (∃x: R(x, y))
A language has at least one dog responding to it if and only if it is not Chinese. (Note: It was important to assert both halves of the ↔.)

- (d, 3) (to symbols) (Statement IV)
There is exactly one dog, Whistle, who responds to commands in Spanish.
The easiest way to say this is "∀x: R(x, S) ↔ (x = w)", but other ways were all right as long as you asserted both that Whistle responds to Spanish and that no other dogs do.

- (e, 2) (to English) (Statement V)
∀x: ∀y: R(x, y) → R(x, E)
If any dog responds to any language, then that dog responds to English.

- (f, 3) (to symbols) (Statement VI)
Unless Duncan is a terrier, he responds to commands in Chinese.
¬T(d) → R(d, c)

- (g, 2) (to English) (Statement VII)
∃x: ∀y: ¬T(x) ∧ (R(x, y) ↔ (y = E))
There is a non-terrier who responds to English and to no other language.

- (h, 3) (to symbols) (Statement VIII)
Any dog who does not respond to commands in English must be a
terrier.
∀x: ¬R(x, E) → T(x)

- (a, 2) (to English) (Statement I)
¬(R(c, F) → R(c, S)) ∧ ¬(¬R(c, L) ∨ R(c, S))
**Question 2 (10):**This question uses the sets, definitions, and predicates above, and the statements from Question 1.Prove that if Statement I is true, Statement II must be true as well. You may use either a truth table or a deductive argument.

The truth table argument is straightforward. You determine that Statement I is true in only one of the eight cases, the one where R(c, F) and R(c, L) are true and R(c, S) is false. Then you can just evaluate Statement II in this case and see that it is true. (Statement II is also true in another case, where all three propositions are true.)

For the deductive sequence argument, we assume Statement I. We can first use Separation to get ¬(R(c, F) → R(c, S)), use the Definition of Implication to get ¬(¬R(c, F) ∨ R(c, S)), use DeMorgan to get R(c, F) ∧ ¬R(c, S), and finally Separation to get R(c, F). Then we use Separation on Statement II to get ¬(¬R(c, L) ∨ R(c, S)), DeMorgan to get R(c, L) ∧ ¬R(c, S), and Separation to get R(c, L). We can then use Conjunction to get R(c, F) ∧ R(c, L), which is Statement II. We have completed a direct proof of the desired implication.

**Question 3 (20):**This question also uses the sets, definitions, and predicates from above and the statements from Question 1.Prove, using any or all of Statements I through VII, that Statement VIII is true. Do not assume anything about the English meaning of the predicates, except what you are given in the statements. Make your use of quantifier proof rules clear.

(Hint: If you have an arbitrary dog x, you may divide into the four cases x = c, x = d, x = m, and x = w. It is possible to solve this problem with or without Proof By Contradiction.)

Let's first do this by Contradiction. If Statement VIII is false, then there exists a dog x who does not respond to English and is not a terrier. This dog cannot be Cardie, who responds to French by Statement II and thus must respond to English by Statement V, specialized to give R(c, F) → R(c, E). Dog x cannot be Whistle, who responds to Spanish by Statement IV and thus to English by Statement V. It cannot be Duncan, who by Statement VI is either a terrier or responds to Chinese and thus also to English. (Duncan must in fact be a terrier, since no dog responds to Chinese by Statement III, but we don't actually need that.) Finally, dog x cannot be Mia, because Mia must be the monolingual non-terrier from Statement VII. (We know this because Cardie and Whistle respond to foreign languages, and Duncan either is a terrier or responds to Chinese.) Since all four possible values of x lead to contradictions, the existence of x leads to a contradiction and Statement VIII is proved.

We can phrase essentially the same proof without contradiction, proving Statement VIII directly by Generalization. Let x be an arbitrary dog. We will use Proof By Cases to show R(x, E) ∨ T(x). In the case x = c we use II to get R(c, F) and specialize V to get R(c, E). The case x = w is similar, using IV to get R(w, S) and then V to get R(w, E). In the case x = d we have T(d) ∨ R(d, C), from which we can either get T(x) ∨ R(d, E) by specializing V, or get T(d) by Contradiction using III. Finally, as above we prove separately that Mia is the dog in VII, since the other three cases are impossible, and this proves R(m, E) and thus gives our desired statement in the fourth case of x = m. We have proved our statement for arbitrary x by Cases, and thus completed the Generalization.

**Question 4 (30):**The following are fifteen true/false questions, with no explanation needed or wanted, no partial credit for wrong answers, and no penalty for guessing. They use the sets and relations defined above.- (a) (This uses the predicates defined above but not
Statements I-VIII.) If I have the premise (T(x) ∧ R(x, c))
→ (x = d), I may derive the statement T(x) → (x = d)
by the rule of Separation.
FALSE. If R(x, C) is false, the first implication is automatically true but the second may not be.

- (b) The negation of ∀x: T(x) is ¬∀x:¬T(x)
FALSE. The correct negation is ¬∃x:¬T(x).

- (c) The relation P defined above is an equivalence relation.
FALSE. It is not transitive. For example, P(0, 3) and P(3, 6) are both true but P(0, 6) is false.

- (d) The relation P defined above is both reflexive and symmetric.
TRUE. P(x, x) is always true because |x - x| ≤ 3, and P(x, y) and P(y, x) always have the same value because |x - y| = |y = x|.

- (e) The relation Q defined above is a partial order.
TRUE. It is clearly reflexive because Q(x, x) is defined to be true. It is antisymmetric because if x ≠ y, Q(x, y) ∧ Q(y, x) would require both x > y + 3 and y > x + 3, which is impossible. For transitivity, let x, y, and z be arbitrary and assume Q(x, y) and Q(y, z). If x = y or y = z, Q(x, z) is immediate. Otherwise we have y > x + 3 and z > y + 3, from which z > x + 3 follows by arithmetic.

- (f) The relation Q defined above is a total order.
FALSE. Neither Q(0, 1) nor Q(1, 0) is true.

- (g) The relation G defined above is a function from
**N**to**N**.TRUE.

**N**is closed under the operations of "/2", "%2", and "+", and each of these operations is a function from**N**to**N**, so for any x, G(x, y) is true if and only if y is the unique value obtained by composing these operations. - (h) The relation G is an injection (a one-to-one function).
FALSE. G(1, 1) and G(2, 1) are both true, so the function is not one-to-one.

- (i) The relation G is not a surjection (an onto function).
FALSE. It is onto, because for any arbitrary natural y, G(2y, y) is true.

- (j) Let u, v, and w be any three strings over the alphabet
Σ = {a, b}. If uv = uw, it must be true that v = w. (Here
"uv" means the concatenation of u and v.)
TRUE. If we let x be the string equal to both uv and uw, and we delete each letter of u in turn from the start of x, the result must be equal to both u and v. Or by contrapositive, if v and w are different lengths, or are the same length but differ in some letter, these facts will remain true if we concatenate u to both strings, and uv thus cannot equal uw.

- (k) Let u be a string of eight letters over the alphabet
Σ = {a, b}. If neither aaa nor bbb is a substring of u, then
u has at least two a's and at least two b's.
TRUE. If u had only one a and no bbb substring, it could be at most five letters long since there could be at most two b's on each side of the a. Similarly if it has only one b and no aaa substring, if could be at most five letters long. If u has no a's or no b's, and no such substring, it can be at most two letters long. So eight letters guarantees at least two a's and at least two b's. (You can't guarantee at least three of each letter without length 9, because of the counterexample bbabbabb.)

- (l) Let a, b, c, d, and m be naturals with m > 1, a
≡ c (mod m), and b ≡ d (mod m). If a is divisible by b
and c is divisible by d, we can guarantee that (a/b) ≡ (c/d)
(mod m).
FALSE. Let a = 10, b = 2, c = 8, d = 2, and m = 2. Then 10 ≡ 8 (mod 2) and 2 ≡ 2 (mod 2) are both true, but (10/2) ≡ (8/2) (mod 2) is false.

- (m) The statement of part (l) is true if we add the
additional condition that b and m are relatively prime.
TRUE. Let z be the inverse of b, and thus also the inverse of d, modulo m. Since a ≡ c (mod m), we must have that az ≡ cz (mod m). But az is congruent to a/b, and cz to c/d, modulo m.

- (n) (This uses the sets and predicates of Question 1 but not Statements
I-VIII.) If I have the premises ∃x: T(x) → R(x, C) and
T(d), I can conclude R(d, C).
FALSE. By Instantiation "T(x) → R(x, C)" holds for some dog x, but there is no reason that this dog has to be Duncan.

- (o) (This uses the sets and predicates of Question 1 but not
Statements I-VIII.) If I have the premises ∀x: T(x) →
R(x, C) and ¬T(m), I can conclude ¬R(m, C).
FALSE. We can get "T(m) → R(m, C)" by Instantiation, but the claimed conclusion is the inverse of this statement, which might be false even if the statement is true.

- (a) (This uses the predicates defined above but not
Statements I-VIII.) If I have the premise (T(x) ∧ R(x, c))
→ (x = d), I may derive the statement T(x) → (x = d)
by the rule of Separation.
**Question 5 (30):**Here are some straightforward number theory questions.- (a, 5)
Give prime factorizations of the naturals 25 and 57.
25 = 5 × 5, and 57 = 3 × 19.

- (b, 5) Based on your prime factorizations, determine
exactly which of the numbers in the set {1, 2, 3, 4, 5, 6, 7, 8,
9, 10}, if any, have
*both*an inverse modulo 25 and an inverse modulo 57. Justify your answer.We must eliminate the numbers that are divisible by 5, as they have no inverse mod 25 and those that are divisible by 3, as they have no inverse mod 57. (We needn't worry about any numbers divisible by 19.) That leaves 1, 2, 4, 7, and 8. For some reason many people left off 1, which is relatively prime to any natural and always has itself as an inverse.

- (c, 10) Find an inverse of 25, modulo 57, and an inverse
of 57, modulo 25. Be sure to make clear which is which.
The EA produces numbers 57, 25, 7, 4, 3, and 1. The sequence of linear combinations is:

- 57 = 0(25) + 1(57)
- 25 = 1(25) + 0(57)
- 7 = -2(25) + 1(57)
- 4 = 7(25) - 3(57)
- 3 = -9(25) + 4(57)
- 1 = 16(25) - 7(57)

So the inverse of 25, modulo 57, is 16 and the inverse of 57, modulo 25, is -7 (or, equivalently, 18).

- (d, 10)
Find which naturals x satisfy both the congruences x ≡ 13
(mod 25) and x ≡ 14 (mod 57). You may give an arithmetic
expression in your answer without resolving it to an explicit integer.
The Chinese Remainder Theorem says that these two congruences are together equivalent to a single congruence x ≡ c (mod 25×57). (I gave three points for quoting this fact.) To find c, we can use the inverses calculated in part (c) to get the expression 16×25×14 - 7×57×13, which evaluates to 5600 - 5187 = 413.

You could also find 413 by comparing the sequence of x's that satisfy the first congruence: 13, 38, 63, 88, 113, 138, 163, 188,... and the sequence of x's that satisfy the second: 14, 71, 128, 185, 242, 299, 356, 413,.... It's easier to see the match if you notice that the first sequence consists of exactly those numbers whose decimal representations end in 13, 38, 63, or 88.

If you found one number satisfying both congruences but failed to note that any number congruent to that modulo 1425 also satisfies them, you got six out of ten points.

- (a, 5)
Give prime factorizations of the naturals 25 and 57.

Last modified 22 February 2018