Cook-Levin Theorem - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

Cook-Levin Theorem

Description:

Cook-Levin Theorem Circuit Satisfiability A first NP-complete problem Reduction overview Example reduction – PowerPoint PPT presentation

Number of Views:99
Avg rating:3.0/5.0
Slides: 21
Provided by: EricT161
Learn more at: http://www.cse.msu.edu
Category:
Tags: cook | levin | theorem | vars

less

Transcript and Presenter's Notes

Title: Cook-Levin Theorem


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?

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 0s
    and 1s
  • Example input is an undirected graph
  • First specify the number of nodes in binary
  • Then use an adjacency matrix to represent edges

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

Circuit representing computation of A on x with
certificate C
R
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 usedV false / initialized to all false
    /
  • if i V goto 6
  • if (usedPi true) answer false else
    usedi true
  • if (!E(Pi,Pi1)) answer false
  • i
  • goto 1
  • if (usedPi true) answer false
  • return answer
  • Certificate A path which is a permutation of the
    V nodes in the graph

8
Configurations of HPV computation
  • What information should be recorded in a
    configuration of this program?
  • Current instruction (PC)
  • value of all variables
  • Input x
  • Certificate
  • bool HPV(graph G(V,E), path P)
  • int i 1
  • bool answer true
  • bool usedV false / initialized to all false
    /
  • if i V goto 6
  • if (usedPi true) answer false else
    usedi true
  • if (!E(Pi,Pi1)) answer false
  • i
  • goto 1
  • if (usedPi true) answer false
  • return answer
  • Certificate A path which is a permutation of the
    V nodes in the graph

9
One computation of HPV
PC
G(V,E)
Path
i
answer
used
  • bool HPV(graph G(V,E), path P)
  • int i 1
  • bool answer true
  • bool usedV false / initialized to all false
    /
  • if i V goto 6
  • if (usedPi true) answer false else
    usedi true
  • if (!E(Pi,Pi1)) answer false
  • i
  • goto 1
  • if (usedPi true) answer false
  • return answer
  • Certificate A path which is a permutation of the
    V nodes in the graph

Path P 1, 2, 3
10
One computation of HPV contd
PC
G(V,E)
Path
i
answer
used
  • bool HPV(graph G(V,E), path P)
  • int i 1
  • bool answer true
  • bool usedV false / initialized to all false
    /
  • if i V goto 6
  • if (usedPi true) answer false else
    usedi true
  • if (!E(Pi,Pi1)) answer false
  • i
  • goto 1
  • if (usedPi true) answer false
  • return answer
  • Certificate A path which is a permutation of the
    V nodes in the graph

Path P 1, 2, 3
11
Second computation of HPV
PC
G(V,E)
Path
i
answer
used
  • bool HPV(graph G(V,E), path P)
  • int i 1
  • bool answer true
  • bool usedV false / initialized to all false
    /
  • if i V goto 6
  • if (usedPi true) answer false else
    usedi true
  • if (!E(Pi,Pi1)) answer false
  • i
  • goto 1
  • if (usedPi true) answer false
  • return answer
  • Certificate A path which is a permutation of the
    V nodes in the graph

Path P 2, 3, 1
12
Second computation of HPV contd
PC
G(V,E)
Path
i
answer
used
  • bool HPV(graph G(V,E), path P)
  • int i 1
  • bool answer true
  • bool usedV false / initialized to all false
    /
  • if i V goto 6
  • if (usedPi true) answer false else
    usedi true
  • if (!E(Pi,Pi1)) answer false
  • i
  • goto 1
  • if (usedPi true) answer false
  • return answer
  • Certificate A path which is a permutation of the
    V nodes in the graph

Path P 2, 3, 1
13
Computation represented as a Boolean Circuit
  • bool HPV(graph G(V,E), path P)
  • int i 1
  • bool answer true
  • bool usedV false / initialized to all false
    /
  • if i V goto 6
  • if (usedPi true) answer false else
    usedi true
  • if (!E(Pi,Pi1)) answer false
  • i
  • goto 1
  • if (usedPi true) answer false
  • return answer
  • Certificate A path which is a permutation of the
    V nodes in the graph

1
1
1
0
1
0
1
0
1
0
1
0
0
1
1
0
1
1
1
1
0
0
1
1
1
1
Path P 2, 3, 1
14
Output of Circuit
  • bool HPV(graph G(V,E), path P)
  • int i 1
  • bool answer true
  • bool usedV false / initialized to all false
    /
  • if i V goto 6
  • if (usedPi true) answer false else
    usedi true
  • if (!E(Pi,Pi1)) answer false
  • i
  • goto 1
  • if (usedPi true) answer false
  • return answer
  • Certificate A path which is a permutation of the
    V nodes in the graph

GATES
GATES
GATES
GATES
1
1
1
0
1
0
1
0
1
0
1
0
0
1
1
0
1
1
1
1
0
0
1
1
1
1
Path P 2, 3, 1
15
Constant Input Gates
  • bool HPV(graph G(V,E), path P)
  • int i 1
  • bool answer true
  • bool usedV false / initialized to all false
    /
  • if i V goto 6
  • if (usedPi true) answer false else
    usedi true
  • if (!E(Pi,Pi1)) answer false
  • i
  • goto 1
  • if (usedPi true) answer false
  • return answer
  • Certificate A path which is a permutation of the
    V nodes in the graph

1
0
1
1
0
1
GATES
GATES
GATES
GATES
1
1
1
0
1
0
1
0
1
0
1
0
0
1
1
0
1
1
1
1
0
0
1
1
1
1
Path P 2, 3, 1
16
Variable Input Gates
  • bool HPV(graph G(V,E), path P)
  • int i 1
  • bool answer true
  • bool usedV false / initialized to all false
    /
  • if i V goto 6
  • if (usedPi true) answer false else
    usedi true
  • if (!E(Pi,Pi1)) answer false
  • i
  • goto 1
  • if (usedPi true) answer false
  • return answer
  • Certificate A path which is a permutation of the
    V nodes in the graph

GATES
GATES
GATES
GATES
1
1
1
0
1
0
1
0
1
0
1
0
?
?
?
?
?
?
1
1
0
0
1
1
1
1
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.

GATES
GATES
1
1
1
0
1
0
1
0
1
0
1
0
?
?
?
?
?
?
1
1
1
1
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

GATES
GATES
1
1
1
0
1
0
1
0
1
0
1
0
?
?
?
?
?
?
1
1
1
1
19
Different sized inputs
  • There is a minor issue with size
  • The number of columns does change depending on
    the size of the input

20
General Case
Cert.
PC
Input
Vars
  • 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.

GATES
Based on Verification Algorithm
GATES
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
0
1
0
1
0
?
?
?
?
?
?
1
1
Write a Comment
User Comments (0)
About PowerShow.com