CMPSCI 250: Introduction to Computation

Solutions to First Midterm Exam

David Mix Barrington

25 February 2015

Question text is in black, solutions in blue.


  Q1: 20 points
  Q2: 20 points
  Q3: 10 points
  Q4: 15 points
  Q5: 15 points
  Q6: 20+10 points
Total: 100+10 points

Correction in orange made 23 February 2016.

Here are definitions of sets, predicates, and statements used in Questions 1-5 on this exam.

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

Last week my young neighbor Marisol invited a set D of six dogs to a Pet Competition. The dogs were Arlie (a), Cardie (c), my Duncan (d), another Duncan (d'), Honey (h), and Whistle (w).

Let Σ be the alphabet {a, b, c,..., z} and recall that Σ* is the set of all strings with letters in Σ.

The relation N ⊆ D × Σ* is {(x, y): the name of dog x is string y}. The names of the six dogs are thus "arlie", "cardie", "duncan", "duncan", "honey", and "whistle".

The relation R ⊆ D × D is {(x, y): either dogs x and y have the same name or x's name comes before y in alphabetical order}.

The relation S ⊆ D × D is {(x, y): x and y are dogs and R(x, y) and R(y, x) are both true}.

The relation GT ⊆ D is {x: x is a dog and x got a treat}.

Let B be the set of breeds {p, r, s, t} or {Poodle, Retriever, Setter, Terrier}. Let the relation IB ⊆ D × B be {(x, y): dog x is of breed y}. Assume that this relation is a function from D to B. (Hence every dog is of exactly one breed.)

The relation SB ⊆ D × D is {(x, y): ∃b: IB(x, b) ∧ IB(y, b)}.

The Pet Competition had three events: Best Dressed (BD), Cleverest Trick (CT), and Fastest Dog (FD). Let E be the set {BD, CT, FD}.

The relation WB ⊆ E × D is {(y, z): event y was won by dog z}. Assume that this relation is a function from E to D, so that every event was won by exactly one dog.

Last modified 23 February 2016