Definition of NP Problem: Is it Yes or No?

  • Context: Undergrad 
  • Thread starter Thread starter ak416
  • Start date Start date
  • Tags Tags
    Definition
Click For Summary

Discussion Overview

The discussion centers around the definition of NP problems, specifically regarding the requirements for proving that a decision problem belongs to the NP class. Participants explore the nature of polynomial time certification and the validation of certificates for both affirmative and negative answers.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • Some participants propose that a decision problem is in NP if it has a polynomial time certification, questioning whether one must prove both affirmative and negative cases or just one.
  • Others clarify that the focus should be on validating a given certificate in polynomial time, regardless of whether the answer is yes or no.
  • A participant provides an example involving the Hamiltonian cycle problem, discussing the process of assuming a certificate exists and validating it in polynomial time.
  • Another participant introduces the concept of an "Oracle" to illustrate how verification of a solution can be performed in polynomial time, emphasizing the importance of checking necessary conditions for the solution.
  • There is a reiteration that if a problem is false, no certificate should be valid, while if it is true, at least one valid certificate must exist.

Areas of Agreement / Disagreement

Participants generally agree that the validation of a certificate is key to determining if a problem is in NP, but there is no consensus on whether both affirmative and negative cases need to be shown or if one suffices.

Contextual Notes

Some assumptions regarding the nature of certificates and the polynomial time validation process remain unresolved, particularly concerning the necessity of proving both cases for a decision problem.

ak416
Messages
121
Reaction score
0
(I asked this question also in Homework Help for Comp Sci and Engineering, but maybe someone in here can answer this)

Im just a little confused about the definition of an NP problem. The most common definition I hear is: a decision problem is in NP if it has a polynomial time certification. So if it is a yes or no question, there is a proof of it in polynomial time. But my question is, when proving a decision problem is in NP, do you have to assume the answer is yes and show a polytime certification exists and then assume the answer is no and show a polytime certification of that answer exists? Or do you choose either yes or no and show that a polytime certification of that answers exists?
 
Physics news on Phys.org
The thing required to be polynomial time is the algorithm that takes a certificate as input, and returns "valid" or "invalid".


(One thing to note -- if a problem is NP, then the certificate itself must occupy a polynomial amount of space! Otherwise, it couldn't be validated in polynomial time)
 
Last edited:
so for example if I want to prove that the problem: Does a graph G have a hamiltonian cycle? is NP, do I first assume there is a hamiltonian cycle and show that this can be certified in polynomial time, and then assume there isn't one, and show that this also can be certified in polynomial time?
 
No; you assume someone has handed you a certificate that asserts the answer, and show that you can validate the certificate in polynomial time.


Here's a short proof that finding a factor of a number is NP:

I'm going to define a certificate as follows:

. A certificate consists of a single number X, written in binary.
. 0 < X < N.
. If X = 1, the certificate is asserting that N is prime.
. Otherwise, the certificate is asserting that X is a nontrivial factor of N.


Here's a validation scheme.

Input: An n-bit number number N, and an alledged certificate for N.

. Read up to n + 1 bits of the certificate to obtain a number X.
. If the end of the certificate has not been reached, output "invalid"
. If X = 0, output "invalid"
. if X = N, output "invalid"
. If X = 1, run the AKS primality test on N
... If N passes the AKS test, output "valid"
... If N fails the AKS test, output "invalid"
. If X > 1, perform the division algorithm on N / X
... If the remainder is zero, output "valid"
... If the remainder is nonzero, output "invalid"


I have defined a certificate for the solution to the problem:

. Find a nontrivial factor of N, if one exists.

I have presented an algorithm for validating such a certificate.

The validation algorithm runs in polynomial time, therefore the problem of determining a nontrivial factor of N if one exists is in NP.
 
This is usually explained using an "Oracle". For example, suppose you have an Oracle who, when given a Graph of n nodes, and through some means, gives you back a Hamiltonian path for that graph.

Now you're interested in whether the Oracle made a mistake. So you verify that the path is a hamiltonian by checking the necessary conditions (i.e. that the path goes through every node exactly once). The process by which you verify the solution the Oracle gave you is the certificate.

If the process can be completed in polynomial time, then the problem is in NP.

So in order to determine whether the Hamiltonian Path problem is in NP you try to determine whether you can verify a solution to that problem in polynomial time.

In this case, it's easy. The oracle gives you a path. You check two things:
. That the path goes through every node.
. That the path goes through every node not more than once.

This can be done in O(n). Hence the Hamiltonian Path Problem has a certificate which runs in Polynomial time. So the HPP is in NP.
 
Hurkyl said:
No; you assume someone has handed you a certificate that asserts the answer, and show that you can validate the certificate in polynomial time.

Yes, absolutely. Also (not to disagree but to elucidate) you must show:
* If a particular instance of the problem is false, no certificate is valid.
* If a particular instance of the problem is true, some certificate is valid.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 4 ·
Replies
4
Views
1K
Replies
52
Views
4K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 54 ·
2
Replies
54
Views
7K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
3
Views
7K
  • · Replies 131 ·
5
Replies
131
Views
11K
  • · Replies 18 ·
Replies
18
Views
4K