Introduction
Quantitative verification is an extension of classical verification that goes beyond simple yes-or-no queries, and instead queries quantitative information about a system’s behaviour. Such information includes probabilities, costs, time, memory usage, and resources. Quantitative verification has found applications in probabilistic programming [9 ] , resource analysis [25 ] , and dataflow analysis [32 , 41 ] .
In this paper, we restrict our focus to weighted pushdown systems (wPDS), which are a suitable model for analysing programs with procedures [41 ] . These systems were independently introduced in [44 ] for the verification of access control policies in shared computing resources, and in [11 ] for the static analysis of concurrent recursive programs.
The main idea is to equip the transitions of a pushdown system (PDS) with values from a data domain such as the natural numbers. As transitions are executed along a run, these values are combined according to an appropriate operation, e.g., addition of numbers. This accumulates a value along each computation path. One can then study quantitative verification questions such as computing, for a given target configuration, the aggregate value over all paths leading to it — for example, the minimal accumulated value among all such paths. It follows that the underlying data domain must have a semiring-like structure (cf. Section 2.1). When the underlying semiring is Boolean, the model reduces to PDSs.
Several verification problems for network protocols have recently been reduced to qualitative decision problems for PDSs. Jacobs et al. [27 ] extend NetKAT [5 , 20 ] with push and pop constructs to model tunnelling protocols and source routing schemes [47 ] , such as MPLS and Segment Routing, and decide the equivalence of the resulting StacKAT expressions via a translation to PDSs. Schmid and Srba [43 ] reduce the verification of MPLS networks to PDS reachability, and Nevatia et al. [39 ] model the Domain Name System as communicating pushdown processes and, under certain restrictions, reduce the detection of vulnerabilities such as amplification attacks to pushdown state reachability. With the increasing use of PDSs in modelling complex large-scale networks, it becomes equally important to reason about quantitative properties. While classical network verification has primarily focused on qualitative properties such as reachability and isolation, many practical concerns are not yes-or-no questions. Examples include the worst-case latency of a network, its worst-case failure rate, the bandwidth of its bottleneck, the reliability or security level it can guarantee, and the information flow between two of its configurations (cf. Figure 12). Answering such questions calls for the quantitative verification of wPDS networks, and the literature here remains limited.
Challenges. A natural way to develop algorithms for quantitative verification of weighted pushdown networks would be to generalise the existing qualitative techniques. It was shown by Atig et al. [8 ] that the qualitative reachability problem for a network of PDSs with no communication loops is decidable. One of the main ingredients in their algorithm is the computation of language closures. For instance, the downward closure of a set of words is the set of all subsequences of words in that set. The downward closure of the set of traces between two configurations of a PDS can be effectively computed as the language accepted by an NFA of size exponential in that of the input PDS [14 ] . They provide an iterative procedure in which each iteration constructs an NFA recognising the downward closure of the set of traces between two configurations in a parent process of the network, and takes its product with the child of that process. This algorithm has an elementary complexity in the size of the network.
A generalisation of the above algorithm to the quantitative setting is not straightforward. For instance, how does the weight assigned to every transition of a weighted pushdown system in the network factor into the corresponding weighted NFAs associated with its downward closures? Alternatively, one may propose a qualitative analysis, followed by a finite number of isolated quantitative analyses of each network component, assuming arbitrary behaviour in other components. However, there is an entanglement between traces and their weights that is now forgotten. This is especially challenging when the underlying data domain for the weighted pushdown system is infinite. Let us take a simple example to understand this better.
A Motivating Example
Consider a cost model for client-server networks. A client accumulates a backlog of tasks and clears it either by sending the tasks to a remote server or by executing them itself. Sending is free for the client but occupies the server, which, while idle, accrues credit points that fund task completion for free ; once these reserves are depleted, the client is billed for further tasks. Executing tasks locally requires no server at all, but the client pays for each one. This is a simplified model of leaky-bucket rate limiters [15 , 16 ] , ubiquitous in API gateways and congestion control, and of the burstable CPU-credit systems used in cloud architectures like AWS [13 ] .
We illustrate a concrete instance in Figure 1 , modelling a client (P c l \mathcal{P}^{\mathrm{cl}} P cl ) and a server (P s r v \mathcal{P}^{\mathrm{srv}} P srv ) as weighted pushdown processes. The server can at any time choose to observe the client’s state, illustrated by the doubly dashed arrow on the left; the client observes nothing. The transitions are of the form s ? o p : a s?op : a s ? o p : a , where s s s is an observed state, a a a is the weight annotation, and o p ∈ { push γ , pop γ , nop , check γ } op \in\{\text{push }\gamma,\text{pop }\gamma,\text{nop},\text{check }\gamma\} o p ∈ { push γ , pop γ , nop , check γ } is a macro for a stack operation using a stack symbol γ \gamma γ . The symbol ⊥ \bot ⊥ denotes the bottom of the stack. The operation “push γ \gamma γ ” denotes pushing γ \gamma γ onto the stack, “pop γ \gamma γ ” denotes popping γ \gamma γ from the stack, “nop” leaves the stack unchanged, and “check γ \gamma γ ” checks that the top of the stack is γ \gamma γ , again leaving it unchanged. These are exactly the four forms of stack operation admitted by a PDS rule, namely the pairs ⟨ ϵ , γ ⟩ \langle\epsilon,\gamma\rangle ⟨ ϵ , γ ⟩ , ⟨ γ , ϵ ⟩ \langle\gamma,\epsilon\rangle ⟨ γ , ϵ ⟩ , ⟨ ϵ , ϵ ⟩ \langle\epsilon,\epsilon\rangle ⟨ ϵ , ϵ ⟩ , and ⟨ γ , γ ⟩ \langle\gamma,\gamma\rangle ⟨ γ , γ ⟩ respectively; in particular, check ⊥ \bot ⊥ tests that the stack is empty.
Figure 1. A client-server network. The doubly dashed arrow points from the observed process to the observing one: the server may read the client’s state, but not conversely. A label of the form x ? x? x ? , for x ∈ { i n c l , r e q , i d l e } x \in\{in^{cl}, \mathrm{req}, \mathrm{idle}\} x ∈ { i n c l , req , idle } , indicates that the transition is enabled only while the client is in the state x x x .
From its initial state i n c l in^{\mathrm{cl}} i n cl , the client queues tasks at no cost, pushing β \beta β onto its stack once per task (push β : 0 \beta: 0 β : 0 ), so the backlog is unbounded. It then clears the backlog in one of two ways. It may send, handing each queued task to the server (pop β \beta β : 0), and, once the backlog is empty, submitting the batch (check ⊣ \dashv ⊣ : 0) and going idle, paying nothing. Alternatively, it may work locally , performing each queued task itself at one unit apiece (pop β \beta β : 1), and, once the backlog is empty, finishing (check ⊣ \dashv ⊣ : 0) without ever contacting the server . Either way, the guard check ⊣ \dashv ⊣ prevents the client from leaving before its backlog is empty. The asymmetry is justified: sending is free for the client but requires the server, whereas working locally costs the client.
The server maintains a credit counter, i.e., a stack over the unary alphabet { α } \{\alpha\} { α } . While the client is still queueing, the server banks credits at no cost (i n c l ? in^{cl}? i n c l ? push α \alpha α : 0); on observing a submitted batch, it serves the batch, entering its finished state fin (req?nop : 0). When the client then goes idle, the server speculatively spends a credit to pre-stage the next batch, moving to next (idle?pop α \alpha α : 0). From there it needs a follow-up request, which is free if credits remain (req?check α \alpha α : 0), and costs one unit once the counter has run dry (req?check ⊣ \dashv ⊣ : 1).
A natural question is: “Are x x x units sufficient for the client to clear its backlog?” This amounts to computing the worst-case cost of reaching the target global state ⟨ \langle ⟨ cl : idle, srv : fin⟩ \rangle ⟩ , from the initial state ⟨ \langle ⟨ cl : i n c l in^{cl} i n c l , srv : i n s r v ⟩ in^{srv}\rangle i n sr v ⟩ , over all interleavings of the two processes; x x x suffices when it exceeds this cost. Analysed in isolation, both processes look unboundedly expensive. The client reaches “idle” by either route, and the local route costs n n n for a backlog of n n n tasks, so its worst case is ∞ \infty ∞ . The server may repeat the loop “fin → \to → next → \to → fin” as often as it likes, paying a unit per turn once the counter is empty, so its worst case is ∞ \infty ∞ as well. The decoupled answer is ⟨ \langle ⟨ cl : ∞ \infty ∞ , srv : ∞ ⟩ \infty\rangle ∞ ⟩ .
Yet both estimates are wrong. The target requires the server to be in “fin”, and the server reaches “fin” only by observing “req”, which only the “send” route ever visits. Every global run reaching the target therefore takes the “send” route, on which the client pays nothing. On those very runs the server steps into “next” at most once, and is then stranded there: the follow-up request it speculated on never arrives, because from “idle” the client never returns to “req”. So the server pays nothing either, and the true answer is ⟨ \langle ⟨ cl : 0, srv : 0⟩ \rangle ⟩ .
This shows that isolated analyses can grossly over-approximate costs. The local route is not a spurious artefact of the model. The client really can do all of the work itself, at unbounded cost, and really does terminate; it is simply a run in which the server does nothing, and hence one that no global trace reaching the target can contain. Analysing the client on its own, under arbitrary behaviour of the server, therefore reports ∞ \infty ∞ for a branch that no global trace can follow. One cannot compute the weight of a component without knowing which of its runs the other components are able to follow, and so traces and weights must be computed together. The same phenomenon occurs in networks with several hierarchical rate-limiting servers, such as those in the Linux kernel [36 ] and cloud-native applications like Envoy [17 , 18 ] and DynamoDB [4 ] . This motivates the need for a principled approach that can tackle the analysis of all such networks.
Contributions
Our principal result, developed in § 7 , is a framework for the quantitative verification of networks of wPDSs, where we provide the first quantitative verification algorithms for networks of pushdown systems. We achieve this in three steps.
A quantitative analysis of a recursive system must summarise the weight accumulated by unboundedly many nested loop iterations. Existing techniques either compute this summary exactly, but only over weight domains satisfying the ascending chain condition [11 , 32 , 44 ] , leaving out domains as basic as the arctic semiring, or else apply to arbitrary domains at the price of over-approximation, through widening or abstraction [29 ] . We ask when such a summary can be computed exactly without constraining the chains, and answer this in § 3 with the class of pumping semirings; see Figure 2 for several examples. Informally, the condition requires that the domain be unable to count the iterations. The class admits domains with infinite ascending chains, such as the arctic semiring and the semiring of downward-closed languages.
In § 5 , we propose a novel saturation-based procedure for the quantitative verification problem QuantReach for wPDSs. As the first application of our procedure, we show that both the upward and downward closures of context-free languages can be computed as instances of QuantReach (cf. § 6 ). These results serve as a key technical ingredient for the network-verification algorithms developed in subsequent sections.
In § 7 , we focus on three classes of quantitative properties: safety, reachability, and cost-bounded reachability. We categorise these properties into two kinds of problems: threshold (“Given a bound r r r , does the network satisfy r r r w.r.t. the property?”) and optimality (“Can we compute the optimal bound r r r such that the network satisfies r r r w.r.t. the property?”). We then introduce GenConfigReach, a quantitative verification problem for networks of wPDSs over pumping semirings, which forms the basis for solving the above problems. Using our saturation procedure, we prove that this problem can be solved for a wide range of quantitative domains relevant for network verification, thus yielding algorithms for all the aforementioned properties.
Notation and Background
Given a set X X X , let F ( X ) F(X) F ( X ) denote the set of all finite subsets of X X X . For n ∈ N n \in\mathbb{N} n ∈ N , we write [ n ] [n] [ n ] for the set { 1 , 2 , … , n } \{1, 2, \ldots, n\} { 1 , 2 , … , n } . A sequence in X X X is defined as a partial function f : N → X f : \mathbb{N} \to X f : N → X such that if f ( n ) f(n) f ( n ) is defined, then f ( n ′ ) f(n') f ( n ′ ) must be defined for all n ′ ≤ n n' \le n n ′ ≤ n ; we also denote it by n ↦ f ( n ) n \mapsto f(n) n ↦ f ( n ) , implicitly assuming that n n n belongs to the domain of f f f . An infinite sequence in X X X is a total function f : N → X f : \mathbb{N} \to X f : N → X . Given a function f : X → Y f : X \to Y f : X → Y and a subset X ′ ⊆ X X' \subseteq X X ′ ⊆ X , we write f ( X ′ ) f(X') f ( X ′ ) to denote the set { f ( x ) ∣ x ∈ X ′ } \{f(x) \mid x \in X'\} { f ( x ) ∣ x ∈ X ′ } . Given functions f 1 : 2 X → 2 Y f_1 : 2^X \to2^Y f 1 : 2 X → 2 Y and f 2 : 2 X → 2 Y f_2 : 2^X \to2^Y f 2 : 2 X → 2 Y , we write f 1 + f 2 f_1 + f_2 f 1 + f 2 to denote the function X ′ ↦ f 1 ( X ′ ) ∪ f 2 ( X ′ ) X' \mapsto f_1(X') \cup f_2(X') X ′ ↦ f 1 ( X ′ ) ∪ f 2 ( X ′ ) . Given a function f : 2 X → 2 X f : 2^X \to2^X f : 2 X → 2 X , we write f ‾ \overline{f} f to denote the function ∑ n ∈ N f n \sum_{n \in\mathbb{N}} f^n ∑ n ∈ N f n , where f 0 f^0 f 0 is the identity, and f n + 1 = f ∘ f n f^{n+1} = f \circ f^n f n + 1 = f ∘ f n .
Some Basic Definitions
Words. Let A ∗ A^* A ∗ be the set of all finite words over the alphabet A A A . The empty word is denoted by ϵ \epsilon ϵ . The set of all non-empty words is denoted by A + = A ∗ ∖ { ϵ } A^+ = A^* \setminus\{\epsilon\} A + = A ∗ ∖ { ϵ } . The concatenation of two words u , v ∈ A ∗ u, v \in A^* u , v ∈ A ∗ is denoted by u v uv uv . We write w k = w w ⋯ w w^k = ww \cdots w w k = w w ⋯ w for the k k k -fold concatenation of a word w w w in A ∗ A^* A ∗ . Given L ⊆ A ∗ L \subseteq A^* L ⊆ A ∗ , we define L k : = { w 1 ⋯ w k ∣ w 1 , … , w k ∈ L } L^k := \{w_1 \cdots w_k \mid w_1, \ldots, w_k \in L\} L k := { w 1 ⋯ w k ∣ w 1 , … , w k ∈ L } . The prefix partial order ⪯ \preceq ⪯ over words is defined by u ⪯ v u \preceq v u ⪯ v if v = u w v = uw v = u w for some word w ∈ A ∗ w \in A^* w ∈ A ∗ . A subset L ⊆ A ∗ L \subseteq A^* L ⊆ A ∗ is prefix-closed if u ⪯ v u \preceq v u ⪯ v and v ∈ L v \in L v ∈ L implies u ∈ L u \in L u ∈ L . The length of a word w ∈ A ∗ w \in A^* w ∈ A ∗ is denoted by ∣ w ∣ |w| ∣ w ∣ .
Given two words u , v ∈ A ∗ u, v \in A^* u , v ∈ A ∗ , we say u u u is a subword of v v v , written u ⊑ v u \sqsubseteq v u ⊑ v , iff u = u 1 ⋯ u n u = u_1 \cdots u_n u = u 1 ⋯ u n and v = v 0 u 1 ⋯ u n v n v = v_0u_1 \cdots u_nv_n v = v 0 u 1 ⋯ u n v n for some v 0 , u 1 , … , u n , v n ∈ A ∗ v_0, u_1, \ldots, u_n, v_n \in A^* v 0 , u 1 , … , u n , v n ∈ A ∗ . Given a set of words L ⊆ A ∗ L \subseteq A^* L ⊆ A ∗ , we define its downward closure L ↓ : = { y ∈ A ∗ ∣ ∃ x ∈ L . y ⊑ x } L \mathord{\downarrow} := \{y \in A^* \mid\exists x \in L.\ y \sqsubseteq x\} L ↓ := { y ∈ A ∗ ∣ ∃ x ∈ L . y ⊑ x } . Dually, its upward closure is L ↑ : = { y ∈ A ∗ ∣ ∃ x ∈ L . x ⊑ y } L \mathord{\uparrow} := \{y \in A^* \mid\exists x \in L.\ x \sqsubseteq y\} L ↑ := { y ∈ A ∗ ∣ ∃ x ∈ L . x ⊑ y } . A set L ⊆ A ∗ L \subseteq A^* L ⊆ A ∗ is downward-closed (resp. upward-closed ) iff L = L ↓ L = L \mathord{\downarrow} L = L ↓ (resp. L = L ↑ L = L \mathord{\uparrow} L = L ↑ ). Both upward-closed and downward-closed languages are closed under union and concatenation.
Trees. A tree T T T is a prefix-closed subset of N ∗ \mathbb{N}^* N ∗ such that for every t ∈ N ∗ t \in\mathbb{N}^* t ∈ N ∗ and i , j ∈ N i, j \in\mathbb{N} i , j ∈ N , if t j ∈ T tj \in T t j ∈ T and i ≤ j i \leq j i ≤ j , then t i ∈ T ti \in T t i ∈ T . A tree is finite if T T T is finite. The elements of T T T are called nodes . The empty word ϵ \epsilon ϵ is called the root node . A child of a node t ∈ T t \in T t ∈ T is a node t i ∈ T ti \in T t i ∈ T . The subtree of T T T rooted at t t t is the set t − 1 T : = { t ′ ∣ t ⋅ t ′ ∈ T } t^{-1}T := \{t' \mid t \cdot t' \in T\} t − 1 T := { t ′ ∣ t ⋅ t ′ ∈ T } ; conversely, t ⋅ T : = { t ⋅ t ′ ∣ t ′ ∈ t − 1 T } t \cdot T := \{t \cdot t' \mid t' \in t^{-1}T\} t ⋅ T := { t ⋅ t ′ ∣ t ′ ∈ t − 1 T } . The height of the tree T T T is the supremum sup { ∣ t ∣ ∣ t ∈ T } ∈ N ∪ { ∞ } \sup\{|t| \mid t \in T\} \in\mathbb{N} \cup\{\infty\} sup { ∣ t ∣ ∣ t ∈ T } ∈ N ∪ { ∞ } of the lengths of its nodes, denoted by ht ( T ) \operatorname{ht}(T) ht ( T ) . The height of a node t t t in T T T is ht ( t − 1 T ) \operatorname{ht}(t^{-1}T) ht ( t − 1 T ) .
Given a set A A A , an A A A -labelled tree is a tuple ⟨ T , σ ⟩ \langle T, \sigma\rangle ⟨ T , σ ⟩ , where T T T is a tree and σ : T → A \sigma:T \to A σ : T → A is a labelling function that maps nodes in T T T to labels in A A A . Each of the above definitions can be naturally lifted from trees to labelled trees by considering it on the tree T T T . For instance, the subtree of ⟨ T , σ ⟩ \langle T, \sigma\rangle ⟨ T , σ ⟩ rooted at t t t is ⟨ t − 1 T , t − 1 σ ⟩ \langle t^{-1}T,t^{-1}\sigma\rangle ⟨ t − 1 T , t − 1 σ ⟩ , where t − 1 σ ( t ′ ) : = σ ( t ⋅ t ′ ) t^{-1}\sigma(t') := \sigma(t \cdot t') t − 1 σ ( t ′ ) := σ ( t ⋅ t ′ ) for t ′ ∈ t − 1 T t' \in t^{-1}T t ′ ∈ t − 1 T . We abuse notation and write t − 1 ⟨ T , σ ⟩ t^{-1}\langle T,\sigma\rangle t − 1 ⟨ T , σ ⟩ for ⟨ t − 1 T , t − 1 σ ⟩ \langle t^{-1}T,t^{-1}\sigma\rangle ⟨ t − 1 T , t − 1 σ ⟩ . The set of all finite A A A -labelled trees is denoted by FTree ( A ) \operatorname{FTree}(A) FTree ( A ) .
Idempotent Semirings. An idempotent semiring S S S is a 5-tuple ⟨ S , ⊕ , ⊗ , 0 , 1 ⟩ \langle S,\oplus,\otimes,0,1\rangle ⟨ S , ⊕ , ⊗ , 0 , 1 ⟩ , where S S S is a set, and ⊕ , ⊗ : S × S → S \oplus,\otimes:S \times S \to S ⊕ , ⊗ : S × S → S are binary operations such that: (1) ⟨ S , ⊕ , 0 ⟩ \langle S,\oplus,0\rangle ⟨ S , ⊕ , 0 ⟩ forms a commutative monoid, (2) ⟨ S , ⊗ , 1 ⟩ \langle S,\otimes,1\rangle ⟨ S , ⊗ , 1 ⟩ forms a monoid, and (3) the following identities hold for arbitrary a , b , c ∈ S a,b,c \in S a , b , c ∈ S :
a ⊕ a = a , a ⊗ 0 = 0 = 0 ⊗ a , a \oplus a = a,\qquad a \otimes0 = 0 = 0 \otimes a, a ⊕ a = a , a ⊗ 0 = 0 = 0 ⊗ a ,
a ⊗ ( b ⊕ c ) = ( a ⊗ b ) ⊕ ( a ⊗ c ) , ( b ⊕ c ) ⊗ a = ( b ⊗ a ) ⊕ ( c ⊗ a ) . a \otimes(b \oplus c) = (a \otimes b) \oplus(a \otimes c),\qquad(b \oplus c) \otimes a = (b \otimes a) \oplus(c \otimes a). a ⊗ ( b ⊕ c ) = ( a ⊗ b ) ⊕ ( a ⊗ c ) , ( b ⊕ c ) ⊗ a = ( b ⊗ a ) ⊕ ( c ⊗ a ) .
As shorthand, we may write S S S for S \mathcal{S} S , and similarly for semigroups and monoids. We also omit the symbol ⊗ \otimes ⊗ when it is clear from context.
Given two idempotent semirings S 1 = ⟨ S 1 , ⊕ 1 , ⊗ 1 , 0 1 , 1 1 ⟩ S_1 = \langle S_1,\oplus_1,\otimes_1,0_1,1_1\rangle S 1 = ⟨ S 1 , ⊕ 1 , ⊗ 1 , 0 1 , 1 1 ⟩ , and S 2 = ⟨ S 2 , ⊕ 2 , ⊗ 2 , 0 2 , 1 2 ⟩ S_2 = \langle S_2,\oplus_2,\otimes_2,0_2,1_2\rangle S 2 = ⟨ S 2 , ⊕ 2 , ⊗ 2 , 0 2 , 1 2 ⟩ , we define the product semiring S 1 × S 2 : = ⟨ S 1 × S 2 , ⊕ , ⊗ , ⟨ 0 1 , 0 2 ⟩ , ⟨ 1 1 , 1 2 ⟩ ⟩ S_1 \times S_2 := \langle S_1 \times S_2,\oplus,\otimes,\langle0_1,0_2\rangle,\langle1_1,1_2\rangle\rangle S 1 × S 2 := ⟨ S 1 × S 2 , ⊕ , ⊗ , ⟨ 0 1 , 0 2 ⟩ , ⟨ 1 1 , 1 2 ⟩⟩ , where ⟨ a 1 , a 2 ⟩ ∙ ⟨ b 1 , b 2 ⟩ : = ⟨ a 1 ∙ 1 b 1 , a 2 ∙ 2 b 2 ⟩ \langle a_1,a_2\rangle\bullet\langle b_1,b_2\rangle:= \langle a_1 \bullet_1 b_1,a_2 \bullet_2 b_2\rangle ⟨ a 1 , a 2 ⟩ ∙ ⟨ b 1 , b 2 ⟩ := ⟨ a 1 ∙ 1 b 1 , a 2 ∙ 2 b 2 ⟩ for ∙ ∈ { ⊕ , ⊗ } \bullet\in\{\oplus,\otimes\} ∙ ∈ { ⊕ , ⊗ } , i.e., the individual operations are applied pointwise.
Given a set X X X , an idempotent semiring ⟨ S , ⊕ , ⊗ , 0 , 1 ⟩ \langle S,\oplus,\otimes,0,1\rangle ⟨ S , ⊕ , ⊗ , 0 , 1 ⟩ , and a function f : X → S f:X \to S f : X → S , we can naturally lift f f f to the function f ∗ : X ∗ → S f^*:X^* \to S f ∗ : X ∗ → S over the free monoid generated by X X X , i.e., given a word x 1 ⋯ x n ∈ X ∗ x_1 \cdots x_n \in X^* x 1 ⋯ x n ∈ X ∗ , we define f ∗ ( ϵ ) = 1 f^*(\epsilon)=1 f ∗ ( ϵ ) = 1 , and f ∗ ( x 1 ⋯ x n ) = f ( x 1 ) ⊗ ⋯ ⊗ f ( x n ) f^*(x_1 \cdots x_n)=f(x_1)\otimes\cdots\otimes f(x_n) f ∗ ( x 1 ⋯ x n ) = f ( x 1 ) ⊗ ⋯ ⊗ f ( x n ) .
An idempotent semiring S S S defines a natural partial order ⪯ S \preceq_S ⪯ S on its elements: a ⪯ S b ⟺ a ⊕ b = b a \preceq_S b \iff a \oplus b = b a ⪯ S b ⟺ a ⊕ b = b . It is easy to see that all semiring operations are monotone with respect to this partial order, i.e., if a ⪯ S b a \preceq_S b a ⪯ S b , then a c ⪯ S b c ac \preceq_S bc a c ⪯ S b c , c a ⪯ S c b ca \preceq_S cb c a ⪯ S c b , and a ⊕ c ⪯ S b ⊕ c a \oplus c \preceq_S b \oplus c a ⊕ c ⪯ S b ⊕ c .
Since a ⊕ b a \oplus b a ⊕ b is the least upper bound of a a a and b b b w.r.t. ⪯ S \preceq_S ⪯ S , we define countable sums as suprema: for a countable set X X X and f : X → S f:X \to S f : X → S , ⨁ x ∈ X f ( x ) \bigoplus_{x \in X} f(x) ⨁ x ∈ X f ( x ) denotes the supremum of { f ( x ) ∣ x ∈ X } \{f(x) \mid x \in X\} { f ( x ) ∣ x ∈ X } . It need not exist in S S S ; henceforth, whenever we write such a sum, we implicitly assume that it exists. The empty sum is 0 0 0 , the least element of S S S . In Figure 2, we provide some examples of idempotent semirings.
Weighted Pushdown Systems
Next, we give an overview of weighted pushdown systems.
Pushdown Systems. A pushdown system is a 4-tuple P = ⟨ Q , A , Γ , Trans ⟩ \mathcal{P} = \langle Q,A,\Gamma,\operatorname{Trans}\rangle P = ⟨ Q , A , Γ , Trans ⟩ , where Q Q Q is a finite set of states, A A A is a finite input alphabet, Γ \Gamma Γ is a finite stack alphabet, and Trans \operatorname{Trans} Trans is a set of transition rules. Transition rules are of the form ⟨ p , α , u , α ′ , q ⟩ \langle p,\alpha,u,\alpha',q\rangle ⟨ p , α , u , α ′ , q ⟩ , with p , q ∈ Q p,q\in Q p , q ∈ Q states, u ∈ A ∪ { ϵ } u\in A\cup\{\epsilon\} u ∈ A ∪ { ϵ } an input letter, and the pair ⟨ α , α ′ ⟩ ∈ ( { ϵ } × Γ ) ∪ ( Γ × { ϵ } ) ∪ { ⟨ ϵ , ϵ ⟩ } ∪ { ⟨ β , β ⟩ ∣ β ∈ Γ ∪ { ⊣ } } \langle\alpha,\alpha'\rangle\in(\{\epsilon\}\times\Gamma)\cup(\Gamma\times\{\epsilon\})\cup\{\langle\epsilon,\epsilon\rangle\}\cup\{\langle\beta,\beta\rangle\mid\beta\in\Gamma\cup\{\dashv\}\} ⟨ α , α ′ ⟩ ∈ ({ ϵ } × Γ ) ∪ ( Γ × { ϵ }) ∪ {⟨ ϵ , ϵ ⟩} ∪ {⟨ β , β ⟩ ∣ β ∈ Γ ∪ { ⊣ }} representing the lookup of the top of the stack (or none thereof, if α = ϵ \alpha=\epsilon α = ϵ ) and the element to be pushed (or none thereof, if α ′ = ϵ \alpha'=\epsilon α ′ = ϵ ), respectively. The four cases are, in order, a push , a pop , a step that leaves the stack untouched, and a test that the top of the stack is β \beta β . The bottom-of-stack marker may be tested but never pushed or popped, so that a test ⟨ ⊣ , ⊣ ⟩ \langle\dashv,\dashv\rangle ⟨ ⊣ , ⊣ ⟩ checks that the stack is empty. The size of P \mathcal{P} P , written ∣ P ∣ |\mathcal{P}| ∣ P ∣ , is the cumulative size of all its components.
Table 2. Idempotent semirings (left), ⊗ \otimes ⊗ -operators (middle; cf. Definition 3.1 ), and their pumping semiring status (right). Why is the absorptive Why-provenance semiring [23 ] : W ( A ) \mathcal{W}(A) W ( A ) is the set of ⊆ \subseteq ⊆ -antichains of subsets of a finite set A A A , X + Y : = min ( X ∪ Y ) X+Y := \min(X\cup Y) X + Y := min ( X ∪ Y ) , and X ⋅ Y : = min { x ∪ y ∣ x ∈ X , y ∈ Y } X\cdot Y := \min\{x\cup y \mid x\in X, y\in Y\} X ⋅ Y := min { x ∪ y ∣ x ∈ X , y ∈ Y } , where min \min min keeps ⊆ \subseteq ⊆ -minimal sets.
A configuration c c c of the PDS P \mathcal{P} P is a tuple ⟨ p , γ ⟩ \langle p,\gamma\rangle ⟨ p , γ ⟩ , where p ∈ Q p\in Q p ∈ Q , and γ ∈ Γ ∗ ⊣ \gamma\in\Gamma^*\dashv γ ∈ Γ ∗ ⊣ is the stack valuation with the stack top being the leftmost label in γ \gamma γ , and the special symbol ⊣ ∉ Γ \dashv\notin\Gamma ⊣ ∈ / Γ denoting the bottom of the stack. The set of all configurations is the set Config ( P ) = Q × Γ ∗ ⊣ \operatorname{Config}(\mathcal{P})=Q\times\Gamma^*\dashv Config ( P ) = Q × Γ ∗ ⊣ . We write st ( c ) \operatorname{st}(c) st ( c ) to denote the state p p p within the configuration. A successor of c = ⟨ p , γ ⟩ c=\langle p,\gamma\rangle c = ⟨ p , γ ⟩ is a configuration c ′ = ⟨ q , γ ′ ⟩ c'=\langle q,\gamma'\rangle c ′ = ⟨ q , γ ′ ⟩ such that there exists a transition δ = ⟨ p , α , u , α ′ , q ⟩ \delta=\langle p,\alpha,u,\alpha',q\rangle δ = ⟨ p , α , u , α ′ , q ⟩ , and we have γ ′ = α ′ ⋅ γ ′ ′ \gamma'=\alpha'\cdot\gamma'' γ ′ = α ′ ⋅ γ ′′ where γ = α ⋅ γ ′ ′ \gamma=\alpha\cdot\gamma'' γ = α ⋅ γ ′′ . We then write this relation as c ⇒ δ P c ′ c \xRightarrow{\delta}_{\mathcal{P}} c' c δ P c ′ , and denote the reflexive transitive closure of all such relations by ⇒ ∗ P ⊆ Config ( P ) × Config ( P ) \xRightarrow{*}_{\mathcal{P}}\subseteq\operatorname{Config}(\mathcal{P})\times\operatorname{Config}(\mathcal{P}) ∗ P ⊆ Config ( P ) × Config ( P ) . Intuitively, each transition checks whether the top of the stack matches α \alpha α and, after popping it, pushes α ′ \alpha' α ′ onto the stack. We drop the subscript P \mathcal{P} P from ⇒ δ \xRightarrow{\delta} δ when the context is clear.
Given two configurations c , c ′ ∈ Config ( P ) c,c'\in\operatorname{Config}(\mathcal{P}) c , c ′ ∈ Config ( P ) , a run ρ \rho ρ from c c c to c ′ c' c ′ is a finite alternating sequence c = c 0 ⇒ δ 1 c 1 ⋯ ⇒ δ n c n = c ′ c=c_0\xRightarrow{\delta_1}c_1\cdots\xRightarrow{\delta_n}c_n=c' c = c 0 δ 1 c 1 ⋯ δ n c n = c ′ of configurations and transitions. We then say that c ′ c' c ′ is reachable from c c c . The trace of this run is the word δ 1 δ 2 ⋯ δ n ∈ Trans ∗ \delta_1\delta_2\cdots\delta_n\in\operatorname{Trans}^* δ 1 δ 2 ⋯ δ n ∈ Trans ∗ of transitions.
Figure 3. (a) An example wPDS where the weight associated with every transition in P e x \mathcal{P}_{\mathrm{ex}} P ex is annotated on its right (separated by ‘:’), and (b) the corresponding weight semantics. Every transition of P e x \mathcal{P}_{\mathrm{ex}} P ex reads the input letter a a a .
Weighted Pushdown Systems. A weighted pushdown system is a 3-tuple ⟨ P , S , w t ⟩ \langle\mathcal{P}, \mathcal{S}, \mathrm{wt}\rangle ⟨ P , S , wt ⟩ , where P = ⟨ Q , A , Γ , T r a n s ⟩ \mathcal{P} = \langle Q, A, \Gamma, \mathrm{Trans}\rangle P = ⟨ Q , A , Γ , Trans ⟩ is a PDS, S = ⟨ S , ⊕ , ⊗ , 0 , 1 ⟩ \mathcal{S} = \langle S, \oplus, \otimes, 0, 1\rangle S = ⟨ S , ⊕ , ⊗ , 0 , 1 ⟩ is an idempotent semiring, and w t : T r a n s → S ∖ { 0 } \mathrm{wt} : \mathrm{Trans} \to S \setminus\{0\} wt : Trans → S ∖ { 0 } is a weight function that assigns a non-zero value from S S S to each transition in P \mathcal{P} P .
Given two configurations c , c ′ ∈ Config ( P ) c,c' \in\operatorname{Config}(\mathcal{P}) c , c ′ ∈ Config ( P ) , let Paths ( c , c ′ ) : = { δ 1 ⋯ δ n ∈ Trans ∗ ∣ c ⇒ δ 1 ⋯ δ n c ′ } \operatorname{Paths}(c,c') := \{\delta_1 \cdots\delta_n \in\operatorname{Trans}^{*} \mid c \xRightarrow{\delta_1 \cdots\delta_n} c'\} Paths ( c , c ′ ) := { δ 1 ⋯ δ n ∈ Trans ∗ ∣ c δ 1 ⋯ δ n c ′ } be the (possibly infinite) set of traces from c c c to c ′ c' c ′ . We then define
w t [ [ c , c ′ ] ] : = ⨁ τ ∈ Paths ( c , c ′ ) w t ∗ ( τ ) . \mathrm{wt}[\![c,c']\!] := \bigoplus_{\tau\in\operatorname{Paths}(c,c')} \mathrm{wt}^{*}(\tau). wt [ [ c , c ′ ] ] := τ ∈ Paths ( c , c ′ ) ⨁ wt ∗ ( τ ) .
In particular, w t [ [ c , c ′ ] ] = 0 \mathrm{wt}[\![c,c']\!] = 0 wt [ [ c , c ′ ] ] = 0 if Paths ( c , c ′ ) \operatorname{Paths}(c,c') Paths ( c , c ′ ) is empty. Intuitively, w t [ [ c , c ′ ] ] \mathrm{wt}[\![c,c']\!] wt [ [ c , c ′ ] ] is the accumulation of the weights of all the runs that go from c c c to c ′ c' c ′ , thus measuring the weight of reaching c ′ c' c ′ from c c c . Note that the definition of w t [ [ c , c ′ ] ] \mathrm{wt}[\![c,c']\!] wt [ [ c , c ′ ] ] implicitly assumes its existence. However, a priori , it may not exist. Moreover, if S \mathcal{S} S is the Boolean semiring B \mathbb{B} B , then the wPDS essentially reduces to a PDS, and w t [ [ c , c ′ ] ] = t r u e \mathrm{wt}[\![c,c']\!] = \mathrm{true} wt [ [ c , c ′ ] ] = true iff there is a run from c c c to c ′ c' c ′ .
Example 2.1. Consider the wPDS ⟨ P e x , ⟨ N ± ∞ , max , + , − ∞ , 0 ⟩ , w t e x ⟩ \langle\mathcal{P}_{\mathrm{ex}}, \langle\mathbb{N}_{\pm\infty}, \max, +, -\infty, 0\rangle, \mathrm{wt}_{\mathrm{ex}}\rangle ⟨ P ex , ⟨ N ± ∞ , max , + , − ∞ , 0 ⟩ , wt ex ⟩ illustrated in Figure 3. Every trace from the configuration ⟨ q 1 , ⊣ ⟩ \langle q_1,\dashv\rangle ⟨ q 1 , ⊣ ⟩ to ⟨ q 2 , ⊣ ⟩ \langle q_2,\dashv\rangle ⟨ q 2 , ⊣ ⟩ is of the form ⟨ q 1 , ϵ , a , α , q 1 ⟩ n ⟨ q 1 , α , a , ϵ , q 2 ⟩ ⟨ q 2 , α , a , ϵ , q 2 ⟩ n − 1 \langle q_1,\epsilon,a,\alpha,q_1\rangle^n\langle q_1,\alpha,a,\epsilon,q_2\rangle\langle q_2,\alpha,a,\epsilon,q_2\rangle^{n-1} ⟨ q 1 , ϵ , a , α , q 1 ⟩ n ⟨ q 1 , α , a , ϵ , q 2 ⟩ ⟨ q 2 , α , a , ϵ , q 2 ⟩ n − 1 . The lifted function w t e x ∗ \mathrm{wt}^{*}_{\mathrm{ex}} wt ex ∗ maps every such trace to a weight of the form 2 n + 1 2n+1 2 n + 1 . To compute w t e x [ [ ⟨ q 1 , ⊣ ⟩ , ⟨ q 2 , ⊣ ⟩ ] ] \mathrm{wt}_{\mathrm{ex}}[\![\langle q_1,\dashv\rangle,\langle q_2,\dashv\rangle]\!] wt ex [ [⟨ q 1 , ⊣ ⟩ , ⟨ q 2 , ⊣ ⟩] ] , we aggregate all these weights by taking their maximum, which is the infinite value ∞ \infty ∞ . If we instead switch to the tropical semiring, the infinite sum equals its least value, 3 3 3 .
Pumping Semirings and Quantitative Reachability
We will now state the main contributions of the first part of this paper. Essentially, we obtain a decision procedure for a quantitative variant of the reachability problem for wPDSs, as introduced in [44 ] , but for a much larger class of semirings. In § 7 , we show that these semirings play a vital role in the quantitative verification of wPDS networks. We start by introducing a new class of semirings that form the weight domains for wPDSs in our problem.
Definition 3.1. Let S \mathcal{S} S be a 6-tuple ⟨ S , ⊕ , ⊗ , ⊙ , 0 , 1 ⟩ \langle S,\oplus,\otimes,\odot,0,1\rangle ⟨ S , ⊕ , ⊗ , ⊙ , 0 , 1 ⟩ , where ⟨ S , ⊕ , ⊗ , 0 , 1 ⟩ \langle S,\oplus,\otimes,0,1\rangle ⟨ S , ⊕ , ⊗ , 0 , 1 ⟩ is an idempotent semiring, and ⊙ : S → S \odot: S \to S ⊙ : S → S (applied as a superscript) is a unary operator. We call S \mathcal{S} S a pumping semiring iff the following conditions are satisfied:
(C1) It holds that
⨁ n ∈ N a n ⊗ b ⊗ c n = a ⊙ ⊗ b ⊗ c ⊙ \bigoplus_{n \in\mathbb{N}} a^n \otimes b \otimes c^n = a^{\odot} \otimes b \otimes c^{\odot} n ∈ N ⨁ a n ⊗ b ⊗ c n = a ⊙ ⊗ b ⊗ c ⊙ for arbitrary a , c ∈ S ∖ { 0 } a,c \in S \setminus\{0\} a , c ∈ S ∖ { 0 } and b ∈ S b \in S b ∈ S , where x 0 : = 1 x^0 := 1 x 0 := 1 and x n + 1 : = x ⊗ x n x^{n+1} := x \otimes x^n x n + 1 := x ⊗ x n for n ∈ N n \in\mathbb{N} n ∈ N .
(C2) It holds that:
⨁ i ∈ N ( a ⊗ f ( i ) ⊗ b ) = a ⊗ ( ⨁ i ∈ N f ( i ) ) ⊗ b , \bigoplus_{i\in\mathbb{N}}(a\otimes f(i)\otimes b)=a\otimes\left(\bigoplus_{i\in\mathbb{N}}f(i)\right)\otimes b, i ∈ N ⨁ ( a ⊗ f ( i ) ⊗ b ) = a ⊗ ( i ∈ N ⨁ f ( i ) ) ⊗ b ,
and
⨁ i ∈ N f ( i ) = ⨁ j ∈ N ( ⨁ i ∈ P ( j ) f ( i ) ) , \bigoplus_{i\in\mathbb{N}}f(i)=\bigoplus_{j\in\mathbb{N}}\left(\bigoplus_{i\in P(j)}f(i)\right), i ∈ N ⨁ f ( i ) = j ∈ N ⨁ i ∈ P ( j ) ⨁ f ( i ) ,
for every a , b ∈ S a,b\in S a , b ∈ S , f : N → S f:\mathbb{N}\to S f : N → S and partition P : N → 2 N P:\mathbb{N}\to2^{\mathbb{N}} P : N → 2 N of the domain of f f f .
(C3) The set ⊛ ( S ) : = { x ⊛ ∣ x ∈ S } \circledast(S):=\{x^{\circledast}\mid x\in S\} ⊛ ( S ) := { x ⊛ ∣ x ∈ S } is finite.
Each condition imposes a structural restriction. Condition (C1) strengthens the Kleene star operation meant for regular loop summarisation to also include context-free behaviour; in particular, ⊛ \circledast ⊛ is forced to coincide with the Kleene star (cf. Proposition 3.2). Condition (C2) requires ⊗ \otimes ⊗ to distribute over the countable sums that exist, and condition (C3) requires that S S S have only finitely many Kleene closures.
The operator ⊛ \circledast ⊛ is not additional data; the idempotent semiring already determines it.
Proposition 3.2. Let S = ⟨ S , ⊕ , ⊗ , ⊛ , 0 , 1 ⟩ S=\langle S,\oplus,\otimes,\circledast,0,1\rangle S = ⟨ S , ⊕ , ⊗ , ⊛ , 0 , 1 ⟩ be a pumping semiring with 0 ≠ 1 0\ne1 0 = 1 . Then 1 ⊛ = 1 1^{\circledast}=1 1 ⊛ = 1 , and consequently a ⊛ = ⨁ n ∈ N a n a^{\circledast}=\bigoplus_{n\in\mathbb{N}}a^n a ⊛ = ⨁ n ∈ N a n for every a ∈ S ∖ { 0 } a\in S\setminus\{0\} a ∈ S ∖ { 0 } .
We defer the proof to Section A. Hence ⊛ \circledast ⊛ is uniquely determined on S ∖ { 0 } S\setminus\{0\} S ∖ { 0 } , and (C1) leaves the value 0 ⊛ 0^{\circledast} 0 ⊛ unconstrained. This also isolates the actual content of (C1): it is a collapse law, demanding that the diagonal sum ⨁ n ∈ N a n ⊗ b ⊗ c n \bigoplus_{n\in\mathbb{N}}a^n\otimes b\otimes c^n ⨁ n ∈ N a n ⊗ b ⊗ c n , which aggregates context-free pumping , be captured by the expression a ⊛ ⊗ b ⊗ c ⊛ a^{\circledast}\otimes b\otimes c^{\circledast} a ⊛ ⊗ b ⊗ c ⊛ . This is exactly what fails for regular expressions, as we see next.
Example 3.3. In fig:2 we illustrate several idempotent semirings extended to their potential pumping semiring counterparts. In particular, observe that the Kleene algebra ⟨ Reg ( A ) , ∪ , ⋅ , ∗ , ∅ , { ϵ } ⟩ \langle\operatorname{Reg}(A),\cup,\cdot,*,\varnothing,\{\epsilon\}\rangle ⟨ Reg ( A ) , ∪ , ⋅ , ∗ , ∅ , { ϵ }⟩ is not a pumping semiring. Let u ∈ A + u\in A^+ u ∈ A + . Clearly, ⨁ n ∈ N u 2 n + 1 ≠ ( u ) ∗ u ( u ) ∗ = u + \bigoplus_{n\in\mathbb{N}}u^{2n+1}\ne(u)^*u(u)^*=u^+ ⨁ n ∈ N u 2 n + 1 = ( u ) ∗ u ( u ) ∗ = u + , contradicting (C1), and the set { ( u ) n ∣ n ∈ N } ⊆ Reg ( A ) \{(u)^n\mid n\in\mathbb{N}\}\subseteq\operatorname{Reg}(A) {( u ) n ∣ n ∈ N } ⊆ Reg ( A ) is not finite, contradicting (C3).
Even a finite weight domain need not admit a ⊛ \circledast ⊛ operator.
Example 3.4. Consider the parity semiring S p a r = ⟨ 2 Z 2 , ∪ , + , ∅ , { 0 } ⟩ S_{\mathrm{par}}=\langle2^{\mathbb{Z}_2},\cup,+,\varnothing,\{0\}\rangle S par = ⟨ 2 Z 2 , ∪ , + , ∅ , { 0 }⟩ , whose elements are the subsets of Z 2 = { 0 , 1 } \mathbb{Z}_2=\{0,1\} Z 2 = { 0 , 1 } , and where X + Y : = { x + y ∣ x ∈ X , y ∈ Y } X+Y:=\{x+y\mid x\in X,y\in Y\} X + Y := { x + y ∣ x ∈ X , y ∈ Y } lifts addition modulo 2 to sets. It is a natural weight domain for tracking the parity of the number of times a distinguished set of transitions is taken along a run, and it has four elements, so it trivially satisfies the ascending chain condition. Nevertheless, it admits no ⊛ \circledast ⊛ operator. Indeed, by Proposition 3.2, such an operator would have to satisfy { 1 } ⊛ = ⨁ n ∈ N { 1 } n = { 0 } ∪ { 1 } \{1\}^{\circledast}=\bigoplus_{n\in\mathbb{N}}\{1\}^n=\{0\}\cup\{1\} { 1 } ⊛ = ⨁ n ∈ N { 1 } n = { 0 } ∪ { 1 } , but then instantiating (C1) at a = c = { 1 } a=c=\{1\} a = c = { 1 } and b = { 0 } b=\{0\} b = { 0 } fails:
⨁ n ∈ N ( { 1 } n + { 0 } + { 1 } n ) = ⨁ n ∈ N { 1 } 2 n = { 0 } ≠ { 0 , 1 } = { 1 } ⊛ + { 0 } + { 1 } ⊛ . \bigoplus_{n\in\mathbb{N}}\left(\{1\}^n+\{0\}+\{1\}^n\right)=\bigoplus_{n\in\mathbb{N}}\{1\}^{2n}=\{0\}\ne\{0,1\}=\{1\}^{\circledast}+\{0\}+\{1\}^{\circledast}. n ∈ N ⨁ ( { 1 } n + { 0 } + { 1 } n ) = n ∈ N ⨁ { 1 } 2 n = { 0 } = { 0 , 1 } = { 1 } ⊛ + { 0 } + { 1 } ⊛ .
The problem is that the sequence n ↦ a n ⊗ b ⊗ c n n\mapsto a^n\otimes b\otimes c^n n ↦ a n ⊗ b ⊗ c n can count n n n modulo 2, which (C1) forbids.
Related Semiring Classes. Pumping semirings are closely related to three established classes of semirings with iteration. A closed semiring [31 ] is an idempotent semiring in which every countable sum exists and ⊗ \otimes ⊗ distributes over countable sums; its star is a ∗ : = ⨁ n ∈ N a n a^*:=\bigoplus_{n\in\mathbb{N}}a^n a ∗ := ⨁ n ∈ N a n . An ω \omega ω -continuous semiring [19 ] , the weight domain of weighted NetKAT [46 ] , likewise admits every countable sum, as the supremum of its partial sums, with both operations preserving these suprema. However, it need not be idempotent. A ∗ \ast ∗ -continuous Kleene algebra [31 ] is a Kleene algebra in which ⨁ n ∈ N a ⊗ b n ⊗ c \bigoplus_{n\in\mathbb{N}}a\otimes b^n\otimes c ⨁ n ∈ N a ⊗ b n ⊗ c exists and equals a ⊗ b ∗ ⊗ c a\otimes b^*\otimes c a ⊗ b ∗ ⊗ c , for all a , b , c a,b,c a , b , c . Pumping semirings differ from classes in two respects. First, we require idempotency, unlike ω \omega ω -continuous semirings, but only the countable sums demanded by (C1) need to exist, unlike closed and ω \omega ω -continuous semirings. Second, although ⊛ \circledast ⊛ coincides with the star a ↦ ⨁ n ∈ N a n a \mapsto\bigoplus_{n\in\mathbb{N}} a^n a ↦ ⨁ n ∈ N a n (Proposition 3.2), the pumping axiom (C1) additionally requires every diagonal sum ⨁ n ∈ N a n ⊗ b ⊗ c n \bigoplus_{n\in\mathbb{N}} a^n \otimes b \otimes c^n ⨁ n ∈ N a n ⊗ b ⊗ c n to collapse to a ⊛ ⊗ b ⊗ c ⊛ a^{\circledast} \otimes b \otimes c^{\circledast} a ⊛ ⊗ b ⊗ c ⊛ . This fails in all three classes: the argument of Example 3.3 applies directly to the semiring of all languages over A A A , which is both closed and ω \omega ω -continuous, and to the ∗ * ∗ -continuous Kleene algebra of regular languages. All our examples satisfy 0 ⊛ = 1 0^{\circledast}=1 0 ⊛ = 1 , although our techniques do not require it. Under this choice, the pumping semirings in which every countable sum exists are exactly the closed semirings satisfying (C1) and (C3), and every pumping semiring is a ∗ * ∗ -continuous Kleene algebra; regular languages show that the latter containment is strict.
Quantitative Reachability
We now state the problem that is our main focus in § 5 :
QuantReach:
Input: A pumping semiring S S S , a wPDS ⟨ P , S , w t ⟩ \langle P,S,\mathrm{wt}\rangle ⟨ P , S , wt ⟩ , and two states p p p and p ′ p' p ′ in P P P .
Questions:
Does ⟨ p , ⊣ ⟩ ⇒ ∗ ⟨ p ′ , ⊣ ⟩ \langle p,\dashv\rangle\Rightarrow^{*} \langle p',\dashv\rangle ⟨ p , ⊣ ⟩ ⇒ ∗ ⟨ p ′ , ⊣ ⟩ hold?
What is w t ⟦ ⟨ p , ⊣ ⟩ , ⟨ p ′ , ⊣ ⟩ ⟧ \mathrm{wt}\llbracket\langle p,\dashv\rangle,\langle p',\dashv\rangle\rrbracket wt [ [ ⟨ p , ⊣ ⟩ , ⟨ p ′ , ⊣ ⟩ ] ] ?
We prove the following statement:
Theorem 3.5. QuantReach is computable.
Schwoon et al. [44 ] showed that this problem is computable when the underlying idempotent semiring satisfies the ascending chain condition (ACC), i.e., it has no infinite strictly ascending chain. This already excludes the arctic pumping semiring ⟨ N ± ∞ , max , + , ⊛ , − ∞ , 0 ⟩ \langle\mathbb{N}_{\pm\infty},\max,+,\circledast,-\infty,0\rangle ⟨ N ± ∞ , max , + , ⊛ , − ∞ , 0 ⟩ , as well as the semiring of downward-closed languages that underpins our network algorithms in § 7 .
Observe that, given a pumping semiring S = ⟨ S , ⊕ , ⊗ , ⊛ , 0 , 1 ⟩ S=\langle S,\oplus,\otimes,\circledast,0,1\rangle S = ⟨ S , ⊕ , ⊗ , ⊛ , 0 , 1 ⟩ , a wPDS ⟨ P , S , w t ⟩ \langle P,S,\mathrm{wt}\rangle ⟨ P , S , wt ⟩ , and two configurations c , c ′ ∈ Config ( P ) c,c'\in\operatorname{Config}(P) c , c ′ ∈ Config ( P ) , we can effectively construct another wPDS ⟨ P ′ , S , w t ′ ⟩ \langle P',S,\mathrm{wt}'\rangle ⟨ P ′ , S , wt ′ ⟩ with additional transitions that initially populate the stack, and finally flush the stack, each transition annotated with the weight 1 1 1 , such that computing w t ⟦ c , c ′ ⟧ \mathrm{wt}\llbracket c,c'\rrbracket wt [ [ c , c ′ ] ] reduces to computing w t ′ ⟦ ⟨ p , ⊣ ⟩ , ⟨ p ′ , ⊣ ⟩ ⟧ \mathrm{wt}'\llbracket\langle p,\dashv\rangle,\langle p',\dashv\rangle\rrbracket wt ′ [ [ ⟨ p , ⊣ ⟩ , ⟨ p ′ , ⊣ ⟩ ] ] for some states p p p and p ′ p' p ′ in P ′ P' P ′ . This leads to the following corollary:
Corollary 3.6. Given a pumping semiring S S S , a wPDS ⟨ P , S , w t ⟩ \langle P,S,\mathrm{wt}\rangle ⟨ P , S , wt ⟩ , and two configurations c , c ′ ∈ Config ( P ) c,c'\in\operatorname{Config}(P) c , c ′ ∈ Config ( P ) , w t ⟦ c , c ′ ⟧ \mathrm{wt}\llbracket c,c'\rrbracket wt [ [ c , c ′ ] ] can be effectively computed.
Segment Tree Algebras
In this section, we describe a novel representation of runs in a wPDS. Intuitively, it gives a compositional counterpart to the sequential definition provided in § 2.2 , comprising labelled trees such that each tree describes a set of runs. Moreover, the root label of each tree contains a summary of the runs that the tree represents, including their cumulative weight.
The construction is driven by two observations. First, reachability between empty-stack configurations of a PDS is already captured by the classical construction of a context-free grammar from a pushdown automaton [45 Lem. 2.15] , whose non-terminals A p q A_{pq} A pq range over pairs of states, read as “from ⟨ p , ⊣ ⟩ \langle p,\dashv\rangle ⟨ p , ⊣ ⟩ to ⟨ q , ⊣ ⟩ \langle q,\dashv\rangle ⟨ q , ⊣ ⟩ ,” and which derives them in exactly two ways: by bracketing a non-terminal between a matching push and pop, or by concatenating two of them. The operations ν \nu ν and h h h below are precisely these, and our labelled trees are the corresponding derivation trees, with each A p q A_{pq} A pq enriched by the cumulative weight of the runs it derives. Second, qualitatively, the non-terminal alone suffices, as there is no pumping to account for and only finitely many pairs of states, whereas recovering pumping behaviour requires the history of the derivation, which the tree retains.
Segment Tree Algebras
Given sets S S S and X X X , we define a segment tree algebra over ( S , X ) (S, X) ( S , X ) (ST( S , X ) (S, X) ( S , X ) -algebra, for short) as a tuple T = ⟨ T ⊥ , v , h , ⊥ ⟩ \mathcal{T} = \langle\mathcal{T}^{\perp}, v, h, \perp\rangle T = ⟨ T ⊥ , v , h , ⊥ ⟩ where T ⊥ \mathcal{T}^{\perp} T ⊥ is shorthand for T ∪ { ⊥ } \mathcal{T} \cup\{\perp\} T ∪ { ⊥ } , T ⊆ FTree ( S ) \mathcal{T} \subseteq\operatorname{FTree}(S) T ⊆ FTree ( S ) is a set of S S S -labelled trees, ⊥ \perp ⊥ is a special symbol, v : X × ( T ⊥ ) → T ⊥ v : X \times(\mathcal{T}^{\perp}) \to\mathcal{T}^{\perp} v : X × ( T ⊥ ) → T ⊥ , and h : T ⊥ × T ⊥ → T ⊥ h : \mathcal{T}^{\perp} \times\mathcal{T}^{\perp} \to\mathcal{T}^{\perp} h : T ⊥ × T ⊥ → T ⊥ such that:
v ( x , ⊥ ) = ⊥ , and v(x,\perp)=\perp,\ \text{and} v ( x , ⊥ ) =⊥ , and
h ( L T , ⊥ ) = h ( ⊥ , L T ) = ⊥ h(LT,\perp)=h(\perp,LT)=\perp h ( L T , ⊥ ) = h ( ⊥ , L T ) =⊥
for arbitrary x ∈ X x \in X x ∈ X , and L T ∈ T ⊥ LT \in\mathcal{T}^{\perp} L T ∈ T ⊥ . We call T \mathcal{T} T finite if T \mathcal{T} T is finite.
An ideal in T \mathcal{T} T is a subset I ⊆ T ⊥ I \subseteq\mathcal{T}^{\perp} I ⊆ T ⊥ such that ⊥ ∈ I \perp\in I ⊥∈ I and, for every x ∈ X x \in X x ∈ X and L T 1 , L T 2 ∈ I LT_1, LT_2 \in I L T 1 , L T 2 ∈ I , we have v ( x , L T 1 ) ∈ I v(x,LT_1) \in I v ( x , L T 1 ) ∈ I and h ( L T 1 , L T 2 ) ∈ I h(LT_1,LT_2) \in I h ( L T 1 , L T 2 ) ∈ I . Clearly, ⟨ I , v , h , ⊥ ⟩ \langle I,v,h,\perp\rangle ⟨ I , v , h , ⊥ ⟩ is also a segment tree algebra. Given a set G ⊆ T G \subseteq\mathcal{T} G ⊆ T of S S S -labelled trees, let [ G ] T ⊆ T ⊥ [G]_{\mathcal{T}} \subseteq\mathcal{T}^{\perp} [ G ] T ⊆ T ⊥ be the smallest ideal in T \mathcal{T} T containing G ⊥ G^{\perp} G ⊥ ; we call [ G ] T [G]_{\mathcal{T}} [ G ] T the ideal generated by G G G . Equivalently, [ G ] T [G]_{\mathcal{T}} [ G ] T is the closure of G ⊥ G^{\perp} G ⊥ under the operations v v v and h h h :
Lemma 4.1. Given G ⊆ T G \subseteq\mathcal{T} G ⊆ T , [ G ] T = ⋃ i ∈ N G i [G]_{\mathcal{T}} = \bigcup_{i \in\mathbb{N}} G_i [ G ] T = ⋃ i ∈ N G i such that
(a) G 0 : = G ⊥ = G ∪ { ⊥ } G_0 := G^{\perp} = G \cup\{\perp\} G 0 := G ⊥ = G ∪ { ⊥ } ,
(b) G i : = G i − 1 ∪ G i , v ∪ G i , h G_i := G_{i-1} \cup G_{i,v} \cup G_{i,h} G i := G i − 1 ∪ G i , v ∪ G i , h where G i , v : = { v ( x , L T ) ∣ x ∈ X , L T ∈ G i − 1 } G_{i,v} := \{v(x,LT) \mid x \in X, LT \in G_{i-1}\} G i , v := { v ( x , L T ) ∣ x ∈ X , L T ∈ G i − 1 } , and G i , h : = { h ( L T 1 , L T 2 ) ∣ L T 1 , L T 2 ∈ G i − 1 } G_{i,h} := \{h(LT_1,LT_2) \mid LT_1,LT_2 \in G_{i-1}\} G i , h := { h ( L T 1 , L T 2 ) ∣ L T 1 , L T 2 ∈ G i − 1 } .
We defer the proof to Section B.
Contexts. We define GrCon T \operatorname{GrCon}_{\mathcal{T}} GrCon T to be the set of ground functions of one of the following forms: v ( x , _ ) : L T ↦ v ( x , L T ) v(x, \_) : LT \mapsto v(x,LT) v ( x , _ ) : L T ↦ v ( x , L T ) , h ( L T ′ , _ ) : L T ↦ h ( L T ′ , L T ) h(LT', \_) : LT \mapsto h(LT',LT) h ( L T ′ , _ ) : L T ↦ h ( L T ′ , L T ) , or h ( _ , L T ′ ) : L T ↦ h ( L T , L T ′ ) h(\_,LT') : LT \mapsto h(LT,LT') h ( _ , L T ′ ) : L T ↦ h ( L T , L T ′ ) . A context in T \mathcal{T} T is a function in the monoid Context T \operatorname{Context}_{\mathcal{T}} Context T generated by GrCon T \operatorname{GrCon}_{\mathcal{T}} GrCon T under function composition ( ∘ ) (\circ) ( ∘ ) . In particular, we define the context Id \operatorname{Id} Id as the identity function. We then have the following important property, which essentially states that an ideal is closed under context applications:
Lemma 4.2. Given an ideal I I I in T = ⟨ T ⊥ , v , h , ⊥ ⟩ \mathcal{T} = \langle\mathcal{T}^{\perp},v,h,\perp\rangle T = ⟨ T ⊥ , v , h , ⊥ ⟩ , let I = ⟨ I , v , h , ⊥ ⟩ \mathcal{I} = \langle I,v,h,\perp\rangle I = ⟨ I , v , h , ⊥ ⟩ . Then for any context f ∈ Context I f \in\operatorname{Context}_{\mathcal{I}} f ∈ Context I in I \mathcal{I} I , and L T ∈ I LT \in I L T ∈ I , we have f ( L T ) ∈ I f(LT) \in I f ( L T ) ∈ I .
Proof. Since f f f is a finite composition of elements of GrCon I \operatorname{GrCon}_{\mathcal{I}} GrCon I , it has the form f = f 1 ∘ ⋯ ∘ f k f=f_1\circ\cdots\circ f_k f = f 1 ∘ ⋯ ∘ f k for f i ∈ GrCon I f_i \in\operatorname{GrCon}_{\mathcal{I}} f i ∈ GrCon I . The proof is by induction on k k k , using the definition of ideals. □ \square □
Intuitively, we will use contexts to capture pumping behaviours in wPDS runs. In the following subsections, we will describe how segment tree algebras form a useful class of objects for wPDSs.
wPDS vs. Segment Tree Algebras
In this subsection, we will construct a canonical segment tree algebra that captures the runs of a wPDS. We fix an arbitrary wPDS ⟨ P , S , w t ⟩ \langle\mathcal{P},S,\mathsf{wt}\rangle ⟨ P , S , wt ⟩ where P = ⟨ Q , A , Γ , Trans ⟩ \mathcal{P}=\langle Q,A,\Gamma,\operatorname{Trans}\rangle P = ⟨ Q , A , Γ , Trans ⟩ , and S = ⟨ S , ⊕ , ∅ , 0 , 1 ⟩ S=\langle S,\oplus,\varnothing,0,1\rangle S = ⟨ S , ⊕ , ∅ , 0 , 1 ⟩ for the rest of this paper, unless specified otherwise. Consider the set Q × Q ∪ { ⊥ Q } Q \times Q \cup\{\perp_Q\} Q × Q ∪ { ⊥ Q } with the special element ⊥ Q \perp_Q ⊥ Q that denotes an undefined element, and the semigroup Q Q Q over this set, with multiplication ⊙ \odot ⊙ given by
⟨ p 1 , q 1 ⟩ ⊙ ⊥ Q : = ⊥ Q , ⊥ Q ⊙ ⟨ p 1 , q 1 ⟩ : = ⊥ Q , ⟨ p 1 , q 1 ⟩ ⊙ ⟨ p 2 , q 2 ⟩ : = { ⟨ p 1 , q 2 ⟩ if q 1 = p 2 , ⊥ Q otherwise. \langle p_1,q_1\rangle\odot\perp_Q := \perp_Q,\qquad\perp_Q \odot\langle p_1,q_1\rangle:= \perp_Q,\qquad\langle p_1,q_1\rangle\odot\langle p_2,q_2\rangle:=
\begin{cases}
\langle p_1,q_2\rangle& \text{if } q_1=p_2,\\
\perp_Q & \text{otherwise.}
\end{cases} ⟨ p 1 , q 1 ⟩ ⊙ ⊥ Q := ⊥ Q , ⊥ Q ⊙ ⟨ p 1 , q 1 ⟩ := ⊥ Q , ⟨ p 1 , q 1 ⟩ ⊙ ⟨ p 2 , q 2 ⟩ := { ⟨ p 1 , q 2 ⟩ ⊥ Q if q 1 = p 2 , otherwise.
for arbitrary p 1 , q 1 , p 2 , q 2 ∈ Q p_1,q_1,p_2,q_2\in Q p 1 , q 1 , p 2 , q 2 ∈ Q . We denote by C \mathcal{C} C the product semigroup Q × ⟨ S , ⊗ ⟩ Q\times\langle S,\otimes\rangle Q × ⟨ S , ⊗ ⟩ , whose componentwise multiplication we also write ⊙ \odot ⊙ . Intuitively, a tuple ⟨ ⟨ p , q ⟩ , a ⟩ ∈ C \langle\langle p,q\rangle,a\rangle\in\mathcal{C} ⟨⟨ p , q ⟩ , a ⟩ ∈ C can be read as “There is a run from c = ⟨ p , ⊢ ⟩ c=\langle p,\vdash\rangle c = ⟨ p , ⊢ ⟩ to c ′ = ⟨ q , ⊢ ⟩ c'=\langle q,\vdash\rangle c ′ = ⟨ q , ⊢ ⟩ in P \mathcal{P} P such that wt ⟦ c , c ′ ⟧ = a \operatorname{wt}\llbracket c,c'\rrbracket=a wt [ [ c , c ′ ] ] = a .” For notational convenience, we abuse notation and write s t ( ⟨ ⟨ p , q ⟩ , a ⟩ ) st(\langle\langle p,q\rangle,a\rangle) s t (⟨⟨ p , q ⟩ , a ⟩) for the tuple ⟨ p , q ⟩ \langle p,q\rangle ⟨ p , q ⟩ , and ⟦ ⟨ ⟨ p , q ⟩ , a ⟩ ⟧ \llbracket\langle\langle p,q\rangle,a\rangle\rrbracket [ [ ⟨⟨ p , q ⟩ , a ⟩ ] ] for its weight a a a .
Let us first define the ambient S T ( C , T r a n s 2 ) \mathrm{ST}(\mathcal{C},\mathrm{Trans}^2) ST ( C , Trans 2 ) -algebra F C = ⟨ F T r e e ( C ) ⊥ , v C , h C , ⊥ ⟩ \mathcal{F}_{\mathcal{C}}=\langle\mathrm{FTree}(\mathcal{C})_\perp,v_{\mathcal{C}},h_{\mathcal{C}},\perp\rangle F C = ⟨ FTree ( C ) ⊥ , v C , h C , ⊥ ⟩ such that for δ 1 = ⟨ p 1 , α 11 , u 1 , α 12 , q 1 ⟩ , δ 2 = ⟨ p 2 , α 21 , u 2 , α 22 , q 2 ⟩ ∈ T r a n s \delta_1=\langle p_1,\alpha_{11},u_1,\alpha_{12},q_1\rangle,\delta_2=\langle p_2,\alpha_{21},u_2,\alpha_{22},q_2\rangle\in\mathrm{Trans} δ 1 = ⟨ p 1 , α 11 , u 1 , α 12 , q 1 ⟩ , δ 2 = ⟨ p 2 , α 21 , u 2 , α 22 , q 2 ⟩ ∈ Trans , and ⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩ ∈ F T r e e ( C ) \langle T_1,\sigma_1\rangle,\langle T_2,\sigma_2\rangle\in\mathrm{FTree}(\mathcal{C}) ⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩ ∈ FTree ( C ) the following holds for v C v_{\mathcal{C}} v C :
if ⟨ ⟨ p 1 , q 1 ⟩ , wt ( δ 1 ) ⟩ ⊙ σ 1 ( ϵ ) ⊙ ⟨ ⟨ p 2 , q 2 ⟩ , wt ( δ 2 ) ⟩ = ⟨ ⟨ p 1 , q 2 ⟩ , a ⟩ \langle\langle p_1,q_1\rangle,\operatorname{wt}(\delta_1)\rangle\odot\sigma_1(\epsilon)\odot\langle\langle p_2,q_2\rangle,\operatorname{wt}(\delta_2)\rangle=\langle\langle p_1,q_2\rangle,a\rangle ⟨⟨ p 1 , q 1 ⟩ , wt ( δ 1 )⟩ ⊙ σ 1 ( ϵ ) ⊙ ⟨⟨ p 2 , q 2 ⟩ , wt ( δ 2 )⟩ = ⟨⟨ p 1 , q 2 ⟩ , a ⟩ , α 11 = α 22 = ϵ \alpha_{11}=\alpha_{22}=\epsilon α 11 = α 22 = ϵ , and α 12 = α 21 ∈ Γ \alpha_{12}=\alpha_{21}\in\Gamma α 12 = α 21 ∈ Γ then v C ( ⟨ δ 1 , δ 2 ⟩ , ⟨ T 1 , σ 1 ⟩ ) : = ⟨ T ′ , σ ′ ⟩ v_{\mathcal{C}}(\langle\delta_1,\delta_2\rangle,\langle T_1,\sigma_1\rangle):=\langle T',\sigma'\rangle v C (⟨ δ 1 , δ 2 ⟩ , ⟨ T 1 , σ 1 ⟩) := ⟨ T ′ , σ ′ ⟩ , where T ′ = 1 ⋅ T 1 ∪ { ϵ } T'=1\cdot T_1\cup\{\epsilon\} T ′ = 1 ⋅ T 1 ∪ { ϵ } , σ ′ ( ϵ ) = ⟨ ⟨ p 1 , q 2 ⟩ , a ⟩ \sigma'(\epsilon)=\langle\langle p_1,q_2\rangle,a\rangle σ ′ ( ϵ ) = ⟨⟨ p 1 , q 2 ⟩ , a ⟩ , and σ ′ ( 1 ⋅ w ) = σ 1 ( w ) \sigma'(1\cdot w)=\sigma_1(w) σ ′ ( 1 ⋅ w ) = σ 1 ( w ) ,
otherwise, v C ( ⟨ δ 1 , δ 2 ⟩ , ⟨ T 1 , σ 1 ⟩ ) : = ⊥ v_{\mathcal{C}}(\langle\delta_1,\delta_2\rangle,\langle T_1,\sigma_1\rangle):=\perp v C (⟨ δ 1 , δ 2 ⟩ , ⟨ T 1 , σ 1 ⟩) :=⊥ ;
and the following holds for h C h_{\mathcal{C}} h C :
if σ 1 ( ϵ ) ⊙ σ 2 ( ϵ ) = ⟨ ⟨ p , q ⟩ , a ⟩ \sigma_1(\epsilon)\odot\sigma_2(\epsilon)=\langle\langle p,q\rangle,a\rangle σ 1 ( ϵ ) ⊙ σ 2 ( ϵ ) = ⟨⟨ p , q ⟩ , a ⟩ then h C ( ⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩ ) : = ⟨ T ′ , σ ′ ⟩ h_{\mathcal{C}}(\langle T_1,\sigma_1\rangle,\langle T_2,\sigma_2\rangle):=\langle T',\sigma'\rangle h C (⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩) := ⟨ T ′ , σ ′ ⟩ , where T ′ = { ϵ } ∪ 1 ⋅ T 1 ∪ 2 ⋅ T 2 T'=\{\epsilon\}\cup1\cdot T_1\cup2\cdot T_2 T ′ = { ϵ } ∪ 1 ⋅ T 1 ∪ 2 ⋅ T 2 , σ ′ ( ϵ ) = ⟨ ⟨ p , q ⟩ , a ⟩ \sigma'(\epsilon)=\langle\langle p,q\rangle,a\rangle σ ′ ( ϵ ) = ⟨⟨ p , q ⟩ , a ⟩ , σ ′ ( 1 ⋅ w ) = σ 1 ( w ) \sigma'(1\cdot w)=\sigma_1(w) σ ′ ( 1 ⋅ w ) = σ 1 ( w ) , and σ ′ ( 2 ⋅ w ) = σ 2 ( w ) \sigma'(2\cdot w)=\sigma_2(w) σ ′ ( 2 ⋅ w ) = σ 2 ( w ) ,
otherwise, h C ( ⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩ ) : = ⊥ h_{\mathcal{C}}(\langle T_1,\sigma_1\rangle,\langle T_2,\sigma_2\rangle):=\perp h C (⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩) :=⊥ .
We illustrate both these operations in Figure 4 . The following lemma follows by induction.
Figure 4. Illustrations of v C v_{\mathcal{C}} v C and h C h_{\mathcal{C}} h C . Let δ 1 = ⟨ p 1 , ϵ , u 1 , α 12 , q 1 ⟩ , δ 2 = ⟨ p 2 , α 21 , u 2 , ϵ , q 2 ⟩ ∈ T r a n s \delta_1=\langle p_1,\epsilon,u_1,\alpha_{12},q_1\rangle,\delta_2=\langle p_2,\alpha_{21},u_2,\epsilon,q_2\rangle\in\mathrm{Trans} δ 1 = ⟨ p 1 , ϵ , u 1 , α 12 , q 1 ⟩ , δ 2 = ⟨ p 2 , α 21 , u 2 , ϵ , q 2 ⟩ ∈ Trans , where α 12 = α 21 \alpha_{12}=\alpha_{21} α 12 = α 21 .
Lemma 4.3. Given an arbitrary context f ∈ C o n t e x t F C f\in\mathrm{Context}_{\mathcal{F}_{\mathcal{C}}} f ∈ Context F C , we can compute ⟨ b , c ⟩ ∈ S 2 \langle b,c\rangle\in S^2 ⟨ b , c ⟩ ∈ S 2 such that for any two trees ⟨ T , σ ⟩ , ⟨ T ′ , σ ′ ⟩ ∈ F T r e e ( C ) \langle T,\sigma\rangle,\langle T',\sigma'\rangle\in\mathrm{FTree}(\mathcal{C}) ⟨ T , σ ⟩ , ⟨ T ′ , σ ′ ⟩ ∈ FTree ( C ) if ⟨ T ′ , σ ′ ⟩ = f ( ⟨ T , σ ⟩ ) \langle T',\sigma'\rangle=f(\langle T,\sigma\rangle) ⟨ T ′ , σ ′ ⟩ = f (⟨ T , σ ⟩) , then ⟦ σ ′ ( ϵ ) ⟧ = b ⟦ σ ( ϵ ) ⟧ c \llbracket\sigma'(\epsilon)\rrbracket=b\llbracket\sigma(\epsilon)\rrbracket c [ [ σ ′ ( ϵ ) ] ] = b [ [ σ ( ϵ ) ] ] c .
Intuitively, this means that every context f f f has an effect of the form ⟨ b , c ⟩ \langle b,c\rangle ⟨ b , c ⟩ independent of the trees that it is applied to, and this effect can be effectively computed. We then write eff ( f ) = ⟨ b , c ⟩ \operatorname{eff}(f)=\langle b,c\rangle eff ( f ) = ⟨ b , c ⟩ . A context f f f is pumping iff ⟨ T , σ ⟩ = f ( ⟨ T ′ , σ ′ ⟩ ) ⟹ s t ( σ ( ϵ ) ) = s t ( σ ′ ( ϵ ) ) \langle T,\sigma\rangle=f(\langle T',\sigma'\rangle)\Longrightarrow st(\sigma(\epsilon))=st(\sigma'(\epsilon)) ⟨ T , σ ⟩ = f (⟨ T ′ , σ ′ ⟩) ⟹ s t ( σ ( ϵ )) = s t ( σ ′ ( ϵ )) for arbitrary ⟨ T , σ ⟩ , ⟨ T ′ , σ ′ ⟩ ∈ F T r e e ( C ) \langle T,\sigma\rangle,\langle T',\sigma'\rangle\in\mathrm{FTree}(\mathcal{C}) ⟨ T , σ ⟩ , ⟨ T ′ , σ ′ ⟩ ∈ FTree ( C ) . It is easy to show that compositions of pumping contexts are pumping.
Capturing wPDS. We will now formally define a segment tree algebra that characterises the reachability relation in P \mathcal{P} P . Consider the set
I n i t : = { ⟨ { ϵ } , σ ⟩ ∣ p ∈ Q , σ ( ϵ ) = ⟨ ⟨ p , p ⟩ , 1 ⟩ } . \mathrm{Init}:=\{\langle\{\epsilon\},\sigma\rangle\mid p\in Q,\ \sigma(\epsilon)=\langle\langle p,p\rangle,1\rangle\}. Init := {⟨{ ϵ } , σ ⟩ ∣ p ∈ Q , σ ( ϵ ) = ⟨⟨ p , p ⟩ , 1 ⟩} .
The segment tree algebra of ⟨ P , S , wt ⟩ \langle\mathcal{P},S,\operatorname{wt}\rangle ⟨ P , S , wt ⟩ is the tuple ⟨ [ I n i t ] F C , v C , h C , ⊥ ⟩ \langle[\mathrm{Init}]_{\mathcal{F}_{\mathcal{C}}},v_{\mathcal{C}},h_{\mathcal{C}},\perp\rangle ⟨[ Init ] F C , v C , h C , ⊥ ⟩ where [ I n i t ] F C [\mathrm{Init}]_{\mathcal{F}_{\mathcal{C}}} [ Init ] F C is the ideal generated by I n i t \mathrm{Init} Init in F C \mathcal{F}_{\mathcal{C}} F C . Intuitively, the set I n i t \mathrm{Init} Init captures the reachability relation due to the empty runs, along with their weights, which default to 1 1 1 .
Recall from Lemma 4.1 that the set [ I n i t ] F C [\mathrm{Init}]_{\mathcal{F}_{\mathcal{C}}} [ Init ] F C is of the form ⋃ i ∈ N G i \bigcup_{i\in N}G_i ⋃ i ∈ N G i where G i ⊆ F T r e e ( C ) ⊥ G_i\subseteq\mathrm{FTree}(\mathcal{C})_\perp G i ⊆ FTree ( C ) ⊥ . Let us fix this representation for the rest of this paper. Below, we state the main result of this section.
Theorem 4.4. Given states p , q ∈ Q p,q\in Q p , q ∈ Q , let X = { a ∈ S ∣ ⟨ T , σ ⟩ ∈ [ I n i t ] F C , σ ( ϵ ) = ⟨ ⟨ p , q ⟩ , a ⟩ } X=\{a\in S\mid\langle T,\sigma\rangle\in[\mathrm{Init}]_{\mathcal{F}_{\mathcal{C}}},\ \sigma(\epsilon)=\langle\langle p,q\rangle,a\rangle\} X = { a ∈ S ∣ ⟨ T , σ ⟩ ∈ [ Init ] F C , σ ( ϵ ) = ⟨⟨ p , q ⟩ , a ⟩} . Then
wt ⟦ ⟨ p , ⊢ ⟩ , ⟨ q , ⊢ ⟩ ⟧ = ⨁ a ∈ X a . \operatorname{wt}\llbracket\langle p,\vdash\rangle,\langle q,\vdash\rangle\rrbracket=\bigoplus_{a\in X}a. wt [ [ ⟨ p , ⊢ ⟩ , ⟨ q , ⊢ ⟩ ] ] = a ∈ X ⨁ a .
Essentially, we state that in order to confirm the existence of a witness run from ⟨ p , ⊣ ⟩ \langle p,\dashv\rangle ⟨ p , ⊣ ⟩ to ⟨ q , ⊣ ⟩ \langle q,\dashv\rangle ⟨ q , ⊣ ⟩ with the weight a a a , it is necessary and sufficient to find the tuple ⟨ ⟨ p , q ⟩ , a ⟩ \langle\langle p,q\rangle,a\rangle ⟨⟨ p , q ⟩ , a ⟩ in the ideal [ I n i t ] F C [\mathrm{Init}]_{\mathcal F_C} [ Init ] F C of the segment tree algebra of ⟨ P , S , wt ⟩ \langle\mathcal P,S,\operatorname{wt}\rangle ⟨ P , S , wt ⟩ . The proof follows as a corollary of the following statement:
Lemma 4.5. There exists a C C C -labelled tree ⟨ T , σ ⟩ ∈ [ I n i t ] F C \langle T,\sigma\rangle\in[\mathrm{Init}]_{\mathcal F_C} ⟨ T , σ ⟩ ∈ [ Init ] F C with σ ( ϵ ) = ⟨ ⟨ p , q ⟩ , a ⟩ \sigma(\epsilon)=\langle\langle p,q\rangle,a\rangle σ ( ϵ ) = ⟨⟨ p , q ⟩ , a ⟩ if and only if there exists a sequence τ ∈ Paths ( ⟨ p , ⊣ ⟩ , ⟨ q , ⊣ ⟩ ) \tau\in\operatorname{Paths}(\langle p,\dashv\rangle,\langle q,\dashv\rangle) τ ∈ Paths (⟨ p , ⊣ ⟩ , ⟨ q , ⊣ ⟩) such that wt ∗ ( τ ) = a \operatorname{wt}^{*}(\tau)=a wt ∗ ( τ ) = a .
Thus, we obtain a dual representation of the standard notion of derivation trees in context-free grammars, but fit for inductive reasoning. Due to space limitations, we defer the proof to Section C. Figure 5 gives a visualisation.
Figure 5. Left: a run from ⟨ p , ⊣ ⟩ \langle p,\dashv\rangle ⟨ p , ⊣ ⟩ to ⟨ q , ⊣ ⟩ \langle q,\dashv\rangle ⟨ q , ⊣ ⟩ , with push (upward) and pop (downward) arrows, decomposed as ⟨ p , ⊣ ⟩ → p u s h α 1 ⟨ p ′ , ⊣ ⟩ ⇒ ∗ ⟨ r ′ , ⊣ ⟩ → p o p α 1 ⟨ q , ⊣ ⟩ \langle p,\dashv\rangle\xrightarrow{\mathrm{push}\ \alpha_1} \langle p',\dashv\rangle\Rightarrow^{*} \langle r',\dashv\rangle\xrightarrow{\mathrm{pop}\ \alpha_1} \langle q,\dashv\rangle ⟨ p , ⊣ ⟩ push α 1 ⟨ p ′ , ⊣ ⟩ ⇒ ∗ ⟨ r ′ , ⊣ ⟩ pop α 1 ⟨ q , ⊣ ⟩ . Right: the corresponding tree, whose root ⟨ ⟨ p , q ⟩ , wt ( δ 1 ) a 1 a 2 wt ( δ 2 ) ⟩ \langle\langle p,q\rangle,\operatorname{wt}(\delta_1)a_1a_2\operatorname{wt}(\delta_2)\rangle ⟨⟨ p , q ⟩ , wt ( δ 1 ) a 1 a 2 wt ( δ 2 )⟩ has a single child ⟨ ⟨ p ′ , r ′ ⟩ , a 1 a 2 ⟩ \langle\langle p',r'\rangle,a_1a_2\rangle ⟨⟨ p ′ , r ′ ⟩ , a 1 a 2 ⟩ ; the red and purple subtrees model the further split of the ⟨ p ′ , ⊣ ⟩ \langle p',\dashv\rangle ⟨ p ′ , ⊣ ⟩ -to-⟨ r ′ , ⊣ ⟩ \langle r',\dashv\rangle ⟨ r ′ , ⊣ ⟩ run at ⟨ q ′ , ⊣ ⟩ \langle q',\dashv\rangle ⟨ q ′ , ⊣ ⟩ into weights a 1 a_1 a 1 and a 2 a_2 a 2 .
An Algorithm for Quantitative Reachability
In this section, we leverage segment tree algebras to give an algorithm for QuantReach. We start with an overview of our approach.
A Naïve Approach. By Lemma 4.5 and Theorem 4.4, it suffices to first compute the set of all C C C -labelled trees in the ideal [ I n i t ] F C [\mathrm{Init}]_{\mathcal F_C} [ Init ] F C , and project each of its elements onto the corresponding root label. This procedure hinges crucially on computing the ideal [ I n i t ] F C [\mathrm{Init}]_{\mathcal F_C} [ Init ] F C in a representation that allows us to effectively compute the projection.
Recall from Section 4.2 that [ I n i t ] F C [\mathrm{Init}]_{\mathcal F_C} [ Init ] F C is of the form ⋃ i ∈ N G i \bigcup_{i\in\mathbb{N}}G_i ⋃ i ∈ N G i . One may try to iteratively construct the increasing sequence G 0 ⊆ G 1 ⊆ ⋯ G_0\subseteq G_1\subseteq\cdots G 0 ⊆ G 1 ⊆ ⋯ as defined in Lemma 4.1 until it reaches a fixpoint; if it did, this would yield an algorithm for QuantReach.
If G i + 1 = G i G_{i+1}=G_i G i + 1 = G i holds for some i ∈ N i\in\mathbb{N} i ∈ N , then it is clear that G i + 1 = [ I n i t ] F C G_{i+1}=[\mathrm{Init}]_{\mathcal F_C} G i + 1 = [ Init ] F C . Unfortunately, we will never reach such a fixed point. By definition, both the functions ν C \nu_C ν C and h C h_C h C necessarily increment the height of the input labelled tree. This means that for every i ∈ N i\in\mathbb{N} i ∈ N , there is a C C C -labelled tree in G i + 1 G_{i+1} G i + 1 not present in G i G_i G i . Hence, this approach will not work.
Let us define the partial order ⟨ ⟨ p , q ⟩ , a ⟩ ≤ C ⟨ ⟨ p ′ , q ′ ⟩ , a ′ ⟩ \langle\langle p,q\rangle,a\rangle\leq_C\langle\langle p',q'\rangle,a'\rangle ⟨⟨ p , q ⟩ , a ⟩ ≤ C ⟨⟨ p ′ , q ′ ⟩ , a ′ ⟩ iff ⟨ p , q ⟩ = ⟨ p ′ , q ′ ⟩ \langle p,q\rangle=\langle p',q'\rangle ⟨ p , q ⟩ = ⟨ p ′ , q ′ ⟩ and a ≤ S a ′ a\leq_S a' a ≤ S a ′ . A better fixpoint strategy would then be to compare the root labels of the labelled trees in G i G_i G i . It is sufficient to show that for some i ∈ N i\in\mathbb{N} i ∈ N ,
∀ ⟨ T ′ , σ ′ ⟩ ∈ G i + 1 . ∃ ⟨ T , σ ⟩ ∈ G i . σ ′ ( ϵ ) ≤ C σ ( ϵ ) . \forall\langle T',\sigma'\rangle\in G_{i+1}.\ \exists\langle T,\sigma\rangle\in G_i.\ \sigma'(\epsilon)\leq_C\sigma(\epsilon). ∀ ⟨ T ′ , σ ′ ⟩ ∈ G i + 1 . ∃ ⟨ T , σ ⟩ ∈ G i . σ ′ ( ϵ ) ≤ C σ ( ϵ ) .
By monotonicity of our operations w.r.t. ≤ C \leq_C ≤ C , the above property also holds when i i i is replaced by an arbitrary j > i j>i j > i . Intuitively, we have computed all ≤ C \leq_C ≤ C -maximal elements by iteration i i i and, by Theorem 4.4, have sufficient elements to compute QuantReach. However, by definition, pumping semirings, and thus C C C , may have infinite ascending chains. Hence, a fixpoint may not exist.
Solution. We overcome the problem stated above by iteratively computing another increasing sequence J 0 ⊆ J 1 ⊆ ⋯ J_0 \subseteq J_1 \subseteq\cdots J 0 ⊆ J 1 ⊆ ⋯ of finite sets of C C C -labelled trees, for which we can prove the following:
(P1) there exists i ∈ N i \in\mathbb{N} i ∈ N such that J i + 1 = J i J_{i+1}=J_i J i + 1 = J i ,
(P2) for every i ∈ N i \in\mathbb{N} i ∈ N and ⟨ T , σ ⟩ ∈ G i \langle T,\sigma\rangle\in G_i ⟨ T , σ ⟩ ∈ G i , there exists ⟨ T ′ , σ ′ ⟩ ∈ J i \langle T',\sigma'\rangle\in J_i ⟨ T ′ , σ ′ ⟩ ∈ J i such that σ ( ϵ ) ≤ C σ ′ ( ϵ ) \sigma(\epsilon) \le_C \sigma'(\epsilon) σ ( ϵ ) ≤ C σ ′ ( ϵ ) ,
(P3) for every i ∈ N i \in\mathbb{N} i ∈ N and ⟨ T ′ , σ ′ ⟩ ∈ J i \langle T',\sigma'\rangle\in J_i ⟨ T ′ , σ ′ ⟩ ∈ J i , where σ ′ ( ϵ ) = ⟨ ⟨ p , q ⟩ , a ′ ⟩ \sigma'(\epsilon)=\langle\langle p,q\rangle,a'\rangle σ ′ ( ϵ ) = ⟨⟨ p , q ⟩ , a ′ ⟩ , there exists a countable subset
X ⊆ { [ [ σ ( ϵ ) ] ] ∣ ⟨ T , σ ⟩ ∈ [ I n i t ] F C , st ( σ ( ϵ ) ) = st ( σ ′ ( ϵ ) ) } X \subseteq\{[\![\sigma(\epsilon)]\!] \mid\langle T,\sigma\rangle\in[\mathrm{Init}]_{\mathcal{F}_C},\operatorname{st}(\sigma(\epsilon))=\operatorname{st}(\sigma'(\epsilon))\} X ⊆ {[ [ σ ( ϵ )] ] ∣ ⟨ T , σ ⟩ ∈ [ Init ] F C , st ( σ ( ϵ )) = st ( σ ′ ( ϵ ))}
such that
⨁ a ∈ X a = a ′ . \bigoplus_{a\in X} a=a'. a ∈ X ⨁ a = a ′ .
Property (P1) ensures the termination of the procedure. Property (P2) ensures that, by computing the limit of the J i J_i J i 's, we at least compute upper bounds, w.r.t. ≤ C \le_C ≤ C , of the root labels in [ I n i t ] F C [\mathrm{Init}]_{\mathcal{F}_C} [ Init ] F C . Property (P3) ensures that these upper bounds are not too large. Every computed weight is a sum of weights of trees in [ I n i t ] F C [\mathrm{Init}]_{\mathcal{F}_C} [ Init ] F C . Together, they ensure that the least upper bounds are captured. If J i 0 J_{i_0} J i 0 is the fixed point of the sequence, then (P2) and (P3) yield:
Lemma 5.1. Given p , q ∈ Q p,q\in Q p , q ∈ Q , define the sets
X = { [ [ σ ( ϵ ) ] ] ∈ S ∣ ⟨ T , σ ⟩ ∈ [ I n i t ] F C , st ( σ ( ϵ ) ) = ⟨ p , q ⟩ } X=\{[\![\sigma(\epsilon)]\!]\in S\mid\langle T,\sigma\rangle\in[\mathrm{Init}]_{\mathcal{F}_C},\operatorname{st}(\sigma(\epsilon))=\langle p,q\rangle\} X = {[ [ σ ( ϵ )] ] ∈ S ∣ ⟨ T , σ ⟩ ∈ [ Init ] F C , st ( σ ( ϵ )) = ⟨ p , q ⟩}
X 0 = { [ [ σ ′ ( ϵ ) ] ] ∈ S ∣ ⟨ T ′ , σ ′ ⟩ ∈ J i 0 , st ( σ ′ ( ϵ ) ) = ⟨ p , q ⟩ } X_0=\{[\![\sigma'(\epsilon)]\!]\in S\mid\langle T',\sigma'\rangle\in J_{i_0},\operatorname{st}(\sigma'(\epsilon))=\langle p,q\rangle\} X 0 = {[ [ σ ′ ( ϵ )] ] ∈ S ∣ ⟨ T ′ , σ ′ ⟩ ∈ J i 0 , st ( σ ′ ( ϵ )) = ⟨ p , q ⟩}
Then it holds that
⨁ a ∈ X a = ⨁ a 0 ∈ X 0 a 0 . \bigoplus_{a\in X} a=\bigoplus_{a_0\in X_0} a_0. a ∈ X ⨁ a = a 0 ∈ X 0 ⨁ a 0 . By Theorem 4.4 , in order to compute wt [ [ ⟨ p , ⊣ ⟩ , ⟨ q , ⊣ ⟩ ] ] \operatorname{wt}[\![\langle p,\dashv\rangle,\langle q,\dashv\rangle]\!] wt [ [⟨ p , ⊣ ⟩ , ⟨ q , ⊣ ⟩] ] , it suffices to compute ⨁ a 0 ∈ X 0 a 0 \bigoplus_{a_0\in X_0}a_0 ⨁ a 0 ∈ X 0 a 0 . In the rest of this section, we will obtain a fixpoint algorithm that computes J i 0 J_{i_0} J i 0 .
Overview. The key idea of our approach is to accelerate the effects of a pumping context. Consider the simple acceleration scenario in Figure 6 .
Figure 6. Accelerating a pumping context.
On the left, we observe a pumping context f f f , with the effect ⟨ b , c ⟩ \langle b,c\rangle ⟨ b , c ⟩ (illustrated along the bottom contour of the tree f ( L T ) f(LT) f ( L T ) ) applied to the tree L T LT L T . The application transforms the root label ⟨ ⟨ p , q ⟩ , a ⟩ \langle\langle p,q\rangle,a\rangle ⟨⟨ p , q ⟩ , a ⟩ of L T LT L T into the root label ⟨ ⟨ p , q ⟩ , b a c ⟩ \langle\langle p,q\rangle,bac\rangle ⟨⟨ p , q ⟩ , ba c ⟩ of f ( L T ) f(LT) f ( L T ) . In the middle, we illustrate the result of composing multiple iterations of f f f on L T LT L T . By Lemma 4.5 , each fresh application of f f f to f i ( L T ) f^i(LT) f i ( L T ) corresponds to another tree in the ideal [ I n i t ] F C [\mathrm{Init}]_{\mathcal{F}_C} [ Init ] F C , with the root label ⟨ ⟨ p , q ⟩ , b i + 1 a c i + 1 ⟩ \langle\langle p,q\rangle,b^{i+1}ac^{i+1}\rangle ⟨⟨ p , q ⟩ , b i + 1 a c i + 1 ⟩ . By (C1), the sum of the weight components of all these labels is b ⊛ a c ⊛ b^{\circledast}a c^{\circledast} b ⊛ a c ⊛ . Hence, we can instead accelerate the infinite sequence of pumped trees into the single tree illustrated on the right of Figure 6 , where we just replace the root label of L T LT L T by ⟨ ⟨ p , q ⟩ , b ⊛ a c ⊛ ⟩ \langle\langle p,q\rangle,b^{\circledast}ac^{\circledast}\rangle ⟨⟨ p , q ⟩ , b ⊛ a c ⊛ ⟩ . Instead of simply computing the left-most tree, we compute L T ′ LT' L T ′ in our iterative step. However, acceleration is not always so straightforward. Consider the acceleration scenario in Figure 7 .
Figure 7. Recovering the pumping effect from an accelerated tree.
On the left, we have a case of pumping where the context f ′ f' f ′ is applied to our already pumped tree L T ′ LT' L T ′ , producing a tree with the root label ⟨ ⟨ p , q ′ ⟩ , b ′ b ⊛ a c ⊛ c ′ ⟩ \langle\langle p,q'\rangle,b'b^\circledast ac^\circledast c'\rangle ⟨⟨ p , q ′ ⟩ , b ′ b ⊛ a c ⊛ c ′ ⟩ . Now suppose the tree L T ′ LT' L T ′ additionally has a subtree L T ′ ′ LT'' L T ′′ with the root label ⟨ ⟨ p ′ , q ′ ⟩ , a ′ ⟩ \langle\langle p',q'\rangle,a'\rangle ⟨⟨ p ′ , q ′ ⟩ , a ′ ⟩ . As we saw earlier, the existence of the tree L T ′ LT' L T ′ implies that there is a sequence Id , f , f ∘ f , … \operatorname{Id},f,f\circ f,\ldots Id , f , f ∘ f , … of pumping contexts which cumulatively creates the effect ⟨ b ⊛ , c ⊛ ⟩ \langle b^\circledast,c^\circledast\rangle ⟨ b ⊛ , c ⊛ ⟩ on some tree that is structurally similar to L T LT L T . Moreover, since acceleration leaves the non-trivial subtrees untouched, we should be able to infer a context f ′ ′ f'' f ′′ (as illustrated) with the effect ⟨ b ′ ′ , c ′ ′ ⟩ \langle b'',c''\rangle ⟨ b ′′ , c ′′ ⟩ , such that a = b ′ ′ a ′ c ′ ′ a=b''a'c'' a = b ′′ a ′ c ′′ . In particular, it may be that b ⊛ a c ⊛ ≠ b ′ ′ a ′ c ′ ′ b^\circledast ac^\circledast\ne b''a'c'' b ⊛ a c ⊛ = b ′′ a ′ c ′′ , since the root label of L T ′ LT' L T ′ was synthetically mutated. Composing each context in this sequence with f ′ f' f ′ on the left and f ′ ′ f'' f ′′ on the right will give us yet another sequence of pumping contexts with the cumulative effect ⟨ b ′ b ⊛ b ′ ′ , c ′ ′ c ⊛ c ′ ⟩ \langle b'b^\circledast b'',c''c^\circledast c'\rangle ⟨ b ′ b ⊛ b ′′ , c ′′ c ⊛ c ′ ⟩ , as illustrated in Figure 8 .
Figure 8. Composing the recovered contexts. Here f n f^n f n denotes n n n compositions of the context f f f .
Since all contexts in this sequence are pumping contexts, they can be composed with each other to generate larger pumping contexts. Hence, we may construct another sequence generated by composing every pair of contexts in the above sequence. Putting the illustrated sequence together with our newly constructed sequence, we obtain the cumulative effect ⟨ ( b ′ b ⊛ b ′ ′ ) 2 , ( c ′ ′ c ⊛ c ′ ) 2 ⟩ \langle(b'b^\circledast b'')^2,(c''c^\circledast c')^2\rangle ⟨( b ′ b ⊛ b ′′ ) 2 , ( c ′′ c ⊛ c ′ ) 2 ⟩ . Repeating this process, where we compose the elements from the i i i th sequence with those of the illustrated sequence and then take the union of the i i i th sequence with the new sequence, generates a cumulative effect of ⟨ ( b ′ b ⊛ b ′ ′ ) i + 1 , ( c ′ ′ c ⊛ c ′ ) i + 1 ⟩ \langle(b'b^\circledast b'')^{i+1},(c''c^\circledast c')^{i+1}\rangle ⟨( b ′ b ⊛ b ′′ ) i + 1 , ( c ′′ c ⊛ c ′ ) i + 1 ⟩ . Aggregating these, we obtain a countable set of contexts, with subsets having cumulative effects of the form ⟨ ( b ′ b ⊛ b ′ ′ ) i , ( c ′ ′ c ⊛ c ′ ) i ⟩ \langle(b'b^\circledast b'')^i,(c''c^\circledast c')^i\rangle ⟨( b ′ b ⊛ b ′′ ) i , ( c ′′ c ⊛ c ′ ) i ⟩ , for every i ∈ N i\in\mathbb{N} i ∈ N . Applying each of these to the tree L T ′ ′ LT'' L T ′′ and summing the resulting root weights, we should at least generate the weight of the root node in the accelerated tree L T ′ ′ ′ LT''' L T ′′′ , illustrated on the right.
Challenge. Such a construction presents an important problem. How do we recover the pumping effect ⟨ b ⊛ , c ⊛ ⟩ \langle b^\circledast,c^\circledast\rangle ⟨ b ⊛ , c ⊛ ⟩ from the accelerated tree L T ′ LT' L T ′ ? A priori, this is not always possible. We solve this problem by syntactically separating the pumping effect ⟨ b ⊛ , c ⊛ ⟩ \langle b^\circledast,c^\circledast\rangle ⟨ b ⊛ , c ⊛ ⟩ . To do this, we introduce them extensions of semirings. Figuratively, we represent the accelerated weights (of the form a ⊛ a^{\circledast} a ⊛ ) as hot expressions, and others as cold expressions (hence our terminology). Cold expressions do not merge (under ⊗ \otimes ⊗ ) with any other elements, but hot expressions merge with other hot expressions.
In Section 5.1, we formalise the notion of thermal extensions. In Section 5.2, we construct an auxiliary sequence, following the earlier discussion.
Thermal Extensions
As mentioned earlier, in order to make combinatorial arguments about our construction, we need a richer syntax for expressions in the pumping semirings. In this subsection, we introduce the notion of thermal extensions of pumping semirings. Recall our fixed semiring S = ⟨ S , ⊕ , ⊗ , ⊛ , 0 , 1 ⟩ S = \langle S, \oplus, \otimes, \circledast, 0, 1\rangle S = ⟨ S , ⊕ , ⊗ , ⊛ , 0 , 1 ⟩ .
The thermal extension of S S S , written as Th S \operatorname{Th}_S Th S , is the set of expressions defined by the following grammar, where a ^ \hat{a} a ^ (resp. a a a ) ranges over the hot-sorted (resp. cold-sorted) set S ^ \hat{S} S ^ (resp. S S S ):
Th S : : = # ∣ a ^ ∣ a ∣ Th S ⋅ Th S ∣ Th S ⋆ . \operatorname{Th}_S ::= \# \mid\hat{a} \mid a \mid\operatorname{Th}_S \cdot\operatorname{Th}_S \mid\operatorname{Th}_S^{\star}. Th S ::= # ∣ a ^ ∣ a ∣ Th S ⋅ Th S ∣ Th S ⋆ .
where # \# # is a special symbol not in S S S . Intuitively, expressions over S ^ \hat{S} S ^ denote hot expressions, and those over S S S denote cold expressions. The size of an expression is defined by:
size ( # ) = size ( a ) = size ( a ^ ) = 0 , size ( x ⋅ y ) = 1 + size ( x ) + size ( y ) , size ( x ⋆ ) = 1 + size ( x ) , \operatorname{size}(\#) = \operatorname{size}(a) = \operatorname{size}(\hat{a}) = 0,\qquad\operatorname{size}(x \cdot y) = 1 + \operatorname{size}(x) + \operatorname{size}(y),\qquad\operatorname{size}(x^{\star}) = 1 + \operatorname{size}(x), size ( # ) = size ( a ) = size ( a ^ ) = 0 , size ( x ⋅ y ) = 1 + size ( x ) + size ( y ) , size ( x ⋆ ) = 1 + size ( x ) ,
where x ∈ Th S x \in\operatorname{Th}_S x ∈ Th S . We define the forgetful map fgt : Th S → S \operatorname{fgt} : \operatorname{Th}_S \to S fgt : Th S → S such that
fgt ( # ) = 1 , fgt ( a ^ ) = a , fgt ( a ) = a , fgt ( x ⋅ y ) = fgt ( x ) ⊗ fgt ( y ) , fgt ( x ⋆ ) = fgt ( x ) ⊛ \operatorname{fgt}(\#) = 1,\qquad\operatorname{fgt}(\hat{a}) = a,\qquad\operatorname{fgt}(a) = a,\qquad\operatorname{fgt}(x \cdot y) = \operatorname{fgt}(x) \otimes\operatorname{fgt}(y),\qquad\operatorname{fgt}(x^{\star}) = \operatorname{fgt}(x)^{\circledast} fgt ( # ) = 1 , fgt ( a ^ ) = a , fgt ( a ) = a , fgt ( x ⋅ y ) = fgt ( x ) ⊗ fgt ( y ) , fgt ( x ⋆ ) = fgt ( x ) ⊛
where a ∈ S a \in S a ∈ S , and x , y ∈ Th S x,y \in\operatorname{Th}_S x , y ∈ Th S . Intuitively, fgt ( x ) \operatorname{fgt}(x) fgt ( x ) evaluates x x x as per the semantics of S S S .
Now consider the equivalence relation ≡ \equiv ≡ defined as follows:
# ⋅ # ≡ # , # ⋅ x ≡ x ≡ x ⋅ # , x ⋅ ( y ⋅ z ) ≡ ( x ⋅ y ) ⋅ z , x ^ ⋅ y ^ ≡ fgt ( x ⋅ y ) ^ , x ⋆ ≡ fgt ( x ) ⊛ ^ . (1) \# \cdot\# \equiv\#, \qquad\# \cdot x \equiv x \equiv x \cdot\#, \qquad x \cdot(y \cdot z) \equiv(x \cdot y) \cdot z, \qquad\hat{x} \cdot\hat{y} \equiv\widehat{\operatorname{fgt}(x \cdot y)}, \qquad x^{\star} \equiv\widehat{\operatorname{fgt}(x)^{\circledast}}. \tag*{(1)} # ⋅ # ≡ # , # ⋅ x ≡ x ≡ x ⋅ # , x ⋅ ( y ⋅ z ) ≡ ( x ⋅ y ) ⋅ z , x ^ ⋅ y ^ ≡ fgt ( x ⋅ y ) , x ⋆ ≡ fgt ( x ) ⊛ . (1)
Note that the relation imposes associativity on the concatenation operator “⋅ \cdot ⋅ ”. While # \# # acts as the identity for S S S , it acts as a separator for elements in S ^ \hat{S} S ^ . Moreover, two elements can never merge under the equivalence if both are in S S S , or if one is in S S S and the other in S ^ \hat{S} S ^ . We say that an expression x x x is in normal form iff for every y ∈ Th S y \in\operatorname{Th}_S y ∈ Th S it holds that
x ≡ y ⟹ size ( x ) ≤ size ( y ) . x \equiv y \Longrightarrow\operatorname{size}(x) \le\operatorname{size}(y). x ≡ y ⟹ size ( x ) ≤ size ( y ) .
The following lemma follows by structural induction:
Lemma 5.2. If x ∈ Th S x \in\operatorname{Th}_S x ∈ Th S is in normal form , then x x x does not contain a subexpression of the form x ⋆ x^{\star} x ⋆ .
Due to the associativity of “⋅ \cdot ⋅ ”, we can thus represent every normal expression as a word in ( S ^ ∪ S ∪ { # } ) + (\hat{S} \cup S \cup\{\#\})^{+} ( S ^ ∪ S ∪ { # } ) + , and the size size ( x ) \operatorname{size}(x) size ( x ) of an expression x x x is equal to ∣ x ∣ − 1 |x| - 1 ∣ x ∣ − 1 . By induction, we prove:
Lemma 5.3. An expression x ∈ Th S x \in\operatorname{Th}_S x ∈ Th S is in normal form iff x x x has an equivalent representation in ( S ∪ S ^ ∪ { # } ) + (S \cup\hat{S} \cup\{\#\})^{+} ( S ∪ S ^ ∪ { # } ) + such that the following conditions hold:
(i) no two neighbouring positions in x x x are labelled in { # } \{\#\} { # } and S S S ,
(ii) no two neighbouring positions in x x x are labelled in S ^ \hat{S} S ^ , and
(iii) no two neighbouring positions in x x x are labelled # . \#. #.
Hence, when concatenating normal expressions, it suffices to check and normalise the connecting edges of the two expressions. As an immediate corollary of the above lemma, we obtain:
Corollary 5.4. Given two normal expressions x , y ∈ Th S x,y \in\operatorname{Th}_S x , y ∈ Th S , we can compute the normal forms for x ⋅ y x \cdot y x ⋅ y and x ⋆ x^{\star} x ⋆ in linear time, assuming that a ⋅ b a \cdot b a ⋅ b and a ⊛ a^{\circledast} a ⊛ are constant-time operations for a , b ∈ S a,b \in S a , b ∈ S .
Example 5.5. Consider the expression 3 ^ ⋅ ( 1 ^ ⋅ 2 ^ ⋅ 1 ) ⋆ ⋅ 2 ⋅ # ⋅ 1 ^ \widehat{3} \cdot(\widehat{1} \cdot\widehat{2} \cdot1)^\star\cdot2 \cdot\# \cdot\widehat{1} 3 ⋅ ( 1 ⋅ 2 ⋅ 1 ) ⋆ ⋅ 2 ⋅ # ⋅ 1 in the thermal extension of the Arctic pumping semiring. It has the following sequence of equivalences leading to its normal form:
( 3 ^ ⋅ ( 1 ^ ⋅ 2 ^ ⋅ 1 ) ⋆ ⋅ 2 ⋅ # ⋅ 1 ^ ) = ( 3 ^ ⋅ ∞ ^ ⋅ 2 ⋅ # ⋅ 1 ^ ) = ( ∞ ^ ⋅ 2 ⋅ # ⋅ 1 ^ ) = ( ∞ ^ ⋅ 2 ⋅ 1 ^ ) . \left(\widehat{3} \cdot(\widehat{1} \cdot\widehat{2} \cdot1)^\star\cdot2 \cdot\# \cdot\widehat{1}\right) = \left(\widehat{3} \cdot\widehat{\infty} \cdot2 \cdot\# \cdot\widehat{1}\right) = \left(\widehat{\infty} \cdot2 \cdot\# \cdot\widehat{1}\right) = \left(\widehat{\infty} \cdot2 \cdot\widehat{1}\right). ( 3 ⋅ ( 1 ⋅ 2 ⋅ 1 ) ⋆ ⋅ 2 ⋅ # ⋅ 1 ) = ( 3 ⋅ ∞ ⋅ 2 ⋅ # ⋅ 1 ) = ( ∞ ⋅ 2 ⋅ # ⋅ 1 ) = ( ∞ ⋅ 2 ⋅ 1 ) . Moreover, given the two normal expressions ∞ ^ ⋅ 2 ⋅ 1 ^ \widehat{\infty} \cdot2 \cdot\widehat{1} ∞ ⋅ 2 ⋅ 1 and # ⋅ 1 ^ \# \cdot\widehat{1} # ⋅ 1 , their composition ∞ ^ ⋅ 2 ⋅ 1 ^ ⋅ # ⋅ 1 ^ \widehat{\infty} \cdot2 \cdot\widehat{1} \cdot\# \cdot\widehat{1} ∞ ⋅ 2 ⋅ 1 ⋅ # ⋅ 1 cannot be reduced any further, since the last element 1 ^ \widehat{1} 1 of the first expression and the first element # \# # of the second do not merge.
Henceforth, we implicitly assume that expressions of the form x ⋅ y x \cdot y x ⋅ y and x ⋆ x^\star x ⋆ are reduced to their normal forms in ( S ^ ∪ S ∪ { # } ) ⋆ (\widehat{S} \cup S \cup\{\#\})^\star ( S ∪ S ∪ { # } ) ⋆ , whenever x , y ∈ ( S ^ ∪ S ∪ { # } ) ⋆ x,y \in(\widehat{S} \cup S \cup\{\#\})^\star x , y ∈ ( S ∪ S ∪ { # } ) ⋆ are in normal forms.
Computing Quantitative Reachability
We are now ready to prove Theorem 3.5. Essentially, we formalise the construction discussed at the beginning of this section. Let C T h C_{\mathrm{Th}} C Th be the set of all tuples ⟨ ⟨ p , q ⟩ , x ⟩ ∈ ( Q × Q ) × T h S \langle\langle p,q\rangle,x\rangle\in(Q \times Q) \times\mathrm{ThS} ⟨⟨ p , q ⟩ , x ⟩ ∈ ( Q × Q ) × ThS , where x x x is assumed to be in normal form. Analogously, we write s t ( ⟨ ⟨ p , q ⟩ , x ⟩ ) st(\langle\langle p,q\rangle,x\rangle) s t (⟨⟨ p , q ⟩ , x ⟩) to denote ⟨ p , q ⟩ \langle p,q\rangle ⟨ p , q ⟩ , and ⟦ ⟨ ⟨ p , q ⟩ , x ⟩ ⟧ \llbracket\langle\langle p,q\rangle,x\rangle\rrbracket [ [ ⟨⟨ p , q ⟩ , x ⟩ ] ] to denote x x x . By convention, we assume x ∈ T h S x \in\mathrm{ThS} x ∈ ThS to be a normal expression unless specified otherwise. Given a labelled tree ⟨ T , σ ⟩ ∈ F T r e e ( C T h ) \langle T,\sigma\rangle\in\mathrm{FTree}(C_{\mathrm{Th}}) ⟨ T , σ ⟩ ∈ FTree ( C Th ) , its canonical image in F T r e e ( C ) \mathrm{FTree}(C) FTree ( C ) is ⟨ T , f g t σ ⟩ \langle T,\mathrm{fgt}_{\sigma}\rangle ⟨ T , fgt σ ⟩ , where f g t σ ( t ) = ⟨ s t ( σ ( t ) ) , f g t ⟦ σ ( t ) ⟧ ⟩ \mathrm{fgt}_{\sigma}(t)=\langle st(\sigma(t)),\mathrm{fgt}\llbracket\sigma(t)\rrbracket\rangle fgt σ ( t ) = ⟨ s t ( σ ( t )) , fgt [ [ σ ( t ) ] ] ⟩ for t ∈ T t \in T t ∈ T .
Construction. Formally, we construct an auxiliary sequence i ↦ H i i \mapsto H_i i ↦ H i of C T h C_{\mathrm{Th}} C Th -labelled trees, instead of C C C -labelled trees. The desired sequence is obtained as their canonical image in F T r e e ( C ) \mathrm{FTree}(C) FTree ( C ) given by J : i ↦ J i J:i \mapsto J_i J : i ↦ J i where
J i : = { ⟨ T , f g t σ ⟩ ∣ ⟨ T , σ ⟩ ∈ H i } ⊆ F T r e e ( C ) . J_i := \{\langle T,\mathrm{fgt}_{\sigma}\rangle\mid\langle T,\sigma\rangle\in H_i\} \subseteq\mathrm{FTree}(C). J i := {⟨ T , fgt σ ⟩ ∣ ⟨ T , σ ⟩ ∈ H i } ⊆ FTree ( C ) .
Let H 0 : = { ⟨ { ϵ } , σ ⟩ ∣ p ∈ Q , σ ( ϵ ) = ⟨ ⟨ p , p ⟩ , # ⟩ } H_0 := \{\langle\{\epsilon\},\sigma\rangle\mid p \in Q,\ \sigma(\epsilon)=\langle\langle p,p\rangle,\#\rangle\} H 0 := {⟨{ ϵ } , σ ⟩ ∣ p ∈ Q , σ ( ϵ ) = ⟨⟨ p , p ⟩ , # ⟩} . We inductively define H i : = H i − 1 ∪ H i , v ∪ H i , h H_i := H_{i-1} \cup H_{i,v} \cup H_{i,h} H i := H i − 1 ∪ H i , v ∪ H i , h , for i ∈ N i \in\mathbb{N} i ∈ N . The sets H i , v H_{i,v} H i , v and H i , h H_{i,h} H i , h are defined as follows:
Computev ( H i − 1 ) _v(H_{i-1}) v ( H i − 1 ) . Let ⟨ δ 1 , δ 2 ⟩ ∈ T r a n s 2 \langle\delta_1,\delta_2\rangle\in\mathrm{Trans}^2 ⟨ δ 1 , δ 2 ⟩ ∈ Trans 2 , and ⟨ T , σ ⟩ ∈ H i − 1 \langle T,\sigma\rangle\in H_{i-1} ⟨ T , σ ⟩ ∈ H i − 1 be arbitrary. Assume ν C ( ⟨ δ 1 , δ 2 ⟩ , ⟨ T , f g t σ ⟩ ) = ⟨ T ′ ′ , σ ′ ′ ⟩ ∈ F T r e e ( C ) \nu_C(\langle\delta_1,\delta_2\rangle,\langle T,\mathrm{fgt}_{\sigma}\rangle)=\langle T^{\prime\prime},\sigma^{\prime\prime}\rangle\in\mathrm{FTree}(C) ν C (⟨ δ 1 , δ 2 ⟩ , ⟨ T , fgt σ ⟩) = ⟨ T ′′ , σ ′′ ⟩ ∈ FTree ( C ) . Then H i , v H_{i,v} H i , v is the set of all ⟨ T ′ , σ ′ ⟩ ∈ F T r e e ( C T h ) \langle T',\sigma'\rangle\in\mathrm{FTree}(C_{\mathrm{Th}}) ⟨ T ′ , σ ′ ⟩ ∈ FTree ( C Th ) such that:
(V1) if there exists t ∈ T t \in T t ∈ T such that s t ( σ ′ ′ ( ϵ ) ) = s t ( σ ( t ) ) st(\sigma^{\prime\prime}(\epsilon))=st(\sigma(t)) s t ( σ ′′ ( ϵ )) = s t ( σ ( t )) , and w t ( δ 1 ) ⋅ # ⋅ ⟦ σ ( ϵ ) ⟧ ⋅ # ⋅ w t ( δ 2 ) = ⟦ σ ( t ) ⟧ \mathrm{wt}(\delta_1)\cdot\#\cdot\llbracket\sigma(\epsilon)\rrbracket\cdot\#\cdot\mathrm{wt}(\delta_2)=\llbracket\sigma(t)\rrbracket wt ( δ 1 ) ⋅ # ⋅ [ [ σ ( ϵ ) ] ] ⋅ # ⋅ wt ( δ 2 ) = [ [ σ ( t ) ] ] , then ⟨ T ′ , σ ′ ⟩ = t − 1 ⟨ T , σ ⟩ \langle T',\sigma'\rangle=t^{-1}\langle T,\sigma\rangle ⟨ T ′ , σ ′ ⟩ = t − 1 ⟨ T , σ ⟩ ,
(V2) else, if some t ∈ T t \in T t ∈ T is the shortest node with s t ( σ ( t ) ) = s t ( σ ′ ′ ( ϵ ) ) st(\sigma(t))=st(\sigma^{\prime\prime}(\epsilon)) s t ( σ ( t )) = s t ( σ ′′ ( ϵ )) such that w t ( δ 1 ) ⋅ # ⋅ ⟦ σ ( ϵ ) ⟧ ⋅ # ⋅ w t ( δ 2 ) = y 1 ⋅ ⟦ σ ( t ) ⟧ ⋅ y 2 \mathrm{wt}(\delta_1)\cdot\#\cdot\llbracket\sigma(\epsilon)\rrbracket\cdot\#\cdot\mathrm{wt}(\delta_2)=y_1\cdot\llbracket\sigma(t)\rrbracket\cdot y_2 wt ( δ 1 ) ⋅ # ⋅ [ [ σ ( ϵ ) ] ] ⋅ # ⋅ wt ( δ 2 ) = y 1 ⋅ [ [ σ ( t ) ] ] ⋅ y 2 , for some y 1 , y 2 ∈ T h S y_1,y_2 \in\mathrm{ThS} y 1 , y 2 ∈ ThS in normal form, and y 1 ≠ # ≠ y 2 y_1\ne\#\ne y_2 y 1 = # = y 2 , then T ′ = t − 1 T T'=t^{-1}T T ′ = t − 1 T , σ ′ ( t ′ ) = σ ( t ⋅ t ′ ) \sigma'(t')=\sigma(t\cdot t') σ ′ ( t ′ ) = σ ( t ⋅ t ′ ) for t ′ ∈ T ′ ∖ { ϵ } t'\in T'\setminus\{\epsilon\} t ′ ∈ T ′ ∖ { ϵ } , and σ ′ ( ϵ ) = ⟨ s t ( σ ′ ′ ( ϵ ) ) , z ⟩ \sigma'(\epsilon)=\langle st(\sigma^{\prime\prime}(\epsilon)),z\rangle σ ′ ( ϵ ) = ⟨ s t ( σ ′′ ( ϵ )) , z ⟩ , where
z = { ( y 1 ⋅ l ^ ) ⋆ ⋅ x ⋅ ( r ^ ⋅ y 2 ) ⋆ , if ⟦ σ ( t ) ⟧ is of the form l ^ ⋅ x ⋅ r ^ , y 1 ⋆ ⋅ ⟦ σ ( t ) ⟧ ⋅ y 2 ⋆ , otherwise , z=
\begin{cases}
(y_1\cdot\widehat{l})^\star\cdot x\cdot(\widehat{r}\cdot y_2)^\star, & \text{if }\llbracket\sigma(t)\rrbracket\text{ is of the form }\widehat{l}\cdot x\cdot\widehat{r},\\
y_1^\star\cdot\llbracket\sigma(t)\rrbracket\cdot y_2^\star, & \text{otherwise},
\end{cases} z = { ( y 1 ⋅ l ) ⋆ ⋅ x ⋅ ( r ⋅ y 2 ) ⋆ , y 1 ⋆ ⋅ [ [ σ ( t ) ] ] ⋅ y 2 ⋆ , if [ [ σ ( t ) ] ] is of the form l ⋅ x ⋅ r , otherwise , (V3) otherwise, T ′ = 1 ⋅ T ∪ { ϵ } T'=1\cdot T\cup\{\epsilon\} T ′ = 1 ⋅ T ∪ { ϵ } , σ ′ ( ϵ ) = ⟨ s t ( σ ′ ′ ( ϵ ) ) , w t ( δ 1 ) ⋅ # ⋅ ⟦ σ ( ϵ ) ⟧ ⋅ # ⋅ w t ( δ 2 ) ⟩ \sigma'(\epsilon)=\langle st(\sigma^{\prime\prime}(\epsilon)),\mathrm{wt}(\delta_1)\cdot\#\cdot\llbracket\sigma(\epsilon)\rrbracket\cdot\#\cdot\mathrm{wt}(\delta_2)\rangle σ ′ ( ϵ ) = ⟨ s t ( σ ′′ ( ϵ )) , wt ( δ 1 ) ⋅ # ⋅ [ [ σ ( ϵ ) ] ] ⋅ # ⋅ wt ( δ 2 )⟩ , and σ ′ ( 1 ⋅ t ) = σ ( t ) \sigma'(1\cdot t)=\sigma(t) σ ′ ( 1 ⋅ t ) = σ ( t ) for t ∈ T t\in T t ∈ T .
Computeh _h h (H i − 1 H_{i-1} H i − 1 ). Let ⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩ ∈ H i − 1 \langle T_1,\sigma_1\rangle,\langle T_2,\sigma_2\rangle\in H_{i-1} ⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩ ∈ H i − 1 . Let σ i ( ϵ ) = ⟨ ⟨ p i , q i ⟩ , x i ⟩ \sigma_i(\epsilon)=\langle\langle p_i,q_i\rangle,x_i\rangle σ i ( ϵ ) = ⟨⟨ p i , q i ⟩ , x i ⟩ for every i ∈ [ 2 ] i\in[2] i ∈ [ 2 ] , and h C ( ⟨ T 1 , fgt σ 1 ⟩ , ⟨ T 2 , fgt σ 2 ⟩ ) = ⟨ T ′ ′ , σ ′ ′ ⟩ h_C(\langle T_1,\operatorname{fgt}\sigma_1\rangle,\langle T_2,\operatorname{fgt}\sigma_2\rangle)=\langle T^{\prime\prime},\sigma^{\prime\prime}\rangle h C (⟨ T 1 , fgt σ 1 ⟩ , ⟨ T 2 , fgt σ 2 ⟩) = ⟨ T ′′ , σ ′′ ⟩ with σ ′ ′ ( ϵ ) = ⟨ ⟨ p ′ , q ′ ⟩ , a ⟩ \sigma^{\prime\prime}(\epsilon)=\langle\langle p^\prime,q^\prime\rangle,a\rangle σ ′′ ( ϵ ) = ⟨⟨ p ′ , q ′ ⟩ , a ⟩ . Then H i , h H_{i,h} H i , h is the set of all ⟨ T ′ , σ ′ ⟩ ∈ FTree ( C T h ) \langle T^\prime,\sigma^\prime\rangle\in\operatorname{FTree}(CTh) ⟨ T ′ , σ ′ ⟩ ∈ FTree ( C T h ) such that:
(H1) if there exists t ∈ T j t\in T_j t ∈ T j , for some j ∈ [ 2 ] j\in[2] j ∈ [ 2 ] , such that s t ( σ ′ ′ ( ϵ ) ) = s t ( σ j ( t ) ) st(\sigma^{\prime\prime}(\epsilon))=st(\sigma_j(t)) s t ( σ ′′ ( ϵ )) = s t ( σ j ( t )) , and [ [ σ 1 ( ϵ ) ] ] ⋅ # ⋅ [ [ σ 2 ( ϵ ) ] ] = σ j ( t ) [[\sigma_1(\epsilon)]]\cdot\#\cdot[[\sigma_2(\epsilon)]]=\sigma_j(t) [[ σ 1 ( ϵ )]] ⋅ # ⋅ [[ σ 2 ( ϵ )]] = σ j ( t ) , then ⟨ T ′ , σ ′ ⟩ = t − 1 ⟨ T j , σ j ⟩ \langle T^\prime,\sigma^\prime\rangle=t^{-1}\langle T_j,\sigma_j\rangle ⟨ T ′ , σ ′ ⟩ = t − 1 ⟨ T j , σ j ⟩ ,
(H2) else, for j ∈ [ 2 ] j\in[2] j ∈ [ 2 ] , if some t ∈ T j t\in T_j t ∈ T j is the shortest node with s t ( σ j ( t ) ) = s t ( σ ′ ′ ( ϵ ) ) st(\sigma_j(t))=st(\sigma^{\prime\prime}(\epsilon)) s t ( σ j ( t )) = s t ( σ ′′ ( ϵ )) such that [ [ σ 1 ( ϵ ) ] ] ⋅ # ⋅ [ [ σ 2 ( ϵ ) ] ] = y 1 ⋅ [ [ σ j ( t ) ] ] ⋅ y 2 [[\sigma_1(\epsilon)]]\cdot\#\cdot[[\sigma_2(\epsilon)]]=y_1\cdot[\![\sigma_j(t)]\!]\cdot y_2 [[ σ 1 ( ϵ )]] ⋅ # ⋅ [[ σ 2 ( ϵ )]] = y 1 ⋅ [ [ σ j ( t )] ] ⋅ y 2 , for some y 1 , y 2 ∈ T h S y_1,y_2\in\mathrm{ThS} y 1 , y 2 ∈ ThS in normal form, and y 1 ≠ # ≠ y 2 y_1\ne\#\ne y_2 y 1 = # = y 2 , then T ′ = t − 1 T j T^\prime=t^{-1}T_j T ′ = t − 1 T j , σ ′ ( t ′ ) = σ j ( t ⋅ t ′ ) \sigma^\prime(t^\prime)=\sigma_j(t\cdot t^\prime) σ ′ ( t ′ ) = σ j ( t ⋅ t ′ ) for t ′ ∈ T ′ ∖ { ϵ } t^\prime\in T^\prime\setminus\{\epsilon\} t ′ ∈ T ′ ∖ { ϵ } , and σ ′ ( ϵ ) = ⟨ s t ( σ ′ ′ ( ϵ ) ) , z ⟩ \sigma^\prime(\epsilon)=\langle st(\sigma^{\prime\prime}(\epsilon)),z\rangle σ ′ ( ϵ ) = ⟨ s t ( σ ′′ ( ϵ )) , z ⟩ , where
z = { ( y 1 ⋅ l ^ ) ⋆ ⋅ x ⋅ ( r ^ ⋅ y 2 ) ⋆ , if σ j ( t ) is of the form l ^ ⋅ x ⋅ r ^ , y 1 ⋆ ⋅ [ [ σ j ( t ) ] ] ⋅ y 2 ⋆ , otherwise, z=\begin{cases}
(y_1\cdot\hat{l})^\star\cdot x\cdot(\hat{r}\cdot y_2)^\star,&\text{if }\sigma_j(t)\text{ is of the form }\hat{l}\cdot x\cdot\hat{r},\\
y_1^\star\cdot[\![\sigma_j(t)]\!]\cdot y_2^\star,&\text{otherwise,}
\end{cases} z = { ( y 1 ⋅ l ^ ) ⋆ ⋅ x ⋅ ( r ^ ⋅ y 2 ) ⋆ , y 1 ⋆ ⋅ [ [ σ j ( t )] ] ⋅ y 2 ⋆ , if σ j ( t ) is of the form l ^ ⋅ x ⋅ r ^ , otherwise, (H3) otherwise, T ′ = 1 ⋅ T 1 ∪ 2 ⋅ T 2 ∪ { ϵ } T^\prime=1\cdot T_1\cup2\cdot T_2\cup\{\epsilon\} T ′ = 1 ⋅ T 1 ∪ 2 ⋅ T 2 ∪ { ϵ } , σ ′ ( ϵ ) = ⟨ s t ( σ ′ ′ ( ϵ ) ) , [ [ σ 1 ( ϵ ) ] ] ⋅ # ⋅ [ [ σ 2 ( ϵ ) ] ] ⟩ \sigma^\prime(\epsilon)=\langle st(\sigma^{\prime\prime}(\epsilon)),[[\sigma_1(\epsilon)]]\cdot\#\cdot[[\sigma_2(\epsilon)]]\rangle σ ′ ( ϵ ) = ⟨ s t ( σ ′′ ( ϵ )) , [[ σ 1 ( ϵ )]] ⋅ # ⋅ [[ σ 2 ( ϵ )]]⟩ , and σ ′ ( j ⋅ t ) = σ j ( t ) \sigma^\prime(j\cdot t)=\sigma_j(t) σ ′ ( j ⋅ t ) = σ j ( t ) for j ∈ [ 2 ] j\in[2] j ∈ [ 2 ] , and t ∈ T j t\in T_j t ∈ T j .
Note that we can effectively compute the normal expressions y 1 y_1 y 1 , and y 2 y_2 y 2 in steps (V2), and (H2). We can prove this using induction via a case-by-case analysis.
Lemma 5.6. For every ⟨ T , σ ⟩ ∈ H i \langle T,\sigma\rangle\in H_i ⟨ T , σ ⟩ ∈ H i where i ∈ N i\in\mathbb{N} i ∈ N , and nodes t 1 , t 2 ∈ T t_1,t_2\in T t 1 , t 2 ∈ T , where σ ( t j ) = ⟨ ⟨ p j , q j ⟩ , x j ⟩ \sigma(t_j)=\langle\langle p_j,q_j\rangle,x_j\rangle σ ( t j ) = ⟨⟨ p j , q j ⟩ , x j ⟩ for j ∈ [ 2 ] j\in[2] j ∈ [ 2 ] , it holds that t 1 ⪯ t 2 ⟹ y 1 ⋅ x 2 ⋅ y 2 = x 1 t_1\preceq t_2\Longrightarrow y_1\cdot x_2\cdot y_2=x_1 t 1 ⪯ t 2 ⟹ y 1 ⋅ x 2 ⋅ y 2 = x 1 , for some effectively computable y 1 , y 2 ∈ T h S y_1,y_2\in\mathrm{ThS} y 1 , y 2 ∈ ThS .
Let v C T h ( ⟨ δ 1 , δ 2 ⟩ , ⟨ T , σ ⟩ ) v_{CTh}(\langle\delta_1,\delta_2\rangle,\langle T,\sigma\rangle) v C T h (⟨ δ 1 , δ 2 ⟩ , ⟨ T , σ ⟩) (resp. h C T h ( ⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩ ) h_{CTh}(\langle T_1,\sigma_1\rangle,\langle T_2,\sigma_2\rangle) h C T h (⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩) ) denote the tree ⟨ T ′ , σ ′ ⟩ \langle T^\prime,\sigma^\prime\rangle ⟨ T ′ , σ ′ ⟩ constructed in step (V3) (resp. (H3)) if v C ( ⟨ δ 1 , δ 2 ⟩ , ⟨ T , fgt σ ⟩ ) ≠ ⊥ v_C(\langle\delta_1,\delta_2\rangle,\langle T,\operatorname{fgt}\sigma\rangle)\ne\bot v C (⟨ δ 1 , δ 2 ⟩ , ⟨ T , fgt σ ⟩) = ⊥ (resp. h C ( ⟨ T 1 , fgt σ 1 ⟩ , ⟨ T 2 , fgt σ 2 ⟩ ) ≠ ⊥ h_C(\langle T_1,\operatorname{fgt}\sigma_1\rangle,\langle T_2,\operatorname{fgt}\sigma_2\rangle)\ne\bot h C (⟨ T 1 , fgt σ 1 ⟩ , ⟨ T 2 , fgt σ 2 ⟩) = ⊥ ), and ⊥ \bot ⊥ otherwise. Intuitively, the trees ⟨ T ′ ′ , σ ′ ′ ⟩ \langle T^{\prime\prime},\sigma^{\prime\prime}\rangle ⟨ T ′′ , σ ′′ ⟩ are of the form ⟨ T ′ ′ , fgt σ ′ ′ ′ ⟩ \langle T^{\prime\prime},\operatorname{fgt}\sigma^{\prime\prime\prime}\rangle ⟨ T ′′ , fgt σ ′′′ ⟩ where v C T h ( ⟨ δ 1 , δ 2 ⟩ , ⟨ T , σ ⟩ ) = ⟨ T ′ ′ , σ ′ ′ ′ ⟩ v_{CTh}(\langle\delta_1,\delta_2\rangle,\langle T,\sigma\rangle)=\langle T^{\prime\prime},\sigma^{\prime\prime\prime}\rangle v C T h (⟨ δ 1 , δ 2 ⟩ , ⟨ T , σ ⟩) = ⟨ T ′′ , σ ′′′ ⟩ (resp. h C T h ( ⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩ ) = ⟨ T ′ ′ , σ ′ ′ ′ ⟩ h_{CTh}(\langle T_1,\sigma_1\rangle,\langle T_2,\sigma_2\rangle)=\langle T^{\prime\prime},\sigma^{\prime\prime\prime}\rangle h C T h (⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩) = ⟨ T ′′ , σ ′′′ ⟩ ). Moreover, the set H i H_i H i is subtree-closed for every i ∈ N i\in\mathbb{N} i ∈ N . The proof is by induction. We state this as follows:
Lemma 5.7. For every ⟨ T , σ ⟩ ∈ H i + 1 \langle T,\sigma\rangle\in H_{i+1} ⟨ T , σ ⟩ ∈ H i + 1 where i ∈ N i\in\mathbb{N} i ∈ N , and node t ∈ T t\in T t ∈ T , if t ≠ ϵ t\ne\epsilon t = ϵ , then t − 1 ⟨ T , σ ⟩ ∈ H i t^{-1}\langle T,\sigma\rangle\in H_i t − 1 ⟨ T , σ ⟩ ∈ H i .
Correctness and Termination. By Lemma 5.1, it suffices to show that properties (P1), (P2), and (P3) hold for the sequence J J J . Termination, i.e., (P1), follows since the trees in ⋃ i ∈ N H i \bigcup_{i\in\mathbb{N}}H_i ⋃ i ∈ N H i have height at most ∣ Q ∣ 2 |Q|^2 ∣ Q ∣ 2 , and, by (C3), only finitely many labels can occur at each height. Our proofs contain a rigorous case-by-case analysis and are deferred to Section D. For completeness, we describe the full algorithm computing the fixpoint of the sequence J J J , further projected onto the root label weights, in Section E. This concludes our proof of Theorem 3.5 .
Complexity. Our termination argument is by contradiction and yields no bound on the number of iterations, but it can be made quantitative (cf. Section D.3). The weight domain enters through a single parameter, namely the number
K : = ∣ { ∗ ( [ [ wt ( Trans ) ] ] S ) } ∣ K:=\left|\bigl\{\mathord{\ast}([\![\operatorname{wt}(\operatorname{Trans})]\!]_S)\bigr\}\right| K := { ∗ ([ [ wt ( Trans )] ] S ) }
of distinct ∗ \mathord{\ast} ∗ -closures generated by the transition weights, where [ [ wt ( Trans ) ] ] S ⊆ S [\![\operatorname{wt}(\operatorname{Trans})]\!]_S\subseteq S [ [ wt ( Trans )] ] S ⊆ S is the smallest set containing wt ( Trans ) \operatorname{wt}(\operatorname{Trans}) wt ( Trans ) that is closed under ⊕ \oplus ⊕ , ⊗ \otimes ⊗ , and ∗ \mathord{\ast} ∗ , and \mathord{\ast}(X):=\{x^\mathord{\ast}\mid x\in X\} for X ⊆ S X\subseteq S X ⊆ S . It is finite by (C3), since ∗ ( [ [ wt ( Trans ) ] ] S ) ⊆ ∗ ( S ) \mathord{\ast}([\![\operatorname{wt}(\operatorname{Trans})]\!]_S)\subseteq\mathord{\ast}(S) ∗ ([ [ wt ( Trans )] ] S ) ⊆ ∗ ( S ) .
Proposition 5.8. The sequence i ↦ H i i\mapsto H_i i ↦ H i reaches its fixpoint after at most ( ∣ Trans ∣ + K + 1 ) 2 O ( ∣ Q ∣ 2 ) (|\operatorname{Trans}|+K+1)^{2O(|Q|^2)} ( ∣ Trans ∣ + K + 1 ) 2 O ( ∣ Q ∣ 2 ) iterations.
Our procedure is therefore doubly exponential in the number of control states of P \mathcal{P} P , with the weight domain contributing only to the base. For most of the pumping semirings in Figure 2, the operator ⊛ \circledast ⊛ is constant, so that K = 1 K = 1 K = 1 ; for the arctic and probabilistic-union pumping semirings, K = 2 K = 2 K = 2 . The exception is the semiring of downward-closed languages of § 6.2 , where e ⊛ d c = ∥ e ∥ ∗ e^{\circledast_{\mathrm{dc}}} = \lVert e \rVert^{*} e ⊛ dc = ∥ e ∥ ∗ ranges over the subsets of T r a n s \mathrm{Trans} Trans , and hence K ≤ 2 ∣ T r a n s ∣ K \leq2^{|\mathrm{Trans}|} K ≤ 2 ∣ Trans ∣ . This is precisely the exponential blow-up incurred by the classical downward closure construction [14 ] . Note that our bound is not tight. The second exponential stems entirely from step (H3), which concatenates both its children’s labels, and already for S = B \mathcal{S} = \mathbb{B} S = B , the bound is far from the known polynomial one [10 ] . Whether the label sizes stay polynomial in ∣ Q ∣ |Q| ∣ Q ∣ , which would make our procedure singly exponential, remains open.
Uniform Computation of Language Closures
In this section, we show that one can compute the upward and downward closures of context-free languages as instances of our framework. In § 7 , we will explain how this allows us to quantitatively verify networks of wPDSs.
Upward Closures
Let us start with the case of upward closures. By Higman’s lemma [24 ] , every upward-closed set of words has finitely many ⊑ \sqsubseteq ⊑ -minimal elements. Thus, every upward-closed set can be uniquely represented by a finite set of mutually incomparable words.
Let T r a n s u c \mathrm{Trans}_{\mathrm{uc}} Trans uc be the set of all finite subsets of mutually incomparable words in ⟨ T r a n s ∗ , ⊑ ⟩ \langle\mathrm{Trans}^{*}, \sqsubseteq\rangle ⟨ Trans ∗ , ⊑ ⟩ . Every set L ∈ T r a n s u c L \in\mathrm{Trans}_{\mathrm{uc}} L ∈ Trans uc defines the upward-closed set ⋃ x ∈ L { x } ↑ \bigcup_{x \in L} \{x\}\mathord{\uparrow} ⋃ x ∈ L { x } ↑ . It follows that every upward-closed set can be represented by an element in T r a n s u c \mathrm{Trans}_{\mathrm{uc}} Trans uc . Let us show that this set forms a pumping semiring.
Consider the tuple S T r a n s u c = ⟨ T r a n s u c , + u c , ⋅ u c , ⊛ u c , ∅ , { ϵ } ⟩ \mathcal{S}_{\mathrm{Trans}_{\mathrm{uc}}} = \langle\mathrm{Trans}_{\mathrm{uc}}, +_{\mathrm{uc}}, \cdot_{\mathrm{uc}}, \circledast_{\mathrm{uc}}, \varnothing, \{\epsilon\} \rangle S Trans uc = ⟨ Trans uc , + uc , ⋅ uc , ⊛ uc , ∅ , { ϵ }⟩ where:
L 1 + u c L 2 : = { u ∈ L 1 ∪ L 2 ∣ ∀ v ∈ L 1 ∪ L 2 . v ⊑ u ⇒ v = u } , L_1 +_{\mathrm{uc}} L_2 := \{u \in L_1 \cup L_2 \mid\forall v \in L_1 \cup L_2.\ v \sqsubseteq u \Rightarrow v = u\}, L 1 + uc L 2 := { u ∈ L 1 ∪ L 2 ∣ ∀ v ∈ L 1 ∪ L 2 . v ⊑ u ⇒ v = u } ,
L 1 ⋅ u c L 2 : = { u 1 u 2 ∣ u 1 ∈ L 1 , u 2 ∈ L 2 } , L_1 \cdot_{\mathrm{uc}} L_2 := \{u_1u_2 \mid u_1 \in L_1, u_2 \in L_2\}, L 1 ⋅ uc L 2 := { u 1 u 2 ∣ u 1 ∈ L 1 , u 2 ∈ L 2 } ,
L 1 ⊛ u c : = { ϵ } , L_1^{\circledast_{\mathrm{uc}}} := \{\epsilon\}, L 1 ⊛ uc := { ϵ } ,
for arbitrary L 1 , L 2 ∈ T r a n s u c L_1, L_2 \in\mathrm{Trans}_{\mathrm{uc}} L 1 , L 2 ∈ Trans uc . Observe that summation maintains the mutual incomparability of the summands. For instance, { δ 1 δ 2 δ 3 } + u c { δ 1 δ 3 } = { δ 1 δ 3 } \{\delta_1\delta_2\delta_3\} +_{\mathrm{uc}} \{\delta_1\delta_3\} = \{\delta_1\delta_3\} { δ 1 δ 2 δ 3 } + uc { δ 1 δ 3 } = { δ 1 δ 3 } , for δ 1 , δ 2 , δ 3 ∈ T r a n s \delta_1, \delta_2, \delta_3 \in\mathrm{Trans} δ 1 , δ 2 , δ 3 ∈ Trans , since δ 1 δ 3 ⊑ δ 1 δ 2 δ 3 \delta_1\delta_3 \sqsubseteq\delta_1\delta_2\delta_3 δ 1 δ 3 ⊑ δ 1 δ 2 δ 3 .
One can check that the conditions (C1)–(C3) hold. In particular, property (C1) states that, given sets L 1 , L 2 , L 3 ∈ T r a n s u c L_1, L_2, L_3 \in\mathrm{Trans}_{\mathrm{uc}} L 1 , L 2 , L 3 ∈ Trans uc , the ⊑ \sqsubseteq ⊑ -minimal subset of the (potentially infinite) set { L 1 n L 2 L 3 n ∣ n ∈ N } \{L_1^{n}L_2L_3^{n} \mid n \in\mathbb{N}\} { L 1 n L 2 L 3 n ∣ n ∈ N } is L 2 L_2 L 2 , making pumping behaviour redundant. Hence, S T r a n s u c \mathcal{S}_{\mathrm{Trans}_{\mathrm{uc}}} S Trans uc is a pumping semiring.
Consider the PDS P \mathcal{P} P , and let c , c ′ ∈ C o n f i g ( P ) c, c' \in\mathrm{Config}(\mathcal{P}) c , c ′ ∈ Config ( P ) be arbitrary configurations. We will define the wPDS ⟨ P , S T r a n s u c , w t u c ⟩ \langle\mathcal{P}, \mathcal{S}_{\mathrm{Trans}_{\mathrm{uc}}}, \mathrm{wt}_{\mathrm{uc}} \rangle ⟨ P , S Trans uc , wt uc ⟩ such that
P a t h s ( c , c ′ ) ↑ = w t u c ⟦ c , c ′ ⟧ ↑ . (2) \mathrm{Paths}(c,c')\mathord{\uparrow} = \mathrm{wt}_{\mathrm{uc}}\llbracket c,c'\rrbracket\mathord{\uparrow}. \tag*{(2)} Paths ( c , c ′ ) ↑ = wt uc [ [ c , c ′ ] ] ↑ . (2)
Using Corollary 3.6, we can compute a finite set J ⊆ T r a n s u c J \subseteq\mathrm{Trans}_{\mathrm{uc}} J ⊆ Trans uc of finite sets of mutually incomparable elements in T r a n s ∗ \mathrm{Trans}^{*} Trans ∗ , such that ⨁ L ∈ J L = w t u c ⟦ c , c ′ ⟧ \bigoplus_{L \in J} L = \mathrm{wt}_{\mathrm{uc}}\llbracket c,c'\rrbracket ⨁ L ∈ J L = wt uc [ [ c , c ′ ] ] .
We define the weight function w t u c : T r a n s → T r a n s u c \mathrm{wt}_{\mathrm{uc}} : \mathrm{Trans} \to\mathrm{Trans}_{\mathrm{uc}} wt uc : Trans → Trans uc such that δ ↦ { δ } \delta\mapsto\{\delta\} δ ↦ { δ } , for arbitrary δ ∈ T r a n s \delta\in\mathrm{Trans} δ ∈ Trans , intuitively mapping every transition δ \delta δ to its upward closure { δ } ↑ \{\delta\}\mathord{\uparrow} { δ } ↑ . We can prove (2) by induction on the length of the traces in P a t h s ( c , c ′ ) \mathrm{Paths}(c,c') Paths ( c , c ′ ) .
In Figure 9, we illustrate such a translation for the underlying PDS P e x \mathcal{P}_{\mathrm{ex}} P ex defined in Example 2.1. Observe that our construction yields the following increasing (albeit degenerate) sequence of under-approximations of P a t h s ( ⟨ q 1 , γ ⟩ , ⟨ q 2 , ⟩ ) \mathrm{Paths}(\langle q_1,\gamma\rangle,\langle q_2,\rangle) Paths (⟨ q 1 , γ ⟩ , ⟨ q 2 , ⟩) , obtained by applying fgt to every expression of the labels indicated with yellow (in Figure 9b):
{ δ 1 δ 2 } ⊆ { δ 1 δ 2 } ⊆ { δ 1 δ 2 } . \{\delta_1\delta_2\} \subseteq\{\delta_1\delta_2\} \subseteq\{\delta_1\delta_2\}. { δ 1 δ 2 } ⊆ { δ 1 δ 2 } ⊆ { δ 1 δ 2 } .
As a useful side effect, the above algorithm simultaneously yields the set of minimal traces between the configurations c c c and c ′ c' c ′ . Thus, it also serves as a trace generation algorithm.
Figure 9. Let T r a n s e x = { δ 1 , δ 2 , δ 3 } \mathrm{Trans}_{\mathrm{ex}}=\{\delta_1,\delta_2,\delta_3\} Trans ex = { δ 1 , δ 2 , δ 3 } , where δ 1 = ⟨ q 1 , ϵ , a , α , q 1 ⟩ \delta_1=\langle q_1,\epsilon,a,\alpha,q_1\rangle δ 1 = ⟨ q 1 , ϵ , a , α , q 1 ⟩ , δ 2 = ⟨ q 1 , α , a , ϵ , q 2 ⟩ \delta_2=\langle q_1,\alpha,a,\epsilon,q_2\rangle δ 2 = ⟨ q 1 , α , a , ϵ , q 2 ⟩ , and δ 3 = ⟨ q 2 , α , a , ϵ , q 2 ⟩ \delta_3=\langle q_2,\alpha,a,\epsilon,q_2\rangle δ 3 = ⟨ q 2 , α , a , ϵ , q 2 ⟩ . (a) A translation of the PDS P e x P_{\mathrm{ex}} P ex to the wPDS ⟨ P e x , S ( T r a n s e x ) u c , ( w t e x ) u c ⟩ \langle P_{\mathrm{ex}},S(\mathrm{Trans}_{\mathrm{ex}})_{\mathrm{uc}},(w_{\mathrm{tex}})_{\mathrm{uc}}\rangle ⟨ P ex , S ( Trans ex ) uc , ( w tex ) uc ⟩ , and (b) an illustration of our iterative upward closure construction for the wPDS in (a). For each iteration, denoted by iter i i i , we depict the root labels of the trees added in that iteration. The arrows indicate the source root labels used to generate the target root label, and are labelled with the step used for the generation.
Downward Closures
It was shown by Jullien [28 ] (and later rediscovered by Abdulla et al. [1 ] ) that the class of downward-closed languages is precisely captured by the class of simple regular expressions. A simple regular expression (SRE) is a regular expression defined by the following syntax, where u u u ranges over a finite alphabet A A A , and X X X ranges over F ( A ) F(A) F ( A ) :
sre ( A ) : = ∅ ∣ ( ϵ + u ) ∣ X ∗ ∣ sre ( A ) + sre ( A ) ∣ sre ( A ) ⋅ sre ( A ) . \operatorname{sre}(A) := \varnothing\mid(\epsilon+ u) \mid X^* \mid\operatorname{sre}(A) + \operatorname{sre}(A) \mid\operatorname{sre}(A) \cdot\operatorname{sre}(A). sre ( A ) := ∅ ∣ ( ϵ + u ) ∣ X ∗ ∣ sre ( A ) + sre ( A ) ∣ sre ( A ) ⋅ sre ( A ) .
Here, we call the base expressions of the form ( ϵ + u ) (\epsilon+u) ( ϵ + u ) and X ∗ X^* X ∗ atoms. Observe that every atom itself describes a downward-closed language. We write ∣ e ∣ ⊆ A ∗ \lvert e\rvert\subseteq A^* ∣ e ∣ ⊆ A ∗ to denote the semantics of the SRE e ∈ sre ( A ) e\in\operatorname{sre}(A) e ∈ sre ( A ) . Moreover, we assume that sufficiently many equational axioms hold for the expressions in sre ( A ) \operatorname{sre}(A) sre ( A ) so that ⟨ sre ( A ) , + , ⋅ , ∅ , ∅ ∗ ⟩ \langle\operatorname{sre}(A),+,\cdot,\varnothing,\varnothing^*\rangle ⟨ sre ( A ) , + , ⋅ , ∅ , ∅ ∗ ⟩ forms an idempotent semiring.
In this subsection, we will refine the notion of SREs so that they form a pumping semiring. We then obtain an algorithm to compute the downward closures of context-free languages purely as SREs. The key idea in Section 6.1 was to construct an auxiliary wPDS using an appropriate pumping semiring such that, given any two configurations, the weight along any trace between them encodes the upward closure of that trace, while accelerating any loops within it. As a result, every trace generates an under-approximation of the upward closure of the set of all such traces.
In the case of downward closures, the natural choice is the semiring S T r a n s d c = ⟨ sre ( T r a n s ) , + , ⋅ , ∅ , ∅ ∗ ⟩ S_{\mathrm{Trans}_{\mathrm{dc}}}=\langle\operatorname{sre}(\mathrm{Trans}),+,\cdot,\varnothing,\varnothing^*\rangle S Trans dc = ⟨ sre ( Trans ) , + , ⋅ , ∅ , ∅ ∗ ⟩ of SREs, but to lift it to a pumping semiring, we must define the correct notion of the unary operator ⊛ \circledast ⊛ in Definition 3.1. Our definition is motivated by Courcelle’s downward closure construction for context-free grammars [14 ] .
Given an SRE e ∈ sre ( T r a n s ) e\in\operatorname{sre}(\mathrm{Trans}) e ∈ sre ( Trans ) , let ∥ e ∥ ⊆ T r a n s \lVert e\rVert\subseteq\mathrm{Trans} ∥ e ∥ ⊆ Trans be the set of all transitions that occur in the expression. We can inductively define it as follows:
∥ ∅ ∥ : = ∅ , ∥ e + δ ∥ : = { δ } , ∥ X ∗ ∥ : = X , ∥ e 1 + e 2 ∥ : = ∥ e 1 ∥ ∪ ∥ e 2 ∥ , ∥ e 1 ⋅ e 2 ∥ : = ∥ e 1 ∥ ∪ ∥ e 2 ∥ . \begin{aligned}
\lVert\varnothing\rVert&:= \varnothing, & \lVert e+\delta\rVert&:= \{\delta\}, & \lVert X^*\rVert&:= X, \\
\lVert e_1+e_2\rVert&:= \lVert e_1\rVert\cup\lVert e_2\rVert, & \lVert e_1\cdot e_2\rVert&:= \lVert e_1\rVert\cup\lVert e_2\rVert.
\end{aligned} ∥ ∅ ∥ ∥ e 1 + e 2 ∥ := ∅ , := ∥ e 1 ∥ ∪ ∥ e 2 ∥ , ∥ e + δ ∥ ∥ e 1 ⋅ e 2 ∥ := { δ } , := ∥ e 1 ∥ ∪ ∥ e 2 ∥ . ∥ X ∗ ∥ := X ,
where e 1 , e 2 ∈ sre ( T r a n s ) e_1,e_2\in\operatorname{sre}(\mathrm{Trans}) e 1 , e 2 ∈ sre ( Trans ) , δ ∈ T r a n s \delta\in\mathrm{Trans} δ ∈ Trans , and X ∈ F ( T r a n s ) X\in F(\mathrm{Trans}) X ∈ F ( Trans ) . We then define the function ⊛ d c : sre ( T r a n s ) → sre ( T r a n s ) \circledast_{\mathrm{dc}}:\operatorname{sre}(\mathrm{Trans})\to\operatorname{sre}(\mathrm{Trans}) ⊛ dc : sre ( Trans ) → sre ( Trans ) such that e ⊛ d c : = ∥ e ∥ ∗ e^{\circledast_{\mathrm{dc}}}:=\lVert e\rVert^* e ⊛ dc := ∥ e ∥ ∗ . Then the tuple S T r a n s d c = ⟨ sre ( T r a n s ) , + , ⋅ , ⊛ d c , ∅ , ∅ ∗ ⟩ S_{\mathrm{Trans}_{\mathrm{dc}}}=\langle\operatorname{sre}(\mathrm{Trans}),+,\cdot,\circledast_{\mathrm{dc}},\varnothing,\varnothing^*\rangle S Trans dc = ⟨ sre ( Trans ) , + , ⋅ , ⊛ dc , ∅ , ∅ ∗ ⟩ satisfies condition (C2) by definition. For (C3), observe that the set { ⊛ d c ( sre ( T r a n s ) ) = { X ∗ ∣ X ∈ F ( T r a n s ) } } \{\circledast_{\mathrm{dc}}(\operatorname{sre}(\mathrm{Trans}))=\{X^*\mid X\in F(\mathrm{Trans})\}\} { ⊛ dc ( sre ( Trans )) = { X ∗ ∣ X ∈ F ( Trans )}} is finite.
To see that property (C1) is satisfied, consider the infinite sum ∑ n ∈ N ( ( ϵ + δ 1 ) ( ϵ + δ 1 ′ ) ) n ⋅ ϵ ⋅ ( ( ϵ + δ 2 ′ ) ( ϵ + δ 2 ) ) n \sum_{n\in\mathbb{N}} ((\epsilon+\delta_1)(\epsilon+\delta'_1))^n \cdot\epsilon\cdot((\epsilon+\delta'_2)(\epsilon+\delta_2))^n ∑ n ∈ N (( ϵ + δ 1 ) ( ϵ + δ 1 ′ ) ) n ⋅ ϵ ⋅ (( ϵ + δ 2 ′ ) ( ϵ + δ 2 ) ) n , where e ∈ sre ( T r a n s ) e\in\operatorname{sre}(\mathrm{Trans}) e ∈ sre ( Trans ) and δ i , δ i ′ ∈ T r a n s \delta_i,\delta'_i\in\mathrm{Trans} δ i , δ i ′ ∈ Trans for i ∈ [ 2 ] i\in[2] i ∈ [ 2 ] . Every word in the expression ( ( ϵ + δ 1 ) ( ϵ + δ 1 ′ ) ) n ((\epsilon+\delta_1)(\epsilon+\delta'_1))^n (( ϵ + δ 1 ) ( ϵ + δ 1 ′ ) ) n is a word over { δ 1 , δ 1 ′ } \{\delta_1,\delta'_1\} { δ 1 , δ 1 ′ } . Conversely, every word w w w over { δ 1 , δ 1 ′ } \{\delta_1,\delta'_1\} { δ 1 , δ 1 ′ } can be produced by dropping labels from the word ( δ 1 ⋅ δ 1 ′ ) ∣ w ∣ (\delta_1\cdot\delta'_1)^{|w|} ( δ 1 ⋅ δ 1 ′ ) ∣ w ∣ , matching the j j j -th letter of w w w inside the j j j -th block, and hence belongs to ( ( ϵ + δ 1 ) ( ϵ + δ 1 ′ ) ) n ((\epsilon+\delta_1)(\epsilon+\delta'_1))^n (( ϵ + δ 1 ) ( ϵ + δ 1 ′ ) ) n for every n ≥ ∣ w ∣ n\geq|w| n ≥ ∣ w ∣ . The same holds for the right-hand factor. Thus, the infinite sum is equivalent to the expression ( δ 1 + δ 1 ′ ) ∗ ⋅ e ⋅ ( δ 2 + δ 2 ′ ) ∗ (\delta_1+\delta'_1)^*\cdot e\cdot(\delta_2+\delta'_2)^* ( δ 1 + δ 1 ′ ) ∗ ⋅ e ⋅ ( δ 2 + δ 2 ′ ) ∗ , i.e., ∥ ( ϵ + δ 1 ) ( ϵ + δ 1 ′ ) ∥ ∗ ⋅ e ⋅ ∥ ( ϵ + δ 2 ) ( ϵ + δ 2 ′ ) ∥ ∗ \lVert(\epsilon+\delta_1)(\epsilon+\delta'_1)\rVert^*\cdot e\cdot\lVert(\epsilon+\delta_2)(\epsilon+\delta'_2)\rVert^* ∥( ϵ + δ 1 ) ( ϵ + δ 1 ′ ) ∥ ∗ ⋅ e ⋅ ∥( ϵ + δ 2 ) ( ϵ + δ 2 ′ ) ∥ ∗ .
We define the auxiliary wPDS ⟨ P , S T r a n s d c , w t d c ⟩ \langle\mathcal{P},\mathcal{S}_{\mathrm{Trans}_{\mathrm{dc}}},\mathrm{wt}_{\mathrm{dc}}\rangle ⟨ P , S Trans dc , wt dc ⟩ where w t d c ( δ ) : = ( ϵ + δ ) \mathrm{wt}_{\mathrm{dc}}(\delta):=(\epsilon+\delta) wt dc ( δ ) := ( ϵ + δ ) , for δ ∈ T r a n s \delta\in\mathrm{Trans} δ ∈ Trans . By induction, we can prove the following analogue of (2) for two configurations c c c and c ′ c' c ′ :
Paths ( c , c ′ ) ↓ = ∥ w t d c [ [ c , c ′ ] ] ∥ . (3) \operatorname{Paths}(c,c')\mathord{\downarrow}=\left\lVert\mathrm{wt}_{\mathrm{dc}}[[c,c']]\right\rVert. \tag*{(3)} Paths ( c , c ′ ) ↓ = ∥ wt dc [[ c , c ′ ]] ∥ . (3)
In Figure 10 , we illustrate such a translation for the underlying PDS P e x \mathcal{P}_{\mathrm{ex}} P ex defined in Example 2.1. As in the case of upward closure, our construction yields the following increasing sequence of under-approximations of Paths ( ⟨ q 1 , ⊣ ⟩ , ⟨ q 2 , ⊣ ⟩ ) ↓ \operatorname{Paths}(\langle q_1,\dashv\rangle,\langle q_2,\dashv\rangle)\mathord{\downarrow} Paths (⟨ q 1 , ⊣ ⟩ , ⟨ q 2 , ⊣ ⟩) ↓ :
Figure 10. We borrow notation from Figure 9. (a) A translation of the PDS P e x \mathcal{P}_{\mathrm{ex}} P ex to the wPDS ⟨ P e x , S ( T r a n s e x ) d c , ( w t e x ) d c ⟩ \langle\mathcal{P}_{\mathrm{ex}},\mathcal{S}_{(\mathrm{Trans}_{\mathrm{ex}})_{\mathrm{dc}}},(\mathrm{wt}_{\mathrm{ex}})_{\mathrm{dc}}\rangle ⟨ P ex , S ( Trans ex ) dc , ( wt ex ) dc ⟩ , and (b) our iterative downward closure construction for the wPDS in (a).
( ϵ + δ 1 ) ( ϵ + δ 2 ) ⊆ { δ 1 } ∗ ( ϵ + δ 1 ) ( ϵ + δ 2 ) { δ 3 } ∗ ⊆ { δ 1 } ∗ ( ϵ + δ 1 ) ( ϵ + δ 2 ) { δ 3 } ∗ . (\epsilon+\delta_1)(\epsilon+\delta_2)\subseteq\{\delta_1\}^*(\epsilon+\delta_1)(\epsilon+\delta_2)\{\delta_3\}^*\subseteq\{\delta_1\}^*(\epsilon+\delta_1)(\epsilon+\delta_2)\{\delta_3\}^*. ( ϵ + δ 1 ) ( ϵ + δ 2 ) ⊆ { δ 1 } ∗ ( ϵ + δ 1 ) ( ϵ + δ 2 ) { δ 3 } ∗ ⊆ { δ 1 } ∗ ( ϵ + δ 1 ) ( ϵ + δ 2 ) { δ 3 } ∗ .
Quantitative Network Verification
We now show that several classes of quantitative problems about networks of PDSs can be generically analysed within our framework. Let us assume a pumping semiring S = ⟨ S , ⊕ , ⊗ , ⊛ , 0 , 1 ⟩ S=\langle S,\oplus,\otimes,\circledast,0,1\rangle S = ⟨ S , ⊕ , ⊗ , ⊛ , 0 , 1 ⟩ and a partial order ⊴ \unlhd ⊴ on S S S , not necessarily the same as ≤ S \leq_S ≤ S . We now divide the problems into two main categories. All order comparisons are w.r.t. ⊴ \unlhd ⊴ .
Threshold Problems. We first consider three classes of threshold problems, where the threshold r is known, and C₁, C₂ are sets of network configurations. In (r, C₁, C₂)-Safety , we ask whether every trace from a configuration in C₁ to one in C₂ satisfies the upper bound r. In (r, C₁, C₂)-Reachability , we dually ask whether, for each process p, some such trace satisfies the lower bound rᵖ on p. Finally, in (r, C₁, c)-Cost-bounded reachability , we ask whether a configuration c is reachable from some configuration in C₁, and whether every trace from C₁ to c satisfies an upper bound r.
Optimality Problems. Each of the above properties is parameterised by a threshold. A violation of r-safety, for instance, witnesses a trace whose weight exceeds r; dually, requiring that no trace triggers a violation amounts to computing an appropriate threshold in the first place. This computation matters in practice: overly aggressive thresholds may flag even desired behaviour as violations, thus impeding network availability. We therefore also consider, for each property above, an optimality analogue in which the threshold must be computed as the set R R R of optimal (minimal for safety and cost-bounded reachability, maximal for reachability) bounds r r r .
In Section 7.1, we will introduce the notion of networks of wPDSs and briefly review the existing literature on qualitative verification of networks of PDSs. In Section 7.2, we will define a novel quantitative problem that lies at the heart of all the above problems. In Section 7.3, we will formalise each of the above problems, and state our results. In Section 7.4, we will demonstrate our verification algorithm on the motivating example from Section 1.1.
Networks of Weighted Pushdown Systems
It is widely known that the control-state reachability problem for networks of PDSs, communicating over various mechanisms, is undecidable in general [3 , 7 ] . Consequently, a quantitative analysis of such models is impossible in general. In this paper, we will study acyclic networks of weighted PDSs.
Acyclic Networks. Acyclic networks of PDSs were first introduced by Atig et al. [8 ] . They considered two kinds of networks with differing communication mechanisms: communication through shared memory and communication through unreliable channels. They studied their configuration reachability problems and showed decidability in both cases. For the sake of simplicity, we describe the model with shared-memory communication, naturally extended with weights.
A network is defined by a tuple N = ⟨ P , c h , { ⟨ P p , w t p ⟩ } p ∈ P , { ϕ δ } δ ∈ ⋃ p ∈ P Trans p ⟩ \mathcal{N} = \langle P, \mathit{ch}, \{\langle\mathcal{P}^{p}, \mathit{wt}^{p}\rangle\}_{p \in P}, \{\phi^{\delta}\}_{\delta\in\bigcup_{p \in P}\operatorname{Trans}^{p}}\rangle N = ⟨ P , ch , {⟨ P p , wt p ⟩ } p ∈ P , { ϕ δ } δ ∈ ⋃ p ∈ P Trans p ⟩ , where P P P is a finite set of processes, c h ⊆ P × P \mathit{ch} \subseteq P \times P ch ⊆ P × P is a binary relation denoting a set of channels ⟨ p ′ , p ⟩ \langle p',p\rangle ⟨ p ′ , p ⟩ from the source process p ′ p' p ′ to the destination process p p p , and each process p ∈ P p \in P p ∈ P is assigned a wPDS ⟨ P p , w t p ⟩ \langle\mathcal{P}^{p}, \mathit{wt}^{p}\rangle ⟨ P p , wt p ⟩ where P p = ⟨ Q p , A p , Γ p , Trans p ⟩ \mathcal{P}^{p} = \langle Q^{p}, A^{p}, \Gamma^{p}, \operatorname{Trans}^{p}\rangle P p = ⟨ Q p , A p , Γ p , Trans p ⟩ . This models a network of PDSs according to the channel relation c h \mathit{ch} ch : a PDS P p \mathcal{P}^{p} P p can observe the state of any PDS P p ′ \mathcal{P}^{p'} P p ′ if ⟨ p ′ , p ⟩ ∈ c h \langle p',p\rangle\in\mathit{ch} ⟨ p ′ , p ⟩ ∈ ch , and conditionally take a transition δ ∈ Trans p \delta\in\operatorname{Trans}^{p} δ ∈ Trans p based on its observation; this condition is modelled by ϕ δ ⊆ ∏ p ′ ′ ∈ { p } ∪ { p ′ ∣ ⟨ p ′ , p ⟩ ∈ c h } Q p ′ ′ \phi^{\delta} \subseteq\prod_{p'' \in\{p\}\cup\{p' \mid\langle p',p\rangle\in\mathit{ch}\}} Q^{p''} ϕ δ ⊆ ∏ p ′′ ∈ { p } ∪ { p ′ ∣ ⟨ p ′ , p ⟩ ∈ ch } Q p ′′ , which characterises the valid tuples of states of p p p and of the processes it observes. The network N \mathcal{N} N is acyclic iff the transitive closure c h + ⊆ P × P \mathit{ch}^{+} \subseteq P \times P ch + ⊆ P × P of c h \mathit{ch} ch is anti-reflexive.
A local configuration of the PDS P p \mathcal{P}^{p} P p is a configuration in Config ( P p ) \operatorname{Config}(\mathcal{P}^{p}) Config ( P p ) . A global configuration of the network N \mathcal{N} N is a tuple1 ^{1} 1 c ∈ ( Config ( P p ) ) p ∈ P \mathbf{c} \in\left(\operatorname{Config}(\mathcal{P}^{p})\right)_{p \in P} c ∈ ( Config ( P p ) ) p ∈ P of local configurations. Let Config ( N ) \operatorname{Config}(\mathcal{N}) Config ( N ) denote the set of all global configurations. We define local states and global states analogously. Given p ∈ P p \in P p ∈ P , a set C ⊆ Config ( P p ) C \subseteq\operatorname{Config}(\mathcal{P}^{p}) C ⊆ Config ( P p ) of local configurations is called regular if it is a finite union of sets of the form { q } × L \{q\} \times L { q } × L , where L ⊆ Γ ∗ L \subseteq\Gamma^{*} L ⊆ Γ ∗ is a regular language. A set C ⊆ Config ( N ) C \subseteq\operatorname{Config}(\mathcal{N}) C ⊆ Config ( N ) of global configurations is called regular if it is the Cartesian product of regular sets of local configurations.
Let c p \mathbf{c}^{p} c p denote the local configuration that corresponds to the process p p p in the global configuration c \mathbf{c} c . Then, a successor of c \mathbf{c} c is a global configuration c ′ \mathbf{c}' c ′ such that, for some p ∈ P p \in P p ∈ P , there exists a transition δ ∈ Trans p \delta\in\operatorname{Trans}^{p} δ ∈ Trans p such that (1) c p → δ P p c ′ p \mathbf{c}^{p} \xrightarrow{\delta}_{\mathcal{P}^{p}} \mathbf{c}'^{p} c p δ P p c ′ p , (2) ⟨ st ( c p ′ ′ ) ⟩ p ′ ′ ∈ { p } ∪ { p ′ ∣ ⟨ p ′ , p ⟩ ∈ c h } ∈ ϕ δ \langle\operatorname{st}(\mathbf{c}^{p''})\rangle_{p'' \in\{p\}\cup\{p' \mid\langle p',p\rangle\in\mathit{ch}\}} \in\phi^{\delta} ⟨ st ( c p ′′ ) ⟩ p ′′ ∈ { p } ∪ { p ′ ∣ ⟨ p ′ , p ⟩ ∈ ch } ∈ ϕ δ (we then say that these states satisfy ϕ δ \phi^{\delta} ϕ δ ), and (3) ∀ p ′ ≠ p . c p ′ = c ′ p ′ \forall p' \ne p.\ \mathbf{c}^{p'} = \mathbf{c}'^{p'} ∀ p ′ = p . c p ′ = c ′ p ′ . We write c → δ N c ′ \mathbf{c} \xrightarrow{\delta}_{\mathcal{N}} \mathbf{c}' c δ N c ′ to denote this relation, and ⇒ N ∗ \Rightarrow_{\mathcal{N}}^{*} ⇒ N ∗ to denote the reflexive-transitive closure of all such relations, dropping the subscript when the context is clear. We define global runs and global traces analogously. Given a global run (resp. global trace) ρ \rho ρ (resp. τ \tau τ , written in boldface), we define the local run (resp. local trace) of the process p p p , denoted by ρ p \rho^{p} ρ p (resp. τ p \tau^{p} τ p ), as the projection of ρ \rho ρ (resp. τ \tau τ ) onto the transitions that belong to P p \mathcal{P}^{p} P p . Analogously to weight functions for PDSs, we define
Paths N ( c , c ′ ) : = { δ 1 ⋯ δ n ∣ c ⇒ δ 1 ⋯ ⇒ δ n c ′ } \operatorname{Paths}_{N}(c,c') := \{\delta_1\cdots\delta_n \mid c \xRightarrow{\delta_1}\cdots\xRightarrow{\delta_n} c'\} Paths N ( c , c ′ ) := { δ 1 ⋯ δ n ∣ c δ 1 ⋯ δ n c ′ }
⟦ c , c ′ ⟧ N : = ⟨ ⨁ τ ∈ Paths N ( c , c ′ ) ( wt p ∗ τ p ) ⟩ p ∈ P . \llbracket c,c'\rrbracket_N := \left\langle\bigoplus_{\tau\in\operatorname{Paths}_{N}(c,c')} \left(\operatorname{wt}^{p} * \tau^{p}\right) \right\rangle_{p\in P}. [ [ c , c ′ ] ] N := ⟨ τ ∈ Paths N ( c , c ′ ) ⨁ ( wt p ∗ τ p ) ⟩ p ∈ P .
Intuitively, ⟦ c , c ′ ⟧ N \llbracket c,c'\rrbracket_N [ [ c , c ′ ] ] N captures the weight of every local trace in a global trace from c c c to c ′ c' c ′ as a tuple.
Example 7.1. Consider the example of a simple client-server model illustrated in Figure 11 a. The underlying semiring is the arctic semiring. In the initial state i n s e r v in_{serv} i n ser v , the server process P s e r v P_{serv} P ser v non-deterministically chooses to display either the message a a a , by moving to state s n t a snt_a s n t a , or the message b b b , by moving to state s n t b snt_b s n t b . Both transitions cost 1 unit of work. On the other hand, the client process P c l P_{cl} P c l repeatedly checks the state of the server process. If it observes the message a a a , then it pushes α \alpha α onto its stack and moves back to its initial state i n c l in_{cl} i n c l , intuitively asking the server process to display the message b b b . This transition costs 1 unit of work. It keeps doing so until it observes the message b b b , whereupon it moves to the state r c v b rcv_b r c v b . Once it reaches this state, it may choose to move to the state f i n fin f in and flush its stack. Each popping operation costs 1 unit of work.
Figure 11. (a) An example of an acyclic network with a client process (below) and a server process (above). The labels of the form ( s n t a ? ) (\mathit{snt}_a?) ( snt a ?) indicate a check with the singleton valid set { ⟨ s e r v : s n t a , c l : i n c l ⟩ } \{\langle\mathit{serv}:\mathit{snt}_a,\mathit{cl}:\mathit{in}_{cl}\rangle\} {⟨ serv : snt a , cl : in c l ⟩} of state tuples. (b) A correspondence between two asynchronous runs ρ s e r v \rho^{serv} ρ ser v and ρ c l \rho^{cl} ρ c l of the two processes. We have omitted the stack contents from our configurations. The coloured triangles depict the scope of the runs where P c l P_{cl} P c l views the corresponding P s e r v P_{serv} P ser v ’s state near its top vertex.
In Figure 11 b, we depict a global run with two local runs of the two processes. The server process transitions to state s n t b snt_b s n t b via the state s n t a snt_a s n t a . For the first half of P c l P_{cl} P c l ’s run, it observes the state s n t a snt_a s n t a twice, and thus pushes α \alpha α twice onto the stack. At this point, the server decides to move to state s n t b snt_b s n t b . Once the client process observes this, it moves to r c v b rcv_b r c v b , followed by f i n fin f in , and flushes its stack. The weight of this global run is the tuple ⟨ s e r v : 2 , c l : 4 ⟩ ∈ N 2 \langle serv:2,cl:4\rangle\in\mathbb{N}^2 ⟨ ser v : 2 , c l : 4 ⟩ ∈ N 2 .
Finding the Common Denominator
All the threshold and optimality problems discussed at the start of this section share a common core: aggregating, for each process, the weights of all global traces between two global configurations. We now present this core problem, a weighted extension of the reachability problem proposed in [8 ] for acyclic networks of wPDSs. In Section 7.3, we will show that it provides the basis for solving all of them.
Table 12. Thin semirings and their interpretations in the analysis of a network N \mathcal{N} N .
GenConfigReach:
Input: A network N = ⟨ P , c h , { ⟨ P p , S p , w t p ⟩ } p ∈ P , { ϕ δ } δ ∈ ⋃ p ∈ P T r a n s p ⟩ \mathcal{N} = \langle P,\mathop{\mathrm{ch}},\{\langle\mathcal{P}^{p},S^{p},\mathrm{wt}^{p}\rangle\}_{p\in P},\{\phi^{\delta}\}_{\delta\in\bigcup_{p\in P}\mathrm{Trans}^{p}}\rangle N = ⟨ P , ch , {⟨ P p , S p , wt p ⟩ } p ∈ P , { ϕ δ } δ ∈ ⋃ p ∈ P Trans p ⟩ , where S p S^{p} S p is a pumping semiring for every p ∈ P p\in P p ∈ P , and two global configurations c , c ′ ∈ ( C o n f i g ( P p ) ) p ∈ P \mathbf{c},\mathbf{c}'\in(\mathrm{Config}(\mathcal{P}^{p}))_{p\in P} c , c ′ ∈ ( Config ( P p ) ) p ∈ P .
Questions:
Does c ⇒ N ∗ c ′ \mathbf{c}\mathrel{\Rightarrow^{*}_{\mathcal{N}}}\mathbf{c}' c ⇒ N ∗ c ′ hold?
What is [ c , c ′ ] N [\mathbf{c},\mathbf{c}']_{\mathcal{N}} [ c , c ′ ] N ?
Note that when S p = B S^{p}=\mathbb{B} S p = B for every p ∈ P p\in P p ∈ P , each wPDS in the network is a PDS. Atig et al. showed that GenConfigReach is decidable in such cases [8 Prop. 4, Thm. 4] .
Main result. A pumping semiring S S S is ≤ S \leq_{S} ≤ S -thin (resp. ≥ S \geq_{S} ≥ S -thin) iff for every a , b , c ∈ S ∖ { 0 } a,b,c\in S\setminus\{0\} a , b , c ∈ S ∖ { 0 } , it holds that a ≤ S b ⊗ a ⊗ c a\leq_{S}b\otimes a\otimes c a ≤ S b ⊗ a ⊗ c (resp. a ≥ S b ⊗ a ⊗ c a\geq_{S}b\otimes a\otimes c a ≥ S b ⊗ a ⊗ c ). We say S S S is thin if it is either ≤ S \leq_{S} ≤ S -thin or ≥ S \geq_{S} ≥ S -thin. Equivalently, a ≤ S \leq_{S} ≤ S -thin (resp. ≥ S \geq_{S} ≥ S -thin) semiring S S S imposes the condition that 1 1 1 is the smallest (resp. largest) non-zero element in the semiring.2
While being thin may seem like a strong restriction, it still subsumes a rich class of pumping semirings. For instance, all the pumping semirings described in Figure 2 are thin (cf. Figure 12). In fact, inserting transitions into a trace can only increase (resp. decrease) its weight in a ≤ S \leq_{S} ≤ S -thin (resp. ≥ S \geq_{S} ≥ S -thin) semiring, so the weight of a set of traces coincides with that of its downward closure (resp. upward closure), and can be read off from it directly. After linearising the network [8 Prop. 3] , processes constrain each other only through the closures of their observations. Yet summing the weights of all runs of a process over-approximates, as only some take part in global traces; our procedure therefore keeps them apart in finitely many families, each with its own closure and weight. We prove that GenConfigReach is computable for ≤ S \leq_{S} ≤ S -thin (resp. ≥ S \geq_{S} ≥ S -thin) pumping semirings:
Theorem 7.2. Let N = ⟨ P , c h , { ⟨ P p , S p , w t p ⟩ p ∈ P , { ϕ δ } δ ∈ ⋃ p ∈ P T r a n s p ⟩ \mathcal{N}=\langle P,\mathop{\mathrm{ch}},\{\langle\mathcal{P}^{p},S^{p},\mathrm{wt}^{p}\rangle_{p\in P},\{\phi^{\delta}\}_{\delta\in\bigcup_{p\in P}\mathrm{Trans}^{p}}\rangle N = ⟨ P , ch , {⟨ P p , S p , wt p ⟩ p ∈ P , { ϕ δ } δ ∈ ⋃ p ∈ P Trans p ⟩ be an arbitrary acyclic network, such that for every p ∈ P p\in P p ∈ P , S p S^{p} S p is ≤ S p \leq_{S^{p}} ≤ S p -thin (resp. ≥ S p \geq_{S^{p}} ≥ S p -thin). Let c , c ′ \mathbf{c},\mathbf{c}' c , c ′ be arbitrary global configurations of N \mathcal{N} N . Then GenConfigReach can be solved for the input N , c \mathcal{N},\mathbf{c} N , c , and c ′ \mathbf{c}' c ′ .
Intuitively, the proof is a non-trivial adaptation of Atig et al.’s decision procedure for acyclic PDS networks, using our fixpoint algorithm for a joint computation of language closures and weight summaries. However, unlike the qualitative case, where a bottom-up approach is dual to the top-down approach, the symmetry breaks in the case of quantitative analysis. For ≤ S \leq_{\mathcal{S}} ≤ S -thin semirings, we will need to use the top-down approach, whereas for ≥ S \geq_{\mathcal{S}} ≥ S -thin semirings, we will need to use the bottom-up approach.3 See Section G for further details.
Formalising Threshold and Optimality
We are now ready to formalise each of the network verification problems stated at the beginning of this section. We fix an arbitrary network N = ⟨ P , c h , { ⟨ P p , s w p ⟩ p ∈ P , { ϕ δ } δ ∈ T r a n s p ⟩ p ∈ P ⟩ \mathcal{N} = \langle P,\mathsf{ch},\{\langle\mathcal{P}^{p},\mathsf{sw}^{p}\rangle_{p\in P},\{\phi^{\delta}\}_{\delta\in\mathsf{Trans}^{p}}\rangle_{p\in P}\rangle N = ⟨ P , ch , {⟨ P p , sw p ⟩ p ∈ P , { ϕ δ } δ ∈ Trans p ⟩ p ∈ P ⟩ for the rest of this section. For simplicity, we assume that S p = S \mathcal{S}^{p} = \mathcal{S} S p = S for every p ∈ P p \in P p ∈ P , for a fixed pumping semiring S \mathcal{S} S with a computable partial order ≤ \leq ≤ on S \mathcal{S} S , for which 0 0 0 is the ≤ \leq ≤ -least element (so that, when no global trace exists and every threshold is vacuously met, the optimal bound is 0 P 0^{P} 0 P ). By abuse of notation, we use the symbol ≤ \leq ≤ to also denote its iterated product order.
Threshold. Let r ∈ S P \mathbf{r} \in\mathcal{S}^{P} r ∈ S P be a tuple of weights in S \mathcal{S} S , and let C 1 , C 2 ⊆ Config ( N ) C_{1}, C_{2} \subseteq\operatorname{Config}(\mathcal{N}) C 1 , C 2 ⊆ Config ( N ) be non-empty regular sets of configurations. We say:
N is ( r , C 1 , C 2 ) -safe ⟺ ∀ c 1 ∈ C 1 . ∀ c 2 ∈ C 2 . ∀ τ ∈ Paths N ( c 1 , c 2 ) . ∀ p ∈ P . \mathcal{N}\text{ is }(\mathbf{r},C_{1},C_{2})\text{-safe} \Longleftrightarrow\forall c_{1}\in C_{1}.\ \forall c_{2}\in C_{2}.\ \forall\tau\in\operatorname{Paths}_{\mathcal{N}}(c_{1},c_{2}).\ \forall p\in P. N is ( r , C 1 , C 2 ) -safe ⟺ ∀ c 1 ∈ C 1 . ∀ c 2 ∈ C 2 . ∀ τ ∈ Paths N ( c 1 , c 2 ) . ∀ p ∈ P .
( w t p ) ∗ ( τ p ) ≤ r p , (\mathsf{wt}^{p})^{*}(\tau^{p}) \leq r^{p}, ( wt p ) ∗ ( τ p ) ≤ r p ,
N is ( r , C 1 , C 2 ) -reachable ⟺ ∀ p ∈ P . ∃ c 1 ∈ C 1 . ∃ c 2 ∈ C 2 . ∃ τ ∈ Paths N ( c 1 , c 2 ) . \mathcal{N}\text{ is }(\mathbf{r},C_{1},C_{2})\text{-reachable} \Longleftrightarrow\forall p\in P.\ \exists c_{1}\in C_{1}.\ \exists c_{2}\in C_{2}.\ \exists\tau\in\operatorname{Paths}_{\mathcal{N}}(c_{1},c_{2}). N is ( r , C 1 , C 2 ) -reachable ⟺ ∀ p ∈ P . ∃ c 1 ∈ C 1 . ∃ c 2 ∈ C 2 . ∃ τ ∈ Paths N ( c 1 , c 2 ) .
r p ≤ ( w t p ) ∗ ( τ p ) , r^{p} \leq(\mathsf{wt}^{p})^{*}(\tau^{p}), r p ≤ ( wt p ) ∗ ( τ p ) ,
N is ( r , C 1 , c ) -cost-bounded ⟺ ∃ c 1 ∈ C 1 . Paths N ( c 1 , c ) ≠ ∅ \mathcal{N}\text{ is }(\mathbf{r},C_{1},c)\text{-cost-bounded} \Longleftrightarrow\exists c_{1}\in C_{1}.\ \operatorname{Paths}_{\mathcal{N}}(c_{1},c)\ne\varnothing N is ( r , C 1 , c ) -cost-bounded ⟺ ∃ c 1 ∈ C 1 . Paths N ( c 1 , c ) = ∅
∧ ∀ c 1 ∈ C 1 . ∀ τ ∈ Paths N ( c 1 , c ) . ∀ p ∈ P . ( w t p ) ∗ ( τ p ) ≤ r p . \land\ \forall c_{1}\in C_{1}.\ \forall\tau\in\operatorname{Paths}_{\mathcal{N}}(c_{1},c).\ \forall p\in P.\ (\mathsf{wt}^{p})^{*}(\tau^{p}) \leq r^{p}. ∧ ∀ c 1 ∈ C 1 . ∀ τ ∈ Paths N ( c 1 , c ) . ∀ p ∈ P . ( wt p ) ∗ ( τ p ) ≤ r p .
Essentially, the network N \mathcal{N} N is ( r , C 1 , C 2 ) (\mathbf{r},C_{1},C_{2}) ( r , C 1 , C 2 ) -safe when every global trace from C 1 C_{1} C 1 to C 2 C_{2} C 2 has weight at most r \mathbf{r} r ; the network N \mathcal{N} N is ( r , C 1 , C 2 ) (\mathbf{r},C_{1},C_{2}) ( r , C 1 , C 2 ) -reachable when for every process p p p there exists a global trace from C 1 C_{1} C 1 to C 2 C_{2} C 2 with local weight at least r p r^{p} r p ; and the network N \mathcal{N} N is ( r , C 1 , c ) (\mathbf{r},C_{1},c) ( r , C 1 , c ) -cost-bounded when the target configuration c c c is reachable from some global configuration c 1 ∈ C 1 c_{1}\in C_{1} c 1 ∈ C 1 , and every global trace from C 1 C_{1} C 1 to c c c has weight at most r \mathbf{r} r . Note that C 1 C_{1} C 1 and C 2 C_{2} C 2 may be infinite sets of global configurations.
Optimality. We define the optimal sets for the above properties as follows:
OptSafe C 1 , C 2 ( N ) : = min ≤ { r ∈ S P ∣ N is ( r , C 1 , C 2 ) -safe } , \operatorname{OptSafe}_{C_{1},C_{2}}(\mathcal{N}) := \min_{\leq}\{\mathbf{r}\in\mathcal{S}^{P}\mid\mathcal{N}\text{ is }(\mathbf{r},C_{1},C_{2})\text{-safe}\}, OptSafe C 1 , C 2 ( N ) := ≤ min { r ∈ S P ∣ N is ( r , C 1 , C 2 ) -safe } ,
OptReach C 1 , C 2 ( N ) : = max ≤ { r ∈ S P ∣ N is ( r , C 1 , C 2 ) -reachable } , \operatorname{OptReach}_{C_{1},C_{2}}(\mathcal{N}) := \max_{\leq}\{\mathbf{r}\in\mathcal{S}^{P}\mid\mathcal{N}\text{ is }(\mathbf{r},C_{1},C_{2})\text{-reachable}\}, OptReach C 1 , C 2 ( N ) := ≤ max { r ∈ S P ∣ N is ( r , C 1 , C 2 ) -reachable } ,
OptCost C 1 , c ( N ) : = min ≤ { r ∈ S P ∣ N is ( r , C 1 , c ) -cost-bounded } . \operatorname{OptCost}_{C_{1},c}(\mathcal{N}) := \min_{\leq}\{\mathbf{r}\in\mathcal{S}^{P}\mid\mathcal{N}\text{ is }(\mathbf{r},C_{1},c)\text{-cost-bounded}\}. OptCost C 1 , c ( N ) := ≤ min { r ∈ S P ∣ N is ( r , C 1 , c ) -cost-bounded } .
Results. The optimality problems are closely related to the threshold problems:
N \mathcal{N} N is ( r , C 1 , C 2 ) (\mathbf{r},C_{1},C_{2}) ( r , C 1 , C 2 ) -safe iff there exists r ′ ∈ OptSafe C 1 , C 2 ( N ) \mathbf{r}'\in\operatorname{OptSafe}_{C_{1},C_{2}}(\mathcal{N}) r ′ ∈ OptSafe C 1 , C 2 ( N ) such that r ′ ≤ r \mathbf{r}'\leq\mathbf{r} r ′ ≤ r .
N \mathcal{N} N is ( r , C 1 , C 2 ) (\mathbf{r},C_{1},C_{2}) ( r , C 1 , C 2 ) -reachable iff there exists r ′ ∈ OptReach C 1 , C 2 ( N ) \mathbf{r}'\in\operatorname{OptReach}_{C_{1},C_{2}}(\mathcal{N}) r ′ ∈ OptReach C 1 , C 2 ( N ) such that r ≤ r ′ \mathbf{r}\leq\mathbf{r}' r ≤ r ′ .
N \mathcal{N} N is ( r , C 1 , c ) (\mathbf{r},C_{1},c) ( r , C 1 , c ) -cost-bounded iff there exists r ′ ∈ OptCost C 1 , c ( N ) \mathbf{r}'\in\operatorname{OptCost}_{C_{1},c}(\mathcal{N}) r ′ ∈ OptCost C 1 , c ( N ) such that r ′ ≤ r \mathbf{r}'\leq\mathbf{r} r ′ ≤ r .
In other words, if each optimal set is finite and computable, then the corresponding threshold problem is decidable. Recall that N \mathcal{N} N is arbitrary. We prove the following lemma:
Lemma 7.3. Suppose N \mathcal{N} N is acyclic, and S \mathcal{S} S is ≤ S \leq_{\mathcal{S}} ≤ S -thin (resp. ≥ S \geq_{\mathcal{S}} ≥ S -thin). We then have:
(S1) If a ⊕ b ≤ c ⟺ a ≤ c a\oplus b\leq c\Longleftrightarrow a\leq c a ⊕ b ≤ c ⟺ a ≤ c and b ≤ c b\leq c b ≤ c , then OptSafe C 1 , C 2 ( N ) \operatorname{OptSafe}_{C_{1},C_{2}}(\mathcal{N}) OptSafe C 1 , C 2 ( N ) and OptCost C 1 , c ( N ) \operatorname{OptCost}_{C_{1},c}(\mathcal{N}) OptCost C 1 , c ( N ) are at most singletons and computable,
(S2) If c ≤ a ⊕ b ⟺ c ≤ a c\leq a\oplus b\Longleftrightarrow c\leq a c ≤ a ⊕ b ⟺ c ≤ a or c ≤ b c\leq b c ≤ b , then OptReach C 1 , C 2 ( N ) \operatorname{OptReach}_{C_{1},C_{2}}(\mathcal{N}) OptReach C 1 , C 2 ( N ) is at most a singleton and computable.
By Theorem 7.2, acyclicity and thinness ensure that ⟦ c , c ′ ⟧ N \llbracket c,c'\rrbracket_{\mathcal{N}} [ [ c , c ′ ] ] N is computable for arbitrary input global configurations c , c ′ ∈ Config ( N ) c,c' \in\operatorname{Config}(\mathcal{N}) c , c ′ ∈ Config ( N ) . Intuitively, the condition in (S1) imposes that the traces track worst-case behaviour w.r.t. ⊴ \unlhd ⊴ , i.e., upper-bounding the aggregate a ⊕ b a \oplus b a ⊕ b of two traces equivalently upper-bounds both the accumulations a a a , and b b b of each trace. This is satisfied by the Arctic, Probabilistic-union, Why, downward closure, and upward closure semirings respectively, over the orders ≤ \leq ≤ , ≤ \leq ≤ , ⊆ \subseteq ⊆ , ⊆ \subseteq ⊆ , and ⊆ \subseteq ⊆ (cf. Figure 2).
Since C 1 C_1 C 1 and C 2 C_2 C 2 are regular, we can construct a new acyclic network N 0 \mathcal{N}_0 N 0 from N \mathcal{N} N , which can non-deterministically bootstrap to any global configuration in C 1 C_1 C 1 from a special global configuration c 0 ∈ Config ( N 0 ) c_0 \in\operatorname{Config}(\mathcal{N}_0) c 0 ∈ Config ( N 0 ) (with empty stacks) with 1 P 1^P 1 P weight. It simulates the behaviour of N \mathcal{N} N , and finally moves to a flushing phase when it reaches a global configuration in C 2 C_2 C 2 , where it flushes the contents of its stacks to reach a special global configuration c 0 ′ ∈ Config ( N 0 ) c'_0 \in\operatorname{Config}(\mathcal{N}_0) c 0 ′ ∈ Config ( N 0 ) with 1 P 1^P 1 P weight. It holds that:
N is ( r , C 1 , C 2 ) -safe ⟺ ∀ c 1 ∈ C 1 . ∀ c 2 ∈ C 2 . ∀ τ ∈ Paths N ( c 1 , c 2 ) . ∀ p ∈ P . ( wt p ) ∗ ( τ p ) ⊴ r p ⟺ ∀ c 1 ∈ C 1 . ∀ c 2 ∈ C 2 . ⟦ c 1 , c 2 ⟧ N ⊴ r ⟺ ⨁ c 1 ∈ C 1 , c 2 ∈ C 2 ⟦ c 1 , c 2 ⟧ N ⊴ r ⟺ ⟦ c 0 , c 0 ′ ⟧ N 0 ⊴ r . \begin{aligned}
\mathcal{N}\text{ is }(r,C_1,C_2)\text{-safe} &\Longleftrightarrow\forall c_1 \in C_1.\ \forall c_2 \in C_2.\ \forall\tau\in\operatorname{Paths}_{\mathcal{N}}(c_1,c_2).\ \forall p \in P.\ (\operatorname{wt}^p)^\ast(\tau^p) \unlhd r^p \\
&\Longleftrightarrow\forall c_1 \in C_1.\ \forall c_2 \in C_2.\ \llbracket c_1,c_2\rrbracket_{\mathcal{N}} \unlhd r \\
&\Longleftrightarrow\bigoplus_{c_1\in C_1,c_2\in C_2}\llbracket c_1,c_2\rrbracket_{\mathcal{N}}\unlhd r \\
&\Longleftrightarrow\llbracket c_0,c'_0\rrbracket_{\mathcal{N}_0}\unlhd r.
\end{aligned} N is ( r , C 1 , C 2 ) -safe ⟺ ∀ c 1 ∈ C 1 . ∀ c 2 ∈ C 2 . ∀ τ ∈ Paths N ( c 1 , c 2 ) . ∀ p ∈ P . ( wt p ) ∗ ( τ p ) ⊴ r p ⟺ ∀ c 1 ∈ C 1 . ∀ c 2 ∈ C 2 . [ [ c 1 , c 2 ] ] N ⊴ r ⟺ c 1 ∈ C 1 , c 2 ∈ C 2 ⨁ [ [ c 1 , c 2 ] ] N ⊴ r ⟺ [ [ c 0 , c 0 ′ ] ] N 0 ⊴ r .
Therefore, OptSafe C 1 , C 2 ( N ) \operatorname{OptSafe}_{C_1,C_2}(\mathcal{N}) OptSafe C 1 , C 2 ( N ) is { ⟦ c 0 , c 0 ′ ⟧ N 0 } \{\llbracket c_0,c'_0\rrbracket_{\mathcal{N}_0}\} { [ [ c 0 , c 0 ′ ] ] N 0 } , and it suffices to compute GenConfigReach \operatorname{GenConfigReach} GenConfigReach for N 0 \mathcal{N}_0 N 0 , c 0 c_0 c 0 , and c 0 ′ c'_0 c 0 ′ . For OptCost C 1 , c ( N ) \operatorname{OptCost}_{C_1,c}(\mathcal{N}) OptCost C 1 , c ( N ) , we construct an acyclic network N 1 \mathcal{N}_1 N 1 which, like N 0 \mathcal{N}_0 N 0 , bootstraps to any global configuration in C 1 C_1 C 1 from a special global configuration c 1 ∈ Config ( N 1 ) c_1 \in\operatorname{Config}(\mathcal{N}_1) c 1 ∈ Config ( N 1 ) with weight 1 P 1^P 1 P , simulates the behaviour of N \mathcal{N} N , but moves to a flushing phase only when it reaches c c c , eventually reaching a special global configuration c 1 ′ ∈ Config ( N 1 ) c'_1 \in\operatorname{Config}(\mathcal{N}_1) c 1 ′ ∈ Config ( N 1 ) with weight 1 P 1^P 1 P . To compute OptCost C 1 , c ( N ) \operatorname{OptCost}_{C_1,c}(\mathcal{N}) OptCost C 1 , c ( N ) , we need to first decide whether ∃ c ′ ∈ C 1 . Paths N ( c ′ , c ) ≠ ∅ \exists c' \in C_1.\operatorname{Paths}_{\mathcal{N}}(c',c) \neq\varnothing ∃ c ′ ∈ C 1 . Paths N ( c ′ , c ) = ∅ , or equivalently whether c 1 ⇒ N 1 ∗ c 1 ′ c_1 \Rightarrow_{\mathcal{N}_1}^{\ast} c'_1 c 1 ⇒ N 1 ∗ c 1 ′ . This can be decided as an instance of GenConfigReach \operatorname{GenConfigReach} GenConfigReach over the Boolean semiring. If it does not hold, OptCost C 1 , c ( N ) = ∅ \operatorname{OptCost}_{C_1,c}(\mathcal{N})=\varnothing OptCost C 1 , c ( N ) = ∅ . Otherwise, we obtain that OptCost C 1 , c ( N ) \operatorname{OptCost}_{C_1,c}(\mathcal{N}) OptCost C 1 , c ( N ) is { ⟦ c 1 , c 1 ′ ⟧ N 1 } \{\llbracket c_1,c'_1\rrbracket_{\mathcal{N}_1}\} { [ [ c 1 , c 1 ′ ] ] N 1 } , and it suffices to compute GenConfigReach \operatorname{GenConfigReach} GenConfigReach for N 1 \mathcal{N}_1 N 1 , c 1 c_1 c 1 , and c 1 ′ c'_1 c 1 ′ .
The condition in (S2) expresses that the traces track best-case behaviour w.r.t. ⊴ \unlhd ⊴ , i.e., lower-bounding the aggregate a ⊕ b a\oplus b a ⊕ b of two traces lower-bounds the accumulation a a a or b b b of one of the traces. This is satisfied by the Tropical, Viterbi, Bottleneck, Security, and Boolean semirings respectively, over the orders ≥ \geq ≥ , ≤ \leq ≤ , ≤ \leq ≤ , ≤ \leq ≤ , ⇒ \Rightarrow ⇒ (cf. Figure 2). Using the network N 0 \mathcal{N}_0 N 0 , we obtain:
N is ( r , C 1 , C 2 ) -reachable ⟺ ∀ p ∈ P . ∃ c 1 ∈ C 1 . ∃ c 2 ∈ C 2 . ∃ τ ∈ Paths N ( c 1 , c 2 ) . r p ⊴ ( wt p ) ∗ ( τ p ) ⟺ ∀ p ∈ P . ∃ c 1 ∈ C 1 . ∃ c 2 ∈ C 2 . r p ⊴ ⟦ c 1 , c 2 ⟧ N p ⟺ ∀ p ∈ P . r p ⊴ ⨁ c 1 ∈ C 1 , c 2 ∈ C 2 ⟦ c 1 , c 2 ⟧ N p ⟺ r ⊴ ⟦ c 0 , c 0 ′ ⟧ N 0 . \begin{aligned}
\mathcal{N}\text{ is }(r,C_1,C_2)\text{-reachable} &\Longleftrightarrow\forall p \in P.\ \exists c_1 \in C_1.\ \exists c_2 \in C_2.\ \exists\tau\in\operatorname{Paths}_{\mathcal{N}}(c_1,c_2).\ r^p \unlhd(\operatorname{wt}^p)^\ast(\tau^p) \\
&\Longleftrightarrow\forall p \in P.\ \exists c_1 \in C_1.\ \exists c_2 \in C_2.\ r^p \unlhd\llbracket c_1,c_2\rrbracket_{\mathcal{N}}^p \\
&\Longleftrightarrow\forall p \in P.\ r^p \unlhd\bigoplus_{c_1\in C_1,c_2\in C_2}\llbracket c_1,c_2\rrbracket_{\mathcal{N}}^p \\
&\Longleftrightarrow r \unlhd\llbracket c_0,c'_0\rrbracket_{\mathcal{N}_0}.
\end{aligned} N is ( r , C 1 , C 2 ) -reachable ⟺ ∀ p ∈ P . ∃ c 1 ∈ C 1 . ∃ c 2 ∈ C 2 . ∃ τ ∈ Paths N ( c 1 , c 2 ) . r p ⊴ ( wt p ) ∗ ( τ p ) ⟺ ∀ p ∈ P . ∃ c 1 ∈ C 1 . ∃ c 2 ∈ C 2 . r p ⊴ [ [ c 1 , c 2 ] ] N p ⟺ ∀ p ∈ P . r p ⊴ c 1 ∈ C 1 , c 2 ∈ C 2 ⨁ [ [ c 1 , c 2 ] ] N p ⟺ r ⊴ [ [ c 0 , c 0 ′ ] ] N 0 .
Therefore, OptReach C 1 , C 2 ( N ) \operatorname{OptReach}_{C_1,C_2}(\mathcal{N}) OptReach C 1 , C 2 ( N ) is either { ⟦ c 0 , c 0 ′ ⟧ N 0 } \{\llbracket c_0,c'_0\rrbracket_{\mathcal{N}_0}\} { [ [ c 0 , c 0 ′ ] ] N 0 } or empty, and it suffices to compute GenConfigReach \operatorname{GenConfigReach} GenConfigReach for N 0 \mathcal{N}_0 N 0 , c 0 c_0 c 0 , and c 0 ′ c'_0 c 0 ′ . By Theorem 7.2, both ⟦ c 0 , c 0 ′ ⟧ N 0 \llbracket c_0,c'_0\rrbracket_{\mathcal{N}_0} [ [ c 0 , c 0 ′ ] ] N 0 and ⟦ c 1 , c 1 ′ ⟧ N 1 \llbracket c_1,c'_1\rrbracket_{\mathcal{N}_1} [ [ c 1 , c 1 ′ ] ] N 1 are computable.
Revisiting Our Example
Recall the client-server network N \mathcal{N} N of Figure 1 . Taking the Arctic pumping semiring, which is ≤ A S \leq_{\mathrm{AS}} ≤ AS -thin (cf. Figure 12), the question from § 1.1 , whether x ∈ N x \in\mathbb{N} x ∈ N units suffice for the client to clear its backlog, becomes: “Is N \mathcal{N} N ( x , C 1 , C 2 ) (x,C_1,C_2) ( x , C 1 , C 2 ) -safe?”, where x = ( c : x , s v : x ) x=(c: x,sv: x) x = ( c : x , s v : x ) , and C 1 C_1 C 1 and C 2 C_2 C 2 are the regular sets ( { i n c } × { # } ) × ( { i n s v } × α ∗ ) (\{in^c\}\times\{\#\})\times(\{in^{sv}\}\times\alpha^\ast) ({ i n c } × { # }) × ({ i n s v } × α ∗ ) , and ( { i d l e } × { # } ) × ( { f i n } × α ∗ ) (\{idle\}\times\{\#\})\times(\{fin\}\times\alpha^\ast) ({ i d l e } × { # }) × ({ f in } × α ∗ ) , respectively. $C_1 captures the set of all initial global configurations of N N N where both processes are in their initial local states. The client’s backlog is empty to begin with, so every local configuration of P c l P^{\mathrm{cl}} P cl in C 1 C_1 C 1 has an empty stack. Since we need to allow arbitrary periods of prior idleness in the network, the credit counter of srv can be arbitrarily large for the local configurations of P s r v P^{\mathrm{srv}} P srv in C 1 C_1 C 1 . In C 2 C_2 C 2 , the client’s stack is empty once more, this time because the guards check ⊣ \dashv ⊣ prevent it from reaching idle with a non-empty backlog, while the server’s counter is again unconstrained.
According to the verification procedure in Section 7.3, we need to first construct an auxiliary network of the form N 0 N_0 N 0 , illustrated in Figure 13 . Observe that the special global configuration c 0 = ⟨ c l : ⟨ s 0 c l , ⊣ ⟩ , s r v : ⟨ s 0 s r v , ⊣ ⟩ ⟩ c_0 = \langle\mathrm{cl} : \langle s^{\mathrm{cl}}_0, \dashv\rangle,\mathrm{srv} : \langle s^{\mathrm{srv}}_0, \dashv\rangle\rangle c 0 = ⟨ cl : ⟨ s 0 cl , ⊣ ⟩ , srv : ⟨ s 0 srv , ⊣ ⟩⟩ non-deterministically bootstraps to an arbitrary configuration of the form ⟨ c l : ⟨ i n c l , ⊣ ⟩ , s r v : ⟨ i n s r v , α k ⊣ ⟩ ⟩ \langle\mathrm{cl} : \langle in^{\mathrm{cl}}, \dashv\rangle,\mathrm{srv} : \langle in^{\mathrm{srv}}, \alpha^k \dashv\rangle\rangle ⟨ cl : ⟨ i n cl , ⊣ ⟩ , srv : ⟨ i n srv , α k ⊣ ⟩⟩ for k ∈ N k \in\mathbb{N} k ∈ N . Moreover, from an arbitrary global configuration of the form ⟨ c l : ⟨ i d l e , ⊣ ⟩ , s r v : ⟨ f i n , α k ⊣ ⟩ ⟩ \langle\mathrm{cl} : \langle idle, \dashv\rangle,\mathrm{srv} : \langle fin, \alpha^k \dashv\rangle\rangle ⟨ cl : ⟨ i d l e , ⊣ ⟩ , srv : ⟨ f in , α k ⊣ ⟩⟩ , for k ∈ N k \in\mathbb{N} k ∈ N , there exists a trace to c 0 ′ = ⟨ c l : ⟨ s 0 ′ c l , ⊣ ⟩ , s r v : ⟨ s 0 ′ s r v , ⊣ ⟩ ⟩ c'_0 = \langle\mathrm{cl} : \langle s'^{\mathrm{cl}}_0, \dashv\rangle,\mathrm{srv} : \langle s'^{\mathrm{srv}}_0, \dashv\rangle\rangle c 0 ′ = ⟨ cl : ⟨ s 0 ′ cl , ⊣ ⟩ , srv : ⟨ s 0 ′ srv , ⊣ ⟩⟩ . Thus, the worst-case upper bound is ⟦ c 0 , c 0 ′ ⟧ N 0 \llbracket c_0,c'_0\rrbracket_{N_0} [ [ c 0 , c 0 ′ ] ] N 0 , which by Theorem 7.2 is computable. We obtain that ⟦ c 0 , c 0 ′ ⟧ N 0 = ⟨ c l : 0 , s r v : 0 ⟩ \llbracket c_0,c'_0\rrbracket_{N_0} = \langle\mathrm{cl} : 0,\mathrm{srv} : 0\rangle [ [ c 0 , c 0 ′ ] ] N 0 = ⟨ cl : 0 , srv : 0 ⟩ . Hence, N N N is ( x , C 1 , C 2 ) (x,C_1,C_2) ( x , C 1 , C 2 ) -safe iff ⟨ c l : 0 , s r v : 0 ⟩ ≤ x \langle\mathrm{cl} : 0,\mathrm{srv} : 0\rangle\leq x ⟨ cl : 0 , srv : 0 ⟩ ≤ x , which is decidable. In particular, N N N is ( x , C 1 , C 2 ) (x,C_1,C_2) ( x , C 1 , C 2 ) -safe for every x ∈ N 2 x \in\mathbb{N}^2 x ∈ N 2 , in contrast to the estimate ⟨ c l : ∞ , s r v : ∞ ⟩ \langle\mathrm{cl} : \infty,\mathrm{srv} : \infty\rangle ⟨ cl : ∞ , srv : ∞ ⟩ obtained by analysing the two processes separately.
Figure 13. The auxiliary network N 0 N_0 N 0 built from the network N N N of Figure 1. The states s 0 c l , s 0 s r v s^{\mathrm{cl}}_0, s^{\mathrm{srv}}_0 s 0 cl , s 0 srv bootstrap to C 1 C_1 C 1 , and the states s 0 ′ c l , s 0 ′ s r v s'^{\mathrm{cl}}_0, s'^{\mathrm{srv}}_0 s 0 ′ cl , s 0 ′ srv flush the stacks from C 2 C_2 C 2 .
Need for Closure. It is instructive to see why the downward closure of the client cannot be summarised by a single product. Name the transitions of P c l P^{\mathrm{cl}} P cl so that δ 1 \delta_1 δ 1 is its push β \beta β loop, δ 2 , δ 3 , δ 4 , δ 5 \delta_2,\delta_3,\delta_4,\delta_5 δ 2 , δ 3 , δ 4 , δ 5 are the transitions along the send route, and δ 6 , δ 7 , δ 8 \delta_6,\delta_7,\delta_8 δ 6 , δ 7 , δ 8 those along the local route. The traces from ⟨ i n c l , ⊣ ⟩ \langle in^{\mathrm{cl}},\dashv\rangle ⟨ i n cl , ⊣ ⟩ to ⟨ i d l e , ⊣ ⟩ \langle idle,\dashv\rangle ⟨ i d l e , ⊣ ⟩ then have the two shapes δ 1 n δ 2 δ 3 n δ 4 δ 5 \delta_1^n\delta_2\delta_3^n\delta_4\delta_5 δ 1 n δ 2 δ 3 n δ 4 δ 5 and δ 1 n δ 6 δ 7 n δ 8 \delta_1^n\delta_6\delta_7^n\delta_8 δ 1 n δ 6 δ 7 n δ 8 , for n ∈ N n \in\mathbb{N} n ∈ N , so that
Paths ( ⟨ i n c l , ⊣ ⟩ , ⟨ i d l e , ⊣ ⟩ ) ↓ = { δ 1 } ∗ ( ϵ + δ 2 ) { δ 3 } ∗ ( ϵ + δ 4 ) ( ϵ + δ 5 ) + { δ 1 } ∗ ( ϵ + δ 6 ) { δ 7 } ∗ ( ϵ + δ 8 ) . \operatorname{Paths}(\langle in^{\mathrm{cl}},\dashv\rangle,\langle idle,\dashv\rangle)\mathord{\downarrow} = \{\delta_1\}^{*}(\epsilon+\delta_2)\{\delta_3\}^{*}(\epsilon+\delta_4)(\epsilon+\delta_5) + \{\delta_1\}^{*}(\epsilon+\delta_6)\{\delta_7\}^{*}(\epsilon+\delta_8). Paths (⟨ i n cl , ⊣ ⟩ , ⟨ i d l e , ⊣ ⟩) ↓ = { δ 1 } ∗ ( ϵ + δ 2 ) { δ 3 } ∗ ( ϵ + δ 4 ) ( ϵ + δ 5 ) + { δ 1 } ∗ ( ϵ + δ 6 ) { δ 7 } ∗ ( ϵ + δ 8 ) .
Conclusion
In this paper, we provide a framework to solve QuantReach for wPDSs over pumping semirings. We introduce segment tree algebras, a tree-like representation of runs in a wPDS that additionally tracks the corresponding weight semantics. We then develop a saturation procedure that computes a sequence of sets of accelerated trees, and show that it reaches a fixpoint.
Our framework’s algebraic underpinnings lead us to an algorithm for a novel quantitative verification problem, namely GenConfigReach, of weighted pushdown networks. Our verification procedure crucially relies on a unified approach to the language closure computations of context-free languages, providing an alternative to the standard enumerative approach [49 ] , and additionally preserving the relationship between traces and weights. We show that GenConfigReach can be used to compute optimal bounds for safety, reachability, and cost-bounded reachability of acyclic weighted pushdown networks. We now relate our findings to prior work in three broad areas.
Algebraic Program Analysis. The research that comes closest to ours is that of interprocedural recurrence analysis by Kincaid et al. [29 ] . They extend the framework of Newtonian program analysis via tensor products [42 ] with abstraction and widening operators. Their algorithm first extracts a system of recurrence equations from the input system, followed by a Gauss-Jordan-like elimination procedure that yields an equivalent system of equations with iterated tensor applications; ours instead consumes the wPDS on the fly , forming loop summaries as it discovers them (steps (V2) and (H2)). Our goals differ, however, and so do our guarantees. Their analysis applies to any domain for which an iteration operator can be supplied, at the price of over-approximating the loop summaries, whereas ours computes them exactly, but only over pumping semirings. The difference is not merely one of precision. Their framework asks the designer of an analysis to supply that operator for each domain, and its quality determines that of the result. Condition (C1) is instead a property of the domain itself, checked once, that says when no such operator is needed: whenever it holds, the closed form a ⊛ ⊗ b ⊗ c ⊛ a^{\circledast} \otimes b \otimes c^{\circledast} a ⊛ ⊗ b ⊗ c ⊛ is the summary. Neither approach subsumes the other, but ours also extends to networks of communicating processes. Recently, Zhou et al. [50 ] proposed an algorithm to incrementally update the path expressions computed for the algebraic analysis of non-recursive programs [30 ] , in response to changes to the program under analysis. They work with a similar notion of segment trees to represent path expressions. It would be interesting to investigate whether our techniques yield an incremental algorithm for recursive programs.
Multi-Pushdown Systems. Safety verification of multi-threaded recursive programs can be modelled as the reachability problem of multi-pushdown automata (MPDA) [26 , 38 , 40 ] . Since reachability in MPDA is generally undecidable, several parametric bounds on their execution have been introduced to obtain decidability [6 , 12 , 33 , 37 , 40 ] . In [34 ] , Lal et al. provide a quantitative verification procedure for weighted MPDA over infinite weight domains (that satisfy the ACC) by bounding the number of switches between stack operations. A natural question to ask is whether our framework can be extended to verify quantitative properties of MPDA.
Network Verification. Larsen et al. [35 ] first studied the quantitative verification of finite-state networks, using a weighted extension of NetKAT. Recently, Suárez Acevedo et al. [46 ] took this further with a more conservative extension supporting automated analysis of r r r -safety and r r r -reachability properties, using techniques from finite weighted automata theory. In spirit, our work extends Suárez Acevedo et al.’s results to networks of weighted pushdown processes. Broadly, their results correspond to the cases when our network is restricted to a single process without pushdown capabilities [46 cf. Thm. 2, 3] . Although the class of thin pumping semirings differs from their restrictions, our results subsume their concrete instances [46 Sec. 6] . Our techniques may also yield decision procedures for a weighted extension of StacKAT, corresponding to a single weighted pushdown process whose stack simulates the current packet; we leave this to future work.
Our contribution is primarily theoretical; a practical implementation and an experimental evaluation of its scalability and performance through case studies remain our next steps.
Disclosure of Use of AI in Research
A generative AI software tool (Claude, Opus 5.5) was used for finding typographical and grammatical errors in our paper, and for help producing the TikZ code used in two figures.
Data Availability Statement
Our work proposes a generic methodology for the verification of weighted pushdown systems, and their networks. For a rigorous presentation of our results, we have introduced several non-trivial, albeit theoretical, gadgets. Consequently, an implementation is outside the scope of this paper, and stays as an important future task. Hence, our paper does not constitute an artifact.
References
A Proof of Proposition 3.2
Proof. We will write e : = 1 ⊛ e := 1^{\circledast} e := 1 ⊛ . Instantiating (C1) at a = c = b = 1 a = c = b = 1 a = c = b = 1 yields
e ⊗ e = e ⊗ 1 ⊗ e = ⨁ n ∈ N 1 n ⊗ 1 ⊗ 1 n = 1. e \otimes e = e \otimes1 \otimes e = \bigoplus_{n \in\mathbb{N}} 1^n \otimes1 \otimes1^n = 1. e ⊗ e = e ⊗ 1 ⊗ e = n ∈ N ⨁ 1 n ⊗ 1 ⊗ 1 n = 1.
In particular, e ≠ 0 e \ne0 e = 0 , as otherwise 0 = 1 0 = 1 0 = 1 ; moreover, the powers of e e e alternate: e 2 n = 1 e^{2n} = 1 e 2 n = 1 , and e 2 n + 1 = e e^{2n+1} = e e 2 n + 1 = e , for every n ∈ N n \in\mathbb{N} n ∈ N . Since e ≠ 0 e \ne0 e = 0 , we may instantiate (C1) at a = e a = e a = e twice, once with c = 1 c = 1 c = 1 and b = 1 b = 1 b = 1 , and once with c = e c = e c = e and b = 1 b = 1 b = 1 :
e ⊛ ⊗ e = ⨁ n ∈ N e n = 1 ⊕ e , e ⊛ ⊗ e ⊛ = ⨁ n ∈ N e 2 n = 1. e^{\circledast} \otimes e = \bigoplus_{n \in\mathbb{N}} e^n = 1 \oplus e,\qquad e^{\circledast} \otimes e^{\circledast} = \bigoplus_{n \in\mathbb{N}} e^{2n} = 1. e ⊛ ⊗ e = n ∈ N ⨁ e n = 1 ⊕ e , e ⊛ ⊗ e ⊛ = n ∈ N ⨁ e 2 n = 1.
Multiplying the first identity on the right by e e e gives e ⊛ = e ⊛ ⊗ ( e ⊗ e ) = ( 1 ⊕ e ) ⊗ e = e ⊕ 1 e^{\circledast} = e^{\circledast} \otimes(e \otimes e) = (1 \oplus e) \otimes e = e \oplus1 e ⊛ = e ⊛ ⊗ ( e ⊗ e ) = ( 1 ⊕ e ) ⊗ e = e ⊕ 1 . Substituting this into the second identity, and using the idempotence of ⊕ \oplus ⊕ together with e ⊗ e = 1 e \otimes e = 1 e ⊗ e = 1 , we obtain
1 = ( 1 ⊕ e ) ⊗ ( 1 ⊕ e ) = 1 ⊕ e ⊕ e ⊕ ( e ⊗ e ) = 1 ⊕ e , 1 = (1 \oplus e) \otimes(1 \oplus e) = 1 \oplus e \oplus e \oplus(e \otimes e) = 1 \oplus e, 1 = ( 1 ⊕ e ) ⊗ ( 1 ⊕ e ) = 1 ⊕ e ⊕ e ⊕ ( e ⊗ e ) = 1 ⊕ e ,
that is, e ≤ S 1 e \leq_S 1 e ≤ S 1 . By the monotonicity of ⊗ \otimes ⊗ , $1 = e \otimes e \leq_S 1 \otimes e = e$. Since ≤ S \leq_S ≤ S is a partial order, e = 1 e = 1 e = 1 .
For the second claim, instantiating (C1) at c = b = 1 c = b = 1 c = b = 1 gives ⨁ n ∈ N a n = a ⊛ ⊗ 1 ⊛ = a ⊛ \bigoplus_{n \in\mathbb{N}} a^n = a^{\circledast} \otimes1^{\circledast} = a^{\circledast} ⨁ n ∈ N a n = a ⊛ ⊗ 1 ⊛ = a ⊛ , for every a ∈ S ∖ { 0 } a \in S \setminus\{0\} a ∈ S ∖ { 0 } . □
B Proof of Lemma 4.1
Proof. Suppose [ G ] T ⊊ ⋃ i ∈ N G i [G]_T \subsetneq\bigcup_{i \in\mathbb{N}} G_i [ G ] T ⊊ ⋃ i ∈ N G i , for the sake of contradiction. Let i ∈ N i \in\mathbb{N} i ∈ N be the smallest index such that for some L T ∈ FTree ( S ) L_T \in\operatorname{FTree}(S) L T ∈ FTree ( S ) , L T ∈ G i L_T \in G_i L T ∈ G i and L T ∉ [ G ] T L_T \notin[G]_T L T ∈ / [ G ] T . By our initial assumption, such an index must exist. Now, by definition of G i G_i G i , L T ∈ G i , v ∪ G i , h L_T \in G_{i,v} \cup G_{i,h} L T ∈ G i , v ∪ G i , h . Indeed, if L T ∈ G i − 1 L_T \in G_{i-1} L T ∈ G i − 1 , then we have found a smaller index ( i − 1 ) (i - 1) ( i − 1 ) such that L T ∈ G i − 1 ∖ [ G ] T L_T \in G_{i-1} \setminus[G]_T L T ∈ G i − 1 ∖ [ G ] T , which is a contradiction.
Suppose L T ∈ G i , v L_T \in G_{i,v} L T ∈ G i , v . By definition, there exist x ∈ X x \in X x ∈ X and L T ′ ∈ G i − 1 L_T' \in G_{i-1} L T ′ ∈ G i − 1 such that L T = v ( x , L T ′ ) L_T = v(x,L_T') L T = v ( x , L T ′ ) . Since L T ′ ∈ [ G ] T L_T' \in[G]_T L T ′ ∈ [ G ] T by our assumption, once again by definition L T = v ( x , L T ′ ) ∈ [ G ] T L_T = v(x,L_T') \in[G]_T L T = v ( x , L T ′ ) ∈ [ G ] T . This leads to a contradiction. Similarly, the case of L T ∈ G i , h L_T \in G_{i,h} L T ∈ G i , h leads to a contradiction. Hence, i i i cannot exist. □
C Proof of Lemma 4.5
Proof. ( ⇒ ) (\Rightarrow) ( ⇒ ) Let ⟨ T , σ ⟩ ∈ [ Init ] F C \langle T,\sigma\rangle\in[\operatorname{Init}]_{\mathcal{F}_C} ⟨ T , σ ⟩ ∈ [ Init ] F C be arbitrary such that σ ( ϵ ) = ⟨ ⟨ p , q ⟩ , a ⟩ \sigma(\epsilon) = \langle\langle p,q\rangle,a\rangle σ ( ϵ ) = ⟨⟨ p , q ⟩ , a ⟩ . Then there exists j ∈ N j \in\mathbb{N} j ∈ N such that ⟨ T , σ ⟩ ∈ G j \langle T,\sigma\rangle\in G_j ⟨ T , σ ⟩ ∈ G j . It suffices to prove that the forward direction holds for arbitrary j j j . We proceed by induction on j j j . The claim holds by definition when j = 0 j = 0 j = 0 . Let j > 0 j > 0 j > 0 . We now do a case-by-case analysis:
Suppose there exist δ 1 , δ 2 ∈ Trans \delta_1,\delta_2 \in\operatorname{Trans} δ 1 , δ 2 ∈ Trans , and ⟨ T ′ , σ ′ ⟩ ∈ G j − 1 \langle T',\sigma'\rangle\in G_{j-1} ⟨ T ′ , σ ′ ⟩ ∈ G j − 1 where σ ′ ( ϵ ) = ⟨ ⟨ p ′ , q ′ ⟩ , a ′ ⟩ \sigma'(\epsilon) = \langle\langle p',q'\rangle,a'\rangle σ ′ ( ϵ ) = ⟨⟨ p ′ , q ′ ⟩ , a ′ ⟩ , such that ⟨ T , σ ⟩ = v C ( ⟨ δ 1 , δ 2 ⟩ , ⟨ T ′ , σ ′ ⟩ ) \langle T,\sigma\rangle= v_C(\langle\delta_1,\delta_2\rangle,\langle T',\sigma'\rangle) ⟨ T , σ ⟩ = v C (⟨ δ 1 , δ 2 ⟩ , ⟨ T ′ , σ ′ ⟩) . By definition of v C v_C v C , δ 1 = ⟨ p , e , u 1 , α , p ′ ⟩ \delta_1 = \langle p,e,u_1,\alpha,p'\rangle δ 1 = ⟨ p , e , u 1 , α , p ′ ⟩ , and δ 2 = ⟨ q ′ , α , u 2 , e , q ⟩ \delta_2 = \langle q',\alpha,u_2,e,q\rangle δ 2 = ⟨ q ′ , α , u 2 , e , q ⟩ for some α ∈ Γ \alpha\in\Gamma α ∈ Γ , and a = wt ( δ 1 ) ⊗ a ′ ⊗ wt ( δ 2 ) a = \operatorname{wt}(\delta_1) \otimes a' \otimes\operatorname{wt}(\delta_2) a = wt ( δ 1 ) ⊗ a ′ ⊗ wt ( δ 2 ) . By our hypothesis, there exists τ ′ ∈ Paths ( ⟨ p ′ , λ ⟩ , ⟨ q ′ , λ ⟩ ) \tau' \in\operatorname{Paths}(\langle p',\lambda\rangle,\langle q',\lambda\rangle) τ ′ ∈ Paths (⟨ p ′ , λ ⟩ , ⟨ q ′ , λ ⟩) such that wt ∗ ( τ ′ ) = a ′ \operatorname{wt}^*(\tau') = a' wt ∗ ( τ ′ ) = a ′ . It follows that δ 1 τ ′ δ 2 ∈ Paths ( ⟨ p , λ ⟩ , ⟨ q , λ ⟩ ) \delta_1\tau'\delta_2 \in\operatorname{Paths}(\langle p,\lambda\rangle,\langle q,\lambda\rangle) δ 1 τ ′ δ 2 ∈ Paths (⟨ p , λ ⟩ , ⟨ q , λ ⟩) , and wt ∗ ( δ 1 τ ′ δ 2 ) = a \operatorname{wt}^*(\delta_1\tau'\delta_2) = a wt ∗ ( δ 1 τ ′ δ 2 ) = a .
(ii) Otherwise, there exist ⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩ ∈ G j − 1 \langle T_1,\sigma_1\rangle,\langle T_2,\sigma_2\rangle\in G_{j-1} ⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩ ∈ G j − 1 such that ⟨ T , σ ⟩ = h C ( ⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩ ) \langle T,\sigma\rangle= h_C(\langle T_1,\sigma_1\rangle,\langle T_2,\sigma_2\rangle) ⟨ T , σ ⟩ = h C (⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩) . By definition, σ 1 ( ϵ ) = ⟨ ⟨ p , p ′ ⟩ , a 1 ⟩ \sigma_1(\epsilon)=\langle\langle p,p'\rangle,a_1\rangle σ 1 ( ϵ ) = ⟨⟨ p , p ′ ⟩ , a 1 ⟩ , and σ 2 ( ϵ ) = ⟨ ⟨ p ′ , q ⟩ , a 2 ⟩ \sigma_2(\epsilon)=\langle\langle p',q\rangle,a_2\rangle σ 2 ( ϵ ) = ⟨⟨ p ′ , q ⟩ , a 2 ⟩ for some p ′ ∈ Q p'\in Q p ′ ∈ Q and a 1 , a 2 ∈ S a_1,a_2\in S a 1 , a 2 ∈ S such that a = a 1 ⊗ a 2 a=a_1\otimes a_2 a = a 1 ⊗ a 2 . By our hypothesis, there exist τ 1 ∈ Paths ( ⟨ p , ⊣ ⟩ , ⟨ p ′ , ⊣ ⟩ ) \tau_1\in\operatorname{Paths}(\langle p,\dashv\rangle,\langle p',\dashv\rangle) τ 1 ∈ Paths (⟨ p , ⊣ ⟩ , ⟨ p ′ , ⊣ ⟩) , and τ 2 ∈ Paths ( ⟨ p ′ , ⊣ ⟩ , ⟨ q , ⊣ ⟩ ) \tau_2\in\operatorname{Paths}(\langle p',\dashv\rangle,\langle q,\dashv\rangle) τ 2 ∈ Paths (⟨ p ′ , ⊣ ⟩ , ⟨ q , ⊣ ⟩) such that wt ∗ ( τ i ) = a i \operatorname{wt}^{*}(\tau_i)=a_i wt ∗ ( τ i ) = a i for i ∈ [ 2 ] i\in[2] i ∈ [ 2 ] . Once again, it follows that τ 1 τ 2 ∈ Paths ( ⟨ p , ⊣ ⟩ , ⟨ q , ⊣ ⟩ ) \tau_1\tau_2\in\operatorname{Paths}(\langle p,\dashv\rangle,\langle q,\dashv\rangle) τ 1 τ 2 ∈ Paths (⟨ p , ⊣ ⟩ , ⟨ q , ⊣ ⟩) , and wt ∗ ( τ 1 τ 2 ) = a \operatorname{wt}^{*}(\tau_1\tau_2)=a wt ∗ ( τ 1 τ 2 ) = a .
( ⇐ ) (\Leftarrow) ( ⇐ ) Assume τ ∈ Paths ( ⟨ p , ⊣ ⟩ , ⟨ q , ⊣ ⟩ ) \tau\in\operatorname{Paths}(\langle p,\dashv\rangle,\langle q,\dashv\rangle) τ ∈ Paths (⟨ p , ⊣ ⟩ , ⟨ q , ⊣ ⟩) such that wt ∗ ( τ ) = a \operatorname{wt}^{*}(\tau)=a wt ∗ ( τ ) = a . We proceed by induction on ∣ τ ∣ |\tau| ∣ τ ∣ . The property trivially holds for the case τ = ϵ \tau=\epsilon τ = ϵ , forcing p = q p=q p = q .
Suppose τ = τ ′ τ ′ ′ \tau=\tau'\tau'' τ = τ ′ τ ′′ for some non-empty τ ′ ∈ Paths ( ⟨ p , ⊣ ⟩ , ⟨ p ′ , ⊣ ⟩ ) \tau'\in\operatorname{Paths}(\langle p,\dashv\rangle,\langle p',\dashv\rangle) τ ′ ∈ Paths (⟨ p , ⊣ ⟩ , ⟨ p ′ , ⊣ ⟩) , and non-empty τ ′ ′ ∈ Paths ( ⟨ p ′ , ⊣ ⟩ , ⟨ q , ⊣ ⟩ ) \tau''\in\operatorname{Paths}(\langle p',\dashv\rangle,\langle q,\dashv\rangle) τ ′′ ∈ Paths (⟨ p ′ , ⊣ ⟩ , ⟨ q , ⊣ ⟩) . Then, a = wt ∗ ( τ ) = wt ∗ ( τ ′ ) wt ∗ ( τ ′ ′ ) a=\operatorname{wt}^{*}(\tau)=\operatorname{wt}^{*}(\tau')\operatorname{wt}^{*}(\tau'') a = wt ∗ ( τ ) = wt ∗ ( τ ′ ) wt ∗ ( τ ′′ ) . By our hypothesis, there exist ⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩ ∈ [ Init ] F C \langle T_1,\sigma_1\rangle,\langle T_2,\sigma_2\rangle\in[\operatorname{Init}]_{\mathcal{F}_C} ⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩ ∈ [ Init ] F C such that σ 1 ( ϵ ) = ⟨ ⟨ p , p ′ ⟩ , wt ∗ ( τ ′ ) ⟩ \sigma_1(\epsilon)=\langle\langle p,p'\rangle,\operatorname{wt}^{*}(\tau')\rangle σ 1 ( ϵ ) = ⟨⟨ p , p ′ ⟩ , wt ∗ ( τ ′ )⟩ , and σ 2 ( ϵ ) = ⟨ ⟨ p ′ , q ⟩ , wt ∗ ( τ ′ ′ ) ⟩ \sigma_2(\epsilon)=\langle\langle p',q\rangle,\operatorname{wt}^{*}(\tau'')\rangle σ 2 ( ϵ ) = ⟨⟨ p ′ , q ⟩ , wt ∗ ( τ ′′ )⟩ . Then by definition of ideals there exists ⟨ T , σ ⟩ = h C ( ⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩ ) ∈ [ Init ] F C \langle T,\sigma\rangle=h_C(\langle T_1,\sigma_1\rangle,\langle T_2,\sigma_2\rangle)\in[\operatorname{Init}]_{\mathcal{F}_C} ⟨ T , σ ⟩ = h C (⟨ T 1 , σ 1 ⟩ , ⟨ T 2 , σ 2 ⟩) ∈ [ Init ] F C where σ ( ϵ ) = ⟨ ⟨ p , q ⟩ , wt ∗ ( τ ′ ) wt ∗ ( τ ′ ′ ) ⟩ = ⟨ ⟨ p , q ⟩ , a ⟩ \sigma(\epsilon)=\langle\langle p,q\rangle,\operatorname{wt}^{*}(\tau')\operatorname{wt}^{*}(\tau'')\rangle=\langle\langle p,q\rangle,a\rangle σ ( ϵ ) = ⟨⟨ p , q ⟩ , wt ∗ ( τ ′ ) wt ∗ ( τ ′′ )⟩ = ⟨⟨ p , q ⟩ , a ⟩ .
Now suppose there exist no such non-empty runs τ ′ \tau' τ ′ and τ ′ ′ \tau'' τ ′′ . Then there must exist transitions δ 1 = ⟨ p , ϵ , u 1 , α , p ′ ⟩ \delta_1=\langle p,\epsilon,u_1,\alpha,p'\rangle δ 1 = ⟨ p , ϵ , u 1 , α , p ′ ⟩ , δ 2 = ⟨ q ′ , α , u 2 , ϵ , q ⟩ \delta_2=\langle q',\alpha,u_2,\epsilon,q\rangle δ 2 = ⟨ q ′ , α , u 2 , ϵ , q ⟩ , with ⟨ p ′ , ⊣ ⟩ ⇒ ∗ ⟨ q ′ , ⊣ ⟩ \langle p',\dashv\rangle\Rightarrow^{*}\langle q',\dashv\rangle ⟨ p ′ , ⊣ ⟩ ⇒ ∗ ⟨ q ′ , ⊣ ⟩ , such that
⟨ p , ⊣ ⟩ ⇒ δ 1 ⟨ p ′ , α ⊣ ⟩ ⇒ ∗ ⟨ q ′ , α ⊣ ⟩ ⇒ δ 2 ⟨ q , ⊣ ⟩ \langle p,\dashv\rangle\mathrel{\xRightarrow{\delta_1}} \langle p',\alpha\dashv\rangle\Rightarrow^{*} \langle q',\alpha\dashv\rangle\mathrel{\xRightarrow{\delta_2}} \langle q,\dashv\rangle ⟨ p , ⊣ ⟩ δ 1 ⟨ p ′ , α ⊣ ⟩ ⇒ ∗ ⟨ q ′ , α ⊣ ⟩ δ 2 ⟨ q , ⊣ ⟩
This follows from the simple inductive property Paths ( ⟨ p ′ , ⊣ ⟩ , ⟨ q ′ , ⊣ ⟩ ) ⊆ Paths ( ⟨ p ′ , α ⊣ ⟩ , ⟨ q ′ , α ⊣ ⟩ ) \operatorname{Paths}(\langle p',\dashv\rangle,\langle q',\dashv\rangle)\subseteq\operatorname{Paths}(\langle p',\alpha\dashv\rangle,\langle q',\alpha\dashv\rangle) Paths (⟨ p ′ , ⊣ ⟩ , ⟨ q ′ , ⊣ ⟩) ⊆ Paths (⟨ p ′ , α ⊣ ⟩ , ⟨ q ′ , α ⊣ ⟩) . Intuitively, we claim that there must exist a run from ⟨ p ′ , α ⊣ ⟩ \langle p',\alpha\dashv\rangle ⟨ p ′ , α ⊣ ⟩ to ⟨ q ′ , α ⊣ ⟩ \langle q',\alpha\dashv\rangle ⟨ q ′ , α ⊣ ⟩ that does not contain a configuration with just ⊣ \dashv ⊣ in the stack. Indeed, otherwise there must exist a configuration of the form ⟨ p ′ ′ , ⊣ ⟩ \langle p'',\dashv\rangle ⟨ p ′′ , ⊣ ⟩ in every run from ⟨ p ′ , α ⊣ ⟩ \langle p',\alpha\dashv\rangle ⟨ p ′ , α ⊣ ⟩ to ⟨ q ′ , α ⊣ ⟩ \langle q',\alpha\dashv\rangle ⟨ q ′ , α ⊣ ⟩ , i.e., Paths ( ⟨ p ′ , ⊣ ⟩ , ⟨ q ′ , ⊣ ⟩ ) = ∅ \operatorname{Paths}(\langle p',\dashv\rangle,\langle q',\dashv\rangle)=\varnothing Paths (⟨ p ′ , ⊣ ⟩ , ⟨ q ′ , ⊣ ⟩) = ∅ , which contradicts our assumption. Hence, τ \tau τ is of the form δ 1 τ ′ δ 2 \delta_1\tau'\delta_2 δ 1 τ ′ δ 2 for some τ ′ ∈ Paths ( ⟨ p ′ , ⊣ ⟩ , ⟨ q ′ , ⊣ ⟩ ) \tau'\in\operatorname{Paths}(\langle p',\dashv\rangle,\langle q',\dashv\rangle) τ ′ ∈ Paths (⟨ p ′ , ⊣ ⟩ , ⟨ q ′ , ⊣ ⟩) .
By our hypothesis, we can thus obtain a C C C -labelled tree ⟨ T ′ , σ ′ ⟩ ∈ [ Init ] F C \langle T',\sigma'\rangle\in[\operatorname{Init}]_{\mathcal{F}_C} ⟨ T ′ , σ ′ ⟩ ∈ [ Init ] F C such that σ ′ ( ϵ ) = ⟨ ⟨ p ′ , q ′ ⟩ , a ′ ⟩ \sigma'(\epsilon)=\langle\langle p',q'\rangle,a'\rangle σ ′ ( ϵ ) = ⟨⟨ p ′ , q ′ ⟩ , a ′ ⟩ , where a ′ = wt ∗ ( τ ′ ) a'=\operatorname{wt}^{*}(\tau') a ′ = wt ∗ ( τ ′ ) . By definition of ideals, we obtain ⟨ T , σ ⟩ = v C ( ⟨ δ 1 , δ 2 ⟩ , ⟨ T ′ , σ ′ ⟩ ) ∈ [ Init ] F C \langle T,\sigma\rangle=v_C(\langle\delta_1,\delta_2\rangle,\langle T',\sigma'\rangle)\in[\operatorname{Init}]_{\mathcal{F}_C} ⟨ T , σ ⟩ = v C (⟨ δ 1 , δ 2 ⟩ , ⟨ T ′ , σ ′ ⟩) ∈ [ Init ] F C where σ ( ϵ ) = ⟨ ⟨ p , q ⟩ , wt ∗ ( δ 1 ) a ′ wt ∗ ( δ 2 ) ⟩ = ⟨ ⟨ p , q ⟩ , wt ∗ ( τ ) ⟩ \sigma(\epsilon)=\langle\langle p,q\rangle,\operatorname{wt}^{*}(\delta_1)a'\operatorname{wt}^{*}(\delta_2)\rangle=\langle\langle p,q\rangle,\operatorname{wt}^{*}(\tau)\rangle σ ( ϵ ) = ⟨⟨ p , q ⟩ , wt ∗ ( δ 1 ) a ′ wt ∗ ( δ 2 )⟩ = ⟨⟨ p , q ⟩ , wt ∗ ( τ )⟩ . □
Proof of Correctness and Termination
Correctness
To prove (P2), it suffices to prove the following statement using induction:
Lemma D.1. Let ⟨ T , σ ⟩ ∈ G i \langle T,\sigma\rangle\in G_i ⟨ T , σ ⟩ ∈ G i , for i ∈ N i\in\mathbb{N} i ∈ N . There exists ⟨ T ′ , σ ′ ⟩ ∈ H i \langle T',\sigma'\rangle\in H_i ⟨ T ′ , σ ′ ⟩ ∈ H i such that σ ( ϵ ) ≤ C fgt σ ′ ( ϵ ) \sigma(\epsilon)\le_C \operatorname{fgt}_{\sigma'}(\epsilon) σ ( ϵ ) ≤ C fgt σ ′ ( ϵ ) .
Proof. Let ⟨ T , σ ⟩ ∈ G i \langle T,\sigma\rangle\in G_i ⟨ T , σ ⟩ ∈ G i . We proceed by induction on i ∈ N i\in\mathbb{N} i ∈ N . If i = 0 i=0 i = 0 , then the above statement holds by definition.
Suppose i > 0 i>0 i > 0 . Assume ⟨ T , σ ⟩ ∈ G i , v \langle T,\sigma\rangle\in G_{i,v} ⟨ T , σ ⟩ ∈ G i , v . Let σ ( ϵ ) = ⟨ ⟨ p , q ⟩ , a ⟩ \sigma(\epsilon)=\langle\langle p,q\rangle,a\rangle σ ( ϵ ) = ⟨⟨ p , q ⟩ , a ⟩ . By definition, there exist a tuple ⟨ δ 1 , δ 2 ⟩ ∈ Trans 2 \langle\delta_1,\delta_2\rangle\in\operatorname{Trans}^2 ⟨ δ 1 , δ 2 ⟩ ∈ Trans 2 of transitions and a tree ⟨ T 1 , σ 1 ⟩ ∈ G i − 1 \langle T_1,\sigma_1\rangle\in G_{i-1} ⟨ T 1 , σ 1 ⟩ ∈ G i − 1 where σ 1 ( ϵ ) = ⟨ ⟨ p 1 , q 1 ⟩ , a 1 ⟩ \sigma_1(\epsilon)=\langle\langle p_1,q_1\rangle,a_1\rangle σ 1 ( ϵ ) = ⟨⟨ p 1 , q 1 ⟩ , a 1 ⟩ , such that v C ( ⟨ δ 1 , δ 2 ⟩ , ⟨ T 1 , σ 1 ⟩ ) = ⟨ T , σ ⟩ v_C(\langle\delta_1,\delta_2\rangle,\langle T_1,\sigma_1\rangle)=\langle T,\sigma\rangle v C (⟨ δ 1 , δ 2 ⟩ , ⟨ T 1 , σ 1 ⟩) = ⟨ T , σ ⟩ , and a = wt ( δ 1 ) a 1 wt ( δ 2 ) a=\operatorname{wt}(\delta_1)a_1\operatorname{wt}(\delta_2) a = wt ( δ 1 ) a 1 wt ( δ 2 ) .
By our hypothesis, there exists ⟨ T 1 ′ , σ 1 ′ ⟩ ∈ H i − 1 \langle T_1',\sigma_1'\rangle\in H_{i-1} ⟨ T 1 ′ , σ 1 ′ ⟩ ∈ H i − 1 such that σ 1 ( ϵ ) ≤ C fgt σ 1 ′ ( ϵ ) \sigma_1(\epsilon)\le_C\operatorname{fgt}_{\sigma_1'}(\epsilon) σ 1 ( ϵ ) ≤ C fgt σ 1 ′ ( ϵ ) . Let σ 1 ′ ( ϵ ) = ⟨ ⟨ p 1 , q 1 ⟩ , x 1 ⟩ \sigma_1'(\epsilon)=\langle\langle p_1,q_1\rangle,x_1\rangle σ 1 ′ ( ϵ ) = ⟨⟨ p 1 , q 1 ⟩ , x 1 ⟩ . By assumption, H i , v H_{i,v} H i , v is non-empty. As per the definition of H i , v H_{i,v} H i , v , we may choose ⟨ T 1 ′ , σ 1 ′ ⟩ \langle T_1',\sigma_1'\rangle ⟨ T 1 ′ , σ 1 ′ ⟩ such that one of the following three cases holds:
Case (V1). There exists t ∈ T 1 ′ t\in T_1' t ∈ T 1 ′ such that wt ( δ 1 ) ⋅ # ⋅ x 1 ⋅ # ⋅ wt ( δ 2 ) = ⟦ σ 1 ′ ( t ) ⟧ \operatorname{wt}(\delta_1)\cdot\#\cdot x_1\cdot\#\cdot\operatorname{wt}(\delta_2)=\llbracket\sigma_1'(t)\rrbracket wt ( δ 1 ) ⋅ # ⋅ x 1 ⋅ # ⋅ wt ( δ 2 ) = [ [ σ 1 ′ ( t ) ] ] , and we can define ⟨ T ′ , σ ′ ⟩ = t − 1 ⟨ T 1 ′ , σ 1 ′ ⟩ ∈ H i , v \langle T',\sigma'\rangle=t^{-1}\langle T_1',\sigma_1'\rangle\in H_{i,v} ⟨ T ′ , σ ′ ⟩ = t − 1 ⟨ T 1 ′ , σ 1 ′ ⟩ ∈ H i , v . In particular, we have σ ( ϵ ) = fgt t − 1 σ ′ ( ϵ ) \sigma(\epsilon)=\operatorname{fgt}_{t^{-1}\sigma'}(\epsilon) σ ( ϵ ) = fgt t − 1 σ ′ ( ϵ ) .
Case (V2). Some t ∈ T 1 ′ t\in T_1' t ∈ T 1 ′ is the smallest node such that st ( σ 1 ′ ( t ) ) = st ( σ ( ϵ ) ) \operatorname{st}(\sigma_1'(t))=\operatorname{st}(\sigma(\epsilon)) st ( σ 1 ′ ( t )) = st ( σ ( ϵ )) , wt ( δ 1 ) ⋅ # ⋅ x 1 ⋅ # ⋅ wt ( δ 2 ) = y 1 ⋅ ⟦ σ 1 ′ ( t ) ⟧ ⋅ y 2 \operatorname{wt}(\delta_1)\cdot\#\cdot x_1\cdot\#\cdot\operatorname{wt}(\delta_2)=y_1\cdot\llbracket\sigma_1'(t)\rrbracket\cdot y_2 wt ( δ 1 ) ⋅ # ⋅ x 1 ⋅ # ⋅ wt ( δ 2 ) = y 1 ⋅ [ [ σ 1 ′ ( t ) ] ] ⋅ y 2 , for some computable non-empty y 1 , y 2 ∈ Ths y_1,y_2\in\operatorname{Ths} y 1 , y 2 ∈ Ths . We can define T ′ = t − 1 T 1 ′ T'=t^{-1}T_1' T ′ = t − 1 T 1 ′ , and σ ′ ( t ′ ) = σ 1 ′ ( t ⋅ t ′ ) \sigma'(t')=\sigma_1'(t\cdot t') σ ′ ( t ′ ) = σ 1 ′ ( t ⋅ t ′ ) for t ′ ∈ T ′ ∖ { ϵ } t'\in T'\setminus\{\epsilon\} t ′ ∈ T ′ ∖ { ϵ } . If ⟦ σ 1 ′ ( t ) ⟧ = l ^ ⋅ x 1 ′ ⋅ r ^ \llbracket\sigma_1'(t)\rrbracket=\hat{l}\cdot x_1'\cdot\hat{r} [ [ σ 1 ′ ( t ) ] ] = l ^ ⋅ x 1 ′ ⋅ r ^ then we define σ ′ ( ϵ ) : = ⟨ ⟨ p , q ⟩ , ( y 1 ⋅ l ^ ) ⋆ ⋅ x 1 ′ ⋅ ( r ^ ⋅ y 2 ) ⋆ ⟩ \sigma'(\epsilon):=\langle\langle p,q\rangle,(y_1\cdot\hat{l})^{\star}\cdot x_1'\cdot(\hat{r}\cdot y_2)^{\star}\rangle σ ′ ( ϵ ) := ⟨⟨ p , q ⟩ , ( y 1 ⋅ l ^ ) ⋆ ⋅ x 1 ′ ⋅ ( r ^ ⋅ y 2 ) ⋆ ⟩ , otherwise σ ′ ( ϵ ) : = ⟨ ⟨ p , q ⟩ , y 1 ⋆ ⋅ ⟦ σ 1 ′ ( t ) ⟧ ⋅ y 2 ⋆ ⟩ \sigma'(\epsilon):=\langle\langle p,q\rangle,y_1^{\star}\cdot\llbracket\sigma_1'(t)\rrbracket\cdot y_2^{\star}\rangle σ ′ ( ϵ ) := ⟨⟨ p , q ⟩ , y 1 ⋆ ⋅ [ [ σ 1 ′ ( t ) ] ] ⋅ y 2 ⋆ ⟩ . We treat the second case, writing x 1 ′ = ⟦ σ 1 ′ ⟧ x'_1 = \llbracket\sigma'_1 \rrbracket x 1 ′ = [ [ σ 1 ′ ] ] ; the first case is analogous, with y 1 ⋅ l ^ y_1 \cdot\hat{l} y 1 ⋅ l ^ and r ^ ⋅ y 2 \hat{r} \cdot y_2 r ^ ⋅ y 2 in place of y 1 y_1 y 1 and y 2 y_2 y 2 . Then, we have
a = wt ( δ 1 ) a wt ( δ 2 ) ≤ S wt ( δ 1 ) fgt ( x 1 ) wt ( δ 2 ) = fgt ( wt ( δ 1 ) ⋅ # ⋅ x 1 ⋅ # ⋅ wt ( δ 2 ) ) = fgt ( y 1 ⋅ x 1 ′ ⋅ y 2 ) . a = \operatorname{wt}(\delta_1)a\operatorname{wt}(\delta_2) \leq_S \operatorname{wt}(\delta_1)\operatorname{fgt}(x_1)\operatorname{wt}(\delta_2) = \operatorname{fgt}\bigl(\operatorname{wt}(\delta_1)\cdot\#\cdot x_1\cdot\#\cdot\operatorname{wt}(\delta_2)\bigr) = \operatorname{fgt}(y_1\cdot x'_1\cdot y_2). a = wt ( δ 1 ) a wt ( δ 2 ) ≤ S wt ( δ 1 ) fgt ( x 1 ) wt ( δ 2 ) = fgt ( wt ( δ 1 ) ⋅ # ⋅ x 1 ⋅ # ⋅ wt ( δ 2 ) ) = fgt ( y 1 ⋅ x 1 ′ ⋅ y 2 ) .
The inequality follows from σ 1 ( ϵ ) ≤ C fgt σ 1 ′ ( ϵ ) \sigma_1(\epsilon) \leq_C \operatorname{fgt}_{\sigma'_1}(\epsilon) σ 1 ( ϵ ) ≤ C fgt σ 1 ′ ( ϵ ) . By property (C1), we also have,
fgt ( y 1 ⋅ x 1 ′ ⋅ y 2 ) ≤ S fgt ( y 1 ) ⊗ fgt ( x 1 ′ ) ⊗ fgt ( y 2 ) = fgt ( y 1 ⋆ ⋅ x 1 ′ ⋅ y 2 ⋆ ) . \operatorname{fgt}(y_1\cdot x'_1\cdot y_2) \leq_S \operatorname{fgt}(y_1) \otimes\operatorname{fgt}(x'_1) \otimes\operatorname{fgt}(y_2) = \operatorname{fgt}(y_1^\star\cdot x'_1\cdot y_2^\star). fgt ( y 1 ⋅ x 1 ′ ⋅ y 2 ) ≤ S fgt ( y 1 ) ⊗ fgt ( x 1 ′ ) ⊗ fgt ( y 2 ) = fgt ( y 1 ⋆ ⋅ x 1 ′ ⋅ y 2 ⋆ ) .
Hence, σ ( ϵ ) ≤ C fgt σ 1 ′ ( ϵ ) \sigma(\epsilon) \leq_C \operatorname{fgt}_{\sigma'_1}(\epsilon) σ ( ϵ ) ≤ C fgt σ 1 ′ ( ϵ ) .
Case (V3). Otherwise, we define T ′ = 1 ⋅ T 1 ′ ∪ { ϵ } T' = 1\cdot T'_1 \cup\{\epsilon\} T ′ = 1 ⋅ T 1 ′ ∪ { ϵ } , σ ′ ( ϵ ) = ⟨ ⟨ p , q ⟩ , wt ( δ 1 ) ⋅ # ⋅ x 1 ⋅ # ⋅ wt ( δ 2 ) ⟩ \sigma'(\epsilon) = \langle\langle p,q\rangle,\operatorname{wt}(\delta_1)\cdot\#\cdot x_1\cdot\#\cdot\operatorname{wt}(\delta_2)\rangle σ ′ ( ϵ ) = ⟨⟨ p , q ⟩ , wt ( δ 1 ) ⋅ # ⋅ x 1 ⋅ # ⋅ wt ( δ 2 )⟩ , and σ ′ ( 1 ⋅ t ′ ) = σ 1 ′ ( t ′ ) \sigma'(1\cdot t')=\sigma'_1(t') σ ′ ( 1 ⋅ t ′ ) = σ 1 ′ ( t ′ ) for t ′ ∈ T 1 ′ t'\in T'_1 t ′ ∈ T 1 ′ .
We can conduct a similar case-by-case analysis when ⟨ T , σ ⟩ ∈ G i , h \langle T,\sigma\rangle\in G_{i,h} ⟨ T , σ ⟩ ∈ G i , h .
Proving property (P3) is relatively non-trivial. We will need the following auxiliary lemma for our proof:
Lemma D.2. Let ⟨ T , σ ⟩ ∈ H i + 1 \langle T,\sigma\rangle\in H_{i+1} ⟨ T , σ ⟩ ∈ H i + 1 be arbitrary, where i ∈ N i\in\mathbb{N} i ∈ N , and ⟦ σ ( ϵ ) ⟧ \llbracket\sigma(\epsilon)\rrbracket [ [ σ ( ϵ ) ] ] is of the form l ^ ⋅ x ⋅ r ^ \hat{l}\cdot x\cdot\hat{r} l ^ ⋅ x ⋅ r ^ . Then the tree ⟨ T , σ ′ ⟩ \langle T,\sigma'\rangle ⟨ T , σ ′ ⟩ , where σ ′ ( ϵ ) : = ⟨ st ( σ ( ϵ ) ) , x ⟩ \sigma'(\epsilon):=\langle\operatorname{st}(\sigma(\epsilon)),x\rangle σ ′ ( ϵ ) := ⟨ st ( σ ( ϵ )) , x ⟩ , and σ ′ ( t ) : = σ ( t ) \sigma'(t):=\sigma(t) σ ′ ( t ) := σ ( t ) for t ∈ T t\in T t ∈ T , is in H i H_i H i .
Proof. The proof goes via induction on i i i , and a case-by-case analysis of each of the construction steps.
Given two trees T 1 T_1 T 1 and T 2 T_2 T 2 , an injective function ν : T 1 → T 2 \nu:T_1\to T_2 ν : T 1 → T 2 is an embedding iff ν ( ϵ ) = ϵ \nu(\epsilon)=\epsilon ν ( ϵ ) = ϵ , and for every t 1 , t 2 ∈ T 1 t_1,t_2\in T_1 t 1 , t 2 ∈ T 1 , t 1 ⪯ t 2 t_1\preceq t_2 t 1 ⪯ t 2 iff ν ( t 1 ) ⪯ ν ( t 2 ) \nu(t_1)\preceq\nu(t_2) ν ( t 1 ) ⪯ ν ( t 2 ) . In this case, we say that T 1 T_1 T 1 embeds into T 2 T_2 T 2 . We now prove the following more general property:
Lemma D.3. Let ⟨ T , σ ⟩ ∈ H i \langle T,\sigma\rangle\in H_i ⟨ T , σ ⟩ ∈ H i , for i ∈ N i\in\mathbb{N} i ∈ N . There exist a sequence n ↦ ⟨ T n , σ n ⟩ ∈ [ I n i t ] F C n\mapsto\langle T_n,\sigma_n\rangle\in[\mathit{Init}]_{\mathit{FC}} n ↦ ⟨ T n , σ n ⟩ ∈ [ Init ] FC of trees and a sequence of embeddings n ↦ ( ν n : T → T n ) n\mapsto(\nu_n:T\to T_n) n ↦ ( ν n : T → T n ) such that, for every t ∈ T t\in T t ∈ T and n ∈ N n\in\mathbb{N} n ∈ N , the following conditions hold:
(P3a) st ( σ n ∘ ν n ( t ) ) = st ( σ ( t ) ) \operatorname{st}(\sigma_n\circ\nu_n(t))=\operatorname{st}(\sigma(t)) st ( σ n ∘ ν n ( t )) = st ( σ ( t )) .
(P3b)
⟦ fgt σ ( t ) ⟧ = ⨁ n ∈ N ⟦ σ n ∘ ν n ( t ) ⟧ . \llbracket\operatorname{fgt}_{\sigma}(t)\rrbracket=\bigoplus_{n\in\mathbb{N}}\llbracket\sigma_n\circ\nu_n(t)\rrbracket. [ [ fgt σ ( t ) ] ] = n ∈ N ⨁ [ [ σ n ∘ ν n ( t ) ] ] . (P3c) If ⟦ σ ( ϵ ) ⟧ \llbracket\sigma(\epsilon)\rrbracket [ [ σ ( ϵ ) ] ] is of the form l ^ ⋅ x ⋅ r ^ \hat{l}\cdot x\cdot\hat{r} l ^ ⋅ x ⋅ r ^ , then there exists a sequence of pumping contexts n ↦ g n ∈ C o n t e x t F C n\mapsto g_n\in\mathit{Context}_{\mathit{FC}} n ↦ g n ∈ Context FC such that for every choice a ∈ S a\in S a ∈ S it holds
⨁ n ′ ∈ N b n ′ ′ a c n ′ ′ = fgt ( l ) ⊗ a ⊗ fgt ( r ) , \bigoplus_{n'\in\mathbb{N}} b_{n'}'a c_{n'}'=\operatorname{fgt}(l)\otimes a\otimes\operatorname{fgt}(r), n ′ ∈ N ⨁ b n ′ ′ a c n ′ ′ = fgt ( l ) ⊗ a ⊗ fgt ( r ) , where eff ( g n ′ ′ ) = ⟨ b n ′ ′ , c n ′ ′ ⟩ \operatorname{eff}(g_{n'}')=\langle b_{n'}',c_{n'}'\rangle eff ( g n ′ ′ ) = ⟨ b n ′ ′ , c n ′ ′ ⟩ .
(P3d) For every t ′ ∈ T t'\in T t ′ ∈ T such that t ⪯ t ′ t\preceq t' t ⪯ t ′ , let f n , t , t ′ ∈ C o n t e x t F C f_{n,t,t'}\in\mathit{Context}_{\mathit{FC}} f n , t , t ′ ∈ Context FC be the unique context that corresponds to nodes ν n ( t ) , ν n ( t ′ ) ∈ T n \nu_n(t),\nu_n(t')\in T_n ν n ( t ) , ν n ( t ′ ) ∈ T n . For every choice of a ∈ S a\in S a ∈ S , it holds
⨁ n ′ ∈ N b n ′ , t , t ′ ′ a c n ′ , t , t ′ ′ = fgt ( l t , t ′ ) ⊗ a ⊗ fgt ( r t , t ′ ) , \bigoplus_{n'\in\mathbb{N}} b_{n',t,t'}'a c_{n',t,t'}'=\operatorname{fgt}(l_{t,t'})\otimes a\otimes\operatorname{fgt}(r_{t,t'}), n ′ ∈ N ⨁ b n ′ , t , t ′ ′ a c n ′ , t , t ′ ′ = fgt ( l t , t ′ ) ⊗ a ⊗ fgt ( r t , t ′ ) , where eff ( f n ′ , t , t ′ ′ ) = ⟨ b n ′ , t , t ′ ′ , c n ′ , t , t ′ ′ ⟩ \operatorname{eff}(f_{n',t,t'}')=\langle b_{n',t,t'}',c_{n',t,t'}'\rangle eff ( f n ′ , t , t ′ ′ ) = ⟨ b n ′ , t , t ′ ′ , c n ′ , t , t ′ ′ ⟩ , and ⟦ σ ( t ) ⟧ = l t , t ′ ⋅ ⟦ σ ( t ′ ) ⟧ ⋅ r t , t ′ \llbracket\sigma(t)\rrbracket=l_{t,t'}\cdot\llbracket\sigma(t')\rrbracket\cdot r_{t,t'} [ [ σ ( t ) ] ] = l t , t ′ ⋅ [ [ σ ( t ′ ) ] ] ⋅ r t , t ′ .
For finite sequences we assume that the infinite sums only span over the indices where the sequences are defined.
In particular, property (P3) follows from properties (P3a), and (P3b) in the special case when t = ϵ t=\epsilon t = ϵ .
Proof. Let ⟨ T , σ ⟩ ∈ H i \langle T, \sigma\rangle\in H_i ⟨ T , σ ⟩ ∈ H i for an arbitrary i ∈ N i \in\mathbb{N} i ∈ N . We proceed by induction on i i i . If i = 0 i = 0 i = 0 , then the above statement is trivially true. In particular, for every t ∈ T t \in T t ∈ T , we define n ↦ f n , t = Id n \mapsto f_{n,t} = \operatorname{Id} n ↦ f n , t = Id .
Suppose i > 0 i > 0 i > 0 . Assume ⟨ T ′ , σ ′ ⟩ ∈ H i − 1 \langle T', \sigma'\rangle\in H_{i-1} ⟨ T ′ , σ ′ ⟩ ∈ H i − 1 to be arbitrary. By our hypothesis, there exist sequences n ↦ ⟨ T n ′ , σ n ′ ⟩ n \mapsto\langle T'_n, \sigma'_n\rangle n ↦ ⟨ T n ′ , σ n ′ ⟩ of trees in [ I n i t ] F C [\mathrm{Init}]_{\mathcal{F}_{\mathcal{C}}} [ Init ] F C , n ↦ ν n ′ n \mapsto\nu'_n n ↦ ν n ′ of embeddings of the form ν n ′ : ⟨ T ′ , σ ′ ⟩ → ⟨ T n ′ , σ n ′ ⟩ \nu'_n : \langle T', \sigma'\rangle\to\langle T'_n, \sigma'_n\rangle ν n ′ : ⟨ T ′ , σ ′ ⟩ → ⟨ T n ′ , σ n ′ ⟩ , and n ↦ f n , t , t ′ n \mapsto f_{n,t,t'} n ↦ f n , t , t ′ of contexts in C o n t e x t F C \mathrm{Context}_{\mathcal{F}_{\mathcal{C}}} Context F C for every t , t ′ ∈ T ′ t,t' \in T' t , t ′ ∈ T ′ where t ⪯ t ′ t \preceq t' t ⪯ t ′ , such that the corresponding instantiation of the lemma holds. We also assume that the sequences are infinite as the proof follows similarly for the finite case.
Without loss of generality, we assume ⟨ T , σ ⟩ ∈ H i ∖ H i − 1 \langle T,\sigma\rangle\in H_i \setminus H_{i-1} ⟨ T , σ ⟩ ∈ H i ∖ H i − 1 . Let ⟨ T , σ ⟩ ∈ H i , v \langle T,\sigma\rangle\in H_{i,v} ⟨ T , σ ⟩ ∈ H i , v . The proof for the case when ⟨ T , σ ⟩ ∈ H i , h \langle T,\sigma\rangle\in H_{i,h} ⟨ T , σ ⟩ ∈ H i , h follows similarly. Then we can find a suitable pair of transitions ⟨ δ 1 , δ 2 ⟩ ∈ T r a n s 2 \langle\delta_1,\delta_2\rangle\in\mathrm{Trans}^2 ⟨ δ 1 , δ 2 ⟩ ∈ Trans 2 , and choose ⟨ T ′ , σ ′ ⟩ \langle T',\sigma'\rangle ⟨ T ′ , σ ′ ⟩ such that ⟨ T ′ ′ , σ ′ ′ ⟩ = v C ( ⟨ δ 1 , δ 2 ⟩ , ⟨ T ′ , fgt σ ′ ⟩ ) ∈ F T r e e ( C ) \langle T'',\sigma''\rangle= v_{\mathcal{C}}(\langle\delta_1,\delta_2\rangle,\langle T',\operatorname{fgt}_{\sigma'}\rangle) \in\mathrm{FTree}(\mathcal{C}) ⟨ T ′′ , σ ′′ ⟩ = v C (⟨ δ 1 , δ 2 ⟩ , ⟨ T ′ , fgt σ ′ ⟩) ∈ FTree ( C ) , and one of the following cases holds:
Case (V1). There exists t ∈ T ′ t \in T' t ∈ T ′ such that st ( σ ′ ′ ( ϵ ) ) = st ( σ ( t ) ) \operatorname{st}(\sigma''(\epsilon)) = \operatorname{st}(\sigma(t)) st ( σ ′′ ( ϵ )) = st ( σ ( t )) , wt ( δ 1 ) ⋅ # ⋅ ⟦ σ ( ϵ ) ⟧ ⋅ # ⋅ wt ( δ 2 ) = ⟦ σ ( t ) ⟧ \operatorname{wt}(\delta_1) \cdot\# \cdot\llbracket\sigma(\epsilon)\rrbracket\cdot\# \cdot\operatorname{wt}(\delta_2) = \llbracket\sigma(t)\rrbracket wt ( δ 1 ) ⋅ # ⋅ [ [ σ ( ϵ ) ] ] ⋅ # ⋅ wt ( δ 2 ) = [ [ σ ( t ) ] ] , and ⟨ T , σ ⟩ = t − 1 ⟨ T ′ , σ ′ ⟩ \langle T,\sigma\rangle= t^{-1}\langle T',\sigma'\rangle ⟨ T , σ ⟩ = t − 1 ⟨ T ′ , σ ′ ⟩ . By Lemma 5.7, the rest follows from our hypothesis.
Case (V3). We have T = { ϵ } ∪ 1 ⋅ T ′ T = \{\epsilon\} \cup1 \cdot T' T = { ϵ } ∪ 1 ⋅ T ′ , σ ( ϵ ) = ⟨ ⟨ p , q ⟩ , wt ( δ 1 ) ⋅ # ⋅ ⟦ σ ′ ( ϵ ) ⟧ ⋅ # ⋅ wt ( δ 2 ) ⟩ \sigma(\epsilon) = \langle\langle p,q\rangle,\operatorname{wt}(\delta_1)\cdot\#\cdot\llbracket\sigma'(\epsilon)\rrbracket\cdot\#\cdot\operatorname{wt}(\delta_2)\rangle σ ( ϵ ) = ⟨⟨ p , q ⟩ , wt ( δ 1 ) ⋅ # ⋅ [ [ σ ′ ( ϵ ) ] ] ⋅ # ⋅ wt ( δ 2 )⟩ , and σ ( 1 ⋅ t ′ ) = σ ′ ( t ′ ) \sigma(1\cdot t') = \sigma'(t') σ ( 1 ⋅ t ′ ) = σ ′ ( t ′ ) for t ′ ∈ T ′ t' \in T' t ′ ∈ T ′ . By definition, for every n ∈ N n \in\mathbb{N} n ∈ N , v C ( ⟨ δ 1 , δ 2 ⟩ , ⟨ T n ′ , σ n ′ ⟩ ) ∈ [ I n i t ] F C v_{\mathcal{C}}(\langle\delta_1,\delta_2\rangle,\langle T'_n,\sigma'_n\rangle) \in[\mathrm{Init}]_{\mathcal{F}_{\mathcal{C}}} v C (⟨ δ 1 , δ 2 ⟩ , ⟨ T n ′ , σ n ′ ⟩) ∈ [ Init ] F C . Hence, we define the candidate sequences as follows:
⟨ T n , σ n ⟩ = v C ( ⟨ δ 1 , δ 2 ⟩ , ⟨ T n ′ , σ n ′ ⟩ ) , and \langle T_n,\sigma_n\rangle= v_{\mathcal{C}}(\langle\delta_1,\delta_2\rangle,\langle T'_n,\sigma'_n\rangle), \quad\text{and} ⟨ T n , σ n ⟩ = v C (⟨ δ 1 , δ 2 ⟩ , ⟨ T n ′ , σ n ′ ⟩) , and
ν n ( ϵ ) = ϵ , ν n ( 1 ⋅ t ′ ) = 1 ⋅ ν n ′ ( t ′ ) , \nu_n(\epsilon) = \epsilon, \qquad\nu_n(1\cdot t') = 1\cdot\nu'_n(t'), ν n ( ϵ ) = ϵ , ν n ( 1 ⋅ t ′ ) = 1 ⋅ ν n ′ ( t ′ ) ,
where n ∈ N n \in\mathbb{N} n ∈ N , and t ′ ∈ T ′ t' \in T' t ′ ∈ T ′ . We show how to prove (P3b), as (P3c) is trivially true, and (P3d) follows from definitions. In particular, it suffices to show that
⨁ n ∈ N ⟦ σ n ∘ ν n ( ϵ ) ⟧ = fgt ( wt ( δ 1 ) ⋅ # ⋅ ⟦ σ ′ ( ϵ ) ⟧ ⋅ # ⋅ wt ( δ 2 ) ) = ⟦ fgt σ ( ϵ ) ⟧ . \bigoplus_{n\in\mathbb{N}}\llbracket\sigma_n\circ\nu_n(\epsilon)\rrbracket= \operatorname{fgt}\bigl(\operatorname{wt}(\delta_1)\cdot\#\cdot\llbracket\sigma'(\epsilon)\rrbracket\cdot\#\cdot\operatorname{wt}(\delta_2)\bigr) = \llbracket\operatorname{fgt}_{\sigma}(\epsilon)\rrbracket. n ∈ N ⨁ [ [ σ n ∘ ν n ( ϵ ) ] ] = fgt ( wt ( δ 1 ) ⋅ # ⋅ [ [ σ ′ ( ϵ ) ] ] ⋅ # ⋅ wt ( δ 2 ) ) = [ [ fgt σ ( ϵ ) ] ] .
The case where t ≠ ϵ t \ne\epsilon t = ϵ follows simply from our assumption. By definition, ⟦ σ n ∘ ν n ( ϵ ) ⟧ = wt ( δ 1 ) ⟦ σ n ′ ∘ ν n ′ ( ϵ ) ⟧ wt ( δ 2 ) \llbracket\sigma_n\circ\nu_n(\epsilon)\rrbracket= \operatorname{wt}(\delta_1)\llbracket\sigma'_n\circ\nu'_n(\epsilon)\rrbracket\operatorname{wt}(\delta_2) [ [ σ n ∘ ν n ( ϵ ) ] ] = wt ( δ 1 ) [ [ σ n ′ ∘ ν n ′ ( ϵ ) ] ] wt ( δ 2 ) . Hence, we have
⨁ n ∈ N ⟦ σ n ∘ ν n ( ϵ ) ⟧ = ⨁ n ∈ N wt ( δ 1 ) ⟦ σ n ′ ∘ ν n ′ ( ϵ ) ⟧ wt ( δ 2 ) = wt ( δ 1 ) ( ⨁ n ∈ N ⟦ σ n ′ ∘ ν n ′ ( ϵ ) ⟧ ) wt ( δ 2 ) = wt ( δ 1 ) ⟦ fgt σ ′ ( ϵ ) ⟧ wt ( δ 2 ) . \begin{aligned}
\bigoplus_{n\in\mathbb{N}}\llbracket\sigma_n\circ\nu_n(\epsilon)\rrbracket
&= \bigoplus_{n\in\mathbb{N}}\operatorname{wt}(\delta_1)\llbracket\sigma'_n\circ\nu'_n(\epsilon)\rrbracket\operatorname{wt}(\delta_2)\\
&= \operatorname{wt}(\delta_1)\left(\bigoplus_{n\in\mathbb{N}}\llbracket\sigma'_n\circ\nu'_n(\epsilon)\rrbracket\right)\operatorname{wt}(\delta_2)\\
&= \operatorname{wt}(\delta_1)\llbracket\operatorname{fgt}_{\sigma'}(\epsilon)\rrbracket\operatorname{wt}(\delta_2).
\end{aligned} n ∈ N ⨁ [ [ σ n ∘ ν n ( ϵ ) ] ] = n ∈ N ⨁ wt ( δ 1 ) [ [ σ n ′ ∘ ν n ′ ( ϵ ) ] ] wt ( δ 2 ) = wt ( δ 1 ) ( n ∈ N ⨁ [ [ σ n ′ ∘ ν n ′ ( ϵ ) ] ] ) wt ( δ 2 ) = wt ( δ 1 ) [ [ fgt σ ′ ( ϵ ) ] ] wt ( δ 2 ) .
Since fgt ( ⟦ σ ′ ( ϵ ) ⟧ ) = ⟦ fgt σ ′ ( ϵ ) ⟧ \operatorname{fgt}(\llbracket\sigma'(\epsilon)\rrbracket) = \llbracket\operatorname{fgt}_{\sigma'}(\epsilon)\rrbracket fgt ( [ [ σ ′ ( ϵ ) ] ] ) = [ [ fgt σ ′ ( ϵ ) ] ] , we are done.
Case (V2). Suppose there exists a node t ∈ T ′ t \in T' t ∈ T ′ such that st ( σ ( t ) ) = st ( σ ′ ′ ( ϵ ) ) \operatorname{st}(\sigma(t)) = \operatorname{st}(\sigma''(\epsilon)) st ( σ ( t )) = st ( σ ′′ ( ϵ )) , T = t − 1 T ′ T = t^{-1}T' T = t − 1 T ′ , ⟦ σ ( ϵ ) ⟧ = ( y 1 ⋅ l ^ t ) ⋆ ⋅ x t ′ ⋅ ( r ^ t ⋅ y 2 ) ⋆ \llbracket\sigma(\epsilon)\rrbracket= (y_1\cdot\widehat{l}_t)^\star\cdot x'_t\cdot(\widehat{r}_t\cdot y_2)^\star [ [ σ ( ϵ ) ] ] = ( y 1 ⋅ l t ) ⋆ ⋅ x t ′ ⋅ ( r t ⋅ y 2 ) ⋆ , and σ ( t ′ ) = σ ′ ( t ⋅ t ′ ) \sigma(t') = \sigma'(t\cdot t') σ ( t ′ ) = σ ′ ( t ⋅ t ′ ) for t ′ ∈ T ∖ { ϵ } t' \in T\setminus\{\epsilon\} t ′ ∈ T ∖ { ϵ } , where wt ( δ 1 ) ⋅ # ⋅ ⟦ σ ′ ( ϵ ) ⟧ ⋅ # ⋅ wt ( δ 2 ) = y 1 ⋅ ⟦ σ ′ ( t ) ⟧ ⋅ y 2 \operatorname{wt}(\delta_1)\cdot\#\cdot\llbracket\sigma'(\epsilon)\rrbracket\cdot\#\cdot\operatorname{wt}(\delta_2) = y_1\cdot\llbracket\sigma'(t)\rrbracket\cdot y_2 wt ( δ 1 ) ⋅ # ⋅ [ [ σ ′ ( ϵ ) ] ] ⋅ # ⋅ wt ( δ 2 ) = y 1 ⋅ [ [ σ ′ ( t ) ] ] ⋅ y 2 , for non-empty y 1 , y 2 ∈ T h S y_1,y_2 \in\mathrm{ThS} y 1 , y 2 ∈ ThS , and ⟦ σ ′ ( t ) ⟧ = l ^ t ⋅ x t ′ ⋅ r ^ t \llbracket\sigma'(t)\rrbracket= \widehat{l}_t\cdot x'_t\cdot\widehat{r}_t [ [ σ ′ ( t ) ] ] = l t ⋅ x t ′ ⋅ r t .
By Lemma 5.7, the tree ⟨ T ′ , σ ′ ⟩ \langle T',\sigma'\rangle ⟨ T ′ , σ ′ ⟩ belongs to H i − 1 H_{i-1} H i − 1 . Consider the sequence n ↦ g n ′ n \mapsto g'_n n ↦ g n ′ of pumping contexts in C o n t e x t F C \mathrm{Context}_{\mathcal{F}_{\mathcal{C}}} Context F C , where eff ( g n ′ ) = ⟨ b n ′ , c n ′ ⟩ \operatorname{eff}(g'_n) = \langle b'_n,c'_n\rangle eff ( g n ′ ) = ⟨ b n ′ , c n ′ ⟩ , such that (P3c) holds in our induction hypothesis. By Lemma D.2, there exists a tree ⟨ T † , σ † ⟩ \langle T^\dagger,\sigma^\dagger\rangle ⟨ T † , σ † ⟩ in H i − 1 H_{i-1} H i − 1 such that T † = T T^\dagger= T T † = T , σ † ( ϵ ) = ⟨ st ( σ ′ ( t ) ) , x t ′ ⟩ \sigma^\dagger(\epsilon) = \langle\operatorname{st}(\sigma'(t)),x'_t\rangle σ † ( ϵ ) = ⟨ st ( σ ′ ( t )) , x t ′ ⟩ , and σ † ( t ′ ) = σ ′ ( t ⋅ t ′ ) \sigma^\dagger(t') = \sigma'(t\cdot t') σ † ( t ′ ) = σ ′ ( t ⋅ t ′ ) for t ′ ∈ T ∖ { ϵ } t' \in T\setminus\{\epsilon\} t ′ ∈ T ∖ { ϵ } . By our induction hypothesis, there exist sequences n ↦ ⟨ T n † , σ n † ⟩ n \mapsto\langle T^\dagger_n,\sigma^\dagger_n\rangle n ↦ ⟨ T n † , σ n † ⟩ of trees in [ I n i t ] F C [\mathrm{Init}]_{\mathcal{F}_{\mathcal{C}}} [ Init ] F C , n ↦ ν n † n \mapsto\nu^\dagger_n n ↦ ν n † of embeddings of the form ν n † : ⟨ T † , σ † ⟩ → ⟨ T n † , σ n † ⟩ \nu^\dagger_n : \langle T^\dagger,\sigma^\dagger\rangle\to\langle T^\dagger_n,\sigma^\dagger_n\rangle ν n † : ⟨ T † , σ † ⟩ → ⟨ T n † , σ n † ⟩ , and n ↦ f n , t ′ , t ′ ′ † n \mapsto f^\dagger_{n,t',t''} n ↦ f n , t ′ , t ′′ † of contexts in C o n t e x t F C \mathrm{Context}_{\mathcal{F}_{\mathcal{C}}} Context F C for every t ′ , t ′ ′ ∈ T † t',t'' \in T^\dagger t ′ , t ′′ ∈ T † where t ′ ⪯ t ′ ′ t' \preceq t'' t ′ ⪯ t ′′ , such that the corresponding instantiation of the lemma holds.
Let g g g be the context v C ( ⟨ δ 1 , δ 2 ⟩ , _ ) v_C(\langle\delta_1,\delta_2\rangle,\_) v C (⟨ δ 1 , δ 2 ⟩ , _ ) . Consider the countable set of trees given by
X = ( ∑ n , m ∈ N g ∘ f n , ϵ , t ′ ∘ g m ′ ) ( { ⟨ T j † , σ j † ⟩ ∣ j ∈ N } ) ‾ . X=\overline{\left(\sum_{n,m\in\mathbb{N}}g\circ f'_{n,\epsilon,t}\circ g'_m\right)\left(\left\{\langle T^\dagger_j,\sigma^\dagger_j\rangle\mid j\in\mathbb{N}\right\}\right)}. X = n , m ∈ N ∑ g ∘ f n , ϵ , t ′ ∘ g m ′ ( { ⟨ T j † , σ j † ⟩ ∣ j ∈ N } ) .
We claim that X X X is the candidate set of trees.4 Observe that every context of the form g ∘ f n , ϵ , t ′ ∘ g m ′ g\circ f'_{n,\epsilon,t}\circ g'_m g ∘ f n , ϵ , t ′ ∘ g m ′ is a pumping context. Hence, (P3a) holds.
Let bold variables of the form n = ⟨ n 1 , … , n k ⟩ ∈ N k \mathbf{n}=\langle n_1,\ldots,n_k\rangle\in\mathbb{N}^k n = ⟨ n 1 , … , n k ⟩ ∈ N k , and m = ⟨ m 1 , … , m k ⟩ ∈ N k \mathbf{m}=\langle m_1,\ldots,m_k\rangle\in\mathbb{N}^k m = ⟨ m 1 , … , m k ⟩ ∈ N k denote non-negative vectors. We write f n , m f_{\mathbf{n},\mathbf{m}} f n , m to denote the pumping context ( ( g ∘ f n 1 , ϵ , t ′ ∘ g m 1 ′ ) ∘ ⋯ ∘ ( g ∘ f n k , ϵ , t ′ ∘ g m k ′ ) ) \left((g\circ f'_{n_1,\epsilon,t}\circ g'_{m_1})\circ\cdots\circ(g\circ f'_{n_k,\epsilon,t}\circ g'_{m_k})\right) ( ( g ∘ f n 1 , ϵ , t ′ ∘ g m 1 ′ ) ∘ ⋯ ∘ ( g ∘ f n k , ϵ , t ′ ∘ g m k ′ ) ) , and we write ⟨ T n , m , j , σ n , m , j ⟩ \langle T_{\mathbf{n},\mathbf{m},j},\sigma_{\mathbf{n},\mathbf{m},j}\rangle ⟨ T n , m , j , σ n , m , j ⟩ to denote the tree f n , m ( ⟨ T j † , σ j † ⟩ ) f_{\mathbf{n},\mathbf{m}}(\langle T^\dagger_j,\sigma^\dagger_j\rangle) f n , m (⟨ T j † , σ j † ⟩) in X X X , for j ∈ N j\in\mathbb{N} j ∈ N . We define the embedding ν n , m , j : T → T n , m , j \nu_{\mathbf{n},\mathbf{m},j}:T\to T_{\mathbf{n},\mathbf{m},j} ν n , m , j : T → T n , m , j such that ν n , m , j ( ϵ ) : = ϵ \nu_{\mathbf{n},\mathbf{m},j}(\epsilon):=\epsilon ν n , m , j ( ϵ ) := ϵ , and ν n , m , j ( t ′ ) : = ( 1 ⋅ ν n 1 ′ ( t ) ⋅ t m 1 ′ ) ⋯ ( 1 ⋅ ν n k ′ ( t ) ⋅ t m k ′ ) ⋅ ν j † ( t ′ ) \nu_{\mathbf{n},\mathbf{m},j}(t') := (1\cdot\nu'_{n_1}(t)\cdot t'_{m_1})\cdots(1\cdot\nu'_{n_k}(t)\cdot t'_{m_k})\cdot\nu^\dagger_j(t') ν n , m , j ( t ′ ) := ( 1 ⋅ ν n 1 ′ ( t ) ⋅ t m 1 ′ ) ⋯ ( 1 ⋅ ν n k ′ ( t ) ⋅ t m k ′ ) ⋅ ν j † ( t ′ ) for t ′ ∈ T ∖ { ϵ } t'\in T\setminus\{\epsilon\} t ′ ∈ T ∖ { ϵ } , where t m ′ ∈ N ∗ t'_{m}\in\mathbb{N}^* t m ′ ∈ N ∗ is the unique node associated to the hole of the context g m ′ g'_m g m ′ .
We can rewrite X X X as follows:
⋃ i ∈ N ( ( ∑ n , m ∈ N g ∘ f n , ϵ , t ′ ∘ g m ′ ) ( { ⟨ T j † , σ j † ⟩ ∣ j ∈ N } ) ) i . \bigcup_{i\in\mathbb{N}}\left(\left(\sum_{n,m\in\mathbb{N}}g\circ f'_{n,\epsilon,t}\circ g'_m\right)\left(\left\{\langle T^\dagger_j,\sigma^\dagger_j\rangle\mid j\in\mathbb{N}\right\}\right)\right)^i. i ∈ N ⋃ n , m ∈ N ∑ g ∘ f n , ϵ , t ′ ∘ g m ′ ( { ⟨ T j † , σ j † ⟩ ∣ j ∈ N } ) i .
Thus, in order to prove (P3b), one must show that
\bigoplus_{\mathbf{n},\mathbf{m}\in\mathbb{N}^i,j\in\mathbb{N}}\left\llbracket\sigma_{\mathbf{n},\mathbf{m},j}\circ\nu_{\mathbf{n},\mathbf{m},j}(t')\right\rrbracket=\operatorname{fgt}(\llbracket\sigma(t')\rrbracket).
for t ′ ∈ T t'\in T t ′ ∈ T . The case when t ′ ≠ ϵ t'\ne\epsilon t ′ = ϵ follows by the definition of ⟨ T † , σ † ⟩ \langle T^\dagger,\sigma^\dagger\rangle ⟨ T † , σ † ⟩ . When t ′ = ϵ t'=\epsilon t ′ = ϵ , it suffices to show
\bigoplus_{\mathbf{n},\mathbf{m}\in\mathbb{N}^i,j\in\mathbb{N}}\left\llbracket\sigma_{\mathbf{n},\mathbf{m},j}\circ\nu_{\mathbf{n},\mathbf{m},j}(\epsilon)\right\rrbracket
=\operatorname{fgt}(y_1\cdot\widehat{l_t})^i\operatorname{fgt}(x'_t)\operatorname{fgt}(\widehat{r_t}\cdot y_2)^i, \tag*{(4)}
for arbitrary i ∈ N i\in\mathbb{N} i ∈ N . Indeed, then we have
\bigoplus_{i\in\mathbb{N}}\left(\bigoplus_{\mathbf{n},\mathbf{m}\in\mathbb{N}^i,j\in\mathbb{N}}\left\llbracket\sigma_{\mathbf{n},\mathbf{m},j}\circ\nu_{\mathbf{n},\mathbf{m},j}(\epsilon)\right\rrbracket\right)
=\bigoplus_{i\in\mathbb{N}}\operatorname{fgt}(y_1\cdot\widehat{l_t})^i\operatorname{fgt}(x'_t)\operatorname{fgt}(\widehat{r_t}\cdot y_2)^i
=\operatorname{fgt}((y_1\cdot\widehat{l_t})^*\cdot x'_t\cdot(\widehat{r_t}\cdot y_2)^*),
where the second equality follows from the definition of pumping semirings. We prove that (4) holds, by induction. For i = 0 i=0 i = 0 , the context f n , m f_{\mathbf{n},\mathbf{m}} f n , m is the identity, and the equation holds by our induction hypothesis on ⟨ T † , σ † ⟩ \langle T^\dagger,\sigma^\dagger\rangle ⟨ T † , σ † ⟩ . Now, suppose it holds for an arbitrary i ∈ N i \in\mathbb{N} i ∈ N . We have,
\begin{aligned}
\bigoplus_{\substack{n,m\in\mathbb{N}\\i+1,j\in\mathbb{N}}} \left\llbracket\sigma_{n,m,j}\circ\nu_{n,m,j}(\epsilon)\right\rrbracket
=
\bigoplus_{\substack{n,m\in\mathbb{N}\\i+1,j\in\mathbb{N}}} \left\llbracket\sigma_{n,m,j}(\epsilon)\right\rrbracket\\
&=
\bigoplus_{\substack{n,m\in\mathbb{N},n',m'\in\mathbb{N}\\i,j\in\mathbb{N}}}
\operatorname{wt}(\delta_1)b'_{n,\epsilon,t}b'_{m}\left\llbracket\sigma_{n',m',j}(\epsilon)\right\rrbracket c'_{m'}c'_{n,\epsilon,t}\operatorname{wt}(\delta_2) \\
&=
\operatorname{wt}(\delta_1)\left(\bigoplus_{n\in\mathbb{N}}b'_{n,\epsilon,t}\left(\bigoplus_{\substack{m\in\mathbb{N},n',m'\in\mathbb{N}\\i,j\in\mathbb{N}}}b'_{m}\left\llbracket\sigma_{n',m',j}(\epsilon)\right\rrbracket c'_{m'}\right)c'_{n,\epsilon,t}\right)\operatorname{wt}(\delta_2) \\
&=
\operatorname{wt}(\delta_1)\operatorname{fgt}(l_{\epsilon,t'})
\left(\bigoplus_{m\in\mathbb{N}}b'_{m}\left(\bigoplus_{\substack{n',m'\in\mathbb{N}\\i,j\in\mathbb{N}}}\left\llbracket\sigma_{n',m',j}(\epsilon)\right\rrbracket c'_{m'}\right)\right)
\operatorname{fgt}(r_{\epsilon,t'})\operatorname{wt}(\delta_2) \\
&=
\operatorname{wt}(\delta_1)\operatorname{fgt}(l_{\epsilon,t'})\operatorname{fgt}(l_t)
\left(\operatorname{fgt}(y_1\cdot l_t')\operatorname{fgt}(x_t')\operatorname{fgt}(r_t\cdot y_2)\right)
\operatorname{fgt}(r_t)\operatorname{fgt}(r_{\epsilon,t'})\operatorname{wt}(\delta_2) \\
&=
\operatorname{fgt}(y_1\cdot l_t)^{i+1}\operatorname{fgt}(x_t')\operatorname{fgt}(r_t\cdot y_2)^{i+1},
\end{aligned}
where l ϵ , t ′ , r ϵ , t ′ ∈ T h S l_{\epsilon,t'},r_{\epsilon,t'}\in\mathrm{ThS} l ϵ , t ′ , r ϵ , t ′ ∈ ThS are such that ⟦ σ ′ ( ϵ ) ⟧ = l ϵ , t ′ ⋅ ⟦ σ ′ ( t ) ⟧ ⋅ r ϵ , t ′ \llbracket\sigma'(\epsilon)\rrbracket=l_{\epsilon,t'}\cdot\llbracket\sigma'(t)\rrbracket\cdot r_{\epsilon,t'} [ [ σ ′ ( ϵ ) ] ] = l ϵ , t ′ ⋅ [ [ σ ′ ( t ) ] ] ⋅ r ϵ , t ′ (these must exist by Lemma 5.6), and ⟨ b n , ϵ , t ′ , c n , ϵ , t ′ ⟩ = eff ( f n , ϵ , t ) \langle b_{n,\epsilon,t}',c_{n,\epsilon,t}'\rangle=\operatorname{eff}(f_{n,\epsilon,t}) ⟨ b n , ϵ , t ′ , c n , ϵ , t ′ ⟩ = eff ( f n , ϵ , t ) , for n ∈ N n\in\mathbb{N} n ∈ N . Observe that the fourth equality uses property (P3d) in our hypothesis, and the fifth uses property (P3c) for the contexts g m ′ g_m' g m ′ , together with Equation (4) for i i i .
It remains to prove (P3c), and (P3d). We will first prove (P3d). Recall that t ∈ T ′ t\in T' t ∈ T ′ is fixed. Let t ′ , t ′ ′ ∈ T t',t''\in T t ′ , t ′′ ∈ T be arbitrary, such that t ′ ⪯ t ′ ′ t'\preceq t'' t ′ ⪯ t ′′ . For the case when t ′ ≠ ϵ ≠ t ′ ′ t'\ne\epsilon\ne t'' t ′ = ϵ = t ′′ , the proof follows from our hypothesis. Let t ′ = ϵ t'=\epsilon t ′ = ϵ . We write the required set of contexts as { f n , m ∘ f j , ϵ , t ′ ′ † ∣ j ∈ N , ⟨ n , m ⟩ ∈ ( N × N ) ∗ } \{f_{n,m}\circ f^\dagger_{j,\epsilon,t''}\mid j\in\mathbb{N},\langle n,m\rangle\in(\mathbb{N}\times\mathbb{N})^*\} { f n , m ∘ f j , ϵ , t ′′ † ∣ j ∈ N , ⟨ n , m ⟩ ∈ ( N × N ) ∗ } . We must then show that for every choice of a ∈ S a\in S a ∈ S , we have
⨁ i ∈ N n 1 , m 1 , … , m i , n i , j ∈ N ( wt ( δ 1 ) b n 1 , ϵ , t ′ b m 1 ′ ) ⋯ ( wt ( δ 1 ) b n i , ϵ , t ′ b m i ′ ) b j , ϵ , t ′ ′ † ⊗ a ⊗ c j , ϵ , t ′ ′ † ( c m i ′ c n i , ϵ , t ′ wt ( δ 2 ) ) ⋯ ( c m 1 ′ c n 1 , ϵ , t ′ wt ( δ 2 ) ) = fgt ( l ϵ , t ′ ′ ) ⊗ a ⊗ fgt ( r ϵ , t ′ ′ ) , \bigoplus_{\substack{i\in\mathbb{N}\\n_1,m_1,\ldots,m_i,n_i,j\in\mathbb{N}}}
\left(\operatorname{wt}(\delta_1)b'_{n_1,\epsilon,t}b'_{m_1}\right)\cdots
\left(\operatorname{wt}(\delta_1)b'_{n_i,\epsilon,t}b'_{m_i}\right)b^\dagger_{j,\epsilon,t''}
\otimes a\otimes
c^\dagger_{j,\epsilon,t''}\left(c'_{m_i}c'_{n_i,\epsilon,t}\operatorname{wt}(\delta_2)\right)\cdots
\left(c'_{m_1}c'_{n_1,\epsilon,t}\operatorname{wt}(\delta_2)\right)
=
\operatorname{fgt}(l_{\epsilon,t''})\otimes a\otimes\operatorname{fgt}(r_{\epsilon,t''}), i ∈ N n 1 , m 1 , … , m i , n i , j ∈ N ⨁ ( wt ( δ 1 ) b n 1 , ϵ , t ′ b m 1 ′ ) ⋯ ( wt ( δ 1 ) b n i , ϵ , t ′ b m i ′ ) b j , ϵ , t ′′ † ⊗ a ⊗ c j , ϵ , t ′′ † ( c m i ′ c n i , ϵ , t ′ wt ( δ 2 ) ) ⋯ ( c m 1 ′ c n 1 , ϵ , t ′ wt ( δ 2 ) ) = fgt ( l ϵ , t ′′ ) ⊗ a ⊗ fgt ( r ϵ , t ′′ ) ,
where eff ( f j , t 1 , t 2 † ) = ⟨ b j , t 1 , t 2 † , c j , t 1 , t 2 † ⟩ \operatorname{eff}(f^\dagger_{j,t_1,t_2})=\langle b^\dagger_{j,t_1,t_2},c^\dagger_{j,t_1,t_2}\rangle eff ( f j , t 1 , t 2 † ) = ⟨ b j , t 1 , t 2 † , c j , t 1 , t 2 † ⟩ for j ∈ N j\in\mathbb{N} j ∈ N , and t 1 , t 2 ∈ N ∗ t_1,t_2\in\mathbb{N}^* t 1 , t 2 ∈ N ∗ . As before, by (C1), it suffices to prove
⨁ n 1 , m 1 , … , m i , n i , j ∈ N ( wt ( δ 1 ) b n 1 , ϵ , t ′ b m 1 ′ ) ⋯ ( wt ( δ 1 ) b n i , ϵ , t ′ b m i ′ ) b j , ϵ , t ′ ′ † ⊗ a ⊗ c j , ϵ , t ′ ′ † ( c m i ′ c n i , ϵ , t ′ wt ( δ 2 ) ) ⋯ ( c m 1 ′ c n 1 , ϵ , t ′ wt ( δ 2 ) ) = fgt ( y 1 ) i fgt ( l t ′ , t ′ ′ ) ⊗ a ⊗ fgt ( r t ′ , t ′ ′ ) fgt ( y 2 ) i , \bigoplus_{\substack{n_1,m_1,\ldots,m_i,n_i,j\in\mathbb{N}}}
\left(\operatorname{wt}(\delta_1)b'_{n_1,\epsilon,t}b'_{m_1}\right)\cdots
\left(\operatorname{wt}(\delta_1)b'_{n_i,\epsilon,t}b'_{m_i}\right)b^\dagger_{j,\epsilon,t''}
\otimes a\otimes
c^\dagger_{j,\epsilon,t''}\left(c'_{m_i}c'_{n_i,\epsilon,t}\operatorname{wt}(\delta_2)\right)\cdots
\left(c'_{m_1}c'_{n_1,\epsilon,t}\operatorname{wt}(\delta_2)\right)
=
\operatorname{fgt}(y_1)^i\operatorname{fgt}(l_{t',t''})\otimes a\otimes
\operatorname{fgt}(r_{t',t''})\operatorname{fgt}(y_2)^i, n 1 , m 1 , … , m i , n i , j ∈ N ⨁ ( wt ( δ 1 ) b n 1 , ϵ , t ′ b m 1 ′ ) ⋯ ( wt ( δ 1 ) b n i , ϵ , t ′ b m i ′ ) b j , ϵ , t ′′ † ⊗ a ⊗ c j , ϵ , t ′′ † ( c m i ′ c n i , ϵ , t ′ wt ( δ 2 ) ) ⋯ ( c m 1 ′ c n 1 , ϵ , t ′ wt ( δ 2 ) ) = fgt ( y 1 ) i fgt ( l t ′ , t ′′ ) ⊗ a ⊗ fgt ( r t ′ , t ′′ ) fgt ( y 2 ) i ,
for arbitrary i ∈ N i\in\mathbb{N} i ∈ N , where x t ′ = l t ′ , t ′ ′ ⋅ ⟦ σ ′ ( t ′ ′ ) ⟧ ⋅ r t ′ , t ′ ′ x_{t'}=l_{t',t''}\cdot\llbracket\sigma'(t'')\rrbracket\cdot r_{t',t''} x t ′ = l t ′ , t ′′ ⋅ [ [ σ ′ ( t ′′ ) ] ] ⋅ r t ′ , t ′′ . Once again, we proceed by induction. The computations are similar to the proof of (P3b). For (P3c), we just take the countable set { f n , m ∘ f j , ϵ , ϵ † ∣ j ∈ N , ⟨ n , m ⟩ ∈ ( N × N ) ∗ } \{f_{n,m}\circ f^\dagger_{j,\epsilon,\epsilon}\mid j\in\mathbb{N},\langle n,m\rangle\in(\mathbb{N}\times\mathbb{N})^*\} { f n , m ∘ f j , ϵ , ϵ † ∣ j ∈ N , ⟨ n , m ⟩ ∈ ( N × N ) ∗ } . Since f j , ϵ , ϵ † = Id f^\dagger_{j,\epsilon,\epsilon}=\operatorname{Id} f j , ϵ , ϵ † = Id by definition, it is equivalent to { f n , m ∣ ⟨ n , m ⟩ ∈ ( N × N ) ∗ } \{f_{n,m}\mid\langle n,m\rangle\in(\mathbb{N}\times\mathbb{N})^*\} { f n , m ∣ ⟨ n , m ⟩ ∈ ( N × N ) ∗ } .
The proof follows analogously for the simpler case when ⟦ σ ′ ( t ) ⟧ \llbracket\sigma'(t)\rrbracket [ [ σ ′ ( t ) ] ] is not of the form l ^ t ⋅ x t ′ ⋅ r ^ t \widehat{l}_t\cdot x'_t\cdot\widehat{r}_t l t ⋅ x t ′ ⋅ r t .
Termination
We will now prove the termination of our algorithm by proving that (P1) holds. It suffices to show that the set ⋃ i ∈ N H i \bigcup_{i\in\mathbb{N}}H_i ⋃ i ∈ N H i is finite. For the sake of contradiction, assume ⋃ i ∈ N H i \bigcup_{i\in\mathbb{N}}H_i ⋃ i ∈ N H i is infinite. We observe:
Lemma D.4. For every i ∈ N i\in\mathbb{N} i ∈ N , the heights of trees in H i H_i H i are bounded by ∣ Q ∣ 2 |Q|^2 ∣ Q ∣ 2 .
The proof follows from the fact that the steps (V1), (V2), (H1), and (H2) ensure that for any tree ⟨ T , σ ⟩ ∈ H i \langle T,\sigma\rangle\in H_i ⟨ T , σ ⟩ ∈ H i , and two of its nodes t 1 , t 2 ∈ T t_1,t_2\in T t 1 , t 2 ∈ T , such that t 1 ⪯ t 2 t_1\preceq t_2 t 1 ⪯ t 2 and t 1 ≠ t 2 t_1\ne t_2 t 1 = t 2 , we have $st(\sigma(t_1))\ne s t ( σ ( t 2 ) ) st(\sigma(t_2)) s t ( σ ( t 2 )) . Since these pairs of states range over Q × Q Q \times Q Q × Q , no path from the root of such a tree can have more than ∣ Q ∣ 2 |Q|^2 ∣ Q ∣ 2 nodes. Since ⋃ i ∈ N H i \bigcup_{i\in\mathbb{N}} H_i ⋃ i ∈ N H i is infinite and there are only finitely many heights h ≤ ∣ Q ∣ 2 h \leq|Q|^2 h ≤ ∣ Q ∣ 2 , by the pigeon-hole principle there must exist infinitely many trees in ⋃ i ∈ N H i \bigcup_{i\in\mathbb{N}} H_i ⋃ i ∈ N H i of height h h h , for some h ≤ ∣ Q ∣ 2 h \leq|Q|^2 h ≤ ∣ Q ∣ 2 . Let h 0 h_0 h 0 be the least such height.
By construction, H i ⊆ H i + 1 H_i \subseteq H_{i+1} H i ⊆ H i + 1 , for all i ∈ N i \in\mathbb{N} i ∈ N . Hence, there exists an index i 0 ∈ N i_0 \in\mathbb{N} i 0 ∈ N such that H i 0 H_{i_0} H i 0 contains the set of all trees of height strictly less than h 0 h_0 h 0 , in ⋃ i ∈ N H i \bigcup_{i\in\mathbb{N}} H_i ⋃ i ∈ N H i . Without loss of generality, we assume ( i 0 − 1 ) (i_0 - 1) ( i 0 − 1 ) to be the smallest such index. Let R 0 = { [ [ σ ( t ) ] ] ∣ ⟨ T , σ ⟩ ∈ H i 0 , t ∈ T , ht ( t − 1 T ) = h 0 } R_0 = \{[\![\sigma(t)]\!] \mid\langle T, \sigma\rangle\in H_{i_0},\ t \in T,\ \operatorname{ht}(t^{-1}T) = h_0\} R 0 = {[ [ σ ( t )] ] ∣ ⟨ T , σ ⟩ ∈ H i 0 , t ∈ T , ht ( t − 1 T ) = h 0 } be the T h S \mathrm{Th}_S Th S -components of the roots of the trees in H i 0 H_{i_0} H i 0 , at height h 0 h_0 h 0 . By definition, R 0 R_0 R 0 is a finite set.
Let us define the set W 0 : = R 0 ∪ { b ⋅ x ⋅ c ∣ b , c ∈ O ( S ) , x ∈ R 0 } ⊆ T h S W_0 := R_0 \cup\{b \cdot x \cdot c \mid b,c \in\mathcal{O}(S),\ x \in R_0\} \subseteq\mathrm{Th}_S W 0 := R 0 ∪ { b ⋅ x ⋅ c ∣ b , c ∈ O ( S ) , x ∈ R 0 } ⊆ Th S . We then claim,
Lemma D.5. Let i ∈ N i \in\mathbb{N} i ∈ N with i ≥ i 0 i \geq i_0 i ≥ i 0 . For every tree ⟨ T , σ ⟩ ∈ H i \langle T,\sigma\rangle\in H_i ⟨ T , σ ⟩ ∈ H i and t ∈ T t \in T t ∈ T such that ht ( t − 1 T ) = h 0 \operatorname{ht}(t^{-1}T) = h_0 ht ( t − 1 T ) = h 0 , we have [ [ σ ( t ) ] ] ∈ W 0 [\![\sigma(t)]\!] \in W_0 [ [ σ ( t )] ] ∈ W 0 .
By property (C3), we know that W 0 W_0 W 0 is finite. Hence, Lemma D.5 directly contradicts our initial assumption, and h 0 h_0 h 0 cannot exist.
Proof of Lemma D.5. We proceed by induction on i ∈ N i \in\mathbb{N} i ∈ N . The case when i = i 0 i=i_0 i = i 0 follows by definition. Let i > i 0 i>i_0 i > i 0 be arbitrary for which the lemma holds. Let ⟨ T , σ ⟩ ∈ H i + 1 \langle T,\sigma\rangle\in H_{i+1} ⟨ T , σ ⟩ ∈ H i + 1 , and t ∈ T t \in T t ∈ T be arbitrary such that t t t is at height h 0 h_0 h 0 . The proof is trivial when t ≠ ϵ t \neq\epsilon t = ϵ , and follows from the fact that the corresponding subtree t − 1 ⟨ T , σ ⟩ t^{-1}\langle T,\sigma\rangle t − 1 ⟨ T , σ ⟩ rooted at t t t belongs to H i H_i H i (by Lemma 5.7). Hence, we assume t = ϵ t=\epsilon t = ϵ .
If ⟨ T , σ ⟩ \langle T,\sigma\rangle ⟨ T , σ ⟩ is generated as a result of step (V1) (resp. (H1)), then by definition ⟨ T , σ ⟩ ∈ H i \langle T,\sigma\rangle\in H_i ⟨ T , σ ⟩ ∈ H i . Hence, the lemma follows from our hypothesis. Suppose ⟨ T , σ ⟩ \langle T,\sigma\rangle ⟨ T , σ ⟩ is generated as a result of step (V2) (resp. (H2)). Then there exists ⟨ T ′ , σ ′ ⟩ ∈ H i \langle T',\sigma'\rangle\in H_i ⟨ T ′ , σ ′ ⟩ ∈ H i , such that [ [ σ ( ϵ ) ] ] = b ′ ⋅ [ [ σ ′ ( ϵ ) ] ] ⋅ c ′ [\![\sigma(\epsilon)]\!] = b' \cdot[\![\sigma'(\epsilon)]\!] \cdot c' [ [ σ ( ϵ )] ] = b ′ ⋅ [ [ σ ′ ( ϵ )] ] ⋅ c ′ , for some b ′ , c ′ ∈ O ( S ) b',c' \in\mathcal{O}(S) b ′ , c ′ ∈ O ( S ) . By our hypothesis, [ [ σ ′ ( ϵ ) ] ] ∈ W 0 [\![\sigma'(\epsilon)]\!] \in W_0 [ [ σ ′ ( ϵ )] ] ∈ W 0 . If [ [ σ ′ ( ϵ ) ] ] [\![\sigma'(\epsilon)]\!] [ [ σ ′ ( ϵ )] ] is in R 0 R_0 R 0 , we are done. Otherwise, the normal form of b ′ ⋅ [ [ σ ′ ( ϵ ) ] ] ⋅ c ′ b' \cdot[\![\sigma'(\epsilon)]\!] \cdot c' b ′ ⋅ [ [ σ ′ ( ϵ )] ] ⋅ c ′ is in W 0 ∖ R 0 W_0 \setminus R_0 W 0 ∖ R 0 .
Suppose ⟨ T , σ ⟩ \langle T,\sigma\rangle ⟨ T , σ ⟩ is generated as a result of step (V3) (resp. (H3)). By definition, the tree 1 − 1 ⟨ T , σ ⟩ 1^{-1}\langle T,\sigma\rangle 1 − 1 ⟨ T , σ ⟩ (resp. trees i − 1 ⟨ T , σ ⟩ i^{-1}\langle T,\sigma\rangle i − 1 ⟨ T , σ ⟩ , for i ∈ [ 2 ] i \in[2] i ∈ [ 2 ] ) has height ( h 0 − 1 ) (h_0-1) ( h 0 − 1 ) , and hence belongs to the set H i 0 − 1 H_{i_0-1} H i 0 − 1 . Therefore, ⟨ T , σ ⟩ ∈ H i 0 \langle T,\sigma\rangle\in H_{i_0} ⟨ T , σ ⟩ ∈ H i 0 , and the statement holds. □
Thus, our algorithm terminates.
Complexity
We now prove Proposition 5.8. Every label occurring in ⋃ i ∈ N H i \bigcup_{i\in\mathbb{N}} H_i ⋃ i ∈ N H i is a pair in ( Q × Q ) × T h S (Q \times Q) \times\mathrm{Th}_S ( Q × Q ) × Th S whose T h S \mathrm{Th}_S Th S -component is a normal expression over the alphabet wt ( T r a n s ) ∪ O ( [ wt ( T r a n s ) ] S ) ∪ { # } \operatorname{wt}(\mathrm{Trans}) \cup\mathcal{O}([\operatorname{wt}(\mathrm{Trans})]_S) \cup\{\#\} wt ( Trans ) ∪ O ([ wt ( Trans ) ] S ) ∪ { # } , which has at most ∣ T r a n s ∣ + K + 1 |\mathrm{Trans}| + K + 1 ∣ Trans ∣ + K + 1 letters: the cold letters are introduced only by (V3) and (H3), where they are transition weights, and the hot letters only by (V2) and (H2), where they are star closures of forgetful images of expressions over that same alphabet.
It remains to bound the lengths of these expressions, and the number of nodes per tree. Let L h L_h L h denote the maximum size of a label at a node of height h h h . Steps (V1) and (H1) select a subtree, and steps (V2) and (H2) replace a prefix and a suffix of a label by one hot letter each; none of these lengthen a label by more than an additive constant. The remaining steps (V3) and (H3) lengthen it by an additive constant, and by the sum of the sizes of the two children, respectively. Hence L h ≤ 2 L h − 1 + O ( 1 ) L_h \leq2L_{h-1} + O(1) L h ≤ 2 L h − 1 + O ( 1 ) , and so L h ∈ 2 O ( h ) L_h \in2^{O(h)} L h ∈ 2 O ( h ) . By Lemma D.4 it follows that L : = max h L h ∈ 2 O ( ∣ Q ∣ 2 ) L := \max_h L_h \in2^{O(|Q|^2)} L := max h L h ∈ 2 O ( ∣ Q ∣ 2 ) . Since v C v_C v C and h C h_C h C are respectively unary and binary, the trees are binary, and again by Lemma D.4 they have at most 2 ∣ Q ∣ 2 + 1 2^{|Q|^2+1} 2 ∣ Q ∣ 2 + 1 nodes. Each node therefore carries one of at most ∣ Q ∣ 2 ⋅ ( ∣ T r a n s ∣ + K + 1 ) L + 2 |Q|^2 \cdot(|\mathrm{Trans}| + K + 1)^{L+2} ∣ Q ∣ 2 ⋅ ( ∣ Trans ∣ + K + 1 ) L + 2 labels, where the first factor accounts for the pair of states. Taken over all nodes, this first factor contributes only 2 O ( ∣ Q ∣ 2 ) 2^{O(|Q|^2)} 2 O ( ∣ Q ∣ 2 ) to the exponent below, and is absorbed. Combining the three bounds yields Proposition 5.8.
Fixpoint Algorithm
FixPt:
Input: A wPDS ⟨ P , S , w t ⟩ \langle P, S, \mathrm{wt}\rangle ⟨ P , S , wt ⟩ , and states p , p ′ ∈ Q p,p' \in Q p , p ′ ∈ Q .
H p r e v ← ∅ H_{\mathrm{prev}} \gets\varnothing H prev ← ∅
H c u r r ← { ⟨ { ϵ } , σ ⟩ ∣ q ∈ Q , σ ( ϵ ) = ⟨ ⟨ q , q ⟩ , # ⟩ } H_{\mathrm{curr}} \gets\{\langle\{\epsilon\},\sigma\rangle\mid q \in Q,\ \sigma(\epsilon)=\langle\langle q,q\rangle,\#\rangle\} H curr ← {⟨{ ϵ } , σ ⟩ ∣ q ∈ Q , σ ( ϵ ) = ⟨⟨ q , q ⟩ , # ⟩}
while H p r e v ≠ H c u r r H_{\mathrm{prev}} \ne H_{\mathrm{curr}} H prev = H curr do
H p r e v ← H c u r r H_{\mathrm{prev}} \gets H_{\mathrm{curr}} H prev ← H curr
H c u r r ← H c u r r ∪ Compute v ( H c u r r ) ∪ Compute h ( H c u r r ) H_{\mathrm{curr}} \gets H_{\mathrm{curr}} \cup\operatorname{Compute}_{v}(H_{\mathrm{curr}}) \cup\operatorname{Compute}_{h}(H_{\mathrm{curr}}) H curr ← H curr ∪ Compute v ( H curr ) ∪ Compute h ( H curr )
end
f i x p o i n t ← { ⟦ f g t σ ( ϵ ) ⟧ ∣ ⟨ T , σ ⟩ ∈ H c u r r , s t ( σ ( ϵ ) ) = ⟨ p , p ′ ⟩ } \mathit{fixpoint} \gets\{\llbracket\mathrm{fgt}_{\sigma}(\epsilon)\rrbracket\mid\langle T,\sigma\rangle\in H_{\mathrm{curr}},\ \mathrm{st}(\sigma(\epsilon))=\langle p,p'\rangle\} fixpoint ← { [ [ fgt σ ( ϵ ) ] ] ∣ ⟨ T , σ ⟩ ∈ H curr , st ( σ ( ϵ )) = ⟨ p , p ′ ⟩}
return f i x p o i n t \mathit{fixpoint} fixpoint
Algorithm 1: Fixpoint Algorithm.
Qualitative Network Reachability is Decidable
Let us define the decision problem introduced in [8 ] :
ConfigReach:
Input: An acyclic network N = ⟨ P , c h , { ⟨ P , B , w t p ⟩ } p ∈ P , { ϕ δ } δ ∈ ⋃ p ∈ P T r a n s p ⟩ \mathcal{N}=\langle P,\mathrm{ch},\{\langle P,\mathbb{B},\mathrm{wt}^{p}\rangle\}_{p\in P},\{\phi^{\delta}\}_{\delta\in\bigcup_{p\in P}\mathrm{Trans}^{p}}\rangle N = ⟨ P , ch , {⟨ P , B , wt p ⟩ } p ∈ P , { ϕ δ } δ ∈ ⋃ p ∈ P Trans p ⟩ , and two global configurations c , c ′ ∈ ( Config ( P p ) ) p ∈ P \mathbf{c},\mathbf{c}'\in(\operatorname{Config}(P^{p}))_{p\in P} c , c ′ ∈ ( Config ( P p ) ) p ∈ P .
Questions: Does c ⇒ N ∗ c ′ \mathbf{c}\mathrel{\Rightarrow_{\mathcal{N}}^{*}}\mathbf{c}' c ⇒ N ∗ c ′ hold? If yes, what is a global trace from c \mathbf{c} c to c ′ \mathbf{c}' c ′ ?
Note that each wPDS in the input network is essentially a PDS, since each of the underlying semirings is the Boolean semiring.
Atig et al. showed that ConfigReach is decidable [8 Prop. 3, Thm. 4] . They first reduce the problem from acyclic networks to that of linear networks [8 Prop. 3] : after sorting the processes topologically, each process is simulated by one whose control state additionally stores a copy of the states of all the processes preceding it; the copy is refreshed by observing the immediately preceding process, and guards are checked against the copy. No process is merged or duplicated. Given a linear network and the root process p p p , the decision procedure starts with the computation of the downward closure of the set of all state sequences modulo stuttering that occur in some run from c p \mathbf{c}^{p} c p to c ′ p \mathbf{c}'^{p} c ′ p in P p P^{p} P p . Since the set of such sequences is a context-free language, its downward closure is effectively regular [14 , 48 ] . The downward closure is computed as an NFA A p \mathcal{A}^{p} A p , and a kind of product of A p \mathcal{A}^{p} A p with the child PDS P p ′ P^{p'} P p ′ then yields a PDS that we denote by L ( A p ) ∗ o b s P p ′ \mathcal{L}(\mathcal{A}^{p})*_{\mathrm{obs}}P^{p'} L ( A p ) ∗ obs P p ′ (see [8 ] for its explicit construction). Intuitively, the product PDS L ( A p ) ∗ o b s P p ′ \mathcal{L}(\mathcal{A}^{p})*_{\mathrm{obs}}P^{p'} L ( A p ) ∗ obs P p ′ computes the set of all runs in P p ′ P^{p'} P p ′ , where in each run P p ′ P^{p'} P p ′ observes the downward closure of the trace of some accepting run in A p \mathcal{A}^{p} A p , as an alternative to observing the states in P p P^{p} P p . The downward closure captures the possibility that the child process p ′ p' p ′ might have missed some of the state occurrences in p p p , since communication is asynchronous.
The process is repeated assuming p ′ p' p ′ as the new root process, and L ( A p ) o b s ∗ P p ′ \mathcal{L}(\mathcal{A}_p)^{*}_{\mathrm{obs}} \mathcal{P}_{p'} L ( A p ) obs ∗ P p ′ as the corresponding PDS, until we reach the leaf process l l l . At the end, the construction yields a product of the PDS P l \mathcal{P}^{l} P l at the leaf process l l l , with some NFA A \mathcal{A} A such that P l \mathcal{P}^{l} P l is allowed a run from c l c^{l} c l to c ′ l c'^{l} c ′ l iff there are compatible runs in each of the ancestor processes p ′ ′ p'' p ′′ (remember that each child process can observe the states of its parent process) from c p ′ ′ c^{p''} c p ′′ to c ′ p ′ ′ c'^{p''} c ′ p ′′ . One can decide the existence of such a run in polynomial time in the size of the final product PDS. Dually, Atig et al. also propose a bottom-up approach, that starts from the leaf processes and iteratively computes their upward closures. Intuitively, the upward closure captures the possibility that a child process does not need to observe all the states in a parent process.
Proof of Theorem 7.2
We will now give a proof of Theorem 7.2 . As mentioned earlier, our algorithm is an adaptation of the decision procedure proposed in [8 Prop. 4, Thm. 4] , instead using our fixpoint algorithm for simultaneously computing the required language closures of traces, as well as the weights of the corresponding traces. Our procedure reduces to the classical one in the degenerate case of the Boolean semiring, which is both ≤ B \leq_{\mathrm{B}} ≤ B - and ≥ B \geq_{\mathrm{B}} ≥ B -thin. Like the classical procedure, it first linearises the network [8 Prop. 3] ; by Lemma G.6 , which shows that this preserves the weight of every process, it suffices to compute GenConfigReach for linear networks, and the arguments below concern these. As a first step, we will show that our fixpoint computation preserves some properties used later in our algorithm.
Revisiting the Fixpoint Algorithm
Recall the arbitrarily fixed wPDS ⟨ P , S , w t ⟩ \langle\mathcal{P}, S, \mathrm{wt}\rangle ⟨ P , S , wt ⟩ , where P = ⟨ Q , A , Γ , T r a n s ⟩ \mathcal{P} = \langle Q, A, \Gamma, \mathrm{Trans}\rangle P = ⟨ Q , A , Γ , Trans ⟩ , and S = ⟨ S , ⊕ , ⊗ , 0 , 1 ⟩ S = \langle\mathcal{S}, \oplus, \otimes, 0, 1\rangle S = ⟨ S , ⊕ , ⊗ , 0 , 1 ⟩ . Our constructions below run the fixpoint algorithm over products of pumping semirings, which need not be pumping semirings themselves. The following lemma shows that thin ones are, in the right sense.
Lemma G.1. Let S 1 S_1 S 1 and S 2 S_2 S 2 be pumping semirings, and equip their products with a ⊛ : = ⨁ n ∈ N a n a^{\circledast} := \bigoplus_{n\in\mathbb{N}} a^n a ⊛ := ⨁ n ∈ N a n for a ≠ 0 a \ne0 a = 0 , as forced by Proposition 3.2, and an arbitrary value for 0 ⊛ 0^{\circledast} 0 ⊛ .
(1) If both are ≥ \geq ≥ -thin, then S 1 × S 2 S_1 \times S_2 S 1 × S 2 is a ≥ \geq ≥ -thin pumping semiring.
(2) If both are ≤ \leq ≤ -thin, then S 1 ⊠ S 2 : = ( ( S 1 ∖ { 0 } ) × ( S 2 ∖ { 0 } ) ) ∪ { 0 } S_1 \boxtimes S_2 := ((S_1 \setminus\{0\}) \times(S_2 \setminus\{0\})) \cup\{0\} S 1 ⊠ S 2 := (( S 1 ∖ { 0 }) × ( S 2 ∖ { 0 })) ∪ { 0 } is a subsemiring of S 1 × S 2 S_1 \times S_2 S 1 × S 2 , and a ≤ \leq ≤ -thin pumping semiring.
Proof. Countable sums in S 1 × S 2 S_1 \times S_2 S 1 × S 2 are taken componentwise, so in both cases (C2) holds, and thinness transfers componentwise. It remains to show (C1) and (C3).
(1) Instantiating ≥ \geq ≥ -thinness at a = c = 1 a = c = 1 a = c = 1 shows that 1 1 1 is the greatest element of each S i S_i S i . Hence, for all a , b , c ∈ S i a,b,c \in S_i a , b , c ∈ S i , including 0 0 0 , every term a n ⊗ b ⊗ c n a^n \otimes b \otimes c^n a n ⊗ b ⊗ c n lies below the term b b b for n = 0 n = 0 n = 0 , so ⨁ n ∈ N a n ⊗ b ⊗ c n = b \bigoplus_{n\in\mathbb{N}} a^n \otimes b \otimes c^n = b ⨁ n ∈ N a n ⊗ b ⊗ c n = b . In particular, a ⊛ = 1 a^{\circledast} = 1 a ⊛ = 1 for every non-zero element a a a of the product, and (C1) holds componentwise, as both of these sides equal b b b . (C3) holds trivially.
(2) ≤ \leq ≤ -thin semirings have no zero divisors: if x , y ≠ 0 x,y \ne0 x , y = 0 and x ⊗ y = 0 x \otimes y = 0 x ⊗ y = 0 , then y ≤ S x ⊗ y ⊗ 1 = 0 y \leq_{S} x \otimes y \otimes1 = 0 y ≤ S x ⊗ y ⊗ 1 = 0 , a contradiction. Moreover, x ⊕ y = 0 x \oplus y = 0 x ⊕ y = 0 implies x = y = 0 x = y = 0 x = y = 0 in any idempotent semiring. Hence S 1 ⊠ S 2 S_1 \boxtimes S_2 S 1 ⊠ S 2 is closed under ⊕ \oplus ⊕ , ⊗ \otimes ⊗ , and countable sums. Every non-zero element has non-zero components, so by Proposition 3.2 ⊗ \otimes ⊗ acts componentwise on it, staying in S 1 ⊠ S 2 S_1 \boxtimes S_2 S 1 ⊠ S 2 since a i ⊛ ≥ S i 1 a_i^{\circledast} \geq_{S_i} 1 a i ⊛ ≥ S i 1 ; thus (C1) and (C3) follow componentwise. □ \square □
The restriction to ⊠ \boxtimes ⊠ in (2) is necessary: for the arctic semiring S S S , the product S × S S \times S S × S violates (C1) at a = ⟨ − ∞ , 0 ⟩ a = \langle-\infty, 0\rangle a = ⟨ − ∞ , 0 ⟩ , b = ⟨ 0 , 0 ⟩ b = \langle0, 0\rangle b = ⟨ 0 , 0 ⟩ , and c = ⟨ 1 , 0 ⟩ c = \langle1, 0\rangle c = ⟨ 1 , 0 ⟩ , whose first components yield 0 ≠ ∞ 0 \ne\infty 0 = ∞ .
≤ S \le_S ≤ S -thin. Suppose S S S is ≤ S \le_S ≤ S -thin. Following our construction in § 6.2 , we construct the auxiliary wPDS ⟨ P , S T r a n s d c ⊠ S , w t ′ ⟩ \langle P, S_{\mathrm{Transdc}}\boxtimes S, \mathrm{wt}'\rangle ⟨ P , S Transdc ⊠ S , wt ′ ⟩ where we define w t ′ ( δ ) : = ⟨ ϵ + δ , w t ( δ ) ⟩ ∈ S T r a n s d c ⊠ S \mathrm{wt}'(\delta) := \langle\epsilon+\delta,\mathrm{wt}(\delta)\rangle\in S_{\mathrm{Transdc}}\boxtimes S wt ′ ( δ ) := ⟨ ϵ + δ , wt ( δ )⟩ ∈ S Transdc ⊠ S . Both components of w t ′ ( δ ) \mathrm{wt}'(\delta) wt ′ ( δ ) are non-zero, and S T r a n s d c S_{\mathrm{Transdc}} S Transdc is ≤ \le ≤ -thin (cf. Figure 12), so S T r a n s d c ⊠ S S_{\mathrm{Transdc}}\boxtimes S S Transdc ⊠ S is a pumping semiring by Lemma G.1 . Intuitively, traces in our auxiliary wPDS simultaneously track both the downward closure, and the weight of the trace w.r.t. w t \mathrm{wt} wt . Given arbitrary configurations c , c ′ ∈ Config ( P ) c,c' \in\operatorname{Config}(P) c , c ′ ∈ Config ( P ) , if w t ′ [ [ c , c ′ ] ] = ⟨ e , a ⟩ \mathrm{wt}'[[c,c']] = \langle e,a\rangle wt ′ [[ c , c ′ ]] = ⟨ e , a ⟩ , then it is easy to prove that ( ∣ e ∣ ) = Paths ( c , c ′ ) ↓ (\lvert e\rvert) = \operatorname{Paths}(c,c')\mathord{\downarrow} (∣ e ∣) = Paths ( c , c ′ ) ↓ , and a = w t [ [ c , c ′ ] ] a=\mathrm{wt}[[c,c']] a = wt [[ c , c ′ ]] . However, our fixpoint algorithm computes more than that.
Consider the sequence J 0 ⊆ J 1 ⊆ ⋯ J_0\subseteq J_1\subseteq\cdots J 0 ⊆ J 1 ⊆ ⋯ of finite sets of trees computed in our fixpoint iteration, for ⟨ P , S T r a n s d c ⊠ S , w t ′ ⟩ \langle P,S_{\mathrm{Transdc}}\boxtimes S,\mathrm{wt}'\rangle ⟨ P , S Transdc ⊠ S , wt ′ ⟩ . Let Y i = { fgt σ ( ϵ ) ∣ ⟨ T , fgt σ ⟩ ∈ J i } Y_i=\{\operatorname{fgt}_{\sigma}(\epsilon)\mid\langle T,\operatorname{fgt}_{\sigma}\rangle\in J_i\} Y i = { fgt σ ( ϵ ) ∣ ⟨ T , fgt σ ⟩ ∈ J i } be the set of root labels of the trees in J i J_i J i , for i ∈ N i\in\mathbb{N} i ∈ N . Now, suppose ⟨ ⟨ p , p ′ ⟩ , ⟨ e , a ⟩ ⟩ ∈ Y i \langle\langle p,p'\rangle,\langle e,a\rangle\rangle\in Y_i ⟨⟨ p , p ′ ⟩ , ⟨ e , a ⟩⟩ ∈ Y i for some i ∈ N i\in\mathbb{N} i ∈ N . By property (P3), there must exist a countable set of traces X ⊆ Paths ( ⟨ p , ⊣ ⟩ , ⟨ p ′ , ⊣ ⟩ ) X\subseteq\operatorname{Paths}(\langle p,\dashv\rangle,\langle p',\dashv\rangle) X ⊆ Paths (⟨ p , ⊣ ⟩ , ⟨ p ′ , ⊣ ⟩) such that its downward closure X ↓ X\mathord{\downarrow} X ↓ is ( ∣ e ∣ ) (\lvert e\rvert) (∣ e ∣) , and the sum of the weights of its elements is a a a . Since our construction steps never use the ⊕ \oplus ⊕ operation of the underlying semiring S T r a n s d c ⊠ S S_{\mathrm{Transdc}}\boxtimes S S Transdc ⊠ S , our expression e e e cannot be of the form e 1 + e 2 e_1+e_2 e 1 + e 2 . Thus, e e e is a product of atoms. This leaves two other cases: (1) either e e e uses an atom of the form A ∗ A^* A ∗ , or (2) it does not. Using a case-by-case analysis, we can prove that:
Lemma G.2. For any finite subset X ′ ⊆ X X'\subseteq X X ′ ⊆ X of traces in X X X , there exists a trace τ ∈ X \tau\in X τ ∈ X , such that ∀ τ ′ ∈ X ′ , τ ′ ⊑ τ \forall\tau'\in X',\ \tau'\sqsubseteq\tau ∀ τ ′ ∈ X ′ , τ ′ ⊑ τ .
Given an arbitrary word w ∈ ( ∣ e ∣ ) w\in(\lvert e\rvert) w ∈ (∣ e ∣) , let τ w ∈ X \tau_w\in X τ w ∈ X be a minimal trace that contains w w w as a subword. Such a trace exists since w ∈ ( ∣ e ∣ ) = X ↓ w\in(\lvert e\rvert)=X\mathord{\downarrow} w ∈ (∣ e ∣) = X ↓ , and the subword ordering is well-founded. Now, the set { τ w } ∪ ( X ∖ { τ w } ↓ ) ⊆ X \{\tau_w\}\cup(X\setminus\{\tau_w\}\mathord{\downarrow})\subseteq X { τ w } ∪ ( X ∖ { τ w } ↓ ) ⊆ X , which contains no proper subword of τ w \tau_w τ w , is countable. Consider the following (potentially infinite) enumeration:
τ 1 , τ 2 , τ 3 , … \tau_1,\tau_2,\tau_3,\ldots τ 1 , τ 2 , τ 3 , …
Using Lemma G.2, there must exist the following increasing sequence of traces in X X X :
τ 1 ′ ⊑ τ 2 ′ ⊑ τ 3 ′ ⊑ ⋯ \tau'_1\sqsubseteq\tau'_2\sqsubseteq\tau'_3\sqsubseteq\cdots τ 1 ′ ⊑ τ 2 ′ ⊑ τ 3 ′ ⊑ ⋯
where τ n ′ ∈ X \tau'_n\in X τ n ′ ∈ X is a trace that contains every trace in { τ k ∣ k ≤ n } ∪ { τ k ′ ∣ k < n } \{\tau_k\mid k\le n\}\cup\{\tau'_k\mid k<n\} { τ k ∣ k ≤ n } ∪ { τ k ′ ∣ k < n } as a subword. Observe that this sequence must contain a trace that contains w w w as a subword, since τ w \tau_w τ w belongs to the earlier enumeration. Let the corresponding index be i w ∈ N i_w\in\mathbb{N} i w ∈ N . Then the sequence
τ i w ′ ⊑ τ i w + 1 ′ ⊑ τ i w + 2 ′ ⊑ ⋯ \tau'_{i_w}\sqsubseteq\tau'_{i_w+1}\sqsubseteq\tau'_{i_w+2}\sqsubseteq\cdots τ i w ′ ⊑ τ i w + 1 ′ ⊑ τ i w + 2 ′ ⊑ ⋯
is entirely contained in { w } ↑ \{w\}\mathord{\uparrow} { w } ↑ . Since S S S is ≤ S \le_S ≤ S -thin, we thus obtain:
⨁ τ ∈ X w t ∗ ( τ ) = ⨁ n ≥ i w w t ∗ ( τ n ′ ) = a . \bigoplus_{\tau\in X}\mathrm{wt}^*(\tau)=\bigoplus_{n\ge i_w}\mathrm{wt}^*(\tau'_n)=a. τ ∈ X ⨁ wt ∗ ( τ ) = n ≥ i w ⨁ wt ∗ ( τ n ′ ) = a .
Similarly, given a countable set of words W ⊆ ( ∣ e ∣ ) W\subseteq(\lvert e\rvert) W ⊆ (∣ e ∣) , let X W = { τ w ∣ w ∈ W } X_W=\{\tau_w\mid w\in W\} X W = { τ w ∣ w ∈ W } be a set of minimal traces that contain words in W W W . As before, since X W ∪ ( X ∖ X W ↓ ) X_W\cup(X\setminus X_W\mathord{\downarrow}) X W ∪ ( X ∖ X W ↓ ) is a countable set, using earlier techniques we can obtain a sequence:
τ ˉ 1 † ⊑ τ ˉ 2 † ⊑ τ ˉ 3 † ⊑ ⋯ \bar{\tau}^{\dagger}_1\sqsubseteq\bar{\tau}^{\dagger}_2\sqsubseteq\bar{\tau}^{\dagger}_3\sqsubseteq\cdots τ ˉ 1 † ⊑ τ ˉ 2 † ⊑ τ ˉ 3 † ⊑ ⋯
such that for any finite subset W ′ W' W ′ of W W W , there exists a trace τ ˉ W ′ † \bar{\tau}^{\dagger}_{W'} τ ˉ W ′ † which contains every word in W ′ W' W ′ as a subword. Once again, since S S S is ≤ S \le_S ≤ S -thin, we obtain:
⨁ n ∈ N w t ∗ ( τ ˉ n † ) = a . \bigoplus_{n\in\mathbb{N}}\mathrm{wt}^*(\bar{\tau}^{\dagger}_n)=a. n ∈ N ⨁ wt ∗ ( τ ˉ n † ) = a .
Let J 0 J_0 J 0 be the fixpoint of the sequence of J i J_i J i 's. We then have the following property:
Corollary G.3. Let ⟨ ⟨ p , p ′ ⟩ , ⟨ e , a ⟩ ⟩ ∈ Y i 0 \langle\langle p,p'\rangle,\langle e,a\rangle\rangle\in Y_{i_0} ⟨⟨ p , p ′ ⟩ , ⟨ e , a ⟩⟩ ∈ Y i 0 be arbitrary. For every countable set W ⊆ ( ∣ e ∣ ) W\subseteq(\lvert e\rvert) W ⊆ (∣ e ∣) , there exists a countable subset Z ⊆ Paths ( ⟨ p , ⊣ ⟩ , ⟨ p ′ , ⊣ ⟩ ) Z\subseteq\operatorname{Paths}(\langle p,\dashv\rangle,\langle p',\dashv\rangle) Z ⊆ Paths (⟨ p , ⊣ ⟩ , ⟨ p ′ , ⊣ ⟩) of traces such that the following properties hold:
⨁ τ ′ ∈ Z wt ∗ ( τ ′ ) = a \bigoplus_{\tau' \in Z} \operatorname{wt}^{*}(\tau') = a ⨁ τ ′ ∈ Z wt ∗ ( τ ′ ) = a ,
for every finite subset W ′ ⊆ W W' \subseteq W W ′ ⊆ W , there exists τ ∈ Z ∩ ⋂ w ∈ W ′ ( { w } ↑ ) \tau\in Z \cap\bigcap_{w \in W'} (\{w\} \uparrow) τ ∈ Z ∩ ⋂ w ∈ W ′ ({ w } ↑ ) , and
Z Z Z is totally-ordered under the subword order ⊑ \sqsubseteq ⊑ .
≥ S \geq_S ≥ S -thin. Suppose S \mathcal{S} S is ≥ S \geq_S ≥ S -thin. Following our construction in § 6.1 , we construct the auxiliary wPDS ⟨ P , S T r a n s u c × S , wt ′ ⟩ \langle\mathcal{P}, \mathcal{S}_{\mathrm{Trans}_{\mathrm{uc}}} \times\mathcal{S}, \operatorname{wt}'\rangle ⟨ P , S Trans uc × S , wt ′ ⟩ where we define wt ′ ( δ ) : = ⟨ { δ } , wt ( δ ) ⟩ ∈ S T r a n s u c × S \operatorname{wt}'(\delta) := \langle\{\delta\}, \operatorname{wt}(\delta)\rangle\in\mathcal{S}_{\mathrm{Trans}_{\mathrm{uc}}} \times\mathcal{S} wt ′ ( δ ) := ⟨{ δ } , wt ( δ )⟩ ∈ S Trans uc × S . Since S T r a n s u c \mathcal{S}_{\mathrm{Trans}_{\mathrm{uc}}} S Trans uc is ≥ \geq ≥ -thin (cf. Figure 12), S T r a n s u c × S \mathcal{S}_{\mathrm{Trans}_{\mathrm{uc}}} \times\mathcal{S} S Trans uc × S is a pumping semiring by Lemma G.1 . Intuitively, the traces in this wPDS track both their upward closure, and their weight w.r.t. wt \operatorname{wt} wt . Given arbitrary configurations c , c ′ ∈ Config ( P ) c,c' \in\operatorname{Config}(\mathcal{P}) c , c ′ ∈ Config ( P ) , if wt ′ ⟦ c , c ′ ⟧ = ⟨ L , a ⟩ \operatorname{wt}'\llbracket c,c'\rrbracket= \langle L,a\rangle wt ′ [ [ c , c ′ ] ] = ⟨ L , a ⟩ , then it is easy to prove via induction that L ↑ = Paths ( c , c ′ ) ↑ L \uparrow= \operatorname{Paths}(c,c') \uparrow L ↑= Paths ( c , c ′ ) ↑ , and a = wt ⟦ c , c ′ ⟧ a = \operatorname{wt}\llbracket c,c'\rrbracket a = wt [ [ c , c ′ ] ] . As before, we will show that there is more to the story.
Consider the sequence J 0 ⊆ J 1 ⊆ ⋯ J_0 \subseteq J_1 \subseteq\cdots J 0 ⊆ J 1 ⊆ ⋯ of finite sets of trees computed in every iteration of Algorithm 1 for ⟨ P , S T r a n s u c × S , wt ′ ⟩ \langle\mathcal{P},\mathcal{S}_{\mathrm{Trans}_{\mathrm{uc}}} \times\mathcal{S},\operatorname{wt}'\rangle ⟨ P , S Trans uc × S , wt ′ ⟩ . Let Y i = { fgt σ ( ϵ ) ∣ ⟨ T , fgt σ ⟩ ∈ J i } Y_i = \{\operatorname{fgt}_{\sigma}(\epsilon) \mid\langle T,\operatorname{fgt}_{\sigma}\rangle\in J_i\} Y i = { fgt σ ( ϵ ) ∣ ⟨ T , fgt σ ⟩ ∈ J i } be the set of root labels of the trees in J i J_i J i , for i ∈ N i \in\mathbb{N} i ∈ N . Now, suppose ⟨ ⟨ p , p ′ ⟩ , ⟨ L , a ⟩ ⟩ ∈ Y i \langle\langle p,p'\rangle,\langle L,a\rangle\rangle\in Y_i ⟨⟨ p , p ′ ⟩ , ⟨ L , a ⟩⟩ ∈ Y i for some i ∈ N i \in\mathbb{N} i ∈ N . By property (P3), there must exist a set of traces X ⊆ Paths ( ⟨ p , ⊣ ⟩ , ⟨ p ′ , ⊣ ⟩ ) X \subseteq\operatorname{Paths}(\langle p,\dashv\rangle,\langle p',\dashv\rangle) X ⊆ Paths (⟨ p , ⊣ ⟩ , ⟨ p ′ , ⊣ ⟩) such that its upward closure X ↑ X \uparrow X ↑ is L ↑ L \uparrow L ↑ , and the sum of the weights of its elements is a a a . Since our construction steps never use the ⊕ \oplus ⊕ operation of the underlying semiring S T r a n s u c × S \mathcal{S}_{\mathrm{Trans}_{\mathrm{uc}}} \times\mathcal{S} S Trans uc × S , the set L L L is obtained from the singletons { δ } \{\delta\} { δ } , for δ ∈ Trans \delta\in\operatorname{Trans} δ ∈ Trans , using only ⋅ u c \cdot_{\mathrm{uc}} ⋅ uc and ∗ u c \ast_{\mathrm{uc}} ∗ uc , both of which map singletons to singletons. In other words L L L is a singleton of the form { τ } \{\tau\} { τ } . Moreover, as X ↑ = { τ } ↑ X \uparrow= \{\tau\} \uparrow X ↑= { τ } ↑ , some trace in X X X is both a subword and a superword of τ \tau τ . Hence, τ ∈ X \tau\in X τ ∈ X holds. Since S \mathcal{S} S is ≥ S \geq_S ≥ S -thin, we obtain the equation:
⨁ τ ′ ∈ X wt ∗ ( τ ′ ) = wt ∗ ( τ ) = a . \bigoplus_{\tau' \in X} \operatorname{wt}^{*}(\tau') = \operatorname{wt}^{*}(\tau) = a. τ ′ ∈ X ⨁ wt ∗ ( τ ′ ) = wt ∗ ( τ ) = a .
Let J i 0 J_{i_0} J i 0 be the fixpoint of the sequence of J i J_i J i 's. This leads to the following corollary:
Corollary G.4. Let ⟨ ⟨ p , p ′ ⟩ , ⟨ L , a ⟩ ⟩ ∈ Y i 0 \langle\langle p,p'\rangle,\langle L,a\rangle\rangle\in Y_{i_0} ⟨⟨ p , p ′ ⟩ , ⟨ L , a ⟩⟩ ∈ Y i 0 be arbitrary. For every w ∈ L ↑ w \in L \uparrow w ∈ L ↑ , there exists a trace τ ∈ Paths ( ⟨ p , ⊣ ⟩ , ⟨ p ′ , ⊣ ⟩ ) \tau\in\operatorname{Paths}(\langle p,\dashv\rangle,\langle p',\dashv\rangle) τ ∈ Paths (⟨ p , ⊣ ⟩ , ⟨ p ′ , ⊣ ⟩) which is contained in the downward closure { w } ↓ \{w\} \downarrow { w } ↓ , such that wt ∗ ( τ ) = a \operatorname{wt}^{*}(\tau) = a wt ∗ ( τ ) = a holds.
Asynchronous product
We briefly review a certain notion of asynchronous products, which form an important primitive for the network verification algorithm presented in [8 ] , and also ours.
Consider k k k alphabets B 1 , B 2 , … , B k B_1,B_2,\ldots,B_k B 1 , B 2 , … , B k . We write B i ϵ : = B i ∪ { ϵ } B_i^{\epsilon} := B_i \cup\{\epsilon\} B i ϵ := B i ∪ { ϵ } for the alphabet B i B_i B i padded with a fresh idling symbol, and
B ∥ : = ( B 1 ϵ × ⋯ × B k ϵ ) ∖ { ( ϵ , … , ϵ ) } . B^{\parallel} := \left(B_1^{\epsilon} \times\cdots\times B_k^{\epsilon}\right) \setminus\{(\epsilon,\ldots,\epsilon)\}. B ∥ := ( B 1 ϵ × ⋯ × B k ϵ ) ∖ {( ϵ , … , ϵ )} .
for the set of tuples in which at least one component moves. Given a word w ∈ ( B ∥ ) ∗ w \in(B^{\parallel})^{*} w ∈ ( B ∥ ) ∗ , we write π B i ( w ) \pi_{B_i}(w) π B i ( w ) to denote the pointwise projection of w w w onto the component that corresponds to B i B_i B i , erasing every occurrence of ϵ \epsilon ϵ , for i ∈ [ k ] i \in[k] i ∈ [ k ] . Given k k k languages L i ⊆ B i ∗ L_i \subseteq B_i^{*} L i ⊆ B i ∗ , for i ∈ [ k ] i \in[k] i ∈ [ k ] , we define their asynchronous product L 1 ∥ ⋯ ∥ L k ⊆ ( B ∥ ) ∗ L_1 \parallel\cdots\parallel L_k \subseteq(B^{\parallel})^{*} L 1 ∥ ⋯ ∥ L k ⊆ ( B ∥ ) ∗ as the set of words w ∈ ( B ∥ ) ∗ w \in(B^{\parallel})^{*} w ∈ ( B ∥ ) ∗ such that π B i ( w ) ∈ L i \pi_{B_i}(w) \in L_i π B i ( w ) ∈ L i , for i ∈ [ k ] i \in[k] i ∈ [ k ] . Padding is what makes the product asynchronous: a component idles at the positions where its coordinate is ϵ \epsilon ϵ , so the L i L_i L i need not be of equal length. We also denote this product by ∥ i ∈ [ k ] L i \mathop{\parallel}_{i \in[k]} L_i ∥ i ∈ [ k ] L i . The following result is folklore:
Lemma G.5. Given k k k regular languages L 1 , … , L k L_1,\ldots,L_k L 1 , … , L k , ∥ i ∈ [ k ] L i \mathop{\parallel}_{i \in[k]} L_i ∥ i ∈ [ k ] L i is effectively computable.
The Algorithms
We are now ready to present our network verification algorithm. Henceforth, the input acyclic network N = ⟨ P , ch , { ⟨ P p , S p , wt p ⟩ p ∈ P , { δ } δ ∈ ⋃ p ∈ P Trans p ⟩ \mathcal{N} = \langle P,\operatorname{ch},\{\langle\mathcal{P}^{p},\mathcal{S}^{p},\operatorname{wt}^{p}\rangle_{p \in P},\{\delta\}_{\delta\in\bigcup_{p \in P}\operatorname{Trans}^{p}}\rangle N = ⟨ P , ch , {⟨ P p , S p , wt p ⟩ p ∈ P , { δ } δ ∈ ⋃ p ∈ P Trans p ⟩ , and global configurations c c c and c ′ c' c ′ are considered to be globally available in our algorithms. For simplicity of presentation, we assume c p c^{p} c p is of the form ⟨ q p , ⊣ ⟩ \langle q^{p},\dashv\rangle ⟨ q p , ⊣ ⟩ for some q p ∈ Q p q^{p} \in Q^{p} q p ∈ Q p , for every p ∈ P p \in P p ∈ P , i.e., the local configurations have empty stacks. Similarly, we assume c ′ p c^{\prime p} c ′ p is of the form ⟨ q ′ p , ⊢ ⟩ \langle q^{\prime p},\vdash\rangle ⟨ q ′ p , ⊢ ⟩ for some q ′ p ∈ Q p q^{\prime p}\in Q^p q ′ p ∈ Q p , for every p ∈ P p\in P p ∈ P . Note that this is not a limitation, as one can reduce the general problem instance to an auxiliary instance of this form. Given a process p ∈ P p\in P p ∈ P , we write Parents ( p ) : = { p ′ ∣ ⟨ p ′ , p ⟩ ∈ c h } \operatorname{Parents}(p):=\{p^{\prime}\mid\langle p^{\prime},p\rangle\in\mathit{ch}\} Parents ( p ) := { p ′ ∣ ⟨ p ′ , p ⟩ ∈ ch } and Children ( p ) : = { p ′ ∣ ⟨ p , p ′ ⟩ ∈ c h } \operatorname{Children}(p):=\{p^{\prime}\mid\langle p,p^{\prime}\rangle\in\mathit{ch}\} Children ( p ) := { p ′ ∣ ⟨ p , p ′ ⟩ ∈ ch } to denote the set of parents and children of p p p respectively. A process observes its parents.
Linearisation. Following [8 Prop. 3] (cf. Section F), we first reduce N \mathcal{N} N to a linear network. Fix a topological order p 1 , … , p n p_1,\ldots,p_n p 1 , … , p n of P P P in which every process observes only processes preceding it, i.e., ⟨ p j , p i ⟩ ∈ c h \langle p_j,p_i\rangle\in\mathit{ch} ⟨ p j , p i ⟩ ∈ ch implies j < i j<i j < i , and write Q < i : = Q p i − 1 × ⋯ × Q p 1 Q_{<i}:=Q^{p_{i-1}}\times\cdots\times Q^{p_1} Q < i := Q p i − 1 × ⋯ × Q p 1 . We construct the network N ′ \mathcal{N}^{\prime} N ′ with processes p 1 ′ , … , p n ′ p_1^{\prime},\ldots,p_n^{\prime} p 1 ′ , … , p n ′ and channels c h ′ : = { ⟨ p i − 1 ′ , p i ′ ⟩ ∣ 1 < i ≤ n } \mathit{ch}^{\prime}:=\{\langle p_{i-1}^{\prime},p_i^{\prime}\rangle\mid1<i\le n\} ch ′ := {⟨ p i − 1 ′ , p i ′ ⟩ ∣ 1 < i ≤ n } , in which the wPDS of p i ′ p_i^{\prime} p i ′ has control states Q p i × Q < i Q^{p_i}\times Q_{<i} Q p i × Q < i , the stack alphabet of P p i \mathcal{P}^{p_i} P p i , the semiring S p i S^{p_i} S p i , and the following transitions:
(refresh) for all q ∈ Q p i q\in Q^{p_i} q ∈ Q p i and x , y ∈ Q < i x,y\in Q_{<i} x , y ∈ Q < i , the transition ⟨ ⟨ q , x ⟩ , ϵ , ϵ , ϵ , ⟨ q , y ⟩ ⟩ \langle\langle q,x\rangle,\epsilon,\epsilon,\epsilon,\langle q,y\rangle\rangle ⟨⟨ q , x ⟩ , ϵ , ϵ , ϵ , ⟨ q , y ⟩⟩ , enabled when p i − 1 ′ p_{i-1}^{\prime} p i − 1 ′ is in the state y y y , with weight 1 1 1 ; it updates the copy of the states of the preceding processes;
(simulate) for every δ = ⟨ q , α , u , α ′ , q ′ ⟩ ∈ Trans p i \delta=\langle q,\alpha,u,\alpha^{\prime},q^{\prime}\rangle\in\operatorname{Trans}^{p_i} δ = ⟨ q , α , u , α ′ , q ′ ⟩ ∈ Trans p i and every x ∈ Q < i x\in Q_{<i} x ∈ Q < i whose components, together with q q q , satisfy ϕ p i \phi^{p_i} ϕ p i , the unguarded transition ⟨ ⟨ q , x ⟩ , α , u , α ′ , ⟨ q ′ , x ⟩ ⟩ \langle\langle q,x\rangle,\alpha,u,\alpha^{\prime},\langle q^{\prime},x\rangle\rangle ⟨⟨ q , x ⟩ , α , u , α ′ , ⟨ q ′ , x ⟩⟩ , with weight wt p i ( δ ) \operatorname{wt}^{p_i}(\delta) wt p i ( δ ) ; it simulates δ \delta δ , checking its guard against the copy.
No process is merged or duplicated: the stack and the weights of p i ′ p_i^{\prime} p i ′ are those of p i p_i p i , and N ′ \mathcal{N}^{\prime} N ′ is linear. Given a global configuration c c c of N \mathcal{N} N , we write c ~ \tilde{c} c ~ for the global configuration of N ′ \mathcal{N}^{\prime} N ′ in which every process has the local configuration of c c c , and every copy holds the corresponding states of c c c .
Lemma G.6. Let c , c ′ c,c^{\prime} c , c ′ be global configurations of N \mathcal{N} N , and let c ′ ′ c^{\prime\prime} c ′′ range over the finitely many global configurations of N ′ \mathcal{N}^{\prime} N ′ that agree with c ′ c^{\prime} c ′ on the states and stacks of the original processes. Then c ⇒ N ∗ c ′ c\Rightarrow_{\mathcal{N}}^{*}c^{\prime} c ⇒ N ∗ c ′ iff c ~ ⇒ N ′ ∗ c ′ ′ \tilde{c}\Rightarrow_{\mathcal{N}^{\prime}}^{*}c^{\prime\prime} c ~ ⇒ N ′ ∗ c ′′ for some such c ′ ′ c^{\prime\prime} c ′′ , and for every i ∈ [ n ] i\in[n] i ∈ [ n ] ,
⟦ c , c ′ ⟧ N p i = ⨁ c ′ ′ ⟦ c ~ , c ′ ′ ⟧ N ′ p i ′ . \llbracket c,c^{\prime}\rrbracket_{\mathcal{N}}^{p_i}
=
\bigoplus_{c^{\prime\prime}}\llbracket\tilde{c},c^{\prime\prime}\rrbracket_{\mathcal{N}^{\prime}}^{p_i^{\prime}}. [ [ c , c ′ ] ] N p i = c ′′ ⨁ [ [ c ~ , c ′′ ] ] N ′ p i ′ .
Proof sketch. The proof of [8 Prop. 3] relates the global traces of N \mathcal{N} N from c c c to c ′ c^{\prime} c ′ with those of N ′ \mathcal{N}^{\prime} N ′ from c ~ \tilde{c} c ~ to some c ′ ′ c^{\prime\prime} c ′′ , such that every process performs the same sequence of transitions of P p i \mathcal{P}^{p_i} P p i , up to inserted refresh steps. The weight of a process depends only on its local trace, and refresh steps have weight 1 1 1 , so the per-process aggregates coincide; the sum over c ′ ′ c^{\prime\prime} c ′′ accounts for the final values of the copies. □
Henceforth, we run our algorithms on N ′ \mathcal{N}^{\prime} N ′ , writing N \mathcal{N} N for it by abuse of notation; by Lemma G.6, this computes GenConfigReach for the original network. In particular, every process now has at most one parent and at most one child. The target state q ′ p q^{\prime p} q ′ p of a process stands for any of its states whose first component is the original target state, and the subroutines take the union over these, just as they do over the accepting states of the observation automaton.
As discussed in Section 7, there are two variants of our algorithm: a top-down approach that works for ≤ S \le_S ≤ S -thin semirings, and a bottom-up approach that works for ≥ S \ge_S ≥ S -thin semirings.
≤ S \le_S ≤ S -thin semirings. Suppose S p S^p S p is ≤ S \le_S ≤ S -thin for every p ∈ P p\in P p ∈ P .
Given a process p ∈ P p\in P p ∈ P and a transition δ = ⟨ q , α , u , α ′ , q ′ ⟩ ∈ Trans p \delta=\langle q,\alpha,u,\alpha^{\prime},q^{\prime}\rangle\in\operatorname{Trans}^p δ = ⟨ q , α , u , α ′ , q ′ ⟩ ∈ Trans p , we write π s t ( δ ) : = q ′ \pi_{\mathrm{st}}(\delta):=q^{\prime} π st ( δ ) := q ′ to denote its successor state. Given a word w = δ 1 ⋯ δ n ∈ Trans p ∗ w=\delta_1\cdots\delta_n\in\operatorname{Trans}^{p*} w = δ 1 ⋯ δ n ∈ Trans p ∗ , we naturally define π s t ∗ ( w ) : = π s t ( δ 1 ) ⋯ π s t ( δ n ) ∈ Q p ∗ \pi_{\mathrm{st}}^{*}(w):=\pi_{\mathrm{st}}(\delta_1)\cdots\pi_{\mathrm{st}}(\delta_n)\in Q^{p*} π st ∗ ( w ) := π st ( δ 1 ) ⋯ π st ( δ n ) ∈ Q p ∗ . As per convention, given a language L ⊆ Trans p ∗ L\subseteq\operatorname{Trans}^{p*} L ⊆ Trans p ∗ , we write π s t ∗ ( L ) \pi_{\mathrm{st}}^{*}(L) π st ∗ ( L ) to denote the language { π s t ∗ ( w ) ∣ w ∈ L } ⊆ Q p ∗ \{\pi_{\mathrm{st}}^{*}(w)\mid w\in L\}\subseteq Q^{p*} { π st ∗ ( w ) ∣ w ∈ L } ⊆ Q p ∗ .
Automata Product. Consider a wPDS ⟨ P p ′ , S p ′ , wt p ′ ⟩ \langle\mathcal{P}^{p^{\prime}},S^{p^{\prime}},\operatorname{wt}^{p^{\prime}}\rangle ⟨ P p ′ , S p ′ , wt p ′ ⟩ , for some p ′ ∈ P p^{\prime}\in P p ′ ∈ P , and a regular language L L L whose letters are tuples of states of the processes in Parents ( p ′ ) \operatorname{Parents}(p^{\prime}) Parents ( p ′ ) . We write L ∗ o b s ⟨ P p ′ , S p ′ , wt p ′ ⟩ L*_{\mathrm{obs}}\langle\mathcal{P}^{p^{\prime}},S^{p^{\prime}},\operatorname{wt}^{p^{\prime}}\rangle L ∗ obs ⟨ P p ′ , S p ′ , wt p ′ ⟩ to denote the wPDS whose underlying PDS is the product L ∗ o b s P p ′ L*_{\mathrm{obs}}\mathcal{P}^{p^{\prime}} L ∗ obs P p ′ recalled in Section F (cf. [8 ] ), with weights added as follows. Each transition of L ∗ o b s P p ′ L*_{\mathrm{obs}}\mathcal{P}^{p^{\prime}} L ∗ obs P p ′ simulates a transition δ = ⟨ q , α , u , α ′ , q ′ ⟩ \delta=\langle q,\alpha,u,\alpha^{\prime},q^{\prime}\rangle δ = ⟨ q , α , u , α ′ , q ′ ⟩ of P p ′ \mathcal{P}^{p'} P p ′ while observing a tuple q \mathbf{q} q of its parents’ states that, together with its own current state q q q , satisfies the guard ϕ δ \phi^{\delta} ϕ δ , and which it consumes as the next letter of L L L ; we assign it the weight wt P p ′ ( δ ) \operatorname{wt}^{\mathcal{P}^{p'}}(\delta) wt P p ′ ( δ ) . Intuitively, we simulate P p ′ \mathcal{P}^{p'} P p ′ while consuming elements from L L L as state observations, so that the observations made along any run form a word of L L L . Its states are pairs of a state of P p ′ \mathcal{P}^{p'} P p ′ and a state of an NFA A L \mathcal{A}_{L} A L recognising L L L , which we call the observation automaton ; we write s L s_{L} s L for its initial state, and F L F_{L} F L for its set of accepting states.
Algorithm. Our algorithm (cf. Algorithm 2) has a main routine TopDown describing the top-down flow of computation, and a subroutine TDSub (cf. Algorithm 3) that describes the computation in each level. While TDSub and most of TopDown are straightforward weighted adaptations of Atig et al.’s decision procedure, the biggest difference lies in Lines 8-14. Since N \mathcal{N} N is linear, each iteration visits the single next process of the chain, which computes its individual fixpoint for every tuple of fixpoints computed so far. A fixpoint of its parent summarises a whole family of the parent’s runs, through the downward closure of their observable states, and the child may use any observations from this closure. That these observations are always embedded in runs of the parent whose weights add up to that fixpoint follows from Corollary G.3.
≥ S \geq_{S} ≥ S -thin semirings. Suppose S p \mathcal{S}^{p} S p is ≥ S \geq_{S} ≥ S -thin for every p ∈ P p \in P p ∈ P .
Automata Product. As a shorthand, we will write Q = ( Q p ) p ∈ P \mathbf{Q} = (Q^{p})_{p\in P} Q = ( Q p ) p ∈ P . For δ ∈ Trans p \delta\in\operatorname{Trans}^{p} δ ∈ Trans p , the guard ϕ δ \phi^{\delta} ϕ δ only constrains the states of p p p and of the processes it observes; we identify it with the set of tuples in Q \mathbf{Q} Q whose projection onto these processes lies in ϕ δ \phi^{\delta} ϕ δ , and thus consider the map ϕ : δ ↦ ϕ δ ⊆ Q \phi: \delta\mapsto\phi^{\delta} \subseteq\mathbf{Q} ϕ : δ ↦ ϕ δ ⊆ Q , for δ ∈ ⋃ p ∈ P Trans p \delta\in\bigcup_{p\in P}\operatorname{Trans}^{p} δ ∈ ⋃ p ∈ P Trans p . Given a regular language L ⊆ Trans p ∗ L \subseteq\operatorname{Trans}^{p*} L ⊆ Trans p ∗ , for some p ∈ P p \in P p ∈ P , we write ϕ ∗ ( L ) \phi^{*}(L) ϕ ∗ ( L ) to denote its image under the homomorphism induced by ϕ \phi ϕ . Given Q ′ ⊆ Q \mathbf{Q}' \subseteq\mathbf{Q} Q ′ ⊆ Q and p ′ ∈ P p' \in P p ′ ∈ P , we write Q ′ p ′ \mathbf{Q}'^{p'} Q ′ p ′ for the projection of Q ′ \mathbf{Q}' Q ′ onto Q p ′ Q^{p'} Q p ′ .
Consider a regular language L ⊆ 2 Q ∗ L \subseteq2^{\mathbf{Q}}{}^{*} L ⊆ 2 Q ∗ of constraints, and a wPDS ⟨ P p ′ , S p ′ , wt p ′ ⟩ \langle\mathcal{P}^{p'},\mathcal{S}^{p'},\operatorname{wt}^{p'}\rangle ⟨ P p ′ , S p ′ , wt p ′ ⟩ , for some p ′ ∈ P p' \in P p ′ ∈ P . We write L ∗ ϕ ⟨ P p ′ , S p ′ , wt p ′ ⟩ L *_{\phi} \langle\mathcal{P}^{p'},\mathcal{S}^{p'},\operatorname{wt}^{p'}\rangle L ∗ ϕ ⟨ P p ′ , S p ′ , wt p ′ ⟩ to denote the wPDS whose underlying PDS is the product L ∗ ϕ P p ′ L *_{\phi} \mathcal{P}^{p'} L ∗ ϕ P p ′ of Atig et al.’s bottom-up procedure [8 ] , with weights added as follows. Each transition of L ∗ ϕ P p ′ L *_{\phi} \mathcal{P}^{p'} L ∗ ϕ P p ′ simulates a transition δ = ⟨ q , α , u , α ′ , q ′ ⟩ \delta= \langle q,\alpha,u,\alpha',q'\rangle δ = ⟨ q , α , u , α ′ , q ′ ⟩ of P p ′ \mathcal{P}^{p'} P p ′ while consuming a constraint Q ′ \mathbf{Q}' Q ′ as the next letter of L L L , provided that the current state satisfies it, i.e., q ∈ Q ′ p ′ q \in\mathbf{Q}'^{p'} q ∈ Q ′ p ′ ; we assign it the weight wt p ′ ( δ ) \operatorname{wt}^{p'}(\delta) wt p ′ ( δ ) . Intuitively, we simulate P p ′ \mathcal{P}^{p'} P p ′ while satisfying, and consuming constraints from L L L . As before, its states are pairs of a state of P p ′ \mathcal{P}^{p'} P p ′ and a state of the observation automaton A L \mathcal{A}_{L} A L for L L L , with initial state s L s_{L} s L and accepting states F L F_{L} F L .
Algorithm. For this case, the algorithm is a simple weighted extension of Atig et al.’s bottom-up procedure. As before, our algorithm (cf. Algorithm 4) has a main routine BottomUp describing the bottom-up flow of computation, and a subroutine BUSub (cf. Algorithm 5) that describes the computation in each level.
TopDown:
// Find the roots of the input topology
1 top ← {𝑝 ∈ 𝑃 | Parents(𝑝) = ∅}
// Compute the fixpoints for each root process
2 CurrVals ← ⋂_{𝑝∈top} FixPt(⟨𝒫^𝑝, STrans^𝑝_dc ⊠ S^𝑝, wt^𝑝′⟩, 𝑞^𝑝, 𝑞′^𝑝)
// Track the currently visited and unvisited processes of network
3 visited ← top
4 unvisited ← 𝑃 \ top
// Recursively compute until all processes are visited
5 while unvisited ≠ ∅ do
// Find root processes in the unvisited network
6 top ← {𝑝 ∈ unvisited | Parents(𝑝) ∩ unvisited = ∅}
7 tmpVals ← ∅
// For each val tuple of prior processes...
8 for val ← CurrVals do
// ...extend val with a fixpoint of every root process
9 ext ← {val}
10 for 𝑝 ∈ top do
// Compute fixpoint w.r.t. val as observation
11 ext ← ext × TDSub(val, 𝑝)
12 end
13 tmpVals ← tmpVals ∪ ext
14 end
// Update the current fixpoints
15 CurrVals ← tmpVals
// Update visited and unvisited processes
16 unvisited ← unvisited \ top
17 visited ← visited ∪ top
18 end
// Project every tuple in CurrVals onto its semiring components
19 CurrWts ← {⟨π₂(val^𝑝)⟩_{𝑝∈𝑃} | val ∈ CurrVals}
// Compute the sum of weight tuples
20 output ← ⨁_{a∈CurrWts} a
21 return output
Algorithm 2: Main routine of Top-Down Approach for ≤ S \le S ≤ S -thin semirings.
TDSub(val, p):
// Take asynchronous product of parent languages of p w.r.t. val
1 L ← \mathop{\|}_{p′←Parents(p),⟨e_{p′},a_{p′}⟩←val_{p′}^{q}} q^{p′} * \pi_{st}^{*} (|⟨e_{p′}⟩|)
// Normalize notation
2 ⟨\mathcal{P}, S, wt⟩ ← ⟨L *_{obs} \mathcal{P}^{P}, S^{P}, wt^{P}⟩
// Instantiate variables using pattern-matching
3 ⟨Q, A, Γ, Trans⟩ ← \mathcal{P}
// Compute fixpoint, from the initial to an accepting state of the
observation automaton
4 Y ← \bigcup_{s∈F_L} FixPt(⟨\mathcal{P}, S_{\mathrm{Trans}_{dc}} \boxtimes S, wt′⟩, ⟨q^{p},s_L⟩, ⟨q^{p},s⟩)
// Return the fixpoints of p; the caller extends val with them
5 return Y
Figure 3 (PDF p. 44). Algorithm 3: Subroutine of Top-Down Approach for ≤ S \leq_S ≤ S -thin semirings.
BottomUp:
// Find the leaves of the input topology
1 bottom ← {𝑝 ∈ 𝑃 | Children(𝑝) = ∅}
// Compute the fixpoints for each leaf process
2 CurrVals ← ⋂_{𝑝∈bottom} FixPt(⟨𝑃, STrans^{𝑝}_{uc} × S^{𝑝}, wt^{𝑝′}⟩, 𝑞_{𝑝}, 𝑞′_{𝑝})
// Track the currently visited and unvisited processes of network
3 visited ← bottom
4 unvisited ← 𝑃 \ bottom
// Recursively compute until all processes are visited
5 while unvisited ≠ ∅ do
// Find leaf processes in the unvisited network
6 bottom ← {𝑝 ∈ unvisited | Children(𝑝) ∩ unvisited = ∅}
7 tmpVals ← ∅
// For each val tuple of prior processes...
8 for val ← CurrVals do
// ...extend val with a fixpoint of every leaf process
9 ext ← {val}
10 for 𝑝 ∈ bottom do
// Compute fixpoint w.r.t. val as observation
11 ext ← ext × BUSub(val, 𝑝)
12 end
13 tmpVals ← tmpVals ∪ ext
14 end
// Update the current fixpoints
15 CurrVals ← tmpVals
// Update visited and unvisited processes
16 unvisited ← unvisited \ bottom
17 visited ← visited ∪ bottom
18 end
// Project every tuple in CurrVals onto its semiring components
19 CurrWts ← {⟨𝜋₂(val^{𝑝})⟩_{𝑝∈𝑃} | val ∈ CurrVals}
// Compute the sum of weight tuples
20 output ← ⨁_{𝑎∈CurrWts} 𝑎
21 return output
Algorithm 4: Main routine of Bottom-Up Approach for ≥S _S S -thin semirings.
BUSUB($val,p$):
// Take intersection of the upward-closed constraint languages of the
children of $p$ w.r.t. $val$
1 $L \leftarrow \bigcap_{p'\leftarrow\operatorname{Children}(p),\langle L^{p'},a^{p'}\rangle\leftarrow val_{p'}} \phi^*(L^{p'}) \uparrow$
// Normalize notation
2 $\langle P,S,\mathrm{wt}\rangle \leftarrow L *_{\phi} \langle P^{p},S^{p},\mathrm{wt}^{p}\rangle$
// Instantiate variables using pattern-matching
3 $\langle Q,A,\Gamma,\mathrm{Trans}\rangle \leftarrow P$
// Compute fixpoint, from the initial to an accepting state of the
observation automaton
4 $Y \leftarrow \bigcup_{s\in F_L}\operatorname{FixPt}(\langle P,S_{\mathrm{Trans}_{uc}}\times S,\mathrm{wt}'\rangle,\langle q^{p},s_L\rangle,\langle q^{p},s\rangle)$
// Return the fixpoints of $p$; the caller extends $val$ with them
5 return $Y$
Algorithm 5: Subroutine of Bottom-Up Approach for ≥ S \geq_S ≥ S -thin semirings.