CMPSCI 250: Introduction to Computation
First Midterm Exam Spring 2020
David Mix Barrington and Hia Ghosh
25 February 2020
Directions:
- Answer the problems on the exam pages.
- There are four problems, each with multiple parts, for 100 total
points plus 5 extra credit. Actual scale A = 93, C = 63.
- 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: 30 points
Q3: 30 points
Q4: 20+5 points
Total: 100+5 points
Here are definitions of sets, predicates, and statements used
on this exam.
Remember that the score of any quantifier is always to the end of
the statement it is in.
Question 2 deals with the following scenario.
Every day, Duncan monitors all visitors to the house
and evaluates which ones (in his judgment) pose a threat.
One day there were exactly five visitors, arriving at five
distinct times. In alphabetical order, they were an Amazon
driver (ad), the house cleaner (hc), the mail person (mp).
a political canvasser (pc), and a UPS driver (ud).
Let V be the set {ad, hc, mp, pc, ud}. Let PT and DA be
two unary relations on V, such that PT(x) means "visitor x posed
a threat" and DA(x) means "visitor x was driven away by Duncan".
Let AB be a binary relation on V, such that AB(x, y) means "visitor
x arrived before visitor y", or equivalently "visitor y arrived after
visitor x". We assume that AB is a strict total order, so that it
is antireflexive, antisymmetric, transitive, and total.
Let N be the set of natural numbers {0, 1, 2, 3,...}.
If a, b, and m are naturals, with m > 0, the notation "a ≡
b (mod m)" means "a is congruent to b, modulo m".
The operator "%" on naturals, as in Java, refers to integer division, so
that "x % y" is the remainder on dividing x by y.
- Question 1 (20):
Translate each statement as indicated, using the set of visitors
V = {ad, hc, mp, pc, ud} defined above and the predicates PT(x), DA(x),
and AB(x, y) defined above to mean "visitor x posed a threat", "visitor
x was driven away by Duncan", and "visitor x arrived before visitor y"
respectively. All variables should
be of type "visitor". The predicate AB is assumed to be a strict total
order (antireflexive, antisymmetric, transitive, and total).
- (a, 3) (to English) (Statement I)
(PT(pc) ↔ AB(hc, pc)) ∧ (PT(hc) → (PT(pc) ∧ AB(hc, pc)))
- (b, 3) (to symbols)
(Statement II)
If both the political canvasser and the house cleaner posed a threat,
then the house cleaner arrived before the political canvasser.
- (c, 3) (to English) (Statement III)
(PT(pc) ∨ PT(hc) ∨ AB(hc, pc)) ∧
¬(AB(hc, pc) ∧ PT(hc) ∧ PT(pc))
- (d, 4) (to symbols) (Statement IV)
Every visitor who was not driven away by Duncan did not arrive after
the house cleaner.
- (e, 4) (to English) (Statement V)
∃y:∀z:DA(y)∧ (AB(z, hc) ↔ (y=z))
- (f, 3) (to symbols) (Statement VI)
Every visitor who posed a threat was driven away by Duncan.
- Question 2 (30): These questions use the definitions,
predicates, and premises above.
- (a, 10)
Given only that Statements I, II, and III are true, determine
the truth values of the three propositions q = PT(hc), r = PT(pc),
and s = AB(hc, pc). You may use a truth table or a deductive
sequence proof.
- (b, 20)
Asssuming that Statements I-V are all true, and assuming that the
relation AB is a strict total order (antireflexive, antisymmetric,
transitive, and total) prove
that Statement VI is also true. You may use either English or symbols,
but make it clear each time you use a quantifier proof rule.
- Question 3 (30):
The following are fifteen true/false questions, with no explanation
needed or wanted, no partial credit for wrong answers, and no penalty
for guessing. Some use the sets, relations, and functions defined
above, but you should assume the truth of Statements I-VI only if
explicitly told to. Two points for each correct answer.
- (a) If Statements I-VI are all true, and the relation AB has
the specified properties, we do not know whether the mail person
posed a threat.
- (b) There exists a symmetric binary relation on some non-empty
set that is not reflexive.
- (c) If n is any natural with n > 1, then n and n+1 are
relatively prime.
- (d) Let the set S be {2, 4, 8, 26, 32} and define a partial
order by the division relation D(a, b), which means that a divides
b with no remainder. Then when we construct the Hasse diagram,
there are fewer than five edges.
- (e) If |A| = 4 and |B| = 5, then there is not any surjective (onto)
function from A to B.
- (f) 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.
- (g) Every total order is also a partial order.
- (h) If R is an equivalence relation on a nonempty finite set
A, then the equivalence classes of R must each have the same
number of elementss.
- (i) The function f: N → R, defined by
f(n) = √n, is an injection (1-1 function) but not a
surjection (onto function).
- (j) The negation of ∀x:DA(x) is ¬∀x:¬DA(x).
- (k) If f(x) = 2x2 + 1 and g(x) = 4√x,
then (f ○ g)(x) = 4√2x2 + 1.
- (l) Every one-to-one function has an inverse function.
- (m) If we know that p is true, and r is any proposition at all,
then (p ∨ r) must also be true.
- (n) If we know that p → q is true, and r is any
proposition at all, then (p ∨ r) → q must also be true.
- (o) Let R be a relation defined on the set Z so that
R(a, b) if and only if a ≠ b. Then R is symmetric
and transitive, but not reflexive.
- Question 4 (20+5):
Here are some straightforward number theory questions.
Let X be the set of naturals {0, 1, 2,..., 99}. Define the
function g from X to X by the rule g(x) = (77x)%100,
where "%" denotes the Java remainder operator.
- (a, 5)
Give prime factorizations of the naturals 77 and 100, and
explain why these factorizations prove that these numbers
are relatively prime to one another.
- (b, 5)
Compute integers y and z such that 77y + 100z = 1. You could
conceivably do this by brute force, but the Inverse Algorithm
from lecture is far easier and more reliable.
- (c, 5)
Prove that the function g from X to X, defined above, is a bijection.
- (d, 5) Find a function from X to X that is an inverse of g.
- (e, 5XC) For any numbers a and B in X, define the function
fa, b from X to X by the rule
fa, b(x) = (ax+b)%100. For what values of a
and b is fa, b a bijection? Prove your answer.
Last modified 2 March 2020