CMPSCI 250: Introduction to Computation
Final Exam Spring 2018
David Mix Barrington
Exam given 8 May 2018
Text posted 16 May 2018
Directions:
- Answer the problems on the exam pages.
- There are four problems, each with multiple parts, for 120 total
points. Actual scale was A = 110, C = 75.
- 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:
Many of the dogs in my neighborhood are fans of rap music. One day
a set D of four dogs: Cardie (c), Duncan (d), Rio (r), and Scout (s)
met to discuss their preferences among a set R of four rap artists:
Cardi B (CB), Drake (DR), Kendrick Lamar (KL), and Kanye West (KW).
Note that variables and constants with lower case letters denote
dogs, and those with capital letters denote rappers. Note also that
Cardie the dog is spelled differently from Cardi B the rapper.
The predicate P(x, Y, Z) means "dog x prefers rapper Y to rapper
Z". Each dog's preferences establish a total order on the rappers, so
that for each dog x the predicate "(Y = Z) ∨ P(x, Y, Z)" is
reflexive, antisymmetric, transitive, and total.
Question 1 also refers to the following five statements, where the variables
are of type "dog" or type "rapper".
The statements are:
- Statement I: ∀Y: (Y ≠ CB) → P(c, CB, Y)
- Statement II: Every dog prefers both Drake and Kendrick
Lamar to Kanye West.
- Statement III: (P(d, DR, CB) → P(d, CB, KL)) ∧
¬(P(s, KL, CB) → P(d, CB, DR)
- Statement IV: Scout and Rio each prefer Cardi B to at
least one other rapper. (Note added in test: There are two possible
interpretations of this English statement. Either one may be used
in Question 1, but if you see both of them you should explain in
English which you intend.)
- Statement V:
∃Y: ∀x: ∀Z: (Y = Z) ∨ P(x, Z, Y)
N is the set of naturals (non-negative integers, {0,
1, 2, 3,...}.
Question 2 uses a recursive function f from N to N defined by
the rules f(0) = 1, and for n ≥ 0, f(n+1) = f(n) + n^{2}
+ n - 1.
Question 2 also refers to the language L, over the alphabet {a, b,
c}, which is denoted by the regular expression (∅^{*}
+ b + bb)(a + ab + abb + acc)^{*}. Note that a similar but different
regular language is the subject of Question 3.
Question 2 also uses a recursive function g from N to
N, defined by the rules g(0) = 1, g(1) = 2, g(2) = 4, and,
for n ≥ 2, g(n+1) = g(n) + g(n-1) + 2g(n-2).
Question 3 uses the following λ-NFA N, which has state set
{1, 2, 3, 4},
start state 1, final state set {1}, alphabet {a, b, c},
and transition relation Δ =
{(1, a, 2), (2, λ, 1), (2, b, 3), (2, c, 4), (3, b, 1), (3,
λ, 1),
and (4, c, 1)}.
Here is a diagram of N, with "L" representing λ:
c
----------(4)
| ^
| | c
| |
V a |
>((1)) -----> (2)
^ <------ |
| L |
| | b
| |
| |
| b, L V
--------- (3)
- Question 1 (30): This question deals with the
scenario described above, and with the five statements about
a set of dogs D, consisting of exactly the four dogs
Cardie (c), Duncan (d), Rio (r), and Scout (s), and a set of
rappers R, consisting of exactly the four rappers Cardi B (CB),
Drake (DR), Kendrick Lamar (KL), and Kanye West (KW). Note that
variables and constants with lower case letters denote dogs, and
that those with capital letters denote rappers. Note also that
Cardie the dog is spelled differently from Cardi B the rapper.
The predicate P(x, Y, Z) means "dog x prefers rapper Y to rapper
Z". Each dog's preferences establish a total order on the
rappers, so that for each dog x the predicate "(Y = Z) ∨ P(x,
Y, Z)" is reflexive, antisymmetric, transitive, and total.
- (a, 10) Translate each of these five statements as indicated.
- Statement I: (to English)
∀Y: (Y ≠ CB) → P(c, CB, Y)
- Statement II: (to symbols)
Every dog prefers both Drake and Kendrick
Lamar to Kanye West.
- Statement III: (to English)
(P(d, DR, CB) → P(d, CB, KL)) ∧
¬(P(s, KL, CB) → P(d, CB, DR)
- Statement IV: (to symbols)
Scout and Rio each prefer Cardi B to at
least one other rapper. (Note added in test: There are two possible
interpretations of this English statement. Either one may be used
in Question 1, but if you see both of them you should explain in
English which you intend.)
- Statement V: (to English)
∃Y: ∀x: ∀Z: (Y = Z) ∨ P(x, Z, Y)
- (b, 10) Using Statement III only, along with the given
properties of the relation P, determine the truth value of
the three propositions P(d, CB, DR), P(d, CB, KL), and
P(s, KL, CB).
- (c, 10) Using Statements I, II, III, and IV, along
with the given properties of the relation P, prove
Statement V. You may use English, symbols, or a
combination, but make your use of quantifier proof rules clear.
- Question 2 (20+10): This question uses the
functions f and g, and the language L, defined above. The rules defining f
are f(0) = 1, and for any n with n ≥ 0,
f(n+1) = f(n) + n^{2} + n - 1. The rules defining g are
g(0) = 1, g(1) = 2, g(2) = 4, and for any n with n ≥ 2,
g(n+1) = g(n) + g(n-1) + 2g(n-2). The language L, over the
alphabet {a, b, c}, is denoted by the regular expression
(∅^{*} + b + bb)(a + ab + abb + acc)^{*}.
- (a, 10) Prove by ordinary induction on all naturals n that f(n) =
(n^{3} - 4n + 3)/3.
- (b, 10) Prove by strong induction on all naturals n
that g(n) = 2^{n}.
Make sure that you have the correct
base cases.
- (c, 10XC) Let h(n) be the number of strings in L of length
n. Prove by strong induction for all naturals n that h(n) =
g(n). Make sure that you have the correct base cases.
- 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 + ab + abb + acc)^{*}. For full
credit, use the construction exactly, without any simplifications.
- (b, 10) Using the construction from 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) Find a minimal
DFA D' with L(D') = L(D). You may use the
minimization construction, or prove directly that your
D is already minimal.
- (e, 10) By using the State Elimination
construction on either D or D', find a regular
expression for
L(N). (In fact, L(N) is the language of the regular
expression from part (a) of this question, so you
have a correct regular expression already, but I want
the one from the construction, which will probably be
more complicated.)
- 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) In the scenario of Question 1, define the function h from
D to R so that h(x) is dog x's favorite rapper. Then, given
Statements I-V, the function h is neither onto nor one-to-one.
- (b) Let x be a natural number that is congruent to 3
modulo 4 and is congruent to 5 modulo 6. Then x must be congruent
to 23 modulo 24.
- (c) Let p be any prime number and let x be any positive
natural. Then there exists a natural e such that p^{e}
divides x and p^{e+1} does not divide x.
- (d) Let G be the directed graph made from the λ-NFA
N above by ignoring the edge labels and merging parallel edges.
Then G is not strongly connected.
- (e) Let H be an undirected graph with node set {1, 2, 3,
4, 5, 6} and an edge between nodes i and j if and only if i + j is
odd. Then H is a bipartite graph.
- (f) There exists a labeled undirected graph G, with
positive integer edge weights, a start node s, a goal node g, and
an admissibile and consistent heuristic function h for g, such
that the path found by an A^{*} search from s with goal
node g is shorter (has smaller total cost) than the path found by
a uniform-cost search from s with goal node g.
- (g) Let G be any undirected graph with n nodes, where n
> 0. Then G is a tree if and only if for every node x of G,
the DFS tree of any depth-first search of G from x contains
exactly n-1 tree edges and no back edges.
- (h) Consider a game with a finite game tree, where each
leaf is labeled as a win for White or Black and each internal node
is labeled as to whether White or Black moves next from that
node. Then one of the two players has a winning strategy, and
there is an algorithm to determine which, given the entire tree as input.
- (i) Let X and Y be two languages over the alphabet {0, 1}.
Then is it possible that Y is regular, X ⊆ Y, and X is not
regular.
- (j) The language of the regular expression ab + ba, where
the alphabet is {a, b}, has exactly five Myhill-Nerode equivalence
classes.
- (k) For every two-way DFA M, there exists a regular
expression R such that L(M) = L(R).
- (l) Let X and Y be any languages with X ⊆ Y. If Y is
Turing recognizable, then X must be Turing recognizable but may
not be Turing decidable.
- (m) A language X is Turing recognizable if and only if
both X and its complement are Turing decidable.
- (n) An ordinary one-tape Turing machine, as originally
defined in the text, may move more than one space on its tape in a
single step.
- (o) The set of descriptions of DFA's that have non-empty
languages is Turing decidable.
Last modified 16 May 2018