A subset of NP is said to have a dichotomy if it contains problem that are either solvable in P-time or NP-complete. The class of finite Constraint Satisfaction Problems (CSP) is a well-known subset of NP that follows such a dichotomy. The complexity class NP does not have a dichotomy unless P = NP. For both of these classes there exist logics that are associated with them. • NP is captured by Existential Second-Order (ESO) logic by Fagin's theorem, i.e., a problem is in NP if and only if it is expressible by an ESO sentence. • CSP is a subset of Feder and Vardi's logic, Monotone Monadic Strict NP without inequalities (MMSNP), and for every MMSNP sentence there exists a P-time equivalent CSP problem.

This implies that ESO does not have a dichotomy as well as NP, and that MMSNP has a dichotomy as well as CSP. The main objective of this thesis is to study subsets of NP that strictly contain CSP or MMSNP with respect to the dichotomy existence.

Feder and Vardi proved that if we omit one of the three properties that define MMSNP, namely being monotone, monadic or omitting inequalities, then the resulting logic does not have a dichotomy. As their proofs remain sketchy at times, we revisit these results and provide detailed proofs.

Guarded Monotone Strict NP (GMSNP) is a known extension of MMSNP that is obtained by relaxing the monadic restriction of MMSNP. We define similarly a new logic that is called MMSNP with Guarded inequalities (GMMSNP ̸ = ), relaxing the restriction of being without inequalities. We prove that GMMSNP ̸ = is strictly more expressive than MMSNP and that it also has a dichotomy.

There is a logic MMSNP 2 that extends MMSNP in the same way as MSO 2 extends Monadic Second-Order (MSO) logic. It is known that MMSNP 2 is a fragment of GMSNP and that these two classes either both have a dichotomy or both have not. We revisit this result and strengthen it by proving that, with respect to having a dichotomy, without loss of generality, one can consider only MMSNP 2 problems over one-element signatures, instead of GMSNP problems over arbitrary finite signatures.

We seek to prove the existence of a dichotomy for MMSNP 2 by finding, for every MMSNP 2 problem, a P-time equivalent MMSNP problem. We face some obstacles to build such an equivalence. However, if we allow MMSNP sentences to consist of countably many negated conjuncts, then we prove that such an equivalence exists. Moreover, the corresponding infinite MMSNP sentence has a property of being regular. This regular property means that, in some sense, this sentence is still finite. It is known that regular MMSNP problems can be expressed by CSP on ω-categorical templates. Also, there is an algebraic dichotomy characterisation for ω-categorical CSPs that describe MMSNP

problems. If one manages to extend this algebraic characterisation onto regular MMSNP, then our result would provide an algebraic dichotomy for MMSNP 2 .

Another potential way to prove the existence of a dichotomy for MMSNP 2 is to mimic the proof of Feder and Vardi for MMSNP. That is, by finding a P-time equivalent CSP problem. The most difficult part there is to reduce a given input structure to a structure of sufficiently large girth. For MMSNP and CSP, it is done using expanders, i.e., structures, where the distribution of tuples is close to a uniform distribution. We study this approach with respect to MMSNP 2 and point out the main obstacles.

We also consider an extension of CSP: the Matrix Partition (MP) problems class. We study it from several perspectives. It is well-known that CSP over an arbitrary finite signature has a dichotomy if and only if CSP on directed graphs has a dichotomy. Motivated by this result, we consider MP problems over arbitrary finite signatures and show that they have a dichotomy if and only if MP problems over one-element signatures have a dichotomy, similarly to our result for MMSNP 2 . Another perspective is to characterise MP problems with respect to being definable in First-Order (FO) logic. For CSP, a problem is FO-definable if and only if it has a finitary duality, i.e., a finite family of digraphs such that an input digraph is accepted by the CSP if and only if no digraph from the family is homomorphically mapped to the input one. There have already been some attempts to classify Matrix Partition problems in terms of having finitely many minimal obstructions, i.e., an input graph is accepted by the MP problem if and only if it does not contain an induced subgraph from a given finite family. We manage to show that, for MP problems, these two notions are the same. The third perspective is to find a logic that would be related to MP in a similar way as MMSNP is related to CSP. We introduce, as a potential candidate, a logic obtained from MMSNP by relaxing the monotone restriction, and show that it contains MP. However, it is not known how to show the equivalence. At last, we study the notion of polymorphism for MP problems. We do it in order to consider the algebraic dichotomy characterisation for finite CSP and see if there is some potential to consider polymorphisms for MP problems. In the case of CSP, a structure has a non-trivial polymorphism if and only if the corresponding CSP is P-time solvable. We manage to provide an MP problem that has only trivial polymorphisms and that is P-time solvable. This means that, for MP problems, the existence of an algebraic characterisation is unlikely.

In an independent chapter, we investigate the Maximum Cut (MaxCut) problem. Although being NP-complete in general, its complexity becomes unknown if we consider only unit interval graphs in the input. Knowing that MaxCut is NP-complete on interval graphs, we approach as close as possible to unit interval graphs by proving that it remains NP-complete even if we are allowed to operate with intervals of only two different lengths.

Dedication

To my parents Igor and Galina for their constant support. 5

Acknowledgement

My PhD part of life would not be so good and this thesis probably would not exist if I worked on it all alone. This section is devoted to all people and places that had a positive impact on my life and helped me to write a better thesis.

First of all, I want to thank my advisors Florent and Mamadou, you spent a lot of time teaching me, explaining new concepts that I did not know, patiently listening to my ideas and criticizing them, encouraging me to read important papers that I was too lazy to find by myself. Your guidance was crucial. Right after, I want to thank Lhouari who introduced me to Florent and Mamadou, without you there would never be a timeline where I do research on extensions of MMSNP and CSP.

I want to thank the members of my jury: Aline, Arnaud, Nadia, Víctor and Yann. I appreciate that you read my thesis and left valuable comments that led to improvements.

It is very difficult to have the thesis finished if you have bad work ethic. In the beginning of my PhD I was working together with Oscar and Simon. Your diligence influenced me to become more hardworking and disciplined. It is also very difficult to write a thesis if writing a thesis is the only thing in your life. I was glad to play table tennis and to hang out together with you guys: Aurelien, Caroline, Élodie, Hieu, Loan, Malek, Mari, and Trang -thank you! I did my thesis abroad, I spoke almost no French when I started my PhD. Therefore, I had literally no idea how to complete different obligatory administrative procedures within the university and everywhere else in France. I want to thank Béa and Séverine who helped me to resolve many questions of French bureaucracy.

I want to thank everyone with whom I used to go to lunch in Clermont: Aurelie, Alexandre, Bruno, Florent F., Jean-Florent, Jean-Philippe, Lucas, Olivier, Vincent, Yannick, and Yves-Jean; and in Fontainebleau: Denis, Frédéric, Gaëlle, Luc, Marie-Hélène, Oleg, Patricia, Régis, and Régine. Every morning I was looking forward to meet you at lunch, enjoy food, and practice my French. I would not learn it without your help.

Finally, I want to thank the nature of both places where I worked on my thesis: Clermont-Ferrand and Fontainebleau. Spending much time on weekends in the mountains or in the forest helped me to recover from stress and fatigue gained during working days.

Bibliography

Glossary

Complexity

We try to use the same definitions as in Papadimitriou's book [START_REF] Papadimitriou | Computational complexity[END_REF].

A Turing machine is a quadruple M = (Q, Σ, δ, q 0 ). Here Q is a finite set of states; q 0 ∈ Q is the initial state. Σ is a finite set of symbols (we say that Σ is the alphabet of M ). Σ always contains the special symbols ⊔ and ▷: the blank and the first symbol. Finally, δ is a transition function which maps Q × Σ to Q ∪ {"yes", "no"} × Σ × { , }.

For an alphabet Σ, a string of symbols of Σ is a finite sequence s 1 s 2 . . . s r , for some r in N. The set of all strings of symbols of Σ is denoted by Σ * .

The input of a Turing machine is a one-way infinite tape with a head that can move freely across the tape. A tape is a sequence of cells, each cell contains one symbol of the alphabet Σ. The first cell of the tape always contains a special symbol ▷ that represents the left end of the tape. We assume that there exists N in N such that, for all n > N , the nth cell contains ⊔, and, for all i such that 1 < i ≤ N , the ith cell contains a symbol from Σ ∖ {▷, ⊔}. That is, there is a one-to-one correspondence between one-way infinite tapes and finite strings in Σ ∖ {▷, ⊔} * . The head is always in some state of Q, it can move across the tape, and overwrite the symbol of a cell where it is at the moment. At the beginning, the head is at the first cell of the tape, at the cell with ▷, and it is in the starting state q 0 ∈ Q. The execution of a Turing machine is a sequence of iterations. In this thesis, we always suppose that this sequence is finite. Each iteration is described as follows.

1. The head having a state q in Q finds itself in some cell of the tape.

2. The head reads the symbol s in Σ of that cell.

3. The transition function δ(q, s) commands the head what it should do. Suppose δ(q, s) = (q ′ , s ′ , D), where q ′ is in Q ∪ {"yes", "no"}, s ′ is in Σ, and D is in { , }; then the head changes its state to q ′ , overwrites s with s ′ , and, depending on D, either moves one cell to the left or one cell to the right.

The head cannot move to the left from the first cell. So we assume that, for any transition rule δ(q, ▷) = (q ′ , s ′ , D), we have s ′ = ▷ and D = . Also we assume that the first cell is always a unique cell that contains ▷. So, for any rule δ(q, s) = (q ′ , s ′ , D), where s ̸ = ▷, we have s ′ ̸ = ▷.

Once the head is in a state from {"yes", "no"} the machine halts. If the state of M is "yes", then we say that M accepts the input, if it is "no", then M rejects the input.

Let M be a Turing machine, and x in Σ * be a string of symbols. If M reaches one of the states of {"yes", "no"} in t iterations, then we say that the time required by M on input x is t.

Let f : N N. We say that a Turing machine M operates within time f(n) if, for any input string x, the time required by M on x is at most f(|x|) (by |x| we denote the length of string x).

Let M be a Turing machine, and x in Σ * be its input. By M (x) we denote the output of the machine. That is a string of (Σ ∪ {⊔}) * that is associated with the configuration of the tape at the end of the execution of M .

Let L ⊂ (Σ ∖ {⊔}) * be a language. Let M be a Turing machine such that, for any string x in (Σ ∖ {⊔}) * , if x is in L, then M accepts x, and, if x is not in L, then M rejects x. Then we say that M decides L.

Let O(n k ) be a set of functions from N to N that satisfies the following property. For any function f in O(n k ) there exist positive integers c and n 0 such that, for any n ≥ n 0 , f(n) ≤ cn k .

We say that M operates within polynomial time if it operates within time f(n), and if there is

k in N such that f(n) is in O(n k ).
A nondeterministic Turing machine is a quadruple N = (Q, Σ, ∆, q 0 ). Q, Σ, and q 0 are as before. But now ∆ is a relation: ∆ ⊂ (Q × Σ) × Q ∪ {"yes", "no"} × Σ × { , } . For a nondeterministic Turing machine, its execution is not uniquely determined by the input. Suppose that before some iteration the head is in some state q in Q and is at some cell that contains a symbol s in (Σ ∪ {⊔}). Then N chooses an element from ∆(q, s) and the head acts depending on the choice.

For a nondeterministic machine N and some string x in Σ, N accepts x if there is an execution of N such that N halts in the "yes" state. Otherwise, N rejects x. We say that a nondeterministic Turing machine N decides a language L if, for any x in Σ * , the following is true: x is in L if and only if N accepts x. We say that N decides L in time f(n), where f : N N, if N decides L, and, for any x in Σ * , any execution of N with input x has at most f(|x|) iterations.

Denote by P the set of all the languages L that can be decided by a Turing machine operating within polynomial time. And denote by NP the set of all the languages L that can be decided by a nondeterministic Turing machine operating within polynomial time.

Let f : (Σ ∖ {⊔}) * Σ * . We say that a Turing machine M computes f if, for any x in (Σ ∖ {⊔}) * , M (x) = f(x). If M operates within polynomial time, then we write that M computes f in polynomial time.

Let L 1 , L 2 be languages over an alphabet Σ. We say that L 1 reduces in polynomial time to L 2 , denoted by L 1 ≤ p L 2 , if there is a function f : (Σ ∖ {⊔}) * Σ * and a Turing machine M such that f is computable by M in polynomial time, and that x is in L 1 if and only if f(x) is in L 2 . This is also called Karp reduction.

We say that L 1 and L 2 are polynomial time equivalent, denoted by

L 1 ≡ p L 2 , if L 1 ≤ p L 2 and L 2 ≤ p L 1 .
Denote by NP-complete the set of all the languages L such that, for any L ′ in NP, we have L ′ ≤ p L.

Suppose that P ̸ = NP. Denote by NP-intermediate the set of all languages L such that L is in NP, L is not in P, and L is not NP-complete.

For C ⊆ NP, we say that C has a dichotomy if C ∩ NP-intermediate = ∅.

Let C 1 , C 2 in NP be two sets of languages. We say that C 1 is contained in C 2 under polynomial time reductions, denoted by C 1 ⊆ p C 2 , if for every L 1 in C 1 there exists L 2 in C 2 such that L 1 ≡ p L 2 . If C 1 ⊆ p C 2 and C 2 ⊆ p C 1 , then we say that C 1 is equivalent to C 2 under polynomial time reductions, denoted by C 1 ≡ p C 2 . Clearly, if C 1 ⊆ p C 2 , then if C 2 has a dichotomy, so does C 1 . And, if C 1 ≡ p C 2 , then C 1 has a dichotomy if and only if C 2 has a dichotomy.

Structures and homomorphisms

We try to use the same definitions as in the book of Hell and Nešetřil [START_REF] Hell | Graphs and homomorphisms, volume 28 of Oxford lecture series in mathematics and its applications[END_REF] and as in Bodirsky's book [START_REF] Bodirsky | Complexity of Infinite-Domain Constraint Satisfaction[END_REF].

Let A, B be two sets. The product of sets A and B, denoted by A × B, is the set of pairs: {(a, b) | a ∈ A, b ∈ B}. For a set A and k in N, the k-ary product of A, denoted by A k , is the following set of k-tuples: {(a 1 , . . . , a k ) | a 1 , . . . , a k ∈ A}.

A relational signature τ is a set of relation symbols R each of which has an associated finite arity k in N. A relational structure A over a signature τ (also called τ -structure) consists of a set A (the domain) together with a relation R A ⊆ A k for each relation symbol R in τ , where k is the associated arity. For any k-tuple a in A k , if a is in R A , then we usually write R A (a). We consider only finite relational signatures; and relational structures with at most countable domains.

A homomorphism between τ -structures A and B with domains A and B is a mapping h : A B that preserves the relations; that is, for any R in τ of some arity k and any (a 1 , . . . , a k ) in A k , R A (a 1 , . . . , a k ) implies R B h(a 1 ), . . . , h(a k ) . If h is a homomorphism between A and B, then it is denoted by h : A B. For a tuple a = (a 1 , . . . , a k ) in A k and a homomorphism h : A B, we denote h(a) := h(a 1 ), . . . , h(a k ) . For τ -structures A, B, if there exist homomorphisms h 1 : A B and h 2 : B A, then A and B are called homomorphically equivalent, it is denoted by A ⇆ B. A homomorphism h : A B is called surjective if the mapping h : A B is surjective. An injective homomorphism is defined similarly.

A homomorphism f : A B is called full if, for any R in τ of arity k and any a in A k , R B f(a) implies R A (a). A full homomorphism i : A B is called an isomorphism between A and B if i : A B is one-to-one. If there exists an isomorphism i : A B, then the two structures are said to be isomorphic, we denote it by A ∼ = B. An isomorphism a : A A from a structure to itself is called an automorphism. Let A be a τ -structure for some relational signature τ . Let B ⊆ A. A τ -structure B with domain B is called a substructure of A if, for any R in τ , R B ⊆ R A . And B is called an induced substructure of A if, for any R in τ of arity k, R B = B k ∩ R A . Equivalently, we can say that B is the substructure of A induced on B and write A [B]. When B is an induced substructure of A, we also say that B embeds into A and denote it as follows: B A. Let h : A B be a mapping between two sets. The set h(A) := {b ∈ B | ∃a ∈ A : h(a) = b} is called the image of h. A homomorphism e : A B is called an embedding if A ∼ = B[e(A)], it is denoted by e : A B. Let A, B be τ -structures with domains A and B correspondingly. The union of two τ -structures A and B, denoted by A ∪ B, is a τ -structure with domain A ∪ B and, for any R in τ of arity k, R A∪B = R A ∪ R B . The intersection of τ -structures A and B, denoted by A ∩ B, is defined similarly. A disjoint union of A and B, denoted by A ⊎ B, is the union of two isomorphic copies of A and B with disjoint domains. As disjoint unions are unique up to isomorphism, we usually speak of the disjoint union of A and B. If a structure is not isomorphic to the disjoint union of structures, then it is called connected.

For two k-tuples a = (a 1 , . . . , a k ) in A k , b = (b 1 , . . . , b k ) in B k , denote a × b := (a 1 , b 1 ), . . . , (a k , b k ) . For τ -structures A and B, the product of A and B, denoted by A × B, is a τ -structure with domain A × B and, for any k-ary R in τ and, for any a in A k ,b in B k , if R A (a) and R B (b), then R A×B (a × b).

A binary relation e(•, •) is called an equivalence relation on a set A if it is reflexive, symmetric and transitive.

Let ∼ be an equivalence relation on a set A. For some a in A, a set [a] ∼ = {x ∈ A | a ∼ x} is called the ∼-equivalence class of a. For any equivalence relation, its equivalence classes make a partition of A. The set of all the ∼-equivalence classes of elements of A is denoted by A/ ∼.

For a relational structure A and an equivalence relation ∼ defined on this structure, the quotient A/ ∼ is also a relational structure with domain A/ ∼, and, for some relation R, a k-tuple a = ([a 1 ] ∼ , . . . , [a k ] ∼ ) belongs to R A/∼ of A/ ∼ if there exists a tuple a ′ = (a ′ 1 , . . . , a ′ k ) such that, for all i in [k], a ′ i is in the equivalence class [a i ] ∼ , and a ′ belongs to R A . There is always a surjective homomorphism π : A A/ ∼ such that π(a) = [a] ∼ . For a k-tuple a = (a 1 , . . . , a k ) in A k , denote [a] ∼ := ([a 1 ] ∼ , . . . , [a k ] ∼ ).

Let τ and σ be two relational signatures. For a τ ⊎ σ-structure A and a τ -structure A τ , we say that A τ is the τ -reduct of A if the structures have the same domain A and, for any R in τ , R A = R A τ . In this case, A is called a σ-expansion of A τ . Observe that there is a unique reduct but there may be many expansions.

A relational structure G = (G, E G ), where E has arity 2, is called a directed graph. Elements of G are called vertices, tuples of E G are called arcs.

Two distinct vertices v, w in G are called adjacent if (v, w) is in E G or (w, v) is in E G . A sequence of vertices v 1 , . . . , v n of G is called an walk, if, for any i in [n-1], v is adjacent to v i+1 . A path is a walk v 1 , . . . , v n such that all its vertices are pairwise distinct. A cycle is a path v 1 , . . . , v n such that v 1 is adjacent to v n . The length of a walk is the number of vertices in the sequence. A digraph is called a tree if it contains no cycle.

For a walk v 1 , . . . , v n , an arc E G (v i , v i+1 ) is called a forward arc, and an arc E G (v i+1 , v i ) is called a backward arc. The net length of a walk is the difference between the number of forward arcs and the number of backward arcs. A walk/path/cycle is called directed if all its arcs are forward. If a digraph contains no directed cycle, then it is called acyclic.

For a directed graph G, the girth of G is the shortest length of a cycle of G.

For a vertex v in G, the degree of v is the number of vertices w in G such that v is adjacent to w. The in-degree of v is the number of vertices w in G such that (w, v) is in E G . The definition of the out-degree is similar.

Let A be a relational τ -structure. Two elements a 1 , a 2 of A are called adjacent if there is a tuple a in R A , for some R in τ , such that both a 1 , a 2 are contained in a. The definitions of a walk, path, cycle, and degree are similar.

We use the same definitions for the notions of the category theory as in the book of Awodey, see [START_REF] Awodey | Category Theory[END_REF]. For a relational signature τ , the τ -structures together form a category, where the objects are τ -structures themselves and the arrows are homomorphisms between the corresponding τ -structures. The category of τ -structures is denoted by Struct [τ ].

Any relational structure can be encoded by a string consisting of 0 and 1. Such string is an input instance of a Turing machine. We explain how the encoding is described in [START_REF] Libkin | Elements of Finite Model Theory[END_REF]. Consider an n-element relational τ -structure A, where τ = {R 1 , . . . , R t }. Suppose that its elements are linearly ordered: a 1 < a 2 < • • • < a n . It induces lexico-graphical orderings of k-tuples consisting of these elements, for any k in N, (a 1 , . . . , a 1 ) < (a 1 , . . . , a 1 , a 2 ) < • • • < (a n , . . . , a n ). For R of arity k in τ , the relation R A can be encoded by a n k -bit string enc R A : the ith element of enc R A equals 1 if and only if the ith tuple in the lexicographical ordering belongs to R A . The whole structure A can be encoded by the following string:

enc(A) := 0 n 1 • enc R A 1 • • • • • enc R A t ,
where 0 n means the string of length n consisting only of 0s, and the sign • means the concatenation of strings.

Remark. Further in this thesis, when we show a reduction from one problem to another, we neither consider the problems as languages of strings nor explicitly describe the Turing machine that computes the function between the languages. Usually, input instances of a problem are relational structures. The reduction is shown by describing an algorithm that takes an input structure A 1 of the first problem P 1 and returns an input structure A 2 of the second problem P 2 such that A 1 is accepted by P 1 if and only if A 2 is accepted by P 2 . And, moreover, the runtime of the algorithm must be polynomial in size of A 1 .

Logic

We try to use the same definitions as in Libkin's book [START_REF] Libkin | Elements of Finite Model Theory[END_REF].

Let τ be a relational signature. We assume a countably infinite set of (first-order) variables that range over the domains of τ -structures. We inductively define first-order formulae over τ as follows.

• If x 1 , x 2 are variables, then x 1 = x 2 is an (atomic) formula.

• If x 1 , . . . , x k are variables and R in τ is a k-ary relation symbol, then R(x 1 , . . . , x k ) is an (atomic) formula.

• If ϕ 1 , ϕ 2 are formulae, then ϕ 1 ∧ ϕ 2 , ϕ 1 ∨ ϕ 2 , and ¬ϕ 1 are formulae.

• If ϕ is a formula, then ∀x ϕ and ∃x ϕ are formulae.

The set of all first-order formulae is denoted by FO and is called first-order logic. We do not consider signatures with constants and function symbols, so we do not need to mention them in the definition of FO. For a formula ϕ in FO, denote by Var(ϕ) its set of variables.

For a relation symbol R in τ , an atomic formula of the form R(x 1 , . . . , x k ) is called an R-atom or a τ -atom.

A formula that does not use existential (∃) and universal (∀) quantifiers is called quantifier-free. It is called universal if all the quantifiers are universal. It is called existential if all the quantifiers are existential.

A τ -formula ϕ(x 1 , . . . , x n ) is called primitive positive if it is of the form:

∃x n+1 , . . . , x l (ψ 1 ∧ • • • ∧ ψ m ),
where ψ 1 , . . . , ψ m are τ -atoms. We use the standard shorthand ϕ ψ for ¬ϕ ∨ ψ and ϕ ↔ ψ for (ϕ ψ) ∧ (ψ ϕ).

Suppose that a formula ϕ contains a variable x. If x is not quantified neither existentially nor universally, then the variable x is called free; otherwise it is called bound. If x is a tuple of all the free variables of ϕ, then we write ϕ(x).

If a formula ϕ contains no free variables, then ϕ is called a sentence. If we want to precise that it is over a signature τ , then we usually call it a τ -sentence.

Given a τ -structure A, we define inductively, for each first-order formula ϕ with its tuple a of free variables, the notion A |= ϕ(a) (i.e. ϕ(a) is true in A). That is, we define the semantics of the first-order logic.

• If ϕ is of the form (x 1 = x 2 ), then, for a = (a 1 , a 2 ), A |= ϕ(a 1 , a 2 ) if and only if a 1 = a 2 .

• If ϕ is of the form R(x 1 , . . . , x k ), for some k-ary R in τ , then A |= ϕ(a) if and only if a is in R A .

• A |= ¬ϕ(a) if and only if A |= ϕ(a) is false.

• A |= ϕ 1 (a 1 ) ∧ ϕ 2 (a 2 ) if and only if A |= ϕ 1 (a 1 ) and A |= ϕ 2 (a 2 ).

• A |= ϕ 1 (a 1 ) ∨ ϕ 2 (a 2 ) if and only if A |= ϕ 1 (a 1 ) or A |= ϕ 2 (a 2 ).

• If ψ(x) is of the form ∃yϕ(y, x), then A |= ψ(a) if and only if A |= ϕ(a ′ , a) for some a ′ in A.

• If ψ(x) is of the form ∀yϕ(y, x), then A |= ψ(a) if and only if A |= ϕ(a ′ , a) for all a ′ in A.

A set of first-order τ -sentences is called a first-order theory. For some first-order theory T , a τ -structure A is called a model of T , if any ϕ of T is true in A. For a τ -structure A, the first-order theory of A is the set of all first-order sentences ϕ such that ϕ is true in A, it is denoted by Th(A).

Assume, apart from first-order variables, that for any k in N there is a countably infinite set of second-order variables X k 1 , X k 2 , . . . ranging over k-ary relations. The secondorder logic, denoted by SO, is the set of all second-order formulae ϕ(x, X); each such formula contains both first and second order variables and is inductively defined as follows.

• Any atomic FO formula is an atomic SO formula; also, for variables x 1 , . . . , x k and for a k-ary SO variable X, X(x 1 , . . . , x k ) is an atomic SO formula.

• If ϕ 1 , ϕ 2 are in SO, then ϕ 1 ∧ ϕ 2 , ϕ 1 ∨ ϕ 2 , ¬ϕ 1 , ∃x ϕ 1 , ∀x ϕ 1 are in SO.

• If ϕ(x, Y, X) is in SO, then ∃Y ϕ(x, X) and ∀Y ϕ(x, X) are in SO.

The semantics of the second-order logic extend the semantics of FO as follows.

• Suppose ϕ(x, X) is of the form X(x 1 , . . . , x k ); then A |= ϕ(b, B) if and only if b is in B, where B is some subset of A k .

• Suppose ψ(x, X) is of the form ∃Y ϕ(x, Y, X), where Y is a second-order variable with arity k in N; then A |= ψ(b, B) if and only if there is C ⊆ A k such that A |= ϕ(b, C, B).

• Suppose ψ(x, X) is of the form ∀Y ϕ(x, Y, X), where Y is a second-order variable with arity k in N; then A |= ψ(b, B) if and only if for any subset C ⊆ A k , we have A |= ϕ(b, C, B).

Let L be a logic, i.e., a set of formulae. Let S be a set of τ -structures. We say that S is definable in L (or, L-definable), if there is a sentence ϕ in L such that, for any τ -structure A, A |= ϕ if and only if A is in S.

For a τ -structure A, we say that a k-ary relation R ⊆ A k is definable by a formula ϕ(x 1 , . . . , x k ) if, for every k-tuple (a 1 , . . . , a k ) in A k , we have (a 1 , . . . , a k ) ∈ R if and only if A |= ϕ(a 1 , . . . , a k ). In particular, if ϕ is primitive positive, then we say that R has a primitive positive definition in A, or just R is pp-definable in A.

Let ϕ be a conjunction of non-negated atomic formulae over some relational signature τ . Let A be a τ -structure. Suppose that there is a one-to-one correspondence f between variables x 1 , . . . , x n of ϕ and the vertices a 1 , . . . , a n of A. Also suppose that, for any R in τ , ϕ contains an atom R(x) if and only if the tuple f(x) belongs to the relation R A . In this case, ϕ is called the canonical conjunctive query of A, and A is called the canonical database of ϕ. P vs NP is one of the most famous open computer science problems. Despite failing to solve it, researchers pose new questions assuming that there is an answer to P vs NP conjecture. In particular, Ladner shows in [START_REF] Ladner | On the structure of polynomial time reducibility[END_REF] that the class of NP-intermediate problems is not empty under the assumption that P ̸ = NP, see Figure 1.1 for an illustration.

Theorem 1.1.1 ( [START_REF] Ladner | On the structure of polynomial time reducibility[END_REF]). Suppose that P ̸ = NP. Then there is a problem L in NP that is neither solvable in polynomial time, nor NP-complete.

Constraint Satisfaction

The Constraint Satisfaction Problem enjoys many definitions. A simple one is as follows. Let B be a finite relational structure. The problem CSP(B) accepts every finite relational structure A that homomorphically maps to B. The class CSP is the set of all such problems CSP(B), for any B.

The complexity of this NP problem that generalises both SAT and 3-Colorability is then classified when parametrised by the target of the homomorphism -the so called template of the problem -which is fixed and not part of the input.

Feder and Vardi conjectured a dichotomy for this class in [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF] in particular because of the following noted results in the boolean case and in the case of undirected graphs.

Theorem 1.1.2 (Schaefer, [START_REF] Thomas | The complexity of satisfiability problems[END_REF]). Let B be a relational structure with a two-element domain. Then either ({0, 1}; NAE) has a primitive positive definition in B, and CSP(B) is NP-complete, or 1. B is preserved by a constant operation.

2. B is preserved by min. In this case, every relation of B has a definition by a propositional Horn formula.

3. B is preserved by max. In this case, every relation of B has a definition by a dual-Horn formula, that is, by a propositional formula in CNF where every clause contains at most one negative literal.

4. B is preserved by the majority operation. In this case, every relation of B can be defined by 2-CNF.

5. B is preserved by the minority operation. In this case, every relation of B can be defined by a conjunction of linear equations modulo 2.

In each of these five cases, CSP(B) can be solved in P-time.

Theorem 1.1.3 (Hell, Nešetřil, [START_REF] Hell | On the complexity of H -coloring[END_REF]). If an undirected graph H is bipartite, then CSP(H) is P-time solvable. Otherwise CSP(H) is NP-complete.

This conjecture was attacked on several fronts. One direction of research involved the study of special case of digraphs as it was shown that proving the conjecture for digraphs was sufficient.

Theorem 1.1.4 ( [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF]). For a finite relational structure B there exists a balanced directed graph H such that CSP(B) is P-time equivalent to CSP(H).

The approach that proved the most fruitful involved algebra, pushing further the methods initially used by Shaefer : progress was made in the nineties by Cohen, Jeavons and their co-authors. An important milestone was the two dichotomy theorems of Bulatov at the turn of the century, in the three element case and in the conservative case [START_REF] Bulatov | Tractable conservative constraint satisfaction problems[END_REF][START_REF] Bulatov | Classifying the complexity of constraints using finite algebras[END_REF][START_REF] Bulatov | A dichotomy theorem for constraint satisfaction problems on a 3-element set[END_REF], pushing the methodology further into algebra, using Congruence Tame Theory.

Finally, the dichotomy conjecture on finite relational structures was proved independently by Bulatov in [START_REF] Bulatov | A dichotomy theorem for nonuniform csps[END_REF] and Zhuk in [START_REF] Zhuk | A proof of the CSP dichotomy conjecture[END_REF]. The tractability condition is described by an existence of symmetries within the structure. The symmetries are described by polymorphisms. Below we provide an equivalent formulation of the theorem that uses the notion of Siggers polymorphism, as we also use it in this thesis. The absence of a Siggers polymorphism was already known to imply NP-completeness, and it remained to provide a classification in the presence of a Siggers polymorphism. This was done by providing tractable algorithms in all such remaining cases.

Theorem 1.1.5 (Bulatov, Zhuk). For every finite relational structure A, if A admits a Siggers polymorphism, then CSP(A) is P-time solvable. Otherwise it is NP-complete.

Meanwhile researchers investigated many variations of CSP : quantified and in Pspace with QCSP [START_REF] Martin | Quantified constraints in twenty seventeen[END_REF], with an aspect of optimization with VCSP [START_REF] Krokhin | The complexity of valued csps[END_REF] or more recently approximation with the promise CSP (PCSP) [START_REF] Barto | Algebraic approach to promise constraint satisfaction[END_REF]. An extension of the CSP that shall concern us in this thesis is championed by Bodirsky and involves CSP on infinite domains, most often on languages that can be described by an omega-categorical template. The problem definition is the same as in the finite case, but with an infinite domain structure. Such well known structures in model theory are sufficiently similar to finite structures that some of the algebraic approach can be adapted and extended and allows to prove many dichotomies on natural classes of problems that could not be captured in the finite setting and were already studied in the literature.

The field of infinite CSP is now quite mature, see [START_REF] Bodirsky | Complexity of Infinite-Domain Constraint Satisfaction[END_REF]. There is an analogue of the Feder and Vardi's conjecture. Here, P denotes the clone of projections:

P := {π n i : X n X | i, n ∈ N, i < n, ∀x 1 , . . . , x n π n i (x 1 , . . . , x n ) = x i }.
Conjecture 1.1.6. [BKO + 17,BMM18] Let B be a first-order reduct of a finitely bounded homogeneous structure with finite relational signature. If there is no uniformly continuous minor-preserving map from Pol(B) to P, then CSP(B) is in P. If there is such a mapping, then it is NP-complete.

Descriptive complexity

Descriptive complexity relates (finite) model theory with complexity theory by showing a correspondence between the amount of logic one needs to describe a problem with the amount of computation problem necessary to solve it. This area goes back to the following theorem.

Theorem 1.1.7 ( [START_REF] Fagin | Generalized first-order spectra, and polynomial-time recognizable sets[END_REF]). For every ESO sentence Φ, the problem SAT(Φ) is in NP.

For every property P defined on the set of finite structures and decidable in P-time, there is a sentence Φ P in ESO such that, for any finite structure A, we have A |= Φ P if and only if A has the property P.

Feder and Vardi in [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF] introduced the logic MMSNP as a candidate to express CSP. This logic is a fragment of SNP ⊂ ESO, which is defined by three conditions: monotone, monadic and without inequalities.

They showed that if MMSNP loses one of them, then it becomes P-time equivalent to NP, and, thus, it has no dichotomy, by Ladner's theorem. We revisit these three classes in Chapter 2.

On the other hand, they showed that MMSNP ≡ p CSP, which, as they conjectured, should have a dichotomy. Their approach used randomised reductions, that is, the reduction is polynomial but probabilistic. Nonetheless, Kun in [START_REF] Kun | Constraints, MMSNP and expander relational structures[END_REF] provided an explicit P-time equivalence between MMSNP and CSP by determinising this randomised reduction.

THe problems described by sentences of MMSNP may not be in CSP, Madelaine et al. showed in [START_REF] Florent | Constraint satisfaction, logic and forbidden patterns[END_REF] that the question of being in CSP is decidable for MMSNP problems. However, they are always P-time equivalent to infinite CSP with an ω-categorical template, see [START_REF] Bodirsky | Datalog and constraint satisfaction with infinite templates[END_REF]. After the algebraic characterisation of CSP given by Bulatov and Zhuk, a similar question was answered for a fragment of CSP on ω-categorical structures which is definable by MMSNP sentences. Bodirsky, Madelaine and Mottet in [START_REF] Bodirsky | A universal-algebraic proof of the complexity dichotomy for monotone monadic SNP[END_REF] proved the following result.

Theorem 1.1.8 ( [START_REF] Bodirsky | A universal-algebraic proof of the complexity dichotomy for monotone monadic SNP[END_REF]). Let B be an ω-categorical structure such that CSP(B) is described by an MMSNP sentence. Then exactly one of the following holds:

• There is a uniformly continuous minor-preserving map from Pol(B) to the clone of projections on a 2-element set, and CSP(B) is NP-complete, or

• there is no such map and CSP(B) is in P.

The whole picture

The purpose of this thesis is to investigate classes of problems and fragments of logics that are between the three known non dichotomic logics and above the known logic or classes of problems known to have a dichotomy (CSP, MMSNP) (see Figure 1.2 for an illustration).

The various classes of interest investigated in this thesis are introduced in more details in the next section. MP is a family of combinatorial problems. MMSNP 2 and GMSNP are logics. The main objective is to expand known classes that admit a dichotomy. For some classes like MMSNP 2 that is an example of an infinite CSP à la Bodirsky, we hope to obtain an algebraic dichotomy in the spirit of Theorem 1.1.8.

Motivation

Investigate MMSNP extensions

Guarded fragments

There are natural ways when can think of to create a logic that lies above MMSNP and below the three fragments that are provably non dichotomic, and drop a restriction on MMSNP, namely to relax this restriction: one canonical example is MMSNP 2 which relaxes the requirement that the logic is not necessarily monadic as in MMSNP, yet does not allow proper binary quantification as in MonotoneSNP, and only allows for colouring tuples of input relations. This is similar in spirit to MSO 2 and MSO 1 considered by Courcelle in [START_REF] Courcelle | Graph Structure and Monadic Second-Order Logic -A Language-Theoretic Approach[END_REF].

MMSNP 2 is subsumed by GMSNP, the guarded fragment of MonotoneSNP, yet they are in fact equally expressive as any sentence of the latter is logically equivalent to a sentence of the former.

Looking at Figure 1.2 on page 24 may give reader a feeling that, similarly to GMSNP being a guarded fragment of MonotoneSNP, there might be fragments of MonadicSNP and of MMSNP with inequalities that are also "guarded" in some sense.

We investigate in Section 3.1 a logic GMMSNP ̸ = that extends MMSNP by allowing inequalities within negated conjuncts. But, for each inequality x ̸ = y there must be a τ -atom R(z) within the same conjunct such that both x and y are contained in z. We say, in this case, that R(z) guards x ̸ = y. We manage to show that GMMSNP ̸ = ≡ p MMSNP and thus it has a dichotomy.

It is not quite clear what it could mean to weaken MonadicSNP (the extension of MMSNP that allows negation) by guarding negation. We study this case in Section 6.5, where we attempt to find a logic that is equivalent to the class of Matrix Partition problems, an extension of CSP that is not monotone to be introduced shortly. This logic is still monadic, it does not have inequalities, but violates the property of being monotone, that is, input atoms may be both negated and non-negated. But we restrict it to be such that, within each negated conjunct, all the input atoms have the same polarity: either all negated or all non-negated. The question of having a dichotomy for this logic is still open.

Edge colouring

It is known, see [START_REF] Bienvenu | Ontology-based data access: A study through disjunctive datalog, csp, and MMSNP[END_REF], that the guarded fragment GMSNP of MonotoneSNP is strictly more expressible than MMSNP, so showing a dichotomy (or its absence) would be an important result. We study this logic in Section 3.2.

Feder and Vardi showed in [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF] that the signature of a CSP problem can be simplified up to digraph homomorphisms. We ask a similar question several times in this thesis: for the logic GMSNP in Section 3.2.1 and for generalisations of Matrix partitions in Section 6.3.2. Both times we manage to show that problems over an arbitrary finite signature are P-time equivalent to problems over a signature consisting of a unique relation symbol. However, it is not known in any of these two cases, if we can reduce the arity of this symbol up to 2 as Feder and Vardi did for CSP. Bienvenu et al. showed in [START_REF] Bienvenu | Ontology-based data access: A study through disjunctive datalog, csp, and MMSNP[END_REF] that their logic GMSNP is P-time equivalent to a logic MMSNP 2 which had been introduced earlier by Madelaine in [START_REF] Florent | Universal structures and the logic of forbidden patterns[END_REF]. This class is as expressive as GMSNP but its definition is simpler. It is similar to MMSNP but now we can colour edges (tuples) as well, when in MMSNP we can colour vertices only. In Section 3.2.2 we show that without loss of generality we can study MMSNP 2 problems over one-relation signatures.

Infinite MMSNP

It is not known if MMSNP 2 has a dichotomy. But it is quite natural to try showing that it is equivalent to MMSNP, as these two logics are similar. In Chapter 4 we study connections between them.

As MMSNP 2 colours edges, we try to mimic this by adding to every edge a new vertex whose mission is to represent the edge and its colour. As we all know, an edge is incident to just one pair of vertices. But these new vertices are not aware of this rule, and MMSNP is not expressive enough so that we could inform them about it. Because of this, we obtain an undesirable concept of duplicated edges (tuples). This becomes an obstacle for us to find an equivalent MMSNP problem for a given one from MMSNP 2 .

However, in Section 4.3 we construct a countably infinite class of structures that can be thought as an infinite extension of an MMSNP sentence. And we manage to show that for any MMSNP 2 sentence there is an equivalent MMSNP sentence of countable length.

It is known that any MMSNP problem is described by a CSP problem on ω-categorical structure. In Section 4.4 we prove that the countably infinite class of structures that is associated with a MMSNP 2 sentence is regular. The notion of regularity for relational structure families is studied by Hubička and Nešetřil in [START_REF] Hubicka | Universal structures with forbidden homomorphisms[END_REF], where they show that for any regular class of structures F there exists an ω-categorical structure B such that, for any finite structure A, A homomorphically maps to B if and only if no structure from F maps to A. This implies that any infinite MMSNP problem that we have obtained in Section 4.3 is described by some ω-categorical CSP. Although it is known (see [START_REF] Florent | Universal structures and the logic of forbidden patterns[END_REF]) that MMSNP 2 problems are already described by ω-categorical CSPs, representing these problems as regular families of forbidden structures seems to be an interesting result.

Bodirsky et al. in [START_REF] Bodirsky | A universal-algebraic proof of the complexity dichotomy for monotone monadic SNP[END_REF] characterized a dichotomy condition for CSP on ωcategorical structures that are described by MMSNP sentences. We think that a dichotomy for MMSNP 2 can potentially be investigated by a similar approach.

Expanders for MMSNP 2

Apart from reducing to MMSNP, one could try to use an approach similar to Feder and Vardi's proof of MMSNP ≡ p CSP. The most difficult part of their proof was to find, for a given structure S, a structure S ′ that is equivalent to S with respect to the CSP and that contains no short cycles. The authors construct S ′ by replacing each vertex of S with a large bag of vertices and then, for each tuple of S, the tuples are uniformly randomly distributed in its preimage. By manipulating the number of tuples in S ′ , this structure becomes both sparse and dense at the same time. It is sparse because it contains few short cycles. And it is dense because of the uniform distribution. These two properties are usually discussed when talking about expander graphs. In particular, when Kun derandomised the construction of S ′ in [START_REF] Kun | Constraints, MMSNP and expander relational structures[END_REF], he also used such graphs.

We face a similar task: to find such S ′ . In Section 5.3 we study different approaches to construct a desired expander structure. For every approach, we highlight the obstacle that does not let us complete the task.

Investigate CSP extensions

Overview

Motivated by the CSP conjecture, many homomorphism type problems have been introduced and studied under the realm of a dichotomy, e.g., full homomorphism [START_REF] Ball | Dualities in full homomorphisms[END_REF], locally injective/surjective homomorphism [MS10, BKM12], list homomorphism [START_REF] Hell | The dichotomy of list homomorphisms for digraphs[END_REF], quantified CSP [START_REF] Zhuk | QCSP monsters and the demise of the chen conjecture[END_REF], infinite CSP [START_REF] Bodirsky | A universal-algebraic proof of the complexity dichotomy for monotone monadic SNP[END_REF], VCSP [START_REF] Kolmogorov | The complexity of conservative valued csps[END_REF], etc. In this thesis, we are interested in the Matrix Partition Problem introduced in [START_REF] Feder | List partitions[END_REF] which finds its origin in combinatorics as other variants of the CSP conjecture, e.g., list or surjective homomorphism.

Trigraphs A trigraph is a pair G = (G, E G ) where E G : G 2 {0, 1, ⋆}. A homomorphism between two trigraphs G and H is a mapping h : G H such that for all (x, y) ∈ G 2 , E H (h(x), h(y)) ∈ {E G (x, y), ⋆}.
As any graph is a trigraph, Hell et al. [START_REF] Feder | List partitions[END_REF][START_REF] Feder | Matrix partitions with finitely many obstructions[END_REF][START_REF] Hell | Graph partitions with prescribed patterns[END_REF]) proposed a way to consider combinatorial problems on graphs as trigraph homomorphism problems, and called them Matrix Partition Problems The term Matrix Partition Problem is a natural one because any trigraph can be represented by a matrix where each entry is in {0, 1, ⋆}, and a trigraph homomorphism is a partition problem where the edges between two parts V i and V j are controlled by the entry of the matrix on (i, j). Particularly, any CSP problem on (directed) graphs can be represented as a Matrix Partition Problem, thus the latter is a generalisation of the class CSP. Motivated by the CSP conjecture, and the similarity of Matrix Partition Problem with CSP, Hell et al. [START_REF] Feder | Matrix partitions with finitely many obstructions[END_REF][START_REF] Hell | Graph partitions with prescribed patterns[END_REF] asks whether Matrix Partition Problems may follow a dichotomy as CSP does.

Motivation

Motivated by the P-time equivalence between general CSP and CSP on directed graphs [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF], we investigate a similar question for Matrix Partition Problems. But, contrary to CSP, there are several ways to generalise Matrix Partition Problems on relational structures. We first propose to generalise the definition of trigraphs to relational structures, where a tuple can be now labeled ⋆, and as in the trigraph homomorphism, a tuple labeled 0 can be only mapped to tuples labeled 0 or ⋆, similarly for 1-labeled tuples that can be mapped to 1 or ⋆-labeled tuples, and a tuple labeled ⋆ can be only mapped to tuples labeled ⋆. Another generalisation of Matrix Partition Problem concerns the inputs. While in Hell et al.'s definition of the problem the inputs are graphs, we propose to consider instead trigraphs as inputs, for their definition see [START_REF] Hell | On the density of trigraph homomorphisms[END_REF]. We denote such new problems by MP ⋆ (H), and the original ones by MP(H) where H is the target structure of the problem. As in the CSP case, we wonder whether this generalisation is P-time equivalent to trigraph homomorphism. We prove that MP ⋆ and MP are P-time equivalent: MP ⋆ ≡ p MP. Hell and Nešetřil in [START_REF] Hell | On the density of trigraph homomorphisms[END_REF] provided a probabilistic proof of this equivalence. In this thesis, we make it deterministic. In doing so, we replace any ⋆-labeled tuple by a large enough Hadamard matrix [START_REF] Frankl | The number of submatrices of a given type in a hadamard matrix and related results[END_REF]. Hadamard matrices are matrices over {1, -1} with the property that any large submatrix is not monochromatic. This property of Hadamard matrices and the pigeonhole principle allow us to show the P-time equivalence (see Section 6.2).

Feder and Vardi in [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF] showed that a CSP over a finite signature is P-time equivalent to a CSP on directed graphs. Bulin et al. in [START_REF] Bulin | A finer reduction of constraint problems to digraphs[END_REF] gave a more detailed proof of this fact and showed that all the reductions are log-space. In Section 6.3.2, we raise similar questions about Matrix Partition Problems. Using the result achieved in Section 6.3.1, we show that any problem in MP over any finite signature is P-time equivalent to a problem in MP on relational structures with one single relation.

We then turn our attention to the P-time equivalence between MP on relational structures with a single relation to MP on directed graphs. While we think that, contrary to the CSP case, MP on relational structures is richer than MP on directed graphs, we fail to prove it. Instead, we analyse the type of reductions used in the CSP case and show that it is unlikely that such reductions work for MP, unless MP ≡ p CSP. In order to show this, we introduce another generalisation of Matrix Partition Problems, denoted by MP ∅ . We first encode any problem in MP by a CSP problem by identifying for each tuple whether it is labeled 1 or 0 (we introduce for each relation R two relations R 0 , for 0-labeled tuples, and R 1 for 1-labeled tuples). Therefore, any MP problem is a CSP problem, but restricted to "complete structures", i.e., any tuple should be in either R 0 or in R 1 . When we relax this completeness property, we obtain the class of problems MP ∅ , where we introduce a new value for tuples, namely ∅, which can be mapped to any value among {0, 1, ⋆}. Firstly, we show in Section 6.2 that MP ∅ ≡ p CSP, and that the correspondence between the classes of problems is one-to-one. We later use this correspondence to show in Section 6.3.2 that any reduction similar to the one of Bulin et al. cannot prove the P-time equivalence between MP over any finite signature and MP on directed graphs, unless MP ≡ p CSP. The four values ∅, 0, 1⋆ are ordered in a form of a Boolean lattice. We also show in Section 6.2 that, if relational tuples have values in an arbitrary finite lattice, then the corresponding class of MP problems is embedded into CSP under P-time reductions, and thus has a dichotomy.

A natural way to prove that a problem is in P is to show that it is described by a finite set of obstructions. In the case of CSP, F is called a duality set for an instance CSP(H) if for any structure G, G does not homomorphically map to H if and only if there is F ∈ F such that F homomorphically maps to G. It is known that CSP(H) has a finite set of obstructions if and only if it is definable by a first-order formula [START_REF] Atserias | On digraph coloring problems and treewidth duality[END_REF]. Feder, Hell and Xie proposed in [START_REF] Feder | Matrix partitions with finitely many obstructions[END_REF] to study Matrix Partition Problems with finite sets of (inclusion-wise minimal) obstructions, that is a graph admits a partition if and only if it does not have an induced subgraph that belongs to a finite family F of forbidden graphs. They proposed a necessary (but not sufficient) condition for a matrix M to have finitely many obstructions, and Feder, Hell and Shklarsky later showed in [START_REF] Feder | Matrix partitions of split graphs[END_REF] that any Matrix Partition Problem has finitely many obstructions if the input consists only of split graphs. In Section 6.4, we show that a Matrix Partition Problem has finitely many inclusion-wise minimal obstructions if and only if there are finitely many of them for the MP ⋆ case. We also consider duality sets for Matrix Partition Problems. We show that the following are equivalent for a trigraph H (it holds also for relational structures):

1. MP(H) has a finite duality set.

MP(H) has a finite set of inclusion-wise minimal obstructions.

3. MP ⋆ (H) has a finite duality set.

MP ⋆ (H) has a finite set of inclusion-wise minimal obstructions.

Apart from it, we study how the finiteness of obstruction sets for the CSPs is related to the finiteness for trigraphs. We demonstrate that if MP ∅ (H) (that is associated with a CSP, see Section 6.2) has a finite set of obstructions, then MP(H) has also a finite set of obstructions. We show that the other direction is false by giving an example of a ⋆-graph H such that MP ⋆ (H) has finitely many obstructions and MP ∅ (H) has an infinite set of obstructions.

Any MP problem can be described by a sentence from MonadicSNP. This means that potentially there exists a logic that is P-time equivalent to MP. Finding such a logic will provide more tools to study MP with respect to a possible dichotomy. In Section 6.5 we provide a fragment of MonadicSNP and show that it strictly contains MP.

Being inspired by the result of Bulatov and Zhuk for CSP, we study polymorphisms on MP instances. In Section 6.6 we define what is a polymorphism in the MP case and provide an MP instance that is solvable in P-time and that does not have a Siggers polymorphism. This means that MP does not have a characterization similar to CSP. This is not completely surprising as MP can be seen as a CSP with restricted input. There are numerous examples of CSP that are NP-complete, yet become tractable when their input is restricted. For example, when the input has bounded tree-width, see [START_REF] Grohe | The complexity of homomorphism and constraint satisfaction problems seen from the other side[END_REF] 29 Chapter 2 Strict NP and its three syntactic fragments

We revisit the three logics from Feder and Vardi's paper [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF] that extend Monotone Monadic SNP without inequality (MMSNP) by omitting one of the three conditions that define MMSNP. The authors state that none of these classes has a dichotomy, however some of their proofs are given rather as sketches of proofs. We show the absence of a dichotomy for these three fragments of SNP by providing detailed proofs.

Denote by τ a signature that contains the input relation symbols. An SNP sentence is an existential second-order τ -sentence with the universal first-order part, i.e., a sentence of the form

∃X 1 , . . . , X s ∀x ϕ(x 1 , . . . , x n ),
where ϕ is a quantifier-free first-order formula over the signature τ ⊎ {X 1 , . . . , X s }, and x is the tuple of (first-order) variables x 1 , . . . , x n . Denote the set of the existentially quantified second-order variables {X 1 , . . . , X s } by σ. We call τ the input signature and σ the existential signature. Relation symbols of τ are called input relations and relation symbols of σ are called existential relations.

Let a τ -sentence Φ ∈ SNP be written in the following form:

∃X 1 , . . . , X s ∀x i ¬(α i ∧ β i ).
Here α i is a conjunction of atomic or negated atomic formulae involving relation symbols of τ and variables from x; and β i is a conjunction of atomic or negated atomic formulae involving relation symbols of σ and variables from x. Every subformula ¬(α i ∧ β i ) is called a negated conjunct. A sentence Φ is called monotone if each conjunction α i does not contain negated atomic formulae.

Remark. We frequently replace a negated conjunct ¬(α i ∧ β i ) with an equivalent implication (α i ¬β i ).

An SNP-sentence Φ is called monadic if all existential relation symbols M in σ have arity 1.

Denote by MMSNP the class of SNP-sentences that are monotone, monadic, and without inequality, that is, they do not contain literals of the form x ̸ = y. Similarly, denote by • MonotoneSNP those SNP-sentences that are monotone and without inequality;

• MonadicSNP those ones that are monadic and without inequality;

• MMSNP ̸ = those ones that are monotone and monadic, and possibly with inequality.

If Φ is a τ -sentence of SNP, then the problem of satisfiability of Φ, denoted by SAT(Φ), is a set of relational τ -structures that satisfy the sentence Φ:

SAT(Φ) := {A | A |= Φ}.
Example 2.0.1. We provide three sentences from each of these classes. Let Φ 1 be the following sentence:

∃A, B ∀x, y    ¬ A(x) ∧ B(x) ∧ ¬ ¬A(x) ∧ ¬B(x) ∧ ¬ E(x, y) ∧ A(x) ∧ A(y) ∧ ¬ E(x, y) ∧ B(x) ∧ B(y) ∧ ¬ ¬E(x, y) ∧ A(x) ∧ B(y) ∧ ¬ ¬E(x, y) ∧ B(x) ∧ A(y)   
This sentence is not monotone because the last two negated conjuncts contains a negated τ -atom ¬E(x, y). So it belongs to MonadicSNP ∖ MMSNP. For a directed graph G, we have G |= Φ 1 if and only if G is a complete bipartite graph.

Let Φ 2 be the following sentence:

∃T ∀x, y, z    ¬T (x, x)∧ ¬ E(x, y) ∧ ¬T (x, y) ∧ ¬ T (x, y) ∧ T (y, z) ∧ ¬T (x, z)   
This sentence is not monadic because the existentially quantified relation T is not unary. So it belongs to MonotoneSNP ∖ MMSNP. For a digraph G, we have G |= Φ 2 if and only if G is acyclic. Let Φ 3 be the following sentence:

∀x, y, z ¬ E(x, y) ∧ E(x, z) ∧ y ̸ = z ∧ ¬ E(x, y) ∧ E(z, y) ∧ x ̸ = z
This sentence contains inequalities, so it belongs to MMSNP ̸ = ∖ MMSNP. For a digraph G, G |= Φ 3 if and only if the in-and out-degrees of any vertex are not greater than 1. This means that, in this case, G is a disjoint union of directed paths and cycles. △

Our aim is to reprove the three following theorems. All of them are stated in [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF]. However, their proofs are not very detailed there: the authors only provide the main ideas how the reductions must look like. Our goal is to make them more precise. The proof of Theorem 2.0.1 is almost the same as the original one, here, we also explicitly show the two reduction directions. The proof of Theorem 2.0.2 uses the same constructions as in [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF], but we also explicitly write both reductions, and they are non-trivial. The proof of Theorem 2.0.3 is different in the sense that the original proof was only sketched and referred to another paper of Vardi on fragments of Datalog with no explicit result that allowed us to be fully convinced. Our proof is complete and uses the key idea of oblivious Turing machines as proposed in the sketched proof of Feder and Vardi.

Theorem 2.0.1 (Theorem 2 in [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF]). Any non trivial MMSNP ̸ = problem is P-time equivalent to a problem in MonadicSNP.

Theorem 2.0.2 (Theorem 3 in [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF]). Any non trivial MMSNP ̸ = problem is P-time equivalent to a problem in MonotoneSNP.

Theorem 2.0.3 (Theorem 1 in [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF]). Any non trivial NP problem is P-time equivalent to a problem in MMSNP ̸ = .

Remark. When we prove each of these three theorems, we do not consider trivial problems: a problem that either accepts any input or rejects any input. Each of the three classes: MonadicSNP, MonotoneSNP and MMSNP ̸ = , contains both of the trivial problems. The problem that accepts all the input is described by the following MMSNP sentence, for example:

∃Red(•), Blue(•) ∀x ¬Red(x),
as we can colour all the input structure elements in Blue. The problem that rejects any input can be described by the following MMSNP sentence:

∃Red(•) ∀x ¬ Red(x) ∧ ¬Red(x) .
2.1 MMSNP with ̸ = embeds into Monadic SNP without ̸ = First, we explain how to construct, for a sentence Φ of MMSNP ̸ = , the corresponding sentence Φ ′ in MonadicSNP in order to prove Theorem 2.0.1. Let Φ in MMSNP ̸ = be a τ -sentence as follows: ∃M 1 , . . . , M s ∀x ϕ(x),

where τ = {R 1 , . . . , R t } is the input relational signature and σ = {M 1 , . . . , M s } is the existential relational signature consisting of unary relation symbols. We are going to construct a sentence Φ ′ in MonadicSNP with an input signature τ ′ and the same existential signature σ.

Construction 1. The new input signature τ ′ is obtained from τ by adding a new relation symbol eq(•, •). Firstly, we require that eq is an equivalence relation. We denote this formula by ϵ 1 .

ϵ 1 := ∀x, y, z eq(x, x) ∧ eq(x, y) eq(y, x) ∧ eq(x, y) ∧ eq(y, z) eq(x, z) .

Remark. By construction, eq violates the monotonicity property in the sentence Φ ′ in ϵ 1 . Any equivalence relation ∼ defined on a set A can be extended to an equivalence relation on the set A k of k-tuples of A as follows: (x 1 , . . . , x k ) is equivalent to (y 1 , . . . , y k ) if, for any i in [k], we have x i ∼ y i . The next condition, denoted by ϵ 2,τ , states that if a τ -relation R contains a tuple x, then it contains every other tuple y that is equivalent to x in a sense described above.

ϵ 2,τ := R∈τ ∀x 1 , . . . , x k R , y 1 , . . . , y k R R(x 1 , . . . , x k R ) ∧ eq(x 1 , y 1 ) ∧ • • • ∧ eq(x k R , y k R ) R(y 1 , . . . , y k R ) .
Similarly, for any σ-relation M, we require that any two eq-equivalent elements agree on M. ϵ 2,σ := M∈σ ∀x, y M(x) ∧ eq(x, y) M(y) .

Let ϕ ′ be the quantifier-free first-order (τ ⊎ σ)-formula obtained from the quantifier-free part ϕ of Φ, where each literal x ̸ = y is replaced by ¬eq(x, y). Let Φ ′ be the following sentence:

Φ ′ := ∃M 1 , . . . , M s ϵ 1 ∧ ϵ 2,τ ∧ ϵ 2,σ ∧ ∀x ϕ ′ (x) ,
By construction, Φ ′ is monadic and without inequality. This is the end of Construction 1.

Remark. We assume without loss of generality that Φ of MMSNP ̸ = is non trivial in the sense that there is a structure that does not satisfy Φ. Such structure is called a NO instance. We can assume that Φ always has a NO instance.

In order to prove Theorem 2.0.1, we show that SAT(Φ) ≤ p SAT(Φ ′ ), and then we prove the other direction. Thus, together, the following Lemmas 2.1.1 and 2.1.2 prove Theorem 2.0.1. Lemma 2.1.1. Suppose that Φ in MMSNP ̸ = and Φ ′ in MonadicSNP are as in Construction 1. Then SAT(Φ) reduces in P-time to SAT(Φ ′ ).

Proof. For any τ -structure A, we construct a τ ′ -structure A ′ , by keeping all relations from τ the same and interpreting eq as the identity, that is, we set

eq A ′ := {(x, x) | x ∈ A ′ }.
This interpretation satisfies ϵ 1 , ϵ 2,τ , and ϵ 2,σ . And also, for all x, y in A, x ̸ = y if and only if ¬eq(x, y), so A |= Φ if and only if A ′ |= Φ ′ . As we can construct A ′ in time polynomial in the size of A, we have SAT(Φ) ≤ p SAT(Φ ′ ).

Lemma 2.1.2. Suppose Φ in MMSNP ̸ = and Φ ′ in MonadicSNP are as in Construction 1. Then SAT(Φ ′ ) reduces in P-time to SAT(Φ).

Proof. Consider a τ ′ -structure A ′ . We can check in P-time in

|A ′ | whether A ′ |= ϵ 1 ∧ ϵ 2,τ .
If this is false, then A ′ ̸ |= Φ ′ , and we reduce A ′ to a fixed NO instance of Φ. Otherwise we reduce A ′ to its eq-quotient. That is, we set A := A/eq. We now prove that A |= Φ if and only if

A ′ |= Φ ′ . Suppose that A ′ ̸ |= Φ ′ and, on the contrary, A |= Φ. Let M A 1 , . . . , M A s be the choice of σ-relations for A that satisfies the sentence Φ. It is associated with a unique choice M A ′ 1 , . . . , M A ′ s for A ′ : such that for any M in σ and [a] eq in A, M A ([a] eq ) ↔ M A ′ (a), its uniqueness is provided by ϵ 2,σ . By assumption, there is a tuple a ′ = (a ′ 1 , . . . , a ′ n ) from A ′ such that some negated conjunct ¬ϕ ′ i (a ′ i ) of ϕ ′ (a ′ ) is false. Take the tuple [a ′ ] eq := ([a ′ 1 ] eq , . . . , [a n ] ′ eq )
. By ϵ 2,τ and ϵ 2,σ , the corresponding negated conjunct ¬ϕ i ([a ′ ] eq ) is false, this is a contradiction.

Suppose now that A ̸ |= Φ and, on the contrary, A ′ |= Φ ′ . Let M A ′ 1 , . . . , M A ′ s be the choice of the σ-relations for A ′ that satisfies the sentence Φ ′ . Let us choose M A 1 , . . . , M A s such that for any a ′ in A ′ and M in σ, we have M A ([a ′ ] eq ) ↔ M A ′ (a ′ ). For this choice of M A 1 , . . . , M A s there is a tuple a such that some negated conjunct ¬ϕ i (a) is false. Pick any tuple a ′ such that a = [a ′ ] eq . Then, by ϵ 2,τ and ϵ 2,σ , the corresponding negated conjunct

ϕ ′ i (a ′ ) is false in A ′ , this is a contradiction. A σ A σ /eq
Figure 2.1: On the left, we depict a σ-extension of a structure A ′ . On the right, we depict its eq-quotient.

Arcs denote binary input relations. Coloured dots denote monadic existential relations. Dotted closed curves denote eq-equivalence classes.

Example 2.1.1. We provide an example of the reduction from Lemma 2.1.2, see Figure 2.1 on page 35. We can observe that if a map e : A ′ /eq A ′ A ′ sends any eq-equivalence class [a] eq to some element of the same class, then this map is an embedding. In particular, this means that if A ′ satisfies Φ ′ , then A ′ /eq satisfies Φ ′ as well. △

MMSNP with ̸ = embeds into Monotone SNP without ̸ =

Let Φ in MMSNP ̸ = be a τ -sentence with the existential signature σ = {M 1 , . . . , M s } consisting of unary relation symbols. We construct a τ ′ -sentence Φ ′ in MonotoneSNP with the existential signature σ ′ such that SAT(Φ) ≡ p SAT(Φ ′ ), which will prove Theorem 2.0.2.

Construction 2. The new input signature τ ′ is obtained from τ by adding two relation symbols: special(•) and succ(•, •). The new existential signature σ ′ is obtained from σ by adding three relation symbols: Marked(•), Eq(•, •) and Pred(•, •). We have certain requirements for every new relation. Every special element must be Marked:

θ 1 := ∀x special(x) Marked(x) .
Any element that is connected (in any direction) to a Marked element by a succ-arc must also be Marked:

θ 2 := ∀x, y Marked(x) ∧ succ(x, y) Marked(y) ∧ ∧ Marked(x) ∧ succ(y, x) Marked(y) .
The relation Pred must be irreflexive and transitive:

θ 3 := ∀x, y, z ¬Pred(x, x)∧ Pred(x, y) ∧ Pred(y, z) Pred(x, z) .
Any succ-arc is a Pred-arc, so Pred must contain the transitive closure of succ:

θ 4 := ∀x, y succ(x, y) Pred(x, y) .
Similarly as in the proof of Theorem 2.0.1, Eq must be an equivalence relation, that is, ϵ 1 must be satisfied:

ϵ 1 := ∀x, y, z Eq(x, x) ∧ Eq(x, y) Eq(y, x) ∧ Eq(x, y) ∧ Eq(y, z) Eq(x, z) .

Every two special elements must be Eq-equivalent:

θ 5 := ∀x, y special(x) ∧ special(y) Eq(x, y) .

The relation Pred must be preserved under replacing each of the elements by an equivalent one:

θ 6 := ∀x, y, z Pred(x, y) ∧ Eq(y, z) Pred(x, z) ∧ ∧ Pred(x, y) ∧ Eq(x, z) Pred(z, y) .
The successors and predecessors of two equivalent elements must also be equivalent with one another:

θ 7 := ∀x, y, x ′ , y ′ Eq(x, y) ∧ succ(x, x ′ ) ∧ succ(y, y ′ ) Eq(x ′ , y ′ ) ∧ ∧ Eq(x, y) ∧ succ(x ′ , x) ∧ succ(y ′ , y) Eq(x ′ , y ′ ) .
Also, all relations M from σ keep holding after replacing one of their elements x by another element that is equivalent to x, similarly to ϵ 2,σ from Theorem 2.0.1:

θ 8 := M∈σ ∀x, y M(x) ∧ Eq(x, y) M(y) .
Note that we can not require the something similar for the input relations as in ϵ 2,τ in the proof of Theorem 2.0.1, otherwise, we would violate the monotonicity. We can suppose without loss of generality that, for an MMSNP ̸ = sentence Φ, its quantifier-free part ϕ(x) is as follows:

¬ϕ 1 (x 1 ) ∧ • • • ∧ ¬ϕ n (x n ),
where each ϕ i (x i ) is of the following form:

α i (x τ i ) ∧ β i (x σ i ) ∧ γ i x ̸ = i .
Here, α i is a conjunction of τ -atoms, β i is a conjunction of σ-atoms or negated σ-atoms, and γ i is a conjunction of inequalities. There are no literals of the form x = y, as every literal of such form can be removed if we replace y with x everywhere in the conjunct. In order to construct the sentence Φ ′ , for which we will later show the P-time equivalence with Φ, we do the following transformations within every negated conjunct ¬ϕ i .

• Suppose that the part α i of ϕ i contains two τ -atoms R 1 (x 1 ) and R 2 (x 2 ) such that both tuples x 1 and x 2 share a variable x. In this case, we introduce a new variable x ′ , add an atom Eq(x, x ′ ) to ϕ i , and replace x with x ′ in the tuple x 2 . Repeat this procedure until no two τ -atoms of α i share variables.

• After that, within γ i , we replace all inequalities x ̸ = y by negated σ-atoms ¬Eq(x, y).

• For every variable x of ϕ i , we add an atom Marked(x) to this conjunct. This means that now we can restrict any input structure on Marked elements. In model theory, the substructure consisting of Marked elements is usually called the relativised reduct with respect to the relation Marked, see [START_REF] Hodges | A Shorter Model Theory[END_REF].

For ϵ 1 and θ 3 , . . . , θ 8 , that is, for all the introduced formulae that do not describe the Marked relation, we also require that all their variables are Marked, as well as for any negated conjunct of ϕ(x). To do this, we add the atom Marked(x) into the implication body, for every variable x of each rule.

Example 2.2.1. The rule θ 5 that forces two special elements be Eq-equivalent is transformed to the following one:

θ 5 := ∀x, y special(x) ∧ special(y) ∧ Marked(x) ∧ Marked(y)
Eq(x, y) .

△ Let ϕ ′ be obtained from the quantifier-free part ϕ of Φ after doing the procedures described above. Then, the desired sentence Φ ′ is obtained by requiring all the conditions from above:

∃M 1 , . . . , M s , Marked, Eq, Pred ∀x ϵ 1 ∧ θ 1 ∧ • • • ∧ θ 8 ∧ ϕ ′ (x) .
This is the end of Construction 2.

We prove a well-known fact which states that any SNP sentence is preserved under taking induced substructures. So that we are sure that without loss of generality the Marked relation can be chosen to be minimal possible by inclusion. That is, the one that contains all special elements, by θ 1 , and all the elements that are connected to a special element by a sequence of succ-arcs, by θ 2 , and contains nothing else.

Lemma 2.2.1. Let Φ in SNP with some input and existential signatures τ and σ, A is a relational τ -structure, and B is an induced substructure of A. Then A |= Φ implies that B |= Φ.

Proof. Suppose that A |= Φ. Let A ′ := (A, X A ′ 1 , . . . , X A ′ s ) be a σ-expansion of A that satisfies the first-order part ∀x ϕ(x) of the sentence Φ. Observe that ∀x ϕ(x) is a universal first-order formula. Let B ′ := (B, X B ′ 1 , . . . , X A ′ s ) be the substructure of A ′ induced on the set B. It is well-known that universal first-order formulae are preserved under taking induced substructures, see [START_REF] Hodges | A Shorter Model Theory[END_REF]. Then B ′ |= ∀x ϕ(x). Thus, B |= Φ.

We have split the proof of Theorem 2.0.2 in two parts: Lemma 2.2.2 and Lemma 2.2.4. Together, they imply Theorem 2.0.2. Lemma 2.2.2. For any sentence Φ in MMSNP ̸ = , the problem SAT(Φ) reduces to SAT(Φ ′ ), where Φ ′ is a sentence in MonotoneSNP which is obtained from Φ by Construction 2.

Proof. For a τ -structure A with domain A = {a 1 , . . . , a n }, we construct a τ ′ -structure A ′ with the same domain A ′ := A such that, for any R in τ , we have R A = R A ′ , and the other two input relation symbols special and succ are interpreted as follows:

special A ′ := {a 1 }, succ A ′ := {(a i , a i+1 ) | i ∈ [n -1]}.
For such interpretations there is a unique choice of the existential relations Marked, Eq, and Pred satisfying ϵ 1 , θ 1 , . . . , θ 7 , namely,

Marked A ′ := A, Eq A ′ := {(a, a) | a ∈ A}, Pred A ′ := {(a i , a j ) | i < j}.
Similarly as in the proof of Theorem 2.0.1, for all x, y in A, x ̸ = y if and only if ¬Eq(x, y).

There is a one-to-one correspondence between interpretations of the existential relations M 1 , . . . , M s of σ, for A and A ′ , as these two structures have the same domain. Let A σ and A ′σ ′ be two expansions such that all M 1 , . . . , M s are interpreted identically. If there is a negated conjunct ¬ϕ i (x i ) of Φ such that, for some tuple a i , we have A σ |= ϕ i (a i ), then we also have

A ′σ ′ |= ϕ ′ i (a ′ i )
, where a ′ i is associated with a i similarly as the variables of ϕ ′ i are associated with the variables of ϕ i . Recall that the variables may not be the same because we may have replaced a variable x, that belonged to two distinct τ -atoms, with two variables x and x ′ now related by Eq. If two variables of ϕ ′ i are related by the Eqatom, then we have to assign the same value to them. Backwards, if A ′σ ′ |= ϕ ′ i (a i ), then, for any two variables of ϕ ′ i that are related by an Eq-atom, there is a common element of A that is assigned to them. Then we uniquely define which element of A should be assigned to any variable of ϕ i , then, for some tuple a i , we have

A σ |= ϕ i (a i ). This means that A |= Φ if and only if A ′ |= Φ ′ .
Before proving the other reduction direction, we want to assume without loss of generality that any element a of A is forced to be Marked by θ 1 and θ 2 . That is, either a is special or it is connected to a special element by a sequence of succ-arcs.

Lemma 2.2.3. Let A ′ be a τ ′ -structure. Denote by A ′ | Marked its substructure induced on the elements that are either special or connected to a special element by a sequence of succ-arcs. Proof. Let A ′ be a τ ′ -structure. By Lemma 2.2.3, we can assume without loss of generality that any element a in A ′ is either special or connected by a sequence of succ-arcs to a special element.

It turns out that the structure A has a σ ′ -extension that satisfies ϵ 1 , θ 1 , . . . , θ 7 if and only if A ∼ := A ′ / ∼ is a balanced graph with respect to succ-arcs, where ∼ is the minimal by inclusion equivalence relation that identifies precisely all special elements, that is,

∀x, y ∈ A ′ special(x) ∧ special(y) ↔ (x ∼ y) .
Recall that a directed graph G is called balanced if it admits a height function, i.e., a function f : G Z such that, for any two vertices x, y in G, if there is an arc E(x, y), then we have f(y) = f(x) + 1. One can check in P-time if a digraph is balanced, see [START_REF] Bulin | A finer reduction of constraint problems to digraphs[END_REF].

Claim 2.2.5. A ′ has a σ ′ -extension that satisfies the conditions

ϵ 1 ∧ θ 1 ∧ • • • ∧ θ 7 if and only if (A ∼ , succ A∼ ) is a balanced digraph.
Proof of the Claim. We are going to prove the claim by arguing, first, that a height function yields an interpretation of Eq and Pred that satisfy the formulae; and then we argue that if it not balanced, then no choice for Eq, Pred can satisfy the formulae.

Suppose (A ∼ , succ A∼ ) is balanced; then let f ∼ : A ∼ Z be its height function. Let

f : A ′ Z satisfy ∀x ∈ A f(x) = f ∼ ([x] ∼ ) , where [x] ∼ is the ∼-equivalence class that contains x. Construct the σ ′ -extension A ′σ ′ as follows. Choose Eq A ′σ ′ := {(x, y) ∈ (A ′ ) 2 | f(x) = f(y)}, and
Pred A ′σ ′ = {(x, y) ∈ (A ′ ) 2 | f(x) < f(y)} (recall that
we assume without loss of generality that Marked A ′σ ′ = A ′ ). All the other relations from σ ′ can be chosen arbitrarily.

ϵ 1 is true as "=" is an equivalence relation on Z, θ 1 , θ 2 are satisfied by the assumption, θ 3 is satisfied because "<" is irreflexive and transitive on Z, θ 4 is true because f ∼ is a height function, θ 5 is true by the construction of f from f ∼ , θ 6 is true because, for a, b, c in (Z, <), a < b and b = c imply a < c, θ 7 is true because f ∼ is a height function. We have proved one direction.

For the other direction, suppose that there is a σ ′ -extension A ′σ ′ that satisfies θ 1 , . . . , θ 7 . Let s = (a 1 , . . . , a s ) be a sequence of elements of A ′σ ′ such that, for any i in [s -1], either

succ A ′σ ′ (a i , a i+1 ) or succ A ′σ ′ (a i+1 , a i ), or Eq A ′σ ′ (a i , a i+1 ).
Denote the family of all such sequences by S. Any s in S of length s is associated with a tuple t s = (t 1 , . . . , t s-1 ) such that, for any i in [s -1],

• if succ A ′σ ′ (a i , a i+1 ), then t i = 1;

• if succ A ′σ ′ (a i+1 , a i ), then t i = -1;

• if Eq A ′σ ′ (a i , a i+1 ), then t i = 0.

For any s in S, denote h(s) := s-1 i=1 t i . This function h computes the difference between the number of forth-coming succ-arcs of the sequence and the number of back-coming ones. In particular, if s is a succ-path, then h returns its net length.

We want to show that, for any sequence s = (a 1 , . . . , a s ) in S, if h(s) = 0, then (a 1 , a s ) belongs to Eq A ′σ ′

. By construction, this property holds for any s in S of length 2. Let s be a sequence of the shortest length such that this property does not hold. Observe that t s cannot contain two consecutive 0s, as Eq is transitive, thus t s must contain at least one element from {-1, 1}. Consider the four following cases for the tuple s that are displayed on Figure 2.2 on page 39.

a i-1 a i a i+1 a i-1 a i a i+1 a i-1 a i a i+1 a i+2 a i-1 a i a i+1 a i+2 Case 1
Case 2 Case 3 Case 4

Figure 2.2: The four cases that may occur in s. Dotted closed curves denote Eq-tuples.

If none of these cases happens, then all the succ-arcs of the sequence s have the same direction, so h(s) ̸ = 0. Cases 1 and 2 imply that Eq A ′σ ′ (a i-1 , a i+1 ), by θ 7 . Thus, we can delete a i from s, and obtain a shorter sequence that violates the property. Cases 3 and 4, similarly, imply that Eq A ′σ ′ (a i-1 , a i+2 ). Thus, if we delete a i , a i+1 from s, then the resulting sequence is shorter and it violates the property.

We want to show that, for any sequence s = (a 1 , . . . , a s ) in S, if h(s) > 0, then (a 1 , a s ) belongs to Pred A ′σ ′ . Suppose the opposite, then choose s to be a sequence of the shortest length that violates the property. If one of the four cases from Figure 2.2 happens, then we can reduce the length of s without changing the value of h. If none of them happens, then either t s consists only of 0s and 1s, or it consists only of 0s and -1s. Without loss of generality, suppose the first case. Then we have h(s) > 0, and θ 3 , θ 4 , θ 6 provide that

(a 1 , a s ) belongs to Pred A ′σ ′
, this is a contradiction. Suppose that (A ∼ , succ A∼ ) is not balanced; then there exist two elements x, y in A ∼ and two sequences s 1 = (a 1 1 , . . . , a 1 s 1 ), s 2 = (a 2 1 , . . . , a 2 s 2 ) in S such that x = a 1 1 = a 2 1 , y = a 1 s 1 = a 2 s 2 , and h(s 1 ) ̸ = h(s 2 ). Otherwise we could construct a height function f by setting f([x] ∼ ) = 0, for x in special A ′ , and by setting f(y) = h([x] ∼ , . . . , y), for some sequence of S connecting [x] ∼ and y. Let s -1 2 be the result of reversing s 2 , that is, s -1 2 = (a 2 s 2 , . . . , a 2 1 ). For any sequence s in S, we have h(s) = -h (s -1 ). Let s 1 s -1 2 be the concatenation of s 1 and s -1 2 . Then h(s

1 s -1 2 ) = h(s 1 ) + h s -1 2 = h(s 1 ) -h(s 2 ) ̸ = 0. This implies that (x, x) belongs to Pred A ′σ ′
, that is forbidden by θ 3 .

Suppose that (A ∼ , succ A∼ ) is a balanced graph. Then there is only one way to choose the relations Eq and Pred as they depend on the values of the function h. We know that, if h(x, . . . , y) = 0, then (x, y) ∈ Eq A ′ ; and if h(x, . . . , y) > 0, then (x, y) ∈ Pred A ′ . And also we know that, for any pair (x, y) in (A ′ ) 2 , it cannot belong to Pred A ′ and to Eq A ′ at the same time, this is forbidden by θ 3 and θ 6 . We can conclude now that, for any x, y in A ′ , (x, y) ∈ Eq A ′ if and only if h(x, . . . , y) = 0 and (x, y) ∈ Pred A ′ if and only if h(x, . . . , y) > 0. This implies a uniqueness of the choice of these two relations. So we can assume that either Φ ′ rejects A ′ in P-time or there is a unique interpretation

Eq A ′σ ′ , Pred A ′σ ′ that satisfies ϵ 1 ∧ θ 1 ∧ • • • ∧ θ 7 .
We are ready to construct the corresponding τ -structure A. It is the τ -reduct of the quotient of A ′ with respect to Eq A ′σ ′

: A := A ′ /Eq A ′σ ′ τ . The condition θ 8 requires that any two elements of the same Eq A ′ -equivalence class have to agree on any σ-relation, thus there is a one-to-one correspondence between choices of σ-relations M A 1 , . . . , M A s for A and choices for A ′ .

We need to prove that A |= Φ if and only if A ′ |= Φ ′ . Let A ′σ ′ be a σ ′ -expansion of A ′ that satisfies all the conditions ϵ 1 , θ 1 , . . . , θ 8 . Let A σ be the σ-expansion of A that is associated with A ′σ ′ . It suffices to show that each negated conjunct ¬ϕ i (a) of the quantifier-free part ϕ of Φ is true in A σ , for any choice of variables a, if and only if the corresponding negated conjunct ¬ϕ ′ i (a ′ ) is true in A ′σ ′ , for any choice of variables a ′ . Suppose that, for some a and some negated conjunct ϕ i (a), every atom of ϕ i (a) is true in A σ . We need to find a tuple a ′ such that every atom in ϕ ′ i (a ′ ) is true in A ′σ ′ . For any atom R(b) of a τ -relation R, we know that it holds in A. By the construction of A, there exists a tuple b ′ in A ′ such that b = [b ′ ] Eq and that R(b ′ ) holds in A ′ . By the construction of ϕ ′ i , we know that any variable of ϕ ′ i may appear only in one atom with a τ -relation; this means that the choice of the tuple b ′ that is associated with b does not influence

(A ′ , Eq) A ′ /Eq A ′ Figure 2
.3: From left to right, a τ ′ -structure A ′ , the same structure expanded with the existential equivalence relation Eq, and the Eq-quotient of this structure. Red squares are special elements, closed curves are τ -relational tuples, black arcs are succ-arcs, dotted closed curves are Eq-equivalence classes.

the choices for other τ -relational atoms of ϕ i . We can suppose now that we can choose elements of A ′ such that any τ -relational atom of ϕ ′ i is true. Consider a σ-relational atom M(d) of ϕ i (a). Suppose that the element d appears in a tuple b of some τ -relational atom R(b): d = b i ; then we have already chosen an element of A ′ that is associated with d: it is b ′ i of the tuple b ′ . By θ 8 and, by the construction of A, b i belongs to M if and only if [b i ] Eq belongs to M. Suppose that the element d does not appear in any τ -relational atom of ϕ i ; then we choose any element d ′ in A ′ such that [d ′ ] Eq = d. We have shown that any τ -relational and any σ-relational atom is satisfied in

A ′σ ′ . Recall that, for any a ′ 1 , a ′ 2 in A ′ , ¬Eq(a ′ 1 , a ′ 2 ) ⇔ [a ′ 1 ] Eq ̸ = [a ′ 2 ]
Eq ; thus any atom of ϕ ′ i that has the form ¬Eq(x, y) is satisfied. The rest consists of atoms of the form Eq(x, x ′ ) that are added during the construction of ϕ i . Both of the elements of any such atom appear in τ -relational atoms, and we know that [x] Eq = [x ′ ] Eq , because they are associated with the same element of A. We have shown that, for our choice, any atom of ϕ ′ i is true in A ′σ ′ . Let us show the other direction. Suppose that, for some tuple a ′ , any atom of some ϕ ′ i is true in A ′σ ′ . For any element b ′ of a ′ , we associate [b ′ ] Eq to it. By the construction of A, every atom of ϕ i is true in A σ .

Example 2.2.2. Have a look at a structure A ′ that is displayed on Figure 2.3 on page 41. Here, the signature τ ′ is obtained from τ by adding special and succ relations, and τ consists of just one ternary relation. By default, there may be more than one special element, but they belong to the same Eq-equivalence class. Then, their succ-neighbours must also belong to the same Eq-equivalence class, and so on. If succ A ′ was not a balanced graph, then we would have two elements connected by a succ-arc within the same Eq-equivalence class. △

NP embeds into MMSNP with ̸ =

We show that for any nondeterministic Turing machine there exists a P-time equivalent MMSNP ̸ = sentence. Feder and Vardi in [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF] consider only oblivious Turing machines. An oblivious Turing machine is defined by the following property: for any two input instances of the same size, the head movements during the machine executions are the same. That is, the head movement does not depend on the symbols written on the tape, it depends only on the size of the input. More formally, a (possibly non-deterministic) Turing machine M o is called oblivious if there exists a function f : N N such that, for any input x of size |x| = n, M o decides x in precisely f(n) steps. And that, for every two inputs x 1 , x 2 such that |x 1 | = |x 2 |, and, for any moment t in [f(n)] of each execution, the positions of the head are the same. The concept of oblivious Turing machines is introduced by Pippenger and Fischer in [START_REF] Pippenger | Relations among complexity measures[END_REF].

The proof of Theorem 2.0.3 is only vaguely sketched in [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF]. We provide a complete proof in this section. This proof relies on a specific choice of the way in which we expect an oblivious Turing machine to work. That is, we do not know how to provide a proof of Theorem 2.0.3 that would use [START_REF] Pippenger | Relations among complexity measures[END_REF] as a black box reduction from non-deterministic Turing machines to oblivious ones.

Before explaining how NP can be embedded into MMSNP ̸ = , we argue that without loss of generality one can consider only oblivious Turing machines with a one-way infinite tape. Then, for any oblivious Turing machine, we construct an MMSNP ̸ = sentence Φ and then show that the corresponding problems are P-time equivalent.

In the reduction, an input instance of a Turing machine is associated with a structure that looks like a two-dimensional grid, which represents the set of tape configurations at any moment of the execution. That is, the structure shall be used to represent a canvas for the space-time diagram of the oblivious Turing machine. A row consists of cells that are either occupied by the input or visited by the head by this time. When the head reaches the rightmost cell of the tape it does one more step to the right and, thus, increases the row size by 1, as a new cell is visited. The first row is associated with the initial configuration of the tape (t = 0): the head is at the leftmost cell, the string of symbols is the initial input string. The next row is associated with the next moment of time (t = 1), the head has done one step to the right. The movements of the head are independent of the input contents. So it shall be possible to check that the grid is in the correct shape in MMSNP ̸ = .

We assume that a Turing machine that we consider is non-trivial, i.e., it neither accepts all input instances nor rejects all of them.

Oblivious Turing machines

For a Turing machine M , we say that the running time of M depends only on the size of the input if there is a function f : N N such that, for any input x of size |x| = n, M decides x in precisely f(n) steps. The following lemma allows us to consider without loss of generality only Turing machines whose running time depends only on the size of the input.

Lemma 2.3.1. Let M be a nondeterministic Turing machine. Let f : N N be a function such that M operates within time f(n). Then there is a nondeterministic Turing machine M ′ that is P-time equivalent to M and whose running time depends only on the size of the input.

Proof. We know that, for some c, k in N, f(n) ≤ cn k . We construct a Turing machine M ′ that decides an input of M of size n precisely in time f ′ (n), for some other function f ′ : N N. The machine M ′ has two tapes. The alphabet of the first tape is the same as the alphabet of M . The alphabet of the second tape has m symbols, where m = 2 k + c ′ such that m log 2 n > cn k . Such m exists and it is fixed and does not depend on n. Suppose without loss of generality that it consists of the symbols 1, . . . , m. Then every execution of M ′ is as follows:

• The head of the first tape of M ′ scans it and writes on the second tape the sequence of 1s of length ⌈log 2 n⌉. This procedure takes the same amount of time for any input on the tape 1 of size n.

• Then, M ′ does the same things as M for this input. And, for the tape 2, M ′ acts as a deterministic Turing machine. It consequently writes all the ⌈log 2 n⌉-sequences consisting of numbers from 1 to m. For m large enough, the execution for the tape 2 always stops after the execution for the tape 1. At the end, it is always in the accepting state.

The machine M ′ accepts the input if it both tapes answer YES. Otherwise it rejects the input. By construction, it is equivalent to M . And it is well-known, see [START_REF] Papadimitriou | Computational complexity[END_REF], that a machine with two tapes can be simulated by a machine with one tape. Thus, it is possible to construct an equivalent machine such that its running time depends only on the size of the input.

The next lemma states that without loss of generality we can assume that the movement of the head of the machine is the same for any two input instances of the same size. For a Turing machine M , we construct an oblivious Turing machine M o . The movement of head of M o is always the same: for every iteration of M , the head of M o walks to the right end of the tape, increases the tape size by 1, and then walks to the left end of the tape, see then M o halts, for any input of size n, in f o (n) steps, where:

f o (n) := 2n + 2(n + 1) + . . . + 2(n + f(n)) = (f(n) + 1)(2n + f(n)).
Lemma 2.3.2. For any nondeterministic Turing machine M with a one-way infinite tape whose running time depends only on the size of the input, there exists a P-time equivalent oblivious nondeterministic Turing machine M o with a one-way infinite tape.

Proof. Let M have the alphabet Σ = {s 1 , . . . , s k , ▷, ⊔}, where ▷ is the first symbol and ⊔ is the blank symbol; and the states Q = {q 0 , . . . , q m }, where q 0 is the starting state. Firstly, we describe the alphabet Σ o and the set of states Q o of M o .

• For s in Σ ∖ {▷, ⊔}, add to Σ o two symbols: s, s h . The h-superscript helps to remember the position of the head of M . Instead of one blank symbol in Σ, Σ o has three symbols: ⊔, ⊔ ′ , ⊔ ′h . ⊔ is written in cells that are not visited by the head of M o . ⊔ ′ is written in those cells that are blank but the head of the machine M potentially could have already visited them. ⊔ ′h , similarly as s h , informs the head of M o that the head of M is at the same cell. At last, add the first symbol ▷ to Σ o .

• Any state q i in Q is replaced by two states: q L i , q R i in Q o -they highlight the head movement direction (Left or Right). Then, for every pair of states q i , q j of Q, we add four states to Q o : q L i j and q R i j and q R i j(write) , q i j(write) -they are used when M o simulates the transition of M . And also we add to Q o states q start , q search , q return that are used at the start of the execution in order to check if the input of M o is associated with the input of M ; q start is the starting state. And, finally, for every newly added state, we add a copy of it that is labeled with the word "error", e.g. for q R i we add q R,error i . For every state of the type q, the corresponding state of the type error does the same function but, in this case, at the end of the execution, the machine always answers YES.

We explain how M o works. Our informal explanation is followed by an explicit description of M o .

We assume that for every input tape there is N in N such that the first cell contains ▷, next N cells contain symbols of Σ o ∖ {▷, ⊔}, and every other cell contains the blank symbol ⊔. We also assume that the head of M o is in the first cell of the tape and in the state q start when the execution starts.

Informal description of M o . We want to check if the input of the machine M o is associated with an input of the machine M . It must have the following form: the first cell must contain the first symbol ▷, the next n cells must contain an element of Σ ∖ {▷, ⊔}, and all other cells must contain ⊔.

Check if the input of M o is exactly like an input of M . At the start of any execution, the head turns into the state q search and moves to the right end of the input in this state. When it reads the blank symbol ⊔, it turns into the state q return and moves back to the initial position in this state. During the left-to-right walk, the head scans every cell and changes the state to q error search if the cell contains an element not from Σ ∖ {▷, ⊔}. The head edits the bad cell by writing in it a symbol from Σ ∖ {▷, ⊔}. Thus, when the head returns back to the initial position, the input of the machine is of the right form. But the machine already knows that there is an error, and it shall accept this input at the end of the execution anyway.

Simulate one move of M by two walks: left to right, then right to left. After this scanning and editing procedure, the machine M o starts the simulation of the execution of M . Every move of the head of M is associated with the walk of the head of M o towards the right end of the tape and its return to the left end. The head of M o moves to the right, until it scans the first cell with the blank symbol ⊔. It rewrites ⊔ to ⊔ ′ in order to mark that during the next walk it does not have to stop at the same cell and can make one more step to the right. Then it returns to the left end of the input string.

If the head is at a cell with a symbol s without the h-superscript, then the head of M o does not rewrite the symbol and keeps walking in the same direction.

Any cell, except for the first and the last ones, is visited by the head of M o exactly two times: when it goes left-to-right and right-to-left. Suppose that the head of M o scans a cell that contains s h and that the original Turing machine M is in the state q i now. As it is non-deterministic, there is more than one possible transition from this configuration. For every transition when M decides to move to the right, M o simulates this transition during the left-to-right walk, and for every transition when M decides to move to the left, M o does this when the head is returning to the left end. Suppose that the head of M o is moving towards the right end now, that it is in the state q R i , and that it reads s h from the current cell; then the machine M o can do one of the following things.

right : M o decides to simulate one of the possible transitions of M for the configuration (q i , s) when, during the transition, the head of M moves to the right, e.g. (q i , s) (q j , s ′ , ). In this case, M o changes its state to q R i j(write) , writes s ′ , and moves one cell to the right. Then it changes to the state q R i j and, for the symbol s 1 of this new cell, writes s h 1 and keeps walking to the right end. Then it changes to the state q L i j and walks towards the left end. And, at the left end, it changes to the state q R j and repeats the walk. See Figure 2.5 on page 46.

left : The machine M o decides to simulate one of the transitions when the head of M walks to the left. In this case, M o does not change its state q R i until it is at the right end of the tape. Then it turns to the state q L i , arrives to the cell with s h during the right-to-left walk and does the steps similar to those from the previous case.

If the head of M is at the first cell, then it always moves to the right. This means that M o must simulate this movement when it is going to the right from the first cell.

Any state of the type error is similar to the corresponding one of the type q. The only difference is that at the end of the execution the machine in an error-type state always answers YES.

Explicit description of M o We give below the transitions of M o . For the sake of brevity, we do not write the transition rules for the states of the type error as they just repeat the transition rules of the usual states, and, once M o is in an error state, it will always be in an error state.

Transitions checking the input. If the cell, where the head of M o is before the run, contains something different from ▷, then the machine turns to the q error search state, writes ▷ in the first cell, and starts walking to the right. If the first cell contains ▷, then the machine writes nothing and just walks to the right while being in the state q search . ∀s ̸ = ▷ (q start , s) (q error search , ▷, ) ,

(q start , ▷) (q search , ▷, ).
When the head of M o walks to the right: either it meets a symbol not from Σ, edits it to a symbol from Σ, changes the state to q error search , and keeps moving to the right; or it edits nothing and keeps moving to the right. ∀s ̸ ∈ Σ (q search , s) (q error search , s 1 , ) , for some arbitrary ∀s ∈ Σ ∖ {▷, ⊔} (q search , s) (q search , s, ) .

s 1 ∈ Σ, ▷ s q i ▷ s ′ q j s 1 s 1 M ▷ s h q R i ▷ s ′ q R i→j(write) s 1 s 1 M o ▷ s ′ q R i→j s h 1 ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ ▷ s ′ q R i→j s h 1 ⊔ ⊔ ▷ s ′ q L i→j s h 1 ⊔ ′ ⊔ ▷ s ′ q L i→j s h 1 ⊔ ′ ⊔ ▷ s ′ q R j s h 1 ⊔ ′ ⊔ ▷ s h q R i s 1 ⊔ ⊔ . . . . . . . . . . . . . . . . . .
Now we describe what the head does when it reaches the right end. Observe that, when the machine is at the right end and in the state q search , the tape already has a good form, so we do not need to edit it anymore.

(q search , ⊔) (q return , ⊔ ′ , ), ∀s ∈ Σ o ∖ {▷} (q return , s) (q return , s, ) .
When the head of M o returns to the first cell, it simulates the first move of M . Suppose that M has the following transition rule:

(q 0 , ▷) (q i 1 , ▷, ), . . . , (q i k , ▷, ) ;
then M o has the following transition rule:

(q search , ▷) (q R 0 i 1 (write) , ▷, ), . . . , (q R 0 i k (write) , ▷, ) . For q i , q j in Q, the states q L i j(write) , q R i j(write) are used when the head of M o simulates the change of the head position of the initial machine M . The head of M o adds the h-superscript to the symbol of the next cell. Thus, M o must have the following rules for any symbol of Σ o ∖ {⊔, ▷} without the h-superscript:

∀q i , q j ∈ Q, s ∈ Σ ∪ {⊔ ′ } ∖ {⊔, ▷} (q R i j(write) , s) (q R i j , s h , ) , ∀q i , q j ∈ Q, s ∈ Σ ∪ {⊔ ′ } ∖ {⊔, ▷} (q L i j(write) , s) (q L i j , s h , )
. Note that by construction, the head of M o cannot be simultaneously in the state of the type q i j(write) and scan the symbol ⊔. The head cannot be in the first cell (that contains ▷) in a state of the types q R i j , q R i j(write) , as there is no cell to the left from the first cell. However, it can be at the first cell in a state of the type q L i j(write) . We will describe this case later.

If the head of M o , being in a state not of the type q i j(write) , reads a symbol without the h-superscript, then it does not change the symbol and keeps moving further:

∀q i , q j ∈ Q, s ∈ Σ ∪ {⊔ ′ } ∖ {⊔} (q R i , s) (q R i , s, ) , ∀q i , q j ∈ Q, s ∈ Σ ∪ {⊔ ′ } ∖ {⊔} (q R i j , s) (q R i j , s,
) , and similarly for the right-to-left direction:

∀q i , q j ∈ Q, s ∈ Σ ∪ {⊔ ′ } ∖ {⊔} (q L i , s) (q L i , s, ) , ∀q i , q j ∈ Q, s ∈ Σ ∪ {⊔ ′ } ∖ {⊔} (q L i j , s) (q L i j , s,
) , If the head of M is not at the first cell, then, for a rule

(q i , s) (q j 1 , s j 1 , D 1 ), . . . , (q jm , s jm , D m ) of M , we write a rule (q R i , s h ) (q R i j k (write) , s j k , ) for any k in [m] such that D k = ; and if D k = , then we write a rule (q L i , s h ) (q L i j k (write) , s j k , ),
and we also want to let the head of M o pass s h when it moves left-to-right:

(q R i , s h ) (q R i , s h , ).
If the head of M o is in a state of the type q i j , then it has simulated the current transition of M and is returning now to the first cell in order to change its state to q R j .

∀s ∈ Σ o ∖ {▷, ⊔} (q R i j , s) (q R i j , s, ) , ∀s ∈ Σ o ∖ {▷, ⊔} (q L i j , s) (q i j , s, ) .
By construction, M o reaches the right end in one of the states of the type: q R i , q R i j , for some i, j. In this case, it pushes the right end one cell to the right by changing ⊔ to ⊔ ′ and starts moving to the left:

(q R i , ⊔) (q L i , ⊔ ′ , ), (q R i j , ⊔) (q L i j , ⊔ ′ , ).
When it returns to the first cell, it turns into the state q R j and moves to the right:

(q L i j , ▷) (q R j , ▷, ).
It remains to explain what M o does when the head of M moves to the first cell. Consider the following situation, it is displayed on Figure 2.6 on page 48. The head of M is in the second cell with a symbol s, being in the state q i . Then it rewrites s to s ′ , moves one cell to the left and arrives to the first cell being in the state q j . And then it moves one cell to the right and turns into the state q k . In total, there are two moves of the head of M . As each move of M is associated with a walk of M o left-to-right and back, the head of M o must simulate these two moves with two walks. It starts the first walk at the first cell and turns into the state q R i . Then it passes the second cell from left to right and does nothing. Then it reaches the end of the tape and turns into the state q L i . When it visits the second cell again, it turns into the state q L i j(write) , rewrites s h to s ′ , and moves to the first cell. Then it acts according to the following rule:

(q L i j(write) , ▷) (q R j k(write) , ▷, ).
As it arrives to the second cell again, being in the state q R j k(write) , it has to rewrite s ′ to s ′h , turn into the state q R j k and continue walking to the right. When it arrives to the end of the tape, it turns into the state q L j k and walks left. Eventually, it arrives to the first cell and turns into the state q R k . With this setting, one move of M is associated with one left-right-left walk, thus, M o does not violate the obliviousness property. We have explained how M o executes. Every execution for the input of size n will take the same amount of time f o (n) as the running time of the machine M depends only on the size of the input. The movement of the head of M o is also the same for all input instances of the same size. We conclude that M o is oblivious. Moreover, M o is P-time equivalent to M , because if the input of M o is not of the form that fits M , then we reduce to a fixed YES instance of M , and if it is of the good form, then we reduce to the same input tape of M . The reduction from M to M o is the identity. Lemmas 2.3.1 and 2.3.2 together imply the following.

▷ qi ▷ M ▷ M o ▷ ⊔ ⊔ ⊔ ▷ ⊔ ▷ ⊔ ′ ⊔ ▷ ⊔ ′ ⊔ ▷ ⊔ ′ ▷ q R i ⊔ ⊔ . . . . . . . . . . . . . . . . . . s s ′ qj ▷ s ′ qk s h q R i ⊔ ′ ⊔ ′ s h s h q L i ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ ⊔ s ′ q L i→j(write) q R j→k(write) s ′ s ′h s ′h q R j→k . . . . . . ⊔ ′ q L j→k ▷ ⊔ ′ ⊔ s ′h . . . . . . ⊔ ′ q R k
Corollary 2.3.3. For any Turing machine there exists a P-time equivalent oblivious Turing machine with a one-way-infinite tape.

By Corollary 2.3.3, it is sufficient to show the existence of an MMSNP ̸ = sentence that is P-time equivalent to a given oblivious Turing machine M o with a one-way-infinite tape, for any such M o .

Construction of the MMSNP ̸ = sentence

Let an oblivious Turing machine M o be the same as in the proof of Lemma 2.3.2.

• M o has the alphabet Σ o := Σ ⊎ {s h | s ∈ Σ ∖ {▷, ⊔}} ⊎ {⊔ ′ , ⊔ ′h }.
• It has the states Q o : q start , q search , q return in Q o ; then, for every q i in Q, q L i , q R i in Q o ; and, for every two distinct q i , q j in Q: q L i j , q R i j , q L i j(write) , q R i j(write) ∈ Q o ; and Q o contains all the error-copies of each of these states.

The input A of the MMSNP ̸ = sentence Φ to be constructed shall be a canvas for a space-time diagram of a run of M o . The expressing power of the inequality allows us to forbid the structure A to be over-complete, that is, to have more than one tuple of the same relation that are incident to the same element. For example, by using of the inequality, we can require that all the out-and in-degrees of digraph elements are at most one.

However, we cannot forbid the structure A to be incomplete, that is, not to have tuples where they ought to be. This is because any MMSNP ̸ = formula is monotone with respect to τ -relations. For example, we cannot require that all the out-and in-degrees are precisely one.

The main difficulty of the proof is to come up with an encoding that can be dealt with using the expressivity of MMSNP ̸ = when A is not of the correct form.

We are planning to construct Φ in MMSNP ̸ = such that, for any input structure A:

• if A is over-complete, then A ̸ |= Φ, • if A is not complete enough to simulate a run of M o , then A |= Φ,
• if A is in an appropriate form and can simulate a run of M o that returns YES, then

A |= Φ,
• if A is in an appropriate form and can simulate a run of M o that returns NO, then A ̸ |= Φ.

By an appropriate form we mean the form of a two-dimensional (space-time) grid. It is formed by horizontal succ-arcs directed from left to right and by vertical next-arcs directed from top to bottom. Every row of this grid represents the tape at some moment of time t. The row below is the tape at the next moment t + 1, and the row above stands for the moment t-1. Every element of a row is connected to the first and the last member of the row with a ternary relation between, this will allow us to require some properties precisely from all the elements of the tape at some fixed moment of time. The contents of the tape -the symbols, the states, the positions of the head -are encoded with both input and existential relations.

The input relations are represented by a signature τ :

τ = {s(•) | s ∈ Σ} ⊎ {start(•), succ(•, •), next(•, •), between(•, •, •)},
where

• start(x) represents a constant that highlights the grid element that is associated with the leftmost element of the tape, where the head must be at the start of the execution;

• succ(x, y) -a horizontal arc, it means that the cell corresponding to y is the right neighbour of the cell corresponding to x on the tape;

• next(x, x ′ ) -a vertical arc, it means that x ′ represents some cell of the tape at the time t, and x represents the same cell at the time t + 1;

• s(x), for each s in Σ, means that the symbol s is written in the cell corresponding to an element x; these relations matter only in the first row, where they set the initial values for the corresponding existential relations;

• between(x, y, z) means that y represents an element of a tape that starts at x and ends at z.

The existential relations are represented by a signature σ. All of them must be unary. In order to distinguish τ -relations from σ-relations, we write the name of each σ-relation with an initial upper case letter while every τ -relation starts with a lower case letter. This is convenient because there are both input and existential relations that describe symbols on the tape and that are named identically up to the letter case.

σ = {S(•) | s ∈ Σ o } ⊎ {Marked(•), Head(•)} ⊎ {Q(•) | q ∈ Q},
where • S(x), for s in Σ o , means that the cell corresponding to x contains a symbol s;

• Marked(x) has the same role as in the proof of Theorem 2.0.2: it marks the elements that need to be considered;

• Initial(x) highlights the elements corresponding to the initial configuration of the tape, it is used in order to generate all Marked elements;

• Head(x) means that the head of M o is at the cell corresponding to x;

• Q(x) means that the cell corresponding to x belongs to the tape at the moment of time when the machine is in the state q.

Below, we provide the conditions that force an element to be Marked. We require that the elements of the first row are Initial, where the first row consists of all x such that between(a, x, a ′ )∧start(a). We demand every Initial element to be Marked. And then we force Marked relation to spread from an element to its bottom next-neighbour if the structure contains all the necessary tuples around this point. Simultaneously, we set the values for existential relations that are associated with alphabetical symbols as we do not want to have an Initial element that is associated with a cell with no symbol. For any s in Σ, we add the following conjuncts to Φ:

start(a) ∧ succ(a, x) ∧ next(a, a ′ ) ∧ between(a, x, a ′ ) ∧ s(x) Initial(x) ∧ S(x) ∧ Head(x) ∧ Q start (x), start(a) ∧ Initial(x) ∧ succ(x, y) ∧ between(a, y, a ′ ) ∧ next(a, a ′ ) ∧ s(y) Initial(y) ∧ S(y),
we require that every element of the row highlighted with start must be Initial, except for the start itself. We also want the structure to be complete with respect to between and next, i.e., an element does not need to be Initial if any such tuple is missing.

In the same rule we assign the existential symbol relations S(•) depending on the input symbol relations s(•), and also demand that the Head is in the leftmost cell (the right succ-neighbour of the start element) in the state Q start . See Figure 2.7 on page 51 for a graphical representation.

Initial elements generate all the Marked elements. Firstly, we require that all the elements of the first row are Marked: Initial(x) Marked(x). Secondly, we force the relation Marked to spread from top to bottom via next-arcs. If the neighbourhood of an element y ′ has one of the four appropriate patterns from Figure 2.8 on page 52 and if its next-predecessor y is Marked, then y ′ must also be Marked. It will be more convenient to display them as graphs, see Figure 2.8. As the corresponding formulae are rather difficult to read. We explicitly write only the rule corresponding to Figure 2.8a. It goes as follows.

     succ(a, y) ∧ succ(y, z) ∧ succ(a ′ , y ′ ) ∧ succ(y ′ , z ′ )∧ next(a, a ′ ) ∧ next(y, y ′ ) ∧ next(z, z ′ ) ∧ next(a ′ , a ′′ )∧ between(a, y, a ′ ) ∧ between(a, z, a ′ ) ∧ between(a ′ , y ′ , a ′′ )∧ between(a ′ , z ′ , a ′′ ) ∧ Marked(y) ∧ Marked(z)      Marked(y ′ )
We want from the relations that represent the states to be a partition:

¬ q∈Q ¬Q(x) ∧ q,q ′ ∈Q ¬ Q(x) ∧ Q ′ (x) ,
and that two points at the same row of the grid (i.e., from the tape at the same moment of time) can not have different states, thus, they are in precisely one state: x y

q,q ′ ∈Q ¬ (between(a, x, a ′ ) ∧ between(a, y, a ′ ) ∧ next(a, a ′ ) ∧ Q(x) ∧ Q ′ (y)) .
x y a a a (c) y is at the end of the tape. The head is not at y, this is highlighted with a cross. Then, at the next moment of time, the tape will not be augmented. If x, y are Marked, then y ′ has to be Marked.

x y

x y z a a a (d) y is at the end of the tape. The head is at y, this is highlighted with a large circle. Then the tape will be augmented with z ′ . Both y ′ , z ′ have to be Marked and the head has to move upon x ′ . The relations S, for s in Σ o form a partition, as a cell cannot contain two different symbols simultaneously:

¬ s∈Σo ¬S(x) ∧ s,s ′ ∈Σo ¬ S(x) ∧ S ′ (x) .
The symbol predicates S(•), for s in Σ o ∖ {⊔}, are propagated from top to bottom when the predicate Head is not upon the considered element. These symbol predicates can change only when Head is present. This is because a machine can change the contents of the tape only with its head. For every s in Σ o ∖ {⊔} and the corresponding relation S written in upper-case, we write:

Marked(x) ∧ ¬Head(x) ∧ S(x) ∧ next(x, x ′ ) S(x ′ ). (2.1)
We shall add constraints for the Head movement when we provide the formulae that describe the transitions of M o . There is only one other constraint for the Head relation. It states that at any moment of time there cannot be two different cells of the tape where the Head is at:

between(a, x, a ′ ) ∧ between(a, y, a ′ ) ∧ next(a, a ′ ) ∧ Head(x) ∧ Head(y) x = y. (2.2)
The head of M o is on the initial cell containing ▷ at the start. We have one element to the left of ▷ in our structure so the conjunct will not be start(x) Head(x) but something morally similar. Squares with ⊔, ⊔ ′ are relations corresponding to the blank symbol that highlights the end of the tape and to the blank symbol that can be written in the middle of the tape. Large circles stand for the state relations.

⇒ ⇐ ⇐ ⇐ ⇒ ⇐ ⇒ ⇐ h ⇐ h ⇒ ⇒ w ⇒ w ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ∨ ∨ • • • ∨ ⇒ h h h h w w ⇒ h ⇐ ⇒ h ∨ • • • ∨ w w ⇐ ⇐ ⇐ h ⇐ ⇒ ⇐ w w ⇒ ⇒ ⇒ ⇒ ⇒ ⇐ ⇒ ⇐ ; ; ⇒ 1 2 3a 3b 4 5 6a 6b
If two circles have the same colour, then they are associated with the same relation. A letter w near the circle means that the head is in a state of the type q i j(write) . Symbols ⇐ and ⇒ near circles denote the direction of the walk. A symbol ⇒ between structures means that the left structure represented as the conjunction of all the corresponding atomic formulae implies any atomic formula that is present on the right structure and absent on the left. Symbols ∨ • • • ∨ mean that the structure on the left implies one of the structures on the right.

The formulae are displayed on Figure 2.9 on page 53. The figure has 6 lines. Every line is associated with a class of head transitions. Every such class is described by an implication between (τ ⊎ σ)structures. The caption of Figure 2.9 explains the meaning of every detail of the figure. We describe the transitions one by one. Observe that in the base of every implication the element with the Head is Marked. This means that if the Head comes into a non-Marked element, then no transition rule has to be used.

1. The first line describes the case when the Head is in the first cell. The transition of M o is always deterministic when the first symbol ▷ is read. During the transition the Head writes the same symbol and then moves right. The new state is uniquely determined by the state in which the machine was before the transition. The corresponding rule of M o is of the following form: (q L i j , ▷) (q R j , ▷, ). Below, we write the formula that is associated with this rule:

     between(a, y, a ′ )∧ succ(a, y) ∧ succ(y, z) ∧ succ(a ′ , y ′ ) ∧ succ(y ′ , z ′ )∧ next(a, a ′ ) ∧ next(y, y ′ ) ∧ next(z, z ′ )∧ Marked(y) ∧ Head(y) ∧ S ▷ (y) ∧ Q L i j (y)      S ▷ (y ′ )∧ Head(z ′ ) ∧ Q R j (z ′ )
.

For brevity, we write the formula only for one case, as, for other cases, the formulae can be written similarly.

2. The second line describes the situation when the Head is in the last cell. By the form of the input tape, the last cell is the cell that contains the blank symbol ⊔. When the Head of M o is reads ⊔, then the transition is deterministic. For any possible state of M o , the Head rewrites ⊔ to ⊔ ′ and moves to the left. The new state is uniquely determined by the previous state. As the length of the grid increases every time when the head reaches its end, we also assign the relation ⊔(•) to the newly added element.

3. The third line contains two rules that are similar to each other. They describe the case when the Head reads a symbol in the middle of the tape that does not contain the h-superscript. This means that the transition is deterministic: the Head does not rewrite the symbol and keeps moving in the same direction. This line also describes the situation when the Head has done the transition and now is returning to the first cell in order to start a new tour.

4. The fourth line is associated with the case when the Head is moving towards the right end and reads a symbol with the h-superscript. This means that it can imitate some of the transitions of the original Turing machine M , where the Head moves to the right. In this case, the Head of M o has a choice: either to continue moving further and imitate the transition when it visits this cell for the second time, or to imitate one of the transitions. If it decides to imitate them now, then it rewrites the symbol according to the transition, and turns into a state of the type q i j(write) in order to add the h-superscript to the next symbol.

5. The fifth line is associated with the case when the Head is moving towards the left end and reads a symbol with the h-superscript. This case is similar to the fourth line, but now the Head cannot do nothing and keep moving. It is the last time when it visits this cell, so it has to do the transition now.

6. The sixth line contains two similar rules. Each of them is associated with the case when the Head is in a state of the type q i j(write) and it reads a symbol without the h-superscript. In this case it adds the h-superscript to the symbol highlighting that the head of the original machine M changes its position. After doing this it keeps moving to the same direction.

We have described how to represent the transition rules of M o in the language of MMSNP ̸ = . We know that M o rejects the input if at the end of the execution it is in a rejecting state. We are going to reject the structure if, for some point x, it has both Head and Q reject at this point (for any Q reject that is associated with a rejecting state of Q):

¬ Marked(x) ∧ Head(x) ∧ Q reject (x) (2.3)
We have explained all the rules that describe the behaviour of the existential predicates. This is sufficient to show that the problem corresponding to M o can be reduced to SAT(Φ), where Φ is a sentence from MMSNP ̸ = with the existential predicates from σ, the input relations from τ , and the quantifier-free part is the conjunction of all the formulae mentioned earlier in this proof. Proof. For a tape of length n, we reduce to a grid that consists of f(n) rows, where f is the running time of M o . The horizontal arcs are succ, the vertical are next, each element of the row is connected by between with the start of this row and with the start of the next row. The start of a row is the succ-successor of the end of the precedent row. As every time the the head reaches the right end of the tape, it extends the tape by one cell, we need to augment the length of each row by 1 every time the head reaches its end. So, the first n rows of the grid have length n, the next 2(n + 1) rows have length n + 1, and so on. The top-left element of the grid has the predicate start. And the elements of the first row have predicates from {s(•) | s ∈ Σ o } that are associated with symbols in the cells of the tape. Such a grid is displayed on Figure 2.10 on page 55. By the construction of Φ and the construction of the grid, every grid element has to be Marked unless it is the leftmost element of a row. For the predicate Head there is only one possible interpretation on the set of Marked elements. See Figure 2.11 on page 56.

As any element that is associated with a cell of the tape is Marked and as the Head movement coincides with the one of M o , we conclude that this grid is accepted by Φ if and only if all the conjuncts from eq. (2.3) are satisfied. That is, if and only if M o does not reject its input tape. This proves the reduction.

We need to show the other direction of P-time equivalence. That is, for any relational τ -structure, either we need to solve SAT(Φ) in time polynomial in the structure size or we need to reduce this τ -structure to an equivalent tape of M o .

In order to do this we have to treat all the input that does not look like a grid from Figure 2.11. We are going to use ̸ = to forbid all the inputs that are over-complete. Informally speaking, ̸ = helps us to forbid degrees two or more and to forbid two or more appearances of a predicate.

Let us list these conditions, which are displayed on Figure 2.12 on page 57:

• there can be at most one point highlighted with start:

¬(start(x) ∧ start(y) ∧ x ̸ = y),
• every element may have at most one in-neighbour and at most one out-neighbour with respect to succ and next:

¬(succ(x, y) ∧ succ(x, y ′ ) ∧ y ̸ = y ′ ), ¬(succ(x, y) ∧ succ(x ′ , y) ∧ x ̸ = x ′ ), ¬(next(x, y) ∧ next(x, y ′ ) ∧ y ̸ = y ′ ), ¬(next(x, y) ∧ next(x ′ , y) ∧ x ̸ = x ′ ),
• every element can not belong to several tapes at the same time, that is, it can participate in at most one between-tuple:

¬(between(x, y, z) ∧ between(x ′ , y, z ′ ) ∧ x ̸ = x ′ ), ¬(between(x, y, z) ∧ between(x ′ , y, z ′ ) ∧ z ̸ = z ′ ),
• if an element is on the 1st or on the 3rd coordinate in a between-tuple, then it can not be on the second coordinate of another between-tuple:

¬ between(a, x, b) ∧ between(a ′ , a, b ′ ) , ¬ between(a, x, b) ∧ between(a ′ , b, b ′ ) ,
• loops of any kind are forbidden:

¬succ(x, x), ¬next(x, x ′ ), ¬between(a, x, a), ̸ = ̸ = ̸ = ̸ = ̸ = ̸ = ̸ = Figure 2
.12: A graphical representation of forbidden conjunctions. Red squares are start elements. Arcs with black heads are succ-arcs. Arcs with white heads are next-arcs. Closed curves are between-triples.

Red and blue disks are different input symbol relations s, s ′ .

• a point can belong to at most one symbol relation, that is, for each s, s ′ in Σ o , we add:

¬ s(x) ∧ s ′ (x) .
Observe that grids corresponding to tapes satisfy all these sentences. Thus, if we add them to Φ, the reduction from NP to MMSNP ̸ = still works correctly.

Informal outline of our reduction from SAT(Φ) to M o . For some input τ -structure A, we first check if it omits all the forbidden patterns from Figure 2.12. If it does, then we can understand which elements must be Marked, and at which elements the Head has to be. We shall argue that without loss of generality one needs to consider the minimal by inclusion interpretations of the Marked and Head relations. For an oblivious Turing machine, we know exactly how much time we do need to finish the execution. Thus, we can just see if the size of the substructure induced on Marked elements is large enough to achieve it. If the size is not large enough, then we are certain that the head never reaches a rejecting state, thus, all the conjuncts of Φ are satisfied. In this case we reduce the structure to some input instance of M o that is accepted by the machine. If the substructure induced on Marked elements is sufficiently large to finish the execution, then the input instance of M o is provided by the first row of the grid.

Lemma 2.3.5. SAT(Φ) reduces in P-time to L(M o ).

Proof. It takes P-time to check if the input structure A of SAT(Φ) satisfies conditions given on Figure 2.12 as they all are first-order formulae. If it is rejected, then we reduce it to some input instance rejected by M o . If not, then we use the following claim in order to understand which elements of A must be Marked and reconstruct the movement of the Head.

Claim 2.3.6. Among all valid interpretations of the relations Marked and Head there exist unique minimal by inclusion interpretations, and, if Φ holds on A, then there exists a valid assignment of σ-relations such that Marked A and Head A are minimal by inclusion.

Proof of the Claim. Denote by a 0 an element of A such that start(a 0 ); if such element does not exist, then no element is forced to be Marked. Denote by C m ⊆ A the set of elements that are forced to be Marked. It is defined inductively. Firstly, we add to C m the right succ-neighbour of a 0 ; then we put the neighbour of the neighbour and so on, by using the formulae from Figure 2.7 on page 51. Eventually, we add all the elements that are forced to be Initial. Then, we use the formulae from Figure 2.8 on page 52 and add every element that is forced to be Marked by one of the rules. Repeat this until no more element can be added.

We now know that in-and out-degrees of succ-and next-arcs of A are at most one. Thus, we can assign to every element of C m a pair of natural numbers. Assign (1, 0) to the right succ-neighbour of the start, assign (2, 0) to the neighbour of the neighbour, and so on. For the bottom next-neighbour of (i, j), we assign (i, j + 1). One can prove by induction that, for any x, y in C m with coordinates (i x , j x ), (i y , j y ), we have succ A (x, y) if and only if i x + 1 = i y and j x = j y ; also, a similar statement is true for next-arcs, and for between-triples as well: x and y are on the same row if and only if j x = j y .

We show that any interpretation Marked A either contains C m as a subset or does not satisfy Φ. If there is x in C m such that x ̸ ∈ Marked A , then choose such x that is added to C m at the earliest possible moment. Then, as x is not Marked, it does not satisfy one of the formulae from Figures 2.7 and 2.8, as all its predecessors are Marked.

Suppose that A |= Φ and Marked A = B is the interpretation of a solution. We show now that if we set Marked A = C m , then this assignment is still satisfiable. Suppose that it is not satisfiable, thus, some conjunct of Φ is false. It cannot be a rule from Figures 2.7 and 2.8, as C m satisfies them. And there are no conjuncts with an atomic Marked formula that has an even number of negations before it. This means that all other conjuncts cannot be violated because of the Marked relation. All other relations being the same, we conclude that Φ is also satisfied when Marked A = C m . We have proved that without loss of generality we can assume that the relation Marked is interpreted as the minimal possible one. Now we proceed similarly for the relation Head. We define a set C h as follows. Firstly, add the right succ-neighbour of a 0 to C h (only if it belongs to C m ). Then, follow the rules that are responsible for the head movement, i.e., those that simulate the transitions of the Turing machine displayed on Figure 2.9 on page 53. Recall that any transition rule is fired only if the current Head element is Marked; also recall that the movement of the Head is unambiguous. This means that there is at most one Head element that is not in C m : it is the last element that is added to C h .

Similarly as for C m , for any interpretation Head A , either C h ⊆ Head A or a rule of Φ that describes the transition is not satisfied in A.

Suppose that there is a satisfiable assignment for the existential relations of Φ, where Head A = B ⊋ C h . We show now that if we set Head A = C h , then the assignment is still valid. Suppose that it is not valid when Head A = C h ; then there is a conjunct of Φ that is not satisfied. This conjunct has to contain a Head-atom that is true when Head A = B and that is false when Head A = C h . This means that this atom has an even number of negations before it. The only conjunct that can be false and that has a Head-atom is eq. (2.1), it means that, if there is no Head at a cell, then this cell contains the same symbol as before at the next moment of time. This means that, when Head A = B, it can put the Head where it is not supposed to be and change the symbol written on the tape such that the Head is never in a rejecting state.

When Head A = C h , we need to satisfy this conjunct, so we need to change the interpretation of the relation S such that the new interpretation satisfies the conjunct. That is, if the head is not at the cell, the symbol written in the cell stays the same at the next moment of time. If with this new interpretation S A every conjunct is satisfied, then we are done. Suppose that it is not satisfied; then the only type of negated conjuncts that are false is the one that is associated with M o being in a rejecting state:

¬ Marked(x) ∧ Head(x) ∧ Q reject (x) .
We use the fact that one can assign a pair of coordinates to any element of C m . By eq. (2.2), no two points x, y with coordinates (i x , j x ), (i y , j y ) can belong to Head A if j x = j y . By the construction of C h , we know that, if an element x with coordinates (i x , j x ) belongs to C h , then, for any j ′ < j x there exists x ′ in C h with its second coordinate equal to j ′ . So, for any b in B ∖ C h and for any x in C h , the second coordinates cannot be the same: j b ̸ = j x . Thus, in the case when Head A = B, changing a symbol on the tape does not change the rejecting state of the machine at the last point of C h . This is a contradiction as we suppose that Φ is satisfied when Head A = B. See Figure 2.13 on page 59 for a graphical representation of this proof. Now we can prove Lemma 2.3.5. We know now that without loss of generality we can interpret Marked and Head as C m and C h . We can construct these two sets in time linear of the size of A. We know that M o decides an input of size n in exactly f(n) steps. The size of the input is equal to N = max{i | (i, 0) ∈ C m }. Then we see if C h ∩ C m contains an element with its second coordinate equal to f(N ). If it does, then we know that the structure is large enough to simulate the execution of M o , and we associate it with a string of symbols written in cells (1, 0), . . . , (N, 0). Otherwise any element of C h ∩ C m has a too small second coordinate, so no negated conjunct of the following type can be false:

¬ Marked(x) ∧ Head(x) ∧ Q reject (x) .
This means that A |= Φ, and we associate with A some YES instance of M o .

Together, Lemmas 2.3.4 and 2.3.5 prove Theorem 2.0.3.

Why oblivious Turing machines are necessary? In this paragraph we explain why the proof of Theorem 2.0.3 works only for oblivious Turing machines. We use this property in the proof of Lemma 2.3.5, where we reduce MMSNP ̸ = back to NP. Suppose that the Turing machine is not oblivious; then the head movements and the execution time can be arbitrary. We can make the input to look like a two-dimensional grid. But we cannot manipulate its height (the number of rows) and width (the number of columns). If the Turing machine is oblivious, then we know the exact head movement and the time of the execution. Consider two grids that are displayed on Figure 2.14. If the head movement is oblivious, then it will perform as we expect, for every grid that is in a good form. If the grid is too short in terms of height and width, then the execution will not be finished, then the rejecting state will never be reached, this means that such short input will never be rejected. However, if the movement is not oblivious, then, for some input string, it can be rejected arbitrarily quickly. This means that we cannot predict if a short grid is sufficient to imitate the whole execution leading to a rejecting state. The right two-dimensional grid is an example of a short grid: the red dashed line marks the boundary, everything beyond it is deleted. The white circles mark the head movement. The execution time is small enough to reject the input encoded in the first row.

Figure 2.14: On the left, there is a space-time grid in a good form. On the right, there is a space-time grid in a bad form.

Chapter 3

Guarded extensions of MMSNP

We consider extensions of MMSNP that allow for a limited relaxation of some of the constraints imposed on MMSNP, namely absence of inequalities and monotonicity in the input signature. This limitation on the relaxation of a constraint involves guardedness.

We describe two such guarded fragments of MMSNP ̸ = and MonotoneSNP that both extend MMSNP. The objective is to study these two classes with respect to having a dichotomy. We first show that MMSNP with guarded inequalities has a dichotomy. The guarded fragment of MonotoneSNP, denoted by GMSNP, is a well-studied class, see [START_REF] Bienvenu | Ontology-based data access: A study through disjunctive datalog, csp, and MMSNP[END_REF]. We then show that, for any GMSNP problem over any signature there is a P-time equivalent MMSNP 2 problem over a signature consisting of a unique relation symbol. Here, MMSNP 2 is a fragment of GMSNP that extends MMSNP by being able to colour tuples as well as vertices.

Dichotomy for MMSNP with guarded inequalities

Let τ be an input signature and σ = {M 1 , . . . , M s } be the signature of the existentially quantified unary relations.

Definition 1. The guarded MMSNP with ̸ = (GMMSNP ̸ = ) is an extension of MMSNP such that every sentence Φ in GMMSNP ̸ = is of the following form:

∃M 1 , . . . M s ∀x i ¬(α i ∧ β i ∧ x 1 ̸ = x ′ 1 ∧ • • • ∧ x k i ̸ = x ′ k i ),
where, for each i, α i is a conjunction of non-negated τ -atoms, β i is a conjunction of σatoms and negated σ-atoms, and, for each inequality x j ̸ = x ′ j of the ith negated conjunct, there exists a τ -atom in α i that contains both x j and x ′ j .

Example 3.1.1. Let τ = {E(•, •)} be the directed graph signature. The following first-order τ -sentence belongs to GMMSNP ̸ = :

∀x, y ¬ E(x, y) ∧ x ̸ = y .
This sentence describes the class of graphs where every arc is a loop. Such class is not closed under inverse homomorphisms as any directed graph can be mapped to a loop. As any MMSNP problem is closed under inverse homomorphisms, see e.g. [START_REF] Bodirsky | Complexity of Infinite-Domain Constraint Satisfaction[END_REF], we conclude that GMMSNP ̸ = is strictly more expressive than MMSNP. △

The goal of this section is to show that such extension of MMSNP has a dichotomy. For simplicity, we consider the case τ = {R}, where R has arity n. The proof for an arbitrary finite signature τ is similar, we can independently do the same steps for any relation of τ as we do for R in this proof.

Lemma 3.1.1. Any GMMSNP ̸ = sentence Φ is logically equivalent to a GMMSNP ̸ = sentence Ψ such that, for any negated conjunct ¬ψ i of Ψ and for any two different variables x, y that appear within some R-atom of ψ i , this conjunct contains the inequality x ̸ = y.

In the following, we explain how to obtain the sentence Ψ from the statement of Lemma 3.1.1. Construction 3. For every negated conjunct of Φ and for any two variables that appear in the same τ -atom, replace this negated conjunct with two negated conjuncts: the first one is obtained from the original one by adding the inequality x ̸ = y to the conjunction, the second one is obtained from the original one by replacing every occurence of the variable y with the variable x. Denote this new τ -sentence by Ψ.

Example 3.1.2. If Φ contains the following negated conjunct:

¬ R(x, y) ∧ M 1 (x) ∧ M 2 (y) ,
then this negated conjunct is replaced by the two following negated conjuncts:

¬ R(x, y) ∧ M 1 (x) ∧ M 2 (y) ∧ x ̸ = y ∧ ¬ R(x, x) ∧ M 1 (x) ∧ M 2 (x) .

△

Remark. This transformation is similar to one used in the proof of Theorem 3 in [START_REF] Feder | Homomorphism closed vs. existential positive[END_REF]. The theorem states that, for classes of finite structures closed under inverse homomorphisms, MonadicSNP is as expressive as MMSNP.

Proof of Lemma 3.1.1. Let Φ and Ψ be as in Construction 3, and A be a τ -structure. Suppose that A ̸ |= Φ; then for any σ-expansion there exists a negated conjunct ¬ϕ i of Φ that is false for some assignment of elements of A to the conjunct variables. Among the negated conjuncts of Ψ that are obtained from ϕ i we choose the one that is associated with this assignment: if two variables x, y of ϕ have the same element a in A assigned to them, then x and y must be identified in the corresponding conjunct of Ψ; if two different elements a, a ′ in A are assigned to x and y, then the corresponding conjunct of Ψ must contain the inequality x ̸ = y. By the construction of Ψ, such a conjunct exists. If A ̸ |= Ψ, then for any σ-expansion there is a negated conjunct of Ψ that is false for some assignment. It is associated with some negated conjunct ¬ϕ i of Φ, and, by construction, ϕ i is also false for the same assignment. We conclude that A |= Φ ↔ A |= Ψ, for any τ -structure A.

Consider any sentence Φ of GMMSNP ̸ = . By Lemma 3.1.1, we assume that, without loss of generality, for any two variables x, y that appear within the same τ -atom in some negated conjunct, this negated conjunct contains the inequality x ̸ = y.

We need to introduce some necessary notations. For n in N, denote by ϵ(n) the number of equivalence relations on a set of n elements: ∼ 1 , . . . , ∼ ϵ(n) . For each ∼ k , denote by

n k := |[n]/ ∼ k |
[x] ∼ k ≺ k [y] ∼ k if x < y. Definition 2. For a set X, define a function p : ∞ n=1 X n ∞ n=1 X n as follows. Let x = (x 1 , . . . , x n ) in X n be a n-tuple of equivalence type k, for some n in N. Let [s 1 ] ∼ k , . . . , [s n k ] ∼ k be the ∼ k -equivalence classes such that [s i ] ∼ k ≺ k [s j ] ∼ k if
and only if i < j. Then we say that p(x) := (x s 1 , . . . , x sn k ) belongs to X n k .

Example 3.1.3. Informally, the function p removes an element from a tuple if it is not its first occurence. Consider a 3-tuple t = (y, x, x), it is associated with the equivalence relation ∼ 4 from Figure 3.1 on page 63, the equivalence classes of ∼ 4 on the set

[3] = {1, 2, 3} are [1] ∼ 4 = {1} and [2] ∼ 4 = {2, 3}. Then p(t) = (y, x) because y is on the first coordinate of t, x is on the second, and [1] ∼ 4 ≺ 4 [2] ∼ 4 . △ ∼ 1 ∼ 2 ∼ 3 ∼ 4 ∼ 5 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 Figure 3
.1: All the 5 equivalence relations on the 3-element set depicted as 3 × 3 logical matrices (white cells stand for ones, grey cells stand for zeros.) That is, for i, j in [3], k in [ϵ(3)], the cell (i, j) of the kth matrix is white if and only if i ∼ k j.

In the following construction we explain how to obtain an equivalent MMSNP sentence Φ ′ , for a given GMMSNP ̸ = sentence Φ, in order to prove Theorem 3.1.2 on page 64.

Construction 4. We need to find, for any Φ in GMMSNP ̸ = , an MMSNP sentence Φ ′ over some input and existential signatures τ ′ and σ ′ such that SAT(Φ) ≡ p SAT(Φ ′ ). At first, we set σ ′ = σ to be the same signature. In order to construct the new input signature τ ′ , we consider any R in τ that has arity n, and we add to τ ′ new relation symbols R 1 , . . . , R ϵ(n) . Each R i is associated with one of the ϵ(n) equivalence relations ∼ i on the set [n], the arity of R i equals to n i -the number of equivalence classes of ∼ i .

Example 3.1.4. If R is ternary, then we add to τ ′ five relation symbols:

R 1 (•, •, •), R 2 (•, •), R 3 (•, •), R 4 (•, •), R 5 (•).
The corresponding equivalence relations on the set [3] = {1, 2, 3} are shown on Figure 3.1. △

We are going to describe how to construct the MMSNP sentence Φ ′ from Φ. At first, we get rid of the inequalities as they are not allowed in MMSNP. And then we show how to represent them with the relations of τ ′ .

• Firstly, for every negated conjunct ¬ϕ i (x i ), we delete all the inequalities from it.

Recall that, before this procedure, every negated conjunct contained an inequality x ̸ = y for every pair of distinct variables x, y that appeared together in some relational τ -tuple.

• After doing that, change every τ -atom in any negated conjunct ¬ϕ i (x i ) to the corresponding τ ′ -atom. Consider a relational τ -tuple R(x), where x is an n-tuple of equivalence type k. Then, replace R(x) with R k p(x) .

• Finally, we require that an element cannot appear in a τ ′ -relational tuple more than once. In order to do this, for any R k in τ ′ and for any i < j in [n k ], we add to Φ ′ the following negated conjunct consisting of one atom:

¬R k (x 1 , . . . , x i-1 , x i , x i+1 , . . . , x j-1 , x i , x j+1 , . . . , x n k ), (3.1)
that is the elements at the ith and the jth coordinates are the same. This is the end of Construction 4.

Example 3.1.5. Let Φ in GMMSNP ̸ = describe bipartite directed graphs, but loops are not prohibited. It can written as follows:

∃M 1 , M 2 ∀x, y    ¬ ¬M 1 (x) ∧ ¬M 2 (x) ∧ ¬ M 1 (x) ∧ M 2 (x) ∧ ¬ M 1 (x) ∧ M 1 (y) ∧ x ̸ = y ∧ E(x, y) ∧ ¬ M 2 (x) ∧ M 2 (y) ∧ x ̸ = y ∧ E(x, y)   
Observe that all the negated conjuncts contain inequalities for every pair of distinct variables. So we can follow the stages from Construction 4. At first, we delete all the inequalities from Φ and the sentence is now in the following form:

Φ 1 := ∃M 1 , M 2 ∀x, y ¬ ¬M 1 (x) ∧ ¬M 1 (x) ∧ ¬ M 1 (x) ∧ M 2 (x) ∧ ¬ M 1 (x) ∧ M 1 (y) ∧ E(x, y) ∧ ¬ M 2 (x) ∧ M 2 (y) ∧ E(x, y)
There are two equivalence relations on a 2-element set. This means that the signature τ ′ consists of a binary relation symbol E 1 and of a unary relation symbol E 2 . As there are no atoms of the form E(x, x), all τ -atoms are replaced by E 1 -atoms:

Φ 2 := ∃M 1 , M 2 ∀x, y ¬ ¬M 1 (x) ∧ ¬M 1 (x) ∧ ¬ M 1 (x) ∧ M 2 (x) ∧ ¬ M 1 (x) ∧ M 1 (y) ∧ E 1 (x, y) ∧ ¬ M 2 (x) ∧ M 2 (y) ∧ E 1 (x, y)
Finally, we add the negated conjunct ¬E 1 (x, x) and we obtain the desired MMSNP sentence Φ ′ :

Φ ′ := ∃M 1 , M 2 ∀x, y ¬E 1 (x, x) ∧ ¬ ¬M 1 (x) ∧ ¬M 1 (x) ∧ ¬ M 1 (x) ∧ M 2 (x) ∧ ¬ M 1 (x) ∧ M 1 (y) ∧ E 1 (x, y) ∧ ¬ M 2 (x) ∧ M 2 (y) ∧ E 1 (x, y) △ Theorem 3.1.2.
For any formula Φ in GMMSNP ̸ = there exists a formula Φ ′ in MMSNP such that the problems SAT(Φ) and SAT(Φ ′ ) are P-time equivalent.

Proof. Let Φ ′ be obtained from Φ by Construction 4. We need to show that the problems SAT(Φ) ≡ p SAT(Φ ′ ). We describe how to construct an equivalent τ ′ -structure A ′ from a given τ -structure A, and then show the P-time equivalence between the problems.

Let A be a τ -structure. The corresponding τ ′ -structure A ′ has the same domain A ′ = A. Consider any n-ary R in τ . Then, for every relation R k in τ ′ and for every tuple a = (a 1 , . . . , a n ) of equivalence type k:

R A ′ k p(a) ↔ R A (a). (3.2)
For a τ ′ -structure A ′ there exists a corresponding τ -structure A if and only if any relation R k of A does not contain a tuple with some element appearing in it more than once. Also observe that such A ′ is constructible from A in P-time.

It remains to prove the correctness of two reductions: we show that SAT(Φ) ≤ p SAT(Φ ′ ) and then do the reverse.

For any relational τ -structure A, we construct the τ ′ -structure A ′ . By construction, A ′ satisfies every negated conjunct of the type described in eq. (3.1). It is sufficient to show that, for the same choice of any σ-relation for both structures, the corresponding expansions A σ and A ′σ either both satisfy the first-order parts of corresponding formulae or both do not satisfy them. That is, we assume that, for any M in σ, a in A, we have M A σ (a) if and only if M A ′σ (a). Observe that, for any negated conjunct ¬ϕ i (x i ) of Φ, the corresponding negated conjunct of Φ ′ uses the same variables: ϕ ′ i (x i ). Let a(x i ) be an assignment of elements of A to the variables of x i . For any τ -atom R(y) of ϕ i (x i ) we know that, for any two different variables y i , y j within y, the negated conjunct ¬ϕ i (x i ) also contains the inequality y i ̸ = y j . The conjunct ϕ ′ i is obtained from ϕ i by replacing every τ -atom R(y) and the corresponding inequalities y i ̸ = y j with a τ ′ -atom R k p(y) . So, if the tuple a(y) is in R A and all the inequalities: a(y i ) ̸ = a(y j ), then, by the construction of A ′ , the tuple p(a(y)

) belongs to R A ′ k . If p(a(y)) is in R A ′ k , then, by the construction of A ′ , R(a(y)) is satisfied in A;
and also any inequality is satisfied because the coordinates of p(y) are pairwise distinct, by the definition of the function p. Hence, for any assignment a, ϕ i (a(x i )) holds in A σ if and only if ϕ ′ i (a(x i )) holds in A ′σ . This proves that SAT(Φ) ≤ p SAT(Φ ′ ).

We prove now the reduction from SAT(Φ ′ ) to SAT(Φ). Consider any relational τ ′structure A ′ . It takes P-time in its size to check that every formula of the type from eq. (3.1) is true in A ′ . If it is not true, then A ′ ̸ |= Φ ′ , thus we can reduce it to a fixed NO instance of Φ. If any such formula is satisfied, then there exists a τ -structure A with the same domain A = A ′ such that the condition from eq. (3.2) holds. This structure A is constructible from A ′ in P-time in its size. And these two structures are equivalent w.r.t. the problems SAT(Φ) and SAT(Φ ′ ), as shown previously.

This concludes that SAT(Φ) ≡ p SAT(Φ ′ ).

MMSNP 2 and Guarded Monotone Strict NP

Let τ = {R 1 , . . . , R t } be the input relational signature and σ = {X 1 , . . . , X s } be the existential relational signature. A sentence of guarded monotone strict NP (GMSNP) has the form ∃X 1 , . . . , X s ∀x ϕ(x), where ϕ is a conjunction of formulae

¬ϕ i := ¬(α 1 ∧ • • • ∧ α n ∧ ¬β 1 ∧ • • • ∧ ¬β m ) with n, m ≥ 0,
where each α i is either • an atom X i (y), for X i in σ, or • an atom R(y), for R in τ , or

• an equality x = y; and each β i is of the form X i (y), for X i in σ. Additionally, we require that for every negated atom ¬β i there is an atom α j such that α j contains all variables from β i . It is said that α j guards β i .

Example 3.2.1. Suppose that we have a ternary input τ -relation C 3 (x, y, z) that encodes the directed cycle C 3 . We want to check that a given τ -structure does not have a 2-cycle. In order to check this property, we introduce two binary σ-relations:

• E(x, y), which means that (x, y) is an arc, and • C 2 (x, y), which means that x and y make a directed cycle of length 2.

The query can be expressed by the following GMSNP sentence:

∃E, C 2 ∀x, y    ¬ C 3 (x, y, z) ∧ ¬E(x, y) ∧ ¬ C 3 (x, y, z) ∧ ¬E(y, z) ∧ ¬ C 3 (x, y, z) ∧ ¬E(z, x)    ∧ ¬ E(x, y) ∧ E(y, x) ∧ ¬C 2 (x, y) ∧ ¬C 2 (x, y).
△ Suppose now that the existential signature σ can be represented in the following form: σ = σ 0 1≤i≤t σ i , where σ 0 consists of unary relation symbols, and each σ i consists of relation symbols of the same arity as the corresponding input relation R i . A sentence of MMSNP 2 logic has the form ∃X 1 , . . . , X s ∀x ϕ(x),

where ϕ is a conjunction of formulae

¬ϕ i := ¬(α i ∧ β i ),
where each α i is a conjunction of non-negated τ -atoms, each β i is a conjunction of σ-atoms or negated σ-atoms. And, for each atom in β i of the form X(y) or ¬X(y), where X is in

σ i , for 1 ≤ i ≤ t, α i contains a τ -atom of the form R i (y). Example 3.2.2. (No-Monochromatic-Arc-Triangle) Let Φ describe the following problem.
That is, a directed graph G satisfies Φ if and only if one can colour its arcs in two colours B and W such that G does not contain a 3-cycle as a subgraph, where all 3 arcs have the same colour. Φ can be written as follows:

∃B, W ∀x, y, z       ¬ E(x, y) ∧ B(x, y) ∧ W(x, y) ∧ ¬ E(x, y) ∧ ¬B(x, y) ∧ ¬W(x, y) ∧ ¬ E(x, y) ∧ E(y, z) ∧ E(z, x) ∧ B(x, y) ∧ B(y, z) ∧ B(z, x) ∧ ¬ E(x, y) ∧ E(y, z) ∧ E(z, x) ∧ W(x, y) ∧ W(y, z) ∧ W(z, x)      

△

The class GMSNP is studied in the paper [START_REF] Bienvenu | Ontology-based data access: A study through disjunctive datalog, csp, and MMSNP[END_REF] of Bienvenu et al. The authors investigate its relation with MMSNP and show that GMSNP is strictly more expressive than MMSNP. Moreover, they compare GMSNP to MMSNP 2 (that was introduced before by Madelaine in [START_REF] Florent | Universal structures and the logic of forbidden patterns[END_REF]) and show that MMSNP 2 has the same expressive power as GMSNP. That is, for any GMSNP sentence Φ there exists an MMSNP 2 sentence Φ ′ that is logically equivalent to Φ and vice versa.

In Section 3.2.1 we first show that for any finite relational signature τ there is a signature τ 1 consisting of just one relation symbol such that for any τ -sentence Φ in GMSNP there is a P-time equivalent τ 1 -sentence Φ 1 in GMSNP. Then, in Section 3.2.2, we strengthen the result of Bienvenu et al. by showing that for any τ 1 -sentence Φ in GMSNP there is a logically equivalent τ 1 -sentence in MMSNP 2 , as in their proof the signature contains arbitrarily many relation symbols. So now without loss of generality one can study the dichotomy question for MMSNP 2 over a signature with a unique relation symbol, this makes the notations much simpler. We also rewrite this proof for convenience as the original proof of Bienvenu et al. uses different notations.

Signature simplification for Guarded Monotone Strict NP

Here we show how one can simplify a GMSNP problem such that without loss of generality one can consider the case when the input relational signature consists only of one relation symbol. We do it by showing that for any finite signature τ = {R 1 , . . . , R t } there exists a signature τ 1 = {P} such that for any GMSNP problem over τ there is a P-time equivalent GMSNP problem over τ 1 , see Lemma 3.2.10.

An SNP τ -sentence Φ is called connected if no negated conjunct ¬ϕ(x) of Φ has the form ¬ (ψ 1 (x 1 ) ∧ ψ 2 (x 2 )) ,
where the tuples x 1 and x 2 share no variables. Denote by ConnectedGMSNP the set of all connected GMSNP sentences over all finite relational signatures. We first show that GMSNP and ConnectedGMSNP are P-time equivalent. Then we show that any ConnectedGMSNP sentence is equivalent to a ConnectedGMSNP sentence over a one-element relational signature.

Recall that the family of structures that satisfy some connected SNP sentence is closed under taking disjoint unions.

Proposition 3.2.1 ([Bod21]

). Let Φ be an SNP sentence. Then the class of structures that satisfy Φ is closed under disjoint unions if and only if Φ is logically equivalent to a connected SNP sentence.

It is known that one can rewrite any GMSNP sentence as a disjunction of connected sentences.

Proposition 3.2.2 ([BKS20]). Every GMSNP sentence Φ is logically equivalent to a finite disjunction Φ 1 ∨ • • • ∨ Φ k of connected GMSNP sentences.
The following result is similar to a well-know similar result for MMSNP sentences. One can find a proof for the case of MMSNP in [START_REF] Bodirsky | A universal-algebraic proof of the complexity dichotomy for monotone monadic SNP[END_REF]. We provide a similar proof for the class GMSNP.

Proposition 3.2.3. Let Φ be a GMSNP τ -sentence that is logically equivalent to a disjunction

Φ 1 ∨ • • • ∨ Φ k of ConnectedGMSNP sentences. Then SAT(Φ) is P-time solvable if all SAT(Φ i ) are in P. If one SAT(Φ i ) is NP-hard, then so is SAT(Φ).
Proof. If all SAT(Φ i ) are P-time solvable, then, for any τ -structure A, we can check in P-time in its size if A satisfies one of

Φ i s. If yes, then A |= Φ; if no, then A ̸ |= Φ. So SAT(Φ) is P-time solvable.
Suppose that, for some i in [k], SAT(Φ i ) is NP-hard. Let k be the smallest number such that Φ is represented as a disjunction of k connected sentences. Then there exists a structure B such that, for all j in [k] ∖ {i}, B ̸ |= Φ j , and B |= Φ i . If such structure does not exist, then we can delete Φ i from the disjunction and keep it logically equivalent to Φ, this contradicts the minimality of k. We reduce SAT(Φ i ) to SAT(Φ) as follows: for any τ -structure A we construct a τ -structure

A ′ := A ⊎ B and show that A |= Φ i if and only if A ′ |= Φ.
Suppose A |= Φ i ; then, as B also satisfies Φ i , by Proposition 3.2.1, their disjoint union

A ′ also satisfies Φ i , thus, A ′ |= Φ. Suppose A ′ |= Φ. Then, for some j in [k], A ′ |= Φ j . Lemma 2.
2.1 states that any SNP sentence is closed under taking induced substructures, thus, we have B |= Φ j . This means that j = i. As A is also an induced substructure of A ′ , by Lemma 2.2.1, we have A |= Φ i as well.

Corollary 3.2.4. Let τ be a finite relational signature. The class of GMSNP problems over τ has a dichotomy if and only if the class of connected GMSNP problems over τ has a dichotomy.

We shall prove that from the perspective of dichotomy we can assume that a GMSNP sentence has only one input symbol, that is we prove the following. Theorem 3.2.5. For any finite relational signature τ there exists a signature τ 1 consisting of just one relational symbol such that, for any GMSNP τ -sentence Φ there exists a GMSNP τ 1 -sentence Φ 1 such that the problems SAT(Φ) and SAT(Φ 1 ) are P-time equivalent. Recall that GMSNP problems are closed under inverse homomorphisms because they all belong to MonotoneSNP.

Let R in τ have arity k in N. Let B R be a τ -structure that consists of one R-tuple: b R = (b R,1 , . . . , b R,k ). That is, B R = {b R,1 , . . . , b R,k },

Theorem 3.2.6 ([FV03]

). Let Φ be an SNP sentence. Then the class of structures that satisfy Φ is closed under inverse homomorphisms if and only if Φ is logically equivalent to a MonotoneSNP sentence.

We shall first discard input symbols of GMSNP that are implicitly forbidden by the sentence. This will allow us to eventually encode the many -now necessary -input symbols into a single input symbol. Lemma 3.2.7. If a connected GMSNP τ -sentence Φ does not satisfy the structure B R , for some R in τ , then the problem SAT(Φ) is P-time equivalent to SAT(Φ ¡ R ), where Φ ¡ R is a connected (τ ∖ {R})-sentence that is obtained by removing from Φ all negated conjuncts that contain R-atoms.

ϕ i ϕ i ∧ ∧ . . . ∧ x R1 x Rt R 1 R t A A ⊎ ⊎ . . . ⊎ b R1 b Rt R 1 R t Figure 3.2: Above, one can see the transformation of each negated conjunct of Φ to a negated conjunct of Φ ′ . Below, it is shown how the structure A ′ is constructed from A. Proof. Suppose that B R ̸ |= Φ. Let a τ -structure A be an input instance of SAT(Φ). If R A ̸ = ∅, then B R
A, so, by Theorem 3.2.6, A ̸ |= Φ, and we reduce it to some NO instance of SAT(Φ ¡ R ). Suppose that R A = ∅; then we reduce A to its (τ ∖ {R})-reduct A ¡ R . For any σ-expansion of A, any negated conjunct with an R-atom is always satisfied, as

R A = ∅. Thus, A |= Φ if and only if A ¡ R |= Φ ¡ R . For τ -structures A such that R A = ∅, the correspondence A ↔ A ¡ R
is one-to-one. This means that the two problems are P-time equivalent.

Suppose that Lemma 3.2.7 does not apply to Φ. Then we shall construct a new sentence Φ ′ and, for any τ -structure A, a τ -structure A ′ such that • any negated conjunct of Φ ′ contains at least one R-atom of each R in τ ;

• A |= Φ if and only if A ′ |= Φ ′ .
Construction 5. The sentence Φ ′ is obtained from Φ as follows. Take any negated conjunct ¬ϕ i of Φ and replace it with

¬ϕ ′ i := ¬ ϕ i ∧ R∈τ R(x R ) ,
where each x R is a tuple of new variables. Φ ′ is no longer connected. However, it is still in GMSNP. And Φ is more restrictive than Φ ′ , as we enrich negated conjuncts of Φ with τ -atoms. That is, for any τ -structure A, we have that

A |= Φ implies A |= Φ ′ .
For a τ -structure A, let A ′ := A ⊎ R∈τ B R -be the disjoint union of A and singleton tuples, for every relation in τ . The sentence Φ ′ and the structure A ′ are displayed on Figure 3.2 on page 69. This is the end of Construction 5. Lemma 3.2.8. Let Φ, Φ ′ , A and A ′ be as in Construction 5. Then A |= Φ if and only if A ′ |= Φ ′ . Consequently, SAT(Φ) is P-time reducible to SAT(Φ ′ ).

Proof. Let A be an input instance of SAT(Φ), and A ′ be an input instance of SAT(Φ ′ ) obtained from A as in Construction 5. We need to prove that A |= Φ if and only if A ′ |= Φ ′ . Suppose that A |= Φ. We also know that, for any R in τ , B R |= Φ. Then, by Proposition 3.2.1, A ′ |= Φ, as A ′ is the disjoint union of structures satisfying Φ. But then, as Φ ′ is less restrictive than Φ, we have A ′ |= Φ ′ .

Suppose that A ′ |= Φ ′ ; then, for some σ-expansion A ′σ , the first-order part ϕ ′ of Φ ′ is satisfied. Choose a σ-expansion A σ of A to be equal to A ′σ [A], the substructure of A ′σ induced on A. Suppose that, for some negated conjunct ¬ϕ i (x i ) of Φ, there is an assignment that makes it false in A σ . But then we can take the corresponding negated conjunct ¬ ϕ i ∧ R∈τ R(x R ) of Φ ′ , and assign b R to each new tuple of variables x R . Under this assignment the conjunct is false in A ′σ , this is a contradiction. We have shown that

A |= Φ if and only if A ′ |= Φ ′ .
Lemma 3.2.9. Let Φ, Φ ′ be as in Construction 5. Then SAT(Φ ′ ) is P-time reducible to SAT(Φ).

Proof. Consider a τ -structure A that is an input instance of SAT(Φ ′ ). We first suppose that, for some R in τ , R A = ∅. Then, by Construction 5, A |= Φ ′ . Then we reduce it to some fixed YES instance of SAT(Φ), e.g., to B R , as we know that B R |= Φ.

Suppose now that any relation of A is interpreted as a non-empty set. Then, A |= Φ implies A |= Φ ′ because Φ is more restrictive than Φ ′ . Suppose that A ̸ |= Φ; then, for any σ-expansion A σ of A there is a negated conjunct ¬ϕ i (x i ) of Φ and a tuple a i of elements of A such that A σ |= ϕ i (a i ). But then, take the negated conjunct ¬ ϕ i (x i ) ∧ R∈τ R(x R ) , assign a i to x i and assign a R to x R such that, for any R in τ , a R ∈ R A . At least one such a R exists, by our assumption. But then we have A σ |= ϕ i (a i ) ∧ R∈τ R(a R ) . This means that the two problems SAT(Φ) ≡ p SAT(Φ ′ ).

By Lemma 3.2.7, Lemma 3.2.8, and Lemma 3.2.9, we can assume that every negated conjunct of Φ contains a τ -atom of each relation symbol of τ . Set τ 1 := {P}, where arity(P) := R∈τ arity(R).

(3.3)

For two tuples x = (x 1 , . . . , x n ), y = (y 1 , . . . , y m ), we use the following notation for their concatenation: (x, y) := (x 1 , . . . , x n , y 1 , . . . , y m ).

Now we construct a GMSNP τ 1 -sentence Φ 1 and then show that SAT(Φ) with the restricted input is P-time equivalent to SAT(Φ 1 ). It will be the main result of this subsection.

Construction 6. Consider a negated conjunct ¬ϕ i of Φ and construct the corresponding negated conjunct ¬ϕ 1 i as follows. The σ-atoms of ϕ 1 i are the same as in ϕ i . Each τ -atom of ϕ i is replaced by a τ 1 -atom as follows. For any j in [t] and a τ -atom R j (x), ϕ 1 i contains a τ 1 -atom P(y 1 , . . . , y t ), where y j = x and all other variables of this formula are new and they are used only in this atomic formula. Φ 1 is a GMSNP sentence because the σ-parts are kept the same and all the variables of a τ -atom of Φ are contained in the corresponding τ 1 -atom of Φ 1 . An example of such construction is displayed on Figure 3.3 on page 71. Observe that Φ 1 is connected. This is the end of Construction 6. Lemma 3.2.10. Suppose that Φ 1 is obtained from Φ by Construction 6. Then, for any τ -structure A there exists a τ 1 -structure A 1 such that A |= Φ if and only if A 1 |= Φ 1 ; and for any τ 1 -structure A 1 there is a τ -structure A such that

A 1 |= Φ 1 if and only if A |= Φ. R 1 (x 1 , x 2 ) ∧ R 2 (x 2 , x 3 ) ∧ R 1 (x 1 , x 3 ) x 1 x 2 x 3 x 1 x 2 x 3 y 1 y 2 y 3 y 4 y 5 y 6 P(x 1 , x 2 , y 1 , y 2 ) ∧ P(y 3 , y 4 , x 2 , x 3 ) ∧ P(x 1 , x 3 , y 5 , y 6 )
Figure 3.3: On the left, there is the τ -part of some negated conjunct of Φ. On the right, there is the τ 1 -part of the corresponding negated conjunct of Φ 1 .

A A 1 Proof. For a τ -structure A we construct the corresponding τ 1 -structure A 1 as follows. The structures have the same domain: A 1 = A. The relation P A 1 is defined by the relations of A as on eq. (3.4). An example of such construction is displayed on Figure 3.4 on page 71.

P A 1 (a 1 , . . . , a t ) ↔ R A 1 (a 1 ) ∧ • • • ∧ R A t (a t ). (3.4)
Observe that, if R A = ∅, for some R in τ , then P A 1 = ∅. In this case, we have A |= Φ, as every negated conjunct contains an R-atom. And we also have A 1 |= Φ 1 , as every negated conjunct of Φ 1 contains at least one P-atom. So, we can now assume that R A ̸ = ∅, for any R in τ , and that P A 1 ̸ = ∅.

Let A σ and A σ 1 be two σ-expansions of A and A ′ such that, for any X in σ,

X A σ = X A σ 1 . It is sufficient to show that A σ |= ∀x ϕ(x) if and only if A σ 1 |= ∀x, y ϕ 1 (x, y)
, where y represents variables that are added during the construction of Φ 1 . Suppose that A σ ̸ |= ∀x ϕ(x); then, for some negated conjunct ¬ϕ i (x i ) of Φ and for some tuple a i , we have

A σ |= ϕ i (a i ). Consider the ith negated conjunct ¬ϕ 1 i (x i , y i ) of Φ 1 .
To the tuple of variables x i that are used in ϕ i as well, we assign the same tuple a i of elements of A. Let P(y 1 , . . . , y t ) be a τ 1 -atom that is contained in ϕ 1 i . Pick a tuple y j of variables of this atomic formula such that nothing is assigned to these variables yet. We know that, for the jth relation symbol R j in τ , ϕ i contains at least one τ -atom R j (z j ), thus each variable of z j is contained in x i . As a i is assigned to x i , some tuple b j of elements of A is already assigned to z j . Hence, we assign the tuple b j to y j . Repeat this procedure for all unassigned variables of P(y 1 , . . . , y t ). By eq. (3.4), we have A σ 1 |= P(b 1 , . . . , b t ). This is true for any τ -atom of ϕ 1 i . Thus, A σ 1 ̸ |= ∀x, y ϕ(x, y). For the other direction, suppose that A σ 1 ̸ |= ∀x, y ϕ(x, y); then there is a negated conjunct ¬ϕ 1 i (x i , y i ) and tuples

a i , b i of elements of A such that A σ 1 |= ϕ 1 i (a i , b i ).
Take the corresponding negated conjunct ¬ϕ i (x i ) of Φ and assign a i to x i . We have A σ |= ϕ i (a i ), by eq. (3.4).

For an arbitrary τ 1 -structure B 1 , we construct a τ -structure B. They have the same domain B and, for any j in [t], the relation R B j is defined as follows: R B j (x j ) ∃x 1 , . . . , x j-1 , x j+1 , . . . , x t P B 1 (x 1 , . . . , x t ).

(3.5)

Similarly as above, we consider two σ-expansions B σ and B σ 1 such that, for all X in σ, X B σ = X B σ 1 . Suppose that B σ 1 ̸ |= ∀x, y ϕ 1 (x, y); then there exists a negated conjunct ¬ϕ 1 i (x i , y i ) and assignments a i , b i to x i , y i correspondingly such that B σ 1 |= ϕ 1 i (a i , b i ). Take the ith negated conjunct ¬ϕ i (x i ) of Φ and assign a i to x i . As ϕ i and ϕ 1 i have the same σ-part, we have B σ satisfies any σ-atom and negated σ-atom of ϕ i . Any τ -atom of ϕ i is satisfied, by eq. (3.5). So we have B σ |= ϕ i (a i ). For the other direction, suppose that B σ |= ϕ i (a i ), for some negated conjunct ¬ϕ i (x i ) of Φ and for some assignment a i of elements of B to the variables x i of ϕ i . For any atomic formula R j (z) of α i , the conjunction ϕ 1 i contains an atomic formula P(y 1 , . . . , y t ), where y j = z. We know that some tuple c is assigned to z such that B σ |= R j (c). By eq. (3.5), there exist b 1 , . . . , b j-1 , b j+1 , . . . , b t such that P B σ 1 (b 1 , . . . , b t ), where b j = c. So, for any y 1 , . . . , y t except for y j = z, we assign b 1 , . . . , b t . Then, B σ 1 |= P(b 1 , . . . , b t ), this is true for any τ -atom of ϕ 1 i . Any σ-atom and negated σ-atom of ϕ i is also satisfied by the choice of σ-expansions. This implies that B σ 1 ̸ |= ∀x, y ϕ 1 (x, y) and we are done.

Proof of Theorem 3.2.5. For a given finite relational signature τ , the sole symbol P of τ 1 has arity as in eq. (3.3). Let Φ be some GMSNP τ -sentence. We can assume without loss of generality that it is connected, by Corollary 3.2.4. If the condition of Lemma 3.2.7 applies to Φ, then SAT(Φ) ≡ p SAT(Ψ), where Ψ is a GMSNP τ ′ -sentence, and τ ′ ⊊ τ , and the condition of Lemma 3.2.7 does not apply to Ψ. So, we can assume that it does not apply to Φ. Then, by Lemma 3.2.8 and Lemma 3.2.9, SAT(Φ) ≡ p SAT(Φ ′ ), where every negated conjunct of Φ ′ contains at least one R-atom, for every R in τ . Then, by Construction 6, we construct a GMSNP τ 1 -sentence Φ 1 such that SAT(Φ ′ ) ≡ p SAT(Φ 1 ), by Lemma 3.2.10. This means that SAT(Φ) ≡ p SAT(Φ 1 ).

Equivalence between Guarded Monotone Strict NP and MMSNP 2

Suppose that τ = {R} is the input signature that consists of one relation symbol of arity k. Our objective is to show that for every GMSNP τ -sentence there is a logically equivalent MMSNP 2 τ -sentence, and vice versa. This yields that the two classes have the same expressive power.

There are two major differences between GMSNP and MMSNP 2 . At first, within a GMSNP sentence a negated existential atom may be guarded by another existential atom, while in MMSNP 2 sentences existential atoms are always guarded by τ -atoms. The second difference is that the existential relations within a GMSNP sentence may have arbitrary arity, while, within MMSNP 2 sentences the arity is determined: either it equals the arity of the input relation, or it is 1. The following definition is helpful with respect to the second difference. Definition 3. Let E m k denote the family of injective mappings from sets of size at most m to sets with at most k elements, for m < k. That is,

E m k := e : [m ′ ] [k ′ ] | m ′ ≤ m, k ′ ≤ k, e is injective .
Denote n := |E m k | to be the number of these mappings and suppose that all of them are linearly ordered: E m k = {e 1 , . . . , e n }. Let p be the function from Definition 2 on page 63 that deletes repeating elements from a tuple. Let x be an m-tuple, y be a ktuple, x ′ := p(x) and y ′ := p(y) be the corresponding m ′ -and k ′ -tuples with all repeating elements having been removed. We say that x has guarding type i in y if, for any j in j) , where

[m ′ ], we have x ′ j = y ′ e i (
e i : [m ′ ] [k ′ ] is the ith element in E m k .
The following statement is the main result of this part. It is initially proved in [Bt-CLW14]. However, we reprove it here, for convenience. Proposition 3.2.11. GMSNP and MMSNP 2 have the same expressive power.

Proof. It is straightforward to show that any MMSNP 2 sentence is also a GMSNP sentence: if ¬β i is of the form ¬X(y), for some unary X in σ, then we can enrich the conjunction ϕ i with the equality y = y that guards β i , and all other βs are already guarded by τ -atoms. As y = y always holds, the resulting sentence is logically equivalent to the original one. Now, consider a GMSNP sentence Φ. We want to do the following steps in order to finish the proof: 1. To remove all the equalities from Φ.

2. To enrich the negated conjuncts of Φ such that within any conjunct, for any σ i -atom there is a τ -atom in the same conjunct that guards this σ-atom. By transitivity, this implies that any negated σ-atom is also guarded by a τ -atom. The modified sentence is logically equivalent to Φ.

3. To replace the existential relational signature σ with a new signature σ ′ consisting only of k-ary relation symbols. And to replace every σ-atom with a σ ′ -atom so that the result is an MMSNP 2 sentence Φ ′ that is logically equivalent to Φ.

Removing equalities. For every equality x = y that is in some negated conjunct ¬ϕ i of Φ, we replace every occurence of y within ϕ i with x. If this equality guards some negated σ-atoms, then, after replacing ys with xs, there might be a negated σ-atom of the form ¬X(x, . . . , x). For every X in σ, we add to σ a unary relation symbol L X and add to Φ the following negated conjuncts:

¬ X(x, . . . , x) ∧ ¬L X (x) ∧ ¬ L X (x) ∧ ¬X(x, . . . , x) .
These two negated conjuncts require that an element x belongs to the relation L X if and only if the k-tuple (x, . . . , x) belongs to X. Then, we replace all the unguarded negated σ-atoms ¬X(x, . . . , x) by a unary negated atom ¬L X (x). As this atom is unary, it does not have to be guarded.

Making every σ-atom be guarded by a τ -atom. Consider any negated conjunct ¬ϕ i (x i ) that contains a σ-atom X(z) that is guarded by no τ -atom. Let n denote the number of guarding types of z in a k-tuple. We replace the negated conjunct ¬ϕ i (x i ) with the following conjunction:

¬ ϕ i (x i ) ∧ R(y 1 ) ∧ • • • ∧ ¬ ϕ i (x i ) ∧ R(y n ) ,
where, for any j in [n], the atom X(z) has guarding type j in R(y j ). There is more than one way to choose y j , so suppose that any variable of y j that is not ought to be in z is distinct.

The new sentence, denoted by Φ ′ , is less restrictive than the old one. That is, for any τ -structure A, if A |= Φ, then A |= Φ ′ . We need to prove that Φ ′ is still logically equivalent to Φ. Suppose that there is a τ -structure A that satisfies Φ ′ but does not satisfy the original sentence Φ. Then, let A σ 0 be a σ-expansion of A that satisfies the firstorder part ∀x, y ϕ ′ (x, y) of Φ ′ , where y denote new distinct variables from y 1 , . . . , y n . By assumption, A σ 0 does not satisfy the first-order part ∀x ϕ(x) of Φ. Then, as all other negated conjuncts are the same, we have, for some assignment a i to x i , A σ 0 |= ϕ i (a i ). Assume that, under this assignment, the tuple z of the atom X(z) is mapped to some tuple c of A. We have A σ 0 |= X(c) and that this tuple c is not contained in any R-tuple b j of A, as then we would have

A σ 0 |= ϕ i (a i ) ∧ R(b j )
, that would contradict one of the n new negated conjuncts of Φ ′ . Then we modify the σ-expansion A σ 0 by deleting this tuple c from the relation X A σ 0 . We do this procedure for any other X-tuple that does not belong to any R-tuple. If the new σ-expansion, denoted by A σ 1 , does not satisfy ∀x ϕ(x), then there is a negated conjunct ¬ϕ i 1 (x i 1 ) that contains a negated X-atom ¬X(z 1 ) and there is an assignment x i 1 a i 1 that maps z 1 to c 1 such that the tuple c 1 is not contained in X A σ 1 and that was contained in X A σ 0 -before we deleted those X-tuples that were not guarded by R-tuples. This means that, within ϕ i 1 , the negated σ-atom ¬X(z 1 ) is guarded by another σ-atom, say X 1 (z 2 ). Let c 2 be the tuple assigned to z 2 , then c 2 contains the tuple c 1 , and c 2 is in

X A σ 1 1 = X A σ 0 1
. We keep modifying the σ-expansion by deleting c 2 from X A σ 1 1 and so on until all the negated conjuncts of ∀x ϕ(x) are satisfied. At each next step, any negated σ-atom that becomes satisfied is always guarded by another σ-atom, not by a τ -atom because c ⊆ c 1 ⊆ c 2 ⊆ . . . and, for no R-tuple b j , we have c ⊆ b j . We cannot keep deleting the σ-tuples indefinitely, so this process will halt. This means that A |= Φ, which is a contradiction, so the sentences Φ and Φ ′ are logically equivalent.

We continue modifying Φ ′ by choosing another σ-atom that is not guarded by a τatom and replace the corresponding negated conjunct similarly as above. After every such modification, the result is logically equivalent to the original sentence. We do this modification for every σ-atom of Φ that is not guarded by a τ -atom. At the end, we obtain a sentence that is equivalent to Φ and that any of its σ-atoms is guarded by a τ -atom. We can assume now that Φ already satisfies this property.

Changing the arity of σ-relations. Now we are going to modify the existential signature σ so that the new signature consists of either unary or k-ary relation symbols. That is, they are either unary or have the same arity as R.

Define a function f : σ N such that f(X) is equal to the number of guarding types of an X-tuple in a R-tuple. The new existential signature σ ′ is defined as follows:

σ ′ = {X i | X ∈ σ ∧ i ∈ [f(X)]},
each relation symbol has arity k. Now we construct an MMSNP 2 sentence Ψ that is logically equivalent to Φ.

• For any negated conjunct ¬ϕ i of Φ, we add to Ψ its copy denoted by ¬ψ i . The τ -atoms in ¬ψ i are kept the same as in ¬ϕ i .

• As the existential signature is different, we need to replace σ-atoms with σ ′ -atoms. Let X(x) be some σ-atom guarded by a τ -atom R(y). Let X(x) have guarding type j in R(y), for some j in [f(X)]. We replace X(x) with a σ ′ -atom X j (y). Do a similar thing for every other σ-atom.

• Let y 1 , y 2 be two R-tuples that have some variables in common. For l-ary X in σ, let x be an l-tuple consisting of some of the variables shared between y 1 and y 2 . Let X(x) have guarding type j 1 in R(y 1 ), and guarding type j 2 in R(y 2 ). Then, for any such two intersecting R-tuples y 1 , y 2 , for any X in σ, and for any such x contained in both y 1 , y 2 , we add the following negated conjuncts:

¬ R(y 1 )∧R(y 2 )∧X j 1 (y 1 )∧¬X j 2 (y 2 ) ∧¬ R(y 1 )∧R(y 2 )∧¬X j 1 (y 1 )∧X j 2 (y 2 ) . (3.6)
Informally, these two conjuncts mean that, for two R-tuples y 1 , y 2 that intersect, x having guarding type j 1 in y 1 implies it having guarding type j 2 in y 2 , and vice versa.

If a σ ′ -expansion A σ ′ of some τ -structure A satisfies all the negated conjuncts of the form as in eq. (3.6), then it is associated with a unique σ-expansion A σ , and this correspondence is one-to-one. The correspondence is defined as follows: for any σ-tuple X(a) of A σ that is contained in some τ -tuple R(b) there is a σ ′ -tuple X i (b) of A σ ′ such that X(a) has guarding type i in R(b). And backwards, if there is no such σ-tuple, then there is no corresponding σ ′ -tuple. If we did not add the negated conjuncts of the form as in eq. (3.6) to Ψ, then we would have to consider those σ ′ -expansions that are associated with no σ-expansion of an input τ -structure. Observe that, given one expansion, the other expansion can be constructed in P-time in the size of the given one.

Let A be a τ -structure, let A σ be a σ-expansion of A, and let A σ ′ be the σ ′ -expansion that is associated with A σ by the rule above. By the construction of A σ ′ , for any negated conjunct ¬ϕ i (x) of Φ and the corresponding negated conjunct ¬ψ i (x) of Ψ, and for any assignment a i to the variables x i of the conjuncts, we have A σ |= ϕ i (a i ) if and only if A σ ′ |= ψ i (a i ). Also, A σ ′ satisfies all the negated conjuncts of the form as in eq. (3.6). Thus, these two expansions either both satisfy the first-order parts of Φ and Ψ correspondingly or both do not satisfy them. As any σ ′ -expansion of A that is not associated with a σ-expansion violates one of the negated conjuncts from eq. (3.6), we can conclude that

A |= Φ if and only if A |= Ψ. Example 3.2.3. Consider the GMSNP sentence Φ given in Example 3.2.1: ∃E, C 2 ∀x, y    ¬ C 3 (x, y, z) ∧ ¬E(x, y) ∧ ¬ C 3 (x, y, z) ∧ ¬E(y, z) ∧ ¬ C 3 (x, y, z) ∧ ¬E(z, x)    ∧ ¬ E(x, y) ∧ E(y, x) ∧ ¬C 2 (x, y) ∧ ¬C 2 (x, y).
Here, there is one input relation C 3 , and two existential relations E and C 2 . This query checks if a directed graph encoded by its 3-cycles does not have 2-cycles. We transform Φ to an equivalent MMSNP 2 sentence according to the steps from Proposition 3.2.11. As Φ does not contain equalities, we have no equalities to remove. There are two negated conjuncts, where σ-atoms are not guarded by τ -atoms: ¬ E(x, y)∧E(y, x)∧¬C 2 (x, y) and ¬C 2 (x, y). There are six different injective mappings from a 2-element set to a 3-element set. The negated conjunct ¬C 2 (x, y) is replaced by the following negated conjuncts:

¬ C 2 (x, y) ∧ C 3 (x, y, z) ∧ ¬ C 2 (x, y) ∧ C 3 (y, x, z) ∧ ¬ C 2 (x, y) ∧ C 3 (x, z, y) ∧ ¬ C 2 (x, y) ∧ C 3 (y, z, x) ∧ ¬ C 2 (x, y) ∧ C 3 (z, x, y) ∧ ¬ C 2 (x, y) ∧ C 3 (z, y, x) .
(3.7) Similarly, the negated conjunct ¬ E(x, y) ∧ E(y, x) ∧ ¬C 2 (x, y) is replaced by six negated conjuncts. After completing the second step, we modify the existential signature so that all existential relations have arity 1 or 3. Right now, both relations are binary, so, eventually, we will have only ternary relations. For a binary relation C 2 there are 9 ways how a Etuple can be guarded by a C 3 -tuple: 6 ways are as in eq. (3.7), the other three ways are as follows:

¬ C 2 (x, x) ∧ C 3 (x, y, z) , ¬ C 2 (x, x) ∧ C 3 (y, x, z) , ¬ C 2 (x, x) ∧ C 3 (y, z, x) .
Instead of two relations E, C 2 we now use 18 relations: E 1 , . . . , E 9 , C 1 2 , . . . , C 9 2 . Every Eatom and C 2 -atom is replaced by the corresponding atom of this new signature σ ′ . Then we add all the conjuncts as in eq. (3.6), therefore, if a σ-tuple is contained in more than one τ -tuple, then each of these τ -tuple must be coloured in the corresponding σ ′ -colour. △ Remark. As the τ -atoms in the MMSNP 2 sentence Ψ are the same as in Φ, we know that if Φ is connected, then Ψ is connected. By Lemma 3.2.10, we consider only connected GMSNP sentences, so further we can consider only connected MMSNP 2 sentences.

Chapter 4 MMSNP 2 on ω-categorical structures

We show that any MMSNP 2 problem can be reduced to an MMSNP problem, this reduction is provided by a functor between the inputs. Then, we consider an infinitary extension of MMSNP that allows a sentence to have countably many negated conjuncts. We show that any MMSNP 2 problem is P-time equivalent to an infinite regular MMSNP, where the word "regular" has a similar meaning as in regular languages. Regularity of an infinite MMSNP sentence provides the existence of an ω-categorical relational structure with an equivalent CSP. For every MMSNP 2 sentence there also exists an ω-categorical structure with an equivalent CSP. Finally, we show that the functorial image of this structure is homomorphically equivalent to the ω-categorical template associated with the infinite MMSNP.

Reduction from MMSNP 2 to MMSNP

Clearly, any MMSNP problem is also an MMSNP 2 problem, by the definition. In this section we show that any MMSNP 2 problem reduces to some MMSNP problem. Firstly, we describe how to construct the MMSNP sentence for a given one of MMSNP 2 . And then, for any relational τ -structure of the MMSNP 2 input, we construct the corresponding relational τ -structure of the MMSNP input. It happens that this construction is functorial. That is, it is described by a functor from the category of τ -structures Struct[τ ] to the category of τ -structures Struct[τ ]. In the category of τ -structures, the objects are τ -structures themselves and the morphisms are homomorphisms between structures.

By Theorem 3.2.5 and Proposition 3.2.11 from the previous chapter, we can assume without loss of generality that the input signature consists of a unique relation symbol. Let τ = {R} be the input signature of MMSNP 2 sentences and σ = σ V ⊎ σ T be the existential signature, where σ V = {M 1 , . . . , M u } and σ T = {X 1 , . . . , X s }. Let R have arity k, each M in σ V be unary, and each X in σ T be k-ary. We introduce signatures τ and σ and show that any MMSNP 2 problem over τ reduces to some MMSNP problem over τ . Construction 7 describes how we modify the sentence, Construction 8 describes how we modify the input of the corresponding problem. These two transformations are similar: the main idea is to add to every tuple a special vertex that represents the colour of this tuple.

Construction 7. The new input signature τ has unary relation symbols V and T , and a (k + 1)-ary relation symbol R. The new existential signature σ := σV ⊎ σT contains a unary relation symbol X, for any X in σ. Any MMSNP 2 τ -sentence Φ transforms to an MMSNP τ -sentence Φ as follows. Every τ -atom R(x) of Φ is replaced by the following conjunction that is displayed on Figure 4.1 on page 78: R(t, x) ∧ T (t) ∧

R(x)

R(t x , x) T (t x ) V(x)
x in x V(x).

Every unary σ-atom M(x) is replaced by the following conjunction:

M(x) ∧ V(x).
Every k-ary σ-atom X(x) that is guarded by a τ -atom R(x) is replaced by a unary σT -atom X(t), where t is a new variable that appears when we replace R(x) with R(t, x). Finally, we add to Φ all the negated conjuncts of the two types displayed on Figure 4.2 on page 79. For any X in σT , we add the negated conjunct ¬ V(x) ∧ X(x) . For any M in σV , we add the negated conjunct ¬ M(x) ∧ T (x) . This is the end of Construction 7.

Example 4.1.1. Let Φ be the MMSNP 2 sentence that is associated with the problem No-Monochromatic-Arc-Triangle from Example 3.2.2 on page 66:

∃B, W ∀x, y, z       ¬ E(x, y) ∧ B(x, y) ∧ W(x, y) ∧ ¬ E(x, y) ∧ ¬B(x, y) ∧ ¬W(x, y) ∧ ¬ E(x, y) ∧ E(y, z) ∧ E(z, x) ∧ B(x, y) ∧ B(y, z) ∧ B(z, x) ∧ ¬ E(x, y) ∧ E(y, z) ∧ E(z, x) ∧ W(x, y) ∧ W(y, z) ∧ W(z, x)      
Then, the MMSNP sentence Φ obtained by Construction 7 can be written as follows:

∃B, W ∀t xy , t yz , t zx , x, y, z

                 ¬ V(x) ∧ B(x) ∧ ¬ V(x) ∧ W(x) ∧ ¬ Ẽ(t xy , x, y) ∧ T (t xy ) ∧ V(x) ∧ V(y) ∧ B(t xy ) ∧ W(t xy ) ∧ ¬ Ẽ(t xy , x, y) ∧ T (t xy ) ∧ V(x) ∧ V(y) ∧ ¬B(t xy ) ∧ ¬W(t xy ) ∧ ¬ Ẽ(t xy , x, y) ∧ Ẽ(t yz , y, z) ∧ Ẽ(t zx , z, x)∧ ∧ T (t xy ) ∧ T (t yz ) ∧ T (t zx ) ∧ V(x) ∧ V(y) ∧ V(z) ∧ B(t xy ) ∧ B(t yz ) ∧ B(t zx ) ∧ ¬ Ẽ(t xy , x, y) ∧ Ẽ(t yz , y, z) ∧ Ẽ(t zx , z, x)∧ ∧ T (t xy ) ∧ T (t yz ) ∧ T (t zx ) ∧ V(x) ∧ V(y) ∧ V(z) ∧ W(t xy ) ∧ W(t yz ) ∧ W(t zx )                 
We first add two negated conjuncts from Figure 4.2, and then modify the other conjuncts of Φ as described in the construction. △ Now we explain how to transform an input structure A of MMSNP 2 to an input structure à of MMSNP. Remark. Further, we will usually call any element x a V-vertex if V(x) is satisfied and a T -vertex if T (x) is satisfied. Also, the relations V and T are not really necessary because they can be defined by the tuple coordinate where the considered element of à appears. If x appears on the first coordinate, then it is a T -vertex. If it appears anywhere else except for the first coordinate, then it is a V-vertex.

¬(V(x) ∧ X(x)) ¬(T (x) ∧ M(x))
We prove now that SAT(Φ) is reduced in P-time to SAT( Φ): SAT(Φ) ≤ p SAT( Φ).

Proposition 4.1.1. Let Φ be in MMSNP 2 and Φ in MMSNP be obtained from Φ by Construction 7. Then, for any τ -structure A there exists a τ -structure à constructible from A in P-time such that A |= Φ if and only if à |= Φ.

Proof. For any τ -structure A, we obtain à according to Construction 8. We need to show that these two structures are equivalent with respect to being models for Φ and Φ. Suppose that A |= Φ, that is, there is a σ-expansion A σ of A such that any negated conjunct of Φ is satisfied. We can assume that, for any X in σ T , X A σ ⊆ R A , otherwise, if we delete all the X-tuples not belonging to R A , then any negated conjunct will still be satisfied. Then we choose a σ-expansion Ãσ of à such that, for any X in σ T and any k-tuple a in R A , the T -vertex t a is in XÃσ if and only if a is in X A σ . And, for any M in σ V and any a in A, a is in MÃσ if and only if a is in M A σ . By the construction of Φ and Ã, we have that Ãσ satisfies any negated conjunct of Φ as well.

Suppose that à |= Φ; then there is a σ-expansion that satisfies any negated conjunct of Φ. In particular, it satisfies any negated conjunct of one of the types from Figure 4.2 on page 79. This means that no V-vertex is coloured by a σT -relation and that no Tvertex is coloured by a σV -relation. Then there exists a σ-expansion A σ of A such that A σ and Ãσ are related to each other as in the previous paragraph of this proof. Then, by the constructions of Φ and Ã, if some negated conjunct of Φ is not satisfied, then the corresponding negated conjunct of Φ is not satisfied in Ã.

Using the method from the proof of Proposition 4.1.1, we can extend Construction 8 onto (τ ⊎ σ)-structures, where all k-ary existential relations X ∈ σ T are interpreted as subsets of the τ -relation R.

Construction 9. Let A be a τ -structure, and A σ be one of its σ-expansions such that, for any X in σ T , X A σ ⊆ R A σ = R A . Let à be obtained from A by Construction 8. The σ-expansion Ãσ of à associated with A σ is constructed as follows. For any X in σ T and any R-tuple a in R A , the T -vertex t a is in XÃσ if and only if a is in X A σ . And, for any M in σ V and any a in A, a is in MÃσ if and only if a is in M A σ .

The (τ ⊎ σ)-structures obtained from (τ ⊎ σ)-structures by Construction 9 agree on homomorphisms.

Proposition 4.1.2. Let à and B be constructed from (τ ⊎ σ)-structures A and B. Then, A homomorphically maps to B if and only if à homomorphically maps to B.

Proof. Let h : A B be a homomorphism. Construct a map h as follows. For any V-vertex v of Ã, its image h(v) equals h(v). Any T -vertex t x of à is associated with some R-tuple x of A. The homomorphism h requires that h(x) is an R-tuple in B. Then, B contains a T -vertex t h(x) . We set h(t x ) := t h(x) . For any R-tuple (t

x , x) of Ã, its h-image is t h(x) , h(x) , by construction, it is an R-tuple of B. Any σT -coloured vertex t x of à is associated with a σ T -tuple x of A. Its image h(x) is a σ T -tuple of B.
So, by construction, the image h(t x ) is coloured in the same σT -colour. h is the same as h, once restricted on the V-vertices, so any σV -colour is also preserved.

Let h : Ã B be a homomorphism. Let h : A B be associated with the restriction of h on the V-vertices of Ã. Any σ V -colour is preserved. Consider an R-tuple x of A such that x also belongs to X A , for some X in σ T . It is associated with an R-tuple (t x , x) of Ã, where t x is coloured in X. This R-tuple is mapped to an R-tuple h(t x ), h(x) , where h(t x ) is coloured in X. This tuple is associated with an R-tuple h(x) that is coloured in X. As h(x) = h(x), we conclude that h is a homomorphism. It is routine to check that D preserves the identity arrows and the associative property.

Remark. The functor D can be naturally "reduced" on the category Struct[τ ], as any τ -structure is the τ -reduct of a (τ ⊎ σ)-structure with every σ-relation being interpreted as the empty set.

The following definition describes those structures in the MMSNP input that are associated with some input of MMSNP 2 . They are called good because we know how to treat them.

Definition 4. A structure is called good if it is isomorphic to D(A), for some A in Struct[τ ] ∪ Struct[τ ⊎ σ].

Normal 1 form for MMSNP 2

We show that MMSNP 2 sentences can be rewritten in a certain form that we use further. The transformed sentence is logically equivalent to the original one. Once a sentence is in this new form, we are able to represent the corresponding MMSNP 2 problem as a forbidden patterns problem (FPP), see Section 4.3 and Section 4.4.

As usual, we consider connected MMSNP 2 sentences over a relational signature with one k-ary symbol: τ = {R}. The existential relations (colours) of Φ are from some relational signature σ = σ T ⊎ σ V , where all symbols of σ T = {X 1 , . . . , X s } are k-ary, and all symbols of σ V = {M 1 , . . . , M u } are unary. Definition 5. An MMSNP 2 sentence Φ is said to be in normal 1 form if the following conditions hold.

1. Any element and any R-tuple have at least one colour. That is, the first two negated conjuncts of Φ are:

¬ ¬M 1 (x) ∧ • • • ∧ ¬M u (x) ∧ ¬ R(x) ∧ ¬X 1 (x) ∧ • • • ∧ ¬X s (x) .
2. Any element and any R-tuple have at most one colour. That is, for any distinct M, M ′ in σ V and X, X ′ in σ T , Φ contains the negated conjuncts:

¬ M(x) ∧ M ′ (x) , ¬ R(x) ∧ X(x) ∧ X ′ (x) .
4. Any negated conjunct ¬ϕ i of Φ is biconnected, i.e., the conjunction ϕ i cannot be divided in two parts ψ 1 and ψ 2 such that the negated conjunct ¬ϕ i equals

¬ ψ 1 (x, y) ∧ ψ 2 (x, z) ,
where x is some variable of ϕ i and y, z are two disjoint tuples of variables of ϕ i .

5. There are no implicit small clauses. That is, any (τ ⊎σ)-structure A with n elements satisfies the first-order parts of Φ if and only if it satisfies all the negated conjuncts with at most n variables.

If Φ is an MMSNP sentence (notice the absence of the 2 subscript), then this normal form is used by Feder and Vardi to prove the following theorem.

Theorem 4.2.1 ([FV98]). For any MMSNP sentence Φ there is a finite relational structure A such that SAT(Φ) and CSP(A) are P-time equivalent under randomized P-time reductions.

In the rest of this section, we show how to transform a sentence to have normal 1 form. We do a similar transformation to the one of Feder and Vardi in [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF] which is described with more details in [START_REF] Bodirsky | A universal-algebraic proof of the complexity dichotomy for monotone monadic SNP[END_REF]. In our case, the only difference is to make the σ T -existential relations form a partition on the R-tuples of an input structure and to ensure that any clause is fully coloured with respect to R-tuples. We proceed as for unary existential relations by Feder and Vardi in [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF].

Proposition 4.2.2. For any MMSNP 2 sentence Φ there is an MMSNP 2 sentence Φ ′ in normal 1 form which is logically equivalent to Φ.

Proof.

Make every conjunct biconnected. If there is a negated conjunct ¬ϕ i that has the form:

¬ ψ 1 (x, y) ∧ ψ 2 (x, z) , then we augment σ V with a new unary relation P and replace ¬ϕ i with the two negated conjuncts:

¬ ψ 1 (x, y) ∧ P(x) , ¬ ψ 2 (x, z) ∧ ¬P(x) .
Make all implicit small clauses explicit. This transformation has the same nature as Construction 3 on page 62. Let ¬ϕ(x 1 , . . . , x l ) be some negated conjunct of Φ. Let x be a variable that does not appear among the variables x 1 , . . . , x n used in Φ. Construct the negated conjunct ¬ϕ(y 1 , . . . , y l ), where, for any i in [l], y i equals either x i or x, and, for at least two different i, j ≤ l, we have y i = y j = x. If this conjunct is biconnected, then we add it to Φ. If it is not biconnected, then we use the procedure from the first step and, instead of ¬ϕ(y 1 , . . . , y l ), add the corresponding conjunction of biconnected negated conjuncts. Do this procedure for any negated conjunct of Φ, this process eventually ends as the number of variables reduces each time. Let now A be a (τ ⊎ σ)-structure with n elements. Suppose that it does not satisfy a negated conjunct ¬ϕ(x 1 , . . . , x l ) with l > n variables. Then some variables must have a common element of A which is assigned to them. Then we find the corresponding negated conjunct ¬ϕ(y 1 , . . . , y n ) (if it is biconnected) or one of the biconnected negated conjuncts obtained from it and that is not satisfied by A. Each of these conjuncts has at most n variables.

Partition and fully coloured clauses. We describe the procedure only for k-ary existential relations of σ T . The procedure for unary relations is similar to the procedure for the case of MMSNP as described in [START_REF] Bodirsky | A universal-algebraic proof of the complexity dichotomy for monotone monadic SNP[END_REF]. We check if for any R-atom R(x) of Φ and for any X in σ T there is either the X-atom X(x) or the negated X-atom ¬X(x) in the same conjunct as R(x). If there is a negated conjunct ¬ϕ i that does not satisfy this condition, then we replace it with

¬ ϕ i ∧ X(x) ∧ ¬ ϕ i ∧ ¬X(x) .
Once this property is achieved, we replace the existential signature σ T with a signature 2 σ T , where each relation symbol is associated with a subset of σ T . It is uniquely determined which new relation we should assign to any R-atom R(x) because now, for any X in σ T , the negated conjunct containing the atom R(x) also contains either X(x) or ¬X(x) but not both at the same time. We demand that the new relations must form a partition of the R-tuples of an input structure by adding the following negated conjuncts:

¬ R(x) ∧ X∈2 σ T ¬X(x) ∧ X,Y∈2 σ T ¬ R(x) ∧ X(x) ∧ Y(x) .
Example 4.2.1. Let Φ describe the No-Monochromatic-Arc-Triangle problem. Similarly as in Example 3.2.2. Φ can be written as follows:

∃B, W ∀x, y, z       ¬ E(x, y) ∧ ¬B(x, y) ∧ ¬W(x, y) ∧ ¬ E(x, y) ∧ B(x, y) ∧ W(x, y) ∧ ¬ E(x, y) ∧ E(y, z) ∧ E(z, x) ∧ B(x, y) ∧ B(y, z) ∧ B(z, x) ∧ ¬ E(x, y) ∧ E(y, z) ∧ E(z, x) ∧ W(x, y) ∧ W(y, z) ∧ W(z, x)      
This sentence is not in normal 1 form by several reasons. We do not restrict any element to be coloured, as there are no unary existential relations. Consequently, the clauses are not fully coloured. However, all of the conjuncts are biconnected. But there are implicit small clauses, as the structure consisting of a single vertex with a loop does not satisfy Φ, but, as any negated conjunct has at least 2 variables, this structure satisfies any conjunct with at most 1 variable.

We repeat the steps of the proof of Proposition 4.2.2. We skip the first step, as all conjuncts are already biconnected. Then, we explicitly write all implicit small clauses. Up to isomorphism, there are two digraphs that can be obtained from the directed cycle of length 3. They are displayed on Figure 4.4. Observe that both of them are biconnected.

As only monochromatic-arc triangles are forbidden, for every triangle with coloured arcs, we add the two images with all arcs having the same colour. After this step, the sentence Φ is written as follows:

∃B, W ∀x, y, z                 ¬ E(x, y) ∧ ¬B(x, y) ∧ ¬W(x, y) ∧ ¬ E(x, y) ∧ B(x, y) ∧ W(x, y) ∧ ¬ E(x, x) ∧ B(x, x) ∧ ¬ E(x, y) ∧ E(y, x) ∧ E(x, x) ∧ B(x, y) ∧ B(y, x) ∧ B(x, x) ∧ ¬ E(x, y) ∧ E(y, z) ∧ E(z, x) ∧ B(x, y) ∧ B(y, z) ∧ B(z, x) ∧ ¬ E(x, y) ∧ W(x, x) ∧ ¬ E(x, y) ∧ E(y, x) ∧ E(x, x) ∧ W(x, y) ∧ W(y, x) ∧ W(x, x) ∧ ¬ E(x, y) ∧ E(y, z) ∧ E(z, x) ∧ W(x, y) ∧ W(y, z) ∧ W(z, x)                
Now we only need to introduce one unary existential relation M, require that every element must be coloured with it, and colour every variable of any conjunct with this colour. After this change, the sentence Φ will be in normal 1 form. It will be written as follows:

∃M, B, W ∀x, y, z

                ¬ ¬M(x) ∧ ¬ E(x, y) ∧ ¬B(x, y) ∧ ¬W(x, y) ∧ ¬ E(x, y) ∧ M(x) ∧ M(y) ∧ B(x, y) ∧ W(x, y) ∧ ¬ E(x, x) ∧ M(x) ∧ B(x, x) ∧ ¬ E(x, y) ∧ E(y, x) ∧ E(x, x) ∧ M(x) ∧ M(y) ∧ B(x, y) ∧ B(y, x) ∧ B(x, x) ∧ ¬ E(x, y) ∧ E(y, z) ∧ E(z, x) ∧ M(x) ∧ M(y) ∧ M(z) ∧ B(x, y) ∧ B(y, z) ∧ B(z, x) ∧ ¬ E(x, x) ∧ M(x) ∧ W(x, x) ∧ ¬ E(x, y) ∧ E(y, x) ∧ E(x, x) ∧ M(x) ∧ M(y) ∧ W(x, y) ∧ W(y, x) ∧ W(x, x) ∧ ¬ E(x, y) ∧ E(y, z) ∧ E(z, x) ∧ M(x) ∧ M(y) ∧ M(z) ∧ W(x, y) ∧ W(y, z) ∧ W(z, x)                 △

MMSNP 2 and infinite MMSNP

In Proposition 4.1.1 of Section 4.1, we have shown that for any MMSNP 2 sentence Φ there exists an MMSNP sentence Φ such that SAT(Φ) ≤ p SAT( Φ). We now argue that it is not likely to have the other reduction direction between SAT(Φ) and SAT( Φ), even if we consider instead of Φ another τ -sentence that is logically equivalent to Φ on the input consisting of good τ -structures. Failing to find an equivalent MMSNP problem, we show that SAT(Φ) is P-time equivalent to a problem that looks like an infinite MMSNP. We turn to the language of forbidden patterns problems that is equivalent to MMSNP when there are finitely many forbidden patterns. Although, in our case, we need infinitely many forbidden patterns, it happens that the family consisting of these patterns is regular, which roughly means "finitely describable". This regularity property will be specified later, in Section 4.4. By Proposition 4.2.2 from Section 4.2, we can assume that any connected MMSNP 2 sentence that we consider is also in normal 1 form. This means that the existential relations always make a partition of both R-tuples and vertices of the input structure.

Recall that τ = {R} and τ = {T , V, R}; and that the arity of the τ -relation symbol R is k, T and V are unary, and the arity of the corresponding τ -relation symbol R is k + 1. Now we modify the MMSNP sentence Φ so that the resulting sentence rejects more input structures that are not good. To do this, we add to Φ a family of negated conjuncts that help us reject some non good τ -structures. There are five types of negated conjuncts, all of them are displayed on Figure 4.5 on page 85. Denote the new formula by Φ′ . These conjuncts are not fully coloured, therefore we consider every possible way to assign σrelations to uncoloured elements.

• The first type contains just one negated conjunct: ¬ T (x) ∧ V(x) . It forbids an element to be both a T -vertex and a V-vertex at the same time.

• The second type forbids a T -vertex to be in an R-tuple on any coordinate except for the first one. For every i in [k], we add the following: ¬ T (x i ) ∧ R(t, x) , where x i is the ith element of the k-tuple x.

• The third type forbids a V-vertex to be on the first coordinate of some R-tuple. We just add the following negated conjunct: ¬ V(t) ∧ R(t, x) .

• The fourth type is the most interesting. We would like to forbid one T -vertex to be adjacent to more than one R-tuple. Sadly, it is not likely to be expressed unless we use inequalities. However, we are still able to require that, for any two R-tuples (t, x), (t, y) having a common T -vertex and for any coordinate i in [k], the corresponding elements x i , y i must be coloured in the same σ-relations.

• The fifth type requires that any two R-tuples that have the same V-vertices must have their T -vertices coloured in the same σ-relations.

Proposition 4.3.1. SAT(Φ) is reducible in P-time to SAT( Φ′ ).

Proof. For any τ -structure A, its image à := D(A) satisfies all the negated conjuncts from Observe that the sentence Φ′ adds constraints only for those elements that are contained either in T -relation or in V-relation. This means that, for any τ -structure A, we have A |= Φ′ if and only if A[A TV ] |= Φ′ , where

A TV = {a ∈ A | a ∈ T A ∪ V A }.
We introduce two useful notions that describe the situation when a τ -structure is not good. Definition 6. Let us call a τ -structure A ugly if it does not satisfy some negated conjuncts of the first three types from Figure 4.5.

In particular, it is FO-definable to check if a structure is ugly, as the negated conjuncts of the first three types do not have σ-atoms. Definition 7. If, for a τ -structure A, there are two R-tuples (t, x) and (t, y) such that x is distinct from y, then we say that that A has duplicated tuples.

The current goal is to argue that τ -structures with duplicated tuples is the only obstacle for having SAT(Φ) ≡ p SAT( Φ).

Proposition 4.3.2. Let A be a τ -structure. Then one of the following statements holds.

• A has duplicated tuples.

• A is an ugly structure and is rejected by Φ′ .

• One can construct in P-time in |A| a τ -structure B such that B |= Φ if and only if A |= Φ′ .
Proof. Suppose that A is neither ugly nor has duplicated tuples. Recall that without loss of generality we can assume that, for any a in A, a belongs to T A ⊎ V A . This union is disjoint as A is not ugly. Suppose that there are two tuples (t, x), (t ′ , x) in RA with distinct T -vertices t and t ′ . If we prove that A |= Φ′ if and only if A[A ∖ {t ′ }] |= Φ′ , then we are done, because we can delete all such T -vertices one-by-one, and, at the end, we get a good structure. And for any good structure there exists an equivalent τ -structure, by Proposition 4.1.2. By Lemma 2.2.1, we know that any SNP sentence is closed under taking induced substructures. Thus,

A |= Φ′ implies A[A ∖ {t ′ }] |= Φ′ . For the other direction, suppose that A[A ∖ {t ′ }] |= Φ′ . Let A[A ∖ {t ′ }] σ be a valid σ-expansion i.e., it satisfies every negated conjunct of Φ′ . Pick a σ-expansion A σ such that A σ[A ∖ {t ′ }] = A[A ∖ {t ′ }] σ and that the T -vertex t ′ is in XA σ if
and only if t is in XA σ , for any X in σT . That is, the σT colours for t and t ′ have to be the same. Otherwise, it would not satisfy some negated conjunct of the fifth type from Figure 4.5 on page 85. Suppose that, for some negated conjunct ¬ φi (x i ) of Φ′ and for some tuple a i , we have A σ |= φi (a i ). Let a ′ i be obtained from a i by replacing each occurence of t ′ with t. As the T -vertices t and t ′ agree on the σT relations, as they do not belong to any σV -relation, by the construction of Φ, and as A contains no duplicated tuples, we can conclude that A σ |= φi (a ′ i ). But then we have

A σ[A ∖ {t ′ }] |= φi (a ′
i ) which contradicts our assumption that A[A ∖ {t ′ }] |= Φ′ . It is not clear which τ -structure should be associated with a τ -structure with duplicated tuples. Such R-tuples represent two distinct R-tuples. But, as they share the T -vertex, the corresponding R-tuples must have the same σ T -colours. And it is not clear how to construct a τ -structure that can express such constraints.

Although we do not know how to show a P-time equivalence between MMSNP 2 and MMSNP, we still can generalise MMSNP sentences by using the language of forbidden patterns problems (FPPs). This approach is introduced by Madelaine in [START_REF] Florent | Constraint satisfaction, logic and forbidden patterns[END_REF] in order to describe the MMSNP problems that are not CSP problems. It is shown to be P-time equivalent to MMSNP. This notion has later been extended for the case of the MMSNP 2 logic in [START_REF] Florent | Universal structures and the logic of forbidden patterns[END_REF]. Though, these classes have always been defined to have finitely many forbidden structures. We need more than that. In the rest of this subsection we define the class of problems FPP ∞ 1 and show that any MMSNP 2 problem SAT(Φ) over a finite signature τ is P-time equivalent to some FPP ∞ 1 problem over the corresponding signature τ .

At first, we provide the definitions of forbidden patterns problems FPP 1 and FPP 2 as they are defined in [START_REF] Florent | Constraint satisfaction, logic and forbidden patterns[END_REF][START_REF] Florent | Universal structures and the logic of forbidden patterns[END_REF]. Let V be a finite set of vertex colours, F 1 be a finite family of pairs (F τ , v F τ ), where F τ is a τ -structure and v F τ : F

V is a mapping that assigns a colour of V to each element of F τ . FPP 1 (F) is a decision problem defined on τ -structures such that a τ -structure A belongs to the class FPP 1 (F) if and only if there is a mapping v A : A V such that, for any

(F τ , v F τ ) in F, if there is a homomorphism h : F τ A, then v A • h ̸ = v F τ .
Example 4.3.1. Consider the problem No-Monochromatic-Triangle: this is a decision problem defined on directed graphs, it accepts the input graph G if one can colour its vertices with 2 colours B, W such that we cannot map to G the directed 3-cycle with its vertices having the same colour. The family F 1 consists of 6 structures that are displayed on Figure 4.6. It is the two monochromatic 3-cycles and all the possible homomorphic images of them.

△

Let τ = {R}. Let V be a finite set of vertex colours, E be a finite set of edge (tuple) colours, and F be a finite set of triples (F τ , v F τ , e F τ ), where F τ is a τ -structure, v F τ : F V is a mapping that colours the elements of F τ , and e F τ : R F τ E is a mapping that colours the R-tuples of F τ . For a τ -structure A, we say that A belongs to the class FPP 2 (F) if and only if there are mappings v A : A

V and e A : R A E such that, for any Proof. As Φ is in normal 1 form, this sentence contains negated conjuncts that force the choice of the existential relations to be partitions of both vertices and R-tuples. That is, the negated conjuncts of the following forms:

(F τ , v F τ , e F τ ) in F, there is no homomorphism h : F τ A such that v A • h = v F τ and e A h(f ) = e F τ (
¬ M∈σ V ¬M(x) ∧ M,M ′ ∈σ V ¬ M(x) ∧ M ′ (x) , ¬ R(x) ∧ X∈σ T ¬X(x) ∧ X,X ′ ∈σ T ¬ R(x) ∧ X(x) ∧ X ′ (x) .
For any other negated conjunct of Φ, we know that its canonical database is a connected (τ ⊎ σ)-structure F such that any of its vertices and any of its R-tuples is coloured in exactly one existential colour of σ, where σ = σ T ⊎ σ V . We say that the set of vertex colours V is equal to the set of monadic existential relation symbols σ V , and that the set of edge colours E is equal to the set of k-ary existential relation symbols σ T . For a negated conjunct ¬ϕ i of Φ, we construct the triple (F τ i , v F τ i , e F τ i ) as follows. The τ -structure F τ i is the τ -reduct of the canonical database F i of ϕ i . For any variable x of ϕ i there is exactly one σ-atom M(x) in ϕ i , so, in this case, we set v F τ i (x) := M. For any τ -atom R(x) of ϕ i there is exactly one σ-atom X(x) in ϕ i , so we set e F τ i (x) = X. The mappings v F τ i and e F τ i are well-defined for every negated conjunct ¬ϕ i of Φ. The class F 2 is constructed. Take any τ -structure A. Suppose that A |= Φ; then there exists a σ-expansion A σ such that any element and any R-tuple of A are coloured in exactly one colour of σ and that any negated conjunct of Φ is satisfied. This σ-expansion induces the mappings v A : A V and e A : R A E. By the construction of F 2 , we must have A be accepted by FPP 2 (F 2 ). Suppose that A satisfies FPP 2 (F 2 ). Then there exist corresponding mappings v A and e A . These mappings induce a partition of elements of A and a partition of R-tuples of A, thus, they induce a σ-expansion of A. If this expansion does not satisfy some negated conjunct ¬ϕ i , then, by the construction of F 2 , there is a homomorphism h : F τ i A that violates the property.

We depart marginally from the way the classes FPP 1 and FPP 2 are defined: this is purely notational. We get rid of the mappings and propose the concept of a colouring expansion. One should think of colourings as of expansions, where we can define σ Trelations only on input tuples. Definition 8. A σ-expansion A σ of some τ -structure A is called a σ-colouring if

• for any element a of A there is a unique unary M in σ V such that M A σ (a), and • for any tuple a in R A there is a unique X in σ T such that a belongs to X A σ , and Before we describe how F 1 is constructed, we would like to explain informally why and how we shall proceed. We could use as obstruction set the family O = {G | F G/eq, for some F ∈ F 2 }. Although it is easier to show that FPP ∞ 1 (O) ≡ p FPP 2 (F 2 ), this family would not have the regularity property we wish for, which is made precise later, in Section 4.4. So we construct a subset F 1 of O with some care.

• for any relation X in σ T , it is contained in the set of R-tuples of A: X A σ ⊆ R A .
We want that for any O in O there is some G in F 1 such that G has a homomorphism h 1 to O. By construction of O, there is some F in F 2 and a homomorphism h 0 : F O/eq. Let Old be the set of elements of O that are in an equivalence class of eq in the image of the homomorphism h 0 . We informally refer to such elements as Old elements.

We want G to be "simple" enough so that the class F 1 is regular. Here, "simple" will mean that locally it shall be tree-like. Indeed, viewing the computation of eq as an inductive process, i.e., two vertices are made eq-equivalent if they appear in the same coordinate of a duplicated tuple, then we can reconstruct a minimal "explanation" as to why Old elements of O are in the same eq-equivalence class. This minimal explanation is by nature tree-like.

What amounts to one image of a tuple of F under the homomorphism h 0 may be associated with several tuples in O. Because taking the quotient under eq "squashes" duplicated tuples, we may have in O something that amounts to "stretched" tuples in the inverse of the surjective homomorphism from O to O/eq.

Because we need a simple obstruction G to have a homomorphism h 1 to O, it means that at the very least it must also have such "stretched tuples". This is made precise in the construction of F• below. This structure F• seems not general enough for our purpose as the distance between some Old elements of O may be large unlike the elements of F• , where there is a unique Old element within each equivalence class. So we have no hope to guarantee a homomorphism from F• to O. We can however describe a specific structure G that is inductively constructed from F• , where the preimage of Old elements is connected in a tree-like fashion that encapsulates minimal explanation of the computation of eq. Figure 4.10 on page 91 illustrates these ideas. Making the class F 1 . Now we are going to construct a countably infinite class F 1 of coloured (τ ⊎ σ)-structures and then show that SAT(Φ) ≡ p FPP ∞ 1 (F 1 ). The family F 1 is the disjoint union of the families:

F• F G O O/eq F D . . . F 1 O F 2 h 1 h 0
F 1 := F ugly ⊎ F∈F 2 F F .
Here, F ugly is a family of coloured (τ ⊎ σ)-structures that are canonical databases of the negated conjuncts of the types from Figure 4.2 on page 79 and Figure 4.5 on page 85 reproduced below.

For those negated conjunct variables that are not coloured, we consider all possible σcolourings of them.

Every family F F is obtained from some coloured (τ ⊎ σ)-structure F in F 2 , where F 2 is constructed from Φ as in the proof of Proposition 4.3.3.

As we require that the V-vertices that are on the same coordinate of two duplicated tuples cannot be coloured with different σ-relations, we know that no two V-vertices of the same eq-equivalence class can be coloured with different σ-relations. This relation is useful because we plan to add to F F all minimal by inclusion coloured (τ ⊎ σ)-structures G such that G/eq contains F as an induced substructure.

We define a unary relation Old, for any structure that we add to F F . For a structure F, where F is in F 2 , we set Old F := V F. As any structure of F F is constructed from F by adding new vertices, the relation Old helps us to remember which vertices are associated with the original ones in F.

Recall that k is the arity of the relation symbol R in τ . For a coloured (τ ⊎σ)-structure F in F 2 , denote by F• the following coloured (τ ⊎ σ)-structure. This structure is obtained from F by replacing any R-tuple (t, x) with k duplicated R-tuples (t, y 1 ), . . . , (t, y k ), where, for i in [k], the ith element y i,i of the tuple y i is equal to the ith element x i of x, and all other elements are new and do not appear anywhere else. The relation Old F• consists of the V-vertices y i,i that are associated with the vertices x i of F . See Figure 4.11 on page 92, for an illustration. The following construction describes the countably infinite family of coloured (τ ⊎ σ)structures associated with a given coloured (τ ⊎ σ)-structure F in F 2 .

Construction 10. The class F F is defined by induction. For the base case, we add F• to F F .

For the induction step, let a coloured (τ ⊎ σ)-structure G belong to F F . A new coloured structure G ′ is constructed from G as follows. Firstly, let G ′ be a copy of G, with Old G ′ = Old G .

Let x be an Old vertex of G ′ . Suppose that there is more than one R-tuple that contains x: (t 1 , v 1 ), . . . , (t n , v n ), where the ordering of these tuples is chosen arbitrarily. We split these n tuples in two non-empty sets X 1 , X 2 , without loss of generality, choose some m in [n -1] and put

(t i , v i ) in X 1 if i ≤ m, otherwise put it to X 2 .
We introduce two new V-vertices x 1 and x 2 and require that they have the same unary (τ ⊎ σ)-relations as x: they are both Old V-vertices that have the same σ-colour as x does. Then we introduce a new T -vertex t and 2(k -1) new V-vertices, and add to RG ′ a pair of duplicated tuples (t, w 1 ), (t, w 2 ), where w 1 , w 2 consist of x 1 , x 2 and of the recently added 2(k -1) V-vertices. Moreover, for some i in [k], the ith coordinate of w 1 is x 1 and the ith coordinate of w 2 is x 2 . We assign some σT colour to t and some σV colours to the 2(k -1) V-vertices such that any two vertices that are on the same coordinate in w 1 and w 2 must have the same σV colour.

Finally, delete x from G ′ and replace all its occurences in tuples of X 1 with x 1 and replace all its occurences in tuples of X 2 with x 2 . The construction of G ′ from G is finished. Any structure G ′ obtained by this procedure from some G in F F is added to F F . This finishes Construction 10. Example 4.3.4. Consider Figure 4.12 on page 93. Suppose that R is a binary relation and that F is as on Figure 4.12. At the first step, we copy the vertex x that is coloured in "red". The new vertices x 1 and x 2 are also Old and have the same colour as x. The vertex x 1 is not connected to y, and x 2 is not connected to u and v. Then we add a pair of duplicated R-tuples that have x 1 and x 2 on the same coordinate. The pair of newly added V-vertices is coloured with the same σV -colour. The resulting structure is called G 1 . Similarly, G 2 is obtained from G 1 by replacing x 1 with x 11 and x 12 . △ Tree families. There is a nice way to represent structures of every family F F . Any G in F F can be encoded by a family of labeled unoriented trees

F• G 2 G 1 F x x x1 x2
T G = {T f | f ∈ F }, where F is the domain of F ∈ F 2 .
Each tree is associated with an element of F or, equivalently, with a V-vertex of F.

Construction 11. The vertex set T f of a tree T f in T G consists of Old vertices that belong to the same eq-equivalence class [f ] eq of G, that is, T f := Old G ∩ [f ] eq . For two vertices v, w in T f there is an edge vw in T f if G contains a pair of duplicated R-tuples (t, y) and (t, z) that have v and w on the same coordinate, i.e., for some i in [k], v = y i and w = z i , see For any tree T f of T F there is a set of labels L f that are assigned to vertices of T f . Each L f is associated with the set of R-tuples of F that contain the element f . Let l f in L f be associated with some tuple

f = (f 1 , . . . , f k ) in R F , where f = f i , for some i in [k].
The label l f is assigned to a vertex y of T f if there is an R-tuple (t, y 1 , . . . , y k ) such that, for any j in [k], y j belongs to the eq-equivalence class [f j ] eq . By the construction of F F , for any label of L f there is a unique vertex of T f that has this label.

Any edge of any tree T f of T G has a number i in [k], a relation symbol from σT , and a (k -1)-tuple of relation symbols of σV assigned to it. Suppose that v and w are two Old vertices that are contained on the same coordinate within a pair of duplicated tuples R(t, y) and R(t, z), that is, for some i in [k], v = y i and w = z i . Then the corresponding edge vw has a number i assigned to it. We require that any element of G is coloured with exactly one monadic relation of σ, so we need to assign a σT -relation to the T -vertex t and σV -relations to the other 2(k -1) V-vertices of the tuples R(t, x) and R(t, y). As every two V-vertices on the same coordinate must have the same colour, we can express it by a (k -1)-tuple of relation symbols of σV . See Example 4.3.5. Look at Figure 4.15. It has three families of labeled trees that are associated with the structures from Figure 4.12 on page 93. Those elements that are connected by a pair of duplicated tuples are adjacent within the corresponding tree. Every tree of the first added structure F• consists of one vertex that has all the labels. After that, trees grow in size. In the tree family T G 1 , the edge has label 2 because x 1 and x 2 are both on the second coordinate within the pair of duplicated tuples in G 1 . Similarly, the edges of T G 2 have labels 1 and 2, which is associated with the structure G 2 of Figure 4.12. The coloured squares represent the monadic relations of σ that are assigned to the T -vertex and to the pair of V-vertices, for each pair of duplicated tuples.

△

Recall that a vertex of a tree is called a leaf if its degree is equal to 1.

Proposition 4.3.5. Let G be in F F , and T G be the corresponding labeled tree family. Then, for any tree T f of T G and for any leaf of T f there is a label in L f assigned to this leaf.

ω-categorical templates for MMSNP 2 and infinite MMSNP

We show that the class F 1 is regular. By the result of Hubička and Nešetřil, it implies the existence of an ω-categorical (τ ⊎ σ)-structure C synt such that a τ -structure A is accepted by FPP ∞ 1 (F 1 ) if and only if A homomorphically maps to the τ -reduct C τ synt of C synt . We also show that for any MMSNP 2 τ -sentence Φ that is in normal 1 form there is an ω-categorical (τ ⊎ σ)-structure C Φ such that, for any τ -structure A, A satisfies Φ if and only if there is a homomorphism from A to the τ -reduct C τ Φ of C Φ . Finally, we show, for the functorial image C sem := D(C Φ ), that the structures C sem and C synt are homomorphically equivalent.

Preliminaries

A pair (P, r) is called a rooted structure, if P is a relational structure with domain P and r is a linearly ordered proper subset of elements of P. The elements of r are called the roots of P.

Let F be a relational structure. A rooted structure (P, r) is called a piece of F, if

• P is an induced connected substructure of F;

• r = (r 1 , . . . , r p ) is a minimal set of elements of P such that, for any relational tuple x, if x contains an element x that belongs to the complement F ∖ P and an element x ′ that belongs to P , then x ′ must be contained in r.

In this case, we say that F contains the piece (P, r). If F is a member of some family of structures F, then we also call (P, r) a piece of F. Example 4.4.1. If the structure F 1 is a graph, then any induced connected subgraph P 1 of F 1 is a piece, where the set of roots r 1 is a minimal separator, i.e., a minimal by inclusion subset r 1 of P 1 such that F 1 [F 1 ∖ r 1 ] is not connected. However, if relational tuples of F 2 have arity greater than two, then there might be an induced connected substructure P 2 and a minimal separator r 2 such that (P 2 , r 2 ) is not a piece of F 2 . These two cases are displayed on Let F be a family of structures. Suppose that (P, r) and (P ′ , r ′ ) are pieces of structures of F such that the pairwise correspondence between their roots induces an isomorphism between the induced substructures P[r] and P ′ [r ′ ]. Then, (P, r) and (P ′ , r ′ ) are called incompatible with respect to F if (P, r) ⊕ (P ′ , r ′ ) belongs to F.

Let (P, r) be a piece of some structure F in F. Then, I (P,r) denotes the set of all pieces that are incompatible with (P, r) with respect to F.

One can define the following equivalence relation ∼ F on the set of all pieces of F. We say that two pieces (P, r) and (P ′ , r ′ ) of F are equivalent, denoted (P, r) ∼ F (P ′ , r ′ ), if

I (P,r) = I (P ′ ,r ′ ) .
A family of τ -structures F is called regular if the number of the ∼ F -equivalence classes is finite.

(P 1 , r 1 ) (P 2 , r 2 ) (P 3 , r 3 ) (P 1 , r 1 ) ⊕ (P 2 , r 2 ) (P 1 , r 1 ) ⊕ (P 3 , r 3 )
Figure 4.18: Pieces of odd cycles (coloured in red), and graphs obtained from them by the ⊕ operation.

Example 4.4.2. Let F be a family of undirected graphs that consists of odd cycles. Every piece of an odd cycle is a path. There are two equivalence classes of pieces: paths of odd length and paths of even length. As any odd length path is incompatible to any even length path with respect to F. Indeed, if we join them by the ⊕ operation, then we will obtain an odd cycle.

Consider three pieces displayed on Figure 4.18. (P 1 , r 1 ) and (P 2 , r 2 ) are paths of odd length. (P 3 , r 3 ) is a path of even length. And, as a result, (P 1 , r 1 ) ⊕ (P 2 , r 2 ) is an even cycle that does not belong to F, and (P 1 , r 1 ) ⊕ (P 3 , r 3 ) is a member of F. △

A countably infinite relational structure A is called ω-categorical if all models of the first-order theory of A are isomorphic to each other.

The concept of ω-categorical structure has another equivalent definition. An isomorphism a : A A from a structure to itself is called an automorphism. The set Aut(A) of automorphisms of A is a group with respect to the composition. Consider actions of this group on sets of tuples of elements of A: A, A 2 , A 3 , . . ., where, for (a 1 , . . . , a k ) in A k and a in Aut(A), we put a • (a 1 , . . . , a k ) := a(a 1 ), . . . , a(a k ) .

For an action of a group G on a set X, the orbit of an element x in X is a subset of elements of X where x can be mapped by the elements of G. A group G is called oligomorphic if, for any k in N, the action of G on X k has finitely many orbits.

Proposition 4.4.1. A countably infinite structure A is ω-categorical if and only if Aut(A) is oligomorphic.

Example 4.4.3. Consider a structure (Z, <) -its domain consists of integers, and the only relation is the linear ordering. Any automorphism a t of (Z, <) is of the form x x + t, for t ∈ Z. For any two elements x, y in Z there exists an automorphism a y-x ∈ Aut(Z, <) that maps x to y. This means that all elements are in the same orbit. Thus, (Z, <) is ω-categorical. △

It is well-known, that, for a finite family of forbidden relational structures there exists a universal ω-categorical structure.

Theorem 4.4.2 (Theorem 4 in [START_REF] Cherlin | Universal graphs with forbidden subgraphs and algebraic closure[END_REF]). Let F be a finite set of finite connected relational structures. Then there exists an ω-categorical τ -structure B such that, for any finite structure A, there is an embedding: A B if and only if for any F in F there is no homomorphism from F to A.

Hubička and Nešetřil extend this result by showing that this property holds not only for finite but also for regular families of forbidden structures.

Theorem 4.4.3 (Theorem 3.1 in [START_REF] Hubicka | Universal structures with forbidden homomorphisms[END_REF]). Let F be a regular family of finite connected relational structures. Then there exists an ω-categorical structure C such that, for any finite structure A, there is an embedding: A C if and only if for any F in F there is no homomorphism from F to A.

Regularity

For showing the regularity of F 1 , it suffices to show that the number of ∼ F -equivalence classes is finite within any subfamily F F , as there are finitely many such subfamilies that make F 1 .

Our aim is to prove that the class F 1 is regular, we do it at the end of this part in Theorem 4.4.6. In order to prove this theorem, we represent every piece of a structure of F F in a better-looking form which is based on the labeled tree family construction discussed on page 93. We first describe this form, then justify that we can consider these forms instead of pieces, and finally prove that these forms have the regularity property.

We first define what is the label graph of a structure F in F 2 .

Definition 11. Take some (τ ⊎ σ)-structure F from F 2 . Let L F be an undirected graph with possibly multiple edges that is obtained from F as follows.

1. The domain of L F is the same as the domain F of F.

2. Edges of L F have labels from the set l x | x ∈ R F .

3. Every k-tuple x of elements of F is replaced in L F by a k-clique induced on the vertices of x, each edge of this clique has a label l x that is associated with x.

We call such L F the label graph of F. Example 4.4.4. Let F be as on Figure 4.19. Every tuple of arity k in F is replaced by a k-clique in L F . In our case, every relational tuple of F is ternary, so we replace it with a 3-clique K 3 . If K 3 substitutes a tuple t, then every edge of it obtains a label associated with t. △

We are going to use the concept of a semi-edge that is discussed in [BFJ + 22]. Semiedge is an edge with just one end. Every edge xy contains two semi-edges, one semi-edge is incident to x, the other is incident to y. For every graph G = (G, E G ) there exists a unique set of semi-edges

S G = {(v, e) | v ∈ G, e ∈ E G , v is incident to e}.
Remark. We need semi-edges because edges of trees of T G represent pairs of duplicated tuples. Semi-edges help us to describe the case when only one tuple of the pair belongs to a piece. Definition 12. Let G be a graph, V ⊆ G be a subset of vertices, and S ⊂ S G be a subset of semi-edges. We say that a pair (V, S) is connected if:

• for any semi-edge s in S there is a vertex v in V such that s is incident to v;

• for any two vertices v and w in V there is a path in G such that, for any edge of this path, both its semi-edges are contained in S.

Example 4.4.5. Consider 3 pairs (V i , S i ), for i in [3], displayed on Figure 4.20. A vertex is red if it belongs to V i . A semiedge is red if it belongs to S i . For the pair (V 1 , S 1 ) there exist two vertices of V 1 that are not connected with a path consisting of semi-edges from S 1 , so this pair is not connected. For the pair (V 2 , S 2 ) there exist semi-edges in S 2 that are not incident to any vertex of V 2 , so this pair is not connected too. The pair (V 3 , S 3 ) satisfies both conditions, so it is connected. Definition 13. Let G be in F F and P be a collection of pairs:

△ (V 1 , S 1 ) (V 2 , S 2 ) (V 3 , S 3 )
P := V L F , S L F , V 1 , S 1 , . . . , V n , S n .
Here, V L F and S L F are some subsets of vertices and semi-edges of the graph L F , and

n := |V L F |. For i in [n],
V i and S i are some subsets of vertices and semi-edges of the tree

T f i in T G , where f i is the ith element of V L F = {f 1 , . . . , f n }. Such family P is called piece alike if the following conditions hold. • V L F , S L F is connected.
• For any i in [n], for any semi-edge s in S i there is a vertex v in V i such that s is incident to v.

• If, for some element f i of L F , f i ̸ ∈ V L F , then the corresponding sets V i and S i are empty.

• Suppose that a semi-edge s in S L F is incident to a vertex v in V L F and that it belongs to an edge of L F with a label l x , for some x in R F ; then any other semi-edge of L F which is incident to v and has a label l x must belong to S L F .

• It is possible to define a connected binary relation P on the set V 1 ∪ • • • ∪ V n such that a pair (x, y) belongs to P if and only if either x and y belong to the same V i , (x, y) is an edge , and S i contains both semiedges of (x, y), or x belongs to some V i , y belongs to some V j , (f i , f j ) is an edge of L F such that both its semi-edges belong to S L F , and x and y have labels in L f i and L f j that are associated with the same R-tuple of F.

Example 4.4.6. Consider Figure 4.21 on page 103. On the left, there is a structure F from F 2 . In the middle, there is the label graph L F . As R is ternary, this graph is obtained from F by replacing tuples with 3-cliques. Every tuple of F is highlighted with its own colour, the edges of every 3-clique of the label graph have the corresponding label. On the right, there is the labeled tree family T G , for some structure G ∈ F F .

L F

T G F The vertices and semi-edges (V L F , S L F ) of L F are highlighted with red. Similarly, for all the trees of T G , these sets of vertices and semi-edges are highlighted with red. The relation P is comprised of red edges and dashed edges between red vertices.

The family on Figure 4.21 is indeed piece alike, it satisfies all the properties. We would also like to point out some details about it.

• The pair (V i , S i ), for i in [n] does not need to be connected. There is one such tree in the family (the path in the middle of the left side). Both its leaves are connected by P through the tree in the bottom center.

• If the degree of a vertex of F is 1, then the corresponding tree of T G always consists of a single vertex, for any G in F 1 .

• In the piece alike family definition, it may seem unclear why do we need the condition that requires that all semi-edges incident to the same vertex of L F must either all belong to S L F or all not belong to it. This condition arises from the way all G in F F are constructed. All of them are obtained from F• . The construction of F• is given on Figure 4.11 on page 92, we recall that it is obtained from F by replacing each (k + 1)-ary R-tuple with k R-tuples. Within L F , each of these k tuples is associated with the set of semi-edges that have the same label and that are incident to the same vertex of L F .

△

Remark. When we just defined a labeled tree family on page 93, we also assigned labels to every edge of every tree of the family. Those edge labels carried the information about the vertex colours of the corresponding pair of duplicated tuples and about the coordinate where the Old vertices were placed. Our current goal is to prove that F 1 is regular and edge-labels are never used here. So, for simplicity, we do not mention them in this part although they always are where they are supposed to be. Sometimes, in particular, in Construction 12 on page 105, we add a new edge to a labeled tree. As we are free to assign any possible label to this edge, we assume that it is assigned arbitrarily.

The next result allows us to represent pieces as piece alike families.

Lemma 4.4.4. Let G be in F F . Then, there is a one-to-one correspondence between pieces of G and piece alike families constructed from G.

Proof. Let (P, r) be a piece of G. The roots r can contain either Old elements of G or those T -vertices that are in pairs of duplicated R-tuples. As r is minimal by inclusion, any vertex that is neither Old nor a T -vertex within a pair of duplicated tuples cannot be contained in r.

There is a one-to-one correspondence between Old elements of G and tree vertices in T G . Every R-tuple of G is associated either with a set of semi-edges of L F that are incident to the same vertex or with a semi-edge of some tree of T G , this correspondence is also one-to-one.

We construct the piece alike family P G := (V L F , S L F ), (V 1 , S 1 ), . . . , (V n , S n ) that is associated with (P, r).

• For an Old element x in G, suppose that it belongs to an eq-equivalence class [f i ] eq ; then, if x belongs to the domain P of P, we add x to V i and add f i to V L F .

• Suppose that an R-tuple (t, x) of G is in a pair of duplicated tuples and the Old element x in x is in some eq-equivalence class [f i ] eq ; then we add the semi-edge associated with (t, x) to S i if P has the R-tuple (t, x).

• Suppose that an R-tuple (t, x) belongs to a set of k duplicated tuples that are associated with some R-tuple f of F, and that the Old element x of x belongs to [f ] eq ; then, if (t, x) is contained in P, we add to S L F all semi-edges incident to f with label l f . This construction induces an injection, as two distinct pieces have different sets of Rtuples. It is a routine to check that the resulting family P is piece alike. For any piece alike family P, we construct a piece (P, r) as follows.

• If a set of semi-edges of L F that have the same label and are incident to the same vertex, and all belong to P, then we add to P all the vertices of the corresponding tuple of G.

• If the semi-edge corresponding to an R-tuple (t, x) is contained in some S i , then we add to P all the elements of this tuple.

• If a vertex x contained in V L F or in some V i is incident to a semi-edge that does not belong to P, then we add x to r.

This construction also induces an injection, as different families are associated with two substructures of G that differ either with respect to Old elements or with respect to R-tuples. We need to show that (P, r) is a piece. It is connected because P is a piece alike family. r is minimal by inclusion as any vertex of P incident to a semi-edge not from P is added to the set of roots r.

This implies that there is a one-to-one correspondence between pieces and piece alike families. Moreover, these two construction mappings are inverses of each other, because there is a one-to-one correspondence between semi-edges of the family and R-tuples of the piece.

Proposition 4.4.5. Let (P, r) be a piece of some structure G in F F . Then the size of r is bounded by

k 2 |F | 2k-1 + k|F | k ,
where k is the arity of R.

Proof. Let P be the corresponding piece alike family, provided by Lemma 4.4.4. The binary relation P defined on the set

V 1 ∪ • • • ∪ V n is connected. Pick any tree T f of T G .
Any connected component of P induced on T f must contain a labeled vertex. The number of labeled vertices is at most the number of distinct R-tuples that can be adjacent to an element f of the structure F. Thus, it is at most k|F | k-1 . So, the number of leaves of each tree of T G is at most k|F | k-1 , as every leaf has a label.

Any vertex of r is associated either

• with some v in V i that is incident to a semi-edge not from S i , for some i in [n], or

• with some v in V i that has a label l f , for some tuple f in R F , such that the l f -labeled semi-edges incident to f i are not contained in S L F , or

• with a semi-edge s in S i such that the other semi-edge of the edge where they belong to is not in S i , for some i in [n], or

• with a set of semi-edges of L F that are incident to the same vertex and have the same label.

For any element f i of F, and for any connected component of the graph induced by P on T f i , the number of vertices and semi-edges corresponding to roots in r cannot be greater than the number of labeled vertices of T f i . This is justified as follows. Pick any vertex x of the component. Call a branch every path from x to a labeled vertex, the number of branches is at most to the number of labeled vertices because T f i is a tree. Any branch can contain exactly one vertex y such that either • y belongs to the same component as x, and the next vertex z of the branch does not belong to this component, or

• y is the end of the branch, i.e., a labeled vertex.

Thus, each T f i contains at most k 2 |F | 2k-2 elements of r, as the number of connected components is at most the number of leaves.

The number of trees in T G equals to |F |, the number of sets of semi-edges of L F that have the same label and are incident to the same vertex is at most k|F | k . So the total number of roots is at most

k 2 |F | 2k-1 + k|F | k .
Consider a structure G that belongs to F F . Before proving Theorem 4.4.6, we are going to show in Construction 12 how to modify any piece (P, r) of G so that the resulting piece has bounded size, and the resulting structure still belongs to F F . Construction 12. Consider a piece (P, r) of G. Let P be a piece alike family that is associated with (P, r), by Lemma 4.4.4. Denote by P the substructure of G induced on G ∖ (P ∖ r). By the definition of ⊕ operation, G is isomorphic to (P, r) ⊕ (P, r). Our goal is to provide a finite family R of rooted structures such that, for each given G of F 1 and any its piece (P, r), R will contain a piece (P ′ , r ′ ) such that P[r] is isomorphic to P ′ [r ′ ] and that G ′ := (P ′ , r ′ ) ⊕ (P, r) belongs to F 1 . If we show that any such (P, r) has bounded size, then this will imply that there are finitely many of them.

We describe the process of obtaining (P ′ , r ′ ) from (P, r) by modifying P and the trees of T G . Let T f i be some labeled tree in T G and V i and S i be subsets of its vertices and semi-edges such that the pair (V i , S i ) is in P. We mentioned before, in Example 4.4.6, that (V i , S i ) is not always connected. So we choose any of its connected components induced by the relation P. Let (V c i , S c i ) denote the vertices and semi-edges of some connected component of (V i , S i ). We highlight the important vertices of V c i as follows:

• Labeled vertices. Their number is bounded by k|F | k , where |F | is the domain size of F ∈ F 2 .

• Vertices of degree strictly greater than 2. The number of such vertices is as most the number of leaves in T f i , which is at most the number of labeled vertices.

• Vertices that are adjacent to a vertex not from V i . This means that either such a vertex is incident to a semi-edge not from S i , or this vertex is incident to an edge such that one of its semi-edges is not in S i . The number of these vertices is at most the number of roots r. So their number is also bounded, by Proposition 4.4.5.

All other vertices of V c i have degree 2 and both incident semi-edges belong to S i (and, consequently, to S c i ), their number may be arbitrarily large. Our aim is to get rid of them, leaving only vertices of the listed classes. Let v be one such vertex, let u and x be its neighbours. The procedure is as follows, it is displayed on.

1. Delete v and both incident edges uv, vx from T f i . This will automatically remove v from V i and all 4 semi-edges (u, uv), (v, uv), (v, vx), (x, vx) from S i .

2. Add an edge ux to T f i and both semi-edges (u, ux), (x, ux) to S i . We repeat this procedure for every vertex that does not belong to any of the three highlighted classes until there are no such vertices. The result of this procedure applied for one connected component is displayed on Figure 4.23. Do this for every connected component of every tree of T G . This finishes Construction 12.

u v x u x
T f i T f i Figure 4
.23: On the left, there is the original labeled tree T fi . The elements of (V i , S i ) are coloured in red. The circles are the labels. On the right, there is the modified labeled tree T ′ fi .

Theorem 4.4.6. The class F 1 is regular.

Proof. Consider some structure G ∈ F F and one of its pieces (P, r) that is represented by a piece alike family P. Denote by T ′ and by P ′ the tree and piece alike families obtained by Construction 12. By Proposition 4.3.6 from page 95, we know that there is a structure

G ′ in F 1 such that T G ′ = T ′ .
The rest is to show that, for any pair

(V ′ i , S ′ i ) in P ′ , |V ′ i | and |S ′ i | are bounded.
The maximal degree of a vertex in a tree is at most the number of leaves in this tree. So, as the number of leaves of any tree of T G ′ is bounded by the number of labels, by Proposition 4.3.5 on page 94, the boundedness of |S ′ i | is implied by the boundedness of |V ′ i |. The set V ′ i consists only of vertices of the three types described in Construction 12. The number of vertices of each type is bounded.

Equivalence of ω-categorical templates

Let Φ in MMSNP 2 be a τ -sentence in normal 1 form and σ be the set of existentially quantified relations of Φ. We are going to show that there is an ω-categorical (τ ⊎ σ)structure C Φ such that a τ -structure A satisfies Φ if and only if A homomorphically maps to the τ -reduct C τ Φ . The existence of a similar structure for MMSNP sentences is shown in [START_REF] Bodirsky | A universal-algebraic proof of the complexity dichotomy for monotone monadic SNP[END_REF]. The MMSNP 2 case is treated similarly.

Theorem 4.4.7. Let F 2 be a finite set of finite connected (τ ⊎ σ)-structures corresponding to Φ in MMSNP 2 . Denote by B F 2 ind the universal ω-categorical structure provided by Theorem 4.4.2. That is, for any (τ ⊎ σ)-structure A, A embeds into B F 2 ind if and only if no structure F in F 2 homomorphically maps to A. Then there is an ω-categorical structure C Φ such that a finite τ -structure A satisfies Φ if and only if there is a homomorphism from A to C τ Φ .

Proof. Let C Φ be the substructure of B F 2 ind that contains only σ V -coloured vertices of B F 2 ind and contains only σ T -coloured R-tuples. By Theorem 4.4.2, B F 2 ind is ω-categorical. Thus, its automorphism group is oligomorphic, by Proposition 4.4.1. Any automorphism a in Aut(B F 2 ind ) induces an automorphism on C Φ , so Aut(C Φ ) is also oligomorphic. Any automorphism of a structure is an automorphism of its reduct, so Aut(C τ Φ ) is also oligomorphic. We conclude that both C Φ and its τ -reduct are ω-categorical.

Suppose that a finite τ -structure A satisfies Φ. Then there exists a σ-expansion A σ of A, where any vertex and any R-tuple is coloured in precisely one colour, such that no F in F 2 homomorphically maps to A σ . Then A σ embeds into B F 2 ind , as it is all coloured, it also embeds into C Φ . Thus, A embeds into the τ -reduct C τ Φ . Suppose that there is a homomorphism h : A C τ Φ . Assign to any a of A the same σ V colour that the image h(a) has in C Φ . Assign to any R-tuple a of A the same σ T colour that the tuple of the image h(a) has in C Φ . Each element and each R-tuple of C Φ has precisely one colour because Φ is in normal 1 form. Denote the corresponding σ-expansion by A σ , by its construction, it maps homomorphically to C Φ . If there is F in F 2 that maps to A σ , then, by transitivity, it maps to C Φ , that is a contradiction. So, we have A is accepted by FPP 2 (F 2 ), thus, A satisfies Φ. We assume that the elements of G are linearly ordered, this ordering is defined by a one-to-one correspondence ord G : G |G| . Also assume that the set of T -vertices precedes the set of V-vertices in this ordering, that is, for any T -vertex t and for any Vvertex v in G, we have ord G (t) < ord G (v). For any relation symbol S G in ρ that has arity m, we frequently say that it has arity (m T , m V ): m T denotes the number of T -vertices in G, they are on the coordinates from 1 to m T ; and m V denotes the number of V-vertices in G, they are on the coordinates from m T + 1 to m.

Denote

Define a mapping F :

Struct[τ ] Struct[ρ] as follows.
Let A be a τ -structure. The domain of the corresponding ρ-structure  := F(A) is the same as the domain of A. For any |G|-ary tuple x = (x 1 , . . . , x |G| ) of elements of  and for any relation symbol S G in ρ, the tuple x belongs to the relation S  G if and only if the mapping h : G A defined by h : g

x ord G (g) is a homomorphism from G to A. That is, we find all possible ways to map G to A and highlight them with the relation S Â G . This is the end of Construction 13.

Proposition 5.1.1. The mapping F :

Struct[τ ] Struct[ρ]
from Construction 13 is a functor.

Proof. Let h : A B be a homomorphism between two τ -structures. Let  and B be the corresponding F-images. We are going to prove that the same mapping h is also a homomorphism between  and B. Pick any ρ-tuple x = x 1 , . . . , x |G| from S  G , for some S G in ρ. It suffices to prove that the image h(x) of this tuple belongs to S B G . By assumption, there is a homomorphism g : G A such that, for all g in G, g(g

) = x ord G (g) . Then h • g : G B is a homomorphism. This implies that, for all g in G, (h • g)(g) = h x ord G (g) , so h(x) belongs to S B G .
Example 5.1.1. Suppose that the family F 2 consists of directed paths of length 3 (that is, containing 2 arcs having the same orientation and 3 vertices). Then ρ contains one (2, 3)-ary relation symbol corresponding to such a path. On Figure 5.1 on page 110 we show how the functor F works for good structures. There are three ways to map the path to A. So the structure F D(A) contains three ρ-tuples corresponding to paths. As D(A) is a good structure, every two ρ-tuples of F D(A) that have a common T -vertex also have in common the corresponding V-vertices. △ A F(A) Example 5.1.2. Similarly as in Example 5.1.1, suppose that there is only one τ -reduct up to isomorphism, and that it is isomorphic to a directed path of length 3. Consider a τ -structure A that is not good, that is, it contains a pair of duplicated tuples. See Figure 5.2 on page 111 for an example of such structure. Then, the ρ-tuples that are associated with directed paths might share a single T -vertex. △

The following construction explains how to obtain the ρ-structure T Φ from a given MMSNP sentence Φ. It is the target structure of the problem CSP(T Φ) to which we reduce SAT( Φ).

Construction 14. The domain T Φ of T Φ is the set of existential relations σ = σT ⊎ σV . Denote by T T those elements of T Φ that are associated with σT , and denote by T V those ones that are associated with σV . Consider a relation symbol S G in ρ, suppose that it has arity (m T , m V ). Consider a tuple (t, v), where t consists of m T elements of T T , and v consists of m V elements of T V . We add (t, v) to S T Φ G if the σ-expansion of G, where we assign to the element g i the colour corresponding to the ith element of the tuple (t, v), does not belong to D(F 2 ). That is, we add to S T Φ G all tuples associated with σ-colourings of G not from D(F 2 ).

Proposition 5.1.2. A problem SAT( Φ) reduces to CSP(T Φ) in P-time.

Proof. For any τ -structure A, that is an input instance of SAT( Φ), we reduce it to a ρ-structure  := F(A) -the functorial image of A.

Suppose that there is a homomorphism h :  T Φ. Then, consider a σ-expansion A σ of A such that we assign to each element a of A a relation of σ corresponding to the element h(a) of T . Suppose that this expansion does not satisfy Φ; then, there is some G in D(F 2 ) that homomorphically maps to A σ. Any element of G is coloured with exactly one σ-relation, because we assume that Φ is in normal 1 form. Then, there is an S G -tuple in  that is associated with the image of G in A. The h-image of this tuple cannot belong to S T Φ G , this contradicts h being a homomorphism. Suppose that A models Φ. Then there is a σ-expansion A σ such that no G in D(F 2 ) maps to A σ. As Φ is in normal 1 form, we assume that, for any element a of A there is a unique σ-relation assigned to it. Construct a mapping h as follows. Pick an element a in A, suppose without loss of generality that a is a T -vertex that is coloured with a relation M. Then, set h(a) := t M, where t M is an element of T that is associated with M. Suppose that h is not a homomorphism, then, for some S in ρ there is a tuple x that belongs to S  and its image h(x) does not belong to S T Φ . This means that there is a structure G ′ in D(F 2 ) that maps to A σ, it is a contradiction. Let Φ be the MMSNP 2 sentence such that Φ is obtained from it by Construction 7 from page 77. So Proposition 4.1.1 from page 79 and Proposition 5.1.2 together imply that SAT(Φ) reduces to CSP(T Φ), where Φ is a sentence in MMSNP 2 .

Corollary 5.1.3. For any sentence Φ in MMSNP 2 in normal 1 form there is a finite structure T Φ such that SAT(Φ) reduces in P-time to CSP(T Φ).

The diagram below explains how the three problems are related to each other. A τ -structure A satisfies Φ if and only if there is a σ-expansion A σ such that no structure from F 2 is mapped to A σ or, equivalently, iff the ρ-structure

F D(A) is mapped to T Φ. τ τ ρ F 2 D(F 2 ) F D(A) A σ D(A) σ T Φ
The least trivial part of Feder and Vardi's proof is the reduction from CSP(T Φ) to SAT( Φ), where Φ is an MMSNP τ -sentence with the existential signature σ, T Φ is the relational ρ-structure constructed from Φ. In order to reduce CSP(T Φ) to SAT( Φ) one has to find, for every given input ρ-structure S, a τ -structure A S such that S T Φ if and only if A S |= Φ. Suppose that we just take S and replace each S i -tuple with the corresponding τ -reduct F τ i . Then the resulting τ -structure B S might have a substructure isomorphic to the hom-image of some τ -reduct F τ j and the S j -tuple corresponding to this substructure is not in S S j . See Figure 5.3 on page 112, for example. In order to avoid this issue, Feder and Vardi assume that the given sentence Φ can be transformed to a logically equivalent sentence that has some special properties. These properties are known now as normal form properties. When Φ is in normal form, Feder and Vardi use the following adaptation for ρ-structures of the result of Erdős on graphs in [START_REF] Erdős | Graph theory and probability[END_REF]. When Φ is in normal form, all the τ -reducts corresponding to ρ-tuples are biconnected, and if the girth is larger than the maximal arity of a ρ-relation, then a large girth ρ-structure does not contain implicit ρ-tuples. In this case, they are able to replace every ρ-tuple with a τ -structure in order to obtain an equivalent input τ -structure of SAT( Φ).

Lemma 5.1.4 ( [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF]). Let T be a ρ-structure, and l be a natural number. Then, for every ρ-structure S on n vertices there exists a ρ-structure S ′ on n a vertices such that:

• a depends only on l and |T |;

• there is a surjective homomorphism from S ′ onto S;

• S ′ maps to T if and only if S maps to T;

• the girth of S ′ at least l.

S ′

S T

Sketch of Proof. The domain of S ′ is the disjoint union s∈S X s , where each X s is a set of copies of s of size N := n a-1 . For any m-ary S-tuple s = (s 1 , . . . , s n ) of S, we impose the relation

S S ′ on a tuple s ′ in X s 1 × • • • × X sm with probability N 1-m+ϵ . As |X s 1 × • • • × X sm | = N m
, the expected number of tuples that are associated with s is N 1+ϵ . If the arity m is equal to 1, then we impose S on all the elements of the corresponding set of copies. There is a surjective homomorphism π : S ′ ↠ S such that π(X s ) = s, for any s in S. So, by transitivity, if S T, then S ′ T. The expected number of cycles of length less than l is at most N ϵ ′ , where ϵ ′ = c 1 a-1 + ϵl and c 1 is a constant value. Markov's inequality states that, for any δ > 0,

Pr(X ≤ δ) ≥ 1 - E[X] δ .
Set δ := 2E[X], then the probability that S ′ has at most twice as many such cycles is at least 1 2 . Suppose that S ′ homomorphically maps to T by some h ′ , then, for each X s , at least |Xs| |T | of its elements map to the same vertex of T, we denote them by Y s and define a mapping h : S T such that h(s) := h ′ (Y s ). For a S-tuple s = (s 1 , . . . , s m ) of S, the expected number of tuples imposed on Y s 1 , . . . , Y sm is at least

N |T | m N 1-m+ϵ = N 1+ϵ
|T | m . The multiplicative Chernoff bound states that, for any δ > 0,

Pr X < (1 -δ)E[X] < e -δ (1 -δ) 1-δ E[X]
, where X is the sum of independent random variables taking values in {0, 1}. Thus, the probability that the number of such tuples is at most half of the expected number is less than

p := Exp -N 1+ϵ c 2
, where c 2 is a constant value.

For N large enough, we have

2N ϵ ′ < 1 2 N 1+ϵ
|T | m . With probability at least 1 2 , we can get rid of all the cycles of length less than l by deleting 2N ϵ ′ tuples from S ′ . Denote by n c 3 the number of all the tuples s of S that are contained in some relation. The probability that, after removing the tuples, there are no tuples imposed on some Y s 1 , . . . , Y sm is at most 1 -(1 -p) n c 3 < n c 3 p. For N large enough, this probability is very small, so there exists a structure S ′ . In this case, h is a homomorphism, as, for any S-tuple s, h(s) = h ′ (Y s 1 , . . . , Y sm ) and there is at least one S-tuple imposed on Y s 1 , . . . , Y sm .

Example 5.1.3. Have a look at Figure 5.4 on page 114. For simplicity, relations are binary. For every of three vertices of S, we add N vertices to S ′ and then randomly add edges. There is no cycle of length 3, unlike in S. However, there are two cycles: red and blue. The red one has length 9, the blue one has the length 4. They have different nature: all edges of the blue cycle are in the preimage of just one edge of S, and this is not the case for the red cycle. △ What can be done for MMSNP 2 ? If we use Lemma 5.1.4 from page 112 and then replace ρ-tuples with the corresponding τ -structures, then we might obtain a structure with duplicated tuples. Such structure is not good, and it is not clear what τ -structure we can associate with it. In Section 5.2 we show how to transform any MMSNP 2 sentence to a form such that the input of CSP(T Φ) can be restricted to good structures, without loss of generality. That is, to structures without implicit duplicated tuples. An example of a τ -structure with duplicated tuples is displayed on Figure 5.2 on page 111. Apart from that, the new normal form for MMSNP 2 sentences, that we introduce in Section 5.2, allows two ρ-tuples intersect by an implicit τ -tuple without having any implicit ρ-tuples. For example, two ρ-tuples corresponding to triangles could intersect by an edge as well. In the MMSNP case, they could only share a vertex.

S S ′

On one hand, the large girth structure S ′ must be good -this is more restrictive that the MMSNP case. However, on the other hand, the notion of "large girth" is less restrictive as we can now join two ρ-tuples by an edge, this gives us more tools to build the desired structure.

In Section 5.3, we discuss various approaches to build an appropriate structure S ′ that could be associated with an input instance of SAT(Φ). For each of these approaches, we explain why it is problematic to find such a structure.

Normal 2 form for MMSNP 2

We are going to show that, for MMSNP 2 sentences, the analogue of normal form for MMSNP is not sufficient for providing a reduction similar to the one of Feder and Vardi. We provide some new properties that are necessary for the potential existence of a similar proof for MMSNP 2 .

At first, we recall that, by Proposition 4.2.2, for any MMSNP 2 sentence there exists a logically equivalent MMSNP 2 sentence in normal 1 form. We show now the insufficiency of the normal 1 form for the case of MMSNP 2 sentences. Proposition 5.2.1. Let Φ in MMSNP 2 , and Φ in MMSNP be obtained from Φ by the transformation described in Section 4.1. Then, for some Φ in normal 1 form and for some l in N, there is a ρ-structure G such that G ̸ T Φ, and for any ρ-structure

G ′ of girth at least l, if G ′ G, then G ′ T Φ.
Proof. In order to prove the statement, we are going to provide a counterexample. Let

τ = {R(•, •)}, then τ = {T (•), V(•), R(•, •, •)}.
Suppose that there are four unary relation symbols in σ : M a , M b , M c , M d ; and eight binary: X ab , X bc , X ca , X ′ ca , X ad , X dc , X bd , X db . The τ -reducts of the forbidden (τ ⊎ σ)-structures induced by Φ belong to one of the three following types: a cycle of length 3, a cycle of length 2, or a loop, they all are displayed on Figure 5.5 on page 115. Then, ρ consists of three relations: a binary S 2 , a 4-ary S 4 , and a 6-ary S 6 . Let l denote the maximal arity among the ρ-relations. That is, in our case, l = 6. Suppose that • Φ forbids loops for any possible colouring of their vertices and arcs.

• There is only one valid colouring of a 2-cycle:

R(x, y) ∧ R(y, x) ∧ M b (x) ∧ M d (y) ∧ X bd (x, y) ∧ X db (y, x).
• There are just two valid colourings of 3-cycles. They are associated with these conjunctions:

R(x, y) ∧ R(y, z) ∧ R(z, x) ∧ M a (x) ∧ M b (y) ∧ M c (z) ∧ X ab (x, y) ∧ X bc (y, z) ∧ X ca (z, x), R(x, y) ∧ R(y, z) ∧ R(z, x) ∧ M a (x) ∧ M d (y) ∧ M c (z) ∧ X ad (x, y) ∧ X dc (y, z) ∧ X ′ ca (z, x).
The resulting ρ-structure T Φ is displayed on the right side of Figure 5.6 on page 116. Observe that we have chosen Φ such that it is in normal 1 form: we can require that the existential relations form a partition of both vertices and R-tuples, all the forbidden structures are biconnected, they are closed under homomorphisms, and we can make them be fully coloured. Our goal is to show that, for some relational ρ-structure S, any ρ-structure S ′ of girth greater than l that maps to S is either not equivalent to S with respect to being mapped to T Φ or there is no τ -structure that is associated with S ′ if we try to replace any ρ-tuple with the corresponding τ -structure.

As a counterexample, we choose a structure S as on the left side of Figure 5.6. Clearly, S ̸ T Φ. Now, consider any ρ-structure S ′ such that S ′ has girth greater than l = 6 and that S ′ S. Any two relational tuples of S ′ intersect by at most one point as, otherwise, there would be a cycle of length 2, that is smaller than l. If there are two tuples that intersect by a point that is associated with a T -vertex, then such S ′ does not are associated .6: On the right, T Φ consists of 12 vertices, two S 6 -tuples, that are associated with 3-cycles and a S 4 -tuple that is associated with the only allowed 2-cycle. Any vertex t in T Φ is associated with some M t in σ, the subscripts are highlighted. On the left, a ρ-structure S is similar to T Φ, but in S two S 6 -tuples share a T -vertex zx, when in T Φ there are two distinct ca, ca ′ . Implicit R-tuples are highlighted with dotted arcs.

with any τ -structure, because, if two R-tuples have a common T -vertex, then they must also share all the V-vertices. Suppose now that all the tuples of S ′ intersect only at V-vertices.

We know that there exists a homomorphism g :

S ′ S. Let f : G ∖ {zx} T Φ be the obvious mapping, that is, f(w) = d, f(x) = a, f(y) = b, f(z) = c,
and so on. We construct a homomorphism h : S ′ T Φ as follows. For any

v in S ′ , if g(v) ̸ = zx, then set h(v) = (f • g)(v). If g(v) = zx, then there is at most one S 6 -tuple that contains v. This tuple must contain an element v ′ such that g(v ′ ) is in {w, y}. If g(v ′ ) = w, then set h(v) = ca ′ ; if g(v ′ ) = y, then set h(v) = ca.
This means that S ′ is not equivalent to S regarding having a homomorphism to T Φ. Definition 14. Let S be a ρ-structure, x = (x 1 , . . . , x m ) be a tuple of S that belongs to some ρ-relation S S . Let G be a τ -structure of size m that is associated with S in ρ. For any R-tuple g = (g 0 , . . . , g k ) of G, a subtuple x ord G (g 0 ) , . . . ,

x ord G (g k ) of x is called an implicit R-tuple of S. If g is a T -(V-)vertex of G, then x ord G (g) is called an implicit T -(V-)vertex.
Example 5.2.1. Consider ρ-structures S and T Φ displayed on Figure 5.6 on page 116. All the dotted arcs stand for implicit R-tuples. They have arity 3 as R is binary. △ Our aim is to modify Φ such that we may allow two relational ρ-tuples from S ′ to share a T -vertex. When two ρ-tuples share a T -vertex t, they must also share all the V-vertices that make an implicit R-tuple together with t. Otherwise, it would be impossible to find a ρ-structure S ′ that is associated with a ρ-structure S, as in Proposition 5.2.1. Moreover, we want ρ-tuples to be able to share implicit R-tuples so that nothing new appears once we replace ρ-tuples with the corresponding τ -reducts.

Definition 15. Let ¬ϕ be a negated conjunct of Φ and k in N be a natural number. ¬ϕ(x) is called k-separable if the variables x of ϕ can be grouped into three disjoint sets s, y, z of variables such that the tuple s contains k (possibly not pairwise distinct) variables and ¬ϕ(x) can be written in the form:

¬ ψ 1 (s, y) ∧ ψ 2 (s, z) ,
where ψ 1 and ψ 2 are subformulae of ϕ obtained by splitting the conjunction ϕ into two parts. If ¬ϕ is not k-separable, then it is called k-inseparable.

Sometimes, within a k-separable conjunct of Φ, the tuple s is already contained in a τ -atom R(s). We want to track all such conjuncts and to get rid of them because they can be replaced by two smaller conjuncts which represent the separation parts. In order to do this, we give the following definition that is analogous to the "biconnected" property. Definition 16. A negated conjunct ¬ϕ(x) of an MMSNP 2 τ -sentence Φ is called tuplebiconnected if, for every partition of its variables x into 3 groups y, s, z, it cannot be written in the following form:

¬ ψ 1 (s, y) ∧ R(s) ∧ ψ 2 (s, z) ,
where ψ 1 , ψ 2 are subformulae of the conjunction ϕ that are obtained from it by removing the atom R(s) and splitting the rest into two parts.

Example 5.2.2. The canonical conjunctive query of the graph from Figure 5.8 on page 119 is not tuple-biconnected: if we remove the vertical arc together with both incident vertices, then the result will not be connected. On the other side, the canonical conjunctive query of the graph from Figure 5.9 on page 120 is tuple-biconnected. △

We can now give a better definition of normal form for MMSNP 2 sentences.

Definition 17. A τ -sentence Φ in MMSNP 2 is said to be in normal 2 form if the following conditions hold.

• Φ is in normal 1 form.

• Any negated conjunct of Φ is tuple-biconnected.

• For any negated conjunct ¬ϕ of Φ that is k-separable by a k-tuple s such that it can be written in the form:

¬ ψ 1 (s, x) ∧ ψ 2 (s, y) ,
and, for any existential k-ary relation X in σ T , Φ contains precisely one of the two following negated conjuncts:

¬ ψ 1 (s, x) ∧ R(s) ∧ X(s) , ¬ ψ 2 (s, y) ∧ R(s) ∧ X(s) .
• Any σ T colour must uniquely define the σ V colours of the tuple elements. That is, if there are two negated conjuncts

¬ ϕ 1 ∧ R(x 1 ) ∧ X(x 1 ) and ¬ ϕ 2 ∧ R(x 2 ) ∧ X(x 2 )
that contain similarly coloured R-atoms, then, for any i in [k] and for any M in σ V , ϕ 1 contains the atom M(x i 1 ) if and only if ϕ 2 contains the atom M(x i 2 ). Here, x i 1 and x i 2 are the elements at the ith coordinates of x 1 and x 2 correspondingly.

Proposition 5.2.2. For any connected τ -sentence Φ in MMSNP 2 there is a connected τ -sentence Ψ in MMSNP 2 such that Ψ is in normal 2 form and logically equivalent to Φ.

Proof. In order to satisfy the fourth condition of normal 2 form, we replace any σ T -relation X with |σ V | k relations of the set

X (M 1 ,...,M k ) | i ∈ [k], M i ∈ σ V .
Within every negated conjunct, we replace an atom X(x) with X (M 1 ,...,M k ) (x) if the conjunct also contains an atom

M i (x i ), for any i in [k].
Next, we transform Φ to a logically equivalent sentence in normal 1 form, this is provided by Proposition 4.2.2. Denote the mapping that transforms a sentence to normal 1 form by nf 1 : MMSNP 2 MMSNP 2 . Since now, we can assume that Φ is in normal 1 form, as we can set Φ := nf 1 (Φ). Notice that nf 1 preserves the fourth condition of the normal 2 form property.

It remains to achieve the second and the third conditions. Let ¬ϕ 1 , . . . , ¬ϕ s be negated conjuncts of Φ such that they are k-separable, where k is the arity of R in τ , and that they have the maximal number of variables, denoted by N , and that they violate the third condition of the normal 2 form property. Some of them also are not tuple-biconnected. Denote the current sentence Φ by Φ N . Below, we transform Φ N to an equivalent sentence in normal 1 form, where any k-separable negated conjunct violating the third condition has strictly less than N variables. Hence, we can obtain, in finitely many steps, an equivalent sentence Ψ := Φ 0 that is in normal 2 form.

We now describe the procedure that is applied to each of these negated conjuncts until all the non-tuple-biconnected conjuncts are removed and all of the rest satisfy the third condition. Pick any k-separable negated conjunct ¬ϕ i from ¬ϕ 1 , . . . , ¬ϕ s . For any k-tuple s that separates ¬ϕ i as follows:

¬ ψ 1 (s, x) ∧ ψ 2 (s, y) , we add to Φ N the two following negated conjuncts (each of them contains strictly less than N variables):

¬ ψ 1 (s, x) ∧ R(s) ∧ P(s) ∧ ¬ ψ 2 (s, y) ∧ R(s) ∧ ¬P(s) .
Here, P is a new k-ary existential relation that we have added at this step. Adding these conjuncts keeps the sentence logically equivalent to the original one. Because if any of these two new negated conjuncts is violated, then either the original negated conjunct ¬ϕ i is also violated or we can choose another interpretation for the relation symbol P and satisfy both negated conjuncts. Also, if ¬ϕ i is connected, then both new negated conjuncts are connected.

If ¬ϕ i is not tuple-biconnected with respect to s, that is, if it can be written as

¬ ψ i 1 (x i , s) ∧ R(s) ∧ ψ i 2 (s, y i )
, then we remove it from Φ. We do this procedure for every k-separating tuple of every negated conjunct ϕ 1 , . . . , ϕ s . Observe that we have extended the existential signature with new relation symbols, e.g. P.

The number of them is bounded by some constant depending on Φ N . The fourth normal 2 condition is satisfied as, for any new relation symbol P there is a unique non-negated P-atom.

Apply now the transformation nf 1 to this sentence. Denote the result by Φ N ′ . This sentence is in normal 1 form, it is logically equivalent to Φ, and any negated conjunct that violates the second or the third normal 2 form property contains at most N ′ variables, where N ′ is strictly smaller than N . We repeat this procedure for Φ N ′ , and in at most N ′ iterations we obtain Ψ := Φ 0 such that any negated conjunct satisfies the second and the third normal 2 form conditions.

Example 5.2.3. Let ¬ϕ i are associated with a 4-cycle, where the relation R is binary. Then ¬ϕ i is 2-separable, however it is tuple-biconnected. It can be separated by four different tuples that create eight new graphs, however, each of them is 2-inseparable. See Figure 5.7 on page 119. △

Figure 5.7: F, corresponding to ϕ i , is on the left. On the right, the eight structures obtained from F by separating it in two in the all possible ways. The corresponding eight negated conjuncts are added to the sentence when we transform it to normal 2 form. Dashed arcs mean negated existential atomic formulae.

In the rest of this section we discuss the new opportunities that we have when Φ is in normal 2 form. Consider Figure 5.8 on page 119.

Suppose that some of the negated conjuncts of Φ encode triangles (e.g., C 3 ). Then the relational signature ρ from Proposition 5.2.1 would contain a 6-ary relation symbol △ corresponding to the triangle. In the proof of Proposition 5.2.1, the ρ-structure S ′ cannot contain two △-tuples that share an arc, as on Figure 5.8. Because, in this case, the girth is at most 2. But, if the sentence Φ is in normal 2 form, then two tuples are allowed to share a whole arc. If some negated conjunct of Φ encodes a structure from Figure 5.9 on page 120. then ρ must contain a 8-ary relation symbol □ corresponding to this structure. Observe that on Figure 5.8 there is a □-tuple implicitly contained in the union of two triangles. But, by the condition of normal 2 form, it is forbidden to assign colours to these two △-tuples such that the implicit □-tuple has a forbidden colouring.

We can conclude that it is not necessary anymore for S ′ to have large girth. We need to define a new metric that is more appropriate in our case. Recall that the relation symbols of ρ are associated with τ -reducts of forbidden structures.

Definition 18. Let S be a ρ-structure and x, y be two relational ρ-tuples. We say that x and y are V-adjacent if there is an implicit V-vertex z that is contained in both of the tuples, and if no other vertex is shared by the tuples. We say that x and y are T -adjacent if there is an implicit R-tuple z that is an implicit R-tuple of both ρ-tuples x and y, and if x and y do not share any other vertices.

A sequence of ρ-tuples x 1 , . . . , x n is called a tuple-cycle if, for i in [n -1], x i and x i+1 are either V-adjacent or T -adjacent, and similarly for x n and x 1 . The length of a tuple-cycle is simply the number of tuples in the sequence. A structure S is said to have tuple-girth be equal to l, for l in N, if S has a tuple-cycle of length l and if it has no tuple-cycle of length less than l.

Example 5.2.4. Consider Figure 5.10 on page 120. It is a ρ-structure that contains △tuples. Some of the tuples are T -adjacent, some are V-adjacent. The original girth of this structure is equal to 2. The tuple-girth is equal to 6. A cycle of the minimal length is highlighted with the red triangles. △

At last, we explain the fourth condition of the normal 2 form property. This condition requires that a σ T -relation X uniquely determines the σ V -relations that are assigned to elements of a tuple from X.

Definition 19. We say that implicit R-tuples (t, v 1 ) and

(t, v 2 ) of a ρ-structure A are duplicated if v 1 ̸ = v 2 . Two implicit tuples (t 1 , v) and (t 2 , v) of A are called multiple if t 1 ̸ = t 2 .
Observation 1. Let Φ be an MMSNP 2 sentence in normal 2 form. Let T Φ be the corresponding finite CSP ρ-structure. Then T Φ does not contain implicit duplicated tuples. Though, T Φ still may contain multiple implicit tuples which makes our situation more difficult.

Expanders

Further, we consider the following problem. Being able to solve it is sufficient to prove the dichotomy property for MMSNP 2 .

Problem 1. Let T be a ρ-structure without duplicated implicit tuples. Then, for any ρ-structure S and for any l in N, one can construct in time polynomial in |S| a ρ-structure S ′ of tuple-girth at least l and without duplicated implicit R-tuples such that there is a homomorphism h : S T if and only if there is a homomorphism h ′ :

S ′ T. S ′ S T h ′ h
Remark. The name of this section contains the word expander because of the ε-expander property that is very useful in our situation. This property is given by Kun in [START_REF] Kun | Constraints, MMSNP and expander relational structures[END_REF], where he proves that the structure S ′ of Feder and Vardi's Lemma 5.1.4 can be constructed by a deterministic P-time algorithm. Roughly speaking, this property estimates how closely to a uniform distribution the relational tuples are distributed. More precisely, let A be a ρ-structure and let ε > 0. Then A is called an ε-expander if, for any S in ρ of arity m and for any subsets A 1 , . . . , A m of A, we have

|S(A 1 , . . . , A m )| - |A 1 | × • • • × |A m | |A| m |S A | < ε|S A |,
where S(A 1 , . . . , A m ) denotes the set of S-tuples imposed on the subsets A 1 , . . . , A m . This formula states that the difference between the actual number of tuples imposed on the subsets differs from their expected number under the uniform distribution by a small proportion of the total number of tuples.

Further in this section we consider different approaches that can be used in order to solve the problem. We explain every time why the approach can not be used to solve Problem 1.

V-vertex expander

Let ρ V be a signature obtained from ρ such that, for every S in ρ of arity (m T , m V ) there is a relation symbol S V in ρ V of arity m V . For any ρ-structure A with the domain

A = A T ⊎ A V , denote by A V a ρ V -structure with the domain A V such that, for any S V in ρ V and for any v in A m V V , the tuple v belongs to S A V V if and only if (t, v) ∈ S A for some t ∈ A m T
T . Now we explain how to obtain the structure S ′ for a given input structure S and target structure T. After that, we discuss if it is a good candidate for Problem 1.

Construction 15. For two given ρ-structures S and T, we consider the corresponding ρ V -structures S V and T V . In this case, we can find a ρ V -structure S ′ V of large girth that is equivalent to S V with respect to CSP(T V ), by Feder and Vardi's Lemma 5.1.4. And then we return to the signature ρ by adding T -vertices: for every S V -tuple v of every S V in ρ V , we introduce a tuple t of pairwise distinct new T -vertices and require that (t, v) belongs to S S ′ . This finishes Construction 15. This approach does not work because T may contain multiple tuples. Counterexample 5.3.1. Let S and T be the same as S and T Φ in Proposition 5.2.1 from Section 5.2, see Figure 5.11 on page 122. Then, S does not map to T, but any S ′ obtained from S by Construction 15 maps to T.

T-vertex expander

Let ρ T be a signature obtained from ρ in a similar way as ρ V is obtained for V-vertex expanders. That is, for every S ∈ ρ of arity k = m T + m V , we introduce a relation symbol S T ∈ ρ T of arity m T . And for any ρ-structure A with the domain A T ⊎ A V , we denote by A T a ρ T -structure with the domain A T such that, for any S T ∈ ρ T and any t ∈ A m T T , the tuple t belongs to the relation S A T T if and only if (t, v) is contained in S A for some tuple v ∈ A m V V . Construction 16. One can treat the structure A T similarly to the structure A V . For given ρ-structures S, T we consider ρ T -structures S T , T T and find a structure S ′ T such that it satisfies the conditions of Feder and Vardi's Lemma 5.1.4 over the signature ρ T . Then, we add V-vertices to S ′ T in order to obtain the desired ρ-structure S ′ . At first, we add to S ′ all the vertices of S ′ T , they make the set of implicit T -vertices. Let t be a S T -tuple of S ′ T , for some S T in ρ T . Suppose that the arity of S T is m T , and the arity of the corresponding ρ-relation S is (m T , m V ). For t, we add m V new pairwise distinct vertices v, they become implicit V-vertices, and we add the tuple (t, v) to the relation S S ′ . Do this procedure for any tuple t of any ρ T -relation of S ′ T . If an implicit T -vertex t is contained in more than one ρ-tuple, then it is contained in a pair of duplicated implicit R-tuples. For any such pair (t, v 1 ) and (t, v 2 ), we identify v 1 and v 2 in the coordinate-wise fashion.

Counterexample 5.3.2. Suppose that S contains two relational tuples (t 1 , v 1 ), (t 2 , v 2 ) such that t 1 ∩ t 2 = ∅ and v 1 ∩ v 2 ̸ = ∅. Then, during the construction of S T , the corresponding tuples share no elements. Thus, none of them intersect in S ′ neither. We can consider a case where any two tuples of S can only share some V-vertices but not T -vertices. Then, all S T , S ′ T and S ′ consist of pairwise disjoint tuples, for any choice of T Φ. This means that, for some T Φ, S and S ′ are not equivalent with respect to having a homomorphism to T Φ.

TV-expanders

In this part, we construct the structure S ′ directly from S unlike V-vertex expanders and T -vertex expanders. We use the same approach as in Feder and Vardi's Lemma 5.1.4: we

t v 1 t v 2 t (t 1 , v 1 ) (t 2 , v 2 ) S ′ t v t S ′ /eq (t 1 , v 1 ) (t 2 , v 2 )
Figure 5.12: To the left, there are duplicated implicit tuples in S ′ . Tuples (t 1 , v 1 ) and (t 2 , v 2 ) share one T -vertex t but not the V-vertices of the corresponding implicit tuples v 1 T , v 2 T . To the right, there is the result of their identification within S ′ /eq that does not have duplicated implicit tuples. substitute every vertex s of the domain S of S by a set X s of vertices and then, for any tuple (t 1 , . . . , t m T , v 1 , . . . , v m V ) of S, we randomly impose tuples on the sets X t 1 , . . . , X vm V .

The resulting structure S ′ has large tuple-girth, as the tuple-girth is always at least as large as the girth. But S ′ does not look exactly as what we want. Particularly, it has duplicated implicit R-tuples, i.e., it contains tuples that have some T -vertex t in common but that do not share the V-vertices v T of the corresponding implicit tuple (t, v T ), see the left part of Figure 5.12 on page 123. This is a problem because the ρ-structure S ′ should be associated with some τ -structure. If the target structure T Φ does not have duplicated implicit R-tuples, then, for any structure S ′ , one can construct in time polynomial in the size of S ′ a ρ-structure S ′ /eq that is equivalent to S ′ with respect to CSP(T Φ) and that does not have duplicated implicit R-tuples. Here, eq is the minimal by inclusion equivalence relation over S ′ such that two V-vertices v 1 , v 2 are equivalent if there is a T -vertex t and two implicit R-tuples (t, v 1 ), (t, v 2 ), where v 1 and v 2 are on the same coordinate. The quotient does not have duplicated implicit R-tuples.

On one hand, the structure S ′ /eq does not have duplicated tuples. But, on the other hand, we still can not derive a τ -structure from it because taking a quotient might make the tuple-girth smaller. In the rest of this section we estimate how many new cycles of short length appear after taking the quotient.

For simplicity, we consider a particular case when τ = {E(•, •)} and ρ = {S(•, •, •, •, •, •)}. Here, S is a (3, 3)-ary relation that represents a triangle. We are going to consider a cycle of length n in a ρ-structure S ′ and calculate the probability that, after taking the quotient S ′ /eq, this cycle contains a subcycle of length at most l, for some fixed l. Let the cycle consist of tuples (t 1 , v 1 ), . . . , (t n , v n ) such that, for each two neighbour tuples (t i , v i ), (t i+1 , v i+1 ) there is a unique vertex x that is contained either in both t i , t i+1 or in both v i , v i+1 . This means that tuples intersect correctly with respect to the partition into implicit T -and V-vertices: a vertex cannot be simultaneously an implicit T -vertex and an implicit V-vertex. We also make an assumption that the way how two neighbour tuples intersect is uniformly arbitrary: say that in a tuple (t i , v i ) we randomly choose a vertex (with the same probability for each vertex) and if it appears to be a T -vertex, then we also randomly choose a T -vertex in (t i+1 , v i+1 ) and identify these two.

It is important how exactly neighbour tuples touch. Suppose that a tuple (t i , v i ) = (t a , t b , t c , a, b, c) of the cycle touches the precedent tuple (t i-1 , v i-1 ) by a T -vertex, say, by t a . Then there are 5 different cases, see Figure 5.14 on page 125, how the next tuple (t i+1 , v i+1 ) can touch (t i , v i ):

• 'tDv': by the V-vertex a, in this case, taking the quotient does not reduce the cycle length;

• 'tLv': by the V-vertex b, in this case, the (i + 1)th tuple touches the (i -1)th tuple 123

s 0 s 1 t v R L D Figure 5
.13: A finite automaton that accepts a word if and only if it is associated with a sequence of tuples. The starting state is s 0 , the accepting state is s 1 .

after taking the quotient;

• 'tRv': by the V-vertex c, in this case, the (i + 1)th tuple touches the (i -1)th tuple after taking the quotient;

• 'tLt': by the T -vertex t c , in this case, the (i + 1)th tuple touches the (i -1)th tuple after taking the quotient;

• 'tRt': by the T -vertex t b , in this case, the (i + 1)th tuple touches the (i -1)th tuple after taking the quotient.

Sequences of tuples can be encoded by a regular language L ⊂ {t, v, D, L, R} * . A finite automaton displayed on Figure 5.13 on page 124 defines this language. A string of symbols of {t, v, D, L, R} belongs to L if and only if any odd symbol is either t or v, and any even symbol is either D, L, or R.

Suppose that a tuple (t i , v i ) = (t a , t b , t c , a, b, c) touches the precedent tuple (t i-1 , v i-1 ) by a V-vertex, say, by a. Then there are 3 different cases, see Figure 5.15 on page 125, how the next tuple (t i-1 , v i-1 ) may touch (t i , v i ):

• 'vDv' or 'vDt': by the V-vertex b or c or by the T -vertex t a correspondingly, in each of these cases, the cycle length is not reduced by taking the quotient;

• 'vLt': by the T -vertex t c , or

• 'vRt': by the T -vertex t b , in both of these cases, the (i + 1)th tuple touches the (i -1)th tuple.

Every case has its own label. The first lower-case letter explains how the (i -1)th tuple touches the ith one: either by a T -vertex (t) or by a V-vertex (v). The upper-case letter describes which side of the ith triangle touches the (i + 1)th one: left (L), right (R), or the distant side (D). The last lower-case letter precises if the ith and (i + 1)th tuples touch either by a T -vertex (t) or by a V-vertex (v).

After giving a label to each triangle, depending on how it touches the precedent and the next triangles, we can represent any such cycle by a word. And we can characterize how each combination of labels reduces the length. Consider an example given on Figure 5.16 on page 125.

Observe that for a sequence of tuples there is a unique word, but for the same word there may be more than one different sequence of tuples. However, they all have the same length even after taking the quotient. We are going to consider all possible cases how the addition of the next tuple changes the length of the sequence in the quotient. And to provide an upper bound for the probability that, after increasing the sequence by one more tuple, the length of the sequence increases once we identify all the duplicated implicit tuples.

tDv tLv tRv tRt tLt i -1 i i + 1 i + 1 i + 1 i + 1 i + 1 i i i i i -1 i -1 i -1 i -1
1 i i + 1 i + 1 i + 1 i + 1 i i -1 i -1 i i + 1

125

• If a word ends with tLt, then adding Lt or Lv does not increase the length because the last two tuples intersect the same tuples. If we assume that adding each label has equal probability 1 5 , then the black triangle is added with probability at most 3 5 . The case for tRt is similar. • If a word ends with tLv, then adding Lt or Rt does not increase the length because the newly added tuple intersects the same tuples as the previous one. Thus, the length increases with probability at most 3 5 . The case for tRv is similar. • If a word ends with vLt, then adding Lt or Lv does not add a new black triangle.

The probability that the length increases is at most 3 5 . The case for vRt is similar. • If a word ends with tDv or with vDv, then adding Lt or Rt does not add a black triangle. Thus, the probability is again at most 3 5 . • If a word ends with vDt then adding anything but Dv does not add a black triangle, thus the probability is at most 1 5 so we can assume that it is at most 3 5 .

Let p ≤ 3 5 . Let X = k i=0 X i , where k denotes the number of tuples in the sequence, and X i s are independent random values that take values in {0, 1} such that, for all i in [k], we have Pr(X i = 1) = p. Below, we write the probability that a sequence, having length k before taking the quotient, has length at most l after taking the quotient:

Pr(X < l) = l i=0 n l p i (1 -p) k-i .
The smaller the value of p, the greater this probability becomes. So this probability is minimal when p = 3 5 . This implies the following lower bound:

Pr(X < l) > l i=0 n l 3 5 i 2 5 k-i > 2 5 k .
Consider a random ρ-structure S ′ , as in the proof of Lemma 5.1.4, with the domain of size n, where, as every relation has 6 coordinates, the probability that for given 3 Tvertices and 3 V-vertices there is a tuple on them is n ε n 5 , where ε > 0 is fixed. We want to compute the expected number of cycles on k vertices, for some natural number k. We use the following information in order to do this:

• n k -the number of ways to choose k vertices that make the cycle; • k! 2k -the number of different cycles consisting of k elements; • (n -k) . . . (n -5k + 1) -the number of ways to choose the vertices that belong to some tuple but do not participate in the cycle;

• n 1+ε n 6 k -the probability that every of the k tuples of the cycle is present.

The expected number of cycles of length k is the product of these four values.

n k k! 2k (n -k) . . . (n -5k + 1) n εk n 5k = n! 2k(n -5k)! • n εk n 5k (5.1)
Stirling's formula states that n! ∼ √ 2πn n e n , so the expected number of such cycles transforms as follows.

n n 2ke 5k (n -5k) n-5k • n εk n 5k = 1 2ke 5k • 1 + 5k n -5k n-5k • n εk > n ε ′ k .
Here, ε ′ in (0, ε) is a fixed value such that n (ε-ε ′ )k > 2ke 5k , for any k < ⌊n/5⌋ and n large enough.

So, the expected number of cycles that have length k within S ′ and that have length at most l within the quotient S ′ /eq is at least 2 5 k n ε ′ k , so it belongs to Ω(n ε ′′ k ), where

ε ′′ in (0, ε ′ ) is a constant such that n (ε ′ -ε ′′ )k > 5 2
k , for all k < ⌊n/5⌋ and n large enough. As k can take values up to ⌊n/5⌋, we conclude that the number of cycles that become short in the quotient is greater than the number of tuples in S ′ , so we cannot guarantee that we can remove all short cycles from S ′ /eq by removing O(n εl ) tuples as in the proof of Lemma 5.1.4.

Regular graphs

A graph is regular if all the vertices have the same degree, i.e., if there exists d ∈ N such that for any vertex there are exactly d edges adjacent to it. If G is a graph, then a graph L G is called the line graph of G if its vertex set L G = E G is the edge set of G and two vertices e 1 , e 2 ∈ L G are adjacent if the corresponding edges share a common point in G.

In this part, we introduce two properties such that if a graph satisfies them, then one could use this graph for proving the dichotomy of MMSNP 2 . The first property is used in the deterministic proof of the equivalence between CSP and MMSNP of Kun in [START_REF] Kun | Constraints, MMSNP and expander relational structures[END_REF].

Property 1 (ε-expander). Let G be a graph. For two subsets S, T ⊆ G, denote by E(S, T ) the subset of E G of edges with one end in S and the other in T . Then G is called ε-expander if it satisfies the following condition, for any subsets S, T ⊆ G:

|E(S, T )| - |S||T | |G| 2 |E G | < ε|E G |.
(5.2)

The second property appears from the difference between MMSNP and MMSNP 2 and from the construction of an ε-expander structure from a regular graph in [START_REF] Kun | Constraints, MMSNP and expander relational structures[END_REF].

Property 2. Let G be a graph. Let T G be a graph with its vertex set T G consisting of all the triangles of G. Two vertices t 1 , t 2 ∈ T G are adjacent if the corresponding two triangles of G have two vertices out of three in common. T G is called the triangle graph of G. The graph G is called an ε-triangle-expander if T G is an ε-expander.

Property 1 is well-studied and there are numerous examples of graphs that satisfy it. Despite, Property 2 is introduced here for the first time. We could provide an example of a graph that is an ε-triangle-expander.

Example 5.3.1. Let G be a graph with the domain {a, b, c 1 , . . . , c n }. The set of edges E G is {ab, ac 1 , bc 1 , . . . , ac n , bc n }. Then any triangle is of the form abc i and every two triangles have the edge ab in common. Thus, T G = K n is the clique on n vertices. △ Our goal is to obtain a relational structure over a relational signature with symbols of large arity from a graph, similarly to what is made in Kun's paper [START_REF] Kun | Constraints, MMSNP and expander relational structures[END_REF]. However, he does not consider triangles, he constructs relational tuples of arity k from paths of the length k within a regular graph. And the resulting relational structure satisfies Property 1 which is sufficient for him. This is not sufficient for us as we need to take into the account Property 2 as well.

We are going to show that the approach of Kun fails to satisfy Property 2. For simplicity, we consider a particular case, when the corresponding relational structure has one ternary symbol (that is associated with a triangle). In order to construct an ε-expander, Kun takes some regular graph G with a small enough value of λ 2 d , where λ 2 denotes the second largest eigenvalue (with respect to its absolute value) of the adjacency matrix of G and d denotes the degree of any vertex of the graph. The value λ 2 d is called the eigenvalue gap of G.

The following proposition shows that if one constructs T G by considering paths of length 2 instead of triangles, then no graph G can satisfy both Property 1 and Property 2 at the same time.

Proposition 5.3.1. Let G be a regular graph of degree d, with second largest eigenvalue λ 2 . Also suppose that G has girth at least 5 so that saying that two paths of length 2 share two vertices is equivalent to saying that these two paths share an edge. Let L G be the line graph of G. And let T G be a graph with the domain T G = {abc | ab, bc ∈ E G } consisting of all the paths of length 2 in G. And there is an edge between two vertices a 1 a 2 a 3 and b

1 b 2 b 3 of T G if |{a 1 , a 2 , a 3 } ∩ {b 1 , b 2 , b 3 }| = 2.
Then, the eigenvalue gap of T G is at least 3 4 . Proof. Recall that, for a graph G on n vertices and with m edges, the adjacency matrix A G is an n × n matrix where a ij = 1, if ij ∈ E G , and a ij = 0, otherwise. And the incidence matrix of G is an n × m matrix X G where x ve = 1, if the edge e is incident to the vertex v, and x ve = 0, otherwise.

It is known that X G X t G = A G + dI n where I n is the incidence matrix of size n. Also,

X t G X G = A L G + 2(d -1)I m , where L G is the line graph of G.
There is a proof of Sachs that shows how the characteristic polynomials of A G and A L G are related to each other, in the book "Algebraic Graph Theory" of Biggs [START_REF] Biggs | Algebraic graph theory[END_REF]. Two matrices are considered:

U = λI n -X G 0 I m , V = I n X G X t G λI m .
These matrices provide the following fact about the characteristic polynomials of X G and X L G :

det(UV) = det(VU) ⇔ λ m det(λI n -X G X t G ) = λ n det(λI m -X t G X G ) ⇔
Characteristic polynomials are useful if one needs to compute the second largest eigenvalue. So, in order to finish the proof, we need to compute the characteristic polynomial of T G . Firstly, in a d-regular graph the number of edges equals m = nd 2 , and the number of paths of length 2 equals m 2 := nd(d-1)

2

. Let X ∆ be an m × m 2 matrix, where every row is associated with an edge of G and every column is associated with a path of length 2, X ∆ [e, p] = 1, if the edge e belongs to the path p, and it equals 0, otherwise. Observe that

A T G = X t ∆ X ∆ -2I m 2 and A L G = X ∆ X t ∆ -2(d -1
)I m as every edge is contained in exactly 2(d-1) paths. For every path there are exactly (d-1)+2(d-2)+(d-1) = 2(2d-3) other paths that share an edge with it. Hence, the degree of every vertex of T G is 2(2d -3). Using the similar approach as above we get:

χ T G (λ) = det(λI m 2 -A T G ) = det (λ + 2)I m 2 -X t ∆ X ∆ = = (λ + 2) m 2 -m det (λ + 2)I m -X ∆ X t ∆ = = (λ + 2) m 2 -m det (λ -2d + 4)I m -A L G = = (λ + 2) m 2 -m χ L G (λ -2d + 4) = (λ + 2) m 2 -n χ G λ -3(d -2) .
Thus, the second largest eigenvalue of T G is λ 2 + 3(d -2), therefore, the eigenvalue gap of T G is λ 2 +3(d-2) 2(2d-3) that cannot be smaller than 3(d-2) 2(2d-3) ≈ 3 4 . As we need the eigenvalue gap to be arbitrarily small, this approach is not useful for us.

129

Chapter 6

Matrix Partition

We consider an extension of CSP which is called Matrix Partition problems (MP). We mainly study its generalisations by manipulating the containments of the problem input and by considering problems over arbitrary relational signatures. We show how these generalisations are related to each other in terms of having a dichotomy. Being motivated by Atserias' characterization of FO-definable fragment of CSP by having a finitary duality in [START_REF] Atserias | On digraph coloring problems and treewidth duality[END_REF], we study how different input extensions influence an MP problem to be expressed by finitely many minimal obstructions. Apart from that, we provide an MP problem which is P-time solvable with a trivial clone of polymorphisms. Finally, we provide a logic that is an extension of MMSNP and a fragment of MonadicSNP that contains MP and that becomes a candidate to be P-time equivalent to MP.

Preliminaries

We deal mostly with labeled complete relational structures, i.e., each relation of arity k is V k , and tuples are labeled by the elements of a partially ordered set, defined for example in [START_REF] Stanley | Enumerative combinatorics[END_REF].

Definition 20 (( * , τ )-structures). Let (P * , ⪯ * ) be a partially ordered set (poset), and τ be a finite relational signature. A ( * , τ )-structure is a tuple G := (G; R G 1 , . . . , R G n ) with G a finite set, and for each i ∈ [n], R G i : G k i P * is interpreted as a mapping to the elements of the poset.

We will always denote a ( * , τ )-structure by a boldface capital letter, e.g. A, and its domain by the same letter in plain font, e.g. A. It is worth mentioning that the notion of ( * , τ )-structure is different from the one in universal algebra, where in the latter case the functional symbol R i is interpreted in G as a function from G k i G. For a ( * , τ )-structure G and X ⊆ G, the substructure of G induced by X is the ( * , τ )structure G ′ with domain G ′ = X and, for R ∈ τ of arity k and t ∈ X k , R G ′ (t) = R G (t); and we denote by G ∖ X the substructure of G induced by G ∖ X.

We now extend the notion of homomorphism between relational structures to ( * , τ )structures, the difference being the ability to map a tuple to a "greater" one.

Definition 21 (homomorphism for ( * , τ )-structures). For two ( * , τ )-structures G and H, a mapping h : G H is called a homomorphism from G to H if, for each R ∈ τ of arity k, and

t ∈ G k , R G (t) ⪯ * R H h(t) .
As usual, we will write h : G H to mean that h : G H is a homomorphism from G to H. We say that h : G H is surjective (resp. injective) if h : G H is surjective (resp. injective).

We can now explain how the notion of homomorphism between ( * , τ )-structures subsumes the usual ones. Before, let us recall the partial orders we consider in this thesis.

• (P 01 , ⪯ 01 ), where P 01 = {0, 1} and ⪯ 01 is the empty order with 0 and 1 incomparable.

• (P CSP , ⪯ CSP ), where P CSP = {0, 1} and ⪯ CSP is a total order with 0 ⪯ CSP 1.

• (P ⋆ , ⪯ ⋆ ), where P ⋆ = {0, 1, ⋆} and ⪯ ⋆ is the poset with 0 ⪯ ⋆ ⋆ and 1 ⪯ ⋆ ⋆, and 0 incomparable with 1.

• (P ∅ , ⪯ ∅ ) where P ∅ = {∅, 0, 1, ⋆} and ⪯ ∅ is the poset with ∅ ⪯ ∅ 0 ⪯ ∅ ⋆ and ∅ ⪯ ∅ 1 ⪯ ∅ ⋆, and 0 incomparable with 1.

Remark. If the signature τ is clear from the context, then we will just write * -structure instead of ( * , τ )-structure, for * ∈ {01, ⋆, ∅}. Also, if τ = {E(•, •)}, then we will write * -graph instead. Finally, we will talk about relational τ -structures and directed graphs, instead of (CSP, τ )-structures and CSP-graphs. Furthermore, for any tuple (arc) t ∈ A k of a * -structure ( * -graph) A corresponding to a symbol R in τ that is clear from the context, we will call t a p-tuple (p-arc) if R A (t) = p for some element p of the poset (P * , ⪯ * ).

It is not hard to check that (CSP, τ )-structures are exactly associated with the usual notion of relational τ -structures, and homomorphisms between (CSP, τ )-structures to usual homomorphisms. Notice that homomorphisms between (01, τ )-structures are exactly full homomorphisms on relational structures. Proposition 6.1.1. Let (P * , ⪯ * ) and (P * ′ , ⪯ * ′ ) be two posets, with (P * , ⪯ * ) a sub-poset of (P * ′ , ⪯ * ′ ). Then every ( * , τ )-structure is also a ( * ′ , τ )-structure, for any τ .

Particularly, for any τ , every (01, τ )-structure is a (⋆, τ )-structure, and every (⋆, τ )structure is a (∅, τ )-structure. For * ∈ {01, ⋆, ∅}, we denote by Struct * [τ ] the set of all ( * , τ )-structures. We use the notation Struct * because one can use ( * , τ )-structures as objects and homomorphisms as arrows to make a category. From the proposition above, and the definitions of (P 01 , ⪯ 01 ), (P ⋆ , ⪯ ⋆ ) and (P ∅ , ⪯ ∅ ), we have the following inclusion:

Struct 01 [τ ] ⊂ Struct ⋆ [τ ] ⊂ Struct ∅ [τ ].
We can now define the homomorphism problems, that we restrict for conciseness to the four posets: (P 01 , ⪯ 01 ), (P ⋆ , ⪯ ⋆ ), (P ∅ , ⪯ ∅ ), (P CSP , ⪯ CSP ). Definition 22. Let τ be a finite signature and * ∈ {01, ⋆}. For a ⋆-structure H, the problem MP τ * (H) denotes the set of all * -structures G such that there exists a homomorphism h : G H. If H is a CSP-structure, then we write CSP τ (H) as the set of all CSP-structures G such that there exists a homomorphism h : G H. We always omit subscript 01 in MP τ 01 (H). The set of all ∅-structures G such that there is a homomorphism h : G H, with H a ∅-structure, is denoted by MP τ ∅ (H).

By MP τ , MP τ ⋆ , MP τ ∅ and CSP τ we denote, respectively, the families of problems MP τ (H), MP τ ⋆ (H), MP τ ∅ (H) and CSP τ (H), for all ⋆-structures H. For CSP τ (H) we of course demand that H is a relational τ -structure, and for MP τ ∅ (H), we consider H to be a (∅, τ )-structure. If τ = {E(•, •)} -the directed graph signature, then we will omit the τ -superscript and will just write MP, MP ⋆ , MP ∅ and CSP.

Remark. All along the thesis, whenever we consider a problem MP τ * (H), for * ∈ {01, ⋆, ∅}, we consider that there is no x ∈ H such that for all R ∈ τ , R(x, . . . , x) = ⋆. Otherwise, the problem is trivial as then MP τ * (H) equals Struct τ * . Notice that as every 01-structure is also a ⋆-structure, and every ⋆-structure is also a ∅-structure, our problems are well defined.

Example 6.1.1. Let H be as on Figure 6.1 on page 133. We can define three problems: MP(H), MP ⋆ (H), and MP ∅ (H). The first one takes an input directed graph and checks if all the loopless vertices induce an independent set, if all the vertices with loops induce a clique, and if there is an arc from any vertex with a loop to any loopless one. The second one takes an input ⋆-graph and checks if all vertices with 0-loops induce an independent set, if all the vertices with 1-loops induce a clique, and if there is a 1-arc from any vertex with a 1-loop to any with a 0-loop. The third problem checks if there is a partition of the domain of an input ∅-graph G in two parts G 0 , G 1 such that • for all x, y in G 0 , we have E G (x, y) ∈ {∅, 0}, or equivalently E G (x, y) ⪯ ∅ 0;

• for all x, y in G 1 , we have E G (x, y) ⪯ ∅ 1, and • for all x in G 1 , y in G 0 , we have E G (x, y) ⪯ ∅ 1.

△

Nuance in the definition

The original definition of Matrix Partition problem is as follows. Further, we explain why this definition is inconvenient for some questions that we consider.

Definition 23 (Matrix Partitions [START_REF] Feder | Matrix partitions with finitely many obstructions[END_REF]). Let M be a an n × n-matrix with entries on {0, 1, ⋆}. A loopless graph G admits an M-partition if there is a function m : G

[n] such that for all distinct x, y ∈ G,

E G (x, y) ⪯ ⋆ M[m(x), m(y)].
There are some differences between the definition of M-partition in [START_REF] Feder | Matrix partitions with finitely many obstructions[END_REF] and the definition of MP(H). Unlike Feder and Hell, we consider all possible graphs in the input, not only the loopless ones. Thus, we consider every two vertices that are not necessarily distinct, however, Feder and Hell consider every two distinct ones.

We can put 01-graphs and ⋆-graphs into the same category. For convenience, we want to consider directed graphs and ⋆-graphs as objects of the same category Struct ⋆ . In this case, directed graphs become 01-graphs, according to the definition of MP. Morphisms (arrows) of any category must be transitive. Our definition permits to put digraphs as 01-graphs into the same category as trigraphs, where a morphism between two 01-graphs represents a full homomorphism between the corresponding digraphs. Full homomorphisms are transitive. But they are not transitive in the case of Feder and Hell, we justify it in Example 6.1.2. K 2 admits L-partition, as it is a clique. But K 1,2 does not admit L-partition as it is not a clique. △

We need a less expressive logic for our definition.

∃M 1 , M 2 ∀x, y ¬ ¬M 1 (x) ∧ ¬M 2 (x) ∧¬ M 1 (x) ∧ M 2 (x) ∧    ¬ M 1 (x) ∧ M 1 (y) ∧ x ̸ = y ∧ E(x, y) ∧¬ M 1 (x) ∧ M 2 (y) ∧ x ̸ = y ∧ E(x, y) ∧¬ M 2 (x) ∧ M 2 (y) ∧ x ̸ = y ∧ ¬E(x, y)    .
And the problem MP(H) can be formulated by a similar sentence but without inequalities:

∃M 1 , M 2 ∀x, y ¬ ¬M 1 (x) ∧ ¬M 2 (x) ∧¬ M 1 (x) ∧ M 2 (x) ∧    ¬ M 1 (x) ∧ M 1 (y) ∧ E(x, y) ∧¬ M 1 (x) ∧ M 2 (y) ∧ E(x, y) ∧¬ M 2 (x) ∧ M 2 (y) ∧ ¬E(x, y)    . △ It is

Matrix Partition and CSP

Let τ = {R 1 , . . . , R n } be a signature, the arity of each R i denoted by k i . We prove in this section that there is a signature τ CSP such that any problem in MP τ ∅ is P-time equivalent to a problem in CSP τ CSP and vice versa, that is, MP τ ∅ ≡ p CSP τ CSP . The signature τ CSP is defined by repeating each symbol of τ two times, one for 0-tuples and one for 1-tuples, ⋆-tuples will be considered as 0-and 1-tuples at the same time. Let

τ CSP = {R 1,0 , R 1,1 , . . . , R n,0 , R n,1 }, for i ∈ [n], R i,0 , R i,1 both have arity k i .
Every ∅-structure A ∅ is associated with a relational τ CSP -structure A CSP with the same domain A and the symbols R i,0 , R i,1 of τ CSP are interpreted as follows:

∀R i ∈ τ, t ∈ A k i , j ∈ {0, 1} : R A CSP i,j (t) = 1 ⇔ j ⪯ ∅ R A∅ i (t). (6.1)
Observation 2. A CSP is constructible in P-time in the size of A ∅ .

Observation 3. For any (∅, τ )-structure A ∅ , there exists a unique relational τ CSP -structure A CSP , and for any relational τ CSP -structure, there exists a unique (∅, τ )-structure A ∅ such that eq. (6.1) is satisfied. That is there is a one-to-one correspondence between (∅, τ )structures and relational τ CSP -structures.

Theorem 6.2.1. MP τ ∅ and CSP τ CSP are P-time equivalent. Proof. Let A ∅ be a ∅-structure. We first prove that

B ∅ ∈ MP τ ∅ (A ∅ ) if and only if B CSP ∈ CSP τ CSP (A CSP ).
Assume that B ∅ ∈ MP τ ∅ (A ∅ ) and let h : B A be a homomorphism from B ∅ to A ∅ . We will show that the same map h is a homomorphism from B CSP to A CSP . For any tuple t and its image h(t), we know that for any R i,j ∈ τ CSP :

R B CSP i,j (t) = 1 ⇔ j ⪯ ∅ R B∅ i (t) ⇒ j ⪯ ∅ R A∅ i h(t) ⇔ R A CSP i,j h(t) = 1.
Now, backwards, assume that B CSP ∈ CSP τ CSP (A CSP ), and let h : B A a homomorphism from B CSP to A CSP . Similarly as in the first part, for a tuple t, we know that for all R i ∈ τ, j ∈ {0, 1}:

j ⪯ ∅ R B∅ i (t) ⇔ R B CSP i,j (t) = 1 ⇒ R A CSP i,j h(t) = 1 ⇔ j ⪯ ∅ R A∅ i h(t) .
This implies that h is a homomorphism from B ∅ to A ∅ .

For * ∈ {01, ⋆, ∅}, the notion of homomorphism between ( * , τ )-structures admits a core notion. It generalises the notion of a core for trigraphs (⋆-graphs) given in [START_REF] Hell | On the density of trigraph homomorphisms[END_REF]. For * ∈ {01, ⋆, ∅}, a ( * , τ )-structure C is called a core if any homomorphism h : C C is an isomorphism, where isomorphism between ( * , τ )-structures is the same as usual. Proposition 6.2.2. Let * ∈ {01, ⋆, ∅}. Then for any ( * , τ )-structure A * , there exists a unique, up to isomorphism, ( * , τ )-structure C * such that it is a core and A * ⇆ C * , and C * embeds into A * .

Proof. We know that A * is also a ∅-structure by Proposition 6.1.1. Then, consider the relational τ CSP -structure A CSP provided by Theorem 6.2.1. It is well-known, see [START_REF] Hell | Graphs and homomorphisms, volume 28 of Oxford lecture series in mathematics and its applications[END_REF], that A CSP has the core C CSP embedded into A CSP . Let C * be the corresponding ∅-structure by Theorem 6.2.1, it must also be homomorphically equivalent to A * and be embedded into it. As C * embeds into A * , it is also a * -structure. Let e : C C be a non-injective endomorphism. Then the same map e will be a non-injective endomorphism of the core C CSP which is impossible. Let C ′ * be another core of A * , that is not isomorphic to C * . But then C ′ CSP must be the core of A CSP and

C CSP ̸ ∼ = C ′ CSP which is impossible as C CSP is a core.
If, for a class of problems C, C ⊆ p CSP, then C has a dichotomy. We manage to embed the class MP ∅ into CSP because of the smallest element ∅. Now we show that this happens every time when the poset (P * , ⪯ * ) is a lattice.

A poset (P, ⪯) is called a lattice if, for any two elements x, y in P there are two elements:

• x ∨ y -the least upper bound, that is, for any element z, we have

x ⪯ z and y ⪯ z implies x ∨ y ⪯ z;

• x ∧ y -the greatest lower bound, that is, for any element z, we have z ⪯ x and z ⪯ y implies z ⪯ x ∧ y.

In the rest of this section, we prove the following theorem. Theorem 6.2.3. Let τ be a finite relational signature. Suppose that (P * , ⪯ * ) is a lattice. Then, for any ( * , τ )-structure A * there is a τ CSP -structure A CSP such that MP τ * (A * ) is P-time equivalent to CSP τ CSP (A CSP ), where τ CSP is a finite relational signature.

We first explain how to construct A CSP from A * . Construction 17. The signature τ CSP is constructed as follows:

τ CSP := R l | R ∈ τ, l ∈ P * ∖ {min} ,
where min denotes the minimal element of the lattice. Each R l has the same arity as R has.

The domain of A CSP is the same as the domain of A * . For any k-ary R in τ , and for any k-tuple a of the elements of A * , for any l in P * ∖ {min}, a belongs to R A CSP l if and only if R A * ⪰ * l. This is the end of Construction 17. Example 6.2.1. Let (P * , ⪯ * ) be as on Figure 6.3. Let τ be the graph signature: τ = {E(•, •)}. Then τ CSP contains 4 relational symbols: E a , E b , E c , and E abc . For a * -graph A * , the structure A CSP is constructed as follows.

• For any (x, y) ∈ A 2 such that E A * (x, y) = 0, it is contained in no τ CSP -relation of A CSP .

• For any (x, y)

∈ A 2 such that E A * (x, y) = a, it is contained in E A CSP a .
The cases E A * (x, y) = b and E A * (x, y) = c are treated similarly.

• For any (x, y) ∈ A 2 such that E A * (x, y) = abc, it is contained in all four relations

E A CSP a , E A CSP b , E A CSP c , E A CSP abc .
△ To prove Theorem 6.2.3, we need the two following propositions. , for any l ′ ⪯ * l. This implies that h is a homomorphism between B * and A * if and only if it is a homomorphism between B CSP and A CSP . Proposition 6.2.5. Let G be a finite τ CSP -structure. Suppose that, for any R in τ of arity k and for any k-ary tuple x of G, there is l in P * such that x belongs to R G m , for any m ⪯ * l. Then there is a ( * , τ )-structure B * such that G = B CSP , where B CSP is obtained from B * by Construction 17.

Proof. Let B * have the same domain as G has. For any R ∈ τ of arity k, and for any k-ary tuple x, we put R B * (x) = l, where l is the maximal element such that x is contained in R G l . Let B CSP be obtained from B * by Construction 17. By construction, B CSP and G is the same structure.

Proof of Theorem 6.2.3. For a ( * , τ )-structure A * , we construct in P-time in size of A * , the relational structure A CSP , by Construction 17. By Proposition 6.2.4 on page 137, we have MP τ * (A * ) ≤ p CSP τ CSP (A CSP ). Now, consider an arbitrary relational τ CSP -structure G, we will find a ( * , τ )-structure B * such that G A CSP if and only if B * A * . For any R in τ of arity k, consider a k-tuple x of G. Let X x denote the following subset of P * :

X x := l ∈ P * | x ∈ R G l .
Proof of Theorem 6.3.1. Let us first explain the case of ⋆-graphs. Let H be a ⋆-graph with m = |H|. We will show the P-time equivalence between the problems MP(H) and MP ⋆ (H).

Every 01-graph is also a ⋆-graph, so MP 01 (H) trivially reduces to MP ⋆ (H). For the opposite direction, let us construct for every ⋆-graph G, a 01-graph G 01 such that G ∈ MP ⋆ (H) if and only G 01 ∈ MP 01 (H).

Let k be the smallest positive integer such that 2 k > 4m 2 + 1, and let H 2 k be the Hadamard matrix ensured by Lemma 6.3.2. Let the domain of G 01 be the disjoint union g∈G V g , where for all g ∈ G, |V g | = 2 k . Let us enumerate the set V g as {v g,1 , . . . , v g,2 k },

for each g ∈ G. Now, for each v g 1 ,i ∈ V g 1 and v g 2 ,j ∈ V g 2 , 1 ≤ i, j ≤ 2 k , E G 01 (v g 1 ,i , v g 2 ,j ) = E G (g 1 , g 2 ) if E G (g 1 , g 2 ) ̸ = ⋆, (H 2 k [i, j] + 1)/2 otherwise.
Observe that in the case For the other direction, we use the same technique as in the proof for the binary case, we construct a 01-structure G 01 . For a given input G, and for any element g ∈ G, we introduce a set V g = {v g,1 , . . . , v g,2 k } of size 2 k such that 2 k ≥ 4|H| 2 + 1 and k is the smallest such positive integer. Let also H 2 k be the Hadamard matrix guaranteed by Lemma 6.3.2. Now, the domain G 01 of G 01 is the disjoint union g∈G V g . For each R i ∈ τ and for each tuple

E G (g 1 , g 2 ) = ⋆, if H 2 k [i, j] = 1, then E G 01 (v g 1 ,i , v g 2 ,j ) = 1,
, g 2 ∈ G, if E G (g 1 , g 2 ) ∈ {0, 1}, then for all a 1 ∈ A g 1 , a 2 ∈ A g 2 , E G 01 (a 1 , a 2 ) = E G (g 1 , g 2 ), so E G (g 1 , g 2 ) ⪯ ⋆ E H h(g 1 ), h(g 2 ) . If E G (g 1 , g 2 ) = ⋆, then H 2 k [A g 1 , A g 2 ] is of size at least 4m 2 +1 m × 4m 2 +1 m ,
(v g 1 ,i 1 , v g 2 ,i 2 , . . . , v g k i ,i k i ), R G 01 i (v g 1 ,i 1 , . . . , v g k i ,i k i ) = R G i (g 1 , . . . , g k i ) if R G i (g 1 , . . . , g k i ) ̸ = ⋆, (H 2 k [i 1 , i 2 ] + 1)/2 otherwise.
Suppose now that there exists h 01 : G 01 H. Then, by pigeonhole principle, in each set V g , there is a set of size at least |Vg| |H| elements that are mapped to the same element of H, denoted by A g . Then, the sets A g 1 and A g 2 define a submatrix of H 2 k of size at least 2 √ 2 k and thus it is not monochromatic by the same argument as in the proof for the binary case.

Signature simplification

Recall that a primitive-positive formula φ(x 1 , . . . , x n ) is a first-order formula (FO τ ) of the form ∃x n+1 , . . . , x m .(ψ

1 ∧ • • • ∧ ψ l )
where each ψ i is either

x s = x j , true, or R(x i 1 , . . . , x i k ) = 1. Let τ = {R 1 , . . . , R n }, τ ′ = {S 1 , .
. . , S m } be two signatures, and A, A ′ be relational τand τ ′ -structures over the same domain A. We say that A pp-defines A ′ if for every k-ary relation S A ′ j of A ′ there exists a primitive-positive formula φ j ∈ FO τ with k free variables such that for all (a 1 , . . . , a

k ) ∈ A k , S A ′ j (a 1 , . . . , a n ) = 1 ⇔ A ′ |= φ j (a 1 /x 1 , . . . , a n /x n ).
Theorem 6.3.4. [START_REF] Barto | Absorption in universal algebra and CSP[END_REF] Suppose that a relational τ -structure A pp-defines a relational τ ′ -structure A ′ . Then the problem CSP τ ′ (A ′ ) reduces in P-time to CSP τ (A).

From directed graphs to many relations

Let τ = {R 1 , . . . , R n } be a finite signature with arities k 1 , . . . , k n , and such that k 1 ≥ 2.

We show that the existence of a dichotomy for the class of problems MP τ ⋆ implies the existence of a dichotomy for the class of ⋆-graphs MP ⋆ . Let γ = {E(•, •)} be the directed graph signature and let γ CSP = {E 0 (•, •), E 1 (•, •)} be obtained from γ by the construction from Section 6.2. Theorem 6.3.5. For every ⋆-graph H ⋆ there exists a (⋆, τ )-structure A ⋆ such that the problems MP ⋆ (H ⋆ ) and MP τ ⋆ (A ⋆ ) are P-time equivalent.

Proof. Let us recall from the Section 6.2 that there is a one-to-one correspondence between a (∅, τ )-structure A ∅ and a relational τ CSP -structure A CSP such that for any two (∅, τ )structures A ∅ , B ∅ :

B ∅ A ∅ ⇔ B CSP A CSP .
Now, let us consider a ⋆-graph H ⋆ with its corresponding relational γ CSP -structure H CSP . We construct the τ CSP -structure A CSP by the following pp-definition:

∀j ∈ {0, 1} R A CSP 1,j (x 1 , . . . , x k 1 ) = 1 ⇔ E H CSP j (x 1 , x 2 ) = 1; (6.2) ∀i > 1, j ∈ {0, 1} R A CSP i,j (x 1 , . . . , x k i ) = 1 ⇔ true. (6.3)
Observe that the relational γ CSP -structure H CSP is also pp-definable from the relational τ CSP -structure A CSP :

E H CSP (x 1 , x 2 ) = 1 ⇔ ∃x 3 , . . . , x k 1 .R A CSP 1 (x 1 , . . . ,
∈ B k 1 either R B CSP 1,0 (x) = 1 or R B CSP 1,1 (x) = 1. So, B ⋆ is indeed a (⋆, τ )-
(G ⋆ ) ≡ p MP τ ⋆ (A ⋆ )
One notices that the proof of Theorem 6.3.5 is still correct if we replace γ by any relation R of arity ℓ ≥ 2, we require in this case that R 1 has arity at least ℓ.

From many relations to one

Suppose that τ = {R 1 , . . . , R p }, R i has arity k i , let k = max i k i . We show that for any such τ there exists τ = {R} with R of arity k + p -1 such that for any (⋆, τ )-structure A there exists a (⋆, τ )-structure à such that MP τ ⋆ (A) and MP τ ⋆ ( Ã) are P-time equivalent. This means that MP τ ⋆ ⊆ p MP τ ⋆ . Now we will describe how the τ -structure

à is constructed. If A is the domain of A, then the domain à of à is à = A ⊔ {c A }, with c A a new element. The relation R à is defined as follows: • Let A 1 = { t = (c A , . . . , c A i-1 , t, c A , . . . , c A k+p-k i -i ) | R i ∈ τ, t ∈ A k i }, and for all, t ∈ A 1 , R Ã( t) = R A i (t); (6.5)
• Let A 2 = {(c A , . . . , c A )}, then for all t ∈ A 2 : R Ã( t) = 1;

• Let A 3 = Ãk+p-1 ∖ (A 1 ⊔ A 2 )
, then for all t ∈ A 3 : R Ã( t) = 0. Now we will prove one direction of the P-time equivalence. The size of à is polynomial in |A|, so the construction takes P-time, and below we show that B A ⇔ B Ã.

Lemma 6.3.6. MP τ ⋆ (A) reduces in polynomial time to MP τ ⋆ ( Ã).

Proof. Let B be an input instance of the problem MP τ ⋆ (A). Assume that there is h : B A -a homomorphism. We will show that h : B Ã such that h(c B ) = c A and for all

x ∈ B ∖ {c B } : h(x) = h(x), is a homomorphism. Recall that Bk+p-1 = B 1 ⊔ B 2 ⊔ B 3 . Consider t = (c B , . . . , c B , t, c B , . . . , c B ) ∈ B 1 , where t = (b 1 , . . . , b k i ) ∈ B k i for R i ∈ τ . Then h( t) = (c A , . . . , c A , h(t), c A , . . . , c A ) ∈ A 1 .
As h is a homomorphism, we have that by eq. (6.5):

R B( t) = R B i (t) ⪯ ⋆ R A i h(t) = R Ã h( t) . • the domain B of B is B ∖ {c B }; • for any relation R i ∈ τ and any tuple t = (b 1 , . . . , b k i ) ∈ B k i it is interpreted as follows: R B i (t) = R B(c B , . . . , c B i-1 , t, c B , . . . , c B k+p-k i -i
).

(6.8)

If we apply the (•)-transformation to this (⋆, τ )-structure B, then we will get B, because for all tuples of B 2 , B 3 : R B always has values 1 and 0 correspondingly, and for all tuples of B 1 there is a one-to-one correspondence with the tuples of all R i ∈ τ , the equivalence of their values is provided by eqs. (6.5) and (6.8). By Lemma 6. Observe that in order to prove the other direction, for every (⋆, τ )-structure A, we have to find a (⋆, τ )-structure  such that MP τ ⋆ ( Â) and MP τ ⋆ (A) are P-time equivalent. We show in the next section the difficulties to obtain such a reduction.

The dichotomy implications between the considered classes are displayed on the diagram below. Each arrow shows an implication of the existence of a dichotomy, i.e., if the class at the tail has a dichotomy, then the class at the head has it. The vertical ones are shown in Section 6.3.1, and the horizontal ones are shown in Section 6.3.2. One can see now that the existence of a dichotomy for MP τ implies such existence for all other classes considered there.

MP ⋆ MP τ ⋆ MP τ ⋆ MP MP τ MP τ

From one relation to directed graphs

We do not prove that for any (⋆, τ )-structure H, with τ consisting of one single symbol, there exists a ⋆-graph H 2 such that MP τ ⋆ (H) ≡ p MP ⋆ (H 2 ). However, we will discuss some necessary conditions for the existence of such a reduction. And also we will discuss why approaches that are similar to the one used in [START_REF] Bulin | A finer reduction of constraint problems to digraphs[END_REF][START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF] cannot be applied to the homomorphism problems considered in this thesis, in particular, Matrix Partition Problems.

For the simplicity of the notations, we will consider the reduction from τ = {R(•, •, •)} to ⋆-graphs. In the very beginning, we are going to show that if there exists such a correspondence between (⋆, τ )-structures and ⋆-graphs, then the size of the domain of the constructed ⋆-graph must be significantly greater than the one of the corresponding ternary ⋆-structure.

This lemma ensures that when we make a correspondence between ternary and binary structures, in the general case we need to add a lot of elements to the binary one.

Corollary 6.3.10. Let n, m ∈ N. If |G n 3 | < |G m 2 |, then m > n(n -1) 2 -1. Proof.
The number of all possible ways to assign one of three values to each of the m 2 pairs equals 3 m 2 . Then, by Lemma 6.3.9:

3 m 2 ≥ |G m 2 | > |G n 3 | ≥ 3 n(n-1) 2 -1 |G n 2 | ≥ 3 n(n-1) 2 -1 ⇒ m 2 > n(n -1) 2 -1.
We will argue that all the approaches similar to the one used in [START_REF] Bulin | A finer reduction of constraint problems to digraphs[END_REF] do not work for the case of MP ⋆ (equivalently MP, see Section 6.3.1). Such an approach can be described by these steps: for any (⋆, τ )-structure H 3 the corresponding ⋆-graph H 2 is constructed as follows:

1. take the same domain H 2 = H 3 and 2. substitute every tuple R H 3 (x 1 , x 2 , x 3 ) by a ⋆-graph T v

x 1 x 2 x 3 for v ∈ {0, 1, ⋆} that contains only these 3 elements x 1 , x 2 , x 3 among those of H 3 . Letter T stands for "tuple" and the superscript v is for "value". It is required that for two different tuples t 1 and t 2 , the domains of T v 1 t 1 and of T v 1 t 2 intersect only on H 3 . So, the domain of H 2 is the union of the domain H 3 of the (⋆, τ )-structure H 3 and the domains of all the ⋆-graphs T v that represent the tuples of H 3 :

H 2 = H 3 ∪ (x 1 ,x 2 ,x 3 )∈H 3 3 , R H3 (x 1 ,x 2 ,x 3 )=v T v x 1 x 2 x 3 .
This union is not disjoint because each T v contains elements of H 3 . In [BDJN15] every such T v was a balanced directed graph obtained from the star with three leaves by subdividing each arc p times, for some p, the leaves being the elements of H 3 . So, during the reduction from CSP on directed graphs to CSP τ , it was clear which elements of the input directed graph are associated with the elements of the domain of the τ -structure from which this directed graph is reduced. This constructive approach can be generalised by the following list of conditions applied to H 2 . This means that any construction of H 2 that satisfies them, is called similar to the construction given in [START_REF] Bulin | A finer reduction of constraint problems to digraphs[END_REF]. All the results in this section are related only to such similar constructions.

For each

⋆-graph T v x 1 x 2 x 3 that represents a tuple R H 3 (x 1 , x 2 , x 3 ) = v, the problem MP ⋆ (T v x 1 x 2 x 3 ) is solvable in P-time and v x = R H 3 (x 1 , x 2 , x 3 ) ⪯ ⋆ R H 3 (y 1 , y 2 , y 3 ) = v y if and only if T vx x 1 x 2 x 3 T vy y 1 y 2 y 3 . 2. Let H 2 , H ′
2 be two ⋆-graphs obtained from (⋆, τ )-structures H 3 , H ′ 3 by this approach. Then, for any homomorphism h : 5. Let A be a ⋆-graph. Suppose that for some v ̸ = v ′ there is h : A T v xyz and A ̸ T v ′ xyz . Suppose that, for every a 0 , a n ∈ A such that h(a 0 ), h(a n ) ∈ {x, y, z}, there exist a 1 , . . . , a n-1 ∈ A such that:

H 2 H ′ 2 , it is true that for all x ∈ H 2 , x ∈ H 3 ⊆ H 2 ⇔ h(x) ∈ H ′ 3 ⊆ H ′ 2 . 3. For each ⋆-graph A that is an input instance of MP ⋆ (H 2 ),
• for every 1 ≤ i < n, h(a i ) ̸ ∈ {x, y, z},

• for every 0 ≤ i < n, E A (a i , a i+1 ) ̸ = 0 or E A (a i+1 , a i ) ̸ = 0.
Then, for any other h ′ : A T v xyz and for all a ∈ A such that h(a) ∈ {x, y, z}, we have that h(a) = h ′ (a).

In particular, the reduction from CSP τ to CSP on directed graphs in [START_REF] Bulin | A finer reduction of constraint problems to digraphs[END_REF] satisfies the first four conditions. The fifth one cannot be applied to CSP because there are no three different types of T v in that case. Any polynomial time reduction satisfying these five conditions, cannot prove the P-equivalence with ⋆-graphs, unless CSP ≡ p MP. We assume that CSP ≡ p MP ∅ by Section 6.2. Proposition 6.3.11. Let a ⋆-graph H 2 be constructed from some (⋆, τ )-structure H 3 and satisfy all the five conditions above. Then MP τ ⋆ (H 3 ) reduces in P-time to MP ⋆ (H 2 ), and MP ⋆ (H 2 ) reduces in P-time to MP τ ∅ (H 3 ). Proof. Consider (⋆, τ )-structures G 3 , H 3 and the corresponding ⋆-graphs G 2 and H 2 that satisfy the conditions 1-5. If there is h : G 3 H 3 , then, by the conditions 1 and 2, there is h 2 : G 2 H 2 . If there is h 2 : G 2 H 2 , then, by the condition 2, one can consider the restriction h of this map on the set G 3 , and the codomain of this map will be the set H 3 . By the condition 1, h is a homomorphism between G 3 and H 3 . Now, consider any ⋆-graph A from the input of MP ⋆ (H 2 ). By the condition 3, we can mark in P-time all the elements that can map only to the elements of H 3 , denote the set containing them by A 3 . Then on the set A∖A 3 we define the following equivalence relation eq(•, •): for two elements a 0 , a n ∈ A∖A 3 , we say that eq(a 0 , a n ) if there exists a sequence of elements a 0 , a 1 , . . . , a n-1 , a n ∈ A ∖ A 3 such that for any 0 ≤ i < n, either E A (a i , a i+1 ) ̸ = 0 or E A (a i+1 , a i ) ̸ = 0. For every eq-equivalence class A a (containing an element a), consider an induced ⋆-subgraph A a on the subset consisting of A a itself together with those b ∈ A 3 such that there exists c ∈ A a such that either E A (b, c) ̸ = 0 or E A (b, c) ̸ = 0. Below we will show that the image of every A a can only be contained in some T v xyz . Claim 6.3.12. If there is h :

A a H 2 , then h(A a ) ⊆ T v xyz for some T v xyz .
Proof of Claim 6.3.12. For any two elements a 0 , a n of the eq-equivalence class A a , there exists a sequence a 1 , . . . , a n-1 of elements of A a such that, for any 0 ≤ i ≤ n -1, one of E A (a i , a i+1 ) and E A (a i+1 , a i ) is not 0. As for all a ∈ A ∖ A 3 and for all h ′ : A H 2 , h ′ (a) ̸ ∈ H 3 , h(a 0 ), . . . , h(a n ) ∈ H 2 ∖ H 3 (by condition (3)). Then, by the condition 4, that is in H 2 any two elements w and w ′ belonging to different T v , T v ′ , E H 2 (w, w ′ ) = 0, we have that all h(a 0 ), . . . , h(a n ) are in the same T v . By the condition 1, we find in P-time for every A a the list of values v ∈ {0, 1, ⋆} such that A a maps to T v xyz . If A a ̸ T v xyz for any v, then there is no way that A can be mapped to H 2 and we reject this instance. Among all v such that A a T v , we label A a with the smallest possible such v with respect to ⪯ ⋆ . If A a maps to T v xyz for any possible v, then we say that A a is ∅-labeled. Introduce a new equivalence relation map(•, •) on the set A 3 , we say that map(a 1 , a 2 ) if there exists A a ∋ a 1 , a 2 and there is h : A a T v such that h(a 1 ) = h(a 2 ). By the condition 5, for any a 1 , a 2 ∈ A 3 such that map(a 1 , a 2 ): there is h : A H 2 ⇒ h(a 1 ) = h(a 2 ). Let us construct a new ⋆-graph A 2 based on A. Take the domain A 2 = A 3 /map and, for any (a 1 , a 2 , a 3 ) ∈ (A 2 ) 3 , add a gadget T v a 1 a 2 a 3 following the rules below. Consider A a labeled with v ̸ = ∅ such that for any element x ∈ H 3 (or y or z) of T v xyz there exists an A 3 -element a x of A a such that a x is mapped to x. In this case we substitute A a by T v axayaz for a x , a y , a z ∈ A 2 . Consider those A a labeled with v ̸ = ∅ where there exists an element x ∈ H 3 (or y or z) of T v xyz so that no element a x of A a maps to x. For such a case we add to A 2 a new element a Aa,x and substitute A a by T v for the corresponding 3 elements of A 2 . All the eq-equivalence classes A a labeled with ∅ are not substituted with anything in A 2 . The ⋆-graph A 2 is associated with a (∅, τ )-structure A 3 as follows: each triple a 1 , a 2 , a 3 of A 3 is either contained in T v a 1 a 2 a 3 or not. If yes, then we set

R A 3 (a 1 , a 2 , a 3 ) = v, if not, then R A 3 (a 1 , a 2 , a 3 ) = ∅. It is routine to check now that A H 2 if and only if A 3 H 3 .

Minimal Obstructions

We prove that the inclusion-minimal obstructions considered in [START_REF] Feder | Matrix partitions with finitely many obstructions[END_REF] coincide with finitary duality in Struct 01 . We also show that being characterised by a finite set of inclusion-minimal obstructions in Struct 01 is equivalent to be characterised by a finite set of inclusion-minimal obstructions in Struct ⋆ . The main results of this section are summarised in the following.

Theorem 6.4.1. Let H be a ⋆-structure. Then, the following are equivalent.

1. MP(H) has finitary duality.

2. Obs ⊂ 01 (H) is finite.

3. MP ⋆ (H) has finitary duality.

Obs ⊂

⋆ (H) is finite. Throughout this section, let τ = {R 1 , . . . , R p } be a fixed signature. We recall that, for * in {01, ⋆, ∅}, Struct * is the set of all ( * , τ )-structures.

Let us now recall the definitions of obstructions from [START_REF] Feder | Matrix partitions with finitely many obstructions[END_REF] and of finitary duality, that we extend to all structures. We prove that the inclusion-minimal obstruction set is finite if and only if there is a finite duality set. We also show how their finiteness depends on the category from which the input structures are taken. We summarise on the diagram below all the dependencies that we have proved. Every arrow of this diagram means the implication. G, and that G ̸ G 1 . Let G ′ = h(G 1 ) and let G ′ be the substructure of G induced by G ′ . If G ′ is a proper induced substructure of G, then by the assumption of inclusion-minimality, and by transitivity of homomorphism: G 1 H -a contradiction. Thus, h(G 1 ) = G, but since h is a full homomorphism, G is either a proper induced substructure of G 1 , which would contradict our assumption that G 1 is a core, or is isomorphic to G 1 , which would contradict the assumption that G ̸ G 1 . We can then conclude that Obs ⊂ 01 (H) contains no proper subsets that are duality sets for MP(H), which means that this duality set is a subset of any other duality set. Both G and G ′ belong to Obs ⊂ ⋆ (H) as H has an element x such that E H (x, x) = E G (u, u) = E G (v, v) and as G ̸ H and similarly G ′ ̸ H because they both have a ⋆-arc and H is a 01-graph. Also, G ′ G and G ̸ G ′ , so G can be removed from Obs ⊂ ⋆ (H) if it is a duality set. For and arbitrary signature τ the proof will be similar. Proof. If t and t ′ consist of elements of different two-element sets, then, by Lemma 6.6.4, we are done.

|Obs ⊂ 01 (H)| < ∞ |Obs ⊂ ⋆ (H)| < ∞ |Obs ⊂ ∅ (H)| < ∞ MP (
Suppose that t, t ′ belong to {w, x} 4 . By Lemma 6.6.4, s(t), s(t ′ ) belong to {w, x}. Suppose that t ⪯ t ′ and s(t) ̸ ⪯ s(t ′ ), that is, s(t) = x and s(t ′ ) = w. On one hand, E P (t ′ i , t i ) = 0, for any i in [4]. But E P s(t ′ , t) = E P (w, x) = 1 which contradicts s being a polymorphism. The proof for other tuples from {w, x} 4 ∪ {y, z} 4 is similar.

Suppose that, for t, t ′ in {x, y} 4 , we have t ⪯ t ′ . Let u and u ′ be obtained from t and t ′ by replacing each occurence of x with w and each occurence of y with x. Then we have u ⪯ u ′ , and, as they both belong to {w, x} 4 , we have s(u) ⪯ s(u ′ ). Suppose that s(t) ̸ ⪯ s(t ′ ); then, by Lemma 6.6.4, s(t) = y and s(t ′ ) = x. Then, s(u ′ ) = w and, consequently, s(u) = w. As 4 i=1 E P (u i , t i ) ̸ ⪯ ∅ E P s(u), s(t) , s is not a polymorphism.

Lemma 6.6.6. Let s be a Siggers polymorphism of P. Let t be a 4-tuple from {w, x} 4 ∪ {x, y} 4 ∪{y, z} 4 , where 3 out of 4 elements are equal to a, for some a in P . Then, s(t) = a.

Proof. Suppose that t is in {x, y} 4 . We are going to show that, if 3 out of 4 elements of t are equal to x, then s(t) ̸ = y, so it can only be mapped to x. Observe that it is sufficient to show that (x, y, x, x) does not map to y. Because, by Siggers property, s(x, y, x, x) = s(y, x, y, x) and, by Lemma 6.6.5, s(x, x, y, x) ⪯ s(y, x, y, x) and s(y, x, x, x) ⪯ s(y, x, y, x), and, by Siggers property, s(x, x, y, x) = s(x, x, x, y). See Figure 6.6 on page 156. Suppose that s(x, y, x, x) = y. Then, s(y, z, y, y) = z, as E P (x, y) = E P (y, z) = 1 and as (y, z) is the only 1-arc that goes from y. By Siggers property, s(z, y, y, z) = s(y, z, y, y) = z. Therefore, by Lemma 6.6.5, s(z, y, y, z) ⪯ s(z, y, z, z), so s(z, y, z, z) = z. But, E P (y, z) = 1 and E P (x, z) = E P (y, y) = 0, that contradicts the assumption that s is a polymorphism. We conclude that s(x, y, x, x) = x, and all other tuples from {x, y} 4 , where 3 out of 4 elements are equal to x, must be mapped to x. Similarly, all tuples of {x, y} 4 , where 3 out of 4 elements equal y, must be mapped to y. The proof for tuples from {w, x} 4 ∪ {y, z} 4 is similar.

For a set A, a ternary function f : A 3

A is called majority if, for any x, y in A, f(x, x, y) = f(x, y, x) = f(y, x, x) = x.

As an example, let A be equal to [n], and consider the ternary median function m : A 3 A that is defined as follows. Let x, y, z be three elements from A. Suppose that {x, y, z} = {a, b, c}, where a ≤ b ≤ c. Then m(x, y, z) is defined to be b.

Proof of Theorem 6.6.2. Consider two tuples t = (w, w, x, y) and t ′ = (x, y, w, w). Suppose that s is a Siggers polymorphism of P. By Lemma 6.6.4, s(t), s(t ′ ) belongs to {w, x, y}. Suppose that s(t) = x; then, by Lemma 6.6.6, s(w, w, x, w) = w, this is a contradiction to s being a polymorphism. Suppose that s(t) = y; then, by Lemma 6.6.6, s(z, z, z, y) = z, this is a contradiction to s being a polymorphism. Similarly, having s(x, w, w, w) = w and s(z, y, z, z) prevents s(t ′ ) from belonging to {x, y}. Thus, both these tuples must be mapped to w. If s(w, w, x, y) = w, then s(y, y, x, x) = y and, consequently, s(x, x, w, w) = x. On the other hand, we have s(x, y, w, w) = w, this contradicts to s being a polymorphism. So, any map s with Siggers property cannot be a polymorphism of P.

For any ⋆-graph H, the MP problem MP(H) can be reduced to the list matrix partition problem associated with H. For an input directed graph G of MP(H), do the following. Denote by G ′ the graph that is obtained from G by removing all the loops. For x in G, if E G (x, x) = 0, then the list L x consists of all h in H such that E H (h, h) = 0; if E G (x, x) = 1, then L x consists of all h in H such that E H (h, h) = 1. Then, we reduce G to G ′ with the family of lists L x | x ∈ G .

Let P -denote the directed path of length 4. P -has the median polymorphism m with respect to the ordering w < x < y < z on the set P = {w, x, y, z}. By Bulatov's characterisation for list-homomorphism problems from [START_REF] Bulatov | Tractable conservative constraint satisfaction problems[END_REF], having a majority polymorphism implies that the corresponding list-homomorphism problem is P-time solvable.

By Lemma 6.6.3, the list-matrix partition problem associated with P can also be solved in P-time, as the list-homomorphism problem is P-time solvable for P -. As MP(P) can be reduced to a P-time solvable problem, it is also P-time solvable.

Chapter 7 Conclusion

In this part we briefly summarize the main results of this thesis and discuss possible perspectives for further work. We explain our ideas quite informally.

Although the main objective of this thesis is to study the dichotomy question for extensions of MMSNP and CSP, we manage to solve it only for MMSNP with guarded inequalities, which happens to be P-time equivalent to MMSNP, and, thus, has a dichotomy. For each of the other classes that we have considered, this question still remains unanswered.

Regarding MMSNP 2 , we believe that one should study algebraic properties of ωcategorical CSP templates that are associated with MMSNP 2 sentences or, more broadly, with regular infinite MMSNP sentences. Maybe, there is a chance to apply the same methods as for MMSNP, see [START_REF] Bodirsky | A universal-algebraic proof of the complexity dichotomy for monotone monadic SNP[END_REF]. Apart from that, we also see some potential in constructing a right expander structure that can finish the reduction. It requires deep understanding of the construction properties that we want our expander to have. Results that we obtain in this thesis about infinite MMSNP and expander structures for MMSNP 2 , could be useful for proving a dichotomy for this class.

Speaking of Matrix Partition problems (MP), we do not think that it is possible to provide a PvsNP-complete characterization that uses polymorphisms, as in CSP. Because we provide a ⋆-graph with a tractable MP problem that has no Siggers polymorphism. This means that it has only trivial polymorphisms. The class MP is contained in MMSNP * that is a fragment of MonadicSNP. A dichotomy for MMSNP * would imply a dichotomy for MP as well. We do not think that the complexity of MP problems can be characterized by having some forbidden induced substructures, similarly as it is done for undirected graphs in [START_REF] Hell | On the complexity of H -coloring[END_REF]. Because MP extends CSP on digraphs, and CSP on digraphs is not characterized in this manner.

It makes sense to pose questions about "grey zone" classes that are similar to those that have already been studied on CSP. We have considered one such question on both MMSNP 2 and MP: is it possible to simplify the signature so that we can always assume only problems on directed graphs? In both cases, we only manage to show that we can consider, without loss of generality, signatures with a unique relation symbol. Though, it seems much harder to reduce the arity of this relation symbol. It is hard to be done for MP because this class does not have a notion for "nothing", which is similar to the "non-edge" notion in CSP. However, for MMSNP 2 it seems to be more doable as it is not clear what the obstacle is. It remains just to understand well the properties that we need from the directed graphs. These properties must be, in some sense, dual to the "balanced" property that is used for CSP. Because both MMSNP and MMSNP 2 classes are formulated dually with respect to CSP.

The question of containment of two MMSNP problems is also well-studied, see [START_REF] Florent | On the containment of forbidden patterns problems[END_REF]. It happens that SAT(Φ 1 ) is contained in SAT(Φ 2 ) if and only if we can replace existential relations σ 1 of Φ 1 with existential relations σ 2 of Φ 2 such that for any negated conjunct of Φ 2 there exists a more restrictive negated conjunct of the recoloured Φ 1 . The map from σ 1 to σ 2 is called a recolouring, it is used in the proof of the dichotomy theorem for MMSNP in [START_REF] Bodirsky | A universal-algebraic proof of the complexity dichotomy for monotone monadic SNP[END_REF]. For MMSNP 2 logic, it is easy to show that containment implies the existence of a recolouring. However, the other directions seems to be more complicated, the main obstacle is the existence of duplicated tuples.

For a complexity class, it is important to understand its relation with the first-order logic FO. This is done by characterizing the problems that are FO-definable. For example, see [START_REF] Atserias | On digraph coloring problems and treewidth duality[END_REF], for a finite relational structure A, CSP(A) is FO-definable if and only if CSP(A) has a finitary duality, i.e., there is a finite family D of structures such that, for any input structure B, we have B A if and only if ∀D ∈ D D ̸ B. This question can be asked for MP problems. This is the reason why we studied minimal obstructions for these problems. This question is unlikely to be solved for MP by a similar approach as it is done for CSP, because MP does not have a notion for "nothing". That is, by the same reason as it is hard to reduce the arity. away from unit interval graphs, for which the problem was still open. De Figueiredo et al. in [START_REF] Celina | Maximum cut on interval graphs of interval count four is np-complete[END_REF] made a very important advancement in this regard. They showed that MaxCut was NP-complete even when the total number of lengths used for the intervals was only 4, i.e. when the interval count of the graph was 4. In their paper, an extra gadget, resembling the vertex and edge gadgets, was used as a "joining gadget" between link intervals. Instead of having a link interval running through the entire length between its corresponding vertex and edge gadgets, they used a chain of link intervals joined to each other with the use of joining gadgets. A link chain is a sequence of link intervals with a join gadget between every two consecutive link intervals. Such a join gadget partially intersects only particular link intervals. The link intervals of all other link chains that intersect the join gadget, intersect it fully. The join gadgets ensure that in a maximum cut partition, the link intervals of every link chain are colored with red and blue alternately. Thus, link intervals of arbitrary lengths in the original reduction can be replaced by link intervals of a single size. However, one problem remained. Between consecutive vertex or edge gadgets, the link chains had their join gadgets in a fixed order. For example, consider vertex gadgets V i-1 , V i and V i+1 , and link chains L j-1 , L j and L j+1 (Fig. A.1. If in the gap between V i-1 and V i , the join gadget of L i-1 occurred first, followed by a join gadget each of L j and L j+1 respectively, then they would occur in the same order in the gap between V i and V i+1 . This would pose a problem if the structure of the graph required L j-1 and L j+1 to have a partial intersection with the same edge gadget. In such a case, a second type of link interval with a different length would be used to end link chain L j+1 early and enable it to partially intersect the same edge gadget along with L j-1 . Thus, their reduction needed intervals of two lengths for the vertex, edge and join gadgets, and another two lengths as the link intervals, totalling to an interval count of four.

L j-1 L j L j+1 V i-1 V i V i+1
In the present work, we bring the interval count by two due to our modifications in the structure of gadgets and link chains. Instead of using separate lengths of short and long intervals, the vertex, edge and join gadgets are now three consecutive cliques composed of intervals of the same length, with the middle clique being twice as large as the two other cliques. The link chains do not need two separate lengths of intervals anymore. The problem of non-consecutive link chains partially intersecting the same edge gadget is solved by using a switch gadget, which again is a sequence of cliques, that changes the relative positions of join gadgets of link chains. This brings the interval count down to two.

A.4 Overview of the reduction

We reduce MaxCut on cubic graphs to MaxCut on interval graphs of interval count two. For every cubic graph G, we construct an interval graph H of interval count 2 such that any MaxCut partition of G corresponds to some MaxCut partition of H. In this section, we provide basic information about the reduction.

Interval sizes We can use intervals of only two different sizes: short and long. Later, when we give an explicit proof, we assume that short intervals have length 1, and long intervals have length α, for some α > 1 that depends on the size of the input cubic graph.

Blocks A block is an interval model consisting of short intervals that start from and terminate at the same coordinates. It is usually denoted by a letter B. The size |B| of a block B is the number of intervals within it. We can without loss of generality draw blocks as squares. A block of size x is an interval model of the complete graph K x on x vertices. When an interval model contains several blocks, they can be linearly ordered. The ordering depends on the coordinates of the left ends of the blocks. Every gadget that we use is constructed from blocks.

Block coloring Consider any interval model consisting of blocks B 1 , . . . , B s , they are linearly ordered from the leftmost to the rightmost, say that B 1 is the leftmost and B s is the rightmost. Then we say that the coloring of the blocks is alternating if, for every i ∈ [s -1], B i and B i+1 are entirely in different classes, i.e., Color(B i ) ̸ = Color(B i+1 ). The coloring is almost alternating except for (B i , c) if there is a constant value c such that at most c intervals of the block B i have the same color as B i-1 and B i+1 and, for every j ̸ ∈ {i -1, i}, we have Color(B j ) ̸ = Color(B j+1 ).

Size of the reduction graph Before we formally describe the reduction graph H, we define all the gadgets that are used in the construction of H. It is convenient to prove the necessary properties of a gadget right after it is defined. Sometimes, for a property to hold, it is required that H satisfies certain numerical constraints. We list them now, and, when we explicitly construct H, we make sure that these constraints hold. Suppose that |V (G)| = n; then |E(G)| = 3n 2 .

1. The size of every block of H depends either on a parameter x (for vertex, join, and switch gadgets) or on a parameter k (for edge gadgets). It is required that x, k ∈ Ω(n 6 ).

2. For every block of H there are at most η := 3n long intervals that intersect it.

3. Every long interval of H intersects at most µ := 30n + 16 blocks. Also let y 1 , 2x -y 2 , and y 3 be the number of intervals of respectively B 1 , B 2 , B 3 that are colored blue. Hence x -y 1 , y 2 , and x -y 3 are the numbers of intervals of respectively B 1 , B 2 , and B 3 that are colored red. Now observe that 1. The number of cut edges formed between the blocks and the long intervals is r 1 y 1 + b 1 (x -y 1 ) + r 2 (y 1 + 2x -y 2 + y 3 ) + b 2 (2x -y 1 + y 2 -y 3 ) + r 3 y 3 + b 3 (x -y 3 ) + r 4 (y 1 + 2x -y 2 ) + b 4 (x -y 1 + y 2 ) + r 5 (2x -y 2 + y 3 ) + b 5 (y 2 + x -y 3 ).

A.5 3-blocks

2. The number of cut edges formed by the short intervals of the same block among themselves is y 1 (x -y 1 ) + y 2 (2x -y 2 ) + y 3 (x -y 3 ).

3. The number of cut edges formed by the short intervals of the different blocks is y 1 y 2 + (x -y 1 )(2x -y 2 ) + y 2 y 3 + (2x -y 2 )(x -y 3 ).

Denote the quantity r i -b i by ∆ i . Therefore the number of cut edges, denoted by C, contributed by the 3-block B is:

C =4x 2 + x(2r 2 + 2r 4 + 2r 5 + b 1 + 2b 2 + b 3 + b 4 + b 5 )-
-xy 1 -xy 3 -y 2 1 -y 2 2 -y 2 3 + 2y 1 y 2 + 2y 2 y 3 + + ∆ 1 y 1 + ∆ 2 (y 1 -y 2 + y 3 ) + ∆ 3 y 3 + ∆ 4 (y 1 -y 2 ) + ∆ 5 (y 3 -y 2 ).

A.6 Gadgets

After defining a 3-block and showing how it is colored under a MaxCut partition, we can use it to construct different gadgets of the reduction graph H. For each gadget that we introduce, we state in a corresponding lemma how it can be colored under a MaxCut partition of H. For gadgets that are based on 3-blocks, these lemmas follow from Lemma A.5.1 and from the gadget construction. Although there is a gadget whose construction is not based on 3-blocks, the lemma that describes its MaxCut partition within H is proved using methods similar to Lemma A.5.1.

Vertex gadget

The interval model of a vertex gadget consists of three 3-blocks and two short intervals: V := B 1 ⊔ B 2 ⊔ B 3 ⊔ {S 12 , S 23 }. The blocks B i 1 , B i 2 , B i 3 of each 3-block B i have sizes x, 2x, x correspondingly, for some x > 0. The 3-blocks are connected by short intervals S 12 , S 23 , they are called short link intervals. There are three long intervals L 1 , L 2 , L 3 adjacent to a vertex gadget, they start from B 1 3 , B 2 3 , B 3 3 , where, for each i in [3], B i 3 is the rightmost block of B i . Under any MaxCut partition, the coloring of each 3-block of a vertex gadget is almost alternating. Moreover, each pair of blocks that are connected by a short link interval must have the same color, and the short link interval must have the opposite color. The colors of L 1 , L 2 , L 3 are opposite to the colors of blocks from which they start. An optimal coloring of a vertex gadget, under a MaxCut partition, is displayed on Figure A.3. We prove this in Lemma A.6.1.

Lemma A.6.1. Let V be a vertex gadget of H (see Figure A.3). Then, in a MaxCut partition of H, the two following statements hold:

1. for all i ∈ [3], all the intervals of the blocks B i 1 and B i 3 belong to the same class, and 2. the intervals of each of the blocks B 1 2 , B 2 2 , and B 3 2 , except for at most η intervals within each block, belong to the other class, as well as S 12 and S 23 . Proof. By Lemma A.5.1, for i ∈ [3], B i must be almost alternating except for η intervals in B i 2 .

greater than ∆x + 11 16 ∆ 2 , as x > ∆ 2 , it is easy to choose a convenient value for x ′ . For such x ′ , we will have |z 4 -z 5 |, |z 5 -z 6 | < ∆.

Denote The same is true for |d 34 |. We now can imply that |y 1 -y 4 | < 9∆, otherwise the cut is not maximal. This is an important result because we can show now that all the blocks except for y 1 , y 4 are monochromatic. Take any x > 9 2 ∆ 2 + 11 16 ∆ 2 = 83 16 ∆ 2 , then suppose that for some variable except for y 1 , y 4 , say z 1 for example: z 1 ̸ ∈ {0, x}. Then (x -z 1 )z 1 ≥ x -1 > 9 2 ∆ 2 + 11 16 ∆ 2 . So the cut will not be maximal in this case. Same is true for any variable other than y 1 , y 4 . So we can conclude that 2z 1 = z 2 = . . . = z 8 = 2z 9 ∈ {0, 2x}, and y 2 = y 3 ∈ {0, 2x ′ }.

Suppose without loss of generality that all the variables except for y 1 , y 4 are equal to 0. Then Cut -Cut alter equals -(y 1 -∆/4) 2 -(y 4 + ∆/4) 2 + ∆ 2 (y 1 -y 4 ) + ∆ 2 8 = -y 1 (y 1 -∆) -y 4 (y 4 + ∆).

One can see now that the cut will be optimal if y 1 = ∆/2, y 4 = 0 for ∆ > 0. For the case when ∆ < 0 the optimal cut will be when y 1 = 0 and y 4 = -∆/2. Recall that η denotes the total number of long intervals. As ∆ = (r -b), we have |∆/2| < η.

A.7 Reduction

After describing each gadget of H we can go one level higher and explain how they are positioned in the graph. We first consider an operation that is used many times in H, the switch procedure. It allows to change the relative positions of two long interval chains. If we need to connect two chains to the same edge gadget and if there are other chains between these two, then this procedure becomes extremely helpful. Further, we provide the explicit construction of H and, at the end, prove Theorem A.1.1. Say that a gadget is in the fragment [a, b] of some zone if its leftmost and rightmost points are in a and b. We are going to show that no gadgets intersect each other by considering each of nine buffer zones on Figure A.9.

1. The first buffer does not contain any gadgets.

2. The second buffer intersects two stretch gadgets. The blue one is in [0, 32] of Zone(i)

and in [0, 3] of Buffer(i, i + 1). Its long intervals terminate at {0, 4, 8} of Zone(i) and start from {3, 7} of Zone(i) and from 3 of Buffer(i, i + 1). The red one is in [4, 21] of Buffer(i, i + 1) and in [0, 11] of Zone(i + 1). Its long intervals terminate at {0, 4, 8} of Zone(i + 1) and start from 6.5 of Buffer(i, i + 1) and from {3, 7} of Zone(i + 1).

3. The third buffer contains the first switch gadget in [0, 9]. Its long intervals terminate at {0, 3.5} and start from {5.5, 9} of Buffer(i, i + 1). It also contains the red stretch gadget in [10, 21] of Buffer(i, i + 1) and in [0, 7] of Zone(i + 1). Its long intervals terminate at {0, 4} of Zone(i + 1) and start from 12.5 of Buffer(i, i + 1) and from 3 of Zone(i + 1). 9. The ninth buffer is empty.

Observe that the distance between any two ends of long intervals is always at least 2.5 if one end is left and the other is right, and is at least 3. Lemma A.6.3 allows us to do this. This is the end of the switching procedure.

Construction of H Let G be a cubic graph of size n. Let the long interval length to be α := 53n -3. All the intervals of H are going to be inside [0, +∞). This ray is split into zones and buffers in the following order: Zone(1), Buffer(1, 2), Zone(2), Buffer(2, 3), . . . , Zone(n), Buffer(n, 1), Zone(1), . . . For i ∈ [n], put a vertex gadget V i into the leftmost fragment of Zone(i). For each V i there are 3 long intervals starting from it; they terminate at a join gadget that has 3 new long intervals starting from it. This produces 3 chains of long intervals. Each such chain eventually terminates at some edge gadget.

For every edge g i g j ∈ E(G), where i < j, we choose a chain starting from V i and repeatedly apply the switch procedure to this chain until it is in Zone(j). Once it happens, this chain of V i and one of the chains of V j terminate at the same edge gadget E ij . No long interval starts from E ij . Then we choose another edge of G and repeat this operation until all edges of G are treated. If a chain does not participate in some switch procedure, then, during this procedure, the long intervals of this chain are joined by join gadgets that look the same as vertex gadgets. The composition of H is displayed on Figure A.10.

• 2ηl -the cut between the long intervals of H intersected by the intervals of the chain;

• η 2 l -the cut between the gadgets of the chain and the long intervals of H overlapping them (the number of gadgets in the chain also equals l).

As η, µ ∈ O(n), and l ∈ O(n 2 ), the loss is in O(k + n 4 ). We are free to choose x to be large enough for the gain to be strictly greater than the maximal possible loss. Thus, for such value of x, the second condition also holds.

A good partition p : V (H) {R, B} corresponds to some partition q : V (G) {R, B}: assign to a vertex g i ∈ V (G) the same color that is assigned to the chains starting from the vertex gadget V i . For such p and q, we will write p ∼ q. Clearly, the other direction is also true: for every q : V (G) {R, B} there exists a good partition p such that p ∼ q.

Lemma A.7.2. Let p : V (H) {R, B} be a MaxCut partition of H, and q : V (G) {R, B} be the corresponding partition of G, i.e., p ∼ q. Then q is a MaxCut partition of G.

Proof. Suppose that q is not a MaxCut partition, that is, there is another q ′ : V (G) {R, B} which is maximal. Let p ′ : V (H) {R, B} be a good partition that satisfies p ′ ∼ q ′ .

For simplicity, we denote by E the set of intervals that belong to edge gadgets, and C denotes the set of intervals that belong to chains or to other gadgets. Clearly, V (H) = C ⊔ E.

The difference between the cut values of p and p ′ , for edges induced by E, is at most η 3 ∈ O(n 3 ) because there are η 2 edge gadgets, and each of them changes the cut by at most 2η 2 . The difference between the cut values, for edges induced by C, is at most

η 2 • 10 • l • η within each gadget + η • l • η between long intervals + 2η • µ • l • η
between gadgets and long intervals which belongs to O(n 5 ). Finally, as q ′ has a strictly greater cut value that q, we know that the number of cut edges between C and E for p ′ is greater than the corresponding number for p by at least (k -2η) -η • 2η • η 2 , by Lemma A.6.2 and because an edge gadget is overlapped by at most η long intervals, each of them adds at most 2η to the cut, and there are η 2 edge gadgets. As we choose k to be in Ω(n 6 ), the cut for p ′ is greater than the cut for p, it is a contradiction. Lemma A.7.2 implies Theorem A.1.1.

7A. 3

 3 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.4 Overview of the reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . A.5 3-blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.6 Gadgets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.7 Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

NP

  Figure 1.1: An illustration of complexity subclasses of NP assuming that P ̸ = NP.

Figure 1 . 2 :

 12 Figure1.2: An illustration of complexity classes with respect to having a dichotomy. An arc going from a class C 1 to a class C 2 means that C 2 ⊆ p C 1 -for every problem of C 2 , C 1 contains a P-time equivalent problem. This implies that, if C 1 has a dichotomy, then so does C 2 . If a class C 1 is below a class C 2 and if there is an edge between C 1 and C 2 , then C 1 is a subclass of C 2 .

Figure 2 . 4 :

 24 Figure 2.4: The trajectory of the head movement of M o .

Figure 2

 2 Figure 2.5: A move of the head of a machine M is simulated by a walk of the head of the corresponding oblivious machine M o .

Figure 2 . 6 :

 26 Figure 2.6: Description of the M o simulation when the head of M is at the first cell.

Figure 2

 2 Figure 2.7: A graphical representation of formulae that set the Initial relation on the first row of the grid. Arcs with black heads are succ, arcs with white heads are next, dashed closed curves are betweentriples, red squares are start elements, small white circles are Initial elements, large white circles are Head elements. Relations s and S are implicit.

  y is the first element of the tape. If y, z are Marked, then y ′ has to be Marked.

  The general case, when y is in the middle of the tape. If x, y, z are Marked, then y ′ has to be Marked.

Figure 2 . 8 :

 28 Figure2.8: All the four cases when an element y ′ is forced to become Marked. All the elements are required to be pairwise distinct, using ̸ =. Black-headed arcs are succ. White-headed arcs are next. Dashed closed curves are between. Small white discs are Marked elements.

Figure 2

 2 Figure2.9: A graphical representation of the formulae that describe the transition of M o . Horizontal black-headed arcs are succ. Vertical white-headed arcs are next. Dashed closed curves are betweentuples. Small white circles are Marked elements. Medium white circles are Head elements. Large squares are existential symbol relations S. If two squares on the same figure have the same colour, then they are associated with the same relation. There is a letter h near the square if and only if the corresponding symbol has the h-superscript. A square with ▷ is associated with the first symbol relation ▷(•). Squares with ⊔, ⊔ ′ are relations corresponding to the blank symbol that highlights the end of the tape and to the blank symbol that can be written in the middle of the tape. Large circles stand for the state relations. If two circles have the same colour, then they are associated with the same relation. A letter w near the circle means that the head is in a state of the type q i j(write) . Symbols ⇐ and ⇒ near circles denote the direction of the walk. A symbol ⇒ between structures means that the left structure represented as the conjunction of all the corresponding atomic formulae implies any atomic formula that is present on the right structure and absent on the left. Symbols ∨ • • • ∨ mean that the structure on the left implies one of the structures on the right.

  Lemma 2.3.4. Let L(M o ) be the set of tapes accepted by M o . Then the problem L(M o ) reduces in P-time to SAT(Φ).

Figure 2 .

 2 Figure 2.10: An example of the grid that is associated with the tape of M o . The horizontal arcs are succ, the red square element is the start. All tuples of the relation between and the symbol relations s(•) are not drawn in order to make the figure look less complex.

Figure 2 .

 2 Figure 2.11: The colouring of the grid from Figure 2.10 with the predicates Marked (small white circles) and Head (large white circles).

N

  Figure 2.13: The substructure of A induced on C m . The red square is start, horizontal arcs are succ, vertical are next. White circles with black boundaries are the elements of C h . White circles with red boundaries are the elements of B ∖ C h . Thick red line highlights the moment of time when the execution of M o stops. There cannot be an element of B ∖ C h above this red line. The region where they could be is highlighted with grey.

  the relation R contains just one tuple b R , and any other relation is interpreted as the empty set.

Figure 3 . 4 :

 34 Figure 3.4: The original τ -structure A is on the left. The corresponding τ 1 -structure A 1 is on the right.

Figure 4 . 1 :

 41 Figure 4.1: The relation between τ -tuples and τ -tuples. The long closed curves are the relations R and R, the green disc is the relation T , the white circles denote the relation V.

Figure 4 . 2 :Figure 4 . 3 :

 4243 Figure 4.2: The two additional negated conjunct that are added to Φ. The green disc is the T relation. The white circle is the V relation. The blue disc is the X relation corresponding to some X in σ T . The grey disc with the black boundary is the M relation corresponding to some M in σ V .

  Construction 9 induces a functor D :Struct[τ ⊎ σ] Struct[τ ⊎ σ]between the categories of (τ ⊎σ)-structures and (τ ⊎ σ)-structures such that, for any A in Struct[τ ⊎σ], D(A) is equal to Ã.

  Proposition 4.1.3. There exists a functor D between the categories Struct[τ ⊎ σ] and Struct[τ ⊎ σ]. Proof. For an object A in Struct[τ ⊎ σ], we put D(A) := Ã. For an arrow h : A B in Struct[τ ⊎ σ], we put D(h) := h, as in Proposition 4.1.2.

Figure 4 . 4 :

 44 Figure 4.4: The directed 3-cycle and its homomorphic images.

Figure 4 . 5 :

 45 Figure 4.5: The five types of negated conjuncts that are added to Φ. The green disc is the T -relation. The white circle is the V-relation. The closed curves are the R-tuples. The grey and orange discs with black boundaries are any two different σV -relations. The blue and yellow discs are any two different σT -relations.

  Figure 4.5 on page 85. Thus, by Proposition 4.1.1, we have à |= Φ if and only if à |= Φ′ .

Figure 4 . 6 :

 46 Figure 4.6: The forbidden structures of the No-Monochromatic-Triangle problem.

Figure 4 . 7 :

 47 Figure 4.7: The forbidden structures of the No-Monochromatic-Arc-Triangle problem. The heads of arcs highlight the arc colours: B (black) and W (white).

Figure 4 . 8 :

 48 Figure 4.8: All oriented odd cycles of length 3, 5, and 7.

  eq

Figure 4 . 9 :

 49 Figure 4.9: The eq relation (marked with red edges) and a pair of duplicated tuples.

Figure 4 .

 4 Figure 4.10: An illustration of the construction of F 1 . Grey dots are Old vertices. Small circles are eq-equivalence classes. Red lines are tree edges.

Figure 4

 4 Figure 4.11: Suppose that F is a triangle (e.g. C 3 ). Its D-image F is as on the left. There are two ways to represent the structure F• : as in the middle and as on the right. In the middle, yellow zones between two arcs highlight pairs of duplicated R-tuples, and, for convenience, T -vertices are not displayed in the middle. However, the figure on the right contains T -vertices, they are denoted by green disks. The relation Old is marked on both figures with grey disks. Red, green and black dots inside white circles represent σV -coloured V-vertices.

Figure 4

 4 Figure 4.12: An example of new structure creation for F F . Yellow and blueish zones highlight pairs of duplicated R-tuples. Coloured dots highlight the sets of V-vertices that have the same σ-colour.

FigureFigure 4

 4 Figure 4.13: Duplicated tuples in G are associated with edges of T f .

FigureFigure 4

 4 Figure 4.14: We assign to every edge of T f the number i of [k] representing the position of v and w in y and z, and we also assign the tuple of σ-relation symbols that colour (t, y) and (t, z).

Figure 4

 4 Figure4.15: Tree families T F• , T G1 and T G2 . For simplicity, the labels are expressed with single letters u, v, x, y. In particular, a vertex in [x] eq that has an edge to a vertex in [y] eq has label y instead of xy.

Figure 4

 4 Figure 4.16: Examples of a piece and of not a piece.

Figure 4 . 17 :

 417 Figure 4.17: An example of the ⊕ operation.

FFigure 4

 4 Figure 4.19: An example of a structure and its label graph.

Figure 4 .

 4 Figure 4.20: Two not connected pairs of subsets of vertices and semiedges of the Petersen graph and one connected pair.

Figure 4 .

 4 Figure 4.21: An example of a piece alike family for a structure G in F F .

Figure 4 . 22 :

 422 Figure 4.22: The procedure of Construction 12.

Figure 5 . 1 :

 51 Figure 5.1: On the left, there is the original τ -structure A. In the middle, there is its D-image Ã. On the right, there is the F-image of Ã. Green disks are T -vertices, white disks are V-vertices. Closed curves are ρ-relational tuples.

Figure 5 . 2 :

 52 Figure 5.2: On the left, there is a τ -structure A. On the right, there is the F-image of A. Green disks are T -vertices, white disks are V-vertices. Closed curves are ρ-relational tuples.

Figure 5 . 3 :

 53 Figure 5.3: On the left there are three ρ-tuples. They are replaced by the corresponding τ -reducts that have here the form of a triangle. The result, on the right, contains (in the center) an implicit triangle.

Figure 5

 5 Figure 5.4: An illustration of the construction of the structure S ′ from Lemma 5.1.4. Red and blue edges highlight cycles that appear in S ′ .

Figure 5

 5 Figure 5.5: The τ -reducts of the forbidden structures corresponding to Φ.

  Figure5.6: On the right, T Φ consists of 12 vertices, two S 6 -tuples, that are associated with 3-cycles and a S 4 -tuple that is associated with the only allowed 2-cycle. Any vertex t in T Φ is associated with some M t in σ, the subscripts are highlighted. On the left, a ρ-structure S is similar to T Φ, but in S two S 6 -tuples share a T -vertex zx, when in T Φ there are two distinct ca, ca ′ . Implicit R-tuples are highlighted with dotted arcs.

Figure 5

 5 Figure 5.8: Two triangles share an arc.

Figure 5 . 9 :

 59 Figure 5.9: An implicit □-tuple contained on Figure 5.8.

Figure 5 .

 5 Figure 5.10: An example of a ρ-structure. The red ρ-tuples (triangles) highlight a tuple-cycle of the minimal length.

Figure 5

 5 Figure 5.11: A counterexample for the V-vertex expander strategy.

Figure 5 .

 5 Figure5.14: Five cases how the (i + 1)the tuple can touch the ith tuple if the (i -1)th and the ith tuples intersect by a T -vertex. Light blue zones between two implicit edges mean that they are duplicated.

Figure 5 .b

 5 Figure5.15: Three cases how the (i + 1)the tuple can touch the ith tuple if the (i -1)th and the ith tuples intersect by a V-vertex. Light blue zones between two implicit edges mean that they are duplicated.

Figure 5 . 17 :

 517 Figure 5.17: An example of a graph G whose triangle graph T G is a clique.

Figure 6

 6 Figure 6.1: An example of a ⋆-graph H.

2 LFigure 6 . 2 :

 262 Figure 6.2: The graphs from Example 6.1.2.

  Feder and Hell's definition requires more expressivity from logical sentences that describe their problems, as they have to use inequalities. When, at the same time, our definition does not have this constraint. In Example 6.1.3, we construct MonadicSNP sentences that describe both problem variations about the same ⋆-graph. Example 6.1.3. Let H be a ⋆-graph with the 2-element domain: H = {a, b}, and with E interpreted as follows: E H (a, a) = E H (a, b) = 0, E H (b, b) = 1, and E H (b, a) = ⋆. Then the corresponding Matrix Partition problem of Feder and Hell can be formulated by the sentence:

Figure 6 . 3 :

 63 Figure 6.3: The Hasse diagram of (P * , ⪯ * ).

  Proposition 6.2.4. Let A * , B * be two ( * , τ )-structures, and A CSP , B CSP be the relational structures that are obtained by Construction 17. Then, B * A * if and only if B CSP A CSP . Proof. Let h : B A be a mapping between the domains. Pick some R-tuple b, it is mapped to h(b). Suppose that R B * (b) = l. By construction, we have b ∈ R B CSP l ′ , for any l ′ ⪯ * l. Also, by construction, R A * h(b) ⪰ * l if and only if h(b) is contained in R A CSP l ′

  Corollary 6.4.3. |Obs ⊂ 01 (H)| < ∞ if and only if MP(H) has finitary duality. The result of Proposition 6.4.2 does not hold on Struct ⋆ . Proposition 6.4.4. For any 01-structure H, Obs ⊂ ⋆ (H) is not a duality set of minimal size. Proof. Pick some vertex x in the domain H of H. Consider a ⋆-graphG = ({u, v}, E G ) with E G (u, u) = E G (v, v) = E H (x, x) and E G (u, v) = E G (v, u) = ⋆. Also consider a ⋆-graph G ′ obtained from G by setting E G ′ (v, u) = 0,and keeping the rest as in G, see Figure6.4.

Figure 6

 6 Figure 6.6: The Hasse diagram of the ⪯-ordering of {x, y} 4 . Dotted closed curves highlight those tuples that are mapped to the same element by a Siggers polymorphism.

Figure A. 1 :

 1 Figure A.1: Link chains between consecutive vertex gadgets.

A 3 -

 3 block is an interval model consisting of three blocks B 1 , B 2 , B 3 such that |B 1 | = |B 3 | and |B 2 | = 2|B 1 |. Every interval of B 1 intersects every interval of B 1 ⊔ B 2 and no interval

  Now let us modify the cut by making Color(B 1 ) = Color(B 3 ) = R and Color(B 2 ) = B. This means that we have y 1 = y 2 = y 3 = 0. So the number of cut edges, denoted by C RBR , contributed by the 3-block B in this case is:C RBR = 4x 2 + x(2r 2 + 2r 4 + 2r 5 + b 1 + 2b 2 + b 3 + b 4 + b 5 ).If we instead have Color(B 1 ) = Color(B 3 ) = B and Color(B 2 ) = R (i.e., y 1 = y 3 = x, y 2 = 2x), then the number of cut edges, denoted by C BRB , contributed by the 3-block B would be:C BRB = 4x 2 + x(r 1 + 2r 2 + r 3 + r 4 + r 5 + 2b 2 + 2b 4 + 2b 5 ).Without loss of generality, assume that C RBR ≥ C BRB . This implies thatC RBR -C BRB ≥ 0 =⇒ ∆ 1 + ∆ 3 -∆ 4 -∆ 5 ≤ 0.Since we have only modified y 2 , the difference in cut sizes of these two cuts is:C -C RBR = -y 2 (y 2 + r 2 -b 2 + r 4 -b 4 + r 5 -b 5 )Since y 2 > b 2 + b 4 + b 5 , we conclude that C -C RBR < 0, which contradicts C being a maximal cut. Hence y 2 < b 2 + b 4 + b 5 < η.

Figure

  Figure A.3: A vertex gadget interval model.

Figure A. 9 :

 9 Figure A.9: The switch procedure. Blue and red fragments correspond to Zone(i) and Zone(i + 1). Grey fragment is Buffer(i, i + 1) between these zones. Black fragment contains all other zones and buffers. One should read this figure from left to right and from top to bottom, like a book.

Choose the interpretation for the relation symbol Marked in A to consist exactly of the elements from A ′ | Marked . By definition, it satisfies both conditions θ 1 and θ 2 . All other conditions of Φ ′ are applied only to Marked elements. All of them are satisfied in A ′ | Marked , so they are also satisfied in A ′ .

  Then we have A ′ |= Φ ′ if and only if A ′ | Marked |= Φ ′ , where Φ ′ is as in Construction 2. Proof. Lemma 2.2.1 states that every SNP-sentence is closed under embeddings. This means that A ′ | Marked |= Φ ′ if A ′ does. Suppose now that A ′ | Marked |= Φ ′ . Let Φ in MMSNP ̸ = and Φ ′ in MonotoneSNP be as in Construction 2. Then SAT(Φ ′ ) reduces to SAT(Φ).

	Lemma 2.2.4.

  the number of equivalence classes of this relation. Observe that every n-tuple x is associated with exactly one equivalence relation ∼ k on the set [n] such that x i = x j if and only if i ∼ k j. If ∼ k is associated with x then we say that this tuple has equivalence type k. For every equivalence class {x c 1 , . . . , x c l } of an equivalence relation ∼ k , denote it by [c] ∼ k , where c = min{c 1 , . . . , c l } -the smallest number of this set. Then, introduce a linear ordering ≺ k on the set [n]/ ∼ k by setting

  f ), for any tuple f in R F τ .

	Example 4.3.2. The No-Monochromatic-Arc-Triangle is an MMSNP 2 problem. It
	was considered before, in Example 3.2.2 and Example 4.2.1. It is also an FPP 2 problem,
	defined by the family of forbidden structures displayed on Figure 4.7 on page 88.

△

Every FPP 2 problem is associated with an MMSNP 2 sentence in normal 1 form.

Proposition 4.3.3. Let Φ be an MMSNP 2 sentence in normal 1 form. Then there exists a family of triples F 2 such that SAT(Φ) and FPP 2 (F 2 ) are the same problem.

  more natural to generalise according to our definition. It is natural when a relational structure has a relational tuple of the form R(x, . . . , x). It is not clear why we should omit all structures with such tuples. Apart from that, we show, see Section 6.3.2, that without loss of generality we can consider only classes MP σ , where σ consists of a unique relation symbol. The techniques used in the proof cannot be applied to show a similar result for problems where input structures contain no tuples of the form R(x, . . . , x).Remark. It is not known if these two definitions are give P-time equivalent classes of problems. It can be shown that any problem MP(H) can be reduced to a list matrix partition problem with the matrix M, where M is a |H| × |H|-matrix such that, for any i, j in [|H|], M[i, j] = E H (h i , h j ). This implies that if a list matrix partition problem is P-time solvable, then the corresponding MP problem is also P-time solvable.

  otherwise it is equal to 0.By construction, there exists a surjective homomorphism π : G 01 G such that for all g ∈ G, π(V g ) = g. If there exists a homomorphism h : G H, then, by transitivity, h • π : G 01 H will be a homomorphism. Suppose that there exists a homomorphism h 01 : G 01 H. By pigeonhole principle, for every V g , there is a set of size at least |Vg|

m elements of V g that are mapped by h 01 to the same element of H, and let us call it A g ⊆ V g , for each g ∈ G. Let us define a map h : G H with h(g) = h 01 (A g ). Now, for every two elements g 1

  where A g is identified with the set {i ∈ [2 k ] | v g,i ∈ A g }. One checks easily that there are subsets B 1 of A g 1 , and B 2 of A g 2 , that do not intersect and both of size at least |Vg| {R 1 , . . . , R p } a signature, with k i the arity of R i , for i ∈ [p]. We recall that MP τ (H) trivially reduces to MP τ ⋆ (H) as it is the same problem, but with restricted inputs.

	2m . Observe that
	|V g | 2m	≥	4m 2 + 1 2m	≥	√	4m 2 + 1.
	By Lemma 6.3.3, the submatrix H 2

k [B 1 , B 2 ] is not monochromatic. This means that E H h(g 1 ), h(g 2 ) = ⋆ and h is a homomorphism from G to H, and we are done.

Let us now prove the general case. Let τ =

  x k 1 ). CSP H CSP . By the ppdefinability in eq. (6.4) and Theorem 6.3.4, we construct a relational τ CSP -structure B CSP such that G CSP H CSP if and only if B CSP A CSP . From B CSP we obtain a (⋆, τ )structure B ⋆ such that B CSP A CSP if and only if B ⋆ A ⋆ . Observe that, because G ⋆ is a ⋆-graph, in G CSP for any (x, y) ∈ G 2 , we have either E G CSP CSP any relation other than R 1 is interpreted trivially and for each tuple x

	0	(x, y) = 1 or E G CSP 1	(x, y) = 1;
	thus in B
			(6.4)

Now consider any ⋆-graph G ⋆ . Every ⋆-graph is also a ∅-graph, so there is a relational γ CSP -structure G CSP such that G ⋆ H ⋆ if and only if G

  structure, that finishes the reduction from MP ⋆ (H ⋆ ) to MP τ ⋆ (A ⋆ ). For the other direction, consider any (⋆, τ )-structure B ⋆ . Similarly, we construct a relational τ CSP -structure B CSP , and by the pp-definition in eqs. (6.2) and (6.3), we can compute a relational γ CSP -structure G CSP such that G CSP H CSP if and only if B ⋆ A ⋆ , and then a ⋆-graph G ⋆ such that B ⋆ A ⋆ if and only if G ⋆ H ⋆ . With similar arguments as in the other direction, we can prove that G ⋆ is indeed a ⋆-graph. We have then shown that MP ⋆

  . For two elements w, w ′ ∈ H 2 such that w, w ′ / ∈ H 3 and w, w ′ do not belong to the same T v xyz , then E H 2 (w, w ′ ) = 0.

one can decide in time polynomial in |A| which elements of A can only map to the elements of H 3 . That is, we can decide, for every x ∈ A, if any h : A H 2 , implies that h(x) ∈ H 3 ⊂ H 2 . Also, for every x ∈ A, either any homomorphism from A H 2 maps x to H 3 , or any homomorphism from A H 2 maps x to H 2 ∖ H 3 . 4

  Definition 24 ([START_REF] Feder | Matrix partitions with finitely many obstructions[END_REF]). Let * be in {01, ⋆, ∅} and let H be a ⋆-structure. A * -structure G is called an inclusion-minimal obstruction for MP * (H) if G ̸ H and for all v in G, G ∖ {v} H. The set of all obstructions for the problem MP * (H) is denoted by Obs ⊂ Definition 25. Let * be in {01, ⋆, ∅} and let H be a ⋆-structure. We say that a set F of

* (H). * -structures is a duality set for the problem MP * (H) if

G / ∈ MP * (H) ⇐⇒ F G, for some F ∈ F.

If, moreover, the set F is finite, we say that MP * (H) has finitary duality.

  We start iteratively removing arbitrary elements from A until the substructure induced on the elements of the rest is an inclusion-minimal obstruction, i.e., if we remove any element, then the resulting structure will map to H. Such a substructure belongs to Obs ⊂ 01 (H) and maps to A, thus, Obs ⊂ 01 (H) is a duality set. Let F be a duality set for MP(H) such that |F| ≤ |Obs ⊂ 01 (H)|. We can assume without loss of generality that F ⊆ Obs ⊂ 01 (H): any F in F has an induced substructure that belongs to Obs ⊂ 01 (H), so we can substitute F with this substructure. Let G be in Obs ⊂ 01 (H). G is a core, otherwise it contains a proper induced substructure that does not map to H, a contradiction. Assume now that there exists G 1 in Obs ⊂ 01 (H) such that there is a homomorphism h : G 1

	H) has f.d.	MP ⋆ (H) has f.d.	MP ∅ (H) has f.d.
	Let us first prove that on Struct 01 the inclusion-minimal obstruction set is also a
	duality set.
	Proposition 6.4.2. Obs ⊂ 01 (H) is a duality set for MP(H). Moreover, among all duality sets, Obs ⊂ 01 (H) is the minimal one by inclusion.

Proof. Let A ̸ H.

  d 12 = y 1 -y 2 and d 34 = y 3 -y 4 . Then y 1 -y 4 < |d 12 | + ∆ + |d 34 |. Then we can choose only those d 12 , d 34 that satisfy-(d 12 -z 4 + z 5 -∆/4) 2 -(d 34 + z 5 -z 6 -∆/4) 2 + ∆ 2 (|d 12 | + ∆ + |d 34 |) + 11 16 ∆ 2 > 0as, otherwise, it will not be a maximal cut. Denote w = -z 4 + z 5 -∆/4, w ′ = z 5 -z 6 -∆ 4 , we know that |w|, |w ′ | ≤ 5∆/4. Then the expression can be written in the following form:-d 2 12 + 2d 12 w -w 2 -d 2 34 + 2d 34 w ′ -w ′2 + ∆/2(|d 12 | + |d 34 |) + Take |d 12 | ≥ 4∆. Then -(d 12 -w -∆/4) 2 -(d 34 -w ′ -∆/4)

									19 16	∆ 2 > 0 ⇒
	⇒ -(d 12 -w -∆/4) 2 -(d 34 -w ′ -∆/4) 2 +	∆ 2	(|w| + |w ′ |) +	2∆ 2 16	+	19 16	∆ 2 > 0.
					2 +	∆ 2	(|w| + |w ′ |) +	2∆ 2 16	+	19 16	∆ 2 ≤
	≤ -	5∆ 2	2	+	5∆ 2 4	+	21∆ 2 16	< 0.

  4. The fourth buffer contains the second switch gadget in [6, 15]. Its long intervals terminate at {6, 9.5} and start from {11.5, 15}. It also contains the second part of the first switch gadget in [2.5, 5.5]. Its long intervals terminate at 2.5 and start from 4.5. It also contains a red stretch gadget in [16, 21] of Buffer(i, i + 1) and in [0, 3] of Zone(i + 1). Its long intervals terminate at 21 and start from 18.5 of Buffer(i, i + 1). 5. The fifth buffer contains the second part of the second switch gadget in [8.5, 11.5]. Its long intervals terminate at 8.5 and start from 10.5. It also contains the third switch gadget in [12, 21]. Its long intervals terminate at {12, 15.5} and start from {17.5, 21}. It also contains a red join gadget in [1.5, 4.5]. Its long intervals terminate at 1.5 and start from 4.5. 6. The sixth buffer contains a blue join gadget in [18, 21]. Its long intervals terminate at 18 and start from 21. It also contains the second part of the third switch gadget in [14.5, 17.5]. Its long intervals terminate at 14.5 and start from 16.5. It also contains a red stretch gadget in [1.5, 13.5]. Its long intervals terminate at 1.5, 7.5 and start from 10.5, 13.5. 7. The seventh buffer intersects a blue stretch gadget that is in [18, 21] of Buffer(i, i+1), in [0, 32] of Zone(i + 1) and in [0, 4] of Buffer(i + 1, i + 2). Its long intervals terminate at 18 of Buffer(i, i + 1) and start from 4 of Buffer(i + 1, i + 2). It also contains a red stretch gadget in [7.5, 16.5]. Its long intervals terminate at {7.5, 10.5, 13.5} and start from {10, 13, 16.5}. 8. The eighth buffer intersects a red stretch gadget. It is in [7, 21] of Buffer(i, i+1) and in [0, 11] of Zone(i + 1). Its long intervals terminate at {7, 10, 13.5} of Buffer(i, i + 1) and start from {3, 7, 11} of Zone(i + 1).

The clauses of Φ are fully colored. This means that, for any negated conjunct ¬ϕ i of Φ except for the first two ones and for any variable x of ϕ i , ϕ i contains an atom M(x), for some M in σ V . And, similarly, for any negated conjunct ¬ϕ i of Φ except the first two ones and for any R-tuple x of ϕ i , ϕ i contains an atom X(x), for some X in σ T .

Contents

List of Notations

[n] {i ∈ N | 1 ≤ i ≤ n} α(x), ϕ(x), . . .

Similarly, a σ-expansion B σ of some τ -structure B is a σ-colouring if

• for any V-vertex v of B there is a unique σV -relation M such that MB σ (v), and

• for any T -vertex t of B there is a unique σT -relation X such that XB σ (t), and

• any σV -relation M is contained in the set of V-vertices of B: Mσ ⊆ V B , and

• any σT -relation X is contained in the set of T -vertices of B: Xσ ⊆ T B .

A (τ ⊎ σ)-structure F is called coloured if it is a σ-colouring of its τ -reduct F τ . The definition of a coloured (τ ⊎ σ)-structure is similar.

Usually, it is more convenient to consider a coloured (τ ⊎ σ)-structure F instead of the corresponding triple (F τ , v F τ , e F τ ). Moreover, for a coloured structure, it is natural to say that its vertices and tuples are coloured. The following Proposition 4.3.4 immediately follows from the definition. Proposition 4.3.4. A τ -structure A is accepted by FPP 2 (F 2 ) if and only if there is a σ-colouring A σ of A such that for any F, we have F ̸ A σ , where F is a coloured (τ ⊎ σ)-structure corresponding to some triple (F τ , v F τ , e F τ ) in F 2 . Similarly, a τ -structure B is accepted by FPP 1 (F) if and only if there is a σ-colouring B σ such that for no G corresponding to some (G τ , v G τ ) in F there is a homomorphism G B σ.

Because of duplicated tuples, we fail to find an MMSNP sentence that produces a problem P-time equivalent to SAT(Φ). For any finite family of forbidden structures there exists a structure with duplicated tuples such that it is not known what it should be reduced to. However, later in this section, we manage to resolve this issue by extending the set of forbidden structures infinitary long. The resulting family provides a P-time equivalent problem to a given MMSNP 2 problem. As now we have infinitely many forbidden structures, the problem does not belong to FPP 1 anymore, so we need to use another notation: FPP ∞ 1 . The definition of the class FPP ∞ 1 (F) is similar to the finite case, but now the family F can be also countably infinite.

Definition 9. Let τ be a finite relational signature and let σ be a finite relational signature consisting of unary symbols. Let F be a countable family of coloured (τ ⊎ σ)-structures. The infinite forbidden patterns problem for the family F, denoted by FPP ∞ 1 (F), is the following class of τ -structures. For a τ -structure A, A is accepted by FPP ∞ 1 (F) if there exists a σ-colouring A σ such that for any F in F there is no homomorphism F A σ .

Example 4.3.3. The 2-colourability problem that accepts precisely all bipartite directed graphs can be represented as an FPP ∞ 1 problem. In this case, the set of vertex colours σ is empty. The family of forbidden structures F consists of all possible orientations of odd cycles. The members of F of length 3, 5, and 7 are displayed on Figure 4.8 on page 90. △ In the next construction and subsequent chapters, duplicated tuples are a niggling challenge, that can be somewhat alleviated by the following equivalence relation.

Definition 10. For any τ -structure, let eq be the minimal by inclusion equivalence relation such that, for any two R-tuples (t, x), (t, y) that have a common T -vertex t, the pair (x i , y i ) belongs to eq A , for any i in [k]. See Figure 4.9 on page 90.

Proof. This is proved by induction. Consider the structure F• . Any tree of T F• has only one vertex. Thus, there are no leaves.

Suppose that any leaf of any tree T f of T G has a label in L f assigned to it. Consider a structure G ′ that is obtained from G by Construction 10. All the trees of T G ′ but one are the same as the ones of T G . Let T f in T G and T ′ f in T G ′ be the pair of different trees. The tree T ′ f is obtained from T f by taking some vertex x of T f and replacing it with a pair of adjacent vertices x 1 and x 2 such that either none of x 1 , x 2 are leaves or some of them is a leaf but with a label from L f . This is provided by the collections of tuples X 1 , X 2 being non empty. Every tuple of each of these collections either provides an edge or provides a label from L f to the corresponding vertex among x 1 and x 2 .

Any structure G in F F is associated with a family of labeled trees. We show now that this correspondence is one-to-one. Proposition 4.3.6. Let F be in F 2 . For any f in F , let T f be a tree and L f be a set of labels for vertices, and [k] × σT × (σ V ) k-1 be a set of labels for edges. Each element of L f is associated with some R-tuple of F that contains f . Suppose the following:

• for any l in L f there is a unique vertex v in T f such that l is assigned to v;

• any leaf of T f has some label of L f assigned to it;

• any edge of any tree T f has a number i in [k] and a k-tuple of σ-relation symbols assigned to it, where the first element of the tuple is a σT -relation and the other k -1 elements are σV -relations.

Denote this family of labeled trees by T ′ . Then there is a structure G in F F such that T G = T ′ .

Proof. Recall that the structures of F F are constructed inductively. Any new structure is obtained from some structure that has already been added to F F by picking an Old vertex x and replacing it with two copies x 1 and x 2 that also belong to the relation Old.

Any R-tuple that contained x now contains exactly one of x 1 and x 2 . Similarly, as any structure G of F F is obtained from F• , any tree family T G is obtained from a collection of one-vertex trees, where the vertex has all the labels. Each transformation, where x is replaced by x 1 and x 2 , is associated with the following transformation of the labeled tree family. Suppose that we are replacing some Old vertex x that belongs to an equivalence class [f ] eq by two vertices x 1 , x 2 . We pick the corresponding vertex x in T f . We replace x with two adjacent vertices x 1 and x 2 by assigning a number i and a k-tuple of σ-relations to the edge x 1 x 2 . The edge label i depends on the coordinate of the pair of duplicated R-tuples where x 1 and x 2 are. And the k-tuple defines the way how the vertices of the duplicated tuples are coloured. Any vertex y that was adjacent to x is now adjacent to exactly one of {x 1 , x 2 }, we can choose it independently. The set of labels assigned to x is now split between x 1 and x 2 , we can also choose it independently, as well as the labels for the edge between x 1 and x 2 . Any other tree T f ′ , for f ′ in F ∖ {f }, is kept the same during the modification of T f . Clearly, any collection of labeled trees can be obtained by repeating this transformation sufficiently many times.

We can prove two useful statements: Lemma 4.3.7 states that any homomorphism from A to a good structure factors through A/eq, Lemma 4.3.8 states that the family F F is sufficient to reject any structure G whose eq-quotient contains a homomorphic image of F. They help to prove then that FPP ∞ 1 (F 1 ) ≡ p SAT(Φ 2 ).

Lemma 4.3.7. Let A be a finite (τ ⊎ σ)-structure, B be a good (τ ⊎ σ)-structure (in particular, B ∼ = B/eq). Then A B if and only if A/eq B.

Proof. Denote by [x] eq an element of A/eq that is associated with an equivalence class of A containing x. Suppose that A/eq B. By the definition of quotient, we have A A/eq. By transitivity of homomorphism, we have A B. Suppose that A B. Let h : A B be a homomorphism. Consider two R-tuples of A: R(t, a 1 ), R(t, a ′ ). As B is good, for the image h(t) of t there is only one R-tuple of B: R(h(t), b), that is adjacent to h(t). Then we must have h(a) = h(a ′ ) = b. By transitivity, for any two a 1 and a 2 that belong to the same eq-equivalence class of A/eq, we have h(a 1 ) = h(a 2 ). So we can construct a homomorphism h eq : A/eq B such that h eq ([a] eq ) = h(a).

Lemma 4.3.8. Let A be a finite (τ ⊎ σ)-structure such that there is a homomorphism h : F A/eq, for some F in F 2 . Then, either there exists G in F F such that G A, or there exists a structure in F ugly that is mapped to A.

Proof. Denote by h( F) the substructure of A/eq consisting of the elements and of the R-tuples of the h-image of F . Pick any V-vertex [x] eq of A/eq that is contained in h( F). Let F x := {f 1 , . . . , f p } be the preimage of [x] eq , that is, the set of V-vertices of F such that, for any f in F x , we have h(f ) = [x] eq . Denote by T x := [x] eq the corresponding set of vertices of A. Define a labeled undirected graph (T x ; E) on the set T x as follows: if A contains a pair of duplicated R-tuples that contain x 1 and x 2 on the ith coordinate and are coloured with σ-relations X, M 1 , . . . , M k , then add to (T x ; E) an edge x 1 x 2 labeled with i in [k] and (X, M 1 , . . . , M k ). If x 1 and x 2 are coloured differently, then there is a structure in F ugly that can be mapped to A, so we assume that they are always coloured by the same σV -relation. Similarly, we assume that any two elements of this pair of tuples that are on the same coordinates have the same colour. Suppose that x is contained in an R-tuple (t, x 1 , . . . , x k ) such that (t, [x 1 ] eq , . . . , [x k ] eq ) is contained in h( F); then we assign to x a corresponding label from f ∈Fx L f . For any label of this set there is at least one element in T x having this label, because h is a mapping.

The structure G of F F that we want to obtain is defined by its family of trees T G , by Proposition 4.3.6. Any V-vertex f of F belongs to some F x . For any label l in L f there is an element x l in T x that has this label. Choose T f to be isomorphic to a minimal by inclusion tree that is a subgraph of (T x ; E) and that contains all these elements x l . This tree exists because (T x ; E) is a connected graph. And any leaf of this tree has a label from L f , otherwise it is not minimal by inclusion. The edges of T f have the same labels as the corresponding edges of (T x , E).

A homomorphism h ′ from G to A is constructed as follows. Any Old vertex v of G is associated with a vertex of some tree T f of T G . We map the Old vertices according to the isomorphisms between the trees. Any other vertex of G is adjacent to exactly one Old vertex of G by exactly one R-tuple (t, x). So it suffices to explain how h ′ maps any R-tuple. A R-tuple may belong to a pair of duplicated tuples that are added to G at some step of its construction. In this case, we know that A contains a similar pair of duplicated tuples, this is provided by the coincidence of the corresponding edge labels of T f and (T x ; E). Otherwise, an R-tuple belongs to a collection of k duplicated tuples, this collection is associated with some R-tuple of F, and this collection is added when we introduce the structure F• . Any tuple of this collection is adjacent to exactly one Old vertex. This vertex is associated with some tree vertex v G that has a label indicating that it is adjacent to this tuple. The vertex v G is mapped by h ′ to v A that also has the same label. Thus, there is a tuple in A where we can map it. Now we can show that any MMSNP 2 problem is P-time equivalent to some FPP ∞ 1 problem.

Theorem 4.3.9. For any Φ in MMSNP 2 there is a countably infinite family of finite structures F 1 such that SAT(Φ) is P-time equivalent to FPP 1 (F 1 ).

Proof. Let F 2 be the family of coloured (τ ⊎ σ)-structures constructed from Φ as in Proposition 4.3.3. Then, for F 2 , we construct a countably infinite family F 1 :

. Consider any τ -structure A and the τ -structure à := D(A).

Suppose that there is a σ-colouring A σ such that for no F in F 2 there is a homomorphism h : F A σ . Then, choose the σ-colouring Ãσ of à to be equal to D(A σ ). As Ãσ is a good structure, there is no homomorphism u : U Ãσ , for U in F ugly . If there is a homomorphism g : G Ãσ , for some G in F F ⊂ F 1 , then, by Lemma 4.3.7, we have G/eq Ãσ . By the construction of F F , F embeds into G/eq, for any G in F F , then, by transitivity, there is also a homomorphism f : F Ãσ . By Proposition 4.1.2, there exists a homomorphism f : F A σ . This is a contradiction. Suppose that, for any σ-colouring A σ there always exists some F in F 2 such that F A σ . Take any σ-colouring Ãσ . It is the D-image of some σ-colouring A σ such that F A σ , for some F in F 2 . So, by Proposition 4.1.2, there is a homomorphism f : F Ãσ . Then, by transitivity, we have F• Ãσ . We have proved that SAT(Φ) ≤ p FPP ∞ 1 (F 1 ). Now we prove that FPP ∞ 1 (F 1 ) ≤ p SAT(Φ). Let B be some τ -structure. We are going to show that B is accepted by FPP ∞ 1 (F 1 ) if and only if A |= Φ. The structure à is obtained from B/eq by removing every T -vertex t such that both tuples (t, x), (t ′ , x) belong to RB/eq , where t ′ ̸ = t and x is some k-tuple of V-vertices, similarly as in the proof of Proposition 4.3.2. We assume that no structure of F ugly can be mapped to B, otherwise we know that B is rejected by FPP

Suppose that there exists G in F F such that G B σ, then, by Lemma 4.3.8, we have F Bσ /eq. The structure F contains no R-tuples (t, x), (t ′ , x) such that t ̸ = t ′ , and no ugly structure can be mapped to B σ, so we also have F Ãσ . This means, by Proposition 4.1.2, that F A σ . This means that A is rejected by FPP 2 (F 2 ). Suppose that there exists F in F 2 such that F A σ . Then, by Proposition 4.1.2, we have F Ãσ , and, by transitivity, F B σ/eq. Then, by Lemma 4.3.8, there is

by coloured vertices and coloured R-tuples. By arguments similar to the ones in the proof of Theorem 4.4.7, we can obtain the following result.

Theorem 4.4.8. For any regular family F 1 of (τ ⊎ σ)-structures there exists an ωcategorical structure C synt such that, for any finite τ -structure A, A is accepted by the problem FPP ∞ 1 (F 1 ) if and only if A homomorphically maps to C synt . Observe that the structure C sem is a good structure, as it belongs to the functorial image. And the structure C synt contains duplicated tuples. In the rest of this section, we prove that, despite this difference, the two structures are homomorphically equivalent. So they define the same CSP problem.

Lemma 4.4.9. For any finite induced substructure G of C sem , G homomorphically maps to C synt .

Proof. Observe that G is good as every substructure of C sem is good, so there exists G 2 such that G is isomorphic to the functorial image D(G 2 ). Then, suppose that G does not map to C synt ; then there is a forbidden structure F 1 in F F ⊂ F 1 that maps to G. By Lemma 4.3.7, the quotient F 1 /eq maps to G, as G is good. Then, by transitivity, we have F maps to G, as it maps to any eq-quotient of F F structures. But F is the functorial image of F in F 2 . By Proposition 4.1.2, we know that F maps to G 2 if and only if F maps to G. We conclude that F maps to G 2 , and thus G 2 does not map to C 2 . So, also by Proposition 4.1.2, G does not map to C sem , that is a contradiction. Lemma 4.4.10. For any finite induced substructure G of C synt , G homomorphically maps to C sem . Proof. By Lemma 4.3.7, G maps to C sem if and only if G/eq maps to C sem , as C sem is a good structure. Suppose that G/eq does not map to C sem . The structure G/eq is good, so there exists a (τ ⊎σ)-structure G 2 such that G/eq = D(G 2 ). G 2 does not map to C 2 , by Proposition 4.1.2. So, there is a (τ ⊎ σ)-structure F in F 2 that maps to G 2 . Then F maps to G/eq, by Proposition 4.1.2. Then, by Lemma 4.3.8, there is a forbidden structure F ′ in F 1 that maps to G. So G does not map to C synt , that is a contradiction.

It is well known that there is a homomorphism (embedding) between two ω-categorical structures A and B if any finite substructure of A maps to B. Lemma 4.4.11 (Lemma 4.1.7 in [START_REF] Bodirsky | Complexity of Infinite-Domain Constraint Satisfaction[END_REF]). Let B be a finite or countably infinite ωcategorical structure with relational signature τ , and let A be a countable τ -structure. If there is no homomorphism (embedding) from A to B, then there is a finite substructure of A that does not map homomorphically (embed) to B. Lemma 4.4.9, Lemma 4.4.10 and Lemma 4.4.11 imply that the two ω-categorical templates constructed in this section are homomorphically equivalent.

Corollary 4.4.12. C sem and C synt are homomorphically equivalent.

Chapter 5 MMSNP 2 and expander structures

We reduce MMSNP 2 to finite CSP through MMSNP by Feder and Vardi's method from [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF]. We provide a new notion of normal form for MMSNP 2 sentences that eases a potential reduction in the other direction by providing new useful tools. And, finally, we study the main obstacle that prevents us from proving a dichotomy for MMSNP 2 . This obstacle is to construct, for a given structure, an equivalent (w.r.t. a given CSP) structure that is sufficiently sparse, in a sense. We consider different approaches that try to get over this obstacle, for a better understanding of this problem.

Introduction to expanders

We know, by Proposition 4.1.1 in Section 4.1, that MMSNP 2 problems can be reduced to MMSNP problems. Moreover, once restricted on the good input, this reduction becomes a P-time equivalence. We can detect ugly input structures and reject them. The only obstacle that stops us from showing a dichotomy for MMSNP 2 is the inability to deal with structures containing duplicated tuples.

It is not known if there is an approach to show a dichotomy for MMSNP 2 other than trying to show that SAT(Φ) is equivalent to a CSP problem under (possibly randomized) P-time reductions, where Φ is a connected MMSNP 2 sentence. That is, similarly as it is done for MMSNP by Feder and Vardi in [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF]. Their approach is as follows: the input is transformed according to Construction 13, and the target structure that defines the CSP problem is obtained from an MMSNP sentence Φ according to Construction 14.

We first describe how Feder and Vardi reduce MMSNP problems to CSP problems, then we briefly show how they reduce CSP back to MMSNP, and finally we conclude what can be done for our case of MMSNP 2 problems.

In the following construction we explain how to transform the input of an MMSNP problem on τ -structures to the input of the CSP problem.

Construction 13. For a family of (τ ⊎ σ)-structures F, denote by F τ the set of their τ -reducts: F τ := {F τ | F ∈ F}; when F is a family of (τ ⊎ σ)-structures, denote a similar set by F τ . Recall the functor D defined on page 81: it maps a (τ ⊎ σ)-structure F to a (τ ⊎ σ)-structure F := D(F). Denote by D(F τ ) the family of D-images of the members of F τ : D(F τ ) := D(F τ ) | F ∈ F . Let ρ be a finite relational signature corresponding to the CSP problem that we construct. For every τ -reduct G of D(F τ ), we add to ρ a relation symbol S G of arity m S G := |G| equal to the number of elements in the domain of G.

If there is a homomorphism g : G A CSP , then the tuple g(x) must belong to R A CSP m , for any m which is smaller than the least upper bound X x of the elements of X x . For any such m, we add x to R G m . Observe that, after doing this, the result can be mapped to A CSP if and only if the original structureG can be mapped to A CSP , by the construction of A CSP . For any other k-tuple, we do a similar operation. After that, for any k-tuple y, X y contains all the elements l ′ such that l ′ ⪯ * X y . For any other R ′ ∈ τ of arity k ′ , we do a similar operation.

The structure that we obtain from G satisfies the condition from Proposition 6.2.5 on page 137, this means that there is a ( * , τ )-structure B * such that G and B CSP is the same structure. By Proposition 6.2.4, B * A * if and only if B CSP A CSP .

Generalised Matrix Partition

Input extension

In this section we will prove the following theorem.

Theorem 6.3.1. For any finite signature τ , MP τ and MP τ ⋆ are P-time equivalent. In order to prove the P-time equivalence, we will show that for any ⋆-structure H, MP τ (H) ≡ p MP τ ⋆ (H). We first do the proof for ⋆-graphs, and then explain how to modify the construction for any τ . Hell and Nešetřil proved in [START_REF] Hell | On the density of trigraph homomorphisms[END_REF] that for any ⋆-graph G there is a 01-graph G 01 such that G ∈ MP ⋆ (H) ⇔ G 01 ∈ MP(H) using probabilistic arguments. We prove the equivalence by giving a deterministic algorithm running in P-time.

In order to prove that for any ⋆-graph G, there is a 01-graph G 01 such that G ∈ MP ⋆ (H) if and only if G 01 ∈ MP(H), we will use the notion of Hadamard matrices.

An n × n-matrix H n , which entries are in {1, -1}, is called a Hadamard matrix if

, where I n is the identity matrix of size n, and H T is the transpose of H.

Hadamard matrices exist for any power of 2.

Lemma 6.3.2 ([Wal23]). For every positive integer n > 1, one can construct in time

If H n is an n × n-Hadamard matrix, that we assume its rows and columns indexed by

Remark. We use Hadamard matrices because the distribution of 1s is close to the uniform one. It is not the only class that can be used in this case. Every graph with a good expanding property, see [START_REF] Alon | Eigenvalues, geometric expanders, sorting in rounds, and ramsey theory[END_REF], would also be sufficient to prove Theorem 6.3.1. Hadamard matrices were the first ones that we found that had this property of being close to uniform, so we decided to use them in this thesis.

For t ∈ B 2 , we have that h

We have shown that h is a homomorphism.

Assume that there is h : B Ã -a homomorphism. We know that x = c B if and only if R B(x, . . . , x) = 1, and otherwise R B(x, . . . , x) = 0. We also know the same thing for Ã. Thus, x = c B if and only if h(x) = c A . This allows us to correctly construct h : B A, where for all x ∈ B, h(x) = h(x).

For any

We know that by the construction of à and B, and by eq. (6.5):

So, h is a homomorphism and MP τ ⋆ (A) reduces to MP τ ⋆ ( Ã).

Now we have to find in polynomial time for any input

Proof. Let G be an input instance of MP τ ⋆ ( Ã). Firstly, for any element x ∈ G, we check whether R G(x, . . . , x) = ⋆. If such an x exists, then we cannot map G to à as for all y ∈ à we have that R Ã(y, . . . , y) ∈ {0, 1}. This can be checked in time linear in | G|. In this case, we output some fixed NO input instance of MP τ ⋆ (A), e.g., some B where there is b ∈ B and R B i (b, . . . , b) = ⋆ for all R i ∈ τ . Now we can assume that, for all x ∈ G, R G(x, . . . , x) ∈ {0, 1}. We divide the elements of G into two classes: G = C 1 ⊔ C 0 by the following rule:

Observe that if there exists a homomorphism h : G Ã, then for all x ∈ G : h(x) = c A ⇔ x ∈ C 1 . We are going to construct a τ -structure B with the following properties:

3. Either we can check in P-time that B ̸ Ã or there exists a τ -structure B such that B can be obtained from B by the construction described above in this section.

The interpretation R B is defined as follows, here denotes the least upper bound of two element with respect to the ordering ⪯ ⋆ :

(6.7)

Observe that we can construct B in time polynomial in the size of the input G.

Let us check the property 1, that G B. Let us consider a map π : G B s.t.

As x ∈ C π(x) , by eq. (6.7) we have

. This proves that π is a homomorphism.

Let us check the property 2, that G Ã ⇔ B Ã. As G B, we need to show only one direction, i.e., ⇒. Assume that there is h

We define a map h B as follows:

for all (x 1 , . . . , x k+p-1 ) ∈ C t. Thus,

, where denote the least upper bound of the elements. This shows that h B is a homomorphism.

Finally, we need to check the property 3 to finish the proof. Recall that we split all the tuples (b 1 , . . . , b k+p-1 ) ∈ Bk+p-1 into three classes: B 1 , B 2 , B 3 . Observe that for any homomorphism h : B Ã, we have that for any

At first, we look at the tuple t = (c B , . . . , c B ) ∈ B 2 . By eqs. (6.6) and (6.7), we know that R B( t)

, then we continue. Now, we look at every tuple t ∈ B 3 and check whether R B( t) = 0. If there exists t ∈ B 3 such that R B( t) ̸ = 0, then we output some fixed NO input instance of MP τ ⋆ (A) for G. If, for all tuples of B 3 , we have that R B( t) = 0, then we continue. We can do all these checks in time polynomial in | G|.

Now we can assume that R B( t2 ) = 1 and R B( t3 ) = 0, for all t2 ∈ B 2 , t3 ∈ B 3 . We are ready to construct the (⋆, τ )-structure B:

Let G n 2 be the class of all ⋆-graphs on n elements that are cores and pairwise not homomorphically equivalent. Recall that a core G ∈ G n 2 cannot have an element x with E G (x, x) = ⋆. Let G n 3 be the class of (⋆, τ )-structures with the same property. Lemma 6.3.9. For every positive integer n,

We suppose that all G ∈ G n 2 have the same domain {a, x 1 , . . . , x n-1 }, we fix one element a, and linearly order the elements from {x 1 , . . . , x n-1 } with

2 . We will construct a family of (⋆, τ )-structures G G of size 3 n(n-1) 2 -1 such that every two (⋆, τ )-structures from there will not be homomorphically equivalent. We will construct such a class for every ⋆-graph in G n 2 , and then show that any two structures from different classes will not be homomorphically equivalent as well.

Any G 3 ∈ G G must satisfy the following properties:

• the domain is the same as the one of G:

• for all x, y ∈ G 3 : R G 3 (a, x, y) = E G (x, y) -we define all the relations of G using only the triples that have a on the first coordinate;

• for all x ∈ G 3 ∖ {a} : R G 3 (x, x, x) = 1 -E G (a, a) -all the elements other than a have the value on the loop, that is different from the loop R G 3 (a, a, a) = E G (a, a); the loop property

The values are restricted for the n 2 tuples that are associated with the arcs of G, for the (n -1) 2 tuples of the linear ordering, and for the (n -1) loops, and for the triple (x i 1 , x i 2 , x i 3 ). For any other triple (x, y, z) ∈ G 3 , there is no restriction on the value of R G 3 among {0, 1, ⋆}. Thus,

Let us consider A, B ∈ G G , suppose that there is a homomorphism h : A B, then h(a) = a and for all x ̸ = a, h(x) ̸ = a by the loop property of G 3 . Also, by the linear ordering property, we have that for all x ∈ A, h(x) = x. But these two structures differ on at least one tuple, this is a contradiction.

Let us consider

a, a) on the other hand. Thus, we assume that E G 1 (a, a) = E G 2 (a, a) and that h(a) = a and, for all x ̸ = a, h(x) ̸ = a (again by the loop property), but, by the linear ordering property, we must have that h(x) = x. The homomorphism h implies that the identity mapping on the set G = {a, x 1 , . . . , x n-1 } is a homomorphism from G 1 to G 2 that is a contradiction as G 1 and G 2 are pairwise not homomorphically equivalent.

This proves that we are able to construct at least |G n 2 | • 3 n(n-1) 2 -1 (⋆, τ )-structures such that any two of them are not homomorphically equivalent. Without loss of generality, we assume that E H (x, x) = 0, the case when it is equal to 1 is equivalent.

01-and ⋆-obstruction sets agree on being finite

We prove Theorem 6.4.1 in this section. From now on, we fix a ⋆-structure H. We have showed, see Corollary 6.4.3, that Theorem 6.4.1(1.) and Theorem 6.4.1(2.) are equivalent.

We prove the other equivalences with the following propositions. Corollary 6.4.6 of the following Proposition 6.4.5 proves that Theorem 6.4.1(3.) is equivalent to Theorem 6.4.1 (1.). • there is a surjective homomorphism π G : G 01 ↠ G;

and with E Cn (v n , v 1 ) = 1, and with all other arcs equal to ∅. The problem C n H is equivalent to the 2-coloring of a directed cycle that is a directed graph, for which we know that odd cycles are all inclusion-minimal obstructions. Similarly, deleting any vertex from C n creates a ∅-graph that maps to H. Thus, the set C = {C n | n is odd} is an infinite set of inclusion-minimal obstructions for MP ∅ (H).

Matrix Partition and its relation with logic

Feder and Vardi show in [START_REF] Feder | The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory[END_REF] that MMSNP and CSP denote the same class of problems, up to P-time equivalence. This means that this class can be studied from both logic and homomorphism perspectives. We discuss logics that potentially could be P-time equivalent to the class MP.

Let τ be the input relational signature, and σ = {M 1 , . . . , M s } be the existential signature consisting of unary relation symbols. Recall that the logic MonadicSNP from Chapter 2 consists of the sentences of the following form:

where, for any i in [m], α i is a conjunction of τ -atoms or negated τ -atoms, and β i is a conjunction of σ-atoms or negated σ-atoms.

Clearly, MP is a subclass of MonadicSNP, that is, every MP problem can be defined by a MonadicSNP sentence. Proposition 6.5.1. For any s × s matrix M consisting of 0, 1, * , there is a sentence Φ M in MonadicSNP such that SAT(Φ M ) is P-time equivalent to MP(M).

Proof. Let τ = {E(•, •)} be the input signature of Φ M and σ = {M 1 , . . . , M s } be the existential signature. Then, the sentence Φ M is of the following form:

Here, the first negated conjunct requires that any element must belong to at least one σ-relation, and the next s negated conjuncts restrict an element to be in two different σ-relations. Then, every ϕ ij depends on the value of the corresponding matrix element m ij of M: By Theorem 2.0.1 in Chapter 2, MonadicSNP does not have a dichotomy. But this does not mean that MP does not have it, as we do not know if MonadicSNP can be embedded into MP. In fact, being written in the MonadicSNP form, MP problems define a small fragment of MonadicSNP, which can be described by the following property satisfied by Φ M , for any M.

Observation 4. Any negated conjunct of Φ M contains at most one τ -atom or negated τatom. Which implies that, within any negated conjunct, all its τ -atoms have the same polarity: either they are all non-negated or all negated.

It is easy to show that the set of MonadicSNP sentences satisfying the property from Observation 4 coincides with the class MP. For any such sentence Φ, we can modify its existential signature σ in order to make the σ-relations form a partition of the input structure elements. This can be done similarly to the normal form transformation in Section 4.2. Where we, firstly, ensure that, for any negated conjunct ¬ϕ of Φ and for any variable x in ϕ, and for any σ-relation M in σ, this negated conjunct ¬ϕ contains either the σ-atom M(x) or its negated version ¬M(x). And then we replace σ by a new signature 2 σ , where every 2 σ -relation is associated with a subset of σ. Finally, we demand that these new 2 |σ| relation symbols form a partition. The resulting sentence still satisfies the property. Now, it is straightforward to construct an equivalent MP problem.

So, it makes sense to consider a more expressive logic, where, within any negated conjunct, its τ -atoms have the same polarity.

Definition 26. Let τ be the input signature and let σ = {M 1 , . . . , M s } be the existential signature consisting of unary relation symbols. We say that a τ -sentence Φ belongs to the class MMSNP * if it can be written in the following form:

where, for any i in [m], either α i is a conjunction only of non-negated τ -atoms or it is a conjunction only of negated τ -atoms; and β i is a conjunction of σ-atoms or negated σ-atoms.

Clearly, MMSNP * contains MP. Regarding this class, we can formulate the following problem.

Problem 2. Is it true that for any sentence Φ in MMSNP * there is a problem in MP which is P-time equivalent to SAT(Φ)?

The logic MMSNP * is strictly more expressive than MMSNP. Proposition 6.5.2. There is a sentence Φ * in MMSNP * such that, for any Φ in MMSNP, Φ * is not logically equivalent to Φ.

Proof. Let Φ * be a sentence on directed graphs that accepts only complete graphs with loops: ∀x, y E(x, y). Theorem 3 in [START_REF] Feder | Homomorphism closed vs. existential positive[END_REF] states that the class of structures satisfying a MonadicSNP sentence Ψ is closed under inverse homomorphisms if and only if Ψ is logically equivalent to a MMSNP sentence. As SAT(Φ * ) is not closed under inverse homomorphisms, it cannot be expressed by an MMSNP sentence.

Matrix Partition and polymorphisms

Let A be a (⋆, τ )-structure with the domain A. A mapping f :

where denotes the greatest lower bound of the elements and f(t 1 , . . . , t n ) denotes f(t 1 1 , . . . , t 1 n ), . . . , f(t k 1 , . . . , t k n ) . The set of all polymorphisms of A is denoted by Pol(A). A polymorphism s : A 4

A is called Siggers if it satisfies the following identity:

∀x, y, z ∈ A s(x, y, z, x) = s(y, x, y, z). (6.9)

The following is proved in [START_REF] Zhuk | A proof of the CSP dichotomy conjecture[END_REF] for Constraint Satisfaction Problems (CSP) on finite relational structures. Theorem 6.6.1. Let A be a finite relational structure over some finite signature. Then either

• there is a Siggers polymorphism s : A 4

A and CSP(A) is in P, or

• there is no Siggers polymorphism and CSP(A) is NP-complete.

We can reduce any Matrix Partition problem in P-time to some CSP such that the Matrix Partition problem is equivalent to this CSP being restricted on complete input instances. In particular, for any ⋆-graph H, we can construct a relational structure H CSP over a signature {E 0 (•, •), E 1 (•, •)}. Here, by complete input we mean those relational structures A such that for all x, y in A, (x, y) belongs exactly to one of E A 0 and E A 1 . Our goal is to show that Matrix Partition problems cannot be characterised by the conditions from Theorem 6.6.1. To do that, we provide a ⋆-graph P such that MP(P) is Ptime solvable but the corresponding structure P CSP does not have a Siggers polymorphism and thus CSP(P CSP ) is NP-complete.

We provide a ⋆-graph such that the corresponding Matrix Partition problem is solvable in P-time and that it has no Siggers polymorphism. Consider a ⋆-graph P as on Figure 6.5. We have chosen it to be of the form of a directed path because it is well-known that list matrix partition problems are P-time solvable on them (we prove it formally, though). So the objective is to prove that such structure has no nontrivial polymorphisms. By trivial we mean a projection. Theorem 6.6.2. P does not have Siggers polymorphism and MP(P) is P-time solvable.

We prove Theorem 6.6.2 at the end of this section after proving all the lemmas. Lemma 6.6.3 (Theorem 2 in [START_REF] Feder | Dichotomy for tree-structured trigraph list homomorphism problems[END_REF]). Let H be a ⋆-graph. Let H -be a directed graph obtained from H by adding an arc for every pair (x, y) in H 2 such that E H (x, y) ∈ {1, ⋆}. Then, if H -is an oriented tree, then the list matrix partition problem of H is P-time equivalent to the list homomorphism problem of H -. Lemma 6.6.4. If s : A 4 P is a polymorphism, then it is conservative. That is, for any x 1 , x 2 , x 3 , x 4 in P , we have s(x 1 , x 2 , x 3 , x 4 ) ∈ {x 1 , x 2 , x 3 , x 4 }.

Proof. As (x, y) is the only pair such that E P (x, y) = ⋆, we must have s(x, x, x, x) = x and s(y, y, y, y) = y. As x is the only element of P that is adjacent to w by a 1-arc, we must have s(w, w, w, w) = w. As y is the only element of P that is adjacent to z by a 1-arc, we must have s(z, z, z, z) = z.

Suppose that s(w, w, x, x) ∈ {y, z}. If it equals y, then s(x, x, y, y) = z, but then, for any value of s(y, y, z, z), s violates the polymorphism property. If s(w, w, x, x) = z, then, for any value of s(x, x, y, y), s violates the polymorphism property. The proof, for other tuples from {w, x} 4 ∪ {x, y} 4 ∪ {y, z} 4 , is similar.

Suppose that s(w, w, y, y) ∈ {x, z}. If it equals x, then it contradicts to s(w, w, w, w) = w. If it equals z, then, for any value of s(x, x, z, z), s violates the polymorphism property. The proof, for other tuples from {w, y} 4 ∪ {x, z} 4 is similar.

Suppose that s(w, w, z, z) ∈ {x, y}. If it equals x, then it contradicts to s(w, w, w, w) = w. If it equals y, then it contradicts to s(z, z, z, z) = z. The proof for other tuples from {w, z} 4 is similar.

Suppose that s(w, w, x, y) = z; then, for any value of s(x, x, y, z), s violates the polymorphism property. The proof for other tuples from {w, x, y} 4 ∪ {x, y, z} 4 is similar.

Suppose that s(w, w, x, z) = y; then it contradicts s(z, z, z, z) = z. The proof for other tuples from {w, x, z} 4 ∪ {w, y, z} 4 is similar.

Order w, x, y, z as w ≺ x ≺ y ≺ z. Take two tuples t, t ′ in {w, x} 4 ∪ {x, y} 4 ∪ {y, z} 4 . We say that t ⪯ t ′ if, for any i in [4], t i ⪯ t ′ i , where ⪯ means ≺ or =. This ordering is displayed on Figure 6.6 for tuples from {x, y}. Lemma 6.6.5. Let s be a polymorphism of P. Then, for any t, t ′ in {w, x} 4 ∪ {x, y} 4 ∪ {y, z} 4 , if t ⪯ t ′ , then s(t) ⪯ s(t ′ ).

Appendix A

Maximum cut on interval graphs of interval count two is NP-complete By Ladner's theorem, P ̸ = NP implies the existence of NP-intermediate problems. However, we do not know about any naturally formulated problem that happens to be NP-intermediate. There are many NP problems that are not known to be NP-complete or P-time solvable, e.g. Graph Isomorphism and Integer Factoring. Some problems that are NP-complete for general case become P-time solvable if the input is restricted. And, for some cases of the input restriction, the questions about the problem complexity are still open. In this appendix, we solve one of such questions. Although it is not related to Feder and Vardi's logic MMSNP, this result concerns the P-NP-complete dichotomy question. This is why we decide to add it to the thesis.

A.1 Introduction

For a graph G = V (G), E(G) , a cut is a partition of V (G) into two disjoint subsets. Any cut determines a cut set which is the set of all edges that have one endpoint in one part and the other endpoint in the other part. The size of a cut is the cardinality of its cut set. The maximum cut problem, denoted by MaxCut, asks for a cut of maximum size in G.

MaxCut is a fundamental and well-known NP-complete problem [START_REF] Garey | Computers and Intractability; A Guide to the Theory of NP-Completeness[END_REF]. The weighted version of the problem is one of Karp's original 21 NP-complete problems [START_REF] Karp | Reducibility among combinatorial problems[END_REF]. MaxCut remains NP-hard even for cubic graphs [START_REF] Berman | On some tighter inapproximability results (extended abstract)[END_REF], split graphs [START_REF] Hans | On the complexity of the maximum cut problem[END_REF], co-bipartite graphs [START_REF] Hans | On the complexity of the maximum cut problem[END_REF], unit disk graphs [START_REF] Díaz | MAX-CUT and MAX-BISECTION are np-hard on unit disk graphs[END_REF], total graphs [START_REF] Guruswami | Maximum cut on line and total graphs[END_REF], and interval graphs [START_REF] Adhikary | Complexity of maximum cut on interval graphs[END_REF]. On the positive side, polynomial time algorithms are known for planar graphs [START_REF] Hadlock | Finding a maximum cut of a planar graph in polynomial time[END_REF], line graphs [START_REF] Guruswami | Maximum cut on line and total graphs[END_REF], graphs not contractible to K 5 [START_REF] Barahona | The max-cut problem on graphs not contractible to k5[END_REF] and graphs with bounded treewidth [START_REF] Hans | On the complexity of the maximum cut problem[END_REF].

There are two papers that mainly motivate our research. First, a recent proof of NPcompleteness of MaxCut on interval graphs provided by Adhikary et al. in [START_REF] Adhikary | Complexity of maximum cut on interval graphs[END_REF]. Second, a more recent result of de Figueiredo et al. in [START_REF] Celina | Maximum cut on interval graphs of interval count four is np-complete[END_REF], where they extend the result of the first paper by proving that MaxCut is NP-complete on graphs of interval count four. Using the technique of the above work, de Figueiredo et al. prove the NPcompleteness of MaxCut on permutation graphs as well, which too was open for a long time [START_REF] Celina | Maxcut on permutation graphs is npcomplete[END_REF]. The bounding of the number of interval lengths brings us closer to the final goal: to characterize MaxCut for unit interval graphs as they are exactly interval graphs of interval count one. There were attempts to provide a polynomial-time algorithm for unit interval graphs [BKN99, BES17], but they both were later shown to be incorrect [BdFG + 04, KMN20]. In this paper we extend the result of the second paper by proving the following theorem which brings us as close as possible to MaxCut on unit interval graphs.

Theorem A.1.1. MaxCut on interval graphs of interval count two is NP-complete.

A.2 Preliminaries

For a, b in R, an interval between a and b is the set of all

Here and elsewhere, we use the notation [n] for the set {1, 2, . . . , n}, where n ∈ N. A graph G is called an interval graph if there exists a family of intervals M G that is an interval model of G. A graph G is said to have interval count c if there exist a set C ⊂ R of size c and an interval model M of G, where the length of any interval of M belongs to C. We usually think of a MaxCut partition as of a coloring of intervals into two colors: R for red and B for blue. So, when we say that some interval is colored in some color, we mean that it belongs to the corresponding partition class. If an interval X has a color c ∈ {R, B}, then we frequently denote it by Color(X) = c. If B is a family of intervals that all have a color c ∈ {R, B}, then we also can write Color(B) = c.

A.3 Background

We first start with the reduction of Adhikary et al. in [START_REF] Adhikary | Complexity of maximum cut on interval graphs[END_REF]. They reduced MaxCut on cubic graphs to MaxCut on interval graphs. In their paper, each vertex and edge of the original cubic graph was represented by a set of intervals, called vertex and edge gadgets respectively. The interval model consisted of first all the vertex gadgets, and then all the edge gadgets arranged from left to right. If an edge was incident to a vertex, then the corresponding vertex and edge gadgets were "linked" by a pair of very long intervals whose left ends intersected the corresponding vertex gadgets and right ends intersected the edge gadget. They were called link intervals. The number of intervals in any gadget was much greater than the total number of link intervals in the graph. It was shown that, in a MaxCut partition of this interval graph, each vertex gadget or edge gadget could have only two possible partitions. For a vertex gadget, these two partitions were made to correspond to its membership in one of the partitioning sets for MaxCut of the cubic graph. If two adjacent vertices of the cubic graph belonged to different sets, then the corresponding edge gadget would make more cut edges with link intervals than if these vertex gadgets were in the same set. Thus, a maximum sized cut of the cubic graph always corresponded to a maximum sized cut of the constructed interval graph and vice versa, proving the latter to be NP-complete.

In the above reduction, intervals of two different lengths were used to construct the gadgets. However, the length of each link interval depended on the relative positions of its vertex and edge gadgets. So the total number of different lengths of link intervals was linearly dependent on the size of the cubic graph. So, this interval graph seemed to be far Usually, we draw a 3-block as it is done on Figure A.2. We say that an interval terminates at a block B if B is the rightmost block that contains the right end of the interval. Similarly, we say that an interval starts from B if B is the leftmost block that contains the left end of the interval. For a long interval, we say that it overlaps B if it intersects the block but neither terminates at it nor starts from it. For example, on Figure A.2, there is a short interval that terminates at B 1 , another short interval that starts from B 3 , and three long intervals that overlap all the three blocks.

3-block is a basic concept of this paper because almost all other gadgets are constructed using 3-blocks. The reason of its usefulness is that, if the block size is large enough, then, under any MaxCut coloring, the coloring of the blocks B 1 , B 2 , B 3 of a 3-block is almost alternating except for (B 2 , c); and the value of c depends on the number of long intervals that overlap B 2 . This is proved in Lemma A.5.1. Denote the total number of link intervals by η. In the following lemma we show that a 3-block follows an alternating pattern of partition for all maximum sized cuts, except a few intervals in the middle block.

Lemma A.5.1. Let B = (B 1 , B 2 , B 3 ) be a 3-block in H of size (x, 2x, x). Then any maximum cut coloring of H satisfies the following conditions:

1. all intervals of B 1 and B 3 get the same color.

2. all intervals of B 2 get the opposite color except for at most η intervals.

Proof. Consider a maximum cut coloring of H.

• We denote by L 1 all the long intervals that terminate at B 1 .

• We denote by L 2 all the long intervals that overlap B 1 , B 2 , and B 3 .

• Those long intervals that start from B 3 are denoted by L 3 .

• Those long intervals that terminate at B 2 are denoted by L 4 .

• Finally, L 5 denotes all the long intervals that start from B 2 . Let r i and b i be the numbers of intervals that respectively get red and blue colors in L i , for any i ∈ [5]. Without loss of generality, assume that most intervals of L 1 get the color red, that is,

This contradicts the maximality of the first cut. Therefore we conclude that y 1 ∈ {0, x} and y 3 ∈ {0, x} , i.e., B 1 and B 3 are monochromatic. Now we show that Color(B 1 ) = Color(B 3 ). For the sake of contradiction, assume that Color(B 1 ) ̸ = Color(B 3 ). Thus, |y 1 -y 3 | = x. Again, we calculate the difference C -C RBR , which is at most:

Since x > n 6 and each ∆ i < n 3 , we have that C -C RBR < 0, which contradicts the maximality of the first cut. So we conclude that Color(B 1 ) = Color(B 3 ), this proves (1).

Without loss of generality, suppose that Color(B 1 ) = Color(B 3 ) = R. So in order to prove (2), we have to show that except at most η intervals, all intervals of B 2 get color blue. The number of cut edges contributed by B is

Now we show that y 2 ≤ b 2 + b 4 + b 5 . For the sake of contradiction assume that y 2 > b 2 + b 4 + b 5 . Let us modify the cut by coloring all intervals of B 2 blue, i.e. by making y 2 = 0. The number of cut edges contributed by B in the modified cut is:

If two adjacent 3-blocks are colored differently, then the short link interval between them will add x to the MaxCut. If they have the same color, then it will add 2x, so all the three 3-blocks will have a similar partition: either all RBR or all BRB except for a small fraction in every central block B i 2 . Let v ∈ V (G) be a vertex of a cubic graph G. It corresponds to some vertex gadget. Then the color of v, under a MaxCut partition, is the same as the color assigned to the long intervals starting from the vertex gadget.

Edge gadget An edge gadget consists of two 3-blocks connected by a short link interval:

, k correspondingly, for some k > 0. The value of k is different from the value of x -the block size within a vertex gadget. There are two long intervals L 1 , L 2 that terminate at B 1 1 and B 2 2 correspondingly, see The colors of L 1 and L 2 are enforced by some two vertex gadgets. If we choose k to be significantly smaller than x, then edge gadgets are less influential than vertex gadgets. The colorings of B 1 and B 2 of an edge gadget must be almost alternating and they depend on the colors of L 1 and L 2 . The two possible cases are displayed on Figure A.4. If Color(L 1 ) ̸ = Color(L 2 ), then the MaxCut value is greater, as S 12 is connected to blocks of the same color and it can pick the opposite color. If Color(L 1 ) = Color(L 2 ), then S 12 is adjacent to blocks of different colors, and the MaxCut value is less than in the first case. This is proved in Lemma A.6.2. Suppose that there is a graph H and a maximum cut partition of H; then, for some induced subgraph H ′ of H, the value provided by H ′ means the number of cut edges having at least one end in H ′ .

Then, for a MaxCut partition of H, the colorings of 3-blocks are almost alternating except for at most η intervals of the central blocks; and if Color(L 1 ) ̸ = Color(L 2 ), then the maximum cut value provided by E is greater at least by k -2η than the maximum cut value in the case Color(L 1 ) = Color(L 2 ).

Proof. Suppose that E is overlapped by λ < η long intervals. By Lemma A.5.1, the MaxCut of B 1 and B 2 , is either alternating or almost alternating except for ∆ intervals of B 1 2 or B 2 2 , where ∆ < η is the difference between the numbers of red and blue long overlapping intervals.

Suppose that Color(L 1 ) = Color(L 2 ) = B; then Color(B 1 1 ) = Color(B 1 3 ) = R. The color of B 1 2 must be blue except for at most η intervals. For B 2 there are two cases. 1. The color of B 2 2 is red except for at most η intervals, and Color(B 2 1 ) = Color(B 2 3 ) = B. Then, for any Color(S 12 ), the cut size is at most

2. The color of B 2 2 is blue except for at most η intervals, and Color(B 2 1 ) = Color(B 2 3 ) = R. Then Color(S 12 ) = B. Then the cut size is at most 8k 2 + (6 + 4λ)k + 1 2 ∆ 2 + 2λ. Suppose that Color(L 2 ) = B and Color(L 1 ) = R. Then B 2 is partitioned as RBR. B 1 is also partitioned as RBR. Then the cut size would be at least 8k 2 + (7 + 4λ)k + 1 2 ∆ 2 + 2. The difference between the value provided by E when Color(L 1 ) ̸ = Color(L 2 ) and the value in the case when they are equal is at least k -2λ, which is at least k -2η.

Join gadget Similarly to vertex gadgets, a join gadget consists of three 3-blocks connected by short link intervals: J = B 1 ⊔ B 2 ⊔ B 3 ⊔ {S 12 , S 23 }. Every join gadget has 3 long intervals terminating at B i 1 and 3 long intervals starting from B i 3 , for i ∈ [3], see Figure A.5. We need such gadgets to connect vertex gadgets to edge gadgets by chains of long intervals. By Lemma A.5.1, the coloring of each 3-block B i is almost alternating except for some small fraction within its central block B i 2 . All the 3-blocks are colored similarly: either all are BRB or all are RBR. See Lemma A.6.4 for the proof. The colors of the three long intervals that start from a join gadget are the same as the colors of those three that terminate at it. This means that we can keep in our memory the vertex gadget coloring as it is preserved by join gadgets.

Stretch gadget

We need to be able to manipulate the positions of long intervals within a join gadget. Either we can increase the number of 3-blocks inside it or we can decrease the distances between blocks without adding any new intersections, as on Figure A.6. Such join gadgets are called stretch gadgets. We will never need more than 10 3-blocks within one stretch gadget. The following lemma provides a lower bound for the distance between the ends of two long intervals of H, it is a consequence of the stretch gadget construction.

Lemma A.6.3. If the distance between the ends of two long intervals L 1 , L 2 is greater than 2, then we can attach them to the same stretch gadget.

Proof. See Figure A.6. Assume that L 1 , L 2 intersect a stretch gadget and do not overlap it. By construction, a long interval can terminate at the first block B i 1 of some 3-block B i , and can start from the third one. Consider 3 cases: 1. L 1 and L 2 terminate at (start from) the gadget: L 1 at a, L 2 at b, and a < b.

2. L 1 terminates at a and L 2 starts from b and a < b.

3. L 1 terminates at a and L 2 starts from b and a > b.

If L 1 has its end in a 3-block B i , and L 2 -in B i ′ , then we say that the intervals have |i ′ -i| 3-blocks between them. In particular, if they have their ends in the same block, then they have no 3-blocks between them.

Suppose that there are j 3-blocks between the intervals. Case 1. The ends cannot be in the same 3-block. The distance between the ends can be in (2j, 4j], for j ≥ 1.

Case 2. The distance can be in (2j + 1, 4j + 3], for j ≥ 0. Case 3. The ends cannot be in the same 3-block. The distance can be in (2j -2, 4j -3], for j ≥ 1.

One can see that the union of these three intervals, in each case, will contain (2, +∞).

We now show similar bounds on the MaxCut for stretch and switch gadgets. Proof. By Lemma A.5.1, the coloring of B j , for j ∈ [m], must be almost alternating except for η intervals in B j 2 . Suppose that B j and B j+1 are colored differently, for some j ∈ [m -1]. Then we invert the coloring of B j+1 so that now they have the same color. Do it for any other B j ′ , for k > j + 1, if needed. The possible loss is at most m × η 2 . The possible gain is at least x, as now, for any short link interval S j,j+1 , its color is different than the color of both B j 3 , B j+1 1 . As x ∈ Ω(n 6 ) and η < 3n, this partition is MaxCut.

Switch gadget

, where x ′ is some value satisfying x/2 < x ′ < x. It also contains two long intervals L 1 , L 2 that terminate at the gadget, and two long intervals R 1 , R 2 that start from it, where, for each i, the end of L i is to the left of the end of R i . L 1 terminates at the bottom left block, L 2 terminates at the top left one. R 1 starts from the top right block, R 2 starts from the bottom right one. The main property of this gadget is that, for any MaxCut partition, we have Color(L 1 ) = Color(R 2 ) and Color(L 2 ) ̸ = Color(R 1 ). The second part, see Figure A.8, is just a 3-block that changes the color of the successor of R 1 to be the same as Color(L 2 ). The idea behind switch gadget is that it "switches" the intervals: the color of R 1 depends on the color of L 2 , and the color of R 2 depends on the color of L 1 .

A MaxCut partition of the first part of the switch gadget is shown on Figure A.7, this is proved in Lemma A.6.5. If the first switch gadget part is overlapped by many long intervals, then, under a MaxCut partition, the coloring of the blocks will be the same as on 4 . This is proved in Lemma A.6.6. Here, c also depends on the size of the input cubic graph. A MaxCut partition of the second part is similar to the one of a 3-block.

Lemma A.6.5. Consider a graph with an interval model as on Figure A.7. Then, in any MaxCut partition of this graph, the following statements hold:

• for each of the two levels, block colorings are alternating, and

Proof of Lemma A.6.5. At first, let us compute the size of the cut for any partition, where the colors of the blocks on the top and on the bottom alternate. We do not consider the four long intervals at the moment. The value is the same for any of the four such partitions:

Suppose now that the alternating partition is not maximal. Then we will introduce the following notations for each block.

• Denote by y 1 , y 3 the numbers of blue intervals in B top 1 and B top 3 .

• Similarly, y 2 , y 4 denote the numbers of red intervals in B top 2 and B top 4 .

• Denote by z 1 , z 3 , z 5 , z 7 , z 9 the numbers of blue intervals in B bot 1 , B bot 3 , B bot 5 , B bot 7 , B bot 9 .

• Similarly, denote by z 2 , z 4 , z 6 , z 8 the numbers of red intervals in B bot 2 , B bot 4 , B bot 6 , B bot 8 .

We are going to compute the MaxCut for a general case and to compare it to Cut alter in order to find out when it can be the maximal. We are going to split the computation into several parts in order to be clear:

• The Cut inside part counts the cut-edges inside each of the blocks.

• The Cut y and Cut z parts count the cut-edges between different blocks that are both on the same level. There are two levels: the top y and the bottom z.

• The Cut inter part counts the cut-edges between the two levels. Now we compute the parts one by one.

Then

Cut inter = (i,j)∈A,i+j is odd

Our goal is to prove that f = Cut inside + Cut y + Cut z + Cut inter -Cut alter is less or equal to 0 and the equality is reached only when the colors alternate. Think of f as of a polynomial of x ′ and x of degree 2:

Clearly, f 3 = f 4 = f 5 = 0. Now compute the terms f 0 , f 1 x ′ , and f 2 x:

We have extracted the negative squares of y i , z j from f 1 x ′ and f 2 x in order to combine them together with the negative squares of the part of f 0 provided by Cut inside . The other summands of f 1 x ′ and f 2 x are almost always negative, except for the minimal and maximal values of y i , z j . These extreme cases happen exactly when a block is either all red or all blue. Then

Clearly, f ≤ 0. We are going to find all the cases when f = 0. Observe that, for any i ∈ {2, 3}, j ∈ [9], there is a summand -y i (2x ′ -y i ) and a corresponding one for z j . Thus, we need to consider only the cases when y 2 , y 3 ∈ {0, 2x ′ }, z 1 , z 9 ∈ {0, x} and z 2 , . . . , z 8 ∈ {0, 2x}. Suppose that y 1 ̸ ∈ {0, 2x ′ }; then 0 < |y 1 -y 2 | < 2x ′ and thus y 1 -y 2 -z 2 + z 3 ̸ = 0, for any z 2 , z 3 ∈ {0, 2x}, as x ′ < x. So y 1 = y 2 , and thus z 2 = z 3 . Similarly, y 3 = y 4 , and so z 5 = z 6 . Using other clauses of the expression, we conclude that y 1 = . . . = y 4 , z 2 = . . . = z 8 , and also we have z 1 = z 9 = z 2 /2 = z 8 /2. This means that the colorings of the blocks alternate.

Now we need to prove that Color(L 2 ) ̸ = Color(R 1 ). Suppose the opposite; then the cut between the blocks and the long intervals will be at most the sum: 4x provided by L 2 plus 4x provided by R 1 , plus x provided by L 1 plus x provided by R 2 and plus 2x ′ provided by one of L 2 , R 1 . In total it makes 10x + 2x ′ . On the other hand, if Color(L 2 ) ̸ = Color(R 1 ), then together L 2 and R 1 provide 7x + 4x ′ , for each of two possible colorings of the bottom blocks, and L 1 and R 2 provide 2x, in total it is 9x+4x ′ . This case is reachable, because we can choose the leftmost bottom block to have a color opposite to Color(L 1 ). As Color(R 2 ) is not fixed, we can choose the right one that will add x as well. So we have to satisfy the inequality 10x + 2x ′ < 9x + 4x ′ .

We assumed that 2x ′ > x so the inequality holds and thus the second case is optimal. We should note that, in the second case, L 1 and R 2 have the same color because the leftmost and the rightmost bottom blocks are of the same color. We have shown that L 1 and R 2 are colored similarly and that L 2 and R 1 are colored differently.

Lemma A.6.6. Consider some switch gadget of H. For any maximum cut partition of H, the colorings of both levels will be alternating except for at most η intervals within B top 1 or B top 4 .

Proof. Let the number of red and blue long intervals overlapping the switch gadget be r and b respectively, and denote the quantity (r -b) by ∆. Suppose that r > b. Let y i , z j , for i ∈ [4], j ∈ [9], be the same as in Lemma A.6.5. Compute the size of the cut: Consider only those summands that participate in the size of the cut when the coloring of the blocks alternates, i.e. when, for all i, j, y i = z j = 0:

If we choose x > (2∆+1) 2 2 + 11 4 ∆ 2 , then the distance between some variable (except for y 1 , y 4 ) and the closest end of its domain cannot be greater than ∆. For example, suppose that min(z 1 , x -z 1 ) > ∆. Then (x -z 1 )z 1 > ∆x + 11 16 ∆ 2 , and so

Cut ≤ Cut alter -(x -z 1 )z 1 + ∆ 2 (y 1 -y 4 ) + 11 16 ∆ 2 < Cut alter .

So, in this case it will not be a maximum cut. Suppose that |z j -z j+1 | > ∆, then either |z j -z j+1 | > 2x -2∆ when j ̸ ∈ {1, 4, 5, 8}, or |z j -z j+1 | > x -2∆ when j ∈ {1, 8}. But then one of the clauses will be greater than (x -2∆ -∆/4) 2 , hence, greater than ∆x + 11 16 ∆ 2 . Similarly, |y 2 -y 3 | < ∆. Consider the variables z 4 , z 5 , z 6 . Choose x ′ between x/2 and x such that (2x ′ -2x + 2∆ + ∆/4) 2 is Switch procedure Consider some adjacent vertices g i , g j of the cubic graph G, they correspond to two vertex gadgets V i , V j and to an edge gadget E ij in the interval model of H. It might be that there is another vertex gadget V ′ between V i and V j . Consequently, there is a join gadget corresponding to V ′ between any pair of join gadgets of V i , V j . We do not want any gadget to intersect E ij , so we have to switch some long interval chain starting from V i with all three long interval chains that start from V ′ , and similarly for any other vertex gadget between V i and V j .

We solve this issue by the switch procedure. It is displayed on Figure A.9. The line R is split into zones and buffers between zones. Each zone (or buffer) is a disjoint union of fragments of the same size, where the distance between two neighbor fragments is the same and depends on the long interval length α. Every zone corresponds to some vertex gadget, it contains the vertex gadget and most of the join gadgets of link chains starting from it. Every fragment of Buffer(i, i + 1) is placed between the fragments of Zone(i) and Zone(i + 1), for any pair of neighbor vertex gadgets V i and V i+1 . Buffer(i, i + 1) contains switch gadgets that are used to let a chain starting from V i pass all three chains starting from V i+1 , this is exactly what is shown on Figure A.9. By repeatedly iterating the switching, we pass all the vertex gadgets between V i and V j and eventually connect the corresponding long interval chains to a common edge gadget E ij . In order to justify the correctness of Figure A.9, we describe precise positions of each gadget and long interval within each zone during this procedure.

Suppose that α = 53n -3. All the intervals are going to be inside [0, +∞). This ray is divided into zones.

• Zones that correspond to vertices of G. For a vertex g i ∈ V (G), denote the corresponding zone by Zone(i) and define it as Zone(i) = j∈Z 53i + j(α + 3), 53i + j(α + 3) + 32 .

This zone usually contains the vertex and the join gadgets corresponding to g i ∈ V (G). The size of its fragments is 32. The distance between the start of the ith interval and the start of the (i + 1)th interval is called the phase.

• Buffer zones. For two vertices g i , g i+1 ∈ V (G) (and also g n-1 , g 0 ), we introduce a buffer zone between Zone(i), Zone(i + 1). It is denoted by Buffer(i, i + 1) (Buffer(n -1, 0) is denoted similarly) and is defined as follows:

Buffer(i, i + 1) = j∈Z 53i + j(α + 3) + 32, 53(i + 1) + j(α + 3) .

We need buffer zones in order to do the switching. Every fragment o f a buffer zone has size 21.

We need to write α + 3 instead of α because a long interval must start from the rightmost block of some 3-block and must terminate at the leftmost block of another 3-block. So, the length of long intervals must be lesser than the length of the phase by 3. Call by a point x of Buffer(i, i + 1) a set of points {53i + (j + 3)α + 32 + x | j ∈ Z}. As the minimal distance between two points of this set is exactly α and as we always attach just one long interval, it can be uniquely understood which point of the set is considered at the moment. Reduction At first, we return to the three conditions about H that we stated in Appendix A.3 and that we assumed to hold. We need to verify that the graph H that we have just constructed indeed satisfies them. Clearly, we are free to choose x, k to be in Ω(n 6 ). In total, there are 3n long intervals starting from vertex gadgets, so every block is intersected by at most 3n long intervals. Every long interval overlaps n -1 zone and n buffers, each zone contains a join gadget that has at most 10 3-blocks, each buffer contains at most one switch gadget that has 16 blocks. Thus, those 3 conditions hold for H.

Let us say that a partition of V (H) in 2 classes {R, B} is good if the following conditions hold.

1. For any gadget, its coloring is alternating or almost alternating except for B i 2 of a 3-block B i or one of B top 1 , B top 4 of a switch gadget that contain at most η intervals of the other color.

2. For any long interval L that starts from or terminates at a block B of size x ′ , x, or 2x, we have Color(L) ̸ = Color(B).

Lemma A.7.1. Any MaxCut partition of H is good.

Proof. The first condition is provided by Lemma A.6.1, Lemma A.6.2, Lemma A.6.4, and Lemma A.6.6. Assume that the second condition does not hold for some long interval L, suppose that it starts from a block B of size at least x ′ > x 2 and Color(L) = Color(B). L is a part of some long interval chain that connects a vertex gadget V to an edge gadget E. Invert Color(L) and modify the colors of all gadgets and long intervals of this chain that are between L and E so that this particular chain satisfies the second condition. The gain after this operation is at least x because Color(L) ̸ = Color(B). Denote by l the number of long intervals in the chain, it is at most 3n × 9 × 3n 2 . The loss is at most the sum of the following values:

• k, if both intervals terminating at E have the same color;

• ηµl -the cut between the gadgets of H overlapped by the intervals of the chain, where η is an upper bound for the number of long intervals overlapping a gadget and µ is an upper bound on blocks that a long interval intersects;