lecture 23: finite state machines with no outputs acceptors & recognizers
TRANSCRIPT
![Page 1: Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers](https://reader036.vdocuments.site/reader036/viewer/2022082422/56649e9e5503460f94ba0454/html5/thumbnails/1.jpg)
Lecture 23:
Finite State Machines with no Outputs
Acceptors & Recognizers
![Page 2: Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers](https://reader036.vdocuments.site/reader036/viewer/2022082422/56649e9e5503460f94ba0454/html5/thumbnails/2.jpg)
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 = rightL = leftU = upD = down
![Page 3: Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers](https://reader036.vdocuments.site/reader036/viewer/2022082422/56649e9e5503460f94ba0454/html5/thumbnails/3.jpg)
Definition of a Finite State Machine - 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.
Formal Definition
![Page 4: Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers](https://reader036.vdocuments.site/reader036/viewer/2022082422/56649e9e5503460f94ba0454/html5/thumbnails/4.jpg)
Q = {1, 2, 3, 4, 5, 6}
q0 = 1 (start state)
= {U, D, L, R}
F = {6}
An Example
![Page 5: Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers](https://reader036.vdocuments.site/reader036/viewer/2022082422/56649e9e5503460f94ba0454/html5/thumbnails/5.jpg)
An FSM to Recognize (Accept) Integers
Valid Integers Not an Integer 123 123.456 123456 12+345 -543 Hello There 9 9 3 5
![Page 6: Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers](https://reader036.vdocuments.site/reader036/viewer/2022082422/56649e9e5503460f94ba0454/html5/thumbnails/6.jpg)
How to Implement an FSM in a Computer Program
![Page 7: Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers](https://reader036.vdocuments.site/reader036/viewer/2022082422/56649e9e5503460f94ba0454/html5/thumbnails/7.jpg)
Example Binary String Recognizeraccepts 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
![Page 8: Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers](https://reader036.vdocuments.site/reader036/viewer/2022082422/56649e9e5503460f94ba0454/html5/thumbnails/8.jpg)
Example Binary String Recognizeraccepts 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
![Page 9: Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers](https://reader036.vdocuments.site/reader036/viewer/2022082422/56649e9e5503460f94ba0454/html5/thumbnails/9.jpg)
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.
![Page 10: Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers](https://reader036.vdocuments.site/reader036/viewer/2022082422/56649e9e5503460f94ba0454/html5/thumbnails/10.jpg)
Accepting Binary Encoded Valuesdivisible by four
![Page 11: Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers](https://reader036.vdocuments.site/reader036/viewer/2022082422/56649e9e5503460f94ba0454/html5/thumbnails/11.jpg)
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
![Page 12: Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers](https://reader036.vdocuments.site/reader036/viewer/2022082422/56649e9e5503460f94ba0454/html5/thumbnails/12.jpg)
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.
![Page 13: Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers](https://reader036.vdocuments.site/reader036/viewer/2022082422/56649e9e5503460f94ba0454/html5/thumbnails/13.jpg)
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
FSM for Recognizing Binary Palindromes
![Page 14: Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers](https://reader036.vdocuments.site/reader036/viewer/2022082422/56649e9e5503460f94ba0454/html5/thumbnails/14.jpg)
Describe the Language Recognized by this FSM