Documentation

CslibFrontier.Languages.Probabilistic.Oracle.Substitution.QueryCount

Query budgets of substituted programs #

A reduction built with ProbOracleComp.simulate handler A keeps A's private samples and replaces each external query q by the program handler q. When every handler program costs at most the cost of the query it replaces, the reduction keeps A's budget. In particular, a reduction whose handlers each make at most one query makes at most as many queries as A, and a handler family whose external queries all satisfy p' yields a substituted program whose external queries all satisfy p'.

Main results #

theorem Cslib.ProbOracleComp.isCostBounded_simulate {Query : Type u} {Query' : Type v} {α : Type} {spec : Query → Type} {spec' : Query' → Type} {cost : Query → ℕ} {cost' : Query' → ℕ} {handler : (q : Query) → ProbOracleComp spec' (spec q)} (hhandler : ∀ (q : Query), OracleComp.IsCostBounded (Sum.elim (fun (x : ℕ) => 0) cost') (handler q) (cost q)) {program : ProbOracleComp spec α} {n : ℕ} (h : OracleComp.IsCostBounded (Sum.elim (fun (x : ℕ) => 0) cost) program n) :
OracleComp.IsCostBounded (Sum.elim (fun (x : ℕ) => 0) cost') (simulate handler program) n

A substituted program costs at most n when the original program does and each handler program costs at most the cost of the query it replaces.

theorem Cslib.ProbOracleComp.IsQueryBounded.simulate {Query : Type u} {Query' : Type v} {α : Type} {spec : Query → Type} {spec' : Query' → Type} {handler : (q : Query) → ProbOracleComp spec' (spec q)} (hhandler : ∀ (q : Query), (handler q).IsQueryBounded 1) {program : ProbOracleComp spec α} {n : ℕ} (h : program.IsQueryBounded n) :

A substituted program makes at most n queries when the original program does and each handler program makes at most one.

theorem Cslib.ProbOracleComp.queriesSatisfy_simulate {Query : Type u} {Query' : Type v} {α : Type} {spec : Query → Type} {spec' : Query' → Type} {p' : Query' → Prop} {handler : (q : Query) → ProbOracleComp spec' (spec q)} (hhandler : ∀ (q : Query), QueriesSatisfy p' (handler q)) (program : ProbOracleComp spec α) :
QueriesSatisfy p' (simulate handler program)

A substituted program asks only external queries satisfying p' when every handler program does, whatever the original program asks.