Computer Science Department
THEORY OF AUTOMATA
Assignment#3
Name: Muhammad Nabeel Ahmad (181132)
Class: BSCS-F18 (C)
Submitted to: Sir Asif Jamal
Date: May 3rd ,2021
Q1: Describe the language denoted by following regular expression
R.E = (b* (aaa)* b*)*
Solution:
The language can be predicted from the regular expression by finding the
meaning of it. We will first split the regular expression as:
R.E. = (any combination of b's) (aaa)* (any combination of b's)
L = {The language consists of the string in which a's appear triples, there
is no restriction on the number of b's}
Q2: Prove that whether (ab)* is equal OR not equal to a*b*?
Solution:
(ab)* is not equal to a*b* such that:
a*b*!= * (ab)*.
As we know that the language defined by the expression on the right
contains the word abab, which the language defined by the expression on
the left does not. Similarly the expression on the left has ‘a’ and ‘b’ as
separate words but not on the right.
Q3: Let us reconsider the regular expression (a + b)*a(a + b)*b(a + b)*.
Show that this is equivalent to (a + b)*ab(a + b)* in the sense that they
define the same language.
Solution:
R.E=(a + b)*a(a + b)*b(a + b)* will generate L={ab, aab, abb, abab,
……….}
& R.E=(a + b)*ab(a + b)* will generate L={ab, aab, abb, abab,……….}
So, both Regular Expressions define same language.
Q4: Write the regular expression for the language L over ∑ = {0, 1} such
that all the string do not contain the substring 01.
Solution:
L = {ε, 0, 1, 00, 11, 10, 100, .....}
R = (1* 0*)
Q5: Write the regular expression for the language containing the string
over {0, 1} in which there are at least two occurrences of 1's between
any two occurrences of 1's between any two occurrences of 0's.
Solution:
At least two 1's between two occurrences of 0's can be denoted by
(0111*0)*.
Similarly, if there is no occurrence of 0's, then any number of 1's are also
allowed. Hence the R.E. for required language is:
R = (1 + (0111*0))*
Q6: Write the regular expression for the language containing the string
in which every 0 is immediately followed by 11.
Solution:
The regular expectation will be:
R = (011 + 1)*