Professional Documents
Culture Documents
{ })
3. x is a Regular Expression where L={x}
4. If X is a Regular Expression denoting the language L(X) and Y is a
2. ε* = ε
3. RR* = R*R
4. 4. R*R* = R*
5. 5. (R*)* = R*
6. RR* = R*R
7. (PQ)*P =P(QP)*
Arden’s Theorem
Statement:
If P does not contain null string, then R = Q + RP has a unique solution that is R
= QP*
Proof:
R = Q + (Q + RP)P [After putting the value R = Q + RP]
= Q + QP + RPP
When we put the value of R recursively again and again, we get the following
equation:
R = Q + QP + QP2 + QP3….. R = Q (є + P + P2 + P3 + …. )
Step 1: Create equations as the following form for all the states of the DFA
having
n states with initial state q1.
……………………………
qn = q1R1n + q2R2n + … + qnRnn
Rij represents the set of labels of edges from qi to qj, if no such edge exists,
then Rij = Ø
Step 2: Solve these equations to get the equation for the final state in terms
of Rij
Problem
Construct a regular expression corresponding to the automata given below:
b a
q2
q3
b
b a
q1
a
Finite automata
Solution
The equations for the three states q1, q2, and q3 are as follows:
q1 = q1a + q3a + є (є move is because q1 is the initial state0 q2 = q1b + q2b
+ q3b
q3 = q2a
q1 = q1a + q3a + є
Problem
0 0, 1
q1 q3
1 1
q
0
Finite automata
Solution Here the initial state is q1 and the final state is q2 Now we
write down the equations:
q1 = q10 + є q2 = q11 + q20
q3 = q21 + q30 + q31
So, q1 = 0*
q2 = 0*1 + q20
q1 q
a
q1 q1 q
a b
q1 q
a
a,b
Solution:
0, 1
q0 q1 q2 q3 q
1 є є 0
0, 1
q0 q2 q
1 0
Let L be a regular language. Then there exists a constant ‘c’ such that for
every string
w in L:
|w| ≥ c
1. |y| > 0
2. |xy| ≤ c
Solution:
form anbn.
Case 3) r = r1*
Since OP(r) = k+1, it follows that 0<= OP(r1) <= k. By the
inductive hypothesis there exists an NFA-ε machine M1 such
that L(M1) = L(r1). Furthermore, M1 has exactly one final
state.
• Example:
Problem: Construct FA equivalent to RE, r = 0(0+1)*
Solution: r = r1r2
r1 = 0
r2 = (0+1)*
r2 = r3*
r3 = 0+1
r3 = r4 + r5
r4 = 0
r5 = 1
Transition graph:
If X and Y are two states in a DFA, we can combine these two states
into {X, Y} if they are not distinguishable. Two states are
distinguishable, if there is at least one string S, such that one of δ (X,
S) and δ (Y, S) is accepting and another is not accepting. Hence, a
DFA is minimal if and only if all the states are distinguishable.
Algorithm 3
Step 1: All the states Q are divided in two partitions: final states
and non-final states and are denoted by P0. All the states in a
Example
0, 1
q δ(q,0) δ(q,1)
1 1
b f a b c
0
b a d
0 0 1
1 c e f
a d e f
e
1 0
0 e e f
f f f
P0 = {(c,d,e), (a,b,f)}
P1 = {(c,d,e), (a,b),(f)}
There are three states in the reduced DFA. The reduced DFA is
as follows:
Q δ(q,0) δ(q,1) 0
0, 1 1
(a, b) (a, b) (c,d,e) (a, (c,d, e)
(c,d,e) (c,d,e) (f)
1
(f) (f) (f) 0,1 (f
Homomorphisms
• A homomorphism on an alphabet is a function that gives a string for
each symbol in that alphabet.
• Example: h(0) = ab; h(1) = ε.
• Extend to strings by h(a 1…a n) = h(a 1)…h(a n).
• Example: h(01010) = ababab.
Closure Under Homomorphism
• If L is a regular language, and h is a homomorphism on its
alphabet, then h(L) = {h(w) | w is in L} is also a regular language.
• Proof: Let E be a regular expression for L.
• Apply h to each symbol in E.
• Language of resulting RE is h(L)
Decision Properties of Regular Languages
Language classes have two important kinds of properties: 1. Decision
properties. 2. Closure properties.
• Representation of Languages Representations can be formal or
informal.
• Example (formal): represent a language by a RE or DFA defining it.
• Example: (informal): a logical or prose statement about its strings:
1). {0 n 1 n | n is a non negative integer}
2). “The set of strings consisting of some number of 0’s followed by
the same number of 1’s.”
Decision Properties
• A decision property for a class of languages is an algorithm that
takes a formal description of a language (e.g., a DFA) and tells
whether or not some property holds.
• Example: Is language L empty?
Figure 2
For any given DFA M accepting L we can construct the minimal state DFA
accepting L by using an algorithm which uses following generic steps.
First, remove all the states ( of the given DFA M ) which are not
accessible from the start state i.e. sates P for which there is no
string s.t. .
Removing these states will not change the language accepted by the
DFA.
Second, remove all the trap states, i.e. all states P from which there is
no transition out of it.
Finally, merge all states which are "equivalent" or "indistinguishable".
We need to define formally what is meant by equivalent
or indistinguishable states; but at this point we assume that merging
these states would not change the accepted language.
In the example, states 5 and 6 are inaccessible and hence can be removed,
states 1 and 2 are equivalent and can be merged. Similarly states 3 & 4 are
also equivalent and can be merged together to have the minimal DFA as
produced above.
Properties
* δ(P,w) ∈ F → δ(Q,w) ∈ F
|w| = 1, it is 1 equivalent
|w| = 2, it is 2 equivalent
|w| = n, it is n equivalent
If these properties are satisfied, we can merge P,Q states and represent it as
a single state.
Partitioning Method
δ 0 1
→1 2 3
2 4 5
3 6 7
4 4 5
5 6 7
*6 4 5
7 6 7
Exercise
=====================