CMPSCI 250: Introduction to Computation
First Midterm Exam
David Mix Barrington
14 October 2015
Directions:
- Answer the problems on the exam pages.
- There are six problems, some with multiple parts, for 100 total
points plus 10 extra credit. Actual scale A = 90, C = 65.
- 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: 20 points
Q2: 20 points
Q3: 10 points
Q4: 15 points
Q5: 15 points
Q6: 20+10 points
Total: 100+10 points
Here are definitions of sets, predicates, and statements used
in Questions 1-5 on this exam.
Remember that the score of any quantifier is always to the end of
the statement it is in.
Let D be a finite set of dogs including the named dogs Cardie (c), Duncan
(d), Mia (m), and Toby (t), along possibly with others.
Let DW by the set of the seven days of the week: {Sun, Mon, Tue, Wed,
Thu, Fri, Sat}.
Let N be the set of natural numbers {0, 1, 2, 3,...}.
Let L(x, y, r) be the predicate defined by "dog x likes dog y on day of week r".
Let w be the function from D to N defined so that w(x) is the weight
of dog x in kilograms, rounded to the nearest integer.
Let SW(x, y) ("same weight") be the binary relation on D defined by
"w(x) = w(y)".
Let LEW(x, y) ("less than or equal weight") be the binary relation on D
defined by "w(x) ≤ w(y)".
- Question 1 (20):
Translate each statement as indicated, using the set of dogs D, the
set of breeds B, the set of events E, and the various predicates
defined above. GT(x) means "x got a treat", IB(x, y) means "dog x
is
of breed y", SB(x, y) means "dog x and dog y are of the same breed",
and WB(y, z) means "event y was won by dog z".
- (a, 3) (to symbols) (Statement I)
If Duncan likes Toby on Sundays, then it is not the case that Duncan
likes both Mia on Wednesdays and Toby on Tuesdays.
- (b, 3) (to English)
(Statement II)
¬(L(d, t, Sun) ∧ L(d, t, Tue)) → (L(d, m, Wed) ∧
L(d, t, Sun)).
- (c, 3) (to symbols) (Statement III)
Duncan likes Toby either on all days of the week or on none.
- (d, 2) (to English) (Statement IV)
∀r:∀x: L(c, x, r)
- (e, 3) (to symbols) (Statement V)
The function w is not a one-to-one function.
- (f, 2) (to English) (Statement VI)
¬∀x:∃r: L(d, x, r)
- (g, 3) (to symbols) (Statement VII)
On Fridays, Duncan dislikes every dog that weighs as much or more than Mia.
- (h, 2) (to English) (Statement VIII)
∀x: LEW(x, t) → L(d, x, Wed)
- Question 2 (20):
The following are ten true/false questions, with no explanation
needed or wanted, no partial credit for wrong answers, and no penalty
for guessing. They use the sets and relations defined above. Some
may
depend as well on the statements I through VIII given in Question 1.
- (a) The relation SW is an equivalence relation.
- (b) The relation LEW is reflexive and transitive.
- (c) The relation LEW is not a partial order.
- (d) The relation w is not onto.
- (e) Let R ⊆ D × DW be the relation defined by
R(x, r) = "Duncan likes dog x on day r". Then R is total but not well-defined.
- (f) Let S ⊆ D × DW be the relation defined by
S(x, r) = "Cardie likes dog x on day r". Then R is neither total nor well-defined.
- (g) Let X ⊆ DW × N be defined by X(r, n) =
"n is the weight of a dog that Cardie likes on day r, and no such dog has
weight smaller than n". Then X is a one-to-one function from DW to N.
- (h) Let Y ⊆ DW × N be defined by Y(r, n) =
"n is the weight of a dog that Duncan likes on day r, and no such dog has
weight smaller than n". Then we cannot tell from Statements I-VIII whether
X is a one-to-one function from DW to N.
- (i) Let A and B be any two disjoint nonempty sets (so that
A ∩ B = ∅). Let U be any partial order on A and let V be any
partial order on B. Then U ∪ V (the set of all ordered pairs that are in
either U or V) is a partial order on A ∪ B.
- (j) Let A, B, U, and V be as in part (i). Then U ∩ V (the set
of all ordered pairs that are in both U and V) is a partial order on A
∪ B.
- Question 3 (10): This question uses the sets,
definitions, and predicates above, and the statements from Question 1.
(Note: The point values of Questions 3 and 5 were
reversed on the test paper, though they were correct on page 2.)
From Statements I, II, and III, there is only one possible setting of
the truth values of the three propositions L(d, t, Sun), L(d, t, Tue), and
L(d, m, Wed). Determine this setting and justify it, either with a truth
table or a deductive argument.
- Question 4 (15): This question also uses the sets,
definitions, and predicates from above and the statements from
Question 1.
Prove, using any or all of Statements I through VIII, that
Toby weighs less than Mia. (Hint: One way to proceed is by Proof by
Contradiction.)
- Question 5 (15): This question also uses the sets,
definitions, and predicates from above and the statements from
Question 1.
Prove, using any or all of Statements I through VIII, the
following statement:
∃a:∀r: (L(d, a, r) ⊕ L(c, a, r)) &and' ¬LEW(a, t)
Make your use of quantifier proof rules clear.
- Question 6 (20+10):
These number theory questions deal with the numbers 49 and 100.
- (a, 5)
Give the prime factorizations of 49 and 100. How can you tell from these
factorizations that 49 and 100 are relatively prime?
- (b, 5) Run the Euclidean Algorithm on 100 and 49. How can you
tell from the result that these two numbers are relatively prime?
- (c, 10) Find integers x and y such that 49x + 100y = 1.
Which, if either, is the inverse of 49, modulo 100?
- (d, 10XC)
I have bought an item costing $12.87 from a vending machine that cannot
return coins as change, but can give me 49-cent stamps. I have a large supply
of dollar bills. Find a number of dollar bills I can give the machine, and a
number of stamps it can return to me, such that my net payment to the machine
is exactly $12.87. (Partial credit if your answer is in terms of the numbers
x and y found in part (c), rather than an actual numerical answer. If you do
it this way you may assume that is positive and that y is negative.
Last modified 23 October 2015