Cost budgets from call budgets #
A program that makes at most n calls, each costing at most c, costs at most n * c. The
per-call bound need only hold on the calls satisfying a predicate that every call of the program
satisfies (OracleComp.QueriesSatisfy), such as a size bound on the requests.
Main results #
Cslib.OracleComp.IsQueryBounded.isCostBounded_mul: at mostncalls, each satisfying a predicate on which calls cost at mostc, cost at mostn * c.Cslib.OracleComp.IsQueryBounded.isCostBounded_mul_of_forall_le: the case where every call costs at mostc.Cslib.OracleComp.IsCostBounded.mul_of_le: a budgetnfor one cost gives the budgetn * cfor a cost at mostctimes it, for example external requests costing at mostceach.
theorem Cslib.OracleComp.IsQueryBounded.isCostBounded_mul {ι : Type u} {spec : OracleSpec ι} {α : Type v} {cost : ι → ℕ} {c n : ℕ} {program : OracleComp spec α} {p : ι → Prop} (h : program.IsQueryBounded n) (hp : QueriesSatisfy p program) (hcost : ∀ (q : ι), p q → cost q ≤ c) :
IsCostBounded cost program (n * c)
At most n calls, each satisfying p, cost at most n * c when the calls satisfying p
cost at most c.
theorem Cslib.OracleComp.IsQueryBounded.isCostBounded_mul_of_forall_le {ι : Type u} {spec : OracleSpec ι} {α : Type v} {cost : ι → ℕ} {c n : ℕ} {program : OracleComp spec α} (h : program.IsQueryBounded n) (hcost : ∀ (q : ι), cost q ≤ c) :
IsCostBounded cost program (n * c)
At most n calls, each costing at most c, cost at most n * c.
theorem Cslib.OracleComp.IsCostBounded.mul_of_le {ι : Type u} {spec : OracleSpec ι} {α : Type v} {cost : ι → ℕ} {c n : ℕ} {program : OracleComp spec α} {cost' : ι → ℕ} (h : IsCostBounded cost program n) (hcost : ∀ (q : ι), cost' q ≤ cost q * c) :
IsCostBounded cost' program (n * c)
A budget n for cost gives the budget n * c for every cost cost' with
cost' q ≤ cost q * c. With cost counting only some calls, such as the external queries of a
program with private coins, this bounds the total cost of those calls at c each.