Section DinatSimulation.
Context {A B C : Type -> Type}.
Context (f0 : A ~> itree (B +' C)) (g0 : B ~> itree (A +' C)).
Context {R : Type}.
Context (f := fun T e => Tau (f0 T e)) (g := fun T e => Tau (g0 T e)).
Local Inductive interleaved
: itree (A +' C) R -> itree (B +' C) R -> Prop :=
| interleaved_Ret r : interleaved (Ret r) (Ret r)
| interleaved_Left {U} (t : itree _ U) k1 k2 :
(forall (x : U), interleaved (k1 x) (k2 x)) ->
interleaved (interp (case_ g inr_) t >>= k1) (t >>= k2)
| interleaved_Right {U} (t : itree _ U) k1 k2 :
(forall (x : U), interleaved (k1 x) (k2 x)) ->
interleaved (t >>= k1) (interp (case_ f inr_) t >>= k2)
.
Hint Constructors interleaved.
Let hg := @case_ _ Handler _ _ _ _ _ g inr_.
Let hf := @case_ _ Handler _ _ _ _ _ f inr_.

Theorem interleaved_mrec : forall t1 t2,
interleaved t1 t2 ->
Recursion.interp_mrec (cat f (case_ g inr_)) t1
≈ Recursion.interp_mrec (cat g (case_ f inr_)) t2.