Regular Expression2
Regular Expression2
Regular Expression2
REGULAR
EXPRESSIONS
. (3) (L*)* = L*. (Both sides contain all possible strings that are made up of
strings of L.)
(4) * = Λ* =Λ. (The Kleene star always contains the empty string Λ).
baba + babab
(Λ + x + xx)(y*) = y* + xy* + xxy*
Rules define the language associated
with regular expression
Rule 1
The language associated with Λ is just {Λ}, a one – word language.
Rule 2
If r1 is a regular expression associated with the language L1 and r2 is
a regular expression associated with the language L2 then,
(i) The regular expression (r1) (r2) is associated with the language
L1 times L2
Language (r1 r2) = L1L2
(ii) The regular expression r1 + r2 is associated with the language
formed by the union of the sets L1 and L2
Language (r1 +r2) = L1 +L2
(iii) The language associated with the regular expression (r1)* is L1* ,the
kleene closure of the set L1 as a set of words
Language (r1*) = L1*
THEOREM
If L is a finite language (a language with only finitely
many words), then L can be defined by a regular
expression
PROOF
Let L = {w1, . . . wn}. Then each wj can be described by
a regular expression (write out the letters and show this
is a regular expression). Then take the union.
EXAMPLE
Let
L = {baa abbba bababa}
The regular expression we get from theorem is
baa + abbba + bababa
EXAMPLE
We have L = language (bb* + abb* + aabb*) ((a
+ aa)bb*)*(b* + a + aa).
We can simplify this expression.
The first factor can be written (Λ + a + aa) bb*