Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our...
-
Upload
perry-eldridge -
Category
Documents
-
view
217 -
download
2
Transcript of Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our...
![Page 1: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/1.jpg)
Complexity©D.Moshkovitz
1
Reductions
![Page 2: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/2.jpg)
Complexity©D.Moshkovitz
2
Motivation
• Reductions are our main tool for comparison between problems.
![Page 3: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/3.jpg)
Complexity©D.Moshkovitz
3
Introduction
• Objectives:– To formalize the notion of “reductions”.
• Overview:– Karp reductions
– HAMPATH p HAMCYCLE
– Closeness under reductions– Cook reductions– Completeness
![Page 4: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/4.jpg)
Complexity©D.Moshkovitz
4
Reductions – Concept
A p B
IF problem A can be efficiently translated to problem B…
THEN B is at least as hard as A.
![Page 5: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/5.jpg)
Complexity©D.Moshkovitz
5
Definition: Language A is polynomial time reducible to language B if…
a polynomial time computable function f:** exists,
where for every w,wA f(w)B
Reductions – Formal Definition
SIP 250
I.e – there exists a polynomial time TM which halts with f(w) on its tape when given input
w.
f is referred to as a polynomial-time reduction of A to B.
Denote Ap B
![Page 6: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/6.jpg)
Complexity©D.Moshkovitz
6
Reductions and Algorithms
*
A
* - A
f
*
B
* - B
![Page 7: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/7.jpg)
Complexity©D.Moshkovitz
7
Reductions and Algorithms
f
polynomial time algorithm for A
polynomial time algorithm for B
wf(w)B
?f(w) wA
?
![Page 8: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/8.jpg)
Complexity©D.Moshkovitz
8
How to Reduce?
1. Construct f.2. Show f is polynomial time
computable.3. Prove f is a reduction, i.e
show:1. If wA then f(w)B2. If f(w)B then wA
![Page 9: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/9.jpg)
Complexity©D.Moshkovitz
9
Terminology
• The type of reductions we’ve just described is also called:– Polynomial-time mapping reduction– Polynomial-time many-one reduction– Polynomial-time Karp reduction
• We’ll always refer to such reductions unless otherwise specified.
![Page 10: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/10.jpg)
Complexity©D.Moshkovitz
10
Example
• To demonstrate a reduction, we’ll revisit the example we gave in the introduction.
• We’ll rephrase and formalize the seating and tour problems
• And demonstrate a slightly different reduction between them.
![Page 11: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/11.jpg)
Complexity©D.Moshkovitz
11
Hamiltonian Path
Instance: a directed graph G=(V,E) and two vertices stV.
Problem: To decide if there exists a path from s to t, which goes through each node once.
In the version presented in the introduction we asked for some path, without specifying the start and end
vertices.
![Page 12: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/12.jpg)
Complexity©D.Moshkovitz
12
Hamiltonian Cycle
Instance: a directed graph G=(V,E).Problem: To decide if there exists a simple
cycle in the graph which goes through each node exactly once.
![Page 13: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/13.jpg)
Complexity©D.Moshkovitz
13
f( <G=(V,E),s,t> ) = <G’=(V{u},E{(u,s),(t,u)})>f( <G=(V,E),s,t> ) = <G’=(V{u},E{(u,s),(t,u)})>
HAMPATH p HAMCYCLE
p
f( <G=(V,E),s,t> ) = <G’=(V{u},E{(u,s),(t,u)})>f( <G=(V,E),s,t> ) = <G’=(V{u},E{(u,s),(t,u)})>
s
t
s
t
n
![Page 14: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/14.jpg)
Complexity©D.Moshkovitz
14
Correctness
• (Completeness) If there exists a Hamiltonian path (v0=s,v1,…,vn=t) in the original graph, then (u,v0=s,v1,…,vn=t,u) is a Hamiltonian cycle in the new graph.
![Page 15: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/15.jpg)
Complexity©D.Moshkovitz
15
Correctness
• (Soundness) (u,s) and (t,u) must be in any Hamiltonian cycle in the constructed graph, thus removing u yields a Hamiltonian path from s to t.
![Page 16: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/16.jpg)
Complexity©D.Moshkovitz
16
How to Reduce?
1. Construct f.2. Show f is polynomial time
computable.3. Prove f is a reduction, i.e show:
1. If wHAMPATH then f(w)HAMCYCLE
2. If f(w)HAMCYCLE then wHAMPATH
easy to
verify
![Page 17: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/17.jpg)
Complexity©D.Moshkovitz
17
Closeness Under Reductions
Definition: A complexity class C is closed under reductions if, whenever L is reducible to L’ and L’C, then L is also in C.
L
L’ C
![Page 18: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/18.jpg)
Complexity©D.Moshkovitz
18
Observation
Theorem: P, NP, PSPACE and EXPTIME are closed under polynomial-time Karp reductions.
Proof: Filling in the exact details is left to the reader. (See sketch)
![Page 19: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/19.jpg)
Complexity©D.Moshkovitz
21
Other Types of Reductions
• Cook Reduction: Use an efficient “black box” (procedure) that decides B, to construct a polynomial-time machine which decides A.
polynomial time algorithm
for A
polynomial time algorithm for B
![Page 20: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/20.jpg)
Complexity©D.Moshkovitz
22
Cook reduction of HAMCYCLE to HAMPATH.
• For each edge (u,v)E,– if there’s a Hamiltonian path from v to
u in the graph where (u,v) is removed, output ‘YES’, exit
• Output ‘NO’HAMPATH oracleMake
sure it’s efficient!
![Page 21: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/21.jpg)
Complexity©D.Moshkovitz
23
How do Cook and Karp Reductions Differ?
• Cook reductions allow us to call the procedure many times (instead of 1).
• When Karp reducing, we must output the answer of the procedure.
![Page 22: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/22.jpg)
Complexity©D.Moshkovitz
24
On the Relation Between Cook and Karp Reductions• Observation: Karp reductions are
special cases of Cook reductions.
![Page 23: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/23.jpg)
Complexity©D.Moshkovitz
25
Food for Thought…
• Which complexity classes are closed under Cook reductions?
![Page 24: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/24.jpg)
Complexity©D.Moshkovitz
26
Completeness
Definition: Let C be a complexity class and let L be a language. We say L is C-Complete if:
1. L is in C2. For every language AC, A is
reducible to L.
![Page 25: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/25.jpg)
Complexity©D.Moshkovitz
27
C-Complete Languages
C
C-Complete
hardness
![Page 26: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/26.jpg)
Complexity©D.Moshkovitz
28
Observation
Theorem: If two classes C and C’ are both closed under reductions (of some specific type) and there is a language L which is complete for both C and C’, then C=C’.
Proof: W.l.o.g we’ll only show CC’. All languages in C are reducible to L. Since C’ is closed under reductions, it follows that CC’.
![Page 27: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/27.jpg)
Complexity©D.Moshkovitz
29
Corollary
If any NP-Complete problem is in P, then P=NP.
![Page 28: Complexity ©D.Moshkovitz 1 Reductions. Complexity ©D.Moshkovitz 2 Motivation Reductions are our main tool for comparison between problems.](https://reader035.fdocuments.us/reader035/viewer/2022062511/551633a4550346b2068b4dc1/html5/thumbnails/28.jpg)
Complexity©D.Moshkovitz
30
Summary
• In this lecture we’ve introduced many types of reductions:– Cook/Karp reductions– Polynomial-time reductions
• We’ve defined the notion of completeness
• And seen how it can help us prove equality of complexity classes.
• Nevertheless, we are still not convinced complete languages even exist.