Documentation

CslibFrontier.Languages.Probabilistic.QueryCount.Demand

Query budgets through a handler with several kinds of calls #

A program can have separate budgets for signing calls and direct hash queries, for example. If implementing a source call uses at most its weighted sum of source charges on target channel j, then the same weighted sum of program budgets bounds the entire implementation on j. Successive handlers act on the resulting budgets in turn.

These laws specialize vector charges to the pathwise natural-number bounds of Cslib.OracleComp.IsCostBounded.

Main results #

References #

Bas Spitters's vector-charge demand laws in PolyFun.

theorem Cslib.OracleComp.IsCostBounded.sum_mul {Q : Type u} {spec : OracleSpec Q} {α : Type v} {I : Type u_1} (indices : Finset I) (weight : I → ℕ) {cost : I → Q → ℕ} {budget : I → ℕ} {p : OracleComp spec α} (h : ∀ i ∈ indices, IsCostBounded (cost i) p (budget i)) :
IsCostBounded (fun (q : Q) => ∑ i ∈ indices, cost i q * weight i) p (∑ i ∈ indices, budget i * weight i)

A finite weighted sum of budgets bounds the corresponding weighted sum of charges.

theorem Cslib.OracleComp.IsCostBounded.interpret_demand {Q : Type u} {spec : OracleSpec Q} {α : Type v} {I : Type u_1} {J : Type u_2} [Fintype I] {R : Type w} {target : OracleSpec R} (sourceCost : I → Q → ℕ) (targetCost : J → R → ℕ) (demand : I → J → ℕ) {budget : I → ℕ} (handler : (q : Q) → OracleComp target (spec q)) (step : ∀ (q : Q) (j : J), IsCostBounded (targetCost j) (handler q) (∑ i : I, sourceCost i q * demand i j)) {p : OracleComp spec α} (bound : ∀ (i : I), IsCostBounded (sourceCost i) p (budget i)) (j : J) :
IsCostBounded (targetCost j) (OracleComp.interpret handler p) (∑ i : I, budget i * demand i j)

Substitution transfers a family of source budgets to each target channel according to the per-call demand. Only the family of source charges needs to be finite.

theorem Cslib.OracleComp.IsCostBounded.interpret_interpret_demand {Q : Type u} {spec : OracleSpec Q} {α : Type v} {I : Type u_1} {J : Type u_2} {K : Type u_3} [Fintype I] [Fintype J] {R : Type u_4} {T : Type u_5} {mid : OracleSpec R} {target : OracleSpec T} (sourceCost : I → Q → ℕ) (midCost : J → R → ℕ) (targetCost : K → T → ℕ) (d : I → J → ℕ) (e : J → K → ℕ) (f : (q : Q) → OracleComp mid (spec q)) (g : (r : R) → OracleComp target (mid r)) (hf : ∀ (q : Q) (j : J), IsCostBounded (midCost j) (f q) (∑ i : I, sourceCost i q * d i j)) (hg : ∀ (r : R) (k : K), IsCostBounded (targetCost k) (g r) (∑ j : J, midCost j r * e j k)) {budget : I → ℕ} {p : OracleComp spec α} (hp : ∀ (i : I), IsCostBounded (sourceCost i) p (budget i)) (k : K) :
IsCostBounded (targetCost k) (OracleComp.interpret g (OracleComp.interpret f p)) (∑ i : I, budget i * ∑ j : J, d i j * e j k)

With two handlers, demands compose by matrix multiplication. The inner sum ranges over the intermediate channels and the outer sum weights each source budget exactly once.