# Final Exam (Version A) Spring 2020

### Directions:

• Answer the problems on the exam pages.
• There are four problems, each with multiple parts, for 120 total points. Actual scale A = 105, C = 70.
• The textbook, course website, and notes are allowed. No other books, calculators, or collaboration.
• In case of a numerical answer, an arithmetic expression like "217 - 4" need not be reduced to a single integer.

```  Q1: 30 points
Q2: 30 points
Q3: 30 points
Q4: 30 points
Total: 120 points
```

• Question 1 (30): One day, Duncan went to the park and met his friends Becky, Cindy, Maggie, and Pushkin, so that the set S of dogs at the park was {b, c, d, m, p}. Define three unary predicates on S, so that for any dog x, GT(x) means “x got a treat”, RO(x) means “x ran off”, and SN(x) means “x sat nicely”.

• (a, 10) Translate the following statements as indicated:

• Statement I (to symbols): Every dog who sat nicely got a treat.
• Statement II (to English): (RO(p) ↔ ∃z:(z≠p) ∧ RO(z)) ∧ &neg;SN(p)
• Statement III (to symbols): Neither Duncan nor Maggie sat nicely, and one of them ran off while the other got a treat.
• Statement IV (to symbols): At least two different dogs sat nicely.
• Statement V (to English): ∀y:((&neg;RO(y)) → GT(y))

• (b, 5) Consider the six propositions GT(d), GT(m), RO(d), RO(m), SN(d), and SN(m). There are 26 = 64 possible assignments of truth values to these propositions. How many of these are consistent with Statement III? Justify your answer. (Hint: If you make a truth table, you can simplify your life by considering only four of the six variables.)

• (c, 15) Using Statements I-IV, prove Statement V. You may use English, symbols, or a combination, but make your use of quantifier proof rules clear.

• Question 2 (20+10): Let Σ = {a, b, c, d, e} and let S be the language (aa + bb + cc + ddd + eee)*.

• (a, 5) Prove that for all naturals n, except for n = 1, there exists a string of length n in S. (Hint: Show the n = 0 case separately and then use induction on all n with n ≥ 2.)
• (b, 5) Let f(n) be the number of strings in S of length n. Explain why, for all n with n ≥ 3, f(n) = 3f(n-2) + 2f(n-3).
• (c, 10) Prove, for all naturals n, that f(n) = [2n+2 + (-1)n(3n+5)]/9. (Hint: Use strong induction on the recurrence from part (b), with base cases for n = 0, n = 1, and n = 2.
• (d, 10) The Myhill-Nerode Theorem tells us that Σ* is divided into a finite number of S-equivalence classes. How many are there? Justify your answer. You may quote the Myhill-Nerode Theorem to justify your answer if you do so correctly.

• Question 3 (30): Let N be a λ-NFA with state set {1, 2, 3, 4, 5}, start state 1, only final state 4, and transitions (1, λ, 2), (1, b, 3), (2, a, 4), (2, λ, 5), (3, b, 5), (4, a, 3), (4, b, 5), and (5, &lambda, 4). This is the λ-NFA used in the 2:00 exam. The 8:00 exam had the transition (4, λ, 5) instead of (4, b, 5).

• (a, 10) Construct an ordinary NFA N’ from N using the construction given in lecture. You should get six a-moves and eleven b-moves. (The NFA from the λ-NFA on the 8:30 exam had eight a-moves and three b-moves.)

• (b, 5) Construct a DFA D from N’ using the Subset Construction.

• (c, 5) Construct a minimal DFA D’ equivalent to D. If you do not use the minimization construction from the textbook and supplemental lecture, prove that your D’ is in fact minimal.

• (d, 5) Construct a regular expression R with L(R) = L(D). You may start from either D or D’.
• (e, 5) Construct a lambda-NFA with the same language as R, using the construction from lecture and the textbook.

• Question 4 (30): The following are fifteen true/false questions, with no explanation needed or wanted, no partial credit for wrong answers, and no penalty for guessing.

• (a) There exists a language that is not Turing recognizable.

• (b) Every language that is not the language of any DFA has an infinite number of words.

• (c) There exist languages L and M such that M, LM, and ML are all regular languages, but L is not regular.

• (d) There exist languages X and Y such that Y is regular, X is not regular, and X is a subset of Y.

• (e) The regular expressions (1*0*)* and (0 + 1)* denote different languages.

• (f) There exists a multitape Turing machine whose language is not the language of any single-tape Turing machine.

• (g) The less-than relation, <, on a set of real numbers is a partial ordering since it is antisymmetric and reflexive.

• (h) The maximum number of edges in a bipartite graph on 14 vertices is 49.

• (i) Let h1(s) and h2(s) be two non-negative potential heuristics for the same search problem. If either h1(s) or h2(s) is an admissible heuristic, then so is h3(s) = min(h1(s), h2(s)).

• (j) There exist an undirected graph G and a node v in G such that the DFS and BFS trees of G rooted at v contain different numbers of edges.

• (k) There exists a natural x such that 5x is congruent to 3, modulo 10.

• (l) A basket contains a certain number of apples. If we take them out 6 at a time, 1 apple remains. If we take them out 5 at a time, 3 apples remain. Then the original number of apples must have been greater than 12.

• (m) If the converse of a statement is false, then its contrapositive is also false.

• (n) Let A and B be any two languages (sets of strings). It is possible that A* ⊆ B*, but that A is not a subset of B.

• (o) If T is any rooted tree with n nodes and e edges, then it is possible that n = e+2.