1
$\begingroup$

Forgive me if this is a stupid question - it's been a while since I thought at all about complexity theory and I want to make sure that I have covered all the possible angles with regards to the basics.

My question is, is it immediately true that class P is a subset of the class NP? That is, do we need to prove that the set of problems for which a solution may be obtained in polynomial time, is a subset of the class of problems for which a potential solution may be verified in polynomial time?

For example, consider a problem has multiple solutions and suppose that at least one of these solutions can be found by a program that runs in polynomial time. Then this problem is clearly in the class of P, since a solution can be found in polynomial time.

However, this does not tell us that all solutions are verifyable in polynomial time. Could it not be the case that some other solution to the problem is very difficult to verify?

$\endgroup$
0

1 Answer 1

1
$\begingroup$

P problems are a subset of NP problems. For a problem to be in P it must be decidable in polynomial time. For a problem to be in NP, it must be verifiable in polynomial time. If a problem is decidable in polynomial time, it is clearly verifiable in polynomial time as it can simply be verified by deciding it a second time. Therefore, all P problems are in NP.

I think that the fundamental component that you may not be remembering is that P and NP refer to specific time complexity classes of decision problems. Decision problems can't return general solutions. They can return yes (accept), no (reject), or never return.

$\endgroup$
4
  • $\begingroup$ What do you mean by "deciding it a second time."? Also, I wouldn't discard the statement immediately: if we interpret 'solution' here can be seen as a certificate (e.g. an assignment of variables for SAT), the statement makes sense (at least, there is something we can 'consider'). The usage of 'solution' here is a bit informal, but not uncommon, I believe. $\endgroup$
    – Discrete lizard
    May 6, 2018 at 21:14
  • $\begingroup$ Perhaps "deciding it a second time" is not a great way to phrase that. I mean that the decider and the verifier are equivalent in terms of complexity class. I was trying to indicate that any generated certificate is irrelevant, because we can already solve the problem directly in polynomial time. I see what you are saying about certificates, so I've removed the dismissive bit at the end. $\endgroup$
    – jncraton
    May 6, 2018 at 21:26
  • $\begingroup$ Any decision problem which is in NP must be in P though? Since we can use the verifier as the solver? So for decision problems P=NP? $\endgroup$
    – M Smith
    May 7, 2018 at 20:20
  • $\begingroup$ It isn't currently known if P=NP. To use the verifier as the solver requires brute-force search and testing over all possible solutions, and for NP problems this search space is superpolynomial, so the search can't be completed in polynomial time as far as we know. $\endgroup$
    – jncraton
    May 7, 2018 at 20:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.