Math 2.0

Computer science Definition

NP

Builds on Complexity classNondeterministic Turing machineTime complexityFormal languageP

Definition

Let Σ\Sigma be a finite alphabet. Let t ⁣:ℕ→ℕt \colon \N \to \N be a function. The class NTIME(t)\mathrm{NTIME}(t) is the set of languages L⊆Σ∗L \subseteq \Sigma^* decided by some nondeterministic Turing machine MM with the following property. On every input of length nn, every computation branch of MM halts within O(t(n))O(t(n)) steps. The complexity class NP is NP=⋃k∈ℕNTIME(nk).\mathrm{NP} = \bigcup_{k \in \N} \mathrm{NTIME}(n^k). Here a nondeterministic machine decides LL when an input ww lies in LL exactly when at least one branch accepts ww.

Remarks

Equivalent form with certificates: L∈NPL \in \mathrm{NP} exactly when there are a polynomial pp and a language V∈V \in P of pairs such that w∈L  ⟺  there is c∈Σ∗ with ∣c∣≤p(∣w∣) and (w,c)∈V.w \in L \iff \text{there is } c \in \Sigma^* \text{ with } \abs{c} \le p(\abs{w}) \text{ and } (w, c) \in V. The string cc is a certificate for ww, and a machine deciding VV is a verifier.

Example: the set of composite numbers, written in binary, is in NP. A certificate for mm is a factor dd with 1<d<m1 < d < m, which has at most as many digits as mm. The verifier checks that dd divides mm by one division, in polynomial time.

Non-example: a certificate whose length grows like 2∣w∣2^{\abs{w}} is not allowed, because the definition bounds ∣c∣\abs{c} by a polynomial in ∣w∣\abs{w}.

Every language in P is in NP, with the empty certificate, so P⊆NP\mathrm{P} \subseteq \mathrm{NP}. The name stands for "nondeterministic polynomial time".

Reading path

To understand this page from the ground up, read these 6 pages in order. The foundations come first.

Show the path as a graph
Each page uses the pages above it. The colour of the bar on a box shows how strong the evidence is, and the box also gives it as text. The list has the same pages.
  • no evidence level
  1. Complexity class concept
  2. Formal language concept
  3. Nondeterministic Turing machine concept
  4. P concept
  5. Time complexity concept
  6. NP definition

Further reading

  1. Web https://en.wikipedia.org/wiki/NP_(complexity)
About this page
TagSBDQH0TJ5X
URIm2://SBDQH0TJ5X
Kinddefinition
WritingW0 stub
MSC68Q15
DefinesNP
UsesComplexity class, Nondeterministic Turing machine, Time complexity, Formal language, P
Changed3 November 2026

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • a source with a locator (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.