Simulation Semantics for Oracles in a Computation #
Given an implementation of spec in the monad r, convert an OracleComp spec α to a
implementation in r α by substituting impl t for query t throughout.
Instances For
Version of simulateQ that bundles into a monad hom.
Instances For
Specialized form of simulateQ_query for the canonical spec.query t
constructor: simulateQ impl (liftM (spec.query t)) = impl t.
The general simulateQ_query rewrite leaves an id <$> artifact when applied
to spec.query t (because (spec.query t).cont = id). That artifact is
harmless when spec.Range t is concrete (it disappears under definitional
reduction), but in parametric sum-spec contexts ((E₁ + E₂).Range (Sum.inl t)
vs E₁.Range t, both abstract atoms) the type annotations diverge and
id_map no longer fires under simp only. This lemma sidesteps the artifact
entirely and is the canonical entry point for simplifying simulateQ over an
explicit spec.query t.
QueryImpl.id' is an identity for simulateQ with implementaiton in OracleComp spec.
Lifting queries to their original implementation has no effect on a computation.
simulateQ distributes through OptionT.bind, stated via OptionT.run.
simulateQ distributes through OptionT.bind, stated via Option.elimM.
simulateQ distributes through OptionT.bind: the simulated OptionT-bind is the
OptionT-bind of the simulated pieces.
simulateQ commutes with OptionT.lift.