Residuals of string functions #
This file characterizes the subsequential, Mealy-computable and bimachine-computable functions by
their residuals, in the style of the Myhill–Nerode theorem for languages. The prefix function of
f : List α → List β sends a word u to the longest common prefix of the outputs of f on the
extensions of u, and the residual of f by u sends v to what f outputs on u ++ v
beyond that prefix. Residuals compose as a right action of words,
and a function is subsequential if and only if it has finitely many residuals, the
characterization of Oncina and García recalled by Chandlee, Eyraud and Heinz. A subsequential
function is Mealy-computable exactly when it is also length- and prefix-preserving, the Nerode
criterion of Eilenberg and Holcombe.
A length-preserving function whose output at a position can depend on input unboundedly far to its right, as in bidirectional harmony, has infinitely many residuals in this sense. Such functions are characterized instead by their synchronous residuals and coresiduals, which cut the output where the input is cut: a length-preserving function is bimachine-computable if and only if it has finitely many of each, the length-preserving stratum of the canonical bimachine of Reutenauer and Schützenberger surveyed by Filiot and Reynier.
Main definitions #
Function.prefixFunction f u: the longest common prefix offon the extensions ofuFunction.residual f u: the residual offby the worduFunction.syncResidual f u,Function.syncCoresidual f y: the output afteruand beforeyof a length-preservingf
Main results #
Function.residual_append: residuals compose as a right action of wordsisLeftSubsequential_iff_finite_range_residual:fis left-subsequential if and only if it has finitely many residualsisMealyComputable_iff_residual:fis Mealy-computable if and only if it is length- and prefix-preserving with finitely many residualsisLengthPreservingBimachineComputable_iff_syncResidual: a length-preservingfis bimachine-computable if and only if it has finitely many synchronous residuals and coresiduals
Implementation notes #
The prefix function takes the supremum in ℕ of the lengths of the common prefixes, so it and
the residual are noncomputable. For a prefix-preserving f the prefix function is f itself
(prefixFunction_eq_self) and the residual drops f u (residual_eq_drop), which on
length-preserving functions is the synchronous residual (residual_eq_syncResidual).
References #
- S. Eilenberg, Automata, Languages and Machines, Volume A (1974)
- W. M. L. Holcombe, Algebraic Automata Theory (1982)
- C. Reutenauer and M. P. Schützenberger, Minimization of Rational Word Functions (1991)
- E. Filiot and P. A. Reynier, Transducers, Logic and Algebra for Functions of Finite Words (2016)
- J. Chandlee, R. Eyraud and J. Heinz, Output Strictly Local Functions (2015)
The prefix function and residuals #
The prefix function of f sends u to the longest common prefix of the outputs of f
on the extensions of u, the output already determined after reading u.
Equations
- Function.prefixFunction f u = List.take (sSup {n : ℕ | n ≤ (f u).length ∧ ∀ (w : List α), List.take n (f u) <+: f (u ++ w)}) (f u)
Instances For
The residual of f by u sends v to what f outputs on u ++ v beyond the prefix
function at u, the analogue for string functions of Language.leftQuotient.
Equations
- Function.residual f u v = List.drop (Function.prefixFunction f u).length (f (u ++ v))
Instances For
The prefix function at u is the greatest common prefix of f on the extensions of
u.
A function prefix-preserving at u extends its output on u by the residual.
If f on the extensions of u is P followed by g on the extensions of v, then its
prefix function at u is P followed by that of g at v.
Residuals through a state summary #
A function that extends its output by one block per letter, the block read off a summary W
of the input whose update is determined, has residuals that factor through W; conversely a
prefix-preserving function whose residuals factor through W extends by blocks read off W.
The strictly local function classes are the instances with W a bounded window.
A function extending its output at every letter is prefix-preserving.
Residuals of a function built block by block from a state summary factor through it.
A prefix-preserving function whose residuals factor through W extends by blocks read
off W.
Myhill–Nerode for subsequential transducers #
Residuals of a transducer's run factor through its states.
A function with finitely many residuals is left-subsequential. The residuals are the states,
each emitting its prefix function on the next letter and its value on [] at the end, and a
fresh start state reads the first letter off f itself.
Myhill–Nerode for subsequential transducers. A function is left-subsequential if and only if it has finitely many residuals ([CEH15], after Oncina and García).
A function is right-subsequential if and only if its reverse-conjugate has finitely many residuals.
Myhill–Nerode for Mealy machines #
Residuals of a machine's run are its runs from the states it reaches.
A length-preserving f with a finite state : List α → σ that is left-congruent
(hδ) and determines f's output at each position (hout) is Mealy-computable.
A length-preserving, prefix-preserving function with finitely many residuals is Mealy-computable, with the residuals themselves as the states.
Myhill–Nerode for Mealy machines. A function is Mealy-computable if and only if it is length-preserving, prefix-preserving, and has finitely many residuals.
Synchronous residuals and coresiduals #
The synchronous residual of f by u is the output of f on u ++ v past the first
u.length symbols, the cells after u of a length-preserving f.
Equations
- Function.syncResidual f u v = List.drop u.length (f (u ++ v))
Instances For
The synchronous coresidual of f by y is the output of f on u ++ y up to its
first u.length symbols, the cells before y of a length-preserving f.
Equations
- Function.syncCoresidual f y u = List.take u.length (f (u ++ y))
Instances For
Synchronous coresiduals step by prepending a letter, the right-to-left congruence.
The cell at the seam, read through the synchronous residual.
The cell at the seam, read through the synchronous coresidual.
On a length- and prefix-preserving function the residual is the synchronous residual.
Myhill–Nerode for bimachines #
Scanning past a prefix reseeds the left state.
Dropping a scanned prefix of a letter-to-letter bimachine run reseeds the left state.
Taking the unscanned prefix of a bimachine run reseeds the right state.
Residuals of a bimachine's run reseed the left automaton.
Coresiduals of a bimachine's run reseed the right automaton.
Necessity #
Sufficiency #
A length-preserving f with finite left and right summaries, congruent in their
respective scan directions and jointly determining each output cell, is
bimachine-computable.
A length-preserving function with finitely many residuals and coresiduals is bimachine-computable, with syncResidual classes as the left states and syncCoresidual classes as the right states, and with the cell output read off representatives, which is well-defined by exchanging one context at a time.
Myhill–Nerode for bimachines. A function is bimachine-computable if and only if it is length-preserving with finitely many residuals and finitely many coresiduals.