Download presentation
Presentation is loading. Please wait.
Published byAshley Lester Modified over 9 years ago
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
Definition of a Finite State Machine - Formally, a finite Automaton (FA) is defined as a 5-tuple (Q, , , q 0, 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) q 0 is an element of Q called the start state, and (5) F is a subset of Q called the set of accept states. Formal Definition
4
Q = {1, 2, 3, 4, 5, 6} q 0 = 1 (start state) = {U, D, L, R} F = {6} An Example
5
An FSM to Recognize (Accept) Integers Valid Integers Not 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, 01010000reject 01001110accept 0111accept 110000reject
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. 0000110011001100reject 0001110000000000accept 1010101010000000reject 11111111accept
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
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). Dual Parity Tester
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
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 2 Nmax+1 -1 states FSM for Recognizing Binary Palindromes
14
Describe the Language Recognized by this FSM
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.