{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

MATH 245 CH6 - DISCRETE MATHEMATICS W W L CHEN c W W L Chen...

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

View Full Document Right Arrow Icon
DISCRETE MATHEMATICS W W L CHEN c W W L Chen, 1991, 2008. This chapter is available free to all individuals, on the understanding that it is not to be used for financial gain, and may be downloaded and/or photocopied, with or without permission from the author. However, this document may not be kept on any information storage and retrieval system without permission from the author, unless such system is not accessible to any individuals other than its owners. Chapter 6 FINITE STATE MACHINES 6.1. Introduction Example 6.1.1. Imagine that we have a very simple machine which will perform addition and multi- plication of numbers from the set { 1 , 2 } and give us the answer, and suppose that we ask the machine to calculate 1 + 2. The table below gives an indication of the order of events: TIME t 1 t 2 t 3 t 4 STATE (1) s 1 (4) s 2 [1] (7) s 3 [1 , 2] (10) s 1 INPUT (2) 1 (5) 2 (8) + OUTPUT (3) nothing (6) nothing (9) 3 Here t 1 < t 2 < t 3 < t 4 denotes time. We explain the table a little further: (1) The machine is in a state s 1 of readiness. (2) We input the number 1. (3) There is as yet no output. (4) The machine is in a state s 2 (it has stored the number 1). (5) We input the number 2. (6) There is as yet no output. (7) The machine is in a state s 3 (it has stored the numbers 1 and 2). (8) We input the operation +. (9) The machine gives the answer 3. (10) The machine returns to the state s 1 of readiness. Note that this machine has only a finite number of possible states. It is either in the state s 1 of readiness, or in a state where it has some, but not all, of the necessary information for it to perform its task. On the other hand, there are only a finite number of possible inputs, namely the numbers 1, 2 and the operations + and × . Also, there are only a finite number of outputs, namely nothing, “junk” (when Chapter 6 : Finite State Machines page 1 of 21
Image of page 1

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

View Full Document Right Arrow Icon
Discrete Mathematics c W W L Chen, 1991, 2008 incorrect input is made) or the right answers. If we investigate this simple machine a little further, then we will note that there are two little tasks that it performs every time we input some information: Depending on the state of the machine and the input, the machine gives an output. Depending on the state of the machine and the input, the machine moves to the next state. Definition. A finite state machine is a 6-tuple M = ( S , I , O , ω, ν, s 1 ), where (a) S is the finite set of states for M ; (b) I is the finite input alphabet for M ; (c) O is the finite output alphabet for M ; (d) ω : S × I → O is the output function; (e) ν : S × I → S is the next-state function; and (f) s 1 ∈ S is the starting state. Example 6.1.2. Consider again our simple finite state machine described earlier. Suppose that when the machine recognizes incorrect input ( e.g. three numbers or two operations), it gives the output “junk” and then returns to the initial state s 1 . It is clear that I = { 1 , 2 , + , ×} and O = { j, n, 1 , 2 , 3 , 4 } , where j denotes the output “junk” and n denotes no output. We can see that S = { s 1 , [1] , [2] , [+] , [ × ] , [1 , 1] , [1 , 2] , [1 , +] , [1 , × ] , [2 , 2] , [2 , +] , [2 , × ] } , where s 1 denotes the initial state of readiness and the entries between the signs [ and ] denote the information in memory. The output function
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern