Forking oracle programs #
An oracle program P s : OracleComp (fun _ : Query => H) (Option ℕ × β), with explicit coins
s, asks queries whose answers lie in a finite set H and finally names one of its queries by
its position, or none. A name counts only if the program actually asked a query at that position
(validIndex). Forking runs the program with uniform answers and, if it validly names position
j, runs it again on the same coins with the same answers before j and fresh answers from j
on; it succeeds when the rerun validly names j too and the answers at j differ. Both runs then
ask the same first j + 1 queries, so the named query exists in both and is the same, while its
two answers differ (mem_support_fork).
runWithAnswers runs a program on a list of answers, deterministically, recording its queries.
Sequencing splits the answers (runWithAnswers_bind), so properties of a program run through a
stateful handler follow from properties of single calls
(runWithAnswers_run_interpret_invariant).
Answering queries from q presampled uniform answers has the law of answering them uniformly as
they come, when the program asks at most q queries: this is the presampling theorem
OracleComp.IsQueryBounded.run_interpret_presample (interpret_uniform_eq, and
run_interpret_countingUniform_eq when the queries are also counted). Hence the general forking
lemma (Probability.Forking.le_add_sqrt_fork) bounds the probability that the program, with
uniform answers, validly names a query by q / |H| + √(q · frk) (le_add_sqrt_fork).
The coins are explicit: the second run replays them. A program with private randomness is put in this form by drawing its coins in advance. The statements are exact; no efficiency is involved.
Main definitions #
Cslib.OracleComp.runWithAnswers: run on a list of answers, recording the queries.Cslib.OracleComp.validIndex: the named position, if it is belowqand was queried.Cslib.OracleComp.countingUniform: uniform answers as queries come, counting them.Cslib.OracleComp.forkingAlgorithm: a program on coins and an answer vector, for forking.
Main results #
Cslib.OracleComp.interpret_uniform_eq,Cslib.OracleComp.run_interpret_countingUniform_eq: uniform answers as they come, or presampled.Cslib.OracleComp.le_add_sqrt_fork: the forking lemma for oracle programs.Cslib.OracleComp.mem_support_fork: both runs of a successful fork ask the same queries up to the named one, and answer it differently.Cslib.OracleComp.take_runWithAnswers: a program's firstn + 1queries depend only on its firstnanswers.Cslib.OracleComp.runWithAnswers_run_interpret_invariant: an invariant of a handler's state and the queries asked so far holds after running a program through the handler on fixed answers.
References #
Run a program on a list of answers, in order, answering default once the list is exhausted;
return its result and its queries, in order.
Instances For
A query is answered by the head of the list, and the rest goes to the continuation.
A program's first n + 1 queries depend only on the first n answers.
Running a sequenced program on a list of answers runs the first part on the list and the second part on the answers the first part left unused.
A program making at most n calls asks at most n queries on every list of answers.
An invariant of a handler's run on a list of answers. A program runs through a stateful handler whose calls are oracle programs, and the resulting program runs on a list of answers. A property of the handler's state and of the queries asked so far that every handler call preserves, when run on the answers not yet used, holds at the end.
Presampled answers #
The lazy law of uniform answers is the law of q presampled uniform answers, for a program
asking at most q queries: an instance of the presampling theorem
ProbOracleComp.IsQueryBounded.eval_presample.
Counting variant of interpret_uniform_eq: answering uniformly as queries come, and counting
them, has the law of running on q presampled uniform answers and counting the queries made.
Forking #
A program with explicit coins as an algorithm on coins and q answers, for the general
forking lemma: the validly named position, and the result with the queries.
Instances For
The forking lemma for oracle programs ([BN06], Lemma 1): if a program with
explicit coins asks at most q queries, and with probability acc names one of the queries it
made when they are answered uniformly as they come, then forking it succeeds with probability
frk such that acc ≤ q / |H| + √(q · frk).
A successful fork of a program reruns it on the same coins with answers that agree before the
named position j and differ at it. Both runs name j, ask the same first j + 1 queries, and
have actually asked a query at position j, the same one.