# Solutions to First Midterm Exam

#### 23 February 2006

• Question 1 (30): Let a be the proposition "he is asleep", c be the proposition "he has his coat", l be the proposition "he has the leash" and w be the proposition "it is time for a walk".

• (a,10) Translate the following four statements as indicated:
• (to English) (I) (a ∧ c) ⊕ l

Either he is both asleep and has his coat, or he has the leash, but not both.

• (to symbols) (II) If he has the leash, then he also has his coat.

l → c

• (to English) (III) l ∨ (c → ¬a)

Either he has the leash or, if he has his coat, he is not asleep.

• (to symbols) (IV) It is time for a walk if and only if it is not the case that either he is asleep, he does not have the leash, or he does not have his coat.

w ↔ ¬(a ∨ ¬l ∨ ¬c)

• (b,20) Prove that given the statements I, II, III, and IV above, it is time for a walk. One good way to do this is to construct a truth table. Another is to use a deductive sequence proof -- a good way to do this is to use Proof by Cases with intermediate proposition l. In a deductive sequence proof, remember that you may use valid rules even if you don't remember their names.

With a truth table, it is easier to just analyze I, II, and III on the variables a, c, and l -- we find that I ∧ II ∧ III are true if and only if (¬a ∧ c ∧ l), which by IV (using DeMorgan) is equivalent to w.

``````
((a and c) xor l) and (l --> c) AND (l or (c --> not a))
0  0  0   0  0   0   0  1  0  |0|  0  1  0   1  1  0
0  0  0   1  1   0   1  0  0  |0|  1  1  0   1  1  0
0  0  1   0  0   0   0  1  1  |0|  0  1  1   1  1  0
0  0  1   1  1   1   1  1  1  |1|  1  1  1   1  1  0
1  0  0   0  0   0   0  1  0  |0|  0  1  0   1  0  1
1  0  0   1  1   0   1  0  0  |0|  1  1  0   1  0  1
1  1  1   1  0   1   0  1  1  |0|  0  0  1   0  0  1
1  1  1   0  1   0   1  1  1  |0|  1  1  0   0  0  1
``````

Here is one way to do the deductive sequence proof:

1. Assume l.
2. By Modus Ponens on II, derive c.
3. If a were true, I would be (1 ∧ 1) &oplus 1 = 0, so a must be false.
4. By IV, using DeMorgan, ¬a ∧ c ∧ l is equivalent to w.
5. We have proved l → w given I, II, III, and IV. (Direct Proof, lines 1-4.)
6. Now assume ¬l.
7. By Tertium Non Datur from III, we have c → ¬a. (The Tertium Non Datur rule is ((x ∨ y) ∧ ¬x) → y -- it can be proved in two lines from Definition of Implication and Modus Ponens.)
8. By Definition of Implication this is ¬c ∨ ¬a.
9. By DeMorgan this is ¬(a ∧ c).
10. But now I evaluates to 0 ⊕ 0 = 0, while it is assumed to be true.
11. We have reached a contradiction from ¬l, so l is true.
12. By Modus Ponens from line 5, w is true.

• Question 2 (50+10): This question involves a set of dogs D and the following predicates: L(x) means "dog x is a Labrador", S(x) means "dog x likes to swim", and B(x) means "dog x is black".

• (a,10) Translate the following three statements as indicated:
• (to symbols) (V) Ebony is a black Labrador.

B(e) ∧ L(e) (You may supply any name for the constant "Ebony".)

• (to English) (VI) ∃y: S(y) ∧ ¬B(y)

There exists a dog that likes to swim and is not black.

• (to symbols) (VII) Only Labradors like to swim.

"If a dog likes to swim, then it is a Labrador": ∀x: S(x) → L(x)

• (b,10) The following statement VIII defines the binary predicate E(x,y) on D:

¬E(x,y) ↔ (B(x) ⊕ B(y))

Prove that E is an equivalence relation. (Use this definition only, not the statements from (a).)

Reflexive: E(x,x) is defined to be ¬(B(x) ⊕ B(x)) = ¬0 = 1.

Symmetric: E(x,y) ↔ ¬(B(x) ⊕ B(y)) ↔ ¬(B(y) ⊕ B(x)) ↔ E(y,x), using VIII and the fact that ⊕ is commutative (that is, for any p and q, (p ⊕ q) ↔ (q ⊕ p)).

Transitive: Assume E(x,y) and E(y,z), so that (B(x) ⊕ B(y)) and (B(y) ⊕ B(z)) are both false. This means that B(x) and B(y) have the same value, and that B(y) and B(z) have the same value, so we see that B(x) ⊕ B(z) is false and so E(x,z) is true.

• (c,20) Using statements V, VI, VII, and VIII from parts (a) and (b), prove the statement:

∀u:∃v: L(v) ∧ E(u,v)

(For full credit you must use the predicate calculus proof rules -- there will be partial credit for informal arguments.)

1. Let a be an arbitrary dog.
2. Assume B(a).
3. Let v be e.
4. We have L(e) by right separation from V.
5. We have B(e) by left separation from V.
6. We have B(a) ∧ B(e) by conjunction from lines 2 and 5.
7. So B(a) ⊕ B(e) is false by definition of ⊕, and thus E(a,e) is true by VIII.
8. By conjunction from lines 4 and 7, we have L(e) ∧ E(a,e)
9. By Existence, we have ∃v: L(v) ∧ E(a,v).
10. Now assume ¬B(a).
11. Using Instantiation on VI, let c be a dog such that S(c) ∧ ¬B(c).
12. By Specification on VII, we have S(c) → L(c).
13. By left separation on line 11, we have S(c).
14. By Modus Ponens on lines 12 and 13, we have L(c).
15. Since ¬B(a) and ¬B(c), by definition of ⊕ we have that B(a) ⊕ B(c) is false, and so E(a,c) is true by VIII.
16. By conjunction from lines 14 and 15, we have L(c) ∧ E(a,c).
17. By Existence, we have ∃v: L(v) ∧ E(a,v).
18. We have now proved ∃v: L(v) ∧ E(a,v) by cases.
19. Since a was arbitrary, we have proved ∀u:∃v: L(v) ∧ E(u,v).

• (d,10) Let C be the set {b,n} and define a function f from D to C by the rules (f(x) = b) ↔ B(x) and (f(x) = n) ↔ ¬B(x). Can you determine from statements V, VI, and VII in part (a) whether the function f is onto (a surjection)? Justify your answer, making it clear that you understand the relevant definitions.

We can be sure that f is onto. The definition of onto is that ∀c:∃d: f(d) = c. Let c be an arbitrary element of C. If c = b, then we can let d be e (Ebony), and we know that f(e) = c because B(e) is true. If c = n, then we can let d be the dog whose existence is guaranteed by VI. Since we have ¬B(d) for this dog we know that f(d) = n. These are the only cases possible for c since C = {b, n}, so we have proved ∃d:f(d) = c for arbitrary c and have thus verified that f is onto.

• (e,10 XC) Can you determine from statements V, VI, and VII in part (a) whether the function f is one-to-one (an injection)? Justify your answer, making it clear that you understand the relevant definitions.

We don't have enough information to determine whether f is one-to-one. We know that two different dogs exist: Ebony and the dog guaranteed to exist by VI. (They aren't the same dog because Ebony is black and the other dog isn't.) If a third dog exists, then f cannot be one-to-one because either Ebony or the second dog will have the same color as the third dog and thus the same value of f. But there is no reason why a third dog has to exist -- the axioms are all satisfied if Ebony (a black Labrador who might or might not swim) and the non-black, swimming Labrador from VI are the only two dogs in D. And in this case, f is one-to-one.

• Question 3 (20): Let N = {0,1,2,3,...} be the set of all naturals. Let R be the binary relation on N defined by:

R(a,b) ↔ [(a ≤ b) ∧ (∃c: b - a = 2c)]

That is, R(a,b) means that b - a is an even natural.