- Answer the problems on the exam pages.
- There are twelve problems (some with multiple parts) for 120 total points plus 10 extra credit. Actual scale was A = 100, C = 60.
- If you need extra space use the back of a page.
- No books, notes, calculators, or collaboration.
- The first five questions are statements -- in each case say whether the statement is true or false and give a convincing justification of your answer -- a proof, counterexample, quotation from the book or from lecture, etc. You get five points for the correct boolean answer (so there is no reason not to guess if you don't know) and up to five for the justification.

Q1: 10 points Q2: 10 points Q3: 10 points Q4: 10 points Q5: 10 points Q6: 15 points Q7: 10 points Q8: 10 points Q9: 15 points Q10: 10 points Q11: 10 points Q12: +10 points Total: 120+10 points

The language X over the alphabet {a, b, c} is the set
{a^{1}b^{j}c^{k}: i + j = k}.

The language Y over the alphabet {a, b} is the set
{a^{n}b^{n}c^{n}: n ≥ 0}.

The language Z over the alphabet {a, b, c, d} is the language of the following NFA N. N has state set {0, 1, 2, 3}, start state and only final state 0, and transitions (0, a, 1), (0, a, 2), (1, b, 2), (1, b, 3), (2, c, 3), (2, c, 0), (3, d, 0), and (3, d, 1).

The PDA M has state set {i, p, f} with start state i and only final state f. Its input alphabet is {a, b} and its stack alphabet is {a, c}. Its transitions are (i, a, ε; p, c), (p, a, ε; p, a), (p, b, a; p, ε), and (p, b, c; f, ε). Recall that the transition (q, x, y; r, z) means that the PDA can do from state q to state r while reading x, popping y, and pushing z.

The grammar G has rules S → aTb, T → TT, T → aTb, and T → ε.

**Question 1 (10):***True or false with justification:*The language X, defined above, is regular.**Question 2 (10):***True or false with justification:*The complement of the language X, defined above, is context-free.**Question 3 (10):***True or false with justification:*The language Y, defined above, is context-free.**Question 4 (10):***True or false with justification:*There is a DFA that accepts every string in X. (That is, ∃D: ∀w: (w ∈ X) → (w ∈ L(D)).) (The language X is defined above.)**Question 5 (10):***True or false with justification:*Let Z' be the set of strings in Z that never have the same letter twice in succession. (The language Z is defined above.) Then there is a regular expression whose language is Z.**Question 6 (15):**Construct a DFA whose language is Z. Also find such a DFA with a minimal number of states, either by using the minimization algorithm on your first DFA or by arguing directly that your DFA is minimal.**Question 7 (10):**Construct a regular expression whose langauge is Z.**Question 8 (10):**Construct a PDA equivalent to G (the grammar given above), using the construction given in Sipser and in lecture.**Question 9 (15):**This question concerns the construction of a CFG equivalent to the PDA M (given above), using the construction given in Sipser and in lecture.- (a, 5) Explain why M is already in the normal form required by the construction.
- (b, 10) Describe the CFG resulting from the construction, identifying the relatively few rules that are needed to actually derive strings in the language, but including all the rules and nonterminals in your description.

**Question 10 (10):**Argue informally but convincingly that L(M) = L(G), where M and G are given above (at the start of the exam).**Question 11 (10):**Prove that if u is any string in the language Z (given above), then there is a string v such that the string uv is in Z and the length of uv is divisible by 3.**Question 12 (10XC):**Describe each of the Myhill-Nerode equivalence classes for the language X.

Last modified 22 February 2015