Deterministic finite-state automata

5.1.1 Deterministic finite-state automata

  Finite-state automata come in two flavours: deterministic and nondeterministic. We start with a description of deterministic finite-state automata, the simplest form of automata.

  Definition 1: Deterministic finite-state automaton, DFA

  deter-

  A deterministic finite-state automaton (DFA) is a 5-tuple (X, Q, d, S, F ) where

  mi-

  • X is the input alphabet,

  nistic

  • Q is a finite set of states,

  finite-

  • d :: Q → X → Q is the state transition function,

  state

  • S ∈ Q is the start state,

  auto-

  • F ⊆ Q is the set of accepting states.

  maton

  As an example, consider the DFA M 0 = (X, Q, d, S, F ) with

  X = {a, b, c} Q = {S, A, B, C}

  F = {C} where state transition function d is defined by

  dSa = C dSb = A

  dSc = S dAa = B

  dBc = C For human beings, a finite-state automaton is more comprehensible in a graphical

  representation. The following representation is customary: states are depicted as the nodes in a graph; accepting states get a double circle; start states are explicitly mentioned or indicated otherwise. The transition function is represented by the edges: whenever d Q i x is a state Q j , then there is an arrow labelled x from Q i

  to Q j . The input alphabet is implicit in the labels. For automaton M 0 above, the

  pictorial representation is:

  5.1 Finite-state automata

  c GF A ED

  89:; ?>=< S a

  ?>=< 89:; .-, ()+ C

  A ?>=< 89:; B

  Note that d is a partial function: for example d B a is not defined. We can make d into a total function by introducing a new ‘sink’ state, the result state of all undefined transitions. For example, in the above automaton we can introduce a sink state D with d D x = D for all terminals x, and d E x = D for all states E and terminals x for which d E x is undefined. The sink state and the transitions fromto it are almost always omitted.

  The action of a DFA on an input string is described as follows: given a sequence w of input symbols, w can be ‘processed’ symbol by symbol (from left to right) and — depending on the specific input symbol — the DFA (initially in the start state) moves to the state as determined by its state transition function. If no move is possible, the automaton blocks. When the complete input has been processed and the DFA is in one of its accepting states, then we say that w is accepted by the automaton.

  accept

  To illustrate the action of an DFA, we will show that the sentence bac is accepted

  by M 0 . We do so by recording the successive configurations, i.e. the pairs of current state and remaining input values.

  (S, bac)

  (C, ) Because of the deterministic behaviour of a DFA the definition of acceptance by

  a DFA is relatively easy. Informally, a sequence w ∈ X ∗ is accepted by a DFA (X, Q, d, S, F ), if it is possible, when starting the DFA in S, to end in an accepting state after processing w. This operational description of acceptance is formalised in the predicate dfa accept . The predicate will be derived in a top-down fashion, i.e. we formulate the predicate in terms of (“smaller”) subcomponents and afterwards we give solutions to the subcomponents.

  Suppose dfa is a function that reflects the behaviour of the DFA, i.e. a function which given a transition function, a start state and a string, returns the unique state that is reached after processing the string starting from the start state. Then the predicate dfa accept is defined by:

  dfa accept :: X ∗ → (Q → X → Q, Q, {Q}) → Bool

  dfa accept w (d, S, F ) = (dfa d S w) ∈ F

  Regular Languages

  It remains to construct a definition of function dfa that takes a transition function,

  a start state, and a list of input symbols, and reflects the behaviour of a DFA. The definition of dfa is straightforward

  dfa d q (ax) = dfa d (d q a) x Note that both the type and the definition of dfa match the pattern of the function

  foldl , and it follows that we can write function dfa as a foldl .

  dfa d q = foldl d q.

  Definition 2: Acceptance by a DFA

  The sequence w ∈ X ∗ is accepted by DFA (X, Q, d, S, F ) if

  dfa accept w (d, S, F ) where

  dfa accept w (d, qs, fs) = dfa d qs w ∈ fs dfa d qs

  = foldl d qs

  2 Using the predicate dfa accept , the language of a DFA is defined as follows.

  Definition 3: Language of a DFA

  For DFA M = (X, Q, d, S, F ), the language of M , Ldfa(M ), is defined by

  Ldfa(M ) = {w ∈ X ∗ | dfa accept w (d, S, F )}

Dokumen yang terkait

Analisis Komparasi Internet Financial Local Government Reporting Pada Website Resmi Kabupaten dan Kota di Jawa Timur The Comparison Analysis of Internet Financial Local Government Reporting on Official Website of Regency and City in East Java

19 819 7

ANTARA IDEALISME DAN KENYATAAN: KEBIJAKAN PENDIDIKAN TIONGHOA PERANAKAN DI SURABAYA PADA MASA PENDUDUKAN JEPANG TAHUN 1942-1945 Between Idealism and Reality: Education Policy of Chinese in Surabaya in the Japanese Era at 1942-1945)

1 29 9

Improving the Eighth Year Students' Tense Achievement and Active Participation by Giving Positive Reinforcement at SMPN 1 Silo in the 2013/2014 Academic Year

7 202 3

Improving the VIII-B Students' listening comprehension ability through note taking and partial dictation techniques at SMPN 3 Jember in the 2006/2007 Academic Year -

0 63 87

The Correlation between students vocabulary master and reading comprehension

16 145 49

The correlation intelligence quatient (IQ) and studenst achievement in learning english : a correlational study on tenth grade of man 19 jakarta

0 57 61

An analysis of moral values through the rewards and punishments on the script of The chronicles of Narnia : The Lion, the witch, and the wardrobe

1 59 47

Improping student's reading comprehension of descriptive text through textual teaching and learning (CTL)

8 140 133

The correlation between listening skill and pronunciation accuracy : a case study in the firt year of smk vocation higt school pupita bangsa ciputat school year 2005-2006

9 128 37

Transmission of Greek and Arabic Veteri

0 1 22