-1

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

David Richerby
  • 82,470
  • 26
  • 145
  • 239
Mino Jende
  • 25
  • 2

2 Answers2

7

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.)

David Richerby
  • 82,470
  • 26
  • 145
  • 239
6

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.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514