DISMANTLABILITY, CONNECTEDNESS, AND MIXING IN RELATIONAL STRUCTURES

. The Constraint Satisfaction Problem (CSP) and its counting counterpart appears under diﬀerent guises in many areas of mathematics, computer science, and elsewhere. Its structural and algorithmic properties have demonstrated to play a crucial role in many of those applications. For instance, in the decision CSPs, structural properties of the relational structures involved—like, for example, dismantlability—and their logical characterizations have been instrumental for determining the complexity and other properties of the problem. Topological properties of the solution set such as connectedness are related to the hardness of CSPs over random structures. Additionally, in approximate counting and statistical physics, where CSPs emerge in the form of spin systems, mixing properties and the uniqueness of Gibbs measures have been heavily exploited for approximating partition functions and free energy. In spite of the great diversity of those features, there are some eerie similarities between them. These were observed and made more precise in the case of graph homomorphisms by Brightwell and Winkler, who showed that dis-mantlability of the target graph, connectedness of the set of homomorphisms, and good mixing properties of the corresponding spin system are all equivalent. In this paper we go a step further and demonstrate similar connections for arbitrary CSPs. This requires much deeper understanding of dismantling and the structure of the solution space in the case of relational structures, and new reﬁned concepts of mixing introduced by Briceño. In addition, we develop properties related to the study of valid extensions of a given partially deﬁned homomorphism, an approach that turns out to be novel even in the graph case. We also add to the mix the combinatorial property of ﬁnite duality and its logic counterpart, FO-deﬁnability, studied by Larose, Loten, and Tardif.


Introduction
The Constraint Satisfaction Problem (CSP) provides a powerful framework in a wide range of areas of mathematics, computer science, statistical physics, and elsewhere.The goal in a CSP is to find an assignment to variables from a given set that satisfies a number of given constraints.The counting version of the problem asks about the number of such assignments.The CSP however appears in different forms: as the standard one outlined above in AI and computer science [18], as the homomorphism problem in graph and model theory [21,27], as conjunctive query evaluation in logic and database theory [31], as computing the partition function of a spin system in statistical physics [40] and related areas, like symbolic dynamics and coding [36,38].
The CSP allows for many approaches of diverse nature, and every application field exploits some of its many facets: structural properties of constraints for complexity and algorithms, probabilistic properties and the topology of the solution space in Random CSP and random structures, mixing properties in statistical physics and dynamical systems, decay of correlations and the uniqueness of probabilistic measures in approximate counting, and homomorphic duality and logical characterizations in model theory.In [11], Brightwell and Winkler observed that some of these properties are actually closely related, at least in the simple case of graph homomorphisms.In this paper we take this research direction a step further by extending Brightwell and Winkler's results to the general CSP, and by refining and widening the range of the properties involved.
We start off with a brief introduction of the features of the CSP considered in this paper.Afterwards, we provide a detailed account of the necessary background and a description of our results.Every CSP involves a set of variables and a domain, a set of possible values for the variables.Assumptions about these two sets differ in different areas.The most studied case in combinatorics and complexity theory is when both sets are finite.However, many interesting problems such as scheduling and temporal and spatial reasoning involve infinite domains; see also extensive literature on infinite CSPs (see, for example, [4] and the references therein).In other cases such as in statistical physics, it is natural to choose the set of variables to be infinite (a lattice, for example).Then, it is also natural to study probability distributions over such assignments-where Gibbs measures and the problem of their (non-)uniqueness appear naturally [25]-and also study quantities such as entropy and free energy [3,7].
Following [21], CSPs can be formulated as the problem of deciding the existence of an homomorphism from a finite relational structure G to a target relational structure H, where G and H encode the variables and the values of the CSP.The complexity of this problem, especially the case when H is a fixed finite relational structure, has received a lot of attention, culminating with the proof of the Feder-Vardi conjecture [13,45].In the present paper we focus as well on the case when H is finite, although our main focus is not algorithmic but rather structural.In particular, we are interested in studying the space Hom(G, H) of homomorphisms from G to H. Furthermore, following [11], we consider homomorphims from both finite and infinite relational structures G (although [11] only considers graphs), a flexibility that turns out to be useful to see different aspects of homomorphism spaces Hom(G, H) that otherwise would be meaningless.
There is a vast literature concerning graph homomorphisms and their properties through the lenses of statistical physics [5,19,10].In this context, it is very common to encode a spin system as a pair of relational structures G and H, where G contains a set of variables/particles and H contains the set of values/spins that each particle could take, imposing hard constraints on them, i.e., disregarding configurations of values that do not satisfy all the given constraints.In practical terms, all this reduces to study-individually and as a set-the maps from G to H that are homomorphisms.In particular, many important parameters of a spin system such as free energy and entropy can be learned from studying such a set of homomorphisms.
In [11], Brightwell and Winkler observed that many of the properties of graph homorphisms used in the above areas are equivalent to a single structural property of graphs, namely, dismantlability.In this paper we follow a similar approach and study properties of CSPs over general relational structures that we put into basically three categories: (1) dismantlability, (2) connectedness, and (3) mixing.Furthermore, as a consequence of our results, we established a connection with a fourth notion not initially contemplated in [11]: (4) finite duality.
Dismantlability.A graph is said to be dismantlable if it can be reduced to a single vertex by removing vertices whose neighborhood is contained in the neighborhood of some other vertex.Such transformations are called folds, and they can be viewed as retractions of a very particular kind.Ultimately, this kind of action allow us to reduce H and Hom(G, H) by replacing the appearance of certain spins with others that have equal or more freedom of allocation.Dismantlable graphs were introduced in [42], based on ideas already present in [29] in the context of lattices, and have been intensively studied in combinatorics.Distamantlability can be generalized in a natural way to relational structures.Indeed, some variants of this notion have been used in the study of CSPs.In particular, dismantlability has been applied in [14] to the problem of enumerating all solutions of Hom(G, H) with polynomial delay.Also, it has played a major role in the study of CSPs definable in first-order logic [17,35].
Connectedness.When G is finite, it is often useful to convert Hom(G, H) into an auxiliary graph and explore the connectivity properties of it.The set of edges of Hom(G, H) can be defined in a variety of ways, usually the most suitable to the problem at hand.For example, it is common to say that two elements from Hom(G, H) are close (and therefore adjacent in the graph) if the Hamming distance between them is smaller than a certain threshold.The particular case when this threshold is 1 has been intensively studied, motivated initially by the fact that the connectedness of the solution space for SAT problems over random instances is linked to the performance of standard satisfiability algorithms, such as WalkSAT or DPLL [1,33].This has given rise to a general framework called reconfiguration [28] (see also [41] for a recent survey) that goes way beyond homomorphisms.Work in this area encompasses both structural questions (under which conditions is Hom(G, H) connected?) and algorithmic ones (what is the complexity of, deciding, given G and H as input, whether Hom(G, H) is connected?Its diameter?The shortest path between two given members of Hom(G, H)? Etc.).In the context of spin systems, the connectedness of Hom(G, H) is related to processes that consists on periodically updating the spin of a single or a small set of particles (e.g., irreducibility of Glauber dynamics).We also consider an alternative way to define adjacency in Hom(G, H) via links as in [35].This notion of adjacency is linked to the so-called finite duality property, which is another of the main themes of our work.
Mixing.Mixing properties have been intensively studied in statistical physics and related areas (see [2,6,8,9,16,43]), and are usually applied when the set of particles in G is very large or infinite.In this case, it can be very useful to be able to "glue" together partial homomorphisms, provided their domains are far from each other.There are several properties that formalize this phenomenon and it is common to establish hierarchies among them.More concretely, given a metric in G, it is natural to ask whether there exists some uniform gap such that for any two subsets V and W of particles sufficiently far apart (in terms of the gap), and for any pair of homomorphisms φ, ψ ∈ Hom(G, H), we can find a third one, γ, such that restriction of γ to V and W coincides with the restrictions of φ and ψ on V and W , respectively.On the contrary, whenever the information content of a given set (at least partially) determines the information content of another set (i.e., the possible values that the variables on it can take), no matter how far it is, such a phenomenon has been called long range action in previous work (e.g., see [12]).
Similar phenomena are used in the related area of approximate computing of partition functions, where many algorithms are based on decay of correlations between values of remote elements of G, which allows for approximation of partition functions based only on local neighborhoods of variables.
Finite duality and logic characterizations.Homomorphism duality often helps to design a solution algorithm for a CSP or establish useful properties.A relational structure H is said to have homomorphism duality if there is a set O of relational structures-called obstructions-such that a relational structure G has a homomorphism to H if and only if no relational structure from O is homomorphic to G. Sometimes the set of obstructions is very simple, say, any bipartite graph has homomorphic duality, where O is the set of all odd cycles.If O can be chosen finite, we say that H has finite duality.
Homomorphism duality is closely related to another property of CSPs.Let L be a logic language such as first order, second order, etc.The problem of deciding homomorphisms to a relational structure H is said to be expressible in L if there is a formula Φ in the language L such that G has a homomorphism to H if and only if Φ is true on G.It is known, for instance, that H has a set of obstructions consisting of relational structures of bounded treewidth if and only if the corresponding homomorphism problem is expressible in Datalog [21], or that H has finite duality if and only if the corresponding problem is expressible in first order logic [35] (see, for example, [15] for a survey on dualities for CSP).
Our results.In this paper we extend the approach taken in [11] to the case of homomorphisms between relational structures, that besides graphs, also includes very natural special cases, like digraphs, hypergraphs, and shifts of finite type (see Example 2.2).In particular, we show (Theorem 3.4) that, for a relational structure H, the three following conditions are equivalent: (A) H 2 dismantles to a substructure of its diagonal, that is, the substructure of H 2 induced by the set {(a, a) | a ∈ H}; (B) for any G, the homomorphism graph Hom(G, H) is connected; and (C) for any G, the space Hom(G, H) satisfies certain mixing properties.Furthermore, there are several contexts where it is natural to work by forcing a certain subset of variables to take each of them a particular value and work with the remaining ones.This idea inspired a refined version of Theorem 3.4, namely Theorem 3.5, which can be regarded as the study of boundary long range actions, i.e., long range action phenomena where some boundary configuration is fixed.
As a byproduct of our results, we obtain two applications.On the one hand, we establish a link with strong spatial mixing (e.g., see [20]) and topological strong spatial mixing (introduced in [7]).These two last properties have played an important role in the development of deterministic approximate counting algorithms.In this paper we address the following question: What fixed targets H are suitable for both of these properties to hold for any G? On the other hand, we establish a connection with finite duality, which allows us to reprove the main theorem in [35].We hope that our work opens the possibility of developing new counting techniques based on this approach in a very general setting.We stress that many of these results are new even in the graph case.
Organization.The paper is organized as follows: In Section 2, we introduce most of the objects and terminology relevant to this work.In particular, we define relational structures, the natural maps and operations on them, and some useful constructions.In addition, we introduce the three relevant properties around homomorphisms: dismantlability, connectedness, and mixing.Next, in Section 3, we enunciate the two main theorems of this paper, Theorem 3.4 and its refinement, Theorem 3.5, and we illustrate how these two theorems relate to the work of Brightwell and Winkler and generalizes it.Next, in Section 4, we prove all the equivalences which constitute Theorem 3.5.In Section 5, we define Gibbs measures on sets of homomorphisms and explore the consequences of our results in relation to spatial mixing properties of such measures.Finally, in Section 6, we establish a meaningful connection between our results, topological strong spatial mixing, and finite duality of relational structures.

Preliminaries
Let H be a countable (finite or denumerable) set and k a positive integer.The set of k-tuples over H is denoted by The elements of a relation R will be denoted in boldface, e.g., a, b, etc., and a i will denote the ith entry of a for 1 ≤ i ≤ k.
Given another countable set G and a map φ : G → H, for a k-tuple a over G we shall use φ(a) to denote the k-tuple over H obtained after applying φ to a componentwise.If V ⊆ G, we will denote by φ| V the restriction of φ to V .Furthermore, if ψ is another map with domain H, we shall use ψ • φ to denote the composition of ψ with φ, i.e., the map x → ψ(φ(x)).
A signature τ is a finite collection of relation symbols R, each of them with an associated arity.For a given signature τ , a relational structure (with signature τ )-or simply, a τ -structure-H consists of a countable set H called the universe of H and a relation R(H) for each R ∈ τ , such that the arity of R(H) equals that of R. We shall use the same capital letter to denote the universe of a τ -structure, e.g., H is the universe of H.We will usually consider τ to be a fixed signature, and G and H to be τ -structures with universes G and H, respectively.
The degree of an element in a relational structure is defined as the number of tuples in which it occurs.A relational structure is locally finite if every element in its universe has finite degree and is said to be finite if its universe is finite.
Remark 2.1.A digraph G (with self-loops allowed) is a very particular case of a relational structure, where the signature τ consists of a unique relation symbol E of arity 2.Moreover, graphs correspond to the digraph case where E(G) is a symmetric relation.
We will denote by Hom(G, H) the set of all homomorphisms from G to H. Example 2.2.A particular example of CSPs that cannot be represented in the setting of Brightwell and Winkler (that is, as homomorphisms of graphs) is the case of d-dimensional nearest-neighbor (n.n.) shifts of finite type (SFTs), a fundamental object in dynamical systems and probability (see [36,37,38]).Given a positive integer d, consider the signature τ = {R 1 , . . ., R d }, where R i is a 2ary relation for all 1 ≤ i ≤ d.We consider two τ -structures G and H. Here, G will be an infinite relational structure with universe G = Z d and relations R i (G), 1 ≤ i ≤ d, representing the usual d-dimensional hypercubic lattice and the adjacency of pairs of elements in it.On the other hand, H will be a finite relational structure with universe H and R i (H) representing pairs of "colors" from H that are allowed to be adjacent in the canonical ith direction of the lattice, 1 ≤ i ≤ d.Then, X = Hom(G, H) is known as a d-dimensional n.n.SFT, a set of colorings of Z d with not necessarily isotropic adjacency rules (i.e., we do not need to have the same restrictions in every direction), and any such object can be represented in this way.
A relational structure J is a substructure of H if J ⊆ H and, for every relation symbol R ∈ τ , we have that R(J) ⊆ R(H).Furthermore, if for every k-ary R ∈ τ , we have that R(J) = R(H)∩J k , then we say that J is the substructure of H induced by J.If J ⊆ H and φ : H → J is a homomorphism acting as the identity on J, then φ is said to be a retraction.
The product of H 1 and H 2 , denoted H 1 × H 2 , is the τ -structure with universe H 1 ×H 2 where, for every k-ary , is the set of its diagonal elements.Similarly, the diagonal structure of H 2 , denoted ∆(H 2 ), is the substructure of H 2 induced by ∆(H 2 ).A substructure K of H 2 is symmetric whenever (a, b) ∈ K if and only if (b, a) ∈ K. Notice that H 2 is always symmetric.
In this paper, we will study properties of H and how they relate to other properties of Hom(G, H) for arbitrary G.We mainly consider three families of properties, namely, dismantling of H, connectedness of some particular graphs with vertex set Hom(G, H), and mixing properties of Hom(G, H).

2.1.
Dismantling.Let H be a τ -structure and let a, b be elements in its universe H.We say that b dominates a (in H) if for every k-ary R ∈ τ , any i ∈ {1, . . ., k}, and any (a 1 , . . ., a k ) ∈ R(H) with a i = a, we also have that (a 1 , . . ., a i−1 , b, a i+1 , . . ., a k ) ∈ R(H).Additionally, if a = b, then we say that a is dominated (in H).
A sequence of τ -structures J 0 , . . ., J is a dismantling sequence if for every 0 ≤ j < there exist a j , b j ∈ J j such that b j dominates a j in J j , and J j+1 is the substructure of J j induced by J j \ {a j }.In this case, we say that J 0 dismantles to J .We can alternatively denote a dismantling sequence by giving the initial τ -structure J 0 and the sequence of elements a 0 , . . ., a −1 .We say that H is dismantlable if it dismantles to a τ -structure such that its universe is a singleton.
Note that for every 0 ≤ j < there is a natural retraction r j from J j to J j+1 , where r j maps a j to b j and acts as the identity elsewhere.We call such retractions a fold.By successive composition, one can define a retraction (namely, It is well known that if H dismantles to some substructure K, then this dismantling can be found in a greedy manner.Formally, Let J ⊆ H.We say that H is J-non-foldable if every dominated element in H belongs to J.

2.2.
Walks in relational structures.We define a walk w in a τ -structure H to be a sequence In this case, we will say that w joins a 0 (the starting point) and a n (the ending point), and that the length of the walk w is n.Notice that if a walk w joins a 0 and a n , then there is another walk w that joins a n and a 0 obtained by just reversing the order of indices.The distance dist(a, b) between two elements a, b ∈ H is defined to be the smallest length among all the walks w that join a and b.The distance dist(V, W ) between sets V, W ⊆ H is defined to be the minimum distance between an element from V and an element from W .
Note that the definition of walk above coincides with the standard definition of walk when H is a graph.However, in the case of graphs it will be convenient to describe the walk merely as the list a 0 , . . ., a n of its nodes, as usual.
A τ -structure H is connected if there is a walk joining any pair of elements of its universe H and a connected component is any induced substructure that is connected and maximal in the sense of inclusion.A walk w is a circuit if n > 0, the starting and ending points of w coincide, and for all 1 ≤ < ≤ n, we have that (R , a ) = (R , a ).A τ -structure T is a τ -forest if it has no circuits.If, additionally, it is connected then it is a τ -tree.Usually, τ -trees are defined using the notion of incidence multigraph (see for example [35]).It is easy to verify that the definition given here is equivalent.
2.3.Forest of walks.Given a τ -structure H, we proceed to define a new τstructure T H .The universe T H of T H consists of all the walks w in H.For a k-ary R ∈ τ , we define R(T H ) as follows: for all a = (a 1 , . . ., a k ) ∈ R(H), for all 1 ≤ i ≤ k, and for all walks w ending in a i , we include in R(T H ) the tuple (w 1 , . . ., w i−1 , w, w i+1 , . . ., w k ), where w j , j = i, is the walk obtained from w by extending it with i, (R, a), j, a j .
We note that T H does not have circuits and has exactly |H| connected components, i.e., |H| τ -trees.It is easy to check that for every substructure I of H, the τ -structure T I is a substructure of T H . Remark 2.4.If H is connected and we consider a slight modification of this previous definition, where the walks are asked to be non-backtracking (i.e., for every 1 ≤ < n, we have that either i = j +1 , or j = i +1 , or (R , x ) = (R +1 , x +1 )), then we obtain that each connected component of the resulting τ -structure corresponds to the universal covering tree of H [32,34] (in particular, they are all the same up to isomorphism).
Note that, by construction, the map ρ H : T H → H that sends every walk w in T H to its ending point, that from now on we refer as the label map, defines a homomorphism from T H to H. Furthermore, Lemma 2.5.Assume that H is J-non-foldable for some J ⊆ H and let U be a cofinite subset of T H containing ρ −1 H (J).Then, every homomorphism in Hom(T H , H) that agrees with ρ H in U is identical to ρ H .
Proof.Given n ≥ 0, let W n be the set of walks of length at least n in H (notice that W n ⊆ W n−1 and W 0 = T H ). We shall show that any ρ ∈ Hom(T H , H) that agrees with ρ H in W n ∪ ρ −1 H (J) for arbitrary n also agrees with ρ H in W n−1 .Let w be any walk of length n − 1 and let a be its ending point.We first show that ρ (w) dominates a in H. Indeed, let R ∈ τ and let a = (a 1 , . . ., a k ) ∈ R(H), where a appears, say, in the ith coordinate.By construction, R(T H ) contains the tuple w = (w 1 , . . ., w i−1 , w, w i+1 , . . ., w k ), where for every j = i, w j is obtained by concatenating i, (R, x), j, a j at the end of w.Since w j has length n for every j = i, it follows by assumption that ρ (w j ) = a j .That is, ρ (w) (which must be a tuple in R(H)) is obtained by replacing, in a, a i by ρ (w).
Hence, we have shown that ρ (w) dominates a in H. Since H is J-non-foldable it follows that either ρ (w) = a (and, hence, ρ (w) = ρ H (w)) or a ∈ J (and, hence, To conclude the proof it is only necessary to observe that, since U is a cofinite set containing ρ −1 H (J), it follows that any homomorphism that agrees with ρ H in U , agrees as well in W n ∪ ρ −1 H (J) for sufficiently large n.

Graphs of homomorphisms.
Let G and H be τ -structures and suppose that H is finite.We define two different kinds of graphs with vertex set Hom(G, H).
The first notion has been heavily studied, from an algorithmic perspective, in the context of the so-called CSP reconfiguration problem (see [26] and the references therein) and also from an structural point of view in the special case when G and H are graphs [11].We define C(G, H) as the (reflexive) graph with vertex set Hom(G, H) such that for every φ, ψ ∈ Hom(G, H), φ and ψ are adjacent if and only if φ and ψ differ in at most one value, i.e., there exists at most one x ∈ G such that φ(x) = ψ(x).More generally, for any n ≥ 1 we can define C n (G, H) on Hom(G, H) by declaring φ and ψ adjacent if they differ in at most n values (in particular, A second notion of graph of homomorphisms appears in [35] and uses the notion of links.The 1-link L (with signature τ ) is the τ -structure with universe {0, 1}, where R(L) = {0, 1} k for every k-ary R ∈ τ .Define a (di)graph L(G, H) with vertex set Hom(G, H) as follows: set φ → ψ-i.e., a directed edge starting from φ and ending in ψ-if for any k-ary R ∈ τ and any (x 1 , . . ., x k ) ∈ R(G), we have that (γ 1 (x 1 ), . . ., γ k (x k )) ∈ R(H) whenever γ 1 , . . ., γ k ∈ {φ, ψ}.Alternatively, one can say that there φ and ψ are joined by a directed edge if there exists a homomorphism from L to H G , the Hth power of G (see [35,Section 5.2]), mapping 0 to φ and 1 to ψ.Notice that the symmetry in the definition of 1-link implies that L(G, H) is, in fact, an undirected graph.
We say that a graph of homomorphisms (i.e., C(G, H), C n (G, H), L(G, H)) is connected if for every pair of maps φ, ψ ∈ Hom(G, H) agreeing on all but finitely many elements there exists a walk that joins them.Notice that if G is finite, this coincides with the usual notion of connected in graph theory.
Clearly, C n (G, H) is a subgraph of C n+1 (G, H).In contrast, C n (G, H) and L(G, H) are not included in one another in general.However, we will establish (see Lemma 4.2) a meaningful relationship between both of them, by characterizing the connectivity properties of one in terms of the other.
Note that there is a one-to-one correspondence between the elements in Hom(L× G, H) and the edges of L(G, H).More generally, for ≥ 1 we define the -link L (with signature τ ) as the τ -structure with universe {0, 1, . . ., }, where R(L ) = ∪ −1 i=0 {i, i + 1} k , for every k-ary R ∈ τ .In other words, the -link is a sequence of 1-links with their endpoints identified.Then the following result is immediate: Lemma 2.6.For every map φ : {0, 1, . . ., } × G → H and every 2.5.Mixing properties.Given τ -structure G and H, it is useful to study properties in Hom(G, H) that allow us to glue together partially defined homomorphisms.This kind of properties are usually referred in the literature as mixing properties.
A natural mixing property is irreducibility.We say that Hom(G, H) is (V, W )irreducible for V, W ⊆ G, if for every φ, ψ ∈ Hom(G, H), there exists a map γ ∈ Hom(G, H) that agrees with φ on V and agrees with ψ on W .
Given g ≥ 0, we say that Hom(G, H) is strongly irreducible with gap g if for every V, W such that dist(V, W ) ≥ g and for all φ, ψ ∈ Hom(G, H), there exists γ ∈ Hom(G, H) that agrees with φ on V and agrees with ψ on W .We say that Hom(G, H) is strongly irreducible if it is strongly irreducible with gap g for some g.
A strengthening of strong irreducibility is the following property, introduced in [7].Given g ≥ 0, we say that Hom(G, H) is topologically strong spatial mixing (TSSM) with gap g if for every V, W, S ⊆ G such that dist(V, W ) ≥ g and for all φ, ψ ∈ Hom(G, H) that agree on S, there exists γ ∈ Hom(G, H) that agrees with φ on V ∪ S and agrees with ψ on S ∪ W .We say that Hom(G, H) is topologically strong spatial mixing if it is TSSM with gap g for some g.
An antithesis of having good mixing properties is the existence of configurations which are frozen.We say that φ ∈ Hom(G, H) is a frozen configuration if for any cofinite set U ⊆ G, the only homomorphism ψ ∈ Hom(G, H) such that ψ| U = φ| U is ψ = φ itself.

Main theorems
In this section we present the two main theorems of our work, which characterize in several ways a special class of relational structures.Both theorems consist of a generalization of some of the equivalences characterizing dismantlable graphs that appear in [11,Theorem 4.1]-which were developed only for the case of graphs-in two directions.First, Theorem 3.4 (or the simple theorem) extends [11] from graphs to arbitrary relational structures.Second, Theorem 3.5 (or the refined theorem), shows how the equivalences in Theorem 3.4 can be rephrased in terms of stronger properties with respect to special subsets of the universe of the given relational structure.
3.1.The case of graphs.The following theorem is a rephrasing of the equivalences that appear in [11,Theorem 4.1] which are relevant to us.We will use this as a prototypical example of the kind of results that we are aiming for, where we split the properties in 3 main categories: (A) dismantlability, (B) connectedness, and (C) mixing.Proof.This follows from our own results.In Theorem 3.4, we prove that, for a finite τ -structure H, we have that H 2 dismantles to a substructure of its diagonal if and only if there exists g ≥ 0 such that Hom(G, H) is strongly irreducible with gap g for all τ -structures G.In particular, this applies if τ = {E}, the usual binary relation of adjacency in graphs.Therefore, by Theorem 3.1, these two properties are also equivalent to H being dismantlable, and we conclude.
In other words, thanks to Lemma 3.2, at least in the realm of graphs, we can freely replace "dismantlable" by "the square dismantles to a substructure of its diagonal", which will be the relevant class of general relational structures in this work.
Remark 3.3.It is important to notice that the equivalence between "dismantlable" and "the square dismantles to a substructure of its diagonal" is not true for general relational structures.For example, given τ = {R} for R a binary relation symbol, we can take H such that H = {0, 1} and R(H) = {(0, 1)}.Then, H is not dismantlable, but H 2 dismantles to its diagonal.

First theorem:
A parallel with the graph case.The following theorem shows that different dismantling, connectedness, and mixing notions are equivalent.It can be seen as a generalization of Theorem 3.1 to relational structures.Theorem 3.4.Let H be a finite τ -structure with universe H. Then the following are equivalent: (A1s) H dismantles to a substructure I such that I 2 dismantles to its diagonal; (A2s) H 2 dismantles to a substructure of its diagonal; (B1s) C(G, H) is connected for every locally finite τ -structure G; (B2s) there exists some n ≥ 1 such that C n (G, H) is connected for every finite τ -structure G; H) is connected for every finite τ -structure G; (B5s) the projections π 1 and π 2 are connected in L(H 2 , H); (C1s) there exists g ≥ 0, such that Hom(G, H) is strongly irreducible with parameter g for every τ -structure G; and (C2s) there exists g ≥ 0, such that Hom(T H 2 , H) is ({x}, W )-mixing with parameter g, for all x ∈ T H 2 and W ⊆ T H 2 .
In this section we shall prove Theorem 3.4.Indeed, we shall prove a refinement of it (Theorem 3.5).This refined theorem, which we believe is interesting in its own, is motivated by the fact that, sometimes, it is natural-particularly in the context of statistical physics-to work by forcing a certain subset of particles to take each of them a particular spin and work with the remaining ones.For example, this is a common scenario when the particles in the boundary of a given set in a lattice are fixed to take particular spins and we want to study the distribution of spins in the interior of the set, conditioned on such boundary configuration.These ideas inspired the refined version, which can be regarded as the study of boundary long range actions, i.e., long range action phenomena where some boundary configuration is fixed, very similar to the concept of boundary phase transition in relation to phase transitions (e.g., see [39]).In order to state this stronger version, we need the following definitions.
3.3.Some refined definitions.Let H and G be τ -structures where G is possibly infinite.Let φ 1 , . . ., φ t be a sequence of homomorphisms in Hom(G, H) and let J ⊆ H.We say that φ 1 , . . ., φ t is J-preserving if for every x ∈ G such that φ 1 (x) = φ t (x) = a ∈ J, we have that φ i (x) = a for every 1 ≤ i ≤ t.A J-walk is a J-preserving walk.Furthermore, we say that a graph of homomorphisms is Jconnected if for every pair of maps φ, ψ ∈ Hom(G, H) agreeing on all but finitely many elements there exists a J-walk that joins them.Notice that if J = ∅, the definition of J-connected coincides with the definition of connected introduced in Section 2.4.
Given J ⊆ H, we say that Hom(G, H) is (V, W )-irreducible with respect to J if Hom(G, H) is (V, W )-irreducible and the map γ can be chosen so that γ(x) = φ(x) = ψ(x) for all x ∈ (φ, ψ) −1 (∆(J 2 )), i.e., the map γ coincides with φ in V , with ψ in W , and with both of them for x such that φ(x) = ψ(x) ∈ J .We say that Hom(G, H) is strongly J-irreducible with parameter g if it is (V, W )-mixing with respect to J for all V, W such that dist(V, W ) ≥ g.
It is easy to check that Hom(G, H) is strongly H-irreducible with gap g if and only if Hom(G, H) is TSSM with gap g.Indeed, the equivalence comes from the fact that S in the definition of TSSM is always a subset of (φ, ψ) −1 (∆(H 2 )) and the strongly H-irreducible property is equivalent to the TSSM case where S = (φ, ψ) −1 (∆(H 2 )).

3.4.
Second theorem: A refinement.Theorem 3.5.Let H be a finite τ -structure with universe H and let J ⊆ H. Then the following are equivalent: (A1) H dismantles to a substructure I whose universe contains J and such that I 2 dismantles to its diagonal; (A2) H 2 dismantles to a substructure K where its universe (B5) the projections π 1 and π 2 are J-connected in L(H 2 , H); (C1) there exists g ≥ 0, such that Hom(G, H) is strongly J-irreducible with parameter g for every τ -structure G; and (C2) there exists g ≥ 0, such that Hom(T H 2 , H) is ({x}, W )-mixing with respect to J with parameter g, for all x ∈ T H 2 and W ⊆ T 2 H . Remark 3.6.Notice that from Theorem 3.5 it follows, by taking J = H, that H 2 dismantles to its full diagonal if and only if there exists g ≥ 0 such that Hom(G, H) is TSSM with parameter g for every τ -structure G.
As a byproduct of our results (in particular of Lemma 4.3 in Section 4) we derive the following effective procedure to decide whether the statements of Theorem 3.5 are satisfied.
Remark 3.7.Let H be a finite τ -structure and let J ⊆ H.If there is a dismantling sequence (for H and J) as in Theorem 3.5(A1), then there is one that can be obtained in the following greedy manner: • First step.Starting from H, iteratively fold elements in H \ J in any arbitrary way until no further dismantling is possible, obtaining a J-nonfoldable τ -structure I.
The rest of the section contains several lemmas from which the remaining implications follow according the following table: Let I be a J-non-foldable τ -structure and K be a symmetric τstructure obtained by folding only non-diagonal elements of I 2 .Assume that K is minimal, i.e., K has no proper substructure with the same property.Then, K is ∆(J 2 )-non-foldable.To complete the proof, we shall show that a is dominated in I which, by the assumptions on I, implies that a ∈ J. Let (c, d) be any element dominating (a, a) in K. Cleary, c or d is different from a, so assume, w.l.o.g., that a = c.We shall show that c dominates a in I. Indeed, let R ∈ τ , let (a 1 , . . ., a k ) be any tuple in R(I), and let j such that a j = a.Then, ((a 1 , a 1 ), . . ., (a k , a k )) ∈ R(K) and thus, ((a 1 , a 1 ), . . ., (a j−1 , a j−1 ), (c, d), (a j+1 , a j+1 ), . . ., (a k , a k )) ∈ R(K) implies that (a 1 , . . ., a j−1 , c, a j+1 . . ., a k ) ∈ R(I), concluding the proof.
Hence, we have shown that there is a walk in L(G, H) connecting h 0 (0) = φ and h s (0) = ψ.It remains to show that the walk we have just constructed is Jpreserving.Let h j (i), for j ∈ {0, . . ., s} and i ∈ {0, . . ., n}, be any element in the walk, and let x ∈ G such that φ(x) = ψ(x) = a ∈ J. Since h 0 (i)(x) = φ(x) = a, h s (i)(x) = ψ(x) = a, and the walk h 0 , . . ., h s is J-preserving, it follows that h j (i) = a as well.
Lemma 4.3.Assume that (B5) holds.Let I be any J-non-foldable structure obtained by dismantling H and let K be the symmetric ∆(J 2 )-non-foldable structure given by Lemma 4.1.Then K contains only diagonal elements.
Proof.Let I be any J-non-foldable structure obtained by dismantling H and let K be the symmetric ∆(J 2 )-non-foldable structure given by Lemma 4.1.It suffices to show that K contains only diagonal elements.Let r be the natural retraction from H 2 to K. Let π 1 = h 1 , . . ., h t = π 2 be a J-walk in L(H 2 , H) connecting π 1 and π 2 and consider the family of maps φ 1 , . . ., φ 2t−1 : K → K, where It follows directly from the construction that every φ i is an endomorphism of K (i.e., a homomorphism from K to K).If K contains some non-diagonal element We have just shown that Note that Proposition 3.7 is a direct consequence of Lemma 4.3.Proof.Assume that H 2 dismantles to a substructure K where its universe K satisfies ∆(J 2 ) ⊆ K ⊆ ∆(H 2 ).We can assume that K = ∆(H 2 ) since otherwise there is nothing to prove.Let H 2 = J 0 , . . ., J = K the dismantling sequence and J i the last structure in the sequence whose domain contains ∆(H 2 ).Consequently, J i contains a diagonal element (a, a) that is dominated by some other element (b, c).Assume that b = a (the other case is analogous).We claim that b dominates a in H. Indeed, let R ∈ τ , let (a 1 , . . ., a k ) be any tuple in R(K) and let j such that a j = a.Note that R(J i ) contains tuple ((a 1 , a 1 ), . . ., (a k , a k )) and, consequently, it also contains ((a 1 , a 1 ), . . ., (a j−1 , a j−1 ), (b, c), (a j+1 , a j+1 ), . . ., (a k , a k )).It follows that R(K) contains (a 1 , . . ., a j−1 , b, a j+1 , . . ., a k ) and we are done.It follows that, in H 2 , every element in (H × {a}) ∪ ({a} × H) is dominated by (b, b) and, hence, H 2 dismantles to I 2 where I is the structure obtained by dismantling a in K.It follows by Lemma 2.3 that I 2 dismantles to K. Iterating this argument we obtain statement (A1).Lemma 4.5.Assume that H dismantles to a substructure I whose universe contains J and such that I 2 dismantles to its diagonal.Then, there is a dismantling sequence H 2 = J 0 , . . ., J = ∆(I 2 ) such that, for every 0 < i ≤ , if u i is the element folded in J i−1 to obtain J i and u i is a diagonal element, then u i is dominated by a (different) diagonal element in J i−1 .
Proof.Let a 1 , . . ., a r be a sequence of elements to be folded to obtain I from H. We construct a sequence of elements to be folded to obtain ∆(I 2 ) from H 2 as follows: In a first stage, all elements in ({a 1 } × H) ∪ (H × {a 1 }) can be folded in an arbitrary order (since they are all dominated by (a 2 , a 2 ) in H 2 ).In a second stage, one folds elements (again, in an arbitrary order) in ({a 2 } × H) ∪ (H × {a 2 }) that are still left, and continues in the same manner until one obtains I 2 .At this point, one proceeds dismantling I 2 to its diagonal as originally was done.It is easy to see that the sequence finally obtained satisfies the desired properties.
Note that it follows from the previous Lemma that if statement (A1) holds, then statement (A2) holds.
Let H 2 = J 0 , . . ., J = ∆(I 2 ) be the sequence provided by Lemma 4.5.For every 0 < i ≤ , let s i be the fold of J i−1 into J i defined in the natural way (i.e., s i acts as the identity on J i and maps u i to any element that dominates it in J i−1 ) and define, for every 0 < i ≤ , (1) and r 0 to be the identity.Note that r i defines a retraction of H 2 into J i and that, again by Lemma 4.5, we can assume that r i maps every diagonal element into a diagonal element.Considering this, we have the following additional lemma, which was inspired by [11,Lemma 5.2].
Lemma 4.6.Under the assumptions of Lemma 4.5, let G be a (possibly infinite) τ -structure, φ ∈ Hom(G, H 2 ), X ⊆ G, and let ω : G → H 2 be the map defined as ω(x) = (r −j • φ)(x), where r i is as in Equation ( 1) and j is the minimum between and the distance from x to X in G.Then, ω is a homomorphism from G to H 2 .Furthermore, if X is finite and G is locally finite, then φ and ω are connected in C(G, H 2 ) by a ∆(J 2 )-preserving walk.
Proof.For every i = 0, . . ., and every Y ⊆ G, let ω i,Y be the map that sends every element x ∈ G to (r i−j • φ)(x), where j is the minimum between i and the distance from x to Y .Note that ω = ω ,X .By induction, we shall prove that ω i,Y is a homomorphism from G to H 2 and, if Y is finite and G is locally finite, then φ and ω i,Y are connected in C(G, H 2 ) by a J i -preserving walk.
The base case, i = 0, is trivial.For the inductive case (i − 1 ⇒ i), we can assume that the map ω = ω i−1,Y is a homomorphism in Hom(G, H 2 ), where Y is the set of all elements of G at distance at most 1 from Y .
Claim.For every Z ⊆ Y , the map Ψ Z that acts as s i • ω in Z and as ω elsewhere, is a homomorphism from G to H 2 .Indeed, let R be any relation symbol in τ and let x = (x 1 , . . ., x k ) be any tuple in R(G).By inductive hypothesis, ω (x) belongs to R(H 2 ).If {x 1 , . . ., x k } ∩ Z = ∅, then Ψ Z (x) = ω (x) and nothing needs to be done.So, assume that x contains some element from Z. Since Z ⊆ Y , it follows that {x 1 , . . ., x k } ⊆ Y .Consequently, ω (x) = (r i−1 • φ)(x), which is a tuple of R(J i−1 ).Let u i be the element that is folded in J i−1 to obtain J i and note that Ψ Z (x) is obtained by replacing, in ω (x), some (possibly zero) occurrences of u i by s i (u i ).Since s i (u i ) dominates u i in J i−1 , it follows that Ψ Z (x) belongs to R(J i−1 ) (and hence to R(H 2 )), finishing the proof of the claim.
It follows that ω = Ψ Y ∈ Hom(G, H 2 ).Furthermore, assume that Y = {y 1 , . . ., y n } is finite and G is locally finite.Then Since G is locally finite, it follows that Y is finite.By inductive hypothesis, there is a J i−1 -preserving walk joining φ and ω in C(G, H 2 ).Hence, by concatenating the two walks, it follows that φ and ω are also connected in C(G, H 2 ).
It remains to see that the walk thus constructed is Hence it is only necessary to observe that the walk joining φ and ω is J i -preserving (by inductive hypothesis and J i ⊆ J i−1 ) and that the walk joining ω and ω is also J i -preserving (directly from its construction).Proof.Assume that statement (A1) holds.Let r 0 , . . ., r be the maps provided by Lemma 4.5 (see Equation ( 1)), let G be any locally finite τ -structure, let φ, ψ ∈ Hom(G, H), and let D be the set of elements in which φ and ψ disagree, which we can assume is finite.Then, the map Φ : G → H 2 with x → Φ(x) = (φ(x), ψ(x)) for x ∈ G, defines a homomorphism from G to H 2 .Since D is finite, it follows from Lemma 4.6 that there is ∆(J 2 )-preserving walk Ψ 1 , . . ., Ψ t in C(G, H 2 ) that joins Φ and the map ω : G → H 2 sending x ∈ G to (r −j • Φ)(x), where j is the minimum between and the the distance from x to D. It is not difficult to see that ω(x) is a diagonal element for every x ∈ G. Indeed, if x ∈ D, it follows from the fact (seen just right after Lemma 4.5) that every retraction r −j maps diagonal elements into diagonal elements and, if x ∈ D, it follows from the fact that r (H 2 ) = ∆(I 2 ).Hence, It remains to see that the walk thus defined is J-preserving.To do so, we just have to notice that if x is an element in G such that φ(x) = ψ(x) ∈ J, then we have by construction that Ψ 1 (x) = (x, x) and Ψ t (x) = (x, x), and then use the fact that Ψ 1 , . . ., Ψ t is ∆(J 2 )-preserving.Proof.Assume that statement (A1) holds.Let r 0 , . . ., r be the maps provided by Lemma 4.5 (see Equation ( 1)) and define g to be 2 .Let G, V , W , φ, and ψ satisfying the hypotheses of statement (C1).Then, the map x → (φ(x), ψ(x)) is a homomorphism from G to H 2 .Let ω be the homomorphism from G to H 2 provided by Lemma 4.6 with map x → (φ(x), ψ(x)) and where X ⊆ G is the set of all elements at distance at least from V ∪ W .It follows by construction that ω(x) = (φ(x), ψ(x)) for every x ∈ V ∪ W and that ω(X) ⊆ ∆(I 2 ).
Define h(x) to be π 1 (ω(x)) if x is at distance less than to V and π 2 (ω(x)) otherwise.We shall prove that h defines a homomorphism from G to H. Let R be any relation symbol in τ of arity k, and let x = (x 1 , . . ., x k ) be any tuple in R(G).The fact that h is a homomorphism follows directly from the following claim: h(x) = π 1 (ω(x)) if the minimum distance j from any element in the tuple to V is at most − 1 and h(x) = π 2 (ω(x)) otherwise.
To prove the claim, notice that, since all the elements in x are at distance j or j + 1 from V , we only need to consider the case when j = − 1.Let x i be any element in x.If the distance of x i to V is − 1, then h(x i ) = π 1 (ω(x i )) by definition.Assume, otherwise, that the distance of x i to V is .Since the distance from V to W is at least g = 2 , then x i is at distance at least from W , and hence Furthermore, since for every x ∈ V ∪ W , ω(x) = (φ(x), ψ(x)), it follows that h agrees with φ on V and ψ on W . Now, let x ∈ G be any element such that φ(x) = ψ(x) ∈ J.Note that, by construction, ω is ∆(I 2 )-preserving.Since J ⊆ I, it follows that ω(x) = (φ(x), ψ(x)).Since h(x) is either the first or second projection of ω(x), it follows that h(x) = φ(x) = ψ(x).Lemma 4.9.If statement (C2) holds, then statement (A1) holds.
Proof.For the sake of contradiction, let's suppose that statement (C2) holds, but statement (A1) does not.Let I be any J-non-foldable relational structure obtained by dismantling H, let K be the symmetric ∆(J 2 )-non-foldable relational structure given by Lemma 4.1, let r be a retraction of H 2 onto K defined in the natural way, and let g be any value given by statement (C2).
Since statement (A1) does not hold, it follows that K contains a non-diagonal element a = (a 1 , a 2 ).Let w 0 be the (unique) walk of length 0 starting at a, let V = {w 0 }, and let W g be the set containing all walks in T H 2 of length at least g.Let φ and ψ be the homomorphisms from T H 2 to H defined as φ := π 1 • ρ H 2 and ψ := π 2 • ρ H 2 .From statement (C2), it follows that there exist homomorphisms h 1 , h 2 : T H 2 → H such that h 1 agrees with ψ on V and with φ on W g , h 2 agrees with φ on V and with ψ on W g , and Since T K is a substructure of T H 2 , it follows that the mapping ρ : T K → K defined as ρ (w) = r(h 1 (w), h 2 (w)) is a homomorphism from T K to K. By construction, ρ agrees with ρ K in W g and every w ∈ T K with ρ K (w) ∈ ∆(J 2 ).Hence, by Lemma 2.5, ρ must be identical to ρ K , implying, in particular, that ρ K and ρ agree in w 0 .However, where the last equality follows from the fact that K is symmetric.We obtain a contradiction, since ρ K (w 0 ) = a = (a 1 , a 2 ) and a is a non-diagonal element.

Gibbs measures and applications
5.1.Basic definitions.Given a finite τ -structure H with universe H, a weight function for H is a map λ : H → R + .
Let G be a locally finite τ -structure.If V ⊆ G is a finite set and φ ∈ Hom(G, H), we define P V,φ to be the probability measure on Hom(G, H) given by for ψ ∈ Hom(G, H), where ψ| V φ| G\V is the map that coincides with ψ in V and with φ in G \ V , and Z V,φ (λ) is a normalization constant-the partition functiondefined as We will call the collection of probability measures {P V,φ }, the Gibbs (G, H, λ)specification.The boundary of a set V ⊆ G, denoted by ∂V , is defined as the set of elements in G at distance exactly 1 from V .Notice that P V,φ depends exclusively on φ| ∂V .Now, consider events of the form Next, consider the σ-algebra F generated by all events of the form A(φ, V ) for V finite, and define M(G, H) to be the set of probability measures on (Hom(G, H), F).
A measure µ ∈ M(G, H) is a Gibbs measure for the Gibbs (G, H, λ)-specification if for any finite V ⊆ G and for all ψ ∈ Hom(G, H), In other words, the probability distribution of a random ψ inside a finite V conditioned on its values outside V to coincide with those of φ, depends only on the values of ψ| V and on the boundary, φ| ∂V .Furthermore, the conditional distribution is the same as for P V,φ (see also [11,Definition 2.1]).
If Hom(G, H) = ∅, then there always exists at least one Gibbs measure [25,Chapter 4].A fundamental question in statistical physics is whether there exists a unique Gibbs measure or multiple for a given Gibbs (G, H, λ)-specification.

5.2.
Non-uniqueness and spatial mixing properties.In [11], it is shown that if H is a graph and it is dismantlable (or equivalently, by Lemma 3.2, its square dismantles to a subgraph of its diagonal), then, for any graph G of bounded degree (and therefore, locally finite), there exists some λ such that there is a unique Gibbs measure [11,Theorem 7.2].Conversely, in [11] it is also proven that if H is a nondismantlable graph, then there exists G (of bounded degree) such that for any λ there exists multiple Gibbs measures [11,Theorem 8.2].
Here, following a similar path, we show that when extending this question to arbitrary relational structures, the first implication does not remain true in general, but the second still holds.More exactly, Proposition 5.1.There exists a finite τ -structure H such that H 2 dismantles to a substructure of its diagonal and a τ -structure G of bounded degree such that for any λ there exists multiple Gibbs measures for the Gibbs (G, H, λ)-specification.Moreover, H can be chosen so that H 2 dismantles to its full diagonal ∆(H 2 ).Proposition 5.2.Let H be a finite τ -structure.If H 2 does not dismantle to a substructure of ∆(H 2 ), then there exists a τ -structure G of bounded degree such that for any λ there exists multiple Gibbs measures for the Gibbs (G, H, λ)-specification.
Before proving these two results, we introduce and explore some spatial mixing properties in this same context.Definition 5.3.Given J ⊆ H, we say that a Gibbs (G, H, λ)-specification satisfies spatial J-mixing (J-SM) if there exists constants C, α > 0 such that for all φ 1 , φ 2 ∈ Hom(G, H), for all finite V ⊆ G, and for all x ∈ V and a ∈ H, )} and {ψ(x) = a} refers to the event that a random ψ takes the value a at x.
In general, spatial mixing properties are forms of correlation decay that have been of interest because of their many applications.On the one hand, WSM is related with uniqueness of Gibbs measures and the absence of phase transitions [20].On the other hand, SSM is a strengthening of WSM and it is related to the absence of boundary phase transitions [39] and has connections with the existence of FPTAS for #P-hard counting problems [3,44], mixing time of Glauber dynamics [20], and efficient approximation algorithms for thermodynamic quantities [24,7].
In [8], there were explored sufficient and necessary conditions for a graph H to have, for any graph G of bounded degree, the existence of a weight function λ such that the Gibbs (G, H, λ)-specification satisfies WSM and SSM.In particular, it was proven that dismantlability was equivalent to the existence of Gibbs (G, H, λ)specifications satisfying WSM for any graph G of bounded degree, and therefore uniqueness, since WSM implies it.In addition, it was observed that a direct consequence is that a necessary condition for SSM to hold is that H is dismantlable, because SSM implies WSM.However, it was also shown that it is not a sufficient condition.Here, we strengthen this necessary condition and extend it to the realm of relational structures.
Proposition 5.4.If H 2 does not dismantle to a substructure of ∆(H 2 ) whose universe contains ∆(J 2 ), then there exists a τ -structure G of bounded degree such that the Gibbs (G, H, λ)-specification does not satisfy J-SM for any λ.
Two direct corollaries of this fact are the following.
Corollary 5.5.If H 2 does not dismantle to some substructure of the diagonal ∆(H 2 ), then there exists a τ -structure G of bounded degree such that the Gibbs (G, H, λ)-specification does not satisfy WSM for any λ.
Corollary 5.6.If H 2 does not dismantle to the full diagonal ∆(H 2 ), then there exists a τ -structure G of bounded degree such that the Gibbs (G, H, λ)-specification does not satisfy SSM for any λ.

Proofs of the propositions.
Proof of Proposition 5.2.Assume that H and J are such that statement (A1) from Theorem 3.5 fails.Notice that we only need the case J = ∅, but it is convenient to prove some of our results for arbitrary J for later use (in particular, in the proof of Proposition 5.4).
Let I be any J-non-foldable relational structure obtained by dismatling H and let K be the ∆(J 2 )-non-foldable relational structure given by Lemma 4.1.It follows easily (for example, see the proof of Lemma 4.5) that H 2 dismantles to K and that there is a retraction r from H 2 to K such that the image of every diagonal element is also a diagonal element (that is, such that r(∆(H 2 )) ⊆ ∆(H 2 )).
In the rest of the proof we shall assume J = ∅.Let λ be any weight function for H. Construct a Gibbs measure µ 1 by taking weak limits using φ 1 , this is to say, we consider the sequence of measures {P Vn,φ1 } n , where V n is an increasing sequence (in the sense of inclusion) of finite sets containing w 0 eventually exhausting T K .Such a sequence must have a subsequence {P Vn k ,π1•ρ K } k weakly converging to a Gibbs measure µ 1 (i.e., lim k→∞ P Vn k ,π1•ρ K (A(φ, V )) = µ 1 (A(φ, V )) for all φ and finite V ).This is a standard argument used for constructing Gibbs measures (see [25,Chapter 4]).Similarly, the sequence {P Vn k ,π2•ρ K } k must contain a subsequence converging to a Gibbs measure µ 2 .
Proof of Proposition 5.4.This is a direct consequence of the results proven in Proposition 5.2.Let us fix some weight function λ for H. Assume H 2 does not dismantle to a substructure of ∆(H 2 ) whose universe contains ∆(J 2 ).This means that H and J do not satisfy statement (A1) from Theorem 3.5.Let K, w 0 , φ 1 , and φ 2 be as in the proof of Proposition 5.2.Pick m large enough and let V ⊆ T K be the set of all elements w ∈ T K that are at distance less than m from w 0 and such that ρ K (w) ∈ ∆(J 2 ).
Since P V,φ1 is a probability measure, there exists some element a ∈ H such that It follows from Equation (3) in Proposition 5.2 (by setting U = T K \ V ), that P V,φ2 ({ψ(w 0 ) = a}) = 0.
Consequently, we have that P V,φ1 ({ψ(w 0 ) = a}) − P V,φ2 ({ψ(w 0 ) = a}) ≥ 1 |H| .Note that dist(w 0 , D J V (φ 1 , φ 2 )) ≥ m.Indeed, it follows from the definition of V that if the distance of w ∈ ∂V to w 0 is less than m, then ρ K (w) ∈ ∆(J 2 ), which implies that (φ ) from the definition of J-SM can be made arbitrarily small by choosing m large enough.Therefore, J-SM cannot hold.

Finite duality revisited
Throughout this section all relational structures are assumed to be finite.We say that a τ -structure H is a core if every homomorphism from H to H is one-toone.An obstruction to H is a τ -structure G that admits no homomorphism to H; the obstruction G is critical if every proper substructure (i.e., any substructure different from G itself) admits a homomorphism to H. A relational structure H is said to have finite duality if it has only finitely many critical obstructions.
We say that a τ -structure H contains all constants if for every a ∈ H there exists R a ∈ τ such that R a (H) = {a}.Note that every such relational structure is a core.It is well known that relational structures with constants allow us to specify the desired image of a given element.More formally, let G be any τ -structure, x ∈ G, and a ∈ H.It is immediate that the τ -structure G a obtained from G by adding x to R a (G), satisfies the following property: For every φ : G → H, φ ∈ Hom(G a , H) ⇔ φ ∈ Hom(G, H) and φ(x) = a.
We shall say that G a is obtained by coloring x to a in G.The main result in [35] states that a core relational structure H has finite duality if and only if H 2 dismantles to its diagonal.In this section we shall see how this result follows from Theorem 3.5.In addition, we shall show that, when H contains all constants, having finite duality is equivalent to having finitely many critical τ -tree obstructions, which was not previously known.Theorem 6.1.Let H be a finite τ -structure which is a core.Then, the following are equivalent: (A1c) H 2 dismantles to its diagonal; (D1c) H has finitely many critical obstructions.
Furthermore, if H contains all the constants, then the following statement is also equivalent: (D2c) H has finitely many critical τ -tree obstructions.
Here we provide an alternative proof.
(A1c) ⇒ (D1c).Assume that statement (A1c) holds.It follows that statement Theorem 3.5(C1) holds for any J ⊆ H (although we note that in this proof it suffices the case J = ∅).We claim that the diameter of the critical obstructions of H is bounded, where the diameter of a relational structure is the maximum distance between any pair of its elements.It follows easily (see [35,Lemma 2.4]) that our claim implies statement (D1c).
To prove the claim, assume towards a contradiction that there exists a critical obstruction G containing two elements x and y at distance at least g + 2 (where g is the gap given by statement Theorem 3.5(C1)).Let R ∈ τ and let x = (x 1 , . . ., x k ) ∈ R(G) in which x occurs.Since G is critical, it follows that the substructure obtained by removing x from R(G) has a homomorphism φ to H. Similarly, the substructure obtained by removing from some relation S(G) a tuple y = (y 1 , . . ., y k ) where y occurs, has a homomorphism ψ to H.
Hence, both φ and ψ define homomorphisms from the substructure K obtained from G by removing both a from R(G) and b from S(G).Note that the distance, in K, from V = {x 1 , . . ., x k } to W = {y 1 , . . ., y k } is at least g.It follows from Theorem 3.5(C1) that there is a homomorphism γ from K to H that agrees with φ on V and with ψ with W . Consequently, γ defines a homomorphism from G to H, a contradiction.
(D1c) ⇒ (D2c).It is immediate since every relational structure containing all constants is a core.
(D2c) ⇒ (A1c).Let us prove the contrapositive.Assume that H 2 does not dismantle to the diagonal or, equivalently, that H does not satisfy statement Theorem 3.5(A1) when J = H.It follows that H does not satisfy statement Theorem 3.5(C2) either.Let g be arbitrary.Since Theorem 3.5(C2) fails, it follows by standard compactness arguments that there is a finite substructure G of T H 2 and V, W ⊆ T H 2 ?Or G with dist(V, W ) ≥ g such that Hom(G, H) is not (V, W )-mixing with respect to H.That is, there exists mappings φ, ψ ∈ Hom(G, H) such that there is no mapping in Hom(G, H) that agrees with φ on V , with ψ on W , and with both on every element x ∈ G such that φ(x) = ψ(x).Now, let K be the τ -structure obtained from G by coloring every element x ∈ V according to φ, every element in W according to ψ, and every element x such that φ(x) = ψ(x) ∈ J according to φ(x).It is easy to check that there is no homomorphism from K to H and, consequently, there is a substructure I of K that is a critical obstruction of H. Since I is critical, then it is connected.Consequently, since G is a substructure of T H 2 and T H 2 does not contain circuits, it follows that I is a τ -tree.Clearly, V ∩I is nonempty since otherwise the mapping x → ψ(x) would define a homomorphism from I to H. Similarly, W ∩ I = ∅.Since I is connected and the distance in G (and hence in I) from V to W is at least g, it follows that |I| ≥ g + 1.Since g is arbitrary, we have completed the proof.
(D1c) ⇒ (A1c).Assume that H satisfies statement (D1c).Let H c obtained by endowing H with all constants.Formally, if τ is the signature of H, then τ c is the new signature containing a new relation symbol R a for every a ∈ H, and H c is the τ c -structure obtained from H by setting R a (H c ) = {a} for every a ∈ H.We shall show that H c has also finite duality.Consequently, H c satisfies statement (D2c) and, hence, H 2 c dismantles to the diagonal, implying that H 2 dismantles to the diagonal as well.
The proof of this claim is fairly standard.Let K c be a minimal critical obstruction of H c and let G be the τ -structure constructed in the following way.In a first stage, compute the disjoint union of H and K, where K is the τ -structure obtained by removing all constants from K c (that is, K is the τ -structure obtained from K c by remoing all relations in τ c \ τ ).In a second stage, we glue some elements from H and K.In particular we glue every element a in H to every element b ∈ R a (K c ).We shall show that G is not homomorphic to H. Assume towards a contradiction that there is φ that defines a homomorphism from G to H. Clearly, the restriction of φ to H, that we shall denote ψ, defines a homomorphism of H that must be one-to-one since H is a core.Since ψ is one-to-one it follows that ψ −1 is also a homomorphism from H to H and, hence, ψ −1 • g defines a homomorphism from G to H that acts as the identity on H.It follows that ψ −1 • φ defines a homomorphism from K c to H c , a contradiction.
Let J be any substructure of G which is a critical obstruction of H.It follows easily from the criticality of K c that J contains K. Since H has finite duality it follows that there is a bound on the size of J and, hence, of K.
It has been shown in [22] that if a τ -structure H has finite duality, then there exists some finite set F of τ -trees such that for every τ -structure I not homomorphic to H, there exists a τ -tree in F that is homomorphic to I but not homomorphic to H. We want to note that the equivalence between statements (D2c) and (D1c) does not follow from this fact.Indeed, direction (D2c) ⇒ (D1c) does not even hold when we do not require that the τ -structure H is equipped with constants as witnessed by the case when H is the oriented 3-cycle.Note that, in this case, H satisfies (D2c) since every τ -tree is homomorphic to H and, hence, H has no critical τ -tree obstructions at all.However, since any oriented cycle whose length is not a multiple of 3 is a critical obstruction of H, it follows that H does not satisfy (D1c).
Theorem 3.1 ([11, Theorem 4.1]).Let H be a graph.The following are equivalent: (A) H is dismantlable; (B) C(G, H) is connected for every finite graph G; and (C) there exists g ≥ 0 such that Hom(G, H) is strongly irreducible with gap g for every graph G. Lemma 3.2.A graph H is dismantlable if and only if H 2 dismantles to a subset its diagonal.

•
Second step.Starting from I 2 , iteratively fold symmetric pairs (a, b) and (b, a) in an arbitrary way until no further dismantling is possible.
Question 3.8.It can be checked that, for general relational structures, if H is dismantlable, then H 2 dismantles to its diagonal.Aside from graphs (see Lemma 3.2), for which general class of relational structures does this equivalence hold?