Implementing Oracle Queries in Other Monads #
This file defines a type QueryImpl spec m to represent implementations
of queries to spec in terms of the monad m.
It also provides the bridge between explicit QueryImpls and the lightweight
HasQuery capability from VCVio.OracleComp.HasQuery.Basic.
A monadic handler for the polynomial interface induced by spec.
Concretely, this maps every oracle input x to a computation returning an
answer of type spec.Range x. It extends first to OracleQuery spec by
applying the continuation, then to OracleComp spec by preserving pure and
bind; see QueryImpl.mapQuery and simulateQ.
Instances For
QueryImpl is definitionally PolyFun's generic monadic handler for the
polynomial interface induced by an oracle specification.
Two query implementations are the same if they are the same on all query inputs.
Restrict an implementation of a sum specification to its left component.
Instances For
Restrict an implementation of a sum specification to its right component.
Instances For
Applying a left restriction is the original implementation on a left input.
Applying a right restriction is the original implementation on a right input.
View a concrete query implementation as query capability in the same monad. This is useful
when instantiating a generic HasQuery construction directly inside an analysis monad such as
StateT σ ProbComp or WriterT ω (OracleComp spec).
Instances For
Embed an oracle query into a new functor by applying the implementation to the input value before applying the continuation of the element.
Instances For
Reduce mapQuery on an explicit constructor-form query. Companion to mapQuery_query
for queries that arise from SubSpec-lift normalization (which produces
OracleQuery.mk/anonymous-constructor forms rather than OracleSpec.query).
Compatibility alias for the generic polynomial-handler target lift.
Instances For
Lifting an implementation to the original monad has no effect.
Identity implementation for queries, sending q : OracleQuery spec α to itself.
Instances For
Version of QueryImpl.id that automatically lifts into OracleComp spec rather than
just implementing queries in the lower level OracleQuery spec monad
Instances For
Given that queries in spec lift to the monad m we get an implementation via lifting.
Instances For
View a function from oracle inputs to outputs as an implementation in the Id monad.
Can be used to run a computation to get a specific value.
Instances For
Version of ofFn that allows queries to fail to return a value.
Instances For
Implement a single oracle as evaluation of a Polynomial.
Instances For
Implement a single oracle as the evaluation of an `MvPolynomial.
Instances For
Implement a single oracle as indexing into a Vector.
Instances For
Oracle context for ability to query elements of a vector v.
Instances For
Repackage HasQuery as a QueryImpl, for APIs that still consume explicit oracle
implementations.
Instances For
On OracleComp spec, HasQuery.toQueryImpl is the identity handler QueryImpl.id'.
Not @[simp]: in definitions where toQueryImpl.liftTarget appears inside a simplifying
unfold, the rewrite toQueryImpl → id' = liftTarget _ (id _)
nests liftTargets and triggers unbounded depth. Use via explicit rw instead.