23. NP-Complete
Mar 29/31, 2022
Polynomial time reductions
Polynomial computable function
Observation: the length of
Definition. Language A is polynomial time reducible to language B if there is a polynomial computable function
Theorem. Suppose that
Proof. Let
- Compute
- Run
on input - If
then accept .
Reducing 3CNF to CLIQUE
3CNF
- each clause has 3 literals e.g.
- language: 3CNF-SAT = {
: is a satisfiable 3CNF formula }
Clique
- Language: CLIQUE = {
: graph contains a -clique }
Theorem: 3CNF-SAT is P-time reducible to CLIQUE
Proof. give a polynomial time reduction of one problem to another.
Transform formula to graph: if formula is satisfied, graph will have k-size clique
- for each 3CNF clause, create a node for each of its variables
- Add a link from a literal
to a literal in every other clause, except its complement - The formula is satisfied iff the graph has a k-clique
NP-Complete languages
We define the class of NP-complete languages:
╭——————————————————————╮ │ Decidable │ │ ╭—————————————————╮ │ │ │ NP │ │ │ │ ╭—————————————╮ │ │ │ │ │ NP-Complete │ │ │ │ │ ╰—————————————╯ │ │ │ ╰—————————————————╯ │ ╰——————————————————————╯
Every problem in NP can be transformed in P time to any NP-complete problem, i.e. a language
Theorem. If language
Proof. Any language
Cook-Levin Theorem
Language SAT (satisfiability problem) is NP-complete.
Proof. Part 1: SAT is in NP (proven previously). Part 2: reduce all NP languages to the SAT problem in polynomial time.
Take an arbitrary language
Provable by construction: for any string
-
SAT is free-form Boolean expression
-
CNF (conjunctive normal form) contains clauses of Boolean expressions
- 3CNF is case of exactly 3 literals in each clause
- CNF form can be converted to 3CNF in P time
-
SAT, CNF-SAT, 3CNF-SAT are NP-complete languages => known as NP-languages