ON TWO-VARIABLE GUARDED FRAGMENT LOGIC WITH EXPRESSIVE LOCAL PRESBURGER CONSTRAINTS

. We consider the extension of the two-variable guarded fragment logic with local Presburger quantiﬁers. These are quantiﬁers that can express properties such as “the number of incoming blue edges plus twice the number of outgoing red edges is at most three times the number of incoming green edges” and captures various description logics with counting, but without constant symbols. We show that the satisﬁability problem for this logic is EXP -complete. While the lower bound already holds for the standard two-variable guarded fragment logic, the upper bound is established by a novel, yet simple deterministic graph-based algorithm.


Introduction
In this paper we consider the extension of two-variable guarded fragment logic with the so called local Presburger quantifiers, which we denote by GP 2 .These are quantifiers that can express local numerical properties such as "the number of outgoing red edges plus twice the number of incoming green edges is at most three times the number of outgoing blue edges."It was first considered in [BOPT21] and captures various description logics up to ALCIHb self [BHLS17, BCM + 03, Grä98].Recently Bednarczyk, et.al. [BOPT21] showed that both satisfiability and finite satisfiability are in 3-NEXP by reduction to the two-variable logic with counting quantifiers.
We show that the satisfiability of this logic is EXP-complete.The lower bound is already known for the standard two-variable guarded-fragment logic [Grä99].The contribution is the upper bound, which is established by a novel, yet simple deterministic exponential time algorithm.Intuitively, the algorithm starts by representing the input sentence as a graph whose vertices and edges represent the allowed types.It then successively eliminates the vertex/edge that contradicts the input sentence until there is no more vertex/edge to eliminate.The flavor is quite similar to the notion of type-elimination, first introduced by Pratt [Pra79].
On the other hand, our algorithm has a markedly different flavor from the standard tableaux method usually used to establish the upper bound of guarded fragment logics.Note that tableaux method usually works by exploiting the so called tree-like model property, where it tries to construct a tree-like model using polynomial space alternating Turing machine.To apply this, it is essential that there is only a polynomial bound on the number of branching from each node in the tree and it is not clear whether this bound still holds for GP 2 .In fact, already for GC 2 (two-variable guarded fragment with counting quantifiers), the exponential time upper bound is established by first reducing it to three-variable guarded fragment, before the tableaux method can be applied [Kaz04].It is not clear a priori how this technique can be extended to GP 2 .
Acknowledgement.Recently in [BF22] Bednarczyk and Fiuk independently obtained the same EXP upper bound for GP 2 .Their proof uses automata theoretic method and yields a rather involved alternating polynomial space algorithm.A brief comparison between their algorithm and ours is presented in Sect.3.6.
Other related work.The guarded fragment is one of the most prominent decidable fragments of first-order logic [ANvB98].The satisfiability is 2-EXP-complete and drops to EXP-complete when the number of variables or the arity of the signature is fixed [Grä99].Various DL and ML (description and modal logics) are captured by the fragment when the arity is fixed to two [Grä98, BCM + 03, BHLS17].The key reason for the decidability of the guarded fragment is the tree-like model property which allows the application of the tableaux method [Var96].
Recently, a deterministic exponential time algorithm for the two-variable guardedfragment was proposed in [LLT21].The algorithm there is also a graph-based algorithm, which also has a similar flavor to type-elimination algorithm, but, it is not clear, a priori, how their algorithm can be extended to GP 2 .
Pratt-Hartmann [Pra07] proposed an elegant reduction of GC 2 formulas to (exponential size) "homogeneous" instances of Integer Linear Programming (ILP) which are of the form Ax = 0 ∧ B x c, where A and B are matrices with integer entries, x is a (column) vector of variables and c is a vector of integers.Note that to check whether Ax = 0 ∧ B x c admits a solution in N, it is sufficient to check whether it admits a solution in Q, which is known to be in PTIME.This implies the EXP upper bound for both satisfiability and finite satisfiability of GC 2 .
In general, GP 2 captures various description logics with counting such as ALCIHQ and ALCIHb self , but without constant symbol [BCM + 03].Note that adding constant symbols to even GC 2 makes the complexity of satisfiability jumps to NEXP-complete [Tob01].
Some logics that allow similar quantifiers as the local Presburger quantifiers were proposed and studied various researchers [Baa17, BBR20, DL10, KP10].The decidability result is obtained by the tableaux method, but their logics do not allow the inverses of binary relations.
The extension of one-variable logic with quantifiers of the form ∃ S x φ(x), where S is a ultimately periodic set, is NP-complete [Bed20].Semantically ∃ S x φ(x) means the number of x where φ(x) holds is in the set S. The extension of two-variable logic with such quantifiers is later shown to be 2-NEXP [BKT20] whose proof makes heavy use of the biregular graph method introduced in [KT15] to analyze the spectrum of two-variable logic with counting quantifiers.The proofs and results in [BKT20,KT15] do not apply in our setting since the logics they considered already subsume full two-variable logic.
Organization.This paper is organized as follows.In Section 2 we present the formal definition of GP 2 .The main result is presented in Section 3. We conclude with Section 4.

Two-variable guarded fragment with local Presburger constraints
(GP 2 ) Let N denote the set of natural numbers {0, 1, 2, . ..}.We fix a vocabulary Σ consisting of only unary and binary predicates and there is no constant symbol.We will consider the logic with the equality predicate.As usual, for a vector x of variables, we write ϕ(x) to denote that the free variables in the formula ϕ are exactly those in x.
Let A be a structure and let a be an element in A. For a formula ϕ(x, y), we denote by |ϕ(x, y)| x/a A the number of element b such that A, x/a, y/b |= ϕ(x, y).
Local Presburger (LP) quantifiers.These are quantifiers of the form: where λ i , δ are integers; r i is either R(x, y) or R(y, x) for some binary relation R; ϕ i (x, y) is a formula with free variables x and y; and ⊛ is one of =, =, , , <, >, ≡ d or ≡ d , where d ∈ N.Here ≡ d denotes the congruence modulo d.Note that P(x) has one free variable x.
The semantics is defined as A, x/a |= P(x), if the (in)equality ⊛ holds when each # r i y [ϕ i (x, y)] is substituted with |r i (x, y) ∧ ϕ i (x, y)| x/a A and each |r i (x, y) ∧ ϕ i (x, y)| x/a A is finite.
The quantifier P(x) is in basic form, if it is of the form: That is, each ϕ i (x, y) is simply the inequality x = y.In other words, an LP quantifier in basic form is a linear constraint on the number of its outgoing R i -edges.Note that for A, x/a |= P(x), we insist that each |r i (x, y) ∧ ϕ i (x, y)| x/a A is finite.The purpose is only to avoid clutter.Obviously, we can easily modify it to allow for the case when A is ∞ and this will be discussed in Sect.3.5.
The guarded fragment class.The class GF of guarded fragment logic is the smallest set of first-order formulas such that the following holds.1 • GF contains all atomic formulas R(x) and equalities between variables.
• GF is closed under boolean combinations.
• If ϕ(x) is in GF, R(z) is an atomic predicate and x, ȳ ⊆ z, then both ∃ȳ R(z) ∧ ϕ(x) and ∀ȳ R(z) → ϕ(x) are also in GF.We define the class GP to be the extension of GF with LP quantifiers, i.e., by adding the following rule.
• An LP quantifier P(x) We denote by GP 2 the restriction of GP to formulas using only two variables: x and y.
We denote by SAT(GP 2 ) the problem that on input GP 2 formula ϕ, decide if it is satisfiable.The following lemma states that it suffices to consider only GP 2 formulas in a normal form.
Lemma 2.1.There is a linear time algorithm that converts a GP 2 formula into the following equisatisfiable normal form (over an extended signature): where • each α i (x, y) is a quantifier free formula of the form: where R(x, y) is an atomic predicate and β(x, y) is quantifier free formula, • each q i (x) is an atomic predicate, • each P i (x) is an LP quantifier in basic form.
Intuitively, we rename each subformula of one free variable with a fresh unary predicate.The renaming is done bottom-up starting from the subformula with the lowest quantifier rank.The detail is as follows.We consider the following three cases.
• Case 1: A subformula in the form of an LP quantifier: where each ϕ i (x, y) is quantifier free.• Case 2: A subformula with one free variable x of the form: where ϕ(x, y) is quantifier free.• Case 3: A subformula with one free variable x of the form: where ϕ(x, y) is quantifier-free, All the other cases can be handled symmetrically.We start with Case 1.Let P(x) be an LP quantifier in form of (2.2).We will first convert it to the basic form.For each 1 i n, we introduce a new binary predicate symbol R i (x, y) and rewrite P(x) into P ′ (x) as follows.
We also add the following conjunct.
Obviously, P ′ (x) is in basic form.We then replace P ′ (x) with a fresh unary predicate symbol q(x) and add the following conjunct.
Next, we consider Case 2, i.e., a subformula ψ(x) in the form of (2.3).First, we replace ψ(x) with a fresh unary predicate symbol q(x) and add the following conjunct.∀x q(x) → ∀y r(x, y) → ϕ(x, y) Note that this conjunct can be rewritten into: which in turn can be rewritten into: Finally, we consider Case 3, i.e., a subformula ψ(x) in the form of (2.4).In this case ψ(x) can be first rewritten into the form: ¬∀y r(x, y) → ¬ϕ(x, y), after which we can proceed as in Case 2.
We perform such renaming procedure repeatedly until we obtain a GP 2 sentence in normal form (2.1).This completes the proof of Lemma 2.1.
Remark 2.2.We stress that if the sentence Ψ in normal form (2.1) is satisfiable, then it is satisfied in an infinite model.Indeed, let A be a model of Ψ.We make an infinitely many copies of A, denoted by A 1 , A 2 , . .., and disjoint union them all to obtain a new model B.
For every pair (a, b), where a and b do not come from the same A i , we set (a, b) not to be in any binary relation R B .It is routine to verify that B still satisfies Ψ.
On the other hand, there is a GP 2 sentence that is satisfied only by infinite models.Consider the following sentence with one unary predicate U and one binary predicate R.
Intuitively, Φ states that every element must belong to the unary predicate U and that every element has exactly two outgoing R-edges and at most one incoming R-edge.It is routine to verify that an infinite binary tree (whose vertices are all in U ) satisfies Φ and that every model of Φ must be infinite.

The satisfiability of GP 2
We introduce some terminology in Section 3.1.Then, we show how to represent GP 2 formulas as graphs in Section 3.2.The algorithm is presented in Section 3.3.Throughout this section we fix a sentence Ψ in the normal form (2.1) over the signature Σ.We assume that the signature Σ is finite.
3.1.Terminology.A unary type (over Σ) is a maximally consistent set of unary predicates from Σ or their negations, where each atom uses only the variable x.Similarly, a binary type is a maximally consistent set of binary predicates from Σ or their negations containing the atom x = y, where each atom or its negation uses two variables x and y. 2 We denote by η(x, y) the "reverse" of η(x, y), i.e., the binary type obtained by swapping the variables x and y.The binary type that contains only the negations of atomic predicates from Σ is called the null type, denoted by η null .Otherwise, it is called a non-null type.
Note that both unary and binary types can be viewed as quantifier-free formulae that are the conjunction of their elements.We will use the symbols π and η (possibly indexed) to denote unary and binary type, respectively.When viewed as formula, we write π(x) and η(x, y), respectively.We write π(y) to denote formula π(x) with x being substituted with y.Let Π denote the set of all unary types over Σ and let K be the set of all non-null binary types over Σ.
For a structure A (over Σ), the type of an element a ∈ A is the unique unary type π that a satisfies in A. Similarly, the type of a pair (a, b) ∈ A × A, where a = b, is the unique binary type that (a, b) satisfies in A. The configuration of a pair (a, b) is the tuple (π, η, π ′ ) where π and π ′ are the types of a and b, respectively, and η is the type of (a, b).In this case we will also call (a, b) an η-edge in A. If η is non-null, then we say that b is a neighbour of a.The set of all neighbours of a is called the neighbourhood of a.
We say that a unary type π is realized in A, if there is an element whose type is π.
The graph representation.In this paper the term graph means finite edge-labelled directed graph G = (V, E), where V ⊆ Π and E ⊆ Π × K × Π.We can think of an edge (π, η, π ′ ) as an edge with label η that goes from vertex π to vertex π ′ .We write N G (π) to denote the set {(η, π ′ )|(π, η, π ′ ) ∈ E}, i.e., the set of all the edges going out from π.A graph Next, we show how the sentence Ψ can be represented as a graph.Recall that Ψ is a GP 2 sentence in the normal form (2.1).We need the following two definitions.Definition 3.2.A unary type π is compatible with Ψ, if π(x) |= γ(x).
2 In the standard definition of 2-type, such as in [GKV97,Pra05], a 2-type contains unary predicates or its negation involving variable x or y.For our purpose, we define a binary type as consisting of only binary predicates that strictly use both variables x and y.We view r(x, x) as a unary predicate.
Note that the sentence Ψ defines a directed graph G Ψ , where the vertices are the unary types that are compatible with Ψ and the edges are (π, η, π ′ ), for every (π, η, π ′ ) compatible with Ψ.Moreover, the graph G Ψ is "symmetric" in the sense that (π, η, π ′ ) is an edge if and only if (π ′ , η, π) is an edge.
Intuitively, the vertices and the edges in the graph G Ψ are the unary/binary types and configurations that do not violate the conjunct ∀x γ(x) and ∀x∀y α i (x, y).If there is a model A |= Ψ, then it is necessary that A conforms to the graph G Ψ .In the next section, we will show how to analyse the graph G Ψ to infer whether the conjunct ℓ i=1 ∀x q i (x) → P i (x) can also be satisfied.

3.2.
The characterization for the satisfiability of Ψ. Recall that Ψ is a sentence in normal form (2.1).For each 1 i ℓ, let the LP quantifier P i (x) be: For a graph G, a vertex π in G and 1 i ℓ, we define the linear constraint Q G,π i : The variables in Q G,π i are z η ′ ,π ′ , for every (η ′ , π ′ ) ∈ K × Π. Intuitively, each z η ′ ,π ′ represents the number of η ′ -edges that goes out from an element with type π to another element with type π ′ .Note that every element/pair of elements has a unique unary/binary types.Thus, we can partition the neighbourhood of each element according to the unary and binary types.This is the reason each # R i,j (x,y) y [x = y] is replaced with the sum: We formalize this intuition as Lemma 3.4.Lemma 3.4.Let G be a graph and A be a structure that conforms to G. Suppose there is an element a in A whose type is π and that A, x/a |= P i (x).Then, Q G,π i admits a solution in N.
Proof.Let G, A, a and π be as in the hypothesis of the lemma.For every (η ′ , π ′ ) ∈ N G (π), let K η ′ ,π ′ be the number of elements c such that the configuration of (a, c) is (π, η ′ , π ′ ).Formally: Note that for every neighbour b of a, there is exactly one (η ′ , π ′ ) ∈ N G (π) where b ∈ K η ′ ,π ′ , i.e. the sets K η ′ ,π ′ 's partitions the neighbourhood of a. Since A, x/a |= P i (x), it is clear that z η ′ ,π ′ = K η ′ ,π is a solution to the constraint Q G,π i .Next, we define a system of linear constraints that captures whether a certain configuration can be realized.Definition 3.5.For an edge (π 1 , η, π 2 ) in a graph G, let Z G π 1 ,η,π 2 be the following system of linear constraints: i , the variables in this system are z η ′ ,π ′ , for every (η ′ , π ′ ) ∈ K × Π.The intuitive meaning of the system Z G π 1 ,η,π 2 is as follows.If it does not admit a solution in N, then the configuration (π 1 , η, π 2 ) is not realized in any model of Ψ.This is because either z η,π 2 must be zero, or one of Q G,π 1 i is violated for some i where q i (x) ∈ π 1 .Its formalization is stated as Lemma 3.6.Lemma 3.6.Let G be a graph and A be a structure that conforms to G. Suppose there is a pair (a, b) in A whose configuration is (π 1 , η, π 2 ) and that A, x/a |= ℓ i=1 (q i (x) → P i (x)).Then, the system Z G π 1 ,η,π 2 has a solution in N. Proof.The proof is similar to Lemma 3.4.Let G, A, a, b and (π 1 , η, π 2 ) be as in the hypothesis.For every (η ′ , π ′ ) ∈ K × Π, let K η ′ ,π ′ denote the number of elements c such that the configuration of (a, c) is (π 1 , η ′ , π ′ ).Since the configuration of (a, b) is (π 1 , η, π 2 ), we have K η,π 2 1.Since A, x/a |= ℓ i=1 q i (x) → P i (x), the assignment z η ′ ,π ′ = K η ′ ,π ′ is a solution to the system Z G π 1 ,η,π 2 .To infer the satisfiability of Ψ from the graph G Ψ , we will need a few more terminology.Definition 3.7.An edge (π 1 , η, π 2 ) is a bad edge in a graph G (w.r.t. the sentence Ψ), if the system Z G π 1 ,η,π 2 does not admit a solution in N. Note that by Lemma 3.6, if (π 1 , η, π 2 ) is a bad edge in G, then there is no model A that conforms to G such that the configuration (π 1 , η, π 2 ) is realized in A and that A |= ∀x (q i (x) → P i (x)) for every 1 i ℓ.
Next, we present a similar notion for vertices in G.
Definition 3.8.A vertex π is a bad vertex in G (w.r.t. the sentence Ψ), if the following holds.

• It does not have any outgoing edge in G.
• There is 1 i ℓ such that π contains q i (x), but the constraint Q G,π i does not admit a zero solution, i.e., the solution where all the variables are assigned with zero.
The intuitive meaning of bad vertex is as follows.Suppose A is a structure that conforms to a graph G and that π has no outgoing edge in G.This means that for every element a with type π the value |R i,j (x, y) ∧ x = y| x/a A is zero.So, for every 1 i ℓ, if π contains q i (x) and if A, x/a |= P i (x), then the following must hold.
That π is a bad vertex means that δ i ⊛ i 0 does not hold for some 1 i ℓ, where π contains q i (x).
We are now ready for the final terminology which will be crucial when deciding the satisfiability of Ψ. Definition 3.9.Let G be a graph and H be a non-empty subgraph of G.We say that H is a good subgraph of G, if the following holds.
• There is no bad vertex and bad edge in H (w.r.t. the sentence Ψ).
• It is symmetric in the sense that (π, η, π ′ ) is an edge in H if and only if (π ′ , η, π) is an edge in H.
Theorem 3.10 states that the satisfiability of Ψ is equivalent to the existence of a good subgraph in G Ψ .
Theorem 3.10.Let Ψ be a GP 2 sentence in normal form (2.1).Then, Ψ is satisfiable if and only if there is a good subgraph in G Ψ .
Proof.(only if ) Let A |= Ψ.Let H be the graph where the vertices are the unary types realized in A and the edges are the configurations realized in A. Obviously, H is symmetric and a non-empty subgraph of G Ψ and that A conforms to H.It remains to show that there is no bad edge and bad vertex in H.
Let (π 1 , η, π 2 ) be an edge in H.By definition, there is a pair (a, b) in A whose configuration is (π 1 , η, π 2 ).Since A |= Ψ, we have A, x/a |= ℓ i=1 q i (x) → P i (x).By Lemma 3.6, the system Z H π 1 ,η,π 2 admits a solution in N, and hence, by definition, (π 1 , η, π 2 ) is not a bad edge in H. Now, we prove that H does not contain any bad vertex.Let π be a vertex in H without any outgoing edge.By definition, there is an element a in A whose type is π.Since A conforms to H, for every relation R i,j (x, y), we have: R i,j (x, y) ∧ x = y x/a A = 0 Since A, x/a |= q i (x) → P i (x), for every 1 i ℓ, if π contains q i (x), the constraint Q H,π i admits the zero solution.Hence, π is not a bad vertex in H.
(if ) Let H = (V, E) be a good subgraph of G Ψ .We will show how to construct a model A |= Ψ that conforms to H.For each type π ∈ V , we pick a set A π of infinitely many elements where for every different π, π ′ ∈ V , the sets A π and A π ′ are disjoint.
The domain of A is the set A = π∈V A π .We will define the interpretation of each relation symbol by setting the types of each element a ∈ A and each pair (a, b) ∈ A × A. For unary types, we set the type of each element in A π to be π itself.The type of every pair (a, b) ∈ A × A is defined such that the configuration of (a, b) is an edge in H, i.e., to ensure that A conforms to H. Note also that a binary type η uniquely determine its "reverse" η.So, when we define a binary type of (a, b), we also define the type of (b, a).
We first enumerate all the elements in A as a 1 , a 2 , . ... The assignment of the binary types is done by iterating the following process starting from j = 1 to j → ∞.Each index j is associated with an integer p j > j such that before the j th iteration starts, the following invariant is satisfied: (a) The binary types of pairs in {a 1 , . . ., a j−1 } × {a j , . . ., a p j } are already defined.(b) The binary types of pairs in {a 1 , . . ., a j−1 } × {a p j +1 , a p j +2 , . ..} are already defined to be the null type.
The binary types between elements of these two sets are already defined to be the null type The binary types between elements of these two sets are not yet defined The binary types between elements of these two sets are already defined and can be non-null type Figure 1: The relation between the sets {a 1 , . . ., a j−1 }, {a j , . . ., a p j } and {a p j +1 , a p j +2 , . ..} before the j th iteration starts.The finite sets T η ′ ,π ′ 's used to define the type of pairs involving a j are all subsets {a p j +1 , a p j +2 , . ..}.
(c) The binary types of pairs in {a j , . . ., a p j } × {a p j +1 , a p j +2 , . ..} are not defined yet.(d) For every a ∈ {a j , . . ., a p j }, there is at most one b ∈ {a 1 , . . ., a j−1 } such that the binary type of (a, b) is not the null type.(e) For every a ∈ {a 1 , . . ., a j−1 }, the following already holds.
Note that (e) makes sense since the binary type of every pair involving the elements in {a 1 , . . ., a j−1 } is already defined.Figure 1 illustrates the relation between the sets {a 1 , . . ., a j−1 }, {a j , . . ., a p j } and {a p j +1 , . ..}.
In the j th iteration, we set the binary types of each pair {a j } × {a j+1 , a j+2 , . ..}.First, we set the binary type of each pair in {a j } × {a j+1 , . . ., a p j } to be the null type.Next, we show how to set the binary type of the pairs in {a j } × {a p j +1 , a p j +2 , . ..}.Let π 1 be the type of a j , i.e., a j ∈ A π 1 .There are two cases.
Case 1: There is h < j such that the type (a j , a h ) is defined as a non-null type.By (d), there is at most one such h.Let η be the binary type of (a j , a h ) and π 2 be the type of a h .Since (π 1 , η, π 2 ) is an edge in H, it is a good edge, i.e., the system Z H π 1 ,η,π 2 admits a solution in N.For every η ′ , π ′ , let M η ′ ,π ′ be the solution for the variable z η ′ ,π ′ .We fix a set T η ′ ,π ′ ⊆ A π ′ ∩ {a p j +1 , a p j +2 , . ..} such that: We also require that the sets T η ′ ,π ′ 's to be pairwise disjoint, which is possible since each A π ′ is an infinite set.Note that since (π 1 , η, π 2 ) is a good edge, by definition, M η,π 2 1.Now, for every η ′ , π ′ ∈ K × Π, we set the type of every pair in {a j } × T η ′ ,π ′ to be η ′ .For every element c ∈ {a p j +1 , a p j +2 , . ..},where c is not in any of T η ′ ,π ′ , we set the type of (a j , c) to be the null type.Finally, we set p j+1 to be the maximal index of the elements in any of the sets T η ′ ,π ′ 's.
It is obvious that invariant (a)-(c) still holds after the j th iteration.Invariant (d) holds, since the sets T η ′ ,π ′ 's are pairwise disjoint.That invariant (e) holds, i.e., A, x/a j |= ℓ i=1 (q i (x) → P i (x)), follows from the fact that z η ′ ,π ′ = M η ′ ,π ′ is a solution for the system Z H π 1 ,η,π 2 .Case 2: For every h < j, the type (a j , a h ) is defined as the null type.
In this case, we pick an arbitrary edge (π 1 , η, π 2 ) in H. Since it is a good edge, we consider a solution z η ′ ,π ′ = M η ′ ,π ′ for the system Z π 1 ,η,π 2 .Then, for every η ′ , π ′ , we define the set T η ′ ,π ′ ⊆ A π ′ in similar manner as Case 1, except that |T η ′ ,π ′ | = M η ′ ,π ′ , for every η ′ , π ′ .Setting the binary types of the pairs involving the element a j is done exactly as in case 1.That the invariant (a)-(e) still holds also follows in a straightforward manner.This ends the construction for case 2.
Coming back to the proof of Theorem 3.10, as j → ∞, the binary type of every pair is well defined and due to invariant (e), we have A |= ℓ i=1 ∀x q i (x) → P i (x) .Since A conforms to H and H is a subgraph of G Ψ , it follows that A |= Ψ.This completes the proof of Theorem 3.10.
3.3.The algorithm.Theorem 3.10 tells us that to decide if Ψ is satisfiable, it suffices to find if G Ψ contains a good subgraph.It can be done as follows.First, construct the graph G Ψ .Then, repeatedly delete the bad edges and bad vertices from the graph G Ψ .It stops when there is no more bad edge/vertex to delete.If the graph ends up not containing any vertices, then Ψ is not satisfiable.If the graph still contains some vertices, then it is a good subgraph of G Ψ and Ψ is satisfiable.Its formal presentation can be found in Algorithm 3.11.It is worth noting that deleting a bad edge may yield a new bad edge, hence the while-loop.Algorithm 3.11.Input: A sentence Ψ in normal form (2.1).Output: Accept if and only if Ψ is satisfiable.
2: while G has a bad edge do 3: Delete the bad edge and its inverse from G.

4:
Delete all bad vertices (if there is any) from G. 5: ACCEPT if and only if G is not an empty graph.To proceed with the analysis, we first show that checking whether the system Z G π 1 ,η,π 2 admits a solution in N can be done in exponential time in the length of the input Ψ. Lemma 3.14.For every edge (π 1 , η, π 2 ) in G, checking whether the system Z G π 1 ,η,π 2 admits a solution in N takes exponential time (in the worst case) in the length of the input sentence.
Proof.Let Ψ be the input sentence in the normal form (2.1).Let n and m be the number of unary and binary relation symbols in Ψ.Thus, there are 2 n+m unary types and 2 2m binary types.(Recall that we consider atomic R(x, x) as a unary predicate.)Note that Z G π 1 ,η,π 2 contains at most ℓ + 1 constraints and 2 n+3m variables.Moreover, it can be rewritten in matrix form Ax = b where A has d = O(ℓ) rows and O(2 n+3m ) columns.Let M be the maximal absolute value of the entries in A and b.
By Theorem 3.12, to check if Ax = b has a solution in N, it suffices to search only for the solutions in which the number of non-zero entries is at most 2d log 2 (4dM ).Moreover, by Theorem 3.13, it suffices to search only for the solutions whose entries are bounded by t(dM ) 2d+1 .This gives us a (deterministic) exponential time upper bound (in the length of Ψ) for checking whether Z G π 1 ,η,π 2 admits a solution in N.
Finally, we show that Algorithm 3.11 runs in exponential time, which establishes that SAT(GP 2 ) is in the class EXP.
Theorem 3.15.Algorithm 3.11 runs in exponential time in the length of the input sentence.
Proof.Let Ψ be the input sentence in the normal form (2.1).Let n and m be the number of unary and binary relation symbols in Ψ.Thus, G Ψ has at most 2 2n+4m edges which bounds the the number of iterations of the while-loop in Algorithm 3.11.Checking whether an edge is a bad edge is equivalent to checking whether the system Z G π 1 ,η,π 2 admits a solution in N, which by Lemma 3.14, takes exponential time in the length of Ψ.Therefore, Algorithm 3.11 runs in exponential time in the length Ψ.
Note that Algorithm 3.11 can be easily implemented using available solvers for Presburger arithmetic as a black box.See, e.g., [ome23, pri22].The following straightforward corollary establishes an upper bound for the number of times such solvers being called by Algorithm 3.11.Corollary 3.16.Algorithm 3.11 can be implemented using a quantifier-free Presburger arithmetic solver as a black box and the number of calls to such solver is bounded by 2 4n+8m , where n and m is the number of unary and binary predicates appearing in the input sentence.
Proof.In each iteration we check whether each edge is a bad edge.Since the graph G Ψ has at most 2 2n+4m edges, there is at most 2 2n+4m number of calls to the Presburger arithmetic solver.After each iteration there is at most one less edge.Therefore, the 2 4n+8m upper bound follows immediately.For such semantics to make sense, we need to insist that the LP quantifiers are of the form: where the coefficients δ, λ i , κ i are all positive integers or ∞.
Note that a set of LP quantifiers of this form can be rewritten into a system of linear equations of the form: Ax = b + A ′ x′ , where each entry in A, A ′ and b comes from N ∪ {∞}.Checking whether it is satisfiable in N ∪ {∞} can easily be reduced to the case in N. Indeed, we can first guess which variables take the value ∞ and check which row must evaluate to ∞.Then, we can check whether the other rows can be satisfied in the standard N.It is routine to verify that such procedure takes exponential time in the length of A, A ′ and b.By Corollary 3.16, SAT(GP 2 ) is in EXP when the semantics is defined over N ∪ {∞}.
3.6.Comparison with the approach in [BF22].An alternating polynomial space algorithm was proposed in [BF22] for deciding the satisfiability of GP 2 sentences. 3ntuitively, it tries to build a tree-like model that satisfies the input sentence (if satisfiable).It starts by guessing the unary type of of the root node and all the unary types of its children as well as the binary types of the edges connecting them.Using Theorems 3.12 and 3.13, the number of different unary types of the children is polynomially bounded (in the length of the input sentence). 4It verifies that the LP quantifiers are satisfied by guessing a solution that respects the guessed binary types of the edges connecting the root nodes and the children.The amount of guessing makes it not trivial to use available Presburger solvers as a black box, compared with our straightforward Algorithm 3.11.

Concluding remarks
In this paper we consider the extension of GF 2 with the local Presburger quantifiers which can express rich Presburger constraints while maintaining deterministic exponential time upper bound.It captures various natural DL with counting up to ALCIHb self and ALCIHQ without constant symbols.The proof is via a novel, yet simple and optimal algorithm, which is a reminiscent of type-elimination approach.
We note that the proof of Theorem 3.10 relies on the infinity of the model.We leave a similar characterization for the finite models for future work.It is worth noting that the finite satisfiability of GP 2 has been shown to be decidable in 3-NEXP [BOPT21], though the precise complexity is still not known.

3. 4 .
The complexity analysis of Algorithm 3.11.To prove Algorithm 3.11 runs in exponential time in the worst case scenario, we will need the following two results from[ES06,Pap81].Theorem 3.12.[ES06, Theorem 1] Let A be an integer matrix with size d × t and let b be an integer column vector with size d.If the linear system Ax = b has a solution in N, then it has a solution in N in which the number of non-zero entries is bounded by 2d log 2 (4dM ) where M is the maximal absolute value of the entries in A and b.Theorem 3.13.[Pap81, Theorem] Let A be an integer matrix with size d × t and let b be an integer column vector with size d.If the linear system Ax = b has a solution in N, then it has a solution in N in which every entry is bounded by t(dM ) 2d+1 where M is the maximal absolute value of the entries in A and b.

3. 5 .
Local Presburger quantifiers with ∞ semantics.In Section 2 we define the the semantics of LP quantifiers in the structure N. One can easily extend it to the structure N ∪ {∞} in which the operations involving ∞ are defined as follows.•∞ + ∞ = ∞ + a = a + ∞ = ∞, for every a ∈ N. • a ∞,for every a ∈ N. • For every a, b ∈ N ∪ {∞}, for every d ∈ N, a ≡ d b if and only if there is c ∈ Z such that a = b + cd.In particular, ∞ ≡ d ∞, but ∞ ≡ d a, for every a ∈ N.