In complexity theory and computability theory, an

**oracle**is a black box that computes a function in a single step. This could be a function solving an NP-complete problem such as the subset sum problem. It could even be an "uncomputable" (non-recursive) function like the halting problem.

Table of contents |

2 Oracles and Complexity Theory 3 Oracles and Halting Problems 4 References in Popular Culture |

### Oracle machines

An **oracle machine** is a Turing machine connected to an oracle. The Turing machine can write on its own tape an input for the oracle, then tell the oracle to execute. In a single step, the oracle computes its function, erases its input, and writes its output to the tape. Sometimes the Turing machine is described as having two tapes, one of which is reserved for oracle inputs and outputs.

### Oracles and Complexity Theory

Clearly, for some oracles, the oracle machine will be more powerful than a simple Turing machine. It is possible to define complexity classes analogous to **P** and **NP** for this machine. This can be useful for investigating the relationship between P and NP.

For an oracle **A**, the corresponding classes are called **P**^{A} and **NP**^{A}. It has been shown that there exist oracles **A** and **B** such that **P**^{A}=**NP**^{A} and **P**^{B}≠**NP**^{B}. When a question such as this has different answers for different oracles, it is said to "relativize both ways". The fact that the **P**=**NP** question relativizes both ways is taken as evidence that answering this question will be difficult.

It is interesting to consider the case where an oracle is chosen randomly from among all possible oracles. It has been shown that if oracle **A** is chosen randomly, then with probability 1, **P**^{A}≠**NP**^{A}. When a question is true for almost all oracles, it is said to be true "for a random oracle". This is sometimes taken as evidence that **P**≠**NP**. Unfortunately, it is possible for some statement to be true for a random oracle, but not be true for ordinary Turing machines.

### Oracles and Halting Problems

It is possible to posit the existence of an oracle which computes a non-recursive function, such as the answer to the halting problem or some equivalent. A machine with an oracle of this sort is a hypercomputer.

Interestingly, the halting paradox still applies to such machines; that is, although they can determine whether particular Turing machines will halt on particular inputs, they cannot determine whether machines with equivalent halting oracles will themselves halt. This fact creates a hierarchy of machines, each with a more powerful halting oracle and an even harder halting problem.

### References in Popular Culture

The Oracle character in the Matrix series is clearly a reference to oracle machines. This becomes particularly apparent in The Matrix Reloaded, with discussion of the Oracle's "intuitive" but inexplicable answers to extremely difficult problems. The Matrix Revolutions appears to explore the idea that oracle machines are unable to answer questions about their own behaviour.

The term

**"oracle machine"**is sometimes used to refer to a computer, especially a server, that runs Oracle Corporation's database management system.