4.6.21 · D1Theory of Computation

Foundations — Complexity — DTIME, DSPACE, complexity classes

2,328 words11 min readBack to topic

Before you can read the parent note, you need to be able to look at each squiggle — , , , , — and see what it means. This page builds every one of them from nothing. We go strictly in order: each symbol only uses symbols already defined above it.


0. The machine we are timing: a Turing machine

Everything here is measured on a Turing machine (TM). You do not need its full theory — just this picture.

Figure — Complexity — DTIME, DSPACE, complexity classes

The two things we will count are drawn right there:

  • how many steps the head takes before it stops → this becomes time,
  • how many distinct cells the head ever touches → this becomes space.

1. The input string and its length


2. A language — what a "problem" actually is

The symbol reads "is a member of"; reads "is not a member of".


3. Worst-case time and space

We count on a deterministic machine that halts (stops) on every input.

The symbol reads "the biggest value in this set". The colon : reads "such that". So = "the biggest step-count over all inputs of length exactly ".

Figure — Complexity — DTIME, DSPACE, complexity classes

4. The letter — Big-O, "grows no faster than"

Picture two curves: can wobble, but eventually it stays under a stretched copy of the reference curve. Big-O throws away constant factors and small- noise, keeping only the growth rate. Deeper treatment: Big-O Asymptotic Notation.

Figure — Complexity — DTIME, DSPACE, complexity classes

5. and the resource function


6. Now the class symbols make sense: ,

Everything above was scaffolding. Here is the payoff.

Decode it left to right with the symbols you now own:

  • — "the set of all languages such that …".
  • — "there exists" (at least one machine works).
  • deterministic ("D") — the machine's next move is fully forced; no choices. (Swap in "N" for nondeterministic and you get , — a machine that may guess, covered in NP-Completeness and Reductions.)
  • — using the Big-O budget from §4.

So is literally the bucket of all yes/no problems some ordinary machine can solve in at-most-quadratic time.

Recall What does the "D" stand for, and what changes if it becomes "N"?

D = deterministic (moves forced). N = nondeterministic — the machine may guess/branch; you only need one branch to accept. ::: D means one forced path; N lets the machine explore many paths and accept if any succeeds.


7. The exponent tower: , ,

The named classes are built by plugging specific 's in. Three shapes appear.

Figure — Complexity — DTIME, DSPACE, complexity classes

8. The union symbol — why classes are unions


9. Containment: and


10. The nested-exponent symbol


The prerequisite map

Turing machine steps and cells

Time T of n

Space S of n

Input string w and length n

Language a set of strings

Complexity class a bucket of languages

Big-O growth rate

DTIME and DSPACE

Budget function f of n

Named classes P NP L PSPACE EXP

Union over exponent k

Inclusions subseteq and subsetneq

2 to the O of f snapshots

Complexity hierarchy


Equipment checklist

Cover the right side; if you can answer each, you're ready for the parent note.

What does stand for, and where does it come from?
, the number of symbols in the input string .
What is a "language" in this subject?
A set of strings — exactly the inputs whose answer is YES.
Why is cost written as a function of instead of one number?
Programs slow down on bigger inputs, so we need one formula covering every input size and comparing growth rates.
What does mean in words?
The largest step-count over all inputs of length exactly — the worst case.
What does assert precisely?
There exist and with for all grows no faster than up to a constant.
Why do the DTIME/DSPACE definitions wrap the budget in ?
Speedup/compression theorems remove constant factors, so only the asymptotic growth is a real property of the problem.
What does the "D" in DTIME mean, and its "N" cousin?
D = deterministic (moves forced); N = nondeterministic (machine may guess/branch, accepts if any branch does).
How many bits store a counter up to , and which class is that?
About bits — that's the logspace budget .
Why is defined as a union ?
Different problems need different polynomial degrees, so we union over all exponents to hold them all.
Difference between and ?
= fits inside ; = fits inside AND has something extra ( strictly smaller).
Where does come from in the space-to-time argument?
It's the number of distinct machine configurations using cells; a halting machine can't repeat one, so it bounds the step-count.