Regular Expressions and Regular Languages
Regular Expressions and Regular Languages
Regular Expressions and Regular Languages
and
Regular Languages
Union:
Concatenation:
Powers:
Kleene Closure:
L M = {00,11,1,01}
L.M = {001,0001,0011,111,1101,1111}
L0 = {} L1= L ={00,11} L2={0000,0011,1100,1111}
L*={,00,11,0000,0011,1100,1111,000000,000011,...}
Note:
{a} is the language containing one string, and that string is of length 1.
All strings of 0’s and 1’s with at least two consecutive 0’s
(0+1)*00 (0+1)*
Case 1: i j
Case 2: i = j
The final regular expression equivalent to DFAis constructed by taking the union of
all the expressions where the first state is the start state and the second state is accepting.
(2)
With 1 as the start state and 2 as the only accepting state, we need only the expression R12
(2)
R12 = 1*0(0+1)*
Eliminate
the state s
1. For each accepting state q, apply the above reduction process to produce an
equivalent automaton with regular-expression labels on the arcs. Eliminate all states
except q and the start state q0.
4. The desired regular expression is the sum (union) of all the expressions derived from
the reduced automata for each accepting state, by rules (2) and (3).
BİL405 - Automata Theory and Formal Languages 21
Converting DFA's to Regular Expressions
by Eliminating States
CASE 1: If q q0, a two-state automaton will be created
(R+SU*T)*SU*
R*
Concatenation is associative: (M N) R = M (N R)
Concatenation is NOT commutative,
i.e., there are M and Nsuch that MN NM
Union is idempotent: M M = M
• Is there a general methodology that will make our proofs of the correct
laws easy? YES
– This methodology only works for regular expression operators (concetanation, or,
closure)
a(b+c) = ab + ac
(a+b)* = (a*b*)*