Documentation

PolyFun.ITree.Interp.State

State events through interp #

StateE.handler answers get and put in the state transformer StateT σ m, and StateE.stateHandler answers state events that way while lifting the remaining events of StateE σ + E into StateT σ (ITree E) through liftHandler. Interpreting through it agrees with the direct corecursor interpState up to weak bisimulation and the order of the returned pair (interpState_weakBisimRel_interp): interpState returns σ × α and takes one silent step per state operation besides keeping each silent step of the source, while interp into StateT returns α × σ and takes one silent step per node of the source. The exact computation rules of interpState are therefore kept, and this module supplies the bridge.

def ITree.StateE.handler {σ : Type u} {m : Type u → Type v} [Monad m] :

Answer state events in the state transformer.

Equations
Instances For
    @[simp]
    theorem ITree.StateE.handler_put {σ : Type u} {m : Type u → Type v} [Monad m] (s : σ) :

    Answer state events through handler and leave the remaining events in place.

    Equations
    Instances For
      theorem ITree.interpState_weakBisimRel_interp {σ : Type u} {E : PFunctor.{u, u}} {α : Type u} (t : ITree (StateE σ + E) α) (s : σ) :
      WeakBisimRel (fun (p : σ × α) (q : α × σ) => p.1 = q.2 ∧ p.2 = q.1) (t.interpState s) ((interp StateE.stateHandler t).run s)

      Interpreting through the state handler agrees with interpState up to weak bisimulation and the order of the returned pair.

      theorem ITree.interpState_weakBisim_interp {σ : Type u} {E : PFunctor.{u, u}} {α : Type u} (t : ITree (StateE σ + E) α) (s : σ) :

      interpState is interpretation through the state handler with the returned pair swapped, up to weak bisimulation.