 Deterministic finitestate machine

In the theory of computation and automata theory, a deterministic finite state machine—also known as deterministic finite automaton (DFA)—is a finite state machine accepting finite strings of symbols. For each state, there is a transition arrow leading out to a next state for each symbol. Upon reading a symbol, a DFA jumps deterministically from a state to another by following the transition arrow. Deterministic means that there is only one outcome (i.e. move to next state when the symbol matches (S0 > S1) or move back to the same state (S0 > S0)). A DFA has a start state (denoted graphically by an arrow coming in from nowhere) where computations begin, and a set of accept states (denoted graphically by a double circle) which help define when a computation is successful.
DFAs recognize exactly the set of regular languages which are, among other things, useful for doing lexical analysis and pattern matching. ^{[1]} A DFA can be used in either an accepting mode to verify that an input string is indeed part of the language it represents, or a generating mode to create a list of all the strings in the language.
A DFA is defined as an abstract mathematical concept, but due to the deterministic nature of a DFA, it is implementable in hardware and software for solving various specific problems. For example, a software state machine that decides whether or not online userinput such as phone numbers and email addresses are valid can be modeled as a DFA. ^{[2]} Another example in hardware is the digital logic circuitry that controls whether an automatic door is open or closed, using input from motion sensors or pressure pads to decide whether or not to perform a state transition (see: finite state machine).
DFAs can be built from nondeterministic finitestate machines through the powerset construction.
Contents
Formal definition
A deterministic finite automaton M is a 5tuple, (Q, Σ, δ, q_{0}, F), consisting of
 a finite set of states (Q)
 a finite set of input symbols called the alphabet (Σ)
 a transition function (δ : Q × Σ → Q)
 a start state (q_{0} ∈ Q)
 a set of accept states (F ⊆ Q)
Let w = a_{1}a_{2} ... a_{n} be a string over the alphabet Σ. The automaton M accepts the string w if a sequence of states, r_{0},r_{1}, ..., r_{n}, exists in Q with the following conditions:
 r_{0} = q_{0}
 r_{i+1} = δ(r_{i}, a_{i+1}), for i = 0, ..., n−1
 r_{n} ∈ F.
In words, the first condition says that the machine starts in the start state q_{0}. The second condition says that given each character of string w, the machine will transition from state to state according to the transition function δ. The last condition says that the machine accepts w if the last input of w causes the machine to halt in one of the accepting states. Otherwise, it is said that the automaton rejects the string. The set of strings M accepts is the language recognized by M and this language is denoted by L(M).
A deterministic finite automaton without accept states and without a starting state is known as a transition system or semiautomaton.
For more comprehensive introduction of the formal definition see automata theory.
Example
The following example is of a DFA M, with a binary alphabet, which requires that the input contains an even number of 0s.
M = (Q, Σ, δ, q_{0}, F) where
 Q = {S_{1}, S_{2}},
 Σ = {0, 1},
 q_{0} = S_{1},
 F = {S_{1}}, and
 δ is defined by the following state transition table:

0 1 S_{1} S_{2} S_{1} S_{2} S_{1} S_{2}
The state S_{1} represents that there has been an even number of 0s in the input so far, while S_{2} signifies an odd number. A 1 in the input does not change the state of the automaton. When the input ends, the state will show whether the input contained an even number of 0s or not. If the input did contain an even number of 0s, M will finish in state S_{1}, an accepting state, so the input string will be accepted.
The language recognized by M is the regular language given by the regular expression
where "*" is the Kleene star, e.g., 1* denotes any nonnegative number (possibly zero) of symbols "1".
Accept and Generate modes
A DFA representing a regular language can be used either in an accepting mode to validate that an input string is part of the language, or in a generating mode to generate a list of all the strings in the language.
In the accept mode an input string is provided which the automaton can read in left to right, one symbol at a time. The computation begins at the start state and proceeds by reading the first symbol from the input string and following the state transition corresponding to that symbol. The system continues reading symbols and following transitions until there are no more symbols in the input, which marks the end of the computation. If after all input symbols have been processed the system is in an accept state then we know that the input string was indeed part of the language, and it is said to be accepted, otherwise it is not part of the language and it is not accepted.
The generating mode is similar except that rather than validating an input string its goal is to produce a list of all the strings in the language. Instead of following a single transition out of each state, it follows all of them. In practice this can be accomplished by massive parallelism (having the program branch into two or more processes each time it is faced with a decision) or through recursion. As before, the computation begins at the start state and then proceeds to follow each available transition, keeping track of which branches it took. Every time the automaton finds itself in an accept state it knows that the sequence of branches it took forms a valid string in the language and it adds that string to the list that it is generating. If the language this automaton describes is infinite (ie contains an infinite number or strings, such as "all the binary string with an even number of 0s) then the computation will never halt. Given that regular languages are, in general, infinite, automata in the generating mode tends to be more of a theoretical construct^{[citation needed]}.
DFA as a transition monoid
Alternatively a run can be seen as a sequence of compositions of transition function with itself. Given an input symbol , one may write the transition function as , using the simple trick of currying, that is, writing δ(q,a) = δ_{a}(q) for all . This way, the transition function can be seen in simpler terms: it's just something that "acts" on a state in Q, yielding another state. One may then consider the result of function composition repeatedly applied to the various functions δ_{a}, δ_{b}, and so on. Using this notion we define . Given a pair of letters , one may define a new function , by insisting that , where denotes function composition. Clearly, this process can be recursively continued. So, we have following recursive definition
 where ε is empty string and
 where and .
is defined for all words . Repeated function composition forms a monoid. For the transition functions, this monoid is known as the transition monoid, or sometimes the transformation semigroup. The construction can also be reversed: given a , one can reconstruct a δ, and so the two descriptions are equivalent.
Advantages and disadvantages
DFAs are one of the most practical models of computation, since there is a trivial linear time, constantspace, online algorithm to simulate a DFA on a stream of input. Also, there are efficient algorithms to find a DFA recognizing:
 the complement of the language recognized by a given DFA.
 the union/intersection of the languages recognized by two given DFAs.
Because DFAs can be reduced to a canonical form (minimal DFAs), there are also efficient algorithms to determine:
 whether a DFA accepts any strings
 whether a DFA accepts all strings
 whether two DFAs recognize the same language
 the DFA with a minimum number of states for a particular regular language
DFAs are equivalent in computing power to nondeterministic finite automata (NFAs). This is because, firstly any DFA is also an NFA, so an NFA can do what a DFA can do. Also, given an NFA, using the powerset construction one can build a DFA that recognizes the same language as the NFA, although the DFA could have exponentially larger number of states than the NFA.
On the other hand, finite state automata are of strictly limited power in the languages they can recognize; many simple languages, including any problem that requires more than constant space to solve, cannot be recognized by a DFA. The classical example of a simply described language that no DFA can recognize is bracket language, i.e., language that consists of properly paired brackets such as word "(()())". No DFA can recognize the bracket language because there is no limit to recursion, i.e., one can always embed another pair of brackets inside. It would require an infinite amount of states to recognize. Another simpler example is the language consisting of strings of the form a^{n}b^{n}—some finite number of a's, followed by an equal number of b's.
See also
 Acyclic deterministic finite automata
 Monadic secondorder logic
 Nondeterministic finitestate machine (NFA)
 Readonly right moving Turing Machines
 Turing machine
 Twoway deterministic finite automaton
References
 Michael Sipser, Introduction to the Theory of Computation. PWS, Boston. 1997. ISBN 053494728X. Section 1.1: Finite Automata, pp. 31–47. Subsection "Decidable Problems Concerning Regular Languages" of section 4.1: Decidable Languages, pp. 152–155.4.4 DFA can accept only regular language
 ^ Fegaras, Leonidas. "Converting a Regular Expression into a Deterministic Finite Automaton". http://lambda.uta.edu/cse5317/notes/node9.html. Retrieved 4 August 2010.
 ^ Gouda, Prabhakar, Application of Finite automata
External links
Automata theory: formal languages and formal grammars Chomsky hierarchy Type0—Type1———Type2——Type3—Grammars (no common name)Linear contextfree rewriting systems etc.Treeadjoining etc.—Languages Minimal automaton Thread automataEach category of languages is a proper subset of the category directly above it.  Any automaton and any grammar in each category has an equivalent automaton or grammar in the category directly above it.Categories: Models of computation
 Automata theory
Wikimedia Foundation. 2010.
См. также в других словарях:
Finitestate machine — State machine redirects here. For infinite state machines, see State transition system. For fault tolerance methodology, see State machine replication. SFSM redirects here. For the Italian railway company, see Circumvesuviana. A finite state… … Wikipedia
Finite state machine — A finite state machine (FSM) or finite state automaton (plural: automata ) or simply a state machine, is a model of behavior composed of a finite number of states, transitions between those states, and actions. A finite state machine is an… … Wikipedia
Nondeterministic finitestate machine — In the theory of computation, a nondeterministic finite state machine or nondeterministic finite automaton (NFA) is a finite state machine where for each pair of state and input symbol there may be several possible next states. This distinguishes … Wikipedia
Nondeterministic finite state machine — In the theory of computation, a nondeterministic finite state machine or nondeterministic finite automaton (NFA) is a finite state machine where for each pair of state and input symbol there may be several possible next states. This distinguishes … Wikipedia
Finite state transducer — A finite state transducer (FST) is a finite state machine with two tapes: an input tape and an output tape. This contrasts with an ordinary finite state automaton (or finite state acceptor), which has a single tape. OverviewAn automaton can be… … Wikipedia
Twoway deterministic finite automaton — In computer science, a two way deterministic finite automaton (2DFA) is an abstract machine, a generalized version of the deterministic finite automaton (DFA) which can revisit characters already processed. As in a DFA, there are a finite number… … Wikipedia
Deterministic automaton — is a concept of automata theory in which the outcome of a transition from one state to another given a certain input can be predicted for every occurrence. A common deterministic automaton is a deterministic finite state machine (sometimes… … Wikipedia
State diagram — State diagrams is a diagram used in the field of computer science, representing the behavior of a system, which is composed of a finite number of states. There are many forms of state diagrams, which differ slightly and have different semantics.… … Wikipedia
State transition table — In automata theory and sequential logic, a state transition table is a table showing what state (or states in the case of a nondeterministic finite automaton) a finite semiautomaton or finite state machine will move to, based on the current state … Wikipedia
Deterministic system — In mathematics, a deterministic system is a system in which no randomness is involved in the development of future states of the system.[1] A deterministic model will thus always produce the same output from a given starting condition or initial… … Wikipedia