Non Deterministic Automata Fall 2004 COMP 335 1

  • Slides: 58
Download presentation
Non Deterministic Automata Fall 2004 COMP 335 1

Non Deterministic Automata Fall 2004 COMP 335 1

Nondeterministic Finite Accepter (NFA) Alphabet = Fall 2004 COMP 335 2

Nondeterministic Finite Accepter (NFA) Alphabet = Fall 2004 COMP 335 2

Nondeterministic Finite Accepter (NFA) Alphabet = Two choices Fall 2004 COMP 335 3

Nondeterministic Finite Accepter (NFA) Alphabet = Two choices Fall 2004 COMP 335 3

Nondeterministic Finite Accepter (NFA) Alphabet = Two choices No transition Fall 2004 COMP 335

Nondeterministic Finite Accepter (NFA) Alphabet = Two choices No transition Fall 2004 COMP 335 4

First Choice Fall 2004 COMP 335 5

First Choice Fall 2004 COMP 335 5

First Choice Fall 2004 COMP 335 6

First Choice Fall 2004 COMP 335 6

First Choice Fall 2004 COMP 335 7

First Choice Fall 2004 COMP 335 7

First Choice All input is consumed “accept” Fall 2004 COMP 335 8

First Choice All input is consumed “accept” Fall 2004 COMP 335 8

Second Choice Fall 2004 COMP 335 9

Second Choice Fall 2004 COMP 335 9

Second Choice Fall 2004 COMP 335 10

Second Choice Fall 2004 COMP 335 10

Second Choice No transition: the automaton hangs Fall 2004 COMP 335 11

Second Choice No transition: the automaton hangs Fall 2004 COMP 335 11

Second Choice Input cannot be consumed “reject” Fall 2004 COMP 335 12

Second Choice Input cannot be consumed “reject” Fall 2004 COMP 335 12

An NFA accepts a string w: if there is at least one computation of

An NFA accepts a string w: if there is at least one computation of the NFA that accepts the string w AND all the input is consumed and the automaton is in a final state Fall 2004 COMP 335 13

Example is accepted by the NFA: “accept” because this computation accepts Fall 2004 “reject”

Example is accepted by the NFA: “accept” because this computation accepts Fall 2004 “reject” COMP 335 14

Rejection example Fall 2004 COMP 335 15

Rejection example Fall 2004 COMP 335 15

First Choice Fall 2004 COMP 335 16

First Choice Fall 2004 COMP 335 16

First Choice “reject” Fall 2004 COMP 335 17

First Choice “reject” Fall 2004 COMP 335 17

Second Choice Fall 2004 COMP 335 18

Second Choice Fall 2004 COMP 335 18

Second Choice Fall 2004 COMP 335 19

Second Choice Fall 2004 COMP 335 19

Second Choice “reject” Fall 2004 COMP 335 20

Second Choice “reject” Fall 2004 COMP 335 20

An NFA rejects a string w: if there is no computation of the NFA

An NFA rejects a string w: if there is no computation of the NFA that accepts the string w: • All the input is consumed and the automaton is in a non final state OR • The input cannot be consumed Fall 2004 COMP 335 21

Example is rejected by the NFA: “reject” All possible computations lead to rejection Fall

Example is rejected by the NFA: “reject” All possible computations lead to rejection Fall 2004 COMP 335 22

Rejection example Fall 2004 COMP 335 23

Rejection example Fall 2004 COMP 335 23

First Choice Fall 2004 COMP 335 24

First Choice Fall 2004 COMP 335 24

First Choice No transition: the automaton hangs Fall 2004 COMP 335 25

First Choice No transition: the automaton hangs Fall 2004 COMP 335 25

First Choice Input cannot be consumed “reject” Fall 2004 COMP 335 26

First Choice Input cannot be consumed “reject” Fall 2004 COMP 335 26

Second Choice Fall 2004 COMP 335 27

Second Choice Fall 2004 COMP 335 27

Second Choice Fall 2004 COMP 335 28

Second Choice Fall 2004 COMP 335 28

Second Choice No transition: the automaton hangs Fall 2004 COMP 335 29

Second Choice No transition: the automaton hangs Fall 2004 COMP 335 29

Second Choice Input cannot be consumed “reject” Fall 2004 COMP 335 30

Second Choice Input cannot be consumed “reject” Fall 2004 COMP 335 30

is rejected by the NFA: “reject” All possible computations lead to rejection Fall 2004

is rejected by the NFA: “reject” All possible computations lead to rejection Fall 2004 COMP 335 31

Language accepted: Fall 2004 COMP 335 32

Language accepted: Fall 2004 COMP 335 32

Lambda Transitions Fall 2004 COMP 335 33

Lambda Transitions Fall 2004 COMP 335 33

Fall 2004 COMP 335 34

Fall 2004 COMP 335 34

Fall 2004 COMP 335 35

Fall 2004 COMP 335 35

(read head does not move) Fall 2004 COMP 335 36

(read head does not move) Fall 2004 COMP 335 36

Fall 2004 COMP 335 37

Fall 2004 COMP 335 37

all input is consumed “accept” String Fall 2004 is accepted COMP 335 38

all input is consumed “accept” String Fall 2004 is accepted COMP 335 38

Rejection Example Fall 2004 COMP 335 39

Rejection Example Fall 2004 COMP 335 39

Fall 2004 COMP 335 40

Fall 2004 COMP 335 40

(read head doesn’t move) Fall 2004 COMP 335 41

(read head doesn’t move) Fall 2004 COMP 335 41

No transition: the automaton hangs Fall 2004 COMP 335 42

No transition: the automaton hangs Fall 2004 COMP 335 42

Input cannot be consumed “reject” String Fall 2004 is rejected COMP 335 43

Input cannot be consumed “reject” String Fall 2004 is rejected COMP 335 43

Language accepted: Fall 2004 COMP 335 44

Language accepted: Fall 2004 COMP 335 44

Another NFA Example Fall 2004 COMP 335 45

Another NFA Example Fall 2004 COMP 335 45

Fall 2004 COMP 335 46

Fall 2004 COMP 335 46

Fall 2004 COMP 335 47

Fall 2004 COMP 335 47

Fall 2004 COMP 335 48

Fall 2004 COMP 335 48

“accept” Fall 2004 COMP 335 49

“accept” Fall 2004 COMP 335 49

Another String Fall 2004 COMP 335 50

Another String Fall 2004 COMP 335 50

Fall 2004 COMP 335 51

Fall 2004 COMP 335 51

Fall 2004 COMP 335 52

Fall 2004 COMP 335 52

Fall 2004 COMP 335 53

Fall 2004 COMP 335 53

Fall 2004 COMP 335 54

Fall 2004 COMP 335 54

Fall 2004 COMP 335 55

Fall 2004 COMP 335 55

Fall 2004 COMP 335 56

Fall 2004 COMP 335 56

“accept” Fall 2004 COMP 335 57

“accept” Fall 2004 COMP 335 57

Language accepted Fall 2004 COMP 335 58

Language accepted Fall 2004 COMP 335 58