Module 2
Module 2
MODULE 2
REGULAR EXPRESSIONS & LANGUAGES
Introduction to Regular Expression
Finite automata and regular expression
Proving languages not to be regular
Closure properties of regular Languages
Equivalence and minimization of automata
Applications of Regular Expressions
2. Obtain a regular expression to accept the lanaguage consisting of strings of 0’s and 1’s with atmost
one pair of consecutive 0’s
(1+01)*001*
3. Obtain a regular expression to accept lanagauge consisting of atleast one a and atleast one b where
Ʃ = {a,b,c}
[c*a(a+c)*b+c*b(b+c)*a](a+b+c)*
Explaination to the solution:
RE for the strings of a’s,b’s and c’s is
(a+b+c)*
String should have atleast one a and atleast one b so
First a proceeding b or b processing a is written as
c*a(a+c)*b or c*b(b+c)*a
The RE (a+b+c)* can be proceeded by one of the two cases
That is, c*a(a+c)*b(a+b+c)* + c*b(b+c)*a(a+b+c)*
Therefore the final RE is
[c*a(a+c)*b + c*b(b+c)*a] (a+b+c)*
4. Obtain a regular expression to accept a language consisting of strings of a’s and b’s of even
length
(aa+ab+ba+bb)*
5. Obtain a regular expression to accept the language consisiting of strings of a’s and b’s of odd
length
(a+b) (aa+ab+ba+bb)*
6. Obtain a regular expression such that L( R) ={w belongs to 0,1} with atleast 3 consecutive 0’s
(0+1)*000(0+1)*
7. Obtain a regular expression to accept strings of a’s and b’s ending with b and has no substring
aa
(b+ab)(b+ab)*
8. Obtain a regular expression to accept the strings of 0’s and 1’s having no or two consecutive 0’s
(1+01)*(0+e)
9. Obtain a regular expression to accept the strings of a’s and b’s of length <=10
(e+a+b)
10. Obtain a regular expression to accept the strings of a’s and b’s starting with a and ending with
b
a(a+b)*b
11. Obtain a regular expression to accept the strings of a’s and b’s whose thenth symbol from
right end is a
a(a+b)(a+b(a+b)(a+b)(a+b)(a+b)(a+b)(a+b)(a+b))
12. Obtain a regular expression to acccept the strings with two or more letters but beginning and
ending with same letter.
a(a+b)*a+b(a+b)*b
13. Obtain a regular expression to accept the strings of a’s and b’s whose whose length is either
even or multiples of 3 or both
[(a+b)(a+b)]* + [(a+b)(a+b)(a+b)]*
2. 4
Proof:
DFA Minimization:
2.