reductions (section 5.1)

38
Reductions (Section 5.1) Héctor Muñoz-Avila

Upload: trella

Post on 24-Feb-2016

44 views

Category:

Documents


0 download

DESCRIPTION

Reductions (Section 5.1). H éctor Muñoz-Avila. 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. Proving that Other Problems are Undecidable. We use the reductions method - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Reductions (Section 5.1)

Reductions

(Section 5.1)

Héctor Muñoz-Avila

Page 2: Reductions (Section 5.1)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

Example: Do-Nothing Problem• Given a program P, will P reject every input w?

Page 18: Reductions (Section 5.1)

Example: Do-Nothing Problem• Given a program P, will P reject every input w?

P(w){ return reject}

Page 19: Reductions (Section 5.1)

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)

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)
Page 22: Reductions (Section 5.1)

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)

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)

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)

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)

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)

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)

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)

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)
Page 31: Reductions (Section 5.1)

The AI Question

Héctor Muñoz-Avila

Page 32: Reductions (Section 5.1)

Informally• Can we construct a machine that exhibits “human level”

intelligence?

Page 33: Reductions (Section 5.1)

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)

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)

We Certainly Have seen Impressive Examples of Machine’s Capabilities

Page 36: Reductions (Section 5.1)

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)

And Now You Understand the Limitations of Computation

Page 38: Reductions (Section 5.1)

What is your opinion?