151 views

Uploaded by Ayush Sekhari

NFA to DFA

- Finite Automat1
- csci3255 HW 3
- non-det
- Solutions Peter Linz Automata
- TOC Question Bank
- MELJUN CORTES Automata Lecture Pushdown Automata 1
- 02-toc
- 1 - 4 - 4. Nondeterministic Finite Automata (46 Min.)
- 5th sem
- BTech II Year Comp. Sc. & Engg. and Related Programs (Effective From 2017-18)
- Finite Automata
- From RE to NFA and Vise Versa
- CH1-INTRODUCTIONTOFINITEAUTOMATA
- Introduction to Finite Automata
- Lecture 21
- Optical Character Recognition - Project Report
- Call for Papers ICOSAL-13
- 20 Basic Finite State Machines
- teori-bahasaautomata-2
- University of Manchester

You are on page 1of 7

with transitions

Languages

Recall.

What is a language?

What is a class of languages?

Finite Automata

Consists of

A set of states (Q)

A start state (q

o

)

A set of accepting states (F )

Read symbols ( )

Transition function ()

Lets recap

First there was the DFA

Deterministic Finite Automata

For every state and every alphabet symbol there

is exactly one move that the machine can make.

: Q x Q

is a total function: completely defined. I.e. it

is defined for all q Q and a

Then, the NFA

Non-determinism

When machine is in a given state and reads a

symbol, the machine will have a choice of

where to move to next.

There may be states where, after reading a

given symbol, the machine has nowhere to go.

Applying the transition function will give, not 1

state, but 0 or more states.

Non-Deterministic Finite Automata

(NFA)

Transition function

is a function from Q x to 2

Q

(q, a) =subset of Q (possibly empty)

2

And now

Introducing

The newest in the FA family

The Non deterministic finite automata with

transitions (-NFA)

Nondeterministic Finite Automata with

transitions(-NFA)

For both DFAsand NFAs, you must read a

symbol in order for the machine to make a

move.

In Nondeterministic Finite Automata with

transitions(-NFA)

Can make move without reading a symbol off

the read tape

Such a move is called a transition

Nondeterministic Finite Automata with

transitions(-NFA)

Example:

Machine to accept decimal numbers

q

0

q

1

q

2

q

3

q

5

q

4

+-

0,1,..9

0,1,..9 .

.

0,1,..9

0,1,..9

Nondeterministic Finite Automata with

transitions(-NFA)

How does such a machine accept?

A string will be accepted if there is at least one

sequence of state transitions on an input

(including transitions) that leaves the machine

in an accepting state.

Nondeterministic Finite Automata with

transitions(-NFA)

Example:

-3.45 is accepted

.5678

37 is rejected

q

0

q

1

q

2

q

3

q

5

q

4

+-

0,1,..9

0,1,..9 .

.

0,1,..9

0,1,..9

Nondeterministic Finite Automata with

transitions(-NFA)

A Non-Deterministic Finite Automata with

transitions is a 5-tuple(Q, , q

o

, , F) where

Q is a finite set (of states)

is a finite alphabet of symbols

q

o

Q is the start state

F Q is the set of accepting states

is a function fromQ x ( {}) to 2

Q

(transition

function)

3

Nondeterministic Finite Automata with

transitions(-NFA)

Transition function

is a function from Q x ( {}) to 2

Q

(q, a) =subset of Q (possibly empty)

In our example

(q

1

, 0) ={q

1

, q

4

}

(q

1

, .) ={q

1

}

(q

1

, +) =

(q

0

, ) ={q

1

}

Nondeterministic Finite Automata with

transitions(-NFA)

Transition function on a string

is a function from Q x

*

to 2

Q

(q, x) =subset of Q (possibly empty)

Set of all states that the machine can be in,

upon following all possible paths on input x.

Well need to consider all paths that include the

use of transitions

^

-Closure

closure

Before defining the transition function on a

string ( (q,x)), it is useful to first define what

is known as the closure.

Given a set of states S, the closurewill give

the set of states reachable from each state in S

using only transitions.

^

-Closure

closure: Recursive definition

Let M =(Q, , q

o

, , F) be a -NFA

Let S be a subset of Q

The closure, denotes ECLOSE(S) is defined:

For each state p S, p ECLOSE(S)

For any q ECLOSE(S), every element of (q, )

ECLOSE(S)

No other elements of Q are in ECLOSE(S)

-Closure

-Closure: Algorithm

Since we know that ECLOSE(S) is finite, we can convert

the recursive definition to an algorithm.

To find ECLOSE(S) where S is a subset of Q

Let T =S

While (T does not change) do

Add all elements of (q, ) whereq T

ECLOSE(S) =T

-Closure

Example

4

-Closure

closure: Example

Find ECLOSE({s}) in our example

T ={s} initial step

T ={s, w} add (s, )

T ={s, w, q

0

} add (w, )

T ={s, w, q

0

, p,t} add (q

0

, )

(w, ) =(w, ) =

We are done,

ECLOSE({s}) =T ={s, w, q

0

, p,t}

Nondeterministic Finite Automata with

transitions(-NFA)

Now lets define

1. For any q Q, (q, ) =ECLOSE ({q})

2. For any y

*

, a , q Q

Set of all states obtained by applying to all states in

*

(q,y) and

input aand taking the closureof theresult

U

) , (

) , ( ) , (

y q p

a p ECLOSE ya q

transitions(-NFA)

Accepting a string

A string x is accepted if running the machine on

input x, considering all paths, including the use

of transitions, puts the machine into one of

the accepting states

Formally:

x

*

is accepted by M if

(q

0

, x) F

^

transitions(-NFA)

Are the following strings accepted by the -

NFA below:

aba

ababa

aaabbb

Nondeterministic Finite Automata with

transitions(-NFA)

I bet that youre asking

Can J FLAP handle -NFAs?

Well, lets check and see!

Nondeterministic Finite Automata with

transitions(-NFA)

Language accepted by M

The language accepted by M

L(M) ={ x

*

| x is accepted by M }

If L is a language over , L is accepted by

M iff L =L(M).

For all x L, x is accepted by M.

For all x L, x is rejected by M.

5

Nondeterministic Finite Automata with

transitions(-NFA)

Why theyre a good idea

Given a regular expression, it is far easier to

create an -NFA for the language described by

the expression than it is to create a plain old

DFA.

It will also be essential when showing the Fas

accept the class of Regular Languages.

Questions?

DFA / NFA / -NFA Equivalence

Surprisingly enough

transitionsto our NDFA does NOT give it any

additional language accepting power.

DFAs and NFAs and -NFA are all equivalent

Every language that can be accepted by a -NFA can

also be accepted by an DFA which can also be

accepted by a NFA.

Lets show this

-NFA ->DFA

Given -NFA find DFA

Let E =(Q

E

, ,

E

, q

0

, F

E

) be a -NFA then

There exists a DFA, D=(Q

D

, ,

D

, q

D

, F

D

)

Such that L(E) =L(D)

-NFA ->DFA

Basic idea

Very similar to the subset construction

algorithm

Recall that for a -NFA , : Q x 2

Q

Use the states of D to represent subsets of Q.

-NFA ->DFA

Formal definition

E =(Q

E

, ,

E

, q

0

, F

E

) be a -NFA

We define DFA, D=(Q

D

, ,

D

, q

D

, F

D

)

Q

D

=2

QE

q

D

=ECLOSE (q

0

)

F

D

=sets containing at least one state fromF

E

-NFA ->DFA

Computing

D

D

(S, a) for S Q

D

, a

Let S ={ p

1

, p

2

, , p

n

}

Compute the set of all states reachable fromstates in

S on input a using transitions fromE.

D

(S, a) will be the union of the closures of the

elements of {r

1

, , r

m

}

U

L

n

i

i E m

a p r r r

1

2 1

) , ( } , , , {

=

=

U

m

j

j D

r ECLOSE a S

1

) ( ) , (

=

=

6

-NFA ->DFA

q

0

q

1

q

2

q

3

q

5

q

4

+-

0,1,..9

0,1,..9 .

.

0,1,..9

0,1,..9

-NFA ->DFA

{q

5

} q

5

{q

4

} q

4

{q

3 ,

q

5

} q

3

{q

2

} q

2

{q

1

} q

1

{q

0

, q

1

} q

0

closure

State

-NFA ->DFA

q

0

q

1

q

1

+-

q

2

.

q

1

q

4

0,1,,9

0,1,,9

q

2

q

3

q

5

.

.

q

3

q

5

0,1,,9

0,1,,9

0,1,,9

0,1,,9

-NFA ->DFA

Now we must show that D accepts the same

language as E

Can be shown (using induction) that for all x

*

(q, x) = (q, x)

See Theorem2.22

^

D

^

E

-NFA ->DFA

Show that D and E recognize the same

language

x is accepted by Eiff (q

0

, x) F

E

x is accepted by D iff (q

D

, x) F

E

Thus,

x is accepted by D iff x is accepted by E

Questions?

^

E

^

D

DFA ->-NFA

The other direction is fairly straighforward.

For any DFA, there is an equivalent NFA

An NFA is nothing more than a -NFA with no

transitions. Thus

(q, ) for all states q =

7

What have we shown

For every DFA, there is an NFA that

accepts the same language and visa versa

For every DFA, there is a -NFA that accepts the

same language, and visa versa

Thus, for every NFA there is a -NFA that accepts the

same language, and visa versa

DFAs, NFAs, and -NFA s are equivalent!

Questions?

Lets take a break.

- Finite Automat1Uploaded bypisces145
- csci3255 HW 3Uploaded byDK Hassan
- non-detUploaded bytheresa.painter
- Solutions Peter Linz AutomataUploaded byimhungrynow
- TOC Question BankUploaded byayush
- MELJUN CORTES Automata Lecture Pushdown Automata 1Uploaded byMELJUN CORTES, MBA,MPA
- 02-tocUploaded byPreyanshMitharwal
- 1 - 4 - 4. Nondeterministic Finite Automata (46 Min.)Uploaded byHuong Luong
- 5th semUploaded byChiranjiveeThakur
- BTech II Year Comp. Sc. & Engg. and Related Programs (Effective From 2017-18)Uploaded byYadav Deepankar
- Finite AutomataUploaded byAshwin Kumar Dash
- From RE to NFA and Vise VersaUploaded byMahmoud Nawwar
- CH1-INTRODUCTIONTOFINITEAUTOMATAUploaded byHemanth Kumar
- Introduction to Finite AutomataUploaded byapi-3699876
- Lecture 21Uploaded byborakas_borakas
- Optical Character Recognition - Project ReportUploaded byKushagra Chadha
- Call for Papers ICOSAL-13Uploaded byArul Dayanand
- 20 Basic Finite State MachinesUploaded byAshish Kumar
- teori-bahasaautomata-2Uploaded bySanny Era Eliza Siallagan
- University of ManchesterUploaded bycitharthan
- Quadrature EncoderUploaded byJaime Santiago Sanchez Reinoso
- IntroToAutomataTheory.pdfUploaded byasdasa
- Lecture 1 - Intro'18.pptUploaded byПетар Милојковић
- Driven Expertise Exploitation Results RealityUploaded bysfofoby
- Binary Built in Expertise Exploitation Results RealityUploaded bysfofoby
- Model Engineering Using Multimodeling - Mccm08Uploaded bydknow75
- Model Checking a SystemC TLM DesignUploaded byNaveed Beigh
- EF3e_elem_entry_test.pdfUploaded byAnonymous HAIBht
- C ExamplesUploaded byKeshab Fouzdar

- kvs baisc circuit analysis.pdfUploaded byAyush Sekhari
- kernels assignmentUploaded byAyush Sekhari
- Lu Masters ThesisUploaded byAyush Sekhari
- Dijkstra GotoUploaded bySAN JUAN BAUTISTA
- cs229-cvxoptUploaded byEric Huang
- Applied Stochastic ProcessesUploaded byAyush Sekhari
- thermodynamics questionsUploaded byAyush Sekhari
- Lab1 2013Uploaded byAyush Sekhari
- Simulation and Modeling Lab Proposal Ver 2.0_DP.docUploaded byAyush Sekhari
- Defacing Websites A Step By Step Process By Ankit Fadia Hacking Truths FTP ExploitsUploaded bypaul_17oct@yahoo.co.in
- Defacing Websites A Step By Step Process By Ankit Fadia Hacking Truths FTP ExploitsUploaded bypaul_17oct@yahoo.co.in
- SolutionUploaded byAyush Sekhari

- CA448 Lexical Analysis 2pUploaded bytaherakhans
- Fundamentals of Mathematics for Computer ScienceUploaded byDonnell Holmes
- TheoryOfComputation_Uploaded byphyzics
- Sequence DetectorUploaded byLaksh Agrawal
- FAFLUploaded byDharmesh Bharti
- Intro to Automata TheoryUploaded byRaqeeb Rahman
- Givone_ch08Uploaded bydungbarca90
- Grafcet Step-By StepUploaded byGisele Camargo
- IT Final Upto 4th Year Syllabus 27.07.13Uploaded byGulshan Mudgal
- ch3Uploaded byKummari Nagaiah
- Solution Manual for Switching and Finite Automata Theory PDFUploaded byKimberly Greene
- LG GU230 Dimsun Service ManualUploaded byjaimecamo
- Developing Battle of Etam Earth Game Agent With Finite State Machine (FSM) And Sugeno FuzzyUploaded byRaden Andrea Reza
- fsm design using vhdlUploaded byrajivsharma1610
- Jflap Manual and Exercises-Uploaded byHack Mala
- 59766045-II-b-tech-Cse-r10-Jntuk-Syllabus.docUploaded byChristina Robinson
- Keijo Ruohonen: Formal LanguagesUploaded byIntoshBlef
- toc QB.pdfUploaded bySandeep Kumar
- f05_week13Uploaded byavi0341
- Push Down AutomataUploaded byRiya Sapra
- coverage-cookbook-complete-verification-academy.pdfUploaded byanubhaw2004
- 213Ch5.pdfUploaded bySiddharthSharma
- Algorithmic Metatheorems for Decidable LTLUploaded bynewfut
- ASM1.pdfUploaded byZeyad Tareq Al Sarori
- r05310501 Formal Languages and Automata TheoryUploaded bySRINIVASA RAO GANTA
- MSC_MATHS-1Uploaded bydeveshag
- Yaakov Benenson et al- Programmable and autonomous computingmachine made of biomoleculesUploaded byGmso3
- 2015-CSE-3.1-2 Syllabus - 2015Uploaded byVihsdjf Kkdehm,fs
- Btech Cse Curriculum n Syllabus 2015 RmpUploaded bySRM e-Learning
- Theory of ComputationUploaded byVivek Kumar