Skip to content

Complexity Theory

6.1 Time Complexity

The running time of a deterministic TM MM on input ww is the number of steps MM takes before Halting. If MM never halts, the running time is \infty.

MM runs in time t(n)t(n) if for every input ww of length nn, MM halts within t(n)t(n) steps.

Theorem 6.1. Let t(n)t(n) be a function with t(n)nt(n) \geq n. Every TM that runs in time t(n)t(n) has An equivalent single-tape TM that runs in time O(t2(n))O(t^2(n)).

Proof. A kk-tape TM running in time t(n)t(n) uses at most t(n)t(n) tape cells on each tape. Simulating One step of the kk-tape machine requires scanning the single-tape simulation from left to right To read all kk heads, then left to right again to update them. This costs O(t(n))O(t(n)) per simulated Step. Over t(n)t(n) steps, the total is O(t(n)2)O(t(n)^2). \blacksquare

Theorem 6.1a (Time Hierarchy Theorem). If t1,t2t_1, t_2 are time-constructible functions with t1(n)logt1(n)=o(t2(n))t_1(n) \log t_1(n) = o(t_2(n))Then \mathrm{TIME(t_1(n)) \subsetneq \mathrm{TIME(t_2(n)).

Proof (idea). Use diagonalisation. Construct a TM DD that on input xx of length nn:

  1. Compute t2(n)t_2(n) (possible since t2t_2 is time-constructible).
  2. Simulate all TMs M1,M2,M_1, M_2, \ldots in parallel for t1(n)t_1(n) steps on input xx.
  3. If any MiM_i accepts xx within t1(n)t_1(n) steps, DD does the opposite (reject).
  4. Otherwise, accept.

DD runs in time O(t2(n))O(t_2(n)) and differs from every TM that runs in time O(t1(n))O(t_1(n)) on at least One input. \blacksquare

Corollary. \mathrm{P \subsetneq \mathrm{EXPTIME.

Definition. \mathrm{TIME(t(n)) = \{L : L \mathrm{ is decided by a deterministic TM in O(t(n))\}.

Definition. \mathrm{NTIME(t(n)) = \{L : L \mathrm{ is decided by a nondeterministic TM in O(t(n))\}.

6.2 The Class P

P=k1TIME(nk)\mathrm{P} = \bigcup_{k \geq 1} \mathrm{TIME}(n^k)

\mathrm{P is the class of languages decidable in polynomial time by a deterministic TM. This Captures the notion of “efficiently solvable.”

Examples of problems in P:

  • Path connectivity (BFS/DFS): O(V+E)O(V + E).
  • Shortest paths (Dijkstra): O((V+E)logV)O((V + E) \log V).
  • Sorting: O(nlogn)O(n \log n).
  • 2-SAT: O(n+m)O(n + m).
  • Primality testing: O(log6n)O(\log^6 n) (AKS algorithm).

6.3 The Class NP

NP=k1NTIME(nk)\mathrm{NP} = \bigcup_{k \geq 1} \mathrm{NTIME}(n^k)

Equivalent definition. A language LL is in NP if there exists a polynomial-time verifier VV And a polynomial pp such that:

L={w:cwithcp(w)andV(w,c)=accept}L = \{w : \exists c \mathrm{ with} |c| \leq p(|w|) \mathrm{ and} V(w, c) = \mathrm{accept}\}

The string cc is called a certificate (or witness).

Examples of problems in NP:

  • SAT: certificate is a satisfying assignment.
  • Clique: certificate is the set of vertices forming the clique.
  • Travelling Salesman (decision): certificate is the tour.
  • Subset Sum: certificate is the subset.
  • Graph 3-Colouring: certificate is the colouring.
  • Integer factorisation (decision version): certificate is a factor.

Theorem 6.2. \mathrm{P \subseteq \mathrm{NP.

Proof. Every deterministic polynomial-time algorithm is a special case of a nondeterministic one (with exactly one choice at each step). Alternatively, the certificate can be empty. \blacksquare

Theorem 6.2a. If ApBA \leq_p B and B \in \mathrm{NPThen A \in \mathrm{NP.

Proof. Let VBV_B be the polynomial-time verifier for BB and ff be the polynomial-time reduction. Then VA(w,c)=VB(f(w),c)V_A(w, c) = V_B(f(w), c) is a polynomial-time verifier for AA. \blacksquare

Open question: \mathrm{P = \mathrm{NP? This is the most important open problem in computer Science. Most researchers believe \mathrm{P \neq \mathrm{NP.

Consequences of P = NP. If \mathrm{P = \mathrm{NPThen every problem in NP (including SAT, Travelling Salesman, graph colouring, protein folding, etc.) would have polynomial-time algorithms. This would revolutionise optimisation, cryptography (RSA and most public-key systems would be broken), And artificial intelligence. However, after decades of research, no polynomial-time algorithm has Been found for any NP-complete problem, providing strong empirical evidence for \mathrm{P \neq \mathrm{NP.

6.4 NP-Completeness

A language BB is NP-complete if:

  1. B \in \mathrm{NPAnd
  2. ApBA \leq_p B for every A \in \mathrm{NP (polynomial-time mapping reduction).

A language is NP-hard if condition (2) holds (it need not be in NP).

Theorem 6.3 (Cook-Levin, 1971). \mathrm{SAT is NP-complete.

Proof (detailed sketch).

  1. \mathrm{SAT \in \mathrm{NP: a satisfying assignment is a polynomial-size certificate that can be verified in polynomial time.

  2. For any L \in \mathrm{NPThere is a polynomial-time NTM NN that decides LL in time nkn^k for some kk. Given input ww of length nnConstruct a Boolean formula ϕN,w\phi_{N,w} that is satisfiable iff NN accepts ww.

The formula encodes the tableau of NN on ww: a table of size nk×nkn^k \times n^k where each cell T[i,j]T[i, j] records the symbol at tape cell jj after step ii of the computation.

Variables: For each position (i,j)(i, j) in the tableau and each symbol ss in the combined state-tape alphabet Γ"=Q×Γ\Gamma" = Q \times \GammaA variable xi,j,sx_{i,j,s} indicating that cell (i,j)(i, j) contains ss.

Constraints:

  • Well-formedness: Each cell contains exactly one symbol. For each (i,j)(i, j): exactly one of \{x_{i,j,s} : s \in \Gamma} is true.
  • Start configuration: Row 0 encodes q0q_0 at position 0, w1w_1 at position 1, etc.
  • Transition correctness: For every 2×32 \times 3 window of the tableau, the bottom row must be a valid successor of the top row according to NN‘s transition function.
  • Acceptance: Some cell in the last row contains q_{\mathrm{accept}.

Each constraint can be expressed as a polynomial-size CNF formula (using standard encodings of “exactly one” and “window” constraints). The total formula has size O(n2k)O(n^{2k})Which is polynomial in w|w|. \blacksquare

Worked Example: Cook-Levin tableau construction (simplified)

Consider an NTM NN that decides a language LL in time n2n^2. On input w=01w = 01 (length n=2n = 2), The tableau is a 4×44 \times 4 grid (since n2=4n^2 = 4).

The formula ϕN,w\phi_{N,w} has variables for each cell. For instance, x0,0,q0x_{0,0,q_0} indicates That position (0,0)(0,0) contains the start state. The constraints enforce:

  • Row 0: q0q_0 at position 0, 0 at position 1, 1 at position 2, \sqcup at position 3.
  • Transition windows: each 2×32 \times 3 block must be consistent with δ\delta.
  • Row 3: at least one cell contains q_{\mathrm{accept}.

If NN accepts wwThen the accepting computation path provides a satisfying assignment (the tableau records that path). If ϕN,w\phi_{N,w} is satisfiable, the satisfying assignment Encodes a valid accepting computation.

Corollary 6.4. If any NP-complete problem is in P, then P = NP.

Theorem 6.5. If ApBA \leq_p B and B \in \mathrm{PThen A \in \mathrm{P.

Proof. To decide AA on input ww: compute f(w)f(w) in polynomial time (the reduction), then decide BB on f(w)f(w) in polynomial time. Total: polynomial time. \blacksquare

6.5 Classic NP-Complete Problems

3-SAT. Given a CNF formula with exactly 3 literals per clause, is it satisfiable?

Reduction: SAT p\leq_p 3-SAT. Replace each clause with more or fewer than 3 literals by Equivalent clauses with exactly 3 literals using auxiliary variables.

Theorem 6.5a. SAT p\leq_p 3-SAT.

Proof. Given a CNF formula ϕ\phiConvert each clause to exactly 3 literals:

  • Clause (l1)(l_1) (1 literal): replace with (l1ab)(l1abˉ)(l1aˉb)(l1aˉbˉ)(l_1 \lor a \lor b) \land (l_1 \lor a \lor \bar{b}) \land (l_1 \lor \bar{a} \lor b) \land (l_1 \lor \bar{a} \lor \bar{b}) where a,ba, b are new variables. This is satisfiable iff l1l_1 is true.
  • Clause (l1l2)(l_1 \lor l_2) (2 literals): replace with (l1l2a)(l1l2aˉ)(l_1 \lor l_2 \lor a) \land (l_1 \lor l_2 \lor \bar{a}) where aa is new. Satisfiable iff l1l2l_1 \lor l_2 is true.
  • Clause (l1l2l3)(l_1 \lor l_2 \lor l_3): leave as is.
  • Clause (l1lk)(l_1 \lor \cdots \lor l_k) for k>3k \gt 3: replace with (l1l2z1)(zˉ1l3z2)(zˉk4lk1lk)(l_1 \lor l_2 \lor z_1) \land (\bar{z}_1 \lor l_3 \lor z_2) \land \cdots \land (\bar{z}_{k-4} \lor l_{k-1} \lor l_k) where ziz_i are new variables. Satisfiable iff the original clause is satisfiable.

Each transformation is polynomial-size and preserves satisfiability. \blacksquare

Vertex Cover. Given a graph G=(V,E)G = (V, E) and integer kkIs there a vertex cover of size k\leq k?

Theorem 6.5b. 3-SAT p\leq_p Vertex Cover.

Proof (sketch). Given a 3-CNF formula ϕ\phi with kk clauses and nn variables, construct a graph GG:

  1. For each variable xix_iCreate a variable gadget: two vertices xix_i and xˉi\bar{x}_i connected by an edge. Selecting xix_i into the cover corresponds to setting xix_i to true (removing xˉi\bar{x}_i from consideration).
  2. For each clause Cj=(lalblc)C_j = (l_a \lor l_b \lor l_c)Create a clause gadget: a triangle of three vertices connected to the corresponding literal vertices in the variable gadgets.
  3. Set the target: k=n+2kk' = n + 2k.

The cover must include at least one endpoint of each variable-gadget edge (nn vertices) and at Least two vertices from each clause triangle (2k2k vertices). Selecting a literal vertex in the Cover removes it from clause consideration; the remaining two triangle vertices must be in the Cover. The formula is satisfiable iff we can choose literal vertices such that each clause triangle Has at most one vertex already excluded. \blacksquare

Clique. Given G=(V,E)G = (V, E) and integer kkDoes GG contain a clique of size kk?

Reduction: Vertex Cover p\leq_p Clique. G=(V,E)G = (V, E) has a vertex cover of size kk iff G=(V,E)\overline{G} = (V, \overline{E}) has a clique of size Vk|V| - k.

Proof. If CVC \subseteq V is a vertex cover of size kk in GGThen every edge of GG has at Least one endpoint in CC. So VCV \setminus C is an independent set in GGMeaning every pair in VCV \setminus C is an edge in G\overline{G}. Hence G\overline{G} has a clique of size Vk|V| - k. The converse is analogous. \blacksquare

Hamiltonian Path. Given a graph G=(V,E)G = (V, E)Does GG have a path visiting every vertex exactly Once?

Theorem 6.5c. Vertex Cover p\leq_p Hamiltonian Path (via Hamiltonian Cycle).

Proof (sketch). Given (G,k)(G, k) for Vertex Cover, construct a graph GG' such that GG has a Vertex cover of size kk iff GG' has a Hamiltonian cycle. The construction uses selection gadgets That choose kk vertices (the cover), verification gadgets that check every edge is covered, and Connecting gadgets that string the selections together into a single cycle. The construction is Polynomial. \blacksquare

Subset Sum. Given integers S={s1,,sn}S = \{s_1, \ldots, s_n\} and target TTIs there a subset summing To TT?

Theorem 6.5d. 3-SAT p\leq_p Subset Sum.

Proof (sketch). Given a 3-CNF formula with variables x1,,xnx_1, \ldots, x_n and clauses C1,,CkC_1, \ldots, C_kConstruct a set of numbers SS and target TT in decimal.

For each variable xix_iCreate two numbers viv_i and vˉi\bar{v}_i. In the “variable digits” (first nn columns), viv_i has a 1 in column ii and 0 elsewhere; vˉi\bar{v}_i also has a 1 in column ii and 0 elsewhere. This forces choosing exactly one of vi,vˉiv_i, \bar{v}_i.

For each clause CjC_jAdd a “clause digit” (column n+jn + j): in viv_i (resp. vˉi\bar{v}_i), This digit is 1 iff xix_i (resp. xˉi\bar{x}_i) appears in CjC_j. The target TT has 1 in Every digit. Choosing viv_i or vˉi\bar{v}_i contributes to satisfying the clauses that contain That literal. \blacksquare

Partition. Given integers S={s1,,sn}S = \{s_1, \ldots, s_n\}Can SS be partitioned into two subsets of Equal sum?

Reduction chain:

SAT3SATVertexCoverClique\mathrm{SAT} \to \mathrm{3}\mathrm{-SAT} \to \mathrm{VertexCover} \to \mathrm{Clique}

SAT3SATHamiltonianPath\mathrm{SAT} \to \mathrm{3}\mathrm{-SAT} \to \mathrm{HamiltonianPath}

SAT3SATSubsetSumPartition\mathrm{SAT} \to \mathrm{3}\mathrm{-SAT} \to \mathrm{SubsetSum} \to \mathrm{Partition}

SAT3SATSubsetSumPartition\mathrm{SAT} \to \mathrm{3}\mathrm{-SAT} \to \mathrm{SubsetSum} \to \mathrm{Partition}

Worked Example: Reducing 3-SAT to Independent Set

Given a 3-CNF formula ϕ\phi with kk clauses, construct a graph GG:

  1. For each clause CjC_jCreate a group of 3 vertices (one per literal).
  2. Within each group, add all three edges (forming a triangle) — at most one vertex per group can be in an independent set.
  3. For each pair of contradictory literals (xix_i and xˉi\bar{x}_i) in different groups, add an edge — they cannot both be selected.

Set the target to kk (one vertex per clause). An independent set of size kk exists iff ϕ\phi Is satisfiable: selecting one literal per clause without contradiction gives a consistent Satisfying assignment. \blacksquare

6.6 Space Complexity

Definition. \mathrm{SPACE(s(n)) is the class of languages decidable by a deterministic TM Using O(s(n))O(s(n)) tape cells. \mathrm{NSPACE(s(n)) is the nondeterministic analogue.

Key classes:

  • \mathrm{L = \mathrm{SPACE(\log n) — logarithmic space.
  • \mathrm{NL = \mathrm{NSPACE(\log n) — nondeterministic logarithmic space.
  • \mathrm{PSPACE = \bigcup_{k \geq 1} \mathrm{SPACE(n^k).

Theorem 6.6 (Savitch, 1970). \mathrm{NSPACE(s(n)) \subseteq \mathrm{SPACE(s(n)^2) For s(n)logns(n) \geq \log n.

Proof (sketch). To decide whether an NTM using space s(n)s(n) accepts, we check reachability in the Configuration graph. The graph has at most N=Γs(n)s(n)QN = |\Gamma|^{s(n)} \cdot s(n) \cdot |Q| nodes, where Γ|\Gamma| is the tape alphabet size and Q|Q| the number of states. A deterministic TM can decide Reachability using the recursive algorithm \mathrm{REACH(u, v, d) (can uu reach vv in at most dd steps?), which uses O(logN)=O(s(n))O(\log N) = O(s(n)) space and recurses to depth O(logN)O(\log N). Total space: O(s(n)logN)=O(s(n)2)O(s(n) \cdot \log N) = O(s(n)^2). \blacksquare

Corollary 6.7. \mathrm{PSPACE = \mathrm{NPSPACE.

Proof. \mathrm{NPSPACE \subseteq \bigcup_k \mathrm{NSPACE(n^k) \subseteq \bigcup_k \mathrm{SPACE(n^{2k}) = \mathrm{PSPACE by Savitch’s theorem. \blacksquare

NL-completeness. A language BB is NL-complete if B \in \mathrm{NL and every A \in \mathrm{NL is log-space reducible to BB.

Theorem 6.8 (Immerman—Szelepcsényi, 1987). \mathrm{NL = \mathrm{coNL.

This is surprising because it is not known whether \mathrm{NP = \mathrm{coNP. The …/1-number-and-algebra/3_proof-and-logic uses An inductive counting argument: given an NTM for LLConstruct an NTM for L\overline{L} that Counts the number of reachable configurations.

PSPACE-completeness. A language is PSPACE-complete if it is in PSPACE and every PSPACE problem Reduces to it. Key PSPACE-complete problems:

  • TQBF (True Quantified Boolean Formula): Given a fully quantified Boolean formula ϕ=Q1x1Q2x2Qnxnψ(x1,,xn)\phi = Q_1 x_1 Q_2 x_2 \cdots Q_n x_n \, \psi(x_1, \ldots, x_n) where Qi{,}Q_i \in \{\forall, \exists\} and ψ\psi is a CNF formula, is ϕ\phi true?

Theorem 6.9. TQBF is PSPACE-complete.

Proof (membership). Evaluate the quantifiers recursively. For xiϕ\exists x_i \phiTry both values Of xix_i and recurse. For xiϕ\forall x_i \phiSimilarly. At depth nnEvaluate ψ\psi. Each level Uses O(n)O(n) space to store the current assignment, giving O(n2)O(n^2) total.

Proof (hardness). Reduce from any L \in \mathrm{PSPACE using the configuration graph. A Computation of a PSPACE TM on input ww of length nn uses at most p(n)p(n) cells for some Polynomial pp. The number of distinct configurations is at most N=Γp(n)p(n)QN = |\Gamma|^{p(n)} \cdot p(n) \cdot |Q| Which is exponential. The statement ”MM accepts ww” can be expressed as: “there exists a Configuration c1c_1 reachable from the start configuration in N\leq N steps such that for all Configurations c2c_2 reachable from c1c_1 in one step, there exists a configuration c3c_3…” This alternating reachability formula can be encoded as a quantified Boolean formula of Polynomial size. \blacksquare

Worked Example: Evaluating a QBF formula

Evaluate ϕ=xy[(xy)(xˉy)]\phi = \forall x \exists y \, [(x \lor y) \land (\bar{x} \lor y)].

  • For x=0x = 0: need y\exists y such that (0 \lor y) \land (1 \lor y) = y \land \mathrm{true = y. So we need y=1y = 1 (which exists).
  • For x=1x = 1: need y\exists y such that (1 \lor y) \land (0 \lor y) = \mathrm{true \land y = y. So we need y=1y = 1 (which exists).

Since both values of xx lead to a satisfying assignment for yy, ϕ\phi is true.

6.7 The Polynomial Hierarchy

The polynomial hierarchy (PH) generalises the notions of NP and coNP through alternating Quantifiers.

Definition. Define the classes ΣkP\Sigma_k^P and ΠkP\Pi_k^P inductively:

  • Σ0P=Π0P=P\Sigma_0^P = \Pi_0^P = \mathrm{P}.
  • Σk+1P=NPΣkP\Sigma_{k+1}^P = \mathrm{NP}^{\Sigma_k^P} (NP with a ΣkP\Sigma_k^P oracle).
  • Πk+1P=coNPΣkP{\Pi_{k+1}^P} = \mathrm{coNP}^{\Sigma_k^P} (coNP with a ΣkP\Sigma_k^P oracle).
  • PH=k0ΣkP\mathrm{PH} = \bigcup_{k \geq 0} \Sigma_k^P.

Equivalent characterisation. A language LL is in ΣkP\Sigma_k^P iff there exist polynomial-time Computable relations RR and polynomials pp such that:

L={x:y1y2y3QkykR(x,y1,,yk)}L = \{x : \exists y_1 \forall y_2 \exists y_3 \cdots Q_k y_k \, R(x, y_1, \ldots, y_k)\}

Where each yip(x)|y_i| \leq p(|x|) and the quantifiers alternate, starting with \exists.

Examples:

  • Σ1P=NP\Sigma_1^P = \mathrm{NP}: “there exists a certificate.”
  • Π1P=coNP\Pi_1^P = \mathrm{coNP}: “for all certificates.”
  • Σ2P\Sigma_2^P contains problems like “does there exist a strategy for player 1 such that for all strategies of player 2, player 1 wins?” (for polynomial-size games).
  • Π2P\Pi_2^P contains the complement of such problems.

Relationships:

\mathrm{P \subseteq \mathrm{NP \subseteq \Sigma_2^P \subseteq \Sigma_3^P \subseteq \cdots \subseteq \mathrm{PH \subseteq \mathrm{PSPACE

Theorem 6.10. If ΣkP=Σk+1P\Sigma_k^P = \Sigma_{k+1}^P for some kkThen PH=ΣkP\mathrm{PH} = \Sigma_k^P (the polynomial hierarchy collapses to level kk).

Proof. If ΣkP=Σk+1P=NPΣkP\Sigma_k^P = \Sigma_{k+1}^P = \mathrm{NP}^{\Sigma_k^P}Then the ΣkP\Sigma_k^P oracle Provides no additional power. By induction, Σk+iP=ΣkP\Sigma_{k+i}^P = \Sigma_k^P for all i0i \geq 0 So PH=ΣkP\mathrm{PH} = \Sigma_k^P. \blacksquare

It is widely believed that PH\mathrm{PH} does not collapse.

6.8 Beyond NP

coNP. The class of languages whose complements are in NP. A problem is in coNP if every “no” Instance has a polynomial-time verifiable certificate.

  • Example: “Is this formula a tautology?” (the certificate for “no” would be a failing assignment).
  • PNPcoNP\mathrm{P} \subseteq \mathrm{NP} \cap \mathrm{coNP}.
  • It is unknown whether NP=coNP\mathrm{NP} = \mathrm{coNP}. If P=NP\mathrm{P} = \mathrm{NP}Then NP=coNP\mathrm{NP} = \mathrm{coNP}.

Theorem 6.11. If NPcoNP\mathrm{NP} \neq \mathrm{coNP}Then PNP\mathrm{P} \neq \mathrm{NP}.

Proof. If P=NP\mathrm{P} = \mathrm{NP}Then P=coNP\mathrm{P} = \mathrm{coNP} (since P\mathrm{P} Is closed under complement), so NP=coNP\mathrm{NP} = \mathrm{coNP}. The contrapositive gives the Result. \blacksquare

PSPACE. The class of languages decidable in polynomial space:

\mathrm{PSPACE = \bigcup_{k \geq 1} \mathrm{SPACE(n^k)

  • PNPPSPACE\mathrm{P} \subseteq \mathrm{NP} \subseteq \mathrm{PSPACE}.
  • PPSPACE\mathrm{P} \neq \mathrm{PSPACE} (space hierarchy theorem).
  • PSPACE-complete problems: TQBF, generalised geography, determining the winner of a position in certain games.

EXPTIME. The class of languages decidable in exponential time:

\mathrm{EXPTIME = \bigcup_{k \geq 1} \mathrm{TIME(2^{n^k})

  • PNPPSPACEEXPTIME\mathrm{P} \subseteq \mathrm{NP} \subseteq \mathrm{PSPACE} \subseteq \mathrm{EXPTIME}.
  • PEXPTIME\mathrm{P} \neq \mathrm{EXPTIME} (time hierarchy theorem).
  • EXPTIME-complete problems: Generalised chess, Go (on sufficiently large boards), determining the winner of a two-player game with exponential game tree.

Hierarchy summary:

\mathrm{Regular \subsetneq \mathrm{CFL \subsetneq \mathrm{Decidable \subsetneq \mathrm{TM\mathrm{-recognisable}

\mathrm{L \subseteq \mathrm{NL \subseteq \mathrm{P \subseteq \mathrm{NP \subseteq \mathrm{PSPACE \subseteq \mathrm{EXPTIME

\mathrm{P \subseteq \mathrm{NP \subseteq \mathrm{PH \subseteq \mathrm{PSPACE

InclusionKnown to be proper?Theorem used
RegularCFL\mathrm{Regular} \subseteq \mathrm{CFL}YesPumping lemma
CFLDecidable\mathrm{CFL} \subseteq \mathrm{Decidable}YesCYK algorithm
DecidableTMrecognisable\mathrm{Decidable} \subseteq \mathrm{TM}\mathrm{-recognisable}YesDiagonalisation
PEXPTIME\mathrm{P} \subseteq \mathrm{EXPTIME}YesTime hierarchy
PPSPACE\mathrm{P} \subseteq \mathrm{PSPACE}YesSpace hierarchy
NPPSPACE\mathrm{NP} \subseteq \mathrm{PSPACE}YesSavitch’s corollary
LNL\mathrm{L} \subseteq \mathrm{NL}Unknown
PNP\mathrm{P} \subseteq \mathrm{NP}UnknownOpen problem
NPcoNP\mathrm{NP} \subseteq \mathrm{coNP}UnknownOpen problem

Both inclusions PNP\mathrm{P} \subseteq \mathrm{NP} and NPPSPACE\mathrm{NP} \subseteq \mathrm{PSPACE} are Known to be proper (PPSPACE\mathrm{P} \neq \mathrm{PSPACE}), but the status of P\mathrm{P} vs. NP\mathrm{NP} remains open.

:::caution Common Pitfall NP-completeness refers to decision problems. The optimisation versions (e.g., “find the shortest Tour”) are NP-hard, not necessarily NP-complete. Also, “NP” stands for “Nondeterministic Polynomial Time,” not “Not Polynomial time.” Every problem in NP is verifiable in polynomial time; whether all Such problems are solvable in polynomial time is the P vs. NP question. A common error is confusing “NP-hard” with “NP-complete”: NP-hard means at least as hard as all NP problems, but the problem Itself might not be in NP (e.g., the halting problem is NP-hard but undecidable).

:::