CS605 - Mathematics and Theory of Computer Science
Maynooth University Department of Computer Science
T Naughton, MU
Back to CS605 home
Laboratory sheet - Finite automaton emulator
This lab sheet introduces an emulator for finite automata. We will use Paul Ming's Perl-based Virtual Turing Machine adapted for deterministic finite automata.
This lab sheet contains two examples, followed by a list of machines that you must construct yourself.
Q\ | a b
-----------
00 | 99 00
99 | 99 00
which could be formatted equivalently as follows by writing each transition on a separate row:
Q | | d(Q,
)
---------------
00 | a | 99
00 | b | 00
99 | a | 99
99 | b | 00
Simulate this machine with the VFA by using the following steps.
00, a, 99
00, b, 00
99, a, 99
99, b, 00
Note, as a convention, let's label all accepting states 99,98,97,...,90 (even if the start state is an accepting state). This way it will be instantly possible to tell if the FA has accepted the word or not.
Q\ | 0 1
-----------
00 | 01 99
01 | 01 01
99 | 99 99
which can be reformatted for the VFA as:
00, 0, 01
00, 1, 99
01, 0, 01
01, 1, 01
99, 0, 99
99, 1, 99
Paste it into the emulator and satisfy yourself that it works.
Machine 1.1 Construct a FA that accepts the language L = {w : w{a,b}*, w contains the substring aa}.
Machine 1.2 Construct a FA that accepts the language L = {w : w{0,1}*, w contains no 0s}.
Machine 1.3 Construct a FA that accepts the language L = {w : w{0,1}*, w does not begin with a 1}.
Machine 1.4 Construct a FA that accepts the language L = {w : w {a, b}*, w contains the substring baa but does not contain it at the very beginning of the word}.
Machine 1.5 Construct a FA that accepts the language L = {w : w {0,1}*, w contains at least one 0, w contains an even number of 1s}. Note: zero is an even number.
Machine 1.6 Construct a FA that accepts the language L = {w : w{a,b}*, w does not begin with ab}.
Machine 1.7 Construct a FA that accepts the language L = {w : w {a,b}*, w ends with the substring baa}.
Machine 1.8 Construct a FA that accepts the language defined by the regular expression (1 0)0*.
Machine 1.9 Let = {0, 1}. Construct a FA that accepts the language defined by the regular expression {}
e
.
Machine 1.10 Let = {0, 1}. Construct a FA that accepts the language defined by the regular expression
(0
11
111)*
*.
Machine 1.11 Let = {a, b}. Construct a FA that accepts the language defined by the regular expression e
(a
*a)
(b
*b).