Finite-state machines can be subdivided into acceptors, classifiers, transducers and sequencers.
Acceptors Acceptors (also called
detectors or
recognizers) produce binary output, indicating whether or not the received input is accepted. Each state of an acceptor is either
accepting or
non accepting. Once all input has been received, if the current state is an accepting state, the input is accepted; otherwise it is rejected. As a rule, input is a
sequence of symbols (characters); actions are not used. The start state can also be an accepting state, in which case the acceptor accepts the empty string. The example in figure 4 shows an acceptor that accepts the string "nice". In this acceptor, the only accepting state is state 7. A (possibly infinite) set of symbol sequences, called a
formal language, is a
regular language if there is some acceptor that accepts
exactly that set. For example, the set of binary strings with an even number of zeroes is a regular language (cf. Fig. 5), while the set of all strings whose length is a prime number is not. An acceptor could also be described as defining a language that would contain every string accepted by the acceptor but none of the rejected ones; that language is
accepted by the acceptor. By definition, the languages accepted by acceptors are the
regular languages. The problem of determining the language accepted by a given acceptor is an instance of the
algebraic path problem—itself a generalization of the
shortest path problem to graphs with edges weighted by the elements of an (arbitrary)
semiring. An example of an accepting state appears in Fig. 5: a
deterministic finite automaton (DFA) that detects whether the
binary input string contains an even number of 0s.
S1 (which is also the start state) indicates the state at which an even number of 0s has been input. S1 is therefore an accepting state. This acceptor will finish in an accept state, if the binary string contains an even number of 0s (including any binary string containing no 0s). Examples of strings accepted by this acceptor are
ε (the
empty string), 1, 11, 11..., 00, 010, 1010, 10110, etc.
Classifiers Classifiers are a generalization of acceptors that produce
n-ary output where
n is strictly greater than two.
Transducers Transducers produce output based on a given input and/or a state using actions. They are used for control applications and in the field of
computational linguistics. In control applications, two types are distinguished: ;
Moore machine: The FSM uses only entry actions, i.e., output depends only on state. The advantage of the Moore model is a simplification of the behaviour. Consider an elevator door. The state machine recognizes two commands: "command_open" and "command_close", which trigger state changes. The entry action (E:) in state "Opening" starts a motor opening the door, the entry action in state "Closing" starts a motor in the other direction closing the door. States "Opened" and "Closed" stop the motor when fully opened or closed. They signal to the outside world (e.g., to other state machines) the situation: "door is open" or "door is closed". ;
Mealy machine: The FSM also uses input actions, i.e., output depends on input and state. The use of a Mealy FSM leads often to a reduction of the number of states. The example in figure 7 shows a Mealy FSM implementing the same behaviour as in the Moore example (the behaviour depends on the implemented FSM execution model and will work, e.g., for
virtual FSM but not for
event-driven FSM). There are two input actions (I:): "start motor to close the door if command_close arrives" and "start motor in the other direction to open the door if command_open arrives". The "opening" and "closing" intermediate states are not shown.
Sequencers Sequencers (also called
generators) are a subclass of acceptors and transducers that have a single-letter input alphabet. They produce only one sequence, which can be seen as an output sequence of acceptor or transducer outputs.
Determinism A further distinction is between
deterministic (
DFA) and
non-deterministic (
NFA,
GNFA) automata. In a deterministic automaton, every state has exactly one transition for each possible input. In a non-deterministic automaton, an input can lead to one, more than one, or no transition for a given state. The
powerset construction algorithm can transform any nondeterministic automaton into a (usually more complex) deterministic automaton with identical functionality. A finite-state machine with only one state is called a "combinatorial FSM". It only allows actions upon transition
into a state. This concept is useful in cases where a number of finite-state machines are required to work together, and when it is convenient to consider a purely combinatorial part as a form of FSM to suit the design tools. == Alternative semantics ==