LectureNotes3

LectureNotes3 - ECS 120 Lesson 3 Finite State Machines, Pt....

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ECS 120 Lesson 3 Finite State Machines, Pt. 2 Oliver Kreylos Wednesday, April 4th, 2001 1 Formal Definition of Finite State Machines As can be seen from the first two examples of Finite State Machines, we have to specify several parts when trying to give a formal definition of one: How many and which states does the automaton have? What characters can the automaton read? How does the automaton move from state to state? Which state does the automaton start in? Which states are final states? These five questions lead directly to the formal definition: A Finite State Machine M is a 5-tuple M = ( Q, , , q , F ), where Q is a finite set of states . is the input alphabet . : Q Q is the transition function . q Q is the initial state . F Q is the set of final states or accepting states . 1 As an example, here is the formal definition for the pushbutton automaton shown last lecture: PB = { On , Off } , { PUSH } , { (On , PUSH ) 7 Off , (Off , PUSH ) 7 On } , Off , { On } The transfer functions of more complicated automata are usually given in tabular form. Here is the formal definition for the doorlock automaton shown last time. For brevity, let us denote the states idle, 3 seen, 31 seen, 314 seen, 3141 seen and wrong key by q , q 1 , q 2 , q 3 , q 4 and q 5 , respec- tively: DL = { q , q 1 , q 2 , q 3 , q 4 , q 5 } , { , 1 , . . . , 9 } , , q , { q 4 } where = 1 2 3 4 5 6 7 8 9 q q 5 q 5 q 5 q 1 q 5 q 5 q 5 q 5 q 5 q 5 q 1 q 5 q 2 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 2 q 5 q 5 q 5 q 5 q 3 q 5 q 5 q 5 q 5 q 5 q 3 q 5 q 4 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 4 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 5 q 5 As another example, let us consider an automaton that reads an integer in binary notation (as a word over the alphabet { , 1 } ) and has to decide whether that integer is divisible by three. In other words, we consider an automaton D3 that accepts the language L (D3) = w { , 1 } * The integer represented by w is divisible by 3 . Figure 1 shows the automaton as a state diagram. Here is the formal description of the automaton: D3 = { q , q 1 , q 2 } , { , 1 } , , q , { q } where = 1 q q q 1 q 1 q 2 q q 2 q 1 q 2 How did we come up with this automaton? First, we have to look at the problem from an automatons point of view. As programmers, we tendthe problem from an automatons point of view....
View Full Document

This note was uploaded on 05/20/2010 for the course ECS 120 taught by Professor Filkov during the Spring '07 term at UC Davis.

Page1 / 6

LectureNotes3 - ECS 120 Lesson 3 Finite State Machines, Pt....

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online