First-order Logic with Connectivity Operators

First-order logic (FO) can express many algorithmic problems on graphs, such as the independent set and dominating set problem parameterized by solution size. However, FO cannot express the very simple algorithmic question whether two vertices are connected. We enrich FO with connectivity predicates that are tailored to express algorithmic graph problems that are commonly studied in parameterized algorithmics. By adding the atomic predicates connk(x,y,z_1,..., zk) that hold true in a graph if there exists a path between (the valuations of) x and y after (the valuations of) z1,..., zk have been deleted, we obtain separator logic FO + conn. We show that separator logic can express many interesting problems, such as the feedback vertex set problem and elimination distance problems to first-order definable classes. Denote by FO + connk the fragment of separator logic that is restricted to connectivity predicates with at most k + 2 variables (that is, at most k deletions), we show that FO + connk + 1 is strictly more expressive than FO + connk for all k ≥ 0. We then study the limitations of separator logic and prove that it cannot express planarity, and, in particular, not the disjoint paths problem. We obtain the stronger disjoint-paths logic FO + DP by adding the atomic predicates disjoint-pathsk[(x1, y1),..., (xk, yk) that evaluate to true if there are internally vertex-disjoint paths between (the valuations of) xi and yi for all 1 ≤ i ≤ k. Disjoint-paths logic can express the disjoint paths problem, the problem of (topological) minor containment, the problem of hitting (topological) minors, and many more. Again, we show that the fragments FO + DPk that use predicates for at most k disjoint paths form a strict hierarchy of expressiveness. Finally, we compare the expressive power of the new logics with that of transitive-closure logics and monadic second-order logic.


Introduction
Logic provides a very elegant way of formally describing computational problems. Fagin's celebrated result in 1974 [11] established that existential second-order logic captures the complexity class NP. Fagin thereby provided a machine-independent characterization of a complexity class and initiated the field of descriptive complexity theory. Many other complexity classes were later characterized by logics in this theory. Today it remains one of the major open problems whether there exists a logic capturing PTime.
In 1990 Courcelle proved that every graph property definable in monadic second-order logic (MSO) can be decided in linear time on graphs of bounded treewidth [7]. This theorem has a much more algorithmic (rather than a complexity-theoretic) flavor, in the sense that, from a logical description of a problem, it derives an algorithmic approach on how to solve it on certain graph classes. Grohe in his seminal survey coined the term algorithmic meta-theorem for such theorems that provide general conditions on a problem and on the input instances that, when satisfied, imply the existence of an efficient algorithm for the problem [17]. Courcelle's theorem for MSO was extended to graph classes with bounded cliquewidth [8] and it is known that these are essentially the most general graph classes on which efficient MSO model-checking [15,21] is possible. MSO is a powerful logic that can express many important algorithmic properties on graphs. With quantification over edges, we can for example express the existence of a Hamiltonian path, the existence of a fixed minor or topological minor, the disjoint paths problem, and many deletion problems. For a property Π, the task in the Π-deletion problem is to find in a given graph G a minimum-size subset S of V (G) such that the graph G − S obtained from G by removing S has the property Π. Important examples of Π-deletion problems are the feedback vertex set problem, the odd cycle transversal problem, or the problem of hitting all minors or topological minors from a given list F. Also, many elimination distance problems recently studied [5] in parameterized algorithmics can be expressed in MSO. However, as we have seen, this expressiveness comes at the price of algorithmic intractability already on very restricted graph classes. This cannot be a surprise as e.g. the Hamiltonian path problem is NP-complete already on planar graphs of maximum degree 3 [6].
First-order logic (FO) is much weaker than MSO and consequently, the model-checking problem can be solved efficiently on much more general graph classes. FO model-checking is fixed-parameter tractable on a subgraph-closed class C if and only if C is nowhere dense [18] and a recent breakthrough result showed that it is fixed-parameter tractable on a class C of ordered graphs if and only if C has bounded twin-width [3]. FO is weaker than MSO but it can still express many important problems such as the independent set problem and dominating set problem parameterized by solution size, the Steiner tree problem parameterized by the number of Steiner vertices, and many more problems. On the other hand, first-order logic cannot even express the algorithmically extremely simple problem of whether a graph is connected. Also, the other algorithmic problems mentioned before are not expressible in FO, even though some of them are fixed-parameter tractable on general graphs. For example, we can efficiently test for a fixed minor or topological minor and solve the disjoint paths problem [26]. Many Π-deletion problems are fixed-parameter tractable, see e.g. [9,14,25], as well as many elimination distance problems [1,12].
The fact that first-order logic can only express local properties is classically addressed by adding transitive-closure or fixed-point operators, see e.g. [10,16,22]. Unfortunately, this again comes at the price of intractable model-checking for very restricted graph classes. For example, even the model-checking problem for the very restricted monadic transitive-closure logic TC 1 studied by Grohe [17], is AW[⋆]-hard on planar graphs of maximum degree at most 3 [17,Theorem 7.3]. Also, these logics fall short of being able to express all of the above mentioned algorithmic graph problems studied in recent parameterized algorithmics.
This motivates our present work in which we enrich first-order logic with basic connectivity predicates. The extensions are tailored to express algorithmic graph properties that are studied in recent parameterized algorithmics. We can add the atomic predicate conn 0 (x, y) that evaluates to true on a graph G if (the valuations of) x and y are connected in G. This predicate easily generalizes to directed graphs but for simplicity, we work with undirected graphs only. Of course, with this predicate we can express connectivity of graphs, however, it falls short of expressing other interesting properties, e.g. it cannot express that a graph is acyclic. We hence introduce more general predicates conn k (x, y, z 1 , . . . , z k ), parameterized by a number k, that evaluate to true on a graph G if (the valuations of) x and y are connected in G once (the valuations of) z 1 , . . . , z k have been deleted. The interplay of these predicates with the usual nesting of first-order quantification makes the new logic FO + conn already quite powerful. For example, we can express simple properties such as 2-connectivity by ∀z∀x∀y x ̸ = z ∧ y ̸ = z → conn 1 (x, y, z) . We can also express many deletion problems, such as the feedback vertex set problem, and the elimination distance to bounded degree, and more generally, elimination distance to any fixed first-order property.
We also point to the work of Mikołaj Bojańczyk [2], who independently introduced FO + conn and proposed the name separator logic. He studied a variant of star-free expressions for graphs and showed that these expressions exactly correspond to separator logic. We follow his suggestion and thank Mikołaj for the discussion on separator logic.
In Section 3 we study the expressive power of separator logic. We give examples on properties expressible with separator logic as well as proofs that certain properties, such as planarity and in particular the disjoint paths problem, are not expressible in separator logic. We show that (k + 2)-connectivity of a graph cannot be expressed with only conn k predicates and conclude that the restricted use of these predicates induces a natural hierarchy of expressiveness.
Using the notion of block decompositions together with known model-checking results, one can show that model-checking for formulas using only conn 1 predicates is fixed-parameter tractable on nowhere dense classes of graphs. Hence, we can evaluate very simple connectivity queries in formulas without an increase in the complexity of the model-checking problem on subgraph-closed graph classes. On the other hand, when we allow conn 2 predicates, there are some simple graph classes that do not exclude a topological minor, and on which model-checking becomes AW[⋆]-hard. In this paper, we do not go into the details of modelchecking, but in a companion paper [24], we prove that in fact model-checking for FO + conn is fixed-parameter tractable on graph classes that exclude a topological minor.
The fact that planarity and the disjoint paths problem cannot be expressed in separator logic motivates us to define an even stronger logic that can express these properties. The atomic predicate disjoint-paths k [(x 1 , y 1 ), . . . , (x k , y k )] evaluates to true if and only if there are internally vertex-disjoint paths between (the valuations of) x i and y i for all 1 ≤ i ≤ k.
Connectivity of x and y can be tested by disjoint-paths 1 [(x, y)]. More generally, the so obtained disjoint-paths logic FO + DP strictly extends separator logic. With this more powerful logic, we can test if a graph contains a fixed minor or topological minor, and in particular, test for planarity. In combination with first-order quantification, we can also express many Π-deletion problems such as the problem of hitting all minors or topological minors from a given list F. On the other hand, we cannot express the odd cycle transversal problem, as we cannot even express bipartiteness of a graph. We study the expressive power of FO + DP in Section 4. Among other results, we prove that again an increase in the number of disjoint paths in the predicates leads to an increase in expressive power.
Note that while it would be desirable to be able to express bipartiteness, which is equivalent to 2-colorability, it is not desirable to express general colorability problems, as we aim for logics that are tractable on planar graphs and beyond, while the 3-colorability problem is NP-complete on planar graphs. This example shows again that it is a delicate C S L 2 0 2 2 34:4 First-Order Logic with Connectivity Operators balance between expressiveness and tractability and it will be a challenging and highly interesting problem in future work to find the right set of predicates to express even more algorithmic graph properties while at the same time having tractable model-checking. Until now the complexity of the model-checking problem for FO + DP has remained elusive and will be a very interesting problem in future work.
We conclude the paper in Section 5 with a comparison between the newly introduced logics and more established ones, like MSO and transitive-closure logics.

Preliminaries
Graphs. In this paper we deal with finite and simple undirected graphs. Let G be a graph. We write V (G) for the vertex set of G and E(G) for its edge set. For a set X ⊆ V (G) we write G[X] for the subgraph of G induced by X and G − X for the subgraph induced by for all 1 ≤ i < t and a path P is said to connect its endpoints v 1 and v t . Two paths are internally vertex-disjoint if and only if every vertex that appears in both paths is an end point of both paths. The graph G is connected if every two of its vertices are connected by a path. It is k-connected if G has more than k vertices and G − X is connected for every subset X ⊆ V (G) of size strictly smaller than k.
An acyclic graph is a forest and a connected acyclic graph is a tree.
there is a distinct vertex x v in G and for all {u, v} ∈ E(H) there are internally vertex-disjoint paths P uv in G with endpoints x u and x v . A graph is planar if and only if it does not contain K 5 , the complete graph on 5 vertices, and K 3,3 , the complete bipartite graph with two partitions of size 3, as a minor.
Logic. In this work we deal with structures over purely relational signatures. A (purely relational) signature is a collection of relation symbols, each with an associated arity. Let σ be a signature. A σ-structure A consists of a non-empty set A, the universe of A, together with an interpretation of each k-ary relation symbol R ∈ σ as a k-ary relation R A ⊆ A k . For a subset X ⊆ A we write A[X] for the substructure induced by X. A partial isomorphism between σ-structures A and B is an isomorphism between A[X] and B[Y ] for some subset X ⊆ A of the universe A of A and some subset Y ⊆ B of the universe B of B.
We assume an infinite supply Var of variables. First-order formulas are built from the atomic formulas x = y, where x and y are variables, and R(x 1 , . . . , x k ), where R ∈ σ is a k-ary relation symbol and x 1 , . . . , x k are variables, by closing under the Boolean connectives ¬, ∧ and ∨, and by existential and universal quantification ∃x and ∀x. A variable x not in the scope of a quantifier is a free variable. A formula without free variables is a sentence. The quantifier rank qr(φ) of a formula φ is the maximum nesting depth of quantifiers in φ. We write FO σ [q] for the set of all FO σ-formulas of quantifier rank at most q, or simply FO [q] if σ is clear from the context. A formula without quantifiers is called quantifier-free.
If A is a σ-structure with universe A, then an assignment of the variables in A is a mappingā : Var → A. We use the standard notation (A,ā) |= φ(x) or A |= φ(ā) to indicate that φ is satisfied in A when the free variablesx of φ have been assigned byā. We refer e.g. to the textbook [22] for more background on first-order logic.

Separator logic
In this section, we study the expressive power of separator logic FO + conn. Formally, we assume that σ is a signature that does not contain any of the relation symbols conn k for all k ≥ 0, and that it does contain a binary relation symbol E, representing an edge relation. We assume that E is always interpreted as an irreflexive and symmetric relation and connectivity will always refer to this relation. We let σ + conn := σ ∪ {conn k : k ≥ 0}, where each conn k is a (k + 2)-ary relation symbol. ▶ We write FO + conn k for the fragment of FO + conn that uses only conn ℓ predicates for ℓ ≤ k. The quantifier rank of an FO + conn formula is defined as for plain first-order logic. For structures A with universe A andā ∈ A m and B with universe B andb ∈ B m , we write (A,ā) ≡ conn (B,b) if (A,ā) and (B,b) satisfy the same FO + conn formulas, that is, for all and (B,b) satisfy the same FO + conn k formulas and the same FO + conn k formulas of quantifier rank at most q, respectively.

Expressive power of separator logic
We now give examples of properties that are expressible with separator logic.

▶ Example 3.2. Connectivity is expressible in FO + conn 0 by the formula
More generally, for every non-negative integer k, (k + 1)-connectivity can be expressed by the formula First-Order Logic with Connectivity Operators ▶ Example 3.3. We can express that there exists a cycle by hence, that a graph is acyclic by the negation of that formula. We write ψ acyclic for that formula. We can express that a graph is a tree by stating that it is connected and acyclic.
We can conveniently express deletion problems by relativizing formulas as follows. For a formula φ that does not contain z as a free variable write del(z)[φ] for the formula obtained from φ by recursively replacing every subformula ∃xψ by ∃x(x ̸ = z ∧ ψ), every subformula ∀xψ by ∀x(x ̸ = z → ψ) and every atomic formula conn k (x, y, ▶ Example 3.4. We can state the existence of a feedback vertex set of size k by We can of course use the same principle to express any Π-deletion problem that is FO + conn expressible.
We can also, much more generally, express many elimination distance problems.
▶ Example 3.5. The elimination distance to a class C of graphs measures the number of recursive deletions of vertices needed for a graph G to become a member of C . More precisely, a graph G has elimination distance 0 to C if G ∈ C , and otherwise elimination distance at most k + 1 if in every connected component of G we can delete a vertex such that the resulting graph has elimination distance at most k to C . Elimination distance was introduced by Bulian and Dawar [5] in their study of the parameterized complexity of the graph isomorphism problem and has recently obtained much attention in the literature, see e.g. [1,4,13,19,20,23].
Again, we define auxiliary notation. We write comp(x) for the connected component of (the valuation of) x. For a formula φ we write φ [comp(x)] for the formula obtained from φ by recursively replacing all subformulas ∃yψ by ∃y(conn 0 (x, y) ∧ ψ) and all subformulas ∀yψ by ∀y(conn 0 (x, y) → ψ).
] denotes the substructure induced on the connected component ofā(x). Now assume C is a first-order definable class, say defined by a formula ψ C . Then elimination distance 0 to C is defined by ed 0 = ψ C . If ed k has been defined, then we can express elimination distance k + 1 to C by the formula Our final example concerns the expressive power of separator logic on finite words and finite trees. By the classical result of Büchi, a language on words is regular if and only if it is definable in MSO. Here, words are represented as finite structures over the vocabulary of the successor relation and unary predicates representing the letters of the alphabet. When considering first-order logic on strings, it makes a big difference whether one considers word structures over the successor relation or over its transitive closure, the order relation. Languages definable by FO over the order relation are exactly the star-free languages (see e.g. [22,Theorem 7.26]), while languages definable by FO over the successor relation are exactly the locally threshold testable languages [27,Theorem 4.8]. Similarly, MSO on trees can define exactly the tree regular languages (defined via tree automata, see [22,Theorem 7.30]), while FO can only define a proper subclass of the regular tree languages when the ancestor-descendant or even only the parent-child relation is present. This background was also the motivation of Bojańczyk, who studied a variant of star-free expressions for graphs and showed that these expressions exactly correspond to separator logic [2]. In our example, we show that separator logic on rooted trees has exactly the same expressive power as first-order logic in the presence of the ancestor-descendant relation. Let us write FO[<] for the latter logic. On the other hand, we treat a rooted tree as a graph-theoretic tree with an additional unary predicate marking the root. In the degenerate case, we treat a word as a path, where one of the endpoints is marked by a unary predicate as the smallest vertex (the beginning of the word).
▶ Example 3.6. On rooted trees (and similarly on words) FO + conn collapses to FO + conn 1 and has exactly the same expressive power as FO[<] over trees with the ancestor-descendant relation. We show first that conn k (x, y, z 1 , . . . , z k ) can be expressed in FO [<]. For this, we need to ensure that x and y are not equal to any z i and that no z i lies on the unique path between x and y in the tree. We can define the vertices on the unique path between x and y by first defining the least common ancestor of x and y by the formula If z is the least common ancestor of x and y, it remains to state that none of the z i lies either between x and z or between y and z, which is done by the formula ∃z lca( Conversely, we show that we can define with FO + conn 1 the ancestor-descendant relation in rooted trees. Assume the root is marked by the unary symbol R. Then x < y is equivalent to ∃r R(r) ∧ conn 1 (x, r, y) ∧ ¬conn 1 (y, r, x) .

The limits of separator logic
We now study the limits of separator logic and show that planarity cannot be expressed in FO + conn. Slightly abusing notation let us also write FO + conn k for the properties that are expressible in FO + conn k . We show that there is a strict hierarchy of expressiveness: FO + conn 0 ⊊ FO + conn 1 ⊊ FO + conn 2 ⊊ . . . These results are based on an adaptation of the standard Ehrenfeucht-Fraïssé game (EF game), which is commonly used in the study of the expressive power of first-order logic.
Ehrenfeucht-Fraïssé Games. The Ehrenfeucht-Fraïssé game is played by two players called Spoiler and Duplicator. Given two structures A and B, Spoiler's aim is to show that the structures can be distinguished by first-order logic (with formulas of a given quantifier rank), while Duplicator wants to prove the opposite. The q-round EF game proceeds in q rounds, where each round consists of the following two steps. 1. Spoiler picks an element a ∈ A or an element b ∈ B. After q rounds, the game stops. Assume the players have chosenā = a 1 , . . . , a q and b = b 1 , . . . , b q . Then Duplicator wins if the mapping a i → b i for all 1 ≤ i ≤ q is a partial isomorphism of A and B. We write for shortā →b for this mapping. Otherwise, Spoiler wins. We say that Duplicator wins the q-round EF game on A and B if she can force a win no matter how Spoiler plays. We then write A ≃ q B.

First-Order Logic with Connectivity Operators
The EF game for FO naturally extends to separator logic. The (conn k,q )-game is played just as the q-round EF game, but the winning condition is changed as follows. If in q rounds the players have chosenā = a 1 , . . . , a q andb = b 1 , . . . , b q , then Duplicator wins if 1. the mappingā →b is a partial isomorphism of A and B, and 2. for every ℓ ≤ k and every sequence (i 1 , . . . , i ℓ+2 ) of numbers in {1, . . . , q} we have (a i1 , . . . , a i ℓ+2 ) ⇐⇒ B |= conn ℓ (b i1 , . . . , b i ℓ+2 ).
Otherwise, Spoiler wins. We say that Duplicator wins the (conn k,q )-game on A and B if she can force a win no matter how Spoiler plays. We then write A ≃ conn k,q B.
By following the lines of the proof of the classical Ehrenfeucht-Fraïssé Theorem we can prove the following theorem. The next theorem exemplifies the use of the (conn k,q )-game. Proof. Assume planarity is expressible by a sentence φ of FO + conn k of quantifier rank q. Without loss of generality, we may assume that k ≤ q, as otherwise, we have repetitions in the conn k predicates that can be avoided by using conn ℓ predicates for ℓ < k. Let G q and H q be defined as shown in Figure 1, where n = 2 q+1 . Then, G q is planar but H q embeds only in a surface of genus one (into the Möbius strip, which cannot be embedded into the plane). We show that G q ≃ conn k,q H q , contradicting the assumption that φ must distinguish G q and H q . In fact, we prove an even stronger statement by giving Spoiler four free moves g −3 = v 1,1 , g −2 = v 2,1 , g −1 = v 1,n and g 0 = v 2,n in G q and forcing Duplicator to respond with the vertices

▶ Theorem 3.9. Planarity is not expressible in
Note the twist in the last two vertices. These extra moves are helpful to define Duplicator's winning strategy.
We define the x-distance of two nodes v i,j and v k,ℓ as d x (v i,j , v k,ℓ ) = |i − k| and the y-distance as d y (v i,j , v k,ℓ ) = |j − ℓ|. Note that the y-distance is not the distance in the graphs, e.g. d y (g −3 , g −1 ) = 2 q+1 − 1, even though g −3 and g −1 are adjacent in G q .
Assume now that the first i moves have been made in the game and the players have selected the verticesḡ = (g −3 , . . . , g 0 , g 1 , . . . , g i ) in G q (where g 1 , . . . , g i were freely chosen by the players), andh = (h −3 , . . . , h 0 , h 1 , . . . , h i ) in H q (where h 1 , . . . , h i were freely chosen by the players). We prove by induction that Duplicator can play in such a way that after round i of the (conn k,q )-game the following conditions hold for all −3 ≤ j, ℓ ≤ i: x ′ ,y , that is, corresponding pebbles are in the same row, and in particular d y (g j , g ℓ ) = d y (h j , h ℓ ), and These conditions together with the first four extra moves imply that the mappingḡ →h is a partial isomorphism of G q and H q . Let us show that also for every 0 ≤ ℓ ≤ k and every sequence (i 1 , . . . , i ℓ+2 ) of numbers in {−3, . . . , i} we have G q |= conn ℓ (g i1 , . . . , g i ℓ+2 ) if and only if H q |= conn ℓ (h i1 , . . . , h i ℓ+2 ). Assume G q |= conn ℓ (g i1 , . . . , g i ℓ+2 ), that is, g i1 and g i2 are connected after the deletion of g i3 , . . . , g i ℓ+2 , say by a path P = v x1,y1 . . . v xm,ym , where v x1,y1 = g i1 and v xm,ym = g i2 . Then there are no g ij 1 = v x,y and g ij 2 = v x ′ ,y ′ (for j 1 , j 2 ≥ 3) with y = y ′ = y i and x ̸ = x ′ for some 2 ≤ i ≤ m − 1 (this would block a row along which the path goes, which is not possible) and no g ij 1 = v x,y and g ij 2 = v x ′ ,y ′ (for j 1 , j 2 ≥ 3) with y i = y = y ′ − 1 = y i+1 − 1 and x ̸ = x ′ for some 2 ≤ i ≤ m − 1 (this would block a "diagonal" of which the path contains at least one vertex, which is not possible). By the first condition of the invariant there are no h ij 1

and by the second condition of the invariant there are no
is not a path from h i1 to h i2 after the deletion of h i3 , . . . , g i ℓ+2 , it is possible to reroute the path by switching the row appropriately, as the h ij never block a complete row or a diagonal, as shown above. The case H q |= conn ℓ (h i1 , . . . , h i ℓ+2 ) is symmetrical.
We now show that Duplicator can maintain this invariant throughout the game. For the initial configuration i = 0, the conditions are obviously fulfilled for −3 ≤ j, ℓ ≤ 0. Corresponding pebbles are in the same row and note that d y (g j , g ℓ ) = 2 q+1 − 1, for j ∈ {−3, −2} and ℓ ∈ {−1, 0} and analogously for h j and h ℓ .
For the induction step, suppose that the conditions are fulfilled so far and that Spoiler is making his (i + 1)-move in G q (the case of H q is symmetrical). We may assume that Spoiler does not choose a vertex that was chosen before, say Spoiler picks g i+1 = v _,a . Duplicator must choose h i+1 = v ′ _,a with the same y-coordinate. We have to make sure that she can choose the vertex with that y-coordinate satisfying the second condition. Let g j = v _,b and g ℓ = v _,c with −3 ≤ j, ℓ ≤ i be such that b ≤ a ≤ c and there is no other g k = v _,d with b < d < c. Intuitively, g j is the lowest pebble that was placed above (or in the same row as) g i+1 , while g k is the highest pebble that was placed below (or in the same row as) g i+1 . There are two cases: Here, Duplicator chooses the unique 2. d y (g j , g ℓ ) > 2 q−i : Then d y (h j , h ℓ ) > 2 q−i and there are three possibilities: d y (g j , g i+1 ) ≤ 2 q−(i+1) : Then d y (g ℓ , g i+1 ) > 2 q−(i+1) , and Duplicator chooses C S L 2 0 2 2 34:10 First-Order Logic with Connectivity Operators Similarly to the previous case, Thus, in all cases, the conditions are fulfilled and Duplicator wins the (conn k,q )-game on G q and H q . Hence, planarity is not definable in FO + conn. ◀ As a graph is planar if and only if it excludes K 5 and K 3,3 as (topological) minors and we will show that this can be expressed using disjoint paths predicates, we conclude that the disjoint paths predicate cannot be expressed with FO + conn.
▶ Corollary 3.10. The disjoint paths problem cannot be expressed in FO + conn.
The proof of the next theorem is deferred to the next section, as it is a consequence of the fact that the even stronger logic FO + DP cannot express bipartiteness (Theorem 4.7). ▶ Theorem 3.11. Bipartiteness cannot be expressed in FO + conn.
Finally, we show that the FO+conn k hierarchy is strict by proving that (k+2)-connectivity cannot be expressed by FO + conn k . On the other hand, (k + 2)-connectivity can be expressed by FO + conn k+1 (Example 3.2). ▶ Theorem 3.12. (k + 2)-connectivity cannot be expressed by FO + conn k . In particular, the FO + conn k hierarchy is strict, that is, FO + conn 0 ⊊ FO + conn 1 ⊊ . . .

Proof.
Let k be an integer. For every integer q, we choose two graphs G q and H q such that: G q is connected, H q is not connected, and This is possible, as connectivity is not first-order definable and ≃ q has only finitely many equivalence classes.
Then, we define the graph G k q (resp. H k q ) as the disjoint union of G q (resp. H q ) and K k+1 , a clique of size k + 1, and connect the vertices of the clique with all vertices of G q (resp. H q ), that is, we add the additional edges such that (x, y) ∈ E(G k q ) (resp. (x, y) ∈ E(H k q )) if x ∈ G q (resp. x ∈ H q ) and y ∈ K k+1 . Obviously, G k q is (k + 2)-connected (the deletion of any k + 1 vertices cannot disconnect G k q ), while H k q is not (k + 2)-connected (the deletion of the copy of K k+1 disconnects H k q ). The same argument shows that every conn k (x, y, z 1 , . . . , z k ) can be expressed by an atomic plain first-order formula: in both graphs (the valuations of) x and y are not connected after the deletion of (the valuations of) z 1 , . . . , z k if and only if x or y is equal to one of the z i . Hence, to prove G k q ≃ conn k,q H k q it suffices to prove G k q ≃ q H k q , and this finishes the proof. ▷ Claim 3.13. For all integers q, k we have G k q ≃ q H k q . Proof. The following is obviously a winning strategy for Duplicator in the q-round EF game on G k q and H k q . If Spoiler plays a pebble in the subgraph G q or H q , Duplicator can respond by a pebble in the subgraph H q or G q according to the winning strategy of Duplicator in the EF game on G q and H q . Otherwise, if Spoiler picks a pebble in the subgraph K k+1 of G k q or H k q , Duplicator can respond by a pebble in the subgraph K k+1 of the other graph H k q or G k q . ◁ This concludes the proof of Theorem 3.12. ◀

Disjoint-paths logic
In this section, we study the expressive power of disjoint-paths logic FO + DP. We again fix a signature σ that does not contain the symbol disjoint-paths k for any k ≥ 1 and that does contain a binary (edge) relation symbol E. The disjoint paths predicates will always refer to this relation. We let σ + disjoint-paths := σ ∪ {disjoint-paths k : k ≥ 1}, where each disjoint-paths k is a 2k-ary relation symbol. We usually simply write FO + DP, when σ is understood from the context. For a σ-structure A, an assignmentā and an FO + DP formula φ(x), we define the satisfaction relation (A,ā) |= φ(x) as for first-order logic, where an atomic predicate disjoint-paths k [(x 1 , y 1 ), . . . (x k , y k )] is evaluated as follows. Assume that the universe of A is A and let G = (A, E A ) be the graph on vertex set A and edge set E A . Then (A,ā) models disjoint-paths k [(x 1 , y 1 ), . . . , (x k , y k )] if and only if in G there exist k internally vertex-disjoint paths P 1 , . . . , P k , where P i connectsā(x i ) andā(y i ).
As previously mentioned, it is natural to consider these predicates for both undirected and directed graphs. We will, however, in this work only study the undirected case.
We write FO + DP k for the fragment of FO + DP that uses only disjoint-paths ℓ predicates for ℓ ≤ k. The quantifier rank of an FO + DP formula is defined as for plain first-order logic. For structures A with universe A andā ∈ A m and B with universe B andb ∈ B m , we write (A,ā) ≡ DP (B,b) if (A,ā) and (B,b) satisfy the same FO + DP formulas, that is, ā) and (B,b) satisfy the same FO + DP k formulas and the same FO + DP k formulas of quantifier rank at most q, respectively.

Expressive power of disjoint-paths logic
We now study the expressive power of disjoint-paths logic.
▶ Observation 4.2. FO + conn ⊆ FO + DP because conn k (x, y, z 1 , . . . , z k ) is equivalent to disjoint-paths k+1 [(x, y), (z 1 , z 1 ), . . . , Moreover, the inclusion is strict because planarity is not expressible in FO + conn as seen in Corollary 3.10. We show that planarity and in fact the property that a graph contains a fixed (topological) minor can be expressed in FO + DP.

34:12 First-Order Logic with Connectivity Operators
This family can be obtained by considering all possibilities of replacing every branch set representing a vertex of H of degree d ≥ 3 with a tree with at most d leaves and hardcoding their shapes by disjoint paths. ▶ Example 4.5. Planarity can be expressed in FO + DP. This is a corollary of the previous example, using the formula φ planar := ¬φ K5 ∧ ¬φ K3,3 .

The limits of disjoint-paths logic
We now study the limits of disjoint-paths logic and show that bipartiteness cannot be expressed in FO + DP. We also show that the hierarchy on (FO + DP k ) k≥1 is strict. These results are based again on an adaptation of the standard Ehrenfeucht-Fraïssé game.
The (DP k,q )-game is played just as the q-round EF game, but the winning condition is changed as follows. If in q rounds the players have chosenā = a 1 , . . . , a q andb = b 1 , . . . , b q , then Duplicator wins if 1. the mappingā →b is a partial isomorphism of A and B, and 2. for every ℓ ≤ k and every sequence (i 1 , . . . , i 2ℓ ) of numbers in {1, . . . , q} we have Otherwise, Spoiler wins. We say that Duplicator wins the (DP k,q )-game on A and B if she can force a win no matter how Spoiler plays. We then write A ≃ DP k,q B.
By following the lines of the proof of the classical Ehrenfeucht-Fraïssé Theorem we can prove the following theorem. Proof. Let q be an integer, and let G be a cycle graph with 2 q vertices and H a cycle graph with 2 q + 1 vertices. Then, G is bipartite because it has an even number of vertices, and H is not bipartite because it has an odd number of vertices. We want to show that G ≃ DP k,q H by induction over q.
We define the distance d(x, y) of two vertices x and y as the length of the shortest path between x and y. Letḡ = (g 1 , . . . , g i ) be the first i moves in G and similarlyh = (h 1 , . . . , h i ) the first i moves in H. We can prove by induction that Duplicator can play in such a way that after round i of the (DP k,q )-game the following conditions hold for all j, ℓ ≤ i: 3. The pebbles are placed in G and H with the same "circular order". By the first two conditions, the partial isomorphismḡ →h can be ensured. Furthermore, the third condition implies that the second condition for Duplicator's win is also satisfied.
The base case i = 1 of the induction is trivial because d(g 1 , g 1 ) = d(h 1 , h 1 ) = 0. For the induction step, suppose that G ≃ DP k,i H holds and Spoiler is making his (i + 1)-st move in G. The case of H is equivalent.
If Spoiler picks g j for some j ≤ i, a pebble that was already played before, Duplicator can choose h j , and the conditions are fulfilled by the induction hypothesis. Otherwise, Spoiler picks a pebble g i+1 that wasn't played before. Now we have to differentiate two cases:

1.
There is only one other pebble that was already played, g j = g 1 , j ≤ i. Then, we can find h i+1 such that d(h 1 , h i+1 ) = d(g 1 , g i+1 ). 2. g i+1 lies on the shortest path of g j and g ℓ with j, ℓ ≤ i such that there is no other g n , n ≤ i that lies on this path. Then, there are two possibilities: and there are three cases: Proof. Let k be an integer. For every integer q, we define two graphs G q and H q such that: G q is 2-connected, H q is 1-connected but not 2-connected, and G q ≃ q H q For example, take G q the cycle with 2 q+1 many elements, together with an apex vertex, while H q is the disjoint union of two cycles with 2 q many elements each, together with an apex vertex (see Figure 2).
We then define G k q (resp. H k q ) as the lexicographical product of G q (resp. H q ) with K 2k , the clique with 2k elements. More precisely, if  [(a 1 , b 1 ), . . . , (a k , b k )].
Proof. The proofs for G k q and H k q are identical, so we only do it for G k q . Remember that n is the number of vertices in G q . The idea is that each of the k paths uses at most two "copies" of each vertex of G q , hence 2k "copies" is enough for all paths to exists. For every i ≤ n, let We call B i the set of vertices in position i, and F i the free vertices in position i. We then compute each path, starting with (a 1 , b 1 ).
then there is nothing to do as a 1 and b 1 are neighbors. Otherwise, note that for every i ′′ ≤ n, F i ′′ ̸ = ∅, because there are only 2k − 2 elements among a 2 , . . . , a k , b 2 , . . . , b k . Since G q is a connected graph, there is a path from i to i ′ . For every inner node i ′′ of this path, we can select a vertex v ∈ F i ′′ . We can therefore create a path in G k q from a 1 to b 1 where all inner vertices are free vertices. We then remove these vertices from the sets of free vertices.
Let now 1 < ℓ ≤ k, and let i, j, i ′ , j ′ such that a ℓ = v i,j and b ℓ = v i ′ ,j ′ . We assume that the first ℓ − 1 paths have already been computed. Observe that here again, if i = i ′ there is nothing to do. Otherwise, we again have that for every i ′′ , F i ′′ is not empty. This is because for every s ≤ k, the path from a s to b s intersects B i ′′ at most twice (at most once for the inner vertices, and twice when the two endpoints are both in position i ′′ ). Therefore, we can select a path in G q from i to i ′ and for each i ′′ in this path, pick a vertex v ∈ F i ′′ . ◁ With Claim 4.10, we can replace formulas of (FO + DP k )[q] by formulas of FO[q]. Thanks to Claim 4.9, G k q ≃ q H k q , we conclude that G k q ≃ DP k,q H k q . So FO + DP k cannot express 2k-connectivity. Note that this bound is tight for these structures i.e. G k q ̸ ≃ DP k+1,q H k q . ◀ ▶ Lemma 4.11. The FO + DP k hierarchy is strict, that is, FO + DP 1 ⊊ FO + DP 2 ⊊ . . .

Proof.
Consider the structures in the proof of Lemma 4.8, which are indistinguishable in FO + DP k . The following sentence of FO + DP k+1 distinguishes G k q and H k q : In H k q , pick i such that H q \ i is not connected (i ′ and i ′′ two disconnected vertices). Then 1 . Intuitively, this means that the vertices v i,j are "blocked" for every j ≤ 2k by the first k paths and can therefore not be used for the (k + 1)-st path such that this disjoint path does not exist.
G k q does not satisfy the formula because even if we "block" such a clique, there is still a disjoint path connecting every pair of vertices because G q is 2-connected. ◀

Connection to other logics
In this section, we compare the expressive power of the separator logic and the disjoint-paths logic with monadic second-order logic and transitive-closure logic. Figure 3 depicts the connections between these logics.

Monadic second-order logic
Monadic second-order logic (MSO 1 ) allows quantification over sets of vertices in addition to the first-order quantifiers. It has a higher expressive power than first-order logic because for example connectivity is expressible in MSO 1 and every first-order formula can be expressed with the first-order quantifiers. Connectivity is expressible by ∀R ∃xR(x) ∧ ∃x¬R(x) → ∃x∃y R(x) ∧ ¬R(y) ∧ E(x, y) By an extension of this formula, we can say that a given set S is connected: conn-set(S) := ∀R R ⊆ S ∧ ∃x R(x) ∧ ∃x (S(x) ∧ ¬R(x)) → ∃x∃y R(x) ∧ ¬R(y) ∧ S(y) ∧ E(x, y) Furthermore, we can express the connectivity operators in MSO 1 . The connectivity operator conn 0 (x, y) can be expressed by: and conn k (x, y, z 1 , . . . , z k ) using conn-set(S) by: conn k (x, y, z 1 , . . . , z k ) := ∃S conn-set(S) ∧ S(x) ∧ S(y) ∧ i≤k ¬S(z i ) .
We can express the disjoint paths predicates disjoint-paths k [(x 1 , y 1 ), . . . , (x k , y k )] by: Since the disjoint paths operators are expressible in MSO 1 , FO + DP is included in MSO 1 . This inclusion is strict because it is well-known that bipartiteness is expressible in MSO 1 : ∀x∀y (R i (x) ∧ R i (y)) → ¬E(x, y) but we showed in Theorem 4.7 that bipartiteness is not expressible in FO + DP.

Transitive-closure logic
Transitive-closure logic TC i j is the enrichment of first-order logic with the transitive-closure operator [TCx ,ȳ φ(x,ȳ)] wherex andȳ are tuples of length i and φ is a formula with at most j free variables other thanx andȳ.
Every FO + conn k formula can be expressed in TC 1 k because the conn k operator can be expressed with the help of the transitive-closure operator:  Figure 3 Connections between the logics.

Conclusion
We studied first-order logic enriched with connectivity predicates tailored to express algorithmic graph properties that are commonly studied in contemporary parameterized algorithmics. This yielded separator logic, which can query connectivity after the deletion of a bounded number of elements, and disjoint-paths logic, which can express the disjoint-paths problem. We demonstrated a rich expressiveness that arises from the interplay of these predicates with the nested quantification of first-order logic. We also studied the limits of expressiveness of these new logics.
In a companion paper, we studied the model-checking problem for separator logic and proved that it is fixed-parameter tractable parameterized by formula size on classes of graphs that exclude a fixed topological minor [24]. This yields a powerful algorithmic meta-theorem for separator logic. On the other hand, while the disjoint-paths problem is fixed-parameter tractable on general graphs [26], it is not clear that the model-checking problem for disjointpaths logic is fixed-parameter tractable beyond graphs of bounded treewidth. This remains a challenging question for future work.
It will also be interesting to study other extensions of first-order logic that can express further interesting algorithmic graph problems, such as reachability with regular paths queries. This would, in the simplest case, allow to express bipartiteness and the odd cycle transversal problem. On the other hand, it is very likely that with general regular paths queries, we will get intractability beyond bounded treewidth graphs.