1 / 21

Computing Machinery Chapter 4: Finite State Machines

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,

nicola
Download Presentation

Computing Machinery Chapter 4: Finite State Machines

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computing Machinery Chapter 4: Finite State Machines

  2. Introduction to Finite State Machines U - Up D - Down L - Left R - Right

  3. Definition of a Finite State Machine Formally, a finite Automaton (FA) is defined as a 5-tuple (Q, S, d, q0, F) where, (1) Q is a finite set of states. (2) S is a finite set of symbols or the alphabet. (3) d: Q x S -> 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.

  4. Example: Maze FSM

  5. Moore Machine

  6. input: X Y Z X X Z Y X Z Y Y Z output: B A A B A A A A A A A A Example: Moore Machine

  7. Mealy Machine

  8. Integer String Recognizer Build a finite state machine that can be used to recognize character string representations of integer values. Valid IntegersNot Integers 123 123.456 123456 12+345 -543 Hello There 9 9 3 5

  9. Integer String Recognizer Design

  10. Substring Detectors 01010000 reject 01001110 accept 0111 accept 110000 reject FSM that accepts strings containing at least three 1's 0000110011001100 reject 0001110000000000 accept 1010101010000000 reject 11111111 accept FSM that accepts strings containing at least three consecutive 1's

  11. Building a Bit String Recognizer detect bit string "1101"

  12. Moore Machine: Bit String Recognizer ("1101") Sometimes we need to decide whether overlapping substrings are accepted

  13. Mealy Machine: Bit String Recognizer ("1101") 1101101101101101101

  14. FSM to Recognize if a Binary Encoded Value is Divisible by Four

  15. Parity Tester counting 0's and counting 1's

  16. Recognizing Binary Strings with the Same Number of 1's and 0's.

  17. A Partial FSM to Recognize Palindromes binary strings

  18. Detecting Binary Encoded Values Divisible by Three 00000 00001 00010 00011 00100 00101 00110 00111 0100001001 01010 01011 01100 01101 01110 01111 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 yes 101010

More Related