The class NP, standing for Non-deterministic Polynomial time, is central to computational complexity theory and encompasses decision problems that have polynomial-time verifiers. A decision problem is one that requires a yes-or-no answer, and a verifier in this context is an algorithm that checks the correctness of a given solution.
It’s important to distinguish between solving a problem (computation) and verifying a solution (verification). In NP, the focus is on whether there exists a polynomial-time verifier that can confirm the correctness of a solution.
The class P, representing Polynomial time, includes decision problems that are solvable by a deterministic Turing machine within polynomial time. Thus, for every problem in P, not only is there a polynomial-time algorithm to find a solution, but there’s also a polynomial-time algorithm to verify a solution.
The seeming contradiction lies in the observation that every problem in P, inherently having a polynomial-time solving algorithm, also possesses a polynomial-time verifier. However, this doesn’t contradict the definition of NP. The defining feature of NP is the existence of a polynomial-time verifier, irrespective of how long it might take to find the solution. This means all problems in P are also in NP, as their solutions can be verified in polynomial time.
For example, consider the problem of prime number testing. This problem can be framed in two ways: generating prime numbers and verifying if a given number is prime. The Sieve of Eratosthenes is an algorithm for generating all prime numbers up to a certain limit and does so efficiently, but its time complexity is not polynomial in the strict sense used in computational complexity theory; it is often denoted as O(n log log n), which is better than linear but not strictly polynomial as per the definition of P. On the other hand, the problem of verifying whether a given number is prime (prime number testing) is a different task. Efficient algorithms such as the AKS primality test allow for prime verification in polynomial time. Therefore, the prime number testing problem, in the context of verification, falls into the class P, as well as NP, because a solution (whether a number is prime) can be verified in polynomial time. This demonstrates that while prime number generation and prime number testing are related, they involve different considerations in terms of computational complexity.
In conclusion, the definition of NP as having polynomial-time verifiers aligns with the nature of P. The distinction isn’t in the verification step but in the process of finding solutions: P problems are solvable and verifiable in polynomial time, while NP problems are verifiable in polynomial time, but it’s not always known if they can be solved in polynomial time.
Other recent questions and answers regarding Definition of NP and polynomial verifiability:
- Can a problem be in NP complexity class if there is a non deterministic turing machine that will solve it in polynomial time
- NP is the class of languages that have polynomial time verifiers
- Is verifier for class P polynomial?
- What is the difference between the classes P and NP in computational complexity theory, and how do they relate to the concepts of deciding and verifying membership in languages?
- Describe the process of constructing a polynomial time verifier from a polynomial time non-deterministic Turing machine.
- How can a polynomial time verifier be converted into an equivalent non-deterministic Turing machine?
- Explain the two equivalent definitions of the class NP and how they relate to polynomial time verifiers and non-deterministic Turing machines.
- What is polynomial verifiability and how does it relate to the class NP?

