Compose Turing-Machine Subroutines
Construct a decider from two machines and account for output length, time, and reusable space.
Assignment sources
Related exam and assignment appearances
These links mark a related idea or close version; only groups explicitly marked as exact repeats in the question map count as duplicates.
Problem
Machine maps to in time and work space . Machine decides whether in time and space on inputs of length . Construct a multitape decider for and derive honest time and space bounds. State the assumptions needed when the intermediate output tape is reused.
Prerequisites
Know the unit definitions and how resources are measured against encoded input length. Distinguish a conditional theorem, a reduction, and an algorithm.
Hint 1
A machine cannot write more than a constant number of symbols per step.
Hint 2
Let be a separate bound on before composing resource functions.
Hint 3
For space, distinguish the read-only original input, stored intermediate string, and reusable work tapes.
Full solution
Use separate tapes for the original input, the intermediate value, and scratch work. First simulate on and leave on the intermediate tape. Reset the scratch tapes and simulate with as its input. Accept exactly when that simulation accepts. Because both component machines halt, the composition halts, and its correctness is immediate:
Let . In every conventional TM model with constant-size alphabet, writing one output symbol costs at least one step up to a constant, so . It is nevertheless clearer to keep explicit. On a multitape machine the direct bound is
The last term covers positioning or copying if expects its input in a standard place; it is absorbed by the other terms in usual models. Thus one may report , and then substitute when the resource functions are monotone. If both times and are polynomial, their composition is polynomial.
For space, the intermediate string physically occupies cells. During the first phase the machine uses scratch cells in addition to output. Those scratch tapes can be erased or simply reused in phase two; space is maximum simultaneous occupancy, not the sum over time. During phase two the occupancy is the stored plus scratch cells. Therefore
If the convention charges the output tape to 's space, then and the formula simplifies to . If output space is excluded, that simplification is invalid unless can consume a streamed representation.
On a single-tape TM, simulating the multitape construction can introduce a polynomial time overhead, but it does not invalidate a polynomial-time conclusion. The exact formula depends on the selected machine model, which is why the construction and accounting convention must be stated. The robust result is closure under composition with explicit control of intermediate length.
Checkpoints
Check both logical directions, halting of every relevant branch, and that output length and construction time are polynomial in the encoded input length.
Common mistakes
- Substituting instead of .
- Adding phase spaces rather than taking their maximum.
- Omitting the stored intermediate string when output space is free.
Sources and verification
- Merged summary, pp. 14-20
- 2026 transcript 2
- Sipser 3e, secs. 3.2 and 7.1
- Catalog mapping:
data/exercises.json; statements and solutions are independently written; personal submissions are non-authoritative.
Provenance and confidence
The exercise is an original synthesis. Confidence reflects verification of the mathematical claim against the textbook sources listed above; course sources are used only where direct coverage is identified.