CMPSCI 250: Introduction to Computation

Final Exam Fall 2017

David Mix Barrington

14 December 2017

Directions:

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

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

Question 1 deals with the following scenario:

The web site WeRateDogsTM gives numerical ratings of animals based on photographs, and publishes these at twitter.com/dog_rates. They provided ratings for a set A of six animals, consisting exactly of Cardie (c), Duncan (d), Floyd (f), Mia (m), Pushkin (p), and Tib (t). We thus have a function r from A to N where r(x) is the rating of animal x.

We have a number of additional predicates defined on A:

Question 2 also refers to the following six statements, where the variables are of type "animal or type "natural". The predicate P(n) means "natural n is prime".

The statements are:

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

Again, we define the predicate P on N so that P(n) means "n is prime".

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

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

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

        L
>(1) -----> (2)
  |  <-----  |^
  |     a    ||
  |          ||
  |         L||b
  |          ||
  |   b      V|
   ------->((3))


Last modified 3 January 2018