Subsequential functions and finite-state transducers #
A subsequential transducer, in the sense of Schützenberger and Mohri, is a sequential
transducer together with a final block of output determined by the ending state. A sequential
transducer is a deterministic state machine emitting a block of output for each input symbol,
which is a Mealy machine over the output alphabet List β. The functions so computed,
subsequential with left- and right-scan variants, form a proper subclass of the rational
functions.
We show that each class is closed under composition, that the two are isomorphic under
reverse-conjugation, that both contain the Mealy-computable functions, and that
left-subsequential functions pull back regular languages; a subsequential function
withholds at most a bounded stretch of output (bounded_delay).
Like DFA, this definition allows for machines with infinite states; the
classification predicates require a Fintype instance.
Main definitions #
SubsequentialTransducer σ α β: transducer over alphabetsα,βand statesσSubsequentialTransducer.run/SubsequentialTransducer.runRight: the two passesSubsequentialTransducer.comp: the machine computing the composite functionSubsequentialTransducer.ofWindow: the sliding-window transducerDFA.comapSubsequential: pulls an acceptor back along a transducerIsLeftSubsequential f,IsRightSubsequential f,IsSubsequential d f: some finite-state transducer computesfin the given scan direction
Main theorems #
IsLeftSubsequential.comp,IsRightSubsequential.comp: closure under compositionIsMealyComputable.isLeftSubsequential: Mealy-computable functions are left-subsequentialIsLeftSubsequential.isRegular_preimage,IsRightSubsequential.isRegular_preimage: subsequential functions pull back regular languagesIsLeftSubsequential.bounded_delay,IsRightSubsequential.bounded_delay: all but boundedly many symbols off usurvive extending the input on the far side
Implementation notes #
The name follows Choffrut and Mohri: sequential without state-final output,
subsequential with. Sakarovitch calls this class sequential (and the empty-flush case
pure sequential), flagging his usage as unconventional (compare Bruyère and Reutenauer); we
keep the Choffrut spelling. Mealy is the letter-to-letter case.
step is total, so only the total subsequential functions are modelled, since a sink state
does not recover partiality, and Sakarovitch's initial-output function is omitted. The state run
stateAfter and its lemmas are those of the underlying Mealy machine. There are two disjoint
sets of simp lemmas, one for run and another for runFrom; switch from the former to the
latter via simp [run].
TODO #
- Choffrut's theorem: a rational function is subsequential iff it has
bounded variation, decidably via twinning;
bounded_delayis far weaker. - Canonical forms and minimization; two-way transducers; p-subsequential functions.
References #
A subsequential finite-state transducer is a sequential transducer — a Mealy
machine whose output is the block of symbols emitted on reading an input symbol in a
state — together with a state-final output (finalOutput).
- start : σ
- step : σ → α → σ
- output : σ → α → List β
- finalOutput : σ → List β
finalOutput sis the block emitted on terminating in the states.
Instances For
Equations
- instInhabitedSubsequentialTransducer = { default := { toMealy := default, finalOutput := fun (x : σ) => [] } }
T.emitted s x is the output emitted while consuming the input x from the
state s without the final flush, the concatenated blocks of the sequential run.
Instances For
T.runFrom s x runs T on the input x from the state s, emitting the output followed
by the final flush.
Equations
- T.runFrom s xs = T.emitted s xs ++ T.finalOutput (T.stateAfter s xs)
Instances For
T.run x runs T on the input x from the state T.start.
Instances For
T.runRight x runs T right-to-left on the input x.
Instances For
Transport along state equivalences #
Transport a transducer along an equivalence on states.
Equations
- SubsequentialTransducer.map g T = { toMealy := Mealy.map g T.toMealy, finalOutput := fun (t : τ) => T.finalOutput (g.symm t) }
Instances For
reindex g is map g as an equivalence of machines.
Equations
- SubsequentialTransducer.reindex g = { toFun := SubsequentialTransducer.map g, invFun := SubsequentialTransducer.map g.symm, left_inv := ⋯, right_inv := ⋯ }
Instances For
Composition #
T₂.comp T₁ feeds each output block of T₁ to T₂, computing T₂.run ∘ T₁.run, which
is the construction behind the closure of the subsequential functions under composition
[Moh97].
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pulling back acceptors #
M.comapSubsequential T pulls the acceptor M back along the transducer T. The
product machine runs T, feeds each output block to M, and accepts in a state from which M
accepts the final flush, so it accepts x if and only if M accepts T.run x.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Window transducers #
The transducer whose state is a window of the last n accumulated symbols. out
emits from the window and the current symbol, and upd chooses what the window accumulates
(fun _ x ↦ [x] for the input, out for the output).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The window recursion computed by ofWindow, each step of which emits out and extends the
window by upd, truncated to length n.
Equations
- SubsequentialTransducer.windowRun n out upd x✝ [] = []
- SubsequentialTransducer.windowRun n out upd x✝ (x_2 :: xs) = out x✝ x_2 ++ SubsequentialTransducer.windowRun n out upd ((x✝ ++ upd x✝ x_2).rtake n) xs
Instances For
The window after reading u is the last n symbols of the update stream, so a window
recursion extends by one block per letter.
Letter-to-letter machines as block transducers #
A Mealy machine is a SubsequentialTransducer emitting singleton blocks with an
empty final flush; LetterToLetter witnesses the singleton blocks, and the two views
are mutually inverse.
A Mealy machine as a block SubsequentialTransducer, with singleton outputs and an empty
flush.
Equations
Instances For
A witness that every output block of T is a singleton, named by cell.
- cell : σ → α → β
cell s ais the symbol emitted on readingain the states. Every output block is that singleton.
Instances For
Extract a witness from a bound on block lengths.
Equations
- SubsequentialTransducer.LetterToLetter.ofLength hs = { cell := fun (s : σ) (x : α) => (T.output s x).head ⋯, output_eq := ⋯ }
Instances For
w.toMealy is the Mealy machine emitting each cell's symbol.
Instances For
A letter-to-letter transducer with no final flush is the block form of its Mealy view.
A finite-state letter-to-letter transducer with no final flush computes a Mealy-computable function.
The canonical witness that a Mealy machine's block form is letter-to-letter.
Equations
- T.letterToLetter = { cell := T.output, output_eq := ⋯ }
Instances For
Subsequential classification predicates #
A function f : List α → List β is left-subsequential if some finite-state
transducer computes it via left-to-right scan [Moh97].
Equations
- IsLeftSubsequential f = ∃ (σ : Type) (x : Fintype σ) (T : SubsequentialTransducer σ α β), T.run = f
Instances For
A function f : List α → List β is right-subsequential if its reverse-conjugate
is left-subsequential — equivalently, some finite-state transducer computes it via
right-to-left scan (isRightSubsequential_iff).
Equations
Instances For
A function f : List α → List β is subsequential from the edge d if some finite-state
transducer computes it by a scan starting from that edge.
Equations
Instances For
IsLeftSubsequential holds as soon as a transducer with states in any universe computes
f.
IsRightSubsequential holds as soon as a transducer with states in any universe computes
f right to left.
Every finite-state transducer computes a left-subsequential function, whatever the universe of its state type.
Every finite-state transducer computes a right-subsequential function via
runRight.
Reverse conjugation #
The reverse-conjugate of a right-subsequential function is left-subsequential, by definition.
The reverse-conjugate of a left-subsequential function is right-subsequential.
Mealy-computable functions #
A Mealy-computable function is left-subsequential, since
Mealy.toSubsequentialTransducer presents a Mealy machine as a block transducer emitting
singleton blocks.
A finite Mealy machine computes a left-subsequential function.
A finite Mealy machine run right-to-left computes a right-subsequential function.
Window functions #
A window recursion over a finite window alphabet is left-subsequential, the bounded window
being the state of SubsequentialTransducer.ofWindow.
A window recursion emitting exactly one symbol per step is Mealy-computable, with the bounded window as the synchronous state.
Closure under composition #
Left-subsequential functions are closed under composition, by
SubsequentialTransducer.comp [Moh97].
Right-subsequential functions are closed under composition, by conjugating the left closure.
Subsequential functions are closed under composition in either scan direction.
Regular preimages #
Left-subsequential functions pull back regular languages (DFA.comapSubsequential).
Right-subsequential functions pull back regular languages, by conjugating the left case through the closure of the regular languages under reversal.
Subsequential functions pull back regular languages in either scan direction.
Bounded delay #
A left-subsequential function withholds at most the longest state-final output, so all but
the last N symbols of f u are a prefix of f (u ++ v). This is much weaker than
[Cho77]'s bounded-variation characterization, comparing u only with its own
extensions.
For a right-subsequential f, all but the first N symbols of f u are a suffix of
f (v ++ u).
Coordinates of f u more than N positions before its end are stable under extending the
input, for a left-subsequential f.
A length-preserving left-subsequential function is oblivious to input beyond a fixed
margin of each output coordinate, since the delay bound of exists_getElem?_append_eq caps how
far to the right an output coordinate can look.
Coordinates of f u at least N positions from its start are stable under extending the
input on the left, for a length-preserving right-subsequential f.
A length-preserving right-subsequential function is oblivious to input beyond a fixed margin to the left of each output coordinate.
f is not left-subsequential if for every N some images f u and f (u ++ v)
disagree more than N positions before the end of f u — the contrapositive of
bounded_delay.