+ All Categories
Home > Documents > Equivalence, DFA, NDFA

Equivalence, DFA, NDFA

Date post: 14-Jan-2016
Category:
Upload: trey
View: 84 times
Download: 0 times
Share this document with a friend
Description:
Equivalence, DFA, NDFA. Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 2. Updated and modified by Marek Perkowski. Equivalence Relation on A. An Equivalence Relation (Not Relation ship ) Is Not an Equality Relation - PowerPoint PPT Presentation
Popular Tags:
51
Equivalence, DFA, NDFA Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 2 Updated and modified by Marek Perkowski
Transcript
Page 1: Equivalence, DFA, NDFA

Equivalence, DFA, NDFAEquivalence, DFA, NDFA

Sequential Machine Theory

Prof. K. J. HintzDepartment of Electrical and Computer

Engineering

Lecture 2

Updated and modified by Marek Perkowski

Page 2: Equivalence, DFA, NDFA

Equivalence Relation on AEquivalence Relation on A

• An Equivalence Relation (Not Relationship) Is Not an Equality Relation

• A Relation is an Equivalence Relation if and only if (iff) it is:– Reflexive– Symmetric– Transitive

Page 3: Equivalence, DFA, NDFA

Equivalence Relation on AEquivalence Relation on A

A

A

A

A

on ~ relation eequivalenc an is

e)(transitiv '',','','',' ',

)(symmetric ',,' ',

)(reflexive ', ,

R

RRR,

RR

R

then

aaaaaaaaa

and

aaaaaa

and

aaaa

if

Page 4: Equivalence, DFA, NDFA

Non-Algebraic Equivalence Relation Example

Non-Algebraic Equivalence Relation Example

Equivalence Relation on the Set of All Triangles on a Plane

“is congruent to” or “is similar to”

– Reflexive, each triangle is similar to itself,

Page 5: Equivalence, DFA, NDFA

Equivalence Relation ExampleEquivalence Relation Example

Symmetric, if

is similar to

then

is similar to

Page 6: Equivalence, DFA, NDFA

Equivalence Relation ExampleEquivalence Relation Example

Transitive, if

is similar to

and

is similar to

then

is similar to

Page 7: Equivalence, DFA, NDFA

Inclusion RelationInclusion Relation

ji

jiji

jjjj

iiii

ji

iff

then

, also are states all

)" in included is " as (read

,,,

,,,

, states, ofset theon defined partitions 2 Given

321

321

BBB

BBB

BBB

S

Page 8: Equivalence, DFA, NDFA

Inclusion Relation ExampleInclusion Relation Example

, in" included is"

,

5,4,3,2,1

5,4,3,2,1

5,4,3,2,1

21

21

2

14131211

1

or,

then

and

let

BBBB

Page 9: Equivalence, DFA, NDFA

Partition NotationPartition Notation

• Overbar Indicates States Which Are Elements of the Same -block.

• Single States Are Not Normally Listed

1

11 12 13 14

1 2

1 2 3 4 5

1 2 3 4 5

1 2 1 2 3 4 5

, , ,

,

,

B B B B

is written as

and

Page 10: Equivalence, DFA, NDFA

Relations May Be OrderingsRelations May Be Orderings

• Partial Ordering

• Total Ordering, aka Chain

• Well Ordering (not discussed here)

Page 11: Equivalence, DFA, NDFA

Partial OrderingPartial Ordering

• Given an Inclusion Relation, R: s s’, Defined on some Elements of the Set S such that s, s’ S, R Is a Partial Ordering If It Is:– Reflexive– Anti-Symmetric (asymmetric)– Transitive– Not all orderings are specified, therefore partial

Page 12: Equivalence, DFA, NDFA

Properties of POProperties of PO

– Reflexive• s s for all s S

– Anti-Symmetric (asymmetric)If

and

then

s s

s s

s s s s

'

, S

e.g., let : “older than”

if Sam is older than Bill,

then Bill cannot be older

than Sam

Page 13: Equivalence, DFA, NDFA

Properties of POProperties of PO

– TransitiveIf

and

then

s s

s s

s s

'

e.g., If the Redskins beat the Patriots

and the Patriots beat the Cowboys

then the Redskins will beat the Cowboys

Page 14: Equivalence, DFA, NDFA

Total OrderingTotal Ordering

• aka– Chain, simply ordered set, totally ordered set

• A Partial Ordering for Which All Orderings Are Specified

• A Chain Is “Connected” Because

s s s s s s or , S

Page 15: Equivalence, DFA, NDFA

POSETPOSET

• Partially Ordered SET– A set on which a partial ordering is specified– ( S, ) where is defined– Not a chain since not all elements are

connected

• We Will Revisit This Concept in a later part of the Course

Page 16: Equivalence, DFA, NDFA

Finite AutomataFinite Automata

A Deterministic semi-automaton*, aka Completely Specified Deterministic Semi-automaton Is a Triple

with no Mealy machine output function, Beta ()

* Ginzburg, 1968

,,

or ,,,

ΣK

IS

M

M

Page 17: Equivalence, DFA, NDFA

FSM Set PropertiesFSM Set Properties

,,,,,,,,,

,

inputs ofset finite A,,,,

states ofset finite A,,,,

1210

1210

ihgfedcba

m

n

sississis

S

iiiiI

ssss

ISSIS

KS

SIsa sc

ib

Page 18: Equivalence, DFA, NDFA

Language RecognizerLanguage Recognizer

• aka, Rabin-Scott Automata (machine), Automaton, Language Recognizer

• A Recognizer Is a Quintuple of Sets

with S, I, as before

M rs S I F, , , , s0

s

s sp q

0

the single, unique, initial state

A finite set of final statesF S, ,

Page 19: Equivalence, DFA, NDFA

Kleene StarKleene Star

• a* = e, a, aa, aaa, aaaa, ...

• The Kleene Star, *, means NONE or more occurrences of something

• Star is an overloaded operator so be aware of context

• a+= ONE or more occurrences of something.

• a+ is Kleene Star less the null string, .

Page 20: Equivalence, DFA, NDFA

Kleene ClosureKleene Closure

• Kleene Closure Is Not Identical to Kleene Star– “*” Symbol is the same (overloaded)

• Kleene Closure/Star Closure– Found in descriptions of formal language– Language consisting of all strings over some

alphabet

Page 21: Equivalence, DFA, NDFA

StringString

• An Ordered Concatenation of Symbols From an Alphabet

• Used in Place of “Word” to Decouple From Common Concept of Word in Informal Language

• If = { a, 1, 0, b, % } then a “1%0b” is a string.

Page 22: Equivalence, DFA, NDFA

RecognizerRecognizer

If x I*, i.e., a string of input symbols selected from the set of allowable input symbols,

and the application of x to the recognizer results in a final state F,

then the recognizer “accepts” the string.

Page 23: Equivalence, DFA, NDFA

StringsStrings

A String, x, Is Accepted by a Recognizer Left-most Letter First, i.e.,

if the input to a recognizer is a string w,

and if w = w’

then is the first letter of the string which causes a state

transition. Subsequent letters from left to right do the same.

Page 24: Equivalence, DFA, NDFA

State TransitionState Transition

Let There Be Two Configurations for a Machine

somefor

',',

relation, by the related are which',' and ,

1 ww

iff

wqwq

wqwqM

R,

1

q q’S

Page 25: Equivalence, DFA, NDFA

String ExampleString Example

Let

w = a b b a

then

w = a w’

and

w’ = b b a

Page 26: Equivalence, DFA, NDFA

Recognizer as Directed GraphRecognizer as Directed Graph

• Arbitrary State

• State Transition

• Start (initial) State

• Final State

1

q

q q’

-

+ or

or

Page 27: Equivalence, DFA, NDFA

Let I = { a, b }

• Accepts no strings since no final state

• Accepts all strings

• Dead State

Recognizer ExamplesRecognizer Examples

a, b

-

a, b

a, b

Page 28: Equivalence, DFA, NDFA

Recognizer ExamplesRecognizer Examples

• Accepts only , the null string

a,b

a,b

+/-

Page 29: Equivalence, DFA, NDFA

Recognizer ExampleRecognizer Example

This Recognizer Accepts the Language

L= { ab, a (aa) b, a (aa) (aa) b, ...

ab (bb), ab (bb) (bb), ... }

L = a (aa)* b ( b (aa)* b )*

- a

a

b

b

Page 30: Equivalence, DFA, NDFA

Rabin-Scott ExampleRabin-Scott Example

S

F

1 2 3 4

1

40

, , ,

, , ;I a

s

M rs S I F, , , , s0

ps\input a + ;1 2 3 32 3 1 43 3 3 34 3 3 3

4

Page 31: Equivalence, DFA, NDFA

Rabin-Scott ExampleRabin-Scott Example

L (M) = { x I* |* ( 1, x ) = 4 }

L (M) = { a; , a+a; , a+a+a; , ... }

aa

2

3 4

+

+ ;

;

a + ;

a + ;

1

Page 32: Equivalence, DFA, NDFA

Non-Deterministic FSMNon-Deterministic FSM

A Non-deterministic Finite Automata Is a Quintuple with S, I, s0, F

as in a recognizer, but, M nd S I F, , , , s0

,,,,,,

,,,,,,

functiona not relation,a is

,,* *

jhged

fedcba

sssxs

sxssxs

SISSIS

Page 33: Equivalence, DFA, NDFA

Non-Deterministic FSMNon-Deterministic FSM

• State May Change– to two different states in response to the same

input at the same state– in response to a string rather than just a single

element from the set of inputs– in response to a null string input

Page 34: Equivalence, DFA, NDFA

DFA-NDFA TheoremDFA-NDFA Theorem

• Every NDFA Can Be Replaced by an Equivalent DFA

• Equivalent Means Not Only Accepting All Strings Accepted by the NDFA, but Also NOT Accepting Any Others

Page 35: Equivalence, DFA, NDFA

NDFA ExampleNDFA Example

Non-deterministic Since

( ( 1, a ), 2 ) and ( ( 1, a ), 3 )

1

ab

2

3 4a

b

1

Page 36: Equivalence, DFA, NDFA

NDFA ExampleNDFA Example

Non-deterministic Since Not Completely Specified

ab

4

1

abb

L = ab abb,

Page 37: Equivalence, DFA, NDFA

NDFA ExampleNDFA Example

Non-deterministic Since State Changes in Response to a Null String.

ab

2

3 4a

1

bb

Page 38: Equivalence, DFA, NDFA

NDFA to DFANDFA to DFA

• Theorem– For each NDFA there is an equivalent DFA

• Constructive Proof• 4 Difficulties to Resolve

– Missing transitions– Single transitions due to | strings | > 1– Transitions due to strings– Multiple transitions

Page 39: Equivalence, DFA, NDFA

Problem: Missing TransitionsProblem: Missing Transitions

• I = { a, b }

• In DFA, all i I must be accounted for in each state

a

b ?

Page 40: Equivalence, DFA, NDFA

Solution: Missing TransitionsSolution: Missing Transitions

Add a “sink” state which is not a final state and terminate all missing transitions there.

a

b

a, b

a, b

Page 41: Equivalence, DFA, NDFA

Problem: | strings | > 1Problem: | strings | > 1

• Single transition due to string of size > 1

• Add intermediate states and “sink”, other characters in those states go to “sink” state

a

ab

a, b

b

a

Page 42: Equivalence, DFA, NDFA

Problem: StringsProblem: Strings

Can’t just combine states sincea

ab

a bb

a

b

Page 43: Equivalence, DFA, NDFA

Solution: Strings & Multiple Transitions

Solution: Strings & Multiple Transitions

• Eliminate by defining the set of next states which occur in response to no input, call this function E( )

• E( ) is called the “equivalents of ( )

Page 44: Equivalence, DFA, NDFA

NDFA ExampleNDFA Example

> 1

2

3

4

a b

b a

b

a

Page 45: Equivalence, DFA, NDFA

State EquivalentsState Equivalents

E( 1 ) = {self, explicit alternative} = { 1, 3 }

E( 2 ) = { 2 }

E( 3 ) = { 3 }

E( 4 ) = { 4 }

• Define a new machine based on the old using the E( ) states

Page 46: Equivalence, DFA, NDFA

New MachineNew Machine

E a

E b

E a

E b

E a

E b

E a

E b E E b

1 2 3 4

1 5

2 5

2 3

3 3 4

3 5

4 5

4 1 4 4 1 3 4

, , , ,

, , ,

, ,

, ,

, , ,

, ,

, ,

, , , , , , ,

state 5 is new dead state

Page 47: Equivalence, DFA, NDFA

New Machine Transition TableNew Machine Transition Table

Equivalent

OldState

NewState

Inputa

Inputb

E ( 1 ) { 1, 3 } A { 2,3,4 } = F 5 = EE ( 2 ) 2 B 5 = E 3 = CE ( 3 ) 3 C { 3, 4 } = G 5 = EE ( 4 ) 4 D 5 = E { E( 1 ), 4 }

{ 1, 3, 4 } = H

Page 48: Equivalence, DFA, NDFA

New Machine Transition TableNew Machine Transition Table

Equivalent

Old State

New State

Input a

Input b

E ( 5 ) 5 E 5 = E 5 = E 2, 3, 4 F { 5, 3, 4 } = I { 3, 5, E(1), 4}

{ 1, 3, 4, 5} = J 3, 4 G { 3, 4, 5 } = I { 5, E(1), 4}

{ 1, 3, 4, 5} = J

1, 3, 4 H 2, 3, 4, 5 = L { 5, E(1), 4} { 1, 3, 4, 5} = J

Page 49: Equivalence, DFA, NDFA

New Machine Transition TableNew Machine Transition Table

OldState

NewState

Inputa

Inputb

3, 4, 5 I { 3, 4, 5 } = I { 5, E(1), 4}{ 1, 3, 4, 5} = J

1, 3, 4, 5 J { 2, 3, 4, 5 }= L { 5, E(1), 4}{ 1, 3, 4, 5} = J

2, 3, 4, 5 L { 5, 3, 4 } = I { 3, 5, 4, E(1) }{ 1, 3, 4, 5} = J

Page 50: Equivalence, DFA, NDFA

DFA Equivalent of NDFADFA Equivalent of NDFA

Page 51: Equivalence, DFA, NDFA

Reduced DFA EquivalentReduced DFA Equivalent


Recommended