This was a project conducted during MATS 5.0 under the mentorship of Vanessa Kosoy and supported by a grant from BERI. It builds off the String Machines framework (and depends on the linked post for certain definitions), which models category-theoretic generalizations of finite-state transducers. [EDIT: The results here can also be found presented in self-contained form, in this paper.]
The framework as it previously existed did not have representation-independent ways of bounding (analogues of) time complexity, or natural guarantees that output size would not grow exponentially in input size. We introduce “filtered” transducers, which operate on categories enriched over filtered sets (sets equipped with a function to a partially ordered monoid, where morphisms are functions respecting order), and then, restricting our attention to transducers with a finite state space, prove constraints on the time complexity growth and expressivity of string machines.
Parameterizing complexity in string machines
Filtered transducers
Definition 1. The category FiltSet of filtered sets is the category such that
an object is a tuple (S,degS), where S is a set and degS:S→N is a function,
a morphism f:(S,degS)→(T,degT) is a function S→T such that degT(f(s))≤degS(s) for all s∈S.
We will generally refer to objects in FiltSet solely by the symbol corresponding to the underlying set going forward. One can observe that the identity function on a set S by definition satisfies degS(idS(s))=degS(s) for all s∈S and is thus a morphism in FiltSet. One can also observe that given f:S→T and g:T→V, degV(g(f(s)))≤degT(f(s))≤degS(s) for all s∈S, and therefore g∘f is also a morphism in FiltSet. Therefore, FiltSet is indeed a category.
Definition 2. Given two objects S,T∈Ob(FiltSet), we define their filtered productS⊗T to be the set S×T equipped with the function degS⊗T:S×T→N satisfying degS⊗T(s,t)=degS(s)+degT(t) for all (s,t)∈S×T. Given a morphism f:S→U and a morphism g:T→V, we define the morphism f⊗g:S⊗T→U⊗V to be the function f×g. Indeed, we have that degU⊗V(f(s),g(t))=degU(f(s))+degV(g(t))≤degS(s)+degT(t)=degS⊗T(s,t), so f⊗g is a morphism in FiltSet.
Due to the associativity and commutativity of addition, as well as the natural associativity and commutativity (up to isomorphisms which are still isomorphisms in FiltSet) of the cartesian product, −⊗− is naturally associative and commutative up to isomorphism. Additionally, the one-element set 1 equipped with deg1(⋅)=0 and unitor maps which are the same as in Set (which are, by their definition, filtered morphisms) provides a left and right unit for −⊗−, making FiltSet a symmetric monoidal category.
Remark. Suppose filtered sets S,T,U and filtered morphisms f:S→T and g:S→U. Then, the unique factoring function S→T×U defined by s↦(f(s),g(s)) is only a filtered morphism S→T⊗U if degT(f(s))+degU(g(s))≤degS(s), which does not hold in general. Therefore, −⊗− does not provide a product except for when at least one of the sets has degree uniformly zero. However, FiltSet does have finite products S×T where degS×T(s,t):=max(degS(s),degT(t)). We will not be using this construction.
Remark. The set-theoretic disjoint union, with its degree function being the canonical factoring map to N of its components’ degree functions, provides all finite coproducts in FiltSet.
Definition 3. A filtered-morphism categoryC is a locally small symmetric monoidal category enriched over FiltSet, using FiltSet’s filtered product −⊗− as its monoidal structure.
This expresses the notion of morphisms having degrees which are subadditive under composition in a way that naturally extends to a complexity constraint on transducers. As the monoidal identity of FiltSet is the single-element set with degree zero, the arrows IFiltSet→HomC(A,A) providing the identity morphism idA in the enrichment construction will ensure that identity morphisms are degree zero.
One can generalize the construction of Filtset by replacing N with any partially-ordered symmetric monoid (where the partial order is, obviously, translation-invariant as it is with the usual definition of a partially-ordered group). We will make use of categories filtered over N2 (with the partial order given by (a,b)≤(c,d) if and only if a≤c and b≤d) in our construction of the filtered state category, as follows:
Definition 4. Given a filtered-morphism category C and a list {(Xi→Yi,aix+bi)}i of C-signatures (generators) and linear polynomials with coefficients in N, the freely-generated N2-filtered category over C with this list of signatures, or C[X1→Y1,…,Xn→Yn], is the symmetric monoidal category where:
objects are exactly the objects of C.
A morphism f:X→Y is either a morphism of C, or obtained by composing morphisms of C with free generators added to HomC(Xi,Yi) for each C-signature Xi→Yi in the list.
The N2-degree of a morphism f is a linear polynomial with coefficients in N, which is either its degree in C (expressed as a constant) if it is a C-morphism, the polynomial aix+bi if it is one of the generators Xi→Yi added when creating the category, or the sum of the degrees of all morphisms involved in its composition, with the degree contributions of composition-chains of C-morphisms being the degrees in C of the morphism they compose to, and these being strictly additive with each other and the degrees of any generator morphisms once all simplifications have been performed.
The monoidal product of a morphism with generators in its composition-chain and a C-morphism is taken to have the sum of their N2-degrees.
We can now introduce filtered state categories.
Definition 5. Given a filtered-morphism category C, its corresponding filtered state categoryCS is the category where
an object A is a tuple (S(A),VA,degA), where:
The state space of A is a set S(A).
The variables of A are a functor VA from the discrete category corresponding to S(A) to the discrete category formed by all finite ordered tuples of pairs of objects X,Y in C. We call the tuple associated with a given x∈S(A)the variables at x, or VA(x). Since variables implicitly denote morphism signatures, we will refer to a given variable (X,Y)∈VA(x) as X→Y.
The degree of a variable X→Y∈VA(x) for some x∈S(A), denoted degA,x(X→Y) (or simply degA(X→Y) if x can be inferred from context) is a tuple (a,b)∈N2. We impose the same partial ordering ≤ on these tuples as we do with degrees in the freely-generated N2-filtered categories.
a morphism f:A→B of degree ℓ, where ℓ∈N, is a tuple (S(f),Vf), where:
The state transitionS(f) is a function S(A)→S(B).
The output function at x∈S(A), denoted Vf(x), is a collection of morphisms in a freely-generated N2-filtered category over C, defined as follows:
For each variable X′j→Y′j of degree a′jx+b′j, at S(f)(x), Vf(x) defines a morphism X′j→Y′j of degree at most a′j(x+ℓ)+b′j=a′jx+(a′jℓ+b′j) (that is, the degree of the morphism cannot exceed this polynomial in either of its terms) in the freely-generated N2-filtered category over C with generators and the degrees of those generators provided by the variables Xi→Yi of degrees aix+bi in VA(x). The function between hom-sets in C can then be expressed by substituting each generator with a C-morphism of the appropriate signature.
This induces a function (but not a filtered one!) between the product of the hom-sets HomC(Xi,Yi) for all variables Xi→Yi at x and the product of the hom-sets HomC(X′j,Y′j) for all variables X′j→Y′j at S(f)(x), which can be obtained by replacing each generator corresponding to a variable at x with a morphism of C of the appropriate signature.
Given two morphisms f:A→B of degree ℓ and g:B→C of degree ℓ′, their composition g∘f:A→C is a tuple (S(g∘f),Vg∘f) where:
The composite state transition S(g∘f) is defined as S(g)∘S(f).
The composite output function Vg∘f(x) is defined as follows: For each variable X′′k→Y′′k defined at S(g∘f)(x), of degree a′′kx+b′′k, Vg(S(f)(x)) defines a morphism of degree at most a′′k(x+ℓ′)+b′′k=a′′kx+(a′′kℓ′+b′k) in the category freely generated over C with generators corresponding to the variables {X′j→Y′j}j at S(f)(x) and their degrees. Now, Vf(x) induces a functor from C[X′1→Y′1,…] to C[X1→Y1,…] (where {Xi→Yi}i denote the variables at x), which fixes C but replaces every free generator of the category freely generated over the variables at S(f)(x) with the morphism associated with it by Vf(x), in the category freely generated over the variables at x. Therefore, the output function Vg∘f(x) at x is simply the image of each of the morphisms generated by Vg(x) under this functor defined by Vf(x). The function between products of hom-sets induced by the composite output function is therefore just the composition of the functions induced by the individual morphisms’ output functions.
Now, for a given variable X′′k→Y′′k at S(f∘g)(x) of degree a′′kx+b′′k, every generator of some degree a′jx+b′j involved in the morphism of (initial) degree a′′kx+a′′kℓ′+b′′k defined by Vg(x) has been replaced with one of degree a′jx+a′jℓ+b′j. Suppose each generator X′j→Y′j appears with multiplicity m′j in the morphism corresponding to X′′k→Y′′k. Then, we have it that ∑jmja′j≤a′′k, and since a′jℓ worth of degree has been added to the morphism for every generator appearing in it, we have that the degree of the morphism generated by Vg∘f(x) must be a′′k+a′′kℓ′+b′′k+∑jmja′jℓ≤a′′k+a′′k(ℓ+ℓ′)+b′′k. So, the degree of g∘f is ℓ+ℓ′.
Remark.CS is a filtered-morphism category with the degrees of morphisms being defined as in the definition of the category, as the identity morphism of each object A has an output function that outputs a variable of degree ax+b (the generator corresponding to the variable itself) for any variable of degree ax+b and is thus of degree zero. Additionally, as also demonstrated in the definition, degree is subadditive with composition, meaning that the composition arrow is indeed a morphism in FiltSet.
Definition 6. A filtered functorF:C→D is an enriched functor between filtered-morphism categories.
Given a filtered functor F:C→D, since the definition of an enriched functor requires the functor’s action on morphisms to be provided by a morphism between hom-objects within the category, it automatically holds that degDF(α)≤degC(α) for all morphisms α in C.
Definition 7. A filtered deterministic transducer is a deterministic transducer where the input and output categories, C and D, are filtered-morphism categories, and the functor F:C→DS affording the transducer structure is a filtered functor to the filtered state category of the output category.
Finite-state string machines
For the following section, we assume a filtered deterministic transducer T with input category C, output category D, structure functor F, input state space S(A), output state space S(B), primary input C-signature X→Y, auxiliary input D-signatures (Xi→Yi)1≤i≤n, and output D-signatures (X′j→Y′j)1≤j≤m. We will now demonstrate that requiring a finite output state space on a transducer provides us with certain output size and time complexity guarantees.
Proposition 1. If S(B) is finite, and, for every x∈S(A), the linear term of the degree of every variable in VA(x) is nonzero, then, for every x∈S(A) and every primary input C-morphism α, the number of copies of the generator corresponding to each auxiliary input Xi→Yi appearing in each morphism corresponding to each output signature X′j→Y′j in VF(α)(S(F(α))(x)) is bounded by a fixed integer k, which does not depend on deg(α).
Proof. Since S(B) is finite, and the number of variables which exist at any state is finite, there exists a variable with maximal linear degree a′max across all variables in all states in S(B), in some state in S(B). No morphism in DS can generate a morphism in the appropriate N2-graded free category over D with linear degree greater than that of its corresponding variable. Therefore, given any starting state x∈S(A), no morphism f:A→B in DS exists where any component of the output function has more than a′max copies of any of the generators corresponding to the variables at x, since each of these will have sizes with linear term at least 1. ◻
Proposition 2. Suppose S(B) is finite, and every variable in every state in S(A) has a linear term of 1 or greater in its degree. Denote the primary input morphism of T as α and its tuple of auxiliary input morphisms as β1,…,βn, and define degm(β):=max1≤i≤n(deg(βi)). Then, for every output signature X′j→Y′j, there exist fixed integers aTj,bTk,cTj such that, for the morphism γj outputted for this signature given these inputs, deg(γj)≤aTjdeg(α)+bTjdegm(β)+cTj.
Proof. For every output signature X′j→Y′j, there exists a state y∈S(B) such that degB,y(X′j→Y′j) attains some maximal linear coefficient a′max, the generators corresponding to auxiliary inputs of T can appear in X′j→Y′j at most some fixed a′max number of times. Additionally, a similar maximum b′max can be found for the constant term of degB,y(X′j→Y′j). Since, by the definition of a filtered functor, deg(F(α))≤deg(α), and by the definition of the state category, the N2-degree of the output at X′j→Y′j can be at most a′jx+a′jdeg(F(α))+b′j, then deg(γj)≤a′maxdegm(β)+a′maxdeg(α)+b′max. ◻
Corollary 2.1. Suppose a string machine composed only of a finite set of filtered transducers {Tk}1≤k≤N, where each transducer Tk has input state space S(Ak) and output state space S(Bk) such that every variable at every state in S(Ak) has a degree with 1 or greater linear term, and S(Bk) is finite. Denote by α′k the morphism that Tk will receive as its primary input morphism, given overall input morphisms α1,…,αn and input states x1,…,xm to the string machine. Then, ∑Nk=1deg(α′k)=O(∑ni=1deg(αi)).
Proof. Suppose two transducers T1,T2, where T1 receives a primary input morphism α and auxiliary input morphisms β1,…,βm. Therefore, by Proposition 2, there exist integers a1,b1,c1 such that, for a given output γ produced by T1, the degree of γ satisfies deg(γ)≤a1deg(α)+b1degm(β)+c1. Now, if the primary input of T2 is not connected to an output of T1, then the string machine composed of these transducers satisfies the proposition, as the inputs of T2 are now included in the overall inputs of the string machine. If γ is composed into the primary input of T2, however, then deg(α′2)≤a1deg(α)+b1degm(β)+c1. Given similar coefficients a2,b2,c2 for a given output γ2 of T2, we can see that deg(γ2)≤a2(deg(α′2))+b2degm(β2)+c2, where degm(β2) is bounded from above by either the same kind of linear sum as the one for γ (if the greatest degree among the auxiliary inputs comes from an output of T1), or the degree of yet another additional input to the overall string machine. Therefore, any further composition of transducers T3,… will result in α′3,… also being bounded by a linear sum of the degrees of the overall inputs of the string machine, meaning that the sum ∑Nk=1deg(α′k) is also bounded by a linear sum of these degrees. ◻
Corollary 2.1 can be used to bound the time complexity of string machines, if, fixing some model of computation, we have a bound on the time it takes to run a single transducer as a function of its inputs. We note that the coefficients bounding output size are multiplied together upon composition into either an auxiliary input or a primary input, but only composition into a primary input ties the degree of the state transition that will occur in the second transducer to the primary input degree of the first transducer. We define the sum bounded in the corollary as follows:
Definition 8. Take a string machine K with input signatures X1→Y1,…Xn→Yn and input state spaces S(A1),…,S(Am), where the transducers forming K form the set {Tk}1≤k≤N. Denote by α′k the morphism that the transducer Tk will receive as its primary input morphism, given inputs α1,…,αn (¯¯¯¯α for short) and x1,…,xm (¯¯¯x for short) to K. We define the internal total primary input degree of K to be IPDK(¯¯¯¯α,¯¯¯x):=∑Nk=1deg(α′k).
While we have established that, lacking a meta-vertex, IPDK will be linearly bounded by the total degree of its inputs, its scaling properties as a function of the number of transducers composed has no such guarantees. One can observe that composing more and more transducers that double their input size together causes exponential growth in IPDK. As we are interested in the time complexity of both string machines that incorporate a meta-vertex and of parameterized families of string machines, we must obtain some sufficient conditions for IPDK to grow polynomially in the number of transducers in our string machine. To help determine these conditions, we will define the output-degree-bounding parameters referenced in Proposition 2.
Definition 9. Take a filtered deterministic transducer T with a finite output state space S(B) and an output signature X→Y of T. Given an input state x, primary input morphism α, and auxiliary input morphisms β1,…,βm to T, denote by γ the output morphism produced for X→Y. We define the output degreedegTo(X→Y) of the output X→Y of T to be the integer triple (a,b,c) such that the relation described in Proposition 2, deg(γ)≤adeg(α)+bdegm(β)+c, holds for all possible α and β1,…,βm (and the γ produced by these inputs). Given the minimal linear term amin (at least 1) that the degree of any variable in any state in the input state space of T, and the maximal linear term a′max and constant term b′max for the degree of the variable in the output state space corresponding to X→Y, we can unambiguously define degTo(X→Y)=(a′max,⌊a′max/amin⌋,b′max).
We can now prove some elementary sufficient conditions for IPDKN for a family {KN}N≤1 of string machines to grow polynomially in N.
Proposition 3. Suppose a family of string machines {KN}N≥1, where K1 is composed of a single filtered deterministic transducer with a finite output state space, and for N>1, KN is created by composing some of the outputs of KN−1 into the inputs of a new filtered deterministic transducer with a finite output state space, such that the remaining uncomposed input legs of each KN are the same for all N. Given the output XN→YN of KN−1 composed into the primary input of the new transducer added to obtain KN, we designate the transducer that that output is produced from as T′N, and write degT′No(XN→YN)=(aN,bN,cN). Now, fixing any input states and morphisms, IPDKN=O(Nh) for some h, regardless of the value of the inputs fixed, if the following conditions are met:
We have that cN=O(Nk), for some fixed k.
We have that aN+bN=O(1).
The number of times that aN+bN>1 is O(logN).
Proof. Omitting our input morphisms and states, we have that IPDKN=IPDKN−1+γN, where γN is the output of KN−1 composed into the new transducer’s primary input.IPDK1 is obviously simply the degree of our initial primary input.T′N either adds O(Nk) degrees’ worth of material to the new transducer’s primary input compared to IPDKN−1, or at most multiplies IPDKN−1 by some fixed amount and then adds this extra degree. Since subsequent multiplications of this sum can be bounded from above by doing all the additions first first and then multiplying the result by the cumulative multiplication thus far, the function bounding IPDKN can be expressed as a sum
where ℓ is the constant coefficient affording the O(logi) bound, and n is the total degree of the input morphisms to KN. ◻
Assuming the time complexity of a state-category morphism is proportional to its degree, we must impose either a constant or logarithmic bound on the number of primary-input compositions where the output is multiplied to preserve time complexity that is polynomial in the total number of transducers. In the figure, vertical arrows go to a transducer’s primary input, while horizontal ones go to its auxiliary input.
Remark. We have thus far only considered filtered transducers where the linear term of every variable in the input state space is non-vanishing. If we change this condition to only require that the constant term of the variable be non-vanishing, then the total number of generators in the N2-filtered category over the output category produced in the output is still bounded by a linear function of the primary input signature. So, the degree of the output function is now linear in the product of the degrees of the primary and auxiliary inputs. One can observe, however, that any composition of transducers will only cause outputs to be multiplied with each other a fixed number of times, so IPD will now be bounded by a polynomial in the total inputs of the string machine.
String machine description length
As string machines can themselves be thought of as morphisms in a category, and we are interested in extending our complexity constraints to the case where the meta-vertex is involved, we must imbue the category that string machines are morphisms in with a filtered category structure itself. While this could be accomplished by setting the degree of a string machine to just be the number of transducers involved (where a no-transducer string machine is just the identity and has degree zero), this obviously fails to capture the internal complexity of a transducer.
If we require that the input category of every non-meta-vertex transducer be finitely-generated, then we could make reference to the size of some fixed graph representation of a transducer’s transition table and output functions corresponding to generators, and then have this size be additive when transducers are composed. However, as discussed in the previous section, this description size does not constrain time complexity for transducers which build other transducers and then run them. We discuss possible approaches in our conclusion.
The expressivity of finite-state string machines
Now that we have obtained guarantees for the scaling of IPD, which can be thought of as an analogue to the time complexity of running a string machine, in both the number of transducers in a string machine and in input size, we focus on characterizing the expressivity of string machines consisting of finite-state deterministic transducers, that is, filtered deterministic transducers where the state space corresponding to every element of the input category (not only the output state space) is finite.
In the following section, we will assume that all transducers have an input category that is of a form described as follows:
Definition 10. A tape category is a filtered-morphism copy-discard category X freely generated over a single object X and a finite number of morphisms of the form Xm→Xn (where superscripts denote monoidal self-products), where every generator morphism has positive degree. If all our generator morphisms are of signature Xm→X, then a tape category is the copy-discard category freely generated over the symmetric monoidal category freely generated from the multicategory with one object freely generated from those generators, by way of the functor from multicategories to monoidal categories proven by Hermida to be an adjoint to the forgetful functor in the other direction.
We can treat tapes as a special case of tape category, where all generators are endomorphisms of the generating object.
Without a meta-vertex
Finite-state string machines, even without a meta-vertex, can prepend to their output, which is not something the traditional definition of finite-state transducer can do. It is natural to investigate if this makes the framework more expressive than a deterministic finite automaton, e.g., having it recognize palindromes by reversing a string and then feeding the product of these two (their overlaying) into a transducer that then checks if each character matches up.
Unfortunately, given morphisms f:A→B and g:C→D in an input category (not necessarily a tape category) C, and their product f⊗g, we can see that, since F(f⊗g)=F(f⊗idD)∘F(idA⊗g)=F(idB⊗g)∘F(f⊗idC), a state transition on a collection of finite state spaces induced by the product of two morphisms can only capture the same sort of information that could be captured by independently running two finite-state transducers on both morphisms and comparing their states at the very end.
Thus, “per-character” comparisons of the sort that would require conditions analogous to aligning characters on tape would require infinite state spaces to represent the equivalent memory operations being performed. However, due to the nature of the auxiliary input, as well as the aforementioned prepending capabilities, we are clearly able to model functions that finite state transducers cannot, even without a meta-vertex.
To characterize the class of decision problems computable by non-meta-vertex finite-state string machines, we first prove the following lemma:
Lemma 4. Suppose some finite-state transducer T with primary input signature X→X in a tape category X, structure functor F, and output state space S(A), such that these are its only inputs and outputs. Fix a finite set of morphisms {g1,…,gn:X→X} in the freely-generated N2-filtered category over X with a single generating signature X→X of degree x, such that the linear coefficient of the degree of each gi is at most 1 (that is, the generator corresponding to X→X appears at most once). Suppose we are able to construct a primary input morphism g:X→X for this transducer in the following way:
Our starting value for g is idX.
We can replace g with with one of the previously-given gi, with g substituted for the generator morphism. We can perform this step a finite of times.
Then, given some state transition reached as a result of some such g, the space complexity of computing the output state of the transducer is O(1) in the degree of g.
Proof. We will assume that one “computational step” involves performing one of the operations involved in constructing g described above. We will demonstrate that computing the next state after any of the operations performed requires storing an amount of information that is O(1) in the degree of g.
If one of the gi does not have the generator morphism appear at all, then S(A) after this gi has replaced g depends solely on the gi used, and since the set of such gi is finite, it takes a finite amount of space to store the state reached from the starting state when one of these gi are evaluated.
If one of the gi only involves post-composing an endomorphism of X into the generator, then storing the state reached from a given state after any of these endomorphisms is post-composed takes a fixed amount of memory, since the set of gi is finite.
If one of the gi involves only pre-composing and post-composing endomorphisms of T into g, then computing the resultant state after the action of one of these gi only requires us to store |S(A)| extra “possible current states.” That is, if we know what state we would be in after the evaluation of g had we started at any other one of the |S(A)| states of the transducer, then after computing which new starting state we would have started at (which, since the set of endomorphisms we pre-compose is finite, is equivalent to storing a fixed-size transition table), we can then pick the state that the copy of the transducer that started at that state would be at after the action of g. This is therefore equivalent to running |S(A)| copies of a finite state automaton, where each copy starts at a different state.
Suppose one of the gi is obtained by taking a morphism α:X→Xn, post-composing morphisms into each branch (such that one branch includes the generator), and then finally post-composing a morphism β:Xn→X. Even if multiple “branchings” occur, since the generator where g will be substituted appears only once, we can still decompose this into a morphism obtained by first taking the monoidal product of g with a number of fixed morphisms such that the overall signature of their product is Xn→Xn, and then composing in α and β. Now, we only need O(1) space to store the functions S(F(X))→S(F(Xn)) and S(F(Xn))→S(F(X)) induced by α and β, since these are functions between finite sets. Additionally, for the function S(F(Xn))→S(F(Xn)) induced by the monoid product of g with with a fixed morphism γ of signature Xn−1→Xn−1, by the property discussed at the start of this section, we only need to be keeping track of the action of F(g⊗idXn−1) on S(F(Xn)) (which, since there are a finite number of gi, only requires keeping an absolutely bounded number of automata running), and then compute the action of F(idX⊗γ) on the result, which, as a function with a finite domain and codomain, takes finite space to store.
Therefore, to compute the state transition induced by g, we only need to keep |S(A)| copies of the finite state automaton running, as well as some fixed number of finite-state automata with input and output state spaces corresponding to S(F(Xn)) for some fixed n. ◻
With this lemma, it now remains to show, roughly speaking, that for any string machine made out of finite-state deterministic transducers which decides some language (represented by morphisms in a tape category), the computation performed at every input morphism can be broken into a constant-bounded number of transitions of the type described in the lemma. We present a conjecture that finite-state string machines without a meta-vertex can only recognize regular languages, followed by a sketch for a proof of this conjecture.
Conjecture. Suppose a string machine composed only of finite-state transducers, where the input and output categories of each transducer are tape categories. Suppose this string machine has only one free input X→X in some tape category X where all generating morphisms (which form a set Σ) are endomorphisms of the generating object X, and has as its sole output a state space S(A), with some subset of S(A) designated as accepting. Then, taking an endomorphism X→X in X which does not include any instances of the copy morphism to be a string over the alphabet Σ, any language over Σ accepted by this string machine is regular.
Proof sketch. It suffices to prove that the computation involved in deciding this language takes constant space as a function of input size, as DSPACE(O(1))=REG. More precisely, given any input morphism g:X→X and a finite set of possible character strings that we can post-compose into g, we desire to show that there is a constant-bounded amount of information (independent of the size of g) that we need to store, which will allow us to calculate the output state after any of these character strings are added to g. By Proposition 1, each transducer involved in the string machine can create a constant-bounded number of duplicates of its auxiliary inputs within each of its outputs. This means that to predict the state of a given transducer after one of the operations described in Lemma 4 done to an auxiliary input, we need to store a constant amount of information. Moreover, due to the limitation caused by the size of a variable on the number of transitions one can make before we run out of variable space and must either limit ourselves to Lemma 4-like operations or reset, the number of “shapes” auxiliary inputs can exist in is absolutely bounded. The hope is that if we back-propagate until reaching the primary input of the first transducer, we will still have a constant-bounded amount of information to keep track of to predict the output state after the next character is reached.
Remark. This conjecture is already suggested by the combination of Corollary 2.1 and classical results by Kobayashi and Hennie which together imply that any one-tape Turing machine that runs in o(nlogn) time decides a regular language. The reason the proposition is not trivially implied by these results is that a naive simulation of the string machine in question on a single-tape Turing machine will cross the last cell of its initial input a guaranteed O(n) times (when going back and forth to read the next cell to write the inputs to feed to the next automaton in line). The conjecture would also automatically be implied if we prove that the composition of two finite-state transducers can be equivalently modeled by a single finite-state transducer.
With a meta-vertex
The meta-vertex, even at meta-level one, can clearly be seen to increase the expressivity of finite-state string machines. We construct a string machine which can be recognize palindromes as follows:
Given a tape category X where all generating morphisms are endomorphisms of the generating object X, mark a special generating endomorphism r. Given a generating endomorphism α≠r of X, we define Tα to be the filtered deterministic transducer with input and output category X, with input and output signatures X→X and three states, a fixed one of which is the starting state. When in the starting state, Tα will transition to the “accepting state” and store idX in the sole variable at that state if it encounters α, and transition to the “rejecting state” and store r if any other generating morphism is encountered. When in the rejecting state, all morphisms are mapped to the identity on the rejecting state. When in the accepting state, all morphisms transition back to the accepting state, but this time append the current primary input generator morphism to the output. The end result is that when given an endomorphism s:X→X, the transducer Tα will output s with its first “character” removed if and only if it starts with α, and output r otherwise. As a morphism, it is of signature (X→X)X→(X→X)X.
Now, we define a filtered deterministic transducer T with input category X, which outputs a filtered deterministic transducer without meta vertices. This transducer has input signature X→X and only one state, with one variable of signature (X→X)→(X→X), and it is assumed that no morphism X→X fed to T will include r. Given a generator morphism α of X, the transducer T will prepend Tα to the current variable’s stored string machine. If we compose a meta vertex that takes the output of T and takes the same input morphism as T and passes it on to the string machine formed by T, then we obtain a string machine that outputs idX if it is given a palindrome, and r if it is fed anything else.
Conclusions
Thus far, we have proven results about the time complexity and expressivity of finite-state deterministic transducers in the string machines framework. This framework allows us to model the compositionality of transducers in a way that allows for more compression of description length. For example, we are able to implement the trivial time-space tradeoff of recognizing a regular language that is the intersection of several regular languages by running several automata in sequence instead of the product automaton, or the cascade product in Krohn-Rhodes theory by having a transducer “shuffle” its primary input using its ability to prepend.
Additionally, our time complexity scaling guarantees in the number of transducers in a string machine translate to sufficient conditions for transducers which build and run other transducers in runtime to run in polynomial time. This will allow us to take advantage of the additional compression opportunities the meta-vertex presents. These results are valuable for developing string machines into a framework that can be used to model hypothesis spaces representable by automata.
Further work
Description complexity that encapsulates time complexity
As exemplified by Definition 4, the construction of filtered sets can be extended to a partially-ordered monoid that is not N. Since a string machine without a meta-vertex will have the degrees of its outputs be bounded by a linear function of the degrees of its inputs, we can assign a degree ax+b to finite-state filtered transducers, where a and b are the maximal values for some sum of the coefficients appearing in the output degree in Definition 9, where the partial order is the same as in Definition 4. However, in this case, the monoid operation imposed on the polynomials is composition, due to how the linear relations bounding output size get composed when transducers are composed, and the filtered-set category is no longer symmetric monoidal since this operation is not commutative.
Now, the variables in our state categories would have their degrees be of the form ay+bx+c, where a morphism of degree dx+e can compose in a transducer of at most that degree, meaning the output variable is of degree a(y+(dx+e))+bx+c=ay+(dx+e)a∘bx+c by abuse of notation. where the superscript indicates a-fold self-composition. At further meta-levels, we keep adding terms, though it is unclear how we would disambiguate which variable to compose into for the monoid operation.
Characterizing the expressivity of transducers with a meta-vertex and monadic transducers
We have not yet established bounds on the expressivity of finite-state deterministic transducers which incorporate the meta-vertex, but, due to the bounding on levels of meta, it is likely that the languages they decide are some subset of context-free languages. The time complexity guarantees also need to be translated to the monadic case. Work on bounding the expressivity of monadic string machines may involve defining equivalents for string machines of various properties (see work by Mohri, Allauzen et al., Kostolanyi, and Bell et al.) which characterize determinizable weighted transducers, which may in turn allow us to bound the computational complexity of computing the distribution on output morphisms given by a monadic transducer.
Time complexity for deterministic string machines
This was a project conducted during MATS 5.0 under the mentorship of Vanessa Kosoy and supported by a grant from BERI. It builds off the String Machines framework (and depends on the linked post for certain definitions), which models category-theoretic generalizations of finite-state transducers. [EDIT: The results here can also be found presented in self-contained form, in this paper.]
The framework as it previously existed did not have representation-independent ways of bounding (analogues of) time complexity, or natural guarantees that output size would not grow exponentially in input size. We introduce “filtered” transducers, which operate on categories enriched over filtered sets (sets equipped with a function to a partially ordered monoid, where morphisms are functions respecting order), and then, restricting our attention to transducers with a finite state space, prove constraints on the time complexity growth and expressivity of string machines.
Parameterizing complexity in string machines
Filtered transducers
We will generally refer to objects in FiltSet solely by the symbol corresponding to the underlying set going forward. One can observe that the identity function on a set S by definition satisfies degS(idS(s))=degS(s) for all s∈S and is thus a morphism in FiltSet. One can also observe that given f:S→T and g:T→V, degV(g(f(s)))≤degT(f(s))≤degS(s) for all s∈S, and therefore g∘f is also a morphism in FiltSet. Therefore, FiltSet is indeed a category.
Due to the associativity and commutativity of addition, as well as the natural associativity and commutativity (up to isomorphisms which are still isomorphisms in FiltSet) of the cartesian product, −⊗− is naturally associative and commutative up to isomorphism. Additionally, the one-element set 1 equipped with deg1(⋅)=0 and unitor maps which are the same as in Set (which are, by their definition, filtered morphisms) provides a left and right unit for −⊗−, making FiltSet a symmetric monoidal category.
Remark. Suppose filtered sets S,T,U and filtered morphisms f:S→T and g:S→U. Then, the unique factoring function S→T×U defined by s↦(f(s),g(s)) is only a filtered morphism S→T⊗U if degT(f(s))+degU(g(s))≤degS(s), which does not hold in general. Therefore, −⊗− does not provide a product except for when at least one of the sets has degree uniformly zero. However, FiltSet does have finite products S×T where degS×T(s,t):=max(degS(s),degT(t)). We will not be using this construction.
Remark. The set-theoretic disjoint union, with its degree function being the canonical factoring map to N of its components’ degree functions, provides all finite coproducts in FiltSet.
This expresses the notion of morphisms having degrees which are subadditive under composition in a way that naturally extends to a complexity constraint on transducers. As the monoidal identity of FiltSet is the single-element set with degree zero, the arrows IFiltSet→HomC(A,A) providing the identity morphism idA in the enrichment construction will ensure that identity morphisms are degree zero.
One can generalize the construction of Filtset by replacing N with any partially-ordered symmetric monoid (where the partial order is, obviously, translation-invariant as it is with the usual definition of a partially-ordered group). We will make use of categories filtered over N2 (with the partial order given by (a,b)≤(c,d) if and only if a≤c and b≤d) in our construction of the filtered state category, as follows:
We can now introduce filtered state categories.
Remark.CS is a filtered-morphism category with the degrees of morphisms being defined as in the definition of the category, as the identity morphism of each object A has an output function that outputs a variable of degree ax+b (the generator corresponding to the variable itself) for any variable of degree ax+b and is thus of degree zero. Additionally, as also demonstrated in the definition, degree is subadditive with composition, meaning that the composition arrow is indeed a morphism in FiltSet.
Given a filtered functor F:C→D, since the definition of an enriched functor requires the functor’s action on morphisms to be provided by a morphism between hom-objects within the category, it automatically holds that degDF(α)≤degC(α) for all morphisms α in C.
Finite-state string machines
For the following section, we assume a filtered deterministic transducer T with input category C, output category D, structure functor F, input state space S(A), output state space S(B), primary input C-signature X→Y, auxiliary input D-signatures (Xi→Yi)1≤i≤n, and output D-signatures (X′j→Y′j)1≤j≤m. We will now demonstrate that requiring a finite output state space on a transducer provides us with certain output size and time complexity guarantees.
Corollary 2.1 can be used to bound the time complexity of string machines, if, fixing some model of computation, we have a bound on the time it takes to run a single transducer as a function of its inputs. We note that the coefficients bounding output size are multiplied together upon composition into either an auxiliary input or a primary input, but only composition into a primary input ties the degree of the state transition that will occur in the second transducer to the primary input degree of the first transducer. We define the sum bounded in the corollary as follows:
While we have established that, lacking a meta-vertex, IPDK will be linearly bounded by the total degree of its inputs, its scaling properties as a function of the number of transducers composed has no such guarantees. One can observe that composing more and more transducers that double their input size together causes exponential growth in IPDK. As we are interested in the time complexity of both string machines that incorporate a meta-vertex and of parameterized families of string machines, we must obtain some sufficient conditions for IPDK to grow polynomially in the number of transducers in our string machine. To help determine these conditions, we will define the output-degree-bounding parameters referenced in Proposition 2.
We can now prove some elementary sufficient conditions for IPDKN for a family {KN}N≤1 of string machines to grow polynomially in N.
N∑i=1O(1)O(logi)(n+iO(ik))≤N(NO(1)(n+O(Nk+1)))=Nℓ+1n+O(Nℓ+k+2)Remark. We have thus far only considered filtered transducers where the linear term of every variable in the input state space is non-vanishing. If we change this condition to only require that the constant term of the variable be non-vanishing, then the total number of generators in the N2-filtered category over the output category produced in the output is still bounded by a linear function of the primary input signature. So, the degree of the output function is now linear in the product of the degrees of the primary and auxiliary inputs. One can observe, however, that any composition of transducers will only cause outputs to be multiplied with each other a fixed number of times, so IPD will now be bounded by a polynomial in the total inputs of the string machine.
String machine description length
As string machines can themselves be thought of as morphisms in a category, and we are interested in extending our complexity constraints to the case where the meta-vertex is involved, we must imbue the category that string machines are morphisms in with a filtered category structure itself. While this could be accomplished by setting the degree of a string machine to just be the number of transducers involved (where a no-transducer string machine is just the identity and has degree zero), this obviously fails to capture the internal complexity of a transducer.
If we require that the input category of every non-meta-vertex transducer be finitely-generated, then we could make reference to the size of some fixed graph representation of a transducer’s transition table and output functions corresponding to generators, and then have this size be additive when transducers are composed. However, as discussed in the previous section, this description size does not constrain time complexity for transducers which build other transducers and then run them. We discuss possible approaches in our conclusion.
The expressivity of finite-state string machines
Now that we have obtained guarantees for the scaling of IPD, which can be thought of as an analogue to the time complexity of running a string machine, in both the number of transducers in a string machine and in input size, we focus on characterizing the expressivity of string machines consisting of finite-state deterministic transducers, that is, filtered deterministic transducers where the state space corresponding to every element of the input category (not only the output state space) is finite.
In the following section, we will assume that all transducers have an input category that is of a form described as follows:
We can treat tapes as a special case of tape category, where all generators are endomorphisms of the generating object.
Without a meta-vertex
Finite-state string machines, even without a meta-vertex, can prepend to their output, which is not something the traditional definition of finite-state transducer can do. It is natural to investigate if this makes the framework more expressive than a deterministic finite automaton, e.g., having it recognize palindromes by reversing a string and then feeding the product of these two (their overlaying) into a transducer that then checks if each character matches up.
Unfortunately, given morphisms f:A→B and g:C→D in an input category (not necessarily a tape category) C, and their product f⊗g, we can see that, since F(f⊗g)=F(f⊗idD)∘F(idA⊗g)=F(idB⊗g)∘F(f⊗idC), a state transition on a collection of finite state spaces induced by the product of two morphisms can only capture the same sort of information that could be captured by independently running two finite-state transducers on both morphisms and comparing their states at the very end.
Thus, “per-character” comparisons of the sort that would require conditions analogous to aligning characters on tape would require infinite state spaces to represent the equivalent memory operations being performed. However, due to the nature of the auxiliary input, as well as the aforementioned prepending capabilities, we are clearly able to model functions that finite state transducers cannot, even without a meta-vertex.
To characterize the class of decision problems computable by non-meta-vertex finite-state string machines, we first prove the following lemma:
With this lemma, it now remains to show, roughly speaking, that for any string machine made out of finite-state deterministic transducers which decides some language (represented by morphisms in a tape category), the computation performed at every input morphism can be broken into a constant-bounded number of transitions of the type described in the lemma. We present a conjecture that finite-state string machines without a meta-vertex can only recognize regular languages, followed by a sketch for a proof of this conjecture.
Conjecture. Suppose a string machine composed only of finite-state transducers, where the input and output categories of each transducer are tape categories. Suppose this string machine has only one free input X→X in some tape category X where all generating morphisms (which form a set Σ) are endomorphisms of the generating object X, and has as its sole output a state space S(A), with some subset of S(A) designated as accepting. Then, taking an endomorphism X→X in X which does not include any instances of the copy morphism to be a string over the alphabet Σ, any language over Σ accepted by this string machine is regular.
Proof sketch. It suffices to prove that the computation involved in deciding this language takes constant space as a function of input size, as DSPACE(O(1))=REG. More precisely, given any input morphism g:X→X and a finite set of possible character strings that we can post-compose into g, we desire to show that there is a constant-bounded amount of information (independent of the size of g) that we need to store, which will allow us to calculate the output state after any of these character strings are added to g. By Proposition 1, each transducer involved in the string machine can create a constant-bounded number of duplicates of its auxiliary inputs within each of its outputs. This means that to predict the state of a given transducer after one of the operations described in Lemma 4 done to an auxiliary input, we need to store a constant amount of information. Moreover, due to the limitation caused by the size of a variable on the number of transitions one can make before we run out of variable space and must either limit ourselves to Lemma 4-like operations or reset, the number of “shapes” auxiliary inputs can exist in is absolutely bounded. The hope is that if we back-propagate until reaching the primary input of the first transducer, we will still have a constant-bounded amount of information to keep track of to predict the output state after the next character is reached.
Remark. This conjecture is already suggested by the combination of Corollary 2.1 and classical results by Kobayashi and Hennie which together imply that any one-tape Turing machine that runs in o(nlogn) time decides a regular language. The reason the proposition is not trivially implied by these results is that a naive simulation of the string machine in question on a single-tape Turing machine will cross the last cell of its initial input a guaranteed O(n) times (when going back and forth to read the next cell to write the inputs to feed to the next automaton in line). The conjecture would also automatically be implied if we prove that the composition of two finite-state transducers can be equivalently modeled by a single finite-state transducer.
With a meta-vertex
The meta-vertex, even at meta-level one, can clearly be seen to increase the expressivity of finite-state string machines. We construct a string machine which can be recognize palindromes as follows:
Given a tape category X where all generating morphisms are endomorphisms of the generating object X, mark a special generating endomorphism r. Given a generating endomorphism α≠r of X, we define Tα to be the filtered deterministic transducer with input and output category X, with input and output signatures X→X and three states, a fixed one of which is the starting state. When in the starting state, Tα will transition to the “accepting state” and store idX in the sole variable at that state if it encounters α, and transition to the “rejecting state” and store r if any other generating morphism is encountered. When in the rejecting state, all morphisms are mapped to the identity on the rejecting state. When in the accepting state, all morphisms transition back to the accepting state, but this time append the current primary input generator morphism to the output. The end result is that when given an endomorphism s:X→X, the transducer Tα will output s with its first “character” removed if and only if it starts with α, and output r otherwise. As a morphism, it is of signature (X→X)X→(X→X)X.
Now, we define a filtered deterministic transducer T with input category X, which outputs a filtered deterministic transducer without meta vertices. This transducer has input signature X→X and only one state, with one variable of signature (X→X)→(X→X), and it is assumed that no morphism X→X fed to T will include r. Given a generator morphism α of X, the transducer T will prepend Tα to the current variable’s stored string machine. If we compose a meta vertex that takes the output of T and takes the same input morphism as T and passes it on to the string machine formed by T, then we obtain a string machine that outputs idX if it is given a palindrome, and r if it is fed anything else.
Conclusions
Thus far, we have proven results about the time complexity and expressivity of finite-state deterministic transducers in the string machines framework. This framework allows us to model the compositionality of transducers in a way that allows for more compression of description length. For example, we are able to implement the trivial time-space tradeoff of recognizing a regular language that is the intersection of several regular languages by running several automata in sequence instead of the product automaton, or the cascade product in Krohn-Rhodes theory by having a transducer “shuffle” its primary input using its ability to prepend.
Additionally, our time complexity scaling guarantees in the number of transducers in a string machine translate to sufficient conditions for transducers which build and run other transducers in runtime to run in polynomial time. This will allow us to take advantage of the additional compression opportunities the meta-vertex presents. These results are valuable for developing string machines into a framework that can be used to model hypothesis spaces representable by automata.
Further work
Description complexity that encapsulates time complexity
As exemplified by Definition 4, the construction of filtered sets can be extended to a partially-ordered monoid that is not N. Since a string machine without a meta-vertex will have the degrees of its outputs be bounded by a linear function of the degrees of its inputs, we can assign a degree ax+b to finite-state filtered transducers, where a and b are the maximal values for some sum of the coefficients appearing in the output degree in Definition 9, where the partial order is the same as in Definition 4. However, in this case, the monoid operation imposed on the polynomials is composition, due to how the linear relations bounding output size get composed when transducers are composed, and the filtered-set category is no longer symmetric monoidal since this operation is not commutative.
Now, the variables in our state categories would have their degrees be of the form ay+bx+c, where a morphism of degree dx+e can compose in a transducer of at most that degree, meaning the output variable is of degree a(y+(dx+e))+bx+c=ay+(dx+e)a∘bx+c by abuse of notation. where the superscript indicates a-fold self-composition. At further meta-levels, we keep adding terms, though it is unclear how we would disambiguate which variable to compose into for the monoid operation.
Characterizing the expressivity of transducers with a meta-vertex and monadic transducers
We have not yet established bounds on the expressivity of finite-state deterministic transducers which incorporate the meta-vertex, but, due to the bounding on levels of meta, it is likely that the languages they decide are some subset of context-free languages. The time complexity guarantees also need to be translated to the monadic case. Work on bounding the expressivity of monadic string machines may involve defining equivalents for string machines of various properties (see work by Mohri, Allauzen et al., Kostolanyi, and Bell et al.) which characterize determinizable weighted transducers, which may in turn allow us to bound the computational complexity of computing the distribution on output morphisms given by a monadic transducer.