rmykkänen

notes

Satisfiability

date

Satisfiability continues a conversation on NP-completeness. To prove some problem B is NP-complete:

  1. Prove B∈NPB \in \text{NP} by showing that it is verifiable in polynomial time.
  2. Prove BB is NP-hard; A≤pBA \leq_{p} B. For this, choose some known AA which is NP-complete, then give some reduction ff computable in polynomial time such that for every x∈Ax \in A:
    • x∈A(is good)  ⟺  f(x)∈B(is good)x \in A(\text{is good}) \iff f(x) \in B(\text{is good})
    • x∉A(is bad)  ⟺  f(x)∉B(is bad)x \notin A(\text{is bad}) \iff f(x) \notin B(\text{is bad})

In order to prove that a problem is NP-complete, another NP-complete problem must exist. However, Cook and Levin proved SAT is NP-complete without a predecessor; ∀A∈NP,A≤pSAT\forall A \in \text{NP}, A \leq_{p} \text{SAT}.

SAT

A variable is one of x1,x2,...,xnx_1, x_2, ..., x_n. A literal is a variable or its negation; xix_i or ¬xi¬ x_i. A clause is an OR of several literals. A formula in CNF form is an AND of several clauses. For example, (x1)∧(¬x1)(x_1) \land (\neg x_1) is unsatisfiable.

Definition: Φ∈SAT\Phi \in \text{SAT} such that Φ\Phi is a formula in CNF form and is satisfiable.

Cook and Levin proved L∈NP  ⟹  L≤pL \in \text{NP} \implies L \leq_{p} SAT. So if SAT∈P  ⟹  NP⊆P  ⟹  P=NP\text{SAT} \in \text{P} \implies \text{NP} \subseteq \text{P} \implies \text{P} = \text{NP}. SAT is like an elected representative of the entire NP set. This is why we don't believe there exists a polynomial time algorithm for SAT.

3SAT

We prove that 3SAT is NP-complete by reduction. First, we show 3SAT∈NP\text{3SAT} \in \text{NP}. Our witness is the assignment of variables for the problem instance solution. All of these computations can be done in polynomial time. For all Φ(C1,...,Cm)\Phi(C_1, ..., C_m), check if Φ(C1,...,Cm)=1\Phi(C_1,...,C_m) = 1 or not.

Now we prove SAT≤p3SAT\text{SAT} \leq_p \text{3SAT}. For a general SAT formula, we convert it to a 3SAT instance such that Φ\Phi is satisfiable iff F(Φ)F(\Phi) is satisfiable. An input Φ\Phi of every SAT formula has some max clause size kk. If k≤3k \leq 3 then Φ\Phi is in both SAT and 3SAT. Now suppose Φ\Phi has a max clause size greater than 3. We convert a clause size of k>3k > 3 to a pair of clauses, one of size k−1k-1 and the other of size 33. We add a variable zz as follows:

(x1∨x2∨⋯∨xk−1∨xk)  ⟺  (x1∨x2∨⋯∨xk−2∨z)∧(¬z∨xk−1∨xk)(x_1 \lor x_2 \lor \dots \lor x_{k-1} \lor x_k) \iff (x_1 \lor x_2 \lor \dots \lor x_{k-2} \lor z) \land (\neg z \lor x_{k-1} \lor x_k)

Note, if the kk clause is true, at least one of the literals is true, so there is a selection in zz to make the two clauses true. If kk is always false, the two clauses are false for any zz. Repeat this process, adding dummy variables, until Φ\Phi only has clauses of size 3. This reduction occurs in polynomial time. SAT≤p3SAT\text{SAT} \leq_p \text{3SAT}, so 3SAT\text{3SAT} is NP-complete.

Cook and Levin showed that SAT\text{SAT} is NP-complete. We found that 3SAT\text{3SAT} is NP-complete too. We could repeat this reduction for any SAT variant with k≥3k \geq 3.

2SAT

2SAT∈P\text{2SAT} \in \text{P}, so if 3SAT≤p2SAT,SAT∈P\text{3SAT} \leq_p \text{2SAT}, \text{SAT} \in \text{P} and NP=P\text{NP} = \text{P}. This equivalence is intuitively false though; (p⇒q)  ⟺  (¬p∨q)(p \Rightarrow q) \iff (\neg p \lor q), so every clause of size two is an implication.

Create a graph with two vertices for each literal and two edges for each clause. If (a∨b)(a \lor b) is a clause, add edge ¬a→b,¬b→a\neg a \rightarrow b, \neg b \rightarrow a. Implication is transitive, and a formula is unsatisfiable iff ∃x,(x⇒¬x)∧(¬x⇒x)\exists x, (x \Rightarrow \neg x) \land (\neg x \Rightarrow x); that is, for some variable xx there exists a path in our graph from xx to ¬x\neg x and vice versa.

CircuitSAT

Let cSAT be defined as the set cSAT = { CC | CC is a satisfiable boolean circuit}. We prove that cSAT is NP-complete.

First, we show that cSAT ∈NP\in \text{NP}. The verifier VV takes as input CC and a witness of nn bits, and runs CC on the inputs. The size of the input is intuitively polynomial (more depth, more gates).

Now we show that 3SAT≤pcSAT\text{3SAT} \leq_p \text{cSAT}. Let Φ\Phi be a 3SAT\text{3SAT} formula. We create a boolean circuit with variables x1,...,xkx_1,...,x_k and additional input wires for negated literals. We add one root gate on the next layer. For each clause, add a sub-circuit for the appropriate three. Then, add an AND gate to AND the clauses together.

If Φ∈3SAT\Phi \in \text{3SAT}, this circuit C=F(Φ)∈cSATC = F(\Phi) \in \text{cSAT}. If Φ∉3SAT\Phi \notin \text{3SAT}, this circuit is also unsatisfiable. Construction of this circuit takes polynomial time. 3SAT≤pcSAT\text{3SAT} \leq_p \text{cSAT} so cSAT\text{cSAT} is NP-complete.