Hanf normal form for first-order logic with unary counting quantifiers

Size: px
Start display at page:

Download "Hanf normal form for first-order logic with unary counting quantifiers"

Transcription

1 Hanf normal form for first-order logic with unary counting quantifiers Lucas Heimberg Humboldt-Universität zu Berlin Dietrich Kuske Technische Universität Ilmenau Nicole Schweikardt Humboldt-Universität zu Berlin Abstract We study the existence of Hanf normal forms for extensions FO(Q of first-order logic by sets Q P(N of unary counting quantifiers. A formula is in Hanf normal form if it is a Boolean combination of formulas ζ(x describing the isomorphism type of a local neighbourhood around its free variables x and statements of the form the number of witnesses y of ψ(y belongs to (Q+k where Q Q, k N, and ψ describes the isomorphism type of a local neighbourhood around its unique free variable y. We show that a formula from FO(Q can be transformed into a formula in Hanf normal form that is equivalent on all structures of degree d if, and only if, all counting quantifiers occurring in the formula are ultimately periodic. This transformation can be carried out in worst-case optimal 3-fold exponential time. In particular, this yields an algorithmic version of Nurmonen s extension of Hanf s theorem for first-order logic with modulocounting quantifiers. As an immediate consequence, we obtain that on finite structures of degree d, model checking of first-order logic with modulo-counting quantifiers is fixed-parameter tractable. Categories and Subject Descriptors F.4.1 [Mathematical Logic and Formal Languages]: Mathematical Logic Computational Logic, Model Theory General Terms Theory, Algorithms Keywords Extensions of first-order logic, Hanf locality, modulocounting quantifiers, unary counting quantifiers, ultimately periodic sets, structures of bounded degree, normal forms, model checking, elementary algorithms 1. Introduction Two elements of a given graph are indistinguishable by first-order formulas whenever some automorphism maps the first to the second. More generally, if the two elements have isomorphic neighbourhoods of radius 4 q, then they cannot be distinguished by first-order formulas of quantifier depth q. This and similar phenomena are summarized under the slogan first-order logic can only express local properties and formalized by the theorems by Hanf, by Gaifman, and by Schwentick and Barthelmann [5, 8, 9, 19]. All these results give rise to normal forms for first-order formulas. Hanf s and Gaifman s theorem have found various applications in algorithms and Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, to republish, to post on servers, or to redistribute to lists, contact the Owner/Author(s. Request permissions from permissions@acm.org or Publications Dept., ACM, Inc., fax +1 ( LICS 16, July 05-08, 2016, New York, NY, USA Copyright c 2016 held by owner/author(s. Publication rights licensed to ACM. ACM /16/07... $15.00 DOI: complexity (cf., e.g., [12, 13]. In particular, there are very general algorithmic meta-theorems stating that first-order model checking is fixed-parameter tractable for various classes of structures [7, 20], and that the results of first-order queries against various classes of databases can be enumerated with constant delay after a linear-time preprocessing phase [3, 11, 21]. In the context of such algorithms, questions about the efficiency of the normal forms have recently attracted interest (cf. e.g., [1, 2, 14]. Notions of locality have also been developed for extensions of first-order logic, and they have found application in proving inexpressibility results for these logics (cf., e.g., [10, 13, 18]. When restricting attention to classes of finite structures of bounded degree, these locality notions also give rise to normal forms for the respective logics. Let us focus on the particular case of Hanflocality: Hanf s locality theorem for first-order logic implies that for every first-order sentence ϕ over a finite relational signature σ, and for every degree bound d N, there exists a first-order sentence ψ that is equivalent to ϕ on all finite σ-structures of degree d, such that ψ is a Boolean combination of statements of the form the number of elements x whose r-neighbourhood has isomorphism type τ is k. Such a formula ψ is said to be in Hanf normal form. A worst-case optimal algorithm for constructing ψ when given ϕ and d has been developed in [1]. In [18], Nurmonen extended Hanf s locality theorem to the extension of first-order logic by modulo-counting quantifiers D p (for positive integers p, where a formula of the form D p y ψ(x, y states that the number of witnesses y for ψ(x, y is divisible by p. As an easy consequence of Nurmonen s theorem, one obtains that for every sentence ϕ of first-order logic with modulo-counting quantifiers, and for every degree bound d N there exists a firstorder sentence with modulo-counting quantifiers ψ that is equivalent to ϕ on all finite structures of degree d, such that ψ is a Boolean combination of statements of the form the number of elements x whose r-neighbourhood has isomorphism type τ is congruent k modulo p and statements of the form the number of elements x whose r-neighbourhood has isomorphism type τ is k. Again, we say that ψ is in Hanf normal form. For algorithmic applications, an effective procedure for computing ψ when given ϕ and d, would be highly desirable (cf., e.g., the use of Nurmonen s theorem in the full version of [17]. The proof of [18], however, does not lead to such an effective procedure. The two main questions which started the research whose results are presented in this paper are (1 Is there an algorithmic version of Nurmonen s result? (2 For which classes of unary counting quantifiers does an analogue of Nurmonen s result hold? Answering question (2, our first main result provides a precise characterisation: A class Q of unary counting quantifiers permits

2 Hanf normal forms (analogous to the ones obtained from Nurmonen s result if, and only if, all counting quantifiers in Q are ultimately periodic. Answering question (1, our second main result provides an algorithm which, when given a degree bound d and a formula ϕ of the extension of first-order logic with ultimately periodic unary counting quantifiers, transforms ϕ into a corresponding Hanf normal form ψ which is equivalent to ϕ on all structures of degree d. This algorithm uses 3-fold exponential time and is worst-case optimal. As an easy application of our algorithm, we obtain that Seese s and Frick/Grohe s [7, 20] fixed-parameter tractability result for first-order model checking on structures of degree d can be generalised to first-order logic with ultimately periodic unary counting quantifiers. The rest of the paper is structured as follows. Section 2 fixes basic notations used throughout the paper. Section 3 gives precise statements of our two main results. Sections 4 and 5 are devoted to the proof of the only if -direction and the if -direction, respectively, of our characterisation of the sets of unary counting quantifiers that permit Hanf normal forms. Section 6 contains the runtime analysis of our algorithm for transforming a given formula into Hanf normal form. Section 7 shows how to use our algorithm to achieve fixed-parameter tractability of the model checking problem. Section 8 concludes the paper and points out directions for future work. 2. Preliminaries We write P(S to denote the power set of a set S. We write N for the set of non-negative integers, and we let N 1 := N \ {0}. For all m, n N with m n, we write [m, n] for the set {i N : m i n}, and we let [m, n := [m, n] \ {n}. For a real number r > 0, we write log(r to denote the logarithm of r with respect to base 2. We say that a function f from N to the set R 0 of non-negative reals is at most k-fold exponential, for some k N, if there exists a number c > 0 such that for all sufficiently large n N we have f(n T (k, n c, where T (0, m = m and T (k+1, m = 2 T (k,m for all k, m 0 (i.e., T (k, m is a tower of 2s of height k with an m on top. For a finite word w {0, 1}, we write w to denote the length of w. For an ω-word w = w 0w 1w 2 {0, 1} ω and a number n N, we write w[n] to denote the letter w n in w at position n. For numbers i, j N with i j, we write w[i, j] for the (finite word w iw i+1 w j. Similarly, we write w(i, j] for the (finite word w i+1 w j. In particular, w(i, i] is the empty word ɛ, and w(j 1, j] = w[j]. Structures and formulas. A signature σ is a finite set of relation symbols and constant symbols. Associated with every relation symbol R is a positive integer ar(r called the arity of R. The size σ of a signature σ is the number of its constant symbols plus the sum of the arities of its relation symbols. We call a signature relational if it only contains relation symbols. A σ-structure A consists of a finite non-empty set A called the universe of A, a relation R A A ar(r for each relation symbol R σ, and an element c A A for each constant symbol c σ. Note that according to this definition, all signatures and all structures considered in this paper are finite. To indicate that two σ-structures A and B are isomorphic, we write A = B. We use the standard notation concerning first-order logic and extensions thereof, cf. [4, 13]. By FO[σ] we denote the class of all first-order formulas of signature σ, and by FO we denote the union of all FO[σ] for arbitrary signatures σ. By free(ϕ we denote the set of all free variables of ϕ. A sentence is a formula ϕ with free(ϕ =. We write ϕ(x, for x = (x 1,..., x n with n 0, to indicate that free(ϕ {x 1,..., x n}. If A is a σ-structure and a = (a 1,..., a n A n, we write A = ϕ[a] to indicate that the formula ϕ(x is satisfied in A when interpreting the free occurrences of the variables x 1,..., x n with the elements a 1,..., a n. For a class C of σ-structures, two formulas ϕ(x and ψ(x of signature σ are called equivalent on C (for short: C-equivalent if for all σ-structures A C and for all a A n we have A = ϕ[a] A = ψ[a]. Unary counting quantifiers. All quantifiers considered in this article are unary counting quantifiers (for short: quantifiers, i.e., subsets of N. We will use the terms set (of natural numbers and quantifier interchangeably. For a quantifier Q N and a formula ϕ(x, y over a signature σ, the formula Qy ϕ(x, y is satisfied by a σ-structure A and an interpretation a of the variables x if {b A : A = ϕ[a, b]} Q. For a set Q P(N of quantifiers and a relational signature σ, we write FO(Q[σ] to denote the extension of FO[σ] with the quantifiers from Q. That is, FO(Q[σ] is built from atomic formulas of the form x 1=x 2 and R(x 1,..., x ar(r, for R σ and variables x 1, x 2,..., x ar(r, and closed under Boolean connectives,, existential first-order quantifiers x, and unary counting quantifiers Q x, for any Q Q and any variable x. 1 By FO(Q we denote the union of all FO(Q[σ] for arbitrary relational signatures σ. The quantifier rank qr(ϕ of an FO(Q-formula ϕ is defined as the maximal nesting depth of all quantifiers. Since we only consider finite structures, the classical quantifier and the unary counting quantifier N 1 are equivalent. Thus, to avoid unnecessary special cases in proofs, we will often tacitly assume that the existential quantifier = N 1 is contained in the sets Q considered. For a number k 0 we write (Q+ky ϕ(x, y as a short hand for a formula expressing in a σ-structure A and for an interpretation a of the variables x that the number of elements b A such that A = ϕ[a, b] belongs to the set (Q+k := {n+k : n Q}. Clearly, (Q+ky ϕ(x, y can be expressed by the formula ( y 1 y k y i=y j 1 i<j k y ( y=y i ϕ(x, y 1 i k Qy ( ϕ(x, y y=y i. 1 i k For every k 1, we will write k y ϕ and =k y ϕ for the formulas ( +(k 1y ϕ and k y ϕ k+1 y ϕ, respectively. The displacement of a formula ψ is the smallest K 0 such that for every subformula of ψ of shape (Q+ky ϕ with Q N and k 0 it holds that k K. It is the aim of this paper to study the locality of the logics FO(Q in the sense of Hanf s theorem [4, 5, 9]. To define the according locality notion for this logic, we need the concepts introduced in the remainder of this section. Gaifman graph. Let A be a σ-structure. Its Gaifman graph G A is the undirected graph with vertex set A and an edge between two distinct vertices a, b A iff there exists R σ and a tuple (a 1,..., a ar(r R A such that a, b {a 1,..., a ar(r }. 1 As usual, x,,, will be used as abbreviations when constructing formulas. (1

3 The distance dist A (a, b between two elements a, b A is the minimal length (i.e., the number of edges of a path from a to b in G A (if no such path exists, we set dist A (a, b =. For r 0 and a A, the r-neighbourhood of a in A is the set Nr A (a := {b A : dist A (a, b r}. For a tuple a = (a 1,..., a n A n, we write Nr A (a for the union of the sets Nr A (a i for all i [1, n]. Types and spheres. Let σ be a relational signature and let c 1, c 2,... be a sequence of pairwise distinct constant symbols. For every n 1 we write σ n for the signature σ {c 1,..., c n}. For every r 0 and n 1, a type with n centres and radius r (for short: r-type with n centres is a σ n-structure (A, a 1,..., a n, where A is a σ-structure, the constant symbols c 1,..., c n are interpreted by the elements a 1,..., a n A, and A = Nr A (a 1,..., a n. The elements a 1,..., a n are called the centres of the r-type. For a σ-structure A and a non-empty set B A, we write A[B] to denote the restriction of the structure A to the universe B A. For a tuple a = (a 1,..., a n A n, the r-sphere of a in A is defined as the r-type Nr A (a := (A[Nr A (a], a. Bounded structures. The degree of a σ-structure A is the degree of its Gaifman graph G A. If this degree is d, then we call A d-bounded. Two formulas ϕ(x and ψ(x of signature σ are called d-equivalent if they are C d -equivalent, where C d is the class of all d-bounded σ-structures. Note that for all d 2, r 0, and n 1, every d-bounded r-type τ with n centres contains at most n d r+1 elements. Thus, given τ, one can construct an FO[σ]-formula sph τ (x such that for every σ-structure A and every tuple a A n we have A = sph τ [a] N A r (a = τ. The formula sph τ (x has size (n d r+1 O( σ ; and sph τ (x is called a sphere-formula (over σ and x. Hanf normal form for first-order logic. An FO-sentence over a relational signature σ is said to be in Hanf normal form (cf. [1] if it is a Boolean combination 2 of so-called Hanf-sentences. A Hanfsentence is a sentence of the form k y sph τ (y, expressing that there exist at least k elements whose r-sphere is isomorphic to τ, for a given r-type τ. It is known that every first-order sentence is d-equivalent to a sentence in Hanf normal form [4] and that such a sentence in Hanf normal form can be computed in 3-fold exponential time [1]. The main result of the present paper is that both these results generalize to formulas from FO(Q if, and only if, all quantifiers in Q are ultimately periodic which motivates the last definitions of this section. Ultimately periodic sets. Let Q N be a unary counting quantifier. It is ultimately periodic (cf., e.g., [16] if there exist numbers p, n 0 N with p 1, such that for all n n 0 we have n Q n+p Q. (2 The minimal number p 1 for which there exists an n 0 such that statement (2 is true is called the period of Q, and n 0 is called an offset of Q. Examples of ultimately periodic sets are the existential quantifier := N 1 (with period 1 and offset 1 and the divisibility quantifier D p := { p m : m N } for every p N with p 2 (with period p and offset 0. The characteristic sequence χ Q of Q N is the ω-word w = w 0w 1 {0, 1} ω with Q = {n N : w n = 1}. 2 Throughout this paper, whenever we speak of Boolean combinations, we mean finite Boolean combinations. Fact 2.1. Let Q N. If Q is ultimately periodic with period p and offset n 0, then there exist finite words α {0, 1} and π {0, 1} + such that χ Q = α π ω, π = p, and α = n 0. If, conversely, χ Q = α π ω, then Q is ultimately periodic, its period divides π, and α is an offset. We can thus represent an ultimately periodic set Q by the finite word rep(q := α#π, where χ Q = α π ω. To make this definition unambiguous, we demand that p := π is the period of Q, and n 0 := α is the smallest offset of Q. The size Q of Q is defined as the length of rep(q. Let Q P(N be a set of ultimately periodic sets. The size ϕ of an FO(Q-formula ϕ of signature σ is its length when viewed as a word over the alphabet σ Var {, } {=,,,, (,, 0, 1, #}, where Var is a countable set of variable symbols, and where each quantifier Q Q is represented by the word rep(q. 3. Main results In the following, we denote by σ a relational signature. We generalise the notion of Hanf normal form to extensions of first-order logic by unary counting quantifiers in the following way. A Hanf-sentence (over σ is a sentence of the form (Q+ky sph τ (y, where Q N, k N, and τ is an r-type with 1 centre (of signature σ; its locality radius is r. The sentence expresses that the number of interpretations for y such that the r-sphere of y is isomorphic to τ, belongs to the set (Q+k. I.e., for every σ- structure A, we have A = (Q+ky sph τ (y if, and only if, {b A : N A r (b = τ} (Q+k. A sphere-formula (over σ and x is a formula of the form sph τ (x, where x = (x 1,..., x n is a non-empty tuple of pairwise distinct variables, and τ is an r-type with n centres (of signature σ, for some r N. The number r is called the locality radius of the sphere-formula. An FO(Q[σ]-formula ψ(x in Hanf normal form (HNF, for short is a Boolean combination of Hanf-sentences and sphereformulas over σ. Accordingly, a sentence in HNF is a Boolean combination of Hanf-sentences. The locality radius of a formula in HNF is the maximum of the locality radii of its Hanf-formulas and its sphere-formulas. Definition 3.1. A set Q P(N of unary counting quantifiers permits Hanf normal forms if for every relational signature σ and every degree bound d 0, every FO(Q[σ]-formula is d-equivalent to an FO(Q[σ]-formula in HNF. Our first main result characterises the sets Q that permit Hanf normal forms in terms of ultimately periodic sets: Theorem 3.2. A set Q P(N of unary counting quantifiers permits Hanf normal forms if, and only if, every quantifier Q Q is ultimately periodic. For the only if direction of Theorem 3.2, we consider an arbitrary unary counting quantifier S Q that is not ultimately periodic, and we show that already for the signature σ P := {P } with P unary, no sentence in HNF can express A S. I.e., we show that the formula Sy y=y is not equivalent to any FO(Q[σ P ]- sentence in HNF. The proof s key point is that no finite factor of the characteristic sequence χ S of S determines the remainder of χ S, see Section 4. For the if direction, consider a set Q P(N of ultimately periodic sets. Let D P(N be the set of all divisibility quantifiers D p for which there exists Q Q with period p. The proof then proceeds by showing the following:

4 (1 Any FO(Q-formula ϕ can be translated into an FO(D- formula that is equivalent to ϕ on all finite structures (irrespective of their degree. (2 For t N 1 let σ be the signature consisting of the unary relation symbols P 1,..., P t and restrict attention to σ -structures A whose universe is a disjoint union of the relations P1 A,..., Pt A. The properties A ( +k and A (D p+k can be expressed by Boolean combinations of formulas of the form ( +ly P s(y and (D p+ly P s(y (with s [1, t] and all l N. (3 The set D permits Hanf normal forms effectively. (4 If Q N is ultimately periodic with period p 2 and ψ = (D p+ky ϕ, then there is a Boolean combination of formulas (Q+ly ϕ and ( +ly ϕ for suitable numbers l N that is equivalent to ψ on all finite structures (irrespective of their degree. Step (1 is straightforward. Steps (2 and (3 are the crucial steps (and (2 is used for proving (3. Step (4 is obtained by an application of a basic result on word combinatorics. Note that the if direction of Theorem 3.2 is an immediate consequence of steps (1, (3, and (4. Proof details for the steps (1 (4 are given in Section 5. Our second main result provides a worst-case optimal algorithm for transforming formulas into Hanf normal form: Theorem 3.3. There is an algorithm which receives as input a degree bound d N and a formula ϕ FO(Q, where Q P(N is a set of ultimately periodic sets, and constructs a d-equivalent HNF ψ FO(Q of the same signature and with the same free variables as ϕ. For any d 2, the formula ψ has locality radius 4 qr(ϕ and displacement in d 2O( ϕ, and the algorithm s runtime is in 2 d2o( ϕ. Our proof of the if direction of Theorem 3.2 allows it to be read as the algorithm of Theorem 3.3. An upper bound on the algorithm s runtime is obtained by a careful analysis of the time required for performing each of the steps of that proof; see Section 6 for details. For obtaining the 3-fold exponential upper bound, it is crucial that the main construction within our proof of Step (2 is done via a divide and conquer approach (a more straightforward brute-force approach only yields a 4-fold exponential upper bound. A matching 3-fold exponential lower bound (for d = 3 was shown in [1] already for plain first-oder logic, i.e., for the special case where Q = { }. As an easy application of Theorem 3.3, we obtain that Seese s and Frick/Grohe s [7, 20] fixed-parameter tractability result for firstorder model checking on structures of degree d can be generalised to first-order logic with ultimately periodic unary counting quantifiers. Precisely, we obtain the following, where A denotes the size of a reasonable encoding of a σ-structure A (as defined, e.g., in [6]. Theorem 3.4. There is an algorithm which receives as input a formula ϕ(x FO(Q[σ], where Q P(N is the set of all ultimately periodic sets, and where σ consists of precisely the relation symbols that occur in ϕ, and a finite σ-structure A and a tuple a A x, and decides whether A = ϕ[a] in time 2 d2o( ϕ A, where d 2 is an upper bound on the degree of A. 4. Proof of the only if direction of Theorem 3.2 In this section we show that, whenever a set Q of quantifiers contains some quantifier that is not ultimately periodic, then Q does not permit Hanf normal forms. For this, it suffices to consider a signature consisting of a single unary relation symbol. Lemma 4.1. Let σ P := {P } be the signature with P unary. Let Q P(N be a set of unary counting quantifiers which contains a quantifier S N that is not ultimately periodic. There is no FO(Q[σ P ]-sentence δ in Hanf normal form, such that for all σ P - structures A we have A = δ A S. Proof. For contradiction, assume that δ is an FO(Q[σ P ]-sentence in HNF expressing A S. Since P is unary, any r-neighbourhood of an element a in a σ P - structure A consists of its centre a, only. Consequently, P (y and P (y are the only formulas sph τ (y, where τ is a type with one centre. Hence, there are a finite set Q Q and a natural number k 1 such that δ is a Boolean combination of sentences of the form (Q+ly P (y or (Q+ly P (y, where Q Q and l [0, k 1]. Let Q 1,..., Q j be a list of all Q Q. For each a N with a k consider the word w a of length k j defined as the concatenation of the bitstrings χ Qi (a k, a] for i = 1,..., j. Clearly, there exist natural numbers b > a > k with w a = w b, i.e., χ Q (a k, a] = χ Q (b k, b] for all Q Q. If, for all c 0, we have a + c S b + c S, then S is ultimately periodic (with period dividing b a and offset a. Since this is not the case, there is a c 0 with a + c S b + c / S. Now consider σ P -structures A and B with A = a+c, B = b+c, and P A = P B = c. By choice of a, b, c, we have A S B / S, and thus, A = δ B = δ. Nevertheless, A and B cannot be distinguished by any of the Hanf-sentences that occur in δ: To this end, let Q Q and l [0, k 1]. Then A = (Q+ly P (y iff P A (Q+l. This is equivalent to P B (Q+l since P A = P B, and therefore to B = (Q+ly P (y. On the other hand, A = (Q+ly P (y iff a l Q, since A \ P A = a. This is equivalent to b l Q, since χ Q (a k, a] = χ Q (b k, b]. Finally, b l Q is equivalent to B = (Q+ly P (y, since B \ P B = b. In summary, the structures A and B satisfy the same Hanf-sentences that occur in δ. As δ is a Boolean combination of these Hanf-sentences, we obtain A = δ B = δ. This is a contradiction, completing the proof of Lemma 4.1. The only if direction of Theorem 3.2 is an immediate consequence: For S Q not ultimately periodic, the FO(Q[σ P ]- sentence Sy y=y expresses A S which cannot be expressed by any FO(Q[σ P ]-sentence in HNF. 5. Proof of the if direction of Theorem 3.2 For the proof of the if direction of Theorem 3.2, we have to show that for every set Q P(N of ultimately periodic sets, for every relational signature σ, for every degree bound d 0, and for every FO(Q[σ]-formula ϕ, there is a d-equivalent FO(Q[σ]-formula ψ in Hanf normal form. For this, we introduce the notion of the generalised quantifier rank gqr(ϕ of a formula ϕ, which is defined in the same way as the quantifier rank, with the only exception that a formula ψ of the shape (Q+ky ϕ has generalised quantifier rank gqr(ψ = gqr(ϕ + 1 (in contrast, ψ has quantifier rank qr(ψ = qr(ϕ + k + 1. For the remainder of this section we denote by Q P(N a set of ultimately periodic quantifiers. Furthermore, we let D P(N

5 be the set which contains for each Q Q with period p 2 the divisibility quantifier D p. The proof follows the four steps outlined in Section Step (1 Step (1 is established by the following lemma. Lemma 5.1. Let Q N be ultimately periodic with period p and offset n 0. Every formula of the shape Qy ϕ is equivalent to a Boolean combination of formulas of the form (D p+ly ϕ and ( +ly ϕ, for l < n 0+p. This Boolean combination has size O((n 0+p 3 ϕ, and it has the same generalised quantifier rank as Qy ϕ. Proof. Let n 1 N be the (unique number in [n 0, n 0+p that is divisible by p. Clearly, Q is also ultimately periodic with period p and offset n 1. Let Q 1 := Q [0, n 1 and R := {r [0, p : n 1+r Q}. It is straightforward to verify that Qy ϕ is equivalent to the formula ( ( =l y ϕ n 1 y ϕ (D p+ry ϕ l Q 1 r R. (3 Clearly, this formula has the same generalised quantifier rank as Qy ϕ, and it is of size O((n 0+p 3 ϕ. 5.2 Step (2 For every t N 1 let σ be the signature consisting of t unary relation symbols P 1,..., P t. Step (2 consists of proving the following lemma. Lemma 5.2. There is an algorithm which receives as input numbers i, j, t, k N with 1 i j t, and a quantifier Q { } D with period p 1, and constructs a Boolean combination δ (Q+k of sentences of the form (R+ly P s(y with R {, Q}, l max{k, p}, and s [i, j], such that for every σ -structure B where the relations P1 B,..., Pt B are mutually disjoint, B = δ (Q+k The displacement of δ (Q+k j P B s is max{k, p}. (Q+k. To ensure that our algorithm provided by Theorem 3.3 is worstcase optimal, we need the formula δ (Q+k to be sufficiently small. Therefore, our proof of Lemma 5.2 proceeds in a divide-and-conquer manner, such that its runtime meets the bound stated in Corollary 6.2 below. Proof of Lemma 5.2. Let C denote the class of all σ -structures B whose relations Ps B, for s [1, t], are mutually disjoint. Observe that for every B C, we have j Ps B j (Q+k B = (Q+ky P s(y. Thus, if i = j, we are done. If i < j, the algorithm proceeds by a recursive subdivision of the interval [i, j]. For this, let h := i+j 2. Case 1: Q =. The formula ( +ky j Ps(y, that is, the formula k+1 y j Ps(y, is C-equivalent (but not equivalent on all structures to the formula h k+1 y P s(y k+1 y k l=1 ( l y j P s(y s=h+1 h P s(y k l+1 y j s=h+1 P s(y. The algorithm proceeds recursively by decomposing the quantified subformulas in the same manner, and arrives at a Boolean combination δ ( +k of formulas of the shape ( +ly P s(y with 0 l k. Case 2: Q = D p with p 2 and k < p. The formula (D j p+ky Ps(y is C-equivalent (but not equivalent on all structures to ( h j (D p+k 1y P s(y (D p+k 2y P s(y. k 1,k 2 [0,p, k 1 +k 2 k mod p s=h+1 In the same way as in Case 1, the algorithm proceeds recursively and arrives at a Boolean combination δ (Dp+k of formulas of the shape (D p+ly P s(y for l < p. Case 3: Q = D p with p 2 and k p. Let k [0, p with k k mod p. For every B C, we have j Ps B j (Q+k P B s ( +(k 1 (Q+k Therefore, the algorithm can output the sentence where δ ( +(k 1 δ (Dp+k := δ ( +(k 1 δ (Dp+k, and δ (Dp+k are sentences constructed according to Case 1 and Case 2, respectively. Note that in this case δ (Dp+k has displacement max{k, p}. 5.3 Step (3 In the following, we let σ be a relational signature. For every d N, we write C d for the class of all d-bounded σ-structures. For each n 1 and each r 0 we write T d r (n for a set of all (up to isomorphism d-bounded r-types with n centres (of signature σ. I.e., for every d-bounded r-type τ with n centres (of signature σ, there is precisely one τ T d r (n with τ = τ. We write for a fixed tautological FO[σ]-sentence in HNF; e.g., we can choose := y sph τ (y y sph τ (y, where τ is an arbitrary, fixed type of radius 0 with one centre. We let := be the corresponding unsatisfiable sentence in HNF. This subsection s aim is to show that any set D of divisibility quantifiers permits Hanf normal forms. As a warm-up, let us first show how to transform a formula of the form (R+ly sph τ (x, y into a d-equivalent formula in HNF. The crucial point is the separation of the variable y from the variables x. Lemma 5.3. Let R N, let l, d, r, n N with r 1, let τ T d r (n+1, and let α(x := (R+ly sph τ (x, y. There is an FO({R}[σ]-formula α (x in HNF that is d-equivalent to α(x. The formula α (x has locality radius 4r and displacement l + n d (2r+1+1. Furthermore, for ultimately periodic R there is an algorithm which constructs α (x when given α(x and d. Proof. If n = 0 then α := α is in HNF and we are done. For n 1, let x = (x 1,..., x n be the free variables of α(x, and let τ = (T, c, c, for the n+1 centres c, c = (c 1,..., c n, c.

6 For each ρ T d 4r(n, we will construct an FO({R}[σ]-sentence α ρ in HNF which, for all d-bounded σ-structures A and all a A n with N A 4r(a = ρ, satisfies Then, obviously, A = α ρ A = α[a]. (4 α (x := ρ T d 4r (n ( sphρ (x α ρ is in HNF and is d-equivalent to α(x. Let ρ = (R, e T d 4r(n be an arbitrary d-bounded 4r-type with n centres e = (e 1,..., e n. The construction of α ρ proceeds by the following case distinction: Case 1: c N2r+1(c. τ a A n we have Then, for every σ-structure A and all {b A : N A r (a, b = τ} = {b N A 2r+1(a : N A r (a, b = τ}. Furthermore, N τ r (c N τ 3r+1(c. Since 2r+1+r = 3r+1 4r, this implies that for every σ-structure A and every tuple a A n with N A 4r(a = ρ, {b N A 2r+1(a : N A r (a, b = τ} (5 = {f N2r+1(e ρ : Nr ρ (e, f = τ}. (6 }{{} =: k ρ Hence, putting (5 and (6 together, we let α ρ := if k ρ (R+l, and α ρ := if k ρ (R+l. Clearly, α ρ satisfies (4. Case 2: c N2r+1(c. τ Then, the sets Nr τ (c and Nr τ (c are disjoint and there are no edges in the Gaifman graph of τ between the nodes from Nr τ (c and the nodes from Nr τ (c. Case 2.1: N τ r (c and N ρ r (e are not isomorphic. Then, for every σ-structure A and for each a A n with N A 4r(a = ρ, we have {b A : N A r (a, b = τ} = 0. Hence, if 0 (R+l we let α ρ :=, and if 0 (R+l we let α ρ :=. Clearly, α ρ satisfies (4. Case 2.2: N τ r (c and N ρ r (e are isomorphic. Then, for every σ- structure A and every a A n with N A 4r(a = ρ, we have {b A : N A r (a, b = τ} = {b A \ N A 2r+1(a : N A r (b = N τ r (c }. Since 2r+1+r = 3r+1 4r, we have {b N A 2r+1(a : N A r (b = N τ r (c } (7 = {f N2r+1(e ρ : Nr ρ (f = Nr τ (c }. (8 }{{} =: l ρ Hence, putting (7 and (8 together, we know that {b A : N A r (a, b = τ} = {b A : N A r (b = N τ r (c } l ρ. It follows that the Hanf-sentence α ρ := (R+(l+l ρy sph N τ r (c (y satisfies (4. Observe that l ρ n d (2r+1+1 and hence, α ρ has displacement l + n d (2r+1+1. Observe that for each ρ T d 4r(n the HNF-sentence α ρ has locality radius r and displacement l + n d (2r+1+1. Consequently, the HNF-formula α (x has locality radius 4r and displacement l + n d (2r+1+1. Furthermore, for ultimately periodic R, it can easily be decided for a given number m if m (R+l. In Case 1 and Case 2.1, this is used for m = k ρ and m = 0, respectively, and leads to an algorithm which constructs the HNF-formula α (x. The following Lemma 5.4 states this subsection s main result; in particular, it implies that the set D permits Hanf normal forms. For proving Lemma 5.4, we will use the Lemmas 5.2 and 5.3. Lemma 5.4. There is an algorithm which receives as input a degree bound d N and a formula ϕ FO(D[σ] (where σ is a relational signature, and constructs a HNF ψ FO(D[σ] that is d-equivalent to ϕ. Furthermore, free(ψ = free(ϕ, and ψ has locality radius 4 q and displacement max{k, P } + ϕ d 4q, where q 0 is the generalised quantifier rank of ϕ, K 0 is the displacement of ϕ, and P 1 is an upper bound on the periods of the quantifiers occurring in ϕ. The below proof of Lemma 5.4 proceeds by induction on the shape of FO(D[σ]-formulas. While the case of quantifier-free formulas turns out to be straightforward, much more work is needed to transform a formula ϕ(x of the shape (Q+ky ψ (x, y into a d-equivalent HNF. Suppose that ψ (x, y is already in HNF. Our construction is carried out along the following steps: For each structure A C d and each tuple a A n, we let B A,a := { b A : A = ψ [a, b] }. Clearly, A = ϕ[a] B A,a (Q+k. Suppose that ϕ(x has n 0 free variables and that the HNF ψ (x, y has locality radius r 0. Observe that for every b B A,a, there is exactly one τ Tr d (n+1 such that Nr A (a, b = τ. Let τ 1,..., τ t, for t := Tr d (n+1, be an enumeration of Tr d (n+1. Let B be the σ -structure (B, P1 B,..., Pt B with universe B := B A,a and Ps B := {b B : Nr A (a, b = τ s}, for each s [1, t]. Clearly, B is the disjoint union of the sets P1 B,..., Pt B. Hence, for the sentence δ (Q+k FO(D[σ ], obtained from Lemma 5.2 in Step (2, we have that B (Q+k B = δ (Q+k. Recall from Lemma 5.2 that δ (Q+k is a Boolean combination of formulas of the form (R+ly P s(y, with R {, Q}, s [1, t], and l max{k, P }. For every such formula (R+ly P s(y, we construct a HNF ψ s (R+l (x FO(D[σ], such that for every A C d, for every tuple a A n, and for the σ -structure B := B A,a, we have that A = ψ s (R+l [a] Ps B (R+l. Thus, we interpret the σ -structure B A,a in (A, a. In the sentence δ (Q+k, we replace every formula of the shape (R+ly P s(y by the HNF ψ s (R+l (x. Clearly, the resulting FO(D[σ]-formula ψ(x is in HNF and, furthermore, d-equivalent to ϕ(x. The details of the above construction are carried out as follows. Proof of Lemma 5.4. We describe the algorithm on input of a degree bound d 2 and an FO(D[σ]-formula ϕ(x over a finite relational signature σ. Let n = x 0 be the number of free variables of ϕ. Let q 0 be the generalised quantifier rank of ϕ. Let K 0 be the

7 displacement of ϕ, and let P 1 be an upper bound on the periods of the quantifiers occurring in ϕ. The algorithm proceeds by induction on the shape of ϕ(x. We will show that for the HNF ψ(x FO(D[σ], which the algorithm constructs, the following claim holds: Claim 5.5. (a ψ(x has locality radius 4 q. (b ψ(x is d-equivalent to ϕ(x. (c ψ(x has displacement max{k, P } + ϕ d 4q. Suppose that ϕ is quantifier-free, i.e., q = 0. In this case, n 1, and ϕ is d-equivalent to the disjunction over all types in T d 0 (n that satisfy ϕ(x. The algorithm proceeds as follows: (1 Compute the set T d 0 (n. (2 Let c = (c 1,..., c n and compute the set T T d 0 (n that contains precisely those types τ = (T, c from T d 0 (n with T = ϕ[c]. (3 If T is the empty set, then ϕ is unsatisfiable and, hence, equivalent to the HNF ψ(x := sph τ (x sph τ (x, where τ is an arbitrary element in T0 d (n. Otherwise, let ψ(x := sph τ (x. τ T It is clear that in both cases, ψ(x is a HNF which satisfies Claim 5.5 (a (c. Suppose that ϕ is a Boolean combination with generalised quantifier rank q 1. If ϕ = ϕ then let ψ be an FO(D[σ]-formula in HNF that is d-equivalent to ϕ and let ψ := ψ. If ϕ = (ϕ 1 ϕ 2, then let ψ 1 and ψ 2 be FO(D[σ]-formulas in HNF that are d- equivalent to ϕ 1 and ϕ 2, respectively, and let ψ := (ψ 1 ψ 2. In both cases, Claim 5.5 (a (c is obviously satisfied. Suppose that ϕ(x = (Q+ky ϕ (x, y. Let p [1, P ] be the period of Q. Recall that k K. The algorithm proceeds as follows: (4 By Claim 5.5 (a (c, there is a HNF ψ (x, y FO(D[σ] that is d-equivalent to ϕ (x, y and which has locality radius r := 4 q 1 and displacement at most k := max{k, P } + ϕ d 4q 1. (5 Let t := T d r (n+1, and let τ 1,..., τ t be an enumeration of the set T d r (n+1. Recall that for every A C d and every tuple (a, b A n+1, there is exactly one s [1, t] such that N A r (a, b = τ s. (6 Since ψ (x, y is in HNF, it is a Boolean combination of sphereformulas over x, y and of Hanf-sentences. For every s [1, t] consider the type τ s and let ψ s be the HNF-sentence obtained from ψ as follows: Letting (T, c := τ s, check for every sphere-formula sph ρ (x, y in ψ, whether T = sph ρ [c]. If so, replace every occurrence of sph ρ (x, y in ψ with the tautological HNF-sentence ; otherwise replace it with the unsatisfiable HNF-sentence. Since ψ (x, y has locality radius r, clearly ψ (x, y is d- equivalent to t ( sphτs (x, y ψ s. s=1 For any fixed A C d and a A n, consider the σ -structure B := B A,a of universe t s=1 P B s where P B s := { b A : (A, a, b = sph τs (x, y ψ s }, for any s [1, t]. (7 By Lemma 5.2, there is an FO(D[σ ]-sentence δ (Q+k such that B = δ (Q+k B (Q+k. Furthermore, δ (Q+k is a Boolean combination of sentences of the shape (R+ly P s(y with R {, Q}, s [1, t], and l max{k, p} max{k, P }. (8 For every sentence of the shape (R+ly P s(y in δ (Q+k, let the formula ϕ (R+l s (x be defined as follows: If 0 (R+l, then let ϕ (R+l s (x := ψ s (R+ly sph τs (x, y ; otherwise let ϕ (R+l s (x := ψ s (R+ly sph τs (x, y. It is straightforward to verify that for every d-bounded σ- structure A and every a A n we have A = ϕ (R+l s [a] B A,a = (R+ly P s(y. (9 Let ψ s (R+l (x be the HNF-formula obtained from ϕ (R+l s (x by replacing (R+ly sph τs (x, y with the d-equivalent HNFformula obtained from Lemma 5.3. Since τ s has radius r = 4 q 1, and l max{k, P }, the formula ψ s (R+l (x has locality radius 4r = 4 q and displacement max{k, P } + n d 4q. (9 Let ψ(x be the formula obtained from δ (Q+k as follows: For every s [1, t], replace every occurrence of a formula of the shape (R+ly P s(y with the HNF-formula ψ s (R+l (x. Note that ψ(x is in HNF, has locality radius 4 q, and has displacement max{k, P } + ϕ d 4q. By construction, the following is true for every d-bounded σ-structure A, every tuple a A n, and the σ -structure B := B A,a: A = ϕ[a] (A, a = (Q+ky ψ (x, y B (Q+k B = δ (Q+k A = ψ[a]. The last equivalence follows from the construction of ψ(x and equivalence (9. In summary, we obtain that Claim 5.5 (a (c is satisfied. This completes the proof of Lemma Step (4 Step (4 is established by the following lemma. Lemma 5.6. Let Q N be ultimately periodic with period p 2 and offset n 0. Every formula of the shape (D p+ky ϕ, for a k 0, is equivalent to a Boolean combination of formulas of the shape (Q+ly ϕ and ( +ly ϕ with l < n 0+k+2p. Furthermore, such a Boolean combination can be computed in time O(( Q +k 3 ϕ. Proof. Let n 1 N 1 be the smallest number max{n 0, k} such that n 1 1 k mod p. Clearly, Q is ultimately periodic with period p also for the offset n 1. From Fact 2.1 we obtain bitstrings α and π of length α = n 1 and π = p such that χ Q = α π ω. I.e., χ Q [0, n 1 1] = α, and χ Q [n 1, n 1+p 1] = π = χ Q [n 1+(s 1p, n 1+sp 1], (10

8 for every s 1. Claim 5.7. For all n N with n n 1+p 1 we have n (D p+k χ Q (n p, n] = π. Before presenting the proof of the claim, let us first show how the claim can be used to prove Lemma 5.6. Letting π 0, π 1,..., π p 1 {0, 1} be such that π = π p 1 π 1 π 0, it is straightforward to see that for all n N with n n 1+p 1 we have χ Q (n p, n] = π n (Q + i n (Q + j. i [0,p : π i =1 j [0,p : π j =0 Thus, the formula (D p+ky ϕ is equivalent to the formula ( =l y ϕ n1+p 1 y ϕ l S (Q+iy ϕ (Q+jy ϕ, i [0,p : π i =1 j [0,p : π j =0 (11 where S is the set of all n (D p+k with n < n 1+p 1. Since n 1 max{n 0, k}+p, each of the quantifiers that explicitly occur in the formula (11 has displacement < n 0+k+2p 2 Q + k. Using this, it is straightforward to see that the formula (11 has size O(( Q +k 3 ϕ and can easily be computed within the same time bound. To complete the proof of Lemma 5.6, it only remains to prove Claim 5.7. Proof of Claim 5.7. Fix an arbitrary n N with n n 1+p 1. The direction = is an immediate consequence of equation (10. Note that for proving the direction =, it suffices to prove the following: If χ Q = β π ω for some word β {0, 1} with α β, then α β mod p (in our case, β = χ Q [0, n 1]. Since α is not longer than β, there exist i N, a word u {0, 1} with u < π, and a word v {0, 1} + with απ i u = βπ and βπv = απ i+1. Hence απ i uv = απ i+1, and thus π = uv. Consequently, βπvu = απ i+1 u is a prefix of απ ω = βπ ω. This implies that vu is a prefix of π ω of length vu = uv = π, i.e., vu = π. Since u and v commute (i.e., uv = vu, a basic result in word combinatorics (see [15, Proposition 1.3.2] implies the existence of some word w {0, 1} + such that u, v w and therefore π = uv w. But then, χ Q = απ ω = αw ω implies π = w, since p = π was the period of χ Q, and hence minimal. Hence, w = π = uv. Consequently, u = ε and therefore β = απ i. This ensures α β mod p. This completes the proof of Claim 5.7 and therefore the proof of Lemma 5.6. Note that the if direction of Theorem 3.2 is an immediate consequence of the Lemmas 5.1, 5.4, and Complexity This section is devoted to the proof of Theorem 3.3. We proceed along the steps outlined in Section 3 and provide a runtime analysis of the algorithm obtained from the proof presented in Section 5. Due to space restrictions, some proofs had to be deferred to the paper s full version. The following Corollary 6.1 shows how to use Lemma 5.1 to compute, for a given FO(Q-formula, an equivalent FO(D- formula. Here, we let w(ϕ := 1 if ϕ is quantifier-free; otherwise, w(ϕ is the largest number Q for all quantifiers Q occurring in ϕ. Corollary 6.1. There is an algorithm which receives as input a ϕ FO(Q of quantifier rank q, and constructs in time ϕ w(ϕ O(q an equivalent ψ FO(D of the same signature and with the same free variables as ϕ. The formula ψ has generalised quantifier rank q and displacement w(ϕ. The proof, as well as the proof of the following result, is straightforward. Corollary 6.2. The algorithm from Lemma 5.2 runs in time max{2k+2, 2p} O(log(j i+1. We proceed with a runtime analysis of the algorithms provided by the Lemmas 5.3 and 5.4. Two basic tasks that are repeatedly used within both algorithms are (a to test two d-bounded r-types for isomorphism and (b to compute a set Tr d (n of representatives of the isomorphism classes of d-bounded r-types with n centres. Both can be accomplished by brute-force algorithms: Recall that for d 2, the universe of every d-bounded r-type with n centres has size Ñ := n dr+1. For every bijection between the elements of two such r-types, it can be checked in time O(n+Ñ σ Ñ O( σ whether it is indeed an isomorphism. Since there are at most Ñ Ñ bijections, the test whether the two r- types are isomorphic can be performed in time a0 2Ñ, where a 0 1 is a suitable number of size O( σ. For computing the set Tr d (n, we can assume that the universe of each element in Tr d (n is a subset of {1,..., Ñ}. Hence, the relations of an arbitrary r-type in Tr d (n can be represented by a bitstring of length at most Ñ σ. Furthermore, each of the r-type s n centres is interpreted by an element from {1,..., Ñ}. Therefore, there are at most Ñ n σ 2Ñ σ +2 2Ñ candidates for elements in Tr d (n. For any two such candidates, we use the above described algorithm for testing whether they are isomorpic. In summary, Tr d (n can be constructed in time ( 2Ñ σ Ñ a 0 where a 1 > a 0 is a suitable number of size O( σ. Using this, we obtain the following. 2Ñ a 1, (12 Corollary 6.3. For d 2, the algorithm from Lemma 5.3 runs in time O(l 2 2 (n d4r+1 O( σ. Proof. We use the same notation as in the proof of Lemma 5.3, and we let N := n d 4r+1. According to equation (12 the set T d 4r(n can be constructed in time 2 N a1, for a suitable number a 1 of size O( σ. For each ρ T d 4r(n, it takes time N O( σ to construct the formula sph ρ (x. For the construction of α ρ, we have to make a case distinction depending on whether c N τ 2r+1(c. To determine which of the two cases actually applies for the given τ, recall that the universe of τ has size at most (n+1 d r+1. Thus, the time needed do decide whether c N τ 2r+1(c is in N O( σ. Case 1: If c N τ 2r+1(c, we compute the number k ρ defined in equation (6. This requires us to check for at most n d (2r+1+1 N d-bounded r-types with (n+1 centres, each with a universe of size (n+1 d r+1 N, whether they are isomorphic to τ. By using the brute-force isomorphism test described at the beginning of Section 6, the number k ρ can be computed in time 2 N O( σ. And testing whether k ρ (R+l is done in time O(k ρ, for ultimately periodic R. Hence, in Case 1, the algorithm uses time 2 N O( σ to construct the formula α ρ.

9 Case 2: If c N τ 2r+1(c, we have to check whether the two r- types N τ r (c and N ρ r (e (each with N elements are isomorphic. If they are not, we use time O(l to check whether 0 (R+l and construct α ρ accordingly. Otherwise, i.e., if N τ r (c and N ρ r (e are isomorphic, we have to compute the number l ρ defined in equation (8. This requires us to check for at most n d (2r+1+1 N d-bounded r-types with one centre, each with a universe of at most d r+1 N elements, whether they are isomorphic to N τ r (c. By using the brute-force isomorphism test described at the beginning of Section 6, the number l ρ can be computed in time 2 N O( σ. Afterwards, we construct the formula α ρ := (R+(l+l ρy sph N τ r (c (y. For this, we use time N O( σ to construct the formula sph N τ r (c (y; and resolving the quantification (R+(l+l ρ via the quantifiers R and involves an extra factor of (l+l ρ 2 (l+n 2. Altogether, we obtain that in Case 2 the algorithm uses time at most O(l 2 2 N O( σ to construct the formula α ρ. Finally, the algorithm outputs the formula α (x, which is the disjunction of the formulas ( sph ρ (x α ρ, for all ρ T d 4r (n. The overall time used for constructing this formula is 2 N a 1 (N O( σ + O(l 2 2 N O( σ O(l 2 2 N O( σ. By a similar reasoning, a runtime analysis of the algorithm provided by Lemma 5.4 leads to the following result. Corollary 6.4. For d 2, the algorithm from Lemma 5.4 runs in time max{2k+2, 2P } ( ϕ d4q +1 O( σ. The proof of Theorem 3.3 now follows by combining Corollary 6.1, Lemma 5.4, Corollary 6.4, and Lemma 5.6: Proof of Theorem 3.3. We analyse the algorithm s runtime when receiving as input a degree bound d 2 and a formula ϕ FO(Q. Let σ denote the relational signature consisting of all relation symbols that occur in ϕ, and let q 0 be the quantifier rank of ϕ. W.l.o.g., we can assume that Q consists of exactly those unary counting quantifiers that occur in the formula ϕ. In Step (1, the algorithm of Corollary 6.1 computes an FO(D[σ]-formula ϕ that is equivalent to ϕ and that has displacement w(ϕ and generalised quantifier rank q. This takes time ϕ w(ϕ O(q 2 ϕ O(1. For the latter inequality, recall that q, w(ϕ, σ ϕ. In Step (3, the algorithm of Lemma 5.4 computes a HNF ψ FO(D[σ] that is d-equivalent to ϕ. According to Corollary 6.4, for K, P ϕ this takes time max{2k+2, 2P } ( ϕ d 4q +1 O( σ 2 d2o( ϕ. Note that ψ has locality radius 4 q and displacement max{k, P } + ϕ d 4q d 2O( ϕ. In Step (4, the algorithm of Lemma 5.6 computes for each Hanfsentence in ψ an equivalent FO(Q[σ]-sentence in HNF. For each Hanf-sentence in ψ of the shape (D p+ky γ, this takes time O(( Q +k 3 γ, where Q Q is ultimately periodic with period p. Since Q ϕ and k d 2O( ϕ and γ ψ, the time for computing ψ from ψ is at most ψ ( ( ϕ + d 2 O( ϕ 3 ψ 2 d2o( ϕ. ψ has locality radius 4 q and displacement in d 2O( ϕ. Altogether, ψ is an FO(Q[σ]-formula in HNF, ψ is d-equivalent to ϕ, and ψ be computed in time 2 d2o( ϕ. This completes the proof of Theorem Model-checking Proof of Theorem 3.4. Let ϕ(x, A, and a be the algorithm s input, where σ is the relational signature that consists of precisely the relation symbols occurring in ϕ, A is a σ-structure, and Q is the set of ultimately periodic unary counting quantifiers that occur in ϕ. For checking whether A = ϕ[a], the algorithm proceeds as follows: (1 Compute an upper bound d 2 on the degree of A. (2 Use the algorithm from Theorem 3.3 to transform ϕ(x into a d-equivalent FO(Q[σ]-formula ψ(x in HNF. (3 For each sphere-formula α that occurs in ψ, check if A = α[a], and replace each occurrence of α in ψ with the Boolean constant 1 if A = α[a], and with the Boolean constant 0 otherwise. (4 For each Hanf-sentence χ that occurs in ψ, check if A = χ, and replace each occurrence of χ in ψ with the Boolean constant 1 if A = χ, and with the Boolean constant 0 otherwise. (5 After having performed the steps (1 (4, ψ is a Boolean combination of the Boolean constants 0 and 1. Evaluate this Boolean combination and output yes if the result is 1, and output no if the result is 0. Obviously, the algorithm s output is yes if, and only if, A = ϕ[a]. For analysing the algorithm s runtime, we use the same conventions as in [6]. I.e., we use random-access machines with a uniform cost measure, and the input structure A is given by an adjacency list representation of size linear in A := σ + A + R σ R A ar(r. We let n := x and let x = (x 1,..., x n and a = (a 1,..., a n. For the following runtime analysis of each of the steps (1 (5, note that n, σ, and Q are smaller than ϕ, for each Q Q. (1 To compute d, compute an adjacency list representation of A s Gaifman-graph G A: For each R σ and each occurrence of an element of A in a tuple of R A, we have to add less than ar(r σ < ϕ edges to G A. For each edge, this takes time O(d, since A is d-bounded. In summary, computing G A and d takes time at most O( A ϕ d. (2 According to Theorem 3.3, this takes time 2 d2o( ϕ. Recall that ψ(x is a Boolean combination of sphere-formulas of the form sph ρ (x and Hanf-sentences (Q+ky sph τ (y, where x is a tuple of free variables from x, ρ is a d-bounded type with radius 4 qr(ϕ and x centres, Q Q, k N, and τ is a d-bounded type with radius 4 qr(ϕ and one centre. (3 Consider a sphere-formula α(x := sph ρ (x, where x = (x i1,..., x im for 1 m n and i 1,..., i m [1, n], and where ρ is a d-bounded type with radius r 4 qr(ϕ and m centres.

Locality of Counting Logics

Locality of Counting Logics Locality of Counting Logics Dietrich Kuske Technische Universität Ilmenau 1/22 Example 1 Can a first-order formula distinguish the following two graphs? vs. no, but why? Hanf (1965): every single-centered

More information

Pattern Logics and Auxiliary Relations

Pattern Logics and Auxiliary Relations Pattern Logics and Auxiliary Relations Diego Figueira Leonid Libkin University of Edinburgh Abstract A common theme in the study of logics over finite structures is adding auxiliary predicates to enhance

More information

Finite Model Theory: First-Order Logic on the Class of Finite Models

Finite Model Theory: First-Order Logic on the Class of Finite Models 1 Finite Model Theory: First-Order Logic on the Class of Finite Models Anuj Dawar University of Cambridge Modnet Tutorial, La Roche, 21 April 2008 2 Finite Model Theory In the 1980s, the term finite model

More information

Preliminaries. Introduction to EF-games. Inexpressivity results for first-order logic. Normal forms for first-order logic

Preliminaries. Introduction to EF-games. Inexpressivity results for first-order logic. Normal forms for first-order logic Introduction to EF-games Inexpressivity results for first-order logic Normal forms for first-order logic Algorithms and complexity for specific classes of structures General complexity bounds Preliminaries

More information

Automata theory. An algorithmic approach. Lecture Notes. Javier Esparza

Automata theory. An algorithmic approach. Lecture Notes. Javier Esparza Automata theory An algorithmic approach Lecture Notes Javier Esparza July 2 22 2 Chapter 9 Automata and Logic A regular expression can be seen as a set of instructions ( a recipe ) for generating the words

More information

Online Appendix to The Recovery of a Schema Mapping: Bringing Exchanged Data Back

Online Appendix to The Recovery of a Schema Mapping: Bringing Exchanged Data Back Online Appendix to The Recovery of a Schema Mapping: Bringing Exchanged Data Back MARCELO ARENAS and JORGE PÉREZ Pontificia Universidad Católica de Chile and CRISTIAN RIVEROS R&M Tech Ingeniería y Servicios

More information

Connectivity. Topics in Logic and Complexity Handout 7. Proof. Proof. Consider the signature (E, <).

Connectivity. Topics in Logic and Complexity Handout 7. Proof. Proof. Consider the signature (E, <). 1 2 Topics in Logic and Complexity Handout 7 Anuj Dawar MPhil Advanced Computer Science, Lent 2010 Consider the signature (E,

More information

Finite and Algorithmic Model Theory II: Automata-Based Methods

Finite and Algorithmic Model Theory II: Automata-Based Methods Finite and Algorithmic Model Theory II: Automata-Based Methods Anuj Dawar University of Cambridge Computer Laboratory Simons Institute, 30 August 2016 Review We aim to develop tools for studying the expressive

More information

Algorithmic Model Theory SS 2016

Algorithmic Model Theory SS 2016 Algorithmic Model Theory SS 2016 Prof. Dr. Erich Grädel and Dr. Wied Pakusa Mathematische Grundlagen der Informatik RWTH Aachen cbnd This work is licensed under: http://creativecommons.org/licenses/by-nc-nd/3.0/de/

More information

FIRST-ORDER QUERY EVALUATION ON STRUCTURES OF BOUNDED DEGREE

FIRST-ORDER QUERY EVALUATION ON STRUCTURES OF BOUNDED DEGREE FIRST-ORDER QUERY EVALUATION ON STRUCTURES OF BOUNDED DEGREE INRIA and ENS Cachan e-mail address: kazana@lsv.ens-cachan.fr WOJCIECH KAZANA AND LUC SEGOUFIN INRIA and ENS Cachan e-mail address: see http://pages.saclay.inria.fr/luc.segoufin/

More information

A Local Normal Form Theorem for Infinitary Logic with Unary Quantifiers

A Local Normal Form Theorem for Infinitary Logic with Unary Quantifiers mlq header will be provided by the publisher Local Normal Form Theorem for Infinitary Logic with Unary Quantifiers H. Jerome Keisler 1 and Wafik Boulos Lotfallah 2 1 Department of Mathematics University

More information

A short tutorial on order-invariant first-order logic

A short tutorial on order-invariant first-order logic A short tutorial on order-invariant first-order logic Nicole Schweikardt Goethe-Universität Frankfurt am Main, Germany schweika@informatik.uni-frankfurt.de Abstract. This paper gives a short introduction

More information

On the Expressive Power of Logics on Finite Models

On the Expressive Power of Logics on Finite Models On the Expressive Power of Logics on Finite Models Phokion G. Kolaitis Computer Science Department University of California, Santa Cruz Santa Cruz, CA 95064, USA kolaitis@cs.ucsc.edu August 1, 2003 Partially

More information

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler Complexity Theory Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 15 May, 2018 Reinhard

More information

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181. Complexity Theory Complexity Theory Outline Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität

More information

The complexity of first-order and monadic second-order logic revisited

The complexity of first-order and monadic second-order logic revisited The complexity of first-order and monadic second-order logic revisited Markus Frick Martin Grohe May 2, 2002 Abstract The model-checking problem for a logic L on a class C of structures asks whether a

More information

Database Theory VU , SS Ehrenfeucht-Fraïssé Games. Reinhard Pichler

Database Theory VU , SS Ehrenfeucht-Fraïssé Games. Reinhard Pichler Database Theory Database Theory VU 181.140, SS 2018 7. Ehrenfeucht-Fraïssé Games Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 15 May, 2018 Pichler 15

More information

Algorithmic Meta-Theorems

Algorithmic Meta-Theorems Algorithmic Meta-Theorems Stephan Kreutzer Oxford University Computing Laboratory stephan.kreutzer@comlab.ox.ac.uk Abstract. Algorithmic meta-theorems are general algorithmic results applying to a whole

More information

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms First-Order Logic 1 Syntax Domain of Discourse The domain of discourse for first order logic is FO structures or models. A FO structure contains Relations Functions Constants (functions of arity 0) FO

More information

Existential Second-Order Logic and Modal Logic with Quantified Accessibility Relations

Existential Second-Order Logic and Modal Logic with Quantified Accessibility Relations Existential Second-Order Logic and Modal Logic with Quantified Accessibility Relations preprint Lauri Hella University of Tampere Antti Kuusisto University of Bremen Abstract This article investigates

More information

Syntactic Characterisations in Model Theory

Syntactic Characterisations in Model Theory Department of Mathematics Bachelor Thesis (7.5 ECTS) Syntactic Characterisations in Model Theory Author: Dionijs van Tuijl Supervisor: Dr. Jaap van Oosten June 15, 2016 Contents 1 Introduction 2 2 Preliminaries

More information

Locality of queries definable in invariant first-order logic with arbitrary built-in predicates

Locality of queries definable in invariant first-order logic with arbitrary built-in predicates Locality of queries definable in invariant first-order logic with arbitrary built-in predicates Matthew Anderson 1,, Dieter van Melkebeek 1,, Nicole Schweikardt 2, Luc Segoufin 3 1 University of Wisconsin

More information

Infinite and Finite Model Theory Part II

Infinite and Finite Model Theory Part II Infinite and Finite Model Theory Part II Anuj Dawar Computer Laboratory University of Cambridge Lent 2002 3/2002 0 Finite Model Theory Finite Model Theory motivated by computational issues; relationship

More information

VAUGHT S THEOREM: THE FINITE SPECTRUM OF COMPLETE THEORIES IN ℵ 0. Contents

VAUGHT S THEOREM: THE FINITE SPECTRUM OF COMPLETE THEORIES IN ℵ 0. Contents VAUGHT S THEOREM: THE FINITE SPECTRUM OF COMPLETE THEORIES IN ℵ 0 BENJAMIN LEDEAUX Abstract. This expository paper introduces model theory with a focus on countable models of complete theories. Vaught

More information

Löwenheim-Skolem Theorems, Countable Approximations, and L ω. David W. Kueker (Lecture Notes, Fall 2007)

Löwenheim-Skolem Theorems, Countable Approximations, and L ω. David W. Kueker (Lecture Notes, Fall 2007) Löwenheim-Skolem Theorems, Countable Approximations, and L ω 0. Introduction David W. Kueker (Lecture Notes, Fall 2007) In its simplest form the Löwenheim-Skolem Theorem for L ω1 ω states that if σ L ω1

More information

3. Only sequences that were formed by using finitely many applications of rules 1 and 2, are propositional formulas.

3. Only sequences that were formed by using finitely many applications of rules 1 and 2, are propositional formulas. 1 Chapter 1 Propositional Logic Mathematical logic studies correct thinking, correct deductions of statements from other statements. Let us make it more precise. A fundamental property of a statement is

More information

AUTOMATIC STRUCTURES OF BOUNDED DEGREE REVISITED

AUTOMATIC STRUCTURES OF BOUNDED DEGREE REVISITED The Journal of Symbolic Logic Volume 00, Number 0, XXX 0000 AUTOMATIC STRUCTURES OF BOUNDED DEGREE REVISITED DIETRICH KUSKE AND MARKUS LOHREY Abstract. The first-order theory of a string automatic structure

More information

The Complexity of Computing the Behaviour of Lattice Automata on Infinite Trees

The Complexity of Computing the Behaviour of Lattice Automata on Infinite Trees The Complexity of Computing the Behaviour of Lattice Automata on Infinite Trees Karsten Lehmann a, Rafael Peñaloza b a Optimisation Research Group, NICTA Artificial Intelligence Group, Australian National

More information

Database Theory VU , SS Complexity of Query Evaluation. Reinhard Pichler

Database Theory VU , SS Complexity of Query Evaluation. Reinhard Pichler Database Theory Database Theory VU 181.140, SS 2018 5. Complexity of Query Evaluation Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 17 April, 2018 Pichler

More information

Chapter 3 Deterministic planning

Chapter 3 Deterministic planning Chapter 3 Deterministic planning In this chapter we describe a number of algorithms for solving the historically most important and most basic type of planning problem. Two rather strong simplifying assumptions

More information

The Natural Order-Generic Collapse for ω-representable Databases over the Rational and the Real Ordered Group

The Natural Order-Generic Collapse for ω-representable Databases over the Rational and the Real Ordered Group The Natural Order-Generic Collapse for ω-representable Databases over the Rational and the Real Ordered Group Nicole Schweikardt Institut für Informatik / FB 17 Johannes Gutenberg-Universität, D-55099

More information

Lecture 2: Syntax. January 24, 2018

Lecture 2: Syntax. January 24, 2018 Lecture 2: Syntax January 24, 2018 We now review the basic definitions of first-order logic in more detail. Recall that a language consists of a collection of symbols {P i }, each of which has some specified

More information

Isomorphisms between pattern classes

Isomorphisms between pattern classes Journal of Combinatorics olume 0, Number 0, 1 8, 0000 Isomorphisms between pattern classes M. H. Albert, M. D. Atkinson and Anders Claesson Isomorphisms φ : A B between pattern classes are considered.

More information

arxiv: v1 [cs.fl] 8 Jan 2019

arxiv: v1 [cs.fl] 8 Jan 2019 Languages ordered by the subword order Dietrich Kuske TU Ilmenau, Germany dietrich.kuske@tu-ilmenau.de Georg Zetzsche MPI-SWS, Germany georg@mpi-sws.org arxiv:1901.02194v1 [cs.fl] 8 Jan 2019 Abstract We

More information

A local normal form theorem for infinitary logic with unary quantifiers

A local normal form theorem for infinitary logic with unary quantifiers Math. Log. Quart. 51, No. 2, 137 144 (2005) / DOI 10.1002/malq.200410013 / www.mlq-journal.org A local normal form theorem for infinitary logic with unary quantifiers H. Jerome Keisler 1 and Wafik Boulos

More information

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete CS125 Lecture 15 Fall 2016 15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete Already know SAT NP, so only need to show SAT is NP-hard. Let L be any language in NP. Let M be a NTM that decides L

More information

Blame and Coercion: Together Again for the First Time

Blame and Coercion: Together Again for the First Time Blame and Coercion: Together Again for the First Time Supplementary Material Jeremy Siek Indiana University, USA jsiek@indiana.edu Peter Thiemann Universität Freiburg, Germany thiemann@informatik.uni-freiburg.de

More information

Enumerating Homomorphisms

Enumerating Homomorphisms Enumerating Homomorphisms Andrei A. Bulatov School of Computing Science, Simon Fraser University, Burnaby, Canada Víctor Dalmau 1, Department of Information and Communication Technologies, Universitat

More information

About the relationship between formal logic and complexity classes

About the relationship between formal logic and complexity classes About the relationship between formal logic and complexity classes Working paper Comments welcome; my email: armandobcm@yahoo.com Armando B. Matos October 20, 2013 1 Introduction We analyze a particular

More information

On the Expressive Power of Monadic Least Fixed Point Logic

On the Expressive Power of Monadic Least Fixed Point Logic On the Expressive Power of Monadic Least Fixed Point Logic Nicole Schweikardt Institut für Informatik, Humboldt-Universität Berlin, Unter den Linden 6, D-10099 Berlin, Germany, Email: schweika@informatik.hu-berlin.de,

More information

Introduction to Model Theory

Introduction to Model Theory Introduction to Model Theory Charles Steinhorn, Vassar College Katrin Tent, University of Münster CIRM, January 8, 2018 The three lectures Introduction to basic model theory Focus on Definability More

More information

7 RC Simulates RA. Lemma: For every RA expression E(A 1... A k ) there exists a DRC formula F with F V (F ) = {A 1,..., A k } and

7 RC Simulates RA. Lemma: For every RA expression E(A 1... A k ) there exists a DRC formula F with F V (F ) = {A 1,..., A k } and 7 RC Simulates RA. We now show that DRC (and hence TRC) is at least as expressive as RA. That is, given an RA expression E that mentions at most C, there is an equivalent DRC expression E that mentions

More information

Efficient Reasoning about Data Trees via Integer Linear Programming

Efficient Reasoning about Data Trees via Integer Linear Programming Efficient Reasoning about Data Trees via Integer Linear Programming Claire David Université Paris-Est Claire.David@univ-mlv.fr Leonid Libkin University of Edinburgh libkin@inf.ed.ac.uk Tony Tan University

More information

Basics of Model Theory

Basics of Model Theory Chapter udf Basics of Model Theory bas.1 Reducts and Expansions mod:bas:red: defn:reduct mod:bas:red: prop:reduct Often it is useful or necessary to compare languages which have symbols in common, as well

More information

Finite Model Theory Tutorial. Lecture 1

Finite Model Theory Tutorial. Lecture 1 1 Finite Model Theory Tutorial Lecture 1 Anuj Dawar University of Cambridge Modnet Summer School, Manchester, 14-18 July 2008 2 Finite Model Theory In the 1980s, the term finite model theory came to be

More information

Qualifying Exam Logic August 2005

Qualifying Exam Logic August 2005 Instructions: Qualifying Exam Logic August 2005 If you signed up for Computability Theory, do two E and two C problems. If you signed up for Model Theory, do two E and two M problems. If you signed up

More information

Relations to first order logic

Relations to first order logic An Introduction to Description Logic IV Relations to first order logic Marco Cerami Palacký University in Olomouc Department of Computer Science Olomouc, Czech Republic Olomouc, November 6 th 2014 Marco

More information

Total Ordering on Subgroups and Cosets

Total Ordering on Subgroups and Cosets Total Ordering on Subgroups and Cosets Alexander Hulpke Department of Mathematics Colorado State University 1874 Campus Delivery Fort Collins, CO 80523-1874 hulpke@math.colostate.edu Steve Linton Centre

More information

Characterizing First Order Logic

Characterizing First Order Logic Characterizing First Order Logic Jared Holshouser, Originally by Lindstrom September 16, 2014 We are following the presentation of Chang and Keisler. 1 A Brief Review of First Order Logic Definition 1.

More information

arxiv: v1 [cs.db] 21 Feb 2017

arxiv: v1 [cs.db] 21 Feb 2017 Answering Conjunctive Queries under Updates Christoph Berkholz, Jens Keppeler, Nicole Schweikardt Humboldt-Universität zu Berlin {berkholz,keppelej,schweika}@informatik.hu-berlin.de February 22, 207 arxiv:702.06370v

More information

Overview of Topics. Finite Model Theory. Finite Model Theory. Connections to Database Theory. Qing Wang

Overview of Topics. Finite Model Theory. Finite Model Theory. Connections to Database Theory. Qing Wang Overview of Topics Finite Model Theory Part 1: Introduction 1 What is finite model theory? 2 Connections to some areas in CS Qing Wang qing.wang@anu.edu.au Database theory Complexity theory 3 Basic definitions

More information

Friendly Logics, Fall 2015, Lecture Notes 5

Friendly Logics, Fall 2015, Lecture Notes 5 Friendly Logics, Fall 2015, Lecture Notes 5 Val Tannen 1 FO definability In these lecture notes we restrict attention to relational vocabularies i.e., vocabularies consisting only of relation symbols (or

More information

The constructible universe

The constructible universe The constructible universe In this set of notes I want to sketch Gödel s proof that CH is consistent with the other axioms of set theory. Gödel s argument goes well beyond this result; his identification

More information

Monadic Datalog Containment on Trees Using the Descendant-Axis

Monadic Datalog Containment on Trees Using the Descendant-Axis Monadic Datalog Containment on Trees Using the Descendant-Axis André Frochaux and Nicole Schweikardt Institut für Informatik, Humboldt-Universität zu Berlin {frochaua,schweikn}@informatik.hu-berlin.de

More information

Herbrand Theorem, Equality, and Compactness

Herbrand Theorem, Equality, and Compactness CSC 438F/2404F Notes (S. Cook and T. Pitassi) Fall, 2014 Herbrand Theorem, Equality, and Compactness The Herbrand Theorem We now consider a complete method for proving the unsatisfiability of sets of first-order

More information

CAPTURING POLYNOMIAL TIME USING MODULAR DECOMPOSITION

CAPTURING POLYNOMIAL TIME USING MODULAR DECOMPOSITION Logical Methods in Computer Science Volume 15, Issue 1, 2019, pp. 24:1 24:38 https://lmcs.episciences.org/ Submitted Mar. 30, 2018 Published Mar. 05, 2019 CAPTURING POLYNOMIAL TIME USING MODULAR DECOMPOSITION

More information

Automata Theory and Formal Grammars: Lecture 1

Automata Theory and Formal Grammars: Lecture 1 Automata Theory and Formal Grammars: Lecture 1 Sets, Languages, Logic Automata Theory and Formal Grammars: Lecture 1 p.1/72 Sets, Languages, Logic Today Course Overview Administrivia Sets Theory (Review?)

More information

JUMPS IN SPEEDS OF HEREDITARY PROPERTIES IN FINITE RELATIONAL LANGUAGES

JUMPS IN SPEEDS OF HEREDITARY PROPERTIES IN FINITE RELATIONAL LANGUAGES JUMPS IN SPEEDS OF HEREDITARY PROPERTIES IN FINITE RELATIONAL LANGUAGES MICHAEL C. LASKOWSKI AND CAROLINE A. TERRY Abstract. Given a finite relational language L, a hereditary L-property is a class of

More information

Mathematical Logic (IX)

Mathematical Logic (IX) Mathematical Logic (IX) Yijia Chen 1. The Löwenheim-Skolem Theorem and the Compactness Theorem Using the term-interpretation, it is routine to verify: Theorem 1.1 (Löwenheim-Skolem). Let Φ L S be at most

More information

Comp487/587 - Boolean Formulas

Comp487/587 - Boolean Formulas Comp487/587 - Boolean Formulas 1 Logic and SAT 1.1 What is a Boolean Formula Logic is a way through which we can analyze and reason about simple or complicated events. In particular, we are interested

More information

A MODEL-THEORETIC PROOF OF HILBERT S NULLSTELLENSATZ

A MODEL-THEORETIC PROOF OF HILBERT S NULLSTELLENSATZ A MODEL-THEORETIC PROOF OF HILBERT S NULLSTELLENSATZ NICOLAS FORD Abstract. The goal of this paper is to present a proof of the Nullstellensatz using tools from a branch of logic called model theory. In

More information

Graph Reachability and Pebble Automata over Infinite Alphabets

Graph Reachability and Pebble Automata over Infinite Alphabets Graph Reachability and Pebble Automata over Infinite Alphabets Tony Tan Department of Computer Science Technion Israel Institute of Technology Haifa 32000, Israel Email: tantony@cs.technion.ac.il Abstract

More information

Outline. Formale Methoden der Informatik First-Order Logic for Forgetters. Why PL1? Why PL1? Cont d. Motivation

Outline. Formale Methoden der Informatik First-Order Logic for Forgetters. Why PL1? Why PL1? Cont d. Motivation Outline Formale Methoden der Informatik First-Order Logic for Forgetters Uwe Egly Vienna University of Technology Institute of Information Systems Knowledge-Based Systems Group Motivation Syntax of PL1

More information

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P.

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P. First-Order Logic Syntax The alphabet of a first-order language is organised into the following categories. Logical connectives:,,,,, and. Auxiliary symbols:.,,, ( and ). Variables: we assume a countable

More information

Model Theory on Finite Structures

Model Theory on Finite Structures Model Theory on Finite Structures Anuj Dawar Department of Computer Science University of Wales Swansea Swansea, SA2 8PP, U.K. e-mail: a.dawar@swansea.ac.uk 1 Introduction In mathematical logic, the notions

More information

Generalising Automaticity to Modal Properties of Finite Structures

Generalising Automaticity to Modal Properties of Finite Structures Generalising Automaticity to Modal Properties of Finite Structures Anuj Dawar University of Cambridge Computer Laboratory, Cambridge CB3 0FD, UK. anuj.dawar@cl.cam.ac.uk Stephan Kreutzer Institut für Informatik,

More information

Hasse Diagrams for Classes of Deterministic Bottom-Up Tree-to-Tree-Series Transformations

Hasse Diagrams for Classes of Deterministic Bottom-Up Tree-to-Tree-Series Transformations Hasse Diagrams for Classes of Deterministic Bottom-Up Tree-to-Tree-Series Transformations Andreas Maletti 1 Technische Universität Dresden Fakultät Informatik D 01062 Dresden Germany Abstract The relationship

More information

Propositional and Predicate Logic - VII

Propositional and Predicate Logic - VII Propositional and Predicate Logic - VII Petr Gregor KTIML MFF UK WS 2015/2016 Petr Gregor (KTIML MFF UK) Propositional and Predicate Logic - VII WS 2015/2016 1 / 11 Theory Validity in a theory A theory

More information

Lecture 2: Connecting the Three Models

Lecture 2: Connecting the Three Models IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Advanced Course on Computational Complexity Lecture 2: Connecting the Three Models David Mix Barrington and Alexis Maciel July 18, 2000

More information

Definability in the Enumeration Degrees

Definability in the Enumeration Degrees Definability in the Enumeration Degrees Theodore A. Slaman W. Hugh Woodin Abstract We prove that every countable relation on the enumeration degrees, E, is uniformly definable from parameters in E. Consequently,

More information

On the Satisfiability of Two-Variable Logic over Data Words

On the Satisfiability of Two-Variable Logic over Data Words On the Satisfiability of Two-Variable Logic over Data Words Claire David, Leonid Libkin, and Tony Tan School of Informatics, University of Edinburgh Abstract. Data trees and data words have been studied

More information

Halting and Equivalence of Program Schemes in Models of Arbitrary Theories

Halting and Equivalence of Program Schemes in Models of Arbitrary Theories Halting and Equivalence of Program Schemes in Models of Arbitrary Theories Dexter Kozen Cornell University, Ithaca, New York 14853-7501, USA, kozen@cs.cornell.edu, http://www.cs.cornell.edu/~kozen In Honor

More information

Datalog and Constraint Satisfaction with Infinite Templates

Datalog and Constraint Satisfaction with Infinite Templates Datalog and Constraint Satisfaction with Infinite Templates Manuel Bodirsky 1 and Víctor Dalmau 2 1 CNRS/LIX, École Polytechnique, bodirsky@lix.polytechnique.fr 2 Universitat Pompeu Fabra, victor.dalmau@upf.edu

More information

Hrushovski s Fusion. A. Baudisch, A. Martin-Pizarro, M. Ziegler March 4, 2007

Hrushovski s Fusion. A. Baudisch, A. Martin-Pizarro, M. Ziegler March 4, 2007 Hrushovski s Fusion A. Baudisch, A. Martin-Pizarro, M. Ziegler March 4, 2007 Abstract We present a detailed and simplified exposition of Hrushovki s fusion of two strongly minimal theories. 1 Introduction

More information

Equational Logic. Chapter Syntax Terms and Term Algebras

Equational Logic. Chapter Syntax Terms and Term Algebras Chapter 2 Equational Logic 2.1 Syntax 2.1.1 Terms and Term Algebras The natural logic of algebra is equational logic, whose propositions are universally quantified identities between terms built up from

More information

DIVIDING AND WEAK QUASI-DIMENSIONS IN ARBITRARY THEORIES

DIVIDING AND WEAK QUASI-DIMENSIONS IN ARBITRARY THEORIES DIVIDING AND WEAK QUASI-DIMENSIONS IN ARBITRARY THEORIES ISAAC GODBRING AND HENRY TOWSNER Abstract. We show that any countable model of a model complete theory has an elementary extension with a pseudofinite-like

More information

Factorised Representations of Query Results: Size Bounds and Readability

Factorised Representations of Query Results: Size Bounds and Readability Factorised Representations of Query Results: Size Bounds and Readability Dan Olteanu and Jakub Závodný Department of Computer Science University of Oxford {dan.olteanu,jakub.zavodny}@cs.ox.ac.uk ABSTRACT

More information

Chapter 1 : The language of mathematics.

Chapter 1 : The language of mathematics. MAT 200, Logic, Language and Proof, Fall 2015 Summary Chapter 1 : The language of mathematics. Definition. A proposition is a sentence which is either true or false. Truth table for the connective or :

More information

= 1 2x. x 2 a ) 0 (mod p n ), (x 2 + 2a + a2. x a ) 2

= 1 2x. x 2 a ) 0 (mod p n ), (x 2 + 2a + a2. x a ) 2 8. p-adic numbers 8.1. Motivation: Solving x 2 a (mod p n ). Take an odd prime p, and ( an) integer a coprime to p. Then, as we know, x 2 a (mod p) has a solution x Z iff = 1. In this case we can suppose

More information

Finding Paths with Minimum Shared Edges in Graphs with Bounded Treewidth

Finding Paths with Minimum Shared Edges in Graphs with Bounded Treewidth Finding Paths with Minimum Shared Edges in Graphs with Bounded Treewidth Z.-Q. Ye 1, Y.-M. Li 2, H.-Q. Lu 3 and X. Zhou 4 1 Zhejiang University, Hanzhou, Zhejiang, China 2 Wenzhou University, Wenzhou,

More information

First-Order Logic. Chapter Overview Syntax

First-Order Logic. Chapter Overview Syntax Chapter 10 First-Order Logic 10.1 Overview First-Order Logic is the calculus one usually has in mind when using the word logic. It is expressive enough for all of mathematics, except for those concepts

More information

1 First-order logic. 1 Syntax of first-order logic. 2 Semantics of first-order logic. 3 First-order logic queries. 2 First-order query evaluation

1 First-order logic. 1 Syntax of first-order logic. 2 Semantics of first-order logic. 3 First-order logic queries. 2 First-order query evaluation Knowledge Bases and Databases Part 1: First-Order Queries Diego Calvanese Faculty of Computer Science Master of Science in Computer Science A.Y. 2007/2008 Overview of Part 1: First-order queries 1 First-order

More information

Discrete Mathematics. Benny George K. September 22, 2011

Discrete Mathematics. Benny George K. September 22, 2011 Discrete Mathematics Benny George K Department of Computer Science and Engineering Indian Institute of Technology Guwahati ben@iitg.ernet.in September 22, 2011 Set Theory Elementary Concepts Let A and

More information

0-1 Laws for Fragments of SOL

0-1 Laws for Fragments of SOL 0-1 Laws for Fragments of SOL Haggai Eran Iddo Bentov Project in Logical Methods in Combinatorics course Winter 2010 Outline 1 Introduction Introduction Prefix Classes Connection between the 0-1 Law and

More information

Expressiveness of predicate logic: Some motivation

Expressiveness of predicate logic: Some motivation Expressiveness of predicate logic: Some motivation In computer science the analysis of the expressiveness of predicate logic (a.k.a. first-order logic) is of particular importance, for instance In database

More information

Short Introduction to Admissible Recursion Theory

Short Introduction to Admissible Recursion Theory Short Introduction to Admissible Recursion Theory Rachael Alvir November 2016 1 Axioms of KP and Admissible Sets An admissible set is a transitive set A satisfying the axioms of Kripke-Platek Set Theory

More information

CORES OF COUNTABLY CATEGORICAL STRUCTURES

CORES OF COUNTABLY CATEGORICAL STRUCTURES Logical Methods in Computer Science Vol. 3 (1:2) 2007, pp. 1 16 www.lmcs-online.org Submitted Sep. 23, 2005 Published Jan. 25, 2007 CORES OF COUNTABLY CATEGORICAL STRUCTURES MANUEL BODIRSKY Institut für

More information

VC-DENSITY FOR TREES

VC-DENSITY FOR TREES VC-DENSITY FOR TREES ANTON BOBKOV Abstract. We show that for the theory of infinite trees we have vc(n) = n for all n. VC density was introduced in [1] by Aschenbrenner, Dolich, Haskell, MacPherson, and

More information

Axioms for Set Theory

Axioms for Set Theory Axioms for Set Theory The following is a subset of the Zermelo-Fraenkel axioms for set theory. In this setting, all objects are sets which are denoted by letters, e.g. x, y, X, Y. Equality is logical identity:

More information

logic, cf. [1]. Another area of application is descriptive complexity. It turns out that familiar logics capture complexity classes over classes of (o

logic, cf. [1]. Another area of application is descriptive complexity. It turns out that familiar logics capture complexity classes over classes of (o Notions of locality and their logical characterizations over nite models Lauri Hella Department of Mathematics P.O. Box 4 (Yliopistonkatu 5) 00014 University of Helsinki, Finland Email: lauri.hella@helsinki.fi

More information

What You Must Remember When Processing Data Words

What You Must Remember When Processing Data Words What You Must Remember When Processing Data Words Michael Benedikt, Clemens Ley, and Gabriele Puppis Oxford University Computing Laboratory, Park Rd, Oxford OX13QD UK Abstract. We provide a Myhill-Nerode-like

More information

A Logical Characterization for Weighted Event-Recording Automata

A Logical Characterization for Weighted Event-Recording Automata A Logical Characterization for Weighted Event-Recording Automata June 23, 2009 Karin Quaas Institut für Informatik, Universität Leipzig 04009 Leipzig, Germany quaas@informatik.uni-leipzig.de Abstract.

More information

Gödel s Completeness Theorem

Gödel s Completeness Theorem A.Miller M571 Spring 2002 Gödel s Completeness Theorem We only consider countable languages L for first order logic with equality which have only predicate symbols and constant symbols. We regard the symbols

More information

LTCS Report. Decidability and Complexity of Threshold Description Logics Induced by Concept Similarity Measures. LTCS-Report 16-07

LTCS Report. Decidability and Complexity of Threshold Description Logics Induced by Concept Similarity Measures. LTCS-Report 16-07 Technische Universität Dresden Institute for Theoretical Computer Science Chair for Automata Theory LTCS Report Decidability and Complexity of Threshold Description Logics Induced by Concept Similarity

More information

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Lecture Notes 1 Basic Concepts of Mathematics MATH 352 Lecture Notes 1 Basic Concepts of Mathematics MATH 352 Ivan Avramidi New Mexico Institute of Mining and Technology Socorro, NM 87801 June 3, 2004 Author: Ivan Avramidi; File: absmath.tex; Date: June 11,

More information

A Little Logic. Propositional Logic. Satisfiability Problems. Solving Sudokus. First Order Logic. Logic Programming

A Little Logic. Propositional Logic. Satisfiability Problems. Solving Sudokus. First Order Logic. Logic Programming A Little Logic International Center for Computational Logic Technische Universität Dresden Germany Propositional Logic Satisfiability Problems Solving Sudokus First Order Logic Logic Programming A Little

More information

Part II. Logic and Set Theory. Year

Part II. Logic and Set Theory. Year Part II Year 2018 2017 2016 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2018 60 Paper 4, Section II 16G State and prove the ǫ-recursion Theorem. [You may assume the Principle of ǫ- Induction.]

More information

Automata, Logic and Games: Theory and Application

Automata, Logic and Games: Theory and Application Automata, Logic and Games: Theory and Application 1. Büchi Automata and S1S Luke Ong University of Oxford TACL Summer School University of Salerno, 14-19 June 2015 Luke Ong Büchi Automata & S1S 14-19 June

More information

i times p(p(... (p( n))...) = n ki.

i times p(p(... (p( n))...) = n ki. Chapter 7 NP Completeness Exercise 7.1 Show that an algorithm that makes at most a constant number of calls to polynomial-time subroutines runs in polynomial time, but that a polynomial number of calls

More information

Some hard families of parameterised counting problems

Some hard families of parameterised counting problems Some hard families of parameterised counting problems Mark Jerrum and Kitty Meeks School of Mathematical Sciences, Queen Mary University of London {m.jerrum,k.meeks}@qmul.ac.uk September 2014 Abstract

More information