• Aucun résultat trouvé

If a language is accepted by a finite-state automaton, then it is also decided by a deterministic finite-state automaton that has no transition rules

Bibliographic Notes

Theorem 2.3.1 If a language is accepted by a finite-state automaton, then it is also decided by a deterministic finite-state automaton that has no transition rules

Figure 2.3.3 A deterministic finite-state automaton.

M1 has two transition rules, and M2 has one.

A configuration , or an instantaneous description, of the finite-state automaton is a singleton uqv, where q is a state in Q, and uv is a string in *. The configuration is said to be an initial configuration if u = and q is the initial state. The configuration is said to be an accepting , or final, configuration if v = and q is an accepting state. With no loss of generality it is assumed that Q and are mutually disjoint.

Other definitions, like those of M , , M *, *, and acceptance, recognition, and decidability of a language by a finite-state automaton, are similar to those given for finite-state transducers.

Nondeterminism versus Determinism in Finite-State Automata

By the following theorem, nondeterminism does not add to the recognition power of finite-state automata, even though it might add to their succinctness. The proof of the theorem provides an algorithm for

constructing, from any given n-state finite-state automaton, an equivalent deterministic finite-state automaton of at most 2n states.

Theorem 2.3.1 If a language is accepted by a finite-state automaton, then it is also decided by a deterministic finite-state automaton that has no transition rules.

Proof Consider any finite-state automaton M = <Q, , , q0, F>. Let Ax denote the set of all the states

that M can reach from its initial state q0, by the sequences of moves that consume the string x, that is, the set { q | q0x * xq }. Then an input w is accepted by M if and only if Aw contains an accepting state.

The proof relies on the observation that Axa contains exactly those states that can be reached from the states in Ax, by the sequences of transition rules that consume a, that is, Axa = { p | q is in Ax, and qa *

Figure 2.3.4 Sequences of transition rules that consume xa.

Consequently, q is in Ax and the subsequence i+1, . . . , t of transition rules takes M from state q to state p while consuming a.

On the other hand, if q is in Ax and if p is a state that is reachable from state q by a sequence 1, . . . , s of transition rules that consumes a, then the state p is in Axa. In such a case, if '1, . . . , 'r is a sequence of transition rules that takes M from the initial state q0 to state q while consuming x, then M can reach the state p from state q0 by the sequence '1, . . . , 'r, 1, . . . , s of transition rules that consumes xa (see Therefore, a deterministic finite-state automaton M' of the following form decides the language that is accepted by M.

The set of states of M' is equal to { A | A is a subset of Q, and A = Ax for some x in * }. Since Q is finite, it follows that Q has only a finite number of subsets A, and consequently M' has also only a finite number of states. The initial state of M' is the subset of Q that is equal to A . The accepting states of M' are those states of M' that contain at least one accepting state of M. The transition table of M' is the set { (A, a, A') | A and A' are states of M', a is in , and A' is the set of states that the finite-state automaton M can reach by consuming a from those states that are in A }.

By definition, M' has no transition rules. Moreover, M' is deterministic because, for each x in * and each a in , the set Axa is uniquely defined from the set Ax and the symbol a.

Example 2.3.3 Let M be the finite-state automaton whose transition diagram is given in Figure 2.3.2.

The transition diagram in Figure 2.3.5

Figure 2.3.5 A transition diagram of an -free, deterministic finite-state automaton that is equivalent to the finite-state automaton whose transition diagram is given in Figure 2.3.2.

represents an -free, deterministic finite-state automaton that is equivalent to M. Using the terminology of the proof of Theorem 2.3.1 A = {q0, q1, q4}, A0 = {q0, q1, q2, q4}, and A00 = A000 = = A0 0 = {q0, q1, q2, q3, q4}.

A is the set of all the states that M can reach without reading any input. q0 is in A because it is the initial state of M. q1 and q2 are in A because M has transition rules that leave the initial state q0 and enter states q1 and q2, respectively.

A0 is the set of all the states that M can reach just by reading 0 from those states that are in A . q0 is in A0 because q0 is in A and M has the transition rule (q0, 0, q0). q1 is in A0 because q0 is in A and M can use

the pair (q0, 0, q0) and (q0, , q1) of transition rules to reach q1 from q0 just by reading 0. q2 is in A0 because q0 is in A and M can use the pair (q0, , q1) and (q1, 0, q2) of transition rules to reach q2 from q0 just by reading 0.

The result of the last theorem cannot be generalized to finite-state transducers, because deterministic finite-state transducers can only compute functions, whereas nondeterministic finite-state transducers can also compute relations which are not functions, for example, the relation {(a, b), (a, c)}. In fact, there are also functions that can be computed by nondeterministic finite-state transducers but that cannot be

computed by deterministic finite-state transducers. R = { (x0, 0|x|) | x is a string in {0, 1}* } { (x1, 1|x|) | x is a string in {0, 1}* } is an example of such a function. The function cannot be computed by a

deterministic finite-state transducer because each deterministic finite-state transducer M satisfies the following condition, which is not shared by the function: if x1 is a prefix of x2 and M accepts x1 and x2, then the output of M on input x1 is a prefix of the output of M on input x2 (Exercise 2.2.5).

Finite-State Automata and Type 3 Grammars

The following two results imply that a language is accepted by a finite-state automaton if and only if it is a Type 3 language. The proof of the first result shows how Type 3 grammars can simulate the

computations of finite-state automata.