0 Up votes0 Down votes

4 views29 pagesMELJUN CORTES Automata Lecture Designing Finite Automata 2

Jun 12, 2015

© © All Rights Reserved

PDF, TXT or read online from Scribd

MELJUN CORTES Automata Lecture Designing Finite Automata 2

© All Rights Reserved

4 views

MELJUN CORTES Automata Lecture Designing Finite Automata 2

© All Rights Reserved

- Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
- Hidden Figures Young Readers' Edition
- The Law of Explosive Growth: Lesson 20 from The 21 Irrefutable Laws of Leadership
- The E-Myth Revisited: Why Most Small Businesses Don't Work and
- The Wright Brothers
- The Power of Discipline: 7 Ways it Can Change Your Life
- The Other Einstein: A Novel
- The Kiss Quotient: A Novel
- State of Fear
- State of Fear
- The 10X Rule: The Only Difference Between Success and Failure
- Being Wrong: Adventures in the Margin of Error
- Algorithms to Live By: The Computer Science of Human Decisions
- The Black Swan
- Prince Caspian
- The Art of Thinking Clearly
- A Mind for Numbers: How to Excel at Math and Science Even If You Flunked Algebra
- The Last Battle
- The 6th Extinction
- HBR's 10 Must Reads on Strategy (including featured article "What Is Strategy?" by Michael E. Porter)

You are on page 1of 29

Designing Deterministic

Finite Automata

Designing DFAs

accepts all strings over the alphabet

= {0, 1} with an odd number of 1s.

something the machine must

remember about the input

string.

symbols have already arrived.

Upon the arrival of the next

symbol, the machine does not

have to remember the exact

number of 1s it has received.

* Property of STI

Page 1 of 29

remember two things:

to

in the input string at any

point in time is odd.

2. Whether the number of 1s

in the input string at any

point in time is even.

states are needed. One to

represent the fact that the

current number of 1s is odd,

and the other to represent

even.

* Property of STI

Page 2 of 29

of 1s is even will be

designated as the start state.

This is because while there is

no input symbol yet, the

number of 1s is zero (even).

be the final state.

q0 = current number of 1s

is even.

q1 = current number of 1s

is odd.

* Property of STI

Page 3 of 29

state q0 (even):

If it receives a 0, it remains

in that state since the

number of 1s is still even.

If it receives a 1, it moves

to state q1 since the

number of 1s is now odd.

state q1 (odd):

If it receives a 0, it remains

in that state since the

number of 1s is still odd.

If it receives a 1, it moves

to state q0 since the

number of 1s is now even.

* Property of STI

Page 4 of 29

required DFA:

0

0

1

q0

q1

* Property of STI

Page 5 of 29

accepts all strings over the alphabet

= {0, 1} that contains the

substring 011.

be designed does not have to

remember each and every

input symbol that arrives.

only has to remember whether

the substring 011 has been

encountered.

* Property of STI

Page 6 of 29

remember the following things

(states):

first symbol of the

substring so far.

2. it has encountered the first

symbol of the substring (0).

3. it has encountered the first

two symbols of the

substring (01).

4. it has encountered all three

symbols of the substring

(011).

* Property of STI

Page 7 of 29

not yet encountered any of the

symbols of the substring will

be designated as the start

state while the state where it

had encountered all symbols

will be the final state.

1. q0 = the first symbol of the

substring had not arrived.

2. q1 = the first symbol had

arrived.

3. q2 = the first two symbols

had arrived.

4. q3 = all three symbols had

arrived.

* Property of STI

Page 8 of 29

state q0 (had not encountered

first symbol in the substring):

If a 0 arrives, it moves to

state q1 since it had

encountered the first

symbol of the substring.

If a 1 arrives, it stays in

that state because the

substring must start with a

0.

* Property of STI

Page 9 of 29

state q1 (only the first symbol,

0, had been encountered):

If a 0 arrives, it remains in

that state. Remember that

a 0 had already been

encountered. The arrival

of another 0 does not

improve the search.

However, this newly

arrived 0 can now be the

new first symbol of the

substring (the previous 0

may be forgotten).

If it receives a 1, it moves

to state q2 since the two

symbols of the substring

have already been

encountered.

* Property of STI

Page 10 of 29

state q2 (the first two symbols,

01, had been encountered):

If a 0 arrives, it goes to

state q1. The arrival of this

0 makes the substring 010.

The previous 01 would

have to be forgotten and

this newly arrived 0 can

now be the new first

symbol of the substring.

If it receives a 1, it moves

to state q3 since the three

symbols of the substring

(011) had already been

encountered.

* Property of STI

Page 11 of 29

state q3 (the substring 011 had

been encountered):

The DFA will not change

state upon the arrival of

succeeding 0s and 1s

since the desired substring

had already been detected.

required DFA:

q0

q1

0, 1

q2

q3

* Property of STI

Page 12 of 29

accepts all strings over the alphabet

= {0, 1} that starts and ends with

01.

designed must be able to

detect if the input string has a

prefix which is 01 and a suffix

which is also 01.

should remember the following

things:

1. The state where it had not

yet encountered the first

symbol (0) of the prefix 01.

2. The state where it had

encountered the first

symbol (0) of the prefix 01.

* Property of STI

Page 13 of 29

encountered the two

symbols (01) of the prefix

01.

4. The state where it had

already encountered the

prefix 01 and it had

encountered the first

symbol (0) of the suffix 01.

5. The state where it had

encountered the prefix 01

and the two symbols (01)

of the suffix 01.

6. The state where the input

string did not start with the

prefix 01. If the string did

not start with a 01, then it

would be useless for the

DFA to determine if it

would end with a 01.

* Property of STI

Page 14 of 29

1. q0 = the first symbol of the

prefix 01 had not arrived.

2. q1 = the first symbol of the

prefix 01 had arrived.

3. q2 = the two symbols of the

prefix 01 had arrived.

4. q3 = the two symbols of the

prefix

01

had

been

received and the first

symbol of the suffix 01 had

arrived.

5. q4 = the two symbols of the

prefix

01

had

been

received and the two

symbols of the suffix 01

had arrived.

6. q5 = the input string did not

start with the prefix 01.

* Property of STI

Page 15 of 29

state q0 (the first symbol of the

prefix 01 had not arrived):

If a 0 arrives, it moves to

state q1 since it had

encountered the first

symbol of the prefix.

If a 1 arrives, it goes to

state q5 since it is now

impossible for the input

string to start with the

prefix 01.

* Property of STI

Page 16 of 29

state q1 (the first symbol of the

prefix 01 had arrived):

If a 0 arrives, it moves to

state q5 since it is now

impossible for the input

string to start with the

prefix 01 since the first two

symbols received are 00.

If a 1 arrives, it goes to

state q2 since the two

symbols of the prefix 01

had been received.

* Property of STI

Page 17 of 29

state q2 (the two symbols of

the prefix 01 had arrived):

If a 0 arrives, it moves to

state q3 since this newlyarrived zero can potentially

be the start of the suffix 01.

state since the suffix 01 is

still to be detected.

* Property of STI

Page 18 of 29

state q3 (the two symbols of

the prefix 01 had been

received and the first symbol

of the suffix 01 had arrived):

By this time, the last two

symbols received are 00.

The newly-arrived 0 can

now be the first symbol of

the suffix 01 while the

previous zero may be

forgotten.

If a 1 arrives, it moves to

state q4 since the prefix 01

had been received.

* Property of STI

Page 19 of 29

state q4 (the two symbols of

the prefix 01 had been

received and the two symbols

of the suffix 01 had arrived):

If a 0 arrives, the previous

two symbols (01) is not the

true suffix of the input

string. This newly arrived

0 can become the first

symbol of the potentially

true suffix. The DFA

therefore moves to state

q 3.

If a 1 arrives, the previous

two symbols (01) is not the

true suffix of the input

string. The DFA goes to

state q2.

* Property of STI

Page 20 of 29

state q5 (the input string did

not start with the prefix 01):

The DFA will not change

state upon the arrival of

succeeding

0s and 1s

since the string did not start

with the prefix 01. It is now

useless for the DFA to track

the

arriving

symbols

because the string will not

be accepted anyway.

required DFA:

0, 1

q5

1

q0

q1

q2

q3

q4

0

1

* Property of STI

Page 21 of 29

Additional exercises:

strings over the alphabet =

{0, 1} with no more than three

1s.

strings over the alphabet =

{0, 1} with an even number of

0s and an odd number of 1s.

strings over the alphabet =

{0, 1} that starts or ends with a

01.

* Property of STI

Page 22 of 29

For Exercise 1

Design a DFA that accepts all

strings over the alphabet =

{0, 1} with no more than three

1s.

The DFA will have 5 states:

1. q0 = there are no 1s

received.

2. q1 = there is one 1

received.

3. q2 = there are two 1s

received

4. q3 = there are three 1s

received.

5. q4 = there are four or more

1s received.

The start state is q0 while the

final states are q0, q1, q2, and

q 3.

* Property of STI

Page 23 of 29

q0

q1

q2

0, 1

q3

q4

* Property of STI

Page 24 of 29

For Exercise 2

Design a DFA that accepts all

strings over the alphabet =

{0, 1} with an even number of

0s and an odd number of 1s.

The DFA will have 4 states:

1. q0 = the number of 0s is

even and the number of 1s

is even.

2. q1 = the number of 0s is

even and the number of 1s

is odd.

3. q2 = the number of 0s is

odd and the number of 1s

is even.

4. q3 = the number of 0s is

odd and the number of 1s

is odd.

* Property of STI

Page 25 of 29

final state is q1.

q0

q1

q2

q3

* Property of STI

Page 26 of 29

For Exercise 3

Design a DFA that accepts all

strings over the alphabet =

{0, 1} that starts or ends with a

01.

This is similar to the design

example except that instead of

a string starting and ending

with the substring 01, the DFA

should accept strings starting

OR ending with the substring

01.

One way of processing the

strings is to determine first if

the prefix 01 is present. If it is,

then the DFA stops at an

accept state, regardless if

there are still incoming input

strings.

* Property of STI

Page 27 of 29

the prefix 01, then the DFA

proceeds to determine if it will

end with the suffix 01.

The DFA will have 6 states:

1. q0 = the first symbol of the

prefix 01 had not arrived.

2. q1 = the first symbol of the

prefix 01 had arrived.

3. q2 = the two symbols of the

prefix 01 had arrived.

4. q3 = the prefix 01 was not

encountered.

5. q4 = the prefix 01 was not

encountered and the first

symbol of the suffix 01 had

arrived.

6. q5 = the prefix 01 was not

encountered and the two

symbols of the suffix 01

had arrived.

Designing Deterministic Finite Automata

* Property of STI

Page 28 of 29

required DFA:

0, 1

q0

q1

q2

q3

q4

q5

0

1

* Property of STI

Page 29 of 29

- TOC Assignment No-1Uploaded byDhruv Kuchhal
- Exercises Unit3 Part2 OCWUploaded bycompiler&automata
- Dfa ProofsUploaded byMrinal Tak
- chap14Uploaded byPrakruti Krishnan
- Bascom CodesUploaded byFikrul Hakim
- CPRE281_HW05Uploaded byJessica
- Computer Science HomeworksolnUploaded byBenardMbithi
- ContentsUploaded bymircea_h33
- VR10-PG-CSEUploaded bypostpraveen
- asUploaded byAsim Raza
- (Lecture Notes in Computer Science 1600 _ Lecture Notes in Artificial Intelligence) Ruth Aylett (Auth.), Michael J. Wooldridge, Manuela Veloso (Eds.) - Artificial Intelligence Today_ Recent Trends AndUploaded byWafa Gld
- Lec 10.pdfUploaded bymuskan agarwal
- Applied Rec gctUploaded byHarish Mahendira Singh
- lecture4bUploaded byharishmahanthesh
- 7Uploaded byNava Krishnan
- Lecture AsmUploaded byOscar Valdez
- 20130130 d Ll State MachineUploaded bypoiopipo
- cs0355_theory_of_computation.pdfUploaded byRituraj choudhary
- TURING MACHINE VS PUSHDOWN AUTOMATAUploaded byHimanshu
- ASSEMBLY LINE BALANCINGUploaded byRamazan Tasa
- Digital Ckt RevisedUploaded bySriharsha Pidaparthi
- It Syllabus (Fifth Semester)Uploaded byapi-3847143
- baitapVHDLUploaded byHoangngocanh Hoanganh
- SupervisoryControl LibreUploaded byMayra Asitimbay
- Prize Recipients - November 2012Uploaded byBernews Admn
- Us 6182268Uploaded bynidhal
- MaulisaDewi-17482Uploaded byNadia Elaesiana
- Alternativemodel FinalUploaded byjdiorio88
- 379 Class 24 TransportationUploaded bymohana2589
- CS2114 Lecture06 AlgorithmEfficiency 2015FUploaded byMaryam Davoodi

- 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

- PYFML- A TEXTUAL LANGUAGE FOR FEATURE MODELINGUploaded byAnonymous rVWvjCRLG
- turingUploaded bytoos_id
- quantifiers.pdfUploaded bySima Khan
- Java String Interview Questions and Answers - JournalDevUploaded byHar Sha Chavali
- Principle of Mathematical InductionUploaded byAnirvan Shukla
- ifcolog00011Uploaded byRockandopera
- Lecture 7Uploaded byBilal Hashmi Shah
- PCD 2 marksUploaded byVignesh Vicky
- Solution ManualUploaded byAnjinayulu Anji
- Lexical AnalysisUploaded byCameron Harman
- Minds and machinesUploaded byjoni
- Theory Of ComputationUploaded byHameed Lebbai
- 3_26849_34Uploaded byMattin Sharif
- Discrete Str NotesUploaded byhas_zindarod8495
- IndicativeUploaded byjsn75
- Problem Set 1 (theory of automota)Uploaded bymahesh
- Zach Intermediate LogicUploaded byJacques DeBar
- ICS253 161 1 Foundations Logic Proofs S 1 1 1 4 PI(1)Uploaded byDawod Salman
- Main 2Uploaded byEihab Bashier
- predicate_logic.pdfUploaded by01689373477
- WYAHUploaded bySoham Chowdhury
- EspressoUploaded bykbkkr
- District1_2010Uploaded byTimmy Feng
- About the Classification and Regression Supervised Learning ProblemsUploaded bysaileshmns
- Código GEU PDFUploaded byLuis Santos
- Chapter 5 Context Free GrammarsUploaded bySathwick Hk
- Coursang1.PDFUploaded byAbel Ganz
- B.A. II Formal LogicUploaded byDharmendra Kumar
- logik4Uploaded bypoptard
- First Lecture on Symbolic ProgrammingUploaded byAnonymous 8erOuK4i

## Much more than documents.

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

Cancel anytime.