Karp reductions – Definition
description
Transcript of Karp reductions – Definition
1
Karp reductions –DefinitionSIP 250, AB 42
A is polynomial-time reducible to B(denote ApB)
If there exists
a
poly-time-computable
function f:**
s.t. for every
wwA f(w)B
2
Karp Reductions –Ilustrated
*
A
* - A
f
* - B
B
*
F(A)
F(*-A)
3
Don’t Panic
Come up with a reduction-function f
Show f is polynomial time computable
• wA f(w)B• wA f(w)B
Prove f is a reduction, i.e., show: !
Reducing
4
Reductions and Efficiency
Polynomial-time algorithm for A
f Polynomial-time algorithm for BW f(W
)
f(w)B
wA
f(w)B
wA
• A directed graph G=(V,E)
Hamiltonian Path Instance:
• Is there a path in G, which goes through every vertex exactly once?
Decision Problem:
5
• a directed graph G=(V,E).
Hamiltonian Cycle Instance:
• Is there a simple cycle in G that paths through each vertex exactly once?
Decision Problem:
6
G p
G
uVEuVEVf ,,HAMPATH p HAMCYCLE
• Given a Hamiltonian path (v0,…,vn) in G, (v0,…,vn,u) is a Hamiltonian cycle in G’
Completeness:
• Given a Hamiltonian cycle (v0,…,vn,u) in G’, removing u yields a Hamiltonian path.
Soundness:
7
u
8
Check list
Come up with a reduction-function f
Show f is polynomial time computable
• wHAMPATH f(w)HAMCYCLE • wHAMPATH f(w)HAMCYCLE
Prove f is a reduction, i.e., show:
?
A complexity class C is closed under poly-time reductions if:
• L is reducible to L’ and L’C L is also in C.
9
Closeness Under Reductions: Definition
L ≤p L’
C
C
10
Observation
• P, PSPACE and EXPTIME are closed under polynomial-time Karp reductions
Theorem:
• Do it yourself !!Proof:
11
Log-space ReductionsSIP 250, AB 88
A is log-space reducible to B(denote ALB)
If there exists
a
log-space-computable
function f:**
s.t. for every
wwA f(w)B
• L, P, PSPACE and EXPTIME are closed under log-space reductions.
Theorem:f is a log-space reduction of A to B
12
Oracle machines
• Assuming an efficient procedure that decides B, construct one for A.
Cook Reduction:
13
Cook reduction
14
Cook reduction: an example
Claim: L* PL
Let L be a languageL* = { x | x=x1..xk , xi L }
•Let E’=E1
•If E’= reject2
• choose (any) <u, v> in E’3
•If HAMPATH ( <V+{w, z}, E’+{<w,u>, <v,z>}> ) accept4
•E’ = E’ – {<u, v>}5
•Go to step 2615
Cook red. : HAMCYCLEHAMPATH.
• For a class C of decision problems and a language LC, L is C-complete if: L’C L’ is reducible to L.
Definition: C-complete
• L is complete for classes C, C’ C=C’Theorem:
• All languages in C and in C’ are reducible to L, which is in both. Since both are closed under reductions, they’re the same
Proof:
• Any LNPC, LP P=NPTheorem:
Completeness
Discussed types of reductions:• Cook vs. Karp reductions• Poly-time vs. log-space
Defined:• “completeness”
17
Summary