Nondeterministic Finite Automata (NFAs) - PowerPoint PPT Presentation

About This Presentation
Title:

Nondeterministic Finite Automata (NFAs)

Description:

For every state q in Q and every character in , one ... (or 'Justin Timberlake') Another Example. s. q. b. a. b. a. r. a. b. q. b. a. a. r. s. q. a. r. a. b. q ... – PowerPoint PPT presentation

Number of Views:156
Avg rating:3.0/5.0
Slides: 16
Provided by: tico
Category:

less

Transcript and Presenter's Notes

Title: Nondeterministic Finite Automata (NFAs)


1
Nondeterministic Finite Automata (NFAs)
2
Reminder Deterministic Finite Automata (DFA)
For every state q in Q and every character ? in
?, one and only one transition of the following
form occurs
?
q
q
3
Expressiveness of DFA
  • DFA are a type of programs
  • Contains concepts of imperative languages
    sequences, branching and loops.
  • Can implement a newspaper vendor machine or even
    control a character in a video game
  • Can implement pattern matching find all text
    containing Britney Spears

(or Justin Timberlake)
  • Can only implement programs that require a
    constant amount of memory

4
Another Example
a
b
A
b
b
a
a
r
r
s
q
q
gt
a
a
What is the language recognized by A?
b
a
a
B
a
b
r
r
s
q
q
gt
b
What is the language recognized by B?
b
5
Nondeterministic Finite Automata
a
b
a
a
r
r
q
q
b
a
s
gt
b
a
b
r
b
r
q
q
a
a
b
  1. Why is this automaton nondeterministic?
  2. What is the language accepted by this automaton?


6
Nondeterministic Finite Automata (NFA)
For every state q in S and every character ? in
?, one of the following will happen
7
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
  • s ? Q called the start state
  • F ? Q called the favorable states
  • ? ? Q (? ? e) Q

The crucial point is that ? is a relation
  • Book says (Q,?, ?,s,F) where
  • is a transition function, Q (? ? e) ?(Q)

Are ? and ? representing the same transitions?
8
Nondeterministic Finite Automata (NFA)
What else can occur in NFAs?
If next word to process in q is aaabbb and apply
this transition, what is the word to be processed
in q?
aaabbb
e-transitions do not process any characters,
they just allow to jump between states
9
Formal Definition of Computation for NFAs
  • Given a nodeterministic finite automaton N
    (Q,?,?,s,F), and let
  • w w1w2 wn, where each wi is in ?
  • M accepts w if we can write w as
  • w y1y2 ym , where each yi is in
    (? ? e)
  • and there is a sequence of states
  • r0 r1, r2 rm in Q such that
  • r0 is the start state of M
  • ri1 ? ?(ri , wi1) for i 0, , m-1
  • rm ? F
  • Language recognized by N w in ? N accepts w

10
Same Example
a
b
a
a
r
r
q
q
b
a
s
gt
b
a
b
r
b
r
q
q
a
a
b
Language accepted by this automaton is the set of
all strings containing either the substring aa
or the substring bb

11
Example
a
r
r
s
q
q
gt
b
b
b
  1. Why is this automation nondeterministic?
  2. What is the language accepted by this automaton?

12
Why We Study Nondeterministic Computation?
  • Makes it easier to prove properties about
    Automata
  • In particular, makes it easier to prove certain
    properties
  • If A is a regular language then AR is also
    regular
  • It also makes it possible to understand the
    boundaries of computation
  • P NP?

13
Oracle in NFAs
  • The oracle explanation of NFAs given a choice
    between possible transitions, there is a device,
    called the oracle, that always chooses the
    transition that leads to a favorable state

...

...
Oracle chooses this transition because it leads
to a favorable state
current state
...
  • Is the oracle explanation compatible with our
    definition of acceptability in NFAs?
  • Sometimes it is useful to use the oracle when
    creating NFAs

14
NFA vs DFA
  • Every DFA can be seen as an NFA
  • But not every NFA can be seen as a DFA
  • Are DFAs more expressive? What does this means?
  • For example, is there an DFA that accepts the
    same language accepted by the following NFA?

It means that there an NFA can be constructed
that accepts a language L for which no DFA can be
constructed that accepts L
15
NFA vs DFA (2)
  • How about this one?

a
b
a
a
r
r
q
q
b
a
s
gt
b
a
b
r
b
r
q
q
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
Write a Comment
User Comments (0)
About PowerShow.com