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

History-deterministic Parikh Automatathanks: Shibashis Guha was supported by SERB grant SRG/2021/000466. Karoliina Lehtinen was supported by ANR QUASY 23-CE48-0008-01. Martin Zimmermann was supported by by DIREC – Digital Research Centre Denmark.

Enzo Erlich
Université Paris Cité, CNRS, IRIF, F-75013, Paris, France and EPITA Research Laboratory (LRE), Paris, France
Enzo.Erlich@irif.fr
Mario Grobler
University of Bremen, Germany
grobler@uni-bremen.de
Shibashis Guha
Tata Institute of Fundamental Research, Mumbai, India
shibashis.guha@tifr.res.in
Ismaël Jecker
FEMTO-ST, CNRS, Université de Franche-Comté, Besançon, France
ismael.jecker@gmail.com
Karoliina Lehtinen
CNRS, Aix-Marseille University, LIS, Marseille, France
lehtinen@lis-lab.fr
Martin Zimmermann
University of Aalborg, Denmark
mzi@cs.aau.dk
Abstract

Parikh automata extend finite automata by counters that can be tested for membership in a semilinear set, but only at the end of a run. Thereby, they preserve many of the desirable properties of finite automata. Deterministic Parikh automata are strictly weaker than nondeterministic ones, but enjoy better closure and algorithmic properties.

This state of affairs motivates the study of intermediate forms of nondeterminism. Here, we investigate history-deterministic Parikh automata, i.e., automata whose nondeterminism can be resolved on the fly. This restricted form of nondeterminism is well-suited for applications which classically call for determinism, e.g., solving games and composition.

We show that history-deterministic Parikh automata are strictly more expressive than deterministic ones, incomparable to unambiguous ones, and enjoy almost all of the closure properties of deterministic automata. Finally, we investigate the complexity of resolving nondeterminism in history-deterministic Parikh automata.

1 Introduction

Some of the most profound (and challenging) questions of theoretical computer science are concerned with the different properties of deterministic and nondeterministic computation, the P vs. NP problem being arguably the most important and surely the most well-known one. However, even in the more modest setting of automata theory, there is a trade off between deterministic and nondeterministic automata with far-reaching consequences for, e.g., the automated verification of finite-state systems. In the automata-based approach to model checking, for example, one captures a finite-state system 𝒮\mathcal{S} and a specification φ\varphi by automata 𝒜𝒮\mathcal{A}_{\mathcal{S}} and 𝒜φ\mathcal{A}_{\varphi} and then checks whether L(𝒜𝒮)L(𝒜φ)L(\mathcal{A}_{\mathcal{S}})\subseteq L(\mathcal{A}_{\varphi}) holds, i.e., whether every execution of 𝒮\mathcal{S} satisfies the specification φ\varphi. To do so, one tests L(𝒜𝒮)L(𝒜φ)¯L(\mathcal{A}_{\mathcal{S}})\cap\overline{L(\mathcal{A}_{\varphi})} for emptiness. Hence, one is interested in expressive automata models that have good closure and algorithmic properties. Nondeterminism yields succinctness (think DFA’s vs. NFA’s) or even more expressiveness (think pushdown automata) while deterministic automata often have better algorithmic properties and better closure properties (again, think, e.g., pushdown automata).

Limited forms of nondeterminism constitute an appealing middle ground as they often combine the best of both worlds, e.g., increased expressiveness in comparison to deterministic automata and better algorithmic and closure properties than nondeterministic ones. A classical, and well-studied, example are unambiguous automata, i.e., nondeterministic automata that have at most one accepting run for every input. For example, unambiguous finite automata can be exponentially smaller than deterministic ones [35] while unambiguous pushdown automata are more expressive than deterministic ones [29].

Another restricted class of nondeterministic automata is that of residual automata [16], automata where every state accepts a residual language of the automaton’s language. For every regular language there exists a residual automaton. While there exist residual automata that can be exponentially smaller than DFA, there also exist languages for which NFA can be exponentially smaller than residual automata [16].

More recently, another notion of limited nondeterminism has received considerable attention: history-deterministic automata [13, 28]111There is a closely related notion, good-for-gameness, which is often, but not always equivalent [4] (despite frequently being used interchangeably in the past). are nondeterministic automata whose nondeterminism can be resolved based on the run constructed thus far, but independently of the remainder of the input. This property makes history-deterministic automata suitable for composition with games, trees, and other automata, applications which classically require deterministic automata. History-determinism has been studied in the context of regular [1, 28, 33], pushdown [26, 34], quantitative [5, 13], and timed automata [27] (see [6] for a recent survey). For automata that can be determinized, history-determinism offers the potential for succinctness (e.g., co-Büchi automata [33]) while for automata that cannot be determinized, it even offers the potential for increased expressiveness (e.g., pushdown automata [26, 34]). In the quantitative setting, the exact power of history-determinism depends largely on the type of quantitative automata under consideration. So far, it has been studied for quantitative automata in which runs accumulate weights into a value using a value function such as Sum, LimInf, Average, and that assign to a word the supremum among the values of its runs. For these automata, history-determinism turns out to have interesting applications for quantitative synthesis [4]. Here, we continue this line of work by investigating history-deterministic Parikh automata. These are a mildly quantitative form of automata with a significant gap between the expressiveness and algorithmic properties of its deterministic and nondeterministic versions, making it a good candidate for studying restricted forms of nondeterminism, such as history-determinism.

Parikh automata, introduced by Klaedtke and Rueß [32], consist of finite automata, augmented with counters that can only be incremented. A Parikh automaton only accepts a word if the final counter-configuration is within a semilinear set specified in the automaton. As the counters do not interfere with the control flow of the automaton, that is, counter values do not affect whether transitions are enabled, they allow for mildly quantitative computations without the full power of vector addition systems or other more powerful models.

For example the language of words over the alphabet {0,1}\{0,1\} having a prefix with strictly more 11’s than 0’s is accepted by a Parikh automaton that starts by counting the number of 0’s and 11’s and after some prefix nondeterministically stops counting during the processing of the input. It accepts if the counter counting the 11’s is, at the end of the run, indeed larger than the counter counting the 0’s. Note that the nondeterministic choice can be made based on the word processed thus far, i.e., as soon as a prefix with more 11’s than 0’s is encountered, the counting is stopped. Hence, the automaton described above is in fact history-deterministic.

Klaedtke and Rueß [32] showed Parikh automata to be expressively equivalent to a quantitative version of existential weak MSO that allows for reasoning about set cardinalities. Their expressiveness also coincides with that of reversal-bounded counter machines [32], in which counters can go from decrementing to incrementing only a bounded number of times, but in which counters affect control flow [30]. The weakly unambiguous restriction of Parikh automata, that is, those that have at most one accepting run, on the other hand, coincide with unambiguous reversal-bounded counter machines [7]. Parikh automata are also expressively equivalent to weighted finite automata over the groups (k,+,0)(\mathbb{Z}^{k},+,0) [15, 38] for k1k\geqslant 1. This shows that Parikh automata accept a natural class of quantitative specifications.

Despite their expressiveness, nondeterministic Parikh automata retain some decidability: nonemptiness, in particular, is NP-complete [18] and regular separability is decidable [12]. For weakly unambiguous Parikh automata, inclusion is decidable [10]. On the other hand, for deterministic Parikh automata, finiteness, universality, regularity, and model-checking are decidable as well [8, 32]. Figueira and Libkin [18] also argued that Parikh automata are well-suited for querying graph databases, while mitigating some of the complexity issues related with more expressive query languages. Further, they have been used in the model checking of transducer properties [20].

As Parikh automata have been established as a robust and useful model, many variants thereof exist: pushdown (visibly [14] and otherwise [40]), two-way with [14] and without stack [19], unambiguous [9], and weakly unambiguous [7] Parikh automata, to name a few.

Our contributions

We introduce history-deterministic Parikh automata (HDPA) and study their expressiveness, their closure properties, and their algorithmic properties.

Our main result shows that history-deterministic Parikh automata are more expressive than deterministic ones (DPA), but less expressive than nondeterministic ones (PA). Furthermore, we show that they are of incomparable expressiveness to both classes of unambiguous Parikh automata found in the literature, but equivalent to history-deterministic reversal-bounded counter machines, another class of history-deterministic automata that is studied here for the first time. These results show that history-deterministic Parikh automata indeed constitute a novel class of languages capturing quantitative features.

Secondly, we show that history-deterministic Parikh automata satisfy almost the same closure properties as deterministic ones, the only difference being non-closure under complementation. This result has to be contrasted with unambiguous Parikh automata being closed under complement [9, Proposition 5]. Thus, history-determinism is a too strong form of nondeterminism to preserve closure under complementation, a phenomenon that has already been observed in the case of pushdown automata [26, 34].

Further, we study the algorithmic properties of history-deterministic Parikh automata. Most importantly, safety model checking for HDPA is decidable, as it is for PA. The problem asks, given a system and a set of bad prefixes specified by an automaton, whether the system has an execution that has a bad prefix. This allows, for example, to check properties of an arbiter of some shared resource like “the accumulated waiting time between requests and responses of client 1 is always at most twice the accumulated waiting time for client 2 and vice versa”. Note that this property is not ω\omega-regular.

Non-emptiness and finiteness are also both decidable for HDPA (as they are for nondeterministic automata), but universality, inclusion, equivalence, and regularity are not. This is in stark contrast to unambiguous Parikh automata (and therefore also deterministic ones), for which all of these problems are decidable. Further, we show that it is undecidable whether a Parikh automaton is history-deterministic and to decide whether it is equivalent to a history-deterministic one.

Finally, we study the complexity of resolving nondeterminism in HDPA, e.g., the question whether a resolver can be implemented by a DPA. Here, we present a game-theoretic approach, but only obtain a conditional answer.

Note that we consider only automata over finite words here, but many of our results can straightforwardly be transferred to Parikh automata over infinite words, introduced independently by Guha et al. [25] and Grobler et al. [23].

This article is a revised and extended version of an article published at CONCUR 2023 [17], which contains all proofs omitted in the conference version and a new section on resolvers implementable by Parikh automata.

2 Definitions

An alphabet is a finite nonempty set Σ\Sigma of letters. As usual, ε\varepsilon denotes the empty word, Σ\Sigma^{*} denotes the set of finite words over Σ\Sigma, and Σ+\Sigma^{+} denotes the set of finite nonempty words over Σ\Sigma. The length of a finite word ww is denoted by |w||w| and, for notational convenience, we define |w|=|w|=\infty for all infinite words ww. Finally, |w|a|w|_{a} denotes the number of occurrences of the letter aa in a finite word ww.

2.1 Semilinear Sets

We denote the set of nonnegative integers by \mathbb{N}. Given vectors v=(v0,,vd1)d\vec{v}=(v_{0},\ldots,v_{d-1})\in\mathbb{N}^{d} and v=(v0,,vd1)d\vec{v}\,^{\prime}=(v^{\prime}_{0},\ldots,v^{\prime}_{d^{\prime}-1})\in\mathbb{N}^{d^{\prime}}, we define their concatenation vv=(v0,,vd1,v0,,vd1)d+d\vec{v}\cdot\vec{v}\,^{\prime}=(v_{0},\ldots,v_{d-1},v^{\prime}_{0},\ldots,v^{\prime}_{d^{\prime}-1})\in\mathbb{N}^{d+d^{\prime}}. We lift the concatenation of vectors to sets DdD\subseteq\mathbb{N}^{d} and DdD^{\prime}\subseteq\mathbb{N}^{d^{\prime}} via DD={vvvD and vD}D\cdot D^{\prime}=\{\vec{v}\cdot\vec{v}\,^{\prime}\mid\vec{v}\in D\text{ and }\vec{v}\,^{\prime}\in D^{\prime}\}.

Let d1d\geqslant 1. A set CdC\subseteq\mathbb{N}^{d} is linear if there are vectors v0,,vkd\vec{v}_{0},\ldots,\vec{v}_{k}\in\mathbb{N}^{d} such that

C={v0+i=1kcivi|ci for i=1,,k}.C=\left\{\vec{v}_{0}+\sum\nolimits_{i=1}^{k}c_{i}\vec{v}_{i}\>\middle|\>c_{i}\in\mathbb{N}\text{ for }i=1,\ldots,k\right\}.

Furthermore, a subset of d\mathbb{N}^{d} is semilinear if it is a finite union of linear sets.

Example 1.

The sets {(n,n)n}={(0,0)+c(1,1)c}\{(n,n)\mid n\in\mathbb{N}\}=\{(0,0)+c(1,1)\mid c\in\mathbb{N}\} and {(n,2n)n}={(0,0)+c(1,2)c}\{(n,2n)\mid n\in\mathbb{N}\}=\{(0,0)+c(1,2)\mid c\in\mathbb{N}\} are linear, so their union is semilinear. Further, the set {(n,n)n<n}={(0,1)+c1(1,1)+c2(0,1)c1,c2}\{(n,n^{\prime})\mid n<n^{\prime}\}=\{(0,1)+c_{1}(1,1)+c_{2}(0,1)\mid c_{1},c_{2}\in\mathbb{N}\} is linear and thus also semilinear.

Ginsburg and Spanier showed that semilinear sets are closed under the Boolean operators [22] while closure under concatenation can easily be shown by extending the generating vectors with zeroes.

Proposition 1.
  1. 1.

    If C,CdC,C^{\prime}\subseteq\mathbb{N}^{d} are semilinear, then so are CCC\cup C^{\prime}, CCC\cap C^{\prime}, dC\mathbb{N}^{d}\setminus C.

  2. 2.

    If CdC\subseteq\mathbb{N}^{d} and CdC^{\prime}\subseteq\mathbb{N}^{d^{\prime}} are semilinear, then so is CCC\cdot C^{\prime}.

In our proofs, it is sometimes convenient to work with semilinear sets defined by formulas of Presburger arithmetic, i.e., first-order formulas over the structure 𝒩=(,+,<,0,1)\mathcal{N}=(\mathbb{N},+,<,0,1).

Proposition 2 ([21]).

A set CdC\subseteq\mathbb{N}^{d} is semilinear if and only if there is a formula φ(x0,,xd1)\varphi(x_{0},\ldots,x_{d-1}) of Presburger arithmetic with dd free variables such that C={vd𝒩φ(v)}C=\{\vec{v}\in\mathbb{N}^{d}\mid\mathcal{N}\models\varphi(\vec{v})\}.

2.2 Finite Automata

A (nondeterministic) finite automaton (NFA) 𝒜=(Q,Σ,qI,Δ,F)\mathcal{A}=(Q,\Sigma,q_{I},\Delta,F) over Σ\Sigma consists of the finite set QQ of states containing the initial state qIq_{I}, the alphabet Σ\Sigma, the transition relation ΔQ×Σ×Q\Delta\subseteq Q\times\Sigma\times Q, and the set FQF\subseteq Q of accepting states. The NFA is deterministic (i.e., a DFA) if for every state qQq\in Q and every letter aΣa\in\Sigma, there is at most one qQq^{\prime}\in Q such that (q,a,q)(q,a,q^{\prime}) is a transition of 𝒜\mathcal{A}.

A run of 𝒜\mathcal{A} is a (possibly empty) sequence (q0,a0,q1)(q1,a1,q2)(qn1,an1,qn)(q_{0},a_{0},q_{1})(q_{1},a_{1},q_{2})\cdots(q_{n-1},a_{n-1},q_{n}) of transitions with q0=qIq_{0}=q_{I}. It processes the word a0a1an1Σa_{0}a_{1}\cdots a_{n-1}\in\Sigma^{*}, which is the empty word if the run is empty. The run is accepting if it is either empty and the initial state is accepting or if it is nonempty and qnq_{n} is accepting. The language L(𝒜)L(\mathcal{A}) of 𝒜\mathcal{A} contains all finite words wΣw\in\Sigma^{*} such that 𝒜\mathcal{A} has an accepting run processing ww.

2.3 Parikh Automata

Let Σ\Sigma be an alphabet, d1d\geqslant 1, and DD a finite subset of d\mathbb{N}^{d}. Furthermore, let w=(a0,v0)(an1,vn1)w=(a_{0},\vec{v}_{0})\cdots(a_{n-1},\vec{v}_{n-1}) be a word over Σ×D\Sigma\times D. The Σ\Sigma-projection of ww is pΣ(w)=a0an1Σp_{\Sigma}(w)=a_{0}\cdots a_{n-1}\in\Sigma^{*} and its extended Parikh image is Φe(w)=j=0n1vjd\Phi_{e}(w)=\sum_{j=0}^{n-1}\vec{v}_{j}\in\mathbb{N}^{d} with the convention Φe(ε)=0\Phi_{e}(\varepsilon)=\vec{0}, where 0\vec{0} is the dd-dimensional zero vector.

A Parikh automaton (PA) is a pair (𝒜,C)(\mathcal{A},C) such that 𝒜\mathcal{A} is an NFA over Σ×D\Sigma\times D for some input alphabet Σ\Sigma and some finite DdD\subseteq\mathbb{N}^{d} for some d1d\geqslant 1, and CdC\subseteq\mathbb{N}^{d} is semilinear. The language of (𝒜,C)(\mathcal{A},C) consists of the Σ\Sigma-projections of words wL(𝒜)w\in L(\mathcal{A}) whose extended Parikh image is in CC, i.e.,

L(𝒜,C)={pΣ(w)wL(𝒜) with Φe(w)C}.L(\mathcal{A},C)=\{p_{\Sigma}(w)\mid w\in L(\mathcal{A})\text{ with }\Phi_{e}(w)\in C\}.

The Parikh automaton (𝒜,C)(\mathcal{A},C) is deterministic if for every state qq of 𝒜\mathcal{A} and every aΣa\in\Sigma, there is at most one pair (q,v)Q×D(q^{\prime},\vec{v})\in Q\times D such that (q,(a,v),q)(q,(a,\vec{v}),q^{\prime}) is a transition of 𝒜\mathcal{A}. Note that this definition does not coincide with 𝒜\mathcal{A} being a DFA: As mentioned above, 𝒜\mathcal{A} accepts words over Σ×D\Sigma\times D while (𝒜,C)(\mathcal{A},C) accepts words over Σ\Sigma. Therefore, determinism is defined with respect to Σ\Sigma only. Further, (𝒜,C)(\mathcal{A},C) is complete if for every qQq\in Q and every aΣa\in\Sigma, there is a vD\vec{v}\in D and a qQq^{\prime}\in Q such that (q,(a,v),q)Δ(q,(a,\vec{v}),q^{\prime})\in\Delta, i.e., from every state, every letter can be processed. As usual, an incomplete automaton can be completed by adding a fresh non-accepting sink state.

Note that the above definition of L(𝒜,C)L(\mathcal{A},C) coincides with the following alternative definition via accepting runs.

Definition 1.

A run ρ\rho of (𝒜,C)(\mathcal{A},C) is a run

ρ=(q0,(a0,v0),q1)(q1,(a1,v1),q2)(qn1,(an1,vn1),qn)\rho=(q_{0},(a_{0},\vec{v}_{0}),q_{1})(q_{1},(a_{1},\vec{v}_{1}),q_{2})\cdots(q_{n-1},(a_{n-1},\vec{v}_{n-1}),q_{n})

of 𝒜\mathcal{A}. We say that ρ\rho processes the word a0a1an1Σa_{0}a_{1}\cdots a_{n-1}\in\Sigma^{*}, i.e., the vj\vec{v}_{j} are ignored, and that ρ\rho’s extended Parikh image is j=0n1vj\sum_{j=0}^{n-1}\vec{v}_{j}. The run is accepting if it is either empty and both the initial state of 𝒜\mathcal{A} is accepting and the zero vector (the extended Parikh image of the empty run) is in CC, or if it is nonempty, qnq_{n} is accepting, and ρ\rho’s extended Parikh image is in CC. Finally, (𝒜,C)(\mathcal{A},C) accepts wΣw\in\Sigma^{*} if it has an accepting run processing ww.

Example 2.

Consider the deterministic PA (𝒜,C)(\mathcal{A},C) with 𝒜\mathcal{A} in Figure 1 and C={(n,n)n}{(n,2n)n}C=\{(n,n)\mid n\in\mathbb{N}\}\cup\{(n,2n)\mid n\in\mathbb{N}\} (cf. Example 1). It accepts the language {anbnn}{anb2nn}\{a^{n}b^{n}\mid n\in\mathbb{N}\}\cup\{a^{n}b^{2n}\mid n\in\mathbb{N}\}.

a,(1,0)a,(1,0)b,(0,1)b,(0,1)b,(0,1)b,(0,1)
Figure 1: The automaton for Example 2.

Note that there is a closely related automaton model, called constrained automata [8], that has the same expressive power as PA as introduce here [8, Theorem 3.4.]. Here, we mostly work with PA, but we compare unambiguous constrained automata in Subsection 4.1 to history-deterministic PA.

3 History-deterministic Parikh Automata

In this section, we introduce history-deterministic Parikh automata and give examples.

Let (𝒜,C)(\mathcal{A},C) be a PA with 𝒜=(Q,Σ×D,qI,Δ,F)\mathcal{A}=(Q,\Sigma\times D,q_{I},\Delta,F). For a function r:Σ+Δr\colon\Sigma^{+}\rightarrow\Delta we define its iteration r:ΣΔr^{*}\colon\Sigma^{*}\rightarrow\Delta^{*} via r(ε)=εr^{*}(\varepsilon)=\varepsilon and r(a0an)=r(a0an1)r(a0an)r^{*}(a_{0}\cdots a_{n})=r^{*}(a_{0}\cdots a_{n-1})\cdot r(a_{0}\cdots a_{n}). We say that rr is a resolver for (𝒜,C)(\mathcal{A},C) if, for every wL(𝒜,C)w\in L(\mathcal{A},C), r(w)r^{*}(w) is an accepting run of (𝒜,C)(\mathcal{A},C) processing ww. Further, we say that (𝒜,C)(\mathcal{A},C) is history-deterministic (i.e., an HDPA) if it has a resolver.

Example 3.

Fix Σ={0,1}\Sigma=\{0,1\} and say that a word wΣw\in\Sigma^{*} is non-Dyck if |w|0<|w|1|w|_{0}<|w|_{1}. We consider the language NΣ+N\subseteq\Sigma^{+} of words that have a non-Dyck prefix. It is accepted by the PA (𝒜,C)(\mathcal{A},C) where 𝒜\mathcal{A} is depicted in Figure 2 and C={(n,n)n<n}C=\{(n,n^{\prime})\mid n<n^{\prime}\} (cf. Example 1). Intuitively, in the initial state qcq_{c}, the automaton counts the number of 0’s and 11’s occurring in some prefix, nondeterministically decides to stop counting by moving to qnq_{n} (this is the only nondeterminism in 𝒜\mathcal{A}), and accepts if there are more 11’s than 0’s in the prefix.

qcq_{c}qnq_{n}0,(1,0)0,(1,0)1,(0,1)1,(0,1)0,(1,0)0,(1,0)1,(0,1)1,(0,1)0,(0,0)0,(0,0)1,(0,0)1,(0,0)
Figure 2: The automaton for Example 3.

The nondeterministic choice can be made only based on the prefix processed thus far, i.e., as soon as the first non-Dyck prefix is encountered, the resolver proceeds to state qnq_{n}, thereby ending the prefix. Formally, the function

wb{(qc,(b,(1b,b)),qc)if wb has no non-Dyck prefix,(qc,(b,(1b,b)),qn)if wb is non-Dyck, but w has no non-Dyck prefix,(qn,(b,(0,0)),qn)if w has a non-Dyck prefix,wb\mapsto\begin{cases}(q_{c},(b,(1-b,b)),q_{c})&\text{if $wb$ has no non-Dyck prefix,}\\ (q_{c},(b,(1-b,b)),q_{n})&\text{if $wb$ is non-Dyck, but $w$ has no non-Dyck prefix,}\\ (q_{n},(b,(0,0)),q_{n})&\text{if $w$ has a non-Dyck prefix,}\\ \end{cases}

is a resolver for (𝒜,C)(\mathcal{A},C).

Remark 1.

As a resolver resolves nondeterminism and a DPA has no nondeterminism to resolve, every DPA is history-deterministic.

4 Expressiveness

In this section, we study the expressiveness of HDPA by comparing them to related automata models, e.g., deterministic and nondeterministic Parikh automata, unambiguous Parikh automata (capturing another restricted notion of nondeterminism), and reversal-bounded counter machines (which are known to be related to Parikh automata). Overall, we obtain the relations shown in Figure 3, where the additional classes of languages and the separating languages will be introduced throughout this section.

PA/RBCM/HDRBCMWUPAUCADPAHDPA/1-HDRBCMEE (see Page 4)NEN^{\prime}\cup EEE^{\prime} (see Page 4.1)NN^{\prime} (see Page 5)TT (see Page 4.1)TET\cup E
Figure 3: The classes of languages accepted by different models of Parikh automata.

We begin by stating and proving a pumping lemma for HDPA. The basic property used here, just as for the pumping lemmata for PA and DPA [8, Lemma 3.5 and Lemma 3.6], is that shuffling around cycles of a run does not change whether it is accepting or not, as acceptance only depends on the last state of the run being accepting and the vectors (and their multiplicity) that appear on the run, but not the order of their appearance.

Lemma 1.

Let (𝒜,C)(\mathcal{A},C) be an HDPA with L(𝒜,C)ΣL(\mathcal{A},C)\subseteq\Sigma^{*}. Then, there exist p,p,\ell\in\mathbb{N} such that every wΣw\in\Sigma^{*} with |w|>|w|>\ell can be written as w=uvxvzw=uvxvz such that

  • 0<|v|p0<|v|\leqslant p, |x|>p|x|>p, and |uvxv||uvxv|\leqslant\ell, and

  • for all zΣz^{\prime}\in\Sigma^{*}: if uvxvzL(𝒜,C)uvxvz^{\prime}\in L(\mathcal{A},C), then also uv2xzL(𝒜,C)uv^{2}xz^{\prime}\in L(\mathcal{A},C) and uxv2zL(𝒜,C)uxv^{2}z^{\prime}\in L(\mathcal{A},C).

Proof.

Fix some resolver rr for (𝒜,C)(\mathcal{A},C). Note that the definition of a resolver only requires r(w)r^{*}(w) to be a run processing ww for those wL(𝒜,C)w\in L(\mathcal{A},C). Here, we assume without loss of generality that r(w)r^{*}(w) is a run processing ww for each wΣw\in\Sigma^{*}. This can be achieved by completing 𝒜\mathcal{A} (by adding a nonaccepting sink state and transitions to the sink where necessary) and redefining rr where necessary (which is only the case for inputs that cannot be extended to a word in L(𝒜,C)L(\mathcal{A},C)).

A cycle is a nonempty finite run infix

(q0,a0,q1)(q1,a1,q2)(qn1,an1,qn)(qn,an,q0)(q_{0},a_{0},q_{1})(q_{1},a_{1},q_{2})\cdots(q_{n-1},a_{n-1},q_{n})(q_{n},a_{n},q_{0})

starting and ending in the same state and such that the qjq_{j} for j{0,1,,n}j\in\{0,1,\ldots,n\} are all pairwise different. Now, let pp be the number of states of 𝒜\mathcal{A} and let mm be the number of cycles of 𝒜\mathcal{A}. Note that every run infix containing at least pp transitions contains a cycle.

We define =(p+1)(2m+1)\ell=(p+1)(2m+1), consider a word wΣw\in\Sigma^{*} with |w|>|w|>\ell, and let ρ=r(w)\rho=r^{*}(w) be the run of 𝒜\mathcal{A} induced by rr, which processes ww. We split ρ\rho into ρ0ρ1ρ2mρ\rho_{0}\rho_{1}\cdots\rho_{2m}\rho^{\prime} such that each ρj\rho_{j} contains p+1p+1 transitions. Then, each ρj\rho_{j} contains a cycle and there are j0,j1j_{0},j_{1} with j1>j0+1j_{1}>j_{0}+1 such that ρj0\rho_{j_{0}} and ρj1\rho_{j_{1}} contain the same cycle. Now, let

  • ρv\rho_{v} be the cycle in ρj0\rho_{j_{0}} and ρj1\rho_{j_{1}},

  • ρu\rho_{u} be the prefix of ρ\rho before the first occurrence of ρv\rho_{v} in ρj0\rho_{j_{0}}, and

  • ρx\rho_{x} be the infix of ρ\rho between the first occurrences of ρv\rho_{v} in ρj0\rho_{j_{0}} and ρj1\rho_{j_{1}}.

Furthermore, let u,v,xΣu,v,x\in\Sigma^{*} be the inputs processed by ρu\rho_{u}, ρv\rho_{v}, and ρx\rho_{x} respectively. Then, we indeed have 0<|v|p0<|v|\leqslant p (as we consider simple cycles), |x|>p|x|>p (as j1>j0+1j_{1}>j_{0}+1), and |uvxv||uvxv|\leqslant\ell.

Note that ρuρvρxρv\rho_{u}\rho_{v}\rho_{x}\rho_{v}, ρuρv2ρx\rho_{u}\rho_{v}^{2}\rho_{x}, and ρuρxρv2\rho_{u}\rho_{x}\rho_{v}^{2} are all runs of 𝒜\mathcal{A} which process uvxvuvxv, uv2xuv^{2}x, and uxv2uxv^{2} respectively. Furthermore, all three runs end in the same state and their extended Parikh images are equal, as we only shuffled pieces around.

Now, consider some zz^{\prime} such that uvxvzL(𝒜,C)uvxvz^{\prime}\in L(\mathcal{A},C). Then r(uvxvz)r^{*}(uvxvz^{\prime}) is an accepting run, and of the form ρuρvρxρvρz\rho_{u}\rho_{v}\rho_{x}\rho_{v}\rho_{z^{\prime}} for some ρz\rho_{z^{\prime}} processing zz^{\prime}. Now, ρuρv2ρxρz\rho_{u}\rho_{v}^{2}\rho_{x}\rho_{z^{\prime}}, and ρuρxρv2ρz\rho_{u}\rho_{x}\rho_{v}^{2}\rho_{z^{\prime}} are accepting runs of (𝒜,C)(\mathcal{A},C) (although not necessarily induced by rr) processing uv2xzuv^{2}xz^{\prime} and uxv2zuxv^{2}z^{\prime}, respectively. Thus, uv2xzL(𝒜,C)uv^{2}xz^{\prime}\in L(\mathcal{A},C) and uxv2zL(𝒜,C)uxv^{2}z^{\prime}\in L(\mathcal{A},C). ∎

It is instructive to compare our pumping lemma for HDPA to those for PA and DPA [8, Lemma 3.5 and Lemma 3.6]:

  • The pumping lemma for PA states that every long word accepted by a PA can be decomposed into uvxvzuvxvz as above such that both uv2xzuv^{2}xz and uxv2zuxv^{2}z are accepted as well. This statement is weaker than ours, as it only applies to the two words obtained by moving a vv while our pumping lemma applies to any suffix zz^{\prime}. This is possible, as the runs of an HDPA on words of the form uvxvzuvxvz^{\prime} (for fixed uvxvuvxv), induced by a resolver, all coincide on their prefixes processing uvxvuvxv. This is not necessarily the case in PA.

  • The pumping lemma for DPA states that every long word (not necessarily accepted by the automaton) can be decomposed into uvxvzuvxvz as above such that uvxvuvxv, uv2xuv^{2}x, and uxv2uxv^{2} are all equivalent with respect to the Myhill-Nerode equivalence. This statement is stronger than ours, as Myhill-Nerode equivalence is concerned both with the language of the automaton and its complement. But similarly to our pumping lemma, the one for DPA applies to all possible suffixes zz^{\prime}.

Now, we apply the pumping lemma to compare the expressiveness of HDPA, DPA, and PA.

Theorem 1.

HDPA are more expressive than DPA, but less expressive than PA.

Proof.

First, we consider the separation between DPA and HDPA. The language NN from Example 3, which is accepted by an HDPA, is known to be not accepted by any DPA: DPA are closed under complementation [32, Property 4] while the complement of NN is not even accepted by any PA [9, Proposition 11].

To show that PA are more expressive than HDPA, consider the language

E={a,b}{anbnn>0},E=\{a,b\}^{*}\cdot\{a^{n}b^{n}\mid n>0\},

which can easily be seen to be accepted by a PA. We show that EE is not accepted by any HDPA 222Note that the related language {a,b}{an#ann}\{a,b\}^{*}\cdot\{a^{n}\#a^{n}\mid n\in\mathbb{N}\} is not accepted by any DPA [8, Proposition 3.8]. via an application of the pumping lemma.

To this end, assume there is some HDPA (𝒜,C)(\mathcal{A},C) accepting EE, and let p,p,\ell as in the pumping lemma. We pick w=(ap+1bp+1)w=(a^{p+1}b^{p+1})^{\ell}, which we decompose as uvxvzuvxvz with the properties guaranteed by the pumping lemma. In particular, we have |v|p|v|\leqslant p, therefore vab+bav\in a^{*}b^{*}+b^{*}a^{*}. We consider two cases depending on the last letter of vv. In each one, we show the existence of a word zz^{\prime} such that the word uvxvzuvxvz^{\prime} is in the language EE, yet either uv2xzuv^{2}xz^{\prime} or uxv2zuxv^{2}z^{\prime} is not. This yields the desired contradiction to the pumping lemma.

  1. 1.

    First, assume that the last letter of vv is an aa. Since |x|>p|x|>p and xx appears between two copies of vv in (ap+1bp+1)(a^{p+1}b^{p+1})^{\ell}, the infix xvxv contains at least one full bb-block: we have xv=xbp+1akxv=x^{\prime}b^{p+1}a^{k} with x{a,b}x^{\prime}\in\{a,b\}^{*} and 0<kp+10<k\leqslant p+1. We set z=ap+1kbp+1z^{\prime}=a^{p+1-k}b^{p+1}. Hence, uvxvz=uvxbp+1ap+1bp+1Euvxvz^{\prime}=uvx^{\prime}b^{p+1}a^{p+1}b^{p+1}\in E. We show that uv2xzEuv^{2}xz^{\prime}\not\in E by differentiating two cases:

    1. (a)

      If v=aiv=a^{i} for some ii, which must satisfy 0<ik0<i\leqslant k, then uv2xzuv^{2}xz^{\prime} is not in EE as it ends with bp+1ap+1ibp+1b^{p+1}a^{p+1-i}b^{p+1}.

    2. (b)

      Otherwise, we must have v=biakv=b^{i}a^{k} with 0<i<p0<i<p. Then, uv2xzuv^{2}xz^{\prime} is not in EE as it ends with bp+1iap+1kbp+1b^{p+1-i}a^{p+1-k}b^{p+1}.

  2. 2.

    Otherwise, the last letter of vv is a bb. Since |x|>p|x|>p and xx appears between two copies of vv in (ap+1bp+1)(a^{p+1}b^{p+1})^{\ell}, the infix xvxv contains at least one full aa-block: we have xv=xap+1bkxv=x^{\prime}a^{p+1}b^{k} with x{a,b}x^{\prime}\in\{a,b\}^{*} and 0<kp+10<k\leqslant p+1. This time we set z=bp+1kz^{\prime}=b^{p+1-k}. Thus, uvxvz=uvxap+1bp+1Euvxvz^{\prime}=uvx^{\prime}a^{p+1}b^{p+1}\in E, and we differentiate two cases to show that uxv2zEuxv^{2}z^{\prime}\notin E:

    1. (a)

      If v=biv=b^{i} for some ii, which must satisfy 0<ip0<i\leqslant p, then uxv2zuxv^{2}z^{\prime} ends with bp+i+1b^{p+i+1}. However, each of its aa-blocks has length p+1p+1, as moving v=biv=b^{i} with ipi\leqslant p does not merge any aa-blocks. Hence, uxv2zuxv^{2}z^{\prime} is not in EE.

    2. (b)

      Otherwise, we must have v=aibkv=a^{i}b^{k} with 0<i<p0<i<p. Then, uxv2zuxv^{2}z^{\prime} is not in EE as it ends with v2z=aibkaibp+1v^{2}z^{\prime}=a^{i}b^{k}a^{i}b^{p+1}.∎

4.1 History-determinism vs. Unambiguity

After having placed history-deterministic Parikh automata strictly between deterministic and nondeterministic ones, we now compare them to unambiguous Parikh automata, another class of automata whose expressiveness lies strictly between that of DPA and PA. In the literature, there are two (nonequivalent) forms of unambiguous Parikh automata. We consider both of them here.

Cadilhac et al. studied unambiguity in Parikh automata in the guise of unambiguous constrained automata (UCA) [9] (recall that (possibly ambiguous) constrained automata are effectively equivalent to PA [8, Theorem 3.4]). Intuitively, an UCA (𝒜,C)(\mathcal{A},C) over an alphabet Σ\Sigma consists of an unambiguous ε\varepsilon-NFA 𝒜\mathcal{A} over Σ\Sigma, say with dd transitions, and a semilinear set CdC\subseteq\mathbb{N}^{d}, i.e., CC has one dimension for each transition in 𝒜\mathcal{A}. It accepts a word wΣw\in\Sigma^{*} if 𝒜\mathcal{A} has an accepting run processing ww (due to unambiguity this run must be unique) such that the Parikh image of the run (recording the number of times each transition occurs in the run) is in CC.

On the other hand, Bostan et al. introduced so-called weakly-unambiguous Parikh automata (WUPA) [7]. Intuitively, a WUPA (𝒜,C)(\mathcal{A},C) over Σ\Sigma is a classical PA as introduced here where every input over Σ\Sigma has at most one accepting run processing it (in the sense of Definition 1), i.e., the vectors labelling the transitions are ignored as described in that definition. Bostan et al. discuss the different definitions of unambiguity and in particular show that every UCA is a WUPA, but that WUPA are strictly more expressive (see Remark 11 of [7] and the references therein). Here, we compare the expressiveness of HDPA to that of UCA and WUPA.

Theorem 2.

The expressiveness of HDPA is neither comparable with that of UCA nor with that of WUPA.

Proof.

The language EE from the proof of Theorem 1 is accepted by an UCA [9, Theorem 12] and thus also by a WUPA, as every UCA can be turned into an equivalent WUPA (again, see Remark 11 of [7]). However, EE is not accepted by any HDPA, as shown in the proof of Theorem 1. This yields the first two separations.

Conversely, consider the language

T={cn0dcn1dcnkdk1,n0=1, and nj+12nj for some 0j<k}.T=\{c^{n_{0}}dc^{n_{1}}d\cdots c^{n_{k}}d\mid k\geqslant 1,n_{0}=1\text{, and }n_{j+1}\neq 2n_{j}\text{ for some }0\leqslant j<k\}.

Baston et al. proved that TT is not accepted by any WUPA, and therefore also not by any UCA. We show that it is accepted by an HDPA, yielding the other two separations.

We start by giving some intuition. Let w=cn0dcn1dcnkdTw=c^{n_{0}}dc^{n_{1}}d\cdots c^{n_{k}}d\in T and let jj^{\prime}\in\mathbb{N} be minimal with nj+12njn_{j^{\prime}+1}\neq 2n_{j^{\prime}}. Then, we have nj=2jn_{j}=2^{j} for all jjj\leqslant j^{\prime}. Our automaton sums up the njn_{j} for even and odd jj and relies on some basic facts about sums of powers of two to accept the language.

Consider, for example, the sums of the 2j2^{j} for even and odd j5j\leqslant 5, respectively. The former is e5=20+22+24=21e_{\leqslant 5}=2^{0}+2^{2}+2^{4}=21 and the latter is o5=21+23+25=42o_{\leqslant 5}=2^{1}+2^{3}+2^{5}=42, We have 2e5=o52\cdot e_{\leqslant 5}=o_{\leqslant 5} as the terms of the second sum are obtained by doubling the terms of the former one. Similarly, we have e6=85=242+1=2o6+1e_{\leqslant 6}=85=2\cdot 42+1=2\cdot o_{\leqslant 6}+1. Obviously, these equations hold for arbitrary bounds, i.e., if jj is odd then we have 2ej=oj2\cdot e_{\leqslant j}=o_{\leqslant j} and if jj is even then we have ej=2oj+1e_{\leqslant j}=2\cdot o_{\leqslant j}+1.

Recall that jj^{\prime} was chosen minimally with nj+12njn_{j^{\prime}+1}\neq 2n_{j^{\prime}}. So, the equations described above hold for all jjj\leqslant j^{\prime}, but they fail to hold for j=j+1j=j^{\prime}+1.333Note that the equation might be satisfied again, e.g., if the error nj+12njn_{j^{\prime}+1}-2n_{j^{\prime}} is compensated by nj+2n_{j^{\prime}+2}. However, this is irrelevant for our argument.

Figure 4 depicts an HDPA 𝒜\mathcal{A} that we show to accept TT. Intuitively, it sums up the njn_{j} for even and odd jj and nondeterministically decides to stop the summation at the end of one such block. In addition to summing up the njn_{j}, 𝒜\mathcal{A} also keeps track of jj by counting the dd’s. Thus, we equip it with the semilinear set

C={(e,o,j)32eo and j is odd}{(e,o,j)3e2o+1 and j is even},C=\{(e,o,j)\in\mathbb{N}^{3}\mid 2\cdot e\neq o\text{ and }j\text{ is odd}\}\cup\{(e,o,j)\in\mathbb{N}^{3}\mid e\neq 2\cdot o+1\text{ and }j\text{ is even}\},

i.e., we check that the above equations were violated.

c,(1,0,0)c,(1,0,0)d,(0,0,1)d,(0,0,1)d,(0,0,1)d,(0,0,1)d,(0,0,1)d,(0,0,1)c,(0,1,0)c,(0,1,0)c,(1,0,0)c,(1,0,0)d,(0,0,1)d,(0,0,1)d,(0,0,1)d,(0,0,1)d,(0,0,0)d,(0,0,0)c,(0,0,0)c,(0,0,0)c,(0,0,0)c,(0,0,0)d,(0,0,0)d,(0,0,0)
Figure 4: The automaton for the language TT.

First, let us argue that (𝒜,C)(\mathcal{A},C) accepts TT. If ww is in TT, then there is an accepting run processing ww that moves to the accepting state as soon as the (j+1)(j^{\prime}+1)-th dd is processed, where jj^{\prime} is defined as above. Whether this is the case only depends on the prefix ending at that position, i.e., the nondeterminism can be resolved by a resolver. Finally, if ww is not in TT, then there are three cases. Either, ww does not start with cdcd, ww does not end with a dd, or it is of the form c1dc2dc4dc2jdc^{1}dc^{2}dc^{4}d\cdots c^{2^{j}}d for some j1j\geqslant 1. In the first two cases, there is no accepting run of the underlying automaton 𝒜\mathcal{A} that processes ww. In the last case, the equations described above are never violated when processing a dd, so whenever a run ends in the accepting state, the extended Parikh image of the run is not in CC. So, (𝒜,C)(\mathcal{A},C) does indeed accept TT and we have argued above that the only nondeterministic choice during any run can be made by a resolver, i.e., (𝒜,C)(\mathcal{A},C) is an HDPA. ∎

Finally, we show that all intersections between the different classes introduced above are nonempty.

Theorem 3.
  1. 1.

    There is a language that is accepted by an HDPA and by an UCA, but not by any DPA.

  2. 2.

    There is a language that is accepted by an HDPA and by a WUPA, but not by any UCA.

  3. 3.

    There is a language that is accepted by a PA, but not by any HDPA nor by any WUPA.

  4. 4.

    There is a language that is accepted by a WUPA, but not by any HDPA nor by any UCA.

Proof.

1.) Consider the language

E={cm{a,b}m1banbnm,n>0}E^{\prime}=\{c^{m}\{a,b\}^{m-1}ba^{n}b^{n}\mid m,n>0\}

and compare it to the language E={a,b}{anbnn>0}E=\{a,b\}^{*}\cdot\{a^{n}b^{n}\mid n>0\} from Theorem 1, which is not accepted by any HDPA and thus also not by any DPA. The intuitive reason is that such an automaton has to guess when the suffix of the form anbna^{n}b^{n} starts, which cannot be done by a resolver. However, by adding the cc’s, which encode the length of the infix before the suffix of the form anbna^{n}b^{n} starts, a resolver can determine when the suffix starts. Note that we also, for reasons that we discuss below, require that the last letter before the suffix of the form anbna^{n}b^{n} is a bb.

qqc,(1,0,0,0)c,(1,0,0,0)a,(0,1,0,0)a,(0,1,0,0)b,(0,1,0,0)b,(0,1,0,0)a,(0,1,0,0)a,(0,1,0,0)b,(0,1,0,0)b,(0,1,0,0)b,(0,1,0,0)b,(0,1,0,0)a,(0,0,1,0)a,(0,0,1,0)a,(0,0,1,0)a,(0,0,1,0)b,(0,0,0,1)b,(0,0,0,1)b,(0,0,0,1)b,(0,0,0,1)b,(0,1,0,0)b,(0,1,0,0)
Figure 5: The automaton for the language EE^{\prime}.

The automaton (𝒜,C)(\mathcal{A},C) with 𝒜\mathcal{A} in Figure 5 and

C={(m,m,n,n)m,n}C=\{(m,m,n,n)\mid m,n\in\mathbb{N}\}

is an HDPA accepting EE^{\prime}. The automaton accepts EE^{\prime} (when viewed as a PA) and the only nondeterministic choice, i.e., when to move to qq can be made based on the prefix processed thus far, i.e., qq has to be reached with the (unique) prefix of the form cm{a,b}m1bc^{m}\{a,b\}^{m-1}b.

Furthermore, consider the NFA 𝒜\mathcal{A}^{\prime} over {a,b,c}\{a,b,c\} obtained from 𝒜\mathcal{A} in Figure 5 by projecting away the vectors on the transitions, which is unambiguous: Every word accepted by 𝒜\mathcal{A}^{\prime} must end with ba+b+ba^{+}b^{+} and the first bb of that suffix has to lead to qq. As the only nondeterminism in the automaton is the choice to go to qq or not, this implies that 𝒜\mathcal{A}^{\prime} has indeed at most one accepting run on every word.

Now, as every vector projected away from 𝒜\mathcal{A} is a unit vector, it is straightforward to give an eleven-dimensional444Note that the automaton in Figure 5 has eleven transitions. semilinear set CC^{\prime} such that (𝒜,C)(\mathcal{A}^{\prime},C^{\prime}) is an UCA accepting EE^{\prime}, i.e., CC^{\prime} simulates CC: CC^{\prime} ensures that the initial cc-labeled self-loop occurs in a run as often as transitions labeled by (0,1,0,0)(0,1,0,0) in Figure 5 occur in the run (this simulates the first two components of vectors in CC being equal). Similarly, CC^{\prime} ensures that the transitions labeled by (0,0,1,0)(0,0,1,0) occur as often as transitions labeled by (0,0,0,1)(0,0,0,1).

Note that requiring a bb in front of the suffix anbna^{n}b^{n} allows us to use the same transition structure for 𝒜\mathcal{A} and 𝒜\mathcal{A}^{\prime}, as both automata make the same nondeterministic choice, i.e., they guess when the suffix of the form anbna^{n}b^{n} starts. Thus, the separation between languages accepted by DPA and languages accepted both by HDPA and UCA can be witnessed by a language where the HDPA and the UCA are essentially the same automaton. Also, they both rely on the same nondeterministic guess, which can be made history-deterministically and unambiguously. Without the bb, the unambiguous automaton would have to guess the start of the longest suffix of the form anbna^{n}b^{n^{\prime}} with nnn\geqslant n^{\prime}, and thus an UCA accepting EE would require a slightly different transition structure than the one shown in Figure 5.

Finally, it remains to argue that EE^{\prime} is not accepted by any DPA. First, let us remark that the pumping argument in the proof of Theorem 1 also shows that the language Eb={a,b}b{anbnn>0}E_{b}=\{a,b\}^{*}\cdot b\cdot\{a^{n}b^{n}\mid n>0\} is not accepted by any HDPA and thus also not by any DPA. Now, we show that a DPA accepting EE^{\prime} can be turned into a DPA accepting EbE_{b}, which yields the desired result.

So, assume there is a DPA (𝒜,C)(\mathcal{A},C) accepting EE^{\prime}, say with 𝒜=(Q,{a,b,c}×D,qI,Δ,F)\mathcal{A}=(Q,\{a,b,c\}\times D,q_{I},\Delta,F). For every qQq\in Q let RqR_{q} be the set of runs of 𝒜\mathcal{A} starting in qIq_{I}, processing a word in c+c^{+}, and ending in qq. Furthermore, let

Cq={j=0n1vj(qI,(c,v0),q1)(q1,(c,v1),q2)(qn1,(c,vn1),q)Rq}C_{q}=\left\{\sum\nolimits_{j=0}^{n-1}\vec{v}_{j}\mid(q_{I},(c,\vec{v}_{0}),q_{1})(q_{1},(c,\vec{v}_{1}),q_{2})\cdots(q_{n-1},(c,\vec{v}_{n-1}),q)\in R_{q}\right\}

be the set of extended Parikh images of those runs, which is semilinear [39].

Furthermore, for each qQq\in Q with nonempty RqR_{q} let 𝒜q=(Q,{a,b}×D,q,Δ,F)\mathcal{A}_{q}=(Q,\{a,b\}\times D,q,\Delta^{\prime},F) where Δ\Delta^{\prime} is obtained by removing all cc-transitions from Δ\Delta. Note that each 𝒜q\mathcal{A}_{q} is still deterministic, as we have only changed the initial state and removed transitions. Finally, we define

Cq={vthere exists vCq such that v+vC},C^{\prime}_{q}=\{\vec{v}\mid\text{there exists }\vec{v}\,^{\prime}\in C_{q}\text{ such that }\vec{v}+\vec{v}\,^{\prime}\in C\},

which is again semilinear, as it can be defined by a Presburger formula constructed from Presburger formulas for CqC_{q} and CC (see Proposition 2).

We claim Eb=qL(𝒜q,Cq)E_{b}=\bigcup_{q}L(\mathcal{A}_{q},C_{q}^{\prime}) where qq ranges over all states such that RqR_{q} is nonempty. As DPA are closed under union, this yields the desired contradiction in the form of a DPA for EbE_{b}.

So, consider some wEbw\in E_{b}, i.e., w=wbanbnw=w^{\prime}ba^{n}b^{n} for some n>0n>0 and some w{a,b}w^{\prime}\in\{a,b\}^{*}. Define m=|wb|m=|w^{\prime}b| and note that cmwc^{m}w is in EE^{\prime}, i.e., accepted by (𝒜,C)(\mathcal{A},C). Hence, let ρ\rho be the unique run of (𝒜,C)(\mathcal{A},C) processing cmwc^{m}w, let ρ\rho^{\prime} be the prefix of ρ\rho processing cmc^{m}, and let ρ′′\rho^{\prime\prime} be the suffix processing ww. So, there is some qq (the state ρ\rho^{\prime} ends in, which is equal to the state ρ′′\rho^{\prime\prime} begins with) such that ρRq\rho^{\prime}\in R_{q} and the extended Parikh image v\vec{v}\,^{\prime} induced by ρ\rho^{\prime} is in CqC_{q}. Also, ρ′′\rho^{\prime\prime} is a run of 𝒜q\mathcal{A}_{q} starting in qq and ending in FF. Let v\vec{v} be the extended Parikh image induced by ρ′′\rho^{\prime\prime}. Note that v+v\vec{v}+\vec{v}\,^{\prime} is the extended Parikh image induced by the full run ρ=ρρ′′\rho=\rho^{\prime}\rho^{\prime\prime} that witnesses cmwL(𝒜,C)c^{m}w\in L(\mathcal{A},C), and is therefore in CC. From this we conclude vCq\vec{v}\in C_{q}^{\prime} and therefore that ρ′′\rho^{\prime\prime} is an accepting run of (𝒜q,Cq)(\mathcal{A}_{q},C_{q}^{\prime}) processing ww, i.e., wL(𝒜q,Cq)w\in L(\mathcal{A}_{q},C_{q}^{\prime}) and RqR_{q} is nonempty as witnessed by ρ\rho^{\prime}.

For the other direction, consider a wL(𝒜q,Cq)w\in L(\mathcal{A}_{q},C_{q}^{\prime}) for some qq with nonempty RqR_{q}. Then there is an accepting run ρ′′\rho^{\prime\prime} of (𝒜q,Cq)(\mathcal{A}_{q},C_{q}^{\prime}) processing ww, say with induced extended Parikh image vCq\vec{v}\in C_{q}^{\prime}. By construction, there is also a vCq\vec{v}\,^{\prime}\in C_{q} such that v+vC\vec{v}+\vec{v}\,^{\prime}\in C. Furthermore, v\vec{v^{\prime}} is the extended Parikh image induced by some run ρ\rho^{\prime} of (𝒜,C)(\mathcal{A},C) processing some word of the form cmc^{m}. Now, ρρ′′\rho^{\prime}\rho^{\prime\prime} is a run of (𝒜,C)(\mathcal{A},C) starting in the initial state, processing cmwc^{m}w, ending in FF, and with extended Parikh image v+vC\vec{v}+\vec{v}\,^{\prime}\in C, i.e., it is an accepting run. Hence, cmwL(𝒜,C)=Ec^{m}w\in L(\mathcal{A},C)=E^{\prime}. As ww does not contain any cc ((𝒜q,Cq)(\mathcal{A}_{q},C_{q}^{\prime}) has no cc-transitions), this implies that ww must be of the form wbanbnw^{\prime}ba^{n}b^{n} with w{a,b}m1w^{\prime}\in\{a,b\}^{m-1}, i.e., wEbw\in E_{b} as required.

2.) Recall that we say that w{0,1}w\in\{0,1\}^{*} is non-Dyck if |w|0<|w|1|w|_{0}<|w|_{1}. Now, consider the language

N={cnww=a0ak{0,1},|w|n, and a0an1 is non-Dyck},N^{\prime}=\{c^{n}w\mid w=a_{0}\cdots a_{k}\in\{0,1\}^{*},|w|\geqslant n,\text{ and }a_{0}\cdots a_{n-1}\text{ is non-Dyck}\},

which is a variation of the language NN of words that have a non-Dyck prefix. In NN^{\prime}, the length of that prefix is given by the number of cc’s in the beginning of the word, which makes accepting the language easier. Nevertheless, Cadilhac et al. showed that NN^{\prime} is not accepted by any UCA [9, Proposition 14], but Bostan et al. showed that it is accepted by a WUPA [7, Remark 11].

qqc,(0,0,1)c,(0,0,1)0,(1,0,0)0,(1,0,0)1,(0,1,0)1,(0,1,0)0,(1,0,0)0,(1,0,0)1,(0,1,0)1,(0,1,0)0,(0,0,0)0,(0,0,0)1,(0,0,0)1,(0,0,0)0,(0,0,0)0,(0,0,0)1,(0,0,0)1,(0,0,0)
Figure 6: The automaton for the language NN^{\prime}.

In particular, it is accepted by the PA (𝒜,C)(\mathcal{A},C) where 𝒜\mathcal{A} is depicted in Figure 6 and with

C={(n,n,n+n)n<n}.C=\{(n,n^{\prime},n+n^{\prime})\mid n<n^{\prime}\}.

Note that (𝒜,C)(\mathcal{A},C) is both an HDPA and a WUPA for L(𝒜,C)L(\mathcal{A},C): every word cnwc^{n}w in NN^{\prime} has at most one accepting run, the one which leaves qq with the (2n+1)(2n+1)-th letter of cnwc^{n}w (if this letter exists). Furthermore, this choice can be made by a resolver, as the number of cc at the start of the word uniquely determines when this nondeterministic choice has to be made.

3.) The (disjoint) union TET\cup E is accepted by some PA, as both TT and EE are accepted by a PA and PA are closed under union. But it is neither accepted by any HDPA nor by any WUPA, as both models are closed under intersection555For WUPA, this was claimed by Bostan et al. [7], for HDPA this is shown in Theorem 5 on Page 5., i.e., (TE){a,b}=E(T\cup E)\cap\{a,b\}^{*}=E and (TE){c,d}=T(T\cup E)\cap\{c,d\}^{*}=T yield the desired separations.

4.) The (disjoint) union NEN^{\prime}\cup E is accepted by some WUPA (as WUPA are closed under disjoint unions) but not by any HDPA nor by any UCA, as both classes are closed under intersection. Thus, (NE){0,1,c}=N(N^{\prime}\cup E)\cap\{0,1,c\}^{*}=N^{\prime} and (NE){a,b}(N^{\prime}\cup E)\cap\{a,b\}^{*} yield the desired separations. ∎

4.2 History-deterministic Reversal-bounded Counter Machines

There is one more automaton model that is closely related to Parikh automata, i.e., reversal-bounded counter machines, originally introduced by Ibarra [30]. These are, in their most general form, two-way automata with multiple counters that can be incremented, decremented, and tested for zero, but there is a fixed bound on the number of reversals of the reading head and on the number of switches between increments and decrements (on each counter). It is known that Parikh automata and nondeterministic reversal-bounded counter machines are equivalent [31, Property 8], while deterministic reversal-bounded counter machines are strictly more expressive than deterministic Parikh automata [8, Proposition 3.14]. Here, we compare history-deterministic reversal-bounded counter machines and history-deterministic Parikh automata (and, for technical reasons, also history-deterministic Parikh automata with ε\varepsilon-transitions).

We begin by introducing counter machines and then their reversal-bounded variant. A (two-way) counter machine is a tuple =(k,Q,Σ,,,qI,Δ,F)\mathcal{M}=(k,Q,\Sigma,\rhd,\lhd,q_{I},\Delta,F) where kk\in\mathbb{N} is the number of counters, QQ is the finite set of states, Σ\Sigma is the alphabet, ,Σ\rhd,\lhd\notin\Sigma are the left and right endmarkers respectively, qIQq_{I}\in Q is the initial state,

Δ(Q×Σ×{0,1}k)×(Q×{1,0,1}×{1,0,1}k)\Delta\subseteq(Q\times\Sigma_{\rhd\hskip-2.27626pt\lhd}\times\{0,1\}^{k})\times(Q\times\{-1,0,1\}\times\{-1,0,1\}^{k})

is the transition relation, and FQF\subseteq Q is the set of accepting states. Here, we use the shorthand Σ=Σ{,}\Sigma_{\rhd\hskip-2.27626pt\lhd}=\Sigma\cup\{\rhd,\lhd\}. Intuitively, a transition ((q,a,g),(q,m,v))((q,a,\vec{g}),(q^{\prime},m,\vec{v})) is enabled if the current state is qq, the current letter on the tape is aa, and for each 0jk10\leqslant j\leqslant k-1, the jj-th entry in the guard g\vec{g} is nonzero if and only if the current value of counter jj is nonzero. Taking this transition updates the state to qq^{\prime}, moves the head in direction mm, and adds the jj-th entry of v\vec{v} to counter jj.

We require that all transitions ((q,a,g),(q,m,v))Δ((q,a,\vec{g}),(q^{\prime},m,\vec{v}))\in\Delta satisfy the following properties:

  • If a=a=\rhd, then m0m\geqslant 0: the head never leaves the tape to the left.

  • If a=a=\lhd, then m0m\leqslant 0: the head never leaves the tape to the right.

  • g\vec{g} and v\vec{v} are compatible, i.e. if the jj-th entry of g\vec{g} is zero, then the jj-th entry of v\vec{v} is nonnegative: a zero counter is not decremented.

A configuration of \mathcal{M} on an input wΣw\in\Sigma^{*} is of the form (q,w,h,c)(q,\rhd w\lhd,h,\vec{c}) where qQq\in Q is the current state, w\rhd w\lhd is the content of the tape (which does not change during a run), 0h|w|+10\leqslant h\leqslant|w|+1 is the current position of the reading head, and ck\vec{c}\in\mathbb{N}^{k} is the vector of current counter values. The initial configuration on wΣw\in\Sigma^{*} is (qI,w,0,0)(q_{I},\rhd w\lhd,0,\vec{0}), where 0\vec{0} is the kk-dimensional zero vector.

We say that a vector ck\vec{c}\in\mathbb{N}^{k} satisfies a guard g{0,1}k\vec{g}\in\{0,1\}^{k} if the following is satisfied for every 1jk1\leqslant j\leqslant k: the jj-th entry of c\vec{c} is zero if and only if the jj-th entry of g\vec{g} is zero. Now, we write (q,w,h,c)(q,w,h+m,c+v)(q,\rhd w\lhd,h,\vec{c})\Rightarrow(q^{\prime},\rhd w\lhd,h+m,\vec{c}+\vec{v}) if there is a transition ((q,a,g),(q,m,v))Δ((q,a,\vec{g}),(q^{\prime},m,\vec{v}))\in\Delta such that c\vec{c} satisfies g\vec{g}, where aa is the hh-th letter of w\rhd w\lhd.

A run of \mathcal{M} on an input ww is a sequence of configurations ρ=S0S1Sn\rho=S_{0}S_{1}\cdots S_{n} such that S0S_{0} is the initial configuration on ww and SjSj+1S_{j}\Rightarrow S_{j+1} for every 0j<n0\leqslant j<n. The run ρ\rho is accepting if the state of SnS_{n} is in FF. The language accepted by \mathcal{M}, denoted by L()L(\mathcal{M}), is the set of words wΣw\in\Sigma^{*} such that there exists an accepting run of \mathcal{M} on ww.

Remark 2.

A run on some given wΣw\in\Sigma^{*} is fully described by the sequence of transitions between its configurations. However, not every sequence of transitions induces a run.

A counter machine \mathcal{M} is deterministic if, for every qQq\in Q, aΣa\in\Sigma_{\rhd\hskip-2.27626pt\lhd} and g{0,1}k\vec{g}\in\{0,1\}^{k}, there is at most one triple (q,m,v)Q×{1,0,1}×{1,0,1}k(q^{\prime},m,\vec{v})\in Q\times\{-1,0,1\}\times\{-1,0,1\}^{k} such that ((q,a,g),(q,m,v))Δ((q,a,\vec{g}),(q^{\prime},m,\vec{v}))\in\Delta.

The problem with counter machines is that even their deterministic variants are Turing-complete [30, Theorem 3.3]. Therefore, one must impose some restrictions in order to obtain decidability of some decision problems. One way to do that is to introduce bounds on the number of reversals of the direction the reading head moves and on the number of reversals of the stack height of each counter.

More formally, consider a run ρ\rho given by a finite sequence ((qn,an,gn),(qn+1,mn,vn))n((q_{n},a_{n},\vec{g_{n}}),(q_{n+1},m_{n},\vec{v_{n}}))_{n} of transitions. The number of reversals of the reading head during ρ\rho is the number of sign alternations in the sequence (mn)n(m_{n})_{n}, ignoring the 0’s. The number of reversals of the jj-th counter during ρ\rho is the number of sign alternations in the sequence (vn,j)n(v_{n,j})_{n}, where vn,jv_{n,j} is the jj-th entry of vn\vec{v_{n}}, again ignoring the 0’s. A counter machine \mathcal{M} is reversal-bounded if there exists a bb\in\mathbb{N} such that every accepting run has at most bb reversals of the reading head and at most bb reversals of each counter.

We write RBCM for reversal-bounded counter machines and 1-RBCM for RBCM that do not make a reversal of the reading head (i.e., they are one-way). Their deterministic variants are denoted by DRBCM and 1-DRBCM, respectively.

Proposition 3.
  1. 1.

    Every RBCM can be effectively turned into an equivalent 1-RBCM [30, Theorem 2.2].

  2. 2.

    Every RBCM can be effectively turned into an equivalent one where the number of reversals of each counter is bounded by 11. This construction preserves determinism and one-wayness [2, Theorem 5].

Hence, in the following, we assume that during each run of an RBCM, each counter reverses at most once.

Proposition 4.
  1. 1.

    RBCM are as expressive as PA [31, Property 8].

  2. 2.

    1-DRBCM are strictly more expressive than DPA [8, Proposition 3.14].

In the following, we determine the relation between history-deterministic RBCM and HDPA. To this end, we first have to define the notion of history-determinism for RBCM, which is slightly technical due to the two-wayness of these machines.

Let =(k,Q,Σ,,,qI,Δ,F)\mathcal{M}=(k,Q,\Sigma,\rhd,\lhd,q_{I},\Delta,F) be an RBCM. Given a sequence τ0τj\tau_{0}\cdots\tau_{j} of transitions inducing a run ρ\rho, let pos(τ0τj)\mathrm{pos}(\tau_{0}\cdots\tau_{j}) be the position of the reading head at the end of ρ\rho, so in particular pos(ε)=0\mathrm{pos}(\varepsilon)=0. Hence, (w)pos(τ0τ1τj)(\rhd w\lhd)_{\mathrm{pos}(\tau_{0}\tau_{1}\cdots\tau_{j})} is the letter the reading head is currently pointing to. A resolver for \mathcal{M} is a function r:Δ×ΣΔr\colon\Delta^{*}\times\Sigma_{\rhd\hskip-2.27626pt\lhd}\rightarrow\Delta such that if ww is accepted by \mathcal{M}, there is a sequence of transitions τ0τ1τn1\tau_{0}\tau_{1}\cdots\tau_{n-1} such that

  • τj+1=r(τ0τ1τj,(w)pos(τ0τ1τj))\tau_{j+1}=r(\tau_{0}\tau_{1}\cdots\tau_{j},(\rhd w\lhd)_{\mathrm{pos}(\tau_{0}\tau_{1}\cdots\tau_{j})}) for all 0j<n10\leqslant j<n-1, and

  • the sequence of transitions τ0τ1τn1\tau_{0}\tau_{1}\cdots\tau_{n-1} induces an accepting run of \mathcal{M} on ww.

An RBCM \mathcal{M} is history-deterministic (an HDRBCM) if there exists a resolver for \mathcal{M}. One-way HDRBCM are denoted by 1-HDRBCM.

Now, we are able to state the main theorem of this subsection: History-deterministic two-way RBCM are as expressive as RBCM and PA while history-deterministic one-way RBCM are as expressive as history-deterministic PA.

Theorem 4.
  1. 1.

    HDRBCM are as expressive as RBCM, and therefore as expressive as PA.

  2. 2.

    1-HDRBCM are as expressive as HDPA.

Proof.

The proof of the first equivalence is very general and not restricted to RBCM: A two-way automaton over finite inputs can first read the whole input and then resolve nondeterministic choices based on the whole word. Spelt out more concisely: two-wayness makes history-determinism as powerful as general nondeterminism.

For the other equivalence, both directions are nontrivial: We show how to simulate a PA using an RBCM while preserving history-determinism, and how to simulate a 1-RBCM by a PA, again while preserving history-determinism. Due to the existence of transitions that do not move the reading head in a 1-RBCM, this simulation takes a detour via PA with ε\varepsilon-transitions.

1.) It is immediate from the definition that RBCM are at least as expressive as HDRBCM. Thus, we show that for any RBCM, one can construct an equivalent HDRBCM.

Let \mathcal{M} be an RBCM. We construct an RBCM \mathcal{M}^{\prime} from \mathcal{M} as follows: first, the reading head moves right up to the right endmarker. Then, it moves back left to the left endmarker, and then behaves like \mathcal{M} on the input. During the initial scan, it leaves the counters unchanged. It is clear that \mathcal{M}^{\prime} is equivalent to \mathcal{M}, as once the initial scan is finished, it behaves like \mathcal{M}.

Furthermore, \mathcal{M}^{\prime} is history-deterministic since, after the initial scan, which is deterministic, a resolver has access to the whole input and can, for accepted words, fix one accepting run for the input, and then resolve the nondeterminism accordingly. This is possible, since the sequence of transitions seen during the initial scan is unique for every possible input, and the resolver can base its choices on that information.

2.) We first show how to turn an HDPA into an equivalent 1-RBCM and then show that it is history-deterministic. This construction is inspired by the constructions turning a PA into an equivalent 1-RBCM [32, Property 8] and turning a DPA into an equivalent 1-DRBCM [8, Proposition 3.14].

Given an HDPA (𝒜,C)(\mathcal{A},C), the simulating counter machine \mathcal{M} works in two phases. In the first phase, \mathcal{M} simulates the run of (𝒜,C)(\mathcal{A},C) (using the same states as (𝒜,C)(\mathcal{A},C)) and computes the extended Parikh image of the simulated run using its counters. Hence, in the first phase, there is a bijection between the runs of (𝒜,C)(\mathcal{A},C) and \mathcal{M}. If the simulated run does not end in an accepting state, then the run of \mathcal{M} ends in a rejecting state after the first phase. However, if the run ends in an accepting state, then the second phase begins.

In this case, acceptance of (𝒜,C)(\mathcal{A},C) depends on whether the extended Parikh image of the run (stored in the counter values of \mathcal{M}) is in CC. We can do so using the following result due to Cadilhac et al. [8, Proposition 3.13]: membership in a given semilinear set can be tested by a DRBCM that does not move its reading head. More formally they showed that for every semilinear set CdC^{\prime}\subseteq\mathbb{N}^{d}, there exists a DRBCM C\mathcal{M}_{C^{\prime}} such that, for any configuration S0=(qI,w,i,v0)S_{0}=(q_{I},\rhd w\lhd,i,\vec{v}\cdot\vec{0}) with vd\vec{v}\in\mathbb{N}^{d}, the unique run of C\mathcal{M}_{C^{\prime}} starting from S0S_{0} is accepting if and only if vC\vec{v}\in C^{\prime}. Moreover, C\mathcal{M}_{C^{\prime}} does not move its reading head. Note that C\mathcal{M}_{C^{\prime}} will in general use more than dd counters. In the configuration S0S_{0}, the first dd counters contain the vector to be checked, and the remaining ones are initialized with zero. This is exactly the situation after the first phase of the simulation of the HDPA described above has finished. Thus, in the second phase, we run DRBCM C\mathcal{M}_{C} to check whether the extended Parikh image of the simulated run of (𝒜,C)(\mathcal{A},C) stored in the counter values of the simulating run of \mathcal{M} is in CC.

As there is a bijection between runs of (𝒜,C)(\mathcal{A},C) and the runs of \mathcal{M} restricted to their first phase, it is straightforward to argue that \mathcal{M} accepts L(𝒜,C)L(\mathcal{A},C). Furthermore, \mathcal{M} is one-way, as (𝒜,C)(\mathcal{A},C) is one-way by definition, which implies that the first phase of the simulation is one-way as well, while the head does not move in the second phase.

It remains to argue that the resulting 1-RBCM \mathcal{M} is indeed history-deterministic. However, this is straightforward, since it simulates the history-deterministic PA (𝒜,C)(\mathcal{A},C) (recall that there is a bijection between the runs, which can be used to transfer the resolver) and then deterministically checks membership in a semilinear set. Thus, using the bijection, a resolver for (𝒜,C)(\mathcal{A},C) can directly be turned into a resolver for \mathcal{M}.

So, let us consider the other direction, i.e., we turn an 1-HDRBCM \mathcal{M} into an equivalent HDPA (𝒜,C)(\mathcal{A},C). To do so, we proceed in three steps:

Step 1)

We turn \mathcal{M} into a 1-HDRBCM \mathcal{M}^{\prime} in a normal form that requires an RBCM to only terminate with the reading head at the right endmarker and all counters being zero (recall that a PA can only test for membership in the semilinear set at the end of a run).

Step 2)

We turn the 1-HDRBCM \mathcal{M}^{\prime} into an equivalent ε\varepsilon-HDPA.

Step 3)

We show how to eliminate ε\varepsilon-transitions from PA while preserving history-determinism.

Step 1) A 1-RBCM \mathcal{M} is in normal form if the following conditions are satisfied:

  1. 1.

    Let ((q,a,g),(q,m,v))((q,a,\vec{g}),(q^{\prime},m,\vec{v})) be a transition of \mathcal{M} such that qq^{\prime} is not final. Then, ((q,a,g),(q,m,v))((q,a,\vec{g}\hskip 1.42271pt^{\prime}),(q^{\prime},m,\vec{v})) is also a transition of \mathcal{M} for every g{0,1}k\vec{g}\hskip 1.42271pt^{\prime}\in\{0,1\}^{k} that is compatible with v\vec{v}, i.e. \mathcal{M} does not test the counters during the run, but transitions that would decrement from a zero counter are still not allowed.

  2. 2.

    Let ((q,a,g),(q,m,v))((q,a,\vec{g}),(q^{\prime},m,\vec{v})) be a transition of \mathcal{M} such that qq^{\prime} is final. Then, a=a=\lhd, g=0\vec{g}=\vec{0}, and v=0\vec{v}=\vec{0}, i.e. \mathcal{M} only accepts an input on the right endmarker and with all counters equal to zero.

  3. 3.

    Accepting states do not have any outgoing transitions.

We show how to turn a 1-RBCM into an equivalent one in normal form while preserving history-determinism.

It is easy to ensure the second and third conditions, since every 1-RBCM can be turned into an equivalent one that, upon reaching an accepting state, deterministically moves to the right endmarker and empties its counters, and then reaches a fresh accepting state without outgoing transitions. This also preserves history-determinism.

For the first condition, let \mathcal{M} be a 1-RBCM meeting the other two conditions. Also, recall that we assume, again without loss of generality, that every counter reverses at most once. We construct \mathcal{M}^{\prime} that simulates \mathcal{M} and instead of testing counters for zero it guesses the outcome of a test and verifies the guesses at the end of the run. The ability to postpone these tests crucially relies on the fact that every counter reverses at most once.

For every counter, \mathcal{M}^{\prime} stores in its states one of the following statuses:

INI

the counter has neither been increment nor decremented.

INC

the counter has been incremented but not yet decremented.

DEC

the counter has been incremented, decremented, but is still assumed to be nonzero.

ZERO

the counter has been guessed to be zero.

At the beginning, all the counters are in status INI. Then, when a counter has status INI or INC and is incremented, then, its new status is INC. If the status is INC or DEC and the counter is decremented, its status is nondeterministically updated to DEC or ZERO. Intuitively, it should be updated to DEC as long as the true counter value is nonnegative and to ZERO if the true value is zero. A counter with status ZERO cannot be decremented (as it is assumed to be zero) nor incremented (as there is at most one reversal, and the status cannot be changed anymore. This implies that the value of the corresponding counter can no longer be updated as soon as its status is changed to ZERO.

Now, \mathcal{M}^{\prime} simulates \mathcal{M}, accounting for tests in guards as follows:

  • If a counter has status INI or ZERO, then its value is assumed to be equal to zero.

  • If a counter has status INC or DEC, then its value is assumed to be positive.

As a counter is no longer updated once its status is ZERO, the guess that the counter is zero is correct if and only if the value of the counter is indeed zero at the end of the run.

As \mathcal{M} satisfies the second condition of the normal form, every accepting run ends with a transition testing all counters for zero. Thus, an accepting state of \mathcal{M} is only reached if all counters are zero (and stay zero after the transition has been taken). So, we equip \mathcal{M}^{\prime} with a transition that checks, after the simulation of \mathcal{M} has finished in an accepting state, whether all counters are zero and have status INI or ZERO. It only accepts if this is the case.

Therefore, \mathcal{M}^{\prime} accepts the same language as \mathcal{M}. In addition, the only nondeterminism introduced in the construction are the guesses whether a counter is zero after a decrement. These can be made history-determinstically since a resolver can keep track of the current values of the counters. Hence, \mathcal{M}^{\prime} is history-deterministic if \mathcal{M} is.

Step 2) Here, we show how to turn a 1-RBCM into an equivalent ε\varepsilon-HDPA while preserving history-determinism. So, let us first introduce the latter type of automaton.

An ε\varepsilon-PA over an alphabet Σ\Sigma and of dimension dd is a tuple (𝒜,C)(\mathcal{A},C), where 𝒜\mathcal{A} is a finite automaton over (Σ{ε})×D(\Sigma\cup\{\varepsilon\})\times D, where ε\varepsilon is the empty word, and where CdC\subseteq\mathbb{N}^{d} is semilinear. Note that this definition does not coincide with the classical notion of ε\varepsilon-NFA, as ε\varepsilon-transitions in 𝒜\mathcal{A} are still labeled by a vector in the second component. The language accepted by (𝒜,C)(\mathcal{A},C) is L(𝒜,C)={pΣ(w)wL(𝒜) and Φe(w)C}L(\mathcal{A},C)=\{p_{\Sigma}(w)\mid w\in L(\mathcal{A})\text{ and }\Phi_{e}(w)\in C\}. Here, we treat pΣp_{\Sigma} as a homomorphism, which implies pΣ(ε)=εp_{\Sigma}(\varepsilon)=\varepsilon. Note that ε\varepsilon-PA are not more expressive than PA, since PA are closed under homomorphisms: Hence, one can treat ε\varepsilon as a ordinary letter and then apply a homomorphism that deletes exactly that letter.

Let (𝒜,C)(\mathcal{A},C) be an ε\varepsilon-PA with 𝒜=(Q,(Σ{ε})×D,qI,Δ,F)\mathcal{A}=(Q,(\Sigma\cup\{\varepsilon\})\times D,q_{I},\Delta,F). Let Δε\Delta_{\varepsilon} be the set of ε\varepsilon-transitions and ΔΣ\Delta_{\Sigma} be the set of Σ\Sigma-transitions of 𝒜\mathcal{A}. A resolver for (𝒜,C)(\mathcal{A},C) is a function r:Σ+ΔεΔΣΔεr:\Sigma^{+}\rightarrow\Delta_{\varepsilon}^{*}\cdot\Delta_{\Sigma}\cdot\Delta_{\varepsilon}^{*} such that the image r(w)r^{*}(w) of rr’s iteration (defined analogously to the case of Parikh automata without ε\varepsilon-transitions in Section 3) is an accepting run processing ww, for every wL(𝒜,C)w\in L(\mathcal{A},C). An ε\varepsilon-PA (𝒜,C)(\mathcal{A},C) is said to be history-deterministic (an ε\varepsilon-HDPA) if there exists a resolver for it.

Now, fix a 1-RBCM \mathcal{M} in normal form, say with kk counters. We construct an equivalent ε\varepsilon-PA (𝒜,C)(\mathcal{A},C) and show that the transformation preserves history-determinism.

Intuitively, 𝒜\mathcal{A} simulates \mathcal{M} and the semilinear set is used to check that all counters of \mathcal{M} are zero after the simulation has ended. However, recall that a PA can only increment its counter while an RBCM can increment and decrement its counters. Hence, 𝒜\mathcal{A} has two counters for each counter jj of \mathcal{M}, one (counter 2j2j) counting the increments and the other one (counter 2j+12j+1) counting the decrements during the simulation. As \mathcal{M} does not test its counters during a run (due to the second condition of the normal form), 𝒜\mathcal{A} only has to test whether the counters are equal to zero in the last configuration of a simulated run. This is the case if and only if the value of counter 2j2j of (𝒜,C)(\mathcal{A},C) is equal to the value of counter 2j+12j+1, for every counter jj of machine. This can easily be expressed by a semilinear set.

As (𝒜,C)(\mathcal{A},C) simulates a run of \mathcal{M} and accepts if all the counters of \mathcal{M} are equal to zero at the end, they both recognise the same language. In addition, this transformation does not add any nondeterminism as the PA simply simulates the run of the 1-RBCM. Therefore, (𝒜,C)(\mathcal{A},C) is history-deterministic if \mathcal{M} is.

Step 3) Finally, we need to show how to eliminate ε\varepsilon-transitions in ε\varepsilon-PA while preserving history-determinism. The construction is similar to one used by Klaedtke and Rueß [31, Theorem 20] to show that Parikh automata are closed under homomorphisms, which also requires the removal of ε\varepsilon-transitions. For the sake of completeness, we present the construction here, as we need to show that it allows us to preserve history-determinism.

Let (𝒜,C)(\mathcal{A},C) be an ε\varepsilon-PA of dimension dd and let φ(x0,,xd1)\varphi(x_{0},\dots,x_{d-1}) be a Presburger formula defining CC (recall Proposition 2). We construct an equivalent PA (𝒜,C)(\mathcal{A}^{\prime},C^{\prime}) by replacing paths that are labeled by εaε\varepsilon^{*}a\varepsilon^{*} by a single aa-transition. However, taking ε\varepsilon-transitions has side-effects, i.e., the extended Parikh image is updated along them. This requires us to account for the effect of taking ε\varepsilon-cycles in the new semilinear set CC^{\prime}. To do so correctly, we need to keep track of (in the extended Parikh image) which ε\varepsilon-cycles could have been traversed during the run of (𝒜,C)(\mathcal{A},C) being simulated by (𝒜,C)(\mathcal{A}^{\prime},C^{\prime}).

A finite run infix ρ\rho is called reduced if no state is repeated in it. Let aΣa\in\Sigma. An ε\varepsilon-aa-ε\varepsilon-path is a run infix of the form ρ0τρ1\rho_{0}\tau\rho_{1} where ρ0\rho_{0} and ρ1\rho_{1} are (possibly empty) sequences of ε\varepsilon-transitions and where τ\tau is a transition labeled by aa. We say that ρ0τρ1\rho_{0}\tau\rho_{1} is reduced if ρ0\rho_{0} and ρ1\rho_{1} are reduced. Note that there are only finitely many reduced ε\varepsilon-aa-ε\varepsilon-paths for every aa. Finally, let {Kd,Kd+1,,Km}\{K_{d},K_{d+1},\ldots,K_{m}\} be the set of ε\varepsilon-cycles of (𝒜,C)(\mathcal{A},C), which is again finite as we only consider simple cycles.

Consider an arbitrary, not necessarily reduced, ε\varepsilon-aa-ε\varepsilon-path ρ0τρ1\rho_{0}\tau\rho_{1}. If it is not reduced, then ρ0\rho_{0} or ρ1\rho_{1} contains an ε\varepsilon-cycle KjK_{j}. Removing this cycle yields a shorter ε\varepsilon-aa-ε\varepsilon-path starting and ending in the same state (but possibly with different extended Parikh image). By repeating this operation (always removing the first cycle in case there are several ones), we turn every ε\varepsilon-aa-ε\varepsilon-path ρ\rho into a reduced ε\varepsilon-aa-ε\varepsilon-path red(ρ)\mathrm{red}(\rho) that still has the same first state and the same last state as the original one, but possibly a different extended Parikh image.

Now, we define 𝒜\mathcal{A}^{\prime} as follows: it has the same states, the same initial state, the same set of accepting states as 𝒜\mathcal{A}, and the same alphabet Σ\Sigma. Furthermore, for every ε\varepsilon-aa-ε\varepsilon-path

ρ=(q0,a0,q1)(qn1,an1,qn)\rho=(q_{0},a_{0},q_{1})\cdots(q_{n-1},a_{n-1},q_{n})

in 𝒜\mathcal{A}, the automaton 𝒜\mathcal{A}^{\prime} has the transition (q0,(a,v)χ(ρ)),qn)(q_{0},(a,\vec{v})\cdot\chi(\rho)),q_{n}), where v\vec{v} is the extended Parikh image of the reduced run red(ρ)\mathrm{red}(\rho) of ρ\rho, and where

χ(ρ)=(bd,bd+1,,bm)\chi(\rho)=(b_{d},b_{d+1},\ldots,b_{m})

is such that bjb_{j} is equal to 11 if KjK_{j} has been removed at least once from ρ\rho to obtain red(ρ)\mathrm{red}(\rho). Otherwise, bjb_{j} is equal to 0. Note that this results in finitely many transitions, as there are only finitely many reduced ε\varepsilon-aa-ε\varepsilon-paths and only finitely many choices for the χ(ρ)\chi(\rho).666Furthermore, it is not hard to see that the construction can be made effective, as one does not have to consider all ε\varepsilon-aa-ε\varepsilon-paths: every transition in 𝒜\mathcal{A}^{\prime} is witnessed by an ε\varepsilon-aa-ε\varepsilon-path of bounded length.

We then define CC^{\prime} by the Presburger formula

φ(x0,,xm)=ydyd+1ymj=dm(xj>0yj>0)φ((x0,,xd1)+j=dmyjvj)\varphi^{\prime}(x_{0},\dots,x_{m})=\exists y_{d}\exists y_{d+1}\cdots\exists y_{m}\bigwedge_{j=d}^{m}(x_{j}>0\Leftrightarrow y_{j}>0)\wedge\varphi((x_{0},\ldots,x_{d-1})+\sum_{j=d}^{m}y_{j}\cdot\vec{v}_{j})

where vj\vec{v}_{j} is the extended Parikh image of KjK_{j}. The idea is that if a run could have went through the cycle KjK_{j}, then yjy_{j} captures how many times it would have been used. Note that this formula is not a first-order formula, due to the summation of the vectors, but can easily be turned into one by making the addition componentwise. We refrain from doing so for the sake of readability. Also, the multiplication in the formula is not an issue, as we only multiply with constants, which is just repeated addition.

Next, we show that (𝒜,C)(\mathcal{A},C) and (𝒜,C)(\mathcal{A}^{\prime},C^{\prime}) are equivalent. Let us first remark that either both accept the empty word or both reject it. This is because they share the same initial state and same accepting states and because the zero vector is in CC if and only if it is in CC^{\prime}. So, in the following we only have to consider nonempty words.

Let w=a0an1L(𝒜,C)w=a_{0}\cdots a_{n-1}\in L(\mathcal{A},C) with n>0n>0, say with accepting run ρ\rho. Then, ρ\rho can be decomposed into a sequence ρ0ρn1\rho_{0}\cdots\rho_{n-1}, where each ρi\rho_{i} is an ε\varepsilon-aia_{i}-ε\varepsilon-path (the exact splits are irrelevant). Consider one of these ρi\rho_{i}, say it leads from qq to qq^{\prime}. By construction, (𝒜,C)(\mathcal{A}^{\prime},C^{\prime}) has an aia_{i}-transition from qq to qq^{\prime}. These transitions form a run ρ\rho^{\prime} of (𝒜,C)(\mathcal{A}^{\prime},C^{\prime}) processing ww. Note that both runs end in the same state, so ρ\rho^{\prime} ends in an accepting state as well.

Now, χ(ρi)\chi(\rho_{i}) encodes which cycles have been removed from ρi\rho_{i} to obtain red(ρi)\mathrm{red}(\rho_{i}). Hence, taking the first dd components of the extended Parikh image of ρ\rho^{\prime} and adding to it the extended Parikh images of the removed cycles (with their appropriate multiplicity yj>0y_{j}>0) yields the Parikh image of ρ\rho, which is in CC. Hence, the extended Parikh image of ρ\rho^{\prime} is in CC^{\prime}.

Now, assume a0an1L(𝒜,C)a_{0}\cdots a_{n-1}\in L(\mathcal{A}^{\prime},C^{\prime}) with n>0n>0, say with accepting run ρ=τ0τn1\rho^{\prime}=\tau_{0}\cdots\tau_{n-1}. The transition τi\tau_{i} is witnessed by some reduced ε\varepsilon-aia_{i}-ε\varepsilon-path ρi\rho_{i}. These form a run ρ\rho of 𝒜\mathcal{A} processing ww, which ends in an accepting state, as ρ\rho^{\prime} does. Furthermore, we know that the extended Parikh image of ρ\rho^{\prime} is in CC^{\prime}, so there are values yj>0y_{j}>0 for the ε\varepsilon-cycles KjK_{j} such that (x0,,xd1+j=dmyjvj)(x_{0},\ldots,x_{d-1}+\sum_{j=d}^{m}y_{j}\cdot\vec{v}_{j}) is in CC. Hence, we can add each KjK_{j} yjy_{j} times to ρ\rho in order to obtain another accepting run of (𝒜,C)(\mathcal{A},C) that processes ww and has an extended Parikh image in CC.

Finally, we need to show that (𝒜,C)(\mathcal{A}^{\prime},C^{\prime}) is history-deterministic if (𝒜,C)(\mathcal{A},C) is. So, let r:Σ+ΔεΔΣΔεr\colon\Sigma^{+}\rightarrow\Delta_{\varepsilon}^{*}\Delta_{\Sigma}\Delta_{\varepsilon}^{*} be a resolver for (𝒜,C)(\mathcal{A},C). We construct a resolver r:Σ+Δr^{\prime}\colon\Sigma^{+}\rightarrow\Delta^{\prime} for (𝒜,C)(\mathcal{A}^{\prime},C^{\prime}). We can assume without loss of generality that r(wa)r(wa) is an ε\varepsilon-aa-ε\varepsilon-path for every input wawa: if not, then this output cannot be part of an accepting run, which means we can redefine rr arbitrarily so that it satisfies our assumption.

Now, let waΣ+wa\in\Sigma^{+} and let ρ=r(wa)\rho=r(wa), which is an ε\varepsilon-aa-ε\varepsilon-path, say from qq to qq^{\prime}. The reduced ε\varepsilon-aa-ε\varepsilon-path red(ρ)\mathrm{red}(\rho) leads from qq to qq^{\prime} and induces a transition τ\tau of 𝒜\mathcal{A}^{\prime} processing aa. We define r(wa)=τr^{\prime}(wa)=\tau for this transition. Then, an induction on the length of an input word ww shows that the run of (𝒜,C)(\mathcal{A}^{\prime},C^{\prime}) constructed by rr^{\prime} on an input ww is accepting if and only if the run of (𝒜,C)(\mathcal{A},C) constructed by rr on ww is accepting. ∎

Finally, let us remark that HDPA (or equivalently 1-HDRBCM) and deterministic RBCM have incomparable expressiveness. Indeed, the language EE, which is not accepted by any HDPA (see Theorem 1), can easily be accepted by a deterministic RBCM while the language NN (see Example 3) is accepted by an HDPA, but not by any deterministic RBCM. The reason is that these machines are closed under complement, but the complement of NN is not accepted by any PA [9, Proposition 11], and therefore also not by any RBCM.

5 Closure Properties

In this subsection, we study the closure properties of history-deterministic Parikh automata, i.e., we consider Boolean operations, concatenation and Kleene star, (inverse) homomorphic image, and commutative closure. Let us begin by recalling the last three notions.

Fix some alphabet Σ={a0,a1,,ad1}\Sigma=\{a_{0},a_{1},\cdots,a_{d-1}\} with fixed order a0<a1<<ad1a_{0}<a_{1}<\cdots<a_{d-1}. The Parikh image of a word wΣw\in\Sigma^{*} is the vector Φ(w)=(|w|a0,|w|a1,,|w|ad1)\Phi(w)=(|w|_{a_{0}},|w|_{a_{1}},\ldots,|w|_{a_{d-1}}) and the Parikh image of a language LΣL\subseteq\Sigma^{*} is Φ(L)={Φ(w)wL}\Phi(L)=\{\Phi(w)\mid w\in L\}. The commutative closure of LL is {wΣΦ(w)Φ(L)}\{w\in\Sigma^{*}\mid\Phi(w)\in\Phi(L)\}.

Now, fix some alphabets Σ\Sigma and Γ\Gamma and a homomorphism h:ΣΓh\colon\Sigma^{*}\rightarrow\Gamma^{*}. The homomorphic image of a language LΣL\subseteq\Sigma^{*} is h(L)={h(w)wL}Γh(L)=\{h(w)\mid w\in L\}\subseteq\Gamma^{*}. Similarly, the inverse homomorphic image of a language LΓL\subseteq\Gamma^{*} is h1(L)={wΣh(w)L}h^{-1}(L)=\{w\in\Sigma^{*}\mid h(w)\in L\}.

Theorem 5.

HDPA are closed under union, intersection, inverse homomorphic images, and commutative closure, but not under complement, concatenation, Kleene star, and homomorphic image.

Proof.

For i{1,2}i\in\{1,2\}, let (𝒜i,Ci)(\mathcal{A}_{i},C_{i}) be an HDPA with 𝒜i=(Qi,Σ×Di,qIi,Δi,Fi)\mathcal{A}_{i}=(Q_{i},\Sigma\times D_{i},q_{I}^{i},\Delta_{i},F_{i}), say with resolver rir_{i}. Furthermore, let did_{i} be the dimension of DiD_{i}. As in the proof of Lemma 1, we assume without loss generality that ri(w)r^{*}_{i}(w) is a run of 𝒜i\mathcal{A}_{i} processing ww, for every wΣw\in\Sigma^{*}.

First, we consider closure under union. Intuitively, we use a product construction to simulate a run of 𝒜1\mathcal{A}_{1} and a run of 𝒜2\mathcal{A}_{2} simultaneously. A naive approach would be to take the classical product of the 𝒜i\mathcal{A}_{i} where we concatenate the vectors labelling the transitions, and then use C=C1d2d1C2C=C_{1}\cdot\mathbb{N}^{d_{2}}\cup\mathbb{N}^{d_{1}}\cdot C_{2}. However, this is not correct, as this automaton can accept if an accepting state of 𝒜1\mathcal{A}_{1} is reached while the extended Parikh image is in d1C2\mathbb{N}^{d_{1}}\cdot C_{2} or vice versa. To overcome this issue, we reflect in the extended Parikh image which one of the simulated runs ends in an accepting state. To simplify this, we assume, without loss of generality, that the initial states of both 𝒜i\mathcal{A}_{i} do not have incoming transitions.

Now, we define the product 𝒜=(Q1×Q2,Σ×D,(qI1,qI2),Δ,Q1×Q2)\mathcal{A}=(Q_{1}\times Q_{2},\Sigma\times D,(q_{I}^{1},q_{I}^{2}),\Delta,Q_{1}\times Q_{2}) where

  • D={1,2}{1,2}D1D2D=\{1,2\}\cdot\{1,2\}\cdot D_{1}\cdot D_{2}, and

  • Δ={((q1,q2),(a,(f1,f2)v1v2),(q1,q2))(qi,(a,vi),qi)Δi for i{1,2}}\Delta=\{((q_{1},q_{2}),(a,(f_{1},f_{2})\cdot\vec{v}_{1}\cdot\vec{v}_{2}),(q_{1}^{\prime},q_{2}^{\prime}))\mid(q_{i},(a,\vec{v}_{i}),q_{i}^{\prime})\in\Delta_{i}\text{ for }i\in\{1,2\}\}, where fif_{i} for i{1,2}i\in\{1,2\} is defined as follows.

    • If qiq_{i} is the initial state of 𝒜i\mathcal{A}_{i}: If qiFiq_{i}^{\prime}\in F_{i} then fi=2f_{i}=2, otherwise fi=1f_{i}=1.

    • If qiq_{i} is not the initial state of 𝒜i\mathcal{A}_{i}: If qiFiqiFiq_{i}\in F_{i}\Leftrightarrow q_{i}^{\prime}\in F_{i} then fi=2f_{i}=2, otherwise fi=1f_{i}=1.

    Note that this satisfies the following invariant for every nonempty run of 𝒜\mathcal{A}: If w(Σ×D)+w\in(\Sigma\times D)^{+} is the input processed by the run, Φe(w)\Phi_{e}(w) = (f1,f2,)(f_{1},f_{2},\ldots), and the run ends in state (q1,q2)Q1×Q2(q_{1},q_{2})\in Q_{1}\times Q_{2}, then we have fimod2=0f_{i}\bmod 2=0 if and only if qiFiq_{i}\in F_{i}. Thus, it is the values fif_{i} that reflect in the extended Parikh image which of the simulated runs end in an accepting state. Note however, that this only holds for nonempty runs, as we need to initialize the reflection.

Let CεC_{\varepsilon} be the set containing the (2+d1+d2)(2+d_{1}+d_{2})-dimensional zero vector if εL(𝒜1,C1)L(𝒜2,C2)\varepsilon\in L(\mathcal{A}_{1},C_{1})\cup L(\mathcal{A}_{2},C_{2}), and CεC_{\varepsilon} be the empty set otherwise. Then, we define

C={nnmod2=0}C1d2{nnmod2=0}d1C2Cε,C=\{n\in\mathbb{N}\mid n\bmod 2=0\}\cdot\mathbb{N}\cdot C_{1}\cdot\mathbb{N}^{d_{2}}\,\cup\mathbb{N}\cdot\{n\in\mathbb{N}\mid n\bmod 2=0\}\cdot\mathbb{N}^{d_{1}}\cdot C_{2}\cup C_{\varepsilon},

which is semilinear due to Proposition 1. Then, we have L(𝒜,C)=L(𝒜1,C1)L(𝒜2,C2)L(\mathcal{A},C)=L(\mathcal{A}_{1},C_{1})\cup L(\mathcal{A}_{2},C_{2}) and the following function rr is a resolver for (𝒜,C)(\mathcal{A},C): let ri(w)=(qi,(a,vi),qi)r_{i}(w)=(q_{i},(a,\vec{v}_{i}),q_{i}^{\prime}) and define r(w)=((q1,q2),(a,(f1,f2)v1v2),(q1,q2))r(w)=((q_{1},q_{2}),(a,(f_{1},f_{2})\cdot\vec{v}_{1}\cdot\vec{v}_{2}),(q_{1}^{\prime},q_{2}^{\prime})), where (f1,f2)(f_{1},f_{2}) is defined as above.

Now, consider closure under intersection. Here, we take the product 𝒜=(Q1×Q2,Σ×(D1D2),(qI1,qI2),Δ,F1×F2)\mathcal{A}^{\prime}=(Q_{1}\times Q_{2},\Sigma\times(D_{1}\cdot D_{2}),(q_{I}^{1},q_{I}^{2}),\Delta^{\prime},F_{1}\times F_{2}) with

Δ={((q1,q2),(a,v1v2),(q1,q2))(qi,(a,vi),qi)Δi for i{1,2}}\Delta^{\prime}=\{((q_{1},q_{2}),(a,\vec{v}_{1}\cdot\vec{v}_{2}),(q_{1}^{\prime},q_{2}^{\prime}))\mid(q_{i},(a,\vec{v}_{i}),q_{i}^{\prime})\in\Delta_{i}\text{ for }i\in\{1,2\}\}

and define C=C1C2C^{\prime}=C_{1}\cdot C_{2}, which is is semilinear due to Proposition 1. Then, L(𝒜,C)=L(𝒜1,C1)L(𝒜2,C2)L(\mathcal{A}^{\prime},C^{\prime})=L(\mathcal{A}_{1},C_{1})\cap L(\mathcal{A}_{2},C_{2}) and the following function rr is a resolver for (𝒜,C)(\mathcal{A},C): let ri(w)=(qi,(a,vi),qi)r_{i}(w)=(q_{i},(a,\vec{v}_{i}),q_{i}^{\prime}) and define r(w)=((q1,q2),(a,v1v2),(q1,q2))r(w)=((q_{1},q_{2}),(a,\vec{v}_{1}\cdot\vec{v}_{2}),(q_{1}^{\prime},q_{2}^{\prime})).

Now, consider closure under inverse homomorphic images. Klaedtke and Rueß have shown that DPA and PA are effectively closed under inverse homomorphic images [32, Property 4]. We follow their construction to show that HDPA are closed under inverse homomorphic images. In fact, a similar construction is also used to show that regular languages are also closed under inverse homomorphic images [29].

Consider a homomorphism h:ΣΓh:\Sigma^{*}\rightarrow\Gamma^{*}. Given an HDPA (𝒜,C)(\mathcal{A},C) with 𝒜=(Q,Γ×D,qI,Δ,F)\mathcal{A}=(Q,\Gamma\times D,q_{I},\Delta,F), we construct another HDPA (𝒜,C)(\mathcal{A}^{\prime},C) with 𝒜=(Q,Σ×D,qI,Δ,F)\mathcal{A}^{\prime}=(Q,\Sigma\times D^{\prime},q_{I},\Delta^{\prime},F), such that L(𝒜,C)=h1(L(𝒜,C))L(\mathcal{A}^{\prime},C)=h^{-1}(L(\mathcal{A},C)). Note that the set CC is the same in both automata. Intuitively, 𝒜\mathcal{A}^{\prime} processes a letter (a,v)(a,\vec{v}) by simulating a sequence of transitions in 𝒜\mathcal{A} processing (b1,v1),,(bm,vm)(b_{1},\vec{v}_{1}),\dots,(b_{m},\vec{v}_{m}) with h(a)=b1bmh(a)=b_{1}\cdots b_{m}, and v=i=1mvi\vec{v}=\sum_{i=1}^{m}\vec{v}_{i}, for mm\in\mathbb{N}. The NFA 𝒜\mathcal{A}^{\prime} has the same set QQ of states as 𝒜\mathcal{A}, and 𝒜\mathcal{A}^{\prime} has a transition from state pp to state qq with label (a,v)Σ×D(a,\vec{v})\in\Sigma\times D^{\prime} if and only if there is a sequence of transitions labeled with (b1,v1),,(bm,vm)(Γ×D)(b_{1},\vec{v}_{1}),\dots,(b_{m},\vec{v}_{m})\in(\Gamma\times D)^{*} taking 𝒜\mathcal{A} from state pp to state qq, and h(a)=b1bmh(a)=b_{1}\cdots b_{m}, and v=i=1mvi\vec{v}=\sum_{i=1}^{m}\vec{v}_{i}. It is easy to see that the set DD^{\prime} thus obtained is finite, and that (𝒜,C)(\mathcal{A}^{\prime},C) accepts the language h1(L(𝒜,C))h^{-1}(L(\mathcal{A},C)).

We are now left to prove that (𝒜,C)(\mathcal{A}^{\prime},C) is an HDPA. For notational convenience, we lift the definition of Φe\Phi_{e} to the runs of a PA as Φe(ρ)=Φe(w)\Phi_{e}(\rho)=\Phi_{e}(w), where ww is the word processed by ρ\rho. Since (𝒜,C)(\mathcal{A},C) is an HDPA, there exists a resolver rr of (𝒜,C)(\mathcal{A},C). We define a resolver rr^{\prime} for (𝒜,C)(\mathcal{A}^{\prime},C) as follows. Consider a word wL(𝒜,C)w\in L(\mathcal{A}^{\prime},C), and let x=h(w)x=h(w). We have that xL(𝒜,C)x\in L(\mathcal{A},C). Let w=a1amw=a_{1}\cdots a_{m} such that ajΣa_{j}\in\Sigma for 1jm1\leqslant j\leqslant m. We have that h(w)=h(a1)h(am)h(w)=h(a_{1})\cdots h(a_{m}), and let h(aj)=xj,1xj,kjh(a_{j})=x_{j,1}\cdots x_{j,k_{j}} such that each xj,iΓx_{j,i}\in\Gamma for 1ikj1\leqslant i\leqslant k_{j}. We define δj,i=r(h(a1)h(aj1)xj,1xj,i)\delta_{j,i}=r(h(a_{1})\cdots h(a_{j-1})x_{j,1}\cdots x_{j,i}), for 1jm1\leqslant j\leqslant m and 1ikj1\leqslant i\leqslant k_{j}, to be the transition induced by rr after processing the prefix h(a1)h(aj1)xj,1xj,ih(a_{1})\cdots h(a_{j-1})x_{j,1}\cdots x_{j,i} of h(w)h(w). Further, let δj,i=(qj,i1,(xj,i,vj,i),qj,i)\delta_{j,i}=(q_{j,i-1},(x_{j,i},\vec{v}_{j,i}),q_{j,i}). In particular, we have that qj,0q_{j,0} is the state in 𝒜\mathcal{A} before processing xj,1x_{j,1} and qj,kjq_{j,k_{j}} is the state in 𝒜\mathcal{A} after processing xj,kjx_{j,k_{j}}. Then, we define r(a1aj)=(qj,0,(aj,vj),qj,kj)r^{\prime}(a_{1}\cdots a_{j})=(q_{j,0},(a_{j},\vec{v}_{j}),q_{j,k_{j}}), where vj=i=1kjvj,i\vec{v}_{j}=\sum_{i=1}^{k_{j}}\vec{v}_{j,i}.

Recall that wL(𝒜,C)w\in L(\mathcal{A}^{\prime},C) and h(w)=xL(𝒜,C)h(w)=x\in L(\mathcal{A},C). If qfFq_{f}\in F is the state reached after processing xx in (𝒜,C)(\mathcal{A},C) following the accepting run r(x)r^{*}(x), then the same state qfq_{f} is reached after processing ww in (𝒜,C)(\mathcal{A}^{\prime},C) in the run r(w){r^{\prime}}^{*}(w). Besides, the extended Parikh images corresponding to both r(x)r^{*}(x) and r(w){r^{\prime}}^{*}(w) are the same, that is Φe(r(x))=Φe(r(w))\Phi_{e}(r^{*}(x))=\Phi_{e}({r^{\prime}}^{*}(w)). Now since Φe(r(x))\Phi_{e}(r^{*}(x)) belongs to CC, we have that Φe(r(w))\Phi_{e}({r^{\prime}}^{*}(w)) also belongs to CC, and thus r(w){r^{\prime}}^{*}(w) is an accepting run. Hence rr^{\prime} is indeed a resolver for (𝒜,C)(\mathcal{A}^{\prime},C).

Now, let us consider commutative closure. Cadilhac et al. proved that the commutative closure of any PA (and therefore that of any HDPA) is accepted by some DPA [8, Proposition 3.17], and therefore also by some HDPA.

The negative results follow from a combination of expressiveness results proven in Section 4 and nonexpressiveness results in the literature:

  • Complement: In the first part of the proof of Theorem 1, we show that the language NN is accepted by an HDPA, but its complement is known to not be accepted by any PA [9, Proposition 11].

  • Concatenation: The language EE is the concatenation of the languages {a,b}\{a,b\}^{*} and {anbnn}\{a^{n}b^{n}\mid n\in\mathbb{N}\}, which are both accepted by a DPA (and therefore also by HDPA), but itself is not accepted by any HDPA (see the proof of Theorem 1).

  • Kleene star: There is a DPA (and therefore also an HDPA) such that the Kleene star of its language is not accepted by any PA [8, Proposition 3.17], and therefore also by no HDPA.

  • Homomorphic image: The language

    {a,b}{can1bnn>0}\{a,b\}^{*}\cdot\{ca^{n-1}b^{n}\mid n>0\}

    is accepted by the DPA (𝒜,C)(\mathcal{A},C) with 𝒜\mathcal{A} as in Figure 7 and C={(n,n)n>0}C=\{(n,n)\mid n>0\}, and thus also by an HDPA.

    a,(0,0)a,(0,0)b,(0,0)b,(0,0)c,(1,0)c,(1,0)a,(1,0)a,(1,0)b,(0,1)b,(0,1)b,(0,1)b,(0,1)
    Figure 7: The automaton for the language {a,b}{can1bnn>0}\{a,b\}^{*}\cdot\{ca^{n-1}b^{n}\mid n>0\}.

    However, its homomorphic image under the morphism hh uniquely identified by h(a)=h(c)=ah(a)=h(c)=a and h(b)=bh(b)=b is EE, which is not accepted by any HDPA, as shown in Theorem 1.∎

Table 1 compares the closure properties of HDPA with those of DPA, UCA, and PA. We do not compare to RBCM, as only deterministic ones differ from Parikh automata and results on these are incomplete: However, Ibarra proved closure under union, intersection, and complement [30, Lemma 3.1 and Lemma 3.2].

Table 1: Closure properties of history-deterministic Parikh automata (in grey) and comparison to other types of Parikh automata (results for other types are from [8, 9, 32]).
union intersection complement concate- Kleene homo- inverse commutative
nation star morphism homomorphism closure
DPA Y Y Y N N N Y Y
HDPA Y Y N N N N Y Y
UCA Y Y Y N N N ? Y
PA Y Y N Y N Y Y Y

6 Decision Problems

Next, we study various decision problems for history-deterministic PA. First, let us mention that nonemptiness and finiteness are decidable for HDPA, as these problems are decidable for PA [32, Property 6][8, Proposition 3.16]. In the following, we consider universality, inclusion, equivalence, regularity, and model checking.

Our undecidability proofs are reductions from nontermination problems for two-counter machines, using an encoding of two-counter machines by DPA originally developed for PA over infinite words [25].

A two-counter machine \mathcal{M} is a sequence

(0:I0)(1:I1)(k2:Ik2)(k1:STOP),(0:\texttt{I}_{0})(1:\texttt{I}_{1})\cdots(k-2:\texttt{I}_{k-2})(k-1:\texttt{STOP}),

where the first element of a pair (:I)(\ell:\texttt{I}_{\ell}) is the line number and I\texttt{I}_{\ell} for 0<k10\leqslant\ell<k-1 is an instruction of the form

  • INC(Xi)\texttt{INC(X}_{i}\texttt{)} with i{0,1}i\in\{0,1\},

  • DEC(Xi)\texttt{DEC(X}_{i}\texttt{)} with i{0,1}i\in\{0,1\}, or

  • IF Xi=0 GOTO  ELSE GOTO ′′\texttt{IF X}_{i}\texttt{=0 GOTO }\ell^{\prime}\texttt{ ELSE GOTO }\ell^{\prime\prime} with i{0,1}i\in\{0,1\} and ,′′{0,,k1}\ell^{\prime},\ell^{\prime\prime}\in\{0,\ldots,k-1\}.

A configuration of \mathcal{M} is of the form (,c0,c1)(\ell,c_{0},c_{1}) with {0,,k1}\ell\in\{0,\ldots,k-1\} (the current line number) and c0,c1c_{0},c_{1}\in\mathbb{N} (the current contents of the counters). The initial configuration is (0,0,0)(0,0,0) and the unique successor configuration of a configuration (,c0,c1)(\ell,c_{0},c_{1}) is defined as follows:

  • If I=INC(Xi)\texttt{I}_{\ell}=\texttt{INC(X}_{i}\texttt{)}, then the successor configuration is (+1,c0,c1)(\ell+1,c_{0}^{\prime},c_{1}^{\prime}) with ci=ci+1c_{i}^{\prime}=c_{i}+1 and c1i=c1ic_{1-i}^{\prime}=c_{1-i}.

  • If I=DEC(Xi)\texttt{I}_{\ell}=\texttt{DEC(X}_{i}\texttt{)}, then the successor configuration is (+1,c0,c1)(\ell+1,c_{0}^{\prime},c_{1}^{\prime}) with ci=max{ci1,0}c_{i}^{\prime}=\max\{c_{i}-1,0\} and c1i=c1ic_{1-i}^{\prime}=c_{1-i}.

  • If I=IF Xi=0 GOTO  ELSE GOTO ′′\texttt{I}_{\ell}=\texttt{IF X}_{i}\texttt{=0 GOTO }\ell^{\prime}\texttt{ ELSE GOTO }\ell^{\prime\prime} and ci=0c_{i}=0, then the successor configuration is (,c0,c1)(\ell^{\prime},c_{0},c_{1}).

  • If I=IF Xi=0 GOTO  ELSE GOTO ′′\texttt{I}_{\ell}=\texttt{IF X}_{i}\texttt{=0 GOTO }\ell^{\prime}\texttt{ ELSE GOTO }\ell^{\prime\prime} and ci>0c_{i}>0, then the successor configuration is (′′,c0,c1)(\ell^{\prime\prime},c_{0},c_{1}).

  • If I=STOP\texttt{I}_{\ell}=\texttt{STOP}, then (,c0,c1)(\ell,c_{0},c_{1}) has no successor configuration.

The unique run of \mathcal{M} (starting in the initial configuration) is defined as expected. It is either finite (line k1k-1 is reached) or infinite (line k1k-1 is never reached). In the former case, we say that \mathcal{M} terminates.

Proposition 5 ([37]).

The following problem is undecidable: Given a two-counter machine \mathcal{M}, does \mathcal{M} terminate?

In the following, we assume without loss of generality that each two-counter machine satisfies the guarded-decrement property: Every decrement instruction (:DEC(Xi))(\ell:\texttt{DEC(X}_{i}\texttt{)}) is preceded by (1:IF Xi=0 GOTO +1 ELSE GOTO )(\ell-1:\texttt{IF X}_{i}\texttt{=0 GOTO }\ell+1\texttt{ ELSE GOTO }\ell) and decrements are never the target of a goto instruction. As the decrement of a zero counter has no effect, one can modify each two-counter machine \mathcal{M} into an \mathcal{M}^{\prime} satisfying the guarded-decrement property such that \mathcal{M} terminates if and only if \mathcal{M}^{\prime} terminates: One just adds the the required guard before every decrement instruction and changes each target of a goto instruction that is a decrement instruction to the preceding guard.

The guarded-decrement property implies that decrements are only executed if the corresponding counter is nonzero. Thus, the value of counter ii after a finite sequence of executed instructions (starting with value zero in the counters) is equal to the number of executed increments of counter ii minus the number of executed decrements of counter ii. Note that the number of executed increments and decrements can be tracked by a Parikh automaton.

Consider a finite or infinite word w=a0a1a2w=a_{0}a_{1}a_{2}\cdots over the set {0,1,,k1}\{0,1,\ldots,k-1\} of line numbers. We now describe how to characterize whether ww is (a prefix of) the projection to the line numbers of the unique run of \mathcal{M} starting in the initial configuration. This characterization is designed to be checkable by a Parikh automaton. Note that ww only contains line numbers, but does not encode values of the counters. These will be kept track of by the Parikh automaton by counting the number of increment and decrement instructions in the input, as explained above (this explains the need for the guard-decrement property). Formally, we say that ww contains an error at position n<|w|1n<|w|-1 if either an=k1a_{n}=k-1 (the instruction in line ana_{n} is STOP), or if one of the following two conditions is satisfied:

  1. 1.

    The instruction Ian\texttt{I}_{a_{n}} in line ana_{n} of \mathcal{M} is an increment or a decrement and an+1an+1a_{n+1}\neq a_{n}+1, i.e., the letter an+1a_{n+1} after ana_{n} is not equal to the line number an+1a_{n}+1, which it should be after an increment or decrement.

  2. 2.

    Ian\texttt{I}_{a_{n}} has the form IF Xi=0 GOTO  ELSE GOTO \texttt{IF X}_{i}\texttt{=0 GOTO }\ell\texttt{ ELSE GOTO }\ell^{\prime}, and one of the following cases holds: Either, we have

    j:Ij=INC(Xi)|a0an|j=j:Ij=DEC(Xi)|a0an|j\sum\nolimits_{j\colon\texttt{I}_{j}=\texttt{INC(X}_{i}\texttt{)}}|a_{0}\cdots a_{n}|_{j}=\sum\nolimits_{j\colon\texttt{I}_{j}=\texttt{DEC(X}_{i}\texttt{)}}|a_{0}\cdots a_{n}|_{j}

    and an+1a_{n+1}\neq\ell, i.e., the number of increments of counter ii is equal to the number of decrements of counter ii in a0ana_{0}\cdots a_{n} (i.e., the counter is zero) but the next line number in ww is not the target of the if-branch. Or, we have

    j:Ij=INC(Xi)|a0an|jj:Ij=DEC(Xi)|a0an|j,\sum\nolimits_{j\colon\texttt{I}_{j}=\texttt{INC(X}_{i}\texttt{)}}|a_{0}\cdots a_{n}|_{j}\neq\sum\nolimits_{j\colon\texttt{I}_{j}=\texttt{DEC(X}_{i}\texttt{)}}|a_{0}\cdots a_{n}|_{j},

    and an+1a_{n+1}\neq\ell^{\prime}, i.e., the number of increments of counter ii is not equal to the number of decrements of counter ii in a0ana_{0}\cdots a_{n} (i.e., the counter is nonzero) but the next line number in ww is not the target of the else-branch.

Note that the definition of error (at position nn) refers to the number of increments and decrements in the prefix a0ana_{0}\cdots a_{n}, which does not need to be error-free itself. However, if a sequence of line numbers does not have an error, then the guarded-decrement property yields the following result.

Lemma 2.

Let w{0,1,,k1}+w\in\{0,1,\ldots,k-1\}^{+} with a0=0a_{0}=0. Then, ww has no errors at positions {0,1,,|w|2}\{0,1,\ldots,|w|-2\} if and only if ww is a prefix of the projection to the line numbers of the run of \mathcal{M}.

Proof.

If ww has no errors at positions {0,1,,|w|2}\{0,1,\ldots,|w|-2\}, then an induction over nn\in\mathbb{N} shows that (an,c0n,c1n)(a_{n},c_{0}^{n},c_{1}^{n}) with

cin=j:Ij=INC(Xi)|a0an1|jj:Ij=DEC(Xi)|a0an1|jc_{i}^{n}=\sum\nolimits_{j\colon\texttt{I}_{j}=\texttt{INC(X}_{i}\texttt{)}}|a_{0}\cdots a_{n-1}|_{j}-\sum\nolimits_{j\colon\texttt{I}_{j}=\texttt{DEC(X}_{i}\texttt{)}}|a_{0}\cdots a_{n-1}|_{j}

is the nn-th configuration of the run of \mathcal{M}.

On the other hand, projecting a prefix of the run of \mathcal{M} to the line numbers yields a word ww without errors at positions {0,1,,|w|2}\{0,1,\ldots,|w|-2\}. ∎

The existence of an error can be captured by a Parikh automaton, leading to the undecidability of the safe word problem for Parikh automata. Let (𝒜,C)(\mathcal{A},C) be a PA accepting finite words over Σ\Sigma. A safe word of (𝒜,C)(\mathcal{A},C) is an infinite word over Σ\Sigma such that each of its prefixes is in L(𝒜,C)L(\mathcal{A},C).

Guha et al. have shown that the existence of a safe word for PA is undecidable. As we rely on properties of the proof to prove further undecidability results, we give a proof sketch presenting all required details. For the omitted arguments, we refer to [25].

Lemma 3 ([25, Lemma 21]).

The following problem is undecidable: Given a deterministic PA, does it have a safe word?

Proof Sketch.

The proof proceeds by a reduction from the nontermination problem for decrement-guarded two-counter machines. Given such a machine =(0:I0)(k2:Ik2)(k1:STOP)\mathcal{M}=(0:\texttt{I}_{0})\cdots(k-2:\texttt{I}_{k-2})(k-1:\texttt{STOP}) let Σ={0,,k1}\Sigma=\{0,\ldots,k-1\} be the set of its line numbers. One can construct a deterministic PA (𝒜,C)(\mathcal{A}_{\mathcal{M}},C_{\mathcal{M}}) that accepts a word wΣw\in\Sigma^{*} if and only if w=εw=\varepsilon, w=0w=0, or if |w|2|w|\geqslant 2 and ww does not contain an error at position |w|2|w|-2 (but might contain errors at earlier positions). Intuitively, the automaton checks whether the second-to-last instruction is executed properly. The following is then a direct consequence of Lemma 2: (𝒜,C)(\mathcal{A}_{\mathcal{M}},C_{\mathcal{M}}) has a safe word if and only if \mathcal{M} does not terminate.

Intuitively, the deterministic PA (𝒜,C)(\mathcal{A}_{\mathcal{M}},C_{\mathcal{M}}) keeps track of the occurrence of line numbers with increment and decrement instructions of each counter (using four dimensions) and two auxiliary dimensions to ensure that the two cases in Condition 2 of the error definition on Page 2 are only checked when the second-to-last letter corresponds to a goto instruction. All further details of the construction can be found in [25]. ∎

After these preparations, we start with the universality problem.

Theorem 6.

The following problem is undecidable: Given an HDPA (𝒜,C)(\mathcal{A},C) over Σ\Sigma, is L(𝒜,C)=ΣL(\mathcal{A},C)=\Sigma^{*}?

Proof.

By reduction from the nontermination problem for decrement-guarded Minsky machines: Given such a machine \mathcal{M} with line numbers 0,1,,k10,1,\ldots,k-1 where k1k-1 is the stopping instruction, fix Σ={0,1,,k1}\Sigma=\{0,1,\ldots,k-1\} and consider L=L0L1L_{\mathcal{M}}=L_{\mathcal{M}}^{0}\cup L_{\mathcal{M}}^{1} with

L0=\displaystyle L_{\mathcal{M}}^{0}{}= {w=a0amΣ a00 or |w|k1=0} and\displaystyle{}\{w=a_{0}\cdots a_{m}\in\Sigma^{*}\mid\text{ $a_{0}\neq 0$ or $|w|_{k-1}=0$}\}\text{ and }
L1=\displaystyle L_{\mathcal{M}}^{1}{}= {w=a0amΣa0=0|w|k11, and w contains an error before the first k1}\displaystyle{}\{w=a_{0}\cdots a_{m}\in\Sigma^{*}\mid\text{$a_{0}=0$, $|w|_{k-1}\geqslant 1$, and $w$ contains an error before the first $k-1$}\}

We claim that \mathcal{M} does not terminate if and only if LL_{\mathcal{M}} is universal.

First, assume \mathcal{M} does terminate. Then, projecting the terminating run to its line numbers yields a sequence wΣw\in\Sigma^{*} starting with 0, ending with k1k-1, and with no errors. This word is not in LL_{\mathcal{M}}, so LL_{\mathcal{M}} is not universal.

Now, assume \mathcal{M} does not terminate and consider some wΣw\in\Sigma^{*}. If ww does not start with 0 or contains no k1k-1, then it is in LL_{\mathcal{M}}. Thus, now consider the case where ww starts with 0 and contains a k1k-1. Towards a contradiction, assume that the sequence up to the first k1k-1 does not contain an error. Then, Lemma 2 implies that \mathcal{M} terminates, i.e., we have derived the desired contradiction. Hence, ww contains an error before the first k1k-1, i.e., ww is in LL_{\mathcal{M}}. So, LL_{\mathcal{M}} is indeed universal.

So, it remains to show that LL_{\mathcal{M}} is accepted by an HDPA which can be effectively constructed from \mathcal{M}. As HDPA are closed under union and generalize finite automata, we only have to consider L1L_{\mathcal{M}}^{1}. In the proof of Lemma 3, we have constructed a DPA accepting a word if it does not have an error at the second-to-last position. Thus, using complementation and intersection with a regular language, we obtain a DPA that accepts a word if there is an error at the second-to-last position.

But the previous automaton only checks whether the error occurs at the second-to-last position. To find an error at any position, we use history-determinism to guess the prefix with the error and then stop updating the counters and the state, so that their current values can be checked at the end of the run (cf. Example 3). This automaton can easily be turned into one that additionally checks that the first letter is a 0 and that there is at least one k1k-1 in the input, but not before the error. Thus, an HDPA accepting L1L_{\mathcal{M}}^{1} can be effectively constructed from \mathcal{M}. ∎

Note that there is no DPA accepting LL_{\mathcal{M}}, as universality is decidable for DPA. Thus, the guessing described in the proof above is not avoidable.

The next results follow more or less immediately from the undecidability of universality.

Theorem 7.

The following problems are undecidable:

  1. 1.

    Given two HDPA (𝒜0,C0)(\mathcal{A}_{0},C_{0}) and (𝒜1,C1)(\mathcal{A}_{1},C_{1}), is L(𝒜0,C0)L(𝒜1,C1)L(\mathcal{A}_{0},C_{0})\subseteq L(\mathcal{A}_{1},C_{1})?

  2. 2.

    Given two HDPA (𝒜0,C0)(\mathcal{A}_{0},C_{0}) and (𝒜1,C1)(\mathcal{A}_{1},C_{1}), is L(𝒜0,C0)=L(𝒜1,C1)L(\mathcal{A}_{0},C_{0})=L(\mathcal{A}_{1},C_{1})?

  3. 3.

    Given an HDPA (𝒜,C)(\mathcal{A},C), is L(𝒜,C)L(\mathcal{A},C) regular?

  4. 4.

    Given an HDPA (𝒜,C)(\mathcal{A},C), is L(𝒜,C)L(\mathcal{A},C) context-free?

Proof.

Undecidability of inclusion and equivalence follows immediately from Theorem 6 (and even holds if the input (𝒜0,C0)(\mathcal{A}_{0},C_{0}) is replaced by a DFA accepting Σ\Sigma^{*}), so let us consider the regularity problem.

Let L=L0L1L2L_{\mathcal{M}}^{\prime}=L_{\mathcal{M}}^{0}\cup L_{\mathcal{M}}^{1}\cup L_{\mathcal{M}}^{2} where L0L_{\mathcal{M}}^{0} and L1L_{\mathcal{M}}^{1} are defined as in the proof of Theorem 6 and with

L2={w=a0amΣ\displaystyle L_{\mathcal{M}}^{2}=\{w=a_{0}\cdots a_{m}\in\Sigma^{*}\mid a0=0a_{0}=0 and |w|k11|w|_{k-1}\geqslant 1 and the suffix of ww after the first occurrence
of the letter k1 is not of the form 0n1n for some n>0}.\displaystyle\text{of the letter~$k-1$ is \emph{not} of the form~$0^{n}1^{n}$ for some $n>0$}\}.

Note that we assume without loss of generality k11k-1\geqslant 1, i.e., \mathcal{M} has at least one non-stopping instruction.

A DPA for L2L_{\mathcal{M}}^{2} is straightforward to construct. Hence, given \mathcal{M}, one can effectively construct an HDPA for LL_{\mathcal{M}}^{\prime} as HDPA are closed under union. Now, we claim that LL_{\mathcal{M}}^{\prime} is regular if and only if \mathcal{M} does not terminate.

First, assume that \mathcal{M} does not terminate. Then as shown in the proof of Theorem 6, LLL_{\mathcal{M}}\subseteq L_{\mathcal{M}}^{\prime} is equal to Σ\Sigma^{*}. Hence, L=ΣL_{\mathcal{M}}^{\prime}=\Sigma^{*} as well, which is regular.

Now, assume that \mathcal{M} terminates and let wtΣw_{t}\in\Sigma^{*} be the projection of the run of \mathcal{M} to its line numbers. Note that wtw_{t} starts with 0, ends with k1k-1, and does not contain an error. We show that L=Σwt{0n1nn>0}L_{\mathcal{M}}^{\prime}=\Sigma^{*}\setminus w_{t}\cdot\{0^{n}1^{n}\mid n>0\}, which is not regular.

First, if ww is in wt{0n1nn>0}w_{t}\cdot\{0^{n}1^{n}\mid n>0\}, then it is not in LL_{\mathcal{M}}^{\prime}. Now, if ww is not in LL_{\mathcal{M}}^{\prime}, then it has to start with 0 and has to contain a k1k-1 (otherwise, ww would be in L0LL_{\mathcal{M}}^{0}\subseteq L_{\mathcal{M}}^{\prime}). Furthermore, ww cannot contain an error before the first k1k-1 (otherwise, ww would be in L1LL_{\mathcal{M}}^{1}\subseteq L_{\mathcal{M}}^{\prime}). Thus, wtw_{t} is a prefix of ww. Finally, the suffix of ww after the first k1k-1 has to be of the form 0n1n0^{n}1^{n} for some n>0n>0 (otherwise, ww would be in L2LL_{\mathcal{M}}^{2}\subseteq L_{\mathcal{M}}^{\prime}). Altogether, ww is in wt{0n1nn>0}w_{t}\cdot\{0^{n}1^{n}\mid n>0\}.

Finally, using 0n1n2n0^{n}1^{n}2^{n} instead of 0n1n0^{n}1^{n} in the definition of L2L_{\mathcal{M}}^{2} in the previous proof, which is not context-free, allows us to show that the context-freeness problem is also undecidable: Given an HDPA (𝒜,C)(\mathcal{A},C), is L(𝒜,C)L(\mathcal{A},C) context-free? ∎

Next, let us introduce the model-checking problem (for safety properties): A transition system 𝒯=(V,vI,E,λ)\mathcal{T}=(V,v_{I},E,\lambda) consists of a finite set VV of vertices containing the initial state vIVv_{I}\in V, a transition relation EV×VE\subseteq V\times V, and a labeling function λ:VΣ\lambda\colon V\rightarrow\Sigma for some alphabet Σ\Sigma. A (finite and initial) path in 𝒯\mathcal{T} is a sequence v0v1vnV+v_{0}v_{1}\cdots v_{n}\in V^{+} such that v0=vIv_{0}=v_{I} and (vi,vi+1)E(v_{i},v_{i+1})\in E for all 0i<n0\leqslant i<n. Infinite (initial) paths are defined analogously. The trace of a path v0v1vnv_{0}v_{1}\cdots v_{n} is λ(v0)λ(v1)λ(vn)Σ+\lambda(v_{0})\lambda(v_{1})\cdots\lambda(v_{n})\in\Sigma^{+}. We denote the set of traces of paths of 𝒯\mathcal{T} by 𝗍𝗋(𝒯)\mathsf{tr}(\mathcal{T}).

The model-checking problem for HDPA asks, given an HDPA 𝒜\mathcal{A} and a transition system 𝒯\mathcal{T}, whether 𝗍𝗋(𝒯)L(𝒜)=\mathsf{tr}(\mathcal{T})\cap L(\mathcal{A})=\emptyset? Note that the automaton specifies the set of bad prefixes, i.e., 𝒯\mathcal{T} satisfies the specification encoded by 𝒜\mathcal{A} if no trace of 𝒯\mathcal{T} is in L(𝒜)L(\mathcal{A}).

As the model-checking problem for PA is decidable, so is the model-checking problem for HDPA, which follows from the fact that a transition system 𝒯\mathcal{T} can be turned into an NFA and hence into a PA 𝒜𝒯\mathcal{A}_{\mathcal{T}} with L(𝒜𝒯)=𝗍𝗋(𝒯)L(\mathcal{A}_{\mathcal{T}})=\mathsf{tr}(\mathcal{T}). Then, closure under intersection and decidability of nonemptiness yields the desired result.

Theorem 8.

The model-checking problem for HDPA is decidable.

Let us conclude by mentioning that the dual problem, i.e., given a transition system 𝒯\mathcal{T} and an HDPA 𝒜\mathcal{A}, does every infinite path of 𝒯\mathcal{T} have a prefix whose trace is in L(𝒜)L(\mathcal{A}), is undecidable. This follows from recent results on Parikh automata over infinite words [25, Theorem 17], i.e., that model checking for Parikh automata with reachability conditions is undecidable. Such automata are syntactically equal to Parikh automata over finite words and an (infinite) run is accepting if it has a prefix ending in an accepting state whose extended Parikh image is in the semilinear set of the automaton.

Table 2 compares the decidability of standard problems for HDPA with those of DPA, UCA, and PA.

Table 2: Decision problems for history-deterministic Parikh automata (in grey) and comparison to other types of Parikh automata (results are from [8, 9, 32]).
Nonemptiness Finiteness Universality Inclusion Equivalence Regularity Model Checking
DPA Y Y Y Y Y Y Y
HDPA Y Y N N N N Y
UCA Y Y Y Y Y Y Y
PA Y Y N N N N Y

Finally, we consider the problems of deciding whether a Parikh automaton is history-deterministic and whether it is equivalent to some HDPA. Both of our proofs follow arguments developed for similar results for history-deterministic pushdown automata [34, Theorem 6.1].

Theorem 9.

The following problems are undecidable:

  1. 1.

    Given a PA (𝒜,C)(\mathcal{A},C), is it history-deterministic?

  2. 2.

    Given a PA (𝒜,C)(\mathcal{A},C), is it equivalent to some HDPA?

Proof.

1.) We say that a PA (𝒜,C)(\mathcal{A},C) is length-complete if for every nn\in\mathbb{N}, there is some word of length nn in L(𝒜,C)L(\mathcal{A},C). Furthermore, let h:Σ{#}h\colon\Sigma^{*}\rightarrow\{\#\}^{*} be the homomorphism induced by mapping each aΣa\in\Sigma to #\#. If (𝒜,C)(\mathcal{A},C) is length-complete, then {h(w)wL(𝒜,C)}={#}\{h(w)\mid w\in L(\mathcal{A},C)\}=\{\#\}^{*}. Note that the DPA’s (𝒜,C)(\mathcal{A}_{\mathcal{M}},C_{\mathcal{M}}) we have constructed in the proof of Lemma 3 are length-complete. Thus, we have actually shown that the following problem is undecidable: Given a length-complete DPA (𝒜,C)(\mathcal{A},C), does it have a safe word?

We reduce from the safe word problem for length-complete DPA. Given such a DPA (𝒜,C)(\mathcal{A},C) with L(𝒜,C)ΣL(\mathcal{A},C)\subseteq\Sigma^{*}, let (𝒜,C)(\mathcal{A}^{\prime},C) be the PA obtained from (𝒜,C)(\mathcal{A},C) by replacing each letter aΣa\in\Sigma by #\#. Note that (𝒜,C)(\mathcal{A}^{\prime},C) accepts {h(w)wL(𝒜,C)}\{h(w)\mid w\in L(\mathcal{A},C)\}, which is equal to {#}\{\#\}^{*} due to the length-completeness of (𝒜,C)(\mathcal{A},C). We show that (𝒜,C)(\mathcal{A}^{\prime},C) is history-deterministic if and only if (𝒜,C)(\mathcal{A},C) has a safe word, which completes our proof.

So, let (𝒜,C)(\mathcal{A}^{\prime},C) be history-deterministic, i.e., it has a resolver r:{#}Δ𝒜r\colon\{\#\}^{*}\rightarrow\Delta_{\mathcal{A}^{\prime}}, where Δ𝒜\Delta_{\mathcal{A}^{\prime}} is the set of transitions of 𝒜\mathcal{A}^{\prime}. Note that r(#n)r^{*}(\#^{n}) is a prefix of r(#n)r^{*}(\#^{n^{\prime}}) whenever nnn^{\prime}\geqslant n. Hence, there is a unique infinite sequence

(q0,(#,v0),q1)(q1,(#,v1),q2)(q2,(#,v2),q3)(q_{0},(\#,\vec{v}_{0}),q_{1})(q_{1},(\#,\vec{v}_{1}),q_{2})(q_{2},(\#,\vec{v}_{2}),q_{3})\cdots

such that r(#n)=(q0,(#,v0),q1)(qn1,(#,vn1),qn)r^{*}(\#^{n})=(q_{0},(\#,\vec{v}_{0}),q_{1})\cdots(q_{n-1},(\#,\vec{v}_{n-1}),q_{n}). Each of the r(#n)r^{*}(\#^{n}) is an accepting run of 𝒜\mathcal{A}^{\prime} processing #n\#^{n}, as #n\#^{n} is accepted by (𝒜,C)(\mathcal{A}^{\prime},C) and rr is a resolver.

Now, as each transition of 𝒜\mathcal{A}^{\prime} is obtained from a transition of 𝒜\mathcal{A}, there is some infinite word a0a1a2a_{0}a_{1}a_{2}\cdots over Σ\Sigma such that (q0,(a0,v0),q1)(qn1,(an1,vn1),qn)(q_{0},(a_{0},\vec{v}_{0}),q_{1})\cdots(q_{n-1},(a_{n-1},\vec{v}_{n-1}),q_{n}) is an accepting run of 𝒜\mathcal{A} for every n1n\geqslant 1. Thus, we have a0an1L(𝒜,C)a_{0}\cdots a_{n-1}\in L(\mathcal{A},C) for every n1n\geqslant 1. Lastly, we have εL(𝒜,C)\varepsilon\in L(\mathcal{A},C), as εL(𝒜,C)\varepsilon\in L(\mathcal{A}^{\prime},C). Altogether, a0a1a2a_{0}a_{1}a_{2}\cdots is indeed a safe word for (𝒜,C)(\mathcal{A},C).

Now, assume (𝒜,C)(\mathcal{A},C) has a safe word, say a0a1a2a_{0}a_{1}a_{2}\cdots. Thus, ε\varepsilon is in L(𝒜,C)L(\mathcal{A},C) which implies that the initial state of 𝒜\mathcal{A} is accepting and the zero vector is in CC. Further, as the automaton (𝒜,C)(\mathcal{A},C) is deterministic, there is a sequence (q0,(a0,v0),q1)(q1,(a1,v1),q2)(q2,(a2,v2),q3)(q_{0},(a_{0},\vec{v}_{0}),q_{1})(q_{1},(a_{1},\vec{v}_{1}),q_{2})(q_{2},(a_{2},\vec{v}_{2}),q_{3})\cdots such that (q0,(a0,v0),q1)(qn1,(an1,vn1),qn)(q_{0},(a_{0},\vec{v}_{0}),q_{1})\cdots(q_{n-1},(a_{n-1},\vec{v}_{n-1}),q_{n}) is an accepting run of 𝒜\mathcal{A} for all nn\in\mathbb{N}.

By construction of (𝒜,C)(\mathcal{A}^{\prime},C), (q0,(#,v0),q1)(qn1,(#,vn1),qn)(q_{0},(\#,\vec{v}_{0}),q_{1})\cdots(q_{n-1},(\#,\vec{v}_{n-1}),q_{n}) is an accepting run of 𝒜\mathcal{A}^{\prime} on #n\#^{n}, for each n1n\geqslant 1. Now, we define r(#n)=(qn1,(#,vn1),qn)r(\#^{n})=(q_{n-1},(\#,\vec{v}_{n-1}),q_{n}) for each n1n\geqslant 1. Then, r(#n)=(q0,(#,v0),q1)(qn1,(#,vn1),qn)r^{*}(\#^{n})=(q_{0},(\#,\vec{v}_{0}),q_{1})\cdots(q_{n-1},(\#,\vec{v}_{n-1}),q_{n}), i.e., it is an accepting run of (𝒜,C)(\mathcal{A}^{\prime},C) processing #n\#^{n}. Hence, rr is a resolver for (𝒜,C)(\mathcal{A}^{\prime},C), i.e., (𝒜,C)(\mathcal{A}^{\prime},C) is history-deterministic.

2.) We reduce from the universality problem for PA, which is undecidable [32, Property 7], via a series of automata transformations.

First, given a PA (𝒜,C)(\mathcal{A},C) processing words over Σ\Sigma, we construct a PA (𝒜,C)(\mathcal{A}^{\prime},C^{\prime}) with

L(𝒜,C)=L(𝒜,C)L(𝒜,C)#(Σ#)L(\mathcal{A}^{\prime},C^{\prime})=L(\mathcal{A},C)\cup L(\mathcal{A},C)\cdot\#\cdot(\Sigma_{\#})^{*}

where Σ#=Σ{#}\Sigma_{\#}=\Sigma\cup\{\#\} for some fresh #Σ\#\notin\Sigma. Note that (𝒜,C)(\mathcal{A},C) is universal, i.e., L(𝒜,C)=ΣL(\mathcal{A},C)=\Sigma^{*}, if and only if (𝒜,C)(\mathcal{A}^{\prime},C^{\prime}) is universal, i.e., L(𝒜,C)=(Σ#)L(\mathcal{A}^{\prime},C^{\prime})=(\Sigma_{\#})^{*}.

Recall that the language E{a,b}E\subseteq\{a,b\}^{*} from the proof of Theorem 1 is accepted by some PA, but not by any HDPA. Thus, we can construct a PA (𝒜,C)(\mathcal{A}_{\vee},C_{\vee}) with

L(𝒜,C)={w(Σ#×{a,b})π1(w)L(𝒜,C) or π2(w)E}.L(\mathcal{A}_{\vee},C_{\vee})=\{w\in(\Sigma_{\#}\times\{a,b\})^{*}\mid\pi_{1}(w)\in L(\mathcal{A}^{\prime},C^{\prime})\text{ or }\pi_{2}(w)\in E\}.

Here, πi\pi_{i} is the projection to the ii-th component, i.e., the homomorphism defined by πi(a1,a2)=ai\pi_{i}(a_{1},a_{2})=a_{i}. We show that L(𝒜,C)L(\mathcal{A},C) is universal if and only if L(𝒜,C)L(\mathcal{A}_{\vee},C_{\vee}) is accepted by some HDPA.

First, assume that L(𝒜,C)L(\mathcal{A},C) is universal. Then, L(𝒜,C)L(\mathcal{A}^{\prime},C^{\prime}) and L(𝒜,C)L(\mathcal{A}_{\vee},C_{\vee}) are universal as well. Hence, L(𝒜,C)L(\mathcal{A}_{\vee},C_{\vee}) is accepted by some DFA, and therefore also by an HDPA.

Now, assume that L(𝒜,C)L(\mathcal{A},C) is not universal, i.e., there is some u=a0an1L(𝒜,C)u=a_{0}\cdots a_{n-1}\notin L(\mathcal{A},C). Towards a contradiction, we assume there is an HDPA (𝒜a,Ca)(\mathcal{A}_{a},C_{a}) with L(𝒜a,Ca)=L(𝒜,C)L(\mathcal{A}_{a},C_{a})=L(\mathcal{A}_{\vee},C_{\vee}), say with resolver rar_{a}. We show that the language

P={w{a,b}|u||(u#|w||u|w)L(𝒜,C)}P=\left\{w\in\{a,b\}^{\geqslant|u|}\>\middle|\>\binom{u\#^{|w|-|u|}}{w}\in L(\mathcal{A}_{\vee},C_{\vee})\right\}

is also accepted by some HDPA (𝒜P,Ca)(\mathcal{A}_{P},C_{a}). Note that PP contains exactly the words w{a,b}|u|Ew\in\{a,b\}^{\geqslant|u|}\cap E, as u#|w||u|u\#^{|w|-|u|} is not in L(𝒜,C)L(\mathcal{A}^{\prime},C^{\prime}) for any ww. The fact that PP is accepted by some HDPA yields the desired contradiction: We have PEP\subseteq E and EPE\setminus P is finite. Hence, EPE\setminus P is accepted by some DFA and therefore also by some HDPA. Thus, due to closure of HDPA under union, if PP is accepted by some HDPA, so is EE. This contradicts that EE is not accepted by any HDPA (see Theorem 1).

So, let 𝒜a=(Q,(Σ#×{a,b})×D,qI,Δ,F)\mathcal{A}_{a}=(Q,(\Sigma_{\#}\times\{a,b\})\times D,q_{I},\Delta,F). We define 𝒜P=(Q×{0,1,,|u|},{a,b}×D,(qI,0),Δ,F×{|u|})\mathcal{A}_{P}=(Q\times\{0,1,\dots,|u|\},\{a,b\}\times D,(q_{I},0),\Delta^{\prime},F\times\{|u|\}) with

Δ=\displaystyle\Delta^{\prime}={} {((q,j),(a,v),(q,j+1))|(q,((aja),v),q)Δ and j<|u|}\displaystyle{}\left\{((q,j),(a,\vec{v}),(q^{\prime},j+1))\>\middle|\>(q,(\binom{a_{j}}{a},\vec{v}),q^{\prime})\in\Delta\text{ and }j<|u|\right\}\,\cup
{((q,|u|),(a,v),(q,|u|))|(q,((#a),v),q)Δ}\displaystyle{}\left\{((q,|u|),(a,\vec{v}),(q^{\prime},|u|))\>\middle|\>(q,(\binom{\#}{a},\vec{v}),q^{\prime})\in\Delta\right\}

Intuitively, to obtain 𝒜P\mathcal{A}_{P}, we hardcode uu into the state space in order to restrict the runs of 𝒜a\mathcal{A}_{a} to those that process words of the form u#u\#^{*} in the first component (which is projected away). Hence, (𝒜P,Ca)(\mathcal{A}_{P},C_{a}) does indeed accept PP.

Now it remains to observe that (𝒜P,Ca)(\mathcal{A}_{P},C_{a}) has a resolver: Turning (𝒜a,Ca)(\mathcal{A}_{a},C_{a}) into (𝒜P,Ca)(\mathcal{A}_{P},C_{a}) does not introduce nondeterminism, i.e., a resolver rr for (𝒜a,Ca)(\mathcal{A}_{a},C_{a}) can easily be turned into one for (𝒜P,Ca)(\mathcal{A}_{P},C_{a}). So, (𝒜P,Ca)(\mathcal{A}_{P},C_{a}) is an HDPA. ∎

7 Resolvers

So far, a resolver for an HDPA is a function r:Σ+Δr\colon\Sigma^{+}\rightarrow\Delta. This definition does not put any restrictions on the complexity of the function rr. But how complex is it to resolve the nondeterminism in an HDPA? For history-deterministic finite automata, finite automata with output suffice to resolve their nondeterminism [3, Lemma 1] while pushdown automata with output are not sufficient to resolve the nondeterminism in history-deterministic pushdown automata [34, Theorem 7.3][26, Lemma 10.2].

It is straightforward to show that every HDPA has a positional resolver (i.e., one whose decision is only based on the last state of the run constructed thus far and on the extended Parikh image induced by this run) and that HDPA that have finite-state resolvers (say, implemented by a Mealy machine) can be determinized by taking the product of the HDPA and the Mealy machine. In fact, both proofs are simple adaptions of the corresponding ones for history-deterministic pushdown automata [26, Lemma 10.1 and Remark 10.3]. Hence, we focus on the question whether the nondeterminism in an HDPA can be resolved by functions implemented by more expressive formalisms, i.e., we are looking for deterministic machines that implement resolvers for HDPA. A natural question is then whether DPA are sufficient for this task, i.e., the question whether the nondeterminism in an HDPA can be resolved by DPA.

Let us formalize this question. Fix a PA (𝒜,C)(\mathcal{A},C) with 𝒜=(Q,Σ×D,qI,Δ,F)\mathcal{A}=(Q,\Sigma\times D,q_{I},\Delta,F) throughout this section. We assume (without loss of generality) that (𝒜,C)(\mathcal{A},C) is complete. Recall that a function r:Σ+Δr\colon\Sigma^{+}\rightarrow\Delta is a resolver for (𝒜,C)(\mathcal{A},C) if, for every wL(𝒜,C)w\in L(\mathcal{A},C), we have that r(w)r^{*}(w) is an accepting run of (𝒜,C)(\mathcal{A},C). Here, r:ΣΔr^{*}\colon\Sigma^{*}\rightarrow\Delta^{*} is defined as r(ε)=εr^{*}(\varepsilon)=\varepsilon and r(a0an)=r(a0an1)r(a0an)r^{*}(a_{0}\cdots a_{n})=r^{*}(a_{0}\cdots a_{n-1})\cdot r(a_{0}\cdots a_{n}). In the following, we call such a resolver a letter-based resolver.

Here, it is more convenient to work with resolvers that not only get the prefix ww to be processed as input, but the run prefix constructed thus far (from which ww can be reconstructed). In general, one can, given an input word, reconstruct the run prefix induced by the resolver (see the proof of Lemma 4 below). However, this reconstruction cannot necessarily be implemented by an automaton (see Item 2 of Example 4 below). Thus, while these two definitions are equivalent in general, this is not necessarily true when restricted to automata-implementable resolvers.

Let P(𝒜,C)ΔP(\mathcal{A},C)\subseteq\Delta^{*} denote the set of run prefixes of (𝒜,C)(\mathcal{A},C) starting in the initial state. We now consider functions of the form t:P(𝒜,C)×ΣΔt\colon P(\mathcal{A},C)\times\Sigma\rightarrow\Delta and define their iteration t:ΣΔt^{*}\colon\Sigma^{*}\rightarrow\Delta^{*} inductively as t(ε)=εt^{*}(\varepsilon)=\varepsilon and

t(a0an)=t(a0an1)t(t(a0an1),an).t^{*}(a_{0}\cdots a_{n})=t^{*}(a_{0}\cdots a_{n-1})\cdot t(t^{*}(a_{0}\cdots a_{n-1}),a_{n}).

We say that tt is a transition-based resolver if, for every wL(𝒜,C)w\in L(\mathcal{A},C), t(w)t^{*}(w) is an accepting run of (𝒜,C)(\mathcal{A},C).

Lemma 4.

A PA (𝒜,C)(\mathcal{A},C) has a letter-based resolver if and only if it has a transition-based resolver.

Proof.

Let r:Σ+Δr\colon\Sigma^{+}\rightarrow\Delta be a letter-based resolver for (𝒜,C)(\mathcal{A},C). We inductively define the function t:P(𝒜,C)×ΣΔt\colon P(\mathcal{A},C)\times\Sigma\rightarrow\Delta via t(ε,a)=r(a)t(\varepsilon,a)=r(a) and t(ρ,a)=r(wa)t(\rho,a)=r(wa) where wΣ+w\in\Sigma^{+} is the word labelling the sequence ρΔ+\rho\in\Delta^{+}. Then, an induction shows that he have t=rt^{*}=r^{*}, which implies that tt is a transition-based resolver.

For the other implication, let t:P(𝒜,C)×ΣΔt\colon P(\mathcal{A},C)\times\Sigma\rightarrow\Delta be a transition-based resolver. We inductively define the function r:Σ+Δr\colon\Sigma^{+}\rightarrow\Delta via r(a)=t(ε,a)r(a)=t(\varepsilon,a) and r(a0an)=t(t(a0an1),an)r(a_{0}\cdots a_{n})=t(t^{*}(a_{0}\cdots a_{n-1}),a_{n}). Again, an induction shows that he have r=tr^{*}=t^{*}, which implies that rr is a letter-based resolver. ∎

Next, we define how to implement a transition-based resolver via automata. Unlike previous work, which employed transducers (automata with outputs) to implement resolvers, we prefer here to use a different approach and show that for each transition δ\delta, the inverse image of δ\delta is accepted by an automaton. Taking the product of these automata for each δ\delta yields a transducer implementing a resolver, but not taking the product simplifies our constructions below considerably.

Given a transition-based resolver t:P(𝒜,C)×ΣΔt\colon P(\mathcal{A},C)\times\Sigma\rightarrow\Delta, aΣa\in\Sigma, and δΔ\delta\in\Delta, we define

ta1(δ)={ρP(𝒜,C)t(ρ,a)=δ},t^{-1}_{a}(\delta)=\{\rho\in P(\mathcal{A},C)\mid t(\rho,a)=\delta\},

i.e., the set of run prefixes for which, when the next input letter to be processed is an aa, tt extends the run prefix with the transition δ\delta. Note that tt is completely specified by the collection of sets ta1(δ)t^{-1}_{a}(\delta). Conversely, if we have a collection of sets Ra,δR_{a,\delta} that partitions P(𝒜,C)P(\mathcal{A},C), then it induces a function mapping finite runs and letters to transitions, i.e., it has the same signature as a transition-based resolver. We say that a transition-based resolver tt is DPA-implementable, if every ta1(δ)t^{-1}_{a}(\delta) is accepted by a DPA.

Example 4.

Consider the HDPA (𝒜,C)(\mathcal{A},C) from Example 3. For b{0,1}b\in\{0,1\}, let δb,\delta_{b,\ell} be the self-loop processing bb on the left state qcq_{c}, let δb,m\delta_{b,m} be the transition processing bb leading from qcq_{c} to qnq_{n}, and let δb,r\delta_{b,r} be the self-loop processing bb on the right state qnq_{n}.

  1. 1.

    The following languages are all accepted by a DPA, for b{0,1}b\in\{0,1\}:

    • Rb,δb,={δb0,δbn1,n0 and b0bn1b is not non-Dyck}R_{b,\delta_{b,\ell}}=\{\delta_{b_{0},\ell}\cdots\delta_{b_{n-1},\ell}\mid n\geqslant 0\text{ and }b_{0}\cdots b_{n-1}b\text{ is not non-Dyck}\}.

    • Rb,δb,m={δb0,δbn1,n>0 and b0bn1b is non-Dyck}R_{b,\delta_{b,m}}=\{\delta_{b_{0},\ell}\cdots\delta_{b_{n-1},\ell}\mid n>0\text{ and }b_{0}\cdots b_{n-1}b\text{ is non-Dyck}\}.

    • Rb,δb,m={δb0,δbn1,δbn,mδbn+1,rδbn+n,rn>0 and n0}R_{b,\delta_{b,m}}=\{\delta_{b_{0},\ell}\cdots\delta_{b_{n-1},\ell}\delta_{b_{n},m}\delta_{b_{n+1},r}\cdots\delta_{b_{n+n^{\prime}},r}\mid n>0\text{ and }n^{\prime}\geqslant 0\}.

    These languages are pairwise disjoint and their union is the set of all run prefixes. Now, one can verify that the induced function is a transition-based resolver for (𝒜,C)(\mathcal{A},C), i.e., (𝒜,C)(\mathcal{A},C) has a DPA-implementable resolver.

  2. 2.

    Now, let us consider implementation of letter-based resolvers for (𝒜,C)(\mathcal{A},C). Recall that the letter-based resolver presented in Example 3, call it  rr, takes the transition to qnq_{n} as soon as possible, i.e., with the first non-Dyck prefix of the input. One can in fact show that this is the only letter-based resolver of (𝒜,C)(\mathcal{A},C), as staying in qcq_{c} with a non-Dyck prefix ww means that the run induced by the resolver is not accepting, a contradiction.

    Now, assume rr is DPA-implementable (in the sense that {w{0,1}+r(w)=δ}\{w\in\{0,1\}^{+}\mid r(w)=\delta\} is accepted by a DPA for every transition δ\delta). Then, the language

    {w{0,1}+r(w)=δ0,}{w{0,1}+r(w)=δ1,}.\{w\in\{0,1\}^{+}\mid r(w)=\delta_{0,\ell}\}\cup\{w\in\{0,1\}^{+}\mid r(w)=\delta_{1,\ell}\}.

    is also accepted by a DPADPA, as DPA are closed under union. However, by definition of rr, this is the language of words that do not have a non-Dyck prefix. It is known that this language is not accepted by any PA [9, Proposition 11]. Hence, rr is not DPA-implementable and, due to uniqueness of rr, (𝒜,C)(\mathcal{A},C) does not have DPA-implementable letter-based resolvers.

    Note that rr is not even implementable by PA (with the obvious definition), as the language of words without non-Dyck prefixes is not even accepted by (possibly nondeterministic) PA [9, Proposition 11].

Note that a transition-based resolver operates on the run constructed thus far, which contains information on whether there was a non-Dyck prefix in the word processed thus far: If there is one, then the resolver continued the run on that prefix by moving to state qnq_{n}. Thus, any run consistent with the resolver ends in state qnq_{n} if and only if the word processed thus far has a non-Dyck prefix. This saves a transition-based resolver from checking every input for non-Dyckness, a property that cannot be checked by an (even nondeterministic) PA. A letter-based resolver, on the other hand, does not get the information in which state the run constructed thus far ends, and a DPA-implementable one also cannot compute that information. Thus, DPA-implementable letter-based resolvers are strictly weaker than DPA-implementable transition-based resolvers.

Remark 3.

All HDPA we present in examples and proofs in this work have a DPA-implementable transition-based resolver.

Due to Example 4, we will consider only transition-based resolver in the remainder of this section and, for the sake of brevity, call them resolvers in the following.

Now, we investigate whether every HDPA has a DPA-implementable resolver. Unfortunately, we only obtain a conditional result. To explain the condition, we need to introduce some background on the game-theoretic characterization of history-determinism due to Bagnol and Kuperberg [1].

Recall that we fixed a complete PA (𝒜,C)(\mathcal{A},C) with 𝒜=(Q,Σ×D,qI,Δ,F)\mathcal{A}=(Q,\Sigma\times D,q_{I},\Delta,F). We define the one-token game on (𝒜,C)(\mathcal{A},C), a perfect-information zero-sum game played between two players called Challenger and Resolver. The positions of the game consist of pairs (q,q)Q×Q(q,q^{\prime})\in Q\times Q. The game is played in rounds i=0,1,2,i=0,1,2,\ldots starting from the initial position (q0,q0)=(qI,qI)(q_{0},q_{0}^{\prime})=(q_{I},q_{I}). In round ii at position (qi,qi)(q_{i},q_{i}^{\prime}):

  • First Challenger picks a letter aiΣa_{i}\in\Sigma.

  • Then, Resolver picks a transition from Δ\Delta of the form (qi,(ai,vi),qi+1)(q_{i},(a_{i},\vec{v}_{i}),q_{i+1}) for some viD\vec{v}_{i}\in D and some qi+1Qq_{i+1}\in Q.

  • Then, Challenger picks a transition from Δ\Delta of the form (qi,(ai,vi),qi+1)(q_{i}^{\prime},(a_{i},\vec{v}_{i}^{\prime}),q_{i+1}^{\prime}) for some viD\vec{v}_{i}^{\prime}\in D and some qi+1Qq_{i+1}^{\prime}\in Q.

  • Then, round ii ends and the play proceeds from position (qi+1,qi+1)(q_{i+1},q_{i+1}^{\prime}) in round i+1i+1.

Due to completeness of (𝒜,C)(\mathcal{A},C), this is well-defined, i.e., each player has at least one move available. Thus, plays are infinite and induce two infinite sequences

(q0,(a0,v0),q1)(q1,(a1,v1),q2)(q2,(a2,v2),q3) and (q0,(a0,v0),q1)(q1,(a1,v1),q2)(q2,(a2,v2),q3)(q_{0},(a_{0},\vec{v}_{0}),q_{1})(q_{1},(a_{1},\vec{v}_{1}),q_{2})(q_{2},(a_{2},\vec{v}_{2}),q_{3})\cdots\text{\quad and \quad}(q_{0}^{\prime},(a_{0},\vec{v}_{0}^{\prime}),q_{1}^{\prime})(q_{1}^{\prime},(a_{1},\vec{v}_{1}^{\prime}),q_{2}^{\prime})(q_{2}^{\prime},(a_{2},\vec{v}_{2}^{\prime}),q_{3}^{\prime})\cdots

picked by Resolver and Challenger, respectively. Each prefix of the sequences is, by definition of the game, a run of (𝒜,C)(\mathcal{A},C). Resolver wins the play if for every n0n\geqslant 0 for which the run (q0,(a0,v0),q1)(qn1,(an1,vn1),qn)(q_{0}^{\prime},(a_{0},\vec{v}_{0}^{\prime}),q_{1}^{\prime})\cdots(q_{n-1}^{\prime},(a_{n-1},\vec{v}_{n-1}^{\prime}),q_{n}^{\prime}) picked by Challenger is accepting, the run (q0,(a0,v0),q1)(qn1,(an1,vn1),qn)(q_{0},(a_{0},\vec{v}_{0}),q_{1})\cdots(q_{n-1},(a_{n-1},\vec{v}_{n-1}),q_{n}) picked by Resolver is also accepting. A strategy for Resolver maps a finite sequence of transitions (picked by Challenger) and a letter to a transition. The notions of winning strategies and Resolver winning the one-token game are defined as expected.

Lemma 5.

Resolver wins the one-token game on a PA (𝒜,C)(\mathcal{A},C) if and only if (𝒜,C)(\mathcal{A},C) is an HDPA.

Proof.

The proof here is analogous to the one for finite automata [36, Lemma 7 (case of k=1k=1)], but we need to repeat it here as our further results depend on properties of the one-token game that are shown in this proof.

One direction is straightforward: a transition-based resolver can directly be turned into a winning strategy for Resolver which ensures that whenever the word picked by Challenger thus far is in L(𝒜,C)L(\mathcal{A},C), then the finite run constructed thus far by Resolver is accepting (this is what a resolver does after all). In particular, when the run constructed by Challenger is accepting (which implies that the word picked thus far is in L(𝒜,C)L(\mathcal{A},C)), then the run constructed by Resolver is also accepting. Thus, Resolver wins the one-token game.

For the converse direction, we need to show that a winning strategy for Resolver can be turned into a transition-based resolver for (𝒜,C)(\mathcal{A},C). Throughout the proof, we fix such a winning strategy σ\sigma.

We begin by introducing non-residual transitions. Assume Challenger has picked a word ww thus far during a play and the players have picked sequences ρ\rho (Resolver) and ρ\rho^{\prime} (Challenger) of transitions (processing both ww by definition). Now, let Challenger pick the letter aa to begin the next round and let δ\delta be a transition that Resolver could pick to continue the round. We say that δ\delta is non-residual w.r.t. ρ\rho and aa (but independent of ρ\rho^{\prime}) if there is a wΣw^{\prime}\in\Sigma^{*} such that

  • there is an accepting run ρ\rho^{*} with prefix ρ\rho such that ρ\rho^{*} processes wawwaw^{\prime},

  • but there is no accepting run with prefix ρδ\rho\delta that processes wawwaw^{\prime}.

A transition is residual, if it is not non-residual.

If ρ=ρ\rho=\rho^{\prime} in the situation above, then σ\sigma must pick a residual transition. If not, then Challenger wins by picking the letters of ww^{\prime} and the transitions completing the accepting run ρ\rho^{*} processing wawwaw^{\prime}. By definition, Resolver cannot extend ρδ\rho\delta to an accepting run processing wawwaw^{\prime}. This contradicts σ\sigma being winning, as such a play is not winning for Resolver.

We define the function t:P(𝒜,C)×ΣΔt\colon P(\mathcal{A},C)\times\Sigma\rightarrow\Delta. Let ρP(𝒜,C)\rho\in P(\mathcal{A},C) be a run prefix of (𝒜,C)(\mathcal{A},C) processing the word ww, let aΣa\in\Sigma, and let δ\delta be the transition picked by σ\sigma when Challenger has picked ww thus far, both players have picked ρ\rho, and Challenger has picked aa to start the next round. Then, we define t(ρ,a)=δt(\rho,a)=\delta. Note that δ\delta must be residual w.r.t. ρ\rho and aa, as argued above.

Now, an induction shows that if ww is in L(𝒜,C)L(\mathcal{A},C), then the run induced by tt over every prefix of ww^{\prime} of ww can be extended to an accepting run that processes ww, as tt only yields residual transitions. Thus, for w=ww^{\prime}=w we obtain that the run induced by tt is accepting, i.e., tt is a resolver. ∎

Given a PA (𝒜,C)(\mathcal{A},C) with 𝒜=(Q,Σ×D,qI,Δ,F)\mathcal{A}=(Q,\Sigma\times D,q_{I},\Delta,F) and CdC\subseteq\mathbb{N}^{d}, the one-token game on (𝒜,C)(\mathcal{A},C) can be modelled as a safety game on an infinite graph as follows (see, e.g., [24] for a general introduction to graph-based games):

  • The set of vertices is (Q×d×Q×d)(Q×d×Q×d×Σ)(Q×d×Q×d×Σ×Δ)(Q\times\mathbb{N}^{d}\times Q\times\mathbb{N}^{d})\cup(Q\times\mathbb{N}^{d}\times Q\times\mathbb{N}^{d}\times\Sigma)\cup(Q\times\mathbb{N}^{d}\times Q\times\mathbb{N}^{d}\times\Sigma\times\Delta).

  • The initial vertex is (qI,0,qI,0)(q_{I},\vec{0},q_{I},\vec{0}) where 0\vec{0} is the dd-dimensional zero vector.

  • The vertices of Challenger are those in (Q×d×Q×d)(Q×d×Q×d×Σ×Δ)(Q\times\mathbb{N}^{d}\times Q\times\mathbb{N}^{d})\cup(Q\times\mathbb{N}^{d}\times Q\times\mathbb{N}^{d}\times\Sigma\times\Delta).

  • The vertices of Resolver are those in (Q×d×Q×d×Σ)(Q\times\mathbb{N}^{d}\times Q\times\mathbb{N}^{d}\times\Sigma).

  • The edge relation is defined as follows:

    • A vertex (q,v,q,v)(q,\vec{v},q^{\prime},\vec{v}^{\prime}) has the successor (q,v,q,v,a)(q,\vec{v},q^{\prime},\vec{v}^{\prime},a) for each aΣa\in\Sigma, simulating that Challenger picks a letter at the start of a new round.

    • A vertex (q,v,q,v,a)(q,\vec{v},q^{\prime},\vec{v}^{\prime},a) has the successor (q,v,q,v,a,δ)(q,\vec{v},q^{\prime},\vec{v}^{\prime},a,\delta) for every δΔ\delta\in\Delta of the form δ=(q,(a,v′′),q′′)\delta=(q,(a,\vec{v}^{\prime\prime}),q^{\prime\prime}) for some v′′D\vec{v}^{\prime\prime}\in D and some q′′Qq^{\prime\prime}\in Q, simulating that Resolver picks a transition in the second step of a round.

    • A vertex (q,v,q,v,a,(q,(a,v′′),q′′))(q,\vec{v},q^{\prime},\vec{v}^{\prime},a,(q,(a,\vec{v}^{\prime\prime}),q^{\prime\prime})) has the successor (q′′,v+v′′,q′′′,v+v′′′)(q^{\prime\prime},\vec{v}+\vec{v}^{\prime\prime},q^{\prime\prime\prime},\vec{v}^{\prime}+\vec{v}^{\prime\prime\prime}) for every δΔ\delta^{\prime}\in\Delta of the form δ=(q,(a,v′′′),q′′′)\delta^{\prime}=(q^{\prime},(a,\vec{v}^{\prime\prime\prime}),q^{\prime\prime\prime}) for some v′′′D\vec{v}^{\prime\prime\prime}\in D and some q′′′Qq^{\prime\prime\prime}\in Q, simulating that Challenger picks a transition in the last step of a round. This leads to the update of the states and the counters.

  • The set of unsafe vertices is

    {(q,v,q,v)Q×d×Q×dqFvC(qFvC)}.\{(q,\vec{v},q^{\prime},\vec{v}^{\prime})\in Q\times\mathbb{N}^{d}\times Q\times\mathbb{N}^{d}\mid q^{\prime}\in F\wedge\vec{v}^{\prime}\in C\wedge(q\notin F\vee\vec{v}\notin C)\}.

    All other vertices are safe.

As usual, a play is an infinite sequence of vertices starting in the initial one and following the edge relation. It is winning for Resolver if it contains only safe vertices. The winning region of Resolver is the set of vertices from which Resolver has a winning strategy.

Remark 4.

Resolver wins the one-token game on a PA (𝒜,C)(\mathcal{A},C) if and only if the initial vertex of the safety game is in the winning region of Resolver.

The set of vertices of the safety game is isomorphic to S×2dS\times\mathbb{N}^{2d} for some finite set SS. We say that a subset AS×2dA\subseteq S\times\mathbb{N}^{2d} is semilinear if

As={v2d(s,v)A}A\!\!\upharpoonright\!\!s=\{\vec{v}\in\mathbb{N}^{2d}\mid(s,\vec{v})\in A\}

is semilinear for each sSs\in S. Note that there are only finitely many AsA\!\!\upharpoonright\!\!s, as SS is finite. Slightly abusively, we say a subset of the vertices is semilinear, if its isomorphic image is semilinear.

Theorem 10.

If the winning region of Resolver in the safety game induced by (𝒜,C)(\mathcal{A},C) is semilinear and contains the initial vertex, then (𝒜,C)(\mathcal{A},C) has a DPA-implementable transition-based resolver.

Proof.

Our construction uses residual transitions as introduced in the proof of Lemma 5. Let us begin with a simple observation that follows from the definition of residual transitions: if two finite runs ρ,ρ\rho,\rho^{\prime} end in the same state (the empty run ends in the initial state by convention) and have the same extended Parikh image (the empty run has the extended Parikh image 0\vec{0} by convention), and aa is a letter, then a transition is residual w.r.t. ρ\rho and aa if and only if it is residual w.r.t. ρ\rho^{\prime} and aa. Note that the safety game does not keep track of the whole play history of a play in the one-token game, but only keeps track of the last states and the extended Parikh images of the two runs constructed by the two players. Due to the observation above, this suffices to determine residual transitions of histories while only keeping track of the last vertex of the history.

Let WW be the winning region of Resolver in the safety game and consider a vertex of the form (q,v,q,v,a)W(q,\vec{v},q,\vec{v},a)\in W, i.e., it is Resolver’s turn. Then, there is at least one successor in the winning region WW, which must be of the form (q,v,q,v,a,δ)(q,\vec{v},q,\vec{v},a,\delta) for a residual transition δ\delta, as argued above. Thus, Resolver can pick any residual transition to win the one-token game, again as argued above. Hence, we will construct a DPA-implementable resolver that will always pick a residual transition.

However, in general there might be several residual transitions available. So, to define the resolver formally, we need to select one such transition. To this end, let δ0<δ1<δn\delta_{0}<\delta_{1}<\cdots\delta_{n} be a fixed ordering of the set Δ\Delta of transitions of (𝒜,C)(\mathcal{A},C). We fix a letter aa and a transition δi\delta_{i} and construct a DPA that does the following, when given a finite run ρ\rho:

  • Compute the extended Parikh image v\vec{v} of ρ\rho using its counters and determine the last state qq of ρ\rho.

  • If (q,v,q,v,a,δi)W(q,\vec{v},q,\vec{v},a,\delta_{i})\in W and (q,v,q,v,a,δi)W(q,\vec{v},q,\vec{v},a,\delta_{i^{\prime}})\notin W for all i<ii^{\prime}<i, then accept. Intuitively, if δi\delta_{i} is the first residual transition, then ρ\rho is accepted by the automaton associated with δi\delta_{i} and aa.

  • If i=0i=0 and (q,v,q,v,a,δi)W(q,\vec{v},q,\vec{v},a,\delta_{i^{\prime}})\notin W for all i{0,1,,n}i^{\prime}\in\{0,1,\ldots,n\}, then accept. Intuitively, if there is no residual transition for ρ\rho and aa, then the automaton associated with δ0\delta_{0} and aa accepts. Note that this case is only used for completeness, it will never be used below as the resolver we are defining always ensures that there is at least one residual transition.

The last two conditions can be checked by the Parikh automaton we are constructing, as each W(q,q,a,δi)W\!\!\upharpoonright\!\!(q,q,a,\delta_{i^{\prime}}) is semilinear by assumption. Note that this requires to reflect the last state qq in the extended Parikh image as done several times before.

Now, let Ra,δiR_{a,\delta_{i}} be the language of the automaton we have constructed for aa and δi\delta_{i}. The sets Ra,δiR_{a,\delta_{i}} for aΣa\in\Sigma and i{0,1,,n}i\in\{0,1,\ldots,n\} partition P(𝒜,C)P(\mathcal{A},C), and therefore induce a function t:P(𝒜,C)×ΣΔt\colon P(\mathcal{A},C)\times\Sigma\rightarrow\Delta.

It remains to show that tt is a transition-based resolver. Let wL(𝒜,C)w\in L(\mathcal{A},C) and let ρ=t(w)\rho=t^{*}(w) be the sequence of transitions induced by tt for ww. An induction over the prefixes ρ\rho^{\prime} of ρ\rho shows that (qρ,vρ,qρ,vρ)(q_{\rho^{\prime}},\vec{v}_{\rho^{\prime}},q_{\rho^{\prime}},\vec{v}_{\rho^{\prime}}) is in WW, where qρq_{\rho^{\prime}} is the last state of ρ\rho^{\prime} and vρ\vec{v}_{\rho^{\prime}} is the extended Parikh image of ρ\rho^{\prime}, relying on the following two facts:

  • tt only returns transitions that “stay” in the winning region.

  • In a safety game, Challenger (the antagonist aiming to reach an unsafe state) cannot “leave” the winning region with their moves.

Thus, tt will only pick residual transitions, as these are the ones that “stay” in the winning region. Now, an argument as the one in the proof of Lemma 5 shows that tt is indeed a resolver, as it only returns residual transitions. ∎

We conclude this section with the obvious question: Is the winning region of the safety game always semilinear? A classical result characterizes the winning region of the antagonist in a safety game (the player aiming to reach an unsafe state) as the attractor of the unsafe states. In our case, the attractor is the infinite union i0Attri\bigcup_{i\geqslant 0}\mathrm{Attr}_{i} where Attr0\mathrm{Attr}_{0} is the set of unsafe states and Attri+1=CPre(Attri)\mathrm{Attr}_{i+1}=\mathrm{CPre}(\mathrm{Attr}_{i}). Here, CPre(Attri)\mathrm{CPre}(\mathrm{Attr}_{i}) denotes the controlled predecessor of the set Attri\mathrm{Attr}_{i} of states containing

  • all vertices of the antagonist having a successor in Attri\mathrm{Attr}_{i}, and

  • all vertices of the protagonist having only successors in Attri\mathrm{Attr}_{i}.

Thus, if one can show that the attractor (the winning region of the antagonist) is semilinear, then, due to closure of semilinear sets under complementation, also the winning region of the protagonist is semilinear. Then, Theorem 10 implies the existence of a DPA-implementable resolver.

Now, Attr0\mathrm{Attr}_{0}, the set of unsafe states in the safety game, is semilinear, as semilinear sets are closed under Boolean operations and the set of safe states is defined as a Boolean combination of semilinear sets. Further, one can show that in the safety games we consider here (but not in general), the controlled predecessor of a semilinear set is semilinear as well. Thus, the only remaining obstacle is the infinite union. However, semilinear sets are in general not closed under infinite unions (as every set can be described as an infinite union of singletons, which are semilinear). Nevertheless, the game graph the safety game is played in is rather simple, i.e., the edge relation depends only on a finite abstraction of the vertices (i.e., it only depends on the letter stored in a vertex) and is therefore monotone.777Note that related questions about winning regions in exact slow kk-Nim are also open [11].

Note that if the inherent structure of the safety games we consider here suffices to show that the winning region is indeed semilinear, then the DPA’s implementing a resolver cannot be effectively constructed, as it is undecidable whether a PA is history-deterministic (Theorem 9).

8 Conclusion

In this work, we have introduced and studied history-deterministic Parikh automata. We have shown that their expressiveness is strictly between that of deterministic and nondeterministic PA, incomparable to that of unambiguous PA, but equivalent to history-deterministic 1-RBCM. Furthermore, we showed that they have almost the same closure properties as DPA (complementation being the notable difference), and enjoy some of the desirable algorithmic properties of DPA.

An interesting direction for further research concerns the complexity of resolving nondeterminism in history-deterministic Parikh automata. We have shown that if the winning region of Resolver in the one-token game is semilinear, then there is a DPA-implementable resolver. In further research, we investigate whether the winning region is necessarily semilinear. Note that the analogous result for history-deterministic pushdown automata fails: not every history-deterministic pushdown automaton has a pushdown resolver [34, Theorem 7.3][26, Lemma 10.2].

Good-for-gameness is another notion of restricted nondeterminism that is very tightly related to history-determinism. In fact, both terms were used interchangeably until very recently, when it was shown that they do not always coincide [4]. Formally, an automaton 𝒜\mathcal{A} is good-for-games if every two-player zero-sum game with winning condition L(𝒜)L(\mathcal{A}) has the same winner as the game where the player who wins if the outcome is in L(𝒜)L(\mathcal{A}) additionally has to construct a witnessing run of 𝒜\mathcal{A} during the play. This definition comes in two forms, depending on whether one considers only finitely branching (weak compositionality) or all games (compositionality).

Recently, the difference between being history-deterministic and both types of compositionality has been studied in detail for pushdown automata [25]. These results are very general and can easily be transferred to PA and 1-RBCM. They show that for PA, being history-deterministic, compositionality, and weak compositionality all coincide, while for 1-RBCM, being history-deterministic and compositionality coincide, but not weak compositionality.

The reason for this difference can be traced back to the fact that 1-RBCM may contain transitions that do not move the reading head (which are essentially ε\varepsilon-transitions), but that have side-effects beyond state changes, i.e., the counters are updated. This means that an unbounded number of configurations can be reached by processing a single letter, which implies that the game composed of an arena and a 1-RBCM may have infinite branching. So, while HDPA and 1-HDRBCM are expressively equivalent, they, perhaps surprisingly, behave differently when it comes to compositionality.

References

  • [1] Marc Bagnol and Denis Kuperberg. Büchi good-for-games automata are efficiently recognizable. In Sumit Ganguly and Paritosh Pandya, editors, FSTTCS 2018, volume 122 of LIPIcs, pages 16:1–16:14. Schloss Dagstuhl–Leibniz-Zentrum für Informatik, 2018.
  • [2] Brenda S. Baker and Ronald V. Book. Reversal-bounded multipushdown machines. J. Comput. Syst. Sci., 8(3):315–332, 1974.
  • [3] Udi Boker, Denis Kuperberg, Orna Kupferman, and Michal Skrzypczak. Nondeterminism in the presence of a diverse or unknown future. In Fedor V. Fomin, Rusins Freivalds, Marta Z. Kwiatkowska, and David Peleg, editors, ICALP 2013, Part II, volume 7966 of LNCS, pages 89–100. Springer, 2013.
  • [4] Udi Boker and Karoliina Lehtinen. History determinism vs. good for gameness in quantitative automata. In Mikołaj Bojańczyk and Chandra Chekuri, editors, FSTTCS 2021, volume 213 of LIPIcs, pages 38:1–38:20, Dagstuhl, Germany, 2021. Schloss Dagstuhl – Leibniz-Zentrum für Informatik.
  • [5] Udi Boker and Karoliina Lehtinen. Token games and history-deterministic quantitative automata. In Patricia Bouyer and Lutz Schröder, editors, FOSSACS 2022, volume 13242 of LNCS, pages 120–139. Springer, 2022.
  • [6] Udi Boker and Karoliina Lehtinen. When a little nondeterminism goes a long way: An introduction to history-determinism. ACM SIGLOG News, 10(1):24–51, February 2023.
  • [7] Alin Bostan, Arnaud Carayol, Florent Koechlin, and Cyril Nicaud. Weakly-unambiguous Parikh automata and their link to holonomic series. In Artur Czumaj, Anuj Dawar, and Emanuela Merelli, editors, ICALP 2020, volume 168 of LIPIcs, pages 114:1–114:16. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2020.
  • [8] Michaël Cadilhac, Alain Finkel, and Pierre McKenzie. Affine parikh automata. RAIRO Theor. Informatics Appl., 46(4):511–545, 2012.
  • [9] Michaël Cadilhac, Alain Finkel, and Pierre McKenzie. Unambiguous constrained automata. Int. J. Found. Comput. Sci., 24(7):1099–1116, 2013.
  • [10] Giusi Castiglione and Paolo Massazza. On a class of languages with holonomic generating functions. Theor. Comput. Sci., 658:74–84, 2017.
  • [11] Nikolay Chikin, Vladimir Gurvich, Konstantin Knop, Michael S. Paterson, and Michael Vyalyi. More about exact slow k-Nim. Integers: Electronic Journal of Combinatorial Number Theory, 21, 2021.
  • [12] Lorenzo Clemente, Wojciech Czerwinski, Slawomir Lasota, and Charles Paperman. Regular Separability of Parikh Automata. In Ioannis Chatzigiannakis, Piotr Indyk, Fabian Kuhn, and Anca Muscholl, editors, ICALP 2017, volume 80 of LIPIcs, pages 117:1–117:13. Schloss Dagstuhl–Leibniz-Zentrum für Informatik, 2017.
  • [13] Thomas Colcombet. The theory of stabilisation monoids and regular cost functions. In Susanne Albers, Alberto Marchetti-Spaccamela, Yossi Matias, Sotiris E. Nikoletseas, and Wolfgang Thomas, editors, ICALP 2009, (Part II), volume 5556 of LNCS, pages 139–150. Springer, 2009.
  • [14] Luc Dartois, Emmanuel Filiot, and Jean-Marc Talbot. Two-way Parikh automata with a visibly pushdown stack. In Mikolaj Bojanczyk and Alex Simpson, editors, FOSSACS 2019, volume 11425 of LNCS, pages 189–206. Springer, 2019.
  • [15] Jürgen Dassow and Victor Mitrana. Finite automata over free groups. Int. J. Algebra Comput., 10(6):725–738, 2000.
  • [16] François Denis, Aurélien Lemay, and Alain Terlutte. Residual finite state automata. In Afonso Ferreira and Horst Reichel, editors, STACS 2001, volume 2010 of LNCS, pages 144–157. Springer, 2001.
  • [17] Enzo Erlich, Shibashis Guha, Ismaël Jecker, Karoliina Lehtinen, and Martin Zimmermann. History-deterministic parikh automata. In Guillermo A. Pérez and Jean-François Raskin, editors, CONCUR 2023, volume 279 of LIPIcs, pages 31:1–31:16. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2023.
  • [18] Diego Figueira and Leonid Libkin. Path logics for querying graphs: Combining expressiveness and efficiency. In LICS 2015, pages 329–340. IEEE Computer Society, 2015.
  • [19] Emmanuel Filiot, Shibashis Guha, and Nicolas Mazzocchi. Two-way Parikh automata. In Arkadev Chattopadhyay and Paul Gastin, editors, FSTTCS 2019, volume 150 of LIPIcs, pages 40:1–40:14. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2019.
  • [20] Emmanuel Filiot, Nicolas Mazzocchi, and Jean-François Raskin. A pattern logic for automata with outputs. Int. J. Found. Comput. Sci., 31(6):711–748, 2020.
  • [21] Seymour Ginsburg and Edwin H. Spanier. Bounded ALGOL-like languages. Transactions of the American Mathematical Society, 113(2):333–368, 1964.
  • [22] Seymour Ginsburg and Edwin H. Spanier. Semigroups, Presburger formulas, and languages. Pacific Journal of Mathematics, 16(2):285 – 296, 1966.
  • [23] Mario Grobler, Leif Sabellek, and Sebastian Siebertz. Remarks on Parikh-Recognizable Omega-languages. In Aniello Murano and Alexandra Silva, editors, CSL 2024, volume 288 of LIPIcs, pages 31:1–31:21, Dagstuhl, Germany, 2024. Schloss Dagstuhl – Leibniz-Zentrum für Informatik.
  • [24] Erich Grädel, Wolfgang Thomas, and Thomas Wilke, editors. Automata, Logics, and Infinite Games: A Guide to Current Research, volume 2500 of LNCS. Springer, 2002.
  • [25] Shibashis Guha, Ismaël Jecker, Karoliina Lehtinen, and Martin Zimmermann. Parikh automata over infinite words. In Anuj Dawar and Venkatesan Guruswami, editors, FSTTCS 2022, volume 250 of LIPIcs, pages 40:1–40:20. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2022.
  • [26] Shibashis Guha, Ismaël Jecker, Karoliina Lehtinen, and Martin Zimmermann. A bit of nondeterminism makes pushdown automata expressive and succinct. Log. Methods Comput. Sci., 20(1), 2024.
  • [27] Thomas A. Henzinger, Karoliina Lehtinen, and Patrick Totzke. History-deterministic timed automata. In Bartek Klin, Slawomir Lasota, and Anca Muscholl, editors, CONCUR 2022, volume 243 of LIPIcs, pages 14:1–14:21. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2022.
  • [28] Thomas A. Henzinger and Nir Piterman. Solving games without determinization. In Zoltán Ésik, editor, CSL 2006, volume 4207 of LNCS, pages 395–410. Springer, 2006.
  • [29] John E. Hopcroft and Jeffrey D. Ullman. Introduction to Automata Theory, Languages and Computation. Addison-Wesley, 1979.
  • [30] Oscar H. Ibarra. Reversal-bounded multicounter machines and their decision problems. J. ACM, 25(1):116–133, 1978.
  • [31] Felix Klaedtke and Harald Rueß. Parikh automata and monadic second-order logics with linear cardinality constraints. Technical Report 177, Albert-Ludwigs-Universität Freiburg, 2002.
  • [32] Felix Klaedtke and Harald Rueß. Monadic second-order logics with cardinalities. In Jos C. M. Baeten, Jan Karel Lenstra, Joachim Parrow, and Gerhard J. Woeginger, editors, ICALP 2003, volume 2719 of LNCS, pages 681–696. Springer, 2003.
  • [33] Denis Kuperberg and Michal Skrzypczak. On determinisation of good-for-games automata. In Magnús M. Halldórsson, Kazuo Iwama, Naoki Kobayashi, and Bettina Speckmann, editors, ICALP 2015 (Part II), volume 9135 of LNCS, pages 299–310. Springer, 2015.
  • [34] Karoliina Lehtinen and Martin Zimmermann. Good-for-games ω\omega-pushdown automata. LMCS, 18(1), 2022.
  • [35] Hing Leung. Descriptional complexity of NFA of different ambiguity. Int. J. Found. Comput. Sci., 16(5):975–984, 2005.
  • [36] Christof Löding and Stefan Repke. Decidability Results on the Existence of Lookahead Delegators for NFA. In Anil Seth and Nisheeth K. Vishnoi, editors, FSTTCS 2013, volume 24 of LIPIcs, pages 327–338, Dagstuhl, Germany, 2013. Schloss Dagstuhl – Leibniz-Zentrum für Informatik.
  • [37] Marvin L. Minsky. Computation: Finite and Infinite Machines. Prentice-Hall, 1967.
  • [38] Victor Mitrana and Ralf Stiebe. Extended finite automata over groups. Discret. Appl. Math., 108(3):287–300, 2001.
  • [39] Rohit Parikh. On context-free languages. J. ACM, 13(4):570–581, 1966.
  • [40] Karianto Wong. Parikh automata with pushdown stack, 2004. Diploma thesis, RWTH Aachen University.