Bisimulation Equivalence of First-Order Grammars is ACKERMANN-Complete
Petr Jan\v{c}ar, Sylvain Schmitz

TL;DR
This paper establishes that the problem of checking bisimulation equivalence for first-order grammars is ACKERMANN-complete, providing the first complexity bounds and showing fixed-state cases are primitive-recursive.
Contribution
It introduces the first known complexity upper bound for bisimulation equivalence of first-order grammars, proving ACKERMANN-completeness and analyzing fixed-state cases.
Findings
Bisimulation equivalence for first-order grammars is ACKERMANN-complete.
Strong bisimilarity is primitive-recursive with fixed number of states.
Provides the first complexity bounds for this problem.
Abstract
Checking whether two pushdown automata with restricted silent actions are weakly bisimilar was shown decidable by S\'enizergues (1998, 2005). We provide the first known complexity upper bound for this famous problem, in the equivalent setting of first-order grammars. This ACKERMANN upper bound is optimal, and we also show that strong bisimilarity is primitive-recursive when the number of states of the automata is fixed.
| Constant | Ref. in [20] | Ref. here | Growth in | |
|---|---|---|---|---|
| (7) | (2) | linear | ||
| hinc | (4) | (3) | linear | |
| sinc | (5) | (4) | linear | |
| (6) | (5) | exponential | ||
| (13) | doubly exponential | |||
| (19) | exponential | |||
| (21) | doubly exponential | |||
| (24) | (6) | doubly exponential | ||
| (25) | doubly exponential | |||
| (26) | exponential | |||
| (23) | doubly exponential | |||
| (31) | doubly exponential | |||
| (38) | doubly exponential | |||
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Bisimulation Equivalence of First-Order Grammars is ACKERMANN-Complete
Petr Jančar1 and Sylvain Schmitz2,3
1 Dept of Computer Science, Faculty of Science
Palacký University in Olomouc
Czechia
2 LSV, ENS Paris-Saclay & CNRS
Université Paris-Saclay
France
3 IUF, France
Abstract.
Checking whether two pushdown automata with restricted silent actions are weakly bisimilar was shown decidable by Sénizergues (1998, 2005). We provide the first known complexity upper bound for this famous problem, in the equivalent setting of first-order grammars. This ACKERMANN upper bound is optimal, and we also show that strong bisimilarity is primitive-recursive when the number of states of the automata is fixed.
1. Introduction
Bisimulation equivalence plays a central role among the many notions of semantic equivalence studied in verification and concurrency theory [11]. Indeed, two bisimilar processes always satisfy exactly the same specifications written in modal logics [2] or in the modal -calculus [14], allowing one to replace for instance a naive implementation with a highly optimised one without breaking the conformance. As a toy example, the two recursive Erlang functions below implement the same stateful message relaying service, that either receives {upd, M1} and updates its internal message from M to M1, or receives {rel,C} and sends the message M to the client C.
1serverA(M) serverB(M)
2 receive M2 = receive
3 {upd, M1} serverA(M1); {upd, M1} M1;
4 {rel, C } C!M, {rel, C } C!M, M;
5 serverA(M); end,
6 end. serverB(M2).
The two programs are weakly bisimilar if we only observe the input (receive) and output (C!M) actions, but the one on the left is not tail-recursive and might perform poorly compared to the one on the right.
In a landmark 1998 paper, Sénizergues [32, 34] proved the decidability of bisimulation equivalence for rooted equational graphs of finite out-degree. The proof extends his previous seminal result [31, 33], which is the decidability of language equivalence for deterministic pushdown automata (DPDA), and entails that weak bisimilarity of pushdown processes where silent actions are deterministic is decidable; a silent action (also called an -step) is deterministic if it has no alternative when enabled. Because the control flow of a first-order recursive program is readily modelled by a pushdown process, one can view this result as showing that the equivalence of recursive programs (like the two Erlang functions above) is decidable as far as their observable behaviours are concerned, provided silent moves are deterministic. Regarding decidability, Sénizergues’ result is optimal in the sense that bisimilarity becomes undecidable if we consider either nondeterministic (popping) -steps [21], or second-order pushdown processes with no -steps [4]. Note that the decidability border was also refined in [39] by considering branching bisimilarity, a stronger version of weak bisimilarity.
Computational Complexity
While this delineates the decidability border for equivalences of pushdown processes, the computational complexity of the bisimilarity problem is open. Sénizergues’ algorithm consists in two semi-decision procedures, with no clear means of bounding its complexity, and subsequent works like [17] have so far not proven easier to analyse. We know however that this complexity must be considerable, as the problem is \ComplexityFontTOWER-hard in the real-time case (i.e., without silent actions, hence for strong bisimilarity) [1] and \ComplexityFontACKERMANN-hard in the general case (with deterministic silent actions) [18]—we are employing here the ‘fast-growing’ complexity classes defined in [29], where is the lowest non elementary class and the lowest non primitive-recursive one.
In fact, the precise complexity of deciding equivalences for pushdown automata and their restrictions is often not known—as is commonplace with infinite-state processes [35]. For instance, language equivalence of deterministic pushdown automata is ¶-hard and was shown to be in \ComplexityFontTOWER by Stirling [37] (see [18] for an explicit upper bound), and bisimilarity of BPAs (i.e., real-time pushdown processes with a single state) is \ComplexityFontEXPTIME-hard [22] and in \ComplexityFont2EXPTIME [5] (see [16] for an explicit proof). There are also a few known completeness results in restricted cases: bisimilarity of normed BPAs is ¶-complete [13] (see [10] for the best known upper bound), bisimilarity of real-time one-counter processes (i.e., of pushdown processes with a singleton stack alphabet) is \PSPACE-complete [3], and bisimilarity of visibly pushdown processes is \ComplexityFontEXPTIME-complete [36].
Contributions
In this paper, we prove that the bisimilarity problem for pushdown processes is in , even the weak bisimilarity problem when silent actions are deterministic. Combined with the already mentioned lower bound from [18], this shows the problem to be \ComplexityFontACKERMANN-complete. This is the first instance of a complexity completeness result in the line of research originating from Sénizergues’ work [31, 32, 33, 34]; see Tab. 1.
Rather than working with rooted equational graphs of finite out-degree or with pushdown processes with deterministic silent actions, our proof is cast in the formalism of first-order grammars (see Sec. 2), which are term rewriting systems with a head rewriting semantics, and are known to generate the same class of graphs [7].
Our proof heavily relies on the main novelty from [17]: the bisimilarity of two arbitrary terms according to a first-order grammar essentially hinges on a finite basis of pairs of non-equivalent terms, which can be constructed from the grammar independently of the terms provided as input. The basis provides a number that allows us to compute a bound on the ‘equivalence-level’ of two non-equivalent terms; this is the substance of the decision procedure (see Sec. 3). Both in [17] and in its reworked version in [20], such a basis is obtained through a brute force argument, which yields no complexity statement. In Sec. 4 we exhibit a concrete algorithm computing the basis, and we analyse its complexity in the framework of [28, 29, 30] in Sec. 5, yielding the \ComplexityFontACKERMANN upper bound.
Finally, although our results do not match the \ComplexityFontTOWER lower bound of Benedikt et al. [1] in the case of real-time pushdown processes, we nevertheless show in Sec. 6 that bisimilarity becomes primitive-recursive in that case if additionally the number of control states of the pushdown processes is fixed.
2. First-Order Grammars
First-order grammars are labelled term rewriting systems with a head rewriting semantics. They are a natural model of first-order functional programs with a call-by-name semantics, and were shown to generate the class of rooted equational graphs of finite out-degree by Caucal [6, 7], where they are called term context-free grammars. Here we shall use the terminology and notations from [20].
2.1. Regular Terms
Let be a finite ranked alphabet, i.e., where each symbol in comes with an arity in \mathbb{N}\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}\{0,1,2,\dots\}, and \textsc{Var}\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}\{x_{1},x_{2},\dots\} a countable set of variables, all with arity zero. We work with possibly infinite regular terms over and Var, i.e., terms with finitely many distinct subterms. Let denote the set of all regular terms over and Var. We further use for nonterminals, and for terms, possibly primed and/or with subscripts.
Representations
Such terms can be represented by finite directed graphs as shown in Fig. 1, where each node has a label in and a number of ordered outgoing arcs equal to its arity. The unfolding of the graph representation is the desired term, and there is a bijection between the nodes of the least graph representation of a term and the set of subterms of .
Size and Height
We define the size of a term as its number of distinct subterms. For instance, , , and in Fig. 1. For two terms and , we also denote by the number of distinct subterms of and ; note that can be smaller than , as they might share some subterms. For instance, in Fig. 1. We let denote the number of distinct subterms of with root labels in ; e.g., in Fig. 1. A term is thus finite if and only if its graph representation is acyclic, in which case it has a height , which is the maximal length of a path from the root to a leaf; for instance in Fig. 1. Finally, we let denote the set of variables occurring in , and let \textsc{var}(E,F)\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}\textsc{var}(E)\cup\textsc{var}(F); e.g., in Fig. 1.
2.2. Substitutions
A substitution is a map whose support \textsc{supp}(\sigma)\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}\{x\in\textsc{Var}\mid\sigma(x)\neq x\} is finite. This map is lifted to act over terms by
[TABLE]
for all in Var, in , and in . For instance, in Fig. 1, if and .
2.3. Grammars
A first-order grammar is a tuple where is a finite ranked alphabet of nonterminals, a finite alphabet of actions, and a finite set of labelled term rewriting rules of the form where , , and is a finite term in with .
Head Rewriting Semantics
A first-order grammar defines an infinite labelled transition system
[TABLE]
over as set of states, as set of actions, and with a transition relation for each , where each rule of induces a transition
[TABLE]
for every substitution . This means that rewriting steps can only occur at the root of a term, rather than inside a context. For instance, the rules and give rise on the terms of Fig. 1 to the transitions and . The transition relations are extended to for words in the standard way.
Note that variables are ‘dead’, in that no transitions can be fired from a variable. In fact, in Sec. 3.1 we discuss that for technical reasons we could formally assume that each variable has its unique action and a transition .
Grammatical Constants
Let us fix a first-order grammar . We define its size as
[TABLE]
bound respectively the maximal arity of its nonterminals, its maximal height increase in one transition step, and its maximal size increase in one transition step.
If in for some in and in , then we call an -sink word. Observe that , hence with in and , where either and or ‘sinks’ to when applying . Thus, for each and we can compute some shortest -sink word by dynamic programming; in the cases where no -sink word exist, we can formally put w_{[A,i]}\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}\varepsilon. In turn, this entails that the maximal length of shortest sink words satisfies
[TABLE]
here and in later instances, we let \max\emptyset\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}0.
Finally, the following grammatical constant from [20] is important for us:
[TABLE]
note that is at most doubly exponential in the size of . This was chosen in [20] so that each can be written as where and , and it is guaranteed that each path where can be presented as where . Put simply: bounds the number of depth- subterms for each term .
3. Bisimulation Equivalence
Bisimulation equivalence has been introduced independently in the study of modal logics [2] and in that of concurrent processes [25, 26]. We recall here the basic notions surrounding bisimilarity before we introduce the key notion of candidate bases as defined in [20].
3.1. Equivalence Levels
Consider a labelled transition system
[TABLE]
like the one defined by a first-order grammar, with set of states , set of actions , and a transition relation for each in . We work in this paper with image-finite labelled transition systems, where is finite for every in and in . In this setting, the coarsest (strong) bisimulation can be defined through a chain
[TABLE]
of equivalence relations over : let {\sim_{0}}\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}\mathcal{S}\times\mathcal{S} and for each in , let if and
[]
**(zig): **
if for some , then there exists such that and , and
**(zag): **
if for some , then there exists such that and .
We put \sim_{\omega}\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}\bigcap_{k\in\mathbb{N}}{\sim_{k}}; hence .
For each pair of states in , we may then define its equivalence level in as
[TABLE]
Here we should add that—to be consistent with [20]—we stipulate that when ; in particular when . This would automatically hold if we equipped each with a special transition in , as we already mentioned. This stipulation guarantees that .
Two states are (strongly) bisimilar if , which is if and only if . We will later show an algorithm computing the equivalence level of two given terms in the labelled transition system defined by a given first-order grammar. The main decision problem in which we are interested is the following.
Problem** (Bisimulation).**
[]
**input: **
A first-order grammar and two terms in .
**question: **
Is in the labelled transition system ?
3.2. Bisimulation Game
Observe that the following variant of the bisimulation problem is decidable.
Problem** (Bounded Equivalence Level).**
[]
**input: **
A first-order grammar , two terms in , and in .
**question: **
Is in the labelled transition system ?
Indeed, as is well-known, the zig-zag condition can be recast as a bisimulation game between two players called Spoiler and Duplicator. A position of the game is a pair . Spoiler wants to prove that the two states are not bisimilar, while Duplicator wants to prove that they are bisimilar. The game proceeds in rounds; in each round,
- •
Spoiler chooses and a transition (if no such transition exists, Spoiler loses), then
- •
Duplicator chooses a transition with the same label (if no such transition exists, Duplicator loses);
the game then proceeds to the next round from position . Then if and only if Spoiler has a strategy to win in the th round at the latest when starting the game from . Note that this game is determined and memoryless strategies suffice.
Thus, the bounded equivalence level problem can be solved by an alternating Turing machine that first writes the representation of and on its tape, and then plays at most rounds of the bisimulation game, where each round requires at most a polynomial number of computational steps in the size of the grammar (assuming a somewhat reasonable tape encoding of the terms).
Fact 1**.**
*The bounded equivalence level problem is in
\ComplexityFont{ATIME}\big{(}\textsc{size}(E,F)+\poly(|\mathcal{G}|)\cdot e\big{)}.*
3.3. Candidate Bases
Consider some fixed first-order grammar . Given three numbers , , and in —which will depend on —, an -candidate basis for non-equivalence is a set of pairs of terms associated with two sequences of numbers and such that
- (1)
, 2. (2)
for each there is such that and , 3. (3)
s_{n}\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}s, and the remaining numbers are defined inductively by
[TABLE]
Note that the numbers and are entirely determined by and , , and . An -candidate basis yields a bound defined by
[TABLE]
Full Bases
For , let
[TABLE]
An -candidate basis is full below some equivalence level if, for all and all such that we have . We say that is full if it is full below . In other words and because , is full if and only if, for all , .
Proposition 2** ([20, Prop. 9]).**
For any , there is a unique full -candidate basis, denoted by .
Proof.
The full candidate basis is constructed by induction over . Let s_{n}\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}s and consider the finite set S_{n}\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}\{(E,F)\in\textsc{Terms}_{\mathcal{N}}\times\textsc{Terms}_{\mathcal{N}}\mid E\nsim F\wedge\exists j\leq n\mathbin{.}\textsc{var}(E,F)=\{x_{1},\dots,x_{j}\}\wedge\textsc{size}(E,F)\leq s_{n}\}; has a maximal equivalence level e_{n}\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}\max_{(E,F)\in S_{n}}\textsc{el}(E,F). If , we define \mathcal{B}_{0,s,g}\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}S_{0}. Otherwise, we let s_{n-1}\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}2s_{n}+g+e_{n}(\textsc{sinc}+g) as in (9); by induction hypothesis there is a unique full -candidate basis and we set \mathcal{B}_{n,s,g}\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}S_{n}\cup\mathcal{B}_{n-1,s_{n-1},g}. ∎
The main result from [20] can now be stated.
Theorem 3** ([20, Thm. 7]).**
Let be a first-order grammar. Then one can compute a grammatical constant exponential in and grammatical constants , , and doubly exponential in such that, for all terms in with ,
[TABLE]
Theorem 3 therefore shows that the bisimulation problem can be reduced to the bounded equivalence level problem, provided one can compute the full -candidate basis for suitable , , and —see Tab. 2 in the appendix for details on how the grammatical constants , , , and are defined in [20]. Our goal in Sec. 4 will thus be to exhibit a concrete algorithm computing the full candidate basis , in order to derive an upper bound on .
The proof of [20, Thm. 7] relies on the following insight, which we will also need in order to prove the correctness of our algorithm.
Lemma 4** ([20, Eq. 39]).**
Let be a first-order grammar, be defined as in Thm. 3, be two terms in with , and be an -candidate basis full below . Then
[TABLE]
4. Computing Candidate Bases
Theorem 3 shows that, in order to solve the bisimulation problem, it suffices to compute and and then solve the bounded equivalence problem, for which Fact 1 provides a complexity upper bound. In this section, we show how to compute for an input first-order grammar . Note that this grammatical constant was shown computable in [17, 20] through a brute-force argument, but here we want a concrete algorithm, whose complexity will be analysed in Sec. 5. We proceed in two steps, by first considering a non effective version in Sec. 4.1, whose correctness is straightforward, and then the actual algorithm in Sec. 4.2.
4.1. Non Effective Version
Throughout this section, we consider as a fixed parameter. We first assume that we have an oracle at our disposal, that returns the equivalence level in ; the parameters will be used in the effective version in Sec. 4.2. The following procedure then constructs full -candidate basis and its associated bound , by progressively adding pairs from the sets until the candidate basis is full. In order not to clutter the presentation too much, we assume implicitly that the equivalence level of each pair added to on line 14 is implicitly stored, thus it does not need to be recomputed on line 19.
1 procedure CandidateBoundn(, , , )
2 \mathcal{B}\leftarrow\emptyset$$\triangleright Initialisation
3 for do
4
5
6 for do
7
8
9 for do
10
11 while do
12 e\leftarrow\textsc{EqLevel}(\mathcal{G},\mathcal{E}_{\mathcal{B}},c,E,F)$$\triangleright Main loop
13
14
15 if **then If so, then update **
16
17 for do
18
19
20
21
22 return
Invariant
The procedure maintains as an invariant of its main loop on lines 11–21 that is an -candidate basis associated with the numbers and , and that is its associated bound. This holds indeed after the initialisation phase on lines 2–8, and is then enforced in the main loop by the update instructions on lines 15–21.
Correctness
Let us check that, if it terminates, this non effective version does indeed return the bound associated with the unique full -candidate basis . By the previous invariant, it suffices to show that is full when the procedure terminates. Consider for this some index and a pair with for some . By definition of the sets on lines 9–10 and their updates on lines 13 and 20 in the main loop, the pair must have been added to some for . Then the pair must have been selected by the condition of the main loop on line 11, and added to .
Termination
Although we are still considering a non effective version of the algorithm, the proof that it always terminates is the same as the one for the effective version in Sec. 4.2. We exhibit a ranking function on the main loop, thereby showing that it must stop eventually. More precisely, each time we enter the main loop on line 11, we associate to the current state of the procedure the ordinal rank below defined by111 Note that this is equivalent to defining the rank as the tuple in , ordered lexicographically, but ordinal notations are more convenient for our analysis in Sec. 5.
[TABLE]
This defines a descending sequence of ordinals
[TABLE]
of ordinals, where is the rank after iterations of the main loop. Indeed, each time we enter the loop, the cardinal of the set under consideration strictly decreases on line 13, and is not modified by the updates on line 20, which only touch the sets for . Hence terminates.
4.2. Effective Version
In order to render effective, we provide an implementation of EqLevel that does not require an oracle for the bisimulation problem, but relies instead on Lem. 4 and the bounded equivalence level problem, which as we saw in Sec. 3.2 is decidable.
1 procedure EqLevel(, , , , )
2 if \textsc{el}(E,F)\leq c\cdot\big{(}\mathcal{E}_{\mathcal{B}}\cdot\textsc{size}(E,F)+\textsc{size}(E,F)^{2}\big{)} then
3 return
4 else
5 return
We establish the correctness of this effective variant in the following theorem, which uses the same reasoning as the proof of [20, Thm. 7].
Theorem 5**.**
The effective version of procedure terminates and, provided , , , and are defined as in Thm. 3, returns the bound .
Proof.
Termination is guaranteed by the ranking function defined by (12). Regarding correctness, assume the provided , , , and are defined as in Thm. 3, and let us define a (reflexive and symmetric) relation on by if and only if \textsc{el}(E,F)>c\cdot\big{(}k\cdot\textsc{size}(E,F)+\textsc{size}(E,F)^{2}\big{)}. Clearly, for all in . We say that an -candidate basis is -complete if, for all , . We call complete if it is -complete. By the reasoning we used for showing the correctness of the non effective version, when the effective version of terminates, is complete.
It remains to show that is complete if and only if it is full. First observe that, if is full, then it is complete: indeed, being full entails that, for all in , is in , hence .
Conversely, assume that is complete, and let us show that it is full; it suffices to show that, in that case, . By contradiction, consider a pair with ; without loss of generality, can be assumed minimal among all such pairs. Then is full below : indeed, if and , since was taken minimal, and therefore belongs to since is complete. Thus Lem. 4 applies and shows that , a contradiction. ∎
5. Complexity Upper Bounds
In this section, we analyse the procedure to derive an upper bound on the computed . In turn, by facts 1 and 3, this bound will allow us to bound the complexity of the bisimulation problem. The idea is to analyse the ranking function defined by (12) in order to bound how many times the main loop of can be executed. We rely for this on a so-called ‘length function theorem’ from [28] to bound the length of descending sequences of ordinals like (13). Finally, we classify the final upper bound using the ‘fast-growing’ complexity classes defined in [29]. A general introduction to these techniques can be found in [30]. Throughout this section, we assume that the values of , , , and are the ones needed for Thm. 3 to hold.
5.1. Controlled Descending Sequences
Though all descending sequences of ordinals are finite, we cannot bound their lengths in general; e.g., and are descending sequences of length for all in . Nevertheless, the sequence (13) produced by is not arbitrary, because the successive ranks are either determined by the input and the initialisation phase, or the result of some computation, hence one cannot use an arbitrary as in these examples.
This intuition is captured by the notion of controlled sequences. For an ordinal (like the ranks defined by (12)), let us write in Cantor normal form as
[TABLE]
with and in , and define its size as
[TABLE]
Let be a natural number in and a monotone inflationary function, i.e., implies , and . A sequence of ordinals below is -controlled if, for all in ,
[TABLE]
i.e., the size of the th ordinal is bounded by the th iterate of applied to ; in particular, . Because for each , there are only finitely many ordinals below of size at most , the length of controlled descending sequences is bounded [see, e.g., 28]. One can actually give a precise bound on this length in terms of subrecursive functions, whose definition we are about to recall.
5.2. Subrecursive Functions
Algorithms shown to terminate via an ordinal ranking function can have a very high worst-case complexity. In order to express such large bounds, a convenient tool is found in subrecursive hierarchies, which employ recursion over ordinal indices to define faster and faster growing functions. We define here two such hierarchies.
Fundamental Sequences
A fundamental sequence for a limit ordinal is a strictly ascending sequence of ordinals with supremum . We use the standard assignment of fundamental sequences to limit ordinals , defined inductively by
[TABLE]
where is in Cantor normal form. This particular assignment satisfies, e.g., for all . For instance, and .
Hardy and Cichoń Hierarchies
In the context of controlled sequences, the hierarchies of Hardy and Cichoń turn out to be especially well-suited [8]. Let be a function. For each such , the Hardy hierarchy and the Cichoń hierarchy relative to are two families of functions defined by induction over by
[TABLE]
The Hardy functions are well-suited for expressing a large number of iterations of the provided function . For instance, for some finite is simply the th iterate of . This intuition carries over: is a ‘transfinite’ iteration of the function , using a kind of diagonalisation in the fundamental sequences to handle limit ordinals. For instance, if we use the successor function as our function , we see that a first diagonalisation yields . The next diagonalisation occurs at . Fast-forwarding a bit, we get for instance a function of exponential growth , and later a non-elementary function akin to a tower of exponentials, and a non primitive-recursive function of Ackermannian growth.
In the following, we will use the following property of Hardy functions [38, 8], which can be checked by induction provided is in Cantor normal form (and justifies the use of superscripts):
[TABLE]
Regarding the Cichoń functions, an easy induction on shows that for the hierarchy relative to H(x)\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}x+1. But the main interest of Cichoń functions is that they capture how many iterations are performed by Hardy functions [8]:
[TABLE]
Length Function Theorem
We can now state a ‘length function theorem’ for controlled descending sequences of ordinals.
Theorem 6** ([28, Thm. 3.3]).**
Let . The maximal length of -controlled descending sequences of ordinals in is .
5.3. Controlling the Candidate Computation
General Approach
Consider an execution of entering the main loop at line 11 and let us define
[TABLE]
Controlling one Loop Execution
As a preliminary, let us observe that, for all , the number of elements of (defined in (11)) can be bounded by
[TABLE]
Indeed, the graph representation of some pair in has at most vertices, each labelled by a nonterminal symbol from or a variable from and with at most outgoing edges; finally the two roots must be distinguished.
Let us turn our attention to the contents of the main loop.
Lemma 7**.**
For all in we have where
[TABLE]
Proof.
Assume we enter the main loop for the th time with as defined in (19). On line 12, a new equivalence level is introduced, with since and , thus in case of an update on line 16, we have . Consider now the for loop on lines 17–20. Regarding line 19, observe that , thus
[TABLE]
Finally, regarding line 21, by (24), . ∎
Final Bound
Let us finally express (22) in terms of and . First observe that, at the end of the initialisation phase of lines 2–8, , , , and , thus
[TABLE]
Then, because the bounds in lemmata 7 and 27 are in terms of (recall that the grammatical constant is exponential and , , and are doubly exponential in terms of ), there exists a constant independent from such that and for all and , where according to (16) is the th iterate of . Then by (17), h(x)\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}H^{\omega^{2}\cdot d}(x) is a suitable control function that satisfies (20) and therefore (22).
Finally, because and by (17), . We have just shown the following upper bound.
Lemma 8**.**
Let be a first-order grammar and , , and be defined as in Thm. 3. Then where h(x)\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}H^{\omega^{2}\cdot d}(x) for some constant .
5.4. Fast-Growing Complexity
It remains to combine Fact 1 with Lem. 8 in order to provide an upper bound for the bisimilarity problem. We will employ for this the fast-growing complexity classes defined in [29]. This is an ordinal-indexed hierarchy of complexity classes , that uses the Hardy functions relative to H(x)\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}x+1 as a standard against which we can measure high complexities.
Fast-Growing Complexity Classes
Let us first define
[TABLE]
denote the class of decision problems solved by deterministic Turing machines in time O\big{(}H^{\omega^{\alpha}}\!(p(n))\big{)} for some function . The intuition behind this quantification over is that, just like e.g. \ComplexityFont{EXPTIME}=\bigcup_{p\in\poly}\ComplexityFont{DTIME}\big{(}2^{p(n)}\big{)} quantifies over polynomial functions to provide enough ‘wiggle room’ to account for polynomial reductions, is closed under reductions [29, Thms. 4.7 and 4.8].
For instance, \ComplexityFont{TOWER}\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}\ComplexityFont{F}_{\!3} defines the class of problems that can be solved using computational resources bounded by a tower of exponentials of elementary height in the size of the input, is the class of primitive-recursive decision problems, and \ComplexityFont{ACKERMANN}\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}\ComplexityFont{F}_{\!\omega} is the class of problems that can be solved using computational resources bounded by the Ackermann function applied to some primitive-recursive function of the input size—here it does not matter for whether we are considering deterministic, nondeterministic, alternating, time, or space bounds [29, Sec. 4.2.1]. See Fig. 2 for a depiction.
Theorem 9**.**
The bisimulation problem for first-order grammars is in \ComplexityFontACKERMANN, and in if is fixed.
Proof.
This is a consequence of Fact 1 combined with theorems 3 and 8; the various overheads on top of the bound on are of course negligible for such high complexities [29, Lem. 4.6]. We rely here on [29, Thm. 4.2] to translate from with into a bound in terms of . ∎
6. Pushdown Processes
The complexity upper bounds obtained in Sec. 5 are stated in terms of first-order grammars. In this section, we revisit the known reduction from pushdown systems to first-order grammars (as given in [15, 19]), and we also give a direct reduction from first-order grammars to pushdown systems (instead of giving just a general reference to [9, 7]). We do this first to make clear that the reductions are primitive recursive (in fact, they are polynomial-time reductions), and second to show that, in the real-time case, Thm. 9 provides primitive-recursive bounds for pushdown systems with a fixed number of states.
Pushdown Systems
Let us first recall that a pushdown system (PDS) is a tuple of finite sets where the elements of are called control states, actions (or terminal letters), and stack symbols, respectively; contains transition rules of the form where , , , and . A pushdown system is called real-time if is restricted to be in , i.e., if no transition rules appear in .
A PDS generates the labelled transition system
[TABLE]
where each rule induces transitions for all . Note that might feature -transitions (also called -steps) if the PDS is not real-time.
6.1. From PDS to First-Order Grammars
We recall a construction already presented in the appendix of the extended version of [19]. The idea is that, although first-order grammars lack the notion of control state, the behaviour of a pushdown system can nevertheless be captured by a first-order grammar that uses -ary terms where is the number of control states.
Figure 3 (left) presents a configuration of a PDS—i.e., a state in —as a term; here we assume that . The string , depicted on the left in a convenient vertical form, is translated into a term presented by an acyclic graph in the figure. On the right in Fig. 3 we can see the translation of the PDS transition rule into a rule of a first-order grammar.
6.1.1. Real-Time Case
Let us first assume that is a real-time PDS, i.e., that each PDS transition rule is such that is in . We are interested in the following decision problem.
Problem** (Strong Bisimulation).**
[]
**input: **
A real-time pushdown system and two configurations in .
**question: **
Is in the labelled transition system ?
Formally, for a real-time PDS , where , we can define the first-order grammar
[TABLE]
where \mathcal{N}\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}Q\cup(Q\times\Gamma), with r(q)\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}0 and r((q,X))\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}m for all in and in ; the set is defined below. We write and for nonterminals and , respectively, and we map each configuration to a (finite) term in defined by structural induction:
[TABLE]
for all .
A PDS transition rule in with in is then translated into the first-order grammar rule
[TABLE]
It should be obvious that the labelled transition system is isomorphic with the restriction of the labelled transition system to the states where are configurations of ; moreover, the set is closed w.r.t. reachability in : if in , then where in .
Corollary 10**.**
The strong bisimulation problem for real-time pushdown systems is in \ComplexityFontACKERMANN, and in if the number of states is fixed.
Proof.
What we have sketched above is a polynomial-time (in fact, \ComplexityFontlogspace) reduction from the strong bisimulation problem in (real-time) pushdown systems to the bisimulation problem in first-order grammars, for which we can apply Thm. 9. Observe that, in this translation and according to the discussion after (6), we may bound by the number of states of the given pushdown system, which justifies the primitive-recursive upper bound when the number of states is fixed. (Figure 3 makes clear that all branches in have the same lengths, and there are precisely depth- subterms of , for each .) ∎
6.1.2. General Case
In the case of labelled transition systems with a silent action , by , for , we denote that there are and such that , , for all , and . Thus denotes an arbitrary sequence of silent steps, and for denotes that there are such that .
A relation is a weak bisimulation if the following two conditions hold:
[]
**(zig): **
if and for some , then there exists such that and ;
**(zag): **
if and for some , then there exists such that and .
By we denote weak bisimilarity, i.e., the largest weak bisimulation (the union of all weak bisimulations), which is an equivalence relation.
We are now interested in the following problem.
Problem** (Weak Bisimulation).**
[]
**input: **
A pushdown system and two configurations in .
**question: **
Is in the labelled transition system ?
Unfortunately, in general the weak bisimulation problem for PDS is undecidable, already for one-counter systems [24]; we can also refer, e.g., to [21] for further discussion. As already mentioned in the introduction, we thus consider PDS with (very) restricted silent actions: each rule in is deterministic (i.e., alternative-free), which means that there is no other rule with the left-hand side . From now on, by restricted PDS we mean PDS whose -rules are deterministic.
We aim to show that the weak bisimulation problem for restricted PDS reduces to the (strong) bisimulation problem for first-order grammars (where silent actions are not allowed by our definition). For this it is convenient to make a standard transformation [see, e.g., 12, Sec. 5.6] of our restricted PDS that removes non-popping -rules; an -rule is called popping if . This is captured by the next proposition. (When comparing two states from different LTSs, we implicitly refer to the disjoint union of these LTSs.)
Proposition 11**.**
There is a polynomial-time transformation of a restricted PDS to in which each -rule is deterministic and popping, and in is weakly bisimilar with in .
Proof.
Given a restricted PDS , we proceed as follows. First we find all such that
[TABLE]
and each rule with we add the rule . Finally we remove all the non-popping -rules. Thus arises. Identifying the configurations that satisfy conditions (34–36) can be performed in polynomial time through a saturation algorithm. The claim on the relation of and is straightforward. ∎
A stable configuration is either a configuration , or a configuration where there is no -rule of the form . In a restricted PDS with only popping -rules, any unstable configuration only allows to perform a finite sequence of silent popping steps until it reaches a stable configuration. It is natural to restrict our attention to the transitions with between stable configurations; such transitions might encompass sequences of popping -steps.
When defining the grammar , we can avoid the explicit use of deterministic popping silent steps, by ‘preprocessing’ them: we apply the inductive definition of the translation operator from (30–32) to stable configurations, while if is unstable, then there is exactly one applicable rule, , and in this case we let
[TABLE]
Figure 4 (right) shows the grammar-rule
[TABLE]
(arising from the PDS-rule ), when and there is a PDS-rule , while , are stable.
Corollary 12**.**
The weak bisimulation problem for restricted pushdown systems (i.e., where -rules are deterministic) is in .
Proof.
By Proposition 11 it suffices to consider a PDS where each -rule is deterministic and popping. Since it is clear that in iff in , the claim follows from Thm. 9. ∎
Note that, due to our preprocessing, the terms may have branches of varying lengths, which is why as defined in (6) might not be bounded by the number of states as in Cor. 10.
6.2. From First-Order Grammars to PDS
We have shown the -membership for bisimilarity of first-order grammars (Thm. 9), and thus also for weak bisimilarity of pushdown processes with deterministic -steps (Cor. 12). By adding the lower bound from [18], we get the -completeness for both problems.
In fact, the -hardness in [18] was shown in the framework of first-order grammars. The case of pushdown processes was handled by a general reference to the equivalences that are known, e.g., from [9] and the works referred there; another relevant reference for such equivalences is [7]. Nevertheless, in our context it seems more appropriate to show a direct transformation from first-order grammars to pushdown processes (with deterministic -steps), which can be argued to be primitive-recursive; in fact, it is a \ComplexityFontlogspace reduction.
Let be a first-order grammar. For a term such that (hence the root of is a nonterminal ) we define its root-substitution to be the substitution where and for all . A substitution is an rhs-substitution for if it is the root-substitution of a subterm of the right-hand side of a rule in (where ); we let denote the set of rhs-substitutions for .
We define the PDS M_{\mathcal{G}}\mathrel{\raisebox{-0.43057pt}{\stackrel{{\scriptstyle\raisebox{-0.75346pt}{\scalebox{0.5}{{def}}}}}{{=}}}}(Q,\Sigma,\Gamma,\Delta) where
[TABLE]
See Fig. 5 for an example. Note that the -rules are indeed deterministic; moreover, any non-popping -step, hence of the form , cannot be followed by another -step.
It should be obvious that a state in is weakly bisimilar with the state in . In particular we note that in (where also -steps might be comprised) entails that (in which case represents the term ), or when (in which case represents the term ).
We could add a technical discussion about how to represent all the terms from (including the infinite regular terms) in an enhanced version of , but this is not necessary since the lower bound construction in [18] uses only the states of that are reachable from ‘initial’ terms of the form (more precisely, of the form for a nullary nonterminal ).
Corollary 13**.**
The weak bisimulation problem for pushdown systems whose -rules are deterministic and popping is -hard.
Proof.
In [18], the \ComplexityFontACKERMANN-hardness of the control-state reachability problem for reset counter machines is recalled [27], and its polynomial-time (in fact, \ComplexityFontlogspace) reduction to the bisimulation problem for first-order grammars is shown. The reduction guarantees that a given control state is reachable from the initial configuration of a given reset counter machine iff in for the constructed grammar . As shown above, the question whether in can be further reduced to an instance of the weak bisimulation problem for the pushdown system . ∎
7. Concluding Remarks
Theorems 9 and 12 provide the first known worst-case upper bounds, in \ComplexityFontACKERMANN, for the strong bisimulation equivalence of first-order grammars and the weak bisimulation equivalence of pushdown processes restricted to deterministic silent steps. By the lower bound shown in [18] and Cor. 13, this is moreover optimal. An obvious remaining problem is to close the complexity gap in the case of strong bisimulation for real-time pushdown processes, which is only known to be \ComplexityFontTOWER-hard [1], and for which we do not expect Cor. 10 to provide tight upper bounds.
Appendix A Grammatical Constants
The proof of Thm. 3 in [20, Thm. 7] relies on the definition of several grammatical constants, which depend solely on the given first-order grammar . In Tab. 2 we summarise their definitions as a reference for the reader.
Acknowledgements
P. Jančar acknowledges the support of the Grant Agency of Czech Rep., GAČR 18-11193S; part of this research was conducted while he held an invited professorship at ENS Paris-Saclay. S. Schmitz is partially funded by ANR-17-CE40-0028 BraVAS.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1Benedikt et al. [2013] M. Benedikt, S. Göller, S. Kiefer, and A. S. Murawski. Bisimilarity of pushdown automata is nonelementary. In Proc. LICS’13 , pages 488–498. IEEE, 2013. doi:10.1109/LICS.2013.55 . · doi ↗
- 2van Benthem [1975] J. van Benthem. Modal Correspondence Theory . Ph D thesis, Mathematisch Instituut & Instituut voor Grondslagenonderzoek, University of Amsterdam, 1975.
- 3Böhm et al. [2014] S. Böhm, S. Göller, and P. Jančar. Bisimulation equivalence and regularity for real-time one-counter automata. J. Comput. Syst. Sci. , 80(4):720–743, 2014. doi:10.1016/j.jcss.2013.11.003 . · doi ↗
- 4Broadbent and Göller [2012] C. Broadbent and S. Göller. On bisimilarity of higher-order pushdown automata: Undecidability at order two. In Proc. FSTTCS’12 , volume 18 of Leibniz Int. Proc. Inf. , pages 160–172. LZI, 2012. doi:10.4230/LIP Ics.FSTTCS.2012.160 . · doi ↗
- 5Burkart et al. [1995] O. Burkart, D. Caucal, and B. Steffen. An elementary bisimulation decision procedure for arbitrary context-free processes. In Proc. MFCS’95 , volume 969 of Lect. Notes in Comput. Sci. , pages 423–433. Springer, 1995. doi:10.1007/3-540-60246-1_148 . · doi ↗
- 6Caucal [1992] D. Caucal. Monadic theory of term rewritings. In Proc. LICS’92 , pages 266–273. IEEE, 1992. doi:10.1109/LICS.1992.185539 . · doi ↗
- 7Caucal [1995] D. Caucal. Bisimulation of context-free grammars and pushdown automata. In A. Ponse, M. de Rijke, and Y. Venema, editors, Modal Logic and Process Algebra: A Bisimulation Perspective , volume 53 of CSLI Lecture Notes , chapter 5, pages 85–106. CSLI Publications, 1995.
- 8Cichoń and Tahhan Bittar [1998] E. A. Cichoń and E. Tahhan Bittar. Ordinal recursive bounds for Higman’s Theorem. Theor. Comput. Sci. , 201(1–2):63–84, 1998. doi:10.1016/S 0304-3975(97)00009-1 . · doi ↗
