CMPSCI 250: Introduction to Computation
Final Exam Fall 2018
David Mix Barrington and Marius Minea
Exam given 20 December 2018
Text posted 31 December 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 = 100, C = 60.
- 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: 30 points
Q3: 30+10 points
Q4: 30 points
Total: 120+10 points
Here are definitions of some terms, sets, predicates, and statements used
on this exam.
Question 1 deals with the following scenario:
During one cold week in December, each dog in the set S = {c, d, n,
p} = {Cardie, Duncan, Nina, Pushkin} went for a walk on each day in
the set Y = {Mon, Tue, Wed, Thu, Fri}. On each day, each dog chose
whether
to wear a coat, based on the temperature that morning.
Let Z be the set of integers {..., -3, -2, -1, 0, 1, 2,
3,...}. Let f be the function from S to Z defined so that f(x)
is the "critical temperature" (in Celsius) for dog x: the meaning of
this will come from Statement I below. Let t be the function from Y
to Z defined so that t(y) is the outdoor temperature, in
Celsius,
on the morning of day y. Let W be the predicate defined so that
W(x, y) means "dog x wore a coat on day y".
Question 1 also refers to the following four statements, where the
variables are of type "dog", type "day", or type "integer":
The statements are:
- Statement I: ∀x:∀y: W(x, y) ↔
(t(y) ≤ f(x))
- Statement II: Duncan was the one and only dog to
wear a coat on Tuesday, and Nina was the one and only dog to
not wear a coat on Wednesday.
- Statement III: ¬((W(p, Mon) ∧ (t(Tue) = -16))
→ ((t(Thu) = -16) ∧ W(c, Mon)))
- Statement IV: On Friday, the temperature was -17 and
exactly two of the dogs wore coats (on Friday).
N is the set of naturals (non-negative integers, {0,
1, 2, 3,...}.
The Koch snowflake is obtained by recursively defining the
polygons S_{n} in the following way:
- S_{0} is an equilateral triangle.
- S_{n+1} is obtained from S_{n} by dividing
each side of the polygon into three equal parts and replacing the
middle one with the other two sides of an equilateral triangle,
drawn outwards.
- Question 1 (30): This question deals with the
scenario described above, and with the four statements about
a set of dogs S, consisting of exactly the four dogs
Cardie (c), Duncan (d), Nina (n), and Pushkin (p), and a set Y of
five days {Mon, Tue, Wed, Thu, Fri}. The functions f and t, and
the predicate W, are defined above.
- Question 2 (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) Let Σ be a nonempty alphabet, L be the set of all
languages over Σ, and R be the set of all regular expressions
over Σ. Then the function L from R to L that
gives the language L(R) of a regular expression R is neither
one-to-one nor onto.
- (b) The following is not an equivalence relation on
strings: R(u, v) means there exists a string w such that uw and vw
either both have an even number of a's or both have an even number
of b's.
- (c) The number of solutions of the congruence system x
≡ a (mod m) and x ≡ b (mod n) satisfying 0 ≤ x <
mn is equal to gcd(m, n).
- (d) Let P be a predicate on strings over {a, b}. Then we
can derive ∀w:P(w) if we know P(λ) and
∀w:(P(w) → P(wab)) ∧ (P(w) → P(wbb)) ∧
P(wb) → P(w)).
- (e) The depth of a DFS tree for an undirected graph with
cycles
is always one less than the length of the longest cycle.
- (f) Let p and q be two states in a DFA such that
δ(p, x) ≠ δ(q, x) for any letter x in Σ.
Then p and q may be equivalent states for the purpose of
minimizing the DFA.
- (g) The language {a^{n}: n is not prime} is regular.
- (h) There is some regular expression R so that the regular
expressions ((b + R)^{*}a)^{*} and
(b^{*}a)^{*} are not equivalent. (Here the
alphabet is assumed to be {a, b}.)
- (i) Let L be the language of strings from Σ = {a, b}
with no three consecutive equal letters. Then the strings
λ, a, aa, ab, and bb are all pairwise distinguishable.
- (j) Let L be the language of strings of a's and b;s where
the number of a's is congruent modulo n to the number of b's.
Then the L-equivalence relation has n^{2} classes.
- (k) Let w be a binary string (of 0's and 1's). There is
an NFA with |w| + 1 states that accepts exactly the binary strings
ending in w, but any DFA with the same language has at least
2^{|w|} states.
- (l) If a 2WDFA can move left only from a single state,
which is not the initial state, then it cannot hang.
- (m) If language X is Turing decidable, and the complement
of Y is Turing recognizable, than X \ Y must be Turing recognizable.
- (n) The set of pairs consisting of (i) a description of a
DFA, and (ii) a string accepted by that DFA, is Turing
recognizable but not Turing decidable.
- (o) The set of Turing machines that use only a bounded
amount of the infinite tape is Turing recognizable.
- Question 3 (30+10): This question refers to the Koch
snowflake defined above.
- (a, 10) Let E_{n} be the number of sides of the
polygon S_{n}. Derive a recurrence (recursive
definition) for E_{n}
and then find a formula for E_{n} in terms of n, and
prove it correct by induction.
- (b, 10) Let Q_{n} be the number of acute
angles (π/3, or 60°) of the polygon S_{n},
and let R_{n} be the number of other angles
(4π/3, or 240°). Prove by induction that
Q_{n} = 4^{n} + 2 and R_{n} =
2(4^{n}) - 2. (Hint: The total number of angles
in any polygon is equal to the number of sides. Another
hint: Use the result of part (a).)
- (c, 10XC) Let A_{n} be the area of S_{n}.
Prove by induction that A_{n} = A_{0}(1 + (3/5)(1
- (4/9)^{n})).
- (d, 10) Let P_{n} be the path length (or perimeter)
of the figure S_{n}. Prove the following statement:
∀m:∃n:P_{n} > m, where the variables n and
m range over the natural numbers. (Note that the only thing you
know about P_{0} is that it is a positive real number.)
- Question 4 (30): This question is the usual one about Kleene's
Theorem constructions, using the regular language L = ((a +
bb)^{*}b)^{*}.
- (a, 5) Use the construction from lecture and the text to find
a λ-NFA whose language is denoted by the regular
expression language L = ((a +
bb)^{*}b)^{*}. For full
credit, use the construction exactly, without any
simplifications
(except that, if you like, you may use the alternate form of
the Kleene star construction proved to be correct on
Homework #6).
- (b, 10) Using the construction from the text on your
λ-NFA N from part (a),
build an ordinary NFA N' such that L(N') = L(N). You
may
make simplifications of N before doing this, as long as they
do not change the language of the machine and you make
clear what you are doing.
- (c, 5) Using the Subset Construction on N', find a
DFA D such that L(D) = 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, 5) By using the State Elimination
construction on either D or D', find a regular
expression for
L(N). (In fact, L(N) = L, so you
have a correct regular expression already, but the
construction may produce a
more complicated one.)
Last modified 31 December 2018