Xerox Research Centre Europe
Copyright © 1996 Xerox Corporation.

Finite-State Quizz

Question: What is the regular expression that compiles into the following transducer?
    fs0:  ? -> fs0, a -> fs1, b -> fs0.
    fs1:  ? -> fs0, a -> s2, b -> fs0, <a:b> -> fs3.
    s2:   ? -> fs0, a -> s2, b -> fs0, <a:b> -> fs3.
    fs3:  (no arcs)
Answer: There is no unique answer. Any finite-state language or relation can be described by an infinite number of equivalent regular expressions. Some are simple, some more complicated. Perhaps the simplest one in this case is
    a -> b || a _ .#.
It denotes all pairs of strings that are identical except that any final "a" that is preceded by another "a" in the upper-language string gets replaced by "b" in the corresponding lower-language string. For example, this transducer maps "baaa" into "baab". Another regular expression describing the same relation is
    [?* - [?* a a]] | [?* a a:b]

The diagram below represents the same network as the table above.

Arcs that differ only with respect to the label are represented in the diagram by a single multiply labeled arc. For example, the loop in state 0 represents the arcs ? -> fs0 and b -> fs0. Final states are marked with a double circle.


Copyright © The Document Company - Xerox 1997 . All rights reserved.
Written by Lauri Karttunen. Last modified on Jan. 12, 1998 .