1 / 14

Nondeterministic Finite Automata

Nondeterministic Finite Automata. Hopcroft, Motawi, Ullman, Chap 2. NFAs: Nondeterministic Finite Automata. Same as a DFA, except: On input a, state q may have more than one transition out, implying the possibility of multiple choices when processing an input symbol

Download Presentation

Nondeterministic Finite Automata

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. Nondeterministic Finite Automata Hopcroft, Motawi, Ullman, Chap 2

  2. NFAs:Nondeterministic Finite Automata • Same as a DFA, except: • On input a, state q may have more than one transition out, implying the possibility of multiple choices when processing an input symbol • On input a, state q may have no transition out, implying the possibility of “being stuck” • A string is w acceptable as long as there exists an admissible state sequence for w

  3. NFAs • A nondeterministic finite automaton M is a five-tuple M = (Q, , , q0, F), where: • Q is a finite set of states of M •  is the finite input alphabet of M • : Q    power set of Q, is the state transition function mapping a state-symbol pair to a subset of Q • q0 is the start state of M • F  Q is the set of accepting states or final states of M

  4. Example NFA • NFA that recognizes the language of strings that end in 01 0,1 Exercise:draw the complete transition table for this NFA 1 q2 0 q1 q0 note: (q0,0) = {q0,q1} (q1,0) = {}

  5. Converting NFAs to DFAs • Given a NFA, M = (Q, , , q0, F), build a DFA, M’ = (Q’, , ’, {q0}, F’) as follows. • Q’ contains all subsets S of states in Q. • The initial state of M’ is the set containing q0 • F’ is the set of all subsets of Q that contain at least one element in F (equivalently, the subset contains at least one final state)

  6. Converting NFAs to DFAs • ’ is determined by putting together, for each state in the subset and each symbol, all states that may result from a transition:’(S, a) =  (q, a)qS • May remove “unreachable” states in Q’

  7. Example conversion • NFA • DFA 0,1 1 q2 0 q1 q0 1 0 1 0 {q0,q1} {q0,q2} {q0 } 0 1

  8. NFA with -transitions • NFA that allows the transition of an empty string from a state • Jumping to a state is possible even without input • Revision on NFA definition simply allows the  “symbol” for 

  9. NFA with -transitions • A nondeterministic finite automaton with -transitions (or -NFA) is a five-tupleM = (Q, , , q0, F), where: • Q is a finite set of states of M •  is the finite input alphabet of M • : Q  ( + )  power set of Q, is the state transition function mapping a state-symbol pair to a subset of Q • q0 is the start state of M • F  Q is the set of accepting states or final states of M

  10. Converting -NFAs to NFAs • Task: Given an-NFA M = (Q, , , q0, F), build aNFA M’ = (Q’, , ’, q’0, F’) • Need to eliminate -transitions • Need epsilon closure concept • Add transitions to enable transitions previously allowed by the -transitions • Note: the conversion process in the textbook instead builds a DFA from an -NFA

  11. Equivalence of Finite Automata • Conversion processes betweenDFAs, NFAs, and -NFAs show that no additional expressive capacity (except convenience) is introduced by non-determinism or -transitions • All models represent regular languages • Note: possible exponential explosion of states when converting from DFA to NFA

  12. Closure of Regular Languages under certain operations • Union L1  L2 • Complementation L1 • Intersection L1  L2 • Concatenation L1L2 • Goal: ensure a FA can be produced from the FAs of the “operand” languages

  13. Finite Automata with Output • Moore Machines • Output symbol for each state encountered • Mealy Machines • Output symbol for each transition encountered • Exercise: formally define Moore and Mealy machines

  14. Next: Regular Expressions • Defines languages in terms of symbols and operations • Example • (01)* +(10)* defines all even-length strings of alternating 0s and 1s • Regular expressions also model regular languages and we will demonstrate equivalence with finite automata

More Related