1 / 33

TYPES OF FINITE AUTOMATA:DFA & NFA

TYPES OF FINITE AUTOMATA:DFA & NFA. by: Er. Sukhwinder kaur. Topics to be discussed…. Deterministic Finite State Automata (DFA NON DETERMINISTIC FINITE AUTOMATA(NFA) DFA vs NFA Non Deterministic Features of NFA Subset Construction Method Limitations of Finite Automata.

kelton
Download Presentation

TYPES OF FINITE AUTOMATA:DFA & 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. TYPES OF FINITE AUTOMATA:DFA & NFA by: Er. Sukhwinder kaur

  2. Topics to be discussed… • Deterministic Finite State Automata (DFA • NON DETERMINISTIC FINITE AUTOMATA(NFA) • DFA vs NFA • Non Deterministic Features of NFA • Subset Construction Method • Limitations of Finite Automata

  3. Formal Definition of Computation Let M = (Q, , δ,q0, F) be a finite automaton and let w = w1w2…wn be a string where each wi is a member of alphabet ∑. Where Q= total no of states = input alphabet δ= transition function F=final state

  4. Deterministic Finite State Automata (DFA) One-way, infinite tape, broken into cells One-way, read-only tape head. Finite control, I.e., a program, containing the position of the read head, current symbol being scanned, and the current “state.” A string is placed on the tape, read head is positioned at the left end, and the DFA will read the string one symbol at a time until all symbols have been read. The DFA will then either accept or reject.

  5. DFA For every string x, there is a unique path from initial state and associated with x. The finite control can be described by a transition diagram: Example #1:

  6. Example Of DFA Here is a DFA for the language that is the set of all strings of 0’s and 1’s whose numbers of 0’s and 1’s are both even: back

  7. Non Deterministic Finite Automata(NFA) For any string x, there may exist none or more than one path from initial state and associated with x. x is accepted if there is some path that ends at a accept state.

  8. Example of NFA We can have a simpler representation for common suffix language using NFA: Use subset construction to convert it to a DFA. back

  9. DFA vs NFA Deterministic vs nondeterministic For every nondeterministic automata, there is an equivalent deterministic automata Finite acceptors are equivalent iff they both accept the same language L(M1) = L(M2)

  10. Cont….. Deterministic vs nondeterministic In DFA, label resultant state as a set of states {q1, q2, q3,…} For a set of |Q| states, there are exactly 2Q subsets Finite number of states back

  11. Non Deterministic Features of NFA There are three main cases of non- determinism in NFAs: • Transition to a state without consuming any input. • Multiple transitions on the same input symbol. • No transition on an input symbol. To convert NFAs to DFAs we need to get rid of non-determinism from NFAs. back

  12. Subset Construction Method Using Subset construction method to convert NFA to DFA involves the following steps: • For every state in the NFA, determine all reachable statesfor every input symbol. • The set of reachable states constitute a single state in the converted DFA (Each state in the DFA corresponds to a subset of states in the NFA). • Find reachable states for each new DFA state, until no more new states can be found. • Fig1. NFA without λ-transitions

  13. Fig1. NFA without λ-transitions Subset Construction Method 3 a b a a 2 a b a,b 1 5 a a,b 4 b

  14. Fig1. NFA without λ-transitions Step1 Subset Construction Method 3 a b a a 2 a b Construct a transition table showing all reachable states for every state for every input signal. a,b 1 5 a a,b 4 b

  15. Fig1. NFA without λ-transitions Fig2. Transition table Cont… 3 a b a a 2 a b a,b 1 5 a a,b 4 b

  16. Fig1. NFA without λ-transitions Fig2. Transition table Cont… 3 a b a a 2 a b a,b 1 5 a a,b 4 b

  17. Fig1. NFA without λ-transitions Fig2. Transition table Cont… Transition from state q with input a Transition from state q with input b 3 a b Starts here a a 2 a b a,b 1 5 a a,b 4 b

  18. Cont… Fig2. Transition table Step2 The set of states resulting from every transition function constitutes a new state. Calculate all reachable states for every such state for every input signal.

  19. Fig3. Subset Construction table Starts with Initial state Fig2. Transition table

  20. Fig3. Subset Construction table Starts with Initial state Fig2. Transition table

  21. Fig3. Subset Construction table Starts with Initial state Fig2. Transition table Step3 Repeat this process(step2) until no more new states are reachable.

  22. Fig3. Subset Construction table Fig2. Transition table

  23. Fig3. Subset Construction table Fig2. Transition table

  24. Fig3. Subset Construction table Fig2. Transition table

  25. Fig3. Subset Construction table Fig2. Transition table

  26. Fig3. Subset Construction table Fig2. Transition table We already got 4 and 5. So we don’t add them again.

  27. Fig3. Subset Construction table Fig2. Transition table

  28. Fig3. Subset Construction table Fig2. Transition table

  29. Fig3. Subset Construction table Fig2. Transition table

  30. Fig3. Subset Construction table Fig2. Transition table Stops here as there are no more reachable states

  31. Fig4. Resulting FA after applying Subset Construction to fig1 Fig3. Subset Construction table a b a 12345 245 35 a a,b a b b a ∅ 1 3 b a,b b a 2 a b 45 5 b a 4 b back

  32. Limitations of Finite Automata Obvious: Can only accept languages that can be represented in finite memory! Can this language be represented with a FA? L(M)=(ai bi | i  n) How about this one? L(M)=(ai bi | i > 0) back

  33. Thank You

More Related