fun with reductions

34
Yu Cheng Dec 5, 2017 Fun with Reductions

Upload: others

Post on 23-May-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Fun with Reductions

Yu ChengDec 5, 2017

Fun with Reductions

Page 2: Fun with Reductions

Outline

Show• Vertex 3-Coloring

• Hamiltonian Cycle

• Super Mario

are NP-Hard.

Dec5,2017 YuCheng

Page 3: Fun with Reductions

Recap

• P vs NP

• (Polynomial-time) Reductions

• 3-Satisfiability (3SAT)

Dec5,2017 YuCheng

Page 4: Fun with Reductions

“Easy to verify” problems: NP

• All decision problems such that we can verify the correctness of a solution in polynomial time.

ProverVerifier:OK,thatisindeed asolution.

input

Page 5: Fun with Reductions

Polynomial time reductions

• Reduce A to B: a polynomial time algorithm that mapsinstances of A to instances of problem B, such that the answers are the same.

• 𝐴 ≤# 𝐵: B is at least as hard as A.

If you can solve B (in poly time) then you can solve A.

Areduction

B

Page 6: Fun with Reductions

3-Satisfiability (3SAT)

Page 7: Fun with Reductions

Gadget-Based Reductions

𝐴 ≤# 𝐵:

Given instances of A, output instances of B.Build gadgets for pieces of A.Put the pieces together.

3SAT ≤# 𝑋

Page 8: Fun with Reductions

Fun with Hardness Proofs

Algorithmic Lower Bounds: Fun with Hardness Proofs

Erik Demaine

http://courses.csail.mit.edu/6.890/fall14/lectures/

Dec5,2017 YuCheng

Page 9: Fun with Reductions

Outline

Show• Vertex 3-Coloring

• Hamiltonian Cycle

• Super Mario

are NP-Hard.

Dec5,2017 YuCheng

Page 10: Fun with Reductions

Vertex 3-Coloring

Input: a graph

Output: color each vertex using 1 of the 3 colors, sothat adjacent vertices do not get the same color.

Dec5,2017 YuCheng

Page 11: Fun with Reductions

3-Coloring:

Dec5,2017 YuCheng

Page 12: Fun with Reductions

3-Coloring: Yes instance

Dec5,2017 YuCheng

Page 13: Fun with Reductions

3-Coloring: No instance

Dec5,2017 YuCheng

Page 14: Fun with Reductions

3SAT ≤# 3-Coloring

Satisfiable formula ⟺

Unsatisfiable formula ⟺

Dec5,2017 YuCheng

Page 15: Fun with Reductions

Dec5,2017 YuCheng

Page 16: Fun with Reductions

Dec5,2017 YuCheng

Page 17: Fun with Reductions

Dec5,2017 YuCheng

Page 18: Fun with Reductions

Dec5,2017 YuCheng

Page 19: Fun with Reductions

3SAT ≤# 3-Coloring

•Consequence:3-Coloring is NP-Complete.(Because 3-Coloring is also in NP.)

Dec5,2017 YuCheng

Page 20: Fun with Reductions

Outline

Show• Vertex 3-Coloring

• Hamiltonian Cycle

• Super Mario

are NP-Hard.

Dec5,2017 YuCheng

Page 21: Fun with Reductions

Hamiltonian Cycle

Dec5,2017 YuCheng

Page 22: Fun with Reductions

Hamiltonian Cycle

Dec5,2017 YuCheng

• Input: a (directed) graph.

• Solution: a cycle visiting every vertex exactly once.

Page 23: Fun with Reductions

Variable Gadget

Dec5,2017 YuCheng

Page 24: Fun with Reductions

Clause Gadget

Dec5,2017 YuCheng

Page 25: Fun with Reductions

3SAT ≤# Hamiltonian Cycle

Dec5,2017 YuCheng

Page 26: Fun with Reductions

Dec5,2017 YuCheng

Page 27: Fun with Reductions

Dec5,2017 YuCheng

Page 28: Fun with Reductions

3SAT ≤# Hamiltonian Path

Dec5,2017 YuCheng

3SAT ≤# Hamiltonian Cycle

?

Page 29: Fun with Reductions

Dec5,2017 YuCheng

Page 30: Fun with Reductions

Outline

Show• Vertex 3-Coloring

• Hamiltonian Cycle

• Super Mario

are NP-Hard.

Dec5,2017 YuCheng

Page 31: Fun with Reductions
Page 32: Fun with Reductions
Page 33: Fun with Reductions
Page 34: Fun with Reductions