# Caleb Stanford

## ProvableP vs ProvableNP

logic complexity-theory math

### Introduction and Background

The $\mathsf{P}$ versus $\mathsf{NP}$ question asks: is it possible to determine whether a Boolean formula is satisfiable, in time polynomial in the length of the formula? Determining whether a Boolean formulas is satisfiable is called the SAT problem, and programs which solve the problem are called SAT solvers. SAT solvers are used in many modern programming tools (usually, for automatically solving some system of constraints), so the SAT problem is of great practical importance today. And it is often suggested that a solution to “$\mathsf{P}$ versus $\mathsf{NP}$” would resolve whether there exists any efficient algorithm at all for SAT.

There are a number of reasons why this suggestion could be wrong, or at least, a number of ways to argue against it. But here’s a particular thought: what if $\mathsf{P} = \mathsf{NP}$ (that is, SAT can be solved in polynomial time), but the polynomial-time algorithm is beyond our ability to find – and in particular, beyond our ability to prove correct? What if there exists some magic algorithm that happens to work, but there doesn’t exist any proof that it works? Or perhaps there doesn’t exist any proof that it runs in polynomial time? Such a scenario would be an unsatisfying resolution to $\mathsf{P}$ versus $\mathsf{NP}$, in a way: because practically speaking, we generally only trust algorithms that we can prove correct.

The question I’m trying to motivate is: does $\mathsf{ProvableP} = \mathsf{ProvableNP}$? That is, what happens if we restrict our attention to algorithms which can be proven correct? Is this question answerable, or is it just as hard as $\mathsf{P}$ versus $\mathsf{NP}$?

### Summary

It turns out that $\mathsf{P} = \mathsf{NP}$ if and only if $\mathsf{ProvableP} = \mathsf{ProvableNP}$. I’ll define what I mean by $\mathsf{ProvableP}$ and $\mathsf{ProvableNP}$. This post is adapted from a question and answer I made on Computer Science StackExchange.

### The ProvableP versus ProvableNP question

Fix a logic $\mathcal{L}$ that is strong enough to encode statements about Turing machines. By this I mean the same requirements as Godel’s second incompleteness theorem; but for the purposes of this question, just assume the following:

• $\mathcal{L}$ is consistent (it doesn’t prove False); and

• $\mathcal{L}$ implies the Peano arithmetic axioms of $\mathbb{N}$ (PA).

Then define

There’s an issue with this definition: how do we encode languages $A$ (of which there are uncountably many) as finite objects in order for the logic $\mathcal{L}$ to have something to say about them? In particular, how do we encode formulas for $[A \in \mathsf{P}]$ and $[A \in \mathsf{NP}]$? Let us assume that languages are subsets of the natural numbers $\mathbb{N}$, and that any $A$ in $\mathsf{ProvableP}$ or $\mathsf{ProvableNP}$ must be given by an arbitrary formula of the symbols of $\mathcal{L}$, i.e. it is any definable subset of $\mathbb{N}$.

From the definition we have that $\mathsf{ProvableP} \subseteq \mathsf{ProvableNP} \subseteq \mathsf{NP}$. But does $\mathsf{ProvableP} = \mathsf{ProvableNP}$? How does this relate to the original $\mathsf{P}$ vs $\mathsf{NP}$ question?

Obligatory warning: to my knowledge, this proof has not been rigorously checked by someone else :) But we now argue that

For the forward direction, assume $\mathsf{ProvableP} = \mathsf{ProvableNP}$, and consider any language $A$ in $\mathsf{NP}$. Note that $A$ is accepted by a nondeterministic Turing machine $N$, such that there exists a polynomial $p(n)$ which bounds the longest execution branch of $N$ on input a string of length $n$. Then let $N'$ be a nondeterministic Turing machine with the following description: first, count the input length $n$; second, calculate $p(n)$; and finally, runs $N$ for at most $p(n)$ steps nondeterministically. If $N$ doesn’t halt (this never actually occurs, but $N'$ doesn’t know that for sure), $N'$ rejects.

Now observe that $\mathcal{L}$ (more specifically, PA) proves that $N'$ runs in time $p(n)$. Moreover, $\mathcal{L}$ can describe “the language of strings accepted by $N'$” by a formula (roughly, “there exists an sequence of configurations such that the sequence is a run of $N'$ and ends in an accept state”). Then we have that $\mathcal{L}$ proves $[L(N') \in \mathsf{NP}]$. Therefore, $L(N') \in \mathsf{ProvableNP}$. But we know (even if $\mathcal{L}$ doesn’t) that $L(N') = L(N) = A$ by construction. So $A \in \mathsf{ProvableNP}$. But $\mathsf{ProvableNP} = \mathsf{ProvableP} \subseteq \mathsf{P}$, so $A \in \mathsf{P}$.

The backward direction is a similar trick. Assume $\mathsf{P} = \mathsf{NP}$ and that $A \in \mathsf{ProvableNP}$. Then $\mathsf{ProvableNP} \subseteq \mathsf{NP} = \mathsf{P}$, so $A \in \mathsf{P}$. From here, we know there is some Turing machine $M$ and polynomial $p(n)$ such that $M$ runs in time $p(n)$ and $L(M) = A$. Let $M'$ be a deterministic Turing machine which, on input of length $n$, first calculates $p(n)$, and then runs $M$ for at most $p(n)$ steps. If $M$ doesn’t halt, $M'$ returns a default value, say $0$.

Then similarly to before, $\mathcal{L}$ proves that $M'$ halts in time $p(n)$ and therefore that $[L(M') \in \mathsf{P}]$. it follows that $L(M') \in \mathsf{ProvableP}$, but we know (even if $\mathcal{L}$ doesn’t) that $L(M') = L(M) = A$. Thus, $\mathsf{ProvableNP} = \mathsf{ProvableP}$. $\quad \square$

## Coq Logo Vector Image

research miscellaneous

If you’re familiar with the Coq proof assistant, you may recognize their logo (a brown rooster shape). However, it’s difficult to find a good (high-resolution) image of their logo online — the image file on their website is a sad 66x100 pixels. Probably not good enough for use in a presentation or poster.

I made a vector version of the image (actually in September 2017) which I’m posting online now. This was made in Inkscape. The lines may differ very slightly from the original logo. I hope someone finds this useful!

Vector image (SVG):

500x804 image (PNG):

1000x1607 image (PNG):

## Traal -- Deciphered Scroll Messages

games

It happens to be an appropriate day of the year to share this short and elegant puzzle game: Traal by Alan Hazelden and Jonathan Wighting. (Also, if you like difficult elegant puzzle games, check out Alan Hazelden’s page. A Good Snowman Is Hard To Build is probably one of my favorite puzzle games on Steam.)

Actually, the reason I’m posting isn’t just to share some cool puzzle games; it’s because I googled for the deciphered texts of the scrolls in Traal, and couldn’t find anyone who had posted them. So, here they are (spoilers below).

There are 11 scrolls in the game. Here is what a scroll looks like:

### Deciphered Scroll Messages

Spoiler:

1. THE LAST PERSON TO FIND THIS WAS IMPALED WHILE GETTING OUT.

2. BEWARE STRANGER THIS IS AN EVIL PLACE NO GOOD WILL HAPPEN HERE.

3. ONLY A FOOL WOULD SUFFER GREAT DANGER FOR LITTLE GAIN.

4. THESE SCROLLS WILL NOT HELP YOU THEY EXIST FOR MY AMUSEMENT ALONE.

5. SOMETIMES ONE WILL SEE MORE WHEN ONE ONLY LOOKS AHEAD.

6. BROKEN GLASS CUTS DEEP AND NOTHING HERE CAN FIX IT.

7. THREE WISE EYES SEE NO EVIL SEE NO EVIL AND SEE NO EVIL.

8. EVIL TWINS ARE TWINS IN EVIL.

9. WHEN ALL EVIL FACES YOU WEAR ONLY DARKNESS.

10. AN END AWAITS YOU BEYOND HERE BUT IT IS NOT A PRETTY ONE.

11. WHATEVER YOU DO DO NOT COLLECT ALL OF THESE SCROLLS A TERRIBLE FATE AWAITS.

All of the messages are related directly to the rooms they are in, except for scrolls 2 and 4:

1. This is the scroll hidden behind the fake spikes and spike maze. Hence the (accurate) message about getting impaled on the way out.

3. This is the scroll in the optional side room. Hence, "great danger for little gain".

5. This is in the crossroads room that you can get through by only walking ahead.

6. This scroll is blocked behind a bunch of glass that you have to break.

7. This is in the room with three mushroom-shaped enemies ("three wise eyes")

8. This is in the room with two mushroom-shaped enemies ("twins").

9: This is in the room that requires a blindfold to get past (blindfold = "wear only darkness").

10 and 11: These two are in the room just before the end, so they warn you about your fate.

The scrolls are just cryptograms (each English letter is represented as a certain symbol). So you can solve them with an online cryptogram solver, but the time-consuming part is reading the symbols and writing down an arbitrary letter for each symbol, so that you can input that into a solver. Also, the words on the scrolls wrap from one line to the next, so you have to figure out which line breaks to remove.