CMPSCI 250: Introduction to Computation

Final Exam

David Mix Barrington

29 April 2016

Directions:

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

Question 3 deals with a set D of dogs, consisting of exactly the five dogs Arly (a), Cardie (c), Duncan (d), Knight (k), and Nico (n), and a set of four activities A, consisting of "barking" (bar), "chasing" (cha), "swimming" (swi), and "wrestling" (wre). The predicate L(x, y, z) means "dog x likes activity y with dog z". If y is any activity, the binary relation Ly on D is defined by Ly(x, z) ↔ L(x, y, z).

Question 3 also refers to the following six statements, where the variables are of type "dog" or type "activity":

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

Question 4 uses a recursive function from N to N defined by the rules f(0) = 0 and f(n+1) = 2f(n) + n.

Questions 4 and 5 use the following DFA D, which has state set {p, q, r}, start state p, final state set {p, q}, and transition function δ given by δ(p, a) = p, δ(p, b) = q, δ(q, a) = r, δ(q, b) = q, and δ(r, a) = δ(r, b) = r.

We also use D to define three functions p(n), q(n), and r(n) from N to N as follows. For any natural n, p(n) is the number of strings w of length n such that D (started in state p) finishes reading w in state p. (That is, such that δ*(p, w) = p.) Similarly, q(n) is the number of strings w of length n such that D (again started in state p) finishes reading w in state q, and r(n) is the number finishing in state r.

Question 5 also uses the following λ-NFA N, which has state set {1, 2, 3, 4}, start state 1, final state set {4}, and transition relation Δ = {(1, λ, 2), (2, a, 2), (2, λ, 3), (3, b, 3), (3, λ, 4)}.

The DFA D:       

  ___          ___         ___
 |   | a      |   | b     |   | a, b
 |   V        |   V       |   V
>((p)) -----> ((q)) -----> (r)
        b             a


The lambda-NFA N ("L" = lambda):


            ___        ___
           |   | a    |   | b
           |   V      |   V
>(1) -----> (2) -----> (3) -----> ((4))
      L           L         L

Last modified 14 May 2016