[Paper Review] Regular Combinators for String Transformations
This paper presents a machine-independent, algebraic characterization of regular string transformations using a minimal set of combinators—choice, split sum, iterated sum, left-additive split sum, sum of functions, and chained sum—that capture all functions computable by two-way finite-state transducers or MSO-definable graph transformations. The key contribution is a complete and minimal combinatorial foundation for regular functions over arbitrary monoids, including non-commutative ones, enabling declarative specification of complex string transformations such as reversal and copying.
We focus on (partial) functions that map input strings to a monoid such as the set of integers with addition and the set of output strings with concatenation. The notion of regularity for such functions has been defined using two-way finite-state transducers, (one-way) cost register automata, and MSO-definable graph transformations. In this paper, we give an algebraic and machine-independent characterization of this class analogous to the definition of regular languages by regular expressions. When the monoid is commutative, we prove that every regular function can be constructed from constant functions using the combinators of choice, split sum, and iterated sum, that are analogs of union, concatenation, and Kleene-*, respectively, but enforce unique (or unambiguous) parsing. Our main result is for the general case of non-commutative monoids, which is of particular interest for capturing regular string-to-string transformations for document processing. We prove that the following additional combinators suffice for constructing all regular functions: (1) the left-additive versions of split sum and iterated sum, which allow transformations such as string reversal; (2) sum of functions, which allows transformations such as copying of strings; and (3) function composition, or alternatively, a new concept of chained sum, which allows output values from adjacent blocks to mix.
Motivation & Objective
- To provide an algebraic, machine-independent characterization of regular string transformations analogous to regular expressions for regular languages.
- To identify a minimal set of combinators that can construct all regular functions mapping strings to values in a monoid, including non-commutative monoids.
- To extend the theory of regular functions beyond commutative monoids to capture natural string transformations like reversal and copying, which are not expressible with classical one-way transducers.
- To formalize the expressive power of regular functions using a foundation that supports practical applications in document processing, program verification, and string transformation learning.
- To introduce and justify the necessity of the chained sum combinator for enabling mixing of outputs across adjacent blocks in unambiguous parsing.
Proposed method
- Define base functions as constant mappings from strings in a base language to a monoid value, ensuring unambiguous parsing.
- Introduce core combinators: conditional choice (f ▹ g), split sum (f ⊕ g), and iterated sum (∑f), which generalize union, concatenation, and Kleene-*, respectively, with unique parsing constraints.
- Extend the framework with left-additive versions of split sum and iterated sum to support transformations like string reversal that require processing from both ends.
- Introduce the sum of functions combinator to enable copying and duplication of string segments.
- Introduce the chained sum combinator (or function composition) to allow output values from adjacent processing blocks to mix, enabling complex data flow across non-contiguous input segments.
- Prove expressive completeness by showing that all regular functions—especially those requiring two-way or non-deterministic behavior—can be constructed using these combinators, with a formal proof via shape-based decomposition and register state tracking.
Experimental results
Research questions
- RQ1Can regular string transformations, including non-commutative monoid outputs, be characterized using a minimal, algebraic, and machine-independent set of combinators?
- RQ2What additional combinators are necessary to express transformations like string reversal and copying, which are not expressible with one-way transducers?
- RQ3How can the notion of unambiguous parsing be preserved while enabling complex data flow across multiple input segments and output blocks?
- RQ4Is the set of combinators (including chained sum) both necessary and sufficient to capture all regular functions over arbitrary monoids?
- RQ5Can a declarative language for document processing be built on this foundation, enabling correct-by-construction string transformations?
Key findings
- The class of regular functions mapping strings to values in a monoid is completely characterized by a finite set of combinators: choice, split sum, iterated sum, left-additive split sum, sum of functions, and chained sum.
- For commutative monoids, all regular functions can be constructed using only choice, split sum, and iterated sum, ensuring unambiguous parsing and closure under composition.
- For non-commutative monoids, the additional combinators—left-additive split sum, sum of functions, and chained sum—are necessary and sufficient to express all regular string transformations, including reversal and copying.
- The chained sum combinator is essential for enabling output mixing across adjacent blocks, a capability not supported by standard composition or concatenation.
- The proof of expressive completeness relies on a shape-based decomposition of transducer behavior, tracking register states and input segment interactions via formal update expressions.
- The framework provides a foundation for a declarative language for document processing, with potential applications in string transformation learning, web address sanitization, and program verification.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.