Bounded evaluation of oracle programs, with use #
This file defines TauCeti.Oracle.Single.Code.evaln σ k c n, the run of the program c on the
input n with fuel k against the oracle answers σ : ℕ → Option ℕ. A successful run records its
output together with its use: one more than the largest oracle address it queried, or 0 when
it made no query. An answer σ z = none means that no answer is supplied at z, not a negative
answer; a run that queries there fails. A finite oracle string l is the case fun z => l[z]?,
and a total oracle O : ℕ → ℕ the case fun z => some (O z).
Bounded evaluation follows Mathlib's Nat.Partrec.Code.evaln: at fuel k + 1 a run fails on
inputs above k, and the recursions of prec and rfind' consume fuel. Hence a run at fuel k
has input below k and queries only addresses below k, so its use is at most k.
Use is what makes oracle computations finitary: a successful run reads only the answers below its use, so it succeeds unchanged against any answers agreeing there, and its output is then a value of the program relative to every oracle extending those answers.
Main definitions #
TauCeti.Oracle.Single.Code.Halt: the output and use of a successful run.TauCeti.Oracle.Single.Code.evaln: bounded evaluation against oracle answers.TauCeti.Oracle.Single.Code.stageUse: the use of a run, or0when it fails.TauCeti.Oracle.Single.Code.setAnswers: the answers of the characteristic function of a set.
Main results #
TauCeti.Oracle.Single.Code.evaln_succ_pair_eq_someand its neighbours: the clauses of bounded evaluation, one for each program constructor.TauCeti.Oracle.Single.Code.evaln_mono: a successful run persists, with the same output and use, at larger fuel;TauCeti.Oracle.Single.Code.evaln_unique: its output and use do not depend on the fuel.TauCeti.Oracle.Single.Code.evaln_bound,TauCeti.Oracle.Single.Code.evaln_use_le: the input and the use of a run at fuelkare belowk, respectively at mostk.TauCeti.Oracle.Single.Code.evaln_eq_some_of_eqOn: the use principle, a run succeeds with the same output and use against answers agreeing below its use.TauCeti.Oracle.Single.Code.evaln_sound: the output of a successful run is a value of the program relative to every oracle whose values include the answers below the use.TauCeti.Oracle.Single.Code.mem_eval_iff_exists_evaln: when the answers are exactly the values of an oracle, the values of a program relative to that oracle are exactly the outputs of its successful runs.TauCeti.Oracle.Single.Code.mem_eval_iff_exists_evaln_range_map: the values of a program relative to a total oracle are exactly the outputs of its successful runs against the finite initial segments of the oracle.
References #
- R. I. Soare, Recursively Enumerable Sets and Degrees, Springer, 1987, Chapter III.1, in particular the use principle III.1.9.
- The definition and the proofs of persistence, soundness and completeness follow Mathlib's
Nat.Partrec.Code.evaln,Nat.Partrec.Code.evaln_mono,Nat.Partrec.Code.evaln_soundandNat.Partrec.Code.evaln_complete, extended by the oracle instruction and the use.
Instances For
Bounded evaluation of a program with fuel k against the oracle answers σ, where σ z = none
means that no answer is supplied at z. A successful run returns its output and its use; see
TauCeti.Oracle.Single.Code.Halt.
As in Nat.Partrec.Code.evaln, at fuel k + 1 each instruction fails on inputs above k, and the
recursive calls of prec and rfind' at the next argument use fuel k. The oracle instruction
queries σ at its input n and has use n + 1; the other basic instructions have use 0, and a
compound program has the largest use of the runs it makes.
Instances For
rfind' cf at m runs cf at m. On output 0 it returns m; otherwise it continues the
search at m + 1 with one less fuel. Its use is the largest use of the runs of cf it makes.
The stage use of the run of c on n with fuel k against the answers σ: the use of
the run when it succeeds, and 0 when it fails. A successful run can also have use 0, so the
stage use does not record whether the run succeeded.
Instances For
The answers of two sets agree on S exactly when the sets have the same members in S.
Soundness. If a run against the answers σ succeeds, and every answer σ gives below its
use is a value of the oracle O, then the output of the run is a value of the program relative
to O. Answers at or above the use are not read, so they need not be correct.
Completeness. If the answers σ give every value of the oracle O, every value of a
program relative to O is the output of a successful run against σ at some fuel. The answers
may go beyond O at addresses where O is undefined.
Correspondence with evaluation. If the answers σ are exactly the values of the oracle
O, the values of a program relative to O are exactly the outputs of its successful runs
against σ.
Evaluation through finite initial segments. For a total oracle O, the values of a
program relative to O are exactly the outputs of its successful runs, at some fuel k, against
the finite oracle string O 0, …, O (k - 1).