Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cook-Levin Theorem Circuit Satisfiability –A “first” NP-complete problem Reduction overview Example reduction.

Similar presentations


Presentation on theme: "Cook-Levin Theorem Circuit Satisfiability –A “first” NP-complete problem Reduction overview Example reduction."— Presentation transcript:

1 Cook-Levin Theorem Circuit Satisfiability –A “first” NP-complete problem Reduction overview Example reduction

2 Circuit Satisfiability 5 types of gates –Constant (T/F) –And –Or –Not –Variable Input size is total number of gates One output Question –Is there an assignment of truth values to the variable gates that causes the output of the circuit to be true? G5G5 G8G8 G6G6 G 10 G9G9 G7G7 X1X1 X2X2 X3X3 T

3 Reduction Overview We need to develop a reduction that can be applied to ANY problem in NP This leads to two key issues –How do we represent the input for an arbitrary problem in NP? –What do we know about an arbitrary problem in NP?

4 Encoding Inputs We assume the input is encoded as a string of 0’s and 1’s Example: input is an undirected graph –First specify the number of nodes in binary –Then use an adjacency matrix to represent edges 1 2 3 01010101011

5 Arbitrary problem in NP If Π belongs to NP, then there exists a verification algorithm A along with a set of certificates C Given any input x to Π, we construct a circuit to simulate the computation of A on x with the certificate C represented as variable gates R Circuit representing computation of A on x with certificate C 01010101011 Input x

6 Example We will show an example with the Hamiltonian Path Problem Key concept –Representation of computation of A on x as a sequence of configurations –Configuration: With a configuration and the code for A, you should be able to complete the computation of A on x

7 Verification algorithm, certificate for HP bool HPV(graph G=(V,E), path P) { int i = 1; bool answer = true; bool used[V] = false; /* initialized to all false */ 1.if i = V goto 6; 2.if (used[P[i]] = = true) answer = false; else used[i] = true; 3.if (!E(P[i],P[i+1])) answer = false; 4.i++; 5.goto 1; 6.if (used[P[i]] = = true) answer = false; 7.return answer; } Certificate: A path which is a permutation of the V nodes in the graph

8 Configurations of HPV computation bool HPV(graph G=(V,E), path P) { int i = 1; bool answer = true; bool used[V] = false; /* initialized to all false */ 1.if i = V goto 6; 2.if (used[P[i]] = = true) answer = false; else used[i] = true; 3.if (!E(P[i],P[i+1])) answer = false; 4.i++; 5.goto 1; 6.if (used[P[i]] = = true) answer = false; 7.return answer; } Certificate: A path which is a permutation of the V nodes in the graph 1 2 3 01010101011 What information should be recorded in a configuration of this program? Current instruction (PC) value of all variables Input x Certificate PCG=(V,E)Pathianswerused Configuration Description

9 One computation of HPV bool HPV(graph G=(V,E), path P) { int i = 1; bool answer = true; bool used[V] = false; /* initialized to all false */ 1.if i = V goto 6; 2.if (used[P[i]] = = true) answer = false; else used[i] = true; 3.if (!E(P[i],P[i+1])) answer = false; 4.i++; 5.goto 1; 6.if (used[P[i]] = = true) answer = false; 7.return answer; } Certificate: A path which is a permutation of the V nodes in the graph 1 2 3 0101010101100101010101001101101100011 PCG=(V,E)Pathianswerused Path P = 1, 2, 3 01001010101001101101100011011010101010011011011100111000101010100110110111001110101010101001101110110011001010101010011011101100110110101010100110111011101101001010101001101110110011

10 One computation of HPV cont’d bool HPV(graph G=(V,E), path P) { int i = 1; bool answer = true; bool used[V] = false; /* initialized to all false */ 1.if i = V goto 6; 2.if (used[P[i]] = = true) answer = false; else used[i] = true; 3.if (!E(P[i],P[i+1])) answer = false; 4.i++; 5.goto 1; 6.if (used[P[i]] = = true) answer = false; 7.return answer; } Certificate: A path which is a permutation of the V nodes in the graph 1 2 3 01010101011 PCG=(V,E)Pathianswerused Path P = 1, 2, 3 100010101010011011101110111010101010100110111111101101101010101001101110111011001010101010011011111110111100101010100110111111101111101010101001101111111011

11 Second computation of HPV bool HPV(graph G=(V,E), path P) { int i = 1; bool answer = true; bool used[V] = false; /* initialized to all false */ 1.if i = V goto 6; 2.if (used[P[i]] = = true) answer = false; else used[i] = true; 3.if (!E(P[i],P[i+1])) answer = false; 4.i++; 5.goto 1; 6.if (used[P[i]] = = true) answer = false; 7.return answer; } Certificate: A path which is a permutation of the V nodes in the graph 1 2 3 0101010101100101010101010110101100011 PCG=(V,E)Pathianswerused Path P = 2, 3, 1 01001010101010110101100011011010101010101101011010111000101010101011010110101110101010101010110110101011001010101010101101101010110110101010101011011010111101001010101010110110101011

12 Second computation of HPV cont’d bool HPV(graph G=(V,E), path P) { int i = 1; bool answer = true; bool used[V] = false; /* initialized to all false */ 1.if i = V goto 6; 2.if (used[P[i]] = = true) answer = false; else used[i] = true; 3.if (!E(P[i],P[i+1])) answer = false; 4.i++; 5.goto 1; 6.if (used[P[i]] = = true) answer = false; 7.return answer; } Certificate: A path which is a permutation of the V nodes in the graph 1 2 3 01010101011 PCG=(V,E)Pathianswerused Path P = 2, 3, 1 100010101010011011100011111010101010100110111100111101101010101010110110101111001010101010011011110011111100101010100110111100111111101010101001101111001111

13 Computation represented as a Boolean Circuit bool HPV(graph G=(V,E), path P) { int i = 1; bool answer = true; bool used[V] = false; /* initialized to all false */ 1.if i = V goto 6; 2.if (used[P[i]] = = true) answer = false; else used[i] = true; 3.if (!E(P[i],P[i+1])) answer = false; 4.i++; 5.goto 1; 6.if (used[P[i]] = = true) answer = false; 7.return answer; } Certificate: A path which is a permutation of the V nodes in the graph 1 2 3 0101010101100101010101010110101100011 Path P = 2, 3, 1 0100101010101011010110001101101010101010110101101011 GATES 11101010101001101111001111

14 Output of Circuit bool HPV(graph G=(V,E), path P) { int i = 1; bool answer = true; bool used[V] = false; /* initialized to all false */ 1.if i = V goto 6; 2.if (used[P[i]] = = true) answer = false; else used[i] = true; 3.if (!E(P[i],P[i+1])) answer = false; 4.i++; 5.goto 1; 6.if (used[P[i]] = = true) answer = false; 7.return answer; } Certificate: A path which is a permutation of the V nodes in the graph 1 2 3 0101010101100101010101010110101100011 Path P = 2, 3, 1 01001010101010110101100011 GATES 01101010101010110101101011 11101010101001101111001111

15 Constant Input Gates bool HPV(graph G=(V,E), path P) { int i = 1; bool answer = true; bool used[V] = false; /* initialized to all false */ 1.if i = V goto 6; 2.if (used[P[i]] = = true) answer = false; else used[i] = true; 3.if (!E(P[i],P[i+1])) answer = false; 4.i++; 5.goto 1; 6.if (used[P[i]] = = true) answer = false; 7.return answer; } Certificate: A path which is a permutation of the V nodes in the graph 1 2 3 01010101011 101101 01100000101010101011 Path P = 2, 3, 1 01001010101010110101100011 GATES 01101010101010110101101011 11101010101001101111001111

16 Variable Input Gates bool HPV(graph G=(V,E), path P) { int i = 1; bool answer = true; bool used[V] = false; /* initialized to all false */ 1.if i = V goto 6; 2.if (used[P[i]] = = true) answer = false; else used[i] = true; 3.if (!E(P[i],P[i+1])) answer = false; 4.i++; 5.goto 1; 6.if (used[P[i]] = = true) answer = false; 7.return answer; } Certificate: A path which is a permutation of the V nodes in the graph 1 2 3 01010101011??????01100000101010101011010010101010??????01100011 GATES 011010101010??????01101011 111010101010??????11001111

17 Answer-Preserving Nature The HP input below has an HP if and only if there exists an assignment of PATH variables in red such that the CIRCUIT will output 1. ??????01100000101010101011 GATES 111010101010??????1111 1 2 3 01010101011

18 Polynomial Time The number of “rows” is polynomial in the input size since A is assumed to be a polynomial time verification algorithm The number of columns is polynomial in the input size since the certificate must have polynomial size and the variables used must be polynomial in number GATES is essentially constant- sized as GATES is essentially independent of the input; GATES depends mostly on the verification algorithm ??????01100000101010101011 GATES 111010101010??????1111 01010101011 1 2 3

19 Different sized inputs There is a minor issue with size The number of columns does change depending on the size of the input ??????0110000010101010101101010101011 1 2 3 ??????0110000010111011101101110111011 1 2 3 ??????011000001 01010101000 1 2 3 4 10100100 ??000101010100010100100

20 General Case In the general case, the input represented as a string of bits is transformed in an answer-preserving fashion into a polynomial-sized Boolean circuit. ??????00101010101011 GATES 010101010??????11 01010101011 PCInput Cert. Vars Based on Verification Algorithm


Download ppt "Cook-Levin Theorem Circuit Satisfiability –A “first” NP-complete problem Reduction overview Example reduction."

Similar presentations


Ads by Google