151 views

Uploaded by Ayush Sekhari

NFA to DFA

- MCS_232j
- Fsm
- Lecture 3
- a105559
- Chapter 4
- Summary
- Thesis
- two marks
- GATE- Computer Science(CS)- 2009
- 03a Nondeterministic Finite Accepters
- vhdl_proj19
- Fallsem2013 14 Cp1349 Asgn01 Problem Set i
- Final Presentation (Minor)
- Noisy Time Series Prediction using a Recurrent.pdf
- dilbag
- examen-6to-2017
- APETPUP
- apr 10-14
- CollaborativeActivity Group 216
- grammar 1 Module 2.pdf

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.

- MCS_232jUploaded byPooja Sinha
- FsmUploaded byRohit Panwar
- Lecture 3Uploaded byFrozenSoul
- a105559Uploaded byvaralakshmi
- Chapter 4Uploaded bybanana19113
- SummaryUploaded byataj02
- ThesisUploaded bySzilard Zsolt Fazekas
- two marksUploaded byJegathambal Ganeshan
- GATE- Computer Science(CS)- 2009Uploaded bysur89
- 03a Nondeterministic Finite AcceptersUploaded bySoe Chit Kaung
- vhdl_proj19Uploaded byAnirudh Dasari
- Fallsem2013 14 Cp1349 Asgn01 Problem Set iUploaded byHimanshu Singh
- Final Presentation (Minor)Uploaded byAnkita
- Noisy Time Series Prediction using a Recurrent.pdfUploaded byrenvor50
- dilbagUploaded bydggil2
- examen-6to-2017Uploaded byMauricioGomezdelaTorre
- APETPUPUploaded byPearl Phillips
- apr 10-14Uploaded bylallen425
- CollaborativeActivity Group 216Uploaded byMiller Rincon Sastoque
- grammar 1 Module 2.pdfUploaded byAurora M
- ITBP205_SP2015_LCN_09.ppsxUploaded byReem Ashraf
- Participation Assessment, Q1Uploaded byhtgreene
- newsletter1 decemberUploaded byapi-263642764
- sg assignment lesson 1Uploaded byapi-239876044
- theenglishprofilebooklet.pdfUploaded byCristian Olaya
- Project 1 y 2 ING PNIEBUploaded byNancy Mata
- Key Stage Results 2017Uploaded byRichard Davidson
- interactive learning activities 1Uploaded byapi-375058400
- e_f_eng_l1_l2_si_076Uploaded bySimona Bute
- Procedure TextUploaded byWardi Astina

- cs229-cvxoptUploaded byEric Huang
- Applied Stochastic ProcessesUploaded byAyush Sekhari
- Lu Masters ThesisUploaded byAyush Sekhari
- Dijkstra GotoUploaded bySAN JUAN BAUTISTA
- kvs baisc circuit analysis.pdfUploaded byAyush Sekhari
- kernels assignmentUploaded 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
- Lab1 2013Uploaded byAyush Sekhari
- Simulation and Modeling Lab Proposal Ver 2.0_DP.docUploaded byAyush Sekhari
- thermodynamics questionsUploaded byAyush Sekhari

- DSA_QA-1Uploaded byHồng Hải
- Ancilla-driven Instantaneous Quantum Polynomial Time Circuit for Quantum SupremacyUploaded byYash
- Fuzzy Transportation ProblemUploaded byAditya Bhansali
- BGP No DivergenceUploaded byapi-3761983
- 9A02707 Soft Computing Techniques.pdfUploaded byReddy Kiran KD
- DATAMINING AND DATAWARE HOUSINGUploaded byBridget Smith
- Load Based HO OptimizationUploaded byJustin Nguyen
- Lecture08.pdfUploaded byTimothy Eng
- String Exercise (3)Uploaded byjohndoe21718
- Ada solutions 11th exerciseUploaded bysathwick
- SyllabusUploaded byTony
- HOW TO CALCULATE CUTTING LISTUploaded byHowo4Die
- Prepare _ CodeChefUploaded byJOYDIP SARKAR
- Hamming.treballUploaded byAdnan Shehzad
- Clausal Form, ResolutionUploaded byPreeTi KalWar
- Try-Outs on Shortest Paths of General States in Hanoi TowerUploaded byJamie J Seol
- Source CodeUploaded byMeta Lara Pandini
- Creating a Turing Machine in Python – Part 1 - CodeProjectUploaded byGabriel Gomes
- dmchap11Uploaded byKavita Saxena Khare
- UGC-NET Computer ScienceUploaded byVikrant Sehgal
- Lesson 20 Solving Assignment ProblemUploaded byNitin Kumar
- K01149_20181002125220_Updated-PRO FORMA MTS3023 A181 (1)Uploaded byIrfan Fazail
- Tablas de Verdad practicas profesor borregoUploaded byErickGalvanAlcantara
- IRJET-Enumeration of size of a T- graphsUploaded byIRJET Journal
- ADS SyllabusUploaded bySubhash Kulhari
- Selection Test 2008Uploaded byanon-617575
- Java InheritanceUploaded byanired9
- Matrix Indexing in MATLAB - MATLAB & SimulinkUploaded byGautam Monipatro
- Data Structure 2.pptUploaded byHasanen10
- Link Prediction in Social Networks via Friendlink AlgorithmUploaded bysabaarjmand