Proofs: Linear speedup theorem
These are the human proofs of Linear speedup theorem, at full length.
Compressing m symbols into one cell speeds up a multitape machine by the factor m
This proof shows: linear-speedup.
Statement. Let and let be a deterministic -tape machine (as on the multitape Turing machine page) that halts on every input and decides . Let and be integers, and let be a function with such that on every input of length the machine halts within steps. Then there is a deterministic -tape machine with such that on every input of length the machine halts within
$$ T'(n) \le n + 1 \quad \text{if } n < n_0, \qquad T'(n) \le n + \lceil n/m \rceil + 6\lceil t(n)/m \rceil - 1 \quad \text{if } n \ge n_0 . $$
For every , the choice and (and the bound from which holds) gives for all .
Setup. The tapes of and are infinite to the right, with cells numbered . A head on cell that moves stays. The input is in cells to of tape 1. Let be the tape alphabet of , with blank . Write for its start state. Let be the running time of on . The value holds because the start state is not a halting state. For we have .
The tape alphabet of is . A block is an element of . The bit is the end flag. A cell of that holds is read as the block .
The roles of the tapes. Tape of is kept on tape of . Tape of is kept on tape of . Tape of is kept on tape of for . This swap is the place where is used: tape of holds the input at the start, and it is free for use after the input is copied. Let be the tape of that keeps tape of . Let and for . For , block of tape of is the cell of tape of . It holds the cells of tape of , in this order. Only block has the end flag .
The finite control. The state of holds a state of , an offset for each tape , and a bounded buffer: at most symbols during the copy, at most symbols of the input, and three blocks for each tape during a simulation round. All of these come from finite sets, so has finitely many states.
Proof.
Step 1: copy the input. Let .
- Transition , for : head reads in cell , writes and moves right. The control keeps in its buffer. If divides , head writes the block in its cell and moves right, with if and otherwise. Otherwise head stays. In transition , heads write the block and stay.
- Transition : head reads the blank in cell . If , the control holds the whole input, because it keeps the first symbols. Then halts at once with the verdict of on . This verdict exists because halts on every input. So and the first claim holds. If , head writes the block on its cell and stays. This is block of tape of . If , transition is this transition, and head writes on cell and stays, and heads do what transition 1 says. If and , head writes the last block, padded with , with if , and stays on cell . If and , head moves left to cell .
- Transitions : head moves left. It moves left in each cell where it reads . It reads in cell after moves. At that reading, the machine does not spend a separate transition. The reading is transition 1 of the read phase of round 1: it moves head 2 as that transition says (move ), and the other heads, which are already on block , read their blocks in the same transition.
Now every head of is on block of the tape that it keeps. The tapes hold the blocks of the initial configuration of : the blocks of tape hold followed by blanks, and all other blocks are blank. The copy takes transitions if , and transition if .
Step 2: the invariant. A round simulates steps of . Let . We call the following statement , for a round number with . After the copy and rounds, the control holds the state of after steps and the offsets , where is the position of head of after steps. Head of is on block of its tape. Block of each tape holds the cells of the corresponding tape of after steps. Statement holds at the end of step 1, since the head positions of are at the start.
Step 3: a round, assuming and . Let be the block of head .
- Read (4 transitions). In parallel for each tape : the head of makes the moves if the block has , and the moves if it has . After the four transitions the head is on block again, and the control has read the blocks (if ), and of each tape.
- Decide (no transition). The control runs for up to steps from its state, in its memory, on the three blocks of each tape. This is possible because, in at most steps, head stays inside these three blocks. It starts at offset in block , and in steps it moves at most cells, so it stays in the cells to . If , the left block does not exist, and the head cannot move there, because the left-end rule keeps it on cell . The control knows when the head of is on cell : this holds exactly when and the offset is . Also, head cannot visit both the left block and the right block. To visit a cell of the left block (a cell with number below ) and a cell of the right block (number at least ), the head moves at least cells between the two visits, and it has only steps. So for each there is at most one neighbor block that the head visits.
- Halting. If halts within these steps, then halts at once, in transition of the round, with the same verdict.
- Write (2 transitions). Otherwise makes exactly steps and is not halted. Let be its new state and the new position of head . The final block is or the block . In transition the head of writes the new content of block (with its old end flag) and moves toward , or stays if does not exist. In transition it writes the new content of , with its old end flag, and moves to : it stays if , and it moves back to block if . If does not exist, it does nothing in transition . The control now holds and the offsets .
The blocks other than and do not change, because no head of visits them. So holds. Notice that the round uses transitions if does not halt, and transitions if it halts.
Step 4: correctness. By induction on using step 3, holds for every round with , and does not halt before round . In round the machine halts within the simulated steps, because . Then halts with the verdict of . So accepts exactly when accepts , for by this argument and for by step 1.
Step 5: time. Let . Step 1 takes at most transitions if and transition if . Rounds take transitions each, and round takes . So the total is at most
$$ (n + \lceil n/m \rceil) + 6(h - 1) + 4 = n + \lceil n/m \rceil + 6h - 2 \quad (n \ge 1), \qquad 1 + 6(h-1) + 4 = 6h - 1 \quad (n = 0). $$
In both cases it is at most , because . For the time is by step 1.
Step 6: the choice of and . Let , and (or larger, to meet the hypothesis on ). If , then . Let . Use and :
$$ T'(n) \le n + \frac{n}{m} + 1 + \frac{6,t(n)}{m} + 6 - 1 \le n + 6 + \frac{7,t(n)}{m} \le n + 6 + \frac{\varepsilon, t(n)}{2}, $$
because . Since , we have , so . Hence .