Professional Documents
Culture Documents
Nondeterministic Finite Automata (Nfas)
Nondeterministic Finite Automata (Nfas)
(NFAs)
Reminder: Deterministic Finite Automata (DFA)
b b b
> s p q r
a a a
a b
a t b
Expressiveness of DFA
A
b a
> s q r
a
What is the language recognized by A?
b
a
a
B a
b r
> s q
b
What is the language recognized by B?
b
Nondeterministic Finite Automata
a
b a
q r
b
a
> s b
a
b b r’
r
a q’
q a
b
1. Why is this automaton nondeterministic?
2. What is the language accepted by this automaton?
Nondeterministic Finite Automata (NFA)
•One or more transitions: q q’ occurs
p
…
Nondeterministic Finite Automaton (NFA)
A nondeterministic finite automaton (NFA) is a 5-tuple
(Q,,,s,F) where:
•Q is a finite set of elements called states
is a finite input alphabet “the empty word”
Q × ( {e}) × Q
•s Q called the start state
•F Q called the favorable states
e
q q’
b
Language accepted by this automaton is the set of all strings
containing either the substring “aa” or the substring “bb”
Example
>s q r
b b
r
>s b q b
b
NFA vs DFA (2)
• How about this one?
a
b a r
b q
a
> s b
a
b q’
q b r’
r a
a
b
• It turns out that for every NFA, a DFA can be constructed such
they both accept the same language.
• We will study a formal proof of this on Wednesday