Você está na página 1de 5

Deterministic nite automaton

DFSA redirects here. DFSA may also refer to Drug fa- analysis and pattern matching. DFAs can be built
cilitated sexual assault. from nondeterministic nite automata (NFAs) using the
In automata theory, a branch of theoretical computer powerset construction method.

Start

1 0
1 Formal denition
1
0
S0 S1 S2 A deterministic nite automaton M is a 5-tuple, (Q, ,
, q0, F), consisting of
1 0
a nite set of states (Q)
An example of a deterministic nite automaton that accepts only
binary numbers that are multiples of 3. The state S0 is both the
start state and an accept state. a nite set of input symbols called the alphabet ()

science, a deterministic nite automaton (DFA)also a transition function ( : Q Q)


known as deterministic nite state machineis a nite
state machine that accepts/rejects nite strings of symbols a start state (q0 Q)
and only produces a unique computation (or run) of the
automaton for each input string.[1] 'Deterministic' refers a set of accept states (F Q)
to the uniqueness of the computation. In search of sim-
plest models to capture the nite state machines, McCul-
loch and Pitts were among the rst researchers to intro- Let w = a1 a2 ... an be a string over the alphabet . The
duce a concept similar to nite automaton in 1943.[2][3] automaton M accepts the string w if a sequence of states,
r0 ,r1 , ..., rn, exists in Q with the following conditions:
The gure on the right illustrates a deterministic nite au-
tomaton using a state diagram. In the automaton, there
are three states: S0, S1, and S2 (denoted graphically by 1. r0 = q0
circles). The automaton takes a nite sequence of 0s and
1s as input. For each state, there is a transition arrow 2. ri+1 = (ri, ai+1), for i = 0, ..., n1
leading out to a next state for both 0 and 1. Upon read-
ing a symbol, a DFA jumps deterministically from a state 3. rn F.
to another by following the transition arrow. For exam-
ple, if the automaton is currently in state S0 and current
input symbol is 1 then it deterministically jumps to state In words, the rst condition says that the machine starts
S1. A DFA has a start state (denoted graphically by an in the start state q0 . The second condition says that given
arrow coming in from nowhere) where computations be- each character of string w, the machine will transition
gin, and a set of accept states (denoted graphically by a from state to state according to the transition function .
double circle) which help dene when a computation is The last condition says that the machine accepts w if the
successful. last input of w causes the machine to halt in one of the
A DFA is dened as an abstract mathematical concept, accepting states. Otherwise, it is said that the automaton
but due to the deterministic nature of a DFA, it is im- rejects the string. The set of strings that M accepts is the
plementable in hardware and software for solving various language recognized by M and this language is denoted by
specic problems. For example, a DFA can model soft- L(M).
ware that decides whether or not online user-input such A deterministic nite automaton without accept states
as email addresses are valid.[4] (see: nite state machine and without a starting state is known as a transition system
for more practical examples). or semiautomaton.
DFAs recognize exactly the set of regular languages[1] For more comprehensive introduction of the formal def-
which are, among other things, useful for doing lexical inition see automata theory.

1
2 5 LOCAL AUTOMATA

Concatenation

Negation

Kleene closure

Reversal

Init

Quotient

Substitution
The state diagram for M
Homomorphism

2 Example Since DFAs are equivalent to nondeterministic nite au-


tomata (NFA), these closures may be proved using clo-
The following example is of a DFA M, with a binary al- sure properties of NFA.
phabet, which requires that the input contains an even
number of 0s.
M = (Q, , , q0 , F) where 4 DFA as a transition monoid

Q = {S 1 , S 2 }, Alternatively a run can be seen as a sequence of compo-


sitions of transition function with itself. Given an input
= {0, 1}, symbol a , one may write the transition function as
a : Q Q , using the simple trick of currying, that
q0 = S 1 , is, writing (q, a) = a (q) for all q Q . This way,
the transition function can be seen in simpler terms: its
F = {S 1 }, and
just something that acts on a state in Q, yielding another
is dened by the following state transition table: state. One may then consider the result of function com-
position repeatedly applied to the various functions a , b
, and so on. Using this notion we dene b : Q Q
. Given a pair of letters a, b , one may dene a new
function b , by insisting that bab = a b , where de-
The state S 1 represents that there has been an even num-
notes function composition. Clearly, this process can be
ber of 0s in the input so far, while S 2 signies an odd
recursively continued. So, we have the following recur-
number. A 1 in the input does not change the state of
sive denition
the automaton. When the input ends, the state will show
whether the input contained an even number of 0s or not.
b ) = q. where is empty string and
(q,
If the input did contain an even number of 0s, M will n-
ish in state S 1 , an accepting state, so the input string will b wa) = a ((q,
(q, b w)). where w , a
be accepted. and q Q .
The language recognized by M is the regular language
given by the regular expression 1*( 0 (1*) 0 (1*) )*, where b is dened for all words w . Repeated function
"*" is the Kleene star, e.g., 1* denotes any non-negative composition forms a monoid. For the transition func-
number (possibly zero) of symbols 1. tions, this monoid is known as the transition monoid, or
sometimes the transformation semigroup. The construc-
tion can also be reversed: given a b , one can reconstruct
3 Closure properties a , and so the two descriptions are equivalent.

If DFAs recognize the languages that are obtained by ap-


plying an operation on the DFA recognizable languages 5 Local automata
then DFAs are said to be closed under the operation. The
DFAs are closed under the following operations. A local automaton is a DFA for which all edges with the
same label lead to a single vertex. Local automata accept
Union the class of local languages, those for which membership
of a word in the language is determined by a sliding win-
Intersection dow of length two on the word.[5][6]
3

A Myhill graph over an alphabet A is a directed graph brackets inside, and hence would require an innite num-
with vertex set A and subsets of vertices labelled start ber of states to recognize. Another simpler example is the
and nish. The language accepted by a Myhill graph language consisting of strings of the form an bn for some
is the set of directed paths from a start vertex to a nish nite but arbitrary number of a's, followed by an equal
vertex: the graph thus acts as an automaton.[5] The class number of b's.[10]
of languages accepted by Myhill graphs is the class of
local languages.[7]
7 See also
6 Advantages and disadvantages Acyclic deterministic nite automata
Monadic second-order logic
DFAs were invented to model real world nite state ma-
chines in contrast to the concept of a Turing machine, Quantum nite automata
which was too general to study properties of real world
machines. Read-only right moving Turing Machines
DFAs are one of the most practical models of computa- Turing machine
tion, since there is a trivial linear time, constant-space,
online algorithm to simulate a DFA on a stream of input. Two-way deterministic nite automaton
Also, there are ecient algorithms to nd a DFA recog-
nizing:
8 Notes
the complement of the language recognized by a
given DFA. [1] Hopcroft 2001:

the union/intersection of the languages recognized [2] McCulloch and Pitts (1943):
by two given DFAs. [3] Rabin and Scott (1959):

[4] Gouda, Prabhakar, Application of Finite automata


Because DFAs can be reduced to a canonical form
(minimal DFAs), there are also ecient algorithms to de- [5] Lawson (2004) p.129
termine:
[6] Sakarovitch (2009) p.228
whether a DFA accepts any strings [7] Lawson (2004) p.128

whether a DFA accepts all strings [8] Sakarovitch (2009) p.105

whether two DFAs recognize the same language [9] Lawson (2004) p.63

the DFA with a minimum number of states for a [10] Lawson (2004) p.46
particular regular language

DFAs are equivalent in computing power to 9 References


nondeterministic nite automata (NFAs). This is
because, rstly any DFA is also an NFA, so an NFA Hopcroft, John E.; Motwani, Rajeev; Ullman, Jef-
can do what a DFA can do. Also, given an NFA, using frey D. (2001). Introduction to Automata Theory,
the powerset construction one can build a DFA that Languages, and Computation (2 ed.). Addison Wes-
recognizes the same language as the NFA, although the ley. ISBN 0-201-44124-1. Retrieved 19 November
DFA could have exponentially larger number of states 2012.
than the NFA.[8][9]
Lawson, Mark V. (2004). Finite automata. Chap-
On the other hand, nite state automata are of strictly lim- man and Hall/CRC. ISBN 1-58488-255-7. Zbl
ited power in the languages they can recognize; many sim- 1086.68074.
ple languages, including any problem that requires more
than constant space to solve, cannot be recognized by a McCulloch, W. S.; Pitts, E. (1943). A logical cal-
DFA. The classical example of a simply described lan- culus of the ideas imminent in nervous activity.
guage that no DFA can recognize is bracket or Dyck lan- Bulletin of Mathematical Biophysics: 541544.
guage, i.e., the language that consists of properly paired
brackets such as word "(()())". Intuitively, no DFA can Rabin, M. O.; Scott, D. (1959). Finite automata
recognize the bracket language because there is no limit and their decision problems.. IBM J. Res. Develop.:
to recursion, i.e., one can always embed another pair of 114125.
4 10 EXTERNAL LINKS

Sakarovitch, Jacques (2009). Elements of automata


theory. Translated from the French by Reuben
Thomas. Cambridge: Cambridge University Press.
ISBN 978-0-521-84425-3. Zbl 1188.68177.
Sipser, Michael (1997). Introduction to the Theory
of Computation. Boston: PWS. ISBN 0-534-94728-
X.. Section 1.1: Finite Automata, pp. 3147. Sub-
section Decidable Problems Concerning Regular
Languages of section 4.1: Decidable Languages,
pp. 152155.4.4 DFA can accept only regular lan-
guage

10 External links
DFA Simulator - an open source graphical editor
and simulator of DFA
5

11 Text and image sources, contributors, and licenses


11.1 Text
Deterministic nite automaton Source: http://en.wikipedia.org/wiki/Deterministic%20finite%20automaton?oldid=645026418 Contrib-
utors: Booyabazooka, Eric119, Charles Matthews, Dcoetzee, Radiojon, Jaredwf, Hadal, Cyrius, Tobias Bergemann, Decrypt3, Jason
Quinn, Beland, Paulbmann, Grunt, ZeroOne, S.K., Zxombie, Spoon!, Xvr, Jonsafari, Interiot, Thowa, JameySharp, Linas, LOL, Thoma-
sOwens, Marozols, Margosbot, Nivix, Rbonvall, Tardis, YurikBot, Crazytales, FauxFaux, Mararo, Reyk, SmackBot, Canderra, Wittylama,
Afa86, Sviemeister, JDCMAN, Thumperward, Neurodivergent, Frap, Vina-iwbot, SashatoBot, Loadmaster, Sahuagin, Mlwilson, Cyde-
bot, Epbr123, Hermel, A3nm, David Eppstein, Pacdude9, DorganBot, Binris, Jennavecia, Mike Cline, TXiKiBoT, Insanity Incarnate,
Alexsmail, Flyer22, Andrasek, 1ForTheMoney, SoxBot III, Curseofgnome, Addbot, RPHv, , Luckas-bot, Yobot, Vevek, Tbtietc,
AnomieBOT, Ounsworth, BenzolBot, MastiBot, Wyverald, RjwilmsiBot, SaintNULL, Ashutosh y0078, ZroBot, Zephyrus Tavvier, 28bot,
ClueBot NG, Satellizer, Jiri 1984, Helpful Pixie Bot, 2001:db8, Raghunandan ma, ChrisGualtieri, Prabhakant Shukla, Deltahedron, S.eijadi,
Chip Wildon Forster and Anonymous: 72

11.2 Images
File:DFA_example_multiplies_of_3.svg Source: http://upload.wikimedia.org/wikipedia/commons/9/94/DFA_example_multiplies_
of_3.svg License: Public domain Contributors: Own work Original artist: Self-made
File:DFAexample.svg Source: http://upload.wikimedia.org/wikipedia/commons/9/9d/DFAexample.svg License: Public domain Contrib-
utors: Own work Original artist: Cepheus

11.3 Content license


Creative Commons Attribution-Share Alike 3.0

Você também pode gostar