RREDUCTS OF RAMSEY STRUCTURES
MANUEL BODIRSKY AND MICHAEL PINSKER
Abstract.
One way of studying a relational structure is to investigate functions which arerelated to that structure and which leave certain aspects of the structure invariant. Examplesare the automorphism group, the self-embedding monoid, the endomorphism monoid, or thepolymorphism clone of a structure. Such functions can be particularly well understoodwhen the relational structure is countably infinite and has a first-order definition in anotherrelational structure which has a finite language, is totally ordered and homogeneous, andhas the Ramsey property. This is because in this situation, Ramsey theory provides thecombinatorial tool for analyzing these functions – in a certain sense, it allows to representsuch functions by functions on finite sets.This is a survey of results in model theory and theoretical computer science obtainedrecently by the authors in this context. In model theory, we approach the problem of clas-sifying the reducts of countably infinite ordered homogeneous Ramsey structures in a finitelanguage, and certain decidability questions connected with such reducts. In theoretical com-puter science, we use the same combinatorial methods in order to classify the computationalcomplexity for various classes of infinite-domain constraint satisfaction problems. While thefirst set of applications is obviously of an infinitary character, the second set concerns gen-uinely finitary problems – their unifying feature is that the same tools from Ramsey theoryare used in their solution.
Contents
1. Introduction 22. Reducts 43. Ramsey Classes 94. Topological Dynamics 115. Minimal Functions 125.1. Minimal unary functions 125.2. Minimal higher arity functions 136. Decidability of Definability 157. Interpretability 178. Complexity of Constraint Satisfaction 198.1. Climbing up the lattice 198.2. Primitive positive interpretations, and adding constants 208.3. Reducts of equality 218.4. Reducts of the dense linear order 228.5. Reducts of the random graph 259. Concluding Remarks and Further Directions 27
Mathematics Subject Classification. a r X i v : . [ m a t h . L O ] M a y MANUEL BODIRSKY AND MICHAEL PINSKER
References 271.
Introduction “I prefer finite mathematics much more than infinite mathematics. I think that it is muchmore natural, much more appealing and the theory is much more beautiful. It is veryconcrete. It is something that you can touch and something you can feel and something torelate to. Infinity mathematics, to me, is something that is meaningless, because it isabstract nonsense.” (Doron Zeilberger, February 2010) “To the person who does deny infinity and says that it doesn’t exist, I feel sorry for them, Idon’t see how such view enriches the world. Infinity may be does not exist, but it is abeautiful subject. I can say that the stars do not exist and always look down, but then I don’tsee the beauty of the stars. Until one has a real reason to doubt the existence ofmathematical infinity, I just don’t see the point.” (Hugh Woodin, February 2010)Sometimes, infinite mathematics is not just beautiful, but also useful , even when one isultimately interested in finite mathematics. A fascinating example of this type of mathematicsis the recent theorem by Kechris, Pestov, and Todorcevic [32], which links Ramsey classesand topological dynamics. A class of finite structures C closed under isomorphisms, inducedsubstructures, and with the joint embedding property (see [28]) is called a Ramsey class [38,39](or has the Ramsey property ) if for all
P, H ∈ C and every k ≥ S ∈ C such thatfor every coloring of the copies of P in S with k colors there is a copy H (cid:48) of H in C such thatall copies of P in H (cid:48) have the same color. This is a very strong requirement — and certainlyfrom the finite world. Proving that a class has the Ramsey property can be difficult [38], andRamsey theory rather provides a tool box than a theory to answer this question.Kechris, Pestov, and Todorcevic [32] provide a characterization of such classes in topologicaldynamics, connecting Ramsey classes with extreme amenability in (infinite) group theory, aconcept from the 1960s [27]. The result can be used in two directions. One can use itto translate deep existing Ramsey results into proofs of extreme amenability of topologicalgroups (and this is the main focus of the already cited article [32]). One can also use it inthe other direction to obtain a more systematic understanding of Ramsey classes. A keyinsight for this direction is the result of Neˇsetˇril (see [39]) which says that Ramsey classes C have the amalgamation property . Hence, by Fra¨ıss´e’s theorem, there exists a countably infinitehomogeneous and ω -categorical structure Γ such that a finite structure is from C if and only ifit embeds into Γ. The structure Γ is unique up to isomorphism, and is called the Fra¨ıss´e limit of C . Now let D be any amalgamation class whose Fra¨ıss´e limit ∆ is bi-interpretable with Γ.By the theorem of Ahlbrandt and Ziegler [3], two ω -categorical structures are first-order bi-interpretable if and only if their automorphism groups are isomorphic as (abstract) topologicalgroups . In addition, the above-mentioned result from [32] shows that whether or not D is aRamsey class only depends on the automorphism group Aut(∆) of ∆; in fact, and much more EDUCTS OF RAMSEY STRUCTURES 3 interestingly, it only depends on Aut(∆) viewed as a topological group (which has cardinality2 ω ). From this we immediately get our first example where [32] is used in the second direction,with massive consequences for finite structures: the Ramsey property is preserved under first-order bi-interpretations. We will see another statement of this type (Proposition 24) and moreconcrete applications of such statements later (in Section 5, Section 7, and Section 8). Constraint Satisfaction.
Our next example where infinite mathematics is a powerful toolcomes from (finite) computer science. A constraint satisfaction problem is a computationalproblem where we are given a set of variables and a set of constraints on those variables, andwhere the task is to decide whether there is an assignment of values to the variables that sat-isfies all constraints. Computational problems of this type appear in many areas of computerscience, for example in artificial intelligence, computer algebra, scheduling, computationallinguistics, and computational biology.As an example, consider the
Betweenness problem. The input to this problem consistsof a finite set of variables V , and a finite set of triples of the form ( x, y, z ) where x, y, z ∈ V .The task is to find an ordering < on V such that for each of the given triples ( x, y, z ) we haveeither x < y < z or z < y < x . It is well-known that this problem is NP-complete [24, 43],and that we therefore cannot expect to find a polynomial-time algorithm that solves it. Incontrast, when we want to find an ordering < on V such that for each of the given triples( x, y, z ) we have x < y or x < z , then the corresponding problem can be solved in polynomialtime.Many constraint satisfaction problems can be modeled formally as follows. Let Γ be astructure with a finite relational signature. Then the constraint satisfaction problem for Γ,denoted by CSP(Γ), is the problem of deciding whether a given primitive positive sentence φ is true in Γ. By choosing Γ appropriately, many problems in the above mentioned applicationareas can be expressed as CSP(Γ). The Betweenness problem, for instance, can be modeledas CSP(( Q ; Betw )) where Q are the rational numbers and Betw = { ( x, y, z ) ∈ Q | x < y In this article we give a survey presentation of a techniquehow to apply Ramsey theory when studying automorphism groups, endomorphism monoids,and polymorphism clones of countably infinite structures with a first-order definition in an MANUEL BODIRSKY AND MICHAEL PINSKER ordered homogeneous Ramsey structure in a finite language – such structures are always ω -categorical. We present applications of this technique in two fields. Let ∆ be a countablestructure with a first-order definition in an ordered homogeneous Ramsey structure in a finitelanguage. In model theory, our technique can be used to classify the set of all structuresΓ that are first-order definable in ∆. In constraint satisfaction, it can be used to obtain acomplete complexity classification for the class of all problems CSP(Γ) where Γ is first-orderdefinable in ∆. We demonstrate this for ∆ = ( Q ; < ), and for ∆ = ( V ; E ), the countablyinfinite random graph. 2. Reducts One way to classify relational structures on a fixed domain is by identifying two structureswhen they define one another. The term “define” will classically stand for “first-order define”,i.e., a structure Γ has a first-order definition in a structure Γ on the same domain iff allrelations of Γ can be defined by a first-order formula over Γ . When Γ has a first-orderdefinition in Γ and vice-versa, then two structures are considered equivalent up to first-orderinterdefinability .Depending on the application, other notions of definability might be suitable; such notionsinclude syntactic restrictions of first-order definability. In this paper, besides first-order de-finability, we will consider the notions of existential positive definability and primitive positivedefinability ; in particular, we will explain the importance of the latter notion in theoreticalcomputer science in Section 8.The structures which we consider in this article will all be countably infinite, and wewill henceforth assume this property without further mentioning it. A structure is called ω -categorical if all countable models of its first-order theory are isomorphic. We are interested inthe situation where all structures to be classified are reducts of a single countable ω -categoricalstructure in the following sense (which differs from the standard definition of a reduct andmorally follows e.g. [46]). Definition 1. Let ∆ be a structure. A reduct of ∆ is a structure with the same domain as∆ all of whose relations can be defined by a first-order formula in ∆.When all structures under consideration are reducts of a countably infinite base structure ∆which is ω -categorical, then there are natural ways of obtaining classifications up to first-order,existential positive, or primitive positive interdefinability by means of certain sets of functions.In this section, we explain these ways, and give some examples of classifications that have beenobtained in the past. In the following sections, we then observe that these results have actuallybeen obtained in a more specific context than ω -categoricity, namely, where the structures arereducts of an ordered Ramsey structure ∆ which has a finite relational signature and whichis homogeneous in the sense that every isomorphism between finite induced substructures of∆ can be extended to an automorphism of ∆. We further develop a general framework forproving such results in this context.We start with first-order definability. Consider the assignment that sends every structure Γwith domain D to its automorphism group Aut(Γ). Automorphism groups are closed sets inthe convergence topology of all permutations on D , and conversely, every closed permutationgroup on D is the automorphism group of a relational structure with domain D . The closedpermutation groups on D form a complete lattice, where the meet of a set of groups isgiven by their intersection. Similarly, the set of those relational structures on D which are first-order closed , i.e., which contain all relations which they define by a first-order formula, EDUCTS OF RAMSEY STRUCTURES 5 forms a lattice, where the meet of a set S of such structures is the structure which has thoserelations that are contained in all structures in S . Now when Γ is a countable ω -categoricalstructure, then it follows from the proof of the theorem of Ryll-Nardzewki (see [28]) that itsautomorphism group Aut(Γ) still has the first-order theory of Γ encoded in it. And indeed wecan, up to first-order interdefinability, recover Γ from its automorphism group as follows: Fora set F of finitary functions on D , let Inv( F ) be the structure on D which has those relations R which are invariant under F , i.e., those relations that contain f ( r , . . . , r n ) (calculatedcomponentwise) whenever f ∈ F and r , . . . , r n ∈ R . Theorem 2. Let ∆ be ω -categorical. Then the mapping Γ (cid:55)→ Aut(Γ) is an antiisomorphismbetween the lattice of first-order closed reducts of ∆ and the lattice of closed permutationgroups containing Aut(∆) . The inverse mapping is given by G (cid:55)→ Inv( G ) . This connection between closed permutation groups and first-order definability has beenexploited several times in the past in order to obtain complete classifications of reducts of ω -categorical structures. For example, let ∆ be the order of the rational numbers – we write∆ = ( Q ; < ). Then it has been shown in [20] that there are exactly five reducts of ∆, up tofirst-order interdefinability, which we will define in the following.On the permutation side, let ↔ be the function that sends every x ∈ Q to − x . For ourpurposes, we can equivalently choose ↔ to be any permutation that inverts the order < on Q . For any fixed irrational real number α , let (cid:8) be any permutation on Q with the propertythat x < y < α < u < v implies (cid:8) ( u ) < (cid:8) ( v ) < (cid:8) ( x ) < (cid:8) ( y ), for all x, y, u, v ∈ Q . We willconsider closed groups generated by these permutations: For a set of permutations F anda closed permutation group G , we say that F generates G iff G is the smallest closed groupcontaining F .On the relational side, for x , . . . , x n ∈ Q write −−−−−→ x . . . x n when x < . . . < x n . Then wedefine a ternary relation Betw on Q by Betw := { ( x, y, z ) ∈ Q | −−→ xyz ∨ −−→ zyx } . Define anotherternary relation Cycl by Cycl := { ( x, y, z ) ∈ Q | −−→ xyz ∨ −−→ yzx ∨ −−→ zxy } . Finally, define a 4-aryrelation Sep by { ( x , y , x , y ) ∈ Q | −−−−−−→ x x y y ∨ −−−−−−→ x y y x ∨ −−−−−−→ y x x y ∨ −−−−−−→ y y x x ∨−−−−−−→ x x y y ∨ −−−−−−→ x y y x ∨ −−−−−−→ y x x y ∨ −−−−−−→ y y x x } . Theorem 3 (Cameron [20]) . Let Γ be a reduct of ( Q ; < ) . Then exactly one of the followingholds: • Γ is first-order interdefinable with ( Q ; < ) ; equivalently, Aut(Γ) = Aut(( Q ; < )) . • Γ is first-order interdefinable with ( Q ; Betw ) ; equivalently, Aut(Γ) equals the closedgroup generated by Aut(( Q ; < )) and ↔ . • Γ is first-order interdefinable with ( Q ; Cycl ) ; equivalently, Aut(Γ) equals the closedgroup generated by Aut(( Q ; < )) and (cid:8) . • Γ is first-order interdefinable with ( Q ; Sep ) ; equivalently, Aut(Γ) equals the closedgroup generated by Aut(( Q ; < )) and {↔ , (cid:8) } . • Γ is first-order interdefinable with ( Q ; =) ; equivalently, Aut(Γ) equals the group of allpermutations on Q . Another instance of the application of Theorem 2 in the classification of reducts up to first-order interdefinability has been provided by Thomas [46]. Let G = ( V ; E ) be the randomgraph, i.e., the up to isomorphism unique countably infinite graph which is homogeneous and MANUEL BODIRSKY AND MICHAEL PINSKER which contains all finite graphs as induced subgraphs. It turns out that up to first-orderinterdefinability, G has precisely five reducts, too.On the permutation side, observe that the graph ¯ G obtained by making two distinct ver-tices x, y ∈ V adjacent iff they are not adjacent in G is isomorphic to G ; let − be anypermutation on V witnessing this isomorphism. Moreover, for any fixed vertex 0 ∈ V , thegraph obtained by making all vertices which are adjacent with 0 non-adjacent with 0, and allvertices different from 0 and non-adjacent with 0 adjacent with 0, is isomorphic to G . Let swbe any permutation on V witnessing this fact.On the relational side, define for all k ≥ k -ary relation R ( k ) on V by R ( k ) := { ( x , . . . , x k ) | all x i are distinct , and the number of edges on { x , . . . , x k } is odd } . Theorem 4 (Thomas [46]) . Let Γ be a reduct of the random graph G = ( V ; E ) . Then exactlyone of the following holds: • Γ is first-order interdefinable with G ; equivalently, Aut(Γ) = Aut( G ) . • Γ is first-order interdefinable with ( V ; R (3) ) ; equivalently, Aut(Γ) equals the closedgroup generated by Aut( G ) and sw . • Γ is first-order interdefinable with ( V ; R (4) ) ; equivalently, Aut(Γ) equals the closedgroup generated by Aut( G ) and − . • Γ is first-order interdefinable with ( V ; R (5) ) ; equivalently, Aut(Γ) equals the closedgroup generated by Aut( G ) and { sw , −} . • Γ is first-order interdefinable with ( V ; =) ; equivalently, Aut(Γ) equals the group of allpermuations on V . In a similar fashion, the reducts of several prominent ω -categorical structures ∆ havebeen classified up to first-order interdefinability by finding all closed supergroups of Aut(∆).Examples are: • The countable homogeneous K n -free graph, i.e., the unique countable homogeneousgraph which contains precisely those finite graphs which do not contain a clique of size n as induced subgraphs, has 2 reducts up to first-order interdefinability (Thomas [46]),for all n ≥ • The countable homogeneous k -hypergraph has 2 k + 1 reducts up to first-order inter-definability (Thomas [47]), for all k ≥ • The structure ( Q ; <, Conjecture 5 (Thomas [46]) . Let ∆ be a countable relational structure which is homogeneousin a finite language. Then ∆ has finitely many reducts up to first-order interdefinability. It turns out that all the examples above are not only homogeneous in a finite language;in fact, they all have a first-order definition in (in other words: are themselves reducts of)an ordered Ramsey structure which is homogeneous in a finite language. Functions on suchstructures, in particular automorphisms of reducts, can be analyzed by the means of Ramsey EDUCTS OF RAMSEY STRUCTURES 7 theory, and we will outline a general method for classifying the reducts of such structures inSections 3 to 6.We now turn to analogs of Theorem 2 for syntactic restrictions of first-order logic. Afirst-order formula is called existential iff it is of the form ∃ x . . . ∃ x n . φ , where φ is quantifier-free. It is called existential positive iff it is existential and does not contain any negations.Now observe that similarly to permutation groups, the endomorphism monoid End(∆) of arelational structure ∆ with domain D is always closed in the pointwise convergence topologyon the space of all functions from D to D , and that every closed transformation monoid M acting on D is the endomorphism monoid of the structure Inv( M ), i.e., the structurewith domain D which contains those relations which are invariant under all functions in M .Note also that the set of closed transformation monoids on D , ordered by inclusion, forms acomplete lattice, and that likewise the set of all existential positive closed structures formsa complete lattice. The analog to Theorem 2 for existential positive definability is an easyconsequence of the homomorphism preservation theorem (see [28]) and goes like this: Theorem 6. Let ∆ be ω -categorical. Then the mapping Γ (cid:55)→ End(Γ) is an antiisomor-phism between the lattice of existential positive closed reducts of ∆ and the lattice of closedtransformation monoids containing Aut(∆) . The inverse mapping is given by M (cid:55)→ Inv( M ) . All the closed monoids containing the group of all permutations on a countably infinite set D (which equals the automorphism group of the empty structure ( D ; =)) have been deter-mined in [8], and their number is countably infinite. Therefore, every structure has infinitelymany reducts up to existential positive interdefinability. In general, it will be impossible todetermine all of them, but sometimes it is already useful to determine certain closed monoids,as in the following theorem about endomorphism monoids of reducts of the random graphfrom [14]. We need the following definitions. Since the random graph G = ( V ; E ) containsall countable graphs, it contains an infinite clique. Let e E be any injective function from V to V whose image induces such a clique in G . Similarly, let e N be any injection from V to V whose image induces an independent set in G . Theorem 7 (Bodirsky and Pinsker [14]) . Let Γ be a reduct of the random graph G = ( V ; E ) .Then at least one of the following holds. • End(Γ) contains a constant operation. • End(Γ) contains e E . • End(Γ) contains e N . • Aut(Γ) is a dense subset of End(Γ) (equipped with the topology of pointwise conver-gence). Theorem 7 states that for reducts Γ of the random graph, either End(Γ) contains a functionthat destroys all structure of the random graph, or it contains basically no functions exceptthe automorphisms. This has the following non-trivial consequence. A theory T is called model-complete iff every embedding between models of T is elementary, i.e., preserves allfirst-order formulas. A structure is said to be model-complete iff its first-order theory ismodel-complete. Corollary 8 (Bodirsky and Pinsker [14]) . All reducts of the random graph are model-complete.Proof. It is not hard to see (cf. [14]) that an ω -categorical structure Γ is model-complete ifand only if Aut(Γ) is dense in the monoid of self-embeddings of Γ. Now let Γ be a reduct of G , and let M be the closed monoid of self-embeddings of Γ; we will show that Aut(Γ) is dense MANUEL BODIRSKY AND MICHAEL PINSKER in M . We apply Theorem 7 to M (which, as a closed monoid containing Aut( G ), is also anendomorphism monoid of a reduct Γ (cid:48) of G ). Clearly, Γ (cid:48) and Γ have the same automorphisms,namely those permutations in M whose inverse is also in M . Therefore we are done if thelast case of the theorem holds. Note that M cannot contain a constant operation as all itsoperations are injective. So suppose that M contains e N – the argument for e E is analogous.Let R be any relation of Γ, and φ R be its defining quantifier-free formula; φ R exists since G has quantifier-elimination, i.e., every first-order formula over G is equivalent to a quantifier-free formula. Let ψ R be the formula obtained by replacing all occurrences of E by false ; so ψ R is a formula over the empty language. Then a tuple a satisfies φ R in G iff e N ( a ) satisfies φ R in G (because e N is an embedding) iff e N ( a ) satisfies ψ R in G (as there are no edges on e N ( a )) iff e N ( a ) satisfies ψ R in the substructure induced by e N [ V ] (since ψ R does not containany quantifiers). Thus, Γ is isomorphic to the structure on e N [ V ] which has the relationsdefined by the formulas ψ R ; hence, Γ is isomorphic to a structure with a first-order definitionover the empty language. This structure has, of course, all injections as self-embeddings, andall permutations as automorphisms, and hence is model-complete; thus, the same is true forΓ. (cid:3) It follows from [11, Proposition 19] that all reducts of the linear order of the rationals ( Q ; < )are model-complete as well. This is remarkable, since similar structures do not have thisproperty – for example, ( Q ; <, 0) is first-order interdefinable with the structure ( Q ; <, [0 , ∞ ))which is not model-complete.We now turn to an even finer way of distinguishing reducts of an ω -categorical structure,namely up to primitive positive interdefinability . This is of importance in connection withthe constraint satisfaction problem from the introduction, as we will describe in more detailin Section 8. We call a formula primitive positive iff it is existential positive and does notcontain disjunctions. A clone on domain D is a set of finitary operations on D which containsall projections (i.e., functions of the form ( x , . . . , x n ) (cid:55)→ x i ) and which is closed undercomposition. A clone C is closed (also called locally closed or local in the literature) iff foreach n ≥ 1, the set of n -ary functions in C is a closed subset of the space D D n , where D istaken to be discrete. The closed clones on D form a complete lattice with respect to inclusion –the structure of this lattice has been studied in the universal algebra literature (see [26], [44]).Similarly, the set of relational structures with domain D which are primitive positive closed ,i.e., which contain all relations which they define by primitive positive formulas, forms acomplete lattice. For a structure Γ, we define Pol(Γ) to consist of all finitary operations onthe domain of Γ which preserve all relations of Γ, i.e., an n -ary function f is an element ofPol(Γ) iff for all relations R of Γ and all tuples r , . . . , r n ∈ R the tuple f ( r , . . . , r n ) is anelement of R . It is easy to see that Pol(Γ) is always a closed clone. Observe also that Pol(Γ)is a generalization of End(Γ) to higher (finite) arities. Theorem 9 (Bodirsky and Neˇsetˇril [12]) . Let ∆ be ω -categorical. Then the mapping Γ (cid:55)→ Pol(Γ) is an antiisomorphism between the lattice of primitive positive closed reducts of ∆ andthe lattice of closed clones containing Aut(∆) . The inverse mapping is given by C (cid:55)→ Inv( C ) . It turns out that even for the empty structure ( X ; =), the lattice of primitive positiveclosed reducts is probably too complicated to be completely described – the lattice has beenthoroughly investigated in [8]. EDUCTS OF RAMSEY STRUCTURES 9 Theorem 10 (Bodirsky, Chen, Pinsker [8]) . The structure ( X ; =) (where X is countably in-finite), and therefore all countably infinite structures, have ℵ reducts up to primitive positiveinterdefinability. Fortunately, it is sometimes sufficient in applications to understand only parts of thislattice. We will see examples of this in Section 8.3. Ramsey Classes While Theorems 2, 6 and 9 provide a theoretical method for determining reducts of an ω -categorical structure ∆ by transforming them into sets of functions on ∆, understanding theseinfinite objects could turn out difficult without further tools for handling them. We will nowfocus on structures which have the additional property that they are reducts of an orderedRamsey structure that is homogeneous in a finite relational signature; such structures are ω -categorical since homogeneous structures in a finite language are ω -categorical and sincereducts of ω -categorical structures are ω -categorical. This is less restrictive than it mightappear at first sight: we remark that it could be the case that all homogeneous structureswith a finite relational signature are reducts of ordered homogeneous Ramsey structures witha finite relational signature (that is, we do not know of a counterexample). It turns out that inthis context, certain infinite functions can be represented by finite ones, making classificationprojects more feasible. Definition 11. A structure is called ordered iff it has a total order among its relations. Definition 12. Let τ a relational signature. For τ -structures S , H , P and an integer k ≥ S → ( H ) P k iff for every k -coloring χ of the copies of P in S there exists a copy H (cid:48) of H in S such that all copies of P in H (cid:48) have the same color under χ . Definition 13. A class C of finite τ -structures which is closed under isomorphisms, inducedsubstructures, and with the joint embedding property (see [28]) is called a Ramsey class iffit is closed under substructures and for all k ≥ H , P ∈ C there exists S in C suchthat S → ( H ) P k . Definition 14. A relational structure is called Ramsey iff its age , i.e., the set of finitestructures isomorphic to a finite induced substructure, is a Ramsey class.Examples of Ramsey structures are the dense linear order ( Q ; < ) and the ordered randomgraph ( V ; E, < ), i.e., the Fra¨ıss´e limit of the class of finite ordered graphs. We remark thatthe random graph itself is not Ramsey, but since it is a reduct of the ordered random graph,the methods we are about to expose apply as well.We will now see that one can find regular patterns in the behavior of any function actingon an ordered Ramsey structure which is ω -categorical. Definition 15. Let Γ be a structure. The type tp( a ) of an n -tuple a ∈ Γ is the set offirst-order formulas with free variables x , . . . , x n that hold for a in Γ.We recall the classical theorem of Ryll-Nardzewski about the number of types in ω -categorical structures. Theorem 16 (Ryll-Nardzewski) . The following are equivalent for a countable structure Γ ina countable language. • Γ is ω -categorical, i.e., any countable model of the theory of Γ is isomorphic to Γ . • Γ has for all n ≥ only finitely many different types of n -tuples. We also mention that moreover, as a well-known consequence of the proof of this theorem,two tuples in a countable ω -categorical structure have the same type if and only if there is anautomorphism of Γ which sends one tuple to the other. Definition 17. A type condition between two structures Γ , Γ is a pair ( t , t ), where each t i is a type of an n -tuple in Γ i . A function f : Γ → Γ satisfies a type condition ( t , t ) iffor all n -tuples ( a , . . . , a n ) of type t , the n -tuple ( f ( a ) , . . . , f ( a n )) is of type t .A behavior is a set of type conditions between two structures. A function has behavior B if it satisfies all the type conditions of the behavior B . A behavior B is called complete iff forall types t of tuples in Γ there is a type t of a tuple in Γ such that ( t , t ) ∈ B .A function f : Γ → Γ is canonical iff it has a complete behavior. If F ⊆ Γ , then we saythat f is canonical on F if its restriction to F is canonical.Observe that the function ↔ of Theorem 3 is canonical for the structure ( Q ; < ). Thefunction (cid:8) is not, but it is canonical on each of the intervals ( −∞ , α ) and ( α, ∞ ). For therandom graph, the function − of Theorem 4 is canonical, while sw is canonical on V \ { } .Also, sw is canonical as a function from ( V ; E, 0) to ( V ; E ), where ( V ; E, 0) denotes thestructure obtained from ( V ; E ) by adding a new constant symbol for the element 0 by whichwe defined the function sw. Moreover, the constant function and e E , e N of Theorem 7 arecanonical on ( V ; E ). We will now show that it is no coincidence that canonical functions arethat ubiquitous. Definition 18. Let ∆ be a structure. A property P holds for arbitrarily large finite sub-structures of ∆ iff for all finite substructures F ⊆ ∆ there is a copy of F in ∆ for which P holds.The following observation is just an easy application of the definition of a Ramsey class,but crucial in understanding functions on ordered Ramsey structures. Lemma 19. Let ∆ be ordered Ramsey and ω -categorical, and let f : ∆ → ∆ . Then f iscanonical on arbitrarily large finite substructures. The proof goes along the following lines: Let F be any finite substructure of ∆. Thenthe function f induces a mapping from the tuples in ∆ to the set of types in ∆ (each tupleis sent to the type of its image under f ). If we restrict this mapping to tuples of length atmost the size of F , then since ∆ is ω -categorical, the range of this restriction is finite byTheorem 16, and thus is a k -coloring of tuples for some finite k . Now apply the Ramseyproperty once for every type of tuple that occurs in F – see [16] for details. We remark thatthis lemma would be false if one dropped the order assumption, which implies that coloringinduced substructures and coloring tuples in ∆ are one and the same thing.The motivation for working with ordered Ramsey structures is the rough idea that all“important” functions can be assumed to be canonical. While this is simply false whenstated boldly like this, it is still true for some functions when the idea is further refined, as wewill show in the following. Observe that if ∆ is ω -categorical, then for each n ≥ n -types over ∆ (Theorem 16). Suppose that ∆has in addition a finite language and quantifier elimination , i.e., every first-order formula inthe language of ∆ is equivalent to a quantifier-free formula over ∆; this follows in particularfrom homogeneity in a finite language. Then, if n (∆) is the largest arity of its relations, thena function f : ∆ → ∆ is canonical iff for every type t of an n (∆)-tuple in ∆ there is a type EDUCTS OF RAMSEY STRUCTURES 11 t in ∆ such that f satisfies the type condition ( t , t ). In other words, the complete behaviorof f is already determined by its behavior on n (∆)-types. Hence, a canonical function on ∆is essentially a function on the n (∆)-types of ∆ – a finite object. Definition 20. Let f, g : ∆ → ∆. We say that f generates g over ∆ iff g is contained in thesmallest closed monoid containing f and Aut(∆). Equivalently, for every finite subset F of∆, there exists a term β ◦ f ◦ α ◦ f ◦ α ◦ · · · ◦ f ◦ α n , where β, α i ∈ Aut(∆), which agreeswith g on F . Proposition 21. Let ∆ be a structure in a finite language which is ordered, Ramsey, andhomogeneous. Let f : ∆ → ∆ . Then f generates a canonical function g : ∆ → ∆ .First proof. Let ( F i ) i ∈ ω be an increasing sequence of finite substructures of ∆ such that (cid:83) i ∈ ω F i = ∆. By Lemma 19, for each i ∈ ω we find a copy F (cid:48) i of F i in ∆ on which f iscanonical. Since there are only finitely many possibilities of canonical behavior, one behavioroccurs an infinite number of times; thus, by thinning out the sequence, we may assume thatthe behavior is the same on all F (cid:48) i . By the homogeneity of ∆, there exist automorphisms α i of ∆ sending F i to F (cid:48) i , for all i ∈ ω . Also, since the behavior on all the F (cid:48) i is the same, wecan inductively pick automorphisms β i of ∆ such that β i +1 ◦ f ◦ α i +1 agrees with β i ◦ f ◦ α i on F i , for all i ∈ ω . The union over the functions β i ◦ f ◦ α i : F i → ∆ is a canonical functionon ∆. (cid:3) Second proof. The identity function id : ∆ → ∆ is generated by f and is canonical. (cid:3) The problem with the preceding lemma is the second proof, which makes it trivial. Whatwe really want is that f generates a canonical function g which represents f in a certainsense – it should be possible to retain specific properties of f when passing to the canonicalfunctions. For example, we could wish that if f violates a certain relation, then so does g ;or, if f is not an automorphism of ∆, we will look for a canonical function g which is not anautomorphism of ∆ either.We are now going to refine our method, and fix constants c , . . . , c n such that f / ∈ Aut(∆)is witnessed on { c , . . . , c n } . We then consider f as a function from (∆ , c , . . . , c n ) to ∆,where (∆ , c , . . . , c n ) denotes the expansion of ∆ by the constants c , . . . , c n . It turns outthat f is canonical on arbitrarily large substructures of (∆ , c , . . . , c n ), and that it generatesa canonical function g : (∆ , c , . . . , c n ) → ∆ which agrees with f on c , . . . , c n ; in particular, g is not an automorphism of ∆, and the problem of triviality in Proposition 20 no longeroccurs. In order to do this, we must assure that (∆ , c , . . . , c n ) still has the Ramsey property.This leads us into topological dynamics.4. Topological Dynamics We have seen in the previous section that our approach crucially relies on the fact thatwhen an ordered homogeneous Ramsey structure is expanded by finitely many constants, theexpansion is again Ramsey (it is clear that the expansion is again ordered and homogeneous).To prove this, we use a characterization in topological dynamics of those ordered homogeneousstructures which are Ramsey.Recall that a topological group is an (abstract) group G together with a topology on theelements of G such that ( x, y ) (cid:55)→ xy − is continuous from G to G . In other words, we requirethat the binary group operation and the inverse function are continuous. Definition 22. A topological group is extremely amenable iff any continuous action of thegroup on a compact Hausdorff space has a fixed point.Kechris, Pestov and Todorcevic have characterized the Ramsey property of the age of anordered homogeneous structure by means of extreme amenability in the following theorem. Theorem 23 (Kechris, Pestov, Todorcevic [32]) . Let ∆ be an ordered homogeneous relationalstructure. Then the age of ∆ has the Ramsey property iff Aut(∆) is extremely amenable. This theorem can be applied to provide a short and elegant proof of the following. Proposition 24 (Bodirsky, Pinsker and Tsankov [16]) . Let ∆ be ordered, Ramsey, and ho-mogeneous, and let c , . . . , c n ∈ ∆ . Then (∆ , c , . . . , c n ) is Ramsey as well. When ∆ is ordered, Ramsey, and homogeneous, then Aut(∆) is extremely amenable. Notethat the automorphism group of (∆ , c , . . . , c n ) is an open subgroup of Aut(∆). The propo-sition thus follows directly from the following fact – confer [16]. Lemma 25. Let G be an extremely amenable group, and let H be an open subgroup of G .Then H is extremely amenable. Minimal Functions The results of the preceding section provide a tool for “climbing up” the lattice of closedmonoids containing the automorphism group of an ordered Ramsey structure which is homo-geneous and has a finite language. Definition 26. Let C , D be closed clones. Then D is called minimal above C iff D ⊇ C andthere are no closed clones between C and D .Observe that transformation monoids can be identified with those clones which have theproperty that all their functions depend on only one variable. Hence, Definition 26 alsoprovides us with a notion of a minimal closed monoid above another closed monoid.It follows from Theorem 9 and Zorn’s Lemma that if ∆ is an ω -categorical structure in afinite language, then every closed clone containing Pol(∆) contains a minimal closed cloneabove Pol(∆). Similarly, as a consequence of Theorem 6, every closed monoid containingEnd(∆) contains a minimal closed monoid.For closed permutation groups, minimality can be defined analogously. Then Theorem 2implies that for ω -categorical structures ∆ in a finite language, every closed permutationgroup containing Aut(∆) contains a minimal closed permutation group above Aut(∆).Clearly, if a closed clone D is minimal above C , then any function f ∈ D \ C generates D with C (i.e., D is the smallest closed clone containing f and C ) – similar statements holdfor monoids and groups. In the case of clones and monoids and in the setting of reducts ofordered Ramsey structures which are homogeneous in a finite language, we can standardizesuch generating functions. This is the contents of the coming subsections.5.1. Minimal unary functions. Adapting the proof of Lemma 21, with the use of theProposition 24, one can show the following. Lemma 27. Let ∆ be ordered, Ramsey, homogeneous, and of finite language. Let f : ∆ → ∆ ,and let c , . . . , c n ∈ ∆ . Then f together with Aut(∆) generates a function which agrees with f on { c , . . . , c n } and which is canonical as a function from (∆ , c , . . . , c n ) to ∆ . EDUCTS OF RAMSEY STRUCTURES 13 Let Γ be a finite language reduct of a structure ∆ which is ordered, Ramsey, homoge-neous, and of finite language, and let N be a minimal closed monoid containing End(Γ).Then, setting n (Γ) to be the largest arity of the relations of Γ, we can pick constants c , . . . , c n (Γ) ∈ Γ and a function f ∈ N \ End(Γ) such that f / ∈ End(Γ) is witnessed on { c , . . . , c n (Γ) } . By the preceding lemma, f and Aut(∆) generate a function g which behaveslike f on { c , . . . , c n (Γ) } and which is canonical as a function from (∆ , c , . . . , c n (Γ) ) to ∆. Thisfunction g , together with End(Γ), generates N . Since there are only finitely many choicesfor the type of the tuple ( c , . . . , c n (Γ) ) and for each choice only finitely many behaviors offunctions from (∆ , c , . . . , c n (Γ) ) to ∆, we get the following. Proposition 28 (Bodirsky, Pinsker, Tsankov [16]) . Let Γ be a finite language reduct ofa structure ∆ which is ordered, Ramsey, homogeneous, and of finite language. Then thenumber of minimal closed monoids above End(Γ) is finite, and each such monoid is generatedby End(Γ) plus a canonical function g : (∆ , c , . . . , c n (Γ) ) → ∆ , for constants c , . . . , c n (Γ) ∈ Γ . Since for every relation R of Γ we can add its negation to the language, we get the following Corollary 29. Let M be the monoid of self-embeddings of a finite-language structure Γ whichis a reduct of a structure ∆ which is ordered, Ramsey, homogeneous, and of finite language.Then the number of minimal closed monoids above M is finite, and each such monoid isgenerated by M and a canonical function g : (∆ , c , . . . , c n (Γ) ) → ∆ . The following is an example for the random graph G = ( V ; E ). Since G is model-complete,its monoid of self-embeddings is just the topological closure (cid:104) Aut( G ) (cid:105) of Aut( G ) in the space V V . Therefore, the minimal closed monoids above the monoid of self-embeddings of G arejust the minimal closed monoids above (cid:104) Aut( G ) (cid:105) . Theorem 30 (Thomas [47]) . Let G = ( V ; E ) be the random graph. The minimal closedmonoids containing (cid:104) Aut( G ) (cid:105) are the following: • The monoid generated by a constant operation with Aut( G ) . • The monoid generated by e E with Aut( G ) . • The monoid generated by e N with Aut( G ) . • The monoid generated by − with Aut( G ) . • The monoid generated by sw with Aut( G ) . Minimal higher arity functions. We now generalize the concepts from unary func-tions and monoids to higher arity functions and clones. Definition 31. Let ∆ be a structure. For 1 ≤ i ≤ m and a tuple x in the power ∆ m , we write x i for the i -th coordinate of x . The type of a sequence of tuples a , . . . , a n ∈ ∆ m , denoted bytp( a , . . . , a n ), is the cartesian product of the types of ( a i , . . . , a ni ) in ∆.With this definition, the notions of type condition , behavior , complete behavior , and canon-ical generalize in complete analogy from functions f : Γ → Γ to functions f : Γ m → Γ , forstructures Γ , Γ . It can be shown that for ordered structures, the Ramsey property is notlost when going to products; an example of a proof can be found in [16]. Proposition 32. Let ∆ be ordered and Ramsey, and let m ≥ . Let moreover a number k ≥ , an n -tuple ( a , . . . , a n ) ∈ ∆ m , and finite F i ⊆ ∆ be given for ≤ i ≤ m . Then thereexist finite S i ⊆ ∆ with the property that whenever the n -tuples in S × · · · × S m of type tp( a , . . . , a n ) are colored with k colors, then there are copies F (cid:48) i of F i in S i such that thecoloring is constant on F (cid:48) × · · · × F (cid:48) m . We remark that Proposition 32 does not hold in general if ∆ is not assumed to be or-dered – an example for the random graph can be found in [14]. Similarly to the unary case(Proposition 28), one gets the following. Proposition 33 (Bodirsky, Pinsker, Tsankov [16]) . Let Γ be a finite language reduct ofa structure ∆ which is ordered, Ramsey, homogeneous and of finite language. Then ev-ery minimal closed clone above Pol(Γ) is generated by Pol(Γ) and a canonical function g :(∆ , c , . . . , c k ) m → ∆ , where m ≥ , k ≥ , and c , . . . , c k ∈ ∆ . Moreover, m only dependson the number of n (Γ) -types in Γ (and not on the clone), and k only depends on m and n (Γ) ,and the number of minimal closed clones above Pol(Γ) is finite. In the case of minimal closed clones above an endomorphism monoid, the arity of thegenerating canonical functions can be further reduced as follows. Proposition 34 (Bodirsky, Pinsker, Tsankov [16]) . Let Γ be a finite language reduct ofa structure ∆ which is ordered, Ramsey, homogeneous and of finite language. Then everyminimal closed clone above End(Γ) is generated by End(Γ) and a canonical function g :(∆ , c , . . . , c n (Γ) ) → ∆ , or by End(Γ) and a canonical function g : (∆ , c , . . . , c m ) m → ∆ ,where m only depends on the number of -types in Γ (and not on the clone). In particular,the number of minimal closed clones above End(Γ) is finite. Using this technique, the minimal closed clones containing the automorphism group of therandom graph G = ( V ; E ) have been determined. In the following, let f : V → V be abinary operation; we now define some possible behaviors for f . We say that f is • of type p iff for all x , x , y , y ∈ V with x (cid:54) = x and y (cid:54) = y we have E ( f ( x , y ) , f ( x , y ))if and only if E ( x , x ); • of type max iff for all x , x , y , y ∈ V with x (cid:54) = x and y (cid:54) = y we have E ( f ( x , y ) , f ( x , y ))if and only if E ( x , x ) or E ( y , y ); • balanced in the first argument iff for all x , x , y ∈ V with x (cid:54) = x we have E ( f ( x , y ) , f ( x , y ))if and only if E ( x , x ); • balanced in the second argument iff ( x, y ) (cid:55)→ f ( y, x ) is balanced in the first argument; • E -dominated in the first argument iff for all x , x , y ∈ V with x (cid:54) = x we have that E ( f ( x , y ) , f ( x , y )); • E -dominated in the second argument iff ( x, y ) (cid:55)→ f ( y, x ) is E -dominated in the firstargument.The dual of an operation f ( x , . . . , x n ) on V is defined by − f ( − x , . . . , − x n ). Theorem 35 (Bodirsky and Pinsker [14]) . Let G = ( V ; E ) be the random graph, and let C be a minimal closed clone above (cid:104) Aut( G ) (cid:105) . Then C is generated by Aut( G ) together withone of the unary functions of Theorem 30, or by Aut( G ) and one of the following canonicaloperations from G to G : • a binary injection of type p that is balanced in both arguments; • a binary injection of type max that is balanced in both arguments; • a binary injection of type max that is E -dominated in both arguments; • a binary injection of type p that is E -dominated in both arguments; • a binary injection of type p that is balanced in the first and E -dominated in the secondargument; • the dual of one of the last four operations. EDUCTS OF RAMSEY STRUCTURES 15 In [15], the technique of canonical functions was applied again to climb up further in thelattice of closed clones above Aut( G ) – we will come back to this in Section 8.Another example are the minimal closed clones containing all permutations of a countablyinfinite base set X . Observe that the set S X of all permutations on X is the automorphismgroup of the structure ( X ; =) which has no relations. Theorem 36 (Bodirsky and K´ara [10]; cf. also [8]) . The minimal closed clones containing (cid:104)S X (cid:105) on a countably infinite set X are: • The closed clone generated by S X and any constant operation; • The closed clone generated by S X and any binary injection. Observe that any constant operation and any binary injection on X are canonical operationsfor the structure ( X ; =).We end this section with a last example which lists the minimal closed clones containingthe self-embdeddings of the dense linear order ( Q ; < ). As with the random graph and theempty structure, since ( Q ; < ) is model-complete it follows that the monoid of self-embeddingsof ( Q ; < ) is just the closure of Aut(( Q ; < )) in Q Q .Let lex be a binary operation on Q such that lex( a, b ) < lex( a (cid:48) , b (cid:48) ) iff either a < a (cid:48) or a = a (cid:48) and b < b (cid:48) , for all a, a (cid:48) , b, b (cid:48) ∈ Q . Observe that lex is canonical as a function from Q to Q .Next, let pp be an arbitrary binary operation on Q such that for all a, a (cid:48) , b, b (cid:48) ∈ Q we havepp( a, b ) ≤ pp( a (cid:48) , b (cid:48) ) iff one of the following cases applies: • a ≤ a ≤ a (cid:48) ; • < a , 0 < a (cid:48) , and b ≤ b (cid:48) .The name of the operation pp stands for “projection-projection”, since the operation behavesas a projection to the first argument for negative first argument, and a projection to thesecond argument for positive first argument. Observe that pp is canonical if we add theorigin as a constant to the language. Finally, define the dual of an operation f ( x , . . . , x n )on Q by ↔ ( f ( ↔ ( x ) , . . . , ↔ ( x n ))). Theorem 37 (Bodirsky and K´ara [11]) . Let ( Q ; < ) be the order of the rationals, and let C be a minimal closed clone above (cid:104) Aut(( Q ; < )) (cid:105) . Then C is generated by Aut(( Q ; < )) togetherwith one of the following operations: • a constant operation; • the operation ↔ ; • the operation (cid:8) ; • the operation lex ; • the operation pp ; • the dual of pp . Decidability of Definability We turn to another application of the ideas of the last sections. Consider the followingcomputational problem for a structure Γ: Input are quantifier-free formulas φ , . . . , φ n in thelanguage of Γ defining relations R , . . . , R n on the domain of Γ, and the question is whether R can be defined from R , . . . , R n . As in Section 2, “defined” can stand for “first-orderdefined” or syntactic restrictions of this notion. We denote this computational problem byExpr ep (Γ) and Expr pp (Γ) if we consider existential positive and primitive positive definability,respectively. For finite structures Γ the problem Expr pp (Γ) is in co-NEXPTIME (and in particulardecidable), and has recently shown to be co-NEXPTIME-hard [49]. For infinite structures Γ,the decidability of Expr pp (Γ) is not obvious. An algorithm for primitive positive definabilityhas theoretical and practical consequences in the study of the computational complexity ofCPSs (which we will consider in Section 8). It is motivated by the fundamental fact thatexpansions of structures Γ by primitive positive relations do not change the complexity ofCSP(Γ). On a practical side, it turns out that hardness of a CSP can usually be shown bypresenting primitive positive definitions of relations for which it is known that the CSP ishard. Therefore, a procedure that decides primitive positive definability of a given relationmight be a useful tool to determine the computational complexity of CSPs.Using the methods of the last sections, one can show decidability of Expr ep (Γ) and Expr pp (Γ)for certain infinite structures Γ. The following uses the same terminology as in [35]. Definition 38. We say that a class C of finite τ -structures (or a τ -structure with age C ) is finitely bounded if there exists a finite set of finite τ -structures F such for all finite τ -structures A we have that A ∈ C iff no structure from F embeds into A . Theorem 39 (Bodirsky, Pinsker, Tsankov [16]) . Let ∆ be ordered, Ramsey, homogeneous,and of finite language, and let Γ be a finite language reduct of ∆ . Then Expr ep (Γ) and Expr pp (Γ) are decidable. Examples of structures ∆ that satisfy the assumptions of Theorem 39 are ( Q ; < ), the Fra¨ıss´elimit of ordered finite graphs (or tournaments [39]), the Fra¨ıss´e limit of finite partial orderswith a linear extension [39], the homogeneous universal ‘naturally ordered’ C -relation [13],just to name a few. CSPs for structures that are definable in such structures are abundantin particular for qualitative reasoning calculi in Artificial Intelligence.We want to point out that that decidability of primitive positive definability is alreadynon-trivial when Γ is trivial from a model-theoretic perspective: for the case that Γ is thestructure ( X ; =) (where X is countably infinite), the decidability of Expr pp (Γ) has been posedas an open problem in [8]. Theorem 39 solves this problem, since ( X ; =) is isomorphic to areduct of the structure ( Q ; < ), which is clearly finitely bounded, homogeneous, ordered, andRamsey.The proof of Theorem 39 goes along the following lines, and is based on the results of thelast sections. We outline the algorithm for Expr pp (Γ); the proof for Expr ep (Γ) is a subset.So the input are formulas φ , . . . , φ n defining relations R , . . . , R n , and we have to decidewhether R has a primitive positive definition from R , . . . , R n . Let Θ be the structure whichhas R , . . . , R n as its relations. By Theorem 9, R is not primitive positive definable from R , . . . , R n if and only if there is a finitary function f ∈ Pol(Θ) which violates R . By theideas of the last section, such a polymorphism can be chosen to be canonical as a function from(∆ , c , . . . , c k ) m to ∆, where c i ∈ ∆. Such canonical functions are essentially finite objectssince they can be represented as functions on types. Therefore, the algorithm can then checkfor a given canonical function whether it is a polymorphism of Θ and whether it violates R .Also, k and m can be calculated from the input, and so there are only finitely many completebehaviors to be checked. Finally, the additional assumption that ∆ be finitely bounded allowsthe algorithm to check whether a function on types really comes from a function on ∆. Werefer to [16] for details. EDUCTS OF RAMSEY STRUCTURES 17 Interpretability Many ω -categorical structures can be derived from other ω -categorical structures via first-order interpretations. In this section we will discuss the fact already mentioned in the intro-duction that bi-interpretations can be used to transfer the Ramsey property from one structureto another. A special type of interpretations, called primitive positive interpretations , willbecome important in Section 8. The definition of interpretability we use is standard, andfollows [28].When ∆ is a structure with signature τ , and δ ( x , . . . , x k ) is a first-order τ -formula withthe k free variables x , . . . , x k , we write δ (∆ k ) for the k -ary relation that is defined by δ over∆. Definition 40. A relational σ -structure Γ has a (first-order) interpretation in a τ -structure∆ if there exists a natural number d , called the dimension of the interpretation, and • a τ -formula δ ( x , . . . , x d ) – called domain formula , • for each k -ary relation symbol R in σ a τ -formula φ R ( x , . . . , x k ) where the x i denotedisjoint d -tuples of distinct variables – called the defining formulas , • a τ -formula φ = ( x , . . . , x d , y , . . . , y d ), and • a surjective map h : δ (∆ d ) → Γ – called coordinate map ,such that for all relations R in Γ and all tuples a i ∈ δ (∆ d )( h ( a ) , . . . , h ( a k )) ∈ R ⇔ ∆ | = φ R ( a , . . . , a k ) , and h ( a ) = h ( a ) ⇔ ∆ | = φ = ( a , a ) . If the formulas δ , φ R , and φ = are all primitive positive, we say that Γ has a primitive positiveinterpretation in ∆; many primitive positive interpretations can be found in Section 8. We saythat Γ is interpretable in ∆ with finitely many parameters if there are c , . . . , c n ∈ ∆ such thatΓ is interpretable in the expansion of ∆ by the singleton relations { c i } for all 1 ≤ i ≤ n . First-order definitions are a special case of interpretations: a structure Γ is (first-order) definable in ∆ if Γ has an interpretation in ∆ of dimension one where the domain formula is logicallyequivalent to true. Lemma 41 (see e.g. Theorem 7.3.8 in [28]) . If ∆ is an ω -categorical structure, then everystructure Γ that is first-order interpretable in ∆ with finitely many parameters is ω -categoricalas well. The following nicely describes interpretability between structures in terms of the (topolog-ical) automorphism groups of the structures. Theorem 42 (Ahlbrandt and Ziegler [3]; also see Theorem 5.3.5 and 7.3.7 in [28]) . Let ∆ be an ω -categorical structure with at least two elements. Then a structure Γ has a first-orderinterpretation in ∆ if and only if there is a continuous group homomorphism f : Aut(∆) → Aut(Γ) such that the image of f has finitely many orbits in its action on Γ . Note that if Γ has a d -dimensional interpretation I in Γ , and Γ has an e -dimensionalinterpretation J in Γ , then Γ has a natural ed -dimensional interpretation in Γ , whichwe denote by J ◦ I . To formally describe J ◦ I , suppose that the signature of Γ i is τ i for i = 1 , , 3, and that I = ( d, δ, ( φ R ) R ∈ τ , φ = , h ) where d is the dimension, δ the domainformula, φ = and ( φ R ) R ∈ τ the interpreting relations, and h the coordinate map. Similarly, let J = ( e, γ, ( ψ R ) R ∈ τ , ψ = , g ). We use the following. Lemma 43 (Theorem 5.3.2 in [28]) . Let Γ , Γ , I as in the preceding paragraph. Then forevery first-order τ -formula φ ( x , . . . , x k ) there is τ -formula φ I ( x , . . . , x d , . . . , x k , . . . , x dk ) such that for all a , . . . , a k ∈ δ ((Γ ) d )Γ | = φ ( h ( a ) , . . . , h ( a k )) ⇔ Γ | = φ I ( a , . . . , a k ) . We can now define the interpretation J ◦ I as follows: the domain formula η is γ I , andthe defining formula for R ∈ τ is ( ψ R ) I . The coordinate map is from η ((Γ ) ed ) → Γ , anddefined by ( a , . . . , a d , . . . , a e , . . . , a de ) (cid:55)→ g ( h ( a , . . . , a d ) , . . . , h ( a e , . . . , a de )) . Two interpretations of Γ in ∆ with coordinate maps h and h are called homotopic if therelation { (¯ x, ¯ y ) | h (¯ x ) = h (¯ y ) } is definable in ∆. The identity interpretation of a structureΓ is the 1-dimensional interpretation of Γ in Γ whose coordinate map is the identity. Twostructures Γ and ∆ are called bi-interpretable if there is an interpretation I of Γ in ∆ andan interpretation J of ∆ in Γ such that both I ◦ J and J ◦ I are homotopic to the identityinterpretation (of Γ and of ∆, respectively). Theorem 44 (Ahlbrandt and Ziegler [3]) . Two ω -categorical structures Γ and ∆ are bi-interpretable if and only if Aut(Γ) and Aut(∆) are isomorphic as topological groups. As a consequence of this result and Theorem 23 we obtain the following. Corollary 45. For ordered bi-interpretable ω -categorical homogeneous structures Γ and ∆ ,one has the Ramsey property if and only if the other one has the Ramsey property. We give an example. This corollary can be used to deduce that an important structurestudied in temporal reasoning in artificial intelligence has the Ramsey property. For therelevance of this fact in constraint satisfaction, see Section 8.We have already mentioned that the age of ( Q ; < ) has the Ramsey property. Let Γbe the structure whose elements are pairs ( x, y ) ∈ Q with x < y , representing inter-vals , and which contains all binary relations R over those intervals such that the relation { ( x, y, u, v ) | (( x, y ) , ( u, v )) ∈ R } is first-order definable in ( Q ; < ). Hence, Γ has a 2-dimensional interpretation I in ( Q ; < ), whose coordinate map h is the identity map on D := { ( x, y ) ∈ Q | x < y } .The structure Γ is known under the name Allen’s Interval Algebra in artificial intelligence.We claim that its age has the Ramsey property. Using the homogeneity of ( Q ; < ), it is easyto show that Γ is homogeneous as well. By Corollary 45, it suffices to show that Γ and ( Q ; < )are bi-interpretable. We first show that ( Q ; < ) has an interpretation J in Γ. The coordinatemap h of J maps ( x, y ) ∈ D to x . The formula φ = ( a, b ) is R ( a, b ) where R is the binaryrelation { (( x, y ) , ( u, v )) | x = u } from Γ. The formula φ < ( a, b ) is R ( a, b ) where R is thebinary relation { (( x, y ) , ( u, v )) | x < u } .We prove that J ◦ I is homotopic to the identity interpretation of ( Q ; < ) in ( Q ; < ). Thisholds since the relation { ( x, y, u ) ∈ Q | h ( h ( x, y )) = u } has the first-order definition x = u in ( Q ; < ). To show that I ◦ J is homotopic to the identity interpretation, observe that therelation { ( a, b, c ) ∈ D | h ( h ( a ) , h ( b )) = c } has the first-order definition R ( a, c ) ∧ R ( b, c )in Γ, where R is the binary relation from Γ as defined above, and R is the binary relation { (( x, y ) , ( u, v )) ∈ Γ | x = v } from Γ. This shows that Γ and ( Q ; < ) are bi-interpretable. EDUCTS OF RAMSEY STRUCTURES 19 Complexity of Constraint Satisfaction In recent years, a considerable amount of research concentrated on the computationalcomplexity of CSP(Γ) for finite structures Γ. Feder and Vardi [22] conjectured that for suchΓ, the problem CSP(Γ) is either in P, or NP-complete . This conjecture has been fascinatingresearchers from various areas, for instance from graph theory [40] and from finite modeltheory [4, 22, 33]. It has been discovered that complexity classification questions translate tofundamental questions in universal algebra [19, 29], so that lately also many researchers inuniversal algebra started to work on questions that directly correspond to questions aboutthe complexity of CSPs.For arbitrary infinite structures Γ it can be shown that there are problems CSP(Γ) thatare in NP, but neither in P nor NP-complete, unless P=NP. In fact, it can be shown that forevery computational problem P there is an infinite structure Γ such that P and CSP(Γ) areequivalent under polynomial-time Turing reductions [9]. However, there are several classes ofinfinite structures Γ for which the complexity of CSP(Γ) can be classified completely.In this section we will see three such classes of computational problems; they all have theproperty that • every problem in this class can be formulated as CSP(Γ) where Γ has a first-orderdefinition in a base structure ∆; • ∆ is ordered homogeneous Ramsey with finite signature.For all three classes, the classification result can be obtained by the same method, which wedescribe in the following two subsections.8.1. Climbing up the lattice. Clearly, if we add relations to a structure Γ with a finiterelational signature, then the CSP of the structure thus obtained is computationally at leastas complex as the CSP of Γ. On the other hand, when we add a primitive positive definablerelation to Γ, then the CSP of the resulting structure has a polynomial-time reduction toCSP(Γ). This is not hard to show, and has been observed for finite domain structures in [30];the same proof also works for structures over an infinite domain. Lemma 46. Let Γ = ( D ; R , . . . , R l ) be a relational structure, and let R be a relation that hasa primitive positive definition in Γ . Then the problems CSP(Γ) and CSP( D ; R, R , . . . , R l ) are equivalent under polynomial-time reductions. When we study the CSPs of the reducts Γ of a structure ∆, we therefore consider thelattice of reducts of ∆ which are closed under primitive positive definitions (i.e., which containall relations that are primitive positive definable from the reduct), and describe the borderbetween tractability and NP-completeness in this lattice. We remark that the reducts of∆ have, since we expand them by all primitive positive definable relations, infinitely manyrelations, and hence do not define a CSP; however, we consider Γ tractable if and only ifall structures obtained from Γ by dropping all but finitely many relations have a tractableCSP. Similarly, we consider Γ hard if there exists a structure obtained from Γ by droppingall but finitely many relations that has a hard CSP. With this convention, it is interesting todetermine the maximal tractable reducts, i.e., those reducts closed under primitive positivedefinitions which do not contain any hard relation and which cannot be further extendedwithout losing this property. By Ladner’s theorem [34], there are infinitely many complexity classes between P and NP, unless P=NP. Recall the notion of a clone from Section 2. By Theorem 9, the lattice of primitive positiveclosed reducts of ∆ and the lattice of closed clones containing Aut(∆) are antiisomorphic viathe mappings Γ (cid:55)→ Pol(Γ) (for reducts Γ) and C (cid:55)→ Inv( C ) (for clones C ). We refer to theintroduction of [8] for a detailed exposition of this well-known connection. Therefore, themaximal tractable reducts correspond to minimal tractable clones, which are precisely theclones of the form Pol(Γ) for a maximal tractable reduct.The proof strategy of the classification results presented in Sections 8.3, 8.4, and 8.5 is asfollows. We start by proving that certain reducts Γ have an NP-hard CSP. How to show this,and how to find those ‘basic hard reducts’ will be the topic of the next subsection. Let R beone of the relations from those hard reducts. If R does not have a primitive positive definitionin Γ, then Theorem 9 implies that Γ has a polymorphism f that does not preserve R . Weare now in a similar situation as in Section 5. Introducing constants, we can show that f generates an operation g that still does not preserve R but is canonical with respect to theexpansion of Γ by constants. There are only finitely many canonical behaviours that g mighthave, and therefore we can start a combinatorial analysis. In the three classifications thatfollow, this strategy always leads to polymorphisms that imply that CSP(Γ) can be solved inpolynomial time.8.2. Primitive positive interpretations, and adding constants. Surprisingly, in all theclassification results that we present in Sections 8.3, 8.4, and 8.5, there is a single conditionthat implies that a CSP is NP-hard. Recall that an interpretation is called primitive positive ifall formulas involved in the interpretation (the domain formula, the formulas φ R and φ = ) areprimitive positive. The relevance of primitive positive interpretations in constraint satisfactioncomes from the following fact, which is known for finite domain constraint satisfaction, albeitnot using the terminology of primitive positive interpretations [19]. In the present form, itappears first in [6]. Theorem 47. Let Γ and ∆ be structures with finite relational signatures. If there is aprimitive positive interpretation of Γ in ∆ , then there is a polynomial-time reduction from CSP(Γ) to CSP(∆) . All hardness proofs presented later can be shown via primitive positive interpretations ofBoolean structures (i.e., structures with the domain { , } ) with a hard CSP. In fact, in allsuch Boolean structures the relation NAE defined asNAE = { , } \ { (0 , , , (1 , , } is primitive positive definable. This fact has not been stated in the original publications; how-ever, it deserves to be mentioned as a unifying feature of all the classification results presentedhere. It is often more convenient to interpret other Boolean structures than ( { , } ; NAE),and to then apply the following Lemma. An operation f : D k → D is called essentially apermutation if there exists an i and a bijection g : D → D so that f ( x , . . . , x k ) = g ( x i ) forall ( x , . . . , x k ) ∈ D k . Lemma 48. Let ∆ be a structure that interprets a Boolean structure Γ such that all polymor-phisms of Γ are essentially a permutation. Then the structure ( { , } ; NAE) has a primitivepositive interpretation in ∆ , and CSP(∆) is NP-hard.Proof. Since the polymorphisms of Γ preserve the relation NAE, and by the well-knownfinite analog of Theorem 9 (due to [25] and independently, [17]), NAE is primitive positivedefinable in Γ. When φ is such a primitive positive definition, by substituting all relations in EDUCTS OF RAMSEY STRUCTURES 21 φ by their defining relations in ∆ we obtain an interpretation of ( { , } ; NAE) in ∆. Hardnessof CSP(∆) follows from the NP-hardness of CSP(( { , } ; NAE)) (this problem is called Not-all-3-equal-3Sat in [24]) and Theorem 47. (cid:3) Typical Boolean structures Γ such that all polymorphisms of Γ are essentially a permu-tation are the structure ( { , } ; { ( t , t , t , t ) ∈ { , } | t + t + t + t = 2 } , the structure( { , } ; 1IN3), or the structure ( { , } ; NAE) itself.Sometimes it is not possible to give a primitive positive interpretation of the structure( { , } ; NAE) in Γ, but it is possible after expanding Γ with constants. Under an assumptionabout the endomorphism monoid of Γ, however, introducing constants does not change thecomputational complexity of Γ. More precisely, we have the following. Theorem 49 (Theorem 19 in [5]) . Let Γ be an ω -categorical structure with a finite relationalsignature such that Aut(Γ) is dense in End(Γ) . Then for any finite number of elements c , . . . , c k of Γ there is a polynomial-time reduction from CSP((Γ , { c , } , . . . , { c k } )) to CSP(Γ) . Reducts of equality. One of the most fundamental classes of ω -categorical structuresis the class of all reducts of ( X ; =), where X is an arbitrary countably infinite set. Upto isomorphism, this is exactly the class of countable structures that are preserved by allpermutations of their domain. The other two classes of ω -categorical structures that we willstudy here both contain this class.We go straight to the statement of the complexity classification in terms of primitivepositive interpretations. This is essentially a reformulation of a result from [10] which hasbeen formulated without primitive positive interpretations. It turns out that when Γ ispreserved by the operations from one of the minimal clones above the clone generated by allthe permutations of X , then CSP(Γ) can be solved in polynomial time, and otherwise CSP(Γ)is NP-hard. Theorem 50 (essentially from [10]) . Let Γ be a reduct of ( X ; =) . Then exactly one of thefollowing holds. • Γ has a constant endomorphism. In this case, CSP(Γ) is trivially in P. • Γ has a binary injective polymorphism. In this case, CSP(Γ) is in P. • All relations with a first-order definition in ( X ; =) have a primitive positive definitionin Γ . Furthermore, the structure ( { , } ; NAE) has a primitive positive interpretationin Γ , and CSP(Γ) is NP-complete.Proof. It has been shown in [10] that CSP(Γ) is in P when Γ has a constant or a binaryinjective polymorphism. Otherwise, by Theorem 36, every polymorphism of Γ is generatedby the permutations of X . Hence, every relation R with a first-order definition in ( X ; =) ispreserved by all polymorphisms of Γ, and it follows from Theorem 9 that every relation isprimitive positive definable in Γ.This holds in particular for the relation E defined as follows. E = { ( x , x , y , y , z , z ) ∈ X | ( x = x ∧ y (cid:54) = y ∧ z (cid:54) = z ) ∨ ( x (cid:54) = x ∧ y = y ∧ z (cid:54) = z ) ∨ ( x (cid:54) = x ∧ y (cid:54) = y ∧ z = z ) } We now show that the structure ( { , } ; 1IN3) has a primitive positive interpretation in( X ; E ), which by Lemma 48 also shows that ( { , } ; NAE) has a primitive positive inter-pretation in ( X ; E ) and that CSP(Γ) is NP-hard. The dimension of the interpretation is 2, and the domain formula is ‘true’ . The formula φ ( x , x , y , y , z , z ) is E ( x , x , y , y , z , z ), and The formula φ = ( x , x , y , y ) is ∃ a , a , u , u , u , u , z , z . a = a ∧ E ( a , a , u , u , u , u ) ∧ E ( u , u , x , x , z , z ) ∧ E ( u , u , z , z , y , y ) . Note that the primitive positive formula φ = ( x , x , y , y ) is equivalent to x = x ⇔ y = y .The map h maps ( a , a ) to 1 if a = a , and to 0 otherwise. (cid:3) Note that both the constant and the binary injective operation are canonical as functionsover ( X ; =).8.4. Reducts of the dense linear order. An extension of the result in the previous sub-section has been obtained in [11]; there, the complexity of the CSP for all reducts of ( Q ; < )has been classified. By a theorem of Cameron, those reducts are (again up to isomorphism)exactly the structures that are highly set-transitive [20], i.e., structures Γ such that for anytwo finite subsets A, B with | A | = | B | of the domain there is an automorphism of Γ that maps A to B .The corresponding class of CSPs contains many computational problems that have beenstudied in Artificial Intelligence, in particular in temporal reasoning [18, 37, 48], but also inscheduling [36] or general theoretical computer science [23, 43]. The following theorem is aconsequence of results from [11]. Again, we show that the hardness proofs in this class arecaptured by interpreting Boolean structures with few polymorphisms via primitive positiveinterpretations with finitely many parameters; this has not appeared in [11], so we provide theproof. The central arguments in the classification follow the reduct classification techniquebased on Ramsey theory that we present in this survey; see Figure 1 for an illustration of thebottom of the lattice of reducts of ( Q ; < ), and the border of tractability for such reducts. Theorem 51 (essentially from [11]) . Let Γ be a reduct of ( Q ; < ) . Then exactly one of thefollowing holds. • Γ has one out of 9 binary polymorphisms (for a detailed description of those see [11]),and CSP(Γ) is in P. • Aut(Γ) is dense in End(Γ) , and the structure ( { , } ; NAE) has a primitive positive in-terpretation with finitely many parameters in Γ . In this case, CSP(Γ) is NP-complete. Before we derive Theorem 51 from what has been shown in [11], we would like to point toFigure 1 for an illustration of the clones that correspond to maximal tractable reducts. Thediagram also shows the constraint languages that just contain one of the important relations Betw (introduced in the introduction), Cycl , Sep ( Cycl and Sep already appeared in Section 2), E (which appeared earlier in this section), T , and − T . Here, T stands for the relation { ( x, y, z ) ∈ Q | ( x = y < z ) ∨ ( x = z < y ) } , and when R ⊆ Q k , then − R denotes { ( − t , . . . , − t k ) | ( t , . . . , t k ) ∈ R } .The importance of those relations comes from the fact (shown in [11]) that unless Γ hasone out of the 9 binary polymorphisms mentioned in Theorem 51 then there is a primitivepositive definition of at least one of the relations Betw , Cycl , Sep , E , T , or − T . Proof of Theorem 51. It has been shown in [11] that unless Γ has a constant endomorphism,Aut(Γ) is dense in End(Γ). We have already seen that there is a primitive positive interpre-tation of ( { , } ; NAE) in structures isomorphic to ( Q ; E ). EDUCTS OF RAMSEY STRUCTURES 23 (cid:15511) constant NP-completein P ↻ lexppmin llmxmi Pol(Betw) Pol(Cycl)Pol(E ) Pol(Sep)Pol(T ) Figure 1. An illustration of the classification result for temporal constraintlanguages. Double-circles mean that the corresponding operation has a dualgenerating a distinct clone which is not drawn in the figure. For the definitionof mi, min, mx, and ll, see [11].Now suppose that T is primitive positive definable in Γ. We give below a primitive positiveinterpretation of the structure ( { , } ; 1IN3) in ∆ = ( Q ; T , { , } ; 1IN3) in the expansion of Γ by the constant 0. Expansions byconstants do not change the computational complexity of CSP(Γ) since Aut(Γ) is dense inEnd(Γ). Thus, Lemma 48 shows NP-hardness of CSP(Γ), and that ( { , } ; NAE) has aprimitive positive interpretation in (Γ , { , } ; 1IN3) in ∆ • has dimension 2; • the domain formula δ ( x , x ) is T (0 , x , x ); • the formula φ ( x , x , y , y , z , z ) is ∃ u. T ( u, x , y ) ∧ T (0 , u, z ) ; • the formula φ = ( x , x , y , y ) is T (0 , x , y ); • the coordinate map h : δ (∆ ) → { , } is defined as follows. Let ( b , b ) be a pair ofelements of ∆ that satisfies δ . Then exactly one of b , b must have value 0, and theother element is strictly greater than 0. We define h ( b , b ) to be 1 if b = 0, and tobe 0 otherwise.To see that this is the intended interpretation, let ( x , x ) , ( y , y ) , ( z , z ) ∈ δ (∆ ), andsuppose that t := ( h ( x , x ) , h ( y , y ) , h ( z , z )) = (1 , , ∈ x , x , y , y , z , z ) satisfies φ in ∆. Since h ( x , x ) = 1, we have x = 0, and similarly we get that y , z > 0. We can then set u to 0 and have T ( u, x , y ) since 0 = u = x < y , andwe also have T (0 , u, z ) since 0 = u < z . The case that t = (0 , , 0) is analogous. Supposenow that t = (0 , , ∈ x , y > 0, and z = 0. We can then set u to min( x , y ),and therefore have T ( u, x , y ), and T (0 , u, z ) since 0 = z < u . Conversely, suppose that( x , x , y , y , z , z ) satisfies φ in ∆. Since T (0 , u, z ), exactly one out of u, z equals 0.When u = 0, then because of T ( u, x , y ) exactly one out of x , y equals 0, and we get that( h ( x , x ) , h ( y , y ) , h ( z , z )) ∈ { (0 , , , (1 , , } ⊆ u > 0, then x > y > 0, and so ( h ( x , x ) , h ( y , y ) , h ( z , z )) = (0 , , ∈ { , } ; 1IN3) in ( Q ; − T , 0) can be obtained in a dual way.Next, suppose that Betw is primitive positive definable in Γ. We will give a primitivepositive interpretation of ( { , } ; NAE) in ( Q ; Betw , Betw has a primitivepositive definition in Γ, then by Theorem 49 (since Aut(Γ) is dense in End(Γ)) and Lemma 48we obtain NP-hardness of CSP(Γ).The dimension of the interpretation is one, and the domain formula is x (cid:54) = 0, which isclearly equivalent to a primitive positive formula over ( Q ; Betw , h maps positivepoints to 1, and all other points from Q to 0. The formula φ = ( x , y ) is ∃ z. Betw ( x , , z ) ∧ Betw ( z, , y )Note that the primitive positive formula φ = is over ( Q ; Betw , 0) equivalent to ( x > ⇔ y > φ NAE ( x , y , z ) is ∃ u. Betw ( x , u, y ) ∧ Betw ( u, , z ) . If Sep has a primitive positive definition in Γ, then the statement follows easily from theprevious argument since Betw ( x, y, z ) has a 1-dimensional primitive positive interpretation in( Q ; Sep ) (the formula φ Betw ( x, y, z ) is ∃ u. Sep ( u, x, y, z )).Finally, if Cycl is primitive positive definable in Γ, we give a 3-dimensional primitivepositive interpretation of the structure ( { , } ; R, ¬ ) where R = { , } \ { (0 , , } and ¬ = { (0 , , (1 , } . The idea of the interpretation is inspired by the NP-hardness proofof [23] for the ‘Cyclic ordering problem’ (see [24]).The dimension of our interpretation is three, and the domain formula δ ( x , x , x ) is x (cid:54) = x ∧ x (cid:54) = x ∧ x (cid:54) = x , which clearly has a primitive positive definition in ( Q ; Cycl ). Thecoordinate map h sends ( x , x , x ) to 0 if Cycl ( x , x , x ), and to 1 otherwise.Let φ ( x , x , x , y , y , y ) be the formula Cycl ( x , y , x ) ∧ Cycl ( y , x , y ) ∧ Cycl ( x , y , x ) Cycl ( y , x , y ) ∧ Cycl ( x , y , x ) ∧ Cycl ( y , x , y ) . When ( a , . . . , a ) satisfies φ , we can imagine a , . . . , a as points that appear clockwise inthis order on the unit circle. In particular, we then have that Cycl ( a , a , a ) holds if andonly if Cycl ( a , a , a ) holds. The formula φ = ( x , x , x , y , y , y ) is ∃ u , . . . , u . φ ( x , x , x , u , u , u ) ∧ (cid:94) i =1 φ ( u i , u i , u i , u i +11 , u i +12 , u i +13 ) ∧ φ ( u , u , u , y , y , y ) , which is equivalent to δ ( x , x , x ) ∧ δ ( y , y , y ) ∧ ( Cycl ( x , x , x ) ⇔ Cycl ( y , y , y )) ;this is tedious, but straightforward to verify, and we omit the proof. EDUCTS OF RAMSEY STRUCTURES 25 The formula φ ¬ ( x , x , x , y , y , y ) is φ = ( x , x , x , z , z , z ).The formula φ R ( x , x , x , y , y , y , z , z , z ) is ∃ a, b, c, d, e, f, g, h, i, j, k, l, m, n. Cycl ( a, c, j ) ∧ Cycl ( b, j, k ) ∧ Cycl ( c, k, l ) ∧ Cycl ( d, f, j ) ∧ Cycl ( e, j, l ) ∧ Cycl ( f, l, m ) ∧ Cycl ( g, i, k ) ∧ Cycl ( h, k, m ) ∧ Cycl ( i, m, n ) ∧ Cycl ( n, m, l ) ∧ φ = ( x , x , x , a, b, c ) ∧ φ = ( y , y , y , d, e, f ) ∧ φ = ( z , z , z , g, h, i )The proof that for all tuples ¯ a , ¯ a , ¯ a ∈ Q ( h ( a ) , h ( a ) , h ( a )) ∈ R ⇔ ( Q ; Cycl ) | = φ R ( a , a , a )follows directly the correctness proof of the reduction presented in [23]. (cid:3) Reducts of the random graph. The full power of the technique that is developedin this paper can be used to obtain a full complexity classification for all reducts of therandom graph G = ( V ; E ) [15]. Again, the result can be stated in terms of primitive positiveinterpretations – this is not obvious from the statement of the result in [15], therefore weprovide the proofs. Theorem 52 (essentially from [15]) . Let Γ be a reduct of the countably infinite random graph G . Then exactly one of the following holds. • Γ has one out of 17 at most ternary canonical polymorphisms (for a detailed descrip-tion of those see [15]), and CSP(Γ) is in P. • Γ admits a primitive positive interpretation of ( { , } ; 1IN3) . In this case, CSP(Γ) isNP-complete.Proof. It has been shown in [15] that Γ has one out of 17 at most ternary canonical polymor-phisms, and CSP(Γ) is in P, or one of the following relations has a primitive positive definitionin Γ: the relation E , or the relation T , H , or P (3) , which are defined as follows. The 4-aryrelation T holds on x , x , x , x ∈ V if x , x , x , x are pairwise distinct, and induce in G either • a single edge and two isolated vertices, • a path with two edges and an isolated vertex, • a path with three edges, or • a complement of one of the structures stated above.To define the relation H , we write N ( u, v ) as a shortcut for E ( u, v ) ∧ u (cid:54) = v . Then H ( x , y , x , y , x , y )holds on V if (cid:94) i,j ∈{ , , } ,i (cid:54) = j,u ∈{ x i ,y i } ,v ∈{ x j ,y j } N ( u, v ) ∧ (cid:0) (( E ( x , y ) ∧ N ( x , y ) ∧ N ( x , y )) ∨ ( N ( x , y ) ∧ E ( x , y ) ∧ N ( x , y )) ∨ ( N ( x , y ) ∧ N ( x , y ) ∧ E ( x , y )) (cid:1) . The ternary relation P (3) holds on x , x , x if those three vertices are pairwise distinct anddo not induce a clique or an independent set in G . Suppose first that T is primitive positive definable in Γ. Let R be the relation { ( t , t , t , t ) ∈{ , } | t + t + t + t = 2 } . We have already mentioned that all polymorphisms of ( { , } ; R )are essentially permutations. To show that ( { , } ; NAE) has a primitive positive interpre-tation in Γ, we can therefore use Lemma 48 and it suffices to show that there is a primitivepositive interpretation of the structure ( { , } ; R ) in ( V ; T ). For a finite subset S of V , write S for the parity of edges between members of S . Now we define the relation L ⊆ V asfollows. L := (cid:8) x ∈ V | the entries of x are pairwise distinct, and { x , x , x } = { x , x , x } (cid:9) It has been shown in [15] that the relation L is pp-definable in ( V ; T ). We therefore freelyuse the relation L (and similarly (cid:54) =, the disequality relation) in primitive positive formulasover ( V ; T ).Our primitive positive interpretation of ( { , } ; R ) has dimension three. The domain for-mula δ ( x , x , x ) is x (cid:54) = x ∧ x (cid:54) = x ∧ x (cid:54) = x . The formula φ R ( x , x , x , . . . , x , x , x )of the interpretation is ∃ y , y , y , y . T ( y , . . . , y ) ∧ L ( x , x , x , y , y , y ) ∧ L ( x , x , x , y , y , y ) ∧ L ( x , x , x , y , y , y ) ∧ L ( x , x , x , y , y , y )The formula φ = is L ( x , x , x , y , y , y ). Finally, the coordinate map sends a tuple ( a , a , a )for pairwise distinct a , a , a to 1 if P (3) ( a , a , a ), and to 0 otherwise.Next, suppose that H is primitive positive definable in Γ. We give a 2-dimensional inter-pretation of ( { , } ; 1IN3) in Γ. The domain formula is ‘true’ . The formula φ = ( x , x , y , y )is ∃ z , z , u , u , v , v . H ( x , x , u , u , z , z ) ∧ N ( u , u ) ∧ H ( z , z , v , v , y , y ) ∧ N ( v , v ) . This formula is equivalent to a primitive positive formula over Γ since N ( x, y ) is primitivepositive definable by H . The formula φ ( x , x , y , y , z , z ) is ∃ x (cid:48) , x (cid:48) , y (cid:48) , y (cid:48) ,z (cid:48) , z (cid:48) . H ( x (cid:48) , x (cid:48) , y (cid:48) , y (cid:48) , z (cid:48) , z (cid:48) ) ∧ φ = ( x , x , x (cid:48) , x (cid:48) ) ∧ φ = ( x , x , x (cid:48) , x (cid:48) ) ∧ φ = ( x , x , x (cid:48) , x (cid:48) ) . The coordinate map sends a tuple ( x , x ) to 1 if E ( x , x ) and to 0 otherwise.Finally, suppose that P (3) has a primitive positive definition in Γ. We give a 2-dimensionalprimitive positive interpretation of ( { , } ; NAE). For k ≥ 3, let Q ( k ) be the k -ary relation thatholds for a tuple ( x , . . . , x k ) ∈ V k iff x , . . . , x k are pairwise distinct, and ( x , . . . , x k ) / ∈ P ( k ) .It has been shown in [15] that the relation Q (4) is primitive positive definable by the relation P (3) . Now, the formula φ = ( x , x , y , y ) is ∃ z , z .Q (4) ( x , x , z , z ) ∧ Q (4) ( z , z , y , y ). The EDUCTS OF RAMSEY STRUCTURES 27 formula φ NAE ( x , x , y , y , z , z ) is ∃ u, v, w. P (3) ( u, v, w ) ∧ Q (4) ( x , x , u, v ) ∧ Q (4) ( y , y , v, w ) ∧ Q (4) ( z , z , w, u ) . The coordinate map sends a tuple ( x , x ) to 1 if E ( x , x ) and to 0 otherwise. (cid:3) Concluding Remarks and Further Directions We have outlined an approach to use Ramsey theory for the classification of reducts of astructure, considered up to existential positive, or primitive positive interdefinability. Thecentral idea in this approach is to study functions that preserve the reduct, and to applystructural Ramsey theory to show that those functions must act regularly on large parts ofthe domain. This insight makes those functions accessible to combinatoral arguments andclassification.Our approach has been illustrated for the reducts of ( Q ; < ), and the reducts of the ran-dom graph ( V ; E ). One application of the results is complexity classification of constraintsatisfaction problems in theoretical computer science. Interestingly, the hardness proofs inthose classifications all follow a common pattern: they are based on primitive positive inter-pretations. In particular, we proved complete complexity classifications without the typicalcomputer science hardness proofs – rather, the hardness results follow from mathematicalstatements about primitive positive interpretability in ω -categorical structures.There are many other natural and important ω -categorical structures besides ( Q ; < ) and( V ; E ) where this approach seems promising. We have listed some of the simplest and mostbasic examples in Figure 2. In this table, the first column specifies the ‘base structure’ ∆,and we will be interested in the class of all structures definable in ∆. The second columnlists what is known about this class, considered up to first-order interdefinability. The thirdcolumn describes the corresponding Ramsey result, when ∆ is equipped with an appropriatelinear order. The fourth column gives the status with respect to complexity classification ofthe corresponding class of CSPs. The fifth class indicates in which areas in computer sciencethose CSPs find applications. References [1] Samson Adepoju Adeleke and Dugald Macpherson. Classification of infinite primitive Jordan permutationgroups. Proceedings of the London Mathematical Society , 72(1):63–123, 1996.[2] Samson Adepoju Adeleke and Peter M. Neumann. Relations related to betweenness: their structure andautomorphisms , volume 623 of Memoirs of the AMS 131 . American Mathematical Society, 1998.[3] Gisela Ahlbrandt and Martin Ziegler. Quasi-finitely axiomatizable totally categorical theories. Annals ofPure and Applied Logic , 30(1):63–82, 1986.[4] Albert Atserias, Andrei A. Bulatov, and Anuj Dawar. Affine systems of equations and counting infinitarylogic. Theoretical Computer Science , 410(18):1666–1683, 2009.[5] Manuel Bodirsky. Cores of countably categorical structures. Logical Methods in Computer Science , 3(1):1–16, 2007.[6] Manuel Bodirsky. Constraint satisfaction problems with infinite templates. In Heribert Vollmer, editor, Complexity of Constraints (a collection of survey articles) , pages 196–228. Springer, LNCS 5250, 2008.[7] Manuel Bodirsky and Hubert Chen. Oligomorphic clones. Algebra Universalis , 57(1):109–125, 2007.[8] Manuel Bodirsky, Hubie Chen, and Michael Pinsker. The reducts of equality up to primitive positiveinterdefinability. Journal of Symbolic Logic , 75(4):1249–1292, 2010.[9] Manuel Bodirsky and Martin Grohe. Non-dichotomies in constraint satisfaction complexity. In Proceedingsof ICALP’08 , pages 184–196, 2008. Reducts of First-orderReducts RamseyClass CSP Di-chotomy Application,Motivation( X ; =) Trivial Ramsey’stheorem Yes EqualityConstraints( Q ; < ) Cameron [21] Ramsey’stheorem Yes TemporalReasoning( V ; E ) Thomas [46] Neˇsetˇril +R¨odl [42] Yes Schaefer’stheorem forgraphsHomogeneousuniversalposet ? Neˇsetˇril +R¨odl [41] ? TemporalReasoningHomogeneousC-relation Adeleke,Macpherson,Neumann [1, 2] Deuber,Miliken ? PhylogenyReconstruc-tionCountableatomlessBooleanalgebra ? Graham,Leeb,Rothschild(see [32]) ? Set Con-straintsAllen’s Inter-val Algebra ? This paper,Section 7 ? TemporalReasoning Figure 2. A diagram suggesting future research. [10] Manuel Bodirsky and Jan K´ara. The complexity of equality constraint languages. Theory of ComputingSystems , 3(2):136–158, 2008. A conference version appeared in the proceedings of CSR’06.[11] Manuel Bodirsky and Jan K´ara. The complexity of temporal constraint satisfaction problems. Journal ofthe ACM , 57(2), 2009. An extended abstract appeared in the proceedings of STOC’08.[12] Manuel Bodirsky and Jaroslav Neˇsetˇril. Constraint satisfaction with countable homogeneous templates. Journal of Logic and Computation , 16(3):359–373, 2006.[13] Manuel Bodirsky and Diana Piguet. Finite trees are ramsey with respect to topological embeddings.Preprint, arXiv:1002:1557, 2008.[14] Manuel Bodirsky and Michael Pinsker. Minimal functions on the random graph. Preprint, arXiv:1003.4030,2010.[15] Manuel Bodirsky and Michael Pinsker. Schaefer’s theorem for graphs. In Proceedings of STOC’11 Proceedings ofLICS’11 , 2011.[17] V. G. Bodnarˇcuk, L. A. Kaluˇznin, V. N. Kotov, and B. A. Romov. Galois theory for post algebras, partI and II. Cybernetics , 5:243–539, 1969.[18] Mathias Broxvall and Peter Jonsson. Point algebras for temporal reasoning: Algorithms and complexity. Artificial Intelligence , 149(2):179–220, 2003.[19] Andrei Bulatov, Andrei Krokhin, and Peter G. Jeavons. Classifying the complexity of constraints usingfinite algebras. SIAM Journal on Computing , 34:720–742, 2005.[20] Peter J. Cameron. Transitivity of permutation groups on unordered sets. Mathematische Zeitschrift ,148:127–139, 1976.[21] Peter J. Cameron. The random graph. R. L. Graham and J. Neˇsetˇril, Editors, The Mathematics of PaulErd¨os , 1996.[22] Tom´as Feder and Moshe Vardi. The computational structure of monotone monadic SNP and constraintsatisfaction: A study through Datalog and group theory. SIAM Journal on Computing , 28:57–104, 1999. EDUCTS OF RAMSEY STRUCTURES 29 [23] Zvi Galil and Nimrod Megiddo. Cyclic ordering is NP-complete. Theoretical Computer Science , 5(2):179–182, 1977.[24] Michael Garey and David Johnson. A guide to NP-completeness . CSLI Press, Stanford, 1978.[25] David Geiger. Closed systems of functions and predicates. Pacific Journal of Mathematics , 27:95–100,1968.[26] Martin Goldstern and Michael Pinsker. A survey of clones on infinite sets. Algebra Universalis , 59:365–403,2008.[27] Edmond E. Granirer. Extremely amenable semigroups 2. Mathematica Scandinavica , 20:93–113, 1967.[28] Wilfrid Hodges. Model theory . Cambridge University Press, 1993.[29] Pawel M. Idziak, Petar Markovic, Ralph McKenzie, Matthew Valeriote, and Ross Willard. Tractabilityand learnability arising from algebras with few subpowers. In Proceedings of LICS’07 , pages 213–224,2007.[30] Peter Jeavons, David Cohen, and Marc Gyssens. Closure properties of constraints. Journal of the ACM ,44(4):527–548, 1997.[31] Markus Junker and Martin Ziegler. The 116 reducts of ( Q , <, a ). Journal of Symbolic Logic , 74(3):861–884,2008.[32] Alexander Kechris, Vladimir Pestov, and Stevo Todorcevic. Fraiss´e limits, Ramsey theory, and topologicaldynamics of automorphism groups. Geometric and Functional Analysis , 15(1):106–189, 2005.[33] Phokion G. Kolaitis and Moshe Y. Vardi. Conjunctive-query containment and constraint satisfaction. In Proceedings of PODS’98 , pages 205–213, 1998.[34] Richard E. Ladner. On the structure of polynomial time reducibility. Journal of the ACM , 22(1):155–171,1975.[35] Dugald Macpherson. A survey of homogeneous structures. Discrete Mathematics , 311(15):1599–1634, 2011.[36] Rolf H. M¨ohring, Martin Skutella, and Frederik Stork. Scheduling with and/or precedence constraints. SIAM Journal on Computing , 33(2):393–415, 2004.[37] Bernhard Nebel and Hans-J¨urgen B¨urckert. Reasoning about temporal relations: A maximal tractablesubclass of Allen’s interval algebra. Journal of the ACM , 42(1):43–66, 1995.[38] Jaroslav Neˇsetˇril. Ramsey theory. Handbook of Combinatorics , pages 1331–1403, 1995.[39] Jaroslav Neˇsetˇril. Ramsey classes and homogeneous structures. Combinatorics, Probability & Computing ,14(1-2):171–189, 2005.[40] Jaroslav Neˇsetˇril and Pavol Hell. Colouring, constraint satisfaction, and complexity. Computer ScienceReview 2 , pages 143–163, 2008.[41] Jaroslav Neˇsetˇril and Vojtech R¨odl. Combinatorial partitions of finite posets and lattices. Algebra Uni-versalis , 19:106–119, 1984.[42] Jaroslav Neˇsetˇril and Vojtech R¨odl. Mathematics of Ramsey Theory . Springer, Berlin, 1998.[43] Jaroslav Opatrny. Total ordering problem. SIAM Journal on Computing , 8(1):111–114, 1979.[44] Michael Pinsker. More sublattices of the lattice of local clones. Order , 27(3):353–364, 2010.[45] Ivo G. Rosenberg. Minimal clones I: the five types. Lectures in Universal Algebra (Proc. Conf. Szeged,1983), Colloq. Math. Soc. J. Bolyai , 43:405–427, 1986.[46] Simon Thomas. Reducts of the random graph. Journal of Symbolic Logic , 56(1):176–181, 1991.[47] Simon Thomas. Reducts of random hypergraphs. Annals of Pure and Applied Logic , 80(2):165–193, 1996.[48] Peter van Beek. Reasoning about qualitative temporal information. Artificial Intelligence , 58:297–326,1992.[49] Ross Willard. Testing expressibility is hard. In Proceedings of CP’10 , 2010. Laboratoire d’Informatique (LIX), CNRS UMR 7161, ´Ecole Polytechnique, 91128 Palaiseau,France E-mail address : [email protected] URL : ´Equipe de Logique Mathmatique, Universit´e Denis Diderot - Paris 7, UFR de Math´ematiques,75205 Paris Cedex 13, France E-mail address : [email protected] URL ::