# Solutions to First Midterm Exam

### Directions:

• Answer the problems on the exam pages.
• There are six problems for 100 total points plus 10 extra credit. Actual scale is A=96, C=64.
• If you need extra space use the back of a page.
• No books, notes, calculators, or collaboration.

```  Q1: 10 points
Q2: 15 points
Q3: 15 points
Q4: 15 points
Q5: 20+10 points
Q6: 25 points
Total: 100+10 points
```

Question text is in black, solutions in blue.

• Questions 1-5 all deal with a dog play group G, consisting of exactly the four dogs Ace, Biscuit, Cardie, and Duncan, denoted by the constants a, b, c, and d respectively. The variables g, g1, g2, etc., are of type "dog in G". There is also a set of playthings P, which includes a Rope chew r, a Stuffed chicken s, and a Tennis ball t, possibly with other items as well. The variables p, p1, p2, etc., are of type "plaything in P". The predicate H(g, p) means "dog g has plaything p". Unless otherwise indicated, there are no restrictions on a dog having more than one plaything, or more than one dog having the same plaything.

• Question 1 (10): Translate the following three statements as indicated:

• Statement (a) (to symbols) It is not the case that if Cardie has the tennis ball, then Duncan has the tennis ball.

¬(H(c, t) → H(d, t)). This translates to H(c, t) ∧ ¬H(d, t) by Definition of Implication and DeMorgan. It does not translate to ¬H(c, t) → ¬H(d, t) or to any of the many other things people tried using incorrect rules.

• Statement (b) (to English) H(c, t) → (H(a, t) ↔ H(b, t))

If Cardie has the tennis ball, then Ace has it if and only if Biscuit has it.

• Statement (c) (to symbols) It is not the case that Duncan has the tennis ball and that Ace does not have the tennis ball.

¬(H(d, t) ∧ ¬H(a, t)), which translates to ¬H(d, t) ∨ H(a, t) by DeMorgan and then, if you like, to H(d, t) → H(a, t) by Definition of Implication.

• Question 2 (15): Using propositional logic on the three statements (a), (b), and (c), which involve the four propositions H(a, t), H(b, t), H(c, t), and H(d, t), determine which of the dogs have the tennis ball and which do not. (That is, you are to determine the truth values of those four propositions.) It turns out that there are exactly two ways to set the four variables to satisfy all three statements -- find out what they are and prove that there cannot be any others. (You may use either truth tables or a propositional proof -- the propositional proof is shorter.)

Let's use A, B, C, and D to refer to the four propositions, so that A means H(a, t), etc. Statement (a) tells us that C is true and that D is false. Since C is true, statement (b) tells us that A and B have the same truth value. Statement (c) is made true by ¬D, so it gives us no further information. The two solutions are thus (1) only C is true, and (2) A, B, and C are true and D is false. No other solution is possible because all other settings violate (a) or (b).

• Question 3 (15): Translate the following four statements as indicated:

• Statement (a) (to English) ∃g1: ∃g2: ∀p: (g1 ≠ g2) ∧ (H(g1, p) ∨ H(g2, p))

There exist two different dogs such that for any plaything, one of the two dogs has that plaything.

• Statement (b) (to symbols) There is a dog that has all of the playthings.

∃g: ∀p: H(g, p)

• Statement (c) (to English) ∃p: ∀g: H(g, p)

There exists a plaything that all of the dogs have.

• Statement (d) (to symbols) Given any two different playthings, if Ace has one then he also has the other.

∀p1: ∀p2: (p1 ≠ p2) → (H(a, p1) → H(a, p2)). Handling the "two different playthings" is somewhat tricky. You can't just assert that the two arbitrary playthings are different, because they might not be. You need to say that if they are different, the fact about Ace is true. Also, several people used ↔ rather than → between the two values of H. This leads to an equivalent proposition but I took off a point because the English clearly says "if... then".

• Question 4 (15): Given the four statements from Question 3 (but not the statements from Question 1), prove that Ace has the stuffed chicken. Use the quantifier rules of Instantiation, Existence, Specification, and Generalization. (You may not need all four rules, and you may not need all four premises.)

Let's work backwards from the conclusion. Only statement (d) talks about Ace -- it says that Ace has the stuffed chicken if he has any other plaything. So we need to show that he has some plaything. Statements (a) and (b) don't help us do this, at least not directly, because there is no reason that Ace should be one of the two dogs in (a) or the dog in (b). But (c) says that one plaything belongs to all the dogs, so it must belong to Ace.

Now that we have the idea of our proof, we need to use the rules. To use statement (c), we must work from the outside in. So we first use Instantiation and say "Let x be the plaything such that ∀g: H(g, x) is true". Then by Specification we can say H(a, x). (We can't go directly from ∃p: ∀g: H(g, p) to ∃p: H(a, p), because the quantifier rules can only be used on the outermost quantifier. But if we wanted this statement we could get it using three rules.)

Now that we have H(a, p), we want to use Specification on statement (d), letting p1 be x and p2 be s, to get (x ≠ s) → (H(a, x) → H(a, s)). But is (x ≠ s) necessarily true? No, because x was created by Instantiation and we know only its type and the fact we created it for. (Typo in red fixed 3 April 2013.)

Fortunately we can use Proof by Cases. If x = s, then we can get our goal of H(a, s) by substitution from H(a, x). If x ≠ s, we have H(a, x) → H(a, s) by Modus Ponens and then H(a, s) by Modus Ponens again. Since we can prove H(a, s) in both cases, we have proved it without an assumption and we are done.

• Question 5 (20+10): For this question only, assume that the relation H is a function from G to P.

• (a,10) Which of the four statements from Question 3 could still be true, and which could not? Justify your answers.

Statement (a) cannot be true because if H is a function, each dog has exactly one plaything, and thus any two dogs can have at most two playthings between them. But P has at least the three elements r, s, and t, and (a) says the two dogs together have all of them.

Statement (b) cannot be true because it says that some dog has all the playthings, of which there are at least three. But if H were a function, each dog would have exactly one.

Statement (c) could be true if H were a function, because there is a valid function that assigns each dog the same plaything.

Statement (d) cannot be true because it says that if Ace has one plaything, he has all the others as well (since he has each other one by a separate Specifation from (d)). But he must have at least one if H is total, and he cannot have more than one if H is well-defined.

• (b,5) If H is onto but not one-to-one, what can we conclude about the set P?

Each plaything belongs to a dog, and at least one belongs to more than one dog. So there are fewer playthings than dogs, meaning that there are exactly three elements in P.

• (c,5) If H is one-to-one but not onto, what can we conclude about the set P?

Each dog has a different plaything, and at least one plaything is unowned. So there are more playthings than dogs, meaning that there are at least two others in addition to r, s, and t.

• (d,5XC) At least one of the four statements from Question 3 is possible if H is a function, but impossible if H is an injection (a one-to-one function). Which statement, and why?

Statement (c) is the only one that can be true if H is a function. But if (c) is true, all dogs are assigned the same plaything and H is not one-to-one.

• (e,5XC) At least one of the four statements from Question 3 is possible if H is a function, but impossible if H is a surjection (an onto function). Which statement, and why?

Again statement (c) is the only candidate. If (c) is true, only one plaything is owned by dogs, and thus the function H is not onto, as there is at least one (in fact at least two) playthings that are not owned by any dogs.

• Question 6 (25): This question deals with some number-theoretic properties of the naturals 18 and 25.

• (a,5) Run the Euclidean Algorithm on these two numbers and thus show that they are relatively prime.

25 = 1·18 + 7, 18 = 2·7 + 4, 7 = 1·4 + 3, 4 = 1·3 + 1; 3 = 3·1 + 0. Since 1 was the last nonzero number produced by the Euclidean Algorithm, it is the gcd of 18 and 25 and thus these numbers are relatively prime.

• (b,10) Using your calculations from (a) or otherwise, find two integers x and y such that 18x + 25y = 1.

25 = 1·25 + 0·18, 18 = 0·25 + 1·18, 7 = 1·25 - 1·18, 4 = -2·25 + 3·18, 3 = 3·25 - 4·18, 1 = -5·25 + 7·18. So we may take x to be 7 and y to be -5.

• (c,5) Consider the number 18·25 + 1 = 451. Explain why any prime number that divides 451 cannot be a divisor of either 18 or 25.

The proof I had in mind was that if a prime p divides either 18 or 25, it must divide 450 and thus 451 % p is necessarily 1, meaning that p does not divide 451. This is reminiscent of the construction in the Infinitely Many Primes theorem.

It's also valid to factor 18 and 25, and show directly that neither 2, 3, nor 5 divide 451.

A student came up with a nice third proof. If a prime p divides 451, then for some natural r, pr = 451 and thus pr ≡ 1 (mod 18) and pr ≡ 1 (mod 25). Thus p has an inverse mod 18 and mod 25, which by the Inverse Theorem means that p must be relatively prime to both 18 and 25, and thus can't be a divisor of either.

• (d,5) Find an integer z such that z ≡ 7 (mod 18) and z ≡ 13 (mod 25). You may find the answer to part (b) useful. You may express your answer as an arithmetic expression without evaluating it.

By the Chinese Remainder Theorem proof, we can use the facts that 7·18 ≡ 1 (mod 25) and -5·25 ≡ 1 (mod 18), and set z to be 13·7·18 + 7·(-5)·25 = 1638 - 875 = 763. Any number that differs from 763 by a multiple of 450 is also a solution, so the smallest natural solution is 313. Without the CRT proof, you could find 313 by dividing each of 13, 38, 63, 88,..., 313 by 18 until you find one with remainder of 7. Or, perhaps more easily, you could start with 7 and add 18's until you get a number congruent to 13 modulo 25, which you could recognize because its last two digits would be "13", "38", "63", or "88".