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 and total query bounds are recovered by IsPerIndexQueryBound
and IsTotalQueryBound.
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.
Instances For
Transfer a structural query bound through simulateQ into a stateful target semantics,
provided each simulated source query has a target-side step bound and the target-side bind
rule composes those step budgets with the recursive continuation budget.
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.
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.
Total query bounds #
A total query bound: the computation makes at most n queries total
(across all oracle indices).
Instances For
If a computation is followed by a continuation that always starts with one query,
then a bound on the whole computation by n + 1 yields a bound on the prefix by n.
If oa >>= ob is totally query-bounded by n, then after any support point of the
counting run of oa, the continuation ob is bounded by the residual budget.
Any support point of the counting simulation of a totally query-bounded computation has total query count at most the structural bound.
If a stateful simulation has support cost at most one per query step, then any support point of the simulated prefix leaves the continuation bounded by the residual budget measured by that cost. The cost may under-approximate the true query count, so the resulting residual budget is correspondingly weaker but still sound.
Per-index bound implies total bound (sum over indices).
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.
Currently unused outside this file; retained as scaffolding for future asymptotic analyses.
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.
Currently unused outside this file; retained as scaffolding for future asymptotic analyses.
Instances For
PolyQueryUpperBound says the per-index query count is polynomially bounded
in the input size. This is a non-parameterized version of PolyQueries.
Currently unused outside this file; retained as scaffolding for future asymptotic analyses.
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.
Currently used only in CostModel.lean; retained as scaffolding for future asymptotic analyses.
- 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.