# Final Exam (Version B) 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(m) ↔ ∃z:(z≠m) ∧ RO(z)) ∧ &neg;SN(m)
• Statement III (to symbols): Neither Becky nor Cindy 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(b), GT(c), RO(b), RO(c), SN(b), and SN(c). 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 3, and transitions (1, a, 2), (1, λ, 5), (2, a, 4), (3, b, 2), (3, a, 4), (4, λ, 3), (5, b, 3), and (5, &lambda, 4).

• (a, 10) Construct an ordinary NFA N’ from N using the construction given in lecture. You should get eleven a-moves and six 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) If T is any rooted tree with n nodes and e edges, then it is possible that e = n-2.

• (b) Let A and B be any two languages (sets of strings). If A* ⊆ B*, then A ⊆ B.

• (c) If the contrapositive of a statement is true, then the converse of the statement is true as well.

• (d) A basket contains a certain number of apples. If I take them out 5 at a time, 3 apples remain. If I take them out 6 at a time, 1 apple remains. Then the smallest number of apples this basket might contain is 13.

• (e) The congruence 5x ≡ 3 (mod 10) has no solution.

• (f) For an undirected graph G and a node v in that graph, the DFS and BFS trees of G rooted at v always contain the same number of edges.

• (g) Let h1(s) and h2(s) be two non-negative potential heuristics for the same search problem. If either h1(s) is admissible and h2(s) is inadmissible, then h3(s) = min(h1(s), h2(s)) will be admissible.

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

• (i) The less-than relation, <, on a set of real numbers is not a partial ordering because while it is antisymmetric, it is irreflexive.

• (j) Given any multi-tape Turing machine, there is a single-tape Turing machine that has the same language.

• (k) The regular expressions (1*0*)* and (0 + 1)* denote the same language.

• (l) Every subset of a regular language is regular.

• (m) If L and M are two languages such that M, LM and ML are all regular, then L must be regular.

• (n) There exists a finite language (i.e., a language with a finite number of words) that is not the language of any DFA.

• (o) Every language is Turing recognizable.