CMPSCI 250: Introduction to Computation

Solutions to Final Exam

David Mix Barrington

23 December 2013

Directions:

  Q1: 10 points
  Q2: 25 points
  Q3: 25 points
  Q4: 35 points
  Q5: 30 points
Total: 125 points

Question text is in black, solutions in blue.

Correction in orange made 1 May 2015.

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".

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:

  1. The string b is in Y.

  2. If the string w is in Y, then so are the strings wab and wbba.

  3. 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

Last modified 1 May 2015