CSI 3104 Introduction To Formal Languages Winter 2020 Assignment 4
CSI 3104 Introduction To Formal Languages Winter 2020 Assignment 4
Winter 2020
Assignment 4
Assigned February 8, due Friday, March 6 at 12:00 (noon)
1. Let Σ = {0, 1} and let Γ = {0, 1, 2, 3, 4, 5, 6, 7, #}. Construct a Mealy machine that
considers the input as a binary number and outputs the number in octal format (base 8)
with 2 occurrences of # between each octal digit. For example, if the input is 100110, the
output is ##4##6. Assume that the length of the input word is always divisible by 3.
For example, if the input is 010110, the output is ##2##6.
2. Let Σ = {0, 1} and let Γ = {0, 1}. Construct a Moore machine such that the output string
ends in 1 if the total number of occurrences of 1 in the input word is divisible by 3, and
ends in 0 if the total number of occurrences of 1 in the input word is not divisible by 3.
(The rest of the output is ignored.)
a/0
a/0
q0 q1
b/0
b/1
(a) Describe (in English phrases) what this Mealy machine is computing.
(b) Convert this Mealy machine into a Moore machine.
(c) For input baba, what is the output of the original Mealy machine?
(d) For input baba, what is the output of your Moore machine?
5. Let Σ = {a, b, c}. Let L be the language of all words containing any string s of a’s and b’s
followed by a number of c’s equal to length(s).
L = {(a + b)n cn | n ≥ 1} = {ac, bc, aacc, abcc, bacc, bbcc, aaaccc, aabccc, abaccc, . . .}
Prove that L is nonregular by using the first version of the pumping lemma (Theorem 13).