1 / 35

Equivalence of DFA and NFA

Equivalence of DFA and NFA. In this section to convert the DFA to NFA. Theorem: Let ‘L’ be the set accepted by a NFA then there exists a DFA that accepts the same the language ‘L’.

aquinom
Download Presentation

Equivalence of DFA and NFA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Equivalence of DFA and NFA • In this section to convert the DFA to NFA. • Theorem: Let ‘L’ be the set accepted by a NFA then there exists a DFA that accepts the same the language ‘L’.

  2. Proof: let M={Q,∑,δ,q0,F) be a NFA accepting the language ‘L’ and to define the DFA M1={Q1,∑,δ1,q01,F1) • The final states of ‘M1’are equal to the subsets of sets of states of ‘M’. • Q1=2Q. • Q has a finite set of states. i.e Q={q1,q2…qn} • Q1 has finite set of states accepted by a DFA. • Q={q1,q2.q3….qi} • Q1=[q1,q2,q3….qi]

  3. i.e equivalent to the single state of DFA corresponds to the set of states in NFA. • δ1= ([q1,q2…qi], a) = [p1,p2…pi] if and only if δ = ({q1,q2…qi}, a) = {p1,p2…pi} It is easy to show by an induction method on the length of the string ‘x’ δ1(q01,x) = [q1,q2…qi] if and only if δ = ({q1,q2…qi}, a) = {p1,p2…pi}

  4. Basis step: The result id trivial for |x|=0 • Induction step: suppose length of the string should be length M or less. • δ1(q01,xa) = δ1(δ1(q01,x),a) • By inductive hypothesis of δ1 • δ1(q01,x)= [p1,p2…pi] if and only if δ(q0,x) = {p1,p2…pi}

  5. δ1([p1,p2…pi], a) = [r1,r2…rk] • If and only if δ({p1,p2…pi},a) = {r1,r2….rk} • To complete the proof we have only to add that δ1(q01,x)is in final state F1. • Hence the theorem is proved. i.e L(M) =L(M1).

  6. problem1 • Construct a DFA from an NFA

  7. To construct a DFA M1={q1,∑,δ1,q01,F1) and accepting the language L(M1). • Q1=2Q. Q=2 • 22=4 • δ1( Ø,0) =Ø. • δ1( Ø,1) =Ø. • δ1( q0,0) =[q0q1]. • δ1( q0,1) =[q1]. • δ1( q1,0) =Ø. • δ1( q1,1) =[q0q1] • δ1( [q0q1],0) =δ{q0q1},0) =δ( q0,0) U δ( q1,0) ={q0q1} U Ø => [q0q1]

  8. δ1( [q0q1],1) =δ{q0q1},1) =δ( q0,1) U δ( q1,1) ={q0q1} U {q0q1} => [q0q1] Set of final states {[q1],[q0q1]}

  9. solution

  10. Problem 2 • Construct a DFA from an NFA

  11. To construct a DFA M1={q1,∑,δ1,q01,F1) and accepting the language L(M1). • Q1=2Q. Q=4 • 24=16. • δ1( Ø,0) =Ø. • δ1( Ø,1) =Ø. • δ1( p,0) =[pq]. • δ1( p,1) =[p]. • δ1( q,0) =[r]. • δ1( q,1) =[r] • δ1( r,0) = [s] • δ1( r,1) = Ø • δ1( s,0) = [s] • δ1( s,1) = [s]

  12. δ1( [pq],0) =δ{pq},0) =δ( p,0) U δ( q,0) ={pq} U {r} => {pqr} => [pqr] • δ1( [pq],1) =δ{pq},1) =δ( p,1) U δ( q,1) ={p} U {r} => {pr} =>[pr] • δ1( [pr],0) = [pqs] • δ1( [pr],1) = [p] • δ1( [ps],0) = [pqs] • δ1( [ps],1) = [ps] • δ1( [qr],0) = [rs] • δ1( [qr],1) = [r] • δ1( [qs],0) = [rs]

  13. δ1( [qs],1) = [rs] • δ1( [rs],0) = [s] • δ1( [rs],1) = [s] • δ1( [pqr],0) = [pqrs] • δ1( [pqr],1) = [pr] • δ1( [pqs],0) = [pqrs] • δ1( [pqs],1) = [prs] • δ1( [prs],0) = [pqs] • δ1( [prs],1) = [ps] • δ1( [qrs],0) = [rs] • δ1( [qrs],1) = [rs] • δ1( [pqrs],0) = [pqrs] • δ1( [pqrs],1) = [prs] • Set of finite states { [s],[ps],[rs],[pqs],[prs],[pqrs],[qs],[qrs]}

  14. problem 3 • Construct a DFA from an NFA

  15. problem 4 • Construct a DFA from an NFA

  16. Finite Automata with є-closure • We shall introduce the another extension of FA. • NFA is allowed to make a transition with spontaneously without receiving or reading many input symbols.

  17. Contd..

  18. Example

  19. Transition table

  20. Finite Automata with є-closure

  21. Example

  22. Formal definition of NFA - є closure. • To represent the ∑with NFA A={Q,∑,δ,q0,F) where all components have a same interpretations as for a NFA. • A state in Q. • A members of Є U {є} either an input symbol is empty or a set of strings.

  23. E-closure : Definition

  24. Example: Find the є-closure for all the states of given figure

  25. solution • ECLOSE(1) ={1,2,3,4,6} • ECLOSE(2) ={2,3,6} • ECLOSE(3) ={3,6} • ECLOSE(4) ={4} • ECLOSE(5) ={5} • ECLOSE(6) ={6} • ECLOSE(7) ={7}

  26. Inductive definition on δ

  27. Problem 1: consider the following epsilon with NFA and compute the empty closure of each states and find its equivalent to the DFA.

  28. Let A be a NFA with є-closure which has A={Q,∑,δ,q0,F) • Q={p,q.r} • ∑ = {є,a,b,c} • To find ECLOSE for all states. • ECLOSE(p) = {p,q,r} • ECLOSE(q) = {q,r} • ECLOSE(r) = {r}

  29. δ( p,a) =δ(δ( p,є),a) =δ(δ( p,q,r),a) =δ( p,a) U δ(q,a) U (δ(r,a) =p U Ø U Ø = p = e-closure(p) ={pqr} • δ( p,b) =δ(δ( p,є),b) =δ(δ( p,q,r),b) =δ( p,b) U δ(q,b) U (δ(r,b) = Ø U q U Ø = q = e-closure(q) ={qr}

  30. δ( p,c) =δ(δ( p,є),c) =δ(δ( p,q,r),c) =δ( p,c) U δ(q,c) U (δ(r,c) = Ø U Ø U r = r = e-closure(r) ={r} • δ( q,a) =δ(δ( q,є),a) =δ(δ( q,r),a) =δ(q,a) U (δ(r,a) = Ø U Ø = Ø

  31. δ( q,b) =δ(δ( q,є),b) =δ(δ( q,r),b) =δ(q,b) U (δ(r,b) = q U Ø = q = e-closure (q) ={ q,r} • δ( q,c) =δ(δ( q,є),c) =δ(δ( q,r),c) =δ(q,c) U (δ(r,c) = Ø U r = r = e-closure(r) = {r}

  32. δ( r,a) =δ(δ( r,є),a) =δ(r,a) = Ø • δ( r,b) =δ(δ( r,є),b) =δ(r,b) = Ø • δ( r,c) =δ(δ( r,є),c) =δ(r,c) = r =e-closure(r) = {r}

  33. Problem 2: consider the following epsilon with NFA and compute the empty closure of each states and find its equivalent to the DFA.

  34. Problem 3: consider the following epsilon with NFA and compute the empty closure of each states and find its equivalent to the DFA.

More Related