Bounding Queries Made by a Computation #
This file defines a predicate IsQueryBound oa budget canQuery cost parameterized by:
B— the budget typebudget : B— the initial budgetcanQuery : ι → B → Prop— whether a query to oracletis allowed under budgetbcost : ι → B → B— how the budget is updated after a query to oraclet
The definition is structural via OracleComp.construct: pure satisfies any bound, and
query t >>= mx satisfies the bound when canQuery t b holds and each continuation
satisfies the bound with the updated budget cost t b.
The classical per-index bound (qb : ι → ℕ, decrement the queried index) is recovered by
IsPerIndexQueryBound.
Generalized query bound parameterized by a budget type, a validity check, and a cost
function. pure satisfies any bound; query t >>= mx satisfies the bound when
canQuery t b and every continuation satisfies the bound at cost t b.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Per-index query bound: qb t gives the maximum number of queries to oracle t.
Each query to t decrements qb t by one. Recovers the classical notion.
Equations
- oa.IsPerIndexQueryBound qb = oa.IsQueryBound qb (fun (t : ι) (qb : ι → ℕ) => 0 < qb t) fun (t : ι) (qb : ι → ℕ) => Function.update qb t (qb t - 1)
Instances For
Soundness: structural bound implies dynamic count bound #
The structural query bound IsPerIndexQueryBound is sound with respect to the dynamic
query count produced by countingOracle: if a computation satisfies a per-index query bound,
then every execution path's query count is bounded.
Proof strategy: induction on OracleComp, matching the structural IsQueryBound decomposition
with the mem_support_simulate_queryBind_iff characterization of counting oracle support.
Worst-case query bounds as a function of input size #
Worst-case per-index query bound as a function of input size:
for all inputs x with size x ≤ n, the computation f x makes at most bound n i
queries to oracle i.
Equations
- OracleComp.QueryUpperBound f size bound = ∀ (n : ℕ) (x : α), size x ≤ n → (f x).IsPerIndexQueryBound (bound n)
Instances For
Total query upper bound: there exists a constant k such that for all inputs x
with size x ≤ n, the computation f x makes at most k * bound n total queries.
Uses the structural IsQueryBound to avoid dependence on oracle responses.
Equations
Instances For
PolyQueryUpperBound says the per-index query count is polynomially bounded
in the input size. This is a non-parameterized version of PolyQueries.
Equations
- OracleComp.PolyQueryUpperBound f size = ∃ (qb : ι → Polynomial ℕ), OracleComp.QueryUpperBound f size fun (n : ℕ) (i : ι) => Polynomial.eval n (qb i)
Instances For
If f has a QueryUpperBound, then each f x satisfies IsPerIndexQueryBound.
If oa is a computation indexed by a security parameter, then PolyQueries oa
means that for each oracle index there is a polynomial function qb of the security parameter,
such that the number of queries to that oracle is bounded by the corresponding polynomial.
- qb : ι → Polynomial ℕ
qb iis a polynomial bound on the queries made to oraclei. - qb_isQueryBound (n : ℕ) (x : α n) : (oa n x).IsPerIndexQueryBound fun (i : ι) => Polynomial.eval n (self.qb i)
The bound is actually a bound on the number of queries made.