Documentation

VCVio.OracleComp.QueryTracking.Iter

Query Bounds for Iteration Constructs #

This file lifts the structural query-bound predicates (IsTotalQueryBound, IsQueryBoundP, IsPerIndexQueryBound) across the iteration combinators OracleComp.replicate, OracleComp.replicateTR, List.mapM, and List.foldlM.

For the fixed-body case replicate n oa, the bound is exactly multiplicative — we get an iff between the loop bound n * k and the body bound k (when 0 < n) for IsTotalQueryBound and IsQueryBoundP. The reverse direction goes through isTotalQueryBound_iff_counting_total_le / isQueryBoundP_iff_counting_filter_le and a witness lemma showing every counting-oracle support point of oa lifts to an n-fold copy in replicate n oa.

For the variable-body case (List.mapM / List.foldlM), only the forward direction is available: the loop bound is the element-wise sum of body bounds.

Forward replicate bounds #

theorem OracleComp.isTotalQueryBound_replicate {ι : Type u} {spec : OracleSpec ι} {α : Type u} {oa : OracleComp spec α} {k : } (h : oa.IsTotalQueryBound k) (n : ) :
theorem OracleComp.isQueryBoundP_replicate {ι : Type u} {spec : OracleSpec ι} {α : Type u} {oa : OracleComp spec α} {p : ιProp} [DecidablePred p] {k : } (h : oa.IsQueryBoundP p k) (n : ) :
(replicate n oa).IsQueryBoundP p (n * k)
theorem OracleComp.isPerIndexQueryBound_replicate {ι : Type u} {spec : OracleSpec ι} {α : Type u} [DecidableEq ι] {oa : OracleComp spec α} {qb : ι} (h : oa.IsPerIndexQueryBound qb) (n : ) :

Divide-trick iff for the fixed-body case #

When the body oa is fixed, the loop bound n * k is exactly characterized by the body bound k: forward by isTotalQueryBound_replicate, reverse by lifting any counting-oracle support point of oa to an n-fold copy in replicate n oa.

theorem OracleComp.isTotalQueryBound_replicate_iff {ι : Type u} {spec : OracleSpec ι} {α : Type u} [Finite ι] [spec.Inhabited] {oa : OracleComp spec α} {n k : } (hn : 0 < n) :
theorem OracleComp.isQueryBoundP_replicate_iff {ι : Type u} {spec : OracleSpec ι} {α : Type u} [Finite ι] [spec.Inhabited] {oa : OracleComp spec α} {p : ιProp} [DecidablePred p] {n k : } (hn : 0 < n) :
(replicate n oa).IsQueryBoundP p (n * k) oa.IsQueryBoundP p k

replicateTR corollaries #

theorem OracleComp.isTotalQueryBound_replicateTR {ι : Type u} {spec : OracleSpec ι} {α : Type u} {oa : OracleComp spec α} {k : } (h : oa.IsTotalQueryBound k) (n : ) :
theorem OracleComp.isQueryBoundP_replicateTR {ι : Type u} {spec : OracleSpec ι} {α : Type u} {oa : OracleComp spec α} {p : ιProp} [DecidablePred p] {k : } (h : oa.IsQueryBoundP p k) (n : ) :
(replicateTR n oa).IsQueryBoundP p (n * k)
theorem OracleComp.isPerIndexQueryBound_replicateTR {ι : Type u} {spec : OracleSpec ι} {α : Type u} [DecidableEq ι] {oa : OracleComp spec α} {qb : ι} (h : oa.IsPerIndexQueryBound qb) (n : ) :
theorem OracleComp.isTotalQueryBound_replicateTR_iff {ι : Type u} {spec : OracleSpec ι} {α : Type u} [Finite ι] [spec.Inhabited] {oa : OracleComp spec α} {n k : } (hn : 0 < n) :
theorem OracleComp.isQueryBoundP_replicateTR_iff {ι : Type u} {spec : OracleSpec ι} {α : Type u} [Finite ι] [spec.Inhabited] {oa : OracleComp spec α} {p : ιProp} [DecidablePred p] {n k : } (hn : 0 < n) :

List.mapM and List.foldlM (forward only) #

theorem OracleComp.isTotalQueryBound_listMapM {ι : Type u} {spec : OracleSpec ι} {α β : Type u} {f : αOracleComp spec β} {k : α} (h : ∀ (x : α), (f x).IsTotalQueryBound (k x)) (xs : List α) :
theorem OracleComp.isTotalQueryBound_listMapM_const {ι : Type u} {spec : OracleSpec ι} {α β : Type u} {f : αOracleComp spec β} {k : } (h : ∀ (x : α), (f x).IsTotalQueryBound k) (xs : List α) :
theorem OracleComp.isTotalQueryBound_listFoldlM {ι : Type u} {spec : OracleSpec ι} {α β : Type u} {f : βαOracleComp spec β} {k : α} (h : ∀ (b : β) (x : α), (f b x).IsTotalQueryBound (k x)) (b₀ : β) (xs : List α) :
theorem OracleComp.isQueryBoundP_listMapM {ι : Type u} {spec : OracleSpec ι} {α β : Type u} {f : αOracleComp spec β} {p : ιProp} [DecidablePred p] {k : α} (h : ∀ (x : α), (f x).IsQueryBoundP p (k x)) (xs : List α) :
theorem OracleComp.isQueryBoundP_listMapM_const {ι : Type u} {spec : OracleSpec ι} {α β : Type u} {f : αOracleComp spec β} {p : ιProp} [DecidablePred p] {k : } (h : ∀ (x : α), (f x).IsQueryBoundP p k) (xs : List α) :
theorem OracleComp.isQueryBoundP_listFoldlM {ι : Type u} {spec : OracleSpec ι} {α β : Type u} {f : βαOracleComp spec β} {p : ιProp} [DecidablePred p] {k : α} (h : ∀ (b : β) (x : α), (f b x).IsQueryBoundP p (k x)) (b₀ : β) (xs : List α) :
(List.foldlM f b₀ xs).IsQueryBoundP p (List.map k xs).sum
theorem OracleComp.isPerIndexQueryBound_listMapM {ι : Type u} {spec : OracleSpec ι} {α β : Type u} [DecidableEq ι] {f : αOracleComp spec β} {qb : αι} (h : ∀ (x : α), (f x).IsPerIndexQueryBound (qb x)) (xs : List α) :
theorem OracleComp.isPerIndexQueryBound_listMapM_const {ι : Type u} {spec : OracleSpec ι} {α β : Type u} [DecidableEq ι] {f : αOracleComp spec β} {qb : ι} (h : ∀ (x : α), (f x).IsPerIndexQueryBound qb) (xs : List α) :
theorem OracleComp.isPerIndexQueryBound_listFoldlM {ι : Type u} {spec : OracleSpec ι} {α β : Type u} [DecidableEq ι] {f : βαOracleComp spec β} {qb : αι} (h : ∀ (b : β) (x : α), (f b x).IsPerIndexQueryBound (qb x)) (b₀ : β) (xs : List α) :