CS 252 Final Exam Example Problems Is the formula satisfiable? (x + y + z)(~x + ~y + ~z)(x + ~y + ~z) Determine if the numbers x and y are relatively prime. Show the calculations that led to your conclusion. x = 321 y = 123 A Boolean formula in conjunctive normal form (CNF) is a product (and) of clauses, where each clause is a sum (or) of literals. A Tautology is a Boolean formula that is true for every assignment of values to its variables. The CNF-TAUTOLOGY problem is to decide if a Boolean formula in conjunctive normal form is a Tautology. CNF-TAUTOLOGY = { | B is a Boolean formula in CNF and B is a tautology } Use parts a-b below to show that CNF-TAUTOLOGY is in the class P. (Note that only a single clause needs to be false to make the formula false. Also note that a clause can be made false by setting all its literals to false unless the clause contains conflicting literals.) a. Give a high-level description of a decider for CNF-TAUTOLOGY. A high-level description describes an algorithm without giving details about how the machine manages its tape or head. b. Show that the decider in part a runs in deterministic polynomial time. In the SET-COVER problem you are given a set U, a collection S = { S1, ..., Sm } of subsets of U, and a number k. You are to find k of the subsets whose union equals U. SET-COVER = { | U is a set, S = { S1, ..., Sm } is a collection of subsets of U, and the union of k of the subsets equals U } Use parts a-b below to show that SET-COVER is in the class NP. a. Give a high-level description of a non-deterministic decider for SET-COVER. A high-level description describes an algorithm without giving details about how the machine manages its tape or head. b. Show that the decider in part a runs in non-deterministic polynomial time. Use parts a-d below to show that SET-COVER is NP-hard. Recall that VERTEX-COVER = { | G is an undirected graph with a k-node vertex cover }. a. Describe a polynomial-time-mapping-reduction from a VERTEX-COVER instance to a SET-COVER instance . (Hint: Make the set U in the SET-COVER instance contain edges from the graph G in the VERTEX-COVER instance.) b. Explain why the reduction in part a runs in polynomial time. c. Explain why if is in VERTEX-COVER, must be in SET-COVER. d. Explain why if is in SET-COVER, must be in VERTEX-COVER. For each of the languages defined below, identify the smallest language class that contains the language. (Note that some language classes may be used more than once and some may not be used at all.) Choose from among these language classes: Regular Context Free Decidable Turing-recognizable Not Turing-recognizable a. L1 = { | M is a DFA and M accepts epsilon } b. L2 = { | M is a TM and M accepts epsilon } c. L3 = { w | the number of a's in w is divisible by 3 } d. L4 = { a^n b^m a^n b^m a^n | n,m >= 0 } e. L5 = { a^n b^m a* b^m a^n | n,m >= 0 } Consider the language L1. L1 = { | M1 is a Deterministic Finite Automaton and M1 accepts some string of a's and b's where the number of a's is even }. Show that L1 is decidable by giving the high-level description of a Turing Machine that decides L1. A high-level description of a Turing Machine describes an algorithm without giving details about how the machine manages its tape or head. You may use the following facts: * An algorithm exists to convert an NFA into a DFA. * An algorithm exists to convert a regular expression into a DFA. * Algorithms exist to find the union, intersection, complement, concatenation, and star of DFAs. * A decider exists to decide if a DFA accepts a specific string. (A[DFA]) * A decider exists to decide if a DFA accepts no strings. (E[DFA]) * A decider exists to decide if two DFAs are equivalent. (EQ[DFA]) Consider the language L2. L2 = { | M2 is a Turing Machine and M2 accepts some string of a's and b's where the number of a's is even } Follow parts a-c below to give a proof that L2 is undecidable using a reduction from A[TM] to L2. (Don't use a mapping-reduction.) Recall that A[TM] = { | M is a Turing Machine and M accepts w }. a. Give the introduction for the proof. b. Give a description of a TM S that decides A[TM]. Make sure that TM S uses TM R (that decides L2) as part of it's implementation. c. Give the conclusion for the proof. Consider the language L2. L2 = { | M2 is a Turing Machine and L(M2) = Sigma* } a. Give a high-level description of a Turing Machine that computes a mapping-reduction from A[TM] to L2. A high-level description of a Turing Machine describes an algorithm without giving details about how the machine manages its tape or head. Recall that A[TM] = { | M is a Turing Machine and M accepts w }. b. Explain why if the input to your machine is in A[TM], the output from your machine will be in L2. c. Explain why if the input to your machine is not in A[TM], the output from your machine will not be in L2. d. Give a conclusion that explains why parts a-c show that L2 is not decidable.