Url

Deterministic finite automaton

What is this site? It is generaly simplier version of wikipedia. You will find there selected articles. Enjoy!

This article may be too technical for most readers to understand. Please improve this article to make it accessible to non-experts, without removing the technical details. (February 2010)
An example of a Deterministic Finite Automaton that accepts only binary numbers that are multiples of 3. The state S0 is both the start state and an accept state.

In the theory of computation, a deterministic finite state machine—also known as deterministic finite automaton (DFA)—is a finite state machine accepting strings of symbols (usually letters or numbers). The list of symbols used by a DFA is called its alphabet. For each state, there is a transition arrow leading out to a next state for each symbol in the alphabet. This contrasts with a nondeterministic finite automaton (NFA), in which a state may have more than one transition for the same input symbol. Every 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.

Finite Automata are equivalent to regular expressions as a way of representing regular languages. This means that it is possible to convert from a DFA to a regular expression and vice versa without losing any information. A given DFA (or regular expression) describes exactly one regular language. A DFA can be used in either in 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.

DFAs are often treated as abstract mathematical concepts, but DFA-like state machines have been implemented in hardware and / or software in order to solve various specific problems. Example of a software state machine is in deciding whether or not online user-input such as phone numbers and email addresses are valid. A hardware example 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).

Contents

Formal definition

A DFA is a 5-tuple, (Q, Σ, δ, q0, F), consisting of

Let M be a DFA such that M = (Q, Σ, δ, q0, F), and X = x0x1 ... xn−1 be a string over the alphabet Σ. M accepts the string X if a sequence of states, r0,r1, ..., rn, exists in Q with the following conditions:

  1. r0 = q0
  2. ri+1 = δ(ri, xi), for i = 0, ..., n−1
  3. rnF.

In words, the first condition says that the machine starts in the start state q0. The second condition says that given each character of string X, the machine will transition from state to state according to the transition function δ. The last condition says that the machine accepts X if the last input of X 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 the DFA accepts form a language, which is the language the DFA recognizes.

A DFA without a list of accept states and without a designated starting state is known as a transition system or semiautomaton.

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 0's) 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.

Example

The following example is of a DFA M, with a binary alphabet, which requires that the input contains an even number of 0s.

The state diagram for M

M = (Q, Σ, δ, q0, F) where

0
1
S1 S2 S1
S2 S1 S2

The state S1 represents that there has been an even number of 0s in the input so far, while S2 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 S1, an accepting state, so the input string will be accepted.

The language of M is the regular language given by the regular expression

 1^* \bigl( 0 (1^*) 0 (1^*) \bigr)^*, \,

where "*" is the Kleene star, e.g., 1* denotes any number (possibly zero) of symbols "1".

Transition monoid

Alternatively a run can be seen as a sequence of compositions of transition function with itself. Given an input symbol a\in\Sigma, one may write the transition function as \delta_a:Q\rightarrow Q, using the simple trick of currying, that is, writing δ(q,a) = δa(q) for all q\in Q. 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 \widehat\delta:Q \times \Sigma^{\star} \rightarrow Q. Given a pair of letters a,b\in \Sigma, one may define a new function \widehat\delta, by insisting that \widehat\delta_{ab}=\delta_a \circ \delta_b, where \circ denotes function composition. Clearly, this process can be recursively continued. So, we have following recursive definition

\widehat\delta ( q, \epsilon ) = q. where ε is empty string and
\widehat\delta ( q, wa ) = \delta_a(\widehat\delta ( q, w )). where  w \in \Sigma ^*, a \in \Sigma and q \in Q.

\widehat\delta is defined for all words w\in\Sigma^*. 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 \widehat\delta, 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, constant-space, online algorithm to simulate a DFA on a stream of input. Given two DFAs there are efficient algorithms to find a DFA recognizing:

Because DFAs can be reduced to a canonical form (minimal DFAs), there are also efficient algorithms to determine:

DFAs are equivalent in computing power to nondeterministic finite automata.

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, that is, language that consists of properly paired brackets, such as (()()). More formally the language consisting of strings of the form anbn—some finite number of a's, followed by an equal number of b's. If there is no limit to recursion (i.e., you can always embed another pair of brackets inside) it would require an infinite amount of states to recognize.

See also

References

External links

  1. ^ Fegaras, Leonidas. "Converting a Regular Expression into a Deterministic Finite Automaton". http://lambda.uta.edu/cse5317/notes/node9.html. Retrieved 4 August 2010. 
  2. ^ Gouda, Prabhakar, Application of Finite automata 
v  d  e
Automata theory: formal languages and formal grammars
Each 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.
Retrieved from "http://en.wikipedia.org/wiki/Deterministic_finite-state_machine"

All text are available under the terms of the GNU Free Documentation License. Hope this site help you/
Dogs - komputery - nagłośnienie imprez estradowych - www.faktury-online.info - Biuro rachunkowe bydgoszcz - Busy Kraków - refluks żołądkowy - ćwiczenia dla ciężarnych - medi aqua - Przeprowadzki i transport Warszawa, Piaseczno - narzędzia, kompresor , klucze - wózki widłowe Lublin wózki widłowe Lublin - Noclegi - fajne gry logiczne - ring wire