210 likes | 373 Views
Complexity class NP. Is the class of languages that can be verified by a polynomial-time algorithm. L = { x in {0,1}* | there exists a certificate y with |y| = O(|x| c ) The algorithm A verifies language L in polynomial time . HAM-CYCLE NP.
E N D
Complexity class NP Is the class of languages that can be verified by a polynomial-time algorithm. L = { x in {0,1}* | there exists a certificate y with |y| = O(|x| c) The algorithm Averifies language L in polynomial time. HAM-CYCLE NP
If L P then L NP, since if there is a polynomial time algorithm to decide L, the algorithm can be easily converted to verification algorithm to accept those inputs that it detemines to be in L. Thus P NP
Unknown NP is closed under complement? L NP /L NP ? Define complexity class co-NP : L such that /L NP NP = co-NP ? P is closed under complement P NP co-NP
NP = co-NP P = NP = co-NP P NP co-NP P = NP co-NP NP co-NP co-NP NP P P = NP co-NP ? Any language in NP co-NP - NP ? Four possible relationships between complexity classes
NP-Complete problems If NP - P is nonempty, HAM-CYCLE NP - P NP-Complete languages are, in a sense, the “hardest” languages in NP. Compare the relative “hardness” of languages by “polynomial time reducibility”.
Reducibility Q is reduced to Q’ if any instance of Q can be “easily rephrased” into an instance of Q’. Then Q is, in a sense, “not harder to solve” than Q’. L1 is polynomial time reducible to L2, L1p L2, if there exists a polynomial time computable function f: {0,1}* {0,1}* such that x {0,1}* ; x L1 iff f(x) L2. f is called reduction function
x f(x) x L1 ? f(x) L2 ? F A2 A1 Lemma 36.3 If L1, L2 {0,1}* are languages such that L1p L2, then L2 P implies L1 P.
NP-completeness • A language L {0,1}* is NP-complete if • L NP and • L’ p L for every L’ NP • If 2 but not 1 L is NP-hard
Theorem 36.4 If any NP-complete problem is polynomial time solvable, then P = NP. If any problem in NP is not polynomial time solvable, then all NP-complete problems are not polynomial time solvable.
Circuit satisfiability A truth assignment for a boolean combinational circuit is a set of boolean input values. A one-output combinational circuit is satisfiable if it has a truth assignment that causes the output to be 1. CIRCUIT-SAT = {<C> | C is a satisfiable boolean combinational circuit } k inputs, 2k possible assignments
Lemma 36.5 The circuit satisfiability problem belongs to the class NP. Proof : Provide a polynomial time algorithm that can verify CIRCUIT-SAT.
Lemma 36.6 The circuit satisfiability is NP-hard. Proof : Provide a polynomial time algorithm computing a reduction function f that maps every binary string x to a circuit C = f(x) such that x L if and only if C CIRCUIT-SAT.
L NP, A exists that verifies L in polynomial time. The algorithm F that we shall construct will use the two input algorithm A to compute the reduction function f. Running time of A : T(n) = O(nk) input string length n, certificate length O(nk)
Basic idea of proof Represent the computation A as a sequence of configurations and M is a combinational circuit that implement the mapping of one configuration to another. Configuration : the program, the program counter, working storage, machine states.
c0 Program A PC machine state x y memory M input c1 Program A PC machine state x y memory M . . . cT(n) Program A PC machine state x y memory 0/1 output
Ci --M--> C i+1 If A run at most T(n) steps the output appears in C T(n) Construct M that computes all configurations. F : given x computes C = f(x) that is satisfiable iff there exists a certificate y such that A(x,y) = 1. when F obtains x , it first computes n = |x| and construct C’ consists of T(n) copies of M.
Proof • F correctly computes f. C is satisfiable iff there exists y such that A(x,y) = 1. • F runs in polynomial time. • Part 1 if part • Suppose there exists y, length O(nk) such that A(x,y) = 1. Apply y to the input of C, the output of C is C(y) = A(x,y) = 1. Thus if a certificate exists then C is satisfiable.
Part 1 only if Suppose C is satisfiable, hence there exists an input y to C such that C(y) = 1, from which we conclude that A(x,y) =1 . Part 2 (A runs in polynomial time) The number of bits required to represent a configuration is polynomial in n (n = |x|). Program A has constant size
The length of input x is n The length of the certificate y is O(nk) The algorithm runs at most O(nk) steps, the amount of working storage required by A is polynomial of n. The length of a configuration is polynomial in O(nk) M has the size polynomial in the length of a configuration, hence is polynomial in n.
The circuit C consists of at most t = O(nk) copies of M, hence it has size in polynomial of n. The construction of C from x can be accomplished in polynomial time by the reduction algorithm F, since each step of construction takes polynomial time. Theorem 36.7 The circuit-satisfiability problem is NP-complete