Section EquivalenceUpToTaus.
Context {E : Type -> Type} {R : Type}.
(** The standard [itree] equivalence: "Equivalence Up To Taus", or _weak bisimulation_. *)
Definition eutt : itree E R -> itree E R -> Prop :=
ITree.Eq.Eq.eutt eq.
Infix "≈" := eutt (at level 40).
(** [eutt] is an equivalence relation. *)
Global Instance Equivalence_eutt : Equivalence eutt.
Hint Rewrite @interp_ret : itree.
Hint Rewrite @interp_vis : itree.
Hint Rewrite @interp_trigger : itree.
Hint Rewrite @interp_bind : itree.
(** **** Simple recursion: [rec] *)
(** [rec body] is equivalent to [interp (recursive body)], where [recursive] is defined as follows. *)
Definition recursive {E A B} (f : A -> itree (callE A B +' E) B)
: (callE A B +' E) ~> itree E
:= case_ (calling' (rec f)) ITree.trigger.
(** [mrec ctx] is equivalent to [interp (mrecursive ctx)], where [mrecursive] is defined as follows. *)
Definition mrecursive {D E} (f : D ~> itree (D +' E))
: (D +' E) ~> itree E :=
case_ (mrec f) ITree.trigger.

Lemma mrec_as_interp
: forall {D E T} (ctx : D ~> itree (D +' E)) (d : D T),
mrec ctx d
≈ interp (mrecursive ctx) (ctx _ d).