CMPSCI 250: Introduction to Computation
Final Exam Fall 2017
David Mix Barrington
14 December 2017
Directions:
- Answer the problems on the exam pages.
- There are four problems, each with multiple parts, for 120 total
points. Actual scale was A = 108, C = 72.
- Some useful definitions precede the questions below.
- No books, notes, calculators, or collaboration.
- In case of a numerical answer, an arithmetic expression like
"2^{17} - 4" need not be reduced to a single integer.
Q1: 30 points
Q2: 20+10 points
Q3: 40 points
Q4: 30 points
Total: 120 points
Here are definitions of some terms, sets, predicates, and statements used
on this exam.
Question 1 deals with the following scenario:
The web site WeRateDogs^{TM} gives numerical ratings
of animals based on photographs, and publishes these at
twitter.com/dog_rates
. They provided ratings for a set
A of six animals, consisting exactly of Cardie (c), Duncan (d), Floyd (f),
Mia (m), Pushkin (p), and Tib (t). We thus have a function r from A to
N where r(x) is the rating of animal x.
We have a number of additional predicates defined on A:
- E(x) means "animal x is enormous".
- ML(x, y) means "animal x is much larger than animal y" and this
is defined to mean "E(x) ∧ ¬E(y)".
- D(x) means "animal x is a dog".
Question 2 also refers to the following six statements, where the variables
are of type "animal or type "natural". The predicate P(n) means "natural
n is prime".
The statements are:
- Statement I: Floyd, who is enormous, received a rating of 7,
and no enormous animal received a higher rating.
- Statement II: ∀x: ∃y: P(r(x)) ∧
((r(x) > 10) ↔ D(x))
- Statement III: Tib received the same rating as some animal
much larger than herself.
- Statement IV: ∀x: ∃y: (x ≠ y) ∧ (r(x) = r(y))
- Statement V: Pushkin received a rating that was less than
some other animal's rating and greater than some other animal's rating.
- Statement VI: ¬∀x:∀y: (D(x) ∧ D(y))
→ (r(x) = r(y))
N is the set of naturals (non-negative integers, {0, 1, 2,...}.
Again, we define the predicate P on N so that P(n) means "n is prime".
Question 2 uses a recursive function f from N to n defeind by
the rules f(0) = 1, f(1) = 0, f(2) = 1, and for n ≥ 2, f(n+1) = 4f(n) -
5f(n-1) + 2f(n-2).
Question 3 uses the following λ-NFA N, which has state set {1, 2, 3},
start state 1, final state set {3}, and transition relation Δ =
{(1, λ, 2), (1, b, 3), (2, a, 1), (2, λ, 3), (3, b, 2)}.
Here is a diagram of N, with "L" representing λ:
L
>(1) -----> (2)
| <----- |^
| a ||
| ||
| L||b
| ||
| b V|
------->((3))
- Question 1 (30): This question deals with the
scenario described above, and with the six statements about
a set of animals A, consisting of exactly the six animals
Cardie (c), Duncan (d), Floyd (f), Mia (m), Pushkin (p), and Tib (t).
It uses the function r: A → N and the predicates E, ML, D,
and P defined above.
- (a, 10) Translate each of these six statements as indicated.
- Statement I: (to symbols) Floyd, who is enormous,
received a rating of 7, and no enormous animal received a
higher rating.
- Statement II: (to English)
∀x: P(r(x)) ∧ ((r(x) > 10) ↔ D(x))
- Statement III: (to symbols) Tib received the
same rating as some animal much larger than herself.
- Statement IV: (to English)
∀x: ∃y: (x ≠ y) ∧ r(x) = r(y)
- Statement V: (to symbols)
Pushkin received a rating that was less than some other
animal's rating and greater than some other animal's
rating.
- Statement VI: (to English)
¬∀x:∀y: (D(x) ∧ D(y))
→ (r(x) = r(y))
- (b, 10) Assuming that Statements I-VI are all true,
determine exactly with of the six animals are dogs, and prove
your answer.
- (c, 10) Assuming that Statements I-VI are all true,
prove that some dog received a rating of 13 or more.
- Question 2 (20+10): This question uses the
functions f defined above. The rules defining f
are f(0) = 1, f(1) = 0, f(2) = 1, and for any n with n ≥ 2,
f(n+1) = 4f(n) - 5f(n-1)
+ 2(f(n-2).
- (a, 10) Prove by strong induction on all naturals n that f(n) =
2^{n+1} - 3n - 1. Make sure that you have the correct base
cases!
for n = 0 and n = 1.
- (b, 10) Prove by strong induction on all naturals n
(not by using the result of part (a)) than f(n) is odd
if and only if n is even. Make sure that you have the correct
base cases.
- (c, 10XC) Let g(n) be any function of the form a2^{n} +
bn + c, where a, b, and c are any real numbers. Prove
that g satisfies the rule g(n+1) = 4g(n) - 5g(n-1) + 2g(n-2) for any
n with n ≥ 2.
- Question 3 (40): This question is the usual one about Kleene's
Theorem constructions, using the λ-NFA N given above.
- (a, 5) Use the construction from lecture and the text to find
a λ-NFA whose language is denoted by the regular
expression (a+bb)(a+b)^{*}.
- (b, 10) Using the construction form the text on the
λ-NFA N given above (not on your answer to part (a)),
build an ordinary NFA N' such that L(N') = L(N).
- (c, 10) Using the Subset Construction on N', find a
DFA D such that L(D) = L(N) = L(N').
- (d, 5) Use the minimization construction to find a minimal
DFA D' with L(D') = L(D).
- (e, 10) Find a regular expression for the complement
of L(N). To do this, take either D or D' and make a new DFA
by changing its final states to non-final states and vice
versa. Then use the construction from lecture and the text
text to obtain a regular expression from this new DFA.
Do not simplify your
expression -- I want the one from the construction.
- Question 4 (30):
Identify each of the following fifteen statements as true
or false. There are two points for each correct answer,
with no explanation
needed or wanted. Note that there is no penalty
for guessing. Some of these statements refer to terms
defined at the beginning of the exam.
sheet.
- (a) Define the relation Z on the set A from the scenario, so that
Z(x, y) is true if and only if r(x) = r(y). Then Z is an equivalence
relation.
- (b) The relation ML on the set A, defined above, is antisymmetric
and transitive but not reflexive.
- (c) There are no prime numbers that are both greater than 115
and less than 125.
- (d) Let C(w) be a unary predicate on strings over {a, b}.
It is possible that C(λ) and ∀w: C(w) →
(C(wa) ∧ C(wba) ∧ C(wbb)) are both true, but
∀w: C(w) is false.
- (e) Let G be any forest (that is, any
undirected graph with no cycles) and let v be a node
in G. If we conduct both a breadth-first search and a
depth-first search of G, with v as the start node and no
goal node, then it is possible that some edge will be
a tree edge in one of the search trees and not in the
other. (Assume that we do not restart the search at
a new node when the open list becomes empty.)
- (f) Let H be any connected undirected graph
with n nodes and let u and v be nodes of H. It is
possible that there is a path from u to v in H with
exactly n edges, but no path from u to v in H with
fewer than n edges.
- (g) Let B(w) be a unary predicate taking one
argument that is a string over the alphabet
{a, b}. If B(aa) and ∀u: B(u) →
(B(abu) ∧ B(bau) ∧ B(wa) ∧ B(wb)) are
both true, than B(w) is true for any string u in
the regular language
(ab+ba)^{*}aa(a+b)^{*}.
- (h) Every non-empty language has at least two Myhill-Nerode
equivalence classes.
- (i) Let AW be the set of strings w over the alphabet
{a, b} with the following property: There is a prefix u of
w such that (1) u contains exactly two more a's than b's, and
(2) every proper prefix of u has a number of a's and a number
of b's that differ by at most one. Then AW is defined by
the regular expression (ab+ba)*aa(a+b)^{*}.
- (j) Let M be a two-way DFA operating on a string of length
n. If M takes more than n steps, it will never terminate.
- (k) Let M be a deterministic one-tape Turing machine,
whose transition function δ satisfies δ(p, a) =
(q, a, R) and δ(q, b) = (p, b, L). There there exists
a configuration from which M will continue computing forever.
- (l) Let N be a nondeterministic Turing machine with
two halting states h and h' (and possibly others). Let
X be the set of strings w for which it is possible for
N to start on input w and halt in h, and let X' be the
set of strings w for which it is possible for N to start
on input w and halt in h'. Then the language X ∪
X' is Turing recognizable.
- (m) Let X, Y and Z be any three Turing recognizable languages.
Let Q be the language (X ∩ Y) ∪ (X ∩ Z) ∪
(Y ∩ Z). Then it is possible that Q is not Turing recognizable.
- (n) The set of descriptions of Turing machines that accept
their own descriptions is not Turing recognizable.
- (o) The set of descriptions of Turing machines that have
non-empty languages is Turing recognizable.
Last modified 3 January 2018