CMPSCI 250: Introduction to Computation

David Mix Barrington

Fall, 2004

CMPSCI 250 Practice Midterm #1 Solutions

Practice Exam posted 23 September 2004

Solutions posted 28 September 2004

Actual midterm will be 30 September 2004

There are six questions for 100 total points.

Answers are in blue.

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:

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

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.

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:

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:

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).

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

Last modified 28 September 2004