ArticleslgStudy

computer science

Oracle machine

Oracle machine is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Oracle machine rather than just read about it. In short: In complexity theory and computability theory, an oracle machine is an abstract machine that can query a black box called an oracle, which is able to give an answer to any instance of a certain problem ⁠ R {\displaystyle R} ⁠ in a single operation. The problem ⁠ R {\displaystyle R} ⁠ can be of any complexity class, or it can even be an undecidable problem such as the halting problem.

Oracle machine — main illustration
Oracle machine — illustration

Key takeaways

  • Oracle machine belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Oracle machine to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Oracle machine from memory before moving on to harder problems.

Reference excerpt

In complexity theory and computability theory, an oracle machine is an abstract machine that can query a black box called an oracle, which is able to give an answer to any instance of a certain problem ⁠ R {\displaystyle R} ⁠ in a single operation. The problem ⁠ R {\displaystyle R} ⁠ can be of any complexity class, or it can even be an undecidable problem such as the halting problem. If another problem ⁠ R ′ {\displaystyle R'} ⁠ is reducible to ⁠ R {\displaystyle R} ⁠ in polynomial time, then the oracle machine (with the ⁠ R {\displaystyle R} ⁠-oracle) can solve ⁠ R ′ {\displaystyle R'} ⁠ in polynomial time; one can say that ⁠ R ′ {\displaystyle R'} ⁠ is in the relativized complexity class ⁠ P R {\displaystyle {\mathsf {P}}^{R}} ⁠. Other relativized complexity classes such as ⁠ N P R {\displaystyle {\mathsf {NP}}^{R}} ⁠ can be defined analogously.

Oracles An oracle machine can be conceived as a Turing machine connected to an oracle. The oracle, in this context, is an entity capable of solving some problem, which for example may be a decision problem or a function problem. The problem does not have to be computable; the oracle is not assumed to be a Turing machine or computer program. The oracle is simply a "black box" that is able to produce a solution for any instance of a given computational problem:

A decision problem is represented as a set A of natural numbers (or strings). An instance of the problem is an arbitrary natural number (or string). The solution to the instance is "YES" if the number (string) is in the set, and "NO" otherwise. A function problem is represented by a binary relation R relating natural numbers (or strings) to natural numbers (or strings). An instance of the problem is an input x for R. A solution is a value related to x by R. An oracle machine can perform all of the usual operations of a Turing machine, and can also query the oracle to obtain a solution to any instance of the computational problem for that oracle. For example, if the problem is a decision problem for a set A of natural numbers, the oracle machine supplies the oracle with a natural number, and the oracle responds with "yes" or "no" stating whether that number is an element of A.

Definitions There are many equivalent definitions of oracle Turing machines, as discussed below. The one presented here is from van Melkebeek (2003, p. 43). 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 symbol from the tape alphabet; a read/write head, which rests on a single cell of the work tape and can read the data there, write new data, and increment or decrement its position along the tape; 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 read/write head, 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, which is a semi-infinite tape separate from the work tape. The alphabet for the oracle tape may be different from the alphabet for the work tape. an oracle head which, like the read/write head, can move left or right along the oracle tape reading and writing symbols; two special states: the ASK state and the RESPONSE state. From time to time, the oracle machine may enter the ASK state. When this happens, the following actions are performed in a single computational step:

the contents of the oracle tape are viewed as an instance of the oracle's computational problem; the oracle is consulted, and the contents of the oracle tape are replaced with the solution to that instance of the problem; the oracle head is moved to the first square on the oracle tape; the state of the oracle machine is changed to RESPONSE. The effect of changing to the ASK state is thus to receive, in a single step, a solution to the problem instance that is written on the oracle tape.

Alternative definitions There are many alternative definitions to the one presented above. Many of these are specialized for the case where the oracle solves a decision problem. In this case:

Some definitions, instead of writing the answer to the oracle tape, have two special states YES and NO in addition to the ASK state. When the oracle is consulted, the next state is chosen to be YES if the contents of the oracle tape are in the oracle set, and chosen to be NO if the contents are not in the oracle set. Some definitions eschew the separate oracle tape. When the oracle state is entered, a tape symbol is specified. The oracle is queried with the number of times that this tape symbol appears on the work tape. If that number is in the oracle set, the next state is the YES state; if it is not, the next state is the NO state. Another alternative definition makes the oracle tape read-only, and eliminates the ASK and RESPONSE states entirely. Before the machine is started, the indicator function of the oracle set is written on the oracle tape using symbols 0 and 1. The machine is then able to query the oracle by scanning to the correct square on the oracle tape and reading the value located there. These definitions are equivalent from the point of view of Turing computability: a function is oracle-computable from a given oracle under all of these definitions if it is oracle-computable under any of them. The definitions are not equivalent, however, from the point of view of computational complexity. A definition such as the one by van Melkebeek, using an oracle tape that may have its own alphabet, is required in general.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Oracle machine

Start with the simplest possible case. Write down what Oracle machine claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Oracle machine before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Oracle machine ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Oracle machine

In research
Oracle machine appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Oracle machine in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Oracle machine is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computability theory, Computation oracles, Turing machine, so understanding it makes those chapters shorter.
In everyday life
Look for Oracle machine outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Oracle machine in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Oracle machine means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Oracle machine out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Oracle machine in simple terms?

In complexity theory and computability theory, an oracle machine is an abstract machine that can query a black box called an oracle, which is able to give an answer to any instance of a certain problem ⁠ R {\displaystyle R} ⁠ in a single operation. The problem ⁠ R {\displaystyle R} ⁠ can be of any…

Why does Oracle machine matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Oracle machine?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Oracle machine.

Tags

  • Computability theory
  • Computation oracles
  • Turing machine

Keep exploring