0 Up votes0 Down votes

3 views13 pagesMELJUN CORTES Automata Lecture Equivalence of Nfas and Dfas Part 1 1

Jun 12, 2015

© © All Rights Reserved

PDF, TXT or read online from Scribd

MELJUN CORTES Automata Lecture Equivalence of Nfas and Dfas Part 1 1

© All Rights Reserved

3 views

MELJUN CORTES Automata Lecture Equivalence of Nfas and Dfas Part 1 1

© All Rights Reserved

- The Woman Who Smashed Codes: A True Story of Love, Spies, and the Unlikely Heroine who Outwitted America's Enemies
- Steve Jobs
- NIV, Holy Bible, eBook
- NIV, Holy Bible, eBook, Red Letter Edition
- Hidden Figures Young Readers' Edition
- Cryptonomicon
- Make Your Mind Up: My Guide to Finding Your Own Style, Life, and Motavation!
- The Golden Notebook: A Novel
- Alibaba: The House That Jack Ma Built
- The 10X Rule: The Only Difference Between Success and Failure
- Autonomous: A Novel
- Hit Refresh: The Quest to Rediscover Microsoft's Soul and Imagine a Better Future for Everyone
- Hit Refresh: The Quest to Rediscover Microsoft's Soul and Imagine a Better Future for Everyone
- Life After Google: The Fall of Big Data and the Rise of the Blockchain Economy
- Algorithms to Live By: The Computer Science of Human Decisions
- Console Wars: Sega, Nintendo, and the Battle that Defined a Generation
- The Innovators: How a Group of Hackers, Geniuses, and Geeks Created the Digital Revolution

You are on page 1of 13

Specific Objectives:

At the end of the topic session, the students are expected to:

Cognitive:

1. Explain the rationale behind the equivalence between NFAs and

DFAs.

2. Apply the procedure for converting NFAs with no -transitions to

their equivalent DFAs.

Affective:

1. Listen to others with respect.

2. Participate in class discussions actively.

MATERIALS/EQUIPMENT:

o

o

topic slides

OHP

TOPIC PREPARATION:

o

o

o

o

previous courses.

Prepare the slides to be presented in class.

It is imperative for the instructor to incorporate various kinds of

teaching strategies while discussing the suggested topics.

Prepare additional examples on the topic to be presented.

*Property of STI

Page 1 of 13

Page 1 of 21

NFA and DFA Equivalence

Introduction

Consider the following DFA M1 from the previous discussions.

0

q0

q1

q2

q3

0, 1

After analyzing this DFA, it can be said that DFA M1 accepts strings over the

alphabet = {0, 1} that start with a 0 and end with a 1.

NFA and DFA Equivalence

Page 2 of 21

Consider now the following NFA N1 also from the previous discussions.

0, 1

q0

q1

q2

After analyzing this NFA, it can be said that NFA N1 also accepts strings over the

alphabet = {0, 1} that start with a 0 and end with 1.

Since both can accept the same set of strings over the same alphabet, DFA M1

and NFA N1 recognize the same language. In other words, they have the same

language. That is,

L(M1) = L(N1) = {w w starts with 0 and ends with 1}

The language of M1 is equal to the language of N1, which is the set of all strings w

such that w starts with a 0 and ends with a 1.

*Property of STI

Page 2 of 13

Page 3 of 21

If an NFA and a DFA recognize the same language, they are said to be equivalent.

Therefore, DFA M1 is equivalent to NFA N1.

In general, any two machines (whether they are both DFAs, both NFAs, or one is a

DFA while the other is an NFA) are equivalent if they recognize the same

language.

If a language is recognized by a DFA, then there is an NFA that will also recognize

it. This is quite obvious since all DFAs are also NFAs.

But the question now is, if a language is recognized by an NFA, is there a DFA that

will also recognize it?

In other words, is there an equivalent DFA for any NFA?

The answer is not quite obvious since not all NFAs are DFAs.

To answer this question, a procedure must be constructed to convert any NFA to

its equivalent DFA. If no procedure can be constructed, then the answer is no.

Page 4 of 21

The procedure that will be discussed here is applicable only to converting NFAs

with no -transitions into their equivalent DFA.

Consider NFA N1 which has three states q0, q1, and q2. Recall that an NFA can be

in one or more states at any given time. So at any time, the NFA may be in:

1.

2.

3.

4.

5.

6.

7.

8.

state q0 only there is currently only one copy of the NFA and it is at

state q0.

state q1 only there is currently only one copy of the NFA and it is at

state q1.

state q2 only there is currently only one copy of the NFA and it is at

state q2.

states q0 and q1 there are currently two copies of the NFA. One

copy is at state q0 while the other is at state q1.

states q0 and q2 there are currently two copies of the NFA. One

copy is at state q0 while the other is at state q2.

states q1 and q2 there are currently two copies of the NFA. One

copy is at state q1 while the other is at state q2.

states q0, q1, and q2 there are currently three copies of the NFA.

One copy is at state q0, the second copy is at state q1, and the third

copy is at state q2.

dead state (stopped processing) All copies of the NFA have

stopped and ceased to exist.

*Property of STI

Page 3 of 13

Page 5 of 21

Observe that the possible states the NFA can assume are q0 only, q1 only, q2 only,

q0 and q1, q0 and q2, q1 and q2, q1 and q2 and q3, and the dead state.

It can therefore be said that possible states the NFA can be is the power set of its

set of states Q. Recall that the power set is simply the set of all subsets. If Q is

the set of states of the given NFA N1, then:

Q = {q0, q1, q2}

The power set of Q is then

P(Q) = {, {q0}, {q1}, {q2}, {q0,q1}, {q0, q2}, {q1, q2}, {q0, q1, q2}}

where the null set corresponds to the dead state.

Notice that each subset in the power set of Q corresponds to one of the states the

NFA N1 can assume at any given time.

Since a DFA can only be in one state at any one time while an NFA can be in

several states at a time, this mismatch can be resolved by constructing the

equivalent DFA such that it will have a single state that will represent the situation

where the NFA is in several states. In other words, the constructed DFA will have

a single state for each element of the power set.

For example, the state in which the NFA is in states q0 and q1 will be represented

by a single state (that may be called q01) in its equivalent DFA. If the NFA is in

states q0, q1, and q2 at the same time, then the equivalent DFA will have only one

state (that may be called q012) to represent that situation.

n

If the NFA has n states, then the equivalent DFA will have 2 states since there will

n

be 2 possible subsets given a set with n elements. This implies that the

equivalent DFA will have a finite number of states since the number of states in any

NFA is also finite.

In the example given, since the NFA N1 has 3 states, its equivalent DFA will have

3

at most 2 = 8 states.

NFA and DFA Equivalence

Page 6 of 21

The next step now is to determine the start state and the final states of the

equivalent DFA.

The initial state of the NFA N1 is q0 so the initial state of the equivalent DFA will

also be q0.

*Property of STI

Page 4 of 13

Page 7 of 21

The final state of NFA N1 is q2. This means that the NFA is in the final state if at

least one copy of the NFA is at state q2. So the NFA is in the final state if it is in

any of the following states:

1.

2.

3.

4.

q2

q 0, q 2

q 1, q 2

q 0, q 1, q 2

In other words, the NFA will be in the final state if q2 is included in the subset.

Therefore, the final states for the equivalent DFA are q2, q02, q12, and q012.

Take note that not all of the states of the equivalent DFA are reachable from the

start state q0. These states are considered useless. It is thus possible that some

of these states will eventually be removed.

The states that will be removed will be determined upon the construction of the

transition function of the equivalent DFA.

Page 8 of 21

Construction of the transition function for the equivalent DFA for NFA N1

The transition table for the equivalent DFA will be in the following form:

The procedure to be followed is that for each state that is reachable from state q0,

analyze to which state the equivalent DFA will go to given the arrival of each input

symbol.

Starting at state q0 (this is the DFA state that represents the situation where the

NFA is at state q0 only):

If input = 0, the NFA will go to state q1. So the NFA will be at state q1

only. This is represented by state q1 of the equivalent DFA.

If input = 1, the NFA will go to a dead state since all processing will stop.

This is represented by state qdead of the equivalent DFA.

Updating the transition function to reflect these gives

*Property of STI

Page 5 of 13

The next states to be analyzed are states q1 and qdead since these are the states

that can be reached from q0 as of this time.

NFA and DFA Equivalence

Page 9 of 21

From state q1 (this is the DFA state that represents the situation where the NFA is

at state q1 only).

If input = 0, the NFA will stay at state q1. So the NFA will be at state q1

only. This is represented by state q1 of the equivalent DFA.

If input = 1, the NFA will have two copies. One copy will stay at state q1

while the other copy will go to state q2. So the NFA will be at states q1

and q2. This is represented by state q12 of the equivalent DFA.

From state qdead (this is the DFA state that represents the situation where all copies

of the NFA have stopped processing).

The NFA will stay at its dead state regardless of the input symbol

received. So the DFA will also stay at qdead regardless of the input

symbol arriving.

The only state reachable from q0 that has not been analyzed so far is state q12 (it is

reachable from state q0 through state q1). Therefore, it will be analyzed next.

*Property of STI

Page 6 of 13

Page 10 of 21

From state q12 (this is the DFA state that represents the situation where the NFA is

at states q1 and q2)

If input = 0, the copy of the NFA which is at state q1 stays at q1. The

other copy which is at state q2 will stop processing. So the NFA will be at

state q1 only. This is represented by state q1 of the equivalent DFA.

If input = 1, the copy of the NFA which is at state q1 will go to states q1

and q2. While the other copy which is at q2 will stop processing. So the

NFA will be at states q1 and q2. This is represented by state q12 of the

equivalent DFA.

Page 11 of 21

So far the only states of the equivalent DFA that came out during the analysis are

q1, q12, and qdead. All these three states have been analyzed already (they have

complete entries in the transition function). It can therefore be said that these

states are the only states that are reachable from the start state q0.

The transition function will then be

Observe that the DFA states q2, q01, q02, and q012 are not reachable from state q0.

These are the useless states. For example, state q2 of the equivalent DFA is

unreachable from state q0 because there is no situation wherein the NFA N1 will be

in state q2 only. Similarly, state q012 of the equivalent DFA is unreachable from

state q0 because there is no situation wherein the NFA N1 will be at states q0, q1,

and q2 at the same time.

These states can therefore be removed from the transition table.

*Property of STI

Page 7 of 13

Page 12 of 21

0

q0

q1

Page 13 of 21

q12

qdead

0, 1

0, 1

q0

0, 1

q1

q2

Take note that N2 accepts strings over the alphabet = {0, 1} that contain the

substring 11.

Since this NFA has three states, the possible states N2 can assume are q0 only, q1

only, q2 only, q0 and q1, q0 and q2, q1 and q2, q1 and q2 and q3, and the dead state.

This is similar to the previous example.

*Property of STI

Page 8 of 13

Page 14 of 21

The next step now is to determine the start state and the final states of the

equivalent DFA.

The initial state of the NFA N2 is q0 so the initial state of the equivalent DFA will

also be q0.

NFA and DFA Equivalence

Page 15 of 21

The final state of NFA N2 is q2. This means that the NFA is in the final state if one

copy of the NFA is at state q2. So the NFA is in the final state if it is in any of the

following states:

1.

2.

3.

4.

q2

q 0, q 2

q 1, q 2

q 0, q 1, q 2

In other words, the NFA will be in the final state if q2 is included in the subset.

Therefore, the final states for the equivalent DFA are q2, q02, q12, and q012.

The transition table for the equivalent DFA will be in the following form:

For each state that is reachable from state q0, we next analyze to which state the

equivalent DFA will go to given the arrival of each possible input symbol.

Starting at state q0 (this is the DFA state that represents the situation where the

NFA is at state q0 only):

If input = 0, the NFA will go to state q0. So the NFA will be at state q0

only. This is represented by state q0 of the equivalent DFA.

If input = 1, the NFA will have two copies. One copy will stay at state q0

*Property of STI

Page 9 of 13

while the other copy will go to state q1. So the NFA will be at states q0

and q1. This is represented by state q01 of the equivalent DFA.

The next state to be analyzed is state q01 since this is the only state that is

reachable from q0 that has not been analyzed so far.

NFA and DFA Equivalence

Page 16 of 21

From state q01 (this is the DFA state that represents the situation where the NFA is

at states q0 and q1)

If input = 0, the copy of the NFA which is at state q0 will stay at q0. The

other copy which is at q1 will stop processing. The NFA will then be at

state q0 only. This is represented by state q0 of the equivalent DFA.

If input = 1, the copy of the NFA which is at state q0 will go to states q0

and q1. The other copy, which is at state q1, will go to state q2. The NFA

will then be at states q0, q1, and q2. This is represented by state q012 of

the equivalent DFA.

The only state reachable from q0 that has not been analyzed so far is state q012 (it

is reachable from state q0 through state q01). Therefore, it will be analyzed next.

*Property of STI

Page 10 of 13

Page 17 of 26

From state q012 (this is the DFA state that represents the situation where the NFA is

at states q0,q1, and q2)

If input = 0, the copy of the NFA which is at state q0 will stay at state q0.

The second copy which is at state q1 will stop processing. The third copy

which is at state q2 will stay at state q2. The NFA will then be at states q0

and q2. This is represented by state q02 of the equivalent DFA.

If input = 1, the copy of the NFA which is at state q0 will go to states q0

and q1. The second copy which is at state q1 will go to state q2. The third

copy of the NFA which is at state q2 will stay at state q2. The NFA will

then be at states q0, q1, and q2. This is represented by state q012 of the

equivalent DFA.

The only state reachable from q0 that has not been analyzed so far is state q02 (it is

reachable from state q0 through state q01 and then through q012). Therefore, it will

be analyzed next.

NFA and DFA Equivalence

Page 18 of 21

From state q02 (this is the DFA state that represents the situation where the NFA is

at states q0 and q2)

If input = 0, the copy of the NFA which is at state q0 will stay at state q0.

The other copy which is at state q2 will stay at state q2. The NFA will then

be at states q0 and q2. This is represented by state q02 of the equivalent

DFA.

If input = 1, the copy of the NFA which is at state q0 will go to states q0

and q1. The other copy which is at state q2 will stay state q2. The NFA

will then be at states q0, q1, and q2. This is represented by state q012 of

the equivalent DFA.

*Property of STI

Page 11 of 13

Page 19 of 21

So far the only states of the equivalent DFA that came out during the analysis are

q01, q02, and q012. All these three states had been analyzed already (they have

complete entries in the transition function. It can therefore be said that these states

are the only states that are reachable from the start state q0.

The transition function will be

Observe that states q1, q2, q12, and qdead are not reachable from state q0. These

can therefore be removed from the transition table.

*Property of STI

Page 12 of 13

Page 20 of 21

0

q0

q01

q012

0

1

Page 21 of 21

q02

For the given NFA, have the students construct the equivalent DFA.

The given NFA accepts all strings that end with a 00.

q0

q01

q012

1

1

*Property of STI

Page 13 of 13

- chap6+pushdownautomataUploaded byscodrash
- Toc 2Uploaded byapi-3696125
- ACD NOTES-1Uploaded bycute_barbie
- TAFL RCS403 2018.pdfUploaded byanshu gupta
- UndecidableUploaded byHeloel Hernández
- Complementing Buchi AutomataUploaded bymelisavivan
- 4Uploaded bysangtao
- Gate Cs Paper 2009Uploaded byhailos
- CBSE NET December 2014 Computer Science and Applications Syllabus.docxUploaded byAnonymous jpeHV73mLz

- TCU 2019 Certificate Recognization SERVICE AWARD 5 YearsUploaded byMELJUN CORTES, MBA,MPA
- TCU 2018 Certificate of Recognition Outstanding FacultyUploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TCU Evaluation Faculty TCU Taguig City 2nd Semester 2018 2019Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TCU Evaluation Faculty TCU Taguig City 1st Semester 2018 2019Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TCU Evaluation Faculty TCU Taguig City 2nd Semester 2017 2018Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TCU Evaluation Faculty TCU Taguig City 1st Semester 2017 2018Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TCU Evaluation Faculty TCU Taguig City 2nd Semester 2016 2017Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TCU Evaluation Faculty TCU Taguig City 1st Semester 2016 2017Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TCU Evaluation Faculty TCU Taguig City 2nd Semester 2015 2016Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TCU Evaluation Faculty TCU Taguig City 1st Semester 2015 2016Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TCU Evaluation Faculty TCU Taguig City 2nd Semester 2014 2015Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TCU Evaluation Faculty TCU Taguig City 1st Semester 2014 2015Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TCU 2019 Certificate Recognization SERVICE AWARD 5 years of TCU OSASUploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TCU 2018 Certificate of Recognition Outstanding Faculty of TCUUploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TESDA License NC III BookkeepingUploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TESDA License NC II CSS Computer Systems ServicingUploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TESDA TM 1 2016 Trainer's Methodology IUploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TESDA Data Encoder Eligibility 2Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TESDA Data Encoder Eligibility 1Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TESDA License NC II PC OperationsUploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TESDA License NC I Data EncoderUploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TESDA License NC I TechnicianUploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TESDA 2009 Tm Am Trainers AMUploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TESDA 2009 CHS NC II 392 Hours Certificate of Training Computer Hardware ServicingUploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TCU OSAS 2019 Certificate Recognization SERVICE AWARD 5 YearsUploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TCU 2018 Certificate of Recognition Outstanding Faculty - TEACHERUploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES IBM COGNOS Certified 2013Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES IBM Training Certificate DATA WareHousingUploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES IBM Training Certificate BIG DATAUploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES IBM Training Certificate Predictive AnalyticsUploaded byMELJUN CORTES, MBA,MPA

- draft 2Uploaded byapi-383921110
- Lab Manual - Ait (Cse 407) 2016Uploaded byNeha
- R ExamplesUploaded byAnimesh Dubey
- QUAD+ZMU+MN (1)Uploaded byHaroldo Ramos
- Montero-Cordero and Lobo 2010_Effect of Tourist Vessels on the Behaviour of the spotted dolphin KetoUploaded byFundacion Keto
- xs02Uploaded byMathurathipan Rajendraseelan
- 700-908 Adjustable Bimetal ThermostatsUploaded bymasakp
- RefUploaded byEngr Jonathan O Okoronkwo
- APChem_ChemEquationsUploaded bySumolmal Srisukri
- Steel StructureUploaded byPallav Paban Baruah
- Central Institute of Hand ToolsUploaded byNishit Thakran
- IMPRIMIR.pdfUploaded byBoris Yeltsin Ramos Bautista
- Factors Affecting Students Performance in MtUploaded bySanti Sinnakaudan
- A Survey on Moving Object Detection in Static and Dynamic Background for automated video analysisUploaded byInternational Journal for Scientific Research and Development - IJSRD
- brochurePLR.pdfUploaded bytahera aqeel
- A6294 (Sept-2013)Protocol Specifications ManualUploaded byDSTEFANIE
- Kooltronic NPT SERIESUploaded bydanielrivet
- Code PID Trong CUploaded byHue Tran
- R5F21114FPUploaded bydennisarmoa
- Boskovic 2007Uploaded byodisss
- ZAL 40S Description and Operating InstructionUploaded byDaniel Istrati
- Study and Analysis of Single Point Cutting Tool Under Variable Rake AngleUploaded byIJRASETPublications
- Austral is GuideUploaded byHabibi Faridh
- MAMAUploaded byJacob Hansen
- Developing the Half Adder and Full AdderUploaded byFaisal Khan
- P1_Spanish Lessons Tutorial 1Uploaded byhemant023
- 201B Exam 2 PrepUploaded byChanel Nguyen
- Inorganic Photovoltaic CellsUploaded byReivax50
- Microstrategy Interview QuestionsUploaded byMadhu Vaddepally
- 1. Vandenberghe 2013, Employement Greying and Feminizing WorkforceUploaded byRicardo Gutiérrez Argüelles

## Much more than documents.

Discover everything Scribd has to offer, including books and audiobooks from major publishers.

Cancel anytime.