On the Descriptive Complexity of Color Coding

01/10/2019 ∙ by Max Bannach, et al. ∙ Universität Lübeck 0

Color coding is an algorithmic technique used in parameterized complexity theory to detect "small" structures inside graphs. The idea is to derandomize algorithms that first randomly color a graph and then search for an easily-detectable, small color pattern. We transfer color coding to the world of descriptive complexity theory by characterizing -- purely in terms of the syntactic structure of describing formulas -- when the powerful second-order quantifiers representing a random coloring can be replaced by equivalent, simple first-order formulas. Building on this result, we identify syntactic properties of first-order quantifiers that can be eliminated from formulas describing parameterized problems. The result applies to many packing and embedding problems, but also to the long path problem. Together with a new result on the parameterized complexity of formula families involving only a fixed number of variables, we get that many problems lie in FPT just because of the way they are commonly described using logical formulas.



There are no comments yet.


page 1

page 2

page 3

page 4

This week in AI

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

1 Introduction

Descriptive complexity provides a powerful link between logic and complexity theory: We use a logical formula to describe a problem and can then infer the computational complexity of the problem just from the syntactic structure of the formula. As a striking example, Fagin’s Theorem [10] tells us that 3-colorability lies in just because its describing formula (“there exist three colors such that all adjacent vertex pairs have different colors”) is an existential second-order formula. In the context of fixed-parameter tractability theory, methods from descriptive complexity are also used a lot – but commonly to show that problems are difficult. For instance, the A- and W-hierarchies are defined in logical terms [12], but their hard problems are presumably “beyond” the class of fixed-parameter tractable problems.

The methods of descriptive complexity are only rarely used to show that problems are in . More precisely, the syntactic structure of the natural logical descriptions of standard parameterized problems found in textbooks are not known to imply that the problems lie in – even though this is known to be the case for many of them. To appreciate the underlying difficulties, consider the following three parameterized problems: , , and . In each case, we are given an undirected graph as input and a number and we are then asked whether the graph contains vertex-disjoint edges (a size- matching),  vertex-disjoint triangles, or a clique of size , respectively. The problems are known to have widely different complexities (maximal matchings can actually be found in polynomial time, triangle packing lies at least in , while finding cliques is -complete) but very similar logical descriptions:


The family of formulas is clearly a natural “slicewise” description of the matching problem: A graph has a size- matching if, and only if, . The families and are natural parameterized descriptions of the triangle packing and the clique problems, respectively. Well-known results on the descriptive complexity of parameterized problems allow us to infer [12] from the above descriptions that all three problems lie in , but offer no hint why the first two problems actually lie in the class – syntactically the clique problem arguably “looks like the easiest one” when in fact it is semantically the most difficult one. The results of this paper will remedy this: We will show that the syntactic structures of the formulas and imply membership of and in .

The road to deriving the computational complexity of parameterized problems just from the syntactic properties of slicewise first-order descriptions involves three major steps: First, a characterization of when the color coding technique is applicable in terms of syntactic properties of second-order quantifiers. Second, an exploration of how these results on second-order formulas apply to first-order formulas, leading to the notion of strong and weak quantifiers and to an elimination theorem for weak quantifiers. Third, we add a new characterization to the body of known characterizations of how classes like can be characterized in a slicewise fashion by logical formulas.

Our Contributions I: A Syntactic Characterization of Color Coding.

The hard triangle packing problem from above becomes almost trivial when we just wish to check whether a vertex-colored graph contains a red triangle, a green triangle, a blue triangle, a yellow triangle, and so on for different colors. The ingenious idea behind the color coding technique of Alon, Yuster, and Zwick [1] is to reduce the original problem to the much simpler colored version by simply randomly coloring the graph. Of course, even if there are  disjoint triangles, we will most likely not color them monochromatically and differently, but

the probability of “getting lucky” is nonzero and depends only on the parameter 

. Even better, Alon et al. point out that one can derandomize the coloring easily by using universal hash functions to color each vertex with its hash value.

Applying this idea in the setting of descriptive complexity was recently pioneered by Chen et al. [6]. Transferred to the triangle packing problem, their argument would roughly be: “Testing for each color  whether there is a monochromatic triangle of color  can be done in first-order logic using something like . Next, instead of testing whether has color  using the formula , we can test whether gets hashed to by a hash function. Finally, since computing appropriate universal hash functions only involves addition and multiplication, we can express the derandomized algorithm using an arithmetic first-order formula of low quantifier rank.” Phrased differently, Chen et al. would argue that together with the requirement that the are pairwise disjoint is (ignoring some details) equivalent to , where is a formula that is true when “ is hashed to  by a member of a universal family of hash functions indexed by and .”

The family may seem rather technical and, indeed, its importance becomes visible only in conjunction with another result by Chen et al. [6]: They show that a parameterized problem lies in , one of the smallest “sensible” subclasses of , if it can be described by a family of formulas of bounded quantifier rank such that the finite models of are exactly the elements of the th slice of the problem. Since the triangle packing problem can be described in this way via the family of formulas, all of which have a quantifier rank plus the constant number of quantifiers used to express the arithmetics in the formulas , we get .

Clearly, this beautiful idea cannot work in all situations: If it also worked for the formula mentioned earlier expressing 3-colorability, 3-colorability would be first-order expressible, which is known to be impossible. Our first main contribution is a syntactic characterization of when the color coding technique is applicable, that is, of why color coding works for triangle packing but not for 3-colorability: For triangle packing, the colors are applied to variables only inside existential scopes (“”) while for 3-colorability the colors , , and are also applied to variables inside universal scopes (“for all adjacent vertices”). In general, see Theorem 3.1 for the details, we show that a second-order quantification over an arbitrary number of disjoint colors can be replaced by a fixed number of first-order quantifiers whenever none of the is used in a universal scope.

Our Contributions II: New First-Order Quantifier Elimination Rules.

The “purpose” of the colors  in the formulas is not that the three vertices of a triangle get a particular color, but just that they get a color different from the color of all other triangles. Indeed, our “real” objective in these formulas is to ensure that the vertices of a triangle are distinct from the vertices in the other triangles – and giving vertices different colors is “just a means” of ensuring this.

In our second main contribution we explore this idea further: If the main (indeed, the only) use of colors in the context of color coding is to ensure that certain vertices are different, let us do away with colors and instead focus on the notion of distinctness. To better explain this idea, consider the following family, also describing triangle packing, where the only change is that we now require (a bit superfluously) that even the vertices inside a triangle get different colors: . Observe that each is now applied to exactly one variable (, , or in one of the many literals) and the only “effect” that all these applications have is to ensure that the variables are different. In particular, the formula is equivalent to


and these formulas are clearly equivalent to the almost identical formulas from (2).

In a sense, in (4) the many existential quantifiers and the many literals come “for free” from the color coding technique, while , , and have nothing to do with color coding. Our key observation is a syntactic property that tells us whether a quantifier comes “for free” in this way (we will call it weak) or not (we will call it strong): Definition 3.4 states (essentially) that weak quantifiers have the form such that is not free in any universal scope of and is used in at most one literal that is not of the form . To make weak quantifiers easier to spot, we mark their bound variables with a dot (note that this is a “syntactic hint” without semantic meaning). Formulas (4) now read . Observe that , , and are not weak since each is used in three literals that are not inequalities.

We show in Theorem 3.5 that each is equivalent to a whose quantifier rank depends only on the strong quantifier rank of  (meaning that we ignore the weak quantifiers) and whose number of variables depends only on the number of strong variables in . For instance, the formulas from (4) all have strong quantifier rank  and, thus, the triangle packing problem can be described by a family of constant (normal) quantifier rank. Applying Chen et al.’s characterization yields membership in .

As a more complex example, let us sketch a “purely syntactic” proof of the result [3, 5] that the embedding problem for graphs  of tree depth at most  lies in for each . Once more, we construct a family of formulas of constant strong quantifier rank that describes the problem. For a graph and a rooted tree  of depth  such that is contained in ’s transitive closure (this is the definition of “ has tree depth ”), let be the root of  and let be the children of  in . Then the following formula of strong quantifier rank  describes that can be embedded into a structure:

Our Contributions III: Slicewise Descriptions and Variable Set Sizes.

Our third contribution is a new result in the same vein as the already repeatedly mentioned result of Chen et al. [6]: Theorem 2.3 states that a parameterized problem can be described slicewise by a family of arithmetic first-order formulas that all use only a bounded number of variables if, and only if, the problem lies in – a class that has been encountered repeatedly in the literature [2, 3, 8, 17], but for which no characterization was known. It contains all parameterized problems that can be decided by -circuits whose depth depends only on the parameter and whose size is of the form .

As an example, consider the problem of deciding whether a graph contains a path of length 

(no vertex may be visited twice). It can be described (for odd 

) by: . Note that, now, the strong quantifier rank depends on  and, thus, is not constant. However, there are now only four strong variables, namely , , , and . By Theorem 3.5 we see that the above formulas are equivalent to a family of formulas with a bounded number of variables and by Theorem 2.3 we see that . These ideas also generalize easily and we give a purely syntactic proof of the seminal result from the original color coding paper [1] that the embedding problem for graphs of bounded tree width lies in . The core observation – which unifies the results for tree width and depth – is that for each graph with a given tree decomposition, the embedding problem can be described by a formula whose strong nesting structure mirrors the tree structure and whose strong variables mirror the bag contents.

Related Work.

Flum and Grohe [11] were the first to give characterizations of and of many subclasses in terms of the syntactic properties of formulas describing their members. Unfortunately, these syntactic properties do not hold for the descriptions of parameterized problems found in the literature. For instance, they show that contains exactly the problems that can be described by families of -formulas of bounded quantifier rank – but actually describing problems like in this way is more or less hopeless and yields little insights into the structure or complexity of the problem. We believe that it is no coincidence that no applications of these beautiful characterizations to concrete problems could be found in the literature – at least prior to very recent work by Chen and Flum [7], who study slicewise descriptions of problems on structures of bounded tree depth, and the already cited article of Chen et al. [6], who do present a family of formulas that describe the vertex cover problem. This family internally uses the color coding technique and is thus closely related to our results. The crucial difference is, however, that we identify syntactic properties of logical formulas that imply that the color coding technique can be applied. It then suffices to find a family describing a given problem that meets the syntactic properties to establish the complexity of the problem: there is no need to actually construct the color-coding-based formulas – indeed, there is not even a need to understand how color coding works in order to decide whether a quantifier is weak or strong.

Organization of this Paper.

In Section 2 we first review some of the existing work on the descriptive complexity of parameterized problems. We add to this work in the form of the mentioned characterization of the class in terms of a bounded number of variables. Our main technical results are then proved in Section 3, where we establish and prove the syntactic properties that formulas must have in order for the color coding method to be applicable. In Section 4 we then apply the findings and show how membership of different natural problems in and (and, thus, in ) can be derived entirely from the syntactic structure of the formulas describing them.

2 Describing Parameterized Problems

A happy marriage of parameterized complexity and descriptive complexity was first presented in [11]. We first review the most important definitions from [11] and then prove a new characterization, namely of the class that contains all problems decidable by AC-circuits of parameter-dependent depth and “-like” size. Since the results and notions will be useful later, but do not lie at the paper’s heart, we keep this section brief.

Logical Terminology.

We only consider first-order logic and use standard notations, with the perhaps only deviations being that we write relational atoms briefly as instead of and that the literal is an abbreviation for (recall that a literal is an atom or a negated atom). Signatures, typically denoted , are always finite and may only contain relation symbols and constant symbols – with one exception: The special unary function symbol may also be present in a signature. Let us write for the -fold application of , so is short for . It allows us to specify any fixed non-negative integer without having to use additional variables. An alternative is to dynamically add constant symbols for numbers to signatures as done in [6], but we believe that following [11] and adding the successor function gives a leaner formal framework. Let be the maximum arity of relation symbols in .

We denote by the class of all -structures and by the universe of . As is often the case in descriptive complexity theory, we only consider ordered structures in which the ternary predicates and are available and have their natural meaning. Formally, we say is arithmetic if it contains all of the predicates , , , the function symbol , and the constant symbol  (it is included for convenience only). In this case, contains only those for which is a linear ordering of and the other operations have their natural meaning relative to (with the successor of the maximum element of the universe being itself and with being the minimum with respect to ). We write when is a -formula for an arithmetic .

A -problem is a set closed under isomorphisms. A -formula describes a -problem if and it describes eventually if describes a set that differs from only on structures of a certain maximum size.

Lemma 2.1.

For each that describes a -problem eventually, there are quantifier-free formulas and such that describes .


The statement of the lemma would be quite simple if we did not require and  to be quantifier-free: Without this requirement, all we need to do is to use and to fix on the finitely many (up to isomorphisms) structures on which errs by “hard-wiring” which of these structures are elements of and which are not. However, the natural way to do this “hard-wiring” of size- structures is to use  quantifiers to bind all elements of the universe. This is exactly what we do not wish to do. Rather, we use the successor function to refer to the elements of the universe without using any quantifiers.

In detail, let be a number such that for all with (that is, the size of the universe is at least ) we have if, and only if, . We set to , a shorthand for , which is true only for universes of size at least . We define so that it is true exactly for all -structures of size at most  (for simplicity we assume that is the only relation symbol in ):

We write for the quantifier rank of a formula and for the set of its bound variables. For instance, for we have , since the maximum nesting is caused by the two nested existential quantifiers, and .

Let us say that is in negation normal form if negations are applied only to atomic formulas.

Describing Parameterized Problems.

When switching from classical complexity theory to descriptive complexity theory, the basic change is that “words” get replaced by “finite structures.” The same idea works for parameterized complexity theory and, following Flum and Grohe [11], let us define parameterized problems as subsets where is closed under isomorphisms. In a pair the number  is, of course, the parameter value of the pair. Flum and Grohe now propose to describe such problems slicewise using formulas. Since this will be the only way in which we describe problems, we will drop the “slicewise” in the phrasings and just say that a computable family of formulas describes a problem if for all we have if, and only if, . One can also define a purely logical notion of reductions between two problems and , but we will need this notion only inside the proof of Theorem 4.2 and postpone the definition till then.

For a class of computable families , let us write for the class of all parameterized problems that are described by the members of  (we chose “” to represent a “slicewise” description, which seems to be in good keeping with the usual use of in other classes such as or ). For instance, the mentioned characterization of in logical terms by Flum and Grohe can be written as .

We remark that instead of describing parameterized problems using families, a more standard and at the same time more flexible way is to use reductions to model checking problems. Clearly, if a family of -formulas describes , then there is a very simple parameterized reduction from  to the model checking problem , where the input is a pair and the question is whether both and hold. (The function encodes mathematical objects like or later tuples like as unique natural numbers.) The reduction simply maps a pair to . Even more interestingly, without going into any of the technical details, it is also not hard to see that as long as a reduction is sufficiently simple, the reverse implication holds, that is, we can replace a reduction to the model checking problem by a family of formulas that describe the problem. We can, thus, use whatever formalism seems more appropriate for the task at hand and – as we hope that this paper shows – it is sometimes quite natural to write down a family that describes a problem.

Parameterized Circuits.

For our descriptive setting, we need to slightly adapt the definition of the circuit classes and from [2, 3]: Let us say that a problem is in , if there is a family of AC-circuits (Boolean circuits with unbounded fan-in) such that for all we have, first, if, and only if, where is a binary encoding of ; second, the size of is at most for some computable function ; third, the depth of is bounded by a constant; and, fourth, the circuit family satisfies a dlogtime-uniformity condition. The class is defined the same way, but the depth may be for some computable  instead of only . The following fact and theorem show how these two circuit classes are closely related to descriptions of parameterized problems using formulas:

Fact 2.2 ([6]).


Theorem 2.3.



The basic idea behind the proof is quite “old”: we need to establish links between circuit depth and size and the number of variables used in a formula – and such links are well-known, see for instance [18]: The quantifier rank of a first-order formula naturally corresponds to the depth of a circuit that solves the model checking problem for the formula. The number of variables corresponds to the exponent of the polynomial that bounds the size of the circuit (the paper [15] is actually entitled ). One thing that is usually not of interest (because only one formula is usually considered) is the fact that the length of the formula is linked multiplicatively to the size of the circuit.

In detail, suppose we are given a problem with via a circuit family of depth and size . For a fixed , we now need to construct a formula that correctly decides the -th slice. In other words, we need a -formula whose finite models are exactly those on which the family (note that no longer indexes the family) evaluates to  (when the models are encoded as bitstrings). It is well-known how such a formula can be constructed, see for instance [18], we just need a closer look at how the quantifier rank and number of variables relate to the circuit depth and size.

The basic idea behind the formula is the following: The circuit has gates and we can “address” these gates using variables (which gives us possibilities) plus a number (which gives us possibilities). Since for fixed  the number is also fixed, it is permissible that the formula contains copies of some subformula, where each subformula handles another value of . The basic idea is then to start with formulas  for , each of which has free variables, so that is true exactly if the tuple represents an input gate set to . At this point, the uniformity condition basically tells us that such formulas can be constructed and that they all have a fixed quantifier rank. Next, we construct formulas that are true if addresses a gate for which the input values are all already computed by the and that evaluates to . Next, formulas are constructed, but, now, we can reuse the variables used in the . In this way, we finally build formulas and apply it to the “address” of the output gate. All told, we get a formula whose quantifier rank is and in which at most variables are used (note that the size of the formula depends on ). Clearly, this means that the family created in this way does, indeed, only use a bounded number of variables (namely many) and decides .

For the other direction, suppose describes and that all contain at most  variables (since they contain no free variables, this is same as the number of bound variables). Clearly, we may assume that the are in negation normal form. We may also assume that they are flat, by which we mean that they contain no subformulas of the form or : using the distributive laws of propositional logic, any first-order formula can be turned into an equivalent flat formula with the same number of variables and the same quantifier rank. Lastly, we may assume that the function symbol is only used in atoms of the form for some variable  and some number : We can replace for instance by the equivalent formula without raising the number of variables and the quantifier rank by more than (or, in general, by more than the constant ).

As before, it is now known that for each there is a family that evaluates to  exactly on the (encoded) models of . These circuits are constructed as follows: While has no free variables, a subformula of can have up to free variables. For each such subformula, the circuits use gates to keep track of all assignments to these  variables that make the subformula true. Clearly, this is relatively easy to achieve for literals in a constant number of layers, including literals of the form since is a fixed number depending only on . Next, if a formula is of the form and for some assignment we have one gate for each that tells us whether it is true, we can feed all these wires into one -gate. We can take care of a formula of the form in the same way – and note that in a flat formula there will be at most one alternation from to before we encounter a quantifier. Now, for subformulas of the form , the correct values for the gates can be obtained by a big -gate attached to the outputs from the gates for . Similarly, can be handled using a big -gate.

Based on these observations, it is now possible to build a circuit of size and depth . In particular, the resulting overall circuit family has a depth that depends only on the parameter (since the quantifier rank can be at most , which depends only on ) and has a size of at most for . It can also be shown that the necessary uniformity conditions are satisfied.

We remark that the above proof also implies Fact 2.2, namely for for the first direction and for for the second direction. ∎

3 Syntactic Properties Allowing Color Coding

The color coding technique [1] is a powerful method from parameterized complexity theory for “discovering small objects” in larger structures. Recall the example from the introduction: While finding disjoint triangles in a graph is difficult in general, it is easy when the graph is colored with colors and the objective is to find for each color one triangle having this color. The idea behind color coding is to reduce the (hard) uncolored version to the (easy) colored version by randomly coloring the graph and then “hoping” that the coloring assigns a different color to each triangle. Since the triangles are “small objects,” the probability that they do, indeed, get different colors depends only on . Even more importantly, Alon et al. noticed that we can derandomize the coloring procedure simply by coloring each vertex by its hash value with respect to a simple family of universal hash functions that only use addition and multiplication [1]. This idea is beautiful and works surprisingly well in practice [14], but using the method inside proofs can be tricky: On the one hand, we need to “keep the set sizes under control” (they must stay roughly logarithmic in size) and we “need to actually identify the small set based just on its random coloring.” Especially for more complex proofs this can lead to rather subtle arguments.

In the present section, we identify syntactic properties of formulas that guarantee that the color coding technique can be applied. The property is that the colors (the predicates  in the formulas) are not in the scope of a universal quantifier (this restriction is necessary, as the example of the formula describing 3-colorability shows).

As mentioned already in the introduction, the main “job” of the colors in proofs based on color coding is to ensure that vertices of a graph are different from other vertices. This leads us to the idea of focusing entirely on the notion of distinctness in the second half of this section. This time, there will be syntactic properties of existentially bounded first-order variables that will allow us to apply color coding to them.

3.1 Formulas With Color Predicates

In graph theory, a coloring of a graph can either refer to an arbitrary assignment that maps each vertex to a color or to such an assignment in which vertices connected by an edge must get different colors (sometimes called proper colorings). For our purposes, colorings need not be proper and are thus partitions of the vertex set into color classes. From the logical point of view, each color class can be represented by a unary predicate. A -coloring of a -structure is a structure over the signature , where the are fresh unary relation symbols, such that is the -restriction of and such that the sets to form a partition of the universe  of .

Let us now formulate and prove the first syntactic version of color coding. An example of a possible formula in the theorem is , for which the theorem tells us that there is a formula of constant quantifier rank that is true exactly when there are pairwise disjoint sets  that make true.

Theorem 3.1.

Let be an arithmetic signature and let be a number. For each first-order -sentence in negation normal form in which no  is inside a universal scope, there is a -sentence such that:

  1. For all we have if, and only if, there is a -coloring of with .

  2. .

  3. .

(Let us clarify that represents a global constant that is independent of and .)


Let , , and be given as stated in the theorem. If necessary, we modify to ensure that there is no literal of the form , by replacing each such literal by the equivalent . After this transformation, the in are neither in the scope of universal quantifiers nor of negations – and this is also true for all subformulas  of . We will now show by structural induction that all these subformulas (and, hence, also ) have two semantic properties, which we call the monotonicity property and the small witness property (with respect to the ). Afterwards, we will show that these two properties allow us to apply the color coding technique.

Establishing the Monotonicity and Small Witness Properties.

Some notations will be useful: Given a -structure with universe and given sets for , let us write to indicate that is a model of where is the -structure with universe in which all symbols from are interpreted as in  and in which the symbol  is interpreted as , that is, . Subformulas of  may have free variables and suppose that to are the free variables in  and let for . We write to indicate that holds in the just-described structure  when each is interpreted as .

Definition 3.2.

Let be a -formula with free variables to . We say that has the monotonicity and the small witness properties with respect to the if for all -structures with universe  and all values the following holds:

  1. Monotonicity property: Let and be sets with for all . Then implies .

  2. Small witness property: If there are any pairwise disjoint sets such that , then there are sets whose sizes depend only on for , such that .

We now show that has these two properties (for ). For monotonicity, just note that the  are not in the scope of any negation and, thus, if some make true, so will all supersets  of the .

To see that the small witness property holds, we argue by structural induction: If is any formula that does not involve any , then is true or false independently of the and, in particular, if it is true at all, it is also true for for . If is the atomic formula , then setting and for makes the formula true.

If , then and have the small witness property by the induction hypothesis. Let make hold in . Then they also make both and hold in . Let with be the witnesses for and let be the witnesses for . Then by the monotonicity property, makes both and true, that is

and the same holds for . Note that still holds and that they have sizes depending only on and  and thereby on .

For we can argue in exactly the same way as for the logical and.

The last case for the structural induction is . Consider pairwise disjoint that make true. Then there is a value such that . Now, since has the small witness property by the induction hypothesis, we get of size depending on for which we also have . But then, by the definition of existential quantifiers, these also witness . (Observe that this is the point where the argument would not work for a universal quantifier: Here, for each possible value of we might have a different set of ’s as witnesses and their union would then no longer have small size.)

Applying Color Coding.

Our next step in the proof is to use color coding to produce the partition. First, let us recall the basic lemma on universal hash functions formulated below in a way equivalent to [12, page 347]:

Lemma 3.3.

There is an such that for all and all subsets there exist a prime and a number such that the function is injective on .

As has already been observed by Chen et al. [6], if we set we can easily express the computation underlying using a fixed -formula . That is, if we encode the numbers as corresponding elements of the universe with respect to the ordering of the universe, then holds if, and only if, . Note that the and from the lemma could exceed for very large  (they can reach up to ), but, first, this situation will not arise in the following and, second, this could be fixed by using three variables to encode and three variables to encode . Trivially, has some constant quantifier rank (the formula explicitly constructed by Chen et al. has , assuming ).

Next, we will need the basic idea or “trick” of Alon et al.’s [1] color coding technique: While for appropriate and the function will “just” be injective on , we actually want a function that maps each element to a specific element (“the color of ”) of . Fortunately, this is easy to achieve by concatenating with an appropriate function .

In detail, to construct from the claim of the theorem, we construct a family of formulas where and are new free variables and the formulas are indexed by all possible functions : In , replace every occurrence of by the following formula :

where and are fresh variables that we bind to the numbers and  (if the universe is large enough). Note that the formula has as a free variable, while additionally has and as free variables. As an example, for the formula we would have . Clearly, each has the property .

The desired formula is (almost) simply . The “almost” is due to the fact that this formula works only for structures with a sufficiently large universe – but by Lemma 2.1 it suffices to consider only this case. Let us prove that for every -structure with universe and for some to-be-specified constant , the following two statements are equivalent:

  1. There is a -coloring of with .

  2. .

Let us start with the implication of item 2 to 1. Suppose there is a function and elements such that . We define a partition by . In other words, contains all elements of that are first hashed to an element of that is then mapped to  by the function . Trivially, the form a partition of the universe .

Assuming that the universe size is sufficiently large, namely for , inside all uses of will have the property that if, and only if, . Clearly, there is a constant depending only on such that for all we have .

With the property established, we now see that holds inside the formula if, and only if, the interpretation of is an element of . This means that if we interpret each by , then we get and the form a partition of the universe. In other words, we get item 1.

Now assume that item 1 holds, that is, there is a partition with . We must show that there are a and such that .

At this point, we use the small witness property that we established earlier for the partition. By this property there are pairwise disjoint sets such that, first, depends only on and, second, . Let . Then depends only on and let be a -dependent upper bound on this size. By the universal hashing lemma, there are now and such that is injective on . But, then, we can set