Unit 2

Deterministic Complexity Classes

DTIME, DSPACE, P, and hierarchy ideas for deterministic computation.

Goals

  • Define DTIME\mathrm{DTIME}, DSPACE\mathrm{DSPACE}, and P\mathrm P.
  • Prove basic containments from resource bounds.
  • Understand why constructibility matters in hierarchy theorems.

Intuition

A class groups languages by an asymptotic resource budget. Unions over polynomial bounds avoid committing to a particular exponent and remain stable under polynomial simulation.

Formal definitions

DTIME(t(n))\mathrm{DTIME}(t(n)) and DSPACE(s(n))\mathrm{DSPACE}(s(n)) contain languages decidable by deterministic machines within those bounds. Define

P=⋃k≥1DTIME(nk),PSPACE=⋃k≥1DSPACE(nk).\mathrm P=\bigcup_{k\ge1}\mathrm{DTIME}(n^k),\qquad \mathrm{PSPACE}=\bigcup_{k\ge1}\mathrm{DSPACE}(n^k).

The other standard deterministic unions are

EXP=⋃k≥1DTIME(2nk),EXPSPACE=⋃k≥1DSPACE(2nk).\begin{aligned} \mathrm{EXP}&=\bigcup_{k\ge1}\mathrm{DTIME}(2^{n^k}),\\ \mathrm{EXPSPACE}&=\bigcup_{k\ge1}\mathrm{DSPACE}(2^{n^k}). \end{aligned}

Some books write EXPTIME\mathrm{EXPTIME} for EXP\mathrm{EXP}. The union absorbs fixed polynomial exponents but not a change from polynomial to exponential growth. All definitions concern worst-case bounds on halting deciders.

Guided construction

Complexity class containments

Step 1 of 4
Pdeterministic polynomial time
Proven containment

Read solid arrows as proved containments, not equalities. The basic chain is

P⊆PSPACE⊆EXP⊆EXPSPACE.\mathrm P\subseteq\mathrm{PSPACE}\subseteq\mathrm{EXP} \subseteq\mathrm{EXPSPACE}.

Claim. P⊆PSPACE\mathrm P\subseteq\mathrm{PSPACE}.

Proof walkthrough

Fix k≥1k\ge1 and prove DTIME(nk)⊆DSPACE(nk)\mathrm{DTIME}(n^k)\subseteq\mathrm{DSPACE}(n^k). Let L∈DTIME(nk)L\in\mathrm{DTIME}(n^k), and let MM be a deterministic decider that halts within nkn^k steps on every input of length nn.

Each step moves a work head by at most one cell. Therefore a run of at most nkn^k steps visits at most nkn^k work cells (up to a constant for bookkeeping absorbed in OO). Hence L∈DSPACE(nk)L\in\mathrm{DSPACE}(n^k).

Since this holds for every kk,

P=⋃k≥1DTIME(nk)⊆⋃k≥1DSPACE(nk)=PSPACE.\mathrm P=\bigcup_{k\ge1}\mathrm{DTIME}(n^k) \subseteq\bigcup_{k\ge1}\mathrm{DSPACE}(n^k) =\mathrm{PSPACE}.

The union closes the claim: no single exponent is required for all of P\mathrm P.

What this does not show. It does not prove P=PSPACE\mathrm P=\mathrm{PSPACE}, nor any separation. It also does not yield a tight space bound for a specific problem beyond the simulation.

The deterministic time hierarchy theorem says, under suitable time-constructibility and gap conditions, that more time decides strictly more languages. Its diagonal simulation needs enough extra time to interpret and simulate encoded machines.

Configuration counting and containments

Let a fixed deterministic machine use s(n)≥log⁡ns(n)\ge\log n work space. A configuration records its constant-size state, O(s(n))O(s(n)) work symbols, work-head positions, and an input-head position among n+1n+1 locations. Therefore there are at most

∣Q∣⋅∣Γ∣O(s(n))⋅2O(log⁡s(n))⋅O(n)=2O(s(n))|Q|\cdot |\Gamma|^{O(s(n))}\cdot 2^{O(\log s(n))}\cdot O(n) =2^{O(s(n))}

configurations. A halting deterministic run cannot repeat one: repetition would force an infinite loop. Hence, after adding a configuration counter (or detecting repeats), a space-s(n)s(n) decider halts within 2O(s(n))2^{O(s(n))} steps, so

DSPACE(s(n))⊆DTIME(2O(s(n))).\mathrm{DSPACE}(s(n))\subseteq \mathrm{DTIME}(2^{O(s(n))}).

Claim. PSPACE⊆EXP\mathrm{PSPACE}\subseteq\mathrm{EXP}.

Proof. Let L∈PSPACEL\in\mathrm{PSPACE}. Then for some kk, L∈DSPACE(nk)L\in\mathrm{DSPACE}(n^k). By the inclusion above,

L∈DTIME(2O(nk)).L\in\mathrm{DTIME}(2^{O(n^k)}).

There is a constant cc with time at most 2cnk2^{c n^k}. For a large enough exponent k′k' (e.g. k′=k+1k'=k+1), cnk≤nk′c n^k\le n^{k'} for all large nn, hence L∈DTIME(2nk′)⊆EXPL\in\mathrm{DTIME}(2^{n^{k'}})\subseteq\mathrm{EXP}.

The elementary fact that time bounds space gives EXP⊆EXPSPACE\mathrm{EXP}\subseteq\mathrm{EXPSPACE}. Together with P⊆PSPACE\mathrm P\subseteq\mathrm{PSPACE} this yields

P⊆PSPACE⊆EXP⊆EXPSPACE.\mathrm P\subseteq\mathrm{PSPACE}\subseteq\mathrm{EXP}\subseteq\mathrm{EXPSPACE}.

These inclusions do not establish whether adjacent classes are equal. Hierarchy theorems do imply P⊊EXP\mathrm P\subsetneq\mathrm{EXP} and PSPACE⊊EXPSPACE\mathrm{PSPACE}\subsetneq\mathrm{EXPSPACE}, but they do not resolve P\mathrm P versus PSPACE\mathrm{PSPACE}.

Constructibility

A function t(n)≥nt(n)\ge n is time-constructible if a deterministic TM, on an input of length nn, can produce or count exactly t(n)t(n) steps within O(t(n))O(t(n)) time. A function s(n)≥log⁡ns(n)\ge\log n is space-constructible if a machine can mark exactly s(n)s(n) work cells using O(s(n))O(s(n)) space. Standard bounds such as nkn^k, 2n2^n, and 2nk2^{n^k} satisfy appropriate constructibility conditions.

Constructibility lets the diagonal machine enforce its budget. Without it, a pathological numerical function may be large but not efficiently recognizable as a resource limit. The condition is therefore operational, not cosmetic.

Deterministic time hierarchy

One standard formulation says: if t1,t2t_1,t_2 are time-constructible and

t1(n)log⁡t1(n)=o(t2(n)),t_1(n)\log t_1(n)=o(t_2(n)),

then

DTIME(t1(n))⊊DTIME(t2(n))\mathrm{DTIME}(t_1(n))\subsetneq\mathrm{DTIME}(t_2(n))

for a standard multitape model. Exact logarithmic factors depend on simulation conventions.

Proof walkthrough

  1. Enumerate encoded deterministic machines M1,M2,…M_1,M_2,\ldots and arrange that descriptions occur at infinitely many padded lengths.
  2. Define a diagonal decider DD on input xx of length nn. Interpret part of xx as a machine description; malformed descriptions get a fixed answer.
  3. Use time constructibility to start a t2(n)t_2(n)-step clock.
  4. Universally simulate the encoded MM on xx for enough steps to cover its claimed t1(n)t_1(n) computation, including the simulator's logarithmic overhead.
  5. If the simulation accepts in budget, reject; otherwise accept.
  6. The gap condition ensures that interpretation, clocking, and simulation fit in O(t2(n))O(t_2(n)), so L(D)∈DTIME(t2)L(D)\in\mathrm{DTIME}(t_2).
  7. Suppose some t1t_1-time machine MiM_i decides L(D)L(D). Choose a sufficiently long padded input encoding MiM_i. The simulation completes, and DD returns the opposite of MiM_i on that same input, a contradiction.

The proof does not flip an answer after an unbounded simulation. The timeout and gap are exactly what make DD a decider in the larger class.

Application. For every fixed kk,

DTIME(nk)⊊DTIME(nk+1.1)\mathrm{DTIME}(n^k)\subsetneq\mathrm{DTIME}(n^{k+1.1})

under a suitable constructible formulation, because nklog⁡n=o(nk+1.1)n^k\log n=o(n^{k+1.1}). To derive P⊊EXP\mathrm P\subsetneq\mathrm{EXP}, diagonalize against all polynomial exponents within an exponential budget, or use a standard corollary of the hierarchy theorem.

Deterministic space hierarchy

A standard space hierarchy theorem says that if s1,s2s_1,s_2 are space-constructible, at least logarithmic, and s1=o(s2)s_1=o(s_2), then

DSPACE(s1(n))⊊DSPACE(s2(n)).\mathrm{DSPACE}(s_1(n))\subsetneq\mathrm{DSPACE}(s_2(n)).

Proof walkthrough

  1. Enumerate machines and use padded descriptions as diagonal inputs.
  2. The diagonal machine reserves O(s2(n))O(s_2(n)) cells and simulates the encoded machine without crossing that boundary.
  3. A simulation that attempts too much space is cut off.
  4. A machine might loop while staying inside the boundary, so a simple timer of s2(n)s_2(n) bits is insufficient. Instead count the at most 2O(s2(n))2^{O(s_2(n))} bounded configurations using O(s2(n))O(s_2(n)) counter bits.
  5. If the simulated machine halts, reverse its answer; if it exceeds the configuration count, it has repeated and can be treated as nonhalting.
  6. Space constructibility supplies the boundary, and the oo gap allows bookkeeping and self-interpretation.
  7. On a padded encoding of any purported s1s_1-space decider for the diagonal language, the output disagrees with itself.

Taking the union over polynomial versus exponential constructible bounds yields

PSPACE⊊EXPSPACE.\mathrm{PSPACE}\subsetneq\mathrm{EXPSPACE}.

Padding

Padding changes the relation between the meaningful instance size and total input length. For language LL and increasing padding function pp, define

Pad⁡p(L)={ x#1p(∣x∣)−∣x∣:x∈L }.\operatorname{Pad}_p(L)=\{\,x\#1^{p(|x|)-|x|}:x\in L\,\}.

If N=p(n)N=p(n), an algorithm costing 2O(n)2^{O(n)} on xx may become polynomial in padded length NN when p(n)=2Θ(n)p(n)=2^{\Theta(n)}. The padded language is a different language; padding does not magically speed up the original problem.

Example. If L∈DTIME(2n)L\in\mathrm{DTIME}(2^{n}), then on an input promised to have the form x#12∣x∣−∣x∣x\#1^{2^{|x|}-|x|}, simulate the original decider in 2∣x∣=O(N)2^{|x|}=O(N) time after checking the format. Thus the padded version lies in P\mathrm P. Parsing and validating the padding must be included.

Padding arguments can transfer hypothetical containments or equalities between scales. Their proof obligations are: define a uniquely parseable format, relate nn and NN, verify membership, and translate the resource bound in the correct direction.

Worked example

Graph reachability is in P\mathrm P: breadth-first search marks each vertex once and scans edges in polynomial time. The marks and queue also use polynomial space, illustrating the containment above.

Common mistakes

  • Reading P\mathrm P as “fast in practice.”
  • Assuming DTIME(n2)⊊DTIME(n3)\mathrm{DTIME}(n^2)\subsetneq\mathrm{DTIME}(n^3) without checking hierarchy hypotheses.
  • Using a runtime bound that excludes non-halting branches.
  • Treating a containment diagram as proof of strictness.
  • Omitting constructibility or the hierarchy gap.
  • Forgetting loop detection in a space-bounded diagonal simulation.
  • Claiming padding places the original, unpadded language in a smaller class.

Visualization prompt

Draw nested regions P⊆PSPACE⊆EXPTIME\mathrm P\subseteq\mathrm{PSPACE}\subseteq\mathrm{EXPTIME}; annotate known containments separately from unknown equalities.

Exercises

Exercise 1 — DTIME(nk)⊆DSPACE(nk)\mathrm{DTIME}(n^k)\subseteq\mathrm{DSPACE}(n^k)

Prove explicitly that for every k≥1k\ge1, DTIME(nk)⊆DSPACE(nk)\mathrm{DTIME}(n^k)\subseteq\mathrm{DSPACE}(n^k), and deduce P⊆PSPACE\mathrm P\subseteq\mathrm{PSPACE}.

Solution

Let L∈DTIME(nk)L\in\mathrm{DTIME}(n^k) with decider MM halting in nkn^k steps. Each step reaches at most one new work cell, so the number of work cells is at most nkn^k. Hence L∈DSPACE(nk)L\in\mathrm{DSPACE}(n^k).

Union over kk yields P⊆PSPACE\mathrm P\subseteq\mathrm{PSPACE}.

Exercise 2 — Placing a language in the chain

Language LL has a decider using n3n^3 work cells. Prove L∈PSPACEL\in\mathrm{PSPACE} and L∈EXPL\in\mathrm{EXP}. What cannot be concluded about membership in P\mathrm P?

Solution

Immediately L∈DSPACE(n3)⊆PSPACEL\in\mathrm{DSPACE}(n^3)\subseteq\mathrm{PSPACE}. By configuration counting there are 2O(n3)2^{O(n^3)} configurations, so there is a decider in time 2O(n3)2^{O(n^3)}, hence L∈EXPL\in\mathrm{EXP}.

This does not give L∈PL\in\mathrm P: the simulation is exponential. It also does not prove L∉PL\notin\mathrm P: a large upper bound is not a lower bound. If later an n100n^{100}-time algorithm appears, then L∈PL\in\mathrm P — membership is existential.

Exercise 3 — Time-hierarchy audit

Does the standard time-hierarchy theorem (with t1log⁡t1=o(t2)t_1\log t_1=o(t_2)) directly prove

DTIME(n2)⊊DTIME(n2log⁡n)?\mathrm{DTIME}(n^2)\subsetneq\mathrm{DTIME}(n^2\log n)?

Explain. Show how to separate n2n^2 from n3n^3 under the same hypotheses.

Solution

Not directly: the lower-class simulation overhead is already on the order of n2log⁡nn^2\log n, so there is no strict oo gap. This does not refute the claim; it shows the cited theorem is insufficient.

However n2log⁡n=o(n3)n^2\log n=o(n^3), so (subject to constructibility and model) the theorem yields DTIME(n2)⊊DTIME(n3)\mathrm{DTIME}(n^2)\subsetneq\mathrm{DTIME}(n^3).

Exercise 4 — Padding algebra

Suppose original time 2n22^{n^2} and padded length N=2nN=2^n. Prove the time as a function of NN is not polynomial. Which padding would make the simulation linear in NN?

Solution

From N=2nN=2^n we get n=log⁡Nn=\log N, hence

2n2=2(log⁡N)2=Nlog⁡N,2^{n^2}=2^{(\log N)^2}=N^{\log N},

which is not polynomial in NN. Padding by 2n2^n is too short.

If N=2n2N=2^{n^2}, then 2n2=N2^{n^2}=N, and the simulation is linear in NN (plus polynomial-in-NN format checks).

Exercise 5 — Polynomial versus quasipolynomial

Prove that 2O(log⁡n)2^{O(\log n)} is polynomial in nn, but 2O((log⁡n)2)2^{O((\log n)^2)} need not be.

Solution

We have 2clog⁡n=nΘ(c)2^{c\log n}=n^{\Theta(c)} — a polynomial power.

By contrast 2c(log⁡n)2=nO(log⁡n)2^{c(\log n)^2}=n^{O(\log n)}, which is not bounded by any fixed nkn^k for all nn. Hence it need not be polynomial.

Summary

Deterministic classes formalize scalable resource budgets. Elementary simulation gives containments, while diagonalization—under constructibility conditions—gives separations.

Guided theorem audit

Task 1 — Is the proof valid?

A student claims: “DTIME(n2)⊊DTIME(n2log⁡n)\mathrm{DTIME}(n^2)\subsetneq\mathrm{DTIME}(n^2\log n) because there is more time.” List the missing steps in the hierarchy proof template, and what can be salvaged.

Solution

Full template: (1) state theorem version and model; (2) constructibility and minimum bound; (3) compute the gap including overhead; (4) show the diagonalizer halts in budget; (5) choose a sufficiently padded self-input; (6) derive contradiction only against a smaller-class machine.

“More time” skips (2)–(3). For n2n^2 versus n2log⁡nn^2\log n the usual gap fails. A separation versus n3n^3 can be salvaged when n2log⁡n=o(n3)n^2\log n=o(n^3).

Failing a step does not necessarily refute the separation; it identifies a hole in the argument.

Task 2 — Space-bound audit

A decider uses n2n^2 cells. Bound the number of configurations and the halting time. When may one replace 2O(n2)2^{O(n^2)} by 2n22^{n^2}?

Solution

There are 2O(n2)2^{O(n^2)} configurations, so halting time is at most 2O(n2)2^{O(n^2)}. One may not automatically replace this by 2n22^{n^2} with coefficient 11 without computing constants.

For EXP=⋃kDTIME(2nk)\mathrm{EXP}=\bigcup_k\mathrm{DTIME}(2^{n^k}) the constant in the exponent is absorbed by a larger polynomial exponent. For a pointwise bound the constant matters.

Task 3 — Capstone: chain, hierarchy, and padding

  1. Explain why proving P⊊EXP\mathrm P\subsetneq\mathrm{EXP} cannot pick a single polynomial exponent.
  2. With padding N=n4N=n^4, translate times n12n^{12} and 2n2^n to the new length.
  3. What distinguishes an existential class separation from classifying a natural problem in EXP∖P\mathrm{EXP}\setminus\mathrm P?
Solution
  1. P\mathrm P is the union of all polynomial powers. Diagonalization must handle a machine enumeration together with exponents, or use a standard corollary of the hierarchy theorem.

  2. If N=n4N=n^4 then n=N1/4n=N^{1/4}. Time n12=N3n^{12}=N^3 remains polynomial; time 2n=2N1/42^n=2^{N^{1/4}} is not. Shrinking an exponential to a polynomial usually needs exponential padding.

  3. The hierarchy theorem builds a diagonal language in the difference; a natural problem needs a separate hardness argument. An exponential algorithm alone does not prove non-membership in P\mathrm P.

Sources

  • Student-summary evidence: merged course summary, pp. 6-24, 30, 36-39, 68-71, 107, and 129-135; used for course emphasis, not verification.
  • Course evidence: Semester A 2026 transcripts 2-4, deterministic classes, constructibility, and hierarchy arguments.
  • Verification: Sipser, 3e, pp. 275-279 and 321-335.
  • Verification: Arora-Barak draft, pp. 65-88.
  • Verification: Papadimitriou, pp. 139-154.