CMPSCI 250 Practice Midterm #1 Solutions

Actual midterm will be 30 September 2004

There are six questions for 100 total points.

Questions 1-4 deal with three sets of naturals (non-negative integers) named A, B, and C. You will need the following predicates defined in the lecture of Mon 27 September: The predicate D(x,y) on naturals x and y means "x divides y", or formally, ∃z:xz=y. The predicate P(x) on naturals means "x is a prime number", or formally,

(x>1)∧∀y: D(y,x)→(y=1)∨(y=x).

Question 1 (15): Translate the following English statements about A into symbolic form:

• (a) If 3 is an element of A, then so are both 5 and 7.

(3∈A)→((5∈A)∧(7∈A))

• (b) Every element of A is a prime number.

∀x:(x∈A)→P(x)

• (c) Every number that divides an element of A is in B.

∀x:[∃y:(y∈A)∧D(x,y)]→(x∈B)

Question 2 (15): Translate the following symbolic statements about A into English:

• (d) (2∈A)⊕(5∈A)

"Either 2 or 5 is in A, but not both."

• (e) ∃x:∃y:[(x∈A)∧(y∈A)∧(x+y=9)]

There exist a natural x and a natural y such that x is in A and y is in A and x plus y is 9", or more understandably, "There are two naturals in A whose sum is 9."

• (f) C = {x: ∃y:[D(y,x)∧(y∈A)]}

"C is the set of naturals x such that there exists a natural y such that y divides x and y is in A", or more understandably, "C is the set of numbers that are divided by a number in A".

Question 3 (20): Assuming that all six of the statements (a)-(f) are true, exactly which naturals are both less than 10 and in A? Prove your answer by either a truth table or a propositional argument. (Hint: Because of (b) you need only worry about the membership questions for the four prime numbers that are less than 10, and statements (a), (d), and (e) give you compound propositions involving these. Ignore (c) and (f), which don't give information about A.)

We are interested in whether each of 2, 3, 5, and 7 are in A. Call the four membership propositions P2, P3, P5, and P7.

• Statement (a) says "P3→(P5∧P7)".
• Statement (b) gives us no further information.
• Statement (d) says "P2⊕P5".
• Statement (e) implies "P2∧P7", since 2 and 7 are the only pair of prime numbers less than ten that sum to 9.

Truth Table Proof:

```      [P3 --> (P5 and P7)] and [P2 xor P5] and [P2 and P7]
0  1    0  0   0    0    0  0   0  |0|   0  0   0
0  1    0  0   1    0    0  0   0  |0|   0  0   1
0  1    1  0   0    1    0  1   1  |0|   0  0   0
0  1    1  1   1    1    0  1   1  |0|   0  0   1
1  0    0  0   0    0    0  0   0  |0|   0  0   0
1  0    0  0   1    0    0  0   0  |0|   0  0   1
1  0    1  0   0    0    0  1   1  |0|   0  0   0
1  1    1  1   1    1    0  1   1  |0|   0  0   1
0  1    0  0   0    1    1  1   0  |0|   1  0   0
0  1    0  0   1    1    1  1   0  |1|   1  1   1
0  1    1  0   0    0    1  0   1  |0|   1  0   0
0  1    1  1   1    0    1  0   1  |0|   1  1   1
1  0    0  0   0    0    1  1   0  |0|   1  0   0
1  0    0  0   1    0    1  1   0  |0|   1  1   1
1  0    1  0   0    0    1  0   1  |0|   1  0   0
1  1    1  1   1    0    1  0   1  |0|   1  1   1

P2 and P7 are true, P3 and P5 are false.
```

Propositional Proof: P2 and P7 are true by (e). By (d) and the definition of exclusive or, P5 must be false. The contrapositive of (a) says "(¬P5∨¬P7)→¬P3" (using DeMorgan and-to-or). We have ¬P5, which gives ¬P5∨¬P7 by right joining, which gives ¬P3 by modus ponens. So P2 and P7 are true, and P3 and P5 are false.

Question 4 (20): Prove the following statements about A, B, and C, being specific about your use of the four proof rules for quantifiers:

• ∀x:∃y:[(y∈B)∧(y≤x+1)]

• Let i be arbitrary.
• Let j be 1.
• By specification from (c), [∃y:(y∈A)∧D(1,y)]→(1∈B)
• Let k be 2.
• We proved 2∈A above, and D(1,2) is true.
• Since we found k, we conclude ∃y:(y∈A)∧D(1,y).
• By modus ponens, we conclude 1∈B.
• Since i is a natural, i+1 is at least 1, so 1≤i+1.
• Since we found j, we conclude ∃y:(y∈B)∧(y&le:i+1).
• Since i was arbitrary, we conclude ∀x∃y:(y∈B)∧(y≤x+1).
• ∀i:∃j:[(j∈C)∧(i≤j)]

• Let x be arbitrary.
• Let y = 2x. (This is the creative step, we must work out that 2x works.)
• Let z be 2.
• Note that 2∈A (from Question 3) and D(2,2x).
• Since we found z, we conclude ∃z:D(z,2x)∧(z∈A).
• By (f), we conclude 2x∈C.
• By arithmetic properties of the naturals, we observe x≤2x.
• Since we found a y, we conclude ∃j:(j∈C)∧(i≤j).
• Since x was arbitrary, we conclude ∀i:∃j:(j∈C)∧(i≤j).
Questions 5 and 6 deal with two binary relations R (from A to B) and S (from B to A), where A and B are not necessarily the sets from above. Assume that both R and S define functions, that is, both are total and both are well-defined. These questions also deal with the following three statements:

• (I) ∀a:∀b:[R(a,b)↔S(b,a)]
• (II) ∀a:∀c:[∃b:R(a,b)∧S(b,c)]↔(a=c)
• (III) ∀b:∀d:[∃a:S(b,a)∧R(a,d)]↔(b=d)

The statements of Questions 5 and 6 were corrected on 28 September 2004. Here we present solutions for the corrected version.

Question 5 (15): Assuming statement (I), and the fact that both R and S are functions, prove statement (II). (It would be easy to adapt a correct proof of (II) to prove (III).

• Let x and y be two arbitrary elements of A.
• Assume ∃b:R(x,b)∧S(b,y).
• Let z be an element of B such that R(x,z) and S(z,y).
• By specification from (I), R(x,z)↔S(z,x).
• By substitution of equivalents, S(z,x).
• Since S is a function, it is well-defined, that is, ∀a:∀b:∀c:[S(b,a)∧S(b,c)]→(a=c).
• By specification, [S(z,x)∧S(z,y)]→(x=y).
• By modus ponens we conclude x=y.
• We have proved [∃b:R(x,b)∧S(b,y)]→(x=y).
• Now assume x=y.
• Because R is a function, it is total, so ∀a:∃b:R(a,b).
• By specification, ∃b:R(x,b).
• Let z be an element of B such that R(x,z).
• By specification from (I), R(x,z)↔S(z,x).
• By substitution, R(x,z)↔S(z,y).
• Since we found z, we conclude ∃b:R(x,b)∧S(b,y).
• We have proved (x=y)→∃b:R(x,b)∧S(b,y).
• By equivalence and implication, we have proved (x=y)↔∃b:R(x,b)∧S(b,y).
• Since x and y were arbitrary, we have proved (II) by generalization.

Question 6:(15) Assuming statements (II) and (III), and that R and S are functions, prove statement (I).

• Let a and b be arbitrary members of A and B respectively.
• Assume R(a,b).
• Since S is a function, it is total, so ∀y:∃x:S(y,x).
• By specification, ∃x:S(b,x).
• Let c be an element of A such that S(b,c).
• By conjunction, R(a,b)∧S(b,c).
• By existence, ∃b:R(a,b)∧S(b,c).
• By specification from (II), [∃b:R(a,b)∧S(b,c)]↔(a=c).
• By substitution of equivalents, we conclude a=c.
• Since S(b,c) and a=c, we conclude S(b,a)
• We have proved R(a,b)→S(b,a).
• Now assume S(b,a).
• Since R is a function, it is total, and by specification on the definition of totality, ∃y:R(a,y).
• Let d be such that R(a,d). By conjunction, S(b,a)∧R(a,d).
• By existence, ∃a:S(b,a)∧R(a,d).
• By specification from (III), [∃a:S(b,a)∧R(a,d)]↔(b=d).
• By substitution of equivalents, we conclude b=d.
• Since R(a,d) and b=d, we conclude R(a,b).
• We have proved S(b,a)→R(b,a).
• By equivalence and implication, we have proved R(a,b)↔S(b,a).
• Since a and b were arbitrary, we have proved (I).