Вы находитесь на странице: 1из 26

Affine Systems of Equations and Counting Infinitary Logic

Albert Atserias Andrei Bulatov Anuj Dawar

February 19, 2009

Abstract
We study the definability of constraint satisfaction problems (CSP) in various fixed-point and infini-
tary logics. We show that testing the solvability of systems of equations over a finite Abelian group, a
tractable CSP that was previously known not to be definable in Datalog, is not definable in the infinitary
logic with finitely many variables and counting. This implies that it is not definable in least fixed point
logic or its extension with counting. We relate definability of CSPs to their classification obtained from
tame congruence theory of the varieties generated by the algebra of polymorphisms of the template struc-
ture. In particular, we show that if this variety admits either the unary or affine type, the corresponding
CSP is not definable in the infinitary logic with counting.

1 Introduction
The classification of constraint satisfaction problems (CSP) according to their tractability has been a major
research goal since Feder and Vardi first formulated their dichotomy conjecture [14]. This classification
has been closely linked to logic, with definability in Datalog providing one important uniform explanation
for tractability. However, it has long been known that there are tractable CSPs, such as the satisfiability
of systems of linear equations over finite fields, which are not definable in Datalog. Bulatov [5] (see also
[3]) provides a uniform explanation for the tractability of these by showing that any constraint language that
has a Mal’tsev polymorphism is solvable in polynomial time. It has remained an open question, however,
whether there is an explanation for the tractability of these CSPs in terms of a natural logic whose data
complexity is in polynomial time and which can define these problems.
The general form of the constraint satisfaction problem takes as instance two finite relational structures
and  and asks if there is a homomorphism from 
to . We think of the elements of as the

variables of the problem and the universe of as the domain of values which these variables may take. The
individual tuples in the relations of act as constraints on the values that must be matched to the relations

holding in . The general form of the problem is  
-complete [27, 28]. In this paper we are mainly
concerned with the non-uniform version of the problem which gives rise, for each fixed finite structure 
to a different decision problem that we denote  

, namely the problem of deciding whether a given
 
maps homomorphically to . For many fixed , this problem is solvable in polynomial time, while for
others it remains  -complete. A classification of structures for which the problem is tractable remains a
major goal of research in the area.
In the present paper we classify constraint satisfaction problems according to their definability in a
suitable logic. This is an approach that has proved useful in studying the tractability of constraint satisfaction
problems [14, 9, 24]. In particular, it is known that many natural constraint satisfaction problems that
are tractable are definable (or, to be precise, their complements are definable) in Datalog, the language of
function-free Horn clauses. Any class of structures that is definable in Datalog is necessarily decidable in
polynomial time, but there are known constraint satisfaction problems that are tractable but are not definable

1
in Datalog. A classical example is the solvability of systems of linear equations over the two-element field
[14], which we denote   
. Furthermore, there are 
-complete constraint satisfaction problems,
such as 3-colourability of graphs, for which it is possible to show that they are not Datalog-definable without

requiring the assumption that is different from 
. Indeed, the class of constraint satisfaction problems
whose complements are definable in Datalog appears to be a robust, natural class of problems with many
independent and equivalent characterisations [10, 23].

1.1 Results in logic


A natural question arising from such considerations is whether we can offer any explanation based on log-
ical definability for the tractability of problems such as the satisfiability of systems of linear equations over
a finite field. Is there a natural logic such that all problems definable in this logic are polynomial-time de-
cidable and that can express     
? In particular, is this problem definable in LFP—the logic extending

first-order logic with least fixed points or LFP C—the extension of LFP with counting? These are both
logics that have been extensively studied in the context of descriptive complexity as characterising natural
fragments of polynomial time. It is a consequence of our results that neither of these logics is able to express
the solvability of systems of linear equations over any finite field. Indeed, we show that these problems are
not definable in   , the infinitary logic with bounded number of variables and counting, a logic much
more expressive than LFP C. 

Interestingly, Blass, Gurevich and Shelah [1] proved that LFP C is able to define the class of non-
singular square matrices over any fixed finite field, a result we review in Section 4. Together with our result,
this exhibits a fine-grained distinction between the problem of computing the determinant of a square matrix
and the problem of computing its rank, as one underlies a problem definable in and the other underlies   
a problem that is not. We also note in Section 4 that the problem GAP of determining the parity of the 

number of paths in a graph is also definable in LFP C. This demonstrates the differences in definability
between three natural complete problems for the complexity class "!
, two of which we show are definable

in LFP C but the third is not.

1.2 Results in algebra


Another important means of classifying constraint satisfaction problems is on the basis of the algebra of
#
the template structure . A polymorphism of a structure is an operation of its universe that preserves all its
relations (see Section 2 for precise definitions). It is known that whether or not is tractable depends $ # 
% #
only on the algebra obtained from the universe of endowed with its polymorphisms. Indeed, it depends
only on the variety generated by this algebra. This is established in [4] by showing that if the algebra
%'& of structure #(& %
is obtained from as a power, subalgebra or homomorphic image, then is   #(&)
polynomial-time reducible to   # 
. We show in the present paper that this can be improved to Datalog-
definable reductions. These are weak reductions that, in particular, preserve definability in LFP and . ' 
This allows us to establish that definability of a CSP in these logics is also determined by , the variety *,+.-/ %
generated by the algebra of . #
Using the tool of Datalog-reductions, which we expect to be useful for other applications in the area,
we relate definability of constraint satisfaction problems in ' 
to the classification of varieties of finite
algebras from tame congruence theory [18]. It is known [4] that is NP-complete if   #0
admits *.+.-/ %
the unary type (also known as type 1), and it is conjectured that   #0
is in otherwise. Similarly, 
Larose and Zadori showed [25] that   # 
is not definable in Datalog if *,+.-, %1
admits the unary or affine
types (types 1 and 2), and conjectured the converse. It is a consequence of our results that we can strengthen
the assertion by replacing Datalog with  
. This implies that, if the Larose-Zadori conjecture is true, we

2
obtain a dichotomy of definability whereby, for every 2 , either 34 56 2 7 is definable in Datalog or it is not
definable in . 3'89 8
1.3 Organization of the paper
The rest of the paper is structured as follows. In Section 2 we present some background definitions. Section 3
gives a proof that solvability of linear equations is not definable in 3 89 8
. Section 4 considers the definability
of three :";
-complete problems in 3'89 8
. Section 5 establishes that the definability of is determined 34 56 207
2
by the variety generated by the algebra of . Section 6 begins by showing that if the variety admits the unary
or affine type, then it contains an algebra with the operations of a module. These results are tied together
in the same section to obtain the main conclusion relating definability in to the omitting of types from 3 89 8
tame congruence theory.

2 Preliminaries
2.1 Notation, relational structures, and homomorphisms

I <
We use the boldface notation for a tuple with components 6 =?>A@CBCBCBD@E=GFC7
, and similarly for other letters , H
, etc. and variants with subindices or primes. The arity of the tuple will be clear from context. If is a J
sequence 6LK > @CBCBCBD@MKONP7
of indices in QSR.@CBCBCBD@MTVU
, we write for the tuple <XW . Sometimes we also 6 =SYLZC@CBCBCBD@E=GY\[17
write 6 = Y^] K`_JV7 a
if the meaning is clear. If is a set of tuples of arity , we write for T . bXc W 6 ad7 Qe< WP] <f_fagU
i h h
aPkmlnj F
A vocabulary is a finite collection of relation symbols, each with an associated arity. A -structure
j
consists of a finite set with a relation T
for each -ary relation symbol in . A graph is a a h i
structure with a binary relation that is symmetric and irreflexive. A homomorphism from a -structure to hF
h
a -structure is a map 2 o ] jqpsr
such that for each in and each a h , 6 = > @CBCBCBt@E= F 7_fj
if 6 =?>A@CBCBCBD@E=GFC7_fa k , then 6uoD6 =?>v7w@CBCBCBD@ox6 =SF/7M71_yaPz .
i
We write p{2 to denote that there exists a homomorphism from to 2 . A structure is a core if every
i i
i
homomorphism from to itself is an automorphism. We write 34 56 207 for the class of finite structures
i
i
such that ps2 and also for the decision problem of determining membership in this class.

2.2 Logic
We assume familiarity with first-order logic. A formula is quantifier-free if it has no quantifiers, and positive
quantifier-free if it is quantifier-free and it has no negations. A formula is positive primitive if it is formed
from the atomic formulas using only conjunctions and existential quantification. A formula is existential
positive if it is formed from the atomic formulas using conjunctions, disjunctions and existential quantifica-
tion. Datalog can be seen as the extension of existential positive formulas with a recursion mechanism for
building least fixed-points. Similarly, LFP is the extension of first-order logic with an operator for forming
|
the least fixed-points of positive formulas. Finally, LFP C is the extension of LFP with a counting mech-
anism. For formal definitions, which we will not need in this paper, we refer the reader to [26]. It is known
|
that every class of structures definable in LFP C is decidable in polynomial time.
39 8
}~ Y)€
The formulas of the logic are obtained from the atomic formulas using negation, infinitary con-
junction and disjunction, and counting quantifiers for any integer ). The fragment consists Kƒ‚ 3„9 8
of those formulas of 39 8 …
in which only distinct variables appear and
ˆ
3 89 8‡† 3 „9 8 B
„/‰ 8
3
The significance of Š'‹Œ ‹
is that fixed-point logics can be translated into it. That is, any formula of Datalog

or LFP, and indeed of LFP C is equivalent to one of Š ‹Œ ‹
. Thus, these logics are fragments of . Š ‹Œ ‹
Moreover, these translations into infinitary logics have provided some of the most effective tools for proving
inexpressibility results for the fixed-point logics. See [13, 19] for a discussion of this and the role of these
logics in descriptive complexity.

2.3 Logical reducibilities


Ž 
Let and be two finite vocabularies. Let (‘C’C“C“C“D’EP” be the relation symbols of  , with arities •–‘—’C“C“C“x’M•/” .
˜
A -ary interpretation with parameters (of ™  in Ž ) is an šu›1œež -tuple
Ÿ  šO¡^¢'’w¡£‘/’C“C“C“t’w¡¤”vž
of formulas over the vocabulary Ž . The formula ¡ ¢
  ¡ ¢ šL¥£’M¦¤ž has ˜0§™ free variables ¥ and ¦ . Each
formula ¡D¨
  ¡D¨EšL¥^‘A’C“C“C“D’M¥ª©,’M¦¤ž has ˜V•A¨«¬™ free variables ¥^‘A’C“C“C“D’M¥ª© and ¦ . If each formula in Ÿ belongs
Ÿ
to a class of formulas ­ , we say that is a ­ -interpretation.
Let ® be a Ž -structure with universe ¯ and let ° be a tuple of points in ¯ . The image of ® through
Ÿ with Ÿ
parameters ° , denoted by šu®’E°Gž , is the  -structure whose universe ± is the set of tuples ² in ¯³
 
such that ®µ´ ¡^¢š ²ª’E°Gž , and whose interpretation for ¶¨ is the set of tuples š ²·‘C’C“C“C“D’E²$©Až in ± such that
©
 
®¸´ ¡D¨Eš ²·‘A’C“C“C“t’E²$©.’E°Gž . Now we are ready to define the notion of logical reduction:
Definition 1. Let ¹ and º be classes of structures and let ­ be a class of formulas. We say that ¹ reduces
to º under ­ -reducibility, denoted by ¹¼»½nº , if there exists a ­ -interpretation such that, for every
Ÿ
Ÿ
structure ® with at least ™ points, where ™ is the number of parameters of , the following are equivalent:

1. ®¿¾‡¹
Ÿ
2. šu®’E°Gž¾yº for every proper ° ,
Ÿ
3. šu®’E°Gž¾yº for some proper ° ,
 
where a proper ° is a tuple š À/‘A’C“C“C“D’EÀÂÁSž of points in ® such that Àv¨à ÀMÄ whenever Ŷà .
 ÇÆ
­
We will use for the collections of positive quantifier-free formulas, existential positive formulas, and
Datalog formulas (i.e. Datalog programs) and write , and »ÈeÉEÊ »Ë È »ÌCÍÏÎLÍÂÐÒÑMÓ
, respectively. Note that these
are reducibilities of increasing power, and that definability in Š ‹Œ ‹
is preserved downwards by all three (the
™
finitely many exceptions of structures with less than points can be handled individually). Also, all three
reducibilities are transitive.

2.4 Universal algebra


Ô Õ ¯
An -ary operation on a set is a polymorphism of a relation ×Öد ©
if, for any tuples , ²·‘A’C“C“C“t’E²Xه¾
the tuple Õ£š ²·‘C’C“C“C“D’E²$Ù$ž Õ
obtained by applying component-wise also belongs to . We say that is  
Õ
invariant under . The set of all polymorphisms of a collection of relations is denoted by Ú
, and ۤܖÝޚ Ú(ž
the set of all invariant relations of a collection of operations is denoted by ß àÂáSâtšOßdž
. For a relational
®
structure , we use ÛxܖÝãšu®äž ¯
for the set of operations on that are polymorphisms of every relation of
® . The following theorem links polymorphisms and definability of relations by positive primitive formulas
(pp-formulas).

®
Theorem 2 ([15, 2, 21]). Let be a finite structure, and let åÖn¯ ©
be a non-empty relation that is pre-
® 
served by all polymorphisms of . Then is definable in by a pp-formula. ®
4
In [20, 22], Jeavons et al. proved that the set of polymorphisms of is included in the set of poly- æ
morphisms of , then ç èé êëuçyì
is reducible to èé êë æ0ì
by polynomial-time many-one reducicility. Using
the recent logarithmic space algorithm for undirected graph reachability [29], the reduction can be made
logspace.

Theorem 3 ([20, 22]). Let ç and æ be finite structures. If ê¤í–îÞëuçyì1ïðê¤í–îÞë æ ì , then èé êë æ0ìñõòÒóMô èé ê¶ëuçäì .
A set with a collection of operations on it is called an algebra. Two algebras are term-equivalent if the
sets of operations obtained by composition from the basic operations of the algebra and all the projections are
the same in both algebras. As is common in universal algebra, we identify algebras up to term-equivalence.
ç
Every structure can be naturally associated with an algebra ö¶î\÷«ëuçyì
, called the algebra of , whose ç
ç
base set is the universe of , and whose operations are the polymorphisms of . Let ç ø{ù{ë ú(ûwüdì
and
øgýxùþë úýLûwüPý\ì be algebras. We say that and ø øgý
are similar, or of the same type, if there exists an index
ÿ
set such that ü ù  

and ÿ ü"ýù ý
  

ÿ  
 , and the operations and are of the same arity, ý

say  , for every


ÿ . A homomorphism from toø ø ý is a Sú ú ý


map   such that for every


and ÿ
û xû
   
ú, it holds that 
  
 'ë ë û Dû ìM`ì ù ý ë ë ìwû Dû ë Mì ì

 
   
 
   ! 
 
  .
We shall use the three standard ways of transforming algebras.

1. øgý is a reduct of ø if úýXùú and ü"ý·ï ü ;


2. øgý is a subalgebra of ø if úýïØú , every operation from ü is a polymorphism of úý treated as a unary
relation on ú , and ü ý consists of the operations from ü restricted to ú ý .
3. øgý is a homomorphic image of ø if there exists a homomorphism from ø to ø(ý that is onto.
4. øgý is a direct power of ø if there exists an integer "$#&% such that úý¤ù¼ú(' and ü"ý consists of the
operations from ü acting component-wise on ú ' . We write ø ý ùƒø ' .

A variety is a class of algebras which, if it contains ø also contains every subalgebra of ø , every
homomorphic image of ø , and every direct power of ø . The smallest variety containing ø is called the
variety generated by ø and denoted by )*+/ëLø ì . For further background on universal algebra, see [8]. We
shall have occasion to use the following simple observation on pp-definability and reducts.

ç æ
Observation 4. Let and be finite structures with the same universe. The algebra ö¶î\÷«ëuçyì is a reduct
of öî\÷·ë æ ì
if, and only if, every relation of is pp-definable in . æ ç
The following theorem uses the above mentioned result by Jeavons et al. and the results of [4].

Theorem 5. Let ç and æ be finite structures. If the variety generated by ö¶î\÷«ëuçyì contains a reduct of
ö¶î\÷«ë æ ì
then èé êë æ ìñ õòÒóMô è é êëuçyì .
Note that Theorem 3 is a direct consequence of this because ö î\÷·ëuçyì belongs to the variety it generates,
and öî ÷«ëuçyì
is a reduct of ö¶î\÷ë æ ì
precisely when ê¤í–îÞëuçyì1ïðê¤í–îÞë æ ì .
3 Definability and Systems of Equations
In this section we show that the problem of determining the solvability of linear equations over the two-
element field, which we mentioned above as a canonical example of a tractable CSP whose complement is
è
not definable in Datalog, is also not definable in -,. . Indeed, we prove a more general result by showing
,
that the solvability of equations over a finite Abelian group with at least two elements is not definable in
è ,. .
,

5
3.1 Combinatorial games
Our proof of undefinability is based on a game argument. The expressive power of /-01 is characterised by
0
a game known as the bijective game [16]. This is played by two players, Spoiler and Duplicator, on a pair
of structures 2 and 3 , with 4 pairs of pebbles 57698;:=<8?> for @BADCEAF4 . For each move, Spoiler chooses a
pair of pebbles 57698G:=<8 > , Duplicator chooses a bijection HJILKNM O such that HP576RQS>ETU<SQ for CWTY
V X , and
Spoiler chooses Z\[]K and places 68 on Z and <8 on HP5^Z> . If, after some move, the map _a`Mcb is not a
partial isomorphism, Spoiler wins; Duplicator wins infinite plays. By a result of Hella [16], Duplicator has
a winning strategy if, and only if, 2 and 3 cannot be distinguished by any formula of / d1 , a fact denoted
0
by 2fehgij3 .
In constructing the winning strategy in the bijective game we construct, we depend on another game,
the cops and robber game [30], which is known to characterise the treewidth of a graph. For the standard
definition of the treewidth of a graph, we refer the reader to [12]. The cops and robber game is played by
two players, one of whom controls the set of 4 cops attempting to catch a robber controlled by the other
player. The cop player can move any set of cops to any vertices of the graph, while the robber can move
along any path in the graph as long as there is no cop currently on the path. It is known [30] that the cop
player has a winning strategy on a graph using 4lkm@ cops if and only if the graph has treewidth at most 4 .
The treewidth of a graph n is denoted oGpq5 nE> .

3.2 Systems of equations as a CSP


We now turn to the precise formulation of the problem of deciding the solvability of equations over a finite
Abelian group r as a class of relational structures. In the following we will write k for the group operation
in r and s for the identity.

Definition 6. Let r be a finite Abelian group over a set n and t be a positive integer. We define the structure
uwvRx y Q}
to have universe n and, for each ZB[zn and @EA\X{A]t , it has a relation | of arity X that consists of
Q
the set of tuples 576~€:‚:=6ƒQ> [„n that satisfy the equation 6‚~…kJ†††k\6ƒQ(T‡Z .
uwvRx y
Thus, any structure 2 in the signature of can be seen as a set of equations in which at most t
variables occur in each equation. The universe of 2 is the set of variables and the occurrence of a tuple
Q}
576‚~€:L:=6ƒQS> in a relation | signifies the equation 6~ˆk‡†††k‰6RQwTŠZ . This set of equations is solvable if,
u vx y
and only if, 2‹M . In the sequel we will say “the equation 6~Pkm†††Œk]6ƒQTŽZ occurs in 2 ” to mean
Q}
that the tuple 576~€::=6RQ> is in | .
Our aim now is to exhibit, for each non-trivial finite Abelian group r and each positive integer 4 , a pair
u vRx “ u vRx “
of structures 2 and 3 such that 2fe gi 3 and such that 2[\/‘’5 > and 3”[\
V /‘’5 > . This will
u vRx “ u vx y
show that /‘’5 > is not definable in / 01 . This, of course, implies the result for all /R‘h5 > with
0
t–•˜— .
The structures we construct are sets of equations derived from — -regular graphs of large treewidth. From
now on, fix a non-trivial finite Abelian group r , a — -regular graph ™ , and a distinguished vertex š of ™ .
u }
Let ›SZ ~€:L:œZ Ež be the elements of r . We define, for each Z{[Ÿ›SZ~ :L:œZ Ež , a set of equations ™¢¡ as
u } u vRx “
follows (note that ™ ¡ is a structure over the vocabulary of ): x«
For each vertex £B[Ÿ¤l¥ and each edge ¦[¨§l¥ that is incident on £ , we have © distinct variables 6ª8
where C ranges over ›SZ~€::œZ¬ž . Since each vertex has three edges incident on it, there are —© variables
“
associated to each vertex. For every vertex £ other than š , let ¦ ~ :­¦€®:­¦ be the three edges incident on £ . We
u }
then include the following equation in ™„¡ for all Cœ:¯XŒ:­4°[Ÿ›SZ~€::œZ¬ž :
x «­± x «;² x «´³
6 8ª k\6 Q ª k\6 ª TJCµk¶X(k4µ (1)
d

6
For
½S¾¿
the distinguished
¾Á¬Â
vertex · , instead of the above, we include the following equation, again for all ¸œ¹¯º¹­»¢¼
¹ÀÀÀ¹ :
Ã9ÈÄÅ Æ­Ç É Ã9Ë ÄÅ Æ;Ê É Ã9Ä ¾
Í Å ÆGÌ Î ¸ É º É » É À (2)
¿
In addition, for each edge ύ¼¢ÐqÑ let Ò ¹=ÒÓ be its endpoints. We include the following equations in ÔwÕ€Ö Ä
½S¾ ¿ ¾ ÁEÂ
for all ¸­¹¯º×¼ ¹ÀÀÀL¹ :
ÃÈØ Ç=Å Æ É Ã9Ë Ø Ê!Å Æ Î ¸ É ºÀ (3)

We refer to equations of the form (1) and (2) as vertex equations and equations of the form (3) as edge
equations.
¾
Lemma 7. Ô Õ Ö Ä is satisfiable if, and only if, ÎfÙ

Proof. To see that the system of equations ÔwÚÛÖ Ä is satisfiable, just take the assignment that gives the
variable à ÈØ Å Æ the value ¸ . ¾‰Ü
To see that ÔwÕSÖ Ä is unsatisfiable when Ύ٠, consider the subsystem ÝÞÚ of equations involving only
the variables à ØÚ Å Æ with subscript Ù . Note that each such variable occurs exactly twice in ÝjÚ , once in a vertex
equation and once in an edge equation. Thus, if we add up the left hand sides of all the equations, we get
ßáà Ã Ø Å Æ Ã Ø ÅÆ Ã Øœâ Å Æ where Ò ã is the other endpoint of
Ú . Note also that each variable Ú has a companion variable Ú
the edge Ï and we have the equation Ã9ØÚ Å Æ É ÃØÚ â Å Æ Î‡Ù . Thus
ßáä Ã Ø ÅÆ Î ßáä å Ã Ø ÅÆ Ã Ø æâ Å Æ Î‡Ù À
Ú Ú É Ú”ç
Ø ÅÆ Æ

On the other hand, the


¾
right-hand side of all equations is Ù except for the one vertex equation
¾
for · ,¾˜
which
Ü
has right-hand side . Thus summing the right-hand sides of all equations gives the sum . Since ÎèÙ ,
this shows that the subsystem ÝjÚ and hence the system of equations ÔwÕ€Ö Ä is unsatisfiable.

3.3 Winning strategy


Next we argue that any two systems defined this way are sufficiently indistinguishable. We start by showing
that the shape of the system does not depend on which distinguished vertex we pick, provided we pick them
in the same connected component.

Lemma 8. If ·¹=· ã ¼¢é Ñ belong to the same connected component of Ö , then Ô Õ Ö l


Ä êÎ Ô Õ Ö €Ä â .

Proof. The case ¿ ¿


where · Î · ã is¿ trivial, so assume that they are distinct.
Let · Î Ò ¹­Ï ¹ÀÀÀ¹­Ïë¹=Ҍë´ì Î · ã be the sequence of vertices and edges along a simple path from · to
·ã . We now define a map í from Ô(ÕSÖ Ä to ÔwÕÖ Ä â as follows:
î Ü ½
¿ ¿ Â å
for any Ò ¼ Ò ¹ ÀÀÀL¹=Ò Gë ì , í Ã ËØ Å Æ ç Î Ã ËØ Å Æ ;
î ½ ð
 å
for each  ¹ÀÀÀ…¹­ñ , í Ã Ë Ø=ò Å Æ ò ç Î Ã Ë =Ø òì Å Æ Õ ò ; and
î ½ ð  å Ø òôó Ç Å Æ´ò Ã Ë€Ø òôõ ó Ç Å Æ´ò .
for each  ¹ÀÀÀ…¹­ñ , í Ã Ë ç Î Õ

To show that í is an isomorphism, we need to argue that it preserves all the equations in Ô(ÕSÖ Ä . Clearly, all
equations corresponding to vertices and edges of Ö that do not appear on the path are preserved as í is the
identity map on the corresponding variables. Consider now the vertex equations corresponding to the vertex

7
ö . Note that the edge ÷ø (the first edge on the chosen path) is incident on ö and let ù and ú be the two other
edges incident on ö . Then, the equation
ûüý þ­ÿ  ûüý   û9ü ý   
 

 ûüý   û9ü ý   
 
is mapped by to
ûüý þ­ÿ

which is, indeed, an equation of   ü .


Similarly, a vertex equation for ö :
û ü ý þ!  û  ü ý   û ü  ý   " #

%$ !  û üý   û üŒ ý   " # '&


is mapped to
û ü ýþ

Now, consider a vertex equation for an intermediate vertex (  (*)  ø along the path. In this case, there
are two edges ÷),+­÷)  ø of the path incident on ( . Thus, the equation
û€- ý þ/.  û  - ý þ/.10 ÿ  û- ý  2 " #

is mapped by  to
.  û -€ý þ/.10 ÿ  û3- ý   " 67 +
û3-4$ý þ/5

where ù is the third edge incident on ( .


Finally, for each edge ÷) along the path, the equation
û3-8æ. ý þ!.  û  -8.10 ÿ ý þ!. 2 "

is mapped by  to
û-8
.7ý þ!.  û3;-:9!$ý þ  " <&
We have thus established that  maps equations to equations. Since  is a bijection, and the number of
equations in    ü and in    ü is the same, this proves that it is an isomorphism.

Lemma 9. If =?>A@B"C5D and  is connected, then #E; üGF6HJI    ü for any LKNM .

Proof. Our aim is to exhibit a winning strategy for Duplicator in the -pebble bijective game played on the
two structures O  #EP ü and Q     ü . Since =?>R@B
C5D , we know that in the cops and robber game
played on  , robber has a winning strategy and we show how Duplicator can make use of this strategy.
For each vertex ( K
SUT let V - denote the set of variables û-ý þ for edges ÷ incident on ( . Similarly, for
each ÷ KXWT , let V þ denote the set of variables involving ÷ .
We say that a bijection ùNYZO\[]Q is good for a vertex ( KNS T if the following conditions hold:

1. for all ^ K_S T , ù'VX`  VX` ;


2. for all ÷ KXW T , ù'V þ  V þ ;
3. for all û +8a , if û  a  is an equation in O then ùb@ û C  ùb@%acC  is an equation in Q ; and
4. for all û +8a'+:d , if û  a  d  is an equation in O , then
e ùb@ û C  ùb@%acC  ùb@BdZC  is an equation in Q if û +8a3+:dNKf V - ; and
e ùb@ û C  ùb@%acC  ùb@BdZC   is an equation in Q if û +8a3+:d K V - .
8
g h
h
Observe that the identity is a bijection that is good for . Also, observe that a bijection that is good for
preserves all equations except the vertex equations for .
ikjmlon p h q h to r avoid-
gtsu;v;v;vwu8g3x i'yzj#l n p r i|{~}€5;‚„ƒ†…‡…‡… ƒ<  ˆ‰‹Š
Claim 10. Given a bijection that is good for , if there is a path in from

i'yŒ{ }€ ;‚ ƒ†…‡…‡… ƒ  ˆ ‰


ing then there is a bijection that is good for such that
.

h r h Š hŽsPu;v;v;vu8h* Š r ‚
gwsu;v;v;vtu8g3x ‘ Šk’ h*“!u8h*“”s;•
–3™—„˜ ” –'™— ”
–™š8›Œœ — – ™š8›€ œ — i'y
Proof. : Let the path from to avoiding be . For each edge

i'y,ž%–3™k
—„˜ Ÿ Š ibž%–'™—:˜˜   Ÿ i'y,ž%–3™¡
along this path, write for the variable and
”
— Ÿ Š bi ž%–3™— ”   Ÿ i'y
for the variable . We then define
i¥;¥J¤ ˆ
by

h r
path from to avoids
and
g s u;v;v;vtu8g'x i'y ¢X£ 
‚ _
¤ ;
¥
i ¢X£
; and agrees with everywhere else. In particular, since the
, agrees with on .

We now describe Duplicator’s winning strategy in the bijective ¦ -pebble game. Duplicator responds to

in the ¦ cops and robber game played on the graph q . At any point in the game, if Spoiler’s pebbles are on
Spoiler’s first move with the identity bijection. She maintains a board on the side which describes a position

the position –ws;u;v;v;vtu8–'x in l and hŽsu;v;v;vwu8hx are the vertices of q to which these variables correspond, then
the current position of the cops and robber game has ¦ cops sitting on the vertices hZs;u;v;v;vu8h*x . If the robber’s
position according to its winning strategy is h , then Duplicator will play a bijection that is good for h .
To see that Duplicator can do this forever, suppose Spoiler lifts a pebble from – “ . Duplicator responds
with a current bijection i that is good for h . Since the only equations not preserved by i are those associated
with the vertex h , Spoiler must place at least three pebbles on variables associated with h to win the game.
However, Duplicator responds to Spoiler placing the pebble on a new position – y“ by updating the position
of the cops and robber game. Suppose robber’s winning strategy dictates that the robber move from h to r .

update the bijection i to a new i y that is good for r without changing i on any of the currently pebbled
Since robber’s move must be along a path avoiding the current cop positions, by Claim 10, Duplicator can

positions. It is now clear that Duplicator can play forever.

3.4 Undefinability result


We are ready to state and prove the main result of this section:

Theorem 11. Let § ª¨ ©†«ªžB¬#­ œ ® Ÿ is not definable in ¨G¯° ¯


be a non-trivial finite Abelian group. Then
x
Proof. Suppose, to the contrary, that there is a ¦ such that ¨±©†«ªžB¬#­ Ÿ is definable in ¨ ° . Let q be any
œ ®
connected, ² -regular graph with ³?´zžBq Ÿ±µ ¦ and g any vertex of q . For instance, q could be a sufficiently
¯
large brick graph. Let ¶ be any element of § distinct from · . Then, by Lemma 7, ¬#¸qN£º¹
¨±©†«ªžB¬ ­ Ÿ and
¬   qN£X¹X» ¨±©†«ªžB¬#­ œ ® Ÿ . But, by Lemma 9, ¬ ¸ qN£½¼6¾*¿¬   qX£ , a contradiction. œ®
4 Expressive Power of Counting Logics
¨ ¯° ¯
ÂÀ Á
The results of Section 3 show that the counting logic cannot express the satisfiability of systems of

Ã#Ä
linear equations over a finite field. Over the 2-element field , this problem is complete for the complexity

¨ ¯° ¯ Å
class , for which we give a definition in Section 4.4 below. As we noted in the introduction, however,

Å
and even its uniform fragment LFP C are powerful enough to express other complete problems for
this class. For example, LFP C can express that a given square matrix has non-zero determinant over any

ÃÆÄ
finite field. This was first noted by Blass, Gurevich and Shelah [1]. In this section, we revisit this result and
discuss the (in)expressibility of these and other problems that are complete for .

9
4.1 Counting quantifiers
ÇGÈÉ È
ʌË3ÌcÍÏÎÑÐ Ò ÊŒË'ÌcÍÏÎÐPʌӽÊ%ÎÑÐ8Ð
Recall that the formulas of are obtained from the atomic formulas by means of negation, infinitary con-

Ò Ó½Ê%ÎÑÐ
junction and disjunction, and counting quantifiers for every integer . The formula
signifies that there exist at least points of the universe that satisfy . In the formulas below we will use

ÊBÔÖՎÐPʌÓGÊBՎÐ8Ð
the notation

as an abbreviation for the infinitary formula


× ÊŒË ÌÙÚÍ ÕŽÐPʌÓGÊBՎÐ8ЏÛÝÜ±ÊŒË ÌÙÚÍ*Þß ÕZÐPʌӽÊBÕZÐ8Ð
ZÍ ÌØ
which says that the number of points that satisfy Ó½ÊBÕZÐ is even. We also define

ʌà2ÕZÐPʌӽÊBÕZÐ8ÐáâÜÂÊBÔÖÕZÐPʌӽÊBÕZÐ8Ð
which says that the number of points that satisfy Ó½ÊBÕZÐ is odd. As a matter of fact, for every set of integers ã
whatsoever, we could write the infinitary formula
× ÊŒË ÌcÍ ÕZÐPʌӽÊBÕZÐ8ЏÛXÜÂÊŒË ÌcÍ ÕZÐPʌӽÊBÕZÐ8Ð
ÍZä*å
saying that the number of points that satisfy Ó½ÊBÕZÐ belongs to ã . Let us mention then, as a curiosity, that an
immediate consequence to this is that the infinitary logic Ç ÈÉ
of finite structures. Of course, the uniform fragment LFP æ C of ÇGÈÉ
È is able todoesexpress non-computable properties

every property expressible in LFP æ C can be checked in polynomial time.


È not have this property as, in fact,

4.2 Matrix multiplication and powering


Òèç
Ò éëêìÊBíZî1ï‹ð|ñ‹òôó:õ?öÖòôҏР÷ ø
ñ Ê%ó„õ?öZÐ Ù íÏî1ï‹êùñ
An matrix over the 2-element field , whose elements we denote by

ñ ø
and , is represented by the binary relation formed by the pairs such that . In other words,

é úÏñ*õ;û;û;ûüõ8Òþý
the matrix is represented by the set of positions that hold ; the other positions hold . With some abuse of
notation, we will use both for the matrix in the usual meaning and for the binary relation over
that represents it.

Products and powers We define a formula  ÿ 


Ê%Ώõ3õ:éõÐ that defines the product of two Ò çÂÒ
é ÷Ù
matrices
and  over . This is:

ÿ  Ê%Ώõ3õ:éõÐ á ʌà ÕZÐPÊBéAÊ%Ώõ:ÕZÐüÛ‹ÊBÕ õ Ð8Ð û




The particular case in which é2ê  is denoted by


 ÏÊ%Ώõ3õ:éÆÐ .
Next, for every non-negative integer  , we write a formula ÿÊ%Îtõ'õ:éÆÐ that defines the power é

the matrix é . For  ê2ø , the power é is simply the identity matrix, which is defined by the formula
of


Ê%Îtõ cÐ á Ê%ÎÝê cÐ û
For  ñ , we proceed inductively, so

ÿ  Ø ÊBé#Ð á  

ÿ Þß ÊBé#Ð á ÿ ÊBéUõ8ÿJÊBéÆÐ8Ð û
10
By carefully reusing variables, it is possible to write the formula !"#$%&('*)+,)-/. with four variables in
total. For concreteness, we define

0!"#$ %1*2 &('*)+,)-/.43 &657.8&9-:&(';)7<.;=>!"#$ % &(7;)+0)-?..@) if A is odd


0!"#$B%1*2&('*)+,)-/.43 &65CD.8&9-:&(';)CE.*=F!"#$B%&(C)+0)-?..@) if A is even.
In total, we used four variables ' , + , 7 and C .

Repeated squaring It is also convenient to define the powering of matrices by a more efficient induction
known as repeated squaring. For A>GIH , we use the same base case, and for larger powers we distinguish
the odd and even cases:

!"#$JKL&9-?.M3 N
!"#$ J%1*2&9-?.M3 $!DOP&9-Q)RBSUTV$B#U&(!"#$ J WYX %1*2[Z]\_^` &9-/...@) if A is even
!"#$BJ%1*2 &9-?.M3 $!DOP&9N)RS TV$# &(0!"#$BJ WYX %1*2[Za\_^` &9-?...@) if A is odd
Note that, by the same careful reusing of variables as we did for 0!"#$ % , it is possible to write the formula
!"#$ J% with five variables (the additional variable is for the 5 -quantifier in RS TV$# ).
The good feature of the inductive definition based on repeated squaring is that it takes only bc&9dY!fegAh.
iterations to obtain 0!"#$ J% . In comparison, the inductive definition of !"#$ % requires A iterations. This
difference is important if we need to take powers that are exponential in i , the dimension of the matrix, as
we actually do below.

4.3 Non-singular square matrices


A square matrix is called singular if its determinant is zero, and non-singular otherwise. Equivalently, a
square matrix is non-singular if the columns are linearly independent. In the 2-element field, a column is a
linear combination of some other columns if and only if it is the sum of a subset of those. Therefore, the
number of non-singular ikjli matrices over the 2-element field is
^ 2
&nmpo:qsr.8&nmpo:qtmL.8&nmpo:qtm 8. &nmpoqumv.,www&nmpoqkmpoUx .
because we have m o qyr choices of non-zero vectors for the first column, and more generally, m o qcmpz choices
of vectors that are not sums of any of the { previous columns for the {L|ur -st column. Let } be this number.
o
Non-singular matrices over ~ ^ Since the product of non-singular matrices is non-singular and the inverse
of a non-singular matrix is non-singular, the collection of non-singular ij€i matrices over the 2-element
field forms a group of order } . Therefore, - is non-singular if and only if -‚PƒlGI- . It follows that the
o
sentence below expresses that the ikjli matrix - over the 2-element field is non-singular:
„ ! „ R … „ eLTd†V$ 9& -/.u3‡&aˆ,'<.8&aˆ,+.8&(0!"#$ &('*)+,)-/.g‰Š-:&(';)+..@‹
o  ƒ
„ „ „
Finally, if we want to define a sentence ! R… eLTd†V$&9-?. that defines the class of all finite structures that
represent non-singular square matrices - over the 2-element field, regardless of its dimensions, it suffices to
take
„ ! „ R … „ eLTdaV$8&9-/.k3 Œ &9ŽV$B…Y‘ o &9-/.P= „ ! „ R… „ eLTd†V$ &9-/..
2 <ƒ
Uo 

11
where ’c“”•B–˜—U™š9›?œ is the sentence saying that › is a square Ÿž? matrix. In other words, this is the sentence
that says that the structure has exactly  elements:
™h¢ ¢y£¢ ™§*¨¢ ¢l£¢
š6 ,¡ œ8š œP¤l¥¦š6 ,¡ œ8š œ@©
This shows that the collection of non-singular matrices over the 2-element field is definable in ª«¬ . Let us
«
mention that all definitions are perfectly uniform and can be formalized in the uniform fragment LFP ­ C of
ª «¬ . For this, it is important to use the inductive definition of ®0¯°±•B²³ based on repeated squaring because
« ™f¹º
in the definition of non-singular matrices we are taking a power with exponent ´Q™ , which is µf¶¸· . Note
that the log of this number is polynomial.

Non-singular matrices over finite fields The discussion up to now can be generalized to arbitrary finite
£
fields. Let » be a finite field with ¼ elements. An ½žu matrix › š9¾U¿ÁÀtÂÄÃÆÅÈÇÉËÊÌÅ͝*œ over » is
represented by ¼ÏÎ Ã binary relations Ð‚Ñ , one for each ¾kÒs»ÓνÔÕ Ö , where Ð?Ñ is the relation containing
£
the pairs š(ÇÉËÊ œ such that ¾h¿ÁÀ ¾ . In other words, Ð‚Ñ is the set of positions of the matrix that hold ¾ . The
¢
positions that do not belong to any Ð?Ñ hold Õ . It is not too difficult to define ª «¬ formulas ®•¯ ×Pš ÉØ,É›ÏÉُœ
¢ «
and ®¯°±• ³ š ÉØ,É›/œ defining the product and the power of matrices as we did for the 2-element field in the
previous section. It is important for this that the finite field is fixed.
The set of non-singular matrices over » also forms a group. Its order is

š9¼ ™ ÎÚÃœ8š9¼ ™ Îk¼Lœ8š9¼ ™ Îk¼Ûܜ,ÝÝÝpš9¼ ™ Îk¼ ™hÞ<¨ œ


™
because we have ¼ ÎÌÃ choices for the non-zero vector of the first column, and more generally, ¼ Îs¼
™ ¿
choices of vectors that are not linear combinations of previous columns for the Ç*­ßà -st column. If we let
´Ï™hà á be this number, then an Úžâ matrix › over » is a non-singular if and only if ›?ã<äå æ £ › . Thus,
the collection of all non-singular matrices over » is definable in ª «¬ , and in fact in its uniform fragment
«
LFP ­ C too.

4.4 Complete problems for çè


The complexity class é?ê is formally defined as follows. It consists of all languages ë for which there exists
¢
a non-deterministic Turing machine ì running in logarithmic space such that, for every input in ë , the
¢
number of accepting computations of ì is odd, and for every input not in ë , the number of accepting
computations of ì is even. It can be seen that íîêï½é?êïÚð , but neither inclusion is known to be proper.
This class was introduced with the aim of classifying important problems of linear algebra [7].

Complete problems The problem GAP , for Graph Accessibility Problem mod 2, is this:
Û
GAP : Given a directed acyclic graph ñ and two vertices ò and ó , decide whether the number
Û
of paths that go from ò to ó in ñ is odd.
It is not hard to see, using the standard reductions from logspace Turing machines to graph reachability
problems, that GAP is complete for é?ê . The trick to make the digraph acyclic consists in adding a counter
Û
of steps in a separate tape of the logspace machine.
We define two more problems:
™EõU™
N ONSINGULAR : Given a matrix › in ô , decide whether › is non-singular.
Û Û
Uõ ™
F EASIBLE : Given a matrix › in ô÷ö and a vector ø in ô ö , decide whether the system of
Û ¢y£ ¢ Û ™ Û
equations › ø has a solution in ô .
Û
12
It was shown in [7] that the three problems GAP ù , N ONSINGULAR ù and F EASIBLE ù are interreducible by
logspace reductions. It follows that all three are complete for ú?û . Thus, from the computational complexity
perspective, the three problems are equally hard (or easy).
From the descriptive complexity perspective, however, it follows from our results that the situation is
different. We showed in this section that the problem N ONSINGULAR ù is definable in üýþ . Moreover, it is
ý
not hard to see that if ÿ is the adjacency matrix of the digraph , interpreted as a matrix over the 2-element
field, then the   -entry of the
-th power ÿ is the parity of the number of walks of length
that go from
 to  in . In other words, if the number of walks of length
is odd, then the   -entry is , and if it is
even, then it is  . It follows that if ÿ is the binary relation representing the adjacency matrix of a directed
acyclic graph , the following formula of üýþ defines GAP ù :
ý

ÿ
#"$%& '(
 !

where ) is the set of all finite sets of natural numbers of odd cardinality. Here we use the fact that in a
directed acyclic graph, the only walks are paths.
For the problem F EASIBLE ù the situation is different. We show below how the results in Section 3 imply
that, when appropriately encoded into finite structures, this problem is not definable in üýþ .
ý
Inexpressibility of feasible systems Let ÿ+*,.-0/21435 7698:69;<= >6@?A6CB be a matrix in DFE' ù GIH and let
J J J
*K / 3L '6M8:6C;N be a vector in D Eù . The system of equations ÿ OP* is represented by a finite structure
as follows. The universe is the disjoint union of two sets QR*TS=
$U=!V!V!VW
and YR*ZS[\U=!V!V!VW][ of sizes
E>X H^X
; and B , respectively, indexing the rows and columns of ÿ , respectively. The matrix itself is represented
J
by the set of pairs 
=/_][1` such that -I/a14*b . Finally, the vector is represented by the set of
/ ’s such that
J
/c*K .
We show now that the constraint-satisfaction problem üed f .gih j k= , where l is the additive group of
D ù , reduces to F EASIBLE ù by a quantifier-free reduction. Recall that an instance of üed f .g h j k  is given
by a finite structure m with its universe representing the set of variables OWU=!V!V!VWO , and with two ternary
H
relations Qin and Q4U representing equations of the form

O5/^opOq1ro@Otsi*u and O5/^ovO 1:o@Otsi*K 

J
respectively. We build a structure w representing an instance ÿ OP* of F EASIBLE ù as follows. First, if Qin
and Q U are not disjoint, w is just a fixed unsatisfiable instance of F EASIBLE ù . Otherwise, the set of columns
Y of the matrix is S=OxU=!V!V!VO , the universe of m itself. The set of rows Q of the matrix is the set of triples
HLX
in Qynz{Q4U . The union QMz|Y is thus the universe of w . The binary relation representing the matrix itself is
the set of pairs
J J
SI.-5 ][=(]}q~€QKNYK3$}‚*ƒ-'„|}‚* „|}‚*u[ V
X

Finally, the subset of Q representing the independent vector is precisely Q4U . It is obvious that this is a
quantifier-free reduction from üedf .g h j k  to F EASIBLE ù . Thus, F EASIBLE ù is not definable in üýþ .
ý

5 Logical Reductions
The goal of this section is to work out the most useful reductions between CSPs in the framework of logic.
Most constructions are more or less standard, but technical, except the reduction to the idempotent case,
which requires also a non-trivial twist.

13
5.1 Expansions by reduced definable relations
Recall that a structure … is an expansion of another structure † if every relation in † is also a relation in … .
Let us start with the rather trivial case of reductions to expansions.

Lemma 12. Let † be a finite structure, and let … be an expansion of † . Then, ‡eˆ ‰Š.†Œ‹ŽŽ=]‘‡eˆ ‰Š.…’‹ .

Proof. The transformation that expands every instance of ‡eˆ ‰Š.…’‹ by empty relations is a reduction from
‡eˆ ‰Š.†Œ‹ to ‡eˆ ‰ Š.…’‹ . The empty relation is definable by the quantifier-free formula “.”•—–˜ .

It should be clear that, in Lemma 12, the converse reduction ‡eˆ‰ Š.…’‹iŽ=™‘‡eˆ ‰ Š.†š‹ need not be true.
There is an interesting case, however, where it holds. This is when … is an expansion of † by reduced
pp-definable relations. Before we prove this, we need a definition.
Let ›œ9žiŸ be a relation on ž . We define an equivalence relation  `¡ on ¢0£¤!¥!¥!¥W¤™¦$§ by setting Š¨]¤ª©q‹ in
  ¡ if, and only if, «0¬x­ƒ«® for every Š.«L¯!¤!¥!¥!¥W¤]« ‹ in › . We say that › is a reduced relation if   ¡ is the trivial
Ÿ
equivalence relation (i.e. equality). Note that the equality relation on ž is not reduced.

Lemma 13. Let † be a finite structure, and let … be an expansion of † by reduced relations that are
definable in † by a pp-formula. Then, ‡eˆ‰ Š.…’‹FŽ=™‘°‡eˆ ‰Š.†Œ‹ .

Proof. Let ± be the vocabulary of † . We prove the lemma for the expansion by one reduced relation › . The
general case follows by composing. Let ² be the arity of › and let ³´Šµx¯=¤!¥!¥!¥¤µL¶=‹ be the primitive-positive
formula that defines › in † . The formula has the following form:

Š¸·qµ5¶]¹¯™‹5º!º!ºŠ¸·qµL»i‹r¼›>¯Š½x¾À¿ ‹xÁº!º!º`Á|›4¯Š½ ¾ à ¿ ‹cÁĺ!º!ºÁ|› Š½ ¾]Å ‹cÁĺ!º!º`Á|› Š½ ¾ à Š‹_Ƃ¤


¿ ¿ Ÿ ¿ Ÿ Å

¬
where ›4¯=¤!¥!¥!¥x¤]› are all the relation symbols of ± , each Ç ® is a sequence of indices in ¢0£¤!¥!¥!¥¤ȧ whose
Ÿ
length matches the arity ²=¬ of ›¬ , and ½ ¾ denotes the projection of the tuple Šµx¯!¤!¥!¥!¥W¤µ5»i‹ to the indices
indicated by Ç . We may assume that all variables µ ¶]¹¯ ¤!¥!¥!¥x¤µ » are distinct and disjoint from µ ¯ ¤!¥!¥!¥W¤µ ¶ .
Moreover, since › is reduced, we may also assume that all variables µW¯=¤!¥!¥!¥x¤µL¶ are distinct. Given an
instance É of ‡eˆ ‰ Š.…’‹ , we need to define an instance Ê of ‡ ˆ ‰ Š.†š‹ such that ÊÌË † if and only if
ÉZËͅ . First we define Ê abstractly, and then show how to define it in É through a positive quantifier-free
interpretation with parameters.
The universe of Ê is the set ÎCÏ
Š.›7ÐÑ¢=µ5¶]¹¯=¤!¥!¥!¥x¤µL»>§`‹(¤
Î
where µ5¶]¹¯À¤!¥!¥!¥W¤µL» are the quantified variables in ³ , which we assume not to be members of . Intuitively,
we have a new copy of each quantified variable of ³ for each tuple in › Ð . The interpretation of the relation
› ¬ in Ê consists of › ¬Ð , together with a set of tuples defined next. For every ÒP­ÓŠ.Ô ¯ ¤!¥!¥!¥¤]Ô ¶ ‹ in › Ð and
¬
for every Ç ® ­KŠ¨]¯¤!¥!¥!¥x¤¨¸¶_Õ֋ , add to ›'¬× the tuple Š.د=¤!¥!¥!¥¤]Ø=¶ÖÕ_‹ defined by:

1. Ø\Ùi­uÔ(¬—Ú if ¨ªÙ is the index of a free variable of ³ , that is, £7M¨ªÙۍM² ,


2. Ø\Ùi­ÜŠ.Ò¤µL¬—Ú‹ if ¨ªÙ is the index of a bound variable of ³ , that is, ²e݃£7M¨ÖÙ4MÈ .

This defines the structure Ê . Let us prove it has the right property:
Claim 14. ÊÞË߆ if and only if ÉàËá… .
Î
Proof. Let â be a homomorphism from Ê to † . We claim that the restriction of â to is a homomorphism
from É to … . For every ›¬ we have › ¬ Ð œÓ› ¬× and ›'¬ã ­ä›'¬å . Moreover, â is a homomorphism, so
âWŠ.› ¬× ‹Aœæ›'¬å . Thus âWŠ.› ¬ Ð ‹Aœæ›'¬ã . Let us now check that âWŠ.› Ð ‹|œæ›'ã . Let then Ò be any tuple in

14
ç7è ç'ô
. Let é+êÓëWì.íIî . We want to show that ïñð êóò´ì.éî , so é belongs to . By the definition of õ , for
ç
ø
every ö0÷ ê,ìù]ú=û!ü!ü!üxûù¸ýÖþÿî , the tuple ìú=û!ü!ü!üû=ý_þÖî defined as before belongs to . Now, if ù is the index of
÷
a bound variable of ò , we view ëWìì.í^û îî as a witness for  when evaluating òì.éî in ï . On the other
÷
÷
hand, if ù is the index of a free variable of ò , we view ê ëì î as the interpretation of  . This
ç ô ÷ ÷ ÷
interpretation is well-defined because, critically, is reduced so all  variables  ú û!ü!ü!üû are distinct.
Under this interpretation for the free and bound variables, we have ïóð ê+ò´ì.é°î as was to be proved.
Suppose now that ë is a homomorphism from  to  . We need to extend ë to map from  to  . Fix a
ç7è ç'ô
tuple í in , and let éCêKëì.íIî . Then é belongs to so ï ð ê,òì.éî . Let ™ýú!û!ü!ü!üWû  be witnesses to
the existentially quantified variables in ò . We extend ë by defining ëWìì.í^û îîrê for Mù ! . The
÷ ÷
claim is that ë is a homomorphism from õ to ï and that this follows directly from the definitions.

We need to show now that this reduction is indeed a positive quantifier-free interpretation with parame-
ters. This is more or less routine. Fix a pair of distinct variables "$#`û"xú that will play the role of parameters.
For concreteness, we can think of "$# and "xú as distinct elements of % . Let &7ê')(* and + ê-,/. 021435&7689 .
ý;:< 3
We can think of the universe of õ as the subset of % defined by the following formula with =+>@?
free variables A # ûA ú û!ü!ü!üûA ý;: :
ç
ì/AB# êC";#EDFA úrêHGIGIG ê'Aý;:<ú(î5J<ì/AB# êC"xúKD ì/A ú!û!ü!ü!üûAý!î5DMLiì/Aýú=û!ü!ü!üxûAý;:Öîî(û

where Lyì/Aýú!û!ü!ü!üWûAý;:ªî is a formula that is satisfied by the set of numbers NPORQTS û!ü!ü!ü´û&U(P7V when
encoded in binary; the bits are encoded by A ýXW êH"$# or A ýXW êP"xú . In other words, when & is an exact
power of two, which we may as well assume by adding dummy variables, L is the following formula:
:Ycú
Z
ì/A ýú]XW êC"$#8JMA ýú]XW êC"xú(î
W\[X#

Intuitively, the set of tuples ì/AB#`û!ü!ü!üWûAý;:ªî for which


A # êC" # DFA ú êHGIGIG ê^A ý;:

encodes % , and the set of tuples for which


ç
AB# ê_"xú`D ì/A úÀû!ü!ü!üûAýÀî>DFLbaì/Aýú!û!ü!ü!üWûAý;:<ú(î

ç7èdc
encodes QeLýú!û!ü!ü!üWû  V . With the universe defined this way, the rest of the formal definition is easy
to work out.

5.2 Expansions by definable relations


The hypothesis in Lemma 13 that all relations expanding ï must be reduced is necessary, if we want to get
pqf-reducibilities. However, if we are satisfied with Datalog-reducibilities, we can relax it. Before we prove
this, we need a technical intermediate lemma.
ç
Let be a relation of arity f and recall the definition of g7h , the equivalence relation on Q4û!ü!ü!üûfBV
defined in the previous section. Let ö be a set of representatives of the equivalence-classes of gih , ordered in
ç ç ç
an arbitrary way, and define jkelì îê'mnjo . Note that jkelxì î does not depend on the choice of ö . Besides,
ç ç
ø
for every ùO€
p ö there exists some qUO’ö such that r êr for every tuple ìrLú=û!ü!ü!üWûrts(î in . We call jkelWì î
ç ÷
the reduced version of .
A reduced structure is a structure all whose relations are reduced. To every structure ï we can associate
a reduced structure, called the reduced version of ï , whose universe is the universe of ï itself and whose
relations are the reduced versions of the relations of ï . Note that the vocabularies of a structure and its
reduced version may be different. Note that the polymorphisms of ï and its reduced version are the same.

15
Lemma 15. Let u a finite structure and let v be the reduced version of u . Then wxtyzu|{@}~€ƒ‚€…„‡†ˆ
wxty‰zvŠ{ and wx‹yzvŠ{Œ}Žebwxty‰zu‘{ .

Proof. We start with the reduction wxtyzvŠ{}Že8wxtyzu|{ . Let ’ be the vocabulary of u and let ’X“ be the
vocabulary of the reduced structure v . Hence, for every symbol ” in ’ we have a symbol ” “ in ’ “ of the
arity of •–e—˜z”™Œ{ . Let š be an instance of wxtyzvŠ{ . We define an instance › of wx‹yzu|{ . The universe of
› is œ itself. The interpretation of the  -ary symbol ” in › is defined as follows: let ž‘Ÿ ž7¡ for ”PŸ¢” ™
and let £ be a set of representatives of the ž -classes, ordered in an arbitrary way. Then, ”¤ is defined by the
formula ¥
± ´
¡ z/¦˜§e¨I©I©I©>¨¦ªT{EŸ” “ z/«>¬­{5® ¯ ¦ Ÿ'¦ ©
°²±/³ ´¶µ¸·7¹

It is clear that šHº»v if, and only if, ›-º»u . Moreover, the reduction is positive quantifier-free.
We proceed now with the reduction wxty¼zu‘{Ž}Ž~I€ƒ‚/€…„‡†ˆ¼wx‹yzvŠ{ .
Let › be an instance of wxtyzu|{ . We define an instance š of wxtyzvŠ{ . The universe of š is ½ itself.
For the relations, the basic idea is to project every relation ”¤ to the coordinates of a set of representatives £
of the ž -classes, where ž¾Ÿž7¡ . However, before we do that, we need to close each ” ¤ under all equalities
implied by the equivalences z/¿¨ÀÁ{ŽÂÞ . We do that using Datalog-definable intermediate relations.
So, let Ä be the binary relation on ½ defined by the following Datalog program:
± ´
ÄÅz/¦ ¨¦ {dÆnÇ@”|z/¦>§e¨I©I©I©>¨¦XÈÉ{

ÄÅz/¦K¨ʋ{!ÆnÇ@ÄÅz/Ê;¨¦X{

ÄÅz/¦K¨ËÌ{dÆ$Ç@ÄÅz/¦K¨ʋ{>®ÍÄÅz/Ê;¨ËÌ{¶¨

where the first rule is introduced for every symbol ” in ’ and every z/¿¨ÀÌ{‰Â*ž ¡Î . It is obvious that Ä is an
equivalence relation on ½ ; reflexivity follows from the fact that z/¿¨ÀÁ{ÏÂCž ¡nÎ in the first rule, symmetry is
enforced by the second rule, and transitivity is enforced by the third. Next, for every  -ary symbol ” in ’ ,
let ” “ be the relation defined by

” “ z/«>¬­{=ÆnÇ9”|z/Êt§¨I©I©I©K¨Ê4ȶ{5®FÄMz/¦>§e¨Êt§É{5®ÑÐIÐIÐi®FÄÅz/¦XÈI¨Ê4ȶ{¶¨

where £ is a set of representatives of the ž -classes ordered in an arbitrary way. This defines š , and we
defined it by a Datalog program interpreted on › . It remains to argue that this Datalog-interpretation is
indeed a reduction.
Claim 16. If Ò is a homomorphism from › to u and zÓ¨Ó̓<{ŒÂÃÄ , then ҘzӋ{8ŸÔҘzÓ̓<{ .

Proof. We proceed by induction on the stage on which zÓ$¨Ó “ { enters the relation Ä . If it enters in the first
stage, then there exist ” in ’ , z/¿¨ÀÌ{Â՞ ¡Î , and ÖÕÂה ¤ such that Ó ± ŸPÓ and Ó ´ ŸPÓ4“ . Since ÒKzÖ${ØÂה ¤
and z/¿¨ÀÌ{Â_ži¡ , it follows that ҘzÓ ± {ŸRÒKzÓ ´ { , so ÒKzÓt{‰ŸRҘzÓ “ { . The inductive cases follow trivially from
symmetry and transitivity of equality.

Claim 17. ›ÙºÚu if and only if šPºÛv .

Proof. Suppose that ›ÜºÚu and let Ò be a homomorphism. We claim that Ò itself is also a homomorphism
from š to v . Suppose ݊ÂC”Ø“ßÞ . Then there exists Ö and ֋“ in ” ¤ such that ֬ϟHÝ and zÓ ± ¨Ó̱“ {ØÂ_Ä for
every ¿ Âáà4âi¨I©I©I©K¨ã2ä . Now, ҘzÖ “ {åÂÔ™ because Ò is a homomorphism. But also ҘzÖ${æŸÔҘzÖ “ { by the claim
above because zÓ ± ¨Ó4±“ {åÂÃÄ for every ¿ . But then

ҘzÝÌ{ ŸÔҘzÖn¬7{EŸÔҘzÖ${ƒ¬¼ŸÔҘzÖ “ {ƒ¬çÂFè• ¬ z” ™ {8Ÿ'•–e—>z” ™ {8Ÿ” “ßé ©

16
Thus ê is a homomorphism from ë to ì .
Suppose now that ëîíïì and let ê be a homomorphism. For every ðÃñ*ò , let ðÁó be a fixed represen-
tative of the ô -equivalence class of ð . Let õXöðt÷ŽøPê˜öð ó ÷ for every ð . We
 claim that õ is a homomorphism
from ù to ú . Suppose ûÃñŠüý . Then öûnóæ÷ƒþçñÍüØÿ , so ê˜ööûó ÷ƒþT÷ŒñÃüØÿ . Note that
  

õ;öû$÷ƒþ¼øê˜öû ó ÷ƒþøÔêKööû ó ÷ƒþT÷ŒñÍü ÿ ø öü ÷Eø
 þ öü ÷


But then õ;öû$÷ŽñŠü by the definition of  and  . So õ is a homomorphism.

This completes the proof of the lemma.

5.3 Reductions through reducts


By combining the preceding lemmas, we obtain the following result which is the analogue of Theorem 3 for
logical reducibilities.

Theorem 18. Let ù and ú be finite structures. If ]ö¸ùF÷öú|÷ , then öú|÷"!$#%!'&)(+*,-ö¸ùÍ÷ .

Proof. Let ú¾ÿ be the reduced version of ú . By Lemma 15, we have öú|÷./!$#0!'&)(+*1öú¾ÿ<÷ . Let úÏÿ‡ÿ
be the expansion of ú¾ÿ with the relations of ù . By Lemma 12, we have öú¾ÿ<÷24356-öú¾ÿ‡ÿ ÷ . Suppose
now that ö¸ùÍ÷78öú|÷ . Note that ú¾ÿ‡ÿ is an expansion of ù by reduced relations. Moreover, since the
polymorphisms < of; a relation and its reduced version are the same, it follows from ]ö¸ùF÷9:öú|÷ that
;
every relation ü of ú ÿ is invariant under every polymorphism of ù . Therefore, by Theorem 2 every ü is
pp-definable in ù . By Lemma 13 we have ‰öúÏÿ<÷=2>3?5@-ö¸ùÍ÷ . Composing we get -öú|÷="!$#%!'&)(+*
‰ö¸ùF÷ .

5.4 Powering, subalgebras, and homomorphic images


In this subsection we show how the basic algebraic constructions of powering, subalgebra and homomorphic
images can be handled by Datalog-reductions. We start with homomorphic images.
Let ú be a finite structure and let A be its corresponding algebra. Suppose A ÿ is an algebra that has a
homomorphic image B øêKö%Aæÿ<÷ that is a reduct of A . Note that òøCRøÔêKö%C¾ÿ
÷ , i.e. the universes of B and
A are the same and are the image of the universe of A ÿ under ê . We define a new structure 
ú ÿ ø
BöúEDê$÷ ,
the preimage of ú , whose universe is C¾ÿ and whose relations are the preimages êGFIHTöü ÷ of the relations
ü of ú .

Lemma 19. Let the algebras A and A ÿ , and the structures ú and ú ÿ ø
BöúEDê$÷ be as above. Then

1. =öú|÷24356-öú¾ÿ
÷ ; and

2. A ÿ is a reduct of J7KXöú ÿ ÷ .

Proof. 1. We argue that =öú|÷øL=öú¾ÿ<÷ by arguing that ú and ú¾ÿ are homomorphically equivalent.
The homomorphism from ú ÿ to ú is just ê , and this is easy to check. As a homomorphism from ú to ú ÿ
we take any inverse of ê ; that is, any function MONPCÚí C¾ÿ such that MEöRQI÷ belongs to êIFIH­öRQI÷ for every 
QÅñSC . Such a function exists because ê is onto C . It is a homomorphism because if T is a tuple in ü ,

then ê˜öRMEö%TE÷÷æøT , so MEö%Tb÷åñ*êGFIH­öü ÷ .
2. It suffices to show that every operation of A ÿ is a polymorphism of ú¾ÿ . Let M;ÿ be an U -ary operation
of A ÿ , and let M be the corresponding operation of B . Suppose that û H D/ / / VDû
W are U tuples that belong to

17
XGYIZ\[%]_^` X<[%aIZb` c/d/d/d<c?X<[%a
e,` ]_^
. Then the tuples all belong to . We apply f component-wise and we obtain
the tuple Z ` c/d/d/d<c?X<[%g e Z ` c/d/d/dc?X<[%g e
[ [RX<[%g `+` c/d/d/dc [RX[%g `+`+` d
f Z Z f h h

]_^
Since f is an operation of i , and i is a reduct of j , it is a polymorphism of k , so this tuple belongs to .
Now, by the choice of f , this tuple is the same as
[RX<[ [%g Z c/d/d/dcg e `+` c/d/d/dc?X[ [%g Z c/d/d/d<cg e `+`+` d
fml Z Z fml h h

We conclude that the tuple Z c/d/d/d<cg e Z c/d/d/d<cg e


[ [%g ` c/d/d/dc [%g `+`
f l Z Z f l h h

X YIZ [%] ^ `
belongs to . This proves that f l preserves every relation of k l .

Let k be a finite structure and let j be its corresponding algebra. Suppose j l is an algebra that has a
subalgebra ionj l that is a reduct of j . Note that prqsonts l , i.e. the universes of i and j are the same
[ c `
and are a subset of the universe of j l . We define a new structure k l qvu"wx k s l , the extension of k , with
universe s l and the same relations as k .
[ c `
Lemma 20. Let the algebras j and j l , and the structures k and k l qu"wyx k s l be as above. Then
[ `}~4€ [ `
1. z={| k z{-| k l ; and
[ `
2. j l is a reduct of 7‚ƒ k l .

Proof. 1. The structures k and k l are homomorphically equivalent. Indeed the identity mapping on s is a
X…„
homomorphism of k to k l , and any mapping s l-† s that is the identity on s‡ns l and maps elements
from s l‰ˆ s to any element of s is a homomorphism from k l to k .
2. Let f l be an operation of j l and let f be the corresponding operation in i . Then f preserves every
relation of k because i is a reduct of j . But then, trivially, f l also preserves every relation of k l because
the relations in k l and k are the same.
] ] [%]c+‘` ‘
Let be an Š -ary relation on the set pŒ‹ . Then the flattening of , denoted Ž , is the Š -ary
[0’ c/d/d/dVc+’ ` [+[0’ c/d/d/dc+’ ` c/d/d/d<c4[0’V“ c/d/d/d<c+’ `+`,—
relation on p that contains all tuples Z h such that Z h YIZ•” Z h
] ‹ ‹ ‹‰– ‹
. Let k be a finite structure and let j be its corresponding algebra. Suppose j l is an algebra that has a
direct power i‡q˜j l ‹ that is a reduct of j . Note that p:q™soq˜s l ‹ , i.e. the universes of i and j are the
‘ [ c+‘`
same and are the -th power of the universe of j l . We define a new structure k l qvŽ k , the flattening
of k , whose universe is s and whose relations are the flattenings of the relations of k .
[ c+‘`
Lemma 21. Let the algebras j and j l , and the structures k and k l qŽ k be as above. Then
[ `}~4€ [ `
1. z={| k z{-| k l ; and
[ `
2. j l is a reduct of 7‚ƒ k l .
[ ` [ `
Proof. 1. Given an instance š of z={| k , we need to define an instance š l of z{| k l such that š † k
if, and only if, š l† k l . First we define š l abstractly, and then show how to define it on š through a
positive quantifier-free interpretation with parameters.
c/d/d/dc+‘6Ÿ ]
The universe of the structure š l is p‡›œž . For every   -ary symbol in the vocabulary of
‘ ] ]
k , we have a corresponding   -ary symbol l in the vocabulary of k l . The interpretation of l in š l is
defined as the set of all tuples
[+[0’ c ` c/d/d/dc4[0’ c+‘` c/d/d/d<c4[0’¢¡£c ` c/d/d/dc4[0’¢¡yc+‘`+`
Z  Z 

18
such that ¤0¥V¦>§/¨/¨/¨<§+¥m©«ª belongs to ¬_­ .
First we prove that this structure has the right property. If ®°¯²± and ³ is a homomorphism, then clearly
the mapping ³
´Vµ£¶Œ´¢¯¸·9´ defined by the condition ³-´R¤+¤0¥<§+¹$ª+ªº˜³<¤0¥Iª•» , where ³<¤0¥IªPº¼¤R³<¤0¥Gª?¦\§/¨/¨/¨<§?³<¤0¥Iª•½-ª ,
is a homomorphism. Conversely, if ³ is a homomorphism from ® ´ to ± ´ , then the mapping ³ ´ ¤0¥Iª¾º
¤R³ ´ ¤+¤0¥§>¿4ª+ª §/¨/¨/¨§?³ ´ ¤+¤0¥<§+Àª+ª+ª is a homomorphism from ® to ± .
Next we show that this reduction is positive quantifier-free. Fix a pair of distinct variables Á¢Â«§%ÁV¦ that
will play the role of parameters. For concreteness, we can think of Á¢Â and Á<¦ as distinct elements of ¶ .
¦
Let Ãĺ Å0ÆÈljɞÊGÀIËÍÌo¿ . We can think of the universe of ®Î´ as the subset of ¶=ÏÑÐ defined by the for-
mula Ò7¤0Ó«§+Ó¦>§/¨/¨/¨V§+Ó ª with ÃÔ̼¿ free variables that is satisfied by the tuples ¤0Ó«§+Ó¦"§/¨/¨/¨§+Ó ª for which
Ï Ï
¤0Ó ¦ §/¨/¨/¨<§+Ó ª encodes a number from Õ4Ö§/¨/¨/¨§+À…×Ø¿Ù in binary; the bits are encoded by ÓÚÛºÁ  or ÓÚÛºÁ ¦
Ï
for ¿_ÜØÝ,ÜÞÃ . The interpretation of the relational symbol ¬ ´ of arity ßyÀ is given by the formula
½ ©\å ¦
è è é é
¦ © ½ ¦ ½ ¦ ©\å ¦•æ½ ¦ »î½ »î½
Ò@à
á'¤0â §/¨/¨/¨<§+⠪㺠¬1¤0Ó Â §+Ó Â Ð §/¨/¨/¨<§+Ӣ ä Ð ªVç ¤0ëìÈíI¤0Ó ¦ Ð §/¨/¨/¨§+Ó Ð ª@ºÞïÍ×Þ¿4ª §
ébê ê Ï
¦ » Â

é é
»î½ »î½
where ëìÈíI¤0Ó ¦ Ð §/¨/¨/¨V§+Ó Ð ªðºÞïÍ׿ abbreviates the expression
Ï
é é
»ñ½ »î½
Ó ¦ Ð º8Ý4¦çóò/ò/ò«çEÓ Ð º8Ý
Ï Ï

and Ý4¦V¨/¨/¨ Ý is the binary representation of ïô׿ .


Ï ½
2. Since õ is a reduct of ö , every relation of ± is invariant with respect to all operations of õ÷ºøöP´ .
Now it is straightforward that every relation in the flattening of ± is invariant with respect to every operation
of ö ´ .

5.5 Reductions through varieties


Finally, we are ready to state and prove the analogue of Theorem 5 for logical reducibility.
Theorem 22. Let ® and ± be finite structures. If the variety generated by ù7ÆÉ¢¤R®úª contains a reduct of
ù7ÆÉ¢¤%±1ª , then ûüýŒ¤%±þªÜÿ
,û=üý=¤R®úª .

Proof. Let õ ºLùŒÆÉm¤R® ª and örºøù7ÆÉ¢¤%±1ª . Suppose that some algebra õ ´ of ¤0õþª is a reduct of ö . By
the HSP-theorem [8, Theorem 9.5] õ ´ is a homomorphic image of a subalgebra of a direct power of õ . Let
õ , õ , and õ be the direct power, its subalgebra, and the homomorphic image, respectively. We have that
½
õ ´ ºvõ . Let À be such that õ  ºvõ , an let ³ be a homomorphism from õ  to õ .
We use the three intermediate structures
1. 
® Ûºž¤R® §?³¢ª ,
2. ®  
º \¤R®  §¶  ª,
3. 
® .º"!#
¤R®$§+Àª .

Using the fact that õ ´ ºõ  is a reduct of öºù7ÆÉ¢¤%±1ª , now we apply Lemmas 19, 20, and 21 in sequence
to obtain
1. û=üý=¤%±1ªÜ &%(')6ûü-ý=¤R® ª and 
õ  is a reduct of ùŒÆÈÉ¢¤R®  ª ,
2. û=üý=¤R®  ªÜ *%+')6û=üý=¤R®  ª and õ  is a reduct of ù7ÆÉm¤R®  ª ,
3. û=üý=¤R® $žªÜ&%+',)6ûüýŒ¤R®-£ª , and õ is a reduct of ùŒÆÉm¤R®-£ª .
The last condition means that ýÇÆ$¤R® ª/.oýÇÆ ¤R®žª . It follows from Theorem 18 that ûü-ý=¤R® žª1Üÿ0

ûüýŒ¤R® ª . Composing, we get ûü-ý=¤%±1ªÜÿ
_ûüý=¤R®úª .

19
5.6 Reduction from the idempotent case
To every finite structure 1 we associate a new structure, the singleton-expansion of 1 , by adding one unary
relation 243+5 for every 37698 . In other words, if 8;:<243(=+>???@>,3BAC5 , then the structure D01->243(=+5E>???F>243BAC5 G is
the singleton-expansion of 1 . Note that the polymorphisms of the singleton-expansion of 1 are exactly the
idempotent polymorphisms of 1 , that is polymorphisms H satisfying the identity HIDJK>???F>
JLGM:"J . Indeed,
every singleton set 243(5 is preserved by any idempotent polymorphism of 1 , and any polymorphism of 1
that preserves every singleton set 243(5 must by idempotent.
Lemma 23. Let 1 be a finite structure, and let N be the singleton-expansion of 1 . Then O*PRQSD01TGU&V+W,X
O*PQYD0NZG and if 1 is a core with at least two points, then OSPQSD0NZG[U&\ V OSPQSD01TG .

Proof. Since N is an expansion of 1 , the reduction O*PQSD01TG[U&V(WX]O*PRQSD0NZG follows from Lemma 12.
Let us now prove that O*PRQSD0NZGU \ V O*PRQSD01TG . Given an instance ^ of O*PQSD0NZG , we need to define an
instance _ of O*PQSD01TG such that _a`b1 if, and only if, ^c`dN . First we define _ abstractly, and then
show how to define it on ^ through an existential-positive interpretation with parameters.
The universe of the structure _ is the disjoint union of e and 8 . For every relation symbol f of arity g
in the vocabulary of 1 , the interpretation of f in _ is defined by cases: if the sets hjk i are pairwise disjoint,
we let fml:"nSo . Otherwise, we let fml be the set

fmprqts D0f i GB>


uEv wx

where y is the set of mappings e<`{n such that the following two conditions are satisfied:
xrz
1. D|RG&69h k i qr243(5 for every 36}8 and |69h k i ,
x
2. D|RG~:| for every |-6e€ƒ‚ k v…„ h k i .
x
This defines the structure _ . Before we show how to define _ by an existential-positive interpretation, let
us show that it has the property we want:
Claim 24. _†`‡1 if, and only if, ^ˆ`{N .

Proof. If the sets h‰k i are not pairwise disjoint, then clearly ^‹Œ Š` N . In this case, every relation in _ is the
full relation and in particular it is reflexive. But then _{{ Š` 1 since otherwise 1 would also be reflexive and
hence not a core with at least two elements.
Suppose in the following that the sets h k i are pairwise disjoint. Let  be a homomorphism from ^ to
N . Note that KD|RGŽ:3 for every |96h‰k i ; this remark will be of use later. Let  be the unique extension of
 to n:"8‘q-e such that ’D“3GM:3 for every 37698 . We prove that  is a homomorphism from _ to 1 . Let
” ” ” ”
6fml for some relation symbol f , and we aim to show that ’D GY6f p . Since 6rfml , either 6rf p ,
or ” 6 D0f•i[G for some 6Zy . In the first case, –D G~:
” ”
and hence ’D ” G*69f p as required. In the second
case, : ” x x
D—]G for some —ƒ6}f i . Let —:˜D|=+>???K>
| G and let us analyze the components |…™ distinguishing
x o
by cases whether they belong to some h‰k i or not. Suppose first |…™]6}h‰k i for some 3 . Then KD|…™“G~:3 by the
remark above. Also D|…™“G&69h k i qš243(5 by the definition of y . Continuing, if D|…™“GŽ6Zh k i then –D D|…™›G
GM:3
again by the remarkx above, and if D| ™ G•:†3 then ’D D| ™ G
G‰:œ’D“3G‰:†3 by x the definition of  . x Therefore
’D D|…™G
GY:;KD|…™“G . Suppose next that x |…™m6ž
Š h k i for allx 36ž8 . Then D|…™GS:ˆ|…™ by the definition of y , and
’D D| ™ G
GŽ:ŸKD| ™ G again. It follows that ’D D—]G
G&:ŸFD—]G . Since — 6xf i and  is a homomorphism from ^
x
to x N , we have FD—]G‰6 fm¡ . It follows that x ’D ” Gj6 f p because ’D ” G:˜’D D—¢G
Gm:tFD—]G and fm¡;:;f p .
This proves that  is a homomorphism. x
Suppose next that H is a homomorphism from _ to 1 . Note that 1 is an induced substructure of _ ,
so the restriction of H to 8 is a homomorphism from 1 to itself. Since 1 is a core, this restriction must

20
be an automorphism £ of ¤ . We may assume then that ¥ is the identity on ¦ ; otherwise we start with the
homomorphism obtained from ¥ by composing it with £¢§L¨ on ¦ . Now we define the map ©ƒª’«t¬d¦ as
follows: if ­-®Z¯‰± ° for some ²7®9¦ , then ©K³­R´~µ² ; otherwise, ©K³­R´~µ¥I³­R´ . Since we are assuming that the
sets ¯ ± ° are pairwise disjoint, the map © is well-defined. We claim that © is a homomorphism from ¶ to · .
First note that if ­®}¯ ± ° , then ©F³­´[®9¯‰± ¸ by definition. Now, let ¹ƒ®Zº ° for some relation symbol º , and
we prove ©F³¹]´[®9º ¸ . Define »rª¼«<¬{½ by »]³­R´~µ² if ­-®9¯j± ° for some ² , and »¢³­´Mµ­ otherwise. Since
the sets ¯ ± ° are disjoint, this is well-defined. Note that »"®¿¾ . Let ¹ŸµÀ³­ ­…Ã+´ and let us analyze
¨+ÁÂÂÂ@Á
the components ­…Ä distinguishing by cases on whether they belong to some ¯‰± ° or not. Suppose first that
­…Ä]®9¯ ± ° for some ² . Then »]³­…Ä“´IµŸ² by the definition of » , and ¥I³»¢³­…ĝ´
´Mµ² because ¥ is the identity on ¦ .
Also ©K³­ Ä ´*µ˜² by the definition of © . Therefore ©F³­ Ä ´*µ˜¥I³»]³­ Ä ´
´ . Suppose next that ­ Äm®Æ Å ¯ ± ° for any ² .
Then »]³­…Ä“´[µ­…Ä by the definition of » , and ©F³­…Ä›´ŽµÇ¥I³­…Ä“´ by the definition of © . Again ©F³­…ĝ´[µ<¥I³»]³­…Ä“´
´ .
It follows then that ©F³¹¢´Èµ¥I³»¢³¹]´
´ . Now, »¢³¹¢´&®9ºmÉ because »®9¾ and ¹ ®9º ° . Hence ¥I³»¢³¹¢´
´*®}ºmÊ
because ¥ is a homomorphism from Ë to ¤ . Thus ©F³¹¢´Y®º ¸ because º ¸ µŸº Ê . This proves that © is a
homomorphism.

We need to show that this reduction is indeed existential-positive. Fix a pair of distinct variables ÌCÍ Ì
Á ¨
that will play the role of parameters. For concreteness, we can think of ÌCÍ and Ì as distinct elements of « .
¨
Let ε†Ï ¦9Ï and Ð[µÒÑÓÕԅּ×LÎ4Ø&ÙÚ . We can think of the universe of Ë as the subset of «ÛÝÜK¨ defined by the
following formula with ÐLÙÚ free variables ­EÍ ­ ­ :
Á ¨ÁÂÂÂKÁ Û
³­EÍSµ ÌCÍMÞ-­ µÇßßß൭ L ´ áâ³­ µ Ì Þ-ã7³­ ­
´ ´
¨ Û ¨ ¨ ¨+ÁÂÂÂ@Á Û Á
where ã³­ ­ ´ is a formula that is satisfied by the set of numbers ä®æå(ç ÎMèrÚ é when encoded in
¨+ÁÂÂÂFÁ Û ± ± Á¢Á
binary; the bits are encoded by ­ µ ÌCÍ or ­ µƒÌ . This is the same technique as in the proofs of Lemmas 13
¨
and 21. Intuitively, the set of tuples ³­EÍ ­ ´ for which ­EÍ7µêÌCÍ~Þ}­ µëßßß#µ­ holds encodes « , and
ÁÂÂÂ@Á Û ¨ Û
the set of tuples for which ­ Í µÇÌ Þrã³­ ­ ´ encodes ¦ . Now we define the interpretation of the
¨ ¨ ÁÂÂÂFÁ Û
relation symbol º by the following formula:ì

áZíCîá˜ï ðô î
ðñ…òmó Á ì

where õ is the set of mappings öªå÷Ú é ¬ ¦aù¿å(ç Ú é , and , í’î and  ð ô î are formulas to be
ÁÂÂÂFÁ
ø Á
described soon. Note the similarity of this formula with the abstract definition of ºmó É that we gave:

º Êrútû »¢³0º ° ´
üEñ ý Â

Ã
The formula í’¹ ¨ ¹ ´ encodes the set º Ê as a finite disjunction of conjunctions of equalities
ÁÂÂÂFÁ Á þ Ã
encoding the tuples of ºmÊ . This is easy to work out. The formula ðô îȳ¹M¨ ¹ ´ encodes the set
ó 
Á 
 
 F
 Á Áþ
»¢³0º ° ´ as follows:
 
³ÿ ´Cßßß4³ÿ(ô³0ºT³ (ô@Þ Þ × ´
¨ ¨(ÁÂÂÂFÁ ¨
where
     
µ ­ Í µƒÌCÍMÞ-­ µ µ­ Þ¯ ± ³  ´FÞ-¯ ± ³­ ´
¨  ñ  ¨ ÂÂÂ Û ¨
    
× µ ­ Í µƒÌ Þ-­ µ Ì ±  Þ Þ-­ µƒÌ ±
 ñ
¨ ¨ ÂÂÂ Û

21
where   denote the bits of the binary encoding of in a fixed numbering of  , and where  is the
set of  such that !#"$
&%' and )( is the set of  such that !#"$
* . Finally, the formula + is defined
as ,
456!78 -/. 69;:<8 -43 69=
-/.12 0 -43

where  and ( range over  . This completes the definition of >@? . Note that + is used to make >@?A"CBED
whenever the sets 8G- F are not disjoint.

6 Omitting types and definability


Let H be an algebra. A congruence of H is an equivalence relation I that is invariant with respect to all
operations of H . In other words, for any (J -ary) operation K of H and any LM;&L9NM ; NPOQH such
that L9RS R4TOUI we have  KVL  ;&L N KV  W N =TOUI . The congruences of H form its congruence
lattice X7Y[Z;\H] . A prime quotient in this lattice is a pair of congruences I#=^ such that I`_a^ , Ic"c b ^ , and
for any d with Ie_$df_g^ we have either If"hd , or ^A"id . The fact that Ij=^ is a prime quotient will
be denoted by Iakc^ . For any LUOlH we denote by L!m the equivalence class containing L . The set of all
equivalence classes is called the quotient set, Bon . The fact that I is a congruence allows one to define the
m
action of any operation of H on the quotient set:

K m L m  &L Nm #"$ KVLpW&L'Np= m 

The quotient set endowed with all the operations K)m is called the quotient algebra Hqn of H . It is not hard
m
to see that Hqn is the homomorphic image of H under the homomorphism that takes LrOsH to L m .
m

6.1 Unary and affine types and modules


Tame congruence theory [18] allows one to assign to each prime quotient of the congruence lattice X7Y[ZW\Hq
of a finite algebra H one of five types. The type reflects the local structure of the algebra, which can be one
of the following:

1. a finite set with a group action on it,


2. a finite vector space over a finite field,
3. a two-element Boolean algebra,
4. a two-element lattice,
5. a two-element semilattice.

In the sequel we also refer to type 1 as the unary type and to type 2 as the affine type. We use tame congruence
as a black box extracting properties we need from existing results, and we do not therefore need a precise
definition of the types. The type of a prime quotient ItkA^ is denoted by uv9w Ij=^x , while uv9w\H] denotes
the set of types appearing as types of some prime quotient of H . If y is a class of algebras, uv9wz{yT denotes
the set |~}V
€@uv!w!\Hq . If ‚O<
b uv!w{yT , we say that y omits type  . Otherwise, we say y admits type  .
Lemma 25. Let H be a finite idempotent algebra. If ƒ…„…†
\Hq admits types 1 or 2 then it contains a finite
idempotent reduct of a module.

22
Proof. By a result from [6], if ‡…ˆ…‰
Š\‹qŒ does not omit type 1 then it contains a finite set, that is an algebra all
of whose operations are projections. So, suppose that ‡…ˆ…‰
Š\‹]Œ omits type 1, but does not omit type 2.
Since ‡ˆ…‰
Š\‹qŒ does not omit type 2, there is a finite algebra Ž‘‡…ˆ…‰
Š\‹qŒ and a prime quotient ’”“A•–
—7˜[™ ŠŽšŒ such that ›œ!!Š ’#ž=•Œ Ÿ¢¡ . Note first that taking Žš£¤ instead of Ž we may assume that ’`Ÿh¥ , the
equality relation, because it follows from tame congruence theory that ›œ!!Š ’x£¦Mž=•£¦Œ§Ÿe›œ!Š ’#ž=•Œ for any
¨t© ’ . Next we note that since Ž is an idempotent algebra, every congruence class of • is a subalgebra.
Take a non-trivial • -class, and let ª be the corresponding subalgebra. The restriction of • to « is the total
congruence ¬ .
A congruence ­ centralizes ® modulo ¯ if for any term operation °VŠ\±;²ž³³³;ž=±M´ž=µ²ž³³³;ž=µ´¶ž&·²ž³³³;ž&·
¸…Œ ,
² ² ² ² ²
any ¹ ² ž³³³;ž&¹7¸Qlº , and any » ² ž³³³;ž&» ´ , »9¼ ² ž³³³;ž&»!´¼ , ½ ² ž³³³Wž½ ¾ , ½1¼ ² ž³³³;ž½1¾¼ in º such that Š» ¿ ž&»9¿¼ ŒGÀ­ ,
Š ½ ¿ ² ž½1¿¼ ŒÁs® , the following implication holds:
² ² ² ² ÃÂ ² ²
°VŠ» ² ž ³³³Wž&» ´ ž ½ ² ž³³³ž½ ¾ &ž ¹
²ž³³³;ž&¹7¸[Œ °VŠ» ¼ ² ž³³³;ž&» ´¼ ž½ ² ž³³³;ž½ ¾ &ž ¹
²ž³³³Wž&¹1¸Œ
Ä
² ² ÃÂ
°VŠ» ² ž ³³³Wž&» ´ ž ½ ¼ ² ž³³³ž½ ¾¼ ž&¹
²ž³³³;ž&¹7¸[Œ °VŠ» ¼ ² ž³³³;ž&» ´¼ ž ½ ¼ ² ž³³³;ž½ ¾¼ ž&¹
²ž³³³Wž&¹1¸Œ³

It is known that ›œ9Š\®¶ž&­9ŒšÆÅ'Çpž¡ÉÈ if and only if ­ centralizes itself modulo ® (see [18, Theorem 7.2]).
In our situation we have that • centralizes itself modulo ¥ in Ž . Therefore, ¬ centralizes itself modulo
¥ in ª . This implies ›œ9!Š{ª;ŒÆÊËÅ'Çpž¡ÉÈ , and, since ‡ˆ…‰Š\‹]Œ omits type 1, we obtain ›œ!!Š{ª;ŒQŸÌō¡)È . By
Theorem 9.6 of [18] there is a ternary term operation Í that is Mal’tsev on ª , that is Í satisfies the identities
ͶŠ\±Wž=µ¶ž=µpŒ#ŸfͶŠ\µž=µ¶ž=±ÉŒ#Ÿa± . Therefore ª generates a congruence permutable variety, and by a result of [17]
it is an idempotent reduct of a module.

Recall from Section 3 the definition of the structure ÎoÏÐ Ñ for every finite Abelian group Ò and every
integer Ó]Ôf¬ .

Lemma 26. Let Õ be a finite module, let Ò be the Abelian group underlying the ring of Õ , and let ‹ be
an idempotent reduct of Õ . Then ‹ is a reduct of the algebra of ÎTÏzÐ Ñ for every Ó]Ôf¬ .

Proof. Let ÎfŸAÎ ÏÐ Ñ . Every Ö -ary term operation of ‹ can be represented in the form

°VŠ\±²ž³³³ž=± ¾ ŒjŸ`Ó²=±;²×`ØØ؍×lÓ ¾ ± ¾ ž

and, as ° is idempotent, Ó²‚×cØØØz×AÓ ¾ ŸÙ¬ . Take Ö tuples Ú)²ž³³³;ž&Ú ¾ in the relation ÛÝÜ Þ in Î , where
Ú ¿ Ÿ$Š» ¿ ²ž³³³Wž&» ¿ Œ for ß#ÆÅ'¬…ž³³³ž=ÖÆÈ . Check that the tuple
Ü
Š °VŠ» ²=² ž³³³Wž&» ¾ ² Œž³³³;ž°VŠ» ² ž ³³³Wž&» ¾ Œ=Œ
Ü Ü
also belongs to Û ÜÞ :

°VŠ»M²=²ž³³³;ž&» ¾ ²1Œ×`ØØ؅ז°VŠ»p² ž³³³;ž&» ¾ Œ


Ü Ü
Ÿ Š\Ó[²»p²=²×`ØØ؅×lÓ » ¾ ²1ŒÉ×AØØ؍×aŠ\Ó²»M² ×`ØØ؅×lÓ ¾ » ¾ Œ
Ü Ü Ü
Ÿ Ó ² Š» ²=² ×`ØØ؅×à» ² Œ×`ØØ؍×àÓ ¾ Š» ¾ ² ×`ØØ؅×à» ¾ Œ
Ü Ü
Ÿ Ó[²»o×`ØØ؅×lÓ ¾ »
Ÿ »¶³

Therefore, every relation of Î is invariant under every operation of ‹ . That is, ‹ is a reduct of the algebra
of Î .

23
6.2 Unary and affine types and definability
We can bring together the results of Section 5 and the previous subsection to establish the following theorem.

Theorem 27. Let á be a finite structure and let â be its algebra. If ãä…åæâ‚ç admits types 1 or 2 then there
exists a non-trivial finite Abelian group è such that éÝêëEæìoíî ïç‚ðšñò/ó\òSôöõ=÷TéEêëEæáqç for every ø]ùfú .

Proof. Since éÝêë§æá]çsûüéÝêzëEæý7þå&ÿ9æáqç=ç , where ý7þå&ÿ'æáqç is the core of á , we may assume that á is a
core. Let be the singleton-expansion of á and let  be its algebra, which is idempotent. By Lemma 23,
we have éÝêzëEæ ç<ðšñò/ó\òSôöõ=÷ÆéÝêëEæáqç . Moreover, if ãä…åæâ‚ç admits types 1 or 2, so does ãä…åæ]ç because
 is a reduct of â (see [18, Chapter 5]). By Lemma 25, the variety ãä…åæ]ç contains a finite idempotent
reduct  of a module. Let è be the Abelian group underlying the ring of the module. Then è is non-trivial
and finite. Moreover,  is a reduct of the algebra of ì íî ï for every øÆù ú by Lemma 26. It follows that
éÝêë§æìTízî ï7ç‚ðšñò/óòSôöõ=÷TéÝêëEæ ç . Composing we get the result.
We have seen in Section 3 that éÝêë§æìTízî ç is not definable in é when è is non-trivial. Since defin-

ability in é  is preserved downwards by Datalog-reductions, this yields the following corollary:


Corollary 28. Let á be a finite structure and let â be its algebra. If éÝêzëEæáqç is definable in é , then

ã…ä…å
æâ‚ç omits types 1 and 2.
Corollary 28 can be seen as a strengthening of the result of Larose and Zadori [25] that if the complement
of éÝêëEæáqç is definable in Datalog then ãä…å
æâšç omits types 1 and 2. Larose and Zadori also conjectured
the converse, namely that if ã…ä…å
æâšç omits types 1 and 2 then the complement of éÝêëEæáqç is definable in
Datalog. By Corollary 28 this conjecture would imply that every éÝêëEæáqç is either definable in Datalog or
not definable in é  , which can be seen as a definability dichotomy.

Another consequence of Corollary 28 is that graph 3-colourability (i.e., éEêëEæ
ç ) is not definable in
é  , since its algebra has no operations but the projections and therefore admits type 1.


Corollary 29. Graph 3-colourability is not definable in é .




While this has previously been proved directly [11], our result gives a new proof that gives an algebraic
explanation for why the problem is not definable.

References
[1] A. Blass, Y. Gurevich, and S. Shelah. On polynomial time computation over unordered structures. J.
Symbolic Logic, 67(3):1093–1125, 2002.

[2] V.G. Bodnarchuk, L.A. Kaluzhnin, V.N. Kotov, and B.A. Romov. Galois theory for post algebras. i.
Kibernetika, 3:1–10, 1969. [Russian].

[3] A. A. Bulatov and V. Dalmau. A simple algorithm for mal’tsev constraints. SIAM J. Comput., 36(1):16–
27, 2006.

[4] A. A. Bulatov, P. Jeavons, and A. Krokhin. Classifying the complexity of constraints using finite
algebras. SIAM Journal on Computing, 34:720–742, 2005.

[5] A.A. Bulatov. Mal’tsev constraints are tractable. Technical Report PRG-RR-02-05, Computing Labo-
ratory, University of Oxford, Oxford, UK, 2002.

24
[6] A.A. Bulatov and P.G. Jeavons. Algebraic structures in combinatorial problems. Technical Report
MATH-AL-4-2001, Technische universität Dresden, Dresden, Germany, 2001.

[7] G. Buntrock, C. Damm, U. Hertrampf, and C. Meinel. Structure and importance of logspace-MOD
class. Mathematical Systems Theory, 25:223–237, 1992.

[8] S. Burris and H.P. Sankappanavar. A course in universal algebra, volume 78 of Graduate Texts in
Mathematics. Springer-Verlag, New York-Berlin, 1981.

[9] V. Dalmau. Linear datalog and bounded path duality of relational structures. Logical Methods in
Computer Science, 1(1), 2005.

[10] V. Dalmau, Ph.G. Kolaitis, and M.Y. Vardi. Constraint satisfaction, bounded treewidth, and finite
variable logics. In Proceedings of the 8th International Conference on Principles and Practice of Con-
straint Programming, CP’02, Lecture Notes in Computer Science, pages 311–326. Springer-Verlag,
2002.

[11] A. Dawar. A restricted second order logic for finite structures. Information and Computation, 143:154–
174, 1998.

[12] R. Diestel. Graph Theory. Springer, 1997.

[13] H-D. Ebbinghaus and J. Flum. Finite Model Theory. Springer, 2 edition, 1999.

[14] T. Feder and M.Y. Vardi. Computational structure of monotone monadic SNP and constraint satisfac-
tion: A study through Datalog and group theory. SIAM Journal of Computing, 28:57–104, 1998.

[15] D. Geiger. Closed systems of function and predicates. Pacific Journal of Mathematics, pages 95–100,
1968.

[16] L. Hella. Logical hierarchies in PTIME. Info. and Comput., 129:1–19, 1996.

[17] C. Herrman. Affine algebras in congruence-modular varieties. Acta Sci. Math. (Szeged), 41:119–125,
1971.

[18] D. Hobby and R.N. McKenzie. The Structure of Finite Algebras, volume 76 of Contemporary Mathe-
matics. American Mathematical Society, Providence, R.I., 1988.

[19] N. Immerman. Descriptive Complexity. Springer, 1999.

[20] P.G. Jeavons, D.A. Cohen, and M. Gyssens. Closure properties of constraints. Journal of the ACM,
44:527–548, 1997.

[21] P.G. Jeavons, D.A. Cohen, and M. Gyssens. How to determine the expressive power of constraints.
Constraints, 4:113–131, 1999.

[22] P.G. Jeavons, D.A. Cohen, and J.K. Pearson. Constraints and universal algebra. Annals of Mathematics
and Artificial Intelligence, 24:51–67, 1998.

[23] Ph.G. Kolaitis and M.Y Vardi. A game-theoretic approach to constraint satisfaction. In Proc. 17th
National Conference on Artificial Intelligence, AAAI-2000, pages 175–181, 2000.

[24] B. Larose, C. Loten, and C. Tardif. A characterisation of first-order constraint satisfaction problems.
In Proc. 21st IEEE Symp. on Logic in Computer Science, pages 201–210, 2006.

25
[25] B. Larose and L. Zádori. Bounded width problems and algebras. Algebra Universalis, 58:439–466,
2007.

[26] L. Libkin. Elements of Finite Model Theory. Springer, 2004.

[27] A.K. Mackworth. Consistency in networks of relations. Artificial Intelligence, 8:99–118, 1977.

[28] U. Montanari. Networks of constraints: Fundamental properties and applications to picture processing.
Information Sciences, 7:95–132, 1974.

[29] O. Reingold. Undirected st-connectivity in log-space. In 37th Annual Symposium on Theory of Com-
puting, pages 376–385, 2005.

[30] P. Seymour and R.Thomas. Graph searching and a min-max theorem for treewidth. Journal of Com-
binatorial Theory, Series B, 58:22–33, 1993.

26

Вам также может понравиться