3

I think PRIME (is the given number a prime number?) is a good example a decision problem. Therefore, when I'm trying to explain reduction, I'd like to give an example of a problem that is related to PRIME.

What are decision problems that can be reduced to PRIME, and how do these reductions look like?

What are decision problems that PRIME can reduce to, and how do these reductions look like?

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503
wannik
  • 133
  • 5
  • After I read your comment, I realized that question need to be edited. What I really want to know is the reduction, not the problem. There are lots of example of reduction for NP complete problem. But I cannot find reduction to or from PRIME – wannik Mar 28 '20 at 07:07
  • Are you interested in any particular notion of reduction? – Yuval Filmus Mar 28 '20 at 08:19
  • I'd like to see how to reduce a specific poly time decision problem to or from PRIME. I see a lot of reduction example in NP complete proof. But I think PRIME is an easy to understand. So I would like to see it in a reduction example. – wannik Mar 28 '20 at 08:32
  • 3
    PRIME is not very suitable to reductions, unfortunately. – Yuval Filmus Mar 28 '20 at 08:43
  • @YuvalFilmus I like PRIME because it is easy to be explained in term of language L = {10, 11, 101, 111, 1011, ...} Are there any other problem that can be easily explained in term of language and is more suitable to reduction? – wannik Mar 28 '20 at 08:52
  • 1
    You might like the problem described in this answer, in which an instance consists of three natural numbers. A simple problem which is actually about strings (an instance is a single string!) is described in this paper. – Yuval Filmus Mar 28 '20 at 09:08
  • @YuvalFilmus Thank you very much for the links. I like the Square problem. – wannik Mar 28 '20 at 13:23

1 Answers1

1

Assuming you're talking about polynomial-time reductions, since PRIME is in $P$, you can reduce it to any non-trivial decision problem (for which there is at least one instance with answer YES and at least one instance with answer NO). Moreover, any problem in $P$ can be reduced to PRIME.

To reduce an instance $I$ of PRIME to an instance $I_Q$ of non trivial decision problem $Q$, let $Y_Q$ and $N_Q$ be a YES and a NO instance for $Q$, respectively. The reduction is as follows: solve $I$ using a polynomial-time algorithm for PRIME. Then, let

$$I_Q = \begin{cases}Y_Q & \mbox{if $I$ is a YES instance}, \\ N_Q & \mbox{if $I$ is a NO instance}.\end{cases}$$

To reduce an instance $I_Q$ of a problem $Q \in P$ to an instance $I$ of PRIME, solve $I_Q$ using a polynomial-time algorithm for $Q$ and define

$$I = \begin{cases}2 & \mbox{if $I_Q$ is a YES instance}, \\ 1 & \mbox{if $I_Q$ is a NO instance.}\end{cases}$$

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503
Steven
  • 29,419
  • 2
  • 28
  • 49
  • I have a question. For the second part, does to reduce Q <= PRIME means to solve Q using PRIME algorithm? – wannik Mar 28 '20 at 08:10
  • 1
    Assuming we are talking about Karp reductions, it implies that you can solve an instance of $Q$ in polynomial time by using an algorithm for PRIME. The converse direction is not true (that would be: "if you can solve $Q$ in polynomial time using an algorithm for PRIME then $Q$ is Karp-reducible to PRIME"). A Karp reduction also maps YES instances of $Q$ to YES instances of PRIME and NO instances of $Q$ to NO instances of PRIME. – Steven Mar 28 '20 at 08:16
  • Thank you very much for the answer. – wannik Mar 28 '20 at 08:30