Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
143 views6 pages

Assignment-1 Jan2025

This document is an assignment for a course on Automata and Compiler Design, detailing various tasks related to constructing deterministic finite automata (DFA), non-deterministic finite automata (NFA), and machines such as Moore and Mealy machines. It includes problems on designing automata for specific languages, proving properties of automata, and converting between different types of machines. The assignment also covers regular expressions and the application of the pumping lemma to assess the regularity of certain languages.

Uploaded by

megav369
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
143 views6 pages

Assignment-1 Jan2025

This document is an assignment for a course on Automata and Compiler Design, detailing various tasks related to constructing deterministic finite automata (DFA), non-deterministic finite automata (NFA), and machines such as Moore and Mealy machines. It includes problems on designing automata for specific languages, proving properties of automata, and converting between different types of machines. The assignment also covers regular expressions and the application of the pumping lemma to assess the regularity of certain languages.

Uploaded by

megav369
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

ASSIGNMENT -01

Course Name: Automata and Compiler Design Course Code: CSE2240

Submission Deadline: February 15, 2025


1 For each of the following problems construct a deterministic finite automaton which
describes or recognizes the language given. The underlying alphabet is ∑ = {0, 1}.
(a) { w | w begins with 01 and ends with 01. }
(b) { w | w has an even number of 1’s. }
(c) { w | w has two or three 1’s. }
(d) { w | w has an even number of 0’s, and |w| is even. }
(e) { w | w has an even number of 0’s and odd number of 1’s. }
(f) { w | w contains the substring 110. }
(g) { w | w does not contain the substring 110. }
(h) { w | w does not contain neither of the substrings 11 and 00. }
(i) { w | w has exactly one occurence of the substring 010. }
(j) { w | w has n occurences of 0’s where n mod 5 is 3. }

2 Design a DFA for each of the following languages (all over the alphabet {0,1}). Also,
formally explain the idea behind your design by providing the state invariants for all the
states in your DFA.
i) L={w| every odd position of w is a 0}
ii) L={w| |w| is divisible by 3 or it ends in 00}
iii) L={w| every block of 4 consecutive symbols contains the substring 01} (for
example 00100 is in the language and 10001000 is not)

3 Prove that the following automata (M) recognizes the set of strings w (over alphabet {0,1})
such that w interpreted as a binary number is divisible by 4.
4 Give NFAs with the specified number of states recognizing each of the following languages
(no epsilon transitions).
i) The language {w ∈ {0,1}∗ | w contains the substring 0101, i.e., w = x0101y for
some x,y ∈ {0,1}∗} with five states or fewer.
ii) The language {w ∈ {0,1}∗ | w contains an even number of 0s, or exactly two 1s}
with six states or fewer.
iii) The language {w ∈ {a,b}∗ | w starts and ends with same symbol}

5 Consider the languages L1 and L2 described as:


L1={anbm|n>=0,m>0} and L2={w|w Є (a,b)*, string either starts with ‘a‘or ‘b’}
Design the Finite automata for the following:
i. L=L1.L2
ii. L=L1’
iii. L=L2’
iv. L=L1+L2

6 Convert the following NFA to DFA.

For each of the following, determine whether it is recognized by the obtained DFA or not.
i. bab
ii. aababbb
iii. aabbaaaa
iv. aabaaa
v. bbaabbab
vi. aabba

7 Draw NFA with specified number of states to accept the following languages and then
convert them to DFA.
a) All strings that contain the substring 0101 (using 5 states).
b) All strings such that the third symbol from the right end is a ‘a’ (using 4 states).
8 Design a Moore machine to accept language L={anbm|m,n>=1} and produce output in a
manner such that first a produces output 0 followed by 1 for additional a’s followed by 1 for
first b followed by 0’s for additional b’s.
Input: aaa….aabb….bb
Output: 011…1110…00

9 Design a Mealy machine that accepts all strings over {0,1} and produces incremented output.

10 Convert the following Mealy machines into equivalent Moore machine

11 Convert the following Moore machines into equivalent Mealy machine

12 Construct a minimized DFA for the following:


13 Design a minimal DFA that accepts all strings over the alphabet ∑ = {a, b}, where every
accepted string ‘w’ starts with substring s
i) s = b ii) s = ab iii) s = abb

14 Represent the following sets by regular expression:

b. {12n+1 | n>0
c. {The set of all strings over {0,1} which has at most two zeros.

d. {an | n is divisible by 2 or 3 or n=5}.


e. The set of all strings over {a, b} beginning and ending with a.

15 Construct a transition system corresponding to the following regular expressions


a) (ab + c*)*b.abc*
b) (a + bb) . ba*b
c) (ab + a)*(aa + b)
d) (a*b + b*a)*a

16 Find the regular expressions representing the following sets:


a. The set of all strings over {0,1} having at most one pair of 0’s or at most one
pair of 1’s.
b. The set of all strings over {a,b} in which the number of occurrences of a is
divisible by 3.
c. The set of all strings over {a,b} in which there are at least two occurrences of b
between any two occurrences of a.
d. The set of all strings over {a,b} with three consecutive b’s.
e. The set of all strings over {0,1} beginning with 00.
f. The set of all strings over {0,1} ending with 00 and beginning with 1.
g. Let Σ = {a, b} and let L= { w∈Σ* | w≠ ε and the first and last character of w are
the same }. Write a regular expression for L.

17 For a language L, let INIT(L) = {x | xy Є L for some y Є ∑*} . Let r, s, r1 and s1 be


regular expressions for the languages R, S, INIT(R), and INIT(S) respectively. Using only
these regular expressions and the operations +, concatenation, and * give expressions for
the following languages and very briefly justify your answers:
i) Init(R U S)
ii) Init(RS)
iii) Init(R*)

18 Construct R.E. using Arden’s theorem from the following FA’s:


a)
a B
→q1 q1 q2
*q2 q3 q2
q3 φ φ
b)
0 1
→*q1 q1 q2
q2 q3 q2
q3 q1 q2

c)
0 1
→*q1 q1 q2
→*q2 q3 q2
q3 q3 q3
d)
a b
→q1 q3 q2
q2 q2 q2
*q3 q3 q3

19 Given L1={an|n>=0} and L2={bn|n>=0}, check for the following:


a) L1.L2 is regular
b) L1.L2={anbn|n>=0}

20 Use pumping lemma to prove the following language is regular or not.


L = {anbn | n ∈ N, n ≥ 0}.
L = {anbk | n,k ∈ N, n > k ≥ 0}.
L = {anbn+3 | n ∈ N, n ≥ 0}.
L = {(an)2 | n ∈ N, n > 1}.
L= {(ab)nan| n∈ℕ }.

You might also like