Encoding of Oracle Programs and Universality #
This file provides an encoding for oracle partial recursive functions and a definition of the universal partial recursive function relative to an oracle, along with a proof that it is universal.
The identity function is recursive in any oracle O.
The composition of two total recursive functions is recursive.
Every primitive recursive function is recursive.
Reindexes an oracle family f : α → ℕ →. ℕ to a family indexed by ℕ via the
denumerable encoding of α; out-of-range indices map to the nowhere-defined function.
Equations
- Computability.oracleCode f i n = match Encodable.decode i with | some a => f a n | none => ⊥
Instances For
Semantics of codeo, relative to an indexed oracle family.
Equations
- One or more equations did not get rendered due to their size.
- Computability.evalo f Computability.codeo.zero = pure 0
- Computability.evalo f Computability.codeo.succ = fun (n : ℕ) => ↑(some (n + 1))
- Computability.evalo f Computability.codeo.left = fun (n : ℕ) => ↑(some (Nat.unpair n).1)
- Computability.evalo f Computability.codeo.right = fun (n : ℕ) => ↑(some (Nat.unpair n).2)
- Computability.evalo f (Computability.codeo.oracle i) = match Encodable.decode i with | some a => f a | none => fun (x : ℕ) => ⊥
- Computability.evalo f (cf.pair cg) = fun (n : ℕ) => Nat.pair <$> Computability.evalo f cf n <*> Computability.evalo f cg n
- Computability.evalo f (cf.comp cg) = fun (n : ℕ) => Computability.evalo f cg n >>= Computability.evalo f cf
Instances For
Encodes a code as a natural number.
Equations
- Computability.encodeCodeo Computability.codeo.zero = 0
- Computability.encodeCodeo Computability.codeo.succ = 1
- Computability.encodeCodeo Computability.codeo.left = 2
- Computability.encodeCodeo Computability.codeo.right = 3
- Computability.encodeCodeo (Computability.codeo.oracle i) = 4 + 5 * i
- Computability.encodeCodeo (cf.pair cg) = 4 + (5 * Nat.pair (Computability.encodeCodeo cf) (Computability.encodeCodeo cg) + 1)
- Computability.encodeCodeo (cf.comp cg) = 4 + (5 * Nat.pair (Computability.encodeCodeo cf) (Computability.encodeCodeo cg) + 2)
- Computability.encodeCodeo (cf.prec cg) = 4 + (5 * Nat.pair (Computability.encodeCodeo cf) (Computability.encodeCodeo cg) + 3)
- Computability.encodeCodeo cf.rfind' = 4 + (5 * Computability.encodeCodeo cf + 4)
Instances For
Decodes a natural number into a code; the inverse of encodeCodeo.
Equations
- One or more equations did not get rendered due to their size.
- Computability.decodeCodeo 0 = Computability.codeo.zero
- Computability.decodeCodeo 1 = Computability.codeo.succ
- Computability.decodeCodeo 2 = Computability.codeo.left
- Computability.decodeCodeo 3 = Computability.codeo.right
Instances For
Returns a code for the constant function outputting a particular natural.
Equations
Instances For
A code for the identity function.
Instances For
Given a code c taking a pair as input, returns a code using n as the first argument to c.
Equations
- Computability.curry c n = c.comp ((Computability.const n).pair Computability.idCode)
Instances For
The encoding of the code for the constant function with value n.
Equations
Instances For
One primitive-recursion step used to show encodeConst is primitive recursive.
Equations
- Computability.encodeConstStepFun p = 4 + (5 * Nat.pair 1 (Nat.unpair (Nat.unpair p).2).2 + 2)
Instances For
The encoding of the code pairing the constant n with the identity code.
Equations
Instances For
The encoding of the code applying oracle 0 to the constant n (an s-m-n index).
Equations
Instances For
A function is partial recursive relative to an indexed set of oracles O if and only if there
is a code implementing it.
Therefore, evalo is a universal partial recursive function relative to g.