The oracle-uniform s-m-n theorem #
A code for a two-argument oracle program reads its arguments m and n as the paired input
Nat.pair m n. Specializing the first argument to a fixed parameter m gives the code
Code.curry c m, which runs c after pairing its own input with m. This file proves that
specialization is a primitive recursive operation on codes and that it preserves evaluation
relative to every oracle (Code.eval_curry). The specializing map does not depend on the
oracle: it is a syntactic operation on codes, and one primitive recursive index map works for all
oracles at once (Code.exists_primrec₂_smn). This is the relativized s-m-n theorem, in the
s¹₁ form where several parameters are passed as one paired number.
On the way, the constructors of Nat.RecursiveIn.Code are shown primitive recursive on codes,
as is the embedding Code.ofPartrec of ordinary codes. Together with Code.eval, which composes
the evaluations of the two parts of Code.comp cf cg, Code.primrec₂_comp says that composition
of oracle programs is a primitive recursive operation on codes, for every oracle.
Main definitions #
Nat.RecursiveIn.Code.curry: specialize the first argument of a code to a parameter.
Main results #
Nat.RecursiveIn.Code.primrec₂_pair,Nat.RecursiveIn.Code.primrec₂_comp,Nat.RecursiveIn.Code.primrec₂_prec,Nat.RecursiveIn.Code.primrec_rfind': the code constructors are primitive recursive.Nat.RecursiveIn.Code.primrec_ofPartrec: embedding ordinary codes is primitive recursive.Nat.RecursiveIn.Code.eval_curry,Nat.RecursiveIn.Code.primrec₂_curry: specialization preserves evaluation relative to every oracle, and is primitive recursive.Nat.RecursiveIn.Code.exists_primrec₂_smn: the oracle-uniform s-m-n theorem. One primitive recursives : ℕ → ℕ → ℕon indices satisfiesΦ^g_{s(e, m)}(n) ≃ Φ^g_e(⟨m, n⟩)for every oracleg.
Implementation notes #
The constructor lemmas adapt Nat.Partrec.Code.primrec₂_pair and its neighbours in
Mathlib/Computability/PartrecCode.lean (Apache 2.0, by Mario Carneiro) to the numbering
Code.encodeCode, which differs from Mathlib's by the extra atomic code oracle. The embedding
lemma Code.primrec_ofPartrec and the definition of Code.curry through the embedded constant
code follow Nat.Partrec.Code.primrec_toSingleOracleCode and TauCeti.Oracle.Single.Code.curry in
Tau Ceti's
SingleOracle/Code
(Apache 2.0, by the Tau Ceti contributors), restated for this library's oracle codes and its
existing embedding Code.ofPartrec. Code.curry is the oracle analogue of
Mathlib's Nat.Partrec.Code.curry.
References #
Forming the pairing code of two codes is primitive recursive.
Forming the composition code of two codes is primitive recursive.
Forming the primitive recursion code of two codes is primitive recursive.
Forming the unbounded search code of a code is primitive recursive.
Embedding ordinary codes into oracle codes is primitive recursive.
Specialization is primitive recursive in the code and the parameter.
The oracle-uniform s-m-n theorem, in the s¹₁ form with paired arguments. A single
primitive recursive map s on indices specializes the first argument: for every oracle g,
including partial ones, every index e and all m and n, the program with index s e m
computes relative to g on n what the program with index e computes relative to g on
Nat.pair m n. The map s is chosen before the oracle, so it is the same for all oracles; it is
fun e m => encode (curry (ofNat Code e) m). Relativized form of Kleene's s-m-n theorem
[Kle52]; see also [Soa87] for relativization.