Expected query cost #
OracleComp.expectedCost h cost program is the expected total cost of the calls of program when
each call q is answered by an independent sample of h q and costs cost q. It is the
average-case companion of the worst-case budget OracleComp.IsCostBounded: a budget of n bounds
the expected cost by n (OracleComp.expectedCost_le_of_isCostBounded). Unlike a budget, the
expected cost depends on the answers, so it is taken with respect to the distributions h, as in
OracleComp.evalWith.
The expected cost is defined by recursion on the tree of calls. It is additive under sequencing,
weighting the continuation by the output distribution of the first program (Wald's identity,
OracleComp.expectedCost_bind), linear in the cost, and monotone in it. Replacing each call by a
program over another interface turns the expected cost into the expected cost of the original calls,
each priced at the expected cost of its replacement (OracleComp.expectedCost_interpret).
With a cost that is 1 on the reads of one position of an oracle and 0 elsewhere, the expected
cost is the expected number of times a program reads that position, which is how the smoothness of
a local decoder is measured.
Cslib.DataStructure.RandomizedSpec.expectedCost is the stateful counterpart, for calls to a
randomized data structure whose answers depend on its state, with its own Wald identity
(RandomizedSpec.expectedCost_bind) and budget bound
(RandomizedSpec.expectedCost_le_of_isCostBounded).
Main definitions #
Cslib.OracleComp.expectedCost: the expected total cost of the calls.
Main results #
Cslib.OracleComp.expectedCost_bind: expected costs add under sequencing.Cslib.OracleComp.expectedCost_le_of_isCostBounded: a budget bounds the expected cost.Cslib.OracleComp.expectedCost_sum,Cslib.OracleComp.expectedCost_mono: linearity and monotonicity in the cost.Cslib.OracleComp.expectedCost_interpret: the expected cost of a program run through a handler.
The expected total cost of the calls of program when each call q is answered by an
independent sample of h q and costs cost q.
Instances For
Returning a value makes no call.
A call costs its cost, followed by the expected cost of the continuation at its answer.
A single call costs its cost.
Wald's identity for oracle programs: the expected cost of a sequence is the expected cost of the first program plus the expected cost of the continuation at its result.
Postprocessing the result makes no call.
A budget bounds the expected cost, whatever the distributions of the answers.
A program whose calls all cost nothing under one cost has zero expected cost under every cost that vanishes on the same calls.
Calls that cost nothing have zero expected cost.
The expected cost is additive in the cost.
The expected cost of a finite sum of costs is the sum of the expected costs.
The expected cost is monotone in the cost.
The expected cost of a program whose calls were replaced by programs over another interface is the expected cost of the original calls, each priced at the expected cost of its replacement and answered with the distribution of its replacement.
Private coins are free: a closed sampler has zero expected cost under every cost of the external queries.