Comparator Automata in Quantitative Verification
Abstract
The notion of comparison between system runs is fundamental in formal verification. This concept is implicitly present in the verification of qualitative systems, and is more pronounced in the verification of quantitative systems. In this work, we identify a novel mode of comparison in quantitative systems: the online comparison of the aggregate values of two sequences of quantitative weights. This notion is embodied by comparator automata (comparators, in short), a new class of automata that read two infinite sequences of weights synchronously and relate their aggregate values.
We show that comparators that are finitestate and accept by the Büchi condition lead to generic algorithms for a number of wellstudied problems, including the quantitative inclusion and winning strategies in quantitative graph games with incomplete information, as well as related nondecision problems, such as obtaining a finite representation of all counterexamples in the quantitative inclusion problem.
We study comparators for two aggregate functions: discountedsum and limitaverage. We prove that the discountedsum comparator is \(\omega \)regular for all integral discount factors. Not every aggregate function, however, has an \(\omega \)regular comparator. Specifically, we show that the language of sequencepairs for which limitaverage aggregates exist is neither \(\omega \)regular nor \(\omega \)contextfree. Given this result, we introduce the notion of prefixaverage as a relaxation of limitaverage aggregation, and show that it admits \(\omega \)contextfree comparators.
1 Introduction
Many classic questions in formal methods can be seen as involving comparisons between different system runs or inputs. Consider the problem of verifying if a system S satisfies a lineartime temporal property P. Traditionally, this problem is phrased languagetheoretically: S and P are interpreted as sets of (infinite) words, and S is determined to satisfy P if \(S \subseteq P\). The problem, however, can also be framed in terms of a comparison between words in S and P. Suppose a word w is assigned a weight of 1 if it belongs to the language of the system or property, and 0 otherwise. Then determining if \(S \subseteq P\) amounts to checking whether the weight of every word in S is less than or equal to its weight in P [5].
The need for such a formulation is clearer in quantitative systems, in which every run of a word is associated with a sequence of (rationalvalued) weights. The weight of a run is given by aggregate function \(f: \mathbb {Q}^{\omega }\rightarrow \mathbb {R}\), which returns the realvalued aggregate value of the run’s weight sequence. The weight of a word is given by the supremum or infimum of the weight of all its runs. Common examples of aggregate functions include discountedsum and limitaverage.
In a wellstudied class of problems involving quantitative systems, the objective is to check if the aggregate value of words of a system exceed a constant threshold value [14, 15, 16]. This is a natural generalization of emptiness problems in qualitative systems. Known solutions to the problem involve arithmetic reasoning via linear programming and graph algorithms such as negativeweight cycle detection, computation of maximum weight of cycles etc. [4, 18].
A more general notion of comparison relates aggregate values of two weight sequences. Such a notion arises in the quantitative inclusion problem for weighted automata [1], where the goal is to determine whether the weight of words in one weighted automaton is less than that in another. Here it is necessary to compare the aggregate value along runs between the two automata. Approaches based on arithmetic reasoning do not, however, generalize to solving such problems. In fact, the known solution to discountedsum inclusion with integer discountfactor combines linear programming with a specialized subsetconstructionbased determinization step, rendering an EXPTIME algorithm [4, 6]. Yet, this approach does not match the PSPACE lower bound for discountedsum inclusion.
In this paper, we present an automatatheoretic formulation of this form of comparison between weighted sequences. Specifically, we introduce comparator automata (comparators, in short), a class of automata that read pairs of infinite weight sequences synchronously, and compare their aggregate values in an online manner. While comparisons between weight sequences happen implicitly in prior approaches to quantitative systems, comparator automata make these comparisons explicit. We show that this has many benefits, including generic algorithms for a large class of quantitative reasoning problems, as well as a direct solution to the problem of discountedsum inclusion that also closes its complexity gap.
A comparator for aggregate function f is an automaton that accepts a pair (A, B) of sequences of bounded rational numbers iff f(A) R f(B), where R is an inequality relation (>, <, \(\ge \), \(\le \)) or the equality relation. A comparator could be finitestate or (pushdown) infinitestate. This paper studies such comparators.
A comparator is \(\omega \)regular if it is finitestate and accepts by the Büchi condition. We show that \(\omega \)regular comparators lead to generic algorithms for a number of wellstudied problems including the quantitative inclusion problem, and in showing existence of winning strategies in incompleteinformation quantitative games. Our algorithm yields PSPACEcompleteness of quantitative inclusion when the \(\omega \)regular comparator is provided. The same algorithm extends to obtaining finitestate representations of counterexample words in inclusion.
Next, we show that the discountedsum aggregation function admits an \(\omega \)regular comparator when the discountfactor \(d>1\) is an integer. Using properties of \(\omega \)regular comparators, we conclude that the discountedsum inclusion is PSPACEcomplete, hence resolving the complexity gap. Furthermore, we prove that the discountedsum comparator for \(1<d<2\) cannot be \(\omega \)regular. We suspect this result extends to noninteger discountfactors as well.
Finally, we investigate the limitaverage comparator. Since limitaverage is only defined for sequences in which the average of prefixes converge, limitaverage comparison is not welldefined. We show that even a Büchi pushdown automaton cannot separate sequences for which limitaverage exists from those for which it does not. Hence, we introduce the novel notion of prefixaverage comparison as a relaxation of limitaverage comparison. We show that the prefixaverage comparator admits a comparator that is \(\omega \)contextfree, i.e., given by a Büchi pushdown automaton, and we discuss the utility of this characterization.
This paper is organized as follows: Preliminaries are given in Sect. 2. Comparator automata is formally defined in Sect. 3. Generic algorithms for \(\omega \)regular comparators are discussed in Sects. 3.1 and 3.2. The construction and properties of discountedsum comparator, and limitaverage and prefixaverage comparator are given in Sects. 4 and 5, respectively. We conclude with future directions in Sect. 6.
Related Work. The notion of comparison has been widely studied in quantitative settings. Here we mention only a few of them. Such aggregatefunction based notions appear in weighted automata [1, 17], quantitative games including meanpayoff and energy games [16], discountedpayoff games [3, 4], in systems regulating cost, memory consumption, power consumption, verification of quantitative temporal properties [14, 15], and others. Common solution approaches include graph algorithms such as weight of cycles or presence of cycle [18], linearprogrammingbased approaches, fixedpointbased approaches [8], and the like. The choice of approach for a problem typically depends on the underlying aggregate function. In contrast, in this work we present an automatatheoretic approach that unifies solution approaches to problems on different aggregate functions. We identify a class of aggregate functions, ones that have an \(\omega \)regular comparator, and present generic algorithms for some of these problems.
While work on finiterepresentations of counterexamples and witnesses in the qualitative setting is known [5], we are not aware of such work in the quantitative verification domain. This work can be interpreted as automatatheoretic arithmetic, which has been explored in regular real analysis [12].
2 Preliminaries
Definition 1
(Büchi automata [21]). A (finitestate) Büchi automaton is a tuple \(\mathcal {A}= ( S , \varSigma , \delta , { Init }, \mathcal {F})\), where \( S \) is a finite set of states, \( \varSigma \) is a finite input alphabet, \( \delta \subseteq ( S \times \varSigma \times S ) \) is the transition relation, \( { Init }\subseteq S \) is the set of initial states, and \( \mathcal {F}\subseteq S \) is the set of accepting states.
A Büchi automaton is deterministic if for all states s and inputs a, \(\{s'(s, a, s') \in \delta \text { for some}\, s' \} \le 1\) and \({ Init }=1\). Otherwise, it is nondeterministic. For a word \( w = w_0w_1\dots \in \varSigma ^{\omega } \), a run \( \rho \) of w is a sequence of states \(s_0s_1\dots \) s.t. \( s_0 \in { Init }\), and \( \tau _i =(s_i, w_i, s_{i+1}) \in \delta \) for all i. Let \( inf (\rho ) \) denote the set of states that occur infinitely often in run \({\rho }\). A run \(\rho \) is an accepting run if \( inf (\rho )\cap \mathcal {F}\ne \emptyset \). A word w is an accepting word if it has an accepting run. Büchi automata are known to be closed under settheoretic union, intersection, and complementation [21]. Languages accepted by these automata are called \(\omega \)regular languages.
Definition 2
(Weighted \(\omega \)automaton [10, 20]). A weighted \(\omega \)automaton over infinite words is a tuple \(\mathcal {A}= (\mathcal {M}, \gamma )\), where \(\mathcal {M} = ( S , \varSigma , \delta , { Init }, S ) \) is a Büchi automaton, and \(\gamma : \delta \rightarrow \mathbb {Q}\) is a weight function.
Words and runs in weighted \(\omega \)automata are defined as they are in Büchi automata. Note that all states are accepting states in this definition. The weight sequence of run \(\rho = s_0 s_1 \dots \) of word \(w = w_0w_1\dots \) is given by \(wt_{\rho } = n_0 n_1 n_2\dots \) where \(n_i = \gamma (s_i, w_i, s_{i+1})\) for all i. The weight of a run \(\rho \) is given by \(f(wt_{\rho })\), where \(f: \mathbb {Q}^{\omega } \rightarrow \mathbb {R}\) is an aggregate function. We use \(f(\rho )\) to denote \(f(wt_{\rho })\).
Here the weight of a word \(w \in \varSigma ^{\omega }\) in weighted \(\omega \)automata is defined as \(wt_{\mathcal {A}}(w) = sup \{f(\rho )  \rho \) is a run of w in \(\mathcal {A}\}\). It can also be defined as the infimum of the weight of all its runs. By convention, if word \(w\notin \mathcal {A}\), \(wt_{\mathcal {A}}(w)=0\) [10].
Definition 3
(Quantitative inclusion). Given two weighted \(\omega \)automata P and Q with aggregate function f, the quantitativeinclusion problem, denoted by \(P \subseteq _f Q\), asks whether for all words \(w \in \varSigma ^{\omega }\), \(wt_{P}(w) \le wt_{Q}(w)\).
Quantitative inclusion is PSPACEcomplete for limsup and liminf [10], and undecidable for limitaverage [16]. For discountedsum with integer discountfactor it is in EXPTIME [6, 10], and decidability is unknown for rational discountfactors
Definition 4
(Incompleteinformation quantitative games). An incompleteinformation quantitative game is a tuple \(\mathcal {G}= (S,s_{\mathcal {I}} , O , \varSigma , \delta , \gamma , f)\), where S, \( O \), \(\varSigma \) are sets of states, observations, and actions, respectively, \(s_{\mathcal {I}} \in S\) is the initial state, \(\delta \subseteq S \times \varSigma \times S\) is the transition relation, \(\gamma : S \rightarrow \mathbb {N}\times \mathbb {N}\) is the weight function, and \(f: \mathbb {N}^{\omega }\rightarrow \mathbb {R} \) is the aggregate function.
The transition relation \(\delta \) is complete, i.e., for all states p and actions a, there exists a state q s.t. \((p, a, q)\in \delta \). A play \(\rho \) is a sequence \(s_0a_0s_1a_1\dots \), where \(\tau _i=(s_i, a_i, s_{i+1}) \in \delta \). The observation of state s is denoted by \( O (s) \in O \). The observed play \(o_{\rho }\) of \(\rho \) is the sequence \(o_0a_0o_1aa_1\dots \), where \(o_i = O (s_i)\). Player \(P_0\) has incomplete information about the game \(\mathcal {G}\); it only perceives the observation play \(o_{\rho }\). Player \(P_1\) receives full information and witnesses play \(\rho \). Plays begin in the initial state \(s_0 = s_\mathcal {I}\). For \(i\ge 0\), Player \(P_0\) selects action \(a_i\). Next, player \(P_1\) selects the state \(s_{i+1}\), such that \((s_i, a_i, s_{i+1}) \in \delta \). The weight of state s is the pair of payoffs \(\gamma (s) = (\gamma (s)_0, \gamma (s)_1)\). The weight sequence \(wt_i\) of player \(P_i\) along \(\rho \) is given by \(\gamma (s_0)_i \gamma (s_1)_i \dots \), and its payoff from \(\rho \) is given by \(f(wt_i)\) for aggregate function f, denoted by \(f(\rho _i)\), for simplicity. A play on which a player receives a greater payoff is said to be a winning play for the player. A strategy for player \(P_0\) is given by a function \(\alpha : O ^* \rightarrow \varSigma \) since it only sees observations. Player \(P_0\) follows strategy \(\alpha \) if for all i, \(a_i = \alpha (o_0\dots o_i)\). A strategy \(\alpha \) is said to be a winning strategy for player \(P_0\) if all plays following \(\alpha \) are winning plays for \(P_0\).
Definition 5
(Büchi pushdown automata [13]). A Büchi pushdown automaton (Büchi PDA) is a tuple \(\mathcal {A}= ( S , \varSigma , \varGamma , \delta , { Init }, Z_0, \mathcal {F})\), where \( S \), \(\varSigma \), \(\varGamma \), and \(\mathcal {F}\) are finite sets of states, input alphabet, pushdown alphabet and accepting states, respectively. \( \delta \subseteq ( S \times \varGamma \times (\varSigma \cup \{\epsilon \}) \times S \times \varGamma ) \) is the transition relation, \( { Init }\subseteq S \) is a set of initial states, \(Z_0 \in \varGamma \) is the start symbol.
A run \(\rho \) on a word \( w = w_0 w_1\dots \in \varSigma ^{\omega } \) of a Büchi PDA \(\mathcal {A}\) is a sequence of configurations \((s_0,\gamma _0),(s_1,\gamma _1)\dots \) satisfying (1) \( s_0 \in { Init }\), \(\gamma _0 = Z_0\), and (2) (\(s_i, \gamma _i, w_i, s_{i+1}, \gamma _{i+1}) \in \delta \) for all i. Büchi PDA consists of a stack, elements of which are the tokens \(\varGamma \), and initial element \(Z_0\). Transitions push or pop token(s) to/from the top of the stack. Let \( inf (\rho ) \) be the set of states that occur infinitely often in state sequence \(s_0s_1\dots \) of run \(\rho \). A run \(\rho \) is an accepting run in Büchi PDA if \( inf (\rho )\cap \mathcal {F}\ne \emptyset \). A word w is an accepting word if it has an accepting run. Languages accepted by Büchi PDA are called \(\omega \)contextfree languages (\(\omega \)CFL).
We introduce some notation. For an infinite sequence \(A = (a_0, a_1, \dots )\), A[i] denotes its ith element. Abusing notation, we write \( w \in \mathcal {A}\) and \(\rho \in \mathcal {A}\) if w and \(\rho \) are an accepting word and an accepting run of \(\mathcal {A}\) respectively.
For missing proofs and constructions, refer to the supplementary material.
3 Comparator Automata
Comparator automata (often abbreviated as comparators) are a class of automata that can read pairs of weight sequences synchronously and establish an equality or inequality relationship between these sequences. Formally, we define:
Definition 6
(Comparator automata). Let \(\varSigma \) be a finite set of rational numbers, and \(f:\mathbb {Q}^{\omega }\rightarrow \mathbb {R}\) denote an aggregate function. A comparator automaton for aggregate function f is an automaton over the alphabet \(\varSigma \times \varSigma \) that accepts a pair (A, B) of (infinite) weight sequences iff f(A) R f(B), where R is an inequality or the equality relation.
We explain comparators through an example. The limit supremum (limsup, in short) of a bounded, integer sequence A, denoted by \( \mathsf {LimSup(A)}\), is the largest integer that appears infinitely often in A. The limsup comparator is a Büchi automaton that accepts the pair (A, B) of sequences iff \(\mathsf {LimSup(A)}\ge \mathsf {LimSup(B)} \).
The working of the limsup comparator is based on nondeterministically guessing the limsup of sequences A and B, and then verifying that \(\mathsf {LimSup(A)}\ge \mathsf {LimSup(B)}\). Büchi automaton \(\mathcal {A}_k\) (Fig. 1) illustrates the basic building block of the limsup comparator. Automaton \(\mathcal {A}_k\) accepts pair (A, B) of number sequences iff \(\mathsf {LimSup(A)} = k\), and \(\mathsf {LimSup(B)}\le k\), for integer k. To see why this is true, first note that all incoming edges to accepting state \(f_k\) occur on alphabet \((k,\le k)\) while all transitions between states \(f_k\) and \(s_k\) occur on alphabet \((\le k, \le k)\), where \(\le k\) denotes the set \(\{0,1,\dots k\}\). So, the integer k must appear infinitely often in A and all elements occurring infinitely often in A and B are less than or equal to k. Together these ensure that \(\mathsf {LimSup(A)} =k\), and \(\mathsf {LimSup(B)} \le k\). The union of such automata \(\mathcal {A}_k\) for \(k \in \{0,1,\dots \mu \}\) for upper bound \(\mu \), results in the limsup comparator. The limit infimum (liminf, in short) of an integer sequence is the smallest integer that appears infinitely often in it; its comparator is similar.
Motivating Example. Let weighted \(\omega \)automata P and Q be as illustrated in Figs. 2 and 3. The word \(w = a(ab)^{\omega }\) has two runs \(\rho _1^P= q_1 (q_2)^{\omega }\), \(\rho _2^P = q_1 (q_3)^{\omega }\) in P, and four runs \(\rho _1^Q = q_1 (q_2)^{\omega }\), \(\rho _2^Q = q_1 (q_3)^{\omega }\), \(\rho _3^Q=q_1 q_1 (q_2)^{\omega }\) \(\rho _4^Q=q_1 q_1 (q_3)^{\omega }\) in Q. Their weightsequences are \(wt_1^P = 3,(0,1)^{\omega }\), \(wt_2^P = 2,(2,0)^{\omega }\) in P, and \(wt_1^Q = (2,1)^{\omega }\), \(wt_2^Q = (0, 2)^{\omega }\), \(wt_3^Q = 1,2,(2,1)^{\omega }\), \(wt_4^Q = 1, 0, (0, 2)^{\omega }\) in Q.
To determine if w has greater weight in P or in Q, compare aggregate value of weightsequences of runs in P and Q. Take the comparator for aggregate function f that accepts a pair (A, B) of weightsequence iff \(f(A) \le f(B)\). For \(wt_P(w) \le wt_Q(w)\), for every run \(\rho _i^P\) in P, there exists a run \(\rho _j^Q\) in Q s.t. \((\rho _i^P, \rho _j^Q)\) is accepted by the comparator. This forms the basis for quantitative inclusion.
3.1 Quantitative Inclusion
\(\mathsf {InclusionReg}\) (Algorithm 1) is an algorithm for quantitative inclusion for \(\omega \)regular aggregate functions. For weighted \(\omega \)automata P, Q, and \(\omega \)regular comparator \(\mathcal {A}_f\), \(\mathsf {InclusionReg}\) returns \(\mathsf {True}\) iff \(P \subseteq _f Q\). We assume \(P \subseteq Q\) (qualitative inclusion) to avoid trivial corner cases.
Key Ideas. \(P \subseteq _f Q\) holds if for every run \(\rho _P\) in P on word w, there exists a run \(\rho _Q\) in Q on the same word w such that \(f(\rho _P)\le f(\rho _Q)\). We refer to such runs of P by diminished run. Hence, \(P \subseteq _f Q\) iff all runs of P are diminished.
Algorithm Details. \(\mathsf {InclusionReg}\) has three steps: (a). \(\mathsf {UniqueId}\) (Lines 3–4): Enables unique identification of runs in P and Q through labels. (b). \(\mathsf {Compare}\) (Lines 5–7): Compares weight of runs in P with weight of runs in Q, and constructs \( Dim \). (c). \(\mathsf {DimEnsure}\) (Line 8): Ensures if all runs of P are diminished.
 1.
\(\mathsf {UniqueId}\): \(\mathsf {AugmentWtAndLabel}\) transforms weighted \(\omega \)automaton \(\mathcal {A}\) into Büchi automaton \(\hat{\mathcal {A}}\) by converting transition \(\tau = (s, a, t )\) with weight \(\gamma (\tau )\) in \( \mathcal {A}\) to transition \(\hat{\tau } = (s, (a, \gamma (\tau ), l), t)\) in \(\hat{\mathcal {A}}\), where l is a unique label assigned to transition \(\tau \). The word \(\hat{\rho } = (a_0,n_0,l_0)(a_1,n_1,l_1)\dots \in \hat{A}\) iff run \(\rho \in \mathcal {A}\) on word \(a_0a_1\dots \) with weight sequence \(n_0n_1\dots \). Labels ensure bijection between runs in \(\mathcal {A}\) and words in \(\hat{\mathcal {A}}\). Words of \(\hat{A}\) have a single run in \(\hat{A}\).
Hence, transformation of weighted \(\omega \)automata P and Q to Büchi automata \(\hat{P}\) and \(\hat{Q}\) enables disambiguation between runs of P and Q (Line 3–4).
 2.
\(\mathsf {Compare}\): The output of this step is the Büchi automaton \( Dim \), that contains the word \({\hat{\rho }}\in \hat{P}\) iff \(\rho \) is a diminished run in P (Lines 5–7).
\(\mathsf {MakeProduct}(\hat{P}, \hat{Q})\) constructs \(\hat{P}\times \hat{Q}\) s.t. word \((\hat{\rho _P}, \hat{\rho _Q}) \in \hat{P}\times \hat{Q}\) iff \(\rho _P\) and \(\rho _Q\) are runs of the same word in P and Q respectively (Line 5). Concretely, for transition \(\hat{\tau _\mathcal {A}}=(s_\mathcal {A},(a, n_\mathcal {A}, l_\mathcal {A}),t_\mathcal {A})\) in automaton \(\mathcal {A}\), where \(\mathcal {A}\in \{\hat{P}, \hat{Q}\}\), transition \(\hat{\tau _P}\times \hat{\tau _Q}=((s_P, s_Q),(a, n_P, l_P, n_Q, l_Q),(t_P, t_Q))\) is in \( \hat{P}\times \hat{Q}\).
\(\mathsf {Intersect}\) intersects the weight components of \(\hat{P}\times \hat{Q}\) with comparator \(\mathcal {A}_f\) (Line 6). The resulting automaton \( DimProof \) accepts word \((\hat{\rho _P}, \hat{\rho _Q})\) iff \(f(\rho _P)\le f(\rho _Q)\), and \(\rho _P\) and \(\rho _Q\) are runs on the same word in P and Q respectively. The projection of \( DimProof \) on the words of \(\hat{P}\) returns \( Dim \) which contains the word \(\hat{\rho _P}\) iff \(\rho _P\) is a diminished run in P (Line 7).
 3.
\(\mathsf {DimEnsure}\): \(P\subseteq _f Q\) iff \(\hat{P} \equiv Dim \) (qualitative equivalence) since \(\hat{P}\) consists of all runs of P and \( Dim \) consists of all diminished runs of P (Line 8).
Lemma 1
Given weighted \(\omega \)automata P and Q with an \(\omega \)regular aggregate function f. \(\mathsf {InclusionReg}(P,Q,\mathcal {A}_f)\) returns \(\mathsf {True}\) iff \(P \subseteq _f Q\).
Further, \(\mathsf {InclusionReg}\) is adapted for quantitative strictinclusion \(P\subset _f Q\) i.e. for all words w, \(wt_P(w) < wt_Q(w)\) by taking the \(\omega \)regular comparator \(\mathcal {A}_f\) that accepts (A, B) iff \(f(A) < f(B)\). Similarly for quantitative equivalence \(P \equiv _f Q\).
Complexity Analysis. All operations in \(\mathsf {InclusionReg}\) until Line 7 are polytime operations in the size of weighted \(\omega \)automata P, Q and comparator \(\mathcal {A}_f\). Hence, \( Dim \) is polynomial in size of P, Q and \(\mathcal {A}_f\). Line 8 solves a \(\mathsf {PSPACE}\)complete problem. Therefore, the quantitative inclusion for \(\omega \)regular aggregate function f is in \(\mathsf {PSPACE}\) in size of the inputs P, Q, and \(\mathcal {A}_f\).
The \(\mathsf {PSPACE}\)hardness of the quantitative inclusion is established via reduction from the qualitative inclusion problem, which is \(\mathsf {PSPACE}\)complete. The formal reduction is as follows: Let P and Q be Büchi automata (with all states as accepting states). Reduce P, Q to weighted automata \(\overline{P}\), \(\overline{Q}\) by assigning a weight of 1 to each transition. Since all runs in \(\overline{P}\), \(\overline{Q}\) have the same weight sequence, weight of all words in \(\overline{P}\) and \(\overline{Q}\) is the same for any function f. It is easy to see \(P \subseteq Q\) (qualitative inclusion) iff \(\overline{P} \subseteq _f \overline{Q}\) (quantitative inclusion).
Theorem 1
Let P and Q be weighted \(\omega \)automata and \(\mathcal {A}_f\) be an \(\omega \)regular comparator. The complexity of the quantitative inclusion problem, quantitative strictinclusion problem, and quantitative equivalence problem for \(\omega \)regular aggregate function f is \(\mathsf {PSPACE}\)complete.
Theorem 1 extends to weighted \(\omega \)automata when weight of words is the infimum of weight of runs. The key idea for \(P\subseteq _f Q\) here is to ensure that for every run \(\rho _Q\) in Q there exists a run on the same word in \(\rho _P\) in P s.t. \(f(\rho _P)\le f(\rho _Q)\).
Representation of Counterexamples. When \(P \nsubseteq _f Q\), there exists word(s) \(w \in \varSigma ^*\) s.t \(wt_P(w)>wt_Q(w)\). Such a word w is said to be a counterexample word. Previously, finitestate representations of counterexamples have been useful in verification and synthesis in qualitative systems [5], and could be useful in quantitative settings as well. However, we are not aware of procedures for such representations in the quantitative settings. Here we show that a trivial extension of \(\mathsf {InclusionReg}\) yields Büchi automatarepresentations for all counterexamples of the quantitative inclusion problem for \(\omega \)regular functions.
For word w to be a counterexample, it must contain a run in P that is not diminished. Clearly, all nondiminished runs of P are members of \(\hat{P}\setminus Dim \). The counterexamples words can be obtained from \(\hat{P}\setminus Dim \) by modifying its alphabet to the alphabet of P by dropping transition weights and their unique labels.
Theorem 2
All counterexamples of the quantitative inclusion problem for an \(\omega \)regular aggregate function can be expressed by a Büchi automaton.
3.2 IncompleteInformation Quantitative Games
Given an incompleteinformation quantitative game \(\mathcal {G}= (S,s_ {\mathcal {I}}, O , \varSigma , \delta , \gamma , f)\), our objective is to determine if player \(P_0\) has a winning strategy \( \alpha : O ^* \rightarrow \varSigma \) for \(\omega \)regular aggregate function f. We assume we are given the \(\omega \)regular comparator \(\mathcal {A}_f\) for function f. Note that a function \(A^*\rightarrow B\) can be treated like a Blabeled Atree, and viceversa. Hence, we proceed by finding a \(\varSigma \)labeled \( O \)tree – the winning strategy tree. Every branch of a winning strategytree is an observed play \(o_{\rho }\) of \(\mathcal {G}\) for which every actual play \(\rho \) is a winning play for \(P_0\).
We first consider all game trees of \(\mathcal {G}\) by interpreting \(\mathcal {G}\) as a treeautomaton over \(\varSigma \)labeled Strees. Nodes \(n \in S^*\) of the gametree correspond to states in S and labeled by actions in \(\varSigma \) taken by player \(P_0\). Thus, the root node \(\varepsilon \) corresponds to \(s_\mathcal {I}\), and a node \(s_{i_0},\ldots ,s_{i_k}\) corresponds to the state \(s_{i_k}\) reached via \(s_{\mathcal {I}},s_{i_0},\ldots ,s_{i_{k1}}\). Consider now a node x corresponding to state s and labeled by an action \(\sigma \). Then x has children \(x s_1,\ldots x s_n\), for every \(s_i \in S\). If \(s_i\in \delta (s,\sigma )\), then we call \(x s_i\) a valid child, otherwise we call it an invalid child. Branches that contain invalid children correspond to invalid plays.
A gametree \(\tau \) is a winning tree for player \(P_0\) if every branch of \(\tau \) is either a winning play for \(P_0\) or an invalid play of \(\mathcal {G}\). One can check, using an automata, if a play is invalid by the presence of invalid children. Furthermore, the winning condition for \(P_0\) can be expressed by the \(\omega \)regular comparator \(\mathcal {A}_f\) that accepts (A, B) iff \(f(A) > f(B)\). To use the comparator \( \mathcal {A}_f\), it is determinized to parity automaton \(D_f\). Thus, a product of game \(\mathcal {G}\) with \(D_f\) is a deterministic parity treeautomaton accepting precisely winningtrees for player \(P_0\).
Winning trees for player \(P_0\) are \(\varSigma \)labeled Strees. We need to convert them to \(\varSigma \)labeled \( O \)trees. Recall that every state has a unique observation. We can simulate these \(\varSigma \)labeled Strees on strategy trees using the technique of thinning states S to observations \( O \) [19]. The resulting alternating parity tree automaton \(\mathcal {M}\) will accept a \(\varSigma \)labeled \( O \)tree \(\tau _o\) iff for all actual gametree \(\tau \) of \(\tau _o\), \(\tau \) is a winningtree for \(P_0\) with respect to the strategy \(\tau _o\). The problem of existence of winningstrategy for \(P_0\) is then reduced to nonemptiness checking of \(\mathcal {M}\).
Theorem 3
Given an incompleteinformation quantitative game \(\mathcal {G}\) and \(\omega \)regular comparator \(\mathcal {A}_f\) for the aggregate function f, the complexity of determining whether \(P_0\) has a winning strategy is exponential in \({\mathcal {G} \cdot D_f} \), where \(D_f = \mathcal {A}_f^{O(\mathcal {A}_f)}\).
Since, \(D_f\) is the deterministic parity automaton equivalent to \(A_f, D_f= \mathcal {A}_f^{O(\mathcal {A}_f)}\). The thinning operation is linear in size of \(\mathcal {G}\times D_f\), therefore \(\mathcal {M} = \mathcal {G}\cdot  D_f\). Nonemptiness checking of alternating parity tree automata is exponential. Therefore, our procedure is doubly exponential in size of the comparator and exponential in size of the game. The question of tighter bounds is open.
4 DiscountedSum Comparator
The discountedsum of an infinite sequence A with discountfactor \(d >1\), denoted by \( DS ({A}, {d})\), is defined as \(\varSigma _{i=0}^{\infty } A[i] / d^{i}\). The discountedsum comparator (DScomparator, in short) for discountfactor d, denoted by \( \mathcal {A}_{\succ _{DS(d)}}\), accepts a pair (A, B) of weight sequences iff \( DS ({A}, {d}) < DS ({B}, {d}) \). We investigate properties of the DScomparator, and show that the DScomparator is \(\omega \)regular for all integral discountfactors d, and cannot be \(\omega \)regular when \(1<d<2\).
Theorem 4
DScomparator for rational discountfactor \(1< d<2\) is not \(\omega \)regular.
For discountedsum automaton \(\mathcal {A}\) with discount factor d, the cutpoint language of \(\mathcal {A}\) w.r.t. \(r \in \mathbb {R}\) is defined as \(L^{\ge r} = \{w \in L(\mathcal {A})  DS(w, d) \ge r \}\). It is known that the cutpoint language \(L^{\ge 1}\) with discountfactor \(1< d < 2\) is not \(\omega \)regular [9]. One can show that if DScomparator for discountfactor \(1<d<2\) were \(\omega \)regular, then cutpoint language \(L^{\ge 1}\) is also \(\omega \)regular; thus proving Theorem 4.
We provide the construction of DScomparator with integer discountfactor.
Key Ideas. The core intuition is that sequences bounded by \(\mu \) can be converted to their value in base d via a finitestate transducer. Lexicographic comparison of the resulting sequences renders the desired result. Conversion of sequences to base d requires a certain amount of bookkeeping by the transducer. Here we describe a direct method for bookkeeping and lexicographic comparison.
For naturalnumber sequence A and integer discountfactor \(d>1\), \( DS ({A}, {d})\) can be interpreted as a value in base d i.e. \( DS ({A}, {d}) = A[0] + \frac{A[1]}{d} + \frac{A[2]}{d^2} + \dots = (A[0].A[1]A[2]\dots )_d\) [12]. Unlike comparison of numbers in base d, the lexicographically larger sequence may not be larger in value. This occurs because (i) The elements of weight sequences may be larger in value than base d, and (ii) Every value has multiple infinitesequence representations.
To overcome these challenges, we resort to arithmetic techniques in base d. Note that \( DS ({B}, {d}) > DS ({A}, {d}) \) iff there exists a sequence C such that \( DS ({B}, {d}) = DS ({A}, {d}) + DS ({C}, {d}) \), and \( DS ({C}, {d}) > 0\). Therefore, to compare the discountedsum of A and B, we obtain a sequence C. Arithmetic in base d also results in sequence X of carry elements. Then, we see:
Lemma 2
 1.
When \( i = 0 \), \( A[0] + C[0] + X[0] = B[0]\)
 2.
When \( i\ge 1 \), \(A[i] + C[i] + X[i] = B[i] + d \cdot X[i1]\)
Then \( DS ({B}, {d}) = DS ({A}, {d}) + DS ({C}, {d})\).
Hence, to determine \( DS ({B}, {d}) DS ({A}, {d})\), systematically guess sequences C and X using the equations, elementbyelement beginning with the 0th index and moving rightwards. There are two crucial observations here: (i) Computation of ith element of C and X only depends on ith and \((i1)\)th elements of A and B. Therefore guessing C[i] and X[i] requires finite memory only. (ii) C refers to a representation of value \( DS ({B}, {d})  DS ({A}, {d})\) in base d, and X is the carrysequence. Hence if A and B are boundedinteger sequences, not only are X and C bounded sequences, they can be constructed from a fixed finite set of integers:
Lemma 3
 1.
For all \(i \ge 0\), \(0 \le C[i] \le \mu \cdot \frac{d}{d1}\). and
 2.
For all \(i \ge 0\), \(0 \le X[i] \le 1 + \frac{\mu }{d1}\)
In Büchi automaton \(\mathcal {A}_{\succ _{DS(d)}} \) (i) states are represented by (x, c) where x and c range over all possible elements of X and C, which are finite, (ii) a special start state s, (iii) transitions from the start state (s, (a, b), (x, c)) satisfy \(a+c+x = b\) to replicate Eq. 1 (Lemma 2) at the 0th index, (iv) all other transitions \(((x_1, c_1), (a,b), (x_2, c_2))\) satisfy \(a+ c_2 + x_2 = b + d\cdot x_1\) to replicate Eq. 2 (Lemma 2) at indexes \(i>0\), and (v) all (x, c) states are accepting. Lemma 2 ensures that \(\mathcal {A}_{\succ _{DS(d)}} \) accepts (A, B) iff \( DS ({B}, {d}) = DS ({A}, {d}) + DS ({C}, {d})\).
However, \(\mathcal {A}_{\succ _{DS(d)}} \) is yet to guarantee \( DS ({C}, {d}) > 0\). For this, we include nonaccepting states \((x,\bot )\), where x ranges over all possible (finite) elements of X. Transitions into and out of states \((x, \bot )\) satisfy Eqs. 1 or 2 (depending on whether transition is from start state s) where \(\bot \) is treated as \(c = 0\). Transition from \((x,\bot )\)states to (x, c)states occurs only if \(c >0\). Hence, any valid execution of (A, B) will be an accepting run only if the execution witnesses a nonzero value of c. Since C is a nonnegative sequence, this ensures \( DS ({C}, {d})>0\).

\( S = { Init }\cup \mathcal {F}\cup S_{\bot } \) where
\( { Init }= \{s\} \), \(\mathcal {F}= \{(x,c) x \le \mu _X, 0 \le c \le \mu _C\} \), and
\(S_{\bot } = \{(x, \bot )   x \le \mu _X\}\) where \(\bot \) is a special character, and \( c \in \mathbb {N}\), \(x \in \mathbb {Z}\).

\( \varSigma = \{(a,b) : 0 \le a, b \le \mu \} \) where a and b are integers.
 \(\delta _d \subset S \times \varSigma \times S \) is defined as follows:
 1.Transitions from start state s:
 i
(s, (a, b), (x, c)) for all \( (x,c) \in \mathcal {F}\) s.t. \( a + x + c = b \) and \( c \ne 0 \)
 ii
\( (s ,(a,b), (x, \bot )) \) for all \( (x, \bot ) \in S_{\bot } \) s.t. \( a + x = b \)
 i
 2.
Transitions within \( S_{\bot } \): \( ((x, \bot ) ,(a,b), (x', \bot ) )\) for all \((x, \bot )\), \((x', \bot ) \in S_{\bot } \), if \( a + x' = b + d\cdot x \)
 3.
Transitions within \( \mathcal {F}\): \( ((x,c) ,(a,b), (x',c') )\) for all (x, c), \((x',c') \in \mathcal {F}\) where \( c' < d \), if \( a + x' + c' = b + d\cdot x \)
 4.
Transition between \( S_{\bot } \) and \( \mathcal {F}\): \( ((x, \bot ),(a,b), (x',c')) \) for all \( (x,\bot ) \in S_{\bot } \), \( (x',c') \in \mathcal {F}\) where \( 0< c' < d \), if \( a + x' + c' = b + d\cdot x \)
 1.
Theorem 5
The DScomparator with maximum bound \(\mu \), is \(\omega \)regular for integer discountfactors \(d >1\). Size of the discountedsum comparator is \(\mathcal {O}(\frac{\mu ^2}{d})\).
DScomparator with nonstrict inequality \(\le \) and equality \(=\) follow similarly. Consequently, properties of \(\omega \)regular comparators hold for DScomparator with integer discountfactor. Specifically, DSinclusion is \(\mathsf {PSPACE}\)complete in size of the input weighted automata and DScomparator. Since, size of DScomparator is polynomial w.r.t. to upper bound \(\mu \) (in unary), DSinclusion is \(\mathsf {PSPACE}\) in size of input weighted automata and \(\mu \). Not only does this bound improve upon the previously known upper bound of \(\mathsf {EXPTIME}\) but it also closes the gap between upper and lower bounds for DSinclusion.
Corollary 1
Given weighted automata P and Q, maximum weight on their transitions \(\mu \) in unary form and integer discountfactor \(d > 1\), the DSinclusion, DSstrictinclusion, and DSequivalence problems are \(\mathsf {PSPACE}\)complete.
As mentioned earlier, the known upper bound for discountedsum inclusion with integer discountfactor is exponential [6, 10]. This bound is based on an exponential determinization construction (subset construction) combined with arithmetical reasoning. We observe that the determinization construction can be performed onthefly in \(\mathsf {PSPACE}\). To perform, however, the arithmetical reasoning onthefly in PSPACE would require essentially using the same bitlevel ((x, c)state) techniques that we have used to construct DScomparator automata.
5 LimitAverage Comparator
The limitaverage of an infinite sequence M is the point of convergence of the average of prefixes of M. Let \(\mathsf {Sum}(M[0,n1])\) denote the sum of the nlength prefix of sequence M. The limitaverage infimum, denoted by \(\mathsf {LimInfAvg}(M)\), is defined as \(\text {lim inf}_{n \rightarrow \infty } \frac{1}{n}\cdot \mathsf {Sum}(M[0,n1])\). Similarly, the limitaverage supremum, denoted by \(\mathsf {LimSupAvg}(M)\), is defined as \(\text {lim sup}_{n \rightarrow \infty } \frac{1}{n}\cdot \mathsf {Sum}(M[0,n1])\). The limitaverage of sequence M, denoted by \(\mathsf {LimAvg}(M)\), is defined only if the limitaverage infimum and limitaverage supremum coincide, and then \(\mathsf {LimAvg}(M) = \mathsf {LimInfAvg}(M)\) (\(=\mathsf {LimSupAvg}(M)\)). Note that while limitaverage infimum and supremum exist for all bounded sequences, the limitaverage may not.
In existing work, limitaverage is defined as the limitaverage infimum (or limitaverage supremum) to ensure that limitaverage exists for all sequences [7, 10, 11, 22]. While this definition is justified in context of the application, it may lead to a misleading comparison in some cases. For example, consider sequence A s.t. \(\mathsf {LimSupAvg}(A) = 2\) and \(\mathsf {LimInfAvg}(A) = 0\), and sequence B s.t. \(\mathsf {LimAvg}(B) = 1\). Clearly, limitaverage of A does not exist. Suppose, \(\mathsf {LimAvg}(A)=\mathsf {LimInfAvg}(A) = 0\), then \(\mathsf {LimAvg}(A) < \mathsf {LimAvg}(B)\), deluding that average of prefixes of A are always less than those of B in the limit. This is untrue since \(\mathsf {LimSupAvg}(A) = 2 \).
Such inaccuracies in limitaverage comparison may occur when the limitaverage of at least one sequence does not exist. However, it is not easy to distinguish sequences for which limitaverage exists from those for which it doesn’t.
We define prefixaverage comparison as a relaxation of limitaverage comparison. Prefixaverage comparison coincides with limitaverage comparison when limitaverage exists for both sequences. Otherwise, it determines whether eventually the average of prefixes of one sequence are greater than those of the other. This comparison does not require the limitaverage to exist to return intuitive results. Further, we show that the prefixaverage comparator is \(\omega \)contextfree.
5.1 LimitAverage Language and Comparison
Let \(\varSigma = \{0,1,\dots , \mu \}\) be a finite alphabet with \(\mu >0\). The limitaverage language \(\mathcal {L}_{LA}\) contains the sequence (word) \(A \in \varSigma ^{\omega }\) iff its limitaverage exists. Suppose \(\mathcal {L}_{LA}\) were \(\omega \)regular, then \(\mathcal {L}_{LA} = \bigcup _{i=0}^n U_i\cdot V_i^{\omega }\), where \(U_i, V_i\subseteq \varSigma ^*\) are regular languages over finite words. The limitaverage of sequences is determined by its behavior in the limit, so limitaverage of sequences in \(V_i^{\omega }\) exists. Additionally, the average of all (finite) words in \(V_i\) must be the same. If this were not the case, then two words in \(V_i\) with unequal averages \(l_1\) and \(l_2\), can generate a word \(w \in V_i^{\omega }\) s.t the average of its prefixes oscillates between \(l_1\) and \(l_2\). This cannot occur, since limitaverage of w exists. Let the average of sequences in \(V_i\) be \(a_i\), then limitaverage of sequences in \(V_i^{\omega }\) and \(U_i \cdot V_i^{\omega }\) is also \(a_i\). This is contradictory since there are sequences with limitaverage different from the \(a_i\) (see appendix). Similarly, since every \(\omega \)CFL is represented by \(\bigcup _{i=1}^n U_i \cdot V_i^{\omega }\) for CFLs \(U_i, V_i\) over finite words [13], a similar argument proves that \(\mathcal {L}_{LA}\) is not \(\omega \)contextfree.
Quantifiers \(\exists ^{\infty }i\) and \(\exists ^{f}i\) denote the existence of infinitely many and only finitely many indices i, respectively.
Theorem 6
\(\mathcal {L}_{LA}\) is neither an \(\omega \)regular nor an \(\omega \)contextfree language.
In the next section, we will define prefixaverage comparison as a relaxation of limitaverage comparison. To show how prefixaverage comparison relates to limitaverage comparison, we will require the following two lemmas:
Lemma 4
Let A and B be sequences s.t. their limit average exists. If \(\exists ^{\infty }i, \mathsf {Sum}(A[0,i1]) \ge \mathsf {Sum}(B[0,i1])\) then \(\mathsf {LimAvg}(A) \ge \mathsf {LimAvg}(B)\).
Lemma 5
Let A, B be sequences s.t their limitaverage exists. If \(\mathsf {LimAvg}(A) > \mathsf {LimAvg}(B)\) then \(\exists ^{f} i, \mathsf {Sum}(B[0,i1]) \ge \mathsf {Sum}(A[0,i1])\) and \(\exists ^{\infty } i, \mathsf {Sum}(A[0,i1]) > \mathsf {Sum}(B[0,i1])\).
5.2 PrefixAverage Comparison and Comparator
The previous section relates limitaverage comparison with the sums of equal length prefixes of the sequences (Lemmas 4 and 5). The comparison criteria is based on the number of times sum of prefix of one sequence is greater than the other, which does not rely on the existence of limitaverage. Unfortunately, this criteria cannot be used for limitaverage comparison since it is incomplete (Lemma 5). Specifically, for sequences A and B with equal limitaverage it is possible that \(\exists ^{\infty } i, \mathsf {Sum}(A[0,n1]) > \mathsf {Sum}(B[0,n1])\) and \(\exists ^{\infty } i, \mathsf {Sum}(B[0,n1]) > \mathsf {Sum}(A[0,n1])\). Instead, we use this criteria to define prefixaverage comparison. In this section, we define prefixaverage comparison and explain how it relaxes limitaverage comparison. Lastly, we construct the prefixaverage comparator, and prove that it is not \(\omega \)regular but is \(\omega \)contextfree.
Definition 7
(Prefixaverage comparison). Let A and B be number sequences. We say \(\mathsf {PrefixAvg}(A) \ge \mathsf {PrefixAvg}(B)\) if \(\exists ^{f} i, \mathsf {Sum}(B[0,i1]) \ge \mathsf {Sum}(A[0,i1])\) and \(\exists ^{\infty } i, \mathsf {Sum}(A[0,i1]) > \mathsf {Sum}(B[0,i1])\).
Intuitively, prefixaverage comparison states that \(\mathsf {PrefixAvg}(A)\ge \mathsf {PrefixAvg}(B)\) if eventually the sum of prefixes of A are always greater than those of B. We use \(\ge \) since the average of prefixes may be equal when the difference between the sum is small. It coincides with limitaverage comparison when the limitaverage exists for both sequences. Definition 7 and Lemmas 4, 5 relate limitaverage comparison and prefixaverage comparison:
Corollary 2

\(\mathsf {PrefixAvg}(A)\ge \mathsf {PrefixAvg}(B) \implies \mathsf {LimAvg}(A)\ge \mathsf {LimAvg}(B)\).

\(\mathsf {LimAvg}(A)>\mathsf {LimAvg}(B) \implies \mathsf {PrefixAvg}(A)\ge \mathsf {PrefixAvg}(B)\).
Therefore, limitaverage comparison and prefixaverage comparison return the same result on sequences for which limitaverage exists. In addition, prefixaverage returns intuitive results when even when limitaverage may not exist. For example, suppose limitaverage of A and B do not exist, but \(\mathsf {LimInfAvg}(A) > \mathsf {LimSupAvg}(B)\), then \(\mathsf {PrefixAvg}(A) \ge \mathsf {PrefixAvg}(B)\). Therefore, prefixaverage comparison relaxes limitaverage comparison.
The rest of this section describes prefixaverage comparator \(\mathcal {A}_{\succeq _{PA(\cdot )}}\), an automaton that accepts the pair (A, B) of sequences iff \(\mathsf {PrefixAvg}(A)\ge \mathsf {PrefixAvg}(B)\).
Lemma 6
(Pumping Lemma for \(\omega \)regular language [2]). Let L be an \(\omega \)regular language. There exists \(p \in \mathbb {N}\) such that, for each \(w = u_1w_1u_2w_2 \dots \in L\) such that \(w_i \ge p\) for all i, there are sequences of finite words \((x_i)_{i\in \mathbb {N}}\), \((y_i)_{i\in \mathbb {N}}\), \((z_i)_{i\in \mathbb {N}}\) s.t., for all i, \(w_i = x_iy_iz_i\), \(x_iy_i \le p\) and \(y_i > 0\) and for every sequence of pumping factors \((j_i)_{i\in \mathbb {N}} \in \mathbb {N}\), the pumped word \(u_1 x_1 y_1^{j_1}z_1 u_2 x_2 y_2^{j_2}z_2 \dots \in L\).
Theorem 7
The prefixaverage comparator is not \(\omega \)regular.
Proof
(Proof Sketch). We use Lemma 6 to prove that \(\mathcal {A}_{\succeq _{PA(\cdot )}}\) is not \(\omega \)regular. Suppose \(\mathcal {A}_{\succeq _{PA(\cdot )}}\) were \(\omega \)regular. For \(p >0 \in \mathbb {N}\), let \(w = (A,B) = ((0,1)^p(1,0)^{2p})^{\omega }\). The segment \((0,1)^*\) can be pumped s.t the resulting word is no longer in \(\mathcal {L}_{\succeq _{PA(\cdot )}}\).
Concretely, \(A = (0^p 1^{2p})^{\omega }\), \(B = (1^p0^{2p})^{\omega }\), \(\mathsf {LimAvg}(A) = \frac{2}{3}\), \(\mathsf {LimAvg}(B) = \frac{1}{3}\). So, \(w = (A,B) \in \mathcal {A}_{\succeq _{PA(\cdot )}}\). Select as factor \(w_i\) (from Lemma 6) the sequence \((0,1)^p\). Pump each \(y_i\) enough times so that the resulting word is \(\hat{w} = (\hat{A}, \hat{B}) = ((0,1)^{m_i}(1,0)^{2p})^{\omega }\) where \(m_i>4p\). It is easy to show that \(\hat{w} = (\hat{A}, \hat{B})\notin \mathcal {L}_{\succeq _{PA(\cdot )}}\).
We discuss key ideas and sketch the construction of the prefix average comparator. The term prefixsum difference at i indicates \(\mathsf {Sum}(A[0,i1])  \mathsf {Sum}(B[0,i1])\), i.e. the difference between sum of ilength prefix of A and B.
Key Ideas. For sequences A and B to satisfy \(\mathsf {PrefixAvg}(A)\ge \mathsf {PrefixAvg}( B)\), \(\exists ^{f} i, \mathsf {Sum}(B[0,i1]) \ge \mathsf {Sum}(A[0,i1])\) and \(\exists ^{\infty } i, \mathsf {Sum}(A[0,i1]) > \mathsf {Sum}(B[0,i1])\). This occurs iff there exists an index N s.t. for all indices \(i>N\), \(\mathsf {Sum}(A[0,i1])  \mathsf {Sum}(B[0,i1])>0\). While reading a word, the prefixsum difference is maintained by states and the stack of \(\omega \)PDA: states maintain whether it is negative or positive, while number of tokens in the stack equals its absolute value. The automaton nondeterministically guesses the aforementioned index N, beyond which the automaton ensure that prefixsum difference remains positive.
Construction Sketch. The pushdown comparator \(\mathcal {A}_{\succeq _{PA(\cdot )}}\) consists of three states: (i) State \(s_P\) and (ii) State \(s_N\) that indicate that the prefixsum difference is greater than zero and or not respectively, (iii) accepting state \(s_F\). An execution of (A, B) begins in state \(s_N\) with an empty stack. On reading letter (a, b), the stack pops or pushes \((ab)\) tokens from the stack depending on the current state of the execution. From state \(s_P\), the stack pushes tokens if \((ab)>0,\) and pops otherwise. The opposite occurs in state \(s_N\). State transition between \(s_N\) and \(s_P\) occurs only if the stack action is to pop but the stack consists of \(k < ab\) tokens. In this case, stack is emptied, state transition is performed and \(abk\) tokens are pushed into the stack. For an execution of (A, B) to be an accepting run, the automaton nondeterministically transitions into state \(s_F\). State \(s_F\) acts similar to state \(s_P\) except that execution is terminated if there aren’t enough tokens to pop out of the stack. \(\mathcal {A}_{\succeq _{PA(\cdot )}}\) accepts by accepting state.
To see why the construction is correct, it is sufficient to prove that at each index i, the number of tokens in the stack is equal to \(\mathsf {Sum}(A[0,i1])  \mathsf {Sum}(B[0,i1])\). Furthermore, in state \(s_N\), \(\mathsf {Sum}(A[0,i1])  \mathsf {Sum}(B[0,i1])\le 0\), and in state \(s_P\) and \(s_F\), \(\mathsf {Sum}(A[0,i1])  \mathsf {Sum}(B[0,i1])>0\). Next, the index at which the automaton transitions to the accepting state \(s_F\) coincides with index N. The execution is accepted if it has an infinite execution in state \(s_F\), which allows transitions only if \(\mathsf {Sum}(A[0,i1])  \mathsf {Sum}(B[0,i1]) > 0\).
Theorem 8
The prefixaverage comparator is an \(\omega \)CFL.
While \(\omega \)CFL can be easily expressed, they do not possess closure properties, and problems on \(\omega \)CFL are easily undecidable. Hence, the application of \(\omega \)contextfree comparator will require further investigation.
6 Conclusion
In this paper, we identified a novel mode for comparison in quantitative systems: the online comparison of aggregate values of sequences of quantitative weights. This notion is embodied by comparators automata that read two infinite sequences of weights synchronously and relate their aggregate values. We showed that \(\omega \)regular comparators not only yield generic algorithms for problems including quantitative inclusion and winning strategies in incompleteinformation quantitative games, they also result in algorithmic advances. We show that the discountedsum inclusion problem is \(\mathsf {PSAPCE}\)complete for integer discountfactor, hence closing a complexity gap. We also studied the discountedsum and prefixaverage comparator, which are \(\omega \)regular and \(\omega \)contextfree, respectively.
We believe comparators, especially \(\omega \)regular comparators, can be of significant utility in verification and synthesis of quantitative systems, as demonstrated by the existence of finiterepresentation of counterexamples of the quantitative inclusion problem. Another potential application is computing equilibria in quantitative games. Applications of the prefixaverage comparator, in general \(\omega \)contextfree comparators, is open to further investigation. Another direction to pursue is to study aggregate functions in more detail, and develop a clearer understanding of when aggregate functions are \(\omega \)regular.
Notes
Acknowledgements
We thank the anonymous reviewers for their comments. We thank K. Chatterjee, L. Doyen, G. A. Perez and J. F. Raskin for corrections to earlier drafts, and their contributions to this paper. We thank P. Ganty and R. Majumdar for preliminary discussions on the limitaverage comparator. This work was partially supported by NSF Grant No. 1704883, “Formal Analysis and Synthesis of Multiagent Systems with Incentives”.
Supplementary material
References
 1.Almagor, S., Boker, U., Kupferman, O.: What’s decidable about weighted automata? In: Bultan, T., Hsiung, P.A. (eds.) ATVA 2011. LNCS, vol. 6996, pp. 482–491. Springer, Heidelberg (2011). https://doi.org/10.1007/9783642243721_37CrossRefGoogle Scholar
 2.Alur, R., Degorre, A., Maler, O., Weiss, G.: On omegalanguages defined by meanpayoff conditions. In: de Alfaro, L. (ed.) FoSSaCS 2009. LNCS, vol. 5504, pp. 333–347. Springer, Heidelberg (2009). https://doi.org/10.1007/9783642005961_24CrossRefGoogle Scholar
 3.Andersen, G., Conitzer, V.: Fast equilibrium computation for infinitely repeated games. In: Proceedings of AAAI, pp. 53–59 (2013)Google Scholar
 4.Andersson, D.: An improved algorithm for discounted payoff games. In: ESSLLI Student Session, pp. 91–98 (2006)Google Scholar
 5.Baier, C., Katoen, J.P., et al.: Principles of Model Checking. MIT Press, Cambridge (2008)zbMATHGoogle Scholar
 6.Boker, U., Henzinger, T.A.: Exact and approximate determinization of discountedsum automata. LMCS 10(1) (2014)Google Scholar
 7.Brim, L., Chaloupka, J., Doyen, L., Gentilini, R., Raskin, J.F.: Faster algorithms for meanpayoff games. Formal Methods Syst. Des. 38(2), 97–118 (2011)CrossRefGoogle Scholar
 8.Chatterjee, K., Doyen, L.: Energy parity games. In: Abramsky, S., Gavoille, C., Kirchner, C., Meyer auf der Heide, F., Spirakis, P.G. (eds.) ICALP 2010, Part II. LNCS, vol. 6199, pp. 599–610. Springer, Heidelberg (2010). https://doi.org/10.1007/9783642141621_50CrossRefGoogle Scholar
 9.Chatterjee, K., Doyen, L., Henzinger, T.A.: Expressiveness and closure properties for quantitative languages. In: Proceedings of LICS, pp. 199–208. IEEE (2009)Google Scholar
 10.Chatterjee, K., Doyen, L., Henzinger, T.A.: Quantitative languages. Trans. Comput. Log. 11(4), 23 (2010)MathSciNetzbMATHGoogle Scholar
 11.Chatterjee, K., Henzinger, T.A., Jurdzinski, M.: Meanpayoff parity games. In: Proceedings of LICS, pp. 178–187. IEEE (2005)Google Scholar
 12.Chaudhuri, S., Sankaranarayanan, S., Vardi, M.Y.: Regular real analysis. In: Proceedings of LICS, pp. 509–518 (2013)Google Scholar
 13.Cohen, R.S., Gold, A.Y.: Theory of \(\omega \)languages: characterizations of \(\omega \)contextfree languages. J. Comput. Syst. Sci. 15(2), 169–184 (1977)MathSciNetCrossRefGoogle Scholar
 14.de Alfaro, L., Faella, M., Henzinger, T.A., Majumdar, R., Stoelinga, M.: Model checking discounted temporal properties. In: Jensen, K., Podelski, A. (eds.) TACAS 2004. LNCS, vol. 2988, pp. 77–92. Springer, Heidelberg (2004). https://doi.org/10.1007/9783540247302_6CrossRefGoogle Scholar
 15.de Alfaro, L., Faella, M., Stoelinga, M.: Linear and branching metrics for quantitative transition systems. In: Díaz, J., Karhumäki, J., Lepistö, A., Sannella, D. (eds.) ICALP 2004. LNCS, vol. 3142, pp. 97–109. Springer, Heidelberg (2004). https://doi.org/10.1007/9783540278368_11CrossRefzbMATHGoogle Scholar
 16.Degorre, A., Doyen, L., Gentilini, R., Raskin, J.F., Toruńczyk, S.: Energy and meanpayoff games with imperfect information. In: Dawar, A., Veith, H. (eds.) CSL 2010. LNCS, vol. 6247, pp. 260–274. Springer, Heidelberg (2010). https://doi.org/10.1007/9783642152054_22CrossRefGoogle Scholar
 17.Droste, M., Kuich, W., Vogler, H.: Handbook of Weighted Automata. Springer, Heidelberg (2009). https://doi.org/10.1007/9783642014925
 18.Karp, R.M.: A characterization of the minimum cycle mean in a digraph. Discret. Math. 23(3), 309–311 (1978)MathSciNetCrossRefGoogle Scholar
 19.Kupferman, O., Vardi, M.Y.: Synthesis with incomplete informatio. In: Barringer, H., Fisher, M., Gabbay, D., Gough, G. (eds.) Advances in Temporal Logic, pp. 109–127. Springer, Dordrecht (2000). https://doi.org/10.1007/9789401595865_6Google Scholar
 20.Mohri, M.: Weighted automata algorithms. In: Mohri, M. (ed.) Handbook of Weighted Automata, pp. 213–254. Springer, Heidelberg (2009). https://doi.org/10.1007/9783642014925_6
 21.Grädel, E., Thomas, W., Wilke, T. (eds.): Automata Logics, and Infinite Games: A Guide to Current Research. LNCS, vol. 2500. Springer, Heidelberg (2002). https://doi.org/10.1007/3540363874CrossRefzbMATHGoogle Scholar
 22.Zwick, U., Paterson, M.: The complexity of mean payoff games on graphs. Theor. Comput. Sci. 158(1), 343–359 (1996)MathSciNetCrossRefGoogle Scholar
Copyright information
Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made. The images or other third party material in this book are included in the book's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the book's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.