`k`-tape Turing Machines
One way you might try to improve the power of a TM is to allow multiple tapes.
Definition. A `k`-tape TM, where `k ge 1` is an integer, is a six-tuple `M=(Q, Sigma, Gamma, delta, q_0, F)`
where `Q, Sigma, Gamma, q_0` are as in the 1-tape case. Now, however, the transition functions
is a map
`delta:Q times Gamma^k -> Q times Gamma^k times {L,R}^k`
- The transition allows the heads on each tape to move independently of each other.
- At the start of the computation the first tape has the input written on it and all the other tapes are blank.
- With a two tape machine, an algorithm for palindrome testing is easy:
- We set up the transition function so it first copies the first tape input to the second tape.
- Then it rewinds the first tape and leaves the second tape at the end of the input.
- Then the first tape moves right while the second tape moves left and we compare the two tape symbol by symbol. If they don't match we halt and reject. If the second tape gets back to the `\square` then we accept.
Simulating `k`-tapes with `1`-tape
Theorem. Given any `k`-tape machine `M` that operates within time `f(n)` deciding `L`, we can construct a `1`-tape machine `M'`operating within time `O((f(n))^2)` deciding `L`.
Proof. Let `M=(Q, Sigma, Gamma, delta, q_0, F)` be a `k`-tape machine.
- The idea is `M`'s tape alphabet, `Gamma`, is going to be expanded to include symbol `#` to denote the last used
square of a tape. We are also going to add to the new tape alphabet, `Gamma'`, a symbol `\ul{b}` for each symbol `b` in `Gamma`.
- A configuration of `M` can now be written as:
`(q, #w_1\ul{a_1}v_1#w_2\ul{a_2}v_2#ldots#w_k\ul{a_k}v_k#)`
Here the underscored character indicates the position of the tape head for the given tape.
- So except for the state, which we can keep track of in `Q'`, the rest of the configuration is a string over `Gamma'`.
- We will use new states in `Q'` to keep track of the state of `M` during a simulation step.
- To simulate `M`, we first convert the input into the initial configuration of `M` viewed as a string.
- Then to simulate a step we scan left to right the current configuration string, noting what symbol is being read by each tape in our finite control.
- Next we rewind the tape and we then do passes again to update each tapes configuration.
- In the worst case we need to expand the number of tape squares of each tape by `1`. So we could need `(k(f(|x|)+1)+1` passes to simulate `1` step of the `k`-tape machine.
- So simulating `f(|x|)` steps take at most `f(|x|)((k(f(|x|)+1)+1)` times which is `O((f(n))^2)`.