# AMSNP: a tame fragment of existential second-order logic

Amalgamation monotone SNP (AMSNP) is a fragment of existential second-order logic that strictly contains the logics (connected) MMSNP of Feder and Vardi and guarded monotone SNP of Bienvenu, ten Cate, Lutz, and Wolter; it is a promising candidate for an expressive subclass of NP that exhibits a complexity dichotomy. We show that AMSNP has a complexity dichotomy if and only if Constraint Satisfaction Problems for reducts of finitely bounded homogeneous structures have a complexity dichotomy. For such CSPs, powerful universal-algebraic hardness conditions are known that are conjectured to describe the border between NP-hard and polynomial-time tractable CSPs. The connection to CSPs also implies that every AMSNP sentence can be evaluated in polynomial time on classes of finite structures of bounded treewidth. We show that the syntax of AMSNP is decidable. The proof relies on the following fact, which we believe is of independent interest in model theory: for classes of finite structures given by finitely many forbidden substructures, the amalgamation property is decidable.

## Authors

• 27 publications
• 7 publications
• 3 publications
• ### ASNP: a tame fragment of existential second-order logic

Amalgamation SNP (ASNP) is a fragment of existential second-order logic ...
01/22/2020 ∙ by Manuel Bodirsky, et al. ∙ 0

• ### A universal-algebraic proof of the complexity dichotomy for Monotone Monadic SNP

The logic MMSNP is a restricted fragment of existential second-order log...
02/09/2018 ∙ by Manuel Bodirsky, et al. ∙ 0

• ### Approximation metatheorem for fractionally treewidth-fragile graphs

Baker's technique is a powerful tool for designing polynomial-time appro...
03/15/2021 ∙ by Zdeněk Dvořák, et al. ∙ 0

• ### Finding steady-state solutions for ODE systems of zero, first and homogeneous second-order chemical reactions is NP-hard

In the context of modeling of cell signaling pathways, a relevant step i...
02/27/2018 ∙ by Marcelo S. Reis, et al. ∙ 0

• ### Canonization for Bounded and Dihedral Color Classes in Choiceless Polynomial Time

In the quest for a logic capturing PTime the next natural classes of str...
10/23/2020 ∙ by Moritz Lichter, et al. ∙ 0

• ### On the Scope of the Universal-Algebraic Approach to Constraint Satisfaction

The universal-algebraic approach has proved a powerful tool in the study...
09/28/2009 ∙ by Barnaby Martin, et al. ∙ 0

• ### A Functional (Monadic) Second-Order Theory of Infinite Trees

This paper presents a complete axiomatization of Monadic Second-Order Lo...
03/14/2019 ∙ by Anupam Das, et al. ∙ 0

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

Feder and Vardi in their groundbreaking work [16] formulated the famous dichotomy conjecture for finite-domain constraint satisfaction problems, which has recently been resolved [12, 27]. Their motivation to study finite-domain CSPs was the question which fragments of existential second-order logic might exhibit a complexity dichotomy in the sense that every problem that can be expressed in the fragment is either in P or NP-complete. Existential second-order logic without any restriction is known to capture NP [15] and hence does not have a complexity dichotomy by an old result of Ladner [25]. Feder and Vardi proved that even the fragments of monadic SNP and monotone SNP do not have a complexity dichotomy since every problem in NP is polynomial-time equivalent to a problem that can be expressed in these fragments. However, the dichotomy for finite-domain CSPs implies that monotone monadic SNP (MMSNP) has a dichotomy, too [16, 24].

MMSNP is also known to have a tight connection to a certain class of infinite-domain CSPs [8]: an MMSNP sentence is equivalent to a connected MMSNP sentence if and only if it describes an infinite-domain CSP. Moreover, every problem in MMSNP is equivalent to a finite disjunction of connected MMSNP sentences. The infinite structures that appear in this connection are tame from a model-theoretic perspective: they are reducts of finitely bounded homogeneous structures (see Section 4.1). CSPs for such structures are believed to have a complexity dichotomy, too; there is even a known hardness condition such that all other CSPs in the class are conjectured to be in P [9]. The hardness condition can be expressed in several equivalent forms [2, 1].

In this paper we investigate a candidate for a logic that still has a complexity dichotomy and whose expressive power is strictly larger than connected MMSNP. Our minimum requirement for what constitutes a logic is relatively liberal: we require that the syntax of the logic should be decidable. The same requirement has been made for the question whether there exists a logic that captures the class of polynomial-time problems (see, e.g., [21, 20]). The idea of our logic is to modify monotone SNP so that only CSPs for model-theoretically tame structures can be expressed in the logic; the challenge is to come up with a definition of such a logic which has a decidable syntax. We would like to require that the (universal) first-order part of a monotone SNP sentence describes an amalgamation class. We mention that the Joint Embedding Property (JEP), which follows from the Amalgamation Property (AP), has recently be shown to be undecidable [11]. In contrast, we show that the AP is decidable (Section 5). For binary signatures and classes of finite structures described by forbidding finitely many induced substructures, this was a folklore fact in model theory. We use the so-called dual encoding, which originates from constraint satisfaction and is now also well-known in universal algebra, to reduce the general problem of deciding the AP to the binary case. The fact that the AP is decidable for classes described by finitely many forbidden substructures should be of independent interest in model theory.

We call our new logic Amalgamation Monotone SNP (AMSNP). This logic contains connected MMSNP; it also contains the more expressive logic of (connected) guarded monotone SNP, a logic introduced in the context of knowledge representation [3] (see Section 6). Every problem that can be expressed in AMSNP is a CSP for some countably infinite -categorical structure . In Section 7 we present an example application of this fact: every problem that can be expressed in AMSNP can be solved in polynomial time on instances of bounded treewidth.

## 2 Constraint Satisfaction Problems

Let be structures with a finite relational signature ; each symbol is equipped with an arity . A function is called a homomorphism from to if for every and we have ; in this case we write . We write for the class of all finite -structures such that .

###### Example 1

If is the 3-clique, i.e., the complete undirected graph with three vertices, then is the graph 3-colouring problem, which is NP-complete [19].

###### Example 2

If then is the digraph acyclicity problem, which is in P.

###### Example 3

If for then is the Betweenness problem, which is NP-complete [19].

The union of two -structures is the -structure with domain and the relation for every . The intersection is defined analogously. A disjoint union of and is the union of isomorphic copies of and with disjoint domains. As disjoint unions are unique up to isomorphism, we usually speak of the disjoint union of and , and denote it by . A structure is connected if it cannot be written as a disjoint union of at least two structures with non-empty domain. A class of structures is closed under inverse homomorphisms if whenever and homomorphically maps to we have . If is a finite relational signature, then it is well-known and easy to see [5] that for a countably infinite -structure if and only if is closed under inverse homomorphisms and disjoint unions.

## 3 Monotone SNP

Let be a finite relational signature, i.e., is a set of relation symbols , each equipped with an arity . An SNP (-) sentence is an existential second-order (-) sentence with a universal first-order part, i.e., a sentence of the form

 ∃R1,…,Rk∀x1,…,xn:ϕ

where is a quantifier-free formula over the signature . We make the additional convention that the equality symbol, which is usually allowed in first-order logic, is not allowed in (see [16]). We write for the class of all finite models of .

###### Example 4

for the SNP -sentence given below.

 ∃T∀x,y,z( (x

A class of finite -structures is said to be in SNP if there exists an SNP -sentence such that ; we use analogous definitions for all logics considered in this paper. We may assume that the quantifier-free part of SNP sentences is written in conjunctive normal form, and then use the usual terminology (clauses, literals, etc).

###### Definition 1

An SNP -sentence with quantifier-free part and existentially quantified relation symbols is called

• monotone if each literal of with a symbol from is negative, i.e., of the form for .

• monadic if all the existentially quantified relations are unary.

• connected if each clause of is connected, i.e., the following -structure is connected: the domain of is the set of variables of the clause, and if and only if is a disjunct of the clause.

The SNP sentence from Example 4 is monotone, but not monadic, and it can be shown that there does not exist an equivalent MMSNP sentence [4]. The following is taken from [5] and a proof can be found in Appendix 0.A for the convenience of the reader.

###### Theorem 3.1

Every sentence in connected monotone SNP describes a problem of the form for some relational structure . Conversely, for every structure , if is in SNP then it is also in connected monotone SNP.

## 4 Amalgamation Monotone SNP

In this section we define the new logic Amalgamation Monotone SNP (AMSNP). We first revisit some basic concepts from model theory.

### 4.1 The Amalgamation Property

Let be a finite relational signature and let be a class of -structures. We say that is finitely bounded if there exists a finite set of finite -structures such that if and only if no structure in embeds into . Note that is finitely bounded if and only if there exists a universal -sentence (which might involve the equality symbol) such that for every finite -structure we have if and only if . We say that has

• the Joint Embedding Propety (JEP) if for all structures there exists a structure that embeds both and .

• the Amalgamation Property (AP) if for any two structures such that induce the same substructure in and in (a so-called amalgamation diagram) there exists a structure and embeddings and such that for all .

Note that since is relational, the AP implies the JEP. A class of finite -structures which has the AP and is closed under induced substructures and isomorphisms is called an amalgamation class.

The age of is the class of all finite -structures that embed into . We say that is finitely bounded if is finitely bounded. A relational -structure is called homogeneous if every isomorphism between finite substructures of can be extended to an automorphism of . Fraïssé’s theorem implies that for every amalgamation class there exists a countable homogeneous -structure with ; the structure is unique up to isomorphism, also called the Fraïssé-limit of . Conversely, it is easy to see that the age of a homogeneous -structure is an amalgamation class. A structure is called a reduct of a structure if is obtained from by restricting the signature.

### 4.2 Defining Amalgamation SNP

As we have mentioned in the introduction, the idea of our logic is to require that the class of all finite structures satisfying the first-order part of an SNP sentence is an amalgamation class. We later show that the amalgamation property is decidable (Section 5).

###### Definition 2

Let be a finite relational signature. An Amalgamation SNP -sentence is an SNP sentence such that the class of finite models of the first-order part of is an amalgamation class. If is additionally monotone, we call an Amalgamation Monotone SNP (AMSNP) -sentence.

###### Example 5

The monotone SNP sentence from Example 4 describing is in AMSNP (we leave the easy proof to the reader).

###### Example 6

The graph property to be an interval graph can be expressed in ASNP. To see this, let and let be the binary relation and the binary relation . It can be shown that is homogeneous (using the technique from Section 5.1). Let be the set of all universal sentences with three variables that hold in the structure . Then is an Amalgamation SNP sentence that holds on a finite graph if and only if the graph is an interval graph. Clearly, the property to be an interval graph is not preserved by removing edges and hence this property cannot be expressed in AMSNP.

Note that since the class of finite models of the first-order part of an amalgamation SNP sentence has the JEP and since equality is not allowed in SNP, we have that is closed under disjoint unions. It can be shown as in the proof of Theorem 3.1 that every Amalgamation SNP sentence can be rewritten into an equivalent connected Amalgamation SNP sentence, and that every AMSNP sentence can be rewritten into an equivalent connected AMSNP sentence.

### 4.3 AMSNP and CSPs

We present the link between AMSNP and infinite-domain CSPs.

###### Theorem 4.1

For every AMSNP -sentence there exists a reduct of a finitely bounded homogeneous structure such that .

###### Proof

Let be the set of existentially quantified relation symbols of . Let , for a quantifier-free formula in conjunctive normal form, be the first-order part of . Let be the class of all finite -structures that satisfy ; by assumption, is an amalgamation class. Moreover, is finitely bounded because is a universal -sentence. Let be the Fraïssé-limit of ; then is a finitely bounded homogeneous structure. Let be its -reduct.

Claim 1. If is a finite -structure such that , then .

Let be a homomorphism. Let be the -expansion of where of arity denotes . Then satisfies : to see this, let and let be a conjunct of . Since we have in particular that and so there must be a disjunct of such that . Then one of the following cases applies.

• is a -literal and hence must be negative since is a monotone SNP sentence. In this case implies since is a homomorphism.

• is a -literal. Then by the definition of we have that if and only if .

Hence, . Since the conjunct of and were arbitrarily chosen, we have that . Hence, satisfies .

Claim 2. If is a finite -structure such that , then .

If has an expansion that satisfies the first-order part of , then there exists an embedding from into by the definition of . This embedding is in particular a homomorphism from to . ∎

The proof of the following theorem can be found in Appendix 0.B.

###### Theorem 4.2

Let be a reduct of a finitely bounded homogeneous structure . Then there exists an AMSNP sentence such that .

###### Corollary 1

AMSNP has a complexity dichotomy if and only if the infinite-domain tractability conjecture is true.

## 5 Deciding Amalgamation

In this section we show how to algorithmically decide whether a given existential second-order sentence is in Amalgamation SNP or in AMSNP. Our proof is based on the so-called dual encoding.

### 5.1 The Dual Encoding

The dual encoding is a standard technique from constraint satisfaction. It can be phrased using the notion of (primitive positive) bi-interpretations; since we do not need this concept here we avoid to define it and refer to a survey article that discusses primitive positive interpretations in connection with the dual encoding [7].

###### Lemma 1

Let be a relational structure with maximal arity . Then there exists a structure of with a binary signature such that the following holds.

1. If has a finite signature, then has a finite signature.

2. is homogeneous if and only if is homogeneous.

3. If is finitely bounded, then is finitely bounded. Moreover, if for a finite set of finite structures then we can effectively compute from a finite set of finite structures such that .

4. is the class of substructures of for .

###### Proof

We define the structure with domain as follows:

• for every relation of the structure has the unary relation

 R′:={(x1,…,xd)∣(x1,…,xk)∈R}⊆B=Cd;
• for all the structure has the binary relation

 Ei,j:={ ((x1,…,xd),(y1,…,yd))∣ x1,…,xd,y1,…,yd∈C and xi=yj}.

The proof of the 4 items can be found in Appendix 0.D.

### 5.2 Deciding Amalgamation

The following was known for binary signatures (the first author has learned the fact from Gregory Cherlin), but we are not aware of any published proof in the literature. Since we reduce the general case to the binary case, we give the proof in Appendix 0.C for the convenience of the reader.

###### Theorem 5.1

Let be a finite relational signature, and let be a finite set of finite relational -structures. Then there is an algorithm that decides whether has the amalgamation property.

###### Proof

Let be the maximal arity of the relations in . Define

Claim 1. is an amalgamation class if and only if is an amalgamation class. Claim 2. for some finite set of finite structures that can be computed from . For a proof of these claims, see Appendix 0.D. Since has a binary relational signature we have reduced the statement to the binary situation (Theorem 0.C.1). ∎

###### Corollary 2

There is an algorithm that decides for a given existential second-order sentence whether it is in Amalgamation SNP or in AMSNP.

## 6 Guarded Monotone SNP

In this section we revisit an expressive generalisation of MMSNP introduced by Bienvenu, ten Cate, Lutz, and Wolter [3] in the context of ontology-based data access, called guarded monotone SNP (GMSNP). It is equally expressive as the logic MMSNP introduced by Madelaine [26]111MMSNP relates to MMSNP as Courcelle’s MSO relates to MSO [14].. We will see that every GMSNP sentence is equivalent to a finite disjunction of connected GMSNP sentences (Proposition 1), each of which lies in AMSNP (Theorem 6.1).

###### Definition 3

A monotone SNP -sentence with existentially quantified relations is called guarded if each conjunct of can be written in the form

 α1∧⋯∧αn⇒β1∨⋯∨βm,where
• are atomic -formulas, called body atoms,

• are atomic -formulas, called head atoms,

• for every head atom there is a body atom such that contains all variables from (such clauses are called guarded).

We do allow the case that , i.e., the case where the head consists of the empty disjunction, which is equivalent to (false).

Our next proposition is well-known for MMSNP and can be extended to guarded SNP, too. See Appendix 0.E for the proof.

###### Proposition 1

Every GMSNP sentence is equivalent to a finite disjunction of connected GMSNP sentences.

It is well-known and easy to see [18] that each of can be reduced to in polynomial time. Conversely, if each of is in P, then is in P, too. It follows in particular that if connected GMSNP has a complexity dichotomy into P and NP-complete, then so has GMSNP. The proof of the following theorem can be found in Appendix 0.F.

###### Theorem 6.1

For every sentence in connected GMSNP there exists an AMSNP sentence such that .

The following shows that the containment of connected GMSNP in AMSNP is strict.

###### Example 7

is in AMSNP (see Example 6) but not in GMSNP. Indeed, suppose that is a GMSNP sentence which is true on all finite directed paths. We assume that the quantifier-free part of is in conjunctive normal form. Let be the existentially quantified relation symbols of , let , and let be the number of variables in . A directed path of length , viewed as a -structure, satisfies , and therefore it has an -expansion that satisfies . Note that there are different -expansions of a path of length (for each vertex and each edge of the path we have to decide which of the predicates holds), and hence there must be with such that the substructures of induced by and by are isomorphic. We then claim that the directed cycle satisfies : this is witnessed by the -expansion inherited from which satisfies . Hence, does not express digraph acyclicity. ∎

## 7 Application: Instances of Bounded Treewidth

If a computational problem can be formulated in AMSNP, then this has remarkable consequences besides a potential complexity dichotomy. In this section we show that every problem that can be formulated in AMSNP is in P when restricted to instances of bounded treewidth. The corresponding result for Monadic Second-Order Logic (MSO) instead of AMSNP is a famous theorem of Courcelle [14]. We strongly believe that AMSNP is not contained in MSO (consider for instance the Betweenness Problem from Example 3), so our result appears to be incomparable to Courcelle’s.

In the proof of our result, we need the following concepts from model theory. A first-order theory is called -categorical if all countable models of are isomorphic [22]. A structure is called -categorical if its first-order theory (i.e., the set of first-order sentences that hold in ) is -categorical. Note that with this definition, finite structures are -categorical. Another classic example is the structure . The definition of treewidth can be treated as a black box in our proof, and we refer the reader to [6].

###### Theorem 7.1

Let be an AMSNP -sentence and let . Then the problem to decide whether a given finite -structure of treewidth at most satisfies can be decided in polynomial time with a Datalog program of width .

###### Proof

Since structures that are homogeneous in a finite relational language are -categorical [22] and first-order reducts of -categorical structures are -categorical [22], Theorem 4.1 implies that the problem to decide whether a finite -structure satisfies can be formulated as CSP for an -categorical structure . Then the statement follows from Corollary 1 in [6]. ∎

###### Remark 1

In Theorem 7.1 it actually suffices to assume that the core of has treewidth at most .

The proof of the following corollary can be found in Appendix 0.F.

###### Corollary 3

Let be a GMSNP -sentence and let . Then there is a polynomial-time algorithm that decides whether a given -structure of treewidth at most satisfies .

## 8 Conclusion and Open Problems

Amalgamation monotone SNP is a strict extension of connected MMSNP [16] and connected GMSNP [3] and a candidate for an expressive logic with a complexity dichotomy: every problem in AMSNP is NP-complete or in P if and only if the infinite-domain tractability conjecture for reducts of finitely bounded homogeneous structures holds. See Figure 1.

We presented an application of AMSNP concerning the evaluation of computational problems on classes of structures of bounded treewidth. We also proved that the syntax of AMSNP is algorithmically decidable. We have not determined the precise computational complexity of checking the syntax of AMSNP, and leave this for future work. The following problems concerning AMSNP are open.

1. Suppose that is an -categorical structure with finite relational signature such that is in SNP. Is in AMSNP? (It is known that is in connected monotone SNP [16, 5].)

2. Is every CSP in Monadic Second-Order Logic (MSO) also in AMSNP?

3. Can we decide algorithmically whether a given AMSNP sentence is equivalent (over finite structures) to a fixed-point logic sentence (this then implies that the problem is in P)? We refer to [10] for a recent article on the power of fixed-point logic for infinite-domain CSPs.

4. Is every problem in NP polynomial-time equivalent to a problem in Amalgamation SNP (without monotonicity)?

## Appendix 0.A Proofs for Connected Monotone SNP

To prove Theorem 3.1, suppose first that is a connected monotone SNP sentence. To show that describes a problem of the form it suffices to show that the class of structures that satisfy is closed under disjoint unions and inverse homomorphisms. Let be of the form where is a quantifier-free first-order -formula where .

Suppose that and are -structures that satisfy . In other words, there is a -expansion of and a -expansion of such that these expansions satisfy . We claim that the disjoint union of and also satisfies ; otherwise, there would be a clause in and elements of such that is false in . Since and satisfy , there must be such that and . But then is disconnected, a contradiction. Closure under inverse homomorphism follows from monotonicity.

For the second part of the statement, suppose that describes a problem of the form for some infinite structure . In particular, the class of structures that satisfy is closed under inverse homomorphisms. Then it follows from results of Feder and Vardi [17] that is equivalent to a monotone SNP sentence. Moreover, the class of structures that satisfy is closed under disjoint unions. Consider the SNP sentence where is the conjunction of the following clauses (we assume without loss of generality that ).

• For each relation symbol , say of arity , and each , add the conjunct to .

• Add the conjunct to .

• Add the conjunct to .

• For each clause of with variables , add to the conjunct

 ϕ′∨⋁i

Clearly, is monotone if is monotone. We claim that the connected monotone SNP sentence is equivalent to . Suppose first that is a finite structure that satisfies . Then there is a -expansion of that satisfies . The expansion of by the relation shows that also satisfies .

Now suppose that is a finite structure with domain that satisfies . Then there is a -expansion of that satisfies . Write for connected -structures . Note that the clauses of force that the relation denotes in the structure , for each . Let be the -reduct of . Then satisfies , because if there was a clause from violated in then the corresponding clause in would be violated in . Hence, for every , and since is closed under disjoint unions, we also have that . ∎

## Appendix 0.B From CSPs to AMSNP Sentences

Let be a reduct of a finitely bounded homogeneous structure . In this section we construct an AMSNP sentence such that , thus proving Theorem 4.2.

Let be the signature of and the signature of . We may assume without loss of generality that contains a binary relation that denotes the equality relation; it is easy to see that an expansion by the equality relation preserves finite boundedness. Consider the structure with the domain where

 RB∗:={((b1,n1),…,(bk,nk))∣n1,…,nk∈N,(b1,…,bk)∈RB}.

To show that is homogeneous, let be an isomorphism between finite substructures of . Let be the set of all first entries of elements of the first structure. Define by picking for an element of the form and defining by . This is well-defined: if is defined on and on , then , and hence . The same consideration for shows that is a bijection, and in fact an isomorphism between finite substructures of . By the homogeneity of there exists an extension of . For each pick a permutation of that extends the bijection given by . Then the map given by is an automorphism of that extends . Since is finitely bounded, there exists a universal -formula such that . Note that might contain the equality symbol (which we do not allow in SNP sentences) and that symbols from might appear positively (which is not allowed in monotone SNP sentences).

Let be the formula obtained from by

• replacing each occurrence of the equality symbol by the symbol ;

• joining conjuncts that imply that denotes an equivalence relation;

• joining for every of arity the conjunct

 ∀x1,…,xn,y1,…,yn(R(x1,…,xn)∨¬R(y1,…,yn)∨⋁i≤n¬E(xi,yi))

(implementing indiscernibility of identicals for the relation ).

We claim that . To see this, let be a finite -structure. If satisfies , then every induced substructure of with the property that implies that at most one of and is an element of , satisfies , and hence is a substructure of . This in turn means that is in . The implications in this statement can be reversed which shows the claim.

Let be the formula obtained from by

• replacing each occurrence of by a new symbol ;

• joining for every of arity the conjunct

 ∀x1,…,xn(R(x1,…,xn)⇒R′(x1,…,xn)).

Let be the structure obtained from by renaming each relation to ; let be the signature of . By construction, the sentence obtained from by quantifying all relation symbols of is a monotone SNP -sentence.

To show that is an AMSNP sentence, first observe that the class of -reducts of the models of the first-order part of equals . The amalgamation property for follows from the amalgamation property of . To show that the class of finite models of the first-order part of has the amalgamation property, let and be two -structures from . Consider the amalgam of the -reducts of and and note that it can be expanded to a -structure such that both and embeds into it; this proves that is an amalgamation class.

We claim that a finite -structure satisfies if and only if . If then has a -expansion that satisfies . Let be the -reduct of . By the construction of this means that is in . But then , which implies for a -structure that also . Conversely, suppose that . Then a. Let be the -structure defined as in Claim 1 of the previous theorem. Let be the -structure that appears by adding a copy for each to . This structure satisfies and is therefore a witness for . ∎

## Appendix 0.C Deciding Amalgamation in the Binary Case

###### Theorem 0.C.1

Let be a finite binary relational signature, and let be a finite set of finite relational -structures. Then there is an algorithm that decides whether has the amalgamation property.

###### Proof

Let be the maximal size of a structure in , and let be the number of isomorphism types of two-element structures in . It is well-known and easy to prove that has the amalgamation property if and only if it has the so-called 1-point amalgamation property, i.e., the amalgamation property restricted to diagrams where . Suppose that is such an amalgamation diagram without amalgam. Let . Let and . Let be a -structure with domain such that and are substructures of . Since by assumption is not an amalgam for , there must exist such that the substructure of induced by embeds a structure from .

Note that the number of such -structures is bounded by since they only differ by the substructure induced by and . So let be a list of sets witnessing that all of these structures embed a structure from . Let be the substructure of induced by and be the substructure of induced by . Suppose for contradiction that has an amalgam ; we may assume that this amalgam is of size at most . Depending on the two-element structure induced by in , there exists an such that the structure induced by in embeds a structure from , a contradiction. ∎

## Appendix 0.D Proofs Related to the Dual Encoding Lemma

We prove that the structure satisfies the five items from the dual encoding lemma (Lemma 1).

1.: It is clear from the definition of that the signature of is finite if the signature of is finite.

2.: Suppose that is homogenous, and let be an isomorphism between finite substructures of . For any finite we write for the set of all coordinates of elements of . If , then we define ; since preserves the relations this gives a well-defined map . Note that .

Claim. The map is an isomorphism between finite substructures of . Indeed, if is such that , for some and some relation of , then and thus . We therefore have that which proves the claim.

By the homogeneity of there is an extension of to an automorphism of , and is an automorphism of which extends .

To prove the converse, suppose that is homogeneous, and let be an isomorphism between finite substructures of . Then defined by is an isomorphism between the substructure of induced by and the substructure of induced by , and hence can be extended to an automorphism of . Clearly, the map given by is a bijection and extends . To see that it is an automorphism of , suppose that . Pick so that . Hence, . Also note that

 B⊨E1,i((xi,…,xi),(x1,…,xd))

for every and hence . This implies that

 β∗(x1,…,xd) =(β∗(x1,…,x1)1,…,β∗(xd,…,xd)d) =(γ(x1),…,γ(xd))

and hence .

3.: Suppose that is finitely bounded with signature , i.e., for some finite set of finite -structures. For , note that does not embed into . Otherwise, suppose that is such an embedding. Then the map is an embedding of into : if for , let be the unary relation symbol introduced in for . Pick any and note that . Hence, . Also note that for every

 F[d]⊨E1,i((xi,…,xi),(x1,…,xd))

and hence . By the definition of , this implies that , and we conclude that

 (e(x1,…,x1)1,…,e(xk,…,xk)1)∈RC.

Let be the finite set of structures of the form for together with finitely many structures in the signature of (of size at most three) that ensure that for every structure

1. holds for all and ;

2. implies that for all and ;

3. and imply that for all and .

4. implies that .

In particular, every relation is an equivalence relation. We write for the equivalence class of with respect to . Note that every element of is uniquely determined by the equivalence classes of . Clearly, no structure in embeds into . We claim that every structure embeds into . Let be the following -structure. The elements of are the equivalence classes of all the equivalence relations in , for , but is identified with if holds in . We define if ; this is well-defined by the structures in introduced for item (d). Note that is an embedding from into .

The structure embeds into : suppose otherwise that there is an embedding from into . Then is an embedding from into , a contradiction. Hence, and it follows that , which concludes the proof of 4.

4.: We first show that every structure is a substructure of for some . We may assume that is a substructure of . Let be the (finite) substructure of induced by the set of all entries of tuples from . Then is a substructure of as required.

Conversely, it suffices to observe that if is an embedding then is an embedding of into . ∎

We finally show the claims from the proof of Theorem 5.1. Claim 1 states that is an amalgamation class if and only if is an amalgamation class.

If is an amalgamation class, then there exists a homogeneous countably infinite -structure whose age equals . By Lemma 1 (2) it follows that is homogeneous, too, and hence the age , which equals by Lemma 1 (4), is an amalgamation class.

Conversely, if is an amalgamation class then there exists a Fraïssé-limit . We claim that is of the form for some structure with age . To see this, note that the properties (a.-d.) from the proof of Lemma 1 hold in and hence every element of is uniquely determined by the equivalence classes with respect to the equivalence relations . The elements of are the equivalence classes of . For we write for the equivalence class of with respect to and define as the set of all tuples such that there exist such that . The structure is homogeneous by Lemma 1, and hence is an amalgamation class. We claim that . Suppose for contradiction that has a substructure isomorphic to a structure from . Then embeds into , a contradiction to the definition of . Conversely, if , then