|
|
Line 1: |
Line 1: |
| {{Use dmy dates|date=July 2013}}
| | Adrianne is what you will often call me but Which i don't like when males use my full user name. What I love doing can be to play croquet then now I have your time to take on issues. The job I've been [http://www.ehow.com/search.html?s=occupying occupying] for years is an shop clerk. My [http://www.Encyclopedia.com/searchresults.aspx?q=husband husband] and I decide to reside in Guam but I will own to move in a year or two. You can sometimes find my website here: http://circuspartypanama.com<br><br> |
| {{Redirect-synonym|DFSA|[[Drug facilitated sexual assault]]}}
| |
| [[File:DFA example multiplies of 3.svg|thumb |250px |right|An example of a deterministic finite automaton that accepts only binary numbers that are multiples of 3. The state ''S''<sub>0</sub> is both the start state and an accept state.]] | |
|
| |
|
| In [[automata theory]], a branch of [[theoretical computer science]], a '''deterministic finite automaton''' ('''DFA''')—also known as '''deterministic finite state machine'''—is a [[finite state machine]] that accepts/rejects finite strings of symbols and only produces a unique computation (or run) of the automaton for each input string.<ref name="Hopcroft 2001">[[#HMU|Hopcroft 2001]]:</ref>
| | Stop by my web-site: [http://circuspartypanama.com clash of clans hack cydia] |
| 'Deterministic' refers to the uniqueness of the computation.
| |
| In search of simplest models to capture the finite state machines,
| |
| McCulloch and Pitts were among the first researchers to introduce a concept similar to finite automaton in 1943.<ref>[[#MP43|McCulloch and Pitts (1943)]]:</ref><ref>[[#RS59|Rabin and Scott (1959)]]:</ref>
| |
| | |
| The figure on the right illustrates a deterministic finite automaton using a [[state diagram]]. In the automaton, there are three states: S0, S1, and S2 (denoted graphically by circles). The automaton takes a finite sequence of 0s and 1s as input. For each state, there is a transition arrow leading out to a next state for both 0 and 1. Upon reading a symbol, a DFA jumps ''deterministically'' from a state to another by following the transition arrow.
| |
| For example, if the automaton is currently in state S0 and current input symbol is 1 then it deterministically jumps to state S1.
| |
| A DFA has a ''start state'' (denoted graphically by an arrow coming in from nowhere) where computations begin, and a [[set (mathematics)|set]] of ''accept states'' (denoted graphically by a double circle) which help define when a computation is successful.
| |
| | |
| 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 DFA can model software that decides whether or not online user-input such as email addresses are valid.<ref>{{Citation
| |
| | last = Gouda
| |
| | first = Prabhakar
| |
| | title = Application of Finite automata
| |
| | accessdate = 4 August 2010 }}</ref>
| |
| (see: [[finite state machine]] for more practical examples).
| |
| | |
| DFAs recognize exactly the set of [[regular language]]s<ref name="Hopcroft 2001"/> which are, among other things, useful for doing [[lexical analysis]] and pattern matching. DFAs can be built from [[nondeterministic finite automata]] (NFAs) using the [[powerset construction]] method.
| |
| | |
| ==Formal definition==
| |
| | |
| A '''deterministic finite automaton''' ''M'' is a 5-[[n-tuple|tuple]],
| |
| (''Q'', Σ, δ, ''q''<sub>''0''</sub>, ''F''), consisting of
| |
| * a finite set of [[State (computer science)|states]] (''Q'')
| |
| * a finite set of input symbols called the [[Alphabet (computer science)|alphabet]] (Σ)
| |
| * a transition [[function (mathematics)|function]] (δ : ''Q'' × Σ → ''Q'')
| |
| * a [[Finite state machine#Start state|start state]] (''q''<sub>''0''</sub> ∈ ''Q'')
| |
| * a set of [[Finite state machine#Accept state|accept states]] (''F'' ⊆ ''Q'')
| |
| | |
| Let ''w = a<sub>1</sub>a<sub>2</sub> ... a<sub>n</sub>'' be a string over the alphabet Σ. The automaton ''M'' accepts the string ''w'' if a sequence of states,
| |
| ''r<sub>0</sub>,r<sub>1</sub>, ..., r<sub>n</sub>'', exists in ''Q'' with the following conditions:
| |
| # ''r<sub>0</sub>'' = ''q''<sub>''0''</sub>
| |
| # ''r<sub>i+1</sub>'' = δ(''r<sub>i</sub>'', ''a<sub>i+1</sub>''), for ''i'' = ''0, ..., n−1''
| |
| # ''r<sub>n</sub>'' ∈ ''F''.
| |
| | |
| In words, the first condition says that the machine starts in the start state ''q''<sub>0</sub>. 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 [[Formal language|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.
| |
| | |
| [[File:DFAexample.svg|right|thumb|250px|The [[state diagram]] for ''M'']]
| |
| ''M'' = (''Q'', Σ, δ, ''q<sub>0</sub>'', ''F'') where
| |
| *''Q'' = {''S''<sub>1</sub>, ''S''<sub>2</sub>},
| |
| *Σ = {0, 1},
| |
| *''q<sub>0</sub>'' = ''S''<sub>1</sub>,
| |
| *''F'' = {''S''<sub>1</sub>}, and
| |
| *δ is defined by the following [[state transition table]]:
| |
| :{| border="1" cellpadding="1" cellspacing="0"
| |
| | || <center>'''0'''</center> || <center>'''1'''</center>
| |
| |-
| |
| |'''''S''<sub>1</sub>''' || ''S''<sub>2</sub> || ''S''<sub>1</sub>
| |
| |-
| |
| |'''''S''<sub>2</sub>''' || ''S''<sub>1</sub> || ''S''<sub>2</sub>
| |
| |}
| |
| | |
| The state ''S''<sub>1</sub> represents that there has been an even number of 0s in the input so far, while ''S''<sub>2</sub> 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''<sub>1</sub>, an accepting state, so the input string will be accepted.
| |
| | |
| The language recognized by ''M'' is the [[regular language]] given by the [[regular expression]] 1*( 0 (1*) 0 (1*) )*, where "*" is the [[Kleene star]], e.g., 1* denotes any non-negative number (possibly zero) of symbols "1".
| |
| | |
| ==Closure properties==
| |
| | |
| If DFAs recognize the languages
| |
| that are obtained by applying an operation on the DFA recognizable languages
| |
| then DFAs are said to be [[closed under]] the operation.
| |
| The DFAs are closed under the following operations.
| |
| | |
| *Union
| |
| *Intersection
| |
| *Concatenation
| |
| *Negation
| |
| *[[Kleene closure]]
| |
| *Reversal
| |
| *Init
| |
| *Quotient
| |
| *Substitution
| |
| *Homomorphism
| |
| | |
| Since DFAs are [[Powerset construction|equivalent]] to [[nondeterministic finite automaton|nondeterministic finite automata]] (NFA), these closures may be proved using closure properties of NFA.
| |
| | |
| ==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|date=August 2010}}.
| |
| | |
| ==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 <math>a\in\Sigma</math>, one may write the transition function as <math>\delta_a:Q\rightarrow Q</math>, using the simple trick of [[currying]], that is, writing <math>\delta(q,a)=\delta_a(q)</math> for all <math>q\in Q</math>. 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 <math>\delta_a</math>, <math>\delta_b</math>, and so on. Using this notion we define <math>\widehat\delta:Q \times \Sigma^{\star} \rightarrow Q</math>. Given a pair of letters <math>a,b\in \Sigma</math>, one may define a new function <math>\widehat\delta</math>, by insisting that <math>\widehat\delta_{ab}=\delta_a \circ \delta_b</math>, where <math>\circ</math> denotes function composition. Clearly, this process can be recursively continued. So, we have following recursive definition
| |
| :<math>\widehat\delta ( q, \epsilon ) = q.</math> where <math> \epsilon</math> is empty string and
| |
| :<math>\widehat\delta ( q, wa ) = \delta_a(\widehat\delta ( q, w )).</math> where <math> w \in \Sigma ^*, a \in \Sigma </math> and <math>q \in Q</math>.
| |
| <math>\widehat\delta</math> is defined for all words <math>w\in\Sigma^*</math>. 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 <math>\widehat\delta</math>, one can reconstruct a <math>\delta</math>, and so the two descriptions are equivalent.
| |
| | |
| ==Local automata==
| |
| | |
| A '''local automaton''' is a DFA for which all edges with the same label lead to a single vertex. Local automata accept the class of [[Local language (formal language)|local languages]], those for which membership of a word in the language is determined by a "sliding window" of length two on the word.<ref name=Law129>Lawson (2004) p.129</ref><ref name=Sak228>Sakarovitch (2009) p.228</ref>
| |
| | |
| A '''Myhill graph''' over an alphabet ''A'' is a [[directed graph]] with [[Vertex (graph theory)|vertex set]] ''A'' and subsets of vertices labelled "start" and "finish". The language accepted by a Myhill graph is the set of directed paths from a start vertex to a finish vertex: the graph thus acts as an automaton.<ref name=Law129/> The class of languages accepted by Myhill graphs is the class of local languages.<ref name=Law128>Lawson (2004) p.128</ref>
| |
| | |
| ==Advantages and disadvantages==
| |
| | |
| DFAs were invented to model ''real world'' finite state machines in contrast to
| |
| the concept of a [[Turing machine]], which was too general to study properties of
| |
| real world machines.
| |
| | |
| 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. 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'' ([[Dfa minimization|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.<ref name=Sak105>Sakarovitch (2009) p.105</ref><ref name=Law63>Lawson (2004) p.63</ref>
| |
| | |
| 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 or [[Dyck language]], i.e., the language that consists of properly paired brackets such as word "(()())". Intuitively, 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, and hence would require an infinite number of states to recognize. Another simpler example is the language consisting of strings of the form ''a<sup>n</sup>b<sup>n</sup>'', for some finite but arbitrary number of ''a'''s, followed by an equal number of ''b'''s.<ref name=Law46>Lawson (2004) p.46</ref>
| |
| | |
| ==See also==
| |
| * [[Acyclic deterministic finite automata]]
| |
| * [[Monadic second-order logic]]
| |
| * [[Quantum finite automata]]
| |
| * [[Read-only right moving Turing Machines]]
| |
| * [[Turing machine]]
| |
| * [[Two-way deterministic finite automaton]]
| |
| | |
| ==Notes==
| |
| | |
| <references/>
| |
| | |
| ==References==
| |
| * {{cite book
| |
| |last1= Hopcroft |first1= John E. | authorlink1=John Hopcroft
| |
| |last2=Motwani |first2=Rajeev | authorlink2=Rajeev Motwani
| |
| |last3=Ullman |first3=Jeffrey D. | authorlink3=Jeffrey Ullman
| |
| |title= Introduction to Automata Theory, Languages, and Computation
| |
| |edition=2
| |
| |url=http://www.pearsonhighered.com/educator/product/Introduction-to-Automata-Theory-Languages-and-Computation/9780201441246.page
| |
| |accessdate=19 November 2012
| |
| |publisher= [[Addison Wesley]]
| |
| |year= 2001
| |
| |isbn= 0-201-44124-1
| |
| |ref=HMU}}
| |
| * {{cite book | last=Lawson | first=Mark V. | title=Finite automata | publisher=Chapman and Hall/CRC | year=2004 | isbn=1-58488-255-7 | zbl=1086.68074 }}
| |
| * {{cite journal
| |
| |last1= McCulloch
| |
| |first1= W. S.
| |
| |last2= Pitts
| |
| |first2= E.
| |
| |title= A logical calculus of the ideas imminent in nervous activity
| |
| |journal= Bulletin of Mathematical Biophysics
| |
| |year= 1943
| |
| |pages=541–544
| |
| |ref=MP43}}
| |
| | |
| * {{cite journal
| |
| |last1= Rabin
| |
| |first1= M. O.
| |
| |last2=Scott
| |
| |first2=D.
| |
| |title= Finite automata and their decision problems.
| |
| |journal= IBM J. Res. Develop.
| |
| |year= 1959
| |
| |pages=114–125
| |
| |ref=RS59}}
| |
| * {{cite book | last=Sakarovitch | first=Jacques | title=Elements of automata theory | others=Translated from the French by Reuben Thomas | location=Cambridge | publisher=[[Cambridge University Press]] | year=2009 | isbn=978-0-521-84425-3 | zbl=1188.68177 }}
| |
| * {{cite book | first=Michael | last=Sipser | title=Introduction to the Theory of Computation | publisher=PWS | location=Boston | year=1997 | isbn=0-534-94728-X }}. 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
| |
| | |
| ==External links==
| |
| * [http://home.arcor.de/kai.w1986/dfasimulator/ DFA Simulator - an open source graphical editor and simulator of DFA]
| |
| | |
| {{Formal languages and grammars}}
| |
| | |
| {{DEFAULTSORT:Deterministic Finite-State Machine}}
| |
| [[Category:Models of computation]]
| |
| [[Category:Automata theory]]
| |