I’m brushing up on my software testing theory and came across an interesting phenomenon called the Oracle problem. I’ve picked up bits and pieces as to what the problem alludes to but haven’t yet pieced it all together.
One rather dark version of the problem goes a little something like this:
An island has 100 inhabitants. Each of the inhabitants has either green or blue eyes. None of the inhabitants are allowed to communicate with each other to let them know what color eyes they have, nor are there any reflective surfaces in which the inhabitants can see their own eye colors. Basically everyone knows what color eyes everyone has but none of them know what color eyes they themselves have. The rule on the island is that if you find out that you have blue eyes you must kill yourself. The island’s population remains stable until one day an oracle arrives and tells the inhabitants that some people on the island have blue eyes.
The question is what happens to the people?
An answer I found is that 100 days later the last person on the island kills themselves.
I have no clue how this makes sense and I was hoping that someone could help relate this problem back to software testing. Thanks for coming on the journey and I look forward to some interesting responses.
First, to understand the puzzle, add one detail: if you find out that you have blue eyes, you commit suicide at midnight, in privacy. Nobody knows you’re dead until morning. Now try a few versions of the problem with fewer people:
And so on. You may have noticed that the oracle must have an interesting property for this to work: it is truthful, and everybody knows about this property. This means that everyone knows that everyone knows that the oracle is truthful, and everyone knows it, and so on. The fact of a death is also common knowledge: if Sam dies in the night, everyone knows that he killed himself, and everyone knows that everyone else knows it, and so on.
So what does this have to do with software testing? I don’t consider it a very good analogy, but the idea is that you can test a piece of software against something, some standard, to see if it gives the correct answer. The standard might be another piece of software, or the same software in a previous run, or theoretical results, or whatever. But how do we know the standard is correct? It would be really good to have a standard which is correct, and which everyone knows is correct, and which everyone knows everyone knows is correct, and so on.
EDIT:
P.S.: there may be some confusion because in computer science the term “oracle” also refers to a theoretical device that can solve problems which a Turing machine cannot solve, such as the Halting Problem.