Finite State Transducers
A Mealy machine is usually defined as a 6-tuple
M=(Q,A,B,δ,f,q0)i.e., a finite state machine with two associated alphabets (input and output) and two associated functions (transition and output) and no final states.
Where
Q = set of states
A = input alphabet
B = output alphabet
δ = transition function Q x A -> Q
f = output function Q x A -> B
q0 = initial or start state
Matt Foley Pictorial Example:
____
---- a/X | | b/U ----
| |--------->| |--------->| |
---->| s0 | | s1 | | s2 |
---- | |<--------- ----
^ | ---- a/V |
a/X| |b/Y | | b/T
| V | |
---- |a/S V
| |_____ | ---- _______
| s4 | | b/Y ------------->| | | a/S,b/T
---- <---- | s3 |<------
----
Q = {s0, s1, s2, s3, s4}
A = {a,b}
B = {S,T,U,V,X,Y}
q0 = s0
δ: Q x A -> Q f: Q x A -> B
Q \ A | a | b Q \ A| a | b -------|--------|---------- -------|--------|---------- s0 | s1 | s4 s0 | X | Y -------|--------|---------- -------|--------|---------- s1 | s3 | s2 s1 | S | U -------|--------|---------- -------|--------|---------- s2 | s1 | s3 s2 | V | T -------|--------|---------- -------|--------|---------- s3 | s3 | s3 s3 | S | T -------|--------|---------- -------|--------|---------- s4 | s1 | s4 s4 | X | Y
Extending δ to operate on strings.
Given Mealy machine M with transition function δ, and output function f, define δ' and f' as:
δ' : Q x A* -> Q
δ'(q,λ) = q - on null input stays in original state
δ'(q,a) = δ(q,a) if a in A
δ'(q,w) = δ'(d(q,a),x) if w = ax for a in A, x in A*
And
f' : Q x A* -> B
f'(q,ε) = ε - on null input, no output
f'(q,a) = f(q,a) if a in A
f'(q,w) = f(q,a) . f'(δ(q,a),x) if w = ax for a in A, x in A*
(using '.' to denote concatenation.)
These are called the extended transition and output functions, respectively.
δ : Q X A X B -> QRather than producing output, this FST considers what would have been output from a Mealy machine as a part of the input.
We can then note that with this definition an FST can be viewed as:
it might be beneficial to call this a ``translation recognizer'' - is the pair of strings (input/output) a valid translation from one to the other
again, it might be beneficial to call this a ``translation generator'' - each transition can be considered as generating the output character from the input character (or vice versa).
Test the following on the above example to see what the output string would be.
baab
baabb
bab
babaaba