Download - Reductions (Section 5.1)
![Page 1: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/1.jpg)
Reductions
(Section 5.1)
Héctor Muñoz-Avila
![Page 2: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/2.jpg)
Summary of Previous Lectures• The Halting problem is undecidable:
– HALT = {<M,w> | M is a Turing machine, w *, M halts on input w}
• The proof involved a paradox
![Page 3: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/3.jpg)
Proving that Other Problems are Undecidable
• We use the reductions method
– A is reduced into B (written: A ≤red B)– Implies: deciding B is at least as hard as as deciding A
• This method requires that we know at least one problem to be undecidable
• Reductions are also used to prove intractability– E.g., NP-completeness
![Page 4: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/4.jpg)
Intuition• A ≤red B if I can use a decider for B (assuming one exists)
to construct a decider for A• Implies: deciding B is at least as hard as as deciding A
![Page 5: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/5.jpg)
Intuition• A ≤red B if I can use a decider for B (assuming one exists)
to construct a decider for A• Implies: deciding B is at least as hard as as deciding A
• Example?
![Page 6: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/6.jpg)
Intuition• A ≤red B if I can use a decider for B (assuming one exists)
to construct a decider for A• Implies: deciding B is at least as hard as as deciding A
• Example 1: when we use software libraries to solve a problem A
SolutionA() {
}
Software library
solutionB1()
solutionB2()
solutionB3()
![Page 7: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/7.jpg)
Intuition• A ≤red B if I can use a decider for B (assuming one exists)
to construct a decider for A• Implies: deciding B is at least as hard as as deciding A
• Example 1: when we use software libraries to solve a problem A
SolutionA() {
… solutionB2()….}
Software library
solutionB1()
solutionB2()
solutionB3()
![Page 8: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/8.jpg)
Intuition• A ≤red B if I can use a decider for B (assuming one exists)
to construct a decider for A• Implies: deciding B is at least as hard as as deciding A
• Example 2: How to use a solution of B to solve A if:
– A = “find the largest number among an array of integers array[1..n]”
– B = “find the smallest number among an array of integers array[1..n]”
![Page 9: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/9.jpg)
Intuition• A ≤red B if I can use a decider for B (assuming one exists)
to construct a decider for A• Implies: deciding B is at least as hard as as deciding A
• Example 3: How to use a solution of B to solve A if:
– A = “find if there is a zero in an array of integers array[1..n]”
– B = “determine the product of all numbers in an array of integers array[1..n]” (e.g., if array[…] contains 2, 3, 7 then the result will be 42.
![Page 10: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/10.jpg)
Intuition• A ≤red B if I can use a decider for B (assuming one exists)
to construct a decider for A• Implies: deciding B is at least as hard as as deciding A
• Relations:• Assume A is undecidable, is B undecidable?• Assume A is decidable, is B decidable?• Assume B is decidable, is A decidable?• Assume B is undecidable, is A undecidable?
![Page 11: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/11.jpg)
Intuition• A ≤red B if I can use a decider for B (assuming one exists)
to construct a decider for A• Implies: deciding B is at least as hard as as deciding A
If B is decidableThen A is decidable
![Page 12: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/12.jpg)
Intuition• A ≤red B if I can use a decider for B (assuming one exists)
to construct a decider for A• Implies: deciding B is at least as hard as as deciding A
If B is decidableThen A is decidable If A is undecidable
Then B is undecidable
![Page 13: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/13.jpg)
Example: Dead-Code Problem• Given a program P, an input w for P, and a line of code i
in P, will P ever execute line I when running with input w?
![Page 14: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/14.jpg)
Example: Dead-Code Problem• Given a program P, an input w for P, and a line of code i
in P, will P ever execute line I when running with input w?
P(w){ if (w == 1) then println(“yes”) else printlin(“no”)}
![Page 15: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/15.jpg)
Example: Dead-Code Problem• Given a program P, an input w for P, and a line of code i
in P, will P ever execute line I when running with input w?
P(w){ Foo() if (w == 1) then println(“yes”) else printlin(“no”)}
Foo()
![Page 16: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/16.jpg)
Example: Dead-Code Problem• We are going to show HALT ≤red DEAD-Code
• Hence, DEAD-Code is undecidable
• Lets construct a decider MH for HALT assuming a decider MD for DEAD-Code is available
![Page 17: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/17.jpg)
Example: Do-Nothing Problem• Given a program P, will P reject every input w?
![Page 18: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/18.jpg)
Example: Do-Nothing Problem• Given a program P, will P reject every input w?
P(w){ return reject}
![Page 19: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/19.jpg)
Example: Do-Nothing Problem• Given a program P, will P reject every input w?
P(w){ Foo() return accept}
Foo()
![Page 20: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/20.jpg)
Example: Do-Nothing Problem• We are going to show HALT ≤red Do-Nothing
• Hence, Do-Nothing is undecidable
• Lets construct a decider MH for HALT assuming a decider MDN for Do-Nothing is available
![Page 21: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/21.jpg)
![Page 22: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/22.jpg)
Summary of the Previous Lecture (I)
• A ≤red B if I can use a decider for B (assuming one exists) to construct a decider for A• Implies: deciding B is at least as hard as as deciding A
If B is decidableThen A is decidable If A is undecidable
Then B is undecidable
![Page 23: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/23.jpg)
Summary of the Previous Lecture (II)
• A ≤red B if I can use a decider for B (assuming one exists) to construct a decider for A• Implies: deciding B is at least as hard as as deciding A
• We proved:• HALT ≤red DEAD-Code• HALT ≤red Do-Nothing
• Hence, DEAD-Code and Do-Nothing are undecidable
![Page 24: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/24.jpg)
Observations• HALT is recognizable
• Dead-Code is recognizable
• We can easily proof this
• Is there a problem that is not recognizable?
![Page 25: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/25.jpg)
Equivalence• Given two programs P, P’ are they equivalent?
– For every input w, P(w) = P(w’)
– For example, if P and P’ return either true or false then: For every input w, P(w) is true iff P(w’) is true
![Page 26: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/26.jpg)
Equivalence• Given two programs P, P’ are they equivalent?
– For every input w, P(w) = P’(w)• The following 2 programs receive as input an array of
integers (a[1..n] in the left and A[0..MAXDIN] in the right). Are they equivalent?
![Page 27: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/27.jpg)
Equivalence• Given two programs P, P’ are they equivalent?
– For every input w, P(w) = P(w’)
• So what you think is Equivalence decidable?
![Page 28: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/28.jpg)
Equivalence• Given two programs P, P’ are they equivalent?
– For every input w, P(w) = P(w’)
• We can prove that HALT ≤red Equivalence• Lets construct a decider MH for HALT assuming a
decider ME for Equivalence is available• Hence, Equivalence is not decidable• As it turns out Equivalence is not even recognizable
![Page 29: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/29.jpg)
HALT ≤red Equivalence
MH :- on input <M,w> Maux1 :- on input x 1. reject Maux2 :- on input x 1. Run M on input w 2. reject 1. Run ME on <Maux1,Maux2> 2. if accept then accept else reject
![Page 30: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/30.jpg)
![Page 31: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/31.jpg)
The AI Question
Héctor Muñoz-Avila
![Page 32: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/32.jpg)
Informally• Can we construct a machine that exhibits “human level”
intelligence?
![Page 33: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/33.jpg)
We Certainly Have Come a Long Way
• Many AI paradigms are constructed from our understanding of how humans think– E.g., case-based reasoning: recall past experiences– Neural networks: simulate connectionism of brain
cells
![Page 34: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/34.jpg)
34
Example of AI: The Case Base Reasoning Cycle
RETRIEVE
REUSE
SuggestedSolution
REVISE
ConfirmedSolution
RETAIN
previouscases
General Knowledge
NewCase
Problem
RetrievedCase New
Case
SolvedCase
Tested/RepairedCase
LearnedCase
Jerry’sKnowledge
DrivingCases
Allentown to NYC?
(Allentown, NYC)
(Allentown,Jersey City)(Allentown,
NYC)
(Allentown,Jersey City,
NYC)
(Allentown,most of the way to JC,using by pass highway,
NYC)
(Allentown,most of the way to JC,using bypass highway,
NYC)
Driving fromAllentown to NYC?
![Page 35: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/35.jpg)
We Certainly Have seen Impressive Examples of Machine’s Capabilities
![Page 36: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/36.jpg)
Impressive But…
• Could humans “solve” HALT?– E.g., “Crowdsourcing”
• Humans have been able to solve problems that are difficult for computers
![Page 37: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/37.jpg)
And Now You Understand the Limitations of Computation
![Page 38: Reductions (Section 5.1)](https://reader036.vdocuments.us/reader036/viewer/2022062316/56816756550346895ddc0d9e/html5/thumbnails/38.jpg)
What is your opinion?