CMPSCI 250: Introduction to Computation
Final Exam
David Mix Barrington
12 December 2013
Directions:
- Answer the problems on the exam pages.
- There are five problems, some with multiple parts, for 125 total
points. Actual scale A = 108, C = 68.
- 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: 10 points
Q2: 25 points
Q3: 25 points
Q4: 35 points
Q5: 30 points
Total: 125 points
Definitions and Other Notes:
Question 2 refers to the following five statements, where the variables
are of type "dog", the set of dogs include the four distinct dogs Cardie,
Duncan, Jack, Rosa, and possibly others, the predicate A(x) means "dog x
is asleep", and the predicate B(x) means "dog x is barking".
- Statement I: No dog is both barking and asleep.
- Statement II: (B(r) ∨ B(j)) → B(d)
- Statement III: If either Jack is barking or Rosa is not barking,
then Jack is barking and Duncan is asleep.
- Statement IV: (∃x: B(x)) → A(c)
- Statement V: It is not that case that given any two dogs, if
neither is barking, then they are the same dog.
N is the set of naturals, {0, 1, 2, 3,...}, and Z
is the set of integers, {..., -3, -2, -1, 0, 1, 2, 3,...}.
Question 3 uses an inductively defined function from N to Z.
We define f(0) = 1, and for any positive integer n we define f(n) =
2f(n-1) + n(n-3).
Question 4 uses the following two formal languages over the alphabet {a, b}.
The language X is the set of all strings that have strictly more b's
than they have a's. The language Y is defined inductively as follows:
- The string b is in Y.
- If the string w is in Y, then so are the strings wab and wbba.
- The only strings in Y are those forced to be by rules (1) and (2).
Question 5 uses the following λ-NFA N. Th alphabet is {a, b},
the state set is {1, 2, 3}, the start state is 1, the final state set is {2},
and the transition relation Δ is {(1, λ, 2), (2, a, 2),
(2, a, 3), (3, b, 1), (3, b, 3)}.
Here is a diagram of N, with "L" meaning "λ":
L
>(1) ---> ((2))<-\
^ / | |
| / |____| a
b | /
| /
| / a
| /
| /
|V
(3)<-\
|___| b
- Question 1 (10):
Identify each of the following five concepts, giving enough detail to
make it clear that you are familiar with them (2 points each):
- (a, 2) a free variable in a quantified statement
- (b, 2) the congruence statement "a ≡ b (mod m)"
- (c, 2) a one-to-one function from a set X to a set Y
- (d, 2) a directed multigraph
- (e, 2) the concatenation product of two formal languages
X and Y
- Question 2 (25):
This question deals with five statements about a set of dogs that includes
the four distinct named dogs Cardie (c), Duncan (d), Jack (j), and Rosa (r),
and possibly other dogs as well. The predicate A(x) means "dog x is asleep",
and the predicate B(x) means "dog x is barking".
- (a, 5) Translate each of the five statements as indicated.
- Statement I: (to symbols) No dog is both barking and asleep.
- Statement II:(to English) (B(r) ∨ B(j)) → B(d)
- Statement III: (to symbols) If either Jack is barking or Rosa is not barking,
then Jack is barking and Duncan is asleep.
- Statement IV: (to English) (∃x: B(x)) → A(c)
- Statement V: (to symbols) It is not that case that given any two dogs, if
neither is barking, then they are the same dog.
- (b, 10) Using Statments I, II, and III only, determine exactly
which dogs (if any) in the set {Duncan, Jack, Rosa} are barking.
- (c, 10) Assuming that Statements I, II, III, and IV are all true, prove
Statement V using proof rules for quantified statements. (Hint: Convert
Statement V into an existential statement and prove it in that form.)
- Question 3 (25): This question uses the function f
from N to Z defined above. We define f(0) = 1 and, for positive
n, f(n) = 2f(n-1) + n(n-3).
- (a, 5) Compute f(1), f(2), f(3), f(4), f(5), and f(6).
- (b, 10) Prove by induction on all positive integers
n that f(n) is even. (Your base case should be n = 1.)
- (c, 10) Prove by induction on all naturals n that
f(n) = 2^{n} - n(n+1). (Your base case should be n = 0.)
- Question 4 (35): This question uses the definition of
the formal languages X and Y given above. Both languages are over the
alphabet {a, b}. X is the set of strings with more b's than a's, and Y is
given by the inductive definition (1) b is in Y, (2) if w is in Y, then so are
wab and wbba, and (3) nothing else is in Y.
- (a, 10) Prove that Y ⊆ X. I think it is easiest to use
induction on the definition of Y, but you might also use ordinary induction on
the number of times step (2) is used to produce a string.
- (b, 5) Quoting Kleene's Theorem as necessary, prove that Y is
the language of some DFA.
- (c, 10) Is X a regular language? Prove your answer.
- (d, 10) Prove that the language X is Turing decidable. You
may be informal in your description of a Turing machine, as long as you are
clear (a state table is not necessary).
- Question 5 (30):
This question is the usual one about Kleene's Theorem constructions,
staring with the λ-NFA N given above. The transition relation of N
is {(1, &lambda, 2), (2, a, 2), (2, a, 3), (3, b, 1), (3, b, 3)}, its start
state is 1, and its final state set is {2}.
- (a, 10) Using the construction given in lecture and in the text,
find an ordinary NFA N' such that L(N') = L(N).
- (b, 10) Using the Subset Construction on N', find a DFA D such that
L(D) = L(N).
- (c, 5) Using the minimization construction or otherwise, find
a minimal DFA D' such that L(D') = L(D). If you do not use the construction,
prove that your D' is minimal.
- (d, 5) Find a regular expression R such that L(R) = L(N). You
may begin with any of the machines N, N', D, or D'.
Last modified 23 December 2013