Comparator automata in quantitative verification

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 aggregate functions that can be represented with B\"uchi automaton result in comparators that are finite-state and accept by the B\"uchi condition as well. Such $\omega$-regular comparators further lead to generic algorithms for a number of well-studied problems, including the quantitative inclusion and winning strategies in quantitative graph games with incomplete information, as well as related non-decision problems, such as obtaining a finite representation of all counterexamples in the quantitative inclusion problem. We study comparators for two aggregate functions: discounted-sum and limit-average. We prove that the discounted-sum comparator is $\omega$-regular iff the discount-factor is an integer. Not every aggregate function, however, has an $\omega$-regular comparator. Specifically, we show that the language of sequence-pairs for which limit-average aggregates exist is neither $\omega$-regular nor $\omega$-context-free. Given this result, we introduce the notion of prefix-average as a relaxation of limit-average aggregation, and show that it admits $\omega$-context-free comparators i.e. comparator automata expressed by B\"uchi pushdown automata.


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 language-theoretically: S and P are interpreted as sets of (infinite) words, and S is determined to satisfy P if S ⊆ 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 ⊆ P amounts to checking whether the weight of every word in S is less than or equal to its weight in P [BK + 08].
The need for such a formulation is clearer in quantitative systems, in which every run of a word is associated with a sequence of (rational-valued) weights. The weight of a run is given by aggregate function f : Q ω → R, which returns the real-valued 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 discounted-sum and limit-average.
In a well-studied 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 [DAFH + 04, DAFS04, DDG + 10]. 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 negative-weight cycle detection, computation of maximum weight of cycles etc [And06,Kar78].
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 [ABK11], 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 discounted-sum inclusion with integer discount-factor combines linear programming with a specialized subset-construction-based determinization step, rendering an EXPTIME algorithm [And06,BH14]. Yet, this approach does not match the PSPACE lower bound for discounted-sum inclusion.
In this paper, we present an automata-theoretic 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 discounted-sum inclusion that also closes its complexity gap.
A comparator for aggregate function f for relation R is an automaton that accepts a pair (A, B) of sequences of bounded natural numbers iff f (A) R f (B), where R is an inequality relation (>, <, ≥, ≤, =) or the equality relation =. A comparator could be finite-state or (pushdown) infinite-state. This paper studies such comparators.
A comparator is ω-regular if it is finite-state and accepts by the Büchi condition. We relate ω-regular comparators to ω-regular aggregate functions [CSV13], and show that ωregular aggregate-functions entail ω-regular comparators. However, the other direction is still open: Does an ω-regular comparator for an aggregate function and a relation

Preliminaries
Let Σ be a finite set of alphabet. The set of finite and infinite words over Σ is denoted by Σ * and Σ ω , respectively. An aggregate function f : Q ω → R takes the aggregate of an infinite-length weight sequence.
Definition 2.1 (Büchi automaton [TW + 02] ). A (finite-state) Büchi automaton is a tuple A = (S , Σ, δ, Init, F), where S is a finite set of states, Σ is a finite input alphabet, δ ⊆ (S × Σ × S ) is the transition relation, Init ⊆ S is the set of initial states, and F ⊆ 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 ) ∈ δ for some s }| ≤ 1 and |Init| = 1. Otherwise, it is nondeterministic. A Büchi automaton is complete if for all states s and inputs a, |{s |(s, a, s ) ∈ δ for some s }| ≥ 1. For a word w = w 0 w 1 · · · ∈ Σ ω , a run ρ of w is a sequence of states s 0 s 1 . . . s.t. s 0 ∈ Init, and τ i = (s i , w i , s i+1 ) ∈ δ for all i. Let inf (ρ) denote the set of states that occur infinitely often in run ρ. A run ρ is an accepting run if inf (ρ) ∩ F = ∅. A word w is an accepting word if it has an accepting run. Büchi automata are closed under set-theoretic union, intersection, and complementation [TW + 02]. Languages accepted by these automata are called ω-regular languages.
We adopt the definitions of function automata and regular functions [CSV13] w.r.t. aggregate functions as follows: Definition 2.2 (Aggregate function automaton, ω-Regular aggregate function). Let Σ be a finite set, and β ≥ 2 be an integer-valued base. A Büchi automaton A over alphabet Σ × AlphaRep(β) is an aggregate function automaton of type Σ ω → R if for all A ∈ Σ ω , there exists exactly one x ∈ R such that (A, rep(x, β)) ∈ L(A).
Equivalently, the language could be represented by a Parity automaton instead of a Büchi automaton.
Σ and AlphaRep(β) are the input and output alphabets, respectively. An aggregate function is an arbitrary function f : Σ ω → R. An aggregate function f : Σ ω → R is said to be ω-regular under integer base β ≥ 2 if there exists an aggregate function automaton A over alphabet Σ × AlphaRep(β) such that for all sequences A ∈ Σ ω and x ∈ R, f (A) = x iff (A, rep(x, β)) ∈ L(A). Definition 2.3 (Weighted automaton [CDH10,Moh09]). A weighted automaton over infinite words is a tuple A = (M, γ, f ), where M = (S , Σ, δ, Init, S ) is a Büchi automaton with all states as accepting, γ : δ → Q is a weight function, and f : Q → R is the aggregate function. Words and runs in weighted automata are defined as they are in Büchi automata. The weight-sequence of run ρ = s 0 s 1 . . . of word w = w 0 w 1 . . . is given by wt ρ = n 0 n 1 n 2 . . . where n i = γ(s i , w i , s i+1 ) for all i. The weight of a run ρ, denoted by f (ρ), is given by f (wt ρ ).
Here the weight of a word w ∈ Σ ω in weighted automata is defined as wt A (w) = sup{f (ρ)|ρ is a run of w in A}. In general, weight of a word can also be defined as the infimum of the weight of all its runs. Note, an automaton need not accept every word, even though all its states are accepting, since it need not be complete. By convention, if a word w / ∈ L(M) its weight wt A (w) = −∞.
Definition 2.4 (Quantitative inclusion). Let P and Q be weighted ω-automata with the same aggregate function f . The strict quantitative inclusion problem, denoted by P ⊂ f Q, asks whether for all words w ∈ Σ ω , wt P (w) < wt Q (w). The non-strict quantitative inclusion problem, denoted by P ⊆ f Q, asks whether for all words w ∈ Σ ω , wt P (w) ≤ wt Q (w).
Quantitative inclusion, strict and non-strict, is PSPACE-complete for limsup and liminf [CDH10]. Non-strict quantitative inclusion is undecidable for limit-average [DDG + 10], while decidability of the strict variant is still open. For discounted-sum with integer discount-factor it is in EXPTIME [BH14,CDH10], and decidability is unknown for rational discount-factors.
Definition 2.5 (Incomplete-information quantitative games). An incomplete-information quantitative game is a tuple G = (S, s I , O, Σ, δ, γ, f ), where S, O, Σ are sets of states, observations, and actions, respectively, s I ∈ S is the initial state, δ ⊆ S × Σ × S is the transition relation, γ : S → N × N is the weight function, and f : N ω → R is the aggregate function.
The transition relation δ is complete, i.e., for all states p and actions a, there exists a state q s.t. (p, a, q) ∈ δ. A play ρ is a sequence s 0 a 0 s 1 a 1 . . . , where τ i = (s i , a i , s i+1 ) ∈ δ. The observation of state s, by abuse of notation, is denoted by O(s) ∈ O. The observed play o ρ of ρ is the sequence o 0 a 0 o 1 aa 1 . . . , where o i = O(s i ). Player P 0 has incomplete information about the game G; it only perceives the observation play o ρ . Player P 1 receives full information and witnesses play ρ. Plays begin in the initial state s 0 = s I . For i ≥ 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 ) ∈ δ. The weight of state s is the pair of payoffs γ(s) = (γ(s) 0 , γ(s) 1 ). The weight sequence wt i of player P i along ρ is given by γ(s 0 ) i γ(s 1 ) i . . . , and its payoff from ρ is given by f (wt i ) for aggregate function f , denoted by f (ρ i ), for simplicity. A play on which a player receives a greater payoff than the other player is said to be a winning play for the player. A strategy for player P 0 is given by a function α : O * → Σ since it only sees observations. Player P 0 agrees with strategy α if for all i, a i = α(o 0 . . . o i ). A strategy α is said to be a winning strategy for player P 0 if all plays agreeing with α are winning plays for P 0 .
A run ρ on a word w = w 0 w 1 · · · ∈ Σ ω of a Büchi PDA A is a sequence of configurations (s 0 , γ 0 ), (s 1 , γ 1 ) . . . satisfying (1) s 0 ∈ Init, γ 0 = Z 0 , and (2) (s i , γ i , w i , s i+1 , γ i+1 ) ∈ δ for all i. Büchi PDA consists of a stack, elements of which are the tokens Γ, and initial element Z 0 . Transitions push or pop token(s) to/from the top of the stack. Let inf (ρ) be the set of states that occur infinitely often in state sequence s 0 s 1 . . . of run ρ. A run ρ is an accepting run in Büchi PDA if inf (ρ) ∩ F = ∅. A word w is an accepting word if it has an accepting run. Languages accepted by Büchi PDA are called ω-context-free languages (ω-CFL). . An infinite weightsequence A is said to be bounded if there exists a value b ∈ Q such that |A[i]| < b for all i ≥ 0. Abusing notation, we write w ∈ A and ρ ∈ A if w and ρ are an accepting word and an accepting run of A respectively. The Symbol · is used to denote both multiplication of real numbers and concatenation of sequences. The meaning will be clear in context.

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 3.1 (Comparator automata). Let Σ be a finite set of rational numbers, and f : Q ω → R denote an aggregate function. A comparator automaton for aggregate function f with inequality or equality relation R ∈ {≤, <, ≥, >, =, =} is an automaton over the alphabet Σ × Σ that accepts a pair (A, B) of (infinite) weight sequences iff f (A) R f (B).
From now on, unless mentioned otherwise, we assume that all weight sequences are bounded, natural number sequences. The boundedness assumption is justified since the set of weights forming the alphabet of a comparator is bounded. For all aggregate functions considered in this paper, the result of comparison of weight sequences is preserved by a uniform linear transformation that converts rational-valued weights into natural numbers; justifying the natural number assumption.
When the comparator for an aggregate function and a relation is a Büchi automaton, we call it an ω-regular comparator. Likewise, when the comparator is a Büchi pushdown automaton, we call it an ω-context-free comparator.  − −− → t is the ω-regular comparator automata for relation ≥. The ω-regular comparator for = can be obtained by taking the intersection of the comparator for ≤ and ≥ since Büchi automata are closed under intersection. Finally, since Büchi automata are also closed under complementation, we get that the comparator automata for the other three relations, namely <,>, =, is also ω-regular.
Limsup comparator. We explain comparators through an example. The limit supremum (limsup, in short) of a bounded, integer sequence A, denoted by LimSup(A), is the largest integer that appears infinitely often in A. The limsup comparator for relation ≥ is a Büchi automaton that accepts the pair (A, B) of sequences iff LimSup(A) ≥ LimSup(B).
The working of the limsup comparator for relation ≥ is based on non-deterministically guessing the limsup of sequences A and B, and then verifying that LimSup(A) ≥ LimSup(B). • δ ⊆ S × Σ × S is defined as follows: (1) Transitions from start state s: (s, (a, b), p) for all (a, b) ∈ Σ, and for all p ∈ {s} ∪ {f 0 , f 1 , . . . , f µ }.
(2) Transitions between f k and s k for each k:  Proof. Let (A, B) have an accepting run in A k . We show that LimSup(A) = k ≥ LimSup(B). The accepting run visits state f k infinitely often. Note that all incoming transitions to accepting state f k occur on alphabet (k, ≤ k) while all transitions between states f k and s k occur on alphabet (≤ k − 1, ≤ k), where ≤ k denotes the set {0, 1, . . . 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. Therefore, if (A, B) is accepted by A k then LimSup(A) = k, and LimSup(B) ≤ k, and LimSup(A) ≥ LimSup(B).
Conversely, let LimSup(A) = k > LimSup(B). We prove that (A, B) is accepted by A k . For an integer sequence A when LimSup(A) = k integers greater than k can occur only a finite number of times in A. Let l A denote the index of the last occurrence of an integer greater than k in A. Similarly, since LimSup(B) ≤ k, let l B be index of the last occurrence of an integer greater than k in B. Therefore, for sequences A and B integers greater than k will not occur beyond index l = max (l A , l B ). Büchi automaton A k (Fig. 1) non-deterministically determines l. On reading the l-th element of input word (A, B), the run of (A, B) exits the start state s and shifts to accepting state f k . Note that all runs beginning at state f k occur on alphabet (a, b) where a, b ≤ k. Therefore, (A, B) can continue its infinite run even after transitioning to f k . To ensure that this is an accepting run, the run must visit accepting state f k infinitely often. But this must be the case, as transition on alphabet (k, k ) for k ≤ k must be taken infinitely often as k is the limsup of A and limsup of B is less than or equal to k. Transitions on this alphabet always return to the accepting state f k . Hence, for all integer sequences  Proof. The construction given above contains a Büchi automata A k for all k ∈ {0, . . . , µ}. Therefore, from Lemma 3.3, we conclude that the construction corresponds to the limsup comparator with inequality ≥. Therefore, limsup comparator with relation ≥ is ω-regular.
From Lemma 3.2 we know that limsup comparator is ω-regular for all relations.
Due to closure properties of Büchi automata, this implies that limsup comparator for all inequalities and equality relation is also ω-regular. The limit infimum (liminf, in short) of an integer sequence is the smallest integer that appears infinitely often in it; its comparator has a similar construction to the limsup comparator. One can further prove that the limsup and liminf aggregate functions are also ω-regular aggregate functions.
3.1. ω-Regular aggregate functions. This section draws out the relationship between ω-regular aggregate functions and ω-regular comparators. We begin with the following Lemma in order to show that ω-regular aggregate functions entail ω-regular comparators for the aggregate function.
Lemma 3.5. Let µ > 0 be the upper-bound on weight sequences, and β ≥ 2 be the integer base. Then there exists a Büchi automaton A β such that for all Proof. Let a, b ∈ R, and β > 2 be an integer base. Let rep(a, β) = sign a · (Int(a, β), Frac(a, β)) and rep(b, β) = sign b · (Int(b, β), Frac(b, β)). Then, the following statements can be proven using simple evaluation from definitions: • When sign a = + and sign b = −. Then a > b.
• When sign a = sign b = + -If Int(a, β) = Int(b, β): Since Int(a, β) and Int(b, β) eventually only see digit 0 i.e. they are necessarily identical eventually, there exists an index i such that it is the last position where Int(a, β) and Since Int(a, β) and Int(b, β) eventually only see digit 0 i.e. they are necessarily identical eventually. Therefore, there exists an index i such that it is the last position where Int(a, β) and and • When sign a = − and sign b = +. Then a < b.
Since the conditions given above are exhaustive and mutually exclusive, we conclude that for all a, b ∈ R and integer base β ≥ 2, letting rep(a, β) = sign a · (Int(a, β), Frac(a, β)) and rep(b, β) = sign b · (Int(b, β), Frac(b, β)), a > b iff one of the following conditions occurs: Note that each of these five conditions can be easily expressed by a Büchi automaton over alphabet AlphaRep(β) for an integer β ≥ 2. For an integer β ≥ 2, the union of all these Büchi automata will result in a Büchi automaton A β such that for all a, b ∈ R and A = rep(a, β) and We finally show that ω-regular aggregate functions entail ω-regular comparators for the aggregate function.
Theorem 3.6. Let µ > 0 be the upper-bound on weight sequences, and β ≥ 2 be the integer base. Let f : {0, 1, . . . , µ} ω → R be an aggregate function. If aggregate function f is ω-regular under base β, then its comparator for all inequality and equality relations is also ω-regular.
Proof. We show that if an aggregate function is ω-regular under base β, then its comparator for relation > is ω-regular. By closure properties of ω-regular comparators, this implies that comparators of the aggregate function are ω-regular for all inequality and equality relations.
Let f : Σ ω → R be an ω-regular aggregate function with aggregate function automata A f . We will construct an ω-regular comparator for f with relation >. From Lemma 3.5 we know that (X, Y ) is present in the comparator iff (X, M ), (Y, N ) ∈ A f for M, N ∈ AlphaRep(β) ω and (M, N ) ∈ A β , for A β as described above. Since A f and A β are both Büchi automata, the comparator for function f with relation > is also a Büchi auotmaton. Therefore, the comparator for aggregate function f with relation > is ω-regular. The converse direction of whether ω-regular comparator for an aggregate function f for all inequality or equality relations will entail ω-regular functions under an integer base β ≥ 0 is trickier. For all aggregate functions considered in this paper, we see that whenever the comparator is ω-regular, the aggregate function is ω-regular as well. However, the proofs for this have been done on a case-by-cass basis, and we do not have an algorithmic procedure to derive a function (Büchi) automaton from its ω-regular comparator. We also do not have an example of an aggregate function for which the comparator is ω-regular but the function is not. Therefore, we arrive at the following conjecture: Conjecture 3.7. Let µ > 0 be the upper-bound on weight sequences, and β ≥ 2 be the integer base. Let f : {0, 1, . . . , µ} ω → R be an aggregate function. If the comparator for an aggregate function f is ω-regular for all inequality and equality relations, then its aggregate function is also ω-regular under base β.

Quantitative inclusion.
The aggregate function or comparator of a quantitative inclusion problem refer to the aggregate function or comparator of the associated aggregate function. This section presents a generic algorithm (Algorithm 1) to solve quantitative inlcusion between ω-weighted automata P and Q with ω-comparators. This section focusses on the non-strict quantitative inclusion. InclusionReg (Algorithm 1) is an algorithm for quantitative inclusion between weighted ω-automata P and Q with ω-regular comparator A f for relation ≥. InclusionReg takes P ,Q and A f as input, and returns True iff P ⊆ f Q. The results for strict quantitative inclusion are similar. We use the following motivating example to explain steps of Algorithm 1.
Motivating example. Let weighted ω-automata P and Q be as illustrated in Fig. 2-3 with the limsup aggregate function. The word w = a ω has one run ρ P 1 = p 1 p ω 2 with weight sequence wt P 1 = 1 ω in P and two runs ρ Q 1 = q 1 q ω 2 with weight sequence wt Q 1 = 0, 1 ω and run ρ Q 2 = q 1 q ω 2 with weight sequence wt Q 2 = 2, 1 ω . Clearly, wt P (w) ≤ wt Q (w). Therefore P ⊆ f Q. From Theorem 3.4 we know that the limsup comparator A ≤ LS for ≤ is ω-regular. We use Algorithm 1 to show that P ⊆ f Q using its ω-regular comparator for ≤. Intuitively, the algorithm must be able to identify that for run ρ P 1 of w in P , there exists a run ρ Q 2 in Q s.t. (wt P 1 , wt Q 2 ) is accepted by the limsup comparator for ≤.
InclusionReg constructs Büchi automaton Dom that consists of exactly the dominated runs of P w.r.t P ⊆ f Q. InclusionReg returns True iff Dom contains all runs of P . To obtain Dom, it constructs Büchi automaton DomProof that accepts word (ρ P , ρ Q ) iff ρ P and ρ Q are runs of the same word in P and Q respectively, and wt P (ρ P ) ≤ wt Q (ρ Q ) i.e. if w P and Vol. 18:3 COMPARATOR AUTOMATA 13:11 (a, 1, 2, 1, 3) Figure 6:P ×Q w Q are weight sequence of ρ P and ρ Q , respectively, then (w P , w Q ) is present in the ω-regular comparator A ≤ f for aggregate function f with relation ≤. The projection of DomProof on runs of P results in Dom.
Algorithm details. For sake a simplicity, we assume that every word present in P is also present in Q i.e. P ⊆ Q (qualitative inclusion). InclusionReg has three steps: (a). UniqueId (1) UniqueId: AugmentWtAndLabel transforms weighted ω-automaton A into Büchi au-tomatonÂ by converting transition τ = (s, a, t) with weight γ(τ ) in A to transition τ = (s, (a, γ(τ ), l), t) inÂ, where l is a unique label assigned to transition τ . The word ρ = (a 0 , n 0 , l 0 )(a 1 , n 1 , l 1 ) · · · ∈Â iff there exists a run ρ ∈ A on word a 0 a 1 . . . with weight sequence n 0 n 1 . . . . Labels ensure bijection between runs in A and words inÂ. Words ofÂ have a single run inÂ. Hence, transformation of weighted ω-automata P and Q to Büchi automataP andQ enables disambiguation between runs of P and Q (Line 3-4).
The correspondingÂ for weighted ω-automata P and Q from Figure 2-3 are given in Figure 4-5 respectively.
(2) Compare: The output of this step is the Büchi automaton Dom that contains the word ρ ∈P iff ρ is a dominated run in P w.r.t P ⊆ f Q (Lines 5-7). MakeProduct(P ,Q) constructsP ×Q s.t. word (ρ P ,ρ Q ) ∈P ×Q iff ρ P and ρ Q are runs of the same word in P and Q respectively (Line 5). Concretely, for transition τ A = (s A , (a, n A , l A ), t A ) in automaton A, where A ∈ {P ,Q}, transitionτ P ×τ Q = ((s P , s Q ), (a, n P , l P , n Q , l Q ), (t P , t Q )) is inP ×Q, as shown in Figure 6.
The projection of DomProof on the alphabet ofP returns Dom which contains the wordρ P iff ρ P is a dominated run in P w.r.t P ⊆ f Q (Line 7), as shown in Figure 9.
(3) DimEnsure: P ⊆ f Q iffP ≡ Dom (qualitative equivalence) sinceP consists of all runs of P and Dom consists of all dominated runs w.r.t P ⊆ f Q (Line 8).
Lemma 3.8. Büchi automaton Dom consists of all dominated runs in P w.r.t P ⊆ f Q.

Proof.
Let A ≤ f be the comparator for ω-regular aggregate function f and relation ≤ s.t.
A run ρ over word w with weight sequence wt in P (or Q) is represented by the unique wordρ = (w, wt, l) inP (orQ) where l is the unique label sequence associated with each run in P (or Q). Since every label on each transition is unique,P andQ are deterministic automata. Now,P ×Q is constructed by ensuring that two transitions are combined in the product only if their alphabet is the same. Therefore if (w, wt 1 , l 1 , wt 2 , l 2 ) ∈P ×Q, thenρ = (w, wt 1 , l 1 ) ∈P ,σ = (w, wt 2 , l 2 ) ∈Q. Hence, there exist runs ρ and σ with weight sequences wt 1 and wt 2 in P and Q, respectively. Next, P ×Q is intersected over the weight sequences with ω-regular comparator A ≤ f for aggregate function f and relation ≤. Therefore (w, wt 1 , l 1 , wt 2 , l 2 ) ∈ DomProof iff f (wt 1 ) ≤ f (wt 2 ). Therefore runs ρ in P and σ in Q are runs on the same word s.t. aggregate weight in P is less than or equal to that of σ in Q. Therefore Dom consists ofρ only if ρ is a dominated run in P w.r.t P ⊆ f Q.
Every step of the algorithm has a two-way implication, hence it is also true that every dominated run in P w.r.t P ⊆ f Q is present in Dom. Lemma 3.9. Given weighted ω-automata P and Q and their ω-regular comparator A ≤ f for aggregate function f and relation ≤.
Proof.P consists of all runs of P . Dom consists of all dominated run in P w.r.t P ⊆ f Q. P ⊆ f Q iff every run of P is dominated w.r.t P ⊆ f Q. Therefore P ⊆ f Q is given by whether P ≡ Dom, where ≡ denotes qualitative equivalence.
Algorithm InclusionReg is adapted for strict quantitative inclusion P ⊂ f Q by repeating the same procedure with ω-regular comparator A < f for aggregate function f and relation <. Here, a run ρ P in P on word w ∈ Σ ω is said to be dominated w.r.t P ⊂ f Q if there exists a run ρ Q in Q on the same word w such that wt P (ρ P ) < wt Q (ρ Q ). Similarly for quantitative equivalence P ≡ f Q.
We give the complexity analysis of quantitative-inclusion with ω-regular comparators. Theorem 3.10. Let P and Q be weighted ω-automata and A f be an ω-regular comparator. Quantitative inclusion problem, quantitative strict-inclusion problem, and quantitative equivalence problem for ω-regular aggregate function f is PSPACE-complete.
Proof. All operations in InclusionReg until Line 7 are polytime operations in the size of weighted ω-automata P , Q and comparator A f . Hence, Dom is polynomial in size of P , Q and A f . Line 8 solves a PSPACE-complete problem. Therefore, the quantitative inclusion for ω-regular aggregate function f is in PSPACE in size of the inputs P , Q, and A f . The PSPACE-hardness of the quantitative inclusion is established via reduction from the qualitative inclusion problem, which is 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 P , Q by assigning a weight of 1 to each transition. Since all runs in P , Q have the same weight sequence, weight of all words in P and Q is the same for any function f . It is easy to see P ⊆ Q (qualitative inclusion) iff P ⊆ f Q (quantitative inclusion). Theorem 3.10 extends to weighted ω-automata when weight of words is the infimum of weight of runs. The key idea for P ⊆ f Q here is to ensure that for every run ρ Q in Q there exists a run on the same word in Representation of counterexamples. When P f Q, there exists word(s) w ∈ Σ * 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 [BK + 08], 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 InclusionReg yields Büchi automata-representations for all counterexamples of the quantitative inclusion problem for ω-regular functions.
Theorem 3.11. All counterexamples of the quantitative inclusion problem for an ω-regular aggregate function can be expressed by a Büchi automaton.
Proof. For word w to be a counterexample, it must contain a run in P that is not dominated. Clearly, all non-dominated runs of P w.r.t to the quantitative inclusion are members of P \ Dom. The counterexamples words can be obtained fromP \ Dom by modifying its alphabet to the alphabet of P by dropping transition weights and their unique labels.
3.3. Incomplete-information quantitative games. Given an incomplete-information quantitative game G = (S, s I , O, Σ, δ, γ, f ), our objective is to determine if player P 0 has a winning strategy α : O * → Σ for ω-regular aggregate function f . We assume we are given the ω-regular comparator A f for function f . We provide an informal description of the algorithm to describe the intuition.
Note that a function A * → B can be treated like a B-labeled A-tree, and vice-versa. Hence, we proceed by finding a Σ-labeled O-tree -the winning strategy tree. Every branch of a winning strategy-tree is an observed play o ρ of G for which every actual play ρ is a winning play for P 0 .
We first consider all game trees of G by interpreting G as a tree-automaton over Σlabeled S-trees. Nodes n ∈ S * of the game-tree correspond to states in S and labeled by actions in Σ taken by player P 0 . Thus, the root node ε corresponds to s I , and a node s i 0 , . . . , s i k corresponds to the state s i k reached via s I , s i 0 , . . . , s i k−1 . Consider now a node 13:14

S. Bansal, S. Chaudhuri, and M.Y. Vardi
Vol. 18:3 x corresponding to state s and labeled by an action σ. Then x has children xs 1 , . . . xs n , for every s i ∈ S. If s i ∈ δ(s, σ), then we call xs i a valid child, otherwise we call it an invalid child. Branches that contain invalid children correspond to invalid plays. A game-tree τ is a winning tree for player P 0 if every branch of τ is either a winning play for P 0 or an invalid play of 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 ω-regular comparator A f that accepts (A, B) iff f (A) > f (B). To use the comparator A f , it is determinized to Parity automaton D f . Thus, a product of game G with D f is a deterministic Parity tree-automaton accepting precisely winning-trees for player P 0 .
Winning trees for player P 0 are Σ-labeled S-trees. We need to convert them to Σ-labeled O-trees. Recall that every state has a unique observation. We can simulate these Σ-labeled S-trees on strategy trees using the technique of thinning states S to observations O [KV00]. The resulting alternating Parity tree automaton M will accept a Σ-labeled O-tree τ o iff for all actual game-tree τ of τ o , τ is a winning-tree for P 0 with respect to the strategy τ o . The problem of existence of winning-strategy for P 0 is then reduced to non-emptiness checking of M.
Using the above, we get the following result: Given an incomplete-information quantitative game G and ω-regular comparator A f for the aggregate function f , the time complexity of determining whether P 0 has a winning strategy is exponential in |G| Observe that since D f is obtained by determinization of A f , we obtain that |D f | = |A f | O(|A f |) . The thinning operation is linear in size of |G × D f |, therefore |M| = |G| · |D f |. Non-emptiness 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.

Discounted-sum comparator
The discounted-sum of an infinite sequence A with discount-factor d > 1, denoted by DS (A, d), is defined as Σ ∞ i=0 A[i]/d i , and the discounted-sum of a finite sequence A is Σ The discounted-sum comparator (DS-comparator, in short) for discountfactor d and relation R, denoted by A R d , accepts a pair (A, B) of (infinite length) weight sequences iff DS (A, d) R DS (B, d). We investigate properties of the DS-comparator, and show that the DS-comparator is ω-regular iff the discount-factor d > 1 is an integer. We also show that the discounted-sum aggregate function is ω-regular iff the discount-factor is an integer. Finally, we show the repercussions of the above results on quantitative inclusion with discounted-sum aggregate function (DS-inclusion, in short). Section 4.1 and Section 4.2 deal with the non-integer rational discount-factors and integer discount-factors, respectively. 4.1. Non-integer, rational discount-factor. We prove that for non-integer discount factors, the discounted-sum comparator is not ω-regular. For a weighted ω-automaton A and a real number r ∈ R, the cut-point language of A w.r.t. r is defined as L ≥r = {w ∈ L(A)|wt A (w) ≥ r} [CDH09]. When the discount factor is a rational value 1 < d < 2, it is known that not all deterministic weighted ω-automaton with discounted-sum aggregate function (DS-automaton, in short) have an ω-regular cut-point language for an r ∈ R [CDH09]. In this section, we extended this result to all non-integer, rational Vol. 18:3 COMPARATOR AUTOMATA 13:15 discount-factors d > 1. Finally, we use this to prove that discounted-sum is not an ω-regular aggregate function when its discount-factor is a non-integer rational number.
Ambiguous Words. Let d > 2 be a non-integer, rational discount-factor. We consider finite weight-sequences over the alphabet {0, 1, . . . , d − 1}. We say a weight-sequence w is Intuitively, a weight-sequence is ambiguous if it could be extended to an infinite word with length less than 1 and greater than 1.
We will establish that there exists an infinite word such that its discounted-sum is equal to 1 but all of its finite prefixes are ambiguous. We prove by induction on length of prefixes. Let w = 0. Since d > 2, d −1 d−1 > 1. So, w is ambiguous. Now, we prove that if w is ambiguous, then at least one of w · 0, . . . , w · ( d − 1) is ambiguous.
We prove this in cases: In the next case, suppose 1 In the final case, DS (w, d) as d −1 d−1 > 1. Thus, w · 0 is ambiguous.
Theorem 4.1. For all non-integer, rational discount-factor d > 1, there exists a deterministic discounted-sum automata A and rational value r ∈ R for which its cut-point language is not ω-regular.
Proof. Since the proof for 1 < d < 2 has been presented in [CDH09], we skip that case. The proof presented here extends the earlier result on 1 < d < 2 from [CDH09] to all non-integer, rational discount factors d > 2.
Consider its cut-point language L ≥1 . Let us assume that the language L ≥1 is ω-regular and represented by Büchi automaton B. For n < m, let the n-and m-length prefixes of w ≥ , denoted w ≥ [0, n − 1] and w ≥ [0, m − 1], respectively, be such that they reach the same states in B. Then there exists an infinite length word w s such that DS (w s , d) from the equations and simplification, we get: The above is a polynomial over d with degree m − 1 and integer co-efficients. Specifically, d = p q > 2 such that integers p, q > 1, and p and q are mutually prime. Since d = p q is a root of the above equation, q must divide co-efficient of the highest degree term, in this case it is m − 1. The co-efficient of the highest degree term in the polynomial above is (w ≥ [0] − ( d − 1)). Recall from construction of the infinite-length word with ambiguous prefixes w ≥ from above, w ≥ [0] = 0. So the co-efficient of the highest degree term is −1, which is not divisible by integer q > 1. Contradiction.
Finally, we use Theorem 4.1 to prove the discounted-sum comparator is not ω-regular when the discount-factor d > 1 is non-integer, rational number.
Theorem 4.2. DS-comparator for non-integer, rational discount-factors d > 1 for all inequalities and equality are not ω-regular.
Proof. If the comparator for an aggregate function for any one inequality is not ω-regular, then the comparator for all inequalities and equality relation will also not be ω-regular. Therefore, it is sufficient to prove that the discounted-sum comparator with non-integer, rational value for relation ≥ is not ω-regular.
Let d > 1 be a non-integer, rational discount-fact. Let A be the discounted-sum automaton as described in proof of Lemma 4.1. Consider its cut-point language L ≥1 . From Lemma 4.1 and [CDH09], we know that L ≥1 is not an ω-regular language.
Suppose there exists an ω-regular DS-comparator A ≤ d for non-integer rational discount factor d > 1 for relation ≥. We define the Büchi automaton P s.t.
Then the cut-point language L ≥( d −1) of deterministic discounted-sum automata A can be constructed by taking the intersection of P with A ≥ d . Since all actions are closed under ω-regular operations, L ≥1 can be represented by a Büchi automaton. Contradiction to Theorem 4.1.
Theorem 4.3. Let d > 1 be a non-integer, rational discount-factor. The discounted-sum aggregate function with discount-factor d is not ω-regular.
Proof. Immediate from Lemma 4.1 and Theorem 3.6.
Since the DS-comparator for all non-integer, rational discount-factor d > 1 is not ωregular, the ω-regular-based algorithm for quantitative inclusion described in Algorithm 1 does not apply to DS-inclusion. In fact, the decidability of DS-inclusion with non-integer, rational discount-factors is still open. Finally, we have shown is follow-up work that comparators for approximations of discounted-sum with non-integer discount factors 1 < d < 2 can be made ω-regular [BKVW22].

4.2.
Integer discount-factor. In this section, we provide an explicit construction of an ω-regular comparator for discounted-sum with integer discount-factors. We use this construction to prove that discounted-sum aggregate function with integer discount-factor is ω-regular. Finally, we use the ω-regular DS-comparator in Algorithm 1 to establish that PSPACE-completeness of DS-inclusion with integer discount-factors.
Discounted-sum comparator. Let integer µ > 0 be the upper-bound on sequences. The core intuition is that bounded sequences can be converted to their value in base d via a finite-state transducer. Lexicographic comparison of the converted sequences renders the desired DS-comparator. Conversion of sequences to base d requires a certain amount of look-ahead by the transducer. Here we describe a method that directly incorporates the look-ahead with lexicographic comparison to obtain the DS-comparator for integer discount-factor d > 1. Here we construct the discounted-sum comparator for relation <.
We explain the construction in detail now. For weight sequence A and integer discount- CSV13]. Unlike comparison of numbers in base d, the lexicographically larger sequence may not be larger in value since (i) The elements of weight sequences may be larger in value than base d, and (ii) Every value has multiple infinite-sequence representations.
To overcome these challenges, we resort to arithmetic techniques in base d. Note that and DS (C, d) > 0. Therefore, to compare the discounted-sum of A and B, we obtain a sequence C. Arithmetic in base d also results in sequence X of carry elements. Then: Lemma 4.4. Let A, B, C, X be weight sequences, d > 1 be a positive integer such that the following equations hold: , systematically guess sequences C and X using the equations, element-by-element beginning with the 0-th index and moving rightwards. There are two crucial observations here: (i) Computation of i-th element of C and X only depends on i-th and (i − 1)-th elements of A and B. Therefore guessing C[i] and X[i] requires finite memory only. (ii) Intuitively, C refers to a representation of value DS (B, d) − DS (A, d) in base d and X is the carry-sequence. If we can prove that X and C are also bounded-sequences and can be constructed from a finite-set of integers, we would be able to further proceed to construct a Büchi automaton for the desired comparator.
We proceed by providing an inductive construction of sequences C and X that satisfy the properties in Lemma 4.4 (Lemma 4.5), and show that these sequences are bounded when A and B are bounded. In particular, when A and B are bounded integer-sequences, then sequences C and X constructed here are also bounded-integer sequences. Therefore, they can be constructed from a finite-set of integers. Proofs for sequence C are in Lemma 4.6-Lemma 4.8, and proof for sequence X is in Lemma 4.9.
We begin with introducing some notation.
We define the residual function Res : N ∪ {0} → R as follows: Then we define C[i] as follows: Then, we define X[i] as follows: Therefore, we have defined sequences C and X as above. We now prove the desired properties one-by-one.
First, we establish that sequences C, X as defined here satisfy Equations 1-2 from Lemma 4.4. Therefore, ensuring that C is indeed the difference between sequences B and A, and X is their carry-sequence.
Lemma 4.5. Let A and B be bounded integer sequences and C and X be defined as above. Then, Proof. We prove this by induction on i using definition of function X.  [1]). From the above we obtain X Suppose the invariant holds true for all i ≤ n, we show that it is true for n + 1.
Next, we establish the sequence C is a bounded integer sequence, therefore it can be represented by a finite-set of integers.   Suppose for all i ≤ k, 0 ≤ Res(i) < 1 d i . We show this is true even for k + 1. Since Res(k) ≥ 0, Res(k) · d k+1 ≥ 0. Let Res(k) · d k+1 = x + f , for integral x ≥ 0, and fractional 0 ≤ f < 1. Then, from definition of Res, we get Res(k Therefore, we have established that sequence C is non-negative integer-valued and is bounded by maxC = µ · d d−1 . Finally, we prove that sequence X is also a bounded-integer sequence, thereby proving that it is bounded, and can be represented with a finite-set of integers. Note that for all i ≥ 0, by expanding out the definition of X[i] we get that X[i] is an integer for all i ≥ 0. We are left with proving boundedness of X: Proof. From definition of X, we know that We summarize our results from Lemma 4.5-Lemma 4.9 as follows: Corollary 4.10. Let d > 1 be an integer discount-factor. Let A and B be non-negative integer sequences bounded by µ, and DS (A, d) < DS (B, d). Then there exists bounded integer-valued sequences X and C that satisfy the conditions in Lemma 4.4. Furthermore, C and X are bounded as follows: Intuitively, we construct a Büchi automaton A < d with states of the form (x, c) where x and c range over all possible values of X and C, respectively, and a special initial state s. Transitions over alphabet (a, b) replicate the equations in Lemma 4.4. i.e. transitions from the start state (s, (a, b), (x, c)) satisfy a + c + x = b to replicate Equation 1 (Lemma 4.4) at the 0-th index, and all other transitions ((x 1 , c 1 ), (a, b), (x 2 , c 2 )) satisfy a + c 2 + x 2 = b + d · x 1 to replicate Equation 2 (Lemma 4.4) at indexes i > 0. Full construction is as follows: where ⊥ is a special character, and c ∈ N, x ∈ Z. • State s is the initial state, and F are accepting states (1) Transitions from start state s: Proof. Immediate from Theorem 4.11, and closure properties of Büchi automaton.
Constructions of DS-comparator with integer discount-factor d > 1 for non-strict inequality ≤ and equality = follow similarly and also have O( µ 2 d )-many states. Discounted-sum aggregate function. We use the ω-regular comparator for DS-aggregate function for integer discount-factor to prove that discounted-sum with integer discount-factors is an ω-regular aggregate function.
Theorem 4.13. Let d > 1 be an integer discount-factor. The discounted-sum aggregate function with discount-factor d is ω-regular under base d.
Proof. We define the discounted-sum aggregate function automaton ( Therefore, application of transducer T to Parity automaton B \ C will result in a Parity automaton over the alphabet Σ × AlphaRep(d) such that for all A ∈ Σ ω the automaton accepts (A, rep(DS (A, d), d)). This is exactly the DS-function automaton over input alphabet Σ and integer base d > 1. Therefore, the discounted-sum aggregate function with integer discount-factors in ω-regular.
Recall, this proof works only for the discounted-sum aggregate function with integer discount-factor. In general, there is no known procedure to derive a function automaton from an ω-regular comparator (Conjecture 3.7).

DS-inclusion.
For discounted-sum with integer discount-factor it is in EXPTIME [BH14,CDH10] which does not match with its existing PSPACE lower bound. In this section, we use the ω-regular DS-comparator for integer to close the gap, and establish PSPACE-completeness of DS-inclusion under a unary representation of numbers.
Corollary 4.14. Let integer µ > 1 be the maximum weight on transitions in DS-automata P and Q, and d > 1 be an integer discount-factor. Let µ and d be represented in unary form. Then DS-inclusion, DS-strict-inclusion, and DS-equivalence between P and Q are PSPACE-complete.
Proof. Since size of DS-comparator is polynomial w.r.t. to upper bound µ, when represented in unary, (Theorem 4.11), DS-inclusion is PSPACE in size of input weighted ω-automata and µ (Theorem 3.10).

13:22
S. Bansal,S. Chaudhuri,and M.Y. Vardi Vol. 18:3 Not only does this result improve upon the previously known upper bound of EXPTIME but it also closes the gap between upper and lower bounds for DS-inclusion. Note, however, if the numbers are represented in binary, then the comparator-based algorithm will incur prohibitively large overhead since the size of the comparator will be exponential in µ.
We observe the algorithmic benefits of comparator-based solutions. The earlier known EXPTIME upper bound in complexity is based on an exponential determinization construction (subset construction) combined with arithmetical reasoning [BH14,CDH10]. We observe that the determinization construction can be performed on-the-fly in PSPACE. To perform, however, the arithmetical reasoning on-the-fly in PSPACE would require essentially using the same bit-level ((x, c)-state) techniques that we have used to construct DS-comparator. This point is corroborated in empirical evaluations where comparator-based approach comprehensively outperforms the determinization-based approach [BCV18a]. The performance of comparator-based approach has further been improved using additional language-theoretic properties of DS comparators, namely their safety and co-safety properties [BV19]. , is defined only if the limit-average infimum and limit-average supremum coincide, and then LimAvg(M ) = LimInfAvg(M ) (= LimSupAvg(M )). Note that while limitaverage infimum and supremum exist for all bounded sequences, the limit-average may not. To work around this limitation of limit-average, most applications simply use limitaverage infimum or limit-average supremum of sequences [BCD + 11,CDH10,CHJ05,ZP96]. However, the usage of limit-average infimum or limit-average supremum in lieu of limitaverage for purpose of comparison can be misleading. For example, consider sequence A s.t. LimSupAvg(A) = 2 and LimInfAvg(A) = 0, and sequence B s.t. LimAvg(B) = 1. Clearly, limit-average of A does not exist. So while it is true that LimInfAvg(A) < LimInfAvg(B), indicating that at infinitely many indices the average of prefixes of A is lower, this renders an incomplete picture since at infinitley many indices, the average of prefixes of B is greater as LimSupAvg(A) = 2.

Limit-average comparator
Such inaccuracies in limit-average comparison may occur when the limit-average of at least one sequence does not exist. However, it is not easy to distinguish sequences for which limit-average exists from those for which it doesn't.
We define prefix-average comparison as a relaxation of limit-average comparison. Prefixaverage comparison coincides with limit-average comparison when limit-average 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 limit-average to exist to return intuitive results. Further, we show that the prefix-average comparator is ω-context-free.

5.1.
Limit-average language and comparison. Let Σ = {0, 1, . . . , µ} be a finite alphabet with µ > 0. The limit-average language L LA contains the sequence (word) A ∈ Σ ω iff Vol. 18:3 COMPARATOR AUTOMATA 13:23 its limit-average exists. We begin with the intuition to why limit-average language is neither ω-regular nor ω-context free. The formal argument is available in Theorem 5.1. Suppose L LA were ω-regular, then L LA = n i=0 U i · V ω i , where U i , V i ⊆ Σ * are regular languages over finite words. The limit-average of sequences is determined by its behavior in the limit, so limit-average of sequences in V ω i 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 ∈ V ω i s.t the average of its prefixes oscillates between l 1 and l 2 . This cannot occur, since limit-average of w exists. Let the average of sequences in V i be a i , then limit-average of sequences in V ω i and U i · V ω i is also a i . This is contradictory since there are sequences with limit-average different from a i . Similarly, since every ω-CFL is represented by n i=1 U i · V ω i for CFLs U i , V i over finite words [CG77], a similar argument proves that L LA is not ω-context-free.
Theorem 5.1. L LA is neither an ω-regular nor an ω-context-free language.
Proof. We first prove that L LA is not ω-regular.
Let us assume that the language L LA is ω-regular. Then there exists a finite number n s.t. L LA = n i=0 U i · V ω i , where U i and V i ∈ Σ * are regular languages over finite words. For all i ∈ {0, 1, . . . n}, the limit-average of any word in U i · V ω i is given by the suffix of the word in V ω i . Since U i · V ω i ⊆ L LA , limit-average exists for all words in U i · V ω i . Therefore, limit-average of all words in V ω i must exist. As discussed above, we conclude that the average of all words in V i must be the same. Furthermore, we know that the limit-average of all words in V ω i must be the same, say LimAvg(w) = a i for all w ∈ V ω i . Then the limit-average of all words in L LA is one of a 0 , a 1 . . . a n . Let a = p q s.t p < q, and a = a i for i ∈ {0, 1, . . . , µ}. Consider the word w = (1 p 0 q−p ) ω . It is easy to see that LimAvg(w) = a. However, this word is not present in L LA since the limit-average of all words in L LA is equal to a 0 or a 1 . . . or a n . Therefore, our assumption that L LA is an ω-regular language has been contradicted. Next we prove that L LA is not an ω-CFL.
Every ω-context-free language can be written in the form of n i=0 U i · V ω i where U i and V i are context-free languages over finite words. The rest of this proof is similar to the proof for non-ω-regularity of L LA .
In the next section, we will define prefix-average comparison as a relaxation of limitaverage comparison. To show how prefix-average comparison relates to limit-average comparison, we will require the following two lemmas: Quantifiers ∃ ∞ i and ∃ f i denote the existence of infinitely many and only finitely many indices i, respectively. Proof. Let the limit-average of sequences A, B be L a , L b respectively. Since the limit average of both A and B exists, for every > 0, there exists N s.t. for all n > N , |Avg(A [1, n]) − L a | < and |Avg(B [1, n] Let L a − L b = k > 0. Let us take = k 4 . Then, for all n > N k 4 , we get that investigate applications where reductions using ω-context-free comparators require decidable operations such as membership.

Concluding remarks
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 all ω-regular aggregate functions have ω-regular comparators. However, the converse direction is still open: Are functions with ω-regular comparators also ω-regular? We showed that ω-regular comparators not only yield generic algorithms for problems including quantitative inclusion and winning strategies in incomplete-information quantitative games, they also result in algorithmic advances [BCV21]. We establish that when the weights are represented in unary, the discounted-sum inclusion problem is PSAPCE-complete for integer discount-factor, hence closing a complexity gap. We showed that discounted-sum aggregate function and their comparators are ω-regular iff the discount-factor d > 1 is an integer. We showed that prefix-average comparator are ω-context-free. We believe comparators, especially ω-regular comparators, can be of significant utility in verification and synthesis of quantitative systems [Ban20], as demonstrated by the existence of finite-representation of counterexamples of the quantitative inclusion problem. Another potential application is computing equilibria in quantitative games. Applications of the prefixaverage comparator, in general ω-context-free comparators, is open to further investigation. Another direction to pursue is to study aggregate functions in more detail, and attempt to solve the conjecture relating ω-regular aggregate functions and ω-regular comparators.