# Solutions to First Midterm Exam Fall 2017

### Directions:

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

```  Q1: 15 points
Q2: 30 points
Q3: 30 points
Q4: 25+10 points
Total: 100+10 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 animals consisting of exactly the five distinct animals Cardie (c), Duncan (d), Floyd (f), Scout (s), Whistle (w).

Let D be the unary relation on A defined so that D(x) means "x is a dog".

Let F be the unary relation on A defined so that F(x) means "x lives on the farm".

Let R be the unary relation on A defined so that R(x) means "x is a retriever".

Let M be the binary relation on A defined so that M(x, y) means "animal x met animal y during the morning walk". Note that two animals could be together on the walk without meeting during it.

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 Σ be the alphabet {0, 1}, so that Σ* is the set of binary strings.

Let f be the function from Σ* to Σ* defined so that f(w) = ww (the concatenation of the string w with itself). For example, f(011) = 011011.

Let g be the function from Σ* to Σ* defined so that g(λ) = λ and for any letter a in Σ and any string w, g(aw) = w. (So g deletes the first letter of its input if there is one.) For example, g(011) = 11.

• Question 1 (15): Translate each statement as indicated, using the set of animals D = {c, d, f, s, w}, the predicate D(x) meaning "animal x is a dog", the predicate F(x) meaning "animal x lives on the farm", the predicate R(x) meaning "animal x is a retriever", and the predicate M(x, y) meaning "animal x and animal y met during the morning walk". Note that two animals might be together for the entire morning walk but not meet during it. All these are also defined above. Note that variables and constants of type "animal" are in small letters, and predicates are in capital letters.

• (a, 2) (to symbols) (Statement I) Floyd, who is not a dog, met every animal who does not live on the farm.

¬D(f) ∧ ∀x: ¬F(x) → M(f, x)

• (b, 2) (to English) (Statement II) ∀x: ¬R(x) ∨ D(x)

Every animal either is not a retriever or is a dog.

• (c, 2) (to symbols) (Statement III) It is not the case that if Floyd lives on the farm, than Duncan met Cardie.

¬(F(f) → M(d, c)) (The parentheses are necessary. Many of you translated this to "F(f) ∧ ¬M(d, c)", which was useful later.)

• (d, 2) (to English) (Statement IV) [∀z:¬M(x, x)] ∧ [∀y:∀z: M(y, z) → M(z, y)]

No animal met itself, and if any animal met another, the other also met it.

• (e, 3) (to symbolx) (Statement V) Cardie and Duncan met exactly the same animals, and they met all the animals who live on the farm. (Many of you said one of these things, but not the other.)

∀x: (M(c, x) ↔ M(d, x)) ∧ (F(x) → (M(c, x) ∧ M(d, x))

• (f, 2) (to English) (Statement VI) ¬F(w) ∧ [∃x:R(x) ∧ F(x) ∧ M(x, w)]

Some retriever who lives on the farm met Whistle, who does not live on the farm.

• (g, 2) (to symbols) (Statement VII) Whistle met every animal who lives on the farm.

∀x: F(x) → M(w, x) (Note that I took off points if you had M(x, w) instead of M(w, x) -- M is only symmetric if we are assuming that Statement IV is true.)

• Question 2 (30): These questions use the sets, definitions, and predicates above, and the statements from Question 1.

• (a, 10) Use Statements I, II, and III to infer propositional statements about the propositions D(f), F(f), and R(f). Use propositional methods (a truth table, or deductive or equational proof rules) to determine the truth of these three propositions, assuming only that Statements I, II, and III are true.

From Statement I we get ¬D(f) by Left Separation. From Statement II we get ¬R(f) ∨ D(f) by Specification, and we can rewrite this if we like as R(f) → D(f) by Definition of Implication. By Definition of Implication and DeMorgan, we can rewrite Stateement III as F(f) ∧ ¬M(d, c), which implies F(f) by Left Separation.

So we have ¬D(f), R(f) → D(f), and F(f). This gives two of the three desired truth values directly. To get the third, we can rewrite the implication as its contrapositive ¬D(f) → ¬R(f), and then derive ¬R(f) by Modus Ponens. So F(f) is true and the other two are false.

• (b, 10) Assuming that Statements I, IV and V are true, use propositional and predicate proof rules to prove Statement III. Do not assume the truth of any of the other statements. You may use English, symbols, or a combination, as long as your argument is clear.

As above, we can rewrite Statement III (now our goal) as F(f) ∧ ¬M(d, c). We will prove the two statements F(f) and ¬M(d, c) and then use Conjunction. We first prove F(f) by contradiction. Assume ¬F(f). If we specify Statenent I to f we get ¬F(f) → M(f, f). Modus Ponens gives us M(f, f). But by specifying the first part of Statement IV to f, we get ¬M(f, f), and this is a contradiction. There are other valid ways to prove this, but some of you tried to prove it by quoting part (a) of this problem. Of course that is no good because in (a) you are assuming Statement III, the goal of this part, to be true.

It remains to prove ¬M(d, c), and again we can use contradiction. Assume M(d, c) and specify the first part of Statement V to c, getting M(d, c) ↔ M(c, c). But specifying the first part of Statement IV to c gives us ¬M(c, c), a contradiction.

• (c, 10) Assuming that Statements I, II, III, IV, V, and VI are all true, use propositional and predicate proof rules to prove Statement VII. Do not assume the truth of any of the other statements. You may use English, symbols, or a combination, as long as your argument is clear.

Since our goal is a universal statement, we use Generalization. Let x be an arbitrary animal. We want to prove F(x) → M(w, x), and we break this proof into five cases depending on the identity of animal x.

If x = c or x = d, we specify the second part of Statement V to x and get F(x) → (M(c, x) ∧ M(d, x). If F(x) were true, by Modus Ponens and Separation we could get M(c, c) (if x = c) or M(d, d) (if x = d). In either case we can get a contradiction by specifying the first part of Statement IV to c or d. Since F(x) must be false in these cases, the desired implication follows by Vacuous Proof.

If x = w, we have ¬F(x) by Separation from Statement VI, and this gives us the desired implication by Vacuous Proof.

If x = f, we can specify the second part of Statement I to w and get ¬F(w) → M(f, w). Since we have already seen that ¬F(w) follows from Statement VI, by Modus Ponens we know that M(f, w) is true. Specifying the second part of Statement IV to f and w gives us that M(w, f) is true, so the desired implication follows by Trivial Proof.

If x = s, we have more work to do because none of the statements explicitly mention Scout. By Instantiation on the second part of Statement VI, we know that some animal y satisfies F(y) ∧ R(y) ∧ M(y, w). This animal cannot be c, d, or w because we know that F(c), F(d), and F(w) are all false. It cannot be f because we know ¬D(f) from Statement I, and ¬R(f) follows using Statement II as in part (a) of this problem. (Quoting part (a) is legitimate because its assumptions, Statements I-III, are still assumed to be true here.) This means y = s, and thus that F(s), R(s), and M(s, w) are all true. M(w, s) follows by specifying the second part of Statement IV to s and w, then using Modus Ponens. And the desired implication follows by Trivial Proof.

I've been careful about quoting rules and using symbols above, but a convincing proof can use just English, for example: "Let x be an arbitrary dog. If x is Cardie or Duncan, x does not live on the farm because if they did V would obligate them to meet themselves, which they cannot by IV. If x were Floyd, he met Whistle by I, since Whistle does not live on the farm by VI. By IV, then, Whistle met him. If x were Whistle, he would not live on the farm by VI. Finally, we can show that Scout must be the animal from VI because Floyd is not a retriever and the other three do not live on the farm, Whistle by VI and Cardie and Duncan as we showed from V above. So Scout met Whistle, and thus Whistle met Scout by IV. So every animal either does not live on the farm or was met by Whistle."

The statements do not settle all the atomic predicates. We know that Floyd and Scout live on the farm and the others do not. We know that Scout is both a dog and a retriever, and that Floyd is neither, but we know nothing about the caninity or retrieverness of the other three. We know most of the values of the M predicate, but not whether Cardie and Duncan met Whistle (and vice versa), and not whether Floyd met Scout (and vice versa).

• 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, relations, and functions defined above, but do not assume the truth of Statements I-VII.

• (a) Statement IV says that the relation M is both antisymmetric and antireflexive.

FALSE. It says that M is antireflexive and symmetric.

• (b) No relation M satisfying Statement IV could be either an equivalence relation or a partial order, even if A were the empty set.

FALSE. If A is empty, the only possible relation has no elements. But the defining properties of equivalence relations and partial orders are all universal statements, so they are all true if the base set is empty. We've also observed that the equality relation on any set is both an equivalence relation and a partial order, and the unique relation on an empty set is the equality relation.

• (c) The function f defined above is onto.

FALSE. There is no string w such that f(w) = 0, for example.

• (d) The function f defined above is not one-to-one.

FALSE. If two strings u and v are different, f(u) = uu and f(v) = vv are also different.

• (e) The function g defined above is onto.

TRUE. Any string w is equal to both g(w0) and g(w1).

• (f) The function g defined above is not one-to-one.

TRUE. Every string is the image under g of two strings. For example, λ is both g(0) and g(1).

• (g) For every string w in Σ*, the string g(f(w)) has odd length.

FALSE. There is exactly one counterexample, w = λ. The length of f(w) is even for any string w, and g(w) reduces the length by one unless w = λ.

• (h) There exists a string w in Σ* such that f(g(w)) = g(f(w)).

TRUE. Certainly λ is such a string. The only other two are 0 and 1., since if w is non-empty the length of g(f(w)) is 2|w| - 1.

• (i) Let k and n be any two naturals greater than 1. Then it is possible to define sets S1,..., Sn such that each set Si has size k, and such that for any two sets Si and Sj with i ≠ j, the size of Si ∩ Sj is 1.

TRUE. Let x be an element common to all the sets, and let each of the sets have k-1 other elements of its own, that are not in any of the other sets. This can be done as long as there are at least 1 + n(k-1) elements available.

• (j) Every symmetric binary relation on a non-empty set is also reflexive.

FALSE. The empty relation on any non-empty set is symmetric (vacously) but not reflexive.

• (k) A partial order P on a non-empty set is a total order if and only if it has both an element x such that ∀y: P(x, y) and an element z such that ∀y: P(y, z).

FALSE. A finite total order must have two such elements. But a non-total order can have them as well. Consider the set {a, b, c, d} where P(a, b), P(a, c), P(a, d), and P(c, d) are all true but neither P(b, c) nor P(c, b) is true. Here a is the minimum element and d is the maximum, but the order is not total.

• (l) Statement II says that the set of retrievers in A is a proper subset of the set of dogs in A.

FALSE. It says that it is a subset, but it does not say or imply that there exists at least one dog that is not a retriever.

• (m) Statement V says that the set of animals in A who live on the farm is a subset of the set of animals in A who Cardie and Duncan both met.

TRUE. The second part says exactly that. Those of you who took the exam early on Tuesday or through Disabilities Services had a slightly different statement that finished with "the set of animals who met Cardie and Duncan". Since Statement IV is not assumed to be true here, the correct answer for those people was FALSE, as I discovered only when someone in the early session Wednesday pointed this out. I graded those exams with TRUE as the right answer. If you lost points because you caught this mistake, show me your exam and we'll talk.

• (n) If p, q, r, and s are all prime numbers, and pq = rs, then we must have p = r and q = s. (Here "pq", for example, means the integer product of p and q.)

FALSE. This looks like the unique factorization theorem but it isn't. A counter example is p = s = 2 and q = r = 3.

• (o) There is a two-digit natural that has three different odd primes in its factorization.

FALSE. The smallest such natural is 3×5×7 = 105. The smallest odd primes are 3, 5, and 7, because 1 is not prime.

• Question 5 (30): Here are some straightforward number theory questions.

• (a, 5) Give prime factorizations of the naturals 32 and 55. Explain how you can determine from these factorizations that these two numbers are relatively prime to one another. Say which numbers in the set {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, if any, relatively prime to both 32 and 55.

32 = 2×2×2×2×2, and 55 = 5×11. The two numbers are relatively prime to one another because they share no prime factors. Of the ten given numbers, all but 5 and 10 are relatively prime to 55 and the five odd ones are relatively prime to 32. That leaves 1, 3, 7, and 9 as relatively prime to both. Note that 1 is relatively prime to any positive integer.

• (b, 10) Find an inverse of 55, modulo 32, and an inverse of 32, modulo 55. Be sure to make clear which is which.

The Euclidean Algorithm produces remainders 55, 32, 23, 9, 5, 4, and 1. The successive linear combinations are:

• 55 = 1(55) + 0(32)
• 32 = 0(55) + 1(32)
• 23 = 1(55) - 1(32)
• 9 = -1(55) + 2(32)
• 5 = 3(55) - 5(32) (subtracting twice the 9 line from the 23 line)
• 4 = -4(55) + 7(32)
• 1 = 7(55) - 12(32)

The inverse of 55 modulo 32 is 7, and the inverse of 32 modulo 55 is -12, or 43.

• (c, 10) I have a pile of fewer than 2000 coconuts. When I divide them into piles of 32, I have 26 left over. When I divide them into piles of 55, I have 30 left over. Can it be determined from this information alone exactly how many coconuts I have? If so, do it, and if not, find what the possible numbers are.

The Chinese Remainder Theorem will allow us to determine the equivalence class of the number x of coconuts, modulo 32×55 = 1760. This might or might not be enough to determine the number of coconuts when we combine it with the extra information 0 ≤ x < 2000. So we really need to find the exact number in order to answer the question. Many of you found via trial and error that 250 satisfies both congruences. Some of you got full credit without using the CRT at all, since you showed that there were no other solutions in the given range. (This was aided by arguing that any number that met both congruences had to be divisible by 10, which I suppose is actually an implicit use of the CRT in itself.)

But the conventional way to determine the equivalence class of x works just fine. Using the inverses found in part (b), we compute 55×7×26 + 32×(-12)×30 = 10010 - 11520 = -1510. The number of coconuts must then be 250, which we find by adding 1760 to -1510. However you found 250, if you used the CRT you needed to note that the next largest number in the equivalence class is 250 + 1760 = 2010, which is too large to be a solution. The most common error in this method was switching the 26 and the 30.

• (d, 10XC) Define the predicate A on naturals so that A(x, y) means "¬(D(x, y) ∨ D(y, x)", where D is the division predicate. Define the predicate R on naturals so that R(x, y) means "x and y are relatively prime". Prove the statement "∀x: ∀y: (R(x, y) ∧ (x > 1) ∧ (y > 1)) → A(x, y)". You should use predicate proof rules and the definitions of these terms. Again, either English, symbols, or a combination are acceptable if your argument is clear.

Many people gave unconvincing answers that amounted to "Relatively prime means that the numbers don't divide one another, so it's true by definition." It isn't. The definition of R(x, y) is that no third number z with z > 1 divides both x and y. Note that A(4, 6), for example, is true while R(4, 6) is not.

A correct proof that uses the definitions is as follows. Assume (for a proof by contradiction) that R(x, y), x > 1, and y > 1 are all true but A(x, y) is false. That means that either D(x, y) or D(y, x) is true. But if x divides y, it is a common factor of x and y because we know it divides x, and thus RP(x, y) is false. Similarly, if y divides x, y is the forbidden common factor. Either way, there is a contradiction, so the given implication is true.

My proof does not use the FTA, but you were certainly allowed to do so. I got some convincing proofs along the lines of "RP(x, y) means that no prime occurs in both factorizations, but if one of x or y divided the other there would be a prime in both factorizations."