This document discusses regular languages and regular expressions. It defines regular expressions as notations used to represent regular languages, which are sets of strings that are either finite or can be generated using simple recursive rules. The document then provides the formal definitions and operations of regular expressions, including empty languages, single characters, unions, concatenations, and closures. It concludes by listing 37 problems involving writing regular expressions for specific languages over given alphabets.
2. Regular Languages & Regular
Expression
A regular expression is a notation to
represent regular language, i.e. a set
of strings, where the set is
either finite or contains strings
that are generated using simple
recursive rules.
The language represented by regular
expressions are called regular languages.
11/21/2017
Sampath Kumar S, AP/CSE, SECE
2
3. Regular Expression
Let ∑ be an alphabet which is used to denote the input
set. The regular expression over ∑ can be defined as
follows:
is a Regular Expression denoting an empty
language or set. (L () = { })
ε is a Regular Expression indicates the language
containing an empty string. (L (ε) = {ε})
x is a Regular Expression where L={x}
11/21/20173
Sampath Kumar S, AP/CSE, SECE
4. Regular Expression (cont..,)
If X is a Regular Expression denoting the
language L(X) and Y is a Regular Expression denoting
the language L(Y), then
Union: X + Y is a RE corresponding to the language
L(X) ∪ L(Y) where L(X + Y) = L(X) ∪ L(Y).
Concatenation: X . Y is a RE corresponding to the
language L(X) . L(Y) where L(X.Y)= L(X) . L(Y)
Closure: R* is a RE corresponding to the
language L(R*)where L(R*) = (L(R))*
11/21/20174
Sampath Kumar S, AP/CSE, SECE
5. Some rules for language operations
Let r, s and t be languages over {0,1}
r + = + r = r
r + s = s + r (r or s)
r = r = r
r = r =
r(s + t) = rs + rt
r+ = r.r*
11/21/2017
Sampath Kumar S, AP/CSE, SECE
5
6. Problems to Discuses:
22. Write the regular expression for the language
accepting all combinations for a’s over the set Σ =
{a}.
23. Write the regular expression for the language
accepting all combinations for a’s except the null
string over the set Σ = {a}.
24. Design RE for the language containing all the
strings containing any number of a’s and b’s.
25. Design RE for the language containing all the
strings containing any number of a’s and b’s
except null string.
11/21/20176
Sampath Kumar S, AP/CSE, SECE
7. Problems to Discuses:
26. Construct the r.e for the language accepting all
the strings which are ending with 00 over the set
Σ ={0,1}
27. Construct the r.e for the language accepting all
the strings which are starting with 1 and ending
with 0 over the set Σ ={0,1}
28. If L = {The language starting and ending with a
and any combination of b’s in between} then
what is r?
29. Write r.e to denote the language L over Σ* where
Σ={a,b,c} in which every string will be such that
any number of a’s followed by any number f b’s
and any number of c’s. Σ
11/21/20177
Sampath Kumar S, AP/CSE, SECE
8. Problems to Discuses:
30. Write r.e. to denote a language L which accepts
all the string which begins or end with either 00 or
11.
31. Write r.e. to denote a language L over Σ ={a,b}
such that the 3rd character from right end of string
is always a.
32. Construct the r.e for the language L which
accepts all the string with at least two b’s over Σ
={a,b}
33. Construct the r.e for the language L which
accepts all the string with exactly two b’s over Σ
={a,b}
11/21/20178
Sampath Kumar S, AP/CSE, SECE
9. Problems to Discuses:
34. Write r.e. to denote a language L having strings
which should have at least one 0 and at least one
1
35. Construct the r.e for the language L over Σ ={0}
having even length of string
36. Construct the r.e for the language L over Σ ={0}
having even odd length of string
37. Write r.e. to denote a language L over Σ={a,b}
such that all strings do not contain the substing
“ab”.
11/21/20179
Sampath Kumar S, AP/CSE, SECE