Lesson 03
Lesson 03
Task
Q)
1) Let S={ab, bb} and T={ab, bb, bbbb} Show
that S* = T* [Hint S* T* and T* S*]
2) Let S={ab, bb} and T={ab, bb, bbb} Show that
S* T* But S* T*
Solution: Since S T , so every string belonging
to S* , also belongs to T* but bbb is a string
belongs to T* but does not belong to S*.
Task
Q1)Is there any case when S+ contains ? If
yes then justify your answer.
Solution: consider S={,a} then
S+ ={, a, aa, aaa, }
Here is in S+ as member of S. Thus will
be in S+ , in this case.
Q2) continued
ii) (S+)+=S+
Solution: since S+ generates all possible
strings that can be obtained by
concatenating the strings of S, so (S+)+
generates all possible strings that can be
obtained by concatenating the strings of
S+ , will not generate any new string.
Hence (S+)+=S+
6
Q2) continued
iii) Is (S*)+=(S+)*
Solution: since belongs to S* ,so will
belong to (S*)+ as member of S* .Moreover
may not belong to S+, in general, while
will automatically belong to (S+)*.
Hence (S*)+=(S+)*
Regular Expression
As discussed earlier that a* generates
, a, aa, aaa,
and a+ generates a, aa, aaa, aaaa, , so the
language L1 = {, a, aa, aaa, } and
L2 = {a, aa, aaa, aaaa, } can simply be
expressed by a* and a+, respectively.
a* and a+ are called the regular expressions
(RE) for L1 and L2 respectively.
Note: a+, aa* and a*a generate L2.
8
Remark
It may be noted that a language may be
expressed by more than one regular
expressions, while given a regular expression
there exist a unique language generated by that
regular expression.
13
Example:
Consider the language, defined over
={a , b} of words having at least one a,
may be expressed by a regular expression
(a+b)*a(a+b)*.
Consider the language, defined over
= {a, b} of words having at least one a
and one b, may be expressed by a regular
expression
(a+b)*a(a+b)*b(a+b)*+ (a+b)*b(a+b)*a(a+b)*. 14
TASK
Consider the language, defined over
={a, b} of words beginning with a, then
its regular expression may be a(a+b)*
Consider the language, defined over
={a, b} of words beginning and ending
in same letter, then its regular expression
may be (a+b)+a(a+b)*a+b(a+b)*b
16
TASK
Consider the language, defined over
={a, b} of words ending in b, then its
regular expression may be (a+b)*b.
Consider the language, defined over
={a, b} of words not ending in a, then its
regular expression may be (a+b)*b + . It is to
be noted that this language may also be
expressed by ((a+b)*b)*.
17
SummingUP Lecture 3
RE, Recursive definition of RE, defining
languages by RE, { x}*, { x}+, {a+b}*,
Language of strings having exactly one aa,
Language of strings of even length, Language
of strings of odd length, RE defines unique
language (as Remark), Language of strings
having at least one a, Language of strings
havgin at least one a and one b, Language of
strings starting with aa and ending in bb,
Language of strings starting with and ending
in different letters.
18