(** * Theorems about [interp] *)
(** Main facts: - [unfold_interp]: Unfold lemma. - [interp_bind]: [interp] is a monad morphism. - [interp_trigger]: Events are interpreted using a handler. *)
(* begin hide *)
Program
Setoid
Morphisms
RelationClasses.
Basics.Category
Basics.CategoryKleisli
Basics.CategoryKleisliFacts
Basics.Basics
Core.ITreeDefinition
Core.KTree
Core.KTreeFacts
Eq.Eq
Eq.UpToTaus
Indexed.Sum
Indexed.Function
Indexed.Relation
Interp.Interp
Interp.Handler
Interp.TranslateFacts.
(* end hide *)
Instance Equivalence_eq_Handler {E F : Type -> Type}
: Equivalence (@eq_Handler E F).
Instance Equivalence_eutt_Handler {E F : Type -> Type}
: Equivalence (@eutt_Handler E F).
Definition Equivalence_eq2_Handler {E F : Type -> Type}
: @Equivalence (Handler E F) eq2.
(** Unfolding of [interp]. *)
Definition _interp {E F R} (f : E ~> itree F) (ot : itreeF E R _)
: itree F R :=
match ot with
| RetF r => Ret r
| TauF t => Tau (interp f t)
| VisF e k => f _ e >>= (fun x => Tau (interp f (k x)))
end.
(** ** [interp] and constructors *)
(** These are specializations of [unfold_interp], which can be added as rewrite hints. *)

Lemma interp_ret {E F R} {f : E ~> itree F} (x: R):
interp f (Ret x) ≅ Ret x.