Finite Automata Fall 2004 COMP 335 1 Finite

  • Slides: 57
Download presentation
Finite Automata Fall 2004 COMP 335 1

Finite Automata Fall 2004 COMP 335 1

Finite Automaton Input String Output Finite Automaton Fall 2004 COMP 335 String 2

Finite Automaton Input String Output Finite Automaton Fall 2004 COMP 335 String 2

Finite Accepter Input String Output Finite Automaton Fall 2004 COMP 335 “Accept” or “Reject”

Finite Accepter Input String Output Finite Automaton Fall 2004 COMP 335 “Accept” or “Reject” 3

Transition Graph abba - Finite Accepter initial state Fall 2004 transition COMP 335 final

Transition Graph abba - Finite Accepter initial state Fall 2004 transition COMP 335 final state “accept” 4

Initial Configuration Input String Fall 2004 COMP 335 5

Initial Configuration Input String Fall 2004 COMP 335 5

Reading the Input Fall 2004 COMP 335 6

Reading the Input Fall 2004 COMP 335 6

Fall 2004 COMP 335 7

Fall 2004 COMP 335 7

Fall 2004 COMP 335 8

Fall 2004 COMP 335 8

Fall 2004 COMP 335 9

Fall 2004 COMP 335 9

Input finished Output: “accept” Fall 2004 COMP 335 10

Input finished Output: “accept” Fall 2004 COMP 335 10

Rejection Fall 2004 COMP 335 11

Rejection Fall 2004 COMP 335 11

Fall 2004 COMP 335 12

Fall 2004 COMP 335 12

Fall 2004 COMP 335 13

Fall 2004 COMP 335 13

Fall 2004 COMP 335 14

Fall 2004 COMP 335 14

Input finished Output: “reject” Fall 2004 COMP 335 15

Input finished Output: “reject” Fall 2004 COMP 335 15

Another Rejection Fall 2004 COMP 335 16

Another Rejection Fall 2004 COMP 335 16

Output: Fall 2004 “reject” COMP 335 17

Output: Fall 2004 “reject” COMP 335 17

Another Example Fall 2004 COMP 335 18

Another Example Fall 2004 COMP 335 18

Fall 2004 COMP 335 19

Fall 2004 COMP 335 19

Fall 2004 COMP 335 20

Fall 2004 COMP 335 20

Fall 2004 COMP 335 21

Fall 2004 COMP 335 21

Input finished Output: “accept” Fall 2004 COMP 335 22

Input finished Output: “accept” Fall 2004 COMP 335 22

Rejection Fall 2004 COMP 335 23

Rejection Fall 2004 COMP 335 23

Fall 2004 COMP 335 24

Fall 2004 COMP 335 24

Fall 2004 COMP 335 25

Fall 2004 COMP 335 25

Fall 2004 COMP 335 26

Fall 2004 COMP 335 26

Input finished Output: “reject” Fall 2004 COMP 335 27

Input finished Output: “reject” Fall 2004 COMP 335 27

Formalities Deterministic Finite Accepter (DFA) : (A finite) set of states : (A finite)

Formalities Deterministic Finite Accepter (DFA) : (A finite) set of states : (A finite) set of input alphabet : transition function : initial state (an element of Q) : set of final states (a subset of Q) Fall 2004 COMP 335 28

Input Alphabet Fall 2004 COMP 335 29

Input Alphabet Fall 2004 COMP 335 29

Set of States Fall 2004 COMP 335 30

Set of States Fall 2004 COMP 335 30

Initial State Fall 2004 COMP 335 31

Initial State Fall 2004 COMP 335 31

Set of Final States Fall 2004 COMP 335 32

Set of Final States Fall 2004 COMP 335 32

Transition Function Fall 2004 COMP 335 33

Transition Function 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

Fall 2004 COMP 335 36

Fall 2004 COMP 335 36

Transition Function Fall 2004 COMP 335 37

Transition Function Fall 2004 COMP 335 37

Extended Transition Function Fall 2004 COMP 335 38

Extended Transition Function Fall 2004 COMP 335 38

Fall 2004 COMP 335 39

Fall 2004 COMP 335 39

Fall 2004 COMP 335 40

Fall 2004 COMP 335 40

Fall 2004 COMP 335 41

Fall 2004 COMP 335 41

Observation: There is a walk from with label Fall 2004 COMP 335 to 42

Observation: There is a walk from with label Fall 2004 COMP 335 to 42

Example: There is a walk from with label Fall 2004 COMP 335 to 43

Example: There is a walk from with label Fall 2004 COMP 335 to 43

Recursive Definition Fall 2004 COMP 335 44

Recursive Definition Fall 2004 COMP 335 44

Fall 2004 COMP 335 45

Fall 2004 COMP 335 45

Languages Accepted by DFAs Take DFA Definition: The language contains all input strings accepted

Languages Accepted by DFAs Take DFA Definition: The language contains all input strings accepted by = { strings that drive Fall 2004 COMP 335 to a final state} 46

Example accept Fall 2004 COMP 335 47

Example accept Fall 2004 COMP 335 47

Another Example accept Fall 2004 accept COMP 335 accept 48

Another Example accept Fall 2004 accept COMP 335 accept 48

Formally For a DFA Language accepted by Fall 2004 : COMP 335 49

Formally For a DFA Language accepted by Fall 2004 : COMP 335 49

Observation Language rejected by Fall 2004 : COMP 335 50

Observation Language rejected by Fall 2004 : COMP 335 50

More Examples accept Fall 2004 COMP 335 trap state 51

More Examples accept Fall 2004 COMP 335 trap state 51

= { all strings with prefix } accept Fall 2004 COMP 335 52

= { all strings with prefix } accept Fall 2004 COMP 335 52

= { all strings without substring } Fall 2004 COMP 335 53

= { all strings without substring } Fall 2004 COMP 335 53

Regular Languages A language is regular if there is a DFA such that All

Regular Languages A language is regular if there is a DFA such that All regular languages form a language family Fall 2004 COMP 335 54

Examples of regular languages: { all strings with prefix } { all strings with

Examples of regular languages: { all strings with prefix } { all strings with suffix } { all strings without substring } There exist automata that accept these Languages (see previous slides). Fall 2004 COMP 335 55

Another Example The language is regular: Fall 2004 COMP 335 56

Another Example The language is regular: Fall 2004 COMP 335 56

There exist languages which are not Regular: Example: There is no DFA that accepts

There exist languages which are not Regular: Example: There is no DFA that accepts such a language (we will prove this later!) Fall 2004 COMP 335 57