CMPSCI 250: Introduction to Computation
First Midterm Exam Fall 2017
David Mix Barrington
Exam given 11 October 2017
Directions:
- Answer the problems on the exam pages.
- There are five problems, some with multiple parts, for 110 total
points. 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: 15 points
Q2: 30 points
Q3: 30 points
Q4: 25+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 animals consisting of exactly the five
distinct
animals Cardie (c), Duncan
(d), Floyd (f), Scout (s), Whistle (w).
Let D be the unary relation on A defined so that D(x) means "x is
a dog".
Let F be the unary relation on A defined so that F(x) means "x
lives on the farm".
Let R be the unary relation on A defined so that R(x) means "x
is a retriever".
Let M be the binary relation on A defined so that M(x, y) means
"animal x met animal y during the morning walk". Note that two
animals
could be together on the walk without meeting during it.
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".
Let Σ be the alphabet {0, 1}, so that Σ* is
the
set of binary strings.
Let f be the function from Σ* to
Σ*
defined so that f(w) = ww (the concatenation of the string w with
itself).
For example, f(011) = 011011.
Let g be the function from Σ* to
Σ* defined so that g(λ) = λ and for any
letter a in Σ and any string w, g(aw) = w. (So g deletes the
first
letter of its input if there is one.) For example, g(011) = 11.
- Question 1 (15):
Translate each statement as indicated, using the set of animals D = {c,
d, f, s, w}, the predicate D(x) meaning
"animal x is a dog", the predicate F(x) meaning "animal x lives on
the
farm", the predicate R(x) meaning "animal x is a retriever", and the
predicate M(x, y) meaning "animal x and animal y met during the
morning walk". Note that two animals might be together for the
entire
morning walk but not meet during it. All these are also
defined
above. Note that variables and constants of type "animal" are in
small letters, and predicates are in capital letters.
- (a, 2) (to symbols) (Statement I)
Floyd, who is not a dog, met every animal who does not live on the
farm.
- (b, 2) (to English)
(Statement II)
∀x: ¬R(x) ∨ D(x)
- (c, 2) (to symbols) (Statement III)
It is not the case that if Floyd lives on the farm, than Duncan met Cardie.
- (d, 2) (to English) (Statement IV)
[∀z:¬M(x, x)] ∧ [∀y:∀z: M(y, z) →
M(z, y)]
- (e, 3) (to symbolx) (Statement V)
Cardie and Duncan met exactly the same animals, and they met all the
animals who live on the farm. (Many of you said one of these
things, but not the other.)
- (f, 2) (to English) (Statement VI)
¬F(w) ∧ [∃x:R(x) ∧ F(x) ∧ M(x, w)]
- (g, 2) (to symbols) (Statement VII)
Whistle met every animal who lives on the farm.
- Question 2 (30): These questions use the sets,
definitions, and predicates above, and the statements from Question 1.
- (a, 10) Use Statements I, II, and III to infer propositional
statements about the propositions D(f), F(f), and R(f). Use
propositional methods (a truth table, or deductive or equational
proof rules) to determine the truth of these three propositions,
assuming only that Statements I, II, and III are true.
- (b, 10) Assuming that Statements I, IV and V are true, use
propositional and predicate proof rules to prove Statement III. Do
not assume the truth of any of the other statements. You may use
English, symbols, or a combination, as long as your argument is
clear.
- (c, 10) Assuming that Statements I, II, III, IV, V, and VI
are all true, use
propositional and predicate proof rules to prove Statement VII. Do
not assume the truth of any of the other statements. You may use
English, symbols, or a combination, as long as your argument is
clear.
- Question 4 (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. They use the sets, relations, and functions defined above, but do
not assume the truth of Statements I-VII.
- (a) Statement IV says that the relation M is both antisymmetric
and antireflexive.
- (b) No relation M satisfying Statement IV could be either an
equivalence relation or a partial order, even if A were the empty set.
- (c) The function f defined above is onto.
- (d) The function f defined above is not one-to-one.
- (e) The function g defined above is onto.
- (f) The function g defined above is not one-to-one.
- (g) For every string w in Σ*, the string
g(f(w)) has odd length.
- (h) There exists a string w in Σ* such that
f(g(w)) = g(f(w)).
- (i) Let k and n be any two naturals greater than 1. Then
it is possible to define sets S1,..., Sn such
that each set Si has size k, and such that for any two
sets Si and Sj with i ≠ j, the size of
Si ∩ Sj is 1.
- (j) Every symmetric binary relation on a non-empty set is
also reflexive.
- (k) A partial order P on a non-empty set is a total order if
and only if it has both an element x such that ∀y: P(x, y)
and an element z such that ∀y: P(y, z).
- (l) Statement II says that the set of retrievers in A is a
proper subset of the set of dogs in A.
- (m) Statement V says that the set of animals in A who live
on the farm is a subset of the set of animals in A who Cardie and
Duncan both met.
- (n) If p, q, r, and s are all prime numbers, and pq = rs,
then we must have p = r and q = s. (Here "pq", for example, means
the integer product of p and q.)
- (o) There is a two-digit natural that has three different
odd primes in its factorization.
- Question 5 (30):
Here are some straightforward number theory questions.
- (a, 5)
Give prime factorizations of the naturals 32 and 55. Explain
how you can determine from these factorizations that these two
numbers are relatively prime to one another. Say which numbers
in the set {1, 2, 3, 4, 5, 6, 7, 8,
9, 10}, if any, relatively prime to both 32 and 55.
- (b, 10) Find an inverse of 55, modulo 32, and an inverse
of 32, modulo 55. Be sure to make clear which is which.
- (c, 10)
I have a pile of fewer than 2000 coconuts. When I divide them
into piles of 32, I have 26 left over. When I divide them into
piles of 55, I have 30 left over. Can it be determined from this
information alone exactly how many coconuts I have? If so, do
it, and if not, find what the possible numbers are.
- (d, 10XC) Define the predicate A on naturals so that
A(x, y) means "¬(D(x, y) ∨ D(y, x)", where D is the
division predicate. Define the predicate R on naturals so that
R(x, y) means "x and y are relatively prime". Prove the
statement "∀x: ∀y: (R(x, y) ∧ (x > 1) ∧
(y > 1)) → A(x, y)". You should use predicate proof
rules and the definitions of these terms. Again, either
English, symbols, or a combination are acceptable if your
argument is clear.
Last modified 7 March 2018