Sometimes employee’s performance is highly based on his/her ability to perform; in such situations salaries are based on employee competency. This type of salaries is termed as:
32aaef5e59814756b5455f8944258508image.png
SOLVED CS402 Assignment 1 Solution and Discussion

Assignment No. 01
Semester: Fall 2019
Theory of Automata – CS402
Total Marks: 20Due Date: November 15, 2019
Objectives:
Objective of this assignment is to assess the understanding of students about the concept of languages, regular expressions and finite automata.Instructions:
Please read the following instructions carefully before submitting assignment: You should consult the recommended books, PowerPoint slides and audio lectures to clarify your concepts.
 You are supposed to submit your assignment in .doc format. Any other formats like scan images, PDF, zip, rar and bmp etc will not be accepted.
 It should be clear that your assignment will not get any credit if:
• The assignment is submitted after due date.
• The assignment is copied from Internet or from any other student.
• The submitted assignment does not open or file is corrupt.
Note: No assignment will be accepted after the due date through email in any case (load shedding, server down, internet malfunctioning etc.).
It is recommended to upload solution file at least two days before its closing date.For any query about the assignment, contact at
Question: Marks = 20
Q1. Show that the following pairs of regular expressions define the same language over the alphabetL = {a, b}.
(i) (ab)a and a(ba)
(ii) (a* + b)* and (a + b)*
(iii) (a* + b*)* and (a + b)*
[9 marks = 3*3]
Q2. Develop a regular expression for the following language over the alphabet P = {a, b} such that it accepts all strings in which the letter b is never tripled. This means that no word contains the substring bbb. [5 marks]Q3. Develop a regular expression for the following language over the alphabet P = {a, b} such that it accepts all strings all words in which a is tripled or b is tripled, but not both. This means each word contains the substring aaa or the substring bbb but not both. [ 6 marks]
BEST OF LUCK 
Q1. Show that the following pairs of regular expressions define the same language over the alphabet L = {a, b}.
(i) (ab)a and (ii) (a + b)* and (iii) (a* + b*)* and
a(ba)* (a + b)* (a + b)*
Solution:
(i) (ab)a and a(ba) represents same language.
Both will never generate bb’s and both are starting and ending with a
(ii) (a* +b)* (a+b)*
[9 marks = 33]
(a)+ b a* + b*
a* + b* a* + b*
Both are all strings possible in L = {a,b}
(iii) (a* +b*)* (a+b)* (a*)* + (b*)*
a* + b*
(a + b)* Language with all strings
Q2. Develop a regular expression for the following language over the alphabet P = {a, b} such that it accepts all strings in which the letter b is never tripled. This means that no word contains the substring bbb. [5 marks]
Solution:
The required R.E will be (˄+b+bb) (a+ab+abb)*Q3. Develop a regular expression for the following language over the alphabet P = {a, b} such that it accepts all strings all words in which a is tripled or b is tripled, but not both. This means each word contains the substring aaa or the substring bbb but not both. [ 6 marks]
Solution:
(a+ ba + bba)* (˄ + b + bb ) aaa ( a+ ba + bba)* (bb + b + ˄) + (b+ ab + aab)* (aa + a + ˄) bbb (b + ab + aab)* (aa+ a + ˄) 

Q1. Show that the following pairs of regular expressions define the same language over the alphabet L = {a, b}.
(i) (ab)a and (ii) (a + b)* and (iii) (a* + b*)* and
a(ba)* (a + b)* (a + b)*
Solution:
(i) (ab)a and a(ba) represents same language.
Both will never generate bb’s and both are starting and ending with a
(ii) (a* +b)* (a+b)*
[9 marks = 33]
(a)+ b a* + b*
a* + b* a* + b*
Both are all strings possible in L = {a,b}
(iii) (a* +b*)* (a+b)* (a*)* + (b*)*
a* + b*
(a + b)* Language with all strings
Q2. Develop a regular expression for the following language over the alphabet P = {a, b} such that it accepts all strings in which the letter b is never tripled. This means that no word contains the substring bbb. [5 marks]
Solution:
The required R.E will be (˄+b+bb) (a+ab+abb)*Q3. Develop a regular expression for the following language over the alphabet P = {a, b} such that it accepts all strings all words in which a is tripled or b is tripled, but not both. This means each word contains the substring aaa or the substring bbb but not both. [ 6 marks]
Solution:
(a+ ba + bba)* (˄ + b + bb ) aaa ( a+ ba + bba)* (bb + b + ˄) + (b+ ab + aab)* (aa + a + ˄) bbb (b + ab + aab)* (aa+ a + ˄) 
