# COMS W3261 Computer Science Theory Lecture 18: November 26, 2012 Satisfiability

## Outline

• Review of the satisfiability problem for boolean expressions
• SAT is NP-complete: the Cook-Levin theorem
• Some other NP-complete problems
• Complements of languages in NP

## 1. Review

• The satisfiability problem for boolean expressions
• A truth assignment T satisfies a boolean expression E if E(T) = 1.
• An expression E is satisfiable if there exists a truth assignment T to the variables in E that satisfies E.
• The satisfiability problem (SAT) is to determine whether a given boolean expression is satisfiable.
• Normal Forms for boolean expressions
• A boolean expression is in conjunctive normal form (CNF) if it is the logical AND (conjunction) of clauses;
• e.g., (x ∨ ¬y) ∧ (¬x ∨ z) is in CNF.
• A boolean expression is in k-CNF if it is the logical AND of clauses each one of which is the logical OR of exactly k distinct literals;
• e.g., (w ∨ ¬x ∨ y) ∧ (x ∨ ¬y ∨ z) is in 3-CNF.
• Two boolean expressions are equivalent if they have the same result on any truth assignment to their variables.
• CSAT
• Given a boolean expression E in CNF, is E satisfiable?
• We can view CNF as the language { E | E is the representation of a satisfiable CNF boolean expression }.
• CSAT is NP-complete.
• kSAT
• Given a boolean expression E in k-CNF, is E satisfiable?
• 1SAT and 2SAT are in P; kSAT is NP-complete for k ≥ 3.

## 2. SAT is NP-complete: the Cook-Levin theorem

• SAT is in NP
• Given a boolean expression E of length n, a multitape nondeterministic Turing machine can guess a truth assignment T for E in O(n) time.
• The NTM can then evaluate E using the truth assignment T in O(n2) time.
• If E(T) = 1, then the NTM accepts E.
• If L is in NP, then there is a polynomial-time reduction of L to SAT.
• If a NTM M accepts an input w of length n in p(n) time, then M has a sequence of moves such that
1. α0 is the initial ID of M with input w.
2. α0 |– α1 |– … |– αk where k ≤ p(n).
3. αk is an ID with an accepting state.
4. Each αi consists only of nonblanks unless αi ends in a state and a blank, and extends from the initial head position to the right.
• From M and w we can construct a boolean expression EM,w that is satisfiable iff M accepts w within p(n) moves. See HMU, pp. 440-446 for details.

## 3. Some Other NP-complete Problems

• There are thousands of known NP-complete problems. Here are some notable ones:
• Satisfiability
• CSAT
• 3SAT
• Independent set
• Node cover
• Directed Hamiltonian circuit
• Undirected Hamiltonian circuit
• Traveling salesman problem

## 4. Complements of Languages in NP

• P is closed under complement but it is not known whether NP is closed under complement.
• Co-NP is the set of languages whose complements are in NP.
• It is widely believed that none of the NP-complete languages have their complements in NP.
• Thus, it is believed no NP-complete language is in co-NP.
• We suspect NP ≠ co-NP because we can prove NP = co-NP iff there is some NP-complete problem whose complement is in NP.

## 5. Practice Problems

1. Show that 1SAT and 2SAT are solvable in linear time.
2. Show that 3SAT is NP-complete.
3. Show that CSAT is NP-complete.