1 Introduction
Firstorder logic (for short: FO) and its extensions are employed in many fields of theoretical computer science, as for example automata theory, descriptive complexity theory, database theory, and algorithmic metatheorems.
However, it is wellknown that the expressive power of FO is very limited: it can only express local properties. This excludes properties that require a global grasp of the structure, as for example graph connectivity. The theorems by Hanf, by Gaifman, and by Schwentick and Barthelmann [16, 7, 12, 26] are formalisations of the locality of FO and thus facilitate inexpressibility proofs. Moreover, each of these locality theorems gives rise to a normal form for firstorder logic.
In particular, Gaifman’s theorem implies that on the class of all structures, every sentence of FO is equivalent to a Gaifman normal form (gnf), i.e., a Boolean combination of statements of the shape
“There are nodes whose neighbourhoods are pairwise disjoint and which satisfy the same FOdefinable property .”
Hanf’s theorem implies that for every class of structures of bounded degree, each sentence of FO logic is equivalent to a Hanf normal form (hnf), i.e., a Boolean combination of statements of the shape
“There are nodes whose neighbourhoods each have isomorphism type .”
Hanf’s and Gaifman’s theorem have found a plethora of applications in algorithms and complexity (cf., e.g., [27, 10, 23, 4, 20, 21, 28, 13, 1, 22]). In particular, algorithmic metatheorems make use of the local conditions expressed in gnf and hnf to show that on many classes of structures, FO model checking is fixedparameter tractable, and that the results of FO queries can be enumerated with constant delay after a lineartime preprocessing phase.
Schwentick and Barthelmann [26] presented a local normal form for firstorder logic that avoids the “pairwise disjoint neighbourhoods” constraint in Gaifman’s normal form as well as the restriction to classes of structures of bounded degree necessary for Hanf’s normal form. They showed that on the class of all structures, every sentence of FO is equivalent to a single statement of the shape
“ pebbles can be placed such that the neighbourhoods of all nodes in the so extended structure satisfy the same FOdefinable property .”
In the following, we call such statements SchwentickBarthelmann normal form (bsnf). In [26], two applications of bsnf are described: a local variant of EhrenfeuchtFraïssé games [9, 6] which restricts the game to local neighbourhoods after an initial phase [26], and an automata model for firstorder logic.
In the context of algorithmic metatheorems, the question about the efficiency of constructing normal forms has arisen (cf., e.g., [2, 3, 24, 18, 17, 19, 22]). In particular, it was shown in [3] that there is a nonelementary lower bound for the size of gnf in respect to the input sentence if equivalence is required on the class of all finite trees. On the other hand, [2] and [18] provided 3fold exponential algorithms and matching lower bounds for the construction of hnf and gnf, respectively, on classes of structures of bounded degree.
Concerning bsnf, the construction described in [26] is effective, but has nonelementary time complexity. We show (cf. Theorem 8) that this is indeed unavoidable – i.e., even when equivalence of the constructed bsnf to the input sentence is required on the class of all finite forests, a nonelementary blowup in the size cannot be avoided.
For this reason, our main focus lies on an investigation of bsnf on classes of structures of bounded degree. We show that, when equivalence is only required on the class of all structures of degree at most for (), any formula from FO logic can be turned into a bsnf in fold (fold) exponential time in the size of (cf. Theorem 3). We complement both upper bounds by matching lower bounds (cf. Theorem 11 and Theorem 13). In particular, our upper bounds imply corresponding upper bounds on the number of pebbles to be placed in the first stage of the local EhrenfeuchtFraïssé game and on the size of the automata for FO logic described in [26] when restricting attention to classes of structures of bounded degree.
Our algorithm for the construction of bsnf relies on a transformation of FO formulae into hnf, as described in [2, 18, 19]. The most challenging task is to turn socalled typeformulae, which describe the isomorphism type of the neighbourhood of their free variables, into bsnf. Our lower bound proofs use techniques already employed in [29, 11, 8, 3, 2, 18, 17].
The rest of the paper is structured as follows. Section 2 fixes basic notations used throughout the paper. Section 3 presents the algorithm leading to our upper bounds. Section 4 provides the matching lower bounds. Due to space restrictions, some proof details are deferred to an appendix.
Acknowledgements
The authors would like to thank Dietrich Kuske, who brought the normal form of Barthelmann and Schwentick to their attention and posed the question about its complexity. We also would like to thank Nicole Schweikardt for helpful hints on the first version of this paper.
2 Preliminaries
We use to denote the set of natural numbers, i.e., the set of nonnegative integers, and we let . For all with , we write for the set and let if . By we abbreviate the set .
is the set of all reals greater than or equal to . For a real number , we write to denote the logarithm of with respect to base . For every function , we write for the class of all functions for which there exists a number such that for all sufficiently large .
The function is defined by and for all . I.e., is a tower of of height with on top. We furthermore abbreviate . A function is at most fold exponential, for some , if belongs to the class . More generally, is elementary if it is at most fold exponential for some and nonelementary if there is no such .
Signatures and Structures
For signatures, structures, and FO logic, we use the standard notation, cf. [5, 23]. A signature is a finite set of relation symbols and constant symbols . Each relation symbol has an arity . A structure is a tuple , where is a finite and nonempty set, called the universe of , where each relation symbol , , is interpreted by the relation and where each constant symbol , , is interpreted by an element . We write to express that is isomorphic to a second structure .
In the following, we suppose that is a relational signature, i.e., a signature that only contains relation symbols. A structure is a substructure of a structure if and for each . In particular, is the substructure of induced by (for short: ) if for each .
A structure is a disjoint union of structures if the universes are pairwise disjoint, is the union of , and is the union of for all . A structure is a component of if is the disjoint union of and some other structure.
FirstOrder Logic
By we denote the class of all firstorder formulae of signature . That is, is built from atomic formulae of the form and , for and variables or constant symbols , and closed under the Boolean connectives and existential firstorder quantifiers for any variable .^{1}^{1}1As usual, , , , will be used as abbreviations when constructing formulae. By FO we denote the union of all for arbitrary signatures .
The size of an formula is its length when viewed as a word over the alphabet , where Var is a countable set of variable symbols. The quantifier rank of an FOformula is defined as the maximal nesting depth of its quantifiers. By we denote the set of all free variables of . A sentence is a formula with . We write , for with , to indicate that is a subset of .
If is a structure and , we write or to indicate that the formula is satisfied in when interpreting the free occurences of the variables with the elements . Two formulae and over a signature are equivalent, for a class of structures, if for every and , we have if, and only if, . In particular, we call and equivalent if they are equivalent for the class of all structures.
For an formula and a , it is easy to define an formula of size such that for a structure if, and only if, there are at least elements in such that , cf., e.g., [18]. We write for and for .
Gaifman Graph and Classes of Structures of Bounded Degree
Let be a signature and let be a structure. The Gaifman graph of is the undirected and loopfree graph with node set and an edge between two distinct nodes if, and only if, there is an and a tuple , such that . For elements , we denote by the length of a shortest path between and in or if there is no such path. The structure is connected if its Gaifman graph is connected, i.e., if for all .
For each , an formula can be constructed (cf., e.g., [18]) in time for , such that for each structure and all ,
For every and , the neighbourhood of in is the set
and the neighbourhood of a tuple of length is the union of the sets for all .
The degree of is the degree of its Gaifman graph . We say that is bounded, for a degree bound , if no node in has more than neighbours. By we denote the class of all bounded structures. Two formulae and are equivalent if they are equivalent. To bound the cardinality of a neighbourhood in a bounded structure in dependence from its radius , let be defined by
Then, if is bounded, for any element and any , we have . In particular, , , , and for . I.e., is growing linearly for and exponentially for .
Isomorophism Types
Let be a relational signature. For each , we let for pairwise distinct constant symbols . For any , an type (with centres over ) is a structure that consists of a structure and an interpretation for each constant symbol , such that . I.e., every element of has distance to at least one of the ’s. We also call the centres of . If is a structure, for some , and , then denotes the type of in . We say that realise an type with centres if . For short – we often speak of types instead of isomorphism types.
Lemma 1.
Let be a relational signature, let with , and let be a bounded structure. For all , , and , it holds that:

,

if is connected, then for all ,

given , , and , the type of in can be computed in time , and

given two bounded types and with centres over , it can be decided in time whether .
Lemma 2.
There is an algorithm which upon input of a relational signature , a degree bound with , a radius , and a number , computes a set of bounded types with centres over , such that for every bounded type with centres over there is exactly one such that . The algorithm’s runtime is . Furthermore, upon input of a bounded type with centres over , the particular with can be computed in time .
Given an type with centres over , for some and , one can construct a typeformula with such that for every structure and every tuple ,
More precisely, if and for some , the typeformula can be defined by
where is a conjunction of all atomic and negated atomic formulae such that , and are chosen such that for each . Thus, if is bounded for some , the formula can be constructed in time if , and otherwise in time .
Local Formulae and the BarthelmannSchwentick Normal Form
Let be a relational signature. An formula with and is local around if for each structure and all elements ,
We call local around if it is local around for some . As an example, the typeformula is local around if is an type.
A formula is in BarthelmannSchwentick normal form (for short: bsnf) if it has the shape
for an and a formula where every quantification is restricted to elements of the universe of distance at most from , i.e., the formula is local around , for some (cf., [26]). Its locality radius is . A bsnfformula is a formula in bsnf and a bsnfsentence is a sentence in bsnf.
Forests and Trees
A forest is a directed graph where every vertex has indegree at most and whose Gaifman graph is acyclic. A tree is a connected forest. In forests, as well as in trees, nodes of indegree are called roots. By we denote the class of all finite forests. The height of a forest (a tree ) is the length of the longest path in (in ), starting in a (the) root node. denotes the class of all finite forest with height .
3 Upper Bounds
This section’s aim is to show that, in contrast to the nonelementary lower bound on trees of unbounded degree (cf. Theorem 8), BarthelmannSchwentick normal forms can be computed in elementary time when equivalence to the input formula is only required on a class of structures of bounded degree. The main result of this section can be stated as follows:
Theorem 3.
There is an algorithm which, on input of a degree bound with , a relational signature , and a formula from , computes a formula in bsnf that is equivalent to . The algorithm runs in time
where are the number of free variables and the quantifier rank of , respectively.
Remark.
Under the assumption that only contains relation symbols that actually occur in and since , the algorithm of Theorem 3 runs in time
The algorithm described in Theorem 3 relies on the construction of Hanf normal forms described in [2, 18, 19] and proceeds in the following four steps, which are carried out in detail in the subsequent Section 3.1, 3.2, 3.3, and 3.4, respectively:

The input formula is transformed into a equivalent positive Hanf normal form . Intuitively, a positive Hanf normal form is built from the following subformulae using only the logical connectives and :

Countingsentences, which either state that there are at least elements that realise a given type or that there are precisely elements that realise a given type.

Typeformulae, which check whether the interpretation of their free variables realises a given type.


Each countingsentence in is replaced by an equivalent sentence in bsnf.

Each typeformula in is replaced by a equivalent formula in bsnf.

The formula obtained from the latter two steps is a positive Boolean combination of sentences and formulae in bsnf. We use a procedure from [26] to turn this positive Boolean combination into a single equivalent formula in bsnf.
In the remainder of this section, will always denote a relational signature.
3.1 (Positive) Hanf Normal Form
In this section, we recall the notion of Hanf normal form (hnf) from [19] and introduce its syntactical restriction to positve Hanf normal form ().
A thresholdcountingsentence has the shape
where and, for some , is an type with one centre. A structure satisfies if, and only if, there are pairwise distinct elements in that realise .
An formula is in Hanf normal form (for short: hnf) if it is a Boolean combination of typeformulae and thresholdcountingsentences. Its locality radius is the maximum radius of all its typeformulae.
Theorem 4 ([2, 18, 19]).
There is an algorithm which, on input of a degree bound with , a relational signature , and a formula with quantifier rank from , computes a formula in hnf that is equivalent to and that has locality radius . The algorithm runs in time
In the following, we also consider exactcountingsentences of the shape for arbitrary . We will subsume exactcountingsentences and thresholdcountingsentences under the name countingsentences. The reason for introducing exactcountingsentences is that in the notion of positive Hanf normal form, introduced in the following, negations are only allowed inside of typeformulae and countingsentences, but not in the Boolean combination that connects these.
A formula is in positive Hanf normal form (for short: ) if it is a positive Boolean combination (i.e., a Boolean combination that only uses the connectives and ) of typeformulae and countingsentences. can be obtained from hnf:
Lemma 5.
There is an algorithm which, on input of a degree bound with , a relational signature , and a formula with quantifier rank from , computes a formula in that is equivalent to and that has locality radius . The algorithm runs in time

On input of a degree bound with , a relational signature , and a formula from with quantifier rank and free variables, the algorithm proceeds as follows:

Using the algorithm described in Theorem 4, is turned into a equivalent formula in hnf that has locality radius .

Using de Morgan’s law and the elemination of double negations, is turned into a Boolean combination of typeformulae and thresholdcountingsentences whose negations only occur directly in front of a thresholdcountingsentence or a typeformula.

In the formula just constructed, we replace each negated typeformula by a equivalent positive Boolean combination of typeformulae and each negated thresholdcountingsentence by an equivalent positive Boolean combination of exactcountingsentences:

Each subformula of the shape is equivalently replaced by the disjunction of all exactcountingsentences for all .

Consider a subformula of the shape , where, for an , is an type with centres and is a subtuple of of length . This formula is equivalent to the disjunction of all typeformula for all with (recall from Lemma 2 that is a set of representatives of the isomorphism classes of all bounded types with centres over ).

Clearly, the resulting formula also has locality radius . The time complexity of the algorithm is determined by the upper bounds provided by Theorem 4 and Lemma 2. A detailed analysis is deferred to Appendix A.1. ∎

In the following two sections, we will describe how countingsentences and typeformulae can be turned into bsnfformulae.
3.2 From CountingSentences to BSNF
In this section, we show that every countingsentence can be turned into a bsnfsentence that is equivalent to – not only on a class of structures of bounded degree, but on the class of all structures.
Lemma 6.
There is an algorithm which, on input of a countingsentence computes an equivalent sentence in bsnf in time .

The algorithm distinguishs on the possible shapes of the countingsentence . In each case, it is easy to verify that the provided bsnfsentence is indeed equivalent to .

A thresholdcountingsentence with is equivalent to the bsnfsentence

An exactcountingsentence with is equivalent to the bsnfsentence

An exactcountingsentence is equivalent to the bsnfsentence .
The analysis of the time complexity of the algorithm boils down to an analysis of the size of the constructed bsnfsentence and is deferred to Appendix A.2. ∎

3.3 From Typeformulae to BSNF
Aim of this section is to turn typeformulae into equivalent formulae in bsnf.
Lemma 7.
There is an algorithm which, on input of a degree bound with , a relational signature , and a typeformula , where, for some and , is an type with centres over , computes a formula in bsnf that is equivalent to and that has locality radius . The algorithm runs in time

We describe the algorithm on input of a degree bound with , a relational signature , and a typeformula . Let and be the radius and the number of centres of , respectively. I.e., and has the shape for a structure and centres such that .
Suppose that , for a suitable , are the connected components of . Then, each of the centres of belongs to precisely one of the structures , and each of the structures contains at least one of these centres. For each ,

let denote the number of centres among that belong to , and

let with be the nonempty set of indices of all centres that belong to , i.e., such that if, and only if, , and

let .
Note that, as a consequence of Lemma 1, for each when choosing
Furthermore, if are distinct and , , then and have distance in . I.e., and do not intersect and there are no edges in the Gaifman graph of between elements of the two sets (see Figure 1 for an illustration).
The following claim is the crucial step in constructing the desired bsnfformula. It shows that for each there is a “typeformula” for the type which is local around the single variable (instead of being local around all its free variables) and which additionally verifies that the centres belonging to the other connected components of are sufficiently far away.
Claim 1.
Let . There is an formula which is local around the single free variable such that the following holds: If is a bounded structure and , then if, and only if, the following conditions are satisfied:

and

for each , the sets and do not intersect and there are no edges in the Gaifman graph of between elements of the two sets.
Before proving Claim 1, let us first show how these local formulae can be used to obtain the final bsnfformula that is equivalent to .
For this, let be a variable that is distinct to each of the variables in the tuple . For each , let be the tuple of variables obtained from by replacing the variable with . Then, can be chosen as the formula
In particular, note that each of the formulae for is local around and thus, the whole universally quantified subformula of is local around . The equivalence of ) to can easily be shown using the assumption on the shape of and the two conditions of Claim 1.
We now turn to the proof of Claim 1. Let and let denote a set of representatives of the isomorphism classes of all bounded types with centres such that , i.e., all elements have distance at most from , and .
Claim 2.
For each type , there is an formula that is local around the free variable and for each bounded structure and all , it holds that if, and only if, the following conditions hold:


Condition (2) of Claim 1 holds. I.e., for each element with , the distance of to each of the elements is at least .
Observe that, by definition of the set , for each bounded structure and every tuple , if, and only if, there is an type such that . Thus, using the formulae provied by Claim 2, we can let be the disjunction of the formulae for all . In particular, is local around since already each of the formulae for is local around .

Comments
There are no comments yet.