# Final Exam

### Directions:

• Answer the problems on the exam pages.
• There are seven problems, for 120 total points. Probable scale is somewhere around A=105, C=70.
• If you need extra space use the back of a page.
• No books, notes, calculators, or collaboration.
• The first four problems are true/false, with five points for the correct boolean answer and up to five for a convincing justification (proof, counterexample, quotation of result from lecture, etc.)

Q1: 10 points
Q2: 10 points
Q3: 10 points
Q4: 10 points
Q5: 30 points
Q6: 20 points
Q7: 30 points
Total: 120 points

• Question 1 (10): (True/false with justification) The language {(n,S,k): S is a set of binary strings each of length n, and there exists a boolean circuit C with k or fewer gates such that for any string w of length n, C(w) = 1 if and only if w ∈ S} is Turing decidable.

• Question 2 (10): (True/false with justification) If G is any context-free language with terminal alphabet {0,1}, there exists a family of boolean circuits {Cn: n ≥ 0} such that for any string w of any length n, w ∈ L(G) if and only if Cn(w) = 1.

• Question 3 (10): (True/false with justification) Let EQCFG be the set of all pairs (G1, G2) of context-free grammars such that L(G1) = L(G2). Then EQCFG is Turing recognizable.

• Question 4 (10): (True/false with justification) The language ab*a, with alphabet {a,b}, has a four-state minimal DFA.

• Question 5 (20): Recall that a formula is in k-CNF if it consists of the AND of one or more clauses, where each clause is the AND of exactly k literals. (The literals in a clause need not be distinct -- the clause x2 ∨ (¬x3) ∨ x2 could legally occur in a 3-CNF formula.) The language k-SAT is defined to be the set of k-CNF formulas that are satisfiable.

• (a,10) Prove that the language 7-SAT is NP-complete. (Don't forget to show that 7-SAT is in NP.)
• (b,10) Prove that if the language 1-SAT is NP-complete, then NP equals co-NP. (Remember that co-NP is the set of all languages whose complements are in P.)

• Question 6 (20): A directed graph is said to be strongly connected if for any two vertices u and v, there is a directed path from u to v. The out-degree of a directed graph is the maximum number of directed edges coming out of any vertex. We define 1-STR-CONN to be the set of directed graphs of out-degree 1 that are strongly connected. Prove that 1-STR-CONN is in the class L = DSPACE(log n).

• Question 7 (40): If N is any kind of nondeterministic machine taking an input string w, define the language Z(N) to be the set of all w such that N eventually accepts on every computation path with input w. (If there is any path of N on w that fails to halt, then w is not in Z(N).)

• (a,10) Prove that if N is an NFA, then Z(N) is a regular language. (Note that for an NFA, a "path on input w" must read the entire string w.)
• (b,10) Prove that if N is a nondeterministic Turing machine, then Z(N) is Turing recognizable.
• (c,10) Give an example of a nondeterministic Turing machine N such that Z(N) is not Turing decidable. Justify your answer.