This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

\lmcsheading

11(3:14)2015 1–32 Oct. 02, 2014 Sep. 17, 2015 \ACMCCS[Theory of computation]: Formal languages and automata theory

\titlecomment\lsuper

*This work is a revised and extended version of [19]

Quantitative Languages Defined by Functional Automata\rsuper*

Emmanuel Filiot\rsupera \lsupera,cUniversité Libre de Bruxelles, Computer Science Department {efilio, jraskin}t@ulb.ac.be Raffaella Gentilini\rsuperb \lsuperbUniversity of Perugia, Department of Mathematics and Computer Science raffaella.gentilini@dmi.unipg.it  and  Jean-François Raskin\rsuperc
Abstract.

A weighted automaton is functional if any two accepting runs on the same finite word have the same value. In this paper, we investigate functional weighted automata for four different measures: the sum, the mean, the discounted sum of weights along edges and the ratio between rewards and costs. On the positive side, we show that functionality is decidable for the four measures. Furthermore, the existential and universal threshold problems, the language inclusion problem and the equivalence problem are all decidable when the weighted automata are functional. On the negative side, we also study the quantitative extension of the realizability problem and show that it is undecidable for sum, mean and ratio. We finally show how to decide whether the language associated with a given functional automaton can be defined with a deterministic one, for sum, mean and discounted sum. The results on functionality and determinizability are expressed for the more general class of functional group automata. This allows one to formulate within the same framework new results related to discounted sum automata and known results on sum and mean automata. Ratio automata do not fit within this general scheme and different techniques are required to decide functionality.

Key words and phrases:
quantitative languages, weighted automata, functionality, realizability, determinization
1991 Mathematics Subject Classification:
F.4.3, I.2.1
\lsuperaEmmanuel Filiot is supported by F.R.S.-FNRS (as a research associate, “Chercheur Qualifié”)
\lsuperbRaffaella Gentilini acknowledges support from the Italian National Group for Scientific Computing (GNCS-INdAM)
\lsupercJean-François Raskin is supported by ERC Starting Grant (279499: inVEST)

1. Introduction

Recently, there have been several efforts made to lift the foundations of computer aided verification and synthesis from the basic Boolean case to the richer quantitative case, e.g. [11, 8, 2]. This paper belongs to this line of research and contributes to the study of quantitative languages over finite words.

Our paper proposes a systematic study of the algorithmic properties of several classes of functional weighted automata (defining quantitative languages). A functional weighted automaton is a nondeterministic weighted automaton such that any two accepting runs ρ1\rho_{1}, ρ2\rho_{2} on a word ww associate with this word a unique value 𝖵(ρ1)=𝖵(ρ2){\sf V}(\rho_{1})={\sf V}(\rho_{2}). As we show in this paper, several important verification problems are decidable for nondeterministic functional weighted automata while they are undecidable (or not known to be decidable) for the full class of nondeterministic weighted automata.

In this paper, we study automata in which an integer weight, or a pair of integer weights, is associated with each of their transitions. From those weights, an (accepting) run ρ\rho on a word ww associates a sequence of weights with the word, and this sequence is mapped to a rational value by a measure function. We consider four different measure functions111We do not consider the measure functions Min and Max that map a sequence to the minimal and the maximal value that appear in the sequence as the nondeterministic automata that use those measure functions can be made deterministic and all the decision problems for them have known and simple solutions [11].: (i)(i) Sum computes the sum of the weights along the sequence, (ii)(ii) Avg returns the mean value of the weights, (iii)(iii) Dsum computes the discounted sum of the weights for a given discount factor λ]0,1[\lambda\in\mathbb{Q}\cap]0,1[, and (iv)(iv) Ratio is applied to a sequence of pairs of weights, and it returns the ratio between the sum of weights appearing as the first component (rewards) and the sum of the weights appearing as the second component (costs). All those measures are motivated by applications in computer aided verification and synthesis, see for example [14, 7]. The value associated with a word ww is obtained by combining all the values of the accepting runs on ww with a particular operation (usually max or min). The value of ww is denoted by LA(w)L_{A}(w).

Contributions Classical results on weighted automata consider operations over semirings: the value of a run is obtained as the multiplication of the values along its transitions, and the values of all runs on the same input word are combined with addition [16]. Since we focus on functional automata, all the accepting runs have the same value, and so we do not need addition. Whenever it is possible, we phrase our results in the general framework of functional group automata, i.e. automata whose transitions are weighted by elements of a group. In particular, Sum, Avg, and Dsum can be seen as operations over a group. For Ratio however, we always need different techniques, and leave its encoding in terms of a group operation as open.

We first show that functionality is decidable in PTime for group automata (operations on group elements are assumed to be computable in polynomial time). This implies that functionality is PTime for Dsum automata and generalizes known results for Sum and Avg automata. By using a pumping argument, we show that functionality is in CoNP for Ratio-automata.

Then we solve the following decision problems, along the line of [11]. First, we consider threshold problems. The existential (universal, respectively) threshold problem asks, given a weighted automaton AA and a threshold ν\nu\in\mathbb{Q}, if there exists a word (if for all words, respectively) ww accepted by AA: LA(w)νL_{A}(w)\geq\nu. Those problems can be seen as generalizations of the emptiness and universality problems for finite-state automata. Second, we consider the quantitative language inclusion problem that asks, given two weighted automata AA and BB, if all words accepted by AA are also accepted by BB, and for all accepted words ww of AA, we have LA(w)LB(w)L_{A}(w)\leq L_{B}(w). We show that all those problems are decidable for the four classes of measure functions that we consider in this paper when the automata are functional. In particular, for Ratio, we show decidability of the inclusion problem using a recent algorithm to solve quadratic diophantine equations [20], this is a new deep result in mathematics and the complexity of the algorithm is not yet known. We also show that the equivalence problem can be decided in polynomial space for Ratio via an easy reduction to functionality. Note that those decidability results are in sharp contrast with the corresponding results for the full class of nondeterministic weighted automata: for that class, only the existential threshold problem is known to be decidable, the language inclusion problem is undecidable for Sum [25, 1], and therefore for Avg and Ratio, while the problem is open for Dsum.

Finally, we consider a (finite word) quantitative variant of the realizability problem introduced by Church, which is related to the synthesis of reactive systems [32, 35] and can be formalized as a game in which two players (the system and the environment) alternate in choosing letters in their respective alphabet of signals. The system can decide to stop the game. By doing so, they form a word which is obtained by concatenating the successive choices of the players. The realizability problem asks, given a weighted automaton AA, a threshold ν0\nu\geq 0, and an alphabet Σ=Σ1×Σ2\Sigma=\Sigma_{1}\times\Sigma_{2}, if there exists a strategy for choosing the letters in Σ1\Sigma_{1} in the word forming game such that no matter how the adversary chooses his letters in Σ2\Sigma_{2}, the word ww that is obtained belongs to the language of AA and A(w)>νA(w)>\nu. We show that this problem is undecidable for 𝖲𝗎𝗆{\sf Sum}, 𝖠𝗏𝗀{\sf Avg}, and 𝖱𝖺𝗍𝗂𝗈{\sf Ratio} functional automata (the case Dsum is left open). However, we show that the realizability problem is decidable for the deterministic versions of the automata studied in this paper. This motivates the determinizability problem.

The determinizability problem asks, given a functional weighted automaton AA, if the quantitative language defined by AA is also definable by a deterministic automaton. It is known that Sum, Avg and Dsum-automata are not determinizable in general [11]. We give here a decidable necessary and sufficient condition for the determinizability of functional group automata, and we show how to construct a deterministic automaton from the functional one when this is possible. As a corollary, we obtain a decidable characterization of determinizable functional Sum-, Avg- and Dsum-automata. While it was known for Sum (and as a consequence for Avg, by seing the Avg-automaton as a Sum-automaton) [23], it is new for Dsum.

Functionality versus Unambiguity Functional weighted automata are a natural generalization of unambiguous weighted automata, i.e. weighted automata such that there is at most one accepting run for each input word. Since unambiguity captures most of the nondeterminism that is useful in practice, our results are both theoretically and practically important. Functional weighted automata are equivalent (modulo an exponential blow-up) to unambiguous weighted automata. This exponential blow-up is worst-case unavoidable. It is already unavoidable when going from a non-deterministic to an unambiguous finite automaton [33]. Therefore, we inherit this succinctness result.

Having algorithms to test for functionality has the nice consequence of providing algorithms to test for equivalence of functional (and hence unambiguous) weighted automata: given two functional weighted automata A1A_{1} and A2A_{2}, they are equivalent iff they have the same domain, and their union is functional. For Ratio-automata for instance, this gives better complexity than applying our result on inclusion (which is, in some sense, a harder problem).

In all the decision problems we consider but functionality, considering unambiguous weighted automata instead of functional ones would not have simplified the algorithms nor the proofs, because in a way, unambiguous automata capture already all the difficulty of non-deterministic behaviours, and are, therefore, as difficult as functional automata to deal with. Therefore, considering functional automata with respect to decision problems comes, in some sense, for free.

Related Works Motivated by open problems in computer-aided verification, our work follows the same line as [11]. However [11] is concerned with weighted automata on infinite words, either non-deterministic, for which some important problems are undecidable (e.g. inclusion of Avg-automata), or deterministic ones, which are strictly less expressive than functional automata. The Ratio measure is not considered either. Their domains of quantitative languages are assumed to be total (as all states are accepting and their transition relation is total) while we can define partial quantitative languages thanks to an acceptance condition. Functional weighted automata where all states are accepting correspond to deterministic weighted automata: all the transitions that leave the same state on the same input symbol must carry the same weight, and therefore, a simple subset construction allows one to transform any such functional automaton into a deterministic one.

Except for realizability, our results for Sum-automata (and to some extent Avg-automata) are not new [30]. Functionality is known to be in PTime [23], and emptiness, inclusion, equivalence (for functional Sum-automata) are already known to be decidable [26, 27]. Moreover, it is known that determinizability of functional Sum-automata is decidable in PTime [23], as well as for the strictly more expressive class of polynomially ambiguous Sum-automata [22], for which the termination of Mohri’s determinization algorithm [16] is decidable. Weighted automata over semirings have been extensively studied [16], and more generally rational series [5]. Mohri’s determinization algorithm has been generalized in [23] to arbitrary semirings, in which a general condition for its termination, generalizing the notion of twins property in [13, 29], is given. However, this sufficient condition only applies to commutative semirings, and therefore cannot directly be used for Dsum-automata. We rephrase the twinning property on groups that are not necessarily commutative and prove that it is a sufficient condition for a functional group automata to be determinizable. Our determinization algorithm for functional group automata is similar to Mohri’s algorithm and is, in that sense, not new. However, since we cannot rely on the additive operation, we need some different computation of the output values of the constructed deterministic automaton. Further, we extend [23] from functional Sum-automata to functional Avg and Dsum-automata, proving that the twinning property is also a necessary condition toward determinization for these measures.

The techniques we use for deciding functionality and determinization are also inspired by techniques from word transducers [34, 6, 4, 13, 37]. In particular, our procedure to decide functionality of weighted automata also allows us to decide functionality of a word transducer, seen as a weighted automaton over the free group. It generalizes to arbitrary groups the procedure of [4] which was used to show that functionality of word transducers is in PTime. As in [4], it relies on a notion of delay between two runs. This notion of delay is also used for the determinization of group automata.

In [10], Boker et. al. show that Dsum-automata on infinite words with a trivial accepting condition (all states are accepting), but not necessarily functional, are determinizable for any discount factor of the form 1/n1/n for some n2n\in\mathbb{N}_{\geq 2}, while we consider arbitrary discounted factors. Their proof is based on a notion of recoverable gap, similar to that of delays. Finally in [17], the relation between discounted weighted automata over a semiring and weighted logics is studied.

To the best of our knowledge, our results on Dsum and Ratio-automata, as well as on the realizability problem, are new. Our main and most technical results are functionality and inclusion of Ratio-automata, undecidability of the realizability of functional Sum-automata, and solvability of the deterministic versions of the realizability problem. The latter reduce to games on graphs that are to the best of our knowledge new, namely finite 𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆,𝖱𝖺𝗍𝗂𝗈{\sf Sum},{\sf Avg},{\sf Dsum},{\sf Ratio}-games on weighted graphs with a combination of a reachability objective and a quantitative objective.

2. Quantitative Languages and Functionality

Let Σ\Sigma be a finite alphabet. We denote by Σ\Sigma^{*} the set of finite words over Σ\Sigma, and Σ+\Sigma^{+} the set of non-empty words over Σ\Sigma. The empty word is denoted by ϵ\epsilon. In this paper, we assume that weighted automata process input words that end with a terminal symbol Σ{\dashv}\in\Sigma. We denote by Σ+\Sigma_{\dashv}^{+} the set of words of the form uu{\dashv}, where u(Σ{})u\in(\Sigma\setminus\{{\dashv}\})^{*}.

A quantitative language L over Σ\Sigma is a mapping L:Σ+{}L:\Sigma_{\dashv}^{+}\rightarrow\mathbb{Q}\cup\{\perp\}222As in [11], we do not consider the empty word as our weighted automata do not have initial and final weight functions. This eases our presentation but all our results carry over to the more general setting with initial and final weight function [16].. For all wΣ+w\in\Sigma_{\dashv}^{+}, L(w)L(w) is called the value of ww. L(w)=L(w)=\perp means that the value of ww is undefined. We set <v\perp<v for all vv\in\mathbb{Q}.

Let n0n\geq 0. Given a finite sequence v=v0vnv=v_{0}\dots v_{n} of integers (resp. a finite sequence v=(r0,c0)(rn,cn)v^{\prime}=(r_{0},c_{0})\dots(r_{n},c_{n}) of pairs of natural numbers, ci>0c_{i}>0 for all ii) and λ\lambda\in\mathbb{Q} such that 0<λ<10<\lambda<1, we define the following functions:

𝖲𝗎𝗆(v)=i=0nvi𝖠𝗏𝗀(v)=𝖲𝗎𝗆(v)n+1𝖣𝗌𝗎𝗆(v)=i=0nλivi𝖱𝖺𝗍𝗂𝗈(v)=i=0nrii=0nci{\sf Sum}(v)=\sum_{i=0}^{n}v_{i}\quad{\sf Avg}(v)=\frac{{\sf Sum}(v)}{n+1}\quad{\sf Dsum}(v)=\sum_{i=0}^{n}\lambda^{i}v_{i}\quad{\sf Ratio}(v^{\prime})=\dfrac{\sum_{i=0}^{n}r_{i}}{\sum_{i=0}^{n}c_{i}}

Weighted Automata Let V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆,𝖱𝖺𝗍𝗂𝗈}V{\in}\{{\sf Sum},{\sf Avg},{\sf Dsum},{\sf Ratio}\}. A weighted VV-automaton over Σ\Sigma is a tuple A=(Q,qI,F,δ,γ)A{=}(Q,q_{I},F,\delta,\gamma) where QQ is a finite set of states, qIq_{I} is an initial state, FF is a set of final states, δ=δδ\delta=\delta^{\prime}\cup\delta_{\dashv} is a transition relation, where δ(QF)×(Σ{})×(QF)\delta^{\prime}\subseteq(Q\setminus F){\times}(\Sigma\setminus\{\dashv\}){\times}(Q\setminus F) and δ(QF)×{}×F\delta_{\dashv}\subseteq(Q\setminus F){\times}\{\dashv\}{\times}F is the terminal set of transitions, and γ:δ\gamma:\delta\rightarrow\mathbb{Z} (resp. γ:δ×(0)\gamma:\delta\rightarrow\mathbb{N}{\times}(\mathbb{N}-0) if V=𝖱𝖺𝗍𝗂𝗈V={\sf Ratio}) is a weight function. The size of AA is defined by |A|=|Q|+|δ|+tδlog2(γ(t))|A|=|Q|+|\delta|+\sum_{t\in\delta}log_{2}(\gamma(t)). Note that (Q,qI,F,δ)(Q,q_{I},F,\delta) is a classical finite-state automaton, called the input-automaton. We say that AA is deterministic if its input-automaton (Q,qI,F,δ)(Q,q_{I},F,\delta) is deterministic. In the sequel, we use the term VV-automata to denote either 𝖲𝗎𝗆{\sf Sum}, 𝖣𝗌𝗎𝗆{\sf Dsum}, 𝖠𝗏𝗀{\sf Avg} or 𝖱𝖺𝗍𝗂𝗈{\sf Ratio}-automata.

A run ρ\rho of AA over w=σ0σnΣ+w=\sigma_{0}\dots\sigma_{n}\in\Sigma^{+} is a sequence ρ=q0σ0q1σnqn+1\rho=q_{0}\sigma_{0}q_{1}\dots\sigma_{n}q_{n+1} such that q0=qIq_{0}=q_{I} and for all i{0,,n}i\in\{0,\dots,n\}, (qI,σi,qi+1)δ(q_{I},\sigma_{i},q_{i+1})\in\delta. It is accepting if qn+1Fq_{n+1}\in F. We write ρ:q0𝑤qn+1\rho:q_{0}\xrightarrow{w}q_{n+1} to denote that ρ\rho is a run on ww starting at q0q_{0} and ending in qn+1q_{n+1}. Given i{0,,n}i\in\{0,\dots,n\}, we write ρi\rho_{i} to denote the prefix of the run ρ\rho until position ii. The domain of AA, denoted by dom(A)\text{dom}(A), is defined as the set of words wΣw\in\Sigma^{*} on which there exists some accepting run of AA. Note that by definition of δ\delta, we have dom(A)Σ+=(Σ{})\text{dom}(A)\subseteq\Sigma_{\dashv}^{+}=(\Sigma\setminus\{\dashv\})^{*}{\dashv}. We say that AA is unambiguous if it admits at most one accepting run for each word.

The function VV is naturally extended to runs as follows:

V(ρ)={V(γ(q0,σ0,q1)γ(qn,σn,qn+1)) if ρ is accepting otherwiseV(\rho)\ =\ \left\{\begin{array}[]{llllll}V(\gamma(q_{0},\sigma_{0},q_{1})\dots\gamma(q_{n},\sigma_{n},q_{n+1}))&\text{ if $\rho$ is accepting}\\ \perp&\text{ otherwise}\end{array}\right.

The relation RAV={(w,V(ρ))|wΣ+,ρ is an accepting run of A on w}R_{A}^{V}\ =\ \{(w,V(\rho))\ |\ w\in\Sigma^{+},\rho\text{ is an accepting run of $A$ on $w$}\} is called the relation induced by AA. It is functional if for all words wΣ+w\in\Sigma_{\dashv}^{+}, we have |{v|(w,v)RAV}|1|\{v\ |\ (w,v)\in R_{A}^{V}\}|\leq 1. In that case we say that AA is functional. The quantitative language LA:Σ+{}L_{A}:\Sigma_{\dashv}^{+}\rightarrow\mathbb{Q}\cup\{\perp\} defined by AA is defined by LA:wmax{v|(w,v)RAV}L_{A}:w\mapsto\max\{v\ |\ (w,v)\in R_{A}^{V}\} where max=\max\ \emptyset=\perp.

{exa}

Fig. 1 illustrates two Sum-automata over the alphabet {a,b,}\{a,b,{\dashv}\}. The first automaton (on the left) defines the quantitative language wΣ+max(#a(w),#b(w))w\in\Sigma_{\dashv}^{+}\mapsto\max(\#_{a}(w),\#_{b}(w)), where #α(w)\#_{\alpha}(w) denotes the number of occurrences of the letter α\alpha in ww. Its induced relation is {(w,#a(w))wΣ+}{(w,#b(w))wΣ+}\{(w,\#_{a}(w))\mid w\in\Sigma_{\dashv}^{+}\}\cup\{(w,\#_{b}(w))\mid w\in\Sigma_{\dashv}^{+}\}. The second automaton (on the right) defines the quantitative language that maps any word of length at least 2 to the number of occurrences of its last letter but one.

Remark 1.

In the literature, weighted automata are sometimes equipped with a terminal function that associates with accepting states a value. Instead, we assume that weighted automata accepts only words that end with the terminal symbol \dashv. The two models are equivalent in the following sense: we can always transform a weighted automaton AA over an alphabet Γ\Gamma with a terminal function, into a weighted automaton AA_{\dashv} over the alphabet Γ{}\Gamma\cup\{\dashv\} without terminal function, such that dom(A)=dom(A)\text{dom}(A_{\dashv})=\text{dom}(A){\dashv} and such that all the decision problems we consider are preserved, such as functionality, emptiness, determinizability, etc. In other words, AA is functional iff AA_{\dashv} is, etc. This is done by adding transitions from accepting states qfq_{f} of AA to a fresh accepting state of AA_{\dashv} on reading \dashv, with values t(qf)t(q_{f}) if tt is the terminal function. We rather use terminal symbols instead of terminal functions since it lightens the notations in our proofs.

All our results but determinizability hold true for weighted automata without terminal function nor terminal symbol, because the latter can easily be encoded as weighted automata with a terminal symbol, while preserving the properties we are interested in. For determinization however, our determinization procedure, if it terminates, does not necessarily produce a deterministic weighted automaton without terminal function/symbol, even if we apply it to a weighted automaton without terminal function/symbol. The deterministic weighted automata that are constructed by our procedure coincide with the classical notion of subsequential weighted automata with terminal function that is sometimes used in the literature [16]. Without terminal function/symbol, deterministic weighted automata coincide with sequential weighted automata. Since the notion of subsequentiality is more general than sequentiality, and since it already guarantees decidability of the realizability problem, we rather consider this more general class.

A state qq is accessible (by some word wΣw\in\Sigma^{*}) if AA admits a run ρ:qI𝑤q\rho:q_{I}\xrightarrow{w}q. A state qq is co-accessible (by some word wΣw\in\Sigma^{*}) if AA admits a run ρ:q𝑤qf\rho:q\xrightarrow{w}q_{f} for some qfFq_{f}\in F. We say that a state qq is useful if it is both accessible and co-accessible (and useless, otherwise). Useless states can be removed from the given weighted automaton in linear time, without changing the recognized language [30]. A weighted automaton with no useless state is said to be trim.

A pair of states (q,q)(q,q^{\prime}) is co-accessible if there exists a word ww such that qq and qq^{\prime} are co-accessible by ww.

qIq_{I}qaq_{a}qbq_{b}qfq_{f}a|1,b|0a|1,b|0a|0,b|1a|0,b|1a|1,b|0a|1,b|0a|0,b|1a|0,b|1|0{\dashv}|0|0{\dashv}|0|0{\dashv}|0pIp_{I}ppqqpap_{a}qbq_{b}qfq_{f}a|1,b|0a|1,b|0a|0,b|1a|0,b|1a|1,b|0a|1,b|0a|0,b|1a|0,b|1a|1a|1b|1b|1|0{\dashv}|0|0{\dashv}|0
Figure 1. Examples of Sum-automata

Functional Weighted Automata The Sum-automaton on the left of Fig. 1 is not functional (e.g. the word abbabb{\dashv} maps to the values 1 and 2), while the one on the right is functional (and even unambiguous). Concerning the expressiveness of functional automata, we can show that deterministic automata are strictly less expressive than functional automata which are again strictly less expressive than the full class of weighted automata. Let V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖱𝖺𝗍𝗂𝗈}V\in\{{\sf Sum},{\sf Avg},{\sf Ratio}\}. The automata of Fig. 1 can be seen as VV-automata (with a constant cost 11 if V=𝖱𝖺𝗍𝗂𝗈V={\sf Ratio}). The right VV-automaton cannot be expressed by any deterministic VV-automaton because the value of a word depends on its last letter. The left VV-automaton cannot be expressed by any functional VV-automaton. It is easy to verify that the above results hold also for 𝖣𝗌𝗎𝗆{\sf Dsum}-automata. Therefore, for the four measures that we consider, i.e. for V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖱𝖺𝗍𝗂𝗈,𝖣𝗌𝗎𝗆}V\in\{{\sf Sum},{\sf Avg},{\sf Ratio},{\sf Dsum}\}, deterministic VV-automata are strictly less expressive than functional VV-automata which are again strictly less expressive than the full class of VV-automata.

The following result shows that unambiguous VV-automata are as expressive as functional VV-automata, modulo an exponential blow-up. This blow-up is worst-case unavoidable, already for non-deterministic and unambiguous finite state automata [33].

Lemma 2.

Let V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆,𝖱𝖺𝗍𝗂𝗈}V\in\{{\sf Sum},{\sf Avg},{\sf Dsum},{\sf Ratio}\}. For all functional VV-automaton with nn states we can construct an equivalent unambiguous VV-automaton with O(n2n)O(n\cdot 2^{n}) states.

Proof 2.1.

Our proof is independent on the measure. Let A=(Q,qI,F,δ,γ)A=(Q,q_{I},F,\delta,\gamma) be a functional VV-automaton. We order the transitions of δ\delta by a total order denoted by <δ<_{\delta}. We construct an unambiguous automaton A=(Q,qI,F,δ,γ)A^{\prime}=(Q^{\prime},q^{\prime}_{I},F^{\prime},\delta^{\prime},\gamma^{\prime}) equivalent to AA, where:

  • Q=Q×2QQ^{\prime}=Q\times 2^{Q} ;

  • qi=(qI,)q^{\prime}_{i}=(q_{I},\varnothing) ;

  • F=F×{PQ|FP=}F^{\prime}=F\times\{P\subseteq Q\ |\ F\cap P=\varnothing\} ;

  • γ:((p,P),a,(p,P))γ(p,a,p)\gamma^{\prime}\ :\ ((p,P),a,(p^{\prime},P^{\prime}))\mapsto\gamma(p,a,p^{\prime}) ;

Before defining δ\delta^{\prime} formally, let us explain intuitively the semantics of the states in QQ^{\prime}. The automaton AA^{\prime} will guess a run of AA on first state component (called the current run). A pair (p,P)(p,P) represents the state pp of current run in the original automaton AA while PP represents the states reached by all the runs that are greater than the current run (w.r.t. the order <δ<_{\delta} lexigraphically extended to runs). At the end of the word, the run is accepting iff pp is accepting and there is no accepting state in PP. In other words, a run of AA^{\prime} on a word ww is accepting iff the run it defines on the first component is the biggest accepting run of AA on ww.

When a new letter aΣa\in\Sigma is read, AA^{\prime} guesses a transition from pp to some state pp^{\prime}, and goes to the state (p,SPSp,a,p)(p^{\prime},S_{P}\cup S_{p,a,p^{\prime}}), where SPS_{P} are the successor states of of PP by δ\delta on the input aa, and Sp,a,pS_{p,a,p^{\prime}} are all the states reached from pp by a transition on aa bigger than (p,q,p)(p,q,p^{\prime}) (according to <δ<_{\delta}).

Formally, ((p,P),a,(p,P))δ((p,P),a,(p^{\prime},P^{\prime}))\in\delta^{\prime} iff

  • (p,a,p)δ(p,a,p^{\prime})\in\delta ;

  • P={q|qP,(q,a,q)δ}{p′′|(p,a,p′′)δ(p,a,p)<δ(p,a,p′′)}P^{\prime}=\{q^{\prime}\ |\ \exists q\in P,\ (q,a,q^{\prime})\in\delta\}\cup\{p^{\prime\prime}\ |\ (p,a,p^{\prime\prime})\in\delta\wedge(p,a,p^{\prime})<_{\delta}(p,a,p^{\prime\prime})\}.

It is clear by construction that AA and AA^{\prime} define the same domain. As AA is functional, they also define the same function, because the value of a word is equal to the value of any run on it, and in particular to the value of the smallest run (w.r.t <δ<_{\delta}).

Group Automata Whenever possible, we generalise our result to group automata. Group automata are defined as weighted automata, except that the weights are taken from a group structure. Since there are no operation to combine the values of all the runs on the same input word, group automata define functions from words to set of values. Let us recall the definition of a group. A group is a structure (W,,𝟙)(W,\cdot,\mathbb{1}), where WW is a set, :W×WW\cdot:W\times W\rightarrow W is an associative operation, 𝟙W\mathbb{1}\in W is a two sided identity element for \cdot over WW, and each element sWs\in W admits an inverse s1Ws^{-1}\in W, such that s1s=ss1=𝟙s^{-1}\cdot s=s\cdot s^{-1}=\mathbb{1} (the inverse is unique).

A group automaton over Σ\Sigma and a group (W,,𝟙)(W,\cdot,\mathbb{1}) is a tuple A=(Q,qI,F,δ,γ)A{=}(Q,q_{I},F,\delta,\gamma) where Q,qI,F,δQ,q_{I},F,\delta are defined as for weighted automata, and γ:δW\gamma:\delta\rightarrow W is the weight function. Runs are defined as for weighted automata, and the value V(ρ)V(\rho) of a run is obtained by taking the product of the weights of the transitions of ρ\rho. The language defined by AA, denoted by LAL_{A}, is a function from Σ+\Sigma^{+} to finite subsets of WW, defined by LA(w)={V(ρ)|ρ is an accepting run on w}L_{A}(w)=\{V(\rho)\ |\ \rho\text{ is an accepting run on }w\}.

All the notions defined for weighted automata, such as functionality, accessible states, etc. carry over to group automata. When a group automaton AA is functional, we rather write LA(w)=vL_{A}(w)=v instead of LA(w)={v}L_{A}(w)=\{v\}. Finally, we assume that the operations over group elements are computable in polynomial time in the size of their representation.

When considering only the relation induced by weighted VV-automata, it turns out that they are equivalent to group automata, for V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆}V\in\{{\sf Sum},{\sf Avg},{\sf Dsum}\}.

Lemma 3.

Let V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆}V\in\{{\sf Sum},{\sf Avg},{\sf Dsum}\}. There exists a group GVG_{V} and a partial function ψ:GV\psi:G_{V}\rightarrow\mathbb{Q}, such that for all weighted VV-automaton AA, one can construct, in linear-time, a group automaton AgA_{g} over GVG_{V} such that for all wΣ+w\in\Sigma^{+}, we have:

  • for all vv\in\mathbb{Q}, if (w,v)RAV(w,v)\in R_{A}^{V}, there exists sGVs\in G_{V} s.t. sLAg(w)s\in L_{A_{g}}(w) and ψ(s)=v\psi(s)=v,

  • for all sGVs\in G_{V} s.t. sLAg(w)s\in L_{A_{g}}(w), (w,ψ(s))RAV(w,\psi(s))\in R_{A}^{V}.

Proof 2.2.

For Sum and Avg, we define G𝖲𝗎𝗆=(,+,0)G_{\sf Sum}=(\mathbb{Z},+,0) and G𝖠𝗏𝗀=(2,,(0,0))G_{\sf Avg}=(\mathbb{Z}^{2},\cdot,(0,0)), where \cdot is the pairwise sum. An Avg-automaton AA can be turned into a group automaton over G𝖠𝗏𝗀G_{\sf Avg} by replacing each weight vv in AA with the pair (v,1)(v,1). Then, it suffices to take ψ\psi defined by ψ((v,n))=v/n\psi((v,n))=v/n for all n1n\geq 1, otherwise ψ\psi is undefined.

For Dsum-automata, consider the group G𝖣𝗌𝗎𝗆=(W,,𝟙)G_{\sf Dsum}=(W,\cdot,\mathbb{1}), where W=×+W=\mathbb{Q}\times\mathbb{Q}^{+} (where +\mathbb{Q}^{+} is the set of strictly positive rational numbers), \cdot is defined by (a,x)(b,y)=(1ya+b,xy)(a,x)\cdot(b,y)=(\frac{1}{y}a+b,xy), 𝟙=(0,1)\mathbb{1}=(0,1) is the identity element, and given (a,x)W(a,x)\in W, the inverse (a,x)1(a,x)^{-1} is given by (a,x)1=(xa,x1)(a,x)^{-1}=(-xa,x^{-1}).

Given λ]0,1[\lambda\in\mathbb{Q}\cap]0,1[, a Dsum-automaton AA on Σ\Sigma can be turned into a group automaton on G𝖣𝗌𝗎𝗆G_{\sf Dsum}, by replacing each weight aa in AA with the pair (a,λ),a(a,\lambda),a\in\mathbb{Z}. Let w=w0wnΣw=w_{0}\dots w_{n}\in\Sigma, and consider a run ρ:q0𝑤qn+1\rho:q_{0}\xrightarrow{w}q_{n+1} on ww in AA. Then, ρ\rho is valued by the pair (a,x)=(1λnγ(q0,w0,q1)++γ(qn,wn,qn+1),λn+1)(a,x)=(\frac{1}{\lambda^{n}}\gamma(q_{0},w_{0},q_{1})+\dots+\gamma(q_{n},w_{n},q_{n+1}),\lambda^{n+1}). Hence, (a,x)(a,x) codes the value ψ((a,x))=axλ=𝖣𝗌𝗎𝗆(ρ)\psi((a,x))=\frac{ax}{\lambda}={\sf Dsum}(\rho).

As an immediate consequence of Lemma 3, we obtain that AA is functional iff AgA_{g} is, and therefore, any procedure to decide functionality of group automata will allow one to decide functionality of weighted VV-automata, for V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆}V\in\{{\sf Sum},{\sf Avg},{\sf Dsum}\}. We show such a procedure in the next section. We leave open the encoding of Ratio-automata as group automata.

3. Functionality Problem

In this section, we consider the problem of deciding whether a weighted automaton is functional. In particular, Subsection 3.1 provides a general functionality test applying to group automata which, by Lemma 3, yields a procedure to test functionality of weighted VV-automata, for V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆}V\in\{{\sf Sum},{\sf Avg},{\sf Dsum}\}. We also prove that functionality is decidable for Ratio-automata, by using different techniques.

3.1. Functionality of group automata

We start to introduce the notion of delay between two runs of a group automaton, which turns out to be the main ingredient of the functionality algorithm in Fig. 1.

{defi}

[Delay] Let G=(W,,𝟙)G=(W,\cdot,\mathbb{1}) be a group, and A=(Q,qI,F,δ,γ)A=(Q,q_{I},F,\delta,\gamma) be a group automaton over GG. Let p,qQp,q\in Q. A value dWd\in W is a delay for (p,q)(p,q) if AA admits two runs ρ:qI𝑤p\rho:q_{I}\xrightarrow{w}p, ρ:qI𝑤q\rho^{\prime}:q_{I}\xrightarrow{w}q on wΣw\in\Sigma^{*} s.t. 𝖽𝖾𝗅𝖺𝗒(ρ,ρ)=def(V(ρ))1V(ρ)=d{\sf delay}(\rho,\rho^{\prime}){=_{def}}(V(\rho))^{-1}\cdot V(\rho^{\prime})=d.

The following lemma shows that at most one delay can be associated with co-accessible pairs of states in a functional group automaton. This is related to the uniqueness of inverse elements.

Lemma 4 (One Delay).

Let A=(Q,qI,F,δ,γ)A=(Q,q_{I},F,\delta,\gamma) be a functional group automaton. For all pairs of states (p,q)(p,q): If (p,q)(p,q) is co-accessible, then (p,q)(p,q) admits at most one delay.

Proof 3.1.

Let (p,q)(p,q) be a co-accessible pair of states. Assume that (p,q)(p,q) admits two delays d1,d2d_{1},d_{2}. We show that if AA is functional, then d1=d2d_{1}=d_{2}. Let ρ1:q0w1|n1p\rho_{1}:q_{0}\xrightarrow{w_{1}|n_{1}}p, ρ1:q0w1|m1q\rho^{\prime}_{1}:q_{0}\xrightarrow{w_{1}|m_{1}}q (resp. ρ2:q0w2|n2p\rho_{2}:q_{0}\xrightarrow{w_{2}|n_{2}}p, ρ2:q0w2|m2q\rho^{\prime}_{2}:q_{0}\xrightarrow{w_{2}|m_{2}}q) be a run witnessing the delay d1=𝖽𝖾𝗅𝖺𝗒(ρ1,ρ1)d_{1}={\sf delay}(\rho_{1},\rho^{\prime}_{1}) (resp. d2=𝖽𝖾𝗅𝖺𝗒(ρ2,ρ2)d_{2}={\sf delay}(\rho_{2},\rho^{\prime}_{2})). Since (p,q)(p,q) is co-accessible, there exists a word uu and two runs ρ3:pu|lfF\rho_{3}:p\xrightarrow{u|l}f\in F, ρ3:qu|sfF\rho^{\prime}_{3}:q\xrightarrow{u|s}f^{\prime}\in F. The hypothesis of functionality yields:

m1s=n1ln11m1=ls1\displaystyle m_{1}\cdot s=n_{1}\cdot l\Rightarrow n_{1}^{-1}\cdot m_{1}=l\cdot s^{-1} (1)
n2l=m2sls1=n21m2\displaystyle n_{2}\cdot l=m_{2}\cdot s\Rightarrow l\cdot s^{-1}=n_{2}^{-1}\cdot m_{2} (2)

From the above equations, we get:

n11m1=ls1=n21m2m11n1=m21n2n_{1}^{-1}\cdot m_{1}=l\cdot s^{-1}=n_{2}^{-1}\cdot m_{2}\Rightarrow m_{1}^{-1}\cdot n_{1}=m_{2}^{-1}\cdot n_{2} (3)

We are now ready to define an algorithm (Algorithm 1) that checks the functionality of a group automaton over a group (W,,𝟙)(W,\cdot,\mathbb{1}). In a first step, such a procedure computes all co-accessible pairs of states. Then, it explores the set of accessible pairs of states in a forward manner and computes the delays associated with those pairs. If two different delays are associated with the same pair, or if a pair of final states with a delay different from 𝟙\mathbb{1} (the neutral element of the group) is reached, the test stops and returns that the automaton is not functional (by Lemma 4 and by definition of functionality). Otherwise, it goes on until all co-accessible (and accessible) pairs have been visited and concludes that the automaton is functional.

Input: A group automaton A=(Q,qI,F,δ,γ)A=(Q,q_{I},F,\delta,\gamma) over a group G=(W,,𝟙)G=(W,\cdot,\mathbb{1}).
Output: Yes if AA is functional, No otherwise.
begin
 1 𝖢𝗈𝖠𝖼𝖼{\sf CoAcc}\leftarrow all co-accessible pairs of states;
 2 𝗏𝗂𝗌𝗂𝗍𝖾𝖽{\sf visited}\leftarrow\emptyset ; 𝖽𝖾𝗅𝖺𝗒(qI,qI)𝟙;𝖯𝖴𝖲𝖧(S,((qI,qI),(𝟙,𝟙))){\sf delay}(q_{I},q_{I})\leftarrow\mathbb{1};{\sf PUSH}(S,((q_{I},q_{I}),(\mathbb{1},\mathbb{1}))) ;
 
 3while SS\neq\emptyset do
    4 ((p,q),(α,β))𝖯𝖮𝖯(S)((p,q),(\alpha,\beta))\leftarrow{\sf POP}(S);
    5 if (p,q)F2α1β𝟙(p,q)\in F^{2}\wedge\alpha^{-1}\cdot\beta\neq\mathbb{1} then 𝐫𝐞𝐭𝐮𝐫𝐧𝐬𝖭𝗈{\bf returns}\ \ {\sf No};
     ;
    6 if (p,q)𝗏𝗂𝗌𝗂𝗍𝖾𝖽(p,q)\in{\sf visited} then
       if 𝖽𝖾𝗅𝖺𝗒(p,q)α1β{\sf delay}(p,q)\neq\alpha^{-1}\cdot\beta then 𝐫𝐞𝐭𝐮𝐫𝐧𝐬𝖭𝗈{\bf returns}\ \ {\sf No};
       
    else
       7 𝗏𝗂𝗌𝗂𝗍𝖾𝖽𝗏𝗂𝗌𝗂𝗍𝖾𝖽{(p,q)}{\sf visited}\leftarrow{\sf visited}\cup\{(p,q)\};
       8 𝖽𝖾𝗅𝖺𝗒(p,q)α1β{\sf delay}(p,q)\leftarrow\alpha^{-1}\cdot\beta;
       9 foreach (p,q)𝖢𝗈𝖠𝖼𝖼(p^{\prime},q^{\prime})\in{\sf CoAcc} s.t. aΣ(p,a,p)δ(q,a,q)δ\exists a\in\Sigma\cdot(p,a,p^{\prime})\in\delta\wedge(q,a,q^{\prime})\in\delta do 𝖯𝖴𝖲𝖧(S,((p,q),(αγ(p,a,p),βγ(q,a,q))){\sf PUSH}(S,((p^{\prime},q^{\prime}),(\alpha\cdot\gamma(p,a,p^{\prime}),\beta\cdot\gamma(q,a,q^{\prime}))) ;
        ;
       
    
 10 𝐫𝐞𝐭𝐮𝐫𝐧𝐬𝖸𝖾𝗌{\bf returns}\ \ {\sf Yes}
Algorithm 1 Functionality test for group automata.

If the algorithm returns No, it is either because a pair of accepting states with a delay different from 11 has been reached, which gives a counter-example to functionality, or because a pair of states with different delays has been found, so AA is not functional by Lemma 4.

Lemma 6 provides a pumping argument useful to establish the converse. In detail, given a non functional automaton AA, Lemma 6 establishes that AA admits two accepting runs witnessing non-functionality (i.e. on the same word ww and with different values) for which any pair of states that repeats twice has two different delays. The proof of Lemma 6 relies on the following key result:

Lemma 5.

Let A=(Q,qI,F,δ,γ)A=(Q,q_{I},F,\delta,\gamma) be a group automaton. Let w1,w2,w3Σw_{1},w_{2},w_{3}\in\Sigma^{*} such that there exist p,p,q,qQp,p^{\prime},q,q^{\prime}\in Q and the following runs:

ρ1:qIw1|n1pρ2:pw2|n2pρ3:pw3|n3qρ1:qIw1|m1pρ2:pw2|m2pρ3:pw3|m3q\begin{array}[]{lllllll}\rho_{1}:q_{I}\xrightarrow{w_{1}|n_{1}}p&\rho_{2}:p\xrightarrow{w_{2}|n_{2}}p&\rho_{3}:p\xrightarrow{w_{3}|n_{3}}q\\ \rho_{1}^{\prime}:q_{I}\xrightarrow{w_{1}|m_{1}}p^{\prime}&\rho_{2}:p^{\prime}\xrightarrow{w_{2}|m_{2}}p^{\prime}&\rho_{3}:p^{\prime}\xrightarrow{w_{3}|m_{3}}q^{\prime}\\ \end{array}

s. t. 𝖽𝖾𝗅𝖺𝗒(ρ1,ρ1)=𝖽𝖾𝗅𝖺𝗒(ρ1ρ2,ρ1ρ2){\sf delay}(\rho_{1},\rho^{\prime}_{1}){=}{\sf delay}(\rho_{1}\rho_{2},\rho^{\prime}_{1}\rho^{\prime}_{2}). Then, we have 𝖽𝖾𝗅𝖺𝗒(ρ1ρ2ρ3,ρ1ρ2ρ3)=𝖽𝖾𝗅𝖺𝗒(ρ1ρ3,ρ1ρ3){\sf delay}(\rho_{1}\rho_{2}\rho_{3},\rho^{\prime}_{1}\rho^{\prime}_{2}\rho^{\prime}_{3}){=}{\sf delay}(\rho_{1}\rho_{3},\rho^{\prime}_{1}\rho^{\prime}_{3}).

Proof 3.2.

By hypothesis, we have:

n11m1=(n1n2)1m1m2n11m1=n21n11m1m2\displaystyle n_{1}^{-1}\cdot m_{1}=(n_{1}\cdot n_{2})^{-1}\cdot m_{1}\cdot m_{2}\Rightarrow n_{1}^{-1}\cdot m_{1}=n_{2}^{-1}\cdot n_{1}^{-1}\cdot m_{1}\cdot m_{2}

Therefore, n31n11m1m3=n31n21n11m1m2m3n_{3}^{-1}\cdot n_{1}^{-1}\cdot m_{1}\cdot m_{3}=n_{3}^{-1}\cdot n_{2}^{-1}\cdot n_{1}^{-1}\cdot m_{1}\cdot m_{2}\cdot m_{3}, that implies (n1n3)1(m1m3)=(n1n2n3)1m1m2m3(n_{1}\cdot n_{3})^{-1}\cdot(m_{1}\cdot m_{3})=(n_{1}\cdot n_{2}\cdot n_{3})^{-1}\cdot m_{1}\cdot m_{2}\cdot m_{3} i.e. 𝖽𝖾𝗅𝖺𝗒(ρ1ρ2ρ3,ρ1ρ2ρ3)=𝖽𝖾𝗅𝖺𝗒(ρ1ρ3,ρ1ρ3){\sf delay}(\rho_{1}\rho_{2}\rho_{3},\rho^{\prime}_{1}\rho^{\prime}_{2}\rho^{\prime}_{3})={\sf delay}(\rho_{1}\rho_{3},\rho^{\prime}_{1}\rho^{\prime}_{3}).

Lemma 6.

Let A=(Q,qI,F,δ,γ)A{=}(Q,q_{I},F,\delta,\gamma) be a group automaton. If AA is not functional, there exists a word w=σ0σnw{=}\sigma_{0}\dots\sigma_{n} and two accepting runs on it, ρ=q0σ0qn+1\rho{=}q_{0}\sigma_{0}\dots q_{n+1}, ρ=q0σ0qn+1\rho^{\prime}{=}q^{\prime}_{0}\sigma_{0}\dots q^{\prime}_{n+1}, such that V(ρ)V(ρ)V(\rho){\neq}V(\rho^{\prime}) and for all positions i<ji<j in ww, if (qi,qi)=(qj,qj)(q_{i},q^{\prime}_{i}){=}(q_{j},q^{\prime}_{j}) then 𝖽𝖾𝗅𝖺𝗒(ρi,ρi)𝖽𝖾𝗅𝖺𝗒(ρj,ρj){\sf delay}(\rho_{i},\rho^{\prime}_{i}){\neq}{\sf delay}(\rho_{j},\rho^{\prime}_{j}).

Proof 3.3.

Let w=σ0σnw{=}\sigma_{0}\dots\sigma_{n}, wdom(A)w\in\text{dom}(A) such that |RA(w)|>1|R_{A}(w)|>1. Clearly, there exist two runs ρ=q0σ0qn+1,ρ=q0σ0qn+1\rho{=}q_{0}\sigma_{0}\dots q_{n+1},\rho^{\prime}{=}q^{\prime}_{0}\sigma_{0}\dots q^{\prime}_{n+1} on ww such that V(ρ)V(ρ)V(\rho)\neq V(\rho^{\prime}). This implies 𝖽𝖾𝗅𝖺𝗒(ρ,ρ)1{\sf delay}(\rho,\rho^{\prime})\neq 1. Suppose that there are two positions i<ji<j such that (qi,qi)=(qj,qj)(q_{i},q^{\prime}_{i})=(q_{j},q^{\prime}_{j}) and 𝖽𝖾𝗅𝖺𝗒(ρi,ρi)=𝖽𝖾𝗅𝖺𝗒(ρj,ρj){\sf delay}(\rho_{i},\rho^{\prime}_{i})={\sf delay}(\rho_{j},\rho^{\prime}_{j}). Then, Lemma 5 applies and we can shorten the runs ρ,ρ\rho,\rho^{\prime} by removing the slices starting from position ii and ending in position jj. In particular, we obtain two new runs ρ¯=q0σ0qiσj+1qn+1\bar{\rho}{=}q_{0}\sigma_{0}\dots q_{i}\sigma_{j+1}\dots q_{n+1}, ρ¯=q0σ0qiσj+1qn+1\bar{\rho}^{\prime}{=}q^{\prime}_{0}\sigma_{0}\dots q_{i}\sigma_{j+1}\dots q^{\prime}_{n+1} on w¯=σ0σi1σj+1σn\bar{w}=\sigma_{0}\dots\sigma_{i-1}\sigma_{j+1}\dots\sigma_{n} with the following property: 𝖽𝖾𝗅𝖺𝗒(ρ¯,ρ¯)=𝖽𝖾𝗅𝖺𝗒(ρ,ρ)1{\sf delay}(\bar{\rho},\bar{\rho}^{\prime})={\sf delay}(\rho,\rho^{\prime})\neq 1. Iterating the above procedure we recover a pair of runs (ρ^,ρ^)(\widehat{\rho},\widehat{\rho}^{\prime}) on w^\widehat{w} such that 𝖽𝖾𝗅𝖺𝗒(ρ^,ρ^)𝟙{\sf delay}(\widehat{\rho},\widehat{\rho}^{\prime})\neq\mathbb{1} and for all positions i<ji<j in w^\widehat{w}, if (qi,qi)=(qj,qj)(q_{i},q^{\prime}_{i}){=}(q_{j},q^{\prime}_{j}) then 𝖽𝖾𝗅𝖺𝗒(ρ^i,ρ^i)𝖽𝖾𝗅𝖺𝗒(ρ^j,ρ^j){\sf delay}(\widehat{\rho}_{i},\widehat{\rho}^{\prime}_{i}){\neq}{\sf delay}(\widehat{\rho}_{j},\widehat{\rho}^{\prime}_{j}), fulfilling the goals of Lemma 6.

If there are two runs witnessing non-functionality without repetitions of pairs of states, the algorithm can find a pair of final states with a delay different from 𝟙\mathbb{1}. Otherwise the algorithm will return No at line 1, if not before. Therefore we get:

Theorem 7.

Let A=(Q,qI,F,δ,γ)A=(Q,q_{I},F,\delta,\gamma) be a group automaton. Algorithm 1 returns Yes on AA iff AA is functional and terminates within O(|A|2)O(|A|^{2}) steps.

Proof 3.4.

The procedure explores the co-accessible part of A×AA\times A in a depth-first-search manner. In particular, unless a condition for early termination (answering No) is encountered, each edge of the (co-accessible and accessible part of) A×AA\times A is visited once.

Given the above premise, assume that AA is not functional. Then by Lemma 6, AA admits two runs witnessing non functionality for which any pair of states that repeat twice have different delays. Thus, the exploration of such a pair of parallel runs in Algorithm 1 will eventually stop the procedure returning No, as soon as either a pair of co-accessible states is visited twice with different delays, or the final states are reached with a delay different from 𝟙\mathbb{1}. Conversely, assume that the algorithm returns No. Then, this happens either at line 55 or at line 66. In the first case, the algorithm exhibits exactly a pair of runs witnessing non-functionality (by definition). In the second case, the answer is correct by Lemma 4.

The complexity follows from the following observations. At line 11 the set of co-accessible pairs of states can be obtained in O(|A|2)O(|A|^{2}) steps by proceeding as follows. First, compute A×AA\times A and reverse its edges. Then for each pair (q,q)(q,q^{\prime}), qF,qFq\in F,q^{\prime}\in F, mark it as co-accessible and use it to discover new co-accessible pairs of states via a depth-first-search visit on (non-marked) states in A×AA\times A. Finally, within the main loop at line 33 each co-accessible pair of states is inserted into SS (with a corresponding delay) at most once.

Remark 8.

Functionality of Sum-automata have been shown decidable in [23]. Our functionality algorithm on weighted automata over groups specialized for Sum-automata corresponds to the functionality algorithm for Sum-automata defined in [23]. Algorithm 1 can also be applied to word transducers for which functionality has been shown to be decidable in PTIME with similar techniques in [4].

Corollary 9 follows immediately from Lemma 3 and Theorem 7.

Corollary 9.

The functionality problem is decidable in PTime for VV-automata, V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆}V\in\{{\sf Sum},{\sf Avg},{\sf Dsum}\}.

Remark 10.

We remark that our functionality test could be applied also to a more general framework, where the weight-set WW of the considered group automaton is equipped with an equivalence relation W\sim_{W}, and two runs are considered equivalent iff the corresponding values are equivalent w.r.t. W\sim_{W}. In particular, W\sim_{W} needs to fulfill the following properties in order to be able to show uniqueness of the delay (modulo W\sim_{W}) and termination of the functionality test: (1)(1) it is a congruence, i.e. a,b,c,dW\forall a,b,c,d\in W if aWba\sim_{W}b and cWdc\sim_{W}d, then acWbda\cdot c\sim_{W}b\cdot d; (2)(2) for all a,b,cWa,b,c\in W if aWba\nsim_{W}b then acWbca\cdot c\nsim_{W}b\cdot c.

3.2. Functionality of Ratio-automata

Unlike Sum, Avg and Dsum-automata, it is unclear whether Ratio-automata can be encoded in term of group automata. Intuitively, to provide such an encoding we would assign to each edge a pair of natural numbers, where the first component is the edge-reward and the second component is the edge-cost. Thus, each run ρ\rho is assigned the value (n,m)(n,m), where nn (resp. mm) is the sum of the rewards (resp. costs) along the run, and two runs ρ,ρ\rho,\rho^{\prime} with values (n,m),(n,m)(n,m),(n^{\prime},m^{\prime}) need to be considered equivalent iff nm=nmnm^{\prime}=n^{\prime}m. Unfortunately, the induced equivalence relation (where (n,m)(n,m) is equivalent to (n,m)(n^{\prime},m^{\prime}) iff nm=nmnm^{\prime}=n^{\prime}m) is not a congruence. Therefore, the results developed in the previous subsection do not apply to this class of weighted automata (at least to this encoding) as the quotient of the set of pairs by this equivalence relation is not a group (cf. Remark 10). In fact, it is still open whether there exists a good notion of delay for Ratio-automata that would allow us to design an efficient algorithm to test functionality. However deciding functionality can be done by using a short witness property of non-functionality, as shown in the following lemma.

Lemma 11 (Pumping).

Let AA be a Ratio-automaton with nn states. AA is not functional iff there exist a word ww such that |w|<4n2|w|<4n^{2} and two accepting runs ρ,ρ\rho,\rho^{\prime} on ww such that 𝖱𝖺𝗍𝗂𝗈(ρ)𝖱𝖺𝗍𝗂𝗈(ρ){\sf Ratio}(\rho)\neq{\sf Ratio}(\rho^{\prime}).

Proof 3.5.

We prove the existence of a short witness for non-functionality. The other direction is obvious. Let ww be a word such that |w|4n2|w|\geq 4n^{2} and there exist two accepting runs ρ1,ρ2\rho_{1},\rho_{2} on ww such that 𝖱𝖺𝗍𝗂𝗈(ρ)𝖱𝖺𝗍𝗂𝗈(ρ){\sf Ratio}(\rho)\neq{\sf Ratio}(\rho^{\prime}). Since |w|4n2|w|\geq 4n^{2}, there exist states p,qQ,pf,qfFp,q\in Q,p_{f},q_{f}\in F and words w0,w1,w2,w3,w4w_{0},w_{1},w_{2},w_{3},w_{4} such that w=w0w1w2w3w4w=w_{0}w_{1}w_{2}w_{3}w_{4} and ρ,ρ\rho,\rho^{\prime} can be decomposed as follows:

ρ:qIw0|(r0,c0)pw1|(r1,c1)pw2|(r2,c2)pw3|(r3,c3)pw4|(r4,c4)pfρ:qIw0|(r0,c0)qw1|(r1,c1)qw2|(r2,c2)qw3|(r3,c3)qw4|(r4,c4)qf\begin{array}[]{llllllllllllllllllllllllll}\rho:&q_{I}&\xrightarrow{w_{0}|(r_{0},c_{0})}&p&\xrightarrow{w_{1}|(r_{1},c_{1})}&p&\xrightarrow{w_{2}|(r_{2},c_{2})}&p&\xrightarrow{w_{3}|(r_{3},c_{3})}&p&\xrightarrow{w_{4}|(r_{4},c_{4})}&p_{f}\\ \rho^{\prime}:&q_{I}&\xrightarrow{w_{0}|(r^{\prime}_{0},c^{\prime}_{0})}&q&\xrightarrow{w_{1}|(r^{\prime}_{1},c^{\prime}_{1})}&q&\xrightarrow{w_{2}|(r^{\prime}_{2},c^{\prime}_{2})}&q&\xrightarrow{w_{3}|(r^{\prime}_{3},c^{\prime}_{3})}&q&\xrightarrow{w_{4}|(r^{\prime}_{4},c^{\prime}_{4})}&q_{f}\\ \end{array}

where ri,cir_{i},c_{i} denotes the sum of the rewards and the costs respectively on the subruns of ρ\rho on wiw_{i}, and similarly for ri,cir^{\prime}_{i},c^{\prime}_{i}.

By hypothesis we know that (i=04ri)(i=04ci)(i=04ci)(i=04ri)(\sum_{i=0}^{4}r_{i})\cdot(\sum_{i=0}^{4}c^{\prime}_{i})\neq(\sum_{i=0}^{4}c_{i})\cdot(\sum_{i=0}^{4}r^{\prime}_{i}). For all subsets X{1,2,3}X\subseteq\{1,2,3\}, we denote by wXw_{X} the word w0wi1wikw4w_{0}w_{i_{1}}\dots w_{i_{k}}w_{4} if X={i1<<ik}X=\{i_{1}<\dots<i_{k}\}. For instance, w{1,2,3}=ww_{\{1,2,3\}}=w, w{1}=w0w1w4w_{\{1\}}=w_{0}w_{1}w_{4} and w{}=w0w4w_{\{\}}=w_{0}w_{4}. Similarly, we denote by ρX,ρX\rho_{X},\rho^{\prime}_{X} the corresponding runs on wXw_{X}. We will show that there exists X{1,2,3}X\subsetneq\{1,2,3\} such that 𝖱𝖺𝗍𝗂𝗈(ρX)𝖱𝖺𝗍𝗂𝗈(ρX){\sf Ratio}(\rho_{X})\neq{\sf Ratio}(\rho^{\prime}_{X}). Suppose that for all X{1,2,3}X\subsetneq\{1,2,3\}, we have 𝖱𝖺𝗍𝗂𝗈(ρX)=𝖱𝖺𝗍𝗂𝗈(ρX){\sf Ratio}(\rho_{X})={\sf Ratio}(\rho^{\prime}_{X}). We now show that it implies that 𝖱𝖺𝗍𝗂𝗈(ρ)=𝖱𝖺𝗍𝗂𝗈(ρ){\sf Ratio}(\rho)={\sf Ratio}(\rho^{\prime}), which contradicts the hypothesis. For all X{1,2,3}X\subseteq\{1,2,3\}, we let:

LX=(iX{0,4}ri)(iX{0,4}ci)RX=(iX{0,4}ci)(iX{0,4}ri)L_{X}\ =\ (\sum_{i\in X\cup\{0,4\}}r_{i})\cdot(\sum_{i\in X\cup\{0,4\}}c^{\prime}_{i})\qquad R_{X}\ =\ (\sum_{i\in X\cup\{0,4\}}c_{i})\cdot(\sum_{i\in X\cup\{0,4\}}r^{\prime}_{i})

By hypothesis, L{1,2,3}R{1,2,3}L_{\{1,2,3\}}\neq R_{\{1,2,3\}} and for all X{1,2,3}X\subsetneq\{1,2,3\}, LX=RXL_{X}=R_{X}. The following equalities can be easily verified:

L{}+L{1,2}+L{1,3}+L{2,3}L{1}L{2}L{3}=L{1,2,3}R{}+R{1,2}+R{1,3}+R{2,3}R{1}R{2}R{3}=R{1,2,3}\begin{array}[]{llllllllllllllllllllllll}L_{\{\}}&+&L_{\{1,2\}}&+&L_{\{1,3\}}&+&L_{\{2,3\}}&-&L_{\{1\}}&-&L_{\{2\}}&-&L_{\{3\}}&=&L_{\{1,2,3\}}\\ R_{\{\}}&+&R_{\{1,2\}}&+&R_{\{1,3\}}&+&R_{\{2,3\}}&-&R_{\{1\}}&-&R_{\{2\}}&-&R_{\{3\}}&=&R_{\{1,2,3\}}\\ \end{array}

Then, since by hypothesis we have LX=RXL_{X}=R_{X} for all X{1,2,3}X\subsetneq\{1,2,3\}, we get L{1,2,3}=R{1,2,3}L_{\{1,2,3\}}=R_{\{1,2,3\}}, which is a contradiction. Thus there exists X{1,2,3}X\subsetneq\{1,2,3\} such that LXRXL_{X}\neq R_{X}. In other words, there exists X{1,2,3}X\subsetneq\{1,2,3\} such that 𝖱𝖺𝗍𝗂𝗈(ρX)𝖱𝖺𝗍𝗂𝗈(ρX){\sf Ratio}(\rho_{X})\neq{\sf Ratio}(\rho^{\prime}_{X}). This shows that when a witness of non-functionality has length at least 4n24n^{2}, we can find a strictly smaller witness of functionality.

Theorem 12.

Functionality is decidable in CoNP for Ratio-automata, and in PTime if the rewards and costs are unary encoded.

Proof 3.6.

As a consequence of Lemma 11, we can design an NP procedure that will check non-functionality by guessing runs of length at most 4n24n^{2} and by testing, in polynomial time, that they have different ratio values, where nn is the number of states.

To get the PTime upper bound, we design a CoNLogSpace algorithm as follows. The algorithm guesses two runs ρ1\rho_{1} and ρ2\rho_{2} of the Ratio-automaton AA on the same input, and stores in memory a counter value cc, the two states q1q_{1} and q2q_{2} reached so far by the runs, and the current sums R1,C1,R2,C2R_{1},C_{1},R_{2},C_{2} of costs and rewards of the two runs respectively. At each step, it guesses a new symbol σΣ\sigma\in\Sigma, two transitions q1σ|(r1,c1)q1q_{1}\xrightarrow{\sigma|(r_{1},c_{1})}q^{\prime}_{1} and q2σ|(r2,c2)q2q_{2}\xrightarrow{\sigma|(r_{2},c_{2})}q^{\prime}_{2} of AA, and updates its memory to (c+1,q1,q2,R1+r1,C1+c1,R2+r2,C2+c2)(c+1,q^{\prime}_{1},q^{\prime}_{2},R_{1}+r_{1},C_{1}+c_{1},R_{2}+r_{2},C_{2}+c_{2}). The algorithm stops in a configuration (c,q1,q2,R1,C1,R2,C2)(c,q_{1},q_{2},R_{1},C_{1},R_{2},C_{2}) with negative answer whenever c=4n2+1c=4n^{2}+1, and with a positive answer whenever c4n2c\leq 4n^{2}, q1,q2q_{1},q_{2} are accepting, and R1C2R2C1R_{1}C_{2}\neq R_{2}C_{1}.

The correctness of this algorithm directly follows from Lemma 11. Let us show that each configuration uses only a logarithmic space to be stored. Let MM be the largest value (among rewards and costs) that occurs on the transitions of AA. Let |M||M| denote the size of MM. Since rewards and costs are encoded in unary, we have |M|=M|M|=M. Now, the algorithm first converts the rewards and costs in binary (in logspace), and then, each configuration (c,q1,q2,R1,C1,R2,C2)(c,q_{1},q_{2},R_{1},C_{1},R_{2},C_{2}) takes only logarithmic space, because for any α{R1,C1,R2,C2}\alpha\in\{R_{1},C_{1},R_{2},C_{2}\}, α4n2M=4n2|M|\alpha\leq 4n^{2}M=4n^{2}|M|, and therefore log(α)2log(2n)+log(|M|)log(\alpha)\leq 2log(2n)+log(|M|). We can conclude since CoNLogSpace\subseteqPTime.

Remark 13.

The pumping result in Lemma 11 states that if some Ratio-automaton with nn states is not functional, there exists a witness of non-functionality whose length is bounded by 4n24n^{2}, where nn is the number of states. Such a property also holds for Dsum-automata (and is well-known for Sum and Avg-automata), but with the smaller bound 3n23n^{2}. Those bounds are used to state the existence of two runs on the same word such that the same pair of states is repeated 3 or 4 times along the two runs. Then it is proved that one can remove some part in between two repetitions and get a smaller word with two different output values. However for Ratio-automata, three repetitions are not enough to be able to shorten non-functionality witnesses. For instance, consider the following two runs on the alphabet {a,b,c,d}\{a,b,c,d\} and states {qI,p,q,pf,qf}\{q_{I},p,q,p_{f},q_{f}\} where pf,qfp_{f},q_{f} are final (those two runs can easily be realized by some Ratio-automaton):

ρ:qIa|(2,2)pb|(2,1)pc|(2,2)pd|(1,1)pfρ:qIa|(1,2)qb|(2,1)qc|(1,1)qd|(2,1)qf\begin{array}[]{llllllllllllllllllllllllll}\rho:&q_{I}&\xrightarrow{a|(2,2)}&p&\xrightarrow{b|(2,1)}&p&\xrightarrow{c|(2,2)}&p&\xrightarrow{d|(1,1)}&p_{f}\\ \rho^{\prime}:&q_{I}&\xrightarrow{a|(1,2)}&q&\xrightarrow{b|(2,1)}&q&\xrightarrow{c|(1,1)}&q&\xrightarrow{d|(2,1)}&q_{f}\\ \end{array}

It is easy to verify that the word abcdabcd has two outputs given by ρ\rho and ρ\rho^{\prime} while the words adad, abdabd and acdacd has one output. For instance, the two runs qIa|(2,2)pd|(1,1)pfq_{I}\xrightarrow{a|(2,2)}p\xrightarrow{d|(1,1)}p_{f} and qIa|(1,2)qd|(2,1)qfq_{I}\xrightarrow{a|(1,2)}q\xrightarrow{d|(2,1)}q_{f} on adad have both value 11.

4. Verification Problems

In this section, we investigate several decision problems for functional VV-automata as defined in [11], V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆,𝖱𝖺𝗍𝗂𝗈}V\in\{{\sf Sum},{\sf Avg},{\sf Dsum},{\sf Ratio}\}. Given two VV-automata A,BA,B over Σ\Sigma (and with the same discount factor when V=𝖣𝗌𝗎𝗆V={\sf Dsum}) and a threshold ν\nu\in\mathbb{Q}, we define the following decision problems, where {>,}\triangleright\in\{>,\geq\}:

ν\triangleright\nu-Emptiness LAνL_{A}^{\triangleright\nu}\neq\varnothing holds if there exists wΣ+w\in\Sigma^{+} such that LA(w)νL_{A}(w)\triangleright\nu
ν\triangleright\nu-Universality LAνL_{A}\triangleright\nu holds if for all wdom(A)w\in\text{dom}(A), LA(w)νL_{A}(w)\triangleright\nu.
Inclusion LALBL_{A}\leq L_{B} holds if for all wΣ+w\in\Sigma^{+}, LA(w)LB(w)L_{A}(w)\leq L_{B}(w)
Equivalence LA=LBL_{A}=L_{B} holds if for all wΣ+w\in\Sigma^{+}, LA(w)=LB(w)L_{A}(w)=L_{B}(w)

Theorem 14 (resp. Theorem15) below proves that the ν\triangleright\nu-emptiness (resp. universality) problem can be solved in polynomial time for functional Sum-, Avg-, and Ratio-automata. As for functional Dsum-automata, we provide a PTime upper bound for the >ν{>}\nu-emptiness (resp. ν{\geq}\nu-universality) problem. The ν{\geq}\nu-emptiness (resp. >ν{>}\nu-universality) on functional Dsum-automata has been recently shown in PSpace in [9], as an aside result of a partial solution333In particular, [9] provides a solution to the finite version of the target discounted-sum problem. to the notorious target discounted-sum problem. The latter is known to be connected to various areas and open problems in mathematics and computer science, such as e.g. the universality of (nondeterministic) Dsum-automata, Dsum-games with imperfect information or multi-objectives [10, 12], as well as piecewise affine maps and generalizations of the Cantor set [9].

Theorem 14.

The ν\triangleright\nu-emptiness problem is in PTime for functional Sum-, Avg-, and Ratio-automata. The >ν{>}\nu-emptiness (resp. ν{\geq}\nu-emptiness) problem is in PTime (resp. PSpace [9]) for functional Dsum-automata.

Proof 4.1.

For 𝖲𝗎𝗆{\sf Sum}-automata, let A=(Q,qI,F,δ,γ)A=(Q,q_{I},F,\delta,\gamma) be a Sum-automaton. Wlog we assume that all states of AA are both accessible from an initial state and co-accessible from a final state (such property can be ensured via a PTime transformation [30]). First, LAνL_{A}^{\triangleright\nu}\neq\varnothing if AA contains a strictly positive cycle, otherwise one inverts the weights and computes a shortest path from an initial to a final state. If the sum β\beta of such a path satisfies νβ{-}\nu\triangleright\beta then the language is non-empty. Both steps are handled by the classical Bellman-Ford algorithm.

For Avg-automata, let A=(Q,qI,F,δ,γ)A=(Q,q_{I},F,\delta,\gamma) be an Avg-automaton. We can assume ν=0\nu=0 since the ν\triangleright\nu-emptiness problem for Avg-automata reduces to the 0\triangleright 0-emptiness problem for Sum-automata, by simply reweighting the input automaton. Then, LA0L_{A}^{\triangleright 0}\neq\emptyset iff AA admits a path to a final state whose sum of the weights is 0\triangleright 0, that can be easily checked in PTime.

For Dsum automata, let A=(Q,qI,F,δ,γ)A=(Q,q_{I},F,\delta,\gamma) be a Dsum-automaton. We show that LA>νL_{A}^{>\nu}\neq\emptyset iff Player 0 has a strategy to ensure a play from vIv_{I} with discounted sum greater than ν\nu in the one player (infinite) Dsum game Γ=(V,E,w,V0,V1)\Gamma=(V,E,w,\langle V_{0},V_{1}\rangle), where:

  • V={p|pQwΣ(p𝑤fF)}V=\{p\>|\>p\in Q\wedge\exists w\in\Sigma^{*}(p\overset{w}{\rightsquigarrow}f\in F)\}

  • V0=V,V1=V_{0}=V,V_{1}=\emptyset

  • E=(V×(Σ{ζ})×V)({(p,a,p)|(p,a,p)δ}{(p,ζ,p)|pF})E=(V\times(\Sigma\cup\{\zeta\})\times V)\cap(\{(p,a,p^{\prime})\>|\>(p,a,p^{\prime})\in\delta\}\cup\{(p,\zeta,p)\>|\>p\in F\}), where ζΣ\zeta\notin\Sigma is a fresh symbol

  • For each e=(p,a,p)Ee=(p,a,p^{\prime})\in E: If (p,a,p)δ(p,a,p^{\prime})\in\delta, then w(e)=γ(p,a,p)w(e)=\gamma(p,a,p^{\prime}), else w(e)=0w(e)=0.

Once proved the above equivalence, our complexity bound follows easily, since checking whether LA>νL_{A}^{>\nu}\neq\emptyset reduces to solving a 11 player Dsum game (that is in PTime [3]).

If LA>νL_{A}^{>\nu}\neq\emptyset, then AA admits an accepting run ρ\rho such that 𝖣𝗌𝗎𝗆(γ(ρ))>ν{\sf Dsum}(\gamma(\rho))>\nu. By construction, Γ\Gamma admits an (infinite) path with a positive discounted sum, i.e. Player 0 has a (memoryless) strategy to win the one-player discounted sum game Γ\Gamma.

Conversely, suppose that Player 0 has a strategy to win the one-player discounted sum game Γ\Gamma. Let rr be an infinite path on Γ\Gamma consistent with a winning strategy for player 0. Then 𝖣𝗌𝗎𝗆(r)>0{\sf Dsum}(r)>0. Let WW be the maximum absolute weight in Γ\Gamma. For each prefix rir_{i} of length ii of rr we have:

𝖣𝗌𝗎𝗆(ri)+Wλi1λ𝖣𝗌𝗎𝗆(r)𝖣𝗌𝗎𝗆(ri)𝖣𝗌𝗎𝗆(r)Wλi1λ\begin{split}&{\sf Dsum}(r_{i})+\dfrac{W\lambda^{i}}{1-\lambda}\geq{\sf Dsum}(r)\Rightarrow\\ &{\sf Dsum}(r_{i})\geq{\sf Dsum}(r)-\dfrac{W\lambda^{i}}{1-\lambda}\end{split} (4)

Since 𝖣𝗌𝗎𝗆(r)>ν{\sf Dsum}(r)>\nu, there exists ii^{*} such that 𝖣𝗌𝗎𝗆(r)Wλi1λ>ν{\sf Dsum}(r)-\dfrac{W\lambda^{i^{*}}}{1-\lambda}>\nu that implies 𝖣𝗌𝗎𝗆(ri)>ν{\sf Dsum}(r_{i^{*}})>\nu. By construction, each path in Γ\Gamma can be extended to reach a node in FF. Let ri=r0rmFr^{\prime}_{i}=r^{\prime}_{0}\dots r^{\prime}_{m}\in F be such a continuation of rir^{i^{*}}. By Equation 4, our choice of ii^{*} guarantees that 𝖣𝗌𝗎𝗆(ri)>ν{\sf Dsum}(r^{\prime}_{i})>\nu. Since AA is functional, rr^{\prime} witnesses the existence of a word ww such that LA(w)>νL_{A}(w)>\nu.

Finally, let AA be a Ratio-automaton, let ν=m/n\nu=m/n. We consider the Sum automaton AA^{\prime}, where each edge of AA having reward rr and cost cc is replaced by an edge of weight rncmrn-cm. It can be easily proved that LAνL_{A}^{\triangleright\nu}\neq\emptyset iff LAνL_{A^{\prime}}^{\triangleright\nu}\neq\emptyset.

Theorem 15.

Let ν\nu\in\mathbb{Q}. The ν\triangleright\nu-universality problem is PTime for functional VV-automata, V{SumAvgRatio}V\in\{\mbox{{\sf Sum}, {\sf Avg}, {\sf Ratio}}\}. The ν{\geq}\nu-universality (resp. >ν{>}\nu-universality) problem is PTime (resp. PSpace [9]) for functional Dsum-automata.

Proof 4.2.

Let AA be a VV-automaton, V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆}V\in\{{\sf Sum},{\sf Avg},{\sf Dsum}\} and consider the ν\geq\nu-universality (resp. >ν>\nu-universality) problem for VV-automata. We check whether AA admits an accepting run with V(γ(r))<νV(\gamma(r))<\nu (resp. V(γ(r))νV(\gamma(r))\leq\nu) . This can be done in PTime for V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖱𝖺𝗍𝗂𝗈,𝖣𝗌𝗎𝗆}V\in\{{\sf Sum},{\sf Avg},{\sf Ratio},{\sf Dsum}\} (resp. V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖱𝖺𝗍𝗂𝗈}V\in\{{\sf Sum},{\sf Avg},{\sf Ratio}\}), with a procedure similar to the one applied in the proof of Theorem 14.

It is known that inclusion is undecidable for non-deterministic Sum-automata [25, 1], and therefore also for Avg and Ratio-automata. To the best of our knowledge, it is open whether it is decidable for Dsum-automata. This situation is strikingly different for functional automata as the inclusion problem is decidable for all the measures:

Theorem 16.

Let V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆,𝖱𝖺𝗍𝗂𝗈}V{\in}\{{\sf Sum},{\sf Avg},{\sf Dsum},{\sf Ratio}\} and let A,BA,B be two VV-automata where BB is functional. The inclusion problem LALBL_{A}{\leq L_{B}} is decidable. Moreover, if V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆}V{\in}\{{\sf Sum},{\sf Avg},{\sf Dsum}\} then it is PSpace-c and if additionally BB is deterministic, it is in PTime.

Proof 4.3.

Let V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆}V\in\{{\sf Sum},{\sf Avg},{\sf Dsum}\}. In a first step, we test the inclusion of the domains dom(A)dom(B)\text{dom}(A)\subseteq\text{dom}(B) (it is well-known from theory of finite automata to be in PSpace-c and in PTime if BB is deterministic). Then we construct the product A×BA\times B as follows: (p,q)a|nAnB(p,q)δA×B(p,q)\xrightarrow{a|n_{A}-n_{B}}(p^{\prime},q^{\prime})\in\delta_{A\times B} iff pa|nApδAp\xrightarrow{a|n_{A}}p^{\prime}\in\delta_{A} and qa|nBqδBq\xrightarrow{a|n_{B}}q^{\prime}\in\delta_{B}. Then LALBL_{A}\not\leq L_{B} iff LA×B>0L_{A\times B}^{>0}\neq\varnothing, which is decidable by Theorem 14.

Let V=𝖱𝖺𝗍𝗂𝗈V={\sf Ratio}. As for the other measures we first check inclusion of the domains. We then define the product A×BA\times B of AA and BB as a labelled transition system whose set of transitions δA×B\delta_{A\times B} is defined by (p,q)a|(r1,c1,r2,c2)(p,q)δA×B(p,q)\xrightarrow{a|(r_{1},c_{1},r_{2},c_{2})}(p^{\prime},q^{\prime})\in\delta_{A\times B} iff pa|(r1,c1)pδAp\xrightarrow{a|(r_{1},c_{1})}p^{\prime}\in\delta_{A} and qa|(r2,c2)qδBq\xrightarrow{a|(r_{2},c_{2})}q^{\prime}\in\delta_{B}. For all tδA×Bt\in\delta_{A\times B}, we let rA(t)r_{A}(t) be the reward of the transition tt projected on AA. The values cA(t),rB(t)c_{A}(t),r_{B}(t) and cB(t)c_{B}(t) are defined similarly. We let 𝒫(A×B)\mathcal{P}(A\times B) be the Parikh image of the transitions of A×BA\times B, i.e. the set of total functions α:δA×B\alpha:\delta_{A\times B}\rightarrow\mathbb{N} such that there exist wΣ+w\in\Sigma^{+} and a path labelled ww from the pair of initial states to a pair of accepting states, such that this path passes by tt exactly α(t)\alpha(t) times, for all tδA×Bt\in\delta_{A\times B}. It is well-known by Parikh’s theorem that 𝒫(A×B)\mathcal{P}(A\times B) can be effectively represented by a set of linear constraints [31]. We now define the set of vectors Γ\Gamma that are the Parikh images of accepting runs of A×BA\times B which, when projected on AA, has a strictly bigger ratio value than the one obtained by the projection on BB. In particular, the the set of vectors Γ\Gamma is given by:

{α:δA×B|α𝒫(A×B),tδA×Bα(t)rA(t)tδA×Bα(t)cA(t)>tδA×Bα(t)rB(t)tδA×Bα(t)cB(t)}\{\alpha:\delta_{A\times B}\rightarrow\mathbb{N}\ |\ \alpha\in\mathcal{P}(A\times B),\frac{\sum_{t\in\delta_{A\times B}}\alpha(t)\cdot r_{A}(t)}{\sum_{t\in\delta_{A\times B}}\alpha(t)\cdot c_{A}(t)}>\frac{\sum_{t\in\delta_{A\times B}}\alpha(t)\cdot r_{B}(t)}{\sum_{t\in\delta_{A\times B}}\alpha(t)\cdot c_{B}(t)}\}

It is easy to check that Γ\Gamma\neq\varnothing iff LALBL_{A}\not\leq L_{B}. The set Γ\Gamma can be defined as the solutions over natural numbers of a system of equations in linear and quadratic forms (i.e. in which products of two variables are permitted). There is one variable xtx_{t} for each tδA×Bt\in\delta_{A\times B} that gives the number of times tt is fired in an accepting run of A×BA\times B. It is decidable whether such a system has a solution [38, 20].

There is no known complexity bound for solving quadratic equations, so the proof above does not give us a complexity bound for the inclusion problem of functional Ratio-automata. However, thanks to the functionality test, which is in PSpace for Ratio-automata, we can test equivalence of two functional Ratio-automata A1A_{1} and A2A_{2} in PSpace:

Theorem 17.

Let V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆,𝖱𝖺𝗍𝗂𝗈}V\in\{{\sf Sum},{\sf Avg},{\sf Dsum},{\sf Ratio}\}. Equivalence of functional VV-automata is PSpace-c.

Proof 4.4.

The following algorithm can be used to test equivalence for all the considered measures: first check in PSpace that dom(A1)=dom(A2)\text{dom}(A_{1})=\text{dom}(A_{2}) using the standard equivalence algorithm for non-deterministic finite automata. Then, check that the union of A1A_{1} and A2A_{2} is functional. The latter can be done in CoNP for Ratio-automata and in polynomial time for the other measures, using the functionality tests defined in the previous section (cf. Theorem 7, Corollary 9, and Theorem 12).

5. Realizability Problem

In this section, we consider the problem of quantitative language realizability. The realizability problem is better understood as a game between two players: the ’Player input’ (the environment, also called Player II) and the ’Player output’ (the controller, also called Player OO). Player II (resp. Player OO) controls the letters of a finite alphabet ΣI\Sigma_{I} (resp. ΣO\Sigma_{O}). We assume that ΣOΣI=\Sigma_{O}\cap\Sigma_{I}=\varnothing and that ΣO\Sigma_{O} contains the special symbol \dashv whose role is to stop the game. We let Σ=ΣOΣI\Sigma=\Sigma_{O}\cup\Sigma_{I}.

Formally, the realizability game is a turn-based game played on an arena defined by a weighted automaton A=(Q=QOQI,qI,F,δ,γ)A{=}(Q{=}Q_{O}\uplus Q_{I},q_{I},F,\delta,\gamma), whose set of states is partitioned into two sets QOQ_{O} and QIQ_{I}, and such that FQIF\subseteq Q_{I} and δ(QO×ΣO×QI)(QI×ΣI×QO)\delta{\subseteq}(Q_{O}{\times}\Sigma_{O}{\times}Q_{I})\cup(Q_{I}{\times}\Sigma_{I}{\times}Q_{O}). Recall that by definition of the transitions of weighted automaton dom(A)(Σ\{})\text{dom}(A){\subseteq}(\Sigma\backslash\{\dashv\})^{*}\dashv. Player II starts by giving an initial letter i0ΣIi_{0}\in\Sigma_{I}, Player OO responds providing a letter o0ΣOo_{0}\in\Sigma_{O}, then Player II gives i1i_{1} and Player OO responds o1o_{1}, and so on. Player OO has also the power to stop the game at any turn with the distinguishing symbol \dashv. In this case, the game results in a finite word (i0o0)(i1o1)(ij)Σ+(i_{0}o_{0})(i_{1}o_{1})\dots(i_{j}\dashv)\in\Sigma_{\dashv}^{+}, otherwise the outcome of the game is an infinite word (i0o0)(i1o1)(Σ{})ω(i_{0}o_{0})(i_{1}o_{1})\dots\in(\Sigma\setminus\{\dashv\})^{\omega}.

The players play according to strategies. A strategy for Player OO (resp. Player II) is a mapping λO:(ΣIΣO)ΣIΣO\lambda_{O}:(\Sigma_{I}\Sigma_{O})^{*}\Sigma_{I}\rightarrow\Sigma_{O} (resp. λI:(ΣIΣO)ΣI\lambda_{I}:(\Sigma_{I}\Sigma_{O})^{*}\rightarrow\Sigma_{I}). The outcome of the strategies λO,λI\lambda_{O},\lambda_{I} is the word w=i0o0i1o1w=i_{0}o_{0}i_{1}o_{1}\dots denoted by 𝗈𝗎𝗍𝖼𝗈𝗆𝖾(λI,λO)\mathsf{outcome}(\lambda_{I},\lambda_{O}) such that for all 0j|w|0\leq j\leq|w| (where |w|=+|w|=+\infty if ww is infinite), oj=λO(i0ij1)o_{j}=\lambda_{O}(i_{0}\dots i_{j-1}) and ij=λ(i0oj)i_{j}=\lambda(i_{0}\dots o_{j}), and such that if oj=o_{j}={\dashv} for some jj, then w=i0ojw=i_{0}\dots o_{j}. We denote by ΛO\Lambda_{O} (resp. ΛI\Lambda_{I}) the set of strategies for Player OO (resp. Player II). A strategy λOΛO\lambda_{O}\in\Lambda_{O} is winning for Player OO if for all λIΛI\lambda_{I}\in\Lambda_{I}, 𝗈𝗎𝗍𝖼𝗈𝗆𝖾(λI,λO)\mathsf{outcome}(\lambda_{I},\lambda_{O}) is finite and LA(𝗈𝗎𝗍𝖼𝗈𝗆𝖾(λI,λO))>νL_{A}(\mathsf{outcome}(\lambda_{I},\lambda_{O}))>\nu, where ν0\nu\geq 0 a given threshold.

Given a weighted automaton AA and a threshold ν0\nu\geq 0, the quantitative language realizability problem asks whether Player OO has a winning strategy and in that case, we say that AA is realizable. Our first result on realizability is negative: in particular, Subsection 5.1 shows that the realizability problem is undecidable for weighted functional Sum-, Avg-automata, and Ratio-automata. However, when deterministic weighted automata are considered, we can provide positive decidability results for all the considered measures (cfr. subsection 5.2).

5.1. Undecidability Results

We show that the halting problem for deterministic 22-counter Minsky machines  [28] can be reduced to the quantitative language realizability problem for (functional) Sum-automata (resp. Avg-automata). This entails our undecidability results w.r.t. realizability for VV-automata (V{Sum,Avg,Ratio}V\in\{\mbox{{\sf Sum},{\sf Avg},{\sf Ratio}}\}).

22-Counter Machines

A 22-counter machine MM consists of a finite set of control states SS, an initial state sISs_{I}\in S, a final state sFQs_{F}\in Q, a set CC of counters (|C|=2\lvert C\rvert=2) and a finite set δM\delta_{M} of instructions manipulating two integer-valued counters. Instructions are of the form

  • s:s:

    c:=c+1c:=c+1 goto ss^{\prime}

  • s:s:

    if c=0c=0 then goto ss^{\prime} else c:=c1c:=c-1 goto s′′s^{\prime\prime}.

Formally, instructions are tuples (s,α,c,s)(s,\alpha,c,s^{\prime}) where s,sSs,s^{\prime}\in S are source and target states respectively, and the action α{inc,dec,0?}\alpha\in\{inc,dec,0?\} applies to the counter cCc\in C. We assume that MM is deterministic: for every state sSs\in S, either there is exactly one instruction (s,α,,)δM(s,\alpha,\cdot,\cdot)\in\delta_{M} and α=inc\alpha=inc, or there are two instructions (s,dec,c,),(s,0?,c,)δM(s,dec,c,\cdot),(s,0?,c,\cdot)\in\delta_{M}.

A configuration of MM is a pair (s,v)(s,v) where sSs\in S and v:CNaturev:C\to{\rm Nature} is a valuation of the counters. An accepting run of MM is a finite sequence π=(s0,v0)δ0(s1,v1)δ1δn1(sn,vn)\pi=(s_{0},v_{0})\delta_{0}(s_{1},v_{1})\delta_{1}\dots\delta_{n-1}(s_{n},v_{n}) where δi=(si,αi,ci,si+1)δM\delta_{i}=(s_{i},\alpha_{i},c_{i},s_{i+1})\in\delta_{M} are instructions and (si,vi)(s_{i},v_{i}) are configurations of MM such that s0=sIs_{0}=s_{I}, v0(c)=0v_{0}(c)=0 for all cCc\in C, sn=sFs_{n}=s_{F}, and for all 0i<n0\leq i<n, we have vi+1(c)=vi(c)v_{i+1}(c)=v_{i}(c) for ccic\neq c_{i}, and (a)(a) if α=inc\alpha=inc, then vi+1(ci)=vi(ci)+1v_{i+1}(c_{i})=v_{i}(c_{i})+1 (b)(b) if α=dec\alpha=dec, then vi(ci)0v_{i}(c_{i})\neq 0 and vi+1(ci)=vi(ci)1v_{i+1}(c_{i})=v_{i}(c_{i})-1, and (c)(c) if α=0?\alpha=0?, then vi+1(ci)=vi(ci)=0v_{i+1}(c_{i})=v_{i}(c_{i})=0. The corresponding run trace of π\pi is the sequence of instructions π¯=δ0δ1δn1\bar{\pi}=\delta_{0}\delta_{1}\dots\delta_{n-1}. The halting problem is to decide, given a 2-counter machine MM, whether MM has an accepting run. This problem is undecidable [28].

The encoding

We are now ready to present our encoding. The latter goes along the lines of the encodings in [15, 1] to prove undecidability results related to imperfect information games and weighted automata.

Given a deterministic 22-counter machine MM, we construct a functional Sum-automaton A=(Q,qI,F,δ,γ)A=(Q,q_{I},F,\delta,\gamma) (resp. Avg-automata), where Q=QOQIFQ=Q_{O}\cup Q_{I}\cup F, Σ=ΣOΣI\Sigma=\Sigma_{O}\cup\Sigma_{I} and δQ×Σ×Q\delta\subseteq Q\times\Sigma\times Q, such that MM halts if and only if L(A)L(A) is realizable (with realizability threshold ν=0\nu=0). In particular, ΣO=δM\Sigma_{O}=\delta_{M} and a strategy λOΛO\lambda_{O}\in\Lambda_{O} for Player OO is winning if and only if for each λIΛI\lambda_{I}\in\Lambda_{I}, the projection of 𝗈𝗎𝗍𝖼𝗈𝗆𝖾(λI,λO)\mathsf{outcome}(\lambda_{I},\lambda_{O}) onto ΣO\Sigma_{O} is an accepting run of MM. The alphabet ΣI\Sigma_{I} for Player II is the set of letters ΣI={go}(i=1,2{cheatCi+,cheatCi-})(0j<|S|{cheatR:sj})\Sigma_{I}=\{go\}\cup(\bigcup_{i=1,2}\{\emph{cheatCi+},\emph{cheatCi-}\})\cup(\bigcup_{0\leq j<|S|}\{\emph{cheatR:$s_{j}$}\}).

Intuitively, the role of Player II is that of observing the play of Player OO and detecting whether he faithfully simulates MM, or he cheats. If Player OO cheats by declaring the ii-th counter equal to 0 when it is not (positive cheat), then Player II can use the action cheatCi+, i{1,2}i\in\{1,2\}, to force all the runs but one (with weight 0\leq 0) to die. Similarly, if Player OO cheats by decrementing a counter with value zero (negative cheat) or on the structural properties of a run of MM, then Player II can win by playing the corresponding observing action : cheatCi-, for negative cheats on counter i{1,2}i\in\{1,2\}, or cheatR:sjs_{j} for a cheat on the run through MM detected at state sjs_{j}.

In detail, the automaton AA consists of an initial state qIq_{I} from which Player II can nondeterministically jump to several gadgets: each gadget checks one of the properties of the sequence of actions provided by Player OO, and verify whether Player OO simulates faithfully MM or he eventually cheats. More specifically, qIq_{I} has one transition with weight 0 and label go to the set of gadgets listed below and described in detail in the rest of this subsection:

  • two gadgets to observe positive cheats over a counter (one gadget for each counter i{1,2}i\in\{1,2\});

  • two gadgets to observe negative cheats over a counter (one gadget for each counter i{1,2}i\in\{1,2\});

  • a gadget to observe a structural cheat for each state sSs\in S that can be traversed by a path in MM;

  • a neutral gadget, where Player II simply observes the run provided by Player OO and let such a run to reach a final state as soon as Player OO provides an action simulating a step toward the halting state of MM.

Due to the initial nondeterministic choice, each final state (in one of the gadget) is accessible throughout the evolution of the play and Player OO has to ensure that all the properties checked in the gadgets are fulfilled. Otherwise, Player II will have the ability to use a letter in ΣI{go}\Sigma_{I}\setminus\{go\} to let just one run (in the appropriate gadget) to survive, ensuring that such a run eventually reaches the final state with weight 0\leq 0.

We are now ready to present in detail the gadgets (cf. Figure 36). In particular, in each gadget the states belonging to QIQ_{I} (resp. QOQ_{O}) are represented by a square node (resp. circle node), while final states are double lined444The entering node (owned by Player II, with an incoming edge labeled start) is supposed to be connected to qIq_{I} (the initial state of AA, owned by Player II) by means of a transition on the symbol goΣI\in\Sigma_{I} with weight 0. Each transition in the gadgets leaving a node owned by Player II is labelled by a pair of the form (σ,w)(\sigma,w), where σΣI\sigma\in\Sigma_{I} and w{1,0,1}w\in\{-1,0,1\} is the weight of the transition. Symmetrically, each transition in the gadgets leaving a circle-node (i.e. a node owned by Player OO) is labelled by a pair of the form (σ,w)(\sigma,w), where w{1,0,1}w\in\{-1,0,1\} is the weight and σδM\sigma\in\delta_{M} is an instruction of the counter machine. Namely, σ\sigma is of the form (s,α,i,s)(s,\alpha,i,s^{\prime}), where i{1,2}i\in\{1,2\} represents the counter, α{inc,dec,0?}\alpha\in\{inc,dec,0?\} and ss (resp. ss^{\prime}) is the sourcing (resp. target) state. We use the notation \cdot when a symbol within an instruction could be any admissible (e.g. (,inc,1,)(\cdot,inc,1,\cdot) represents any instruction incrementing the first counter). Finally σ\sigma denotes an arbitrary letter in the alphabeth of the player.

 
start(,inc,i,),-1(,dec,i,),1\begin{array}[]{lr}(\cdot,inc,i,\cdot),&\scalebox{1.2}[1.0]{-}1\\ (\cdot,dec,i,\cdot),&1\\ \end{array}go,0go,0go,0go,0(,0?,i,),0(\cdot,0?,i,\cdot),0cheatCi+,0cheatCi+,0σ,0\sigma,0go,0go,0,1{\dashv},1
 
Figure 2. Gadget to check positive cheats
 
start(,0?,i,),0(,inc,i,),1\begin{array}[]{lr}(\cdot,0?,i,\cdot),&0\\ (\cdot,inc,i,\cdot),&1\\ \end{array}go,0go,0go,0go,0(,dec,i,),-1(\cdot,dec,i,\cdot),\scalebox{1.2}[1.0]{-}1cheatCi,0cheatCi-,0σ,0\sigma,0go,0go,0,1{\dashv},1
 
Figure 3. Gadget to check negative cheats
 
start(s0,,,),0(s_{0},\cdot,\cdot,\cdot),0go,0go,0σ,0\sigma,0Σ{(s0,,,)},0\Sigma\setminus\{(s_{0},\cdot,\cdot,\cdot)\},0cheatR:s0,1cheatR:s0,-1σ,0\sigma,0go,0go,0,0{\dashv},0
 
Figure 4. Gadget to check that Player OO plays (s0,,,)(s_{0},\cdot,\cdot,\cdot) at the beginning.
 
start(,,,si),0(\cdot,\cdot,\cdot,s_{i}),0(,,,sji)),0(\cdot,\cdot,\cdot,s_{j\neq i)}),0go,0go,0go,0go,0(si,,,),0(s_{i},\cdot,\cdot,\cdot),0(sji,,,),0(s_{j\neq i},\cdot,\cdot,\cdot),0go,0go,0cheatR:si,1cheatR:s_{i},-1σ,0\sigma,0go,0go,0,0{\dashv},0
 
Figure 5. Gadget to check cheats along the run.
 
startσ,0\sigma,0go,0go,0(,,,sF),0(\cdot,\cdot,\cdot,s_{F}),0go,0go,0,1{\dashv},1
 
Figure 6. Neutral gadget.

Given the above notation, Figure 3 represents the gadget to check a positive cheat on counter ii, i{1,2}i\in\{1,2\}. Player II observes the inverted value of the counter ii throughout the path on MM simulated by Player OO. Whenever Player OO declares that counter ii is equal to 0, Player II can use the action cheatCi+ to kill all the runs in AA but the one within the observing gadget. The evolution of such a run up to cheatCi+ will have a negative value (corresponding to the inverted value of the observed counter) if Player OO was cheating. Hence, as soon as Player OO playes \dashv it will end in a final state with weight 0\leq 0. Symmetrically, the gadget for checking negative cheats (represented in Figure 3) uses the weights on the edges to store the value of the observed counter. If Player OO cheats decrementing counter ii when its value is 0, Player II can use the action cheatCi- to kill all the runs but the one (with negative value) in the gadget observing negative cheats.

Player II can use the gadgets in Figures 45 to detect any structural cheat committed by Player OO. If Player OO initially provides an action different from (s0,_,_,_)(s_{0},\_,\_,\_), Player II can punish him by playing action cheatR:s0. Similarly, if Player OO provides two actions that do not induce a (sub)-path in MM, Player II can punish him within the gadget in Figure 5. Finally, Figure 6 illustrates the neutral gadget, where Player II simply observes the run provided by Player OO and let such a run to reach a final state as soon as Player OO provides an action simulating a step toward the halting state of MM.

Theorem 18.

Let V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖱𝖺𝗍𝗂𝗈}V\in\{{\sf Sum},{\sf Avg},{\sf Ratio}\}. The realizability problem for functional VV-automata is undecidable.

Proof 5.1.

We show that the encoding outlined above is correct by proving that MM halts iff Player OO has a strategy to win the realizability game on the Sum-automaton (resp. Avg-automaton) AA. Namely, we show that Player OO wins the realizability game iff he provides a word π\pi which corresponds to an accepting run of MM (and then stop the game).

(\Rightarrow) Suppose that MM halts. Let π\pi be the run of MM leading to the halting state, and consider λO(π)ΛO\lambda_{O}(\pi)\in\Lambda_{O}, where λO(π)\lambda_{O}(\pi) denotes the strategy for Player OO induced by π\pi, in which PlayerOO provides the word π\pi and then stop the game. Let λIΛI\lambda_{I}\in\Lambda_{I}. There are two cases to consider.

  1. (1)

    In the first case, λI\lambda_{I} does not provide any action in:

    (i=1,2{cheatCi+,cheatCi-})(0j<|S|{cheatR:sj})(\bigcup_{i=1,2}\{\emph{cheatCi+},\emph{cheatCi-}\})\cup(\bigcup_{0\leq j<|S|}\{\emph{cheatR:$s_{j}$}\})

    Then, the only run to a final state in AA is the one within the neutral gadget, having weight strictly positive.

  2. (2)

    In the second case, γI\gamma_{I} contains an action in (i=1,2{cheatCi+,cheatCi-})(\bigcup_{i=1,2}\{\emph{cheatCi+},\emph{cheatCi-}\}). Let α\alpha be the first action in (i=1,2{cheatCi+,cheatCi-})(\bigcup_{i=1,2}\{\emph{cheatCi+},\emph{cheatCi-}\}) on λI\lambda_{I}. There is only one gadget allowing a run containing α\alpha. Since π\pi is faithfully simulating MM, such a run leads to a final state in the corresponding gadget with value >0>0.

Note that λI\lambda_{I} cannot contain an action α(0j<|S|{cheatR:sj})\alpha\in(\bigcup_{0\leq j<|S|}\{\emph{cheatR:$s_{j}$}\}). In fact, Player II can never play cheatR:sjs_{j}, since Player OO does not commit any structural cheat on the run π\pi. Hence, we conclude that λIΛI(LA(𝗈𝗎𝗍𝖼𝗈𝗆𝖾(λO(π),λI)>0))\forall\lambda_{I}\in\Lambda_{I}(L_{A}(\mathsf{outcome}(\lambda_{O}(\pi),\lambda_{I})>0)).

(\Leftarrow) Suppose that λOΛO\lambda_{O}\in\Lambda_{O} is such that λIΛI(LA(𝗈𝗎𝗍𝖼𝗈𝗆𝖾(λO,λI)0))\forall\lambda_{I}\in\Lambda_{I}(L_{A}(\mathsf{outcome}(\lambda_{O},\lambda_{I})\geq 0)). By construction of AA, λO\lambda_{O} allows Player OO to survive in the gadgets for detecting positive, negative or structural cheats if and only if the projection of the outcome onto ΣO\Sigma_{O} is a faithful simulation of a run in MM. If Player II can not use an action in (i=1,2{cheatCi+,cheatCi-})(0j<|S|{cheatR:sj})(\bigcup_{i=1,2}\{\emph{cheatCi+},\emph{cheatCi-}\})\cup(\bigcup_{0\leq j<|S|}\{\emph{cheatR:$s_{j}$}\}) to win (using the gadget targeted to check the corresponding cheat), the only remaining strategy for Player II is playing indefinitely ¬cheat\neg cheat. In that case, Player OO wins only if he eventually provides an action simulating a step leading to an halting state in MM (and then stop the game). Thus, our hypothesis entail that λO\lambda_{O} consists in providing a run for MM that leads to a final state, witnessing that MM halts. Undecidability for Ratio-automata follows from the fact that any Avg-automaton A=(Q,qI,F,δ,γ)A=(Q,q_{I},F,\delta,\gamma) can be coded into a Ratio-automaton by reweighting from γ(t)\gamma(t) to (γ(t),1)(\gamma(t),1) each transition tδt\in\delta.

5.2. Realizability on Deterministic Weighted Automata

The encoding in the previous subsection relies on the use of a nondeterminism. When the automata are deterministic, we recover decidability by considering suitable variants of classical games played on graphs, and prove that they are solvable in 𝖭𝖯𝖼𝗈𝖭𝖯{\sf NP}\cap{\sf coNP}.

Theorem 19.

Let V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆,𝖱𝖺𝗍𝗂𝗈}V\in\{{\sf Sum},{\sf Avg},{\sf Dsum},{\sf Ratio}\}. The realizability problem for deterministic VV-automata is in 𝖭𝖯𝖼𝗈𝖭𝖯.{\sf NP}\cap{\sf coNP}.

Proof 5.2.

We first consider the case of deterministic Sum-automata. Let A=(Q=QOQI,qI,F,δ,γ)A=(Q=Q_{O}\uplus Q_{I},q_{I},F,\delta,\gamma) be a deterministic Sum-automaton. Without loss of generality, we assume that AA contains only one accepting state denoted by ff which is absorbing555Note that in our setting Player O has the ability to stop the game by means of the special symbol \dashv. Therefore, it is sufficient to redirect the transition labeled by \dashv to a unique absorbing final state.. Then we consider AA as a finite state game arena and compute the set of states SQS\subseteq Q from which player OO can force a visit to the accepting state ff. Note that from any state ss in SS, player OO has a strategy to force a visit to ff within nn steps, where n=|Q|n=|Q|. Note also that by determinacy, the complement of this set is the set of states of AA from which player II has a strategy to prevent a visit to ff. Clearly, player OO has to avoid the states in QSQ\setminus S at all cost and so they can be removed from AA. Let AA^{\prime} be AA where we have kept only the states in SS.

Now, we construct from AA^{\prime} a finite tree as follows. We unfold AA^{\prime} and stop a branch at a node when:

  • it is labeled with ff and the sum of the weights on the branch up to the node is equal to c>νc>\nu,

  • it is labeled by a state qq that already appears on the branch from the root to the node. We call the node where qq already appears the ancestor of the leaf.

Let us note LL the set of leafs of this finite tree. We then partition the leafs of this tree into L1L_{1}, the set of leafs that are good for player OO and L2L_{2}, the set of leafs that are good for player II. L1L_{1} contains:

  • (C1)(C_{1}) the leafs that are annotated with ff and for which the sum of weights is strictly greater than the realizability threshold ν\nu, and

  • (C2)(C_{2}) the leafs labeled with a repeating state and for which the sum of weights from the root to the leaf is strictly larger than the sum of weights from the root to the ancestor.

L2=QL1L_{2}=Q\setminus L_{1} are the leafs that are good for player II. Now, consider the game played on this finite tree where player OO wants to reach L1L_{1} and player II wants to reach L2L_{2}. The winner in this game can be found by backward induction. We claim (and prove) below that player II wins in this finite game tree iff he wins the original game.

Assume that player OO wins the finite game tree. We show how to construct a winning strategy in the original game. The strategy is built as follows. In the original game, player OO plays as in the final tree up to the point where he reaches a leaf (in L1L_{1}). If the leaf is of sort defined in C1C_{1} above then we know that player OO has won the original game. Otherwise, we know that the sum now is strictly greater than the sum up to the ancestor of the leaf that we have reached. Then player OO continues to play as prescribed by its winning strategy in the tree from the ancestor. Continuing like that, each time that the game arrives at a leaf, the sum of weights has strictly increased from the last visit to that leaf. As a consequence, after a finite amount of time, the sum will be strictly larger than ν+n|W|\nu+n\cdot|-W| where W-W is the smallest negative weight in AA^{\prime}. From that point, player OO can use his strategy that forces the state ff and reach it with a sum that is strictly greater than ν\nu (this is because he can force ff within nn steps).

Now assume that player II wins the finite game tree. We show how to construct a winning strategy in the original game. The strategy simply follows the strategy of player II in the finite tree by applying the strategy from the ancestor when reaching a leaf. As only leaf in L2L_{2} are reached when playing that way, we know that the sum on successive visits to repeating states is non-increasing. As a consequence, as player OO can not force a visit to a node labeled with ff and sum greater than ν\nu in the finite game tree, we know that this will not happen in the original game neither when player II plays its strategy.

This proof establishes that the realizability problem is decidable for deterministic Sum-automata. Note that player OO needs memory to win in the original game as he has to verify that he has reached a sufficiently high sum before applying the strategy that forces the visit to ff. To provide the complexity bound of 𝖭𝖯𝖼𝗈𝖭𝖯{\sf NP}\cap{\sf coNP}, we reduce the realizability problem for deterministic Sum-automata to the decision problem on mean-payoff games [18, 39]. A mean-payoff game is a zero-sum game involving two players (the maximazer P0P_{0} and the minimizer P1P_{1}) where P0P_{0} has the following objective: to maximize his mean-payoff, defined as the liminf of the ratio between the cost of a play-prefix of length ll (i.e. the sum of the weights along the path) and ll when l+l\rightarrow+\infty.

Given a deterministic Sum-automaton A=(Q=QOQI,qI,F,δ,γ)A=(Q=Q_{O}\uplus Q_{I},q_{I},F,\delta,\gamma), where ff is an absorbing accepting state, consider the mean-payoff game G=(V0,V1,δG,γ)G=(V_{0},V_{1},\delta_{G},\gamma), where V0QOV_{0}\subseteq Q_{O} (resp. V1QIV_{1}\subseteq Q_{I}) is the set of states of player OO (resp. player II) for which player OO has a strategy to force a visit to ff. The transition relation δG\delta_{G} is built as follows. We add an edge from ff back to qIq_{I} (weighted 0) and we omit the self-loop on the absorbing final state. Moreover, if ν>0\nu>0 then δG(q,q)=δ(q,q)ν\delta_{G}(q,q^{\prime})=\delta(q,q^{\prime})-\nu for each edge (q,q)(q,q^{\prime}) in AA. We prove that player OO has a winning strategy w.r.t. realizability on AA if and only if val(qI)>0val(q_{I})>0 in the mean-payoff game GG. Suppose val(qI)>0val(q_{I})>0 in GG. Then, player OO has a memoryless strategy to ensure val(qI)>0val(q_{I})>0. Let σ\sigma be such a memoryless strategy for player OO, and consider the graph GσG_{\sigma} obtained from GG by removing all the edges sourcing from a vertex in V0V_{0} that are not chosen according to σ\sigma. Since σ\sigma guarantees val(qI)>0val(q_{I})>0, GσG_{\sigma} does not contain any non-positive cycle. By construction, each simple cycle involving ff in GG is a simple path to ff followed by an edge back to qIq_{I} with weight 0. Hence, GσG_{\sigma} contains a cycle through ff if and only if GG contains a simple positive path to ff. Therefore, playing according to σ\sigma on AA, player OO will either reach ff with sum greater than ν\nu, or he will eventually reach a sum high enough to guarantee him to win, as soon as he forces the play to reach ff. Conversely, assume that player OO has a strategy to win the realizability game on AA and let σ\sigma be a corresponding winning strategy. To win the mean-payoff game GG, player OO needs simply to apply σ\sigma on GG, since this leads him to ff with a positive sum, and then the play starts back from qIq_{I} following the only edge sourcing from ff back to qIq_{I}. As shown in the previous results Avg games can be reduced easily to Sum games, and as for the questions about thresholds, Ratio games can be reduced to Avg games.

We now turn to the case of Dsum. The solution for Dsum is obtained by first removing from AA all states from which player OO cannot force a visit to ff. As above, we note the game where those states have been removed by AA^{\prime}. Then, we consider AA^{\prime} as an (infinite) discounted sum game where player OO tries to maximize the value of the discounted sum while player II tries to minimize this value. Let vv denote the value of the initial state qIq_{I} in that game. We claim that player OO wins the initial game iff the value vv in qIq_{I} is such that v>νv>\nu. Indeed, if player OO has a winning strategy in the original game, i.e. a strategy to force the game into ff with discounted sum strictly greater than ν\nu, then by playing this strategy in the discounted sum game, the infinite discounted sum will be equal to the discounted sum up to ff as from there only the self loop on ff is traversed and its weight is equal to 0. Now assume that player OO has a strategy that force a value v>νv>\nu in the discounted sum game. Then by playing that strategy for ii steps in the original game with ii large enough to make sure that λiW++λi+nW\lambda^{i}W+\dots+\lambda^{i+n}W is small enough, he will be able to switch to its strategy that forces ff after at most nn steps and ensure to reach ff with a discounted sum >ν>\nu. As infinite discounted sum games are in 𝖭𝖯𝖼𝗈𝖭𝖯{\sf NP}\cap{\sf coNP} [3] and since our reduction is polynomial, we also get that finite reachability discounted sum games are in 𝖭𝖯𝖼𝗈𝖭𝖯{\sf NP}\cap{\sf coNP}.

6. Determinizability Problem

A weighted VV-automaton AA is said to be determinizable it there exists a deterministic VV-automaton DD such that LA(w)=LD(w)L_{A}(w)=L_{D}(w) for all wΣ+w\in\Sigma_{\dashv}^{+}. Weighted automata are not determinizable in general. For example, consider the right automaton on Fig. 1. Seen as Sum-automaton, it cannot be determinized, because there are infinitely many delays associated with the pair of states (p,q)(p,q). Those delays can for instance be obtained by the family of words of the form ana^{n}. Determinizability is already known to be decidable in PTime for functional Sum-automata [23]666See [24, 22] for determinizability results on more general classes of Sum-automata.. It is also known that any Dsum-automaton (even non-functional) with an integral discount factor, i.e. λ=1/n\lambda=1/n, where n>1n>1 is an integer, is determinizable [10].

Determinizable functional 𝖲𝗎𝗆{\sf Sum}-automata are characterized by the so called twinning property, that has been introduced for finite word transducers [13, 4]. In particular, the twinning property has been used as a sufficient condition for the termination of Mohri’s determinization algorithm [16] for (non-functional) weighted automata over the tropical semiring. In [23], Kirsten et al. proved that such a property is also a necessary condition for determinization of functional Sum-automata. The twinning property has been also used as a sufficient condition for the termination of a determinization procedure, applied to classes of weighted automata defined on more general commutative semirings [23] (the commutativity hypothesis is necessary here to ensure that the twinning property is sufficient). In this paper, we consider determinization of functional arbitrary group automata. Further, we show that the twinning property is also a necessary condition for the determinization of functional group automata over groups enjoying the so called infinitary property. We show that the groups encoding Sum, Avg and Dsum are all infinitary. Therefore, our general decidability result for the determinization problem on functional infinitary group automata applies to functional Sum, Avg and Dsum-automata.

6.1. Determinization of functional group automata

We first define a determinization construction for functional group automata. This construction does not necessarily yield a deterministic group automaton with a finite set of states, unless, as we show in Subsection 6.2, the twinning property is satisfied.

The procedure is similar to the one of [16] for weighted automata over a semiring (under some conditions, such as weak divisibility), and to that of finite-state transducers [13, 4], but adapted to groups. In particular, the procedure of [16] heavily uses the additive operation of semi-rings, and the determinization of finite-state transducers relies on the operation of taking the longest common prefix of two strings. One cannot rely on similar operations for group automata. To be more precise, both known determinization procedures in [13, 4, 16] extend the classical subset construction with delays (what remains to be output). States are therefore pairs (q,d)(q,d) where qq is a state of the original automaton, and dd is a delay (unlike functional automata, there can be several delays associated with the same state). Initially, all delays are equal to 𝟙\mathbb{1}. When reading a new symbol aa from a state PP, the deterministic automaton outputs a value vv and goes to a state PP^{\prime}. Let us explain how vv is computed. Let TT be the set of transitions (p,a,p)(p,a,p^{\prime}) of the original automaton on aa, such that there exists (p,d)P(p,d)\in P. Let γ(p,a,p)\gamma(p,a,p^{\prime}) be their associated value. The value vv is obtained by taking the sum (resp. the longest common prefix) of the set {dγ(p,a,p)|(p,d)P}\{d\cdot\gamma(p,a,p^{\prime})\ |\ (p,d)\in P\}. In other words, for each transition (p,a,p)(p,a,p^{\prime}), what remains to be output is dγ(p,a,p)d\cdot\gamma(p,a,p^{\prime}), and the output of the deterministic automaton is somehow the “best” that can be output at the moment: the sum (or longest common prefix respectively) of all these values. The state PP^{\prime} is then the set of states pp^{\prime} with updated delays, i.e. what still remain to be output.

Our determinization construction differs from the procedures in [13, 4, 16] sketched above in two points: (i)(i) it applies to group automata that are functional, and therefore there is at most one delay per state (otherwise, since we assume that all state are co-accessible, functionality would be falsified) (ii)(ii) to compute the value vv, since we cannot rely on the additive operation, nor the longest common prefix operation, we pick a base transition (p0,a,p0)(p_{0},a,p^{\prime}_{0}) (according to a given total order on transitions), and vv is then dγ(p0,a,p0)d\cdot\gamma(p_{0},a,p^{\prime}_{0}), where dd is the delay associated with p0p_{0}. The new delays are computed relatively to vv. The construction works for any order on transitions, possibly yielding different deterministic automata777While point (i)(i) could be relaxed by having sets of delays associated with each state, and several outputs on the terminal symbol \dashv, we rather assume functionality as it is the purpose of this paper, and it lightens our notations. .

Given the above premises, let us describe our determinization construction formally. Let A=(Q,qI,F,δ,γ)A=(Q,q_{I},F,\delta,\gamma) be a trim functional group automaton over a group (W,,𝟙)(W,\cdot,\mathbb{1}) and assume, w.l.o.g., that δ\delta is totally ordered by some order δ\leq_{\delta}. The output of our construction is a group automaton Ad=(Qd,fI,Fd,δd,γd)A_{d}=(Q_{d},f_{I},F_{d},\delta_{d},\gamma_{d}) over (W,,𝟙)(W,\cdot,\mathbb{1}) such that LAd=LAL_{A_{d}}=L_{A} and δd\delta_{d} is deterministic. However, AdA_{d} is not a proper deterministic group automaton, as it may have infinitely many states. The next section gives a sufficient condition under which QdQ_{d} needs to be finite. Let 𝒟\mathcal{D} be the set of delays 𝖽𝖾𝗅𝖺𝗒(ρ,ρ){\sf delay}(\rho,\rho^{\prime}) for any two runs ρ,ρ\rho,\rho^{\prime} of AA on the same word. We define Qd=𝒟QQ_{d}=\mathcal{D}^{Q}, as the set of partial functions from states QQ to delays. We let fI:qI𝟙f_{I}:q_{I}\mapsto\mathbb{1} be the initial function, defined for qIq_{I} only. The set of accepting states FdF_{d} is defined as {fQd|dom(f)F}\{f\in Q_{d}\ |\ \text{dom}(f)\cap F\neq\varnothing\}. Then, given partial functions f,fQdf,f^{\prime}\in Q_{d} and a symbol aΣa\in\Sigma, we let t0=(p0,a,p0)t_{0}=(p^{\prime}_{0},a,p_{0}) be the smallest transition (for δ\leq_{\delta}) from a state pdom(f)p^{\prime}\in\text{dom}(f^{\prime}) to a state p0dom(f)p_{0}\in\text{dom}(f) on aa. Let v0=deff(p)γ(t0)v_{0}=_{def}f^{\prime}(p^{\prime})\cdot\gamma(t_{0}). Then, we let (f,a,f)δd(f^{\prime},a,f)\in\delta_{d} if for all transitions (q,a,q)δ(q^{\prime},a,q)\in\delta such that qdom(f)q^{\prime}\in\text{dom}(f^{\prime}), f(q)f(q) is defined and equals

f(q)=v01f(q)γ(q,a,q)f(q)=v_{0}^{-1}\cdot f^{\prime}(q^{\prime})\cdot\gamma(q^{\prime},a,q)

The value γd(f,a,f)\gamma_{d}(f^{\prime},a,f) of the transition (f,a,f)(f^{\prime},a,f) is v0v_{0}. Note that AdA_{d} is deterministic, because ff is functionally obtained from ff^{\prime} and aa.

Lemma 20.

Let AA be a trim functional group automaton and AdA_{d} be the group automaton obtained by determinization. Then, for all wΣ+w\in\Sigma^{+}, LA(w)=LAd(w)L_{A}(w)=L_{A_{d}}(w). However, AdA_{d} may have infinitely many states.

Proof 6.1.

We show that AdA_{d} maintains the following invariant: for all wΣw\in\Sigma^{*} such that there is a run ρd:fI𝑤fQd\rho_{d}:f_{I}\xrightarrow{w}f\in Q_{d}, the following three properties hold:

  1. (1)

    there exists p0dom(f)p_{0}\in\text{dom}(f) such that f(p0)=𝟙f(p_{0})=\mathbb{1},

  2. (2)

    for all qdom(f)q\in\text{dom}(f), for all runs ρ:qI𝑤q\rho:q_{I}\xrightarrow{w}q and ρ0:qI𝑤p0\rho_{0}:q_{I}\xrightarrow{w}p_{0}, f(q)=𝖽𝖾𝗅𝖺𝗒(ρ0,ρ)f(q)={\sf delay}(\rho_{0},\rho),

  3. (3)

    for all qdom(f)q\in\text{dom}(f), for all runs ρ:qI𝑤q\rho:q_{I}\xrightarrow{w}q, V(ρ)=V(ρd)f(q)V(\rho)=V(\rho_{d})\cdot f(q).

We show this invariant by induction on |w||w|. It is clearly true when |w|=0|w|=0. Suppose that w=waw=w^{\prime}a, where aΣa\in\Sigma, and let fQdf^{\prime}\in Q_{d} be such that fI𝑤ff_{I}\xrightarrow{w}f^{\prime} and (f,a,f)Qd(f^{\prime},a,f)\in Q_{d}. We show the two conditions:

(1)(1) it suffices to take p0p_{0} as defined in the determinization construction, because by definition f(p0)=v01v0=𝟙f(p_{0})=v_{0}^{-1}\cdot v_{0}=\mathbb{1}.

(2)(2) Let ρ:qI𝑤q\rho^{\prime}:q_{I}\xrightarrow{w}q^{\prime} be a run such that ρ.(q,a,q)=ρ\rho^{\prime}.(q^{\prime},a,q)=\rho, and let ρ0:qI𝑤p\rho^{\prime}_{0}:q_{I}\xrightarrow{w}p^{\prime} be a run, where pp^{\prime} is defined as in the definition of δd\delta_{d}. By induction hypothesis, by (1)(1), there exists p0Qp^{\prime}_{0}\in Q such that f(p0)=𝟙f^{\prime}(p^{\prime}_{0})=\mathbb{1}. Let r:qI𝑤p0r:q_{I}\xrightarrow{w}p^{\prime}_{0} be a run of AA on ww. Again by induction hypothesis, by (3)(3), we have f(p)=𝖽𝖾𝗅𝖺𝗒(r,ρ0)f^{\prime}(p^{\prime})={\sf delay}(r,\rho^{\prime}_{0}) and f(q)=𝖽𝖾𝗅𝖺𝗒(r,ρ)f^{\prime}(q^{\prime})={\sf delay}(r,\rho^{\prime}), i.e. f(p)=V(r)1V(ρ0)f^{\prime}(p^{\prime})=V(r)^{-1}\cdot V(\rho^{\prime}_{0}) and f(q)=V(r)1V(ρ)f^{\prime}(q^{\prime})=V(r)^{-1}\cdot V(\rho^{\prime}). Now, by definition of δd\delta_{d}, we have:

f(q)=v01f(q)γ(q,a,q)=(f(p)γ(p,a,p0))1f(q)γ(q,a,q)=γ(p,a,p0)1(f(p))1f(q)γ(q,a,q)=γ(p,a,p0)1(V(r)1V(ρ0))1V(r)1V(ρ)γ(q,a,q)=γ(p,a,p0)1V(ρ0)1V(r)V(r)1V(ρ)γ(q,a,q)=γ(p,a,p0)1V(ρ0)1V(ρ)γ(q,a,q)=V(ρ0)1V(ρ)=𝖽𝖾𝗅𝖺𝗒(ρ0,ρ)\begin{array}[]{lllllllllll}f(q)&=&v_{0}^{-1}\cdot f^{\prime}(q^{\prime})\cdot\gamma(q^{\prime},a,q)\\ &=&(f^{\prime}(p^{\prime})\cdot\gamma(p^{\prime},a,p_{0}))^{-1}\cdot f^{\prime}(q^{\prime})\cdot\gamma(q^{\prime},a,q)\\ &=&\gamma(p^{\prime},a,p_{0})^{-1}\cdot(f^{\prime}(p^{\prime}))^{-1}\cdot f^{\prime}(q^{\prime})\cdot\gamma(q^{\prime},a,q)\\ &=&\gamma(p^{\prime},a,p_{0})^{-1}\cdot(V(r)^{-1}\cdot V(\rho^{\prime}_{0}))^{-1}\cdot V(r)^{-1}\cdot V(\rho^{\prime})\cdot\gamma(q^{\prime},a,q)\\ &=&\gamma(p^{\prime},a,p_{0})^{-1}\cdot V(\rho^{\prime}_{0})^{-1}\cdot V(r)\cdot V(r)^{-1}\cdot V(\rho^{\prime})\cdot\gamma(q^{\prime},a,q)\\ &=&\gamma(p^{\prime},a,p_{0})^{-1}\cdot V(\rho^{\prime}_{0})^{-1}\cdot V(\rho^{\prime})\cdot\gamma(q^{\prime},a,q)\\ &=&V(\rho_{0})^{-1}\cdot V(\rho)\\ &=&{\sf delay}(\rho_{0},\rho)\end{array}

(3)(3) Let ρd\rho^{\prime}_{d} be the run of AdA_{d} on ww. Let ρ:qI𝑤q\rho^{\prime}:q_{I}\xrightarrow{w}q^{\prime} be such that ρ.(q,a,q)=ρ\rho^{\prime}.(q^{\prime},a,q)=\rho. By induction hypothesis and (3)(3), we know that

V(ρ)=V(ρd)f(q)V(\rho^{\prime})=V(\rho^{\prime}_{d})\cdot f^{\prime}(q^{\prime}) (5)

and therefore since V(ρd)=V(ρd)v0V(\rho_{d})=V(\rho^{\prime}_{d})\cdot v_{0},

V(ρ)=V(ρd)v01f(q)V(\rho^{\prime})=V(\rho_{d})\cdot v_{0}^{-1}\cdot f^{\prime}(q^{\prime}) (6)

From which we get

V(ρ)γ(q,a,q)=V(ρd)v01f(q)γ(q,a,q)V(\rho^{\prime})\cdot\gamma(q^{\prime},a,q)=V(\rho_{d})\cdot v_{0}^{-1}\cdot f^{\prime}(q^{\prime})\cdot\gamma(q^{\prime},a,q) (7)

which, since V(ρ)=V(ρ)γ(q,a,q)V(\rho)=V(\rho^{\prime})\cdot\gamma(q^{\prime},a,q) and f(q)=v01f(q)γ(q,a,q)f(q)=v_{0}^{-1}\cdot f^{\prime}(q^{\prime})\cdot\gamma(q^{\prime},a,q), is equivalent to V(ρ)=V(ρd)f(q)V(\rho)=V(\rho_{d})\cdot f(q).

From this invariant, it is not difficult to show that LA=LAdL_{A}=L_{A_{d}}. Indeed, let wdom(A)w\in\text{dom}(A), let ρ\rho be an accepting run of AA on ww (therefore V(ρ)=LA(w)V(\rho)=L_{A}(w)), and let ρd\rho_{d} be the run of AdA_{d} on ww (its existence is already a consequence of the subset construction in finite automata). Clearly, ρd\rho_{d} ends in a state ff such that dom(f)F\text{dom}(f)\subseteq F, because ww necessarily ends with \dashv, and it is the only way in AA to reach an accepting state. By invariant (2)(2), f(q)=𝖽𝖾𝗅𝖺𝗒(ρ0,ρ)f(q)={\sf delay}(\rho_{0},\rho) for ρ0\rho_{0} a run of AA on ww ending in a state p0p_{0} such that f(p0)=𝟙f(p_{0})=\mathbb{1}. By invariant (3)(3), V(ρd)=V(ρ0)f(p0)=V(ρ0)V(\rho_{d})=V(\rho_{0})\cdot f(p_{0})=V(\rho_{0}). Since dom(f)F\text{dom}(f)\subseteq F, ρ0\rho_{0} is accepting, and since AA is functional, V(ρ0)=V(ρ)V(\rho_{0})=V(\rho). Therefore V(ρ)=V(ρd)V(\rho)=V(\rho_{d}), i.e. LAd(w)=LA(w)L_{A_{d}}(w)=L_{A}(w). The converse is shown similarly.

Note that for finite groups, this determinization always yields an equivalent (finite) deterministic group automaton, because the set of delays is finite.

Lemma 21.

Any functional group automaton over a finite group is determinizable.

6.2. The twinning property: a sufficient condition for determinizability

Lemma 22 shows that the twinning property (cfr. Definition 6.2) is sufficient to guarantee the termination of the determinization construction, i.e., the finiteness of the automaton AdA_{d} obtained by determinization.

{defi}

Two states p,qp,q of a functional group automaton AA are twinned if both pp and qq are co-accessible and for all words w1,w2Σw_{1},w_{2}\in\Sigma^{*}, for all runs ρ1:qIw1p\rho_{1}:q_{I}\xrightarrow{w_{1}}p, ρ2:pw2p\rho_{2}:p\xrightarrow{w_{2}}p, ρ1:qIw1q\rho^{\prime}_{1}:q_{I}\xrightarrow{w_{1}}q, ρ2:qw2q\rho^{\prime}_{2}:q\xrightarrow{w_{2}}q, we have 𝖽𝖾𝗅𝖺𝗒(ρ1,ρ1)=𝖽𝖾𝗅𝖺𝗒(ρ1ρ2,ρ1ρ2){\sf delay}(\rho_{1},\rho^{\prime}_{1})={\sf delay}(\rho_{1}\rho_{2},\rho^{\prime}_{1}\rho^{\prime}_{2}). The automaton AA satisfies the twinning property if all pairs of states are twinned.

Lemma 22.

Let AA be a group automaton. If AA satisfies the twinning property, then there are at most |Σ||Q|2|\Sigma|^{|Q|^{2}} delays 𝖽𝖾𝗅𝖺𝗒(ρ,ρ){\sf delay}(\rho,\rho^{\prime}) for any two runs ρ,ρ\rho,\rho^{\prime} on the same input, and thus the deterministic group automaton AdA_{d} obtained by the determinization procedure is finite.

Proof 6.2.

As delays must be equivalent on parallel loops, any delay can be obtained with some pair of runs of length |Q|2|Q|^{2} at most (on longer pairs of runs, there must exist a parallel loop with equivalent delays that can be removed without affecting the value of the global delay of both runs, see Lemma 5).

The following lemma states a short witness property for the non satisfiability of the twinning property. This result is crucial to prove that the twinning property is decidable (cfr. Lemma 24).

Lemma 23.

If a functional group automaton AA does not satisfy the twinning property, there exist two words w1,w2Σw_{1},w_{2}\in\Sigma^{*} such that |w1|2|Q|2|w_{1}|\leq 2|Q|^{2} and |w2|2|Q|2|w_{2}|\leq 2|Q|^{2}, two states p,qQp,q\in Q such that pp and qq are both co-accessible, and runs ρ1:qIw1p\rho_{1}:q_{I}\xrightarrow{w_{1}}p, ρ2:pw2p\rho_{2}:p\xrightarrow{w_{2}}p, ρ1:qIw1q\rho^{\prime}_{1}:q_{I}\xrightarrow{w_{1}}q, ρ2:qw2q\rho^{\prime}_{2}:q\xrightarrow{w_{2}}q, such that 𝖽𝖾𝗅𝖺𝗒(ρ1,ρ1)𝖽𝖾𝗅𝖺𝗒(ρ1ρ2,ρ1ρ2){\sf delay}(\rho_{1},\rho^{\prime}_{1})\neq{\sf delay}(\rho_{1}\rho_{2},\rho^{\prime}_{1}\rho^{\prime}_{2}).

Proof 6.3.

Suppose that |w2|>2|Q|2|w_{2}|>2|Q|^{2} (the case |w1|>2|Q|2|w_{1}|>2|Q|^{2} is proved exactly the same way) and that w1w2w_{1}w_{2} witnesses that the twinning property does not hold by the decomposition into runs ρ1,ρ2,ρ1,ρ2\rho_{1},\rho_{2},\rho^{\prime}_{1},\rho^{\prime}_{2} as in the premisses of the lemma. We will show that we can shorten the runs ρ1,ρ1\rho_{1},\rho^{\prime}_{1} and still get a witness that the twinning property does not hold.

Since |w2|>2|Q|2|w_{2}|>2|Q|^{2}, there is a pair of states (p,q)(p^{\prime},q^{\prime}) that repeats three times along the two parallel runs ρ2\rho_{2} and ρ2\rho^{\prime}_{2}, i.e. w2w_{2} can be decomposed as w1w2w3w4w^{\prime}_{1}w^{\prime}_{2}w^{\prime}_{3}w^{\prime}_{4} and ρ2\rho_{2} and ρ2\rho^{\prime}_{2} can be decomposed as r1r2r3r4r_{1}r_{2}r_{3}r_{4} and r1r2r3r4r^{\prime}_{1}r^{\prime}_{2}r^{\prime}_{3}r^{\prime}_{4} respectively, where:

r1:pw1pr2:pw2pr3:pw3pr4:pw4pr1:qw1qr2:qw2qr3:qw3qr4:pw4q\begin{array}[]{lllllll}r_{1}:p\xrightarrow{w^{\prime}_{1}}p^{\prime}&r_{2}:p^{\prime}\xrightarrow{w^{\prime}_{2}}p^{\prime}&r_{3}:p^{\prime}\xrightarrow{w^{\prime}_{3}}p^{\prime}&r_{4}:p^{\prime}\xrightarrow{w^{\prime}_{4}}p\\ r^{\prime}_{1}:q\xrightarrow{w^{\prime}_{1}}q^{\prime}&r^{\prime}_{2}:q^{\prime}\xrightarrow{w^{\prime}_{2}}q^{\prime}&r^{\prime}_{3}:q^{\prime}\xrightarrow{w^{\prime}_{3}}q^{\prime}&r^{\prime}_{4}:p^{\prime}\xrightarrow{w^{\prime}_{4}}q\end{array}

Note that r1,r1r_{1},r^{\prime}_{1} and r4,r4r_{4},r^{\prime}_{4} may be empty (in this case p=pp=p^{\prime} and q=qq=q^{\prime}), but r2,r3,r2,r3r_{2},r_{3},r^{\prime}_{2},r^{\prime}_{3} are assumed to be non-empty.

Now, there are two cases: 𝖽𝖾𝗅𝖺𝗒(ρ1r1,ρ1r1)𝖽𝖾𝗅𝖺𝗒(ρ1r1r2,ρ1r1r2){\sf delay}(\rho_{1}r_{1},\rho^{\prime}_{1}r^{\prime}_{1})\neq{\sf delay}(\rho_{1}r_{1}r_{2},\rho^{\prime}_{1}r^{\prime}_{1}r^{\prime}_{2}) and in that case the word w1w1w2w_{1}w^{\prime}_{1}w^{\prime}_{2} is a witness that the twinning property does not hold, and |w1w1w2|<|w1w2||w_{1}w^{\prime}_{1}w^{\prime}_{2}|<|w_{1}w_{2}|. In the second case, we have 𝖽𝖾𝗅𝖺𝗒(ρ1r1,ρ1r1)=𝖽𝖾𝗅𝖺𝗒(ρ1r1r2,ρ1r1r2){\sf delay}(\rho_{1}r_{1},\rho^{\prime}_{1}r^{\prime}_{1})={\sf delay}(\rho_{1}r_{1}r_{2},\rho^{\prime}_{1}r^{\prime}_{1}r^{\prime}_{2}), but in that case, we can apply Lemma 5 and we get 𝖽𝖾𝗅𝖺𝗒(ρ1r1r3r4,ρ1r1r3r4)=𝖽𝖾𝗅𝖺𝗒(ρ1ρ2,ρ1ρ2){\sf delay}(\rho_{1}r_{1}r_{3}r_{4},\rho^{\prime}_{1}r^{\prime}_{1}r^{\prime}_{3}r^{\prime}_{4})={\sf delay}(\rho_{1}\rho_{2},\rho^{\prime}_{1}\rho^{\prime}_{2}).

Therefore, 𝖽𝖾𝗅𝖺𝗒(ρ1,ρ1)𝖽𝖾𝗅𝖺𝗒(ρ1r1r3r4,ρ1r1r3r3){\sf delay}(\rho_{1},\rho^{\prime}_{1})\neq{\sf delay}(\rho_{1}r_{1}r_{3}r_{4},\rho^{\prime}_{1}r^{\prime}_{1}r^{\prime}_{3}r^{\prime}_{3}) and w1w1w3w4w_{1}w^{\prime}_{1}w^{\prime}_{3}w^{\prime}_{4} is a shorter witness that the twinning property does not hold.

Lemma 24.

It is decidable in CoNP whether a functional group automaton satisfies the twinning property.

Proof 6.4.

First, the automaton is transformed into a trim automaton. Then, it suffices to guess two runs on the same input word of size at most 4|Q|24|Q|^{2} and two positions in those runs, and check (in ptime) that the pair of states at the two positions are equal and that the respective delays are different. This algorithm is correct thanks to Lemma 23.

6.3. Determinization of functional infinitary group automata

In this subsection, we define the class of infinitary groups, and show that the twinning property is a necessary condition for determinizability of functional group automata over an infinitary group. Morevoer, we show that the groups encoding Sum, Avg, and Dsum (cf. Lemma 3) belong to this class, yielding a procedure to decide determinizability for the classes of weighted VV-automata, for V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆}V\in\{{\sf Sum},{\sf Avg},{\sf Dsum}\}. Intuitively, the infinitary condition implies that iterating two runs of an infinitary group automaton on a parallel loop induces infinitely many delays.

{defi}

[Infinitary Groups] A group (W,,𝟙)(W,\cdot,\mathbb{1}) is said to be infinitary if it satisfies the infinitary condition stating that for all v1,w1,v2,w2Wv_{1},w_{1},v_{2},w_{2}\in W, if v11w1v21v11w1w2v_{1}^{-1}\cdot w_{1}\neq v_{2}^{-1}\cdot v_{1}^{-1}\cdot w_{1}\cdot w_{2}, then:

|{v2hv11w1w2h|h0}|=|\{v_{2}^{-h}\cdot v_{1}^{-1}\cdot w_{1}\cdot w_{2}^{h}\>|\>h\geq 0\}|=\infty

A group automaton over an infinitary group is called an infinitary group automaton.

We show that the groups encoding Sum, Avg and Dsum satisfy the infinitary condition, as well as any linearly ordered group. A linearly ordered group (W,,𝟙,<)(W,\cdot,\mathbb{1},<) is simply a group (W,,1)(W,\cdot,1) equipped with a strict total order << such that (monotonicity) for all x,y,l,rWx,y,l,r\in W, if x<yx<y then lxr<lyrl\cdot x\cdot r<l\cdot y\cdot r.

Proposition 25.

Any linearly ordered group (W,,𝟙,<)(W,\cdot,\mathbb{1},<) is infinitary.

Proof 6.5.

Indeed, let v1,w1,v2,w2Wv_{1},w_{1},v_{2},w_{2}\in W such that v11w1v21v11w1w2v_{1}^{-1}\cdot w_{1}\neq v_{2}^{-1}\cdot v_{1}^{-1}\cdot w_{1}\cdot w_{2}. Suppose that v11w1<v21v11w1w2v_{1}^{-1}\cdot w_{1}<v_{2}^{-1}\cdot v_{1}^{-1}\cdot w_{1}\cdot w_{2}, then by monotonicity, v21v11w1w2<v21v21v11w1w2w2v_{2}^{-1}\cdot v_{1}^{-1}\cdot w_{1}\cdot w_{2}<v_{2}^{-1}\cdot v_{2}^{-1}\cdot v_{1}^{-1}\cdot w_{1}\cdot w_{2}\cdot w_{2}. More generally, for all i<ji<j, v2iv11w1w2i<v2jv11w1w2jv_{2}^{-i}\cdot v_{1}^{-1}\cdot w_{1}\cdot w_{2}^{i}<v_{2}^{-j}\cdot v_{1}^{-1}\cdot w_{1}\cdot w_{2}^{j}. The infinitary condition is shown similarly when assuming v11w1>v21v11w1w2v_{1}^{-1}\cdot w_{1}>v_{2}^{-1}\cdot v_{1}^{-1}\cdot w_{1}\cdot w_{2}.

Since the groups encoding Sum and Avg can be linearly ordered, we immediately get that they are infinitary. For Dsum, we do a different proof.

Proposition 26.

For V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆}V\in\{{\sf Sum},{\sf Avg},{\sf Dsum}\}, let GVG_{V} be the groups defined in Lemma 3. Then GVG_{V} is infinitary.

Proof 6.6.

We show that for the three measures, the groups that encode them (see Lemma 3) can be linearly ordered. Then, the result follows by Proposition 25.

For G𝖲𝗎𝗆G_{\sf Sum}, it suffices to order its elements with the natural order on integers. Similarly, for G𝖠𝗏𝗀G_{\sf Avg}, it suffices to order its elements by lexicographic order. For both orders, it is easy to show they satisfy the monotonicity property.

The group G𝖣𝗌𝗎𝗆G_{\sf Dsum} can also be linearly ordered by lexicographic order as follows: (a,x)<(b,y)(a,x)<(b,y) if x<yx<y, or x=yx=y and a<ba<b. Let us show that this order satisfies the monotonicity condition. Assume that (a,x)<(b,y)(a,x)<(b,y) and consider (c,z)×+(c,z)\in\mathbb{Q}\times\mathbb{Q}^{+}. Then, (c,z)(a,x)=(cx+a,zx)(c,z)\cdot(a,x)=(\frac{c}{x}+a,zx) and (c,z)(b,y)=(cy+b,zy)(c,z)\cdot(b,y)=(\frac{c}{y}+b,zy). Suppose that x<yx<y, then clearly, since z,x,yz,x,y are strictly positive, we have zx<zyzx<zy, and therefore (c,z)(a,x)<(c,z)(b,y)(c,z)\cdot(a,x)<(c,z)\cdot(b,y). Otherwise, if x=yx=y, then a<ba<b, and we get zx=zyzx=zy, cx+a<cy+b\frac{c}{x}+a<\frac{c}{y}+b, which implies again (c,z)(a,x)<(c,z)(b,y)(c,z)\cdot(a,x)<(c,z)\cdot(b,y).

Now, we show that (a,x)(c,z)<(b,y)(c,z)(a,x)\cdot(c,z)<(b,y)\cdot(c,z). By definition of \cdot, (a,x)(c,z)=(az+c,xz)(a,x)\cdot(c,z)=(\frac{a}{z}+c,xz) and (b,y)(c,z)=(bz+c,yz)(b,y)\cdot(c,z)=(\frac{b}{z}+c,yz). If x<yx<y, then clearly xz<yzxz<yz and we are done. Otherwise, x=yx=y and a<ba<b, which implies that az+c<bz+c\frac{a}{z}+c<\frac{b}{z}+c.

Lemma 27.

Let AA be a trim functional infinitary group automaton. If AA does not satisfy the twinning property, then AA is not determinizable.

Proof 6.7.

Suppose that the twinning property does not hold. Therefore we can find words w1w_{1}, w2w_{2} and runs ρ1,ρ1\rho_{1},\rho^{\prime}_{1} on w1w_{1} and ρ2,ρ2\rho_{2},\rho^{\prime}_{2} on w2w_{2} such that ρ2,ρ2\rho_{2},\rho^{\prime}_{2} are loops (on state pp and qq respectively), and 𝖽𝖾𝗅𝖺𝗒(ρ1,ρ1)𝖽𝖾𝗅𝖺𝗒(ρ1ρ2,ρ1ρ2){\sf delay}(\rho_{1},\rho^{\prime}_{1})\neq{\sf delay}(\rho_{1}\rho_{2},\rho^{\prime}_{1}\rho^{\prime}_{2}). Let Δ(k)=𝖽𝖾𝗅𝖺𝗒(ρ1(ρ2)k,ρ1(ρ2)k)\Delta(k)={\sf delay}(\rho_{1}(\rho_{2})^{k},\rho^{\prime}_{1}(\rho^{\prime}_{2})^{k}) for all kk\in\mathbb{N}. By the infinitary condition, the set {Δ(k)|k0}\{\Delta(k)\ |\ k\geq 0\} is infinite. Let SS\subseteq\mathbb{N} such that for all i,jSi,j\in S such that iji\neq j, Δ(i)Δ(j)\Delta(i)\neq\Delta(j). Note that SS is infinite.

Suppose that there exists a deterministic automaton Ad=(Qd,fI,Fd,δd,γd)A_{d}=(Q_{d},f_{I},F_{d},\delta_{d},\gamma_{d}) equivalent to AA. We exhibit a contradiction. Since SS is infinite and QdQ_{d} is finite, we can find k1k2k_{1}\neq k_{2}\in\mathbb{N} such that k1Sk_{1}\in S, k1+k2Sk_{1}+k_{2}\in S (i.e. Δ(k1)Δ(k1+k2)\Delta(k_{1})\neq\Delta(k_{1}+k_{2})), and such that on w1(w2)k1+k2w_{1}(w_{2})^{k_{1}+k_{2}}, the run of AdA_{d} has the following form:

fIw1(w2)k1f(w2)k2ff_{I}\xrightarrow{w_{1}(w_{2})^{k_{1}}}f\xrightarrow{(w_{2})^{k_{2}}}f

for some fQdf\in Q_{d}.

Moreover, since pp and qq are both co-accessible, there exist two words w3,w3w_{3},w^{\prime}_{3} and two runs of AdA_{d} of the form:

ρd:fIw1(w2)k1f(w2)k2fw3gρd:fIw1(w2)k1f(w2)k2fw3g\begin{array}[]{lllllll}\rho_{d}\ :\ f_{I}\xrightarrow{w_{1}(w_{2})^{k_{1}}}f\xrightarrow{(w_{2})^{k_{2}}}f\xrightarrow{w_{3}}g\\ \rho^{\prime}_{d}\ :\ f_{I}\xrightarrow{w_{1}(w_{2})^{k_{1}}}f\xrightarrow{(w_{2})^{k_{2}}}f\xrightarrow{w^{\prime}_{3}}g^{\prime}\\ \end{array}

for some accepting states g,gFdg,g^{\prime}\in F_{d}. Let ρd=ρd,1ρd,2ρd,3\rho_{d}=\rho_{d,1}\rho_{d,2}\rho_{d,3} and ρd=ρd,1ρd,2ρd,3\rho^{\prime}_{d}=\rho_{d,1}\rho_{d,2}\rho^{\prime}_{d,3} for some subruns ρd,1,ρd,2\rho_{d,1},\rho_{d,2} that correspond to w1(w2)k1w_{1}(w_{2})^{k_{1}} and (w2)k2(w_{2})^{k_{2}} respectively, and some subruns ρd,3\rho_{d,3} and ρd,3\rho^{\prime}_{d,3} that correspond to w3w_{3} and w3w^{\prime}_{3} respectively. We know that Δ(k1)Δ(k1+k2)\Delta(k_{1})\neq\Delta(k_{1}+k_{2}). We show that this leads to a contradiction. Let also ρ3:pw3pf\rho_{3}:p\xrightarrow{w_{3}}p_{f} and ρ3:qw3qf\rho^{\prime}_{3}:q\xrightarrow{w^{\prime}_{3}}q_{f} be two runs in AA, for some pf,qfFp_{f},q_{f}\in F. Then we have:

V(ρd,1ρd,2ρd,3)=V(ρ1(ρ2)k1+k2ρ3)V(\rho_{d,1}\rho_{d,2}\rho_{d,3})\ =\ V(\rho_{1}(\rho_{2})^{k_{1}+k_{2}}\rho_{3}) (8)
V(ρd,1ρd,2ρd,3)=V(ρ1(ρ2)k1+k2ρ3)V(\rho_{d,1}\rho_{d,2}\rho^{\prime}_{d,3})\ =\ V(\rho^{\prime}_{1}(\rho^{\prime}_{2})^{k_{1}+k_{2}}\rho^{\prime}_{3}) (9)
V(ρd,1ρd,3)=V(ρ1(ρ2)k1ρ3)V(\rho_{d,1}\rho_{d,3})\ =\ V(\rho_{1}(\rho_{2})^{k_{1}}\rho_{3}) (10)
V(ρd,1ρd,3)=V(ρ1(ρ2)k1ρ3)V(\rho_{d,1}\rho^{\prime}_{d,3})\ =\ V(\rho^{\prime}_{1}(\rho^{\prime}_{2})^{k_{1}}\rho^{\prime}_{3}) (11)

From Equations 8 and 9 we get:

V(ρd,1ρd,2ρd,3)1V(ρd,1ρd,2ρd,3)=V(ρ1(ρ2)k1+k2ρ3)1V(ρ1(ρ2)k1+k2ρ3)V(\rho_{d,1}\rho_{d,2}\rho^{\prime}_{d,3})^{-1}\cdot V(\rho_{d,1}\rho_{d,2}\rho_{d,3})=V(\rho^{\prime}_{1}(\rho^{\prime}_{2})^{k_{1}+k_{2}}\rho^{\prime}_{3})^{-1}\cdot V(\rho_{1}(\rho_{2})^{k_{1}+k_{2}}\rho_{3}) (12)

which is equivalent to:

V(ρd,3)1V(ρd,3)=V(ρ1(ρ2)k1+k2ρ3)1V(ρ1(ρ2)k1+k2ρ3)V(\rho^{\prime}_{d,3})^{-1}\cdot V(\rho_{d,3})=V(\rho^{\prime}_{1}(\rho^{\prime}_{2})^{k_{1}+k_{2}}\rho^{\prime}_{3})^{-1}\cdot V(\rho_{1}(\rho_{2})^{k_{1}+k_{2}}\rho_{3}) (13)

Similarly from Equations 10 and 11 we get:

V(ρd,3)1V(ρd,3)=V(ρ1(ρ2)k1ρ3)1V(ρ1(ρ2)k1ρ3)V(\rho^{\prime}_{d,3})^{-1}\cdot V(\rho_{d,3})=V(\rho^{\prime}_{1}(\rho^{\prime}_{2})^{k_{1}}\rho^{\prime}_{3})^{-1}\cdot V(\rho_{1}(\rho_{2})^{k_{1}}\rho_{3}) (14)

From Equations 13 and 14 we get:

V(ρ1(ρ2)k1+k2ρ3)1V(ρ1(ρ2)k1+k2ρ3)=V(ρ1(ρ2)k1ρ3)1V(ρ1(ρ2)k1ρ3)V(\rho^{\prime}_{1}(\rho^{\prime}_{2})^{k_{1}+k_{2}}\rho^{\prime}_{3})^{-1}\cdot V(\rho_{1}(\rho_{2})^{k_{1}+k_{2}}\rho_{3})=V(\rho^{\prime}_{1}(\rho^{\prime}_{2})^{k_{1}}\rho^{\prime}_{3})^{-1}\cdot V(\rho_{1}(\rho_{2})^{k_{1}}\rho_{3}) (15)

By simplifying this expression we obtain:

V((ρ2)k2)1V(ρ1)1V(ρ1)V((ρ2)k2)=V(ρ1)1V(ρ1)V((\rho^{\prime}_{2})^{k_{2}})^{-1}\cdot V(\rho^{\prime}_{1})^{-1}\cdot V(\rho_{1})\cdot V((\rho_{2})^{k_{2}})=V(\rho^{\prime}_{1})^{-1}\cdot V(\rho_{1}) (16)

And therefore by multiplying by V((ρ2)k1)1V((\rho^{\prime}_{2})^{k_{1}})^{-1} to the left and by V((ρ2)k1)V((\rho_{2})^{k_{1}}) to the right, we obtain:

V((ρ2)k1+k2)1V(ρ1)1V(ρ1)V((ρ2)k1+k2)==V((ρ2)k1)1V(ρ1)1V(ρ1)V((ρ2)k1)\begin{array}[]{c}V((\rho^{\prime}_{2})^{k_{1}+k_{2}})^{-1}\cdot V(\rho^{\prime}_{1})^{-1}\cdot V(\rho_{1})\cdot V((\rho_{2})^{k_{1}+k_{2}})=\\ =V((\rho^{\prime}_{2})^{k_{1}})^{-1}\cdot V(\rho^{\prime}_{1})^{-1}\cdot V(\rho_{1})\cdot V((\rho_{2})^{k_{1}})\end{array} (17)

which can be rewritten as:

V(ρ1(ρ2)k1+k2)1V(ρ1(ρ2)k1+k2)=V(ρ1(ρ2)k1)1V(ρ1(ρ2)k1)V(\rho^{\prime}_{1}(\rho^{\prime}_{2})^{k_{1}+k_{2}})^{-1}\cdot V(\rho_{1}(\rho_{2})^{k_{1}+k_{2}})=V(\rho^{\prime}_{1}(\rho^{\prime}_{2})^{k_{1}})^{-1}\cdot V(\rho_{1}(\rho_{2})^{k_{1}}) (18)

which is equivalent to Δ(k1)=Δ(k1+k2)\Delta(k_{1})=\Delta(k_{1}+k_{2}). This contradicts our hypothesis.

Therefore, we obtain:

Theorem 28.

A functional infinitary group automaton is (effectively) determinizable iff it satisfies the twinning property. Determinizability is decidable in CoNP for functional infinitary group automata, and functional VV-automata, for V{𝖲𝗎𝗆,𝖠𝗏𝗀,𝖣𝗌𝗎𝗆}V\in\{{\sf Sum},{\sf Avg},{\sf Dsum}\}.

Proof 6.8.

It follows directly from Lemmas 22-27 and Lemma 3.

7. Conclusion

Decision Problems Sum/Avg-Automata Dsum-Automata Ratio-Automata
D F ND D F ND D F ND
functionality - - P - - P - - CoNP
>ν{>}\nu-emptiness P P P[11] P P P P P P
ν{\geq}\nu-emptiness P P P[11] ? PSpace[9] ? P P P
>ν{>}\nu-universality P P U[25, 1] ? PSpace[9] ? P P P
ν{\geq}\nu-universality P P U[25, 1] P P P P P P
inclusion ABA\leq B P PSpace-c U[25] P PSpace-c ? D D U
(AA arbitrary)
equivalence P PSpace-c U[25] P PSpace-c ? D D U
determinizability - CoNP ? - CoNP ? - ? ?
>ν{>}\nu-realizability NP\cap U U NP\cap ? ? NP\cap U U
CoNP CoNP CoNP
Table 1. Complexity results for classes of weighted automata. In this table, D stands for deterministic, F for functional and ND for non-deterministic. The symbol P stands PTime, U for undecidable, D for decidable and ? for open.

In this paper, we have introduced and studied classes of functional weighted automata, for four measures: sum, average, discounted sum and ratio. Our results are summarized in Table 1. Despite our efforts, some problems remain open.

The determinizability of (non-deterministic) Sum-automata is a long standing open problem [22, 1]. Another notorious open problem, the so-called target discounted-sum problem [9], underlies a number of open questions related to Dsum automata and games: namely, e.g. imperfect information Dsum-games [15], multi-objective Dsum-games [12], universality of Dsum-automata [10], as well as the realizability problem for Dsum-automata that we mention here. Another open problem, that we did not mention so far, is to decide whether a (non-deterministic) Sum-automaton is equivalent to some functional Sum-automaton. Solving this problem would solve the determinizability problem for non-deterministic Sum-automata, as the determinizability problem for functional Sum-automata is decidable. However, this problem does not seem to be simpler than the determinizability problem. Finally, we leave the determinizability problem for functional Ratio-automata as open: the techniques we developed in this paper toward determinization are based on the well-known notion of delay between runs. It is not clear what would be a suitable notion of delays for Ratio-automata.

Acknowledgement

We are very grateful to the anonymous referees for their valuable comments on preliminary versions of this paper.

References

  • [1] S. Almagor, U. Boker, and O. Kupferman. What’s decidable about weighted automata? In ATVA’11, pp 482–491. Springer, 2011.
  • [2] B. Aminof, O. Kupferman, and R. Lampert. Rigorous approximated determinization of weighted automata. In LICS, pp 345–354, 2011.
  • [3] D. Andersson. An improved algorithm for discounted payoff games. In ESSLLI Student Session, pp 91–98, 2006.
  • [4] M.-P. Beal, O. Carton, C. Prieur, and J. Sakarovitch. Squaring transducers: An efficient procedure for deciding functionality and sequentiality. TCS, 292, 2003.
  • [5] J. Berstel and C. Reutenauer. Rational Series and Their Languages. Number 12 in EATCS Monographs on TCS. Springer, 1988.
  • [6] M. Blattner and T. Head. Single-valued aa-transducers. JCSS, 15(3), pp 310–327, 1977.
  • [7] R. Bloem, K. Greimel, T. A. Henzinger, and B. Jobstmann. Synthesizing robust systems. In FMCAD, pp 85–92. IEEE, 2009.
  • [8] U. Boker, K. Chatterjee, T. A. Henzinger, and O. Kupferman. Temporal specifications with accumulative values. In LICS, pp 43–52, 2011.
  • [9] U. Boker, T. Henzinger and J. Otop. The Target Discount-Sum Problem. In LICS. To appear, 2015.
  • [10] U. Boker and T. A. Henzinger. Determinizing discounted-sum automata. In CSL, pp 82–96, 2011.
  • [11] K. Chatterjee, L. Doyen, and T. A. Henzinger. Quantitative languages. ACM Trans. Comput. Log, 11(4), 2010.
  • [12] K. Chatterjee, V. Forejt, and D. Wojtczak. Multi-objective Discounted Reward Verification in Graphs and MDPs. Logic for Programming, Artificial Intelligence, and Reasoning, LNCS 8312, 2013.
  • [13] C. Choffrut. Une caractérisation des fonctions séquentielles et des fonctions sous-séquentielles en tant que relations rationnelles. TCS, 5(3), pp 325–337, 1977.
  • [14] L. de Alfaro, M. Faella, T. A. Henzinger, R. Majumdar, and M. Stoelinga. Model checking discounted temporal properties. TCS, 345(1), pp 139–170, 2005.
  • [15] A. Degorre, L. Doyen, R. Gentilini, J-F. Raskin and S. Torunczyk Energy and Mean-Payoff Games with Imperfect Information. In CSL-2010, LNCS vol. 6247, pp 260-274, 2010.
  • [16] M. Droste, W. Kuich, and H. Vogler. Handbook of Weighted Automata. Springer, 2009.
  • [17] M. Droste and G. Rahonis. Weighted automata and weighted logics with discounting. In CIAA, pp 73–84, 2007.
  • [18] A. Ehrenfeucht and J. Mycielski. Positional strategies for mean payoff games. In International Journal of Game Theory, 8(2):109–113, 1979.
  • [19] E. Filiot, R. Gentilini and J-F. Raskin Quantitative languages defined by functional automata. In CONCUR-2012, LNCS vol. 7454, pp 132-146, 2012.
  • [20] F. Grunewald and D. Segal. On the integer solutions of quadratic equations. Journal für die reine und angewandte Mathematik, 569, pp 13–45, 2004.
  • [21] E. Gurari and O. Ibarra. A note on finitely-valued and finitely ambiguous transducers. Mathematical Systems Theory, 16(1):61–66, 1983.
  • [22] D. Kirsten. A burnside approach to the termination of mohri’s algorithm for polynomially ambiguous min-plus-automata. ITA, 42(3), pp 553–581, 2008.
  • [23] D. Kirsten and I. Mäurer. On the determinization of weighted automata. Journal of Automata, Languages and Combinatorics, 10(2/3), pp 287–312, 2005.
  • [24] I. Klimann, S. Lombardy, J. Mairesse, and C. Prieur. Deciding unambiguity and sequentiality from a finitely ambiguous max-plus automaton. TCS, 327(3), pp 349–373, 2004.
  • [25] D. Krob. The equality problem for rational series with multiplicities in the tropical semiring is undecidable. Journal of Algebra and Computation, 4(3), pp 405–425, 1994.
  • [26] D. Krob and P. Litp. Some consequences of a fatou property of the tropical semiring. J. Pure Appl. Algebra, 93, pp 231–249, 1994.
  • [27] S. Lombardy and J. Mairesse. Series which are both max-plus and min-plus rational are unambiguous. ITA, 40(1), pp 1–14, 2006.
  • [28] M. L. Minsky. Computation: Finite and Infinite Machines. Prentice-Hall, 1967.
  • [29] M. Mohri. Finite-State Transducers in Language and Speech Processing. Computational Linguistics, pp 269–311, 1997.
  • [30] M. Mohri. Weighted automata algorithms. Handbook of Weighted Automata, pp 213–254, 2009.
  • [31] R. J. Parikh On context-free languages. Journal of the ACM, 13 (4) (1966) 570–581.
  • [32] A. Pnueli and R. Rosner. On the synthesis of a reactive module. In ACM Symposium on Principles of Programming Languages (POPL). ACM, 1989.
  • [33] E. M. Schmidt and T. G. Szymanski. Succinctness of descriptions of unambiguous context-free languages. In SIAM Journal on Computing, 6(3), pp 547–553, 1977.
  • [34] M. P. Schützenberger. Sur les relations rationnelles. In Automata Theory and Formal Languages, vol 33 of LNCS, pp 209–213, 1975.
  • [35] W. Thomas. Church’s problem and a tour through automata theory. In Pillars of Computer Science, pp 635–655, 2008.
  • [36] A. Weber. On the valuedness of finite transducers. Acta Informatica, 27(8):749–780, 1989.
  • [37] A. Weber and R. Klemm. Economy of description for single-valued transducers. Inf. Comput., 118(2), pp 327–340, 1995.
  • [38] K. Wong, A. Krieg, and W. Thomas. On intersection problems for polynomially generated sets. In ICALP, vol 4052 of LNCS, pp 516–527. Springer, 2006.
  • [39] U. Zwick and M. Paterson. The complexity of mean payoff games on graphs. In Theoretical Computer Science, 158(1-2):343–359, 1996.