CMPSCI 250: Introduction to Computation
First Midterm Exam Spring 2018
David Mix Barrington
26 February 2018
Directions:
- Answer the problems on the exam pages.
- There are four problems, each with multiple parts, for 110 total
points. Actual scale A = 95, 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: 30 points
Q3: 30 points
Q4: 20+10 points
Total: 100+10 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.
Let S be a finite set of dogs consisting of exactly the six
distinct
dogs Cardie (c), Duncan
(d), Guinness (g), Maya (m), Nina (n), and Rio (c).
Let B be a finite set of breeds consisting of exactly the six
breeds
Collie (C), Mastiff (M), Poodle (P), Retriever (R), Terrier (T),
and Weimeraner (W).
Let NL be the binary relation on S defined so that NL(x, y) means
"dog x is no larger than dog y". We will also sometimes translate
NL(x, y) as "dog y is no smaller than dog x". Although I didn't say
this on the actual test, I should have encouraged you to translate
¬NL(x, y) as "dog x is larger than dog y" or "dog y is smaller
than dog x".
Let f be the function from S to B defined so that "f(x) = b" means
"the breed of dog x is b".
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".
- Question 1 (20):
Translate each statement as indicated, using the set of dogs S = {c,
d, g, m, n, r}, the set of breeds B = {C, M, P, R, T, W}, the
predicate NL(x, y) meaning "dog x is no larger than dog y" or "dog
y is no smaller than dog x", and the function f from S to B defined
so that f(x) is the breen of dog x. Note that variables and
constants in small letters are of type "dog", and those in capital
letters are of type "breed".
- (a, 2) (to symbols) (Statement I)
It is not the case that if Duncan is no larger than Rio, then either
Maya is no larger than Nina or Guinness is no larger than Cardie.
- (b, 2) (to English)
(Statement II)
¬(NL(m, n) ∨ ¬(¬NL(g, c) ∧ NL(d, r)))
- (c, 4) (to symbols) (Statement III)
The relation NL is a total order. (This should be the AND of four
quantified statements, one for each defining property of a total order.
- (d, 2) (to English) (Statement IV)
∃x: (f(x) = M) ∧ ∀y: NL(y, x)
- (e, 3) (to symbolx) (Statement V)
Duncan is the one and only dog who is both no larger than Rio and no
smaller than Nina.
- (f, 3) (to English) (Statement VI)
∀x: (∃y: (f(x) = f(y)) ∧ (x ≠ y)) ↔ ((x = m)
∨ (x = n))
- (g, 4) (to symbols) (Statement VII)
Every dog is no smaller than some poodle, and every dog is neither
Cardie nor Guinness if and only if it is no larger than some poodle.
- Question 2 (30): These questions use the sets,
definitions, and predicates above, and the statements from Question 1.
- (a, 10) Prove that Statements I and II are logically
equivalent to one another. You may use
a truth table, an equational sequence proof, or two deductive
sequence proofs. You may find it useful to abbreviate the three
propositions involved as p, q, and r.
- (b, 10) Assuming that Statements I-VII are all true, prove
that Cardie is neither a Poodle nor a Mastiff. You may use either
English or symbols, but make it clear each time you use a
quantifier proof rule. Proof by Contradiction is probably the most
natural overall strategy to use.
- (c, 10) Assuming that Statements I-VII are all true,
determine the complete order of the six dogs according to size.
(That is, give enough information to determine whether NL(x, y) is
true for each x and y in S.) Explain your reasoning clearly,
either in English, symbols, or a combination.
- 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-VII only if
explicitly told to. Two points for each correct answer.
- (a) Assuming that Statements I-VII are all true, the function f
is not one-to-one.
- (b) Assuming that Statements I-VII are all true, the function f
is not onto.
- (c) Assume for this question only that Cardie is a Retriever
and that Duncan is a Terrier. Then Statements I-VII determine the
breed of each of the other dogs.
- (d) The staetment "f is one-to-one" means that each dog has
exactly one breed.
- (e) Every total order is also a partial order.
- (f) The string "ababbabababb" is in the Kleene star of
the language {ab, abb}.
- (g) Let u and v be nonempty strings over the alphabet {0,
1}. If u is both a prefix and a suffix of v, then it must be equal
to v.
- (h) Let I be an implication, that is, a statement of the form
p → q. If I and its contrapositive are both true, then its
converse and inverse must also both be true.
- (i) If I have a statement "∃x: P(x)", then the Rule
of Instantiation allows me to conclude "P(a)", where a is any
element of the type of x.
- (j) Let A = {1, 2, 3} and let R be an equivalence relation
on A. Then R cannot be antisymmetric.
- (k) Let A = {1, 2, 3} and let R be an equivalence relation
on A. Then the number of pairs (x, y) in R must be either three,
five, or nine.
- (l) If x is an odd natural greater than 1, then x can be
written as the product of one or more odd primes (if we are allowed
to use the same prime more than once).
- (m) Any positive natural n can be written as a product xyz
where the natuals x, y, and z are pairwise relatively prime.
- (n) Let x, y, and z, be positive naturals, with z > 1.
If neither x nor y is divisible by z, then neither x + y nor xy is
divisible by z.
- (o) If x, y, and z are three odd naturals each greater than
1, then the number xyz + 4 is not divisible by any of x, y, or z.
- Question 4 (30):
Here are some straightforward number theory questions.
- (a, 5)
Explain why every odd natural is relatively prime to 32.
- (b, 5) Is there a composite number strictly between 10
and 20 that is relatively prime to both 32 and 51? Explain your answer.
- (c, 10) Find an inverse of 32, modulo 51, and an inverse
of 51, modulo 32. Be sure to make clear which is which.
- (d, 10XC) Someone on the internet calling themself
"Mr. Rabbit" has agreed to sell me a file of government secrets
for $100. However, Rabbit will accept payment only in two
obscure cryptocurrencies: Batcoins (currently worth $51 each) and
Twitcoins (currently worth $32 each). For technical reasons,
Batcoins and Twitcoins cannot be broken up into fractions like
Bitcoins -- each coin must be transferred entirely or not at
all. Both Rabbit and I have plenty of each kind of coin. How
can I pay Rabbit exactly $100 by transferring integer numbers of
Batcoins and/or Twitcoin from me to Rabbit and/or from Rabbit to me?
Last modified 6 March 2018