Chapter 3
Chapter 3
aabc
a a b c
2
After we precede by two steps
3
Iterated transition function
5
Example
• Let an automaton nfa defined by the relation:
a b
q0 q0,q3 q0, q1
q1 - q2
q2 q2 q2
q3 q4 -
q4 q4 q4
6
Example
• We consider * as a function from Qx in
(Q) :
* a b
q0 {q0,q3} {q0, q1}
q1 {q2}
q2 {q2} {q2}
q3 {q4}
q4 {q4} {q4}
7
Iterated transition function
• We assume, also, that *:
– *(q,) = {q}
– *(q,wa) = {p; r*(q,w) with p (r,a)}
• Notice:
– wL(M) *(q0,w)F
• We extend the function * on (Q) instead of Q: the
image of X(Q) by * is the direct image of the set X
by *.
8
example
• In this example:
* a b
q0 {q0,q3} {q0, q1}
q1 {q2}
q2 {q2} {q2}
q3 {q4}
q4 {q4} {q4}
• *({q0,q1}, b) = *(q0,b)*(q1,b) =
{q0,q1,q2}
9
nfa with -transitions
• We consider the transition as a function :
: Qx({}) |--- (Q)
10
Example of nfa with transitions
a
c
b
q0 q1 q2
11
-closure
• Let consider a state q, the -closure, E(q)
is defined by:
E(q) = set of states that are reached from the
state q with a succession of -transitions.
• We extend as follows:
• *(q, ) = E(q)
• For every w*, a then *(q, wa) = E(P)
with P = {p; r *(q, w) with p(r, a)}
12
example
• With the previous nfa:
– E(q0) = {q0,q1,q2}; E(q1) = {q1,q2}; E(q2) = {q2}
– *(q0,) = {q0,q1,q2}
– *(q0, aabc):
• by a, we get : {q0,q1,q2}
• by aa : {q0,q1,q2}
• by aab : {q1,q2}
• by aabc : {q2}
13
Elimination of -transitions
• Let M = (Q, , , q0, F) be nfa with -transitions.
• Let M’ = (Q, , ’, q0, F’) where:
14
example
• With previous example
* a b c
q0 {q0,q1,q2} {q1,q2} {q2}
q1 {q1,q2} {q2}
q2 {q2}
b
b
q1 q2
q0
a c
16
Determination – Last step
• Now we assume that there is nor -transitions neither
transitions with strings of length greater than 1 , we can
convert a nfa into dfa such as:
17
Conclusion
• Let M = (Q, , q0, F, ) be a nfa automaton where is relation
Qx(Q) instead of being a function QxQ.
• Let M’ = (Q’, , q’0, F’, ’) with:
– Q’ =(Q)
– q’0 = E(q0)
– F’ = {PQ’; PF}
– ’(P,a) = *(P,a) for every PQ’ and every a
Then:
1. M’ is deterministic ( ’: Q’x Q’)
2. L(M) = L(M’) (The same associated language of M & M’)
18
Formalization
Let M = (Q, , , q0, F) a nfa automaton.
The dfa automaton M’ = (Q’, , ’, q’0, F’)
– Q’ =(Q)
– q’0 = E(q0)
– F’ = {PQ’; PF}
– ’(P,a) = { E(q) | pP with (p,a,q) }
19
construct a dfa equivalent to nfa
c
a b
b
b
q1 q2
q0
a c
20
Defining ’
’ a b c
{q0} {q0, q1, q2} {q1, q2} {q2}
{q0, q1, q2} {q0, q1, q2} {q1, q2} {q2}
{q1, q2} {q1, q2} {q2}
{q2} {q2}
21
Direct answer from nfa with
-transitions
• E(q0)={q0, q1, q2}
a b c
{q0,q1,q2} {q0,q1,q2}{q1,q2} {q2}
{q1,q2} {q1,q2} {q2}
{q2} {q2}
22
a
b
b
{q0, q1, q2}} {q1, q2}
c c
{q2}
23
c