# Is there an algorithm that provably exists although we don't know what it is?

In mathematics, there are many existence proofs that are non-constructive, so we know that a certain object exists although we don't know how to find it.

I am looking for similar results in computer science. In particular: is there a problem that we can prove it is decidable without showing an algorithm for it? I.e. we know that it can be solved by an algorithm, but we don't know what the algorithm looks like?

• There is a trivial answer. Take any yes/no question the answer of which is unkown, like "is $\pi$ random", then the question is decidable, only we do not yet know which of the two possible algorithms is correct. – Hendrik Jan Oct 26 '14 at 11:25
• basically duplicate of tcs.se question are there nonconstructive algorithm existence proofs – vzn Oct 26 '14 at 18:06
• @babou Indeed: a question with a unique answer is decidable. Here ignorance is the point it seems, it is a case of "dont't know" from the question, although only "don't know now". Once we have found out whether $\pi$ is random or not we need to look for another example. Your answer below is much better of course! It is a form of "don't know" which is inherently "will never know". – Hendrik Jan Oct 26 '14 at 19:05
• @HendrikJan: And that procedure is what we call an algorithm in CS. But taking the halting problem as an example, we cannot even prove that an algorithm exists! – MSalters Oct 26 '14 at 19:06
• Some more interesting examples can be found here: cstheory.stackexchange.com/questions/4777/… – Erel Segal-Halevi Oct 27 '14 at 7:29

The simplest case I know of an algorithm that exists, though it is not known which algorithm, concerns finite state automata.

The quotient $L_1/L_2$ of a language $L_1$ by a language $L_2$ is defined as $L_1/L_2=\{x \mid \exists y\in L_2 \text{ such that } xy\in L_1\}$.

It is easily proved that regular set are closed under quotient by an arbitrary set. In other words, if $L_1$ is regular and $L_2$ is arbitrary (not necessarily regular), then $L_1/L_2$ is regular, too.

The proof is quite simple. Let $M=(Q,\Sigma,\delta,q_0,F)$ be a FSA accepting the regular set $R$, where $Q$ and $F$ are respectively the set of states and the set of accepting states, and let $L$ be an arbitrary language. Let $F'=\{q\in Q\mid \exists y\in L \;\;\delta(q,y)\in F\}$ be the set of states from which a final state can be reached by accepting a string from $L$.

The automaton $M'=(Q,\Sigma,\delta,q_0,F')$, which differs from $M$ only in its set $F'$ of final states recognizes precisely $R/L$. (Or see Hopcroft-Ullman 1979, page 62 for a proof of this fact.)

However, when the set $L$ is not decidable, there may be no algorithm to decide which states have the property that defines $F'$. So, while we know that the set $F'$ is a subset of $Q$, we have no algorithm to determine which subset. Consequently, while we know that $R$ is accepted by one of $2^{|Q|}$ possible FSA, we do not know which it is. Though I must confess we know to a large extent what it looks like.

This is an example of what is sometimes called an almost constructive proof, that is a proof that one of a finite number of answers is the right one.

I suppose an extension of that could be a proof that one of an enumerable set of answers is the right one. But I do not know any. Nor do I know a purely non-constructive proof that some problem is decidable, for example using only contradiction.

• @D.W. I said $R$ is regular, but $L$ is arbitrary. It does not have to be recursively enumerable, or regular. No property of $L$ is used other than the fact that it is a set of strings. If you do not trust me, check Hopcroft-Ullman 1979, page 62. – babou Oct 26 '14 at 17:46
• Thanks. This is my favorite answer because the decidable language is infinite. – Erel Segal-Halevi Oct 27 '14 at 7:18
• @babou, my mistake, I mis-read what you wrote. My fault -- sorry about that. I've edited your post to make the part that I mis-understood hopefully cleraer. – D.W. Oct 27 '14 at 15:45
• @D.W. I am amused that you had a problem, but it happens to me too. But maybe I should have been clearer. This was not intentional. Saying that because some mathematicians think it is more elegant to be cryptic. Thanks for the edit. – babou Oct 27 '14 at 15:59

To expand on Hendrick's original comment, consider this problem

Given an integer $n\ge 0$ is there a run of $n$ or more consecutive 7s in the decimal expansion of $\pi$?

This problem is decidable, since one of two cases may obtain:

1. There is an integer $N$ for which the decimal expansion of $\pi$ contains a run of $N$ consecutive 7s, but no longer run.
2. For any $n$, the expansion of $\pi$ has a run of $n$ consecutive 7s.

In case (1) a decision algorithm for the problem would be one of

If $n > N$ answer "no" else answer "yes".

and in case (2) the algorithm would be

I originally claimed that it sufficed to take any set $S$ that we know to be finite but for which we don't know the members. Since $S$ is finite, it is recursive, so there is an algorithm but I claimed that we don't know what it is.
However, this is incorrect. For example, by the Robertson–Seymour theorem, we know that the class of graphs of treewidth at most 10 has a finite set of forbidden minors. We don't know what this set is so I claimed we don't have an algorithm to decide if a graph $H$ is a forbidden minor of the class of graphs of treewidth at most 10. But @sdcwc points out that there is an algorithm: just check that $H$ has treewidth more than 10 and all its proper minors have treewidth at most 10.