Structures For Tracking a Computation's Oracle Queries #
This file defines types like QueryLog
and QueryCache
for use with
simulation oracles and implementation transformers defined in the same directory.
Type to represent a cache of queries to oracles in spec
.
Defined to be a function from (indexed) inputs to an optional output.
Equations
- spec.QueryCache = ((i : ι) → spec.domain i → Option (spec.range i))
Instances For
Equations
- OracleSpec.QueryCache.instEmptyCollection = { emptyCollection := fun (x : ι) (x_1 : spec.domain x) => none }
Add a index + input pair to the cache by updating the function
Equations
- cache.cacheQuery i t u = Function.update cache i (Function.update (cache i) t (some u))
Instances For
Simple wrapper in order to introduce the Monoid
structure for countingOracle
.
Marked as reducible and can generally be treated as just a function.
Equations
- _spec.QueryCount = (ι → ℕ)
Instances For
Pointwise addition as the Monoid
operation used for WriterT
.
Equations
Equations
Instances For
Log of queries represented by a list of dependent product's tagging the oracle's index.
(i : ι) → spec.domain i × spec.range i
is slightly more restricted as it doesn't
keep track of query ordering between different oracles.
Instances For
Equations
- OracleSpec.QueryLog.instAppend = { append := List.append }
Query log with a single entry.
Equations
- OracleSpec.QueryLog.singleton (OracleSpec.query i t) u_2 = [⟨i, (t, u_2)⟩]
Instances For
Update a query log by adding a new element to the appropriate list. Note that this requires decidable equality on the indexing set.
Equations
- log.logQuery q u = log ++ OracleSpec.QueryLog.singleton q u
Instances For
Equations
- OracleSpec.QueryLog.instDecidableEqOfDecidableEq = inferInstanceAs (DecidableEq (List ((i : ι) × spec.domain i × spec.range i)))
Get all the queries made to oracle i
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Check if an element was ever queried in a log of queries. Relies on decidable equality of the domain types of oracles.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Get only the portion of the log for queries in spec₁
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Get only the portion of the log for queries in spec₂
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
View a log for spec₁
as one for spec₁ ++ₒ spec₂
by inclusion.
Equations
Instances For
View a log for spec₂
as one for spec₁ ++ₒ spec₂
by inclusion.
Equations
Instances For
Equations
Equations
Type to represent a store of seed values to use in a computation, represented as a function. Updates to individual seed lists are performed via continuation passing.
Instances For
Equations
- OracleSpec.QuerySeed.instDFunLikeListRange = { coe := fun (seed : spec.QuerySeed) => seed, coe_injective' := ⋯ }
Equations
- OracleSpec.QuerySeed.instEmptyCollection = { emptyCollection := fun (x : ι) => [] }
Equations
- seed.update i xs = Function.update seed i xs
Instances For
Add a list of values to the query seed.
Equations
- OracleSpec.QuerySeed.addValues us seed = Function.update seed i (seed i ++ us)
Instances For
Add a single value into the seed, by adding a singleton list
Equations
- seed.addValue i u = OracleSpec.QuerySeed.addValues [u] seed
Instances For
Take only the first n
values of the seed at index i
.
Equations
- seed.takeAtIndex i n = Function.update seed i (List.take n (seed i))