0% found this document useful (0 votes)
13 views20 pages

NFA Vs DFA

The document discusses the differences and relationships between nondeterministic finite automata (NFAs) and deterministic finite automata (DFAs), highlighting that NFAs can be constructed from DFAs using λ transitions and that both types of automata can accept the same languages. It explains the closure properties of NFAs, the process of converting an NFA to a DFA, and the significance of λ-closures in this conversion. Additionally, it addresses the limitations of finite automata in terms of the languages they can represent.

Uploaded by

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

NFA Vs DFA

The document discusses the differences and relationships between nondeterministic finite automata (NFAs) and deterministic finite automata (DFAs), highlighting that NFAs can be constructed from DFAs using λ transitions and that both types of automata can accept the same languages. It explains the closure properties of NFAs, the process of converting an NFA to a DFA, and the significance of λ-closures in this conversion. Additionally, it addresses the limitations of finite automata in terms of the languages they can represent.

Uploaded by

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

NFAs vs.

DFAs
 NFAs can be constructed from DFAs
using transitions:

Called NFA-
 Suppose M1 accepts L1, M2 accepts L2

Then an NFA can be constructed that accepts:
 L1 U L 2 (union)
 L1 L2 (concatenation)
 L1 * (Kleene star)

NFA vs. DFA 1


Closure Properties of NFA-
s

 M1
 M 
M2

L(M)*
L(M1) U L(M2)

  
M1 M2

L(M1) L(M2)

NFA vs. DFA 2


NFA to DFA Conversion

NFA vs. DFA 3


DFA vs NFA
 Deterministic vs nondeterministic
 For every nondeterministic automata,
there is an equivalent deterministic
automata

 Finite acceptors are equivalent iff


they both accept the same language

L(M1) = L(M2)

NFA vs. DFA 4


DFA vs NFA
 Deterministic vs nondeterministic
 In DFA, label resultant state as a set
of states

{q1, q2, q3,…}
 For a set of |Q| states, there are
exactly 2Q subsets

Finite number of states

NFA vs. DFA 5


Removing
Nondeterminism

 By simulating all moves of an NFA-


λ in parallel using a DFA.

 λ-closure of a state is the set of


states reachable using only the λ-
transitions.

NFA vs. DFA 6


NFA-λ
λ p2

a p1

λ
p3
q1 λ
λ p5

q2 a
p4

t ( q1, a ) { p1, p 2, p3, p 4, p5}


NFA vs. DFA 7
λ – Closure
 Selected λ closures
q1: {q1,q2}
p1: {p1,p2,p3}
q2: {q2}

NFA vs. DFA 8


Equivalence Construction
 Given an NFA-λ M1, construct a DFA M2
such that L(M) = L(DM).
 Observe that

A node of the DFA = Set of nodes of NFA-λ


Transition of the DFA =
Transition among set of nodes of
NFA- λ

NFA vs. DFA 9


Special States to Identify

Start state of DFA =


 - closure ({q0 })
Final/Accepting state of DFA =
All subsets of states of NFA-λ
that contain an accepting state
of the NFA-λ

Dead state of DFA = 


NFA vs. DFA 10
Example
a q1 b
a

q0
λ
a
q2

NFA vs. DFA 11


Example
 Identify λ-closures
 q0: {q0}
 q1: {q1}
 q2: {q1,q2}

NFA vs. DFA 12


Example
 Identify transitions

Start with λ-closure of start state
 {q0}: Where can you go on each input?
 a: {q0,q1,q2}
 So, {q0,q1,q2} is a state in the DFA

b, c: Nowhere, so {Φ} is in the DFA

Next slide…
 Next, do the same for {q0,q1,q2} and {Φ}

Find destinations from any node in the set for each of the
three alphabet symbols

Subsequent slide…

NFA vs. DFA 13


All steps from {q0}

{q0}
a {q0,q1,q2}
{q0}
b
c Φ

NFA vs. DFA 14


All steps from {q0,q1,q2}
a

a b
{q0,q1,q2} {q1}
{q0}
b c
{q1,q2}
c Φ

a,b,c
NFA vs. DFA 15
All steps from {q1} and
b
{q1,q2}

{q1} a,c
Φ
c
b {q1}

{q1,q2} a
Φ
NFA vs. DFA 16
Equivalent DFA
a
a c
{q0} {q0,q1,q2} c
b {q1,q2}
b,c b
b
a,c
Φ {q1} a

a,b,c

NFA vs. DFA 17


NFA vs. DFA
Theorem: Given any NFA N, then there exists a
DFA D such that N is equivalent to D

• Proven by constructing a general NFA and


showing that the closure exists among the possible
DFA states P(Q)
• Every possible transition goes to an element of P(Q)

NFA vs. DFA 18


Limitations of Finite
Automata
 Obvious: Can only accept
languages that can be represented
in finite memory!
 Can this language be represented
with a FA?
 L(M)=(aibi | i  n)
 How about this one?
 L(M)=(aibi | i > 0)

NFA vs. DFA 19


Exercise: Convert this NFA
λ p2

a p1

λ
p3
q1 λ
λ p5

q2 a
p4

NFA vs. DFA 20

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy