CMPSCI 250: Introduction to Computation

Solutions to Final Exam Spring 2017

David Mix Barrington

10 May 2017


  Q1: 30 points
  Q2: 30 points
  Q3: 25 points
  Q4: 35 points
Total: 120 points

Question text is in black, solutions in blue.

Here are definitions of some terms, sets, predicates, and statements used on this exam.

Remember that the scope of any quantifier is always to the end of the statement it is in.

Remember that a natural is a non-negative integer, so that the set N or all naturals is {0, 1, 2, 3,...}.

Question 2 deals with the following scenario. All of the dogs in my neighborhood are avid birdwatchers. One day, a set of five dogs met after their morning walks to compare their observations of five possible bird species. The set D of dogs consists exactly of Arly (a), Cardie (c), Duncan (d), Mia (m), and Whistle (w). The set S of species consists exactly of Bluebird (B), Crow (C), Heron (H), Mallard (M), and Woodpecker (W). The relation R ⊆ (D × S) is defined so that (x, y) ∈ R means "dog x observed a bird of species y".

Question 2 also refers to the following five statements, where the variables are of type "dog" or of type "bird species".

The statements are:

Question 3 uses a recursive function f from N to N defined by the rules f(0) = 1, f(1) = 1, and for n ≥ 1, f(n+1) = f(n) + 2f(n-1).

Questions 3 and 4 both use a language X over the alphabet {a, b, c}, which is denoted by the regular expression (a+ab+ac)*.

Question 3 uses the function g from N to N, defined so that g(n) is the number of strings of length n in the language X.

Question 4 also uses the following ordinary NFA N, which has state set {p, q, r}, start state p, final state set {p}, and transition relation Δ = {(p, a, p), (p, a, q), (p, a, r), (q, b, p), (r, c, p)}.

The ordinary NFA N:

   |   | a
   |   V    a
  >((p)) -----> (q)
    ^ |  <-----
    | |     b		     
   c| |a
    | |
    | V