Analysis of Logics with Arithmetic
Abstract
We present new results on finite satisfiability of logics with counting and arithmetic. One result is a tight bound on the complexity of satisfiability of logics with so-called local Presburger quantifiers, which sum over neighbors of a node in a graph. A second contribution concerns computing a semilinear representation of the cardinalities associated with a formula in two variable logic extended with counting quantifiers. Such a representation allows you to get bounds not only on satisfiability for these logics, but for satisfiability in the presence of additional “global cardinality constraints”: restrictions on cardinalities of unary formulas, expressed using arbitrary decidability logics over arithmetic. In the process, we provide simpler proofs of some key prior results on finite satisfiability and semi-linearity of the spectrum for these logics.
Keywords and phrases:
Presburger quantifiers, Spectrum, Guarded logicsCopyright and License:
2012 ACM Subject Classification:
Theory of computation Logic and verificationEditors:
Stefano Guerrini and Barbara KönigSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
This paper concerns the problem of determining whether a formula in some logic is satisfied in some finite structure: the finite satisfiability problem for . For the fragments of interest to us, the decidability of this problem will imply decidability of many other static analysis problems for the logic, such as validity of a sentence over finite structures and equivalence of two sentences over finite structures. The problem is known to be undecidable for first order logic [20]. In the last decades two paradigms for decidability emerged, one based on restricting to guarded quantification, and another restricting to two variable fragments. The two variable fragment of first order logic was shown to have decidable finite satisfiability problem and this was extended to allow “counting quantifiers”, of the form , where is fixed. The complexity of the satisfiability problem for this logic, normally denoted , over finite structures, as well as the complexity of satisfiability when considering arbitrary structures, was isolated in [15]. The same problem for the sublogic where quantification is guarded was shown to have slightly lower complexity [16].
In recent years there has been interest in adding more powerful arithmetic capabilities to these decidable logics. Instead of just asking whether the number of elements satisfying a property is above or below a constant, we can ask whether the cardinality is even, or whether the cardinality of several properties satisfies a linear inequality. Presburger logic focuses on linear inequalities between properties [2, 4, 3, 12], and local Presburger logic, , restricts to properties that involve neighbors of a given element. These logics are most naturally applied to finite models, to avoid dealing with addition or parity of infinity: thus in this work, finite satisfiability will always be our default, and we just refer to “satisfiability” henceforward. In [6] it was shown that local Presburger logics are in some sense equally expressive as certain variations of Graph Neural Networks (GNNs), and GNN verification problems can be reduced to satisfiability problems for these logics. It has been shown that satisfiability of Presburger logic is undecidable, while satisfiability of local Presburger logic is decidable [4]: the complexity of local Presburger logic is complete [3, 12], but the exact complexity of finite satisfiability had not been determined. Another way of enhancing logic with arithmetic involves global cardinality constraints. In such an enhancement, we can write a constraint that defines a constraint (e.g., a linear inequality) between one variable formulas. But we cannot have such a constraint parameterized by a second free variable. For example, we can write that unary predicate has cardinality below unary predicate . But if and are two binary predicates, we cannot express that the elements that are not adjacent to have greater cardinality than the elements that are not adjacent to .
As with local Presburger logic, it follows from prior results that enhanced with global cardinality constraints has decidable (finite) satisfiability problem. The exact complexity is not explicitly studied in the literature, although in the case of global cardinality constraints consisting of linear inequalities, tight bounds follow from results of Rudolph in [18]. A natural approach to proving decidability for logics enhanced with global constraints follows is to show that the the spectrum of each tuple of unary formulas of the logic is effectively semilinear. The spectrum of a tuple of unary formulas is the set of possible values that the tuple of cardinalities of the satisfiers of the formula can have within a finite model. For example, for the pair of formulas the spectrum consists of all pairs with . The spectrum being effectively semilinear means that we can find a quantifier-free formula of arithmetic that defines it. From effective semilinearity of the spectrum, we easily obtain decidability with additional global constraints. Here we provide complexity bounds for several of these problems, one featuring arithmetic over counts of neighbors, another concerning computing the spectrum of formulas. See Table 1 for the summary of our new upper bounds. At the same time, we provide simpler proofs of two fundamental results in the area: decidability of (finite) satisfiability for (see Section 4), and effective semi-linearity of the spectrum for (Section 5). We complement these positive results with a counterexample to semilinearity of spectra for unary formulas (Section 6).
2 Preliminaries
Basic notions.
A graph will always mean a finite directed graph without self-loops. A colored graph is a graph where nodes have a unique node label, and every pair of distinct nodes is connected by a unique edge (in one direction or the other), with node and edge vocabularies distinct. A multigraph is a finite directed graph without self-loops that allows a finite number of parallel edges (including no edge) between a pair of distinct nodes. A colored multigraph is defined similarly, but requiring each node to have a unique label. The multiplicity of a multigraph is defined as the maximum edge multiplicity within it.
The unit vector, denoted by , has entry , and other entries are . We define as the vector where all entries are , and as the vector that all entries are . For , if, for , Let denote the projection operator that maps to its first entries. Let and denote the maximal absolute values of the entries in and , respectively.
Linear algebra and Kleene star.
An integer linear constraint is an inequality involving integer coefficients , non-negative integer variables , and an integer constant . The set of solutions of such a constraint is called a modulus-free semilinear set, while if we include equations for integers it is a semilinear set. A constraint is homogeneous if .
For an integer linear system , we denote by the set of solutions in , i.e., , and similarly for a Boolean combination of linear systems. Note that if is feasible, then it has a solution in which the number of non-zero assignments is bounded, and the values of the assignments are also bounded.
Lemma 1 ([13], [7], also see Corollary 2.2 in [12]).
There are constants such that for every integer linear system , if admits a solution in , then it admits a solution in in which the number of variables assigned non-zero values is at most and every variable is assigned a value bounded by , where is the number of constraints in and is the maximal absolute value of the coefficients in .
Definition 2 (Kleene star).
For a set , the Kleene star of is defined as
Note that for any .
If is semilinear then its Kleene star is semilinear: this is closely-related to Parikh’s theorem which gives a correspondence between semi-linear sets and regular languages: see [14, 8]. We will be interested in bounding the complexity of the Kleene star of a semilinear set using numerical data associated to the set. Note that for an integer linear system , if , then . The following result gives a bound when .
Lemma 3.
For every integer linear system with , where and , there exists with such that , where is the Boolean combination of integer linear systems
, , and . Moreover, can be computed in time , where .
We defer the proof of this to the appendix.
Types.
Let be a vocabulary with unary and binary .
Definition 4 (1- and 2-type).
A 1-type (w.r.t. ) is a maximal consistent subset of
A 2-type (w.r.t. ) is a maximal consistent subset of
We denote the set of -types by and the set of -types .
Given an element in a -structure , we let denote its one-type in and similarly for a pair of elements in we let denote its two-type in ; in both cases we omit the dependence on for brevity.
Definition 5 (Silent 2-type).
The silent type, denoted by , is the unique 2-type that consists of only negated terms. If a type is not silent we say it is audible.
Definition 6 (Dual of 2-type).
For a 2-type , the dual of , denoted by , it the unique 2-type that swaps and in .
We denote the set of all 2-types except by , and the set of all 2-types that contain by for .
Note that , , , and .
We can abstract a model based on types:
Definition 7 (Type graph).
We associate to a -structure in a binary vocabulary a colored graph with the same set of vertices in an exponentially larger vocabulary: each vertex is colored with a 1-type, and each edge is colored with a 2-type. This is the type graph of the -structure.
Losing information, we can abstract a finite model based on cardinalities of -types. The notion will be crucial in Section 5:
Definition 8 (-type cardinality vector of a -structure).
Let be a -structure. The -type cardinality vector of is a -dimensional vector where the component is the number of elements in with 1-type .
3 Logics and prior complexity bounds concerning them
We fix a vocabulary which consists of unary predicates and binary predicates . All of our logics will consist of formulas with at most two variables, and . We start by reviewing two variable logic with counting (), built up from atomic formulas , , , and via the Boolean operators and the quantifier constructs , where is a formula and is a natural number, and similarly with the role of and swapped.
Our semantics will always be over finite structures interpreting the vocabulary . The formula above holds in a model at an element for when there are least elements such that . The case represents standard existential quantification.
Guarded two variable logic with counting (), restricts by requiring quantification to be guarded by an atom. The quantifier rule now includes the forms:
The logic replaces ’s counting quantifier with a Presburger quantifier:
where are integers, is an inequality or equality, and is an integer. In we will also allow unguarded quantification over unary formulas: if is a formula, so is . For example, is a sentence of that holds in a directed graph when there is an element that has 3 times as many outgoing edges as incoming edges.
The logic (guarded two variable logic with Presburger quantifiers) restricts by requiring each in a Presburger quantifier to be guarded, although still allowing unguarded unary quantification. Note that global cardinality constraints can be expressed in , but not in . Following prior papers [12], we do not allow a quantifier that tests the modulus of a linear combination of cardinalities of one dimensional sets, and thus our quantifiers are in a sense weaker than Presburger arithmetic. A Presburger modulus constraint is as above, but allowing to be replaced by , for natural numbers with . Likewise, can be extended to allow modulus constraints. In the appendix we show that all of of our results on and also hold for the extension with modulus constraints; in the body of the paper we focus on plain and in the statements.
Given a unary formula in some logic, and a finite model , we let be the cardinality of in ; we extend this notation to a tuple . Given such a tuple, its spectrum is the set of vectors of numbers of the form . We say that such a spectrum is semi-linear if it can be represented as a set of linear inequalities. When we talk about computing the spectrum for a formula, we mean computing a semi-linear representation. If we have such a representation, we can clearly check whether an individual is satisfiable, simply by seeing if the corresponding set of constraints is feasible. Thus, in cases, where the spectrum is known always to have such a representation, computing the spectrum can be seen as a generalization of the satisfiability pboelm.
The positive results in this paper, as well as the prior bounds, are summarized in Table 1. In the table, Sat Logic refers to the satisfiability problem for formulas of the logic over finite structures, while Spectrum refers to a bound on the size of a representation of the spectrum, again over finite structure. An entry of the form -c indicates that the problem is complete for complexity class .
| Sat Logic | Spectrum Size Bound | |
|---|---|---|
| -c [16] | (formerly ) | |
| -c [15] | , Thm 25 (formerly [5]) | |
| -c, Thm 9 (formerly -hard, in [4]) | Open | |
| Undecidable [4] | No size bound |
We give results on the spectrum, but they have applications to decidability of richer logics. can be extended with global unary cardinality constraints: these are of the form , where are formulas in one free variable, are integers, is an inequality or equality, and is an integer. is a sentence, and we define the semantics only for finite structures . Such satisfies if, letting be the number of elements in satisfying , we have . We write for the extension of with global cardinality constraints. As we explain later, computation of the spectrum provides an approach to get tight bounds on these extended logics. In the case where the global constraints are in Presburger arithmetic, these can be seen as an alternative to the technique of [18], which obtains tight bounds for the logic through reduction to satisfiability of itself.
4 Finite satisfiability of is in EXP
The goal of this section is to prove:
Theorem 9.
The finite satisfiability problem of is in .
infrastructure.
We fix a vocabulary which consists of unary predicates and binary predicates . We consider sentences over in normal form:
where is a quantifier-free formula, each is a quantifier-free formula, and each is a Presburger quantified formula of the form:
Note that in the normal form we allow which is equivalent to a sentence.
There is a linear time algorithm that converts every sentence into an equi-satisfiable sentence in normal form [12], which is based on the standard renaming technique for introduced in [10, 16]. See the appendix for an argument.
Definition 10 (Compatibility of 1- and 2-types).
For a sentence in the normal form above and a 1-type , we say is compatible with , if , where is from the normal form, that is, the “unary universal part” of .
For 1-types and , and a 2-type , we say that is compatible with , if
-
, and
-
.
That is, the tuple satisfies the “binary universal part”.
We denote the set of 1-types compatible with by . Note that it takes time to check compatibility with either for a -type or a tuple .
In order to capture the counting conditions, we introduce behavior vectors. Informally, the behavior vector of a vertex encodes the configuration of its neighbors. We fix an ordering of the set , which has cardinality . A behavior vector is an element of . Abusing notation, we write to refer to the component of , where is the index of the tuple in the fixed ordering of .
Definition 11 (Behavior vector of a vertex).
For a -structure and a vertex in , the behavior vector realized by , denoted by , is an element of defined as follows: for every and , is the number of edges in adjacent to such that the 2-type of is and the 1-type of ’s destination is .
Definition 12 (Characteristic system).
For sentence in normal form and 1-type , the characteristic system of and , denoted , is the integer linear system defined:
-
The variables of are for every and .
-
(Compatibility) For every and if or is not compatible with , then is a constraint in .
-
(Counting) For , if then the following constraint is in :
Note that there are variables and at most , the number of unary predicates, constraints in . The absolute value of coefficients in is bounded by , where is the maximal absolute value of coefficients in .
Definition 13 (Compatibility of behavior vector).
For a sentence in normal form and a 1-type , we say that a behavior vector is compatible with and if is a solution of .
We denote the set of all behavior vectors that are compatible with and by . Note that can be infinite but semilinear.
The following property restates satisfaction of a formula in a -structure in terms of the type graph of the structure, where the types are identified with vertex- and edge-labels:
Proposition 14.
For every sentence in normal form, is finitely satisfiable if and only if there exists a colored graph satisfying the following conditions:
-
(1-type) For every vertex , is compatible with .
-
(2-type) For every pair of vertices , is compatible with .
-
(Counting) For every vertex , is compatible with and .
We say that a colored multiple graph in the vocabulary of types, , is a finite pseudo-model of a sentence if it satisfies all conditions in Proposition 14. Here we show that to establish the finite satisfiability of , it is sufficient to construct a pseudo-model.
Lemma 15.
For every sentence in normal form, is finitely satisfiable if and only if it has a finite pseudo-model.
Proof.
Note that the type graph of a finite model of is a finite pseudo-model of . Thus we focus on the if direction, constructing (the type graph of) a finite model of using a duplicating and swapping procedure.
Let be a finite pseudo-model of , and let be a copy of . Define as the disjoint union of and , after iteratively applying the following swapping procedure: for every pair of vertices and in with more than one edge between them, let be an edge between them, and let be the corresponding edge in . We then swap the destinations of and in .
It is straightforward to verify that is a pseudo-model of and its multiplicity is one less than . We can repeat this procedure until we obtain a finite pseudo-model where no two vertices have multiple edges. Finally, the type graph of the finite model of is obtained by connecting all remaining pairs in with the silent type.
The main construction.
For every sentence in normal form, we assume that for every 1-type , . Otherwise is trivially satisfiable by a model with only one vertex with 1-type .
Lemma 16.
A sentence in normal form is finitely satisfiable if and only if there exists vectors for each satisfying the following conditions.
-
(Matching) For every , .
-
(Non-triviality) There exists some such that .
Proof.
Suppose that is finitely satisfiable with finite model .
For a 1-type , let be the set of vertices in with 1-type . Note that the partition . Since , for every in , . We claim that satisfies the conditions.
-
(Matching) For every , note that
That is, is the number of edges with types in . Similarly, is the number of edges with types in . Since the number of edges with types and should be the same, the Matching constraint holds.
-
(Non-triviality) Since is non-empty, by our assumption, it has a vertex with 1-type satisfying that . Therefore, .
Suppose that there exists such for
. By the definition of Kleene star, for every , there exists , not necessarily distinct, such that . We construct a colored multigraph , which will be the type graph of our structure, as follows. The vertices in are . Each vertex is colored with a -type , and we let be the set of vertices colored with . For every , we add edges between and such that for each , the number of edges connected to it with 2-type is and for each , the number of edges connected to it with 2-type is . Note that by the Matching constraint, , so this construction is always possible. We claim that is a pseudo-model of . Note that each vertex in is colored with 1-type in , each edge in is colored with 2-type in , and it is routine to check that the behavior vector of is . By the Non-triviality constraint, is non-empty. Thus by Lemma 15, is finitely satisfiable.
Above we connected the finite satisfiability problem of sentence and the Kleene star of behavior vectors. However, because the cardinality of the set is infinite, it is not clear how to determine the solvability of the conditions in Lemma 16. In addition, this representation does not tell us anything about the shape of the models.
Recall that the set of behavior vectors is the solution set of the characteristic system . We can apply Lemma 3 and obtain that
Thus the conditions in Lemma 16 can be encoded in the following integer linear system.
Definition 17.
For every sentence in normal form, the integer linear system is defined as follows.
-
The variables of are for every and . Let denote the vector of variables .
-
(Structure) For every , is part of , where is the integer linear system obtained by applying Lemma 3 to the characteristic system .
-
(Matching) For every , the following constraint is in , , where we recall that denotes the dual 2-type.
-
(Non-triviality) .
Lemma 18.
For every sentence in normal form, is finitely satisfiable if and only if has a solution in .
Proof.
Suppose that is finitely satisfiable.
By Lemma 16, there exists for satisfying the Matching and Non-triviality conditions.
For every and , let . We claim that assigning to gives a solution of the system .
Suppose that has a solution, assigning to .
For every , since is a valid assignment of , by Lemma 3, . We claim that are vectors satisfying the conditions in Lemma 16, which implies that is finitely satisfiable. The proof of Non-triviality is routine. Here we focus on the Matching constraint. For every , by the Matching condition of , . Since , we have .
The system is a Boolean combination of exponentially many integer linear constraints, and thus can be solved in . To get , we apply an idea from [16], refining to get exponentially many homogeneous constraints.
Definition 19.
For every sentence in normal form, for , the integer linear system is the system where the Structure constraint is replaced with:
-
(Structure′) For every ,
where is the matrix obtained by applying Lemma 3 to the characteristic system .
Lemma 20.
For every sentence in normal form, there exists , such that for every , has a solution in if and only if has a solution in .
Moreover, can be computed directly from in time exponential in the length of , assuming binary encoding of coefficients.
Proof.
By Lemma 1, if has a solution in , then it has a “small solution”: every value is bounded by , where is the maximal coefficient in and is the number of constraints in , which is exponential in the number of unary and binary predicates. Thus can be computed directly from in time exponential in the length of , assuming binary encoding of coefficients. Let .
Note that the only difference between and pertains to constraints and . We show that the two systems are equi-satisfiable, provided is sufficiently large.
Suppose that has a solution in .
We claim that a small solution of is a solution of . For every , let and be corresponding assignments for and in . If , then and , which implies that holds trivially. On the other hand, if , then , which implies that . Therefore
Suppose that has a solution in .
We claim that the also form a solution to . It is sufficient to show that, for vectors and , if , then . If , then , which implies that . Otherwise if , then holds trivially.
We are now ready to prove Theorem 9:
Proof.
For every sentence in normal form, by Lemma 16, Lemma 18, and Lemma 20, is finitely satisfiable if and only if has a solution in . Note that is an integer linear system with variables, constraints, and coefficients bounded by . Moreover, is homogeneous. Thus, it has a solution in the natural numbers if and only if it has a rational solution. The feasibility of an integer linear system over the rationals can be checked in time polynomial in the number of variables, the number of equations, and the logarithm of the absolute value of the maximum coefficients [9]. Consequently, this process takes time exponential in the length of , assuming binary encoding of coefficients
Note that the solutions to the linear system used in proving Theorem 9 will contain a representation of every finite model: the vector of cardinalities of -types. But it contains additional vectors that do not correspond to the cardinalities of one types in any model. This is related to the fact that while existence of a pseudo-model implies existence of a model (Lemma 15), cardinalities are not preserved in moving from a pseudo-model to the corresponding model. We return to this in Section 6.
5 Spectra of formulas
In this section we will consider converting formulas in logic with arithmetic into linear constraints. These constraints will characterize the set of models of a formula. With this characterization in place, we have reduced finite satisfiability of the formula to a check for satisfiability of the conjunction of the linear constraints, which can be done via standard linear algebra solving. From this it will follow that with a variety of global cardinality constraints is decidable: we just conjoined the cardinality constraints with the constraints characterizing the models.
We fix a vocabulary which consists of unary predicates and binary predicates . We consider sentence over in normal form:
where and are quantifier-free, are binary predicates, , and .
Definition 21 (Count bound vector).
The count bound vector of , denoted by , is the dimension vector such that the component of is .
We denote the sum of by .
Definition 22 (Forward and backward characteristic vector of 2-types).
For as above and a 2-type , the forward characteristic vector of , denoted by , is an dimensional vector defined: for every , if , then the component of is 1. Otherwise, it is . The backward characteristic vector of , denoted by , is defined similarly.
Definition 23 (Forward and backward silent 2-type).
For as above and a 2-type we say that is forward-silent if for , . Backward-silent is defined similarly.
We define the notions of and similarly to those in . We also define as the set of 2-types that are both forward- and backward-silent, for 2-types that are not forward-silent but are backward-silent, and for 2-types that are neither forward- nor backward-silent.
In the rest of the section, we deal only with normal form sentences. We explain how the results apply to arbitrary sentences in the appendix.
Definition 24 (Spectrum and -type spectrum).
For every sentence , the spectrum of , denoted by , is the set of natural numbers that are sizes of finite models of .
The 1-type spectrum of , denoted by , is the set of 1-type cardinality vectors (see Definition 8) corresponding to finite models of .
We aim to show:
Theorem 25.
For every sentence , and are semilinear. Furthermore, each spectrum can be represented by an existential Presburger formula of size doubly exponential in .
Definition 26 (Silent compatible 1-types).
For a pair of 1-types and , we say that and are silent-compatible w.r.t. , if is non-empty. Otherwise, we say, following [15], that and are a noisy pair.
Lemma 27.
For every sentence in normal form and -structure , for every pair of 1-types and , if and are a noisy pair (w.r.t. ), then at least one of the 1-types or is realized by at most vertices in .
Proof.
Recall that denotes the vertices in with 1-type . Because , for vertex , . We consider two cases.
Suppose that .
Since , we have
For every pair of vertices and in with , by definition of noisy pair, the sum of components of is at least . Therefore, we have
which implies that .
Suppose that .
By a similar argument, . If we are done. So assume the opposite. Then we have
The following straightforward proposition gives conditions that characterize the satisfiability of by a model in terms of the prior constructs.
Proposition 28.
For every sentence in normal form and -structure , is a model of if and only if following conditions hold. For every with ,
-
(1-type) ,
-
(2-type) , and
-
(Counting) ,
where is the count bound vector of .
Definition 29 (Partial model of sentence).
For every sentence and -structure , we say that a complete colored graph is a partial model of if satisfies the first two conditions in Proposition 28.
The following is obvious.
Lemma 30.
For every sentence in normal form, for every -structure , for every , is a partial model of .
Core of structures.
Definition 31.
For a -structure, , we say that substructure is an -core of if
-
for every 1-type , the number of vertices in with 1-type is either or at least
-
for 1-types , , and 2-type , there are either and at least pairs of vertices satisfying that , , , and .
Note that the core of is not unique, and is trivially a core of itself for every . Therefore, we are interested in the existence of a small core of . We can show that for every , every -structure has an exponential-size core.
Lemma 32.
For every -structure , for every , has an -core with size at most .
The intuition behind the construction is to repeatedly select a 1-type or tuple that violates the -core condition and add the relevant vertices to . Since there are only finitely many such choices, the process eventually stabilizes, and the size of the constructed core remains bounded: see the appendix for details.
For a sentence and a -structure , if is a -core of with sufficiently large , then we have the following important property of :
Lemma 33.
For every sentence and -structure , for every -core with , the 1-types realized in are silent-compatible (w.r.t. ).
Proof.
Suppose that there exist 1-types and realized in which are not silent-compatible. By Lemma 27, at least one of the 1-types or is realized by at most vertices in . Without loss of generality, suppose that is realized by at most vertices in , then there are at most vertices in realized . However, by the definition of -core, since is realized in , it is realized by at least vertices in . This leads to a contradiction.
In Section 4, we introduced the notion of behavior vectors to describe the number of edges connected to a given vertex with specific 2-types. In this section, we consider -structures with a fixed core and extend the concept of behavior vectors to incorporate information about the core. Again, we fix an ordering of the set , which has cardinality .
Definition 34 (Extended behavior).
Fixing a vocabulary , an extended behavior w.r.t. a set of vertices is a tuple where is a mapping from a vertex to a 2-type in , and is an element of .
Informally, each extended behavior consists of two components. The first one is a mapping from vertices in the core to 2-types, capturing the 2-type realized by the edge between a given vertex and core vertices. The second component is a behavior vector.
Abusing notation, for an extended behavior , we will write for and for the dual of . We will also write for the component of , where is the index of the tuple in the fixed ordering of .
Definition 35 (Compatibility of extended behaviors).
For a sentence in normal form, , and a -structure with vertices , we say that an extended behavior function w.r.t. is compatible with , , and if satisfies:
-
1.
(Compatibility with ) For every , .
-
2.
(Compatibility with 1- and 2- types) For every , if or , then .
-
3.
(Forward-silent zero) For every , if is forward-silent, then .
-
4.
(Counting) The remaining entries of , that is, entries for -types that are not forward-silent, are bounded by the following constraint:
Note that this condition implies that if and are compatible with , and is not forward-silent, then is bounded by .
Note that given an extended behavior, we can check whether it is compatible with and in time polynomial in and . Let be the set of extended behaviors w.r.t. the vertices of that are compatible with , and . For each , recall that every entry of is bounded by . Thus the cardinality of is bounded by which is doubly exponential in the length of .
Computing a semilinear representation of the spectrum of a sentence.
We are now ready to show that the -type spectrum of a sentence in normal form is semilinear. For every finite model of , by Lemma 27, for sufficiently large , for every -core of and pair of 1-types and in , and are silent-compatible w.r.t. . Furthermore by Lemma 32, has an -core whose size is exponential in and . We prove Theorem 37 via a two-step construction. First we show that for every such core , there exists an existential Presburger formula such that the solution set of corresponds to the set of 1-type cardinality vectors of finite models of with -core .
-
The variables are for , and for and . Intuitively, is the 1-type spectrum of the finite model and is the number of vertices in with 1-type and extended behavior .
-
The formula asserts that the 1-type spectrum of is the sum of the 1-type spectrum of and the -type spectrum of . Let be the number of vertices in with 1-type .
.
-
The formula guarantees that the vertices in satisfies the Counting condition of Proposition 28. Let be the vertices in .
.
-
The formula assert that 1-types realized in are silent compatible.
.
-
The formula guarantees that 1-types and tuples realized in satisfy the requirements of a core.
-
The formula encodes the edge matching condition for audible 2-types and vertices in .
.
-
The formula encodes the edge matching condition for backward-silent but not forward-silent 2-types and vertices in .
.
Keep in mind that we will always be considering solutions in the natural numbers. So this implication could be rewritten without summation: if for one of the extended behaviors for this triple, , then one of the numbers .
Finally, .
This system characterizes the spectrum:
Lemma 36.
For every sentence and partial model of , a vector is a solution of if and only if there exists a finite model of such that the 1-type cardinality vector of is , and is a -core of .
It is easy to see that vectors in the spectrum satisfy the equations. In the other direction, we extend the core to a finite model of . Solutions to the equations tell us how many vertices of each -type and extended behavior to create in . We assign edge colors so that each vertex realizes its intended extended behavior. This is always possible because the solution is sufficiently large, as ensured by the Big condition in the equation. This extra size gives us some leeway to match up -types via -types. Details are in the appendix.
Let be the collection of partial models of with size at most . We define the existential Presburger formula
Lemma 37.
For every sentence , .
Proof.
Suppose that , there exists such that . By Lemma 36, there exists a model of such that the 1-type cardinality vector of is . Thus . On the other hand, suppose that . Then there is a model of with 1-type cardinality vector . By Lemma 32, has a -core with size at most , which implies that . By Lemma 36, . Since , .
Note that the length of the formula is doubly exponential in the length of , since the length of is already doubly exponential in the length of , as the number of variables is doubly exponential. Moreover, there are doubly exponentially many possible cores .
Consequences for finite satisfiability of with global constraints.
Note that in Lemma 37, we show that for every sentence in normal form, there exists an existential Presburger formula of doubly exponential size such that . Since for every 1-type and partial model of , we can compute in doubly exponential time in the length of and by a straightforward enumerate-and-check procedure, can be computed from in doubly exponential time. Note that global constraints of sentences are linear constraints over the -type cardinality vector. Therefore the finite satisfiability problem of with global constraints reduces to satisfiability problem of together with those linear constraints. This naive approach yields a algorithm.
We observe that can be rewritten as disjunctions of doubly exponentially many integer linear systems. Each system contains doubly exponentially many variables, but only exponentially many constraints. By Lemma 1, if such a system has a solution, then there exists a solution in which only exponentially many variables are assigned non-zero values.
Therefore, we can decide the finite satisfiability of with global constraints using the procedure in Algorithm 1.
We emphasize again that the argument here is completely generic, and the same comment holds to show that for any decidability extension of Presburger arithmetic (e.g. Büchi Arithemetic or Semenov Arithmetic [19]), with global cardinality constraints of that form is decidable, with the complexity the maximum of and the complexity of solving the corresponding constraints.
6 Negative results about the spectrum of sentences
The -type spectrum of a sentence is semilinear, and we showed how to calculate it in the previous section. For , earlier in the paper we were able to characterize models by a linear system: but the solutions to this linear system are not in one-to-one correspondence with the number of satisfiers of -types. Thus a natural question is whether the -type spectrum of a sentence is semilinear. We answer this below in the negative.
Consider the following formula over vocabulary :
Let be a finite model of . A vertex in is labeled with either or . Let be the set of vertices in with label . For every , the number of edges from to is the same as the number of edges from to . For every vertex , there exists exactly one edge from to . Therefore the cardinality of is the same as the number of edges between vertices of , which is bounded by . Thus the 1-type spectrum of is . Hence we have the following negative result.
Theorem 38.
The 1-type spectrum of a sentence is not always semilinear.
This does not resolve whether the set of cardinalities of finite models is a semilinear set, and it leaves open whether with global cardinality constraints is decidable.
7 Related work
The logic was shown decidable in [4, 12], while the decidability of with cardinality constraints is implicit in [11, 5]. Our complexity bound for refines the analysis of the Kleene star operator in [6], which in turn relies on [8]. Our analysis of with constraints obviously relies heavily on the techniques developed by Pratt-Hartmann for analysis of , in particular normal forms, the categorization of types, and the distinction between large and small number of realizers (e.g. the notion of Z-differentiated [15, 16]).
Although we borrow techniques from prior work, our approach gives a self-contained proof of decidability for itself, and also for with global constraints in extensions of Presburger arithmetic. An alternative approach to get bounds for with Presburger global constraints is by reducing to decidability of . This approach was presented by Rudolph in [18], relying on ideas from [1]. Although technically speaking the results in [18] are presented for description logics, they could easily be applied to give the same bounds for .
In addition to contributing tight bounds for complexity for decidability of a well as the size of the spectrum for , we note that [6] is phrased in terms of graph neural networks, while from the analysis of spectra in [11, 5] it would be difficult to see how semilinear representations are derived. Thus we believe our work additionally makes the analyses of logics with arithmetic substantially more accessible.
8 Conclusion
In the paper we isolate the complexity of satisfiability for two logics combining relational structure and arithmetic, and the logics and extended with cardinality constraints. In the process we refine and simplify proof techniques for analyzing such logics. and are incomparable in expressiveness. The former allows inductively forming open formulas that involve arithmetic between counts of neighbors, while in the latter arithmetic can only be used at top-level for forming sentences. On the other hand, allows unguarded formulas. See the appendix for a formal argument. We leave open the question of the decidability of combinations of formulas in the two languages.
References
- [1] Franz Baader. Expressive cardinality restrictions on concepts in a description logic with expressive number restrictions. SIGAPP Appl. Comput. Rev., 19(3), 2019.
- [2] Bartosz Bednarczyk. One-variable logic meets presburger arithmetic. Theoretical Computer Science, 802:141–146, 2020. doi:10.1016/J.TCS.2019.09.028.
- [3] Bartosz Bednarczyk and Oskar Fiuk. Presburger büchi tree automata with applications to logics with expressive counting. In Logic, Language, Information, and Computation, pages 295–308, Cham, 2022. Springer International Publishing. doi:10.1007/978-3-031-15298-6_19.
- [4] Bartosz Bednarczyk, Maja Orlowska, Anna Pacanowska, and Tony Tan. On classical decidable logics extended with percentage quantifiers and arithmetics. In FSTTCS, 2021.
- [5] Michael Benedikt, Egor Kostylev, and Tony Tan. Two Variable Logic with Ultimately Periodic Counting. SIAM Journal on Computing, 53(4):884–968, 2024. doi:10.1137/22M1504792.
- [6] Michael Benedikt, Chia-Hsuan Liu, Boris Motik, and Tony Tan. Verification of graph neural networks via logical characterizations. In ICALP, 2024.
- [7] Friedrich Eisenbrand and Gennady Shmonin. Carathéodory bounds for integer cones. Oper. Res. Lett., 34(5):564–568, 2006. doi:10.1016/J.ORL.2005.09.008.
- [8] Christoph Haase and Georg Zetzsche. Presburger arithmetic with stars, rational subsets of graph groups, and nested zero tests. In LICS, 2019.
- [9] Narendra Karmarkar. A new polynomial-time algorithm for linear programming. In STOC, 1984.
- [10] Yevgeny Kazakov. A polynomial translation from the two-variable guarded fragment with number restrictions to the guarded fragment. In JELIA, 2004.
- [11] Eryk Kopczynski and Tony Tan. Regular graphs and the spectra of two-variable logic with counting. SIAM J. Comput., 44(3):786–818, 2015. doi:10.1137/130943625.
- [12] Chia-Hsuan Lu and Tony Tan. On two-variable guarded fragment logic with expressive local Presburger constraints. Logical Methods in Computer Science, 20, 2024. doi:10.46298/LMCS-20(3:16)2024.
- [13] Christos H. Papadimitriou. On the complexity of integer programming. J. ACM, 28(4):765–768, 1981. doi:10.1145/322276.322287.
- [14] Rohit Parikh. On Context-Free Languages. JACM, 13(4):570–581, 1966. doi:10.1145/321356.321364.
- [15] Ian Pratt-Hartmann. Complexity of the two-variable fragment with counting quantifiers. Journal of Logic Language and Information, 14:369–395, 2005. doi:10.1007/S10849-005-5791-1.
- [16] Ian Pratt-Hartmann. Complexity of the guarded two-variable fragment with counting quantifiers. Journal of Logic and Computation, 17(1):133–155, 2007. doi:10.1093/LOGCOM/EXL034.
- [17] Ian Pratt-Hartmann. The two-variable fragment with counting. In WoLLIC, 2010.
- [18] "Johann" Sebastian Rudolph. Presburger concept cardinality constraints in very expressive description logics - allegro sexagenarioso ma non ritardando. In Description Logic, Theory Combination, and All That - Essays Dedicated to Franz Baader on the Occasion of His 60th Birthday, 2019. doi:10.1007/978-3-030-22102-7_25.
- [19] Aleksei L. Semenov. Logical theories of one-place functions on the set of natural numbers. Math. USSR Izv., 22(3):587–618, 1984.
- [20] Boris Trakhtenbrot. The Impossibility of an Algorithm for the Decidability Problem on Finite Classes. Proceedings of the USSR Academy of Sciences, 70(4):569–572, 1950.
