Mapping Reductions in Computability Theory

Thu Apr 03 2025

Computability Theory
cover

Introduction

In computability theory, it can be somewhat tedious to analyze the decidability and recognizability of each decision problem from scratch—especially when the problems are closely related. For example, we already know that the Halting Problem

HALT={y,xΣ×Σy=code(M) and M halts on x}\text{HALT} = \{ \langle y, x \rangle \in \Sigma^* \times \Sigma^* \mid y = \text{code}(M) \text{ and } M \text{ halts on } x \}

is undecidable. Now suppose the problem is slightly changed: does a given Turing machine halt on all inputs? Or does it halt on the empty input? Are these problems decidable?

In such cases, a general strategy for proving undecidability is:

  1. Assume there exists a Turing machine MM that decides the target problem.
  2. Use MM to construct a machine MHM_H that decides HALT\text{HALT}.
  3. Contradiction—since HALT\text{HALT} is known to be undecidable.

Abstracting this idea, to prove that a problem AA is undecidable, we assume that AA is decidable and show that this would imply the decidability of another problem BB that is already known to be undecidable. Therefore, AA cannot be decidable. Mapping reduction provides a unified and formal method for solving such problems.

Definition of Mapping Reduction

The idea of a mapping reduction is to transform one problem into another. It is formally defined as follows:

Let L1L_1 and L2L_2 be languages over alphabets Σ\Sigma and Γ\Gamma, respectively. A mapping reduction from L1L_1 to L2L_2 is a computable total function f:ΣΓf: \Sigma^* \to \Gamma^*, such that

xL1    f(x)L2.x \in L_1 \iff f(x) \in L_2.

If such a function ff exists, we write L1mL2L_1 \leq_m L_2.

A computable total function means that there exists a Turing machine which computes ff, and it halts on every input xΣx \in \Sigma^*. In other words, the function always produces an output rather than looping indefinitely.

The condition xL1    f(x)L2x \in L_1 \iff f(x) \in L_2 is equivalent to:

  • if xL1x \in L_1, then f(x)L2f(x) \in L_2, and
  • if xL1x \notin L_1, then f(x)L2f(x) \notin L_2.

In other words, YES-instances of the decision problem for L1L_1 are mapped to YES-instances of the problem for L2L_2, and NO-instances of L1L_1 are mapped to NO-instances of L2L_2.

In fact, a mapping reduction is a concrete realization of the step 2 in the general proof strategy for undecidability we mentioned earlier—it directly transforms one problem into another. The hypothetical machine MM is only used at the final step to reach a contradiction.

It can be noted that mapping reduction is, in fact, an independent process—not directly tied to decidability or recognizability—but it can be used to prove both. This proof technique also plays an important role in many other areas, such as complexity theory.

Example

Now, when we attempt to prove that a language LL is undecidable, it suffices to show that there exists a function ff such that

HALTmL,\text{HALT} \leq_m L,

i.e., ff reduces HALT\text{HALT} to LL. If LL were decidable by some Turing machine MM, then HALT\text{HALT} could also be decided by composing MM with ff (as shown below), leading to a contradiction. Therefore, LL must be undecidable.

HTM

Mapping Reduction in Computability Theory

If L1mL2L_1 \leq_m L_2, then there exists a Turing machine that transforms the decision problem of L1L_1 into the decision problem of L2L_2. This means that, in terms of computability, if we can solve L2L_2, then we can solve L1L_1. In other words, if we know the hardness of L1L_1, then L2L_2 is at least as hard as L1L_1. Conversely, if we know the hardness of L2L_2, then L1L_1 is at most as hard as L2L_2.

Formally, for any languages L1L_1 and L2L_2, mapping reduction has the following properties:

  • If L2L_2 is decidable and L1mL2L_1 \leq_m L_2, then L1L_1 is decidable. (The following Turing machine decides L1L_1.)
HTM
  • If L1L_1 is undecidable and L1mL2L_1 \leq_m L_2, then L2L_2 is undecidable. (Logically equivalent to the above)

  • If L2L_2 is decidable and L1L_1 is undecidable, then L1̸mL2L_1 \not\leq_m L_2. (Also logically equivalent)

For recognizability:

  • If L2L_2 is recognizable and L1mL2L_1 \leq_m L_2, then L1L_1 is recognizable. (The following Turing machine recognize L1L_1.)
HTM
  • If L1L_1 is not recognizable and L1mL2L_1 \leq_m L_2, then L2L_2 is not recognizable.
  • If L2L_2 is recognizable and L1L_1 is not recognizable, then L1̸mL2L_1 \not\leq_m L_2.

The Empty String Halting Problem

The Empty String Halting (ETH) problem asks whether a given Turing machine halts on the empty string. This problem may sound much simpler than the general Halting Problem, since the input is restricted to just one specific case. It is formally defined as:

ETH={xΣx=code(M) and M halts on ε}.\text{ETH} = \{ x \in \Sigma^* \mid x = \text{code}(M) \text{ and } M \text{ halts on } \varepsilon \}.

However, we will prove that HALTmETH\text{HALT} \leq_m \text{ETH}, thereby showing that ETH\text{ETH} is undecidable.

To prove that HALTmETH\text{HALT} \leq_m \text{ETH}, we need to construct a computable function ff such that:

y,xHALT    f(y,x)ETHy,xHALT    f(y,x)ETH\begin{aligned} \langle y, x \rangle \in \text{HALT} &\implies f(\langle y, x \rangle) \in \text{ETH} \\ \langle y, x \rangle \notin \text{HALT} &\implies f(\langle y, x \rangle) \notin \text{ETH} \end{aligned}

Consider the following construction:

  • Check whether y,x\langle y, x \rangle is a valid encoding—that is, whether yy is the encoding of some Turing machine.
    If not, let f(y,x)=yf(\langle y, x \rangle) = y. Clearly, yETHy \notin \text{ETH}.

  • Otherwise, let M=decode(y)M = \text{decode}(y), and define f(y,x)=code(MM,x)f(\langle y, x \rangle) = \text{code}(M_{M,x}), where MM,xM_{M,x} is constructed as follows:

    • On any non-empty input, MM,xM_{M,x} enters an infinite loop.
    • On the empty input, MM,xM_{M,x} simulates MM on input xx.

Now, for a valid encoding y,x\langle y, x \rangle:

  • If y,xHALT\langle y, x \rangle \in \text{HALT}, then MM,xM_{M,x} halts on the empty input, so f(y,x)=code(MM,x)ETHf(\langle y, x \rangle) = \text{code}(M_{M,x}) \in \text{ETH}.
  • If y,xHALT\langle y, x \rangle \notin \text{HALT}, then MM,xM_{M,x} does not halt on the empty input, so f(y,x)=code(MM,x)ETHf(\langle y, x \rangle) = \text{code}(M_{M,x}) \notin \text{ETH}.

For an invalid encoding y,x\langle y, x \rangle, we have y,xHALT\langle y, x \rangle \notin \text{HALT}, and f(y,x)=yETHf(\langle y, x \rangle) = y \notin \text{ETH}.

The rule “on any non-empty input, MM,xM_{M,x} enters an infinite loop” is only used to define the behavior on non-empty inputs and ensure the computability of ff.

Limits of Mapping Reduction from Easy Problems

In the example above, we reduced a provenly hard decision problem (HALT\text{HALT}) to a seemingly simpler one (ETH\text{ETH}) via a mapping reduction, in order to demonstrate that the latter is equally hard. We also know that we can reduce a seemingly hard problem to a known easy one in order to solve it directly. But what happens if we reduce a provenly easy problem to another problem?

The answer is that we only learn that the latter is at least as “hard” as the former—which is not very helpful. In fact, for sufficiently simple decision problems, such as decidable languages, it is possible to reduce them to any nontrivial language LL, that is, any LΣL \neq \Sigma^* and LL \neq \emptyset.

For any decidable language L1L_1 and any nontrivial language L2L_2, suppose MM decides L1L_1. Since L2L_2 is nontrivial, we can find strings yL2y \in L_2 and zL2z \notin L_2. Now consider the function ff defined as follows:

f(x)={yif M accepts xzif M rejects xf(x) = \begin{cases} y & \text{if } M \text{ accepts } x \\ z & \text{if } M \text{ rejects } x \end{cases}

If xL1x \in L_1, then MM accepts xx, so f(x)=yL2f(x) = y \in L_2.
If xL1x \notin L_1, then MM rejects xx, so f(x)=zL2f(x) = z \notin L_2.

This kind of construction relies on the assumption that L1L_1 is simple enough—that is, there exists a Turing machine MM that decides it.

Rice’s Theorem

Finally, we use mapping reduction to prove Rice’s Theorem.

Any nontrivial property about the language L(M)L(M) recognized by a Turing machine MM is undecidable.
— Rice’s Theorem

Nontrivial means that not all recognizable languages L(M)L(M) have the property, and not none of them do either.

First, we need to understand what a property about a language L(M)L(M) means. Formally, for any nontrivial set of Turing-recognizable languages S{L(M)M is a Turing machine}\mathcal{S} \subset \{ L(M) \mid M \text{ is a Turing machine} \}, with S\mathcal{S} \neq \emptyset, we define the language property:

P={code(M)L(M)S}P = \{ \text{code}(M) \mid L(M) \in \mathcal{S} \}

Note that PP is a set of Turing machine codes, not a set of languages. This refers to a property of the Turing machine MM, but one that depends only on the language it recognizes. A language L(M)L(M) is a subset of Σ\Sigma^*, and any description of this set constitutes a language property. For example: whether L(M)L(M) is finite.

In other words, even if two Turing machines M1M_1 and M2M_2 are different, as long as they recognize the same language—that is, L(M1)=L(M2)L(M_1) = L(M_2)—then we have P(M1)=P(M2)P(M_1) = P(M_2).

In contrast, properties that are related to the implementation of the Turing machine MM are not considered language properties. For instance: whether MM halts within 100 steps, or whether the size of its state set is less than 10.

As a result, Rice’s Theorem cannot be used to prove the undecidability of the Halting Problem, since that is a property of the machine, not of the language it recognizes.

Proof

Fix a property PP. Assume that the empty language does not have this property, i.e., P(code(M))=0P(\text{code}(M_\emptyset)) = 0. Since PP is nontrivial, there exists some language L(MP)L(M_P) such that P(code(MP))=1P(\text{code}(M_P)) = 1. Now we construct a function ff as follows:

  • If y,x\langle y, x \rangle is not a valid encoding (i.e., yy is not the encoding of any Turing machine), then let f(y,x)=code(M)f(\langle y, x \rangle) = \text{code}(M_\emptyset).
  • Otherwise, let M=decode(y)M = \text{decode}(y), and define f(y,x)=code(MM,x)f(\langle y, x \rangle) = \text{code}(M_{M,x}), where MM,xM_{M,x} is constructed as follows:
    1. On any input zz, MM,xM_{M,x} first simulates MM on input xx;
    2. If MM halts, then it simulates MPM_P on input zz;
    3. If MPM_P halts, then MM,xM_{M,x} halts on the input zz.

Now, for a valid encoding y,x\langle y, x \rangle:

  • If y,xHALT\langle y, x \rangle \in \text{HALT}, then MM halts on input xx. Then, if MPM_P halts on some input zz, so does MM,xM_{M,x}. In this case, MM,xM_{M,x} recognizes the same language as MPM_P, so P(code(MM,x))=P(code(MP))=1P(\text{code}(M_{M,x})) = P(\text{code}(M_P)) = 1.

  • If y,xHALT\langle y, x \rangle \notin \text{HALT}, then MM does not halt on input xx, so MM,xM_{M,x} does not halts on any input zz. In this case, MM,xM_{M,x} recognizes the same language as MM_\emptyset, so P(code(MM,x))=P(code(M))=0P(\text{code}(M_{M,x})) = P(\text{code}(M_\emptyset)) = 0.

For an invalid encoding y,x\langle y, x \rangle, we also have y,xHALT\langle y, x \rangle \notin \text{HALT}, and we defined f(y,x)=code(M)f(\langle y, x \rangle) = \text{code}(M_\emptyset), so P(code(M))=0P(\text{code}(M_\emptyset)) = 0.

HTM

In our construction, one of the key step is that when y,xHALT\langle y, x \rangle \notin \text{HALT}, the machine MM,xM_{M,x} loops on every input, and

P(code(MM,x))=P(code(M))=0.P(\text{code}(M_{M,x})) = P(\text{code}(M_\emptyset)) = 0.

However, the assumption P(code(M))=0P(\text{code}(M_\emptyset)) = 0 is something we made. What if instead P(code(M))=1P(\text{code}(M_\emptyset)) = 1?

In that case, we can simply consider the complement property ¬P\neg P. Then we have shown that

{code(M)¬P(code(M))=1}\{ \text{code}(M) \mid \neg P(\text{code}(M)) = 1 \}

is undecidable, which is logically equivalent to saying that

{code(M)P(code(M))=1}\{ \text{code}(M) \mid P(\text{code}(M)) = 1 \}

is undecidable.

Conclusion

At this point, we have developed an understanding of mapping reduction as a tool for transforming one decision problem into another. Mapping reductions are not only used in computability theory, but also play an important role in complexity theory, where they are applied in a similar way.

We then used mapping reductions to prove the undecidability of the Empty String Halting (ETH\text{ETH}) problem and Rice’s Theorem, demonstrating that mapping reduction is a general and powerful technique.


Acknowledgments
This blog references material from the slides of COMP0017 Computability and Complexity Theory at University College London.