















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
















PIR AMAD ALI SHAH
COMSATS I.I.T, SAHIWAL
Finite Automaton with Output… Chapter 8
Moore and Mealy Machines… Chapter 8
Theory of Automata & Formal Languages (CSC-307) - Week 8, Lecture 1 2
A Moore machine consists of the following
Theory of Automata & Formal Languages (CSC-307) - Week 8, Lecture 1
Theory of Automata & Formal Languages (CSC-307) - Week 8, Lecture 1
Consider the following Moore machine having the states q 0 , q 1 , q 2 , q 3 where q 0 is the start state and
Theory of Automata & Formal Languages (CSC-307) - Week 8, Lecture 1
Old States
New States after reading a b
q 0 - q 1 q 3
q 1 q 3 q 1
q 2 q 0 q 3
Characters to be printed
Theory of Automata & Formal Languages (CSC-307) - Week 8, Lecture 1
It is to be noted that the states are labeled along with the characters to be printed. Running the string abbabbba over the above machine, the corresponding output string will be 100010101, which can be determined by the following table as well
a
b
b
q^ a 0 /
a
b
q 1 /
q 2 /0 q 3 /1^ a
b
Theory of Automata & Formal Languages (CSC-307) - Week 8, Lecture 1
output 1 0 0 0 1 0 1 0 1
State^ q 0 q 1 q 1 q 1 q 3 q 2 q 3 q 2 q 0
Input a b b a b b b a
It may be noted that the length of output string is l more than that of input string as the initial state prints out the extra character 1, before the input string is read. Theory of Automata & Formal Languages (CSC-307) - Week 8, Lecture 1
Example continued …
output 0 0 0 0 1 0 0 0 0 0 1 0
State^ q 0 q 1 q 2 q 2 q 3 q 1 q 0 q 0 q 1 q 2 q 3 q 0
Input b b b a b a a b b a a
if the string bbbabaabbaa is run, the output string will be 000010000010, as shown below
Theory of Automata & Formal Languages (CSC-307) - Week 8, Lecture 1
14
It can be observed from the given Moore machine that q 3 is the only state which prints out the character 1 which shows that the moment the state q 3 is entered, the machine will print out 1. To enter the state q 3 , starting from q 0 the string must contain bba. It can also be observed that to enter the state q 3 once more the string must contain another substirng bba. In general the input string will visit the state q 3 as many times as the number of substring bba occurs in the input string. Thus the number of 1’s in an output string will be same as the number of substring bba occurs in the corresponding input string. (^) Theory of Automata & Formal Languages (CSC-307) - Week 8, Lecture 1
Theory of Automata & Formal Languages (CSC-307) - Week 8, Lecture 1
Theory of Automata & Formal Languages (CSC-307) - Week 8, Lecture 1
(^) Running the string abbabbba over the above machine, the corresponding output string will be 11011010, which can be determined by the following table as well
a/
b/
a/
q 1
a/
q 2
q 0^ b/0 q 3 a/
b/
b/
Theory of Automata & Formal Languages (CSC-307) - Week 8, Lecture 1
output 0 1 1 1 1 0 1 0
States^ q 0 q 1 q 2 q 3 q 3 q 0 q 3 q 0 q 1
Input a b b a b b b a
Theory of Automata & Formal Languages (CSC-307) - Week 8, Lecture 1