Abstract 1 Introduction 2 Main definitions 3 Regular substitution languages 4 CRAs with two registers 5 Output-minimum CRAs 6 Stateless CRAs 7 Conclusions and open problems References

Boundedness of Cost Register Automata over the Integer Min-Plus Semiring

Andrei Draghici ORCID Department of Computer Science, University of Oxford, UK Radosław Piórkowski ORCID Department of Computer Science, University of Oxford, UK Andrew Ryzhikov ORCID Department of Computer Science, University of Oxford, UK
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 N such that for every word, the value of the CRA on this word does not exceed N. This problem is known to be undecidable for the class of linear CRAs over the integer min-plus semiring ({+},min,+), 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 fi in the hierarchy of fast-growing functions, we provide a stateless CRA with i registers whose output exceeds N only on runs longer than fi(N). Our construction yields a non-elementary lower bound already for four registers.

Keywords and phrases:
cost register automata, boundedness, decidability
Copyright and License:
[Uncaptioned image] © Andrei Draghici, Radosław Piórkowski, and Andrew Ryzhikov; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Quantitative automata
Acknowledgements:
We thank the anonymous reviewers for their helpful comments.
Funding:
margin: [Uncaptioned image] All authors are supported by the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (Grant agreement No. 852769, ARiAT).
Editors:
Jörg Endrullis and Sylvain Schmitz

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 N such that the output of the CRA on every input is smaller than N. 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 ({+},min,+). 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

N{+}.N<+v{+}.(v)(v<N),

where (v) is the predicate that holds true for v{+} if and only if the CRA outputs the value v 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 f(n) such that for every word w the number of accepting runs labelled by w is bounded by f(|w|). If f(n)=1, 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 ({+},min,+) [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 3 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 +{0}. 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 ({+},min,+). Hence, in what follows, we fix 𝕂({+},min,+). 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 X. By Expr(X) we denote the set of expressions constructed using operations min{,} and +, variables from X 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 eExpr()Expr(X) without variables, we denote by eval(e)𝕂 its value.

A substitution over X is a function ν:XExpr(X). We denote the set of all substitutions over X by Sub(X). When defining substitutions, we often treat them as sets of “𝑎𝑟𝑔𝑢𝑚𝑒𝑛𝑡𝑣𝑎𝑙𝑢𝑒” pairs. When X is clear from the context, we implicitly extend partial substitutions with the identity mapping for the omitted arguments. For example, if X={x1,x2}X, then ν={x1e1,x2e2} denotes a substitution satisfying ν(xi)=ei for xiX and ν(x)=x for xXX. A valuation over X is a substitution μ:X𝕂. We denote by Val(X)Sub(X) the set of all valuations over X. We write 𝟎Val(X) for the valuation with 𝟎(x)=0 for every xX. 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 X{x,y,z}.

e min{10,x+5,y+z} Expr(X) (an expression)
ν {x2+min{x,y},y3} Sub(X) (a substitution)
μ {x2,y5,z10} Val(X) (a valuation)

Substitutions can be applied to expressions: given eExpr(X) and νSub(X), by e[ν] we denote the result of simultaneously replacing each occurrence of x with ν(x) for every xX. Substitutions can be composed: for ν,νSub(X), we define the composition (ν;ν)Sub(X) as (ν;ν)(x)=ν(x)[ν]. Applying a valuation μ to an expression e yields an expression without variables – thus, with a defined value from 𝕂. We hence define evalμ(e)eval(e[μ]). For a valuation μ and a substitution ν, we let evalμ(ν)eval(μ;ν).

Example 2 (Application and composition of substitutions).

Continuing Example 1, we have

e[ν] =min{10,(2+min{x,y})+5,(3)+(z)} Expr(X) (e with ν applied to it)
e[μ] =min{10,(2)+5,(5)+(10)} Expr() (e with μ applied to it)
evalμ(e) =eval(e[μ])=7 𝕂 (the value of e[μ])

For e,eExpr(X), we write ee if evalμ(e)=evalμ(e) for every μVal(X). Additionally, for ν,νSub(X), we write νν whenever ν(x)ν(x) for every xX. For an expression e, by maxc(e) we denote the maximal absolute value of constants different to + appearing in e, and 0 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 e is in a canonical linear form if

e=min{x1+c1,x2+c2,,xk+ck}

for some pairwise-different x1,,xkX, c1,,ck𝕂, and k. Any expression e such that ee for an expression e in a canonical linear form is called linear. A substitution ν is linear with resets if for every xX, ν(x) is either linear or 0 (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 x,xX such that xx the expressions ν(x) and ν(x) feature disjoint sets of variables. By Exprlin(X) and Subclr(X) 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 ν:

ν{xy+5ymin{x,z2}z55{xmin{y+5}ymin{x+0,z+(2)}z0,ν{xmin{x}ymin{x,y}

We have that νSubclr({x,y,z}) because it is equivalent to a linear substitution with resets in a canonical form, and variables x,y,z occur at most once in its expressions. In contrast, ν is linear, but not copyless, because x occurs in both ν(x) and ν(y).

2.2 Cost register automata

Definition 4 (CRA).

A copyless linear CRA with resets over 𝕂 is a tuple

𝒞=(X,Q,Σ,δ,qini,out)

consisting of a finite set X of registers, a finite alphabet Σ, a finite set Q of control states, an initial state qiniQ, and two functions:

  • a transition rule function δ:Q×ΣQ×Subclr(X),

  • an output function out:QExprlin(X).

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 𝒞=(X,Q,Σ,δ,qini,out) naturally induces a (possibly infinite) deterministic labelled transition system 𝒞(Conf𝒞,Σ,Δ𝒞,cini), where Conf𝒞Q×Val(X) is the set of configurations, cini(qini,𝟎) is the initial configuration and Δ𝒞:Conf𝒞×ΣConf𝒞 is a transition function defined as Δ𝒞((q,μ),σ)(q,evalμ(ν)), where (q,ν)=δ(q,σ). We extend Δ𝒞 to words as usually: for a configuration t, a letter σΣ and a word wΣ, Δ𝒞(t,σw)Δ𝒞(Δ(t,σ),w) and Δ𝒞(t,ε)t. We further define the function 𝒞:Σ𝕂 calculated by 𝒞 as 𝒞(w)=evalμ(out(q)), where (q,μ)=Δ(cini,w). 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 Σ={a,#}. It has two states p and q, where p is the initial state, and two registers x and y. The output function for state p (words ending with a and the empty word) is min{x,y} and for state q (words ending with #) is 0. Both registers are initialised with value 0. If the input word ends with # or is empty, this CRA outputs 0. Call a sequence of consecutive a’s a block. A block is maximal if it is not contained in a longer block. If the input word ends with a, the CRA outputs the length of the shortest maximal block. Register x stores the number of a’s read in the current block, and y stores the minimum length of maximal blocks read so far. This CRA is a copyless linear CRA with resets.

Figure 1: An example of a CRA over the semiring 𝕂.

We say that a CRA 𝒞 is bounded if there is N such that 𝒞(w)<N for all wΣ. 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 Subclr(X). Every word wΣ read by a CRA 𝒞 induces a sequence of substitutions that 𝒞 performs when reading w. Fix a CRA 𝒞=(X,Σ,Q,qini,δ,out). We define the language of substitutions x(𝒞) induced by it. Observe that the set of substitutions that occur in the transitions and output expressions of 𝒞 is finite. We denote it by Γ𝒞,x. The regular language x(𝒞) is then formally defined as the language of the following automaton NFAx(𝒞). 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 xX.

Definition 8 (NFAx(𝒞)).

Given a CRA 𝒞=(X,Q,Σ,δ,qini,out), define a nondeterministic finite automaton NFAx(𝒞)(Q,Γ𝒞,x,δ,qini,{qfin}) where QQ{qfin} and the transition relation δQ×Γx,𝒜×Q contains transitions:

(q,ν,q) δfor every q,qQ, and ν,σ such that δ(q,σ)=(q,ν),
(q,{xout(q)},qfin) δfor every qQ.

Fix an NFA 𝒜=(Q,S,δ,qini,Qfin) and a set of registers X={x1,,xd} for the rest of this subsection. An alternating sequence π=q0ν1q1ν2q2qn1νnqn of states from Q and letters from S is called a run in 𝒜 labelled by the word w=ν1ν2νn. We write q0π,wqn to denote the fact that π is a run labelled by w that begins in q0 and ends in qn. For such a run and μVal(X), we define evalμ(π)evalμ(w). We identify words with compositions of the corresponding sequences of substitutions. The set of runs of 𝒜 is denoted by Runs(𝒜). A run π is accepting if qini𝜋qfin. An NFA 𝒜 accepts wS whenever there exists an accepting run of 𝒜 labelled by w. 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 p𝜈q and runs qπ,wr. For example, we may consider a run π=p𝜈qπ,wr labelled by a word νw. When the labelling is not important, we write q𝜋r.

There is an obvious correspondence between runs in 𝒞 and in NFAx(𝒞). In particular, for k𝕂, there exists wΣ such that 𝒞(w)=k if, and only if, there exists u(𝒜) such that eval𝟎(u)(x)=k. This allows us to restate the boundedness problems in terms of languages of substitutions. We say that a regular language LSubclr(X) has bounded output in xX if there exists N such that for every wL we have eval𝟎(s)(x)<N.

Problem 9 (Boundedness of regular d-register substitution languages).

Input: NFA 𝒜 over a finite set SSubclr(X), |X|=d, output register xX.

Question: Does (𝒜) have bounded output in x?

Note that boundedness for CRAs (Problem 7) easily reduces to this problem in deterministic logarithmic space. Indeed, it suffices to compute NFA(𝒜) 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 νSubclr(X) is elementary if it has one of the following forms for some x,yX, c𝕂:

{xx+c} (additive sub.) {xy,yx} (transposition)
{xmin{x,y},y0} (minimum sub.) {x0} (reset sub.)

Let Subelem(X)Subclr(X) be the set of elementary substitutions, and let TXRXAXMX be its partition into sets of transpositions, and reset, additive, and minimum substitutions.

Lemma 11.

For every νSubclr(X) in a canonical form, there exists a word of substitutions uSubelem(X) of length O(d2) such that uν.

Note that the statement of the above lemma is not true in the general setting of Sub(X), as its proof relies on copylessness. Note also that Lemma 11 implies the existence of a homomorphism to-elem:Subclr(X)Subelem(X) such that νto-elem(ν) for every νSubclr(X). For a finite set SSub(X), we define maxc(S)max{maxc(ν)|νS}. The following two claims are not difficult to prove.

Claim 12 (Maximal constant grows linearly w.r.t. length).

Fix a finite SSubelem(X). For every wS, we have maxc(w)|w|maxc(S).

Claim 13 (Elementary substitutions assumption).

We may assume w.l.o.g. that the alphabet S of 𝒜 consists only of elementary substitutions, i.e., SSubelem(X).

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 X={x1,,xd}, an output register xX, and an NFA 𝒜 over a finite alphabet SAXRXSubelem(X) 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 wAX be such that w{x1x1+c1,,xdxd+cd} for some c1,,cd𝕂. We define eff(w)(c1,,cd)𝕂X, and we call it the effect of w. The integer conic hull Cone(V) of a set of vectors V is the set of linear combinations of vectors from V 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 d vectors are sufficient to represent a positive point).

Let Vd. If all components of a vector b are strictly positive and bCone(V), then there exists VV with |V|d and a constant λ>0 such that λbCone(V).

We now state two important lemmas describing the shape of runs labelled by words over AX and AXRX, respectively.

Lemma 15 (Decomposition lemma for additive runs).

For every run qπ,wq of 𝒜 such that wAX, there exist n, words w1,,wn,,w,z1,,zn+1AX, and integers a1,,an such that

  • for every word zz1w1z2znwnzn+1, there exists a run q𝑧q,

  • eff(w)=eff(w)+a1eff(w1)++aneff(wn), and

  • |w1|,,|wn|,|w||Q| and |z1zn+1||Q|2.

Proof idea.

We iterate a process that eliminates all the simple cycles from π. These simple cycles are labelled by some words w1,,wd and the process returns a cycle-free run π that is labelled by a word w. We can describe the additive effect of the run π as the effect of w plus the effect of all the simple cycles that we eliminated. Finally, we argue there exists a short run from q to q that contains a vertex from each of these simple cycles.

Proof.

Consider the following iterative process on π. Initialise b=𝟎X.

  • Identify the first simple cycle rπi,wir in π and replace it by r. By simple cycle we mean a run where only the first and last states are equal.

  • Update the value of the vector b to b+eff(wi).

Let qπ,wq be the resulting run. This process guarantees that π is cycle-free and that eff(w)=eff(w)+b=eff(w)+a1eff(w1)++aneff(wn), where ai is the number of times we have eliminated a simple cycle with effect wi, for all 1in.

Let QQ be the set of states visited by π. The shortest run that visits all states of Q has length at most |Q|2. Since every word wi corresponds to a simple cycle eliminated by the process, it follows that there exists words z1,,zn+1 such that for every word zz1w1z2znwnzn+1, there exists a run q𝑧q and |z1zn+1||Q|2 even if n can be as large as 2|Q|.

Lemma 16 (Pumping lemma).

If SAXRX, then there exists a word w(𝒜) with eval𝟎(w)>2d|Q|C, where Cmaxc(S) if and only if there exist words α1,,αd+1, β1,,βdAX such that

  • α1β1+α2αdβd+αd+1ηX(𝒜),

  • |β1|,,|βd||Q|

  • |α1αd+1|<(d+1)|Q|2, and

  • for each N, there are a1,,ad with eval𝟎(α1β1a1α2αdβdadαd+1ηX)(x1)>N.

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 π=qini𝑤qfin, for some qfinQfin such that eval𝟎(w)(x1)>2d|Q|C.

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 w without changing the value of eval𝟎(w)(x1). For each i, 1id, the νi be the last reset substitution for register xi in w. Without loss of generality, we can assume that in w the registers are reset for the last time in the increasing order of their indices. Then π can be represented as

π=qiniπ1,w1q1ν1q1π2,w2q2ν2πd,wdqdνdqdπd+1,wd+1qd+1ηXqfin.

Observe that for each i, 1id1, we can replace in wi all reset substitutions of registers xi+1,,xd with the identity substitution without changing the value of eval𝟎(w)(x1). Thus, w1,,wd+1 become words over additive substitutions only. Hence we now get that eval𝟎(w1ν1wd+1)=eff(w1)++eff(wd+1). By applying Lemma 15 to each run π1,,πd+1, we obtain that

eval𝟎(w1ν1wd+1)= eff(w1)+a1(1)eff(w1(1))++an1(1)eff(wn1(1))
eff(wd+1)+a1(d+1)eff(w1(d+1))++and+1(d+1)eff(wnd+1(d+1))

where w1(1),,wnd+1(d+1),w1,,wd+1 are all words of length smaller than |Q|. Since

eval𝟎(w1ν1wd+1)(x)>2d|Q|C and eff(w1wd+1)(x)(d+1)|Q|C

for every xX, there must exists a vector b+X such that bCone({w1(1),,wd+1(d+1)}). By Theorem 14, there exists a subset {β1,,βd}{w1(1),,wd+1(d+1)} such that bCone({β1,,βd}) and b>𝟎 (pointwise).

It remains to show that there exist words α1,,αd+1 such that |α1αd+1|<(d+1)|Q|2 and α1β1+α2αdβd+αd+1ηX(𝒜). Indeed, consider a run πi for some 1id+1. Either πi contains no cycles from {β1,,βd}, in which case there exists a word wi of length at most |Q| corresponding to the run πi, or it does contain some cycles {βj,,βj+h} from {β1,,βd}. In the latter case, we can use Lemma 15 to argue that there exist words zj,,zj+h+1 such that for every word zzjβjzj+1zj+hβj+hzj+h+1, there exists a run qi1𝑧qi. In both cases, either |w||Q| or |zjzj+h+1||Q|2. Thus, we can obtain the required words α1,,αd+1 by possibly concatenating the wi and zi 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 2-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 X{x,y} and the output register x. Let us also fix for the rest of the section an input NFA 𝒜=(Q,S,δ,qini,Qfin) such that STXAXMXRXSubelem(X) (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 Subelem(X)).

We depict elementary substitutions in Subelem(X) as shown in Figure 2; details of the notation are discussed in its caption.

{xyyxTX

(a) Transposition.

{x0yyRX

(b) Reset substitution.

{xx+cyyAX

(c) Additive substitution.

{xmin{x,y}y0MX

(d) Minimum substitution.
Figure 2: Pictorial representation of elementary substitutions in Subelem({x,y}). Register x is always drawn above y. A black dot stands for adding a constant – our graphical notation disregards the particular values of constants in the substitutions. A branching depicts the minimum operation. For the operations on y, the diagrams are symmetric. The effect of gluing several drawings together horizontally naturally corresponds to composition of depicted substitutions.

For a word w=ν1ν2νnSubelem(X), we define the output derivation tree out-tree(w) as the derivation tree of the expression w(x). This tree can have three kinds of leaves: constants 0 originating from reset or minimum substitutions, arbitrary constants from 𝕂 coming from additive substitutions, and variables occurring in ν1(x) or ν1(y) of the first substitution ν1. We say that a path from a leaf to the root in out-tree(w) is leading if its starting leaf comes from a substitution νi with the smallest i among all leaves that have a path to the root. A path is called x-aligned if all its vertices originate from expressions (νi(x))1in. A word w is called x-aligned if the leading path of out-tree(w) is x-aligned.

Example 20 (Depiction of out-tree(w)).

For wSubelem(X), out-tree(w) corresponds to the tree rooted at the rightmost position corresponding to x in the pictorial representation. Consider

w {xxyy+3{xxy0{xx+2yy{xxyy+2{xmin{x,y}y0{xyyx{xx+3yy
{xx+3yy{xmin{x,y}y0{xxyy+5{xxy0{xmin{x,y}y0

The depiction of w, in line with Definition˜19, is as follows:

The out-tree(w) corresponds to the subgraph drawn in black. The leading path π of out-tree(w) is marked with a blue outline. Expressions in w corresponding to vertices of π are typeset on blue background. As not all of them come from xe mappings, path π is not x-aligned. An x-aligned word w such that w(x)w(x) has the following shape:

Lemma 21 (Leading branch x-aligned assumption).

We can assume that each w(𝒜) is x-aligned.

Therefore, in the remainder of this section we assume that each w(𝒜) is x-aligned. This means that only parts (b), (c) and (d) from Figure 2 (and not their symmetric y-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

η={xmin{x,y},y0} and ρ={xx,y0},

which will be referred to throughout the whole section. Let N|Q| and Cmaxc(S). We introduce two new notations for special types of runs of 𝒜:

and  

used to signify that w1AX (i.e., has additive substitutions only), and w2(AX{ρ}).

Definition 22 (Unboundedness witness).

A run π in 𝒜 is called a trivial unboundedness witness if it has the form

such that |π|3N, eff(θ)(x)>0 and qfinQfin.

A run π in 𝒜 is called a nontrivial unboundedness witness if it has the form

π=qiniπaqaπbqbπcqc

such that |πa|N, |πb|,|πc|3N2, run πb is pumpable, and πc is sustainable, where pumpable and sustainable runs are defined below.

A trivial or nontrivial unboundedness witness is called just an unboundedness witness.

Intuitively, πa from this definition is used to reach a gadget enabling pumping, πb witnesses that we can pump up the value of x to an arbitrarily large number and then end up in qb, and πc certifies that we can maintain a large value of x to be output in qcQfin.

Definition 23 (Pumpable run).

A run πb is called pumpable if it has one of the four forms:

  • Type A.1 (a cycle with a positive effect on x, then a reset of y)

    ( )

    such that θ is a cycle with eff(θ)(x)>0 and α is a run with no η substitutions.

  • Type A.2 (a cycle with a positive effect on both x and y, then a minimum substitution)

    ( )

    such that θ is a cycle with no η and no ρ substitutions and with eff(θ)+2, and α is a run with no η and no ρ substitutions.

  • Type A.3 (two cycles combining for a positive effect on both x and y, then a minimum)

    ( )

    such that θ1,θ2 are cycles with no η and no ρ substitutions and with a1eff(θ1)+a2eff(θ2)+2, for some a1,a2. Furthermore, α1,α2 are runs with no η and no ρ substitutions.

  • Type B (a cycle with a positive effect on x together with cycles supporting its value)

    π=p1π1p2π2p3pn1πn1pnπnp1

    for some n, where p1=qa=qb, and for every i, 1in:

    ( )

    such that αi is a run with no η substitutions, θi is a cycle with no η and no ρ substitutions with eff(θi)×+ and βi is a run with no η substitutions. Furthermore, we require eff(α1θ1β1α2θ2β2αnθnβn)(x)>0.

Definition 24 (Sustainable run).

A run πc is called sustainable if it is labelled by wc(AX{ρ,η}) and has the following form:

for n, runs αi,βi of the form as depicted in the picture, and cycles θi such that eff(θi)×+ for every i, 1in.

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 π=πaπbπc 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 qini, we guess one transition at a time until we verify the existence of a witness or exceed the bound N+4N2 on its length. During the traversal, we guess the positions of states qa,qb,qc at appropriate distances from qini. This splits the search into three phases corresponding to πa,πb and πc. We need to verify that πb 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 r marks the start of the occurrence of a simple cycle θ. In this case, we store r, follow only labels from AX{ρ} and compute the effect of the run until r 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:

π=qiniπaqaπbqbπcqc.

Fix an arbitrary number N. We construct a run π such that eval𝟎(π)(x)N. We first prove that

Claim 27.

For every M there is a run πb of 𝒜 from qa to qb such that eval𝟎(πaπb)=(M,0) for some M>M.

First, by Claim 12 we have that CNeval𝟎(πa)(x)CN. The claim is immediate if πb 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 πb contains a certificate of type B, then πb=p1π1p2π2p3pn1πn1pnπnp1 is a cycle such that the overall effect on x is positive. Since every sub-path π1,,πn contains a cycle with a positive effect on y and a non-negative effect on x, there is a path πb′′ that repeats each such cycle M+CN times. Note that πb′′ is now a cycle with positive effect on x for any value of x smaller than M+CN. Thus, we can take πb to be the cycle πb′′ taken M+CN times.

This finishes the proof of the claim. Now, it suffices to show the following:

Claim 28.

For every M there exists a run πc such that eval𝟎(πaπbπc)(x)M.

We prove this claim by induction on the number of occurrences of η in πc. Assume that πc does not contain any occurrences of η. By Claim 27, there exists a path πb such that eval𝟎(πaπb)(x)M+CN. Thus, eval𝟎(πaπbπc)(x)M by Claim 12, since the length of πc is bounded.

Assume now that there is at least one occurrence of η in πc. Then πc can be represented as follows:

πc=qbρ1,α1q1ρ2,α2q2ρ3,α3ρr,αrqfin,

where the cutting points are states reached after reading η. Assume that there is a run qiniπi1,wi1qi1 such that eval𝟎(wi1)(x)M, for every M. Then we can use the cycle with positive effect on y inside ρi in order to conclude that there exists a run qiniπi,wiqi such that eval𝟎(wi)M, for every M. 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 M15C2N3 and W12CN2. Let π be the shortest accepting run of 𝒜 such that eval𝟎(π)(x)>M+W, and let w be the word labelling π. Since π is x-aligned, it can be split into two parts

π=qiniπpreq0πsufqfin

for some q0Q and qfinQfin, such that πsuf is the shortest suffix of π satisfying out-tree(π)=out-tree(πsuf). Note that eval𝟎(πpref)(x)=0, and πsuf features no substitution ν that resets x (i.e., for which ν(x)=0). Recall that we defined

η={xmin{x,y},y0} and ρ={xx,y0}.

Since π is x-aligned, we have that wsuf(AX{η,ρ}), where wsuf is the word labelling πsuf. Let n be the number of substitutions η in w. Split the run πsuf into segments (some possibly empty)

q0π1,w1q1π2,w2q2qnπn+1,wn+1qn+1

such that q1,,qn are all the states reached directly after reading η each time. Define vieval𝟎(πprefπ1πi)(x) for 0in+1. Observe that v0=0 and vn+1M+W.

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 out-tree(w) is drawn in black, other (irrelevant) lines are drawn in light grey. Run πsuf is the shortest one that contains all black lines. There are n=4 occurrences of η in wsuf, thus πsuf is split into 5 parts, and runs π1,,π4 end with a transition labelled by η.

We first show that unboundedness guarantees the existence of a sustainable part πc of a witness. Define mmax{i|vi<M}.

Claim 31.

For every i>m and every transition s𝜈t in 𝒜 such that t is a state visited by πi and ν(y)=0, there exists a sustainable run πc from t to qfin of length at most 3N2.

We prove the claim by downward induction on i, the index of the segment πi incident with the state t of ν. Base case (i=n+1) is trivial, as wn+1AX. Assume our claim holds for i+1. Fix a transition s𝜈t such that t is a state visited by πi, and ν(y)=0. Similarly to the case of a trivial boundedness witness, a steep increase on y implies existence of a run πc=t𝛼rθ,wθrβ,wβs𝜂qi such that wθ,wβAX, α,β are simple paths and θ a simple cycle, and that eff(θ)(y)>0. Finally, by applying the inductive hypothesis to s𝜂qi, we get a pumpable πc′′ from qi to qfin; we have thus constructed a sustainable run πcπc′′, as required.

It remains to show how to find πb, the pumpable part of the run. We consider two cases.

Case 1: 𝒗𝒊+𝟏𝒗𝒊>𝟒𝑪𝑵 for some 𝒊[𝒎,𝒏].

(aim: pumpable run of type A) Fix such i. Let 𝒜=(S,Q{qi+1},qi,{qi+1},δ), where δ is constructed from δ by removing transitions with minimum substitutions, and adding q𝜂qi+1 whenever q𝜂qi+1 for some qQ. Note that wi(𝒜) and that eval𝟎(wi)(x)>4CN, thus automaton 𝒜 satisfies the premises of Lemma 16. Using this lemma, we obtain a short pumpable run πb of type A of 𝒜 – cases A.1, A.2 and A.3 were designed to match all possible loop arrangements. It naturally induces πb in 𝒜 from qi to qi+1 of the same properties. Since qi is reachable from qini, there exists a short run πa between them. Finally, by Claim 31, we obtain a sustainable part πc 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 vn+1vm>(M+W)M=12CN2 and each vi+1 provides an increase of at most 4CN compared to the previous value vi, any maximal increasing subsequence of (vi)min must have at least 12CN24CN=3N elements. Therefore, there exist k, such that

mk<n,vk<v,M<vi<M+Wforki,and qk=q

thus π(k]πk+1πl is a cycle. For each i, kil, define ci𝕂 to be the effect on x of the run πi without its last transition labelled with η. We have vi+1vi+ci, and therefore i=k1ci>vvk>0. Assume that 𝒜 has no pumpable run of type B from qk to q (otherwise we obtain a witness easily). Therefore, there exists i[k,l] such that πi decomposes into

πi qi1α,ur1β,vr2𝜂qi,

where β is the run of maximal length labelled by some vAX without ρ, run α is labelled by u(AX{ρ}) (possibly empty), and no simple cycle θ with eff(θ)×+ is reachable from r1 and backwards-reachable from r2. Note that eval𝟎(πpreπ1π2πi1α)(y)=0.

Assume that α contains a simple cycle θ. If eff(θ)(x)0, this cycle can be removed from π without decreasing the output value, which contradicts the assumption that π is the shortest. If otherwise eff(θ)(x)>0, we obtain a pumpable run of type A.1 featuring θ and a simple path to r1. Again, a sustainable run to the final state qfin 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 eff(α)(x)[CN,CN]. By Lemma 15, eff(β) decomposes into eff(β)=eff(β)+(A,B) for a run β from r1 to r2 of length N, and (A,B)Cone(Θ), where Θ is the set of simple cycles that are reachable from r1 and backwards-reachable from r2 by transitions not involving ρ. By assumption, eff(θ)×+ for any θΘ. Thus, for each θΘ, either eff(θ)(x)<0 or eff(θ)(y)0. Hence, for θ with eff(θ)(y)>0, we have eff(θ)(x)<0. Take θ such that eff(θ)=(a,b), b>0 (and hence a<0) and ba is the largest possible among cycles satisfying these conditions. Every simple cycle has length at most N, therefore its effect belongs to [CN,CN]2. Thus, CN1ba. Let (t)bat. If there exists θ such that eff(θ) 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 qi.

Otherwise, Cone(Θ) lies below . Since πi ends with η and has effect at least M, eff(β)(y)>M, therefore B>0. This in turn implies A<0, because (A,B) is bellow . Hence B<A=baACNA. We know that eval(vi1,0)(πi)M, therefore

{eval(vi1,0)(αβ)(x)Meval(vi1,0)(αβ)(y)M and thus {vi1+eff(α)(x)+eff(β)(x)+AM 0+eff(β)(y)+BM

Since vi<M+W, and effects of simple runs α and β are bounded by Claim 12, we get

{M+W+2CN+AMCN+BM and {12C2N3+2C2N2CNAB15C2N3CN

Since B<CNA, we have 15C2N3CN<12C2N3+2C2N2 and finally 3C2N3<2C2N2+CN 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 X{x1,,xd}. Let ηX{x1min{xxX}} for XX. Once again, we use the formalism of regular languages of substitutions presented in Section 3. Recall that Subelem(X)=TXRXAXMX. Since we are considering output-minimum CRAs, similarly to Claim 13, we can assume that the alphabet contains only elementary substitutions from TXRXAX, 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 XX, we have, respectively, (𝒜)(AXRX)ηX and (𝒜)(AXRXTX)ηX. 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 (AXRX)ηX is coNP-complete, even if the numbers in the substitutions are presented in unary.

Proof.

As a certificate of unboundedness, we consider substitutions α1,,αd+1, β1,,βd respecting the conditions of Lemma 16, together with a run π of 𝒜 witnessing that α1β1+α2αdβd+αd+1ηX(𝒜). 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 β1,,βd can be modified so that they become additive substitutions without changing the value of eval𝟎(α1β1a1α2αdβdadαd+1ηX)(x1). Now, let the vectors v1,,vd be the effects of the modified substitutions β1,,βd. By Theorem 14, we only need to solve the following linear program

a1,,ad0 s.t. a1v1+a2v2++advd>0,

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 C={c1,,cm} of clauses over boolean variables p1,,pn.

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: X=C={c1,,cm}. Let Cp{cC|pc} and C¬p{cC¬pc} be the sets of clauses satisfied by p= and p=, respectively. Also, for a literal x, let inc(x){cc+1|cCx}. Consider the generalised NFA 𝒜 in Figure 3.

Figure 3: Generalised NFA 𝒜 for satisfiability. Transitions are labelled by regular expressions.

It is readily seen that for any N, there exists a word

w(inc(Cp1)Ninc(C¬p1)N)(inc(Cpn)Ninc(C¬pn)N)ηX

such that eval𝟎(w)(x1)N if and only if the variable assignment induced by w for variables p1,,pn satisfies all the clauses c1,,cm.

5.2 Output-minimum CRAs with transpositions

Proposition 36.

Boundedness for regular subsets of (AXRXTX)ηX 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 SAXRXTX and let C=maxc(S). Fix NFA 𝒜=(Q,S{ηX},δ,qini,Qfin) such that (𝒜)SηX. Let GX be the set of all permutations of the set X and let 𝒫𝒜=(Q,S{ηX},δ,qini,Qfin), where Q=Q×GX, S=STX, and Qfin=Qfin×GX. We also take qini=(qini,τ0), where τ0 is the identity permutation. Let idS be the additive substitution that adds 0 to every register. For sTX and τGX we define (τs)(x)=s(τ(x)). Finally, δcontains transitions

((q,τ),id,(q,τs)) δfor every (q,s,q)δ such that sAX,
((q,τ),s,(q,τ)) δfor every (q,s,q)δ such that sTX.

Clearly, 𝒜 is unbounded if and only if 𝒫𝒜 is unbounded if and only if there exist words α1,,αd+1,β1,,βd that adhere to the conditions of Lemma 16 and run π of 𝒫𝒜 witnessing that α1β1+α2αdβd+αd+1ηX(𝒫𝒜). Since |Q|=|Q|d!, 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 v1,vd are the effects of cycles β1,,βd 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 NPSPACE=PSPACE by Savitch’s theorem [38].

Proposition 37.

Boundedness for regular subsets of (AXRXTX)ηX 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: n, alphabet Σ, n DFAs 𝒜i=(Qi,Σ,δi,qini(i),Qfin(i)), 1in.

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 qi+, qi to each 𝒜i. For each i, make this new letter # send all states from Qfin(i) to qi+, and all other states of 𝒜i to qi. Make the new letter induce a self-loop for both qi+,qi and make qi+ to be the only final state in each DFA.

We construct an NFA 𝒜 such that the language (𝒜) is bounded if and only if 1in(𝒜i) is empty. Let X={qi(j)1jn,qiQj}. The idea is that the registers correspond to the states of the DFAs, and register ri(j) has a positive value after reading wΣ if and only if the i’th state in 𝒜j is active after reading w. Next, we describe (𝒜) in terms of a regular language.

Let νinc={qini(i)qini(i)+11in} be a substitution that increments the registers representing initial states for each 𝒜i. Also, for every σΣ, let

Ti,σ={{qq}{q0qq}(q,σ,q)δi,qq} and
Tσ=T1,σT2,σTn,σ,
T=σΣTσ.

There is a substitution in Ti,σ that simulates every transition inside 𝒜i for letter σΣ. The idea is that after we guess the next letter σΣ, for each 𝒜i 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 qi to qi, 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 Tσ simulates executing a transition labelled by letter σ in all 𝒜i and a substitution from T simulates choosing a letter σΣ and executing a transition labelled by σ in all 𝒜i. Finally let νout={xmin{qfin(i)1in}}. We argue that (𝒜)=νincTνout is unbounded if and only if 1inL(Ai) is non-empty.

Consider a word w=σ1σmΣ and an integer N. For every 1in it follows inductively that there exists a word wjincN+1Tσ1Tσ2Tσj such that eval𝟎(wj)(q(i))=N+1, for qQi if and only if qini(i)σ1σjq(i). Thus, there exists a word wmνincTνout such that eval𝟎(wm)=N+1 if and only if 1inL(Ai) is non-empty.

6 Stateless CRAs

In this section, for every d2 we present a fairly restricted family of unbounded CRAs with d registers such that the length of a shortest run outputting a value N is lower bounded by Fd1(N), the (d1)st function in the hierarchy of fast-growing functions. These functions are defined as follows. Let F1(n)=2n and for every k2 let Fk(n)=Fk1Fk1(1), where denotes the composition of functions, and this composition is taken n times. For example, F2(n)=2n and F3(n)=222=Tower(n), where exponentiation is taken n times. We construct these CRAs inductively in the following theorem.

Theorem 39.

For every d2, there exists a stateless CRA 𝒞 with d registers and d transitions such that for every N+, any run of 𝒞d that outputs a value of at least N must have length at least Fd1(N).

Proof.

For d=2 and d=3 consider the two CRAs in Figure 4.

Figure 4: Unbounded CRAs 𝒞2 (left) and 𝒞3 (right) with 2 and 3 registers.

Let us prove that 𝒞2 and 𝒞3 satisfies the statement of the lemma. Let N+ be an arbitrary positive integer. Since we are dealing with stateless CRAs, we denote a configuration (q,{x1k1,x2k2,,xnkn}) by a vector (k1,k2,,kn). Clearly, for both 𝒞2 and 𝒞3, the transitions labelled by a1 are the only ones that can increase the value of register x1 and since these transitions reset the values of all other counters, any run outputting N must start by taking this transition m many times, m>0, reaching in 𝒞2 and 𝒞3 the configurations (m,0) and (m,0,0), respectively. The value m can be seen as the initial budget that is necessary for increasing the values of other registers. Clearly, the shortest run that outputs N in 𝒞2 reaches the configuration (2N,0), then takes N times the transition labelled by a2 and outputs. Since it must start by getting to the configuration (2N,0), its length is at most F1(N)=2N.

Let now π3 be a shortest run in 𝒞3 that outputs N. Clearly, π3 needs to increase the value of register x3. The transition labelled by a3 is the only one that increases x3, however, it contains a minimum update for x1. Since π3 is a shortest path outputting N, before reading a3 it reaches a configuration in which the values of registers x2,x3 are equal, otherwise some transitions can be removed from it without changing the output value.

Thus, π3 initialises the budget by reading a1m, and then, before reading a3, it reads a word in a2 which applies the function F11()=2 to the value of register x1. We argue that in order to output N, m=F21(N)=2N. Indeed, π3 must reach a value m in register x1 and then apply N many times the function F11() to register x1, so m=F21(N). Thus, the length of π3 must be longer than F2(N). Furthermore, we see that π3 has the following shape (0,0,0)(F2(N),0,0)(N,N,N).

Assume now that there exists 𝒞d1 with the property from the statement of the lemma. We modify it by adding a new letter ad to the alphabet Σ, and extend the substitutions of the transitions as follows:

  • add xd0 to a1,

  • add xdxd to ai for 1<i<d1, and

  • let the substitution of ad be
    {x1min{x1,,xd1},x20,,xd10,xdxd+1}.

We know that there exists a shortest path πd1 with the following shape (0,,0)(Fd2(N),0,,0)(N,N,,N,0). So, in order to increase the register xd by one, we need to have enough budget on register x1 to be able to apply the function Fd21 to its value. Since we need to increase the value of xd by one N times, it follows that we need to repeat this process N times so that πd has shape (0,,0)(Fd1(N),0,,0)(N,N,,N,N). Thus its length must be at least Fd1(N).

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 G=(V,E) be a digraph, and ω:E2 be a (bi-criteria) weighting function on its edges. Given G and ω, find a cycle in G 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.