1 / 79

Finite Automata (FA)

Finite Automata (FA). It consists of set of finite states and finite transitions from one state to another state that take an input from an input alphabet. There are two types of FA i) Deterministic Finite Automata (DFA). ii) Non Deterministic Finite Automata (NFA).

cdriskell
Télécharger la présentation

Finite Automata (FA)

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. Finite Automata (FA) • It consists of set of finite states and finite transitions from one state to another state that take an input from an input alphabet. • There are two types of FA i) Deterministic Finite Automata (DFA). ii) Non Deterministic Finite Automata (NFA).

  2. DFA: There is one and only state to which the automata can transition from its current state. • NFA: There is a more than one state to which the automata can transition from its current state.

  3. Deterministic Finite Automata (DFA)

  4. Formal definition of FA

  5. Simpler notations for DFA • The two notations are used to represent DFA. i) Transition Diagram. ii) Transition Table

  6. Transition Diagram

  7. example

  8. Transition table • A transition table is a conventional tabular representation of functions like δ that takes the two argument and returns another state. • The row of the table corresponding to the states. • The column of the table corresponding to the inputs.

  9. example

  10. Extending the Transition functions to the strings

  11. Language of DFA

  12. Problem 1 Given a DFA accepting the following language over the alphabet {0,1}Set of all the strings ending with 00.

  13. In this problem , “00” as 2 inputs and it needs 3 states

  14. Problem 1 Given a DFA accepting the following language over the alphabet {0,1}Set of all the strings with 3 consecutive 0’s (not necessarily at the end).

  15. In this problem , “000” as 3 inputs and it needs 4 states

  16. Problem 2: Given a DFA accepting the following language over the alphabet {0,1}Set of all the strings with a 011 as a substring.

  17. In this problem , “011” as 3 inputs and it needs 4 states

  18. Problem 2: Given a DFA accepting the following language over the alphabet {0,1}Set of all the strings beginning with a 101.

  19. Problem: Given a DFA accepting the following language over the alphabet {0,1}Set of all the strings with three consecutive zeros.

  20. Problem1: : Consider the following transition diagram and to check the input string 110111,011101 is accepted or not.

  21. Transition table: • Let A be a DFAwhich has A={Q,∑,δ,q0,F)

  22. Input: 110111 • δ( A,є) =A. • δ( A,1) =B. • δ( A,11) =δ( A,1),1) =δ( B,1) =B. • δ( A,110) =δ( A,11),0) =δ( B,0) = C. • δ( A,1101) =δ( A,110),1) =δ( C,1) = D. • δ( A,11010) =δ( A,1101),0) =δ( D,1) = B. • δ( A,110101) =δ( A,11010),0) =δ( B,1) = B. • It does not reach the final state. • The given string is not accepted by DFA.

  23. Input: 011101 • δ( A,є) =A. • δ( A,0) =A. • δ( A,01) =δ( A,0),1) =δ( A,1) =B. • δ( A,011) =δ( A,01),1) =δ( B,1) = B. • δ( A,0111) =δ( A,011),1) =δ( B,1) = B. • δ( A,01110) =δ( A,0111),0) =δ( B,0) = C. • δ( A,011101) =δ( A,011101),0) =δ( C,1) = D. • It reaches the final state. • The given string is accepted by DFA.

  24. Problem:Give a DFA accepting the following language over the alphabet {0,1}. All the strings with a substring 01 and to check the given input string 10010 is accepted or not by a DFA.

  25. Solution: Let A be a DFA which has A={Q,∑,δ,q0,F) • Transition diagram:

  26. Transition table

  27. Input 10010 • δ( q0,є) =q0. • δ( q0,1) =q0. • δ( q0,10) =δ( q0,1),0) =δ( q0,0) =q1. • δ( q0,100) =δ( q0,10),0) =δ( q1,0) =q1. • δ( q0,1001) =δ( q0,100),1) =δ( q1,1) =q2. • δ( q0,10010) =δ( q0,1001),0) =δ( q2,0) =q2. • It reaches the final state • The given string is accepted by DFA.

  28. Problem : Design a DFA to accept the language L ={w/w has an even number of 0’s and even number of 1’s}and to check the given input strings are 110101 and 10010 is accepted or not by an DFA.

  29. It has the 4 states like q0,q1,q2,q3. • q0: Number of 1’s and number of 0’s are even. • q1: Number of 0’s is even and number of 1’s is odd. • q2: Number of 0’s is odd and number of 1’s is even. • q3: Number of 0’s and number of 1’s are odd.

  30. Let A be a DFA which has A={Q,∑,δ,q0,F) • Transition diagram:

  31. Transition table

  32. Input: 110101 • δ( q0,є) =q0. • δ( q0,1) =q1. • δ( q0,11) =δ( q0,1),1) =δ( q1,1) =q0. • δ( q0,110) =δ( q0,11),0) =δ( q0,0) =q2. • δ( q0,1101) =δ( q0,110),1) =δ( q2,1) =q3. • δ( q0,11010) =δ( q0,1101),0) =δ( q3,0) =q1. • δ( q0,110101) =δ( q0,11010),0) =δ( q1,1) =q0. • It reaches the final state • The given string is accepted by DFA.

  33. Input: 10010 • δ( q0,є) =q0. • δ( q0,1) =q1. • δ( q0,10) =δ( q0,1),0) =δ( q1,0) =q3. • δ( q0,100) =δ( q0,10),0) =δ( q3,0) =q1. • δ( q0,1001) =δ( q0,100),1) =δ( q1,1) =q0. • δ( q0,10010) =δ( q0,1001),0) =δ( q0,0) =q2. • The state q2 is not a accepting state. • The given string is not accepted by DFA.

  34. NFA

  35. NFA

  36. Formal definition of NFA

  37. Simpler Notations • Transition table • Transition diagram

  38. Transition Diagram

  39. Transition table • A transition table is a conventional tabular representation of functions like δ that takes the two argument and returns another state. • The row of the table corresponding to the states. • The column of the table corresponding to the inputs.

  40. Extended transition function of NFA • Basis step:δ(q0,є) = q0. Ifwe are in the state of q0 and read no inputs then we are in the same stateq0. • Inductive step: suppose w is a string of the form “xa” δ(q0,x) = p1 p2 p3… pk Let δ(q0,w)= δ(q0,xa) = δ (δ(q0,x),a) = δ((p1 p2 p3… pk),,a) = δ((p1,a)Uδ((p2,a)Uδ((p3,a)U … δ((pK,a) δ(q0,w) = r1 ,r2, r3… rk

  41. Language of an NFA

  42. Problem 1: Given a NFA accepting the following language over the alphabet {0,1}. Set of all the strings end in the substring 01 and to check the given input string 00101 is accepted or not by a NFA.

  43. Transition Diagram

  44. Transition table

  45. Input 00101 • δ( q0,є) =q0. • δ( q0,0) ={q0,q1}. • δ( q0,00) =δ( q0,0),0) =δ( {q0,q1},0) = δ(q0,0) U δ(q1,0) = { q0,q1} U Ф = { q0,q1} • δ( q0,001) =δ( q0,00),1) =δ( {q0,q1},1) = δ(q0,1) U δ(q1,1) = { q0 } U { q2 } = { q0,q2}

  46. δ( q0,0010) =δ( q0,001),0) =δ( {q0,q2},0) = δ(q0,0) U δ(q2,0) = { q0,q1 } U Ф = { q0,q1} • δ( q0,00101) =δ( q0,0010),1) =δ( {q0,q1},1) = δ(q0,1) U δ(q1,1) = { q0 } U { q2 } = { q0,q2} Given input string is accepted by NFA it reaches the final state.

More Related