I am reading the book [Arora2009] and working on Exercise 1.3, which asks:
EXERCISE 1.3. Complete the proof of Claim 1.6.
Claim 1.6 states:
Claim 1.6 Define a single-tape Turing machine to be a TM that has only one read-write tape, that is used as input, work, and output tape. For every $f: \{0, 1\}^* \to \{0, 1\}$ and time-constructible $T: \mathbb{N} \to \mathbb{N}$, if $f$ is computable in time $T(n)$ by a TM $M$ using $k$ tapes, then it is computable in time $5 k T(n)^2$ by a single-tape TM $\tilde{M}$. $\diamond$
The proof sketch says:
Again the idea is simple: The TM $\tilde{M}$ encodes $k$ tapes of $M$ on a single tape by using locations $1, k + 1, 2 k + 1, ...$ to encode the first tape, locations $2, k + 2, 2 k + 2, ...$ to encode the second tape etc. (see Figure 1.4). For every symbol $a$ in $M$’s alphabet, $\tilde{M}$ will contain both the symbol $a$ and the symbol $\hat{a}$. In the encoding of each tape, exactly one symbol will be of the “ˆ type,” indicating that the corresponding head of $M$ is positioned in that location (see Figure 1.4). $\tilde{M}$ will not touch the first $n + 1$ locations of its tape (where the input is located) but rather start by taking $O(n^2)$ steps to copy the input bit by bit into the rest of the tape, while encoding it in the above way.
To simulate one step of $M$, the machine $\tilde{M}$ makes two sweeps of its work tape: First it sweeps the tape in the left-to-right direction and records to its register the $k$ symbols that are marked by “ˆ”. Then $\tilde{M}$ uses $M$’s transition function to determine the new state, symbols, and head movements and sweeps the tape back in the right-to-left direction to update the encoding accordingly. Clearly, $\tilde{M}$ will have the same output as $M$. Also, since on $n$-length inputs $M$ never reaches more than location $T(n)$ of any of its tapes, $\tilde{M}$ will never need to reach more than location $2 n + k T(n) \leq (k + 2) T(n)$ of its work tape, meaning that for each of the at most $T(n)$ steps of $M$, $\tilde{M}$ performs at most $5 \cdot k \cdot T(n)$ work (sweeping back and forth requires about $4 \cdot k \cdot T(n)$ steps, and some additional steps may be needed for updating headmovement andbook keeping). $\blacksquare$
I am confused by the sentence:
"for each of the at most $T(n)$ steps of $M$, $\tilde{M}$ performs at most $5 \cdot k \cdot T(n)$ work (sweeping back and forth requires about $4 \cdot k \cdot T(n)$ steps, and some additional steps may be needed for updating head movement and bookkeeping)."
Could someone explain why simulating one step of $M$ requires about $5kT(n)$ steps in $\tilde{M}$? I especially want to understand the breakdown of the $4kT(n)$ sweeping cost and the additional overhead. Thank you!
Reference
[Arora2009] S. Arora and B. Barak, Computational Complexity: A Modern Approach, Cambridge University Press, 2009.
