Скачать презентацию Complexity class NP Is the class of languages Скачать презентацию Complexity class NP Is the class of languages

9438d524a036dff234d5716bac887898.ppt

  • Количество слайдов: 20

Complexity class NP Is the class of languages that can be verified by a 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 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 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 ? NP P = NP co-NP ? Any language in NP co-NP - NP ? NP = co-NP P = NP = co-NP P = NP co-NP P NP Four possible relationships between complexity classes

NP-Complete problems If NP - P is nonempty, HAM-CYCLE NP - P NP-Complete languages 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 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}* such that x {0, 1}* ; x L 1 iff f(x) L 2. f is called reduction function

x f(x) F A 2 f(x) L 2 ? x L 1 ? A x f(x) F A 2 f(x) L 2 ? x L 1 ? A 1 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. NP-completeness A language L {0, 1}* is NP-complete if 1. L NP and 2. L’ p L for every L’ NP 3. If 2 but not 1 L is NP-hard

Theorem 36. 4 If any NP-complete problem is polynomial time solvable, then P = 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 Circuit satisfiability A truth assignment for a boolean combinational circuit is a set of boolean input values. A oneoutput 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 : 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 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 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) length n, certificate length O(nk) input string

Basic idea of proof Represent the computation A as a sequence of configurations and 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.

input c 0 Program A PC machine state x y memory M c 1 input c 0 Program A PC machine state x y memory M c 1 Program A PC machine state x M. . . c. T(n) Program A PC machine state x y 0/1 output memory

Ci --M--> C i+1 If A run at most T(n) steps the output appears 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 1. F correctly computes f. C is satisfiable iff there exists y such 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. 3. 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 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 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 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