Closure properties of oracle-relative computability #
Mathlib's Nat.RecursiveIn O is the inductive closure of the basic functions and the oracles in
O under pairing, composition, primitive recursion and unbounded search starting at zero. This file
derives further closure properties from those constructors:
Nat.RecursiveIn.comp_primrec,Nat.RecursiveIn.map_primrec: composition with a primitive recursive function on either side;Nat.RecursiveIn.rfind': unbounded search starting at a given value, the oracle-relative form ofNat.Partrec.rfind';Nat.RecursiveIn.cond: a conditional with a guard computable inO, which evaluates only the selected branch.
The search rfind' is the closure property needed to evaluate the search instruction of a code,
whose search starts at the second component of its input rather than at zero. The conditional is
needed to combine two reductions according to a decidable property of the input, as in the Turing
join of two oracles.
Mathlib's ComputableIn₂ expresses computability of binary total functions in terms of
encodings; ComputableIn₂.iff_nat restates it for functions on ℕ as a Nat.RecursiveIn
statement on codes Nat.pair a b of pairs. Total oracle-computable functions are closed under
composition, pairing, primitive recursion, and forming finite initial segments of a sequence.
These closure proofs adapt Mathlib's Computable.comp, Computable.pair, and
Computable.nat_rec in Mathlib.Computability.Partrec to Nat.RecursiveIn.
Precomposition with a primitive recursive function preserves recursiveness in O.
Postcomposition with a primitive recursive function preserves recursiveness in O.
Search from a given start. If f is recursive in O, so is the function sending
Nat.pair a m to the least n ≥ m with f (Nat.pair a n) = 0, provided f (Nat.pair a k) is
defined for every k from m to n. This is the oracle-relative form of Nat.Partrec.rfind'.
Conditionals. If the guard c is computable in O and f and g are recursive in O,
then so is the function which agrees with f where c holds and with g elsewhere. Only the
selected branch is evaluated, so the conditional is defined at n exactly when the selected branch
is.
A binary total function on ℕ is computable in O exactly when it is recursive in O as a
function of the code Nat.pair a b of its arguments.
Composition of total oracle-computable functions.
Pairing total oracle-computable functions.
Primitive recursion of total oracle-computable functions. The recursion counter is allowed to depend on the parameter.
A finite initial segment of an oracle-computable sequence can be computed uniformly in its length and in the sequence parameter.