 # 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.

## Presentation on theme: "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."— Presentation transcript:

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

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

P = NP  co-NP ? Any language in NP  co-NP - NP ? P = NP = co-NP NP = co-NP P co-NP NP P = NP  co-NP co-NP NP NP  co-NP P 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’. L 1 is polynomial time reducible to L 2, L 1  p L 2, if there exists a polynomial time computable function f: {0,1}*  {0,1}* such that  x  {0,1}* ; x  L 1 iff f(x)  L 2. f is called reduction function

FA2 A1 x f(x) f(x)  L2 ? x  L1 ? Lemma 36.3 If L 1, L 2  {0,1}* are languages such that L 1  p L 2, then L 2  P implies L 1  P.

NP-completeness A language L  {0,1}* is NP-complete if 1.L  NP and 2.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 is a satisfiable boolean combinational circuit } k inputs, 2 k 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(n k ) input string length n, certificate length O(n k )

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.

Program A PC machine state x y memory M c1 Program A PC machine state x y memory M c0 Program A PC machine state x y memory cT(n)... input 0/1 output

C i --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 1.F correctly computes f. C is satisfiable iff there exists y such that A(x,y) = 1. 2.F runs in polynomial time. Part 1 if part Suppose there exists y, length O(n k ) 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(n k ) The algorithm runs at most O(n k ) steps, the amount of working storage required by A is polynomial of n. The length of a configuration is polynomial in O(n k ) 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(n k ) 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

Download ppt "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."

Similar presentations