FO Model Checking of Interval Graphs

We study the computational complexity of the FO model checking problem on interval graphs, i.e., intersection graphs of intervals on the real line. The main positive result is that FO model checking and successor-invariant FO model checking can be solved in time O(n log n) for n-vertex interval graphs with representations containing only intervals with lengths from a prescribed finite set. We complement this result by showing that the same is not true if the lengths are restricted to any set that is dense in an open subset, e.g., in the set $(1, 1 + \varepsilon)$.


Introduction
Results on the existence of an efficient algorithm for classes of problems have recently attracted a significant amount of attention.Such results are now referred to as algorithmic meta-theorems, also see a recent survey [Kre09].The most prominent example is a theorem of Courcelle [Cou90] asserting that every MSO (monadic second order) property can be model checked in linear time on the class of graphs with bounded tree-width.Another example is a theorem of Courcelle, Makowski and Rotics [CMR00] asserting that the same conclusion holds for graphs with bounded clique-width when quantification is restricted to vertices and their subsets.
In this paper, we focus on a more restricted class of graph properties, specifically the properties expressible in first order logic.Clearly, every such property can be tested in polynomial time if we allow the degree of the polynomial to depend on the property of interest.But is testing these properties fixed parameter tractable (FPT [DF13]), i.e. are they testable in polynomial time where the degree of the polynomial does not depend on the considered property?The first result in this direction could be that of Seese [See96]: every FO property can be tested in linear time on graphs with bounded maximum degree.A breakthrough result of Frick and Grohe [FG01] asserts that every FO property can be tested in almost linear time on classes of graphs with locally bounded tree-width.Here, an almost linear algorithm stands for an algorithm running in time O(n 1+ε ) for every ε > 0. A generalization to graph classes locally excluding a minor (with worse running time) was later obtained by Dawar, Grohe and Kreutzer [DGK07].
These results have been subsequently extended to (more general) sparse graph classes introduced by Nešetřil and Ossona de Mendéz [NdM08a,NdM08b,NdM08c].First Dawar and Kreutzer [DK09] (also see [GK11] for the complete proof) and, independently, Dvořák, Král' and Thomas [DKT10], showed that every FO property can be tested in almost linear time on classes of graphs with locally bounded expansion; examples of such graph classes include classes of graphs with bounded maximum degree or proper minor-closed classes of graphs.This series of results ultimately culminated with the recent result of Grohe, Kreutzer and Siebertz [GKS14], who established the fixed parameter tractability of testing FO properties on nowhere-dense classes of graphs (nowhere-dense being the most general class of sparse graphs).
In this work, we investigate whether structural properties of graphs that are not necessarily sparse could lead to similar results.Specifically, we study the intersection graphs of intervals on the real line, which are also called interval graphs.When restricted to unit interval graphs, i.e. intersection graphs of intervals with unit lengths, one can easily deduce the existence of a linear time algorithm for testing FO properties from Gaifman's theorem, using the result of Courcelle et al. [CMR00] and that of Lozin [Loz08] asserting that every proper hereditary subclass of unit interval graphs, in particular, the class of unit interval graphs with bounded radius, has bounded clique-width.This observation is a starting point for our research presented in this paper.
Let us now give a definition.For a set L of reals, an interval graph is called an L-interval graph if it is an intersection graph of intervals with lengths from L. For example, unit interval graphs are {1}-interval graphs.If L is a finite set of rationals, then any L-interval graph with bounded radius has bounded clique-width (see Section 5 for further details).So, testing FO properties of such graphs is fixed parameter tractable.However, if L is not a set of rationals, there exist L-interval graphs with bounded radius and unbounded clique-width, and so the easy argument above does not apply.
Our main algorithmic result (Theorem 3.3) says that every fixed FO property can be tested in time O(n log n) for n-vertex L-interval graphs when L is any fixed finite set of reals and an L-interval representation is given on the input.To prove this result, we employ a wellknown characterization of FO properties by Ehrenfeucht-Fraïssé games.Specifically, we show, using the notion of game trees introduced later, that there exists an algorithm transforming an input L-interval graph to another L-interval graph that has bounded maximum degree and that satisfies the same properties expressible by FO sentences with bounded quantifier rank.Inspired by Engelmann, Kreutzer and Siebertz [EKS12] (also see [EKK13]), we then extend our main algorithmic result to successor-invariant FO properties.We should also mention that a recent result of Gajarský et al. [GHL + 15] (proven subsequently after this work), giving a fixed parameter algorithm for testing FO properties of partial orders with bounded width, implies Theorem 3.3 with a running time quadratic in n.
On the negative side, we show that if L is an (infinite) set that is dense in some open set, then L-interval graphs can be used to model arbitrary graphs.Specifically, we show that L-interval graphs for these sets L allow efficient polynomially bounded FO interpretations of all graphs.Consequently, testing FO properties for L-intervals graphs for such sets L is W[2]-hard (see Corollary 6.2) and hence unlikely to be fixed parameter tractable.In addition, we show that unit interval graphs allow an efficient polynomially bounded MSO interpretation of all graphs and a successor FO interpretation of all graphs.So, our main algorithmic result cannot be extended to any of these two stronger logics.
The paper is organized as follows.In Section 2, we introduce the notation and the computational model used in the paper.In the next section, we present an O(n log n) algorithm for deciding FO properties of L-interval graphs for finite sets L, and we extend this result to successor-invariant FO properties in Section 4.Then, we present proofs of the facts mentioned above on the clique-width of L-interval graphs with bounded radius in Section 5. We finish with the several results on the interpretability of all graphs in interval graphs in Section 6.

Preliminaries
An interval graph is a graph G such that every vertex v of G can be associated with an interval J(v) = [ (v), r(v)) such that two vertices v and v of G are adjacent if and only if J(v) and J(v ) intersect (it can be easily shown that the considered class of graphs remains the same regardless of whether we consider open, half-open or closed intervals in the definition).We refer to such an assignment of intervals to the vertices of G as a representation of G.The point (v) is the left end point of the interval J(v) and r(v) is its right end point.
If L is a set of reals and r(v) − (v) ∈ L for every vertex v, we say that G is an L-interval graph and we say that the representation is an L-representation of G.For example, if L = {1}, we speak about unit interval graphs.Finally, if r(v) − (v) ∈ L and 0 ≤ (v) ≤ r(v) ≤ d for some real d, i.e. all intervals are subintervals of [0, d), we speak about (L, d)-interval graphs.Note that if G is an interval graph of radius k, then G is also an (L, (2k + 1) max L)-interval graph (we use max L to denote the maximum element of the set L).
While an (unrestricted) interval representation of a given interval graph G can be found in linear time [BL76] and the same applies to unit interval graphs [CKN + 95], there seem to be no results in the literature about the complexity of finding an L-representation of a given L-interval graph when L is a finite set of positive reals and |L| > 1. Although, Pe'er et al. [PS97] prove that a related interval graph recognition problem in that every vertex of the input graph comes together with its prescribed interval length is NP-hard.We thus suspect that the recognition problem of L-interval graphs might be hard in the computational complexity sense as well and, consequently, we always assume in this paper that an input graph comes alongside with its L-representation.
We now introduce two technical definitions related to manipulating intervals and their lengths.These definitions are needed in the next section.If L is a set of reals, then L (k) is the set of all integer linear combinations of numbers from L with the sum of the absolute values of their coefficients bounded by k.For instance, L (0) = {0} and k) .If no such k exists, then the L-distance of two intervals is defined to be ∞.
Since we do not restrict our attention to L-interval graphs where L is a set of rationals, we should specify the computational model considered.We use the standard RAM model with infinite arithmetic precision and unit cost of all arithmetic operations.However, we refrain from trying to exploit the power of this computational model by encoding other data in the infinite precision variables to manipulate the time complexity of the presented algorithms.In particular, we only store the end points of the intervals of the representations of input graphs and their differences in numerical variables with infinite precision and compare these values, e.g. to decide the vertex adjacencies.
2.1.Parameterized Complexity.Next we give a very brief review of the most important concepts of parameterized complexity.For an in-depth treatment of the subject we refer the reader to other sources, e.g.[DF13].
The instances of a parameterized problem can be considered as pairs I, k where I is the main part of the instance and k is the parameter of the instance; the latter is usually a non-negative integer.A parameterized problem is fixed parameter tractable (FPT) if instances I, k of size n (with respect to some reasonable encoding) can be solved in time O(f (k) • n c ) where f is a computable function and c is a constant independent of k.In the area of parameterized model checking, instances are considered in the form (G, φ), |φ| where G is a structure, φ a formula, the question is whether G |= φ and the parameter is the size of φ.Therefore, when speaking about parameterized complexity of FO model checking we implicitly consider the formula size as a parameter.
The framework of parameterized complexity offers a completeness theory, similar to the theory of NP-completeness, that allows the accumulation of strong theoretical evidence that a parameterized problem is not fixed parameter tractable.This completeness theory is based on the weft hierarchy of equivalence classes W[1],W[2],. . ., W[P] of certain parameterized decision problems under parameterized reductions.A parameterized reduction is an extension of a polynomial-time many-one reduction to parameterized problems that ensures that the parameter of the new instance is bounded by a function of the parameter of the original instance.It is known that, unless the Exponential Time Hypothesis fails [IPZ01], W[1]-hard problems are not fixed parameter tractable.
The class AW[*] extends the weft hierarchy by adding the notion of alternations, and is formally based on the problem of deciding the satisfiability of quantified boolean formulas.In particular, AW[*]-hard problems are also W[1]-and W[2]-hard.Showing that a parameterized problem is AW[*]-hard hence provides a very solid evidence that the problem is not fixed parameter tractable.The parameterized FO model checking problem on general structures as well as on all graphs is AW[*]-complete [DFT96].
There exists an even stronger notion of hardness for parameterized problems: a parameterized problem is para-NP-hard if there exists a parameter k 0 such that the problem restricted to the instances I, k 0 of parameter value equal to k 0 is NP-hard.
2.2.Clique-width.We now briefly present the notion of clique-width, introduced in [CO00].A k-labeled graph is a graph whose vertices are assigned integers (called labels) from 1 to k (each vertex has precisely one label).The clique-width of a graph G equals the minimum k such that G can be obtained using the following four operations: creating a vertex labeled 1, relabeling all vertices with label i to label j, adding all edges between the vertices with label i and the vertices with label j, and taking a disjoint union of graphs obtained using these operations.
2.3.First Order Properties.In this subsection, we introduce concepts from logic and model theory which we use.A first order (FO) sentence is a formula with no free variables with the usual logical connectives and quantification allowed only over variables for elements (vertices in the case of graphs).A monadic second order (MSO) sentence is a formula with no free variables with the usual logical connectives where, unlike in FO sentences, quantification over subsets of elements is allowed.An FO property is a property expressible by an FO sentence; similarly, an MSO property is a property expressible by an MSO sentence.Finally, the quantifier rank of a formula is the maximum number of nested quantifiers.
FO sentences are closely related to the so-called Ehrenfeucht-Fraïssé games.The d-round Ehrenfeucht-Fraïssé game is played on two relational structures R and R (of the same type) by two players, referred to as the spoiler and the duplicator.In each round i = 1, 2, . . .d, the spoiler chooses an element in one of the structures and the duplicator chooses an element in the other.Let x i and y i be the elements of R and R chosen in the i-th round.We say that the duplicator wins the game if there is a strategy for the duplicator such that, for any strategy of the spoiler, the substructure of R induced by the elements x 1 , . . ., x d is always isomorphic to the substructure of R induced by the elements y 1 , . . ., y d , with the isomorphism mapping each x i to y i .
The following theorem [Ehr61,Fra54] relates Ehrenfeucht-Fraïssé games to FO sentences of quantifier rank at most d.We describe possible courses of the d-round Ehrenfeucht-Fraïssé games by rooted trees.A d-EF-tree T is a rooted tree with the following properties: (1) each leaf v of T is associated with a relational structure S(v) with elements labelled with 1, . . ., d such that each element of S(v) has at least one label (but possibly more labels) and each label is used exactly once, and (2) all the leaves of T are at depth d.The full d-EF-tree T R of a relational structure R is a d-EF-tree T such that (1) the edges from each internal node u to its descendants are in one-to-one correspondence with the elements of R, and (2) the structure S(v) associated with a leaf v of T R is the substructure of R induced by the elements corresponding to the edges on the unique path from the root to v and the element corresponding to the i-th edge of this path is labelled by i.A mapping f from a d-EF-tree T to another d-EF-tree T is an EF-homomorphism if the following three conditions hold:

and
(3) the relational structures associated with u and f (u) are the same.Two d-EF-trees T and T are EF-equivalent if there exist an EF-homomorphism from T to T and an EF-homomorphism from T to T .An EF-homomorpishm that is bijective is an EF-isomorphism.
We now formalize the connection between d-EF-trees and Ehrenfeucht-Fraïssé games.
Theorem 2.2.Let d be an integer and let R and R be two relational structures.If the full d-EF-trees of R and R are EF-equivalent, then the duplicator wins the d-round Ehrenfeucht-Fraïssé game for R and R .
Proof.Let T and T be the d-EF-trees for R and R , respectively, and let f : T → T and f : T → T be the EF-homomorphisms witnessing their EF-equivalence.We claim that the duplicator wins the d-round Ehrenfeucht-Fraïssé game, using the following strategy: In the first round, if the spoiler chooses x 1 in R, then the duplicator responds with y 1 = f (x 1 ).If the spoiler chooses y 1 in R , the duplicator responds with x 1 = f (y 1 ).Assume that the i − 1 rounds of the game have been played, the elements chosen in the structures R and R are x 1 , . . ., x i−1 and y 1 , . . ., y i−1 , respectively, and the spoiler chooses an element x i in R. Let u 0 , . . ., u i be the path in T formed by the edges corresponding to x 1 , . . ., x i .The duplicator chooses the element y i of R that corresponds to the edge f The definitions of full d-EF-trees and an EF-homomorphism yield that the substructures of R and R induced by x 1 , . . ., x i and y 1 , . . ., y i are isomorphic through the isomorphism mapping x j to y j , 1 ≤ j ≤ i.In particular, they are isomorphic after the d rounds of the game and the duplicator wins.
The converse implication, i.e. that if the duplicator wins the d-round Ehrenfeucht-Fraïssé game for R and R , then the d-EF-trees for the game played on relational structures R and R are EF-equivalent, is also true.However, we omit the proof since we only need the implication given by Theorem 2.2.We show that full d-EF-trees can pruned to be of bounded size.
Lemma 2.3.Consider a fixed type of relational structures.Every class of EF-equivalent d-EF-trees contains a unique tree (up to an EF-isomorphism) with the minimum number of leaves and the number of non-EF-equivalent d-EF-trees is finite.
Proof.Let T and T be EF-equivalent d-EF-trees with the minimum number of leaves.Suppose that there exists a non-bijective EF-homomorphism f from T to T .Let f be an EF-homomorphism from T to T .Let T be the d-EF-tree that is the subtree of T induced by the image of f .Since f is an EF-homomorphism from T to T and f restricted to the image of f is an EF-homomorphism from T to T , the d-EF-tree T is a d-EF-tree EF-equivalent to T with the smaller number of leaves.
To show that the number of non-EF-equivalent d-EF-trees is finite, we describe the minimal elements of EF-equivalence classes in a constructive way.Let T be a d-EF-tree.If a vertex of T at depth d − 1 is adjacent to two leaves associated with the same labelled structure, delete one of them.The original d-EF-tree has a d-EF-homomorphism to the new one: map all the vertices except the deleted one to themselves and map the deleted leaf to the other leaf associated with the same labelled structure.After this operation, the number of children of any vertex at depth d − 1 does not exceed the number of non-isomorphic structures with their vertices labelled by 1, . . ., d; let K be this number.Now, if any vertex has two children such that their subtrees are isomorphic (preserving the labelled structures associated with their leaves), deleting one of them with its subtree results in a d-EF-tree EFequivalent to T .When the pruning process stops, we have obtained the minimal d-EF-tree EF-equivalent to T (a non-injective EF-homomorphism from a d-EF-tree always exhibits a vertex that can be pruned in the described way).
After pruning T in the way we described, every vertex at depth d − 2 has at most 2 K children, every vertex at depth d − 3 has at most 2 2 K children, etc.So, every EF-equivalence class contains a d-EF-tree of size bounded by a function of K and d.Clearly, there can be only finitely many such such d-EF-trees.
In what follows, we will refer to the minimal d-EF-tree EF-equivalent to the full d-EF-tree of a relational structure R as the d-EF-tree of a relational structure R. Note that the d-EF-tree of a relational structure R can be constructed from the full d-EF-tree in an efficient way through the pruning process described in the proof of Lemma 2.3.

FO Model Checking
Using Theorems 2.1 and 2.2, we prove the following result for L-interval graphs.
Theorem 3.1.For every finite subset L of reals and every integer d ≥ 0, there exist an integer K 0 and an algorithm A with the following properties.The input of A is an L-representation of an n-vertex L-interval graph G and A outputs in time O(n log n) an L-representation of an induced subgraph G of G such that • every unit interval contains at most K 0 left end points of the intervals corresponding to vertices of G , and • G and G satisfy the same FO sentences with quantifier rank at most d.
Proof.We are going to use Ehrenfeucht-Fraïssé games to (possibly) identify an interval representing a vertex of G that can be deleted without changing the set of FO sentences of quantifier rank at most d satisfied by the input graph.Hence, we first focus on proving the existence of the number K 0 and the subgraph G and we postpone the algorithmic considerations to the end of the proof.
We start with perturbing the intervals to guarantee that all the left end points of the intervals representing the vertices of G are distinct.Choose δ to be the minimum distance between distinct end points of the intervals in the representation.Sort the intervals by their left end points (resolving ties arbitrarily) and shift the i-th interval by iδ/2n, for i = 1, . . ., n, to the right.This does not change the graph represented by the intervals and all the end points become distinct.Note that this pertubration can be simulated by storing each end point in the form (x, i) where x is its original coordinate; the pair (x, i) represents the point x + iδ/2n and the lexicographic ordering of the pairs is to the ordering of the modified end-points.In this way, we can perform the perturbation in a way consistent with our computational model, i.e., without actually modifying the positions of the end points.
Choose ε to be the minimum positive element of L (2 d+2 ) .We now establish the following.
Claim 3.2.There exists a number K depending only on L and d such that if any interval [a, a + δ), δ ≤ ε, contains more than K left end points of the intervals representing the vertices of G, then G has a vertex w such that G and G \ {w} satisfy the same FO sentences with quantifier rank at most d.
. By the choice of ε, the intervals of I are disjoint.In addition, the set I is finite (recall that L is finite).Let W be the set of vertices w of G such that the left end point (w) of the interval corresponding to w is in an interval from I. For w ∈ W , let i(w) be the left end point of the interval from I containing (w).Define a linear order on W such that w ≤ w We view W as a linearly ordered set with each of its elements colored (associated) with the pair formed by i(w) and the length of the interval of w, i.e. with elements of I × L. Observe that the colors of the elements of W (together with the linear order) determine the subgraph of G induced by W .
Let K be the sum of the number of edges of all non-EF-isomorphic minimal d-EF-trees for Ehrenfeucht-Fraïssé games played on linearly ordered sets with elements colored with I × L. The number K is well defined (finite) by Lemma 2.3.If W contains more than K elements, then there is an element w ∈ W such that the d-EF-trees of W and W \ {w} are the same, i.e. the duplicator wins the d-round Ehrenfeucht-Fraïssé game by Theorem 2.2.Fix such w for the rest of the proof.
We now describe a strategy for the duplicator to win the d-round Ehrenfeucht-Fraïssé game for the graphs G and G \ w.During the game, some intervals from I will be marked as altered.At the beginning, the only altered interval is the interval [a, a + δ).
The duplicator strategy in the i-th round of the game is the following.• If the spoiler chooses a vertex u with (u) in an interval of I at L-distance at most 2 d+1−i from an altered interval, then the duplicator follows the winning strategy for the d-round Ehrenfeucht-Fraïssé game for the linearly ordered colored sets W and W \ {w}.This gives a vertex v to choose in the other graph.In addition, the duplicator marks the interval of I that contains (u) as altered (note that (u) and (v) necessarily belong to the same interval of I).• Otherwise, the duplicator chooses the same vertex in the other graph and no new intervals are marked as altered.We now argue that the subgraphs of G and G \ w obtained in this way are isomorphic.Let U = {u 1 , . . ., u d } be the chosen vertices of G and U = {u 1 , . . ., u d } those chosen in G \ w.Let us refer to the vertices corresponding to the intervals with left end points in the altered intervals as altered vertices.If u i is not altered, then u i = u i .If u i is altered, then (u i ) and (u i ) belong to the same interval J ∈ I. Suppose two vertices u j and u j are adjacent differently to u i than to u i .Then (u j ) and (u j ) belong to an interval J ∈ I at L-distance at most one from J. Observe that the L-distance of J from an altered interval in the i -th round, i < i, is at most 2 d+1−i .Hence, if j < i, then u j and u j are altered because J was at L-distance at most 2 d+1−j in the j-th round.If j > i, then u j and u j are altered because the interval J turned to be altered in the i-th round and the L-distance of J and J is at most one.
Since we have followed a winning strategy for the duplicator for the sets W and W \ {w}, the colors of u j and u j are the same and they are comparable to u i and u i in the same way.In particular, they are adjacent to u i and u i in the same way.We conclude that the duplicator wins the game, which finishes the proof of the claim.
We now show that the statement of the theorem is true with K 0 = K ε −1 .The algorithm sorts the left end points of all the intervals (this requires O(n log n) time) and for each of these points computes the distance to the left end of the interval that is K positions to the right in the obtained order.If all these distances are at least ε, then every interval of length at most ε contains at most K left end points of the intervals and the representation is of the desired form.
Otherwise, we choose a and b with the smallest b − a such that the interval [a, b) contains K + 1 points and b − a < ε.By the choice of this interval, any interval of length b − a contains at most K + 1 left end points of the intervals from the representation.So, the size of the d-EF-tree for the game played on the vertices v with (v) in the intervals at L-distance at most 2 d+1 from [a, b) is bounded by a function of K, d and |L|.Since this quantity is independent of the input graph, we can identify (in constant time) a vertex w with (w) ∈ [a, b) with the properties from the claim.We delete this vertex from the graph G.We then update the order of the left end points and the at most K computed distances affected by removing w, and iterate the whole process.Storing the distances in a heap results in an algorithm that needs O(log n) per vertex removal.Hence, the running time of the algorithm is bounded by O(n log n).
It is possible to think of several strategies to efficiently decide FO properties of Linterval graphs given Theorem 3.1.We present one of them.Fix an FO sentence Φ with quantifier rank d and apply the algorithm from Theorem 3.1 to get an L-interval graph and a representation of this graph such that every unit interval contains at most K 0 left end points of the intervals of the representation.After this preprocessing step, every vertex of the new graph has at most K 0 • max L neighbors.In particular, the maximum degree of the new graph is bounded.The result of Seese [See96] asserts that every FO property can be decided in linear time for graphs with bounded maximum degree, and so we conclude: Theorem 3.3.For every finite subset L of reals and every FO sentence Φ, there exists an algorithm running in time O(n log n) that decides whether an input n-vertex L-interval graph G given by its L-representation satisfies Φ.

Successor-invariant FO
A successor relation on X is simply a directed path on the vertex set X.An FO sentence over a successor-equipped relational structure is successor-invariant if its truth does not change when the same structure is equipped with a different successor relation.Successorinvariant FO sentences are generally more expressive than FO sentences [Ros07].However, our previous result can be extended to this more expressive setting.
A useful tool when solving the model checking problem on a class of structures is the ability to "efficiently translate" an instance of the problem to a different class of structures.This tool is formalized through the concept of interpretability of logic theories [Rab64].An FO graph interpretation is a pair I = (ν, µ) of FO formulas ν and µ with 1 and 2 free variables, respectively.If G is a graph, then I(G) is the graph such that • its vertex set is the set of all v ∈ V (G) such that G |= ν(v), and • its edge set is the set of all the pairs u and v such that G |= ν(u) ∧ ν(v) ∧ µ(u, v).We require that the edge set relation as defined must be symmetric, i.e.G |= (ν(u) ∧ ν(v)) ⇒ (µ(x, y) ⇔ µ(y, x)) for every graph G.
Similarly, an FO successor-graph interpretation is a triple I = (ν, µ, σ) of FO formulas where ν, µ and σ have one, two and two free variables, respectively.The meaning of ν and µ is the same and σ should represent the successor relation: v is the successor of u iff G |= ν(u) ∧ ν(v) ∧ σ(u, v).Analogously, one may also define an MSO graph interpretation where ν and µ are allowed to be MSO formulas.
A class C 1 of (successor-equipped) graphs has an FO interpretation in a class C 2 of graphs if there exists an FO (successor-)graph interpretation I such that every (successor-equipped) graph In particular, if h is a linear function, then we say that I is linearly bounded and if h is a polynomial function, then we say that I is polynomially bounded.
Theorem 4.1.For every finite subset L of reals and every successor-invariant FO sentence Φ, there exists an algorithm running in time O(n log n) that decides whether an input n-vertex L-interval graph G given by its L-representation satisfies Φ.
Proof.The straightforward criterion [EKS12, Lemma 5.3] implies that it is enough to construct an efficient linearly bounded FO successor-graph interpretation of the class of L-interval graphs equipped with a suitable successor relation in the class of L-interval graphs and apply Theorem 3.3.
Before proceeding further with the proof, we need two definitions.Two vertices in a graph are twins if their neighborhoods are the same.An interval representation is nice if each interval except the last interval contains the left end point of another interval.Note that not all interval graphs have nice representations (e.g.disconnected graphs do not).
As in the proof of Theorem 3.1, we first perturb the intervals so that all their end points are distinct.First suppose that the L-interval representation of G is nice and let G + be the graph G equipped the the successor relation given by the ordering of the left end points of the intervals.Notice that if a vertex y is the successor of a vertex x in G + , then x, y are adjacent in G.We now construct an FO successor-graph interpretation I 1 in L-interval graphs with intervals colored black, red, green and blue.
Fix G + and let us start with constructing the colored L-interval graph, which we call H. Let ε > 0 be such that any two end points of the intervals in the representation of G are at distance larger than 3ε.For each interval [a, b), the interval representation of H contains the following four intervals (see Figure 1): We now define the interpretation I 1 = (ν 1 , µ 1 , σ 1 ).The relations ν 1 and µ 1 are defined as ν 1 (x) ≡ black(x) and µ 1 (x, y) ≡ edge(x, y). (4.1) The definition of σ 1 is more involved.For a vertex v K ∈ V (H), the red vertex v R has the same neighborhood as v K except for the green vertex v G .Note that v R is the only red vertex adjacent to v K with this property: indeed, any other red vertex u R adjacent to v K is distinguished from v R by the adjacency to v B or u B .Hence, every black vertex v K can be uniquely associated with the green vertex v G by an FO formula assoc(x, y).In particular, assoc(x, y) holds only if If the intervals of the black vertices u K and v K intersect, then the inequality (u K ) < (v K ) can be captured by an FO formula less(u K , v K ).Specifically, this inequality can be expressed as less(x, y) ≡ x = y ∧ edge(x, y) ∧ ∃z assoc(x, z) ∧ ¬ edge(z, y) . (4. 2) The successor relation can now be interpreted using (4.2) as follows.
σ 1 (x, y) ≡ less(x, y) ∧ ∀z ¬ black(z) ∨ ¬ less(x, z) ∨ ¬ less(z, y) (4.3) We now adapt the construction to the case when the L-representation of G is not nice.To do so, we introduce a fifth color, which we will refer to as gray.If there is an interval J that is not the last interval and that does not contain the left end point of another interval, we insert a gray interval J of length max L that has its left end point inside J.If J does not contain the end point of another interval, we can shift all the intervals to the right from J by the same distance in such a way that the left end point of one of them, say J , moves inside J and the only new intersection we have introduced is the one between J and J .
After this modification, we perform the construction described earlier, replacing each original interval with black, green, red and blue intervals and each gray interval with gray (in the role of the black interval), green, red and blue intervals.Let H be the graph obtained in this way.The number of black intervals in the representation of H is the number of vertices of G. Since there is the left end point of a black interval between the left end points of any two gray intervals, the number of gray intervals is at most the number of black intervals.Finally, the numbers of green, red and blue intervals are the same and they are equal to the total number of black and gray intervals.We conclude that H has at most 8|V (G)| vertices.
It remains to adapt the FO successor-graph interpretation I 1 , in particular, the FO formula σ 1 .The successor relation between the black intervals is again given by the order of their left end points.Since there is the left end point of at most a single gray interval between any two consecutive left end points of black intervals, we can define the interpretation of the successor relation as follows: Observe that H has no twins.
We now construct a FO graph interpretation I 2 of five-colored L-interval graphs with no twins in L-interval graphs.Every gray, green, red and blue interval is replaced with two, three, four or five identical uncolored copies; black intervals only lose their color.Let H be the constructed L-interval graph.Observe that the number of vertices of H is at most 27|V (G)|.
Since H has no twins, the vertices of H corresponding to the black intervals can be identified by black(x) ≡ ∀y x = y ∨ ∃z edge(x, z) ⇔ edge(y, z) .In a similar way, one may define FO formulas gray(x), green(x), red(x) and blue(x) to express that the vertex x is one of the twins (of multiplicity two, three, four and five) corresponding to a gray, green, red and blue interval, respectively.Combining I 1 and I 2 , we obtain an FO successor-graph interpretation in L-interval graphs.

Clique-width of Interval Graphs
Every proper hereditary subclass of unit interval graphs has bounded clique-width [Loz08] though the class of all unit interval graphs has unbounded clique-width [GR00].In particular, the class of ({1}, d)-interval graphs has bounded clique-width for every d > 0. Using Gaifman's theorem, it follows that testing FO properties of unit interval graphs can be performed in linear time if the input graph is given by its {1}-representation with the left end points of the intervals sorted.We generalize the result on the clique-width of unit interval graphs for finite sets L of rational numbers, which proves a special case of our main result for FO model checking.
Proposition 5.1.Let L be a finite set of positive rational numbers.For any d > 0, the class of (L, d)-interval graphs has bounded clique-width.
Proof.Let a be the largest rational number such that every element of L is an integer multiple of a. Without loss of generality, we can assume that d is not a multiple of a (otherwise, we slightly increase d).We show that the clique-width of any (L, d)-interval graph is at most K := d/a + 1.
Let G be an (L, d)-interval graph with vertices v 1 , . . ., v n and fix an (L, d)-representation of G. Let b i be the smallest non-negative real such that (v i ) − b i is a multiple of a.We may assume that all the numbers b i are distinct (by perturbing the intervals if needed).Without loss of generality, we can also assume that 0 We will now proceed in several steps.After the i-th step, we will have constructed the subgraph of G induced by the vertices v 1 , . . ., v i such that the label of the vertex v i is (v i )/a .In the first step, we insert the vertex v 1 with label (v 1 )/a .In the i-th step, we insert the vertex v i with label K, join it by edges to all vertices with labels between (v i )/a and r(v i )/a , and relabel it to (v i )/a .By the choice of a and the assumption that b 1 < • • • < b n , the vertex v i is adjacent exactly to its neighbors among v 1 , . . ., v i−1 .
From Proposition 5.1 and Gaifman's theorem, one can approach the FO model checking problem on L-interval graphs for finite sets L of rationals.By Gaifman's theorem, every FO model checking instance can be reduced to model checking of basic local FO sentences, i.e. to FO model checking on L-interval graphs with bounded radius.Since L-interval graphs with radius d are (L, (2d + 1) max L)-interval graphs and so have bounded clique-width, the latter can be solved in linear time by [CMR00].Combining this with the neighborhood covering technique from [FG01], which can be adapted to run in linear time in the case of L-interval graphs given with their interval representation, we obtain the following.
Corollary 5.2.Let L be a finite set of positive rational numbers and Φ an FO sentence.There exists a linear time algorithm that decides whether an L-interval graph G satisfies Φ if the input graph G is given by its L-representation with the left end points of the intervals sorted.
However, Proposition 5.1 is just a fortunate special case, since aside of rational lengths one can prove the following.
Proposition 5.3.For any irrational q > 0 there is d such that the class of {1, q}, d -interval graphs has unbounded clique-width.
Proof.We may assume q > 1 (otherwise, we rescale and consider the set {1, 1/q}).We construct a {1, q}, d -interval graph G with arbitrary large clique-width k where d = q + 2. Consider a large enough integer n; the choice of n depends on k and follows from the construction given.
We construct a sequence a 1 , a 2 , . . ., a n of n points from L (n) ∩[0, d−1) as follows: a 1 = 0, a 2 = 1, and for i > 2 set The elements of the sequence defined through the latter case are called q-elements.Informally, we are folding a sequence of intervals of lengths one and q inside [0, q + 1).Choose δ > 0 such that nδ is smaller than the smallest number in L (n) ∩ [0, d − 1).Let us introduce the following shorthand notation: if J is an interval and r a real, then J + r is the interval J shifted by r to the right.Similarly, if I is a set of intervals, then I + r is the set of the intervals from I shifted by r to the right.We define sets of intervals U 1 := {[iδ, 1 + iδ) : i = 0, . . ., n − 1} and U q := {[iδ, q + iδ) : i = 0, . . ., n − 1}.We say that intervals [iδ, 1 + iδ) and [iδ, q + iδ) are at level i.
For i = 1, . . ., n, set W i = U q + a i if a i is a q-element of P , and and let W i , i = 1, . . ., n, be the vertices represented by the intervals from W i .Finally, two vertices x ∈ W i−1 and y ∈ W i , 2 ≤ i ≤ n, are mates if they are represented by the same-level intervals.
We claim that the clique-width of G exceeds k if n is sufficiently large.Suppose that the clique-width of G is at most k.In the construction of G using k labels from the definition of clique-width, a k-labeled subgraph G 1 of G with 1 3 n 2 ≤ |V (G 1 )| ≤ 2 3 n 2 must have appeared.However, this implies that vertices of G 1 have at most k different neighborhoods in G\V (G 1 ).We will show that this is not possible.
Suppose that there exists i such that In the rest of the proof, we assume that 3 n 2 , there exist crossing sets W i 0 , W i 0 +1 , . . ., W i 0 +m where m = n/k − 1.If n is large enough, we can select a (2k + 1)-element subset I ⊆ {i 0 , . . ., i 0 + m − 1} such that neither a i nor a i+1 is a q-element for every i ∈ I (which implies that a i+1 = a i + 1) and such that all intervals in i∈I W i share a common point.Let i 1 , . . ., i 2k+1 be the elements of I ordered according to the (strictly) increasing values of a i , i.e.
If j, j ∈ {1, . . ., 2k +1} and j > j +1, then the neighborhoods of a vertex of W i j ∩V (G 1 ) and a vertex of W i j ∩V (G 1 ) in V (G)\V (G 1 ) differ.Indeed, none of the vertices of W i j ∩V (G 1 ) is adjacent to any of the vertices in W i j+1 +1 \ V (G 1 ) while each of the vertices of W i j ∩ V (G 1 ) is adjacent to all the vertices in W i j+1 +1 \ V (G 1 ).Therefore, the vertices of G 1 have at least k + 1 distinct neighborhoods in G \ V (G 1 ), which yields that the clique-width of G is larger than k.

Graph Interpretation in Interval Graphs
This section is devoted to our hardness results concerning model checking for interval graphs.We first show that Theorem 3.3 cannot be generalized to significantly wider classes of interval graphs.To formulate our results, we need the following definition: a set L of reals is efficiently dense in an open set X, if there exists an algorithm that for every non-empty open interval J ⊆ X returns an element of J ∩ L in time polynomial in |J| −1 .Lemma 6.1.If L is a subset of non-negative reals that is efficiently dense in some nonempty open set, then there exists an efficient polynomially bounded FO interpretation of the class of all graphs in the class of L-interval graphs.
Proof.By scaling, we can assume that L is dense in [1, 1 + ε] for some ε > 0. Let G be a graph with n ≥ 2 vertices (the case n = 1 is easy to handle separately) and let v 1 , . . ., v n be its vertices.We construct an FO interpretation I = (ν, µ), which is independent of the choice of G, and an L-interval graph H with 3n + 5 + |E(G)| vertices such that G = I(H).We will describe H by giving its L-representation.To simplify our exposition, we assume that L = [1, 1 + ε]; it can be routinely verified that the lengths of intervals appearing in the representation of H can be perturbed that all the length belong to a given dense subset of [1, 1 + ε].Finally, let δ = ε n+1 .The vertex set of H will be formed by sets V 1 , V 2 and V 3 , each containing n + 1 vertices, a set W containing |E(G)| vertices, and two special vertices a and b.Let the vertices of V i , i = 1, 2, 3, be denoted t i,j , j = 0, . . ., n, and the vertices of W be denoted e j,j for all pairs 1 ≤ j < j ≤ n such that v j v j ∈ E(G).
• The e j,j ∈ W is represented by the (non-unit) interval 1 + jδ, 2 + (2 + j )δ .Observe that the vertices a and t 1,0 ∈ V 1 are twins, i.e. they have the same neighbors in H, and that the vertex b is adjacent to every vertex in Note that the vertices a and t 1,0 are the only twins in the graph H.In particular, they are the only two vertices that satisfy the following formula: anchor(x) ≡ ∃y x = y ∧ edge(x, y) ∧ ∀z = x, y edge(x, z) ⇔ edge(y, z) .
We will refer to these two vertices as to the anchors.Note that the vertices of V 1 are at distance one from the anchors, those of V 2 at distance two and those of V 3 at distance three or four.
Let dist(x, y) = c for an integer c be the shorthand for an FO formula expressing that the distance of two vertices x and y is c, and adist(x) = c for an FO formula expressing that the distance of x from an anchor is c.The vertices of G are represented by the vertices of V 1 = {t 1,1 , . . ., t 1,n }.Using this notation, the following formula is true for exactly the vertices of V 1 .ν(x) ≡ ¬ anchor(x) ∧ adist(x) = 1 ∧ ∃y (adist(y) = 2 ∧ ¬ edge(x, y)) .
Note that the last part of the formula makes ν(x) false for x = b.
In what follows, we refer to the pairs of vertices t 1,j and t 3,j as mates.The following formula is true if and only if x ∈ V 3 is the mate of Suppose that x = t 1,j and x = t 3,j .If j < j, then there exists no vertex y as in the formula and, if j > j, there exists at least two such y's, in particular, t 2,j , . . ., t 2,j .
The vertices of V 1 can be linearly ordered according to their left end points.This linear order is actually reflected by dominating one vertex of another.Formally, a vertex x dominates a vertex y if y and all its neighbors are also neighbors of x.Observe that x ∈ V 1 dominates y ∈ V 1 if and only if the left end point of y precedes the left end points of x.The following FO formula expresses that a vertex x dominates a vertex y. domin(x, y) ≡ x = y ∧ edge(x, y) ∧ ∀z (edge(y, z) → edge(x, z)) .
Note that µ (x, y) for x = t 1,j and y = t 1,j is true if and only if j < j and the set W contains the vertex e j,j .Indeed, z = e j,j is the only possible choice of a vertex satisfying the existential quantification.
Since the parameterized FO model checking problem is AW[*]-complete for general graphs, we can immediately conclude the following.Corollary 6.2.If L is a subset of non-negative reals that is efficiently dense in some non-empty open set, then FO model checking is AW[*]-complete on L-interval graphs when parameterized by the formula size.
We now turn our attention to interpretations in stronger logics.We start by showing that the class of all graphs has an FO interpretation in the class of unit interval graphs with a successor relation.We actually prove a stronger statement that there exists an interpretation of the class of all directed graphs.Lemma 6.3.There exists a polynomially bounded FO interpretation of the class of all directed graphs in the class of unit interval graphs with a successor relation.
Proof.Fix a directed graph G. Let n and m be the number of vertices and edges of G, respectively.Further, let v 1 , . . ., v n be the vertices of G, let d + i and d − i be the out-degree and in-degree of a vertex v i and let e i,1 , . . ., e i,d + i be the edges leaving v i .We will simultaneously describe the FO interpretation I = (ν, µ) and an unit interval graph H such that G = I(H).
For each vertex v i of G, the graph H contains the following 2 + d + i + d − i vertices: u i , u i and u i,e for each edge e leaving or entering v i in G.The graph H consists of n cliques, the i-th clique formed by the 2 + d + i + d − i vertices corresponding to v i .Clearly, H is a unit interval graph.
We now define a successor relation on the vertices of H.To make the definition of the successor relation less technical, we abuse the notation by writing u i,e i,0 for u i (note that there is no edge denoted by e i,0 in G).The successor relation will contain the following pairs of vertices of H: • (u i , u i ) = (u i , u i,e i,0 ) for every i = 1, . . ., n, • (u i,e i,j−1 , u i ,e i,j ) and (u i ,e i,j , u i,e i,j ) for every edge e i,j , i = 1, . . ., n and j = 1, . . ., d + i , where u i is the head of e i,j , and • (u i,e i,d + i , u i+1 ) for every i = 1, . . ., n − 1.
Note that the only pairs of adjacent vertices included in the successor relation are those described in the first item.The following two FO formulas can be used to form the interpretation.ν(x) ≡ ∃t succ(x, t) ∧ edge(x, t) µ(x, y) ≡ ∃t, t , t succ(t, t ) ∧ succ(t , t )∧ edge(x, t) ∧ edge(y, t ) ∧ edge(x, t ).
Figure 3: The interval representation of the graph H with a part representing an edge v i v j of the graph G.
It is straightforward to check that G = I(H).
Lemma 6.3 yields the following.
Corollary 6.4.FO model checking is AW[*]-complete on unit interval graphs with a successor relation when parameterized by the formula size.
We now turn our attention to more general MSO properties.There exist two commonly used MSO frameworks for graphs: the MSO 1 language where quantifying over vertices and vertex sets only is allowed, and MSO 2 where it is allowed to quantify over edges and edge sets in addition.Our negative result holds for the weaker variant MSO 1 (and so also holds for MSO 2 ).Lemma 6.5.There is a polynomially bounded MSO 1 interpretation of the class of all graphs in the class of unit interval graphs.
Proof.We describe the MSO 1 interpretation I = (ν, µ).Fix an n-vertex G with n ≥ 4 (the cases with n = 1, 2, 3 can be handled separately in a straightforward way).Let v 1 , . . ., v n be the vertices of G and e 1 , . . ., e m its edges.We will construct a unit interval graph H such that G = I(H).The graph H will be described by giving its interval representation and its construction is illustrated in Figure 3.
Choose δ > 0 such that δn < 1 2 and U = [iδ, 1 + iδ) : i = 0, 1, . . ., n − 1 .Recall that J + x where J is an interval and x is a real is the interval J shifted by x to the right.The graph H contains n(3m + 1) vertices corresponding to the intervals from the sets U + k for k = 1, . . ., 3m + 1; the vertices corresponding to the intervals [iδ, 1 + iδ) and [iδ, 1 + iδ) + k are said to be at the level i.Let W , = 0, . . ., m, be the set of the n vertices represented by the intervals from U + (3 + 1).
The graph H further contains three vertices represented by the interval [0, 1) each and m triples of vertices represented by the intervals [0, 1) + (3i − 1/2), i = 1, . . ., m.The vertices in these m + 1 triples will be referred to as anchors and they will be the only vertices of H that have two twins.Also insert a vertex represented by the interval [1/2, 3/2).The three vertices represented by the interval [0, 1) are the only anchors of degree four.
If the edge e k joins vertices v i and v j , H contains a pair of vertices represented by the intervals [iδ, 1 + iδ) + (3k + 1) and [jδ, 1 + jδ) + (3k + 1).The vertices included in this step are the only vertices of H that have unique twins.This finishes the construction of H.
We now give the MSO 1 formulas ν and µ.Let twin(x, y) be the FO formula expressing that x and y are twins.Using this formula, we can identify the anchors and vertices not adjacent to any of the anchors.anchor(x) ≡ ∃y, z z = y ∧ edge(z, y) ∧ twin(x, y) ∧ twin(x, z) , noanch(x) ≡ ∀z anchor(z) ⇒ ¬ edge(x, z) .
Note that the only vertices x that satisfy noanch(x) are the vertices in the sets W 1 , . . ., W m and the 2m twins corresponding to the edges of G.The vertices of G will be modeled by the vertices of W 0 , which are precisely the vertices that are not adjacent to any anchor and that are at distance two from the three anchors of degree four.In particular, the formula ν can be chosen to be the following FO formula.ν(x) ≡ noanch(x) ∧ ∃t anchor(t) ∧ deg(t) = 4 ∧ dist(t, x) = 2 .Two vertices x and x are mates if there exists integers p, 1 ≤ p ≤ m, and i, 0 ≤ i ≤ n−1, such that one of them is represented by the interval [iδ, 1 + iδ) + (3p − 2) and the other is represented by the interval [iδ, 1 + iδ) + (3p + 1).In particular, if x ∈ W p−1 and x ∈ W p and the vertices x and x are represented by intervals at the same level, then x and x are mates.It is easy to verify that two vertices x and x are mates iff they satisfy the following FO formula.mates(x, x ) ≡ noanch(x) ∧ noanch(x ) ∧ dist(x, x ) = 4 ∧ ∃t anchor(t)∧ ∃!y ∃!z ¬ edge(y, z) ∧ edge(y, t) ∧ edge(z, t) ∧ dist(x, y) = 2∧ dist(x , y) > 2 ∧ dist(x , z) = 2 ∧ dist(x, z) > 2 .
Note that this is the only place in the proof where we need the expressive power of MSO.
The formula µ can now be chosen as follows.
Indeed, if x and y belong to W 0 , then µ(x, y) is true only if there exist adjacent vertices x and y at the same level as x and y, respectively, and both x and y have twins.However, this happens only if the counterparts of x and y in G are joined by an edge.
Hence we obtain the following.
Note that the aforementioned result of Lozin [Loz08] states that every proper hereditary subclass of unit interval graphs has bounded clique-width, and hence MSO 1 model checking on this class can be carried out in linear time [CMR00].

Theorem 2. 1 .
Let d be an integer.The following statements are equivalent for any two structures R and R : • The structures R and R satisfy the same FO sentences of quantifier rank at most d.• The duplicator wins the d-round Ehrenfeucht-Fraïssé game for R and R .

Figure 1 :
Figure 1: The intervals representing the four vertices of G 1 corresponding to a vertex.

Figure 2 :
Figure 2: The construction of the interval representation of the graph H in the proof of Lemma 6.1.