Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Notes on Mapping Reduction - Algorithms Design And Analysis | CS 422, Study notes of Algorithms and Programming

Material Type: Notes; Professor: Kowalczyk; Class: Algorithms Design And Analysis; Subject: Computer Science; University: Northern Michigan University; Term: Winter 2008;

Typology: Study notes

2009/2010

Uploaded on 02/25/2010

koofers-user-wy8-1
koofers-user-wy8-1 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Algorithm Design and Analysis 4/6/2008
Lecture 32: Reductions
Instructor: Mike Kowalczyk
Today we saw the solutions to some homework problems and introduced the formal notion of a
mapping reduction.
1 Mapping reduction
We say that decision problem Amapping reduces to decision problem Bif there exists an algorithm
which, on any input x(a problem instance of A) outputs y(a problem instance of B), and xis
a “yes” instance of Aif and only if yis a “yes” instance of B. If this is this case then we write
AmB.
Reductions are important because they allow us to relate the difficulty of solving different
problems. For example, if AmBand we have an algorithm that solves B, then we can use the
reduction to solve A. Conversely, if AmBand Ais known to be undecidable, we know that B
must also be undecidable.
Let’s do such a reduction with the halting problem. Let’s try to show Halt mBwhere Bis
the problem of determining if a given line of given program will be executed, given the input to
that program. If we can show this reduction, then since the halting problem is undecidable, we can
conclude that Bis undecidable as well. Here’s the reduction:
reduceHaltToLineReach(Program P, input i) {
Let program P’ =
"1) Run P on input i
2) i = i"
//Return an instance of line reach: "does program P’ on input i reach line 2?"
Return (P’, i, 2)
}
Let’s prove that this is indeed a mapping reduction. Suppose the input (P, i) is a “yes” instance
of the halting problem, i.e. Phalts on input i. Then if one were to run P0on input i, it would
reach line 2 so (P0, i, 2) is a “yes” instance of the line reach problem. On the other hand, if (P , i) is
a “no” instance of the halting problem, i.e. Pdoesn’t halt on input i, then P0on input idoesn’t
reach line 2 so (P0, i, 2) is a “no” instance of the line reach problem. Thus the halting problem
reduces to the line reach problem via the reduction above, and we conclude that the line reach
problem is undecidable.
1

Partial preview of the text

Download Notes on Mapping Reduction - Algorithms Design And Analysis | CS 422 and more Study notes Algorithms and Programming in PDF only on Docsity!

Algorithm Design and Analysis 4/6/

Lecture 32: Reductions

Instructor: Mike Kowalczyk

Today we saw the solutions to some homework problems and introduced the formal notion of a mapping reduction.

1 Mapping reduction

We say that decision problem A mapping reduces to decision problem B if there exists an algorithm which, on any input x (a problem instance of A) outputs y (a problem instance of B), and x is a “yes” instance of A if and only if y is a “yes” instance of B. If this is this case then we write A ≤m B. Reductions are important because they allow us to relate the difficulty of solving different problems. For example, if A ≤m B and we have an algorithm that solves B, then we can use the reduction to solve A. Conversely, if A ≤m B and A is known to be undecidable, we know that B must also be undecidable. Let’s do such a reduction with the halting problem. Let’s try to show Halt ≤m B where B is the problem of determining if a given line of given program will be executed, given the input to that program. If we can show this reduction, then since the halting problem is undecidable, we can conclude that B is undecidable as well. Here’s the reduction:

reduceHaltToLineReach(Program P, input i) { Let program P’ = "1) Run P on input i

  1. i = i"

//Return an instance of line reach: "does program P’ on input i reach line 2?" Return (P’, i, 2) }

Let’s prove that this is indeed a mapping reduction. Suppose the input (P, i) is a “yes” instance of the halting problem, i.e. P halts on input i. Then if one were to run P ′^ on input i, it would reach line 2 so (P ′, i, 2) is a “yes” instance of the line reach problem. On the other hand, if (P, i) is a “no” instance of the halting problem, i.e. P doesn’t halt on input i, then P ′^ on input i doesn’t reach line 2 so (P ′, i, 2) is a “no” instance of the line reach problem. Thus the halting problem reduces to the line reach problem via the reduction above, and we conclude that the line reach problem is undecidable.