I want to show that $Primes \in NP$ an I've seen multiple proofs that use facts from number theory, like this one.
But isn't it much easier to proof $$Composites=\{x\in \mathbb{N}\cup\{0\}:x=1 \vee\exists p,q>1: x=pq\} \in NP$$ first and then doing a polynomial reduction on $Primes$?
Because I can make a simple Turin-Machine Verifier that goes like this...
TM M on input $(n, (p,q))$
- Check if $1<p,q<n$
- Check if $n=1$ or $n=pq$
- Check if $n\geq 1$
- If all the checks above are true, then accept. Else decline.
All the number specifications are clearly polynomial, multiplication is also polynomial $\Rightarrow Composites \in NP$
Now I want to find a polynomial reduction i.e. $Primes \leq_p Composites$
Clearly, $\overline{Primes}=Composites$, so we have $n \in Primes \Leftrightarrow n\notin Composites$
I define the function (Turing-Machine) $N$ on input $n$ simply as: If $n\in Primes$, decline. Else accept. (This TM runs in constant time)
Then, $n \in Primes \Leftrightarrow N(n) \in Composites$
Since $Primes \leq_p Composites$ and $Composites\in NP$ $\Rightarrow Primes\in NP$