How can one simulate nondeterministic finite transducers?

戏子无情 提交于 2019-12-01 04:56:40

问题


A nondeterministic automaton can be simulated easily on an input string by just keeping track of the states the automaton is in, and how far in the input string it has gotten. But how can a nondeterministic transducer (a transducer, of course, can translate input symbols to output symbols, and give as output a string, not just a boolean value) be simulated? It seems that this is more complicated, since we need to keep track, somehow, of the output strings, which can be numerous because of the nondeterminism.


回答1:


First of all, some theory. The following are distinct algebraic structures:

  • generators (transition systems)

  • acceptors (automata)

  • transducers (machines)

The parenthesized terms are quite commonly found in the literature, alas they are wrongly used more often than not. These algebraic structures resemble each other notoriously much, and can be turned from one to another or hybrids via numerous small changes. But this should not distract from the fact that they ar fundamentally different:

  • generators are a constructive representation of a language, i.e., a set of (finite or infinite) words. You non-deterministically traverse a generator and in doing so you produce all the words in that language.

  • acceptors again are constructs for defining a set of words (language), but each represents an indicator function over all possible words (finite or infinite). So they map each word to a Boolean value (which could be appropriately extended to a finite or infinite output word, in an attempt to compare with transducers - there is though a distinguishing algebraic difference).

  • a transducer represents a function mapping each admissible finite input word to a finite output word.

In the context of finite languages, the distinction between acceptors and transducers becomes less pronounced, because an acceptor can accept or not any finite word, irrespective of its length, thus it produces an output word for each such word. By catenation of the Boolean outputs from an acceptor, one can create a finite output word for each finite input word (i.e., by catenating the outputs from each prefix of the given input word). This attempt to bridge the two notions, though mechanistically correct, nonetheless distorts the notions involved.

In the context of infinite-word languages, the distinction is clearer. An infinite-word automaton cannot produce output for finite prefixes of a given (infinite) input word. This restriction is the consequence of infinite-word acceptance being defined over the entire (infinite) word. As a result, acceptors map each input word to a Boolean value, or output word if such a viewpoint is preferred. In contrast, transducers (machines) map each finite prefix of any input word, to a finite output word of equal length. For this reason, they are called sequential machines, because they react step-by-step.

There are two different types of transducers:

  • Mealy machines
  • Moore machines

A Moore machine can be represented by a Mealy machine. Not every Mealy machine is representable by a Moore machine. The literature is typically wrong in defining and comparing these two types of transducers, please refer to the original publications for the correct definitions.

So both definitions are deterministic. There is a reason for this restriction to determinism: a transducer is used to control a system, so we want to know deterministically what the next control action to apply should be. This has led to deterministic transducers becoming the standard in the literature.

However, non-deterministic transducers can also be useful, e.g., as compact representations of multiple strategies. However, when they are executed, it makes sense to only follow a single path and produce a single output word, not multiple simultaneously (as is the case for copies of non-deterministic acceptors spawned during their execution).

Therefore it becomes clear that the non-deterministic simulation of a transducer does not correspond to its intended use. It represents a set of alternative strategies (that can also be mixed, if one does not determinize in a fixed way during each single play).

So indeed you would have to create an (ever expanding) tree of the possible output words that quickly blows up. This tree is essentially the unfolding of the generator (transition system) that you would get by stripping the transducer of its input annotation.




回答2:


Basically you do the same as for NFAs but this time instead of returning true or false you add the output to an output set. Here's a bit of pseudocode:

function rec(in, current_state, pos, out)
 if(current_state.isFinal && pos == in.length) out_set += out

 for(t <- lambda transition going out from current_state)
  rec(in, t.destination, pos, out + t.output_symbol)

 for(t <- transition going out from current_state for symbol in(pos)
  rec(in, t.destination, pos+1, out + t.output_symbol)


来源:https://stackoverflow.com/questions/11213728/how-can-one-simulate-nondeterministic-finite-transducers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!