BALDER TEN CATE Luc Segoufin
email: luc.segoufin@inria.fr

UNARY NEGATION

Keywords: 1998 ACM Subject Classification: F.4.1 [Mathematical Logic and Formal Languages]: Mathematical Logic, H.2.3 [Database Management]: Languages First-Order Logic, Fixpoint Logic, Decidable Fragments, Satisfiability, Model Checking, Craig Interpolation. Balder

We study fragments of first-order logic and of least fixed point logic that allow only unary negation: negation of formulas with at most one free variable. These logics generalize many interesting known formalisms, including modal logic and the µcalculus, as well as conjunctive queries and monadic Datalog. We show that satisfiability and finite satisfiability are decidable for both fragments, and we pinpoint the complexity of satisfiability, finite satisfiability, and model checking. We also show that the unary negation fragment of first-order logic is model-theoretically very well behaved. In particular, it enjoys Craig Interpolation and the Projective Beth Property.

Introduction

Vardi [START_REF] Vardi | Why is modal logic so robustly decidable? In Descriptive Complexity and Finite Models[END_REF] raised the question "why is modal logic so robustly decidable?". His explanation centers around the fact that modal logic has the tree-model property. More precisely, modal logic enjoys a combination of three properties, namely (i) the tree-model property (if a sentence has a model, it has a model that is a tree), (ii) translatability into tree automata (each formula can be transformed into a tree automaton, or equivalently, an MSO formula, recognizing its tree models), and (iii) the finite model property (if a formula has a model, it also has a finite model). These three properties form a powerful explanation for the decidability of the satisfiability problem, and the finite satisfiability problem, for modal logic and many of its extensions such as the modal µ-calculus. The guarded fragment of first-order logic (GFO) was proposed by Andréka, van Benthem and Németi [START_REF] Andréka | Modal languages and bounded fragments of predicate logic[END_REF] as a large fragment of first-order logic that generalizes modal logic while essentially retaining these properties. It consists of FO formulas in which all quantifiers are "guarded" by atomic formulas. GFO has the tree-like model property (if a sentence has a model, it has a model of bounded tree width), it can be translated into tree automata (each formula can be transformed into a tree automaton recognizing the tree decompositions of its models of bounded tree width) and it has the finite model property [START_REF] Andréka | Modal languages and bounded fragments of predicate logic[END_REF][START_REF] Grädel | On the restraining power of guards[END_REF].

In this paper we provide another, orthogonal generalization of modal logic that enjoys the same nice properties. We introduce UNFO, a fragment of FO in which negation is restricted to formulas having only one free variable. UNFO is incomparable in terms of expressive power to GFO. It generalizes modal logic, as well as other formalisms, such as conjunctive queries, that are not contained in GFO. We show that UNFO has the tree-like model property, is translatable into tree-like automata (in the sense described above), and has the finite model property. Hence UNFO, too, is robustly decidable.

We also introduce UNFP, which extends UNFO with least and greatest monadic fixpoints, in the same way that the µ-calculus extends modal logic [START_REF] Kozen | Results on the propositional µ-calculus[END_REF], and guarded fixpoint logic (GFP) extends GFO [START_REF] Grädel | Guarded fixed point logic[END_REF]. UNFP generalizes the µ-calculus but also monadic Datalog and remains incomparable with GFP. It still has the tree-like model property and can be translated into MSO, but it no longer has the finite model property. Nevertheless, we show that finite satisfiability for UNFP is decidable (note that the decidability of the analogous problem for GFP was only recently solved in [START_REF] Bárány | Finite satisfiability for guarded fixpoint logic[END_REF]). More precisely, the satisfiability problem is 2ExpTime-complete, both for UNFO and for UNFP, both on arbitrary and finite structures.

We also study the model checking problem. In contrast with GFO, whose model checking problem is PTime-complete [START_REF] Berwanger | Games and model checking for guarded logics[END_REF], we show that for UNFO it is complete for P NP[O(log 2 n)] , providing one of the few natural complete problems for that complexity class. For UNFP, model checking is hard for P NP and contained in NP NP ∩ coNP NP . The gap between the upper bound and the lower bound reflects a similar open problem for GFP and the µ-calculus where the model checking problem lies between PTime and NP ∩ coNP [START_REF] Berwanger | Games and model checking for guarded logics[END_REF].

UNFO is not only computationally but also model-theoretically very well behaved. We characterize the expressive power of UNFO in terms of an appropriate notion of invariance, and we show that UNFO has Craig Interpolation as well as the Projective Beth Property. Note that Craig Interpolation fails for GFO [START_REF] Hoogland | Interpolation and definability in guarded fragments[END_REF]. On trees, UNFO and UNFP correspond to well-known existing formalisms.

Outline of the paper. In Section 2, we formally introduce UNFO and UNFP, and we review relevant background material on modal logics and computational complexity. In Section 3 we develop the model theory of UNFO and UNFP: we introduce an appropriate notion of bisimulations, we state a finite model property and a tree-like model property, we obtain model theoretic characterizations, and we prove Craig Interpolation and the Projective Beth Property for UNFO. In Section 4, we show that the satisfiability problem for UNFO, and for UNFP, is 2ExpTime-complete, both on arbitrary structures and on finite structures. In Section 5, we map out the complexity of the model checking problem, that is, the problem of evaluating a formula in a given finite structure. In Section 6, we study the expressive power of UNFO and UNFP on tree structures. We conclude in Section 7 with a comparison with other work, in particular on guarded negation logics.

This paper is the journal version of [START_REF] Cate | Unary negation[END_REF]. It contains new and simpler proofs for many of the results as well as new results, such as the characterization theorem in the finite case, cf. Theorem 3.8.

Preliminaries

We consider relational structures. A relational schema is a finite set of relation symbols fixing an arity to each relation. A model, or structure, M over a relational schema σ is a set dom(M ), the domain of M , together with an interpretation R M to each relation symbol R of σ as a relation over the domain of the arity given by the schema. A model is said to be finite if its domain is finite. We assume familiarity with first-order logic, FO, and least fixpoint logic, LFP, over relational structures. We use classical syntax and semantics for FO and LFP. In particular we write M |= φ(u) or (M, u) |= φ(x) for the fact that the tuple u of elements of the model M makes the FO-formula, or LFP-formula, φ(x) true on M .

Given a structure M and a set X ⊆ dom(M ) we denote by M |X the substructure of M induced by X.

2.1. UNFO and UNFP. We define the unary-negation fragment of first-order logic (UNFO), as the fragment of FO given by the following grammar (where R is an arbitrary relation name from the underlying schema):

φ ::= R(x) | x = y | φ ∧ φ | φ ∨ φ | ∃xφ | ¬φ(x)
where, in the last clause, φ has no free variables besides (possibly) x. Throughout this paper, we will keep using the notation φ(x) to indicate that a formula has at most one free variable. In other words, UNFO is the restriction of FO where negation is only allowed if the subformula has at most one free variable. In particular x = y is not expressible in UNFO.

We say that a formula of UNFO is in UN-normal form if, in the syntax tree of the formula, every existential quantifier (except for the root of the syntax tree) is either directly below another existential quantification, or the subformula starting with that quantifier has at most one free variable. In other words, formulas in UN-normal form are existential positive formulas in prenex normal form where each atom is either a positive atom over the underlying schema or a possibly negated formula with at most one free variable in UN-normal form.

For instance the formula ∃x∃y(R(x, y)∧∃zS(x, y, z)) is not in UN-normal form. However the equivalent formula ∃x∃y∃z (R(x, y) ∧ S(x, y, z)) is in UN-normal form. Similarly the formula ∃x(R(x) ∧ ∃y(R(y) ∧ ∃z(R(z) ∧ (∃xS(x, y, z))))) is not in UN-normal form, but each of the equivalent formulas ∃x∃y∃z∃x ′ R(x) ∧ R(y) ∧ R(z) ∧ S(x ′ , y, z) and ∃x(R(x) ∧ ∃y∃z∃x(R(y) ∧ R(z) ∧ S(x, y, z)) is.

Every formula of UNFO can be transformed into an equivalent formula in UN-normal form in linear time by "pulling out existential quantifiers" as soon as the corresponding subformula has more than one free variable, using the following two rewrite rules: φ ∧ ∃xψ ≡ ∃x(φ ∧ ψ) provided that x does not occur free in φ φ ∨ ∃xψ ≡ ∃x(φ ∨ ψ) provided that x does not occur free in φ (together with safe renaming of variables where needed). For instance, starting with ∃x(R(x) ∧ ∃y(R(y) ∧ ∃z(R(z) ∧ (∃xS(x, y, z)))))

one could obtain: ∃x(R(x) ∧ ∃y∃z∃x(R(y) ∧ R(z) ∧ S(x, y, z)))

Bringing a UNFO formula into UN-normal form may increase the number of variables occurring in the formula, because applying the above rewrite rules may require renaming bound variables. A formula of UNFO is said to be of width k if it can be put in UN-normal form using the above rules in such a way that the resulting formula uses at most k variables. The width of the above formula is therefore 3. We denote by UNFO k the set of all UNFO formulas of width k.

In order to define unary-negation fixpoint logic (UNFP) we introduce extra unary predicates that will serve for computing unary fixpoints. We denote the unary predicates given by the relational schema using the letters P, Q . . . and the unary predicates serving for computing the fixpoints by X, Y . . .. By UNFO(X) we mean UNFO defined over the schema extended with the unary predicates X. In particular it allows formulas of the form ¬φ(x, X). UNFP is the extension of UNFO(X) by means of the following least fixpoint construction:

[LFP X,x φ(X, X, x)](y) where X occurs only positively in φ. An analogous greatest fixed point operator is definable by dualization. Note that no first-order parameters (i.e., free variables in the body of φ other than x) are permitted.

Note that UNFP is a syntactic fragment of least fixpoint logic (LFP), i.e., the extension of full first-order logic with the least fixpoint operator. Therefore, we can simply refer to the literature on LFP for the semantics of these formulas (cf. for example [START_REF] Libkin | Elements of Finite Model Theory[END_REF]). However, we will discuss the semantics of the least fixpoint operator here in some detail, because our arguments later on will refer to it. Consider any UNFP formula of the form [LFP X,x φ(X, X, x)](y) and any structure (M, S), where S is a collection of subsets of the domain of M that form the interpretation for X. Since X occurs in φ only positively, φ(X, X, x)](y) induces a monotone operation O φ on subsets of the domain of M , where O φ (A) = {a ∈ dom(M ) | (M, S, A) |= φ(a)}. By the Knaster-Tarski fixpoint theorem, this monotone operation has a unique least-fixpoint. By definition, an element b ∈ dom(M ) satisfies the formula [LFP X,x φ(X, X, x)](y) in (M, S) if and only if b belongs to this least fixpoint. The least fixpoint of the monotone operation O φ is known to be the intersection of all its pre-fixed points, i.e., {A ⊆ dom(M ) | A ⊇ O φ (A)}, and it can be equivalently characterized as O φ κ (∅), where κ = |dom(M )|, O φ 0 (∅) = ∅; for all successor ordinals λ + 1, O φ λ+1 (∅) = O φ (O φ λ (∅)); and for all limit ordinals λ ≤ κ, O φ λ (∅) = λ ′ <λ O φ λ ′ (∅). The same definition of the UN-normal form applies to UNFP. As in the case of UNFO, we say that a UNFP formula has width k if, when put in UN-normal form, it uses at most k first-order variables. In other words, a formula of UNFP has width k if all the "UNFO(X)parts" of its subformulas have width k. We denote by UNFP k the set of all UNFP formulas of width k.

The negation depth of a UNFO or UNFP formula will also be an important parameter. It is the maximal nesting depth of negations in its syntax tree.

Example 2.1. Two examples of UNFO formulas are ∃yzu(R(x, y) ∧ R(y, z) ∧ R(z, u) ∧ R(u, x)), which expresses the fact that x lies on a directed R-cycle of length 4, and its negation ¬∃yzu(R(x, y) ∧ R(y, z) ∧ R(z, u) ∧ R(u, x)). It follows from known results [START_REF] Andréka | Modal languages and bounded fragments of predicate logic[END_REF] that neither can be expressed in the guarded fragment, and therefore, these examples show that UNFO can express properties that are not definable in the guarded fragment. On the other hand, we will see in Section 3.1 that the guarded-fragment formula ∀xy(R(x, y) → S(x, y)) has no equivalent in UNFO, and therefore, the two logics are incomparable in expressive power.

A conjunctive query (CQ) is query defined by a first-order formula of the form

∃x 1 • • • x n τ 1 ∧ • • • ∧ τ l ,
where each τ i is a (positive) atomic formula. A union of conjunctive queries (UCQ) is a query defined by a finite disjunction of first-order formulas of the above form. Clearly, every UCQ is definable in UNFO. In fact, UNFO can naturally be viewed as the extension of the language of UCQs with unary negation. It is also worth noting that, in a similar way, all monadic datalog queries (i.e., datalog queries in which all IDB relations are unary [START_REF] Cosmadakis | Decidable optimization problems for database logic programs[END_REF]) are definable in UNFP. It was shown in [START_REF] Cosmadakis | Decidable optimization problems for database logic programs[END_REF] that query containment is decidable in 2ExpTime for monadic datalog. As the containment of two unary Datalog programs can be expressed in UNFP, the decidability of UNFP in 2ExpTime, cf. Theorem 4.5, generalizes this result. We also mention that the query containment problem was recently shown to be hard for 2Exptime [START_REF] Benedikt | Monadic Datalog Containment[END_REF], hence the lower bound of Theorem 4.5 also follows from this fact.

2.2.

Modal logic and bisimulation. UNFO and UNFP can be viewed as extensions of modal logic and the µ-calculus, and, actually, of their global two-way extensions. As several of our proofs will make reductions to the modal logic case, we now review relevant definitions and results regarding global two-way modal logic and the global two-way µ-calculus.

We view a Kripke structure as a relational structure over a schema consisting of unary and binary relations. Modal logics are languages for describing properties of nodes in Kripke structures. Intuitively, modal formulas can navigate Kripke structures by traversing edges in a forward or backward direction.

We will use ML to denote the modal language with forward and backward modalities, and with the global modality, as defined by the following grammar.

φ ::= P | φ ∧ φ | ¬φ | R φ | R -1 φ | Sφ
where P is a unary relation symbol (also called proposition letter in this setting), and R is a binary relation symbol (also called an accessibility relation in this context). Disjunction and the "box operators" [R] and [R -1 ] are definable as duals of conjunction, R and

R -1 , respectively (for instance [R]φ is ¬ R ¬φ).
The semantics of ML can be given via a translation into UNFO: For each ML formula φ we construct by induction, as explained in Figure 1, a UNFO formula φ * (x) such that for each Kripke structure M and node a we have M |= φ * (a) iff a has the property φ on M .

We refer to ML as global two-way modal logic, because it includes the global modal operator S and the inverse modal operators R -1 (and their duals). Traditionally, the basic modal logic is defined without those features and can only navigate by traversing an edge in the forward direction.

The global two-way µ-calculus , which we denote by ML µ , is obtained by adding fixpoint variables and a least fixpoint operator to the language of ML: fixpoint variables are admitted as atomic formulas, and whenever φ is a formula of ML µ in which a fixpoint variable X occurs only positively (under an even number of negations), then µXφ is again a valid

(P ) * (x) = P (x) (φ ∧ ψ) * (x) = φ * (x) ∧ ψ * (x) (¬φ) * (x) = ¬φ * (x) ( R φ) * (x) = ∃y R(x, y) ∧ φ * (y) ( R -1 φ) * (x) = ∃y R(y, x) ∧ φ * (y) (Sφ) * (x)
= ∃y φ * (y)

Figure 1: Inductive translation of an ML-formula φ to an equivalent UNFO-formula φ * (x) formula of ML µ , and it denotes the fixpoint of the monotone operation on sets defined by φ(X). An analogous greatest fixpoint operator is definable as the dual of the least fixpoint operator. Adding the rule

(µXφ) * (x) = [LFP X,y φ * (y)](x)
to the table of Figure 1 shows that ML µ can be seen as a fragment of UNFP. We know from [START_REF] Fisher | Propositional dynamic logic of regular programs[END_REF][START_REF] Vardi | Reasoning about the past with two-way automata[END_REF] that the satisfiability problem for ML and for ML µ , on arbitrary Kripke structures, is ExpTime-complete. Although ML has the finite model property [START_REF] Fisher | Propositional dynamic logic of regular programs[END_REF], that is, every satisfiable ML-formula is satisfied in some finite Kripke structure, the same does not hold for ML µ , and therefore the satisfiability problem for ML µ on finite structures is not the same problem as the satisfiability problem for ML µ on arbitrary structures. Nevertheless, it was shown in [START_REF] Bojańczyk | Two-way alternating automata and finite models[END_REF] that the satisfiability problem for ML µ on finite Kripke structures is ExpTime-complete. Theorem 2.2. [START_REF] Vardi | Reasoning about the past with two-way automata[END_REF][START_REF] Bojańczyk | Two-way alternating automata and finite models[END_REF] Testing whether a formula of ML µ is satisfiable is ExpTimecomplete, both on arbitrary Kripke structures and on finite structures.

We note that, while the two-way modal µ-calculus as defined in [START_REF] Vardi | Reasoning about the past with two-way automata[END_REF][START_REF] Bojańczyk | Two-way alternating automata and finite models[END_REF] does not include the global modality S, the results from [START_REF] Bojańczyk | Two-way alternating automata and finite models[END_REF] immediately extend to full ML µ .

Modal formulas are invariant for bisimulation [START_REF] Van Benthem | Modal Logic and Classical Logic[END_REF]. Here, due to the backward modal operators and the global modal operator, we need global two-way bisimulations (see for example [START_REF] Otto | Modal and guarded characterisation theorems over finite transition systems[END_REF]). Given two Kripke structures M and N a global two-way bisimulation between M and N is a binary relation Z ⊆ M × N such that the following hold for every pair (a, b) ∈ Z and every relation symbol R:

• a ∈ P M if and only if b ∈ P N , for all unary relation symbols P .

• for every a ′ with (a, a

′ ) ∈ R M there is a b ′ such that (b, b ′ ) ∈ R N and (a ′ , b ′ ) ∈ Z, • for every b ′ with (b, b ′ ) ∈ R N there is an a ′ such that (a, a ′ ) ∈ R M and (a ′ , b ′ ) ∈ Z, • for every a ′ with (a ′ , a) ∈ R M there is a b ′ such that (b ′ , b) ∈ R N and (a ′ , b ′ ) ∈ Z, • for every b ′ with (b ′ , b) ∈ R N there is an a ′ such that (a ′ , a) ∈ R M and (a ′ , b ′ ) ∈ Z, • for every node a ′ of M there is a node b ′ of N such that (a ′ , b ′ ) ∈ Z, • for every node b ′ of N there is a node a ′ of M such that (a ′ , b ′ ) ∈ Z, We write M ≈ N if
there is a global two-way bisimulation between M and N , and we write (M, a) ≈ (N, b) if the pair (a, b) belongs to a global two-way bisimulation between M and N . Recall that a homomorphism h : M → N is a map from the domain of M to the domain of N such that for all relation symbols R and tuples (a 1 , . . . , a n ) ∈ R M , we have that (h(a 1 ), . . . , h(a n )) ∈ R N . We say that M is a ≈-cover of N if there is a homomorphism h : M → N such that (M, a) ≈ (N, h(a)) for every element a of M . In addition, for h(a ′ ) = a, we say that (M, a ′ ) is a ≈-cover of (N, a).

One can equivalently view bisimulations as strategies for a player in a two-player game. In this game, the two players, called Abelard en Eloïse, maintain a pair (a, b) of elements, one in each structure. Intuitively, one can think of a pebble lying on each of these two selected nodes. At any time during the game, the pebbled nodes must satisfy the same unary predicates in the two structures. A move of Abelard consists of choosing one of the two pebbles (i.e., one of the two structures), and either sliding the pebble forward or backward along an edge belonging to some binary relation R, or moving it to an arbitrary position. Then Eloïse must respond in the other structure with a move mimicking Abelard's move, that is, either sliding her pebble along an edge belonging to the same relation R (and in the same direction), or moving it to an arbitrary position, depending on Abelard's move. If Eloïse cannot respond with a valid move, Abelard wins. It is easy to see that (M, a) ≈ (N, b) if and only if, starting in (a, b), Eloïse has a strategy that allows her to play forever without letting Abelard win. We also write (M, a) ≈ l (N, b) if, starting in (a, b), Eloïse has a strategy that avoids losing in the first l rounds.

It is well known that ML µ -formulas are invariant for global two-way bisimulations: if (M, a) ≈ (N, b) and if φ is a formula of ML µ , then (M, a) |= φ if and only if (N, b) |= φ. This basic fact of ML µ has an important consequence: if a µ-calculus formula has a model, then it has a, possibly infinite, acyclic model, obtained by "unraveling" the original model along its paths while preserving bisimulation equivalence. If we restrict attention to finite Kripke structures, then, in general, acyclicity may not be achievable. For example, the one-element structure consisting in a self-loop is not bisimilar to any finite acyclic structure. However, over finite structures, a weaker form of acyclicity can be achieved. For a natural number l, a Kripke structure is called l-acyclic if its underlying graph contains no cycle of length less than l. We will make use of the following important result: Theorem 2.3. [START_REF] Otto | Modal and guarded characterisation theorems over finite transition systems[END_REF] For all l ∈ N, every finite Kripke structure has a finite l-acyclic ≈-cover.

This was used to show the following property, which is relevant for us as well. We write (M, a) ≡ FO q (N, b) if (M, a) and (N, b) satisfy the same first-order formulas of quantifier depth q.

Theorem 2.4. [START_REF] Otto | Modal and guarded characterisation theorems over finite transition systems[END_REF]Proposition 33] For each q ∈ N there is a l ∈ N such that whenever (M, a) ≈ l (N, b), then (M, a) and (N, b) have ≈-covers (M ′ , a ′ ) and (N ′ , b ′ ), respectively, such that (M ′ , a ′ ) ≡ FO q (N ′ , b ′ ). Moreover, if M and N are finite then M ′ and N ′ can be chosen to be finite as well.

2.3.

Overview of relevant oracle complexity classes. We briefly review a number of complexity classes involving restricted access to an oracle, which turn out to be relevant for our present investigation, and may not be very well known. The reader interested to learn more about these classes would benefit from reading the literature cited below, as well as [START_REF] Schnoebelen | Oracle circuits for branching-time model checking[END_REF] and [START_REF] Gottlob | NP trees and Carnap's modal logic[END_REF] that inspired us a lot.

The first class we use is denoted P NP , also known as ∆ p 2 . It consists of all problems that are computable by a Turing machine running in time polynomial in the size of its input, where the Turing machine, at any point during its computation, can ask yes/no queries to an NP oracle, and take the answers of the oracle into account in subsequent steps of the computation (including subsequent queries to the NP oracle). Analogously, one can define the classes NP NP and coNP NP , which are also known as Σ p 2 and Π p 2 , respectively. An example of a P NP -complete problem is LEX(SAT), which takes as input a Boolean formula φ(x 1 , . . . x n ) and asks what is the value of x n in the lexicographically maximal solution (where x n is treated as the least significant bit in the ordering) [START_REF] Wagner | More Complicated Questions about Maxima and Minima, and some Closures of NP[END_REF].

A subclass of P NP is P NP[O(log n)] . It is defined in the same way as P NP , except that the number of yes/no queries that can be asked to the NP oracle is bounded by O(log(n)), where n is the size of the input. There is an equivalent characterization of this class, denoted P NP || in [START_REF] Buss | On truth-table reducibility to SAT[END_REF]. It consists of all problems computable using a Turing machine running in time polynomial in the size of its input, where the Turing machine can call the oracle only once (or a constant number of times, as this turns out not to make a difference), but in doing so it may ask the oracle several (polynomially many) yes/no questions in parallel [START_REF] Buss | On truth-table reducibility to SAT[END_REF]. In other words, the answer to a query cannot be used by the Turing machine in choosing which subsequent queries to ask to the oracle. A third equivalent characterization of P NP[O(log n)] is as the class of problems that are PTime truth-table reducible to NP [START_REF] Buss | On truth-table reducibility to SAT[END_REF], that is, problems for which there is a PTime algorithm that, given an instance of the problem, produces a set y 1 , • • • , y n of inputs to some NP oracle, together with a Boolean formula φ(x 1 , • • • , x n ), such that the input is a yes-instance iff φ evaluates to true after replacing each x i by 1 if y i is accepted by the NP oracle and 0 otherwise. An example of a P NP[O(log n)] -complete problem is the problem whether two graphs have the same chromatic number [START_REF] Wagner | More Complicated Questions about Maxima and Minima, and some Closures of NP[END_REF].

Finally, in between P NP[O(log n)] and P NP lies a hierarchy of classes P NP[O(log i n)] with i > 1. They are defined in the same way as P NP[O(log n)] except that the number of queries to the oracle is bounded by O(log i (n)). Each class P NP[O(log i n)] can be equivalently characterized as the class of problems that can be solved in polynomial time allowing O(log i-1 (n)) many rounds of parallel queries to an NP oracle [START_REF] Castro | Complexity classes between θ p k and δ p k[END_REF].

There are few known natural complete problems for the classes P NP[O(log i n)] . We introduce here a complete problem LEX i (SAT) that we will make use of later on in our lower bound proofs. Recall that LEX(SAT) is the problem to decide, given a Boolean formula φ(x 1 , . . . , x n ), whether the value of x n is 1 in the lexicographically maximal solution. Here, x 1 is treated as the most significant bit and x n as the least significant bit in the ordering. Similarly, for i ≥ 1, we define LEX i (SAT) to be the problem of testing, given a Boolean formula φ(x 1 , . . . , x n ) and a number k ≤ log i (n), whether the value of x k is 1 in the lexicographically maximal solution.

Theorem 2.5. LEX i (SAT) is P NP[O(log i n)] -complete.
Proof. The upper bound proof is immediate. In order to test whether the value of x 1 is 1 in the lexicographically maximal solution it is enough to ask the oracle whether the Boolean formula φ(1, x 2 , . . . , x n ) has a solution or not. Depending on the result we continue with φ(1, x 2 , . . . , x n ) or φ(0, x 2 , . . . , x n ) and with j calls to the oracle we learn this way the value of x 1 , . . . , x j in the lexicographically maximal solution.

The lower bound proof is a straightforward adaptation of the proof in [START_REF] Wagner | More Complicated Questions about Maxima and Minima, and some Closures of NP[END_REF] that LEX(SAT) is P NP -complete. Let A be any problem in P NP[O(log i n)] , let M be a deterministic polynomialtime Turing machine accepting A using an oracle for a problem B ∈ NP, and let M ′ be a non-deterministic polynomial-time Turing machine accepting B. Let f (n) = O(log i (n)) be a function bounding the number of oracle queries asked by M on an input of size n.

Recall the textbook proof of NP-hardness of propositional satisfiability (cf., for example, [START_REF] Wagner | Computational Complexity[END_REF]), which is based on efficiently constructing a Boolean formula describing runs of a given non-deterministic polynomial-time Turing machine. By the same construction, we can efficiently compute a Boolean formula

H n (x, u, v 1 , . . . , v f (n) , z 1 , . . . , z f (n) , z)
(in fact, a conjunction of clauses with 3 literals per clause), parametrized by a natural number n, whose satisfying assignments describe the runs of M on input words of length n, where [START_REF] Andréka | Modal languages and bounded fragments of predicate logic[END_REF] x describes an input word of length at most n (2) u describes the sequence of configurations of M during the run (including tape content, head position and state in each configuration), (3) v j describes the j-th query asked to the oracle, (4) z j describes the answer of the j-th query asked to the oracle (where z = 0 means "no" and z = 1 means "yes"), (5) z describes the result of the entire computation of M (where z = 0 means "reject" and z = 1 means "accept"). The formula H n (x, u, v 1 , . . . , v f (n) , z 1 , . . . , z f (n) , z) does not enforce that each z j is the correct answer to the oracle query v j . Thus, the formula may have several satisfying assignments with the same values of x (one for each possible sequence of answers that the oracle may give).

In the same way, we can efficiently compute a Boolean formula

G n (v, y, z ′ )
(in fact, a conjunction of clauses with 3 literals per clause), whose satisfying assignments describe all (not necessarily accepting) runs of M ′ on input words of length n, where (1) v describes an input word of length at most n (2) y describes the sequence of configurations of M ′ during the run (including tape content, head position and state in each configuration), (3) z ′ describes the result of the entire computation of M (where z = 0 means "reject" and z = 1 means "accept"). Since M ′ is non-deterministic, the formula G n (v, y, z ′ ) may have many satisfying assignments with the same values of v.

Finally, for each input word w given as a bitstring of length n, we define φ w to be the Boolean formula

φ w = H n (w, u, v 1 , . . . , v f (n) , z 1 , . . . , z f (n) , z) ∧ j=1...f (n) G n (v j , y j , z j )
Observe that φ w only asserts that the z j is the result of some run of the non-deterministic Turing machine M ′ on input v j . It does not require that z j = 1 when M ′ has an accepting run on input v j . Consequently, not every satisfying assignment of φ w describes the correct computation of M on input x. However, it is easy to see that the lexicographically maximal satisfying assignment does describe the correct computation, due to the fact that it makes z j = 1 whenever possible (given the already obtained values for z ℓ for ℓ < j). Thus, we have z = 1 in the lexicographically maximal solution of φ w if and only if w ∈ A.

We order the variables in the formula φ w so that z 1 , . . . , z f (n) , z come first (and in this order). By construction, z is then the f (n)+1st variable of φ w . Let m be the total number of variables occurring in φ n (which is bounded by some polynomial in n). If f (n) + 1 ≤ log i m, then (φ w , m) is a valid input for the LEX i (SAT) problem, and we are done. Otherwise, we extend φ w with additional dummy variables, which serve no role other than making sure that f (n) + 1 ≤ log i m. It is easy to see that this can always be done.

Model theory

In this section we give many key definitions, we show results about the expressive power of UNFO and UNFP, and we show that UNFO has Craig Interpolation and the Projective Beth Property.

3.1. UN-bisimulations, the finite model property, and the tree-like model property. We define a game that captures model indistinguishability, and we use it to characterize the expressive power of UNFO and UNFP. The game is as follows: the two players maintain a single pair (a, b) of elements from the two structures. A move of Abelard consists of choosing a set X of points in one of the two structures. Then Eloise responds with a homomorphism h from the set X into a set of points in the other structure, where the homomorphism maps a to b (respectively b to a) if a (respectively b) belongs to the set X. Finally, Abelard picks a pair (u, h(u)) (respectively (h(u), u)) and the players continue with that pair. The game is parametrized by the size of the sets chosen by Abelard in each round.

Equivalently, we can present the game in terms of a back-and-forth system: We write M ≈ UN N if there is a non-empty UN-bisimulation between M and N , and we write M ≈ UN k N if there is a non-empty UN-bisimulation of width k between M and N . It is not difficult to see that the existence of a UN-bisimulation implies indistinguishability by UNFP sentences, and that the (weaker) existence of a UN-bisimulation of width k implies indistinguishability in UNFP k . Proposition 3.1. For any k ≥ 1, if M ≈ UN k N then M and N satisfy the same sentences of UNFP k . In particular, if M ≈ UN N then M and N satisfy the same sentences of UNFP.

Proof. The second claim follows immediately from the first one, because

M ≈ UN N implies M ≈ UN k N for all k ≥ 1.
The proof of the first claim is by induction on the nesting of fixpoints and existential quantification in the formula. We assume without loss of generality that all formulas are in UN-normal form. It is convenient to state the induction hypothesis for UNFO kformulas φ(x) in one free first-order variable and several free monadic second-order variables. The induction hypothesis then becomes: for all formulas φ(x, Y ) of width k, for all UN-bisimulations Z of width k between (M, P ) and (N, Q), and for all pairs (a, b) ∈ Z, we have (M, P , a) |= φ iff (N, Q, b) |= φ. We show only the important cases of the inductive step. Let M, N be two structures, Z be a UN-bisimulation of width k between M and N , P and Q be valuations of Y respectively on M and N , and (a, b) ∈ Z.

• φ(x, Y ) starts with an existential quantifier. Then, by definition of UN-normal form, φ starts with a block of existential quantifications, followed by a Boolean combination of atomic formulas or formulas with at most one free first-order variable, i.e. again of the form ψ(y, Y ). Let x 1 , . . . , x n be the initial existentially quantified variables of φ. In particular n ≤ k. First, suppose (M, P , a) |= φ. Let X = {a 1 , . . . , a n } be the quantified elements of M witnessing the truth of φ. By the definition of UN-bisimulation, there is a homomorphism h :

M |X → N such that h(a) = b (if a is in the domain of h) and such that {(a i , h(a i )) | i ≤ n} ⊆ Z.
By induction hypothesis, a subformula ψ(y, Y ) of φ is true on (M, P , a i ) iff it is true on (N, Q, h(a i )). Hence the assignment that sends x 1 , . . . , x n to h(a 1 ), . . . , h(a n ) makes φ true on (N, Q, b). The opposite direction, from (N, Q, b) |= φ to (M, P , a) |= φ, is symmetric.

• φ(x, Y ) is any Boolean combination of formulas of the form ψ(y, Y ), the result is immediate from the induction hypothesis. • φ(x, Y ) is of the form [LFP X,y ψ(X, Y , y)](x). We proceed by induction on the the fixpoint iterations. Let O φ,(M,P ) and O φ,(N,Q) be be the monotone set-operations induced by φ on subsets of the domain of (M, P Note that it is crucial, here, that we have defined width in terms of the UN-normal form. For example, if R is a binary relation, then the existence of a cyclic directed R-path of length k (i.e., a sequence of not necessarily distinct nodes a 1 , . . . , a k with R(a i , a i+1 ) and R(a k , a 1 )) can be expressed in UNFO using only 3 variables, by means of a careful reuse of variables, but the formula in question would not be in UN-normal form. Indeed, the existence of a cyclic directed R-path of length k, for k > 3, is not preserved by UN-bisimulations of width k -1.

A similar invariance property holds for formulas with free variables. For simplicity, we only state a version of the result without reference to the width of formulas. Proof. Follows from Proposition 3.1, together with the fact that positive existential formulas are preserved by homomorphisms (note that every UNFP-formula φ(x) can be viewed as a positive existential formula built from atomic formulas and from UNFP-formulas in one free variable).

From the invariance for UN-bisimulation it follows by a standard infinite unraveling argument that UNFP has the tree-like model property. A more involved partial unraveling, using back-edges in order to keep the structure finite, can also be used to show that UNFO has the finite model property. We only state the results without giving the details of these constructions, as it turns out that both results will follow from the material presented in Section 4. Note, that UNFP does not have the finite model property. This follows from the fact that UNFP contains the two-way µ-calculus which is known to lack the finite model property [START_REF] Streett | Propositional dynamic logic of looping and converse[END_REF]. Indeed, if max(x) is shorthand for ¬∃y E(x, y), then the formula

∃x max(x) ∨ ∃x¬[LFP X,y ¬∃z(E(z, y) ∧ ¬X(z))](x)
expresses the property that either there exists a maximal element or there is an infinite backward path. This formula is therefore obviously false in the infinite structure (N, suc). However it holds on any finite structure as if a finite structure has no maximal elements, it must contain a cycle, and hence an infinite backward path. The negation of this sentence is satisfiable, by (N, suc), but has no finite model.

3.2.

Characterizations. We have seen in Proposition 3.1 that UNFO sentences are firstorder formulas that are preserved under ≈ UN -equivalence. It turns out that the converse is also true. Indeed, in the same way that bisimulation-invariance characterizes modal logic [START_REF] Van Benthem | Modal Logic and Classical Logic[END_REF][START_REF] Rosen | Modal logic over finite structures[END_REF] and guarded bisimulation-invariance characterizes the guarded fragment of FO [START_REF] Andréka | Modal languages and bounded fragments of predicate logic[END_REF][START_REF] Otto | Highly acyclic groups, hypergraph covers, and the guarded fragment[END_REF], we will see that ≈ UN -invariance characterizes UNFO. We show two variants of this result depending on whether we consider finite or infinite structures. It turns out that the proof for the finite case also works for the infinite case. However we give an independent proof for the infinite case as it is simpler and introduces techniques that will be useful later when considering Craig Interpolation.

We say that a FO sentence is ≈ UN -invariant if for all structures M and N such that

M ≈ UN N , we have M |= φ iff N |= φ. The notion of ≈ UN k -invariance is defined similarly. Theorem 3.5. A sentence of FO is equivalent to a formula of UNFO iff it is ≈ UN -invariant. For all k ≥ 1, a sentence of FO is equivalent to a formula of UNFO k iff it is ≈ UN k - invariant.
Before proving Theorem 3.5 we state and prove the following useful lemma. We write (M, a) and(N, b) satisfy the same UNFO-formulas. We define (M, a) ≡ UNFO k (N, b) similarly. This lemma makes use of the classical notion of ωsaturation. The actual definition is not needed here and the interested reader is referred to [START_REF] Hodges | Model Theory[END_REF]. For our purpose it is enough to know the following two key properties.

≡ UNFO (N, b) if (M, a)
(1) If a (possibly infinite) set of first-order formulas is satisfiable, then it is satisfied by a model that is ω-saturated. (2) Let M be ω-saturated, let a 1 , . . . , a m ∈ dom(M ), and let T (x 1 , . . . , x n ) is an infinite set of first-order formulas with free variables x 1 , . . . , x n and using a 1 , . . . , a m as parameters. If every finite subset

T ′ of T is realized in M (meaning that (M, b, a) |= T (x) for some b = b 1 , . . . , b n ∈ dom(M )), then the entire set T is realized in M .
Lemma 3.6. For all ω-saturated structures M and N with elements a and b, respectively, the following hold.

(

) The relation {(a, b) | (M, a) ≡ UNFO (N, b)} is a UN-bisimulation. (2) The relation {(a, b) | (M, a) ≡ UNFO k (N, b)} is a UN-bisimulation of width k (k ≥ 1). 1
Proof. We prove the second claim. The proof of the first claim is similar.

Let Z = {(a, b) | (M, a) ≡ UNFO k (N, b)}.
We show that Z satisfies the forward property, the proof of the backward property is analogous. Suppose (c, d) ∈ Z and let X ⊆ dom(M ) with |X| ≤ k. We can distinguish two cases: either c ∈ X or c ∈ X. We will consider the first case (the second case is simpler). Thus, let X = {c, c 1 , . . . , c n } (n < k). Let T [x 1 , . . . , x n ] be the set of all formulas φ(x, x 1 , . . . , x n ) that are positive Boolean combinations of atomic formulas or unary formulas of UNFO k and that are true in (M, c, c 1 , . . . , c n ). We view T as an n-type with one parameter.

Notice that by construction of T , for each finite subset T ′ of T the formula ∃x 1 . . . x n ( T ′ ) is in UNFO k and is satisfied by (M, c). By hypothesis this formula is therefore also satisfied by (N, d). Since N is ω-saturated (and treating T as an n-type with parameter d), it follows that the entire set T [x, x 1 , . . . , x n ] is realized in N under an assignment g that sends x to d. This implies that the function h sending c to d and c i to g(x i ) is a homomorphism such that, for all i, c i and h(c i ) satisfy the same formulas of UNFO k and therefore (c i , h(c i )) ∈ Z by definition of Z.

Proof of Theorem 3.5. One direction follows from Proposition 3.1. For the other direction, we only give the proof for the case of UNFO k , the argument for full UNFO being identical.

Let φ be any ≈ UN k -invariant FO sentence. We want to show that φ is equivalent to a UNFO k -sentence.

We first show that whenever two structures agree on all sentences of UNFO k , they agree on φ. Suppose M and N satisfy the same sentences of UNFO k . Without loss of generality we can assume that M and N are ω-saturated. Define Z ⊆ M × N as the set of all pairs (a, b) such that (M, a) and (N, b) satisfy the same UNFO k -formulas. By Lemma 3.6, Z is a UN-bisimulation of width k. We claim that Z is non-empty. Let a be any element of M , and let Σ(x) be the set of all UNFO k -formulas with one free variable, true for a on M . Notice that for every finite subset Σ ′ of Σ, the formula ∃x Σ ′ is a sentence of UNFO k that is satisfied by M . Hence, by hypothesis, it is also satisfied in N . Therefore, by ω-saturation, the entire set Σ(x) is realized by an element b in N , and hence (a, b) ∈ Z, which implies that Z is non-empty. This implies that

M ≈ UN k N . Assume now that M |= φ. As φ is ≈ UN k -invariant and M ≈ UN k N , this implies that N |= φ. By symmetry we get M |= φ iff N |= φ as desired.
The rest of the proof is a well known argument using Compactness: If φ is not satisfiable then φ is equivalent to the UNFO 1 sentence "false". Otherwise let M |= φ and let Θ be the set of all UNFO k sentences θ such that M |= θ. We show that Θ |= φ (i.e. any model of Θ is a model of φ). If this were not the case then we have a structure N such that N |= Θ ∧ ¬φ. But because Θ contains each UNFO k sentence or its negation we have M ≈ UN k N and M, N disagree on φ. This contradict the claim of the previous paragraph.

By compactness, there is a finite subset Θ ′ of Θ such that Θ ′ |= φ. By construction, this implies that φ is equivalent to the conjunction of all the sentences in Θ ′ .

Before we turn to the finite variant of Theorem 3.5, we remark that a similar characterization can be obtained for formulas with free variables, using UN-homomorphisms instead of UN-bisimulations. Theorem 3.7. A formula of FO with free variables is equivalent to a formula of UNFO iff it is preserved under UN-homomorphisms.

Proof. One direction is provided by Proposition 3.2. For the other direction, let φ(x) be a FO formula preserved under UN-homomorphisms. As for the proof of Theorem 3.5, using a standard Compactness argument (cf. [18, Lemma 3.2.1]), it is enough to show that, for structures M, N with tuples a, b, if every UNFO-formula true in (M, a) is true in (N, b), then also M |= φ(a) implies N |= φ(b). Without loss of generality we may assume that M and N are ω-saturated. As φ is preserved under UN-homomorphisms, the result is now a direct consequence of the following claim.

If M, N are ω-saturated structures, and a, b tuples of elements such that every UNFO-formula true in (M, a) is true in (N, b), then there is a UNhomomorphism from an elementary substructure of (M, a) to an elementary substructure of (N, b) that maps a to b. In what follows, we prove the above claim. First of all, note that every equality statement satisfied in a is satisfied in b, which makes it meaningful to speak about functions mapping a to b.

We need the notion of a potential homomorphism from a structure M to a structure N . It is a non-empty collection F of finite partial homomorphisms f : M → N , which satisfies the following extension property: for all f ∈ F and for all a ∈ dom(M ), there is an f ′ ∈ F which extends f and whose domain includes a. By a potential UN-homomorphism we will mean a potential homomorphism whose finite partial homomorphisms preserve the UNbisimilarity type of each node. It is not hard to see that if M, N are countable structures and F is a potential homomorphism from M to N , then there is a homomorphism h : M → N , which can be defined as the limit of a sequence of finite partial homomorphisms belonging to F. In particular, if F is a potential UN-homomorphism, then h is a UN-homomorphism. Now, let M and N be structures as described by the statement of the Lemma. A straightforward variation of the proof of Lemma 3.6 shows that there is a potential UNhomomorphism F from M to N mapping a to b.

Next, we take the model pair (M, N, a, b) expanded with the maximal UN-bisimulation relation Z between M and N (i.e., the binary relation containing all pairs (a ′ , b ′ ) such that (M, a ′ ) ≈ UN (N, b ′ )), plus infinitely many additional relations that represent the potential UN-homomorphism F (for each k ≤ 1, we use a new 2k-ary relation R k to represent all finite partial homomorphisms defined on k elements). We then apply to downward Löwenheim-Skolem theorem to obtain a similar situation (M ′ , N ′ , a, b, . . .), but where M ′ and N ′ are countable elementary substructures of M and N . Since we added the Z and R k relations before applying the Löwenheim-Skolem theorem, we still have a potential UNhomomorphism from M ′ to N ′ mapping a to b. It then follows by the earlier remark that there is a UN-homomorphism from M ′ to N ′ mapping a to b.

Finally, we consider the case of finite structures. We say that a FO sentence is ≈ UNinvariant on finite structures if for all finite structures M and N such that M ≈ UN N , we have M |= φ iff N |= φ. The notion of ≈ UN k -invariance on finite structure is defined in the same way. We prove that UNFO k is also the ≈ UN k -invariant fragment of FO on finite structures. The proof of this result constitutes, at the same time, also an alternative proof of the second part of Theorem 3.5. However it relies in a crucial way on the parameter k and therefore does not yield a characterization of UNFO in terms of ≈ UN -invariance. In particular, it remains open whether UNFO is the ≈ UN -invariant fragment of FO on finite structures. For simplicity, we state the result for formula with at most one free variable. Theorem 3.8. Fix a finite schema σ, and let m be the maximal arity of the relations in σ. For all k ≥ m, a formula of FO with at most one free variable is equivalent over finite σ-structures to a sentence of UNFO k iff it is ≈ UN k -invariant on finite σ-structures.

Proof. Recall that we write (M, a) ≡ FOq (N, b) if M and N satisfy the same FO sentences of quantifier depth q. Recall the definition of UN-normal form, and observe that, in UNFO formulas that are in UN-normal form and that have at most one free variable, every existential quantifier must be either directly below another existential quantifier, or, otherwise, the subformula starting with that quantifier has at most one free variable. In the latter case, we call the existential quantifier in question a leading existential quantifier. We say that a formula of UNFO k in UN-normal form with at most one free variable has block depth q if the nesting depth of its leading quantifiers is less than q. We denote by UNFO k q the fragment of UNFO k consisting of formulas in UN-normal form with at most one free variable that have block depth q, and we will write (M, a) ≡ UNFO k q (N, b) if M and N satisfy the same formulas of UNFO k q . One can show by a straightforward induction on k that, for every fixed finite schema, ≡ UNFO k q is an equivalence relation of finite index (that is, there are only finitely many equivalence classes) and, consequently, each equivalence class can be described using a single UNFO k q -formula. The basic proof strategy is as follows: we will show that for every q ≥ 0 there exists a l ≥ 0 such that whenever (M, a) ≡ In other words, using the terminology of [START_REF] Otto | Modal and guarded characterisation theorems over finite transition systems[END_REF], "the equivalence relation ≡ UNFO k l can be lifted to ≡ FO q modulo ≈ UN k ". This implies the theorem: starting with a ≈ UN k -invariant FO formula φ in one free variable of quantifier depth q, we obtain that φ is ≡ UNFO k l -invariant. Therefore φ is equivalent to the disjunction of all (finitely many, up to equivalence) formulas describing an equivalence class of ≡ UNFO k l containing a model of φ. The construction of (M * , a * ) and (N * , b * ) makes use of Theorem 2.4. We first need to introduce some auxiliary definitions that will allow us to construct a Kripke structure from an arbitrary structure, and vice versa.

Let M be any structure over a signature σ. In what follows, by a k-neighborhood of M , we will mean a pair (K, h), where K is a structure with domain {1, . . . , k} over σ and h is a homomorphism from K to M . Intuitively, one can think of a k-neighborhood as a realization in M of some positive existential description of size k. From σ and k we construct the signature σ k containing a unary predicate P K for each structure K over σ with domain {1, . . . , k} and a binary relation R i for each 1 ≤ i ≤ k. Given a structure M over σ, we associate to it a structure G M , called the graph of M , over σ k , as follows. The nodes of G M are the elements of M plus the k-neighborhoods of M . Each node of G M that is a k-neighborhood (K, h) is labeled by the unary predicate P K . There is an

R i -edge in G M from a k-neighborhood (K, h) of M to an element a ∈ M if and only if h(i) = a.
Conversely, we can transform a structure G over the signature σ k into a structure G over σ as follows. The universe of G consists of the nodes of G that do not satisfy any unary predicate. A tuple of such elements a = a 1 . . . a n (with n ≤ m ≤ k) belongs to R iff there is a node u of G satisfying P K , for some K, and a tuple b = b 1 . . . b n of elements of K such that K |= R(b) and such that for each i ≤ n, G contains the edge R b i (u, a i ).

We start by establishing a useful property linking M to its graph G M . The base of the induction, where ℓ = 0, is trivial. For the induction step, recall that Abelard can choose a structure, and subsequently, play one of three types of moves: moving the pebble forward along an edge, moving the pebble backward along an edge, and moving the pebble to an arbitrary node. We will assume that Abelard chooses G M (the case where Abelard chooses G N is symmetric) and that Abelard either (i) moves the pebble (forward or backward) along an edge, or (ii) moves the pebble to an arbitrary node. We treat the two cases separately.

As a convenient notation, for each structure K over σ with universe {1, . . . , k}, we define α K (x 1 , . . . , x k ) to be the quantifier-free formula that is the conjunction of all atomic formulas true in K, using free variables x 1 , . . . , x k for the elements 1, . . . , k. Moreover we say that τ is the UNFO k ℓ -type of an element a of M if it is the conjunction of all the UNFO k ℓ formula ϕ(x) such that M |= ϕ(a). Modulo logical equivalence there are only finitely many formulas in UNFO k ℓ hence each UNFO k ℓ -type is equivalent to a formula of UNFO k ℓ . (i) Let (u, v) ∈ Z ℓ . By construction, (u, v) is either of the form (a, b) with a ∈ dom(M ) and b ∈ dom(N ), or it is of the form ((K, h), (K, g)). First, suppose that (u, v) = (a, b), where a ∈ M and b ∈ N . Let u ′ be a node of G M reachable from a by an edge. By construction of G M , u ′ must be of the form (K, h) and is connected with an edge of label i to a, i.e. h(i) = a. For all i, let τ i be the UNFO k ℓ-1 -type of h(i). By definition, the formula β(x i ) defined as ∃x 1 . . . x i-1 x i+1 . . . x k α K ∧ j =i τ j (x j ) is a formula of UNFO k ℓ and by construction we have (M, a) |= β(x i ). Therefore (N, b) |= β(x i ). Let g be the valuation corresponding to the initial block of existential quantifications. By construction g is a homomorphism from K to N and, for each i, (h(i),

g(i)) ∈ Z ℓ-1 . Hence ((K, h), (K, g)) ∈ Z ℓ-1 .
Next, suppose (u, v) = ((K, h), (K, g)) and a there is a node u ′ connected to u via an edge. By construction u ′ must be an element a of G M connected with an edge of label i to (K, h), i.e. h(i) = a. By definition, for b = g(i) we have (a, b) ∈ Z ℓ-1 .

(ii) Let (u, v) ∈ Z ℓ and let u ′ be any element of G M . First, consider the case where u ′ is an element of M , and let τ (x) be its UNFO (N, v), and hence, (u

′ , v ′ ) ∈ Z ℓ-1 .
Next, suppose that u ′ was of the form (K, h). For each i ≤ k, let τ i (x) be the UNFO k ℓ-1type of h(i). By definition, the formula β defined as ∃x 1 . . .

x k α K ∧ i τ i (x i ) is a formula of UNFO k
ℓ and by construction we have (M, a) |= β. Therefore (N, b) |= β. Let g be the valuation corresponding to the initial block of existential quantifications in β. By construction g is a homomorphism from K to N and, for each i, (h(i),

g(i)) ∈ Z ℓ-1 . Hence ((K, h), (K, g)) ∈ Z ℓ-1 .
Fix some q ∈ N and let l be the number given by Theorem 2.4 for q + 1. Let now (M, a) and (N, b) be such that (M, a)

≡ UNFO k l (N, b). By Claim 1 we have (G M , a) ≈ l (G N , b). By Theorem 2.4 there exists (G ′ M , a ′ ) and (G ′ N , b ′ ) such that (G ′ M , a ′ ) ≈ (G M , a), (G ′ N , b ′ ) ≈ (G N , b) and (G ′ M , a) ≡ FO q+1 (G ′ N , b). Let M * be G ′ M and N * be G ′ N .
The following two claims show that (M * , a ′ ) and (N * , b ′ ) have the desired properties.

Claim 2. (M * , a ′ ) ≡ FO q (N * , b ′ ).
Proof. We simply lift the winning strategy in the Ehrenfeucht-Fraïssé game given by (

G ′ M , a ′ ) ≡ FO q+1 (G ′
N , b ′ ) to a winning strategy for the Ehrenfeucht-Fraïssé game (M * , a ′ ) ≡ FO q (N * , b ′ ): When, at stage i of the game, Spoiler chooses an element a i in M * Duplicator responds with the element b i provided by his strategy in the game between G ′ M and G ′ N , and vice versa if Spoiler chooses an element in N * . We show that

M * |= R(a i 1 • • • a iκ ) implies N * |= R(b i 1 • • • b iκ ). Let (K, h) be any k-neighborhood of M such that R(a i 1 , . . . , a iκ ) is the h-image of an atomic fact of K. Assuming the node u = (K, h) is played in the game between G ′
M and G ′ N , the extra move in the winning strategy of Duplicator guarantees the existence of v = (K, g) in G ′ M that is linked to b the same way u is linked to a. This implies the desired property. Proof. We only treat the case for M , the other being identical.

By Theorem 2.4, we have that (G ′ M , a ′ ) is a ≈-cover of (G M , a). That is, there is a homomorphism h :

G ′ M → G M such that h(a ′ ) = a and such that (G ′ M , c) ≈ (G M , h(c)) for all c ∈ dom(G ′ M ). Let Z = {(c, h(c)) | c ∈ dom(M * )}.
Note that, for all c ∈ dom(M * ) we have that h(c) ∈ dom(M ), due to the fact that c and h(c) agree on all unary predicates. We will show that, in fact, Z is a UN-bisimulation of width k between M * and M . Note also that (a ′ , a) ∈ Z.

We first prove that Z is the graph of a homomorphism. Let a be such that

M * |= R(a). By construction of M * , this implies that there is a node u in G ′ M of label P K and elements b 1 , . . . , b l in K such that K |= R(b 1 , . . . , b l ) and G ′ M |= R b j (u, a j ) for all j.
As h is a homomorphism, h(u) has the same label as u and is connected to h(a) the same way u is connected to a. By construction of G M , this implies M |= R(h(a)).

Since we have just shown that Z is the graph of a homomorphism, it remains only to show that Z satisfies the backward property of the definition of UN-bisimulations.

Consider (c, d) ∈ Z, that is, d = h(c). Let Y be a subset of elements of M of size less than k. We assume that d ∈ Y . The case where d ∈ Y is handled in the same way. Let K be the structure with universe {1, . . . , k} which is isomorphic to the restriction of M to Y and let g be the corresponding isomorphism. Without loss of generality we assume that g(1) = b. By definition of G M there is a node v = (K, g) that is connected to all the elements of Y via edges of appropriate label. Since (G ′ M , c) ≈ (G M , d), we can find a node u, whose label correspond to K, connected to c via an edge of label 1, and such that

h(u) = v. Since (G ′ M , u) ≈ (G M , v), we can further find in G ′ M a set of nodes X, connected
to u in the same way that Y are connected to v, such that h(X) = Y . It follows by the construction of M * that the map from Y to X is a partial homomorphism from M to M * .

This concludes the proof of Theorem 3.8: it follows from Claim 2 and Claim 3 that every ≈ UN k -invariant FO formula φ in one free variable of quantifier depth q, is ≡ UNFO k l -invariant for suitably large l, and, therefore (as explained earlier), is equivalent to a UNFO k l -formula. The analogous result for sentences follows immediately.

Craig Interpolation and Beth

Property. We conclude the list of nice modeltheoretic properties of UNFO by showing that it has Craig Interpolation and the Projective Beth Property. In fact, we can show strong versions of these results, which take into account also the width of formulas. This is remarkable, given that both Craig Interpolation and the Beth Property fail for the k-variable fragment of first-order logic, for all k > 1. Moreover, the results presented in this section hold both on arbitrary structures and on finite structures. Model-theoretic proofs of Craig Interpolation typically use amalgamation constructions [START_REF] Chang | Model Theory[END_REF], and the proof we give here is essentially based on an amalgamation construction called zigzag-products that was introduced, in the context of modal logic, in [START_REF] Marx | Multidimensional Modal Logic[END_REF].

For all UNFO-formulas φ(x), ψ(x), we write φ |= ψ to express that the first-order formula ∀x(φ → ψ) (which is not necessarily a UNFO-formula) is valid, i.e. holds on all models.

It turns out that it is enough to consider finite models for testing whether φ |= ψ. This is a consequence of the following remark and Theorem 3.3: Remark 3.9. For all UNFO-formulas φ(x), ψ(x), φ |= ψ holds (resp. holds on finite structures) if and only if the UNFO sentence

∃x(φ ∧ 1≤i≤n P i (x i )) ∧ ¬∃x(ψ ∧ 1≤i≤n P i (x i ))
is not satisfiable (resp. does not have a finite model), where x = x 1 , . . . , x n and P 1 , . . . , P n are fresh unary predicates. Remark 3.9 implies that all the results we prove for sentences apply to entailment between formulas with free variables as well. In particular, since UNFO has the finite model property by Theorem 3.3, we have that φ |= ψ holds on arbitrary structures if and only if holds on finite structures. Consequently, Craig Interpolation, and therefore also Beth Property, hold on arbitrary structures if and only if they hold over finite structures. In the remaining part of this section we only state the results for arbitrary structures, but, as we have just argued, they also hold over finite structures. Theorem 3.10. UNFO k has Craig Interpolation: for all k ≥ 1 and for every pair of UNFO kformulas φ(x), ψ(x) in the same free variables such that φ |= ψ, there is a UNFO k -formula χ(x) over the common vocabulary of φ and ψ such that φ |= χ and χ |= ψ.

Proof. The proof is by contradiction. Suppose that there is no interpolant in UNFO k . We will show that (the first-order formula) φ ∧ ¬ψ is satisfiable.

Let σ be the vocabulary of φ, and τ the vocabulary of ψ, and let x = x 1 . . . ). Let Φ(x) be the set of all UNFO k -formulas in the joint vocabulary that are valid consequences of φ(x). The first-order theory Φ(x) ∪ {¬ψ(x)} is consistent, because, if this were not the case, then by Compactness, some finite conjunction of formulas in Φ would be an interpolant, which we have assumed is not the case. Hence, let (N, b) |= Φ(x) ∪ {¬ψ(x)}.

Next, let Γ(x) be the set of all UNFO k -formulas in the joint vocabulary that are false in (N, b). Then the first-order theory {¬γ | γ ∈ Γ(x)} ∪ {φ(x)} is consistent, for, if it were not, then by Compactness, there would be γ 1 , . . . , γ m ∈ Γ such that i ¬γ i |= ¬φ(x) and hence b). Consider now a set X = {u 1 , . . . , u κ } ⊆ M with κ ≤ k. We assume that X contains no element of a. If this were not the case we simply remove those elements and proceed as below. Let Y = X ∪ a. We view Y as the sequence (v 1 , . . . , v ℓ ) where for j ≤ κ, v j = u j and for j > κ, v j = a j . For each element u i of X, let T i be the set of UNFO k formulas ψ(x) such that M |= ψ(u i ). Let α be the conjunction of all atoms R(x i 1 , . . . ,

i γ i ∈ Φ(x), which contradicts (N, b) |= Φ(x). Let (M, a) |= {¬γ | γ ∈ Γ(x)} ∪ {φ(x)}.
x i l ) such that M |= R(v i 1 , . . . , v i l ). For each finite subset T ′ i of T i , the formula ∃x 1 , . . . x κ α ∧ i T ′ i (x i ) is in UNFO k and is satisfied by (M, a). Because (M, a) ⇛ σ∩τ UNFO k (N, b) it is also satisfied by (N, b). By ω-saturation, this implies that {α(x 1 , . . . , x i )} ∪ i≤κ T i (x i ) is realized in (N, b).
The witnessing tuple c provides the desired homomorphism from X to N .

Altogether this shows that (M, a) → σ∩τ UN k (N, b). We now construct a new σ ∪τ -structure K out of the σ-structure M and the τ -structure N provided by Claim 5. This new structure K will contain a tuple satisfying φ ∧ ¬ψ. Essentially, K will be the substructure of the cartesian product of M and N containing pairs of elements that are UN-bisimilar in the joint language. Relations in the joint vocabulary are interpreted as usual in cartesian products, while relations outside of the joint vocabulary are copied from the respective structure. The precise definition of K is as follows: Let Z be the graph of the natural projection from K onto M , i.e., Z = {( u, v , u) | u, v ∈ K}. Clearly, ( a, b , a) ∈ Z. Therefore, it suffices to show that Z is a UNbisimulation of width k for the signature σ.

• The domain of K is the set of all pairs (a, b) ∈ M ×N such that (M, a) ≈ σ∩τ UN k (N, b). • For each R ∈ σ ∩ τ of
Consider any pair ( u, v , u) ∈ Z, and let X be any subset of the domain of K, with |X| ≤ k. Let h be the natural projection from K onto M , restricted to X. It is clear from the definition of K that h is a partial homomorphism with respect to all relations in σ (those that belong to σ ∩ τ as well as those that belong to σ \ τ ). Furthermore, it is clear that h( a, b ) = a if a, b ∈ X. Therefore, the forward property of the definition of UN-bisimulations is satisfied.

Next, consider any pair ( u, v , u) ∈ Z, and let X be any subset of the domain of M , with

|X| ≤ k. Since (M, u) ≈ σ∩τ UN k (N, v), there is a partial homomorphism f : M → N whose domain is X, such that (M, x) ≈ σ∩τ UN k (N, h(x)
) for all x ∈ X, and such that h(u) = v if u ∈ X. Now, define h : M → K to be the map that sends every x ∈ X to x, f (x) . Clearly, this is a well-defined partial map from M to K, with domain X, having the property that h(u) = (u, v) if u ∈ X. Therefore, it only remains to show that h is a partial homomorphism. That h preserves all relations in σ\τ is immediate from the definition of K. That h preserves all relations in σ ∩ τ follows from the construction of h and of K: if (x 1 , . . . , x m ) ∈ R M , then, since f is a partial homomorphism, we have that (f (x 1 ), . . . , f (x m )) ∈ R N . Hence, by the definition of K, we have that (h(x 1 ), . . . , h(x m )) ∈ R K .

We will use the notation a, b as a convenient shorthand for ( a 1 , b 1 , . . . , a n , b n ).

Claim 7. (K, a, b ) |= φ ∧ ¬ψ
Proof of Claim 7: We may assume that φ is in UN-normal form. Let φ be of the form ∃zφ ′ , where φ ′ is built up from atomic formulas, equalities and formulas in one free variable, using conjunction and disjunction. Since (M, a) |= φ, there is a tuple a ′ witnessing (M, a ′ ) |= φ ′ (where a and a ′ are appropriately related, depending on which variables are quantified in φ). The fact that (M, a) → σ∩τ UN k (N, b) gives us that there is a partial homomorphism h : M → N whose domain is a ′ , such that h(a i ) = b i for all a i ∈ a ∩ a ′ , and such that (M, x) ≈ σ∩τ Next, consider ψ. We may again assume that ψ is in UN-normal form. Recall that the definition of K implies that the natural projections from K onto N is a homomorphism preserving all relations in τ (both those in σ ∩ τ and those in τ \ σ). It follows by a straightforward induction that if (K, a, b ) |= ψ, then also (N, a) |= ψ, which is not the case.

To summarize: on the basis of the assumption that there is no Craig interpolant for φ and ψ, we were able to show that φ ∧ ¬ψ is satisfiable, and hence, φ → ψ is not a valid implication. This concludes the proof of our Craig interpolation theorem.

As usual, Craig Interpolation implies Beth Property. Let Σ be a UNFO-theory in a signature σ and let R ∈ σ and τ ⊆ σ. We say that Σ implicitly defines R in terms of τ if for all τ -structures M and for all σ-expansions M 1 , M 2 of M satisfying Σ, we have that

R M 1 = R M 2 .
We say that a formula φ(x) in signature τ is an explicit definition of R relative to Σ if Σ |= ∀x (Rx ↔ φ(x)). Note that the formula ∀x (Rx ↔ φ(x)) is itself not necessarily a UNFO-formula, but this is irrelevant. Theorem 3.11. UNFO has the Projective Beth Property: whenever a UNFO-theory Σ in a signature σ implicitly defines a k-relation R in terms of a signature τ ⊆ σ, then there is a UNFO-formula in signature τ that is an explicit definition of R relative to Σ. Moreover, if Σ belongs to UNFO k (k ≥ 1), then the explicit definition can be found in UNFO k as well.

Proof. The argument is standard from Craig Interpolation. We give it here for the sake of completeness. Suppose Σ implicitly defines R in terms of τ . We may assume R ∈ τ because otherwise it is trivial. Furthermore, by Compactness, we may assume Σ to be finite. Let Σ ′ be a copy of Σ in which all relations S outside of τ (including R) have been replaced by new disjoint copies S ′ . Then the fact that Σ implicitly defines R in terms of τ implies that following first-order implication is valid:

Σ ∧ Σ ′ |= ∀x(Rx → R ′ x)
We can rewrite this into an equivalent implication of UNFO-formulas:

Σ ∧ Rx |= Σ ′ → Rx
Let χ(x) be the interpolant given by Theorem 3.10 for this UNFO-implication. It is now straightforward to verify that χ is indeed an explicit definition of R relative to Σ.

Satisfiability

In this section, we show that the satisfiability problem for UNFP and for UNFO is 2ExpTimecomplete, both on arbitrary structures and on finite structures. The lower bound holds already over structures with relations of bounded arity, and, in particular, over finite trees. Note that this is in contrast with GFO whose complexity drops from 2ExpTime-complete to ExpTime-complete when the arity of relations is bounded [START_REF] Grädel | Why are modal logics so robustly decidable[END_REF]. The upper bound is obtained by a reduction to the two-way modal µ-calculus and Theorem 2.2. Given a formula ϕ of UNFP we construct in exponential time a formula ϕ * in the µ-calculus such that ϕ has a (finite) model iff ϕ * has a (finite) model. The correctness of the construction in the finite case builds on Theorem 2.3. The same reduction to the two-way modal µ-calculus allows us to prove the finite model property of UNFO and the tree-like model property of UNFP, i.e., Theorem 3.3 and Theorem 3.4.

We describe the reduction from ϕ to ϕ * in two parts. In the first one we consider only a special case of UNFP formulas that we call simple. Those are, intuitively, formulas of the global two-way µ-calculus with navigation through arbitrary relations instead of just binary relations. The construction of ϕ * is then polynomial. In a second part we show how the general case reduces to this one (with an exponential blow-up).

4.1. Simple UNFP formulas. We first consider a fragment of UNFP, which we call simple and denote it by sUNFP. It is a common fragment of UNFP and GFP, which embeds the global two-way µ-calculus. The syntax of sUNFP is given by the following grammar (recall that we use the notation φ(x) to indicate that a formula has no free first-order variables besides possibly x, but may contain some monadic second-order free variables):

φ(x) ::= P (x) | X(x) | φ(x) ∧ φ(x) | φ(x) ∨ φ(x) | ¬φ(x) | [LFP X,y φ(y)](x) | ∃y 1 . . . y n (R(y 1 . . . y n ) ∧ y i = x ∧ j∈{1...n}\{i} φ(y j )) | ∃xφ(x)
Note that all formulas generated by this inductive definition have at most one free (first-order) variable. We denote by sUNFO the first-order (that is, fixpoint-free) fragment of sUNFP.

We need the following notions. A fact of a structure M is an expression R(a 1 , . . . , a n ) where (a 1 , . . . , a n ) ∈ R M . The incidence graph inc(M ) of a structure M is the bi-partite graph containing facts of M and elements of M , and with an edge between a fact and an element if the element occurs in the fact. We say that a structure M is l-acyclic, for l ≥ 1, if (i) inc(M ) has no cycle of length less than 2l, and (ii) no element of M occurs twice in the same fact. We call a structure acyclic, if it is l-acyclic for all l (i.e., the incidence graph is acyclic and no element occurs in the same fact twice).

Based on a simple coding of relations of arbitrary arity using binary relations we can transform a simple formula into a formula of the µ-calculus and, using the results of Section 2.2, obtain: Proposition 4.1.

(1) The satisfiability problem for sUNFP is ExpTime-complete, both on arbitrary structures and on finite structures. Proof. [START_REF] Andréka | Modal languages and bounded fragments of predicate logic[END_REF] The ExpTime lower bound for sUNFP follows immediately from the fact that sUNFP subsumes the two-way modal µ-calculus ML µ whose satisfiability problem is Exp-Time-hard (cf. Theorem 2.2). For the ExpTime upper bounds, we give a polynomial time translation from sUNFP to ML µ , which preserves (un)satisfiability on arbitrary structures and on finite structures.

Let φ be any sUNFP formula. Let l be the maximal arity of the relation symbols occurring in φ, and let p 1 , . . . , p l be fresh proposition letters. For each unary predicate P , we introduce a fresh proposition letter p P . Furthermore, we associate to each relation symbol R a proposition letter p R . Intuitively, the idea of the translation is that, in our Kripke models, we will encode an R-tuple by a "gadget" consisting of a node satisfying p R that has n successors (where n is the arity of the relation R) satisfying p 1 , . . . , p n , respectively, each of which has as a successor the corresponding element of the R-tuple. This is spelled out below in more detail. The syntactic translation [•] * from sUNFP to ML µ is then as follows: Altogether this shows that the translation [•] * preserves (un)satisfiability, both on arbitrary structures and on finite structures.

[P (x)] * = p P [X(x)] * = X [φ(x) ∧ ψ(x)] * = [φ(x)] * ∧ [ψ(x)] * [φ(x) ∨ ψ(x)] * = [φ(x)] * ∨ [ψ(x)] * [¬φ(x)] * = ¬[φ(x)] * [[LFP X,y φ(y)](x)] * = µX [φ(y)] * [∃y 1 . . . y n (R(y 1 . . . y n ) ∧ y i = x ∧ j =i φ j (y j ))] * = ♦ -(p i ∧ ♦ -(p R ∧ j =i ♦(p j ∧ ♦[φ j (y j )] * ))) [∃xφ(x)] * = S[φ(x)] *
(3) If φ has a finite model then by the construction above [φ] * has a finite Kripke model. By Theorem 2.3 this implies that [φ] * has a model that is 4l-acyclic. Now notice that the transformation of M into M * described above preserves l-acyclicity up to a factor of 4, and therefore, φ has a model that is is l-acyclic.

(2) is proved in the same way as (3), using the fact that if [φ] * has a model then it has an acyclic one and that the transformation of M into M * preserves acyclicity.

(4) For a sUNFO formula φ, [φ] * does not contain any fixpoint and is therefore in ML. Recall from Section 2.2 that ML has the finite model property. This implies that UNFO also has the finite model property as the transformation of M into M * preserves finiteness.

4.2.

Arbitrary UNFP-formulas. We now attack the satisfiability problem for arbitrary UNFP formulas. We say that a disjunction ψ 1 ∨ ψ 2 is unary if ψ 1 ∨ ψ 2 has at most one free variable. We remind the reader that we use the notation ψ(y) to express that ψ has at most one free first-order variable y.

∃z τ (z) ∧ z i = y ∧ j∈{1...n}\{i} φ j (z j ) or ∃z τ (z) ∧ j∈{1...n} φ j (z j ) (4.2)
where z = z 1 . . . z n , i ≤ n, and τ (z) is a conjunction of relational atomic formulas with no equalities, and φ j is generated by the grammar (4.1).

Proof. Concerning (4.1). Clearly we may assume that φ is a sentence as all free variables can be existentially quantified without affecting the satisfiability and the fact that φ is in UN-normal form. It is also easy to see that non-unary occurrences of disjunction can be eliminated at the cost of a possible exponential blowup, using the fact that disjunction commutes with conjunction and with the existential quantifiers. This is an exponential transformation, reminiscent of the transformation of propositional formula into disjunctive normal form, and it does not affect the width of the formula, nor the size of other parameters that we will define later. This remark will be important during the complexity analysis as the width will appear in the exponent of the complexity of some forthcoming transformations. The form (4.2) is straightforward to obtain by eliminating equalities by identifying the respective quantified variables.

In what follows let φ be any UNFP formula of the form described in Lemma 4.1, for which we want to test satisfiability.

We denote by subf φ the set of all subformulas ψ(y) of φ that have one free first-order variable. For any subformula of φ of the form

∃z(τ (z) ∧ z i = y ∧ j∈{1...n}\{i} φ j (z j )) or ∃z(τ (z) ∧ j∈{1...n} φ j (z j )) ,
we call τ (z) a neighborhood type. We denote the set of neighborhood types in φ by ntypes φ .

In the sequel we will sometime view a neighborhood type τ (z) as a structure whose universe is the set of variables of z and whose relations are the atoms of τ . We now consider structures that are "stitched together" from copies of the neighborhood types in ntypes φ . Definition 4.2. Consider the signature that contains, for each neighborhood type τ (z 1 , . . . , z n ) ∈ ntypes φ an n-ary relation symbol R τ . A structure in this new signature is called a stitch diagram. Each stitch diagram M gives rise to a stitching M x , which is the structure (with the same domain of M ) in the original signature obtained by replacing each R τ -tuple with a copy of the neighborhood type τ (viewed as a structure) for all τ ∈ ntypes φ .

At this point, our basic strategy for reducing UNFP to sUNFP should be clear: we will produce an sUNFP sentence to describe stitch diagrams whose stitchings satisfy the desired UNFP sentence. In the rest of this section, we work out the details of this strategy.

It is important to realize that, even if a stitch diagram M does not contain an atomic fact R τ (a), it may still be the case that M x |= τ (a). In this case we say that the fact R τ (a) is implicit in M . For example, this could happen if M |= R τ ′ (a) and τ is contained in τ ′ . The following claim gives us a handle on when this phenomenon may occur. For any τ ∈ ntypes φ , we denote by |τ | the number of atomic formulas in τ . We write N ⊆ M if N is a not-necessarily-induced substructure of M . Proof. We need at most one fact of M to account for each atom in τ (a).

Let l = max τ ∈ntypes φ |τ |. We will restrict attention to stitch diagrams M that are l-acyclic. By Item (3) of Proposition 4.1 this is without loss of generality. This implies that every N ⊆ M containing at most l facts is acyclic. The importance of the above claim, then, shows in two facts: (i) intuitively, there are finitely many reasons why a fact may be implicit in M , and (ii) each of these reasons is acyclic, and hence can be described in sUNFP as we will see.

Lemma 4.4. Let ψ(y, X) be any subformula of φ with at most one free first-order variable. By induction on the structure of ψ(y) we can construct a sUNFP formula ψ ′ (y) such that, for all l-acyclic stitch diagrams M , all a ∈ M , and all sets S of elements of M , M |= ψ ′ (a, S) iff M x |= ψ(a, S).

Proof. The inductive translation commutes with all Boolean operators and with the LFP operator. Fix now any τ (z) ∈ ntypes φ with z = z 1 , . . . , z n , fix an i ≤ n, and fix a sequence of formulas ψ 1 , . . . , ψ i-1 , ψ i+1 , . . . , ψ n ∈ subf φ and assume ψ is of the form:

ψ(y) := ∃z(τ ∧ z i = y ∧ j∈{1...n}\{i} ψ j (z j )) .
(the argument if ψ is of the form ∃z(τ ∧ j∈{i...n} ψ j (z j )) is similar. Note that these two cases also account for the base of the induction, if we let n = 1).

By induction we already have constructed sUNFP formulas

ψ ′ 1 , . . . , ψ ′ i-1 , ψ ′ i+1 , . . . , ψ ′ n corresponding to ψ 1 , . . . , ψ i-1 , ψ i+1 , . . . , ψ n .
We are interested in detecting in M how a node in M x may come to satisfy ψ. We will construct a sUNFP formula that lists all the cases in M that make this happen. It clearly suffices to consider one connected component of τ at a time. Hence by Lemma 4.3 it only depends on a small neighborhood of x in M . The formula will then be essentially a long disjunction, where each disjunct corresponds to the description of a small neighborhood of M in which τ is implicitly satisfied by a tuple of nodes satisfying in addition the formulas ψ j . Note that since we assume M to be l-acyclic, these small substructures are all acyclic, which will make it possible to describe them by an (existential) formula of sUNFP.

More precisely, consider any connected acyclic stitch diagram N containing at most l facts, and any homomorphism h : τ → N x . We now construct an sUNFP formula χ ψ,N,h (y) that describes N (existentially positively) from the point of view of h(z i ), and expressing also that each h(z j ) satisfies ψ j .

We shall make use of the following property of acyclic structures. If N is acyclic, i.e. inc(N ) is acyclic, then there is a tree T (N ) such that each of its nodes is labeled with a fact of N satisfying the following properties: (i) each atom of N is the label of exactly one node of T (N ), (ii) if a node u of T (N ) is the parent in T (N ) of a node v then their label share at most one element of N , (iii) if two nodes u and v of T (N ) share an element then either they are siblings of one is the parent of the other. In other words, we view N as a tree T (N ) rooted with an atom containing h(z i ) and the formula describes that tree from top to bottom. We construct the desired sUNFP formula by induction on the number of nodes in T (N ).

When T (N ) contains only one node, whose label is R τ (a 1 , • • • , a m ) and, assuming h(z i ) = a i 0 , the desired formula is then

∃y R τ (y) ∧ y i 0 = y ∧ j =i,h(z j )=aα j ψ ′ j (y α j ).
Assume now that T (N ) is a tree whose root element is u = R τ (a 1 , • • • , a m ) and with several subtrees T (N 1 ), T (N 2 ) • • • . By property (ii) of T (N ), for all j > 0, the label of u and the elements of N j share at most one element, say a β j . For j > 0, let h j be the restriction of h to the elements of N j . Finally assume that h(z i ) = a i 0 . The desired formula χ ψ,N,h (y) is then:

∃y R τ (y) ∧ y i 0 = y ∧ j =i,h(z j )=aα j ψ ′ j (y α j ) ∧ j χ ψ,N j ,h j (y β j )
Finally ψ ′ (y) is the disjunction, for each N and h as above, of the formulas χ ψ,N,h (y). It follows from the construction that, for all l-acyclic stitch diagrams M , M |= ψ ′ if and only if M x |= ψ.

It follows from Lemma 4.4 that if the constructed sUNFO formula ψ ′ is satisfiable (in the finite or in the infinite), by Theorem 2.3 it has a l-acyclic model (in the infinite this model is actually acyclic) and therefore ψ is satisfiable. Conversely, it is easy to construct, from a (finite) model M of ψ, a (finite) model M ′ of ψ ′ . Take for M ′ the structure whose domain is the domain of M and whose relation R τ contains all the tuples of M satisfying τ . Altogether this shows that ψ is satisfiable (on finite structures) if and only if ψ ′ is. By Proposition 4.1 this implies that UNFP is decidable. A careful analysis of the complexity of the above translation actually yields: Theorem 4.5. The satisfiability problem for UNFP is in 2ExpTime, both on arbitrary structures and on finite structures.

Proof. Assume first that the input UNFP formula φ satisfies the simplifying assumptions of Step 1. Recall that we denote by l the maximal number of conjuncts in neighborhood types, and by k the width of the formula. Note that the formula χ ψ,N,h (y) is only polynomially long in the length of ψ, but for any given ψ, the number of possible structures N and homomorphisms h can be exponential. More precisely, each structure N to be considered has at most l facts and domain size at most k•l. Moreover the number of possible atomic relations is |ntypes φ | = O(|φ|) and each relation has arity at most k and cannot contain twice the same element. There are at most |φ| O(k•l) many such structures, up to isomorphism. For each such structure N , since the domain size is at most l • k, the number of homomorphisms k) . All in all, the number of disjuncts occurring in ψ ′ is bounded by |φ| O(k•l) . Lets now consider the size of one such disjunct: as it contains formulas of the form ψ ′ i for smaller formulas, we obtain by induction that the size of the sUNFP formula φ ′ is bounded by |φ| O(r•k•l) where r is the nesting depth of existential blocks.

h : τ → N x is at most (l • k) k = |φ| O(
Consider now the general case of a UNFP formula θ. Putting θ in UN-normal form is linear time. The transformation of θ into a formula φ satisfying the simplifying assumption is exponential in time but produces a formula whose parameters k, l and r are only polynomial (actually linear) in the size of θ. Hence, from the previous paragraph, it follows that the size of the resulting sUNFP formula ψ ′ can be bounded by (2 |θ| ) |θ| c for some constant c, that is exponential in |θ|.

Hence, we obtain by Proposition 4.1 that the satisfiability problem is in 2-ExpTime, both on arbitrary structures and on finite structures.

We conclude this section by proving Theorem 3.3 (Finite Model Property of UNFO) and Theorem 3.4 (Tree-like Model Property of UNFP) using the reductions described above.

Proof of Theorem 3.3. Recall the construction of a sUNFP formula from a UNFP formula described above, and observe that, when starting with a formula of UNFO, we actually obtain a formula of sUNFO. Consider now a satisfiable UNFO formula φ. By construction the resulting sUNFO formula φ ′ is satisfiable. By Item ( 4 Proof. Fix an alternating 2 n -space bounded Turing machine M whose word problem is 2-ExpTime-hard. We may assume that the Turing machine runs in double exponential time (e.g., by maintaining a counter). Let w be a word in the input alphabet of M . We construct a formula φ w that is satisfiable if and only if M accepts w. Moreover, if φ w is satisfiable, then in fact it is satisfied in some finite tree structure. In this way, we show that the lower bound holds not only for arbitrary structures, but also for finite trees and for any class in-between. The formula φ w describes an (alternating) run of M starting in the initial state with w on the tape, and ending in a final configuration.

The run is encoded as a finite tree whose nodes labeled by a unary predicate C represent configurations of the Turing machine, and where a child-edge between two C-nodes indicates that the second node represents a successor configuration of the first. Each C-node is also labeled by a unary predicate Q i indicating the state of the Turing machine in that configuration. In addition, each C-node is the root of a subtree uniformly of height n, in which each non-leaf node has a child satisfying P 0 and a child satisfying P 1 (and no children satisfying both). We can associate to every leaf node of this subtree a number between 0 and 2 n , determined by whether each of its n ancestors (the node itself included) satisfies P 0 or P 1 . Thus, each leaf node of the subtree represents a tape cell, and, using further unary predicates, we can encode at each tape cell the current content of that tape cell, and whether the head is currently located there. See Figure 2. All in all, the schema of the structure consists of a binary relation R, unary relations C, P 0 , P 1 , a unary relation Q i for each state of the Turing machine, a unary relation for each element of the alphabet, and a unary relation H to represent the head position.

The construction of the formula φ w is based on the above encoding of runs as structures. More precisely, φ w is the conjunction of • A formula φ 1 expressing that the root node is labeled C, and that each C-node is the root of a subtree uniformly of height n in which every non-leaf node has a child satisfying P 0 and a child satisfying P 1 (and no children satisfying both). • A formula φ 2 expressing that, whenever two leaf nodes represent the same tape cell in the same configuration, then they agree on all unary predicates (note that, in UNFO, we cannot force that there is only one node representing each tape cell in a given configuration, because we cannot express inequality). • A formula φ 3 expressing that, whenever two leaf nodes represent the same tape cell in the successor configuration, and this tape cell is not the head position, then the two nodes agree on all unary predicates. • A formula φ 4 encoding the transition function of the Turing machine (i.e., whenever, in some configuration, the Turing machine is in a ∃-state (∀-state), and its head reading a particular letter, then for some (respectively, for every) possible transition there exists a corresponding successor configuration). • A formula φ 5 expressing that, in the initial (root) configuration, the tape content is w and the Turing machine is in the initial head position and state; and all final configurations (i.e., C-nodes without C-successors) are accepting configurations. We omit a detailed definition of the formulas in question, which is tedious but not difficult. For example, if we use x ↑ n ↓ m y as a shorthand for a UNFO formula stating that there is a path going n steps up in a tree from x and then m steps down reaching y, if we use leaf(x) as a shorthand for ¬∃yR(x, y), and if we use P ↑i 1 (x) as a shorthand for a UNFO formula that x has an i step ancestor satisfying P 1 , then φ 2 can be expressed as follows (for every unary predicate A):

¬∃xy(leaf(x) ∧ leaf(y) ∧ x ↑ n ↓ n y ∧ i=0...n-1 (P ↑i 1 (x) ↔ P ↑i 1 (y)) ∧ A(x) ∧ ¬A(y))
For φ 3 and φ 4 we make use of the following UNFO formula expressing the fact that x and y denote the same tape position in successive configurations:

leaf(x) ∧ leaf(y) ∧ (x ↑ n+1 ↓ n+2 y) ∧ i (P ↑i 1 (x) ↔ P ↑i 1 (y))
The rest of the construction is straightforward.

The above proof actually established the lower bound for arbitrary structures, for finite trees, and on any class in-between. Moreover, the proof only uses formulas that have negation depth 2. For formulas of negation depth 1, the satisfiability problem turns out to have a lower complexity.

Theorem 4.3. The satisfiability problem for UNFO formulas of negation depth 1 is NP NPcomplete (even for formulas containing unary predicates only).

The proof of Theorem 4.3 is postponed until Section 5 as it makes use of results regarding the complexity of model checking which are obtained there.

Model Checking

In this section we study the complexity of the model-checking problem for UNFO and UNFP. The model-checking problem takes as input a structure M and a sentence φ, and it asks whether φ is true in M . We focus here on the combined complexity of the modelchecking problem, where the input consists of a sentence and a structure. It was already observed in [START_REF] Cate | Navigational XPath: calculus and algebra[END_REF] that the model checking problem for UNFO (there called CRA(mon¬)) is in P NP . Here, we show that the problem is in fact P NP[O(log 2 n)] -complete, and that the model checking problem for UNFP is in NP NP ∩ coNP NP . We refer to the reader to Section 2.3 for the definition of the relevant complexity classes. 5.1. Model checking for UNFO. We start by showing that the model checking problem for UNFO is P NP[O(log 2 n)] -complete. We then show that bounding the nesting of negations lowers the complexity to P NP[O(log n)] -complete and that allowing subformula-sharing increases the complexity to P NP -complete.

In order to give a better intuition about the upper bound algorithms we start by presenting a naive evaluation algorithm. Recall that the negation depth of a UNFO formula is the maximal nesting depth of negations in its syntactic tree. Let φ(x) be a formula of UNFO of negation depth l and M a model. Testing for an element u ∈ dom(M ), whether M |= φ(u), can be done by induction on l using the following bottom-up strategy.

If l = 0 then φ is existential and we can test whether φ holds using one call to an NP-oracle (the oracle guesses witnesses fror the existentially quantified variables and then checks whether the remaining quantifier-free part of the formula holds).

If l = 0, then, for all elements v of M , and all maximal subformulas ψ(y) of φ that have negation depth l -1, we test whether M |= ψ(v) using the induction on l. All these tests can be performed independently of each other, and hence (by induction hypothesis) we need only l -1 parallel calls to the NP-oracle. Based on the outcomes of these calls, we compute a new structure M ′ by expanding M with new unary predicates recording for each element of M which of the maximal subformulas ψ(y) of negation depth l -1 hold at that element. We also transform φ into φ ′ replacing ¬ψ(y) with the appropriate newly introduced unary predicate. It remains to evaluate φ ′ on M ′ using the same algorithm as in the base case where l = 0.

Altogether this yields an algorithm that makes l parallel calls to an NP-oracle. When l is constant this implies that the total process can be made in P NP[O(log n)] and this gives the upper bound of Theorem 5.2 below. When l is at most log |φ| this implies that the total process can be made in P NP[O(log 2 n)] (recall the discussion in Section 2.3) and the upper bound of Theorem 5.1 essentially reduces the general case to this case. Proof. For the lower bound, we give a reduction from LEX 2 (SAT): given a Boolean formula φ(x 1 ....x n ), is x ⌈log 2 (n)⌉ true in the lexicographically maximal satisfying assignment?

Let φ(x 1 , . . . , x n ) be a given Boolean formula, and let d = log(n) (we may assume that n is a power of 2). We are interested in knowing whether x d 2 is set to 1 in the lexicographically maximal satisfying assignment of φ. For this we construct, in time polynomial in n, a model M n and a formula θ n such that M n |= θ n iff x d 2 is set to 1 in the lexicographically maximal satisfying assignment of φ.

Let M n be the structure containing n elements, a 1 , . . . , a n , together with two elements, 1, 0. The elements 1, 0 represents truth and falsity and are distinguished from the elements a 1 , . . . , a n using a unary predicate Q that holds only for 0, 1. Each of the elements a 1 , . . . , a n of M n represents a bit-string of length d encoded using d unary predicates, P 1 , • • • , P d , with the intended meaning that P i (a j ) holds in M n iff the i-th bit of the bit-string represented by a j is true. M n is such that a 1 , • • • , a n code all possible bit-strings of length d.

Below, as a suggestive notation, we will write x i for variables intended to range over truth and falsity, and y i for variables intended to range over the n elements of M n that represent length-d bit-strings. Hence ∃x ψ should be understood as ∃x Q(x) ∧ ψ and ∃y ψ as ∃y ¬Q(y) ∧ ψ.

By φ we denote the UNFO formula obtained from φ by replacing, for k ≤ d and j ≤ d, the variable x (k-1)d+j by P j (y k ). Note that the free variables of φ are y 1 , . . . , y d and x d 2 +1 , . . . , x n . As y 1 , . . . , y d will range over bit strings of length d, we are interested in the last bit of y d , i.e. P d (y d ).

We define, by induction on i, a formula χ i (y) that is true for an element a j if the length-d bit-string represented by a j describes the bits x (i-1)d+1 • • • x (i-1)d+d of the lexicographically maximal satisfying assignment of φ. It is convenient to define simultaneously another formula, ψ i (y), which is true for an element a j if the length-d bit-string represented by a j describes the bits x (j-1)d+1 • • • x (j-1)d+d in the some satisfying assignment whose prefix up to x (j-1)d is the same as the lexicographically maximal satisfying assignment of φ.

ψ i (y) = ∃y 1 . . . y d x d 2 +1 . . . x n φ ∧ y i = y ∧ j<i χ j (y j ) χ i (y) = ψ i (y) ∧ ¬∃y ′ (y ′ > y ∧ ψ i (y ′ ))
where y ′ > y is shorthand for a formula expressing that the bit-string denoted by y ′ is lexicographically greater than the bit-string denoted by y:

i<d ( j<i P j (y) ↔ P j (y ′ )) ∧ ¬P i (y) ∧ P i (y ′ ) .
Finally, take

θ n = ∃y 1 . . . y d x d 2 +1 . . . x n ( φ ∧ i≤d (χ i (y i )) ∧ P d (y d )).
Then θ n is true in M n if and only if x d 2 is true in the lexicographically maximal satisfying assignment of φ as required. Moreover θ n is indeed a formula of UNFO. Finally notice that each χ i has a size exponential in i but they are used only for i ≤ d = log n. Hence θ n has polynomial size and can be computed in time polynomial in n.

Figure 3: A block in a TB-tree with n children

We now turn to the upper bound. Recall the algorithm presented in the preamble of this section. If the syntactic tree of the formula would be a balanced binary tree then its negation depth l would be bounded by the log of the size of the formula and we would be done. The idea is to evaluate the formula by first making its syntactic tree balanced. This trick has already been applied in the context of branching time model checking using "Tree Block Satisfaction" [START_REF] Schnoebelen | Oracle circuits for branching-time model checking[END_REF]. Instead of redoing the trick, we reduce the model checking problem of UNFO to this one.

We first present "Tree Block Satisfaction", called TB(SAT) 1×M in [START_REF] Schnoebelen | Oracle circuits for branching-time model checking[END_REF]. In fact, for present purposes, it suffices to consider a restricted version of the problem TB(SAT) 1×M , which we will refer to simply as TB(SAT) in what follows. We will describe here this restricted version. A TB-tree of width k ≥ 1 is a tree consisting of blocks, where each block is, intuitively, a kind of Boolean circuit having k output gates and having k input gates for each of its children. See Figure 3. The i th output of a block is defined in terms of the input gates by means of an existentially quantified Boolean formula χ i of the form

∃b 1 c 1 . . . b m c m d c 1 = input i 1 (b 1 ) ∧ • • • ∧ c m = input im (b m )) ∧ ψ
where each b j is a tuple of log k Boolean variables, encoding a number [[b j ]] from 1 to k, and input i j (b j ) represents the value of the [[b j ]]-th output bit of the i j -th child block (which is denoted by y 3) and ψ is a Boolean formula using any of the existentially quantified Boolean variables.

(i j ) [[b j ]] in Figure
TB(SAT) is then the problem, given a TB-tree and a truth assignment for all inputs of the blocks that are leaves of the TB-tree, whether the first output bit of the root block evaluates to true. It was shown in [42, corollary 3.4] that TB(SAT) can be decided in

P NP[O(log 2 n)] .
Given a formula φ of UNFO and a structure N , we construct in polynomial time a TB-tree that is a yes instance of TB(SAT) iff N |= φ. The reduction is simple and reflects the naive evaluation of φ on N .

The construction of the TB-tree is by induction on φ. The width k of the TB-tree is the size of the domain of N . At each step of the induction the block of the root of the TB-tree is associated to a subformula of φ having one free variable, and is such that its output gate i is set to 1 iff the i-th element of N makes the associated subformula true. Altogether the shape of the TB-tree resemble the one of the syntactic tree of the formula. In the QBF formulas constructed below we denote by b a vector of log k variables and [[b]] = i is a shorthand for the Boolean formula stating that b represents the binary encoding of i.

Let φ(x) be any formula in one free variable.

Case 1: φ(x) is of the form ¬ψ(x). By induction hypothesis, we have a TB-tree for ψ(x) such that the outputs from the root block indicate which elements of N satisfy ψ(x). We extend this TB-tree with one extra block on top, in which the i-th output gate is defined by the formula ∃b, c

(c = input(b) ∧ [[b]] = i ∧ c = 0
). This formula sets its output to 1 iff its input i is set to 0, hence preserves the inductive hypothesis as required.

Case 2: φ(x) is built up from atomic formulas and formulas in one free variable using conjunction and disjunction and existential quantification. Let y 1 , . . . , y n be the set of all existentially quantified variables in φ. Let ψ 1 (z 1 ) . . . , ψ m (z m ) be the maximal subformulas in one free variable occurring in φ, where z 1 . . . z m are among x, y 1 , . . . , y n . We may assume without loss of generality that z 1 , . . . , z m are the first m variables from the sequence y 1 , . . . , y n (in particular that z 1 , . . . , z m are distinct variables) because if not, one can always introduce another existentially quantifier variable y n+1 and replace ψ j (z j ) by (ψ j (y n+1 ) ∧ y n+1 = z j ). By induction, we have a TB-block T j for each ψ j (y j ) such that the outputs from the root block of T j indicate which elements of N satisfy ψ j (y j ). The TB-tree for φ will consist of a new root block whose children are the roots of each of the T j . The definition of the i-th output gate is

∃b 1 , c 1 , . . . , b m , c m , b m+1 , . . . , b n j≤m (c j = input j (b j )) ∧ χ N
where χ N is obtained from φ by replacing each subformula of the form ψ l (y l ) by c l , each subformula of the form x = y l by b l = i, each subformula of the form y l = y l ′ by b l = b l ′ and each subformula of the form R(y l 1 , . . . , y lκ ) by a Boolean formula listing all tuples in the relation R N :

([[d 1 ]],...,[[dκ]])∈R N (b l 1 = d 1 ∧ . . . ∧ b lκ = d κ )
Note that Case 2 covers the base case when φ(x) has no subformula with one free variable.

It is now easy to check that the TB-tree constructed by the above induction has the desired property and can be computed in polynomial time. This concludes the proof of the Theorem.

As mentioned earlier, restricting the nesting of negations gives a lower complexity. Theorem 5.2. For all l > 0, the complexity of the model-checking problem for UNFO formula of negation depth bounded by l is P NP[O(log n)] -complete. The lower bound holds even for a fixed structure.

Proof. For the lower bound we use the equivalent characterization of P NP[O(log n)] as the class of problems that are PTime truth-table reducible to NP. As 3-colorability is NPcomplete, every problem in P NP[O(log n)] is PTime truth-table reducible to 3-colorability. Recall from Section 2.3 that a PTime truth-table reduction from a given problem to 3colorability is a PTime algorithm that, given an instance of the problem, produces a set y 1 , • • • , y n of inputs to 3-colorability, together with a Boolean formula φ(x 1 , • • • , x n ), such that the input is a yes-instance iff φ evaluates to true after replacing each x i by 1 if y i is 3-colorable and 0 otherwise.

We show that we can reduce any problem that is PTime truth-table reducible to 3colorability to the model checking problem for UNFO formula of negation depth 1. For this, fix a problem P that is PTime truth-table reducible to 3-colorability. Let w be an input string for P . We construct from w, in time polynomial in |w|, an instance M and a formula φ w such that M |= φ w iff w ∈ P . As M will be independent of w and φ w will be in UNFO and with nesting depth 1, this will show P NP[O(log n)] -hardness.

By assumption, there is a polynomial time algorithm that produces from w a tuple G 1 , • • • , G n , C(x 1 , . . . , x n ) such that w ∈ P iff C(x 1 , . . . , x n ) evaluates to 1 after replacing each of the x i by 1 iff G i is 3 colorable.

For each graph G, let q G be the canonical conjunctive query of G, that is, the existentially quantified conjunction of relational atoms, where there is an existentially quantified variable for each node of G, and a relational atom for each edge of G. Note that, since q G does not use negation, it belongs to UNFO. Let M be the structure representing a clique of size 3. It is well known that M |= q G iff G is 3-colorable. Let φ w be the formula constructed from C by replacing each occurrence of x i with the sentence q G i . It is immediate to verify that the resulting formula is in UNFO, has negation depth 1 and satisfies the properties required for the reduction. Moreover φ w can be computed in time polynomial in |w| as this was the case for G 1 , • • • , G n , C(x 1 , . . . , x n ) . This completes the proof for the lower-bound.

The upper bound is obtained using the naive evaluation of the formula presented in the preamble of this section as l is treated as a constant.

We now consider formalism equivalent in expressive power to UNFO but with a more succinct syntax that allows the sharing of subformulas. Let us denote by UNFO(let) the extension of UNFO with Boolean variables b 1 , b 2 , . . . (ranging over truth values) that can be used as atomic formulas, and with a new construct let b = φ in ψ, where b is a Boolean variable, φ is a sentence, i.e., a formula without free first-order variables but possibly with free Boolean variables (excluding b itself), and ψ is a formula that may use all the Boolean variables, including b. We only consider UNFO(let) formulas without free Boolean variables, i.e., in which each occurring Boolean variable is bound by a let operator. The semantics of UNFO(let) formulas is as expected: when the valuation of the Boolean free variables of φ is known, we can derive a valuation for b using b = φ and then we can evaluate ψ.

Example 5.3. A typical formula of UNFO(let) looks like this:

let b = ψ in ∃x 1 , . . . x n b = 0 ∧ ψ 1 (x) ∨ b = 1 ∧ ψ 2 (x)
It is equivalent to the UNFO formula:

∃x 1 , . . . x n ¬ψ ∧ ψ 1 (x) ∨ ψ ∧ ψ 2 (x)
The UNFO(let) model checking problem is the problem of evaluating a given UNFO(let) formula without free Boolean variables in a given structure.

Theorem 5.4. The UNFO(let) model-checking problem is P NP -complete. The lower bound holds even for a fixed structure.

Proof. For the upper bound, we use a simple bottom-up evaluation strategy. Let φ be any UNFO(let) formula. We may assume without loss of generality that each let-operator in φ binds a different Boolean variable. We assign a rank to each Boolean variable occurring in φ: a Boolean variable b has rank 0 if its definition (i.e., the sentence to which it is bound by its let-operator in φ) does not contain any Boolean variables (free or bound), and b has rank k + 1 if its definition only contains Boolean variables of rank at most k. Using Theorem 5.1 repeatedly as an oracle, we can compute in polynomial time a truth value for each Boolean variable. Finally, by replacing all Boolean variables in φ by their truth value and applying Theorem 5.1 once more, we find out whether φ is true in the structure. Altogether this yields a P NP algorithm.

For the lower bound, we make use of the problem LEX(SAT): given a satisfiable Boolean formula φ(x 1 , . . . , x n ), test if the value of x n is 1 in the lexicographically maximal solution (cf. Section 2.3). Given a satisfiable Boolean formula φ(x 1 , . . . , x n ) we construct in time polynomial in n a model M and a UNFO(let) formula ψ such that M |= ψ iff x n is 1 in the lexicographically maximal solution of φ.

The idea of the reduction will be to construct the lexicographically maximal solution B 1 • • • B n of φ bit by bit from B 1 to B n using the following algorithm:

B 1 is true iff φ(⊤, x 1 , . . . , x n ) is satisfiable and if B 1 • • • B i have already been computed then B i+1 is true iff φ(B 1 , • • • , B i , ⊤, x i+1 , • • • , x n ) is satisfiable.
Specifically, our reduction uses a fixed structure M with two elements, one of which is labeled by a unary predicate T and intuitively represents true while the other element represents falsity. We let φ be the UNFO formula obtained from φ by replacing each positive occurrence of the variable x i in φ by the formula T (x i ) and each occurrence of ¬x i in φ by the formula ¬T (x i ).

We construct by induction sentences ψ 1 , . . . , ψ n , where each ψ i is true in M if and only if B i is 1. By definition B 1 = 1 iff φ has an satisfiable assignment setting x 1 to true. This can be expressed using the formula:

ψ 1 := ∃x 1 . . . x n ( φ(x 1 , . . . .x n ) ∧ T (x 1 )) ,
By definition the following UNFO formula, obtained by induction, expresses that B i is 1:

ψ i := ∃x 1 . . . x n ( φ(x 1 , . . . , x n ) ∧ ( j<i T (x j ) ↔ ψ j ) ∧ T (x i )).
Notice that the size of ψ i is exponential in i and therefore, even though ψ n does express the truth value of B n , this would not give a polynomial time reduction. However, using the let construction of UNFO(let) we can derive the same formulas more succinctly.

Let ψ ′ i be the formula (with b 1 , . . . , b i-1 as free Boolean variables):

∃x 1 , . . . x n ( φ(x 1 , . . . , x n ) ∧ ( j<i T (x j ) ↔ b j ) ∧ T (x i )) .
Then we set ψ be the UNFO(let) formula:

ψ := let b 1 = ψ ′ 1 in let b 2 = ψ ′ 2 in . . . let b n-1 = ψ ′ n-1 in ψ ′ n
Then notice that ψ has all the desired properties: it is in UNFO(let), it can be computed in time polynomial in n and it verifies that M |= ψ iff B n = 1. This concludes the proof.

Satisfiability for UNFO formulas of negation depth 1. We are now also in a position to give the proof of Theorem 4.3, which states that testing satisfiability for UNFO formulas of negation depth 1 is NP NP -complete.

Proof of Theorem 4.3. Let ψ be any UNFO formula of negation depth 1, and let χ be the first-order formula obtained by bringing φ into prenex normal form. Note that χ is, in general, no longer a UNFO formula. Since ψ does not contain nested negations or universal quantifiers, χ is of the form ∃x∀yχ ′ , where χ ′ is a quantifier-free formula, which we may assume to be in negation-normal form. In addition, we know that the variables y can only occur in negative atomic subformulas of χ. In other words, all positive atomic subformulas of χ use only variables in x. We claim that χ, and hence, ψ, has a "polynomial size model property": suppose M |= ∀yφ(a, y). Let M ′ be the submodel of M containing only the elements a and containing only the (polynomially many) facts about a that occur positively in φ(a, y). It is easy to see that M ′ still satisfies ∀yφ(a, y). The existence of a model of φ can now be tested by guessing a structure of polynomial size and then applying the model checking procedure to verify whether it is a model or not. Using Theorem 5.2, this implies that the satisfiability problem for UNFO-formulas of negation depth 1 is in NP NP .

Hardness is by reduction from the problem of evaluating QBF formulas of the form φ := ∃x∀yψ with x = x 1 . . . x n and y = y 1 . . . y m which is known to be complete for NP NP . We will construct in PTime a UNFO formula of negation depth 1 that is satisfiable if and only if φ evaluates to true. Take the vocabulary consisting of unary predicates T and F plus unary predicates P 1 , . . . , P n corresponding to the existentially quantified variable x. The UNFO formula is defined as the conjunction ∃x.T (x) ∧ ∃x.F (x) ∧ ¬∃x.(T (x) ∧ F (x))

∧ i≤n ∃x(P i (x) ∧ (T (x) ∨ F (x))) ∧ ¬(∃x.(P i (x) ∧ T (x)) ∧ ∃x(P i (x) ∧ F (x))) ∧ ¬∃y( i (T (y i ) ∨ F (y i )) ∧ -φ)
where -φ is obtained by negating φ, then pushing the negations down to the atoms, and then replacing y i by T (y i ), replacing ¬y i by F (y i ), replacing x i by ∃x(P i (x) ∧ T (x)), and replacing ¬x i by ∃x(P i (x) ∧ F (x)).

It is straightforward to verify that this UNFO formula is satisfiable if and only if φ evaluates to true, and that it has negation depth 1.

5.2.

Model checking for UNFP. We now turn to the complexity of the model checking of UNFP. It is convenient, at this point, to treat the greatest-fixpoint operator (GFP) as a primitive operator, instead of as a defined connective. This way we can use dualization in order to assume without loss of generality that all formulas of UNFP are such that every occurrence of a fixpoint operator in φ is a positive occurrence (i.e., lies under an even number of negations). We also assume without loss of generality that each fixpoint operator binds a different variable, so that we can speak of the fixpoint definition of a variable X, by which we mean the formula directly below the fixpoint operator binding X. The dependency graph of fixpoint variables in φ is the directed graph whose nodes are the fixpoint variables in φ and where there is an edge from X to Y if Y occurs (free or bound) inside the fixpoint definition of X. We say that a UNFP formula is alternation free if the dependency graph does not have a cycle containing both a least fixpoint variable and a greatest fixpoint variable [START_REF] Niwinski | On fixed-point clones[END_REF].

We first consider the alternation-free fragment.

Theorem 5.5. The model-checking problem for the alternation-free fragment of UNFP is P NP -complete.

Proof. Recall that we assume the formulas are such that every occurrence of a fixpoint operator in φ is a positive occurrence (i.e., lies under an even number of negations).

We first prove the claim for formulas containing only LFP operators (no GFP operators). Let φ be any UNFP formula containing only least fixpoint operators and M be a model. Let X = X 1 , . . . , X n be the fixpoint variables occurring in φ (we assume each fixpoint operator binds a different variable). Initially, we assign each X i to be the empty set. We then repeatedly consider each fixpoint variable X i and evaluate its fixpoint definition β i , viewed as a UNFO formula by using the current choice of sets X to interpret the free set variables of β i as well as the fixpoint subformulas of β i , and check if new elements are derived that do not already belong to the set X i . If this is the case, we add the elements in question to X i . We repeat this procedure until no new elements are derived. It is well known that the resulting sets we end up with are the least fixpoint solutions for the fixpoint subformulas of φ. Furthermore, the number of iterations is polynomial, since, in each iteration, at least one element of M gets added to on of the sets, and each iteration can be performed in P NP[O(log 2 n)] by Theorem 5.1.

By dualization, we get the same result for formulas containing only greatest fixpoint operators. The result is then easily lifted to the full alternation free fragment by induction on the alternation rank of the fixpoint variable in question, where the alternation rank is defined as the (finite) maximal number of fixpoint alternations on an outgoing path from that variable in the dependency graph: we simply perform a bottom up evaluation based on the syntactic tree defining φ, coloring each node of M with the fixpoint formulas that it satisfies using the above algorithms.

For the lower bound, we reduce from LEX(SAT). Let φ(x 1 , . . . , x n ) be any Boolean formula that is the input of the LEX(SAT) problem. We may assume without loss of generality that φ is in negation normal form. We construct a structure M , whose domain is {t 1 , . . . , t n , f 1 , . . . , f n }, and with unary predicates T and V 1 , . . . , V n , such that T M = {t 1 , . . . , t n }, and V M i = {t i , f i }. Intuitively, each element t i represents the eventuality that the value of x i in the lexicographically maximal satisfying assignment is 1, while f i represents the eventuality that the value of x i in the lexicographically maximal satisfying assignment is 0. Using a fixpoint formula, we will compute the set of all elements that are actually "true" in the lexicographically maximal satisfying assignment. It then suffices only to check whether t n belongs to this set.

Let φ ′ be obtained from φ by replacing every occurrence of a Boolean variable x i by T (x i ). Let θ be the formula ∃z(V n (z) ∧ T (z) ∧ [LFP X,x ψ](z)) where ψ is the disjunction of all formulas of the following forms, for all 1 ≤ k ≤ n:

V k (x) ∧ T (x) ∧ ∃x 1 , . . . , x n ( i=1...n V i (x i ) ∧ φ ′ ∧ X(x 1 ) ∧ • • • ∧ X(x k-1 ) ∧ T (x k )) and V k (x) ∧ F (x) ∧ ¬∃x 1 , . . . , x n ( i=1...n V i (x i ) ∧ φ ′ ∧ X(x 1 ) ∧ • • • ∧ X(x k-1 ) ∧ T (x k ))
It is easy to see from the construction that θ is true in M if and only if x n = 1 in the lexicographically maximal satisfying assignment for φ.

We now turn to the general case.

Theorem 5.6. The UNFP model checking problem is in NP NP ∩ coNP NP and P NP -hard.

Proof. The lower bound is immediate from Theorem 5.5. We prove here the upper bound.

Since UNFP is closed under unary negation, it is enough to show that the modelchecking problem is in NP NP . We show a slightly stronger result proving that, for every formula in at most one free variable, we can decide in NP NP whether a given element of a given structure makes the formula true. The algorithm we describe below is inspired by an idea from [START_REF] Vardi | On the complexity of bounded-variable queries[END_REF] to reduce the problem to the case of formulas that only contain least fixpoint operators (and no greatest fixpoint operators) by guessing a set for each greatest fixpoint operator.

In the sequel we will only consider formulas φ with one free first-order variable and by "evaluating" this formula over M , intuitively, we mean computing, non-deterministically, a set of elements of M making the formula true.

Recall from the beginning of the section that we consider UNFO-formula in which we allow both LFP and GFP-operators, and we require that all occurrences of fixpoint operators are positive. Equivalently, we view each UNFP formula as being defined inductively by the grammar:

φ ::= α(X, ψ, x) ψ ::= [LFP Y,y φ(Y, X, y)](x) | [GFP Y,y φ(Y, X, y)](x)
where α is a UNFO formula with one free first-order variable, possibly several monadic second-order variables, and possibly using as atoms fixpoint subformulas ψ(z) defined by mutual induction using the above grammar, such that X and ψ occur only positively (under an even number of negations) in α.

Given a formula of the form α(X, ψ, x) we denote by α the UNFO formula constructed from α by replacing each nested fixpoint subformula ψ(z) by Y (z) where Y is the variable defined by ψ. Hence α has x as unique first-order free variable and X and Y as monadic second-order free variables. The positivity condition stated above implies that α is monotonic with respect to X and Y .

Given a structure M , sets U of elements of M and a UNFO formula φ(X, x) we denote by eval(φ, (M, U )) the subset of the domain of M computed by induction on the syntactic representation of φ using the following algorithm where, as a convenient notation, we also write eval(φ, (M, U )) for φ = φ 1 , . . . , φ n , to denote the tuple (eval(φ 1 , (M, U )), . . . , eval(φ n , (M, U ))):

eval(φ, (M, U )) • Case φ is of the form α(X, ψ, x) (1

Trees

In this section, we study the expressive power and computational complexity of UNFO and UNFP on trees. We consider three types of trees: binary trees (with two deterministic successor relations child 1 , child 2 , and any number of unary predicates), unranked trees (with a single child relation, and any number of unary predicates), and XML trees (that is, trees in which nodes can have any number of children and the children of each node are ordered, and where the signature consists of the horizontal and vertical successor and order relations, and any number of unary predicates). We will consider finite trees, but all proofs generalize to infinite trees. On XML trees with all axes, it is known that Core XPath = FO 2 for unary queries while Core XPath = U CQ-over-FO 2 -unary-predicates for binary queries [START_REF] Marx | Semantic characterizations of navigational XPath[END_REF]. It turns out that UNFO has the same expressive power as Core XPath, both for unary and for binary queries (cf. [START_REF] Cate | Navigational XPath: calculus and algebra[END_REF], where UNFO is called CRA(mon¬)) and therefore UNFO characterizes Core XPath in a more uniform way. In particular, since the XML tree languages definable in Core XPath are precisely the ones definable in FO 2 [START_REF] Marx | Semantic characterizations of navigational XPath[END_REF], this implies that UNFO defines the same XML tree languages as FO 2 . The same holds already for UNFO 2 .

In this section, we further analyze the expressive power and complexity of UNFO and UNFP on trees.

The following observation will be helpful. We say that two unranked trees are root-toroot bisimilar if the roots of the two trees are bisimilar. Lemma 6.1. Two unranked trees are UN-bisimilar if and only if they are root-to-root bisimilar.

Proof. It is clear that every UN-bisimulation is a root-to-root bisimulation. Conversely suppose t, t ′ are root-to-root bisimilar trees, with roots r and r ′ . For any node a of t, we denote by depth t (a) the distance from r to a, and we denote by by t a the subtree of t rooted at a. Similar notations apply to t ′ . Let Z consist of all pairs (a, b) of nodes from t and t ′ , respectively, such that (i) depth t (a) = depth t ′ (b) = k ≥ 0, and (ii) for each i ≤ k, the subtree of t rooted at the i-th ancestor of a and the subtree of t ′ rooted at the i-th ancestor of b are root-to-root bisimilar.

We claim that Z is a UN-bisimulation. Let (a, b) ∈ Z. We show how to construct a homomorphism h from t to t ′ that maps a to b. The other direction is established in the same way.

The homomorphism h is constructed as follows: first, the root-to-root bisimulation between t a and t ′ b induces a homomorphism from t a to t ′ b . If a = r and b = r ′ , we are done. Otherwise, let a ′ be the parent of a and let b ′ be the parent of b. Then the root-to-root bisimulation between t a ′ and t ′ b ′ induces a homomorphism from t a ′ to t ′ b ′ , which, we may assume, extends the previously constructed homomorphism from t a to t ′ b . Repeating the same argument, after k many steps, we obtain a homomorphism from t to t ′ that maps a to b, and we are done.

We start with UNFP. Recall that UNFP is included into MSO. Hence, over all kind of trees, UNFP sentences only define regular languages (that is, MSO-definable classes of trees). The converse is also true: Theorem 6.1. The following hold both over the class of finite trees and over the class of finite and infinite trees:

(1) On binary trees, UNFP defines the regular languages.

(2) On XML trees, UNFP defines the regular languages.

(3) On unranked trees, UNFP defines the root-to-root bisimulation invariant regular languages. The same hold for UNFP 2 .

Proof. It is known that all the three statements hold for the µ-calculus [START_REF] Janin | On the expressive completeness of the propositional µ-calculus w.r.t. monadic second-order logic[END_REF] (as well as for monadic Datalog [START_REF] Gottlob | Monadic datalog and the expressive power of languages for web information extraction[END_REF]). Hence, as the µ-calculus is a fragment of UNFP this shows the first two claims and one direction of the third claim. Moreover, as every formula of the µ-calculus is equivalent to a UNFP 2 sentence, UNFP collapses to UNFP 2 over trees. Clearly, UNFP can only define regular languages that are invariant under UN-bisimulation. Hence the other direction of the third claim follows from Lemma 6.1.

We now turn to UNFO. The k-neighborhood of a node of a tree is the subtree rooted at that node, up to depth k. A binary tree language is LT (Locally Testable) if membership into this language is determined by the presence or absence of isomorphism-types of kneighborhoods for some k. Similarly, an unranked tree language is ILT (Idempotent Locally Testable) if membership is determined by the presence of absence of bisimulation-types of k-neighborhoods, for some k. Theorem 6.2. The following hold both over the class of finite trees and over the class of finite and infinite trees:

(1) On binary trees, UNFO defines the LT regular languages.

(2) On unranked trees, UNFO defines the ILT regular languages. The same hold for UNFO 2 .

Proof. Since binary trees have bounded degree, there are only finitely many isomorphism types of k-neighborhoods for any given k. Moreover, each can be completely described by a UNFO formula. It follows that the LT regular languages can be defined in UNFO (in fact, in UNFO 2 ). Incidentally, note that the only negation used in this construction is Boolean negation (i.e., negation applied to sentences), except for expressing the fact that a node is the root or is a leaf.

For unranked trees, the ILT regular languages are precisely the ones that can be defined by a global ML formula as defined in Section 2.2 [START_REF] Place | A decidable characterization of locally testable tree languages[END_REF]. It is clear that this language is contained in UNFO, and therefore all ILT regular language are definable by a UNFOsentence (in fact, a UNFO 2 -sentence).

For the other direction, let φ be a sentence of UNFO. Without loss of generality we can assume that φ is in UN-normal form and satisfies the simplifying assumptions described in Step 1 of Section 4.2.

We can further assume without loss of generality that the conjuncts τ (z) occurring in the formulas:

∃z τ (z) ∧ z i = y ∧ j∈{1...n}\{i} φ j (z j ) or ∃z τ (z) ∧ j∈{1...n} φ j (z j )
are connected when seen as structures. If this were not the case, let I be the set of indices j such that z j is in the component of y, z I and τ I the corresponding fragments of z and τ . Let J, z J and τ J be parts containing the remaining indices. Then

∃z τ (z) ∧ z i = y ∧ j∈{1...n}\{i} φ j (z j ) is equivalent to ∃z I τ I (z I ) ∧ z i = y ∧ j∈I φ j (z j ) ∧ ∃z J τ J (z J ) ∧ j∈J φ j (z j )
Notice that the right-hand side of the resulting formula is a sentence. Therefore φ is equivalent to the disjunction of φ 1 and φ 2 where φ 1 is the conjunction of ∃z J τ J (z J ) ∧ j∈J φ j (z j ) with φ where this right-hand side part was replaced with true, and φ 2 is the conjunction of ¬∃z J τ J (z J ) ∧ j∈J φ j (z j ) and φ where this right-hand side part was replaced by false.

In summary, we can assume that φ is a Boolean combination of sentences in UN-normal form, satisfying the simplifying assumption, starting with an existential quantifier, and such that all its neighborhood types are connected. Hence it is enough to consider a single such sentence.

Let x be the first existentially quantified variable of φ, i.e. φ is ∃xψ(x). By our assumptions on φ, all quantified variables of ψ can be taken to range over the neighborhood of x up to distance |φ|. Hence, whether ψ(x) holds or not at a node a of a tree T only depends on the neighborhood of a up to distance |φ|.

In the binary tree case, there are only finitely many such neighborhoods and each of them is implied by the existence of the isomorphism-type of a k-neighborhood for k = 2|φ|. Hence φ describes a language in LT.

In the unranked tree case, there are infinitely many such neighborhoods. But, as UNFO is invariant under UN-bisimulation, it is enough to consider those neighborhoods up to UNbisimulation. Each of the UN-bisimulation classes of these neighborhoods is implied by the existence of the UN-bisimulation-type of a k-neighborhood for k = 2|φ|. By Lemma 6.1 (and the characterization of ILT on unranked trees in terms of global ML), this implies that φ describes a language in ILT.

We conclude this section by investigating the complexity of satisfiability. Theorem 6.3. The satisfiability problem for UNFO and for UNFP is 2ExpTime-complete on binary trees, on ranked trees, and on XML trees.

Proof. For the lower bound, recall that the proof of Proposition 4.2 was based on an encoding of Turing machine runs as finite trees. Hence it applies here too.

For the upper bound, we will consider the case of UNFP on XML trees, as all other cases can be seen as a special case of this one. We will describe an exponential-time translation to µRegular XPath, the extension of Core XPath [START_REF] Gottlob | Efficient algorithms for processing XPath queries[END_REF] with the Kleene star and with the least fixpoint operator, for which satisfiability on XML trees can decided in ExpTime [START_REF] Cate | The expressivity of XPath with transitive closure[END_REF]. We briefly recall the syntax of µRegular XPath (cf. [START_REF] Cate | The expressivity of XPath with transitive closure[END_REF] for more details). The language has two sort of expressions, node expressions φ and path expressions α which are defined by mutual recursion:

α ::= ↑ | ↓ | ← | → | . | α[φ] | α/β | α ∪ β | α * φ ::= P i | ⊤ | ¬φ | φ ∧ φ | α | X | µXφ
where, in node expressions of the form µXφ, the variable X is required to occur only positively (i.e., under an even number of negations) in φ.

Let φ be any UNFP-sentence, or, more generally, a UNFP-formula with at most one free variable. We may assume without loss of generality that φ is in UN-normal form. In other words, φ is built up from atomic formulas using (i) negation, (ii) fixpoint operators, and (iii) existential positive formulas. The translation to µRegular XPath is now by induction. The base case of the induction, as well as the induction step for negation and for the fixpoint operators, is immediate. Now, suppose that φ is given by an existential positive formula built from atomic relations and subformulas in one free variable for which we already know that there exists a translation. Here, we can apply the known result from [START_REF] Gottlob | Conjunctive queries over trees[END_REF][START_REF] Benedikt | Structural properties of XPath fragments[END_REF] that, on XML trees, every positive existential first-order formula in one free variable (over the given signature) can be translated to a Regular XPath expression (in fact, to a Core XPath expression) in exponential time. Note that when we apply this translation to a UNFP formula, we may treat subformulas in one free variable as unary predicates).

Discussion

7.1. Logics that are contained in UNFO and UNFP. We have seen that unary negation logics generalize UCQ, ML, monadic Datalog and µ-calculus. We list here other related formalisms.

7.1.1. Unary conjunctive view logic. First-order unary-conjunctive-view logic (UCV) was introduced in [START_REF] Bailey | Logical queries over views: Decidability and expressiveness[END_REF] as a fragment of FO. A UCV query is an equality-free first-order formula over a signature consisting of unary predicates only, but where each of these unary predicates is in fact a view defined by a unary conjunctive query. It is easy to see that every UCV query can be expressed by a UNFO-formula. Indeed, a quantifier elimination argument (cf. [START_REF] Hodges | Model Theory[END_REF]) shows that, over signatures consisting only of monadic relations, every equality-free firstorder formula is equivalent to a UNFO formula). UNFO can be viewed as a generalization of UCV where views may be defined in terms of each other (but without cyclic dependencies between view predicates). 7.1.2. The temporal logic CTL * (X). CTL * (X) is the fragment of the temporal logic CTL * in which only the modal operator X ("next") is allowed. More precisely, the syntax of CTL * (X) can be defined as follows: The semantics is the usual one for CTL * , and we refer the interested reader to [START_REF] Clarke | Model checking[END_REF]. One can show that there is a polynomial truth-preserving translation from CTL * (X) formulas to UNFO formulas. The model checking problem for CTL * (X) is known to be complete for the complexity class P NP[O(log 2 n)] [START_REF] Schnoebelen | Oracle circuits for branching-time model checking[END_REF]. This can be used to provide an alternative proof of the P NP[O(log 2 n)] -hardness of the model checking problem of UNFO, cf. Theorem 5.1. 7.1.3. Description logics. The basic description logic ALC (which is a notational variant of the basic multi-modal logic K) can be viewed as a fragment of UNFO. The same holds for a number of extensions of ALC. Moreover, the query answering problem for these description logics reduces to the entailment problem for UNFO. Recall that the query answering problem is the following problem (cf. [START_REF] Baader | The Description Logic Handbook: Theory, Implementation, and Applications[END_REF] for basic terminology):

Given a TBox (i.e., set of concept inclusions) T , an ABox (set of atomic formulas speaking about individuals c 1 . . . c n ) A, a conjunctive query q(x 1 , . . . , x k ), and a tuple of individuals (c i 1 , . . . , c i k ), is (c i 1 , . . . , c i k ) an answer to q in every model of T ∪ A? It is easy to see that this is equivalent to the validity of the UNFO-entailment φ T ∧ A[c 1 /x 1 , . . . , c n /x n ] |= q(x i 1 , . . . , x i k ) where φ T is the UNFO-translation of T . This (together with Remark 3.9) gives a new proof of the known result that query answering for ALC is decidable and that it has the finite model property (cf. [START_REF] Lutz | The complexity of conjunctive query answering in expressive description logics[END_REF]). Note that the same argument works not only for ALC but for any description logic whose TBoxes can be expressed in UNFP. Moreover, the argument works not only for conjunctive queries, but for any class of queries expressible in UNFP.

7.2.

Comparison with guarded logics. We have already seen in Example 2.1 that UNFO and GFO are incomparable in terms of expressive power: It is easy to show that the GFO formula ∀xy(R(x, y) → S(x, y)) is not invariant under UN-bisimulations and therefore not expressible in UNFO. On the other hand a simple argument shows that the UNFO formula ∃yzu(R(x, y) ∧ R(y, z) ∧ R(z, u) ∧ R(u, x)) is not invariant under guarded-bisimulations and therefore not expressible in GFO.

The decidability and expressibility results obtained in this paper for UNFO and UNFP have many similarities with those of their modal logic counterparts. Actually several proofs are reductions to the modal counterparts. This is in contrast with guarded logics that often require new and difficult arguments. A typical example is the finite model property of GFO whose proof is based on the Herwig Extension Theorem (cf. [START_REF] Grädel | On the restraining power of guards[END_REF]). In contrast, we prove the finite model property for UNFO by reduction to the analogous result for ML (which has a very simple proof using filtration, cf. [START_REF] Blackburn | Modal Logic[END_REF]).

It is possible to reconcile the unary negation approach and the guarded approach into one logical formalism called guarded negation logic, where it is possible to negate a formula if all its free variables are guarded: R(x) ∧ ¬φ(x). The first-order and fixpoint formalisms obtained this way generalize both the unary negation and guarded approaches and enjoy all the nice properties of UNFO and UNFP [START_REF] Bárány | Guarded negation[END_REF]. 7.3. Undecidable extensions. Our results show that UNFO and UNFP are well behaved logics. One may ask if there are extensions that are still well behaved. Inequalities are a minimal form of negation not supported by UNFO. Unfortunately, extending UNFO with inequalities leads to undecidability. Let us denote by UNFO = the extension of UNFO with inequalities, and by UNFO ¬ the extension of UNFO with negative relational atomic formulas. Recall that a fragment of first-order logic is called a conservative reduction class if there is a computable map from arbitrary first-order formulas to formulas in the fragment, which preserves (un)satisfiability as well as finite (un)satisfiability. Theorem 7.1. UNFO = and UNFO ¬ are conservative reduction classes, and hence undecidable for satisfiability on arbitrary structures and on finite structures.

Proof. It is known [START_REF] Börger | The Classical Decision Problem[END_REF] that FO 1 with two unary functions and equality is a conservative reduction class. We can translate this logic into UNFO = with two binary relations (we can use inequalities to express that the two relations are graphs of functions, as in ¬∃xyz(Rxy ∧ Rxz ∧ y = z), and atomic formulas such as f (x) = g(x) are expressed by ∃yz(F (x, y) ∧ G(x, z) ∧ y = z)). This shows that UNFO = is a conservative reduction class.

For UNFO ¬ , we use a similar argument. Let E, F, G be binary relations. Using negative atomic formulas, it is possible to express that E is an equivalence relation, as in ¬∃xyz(Exy∧ Eyz ∧¬Exz)∧¬∃xy(Exy∧¬Eyx)∧¬∃x¬Exx, and that F, G are graphs of functions defined on equivalence classes of E, as in ¬∃x¬∃y(F xy) ∧ ¬∃xx ′ yy ′ (Exx ′ ∧ F xy ∧ F x ′ y ′ ∧ ¬Eyy ′ ), and similarly for G. We then use the same reduction as in the case of UNFO = , except that E takes the role of the equality relation. Also, in the fixed point case, one can wonder whether the restriction to monadic least fixed-points was necessary. Indeed, this question naturally arises since it is known that the guarded fragment of first-order logic is decidable even when extended with (guarded) fixed point operators of arbitrary arity. However, adding non-monadic fixpoint operators to our setting make the logic undecidable.

Theorem 7.2. The extension of UNFP with non-monadic fixed point operators is undecidable for satisfiability on arbitrary structures and on finite structures.

Proof. It was shown in [START_REF] Shmueli | Equivalence of datalog queries is undecidable[END_REF] that the containment problem for Datalog is undecidable on finite structures and on arbitrary structures (the result is only stated in [START_REF] Shmueli | Equivalence of datalog queries is undecidable[END_REF] for finite structures, but the proof applies to any class of structures that contains all encodings of finite strings, under some encoding).

We reduce this problem to the problem at hand. A containment between two Datalog queries Π 1 , Π 2 holds precisely if ∃x(φ Π 1 (x) ∧ i P i (x i )) ∧ ¬∃x(φ Π 2 (x) ∧ i P i (x i )) is unsatisfiable, where φ Π i is the Datalog query Π i written as a formula of LFP. Note that φ Π i does not contain negation, and therefore belongs to the extension of UNFP with non-monadic fixed point operators. Incidentally, note that the overall reduction uses only Boolean negation (i.e., negation applied to sentences).

Definition 3 . 1 .

 31 Let M, N be two structures. A UN-bisimulation (resp. a UN-bisimulation of width k ≥ 1) is a binary relation Z ⊆ M × N such that the following hold for every pair (a, b) ∈ Z: • [Forward property] For every finite set X ⊆ dom(M ) (resp. with |X| ≤ k) there is a partial homomorphism h : M → N whose domain is X, such that h(a) = b if a ∈ X, and such that every pair (a ′ , b ′ ) ∈ h belongs to Z. • [Backward property] Likewise in the other direction, where X ⊆ dom(N ).

  ) and (N, Q), respectively, and let κ = max{|M |, |N |}. Recall that the least fixpoint of O φ,(M,P ) is equal to O φ,(M,P ) κ (∅), and similarly for the least fixpoint of O φ,(N,Q) . A straightforward transfinite induction shows that, for all ordinals λ, and for all (a, b) ∈ Z, a ∈ O φ,(M,P ) λ (∅) if and only if b ∈ O φ,(N,Q) λ (∅). We conclude that (M, P , a) |= [LFP X,y ψ(X, Y , y)](x) if and only if (N, Q, b) |= [LFP X,y ψ(X, Y , y)](x).

Definition 3 . 2 .

 32 Let M and N be structures with the same signature. A UN-homomorphism h : M → N is a homomorphism with the property that (M, a) ≈ UN (N, h(a)) for all a ∈ dom(M ). We write (M, a) → UN (N, b) if there is a UN-homomorphism h : M → N such that h(a) = b. Proposition 3.2. If (M, a) → UN (N, b) and M |= φ(a) then N |= φ(b), for all UNFPformulas φ(x).

Theorem 3 . 3 .Theorem 3 . 4 .

 3334 Every satisfiable UNFO formula has a finite model. Every satisfiable UNFP formula of width k has a model of tree-width k -1.

  UNFO k l (N, b), then there exist structures (M * , a * ) and (N * , b * ) such that (M, a) ≈ UN k (M * , a * ), (M * , a * ) ≡ FO q (N * , b * ), and (N * , b * ) ≈ UN k (N, b).

Claim 1 .

 1 For all structures (M, a) and (N, b) and for all l ∈ N, if (M, a) ≡ UNFO k l (N, b) then (G M , a) ≈ l (G N , b). Proof. Let Z 0 be the set of all pairs of elements (a, b) such that (M, a) ≡ UNFO k 0 (N, b), and, for ℓ > 0, let Z ℓ be the set of all pairs of elements (a, b) such that (M, a) ≡ UNFO k ℓ (N, b), together with the set of all pairs ((K, h), (K, g)) such that, for all i ≤ k, (M, h(i)) ≡ UNFO k ℓ-1 (N, g(i)). We show, by induction on ℓ, that from a pair (u, v) in Z ℓ , Eloïse can survive ℓ steps of the global two-way bisimulation game. Therefore, if (a, b) is such that (M, a) ≡ UNFO k l (N, b), Z l witnesses the fact that (G M , a) ≈ l (G N , b) and the lemma is proved.

  k ℓ-1 -type. Since (M, a) ≡ UNFO k ℓ (N, b) and (M, a) |= ∃x τ (x), we have that (N, b) |= ∃x τ (x). Let v ′ be the witnessing element of N . Then (N, u) ≡ UNFO k ℓ-1

Claim 3 .

 3 (M * , a ′ ) ≈ UN k (M, a) and (N * , b ′ ) ≈ UN k (N, b).

Claim 4 .

 4 x n . By (M, a) ≡ σ UNFO k (N, b) we will mean that the tuple a in M and the tuple b in N satisfy the same UNFO k -formulas using only relation symbols in σ, and by (M, a) ⇛ σ UNFO k (N, b) we will mean that every UNFO k -formula using only relation symbols in σ that is satisfied by the tuple a of M is satisfied also by the tuple b of N . There are (M, a) |= φ and (N, b) |= ¬ψ such that (M, a) ⇛ σ∩τ UNFO k (N, b). Proof of Claim 4: A classic argument involving two applications of Compactness (cf. [18, Lemma 3.2.1]

  By construction, all UNFO k formulas in σ ∩ τ true of a in M are true of b in N . In other words, (M, a) ⇛ σ∩τ UNFO k (N, b). The following Claim 5 is a strengthening of Claim 4. Recall the definition of UNhomomorphisms. Just as we parametrized UN-bisimulations by a width k and a signature, we can parametrize UN-homomorphisms by a width and a signature. We write (M, x) ≈ σ∩τ UN k (N, y) if there is a UN-bisimulation of width k, with respect to the signature σ ∩ τ , between (M, x) and (N, y). We write (M, a) → σ∩τ UN k (N, b) if, for every set X ⊆ M with |X| ≤ k, there is a partial homomorphism (with respect to the signature σ ∩ τ ) h : M → N with domain X, such that (i) h(a i ) = b i for all a i ∈ a ∩ X, and (ii) (M, x) ≈ σ∩τ UN k (N, h(x)) for all x ∈ X. In particular this implies that (M, a) ⇛ σ∩τ UNFO k (N, b). Claim 5. There are (M, a) |= φ and (N, b) |= ¬ψ such that (M, a) → σ∩τ UN k (N, b). Proof of Claim 5: We may assume without loss of generality that the models M and N provided by Claim 4 are ω-saturated, and therefore, by Lemma 3.6 we have that, whenever (M, a) ≡ σ∩τ UNFO k (N, b), then (M, a) ≈ σ∩τ UN k (N,

Claim 6 .

 6 arity m, R K contains all tuples ( a 1 , b 1 , . . . , a m , b m ) in the domain of K such that (a 1 , . . . , a m ) ∈ R M and (b 1 , . . . , b m ) ∈ R N . • For each R ∈ σ \ τ of arity m R K contains all tuples ( a 1 , b 1 , . . . , a m , b m ) in the domain of K such that (a 1 , . . . , a m ) ∈ R M . • Analogously for all relation symbols R ∈ τ \ σ. For all elements a, b of K, we have (K, a, b ) ≈ σ UN k (M, a) and (K, a, b ) ≈ τ UN k (N, b). Proof of Claim 6: We will show that (K, a, b ) ≈ σ UN k (M, a). The proof of the other half of the claim is analogous.

  UN k (N, h(x)) for all x ∈ a ′ . Now, let us use a ′ , b ′ again as a convenient shorthand for the pairwise product of a ′ and b ′ . Then it follows from the definition of K that all atomic formulas in signature τ that are true of a ′ in M are true of a ′ , b ′ in K (for relations in τ \ σ, this is immediate, and for relations in σ ∩ τ , this follows from the fact that the atomic formula in question is true also of b ′ in N ). Hence (by induction on the conjunctions and disjunction in φ ′ ), we have that (K, a ′ , b ′ ) |= φ ′ . In fact, it can be seen that a ′ , b ′ provides a witness showing that (K, a, b ) |= φ.

( 2 ) 3 )

 23 If a sUNFP formula has a model, it has an acyclic model (If a sUNFP formula has a finite model, then it has a l-acyclic finite model, ∀l ≥ 1. (4) sUNFO has the finite model property.

For

  any structure M , we denote by M * the Kripke model obtained as follows: every atomic fact R(a 1 . . . a n ) of M gets replaced by a substructure consisting of a node labeled p R which has n children, labeled p 1 , . . . p n , each of which has as its single child a i . Then it is clear from the construction that (M, a) |= φ(x) if and only if (M * , a) |= [φ(x)] * . Conversely, for every Kripke model M , we define a structure M * as follows: the elements of M * are the elements of M . A fact R(a 1 , . . . , a n ) is inserted in M * whenever in M there is a node labeled p R and n (not necessarily distinct) children of p R , labeled p 1 , . . . p n , each of which has a i as a child. It is clear from the construction that (M, a) |= [φ(x)] * if and only if (M * , a) |= φ(x).

Lemma 4 . 1 .

 41 Every UNFP sentence is equivalent to a UNFP sentence in UN-normal form that uses only unary disjunction, and, more precisely, a sentence generated by the following grammar: χ(y) ::= ∃z ψ(y, z) | ¬χ(y) | χ 1 (y) ∨ χ 2 (y) | [LFP X,z χ(z)](y) (4.1) where ψ(y, z) is of the form:

Lemma 4 . 3 .

 43 If R τ (a) is implicit in a stitch diagram M then there is an N ⊆ M containing at most |τ | many facts, such that R τ (a) is already implicit in N . Moreover N is connected whenever τ is.

Proposition 4 . 2 .

 42 ) of Proposition 4.1 φ ′ has a finite model N . By construction N x is a finite model of φ.Proof of Theorem 3.4. Similarly, consider a satisfiable UNFP formula φ. By construction the resulting sUNFP formula φ ′ is satisfiable. By Item (2) of Proposition 4.1 φ ′ has an acyclic model N . By construction this implies that N x is a model of φ that has tree-width at most k -1, where k is the width of φ ′ . 4.3. Lower bounds and restricted fragments. The complexity result of Theorem 4.5 is tight: There is a fixed finite signature such that the satisfiability problem for UNFO is 2 ExpTime-hard, both on arbitrary structures and on finite structures.

Figure 2 :

 2 Figure 2: Encoding of a run of the alternating Turing machine

Theorem 5 . 1 .

 51 The model checking problem for UNFO is P NP[O(log 2 n)] -complete.

1 •

 1 ) Compute V := eval(ψ, (M, U )) by induction (2) Evaluate α on (M, U , V ), using the algorithm of Theorem 5.Case φ is of the form [LFP Y,y α(Y, X, ψ, y)](x) (1) set S := ∅ (2) Compute V := eval(ψ, (M, U , S)) by induction (3) Compute S ′ := eval(α, (M, U , V , S)) by induction (4) If S ′ = S return S otherwise go to Step 2 with S := S ∪ S ′

  State formulas: φ::= p | Eα | Aα | φ ∧ φ | φ ∨ φ | ¬φ Path formulas: α ::= φ | Xα | α ∧ α | α ∨ α | ¬α

Acknowledgment. We are grateful to Philippe Schnoebelen for useful discussions and pointers to relevant literature. We also thank the reviewers for their helpful and extensive comments.

ten Cate has been funded partially by the ERC grant Webdam, agreement 226513, and partially by the NSF grants IIS-0905276 and IIS-1217869. Balder ten Cate and Luc Segoufin Creative Commons 1

• Case φ is of the form [GFP Y,y α(Y, X, ψ, y)](x)

(1) guess T (2) Compute V := eval(ψ, (M, U , T )) by induction (3) Compute T ′ := eval(α, (M, U , V , T )) by induction (4) If T ′ = T return T otherwise abort It should be clear that the algorithm is in NP NP : by monotonicity it makes only polynomially many inductive calls, and the base case corresponds to the evaluation of a UNFO formula and is therefore in P NP[O(log 2 n)] by Theorem 5.1.

It remains to show that this result returns the correct answers. Recall the semantics of fixpoints as described in Section 2. It is easy to see that the algorithm below computes exactly the correct results according to this semantics. ,(M,U )) the set computed by this second algorithm, i.e. the standard algorithm for fixpoint formulas. Notice that it differs with the previous algorithm only in the case of greatest fixpoints. The fact that eval(φ, (M, U )) = eval * (φ, (M, U )) is a consequence of the following claim. Claim 8. For all M, U and φ we have eval(φ, (M, U )) ⊆ eval * (φ, (M, U )). Moreover, if eval always guess the correct greatest fixpoint then we have quality.

Proof. This is a simple induction on φ. For Case (1) we obtain by induction that V ⊆ V * and the result follows immediately by the monotonicity assumption on α. Similarly, for Case (2), we obtain that each stage of the computation of the least fixpoint by eval is included in the same stage by eval * . The inclusion of the respective least fixpoints follows. For Case (3) we obtain again by induction that V ⊆ V * and therefore that T ⊆ eval(α, (M, U , V * , T ))

by the monotonicity assumption on α. If we denote by T * the greatest fixpoint of α on (M, U , V * ), by Knaster-Tarski Theorem, this implies that T ⊆ T * as desired.

The second part of the claim is immediate.

This concludes the proof of Theorem 5.6.