Full text
Coinductive Techniques for Checking Satisfiability of Generalized Nested Conditions Lara Stoltenow # University of Duisburg-Essen, Germany Barbara König # University of Duisburg-Essen, Germany Sven Schneider # Hasso Plattner Institute at the University of Potsdam, Germany Andrea Corradini # Università di Pisa, Italy Leen Lambers # Brandenburgische Technische Universität Cottbus-Senftenberg, Germany Fernando Orejas # Universitat Politècnica de Catalunya, Spain Abstract We study nested conditions, a generalization of first-order logic to a categorical setting, and provide a tableau-based (semi-decision) procedure for checking (un)satisfiability and finite model generation. This generalizes earlier results on graph conditions. Furthermore we introduce a notion of witnesses, allowing the detection of infinite models in some cases. To ensure completeness, paths in a tableau must be fair, where fairness requires that all parts of a condition are processed eventually. Since the correctness arguments are non-trivial, we rely on coinductive proof methods and up-to techniques that structure the arguments. We distinguish between two types of categories: categories where all sections are isomorphisms, allowing for a simpler tableau calculus that includes finite model generation; in categories where this requirement does not hold, model generation does not work, but we still obtain a sound and complete calculus. 2012 ACM Subject Classification Theory of computation → Logic and verification; Theory of computation →Program reasoning Keywords and phrases satisfiability, graph conditions, coinductive techniques, category theory Digital Object Identifier 10.4230/LIPIcs.CONCUR.2024.39 Related Version Full Version:https://arxiv.org/abs/2407.06864 [28] Funding Andrea Corradini: Research partially supported by the Italian MUR under the PRIN 20228KXFN2 “STENDHAL” and by the University of Pisa under the PRA 2022_99 “FM4HD”. Fernando Orejas: Research partially supported by MCIN/ AEI /10.13039/501100011033 under grant PID2020-112581GB-C21. 1 Introduction Nested graph conditions (called graph conditions subsequently) are a well-known specification technique for graph transformation systems [ 8 ] where they are used, e.g., to specify graph languages and application conditions. While their definition is quite different from first-order logic (FOL), they have been shown to be equivalent to FOL in [ 23 , 8 ]. They are naturally equipped with operations such as shift, a form of partial evaluation, which is difficult to specify directly in FOL. This operation can be used to compute weakest preconditions and strongest postconditions for graph transformation systems [1]. ©Lara Stoltenow, Barbara König, Sven Schneider, Andrea Corradini, Leen Lambers, and Fernando Orejas; licensed under Creative Commons License CC-BY 4.0 35th International Conference on Concurrency Theory (CONCUR 2024). Editors: Rupak Majumdar and Alexandra Silva; Article No. 39; pp. 39:1–39:20 Leibniz International Proceedings in Informatics Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany
39:2 Coinductive Techniques for Checking Satisfiability of Generalized Nested Conditions In [ 1 ] it has also been observed that graph conditions can be generalized to the categorical setting of reactive systems [ 16 ] as an alternative to the previously considered instantiation to graphs and injective graph morphisms that is equivalent to FOL. Further possible instantiations include cospan categories where the graphs, equipped with an inner and an outer interface, are the arrows, as well as Lawvere theories. To derive analysis techniques for all such instantiations, we consider nested conditions in the general categorical setting. Here we are in particular interested in satisfiability checks on the general categorical level. As in FOL, satisfiability can be an undecidable problem (depending on the category), and we propose a semi-decision procedure that can simultaneously serve as a model finder. For FOL there are several well-known methods for satisfiability checking, for instance resolution or tableau proofs [ 6 ], while model generation is typically performed separately. The realization that satisfiability checking is feasible directly on graph conditions came in [ 18 , 19 ], and a set of tableau rules was presented [ 18 ] without a proof of (refutational) completeness that was later published in [ 13 ], together with a model generation procedure [ 26 ]. A generalization to non-injective graph morphisms was given in [17]. The contributions of the current paper can be summarized as follows: We generalize the tableau-based semi-decision procedure for graph conditions from [ 13 ] to the level of general categories, under some mild constraints (such as the existence of so-called representative squares [ 1 ]). We present a procedure that has some resemblance to the construction of a tableau in FOL. We distinguish between two cases: one simpler case in which all sections (arrows that have a right inverse) in the category under consideration are isomorphisms (Section 3); and a more involved case where this does not necessarily hold (Section 5). The tableau rules of the former case (Section 3) are easier to present and implement, and we can give additional guarantees, such as model generation whenever there exists a so-called finitely decomposable model, generalizing the notion of finite models. The latter case (Section 5) does not guarantee model generation and has more involved tableau rules, but it allows for instantiations to more categories, such as graphs and arbitrary morphisms. The results of both cases generalize [ 13 , 17 , 26 ] from graphs and graph morphisms to an abstract categorical level, which allows application to additional categories such as cospan categories and Lawvere theories (see [28]). The completeness argument for the satisfiability checking procedure – in particular showing that non-termination implies the existence of an infinite model – requires that the tableau construction satisfies a fairness constraint. The resulting proof is non-trivial and – compared to the proof in [ 13 ] – we show that it can be reformulated using up-to techniques. Here we give it a completely new and hopefully clarifying structure that relies on coinductive methods [ 20 , 22 ]. The alternative would be to inline the up-to techniques, or to rely on complex ad-hoc notation that are less clear and further complicate the proof. Furthermore we use coinductive techniques to display witnesses for infinite models (Section 4): in some cases where only infinite models exist and hence the tableau construction is non-terminating, we can still stop and determine that there does exist an infinite model. Coinductive techniques [ 24 , 22 ] are reasoning techniques based on greatest fixpoints, suitable to analyze infinite or cyclic structures. To the best of our knowledge, such techniques have not yet been employed in the context of satisfiability checking for FOL and graph conditions. The main contribution compared to previous work consists of a categorical generalization to reactive systems on the one hand, and the use of coinductive (up-to) techniques on the other hand. The implication of the first type of contribution is that the theory becomes available
L. Stoltenow, B. König, S. Schneider, A. Corradini, L. Lambers, and F. Orejas 39:3 for new instantiations such as adhesive categories (which includes all variants of graphs, such as typed graphs, Petri nets, but also algebraic specifications, cf. [ 3 ]), as well as other cases such as cospan categories and Lawvere theories. The second type of contribution implies that the proofs (especially for completeness) can now be presented in a more systematic way. 2 Preliminaries 2.1 Coinductive Techniques Acomplete lattice is a partially ordered set ( L, ⊑ )where each subset Y⊆L has a greatest lower bound, denoted by dYand a least upper bound, denoted by FY. A function f:L→L is monotone if for all l1, l2∈L , l1⊑l2 implies f ( l1 ) ⊑f ( l2 ), idempotent if f◦f=f, and extensive if l⊑f(l)for all l∈L. Given a monotone function f:L→L we are in particular interested in its greatest fixpoint νf . By Tarski’s Theorem [ 29 ], νf = F{x|x⊑f ( x ) } , i.e., the greatest fixpoint is the least upper bound of all post-fixpoints. Hence for showing that l⊑νf (for some l∈L ), it is sufficient to prove that lis below some post-fixpoint l′, i.e., l⊑l′⊑f(l′). In order to employ up-to techniques one defines a monotone function u:L→L (the up-to function) and checks whether u is f -compatible, that is u◦f⊑f◦u . If that holds every post-fixpoint l of f◦u (that is l⊑f ( u ( l ))) is below the greatest fixpoint of f ( l⊑νf ). This simple technique can often greatly simplify checking whether a given element is below the greatest fixpoint. For more details see [20]. 2.2 Categories We will use standard concepts from category theory. Given an arrow f:A→B , we write dom ( f ) = A , cod ( f ) = B . For two arrows f:A→B , g:B→C we denote their composition by f;g:A→C . An arrow s:A→B is a section (also known as split mono) if there exists r:B→A such that s ; r = id . That is, sections are those arrows s that have a right-inverse r . Arrows that have a left-inverse (in this case r) are called retractions. As in graph rewriting we will consider the category Graphfin , which has finite graphs as objects and graph morphisms as arrows. We also consider Graphinj fin , the subcategory of Graphfin that has the same objects, but only injective, i.e. mono, graph morphisms. In this category the sections are exactly the isos, while this is not the case in Graphfin. Another important example category that will be used in Section 4 is based on cospans: note that reactive systems instantiated with cospans [ 11 , 25 , 27 ] yield exactly double-pushout rewriting [ 5 ]. Given a base category Dwith pushouts, the category Cospan (D)has as objects the objects of Dand as arrows cospans, which are equivalence classes of pairs of arrows of the form AfL −→ XfR ←−− B , where the middle object is considered up to isomorphism. Cospan composition is performed via pushouts (for details see Appendix A). A cospan is left-linear if its left leg fL is mono. For adhesive categories [ 12 ], the composition of left-linear cospans again yields a left-linear cospan, and ILC (D)is the subcategory of Cospan(D)where the arrows are restricted to left-linear cospans. Note that Graphinj fin can be embedded into ILC ( Graphfin )by transforming an injective graph morphism fto a left-linear cospan with fas the left leg and id as the right leg. Another application are Lawvere theories, where arrows are (tuples of) terms, an approach we explore in the full version of this paper [28]. CONCUR 2024
39:4 Coinductive Techniques for Checking Satisfiability of Generalized Nested Conditions 2.3 Generalized Nested Conditions We consider (nested) conditions over an arbitrary category Cin the spirit of reactive systems [ 16 , 15 ]. Following [ 23 , 8 ], we define conditions as finite tree-like structures, where nodes are annotated with quantifiers and objects, and edges are annotated with arrows. ▶ Definition 1 (Condition).Let Cbe a category. A condition A over an object A in Cis defined inductively as follows: it is either a finite conjunction of universals Vi∈{1,...,n}∀fi.Ai=∀f1.A1∧. . . ∧ ∀fn.An, or a finite disjunction of existentials Wi∈{1,...,n}∃fi.Ai=∃f1.A1∨. . . ∨ ∃fn.An where fi:A→Ai are arrows in Cand Ai∈Cond ( Ai )are conditions. We call A = RO ( A ) the root object of the condition A. Each subcondition Qfi.Ai(Q ∈ {∀,∃}) is called a child of A . The constants trueA (empty conjunction) and falseA (empty disjunction) serve as the base cases. We will omit subscripts in trueAand falseAwhen clear from the context. The set of all conditions over Ais denoted by Cond(A). Instantiated with Graphfin respectively Graphinj fin , conditions are equivalent to graph conditions as defined in [ 8 ], and equivalence to first-order logic has been shown in [ 23 ]. Intuitively, these conditions require the existence of certain subgraphs or patterns, or that whenever a given subgraph occurs, the surroundings of the match satisfy a child condition. For instance, ∀∅→1 2 .∃1 2 →1 2 .true requires that for every edge, a second edge in the reverse direction also exists. For additional examples of conditions we refer to Examples 19, 24, and 27 given later. To simplify our algorithms and their proofs, the definition of conditions requires that conjunctions contain only universal children and disjunctions only existential children (e.g., ∃f.A ∧ ∃g.B is excluded). However, this can be simulated using ∀id.∃f.A ∧ ∀id.∃g.B , and similarly for disjunctions of universals. Hence we sometimes write A∧B or A∨B for arbitrary conditions in the proofs. While in [ 1 ] a model for a condition was a single arrow, we have to be more general, since there are some satisfiable conditions that have no finite models. Here we want to work in categories of finite graphs (so that conditions are finite), but at the same time we want to consider infinite models. The solution is to evaluate conditions on infinite sequences of arrows ¯a = [ a1, a2, a3, ... ], where Aa1 −→ A1 a2 −→ A2 a3 −→ . . . , called composable sequences. 1 We define dom ( ¯a ) = dom ( a1 ) = A and we call such a sequence finite iff for some index k all ai with i>kare identities. Intuitively, the model is represented by the “composition” of the infinite sequence of arrows. In the category Graphinj fin this would amount to taking the limit of this sequence. As we will later see, it does not play a role how exactly an infinite structure is decomposed into arrows, as all decompositions are equivalent with respect to satisfaction. ▶ Definition 2 (Satisfaction).Let A ∈ Cond ( A ). Let ¯a = [ a1, a2, a3, ... ]be a composable sequence with A=dom(¯a). We define the satisfaction relation ¯a|=Aas follows: ¯a| = Vi∈I∀fi.Ai iff for every i∈I and every arrow g: RO ( Ai ) →B and all n∈N0 we have: if a1;...;an=fi;g, then [g, an+1, ...]|=Ai. ¯a| = Wi∃fi.Ai iff there exists i∈I and an arrow g: RO ( Ai ) →B and some n∈N0 such that a1;...;an=fi;gand [g, an+1, ...]|=Ai. 1 Another option would be to work in the category of potentially infinite graphs. However, that would allow conditions based on infinite graphs for which satisfiability checks become algorithmically infeasible.
L. Stoltenow, B. König, S. Schneider, A. Corradini, L. Lambers, and F. Orejas 39:5 Note that this covers the base cases ( ¯a| = true , ¯a| = false for every sequence ¯a ). Furthermore a1 ; ... ; an equals the identity whenever n = 0. For a finite sequence ¯a = [ a1, ..., ak,id,id, ... ] this means that ¯a| = A iff a = a1 ; ... ; ak is a model for A according to the definition of satisfaction given in [1]. In this case we write [a1, ..., ak]|=Aor simply a|=A. ▶ Remark 3. In the following we use Cond to denote the set 2 of all conditions and Seq as the set of all composable sequences of arrows (potential models). ⌟ We write A | = B ( A implies B ) if RO ( A ) = RO ( B )and for every ¯a with dom ( ¯a ) = RO ( A ) we have: if ¯a| = A , then ¯a| = B . Two conditions are equivalent ( A≡B ) if A | = B and B | = A . Every condition can be transformed to an equivalent condition that alternates between ∀,∃by inserting ∀id or ∃id as needed. Such conditions are called alternating. We also define what it means for two conditions to be isomorphic. It is easy to see that isomorphic conditions are equivalent, but not necessarily vice versa. ▶ Definition 4 (Isomorphic Conditions).For conditions A,B and an iso h: RO(B)→RO(A) , we say that A,B are isomorphic ( A∼ =B ) wrt. h , whenever both are universal, i.e., A = Vi∈I∀fi.Ai , B = Vj∈J∀gj.Bj , and for each i∈I there exists j∈J and an iso hj,i : RO ( Bj ) →RO ( Ai )such that h ; fi = gj ; hj,i and Ai∼ =Bj wrt. hj,i ; and vice versa (for each j∈Jthere exists i∈I. . . ). Analogously if both conditions are existential. 2.4 Representative Squares and the Shift Operation We will now define the notion of representative squares, which describe representative ways to close a span of arrows. They generalize idem pushouts [ 16 ] and borrowed context diagrams [ 4 ]. ▶ Definition 5 (Representative squares [ 1 ]).A class κ of commuting squares in a category Cis representative if for every commuting square α1 ; δ1 = α2 ; δ2 in Cthere exists a representative square α1;β1=α2;β2in κand an arrow γsuch that δ1=β1;γand δ2=β2;γ. A B C D D′ α1 α2 β1 β2γ δ1 δ2 For two arrows α1:A→B, α2:A→C , we define κ ( α1, α2 )as the set of pairs of arrows (β1, β2)which, together with α1, α2, form representative squares in κ. Compared to weak pushouts, more than one square might be needed to represent all commuting squares that extend a given span ( α1, α2 ). In categories with pushouts (such as Graphfin ), pushouts are the most natural candidate for representative squares. In Graphinj fin pushouts do not exist, but jointly epi squares can be used instead. For cospan categories, one can use borrowed context diagrams [4] (see Appendix A for a summary). For many categories of interest – such as Graphfin and ILC ( Graphfin )– we can guarantee a choice of κ such that each set κ ( α1, α2 )is finite and computable. In the rest of this paper, we assume that we work in such a category, and use such a class κ . Hence the constructions described below are effective since the finiteness of the transformed conditions is preserved. 2 Actually, without restrictions these are proper classes rather than sets. We tacitly assume that we are working in the corresponding skeleton category where no two different objects are isomorphic and assume that we can consider Cond,Seq as sets. CONCUR 2024
39:6 Coinductive Techniques for Checking Satisfiability of Generalized Nested Conditions One central operation is the shift of a condition along an arrow. The name shift is taken from an analogous operation for nested application conditions (see [19]). ▶ Definition 6 (Shift of a Condition).Given a fixed class of representative squares κ , the shift of a condition Aalong an arrow c: RO(A)→Bis inductively defined as follows: ^ i∈I ∀fi.Ai↓c=^ i∈I^ (α,β)∈κ(fi,c) ∀β.(Ai)↓α fi c α β Shifting of existential conditions is performed analogously. The shift operation can be understood as a partial evaluation of A under the assumption that c is already “present”. In particular it satisfies [ c ; d1, d2, ... ] | = A ⇐⇒ [ d1, d2, ... ] | = A↓c . This implies that while the representation of the shifted condition may differ depending on the chosen class of representative squares, the resulting conditions are equivalent. Since we assume that each set κ ( fi, c )is finite, shifting a finite condition will again result in a finite condition. As an example in Graphinj fin , shifting ∀∅→1.∃1→1 2 .true (every node has an outgoing edge) over ∅→ (a node exists) yields ∀ → .∃ → 1.true ∧ ∀ → 1.∃1→1 2 .true ∨ ∃ 1→1.true (the designated node has an outgoing edge, and so does every other node, possibly to the designated node). In the case where α1 in Definition 5 is an iso, we can always assume that κ ( α1, α2 ) = {(α−1 1;α2,id)}and we will use this assumption in the paper. 2.5 Further Concepts Our goal is to develop a procedure that finds a finite model if one exists, produces unsatisfiability proofs if a condition has neither finite nor infinite models, and otherwise does not terminate. In order to state the correctness of this procedure, we will need an abstract notion of finiteness and to this aim we introduce finitely decomposable morphisms. Intuitively this means that every infinite decomposition contains only finitely many non-isomorphisms. ▶ Definition 7 (Finitely decomposable morphism).A morphism m:A→B is finitely decomposable if for every infinite sequence of ( fi, gi ), i∈N0 , such that f0 = m and fi = gi ; fi+1 (cf. the diagram below), only finitely many giare non-isomorphisms. A B · · · m=f0 g0g1 f1f2 Note that in Graphinj fin all arrows are finitely decomposable, while this is not the case in Graphfin . In Graphfin , there exists a section s (with associated retraction r such that s ; r = id ) that is not an iso (example: s = 1→1 2 , r = 1 2 →1 ). Then, the identity on the domain of s has a decomposition into infinitely many non-isos (an alternating sequence of s and r , more concretely: g2i = s , g2i+1 = r and f2i = id , f2i+1 = r ) and is hence not finitely decomposable. While satisfaction is typically defined inductively (as in Definition 2), i.e., as a least fixpoint, we can also view it coinductively, i.e., as a greatest fixpoint, due to the fact that all conditions are finite. ▶ Proposition 8 (Fixpoint function for satisfaction).Let ¯a = [ a1, a2, a3, ... ] ∈Seq be a composable sequence of arrows. We define the function s:P ( Seq ×Cond ) → P ( Seq ×Cond ) as follows: Let P⊆Seq ×Cond, then
L. Stoltenow, B. König, S. Schneider, A. Corradini, L. Lambers, and F. Orejas 39:7 ( ¯a, Vi∀fi.Ai ) ∈s ( P )iff for every i∈I and every arrow g: RO ( Ai ) →B and all n∈N0 we have: if a1;...;an=fi;g, then ([g, an+1, ...],Ai)∈P. ( ¯a, Wi∃fi.Ai ) ∈s ( P )iff there exists i∈I and an arrow g: RO ( Ai ) →B and some n∈N0 such that a1;...;an=fi;gand ([g, an+1, ...],Ai)∈P. The least and greatest fixpoint of s ( µs , νs ) coincide and they equal the satisfaction relation | =. 3 Satisfiability Checking in the Restricted Case Given a condition A , we want to know whether A is satisfiable and generates a finitely decomposable model, if it exists. Here we provide a procedure that works under the assumption that we are working in a category where all sections are isos. This is for instance true for Graphinj fin and ILC ( Graphinj fin ), where non-trivial right-inverses do not exist. It does not hold for non-injective graph morphisms (see counterexample above) or left-linear cospans (counterexample: id = 1→1←1 2 ;1 2 →1 2 ←1). The general case where this assumption does not hold will be treated in Section 5. 3.1 Tableau Calculus The underlying idea is fairly straightforward: we take an alternating condition A and whenever it is existential, that is A = Wi∈I∃fi.Ai , we branch and check whether some Ai is satisfiable. If instead it is universal, i.e., A = Vi∈I∀fi.Ai , we check whether some fi is an iso. If that is not the case, clearly the sequence of identities on RO ( A )is a model, since there is no arrow g such that id = fi ; g , assuming that all sections are isos. If however some fi is an iso, we invoke a pull-forward rule (see below for more details) that transforms the universal condition into an existential condition and we continue from there. We will show that this procedure works whenever the pull-forward follows a fair strategy: in particular every iso (respectively one of its successors) must be pulled forward eventually. The pull-forward rule relies on the equivalence (A∧∃f.B)≡ ∃f.(A↓f∧ B). ▶ Lemma 9 (Pulling forward isomorphisms).Let Vi∈I∀fi.Ai be a universal condition and assume for some p∈I , fp is an iso and Ap = Wj∈J∃gj.Bj . Then fp can be pulled forward: ^ i∈I ∀fi.Ai≡ ∃fp._ j∈J ∃gj. Bj∧^ m∈I\{p} ∀fm.Am↓fp;gj! ▶ Definition 10 (SatCheck tableau construction rules).Given an alternating condition A , we give rules for the construction of a tableau for A that has conditions as nodes, A as root node, and edges ( → ) labeled with arrows. The tableau is extended at its leaf nodes as follows: For every p∈I: For one p∈Isuch that fpis iso and Ap=Wj∈J∃gj.Bj: _ i∈I ∃fi.Ai fp −→ Ap^ i∈I ∀fi.Ai fp −→ _ j∈J ∃gj.Bj | {z } Ap ∧^ m∈I\{p} ∀fm.Am↓fp;gj | {z } other children, shifted to include gj For existential conditions, for each(!) child condition ∃fp.Ap, add a new descendant. For universal conditions, non-deterministically pick one(!) child condition ∀fp.Ap that can be pulled forward ( fp is an iso), pull it forward (cf. Lemma 9), and add the result as its (only) descendant. If a universal condition contains no isos, then add no descendant. CONCUR 2024
39:8 Coinductive Techniques for Checking Satisfiability of Generalized Nested Conditions Abranch of a tableau is a (potentially infinite) path A0 u1 −→ A1 e1 −→ A2 u2 −→ . . . starting from the root node. A finite branch is extendable if one of the tableau construction rules is applicable at its leaf node and would result in new nodes (hence, a branch where the leaf is an empty existential or a universal without isomorphisms is not extendable). A branch is closed if it ends with an empty existential, otherwise it is open. Due to Lemma 9 each universal condition is (up to iso fp ) equivalent to its (unique) descendant (if one exists), while an existential condition is equivalent to the disjunction of its descendants prefixed with existential quantifiers. The labels along one branch of the tableau are arrows between the root objects of the conditions. Their composition corresponds to the prefix of a potential model being constructed step by step. Finite paths represent a model if they are open and not extendable. For infinite paths, we need an additional property to make sure that the procedure does not “avoid” a possibility to show unsatisfiability of a condition. To capture that, we introduce the notion of fairness, meaning that all parts of a condition are eventually used in a proof and are not postponed indefinitely (a related concept is saturation, see e.g. [ 13 ], though the definition deviates due to a different setup). For this we first need to track how pulling forward one child condition changes the other children by shifting. We define a successor relation that, for each pair of ∀ -condition and one of its ∀ -grandchildren, relates child conditions of the ∀ -condition to their shifted counterparts (the successors) in the ∀ -condition of the second-next nesting level. The successor relation is similar in spirit to the one used in [ 13 ]. In this work, saturation is given in a more descriptive way and has to account for nesting levels in the tableau, a complication that we were able to avoid in the present paper. ▶ Definition 11 (Successor relation).Assume in the construction of a tableau we have a path ^ i∈I ∀fi.Ai fp −→ C gj −→ Bj∧^ m∈I\{p} ∀fm.Am↓fp;gj =Bj∧^ m∈I\{p}^ (α,β)∈κ(fm, fp;gj) ∀β.(Am)↓α where C is the existential condition given in Definition 10. Then for each m∈I\ {p} , each ∀β. ( Am ) ↓α where ( α, β ) ∈κ ( fm, fp ; gj )is a successor of ∀fm.Am . The transitive closure of the successor relation induces the indirect successor relation. ▶ Definition 12 (Fairness).An infinite branch of a tableau is fair if for each universal condition A on the branch and each child condition ∀fi.Ai of A where fi is an iso, it holds that some indirect successor of ∀fi.Aiis eventually pulled forward. ▶ Remark 13 (Fairness strategies). One possible strategy that ensures fairness is to maintain for each incomplete branch a queue of child conditions for which a successor must be pulled forward. Then the first entry in this queue is processed. Note that by the assumption on κ made earlier at the end of Section 2.4, each iso in a universal condition that is not pulled forward has exactly one successor and the queue is modified by replacing each condition accordingly and adding newly generated child conditions with isos at the end. ⌟ 3.2 Up-To Techniques, Fair Branches and Models While showing soundness of the tableau method is relatively straightforward, the crucial part of the completeness proof is to show that every infinite and fair branch of the tableau corresponds to a model. The proof strategy is the following: given such a branch, we aim to construct a witness for this model, by pairing conditions on this path with the suffix
L. Stoltenow, B. König, S. Schneider, A. Corradini, L. Lambers, and F. Orejas 39:9 consisting of the sequence of arrows starting from this condition. If one could show that the set P⊆Seq ×Cond of pairs so obtained is a post-fixpoint of the satisfaction function s defined in Proposition 8 ( P⊆s ( P )), we could conclude, as the satisfaction relation | =is the greatest fixpoint of s(Proposition 8) and hence above any post-fixpoint. However, P is in general not a post-fixpoint, which is mainly due to the fact that universal conditions are treated “sequentially” one after another and are “pulled forward” only if they become isos. Hence, if we want to show that for a chain [ a1, a2, ... ]the universal condition of the form Vi∀fi.Ai is satisfied, we have to prove for every child ∀fi.Ai that whenever a1 ; ... ; an = fi ; g it holds that [ g, an+1, ... ] | = Ai . If ∀fi.Ai actually is the child that is pulled forward in the next tableau step, P contains the tuple required by s . If not, there is a “delay” and intuitively that means that we can not guarantee that Pis indeed a post-fixpoint. However it turns out that it is a post-fixpoint up-to ( P⊆s ( u ( P ))), where u is a combination of one or more suitable up-to functions. We first explore several such up- to functions: u∧ ( P )obtains new conditions by non-deterministically removing parts of conjunctions; with u# ( P )we can arbitrarily recompose (decompose and compose) the arrows in a potential model; with u↓ ( P )we can undo a shift; and u∼ = ( P )allows replacing conditions with isomorphic conditions. For each, we show their s -compatibility (i.e., u ( s ( P )) ⊆s ( u ( P ))). ▶ Theorem 14 (Up-to techniques).Let P⊆Seq ×Cond , i.e. tuples of potential model and condition. Then the following four up-to functions are s-compatible: Conjunction removal: We inductively define a relation U∧ containing a pair of conditions ( A,T )iff T is the same as A but with some conjunctions removed. That is, U∧ contains Vi∈I∀fi.Ai,Vj∈J⊆I∀fj.Tjwhenever (Aj,Tj)∈ U∧for all j∈J Wi∈I∃fi.Ai,Wi∈I∃fi.Tiwhenever (Ai,Ti)∈ U∧for all i∈I Then define: u∧(P) = {(¯c, T)|(¯c, A)∈P, (A,T)∈ U∧} Recomposition: u# ( P ) = { ([ b1, ..., bℓ,¯c ] ,A ) | ([ a1, ..., ak,¯c ] ,A ) ∈P, a1 ; ... ; ak = b1 ; ... ; bℓ} Shift: u↓(P) = {([(c;c1), c2, ...],B)|([c1, c2, ...],B↓c)∈P} Isomorphic condition: u∼ = ( P ) = { ([( h ; c1 ) , c2, ... ] ,B ) |([c1, c2, ...],A)∈P, A∼ =Bwith iso h: RO(B)→RO(A)} Note however that up-to equivalence u≡ is not a valid up-to technique: let U be an unsatisfiable condition and let P = { ([ id, ... ] ,∀id.U ) } . As U ≡ ∀id.U , then also ([ id, ... ] ,U ) ∈u≡ ( P )and hence P⊆s(u≡(P)). If the technique were correct, this would imply id |=U. A convenient property of compatibility is that it is preserved by various operations, in particular, composition, union and iteration ( fω = Si∈N0fi ). This can be used to combine multiple up-to techniques into a new one that also has the compatibility property. [21] ▶ Lemma 15 (combining up-to techniques).Let u = ( u#∪u∧∪u↓∪u∼ = ) ω be the iterated application of the up-to techniques from Theorem 14, then uis s-compatible. We are now able to prove the central theorem needed for showing completeness. ▶ Theorem 16 (Fair branches are models).Let A0 be an alternating condition. Let a fixed tableau constructed by the rules of Definition 10 be given. Let A0 b1 −→ A1 b2 −→ A2 b3 −→ . . . be a branch of the tableau that is either not extendable and ends with a universal quantification (i.e., it is open), or is infinite and fair. For such a branch, we define P = { ( ¯ b, Ai ) |i∈ N0,¯ b = [ bi+1, bi+2, ... ] } ⊆ Seq ×Cond , i.e., the relation P pairs suffixes of the branch with the corresponding conditions. Finally, let u be the combination of up-to techniques defined in Lemma 15. Then, P⊆s ( u ( P )), which implies that P⊆ | =. In other words, every such branch in a tableau of Definition 10 corresponds to a model of A0. CONCUR 2024
39:16 Coinductive Techniques for Checking Satisfiability of Generalized Nested Conditions In the general case, although soundness and completeness still hold, we are no longer able to find all finite models as before. This is intuitively due to the fact that a condition might have a finite model, but what we find is a seemingly infinite model that always has the potential to collapse to the finite model. On the other hand, the weaker requirements on the category imply that more instantiations are possible, such as to Graphfin (graphs and arbitrary morphisms). Here, pushouts can be used for representative squares, which allows for a more efficient shift operation that avoids the blowup of the size of the conditions that is associated with jointly epi squares. 6 Conclusion We introduced a semi-decision procedure for checking satisfiability of nested conditions at the general categorical level. The correctness of this tableau-based procedure has been established using a novel combination of coinductive (up-to) techniques. In the restricted case we also considered the generation of finite models and witnesses for (some) infinite models. Our procedure thereby generalizes prior work [ 13 , 26 , 17 ] on nested graph conditions that are equivalent to first-order logic [ 6 ]. As a result, we can also handle cospan categories over adhesive categories (using borrowed context diagrams for representative squares) and other categories, such as Lawvere theories. There is a notion of Q-trees [ 7 ] reminiscent of the nested conditions studied in this paper, but to our knowledge no generic satisfiability procedures have been derived for Q-trees. We plan to transfer the technique of counterexample-guided abstraction refinement (CEGAR) [9], a program analysis technique based on abstract interpretation and predicate abstraction, to graph transformation and reactive systems. The computation of weakest preconditions and strongest postconditions for nested conditions is fairly straightforward [ 1 ] and satisfiability checks give us the necessary machinery to detect and eliminate spurious counterexamples. One still has to work around undecidability issues and understand whether there is a generalization of Craig interpolation, used to simplify conditions. One further direction for future work is to understand the mechanism for witness generation in more detail. In particular, since it is known that FOL satisfiability for graphs of bounded treewidth is decidable [ 2 ], the question arises whether we can find witnesses for all models of bounded treewidth (or a suitable categorical generalization of this notion). Another direction is to further explore instantiation with a Lawvere theory [ 14 ], where arrows are n -tuples of m -ary terms. In this setting representative squares are closely related to unification. The full version [28] contains some initial results. Finally we plan to complete development of a tool that implements the satisfiability check and explore the potential for optimizations regarding its runtime. References 1 H.J. Sander Bruggink, Raphaël Cauderlier, Mathias Hülsbusch, and Barbara König. Conditional reactive systems. In Proc. of FSTTCS ’11, volume 13 of LIPIcs. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2011. URL: http://drops.dagstuhl.de/opus/frontdoor. php?source_opus=3325. 2 Bruno Courcelle. The monadic second-order logic of graphs I. Recognizable sets of finite graphs. Information and Computation, 85(1):12–75, 1990. 3 Hartmut Ehrig, Karsten Ehrig, Ulrike Prange, and Gabriele Taentzer. Fundamentals of Algebraic Graph Transformation. Monographs in Theoretical Computer Science. Springer, 2006. 4 Hartmut Ehrig and Barbara König. Deriving bisimulation congruences in the DPO approach to graph rewriting with borrowed contexts. MSCS, 16(6):1133–1163, 2006.
L. Stoltenow, B. König, S. Schneider, A. Corradini, L. Lambers, and F. Orejas 39:17 5 Hartmut Ehrig, Michael Pfender, and Hans Jürgen Schneider. Graph grammars: An algebraic approach. In Proc. 14th IEEE Symp. on Switching and Automata Theory, pages 167–180, 1973. 6Melvin Fitting. First-Order Logic and Automated Theorem Proving. Springer, 1996. 7Peter J. Freyd and Andre Scedrov. Categories, Allegories. North-Holland, 1990. 8 Annegret Habel and Karl-Heinz Pennemann. Correctness of high-level transformation systems relative to nested conditions. Mathematical Stuctures in Computer Science, 19(2):245–296, 2009. 9 Thomas A. Henzinger, Ranjit Jhala, Rupak Majumdar, and Kenneth L. McMillan. Abstractions from proofs. In Proc. of POPL ’04, pages 232–244. ACM, 2004. 10 Mathias Hülsbusch and Barbara König. Deriving bisimulation congruences for conditional reactive systems. In Proc. of FOSSACS ’12, pages 361–375. Springer, 2012. LNCS/ARCoSS 7213. 11 Mathias Hülsbusch, Barbara König, Sebastian Küpper, and Lara Stoltenow. Conditional Bisimilarity for Reactive Systems. Logical Methods in Computer Science, Volume 18, Issue 1, January 2022. doi:10.46298/lmcs-18(1:6)2022. 12 Stephen Lack and Paweł Sobociński. Adhesive and quasiadhesive categories. RAIRO – Theoretical Informatics and Applications, 39(3), 2005. 13 Leen Lambers and Fernando Orejas. Tableau-based reasoning for graph properties. In Proc. of ICGT ’14, pages 17–32. Springer, 2014. LNCS 8571. 14 William Lawvere. Functorial Semantics of Algebraic Theories. PhD thesis, Columbia University, 1963. 15 James J. Leifer. Operational congruences for reactive systems. PhD thesis, University of Cambridge Computer Laboratory, September 2001. 16 James J. Leifer and Robin Milner. Deriving bisimulation congruences for reactive systems. In Proc. of CONCUR 2000, pages 243–258. Springer, 2000. LNCS 1877. 17 Marisa Navarro, Fernando Orejas, Elvira Pino, and Leen Lambers. A navigational logic for reasoning about graph properties. Journal of Logical and Algebraic Methods in Programming, 118:100616, 2021. 18 Karl-Heinz Pennemann. An algorithm for approximating the satisfiability problem of high-level conditions. In GT-VC@CONCUR, volume 213.1 of Electronic Notes in Theoretical Computer Science, pages 75–94. Elsevier, 2007. 19 Karl-Heinz Pennemann. Development of Correct Graph Transformation Systems. PhD thesis, Universität Oldenburg, May 2009. 20 Damien Pous. Complete lattices and up-to techniques. In Proc. of APLAS ’07, pages 351–366. Springer, 2007. LNCS 4807. 21 Damien Pous. Techniques modulo pour les bisimulations. PhD thesis, ENS Lyon, February 2008. URL: https://hal.archives-ouvertes.fr/tel-01441480. 22 Damien Pous and Davide Sangiorgi. Enhancements of the coinductive proof method. In Davide Sangiorgi and Jan Rutten, editors, Advanced Topics in Bisimulation and Coinduction. Cambridge University Press, 2011. 23 Arend Rensink. Representing first-order logic using graphs. In Proc. of ICGT ’04, pages 319–335. Springer, 2004. LNCS 3256. 24 Davide Sangiorgi. Introduction to Bisimulation and Coinduction. Cambridge University Press, 2011. 25 Vladimiro Sassone and Paweł Sobociński. Reactive systems over cospans. In Proc. of LICS ’05, pages 311–320. IEEE, 2005. 26 Sven Schneider, Leen Lambers, and Fernando Orejas. Symbolic model generation for graph properties. In Proc. of FASE ’17, pages 226–243. Springer, 2017. LNCS 10202. 27 Paweł Sobociński. Deriving process congruences from reaction rules. PhD thesis, Department of Computer Science, University of Aarhus, 2004. CONCUR 2024
39:18 Coinductive Techniques for Checking Satisfiability of Generalized Nested Conditions 28 Lara Stoltenow, Barbara König, Sven Schneider, Andrea Corradini, Leen Lambers, and Fernando Orejas. Coinductive techniques for checking satisfiability of generalized nested conditions, 2024. arXiv:2407.06864. URL: https://arxiv.org/abs/2407.06864. 29 Alfred Tarski. A lattice-theoretical fixpoint theorem and its applications. Pacific Journal of Mathematics, 5:285–309, 1955. A Additional Material for §2 (Preliminaries) Graphs and graph morphisms We will define in more detail which graphs and graph morphisms we are using: in particular, a graph is a tuple G = ( V, E, s, t, ℓ ), where V, E are sets of nodes respectively edges, s, t:E→V are the source and target functions and ℓ:V→ Λ(where Λis a set of labels) is the node labelling function. In the examples we will always omit node labels by assuming that there is only a single label. A graph Gis finite if both Vand Eare finite. Furthermore, given two graphs Gi = ( Vi, Ei, si, ti, ℓi ), i∈ { 1 , 2 } , a graph morphism φ:G1→G2 consists of two maps φV:V1→V2 , φE:E1→E2 such that φV◦s1 = s2◦φE , φV◦t1=t2◦φEand ℓ1=ℓ2◦φV. In the examples, the mapping of a morphism is given implicitly by the node identifiers: for instance, 1 2 →1 23 adds the node identified by 3and adds two edges from the existing nodes identified by 1and 2. Cospans and cospan composition Two cospans f:AfL −→ XfR ←−− B, g :BgL −→ YgR ←−− C are composed by taking the pushout ( pL, pR )of ( fR, gL )as shown in Figure 1. The result is the cospan f;g:AfL;pL −−−−→ ZgR;pR ←−−−− C , where Z is the pushout object of fR, gL . We see an arrow f:A→C of Cospan (D)as an object B of Dequipped with two interfaces A, C and corresponding arrows fL, fR to relate the interfaces to B , and composition glues the inner objects of two cospans via their common interface. A X B Y C Z fL fRgL gR pLpR f g f;g (PO) Figure 1 Composition of cospans fand gis done via pushouts. In order to make sure that arrow composition in Cospan (D)is associative on the nose, we quotient cospans up to isomorphism. In more detail: two cospans f:AfL −→ XfR ←−− B , g:AgL −→ YgR ←−− B are equivalent whenever there exists an iso ι:X→Y such that fL ; ι = gL , fR;ι=gR. Then, arrows are equivalence classes of cospans. Equivalence laws for conditions We rely on the results given in the following two propositions that were shown in [ 1 ]. They were originally stated for satisfaction with single arrows, but it is easy to see they are valid for possibly infinite sequences as well: conditions have finite depth and satisfaction only refers to finite prefixes of the sequence.
L. Stoltenow, B. König, S. Schneider, A. Corradini, L. Lambers, and F. Orejas 39:19 ▶ Proposition 35 (Adjunction).Let A,B be two conditions with root object A , let C,D be two conditions with root object Band let φ:A→B. Then it holds that: 1. A |=Bimplies A↓φ|=B↓φ. 2. C |=Dimplies Qφ.C |=Qφ.Dfor Q ∈ {∃,∀}. 3. ∃φ.(A↓φ)|=Aand for every Cwith ∃φ.C |=Awe have that C |=A↓φ. 4. A |=∀φ.(A↓φ)and for every Cwith A |=∀φ.Cwe have that A↓φ|=C. ▶ Proposition 36 (Laws for conditions).One easily obtains the following laws for shift and quantification, conjunction and disjunction: A↓id ≡ A A↓φ;ψ≡(A↓φ)↓ψ ∀id.A ≡ A ∀(φ;ψ).A≡∀φ.∀ψ.A ∃id.A ≡ A ∃(φ;ψ).A≡∃φ.∃ψ.A (A∧B)↓φ≡ A↓φ∧ B↓φ(A∨B)↓φ≡ A↓φ∨ B↓φ ∀φ.(A∧B)≡ ∀φ.A∧∀φ.B ∃φ.(A∨B)≡ ∃φ.A∨∃φ.B Borrowed context diagrams For cospan categories over adhesive categories (such as ILC ( Graphfin )), borrowed context diagrams – initially introduced as an extension of DPO rewriting [ 4 ] – can be used as representative squares. Before we can introduce such diagrams, we first need the notion of jointly epi. ▶ Definition 37 (Jointly epi).A pair of arrows f:B→D, g :C→D is jointly epi (JE) if for each pair of arrows d1, d2:D→E the following holds: if f ; d1 = f ; d2 and g ; d1 = g ; d2 , then d1=d2. In Graphfin jointly epi equals jointly surjective, meaning that each node or edge of D is required to have a preimage under for gor both (it contains only images of Bor C). This criterion is similar to, but weaker than a pushout: For jointly epi graph morphisms d1:B→D, d2:C→D , there are no restrictions on which elements of B, C can be merged in D . However, in a pushout constructed from morphisms a1:A→B, a2:A→C , elements in D can (and must) only be merged if they have a common preimage in A . (Hence every pushout generates a pair of jointly epi arrows, but not vice versa.) ▶ Definition 38 (Borrowed context diagram [ 10 ]).A commuting diagram in the category ILC (C), where Cis adhesive, is a borrowed context diagram whenever it has the form of the diagram shown in Figure 2a, and the four squares in the base category Care pushout (PO), pullback (PB) or jointly epi (JE) as indicated. Arrows depicted as ↣ are mono. In particular L↣G+,G↣G+must be jointly epi. Figure 2b shows a more concrete version of Figure 2a, where graphs and their overlaps are depicted by Venn diagrams (assuming that all morphisms are injective). Because of the two pushout squares, this diagram can be interpreted as composition of cospans a ; f = ℓ ; c = D→G+←K with extra conditions on the top left and the bottom right square. The top left square fixes an overlap G+ of L and G , while D is contained in the intersection of L and G (shown as a hatched area). Being jointly epi ensures that it really is an overlap and does not contain unrelated elements. The top right pushout corresponds to the left pushout of a DPO rewriting diagram. It contains a total match of L in G+ . Then, the bottom left pushout gives us the minimal borrowed context F such that applying the rule becomes possible. The top left and the bottom left squares together ensure that the contexts to be considered are not larger than necessary. The bottom right pullback ensures that the interface Kis as large as possible. CONCUR 2024
39:20 Coinductive Techniques for Checking Satisfiability of Generalized Nested Conditions D L I GG+C J F K JE PO PO PB ℓ ac f (a) Structure of a borrowed context diagram. The inner, lighter arrows are morphisms of the base category C, while the outer arrows are morphisms of ILC(C). D L I G G+C J F K JE PO PO PB (b) Borrowed context diagrams represented as Venn diagrams. The outer circles represent graphs L, G , and the area between the inner and outer circles represents their interfaces I, J. Figure 2 Borrowed context diagrams. For more concrete examples of borrowed context diagrams, we refer to [4, 11]. For cospan categories over adhesive categories, borrowed context diagrams form a representative class of squares [ 1 ]. Furthermore, for some categories (such as Graphinj fin ), there are – up to isomorphism – only finitely many jointly epi squares for a given span of monos and hence only finitely many borrowed context diagrams given a, ℓ (since pushout complements along monos in adhesive categories are unique up to isomorphism). Whenever the two cospans ℓ, a are in ILC ( Graphinj fin ), it is easy to see that f, c are in ILC(Graphinj fin), i.e., they consist only of monos, i.e., injective morphisms. Note also that representative squares in Graphinj fin are simply jointly epi squares and they can be straighforwardly extended to squares of ILC(Graphinj fin). Visualization of shifts Given a condition Aand an arrow c:A= RO(A)→B, we will visualize shifts in diagrams as follows: A B X c d A A↓c Remember that for an arrow d:B→Xit holds that d|=A↓c⇐⇒ c;d|=A. B Additional Material for §4 (Witnesses for infinite models) Table 1 Steps for the condition of Example 27, showing that a repeating infinite model exists. C0C1(C1)↓m ∀J1K.false ∀J1 2 K.false ∧ ∀J1 2 K.false ∧ ∀J1+K.∧ ∀J1 2 +K.∀J2+K. ∃J1+K.true ∃J1 2 +K.true ∃J2+K.true ∨∃J1+K.true∨∃J1 2 +K.true ∨∃J2+K.true ∨∃J1 2 +K.true ∧ ∀J1K.∃J12K.true ∧ ∀J1 2 K.∃J123K.true ∧ ∀J2K.∃J23K.true ∨∃J1 2 K.true ∧ ∀J1A×BK.false ∧ ∀J1 2 A×BK.false ∧ ∀J2A×BK.false ∧ ∀J1×BK.false ∧ ∀J1 2 ×BK.false ∧ ∀J2×BK.false ∧ ∀J1 2 BK.false ∧ ∀J2BK.false ∧. . . ∧. . . ∧. . .