By definition, any problem in NP can be reduced to a problem in NP-Complete. However, let's say we have two arbitrary problems X and Y in NP. Is it necessarily true that X is reducible to Y?
I'm unclear on the aspect of reduction between two arbitrary problems of a particular complexity class, so any guidance would be appreciated.
In principle there is no reason why an arbitrary problem should be reducible to another.
For a concrete example, it is known that factorization of an arbitrary integer with n bits is in NP, but it is is believed to both not be in P and not to be NP-complete. Therefore traveling salesman is not reducible to integer factorization.
https://en.wikipedia.org/wiki/NP-intermediate has a list of other problems that are in the same category, and there is no reason to believe that, for example, graph isomorphism is reducible to factoring or vice versa.
Related
Definition 1 (usual definition)
A problem B is NP-Complete if
B is in NP
For C in NP, C is polynomal-time reducible to B
Definition 2 (in a few documents)
A problem B is NP-Complete if
B is in NP
if B admits a polynomial-time algorithm, then all problems in NP also admit a polynomial-time algorithm
(as in "On the Inherent Intractability of Certain Coding Problems,..., Berlekamp, McEliece and Tilborg" and other documents
Definition 1 is the definition of NP-completeness you get if you define reducibility to be polynomial-time mapping reducibility (sometimes called polynomial-time many-one reducibility). That is, you’re allowed to reduce one problem to another by doing polynomial work to transform the input, then make a single call to the target problem. This is the standard definition of NP-completeness.
Definition 2 is the (nonstandard) definition of NP-completeness you get if you use polynomial-time Turing reducibility (called Cook reductions), in which you are allowed to spend polynomial time including an arbitrary number of calls to an oracle (solver) for the problem you’re reducing to.
I am having difficulty understanding the relationship between the complexity of two classes of problems, say NP-hard and NP-complete problems.
The answer at https://stackoverflow.com/a/1857342/ states:
NP Hard
Intuitively, these are the problems that are at least as hard as the NP-complete problems. Note that NP-hard problems do not have to be in NP, and they do not have to be decision problems.
The precise definition here is that a problem X is NP-hard, if there is an NP-complete problem Y, such that Y is reducible to X in polynomial time.
If a problem Y can be reduced to X in polynomial time, should we not say that Y is at least as hard as X? If a problem Y is reducible to X in polynomial time, then the time required to solve Y is polynomial time + the time required to solve X. So it appears to me that problem Y is at least as hard as X.
But the quoted text above says just the opposite. It says, if an NP-complete problem Y is reducible to an NP-hard problem X, then the NP-hard problem is at least as hard as the NP-complete problem.
How does this make sense? Where am I making an error in thinking?
Your error is in supposing that you have to solve X in order to solve Y. Y might be actually much easier, but one way to solve it is to change it to an instance of X problem. And since we are in big O notation and in NP class we are way past linear algorithms, you can always safely discard any linear parts of an algorithm. Heck you can almost safely discard any polynomial parts until P=NP problem is solved. That means O(f(n) + n) = O(f(n)) where n=O(f(n)).
Example (which is obviously with neither NP-hard or NP-complete problems but just a mere illustration): You are to find the lowest number in an unsorted array of n numbers. There is obvious solution to iterate over the whole list and remember the lowest number you found, pretty straight-forward and solid O(n).
Someone else comes and says, ok, let's change it to sorting the array, then we can just take the first number and it will be the lowest. Note here, that this conversion of the problem was O(1), but we can for example pretend there had to be some preprocessing done with the array that would make it O(n). The overall solution is O(n + n*log(n)) = O(n * log(n)).
Here you too changed easy problem to a hard problem, thus proving that the hard problem is indeed the same or harder as the easy one.
Basically what the NP-hard problem difinition means is, that X is at least as hard as an NP-complete Y problem. If you find an NP-complete Y problem that you can solve by solving X problem, it means either that X is as hard or harder than Y and then it is indeed NP-hard, or if it is simpler, it means you found an algorithm to solve Y faster than any algorithm before, potentially even moving it out of NP-complete class.
Another example: let's pretend convolution is in my set of "complete", and normally takes O(n²). Then you come up with Fast Fourier Transformation with O(n * log(n)) and you find out you can solve convolution by transforming it to FFT problem. Now you came up with a solution for convolution, which is o(n²), more specifically O(n * log(n)).
Let I_X be the indicator function of X (i.e., 1 if the input is in X and 0 otherwise) and I_Y be the indicator function of Y. If Y reduces to X via a function f that can be computed in polynomial-time, then I_Y = I_X . f, where . denotes function composition. X is at least as hard as Y because, given an algorithm for I_X, the formula above gives an algorithm for I_Y that, for any class of running times closed under polynomial substitution (e.g., polynomial, exponential, finite), if the algorithm for I_X belongs to the class, then so does the algorithm for I_Y. The contrapositive of this statement is, if Y has no fast decision procedure, then X has no fast decision procedure.
Is this statement true or false : "If a problem A is polynomially reducible to a problem B, then problem B must also be polynomially reducible to A".
This is wrong, consider the reducible to relationship as its hardness is less than or equal. For example, if A is polynomially reducible to B, it means that A <= B in terms of hardness (amount of computation needed to solve it). If A is reducible to B it means that A is simpler than (or as hard as) B, which means if you can solve B you can solve A, as well.
Some supplementary information:
Any problem in P, which are problems that are simple and can be solved in polynomial time, is reducible to any problem in NP-complete (e.g. SAT). This means that problems in P are simpler than problems in NP-complete. Now, if your statement was true then problems in NP-complete would have been solved in polynomial time, which is seemingly impossible (no one has proved or disproved it). And if anybody solves it there will be chaos!!!
https://en.wikipedia.org/wiki/P_versus_NP_problem
SAT problem
A world with P=NP
Here is a (slightly edited) illustration from a very well-known graduate text on Complexity Theory (C.H. Papadimitriou, Computational Complexity). It shows what a reduction from A to B is.
A reduction from A to B is an algorithm for solving A that is composed of a translation R that maps every instance of A into an instance of B, and an algorithm for B. The translation must ensure that the answer for A(x) and for B(R(x)) is the same.
The existence of a such a translation does not guarantee that the inverse translation also exists. Intuitively the images of instances of A might form a subset of easy instances of B.
Anyone can easily suggest simple examples of problems where reduction in one direction does not guarantee a reduction in the other direction. For instance, 2-SAT is trivially reducible to SAT, yet 2-SAT is solvable in polynomial time, while SAT is NP-complete.
This is false. Consider the following problem:
Given a finite automaton, does it halt on a given input?
The answer to this problem happens always to be yes since all deterministic finite automata halt on all inputs. However, this problem is polynomial-time reducible to the following problem:
Given a Turing machine, does it halt on a given input?
The answer to this problem happens to be undecidable in the general case. This is the halting problem. However, if we had an oracle for this problem, we could certainly use it to answer the first question, albeit much less efficiently:
Produce a Turing machine equivalent to the DFA
Use the oracle to determine whether the Turing machine halts.
The halting problem for Turing machines, however, is not polynomial-time reducible to the halting problem for DFAs.
Assuming P != NP
The euler diagram shows a part not part of P and NP-complete. I read on wikipedia that this set is called NP-Intermediate.
Euler Diagram
I have some doubts as to how are NPI problems defined?
An NP-intermediate problem is a decision problem that
is in NP (that is, "yes" answers can be verified in polynomial time),
is not in P (that is, there is no polynomial-time algorithm for solving the problem), and
is not NP-complete.
That last criterion can be stated in a number of different ways. One way to say this is that there is no polynomial-time mapping reduction from SAT to that particular problem.
These problems are primarily of theoretical interest right now because we don't know if any NP-intermediate problems exist - if we could find one, we'd have a problem in NP that's not in P, meaning that P ≠ NP! However, they're interesting because if we can prove that P ≠ NP, then we know that there are some problems in NP that are too hard to be solved in polynomial time, but which aren't among the "hardest" of the hard problems in NP (the problems that are NP-complete).
In the event that P = NP, then there would not be any NP-intermediate problems because you couldn't have a problem in NP but not in P. If P ≠ NP, then Ladner's theorem guarantees at least one NP-intermediate problem exists, but does so by specifically constructing a problem that is highly artificial and designed solely to be NP-intermediate in that case. Right now, with a few exceptions (notably the graph isomorphism problem), all the problems we know of in NP are either squarely in P or known to be NP-complete.
I know if I reduce an NP-complete problem to a unknown problem P then I'm sure that P is itself NP-complete. And I know if I reduce a Problem P to an NP-complete problem there is no conclusion. So I want to give an example to show that we can reduce a Polynomial solvable problem P to an NP-complete one.
If I reduce an NP-complete problem to a unknown problem P then I'm
sure that P is itself NP-complete
No, this is not well formulated. If an NP-complete problem A is reducible to a problem P all we can say is that any problem in NP is reducible to P. To say that P is NP-complete we need to know additionally that P is itself in NP.
What you probably intended to say was
If I reduce an NP-complete problem to some a unknown problem P in NP then I'm
sure that P is itself NP-complete
Now to your original question.
give an example to show that we can reduce a Polynomial solvable
problem P to an NP-complete one
Consider the problem known as 2-SAT: Given a boolean formula in conjunctive normal form such that each disjunction contains at most two variables tell it if is satisfiable.
Solving this problem following an algorithm by Aspvall, Plass & Tarjan (1979) involves building an implication graph and finding all its strongly connected components. The paper proves that the formula is satisfiable if and only if the implication graph does not contain a strongly connected component that include some variable together with its negation. It also shows that this algorithm is linear in the size of the formula encoding.
So
there exists a linear algorithm for 2-SAT.
2-SAT is reducible to unrestricted boolean satisfiability problem known as SAT.
This gives an example of a polynomially solvable problem (2-SAT) that is reducible to an NP-complete problem (SAT).