1 / 14

Lecture 23:

Lecture 23:. Finite State Machines with no Outputs Acceptors & Recognizers. Introduction. Finite State Machines (FSMs) are theoretical models of computational systems. Finite state machines, also called finite automata , are used in the study of the theory of computation. R = right

lexi
Download Presentation

Lecture 23:

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. Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers

  2. Introduction Finite State Machines (FSMs) are theoretical models of computational systems.Finite state machines, also called finite automata, are used in the study of the theory of computation. R = right L = left U = up D = down

  3. Formal Definition • 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. An Example Q = {1, 2, 3, 4, 5, 6} q0 = 1 (start state) S = {U, D, L, R} F = {6}

  5. An FSM to Recognize (Accept) Integers • Valid IntegersNot an Integer • 123 123.456 • 123456 12+345 • -543 Hello There • 9 9 3 5

  6. How to Implement an FSM in a Computer Program

  7. Example Binary String Recognizer accepts strings containing at least three 1's • The double circle indicates the accept state, the start state is labeled (0), and the transitions between states are labeled according the input symbol currently being read. The binary strings below, are accepted or rejected as indicated, • 01010000 reject • 01001110 accept • 0111 accept • 110000 reject

  8. Example Binary String Recognizer accepts strings containing three consecutive 1's • Applying this FSM to the sample binary strings listed below gives the indicated results. • 0000110011001100 reject • 0001110000000000 accept • 1010101010000000 reject • 11111111 accept

  9. Building Finite State Machines Consider an FSM that accepts (or recognizes) strings containing the substring "1101". We create a start state and a state for each bit in the substring for which we are searching.

  10. Accepting Binary Encoded Values divisible by four

  11. Dual Parity Tester We can check the parity of 1's or 0's or both in a binary value using an FSM. In this example, we want an FSM that accepts binary strings with an even number of 0's and an even number of 1's. The start state is an accept state since the empty string has zero 0's and zero 1's (and zero is even).

  12. Computational Limits of Finite State Machines Counting 1's and 0's - Consider the design of an FSM that accepts all binary strings that have an equal number of 1's and 0's. At first this may seem to be a relatively simple problem; however, we need to deal with the possibility that the count of the number of 1's or 0's could grow without bound. We can produce a partial FSM for recognizing binary strings with the same number of 1's and 0's, but a consecutive number of 1's or 0's could occur which would exceed any finit number of states in the FSM.

  13. FSM for Recognizing Binary Palindromes In our example problem, we want to design an FSM that accepts all binary strings that have the same sequence of 1's and 0's when read either left-to-right or right-to-left. Again, we are limited by the fact that an input string can be arbitrarily long. In this case however, the FSM is impractical even for strings of finite length. For binary strings of maximum length Nmax, our palindromic binary string recognizer uses 2Nmax+1-1 states

  14. Describe the Language Recognized by this FSM

More Related