r/AskComputerScience • • May 03 '25
If we can definitively say a problem is np-complete, then wouldn't that mean p != np?
Doesn't the existence of NP-completeness prove there is a difference?
0
Upvotes
3
u/tavianator May 03 '25
"If P is not N" what do you think this means? What is "N"?
4
u/New_Understanding595 May 03 '25
No.
We've proven many many problems to be NP complete, which means they are (in layman's term) the hardest NP can be.... But that still doesn't prove whether NP is equal to P or not.
Here's the 2 possibilities, and what that means
1
u/DisastrousLab1309 May 03 '25
It’s actually trivial - we can prove that one problem can be transformed into another in polynomial time. This is what defines the NP class equivalence.Â
We don’t know if it’s possible to solve any of those problems in P time. If we could then all of them could be solved in P time (since transformation is in P) and P would be equal to NP.Â
But we don’t know. Proving something is impossible is pretty hard. But we have good evidence that it’s the case that P!=NP.Â
1
u/dthdthdthdthdthdth May 03 '25
The complexity class P is defined as every decision problem, that can be solved by a Turing machine in time bound by a polynomial in the size of the problem.
The class NP is defined the same way, but with a non-deterministic Turing machine, i.e. a machine that can "magically guess correctly" the next step from a finite number of possible steps.
A problem is hard for a class, if any other problem in said class can be reduced to it (using some reduction function that doesn't leave that class, for NP the reduction has to be polynomial). Complete means in that class and hard for it.
So we can show, that problems are hard for P and hard for NP, without knowing whether P and NP are the same. To show, they are the same, would require to show, that a problem is hard for NP but actually solvable in P. And this has not been done.
1
u/Nebu May 04 '25
Assuming you're familiar with the definitions of "P", "NP", "NP-Complete" and "NP-Hard", I think the diagram on Wikipedia explains the two possibilities pretty well: https://en.wikipedia.org/wiki/NP_(complexity)#/media/File:P_np_np-complete_np-hard.svg
1
u/dreamingforward May 07 '25
Why don't people talk in real human language instead of this alien one? By NP complete, you're talking about an O(2^n) problem, where P= O(n^2) problem. They grow very differently and are not equal.
1
u/apnorton May 03 '25
There is no complexity class "N."
Reading the formal definition (and the associated diagram) may help you: https://en.wikipedia.org/wiki/NP-completeness#Formal_definition
An "NP complete" problem is one that is at least as hard as any other problem in NP --- i.e. if you can solve an NP-complete problem, you can solve any problem in NP. I'm not sure where you're making the leap from this to collapsing the complexity hierarchy.
1
u/falsifian May 03 '25
Why?
(I don't understand your follow-up sentence, "If P is not N".)
Here are a couple of facts, in case they're helpful:
-1
u/[deleted] May 03 '25 edited May 03 '25
Obviously either it's Polynomial or Non-Polynomial. It can't be both.
NP-complete means that not only is finding the solution NP, but verification of the solution is also NP.
For example, cracking the cryptographic expmod of a PKCS is NP. But verifying it is O(1), and 1 is a polynomial.
Finding the optimal traveling salesman path in a graph is NP, as is verifying that it's the optimal solution.