0% found this document useful (0 votes)
15 views15 pages

Lecture 2 - A 28022024 031156pm

This document provides an overview of nondeterministic finite automata (NFA). It defines an NFA as consisting of a finite set of states, input symbols, a start state, accepting states, and a transition function. It explains that an NFA can be in multiple states simultaneously and transitions can lead to sets of states. Examples are provided to illustrate how an NFA processes input strings and whether they are accepted or rejected. The document also discusses how to build NFAs to recognize specific languages.

Uploaded by

arbab6654
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views15 pages

Lecture 2 - A 28022024 031156pm

This document provides an overview of nondeterministic finite automata (NFA). It defines an NFA as consisting of a finite set of states, input symbols, a start state, accepting states, and a transition function. It explains that an NFA can be in multiple states simultaneously and transitions can lead to sets of states. Examples are provided to illustrate how an NFA processes input strings and whether they are accepted or rejected. The document also discusses how to build NFAs to recognize specific languages.

Uploaded by

arbab6654
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Theory of Automata

Nondeterministic Finite Automata

Dr. Sabina Akhtar


Revision
• Design DFA for
• L = The set of all the strings whose 3rd last symbol is 0.
NONDETERMINISTIC FINITE
AUTOMATA
Nondeterminism
• A nondeterministic finite automaton has the
ability to be in several states at once.
• Transitions from a state on an input symbol
can be to any set of states.
– Being non-deterministic

1 qj
qi … • Each transition function therefore
1 maps to a set of states
qk

4
Example
Example
w = 010110
Example
w = 010110
Non-deterministic Finite Automata (NFA)
• A Non-deterministic Finite Automaton (NFA) consists
of:
– Q ==> a finite set of states
– ∑ ==> a finite set of input symbols (alphabet)
– q0 ==> a start state
– F ==> set of accepting states
– δ ==> a transition function, which is a mapping between Q
x ∑ ==> subset of Q
• An NFA is also defined by the 5-tuple:
– {Q, ∑ , q0,F, δ }

9
How to use an NFA?
• Input: a word w in ∑*
• Question: Is w acceptable by the NFA?
• Steps:
– Start at the “start state” q0
– For every input symbol in the sequence w do
• Determine all possible next states from all current states, given the
current input symbol in w and the transition function
– If after all symbols in w are consumed and if at least one of the current
states is a final state then accept w;
– Otherwise, reject w.

10
NFA for strings containing 01

Why is this non-deterministic? • Q = {q0,q1,q2}

0,1 0,1 •  = {0,1}


• start state = q0
start 0 1
q0 q1 q2 • F = {q2}
Final • Transition table
state symbols
0 1
What will happen if at state q1 q0 {q0,q1} {q0}
states

an input of 0 is received? q1 Φ {q2}


*q2 {q2} {q2}
11
Example
• Build an NFA for the following language:
L = { w | w ends with 111 as a substring}
• Provide formal specification and transition table as
well.

12
Class Activity
• Build an NFA for the following language:
L = { w | w contains a 1 on its 3rd last
position}
• Provide formal specification and transition
table as well.

13
Language of an NFA
• An NFA accepts w if there exists at least one
path from the start state to an accepting (or
final) state that is labeled by w
• L(N) = { w | δ(q0,w) ∩ F ≠ Φ }

14
References
• Book Chapter 2
• Lectures from Stanford University
– http://infolab.stanford.edu/~ullman/ialc/spr10/sp
r10.html#LECTURE%20NOTES
• Lectures from Washington State University
– http://www.eecs.wsu.edu/~ananth/CptS317/Lect
ures/

You might also like