Boundedness of Cost Register Automata over the Integer Min-Plus Semiring
Abstract
Cost register automata (CRAs) are deterministic automata with registers taking values from a fixed semiring. A CRA computes a function from words to values from this semiring. CRAs are tightly related to well-studied weighted automata. Given a CRA, the boundedness problem asks if there exists a natural number such that for every word, the value of the CRA on this word does not exceed . This problem is known to be undecidable for the class of linear CRAs over the integer min-plus semiring , but very little is known about its subclasses. In this paper, we study boundedness of copyless linear CRAs with resets over the integer min-plus semiring. We show that it is decidable for such CRAs with at most two registers. More specifically, we show that it is, respectively, NL-complete and in coNP if the numbers in the input are presented in unary and binary. We also provide complexity results for two classes with an arbitrary number of registers. Namely, we show that for CRAs that use the minimum operation only in the output function, boundedness is PSPACE-complete if transferring values to other registers is allowed, and is coNP-complete otherwise. Finally, for each in the hierarchy of fast-growing functions, we provide a stateless CRA with registers whose output exceeds only on runs longer than . Our construction yields a non-elementary lower bound already for four registers.
Keywords and phrases:
cost register automata, boundedness, decidabilityCopyright and License:
![[Uncaptioned image]](x1.png)
2012 ACM Subject Classification:
Theory of computation Quantitative automataAcknowledgements:
We thank the anonymous reviewers for their helpful comments.Funding:
††margin:![[Uncaptioned image]](erc-eu-logo.png)
Editors:
Jörg Endrullis and Sylvain SchmitzSeries and Publisher:

1 Introduction
A cost register automaton (CRA), introduced by Alur et al. [3], is a deterministic finite automaton over finite words equipped with a finite set of registers storing values from a fixed semiring. When a CRA reads a word, the values of its registers are updated in a write-only way using the semiring operations, and at the end it outputs a value from the semiring. Thus, a CRA defines a function from finite words to elements of a semiring. CRAs can hence be used to model quantitative behaviour of systems, and are tightly related to well-studied weighted automata (WAs) introduced by Schützenberger in [36], see also surveys [18, 19]. In this context, a fundamental question is, given a CRA or WA, to decide if a certain property of the function computed by it (or even just a property of the image of this function) holds.
In this paper, we study the boundedness problem, which, given a CRA, asks if there exists a natural number such that the output of the CRA on every input is smaller than . As discussed in more detail below, very little is known about decidability of this problem compared to other natural problems for WAs and CRAs. Our work thus addresses and partially closes this gap, by studying it for restricted classes of CRAs. Below we provide an overview of such classes, and put them in the context of known classes of WAs.
We concentrate on CRAs over the integer min-plus semiring . All CRAs are thus assumed to be over this semiring unless stated otherwise. Such CRAs can be seen as a variant of counter automata, specifically, as an extension of integer vector addition systems with states [21, 8]. Reachability properties of the latter are characterised by Presburger arithmetic, the first order theory of integer numbers with addition and order [21], which has good algorithmic features. For CRAs over the integer min-plus semiring, the situation changes significantly due to the presence of minimum operations in the updates. This makes the computed functions highly nonlinear: for example, they can compute iterated minimums. The results for integer vector addition systems thus cannot be directly used for CRAs. On the positive side, for subclasses of CRAs with decidable properties, this opens a possibility of finding new decidable extensions of Presburger arithmetic, by finding logical characterisation of the functions computed by CRAs from such subclasses.
More generally, many fundamental properties of CRAs and WAs can be defined by simple formulas in first-order logic, and can thus be considered as model checking CRAs against a fixed formula. For example, boundedness can be expressed by the formula
where is the predicate that holds true for if and only if the CRA outputs the value on some word. Understanding the decidability landscape of natural properties such as boundedness can thus be seen as a first step towards much more general model checking algorithms for subclasses of CRAs and WAs.
Relations between CRAs and WAs
In general, CRAs are strictly more expressive than WAs [3]. However, WAs are equally expressive to linear CRAs, which are CRAs where the updates of the registers are restricted to affine transformations. Transforming a linear CRA into an equivalent WA and vice versa can be done in polynomial time [3]. Hence, linear CRAs can be seen as a deterministic model for inherently nondeterministic WAs. WAs, and thus CRAs, find their applications in the areas of language and speech processing [34], verification [9], image processing [10], and the analysis of on-line algorithms [5] and probabilistic systems [39]. Functions computable by WAs are exactly those that can be defined in weighted monadic second order logic, a natural extension of monadic second order logic [16, 17]. Functions computed by a subclass of CRAs were also characterised in [31] by maximal partition logic, a logic with regular quantifiers that allow to partition words into segments and then aggregate the values computed for them.
Ambiguity hierarchy of WAs
To make decision problems tractable for WAs, it is usually required to restrict their expressiveness. The most well-studied way of doing that is by bounding the ambiguity, that is, the number of accepting runs labelled by a word. A WA is called finitely (respectively, linearly, polynomially or exponentially) ambiguous if there exists a constant (respectively, a linear, polynomial or exponential) function such that for every word the number of accepting runs labelled by is bounded by . If , a WA is called unambiguous. Most classical decision problems, such as universality, inclusion and equivalence, are undecidable already for linearly ambiguous WAs over the integer min-plus semiring [28, 1, 12]. For finitely ambiguous WAs over this semiring, universality, inclusion and equivalence become decidable [40, 23].
For the boundedness problem, the situation is very different. A seminal paper [1] establishes undecidability of several classical decision problems for linearly ambiguous WAs over the integer min-plus semiring in a uniform fashion. However, it only proves boundedness to be undecidable for general (that is, exponentially ambiguous) WAs, and provides no classes with decidable boundedness. This indicates that boundedness is somehow different to other mentioned decision problems.
We remark that boundedness is PSPACE-complete for WAs over the natural min-plus semiring [1, 22, 29, 37], which requires completely different techniques than the integer case. We also remark that it is decidable for copyless linear CRAs over the semiring of positive rational numbers with usual addition and multiplication, and is undecidable for general WAs over the same semiring [11]. Transferring any such results to the min-plus semiring is unlikely, since these semirings has very different properties.
Restricted classes of CRAs
One useful feature of CRAs is that, by adding syntactic restrictions on them, it is possible to introduce subclasses whose expressiveness is incomparable to known classes of WAs. This allows to obtain a finer decidability landscape compared to the case where only the formalism of WAs is used.
One notable example of that is the class of so called copyless linear CRAs. Informally, a CRA is called copyless if for every transition, the value of each of its registers can only be used once in the updates. Copyless linear CRAs are strictly less expressive than linearly ambiguous WAs, and their expressivity is incomparable to unambiguous WAs [2]. A further restriction of copyless linear CRAs to the case where the minimum operation is only allowed in the output function makes them equally expressive to finitely sequential WAs, which are unions of WAs whose underlying NFAs are deterministic [4, 13].
Restricting the number of registers in a class of CRAs also usually provides a subclass whose expressivity is incomparable to that of known classes of WAs. For example, there exists a copyless (but not linear) CRA with only registers that computes a function not computed by any polynomially ambiguous WA [32]. For copyless linear CRAs restricted to only three registers universality is undecidable [15]. Moreover, there exist copyless linear CRAs with only two registers that are not equivalent to any unambiguous WA [2], see Example 6 on page 6 for one such CRA. All these results indicate that CRAs with few registers are quite expressive. Results on finding a CRA with the minimum number of registers computing a given function are presented in [13, 14, 25, 26].
More generally, for many problems the case of automata with two counters or registers often turns out to be already difficult enough. For example, most decision problems are undecidable for two-counter automata [33]. For vector addition systems with states, decidability of the reachability problem in the two-counter case was established in a seminal paper [24] several years before the proof that it is decidable for arbitrary number of counters was found [30], and it took over 20 more years to establish the precise computational complexity of the two-counter case [7].
Our contributions
The main technical contribution of the paper, Theorem 17, states that boundedness is decidable for copyless linear CRAs with resets with at most two registers. Namely, we show that it is NL-complete if the numbers in the updates are presented in unary, and is in coNP is they are presented in binary. Functions computed by CRAs, even when they have only two registers, are highly nonlinear and complex, mainly due to the presence of nested minimum operations. We illustrate this by providing in Section 6 a series of CRAs with very long shortest runs outputting a given value. To show that the two-register case is decidable, we identify several possible shapes of small witnesses of unboundedness (Section 4.2). The main challenge is then showing that if a CRA is unbounded, it contains one of these witnesses, which we do by carefully analysing the growth of the output value for a run providing a large enough value, and showing how to rearrange the cycles of this run to obtain a witness (Section 4.3). This requires in particular some geometrical arguments on the cones generated by the weight vectors of the cycles.
Our second contribution is establishing the complexity of boundedness for copyless linear CRAs with resets where the number of registers is arbitrary, but the minimum operation only occurs in the output function. As mentioned above, such CRAs compute the same class of functions as finitely sequential WAs. We show that boundedness is PSPACE-complete if registers are allowed to transfer values to other registers (Theorem 33), and is coNP-complete otherwise (Theorem 32). For upper bounds on the complexity, our techniques again rely on the combinatorial and geometrical analysis of cycles.
2 Main definitions
Symbols and stand for natural and integer numbers respectively. Let . We assume that the reader is familiar with the basic concepts in the area of formal languages and automata, see e.g. [38]. The Kleene star is denoted as . In regular expressions, we write for the sum and for the empty string. The language of a nondeterministic finite automaton (NFA) is denoted as . When speaking of underlying digraphs of NFAs, we use standard terms like simple cycle, reachability and backwards-reachability. We emphasise that by a simple cycle we mean a cycle that does not visit the same vertex more than once, except for its first and last vertex. General cycles do not have this restriction.
In this paper, we focus on CRAs over the integer min-plus semiring . Hence, in what follows, we fix . For the proofs we present, the main focus lies on the operations on registers performed by CRAs, so we look at them in depth in Section 2.1. Then, in Section 2.2, we define CRAs and the boundedness problem.
2.1 Expressions, valuations and substitutions
Fix a finite set of variables . By we denote the set of expressions constructed using operations and , variables from and constants from . Expressions can be seen as polynomials over . Due to associativity, we allow arbitrary arity of the semiring operations in the expression notation. For an expression without variables, we denote by its value.
A substitution over is a function . We denote the set of all substitutions over by . When defining substitutions, we often treat them as sets of “” pairs. When is clear from the context, we implicitly extend partial substitutions with the identity mapping for the omitted arguments. For example, if , then denotes a substitution satisfying for and for . A valuation over is a substitution . We denote by the set of all valuations over . We write for the valuation with for every . We assume that there is a fixed order on the set of registers, and thus in particular consider valuations equivalently as vectors.
Example 1 (An expression, a substitution and a valuation).
Fix .
(an expression) | |||||
(a substitution) | |||||
(a valuation) |
Substitutions can be applied to expressions: given and , by we denote the result of simultaneously replacing each occurrence of with for every . Substitutions can be composed: for , we define the composition as . Applying a valuation to an expression yields an expression without variables – thus, with a defined value from . We hence define . For a valuation and a substitution , we let .
Example 2 (Application and composition of substitutions).
Continuing Example 1, we have
( with applied to it) | |||||
( with applied to it) | |||||
(the value of ) |
For , we write if for every . Additionally, for , we write whenever for every . For an expression , by we denote the maximal absolute value of constants different to appearing in , and if there are none. We extend maxc naturally to substitutions.
Copyless linear substitution with resets
In this paper, our main focus is on a special family of substitutions which are copyless and linear with resets. An expression is in a canonical linear form if
for some pairwise-different , , and . Any expression such that for an expression in a canonical linear form is called linear. A substitution is linear with resets if for every , is either linear or (a reset). A linear substitution with resets is in a canonical form if all its linear expressions are in a canonical linear form. We remark that the only reason why we use linear substitutions with resets instead of affine substitutions (that is, substitutions whose expressions are sums of linear and constant expressions) is to simplify the presentation of our techniques. Clearly, by adding more registers one can transform an affine CRA into a linear CRA with resets.
A substitution is copyless if for all pairs such that the expressions and feature disjoint sets of variables. By and we denote the sets of linear expressions and copyless linear substitutions with resets, respectively.
Example 3 (Copyless linear substitutions with resets).
Consider the substitutions and :
We have that because it is equivalent to a linear substitution with resets in a canonical form, and variables occur at most once in its expressions. In contrast, is linear, but not copyless, because occurs in both and .
2.2 Cost register automata
Definition 4 (CRA).
A copyless linear CRA with resets over is a tuple
consisting of a finite set of registers, a finite alphabet , a finite set of control states, an initial state , and two functions:
-
a transition rule function ,
-
an output function .
We also make the following assumptions that clearly preserve the property of being bounded or unbounded. We assume that all substitutions and expressions in are in a canonical form. Furthermore, we assume that never occurs as a constant in a substitution, since every such transition can be replaced with a transition leading to a new state, a self-loop incrementing the value of the corresponding register in this new state, and then a transition back.
In this paper, we consider only copyless linear CRAs with resets, hence for the rest of the paper we simply call them CRAs.
Definition 5 (Semantics of a CRA).
A CRA naturally induces a (possibly infinite) deterministic labelled transition system , where is the set of configurations, is the initial configuration and is a transition function defined as , where . We extend to words as usually: for a configuration , a letter and a word , and . We further define the function calculated by as , where . Note that since we are only interested in the boundedness problem, the assumption that the initial value of each register is zero does not restrict the expressiveness of CRAs.
Example 6.
In Figure 1, we give an example of a CRA over the semiring and alphabet . It has two states and , where is the initial state, and two registers and . The output function for state (words ending with and the empty word) is and for state (words ending with ) is . Both registers are initialised with value . If the input word ends with or is empty, this CRA outputs . Call a sequence of consecutive ’s a block. A block is maximal if it is not contained in a longer block. If the input word ends with , the CRA outputs the length of the shortest maximal block. Register stores the number of ’s read in the current block, and stores the minimum length of maximal blocks read so far. This CRA is a copyless linear CRA with resets.
We say that a CRA is bounded if there is such that for all . We are now ready to state the main decision problem we are interested in.
Problem 7 (CRA boundedness).
Input: CRA .
Question: Is bounded?
3 Regular substitution languages
3.1 Substitution languages associated to CRAs
In the boundedness problem, the input alphabet of a CRA is redundant, since the formulation is existentially quantified for the word and the underlying finite automaton is deterministic. For this reason, in this paper we focus on sequences of substitutions that a CRA can perform.
A language of substitutions is an arbitrary subset of . Every word read by a CRA induces a sequence of substitutions that performs when reading . Fix a CRA . We define the language of substitutions induced by it. Observe that the set of substitutions that occur in the transitions and output expressions of is finite. We denote it by . The regular language is then formally defined as the language of the following automaton . To simplify the presentation, we assume that the last substitution in the sequence corresponding to a word saves the output into a designated output register .
Definition 8 ().
Given a CRA , define a nondeterministic finite automaton where and the transition relation contains transitions:
Fix an NFA and a set of registers for the rest of this subsection. An alternating sequence of states from and letters from is called a run in labelled by the word . We write to denote the fact that is a run labelled by that begins in and ends in . For such a run and , we define . We identify words with compositions of the corresponding sequences of substitutions. The set of runs of is denoted by . A run is accepting if . An NFA accepts whenever there exists an accepting run of labelled by . The language of , denoted , is the set of words accepted by .
To be able to refer to segments of runs, we combine the notation for single transitions and runs . For example, we may consider a run labelled by a word . When the labelling is not important, we write .
There is an obvious correspondence between runs in and in . In particular, for , there exists such that if, and only if, there exists such that . This allows us to restate the boundedness problems in terms of languages of substitutions. We say that a regular language has bounded output in if there exists such that for every we have .
Problem 9 (Boundedness of regular -register substitution languages).
Input: NFA over a finite set , , output register .
Question: Does have bounded output in ?
Note that boundedness for CRAs (Problem 7) easily reduces to this problem in deterministic logarithmic space. Indeed, it suffices to compute for a given CRA with Definition˜8. This reformulation allows us to use a rich framework of regular languages, which streamlines the proofs presented in later sections.
Definition 10 (Elementary substitutions).
We say that a substitution is elementary if it has one of the following forms for some , :
(additive sub.) | (transposition) | ||||
(minimum sub.) | (reset sub.) |
Let be the set of elementary substitutions, and let be its partition into sets of transpositions, and reset, additive, and minimum substitutions.
Lemma 11.
For every in a canonical form, there exists a word of substitutions of length such that .
Note that the statement of the above lemma is not true in the general setting of , as its proof relies on copylessness. Note also that Lemma 11 implies the existence of a homomorphism such that for every . For a finite set , we define . The following two claims are not difficult to prove.
Claim 12 (Maximal constant grows linearly w.r.t. length).
Fix a finite . For every , we have .
Claim 13 (Elementary substitutions assumption).
We may assume w.l.o.g. that the alphabet of consists only of elementary substitutions, i.e., .
3.2 The structure of witnesses with additive and reset substitutions only
In this subsection, we show how to simplify and decompose runs that do not contain any minimum substitutions or transpositions. We then use these results in the complexity upper bounds and to analyse runs with a more complex structure.
For the rest of this subsection, fix a set of registers , an output register , and an NFA over a finite alphabet of elementary additive and reset substitutions. Similarly to Claim 13, this covers a more general case where the alphabet of consists of substitutions adding integer values to some registers and resetting other registers.
Let be such that for some . We define , and we call it the effect of . The integer conic hull of a set of vectors is the set of linear combinations of vectors from with nonnegative integer coefficients. The following theorem is a direct consequence of a classical result by Carathédory, see, e.g., [35].
Theorem 14 (Only vectors are sufficient to represent a positive point).
Let . If all components of a vector are strictly positive and , then there exists with and a constant such that .
We now state two important lemmas describing the shape of runs labelled by words over and , respectively.
Lemma 15 (Decomposition lemma for additive runs).
For every run of such that , there exist , words , and integers such that
-
for every word , there exists a run ,
-
, and
-
and .
Proof idea.
We iterate a process that eliminates all the simple cycles from . These simple cycles are labelled by some words and the process returns a cycle-free run that is labelled by a word . We can describe the additive effect of the run as the effect of plus the effect of all the simple cycles that we eliminated. Finally, we argue there exists a short run from to that contains a vertex from each of these simple cycles.
Proof.
Consider the following iterative process on . Initialise .
-
Identify the first simple cycle in and replace it by . By simple cycle we mean a run where only the first and last states are equal.
-
Update the value of the vector to .
Let be the resulting run. This process guarantees that is cycle-free and that , where is the number of times we have eliminated a simple cycle with effect , for all .
Let be the set of states visited by . The shortest run that visits all states of has length at most . Since every word corresponds to a simple cycle eliminated by the process, it follows that there exists words such that for every word , there exists a run and even if can be as large as .
Lemma 16 (Pumping lemma).
If , then there exists a word with , where if and only if there exist words , such that
-
,
-
-
, and
-
for each , there are with .
Proof idea.
Given a run in of sufficiently large value, we can split it into different segments such that in each segment we know for every register if it is going to be reset in the future or not. Thus, for every register, we can determine if a segment of the run is relevant for determining its final value. Subsequently, we identify all cycles of this run and argue that since all the registers hold large values at the end of the run, the total !! effect of the relevant cycles (the ones after the last reset of the register) must be a large positive number for each register. This allows us to use Lemma 15 to conclude that we do not have too many such cycles and that we can pump them up in order to achieve unbounded register values.
Proof.
The right to left implication of this lemma is immediate, so we focus on the left to right implication. Assume there exists a run , for some such that .
We can assume that the value of each register is reset at least once along , since we can add additional reset substitutions to the beginning of without changing the value of . For each , , the be the last reset substitution for register in . Without loss of generality, we can assume that in the registers are reset for the last time in the increasing order of their indices. Then can be represented as
Observe that for each , , we can replace in all reset substitutions of registers with the identity substitution without changing the value of . Thus, become words over additive substitutions only. Hence we now get that . By applying Lemma 15 to each run , we obtain that
where are all words of length smaller than . Since
and |
for every , there must exists a vector such that . By Theorem 14, there exists a subset such that and (pointwise).
It remains to show that there exist words such that and . Indeed, consider a run for some . Either contains no cycles from , in which case there exists a word of length at most corresponding to the run , or it does contain some cycles from . In the latter case, we can use Lemma 15 to argue that there exist words such that for every word , there exists a run . In both cases, either or . Thus, we can obtain the required words by possibly concatenating the and words that we identified.
4 CRAs with two registers
In this section, we prove the following result.
Theorem 17.
The boundedness problem for CRAs with two registers is NL-complete if the numbers in the substitutions are presented in unary, and in coNP if they are in binary.
By the results of the previous section, this theorem is equivalent to the following statement.
Proposition 18.
Boundedness of regular -register substitution languages is NL-complete if the numbers in the substitutions are presented in unary, and in coNP if they are in binary.
The remainder of the section is devoted to proving Proposition 18. For the rest of this section, fix the set of registers and the output register . Let us also fix for the rest of the section an input NFA such that (which we can assume by Claim 13). We begin by providing a series of simplifying assumptions for the automaton in the input.
4.1 Simplifying assumptions
In this subsection, we introduce a normal form that significantly simplifies our arguments.
Definition 19 (Graphical notation for ).
We depict elementary substitutions in as shown in Figure 2; details of the notation are discussed in its caption.
For a word , we define the output derivation tree as the derivation tree of the expression . This tree can have three kinds of leaves: constants originating from reset or minimum substitutions, arbitrary constants from coming from additive substitutions, and variables occurring in or of the first substitution . We say that a path from a leaf to the root in is leading if its starting leaf comes from a substitution with the smallest among all leaves that have a path to the root. A path is called -aligned if all its vertices originate from expressions . A word is called -aligned if the leading path of is -aligned.
Example 20 (Depiction of ).
For , corresponds to the tree rooted at the rightmost position corresponding to in the pictorial representation. Consider
The depiction of , in line with Definition˜19, is as follows:
The corresponds to the subgraph drawn in black. The leading path of is marked with a blue outline. Expressions in corresponding to vertices of are typeset on blue background. As not all of them come from mappings, path is not -aligned. An -aligned word such that has the following shape:
Lemma 21 (Leading branch -aligned assumption).
We can assume that each is -aligned.
Therefore, in the remainder of this section we assume that each is -aligned. This means that only parts (b), (c) and (d) from Figure 2 (and not their symmetric -counterparts) can be segments of runs.
4.2 Unboundedness witnesses
In this subsection, we define the shape of witnesses that prove unboundedness of CRAs. Next subsection shows that if a CRA is unbounded, it must contain such a witness. For the rest of this section, fix two substitutions
which will be referred to throughout the whole section. Let and . We introduce two new notations for special types of runs of :
and
used to signify that (i.e., has additive substitutions only), and .
Definition 22 (Unboundedness witness).
A run in is called a trivial unboundedness witness if it has the form
such that , and .
A run in is called a nontrivial unboundedness witness if it has the form
such that , , run is pumpable, and is sustainable, where pumpable and sustainable runs are defined below.
A trivial or nontrivial unboundedness witness is called just an unboundedness witness.
Intuitively, from this definition is used to reach a gadget enabling pumping, witnesses that we can pump up the value of to an arbitrarily large number and then end up in , and certifies that we can maintain a large value of to be output in .
Definition 23 (Pumpable run).
A run is called pumpable if it has one of the four forms:
-
Type A.1 (a cycle with a positive effect on , then a reset of )
such that is a cycle with and is a run with no substitutions.
-
Type A.2 (a cycle with a positive effect on both and , then a minimum substitution)
such that is a cycle with no and no substitutions and with , and is a run with no and no substitutions.
-
Type A.3 (two cycles combining for a positive effect on both and , then a minimum)
such that are cycles with no and no substitutions and with , for some . Furthermore, are runs with no and no substitutions.
-
Type B (a cycle with a positive effect on together with cycles supporting its value)
for some , where , and for every , :
such that is a run with no substitutions, is a cycle with no and no substitutions with and is a run with no substitutions. Furthermore, we require .
Definition 24 (Sustainable run).
A run is called sustainable if it is labelled by and has the following form:
for , runs of the form as depicted in the picture, and cycles such that for every , .
Proposition 25.
Given , deciding if there exists a run in it which is an unboundedness witness is in NL if the numbers in the substitutions are presented in unary, and in NP if they are in binary.
Proof.
Intuitively, using nondeterminism, we can guess a nontrivial witness as in Definition 22 and verify that it has all the required properties. The case of a trivial witness is handled in a similar way and is thus omitted.
Indeed, starting in , we guess one transition at a time until we verify the existence of a witness or exceed the bound on its length. During the traversal, we guess the positions of states at appropriate distances from . This splits the search into three phases corresponding to and . We need to verify that is of one of four types of pumpable runs (cf. Definition 23). At any point in time, if the definition of a pumpable run requires it, we can guess that the current state marks the start of the occurrence of a simple cycle . In this case, we store , follow only labels from and compute the effect of the run until occurs again. This can easily be done in NL or NP depending on the representation of the numbers in the substitutions.
In order to complete the proof of Proposition 18, we need to show that the existence of an unboundedness witness is equivalent to the fact that is not bounded. We show it by two implications stated below. We start with proving Lemma 26, and Lemma 29 is proved in the next subsection.
Lemma 26.
If there exists an unboundedness witness then is not bounded.
Proof.
The proof is straightforward in case of a trivial unboundedness witness. Fix a nontrivial unboundedness witness as in Definition 22:
Fix an arbitrary number . We construct a run such that . We first prove that
Claim 27.
For every there is a run of from to such that for some .
First, by Claim 12 we have that . The claim is immediate if contains a certificate of type A.1, A.2, or A.3. Indeed, we simply repeat the cycles that occur there a sufficient number of times. If contains a certificate of type B, then is a cycle such that the overall effect on is positive. Since every sub-path contains a cycle with a positive effect on and a non-negative effect on , there is a path that repeats each such cycle times. Note that is now a cycle with positive effect on for any value of smaller than . Thus, we can take to be the cycle taken times.
This finishes the proof of the claim. Now, it suffices to show the following:
Claim 28.
For every there exists a run such that .
We prove this claim by induction on the number of occurrences of in . Assume that does not contain any occurrences of . By Claim 27, there exists a path such that . Thus, by Claim 12, since the length of is bounded.
Assume now that there is at least one occurrence of in . Then can be represented as follows:
where the cutting points are states reached after reading . Assume that there is a run such that , for every . Then we can use the cycle with positive effect on inside in order to conclude that there exists a run such that , for every . This concludes the proof.
Lemma 29.
If is not bounded, there exists an unboundedness witness.
4.3 Unboundedness implies the existence of a witness
Proof of Lemma 29..
Assume that is not bounded. Let and . Let be the shortest accepting run of such that , and let be the word labelling . Since is -aligned, it can be split into two parts
for some and , such that is the shortest suffix of satisfying . Note that , and features no substitution that resets (i.e., for which ). Recall that we defined
Since is -aligned, we have that , where is the word labelling . Let be the number of substitutions in . Split the run into segments (some possibly empty)
such that are all the states reached directly after reading each time. Define for . Observe that and .
Example 30.
Consider a run partitioned into segments as defined above:
Let us overlook the slight inaccuracy that a run reaching a large value would have many more additive transitions (cf. Claim 12). The is drawn in black, other (irrelevant) lines are drawn in light grey. Run is the shortest one that contains all black lines. There are occurrences of in , thus is split into parts, and runs end with a transition labelled by .
We first show that unboundedness guarantees the existence of a sustainable part of a witness. Define .
Claim 31.
For every and every transition in such that is a state visited by and , there exists a sustainable run from to of length at most .
We prove the claim by downward induction on , the index of the segment incident with the state of . Base case () is trivial, as . Assume our claim holds for . Fix a transition such that is a state visited by , and . Similarly to the case of a trivial boundedness witness, a steep increase on implies existence of a run such that , are simple paths and a simple cycle, and that . Finally, by applying the inductive hypothesis to , we get a pumpable from to ; we have thus constructed a sustainable run , as required.
It remains to show how to find , the pumpable part of the run. We consider two cases.
Case 1: for some .
(aim: pumpable run of type A) Fix such . Let , where is constructed from by removing transitions with minimum substitutions, and adding whenever for some . Note that and that , thus automaton satisfies the premises of Lemma 16. Using this lemma, we obtain a short pumpable run of type A of – cases A.1, A.2 and A.3 were designed to match all possible loop arrangements. It naturally induces in from to of the same properties. Since is reachable from , there exists a short run between them. Finally, by Claim 31, we obtain a sustainable part of the witness, which completes the analysis of this case.
Case 2: for all .
(aim: witness exists or contradiction) This case proves to be more difficult, as it involves a more complicated type B pumpable run. The proof is by contradiction. Here, since and each provides an increase of at most compared to the previous value , any maximal increasing subsequence of must have at least elements. Therefore, there exist such that
thus is a cycle. For each , , define to be the effect on of the run without its last transition labelled with . We have , and therefore . Assume that has no pumpable run of type B from to (otherwise we obtain a witness easily). Therefore, there exists such that decomposes into
where is the run of maximal length labelled by some without , run is labelled by (possibly empty), and no simple cycle with is reachable from and backwards-reachable from . Note that .
Assume that contains a simple cycle . If , this cycle can be removed from without decreasing the output value, which contradicts the assumption that is the shortest. If otherwise , we obtain a pumpable run of type A.1 featuring and a simple path to . Again, a sustainable run to the final state is guaranteed by Claim 31, and thus in this case the proof is finished.
Hence, we can assume that does not have simple cycles. Due to Claim 12, we have that . By Lemma 15, decomposes into for a run from to of length , and , where is the set of simple cycles that are reachable from and backwards-reachable from by transitions not involving . By assumption, for any . Thus, for each , either or . Hence, for with , we have . Take such that , (and hence ) and is the largest possible among cycles satisfying these conditions. Every simple cycle has length at most , therefore its effect belongs to . Thus, . Let . If there exists such that lies above line , then we have identified two cycles that span a cone having a nonempty intersection with the positive quadrant; this yields a pumpable run of type A.3, and, by Claim 31, we get a sustainable run starting at .
Otherwise, lies below . Since ends with and has effect at least , , therefore . This in turn implies , because is bellow . Hence . We know that , therefore
and thus |
Since , and effects of simple runs and are bounded by Claim 12, we get
and |
Since , we have and finally which yields a contradiction that concludes the proof.
5 Output-minimum CRAs
In this section, we consider CRAs in which minimum substitutions can only appear in the output function. We call such CRAs output-minimum for brevity.
The main results of this section are as follows.
Theorem 32.
Boundedness of output-minimum CRAs with no transpositions is coNP-complete, even if the numbers in the substitutions are presented in unary.
Theorem 33.
Boundedness of output-minimum CRAs is PSPACE-complete, even if the numbers in the substitutions are presented in unary.
For the rest of the section, fix the set of registers . Let for . Once again, we use the formalism of regular languages of substitutions presented in Section 3. Recall that . Since we are considering output-minimum CRAs, similarly to Claim 13, we can assume that the alphabet contains only elementary substitutions from , with the only exception of a minimum transition which comes at the end of the word. Thus, in Section 5.1 and Section 5.2 we consider the language boundedness problem for NFAs such that for some , we have, respectively, and . As shown in Section 3, this is enough to prove Theorems 32 and 33.
5.1 Output-minimum CRAs with no transpositions
Proposition 34.
Boundedness for regular subsets of is coNP-complete, even if the numbers in the substitutions are presented in unary.
Proof.
As a certificate of unboundedness, we consider substitutions , respecting the conditions of Lemma 16, together with a run of witnessing that . Checking the second and third conditions of Lemma 16 is trivial and by having in the certificate, it is also easy to check the first condition in linear time.
Checking the last conditions requires a bit more work. As argued in the proof of Lemma 16, all substitutions in can be modified so that they become additive substitutions without changing the value of . Now, let the vectors be the effects of the modified substitutions . By Theorem 14, we only need to solve the following linear program
which can be done in polynomial time.
To prove coNP-hardness, we reduce the satisfiability problem, which is NP-complete [20], to the complement of the boundedness problem.
Problem 35 (Satisfiability).
Input: A set of clauses over boolean variables .
Question: Does there exist an assignment of Boolean values to the variables satisfying all the clauses?
As registers, we take the set of all clauses: . Let and be the sets of clauses satisfied by and , respectively. Also, for a literal , let . Consider the generalised NFA in Figure 3.
It is readily seen that for any , there exists a word
such that if and only if the variable assignment induced by for variables satisfies all the clauses .
5.2 Output-minimum CRAs with transpositions
Proposition 36.
Boundedness for regular subsets of is in PSPACE.
Proof idea.
We prove containment in PSPACE by operating on an exponentially larger NFA , called permutation NFA. This NFA encodes all possible register permutations inside its state space, and hence its alphabet contains only additive and reset substitutions. It can be checked in NPSPACE whether this larger NFA admits a certificate of the type presented in Lemma 16. By Savitch’s theorem we get that the problem is in PSPACE [38].
Proof.
Fix a finite alphabet and let . Fix NFA such that . Let be the set of all permutations of the set and let , where , , and . We also take , where is the identity permutation. Let be the additive substitution that adds to every register. For and we define . Finally, contains transitions
Clearly, is unbounded if and only if is unbounded if and only if there exist words that adhere to the conditions of Lemma 16 and run of witnessing that . Since , we can store one state with polynomial space. Hence, an NPSPACE algorithm can non-deterministically search for the run without constructing explicitly. Verifying the first three conditions of Lemma 16 can be done on the fly in linear space. Also, a non-deterministic algorithm can guess and verify that are the effects of cycles on the fly. Finally, it is easy to verify that a positive linear combination of them has positive effect on all registers. Thus, we can conclude the argument by recalling that by Savitch’s theorem [38].
Proposition 37.
Boundedness for regular subsets of is PSPACE-hard, even if the numbers in the substitutions are presented in unary.
Proof idea.
We reduce the DFA intersection problem, which is PSPACE-complete [27]. For every state of each DFA, we create a separate register in the constructed CRA . We simulate reading a letter by all the DFAs by moving a large value to the registers corresponding to the new active states of the DFAs, and keeping the values of all remaining registers zero. These large values come from a self-loop transition in the initial state of , and cannot return to the initial state afterwards. All DFAs accept the same word if and only the large values can be simultaneously brought to the registers corresponding to the final states of the DFAs. The output of is thus set to be the minimum of these registers.
Proof.
We reduce from the following PSPACE-complete problem [27]:
Problem 38 (DFA intersection).
Input: , alphabet , DFAs , .
Question: Does there exist a word accepted by all the DFAs?
We can assume that each DFA has only one final state, which can be ensured as follows: add a new letter to and two new states , to each . For each , make this new letter send all states from to , and all other states of to . Make the new letter induce a self-loop for both and make to be the only final state in each DFA.
We construct an NFA such that the language is bounded if and only if is empty. Let . The idea is that the registers correspond to the states of the DFAs, and register has a positive value after reading if and only if the ’th state in is active after reading . Next, we describe in terms of a regular language.
Let be a substitution that increments the registers representing initial states for each . Also, for every , let
There is a substitution in that simulates every transition inside for letter . The idea is that after we guess the next letter , for each we need to simulate the transition that is executed when reading this letter. If we pick the correct transition, we move our positive value from register to , and resetting all other registers does not change their values. However, if we pick a wrong transition, we reset our positive value and we can never recover. Then, a substitution from simulates executing a transition labelled by letter in all and a substitution from simulates choosing a letter and executing a transition labelled by in all . Finally let . We argue that is unbounded if and only if is non-empty.
Consider a word and an integer . For every it follows inductively that there exists a word such that , for if and only if . Thus, there exists a word such that if and only if is non-empty.
6 Stateless CRAs
In this section, for every we present a fairly restricted family of unbounded CRAs with registers such that the length of a shortest run outputting a value is lower bounded by , the st function in the hierarchy of fast-growing functions. These functions are defined as follows. Let and for every let , where denotes the composition of functions, and this composition is taken times. For example, and , where exponentiation is taken times. We construct these CRAs inductively in the following theorem.
Theorem 39.
For every , there exists a stateless CRA with registers and transitions such that for every , any run of that outputs a value of at least must have length at least .
Proof.
For and consider the two CRAs in Figure 4.
Let us prove that and satisfies the statement of the lemma. Let be an arbitrary positive integer. Since we are dealing with stateless CRAs, we denote a configuration by a vector . Clearly, for both and , the transitions labelled by are the only ones that can increase the value of register and since these transitions reset the values of all other counters, any run outputting must start by taking this transition many times, , reaching in and the configurations and , respectively. The value can be seen as the initial budget that is necessary for increasing the values of other registers. Clearly, the shortest run that outputs in reaches the configuration , then takes times the transition labelled by and outputs. Since it must start by getting to the configuration , its length is at most .
Let now be a shortest run in that outputs . Clearly, needs to increase the value of register . The transition labelled by is the only one that increases , however, it contains a minimum update for . Since is a shortest path outputting , before reading it reaches a configuration in which the values of registers are equal, otherwise some transitions can be removed from it without changing the output value.
Thus, initialises the budget by reading , and then, before reading , it reads a word in which applies the function to the value of register . We argue that in order to output , . Indeed, must reach a value in register and then apply many times the function to register , so . Thus, the length of must be longer than . Furthermore, we see that has the following shape .
Assume now that there exists with the property from the statement of the lemma. We modify it by adding a new letter to the alphabet , and extend the substitutions of the transitions as follows:
-
add to ,
-
add to for , and
-
let the substitution of be
.
We know that there exists a shortest path with the following shape . So, in order to increase the register by one, we need to have enough budget on register to be able to apply the function to its value. Since we need to increase the value of by one times, it follows that we need to repeat this process times so that has shape . Thus its length must be at least .
7 Conclusions and open problems
The most obvious open problem left by this work is the decidability of boundedness for copyless linear CRAs with resets with more than two registers. We conjecture that it is decidable for arbitrary number of registers. Our techniques and the shapes of the witnesses for the two-register case might be useful for proving that.
Another interesting open problem is the precise complexity of the two-register case where numbers in the substitutions are presented in binary. We have proved that this problem is NL-hard and in coNP, but no better bound is known even if minimum substitutions are only allowed in the output. In the latter case, it follows from our results that the witness of unboundedness consists of at most two cycles and some paths connecting them. This relates to the following natural problem whose complexity we were not able to find in the literature. Let be a digraph, and be a (bi-criteria) weighting function on its edges. Given and , find a cycle in such that the sum of weights of its edges is component-wise positive. This is of course a generalisation of the problem of finding a cycle of negative weight in a digraph, which can be solved in polynomial time by e.g. Bellman-Ford-Moore algorithm [6].
References
- [1] Shaull Almagor, Udi Boker, and Orna Kupferman. What’s decidable about weighted automata? Information and Computation, 282:104651, 2022. doi:10.1016/j.ic.2020.104651.
- [2] Shaull Almagor, Michaël Cadilhac, Filip Mazowiecki, and Guillermo A. Pérez. Weak cost register automata are still powerful. International Journal of Foundations of Computer Science, 31(6):689–709, 2020. doi:10.1142/S0129054120410026.
- [3] Rajeev Alur, Loris D’Antoni, Jyotirmoy Deshmukh, Mukund Raghothaman, and Yifei Yuan. Regular functions and cost register automata. In 28th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS 2013), pages 13–22, 2013. doi:10.1109/LICS.2013.65.
- [4] Rajeev Alur and Mukund Raghothaman. Decision problems for additive regular functions. In Fedor V. Fomin, Rusins Freivalds, Marta Z. Kwiatkowska, and David Peleg, editors, Automata, Languages, and Programming - 40th International Colloquium, ICALP 2013, Riga, Latvia, July 8-12, 2013, Proceedings, Part II, volume 7966 of Lecture Notes in Computer Science, pages 37–48. Springer, 2013. doi:10.1007/978-3-642-39212-2_7.
- [5] Benjamin Aminof, Orna Kupferman, and Robby Lampert. Reasoning about online algorithms with weighted automata. ACM Transactions on Algorithms, 6(2):28:1–28:36, 2010. doi:10.1145/1721837.1721844.
- [6] Jørgen Bang-Jensen and Gregory Z Gutin. Digraphs: theory, algorithms and applications. Springer Science & Business Media, 2008.
- [7] Michael Blondin, Alain Finkel, Stefan Göller, Christoph Haase, and Pierre McKenzie. Reachability in two-dimensional vector addition systems with states is pspace-complete. In 30th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2015, Kyoto, Japan, July 6-10, 2015, pages 32–43. IEEE Computer Society, 2015. doi:10.1109/LICS.2015.14.
- [8] Michael Blondin, Christoph Haase, Filip Mazowiecki, and Mikhail A. Raskin. Affine extensions of integer vector addition systems with states. Log. Methods Comput. Sci., 17(3), 2021. doi:10.46298/LMCS-17(3:1)2021.
- [9] Krishnendu Chatterjee, Laurent Doyen, and Thomas A. Henzinger. Quantitative languages. ACM Transactions on Computational Logic, 11(4):23:1–23:38, 2010. doi:10.1145/1805950.1805953.
- [10] Karel Culík and Jarkko Kari. Digital images and formal languages. In Grzegorz Rozenberg and Arto Salomaa, editors, Handbook of Formal Languages, Volume 3: Beyond Words, pages 599–616. Springer, 1997. doi:10.1007/978-3-642-59126-6_10.
- [11] Wojciech Czerwiński, Engel Lefaucheux, Filip Mazowiecki, David Purser, and Markus A. Whiteland. The boundedness and zero isolation problems for weighted automata over nonnegative rationals. In Christel Baier and Dana Fisman, editors, LICS ’22: 37th Annual ACM/IEEE Symposium on Logic in Computer Science, Haifa, Israel, August 2 - 5, 2022, pages 15:1–15:13. ACM, 2022. doi:10.1145/3531130.3533336.
- [12] Laure Daviaud. Containment and equivalence of weighted automata: Probabilistic and max-plus cases. In Alberto Leporati, Carlos Martín-Vide, Dana Shapira, and Claudio Zandron, editors, Language and Automata Theory and Applications - 14th International Conference, LATA 2020, Milan, Italy, March 4-6, 2020, Proceedings, volume 12038 of Lecture Notes in Computer Science, pages 17–32. Springer, 2020. doi:10.1007/978-3-030-40608-0_2.
- [13] Laure Daviaud. Register complexity and determinisation of max-plus automata. ACM SIGLOG News, 7(2):4–14, 2020. doi:10.1145/3397619.3397621.
- [14] Laure Daviaud, Pierre-Alain Reynier, and Jean-Marc Talbot. A generalised twinning property for minimisation of cost register automata. In 31st Annual ACM/IEEE Symposium on Logic in Computer Science, (LICS 2016), pages 857–866, 2016. doi:10.1145/2933575.2934549.
- [15] Laure Daviaud and Andrew Ryzhikov. Universality and forall-exactness of cost register automata with few registers. In Jérôme Leroux, Sylvain Lombardy, and David Peleg, editors, 48th International Symposium on Mathematical Foundations of Computer Science, MFCS 2023, August 28 to September 1, 2023, Bordeaux, France, volume 272 of LIPIcs, pages 40:1–40:15. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2023. doi:10.4230/LIPICS.MFCS.2023.40.
- [16] Manfred Droste and Paul Gastin. Weighted automata and weighted logics. Theoretical Computer Science, 380(1-2):69–86, 2007. doi:10.1016/J.TCS.2007.02.055.
- [17] Manfred Droste and Paul Gastin. Weighted automata and weighted logics. In Handbook of weighted automata, pages 175–211. Springer, 2009.
- [18] Manfred Droste, Werner Kuich, and Heiko Vogler. Handbook of Weighted Automata. Springer Berlin, Heidelberg, 1st edition, 2009. doi:10.1007/978-3-642-01492-5.
- [19] Manfred Droste and Dietrich Kuske. Weighted automata. In Jean-Éric Pin, editor, Handbook of Automata Theory, pages 113–150. European Mathematical Society Publishing House, Zürich, Switzerland, 2021. doi:10.4171/Automata-1/4.
- [20] Michael R Garey and David S Johnson. Computers and intractability, volume 174. freeman San Francisco, 1979.
- [21] Christoph Haase and Simon Halfon. Integer vector addition systems with states. In Joël Ouaknine, Igor Potapov, and James Worrell, editors, Reachability Problems - 8th International Workshop, RP 2014, Oxford, UK, September 22-24, 2014. Proceedings, volume 8762 of Lecture Notes in Computer Science, pages 112–124. Springer, 2014. doi:10.1007/978-3-319-11439-2_9.
- [22] Kosaburo Hashiguchi. New upper bounds to the limitedness of distance automata. Theor. Comput. Sci., 233(1-2):19–32, 2000. doi:10.1016/S0304-3975(97)00260-0.
- [23] Kosaburo Hashiguchi, Kenichi Ishiguro, and Shuji Jimbo. Decisability of the equivalence problem for finitely ambiguous automata. International Journal of Algebra and Computation, 12(03):445–461, 2002. doi:10.1142/S0218196702000845.
- [24] John E. Hopcroft and Jean-Jacques Pansiot. On the reachability problem for 5-dimensional vector addition systems. Theoretical Computer Science, 8:135–159, 1979. doi:10.1016/0304-3975(79)90041-0.
- [25] Daniel Kirsten and Sylvain Lombardy. Deciding Unambiguity and Sequentiality of Polynomially Ambiguous Min-Plus Automata. In 26th International Symposium on Theoretical Aspects of Computer Science (STACS 2009), volume 3 of LIPIcs, pages 589–600, 2009. doi:10.4230/LIPIcs.STACS.2009.1850.
- [26] Ines Klimann, Sylvain Lombardy, Jean Mairesse, and Christophe Prieur. Deciding unambiguity and sequentiality from a finitely ambiguous max-plus automaton. Theoretical Computer Science, 327(3):349–373, 2004. doi:10.1016/j.tcs.2004.02.049.
- [27] Dexter Kozen. Lower bounds for natural proof systems. In Proceedings of the 18th Annual Symposium on Foundations of Computer Science, pages 254–266. IEEE Computer Society, 1977. doi:10.1109/SFCS.1977.16.
- [28] Daniel Krob. The equality problem for rational series with multiplicities in the tropical semiring is undecidable. International Journal of Algebra and Computation, 4(3):405–426, 1994. doi:10.1142/S0218196794000063.
- [29] Hing Leung and Viktor Podolskiy. The limitedness problem on distance automata: Hashiguchi’s method revisited. Theor. Comput. Sci., 310(1-3):147–158, 2004. doi:10.1016/S0304-3975(03)00377-3.
- [30] Ernst W. Mayr. An algorithm for the general petri net reachability problem. In Proceedings of the 13th Annual ACM Symposium on Theory of Computing, May 11-13, 1981, Milwaukee, Wisconsin, USA, pages 238–246. ACM, 1981. doi:10.1145/800076.802477.
- [31] Filip Mazowiecki and Cristian Riveros. Maximal partition logic: Towards a logical characterization of copyless cost register automata. In Stephan Kreutzer, editor, 24th EACSL Annual Conference on Computer Science Logic, CSL 2015, September 7-10, 2015, Berlin, Germany, volume 41 of LIPIcs, pages 144–159. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2015. doi:10.4230/LIPICS.CSL.2015.144.
- [32] Filip Mazowiecki and Cristian Riveros. Copyless cost-register automata: Structure, expressiveness, and closure properties. Journal of Computer and System Sciences, 100:1–29, 2019. doi:10.1016/j.jcss.2018.07.002.
- [33] Marvin L. Minsky. Computation: Finite and Infinite Machines. Prentice-Hall, USA, 1967.
- [34] Mehryar Mohri. Finite-state transducers in language and speech processing. Computational Linguistics, 23(2):269–311, 1997. URL: https://aclanthology.org/J97-2003.
- [35] Alexander Schrijver. Theory of linear and integer programming. John Wiley & Sons, Inc., USA, 1986.
- [36] Marcel-Paul Schützenberger. On the definition of a family of automata. Information and Control, 4(2):245–270, 1961. doi:10.1016/S0019-9958(61)80020-X.
- [37] Imre Simon. On semigroups of matrices over the tropical semiring. RAIRO Theor. Informatics Appl., 28(3-4):277–294, 1994. doi:10.1051/ITA/1994283-402771.
- [38] Michael Sipser. Introduction to the Theory of Computation. Course Technology, Boston, MA, third edition, 2013.
- [39] Moshe Y. Vardi. Automatic verification of probabilistic concurrent finite-state programs. In 26th Annual Symposium on Foundations of Computer Science (FOCS 1985), pages 327–338, 1985. doi:10.1109/SFCS.1985.12.
- [40] Andreas Weber. Finite-valued distance automata. Theoretical Computer Science, 134(1):225–251, 1994. doi:10.1016/0304-3975(94)90287-9.