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?

  • 5
    $\begingroup$ 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. $\endgroup$ Commented Oct 26, 2014 at 11:25
  • 6
    $\begingroup$ basically duplicate of tcs.se question are there nonconstructive algorithm existence proofs $\endgroup$
    – vzn
    Commented Oct 26, 2014 at 18:06
  • 1
    $\begingroup$ @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". $\endgroup$ Commented Oct 26, 2014 at 19:05
  • 1
    $\begingroup$ @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! $\endgroup$
    – MSalters
    Commented Oct 26, 2014 at 19:06
  • 1
    $\begingroup$ Some more interesting examples can be found here: cstheory.stackexchange.com/questions/4777/… $\endgroup$ Commented Oct 27, 2014 at 7:29

3 Answers 3


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.

  • 1
    $\begingroup$ @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. $\endgroup$
    – babou
    Commented Oct 26, 2014 at 17:46
  • $\begingroup$ Thanks. This is my favorite answer because the decidable language is infinite. $\endgroup$ Commented Oct 27, 2014 at 7:18
  • $\begingroup$ @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. $\endgroup$
    – D.W.
    Commented Oct 27, 2014 at 15:45
  • $\begingroup$ @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. $\endgroup$
    – babou
    Commented Oct 27, 2014 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

Answer "yes".

Clearly each of these is a decision algorithm; we just don't know which. That suffices, though, since decidability only requires the existence of an algorithm, not the specification of which algorithm to use.

  • $\begingroup$ +1 This is a straightforward example that I remember my professor in Computability and Logic using. It's my go-to example, since it doesn't require much domain knowledge, so it's easy to convey. $\endgroup$ Commented Oct 27, 2014 at 2:00
  • 1
    $\begingroup$ For alternative formulations, see also here. $\endgroup$
    – Raphael
    Commented Oct 27, 2014 at 16:52

Here is a non-answer. I'm posting because I believe it's instructive, because I originally claimed the opposite and eight people agreed enough to upvote before @sdcwc pointed out the mistake. I didn't want to just edit my first answer because I'm not sure as many people would have upvoted it if they knew it was wrong.

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.


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.