# Do all NP complete problem have polynomial verifier?

Say we want to factor a large number.

Factoring it is in NP.

Verifying it is definitely in P.

However, how do we know that there is no other factors besides the one we found?

So it seems that verifying it isn't in NP either.

Now I am getting confused with NP definition here. I know that NP includes all P.

But then there is this side definition that NP are problems with polynomial verifier.

Is there a proof that all NP problems have P verifier?

If the answer is true, yes all NP problems and hence all NP complete problems have P verifier, then please tell me the proof.

• The title of the question does not seem to match the body. Commented May 19, 2017 at 15:52

A problem is in NP if and only if it has a polynomial verifier – that's the definition of NP. All NP-complete problems are in NP – that's part of the definition – and so have a polynomial verifier.

Factoring is not a decision problem, so it neither belongs to NP nor doesn't belong to NP. You can turn Factoring into a decision problem in many ways, for example asking if the $i$th bit of the $j$th factor of $n$ is equal to $b$. In that case a witness will be the list of factors of $n$. We can check that the factors multiply to $n$, and that they are all prime (since primality testing is in polynomial time).

(We are using here the unique factorization theorem, stating that a positive integer can be factored as a product of primes in a unique way. The same property doesn't hold in some more general situations.)

It is suspected that the decision problem corresponding to Factoring is not NP-complete, though it is certainly in NP, as the preceding paragraph shows.

• There are primality proofs which can be verified with a simpler and faster algorithm than the fastest known deterministic primality test. Commented May 19, 2017 at 23:15
• Factoring is not a decision problem… You can turn Factoring into a decision problem… What? Commented Apr 28, 2023 at 18:47
• A decision problem is one in which the answer is a single bit: belongs to the language or doesn't belong to the language. Factoring is not of this form. Commented May 1, 2023 at 6:08

Veryfying means that you have factored number correctly.

If you have factored number $C$ as $C = A_1 * A_2 * ... * A_n$ you can check if it's right by simply calculating ${\displaystyle \prod_{i=1}^{n} A_i}$ and testing if all $A$ are primes in polynomial time.

The N in NP stands for non-deterministic, the P for polynomial.

An non-deterministic polynomial algorithm can be expressed as a verifier where each choice for a non-deterministic step is part of the input. Simulating that is polynomial in the number of steps taken.

This means that every NP problem has a polynomial verifier.

• Oh so all NP problem have polynomial verifier. And that's the proof? Can I see that more. It seems that the "answer" to be "verified" must be a simulation of NP. What about if I want normal answer. For example, say I want to know if 3 and 7 is the prime factor that is farthest from the edge. Commented May 20, 2017 at 19:56
• a correct path through the simulation would include a list of choices made at each point the NP Turing machine could have made more than one. You can feed that list of choices into the verifier to get a polynomial time verification. Commented May 20, 2017 at 20:01