Assignment #01: Theory of Automata

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Assignment #01

Theory of Automata

5-C

By: Syed Mohammad Ali – 70066816.


To: Sir Naveed Ahmed Khan.
Due date: 13 November, Friday.
Questions 1: Whether following are RE, if so what languages do they
generate.
1. b(b+a)* = {a ,aa, ab , aaa, aab, aba, abb,….}
A language starts with an ‘a’ and is followed by any number of ‘a’s or ‘b’s.
2. bb(a+b) = {bba, bbb}
A language starts with double b’s and is followed by either only one a or only
one b.
3. (a+b) (a+b) (a+b) = {aaa, aab, aba, abb, baa, bab, bba, bbb}
A language starts with either an ‘a’ or a ‘b’ and is followed by either an ‘a’ or a
‘b’ and is followed by an ‘a’ or ‘b’ in the end.
4. (a+b)*ba = {ba, aba, bba, aaba, bbba, aaaba, bbbba,…….}
A language starts with any number of ‘a’s or ‘b’s and always ends with an ‘ba’.
5. (a+b)*a(a+b)* = {a, aa, ba, ab, aaa, aab, baa, bab, aaaa, bbaa, aaab, bbab,…
, abb, bba,…}
A language starts with any number of ‘a’s or ‘b’s and is followed by an single
‘a’ and is followed by any number of ‘a’s or ‘b’s.
6. (a+b)*aa(a+b)* = {aa, aaa, baa, aab, aaaa, aaab, baaa, baab, aaaa, bbaa,
aaab, bbaab,… , aabb, bbaabb,…}
A language starts with any number of ‘a’s or ‘b’s and is followed by ‘aa’ and is
followed by any number of ‘a’s or ‘b’s.
Questions 2: Write RE for the following languages over the  ={a,b}.
1) All words ending with b:
R.E = (a+b)*b
2) All words that start with a:
R.E = a(a+b)*
3) All words that start with a double letter:
R.E = ((a+b) (a+b)) (a+b)*
4) All words that contain at least one double letter:
R.E = (a+b)* ((a+b) (a+b)) (a+b)*
5) All words that start and end with a double letter:
R.E = ((a+b) (a+b)) (a+b)* ((a+b) (a+b))
6) All words of length >=3:
R.E= (a+b) (a+b) (a+b) (a+b)*
7) All words that contain exactly one a or exactly one b:
R.E = a*ba* + b*ab*
8) All words that don’t end at b:
R.E = (a+b)*(a)

You might also like