# Thread: Format used for reduction function (undecidability)

1. ## Format used for reduction function (undecidability)

When describing the reduction of an undecidable language to another, we use a partial function. I understand that the left side of the function is the undecidable language such as the halting problem, but what does the format of the right side mean. I understand it's our new problem, that we want to show is undecidable, but whats the general format of such arguments and what does it mean?

i.e. f(M,w) = ??? where M is the Turing machine that decides if M halts on input w.

2. ## Re: Format used for reduction function (undecidability)

From Wikipedia:
Suppose A and B are formal languages over the alphabets Σ and Γ, respectively. A many-one reduction from A to B is a total computable function f : Σ* → Γ* that has the property that each word w is in A if and only if f(w) is in B (that is, $\displaystyle A = f^{-1}(B)$).
Both sets A and B are encoding of some problems in Turing machines' alphabets. For example, the first problem can be SAT and the second problem can be HAMILTONIAN CYCLE. Then A consists of encodings of satisfiable Boolean formulas and B consists of encodings of graphs with Hamiltonian cycles. In this example, a reduction is just some function from words to words, but it is supposed to map words from A, and only them, to words from B.

3. ## Re: Format used for reduction function (undecidability)

Thank you, that does help. My question now is if we perform that mapping and the input for the machine on the right hand side is different, then would it look something like this:

f((M,w)) = M'(M,w,p)

So in the above example, I'm trying to say, take the description of the halting machine M and an input string w, and map it to a new machine M', which modifies the behavior of M and then runs M on input w as normal looking if a certain state p is reached.

I understand I'd have to give a much more detailed description of M' and how it modifies the behavior of M, but I'm confused as to how to represent the new input to machine M', in this case, a state p, on the right hand side of the mapping.

4. ## Re: Format used for reduction function (undecidability)

Usually you describe M' in words using M and w. What is the problem you are solving? Perhaps it is easier to explain the reduction on this example.

5. ## Re: Format used for reduction function (undecidability)

In my experience, learning TM reductions is counterintuitive. At first it seems like you're doing them backwards.

The basic idea is you're constructing a proof by contradiction. You show that if you had a machine that solved L, you could, with an effective procedure, modify the machine to produce a new machine that solves some known-to-be-unsolvable problem, creating the contradiction.

Example. It is impossible to design a program that will tell me if two arbitrary programs written in the same Turing-complete language produce the same output for all the same inputs.

Proof. Assume not: assume there exists such a machine M that takes as input two turing machines and decides whether they are the same. I can use M to create M' as follows. M' passes as the first portion of its input to M the code for a Turing machine that always halts. It passes as the second portion of its input to M its entire input. Then M' solves the halting problem. But this is impossible, so M must not exist.

In fact, if you look carefully at that example, this is the worst sort of undecidability: the problem is easy to describe and spec in full, yet it is not only undecidable, not only unrecognizable, but its compliment is also unrecognizable. In other words, any machine that claims to tell you if two Turing machines produce the same output for every input must run forever in some "yes" case and must run forever in some "no" case, and the same is true if the machine claims to tell you if two Turing machines produce different output. This is because, in principle, you can't say anything about what a Turing machine will do in the general case without simulating every possible input. This is not surprising, given Godel's First Incompleteness Theorem, and it's also intuitively obvious. A program that could solve halting would be powerful indeed, as you could write, say, the Riemann Hypothesis as a program that terminates only if the Hypothesis is false, and then answer it without calculating the answer by some deterministic means (which is absurd).

The other methods I can think of for proving unsolvability are directly (by showing no such TM can exist), which may or may not require diagonalization; by using diagonalization on Turing Machines or less commonly on inputs or pairs; and by reliance on a lemma such as the celebrated (well if it's not, it should be) Rice's Theorem.

6. ## Re: Format used for reduction function (undecidability)

Thank you for the responses. The problem I am trying to solve is:

To determine, given a Turing machine M, a state p, and a string w, whether M ever reaches state p when started with input w from its initial state.

I know the idea is that we could set p to be the halting state of M, then it solves the halting problem, but I'm unsure how to represent these inputs.

7. ## Re: Format used for reduction function (undecidability)

Originally Posted by LostProjectile
To determine, given a Turing machine M, a state p, and a string w, whether M ever reaches state p when started with input w from its initial state.

I know the idea is that we could set p to be the halting state of M, then it solves the halting problem, but I'm unsure how to represent these inputs.
You are trying to construct a machine, let's call it K, which does what you mention above. You want to prove this is not possible.

So, start by assuming it is possible. This means the Turing machine you described, K, exists. We can find a contradiction (disproving our assumption that K exists) by using K to solve the halting problem.

K takes as input a sequence (M, p, w) where we can separate the three pieces without any ambiguity. What you need to do to show K can help you solve the halting problem is construct a machine K' that uses K as a "helper". This machine K' must take as input (M', w'), and return true iff M' halts on w'.

All that remains to be done is for you to describe how K' works its magic by calling the machine K as a subroutine. You can't modify K, but you can select what input you send it and how you handle the results.

Does that help?

8. ## Re: Format used for reduction function (undecidability)

Originally Posted by LostProjectile
My question now is if we perform that mapping and the input for the machine on the right hand side is different, then would it look something like this:

f((M,w)) = M'(M,w,p)

So in the above example, I'm trying to say, take the description of the halting machine M and an input string w, and map it to a new machine M', which modifies the behavior of M and then runs M on input w as normal looking if a certain state p is reached.
In this problem, you don't need to modify the behavior of M and run M.

Imagine that the city government set up an office where people can come for any business: to renew a driver's license, to get a building permit, to pay a traffic fine, etc. The office just collects the necessary documents and fees and forwards them to the appropriate city department. For example, to renew a driver's license the office requires two things: a copy of an old license and a check for the service. It then sends these items to DMV, which also needs the person's date of birth. However, the front office does not need to ask for the date of birth explicitly because it is listed on the license. Therefore, the front office performs a reduction taking two items: a copy of the license and a check, and turns them into three items: a copy, a check and a date of birth. After the reduction is done, it sends the tree items to the DMV and forgets about them.

Similarly, your reduction must take a machine M' and an input w' and turn them into three pieces of information: M, w, p (some of them may be the same as the original M and w). This is all the reduction does. After that, the triple (M, w, p) is sent to the machine K that knows how to say whether M reaches p on input w.

9. ## Re: Format used for reduction function (undecidability)

Originally Posted by emakarov
In this problem, you don't need to modify the behavior of M and run M.
To be particular, you rarely need to modify a Turing machine to do a reduction. Usually you just use the machine you want to show can't exist, in the exact format it is described to you, as a subroutine for a Turing machine you design (here, the machine M' uses M, where M is the machine you want to prove can't exist).

So to sum up: in a reduction, you describe how to systematically design an impossible machine (M') (e.g. halting problem TM), by using a machine that solves the problem you think is not solvable (M) as a building block for M'.

The only time you need to modify a Turing machine is if it is passed to you as input and there is some systematic way you want to change the input-machine before passing it as part of the input to another machine. This rarely comes up, though.