FLAT Regular Languages Expressions
FLAT Regular Languages Expressions
Examples:
L = All strings of even length,
L’ = All strings that end in a 1,
L1 = {w: w contains 001 as a substring} xxxx001yyyy
L2 = {w: w contains 001 as a subsequence} 010101 also contains 001 as a
subsequence,
L3 = strings that contain at least one 1
L4 = strings whose length is divisible by 3.
L5 = {w : length of w, when divided by 3, gives remainder 1}
L6 = {w: there are an even number of zeroes after the last 1 in w}
Concept of Expressions
0* is an ‘expression’ that refers to a string that contains any number of
zeroes. i.e., the string can be empty string ε, or 0, 00, 000, ….
0*10* is an ‘expression’ that means a string that contains exactly one 1.
Here, 0* means any number of consecutive zeroes (as a block). So the
string can be 0100, 10, 0001, 0010000, ….
We now define ‘regular expressions’ in a way that they correspond exactly to
regular languages, or they are expressions that capture regular languages. How?
L(0 + 1*) = L(0) U L(1*) = {0} U {empty string, 1, 11, 111, ….} = {ε, 0, 1, 11, 111..}
(iv) Reg. expression B = 0 + (11 ◦ 001)
Here, concatenation (or dot) operation ◦ has more precedence over +.
B = 0 + 11 ◦ 001, it means B = 0 + (11 ◦ 001) = 0 + 11001
L(B) = {0} U {11001} = {0, 11001}
Proof:
DFA AØ
Verify that this is a DFA that does not accept any string. In other words, the
language of this DFA is Ø, or the empty set.
DFA Aε
The DFA Aε accepts only the empty string, ε. It says NO on all other strings.
2. The next case is expressions of the form R = a. L(R) = {a}, this also has an
equivalent DFA (or an NFA). What is it?
For example, R = 0. L(R) = {0}, it has only one string, it is a single 0.