Lesson 03
Lesson 03
1
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*.
2
3) Let S={a, bb, bab, abaab} be a set of strings. Are
abbabaabab and baabbbabbaabb in S*? Does any word
in S* have odd number of b’s?
Solution: since abbabaabab can be grouped as (a)(bb)
(abaab)ab , which shows that the last member of the
group does not belong to S, so abbabaabab is not in S*,
while baabbbabbaabb can not be grouped as members
of S, hence baabbbabbaabb is not in S*. Since each
string in S has even number of b’s so there is no
possiblity of any string with odd number of b’s to be in
S*.
3
Task
4
Q2) Prove that for any set of strings S
i. (S+)*=(S*)*
Solution: In general Λ is not in S+ , while Λ
does belong to S*. Obviously Λ will now be
in (S+)*, while (S*)* and S* generate the
same set of strings. Hence (S+)*=(S*)*.
5
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+)*
7
Regular Expression
2.r1 r2
3.r1 + r2 and
4. r1*
are also regular expressions.
Step 3: Nothing else is a regular expression.
9
Defining Languages (continued)…
10
Now consider another language L, consisting
of all possible strings, defined over Σ
= {a, b}. This language can also be expressed
by the regular expression
(a + b)*.
Now consider another language L, of strings
having exactly double a, defined over Σ
= {a, b}, then it’s regular expression may be
b*aab*
11
Now consider another language L, of even
length, defined over Σ = {a, b}, then it’s
regular expression may be
((a+b)(a+b))*
Now consider another language L, of odd
length, defined over Σ = {a, b}, then it’s
regular expression may be
(a+b)((a+b)(a+b))* or
((a+b)(a+b))*(a+b)
12
Remark
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
Consider the language, defined over
Σ={a, b}, of words starting with double a
and ending in double b then its regular
expression may be aa(a+b)*bb
Consider the language, defined over
Σ={a, b} of words starting with a and
ending in b OR starting with b and
ending in a, then its regular expression
may be a(a+b)*b+b(a+b)*a
15
TASK
16
TASK
17
SummingUP Lecture 3
18