Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
If a problem A known to be NP-Complete can be reduced to another problem B in polynomial time then B is
(A) NP-Complete
(B) NP-hard
Nothing is given about problem B whether it is in NP or not. I'm confused because in Hopcraft and Ullman book there is theorem given if a NP-complete problem P1 can be reduced to problem P2 in polynomial time then P2 is NP-complete. But it also required for a problem to be NP-Complete that it should belong to NP class. Guys help in understanding this concept.
If A can be reduced to B in polynomial time all you know is that B is harder than A. In your case, if A is NP-complete, B is NP-hard.
If B also happens to be in NP then B will be NP-complete (since NP-complete means being both in NP and being NP-hard at the same time).
However, nothing stops you from reducing A to a problem that is not in NP. For example, it is trivial to reduce any problem in NP to the halting problem - a problem that is undecideable in addition to being NP-hard:
Construct the following program:
Test all possible solutions for A.
If one of them is successful halt and otherwise enter an infinite loop.
A has a solution if-and-only if that program halts
Since problem A can be reduced to problem B in polynomial time, any solution to problem B can be used to find a solution to A. Or more simply, solving A cannot be harder than solving B. Since we know A is NP-complete, which class of problems is at least as hard as NP-complete problems?
For reference you might also want to take a look at the wikipedia articles on NP-Hard (specifically the 2nd sentence), NP-Complete.
and Reduction.
If A is NP-Complete, then it is also necessarily NP. This in turns means that every potential solution for A can be verified in polynomial time, which implies that the same is true for B (since A is reducible to B in polynomial time). Hence B is NP; it doesn't have to be stated as separate condition.
Related
I get that if you can do a polynomial time reduction from "every" problem then it proves that the problem is at least as hard as every problem in NP. Except, how do we know that we've discovered every problem in NP? Can't there exist problems that we may not have discovered or proven exist in NP but CANNOT be reduced to any np-complete problem? Or is this still an open question?
As others have correctly stated, the existence of the problem that is NP, but is not NP-complete would imply that P != NP, so finding one would bring you a million dollar and eternal glory. One famous problem that is believed to belong in this class is integer factorization. However, your original question was
Can't there exist problems that we may not have discovered or proven
exist in NP but CANNOT be reduced to any np-complete problem?
The answer is no. By definition of NP-completeness, one of two
necessary conditions for a problem A to be NP-complete is that every NP problem needs to be reducible in polynomial time to A. If you want to find out how to prove that every single NP problem can be reducible in polynomial time to some NP-complete problem, have a look at the proof of Cook-Levin theorem that states that 3-SAT problem is NP-complete. It was the first proven NP-complete problem and many other NP-complete problems are later proven to be NP-complete by finding the appropriate reduction from 3-SAT to these problems.
NP consists of all problems that could (theoretically) be solved by being able to make lucky guesses, guessing the solution and checking in polynomial time that the solution is correct. For example, the travelling salesman problem "can I visit the capitols of all 50 states of the USA with a trip of less than 9,825 miles" can be solved by guessing a trip and checking that it is not too long.
And one problem in NP is basically simulating a programmable computer circuit with various inputs and checking whether a certain output can be achieved. And that programmable computer circuit is powerful enough to solve all problems in NP.
So yes, we know all about all problems in NP.
(Then of course an NP complete problem can by definition be used to solve any problem in NP. If there is a problem that it cannot solve, that problem is not in NP).
Except, how do we know that we've discovered every problem in NP?
We don't. The set of all problems in the universe is not only infinite, but uncountable.
Can't there exist problems that we may not have discovered or proven
exist in NP but CANNOT be reduced to any np-complete problem?
We don't know that. We suspect that this is the case, but this hasn't been proven yet. If we were to find a NP problem that is not in NP-Complete, it would be proof that P =/= NP.
It is one of the great unsolved problems in CS. Many brilliant minds have been taking a go at it, but this nut has been one tough one to crack.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
this is my first question on this site.
I recently, study on NP. I have some confusion about this Topic, and want to propose my inference and some one verify me.
I) each NP problem can be solved in Exponential Time.
II) if P=NP then NP=NP-Complete.
III) Problem of factorization into 2-prime factor, is NP.
IV) if problem X can reduce to a known NP-Hard problem, then X must be
NP-HARD.
anyone can verify my inference and learn me?
I) each NP problem can be solved in Exponential Time.
Yes, this because it can be solved in polynomial time on Non Determinisitc Machine (definition of NP), and thus can be solved on a Deterministic Machine in exponential time.
II) if P=NP then NP=NP-Complete.
Yes, because if P=NP, "yes" and "no" answers for all NP problems are equivalently easy to achieve, run the polynomial time algorithm for the "yes" problem, and answer like it. Result is always correct and runs in polynomial time, assuming such a polynomial time machine exists.
III) Problem of factorization into 2-prime factor, is NP.
Yes. Given an number and its prime factorization - it is easy to verify if this is the correct answer (this is equivalent definition of problem being in NP).
IV) if problem X can reduce to a known NP-Hard problem, then X must be
NP-HARD.
No, it should be the other way around. You need to reduce a known NP-Hard Problem to X, and then you can tag X as NP-Hard.
Rememeber that every problem in NP has a reduction to SAT (Cook Levin theorem), and yet P != NP-Complete (or so we think at least)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
In wikipedia I found this diagram. I don't get how under the asumption p=np we get p=np=np-complete?
Not sure this is on topic for stack overflow (Theoretical Comp Sci), but NP-hard, as correctly visualized in the diagram is "the set of problems that are at least as hard as those in NP"; this includes problems that are worse than NP in one sense or another.
NP-complete problems are those problems in NP-hard that have a reducibility relationship with specific problems that are known to be in NP. Essentially, every problem that can be converted in polynomial time or better to a problem in NP-complete is just as hard as the others.
Here are a couple good snippets from CLRS that illustrate the issue:
The class NP consists of those problems that are “verifiable” in polynomial time. What do we mean by a problem being verifiable? If we were somehow given a "certificate” of a solution, then we could verify that the certificate is correct in time polynomial in the size of the input to the problem.
Informally, a problem is in the class NPC—and we refer to it as being NP-complete—if it is in NP and is as “hard” as any problem in NP.
A decidable language L is NP-complete if:
L is in NP, and
L' can be reduced to L in polynomial time for every L' in NP.
If a language L satisfies property 2, but not necessarily property 1, we say that L is NP-hard. We also define NPC to be the class of NP-complete languages.
(I may have the L' and L backwards there, the reducibility symbol is backwards from the way it is read in English.)
So what's the point? Well, you can just solve it with set theory: NP-complete is a subset of NP, and if P=NP, then NP-complete is a subset of P (in fact, they all become equal at that point, since you can solve any of them by first changing them to something your magic P-algorithm can work on). NP-hard still includes some NP-complete problems, but there are other problems outside, which are just hard.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I know that 3-SAT is polynomially reducable to INDEPENDENT-SET problem.
Now is an INDEPENDENT-SET problem polynomially reducable to 3-SAT problem ? Thus are these problems polynomially equivalent?
I think it is, as every instance of INDEPENDENT-SET problem according to me can be represented in 3-SAT ( in some cases after adding a few extra edges ). However I am not clear about this understanding of mine.
Please help me our here.
Yes, the independent set problem can be reduced to 3SAT in polynomial time. The decision problem "given a graph G and number k, is there an independent set in G of size at least k?" is in NP (do you see why?). Since 3SAT is NP-complete, all problems in NP are polynomial-time reducible to it, and therefore the independent set problem is reducible to it.
Hope this helps!
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
Subset problem is defined in Wikipedia as follows:
Given a set of integers, is there a non-empty
subset whose sum is zero? For example, given the set { −7, −3, −2, 5,
8}, the answer is yes because the subset { −3, −2, 5} sums to zero.
or
given a set of integers and an integer s, does any non-empty subset sum to s?
Brute force solution for this problem is exponential (cycle through all subsets of N numbers and, for every one of them, check if the subset sums to the right number), there some optimized version for brute force running in exponential time as well.
Let suppose there is an algorithm that can compute a brute force solution (exact solution to above questions) in between quadratic and polynomial time complexity
How it would be considered related to P=NP question, time complexity and so on?
Supposing algorithm exists, would be an improvement to state of the art for the subset sum problem?
(I'm not an expert on this area so if something does not make sense or is not clear I'll provide additional input to this question to the extent I'm able to :) )
Since the subset problem is NP-complete, if you can find a polynomial time solution to the problem, then you can solve all problems in NP in polynomial time, and P = NP.
Now, of course the above statement wouldn't make sense without understanding what NP and NP-completeness are. There are many ways to define NP problems, but the simplest way is that a problem is in NP if and only if there exists a verifier that can check the correctness of its solution in polynomial time. In the case of the subset sum problem, clearly you can verify its solution in polynomial time. Therefore, it's an NP problem.
The class NP-complete is a special set of problems in NP such that all problems in NP can be reduced to any problem in NP-complete in polynomial time. As an example, the first proven NP-complete problem by Cook is the SAT problem, where you try to decide if there exists a possible assignment to a set of boolean variables such that a boolean formula would evaluate to true. With the correct procedure, you can transform all decision problems in NP to SAT in polynomial time, and this makes SAT NP-complete. You can find more details about the original proof here, but it requires some understanding of the Turing machine.
To prove the NP-completeness of a new problem, you can try to reduce an existing NP-complete problem to the new one. As an example, we know that the SAT problem can be easily reduced to a 3-SAT problem. This means given a SAT problem, we can transform it into a 3-SAT version such that solving the equivalent 3-SAT problem would give us the result of the original SAT problem. Since all problems in NP can be reduced to SAT, and SAT can be reduced to 3-SAT, this makes the 3-SAT problem NP-complete.
Here is a nice proof of how you can reduce 3-SAT to the subset sum problem. As a consequence of the proof, the subset sum problem is NP-complete. Hence, if you can find a polynomial time solution to the subset sum problem, you can then solve all NP problems (yes, including problems such as the traveling salesman, graph coloring, knapsack, etc.) in polynomial time (since all reductions are done in polynomial time).