Simulation Semantics for Oracles in a Computation #
def
simulateQ
{ι : Type u_1}
{spec : OracleSpec ι}
{r : Type u → Type u_2}
[Monad r]
(impl : QueryImpl spec r)
{α : Type u}
(mx : OracleComp spec α)
:
r α
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.
Equations
Instances For
@[simp]
theorem
simulateQ_bind
{α β : Type u}
{ι : Type u_4}
{spec : OracleSpec ι}
{r : Type u → Type u_1}
[Monad r]
(impl : QueryImpl spec r)
[LawfulMonad r]
(mx : OracleComp spec α)
(my : α → OracleComp spec β)
:
@[reducible]
def
simulateQ'
{ι : Type u_4}
{spec : OracleSpec ι}
{r : Type u → Type u_1}
[Monad r]
[LawfulMonad r]
(impl : QueryImpl spec r)
:
Version of simulateQ that bundles into a monad hom.
Equations
Instances For
@[simp]
theorem
simulateQ_query
{α : Type u}
{ι : Type u_4}
{spec : OracleSpec ι}
{r : Type u → Type u_1}
[Monad r]
(impl : QueryImpl spec r)
[LawfulMonad r]
(q : OracleQuery spec α)
:
@[simp]
theorem
simulateQ_query_bind
{α β : Type u}
{ι : Type u_4}
{spec : OracleSpec ι}
{r : Type u → Type u_1}
[Monad r]
(impl : QueryImpl spec r)
[LawfulMonad r]
(q : OracleQuery spec α)
(ou : α → OracleComp spec β)
:
@[simp]
theorem
simulateQ_map
{α β : Type u}
{ι : Type u_4}
{spec : OracleSpec ι}
{r : Type u → Type u_1}
[Monad r]
(impl : QueryImpl spec r)
[LawfulMonad r]
(mx : OracleComp spec α)
(f : α → β)
:
@[simp]
theorem
simulateQ_seq
{α β : Type u}
{ι : Type u_4}
{spec : OracleSpec ι}
{r : Type u → Type u_1}
[Monad r]
(impl : QueryImpl spec r)
[LawfulMonad r]
(og : OracleComp spec (α → β))
(mx : OracleComp spec α)
:
@[simp]
theorem
simulateQ_seqLeft
{α β : Type u}
{ι : Type u_4}
{spec : OracleSpec ι}
{r : Type u → Type u_1}
[Monad r]
(impl : QueryImpl spec r)
[LawfulMonad r]
(mx : OracleComp spec α)
(my : OracleComp spec β)
:
@[simp]
theorem
simulateQ_seqRight
{α β : Type u}
{ι : Type u_4}
{spec : OracleSpec ι}
{r : Type u → Type u_1}
[Monad r]
(impl : QueryImpl spec r)
[LawfulMonad r]
(mx : OracleComp spec α)
(my : OracleComp spec β)
:
theorem
simulateQ_def
{α : Type u}
{ι : Type u_1}
{spec : OracleSpec ι}
{n : Type u → Type v}
[Monad n]
[LawfulMonad n]
(impl : QueryImpl spec n)
(mx : OracleComp spec α)
:
simulateQ impl mx = (fun {α : Type u} (x : spec.toPFunctor.FreeM α) => (PFunctor.FreeM.mapMHom impl).toFun α x) mx
@[simp]
QueryImpl.id' is an identity for simulateQ with implementaiton in OracleComp spec.
theorem
simulateQ_ofLift_eq_self
{ι : Type u_1}
{spec : OracleSpec ι}
{α : Type u}
(mx : OracleComp spec α)
:
Lifting queries to their original implementation has no effect on a computation.