Running a program against a stateful oracle #
A program with private samples and typed external calls (Cslib.ProbOracleComp) interacts with a
stateful probabilistic oracle answering each call q with an element of spec q, possibly at
random and updating a private state. Cslib.ProbOracleComp.runWith is the joint law of the result
and the final oracle state, with fresh fair samples for the private coins, and
Cslib.ProbOracleComp.acceptProbWith the probability that a Boolean program returns true.
A prover of an interactive proof is such an oracle; Cslib.Complexity.Prover.run is the case of
word queries and replies (Cslib.Complexity.Prover.run_eq_runWith).
runWith is the instance of the generic OracleComp.runWith whose handler is the sum
OracleComp.sumHandler of fresh uniform draws for private samples, which keep the state, and
oracle for external calls. Against a memoryless oracle it is OracleComp.evalWith of the sum of
the uniform handler and the oracle, with the state unchanged (runWith_lift). Its structural
rules are those of OracleComp.runWith; Languages.Probabilistic.Oracle.Simulation gives its
simulation and state-representation rules.
Main definitions #
Cslib.ProbOracleComp.runWith: the joint law of the result and the final oracle state.Cslib.ProbOracleComp.acceptProbWith: the acceptance probability.
Main results #
Cslib.ProbOracleComp.runWith_lift,Cslib.ProbOracleComp.acceptProbWith_lift: against a memoryless oracle, the instances ofOracleComp.evalWith.Cslib.ProbOracleComp.induction: structural induction over returned values, private uniform draws and external calls;Cslib.ProbOracleComp.sample_unifFinidentifies a draw with its sampling request.Cslib.ProbOracleComp.runWith_pure,Cslib.ProbOracleComp.runWith_bind,Cslib.ProbOracleComp.runWith_map,Cslib.ProbOracleComp.runWith_query,Cslib.ProbOracleComp.runWith_sample: structural rules forrunWith.Cslib.ProbOracleComp.eval_run_interpret_eq_runWith: evaluating a closed run isrunWithagainst the evaluated handler.Cslib.ProbOracleComp.runWith_sample_bind: a private sample averages the continuation's run;Cslib.ProbOracleComp.runWith_sample_bind_congrexchanges samples with the same law, andCslib.ProbOracleComp.runWith_sample_bind_commmoves a sample past any program.Cslib.ProbOracleComp.runWith_interpret,Cslib.ProbOracleComp.runWith_interpret_sumHandler: running an interpreted program runs the original program against the handler programs' runs.Cslib.ProbOracleComp.acceptProbWith_bind: sequencing for acceptance probability.Cslib.ProbOracleComp.acceptProbWith_query_bind,Cslib.ProbOracleComp.acceptProbWith_sample_bind: averages over replies and samples.Cslib.ProbOracleComp.acceptProbWith_bind_ite_le: a check run only after another one accepted accepts at most as often.
A private uniform draw is the sampling request that it embeds.
Structural induction on a program with private samples and external calls: a returned value, a private uniform draw followed by a continuation, or an external call followed by a continuation.
The joint law of the result of program and the final state of the oracle answering its
external calls, starting from the state s. Private samples are fresh. This is the generic
stateful run OracleComp.runWith of the sum handler.
Instances For
The probability that program returns true against the oracle from the state s.
Instances For
Against a memoryless oracle, the run is OracleComp.evalWith of the uniform handler on the
sampling side and the oracle on the other, with the state unchanged.
Against a memoryless oracle, the acceptance probability is the probability of true under
OracleComp.evalWith of the uniform handler and the oracle.
Running program >>= next runs program, then runs next at its result from the oracle
state it reached.
Mapping f over a program maps it over the result and keeps the final oracle state.
A private sample followed by a continuation averages the continuation's run over the sample, from the same oracle state.
Private samples with the same law can be exchanged in front of any continuation.
A private sample commutes with any program: since the draw neither reads nor changes the oracle state, drawing it before or after the program gives the same run.
Running a program whose calls a handler answers with ProbOracleComp spec programs is a
stateful run of the original program, each call answered by running its handler program.
A program whose private draws are forwarded and whose external calls a handler answers with
ProbOracleComp spec programs runs against the oracle that runs each handler program.
Evaluating a closed run, in which a handler program answers the external calls, is runWith
against the evaluated handler.
An acceptance probability is at most 1.
The acceptance probability of program >>= next averages the acceptance probability of next
over the joint law of the result and oracle state of program.
The acceptance probability after an external call q averages over the oracle's replies and
next states.
The acceptance probability after a private sample averages over the law of the sample, with the oracle state unchanged.
Running a second check only after a first one accepted accepts at most as often as the first check.