- P, NP
- Reductions
- NP completeness
- SAT is NP complete

A language

*L*is**polynomial-time computable**if there is a polynomial*f*and a (deterministic) turing machine*M*such that*M*is guaranteed to halt on input*x*within*f*(∣*x*∣) steps and accepts*x*if and only if*x*∈*L*.**P**is the set of all polynomial-time computable languages.The definition of

**nondeterministic polynomial-time computable**is almost the same, except that the turing machine is allowed to be nondeterministic.**NP**is the set of all nondeterministic polynomial-time computable languages.A

**reduction**from a language*L*to a language*L*ʹ is an algorithm for transforming problem instances of*L*to problem instances of*L*ʹ. If you have an efficient reduction*f*from*L*to*L*ʹ and an efficient solution for*L*ʹ, then you can efficiently decide whether*x*∈*L*by checking whether*f*(*x*) ∈*L*ʹ. In this case,*L*ʹ is**harder**than*L*.A language

*L*is**NP-hard**if it is harder than every NP problem.A language is

**NP-complete**if it is both NP-hard and NP.

Nobody knows whether P = NP.

If P = NP, then many interesting optimization problems have polynomial time solutions

If P = NP, then any cryptographic algorithm can be broken in polynomial time

If

**any**NP-complete problem is solvable in (deterministic) polynomial time, then P = NP (and vice-versa)

Given any language *L* in *N**P*, there is a polynomial time reduction from *L* to the boolean satisfiability problem. That is, you can transform any string *x* to a formula *ϕ* such that *x* ∈ *L* if and only if *ϕ* is satisfiable.

Proof sketch: since *L* ∈ *N**P*, there is a (potentially non-deterministic) turing machine *M* with *L*(*M*) = *L*, and *M* is guaranteed to terminate on input *x* in *f*(∣*x*∣) steps.

at a high level,

*ϕ*is a logical formula that says "M accepts x".the variables represent things like "the position of the head at time

*t*is*i*" and "the tape contains*a*in position*i*at time*t*"*ϕ*contains several clauses describing the transitions of*M*. For example, a transition from state*q*to*q*ʹ on character*a*that writes*b*and moves left would be encoded as the logical formula "if at time*t*, the head is in position*i*, and the tape at position*i*contains an 'a', and the state at time*t*is*q*, then at time*t*+ 1 the state should be*q*ʹ and the tape at position*i*should contain*b*and the head should be at position*i*− 1.

*ϕ*needs to contain clauses for every time*t*. However, since we know*M*halts in*f*(∣*x*∣) steps, we only need to include the clauses for 0≤*t*<*f*(∣*x*∣), so there are only polynomially many*ϕ*also contains clauses for every position in the tape. However, the machine can move left or right at most*f*(∣*x*∣) times (since each move takes one transition), so we only need clauses describing the tape with −*f*(∣*x*∣) <*i*<*f*(∣*x*∣). Again, there are only polynomially many.*ϕ*is satisfiable if and only if*x*∈*L*(*M*).Thus, if you had a polynomial-time SAT solver, you could solve your favorite NP problem (say 3-colorability) by first transforming the graph to be collored along with a non-deterministic coloring turing machine into a big logical formula. You could then use your SAT solver to solve the formula; if the formula is satisfiable then the graph is 3-colorable, and vice-versa.