CMPSCI 250: Introduction to Computation

Final Exam

David Mix Barrington

1 May 2015

Directions:

  Q1: 10 points
  Q2: 20 points
  Q3: 20 points
  Q4: 20+10 points
  Q5: 30 points
  Q6: 20 points
Total: 120+10 points

Definitions:

Question 2 deals with a set D of dogs, containing exactly the three distinct dogs Cardie (c), Duncan (d), and Whistle (w), and a set M of mealtimes. As all hobbits know, there are six possible mealtimes in a day: breakfast (b), second breakfast (sb), lunch (l), tea (t), supper (s), and evening snack (e). The relation F ⊆ D × M is defined so that F(x, y) means "dog x is fed at mealtime y".

Question 2 also refers to the following five statements, where the variables are of type "dog" or type "mealtime". The statements are:

N is the set of naturals (non-negative integers), {0, 1, 2, 3,...}

Z is the set of all integers, {..., -3, -2, -1, 0, 1, 2, 3,...}.

Question 3 uses a function g from Z × N to Z. This function is defined recursively on its second argument. We define g(n, 0) to be n for any integer n. For any integer n and natural k, we define g(n, k+1) to be 2g(n, k) - 3.

Question 4 uses a recursively defined function h from {0, 1}* to {0, 1}*. We define h(λ) = 1, and for any string w we define h(w0) to be 0h(w)0 and define h(w1) to be 1h(w).

Question 5 begins with the following λ-NFA N. The alphabet is {a, b}, the state set is {1, 2, 3, 4, 5}, the start state is 1, the final state set is {5}, and the transition relation Δ is

{(1, λ, 2), (1, a, 3), (2, a, 1), (2, λ, 4), (3, b, 4), (4, λ, 5), (5, b, 5)}.

Here is a diagram of N, with "L" meaning λ:


         L
>(1) - - - - - > (2)
  | < - - - - - - |
  |      a        |
  |               |                    b
  |a              |L                 ----
  |               |                 /    \
  V      b        V      L         V      |
 (3) - - - - - > (4) - - - - - > ((5)) - -|

Last modified 14 December 2015