Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Nondeterministic Finite Automata (NFAs) and Their Applications, Slides of Theory of Automata

An introduction to nondeterministic finite automata (nfas), a type of automaton that relaxes the requirement of having exactly one transition from every state on every symbol. Nfas are more flexible than deterministic finite automata (dfas) and have various practical applications. Topics such as spontaneous transitions, nondeterminism, the 5-tuple for an nfa, and the language accepted by an nfa.

Typology: Slides

2012/2013

Uploaded on 04/29/2013

shamir_69
shamir_69 🇮🇳

5

(4)

66 documents

1 / 30

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter Five:
Nondeterministic Finite Automata
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e

Partial preview of the text

Download Nondeterministic Finite Automata (NFAs) and Their Applications and more Slides Theory of Automata in PDF only on Docsity!

Chapter Five:

Nondeterministic Finite Automata

A DFA has exactly one transition from every state on every

symbol in the alphabet. By relaxing this requirement we get

a related but more flexible kind of automaton: the

nondeterministic finite automaton or NFA.

NFAs are a bit harder to think about than DFAs, because

they do not appear to define simple computational processes.

They may seem at first to be unnatural, like puzzles invented

by professors for the torment of students. But have patience!

NFAs and other kinds of nondeterministic automata arise

naturally in many ways, as you will see later in this book,

and they too have a variety of practical applications.

Not A DFA

  • Does not have exactly one transition from

every state on every symbol:

  • Two transitions from q 0 on a
  • No transition from q 0 (on either a or b )
  • Though not a DFA, this can be taken as

defining a language, in a slightly different way

q 1

a,b

q 0 a

Possible Sequences of Moves

  • We'll consider all possible sequences of moves the machine might make for a given string
  • For example, on the string aa there are three:
    • From q 0 to q 0 to q 0 , rejecting
    • From q 0 to q 0 to q 1 , accepting
    • From q 0 to q 1 , getting stuck on the last a
  • Our convention for this new kind of machine: a string is in L ( M ) if there is at least one accepting sequence

q 1

a,b

q 0 a

NFA Advantage

  • An NFA for a language can be smaller and easier to construct than a DFA
  • Strings whose next-to-last symbol is 1:

DFA:

NFA:

0

0

0

1

1

1 1

0

0,

0,

1

Outline

  • 5.1 Relaxing a Requirement
  • 5.2 Spontaneous Transitions
  • 5.3 Nondeterminism
  • 5.4 The 5-Tuple for an NFA
  • 5.5 The Language Accepted by an NFA

ε-Transitions To Accepting States

  • An ε-transition can be made at any time
  • For example, there are three sequences on the empty string
    • No moves, ending in q 0 , rejecting
    • From q 0 to q 1 , accepting
    • From q 0 to q 2 , accepting
  • Any state with an ε-transition to an accepting state ends up working like an accepting state too

q 0

q 1^ a

q 2 b

ε-transitions For NFA Combining

  • ε-transitions are useful for combining smaller

automata into larger ones

  • This machine is combines a machine for { a }*

and a machine for { b }*

  • It uses an ε-transition at the start to achieve

the union of the two languages

q 0

q 1^ a

q 2 b

Correct Union

A = { an^ | n is odd}

B = { bn^ | n is odd}

A ∪ B

a a b b a a b b

Incorrect Concatenation

A = { an^ | n is odd}

B = { bn^ | n is odd}

{ xy | xA and yB }? No: this NFA accepts abbaab

a a b b a a

b

b

Outline

  • 5.1 Relaxing a Requirement
  • 5.2 Spontaneous Transitions
  • 5.3 Nondeterminism
  • 5.4 The 5-Tuple for an NFA
  • 5.5 The Language Accepted by an NFA

DFAs and NFAs

  • DFAs and NFAs both define languages
  • DFAs do it by giving a simple computational procedure for deciding language membership: - Start in the start state - Make one transition on each symbol in the string - See if the final state is accepting
  • NFAs do it without such a clear-cut procedure:
    • Search all legal sequences of transitions on the input string?
    • How? In what order?

Outline

  • 5.1 Relaxing a Requirement
  • 5.2 Spontaneous Transitions
  • 5.3 Nondeterminism
  • 5.4 The 5-Tuple for an NFA
  • 5.5 The Language Accepted by an NFA

Powerset

  • If S is a set, the powerset of S is the set of all subsets of S:

P ( S ) = { R | RS }

  • This always includes the empty set and S itself
  • For example,

P({1,2,3}) = {{}, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}}