Cite

This course has no released version yet: the text at this address may change. Cite a released version when one exists.

/courses/turing-degrees/oracle-computation
@misc{turing-degrees-oracle-computation,
  title = {{Computation relative to an oracle}},
  howpublished = {Lesson 1 of \emph{Oracles and Turing degrees}, Computability Theory course notes},
  url = {/courses/turing-degrees/oracle-computation},
  note = {Unreleased working version}
}

To cite a single statement, use the # link that appears next to its heading.

Lesson 1 of 6

Computation relative to an oracle

Oracle machines, Turing functionals, computations with finite oracles and the use principle; relativization of the universal function and of the SMN theorem.

40 min5 questions
Before this lesson:Computably enumerable sets (Fundamentals of computability)
Oracles and Turing degrees · lesson 1 of 6
  1. Computation relative to an oracle
  2. Turing reducibility and degrees
  3. The Turing jump
  4. Limit computability
  5. The finite extension method
  6. Low and high sets

A non-computable set can be seen as an unsolvable problem. To compare unsolvable problems with one another, Turing introduced in 1939 machines that may consult an oracle: a set X⊆NX \subseteq \nat, given as an infinite external resource, which the machine may query at any time for the value of X(n)X(n). A set is then computable relative to XX if some oracle machine decides it with oracle XX. This lesson defines oracle computations, proves the property that makes them manageable — a halting computation consults only finitely many bits of the oracle — and shows that the basic results of the course on fundamentals hold relative to any oracle.

1.1 Strings and sequences

We use the notation of Definition 4.1 of “The diagonal argument”. A string is an element σ\sigma of 2<N\bstr, the set of finite binary sequences; ∣σ∣|\sigma| is its length, σ(n)\sigma(n) its nn-th bit for n<∣σ∣n < |\sigma|, and ε\varepsilon the empty string. For strings σ\sigma and τ\tau and X∈2NX \in \cs:

  • σ⪯τ\sigma \preceq \tau means that σ\sigma is a prefix of τ\tau, and σ≺X\sigma \prec X that σ\sigma is a prefix of XX;
  • σ\sigma and τ\tau are compatible if one is a prefix of the other, and incompatible otherwise;
  • στ\sigma \tau and σi\sigma i denote concatenations, for i∈{0,1}i \in \{0, 1\}, and X ⁣↾n=X(0)⋯X(n−1)X \uh n = X(0) \cdots X(n-1);
  • [σ]={X∈2N:σ≺X}[\sigma] = \{ X \in \cs : \sigma \prec X \} is the cylinder of σ\sigma.

Strings are coded by integers in a fixed computable way, so that the usual operations on them are primitive recursive. Sets of integers are identified with elements of 2N\cs.

1.2 Oracle machines

Definition 1.1.#

An oracle machine is a Turing machine with a second, read-only tape, the oracle tape, whose cells are indexed by N\nat, and a second head on it, starting on cell 00. Its transition function has the form

δ:(Q∖{qh})×Γ×{0,1}→Q×Γ×{L,R}×{L,S,R}:\delta : (Q \setminus \{ q_h \}) \times \Gamma \times \{0, 1\} \to Q \times \Gamma \times \{L, R\} \times \{L, S, R\}:

in state qq, reading aa on the work tape and bb under the oracle head, the machine writes a′a' on the work tape, moves the work head in direction DD and the oracle head in direction D′D' (SS meaning that it stays; a move to the left from cell 00 leaves it on cell 00), and enters the state q′q', where δ(q,a,b)=(q′,a′,D,D′)\delta(q, a, b) = (q', a', D, D').

With oracle X∈2NX \in \cs, the oracle tape contains X(k)X(k) on cell kk. Inputs and outputs follow the conventions of Definition 2.4 of “Turing machines”.

work tape⊔111⊔11⊔⊔⊔⋯oracle tape00111203140506170819⋯cells read so far: the usefinite controlq2δ(q, a, b) = (q′, a′, D, D′):read a on the work tape and b = X(k)on the oracle tape; write a′, move both heads

An oracle machine with oracle XX. The oracle head starts on cell 00 and moves by at most one cell per step, so the cells it has read always form an initial segment of the oracle tape.

An oracle machine computes, for each oracle XX, a partial function Nk⇀N\nat^k \rightharpoonup \nat. Ordinary Turing machines are the oracle machines that ignore their oracle. Oracle machines are coded by integers as ordinary machines are; the integers that are not codes are treated as coding a machine that never halts.

Definition 1.2.#

For e,k∈Ne, k \in \nat, the Turing functional Φe\Phi_e is the map which sends an oracle XX to the partial function ΦeX:Nk⇀N\Phi^X_e : \nat^k \rightharpoonup \nat computed by the oracle machine of code ee with oracle XX. We also write Φe(X,x⃗)\Phi_e(X, \vec x) for ΦeX(x⃗)\Phi_e^X(\vec x).

The notation is consistent with the course on fundamentals once a convention is fixed: from now on, Φe\Phi_e denotes the functional of index ee, and when no oracle is written, Φe(x)\Phi_e(x) stands for Φe∅(x)\Phi^{\emptyset}_e(x), Φe(x)[s]\Phi_e(x)[s] for Φe∅(x)[s]\Phi^{\emptyset}_e(x)[s] (defined below) and WeW_e for dom⁡(Φe∅)\dom(\Phi^{\emptyset}_e). The partial computable functions of that course are exactly the functions Φe∅\Phi^{\emptyset}_e, or ΦeX\Phi^X_e for any computable XX (see the exercises), although a function need not have the same indices in the two enumerations. Since every ordinary machine is an oracle machine, every partial computable function is ΦeX\Phi^X_e for some ee and every XX.

Example 1.3.#

Let XX be an infinite set whose principal function pXp_X (Lemma 3.2 of “Countable sets”) grows fast enough that Φe(e) ⁣ ⁣↓\Phi_e(e)\converge implies Φe(e)[pX(e)] ⁣ ⁣↓\Phi_e(e)[p_X(e)]\converge, for every ee. Then there is an oracle machine computing ∅′\emptyset' with oracle XX: on input ee, read the oracle until its ee-th element pX(e)p_X(e) is found, then run Φe(e)\Phi_e(e) for pX(e)p_X(e) stages, and answer 11 if and only if it has converged. Fast-growing sets can thus compute the halting set; this phenomenon is studied in the lesson on limit computability.

1.3 Computations with finite oracles

A halting computation is finite, so it reads only finitely many cells of the oracle. This is the basis of everything that follows. For a string σ\sigma, the computation with oracle σ\sigma is the computation of the machine in which the oracle tape contains σ(k)\sigma(k) on the cells k<∣σ∣k < |\sigma|; it is considered undefined as soon as the oracle head reaches a cell k≥∣σ∣k \geq |\sigma|.

Definition 1.4.#

For σ∈2<N\sigma \in \bstr, e,x,s∈Ne, x, s \in \nat:

  1. Φeσ(x) ⁣ ⁣↓=y\Phi^\sigma_e(x)\converge = y means that the computation of the machine ee on input xx with oracle σ\sigma halts in a standard configuration with output yy, without the oracle head reaching a cell k≥∣σ∣k \geq |\sigma|;
  2. Φeσ(x)[s] ⁣ ⁣↓=y\Phi^\sigma_e(x)[s]\converge = y means that moreover e,x<se, x < s and the code of this computation is smaller than ss;
  3. for X∈2NX \in \cs, ΦeX(x)[s]≃ΦeX ⁣↾s(x)[s]\Phi^X_e(x)[s] \simeq \Phi^{X \uh s}_e(x)[s].

As in Kleene's normal form, the relation ”tt codes a halting computation of the machine ee on input xx with oracle σ\sigma” is primitive recursive in (σ,e,x,t)(\sigma, e, x, t): configurations now include the position of the oracle head, and each step consults one bit of σ\sigma, available since σ\sigma is part of the data. A computation of code tt has fewer than tt steps, and the oracle head moves at most one cell per step, so it reads only cells k<tk < t.

Proposition 1.5.#
  1. The relation Φeσ(x)[s] ⁣ ⁣↓=y\Phi^\sigma_e(x)[s]\converge = y is primitive recursive in (σ,e,x,s,y)(\sigma, e, x, s, y).
  2. Monotonicity. If Φeσ(x)[s] ⁣ ⁣↓=y\Phi^\sigma_e(x)[s]\converge = y, σ⪯τ\sigma \preceq \tau and s≤s′s \leq s', then Φeτ(x)[s′] ⁣ ⁣↓=y\Phi^\tau_e(x)[s']\converge = y.
  3. Approximation. For every X∈2NX \in \cs: ΦeX(x) ⁣ ⁣↓=y\Phi^X_e(x)\converge = y if and only if ΦeX(x)[s] ⁣ ⁣↓=y\Phi^X_e(x)[s]\converge = y for some ss, if and only if Φeσ(x) ⁣ ⁣↓=y\Phi^\sigma_e(x)\converge = y for some σ≺X\sigma \prec X.
Proof of Proposition 1.5.
  1. Φeσ(x)[s] ⁣ ⁣↓=y\Phi^\sigma_e(x)[s]\converge = y holds if and only if e,x<se, x < s and some t<st < s codes a halting computation of ee on xx with oracle σ\sigma, with output U(t)=yU(t) = y: a bounded quantification of a primitive recursive relation.
  2. The computation with oracle σ\sigma reads only cells k<∣σ∣k < |\sigma|, where τ\tau agrees with σ\sigma; so with oracle τ\tau the machine performs the same steps, and the computation has the same code.
  3. If ΦeX(x) ⁣ ⁣↓=y\Phi^X_e(x)\converge = y, let tt be the code of the computation with oracle XX. It reads only cells k<tk < t, so it is also the computation with oracle X ⁣↾tX \uh t, and ΦeX(x)[s] ⁣ ⁣↓=y\Phi^X_e(x)[s]\converge = y for s=max⁡(e,x,t)+1s = \max(e, x, t) + 1, since X ⁣↾t⪯X ⁣↾sX \uh t \preceq X \uh s. If ΦeX(x)[s] ⁣ ⁣↓=y\Phi^X_e(x)[s]\converge = y, then σ=X ⁣↾s\sigma = X \uh s works. Finally, if Φeσ(x) ⁣ ⁣↓=y\Phi^\sigma_e(x)\converge = y with σ≺X\sigma \prec X, the computation with oracle XX performs the same steps, by the argument of item 2.
Definition 1.6.#

If ΦeX(x) ⁣ ⁣↓\Phi^X_e(x)\converge, the use of the computation, written use⁡eX(x)\use^X_e(x), is 11 plus the largest cell read by the oracle head during the computation (the head reads cell 00 initially, so the use is at least 11).

Theorem 1.7 (Use principle).#

If ΦeX(x) ⁣ ⁣↓=y\Phi^X_e(x)\converge = y with use uu, then ΦeY(x) ⁣ ⁣↓=y\Phi^Y_e(x)\converge = y, with the same use, for every YY such that Y ⁣↾u=X ⁣↾uY \uh u = X \uh u. In particular ΦeX ⁣↾u(x) ⁣ ⁣↓=y\Phi^{X \uh u}_e(x)\converge = y.

Proof of Theorem 1.7.

By induction on the number of steps, the computations with oracles XX and YY pass through the same configurations: the oracle head stays within the cells k<uk < u during the computation with oracle XX, and there XX and YY agree, so each step reads the same oracle bit. Hence the computation with oracle YY halts after the same number of steps, with the same output, and reads the same cells. The last statement is the same argument with the finite oracle X ⁣↾uX \uh u, of length uu.

The use principle says that the value of a convergent computation depends only on a finite part of the oracle. In topological terms, which are developed in the course on Π10\Pi^0_1 classes, the partial map X↦ΦeX(x)X \mapsto \Phi^X_e(x) is continuous on its domain, for the product topology on 2N\cs: if ΦeX(x) ⁣ ⁣↓=y\Phi^X_e(x)\converge = y, then ΦeY(x) ⁣ ⁣↓=y\Phi^Y_e(x)\converge = y on the whole open neighborhood [X ⁣↾u][X \uh u] of XX.

1.4 Relativization

Definition 1.8.#

Let X∈2NX \in \cs. A partial function is XX-computable, or computable in XX, if it is ΦeX\Phi^X_e for some ee. A set is XX-computable if its characteristic function is. A set is XX-computably enumerable, or XX-c.e., if it is the domain of an XX-computable partial function; we write WeX=dom⁡(ΦeX)W^X_e = \dom(\Phi^X_e).

Every argument of the course on fundamentals is an algorithm, or a construction of algorithms, and remains valid if all machines are given access to the same oracle XX. This relativization yields, for each theorem, a version relative to XX, obtained by replacing computable with XX-computable and Φe\Phi_e with ΦeX\Phi^X_e throughout. For instance, relative to XX, the c.e. sets are characterized as in Theorem 4.3 of “Computably enumerable sets”, a set is XX-computable if and only if it and its complement are XX-c.e., and the fixed point theorem holds for XX-computable transformations of indices. Two results deserve to be stated explicitly, because their relativized form is uniform: the objects they provide do not depend on XX.

Theorem 1.9 (Relativized universal function).#

There is an index uu such that ΦuX(e,x)≃ΦeX(x)\Phi^X_u(e, x) \simeq \Phi^X_e(x) for every XX, ee and xx.

Proof of Theorem 1.9.

By Proposition 1.5, ΦeX(x)≃U(μt T(X ⁣↾t,e,x,t))\Phi^X_e(x) \simeq U\big(\mu t\ T(X \uh t, e, x, t)\big), where T(σ,e,x,t)T(\sigma, e, x, t) is the primitive recursive relation ”tt codes a halting computation of ee on xx with oracle σ\sigma”. An oracle machine computes this expression: on input (e,x)(e, x), for t=0,1,2,…t = 0, 1, 2, \dots, it reads X ⁣↾tX \uh t on its oracle tape, and tests the relation. The same machine works for every oracle.

Theorem 1.10 (Relativized SMN theorem).#

For all m,n≥1m, n \geq 1, the primitive recursive function SnmS^m_n of SMN theorem satisfies, for every oracle XX,

ΦSnm(e,x⃗)X(y⃗)≃ΦeX(x⃗,y⃗).\Phi^X_{S^m_n(e, \vec x)}(\vec y) \simeq \Phi^X_e(\vec x, \vec y).
Proof of Theorem 1.10.

The construction of SMN theorem prepends to the machine ee a machine writing x⃗\vec x on the work tape, without touching the oracle head. The resulting oracle machine first writes x⃗\vec x, then behaves as the machine ee, with the same oracle; this does not depend on the oracle.

The function SnmS^m_n is computable, not merely XX-computable: it manipulates codes of machines and never consults the oracle. Uniformity of this kind is used repeatedly, for instance to show that the jump is monotone. In proofs, we use the parameter form: if f(X,x,y⃗)f(X, x, \vec y) is computed by an oracle machine, there is a computable ss with Φs(x)X(y⃗)≃f(X,x,y⃗)\Phi^X_{s(x)}(\vec y) \simeq f(X, x, \vec y) for every XX.

Remark 1.11 (Relativization in complexity theory).#

Almost all proofs of computability theory relativize. In complexity theory, this is a limitation: Baker, Gill and Solovay constructed oracles AA and BB with PA=NPA\mathrm{P}^A = \mathrm{NP}^A and PB≠NPB\mathrm{P}^B \neq \mathrm{NP}^B, so no relativizing argument can settle the question P=NP\mathrm P = \mathrm{NP}. We admit this result.

1.5 Oracles that are functions

A function f:N→Nf : \nat \to \nat can also serve as an oracle, through its graph: let Gf={⟨x,y⟩:f(x)=y}G_f = \{ \langle x, y \rangle : f(x) = y \}, a subset of N\nat. A machine with oracle GfG_f can compute f(x)f(x) by searching for the yy with ⟨x,y⟩∈Gf\langle x, y \rangle \in G_f; conversely, a machine that can compute ff can decide GfG_f. We say that a set or a function is ff-computable if it is GfG_f-computable. Computing with an oracle ff is therefore computing with the ability to evaluate ff at any point.

1.6 Exercises

Exercise 1.12 ★.

Show that if XX is computable, then the XX-computable partial functions are exactly the partial computable functions.

Solution

A partial computable function is computed by a machine that ignores its oracle. Conversely, let X=ΦcX = \Phi_c be computable and let f=ΦeXf = \Phi^X_e. Replace each consultation of the oracle tape at cell kk by a computation of Φc(k)\Phi_c(k); more precisely, f(x)≃U(μt T(σt,e,x,t))f(x) \simeq U(\mu t\ T(\sigma_t, e, x, t)) where σt=Φc(0)⋯Φc(t−1)\sigma_t = \Phi_c(0) \cdots \Phi_c(t-1) is computable from tt. This expression is partial computable.

Exercise 1.13 ★.

Show that the partial function (X,e,x)↦use⁡eX(x)(X, e, x) \mapsto \use^X_e(x) is computed by an oracle machine: there is vv with ΦvX(e,x)≃use⁡eX(x)\Phi^X_v(e, x) \simeq \use^X_e(x) for every XX, ee and xx.

Solution

On input (e,x)(e, x) with oracle XX, search for the least tt with T(X ⁣↾t,e,x,t)T(X \uh t, e, x, t), as in Theorem 1.9; the computation coded by tt is then known, and the use is 11 plus the largest oracle head position appearing in its configurations. If ΦeX(x) ⁣ ⁣↑\Phi^X_e(x)\diverge, the search diverges, as it should.

Exercise 1.14 ★★.

Let Φe\Phi_e be a functional such that ΦeX\Phi^X_e is total for every X∈2NX \in \cs. Show that there is a computable function bb such that use⁡eX(x)≤b(x)\use^X_e(x) \leq b(x) for all XX and xx.

Hint

Use König’s lemma, or the compactness of 2N\cs: for a fixed xx, consider the strings σ\sigma on which the computation Φeσ(x)\Phi^\sigma_e(x) does not yet converge.

Solution

First, for every string σ\sigma, the computation of the machine ee on input xx with oracle σ\sigma either halts or reaches a cell k≥∣σ∣k \geq |\sigma| after finitely many steps. Otherwise it would run forever while reading only cells k<∣σ∣k < |\sigma|, and with any oracle X≻σX \succ \sigma it would perform the same steps, so that ΦeX(x) ⁣ ⁣↑\Phi^X_e(x)\diverge, contradicting the hypothesis. Hence the relation Φeσ(x) ⁣ ⁣↓\Phi^\sigma_e(x)\converge is decidable: run the computation until one of the two events occurs.

Fix xx, and let TxT_x be the set of strings σ\sigma such that Φeτ(x) ⁣ ⁣↑\Phi^{\tau}_e(x)\diverge for every τ⪯σ\tau \preceq \sigma. It is closed under prefixes and decidable. If TxT_x contained strings of every length, then by König’s lemma (an infinite binary tree has an infinite path) there would be XX with all its prefixes in TxT_x, and then ΦeX(x) ⁣ ⁣↑\Phi^X_e(x)\diverge by Proposition 1.5, a contradiction. So there is a length ℓ\ell such that no string of length ℓ\ell belongs to TxT_x, and the least such ℓ\ell is found by testing the 2ℓ2^\ell strings of length ℓ=0,1,2,…\ell = 0, 1, 2, \dots in turn. Let b(x)b(x) be this ℓ\ell. Every XX has a prefix τ\tau of length at most b(x)b(x) with Φeτ(x) ⁣ ⁣↓\Phi^\tau_e(x)\converge, and then use⁡eX(x)≤∣τ∣≤b(x)\use^X_e(x) \leq |\tau| \leq b(x) by the use principle.

1.7 Notes and references

Oracle machines were introduced by Turing in his Princeton thesis, published in 1939, in the study of ordinal logics. Post (1944, 1948) and Kleene and Post (1954) made relative computability the central notion of the theory. The model with an oracle tape follows Rogers’ and Soare’s textbooks; models with query states give the same notion of relative computability.

  • A. M. Turing, Systems of logic based on ordinals, Proceedings of the London Mathematical Society (2) 45 (1939), 161–228.
  • S. C. Kleene and E. L. Post, The upper semi-lattice of degrees of recursive unsolvability, Annals of Mathematics 59 (1954), 379–407.
  • T. Baker, J. Gill and R. Solovay, Relativizations of the P =? NP question, SIAM Journal on Computing 4 (1975), 431–442.
  • R. I. Soare, Turing Computability: Theory and Applications, Springer, 2016.