Docsity

Advanced Computational Complexity-Lecture 04 Slides-Computer Science, Slides of Advanced Computational Complexity

Partial preview of the text

Download Advanced Computational Complexity-Lecture 04 Slides-Computer Science and more Slides Advanced Computational Complexity in PDF only on Docsity!

Lecture 4: The Class NP

Matthew Johnson

[email protected]

Beyond P

We have seen that the class P provides a useful model of easy problems. This includes 2-SATISFIABILITY and 2-COLOURABILITY. But what about 3-SATISFIABILITY and 3-COLOURABILITY? No polynomial time algorithms for these problems are known. On the other hand...

Verifiers

Definition An acceptor machine V which halts on all inputs is called a verifier for a language L if

L = {w | V accepts “w; c” for some string c}

The string c is called a certificate (or witness) for w. A verifier is said to be polynomial-time if it is a polynomial-time TM, and there is a polynomial p(x) such that, for any w ∈ L, there is a certificate c with |c| ≤ p(|w|). All problems from the previous slide have polynomial-time verifiers

The class NP

Definition The class of languages that have polynomial-time verifiers is called NP

Problems (probably) not in NP

NO HAMILTONIAN CIRCUIT

Instance : A graph G Question: Is it true that G has no Hamiltonian circuit?

CHECKERS

Instance : An integer n and a position in checkers on n × n board Question: Is it a winning position for White?

Nondeterministic Machines

We can get an alternative definition of the class NP by considering non-deterministic machines. Recall that if NT is a non-deterministic Turing Machine, then NT (x) denotes the tree of configurations which can be entered with input x, and NT accepts x if there is some accepting path in NT (x). Definition The time complexity of a non-deterministic Turing Machine NT is the function NTimeNT such that NTimeNT (x) is the number of steps in the shortest accepting path of NT (x) if there is one, otherwise it is the number of steps in the shortest rejecting path. (If not all paths of NT (x) halt, then NTimeNT (x) is undefined.)

An Alternative Definition of NP

Definition NP =

k≥ 0

NTIME[nk^ ]

This was the original form of the definition of NP , and was first formulated by Karp in 1972. It explains the name — NP = Nondeterministic Polynomial-time

Equivalence

Theorem The two different definitions of NP are equivalent Proof : If L ∈ NTIME[nk^ ], then there is a nondeterministic machine NT such that x ∈ L if and only if there is an accepting computation path in NT (x). Furthermore, the length of these paths is in O(|x|k^ ). Using (some encoding of) these computation paths as the certificates, we can construct a polynomial time verifier for L which simply checks that each step of the computation path is valid.

Equivalence proof continued

Conversely, if L has a polynomial-time verifier V , then we can construct a non-deterministic machine that first “guesses” the value of the certificate (by making a series of non-deterministic choices), and then simulates V with that certificate. Since the length of the certificate is polynomial in the length of the input, this machine is a nondeterministic polynomial-time decision procedure for L.

Equivalence proof continued

Conversely, if L has a polynomial-time verifier V , then we can construct a non-deterministic machine that first “guesses” the value of the certificate (by making a series of non-deterministic choices), and then simulates V with that certificate. Since the length of the certificate is polynomial in the length of the input, this machine is a nondeterministic polynomial-time decision procedure for L.

P = NP?

The question of whether or not P = NP is one of the biggest open problems in computer science.

It is equivalent to determining whether or not the existence of a short solution guarantees an efficient way to find that solution. Virtually everyone is convinced that P 6 = NP , but after 30 years of effort there is still no proof. Resolving this question (either way) would win a prize of 1 million dollars — see www.claymath.org/millennium/P_vs_NP/

Complete Problems

Any complexity class can be partitioned into equivalence classes via polynomial-time reduction — each class contains problems that are reducible to each other. These equivalence classes are partially ordered by reduction. Problems in the maximal class are called complete.

NP -completeness

To show that L is NP -complete we must show that every language in NP can be reduced to L in polynomial time. This would appear to be hard! However, once we have one NP-complete language L 0 , we can show any other language L is NP-complete just by showing L 0 ≤ L Hence the most difficult part is finding the first one...

The First NP -complete Problem

This problem was solved by Cook in 1970 (and independently by Levin in the USSR)

Theorem (Cook-Levin) SATISFIABILITY is NP -complete.