Evaluation of a subsequential finite-state transducer
DefinitionTuring_SubsequentialTransducer_runautomataturing-machines
A deterministic transition reads one input letter, updates the state, and produces a finite output word. The output is the concatenation of the words along the run, followed by the final state’s output word.
Definition code
import Mathlib.Init
namespace Turing.SubsequentialTransducer
/-- Run a finite-state transducer that emits a word on each transition and at end of input. -/
def run {A B S : Type} (step : S → A → S × List B) (finish : S → List B) :
S → List A → List B
| s, [] => finish s
| s, a :: xs => (step s a).2 ++ run step finish (step s a).1 xs
end Turing.SubsequentialTransducer
Source
Mehryar Mohri, Finite-State Transducers in Language and Speech Processing, Computational Linguistics 23(2), 1997, p. 272, https://aclanthology.org/J97-2003/.