1 / 15

Deterministic Finite Automaton

Deterministic Finite Automaton. A deterministic finite automaton (DFA) is a five-tuple A = (Q, , , q 0, F) where Q is a finite set of states  is a finite set of input symbols  is a function : Q   Q called transition function q 0  Q is called the start state

nevina
Télécharger la présentation

Deterministic Finite Automaton

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. Deterministic Finite Automaton • A deterministic finite automaton (DFA) is a five-tuple A = (Q, , , q0, F) where • Q is a finite set of states •  is a finite set of input symbols •  is a function : Q   Q called transition function • q0  Q is called the start state • F  Q is called the set of accepting states

  2. Deterministic Finite Automaton • Transition diagram for a DFA is graph defined as follows: • For each state there is a node labeled by the state • If (q, a) = p, then there is an arc from q to p labeled by a • There is an arrow into the start state q0 labeled start, The arrow does not originate at any node • Nodes corresponding to accepting states marked by double circles

  3. Deterministic Finite Automaton • A transition table is a tabular representation of the transition function. Rows of the table correspond to states and columns correspond to input symbols. The entry if the cell indexed by state q and input a is (q, a). The start state is marked with an arrow, the final states are marked with *.

  4. Deterministic Finite Automaton 0,1 0 1 1 0 q2 q0 q1

  5. Deterministic Finite Automaton • Transition function on strings: Let w=xa 1) 2)

  6. Deterministic Finite Automaton • A DFA accepts a string w if is a final state • The set of all strings accepted by a DFA, A, is the language of the DFA denoted by L(A). The DFA A is said to accept/define a language L if L(A) = L

  7. 1 q1 q0 1 0 0 0 0 1 q2 q3 1 Example L= {w | w has even 0s and even 1s}

  8. Nondeterministic Finite Automaton • A nondeterministic finite automaton (DFA) is a five-tuple A = (Q, , , q0, F) where • Q is a finite set of states •  is a finite set of input symbols •  is a function : Q   2Q called transition function • q0  Q is called the start state • F  Q is called the set of accepting states

  9. Nondeterministic Finite Automaton • Extended transition function: • The language of an NFA A = (Q, , , q0, F):

  10. 0,1 start q0 q1 q2 0 1 Example – L = {w | w ends with 01}

  11. Equivalence of DFA and NFA • Subset construction: Let N = (QN,, N, q0, FN) be an NFA, construct a DFA D = (QD, , D, {q0 }, FD ) as follows: • QD is the set of all subsets of QN • FD is the set of subsets S of QN whose intersection with FN is not empty • For each set S  QN and each input symbol a

  12. Equivalence of DFA and NFA • Theorem: If D = (QD, , D, {q0 }, FD ) is the DFA constructed from the NFA N = (QN,, N, q0, FN) by the subset construction, then L(D) = L(N) • Theorem: A language L is accepted by some DFA if and only if L is accepted by some NFA

  13. 0,1  0 1 q0 q1 q2 q3 Finite Automata with -transitions • An -NFA N = (Q, , , q0, F) where the definitions of Q, , q0, and F are same as for an NFA.  is defined as follows: : Q X   {}  2Q

  14. Function ECLOSE • Epsilon-closure (ECLOSE): /* associates a set of states with a given state */ basis: state q is in ECLOSE(q)induction: if p is in ECLOSE(q) and (p, ) contains r, then r also is in ECLOSE(q)

  15. Eliminating -transitions Let E = (QE,, E, q0, FE), then the equivalent DFA D = (QD, , D, qD , FD ) is defined as follows: • QD is the set of subsets of QE • qD = ECLOSE({q0 }) • (S, a) = ECLOSE( E (p, a)) where p  S • FD = {S | S is in QD and SFE  }

More Related