Professional Documents
Culture Documents
Atfl Tutorial Work Book 2022
Atfl Tutorial Work Book 2022
TUTORIAL WORKBOOK
Contents
2
Tutorial—1 : Finite Automata with Output—Mealy and Moore Machines
1.1 Construct a Mealy machine M that takes as input strings of 0’s and 1’s. Its output is to be
a string of 0’s until the first 1 occurs in the input, at which time it will switch to printing 1’s.
This is to continue until the next 1 is encountered in the input, when the output reverts to 0.
The alternation continues every time a 1 is encountered. For example, FM (0010010) =
0011100.
1.2 Convert the Mealy machine constructed in 1.1 to its equivalent Moore Machine.
3
Tutorial—2: Minimization of DFA
2.1 Find minimal dfa's for the following languages. In each case prove that the result is
minimal.
(c)L={an :n≥0,n≠3}.
2.2 Minimize the states in the dfa depicted in the following diagram.
4
Tutorial—3: NFA, DFA and Regular Expressions
3.1 For each of the languages below, over the alphabet {0, 1}, specify a DFA. Use a state
diagram to specify your DFAs unless either the number of states is too large or the diagram too
clumsy. In such cases, specify specify the DFA formally, using appropriate mathematical
notation.
3. The set of all strings in {0, 1}∗ such that each string is of length at least three and every
block of three con- secutive symbols has at least one 0. (Thus, for example, 0011001 is
in the language, but 0011100 is not.)
1. {w ∈ {0, 1}∗ : w has three consecutive 0’s or three consecutive 1’s or both}.
2. {w ∈ {0, 1}∗ : w has three consecutive 0’s and three consecutive 1’s}.
3. The set of strings in {0, 1}∗ with an equal number of 0’s and 1’s such that no prefix has
two more 0’s than 1’s nor two more 1’s than 0’s.
5
Tutorial—4: Pumping Lemma for Regular Languages
4.1 For each of the following languages, say whether or not the language is regular and prove
your answer. To prove that a language is regular, specify a finite automaton or a regular
expression for that language. To prove that a language is not regular, use the pumping lemma.
a. L= {0m1n0m+n : m, n ≥ 0}.
n
d. {02 : n ≥ 0}.
e. {0m1n :m,n≥0andm̸=n}.
6
Tutorial—5: Design of Context Free Grammar for CFL
S −→1S00|00S1|SS |0S1S0|ε
Give a simple description of the language it generates, in the form {x ∈ {0, 1}∗ : ⟨some simple
property of x⟩}. The simple property might be expressed as an equation or a sentence or some
combination of the two.
7
Tutorial—6: CFG Simplification and Normal Forms
6.2 Remove all unit-productions, all useless productions, and all λ-productions from the
grammar
8
Tutorial—7: Ambiguity in Context Free Grammars
9
Tutorial—8: Designing Pushdown Automaton
8.1 Design pushdown automata (PDAs) for each of the following languages:
10
Tutorial—9: Pushdown Automata to CFG Conversion
9.1 Construct an npda that accepts the language generated by the grammar
9.3 Find a context-free grammar that generates the language accepted by the npda M =
({q0,q1}, {a, b}, {A, z},δ, q0, z, {q1}), with transitions
δ(q0, a, A) = {(q1)λ}
11
Tutorial—10: Designing Turing Machines
10.1 Construct Turing machines that will accept the following languages on {a, b}.
(a) L = L(aba*b).
(b) L = {w : |w| is even}.
(c) L = {w : |w| is a multiple of 3}.
12