TCSLib

201 Complexity — Reductions

201.1 Overview

This module introduces polynomial-time Karp reducibility \(L \le _p L'\), \(\mathsf{NP}\)-hardness and \(\mathsf{NP}\)-completeness following Arora–Barak Definition 2.7, and proves the basic laws of Theorem 2.8: reflexivity and transitivity of \(\le _p\), downward closure of \(\mathsf{P}\) under \(\le _p\), and the collapse \(\mathsf{P} = \mathsf{NP}\) whenever an \(\mathsf{NP}\)-hard language lies in \(\mathsf{P}\). It closes with Arora–Barak Exercise 2.8: the halting language is \(\mathsf{NP}\)-hard for every representation scheme of machines, yet (for effective schemes) not in \(\mathsf{NP}\), hence not \(\mathsf{NP}\)-complete; the supporting material builds a halting recognizer from a Boolean decider and a machine that prepends a fixed word to its input.

201.2 Declarations

Definition 201.1 Polynomial-time Karp reducibility
✓
#

For languages \(L, L' \subseteq \{ 0,1\} ^{*}\), we say \(L\) is polynomial-time (Karp) reducible to \(L'\), written \(L \le _p L'\), if there is a function \(f : \{ 0,1\} ^{*} \to \{ 0,1\} ^{*}\) that is polynomial-time computable (some finite-state binary-alphabet Turing machine computes it within \(C \cdot (n+1)^c\) steps on inputs of length \(n\), for constants \(C, c \in \mathbb {N}\)) such that for every binary string \(x\), \(x \in L\) if and only if \(f(x) \in L'\) [AB09, Definition 2.7].

Theorem 201.2 Reflexivity of Karp reducibility
✓
#

Every language \(L \subseteq \{ 0,1\} ^{*}\) is polynomial-time Karp reducible to itself: \(L \le _p L\) [AB09, Exercise 2.9].

Theorem 201.3 Transitivity of Karp reducibility
✓
#

Let \(L, L', L'' \subseteq \{ 0,1\} ^{*}\) be languages. If \(L \le _p L'\) and \(L' \le _p L''\), where \(\le _p\) denotes polynomial-time Karp reducibility, then \(L \le _p L''\) [AB09, Theorem 2.8.1].

Theorem 201.4 \(\mathsf{P}\) is closed under Karp reductions
✓

Let \(L, L' \subseteq \{ 0,1\} ^{*}\) be languages such that \(L\) is polynomial-time Karp reducible to \(L'\). If \(L' \in \mathsf{P}\), then \(L \in \mathsf{P}\) [AB09, remark after Definition 2.7].

Definition 201.5 \(\mathsf{NP}\)-hardness
✓
#

A language \(L \subseteq \{ 0,1\} ^{*}\) is \(\mathsf{NP}\)-hard if every language \(L' \in \mathsf{NP}\) is polynomial-time Karp reducible to it, i.e. \(L' \le _p L\) [AB09, Definition 2.7].

Definition 201.6 \(\mathsf{NP}\)-completeness
✓
#

A language \(L \subseteq \{ 0,1\} ^{*}\) is \(\mathsf{NP}\)-complete if \(L \in \mathsf{NP}\) and \(L\) is \(\mathsf{NP}\)-hard, i.e. every language in \(\mathsf{NP}\) is polynomial-time Karp reducible to \(L\) [AB09, Definition 2.7].

Theorem 201.7 An \(\mathsf{NP}\)-hard language in \(\mathsf{P}\) collapses \(\mathsf{NP}\)
✓

Let \(L \subseteq \{ 0,1\} ^{*}\) be an \(\mathsf{NP}\)-hard language, i.e. every language in \(\mathsf{NP}\) is polynomial-time Karp reducible to \(L\). If \(L \in \mathsf{P}\), then \(\mathsf{P} = \mathsf{NP}\) [AB09, Theorem 2.8.2].

Theorem 201.8 An \(\mathsf{NP}\)-complete language is in \(\mathsf{P}\) iff \(\mathsf{P}=\mathsf{NP}\)
✓

Let \(L \subseteq \{ 0,1\} ^{*}\) be an \(\mathsf{NP}\)-complete language, i.e. \(L \in \mathsf{NP}\) and every language in \(\mathsf{NP}\) is polynomial-time Karp reducible to \(L\). Then \(L \in \mathsf{P}\) if and only if \(\mathsf{P} = \mathsf{NP}\) [AB09, Theorem 2.8.3].

Definition 201.9 State encoding of the halting recognizer
✓
#

Let \(Q\) be a set of control states. The recognizer’s control states are the pairs \((q, b) \in Q \times \{ 0,1\} \) together with a distinguished loop state \(\ell \), and a further symbol \(\bot \) marks halting. Given \(s \in Q \cup \{ \bot \} \) (a state, or \(\bot \) for halting) and a bit \(b\), the encoded state \(\mathrm{enc}(s, b)\) is \((s, b)\) when \(s \in Q\), is \(\bot \) when \(s = \bot \) and \(b = 1\), and is the loop state \(\ell \) when \(s = \bot \) and \(b = 0\).

Definition 201.10 Recorded-bit transform of a machine action
✓

Let \(a\) be a one-step action of a \(k\)-work-tape binary-alphabet Turing machine with state set \(Q\): an input-head move, a write-and-move instruction for each work tape, an optional output bit, and a successor state \(s \in Q \cup \{ \bot \} \) (\(\bot \) meaning halt). For a bit \(b\), the transformed action has the same input-head move and work-tape instructions, emits no output, and has successor state \(\mathrm{enc}(s, b')\), where \(b'\) is the bit emitted by \(a\) (or \(b\) if \(a\) emits nothing) and \(\mathrm{enc}(s, b')\) is \((s, b')\) for \(s \in Q\), halt for \(s = \bot \) and \(b' = 1\), and a dedicated loop state for \(s = \bot \) and \(b' = 0\).

Definition 201.11 Halting recognizer of a Boolean decider
✓
#

Let \(M\) be a finite-state binary-alphabet Turing machine with \(k\) work tapes, state set \(Q\) and start state \(q_0\). Its halting recognizer \(M^{\mathrm{acc}}\) has the same \(k\) work tapes, states \((Q \times \{ 0,1\} ) \cup \{ \ell \} \) and start state \((q_0, 0)\). In the loop state \(\ell \) it moves no head, writes and emits nothing, and stays in \(\ell \); in state \((q, b)\) it performs \(M\)’s transition from \(q\) on the scanned symbols, except that it emits nothing, records in its bit the symbol \(M\) would emit (keeping \(b\) if none), and where \(M\) would halt it halts if the recorded bit is \(1\) and enters \(\ell \) if it is \(0\).

Definition 201.12 Configuration correspondence for the halting recognizer
✓

Let \(M\) be a finite-state binary-alphabet Turing machine with state set \(Q\), and \(M^{\mathrm{acc}}\) its halting recognizer (states \((q,b) \in Q \times \{ 0,1\} \) plus a loop state \(\ell \), the bit recording \(M\)’s last emitted symbol). For an input \(x\) and a configuration \(C\) of \(M\) on \(x\), the configuration \(\Phi (C)\) of \(M^{\mathrm{acc}}\) on \(x\) has the same input-head position, work-tape contents and work-head positions as \(C\), an empty output tape, and state \(\mathrm{enc}(s, b)\), where \(s\) is the state of \(C\) (or \(\bot \) if halted), \(b\) is the last bit on \(C\)’s output tape (\(0\) if it is empty), and \(\mathrm{enc}(s,b)\) is \((s,b)\) for \(s \in Q\), halted for \(s=\bot , b=1\), and \(\ell \) for \(s=\bot , b=0\).

Lemma 201.13 The loop state of the halting recognizer is stationary
✓

Let \(M\) be a finite-state binary-alphabet Turing machine and \(M^{\mathrm{acc}}\) its halting recognizer, a machine with a distinguished loop state \(\ell \) in which it moves no head, writes and emits nothing, and remains in \(\ell \). For every input \(x\), every configuration \(C\) of \(M^{\mathrm{acc}}\) on \(x\) whose state is \(\ell \), and every \(t \in \mathbb {N}\), running \(M^{\mathrm{acc}}\) for \(t\) steps from \(C\) yields \(C\) itself; in particular it never halts.

Lemma 201.14 Recorded-bit actions commute with the configuration correspondence
✓

Let \(M\) be a finite-state binary-alphabet Turing machine with state set \(Q\), \(x\) an input, \(C\) a configuration of \(M\) on \(x\), and \(a\) an action of \(M\). Let \(b\) be the last bit on \(C\)’s output tape (\(0\) if empty), and let \(\Phi (C)\) be the recognizer configuration with \(C\)’s head positions and tape contents, empty output, and state \(\mathrm{enc}(s,b)\), where \(s\) is \(C\)’s state and \(\mathrm{enc}(s,b) = (s,b)\) for \(s \in Q\), halt for a halted \(s\) with \(b=1\), and a loop state for a halted \(s\) with \(b=0\). Then applying to \(\Phi (C)\) the action with \(a\)’s head moves and writes, no output, and successor state \(\mathrm{enc}(s', b')\) (\(s'\) the successor of \(a\), \(b'\) the bit \(a\) emits, or \(b\) if none) gives exactly \(\Phi (a(C))\), where \(a(C)\) is the result of applying \(a\) to \(C\).

Let \(M\) be a finite-state binary-alphabet Turing machine with state set \(Q\), and let \(M^{\mathrm{acc}}\) be its halting recognizer: same work tapes, states \((q,b) \in Q \times \{ 0,1\} \) plus a stationary loop state \(\ell \), simulating \(M\) with output suppressed and the last emitted bit recorded, halting where \(M\) halts with recorded bit \(1\) and entering \(\ell \) where it halts with bit \(0\). For a configuration \(C\) of \(M\) on an input \(x\), let \(\Phi (C)\) be the configuration of \(M^{\mathrm{acc}}\) with \(C\)’s head positions and work-tape contents, empty output, and state \((q,b)\), halted, or \(\ell \) according as \(C\) is in state \(q\), halted with last output bit \(1\), or halted with last output bit \(0\) (the bit \(b\) being the last output bit, \(0\) if none). Then for every such \(C\), one step of \(M^{\mathrm{acc}}\) from \(\Phi (C)\) yields \(\Phi (C')\), where \(C'\) is the result of one step of \(M\) from \(C\) (a halted configuration stepping to itself).

Lemma 201.16 Runs of the halting recognizer simulate runs
✓

Let \(M\) be a finite-state binary-alphabet Turing machine with state set \(Q\), and let \(M^{\mathrm{acc}}\) be its halting recognizer: same work tapes, states \((q,b) \in Q \times \{ 0,1\} \) plus a stationary loop state \(\ell \), start state \((q_0, 0)\), simulating \(M\) with output suppressed and the last emitted bit recorded, halting where \(M\) halts with recorded bit \(1\) and entering \(\ell \) where it halts with bit \(0\). For every input \(x\) and every \(t \in \mathbb {N}\), the configuration of \(M^{\mathrm{acc}}\) after \(t\) steps on \(x\) has the same head positions and work-tape contents as the configuration \(C_t\) of \(M\) after \(t\) steps on \(x\), an empty output tape, and state \((q,b)\), halted, or \(\ell \) according as \(C_t\) is in state \(q\), halted with last output bit \(1\), or halted with last output bit \(0\), where \(b\) is the last output bit of \(C_t\) (\(0\) if none).

Let \(M\) be a finite-state binary-alphabet Turing machine and \(p : \{ 0,1\} ^{*} \to \{ 0,1\} \) a predicate such that on every input \(x\) the machine \(M\) eventually halts with the single bit \(p(x)\) as its output. Let \(M^{\mathrm{acc}}\) be the halting recognizer of \(M\), which simulates \(M\) with output suppressed while recording the last bit \(M\) emits (initially \(0\)), halts when \(M\) halts with recorded bit \(1\), and otherwise enters a loop state in which it does nothing forever. Then for every input \(x\), \(M^{\mathrm{acc}}\) halts on \(x\) (for some output \(w\) and some \(t\), it halts within \(t\) steps with output \(w\)) if and only if \(p(x) = 1\).

Definition 201.18 Machine prepending a fixed word
✓
#

For a binary string \(w = w_0 w_1 \cdots w_{m-1}\), the prefixing machine \(P_w\) is the binary-alphabet Turing machine with no work tapes, states \(\{ 0, 1, \ldots , m\} \) and start state \(0\). In state \(i \lt m\) it emits \(w_i\) and moves to state \(i+1\) without moving its input head; in state \(m\), if the input head scans a bit \(b\) it emits \(b\), moves the input head right and stays in state \(m\), and if it scans a blank it halts without emitting anything.

Definition 201.19 Configurations of the prefixing machine
✓
#

For binary strings \(w\) and \(x\), an optional state \(q \in \{ 0, 1, \ldots , |w|\} \cup \{ \bot \} \) (\(\bot \) meaning halted), an input-head position \(p \in \{ 0, 1, \ldots , |x|+1\} \) (positions \(0\) and \(|x|+1\) being the blank cells flanking \(x\)) and an output string \(u\), this is the configuration of a machine with no work tapes and state set \(\{ 0, 1, \ldots , |w|\} \) on input \(x\) that is in state \(q\), has its input head at position \(p\), and has \(u\) on its output tape.

Lemma 201.20 Emission phase of the prefixing machine
✓

Let \(w = w_0 \cdots w_{m-1}\) and \(x\) be binary strings, and let \(P_w\) be the machine with no work tapes and states \(\{ 0, \ldots , m\} \) which, starting in state \(0\), emits \(w_i\) and moves to state \(i+1\) in each state \(i \lt m\), and in state \(m\) copies the input bit by bit, halting at the first blank. For every \(i \le m\), after \(i\) steps on input \(x\) the machine \(P_w\) is in state \(i\), its input head is still on the first input cell, and its output tape holds the first \(i\) bits \(w_0 \cdots w_{i-1}\) of \(w\).

Let \(w = w_0 \cdots w_{m-1}\) and \(x = x_1 \cdots x_n\) be binary strings, and let \(P_w\) be the machine with no work tapes and states \(\{ 0, \ldots , m\} \) which emits \(w_i\) and advances to state \(i+1\) in each state \(i \lt m\), and in state \(m\) emits the scanned input bit and moves its input head right, halting at a blank. For every \(i \le n\), running \(P_w\) on input \(x\) for \(i\) steps from the configuration in state \(m\) with the input head on the first input cell and output \(w\) yields the configuration in state \(m\) with the input head on cell \(i+1\) and output \(w\, x_1 \cdots x_i\).

Let \(w = w_0 \cdots w_{m-1}\) be a binary string and \(P_w\) the machine with no work tapes and states \(\{ 0, \ldots , m\} \) which first emits \(w_0, \ldots , w_{m-1}\) one per step without moving its input head, then copies the input bit by bit while moving right, halting at the first blank. Then for every binary input \(x\), \(P_w\) halts within \(|w| + |x| + 1\) steps with output the concatenation \(wx\).

Lemma 201.23 Running time of fixed-code pairing
✓

Let \(\alpha = \alpha _1 \cdots \alpha _m\) be a binary string, and for a binary string \(x\) let \(\langle \alpha , x \rangle = \alpha _1\alpha _1 \cdots \alpha _m\alpha _m\, 0\, 1\, x\) be the pairing encoding (\(\alpha \) with every bit doubled, then the separator \(01\), then \(x\)). The machine with no work tapes that first emits the fixed word \(\alpha _1\alpha _1 \cdots \alpha _m\alpha _m\, 01\) one bit per step and then copies its input bit by bit, halting at the first blank, halts on every input \(x\) within \(2|\alpha | + |x| + 3\) steps with output \(\langle \alpha , x \rangle \).

Lemma 201.24 Fixed-code pairing is polynomial-time computable
✓

Let \(\alpha \) be a fixed binary string, and for binary strings \(x\) let \(\langle \alpha , x \rangle \) be the pairing encoding: \(\alpha \) with every bit doubled, followed by \(01\), followed by \(x\). Then the map \(x \mapsto \langle \alpha , x \rangle \) is polynomial-time computable: some finite-state binary-alphabet Turing machine computes it within \(C \cdot (n+1)^c\) steps on inputs of length \(n\), for constants \(C, c \in \mathbb {N}\).

Let \(c\) be any representation scheme for Turing machines: a total decoding of bit strings into coded one-work-tape machines together with an encoding, such that a machine’s code followed by any number of \(1\)s decodes back to that machine. Let \(\mathrm{HALT}_c\) be the set of bit strings of the form \(\langle \alpha , x \rangle \) (\(\alpha \) with every bit doubled, then \(01\), then \(x\)) such that the machine decoded from \(\alpha \) halts on input \(x\). Then \(\mathrm{HALT}_c\) is \(\mathsf{NP}\)-hard: every language in \(\mathsf{NP}\) is polynomial-time Karp reducible to \(\mathrm{HALT}_c\) [AB09, Exercise 2.8].

Let \(c\) be an effective representation scheme for Turing machines: a total decoding of bit strings into coded machines with an encoding that decoding inverts (also after padding the code with \(1\)s), equipped with a finite-state binary-alphabet machine that, within some time bound, computes from every bit string the canonical serialization of the machine it decodes to. Let \(\mathrm{HALT}_c\) be the set of bit strings of the form \(\langle \alpha , x \rangle \) (\(\alpha \) with every bit doubled, then \(01\), then \(x\)) such that the machine decoded from \(\alpha \) halts on input \(x\). Then \(\mathrm{HALT}_c \notin \mathsf{NP}\) [AB09, Exercise 2.8].