Is there a TM that halts iff P = NP? Is there a Turing machine that halts iff P = NP? There are Turing machines that halt iff the Goldbach conjecture is false, or the Riemann hypothesis is false. How about the P vs. NP question? This is an expressiveness question, but I have not seen such a construction before.
Update: There are competitions to construct the smallest TM that halts iff Goldbach is false. The current record is 27 states. Basically the TM puts successively larger even numbers in unary on the tape and checks if there is a cut dividing the unary even number into two primes. This is the spirit that I intended; my question is not about existential, nonconstructive arguments or provability from ZFC.
The answer to your question is formally &quot;yes&quot;. This is because one possible Turing machine that halts iff P=NP is either (i) a Turning machine that always halts or (ii) a Turing machine that never halts (regardless of its input).
However, the following argument might be closer in spirit to what you are asking:
Assume that $P=NP$ is not independent from the axioms you are (implicitly) using.
Since proofs are enumerable you could build a Turing machine $T$ that iterates over all &quot;candidate proofs&quot; that P=NP.
When a candidate proof $\pi$ is considered, $T$ checks whether $\pi$ is an anctual proof. If it is, $T$ halts immediately. If it isn't, $T$ continues with the next candidate proof.
It follows that $T$ halts iff $P=NP$.