computing machinery chapter 4: finite state machines
DESCRIPTION
Computing Machinery Chapter 4: Finite State Machines. Introduction to Finite State Machines. U - Up D - Down L - Left R - Right. Definition of a Finite State Machine. Formally, a finite Automaton (FA) is defined as a 5-tuple (Q, S , d , q 0 , F) where, - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/1.jpg)
Computing Machinery
Chapter 4: Finite State Machines
![Page 2: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/2.jpg)
U - UpD - DownL - LeftR - Right
Introduction to Finite State Machines
![Page 3: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/3.jpg)
Formally, a finite Automaton (FA) is defined as a 5-tuple (Q, , , q0, F) where, (1) Q is a finite set of states.
(2) is a finite set of symbols or the alphabet.
(3) : Q x -> Q is the transition function
(4) q0 is an element of Q called the start state, and
(5) F is a subset of Q called the set of accept states.
Definition of a Finite State Machine
![Page 4: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/4.jpg)
Example: Maze FSM
![Page 5: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/5.jpg)
Moore Machine
![Page 6: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/6.jpg)
Example: Moore Machine
input: X Y Z X X Z Y X Z Y Y Zoutput: B A A B A A A A A A A A
![Page 7: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/7.jpg)
Mealy Machine
![Page 8: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/8.jpg)
Integer String RecognizerBuild a finite state machine that can be used to recognize character string representations of integer values.
Valid Integers Not Integers 123 123.456 123456 12+345 -543 Hello There 9 9 3 5
![Page 9: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/9.jpg)
Integer String Recognizer Design
![Page 10: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/10.jpg)
01010000 reject01001110 accept0111 accept110000 reject
FSM that accepts strings containing at least three 1's
FSM that accepts strings containing at least three consecutive 1's
0000110011001100 reject0001110000000000 accept1010101010000000 reject11111111 accept
Substring Detectors
![Page 11: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/11.jpg)
Building a Bit String Recognizerdetect bit string "1101"
![Page 12: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/12.jpg)
Moore Machine: Bit String Recognizer ("1101")Sometimes we need to decide whether overlapping substrings are accepted
![Page 13: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/13.jpg)
Mealy Machine: Bit String Recognizer ("1101")
1101101101101101101
![Page 14: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/14.jpg)
FSM to Recognize if a Binary Encoded Value is Divisible by Four
![Page 15: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/15.jpg)
Parity Testercounting 0's and counting 1's
![Page 16: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/16.jpg)
Recognizing Binary Strings with the Same Number of 1's and 0's.
![Page 17: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/17.jpg)
A Partial FSM to Recognize Palindromesbinary strings
![Page 18: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/18.jpg)
Detecting Binary Encoded Values Divisible by Three
00000000010001000011001000010100110001110100001001010100101101100011010111001111
Consider the substrings that leave you in the same state regardless of which state you are in when the substring is encountered
Such substrings can be removed from the candidate string without affecting the final state. The substrings '11', '00' and '1001' are three such "reducible" substrings.
Reduce the following string by removing these substrings.
11011010000000001111000100010010011010
11011010000000001111000100010010011010
0010001010
101010 yes
![Page 19: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/19.jpg)
![Page 20: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/20.jpg)
![Page 21: Computing Machinery Chapter 4: Finite State Machines](https://reader033.vdocuments.site/reader033/viewer/2022051019/5681595d550346895dc69b79/html5/thumbnails/21.jpg)