Models and Computational Resources
Turing machines, robust encodings, and the time and space measures used to compare computations.
Goals
- Define deterministic Turing-machine time and space.
- Explain why reasonable machine variants agree polynomially.
- Read a configuration graph as a computation.
Intuition
A model fixes what one elementary step can do. Resource bounds then make comparisons meaningful. Complexity classes are useful because ordinary deterministic models simulate one another with modest overhead.
Formal definitions
For a machine , let be the maximum number of steps on any input of length on which halts. Its space is the maximum number of work-tape cells visited; the read-only input is conventionally excluded. A configuration records the state, tape contents, and head positions.
A deterministic single-tape machine is a tuple
where is finite, , contains blank , and
On input , the tape initially contains followed by blanks, the head scans its first symbol, and the state is . One transition reads and writes one symbol, changes state, and moves one cell. A recognizer may loop on nonmembers; a decider halts on every input. Complexity classes below are defined using deciders.
Configurations and computations
Notation such as records tape content , state , and a head scanning . Write for one legal transition and for zero or more. A computation is
For a deterministic machine each nonhalting configuration has at most one successor. Therefore, if a run repeats a configuration, its unique future repeats forever and it cannot later halt.
Deterministic configuration graph
In the graph, identify the complete information in one node and follow its unique outgoing edge. A configuration is one snapshot, not the history leading to it.
Encodings and universal simulation
A machine is a finite object, so states, symbols, directions, and transition entries can be encoded as bits. A tuple encoding must be injective and efficiently decodable; raw concatenation is not enough because its boundary may be ambiguous. Invalid descriptions can be rejected or interpreted as a fixed trivial machine, provided the convention is explicit.
A universal machine interprets a machine description and input:
whenever the simulated computation halts, with the same result. It stores an encoded current configuration, finds the matching transition in , updates the encoding, and repeats. This is the formal basis for treating programs as data and later for diagonalization.
The overhead depends on the representation. If is fixed, constants may depend on ; if is part of the input, its length must be counted. Universality establishes controlled simulation, not equal running time.
Example. A parity machine scans right and toggles between “even” and “odd” states whenever it reads . At the first blank it accepts exactly when the state is “even.” It uses transitions. A universal machine given its table and returns the same answer, usually with extra interpretation time.
Robustness theorem. A multitape deterministic Turing machine running in time can be simulated by a standard one-tape machine in time , under standard conventions.
Proof walkthrough
Encode all virtual tapes on one physical tape, separated by delimiters, with marked head positions. One simulated step scans the used region, updates symbols, and possibly shifts data. Since at most cells have been reached after steps, each simulation step costs and the total is .
More explicitly:
- The simulator places the tapes on tracks with one marked cell per virtual head.
- A sweep collects the scanned symbols in finite control.
- The fixed transition table determines all writes and moves.
- A second sweep updates symbols and markers, extending the representation when needed.
- In steps, each head reaches at most cells, so the encoded region has length for fixed .
- Multiplying simulated steps by work per step gives .
For space, the tracks require only a constant-factor increase for fixed . Thus standard machine variants preserve asymptotic space, subject to the same input convention.
Measuring time and space
For a decider, the worst-case time is
The maximum exists because there are finitely many length- strings and every run halts. It includes yes- and no-instances. Space counts the maximum number of distinct work-tape cells touched. The usual model gives a separate read-only input tape, because charging its cells would make sublinear space impossible merely from input storage.
A time- machine reaches at most cells because a head moves one cell per step. Hence time bounds imply comparable space bounds. The converse fails: a bounded-space machine can revisit cells for a long time. Nevertheless, a halting fixed machine using space has only configurations, so it cannot run longer without repeating one.
Worked example
To decide whether a binary string has equally many zeros and ones, repeatedly cross off one uncrossed zero and one uncrossed one. This is polynomial time and linear space, although a counter-based multitape implementation is faster.
For a more detailed analysis, each round performs at most two full sweeps, costing , and there are at most rounds. The time is and the tape footprint is . Correctness follows from the invariant that every completed round has marked exactly one and one ; the machine accepts precisely when no unmatched symbol remains.
Common mistakes
- Counting input cells as work space without stating that convention.
- Assuming all models simulate RAM arithmetic at unit cost for arbitrarily large integers.
- Confusing a configuration with the full computation history.
- Saying “simulate” without bounding the cost of one simulated step.
- Omitting state or head position from a configuration.
- Claiming the one-tape simulation preserves exact time.
Visualization prompt
Draw configurations as nodes and legal transitions as edges; highlight one deterministic path and the bounded set of tape cells it visits.
Exercises
Exercise 1 — Decider for
Describe a single-tape decider for . Prove correctness via an invariant, prove halting, and derive time and space.
Solution
Construction. First scan and reject if a appears after a . Then, in each round: mark the leftmost unmarked , move right, mark one unmarked , and return. Reject if a mate is missing; accept when both kinds are exhausted together.
Invariant. After rounds exactly zeros and ones are marked, and the unmarked part is (unless already rejected as malformed).
Halting. Each round marks at least one new symbol, so there are at most rounds; each sweep ends at the tape end.
Resources. Each sweep costs and there are rounds, so time is . The tape footprint is , so space is .
Exercise 2 — Pair encoding
Prove that is not a valid pairing. Prove that is uniquely and efficiently decodable, and bound the encoding length.
Solution
Concatenation fails. Both and produce . The boundary is not unique.
Valid encoding. From , count leading zeros until the delimiter , read exactly that many bits as , and take the rest as . Decoding is unique and efficient (linear on a multitape TM). Length is .
Exercise 3 — Configuration transition
The machine is in state , reads , writes , moves right, and enters . Write the successor of . Handle explicitly.
Solution
Under the usual notation, the transition on yields .
If , the head moves onto a new blank: the successor is . Explicit edge handling prevents a missing configuration.
Exercise 4 — Time bounds space; repeated configuration
- Prove that a decider running in time uses space.
- Prove that in a deterministic machine, repeating a configuration implies non-halting from that point on.
Solution
-
Each step moves a head by at most one cell, so after steps at most cells have been visited.
-
Determinism gives a unique successor from every nonhalting configuration. If repeats, the path from onward is periodic and cannot reach a halting state that did not already appear in the cycle — in particular it cannot halt after the repetition.
Exercise 5 — Two-tape versus one-tape simulation
A two-tape machine copies an input of length and then makes passes over the copy. Bound time and space. What safe bound does the one-tape simulation theorem give? What does the theorem not claim?
Solution
Copying costs ; passes together cost ; total time . Space (reused cells counted once).
The one-tape simulation theorem gives the safe bound . It is only an upper bound: it does not claim the simulator must use that much time, nor that every linear-time multitape problem requires quadratic one-tape time.
Summary
Time counts steps, space counts reusable work cells, and configuration graphs expose both. Polynomial robustness depends on reasonable encodings and cost conventions.
Guided practice
Task 1 — Universality and quantifiers
A machine description has length and the input has length . Explain when decoding overhead may be absorbed into a constant, and when it may not. State the quantifiers.
Solution
If is fixed (not part of the input), is constant and decoding cost may depend on as a constant.
If is part of the input, depends on the input and must be counted. Time depends on .
The slogan “universal overhead is constant” requires immediate clarification of versus in the input.
Task 2 — Comparing palindrome machines
Single-tape machine decides palindromes by marking extreme pairs in rounds of sweeps. Two-tape machine copies and compares from both ends in time. Compare time and space, bound the one-tape simulation of , encode a configuration of that used work cells, and bound their number.
Solution
: time , space . : time , space . Same language, different times.
A general simulation of yields a one-tape machine in — matching 's order as an upper bound.
A configuration of : one state from a fixed set, contents of both visited regions, and a head mark on each tape. With cells used, encoding length is and there are encodings. This upper bound (not every string is legal) suffices for loop detection.
Task 3 — Resource checklist
State five mandatory questions before accepting a machine analysis as a resource proof, and answer them for the parity decider that scans right toggling even/odd states.
Solution
Questions: (1) Is the input convention explicit? (2) Does every run halt, including rejects? (3) Cost of one iteration and how many? (4) Are delimiters/description/moves counted? (5) Are distinct cells counted, not write events?
For parity: input on the tape; halts at the first blank accepting or rejecting; steps; no machine description in the input; work beyond the input (or on a writable single tape, by convention). Time .
Sources
- Student-summary evidence: merged course summary, pp. 1-7, 25-27, 86, 101-106, and 132; used for sequencing and course terminology, not final verification.
- Course evidence: Semester A 2026 transcripts 1-2, TM definitions, encodings, multitape and universal simulation.
- Verification: Sipser, 3e, pp. 165-181 and 205-212.
- Verification: Arora and Barak, Computational Complexity, draft pp. 21-42.
- Verification: Papadimitriou, Computational Complexity, pp. 19-35.
The pages this was written from
2 pages
These pages were chosen by word overlap between the text here and the page's transcription — nobody has verified them. Treat them as a lead to check, not a citation.
Lecture 1 · page 1מחלקות סיבוכיותShared wordsלקורס · מדדי · מודל · והמקום · אחרי · שלא
Lecture 21 · page 1סיבוכיות מקוםShared wordsלמדידת · סרטים · לקריאה · מודל · עבודה · ימינה