Randomisation and Derandomisation in Descriptive Complexity Theory
Abstract
We study probabilistic complexity classes and questions of derandomisation from a logical point of view. For each logic L we introduce a new logic BPL, bounded error probabilistic L, which is defined from L in a similar way as the complexity class BPP, bounded error probabilistic polynomial time, is defined from P.
Our main focus lies on questions of derandomisation, and we prove that there is a query which is definable in BPFO, the probabilistic version of firstorder logic, but not in , finite variable infinitary logic with counting. This implies that many of the standard logics of finite model theory, like transitive closure logic and fixedpoint logic, both with and without counting, cannot be derandomised. Similarly, we present a query on ordered structures which is definable in BPFO but not in monadic secondorder logic, and a query on additive structures which is definable in BPFO but not in FO. The latter of these queries shows that certain uniform variants of (boundeddepth polynomial sized circuits) cannot be derandomised. These results are in contrast to the general belief that most standard complexity classes can be derandomised.
Finally, we note that BPIFP+C, the probabilistic version of fixedpoint logic with counting, captures the complexity class BPP, even on unordered structures.
7 (3:14) 2011 1–24 Nov. 17, 2010 Sep. 21, 2011
K. Eickmeyer]Kord Eickmeyer
F.4.1 [Mathematical Logic]: Finite Model Theory, F.1.2 [Modes of Computation]: Probabilistic Computation
1 Introduction
The relation between different modes of computation — deterministic, nondeterministic, randomised — is a central topic of computational complexity theory. The P vs. NP problem falls under this topic, and so does a second very important problem, the relation between randomised and deterministic polynomial time. In technical terms, this is the question of whether , where BPP is the class of all problems that can be solved by a randomised polynomial time algorithm with twosided errors and bounded error probability. This question differs from the question of whether in that most complexity theorists seem to believe that the classes P and BPP are indeed equal. This belief is supported by deep results due to Nisan and Wigderson [31] and Impagliazzo and Wigderson [20], which link the derandomisation question to the existence of oneway functions and to circuit lower bounds; cf. also [21]. Similar derandomisation questions are studied for other complexity classes such as logarithmic space, and it is believed that derandomisation is possible for these classes as well.
Descriptive complexity theory gives logical descriptions of complexity classes and thus enables us to translate complexity theoretic questions into the realm of logic. While logical descriptions are known for most natural deterministic and nondeterministic time and space complexity classes, probabilistic classes such as BPP have received very little attention in descriptive complexity theory yet. In this paper, we study probabilistic complexity classes and questions of derandomisation from a logical point of view. For each logic L we introduce a new logic BPL, bounded error probabilistic L, which is defined from L in a similar way as BPP is defined from P. The randomness is introduced to the logic by letting formulas of vocabulary speak about random expansions of structures to a richer vocabulary . We also introduce variants RL, coRL with onesided bounded error and PL with unbounded error, corresponding to other well known complexity classes.
Our main technical results are concerned with questions of derandomisation. By this we mean upper bounds on the expressive power of randomised logics in terms of classical logics. Trivially, BPL is at least as expressive as L, and if the two logics are equally expressive, then we say that BPL derandomisable. More generally, if is a (deterministic) logic that is at least as expressive as BPL, then we say that BPL derandomisable within . We prove that BPFO, bounded error probabilistic firstorder logic, is not derandomisable within , finite variable infinitary logic with counting. This implies that many of the standard logics of finite model theory, like transitive closure logic and fixedpoint logic, both with and without counting, cannot be derandomised. Note that these results are in contrast to the general belief that most standard complexity classes can be derandomised.
We then investigate whether BPFO can be derandomised on classes of structures with builtin relations, such as ordered structures and arithmetic structures. We prove that BPFO cannot be derandomised within MSO, monadic secondorder logic, on structures with builtin order. Furthermore, BPFO cannot be derandomised on structures with builtin order and addition. Interestingly and nontrivially, BPFO can be derandomised within MSO on structures with builtin order and addition. Behle and Lange [5] showed that the expressive power of FO on classes of ordered structures with certain predefined relation symbols corresponds to uniform subclasses of , the class of problems decidable by circuit families of bounded depth, unbounded fanin and polynomial size. In fact, for any set of builtin relations they show that captures uniform . Arguably the most intensively studied uniformity condition on is dlogtimeuniform , which corresponds to , firstorder logic with builtin arithmetic (Barrington et al. [3]). The question of whether dlogtimeuniform can be derandomised is still open, but there is a conditional derandomisation by Viola [39]. There are less uniform variants of that can be proved to be derandomisable by standard arguments; cf. [1]. We prove that the more uniform uniform is not derandomisable. This raises the question of how weak uniformity must be for derandomisation to be possible.
In the last section of this paper, we turn to more standard questions of descriptive complexity theory. We prove that BPIFP+C, the probabilistic version of fixedpoint logic with counting, captures the complexity class BPP, even on unordered structures. For ordered structures, this result is a direct consequence of the ImmermanVardi Theorem [18, 38], and for arbitrary structures it follows from the observation that we can define a random order with high probability in BPIFP+C. Still, the result is surprising at first sight because of its similarity with the open question of whether there is a logic capturing P, and because it is believed that . The caveat is that the logic BPIFP+C does not have an effective syntax and thus is not a “logic” according to Gurevich’s [16] definition underlying the question for a logic that captures P. Nevertheless, we believe that BPIFP+C gives a completely adequate description of the complexity class BPP, because the definition of BPP is inherently ineffective as well (as opposed to the definition of P in terms of the decidable set of polynomially clocked Turing machines). We obtain similar descriptions of other probabilistic complexity classes. For example, randomised logspace is captured by the randomised version of deterministic transitive closure logic with counting.
Related work
As mentioned earlier, probabilistic complexity classes such as BPP have received very little attention in descriptive complexity theory. There is an unpublished paper due to Kaye [22] that gives a logical characterisation of BPP on ordered structures. Müller [30] and Montoya (unpublished) study a logical BPoperator in the context of parameterised complexity theory. What comes closest to our work “in spirit” and also in some technical aspects is Hella, Kolaitis, and Luosto’s work on almost everywhere equivalence [17], which may be viewed as a logical account of average case complexity in a similar sense that our work gives a logical account of randomised complexity. There is a another logical approach to computational complexity, known as implicit computational complexity, which is quite different from descriptive complexity theory. Mitchell, Mitchell, and Scedrov [28] give a logical characterisation of BPP by a higherorder typed programming language in this context.
Let us emphasise that the main purpose of this paper is not the definition of new probabilistic logics, but an investigation of these logics in a complexity theoretic context.
2 Preliminaries
2.1 Structures and Queries
A vocabulary is a finite set of relation symbols of fixed arities. A structure consists of a finite set , the universe of the structure, and, for all , a relation on whose arity matches that of . Thus we only consider finite and relational structures. Let be vocabularies with . Then the restriction of a structure is the structure with universe and relations for all . A expansion of a structure is a structure such that . For every class of structures, denotes the class of all structures in . A renaming of a vocabulary is a bijective mapping from to a vocabulary such that for all the relation symbol has the same arity as . If is a renaming and is a structure then is the structure with and for all .
We let , and be distinguished relation symbols of arity two, three and three, respectively. Whenever any of these relations symbols appear in a vocabulary , we demand that they be interpreted by a linear order and ternary addition and multiplication relations, respectively, in all structures. To be precise, let be the set for , and denote by the structure with
We demand for all structures . We call structures whose vocabulary contains any of these relation symbols ordered, additive and multiplicative, respectively. We say that a formula with exactly one free variable defines an element if in every structure it is satisfied by exactly one element. Since we may identify the elements of an ordered structure uniquely with natural numbers it makes sense to say, e.g., that “ defines a prime number” or “ defines a number ”, and we will sometimes do so.
On ordered structures, every fixed natural number can be defined in firstorder logic by a formula using only three variables as follows:
Because the ordering may be defined using the addition relation, the same holds true on additive structures, again using only three variables.
A ary global relation is a mapping that associates a ary relation with each structure . A ary global relation is usually called a Boolean global relation. We identify the two ary relations and , where denotes the empty tuple, with the truth values and , respectively, and we identify the Boolean global relation with the class of all structures with . A ary query is a ary global relation preserved under isomorphism, that is, if is an isomorphism from a structure to a structure then for all it holds that .
2.2 Logics
A logic L has a syntax that assigns a set of Lformulas of vocabulary with each vocabulary and a semantics that associates a global relation with every formula such that for all vocabularies the following three conditions are satisfied:

For all the global relation is a query.

If then , and for all formulas and all structures it holds that

If is a renaming, then for every formula there is a formula such that for all structures it holds that
Condition (ii) justifies dropping the vocabulary in the notation for the queries and just write . For a structure and a tuple whose length matches the arity of , we usually write instead of . If is a ary query, then we call a ary formula, and if is Boolean, then we call a sentence. Instead of we just write and say that satisfies . We omit the index L if L is clear from the context.
A query is definable in a logic L if there is an Lformula such that . Two formulas are equivalent (we write ) if they define the same query. We say that a logic is weaker than a logic (we write ) if every query definable in is also definable in . Similarly, we define it for and to be equivalent (we write ) and for to be strictly weaker than (we write ). The logics and are incomparable if neither nor .
Our notion of logic is very minimalistic, usually logics are required to meet additional conditions (see [8] for a thorough discussion). In particular, we do not require the syntax of a logic to be effective. Indeed, the main logics studied in this paper have an undecidable syntax. Our definition is in the tradition of abstract model theory (cf. [4]); proof theorists tend to have a different view on what constitutes a logic.
We assume that the reader has heard of the standard logics studied in finite model theory, specifically firstorder logic FO, secondorder logic SO and its fragments , monadic secondorder logic MSO, transitive closure logic TC and its deterministic variant DTC, least, inflationary, and partial fixedpoint logic LFP, IFP, and PFP, and finite variable infinitary logic . For all these logics except LFP there are also counting versions, which we denote by FO+C, TC+C, , PFP+C and , respectively. Only familiarity with firstorder logic is required to follow most of the technical arguments in this paper. The other logics are more or less treated as “black boxes”. We will say a bit more about some of them when they occur later. The following diagram shows how the logics compare in expressive power:
(1) 
Furthermore, MSO is strictly stronger than FO and incomparable with all other logics displayed in (1).
2.3 Complexity theory
We assume that the reader is familiar with the basics of computational complexity theory and in particular the standard complexity classes such as P and NP. Let us briefly review the class BPP, bounded error probabilistic polynomial time, and other probabilistic complexity classes: A language is in BPP if there is a polynomial time algorithm , expecting as input a string and a string of “random bits”, and a polynomial such that for every the following two conditions are satisfied:

If , then .

If , then .
In both conditions, the probabilities range over strings chosen uniformly at random. The choice of the error bounds and in (i) and (ii) is somewhat arbitrary, they can be replaced by any constants with without changing the complexity class. (To reduce the error probability of an algorithm we simply repeat it several times with independently chosen random bits .)
Hence BPP is the class of all problems that can be solved by a randomised polynomial time algorithm with bounded error probabilities. RP is the class of all problems that can be solved by a randomised polynomial time algorithm with bounded onesided error on the positive side (the bound in (ii) is replaced by ), and coRP is the class of all problems that can be solved by a randomised polynomial time algorithm with bounded onesided error on the negative side (the bound in (i) is replaced by ). Finally, PP is the class we obtain if we replace the lower bound in (i) by and the upper bound in (ii) by . Note that PP is not a realistic model of “efficient randomised computation”, because there is no easy way of deciding whether an algorithm accepts or rejects its input. Indeed, by Toda’s Theorem [37], the class contains the full polynomial hierarchy. By the SipserGács Theorem (see [24]), BPP is contained in the second level of the polynomial hierarchy. More precisely, . It is an open question whether . However, as pointed out in the introduction, there are good reasons to believe that .
2.4 Descriptive complexity
It is common in descriptive complexity theory to view complexity classes as classes of Boolean queries, rather than classes of formal languages. This allows it to compare logics with complexity classes. The translation between queries and languages is carried out as follows: Let be a vocabulary, and assume that . With each ordered structure we can associate a binary string in a canonical way. Then with each class of ordered structures we associate the language . For a Boolean query , let be the class of all ordered expansions of structures in . We say that is decidable in a complexity class K if the language is contained in K. We say that a logic L captures K if for all Boolean queries it holds that is definable in L if and only if is decidable in K. We say that L is contained in K if all Boolean queries definable in L are decidable in K.
3 Randomised logics
Throughout this section, let and be disjoint vocabularies. Relations over will be “random”, and we will reserve the letter for relation symbols from . We are interested in random expansions of structures. For a structure , by we denote the class of all expansions of . We view as a probability space with the uniform distribution. Note that we can “construct” a random by deciding independently for all ary and all tuples with probability whether . Hence if , where is ary, then a random can be described by random bitstring of length , where . We are mainly interested in the probabilities
that a random expansion of a structure satisfies a sentence of vocabulary of some logic.
Let L be a logic and .

A formula that defines a ary query has an gap if for all structures and all it holds that

The logic is defined as follows: For each vocabulary ,
where the union ranges over all vocabularies disjoint from . To define the semantics, let . Let such that and is ary. Then for all structures ,
It is easy to see that for every logic L and all with the logic satisfies conditions (i)–(iii) from Subsection 2.2 and hence is indeed a welldefined logic. We let
We can also define a logic and let . The following lemma, which is an adaptation of classical probability amplification techniques to randomised logics, shows that for reasonable L the strength of the logic does not depend on the exact choice of the parameters . This justifies the arbitrary choice of the constants in the definitions of RL and BPL.
Let L be a logic that is closed under conjunctions and disjunctions. Then for all with it holds that and
Proof.
Let an be disjoint relational vocabularies and let . For any we define a new vocabulary
where the arity of is that of . Using the renaming property with the renaming
that leaves fixed and maps to we get sentences , which are the sentence with every occurrence of replaced by . Since L is closed under conjunctions and disjunctions, for every there is an sentence
which is satisfied iff at least of the are satisfied. Notice that the use distinct random relations, so they are satisfied independently of each other.
Clearly, if then also , because we assumed . On the other hand, if for some , then
(2)  
(3) 
and this bound can be made arbitrarily close to by choosing sufficiently large. This proves the claim about RL.
For BPL, notice that if has an gap for some any , then for any there is an such that
has an gap. In fact, the Chernoff bound (see, e.g., [29]) gives very sharp estimates on in terms of , , and , though we only need the mere existence of such an here. ∎
3.1 First observations
We start by observing that the syntax of BPFO and thus of most other logics BPL is undecidable. This follows easily from Trakhtenbrot’s Theorem (see [9] for similar undecidability proofs):
For all with and all vocabularies containing at least one at least binary relation symbol, the set is undecidable.
Proof Sketch.
Assume for some and some containing a binary relation symbol the set is decidable.
By Trakhtenbrot’s Theorem (cf. [9, Thm. 7.2.1]), the satisfiability of a firstorder formula on finite graphs is undecidable. Let be the class of all graphs with exactly one isolated vertex, and let be a sentence defining on finite structures. By standard arguments, whether a formula is satisfiable in or on is undecidable.
Let with be a dyadic rational in the interval , and let be unary random relations. For every , the sentence
has satisfaction probability in all structures in . Thus for a family of distinct subsets of , the sentence
is satisfied with probability on such structures. But now the sentence
is in if and only if is not satisfiable on .∎
For each , let be the structure with universe . Recall the 01law for first order logic [12, 14]. In our terminology, it says that for each vocabulary and each sentence it holds that
(in particular, this limit exists). There is also an appropriate asymptotic law for formulas with free variables. This implies that on structures with empty vocabulary, PFO (and in particular BPFO) has the same expressive power as FO. As there is also a 01law for the logic [23], we actually get the following stronger statement:
Every formula is equivalent to a formula .
As FO+C is strictly stronger than FO even on structures of empty vocabulary, this observation implies that there are queries definable in FO+C, but not in .
Furthermore, the SipserGács Theorem [24] that , the fact that the fragment of secondorder logic captures [11, 36], and the observation that imply the following:
We will use Lautemann’s proof of the SipserGács Theorem in section 5 in the context of monadic secondorder logic.
We close this section by observing that randomised logics without probability gaps are considerably more powerful than their nonrandomised counterparts: {obs} Let be a class of finite structures such that there is a firstorder formula defining a single element in each structure of . Then every query on can be defined in PFO.
Proof.
Let be a query on , i.e., is of the form , where the are relation variables and is firstorder. We replace each of the by a random relation of the same arity to get a new sentence and introduce an extra unary random relation . Then is equivalent to the PFOsentence
because the first part is satisfied with probability exactly . ∎
Toda’s Theorem [37] that the polynomial hierarchy is contained in suggests that, in fact, every secondorder query is definable in PFO. However, Toda’s proof does not carry over easily to the PFOcase. Observation 3.1 suggests that some technical condition such as definability of an element of the structure is necessary to separate PFO from FO at all. One example of such a class is the class of all ordered structures, with defining the minimum element.
4 Separation results for BpFo
In this section we study the expressive power of the randomised logics RFO, coRFO, and BPFO. Our main results are the following: {iteMize}
RFO is not contained in
BPFO is not contained in MSO on ordered structures
RFO is stronger than FO on additive structures A forteriori, the first and the third result also hold with BPFO instead of RFO, and the constructions used in their proofs are also definable in coRFO.
It turns out that we need three rather different queries to get these separation results. For the first two queries this is obvious, because every query on ordered structures is definable in . The third query (on additive structures) is readily seen to be definable in MSO. In fact, in Section 5 we show the following: {iteMize}
Any BPFOdefinable query on additive structures can be defined in MSO.
4.1 Rfo is not contained in
Formulas of the logic may contain arbitrary (not necessarily finite) conjunctions and disjunctions, but only finitely many variables, and counting quantifiers of the form (“there exists at least such that ”). For example, the class of finite structures of even cardinality can be defined in this logic by the sentence
There is a class of structures that is definable in RFO and coRFO, but not in .
Recall that by Observation 3.1 there also is a class of structures definable in , but not in BPFO.
Our proof of Theorem 4.1 is based on a wellknown construction due to Cai, Fürer, and Immerman [6], who gave an example of a Boolean query in P that is not definable in . We modify their construction in a way reminiscent to a proof by Dawar, Hella, and Kolaitis [7] for results on implicit definability in firstorder logic, and obtain a query definable in (co)RFO, but not in . Just like in Cai, Fürer and Immerman’s original proof, the reason why can not define our query is its inability to choose one out of a pair of two elements. Using a random binary relation this can – with high probability – be done in FO.
We first review the construction of [6] and then show how to modify it to suit our needs. Given a graph , Cai et al. construct a new graph , replacing all vertices and edges of with certain gadgets. We shall call graphs resulting in this fashion CFIgraphs, and will from now on restrict ourselves to connected 3regular graphs and CFIgraphs resulting from these.
The construction is as follows: For each vertex in , we place a copy of the gadget shown on the left of Figure 1 in . It has a group of four nodes (henceforth called centre nodes) plus three pairs of nodes, which are to be thought of as ends of the three edges incident with that node. For the time being, we think of the pairs as ordered from to and distinguish between the two nodes in each pair, say one of them is the node, the other one being the node. Each of the four centre nodes is connected to one node from each pair, and each of them to an even number of ’s. To illustrate this, the centre nodes are labelled with the even subsets of . We also introduce an equivalence relation (or colouring, if you like) of nodes as shown in Figure 1, so any isomorphism of the gadget necessarily permutes nodes within each edge group and the centre group.
For each edge in , we connect the  and nodes in the corresponding pairs as shown on the right of Figure 1. We say an edge is “twisted” if the node of one pair is connected to the node of the other and vice versa. This completes our construction of . For definiteness, when we speak of an edge group we mean an equivalence class of size two, and by a centre group we mean one of size four. An edget is a pair of edge groups which form an edge gadget as on the right of Figure 1. Figure 2 shows the result of applying this construction to a small subgraph (a vertex with its three neighbours).
Without the  and labels, we cannot decide which of the edges have been twisted. In fact there are only two isomorphism classes of CFIgraphs derived from , namely those with an even number of edges twisted and those with an odd number (we call the latter ones twisted CFIgraphs). This relies on the fact that isomorphisms of the gadget on the left of Figure 1 are exactly those permutations swapping an even number of ’s and ’s. Since we assume to be connected, we can twist edges along a path between two nodes adjacent to twisted edges, reducing the number of twisted edges by two; cf. [6, Lemma 6.2] for details.
By [6, Thm. 6.4], if the original graph has no separator of size at most then the two isomorphism classes of CFI graphs derived from it can not be distinguished by a sentence , i.e., by a sentence with at most distinct variables. In P, on the other hand, twisted CFIgraphs can easily be recognised: Choose exactly one node from each edge group and label this one and the other one . A centre node is connected to an even number of ’s if and only if all four nodes in its centre group are. In this case we call the centre group even, otherwise we call it odd. Then a CFIgraph is twisted if and only if
We aim for a (co)RFOsentence which defines exactly the twisted connected 3regular CFIgraphs. In view of the above Palgorithm, we are done if we can {iteMize}
express connectedness of the graph,
count edgets and centre groups modulo two and
choose one representative from each centre group, edge group and edget.
For counting modulo two and to get representatives for centre groups and edgets, we augment the structures with a Boolean algebra in the following way: Let be the vocabulary , with unary and , and binary , , and . Let be the class of structures such that {iteMize}
defines a 3regular, connected CFIgraph on ,
is a Boolean algebra , and is true exactly for its members of even cardinality
defines a linear order on the set of atoms of (and no other element of is related to any other).
defines an equivalence relation, where each equivalence class {iteMize}
contains one atom of and the nodes of one edget
or contains one atom of and the nodes of one centre group
or consists of a single nonatom of . In particular, the number of atoms of the Boolean algebra is equal to the number of edgets plus the number of centre groups. Note also that we can distinguish the two edge groups in an edget because only nodes in the same edge group are connected to nodes in the same centre group.
The class is definable in FO. The subclass of twisted CFIgraphs is definable in BPFO but not in .
Proof.
That is definable is easy to establish, the only subtlety being that allows us to quantify over sets of centre groups, which makes connectedness expressible.
The proof that is not definable in is the same as in [6]; it is unaffected by the additional structure. Note that because the atoms are ordered, the Boolean algebra is rigid, i.e., it has no nontrivial automorphism, therefore the isomorphism group of a CFIgraph is not changed by adding the Boolean algebra.
It remains to show that twistedness can be defined in BPFO. We pick one vertex from each edge group by viewing a random binary relation as assigning an bit number to each vertex, where is the number of atoms in the Boolean algebra. From each pair, we choose the vertex with the smaller number, expressed by
where is an FOformula satisfied exactly by the atoms of the Boolean algebra. It is easy to see that if the random relation assigns a different set of atoms to the two vertices in each edge group, then succeeds in picking exactly one vertex from each edge group, and twistedness can then be checked by looking at the predicate of the element of which contains exactly the atoms equivalent to twisted centre groups or twisted edgets.
To prove that the resulting formula has a large probability gap, we need to establish a high probability of success only for structures in the class , because this class is FOdefinable. But in such structures, the probability that the two nodes of an edge group are assigned the same number is , so by a union bound the probability that we successfully pick one node from each group is at least
because there are less than edgets. Furthermore, we can check in FO whether there is an edge group whose members we can not distinguish, and choose to invariably reject or accept in these cases, resulting in an RFO or coRFO sentence, respectively. ∎
4.2 BpFo on ordered structures is not contained in Mso
In the presence of a linear order, any query becomes definable in , and the query becomes definable even in FO. However, randomisation adds expressive power to FO also on ordered structures:
There is a class of ordered structures that is definable in BPFO, but not in MSO.
Remember that monadic secondorder logic MSO is the the fragment of secondorder logic that allows quantification over individual elements and sets of elements.
Let , with binary relations and , and a unary predicate . We define two classes , of structures (cf. Figure 3):
is the class of all structures for which

defines a perfect matching on the set

the set forms a Boolean algebra with the relation and

no and are related

defines a linear order on the whole structure, which puts the before the and orders in such a way that matched elements are always successive.
It is easy to see that the class is definable in FO. is the subclass of whose elements satisfy the additional condition
(4) 
We will prove that is definable in BPFO, but not in MSO. To prove that is definable in BPFO, we will use the following lemma: {lem}[Birthday Paradox] Let and let be a random function drawn uniformly from the set of all such functions.

For any and there is an such that if and we have

For any , if , then
Proof.
For the first part, we note that
For the second part, note that
Proof of Theorem 4.2.
To see that is not definable in MSO, we use two simple and wellknown facts about MSO. The first is that for every there are natural numbers such that for all , a plain linear order of length is indistinguishable from the linear order of length by MSOsentences of quantifier rank at most . The same fact also holds for linear orders with a perfect matching on successive elements, because such a matching is definable in MSO anyway. The second fact we use is a version of the FefermanVaught Theorem (cf. [27, Thm. 1.5(ii)]): {thm} Suppose two structures and satisfy the same MSOsentences of quantifier rank up to , and let be another structure. Denote by (resp. ) the disjoint union of (resp. ) and . Then and satisfy the same MSOsentences of quantifier rank up to . The theorem also holds for the ordered disjoint union instead of the disjoint union, but in our case the elements of the individual structures in the disjoint union are definable anyway. If we put these two facts together, we see that for every there are such that for all the structure with parts of sizes , , respectively, is indistinguishable from the structure with parts of sizes and . We can easily choose and in such a way that and .
It remains to prove that is definable in BPFO. Consider the sentence
which states that the random binary relation , considered as a function
from to subsets of , is injective. By the definition of , the function is drawn uniformly from the set of all such functions. If we fix , the probability for to be injective increases monotonically with . Furthermore, for every structure in , the size of and are a power of two and an even number, respectively. Thus either
and this factor of translates into a probability gap for in all sufficiently large structures in , by Lemma 4.2 with , and . The remaining finitely many structures in can be dealt with separately. ∎
4.3 Rfo is stronger than Fo on additive structures
Recall that an additive structure is one whose vocabulary contains a ternary relation , such that is isomorphic to .
There is a class of additive structures that is definable in RFO and coRFO, but not in FO.
Our proof uses the following result: {thm}[Lynch [26]] For every there is an infinite set and a such that for all finite with or the structures and satisfy exactly the same FOsentences of quantifier rank at most .
Here denotes a structure with ternary and unary , where is interpreted as above and is interpreted by . For a finite set we denote by the maximum element of . By relativising quantifiers to the maximum element satisfying , we immediately get the following corollary: {cor} Let , , , and be as above. Then the (finite) structures and satisfy exactly the same FOsentences of quantifier rank at most .
We call a set sparse if for all . Note that if is sparse and finite, then . It is easy to see that there is an sentence such that
for all finite .
Proof of Theorem 4.3.
We define the following class of additive structures:
with defined as usual. It follows immediately from Corollary 4.3 that is not definable in FO.
It remains to prove that is definable in (co)RFO. We consider a binary random relation on for some finite .
Each element defines a subset of , namely the set of for which holds. If is a sparse set, it has
many subsets, and by standard estimates on the coupon collector’s problem (see, e.g., [29]; or use a unionbound argument), if is large enough, with high probability every subset of is defined by some element of . We may check in FO whether this is actually the case. If so, we use the random relation and the linear order induced by to check whether is even. Otherwise we reject (accept) to get an RFO (coRFO)sentence. ∎
5 BpFo is contained in Mso on additive structures
In this section, we prove our first and only nontrivial derandomisation result. It complements the result of Section 4.2 by saying that, on additive structures, every BPFOsentence is equivalent to an MSOsentence.
Let be a finite relational vocabulary containing a ternary relation and let be a sentence. Then there exists an MSOsentence such that on additive structures
We first use Nisan’s pseudorandom generator for constant depth circuits [32] to reduce the number of random bits to ; throughout this section, will denote the size of the input structure. We then derandomise the resulting formula following Lautemann’s argument in [24]. The secondorder quantifier depth of the resulting MSO formula does not depend on the input formula .
In , one can define a multiplication relation (see [35, Lemma 5.4]) and thus quantify over pairs of elements in . We only need the existence of such a pairing function, a slightly weaker form of which is made precise in the following lemma: {lem}[Pairing Lemma] There are formulas and such that on additive structures {iteMize}
defines a number satisfying
Moreover, is a prime number.
For every there is a unique such that is satisfied. Furthermore, for every there is a unique tuple such that is satisfied. Henceforth we write for this.
Proof.
In , we may define a formulas and stating that is the set of multiples of and divides , respectively. We may thus check whether is a prime number. Furthermore, we may define the set of powers of a prime number : It is the largest set containing only numbers whose only prime divisor is .
Then is the largest prime number whose set of powers contains at least one element other that and itself. Any number may be written as with . Both and are definable in ; notice that is the largest divisor of smaller than , or if . For we define with and . ∎
Whenever we write in this section, we mean the defined by the above. The Pairing Lemma allows us to quantify over binary relations on . In particular, we may define addition and multiplication modulo , i.e., there are formulas and such that for ,
and
For the proof of Theorem 5 we may assume that the BPFOsentence contains only one random relation, say of arity . In fact, using the formulas defining the th element of an additive structure (cf. section 2.1) we may pack several random relations of arities into one random relation of arity by replacing every occurrence of by
We first apply a result by Nisan [32] to reduce the number of random bits: {lem} For every and there are and formulas and , where is a set variable, such that in every additive structure of size , {iteMize}
defines a number and
if is an sentence of quantifier rank , where is some finite relational vocabulary and is of arity , then