-1
$\begingroup$

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) The following problem is in NP: given a natural number, determine whether it is the product of two prime factors.

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?‌

$\endgroup$
  • $\begingroup$ This doesn't sound like anything but a homework problem. You should probably learn about NP before attempting to answer them. There is an excellent question on this site: In basic terms, what is the definition of P, NP, NP-Complete, and NP-Hard? $\endgroup$ – Pål GD Mar 15 '15 at 10:36
  • $\begingroup$ @PålGD, no, i not sure about (4), we must be honest, why homework? $\endgroup$ – Mino Jende Mar 15 '15 at 10:38
  • $\begingroup$ Re closure, I think that parts 2-4 are common enough misconceptions that they're worth addressing in an answer. Part 1 is covered in the reference question and the others might be too but it's hard to find something in the superbly detailed but very long answers there. $\endgroup$ – David Richerby Mar 15 '15 at 18:37
  • $\begingroup$ @DavidRicherby, they'd be worth addressing if the question was decent (e.g., it asked one question per question, the question showed what work the OP had done, etc.). If you would like to create a reference question to point others to, go for it, but I suggest creating 3 new questions, with one question per question -- a single question containing a list of 4 questions is not a good fit for the StackExchange format. $\endgroup$ – D.W. Mar 17 '15 at 6:41
  • $\begingroup$ @D.W. If I created a reference question, would I have to show my prior work in the question? No, of course not. So, for that criterion, you're basically saying that it would be OK if my name were at the bottom but not with somebody else's. That makes no sense. Subquestions are only bad when you end up with a bunch of answers that only cover some of the subquestions. But both of the answers to this question cover all four so that's not an issue. $\endgroup$ – David Richerby Mar 17 '15 at 8:57
6
$\begingroup$

If you define exponential time as $O(2^{n^k})$ for some $k$, then (i) is correct.

(ii) is almost correct – you have to exclude trivial problems (those in which all instances are yes instances or all instances are no instances).

What you describe (iii) is not quite a decision problem, so as stated it is not strictly true. The language consisting of all tuples $(n,k,i,b)$ such that the $k$th smallest prime factor of $n$ has $i$th bit equal to $b$ is in NP.

(iv) is incorrect – the empty language, for example, reduces to all NP-hard problems, but is not NP-hard itself. If some NP-hard problem Q reduces to a problem X then X is NP-hard: indeed any problem in NP reduces to Q (by definition of NP-hard), and through your reduction to X, and so by definition X is NP-hard.

$\endgroup$
7
$\begingroup$

I) each NP problem can be solved in Exponential Time.

Correct. This is covered by an answer to our reference question (search for the heading "Brute-Force/Exhaustive-Search Algorithms for NP and NP$\,\subseteq\,$ExpTime").

II) if P=NP then NP=NP-Complete.

Aaaaaaaalmost true. But false. The problems $\emptyset$ and $\Sigma^*$ are the only two that would not be NP-complete if P$\,=\,$NP. These two are the problem where the answer is always "no" and the problem where the answer is always "yes". These two problems can't be NP-complete because a reduction from $X$ to $Y$ is required by definition to map "yes" instances of $X$ to "yes" instances of $Y$, and map "no" instances to "no" instances. But $\emptyset$ has no "yes" instances and $\Sigma^*$ has no "no" instances so you can't define a reduction from any other problem to one of those.

III) The following problem is in NP: given a natural number, determine whether it is the product of two prime factors.

True. This can be shown using the certificate definition of NP: a problem is in NP if there is a polynomial $p$ such that every "yes instance" $x$ of the problem has a certificate $y$ with $|y|\leq p(|x|)$ and there's a deterministic polynomial-time algorithm that, given an instance and a certificate, checks that the instance really is a "yes" instance.

In this case, the certificate is the two prime numbers. Given $x$ and prime numbers $y_1$ and $y_2$, we can check in polynomial time that $y_1$ and $y_2$ really are prime (using the AKS algorithm) and that $x$ really is $y_1y_2$.

IV) if problem X can reduce to a known NP-Hard problem, then X must be NP-HARD.

False. Informally, "$X$ reduces to $Y$" means "If I can solve $Y$, then I can solve $X$." However, if $Y$ is hard and solving $Y$ lets you solve $X$, that doesn't necessarily mean that solving $X$ was hard: going via $Y$ might have been a really dumb move. (Practical example: suppose you're hungry and have no food. If you had a Ferrari, you could sell the Ferrari and use the money to buy food. This is a reduction from the problem of getting food to the problem of getting a Ferrari. But that doesn't mean that getting food is as hard as getting a Ferrari.)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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