
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Notes; Professor: Kowalczyk; Class: Algorithms Design And Analysis; Subject: Computer Science; University: Northern Michigan University; Term: Winter 2008;
Typology: Study notes
1 / 1
This page cannot be seen from the preview
Don't miss anything!
Algorithm Design and Analysis 4/6/
Instructor: Mike Kowalczyk
Today we saw the solutions to some homework problems and introduced the formal notion of a 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
//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.