Reducing One Problem to Another
The title of this section is likely something you do all the friggin time: take a solution to a problem that you already know how to solve, and then re-use it later when you are solving a more difficult problem. A reduction of one problem to another, in the formal sense that we are just about to introduce, is not much more complicated than that. In any case, it helps to see this happen in real time via an example.
We are going to start with the tasks of representing \(S(n) = n + 1\) and \(P(n) = \max(0, n - 1)\), i.e., successor and predecessor, in binary.
For predecessor, in pseudocode, one way to proceed would be to do the following.
- If the only digit is \(0\), then halt.
- If the only digit is \(1\), then flip it to a \(0\) and halt.
- Move to the end of the string of \(0\)s and \(1\)s.
- If the last digit is \(1\), flip it to a \(0\) and halt.
- If the last digit is \(0\), then we change it to a \(1\) and move left.
- If there are no digits to the left and the current digit is \(1\), erase the \(1\) and halt.
- Otherwise, return to Step 4.
Next, we are going to represent addition, by reducing it to successor and predecessor. Let \(\rho \colon \mathbb N \times \mathbb N \to \{0, 1, \#\}^*\) be the string representation \[ \rho(n, m) = \mathsf{bin}(n)~\#~\mathsf{bin}(m) \] We would like to find a Turing machine \(\mathcal T\) with a state \(x_+\) such that \[ \mathcal T_{x_+}(\rho(n,m)) = \mathsf{bin}(n + m) \] The pseudocode looks like this:
- If the string before the \(\#\) is just \(0\), erase \(\#\) and everything to the left of it.
- Subtract one from the string of \(0\)s and \(1\)s using the predecessor function, then add \(1\) to the string of \(0\)s and \(1\)s after the \(\#\). Return to Step 1.
Arithmetic is nice, because everything somehow reduces to the successor function. Give it a try!
In general, reducing one problem to another can broadly be construed as stating that if P is solvable, then Q is solvable. Today, we saw that we could reduce the problem of multiplication to addition, which itself could be reduced to successor and predecessor.