funwithreductions - homepages.math.uic.edu

37
Yu Cheng Dec 1, 2021 Fun with Reductions

Upload: others

Post on 23-May-2022

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: FunwithReductions - homepages.math.uic.edu

Yu ChengDec 1, 2021

Fun with Reductions

Page 2: FunwithReductions - homepages.math.uic.edu

Outline

Show• Vertex 3-Coloring

• Hamiltonian Cycle

• Super Mario

• Minesweeper

are NP-Hard.

Dec 1, 2021 Yu Cheng

Page 3: FunwithReductions - homepages.math.uic.edu

Recap

• P vs NP• (Polynomial-time) Reductions• 3-Satisfiability (3SAT)

Dec 1, 2021 Yu Cheng

Page 4: FunwithReductions - homepages.math.uic.edu

“Easy to verify” problems: NP

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

ProverVerifier: OK, that is indeed a solution.

input

Dec 1, 2021 Yu Cheng

Page 5: FunwithReductions - homepages.math.uic.edu

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

Dec 1, 2021 Yu Cheng

Page 6: FunwithReductions - homepages.math.uic.edu

3-Satisfiability (3SAT)

Dec 1, 2021 Yu Cheng

Page 7: FunwithReductions - homepages.math.uic.edu

Gadget-Based Reductions

𝐴 ≤! 𝐵:Given instances of A, output instances of B.Build gadgets for pieces of A.

Put the pieces together.

3SAT ≤! 𝑋Dec 1, 2021 Yu Cheng

Page 8: FunwithReductions - homepages.math.uic.edu

Fun with Hardness Proofs

Algorithmic Lower Bounds: Fun with Hardness Proofs

Erik Demaine

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

Dec 1, 2021 Yu Cheng

Page 9: FunwithReductions - homepages.math.uic.edu

Outline

Show• Vertex 3-Coloring

• Hamiltonian Cycle

• Super Mario

• Minesweeper

are NP-Hard.

Dec 1, 2021 Yu Cheng

Page 10: FunwithReductions - homepages.math.uic.edu

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.

Dec 1, 2021 Yu Cheng

Page 11: FunwithReductions - homepages.math.uic.edu

3-Coloring:

Dec 1, 2021 Yu Cheng

Page 12: FunwithReductions - homepages.math.uic.edu

3-Coloring: Yes instance

Dec 1, 2021 Yu Cheng

Page 13: FunwithReductions - homepages.math.uic.edu

3-Coloring: No instance

Dec 1, 2021 Yu Cheng

Page 14: FunwithReductions - homepages.math.uic.edu

3SAT ≤! 3-Coloring

Satisfiable formula ⟺

Unsatisfiable formula ⟺

Dec 1, 2021 Yu Cheng

Page 15: FunwithReductions - homepages.math.uic.edu

Dec 1, 2021 Yu Cheng

Page 16: FunwithReductions - homepages.math.uic.edu

Dec 1, 2021 Yu Cheng

Page 17: FunwithReductions - homepages.math.uic.edu

Dec 1, 2021 Yu Cheng

Page 18: FunwithReductions - homepages.math.uic.edu

Dec 1, 2021 Yu Cheng

Page 19: FunwithReductions - homepages.math.uic.edu

3SAT ≤! 3-Coloring

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

Dec 1, 2021 Yu Cheng

Page 20: FunwithReductions - homepages.math.uic.edu

Outline

Show• Vertex 3-Coloring

• Hamiltonian Cycle

• Super Mario

• Minesweeper

are NP-Hard.

Dec 1, 2021 Yu Cheng

Page 21: FunwithReductions - homepages.math.uic.edu

Hamiltonian Cycle

Dec 1, 2021 Yu Cheng

Page 22: FunwithReductions - homepages.math.uic.edu

Hamiltonian Cycle

Dec 1, 2021 Yu Cheng

• Input: a (directed) graph.

• Solution: a cycle visiting every vertex exactly once.

Page 23: FunwithReductions - homepages.math.uic.edu

Variable Gadget

Dec 1, 2021 Yu Cheng

Page 24: FunwithReductions - homepages.math.uic.edu

Clause Gadget

Dec 1, 2021 Yu Cheng

Page 25: FunwithReductions - homepages.math.uic.edu

3SAT ≤! Hamiltonian Cycle

Dec 1, 2021 Yu Cheng

Page 26: FunwithReductions - homepages.math.uic.edu

Dec 1, 2021 Yu Cheng

Page 27: FunwithReductions - homepages.math.uic.edu

Dec 1, 2021 Yu Cheng

Page 28: FunwithReductions - homepages.math.uic.edu

3SAT ≤! Hamiltonian Path

Dec 1, 2021 Yu Cheng

3SAT ≤! Hamiltonian Cycle

?

Page 29: FunwithReductions - homepages.math.uic.edu

Dec 1, 2021 Yu Cheng

Page 30: FunwithReductions - homepages.math.uic.edu

Outline

Show• Vertex 3-Coloring

• Hamiltonian Cycle

• Super Mario

• Minesweeper

are NP-Hard.

Dec 1, 2021 Yu Cheng

Page 31: FunwithReductions - homepages.math.uic.edu

Dec 1, 2021 Yu Cheng

Page 32: FunwithReductions - homepages.math.uic.edu

Dec 1, 2021 Yu Cheng

Page 33: FunwithReductions - homepages.math.uic.edu

Dec 1, 2021 Yu Cheng

Page 34: FunwithReductions - homepages.math.uic.edu

Outline

Show• Vertex 3-Coloring

• Hamiltonian Cycle

• Super Mario

• Minesweeper

are NP-Hard.

Dec 1, 2021 Yu Cheng

Page 35: FunwithReductions - homepages.math.uic.edu

Gadgets

Dec 1, 2021 Yu Cheng

Variables:

NOT gate:

Page 36: FunwithReductions - homepages.math.uic.edu

Gadgets

Dec 1, 2021 Yu Cheng

Page 37: FunwithReductions - homepages.math.uic.edu

Gadgets

Dec 1, 2021 Yu Cheng