# Oracle machine

In complexity theory and computability theory, an oracle machine is an abstract machine used to study decision problems. It can be visualized as a Turing machine with a black box, called an oracle, which is able to decide certain decision problems in a single operation. The problem can be of any complexity class. Even undecidable problems, like the halting problem, can be used.

## Definition

An oracle machine is a Turing machine connected to an oracle. The oracle, in this context, is thought of as an entity capable of answering some collection of questions, and usually represented as some subset A of the natural numbers. Intuitively then, the Turing machine can perform all of the usual operations of a Turing machine, and can also query the oracle for an answer to a specific question of the form "is x in A?" There are several different definitions of an oracle machine, all of which are equivalent in the sense that they agree on when a specific function f can be computed by an oracle machine with oracle A. The following is a description of one particular definition.

An oracle machine, like a Turing machine, includes a work tape: a sequence of cells without beginning or end, each of which may contain a B (for blank) or a 1; a read/write head, which rests on a single cell of the work tape and can read the data there, write new data, and move left or right along the tape; and a control mechanism, which can be in one of a finite number of states, and which will perform different actions (reading data, writing data, moving the control mechanism, and changing states) depending on the current state and the data being read. In addition to these components, an oracle machine also includes an oracle tape, on which is printed an infinite sequence of B's and 1's corresponding to the characteristic function of the oracle set A, and an oracle head, which (like the read/write head) can move left or right along the oracle tape reading data, but which cannot write.

### Formal definition

An oracle Turing machine is a 4-tuple $M= \langle Q, \delta, q_0, F \rangle$ where

• Q is a finite set of states
• $\delta: Q \times \{B,1\}^2 \rightarrow Q \times \{B,1\} \times \{L,R\}^2$ is a partial function called the transition function, where L is left shift, R is right shift.
• $q_0 \in Q$ is the initial state
• $F \subseteq Q$ is the set of halting states.

Turing machines can compute functions as follows: if f is a function that takes natural numbers to natural numbers, MA is a Turing machine with oracle A, and whenever MA is initialized with the work tape consisting of n+1 consecutive 1's (and blank elsewhere) MA eventually halts with f(n) 1's on the tape, MA is said to compute the function f. A similar definition can be made for functions of more than one variable, or partial functions.

If there is an oracle machine M that computes a function f with oracle A, f is said to be A-computable. If f is the characteristic function of a set B, B is also said to be A-computable, and M is said to be a Turing reduction from B to A.

## Complexity classes of oracle machines

The complexity class of decision problems solvable by an algorithm in class A with an oracle for a problem in class B is written AB. For example, the class of problems solvable in polynomial time by a deterministic Turing machine with an oracle for a problem in NP is PNP. (This is also the class of problems reducible by polynomial-time Turing reduction to a problem in NP.)

It is obvious that NP ⊆ PNP, but the question of whether NPNP, PNP, NP, and P are equal remains open. See polynomial hierarchy for further extensions.

The notation AB also means the class of problems solvable by an algorithm in class A with an oracle for the language B. For example, PSAT is the class of problems solvable in polynomial time by a deterministic Turing machine with an oracle for the Boolean satisfiability problem. When language B is complete for some class C, then AB=AC. In particular, since SAT is NP-complete, PSAT=PNP. Note that this assumes that the machine used in the definition of the class A is powerful enough to execute the reductions used in the completeness definition of the class C; for example, if A = DSPACE(1), ASAT does not necessarily equal ANP.

Oracle machines are useful for investigating the relationship between complexity classes P and NP, by considering the relationship between PA and NPA for an oracle A. In particular, it has been shown that there exist languages A and B such that PA=NPA and PB≠NPB (Baker, Gill, Solovay, 1975). The fact that the P=NP question relativizes both ways is taken as evidence that answering this question will be difficult, because any proof technique that relativizes (i.e., is unaffected by the addition of an oracle) will not answer the P=NP question.

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, PA≠NPA (Bennett, Gill, 1981). 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, a statement may be true for a random oracle and false for ordinary Turing machines at the same time; for example for almost all oracles A, IPA≠PSPACEA, while IP = PSPACE.[1]

## Oracles and halting problems

It is possible to posit the existence of an oracle which computes a non-computable 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, called the arithmetical hierarchy, each with a more powerful halting oracle and an even harder halting problem.

## Applications to cryptography

In cryptography, oracles are sometimes used to make arguments for the security of cryptographic protocols where (typically) a hash function is used. A security reduction for the protocol is given in the case where, instead of a hash function, a random oracle is used which answers each query randomly but consistently; the oracle is assumed to be available to all parties including the attacker, just as a hash function is. Such a proof shows that unless the attacker can solve the hard problem at the heart of the security reduction, they must make use of some interesting property of the hash function to break the protocol; they cannot treat the hash function as a black box (i.e., as a random oracle). This method has been very effective in giving good reductions for the security of efficient protocols, but its validity is sometimes challenged in the cryptographic community since computable functions are inherently very different from random oracles. See random oracle for more details.

## Bibliography

1. Alan Turing, Systems of logic based on ordinals, Proc. London math. soc., 45, 1939
2. C. Papadimitriou. Computational Complexity. Addison-Wesley, 1994. Section 14.3: Oracles, pp. 339 – 343.
3. T. P. Baker, J. Gill, R. Solovay. Relativizations of the P =? NP Question. SIAM Journal on Computing, 4(4): 431-442 (1975)
4. C. H. Bennett, J. Gill. Relative to a Random Oracle A, PA != NPA != co-NPA with Probability 1. SIAM Journal on Computing, 10(1): 96-113 (1981)
5. Michael Sipser (1997). Introduction to the Theory of Computation. PWS Publishing. ISBN 0-534-94728-X.  Section 9.2: Relativization, pp.318 – 321.
6. Martin Davis, editor: The Undecidable, Basic Papers on Undecidable Propositions, Unsolvable Problems And Computable Functions, Raven Press, New York, 1965. Turing's paper is in this volume. Papers include those by Godel, Church, Rosser, Kleene, and Post.

## References

1. ^ Richard Chang, Benny Chor, Oded Goldreich, Juris Hartmanis, Johan Hastad, Desh Ranjan, Pankaj Rohatgi. The Random Oracle Hypothesis is False. Journal of Computer and System Sciences, volume 49, issue 1, pp.24–39. August 1994. ISSN 0022-0000. http://citeseer.ist.psu.edu/282397.html