Sie sind auf Seite 1von 4

Deterministic Finite Acceptors

DFAs are:

Deterministic--there is no element of choice


Finite--only a finite number of states and arcs
Acceptors--produce only a yes/no answer

A DFA is drawn as a graph, with each state represented by a circle.

One designated state is the start state.

Some states (possibly including the start state) can be designated as final states.

Arcs between states represent state transitions -- each such arc is labeled with the symbol that
triggers the transition.

Formal Definition of a DFA


A deterministic finite acceptor or dfa is a quintuple:
M = (Q, , , q0, F)
where

Q is a finite set of states,


is a finite set of symbols, the input alphabet,
:Q
Q is a transition function,
q0 Q is the initial state,
F Q is a set of final states.

Note: The fact that


of .

is a function implies that every vertex has an outgoing arc for each member

We can also define an extended transition function


:Q

as
Q.

If a DFA M = (Q, , , q0, F) is used as a membership criterion, then the set of strings
accepted by M is a language. That is,
L(M) = {w
:
(q0, w) F}.
Languages that can be defined by dfas are called regular languages.

Nondeterministic Finite Acceptors


A finite-state automaton can be nondeterministic in either
or both of two ways:
A state may have
two or more arcs
emanating from it
labeled with the
same symbol. When
arc may be

the symbol occurs in the input, either


followed.
A state may have one or more arcs emanating from it labeled with (the empty string) . These
arcs may optionally be followed without looking at the input or consuming an input symbol.

Due to nondeterminism, the same string may cause an nfa to end up in one of several different
states, some of which may be final while others are not. The string is accepted if any possible
ending state is a final state.

Example NFAs

Formal Definition of NFAs


The extension of our notation to NFAs is somewhat strained.
A nondeterministic finite acceptor or nfa is defined by the quintuple
M = (Q,

, q0, F)

where

Q is a finite set of states,


is a finite set of symbols, the input alphabet,
:Q (
{ })
2 is a transition function,
q0 Q is the initial state,
F Q is a set of final states.

These are all the same as for a dfa except for the definition of

Transitions on are allowed in addition to transitions on elements of , and


The range of is 2 rather than Q. This means that the values of are not elements of
Q, but rather are sets of elements of Q.

The language defined by nfa M is defined as


L(M) = {w
:

(q0, w)

DFA = NFA
Two acceptors are equivalent if the accept the same language.
A DFA is just a special case of an NFA that happens not to have any null transitions or multiple
transitions on the same symbol. So DFAs are not more powerful than NFAs.

For any NFA, we can construct an equivalent DFA (see below). So NFAs are not more powerful
than DFAs. DFAs and NFAs define the same class of languages -- the regular languages.
To translate an NFA into a DFA, the trick is to label each state in the DFA with a set of states
from the NFA. Each state in the DFA summarizes all the states that the NFA might be in. If the
NFA contains |Q| states, the resultant DFA could contain as many as |2 | states. (Usually far
fewer states will be needed.)

Das könnte Ihnen auch gefallen