Documentation

VCVio.OracleComp.QueryTracking.QueryBound

Bounding Queries Made by a Computation #

This file defines a predicate IsQueryBound oa budget canQuery cost parameterized by:

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.

def OracleComp.IsQueryBound {ι : Type u} {spec : OracleSpec ι} {α : Type u} {B : Type u_1} (oa : OracleComp spec α) (budget : B) (canQuery : ιBProp) (cost : ιBB) :

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
    @[simp]
    theorem OracleComp.isQueryBound_pure {ι : Type u} {spec : OracleSpec ι} {α : Type u} {B : Type u_1} (x : α) (b : B) (canQuery : ιBProp) (cost : ιBB) :
    (pure x).IsQueryBound b canQuery cost
    theorem OracleComp.isQueryBound_query_bind_iff {ι : Type u} {spec : OracleSpec ι} {α : Type u} {B : Type u_1} (t : ι) (mx : spec tOracleComp spec α) (b : B) (canQuery : ιBProp) (cost : ιBB) :
    (liftM (query t) >>= mx).IsQueryBound b canQuery cost canQuery t b ∀ (u : spec t), (mx u).IsQueryBound (cost t b) canQuery cost
    @[simp]
    theorem OracleComp.isQueryBound_query_iff {ι : Type u} {spec : OracleSpec ι} {B : Type u_1} (t : ι) (b : B) (canQuery : ιBProp) (cost : ιBB) :
    (liftM (query t)).IsQueryBound b canQuery cost canQuery t b
    @[simp]
    theorem OracleComp.isQueryBound_map_iff {ι : Type u} {spec : OracleSpec ι} {α β : Type u} {B : Type u_1} (oa : OracleComp spec α) (f : αβ) (b : B) (canQuery : ιBProp) (cost : ιBB) :
    (f <$> oa).IsQueryBound b canQuery cost oa.IsQueryBound b canQuery cost
    theorem OracleComp.isQueryBound_congr {ι : Type u} {spec : OracleSpec ι} {α : Type u} {B : Type u_1} {oa : OracleComp spec α} {b : B} {canQuery₁ canQuery₂ : ιBProp} {cost₁ cost₂ : ιBB} (hcan : ∀ (t : ι) (b : B), canQuery₁ t b canQuery₂ t b) (hcost : ∀ (t : ι) (b : B), cost₁ t b = cost₂ t b) :
    oa.IsQueryBound b canQuery₁ cost₁ oa.IsQueryBound b canQuery₂ cost₂
    @[reducible, inline]
    abbrev OracleComp.IsPerIndexQueryBound {ι : Type u} {spec : OracleSpec ι} {α : Type u} [DecidableEq ι] (oa : OracleComp spec α) (qb : ι) :

    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
    Instances For
      @[simp]
      theorem OracleComp.isPerIndexQueryBound_pure {ι : Type u} {spec : OracleSpec ι} {α : Type u} [DecidableEq ι] (x : α) (qb : ι) :
      theorem OracleComp.isPerIndexQueryBound_query_bind_iff {ι : Type u} {spec : OracleSpec ι} {α : Type u} [DecidableEq ι] (t : ι) (mx : spec tOracleComp spec α) (qb : ι) :
      (liftM (query t) >>= mx).IsPerIndexQueryBound qb 0 < qb t ∀ (u : spec t), (mx u).IsPerIndexQueryBound (Function.update qb t (qb t - 1))
      @[simp]
      theorem OracleComp.isPerIndexQueryBound_query_iff {ι : Type u} {spec : OracleSpec ι} [DecidableEq ι] (t : ι) (qb : ι) :
      theorem OracleComp.IsPerIndexQueryBound.mono {ι : Type u} {spec : OracleSpec ι} {α : Type u} [DecidableEq ι] {oa : OracleComp spec α} {qb qb' : ι} (h : oa.IsPerIndexQueryBound qb) (hle : qb qb') :
      theorem OracleComp.isPerIndexQueryBound_bind {ι : Type u} {spec : OracleSpec ι} {α β : Type u} [DecidableEq ι] {oa : OracleComp spec α} {ob : αOracleComp spec β} {qb₁ qb₂ : ι} (h1 : oa.IsPerIndexQueryBound qb₁) (h2 : ∀ (x : α), (ob x).IsPerIndexQueryBound qb₂) :
      (oa >>= ob).IsPerIndexQueryBound (qb₁ + qb₂)
      @[simp]
      theorem OracleComp.isPerIndexQueryBound_map_iff {ι : Type u} {spec : OracleSpec ι} {α β : Type u} [DecidableEq ι] (oa : OracleComp spec α) (f : αβ) (qb : ι) :

      Soundness: structural bound implies dynamic count bound #

      theorem OracleComp.IsPerIndexQueryBound.counting_bounded {ι : Type u} {spec : OracleSpec ι} {α : Type u} [DecidableEq ι] {oa : OracleComp spec α} {qb : ι} (h : oa.IsPerIndexQueryBound qb) {z : α × OracleSpec.QueryCount ι} (hz : z support (countingOracle.simulate oa 0)) :
      z.2 qb

      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 #

      def OracleComp.QueryUpperBound {ι : Type u} {spec : OracleSpec ι} {α β : Type u} [DecidableEq ι] (f : αOracleComp spec β) (size : α) (bound : ι) :

      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
      Instances For
        def OracleComp.TotalQueryUpperBound {ι : Type u} {spec : OracleSpec ι} {α β : Type u} (f : αOracleComp spec β) (size : α) (bound : ) :

        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
          def OracleComp.PolyQueryUpperBound {ι : Type u} {spec : OracleSpec ι} {α β : Type u} [DecidableEq ι] (f : αOracleComp spec β) (size : α) :

          PolyQueryUpperBound says the per-index query count is polynomially bounded in the input size. This is a non-parameterized version of PolyQueries.

          Equations
          Instances For
            theorem OracleComp.QueryUpperBound.apply {ι : Type u} {spec : OracleSpec ι} {α β : Type u} [DecidableEq ι] {f : αOracleComp spec β} {size : α} {bound : ι} (h : QueryUpperBound f size bound) (x : α) :
            (f x).IsPerIndexQueryBound (bound (size x))

            If f has a QueryUpperBound, then each f x satisfies IsPerIndexQueryBound.

            structure OracleComp.PolyQueries {ι : Type} [DecidableEq ι] {spec : OracleSpec ι} {α β : Type} (oa : (n : ) → α nOracleComp (spec n) (β n)) :

            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.

            Instances For