Built with Alectryon, running Coq+SerAPI v8.17.0+0.17.1. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑ Ctrl+↓ to navigate, Ctrl+🖱️ to focus. On Mac, use instead of Ctrl.

Interaction Trees: Definition

We implement a subset of the Interaction Tree library in an indexed setting. These indices provide dynamic control over the set of available external events during the computation. In particular, the interface is composed of some event I I, i.e.:

Indexed Interaction Trees

Section itree.
  Context {I : Type}.
  Context (E : event I I).
  Context (R : psh I).

  Variant itreeF (REC : psh I) (i : I) : Type :=
    | RetF (r : R i) : itreeF REC i
    | TauF (t : REC i) : itreeF REC i
    | VisF (q : E.(e_qry) i) (k : forall (r : E.(e_rsp) q), REC (E.(e_nxt) r)) : itreeF REC i
  .
  Derive NoConfusion for itreeF.

  CoInductive itree (i : I) : Type := go { _observe : itreeF itree i }.

End itree.
Notation itree' E R := (itreeF E R (itree E R)).

The following function defines the coalgebra structure.

Definition observe {I E R i} (t : @itree I E R i) : itree' E R i := t.(_observe).

Notation Ret' x := (go (RetF x)).
Notation Tau' t := (go (TauF t)).
Notation Vis' e k := (go (VisF e k)).