The Turing join on oracle codes #
The join p ⊕ x (Partrec.join) of two oracles is their least upper bound under ≤ᵀ. This file
proves the code-level, uniform form of that fact for the oracle codes Nat.RecursiveIn.Code: the
reductions behind p ≤ᵀ p ⊕ x, x ≤ᵀ p ⊕ x and join_le are primitive recursive maps on codes
that do not depend on the oracles.
- Substitution.
Code.subst c dreplaces every oracle query ofcby a call to the coded. Relative togit runscrelative to the oracle thatdcomputes fromg(Code.eval_subst), and it is primitive recursive in both codes (Code.primrec₂_subst). - Joining codes.
Code.join a bcomputes, relative to anyg, the join of whataandbcompute relative tog(Code.eval_join), and is primitive recursive (Code.primrec₂_join). - Projections. The fixed codes
Code.joinLeftandCode.joinRightrecoverpandxfrom the oraclep ⊕ x(Code.eval_joinLeft,Code.eval_joinRight).
Together, a program querying p ⊕ x corresponds to computations relative to both oracles. A
code c relative to p becomes the code c.subst joinLeft relative to p ⊕ x
(Code.eval_subst_joinLeft). Conversely, a code c relative to p ⊕ x, given codes a and b
computing p and x from an oracle h, becomes the code c.subst (join a b) relative to h
(Code.eval_subst_join). Both translations are primitive recursive in the codes and the same for
all oracles; Code.exists_primrec_joinLeft, Code.exists_primrec_joinRight and
Code.exists_primrec₂_join state them on indices.
Main definitions #
Nat.RecursiveIn.Code.subst: replace the oracle of a code by a code.Nat.RecursiveIn.Code.join: the code for the join of two codes.Nat.RecursiveIn.Code.joinLeft,Nat.RecursiveIn.Code.joinRight: codes for the two halves of a joined oracle.
Main results #
Nat.RecursiveIn.Code.eval_subst,Nat.RecursiveIn.Code.primrec₂_subst.Nat.RecursiveIn.Code.eval_join,Nat.RecursiveIn.Code.primrec₂_join.Nat.RecursiveIn.Code.eval_subst_joinLeft,Nat.RecursiveIn.Code.eval_subst_joinRight,Nat.RecursiveIn.Code.eval_subst_join: the translations between codes relative top ⊕ xand codes relative top,xor an upper boundh.Nat.RecursiveIn.Code.exists_primrec_joinLeft,Nat.RecursiveIn.Code.exists_primrec_joinRight,Nat.RecursiveIn.Code.exists_primrec₂_join: the same on indices, uniformly in the oracles.
Implementation notes #
Code.join a b adds two branches that a primitive recursion code guards by parity: on even
inputs the first branch runs a and the second returns 0, and on odd inputs the other way round.
The fallback 0 always converges, so the sum converges exactly when the selected branch does. The
fixed arithmetic codes are chosen from Mathlib's Nat.Partrec.Code.exists_code, so Code.join,
Code.joinLeft and Code.joinRight are noncomputable; they are still constants as far as
primitive recursiveness is concerned.
References #
Substituting a code for the oracle #
Replace every oracle query of c by a call to the code d.
Substitution is primitive recursive in both codes.
Fixed arithmetic codes #
A code for a primitive recursive function, chosen once from Nat.Partrec.Code.exists_code.
It does not query the oracle.
Joining codes #
The code for the join: relative to any oracle, join a b computes the join of what a and
b compute.
Joining codes is primitive recursive.
The two halves of a joined oracle #
The code that reads the oracle p from the oracle p ⊕ x.
The code that reads the oracle x from the oracle p ⊕ x.
Translating programs #
The lift along p ≤ᵀ p ⊕ x is a primitive recursive map t on indices, the same for all
oracles p and x.
The lift along x ≤ᵀ p ⊕ x is a primitive recursive map t on indices, the same for all
oracles p and x.
The least upper bound property on indices: one primitive recursive j, the same for every
oracle h, sends indices of p and x relative to h to an index of p ⊕ x relative to h.
Composed with primrec₂_subst, it turns a program relative to p ⊕ x into one relative to h
(eval_subst_join).