Given the following language:

$$L=\left\{\langle\phi, n\rangle \ \middle|\ \begin{array}{l}\phi\text{ is a satisfiable Boolean formula}\\ \text{written as POS (in CNF form)}\\ \text{and $n$ is a prime number}\end{array}\right\},$$

Prove that L is an NPC language.

This is the first time I'm trying to solve this kind of questions, and I am stuck.

This is what I have so far:

To prove that a language is NPC, I need to prove two things:

1) $L \in \mathrm{NP}$

2) For any $L'\in \mathrm{NP}$, there exists a poly-time reduction from $L'$ to $L$.

To prove (1), can I say that $\phi$ is NP (because we know that SAT is NP), and that $n$ is P (because Prime is P)?

If so, I think that I need to say that $\mathrm{P} \subseteq \mathrm{NP}$ to complete the proof of (1).

What's next?

  • $\begingroup$ "What's next?" -- Why, 2) of course! Our reference questions may be of help. $\endgroup$
    – Raphael
    Commented Feb 2, 2016 at 13:33

2 Answers 2


For 1): You have to prove that the language is solvable by a nondeterministic TM in polynomial time. The easiest way is indeed to use previously defined TMs, e.g. the TM to solve SAT. So your approach is correct.

For 2): You don't have to prove it for every $L'$ $\in$ $NP$ explicitly, it suffices to give a reduction from a language that is NP-complete. The idea is that you reduce every word $w' \in L'$ to a word $w \in L$, so if you find an efficient way to solve $L$, you also have an efficient way to solve $L'$. So you can choose any NP-complete language that should provide a simple reduction to $L$.

The next step therefore would be to choose such NP-complete language $L'$.

Next you have to find a reduction $f$ to reduce your previously chosen language $L'$ to your language $L$. Depending on your choice of $L'$, this can be a very simple process in your case. Note that $\{$ $f(w') \mid w' \in L \} \subseteq L$, not $\{$ $f(w') \mid w' \in L \} = L$


Below is not a general solution, but specific to the language given in the question. This technique is called restriction. Other widely used techniques are local replacement and component design. You can find these in the old text book of Garey and Johnson.

For 2) we know that $L' \leq SAT$ for all $L' \in NP$. So we only need to prove $SAT \leq L$, just reduce $\phi \rightarrow \langle\phi,2\rangle$. This will give us $\phi \in SAT$ iff $\langle\phi,2\rangle \in L$.

Then $\forall L' \in NP, L' \leq SAT \leq L$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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