funwithreductions - homepages.math.uic.edu
TRANSCRIPT
![Page 1: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/1.jpg)
Yu ChengDec 1, 2021
Fun with Reductions
![Page 2: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/2.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/3.jpg)
Recap
• P vs NP• (Polynomial-time) Reductions• 3-Satisfiability (3SAT)
Dec 1, 2021 Yu Cheng
![Page 4: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/4.jpg)
“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](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/5.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/6.jpg)
3-Satisfiability (3SAT)
Dec 1, 2021 Yu Cheng
![Page 7: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/7.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/8.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/9.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/10.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/11.jpg)
3-Coloring:
Dec 1, 2021 Yu Cheng
![Page 12: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/12.jpg)
3-Coloring: Yes instance
Dec 1, 2021 Yu Cheng
![Page 13: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/13.jpg)
3-Coloring: No instance
Dec 1, 2021 Yu Cheng
![Page 14: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/14.jpg)
3SAT ≤! 3-Coloring
Satisfiable formula ⟺
Unsatisfiable formula ⟺
Dec 1, 2021 Yu Cheng
![Page 15: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/15.jpg)
Dec 1, 2021 Yu Cheng
![Page 16: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/16.jpg)
Dec 1, 2021 Yu Cheng
![Page 17: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/17.jpg)
Dec 1, 2021 Yu Cheng
![Page 18: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/18.jpg)
Dec 1, 2021 Yu Cheng
![Page 19: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/19.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/20.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/21.jpg)
Hamiltonian Cycle
Dec 1, 2021 Yu Cheng
![Page 22: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/22.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/23.jpg)
Variable Gadget
Dec 1, 2021 Yu Cheng
![Page 24: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/24.jpg)
Clause Gadget
Dec 1, 2021 Yu Cheng
![Page 25: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/25.jpg)
3SAT ≤! Hamiltonian Cycle
Dec 1, 2021 Yu Cheng
![Page 26: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/26.jpg)
Dec 1, 2021 Yu Cheng
![Page 27: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/27.jpg)
Dec 1, 2021 Yu Cheng
![Page 28: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/28.jpg)
3SAT ≤! Hamiltonian Path
Dec 1, 2021 Yu Cheng
3SAT ≤! Hamiltonian Cycle
?
![Page 29: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/29.jpg)
Dec 1, 2021 Yu Cheng
![Page 30: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/30.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/31.jpg)
Dec 1, 2021 Yu Cheng
![Page 32: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/32.jpg)
Dec 1, 2021 Yu Cheng
![Page 33: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/33.jpg)
Dec 1, 2021 Yu Cheng
![Page 34: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/34.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/35.jpg)
Gadgets
Dec 1, 2021 Yu Cheng
Variables:
NOT gate:
![Page 36: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/36.jpg)
Gadgets
Dec 1, 2021 Yu Cheng
![Page 37: FunwithReductions - homepages.math.uic.edu](https://reader033.vdocument.in/reader033/viewer/2022052501/628b1ed939f6dd729a2548bc/html5/thumbnails/37.jpg)
Gadgets
Dec 1, 2021 Yu Cheng