Solutions - public.asu.edu

CSE 555 Homework Five Sample Solutions
Question 1
Let φ be a 3cnf-formula. An 6=-assignment to the variables of φ is one where each clause contains two literals with
unequal truth values. In other words, an 6=-assignment satisfies φ without assigning three true literals in any clause.
a Show that the negation of any 6=-assignment to φ is also an 6=-assignment.
b Let 6=SAT be the collection of 3cnf-formulas that have an 6=-assignment. Show that we obtain a polynomial time
reduction from 3SAT to 6=SAT by replacing each clause ci = (y1 ∨ y2 ∨ y3 ) with the two clauses (y1 ∨ y2 ∨ zi )
and (zi ∨ y3 ∨ b), where zi is a new variable for each clause ci , and b is a single additional new variable.
c Conclude that 6=SAT is NP-complete.
Solution: This is answered here: http://www.jessfortier.com/theory-of-computation/jfortier Assignment8.pdf.
Question 2
A cut in an undirected graph is a separation of the vertices V into two disjoint subsets S and T . The size of a cut is
the number of edges that have one endpoint in S and the other in T . Let M AX − CU T = {hG, ki|G has a cut of size
k or more}. Show that M AX − CU T is NP-complete. You may assume the result of Problem 7.26. (Hint: Show that
6=SAT ≤p M AX − CU T . The variable gadget for variable x is a collection of 3c nodes labeled with x and another 3c
nodes labeled with x, where c is the number of clauses. All nodes labeled x are connected with all nodes labeled x.
The clause gadget is a triangle of three edges connecting three nodes labeled with the literals appearing in the clause.
Do not use the same node in more than one clause gadget. Prove that this reduction works.)
Solution: This is answered here (Question 7): http://tuvalu.santafe.edu/~moore/theory/hw4solns.pdf.
Question 3 (7.43)
For a cnf-formula φ with m variables and c clauses, show that you can construct in polynomial time an NFA with
O(cm) states that accepts all nonsatisfying assignments, represented as Boolean strings of length m. Conclude that P
6= NP implies that NFAs cannot be minimized in polynomial time.
Solution: This is partly answered here (Question 2): http://www.eecs.berkeley.edu/ luca/cs172-07/practice2-sol.pdf.
We also give details on how to make the NFA. For constructing each clause Ci , create m states {qi,j }1≤j≤m as follows:
qi,j transitions to qi,j+1 on 0 if variable j is in Ci and is not in its negated form, or is not in Ci at all; also, qi,j
transitions to qi,j+1 on 1 if variable j is in its negated form in Ci or does not appear in Ci at all. We make a start
state q0 that has an -transition to qi,1 for 1 ≤ i ≤ c, and a final state qf (it is the only one) which has a transition
from qi,m for all 1 ≤ i ≤ c to qf .
Question 4 (7.51)
This problem investigates resolution, a method for proving the unsatisfiability of cnf-formulas. Let φ = C1 ∧C2 ∧· · ·∧Cm
be a formula in cnf, where the Ci are its clauses. Let C = {Ci | Ci is a clause of φ}. In a resolution step, we take
two clauses Ca and Cb in C, which both have some variable x occurring positively in one of the clauses and negatively
in the other. Thus, Ca = (x ∨ y1 ∨ y2 ∨ · · · ∨ yk ) and Cb = (x ∨ z1 ∨ z2 ∨ · · · ∨ z` ), where the yi and zi are literals.
We form the new clause (y1 ∨ y2 ∨ · · · ∨ yk ∨ z1 ∨ z2 ∨ · · · ∨ z` ) and remove repeated literals. Add this new clause
to C. Repeat the resolution steps until no additional clauses can be obtained. If the empty clause () is in C, then
declare φ unsatisfiable. Say that resolution is sound if it never declares satisfiable formulas to be unsatisfiable. Say
that resolution is complete if all unsatisfiable formulas are declared to be unsatisfiable.
Question 4a
1
Show that resolution is sound and complete.
Solution: this is answered here: http://www.mathcs.duq.edu/simon/Fall04/notes-6-20/node3.html.
Question 4b
Use part (a) to show that 2SAT ∈ P.
Solution: we make a poly-time algorithm for 2SAT :
D = “On input hφi:
1. Repeat Steps 2 and 3 until no additional clauses are created.
2. Find 2 clauses that have a variable (say x) appearing positively in one of the clauses and negatively in the other.
3. Perform resolution on these 2 clauses (and remove the original 2 clauses), and remove repeated literals. If the
result is the empty clause, reject.
4. Accept.”
There are only O(m2 ) choices of clauses to observe, and resolution of 2 clauses takes poly-time. Therefore, 2SAT ∈ P .
Question 5
Let EQREX = {hR, Si | R and S are equivalent regular expressions}. Show that EQREX ∈ PSPACE.
Solution: this is answered here (Question 4): http://www.cs.cmu.edu/~lblum/flac/Solutions/Sol9.pdf.
2