Iterating Non-Aggregative Structure Compositions
Abstract
An aggregative composition is a binary operation obeying the principle that the whole is determined by the sum of its parts. The development of graph algebras, on which the theory of formal graph languages is built, relies on aggregative compositions that behave like disjoint union, except for a set of well-marked interface vertices from both sides, that are joined. The same style of composition has been considered in the context of relational structures, that generalize graphs and use constant symbols to label the interface.
In this paper, we study a non-aggregative composition operation, called fusion, that joins non-deterministically chosen elements from disjoint structures. The sets of structures obtained by iteratively applying fusion do not always have bounded tree-width, even when starting from a tree-width bounded set. First, we prove that the problem of the existence of a bound on the tree-width of the closure of a given set under fusion is decidable, when the input set is described inductively by a finite hyperedge-replacement (HR) grammar, written using the operations of aggregative composition, forgetting and renaming of constants. Such sets are usually called context-free. Second, assuming that the closure under fusion of a context-free set has bounded tree-width, we show that it is the language of an effectively constructible HR grammar. A possible application of the latter result is the possiblity of checking whether all structures from a non-aggregatively closed set having bounded tree-width satisfy a given monadic second order logic formula.
Keywords and phrases:
Hyperedge replacement, Tree-widthCopyright and License:
2012 ACM Subject Classification:
Theory of computation Logic and verification ; Theory of computation Grammars and context-free languagesFunding:
††margin:Editors:
C. Aiswarya, Ruta Mehta, and Subhajit RoySeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
The tree-width of a graph is a numerical measure of how “tree-like” the graph is. This notion extends naturally to the relational structures, used to define the semantics of classical first and second-order logic. Relational structures generalize a broad range of graph-like objects, such as edge-labeled graphs, hypergraphs, and multi-edge graphs. Tree-width plays a foundational role in logic and verification. Courcelle’s theorem [6] shows that Monadic Second-order Logic (MSO) is decidable on classes of structures having bounded tree-width, while Seese’s theorem [19] asserts that unbounded tree-width leads to undecidability of MSO theories. Thus, proving that a given class of structures has bounded tree-width is tantamount for establishing the decidability of logical theories for that class.
In principle, one is interested in reasoning about infinite families of structures. These families are typically generated inductively from a finite set of basic building blocks, using operations such as composition and renaming. These operations are usually formalized by the Hyperedge Replacement () algebra introduced by Courcelle [8]. The principle of inductive definition is captured by the notion of a context-free set, i.e., the language of a finite grammar written using operations, or equivalently, the set of evaluations of a set of ground terms recognized by a tree automaton.
For both graphs and relational structures, algebras are built on aggregative composition operations, in which the whole is determined by the sum of its parts. These compositions are typically defined as the disjoint union of the arguments, where the elements designated by shared constants on both sides are joined together. In other words, aggregative composition preserves the identity of the substructures while merging them at known interface points. Importantly, context-free sets of graphs and relational structures defined by grammars based on such bounded-interface111Vertex-replacement algebras [8] using disjoint union and edge addition between arbitrarily large interfaces may produce sets of unbounded tree-width. aggregative compositions have bounded tree-width.
In this paper, we investigate a more flexible but less controlled operation, called non-aggregative fusion. Fusion allows elements from two disjoint structures to be merged nondeterministically, even when they are not marked by constants. To maintain a certain level of semantic coherence, we require fusion to be constrained by a coloring discipline: elements can only be joined if their colors (i.e., sets of designated unary relations) are disjoint. This idea stems from existing work in the area of reasoning about the correctness of systems with dynamically reconfigurable connectivity, such as distributed protocols [1] or pointer structures with aliasing [15].
Due to its nondeterministic nature, fusion can cause a dramatic shift in structure: even if a set consists of structures having bounded tree-width, by taking the closure of under fusion one may introduce infinitely many structures of unbounded tree-width. This phenomenon raises two natural and fundamental questions:
-
1.
Given a context-free set of relational structures, does the closure of this set under fusion have bounded tree-width ?
-
2.
If the answer to the above question is yes, is this closure again a context-free set ?
The result this paper is that both questions have a positive answer (Theorem 9):
-
1.
The existence of a bound on the tree-width of the closure by fusion of a context-free set is a decidable problem.
-
2.
If the fusion-closure of context-free set has bounded tree-width, then it is the language of an effectively constructible context-free grammar, that uses only aggregative composition.
These results provide tools for reasoning about nondeterministic structural iteration. For instance, one can check MSO properties over the tree-width bounded fusion-closure of a context-free set, thereby extending algorithmic verification techniques to a broader class of systems. We sketch below two possible application domains that have motivated our work.
Separation Logic of Relations (SLR).
A key motivation for studying non-aggregative fusion comes from SLR, a generalization of classical Separation Logic to relational structures. This logic has been first considered for relational databases and object-oriented languages [14]. More recently, SLR (combined with inductive definitions [12]) has been proposed as an assertion language for the verification of distributed reconfigurable systems [1]. Here, the separating conjunction means that the models of two formulæ and must not have overlapping interpretations of the same relation symbol.
A subtle but crucial point is that, while the separating conjunction enforces disjointness of the tuples that interpret a relation symbol, i.e., that tuples cannot overlap in all positions, the tuples may overlap in some positions. However, by the disjointness of , such overlapping is only possible if the variables at these positions do not occur within the same unary relation symbol 222For each unary relation symbol in the alphabet, the SLR formula entails .. From a semantic point of view, this behavior corresponds precisely to our notion of fusion: joining elements of two separate structures is allowed, as long as their sets of unary relation labels are disjoint. Thus, fusion abstracts the semantics of SLR, where aliasing is controlled implicitly by colors (i.e., sets of relation symbols) and the semantics of the separating conjunction. Moreover, considering inductive definitions on top of the basic SLR logic is akin to considering context-free sets generated by recursive grammars here.
Chemical and Biological Systems.
We believe that fusion-like operations naturally arise in the modeling of chemical and biological systems, where complex structures (e.g., proteins or polymeric carbon chains) are formed by joining smaller components through local interactions. Here non-aggregative fusion abstracts the joining of components not only at fixed attachment points, but also through general, property-based interactions, modeled via color compatibility in our framework. Studying the tree-width of these structures is essential for enabling automated reasoning about their properties. We consider the exploration of this area as future work.
Related Work
The notion of composition is central to substructural logics [17]. One of the foremost such logics is Bunched Implications (BI), whose first definition of semantics is based on partially ordered monoids (i.e., the multiplicative connective is interpreted as the multiplication in the monoid) [16]. In particular, the monoidal semantics of BI (and many other follow-up logics) do not assume the composition to be aggregative. The advent of the more popular semantics of BI based on finite partial functions, called heaps, has made aggregative composition popular among the users of Separation Logic [13, 18]. We list below several substructural logics where composition is not aggregative.
Docherty and Pym developped Intuitionistic Layered Graph Logic (ILGL), a substructural logic tailored to reasoning about graph structures with a fixed, non-commutative and non-associative notion of layering [9]. Calcagno et al. [2] introduce Context Logic as a framework for local reasoning about structured data, emphasizing compositionality through structural connectives that describe data and context separately rather than flattening them into aggregates. In [3], they formalize these connectives as modal operators and demonstrate that such non-aggregative reasoning is essential for expressing weakest preconditions and verifying updates. Cardelli et al. [4] present a spatial logic for reasoning about graphs that, like our work, emphasizes local, non-aggregative composition via structural connectives such as spatial conjunction.
2 Definitions
Given integers and , we write for the set , assumed to be empty if . For a set , we denote by its powerset. By writing we mean that is a finite subset of . The cardinality of a finite (multi)set is written . By writing we mean that and partition , i.e., and . The -times Cartesian product of with itself is denoted and the set of possibly empty (resp. nonempty) sequences of elements from by (resp. ). Multisets are denoted as , and denote the operations of multiset union and intersection, respectively. The multi-powerset (i.e., the set of multisets) of is written .
2.1 Relational Structures
Let be a finite alphabet of relation symbols , of arities , and be a countably infinite set of constants of arity zero. As usual, relation symbols of arity , and are called unary, binary and ternary, respectively. A -structure, for some finite set of constants, is a pair , where is a finite set called universe and is an interpretation that maps each relation symbol to a subset of and each constant to an element of . The sort of the structure is the set . Two structures are disjoint iff their universes are disjoint and isomorphic iff they are defined over the same alphabet and differ only by a renaming of their elements333See, e.g., [10, Section A3] for a formal definition of isomorphism between structures.. For a given sort , we denote by the set of -structures.
We define the composition of two relational structures as the component-wise union of disjoint isomorphic copies of the structures followed by joining the elements that interpret the common constants. This is the same as the gluing operation defined by Courcelle [7, Definition 2.1], that we recall below, for self-completeness:
Definition 1.
Let be a structure and be an equivalence relation, where denotes the equivalence class of . The quotient of with respect to is the -structure defined as follows:
Let be disjoint -structures, for , and be the least equivalence relation such that , for all . The composition of with is the -structure , where:
We remark that the composition of -structures and is the same as their disjoint union, denoted .
The composition of structures is aggregative, meaning that it keeps both structures separate except for the interpretation of the common constants. In the following, we define a non-aggregative fusion operation that matches also some of the elements which are not interpretations of common constants. In contrast to the deterministic composition, the equivalence relation that matches elements in the fusion operation is chosen nondeterministically.
Before formalizing the notion of non-aggregative fusion, we introduce a generic mechanism for controlling which pairs of elements are allowed to join. We assume a designated set of unary relation symbols . The sets of relation symbols are called colors. Given some -structure , we denote by the color of each element . Note that the empty set is a color.
Back to the definition of non-aggregative fusion, we use colors to prevent joining elements labeled with non-disjoint colors. This is captured by the following notion of compatibility:
Definition 2.
Let be a -structure. A relation is compatible with if and only if , for each pair .
We now define the non-aggregative fusion operation. The operation is non-deterministic, i.e., returns a (possibly empty) set of structures. For reasons of simplicity, the fusion operation is only defined for structures of sort , i.e., for structures that do not interpret any constants. This restriction can be lifted at the expense of complexifying the definition below, by considering fusion in which the interpretation of common constants in both structures must always be joined, as in Definition 1.
Given disjoint sets and , a relation is an - matching iff , for all distinct pairs . The least equivalence relation that contains is denoted . We say that an equivalence relation is -generated iff is a matching consisting of pairs.
Definition 3.
Let , for , be two disjoint -structures. The fusion of and is the following set of -structures:
Let be a set of -structures. The closure of under fusion is the least set such that .
Note that iff , for all pairs . The problems considered in the rest of this paper concern the uses of fusion, in addition to the composition and the unary operations on structures introduced next.
2.2 An Algebra of Structures
We recall the definitions of sorted terms and algebras [6, Definition 1.1]. Let be a countably infinite set of sorts and let be a countably infinite set of function symbols, where the set is called a signature. Each has an associated tuple of argument sorts and a value sort . The arity of , denoted , is the length of . Moreover, each variable has a sort. A -term is built as usual from function symbols and variables of matching sorts. A ground term is a term without variables. A trivial term consists of a single variable. A term is a subterm of iff there exists a term such that , where denotes the replacement of by in . The sort of a term , denoted is the value sort of the top-most symbol, i.e., either the value sort of the top-most function symbol , in case of a non-trivial term , or the sort of the variable , in case of a trivial term . A position in a term is a node of the tree that uniquely represents , in the usual way (see [5] for a formal definition). denotes the set of ground terms having function symbols taken from a finite set .
An -algebra consists of domains of each sort and interprets the function symbols as functions , where . By the domain of we understand the set . We denote by the interpretation of an -term in , i.e., the function obtained by replacing each function symbol that occurs in by its interpretation. In particular, is an element of the domain of if is ground.
We define an algebra of structures, called , with sorts , where each universe is the set of -structures. The signature consists of:
-
constant symbols , for and such that either or for all , interpreted as , where:
-
binary function symbols , for , interpreted by the composition operation from Definition 1 applied to structures of sorts and , respectively, see Figure 1 (a).
-
unary function symbols , for all and surjective function , interpreted as the operations where, for each -structure , the output is defined below:
-
unary function symbols , for and , interpreted as the operations where, for each -structure , the output is defined below:
To ease the notation, we omit the sorts of the arguments from the function symbols when they are understood from the context.
Example 4.
We comment on the relationship to the algebra of relational structures introduced in [7, Definition 2.3], as a generalization of both the hyperedge-replacement () algebra of hypergraphs and the vertex-replacement () algebra of binary graphs, to relational structures. As a matter of fact, we do not use this algebra. Instead, our algebra of relational structures algebra follows the standard algebra on hypergraphs [6]. This relationship can be easily understood by viewing relational structures as hypergraphs in the adjacency encoding, i.e., each tuple from the interpretation of a relation symbol corresponds to a -labeled hyperedge attached to the vertices in this order. For reasons of space, we omit further details.
We now introduce the subalgebras of that define the tree-width parameter of a structure. For this, we assume some enumeration of the constants and denote by the subset of consisting of the function symbols whose argument and value sorts are all contained in .
Definition 5.
The tree-width of a structure , denoted , is the minimal integer for which there exists a ground term such that . A set of structures has bounded tree-width if and only if the set is finite.
In particular, for each tree-width bounded set , there exists a set of ground terms and a finite set of constants such that each term uses only constants from and .
This algebraic definition of tree-width of a relational structure is analogous to the definition of the tree-width of a hypergraph using a subalgebra of defined by a restriction of sorts to finite sets of vertex labels (see, e.g., [8, Proposition 1.19] for a proof of equivalence between the graph-theoretic and algebraic definitions of tree-width for hypergraphs). Moreover, the tree-width of a structure can be equivalently defined in terms of the tree-width of its Gaifman-graph:
Definition 6.
Let be a -structure. The Gaifman graph of is the simple undirected graph , where and .
It is known that the tree-width of a structure equals the tree-width of its Gaifman graph [11, Proposition 11.27].
We recall below two standard notions of graph theory. Given binary graphs and , we say that is a minor of iff is obtained from a subgraph of by edge contractions, where the contraction of a binary edge attached to vertices and means deleting and joining and into a single vertex (the edges attached to are the ones attached to either or ). It is well-known that the tree-width of each minor of a graph is bounded by the tree-width of .
A -grid is a binary graph whose vertices can be labeled with pairs such that there is an edge between and iff either , and or , and . It is well-known444This can be shown by using the characterisation of tree-width in terms of the cops and robber game [20]. that each -grid has tree-width . By bluring the distinction between isomorphic grids, we obtain the following:
Proposition 7.
A set of structures whose Gaifman graphs contain infinitely many non-isomorphic square grids has unbounded tree-width.
2.3 Context-Free Sets of Structures
Context-free sets are usually defined as languages of grammars, i.e., finite sets of inductive rules written using nonterminals and function symbols from a given signature. To simplify some of the upcoming proofs, we use here an equivalent definition of contex-free sets based on recognisable sets of ground terms, defined using tree automata [5]. For self-containment reasons, we briefly introduce context-free grammars and discuss their equivalence with tree automata in Section 3.5 (see the statement of Theorem 24).
Let be a finite signature of function symbols. A tree automaton over is a tuple , where is a finite set of states, is a set of accepting states and is a set of transition rules of the form , where and . A run of over a ground term maps each position within to a state if the automaton has a rule , where are the positions of the children of in . A ground term is accepted by iff has a run that labels the root of with an accepting state. The language of , denoted , is the set of ground terms accepted by . A set is recognisable iff it is the language of a tree automaton over the finite signature .
Definition 8.
A set of structures is context-free if and only if there exists a recognisable set of ground terms , over a finite signature , such that .
Note that a context-free set of structures has finitely many sorts, because the signature of terms used to describe the set is finite. For this reason, any context-free set of structures has bounded tree-width. On the other hand, there are bounded tree-width sets which are not context-free, for instance the set of linear structures over the alphabet of binary relations of the form , for all .
3 The Closure of Context-Free Sets under Fusion
This section is concerned with the statement and proof of the main result of the paper (Theorem 9). For simplicity, we assume that is a set of connected structures, where connectivity of a structure means that there exists an undirected path in between each pair of elements . We note that, because contains only connected structures, each structure from its closure is necessarily connected.
The assumption of being a context-free set of connected structures loses no generality, because it is possible, from a tree automaton such that , to build a tree automaton such that is the set of connected substructures of a structure in . Intuitively, is obtained from be labeling each state with finite information concerning the existence of a path between each pair of constant symbols in each structure that is the value of a ground term recognized by in . This construction can be used to generalize the statement of Theorem 9 below from connected to arbitrary structures. We will detail this construction in an extended version of the present article.
Theorem 9.
Let be a context-free set of connected -structures.
-
1.
has bounded tree-width if and only if is context-free.
-
2.
It is decidable whether has bounded tree-width.
An obvious consequence of this theorem is the decidability of the problem: given a context-free set , is context-free?
We give an overview of the proof before going into technical details. The core idea is the equivalence between the (A) tree-width boundedness of the closure of a context-free set and (B) the non-existence of two structures having each at least three elements each , labeled with disjoint colors , for . This equivalence is established via a third, more technical, condition about the disjointness relations between the colors that may occur in a structure from . The latter implies that the matching relation of each fusion of two structures from is generated by at most two pairs of elements with compatible colors.
The equivalence between (A) and (B) is used to prove both points of Theorem 9. For point (1) suppose, for a contradiction, that (B) does not hold. Then, and can be composed by joining their , or elements, for , respectively, as in Figure 2. Consequently, the set of Gaifman graphs corresponding to the structures in contains an infinite set of grid minors, thus has unbounded tree-width (Proposition 7). Else, if (B) holds (i.e., such structures cannot be found), we prove that the matching relation considered in the fusion of any two structures is generated by either one or two pairs of elements. In each of these cases, by adding a finite number of constants to the signature of the -terms from the language of , we can build a tree automaton such that , thus taking care of point (1) of the theorem.
To prove point (2), we rely on the equivalence of (A) and (B) and show that (B) is decidable. This is done by arguing that the existence of two structures with the above property is equivalent to the existence of two multiset abstractions of structures , in the domain of multisets of colors having multiplicity at most three. These multiset abstractions of colors can be effectively computed by a finite fixpoint iteration over the rules of the tree automaton that recognizes the set of ground terms which evaluates to the elements of .
3.1 Color Multisets
In the following, let be a context-free set of -structures. We denote the set of colors by , where is a fixed finite set of unary relation symbols. First, we define an abstraction of structures as finite multisets of colors:
Definition 10.
The multiset color abstraction of a structure is . For an integer , the -multiset color abstraction is . These abstractions are lifted to sets of structures as sets of multisets and .
Note that is a multiset, whereas is a set of multisets. When lifted to sets of structures, both and are sets of multisets.
The core of the proof of Theorem 9 is the equivalence between the following two conditions stated formally below:
| (A) | ||||
| (B) |
Note that condition (A) is more general than the premiss of Theorem 9. We prove the (A) (B) direction below.
Proof.
By contradiction, assume that there exist such that . Then, there exist structures such that and . We shall use and to build infinitely many structures whose Gaifman graphs have arbitrarily large square grid minors, as illustrated in Figure 2.
First, construct the structure by fusing one pair , having colors and , respectively. Let and (resp. and ) be the remaining distinct elements of , having color (resp. ) from and , respectively. For an arbitrarily large integer , consider disjoint copies of . Let be the equivalence relation generated by and be generated by , be generated by , for all . Second, construct the grid-like connected structure :
where structures are added to the fusion in the increasing order of . We can show that has an square grid minor. Finally, as can be taken arbitrarily large, we conclude that does not have bounded tree-width, which contradicts (A).
3.2 Color Schemes
For the proof of the (A) “” (B) direction, we first organize the set of colors using the RGB color schemes defined below:
Definition 12.
A partition of is an RGB color scheme if and only if:
-
1.
, for all ,
-
2.
, for all and all ,
-
3.
for all there exists such that .
Note that an RGB color scheme is fully specified by the set . Indeed, any color not in is unambiguously placed within or , depending on whether or not it is disjoint from some color in . In particular, if then and . For example, Figure 3 shows several RGB color schemes for the set of unary relation symbols.
Because a fusion operation only joins element with disjoint colors, blue elements can only be joined with red elements, green elements can be joined with green or red elements, whereas red elements can be joined with elements of any other color. We define below what is meant for a set of structures to conform to an RGB color scheme:
Definition 13.
A set of structures conforms to if and only if:
-
1.
for all structures , if , for some element , then , for all other elements , and
-
2.
, for all structures .
In other words, conforms to a given color scheme if each structure from has either a single red and the rest blue, or at most occurrences of the same green color and the rest blue elements. Moreover, the number of occurrences of a green color must not exceed two, for each structure obtained by taking fusions of some structures in . This observation justifies the following notion of type of a structure:
Definition 14.
A structure is of type if it has exactly one red element and the rest blue, if it has at least one green element and the rest blue and if it has only blue elements.
Note that there can be structures of neither , or type, but these are the only types of interest, as justified by the following:
Lemma 15.
Let be a set of structures conforming to an RGB color scheme. Then, each structure is of type either , or .
Proof.
By induction on the construction of from one or more structures from . Table 1 summarizes the possible types of on structures and of types , or , respectively.
| of type | of type | of type | |
|---|---|---|---|
| of type | |||
| of type | |||
| of type |
The (B) “” (A) direction will be established via a third condition (C), which is conformance to an RGB color scheme defined by taking the set to be the colors occurring three times in some structure from :
Lemma 16.
If (B) holds then:
| (C) |
Proof.
We show that conforms to the RGB color scheme from the statement, by checking the two points of Definition 13:
-
(1)
Let and prove that for any two colors , if and then . Since , there must exists a color , such that , by Definition 12. By the definition of , this further implies . Henceforth, there exists a structure such that . We can now use and three disjoint copies of to build a new structure by gluing progressively, each one of the three elements of color in to the element of color of . Then, by construction, the structure will also contain three elements of color , one from each disjoint copy of . Therefore, and because this implies and therefore .
-
(2)
By contradiction, let be such that . Then there exists , i.e., and . The latter implies . But this implies according to the definition of the RGB color scheme, contradicting .
In the rest of this and the next subsections, we are concerned with the proof of the following implication, that establishes the equivalence of (A) and (B). As previously mentioned, this direction of the proof uses the third condition (C) that is, conformance to the RGB color scheme from the statement of Lemma 16:
The proof of the above lemma is split into two technical results (Lemmas 18 and 19). The first (Lemma 18) involves reasoning about the number of pairs of elements that are joined by the fusion operation in order to obtain a structure from :
Lemma 18.
If conforms to an RGB scheme and for some , for , and some equivalence closure of a - matching, then exactly one of the following holds:
-
1.
is -generated, or
-
2.
is -generated, is of type , and either:
-
(a)
, are both of type , or
-
(b)
, are both of type and .
-
(a)
Proof.
We distinguish two cases:
-
is of type : If is of type or then and can be fused only by equivalences generated by a single pair, that contains the element from the support of with color in , thus matching the case (1) from the statement. Else, if is of type then and can be fused by equivalences generated by at most two pairs, each containing an element with color from , from either or , thus matching the case 2a from the statement. In this latter case, is of type because joining a red with a blue element always results in a blue element.
-
, are both of type : By contradiction, assume they can be fused by an equivalence generated by three pairs of elements . Let , be the colors from of the matching elements in the two structures, for . Then, we can construct structures using and where any of these colors repeat strictly more than twice, henceforth, contradicting the conformance property to the RGB color scheme. The principle of the construction is depicted in Figure 4. Finally, note that the construction depicted in Figure 4 fuse actually only pairs of colors for . Henceforth, the conformance property is also contradicted if and can be fused by a -generated equivalence relation , such that the support of either or contains more than three elements with colors in . By the same argument, it follows that is of type , if is generated by two pairs of green elements.
3.3 Fusions as Operations on Terms
The second technical result required for the proof of Lemma 17 is a characterization of the -generated fusion, for , via operations on witness -terms. We assume that is a given tree-width bounded set of structures that conforms to a fixed RGB color scheme . The goal is to prove that , for an integer .
Since has bounded tree-width, there exists a set of terms such that and a finite set of constants such that each term uses only constants from and assume w.l.o.g. to be the least such set. Moreover, consider the following set of special constants , with the following intuition. Recall that each element of a structure is the common interpretation of all the constants in the label of a leaf of . By adding to the set , we mean that the color of that element in the structure is . A constant is visible in a term if it is not in the scope of a or operation. Let and note that .
We shall prove that by building, for any , a term that uses only constants from , such that . We then note that has tree-width at most and obtain . Since the choice of was arbitrary, this leads to .
In the following, we understand terms as trees whose nodes are labeled by function symbols from . For each node of a term , we write for its label. The children of each node form an ordered sequence of length equal to the arity of . In order to the build the witness terms for the structures , we make use of the following operations on terms , and having constants in :
-
1.
, where is a leaf of , and : Let be the indices of the sets of constants from that are equal to (see the definition of in Section 2.2). The operation changes the label of in only, by replacing the set with , for each .
-
2.
: The result is the following term, for a nondeterministic choice of , such that is not visible in either or (the operation is undefined otherwise):
We refer to Figure 5 (a) for an illustration. In addition, we consider an overloaded version of that fuses the interpretation of with that of , for both . This definition is similar to the one above, thus omitted for brevity.
-
3.
, where is a leaf of , and : the result is the term , where denotes the substitution of the leaf by the term in . We refer to Figure 5 (b) for an illustration.
Then, Lemma 17 is an immediate consequence of the following lemma:
Lemma 19.
For each structure there exists a -term using only constants from , such that (i) and (ii) for each element such that there exists a special constant such that .
Proof (sketch).
We build by induction of the derivation of . For the base case , let be a term such that . By repeating the operation, we add a special constant to each leaf of , on the appropriate position , where , such that and . The choice of is nondeterministic. The result of applying these labeling operations to is . Then, and (ii) holds, by construction. For the inductive step, let , where and is an equivalence relation that is generated by the set of pairs , where is either or . Let for all and . By the inductive hypothesis, there exist terms and integers , such that and , for all and .
-
1.
, i.e., is -generated.
-
(a)
: by the inductive hypothesis (ii), there exist such that , for both . Suppose that is visible in (visibility in is a symmetric case), for some . Then must belong to , by the inductive hypothesis (ii). If is not visible in , suppose first that is visible in . Then, , and are visible in . By Lemma 15, and occurs times in , thus contradicting the definition of . Hence is not visible in either or and is well-defined. Else, if is visible in , then occurs times in , thus contradicting the definition of .
-
(b)
and ( and is a symmetric case): Let be the leaf of such that and be a set of constants that are (all) interpreted as , for some . Let be the special constant such that , for some . We can assume w.l.o.g. that is not visible in . If this were not to be the case, then must have been involved in a previous join of a term with another term , such that is the outcome of this join. In this case, we change the construction, by first joining with , as in the previous case, then joining the result with ,. Note that this is possible due of the associativity of the operation. Finally, we define .
-
(a)
-
2.
, i.e., is -generated. By Lemma 18, either one of the following holds:
-
(a)
and are of type : let be special constants such that , for all . Then, we define and check that the operation is well-defined, following a similar argument as in case (1a).
-
(b)
and are of type : we can assume w.l.o.g. that is the interpretation of a special constant , for some , where , for both . Let be the leaf of such that and is the interpretation of (all) constants from , for some . Analogously, we consider to be the leaf of and the position of the constants from its label, that are interpreted as . Under similar assumptions as in the case (2a), ensuring that the result is well defined, we let . The only difference with the previous case is that the indices and must be different to avoid name clashes, hence we require special constants and , for each color .
-
(a)
3.4 Tree-width Bounded Fusion-closed Sets are Context-free
This subsection completes the proof of the first point of Theorem 9. The final ingredient is the following lemma, whose proof relies on the lifting of the construction that simulates the - or -generated fusion of structures from terms to tree automata recognising sets of terms:
Lemma 20.
Let be a context-free set of structures conforming to some RGB color scheme. Then, the set is context-free.
Proof of Theorem 9 (1).
3.5 Color Abstractions
This section is concerned with the proof of the second point of Theorem 9. Let be a context-free set of structures given by a tree automaton over a finite signature . In the rest of this section, , and are considered to be fixed.
Note that the equivalence between (A) and (B) follows from (A) (B) (Lemma 11), (B) (C) (Lemma 16) and (C) (A) (Lemma 17). Hence, it is sufficient to establish the decidability of the condition (B) for . To this end, we compute the -multiset abstraction , for an arbitrary given integer (note that checking (B) requires ). First, we reduce the computation of to that of . Second, we sketch the argument behind the effective computability of .
The following lemma shows that, because we are interested only in -multisets color abstractions, we can restrict fusion to -generated equivalence relations, while preserving the -multiset color abstraction. We denote by the set of structures obtained by taking the closure of only with respect to fusions induced by -generated matchings.
Lemma 21.
for any set of structures and integer .
The set can be computed by a least fixpoint iteration of the following abstract operation on the domain of -multiset color abstractions. As the later domain is finite, this fixpoint computation is guaranteed to terminate.
Definition 22.
The single-pair multiset fusion is defined below, for all :
Given an integer , the single-pair -multiset fusion is defined for , , such that and :
For a set of multisets (resp. -multisets) of colors, let (resp. ) be the closure of under taking single-pair fusion on multisets (resp. -multisets).
This operation is used to compute by a iterating starting with until a fixed point is reached. Since there are finitely many colors, the domain of multisets of colors having multiplicity at most is finite, hence this iteration is guaranteed to compute in finitely many steps.
Lemma 23.
, for any set of structures and integer .
The last step concerns the effective computation of , i.e., the set of color multisets of multiplicity at most that occur in the multiset abstraction of some structure . We leverage from the fact that is a context-free set described by the set of terms that forms the language of a tree automaton .
We assume basic acquaintance with context-free grammars, i.e., finite sets of rules of the form either or , where denote nonterminals and is a -term with variables . The language of a grammar is the set of interpretations in of the terms produced by derivations starting with an axiom . It is well known that a tree automaton can be transformed into a context-free grammar having the same language, by turning each transition into a rule , for , and adding an axiom for each final state of the tree automaton.
By first-order logic we understand the set of formulæ consisting of equalities between variables, relation atoms of the form , for some relation symbol , composed via boolean operations and quantifiers. A first-order logic sentence (i.e., a formula without free variables) is interpreted over a structure by the satisfiability relation , defined inductively on the structure of , as usual.
Over words, it is a well-known result that the non-emptiness of the intersection of a context-free set (e.g., given by a context-free grammar) and a regular set (e.g., given by a regular grammar, DFA, or a MSO formula) is decidable. This result has been generalized by Courcelle to context-free grammars over the -algebra of structures and FO-definable sets of structures555[7, Theorem 3.6] is actually given for Monadic Second Order Logic, which subsumes first-order logic.:
Theorem 24 (Theorem 3.6 in [7]).
For each grammar and first-order sentence , one can decide the existence of a structure such that .
In order to compute , we build a first-order sentence for each multiset of colors such that iff . As there are only finitely many such multi-sets , we are able to construct by finitely many calls to the above decision procedure. We now state the details for the construction of . For each color , we denote by the formula . We then obtain as the conjunction of the formulæ , if , and , if , for all colors . As usual, the quantifier (resp. ) means “there exists exactly (resp. at least ) elements that satisfy ”. It is now easy to verify that iff . This concludes the proof of Theorem 9 (2).
4 Conclusions and Future Work
We have defined a non-aggregative and nondeterministic fusion operation on logical structures, that is controlled by a coloring of structures using unary relations. We study the tree-width of the closure of a context-free set under fusion. We prove that it is decidable whether the closure of a context-free set has bounded tree-width. Moreover, if this is the case, we show that the closure set is context-free as well, described by an effectively constructible grammar.
Future work involves considering more general notions of coloring, e.g., coloring functions defined by MSO-definable transductions. Moreover, we plan to investigate generalizations of Theorem 9 for other notions of width, such as generalizations of clique-width and rank-width from graphs and hypergraphs to relational structures.
References
- [1] Emma Ahrens, Marius Bozga, Radu Iosif, and Joost-Pieter Katoen. Reasoning about distributed reconfigurable systems. Proc. ACM Program. Lang., 6(OOPSLA2):145–174, 2022. doi:10.1145/3563293.
- [2] Cristiano Calcagno, Philippa Gardner, and Uri Zarfaty. Context logic and tree update. In Jens Palsberg and Martín Abadi, editors, Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2005, Long Beach, California, USA, January 12-14, 2005, pages 271–282. ACM, 2005. doi:10.1145/1040305.1040328.
- [3] Cristiano Calcagno, Philippa Gardner, and Uri Zarfaty. Context logic as modal logic: completeness and parametric inexpressivity. In Martin Hofmann and Matthias Felleisen, editors, Proceedings of the 34th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2007, Nice, France, January 17-19, 2007, pages 123–134. ACM, 2007. doi:10.1145/1190216.1190236.
- [4] Luca Cardelli, Philippa Gardner, and Giorgio Ghelli. A Spatial Logic for Querying Graphs. In Peter Widmayer, Francisco Triguero Ruiz, Rafael Morales Bueno, Matthew Hennessy, Stephan Eidenbenz, and Ricardo Conejo, editors, Proceedings of the 29th International Colloquium on Automata, Languages and Programming (ICALP’02), volume 2380 of Lecture Notes in Computer Science, pages 597–610. Springer, July 2002. doi:10.1007/3-540-45465-9_51.
- [5] Hubert Comon, Max Dauchet, Rémi Gilleron, Florent Jacquemard, Denis Lugiez, Christof Löding, Sophie Tison, and Marc Tommasi. Tree Automata Techniques and Applications. HAL, 2008. URL: https://inria.hal.science/hal-03367725.
- [6] Bruno Courcelle. The monadic second-order logic of graphs. I. Recognizable sets of finite graphs. Information and Computation, 85(1):12–75, 1990. doi:10.1016/0890-5401(90)90043-H.
- [7] Bruno Courcelle. The monadic second-order logic of graphs VII: graphs as relational structures. Theor. Comput. Sci., 101(1):3–33, 1992. doi:10.1016/0304-3975(92)90148-9.
- [8] Bruno Courcelle and Joost Engelfriet. Graph Structure and Monadic Second-Order Logic: A Language-Theoretic Approach. Encyclopedia of Mathematics and its Applications. Cambridge University Press, 2012. doi:10.1017/CBO9780511977619.
- [9] Simon Docherty and David J. Pym. Intuitionistic layered graph logic: Semantics and proof theory. Log. Methods Comput. Sci., 14(4), 2018. doi:10.23638/LMCS-14(4:11)2018.
- [10] Heinz-Dieter Ebbinghaus and Jörg Flum. Finite model theory. Perspectives in Mathematical Logic. Springer, 1995.
- [11] Jörg Flum and Martin Grohe. Parameterized Complexity Theory. Texts in Theoretical Computer Science. An EATCS Series. Springer, 2006. doi:10.1007/3-540-29953-X.
- [12] Radu Iosif and Florian Zuleger. Expressiveness results for an inductive logic of separated relations. In Guillermo A. Pérez and Jean-François Raskin, editors, 34th International Conference on Concurrency Theory (CONCUR 2023), volume 279 of Leibniz International Proceedings in Informatics (LIPIcs), pages 20:1–20:20, Dagstuhl, Germany, 2023. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.CONCUR.2023.20.
- [13] Samin S. Ishtiaq and Peter W. O’Hearn. BI as an assertion language for mutable data structures. In Chris Hankin and Dave Schmidt, editors, Conference Record of POPL 2001: The 28th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, London, UK, January 17-19, 2001, pages 14–26. ACM, 2001. doi:10.1145/360204.375719.
- [14] Viktor Kuncak and Martin Rinard. Generalized records and spatial conjunction in role logic. In Static Analysis, pages 361–376, Berlin, Heidelberg, 2004. Springer Berlin Heidelberg. doi:10.1007/978-3-540-27864-1_26.
- [15] Peter W. O’Hearn, John C. Reynolds, and Hongseok Yang. Local reasoning about programs that alter data structures. In Proceedings of the 15th International Workshop on Computer Science Logic, CSL ’01, pages 1–19, 2001. doi:10.1007/3-540-44802-0_1.
- [16] David J. Pym, Peter W. O’Hearn, and Hongseok Yang. Possible worlds and resources: the semantics of bi. Theoretical Computer Science, 315(1):257–305, 2004. Mathematical Foundations of Programming Semantics. doi:10.1016/j.tcs.2003.11.020.
- [17] Greg Restall. Substructural Logics. In Edward N. Zalta and Uri Nodelman, editors, The Stanford Encyclopedia of Philosophy. Metaphysics Research Lab, Stanford University, Fall 2024 edition, 2024.
- [18] John C. Reynolds. Separation logic: A logic for shared mutable data structures. In 17th IEEE Symposium on Logic in Computer Science (LICS 2002), 22-25 July 2002, Copenhagen, Denmark, Proceedings, pages 55–74. IEEE Computer Society, 2002. doi:10.1109/LICS.2002.1029817.
- [19] D. Seese. The structure of the models of decidable monadic theories of graphs. Annals of Pure and Applied Logic, 53(2):169–195, 1991. doi:10.1016/0168-0072(91)90054-P.
- [20] P.D. Seymour and R. Thomas. Graph searching and a min-max theorem for tree-width. Journal of Combinatorial Theory, Series B, 58(1):22–33, 1993. doi:10.1006/jctb.1993.1027.
