%\include{preamble}

\documentclass{report}
\usepackage{epsf}

\hbadness=10000
\vbadness=10000

%%%new macros of Sanjeev
%\newcommand{\mnote}[1]{{\tiny\marginpar[#1]{#1}}}
\newcommand{\mnote}[1]{}
\newcommand{\lb}{{\em (}}
\newcommand{\rb}{{\em)}~}
\newcommand{\sep}{{\, \mid \,}}
\newcommand{\PR}{{\Pi}}
\newcommand{\gf}{{\rm GF}}
\newcommand{\C}{{\cal C}}
\newcommand{\unsat}{{\sf UNSATISFIABILITY}}
\newcommand{\tautology}{{\sf TAUTOLOGY}}
%%%new macros of Sanjeev



\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{example}[theorem]{Example}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{claim}[theorem]{Claim}
\renewcommand{\Box}{{\vrule width0.6ex height1em depth0cm}}
\newenvironment{proof}{\noindent{\bf Proof:}}{\hfill \Box}
\newenvironment{newproof}[1]{\noindent{\bf Proof of #1:}\
}{$\Box$\medskip\par}
\newenvironment{Example}{\begin{example} \rm}{\end{example}}
\newenvironment{remark}{\noindent{\bf Remark:}\ }{\medskip\par}


\newcommand{\ra}{\rightarrow}



\newcommand{\calI}{{\cal I}}
\newcommand{\barZ}{{\bar{z}}}
\newcommand{\barY}{{\bar{y}}}
\newcommand{\barX}{{\bar{x}}}
\newcommand{\opt}{\mathop{\null OPT}}
\newcommand\mcut{\mbox{\rm MAX CUT}}
\newcommand{\qed}{\mbox{}\hspace*{\fill}\nolinebreak\mbox{$\rule{0.6em}{0.6em}
$}
}{}

\newenvironment{proofof}[1]{\par{\bf Proof of #1:}}{\(\qed\) \par}{}

\newcommand\LRA{{\Longrightarrow}}


\newcommand{\polyapx}{\mbox{\rm poly-APX}}
\newcommand{\logapx}{\mbox{\rm log-APX}}
\newcommand{\ptas}{\mbox{\rm PTAS}}
\newcommand{\fptas}{\mbox{\rm FPTAS}}

\newcommand{\defas}{\stackrel{{\rm def}}{=}}
\newcommand{\reals}{{\cal R}}
\newcommand{\integers}{{\cal Z}^+}
\newcommand{\eqdef}{\stackrel{\triangle}{=}}

\newcommand{\calf}{\mbox{${\cal F}$}}
\newcommand{\calr}{{\cal R}}
\newcommand{\calq}{{\cal Q}}
\newcommand{\cala}{{\cal A}}
\newcommand{\alb}{{\allowbreak}}
\newcommand{\x}{{\cal I}}
\newcommand\minlabelcover{\mbox{\sc Min Label-Cover}}
\newcommand{\acc}{\mbox{\sc Acc}}

\newcommand{\csp}{{\sf MAX~SAT}}
\newcommand{\maxcsp}{{\csp}}
\newcommand{\mincsp}{{\sf MIN~SAT}}
\newcommand{\minone}{{\sf MIN~ONES}}
\newcommand{\maxone}{{\sf MAX~ONES}}

\newcommand{\wcsp}{{\sf Weighted~MAX~SAT}}
\newcommand{\wmaxcsp}{{\wcsp}}
\newcommand{\wmincsp}{{\sf Weighted~MIN~SAT}}
\newcommand{\wminone}{{\sf Weighted~MIN~ONES}}
\newcommand{\wmaxone}{{\sf Weighted~MAX~ONES}}

\newcommand{\cspf}{{\csp(\calf)}}
\newcommand{\maxcspf}{{\csp(\calf)}}
\newcommand{\mincspf}{{\mincsp(\calf)}}
\newcommand{\minonef}{{\minone(\calf)}}
\newcommand{\maxonef}{{\maxone(\calf)}}

\newcommand{\wcspf}{{\wcsp(\calf)}}
\newcommand{\wmaxcspf}{{\wcsp(\calf)}}
\newcommand{\wmincspf}{{\wmincsp(\calf)}}
\newcommand{\wminonef}{{\wminone(\calf)}}
\newcommand{\wmaxonef}{{\wmaxone(\calf)}}

\newcommand{\msnp}{{\sf MAX~SNP}}
\newcommand{\lmsat}{{\sf LexMinSAT}}
\newcommand{\lmthreesat}{{\sf LexMin3SAT}}

\newcommand{\apx}{{\rm APX}}
\newcommand{\optp}{{\rm OptP}}

\newcommand{\vecx}{{\vec x}}
\newcommand{\vecy}{{\vec y}}

\newcommand{\maxcut}{{\sf MAX~CUT}}
\newcommand{\mincut}{{\sf MIN~CUT}}
\newcommand{\minuncut}{{\sf MIN~UNCUT}}

\newcommand{\vc}{{\sf VERTEX~COVER}}
\newcommand{\minvc}{{\sf MIN~VERTEX~COVER}}
\newcommand{\minvertexcover}{{\sf MIN~VERTEX~COVER}}
\newcommand{\bvc}{{\sf BIPARTITE~VERTEX~COVER}}
\newcommand{\clique}{{\sf CLIQUE}}
\newcommand{\is}{{\sf MAX~INDEPENDENT~SET}}
\newcommand{\dense}{{\sf Dense}}
\newcommand\setcoverB{\mbox{IHS-$B$}}
\newcommand\ihsbp{{\setcoverB$+$}}
\newcommand\ihsbn{{\setcoverB$-$}}
\def\calfb{\mbox{${\cal F}_{\rm HS}$}}
\def\calfta{\mbox{${\cal F}_{\rm 2A}$}}
\newcommand{\AND}{\bigwedge}
\newcommand{\OR}{\bigvee}
\def\mincnf{\mbox{\sc Min 2CNF Deletion}}
\def\horn{\mbox{\sc Min Horn Deletion}}
\def\minhorn{\mbox{\sc Min Horn Deletion}}
\def\nearestcp{\mbox{\sc Nearest Codeword}}
\def\calfc{\mbox{${\cal F}_{\rm 2CNF}$}}
\def\twocnf{{\rm 2CNF}}
\def\wcnf{{\twocnf}}
\newcommand{\aux}{\mbox{\small\sc Aux}}
\def\calfa{\mbox{${\cal F}_{\rm A}$}}
\def\calfp{\mbox{${\cal F}_{\rm WP}$}}
\def\calfn{\mbox{${\cal F}_{\rm WN}$}}
\def\calfh{\mbox{${\cal F}_{\rm Horn}$}}
\def\calfo{\mbox{${\cal F}_1$}}
\def\calfz{\mbox{${\cal F}_0$}}
\def\calfsz{\mbox{${\cal F}_{\rm S0}$}}
\def\calfm{\mbox{${\cal F}_{\rm 2M}$}}


\newcommand{\calF}{{\cal F}}
\newcommand{\CC}{{\cal C}}
\newcommand{\qq}{{\cal Q}}
\newcommand{\T}{{\sf T}}
\newcommand{\F}{{\sf F}}
\newcommand{\hh}{{\sf H}}
\newcommand{\xor}{{\sf XOR}}
\newcommand{\xnor}{{\sf XNOR}}
\newcommand{\myxor}{{\sf XOR}}
\newcommand{\rep}{{\sf REP}}
\newcommand{\myxnor}{{\sf XNOR}}
\newcommand{\bor}{{\sf OR}}
\newcommand{\myor}{{\sf OR}}
\newcommand{\mynand}{{\sf NAND}}
\newcommand{\oneinthree}{{\sf One\_in\_Three}}
\newcommand{\sor}{{\sf SymOR}}

\newcommand{\apred}{{\leq_{\rm AP}}}
\newcommand{\ared}{{\leq_{\rm A}}}


\newcommand{\p}{{\rm P}}
\newcommand{\pspace}{{\rm PSPACE}}



\newcommand{\np}{{\rm NP}}
\newcommand{\conp}{{\rm coNP}}
\newcommand{\fp}{{\rm FP}}
\newcommand{\nc}{{\rm NC}}
\newcommand{\pls}{{\rm PLS}}


\newcommand{\zoconsistent}{{\rm 0/1-consistent}}
\newcommand{\zconsistent}{{\rm 0-consistent}}
\newcommand{\oconsistent}{{\rm 1-consistent}}



\newcommand{\sat}{{\sf SAT}}
\newcommand{\qsat}{{\sf QSAT}}
\newcommand{\meta}{{\sf Meta}}
\newcommand{\sa}{{\tt sat}}
\newcommand{\inverse}{{\sf Inverse}}
\newcommand{\Sat}{{\sf SAT}}
\newcommand{\tsat}{\mbox{\sf 3-SAT}}
\newcommand{\qtsat}{{\sf Q3SAT}}
\newcommand{\Max}{{\sf Max}}
\newcommand{\Min}{{\sf Min}}
\newcommand{\Cut}{{\sf Cut}}
\newcommand{\Pos}{{\rm Pos}}

\newcommand{\Flip}{{\sf Flip}}
\newcommand{\Swap}{{\sf Swap}}



%%%INPUT RESTRICTED MACROS BEGIN HERE====================
\newcommand{\suc}{\mbox{{\sc succ}}}
\newcommand{\base}{\mbox{{\sc base}}}
\newcommand{\vlist}{\mbox{{\sc vlist}}}
\newcommand{\Null}{\mbox{{\sc null}}}
\newcommand{\proj}{\mbox{{\sc proj}}}
\newcommand{\ext}{\mbox{{\sc ext}}}
\newcommand{\wt}{\mbox{{\sc wt}}}
\newcommand{\profit}{\mbox{{\sc pt}}}
\newcommand{\join}{\mbox{{\sc join}}}
\newcommand{\forget}{\mbox{{\sc forget}}}
\newcommand{\introduce}{\mbox{{\sc introduce}}}
\newcommand{\PTAS}{\mbox{\rm PTAS}}
\def\comment#1{\marginpar{\tiny #1}}
\def\opt{\mbox{\rm OPT}}

\newcommand\pcp{\mbox{\rm PCP}}
\newcommand\npo{\mbox{\rm NPO}}
\newcommand\snp{\mbox{\rm SNP}}
\newcommand\apxpb{\mbox{\rm APX-PB}}
\newcommand\mnp{\mbox{\rm MAX NP}}
\newcommand\maxnp{\mbox{\rm MAX NP}}
\newcommand{\maxsnp}{\mbox{\rm MAX SNP}}


\newcommand{\fof}{\mbox{\sc fof}}
\newcommand{\fofs}{\mbox{{\sc fof}s}}
\newcommand{\eps}{\epsilon}
\newcommand{\planar}{{\sf Planar}}
\newcommand{\outerplanar}{{\sf Outerplanar}}


\newcommand\msat{\mbox{\sf MAX SAT}}
\newcommand\mtsat{\mbox{\sf MAX 3-SAT}}


%%%INPUT RESTRICTED MACROS END HERE====================

%%%COMPLEXITY MACROS BEGIN HERE====================

%PLEASE CHANGE THE DEFINITION OF THE MACRO \clique to {\sf CLIQUE}
%PLEASE CHANGE THE DEFINITION OF THE MACRO \tsat to {\mbox{\sf 3-SAT}}

\newenvironment{notation}{\noindent{\bf Notation:}\ }{\medskip\par}

\newcommand{\lra}{\longrightarrow}

\newcommand{\dtime}{{\rm DTIME}}
\newcommand{\ntime}{{\rm NTIME}}
\newcommand{\dspace}{{\rm DSPACE}}
\newcommand{\nspace}{{\rm NSPACE}}
\newcommand{\npspace}{{\rm NPSPACE}}
\newcommand{\po}{{\rm PO}}
\newcommand{\fnc}{{\rm FNC}}
\newcommand{\rnc}{{\rm RNC}}
\newcommand{\ac}{{\rm AC}}
\newcommand{\calC}{{\cal C}}
\newcommand{\calR}{{\cal R}}
\newcommand{\maxclique}{{\sf MAX~CLIQUE}}
\newcommand{\mclique}{{\sf MAX~CLIQUE}}
\newcommand{\minstcut}{\mbox{\sf s,t-MIN~CUT}}
\newcommand{\msc}{{\sf MIN~SET~COVER}}
\newcommand{\maxflow}{{\sf MAX~FLOW}}
\newcommand{\maxcutswap}{\mbox{\sf MAX~CUT-Swap}}
\newcommand{\twosatflip}{\mbox{\sf 2-SAT-Flip}}
\newcommand{\twosat}{\mbox{\sf 2-SAT}}
\newcommand{\ksat}{\mbox{\sf k-SAT}}
\newcommand{\hsb}{\mbox{\sf HITTING~SET-B}}

%%%COMPLEXITY MACROS END HERE====================




%\documentstyle[11pt,fullpage]{book}
%\documentstyle[epsf]{report}
%\documentclass{report}
%\usepackage{epsf}


\title{Complexity  Classifications of Boolean Constraint Satisfaction
Problems}

\author{Nadia Creignou\\
Sanjeev Khanna\\
Madhu Sudan}
\date{}

\begin{document}


\iffalse
%\oddsidemargin 39pt \evensidemargin -3pt
\marginparwidth 40pt \marginparsep 10pt
\topmargin 0pt \headsep .5in
\textheight 7.5in
\textwidth 8in
\brokenpenalty=10000
\renewcommand{\baselinestretch}{1.2}
\fi


\bibliographystyle{alpha}
\maketitle



\iffalse
\begin{abstract}

In 1978 Schaefer [Sch78] considered a subclass of languages in NP (generalized
satisfiability problems) that were expressible as ``constraint satisfaction
problems". In a dichotomy theorem he gave conditions under which a problem of
this class is in $\p$, otherwise it is $\np$-complete. Ever since this class of
problems has been widely studied by various authors. Several  dichotomy
theorems, in different complexity classes, have been obtained for the
corresponding: counting problems, enumeration problems, optimization problems
and inverse problems.
We present here a unified survey on these results. Moreover, we refine them in
proving that the dichotomy is preserved for tractable problems from the
standpoint of parallel computation ($\nc$/$\p$-complete). Besides, we study the
complexity of the ``meta-problems" induced by these dichotomy theorems.
Finally,
we consider the local search version of constraint satisfaction problems, in
the class $\pls$. We show that every ``difficult" (APX-hard) constraint
satisfaction optimization problem leads to a ``difficult" ($\pls$-hard)
local search problem.
\medskip


\noindent [Sch78] Thomas J. Schaefer, {\it The complexity of satisfiability
problems}, Proc. 10th Ann., ACM Symposium of Theory of Computing, Association
for
Computing Machinery, New-York (1978), 216-226.

\end{abstract}


\vfil\break

\fi



\tableofcontents

\newpage

\pagenumbering{arabic}

%\include{intro}



\chapter{Introduction}
\label{Introduction}

One of the fundamental goals of the theory of computation,
or ``complexity theory'', is to
determine how much of a computational resource is required to
solve a given computational task. Along the way it postulates
definitions of when a task is computationally ``easy'' and
when it is, or is likely to be, ``hard''. One of the modern
definitions of computational ``easiness'' or ``tractability''
is that the task be solvable in time polynomial in the size of
the input to the problem. A task is said to be ``intractable''
if there does not exist a polynomial time algorithm to solve it.
While these definitions are straightforward, it turns out to
be a highly challenging problem to explicitly classify a given
computational task as tractable or not. In fact, for a
wide variety of problems, of very differing flavor, this
classification task remains open. (The famed ``P = NP?''
question is an example of such a classification question.)

In the face of this difficulty in establishing concrete lower
bounds on the computational complexity of given problems, complexity
theory has focussed much of its attention on establishing a
partial order among the problems in terms of computational
difficulty. Crucial to this partial order is a computational
mechanism, called ``reduction'', that shows one problem is at least as hard as
another.
Informally, a reduction metamorphoses a given computational problem
into another, using only a bounded amount of computational resources,
say, in polynomial time.
If there exists a reduction from one problem to another,
then this shows that the starting problem is
tractable if the end-problem is tractable; or stated in the
contrapositive, the end-problem is at least as hard as the starting
problem.
Using the notion of reductions, complexity theory has
established a rich partial order among computational problems.
Even more significantly, it has discovered a rich collection of
equivalence classes of computational problems --- each class
contains numerous seemingly unrelated problems, that however,
turn out to be computationally equivalent. These equivalence
classes, commonly studied under the label of ``completeness in
complexity classes'', capture innumerable
phenomena that are uniquely computational in nature --- phenomena
that may have been easily overlooked if the computational restrictions
were ignored, and yet play a fundamental role in computer science
as well as human thought and reasoning.
Examples of such phenomena include, the complexity of searching
a maze, the complexity of playing games, the complexity of
enumerating solutions to a search problem, the complexity of finding
the ``best'' solution to a search problem, complexity of computing
with limited space, or even the complexity of determining the
complexity of a given problem! Arising from such phenomena
are a host of exciting complexity classes such as NP, PSPACE, \#P, MAX SNP,
LOGSPACE,
and NC. These classes are formally introduced in Chapter~\ref{Complexity
Classes}.

The above mentioned list of complexity classes is by no means
exhaustive. In fact
complexity theory deals with infinitely many complexity
classes, infinitely many questions and deals with uncountably
many possible resolutions to these questions. It inherits
these features from the fact that it places no limits on
the kind of computational problems it deals with. Any problem
that can be formally specified is included in its scope. This
powerful feature, however, can be a severely limiting factor
in its scope too! It limits the ability to present
results compactly --- the results are too diverse to allow
any compact presentation. In order to meaningfully reason about
infinitely many problems we need to be able to group them into
a small number of classes. Unfortunately,
there is a limited scope for unification, and it is hard to make
universal statements about the behaviour of natural problems.
Specifically, there is an intriguing result of
Ladner~\cite{ladner}
that shows that if $\p \ne \np$ then there exist
infinitely many equivalence classes between P and NP.
Further, a well-known theorem of Rice says that it is undecidable
to determine if a given problem is in P or not.
Thus these limitations are not mere perceptions, but rather
formally proven barriers.

This monograph attempts to get away from these inherent barriers
in the study of complexity theory by restricting its attention
to a ``microcosmos'' of computational problems, namely,
Boolean constraint satisfaction problems. We will define these shortly,
and then see that this restricted class of problems continues
to exhibit much of the natural diversity of computational
problems; without exhibiting the corresponding limitations.
In particular, we will see that it is possible to define
Boolean constraint satisfaction version of the complexity classes NP,
PSPACE, \#P, MAX SNP, NC etc.
and these classes continue to have a rich collection of
complete problems, which are actually complete for the whole
class (and not just for the restriction).
The classes continue to have infinitely many different problems.
However, it turns out that it is possible to completely classify
the complexity of all the problems in these classes. And even though
there are infinitely many problems in these classes whose
computational complexity is not completely resolved, it turns out
that there are only finitely many questions that are independent,
and only finitely many possible resolutions to these questions.
Thus, by focussing on this restricted world, it is possible to
present a reasonably accurate bird's eyeview of complexity theory
and the equivalence classes it has created;
and this is precisely what this monograph is intended to do.

\section{Constraint Satisfaction Problems}

We introduce constraint satisfaction problems informally by
describing the protoypical example, namely $\tsat$.
This problem arises from the area of Boolean logic.
An instance
of $\tsat$ is a ``formula'' $\phi = \phi(x_1,\ldots,x_n)$ defined
on $n$ Boolean variables $x_1,\ldots,x_n$.
Each variable can be assigned
either the value $0$ (associated with the logical value ``false'')
or the value $1$ (associated with ``true''). The $n$ variables
implicitly define $2n$ {\em literals} $l_1,\ldots,l_{2n}$,
with the literal $l_{2i-1}$ being associated with the variable $x_i$
and the literal $l_{2i}$ being associated with the negation of the
variable $x_{i}$ (the negation being denoted by $\neg x_i$ or
$\bar{x_i}$).
An assigment to the variables induces an assignment to the literals
in a natural way: $l_{2i-1} = x_i$, while $l_{2i} = \neg x_i$.
A clause $C = C(x_1,\ldots,x_n)$ is a disjunction of some $k$
literals: $C = l_{i_1} \vee \cdots \vee l_{i_k}$. The clause
$C$ is satisfied by some assignment to the variables $x_1,\ldots,x_n$
if at least one of the literals $l_{i_1},\ldots,l_{i_k}$ is set to
$1$ (or ``true'').
The length of the clause $C$ is defined to be $k$.
The formula $\phi$ then is the conjunction of some
integer number, $m$, of ``clauses'' $C_1,\ldots,C_m$, each of
length at most $3$. (More generally, the $\ksat$ problem has as
its instances, formulae in which each clause has length at most $k$.)
The formula $\phi$ is said to be satisfied by an assignment to
the variables $x_1,\ldots,x_n$ if every clause in $\phi$ is
satisfied by the assignment. A formula $\phi$ is said to be
satisfiable if it is satisfied by some assignment.

The computational problem $\tsat$ is that of deciding if a given
formula $\phi$ is satisfiable or not.
No polynomial time algorithms (i.e., running in time that is bounded
by a fixed polynomial in $n$ and $m$) are known for this problem.
This may come as a surprise to those unfamiliar with this problem;
however it turns out that there is overwhelming belief today
that such an algorithm may not exist. This belief is in turn
equivalent to the conjecture ``$\np \ne \p$'', as was shown by
the seminal result, obtained independently by Cook~\cite{Cook-71} and
Levin~\cite{Levin-73}, showing that ``$\tsat$ is NP-complete'',
i.e., $\tsat$ is actually as hard as
any problem in $\np$.

One view of the $\tsat$ problem is that it lays down a collection
of ``simple constraints'' on $n$ variables. Each clause $C_j$ is a
``constraint'' in that it rules out certain assignments
to the variables $x_1,\ldots,x_n$. These constraints are ``simple''
in that one can easily verify if a given assignment satisfies
a given constraint: simply inspect the values assigned to the
$3$ variables. Yet, the NP-completeness
of $\tsat$ (and the associated belief that $\np \ne \p$) indicates
that by stringing together $m$ constraints of this simple form,
one obtains a computational problem that is surprisingly hard.
A natural question at this point would be: What aspect of the definition of
the $\tsat$ problem led to this computational hardness? Is it
simply an artifact of stringing together a large number of
constraints or is there something specific about the constraints
(the clauses) of $\tsat$ that forced this to happen?

It turns out that there {\em is} something special in
the nature of the constraints of $\tsat$ that makes this
a computationally hard problem. This point is perhaps best illustrated
by contrasting with the classical $\twosat$ problem. This is just the
restriction of $\tsat$ to instances in which every clause
is of length at most $2$. A folklore result shows that the
$\twosat$ problem is actually solvable in polynomial time.

Somewhat further away from the logical setting
of $\tsat$ is the prolem of solving linear equations over $\gf(2)$.
Notice that the Boolean variables $x_1,\ldots,x_n$ could be
easily interpreted as elements of the finite field on two
elements, with addition and multiplication being performed
modulo $2$. Thus one can define a constraint satisfaction problem
motivated by this algebraic setting. Each constraint is
now a linear constraint on some $k$ variables; and our goal is
to determine if there exists an assignment satisfying all the
linear constraints. Using the fact that Gaussian elimination
works over any field, we see that this problem is also solvable
efficiently, in time $O((m+n)^3)$\footnote{This may be a good point
to remind the reader of the big-Oh notation: For functions
$f(\cdot)$ and $g(\cdot)$ mapping positive integers to the positive
integers, we say $f = O(g)$ if there exist $c,n_0 < \infty$ such
that $f(n) \leq c g(n)$ for all $n \geq n_0$. The big-Oh notation
allows for easy, but approximate computations between growth of
functions. We will be using this notation extensively.}.

In view of the three examples above, it becomes clear that
constraint satisfaction problems are neither trivially easy
nor trivially hard. This motivates the topic of this monograph
and our starting point is the work of Schaefer~\cite{Schaefer-78}.
The broad nature of this (and subsequent works)
is to study the complexity of deciding satisfiability
of a given constraint satisfaction problem as a
function of the ``nature'' of the constraint.
To this end,
Schaefer defined an infinite class of computational problems,
which he referred to as the ``generalized satisfiability problems''.
Informally speaking, a problem in this class is characterized by a
finite collection of finitely specified constraint templates%
\footnote{For the most part we will not care how these
constraints are specified. A canonical assumption would be that a
constraint is specified by a truth table. In
Chapter~\ref{The Complexity of the Meta-problems}, we
will describe some other natural representations for specifying
constraints.}, say ${\cal F}$.
An instance of such a problem, called the $\sat({\cal F})$ problem,
consists of $n$ Boolean variables and $m$ constraints applied to
various subsets of the given variables such that each constraint is drawn
from the collection ${\cal F}$. The objective is to determine if there is
an assignment to the input variables which satisfies all the given
constraints.
Schaefer was interested in studying the complexity of
answering the above question for every problem in the class.
His study led to a strikingly simple answer: every problem in this class
is either in $\p$ or is $\np$-complete. Moreover, there is a concise
characterization that allows us to determine whether for a given ${\cal
F}$, $\sat({\cal F})$ is in
$\p$ or is $\np$-complete.

Schaefer's result is surprising and unexpected
for several reasons. First, prior to this result, $\np$-completeness proofs
were established on a problem by problem basis.
Schaefer's result gave a uniform proof to establish $\np$-completeness of an
infinite collection of problems.
Second, rarely in complexity theory does one comes across an
infinite class of problems where every problem belongs to a
finite collection of (computational) equivalence classes.
The above mentioned result of Ladner had ruled out this possibility
if $\p \neq \np$.
Finally, the result comes with a compact collection of
classification rules, which tell when a problem is in $\p$ and
when it is $\np$-complete. This also overcomes the hurdle posed by
Rice's theorem!

Recent research in complexity theory has tried to generalize and
extend Schaefer's results in several ways.
In one direction,
Feder and Vardi~\cite{FederV-93} study generalize satisfiability problems
when the variables in the domain are not restricted to being Boolean, but
now allowed to take on any one of finitely many values.
They refer to their problems as Constraint Satisfaction Problems; and
we inherit this name from their work.
The simple change of allowing non-Boolean variables
seems to increase the expressive
power of the constraint satisfaction problems considerably.
Feder and Vardi raise the question of whether the dichotomy exhibited in
the Boolean case continues to hold in the non-Boolean case.
Surprisingly, this turns out to be a much harder question and remains
unresolved to this date. However Feder and Vardi prove a number of interesting
facts about constraint satisfaction problems including that this may
be the largest subclass of $\np$ (where largest is meant to be interpreted
carefully) that exhibits a dichotomy.
Since many central questions surrounding
non-Boolean constraint satisfaction problems remain unresolved,
we shall only focus on Boolean ``constraint satisfaction problems''
in this monograph.

There is a growing body of classification results for problems
derived from Boolean constraint satisfaction.
These results extend Schaefer's study and explore
different kinds of complexity classes restricted to constraint satisfaction
problems. This direction of research includes the works of
Creignou~\cite{Creignou-95},
Kavvadias and Sideri~\cite{KavvadiasS-96},
Creignou and Hermann~\cite{CreignouHr-96}
Creignou and H\'ebrard~\cite{CreignouHb-96},
Khanna and Sudan~\cite{KhannaS-96},
Khanna, Sudan and Williamson~\cite{KhannaSW-96},
Khanna, Sudan and Trevisan~\cite{KhannaST-97},
Reith and Vollmer~\cite{ReithV-98}.
Together they
have shown classification results for a variety of
computational tasks, where the goal of the computation varies
while the instance of the problem remains the same.
Some specific results in this sequence include the following.
Creignou~\cite{Creignou-95}
and Khanna and Sudan~\cite{KhannaS-96}
independently
studied
optimization problems where the objective is to maximize the number of
satisfied constraints in a given instance of a constraint satisfaction
problem. They show that every optimization problem in this
class
is either in $\p$ or APX-complete.
Kavvadias and
Sideri~\cite{KavvadiasS-96} studied
the inverse satisfiability problem where the goal is to construct a
collection of constraint applications such that a given set of truth
assignments constitutes its set of feasible solutions. They show dichotomy
results for this class of problems.
Creignou and Hermann~\cite{CreignouHr-96}
show a $\fp/\#\p$-complete dichotomy for
counting versions of constraint satisfaction problems where
the objective is to count the number of assignments satisfying all
constraints.
Creignou and H\'ebrard~\cite{CreignouHb-96} show a dichotomy with
respect to the complexity of
enumerating all satisfying solutions.
Reith and Vollmer~\cite{ReithV-98} have
studied a class of  optimization problems where the objective
is to find a lexicographically minimal (or maximal)
satisfying assignment.
Khanna et al.~\cite{KhannaSW-96,KhannaST-97} study other forms of commonly
occuring optimization tasks in the constraint satisfiability setting
and obtain classification results.
The results of Khanna et al.~\cite{KhannaSW-96,KhannaST-97} are somewhat
different from the others above in that the resulting classification
theorems do not exhibit dichotomies
but rather give a partition into a larger but finite number of
equivalence classes.

\section{Organization}

This monograph is a uniform survey of these results: results that we refer
to as classification results on constraint satisfaction problems.
En route, we present some
new classification results and a refinement of many of these results.
We now describe the layout of this monograph.
Chapters~\ref{Complexity Classes}-\ref{Constraint Satisfaction Problems}
give some of the introductory material
associated with our theme.
Chapter~\ref{Complexity Classes} gives a
(very) short summary of some of the common
complexity classes and related reductions.
Chapter~\ref{Constraint Satisfaction Problems}
formally introduces constraint satisfaction problems
and shows how the classes introduced in
Chapter~\ref{Complexity Classes} can be studied in this restricted setting.

Chapter~\ref{Characterizations of Constraint Functions}
initiates the technical study of constraint
satisfaction problems. It
describes some broad divisions among families
of constraints and shows some preliminary properties or
``characterizations'' of constraint families.
Recall that our eventual goal is to present results of the form:
``If all constraints in a given set of templates ${\cal F}$
satisfy a certain property ${\cal P}$, then a canonical algorithm
can be applied to solve the problem efficiently. The absence of
the property ${\cal P}$ can be used to show that solving the
constraint satisfaction problem associated with ${\cal F}$ is hard.''
\footnote{This is in the spirit of Post's classic
theorem which gives a characterization of all families $\calf$ that form
complete bases for all Boolean functions.}
A first step in this direction is to express succinctly what properties
are exhibited by a family $\calf$, if it does {\em not} satisfy a
property ${\cal P}$. This is the focus of
Chapter~\ref{Characterizations of Constraint Functions}.

Chapter~\ref{Implementation of Functions}
is the central chapter of this monograph and focusses on
a unifying theme among reductions between constraint satisfaction problems.
One of the surprising aspects of dealing with constraint satisfaction
problems is that even though there exist so many different variations
of the main theme; the tools used for dealing with them are essentially
the same. In fact, a similar view could be expressed of complexity theory
in general; however this would be more contentious. In our case, we can
actually ``prove'' this assertion. We introduce in
Chapter~\ref{Implementation of Functions}
a notion of how a family of constraints may be used to ``implement''
other constraints. We show that this one definition captures
reducibility among constraint satisfaction problems, almost
independent of the actual theme (be it decision, counting, enumeration
or optimization).
We then go on to show how the characterizations of
Chapter~\ref{Characterizations of Constraint Functions}
can be used to build a basic toolkit of implementations.

In the following chapters, we repeatedly employ this basic toolkit
to analyze different classes of constraint satisfaction problems.
Chapter~\ref{Dichotomy Theorems for  Boolean Constraint Satisfaction Problems}
presents dichotomy results for
decision, counting, space complexity, and parallel complexity.
Chapter~\ref{Classification Theorems for Optimization Problems}
presents classification results for optimization
problems.

One of the somewhat disappointing conclusions of the study of constraint
satisfaction problems is that too many problems turn out to be hard.
One possible reason for this is that instances typically have no restrictions
on how the variables interact with the constraints. In our final
Chapter~\ref{Input Restricted Constrained Satisfaction Problems}
we show that even to study such limitations of constraint
satisfaction problems, the best formal approach is via constraint
satisfaction.
We show how natural restrictions such as planarity and density
can be expressed naturally in this context; and further lead to
tractability results for otherwise intractable problems.

Finally, in
Chapter~\ref{The Complexity of the Meta-problems}
we go up one level in the nature of questions
asked. We focus on a computational version of the questions tackled
in Chapter~\ref{Characterizations of Constraint Functions}.
It asks: ``What is the complexity of determining
if a given family $\calf$ satisfies a property ${\cal P}$?''
Note that this question is relevant to the
complexity of evaluating the classification rules presented in
Chapters~\ref{Dichotomy Theorems for  Boolean Constraint Satisfaction
Problems}~and~\ref{Classification Theorems for Optimization Problems}.
Naturally
an answer to this question depends on the representation of $\calf$.
Chapter~\ref{The Complexity of the Meta-problems}
answers this question for several natural representations.

To conclude this chapter, we would like to point out that while
our framework of
``constraint satisfaction problems'' allows us to take a unified
look at complexity theory, this is by no means the only such framework.
We are aware of several
other families of classification results that are not covered
by our study. Examples of such results include:
classification results for the
directed subgraph homeomorphism problem
due to Fortune, Hopcroft and Wyllie~\cite{FortuneHW-80};
classification results for the $H$-coloring problem on graphs due
to Hell and Nesetril~\cite{HellN-90};
classification results on graph decomposition due to
Dor and Tarsi~\cite{DorT-97};
classification results for vertex deletion problems on monotone
graph properties due to Lund and Yannakakis~\cite{LundY-93}.
Even within the scope of constraint satisfaction problems, our
approach using implementations is not the only successful one.
An alternate approach due to Boros {\em et al}~\cite{BorosCHS-94}
uses a linear programming based approach to
measure the complexity of satisfiability problems.
We shall not, however, expand our scope to include
these alternate approaches. We shall remained focussed on
the approach via Boolean constraint satisfaction problems,
and hope to highlight its simple unifying view of complexity theory.


%\include{complexity}



\newcommand{\inds}{{\sf INDEPENDENT\ SET}}
\newcommand{\graphpartition}{{\sf GRAPH\ PARTITION}}
\newcommand{\vertexcover}{{\sf VERTEX\ COVER}}
\newcommand{\maxksat}{{\sf MAX $k$-SAT}}

\chapter{Complexity Classes}
\label{Complexity Classes}

Here we present a quick review of the various complexity classes
that arise in the course of our study.
We describe three basic forms of computational tasks:
Decision problems, Counting problems and Optimization problems.
In each case we describe some central complexity classes.
This includes the classical complexity classes such as
$\p$, $\np$ and  $\pspace$; some more recent ones such as
$\nc$ and $\#\p$; and some very modern ones such as
$\po$ and $\npo$ (the last ones arising from the
study of the approximability of optimization problems).
We then define notions of completeness for each
complexity class, by introducing appropriate notions of
reducibility. These definitions
form the backdrop for our study of
Boolean constraint satisfaction problems to be introduced
in Chapter~\ref{Constraint Satisfaction Problems},
where we will specialize all these classes to
the case of Boolean constraint satisfaction problems.

Our definitions rely on some well known formalisms
of models of computation.
The most commonly used models will be those of
deterministic and non deterministic Turing  machines;
and sometimes the notion of a random access machines
(see, for instance, \cite{HU-79}, \cite{Papadimitriou-94},
or \cite{Sipser-96}).
Other models of computation we rely on include
uniform Boolean (and arithmetic) circuits families (see,
for instance, \cite{GreenlawHR-95}).

\section{Decision Problems}
\label{sec:dp}

%We consider here decision problems, defined over a set of instances, for which
%the answer is ``yes " or ``no".

Decision problems are the simplest forms of computational tasks in
which the goal of the computation is to ``decide'' if a given
input satisfies as given property (or lies in a given language).
Formally,
a {\em decision problem} $\PR$ is a function that takes
as input a string
over a finite alphabet $\Sigma$ and maps it one of the two possible
answers, ``yes'' and ``no''.
A {\em language} is any subset of $\Sigma^*$.
There is a natural correspondence between decision problems and languages.
Given a decision problem $\PR$, we can associate with it a language
$L_{\PR} \subset \Sigma^*$ which consists of all strings that are mapped
to ``yes'' by the problem $\PR$. From here on, we will work with the
languages derived from the decision problems.

%\begin{definition}
%Let $L\subset \Sigma ^*$ be a language. Let $M$ be a Turing Machine such that
%for any string $x\in \Sigma ^*$, if $x\in L$ then $M$ accepts $x$ and if
%$x\not\in L$ then $M$ rejects $x$. Then we say that $M$ decides $L$.
%\end{definition}

\subsection{ The classes \p, \np, \conp, \pspace}




%We
%say that a deterministic Turing  machine $M$ operates within time
%(respectively,
%space) $f(n)$ if for any input string $x$ the time (resp. the space storage)
%required by $M$ on $x$ is at most $f(\vert x\vert)$.


%We
%say that a non deterministic Turing  machine $M$ operates within time
%(respectively, space) $f(n)$ if for any input string $x$ the machine $M$ does
%not have computation paths longer than
%$f(\vert x\vert)$ (resp. does not have computation paths using more than
%$f(\vert x\vert)$ space storage).
%\medskip

Let $f$ be a function whose domain and range are nonnegative integers.
We define below the notion of languages belonging to a time or space
complexity class.

\begin{definition}
{\rm [$\dtime(f(n))$ and $\dspace(f(n)$]}
The complexity class
$\dtime(f(n))$ \lb $\dspace (f(n)$ \rb is the class of all languages
accepted by a deterministic Turing  machine within time \lb space \rb $f(n)$.
\end{definition}

We can also define time and space complexity classes with non deterministic
Turing machines.

\begin{definition}
{\rm [$\ntime(f(n))$ and $\nspace(f(n)$]}
The complexity class
$\ntime (f(n))$  \lb $\nspace (f(n)$ \rb is the class of all languages
accepted by a non deterministic Turing  machine within time
\lb space \rb $f(n)$.
\end{definition}

\begin{definition}
{\rm [$\p$]}
The class of languages accepted in polynomial time by
a deterministic Turing  machine is denoted by
 $\p$:

$$\p =\bigcup_k \dtime(n^k).$$
\end{definition}


\begin{definition}
{\rm [$\np$]}
The class of languages accepted in polynomial time by
a non-deterministic Turing  machine is denoted by
$\np$:

$$\np =\bigcup_k \ntime(n^k).$$
\end{definition}


Taking the union over all exponents $k$ ensures that
these classes are stable and robust with respect to variations in
the underlying computational model (see
\cite{Papadimitriou-94}). For instance, $\p$\  is also the class of problems
decidable in polynomial time by a random access machine.

There is an alternative, and perhaps more natural, way of viewing
the class $\np$. One can define $\np$ as the class of languages where
membership has short, easily verifiable proofs. The easy
verfiability property is formalized via a polynomial time
computable binary relation $R$, and the NP language consists of all
strings $x$ for which there exists a short {\em proof} $y$ (also
called {\em certificate} or {\em witness}) such that $R(x,y)$
holds. We formalize this below.

\begin{definition}
Let $R\subseteq \Sigma ^*\times \Sigma ^*$ be a binary relation. The relation
$R$ is a {\em $p$-predicate } if there exist two polynomials $p$ and $q$ such
that:
\begin{itemize}
\item $\forall (x, y)\in \Sigma ^*\times \Sigma ^*, \ R(x,y) \hbox{ implies }
\vert y\vert \le p(\vert x\vert ),$
\item $\forall (x, y)\in \Sigma ^*\times \Sigma ^*, \ R(x,y) \hbox{ is
decidable
in time }  q(\vert x\vert ).$
\end{itemize}
\end{definition}

\begin{proposition} \label{another-def-np}
Let $L\subseteq \Sigma ^*$ be a language. Then $L\in\np$ if and only if there
exists
a $p$-predicate $R$ such that
$$L=\{ x \sep R(x,y)  \hbox{ for some } y\}.$$
\end{proposition}

Thus, intuitively speaking, the difference between $\p$ and $\np$ is
akin to the difference between
efficiently finding a proof of a statement and efficiently verifying a proof.
\medskip


Analogous to the  time complexity classes $\p$ and $\np$, we
can define the space complexity classes $\pspace$ and $\npspace$.

\begin{definition}
{\rm [$\pspace$ and $\npspace$]}
The class of languages accepted in
polynomial space by a deterministic \lb non-deterministic \rb Turing  machine
is denoted by $\pspace$ \lb $\npspace$ \rb:

$$\pspace =\bigcup_k \dspace(n^k),~\mbox{and}$$
$$\npspace =\bigcup_k \nspace(n^k).$$

\end{definition}

While for the time complexity a  fundamental unresolved question is whether $\p
=\np$,
a classic result of Savitch long ago settled the analogous question for space
complexity.

\begin{proposition} {\rm \cite{Savitch-70}}
$\pspace=\npspace$.
\end{proposition}



\begin{definition}
For any complexity class $\cal C$ ,  $co\cal C$ denotes the
following set:

$$co{\cal C} =\{ \Sigma ^* \setminus L\ :\  L\in {\cal C}\}.$$
\end{definition}


It is easily seen that if $\cal C$ is a deterministic, time or space,
complexity class then ${\cal C} =co{\cal C}$. Thus among the four
complexity classes introduced above, it is only relevant to study
the complement of the class $\np$, namely, the class $co\np$.

\subsection{Reductions and $\np$ and $\pspace$ Completeness}

Reductions play a central role in identifying the hardest problems
in any complexity class. We now define the appropriate notion of reductions
for the classes $\np$ and $\pspace$.


\begin{definition}
We say that a language
$L_1\subset \Sigma_1 ^*$ is {\em reducible} to a
language
$L_2\subset \Sigma_2 ^*$ if there is a function
$f: \  \Sigma_1 ^*\lra \Sigma_2 ^*$ such that
$\hbox{for all } x\in \Sigma_1 ^*, x\in  L_1 \hbox{ if and only if }
f( x)\in L_2.$
If the function $f$ is computable in polynomial time
by a deterministic Turing machine, we say that $L_1$
is {\em polynomial-time  reducible} to $L_2$.
Similarly, if the function $f$ is computable in logarithmic space (that is,
using $O(\log (\vert x\vert ))$ cells on any storage tape) by
a deterministic Turing machine, we say that
$L_1$ is {\em log-space  reducible } to $L_2$.
\end{definition}

Note that any log-space reduction is also a polynomial-time reduction.

\begin{proposition}
The composition of two log-pace \lb polynomial-time \rb reductions is a
log-space \lb polynomial-time \rb reduction.
\end{proposition}

The significance of these reductions comes from the following lemmas.

\begin{lemma}
If $L_1$
is polynomial-time  reducible to $L_2$ then $L_2 \in\p$ implies $L_1\in \p$
\lb and equivalently, $L_1 \not\in\p$ implies $L_2\not\in \p$ \rb.
\end{lemma}


\begin{lemma}
If $L_1$
is log-space  reducible to $L_2$ then
\begin{enumerate}
\item $L_2 \in\p$ implies $L_1\in \p$,
\item  $L_2 \in\nspace(\log ^k n)$ implies $L_1 \in\nspace(\log ^k n)$, and
\item $L_2 \in\dspace(\log ^k n)$ implies $L_1 \in\dspace(\log ^k n)$.

\end{enumerate}
\end{lemma}
 We can now introduce the notion of complete problems for $\np$
and $\pspace$.

\begin{definition}
{\rm [$\np$-Hard and $\np$-Complete]}
A language $L\subset \Sigma ^*$ is  {\em  $\np$-hard} if  every
language $L'$ in $\np$ is polynomial-time reducible to $L$.
If, in addition, $L$ belongs to the class $\np$, we say that $L$ is
 {\em  $\np$-complete}.
\end{definition}

If~$L_1$ is an \np-hard problem and there is a  polynomial-time reduction
from~$L_1$ to~$L_2$, then~$L_2$ is an \np-hard problem.
Observe that an $\np$-complete problem
$\PR\in\p\hbox { if and only if } \p = \np.$


\begin{example}
Consider the problem $\sat$ defined below:
\medskip

{\sc Instance :}  A Boolean CNF formula $\Phi$.
\smallskip

{\sc Objective :} Is there a
truth assignment that satisfies  $\Phi$?
\smallskip

\noindent
$\sat$ is the first problem shown to be
$\np$-complete~{\rm \cite{Cook-71,Levin-73}}.
\end{example}

There is a wide variety of other known $\np$-complete problems. We
shall list some of them here.
\begin{itemize}
\item $\ksat$ (${\sf k}\ge 3$):

{\sc Instance :}  A Boolean CNF formula $\Phi$ with  $k$
literals per clause.

{\sc Objective :} Is there a
truth assignment that satisfies  $\Phi$?
\item $\vc$:

{\sc Instance :} A graph $G=(V,E)$ and a positive integer $K\le\vert
V\vert$.

{\sc Objective :} Does $V$contain a vertex cover of size $K$ or less, i.e., a
subset
$V'\subseteq V$ with $\vert V'\vert \le K$ such that for each edge $\{u,v\}$ in
$E$ at least one of $u$ and $v$ belongs to $V'$.
\item $\clique$:

{\sc Instance :} A graph $G=(V,E)$ and a positive integer $K\le\vert
V\vert$.

{\sc Objective :} Does $V$ contain a clique of size $K$ or more, i.e., a subset
$V'\subseteq V$ with $\vert V'\vert \ge K$ such that every pair of
vertices in $V'$ are joined by an edge in $E$?

\item $\inds$:

{\sc Instance :} A graph $G=(V,E)$ and a positive integer $K\le\vert
V\vert$.

{\sc Objective :} Does $V$ contain an independent set
of size $K$ or more, i.e., a subset
$V'\subseteq V$ with $\vert V'\vert \ge K$ such that no two vertices
in $V'$ are joined by an edge in $E$?

\item \graphpartition:

{\sc Instance :}  A graph $G=(V,E)$, a weight $w(e)\in N$ for each $e\in
E$ and a positive integer
$K$.

{\sc Objective :} Is there a partition into two disjoint sets $V_1$ and $V_2$
such that the sum of the weights of the edges from $E$ that have one endpoint
in
$V_1$ and another endpoint in $V_2$, is at least $K$?
\end{itemize}

Polynomial-time reductions are also appropriate
for defining $\conp$-completeness.
Moreover, we have the following.

\begin{proposition} If $L\in\Sigma ^*$ is $\np$-complete then $\bar
L=\Sigma ^*\setminus L $ is $\conp$-complete.
\end{proposition}

The problems that are $\conp$-complete are the least likely ones to be in
class $\p$, or for that matter, even in the class $\np$.

\begin{proposition} If a $\conp$-complete problem is in $\np$ then $\np =
\conp$.
\end{proposition}

$\pspace$-completeness is defined using log-space reductions.

\begin{definition}
{\rm [$\pspace$-Hard and $\pspace$-Complete]}
A language $L\subset \Sigma ^*$ is  {\em $\pspace$-hard}  if
every language $L'$ in $\pspace$ is log-space reducible to $L$. If in
addition $L$ is a member of $\pspace$ then we say that $L$ is
{\em  $\pspace$-complete}.
\end{definition}


\begin{example}
A representative $\pspace$ problem is the problem $\qsat$:
\medskip

{\sc Instance :} A quantified formula $F=(Q_1\ x_1)(Q_2\ x_2)\ldots(Q_n\
x_n)\Phi$, where $\Phi$ is a  CNF formula with
Boolean variables $x_1,\ldots ,x_n$ and $Q_i$ is either the quantifier
``for all" or ``exists".
\smallskip


{\sc Objective :}  Is $F$ true?
\smallskip

\noindent
$\qsat$ is $\pspace$-complete~{\rm \cite{StockmeyerM-73}}.
\end{example}



\subsection{Parallel Complexity: The Class \nc\ and \p-Completeness}

We now review the parallel complexity class \nc\ as well as introduce
\p-complete problems, which are problems in $\p$ that are least likely
to have fast parallel algorithms.
The class \nc\ consists of problems that are solvable in polylogarithmic
time using only a polynomial number of processors. The formal definition
below uses uniform Boolean
circuits families (see \cite[Chapter 2, Section 2.3.1, page
30]{GreenlawHR-95}) as the underlying computational model.


\begin{definition}{\rm [$\nc^k$]}
For each integer $k\ge 1$ the class $\nc^k$ is the set of all languages $L$
such that $L$ is recognized by a uniform Boolean circuits family $\{\alpha
_n\}$ with $size(\alpha_n)=n^{O(1)}$ and $depth(\alpha_n)=O((\log n)^k)$.
\end{definition}


\begin{definition}{\rm [$\nc$]}
$\displaystyle \nc= \bigcup_k \nc^k.$
\end{definition}

\iffalse
Taking the union over all exponents $k$ ensures, as in $\p$ and $\np$, that
this class is stable and robust with respect to variations of the model (see
\cite{GreenlawHR-95}). For instance let us consider parallel random
access machines (PRAM's). A PRAM can be seen
as an infinite sequence of RAM's, or processors, $R_0, \ldots , R_i, \ldots$
where $R_0$ is a global memory accessible to all other RAM's and $R_j$ for
$j>0$ is a RAM with a local memory. Whereas in the sequential model a Turing
machine or a RAM performs one instruction per time unit, a PRAM with a
polynomial number of processors performs a polynomial number of instructions
per time unit. The class $\nc$ is is the set of all languages that are decided
in polylogarithmic time  by a PRAM with polynomially many processors.
\fi
\medskip

The class $\fnc$ is the the set of all functions that are computable in
polylogarithmic time using only polynomially many processors.

\begin{example}
Matrix multiplication is in $\fnc$.
\end{example}

It is clearly the case that every problem in the class \nc\ also belongs to
the class \p. However, an important open question is whether this inclusion
is proper. As in the case of \p\ versus \np\ question, complete problems
have been identified --- these are problems that are least likely to have
\nc\ algorithms. The notion of reductions used towards this end is that
of log-space reductions.

\begin{proposition}
If $L$ is log-space reducible to $L'$ and $L'\in\nc$ then $L\in\nc$.
\end{proposition}
We can now define $\p$-completeness.
\begin{definition}
{\rm [$\p$-Hard and $\p$-Complete]}
A language $L$ is $\p$-hard if  every language $L'$ in $\p$ is log-space
reducible to $L$. If, in
addition,~$L \in \p$, then we say that $L$ is
$\p$-complete.
\end{definition}

\begin{example}
Consider the problem of computing the maximum flow possible between two
given points in a capacitated network.
\medskip

\noindent
\maxflow :
\smallskip

{\sc Instance :} A directed graph $G=(V,E)$, with each edge labeled by a
capacity $c(e)$, two distinguished vertices source $s$ and sink $t$, and a
value $f$.

{\sc Objective :} Is there a flow of value $f$ from $s$ to $t$ that does
not violate any capacity constraints?
\medskip

\noindent \maxflow\  is $\p$-complete {\rm \cite{GoldshlagerSS-82}}.
\end{example}





\section{Counting Problems}

We have so far studied decision problems where we wish to determine
whether a feasible solution exists for a given input instance.
A natural extension of this question is to
determine the total number of feasible solutions for a given instance.

\subsection{The class \#\p}

Consider the following generalization of the $\sat$ problem, referred to as
$\#\sat$:

\medskip

{\sc Instance :}  A Boolean CNF formula $\Phi$.
\smallskip

{\sc Objective :} Compute the number of different
truth assignments that satisfy  $\Phi$?
\smallskip


In general, for any $\np$ language $L$, we can associate
a counting problem $\# L(x)=\# \{y \sep R(x,y)\}.$
We now define the class $\#\p$, the class of counting functions
associated with $\np$ problems.

\begin{definition}
{\rm [$\#\p$]}
A function $F\colon \Sigma ^*\ra N$ is in  $\#\p$ if there is a
$p$-predicate $R$ such that for all $x\in\Sigma ^*$,
$F(x)=\# \{y \sep R(x,y)\}.$
\end{definition}

By the same token,  FP denotes the class of functions $\Sigma ^*\ra
N$ computable in deterministic polynomial time. Clearly, FP is a subclass of
\#\p.


\subsection{Parsimonious Reductions and $\#\p$- Completeness}




Counting problems are related to one another via {\em counting reductions\/}
and {\em parsimonious reductions\/}, which have stronger properties than the
polynomial-time reductions used for NP problems.

\begin{definition}[\cite{Kozen-92}]	\label{counting reduction def}
Let $f, g \colon \Sigma^* \ra N$ be two functions.  A {\em polynomial
many-one counting reduction\/} \lb or simply a {\em counting
reduction\/} \rb from~$f$ to~$g$ consists of a pair of polynomial-time
computable functions $\sigma \colon \Sigma^* \ra \Sigma^*$ and $\tau
\colon N \ra N$ such that the equality $f(x) =
\tau(g(\sigma(x)))$ holds.  When such a reduction
exists we say that~$f$ {\em reduces to\/}~$g$. Such reductions are
often called {\em weakly parsimonious\/}. A {\em parsimonious
reduction\/} from~$f$ to~$g$ is a counting reduction~$\sigma$, $\tau$
{from}~$f$ to~$g$ such that~$\tau$ is the identity function.
\end{definition}
The reductions in the \#P-hardness proofs must preserve the number of
solutions and hence the necessity to look for parsimonious or weakly
parsimonious reductions. Note that the (weakly)
parsimonious reductions are closed under composition.


\begin{definition}
{\rm [\#\p-complete]}
A counting problem~$\#L$ is {\em \#\p-hard} if for every problem $\#L' \in
\#P$ there exists a counting reduction from $\#L'$ to~$\#L$. If, in
addition,~$\#L$ is a member of \#\p, we say that the counting
problem~$\#L$ is  {\em \#\p-complete}.
\end{definition}
If~$\#L_1$ is a \#\p-complete problem and there is a counting reduction
from~$\#L_1$ to~$\#L_2$, then~$\#L_2$ is a \#\p-hard problem.\medskip

\begin{example}
The $\np$-completeness proof for $\sat$ can be adapted to show that
$\#\sat$ is $\#\p$-complete.
\end{example}

Even when a feasible solution to a problem can be found in polynomial time,
the counting version of the problem can be $\#\p$-complete.

\begin{example} The decision problem  $\twosat$ is in $\p$ \lb see
{\rm\cite{AspvallPT-79}}, for instance \rb whereas the corresponding counting
problem
$\#\twosat$ is $\#\p$-complete {\rm \cite{Valiant-79}}.
\end{example}


It is generally
believed that \#P-hard problems are not members of the class FPH, the
functional analog of the polynomial hierarchy PH. In particular, no
\#P-hard problem is known to belong to the class ${\rm FP}^{\rm NP}$
of all functions that are computable in polynomial time using NP
oracles~\cite[section~4.1]{Johnson-90}. In contrast,
Toda~\cite{Toda-89} showed that the polynomial hierarchy is contained
in the class ${\rm P}^{\rm \#P}$ of problems computable in polynomial
time with the help of \#P-oracles.  Thus, to the extent that
one can compare decision problems with counting problems, a
\#P-completeness result suggests a higher level of intractability than
an NP-completeness result.





\section{Optimization Problems}

A significant part of our study will be devoted to classifying the
approximability of $\np$ optimization problems (\npo). In this section we
review some basic concepts related to approximability and describe the
various approximation-preserving reductions that we will use.
We start with a formal definition of the class \npo.

\begin{definition}
{\rm [$\npo$]\cite{Johnson-74,CrescenziP-91}}
An  $\npo$ problem \lb over a finite alphabet $\Sigma$ \rb is a four-tuple
$\PR=(\calI, S, m, \opt)$ where
\begin{itemize}
\item $\calI \subseteq\Sigma^* $ is the space of {\em input instances}.

\item $S(x)\subseteq\Sigma^* $ is the space of {\em feasible solutions} on the
input $x\in\calI$. The only requirement on $S$ is that there exists a
$p$-predicate $R$, only depending on $\PR$, such that for all   $x\in\calI$,
$S$
can be expressed as $S(x)=\{y \sep R(x,y)\}$.

\item $m\colon \calI\times\Sigma^*\ra N$, the {\em objective function}, is a
polynomial time computable function, $m(x,y)$ is defined only when
$y\in S(x)$.

\item $\opt \in\{max,\ min\}$ tells if $\PR$ is a {\em maximization} or a {\em
minimization} problem.
\end{itemize}
\end{definition}

Solving an optimization problem $\PR$ given the  input $x\in\calI$ means
finding a feasible solution $y\in S(x)$ such that $m(x,y)$ is optimal, that
is as large as possible if $\opt_f=max$ and as small as possible if
 $\opt_f=\min$.
Let $\opt(x)$ denote this optimal value of $m$.

Many of the decision problems introduced in Section~\ref{sec:dp}
were obtained from optimzation problems. Here we describe
the underlying optimization problems related to \clique, \inds, \ksat,
\vertexcover, and \graphpartition. We start with $\maxclique$,
the optimization version of $\clique$, which
is an example of an $\npo$ maximization problem.

\begin{example}
$\maxclique$:
{\sc Instance :} A graph $G=(V,E)$.

{\sc Objective :} Find the largest clique in $G$.
\end{example}

Formally, $\maxclique$ can be
described by the tuple $(\calI, S, m, \opt)$ where the space $\calI$ of
input instances consists of all graphs $G$, the
set of feasible solutions $S(G)$ is the set of cliques $C$  of $G$,
the objective function $m(G,C)$ is the cardinality of $C$, and $\opt=\max$.

Some of the other standard optimization problems are described below.
We skip the straightforward translation that would show that these
are $\npo$ problems.

\begin{itemize}
\item \maxksat:

{\sc Instance :}  A Boolean CNF formula $\Phi$ with $m$ clauses,
each having upto $k$ literals per clause.

{\sc Objective :} Find the truth assignment that satisfies the
maximum number of clauses in $\Phi$.

\item $\minvc$:

{\sc Instance :} A graph $G=(V,E)$ and a collection of weights
$w(u)$ for each $u \in V$.


{\sc Objective :} Find a vertex cover $C$ of the graph $G$ that
minimizes the sum of weights of vertices in $C$.

\item \maxcut:

{\sc Instance :}  A graph $G=(V,E)$ and a collection of
weights $w(e)\in N$ for each $e\in
E$.

{\sc Objective :} Find a partition of $V$ into $V_1$ and $V_2$ that
maximizes the sum of the weight of edges with one endpoint each in
$V_1$ and $V_2$.
\end{itemize}

\begin{definition}
$\po$ is the class of $\npo$ problems that can be solved in polynomial time.
\end {definition}

\begin {example}
The $\minstcut$ problem defined below is in $\po$.
\smallskip


{\sc Instance :} A graph $G=(V,E)$, weight $w(e)$ for each $e\in E$, specified
vertices $s, t\in V$.


{\sc Objective :} Find a partition of $V$ into two disjoint sets $V_1$ and
$V_2$
such that $s\in V_1$, $t\in V_2$  so as to minimize the sum of the weights of
the edges from $E$ that have an endpoint in $V_1$ and one endpoint in $V_2$.
\end {example}

\subsection{Approximate Solutions and Approximation Classes}

Unless $\p = \np$, there do not exist algorithms to compute optimal
solutions to $\np$-hard optimization problems in polynomial time.
It is then natural to consider a relaxed objective, namely, that of
finding approximate solutions i.e. solutions that are close to the
optimal value but not necessarily optimal. Polynomial-time algorithms
that do not necessarily compute an optimal solution for an underlying
problem, are referred to as {\em approximation algorithms}. As it turns out,
$\npo$
problems exhibit a very diverse behaviour with respect to approximability.
At one end of the spectrum, there are $\np$-hard optimization problems for
which one can find in polynomial time solutions that are arbitrarily close to
optimal.
On the other hand, for many problems, it is $\np$-hard to even compute a
solution that is only a polynomial factor away from the optimal.
The goal of this section is to introduce some frequently arising
approximability behaviours and the notion of approximation-preserving
reductions.

\begin{definition}{\rm [Performance Ratio]}
An approximation algorithm  for an $\npo$ problem $\PR$ has {\em performance
ratio}
$\calR (n)$ if, given an instance $x\in\calI$ with $\vert x\vert=n$, it
computes a solution $y\in S(x)$ which satisfies
$$max\left\{ {m(x,y)\over \opt(x)}, {\opt(x)\over m(x,y)
}\right\}\le\calR (n).$$
\end {definition}

A solution satisfying the above inequality is referred to as being {\sl
$\calR(n)$-approximate}. We say that an $\npo$ problem is {\sl approximable to
within  a factor $\calR(n)$}  if it has a polynomial-time approximation
algorithm
with performance ratio $\calR(n)$.


%\subsection{The Classes \PTAS, \apx, \logapx, and \polyapx}

An algorithm which approximates an $\npo$ problem $\PR$ to within $1$ by
definition finds an optimal solution to the problem in polynomial time. For
any
$\np$-complete problem there is no such algorithm (unless $\p=\np$). But for
many $\np$-complete problems there are polynomial-time algorithms which
approximate them to within $1+\varepsilon$ for each $\varepsilon >0$. Such an
algorithm is called a {\em polynomial time approximation scheme} and is defined
as
follows.

\begin{definition} {\rm [$\PTAS$]}
We say that an optimization problem $\PR$ has a {\em  polynomial time
approximation scheme} \lb $\PTAS$ \rb if there is a polynomial-time
approximation algorithm that takes as input both an
instance $x\in\calI$ and a fixed parameter $\varepsilon >0$, and outputs a
solution which is $(1+\varepsilon)$-approximate.
\end {definition}

\begin {example}
The problem of finding a maximum independent set in a planar graph
has a $\PTAS$ {\rm \cite{baker}}.
\end {example}

Now we define three other kinds of approximability behaviours that
frequently arise in the study of $\npo$ problems.

\begin{definition}
{\rm [$\apx$]}
An $\npo$ problem $\PR$ is in the class $\apx$ if
there exists a polynomial-time algorithm for $\PR$ whose performance ratio is
bounded by a constant.
\end {definition}

\begin {example}
The optimization problem $\maxcut$ is in $\apx$.
 \end{example}


\begin{definition}
{\rm [$\logapx$ and $\polyapx$]}
An $\npo$ problem $\PR$ is in the class $\logapx$ \lb $\polyapx$ \rb if
there exists a polynomial-time algorithm for $\PR$ whose performance ratio is
bounded by a logarithmic factor \lb polynomial factor \rb in the size of the
input.
\end {definition}

\begin {example}
Let us consider the following two covering problems:
\medskip

\noindent
$\hsb$
\smallskip

{\sc Instance :} A collection $\calC$ of subsets of a finite set $S$, with
$\vert c\vert\le B$ for all $c\in\calC$.

{\sc Objective :}
Find a subset $S'\subseteq S$ that contains at least one element from each
subset  in  $\calC$ such that
$\vert S'\vert$ is minimum.

\medskip

\noindent
$\msc$
\smallskip


{\sc Instance :} A finite set $X$ and $\calC$ a collection of subsets of $X$
which covers $X$.

{\sc Objective :}
Find a sub-collection $\calC '\subseteq \calC$ which also covers $X$ such that
$\vert\calC '\vert$ is minimum.

\medskip

The problem $\hsb$ is in $\apx$ while $\msc$ is in $\logapx$.


\end {example}


\begin{example}
The problem $\maxclique$ is in $\polyapx$.
\end{example}



\subsection{Approximation-Preserving Reductions and $f$-$\apx$ Completeness}

Completeness in approximation classes is defined via appropriate
approximation-preserving reducibilities.
There are two different types
of approximation-preserving reducibilities that we will use in this work,
namely, {\em $A$-reducibility} and {\em $AP$-reducibility}.
The first of these below, preserves a coarse level of approximability,
while the latter is more fine in its preservation of approximability.
The coarser definition is useful because it is easier to obtain such
reductions; the finer one is needed when one is attempting to establish
completeness at low levels of approximability (such as, say, for
$\apx$).

\begin{definition}{\rm [$A$-reducibility] \cite{CrescenziP-91}}
An $\npo$ problem $\PR_1$ is said to be {\em $A$-reducible } to an $\npo$
problem
$\PR_2$, denoted by $\PR_1 \le_A \PR_2$, if two
polynomial-time computable functions $f$ and
$g$  and a constant $\alpha$ exist such that:
\begin{enumerate}
\item For any instance $x$ of $\PR_1$, $x\in\calI_1$, $f(x)$ is an instance
of $\PR_2$, $f(x)\in\calI_2$.
\item  For any instance $x\in\calI_1$, and for any feasible
solution $y'$ for $f(x)$,  $y'\in S_2(f(x))$, $g(x,y')$ is a feasible solution
for $x$,   $g(x,y')\in S_1(x)$.
\item For any instance $x$ of $\PR_1$ and for any $r>1$, if $y'$ is an
$r$-approximate solution for $f(x)$ then $g(x,y')$ is an $(\alpha
r)$-approximate for $x$.
\end{enumerate}
\end {definition}

\begin{definition}{\rm [$AP$-reducibility] \cite{CrescenziKST-95}}

An $\npo$ problem $\PR_1$ is said to be {\em $AP$-reducible } to an $\npo$
problem
$\PR_2$, denoted by $\PR_1 \le_{AP} \PR_2 $, if
two polynomial-time computable functions $f$
and $g$  and a constant $\alpha$ exist such that:
\begin{enumerate}
\item For any instance $x$ of $\PR_1$, $x\in\calI_1$, $f(x)$ is an instance of
$\PR_2$, $f(x)\in\calI_2$.
\item For any instance $x$ of $\PR_1$, $x\in\calI_1$, and for any feasible
solution $y'$ for $f(x)$,  $y'\in S_2(f(x))$, $g(x,y')$ is a feasible solution
for $x$,   $g(x,y')\in S_1(x)$.
\item For any instance $x$ of $\PR_1$ and for any $r>1$, if $y'$ is an
$r$-approximate solution for $f(x)$ then $g(x,y')$ is a $(1+(r-1)\alpha
+ o(1))$-approximate for $x$, where the $o$ notation is with respect to $\vert
x\vert$.
\end{enumerate}
\end {definition}

The main difference between the two reductions is in the item (3) of the
definitions. The requirement in this item is more stringent for an AP-reduction
and thus every AP-reduction is also an A-reduction, but not vice
versa. Some elementary properties of the above reductions are illustrated
below:
\begin{itemize}
\item If $\Pi_1$ is AP-reducible to $\Pi_2$ and $\Pi_2$ is in $\ptas$
(resp. \apx, \logapx\ or \polyapx)
then so is $\Pi_1$.
\item Let $\Pi_1$ be A-reducbile to $\Pi_2$ with the function $f$,
mapping instances of $\Pi_1$ to instances of $\Pi_2$, being computable
in quadratic time. If $\Pi_2$ is approximable to within a factor
$n^{1/3}$ (resp. $\log n$ or $(1+\epsilon)$),
then $\Pi_1$ is approximable to within a factor of
$O(n^{2/3})$ (resp. $O(\log n)$ or $O(1 + \epsilon)$) time.
Consequently, we have, if $\Pi_2$ is in $\polyapx$ (resp. $\logapx$ or
$\apx$)
then so is $\Pi_1$. Note however that if $\Pi_2$ is in $\po$ or $\ptas$,
then $\Pi_1$ need not be in $\po$ or $\ptas$.
\item Note neither definition preserves membership in $\po$.
\end{itemize}

We can now define the notion of complete problems for the classes
$\apx$, $\logapx$ and $\polyapx$.

\begin{definition}{\rm [$\apx$-completeness] }
An $\npo$ problem $\PR$ is  {\em $\apx$-hard} if every $\apx$ problem is
$AP$-reducible to  $\PR$. If, in addition, $\PR$ is in $\apx$, then $\PR$ is
{\em $\apx$-complete}.
\end{definition}

\begin{example}
$\maxcut$ is APX-complete~{\rm \cite{kmsv}}.
\end{example}

\begin{definition}{\rm [$\logapx$ and $\polyapx$-completeness]}
An $\npo$ problem $\PR$ is  {\em $\logapx$-hard } \lb {\em
$\polyapx$-hard} \rb if every
$\logapx$ \lb $\polyapx$ \rb problem is $A$-reducible to  $\PR$.
If, in addition, $\PR$ is in $\logapx$ \lb $\polyapx$ \rb, then $\PR$ is
 {\em $\logapx$-complete} \lb {\em $\polyapx$-complete} \rb .
\end {definition}

\begin{example}
$\msc$ is $\logapx$-complete and $\maxclique$ is $\polyapx$-complete.
\end{example}

\iffalse
\noindent
\paragraph{Remarks:}

\begin{enumerate}
\item
In both reductions, the quality of an approximate solution is preserved
only in absolute terms (to within the specified limits) and not as functions
of the instance size. For example,
an A-reduction from $\PR_1$ to $\PR_2$ which blows up
instance size by quadratic factor and an $O(n^{1/3})$ approximation
algorithm for $\PR_2$ combine to give only an
$O(n^{2/3})$ approximation algorithm for $\PR$.

\item
The difference in the two reductions is level of
approximability that is preserved by the two.
A-reductions preserve constant factor approximability
or higher, i.e., if $\PR_1$ is A-reducible to $\PR_2$ and $\PR_2$ is
approximable to within a factor of $r(n)$, then $\PR_1$ is
approximable to within $\alpha r(n^c)$ for some constants
$\alpha,c$.
This property suffices to preserve membership in
\apx\ (\logapx, \polyapx), i.e., if $\PR_2$ is in
\apx\ (\logapx, \polyapx)
 then $\PR_1$ is also in \apx (resp. \logapx, \polyapx).
However it does not preserve membership in \po, as can
be observed by setting $r = 1$.
\item
AP-reductions reductions are more sensitive
than A-reductions.
Thus if $\PR_1$ is AP-reducbile to $\PR_2$,
then an $r$-approximate solution is mapped to an $h(r)$
approximate solution where $h(r) \to 1$ as $r \to 1$.
Thus
AP-reductions preserve membership in $\po$ or $\ptas$ as well.
\item
Condition (3) of the AP-reduction is strictly stronger and thus
every AP-reduction is also an A-reduction. Unfortunately neither
one of these reductions suffice for our purposes. We need
AP-reductions to show \apx-hardness of problems, but we need
the added flexibility of A-reductions for other hardness results.
\item
The original definitions of AP-reducibility and
A-reducibility of \cite{CrescenziP-91} and \cite{CrescenziKST-95} were more
general.
Under the original
definitions, the A-reducibility does not preserve membership
in $\logapx$, and it is not clear whether every AP-reduction is
also an A-reduction.
The restricted versions defined here are more suitable
for our purposes.
%In particular, it is true that the Vertex Cover
%problem is \apx-complete under our definition of AP-reducibility.
\end{enumerate}
\fi



\iffalse
\section{Parallel Complexity}


\fi


%\include{prelim}



\chapter{Boolean Constraint Satisfaction Problems}
\label{Constraint Satisfaction Problems}

We introduce Boolean constraint satisfaction problems in this
chapter. We define several classes of constraint satisfaction
problems, corresponding to the different classes $\np$,
$\pspace$, $\nc$, $\#\p$, and $\npo$. The unifying concept
behind all the classes, and all problems within a class, is
the presentation of the input instances. An instance of any
problem in any one of the classes has the same canonical form:
it is always presented as $m$ constraints over $n$ Boolean variables!
The difference in the classes comes up from the difference in the
goals. For example, in the $\np$ version of the
problem, the goal is to find an assignment that satisfies all the given
constraints; while in one of the $\npo$ versions, the goal is to find
an assignment that satisfies the maximum number of constraints.

Within any given class, there are infinitely many problems.
The problems differ in the nature of constraints that are allowed.
For example, in the $\np$ version of
constraint satisfaction, two of the problems are (1) $\tsat$ and
(2) satisfiability of linear equations modulo two. The difference
between the two problems is the nature of the underlying constraints.
In order to be able to specify a computational problem in terms
of its underlying constraint structure, one needs a finite specification
of the set of constraints.
In order to achieve this objective, we
distinguish {\em constraints} from their {\em applications}.
For example,
there are
$\Omega(n^3)$ different
clauses of length $3$, when applied to $n$ Boolean variables.
However it is clear that the underlying template only needs to
include all the different constraints on upto $3$ variables; and
the rest can be achieved by specifying to which (ordered) subset of
variables is a basic constraint being applied.
Since there are only finitely many (an easy count leads to an upper
bound of $26$) different clauses on three specified
variables, it becomes clear that the constraints of $\tsat$ can be
finitely specified. (In our final specification, we will do so with
$4$ constraints.)
This distinction, between constraints and their applications is formalized
next.
Once we formalize this distinction, we present the different classes
of constraint satisfaction problems that we will study. We also present
examples of some representative problems arising in these classes.

\section{Constraints and Constraint Applications}

We start with the formal definition of a constraint. Throughout this work,
a constraint is simply a Boolean function on a finite Boolean domain, given
by some canonical description, such as a truth table.

\begin{definition} {\rm [Constraint] }
A {\em constraint} is a Boolean function $f:\{0,1\}^k \to \{0,1\}$ where $k$ is
a
non-negative
integer called the {\em arity} of $f$.
We say that
$f$ is {\em satisfied} by an assignment $s \in \{0,1\}^k$ if
$f(s)=1$. A constraint with no satisfying assignments is called {\em
unsatisfiable}.
\end{definition}


\begin{example}
Some frequently used constraint functions are as follows:
\begin{itemize}
\item Unary functions: $\F(x)=\bar x$, $\T(x)=x$.
\item Binary functions:
$\bor_0(x,y) = x\vee y$, $\bor_1(x,y) = \bar{x} \vee
y$,
$\bor_2(x,y) =
\bar{x} \vee \bar{y}$, $\xor(x,y) = (x\wedge \bar{y})\vee (\bar{x}\wedge y)$,
$\rep(x,y) = (x\wedge y)\vee (\bar x\wedge \bar y)$.
\item Ternary function: $\oneinthree(x,y,z) =
(x\vee y\vee z)\wedge (\bar{x}\vee \bar{y})\wedge (\bar{x}\vee
\bar{z})\wedge (\bar{y}\vee\bar{z})$.
%$\myxor_3(x,y,z) =
%x \oplus y \oplus z$ and $\myxnor_3(x,y,z) = \neg (x \oplus y \oplus
%z)$.
\item Other functions:
\begin{itemize}
\item The OR functions: $\bor_{k,j}(x_1,\ldots,x_k) =
\bar {x_1} \vee \cdots \vee \bar {x_j} \vee x_{j+1} \vee \cdots \vee x_k$.
Note that if $k=2$, we simply omit $k$, getting $\bor_j = \bor_{2,j}$.
\item The XOR functions:
$\myxor_p(x_1,\ldots,x_p) = x_1 \oplus \cdots \oplus x_p$ and
$\myxnor_p(x_1,\ldots,x_p) = \neg(x_1 \oplus \cdots \oplus x_p)$,
for $p \geq 3$.
\end{itemize}
\end{itemize}
\end{example}

The next definition describes how constraints may be applied
to a large number of variables.
Notice that the fact that the representation of the domain
was not very significant to the notion of a {\em constraint}.
However a careful parsing of the following definition, will reveal
that the representation of variables does become relevant to the
notion of a constraint application.

\begin{definition}
{\rm [Constraint Application] }
Given $n$ Boolean variables $x_1,\ldots,x_n$, a constraint
$f$ of arity $k$, and indices $i_1,\ldots,i_k \in
\{1,\ldots,n\}$, the pair $\langle f,(i_1,\ldots,i_k)\rangle$ is referred
to as an {\em application} of the constraint $f$ to
$x_1,\ldots,x_n$. An assignment $x_i = s_i$ for $i \in
\{1,\ldots,n\}$ and $s_i \in \{0,1\}$, {\em satisfies} the
application if $f(s_{i_1},\ldots,s_{i_k}) = 1$.
In the interest of readability, we will often denote a constraint
application $\langle f,(i_1,\ldots,i_k)\rangle$ by
$f(x_{i_{1}},\ldots,x_{i_{k}})$.
\end{definition}


\begin{definition}
{\rm [Constraint Set] }
A {\em constraint set} $\calF = \{f_1,\ldots,f_l\}$
is a finite collection of  satisfiable constraints.
\end{definition}

It is without any loss of generality that we restrict our
attention to satisfiable constraints --- presence of constraint
functions that can never be satisfied does not alter the tractability of any of
the problems studied here.

\begin{definition}
{\rm [$\calF$-Collection of Constraints]}
A collection of
constraint applications  of the form
$\{\langle f_j,(i_1(j),\ldots,i_{k_j}(j))\rangle \}_{j=1}^m$ for some
positive integer $m$, on Boolean variables $x_1,
x_2, ..., x_n$ where $f_j \in \calF$ and $k_j$ is the arity of $f_j$,
is referred to as an {\em $\calF$-collection of constraints}.
\end{definition}

\iffalse
\begin{example}
Consider the constraint set $\calF=\{\bor_0,\bor_1,\bor_2\}$.
Then $\{\bor_0(x,y), \bor_1(x,y), \bor_1(y,z), \bor_2(z,x)\}$
is an $\calF$-collection of constraints.
\end{example}
\fi

We say that an assignment satisfies an $\calF$-collection of
constraints if it satisfies every constraint in the collection.


\section{Constraint Satisfaction Problems}

We now define the classes of problems that we study.
A problem in each of these classes is characterized by a
constraint set $\calF$ which determines the nature of constraints that are
allowed in the input instance to the problem.
The input to any problem in each class is identical, namely,
an $\calF$-collection of constraints, and it is only the goal
that varies across the various classes.

\subsection{Decision and Counting Problems}

We start by defining the constraint satisfaction version of
the class $\np$.

\begin{definition}
{\rm [Satisfiability Problem $\left( \sat(\calF) \right)$]}
The {\em satisfiability problem} $\sat(\calF)$ is to decide whether there
exists an
assignment that satisfies a given $\calF$-collection of constraints.
\end{definition}

\begin{example}
The classical $2$-$\sat$ problem is the same as
$\sat(\{\bor_0,\bor_1,\bor_2\})$, while
the $\tsat$ problem is the same as
$\sat(\{\bor_{3,0},\bor_{3,1},\bor_{3,2},\bor_{3,3}\})$.
\end{example}

In a manner analagous to how we derived the definition of class $\#\p$ from the
class $\np$, we may also define the counting version of constraint
satisfaction problems.

\begin{definition}
{\rm [Satisfiability Counting Problem $\left( \#\sat(\calF) \right)$]}
The {\em satisfiability counting  problem} $\#\sat(\calF)$ is
to find the number of distinct assignments that satisfy a given
$\calF$-collection of constraints.
\end{definition}

We will also study the problem of evaluating  a quantified
collection of constraints. A {\em quantified
$\calF$-expression} is an expression of the form $\qq_1
x_1\ldots \qq_nx_n\CC$, where $\CC$ is an
$\calF$-collection of constraints over the set of variables
$\{x_1,\ldots ,x_n\}$ and $\qq_i$ is either the quantifier ``for all" or
``exists",  for
$i=1,\ldots ,n$.


\begin{definition}
{\rm [Quantified Satisfiability Problem ($\qsat({\cal F})$)]}
The {\em quantified satisfiability problem} $\qsat(\calF)$ is to decide whether
 a given quantified
$\calF$-expression is true.
\end{definition}

Quantified satisfiability problems form a natural subclass of
$\pspace$ problems; and include some $\pspace$-complete problems.
Classification of the complexity of every problem in
$\sat(\calf)$, $\#\sat(\calf)$ and $\qsat(\calf)$ will be carried out in
Chapter~\ref{Dichotomy Theorems for  Boolean Constraint Satisfaction
Problems}.

\subsection{Optimization problems}

In contrast to the decision and counting worlds, where there is
essentially a unique way to obtain constraint satisfaction versions
of the corresponding class, the case of optimization is somewhat
more general. Here we end up with four different classes!

Recall that a generic $\npo$ problem is specified by a four-tuple
$(\calI, S, m, \opt)$, where $\calI$ describes the space of
instances, $S$ describes the space of feasible solutions,
$m$ defines the value of a given solution, and $\opt$ prescribes the
goal ($\max$ or $\min$).
In all the problems we consider, the instances ($\calI$)
are still the same: $\calf$-collections
of constraints.
The four classes are defined by two attributes. The first
attribute
is simply by the $\opt$ parameter. Two classes
have this set to $\max$, while two other classes below set this to
$\min$. The other attribute distinguishing the four classes below
is their definition of feasible solutions ($S$) and the manner
in which the value of a feasible solution is determined ($m$).

The first two classes below treat all solutions as feasible. Thus
$S(x) = \{0,1\}^n$ for all instances on $n$ variables. The $\calf$-collection
of constraints work their way into the value of a solution --- the
solutions that satisfy more constraints are better.
Thus, in the first class below, the objective is to maximize the number
of satisfied constraints while in the second class below the
objective is to minimize the number of unsatisfied constraints.

\begin{definition}
{\rm [MAX Constraint Satisfaction Problem $\left( \csp(\calF) \right)$] }
The {\em MAX constraint satisfaction problem} $\csp(\calF)$ is
to find an assignment that satisfies a maximum number of constraints in
a given $\calF$-collection of constraints.
\end{definition}

\begin{example}
The problem $\maxcut$ can be expressed as $\csp(\{\xor\})$.
\end{example}


\begin{definition}
{\rm [MIN Constraint Satisfaction Problem $\left( \mincsp(\calF) \right)$] }
The {\em MIN constraint satisfaction problem} $\mincsp(\calF)$ is
to find an assignment that minimizes the number of unsatisfied constraints
in a given $\calF$-collection of constraints.
\end{definition}

\begin{example}
The problem $\minstcut$ can be expressed as $\mincsp(\{\F, \T,\bor_1\})$.
\end{example}

%\begin{example}
%The problem $\mincnf$ can be expressed as $\mincsp(\{\bor_0,\bor_1,\bor_2\})$.
%\end{example}
%\mnote{N: i removed the example of min2cnf deletion for this example has not
%been introduced in the previous chapter and it is not easy to introduce it .}
%

In the next two classes, we revert to the notion that constraints
need to be enforced. Thus an instance, i.e, an $\calf$-collection
of constraints, has as its feasible solution space, the assignments
that satisfy the collection. The objective function in these problems
is then set to a simple one, that of maximizing (or minimizing) the
sum of the variables (or equivalently the number of variables set to
$1$).
%\mnote{S: should add some motivation for these classes.}

\begin{definition}
{\rm [MAX Ones Problem $\left( \maxone(\calF) \right)$] }
The {\em MAX Ones problem} $\maxone(\calF)$ is to find an assignment
that satisfies all constraint in a given $\calF$-collection of
constraints and maximizes the number of variables that are set to true.
\end{definition}

\begin{example}
The problem $\maxclique$ can be expressed as $\maxone(\{ \bor_2 \})$.
\end{example}


\begin{definition}
{\rm [MIN Ones Problem $\left( \minone(\calF) \right)$] }
The {\em MIN Ones problem} $\minone(\calF)$ is to find an assignment
that satisfies all constraint in a given $\calF$-collection of
constraints and minimizes the number of variables that are set to true.
\end{definition}


\begin{example}
The problem $\minvertexcover$ can be expressed as $\minone(\{ \bor_0 \})$.
\end{example}

Together, these classes describe a rich variety of optimization problems
and this is further discussed in Chapter~\ref{Classification Theorems
for Optimization Problems}.

In the study of optimization problems, it is natural to consider
weighted problems. Constraint satisfaction problems generalize
naturally to include this aspect, once we introduce notions of weighted
constraints and weighted variables.



\begin{definition}
{\rm [Constraint/Variable Weighted $\calF$-Collection of Constraints]}
An $\calF$-collection of constraints with $m$ constraint applications
on $n$ variables
is called a
{\em constraint weighted $\calF$-collection of constraints} if
we are given $m$ non-negative integers $w_1,\ldots,w_m$ such that
$w_j$ denotes the weight of the $j$-th constraint application.
The $\calF$-collection of constraints is called a
{\em variable weighted $\calF$-collection of constraints} if
we are given $n$ non-negative integers $w_1,\ldots,w_n$ such that
$w_i$ denotes the weight of the $i$-th variable.
\end{definition}

Given a subset $S$ of weighted constraint applications,
we let the weight of $S$ be the sum of weight of the constraints
in $S$. We now define the weighted version of $\csp$.

\begin{definition}
{\rm [Weighted MAX Constraint Satisfaction Problem ($\wcspf$ )] }
The {\em weighted MAX constraint satisfaction problem} $\wcspf$ is
to find an assignment that maximizes the weight of the satisfied
constraints in a given constraint weighted $\calF$-collection of constraints.
\end{definition}

We can define {\em weighted MIN constraint satisfaction problem}, referred
to as $\wmincspf$, in an analogous manner.

In a variable weighted $\calf$-collection of
constraints, for an assignment to the variables,
we let the weight of the assignment be the sum of weight of the
variables set to $1$ by the assignment.

\begin{definition}
{\rm [Weighted MAX Ones Problem ($\wmaxonef$)]}
The {\em weighted MAX ones problem} $\wmaxonef$ is
to find a satisfying assignment of maximum weight for a
given variable weighted $\calF$-collection of constraints.
\end{definition}

Similarly, the {\em weighted MIN ones problem} $\wminonef$ is to
find a satisfying assignment of minimum weight for a given
variable weighted $\calF$-collection of constraints.
Chapter~\ref{Classification Theorems for Optimization Problems}
classifies the approximability
of every (weigthed and unweighted) optimization problem described above.


%\include{characterization}


\chapter{Characterizations of Constraint Functions}
\label{Characterizations of Constraint Functions}

In this chapter we study some basic properties of
Boolean functions. To motivate this study,
recall that in future chapters we
intend to classify the complexity of all problems within a class,
say, all problems of the form  $\sat(\calf)$. We have also indicated that
all problems within a class will fall into one of
finitely many equivalence subclasses. For instance, we will later
show that every $\sat(\calf)$ problem is either
in $\p$ or is $\np$-complete.
Further, for each such classification result, we will present
a finite description of rules
that can be applied to determine which equivalence class a given
family $\calf$ falls in. To prepare for such finite descriptions,
in this chapter we describe and study some basic properties
of Boolean functions. In later chapters we will then use these
properties to explain results such as
when a given family $\calf$ is such that
$\sat(\calf)$ is NP-complete, and when it is in $\p$.

In addition to describing the properties, we also
give some characterizations of functions that satisfy
(or do not satisfy) a given property. As an example, consider
constraints that can be described by linear constraints
over the finite field of two elements. When a
family of functions $\calf$ possesses this property, then we will
show that $\sat(\calf)$ is in $\p$. On the other hand, when
a family of functions does not possess this property, then
$\sat(\calf)$ may be intractable. However to show the latter result,
we need a constructive way of exploiting the fact that $\calf$
is {\em not} given by linear constraints. Lemma~\ref{affine-character}
describes a ``witness'' to the property of not being a linear functions.
In later chapters this property will be crucial in establishing
hardness results for non-linear families of functions.
We provide such characterizations for numerous
properties of functions.

%A complexity classification result for a class of problems
%is a partition of the problems based on certain properties.
%In establishing a classification result, we will typically
%use the presence of a property to show
%that a problem belongs to a certain complexity class and absence
%of a property to establish that the problem is at least as hard as any
%other problem in some underlying complexity class.
%Since problems in any given class in our framework are
%characterized by the underlying constraint sets, our classification
%results partition problems based on the properties of constraint sets.
%In this chapter, we introduce some frequently arising properties of
%constraint sets and develop useful characterizations of these properties.
%These characterizations play a central role in establishing our
%classification results.


\section{Notation}

We will frequently use the following four
Boolean operations on assignments:
\begin{itemize}
  \item $\bar s = \vec 1 - s$ is defined by $\bar s(x) = 1$ iff $s(x)
	= 0$ and $\bar s(x) = 0$ otherwise,
  \item $s = s_1 \oplus s_2$ is defined by $s(x) = 1$ iff $s_1(x)
	\neq s_2(x)$ and $s(x) = 0$ otherwise,
  \item $s = s_1 \cap s_2$ is defined by $s(x)=1$ iff $s_1(x) = s_2(x)
	= 1$ and $s(x) = 0$ otherwise,
  \item $s = s_1 \cup s_2$ is defined by $s(x)=0$ iff $s_1(x) = s_2(x)
	= 0$ and $s(x) = 1$ otherwise, and
  \item $s = {\rm MAJORITY}(s_1, s_2, s_3)= (s_1\cup s_2)\cap (s_2\cup
s_3)\cap
(s_3\cup s_1)$.
\end{itemize}

Given an assignment $s$ to an underlying set of variables, $Z(s)$ and
$O(s)$ denote the set of positions corresponding to variables set to
zero and one, respectively.
In other words, given an assignment $s = s_1s_2...s_n$ to $x_1,x_2,...,x_n$,
where $s_i \in \{0,1\}$, we have $Z(s) = \{i~\mid~s_i = 0\}$ and $O(s) =
\{i~\mid~s_i = 1\}$.
We denote by
$s[1 \rightarrow *]$ the set of $2^{|O(s)|}$ assignments which agree
with $s$ on positions in $Z(s)$ and take all possible values on the remaining
variables; we define the set $s[0 \rightarrow *]$ in an analogous manner.

\section{Representations of Constraint Functions}

A Boolean function $f$ may be expressed in a number of logically
equivalent representations. There are two particular logical
representations that we will use extensively through out this work.
These representations are defined in terms of {\em minterms} and
{\em maxterms}.


\begin{definition}
{\rm [Minterm]}
Given a function $f(x_1,x_2,...,x_k)$, a subset of
literals defined over the variables $x_i$'s is called a {\em minterm} if
setting each literal to true forces the function to be satisfied,
and if it is a minimal such collection.
\end{definition}

We express a minterm $m= \{l_1,l_2,...,l_M\}$ where each $l_j$ is $x_i$
or
$\bar{x}_i$ for some $x_i$, as $\wedge_{j=1}^{M} l_j$.
Thus if $m_1,m_2,...,m_p$ are all the minterms of a function $f$
then
$f$ may
be represented as $\bigvee_{i=1}^{p} m_i$. This is referred to as
the {\em minterm representation} of a function $f$.

\begin{definition}
{\rm [Maxterm]}
Given a function $f(x_1,x_2,...,x_k)$, a subset of
literals defined over the variables $x_i$'s is called a {\em maxterm} if
setting each of the literals false determines the function to be false, and
if it is a minimal such collection.
\end{definition}

We express a maxterm $m= \{l_1,l_2,...,l_M\}$ where each $l_j$ is $x_i$ or
$\bar{x}_i$ for some $x_i$, as $\vee_{j=1}^{M} l_j$.
Thus if $m_1,m_2,...,m_q$ are all the maxterms of a function $f$, then
$f$ may be represented as $\bigwedge_{i=1}^{q} m_i$. This is referred to
as the {\em maxterm representation} of a function $f$.

\begin{example}
The minterm representation of the function $\xor(x,y)$
is $(x\wedge\bar{y}) \vee (\bar{x}\wedge y)$ while its maxterm representation
is $(x \vee y)\wedge(\bar{x} \vee \bar{y})$.
\end{example}



Notice that the minterm (maxterm) representation is a special
case of the Disjunctive Normal Form (DNF)
(Conjunctive Normal Form (CNF)) representation of a function.
A function may have several DNF (CNF) representations; but the minterm
(maxterm) representation is unique by definition.

\section{Properties of Constraint Functions}

We now define certain properties of constraint functions that arise
frequently in our study.


\begin{definition}
A constraint $f$ is said to be
\begin{description}
  \item[$0$-valid] if $f(0, \ldots, 0) = 1$.

  \item[$1$-valid] if $f(1, \ldots, 1) = 1$.

\iffalse
  \item[strongly $0$-valid] if it is satisfied by any assignment with less
than or equal to 1 ones.
\fi

 \item[weakly positive (weakly negative)]
	if $f$ is expressible as a CNF-formula
	having at most one negated (unnegated\footnote{Such clauses are usually
called Horn clauses.})
	 variable in each clause.

\item[bijunctive] if
	$f$ is expressible as a $2$CNF-formula.

 \item[affine]
	if $f$ is expressible as
	a system of linear equations over $\gf(2)$;
	that is, it is equivalent
	to a system of linear equations of the forms $v_1 \oplus
	\cdots \oplus v_n = 0$ and $v_1 \oplus \cdots \oplus v_n = 1$,
	where~$\oplus$ denotes the exclusive or connective.

 \item[affine with width $2$]
	if $f$ is expressible  as
	a system of linear equations over GF($2$) with at most two variables
per equation.




 \item[$2$-monotone]  if
	$f$ is expressible as a DNF-formula
	either of the form $(x_1 \wedge\ldots \wedge x_p)$ or $(\bar
y_1\wedge\ldots\wedge \bar y_q)$ or $(x_1\wedge\ldots \wedge x_p)\vee(\bar
y_1\wedge\ldots\wedge \bar y_q)$.

\item[\setcoverB$+$] (for {\em Implicative Hitting
Set-Bounded$+$})
if it is expressible as a CNF formula where the clauses are of one
of the following types: $\bar x_1$, or $\bar x_1 \vee x_2$, or
$x_1 \vee \cdots \vee x_k$ for some positive integer $k$.

\item[\setcoverB$-$]
if it is expressible as a CNF formula where the clauses are of one
of the following types: $x_1$, or $\bar x_1 \vee x_2$, or
$\bar x_1 \vee \cdots \vee \bar x_k$ for some positive integer $k$.

\item[$C$-closed] if
for all assignments $s$, $f(s) = f(\bar{s})$.
 \end{description}
\end{definition}

The above definitions also generalize to sets (families) of constraints.
For instance, a constraint family $\calf$ is called an {\em affine family}
if every constraint in $\calf$ is affine. Additionally, we refer to
a constraint set $\calf$ as a {\em Horn family} if
$\calf$ is either weakly positive or weakly negative,
and as a {\em $\setcoverB$ family} if the family is
either a $\setcoverB+$ family or a $\setcoverB-$ family.

We stress that the properties listed above do not partition the
Boolean functions.
(In fact, the function
$\oneinthree$ (which is satisfied when exactly one of its three
arguments is $1$) does not possess any of the properties
listed above;
while the function $\rep$ possesses all the properties listed above!)
However these properties play a central role in determining
when a given computational task is easy, versus when it is hard.
For example, Schaefer's theorem (to be proved later) will show that
a $\sat(\calf)$ problem is in $\p$ if and only if $\calf$ is
0-valid or 1-valid or biijunctive or affine or  a Horn family.
Classification results for other classes described earlier will
assume a similar flavour.

\section{Characterization Lemmas}\label{characterization lemmas}

In this section we develop some characterizations of the properties
described above. The natural definitions of the properties, as
given earlier, make it easy to establish that a function has
a given property. The characterizations that we now develop help us
identify witnesses to the fact that a function does not satisfy a
given property. We start by proving some simple closure properties.

\begin{lemma}
\label{lem:char-horn}
Let $f$ be a weakly positive
(weakly negative/ bijunctive/ \setcoverB$+$/ \setcoverB$-$) constraint.
Then any constraint $f'$ derived from $f$ by setting
some subset of its variables to constants (0/1) and existentially
quantifying over some subset of remaining variables is also weakly positive
(weakly negative / bijunctive / \setcoverB$+$ / \setcoverB$-$).
\end{lemma}

\begin{proof}
It is easy to see that a function $f$ remains weakly positive
(weakly negative / affine/ affine with width 2/ bijunctive/ \setcoverB$+$ /
\setcoverB$-$) when any subset of variables is restricted to a constant.
Thus we only need to consider the case when a subset of variables
is existentially quantified. Using a straightforward inductive
argument, it suffices to consider quantification over a single variable,
say, $y$.
In what follows, we assume that we are given the function
as a CNF expression

$$f(x_1, \ldots , x_k, y) =
\left(\AND_{j_0 \in X_0}  (C^0_{j_0} (\vecx) \vee y)\right)
\AND \left(\AND_{j_1 \in X_1}  (C^1_{j_1} (\vecx) \vee \bar y)\right)
\AND \left(\AND_{j \in X}  C_{j} (\vecx) \right)
$$

\noindent
where $X_0$, $X_1$, and $X_2$ are the indices of the clauses in which
$y$ appears as a positive literal, negative literal, and does not appear,
respectively.
Moreover, the clauses $C^0_{j_0}$, $C^1_{j_1}$ and $C_j$ involve
only literals on the variables $x_1,\ldots, x_k$.
We assume that each clause in the above representation
satisfies the property of its underlying function.
Now consider the function
$$f'(x_1, \ldots , x_k) \defas \exists y ~f(x_1, \ldots , x_k, y).$$

We first show a simple transformation which creates a
CNF expression for $f'$.

Define $|X_0| \!\times\! |X_1|$ clauses $C^{'}_{j_0 j_1}(\vecx)
\defas C^0_{j_0}(\vecx) \OR C^1_{j_1}(\vecx)$ with $j_0 \in X_0$ and $j_1 \in
X_1$. We now show that for every $\vecx$,
\begin{equation}
f'(\vecx) =
\left(\AND_{j_0 \in X_0}
\AND_{j_1 \in X_1}
C^{'}_{j_0j_1} (\vecx) \right)
\AND
\left(\AND_{j \in X}   C_{j} (\vecx) \right).
\label{eqn:two?}
\end{equation}

Suppose $f'(\vecx) = 1$. In this case there must exist a $y$ such that
$f(\vecx ,y) = 1$, and hence an $\vecx$ such that all the clauses
$C_{j}(\vecx)$ as well as all the clauses $C^y_{j_y}(\vecx)$ are satisfied.
Thus the right hand side expression above is satisfied.
Conversely, if the right hand side expression above is satisfied then
we claim that $\vecx$ must satisfy either all the clauses $C^{0}$ or
all the clauses $C^{1}$. Assume, by way of contradiction, that
the clauses $C^{0}_{j_0}$ and
$C^1_{j_1}$ are not satisfied. Then the clause
$C^{'}_{j_0 j_1}$ is not satisfied either. A contradiction.
Thus by setting $y = i$ such that all clauses
$C^i$ are satisfied, we find that $f(\vecx , y)$ is satisfied. This in turn
implies that $f'(\vecx) = 1$.


To conclude the proof, we need to verify that $f'$, as defined by
the right hand side of (\ref{eqn:two?}),
satisfies the same properties as $f$. We only need
to consider clauses of the form $C^{'}_{j_0j_1} (\vecx)$
since all other clauses are directly from the expression for $f$.
We verify below for the various properties.

\noindent
\paragraph{weakly positive / weakly negative:}
If $f$ is weakly positive, then the clause
$C^0_{j_0}$ involves at most one negated variable, and the clause
$C^1_{j_1}$ involves no negated variable.
Thus the clause defining
$C^{01}_{j_0j_1}$ also has at most one negated variable.
A similar analysis applies if $f$ is weakly negative.


\noindent
\paragraph{bijunctive:}
If $f$ is $\wcnf$, then the clauses $C^0_{j_0}$ and $C^1_{j_1}$
are of length $1$ and hence the clause $C^{'}_{j_0j_1}$ is of length
at most $2$.

\noindent
\paragraph{\ihsbp\ / \ihsbn:}
If $f$ is \ihsbp\ then the clause $C^{0}_{j_0}$ has
either has only one literal which is negated or has only positive
literals.
Furthermore, $C^{1}_{j_1}$ has at most one positive literal. Thus
$C^{'}_{j_0j_1}$ either has only positive literals or has at most
two literals one of which is negated.  Hence $C^{'}_{j_0j_1}$ is also
\ihsbp.
Similarly if $f$ in \ihsbn\ then the clause $C^{'}_{j_0j_1}$ is
also \ihsbn.
\end{proof}

\begin{lemma}
\label{lem:char-affine}
Let $f$ be an affine (affine width $2$) constraint.
Then any constraint $f'$ derived from $f$ by setting
some subset of its variables to constants (0/1) and existentially
quantifying over a subset of the remaining variables,
is also affine (affine width $2$).
\end{lemma}
\begin{proof}
The proof of this lemma is similar to Lemma~\ref{lem:char-horn},
except that we represent the function as a
conjunction of basic affine functions rather than as a conjunction of
clauses. We omit the details as a simple exercise to the reader.
\iffalse
Thus, let
$$f(x_1 \ldots x_k y) = (\AND_{j=1}^{m_1} \ell^{(1)}_j(x_1 \ldots x_k))
\AND (\AND_{j=1}^{m_2} \ell^{(2)}_j(x_1 \ldots x_k y)),$$
where $\ell^{(i)}_j$ are linear constraints with
$\ell^{(2)}_j$ depending on $y$. Let $\ell^{(2)}_j(x_1 \ldots x_k y)$
be the constraint $y \oplus \xor_{i \in S_j} x_i = b_j$, where
$S_j \subseteq [k]$ and $b_j \in \{0,1\}$. Define
$\ell^{(22)}_{j_1,j_2}(x_1 \ldots x_k) = \xor_{i \in S_{j_1} \Delta
S_{j_2}} x_i = b_{j_1} \oplus b_{j_2}$.
Then we can define
$$f'(x_1\ldots x_k) =
(\AND_{j} \ell^{(1)}_j(x_1 \ldots x_k))
\AND (\AND_{j_1 < j_2} (\ell^{(22)}_{j_1,j_2},$$
which shows that $f'$ is also affine.

Finally the case where $f$ is affine of width 2 can be shown as above
and observing that the constraints $\ell^{(22)}_{j_1,j_2}$ have width
two, if the constraints $\ell^{(2)})_j$ have width 2.
\fi
\end{proof}

\medskip

The closure property described in Lemma~\ref{lem:char-horn}
allows us to prove the following
central fact about the maxterms of weakly positive (weakly
negative / bijunctive / \ihsbp / \ihsbn) functions.

\begin{lemma}
\label{lem:char-horn2}
A constraint $f$ is weakly positive (weakly negative / bijunctive / \ihsbp /
\ihsbn)
constraint if and only if
all its maxterms are weakly positive
(weakly negative / bijunctive / \ihsbp / \ihsbn).
\end{lemma}

\begin{proof}
The proof technique is once again common to all the properties.
We focus on the weakly positive case and towards the end, sketch the
modifications needed for other properties.

Using the maxterm representation of $f$, it is clear that
if all maxterms are weakly positive, then $f$ is weakly positive
We now consider the converse. Suppose $f$ has a (non weakly positive)
maxterm of the form:

$$\bar x_1 \vee \bar x_2 \cdots \vee \bar x_p \vee x_{p+1} \vee \cdots \vee
x_{p+q},$$
\noindent
where $p \geq 2$ and $q \geq 0$.
Consider the function
$$f'(x_1, x_2) = \exists x_{p+q+1},\ldots,x_k
f(x_1, x_2, 1^{p-2} 0^q, x_{p+q+1}, \ldots , x_k).$$
By definition of a maxterm, any assignment setting $x_1 = \cdots = x_p = 1$
and $x_{p+1} = \cdots x_q = 0$ leaves $f$ unsatisfied.
Thus $f'(11) = 0$.
Further, the minimality of this maxterm implies that there exist
assignments of the form $s_1 = 01^{p-1}0^q a_{p+q+1} \ldots a_k$
and $s_2 = 101^{p-2}0^q b_{p+q+1} \ldots b_k$ such that
$f(s_1) = f(s_2) = 1$. Hence we get $f'(01) = f'(10) = 1$. Now depending
on the value of $f'(00)$, we find that $f'(x_1 x_2)$ is either the
function $x_1 \oplus x_2$ or $\bar x_1 \vee \bar x_2$, neither of
which is weakly positive. By Lemma~\ref{lem:char-horn}, this
implies $f$ is not weakly positive.

An identical analysis applies for the case of weakly negative constraints.
For the case of bijunctive constraints, a similar analysis
gives a ternary function $f'$ which is not bijunctive if some maxterm
of $f$ were not bijunctive. Finally, if some maxterm of $f$ were
weakly positive (weakly negative) but not \ihsbp\ (\ihsbn), we get
a ternary function $f'$ that is not monotone positive (negative).
In each case, we can apply Lemma~\ref{lem:char-horn} to get the desired result.
\end{proof}
\medskip

We are now ready to develop characterizations that are specific to the
properties described in the previous section. We start with the
Horn families.

\begin{lemma}
{\rm ~\cite{Horn-51}}
\label{weak-character}
A function $f$ is a weakly positive \lb weakly negative \rb function if and
only if  for all assignments $s_1, s_2$  that satisfy $f$ the assignment
$s_1 \cup s_2$ \lb $s_1 \cap s_2$ \rb is also satisfying.

\end{lemma}

\begin{proof}
In one direction it suffices to verify that if $s_1$ and $s_2$
satisfy a weakly positive function of the form
$\bar x_1 \vee x_2 \vee \cdots x_k$ (i.e., a single clause)
then so does $s_1 \cup s_2$ and this is easily verified.
By arguing so for every maxterm of a function $f$
we get one direction, namely,
if $f$ is weakly positive then for any two satisfying assignments
$s_1,s_2$, $s_1 \cup s_2$ also satisfies $f$.

For the other direction, let $f$ be a function that is not weakly
positive. By Lemma~\ref{lem:char-horn2} we know that
$f$ has a non-weakly
postive maxterm. Say the maxterm is
$\bar x_1 \vee \bar x_2 \cdots \vee \bar x_p \vee x_{p+1} \vee \cdots \vee
x_{p+q}$, where $p \geq 2$ and $q \geq 0$.
Maximality implies there exist
assignments of the form $s_1 = 01^{p-1}0^q a_{p+q+1} \ldots a_k$
and $s_2 = 101^{p-2}0^q b_{p+q+1} \ldots b_k$ such that
 $f(s_1) = f(s_2) = 1$. But $s_1 \cup s_2$ is of the
form $0^p1^qc_{p+q+1} \ldots c_k$ and can not satisfy $f$. A contradiction.
\end{proof}

\begin{lemma}
{\rm [bijunctive characterization]~\cite{Schaefer-78}}
\label{bijunctive-character}
A function $f$ is a bijunctive  function if and only if
 for all assignments $s_1, s_2, s_3$ that satisfy $f$, the assignment
	${\rm MAJORITY}(s_1, s_2, s_3)$ is also satisfying.
\end{lemma}

\begin{proof}
The proof of this lemma is very similar to the proof of
Lemma \ref{weak-character} above and hence omitted.
\end{proof}

\begin{lemma}
{\rm [affine characterization]~\cite{Schaefer-78, CreignouHr-96}}
\label{affine-character}
A function $f$ is affine if and only if for all satisfying
assignments $s_1, s_2, s_3$, the assignment $s_1 \oplus s_2 \oplus s_3$ is also
satisfying.
Alternatively, the function $f$ is affine if and only if for any fixed
satisfying assignment $s_0$, the assignment $s_1 \oplus s_2 \oplus s_0$,
where $s_1,s_2$ are any two satisfying assignments, is also satisfying.
\end{lemma}

\begin{proof}
The first characterization above follows from a classical and well
known characterization of affine subspaces in linear algebra.
For completeness, we go through the basic steps here.
To see the forward direction, note that it suffices to verify
the assertion for the basic affine functions $\myxor_p$ and
$\myxnor_p$, since other affine functions are just conjunctions
of such functions. It is straightforward to verify that
if $s_1,s_2$ and $s_3$ are $p$-ary strings with odd number of $1$'s
(and thus satisfying $\myxor_p$) then $s_1 \oplus s_2 \oplus s_3$
also has an odd number of ones. Similarly for $\myxnor_p$.


To see the converse of the first characterization, we assume $f$
is a $k$-ary predicate that satisfies the condition that if
$s_1$, $s_2$ and $s_3$ satisfy $f$, then so does $s_1 \oplus s_2
\oplus s_3$. We will show that this implies $f$ is affine.
Let $\vecx = \langle x_1,\ldots,x_k \rangle$ and
$\vecx' = \langle x_2,\ldots,x_k \rangle$.
Let $f_0(\vecx') = f(0,\vecx')$ and $f_1(\vecx') = f(1,\vecx')$.
The function $f_0$
(resp. $f_1$) satisfies the property that if $s'_1$, $s'_2$ and $s'_3$
satisfy $f_0$, then so does $s'_1 \oplus s'_2 \oplus s'_3$.
Thus, by induction on $k$, we have that
both $f_0$ and $f_1$ are affine.
Now if $f_0$ (resp. $f_1$) doesn't have any satisfying assignments,
then $f(\vecx) = (x_1 = 1) \wedge f_1(\vecx')$ and thus $f$ is
affine. So assume both $f_0$ and $f_1$ have satisfying assignments,
say $s'_1$ and $s'_2$ respectively. Let $s_1 = 0 s'_1$ and $s_2 =
1 s'_2$. Taking any string $s_3 = 1 s'$
Using the fact that $s_1 \oplus s_2 \oplus s_3$ satisfies
$f$ if and only if $s_3$ does, we  get
$f_1(s') = f_0(s'_1 \oplus s'_2 \oplus s')$.
Let $A'$ be a matrix and $\vec b'$ be a vector
such that $f_0(\vecx') = 1$ if and only if $A'\vecx' = b'$.
(Such a pair exists since $f_0$ is affine.)
Then, using the fact that $f_1(s') = f_0(s'_1 \oplus s'_2 \oplus
s')$, we get $f_1(\vecx') = 1$ if and only if $A' (\vecx' \oplus s'_1
\oplus s'_2) = \vec b'$. Let
$A = [ A'(s'_1 \oplus s'_2) | A' ]$,
i.e., $A$ is the matrix $A'$ with one additional column
$A'(s'_1 \oplus s'_2)$ added in from the left.
Then, we have $A \vec x = \vec b'$ if and only if
$f(\vecx) = 1$ and thus $f$ is affine too.
This completes the proof of the first characterization.

To see the second characterization above, let us fix a satisfying assignment
$s_0$ for $f$. If $f$ is affine, then using the first characterization
above, we know that for all assignments $s_1, s_2$ that satisfy $f$,
$s_1 \oplus s_2 \oplus s_0$ also satisfies $f$. Conversely, suppose that
for all assignments
$s_1, s_2$ that satisfy $f$, the assignment $s_1 \oplus s_2 \oplus s_0$
is also satisfying. Let $s_3$ be any assignment that satisfies $f$. By
assumption $(s_1 \oplus s_2 \oplus s_0)\oplus s_3\oplus s_0$ satisfies
$f$. But, $(s_1 \oplus s_2 \oplus s_0)\oplus s_3\oplus s_0 =
(s_1 \oplus s_2 \oplus s_3)\oplus (s_0\oplus s_0) =  s_1 \oplus
s_2 \oplus s_3$, thus completing the proof.
\end{proof}

\iffalse

\begin{definition}
{\rm [Minimally  Dependent Set ]}
For a constraint $f(x_1, \ldots, x_k)$, a set
$S \subseteq \{x_1, \ldots, x_k\}$ is referred to as a
{\em minimally dependent set} for $f$ if there exists a
partial assignment to the variables in $S$ such that no completion
of this assignment satisfies $f$, and $S$ is minimal with respect
to this property.
\end{definition}

\fi

\begin{lemma}
{\rm [Affine width two characterization]}
\label{char w2a}
A function $f$ is affine with width two if and only if it is
affine and bijunctive
\end{lemma}

\begin{proof}
It is clear that if $f$ is affine with width two, then it is
affine and bijunctive. In particular, the constraint
$x_i \oplus x_j$ can be expressed as the conjunction of
$x_i \vee x_j$ and $\bar x_i \vee \bar x_j$; and the constraint
$\bar x_i \oplus x_j$ can be expressed as the conjunction of
$\bar x_i \vee x_j$ and $x_i \vee \bar x_j$.

To see the converse, let $f$ be an affine and bijunctive function.
Since $f$ is bijunctive, all maxterms of $f$ have at most two
literals in them. The maxterms of size $1$ are already affine
constraints with width one; so
we consider a maxterm of size $2$. Suppose
$x_1 \vee x_2$ is a maxterm. Then we claim $\bar x_1 \vee \bar x_2$
is also a maxterm. If not, then the function $$g(x_1,x_2)
\defas \exists x_3,\ldots,x_k ~f(x_1,\ldots,x_k)$$ equals the
function
$x_1 \vee x_2$ which is not affine and this contradicts
Lemma~\ref{lem:char-affine}.
But then we can replace the maxterms $x_1 \vee x_2$ and $\bar x_1 \vee \bar
x_2$ by the constraint $x_1 \oplus x_2$ which is affine with
width two.
Proceeding like this for every maxterm, we obtain an affine
representation of $f$ with width two.
\end{proof}


\begin{definition}
{\rm [$0/1$-Consistent Set]}
A set $V \subseteq \{1,\ldots,k\}$ is {\em $0$-consistent ($1$-consistent)}
for a constraint $f:\{0,1\}^k \to \{0,1\}$
if and only if every assignment $s$ with $Z(s) \supset V$ ($O(s) \supset V $)
is a satisfying assignment for $f$.
\end{definition}


\begin{lemma}
{\rm [2-monotone-characterization]~\cite{KhannaS-96}}
\label{2-monotone-character}
A function $f$ is a $2$-monotone function if and only if
all the following conditions are satisfied:

(a) for every satisfying assignment $s$ of $f$, either
$Z(s)$ is 0-consistent or $O(s)$ is 1-consistent.

%$s[1 \rightarrow *]$ or $s[0 \rightarrow *]$ is a set of satisfying
%assignments,

(b) if $V_1$ is 1-consistent and $V_2$ is 1-consistent for $f$,
then $V_1 \cap V_2$ is 1-consistent, and

(c) if $V_1$ is 0-consistent and $V_2$ is 0-consistent for $f$, then
$V_1 \cap V_2$ is 0-consistent.
\end{lemma}
\noindent
\begin{proof}
Suppose $f$ is a $2$-monotone function expressed as a sum of
at most two terms satisfying the definition.
Every satisfying assignment must
satisfy one of the terms and this gives us property (a). Properties (b)
and (c) are obtained from the fact that the function has at most one
positive and one negative term.

Conversely, suppose the function $f$ is not $2$-monotone.
We assume that we are given a minterm representation of $f$.
Since $f$ is not $2$-monotone, it either has a
minterm which is not monotone positive or monotone negative or it has
more than one positive (or negative) minterm. In the former case, the
function violates property (a), and in the latter case, it violates
either property (b) or property (c).
\end{proof}

The characterizations above conclude our first cut at
understanding Boolean functions. In the next chapter we
will set a more firm target on our exploration of Boolean functions.
We will define a specific notion of how Boolean functions
may ``implement'' other Boolean functions.
The characterizations will turn out to be quite useful in establishing
a wide variety of implementations.

%\include{implementation}



\chapter{Implementation of Functions and Reductions}
\label{Implementation of Functions}

A complexity classification result for a class of problems is
a statement describing a partial order among the problems
in the class. As mentioned earlier, the central mechanism used
in creating such a partial order is reduction, the process of
transforming a given problem into another one. Since problems in our
framework are specified via underlying constraint sets, the notion of a
reduction between problems essentially corresponds to transformation between
constraint sets. Toward this end, we now introduce a natural notion,
called {\em implementation}, which is a mechanism for showing that the
behaviour of a given constraint can be ``implemented'' by some
collection of functions.
Just as the precise notion of reduction needed depends on the underlying
class of problems, the specific notion of implementation needed varies with
the underlying class of problems.
In the remainder of this chapter, we formally introduce the notion of
implementation and study its inherent connection to reductions.
We then develop several results concerning the implementation power
of various types of constraint families. A typical result here shows
that all constraint families that lack a given property can implement
some canonical function lacking the property. These results allow us
to unify large classes of constraint families through a small
number of canonical functions; a process that is
central to our classification results.

\section{Implementations}

The following definition was explicitly formalized in~\cite{KhannaS-96} and
its variants have been implicitly used by other researchers
(see~\cite{CreignouHr-96}, for instance).

\begin{definition}
{\rm [$\alpha$-Implementation]}
\label{def:imp}
An $\calF$-collection of contraint applications  over a set of variables
$\vec{x} =
\{x_1,x_2,...,x_p\}$ and $\vec{y} = \{y_1,y_2,...,y_q\}$ is called an
{\rm $\alpha$-implementation} of a Boolean function $f(\vec{x})$, where
$\alpha$ is a positive integer, iff the following conditions are
satisfied:

\begin{description}
\item[(a)]
no assignment of values to $\vec{x}$ and $\vec{y}$ can satisfy more than
$\alpha$ constraints,

\item[(b)]
for any assignment of values to $\vec{x}$ such that $f(\vec{x})$ is
true,
there exists an assignment of values to $\vec{y}$ such that precisely
$\alpha$
constraints are satisfied,

\item[(c)]
for any assignment of values to $\vec{x}$ such that $f(\vec{x})$ is
false,
no assignment of values to $\vec{y}$ can satisfy more than $(\alpha -
1)$ constraints.

\iffalse
\item[(d)]
for any assignment to $\vec{X}$ which does not satisfy $f$, there
always exists an assignment to $\vec{Y}$ such that precisely
$(\alpha - 1)$ constraints are satisfied.
\fi

\end{description}
We refer to the set $\vec{x}$ as the {\em function variables} and the
set $\vec{y}$ as the {\em auxiliary variables}.
\end{definition}

We will say that $\cal F$ {\em implements} a function $f$
if there is an $\calF$-collection of contraint applications that
  $\alpha_f$-implements $f$ for some constant $\alpha_f$.
Moreover, an implementation of a function $f$ is called {\em strict} if for any
assignment to $\vec{x}$ which does not satisfy $f$, there
always exists an assignment to $\vec y$ such that precisely
$(\alpha - 1)$ constraints are satisfied;
an implementation is {\em perfect } if
all constraints in the implementation are
satisfiable whenever $f(\vec{x})$ evaluates to true and it is {\em
faithful} if there is always a unique way
 of doing so.
Thus a function $f$ 1-implements itself strictly, perfectly and faithfully.

\begin{example}
\label{ex1}
The family $\{\bor_0, \F \}$ strictly $3$-implements the function
$\xor(x_1,x_2)$.
Consider the constraint applications $\{ (x_1 \vee x_2), (x_1 \vee x_2),
\bar{x_1},
\bar{x_2} \}$. Then any assignment to $x_1,x_2$ that satisfies
$\xor(x_1,x_2)$, satisfies exactly $3$ constraints in above collection
and otherwise, exactly $2$ constraints are satisfied. Thus this is
a strict implementation. Notice that there are no auxiliary variables
in this implementation.
\end{example}

\begin{example}
\label{ex2}
The family $\{\xor\}$ strictly
$2$-implements the
function $\xnor(x_1,x_2)$ through the constraint applications
$\{ \xor(x_1,y) , \xor(x_2,y) \}$. Moreover, this implementation
is perfect and  faithful. The variable $y$ is an auxiliary
variable.
\end{example}



\begin{example}
\label{ex3}
The family $\{\bor_0, \F \}$ strictly $6$-implements the function
$\xnor(x_1,x_2)$ through the constraint applications
$\{ (x_1 \vee y), (x_1 \vee y), \bar{x_1},
\bar{y},  (x_2 \vee y), (x_2 \vee y), \bar{x_2},
\bar{y} \}$
\end{example}

Later we will show how Example~\ref{ex3} follows from
Examples~\ref{ex1}~and~\ref{ex2} by a general composition
method. The following is an example of a perfect,
but non-faithful, implementation.

\begin{example}
\label{ex4}
The family $\{\oneinthree, \myxor \}$ strictly and perfectly
implements the function $\bor_{3,0}(x,y,z)$
through the constraint applications
$$\left\{
\begin{array}{ccc}
(x \oplus x'), &
(y \oplus y'), &
(z \oplus z'), \\
\oneinthree(x',u_1,v_1), &
\oneinthree(y',u_2,v_2), &
\oneinthree(z',u_3,v_3), \\
& \oneinthree(u_1,u_2,u_3) &
\end{array}
\right\}.$$
(Roughly, the first three constraints force $x'$, $y'$ and $z'$
to be the negations of $x$, $y$ and $z$. Thus if $x = y = z = 0$,
then $x' = y' = z' = 1$ and thus all the $u_i$'s and $v_i$'s are
forced to $0$ by the first three $\oneinthree$ constraints, but
this does not allow the final constraint to be satisfied.
It may be verified that if at least one of $x$, $y$ or $z$ is
true, then there is a way to satisfy all constraints; further,
in some cases there is more than one way to do so and hence the
implementation is not faithful.)
\end{example}

In the next example we show that the function $\oneinthree$
perfectly implements the function $\myxor$. Intuitively, this
should indicate that in the above implementation, the use of
$\myxor$ could have replaced with the use of $\oneinthree$.
We will see later that this is indeed the case.

\begin{example}
\label{ex5}
The family $\{\oneinthree\}$ strictly, perfectly and faithfully
implements the constraint $\myxor(x,y)$ through the
constraint applications
$$\{
\oneinthree(z_{\T},z_{\F},z_{\F}),
\oneinthree(x,y,z_{\F})\}.$$
\end{example}

\noindent {\bf Remark:} The implementation above gives a nice
example of how one may use ``replication'' of variables in
constraint applications --- notice the repeated occurrence of
the variable $z_{\F}$ in the first application above.
We will allow such replication throughout this monograph. However,
this allowance is not necessary for most of the proofs. The proofs in,
say \cite{KhannaSW-96,KhannaST-97} do not use the ability to
replicate variables. This gives them a more refined look at some
optimization problems; however, their proofs get significantly more
cumbersome. We opt for more elegant proofs here.

Getting back to implementations, often
we will be interested in families implementing other families.
Specifically, we will focus a lot of attention in showing
that some family $\calf_1$ implements every function in some
other family $\calf_2$.

\begin{example}
\label{ex6}
The family $\{\bor_{3,0}, \myxor\}$ strictly, perfectly and
faithfully implements every function in the family
$\{\bor_{3,0},\bor_{3,1},\bor_{3,2},\bor_{3,3}\}$.
(For instance, the constraint $\bor_{3,2}(x,y,z)$ is
implemented by the constraints $\{(x' \vee y' \vee z),
(x' \oplus x), (y' \oplus y)\}$.)
\end{example}

The following lemma shows that the   above described
$\alpha$-implementations of
functions compose together.
% property (d) is somewhat more strict, but turns out
%to
%be critical in composing implementations together.
\iffalse
\begin{lemma}
{\rm [Composition Lemma]\cite{KhannaS-96}}
If $\calF_f$ can implement
a function $f$, and $\calF_g$ can
implement a function $g \in {\cal F}_f$, then
$((\calF_f \setminus \{ g \} )\cup {\cal F}_g )$
can implement
the function $f$.
Moreover, the composition preserves the properties of strictness, perfectness
 and faithful implementations.
\end{lemma}

\begin{proof}
Let $\beta$ be the number of occurrences of a constraint involving
the function $g$ in the $\calF_f$-collection of constraint applications
$\alpha_1$-implementing
$f$, then clearly, by replacing each occurrence of $g$ by its
$\alpha_2$-implementation by $\calF_g$ , we obtain a $((\calF_f \setminus \{
g
\} )\cup {\cal F}_g )$-collection of constraint applications which
$\alpha$-implements $f$ for
$\alpha
= \alpha_1 + \beta(\alpha_2-1)$.

Finally, it is easy to verify that the strictness,
perfectness  and faithful
nature of an implementation is preserved under this operation.
\end{proof}
\fi



\begin{lemma}
{\rm [Composition Lemma]\cite{KhannaS-96}}
\label{lem:compose}
If $\calF_f$ can strictly (perfectly, faithfully) implement
a function $f$, and $\calF_g$ can
strictly (perfectly, faithfully)  implement a function $g \in {\cal F}_f$, then
$((\calF_f \setminus \{ g \} )\cup {\cal F}_g )$
can strictly (perfectly, faithfully)  implement
the function $f$.
\end{lemma}


\begin{proof}
Let $C_1,\ldots,C_{p}$ be constraint applications from $\calF_f$ on
variable set $\vec{x}, \vec{y}$ giving an
$\alpha_f$-imple\-mentation of $f$ with $\vec{x}$ and $\vec{y}$
being the function and the auxiliary variables, respectively.
Let $C'_1,\ldots,C'_{q}$ be constraint applications
from $\calF_g$ on variable set $\vec{x'},\vec{z}$
yielding an $\alpha_g$-implementation of $g$. Further let the
first $\beta$ constraints of $C_1,\ldots,C_{p}$
be applications of the constraint $g$.

We create a collection of $p + \beta(q-1)$ constraints from
$({\cal F}_f \setminus \{ g \} )\cup {\cal F}_g$ on a set of variables
$\vec{x}, \vec{y}, \vec{z}_1,\ldots,\vec{z}_{\beta}$ as follows.
We include the constraint applications $C_{\beta+1},\ldots,C_{p}$ on
variables $\vec{x},\vec{y}$ and for every constraint application
$C_j$, for $j \in \{1,\ldots,\beta\}$,
on variables $\vec{v}_j$ (a subset of variables from $\vec{x},\vec{y}$),
we place the constraints $C'_{1,j},\ldots,C'_{q,j}$
on variable set $\vec{v}_j, \vec{z}_j$ with $\vec{z}_j$
being the auxiliary variables.

We now show that this collection of constraints is an $\alpha$-implementation
of $f$ where $\alpha = \alpha_f + \beta(\alpha_g - 1)$.
We start with properties (a) and (c).

Consider any assignment to $\vec{x}$ satisfying $f$.
Then any assignment to $\vec{y}$ satisfies at most
$\alpha_f$ constraints from the set $C_1,\ldots,C_{p}$.
Let $\gamma$ of these be from the set $C_1,\ldots,C_{\beta}$.
Now for every $j \in \{1,\ldots,\beta\}$ any assignment to
$\vec{z}_j$ satisfies at most $\alpha_g$ of the constraints
$C'_{1,j},\ldots,C'_{q,j}$.
Furthermore if the constraint $C_j$ is not satisfied by the
assignment to $\vec{x},\vec{y}$, then
at most $\alpha_g-1$ constraints are satisfied.
Thus the total number of constraints
satisfied by any assignment is at most $\gamma (\alpha_g) +
(\beta-\gamma)(\alpha_g-1)
+ (\alpha_f - \gamma) = \alpha_f + \beta(\alpha_g - 1)$. This yields
property (a) in Definition~\ref{def:imp}. Property (c) can be shown to
hold in a similar manner.

We now show that if the implementations of $f$ and $g$ are
strict (perfect, faithful), we also get property (b) and that the property
of being strict (perfect, faithful) is preserved.

Let us first consider the case when both implementations are
perfect (faithful). In this case for any
assignment to $\vec{x}$ satisfying $f$, there exists an (a unique)
assignment to $\vec{y}$ satisfying $C_1,\ldots,C_{p}$.
Furthermore for every $j \in \{1,\ldots,\beta\}$,
there exists an (a unique) assignment to $\vec{z}_{j}$ satisfying
all the constraints $C'_{1,j},\ldots,C'_{q,j}$.
Thus there exists an (a unique) assignment to
$\vec{x},\vec{y}, \vec{z'}_1,\ldots,\vec{z'}_{\beta}$
satisfying all $p + \beta(q-1)$
constraints. This yields
property (b) with perfectness (faithfulness).

We next consider the case when both implementations are strict.
Given an assignment to $\vec{x}$ satisfying $f$ there
exists an assignment to $\vec{y}$ satisfying $\alpha_f$
constraints from $C_1,\ldots, C_{p}$.
Say this assigment satisfies $\gamma$
constraints from the set $C_1,\ldots,C_{\beta}$ and $\alpha_f - \gamma$
constraints
from the set $C_{\beta+1},\ldots,C_{p}$. Then for every $j \in
\{1,\ldots,\beta\}$
such that the clause $C_j$ is satisfied by this assignment to
$\vec{x},\vec{y}$,
there exists an assignment to $\vec{z}_j$
satisfying $\alpha_g$ clauses from the set
$C'_{1,j},\ldots,C'_{q,j}$.
Furthermore, for the remaining values of
$j \in \{1,\ldots,\beta\}$,there exists an assignment to
the variables $\vec{z}_j$ which satisfies  $\alpha_g - 1$ of the
constraints
$C'_{1,j},\ldots,C'_{q,j}$ (for the $\alpha_g$-implementation is
strict).
This setting of $\vec{y},\vec{z}_1,\ldots,\vec{z}_{\beta}$
satisfies $\gamma \alpha_g + (\beta - \gamma) (\alpha_g - 1) + \alpha_f -
\gamma
= \alpha_f + \beta(\alpha_g-1)$ of the $m$ constraints. This yields
property (b). It remains to prove that in this case the implementation obtained
by composition is strict. Given an assignment to $\vec{x}$ that does not
satisfy
$f$ there exists an assignment to $\vec{y}$ satisfying $(\alpha_f -1)$
constraints from $C_1,\ldots, C_{p}$  for the $\alpha_f$-implementation is
strict. Then, the same reasoning as above yields an assignment to
$\vec{y},\vec{z}_1,\ldots,\vec{z}_{\beta}$ that satisfies $ \alpha_f +
\beta(\alpha_g-1)-1$ of the constraints, thus proving the strictness of the
implementation.
\end{proof}

Lemma~\ref{lem:compose} can be applied to
Examples~\ref{ex4}~and~\ref{ex5} to obtain the following example.

\begin{example}
The family $\{\oneinthree\}$ strictly and  perfectly
implements the function $\bor_{3,0}$. (Set $\calf_f =
\{\myxor,\oneinthree\}$ and $\calf_g = \{\oneinthree\}$ and
note that by Example~\ref{ex5}, we have that
$\calf_g$ implements $\myxor$.)
\end{example}

Applying Lemma~\ref{lem:compose} several times, we get more
interesting implementations, such as:

\begin{example}
\label{ex7}
The family $\{\oneinthree\}$ strictly and perfectly
implements every function in the family
$\{\bor_{3,0},\bor_{3,1},\bor_{3,2},\bor_{3,3}\}$.
(Use the implementations of
Examples~\ref{ex4},~\ref{ex5}~and~\ref{ex6}, and combine them all
using Lemma~\ref{lem:compose}.)
\end{example}


\medskip

Next we show a simple monotonicity property of implementations.

\begin{lemma}
\label{lem:imp-mon}
For integers $\alpha,\alpha'$ with $\alpha \leq \alpha'$, if $\calF$
$\alpha$-implements $f$ then $\calF$
$\alpha'$-implements $f$. Furthermore strictness and perfectness are
preserved
under this transformation.
\end{lemma}
\begin{proof}
Let constraint applications $C_1,\ldots,C_m$ from $\calF$ on
$\vec{x},\vec{y}$ form an $\alpha$-implementation of $f$, and
let $g \in \calF$ be a constraint of arity $k$ that is satisfiable.
Also, let $C_{m+1},\ldots,C_{m+\alpha'-\alpha}$
be $\alpha'-\alpha$ applications of the constraint
$g$ on new variables $z_1,\ldots,z_k$.
Then the collection of constraints $C_1,\ldots,C_{m+\alpha'-\alpha}$
on variable set $\vec{x},\vec{y},\vec{z}$ form an
$\alpha'$-implementation of $f$.
Furthermore the transformation preserves strictness and perfectness.
\end{proof}



\section{Reductions for Decision, Counting and Quantified Problems}


As might be already evident from the definition and properties of
implementations, they provide us with a natural mechanism to do
reductions between various satisfiability problems. A problem
specified by a constraint set $\calF_1$ can be reduced
to one specified by another constraint set $\calF_2$, if $\calF_2$
can implement the constraint set $\calF_1$ with appropriate properties.
In this section we formalize this connection between implementations and
reductions for decision, counting and quantified variants of the constraint
satisfaction problems.

\subsection{Decision Problems}

Since decision problems concern with the question of whether or not all
constraint applications are satisfiable, the appropriate notion of
implementations for reductions between decision problems is that
of perfect implementation.

\begin{lemma}
\label{nphard}
If $\sat({\cal F})$ is $\np$-hard and every constraint of
${\cal F}$ can be perfectly implemented
by  ${\cal F}'$,
then $\sat({\cal F}')$ is also $\np$-hard.
\end{lemma}
\begin{proof}
We prove that if every constraint of
${\cal F}$ can be perfectly implemented
by  ${\cal F}'$ then $\sat({\cal F})$ is polynomial-time reducible
to $\sat({\cal F}')$.
Given an $\calF$-collection of constraint applications $\CC$ on variables
$\vec x$, replace every constraint in $\CC$ with perfect implementation using
constraints in $\calF '$. We get an $\calF '$-collection of constraint
applications $\CC'$ on variable set $\vec x, \vec y$ where $\vec y$ is the
set of auxiliary variables.
Since all implementations are perfect, every assignment to $\vec x$ that
satisfies all constraints in $\CC$ can be extended to an assignment
to $\vec x\cup \vec y$ which satisfies all
constraints in $\CC'$. Conversely, given an assignment to $\vec x\cup \vec y$
that satisfies all
constraints in $\CC'$, its projection on to the primary variables $\vec
x$  satisfies all
constraints in $\CC$. This yields the desired reduction.
\end{proof}
\medskip

Now using the fact that
$\sat(\{ \bor_{3,0}, \bor_{3,1}, \bor_{3,2}, \bor_{3,3}\})$
is just $\tsat$, which is $\np$-hard; and combining
with Example~\ref{ex7}, we get the following nice consequence
of Lemma~\ref{nphard}.


\begin{example}
\label{oneinthree completeness}
The problem
$\sat(\{\oneinthree\})$ is \np-hard.
\end{example}


\medskip

We note here that the reduction described in Lemma~\ref{nphard}
is log-space computable and thus can also be used
to establish $\p$-hardness results.

\begin{lemma}
\label{phard}
If $\sat({\cal F}_1)$ is $\p$-hard and every constraint of
${\cal F}_1$ can be perfectly implemented
by  ${\cal F}_2$,
then $\sat({\cal F}_2)$ is also $\p$-hard.
\end{lemma}

\iffalse
To reduce a problem $\sat({\cal F}_1)$ to a problem $\sat({\cal F}_2)$,
we will often use  $\sat({\cal F}_2\cup\{\F, \T\})$ as an intermediate
problem.
Then we will have to get rid of the the constraints
$\F$ and $\T$. This cannot be done if every contraint in  ${\cal F}_2$ is
$C$-closed. In this particular case we will use the following lemma.

\begin{lemma}
\label{C-closed corollary}
Let ${\calF}$ be a set of $C$-closed constraints.
 If $\sat ({\cal F}\cup\{\F ,\T\}) $  is $\np$-hard  ($\p$-hard)  and if
$\calF$ can
perfectly  implement the $\xor$ function, then $\sat ({\cal
F})$   is $\np$-hard  ($\p$-hard).
If $\#\sat({\cal
F}\cup\{\F ,\T\})$ )  is $\#\p$-hard  and if $\calF$ can
faithfully  implement the $\xor$ function, then $\#\sat({\cal F})$  is
$\#\p$-hard.
\end{lemma}
\begin{proof}
First, we show a log-space (counting)
reduction from $\sat(\calF\cup\{\F ,\T\})$  ($\#\sat(\calF\cup\{\F ,\T\})$)
to $\sat(\calF\cup\{\xor\})$ ( $\#\sat(\calF\cup\{\xor\})$). It
suffices to use two new variables
$x_0$
and
$x_1$, that will simulate the role of functions
$F$ and
$T$.
Let $\CC$ be an
$\calF\cup\{\F ,\T\}$-collection of constraint applications  on variables
$\vec x$.  We use the variable  $x_0$ in place of any variable  $y$ with the
constraint
$F(y)$ and the variable $x_1$  in place of any variable  $z$ with the
constraint
$T(z)$. Next we add the constraint $\xor(x_0,x_1)$. We get  $\CC '$ an
$\calF\cup\{\xor\}$-collection of constraint applications  on variables
$\vec x, x_0, x_1$. Let $s$ be an assignment to $\vec x$ that satisfies all
constraints in $\CC$. Extending $s$ by $s(x_0)=0$ and $s(x_1)=1$ yields a
satisfying assignment for $\CC'$. Conversely, let $s'$ be an assignment to
$\vec x\cup x_0\cup x_1$ that satisfies all
constraints in $\CC'$. If $s'(x_0)=0$ and $s'(x_1)=1$ then $s'$ restricted to
$\vec x$  satisfies  $\CC$. Otherwise, $s'(x_0)=1$ and $s'(x_1)=0$. Then, in
using the $C$-closed property of every  function in $\calF$ it is easy to
verify that the assignment $s(x)=1-s'(x)$ satisfies all
constraints in $\CC$. At this stage we can conclude that
$\sat(\calF\cup\{\xor\})$ is $\np$-hard ($\p$-hard). Moreover,  the
number of satisfying assignments for
$\CC'$ is equal to twice the number of satisfying assignments for $\CC$.
Hence the proposed reduction is a counting reduction, thus proving the
$\#\p$-hardness of
$\#\sat(\calF\cup\{\xor\})$.
Finally, if $\calF$ can perfectly (faithfully) implement the $\xor$ function
then we can conclude by using Lemma \ref{nphard} (Lemma
\ref{sharp_phard} ).
\end{proof}

\fi

\subsection{Counting Problems}

As for counting problems, to get $\#\p$-hardness results we use
implementations
that preserve the number of solutions, that is faithful implementations.

\begin{lemma}
\label{sharp_phard}
If $\#\sat({\cal F})$ is $\#\p$-hard and every constraint of
${\cal F}$ can be faithfully implemented  by  ${\cal F}'$,
then $\#\sat({\cal F}')$ is also $\#\p$-hard.
\end{lemma}
\begin{proof}
We prove that if every constraint of
${\cal F}$ can be faithfully implemented  by  ${\cal F}'$ then there is
a parsimonious reduction from
$\#\sat({\cal F})$ to $\#\sat({\cal F}')$.
As in the previous proof, we use faithful implementations to transform a
given $\calF$-collection of constraint applications on variable set
$\vec x$, say $\CC$, we get an $\calF '$-collection of constraint applications
on variable set $\vec x, \vec y$, say $\CC '$.
Since the implementations are faithful, every assignment to
$\vec x$ satisfying all constraints in $\CC$   can be extended in a unique
way to an assignment to $\vec x\cup \vec y$ that satisfies all
constraints in $\CC'$. Therefore there is a one-to-one correspondence between
the assignments to
$\vec x$ that satisfy all constraints in $\CC$ and the assignments to
$\vec x\cup \vec y$ which satisfy all
constraints in $\CC'$. This yields the desired reduction.
\end{proof}


\subsection{Quantified Problems}

Similar to the decision problems, we show that perfect implementations
suffice for reductions among quantified problems.

\begin{lemma}
\label{qnphard}
If $\qsat(\calF)$ is $\pspace$-hard and every constraint of
${\cal F}$ can be perfectly implemented
by  ${\cal F}'$,
then $\qsat({\cal F}')$ is also $\pspace$-hard.
\end{lemma}
\begin{proof}
We prove that if every constraint of
${\cal F}$ can be perfectly implemented
by  ${\cal F}'$ then $\qsat(\calF)$ is log-space reducible to  ${\cal F}'$.
Let $\qq_1
x_1\ldots \qq_nx_n\CC$ be a quantified
$\calF$-expression on  variable set
$\vec x= \{x_1,\ldots , x_n\}$. Replace every constraint in $\CC$ with perfect
implementations using constraints of $\calF '$, thus we get $\CC'$ on
variables set $\vec x,\vec y$. Finally, consider the following quantified
expression:
$$\qq_1 x_1\ldots \qq_nx_n \vec\exists \vec y\ \CC'.$$
Since the implementations are  perfect it is clear that the initial quantified
$\calF$-expression is true if and only if the expression above is true.
This yields the desired reduction.
\end{proof}


\section{Reductions for Optimization Problems}

\iffalse
\subsection{Weighted vs. Unweighted Problems}

Our classification results for optimization problems strongly
rely on the ability to work with weighted versions of our
problems. We show here that in most cases
showing hardness for weighted problems is sufficient.
Specifically it shows
that as long as a problem is weakly approximable, its weighted
and unweighted versions are equivalent. The result uses a
a similar result from Crescenzi et al.~\cite{CST96} who
prove that for ``nice'' problems in \polyapx, weighted
problems AP-reduce to problems with polynomially-bounded
integral weights. Their definition of ``nice'' includes all
problems dealt with in this paper. Using this result we
scale all weights down to small integers and then simulate
the small integral weights by replication of clauses
and/or variables.

\begin{lemma}
\label{lem:weight-remove}
For any constraint family $\calf$, if
\wmaxcspf\ is in \polyapx, then \wmaxcspf AP-reduces
to \maxcspf.
Analogous results hold for
\mincspf, \maxonef\ and \minonef.
\end{lemma}

\begin{proof}
%Given an instance {\cal I_1} of \wmaxcspf\
%(resp. \wmincspf, \wmaxonef\ or \wminonef),
We first use the above mentioned result of
\cite[Theorem 4]{CST96} to AP-reduce \wmaxcspf\
(resp. \wmincspf, \wmaxonef\ or \wminonef) to
the special class of \wmaxcspf\ problems with
polynomially bounded positive integral weights.%
\footnote{Strictly speaking, the reduction of
\cite{CST96} reduces to instances with some weights
being possibly zero. However it is easy to modify their
proof so that this does not happen. In particular,
we may just add one to every weight in the reduced instance
and verify that this still produces an AP-reduction.}
Thus it suffices to show an AP-reduction from
this special class of problems to the unweighted
case.

Given an instance of
\wmaxcspf\ on variables $x_1,\ldots,x_n$,
constraints $C_1,\ldots,C_m$ and weights
$w_1,\ldots,w_m$; we reduce it to the unweighted
case by replication of constraints. Thus the
reduced instance has variables $x_1,\ldots,x_n$
and constraint $\{\{C_i^j\}_{j=1}^{w_i}\}_{i=1}^m$
where constraint $C_i^j = C_i$.
It is clear that the reduced instance is essentially
the same as the instance we started with.
Similarly we reduce \wmincspf\ to \mincspf.

Given an instance ${\cal I}$ of
\wmaxonef\ on variables $x_1,\ldots,x_n$,
constraints $C_1,\ldots,C_m$ and weights
$w_1,\ldots,w_n$; we create an instance ${\cal I}'$ of
\maxonef\ on variables $\{\{y_i^j\}_{j=1}^{w_i}\}_{i=1}^n$.
For every constraint $C_j$ of ${\cal I}$ of the form
$f(x_{i_1},\ldots,x_{i_k})$, and for every $j \in \{1,\ldots,k\}$
and $n_j \in \{1,\ldots,w_{i_j}\}$ we impose the constraints
$f(y_{i_1}^{n_1},\ldots,y_{i_k}^{n_k})$. We now claim that
the reduced instance is essentially equivalent to the instance
we started with. To see this, notice that given any feasible
solution $\vecy$ to the ${\cal I}'$ we may convert it to another
feasible solution $\vecy'$ in which, for every $i$, all the
variables $\{(\vecy')_i^j | j = 1,\ldots,w_i\}$ have the same
assignment, by setting $(\vecy')_i^j$ to $1$ if any of the variables
$y_i^{j'}$, $j' = 1,\ldots,w_i$ is set to $1$. Notice that
this preserves feasibility; and only increases the contribution
to the objective function. The assignment $\vecy'$ now induces an
assignment to $\vecx$ with the same value of the objective
function. Thus the reduced instance is essentially equivalent
to the original one. This concludes the reduction from \wmaxonef\ to
\maxonef. The reduction from \wminonef\ to \minonef\ is similar.
\end{proof}

\fi

In this section we show that implementations lead
to reductions for optimization problems. In the case of
$\maxcsp$ and $\mincsp$, this holds for unweighted problems
as well as weighted problems. In the case of $\minone$
and $\maxone$, the reductions work only when one is
allowed to use weights. It turns out however that weights
do not play any significant role in determining the approximability
behaviour of these problems.
This issue will be dealt with in Chapter~\ref{Classification Theorems
for Optimization Problems}.

\subsection{Reductions for \maxcsp\ Problems}

We first show how strict implementations are useful in establishing
AP-reducibility among \maxcsp\ problems. We
need a simple statement about the approximability of
\maxcsp\ problems.

\begin{proposition}[\cite{py}]
\label{prop:abs-apx-csp}
For every constraint family $\calf$ (with no unsatisfiable constraints)
there exists a positive constant $\beta$ such that given any
instance $\calI$ of \maxcspf\ with $m$ constraint applications,
a solution satisfying $m/\beta$ constraints
can be found in polynomial time. Moreover, the statement also
holds for \wmaxcspf.
\end{proposition}

\begin{proof}
The proposition follows from the proof of Theorem 1 in \cite{py}
which shows the above for every ``$\maxsnp$ problem''. ($\maxsnp$
is a class of optimization problems introduced in \cite{py}.
This class contains every $\maxcspf$ problem.)

Briefly, their proof, specialized to $\maxcspf$, goes as follows:
Let $k$ be the maximum arity of a constraint in $\calf$ and let
$\beta = 2^k$. Then for any instance of $\maxcspf$ on $m$ constraints, a
random assignment satisfies a given constraint application with
probability at least $1/\beta$, and hence is expected to satisfy at
least $m/\beta$ constraints. Thus every instance on $m$ constraints
has an assignment satisfying at least $m/\beta$ constraints. Further,
such an assignment can be found deterministically using the ``method
of conditional probabilities'' (see, for instance, \cite{MR}).

The result for the weighted case is completely analogous.
\end{proof}

\begin{lemma}
\label{apxhard}
If every constraint of ${\cal F}$
can be strictly implemented by  ${\cal F}'$,
then $\csp({\cal F})$ is AP-reducible to  $\csp({\cal F}')$.
\end{lemma}

\begin{proof}
Our reduction uses Proposition~\ref{prop:abs-apx-csp} above.
Let $\beta$ a constant such that
given an instance $\calI$ of \maxcspf\ with $m$ constraints
an assignment satisfying ${m\over\beta}$ constraints can be found
in polynomial time.

Recall that we need to show polynomial time constructible functions
$f$ and $g$ such that $f$ maps
an instance $\calI$ of \maxcspf\ to
an instance of \maxcsp$(\calf')$, and $g$ maps a solution to
$f(\calI)$ back to a solution of $\calI$.
Given an instance $\calI$ on $n$ variables and $m$ constraints,
the mapping $f$ simply replaces every constraint application in
$\calI$ with a strict $\alpha$-implementation using constraints of
$\calF'$, for some constant $\alpha$. (Notice that by
Lemma~\ref{lem:imp-mon}, such an $\alpha$ does exist.)
The mapping retains the original $n$ variables of
$\calI$ as primary variables and uses $m$ independent
copies of the auxiliary variables; one independent copy
for every constraint in $\calI$.

Let $\langle s_x,s_y \rangle$ be an $r$-approximate
solution to the instance $f(\calI)$, where $s_x$ denotes the
assignment to the original variables $\vec{x}$ of $\calI$
and $s_y$ denote the assignment to the auxiliary variables
$\vec{y}$ introduced in the implementations.
The mapping $g$ uses two possible solutions and takes the
better of the two. The first solution is simply $s_x$, while the second
solution $s_{x'}$ is a solution that satisfies at least
$m/ \beta$ of the constraints in  $\calI$ (existence is guaranteed by
Proposition~\ref{prop:abs-apx-csp}). The function
$g$ outputs the better of the two solutions.

We now show that a $r$-approximate solution leads to an
$r'$-approximate solution where $r' \leq 1 + \gamma(r-1)$
for some constant $\gamma$.
Let $\opt$ denote the optimum value for the instance $\calI$.
Then the optimum value for the instance $f(\calI)$ is exactly
$\opt + m(\alpha -1)$.
This computation uses the fact that for every satisfied constraint
in the optimal assignment to $\calI$, we can satisfy $\alpha$
constraints of its implementation by choosing the auxiliary
variables appropriately (from properties (a) and (b) of
Definition~\ref{def:imp}); and for every unsatisfied constraint
exactly $\alpha-1$ constraints of its implementation can be
satisfied (from property (c) and strictness of the implementation).
Thus the solution $\langle s_x,s_y \rangle$ satisfies at least
$\frac1r (\opt + m(\alpha -1))$ constraints of $f(\calI)$, and hence
$x$ satisfies at least $\frac1r (\opt + m(\alpha -1)) - m(\alpha
-1)$ constraints in $\calI$. Note that here we use properties (a) and (c) of
Definition~\ref{def:imp}
to see that there must be at least $\frac1r(\opt + m(\alpha
-1)) - m(\alpha -1)$ constraints of $\calI$ in whose implementations
exactly $\alpha$ constraints must be satisfied.
Thus the solution output by $g$ satisfies at least
$$\max\{\frac1r(\opt + m(\alpha -1)) - m(\alpha -1), {m\over\beta}\}$$
constraints. Using the fact that $\max\{a,b\} \geq \lambda a + (1 -
\lambda) b$ for any $\lambda \in [0,1]$ and using $\lambda = {r
\over r + \beta(\alpha-1)(r-1)}$, we lower bound the
above expression by
$$ {\opt \over r + \beta(\alpha-1)(r-1)}.$$
Thus
$$r' \leq {\opt \over \opt / (r + \beta(\alpha-1)(r-1)) } =
r + \beta(\alpha-1)(r-1) = 1 + (\beta(\alpha-1) + 1) (r-1).$$
Hence $g$ maps $r$-approximate solutions of $f(\calI)$
to $1 + \gamma (r-1) $ approximate solutions to $\calI$
for $\gamma = \beta(\alpha-1) + 1 < \infty$ as required.
\end{proof}

\begin{corollary}
\label{cor:apxhard}
If $\csp({\cal F})$ is $\apx$-hard and every constraint of
${\cal F}$ can be strictly  implemented by  ${\cal F}'$,
then $\csp({\cal F}')$ is also $\apx$-hard.
\end{corollary}



\subsection{Reductions for \maxone\ and \minone\ Problems}

Since every feasible solution to a \maxone\ (\minone) problem
must satisfy all constraint applications, it is natural to consider
perfect implementations. We now show that perfect implementations can be
used to establish AP-reducibility for these problems.

\begin{lemma}
\label{lem:imp-one}
If every constraint of $\calf$ can be perfectly implements by $\calf'$,
then \wmaxonef\ is AP-reducible to \wmaxone$(\calf')$.
An analogous result holds for \wminonef.
\end{lemma}

\begin{proof}
Again we need to show polynomial time constructible functions
$f$ and $g$ such that $f$ maps
an instance $\calI$ of \wmaxonef\ (\wminonef)
to an instance of \wmaxone$(\calf')$ (\wminone$(\calf)$), and
$g$ maps a solution to $f(\calI)$ back to a solution of $\calI$.

Given an instance $\calI$ on $n$ variables and $m$ constraints,
the mapping $f$ simply replaces every constraint in
$\calI$ (which belongs to $\calf$)
with perfect implementations using constraints of
$\calF'$.
The mapping retains the original $n$ variables of
$\calI$ as primary variables and uses $m$ independent
copies of the auxiliary variables; one independent copy
for every constraint in $\calI$.
Further, $f(\calI)$ retains the weight of the primary variables from
$\calI$ and associates a weight of zero to all the newly created
auxiliary variables. Given a solution to $f(\calI)$, the mapping
$g$ is simply the projection of the solution back
to the primary variables.
It is clear that every feasible solution to $\calI$ can be extended
into a feasible solution to $f(\calI)$ which preserves the value
of the objective; alternatively, the mapping $g$ maps feasible
solutions to $f(\calI)$ into feasible solutions to $\calI$ with the
same obective. (This is where the perfectness of the implementations
is being used.)
Thus the optimum of $f(\calI)$
equals the value of the optimum of $\calI$ and given an $r$-approximate
solution to $f(\calI)$, the mapping $g$ yields an $r$-approximate
solution to $\calI$.
\end{proof}


\begin{corollary}
If $\wmaxonef$ is $\apx$-hard and $\calF '$ perfectly
implements every constraint in $\calF$, then
$\wmaxone(\calF ')$ is $\apx$-hard.  Similarly, if
$\wmaxonef$ is $\polyapx$-hard and $\calF '$ perfectly
implements every constraint in $\calF$, then weighted
$\wmaxone(\calF ')$ is $\polyapx$-hard.
Analogous results hold for \wminone\ as well.
\end{corollary}


\subsection{Reductions for \mincsp}

\begin{lemma}
\label{lem:imp-mincsp}
If every constraint of $\calf$
is perfectly implemented by $\calf'$
then \mincspf\ is
A-reducible to \mincsp$(\calf')$.
\end{lemma}

\begin{proof}
Let $\alpha$ be large enough so that any constraint from \calf\ has
a  perfect $\alpha$-implementation using constraints from $\calf'$.
Let $\x$ be an instance of \mincspf\ and let $\x'$ be
the instance of  \mincsp$(\calf')$ obtained by replacing each
constraint of $\x$ with the respective $k$-implementation.
Once again each implementation uses the original set of variables
for its primary variables and uses its own independent copy
of the auxiliary variables.
It is easy to check that  any assigment for $\x'$ of cost $V$
yields
an assigment for $\x$ whose cost is between $V/\alpha$ and $V$. It is
immediate to check that if the former solution is $r$-approximate,
then the latter is $(\alpha r)$-approximate.
\end{proof}

\section{Implementation Results: Classical and New}

In this section we present results about how function families
that do not possess a given property implement some elementary functions
that lack the same property. Since the section is somewhat
long, it may be useful to anticipate some of the results. Let us
consider some of the simplest examples of functions that do not possess
a given property. (The notion of ``simpliciy'' here is just that we consider
a function of the smallest possible arity that does not possess a given
property).
For non-$0$-validity, the function $\T(x)$ is a good
example. Similarly, for non-$1$-validity, the function $\F(x)$ is a good
example. Continuing in this manner, we obtain the following examples:
\begin{itemize}
\item Non-affine: the functions $\bor_0$, $\bor_1$ and $\bor_2$
are non-affine.
\item Non-bijunctive: any of the ternary functions listed in
Chapter~\ref{Constraint Satisfaction Problems},
including
$\bor_{3,j}$, $\myxor_3$ and $\oneinthree$.
\item Non-weakly positive/weakly negative: the functions
$\bor_{3,2}$ and $\bor_{3,3}$ are not weakly positive, while
$\bor_{3,0}$ and $\bor_{3,1}$ are not weakly negative.
\item Affine, but not width $2$: the functions $\myxor_3$ and $\myxnor_3$
are affine but not of width $2$.
\item Non 2-monotone: the function $\myxor$ is not 2-monotone.
\end{itemize}
Surprisingly, it turns out that whenever a constraint family does not
have one of the properties listed above,
then the family implements (sometimes with help) one of
the corresponding example functions listed above.
Thus these example functions serve as the unifying theme for all constraint
families that lack a given property. As we will see later, this unification
is central to our classification results.

\subsection{Preliminaries}

We start by first showing that implementations do not
enhance the power of a function family by much. In particular
all properties defined in Chapter~\ref{Characterizations of
Constraint Functions} are closed under appropriate
forms of implementations.
The following lemma illustrates closure under perfect
implementations.

\begin{lemma}
\label{imp closure}
If $\calf$ is a weakly positive
(weakly negative / bijunctive / \ihsbp / \ihsbn )
family and \calf\ perfectly implements
$f$, then $f$ is also weakly positive
(weakly negative / bijunctive / \ihsbp / \ihsbn ).
\end{lemma}

\begin{proof}
Let $f(x_1,\ldots,x_k)$
be perfectly implemented by the collection of
constraint applications $f_1,\ldots,f_m$ with
$f_j$ being applied to some subset of the primary
variables $x_1,\ldots,x_k$ and the auxiliary variables
$y_1,\ldots,y_l$. Fix $j \in \{1,\ldots,m\}$ and
consider the constraint function
$f'_j(x_1,\ldots,x_k,y_1,\ldots,y_l)$ which
is satisfied by an assignment to $\vecx,\vecy$ if
and only if the $j$th constraint application $f_j$ is
satisfied. Notice that $f'_j$ is a weakly positive constraint
(though it may not necessarily lie in $\calf$ due to syntactic
reasons).
Now consider the function $f'(\vecx,\vecy) = \wedge_{j=1}^m
f'_j(\vecx,\vecy)$. Since $f'$ is the conjunction of weakly
positive functions, $f'$ also weakly positive. Now
$f(x_1,\ldots,x_k)$ is simply the function $\exists \vecy$ s.t.
$f'(\vecx,\vecy)$. By Lemma~\ref{lem:char-horn}, $f$ is also weakly positive.
\end{proof}

Similar results hold true also for perfect implementations
obtained from affine families and affine familes with width two.
Similarly strict implementations obtained from 2-monotone families
only give rise to 2-monotone functions. These results are implicit from
this monograph, but not derived explicitly here.

%Let us first state a useful lemma which will often be  used implicitly.

%\begin{lemma}
%The constraint set $\{\xor\}$ can  implement the constraint $\rep$
%perfectly, %faithfully and with perfect completeness.
%\label{xor_gives_rep}
%\end{lemma}
%\begin{proof}
%To perfectly implement $\rep(x,y)$, we include the constraints $\xor(x,z)$ and
%$\xor(y,z)$ for an auxiliary variable $z$.
%\end{proof}

\subsection{Non 0-valid and Non 1-valid Functions}

First let us observe that as soon as we have the functions $\F$ and $\T$ we
can freely use the constants $0$ and $1$  since we can get rid of them by
replacing them by two new variables $x_0$ and $x_1$ and by adding the
constraints $\F(x_0)$ and $\T(x_1)$.


\begin{lemma}
\label{non0-non1-Cclosed}
\label{non0_non1_Cclosed}
\label{replication}
\label{non0-non1-C-closed}
\label{non0_non1_C-closed}
\label{non0_non1}
\label{non0-non1}
\label{non0_non1_nonC-closed}
\label{non0-non1-nonC-closed}
\label{lem:non01}
if \calf\ is not 0-valid \lb 1-valid \rb and:
\begin{enumerate}
\item if \calf\ is C-closed, then \calf\ implements $\myxor$
strictly, perfectly and faithfully.
\item if \calf\ is not C-closed, then \calf\ implements $\T$
\lb $\F$ \rb strictly, perfectly and faithfully.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $f \in \calf$ be non 0-valid. If $f$ is C-closed, then $f$ is
also not 1-valid.  Let $s$ be a satisfying assignment for $f$.
Observe that both $O(s)$ and $Z(s)$ are nonempty.
Consider the constraint $g(x,y)$ obtained from $f$ by substituting the
variable $x$ for all variables in $O(s)$ and the variable $y$ for
all variables in $Z(s)$. Since $f(\vec 0)=f(\vec 1)=0$ and
$f(s)=f(\bar s)=1$, we find that $g(x,y) = x \oplus y$.
This yields Part 1 of the lemma.

For Part 2, we consider several cases.
Again let $f$ be a non 0-valid function in $\calf$.
If $f$ is 1-valid then
the constraint obtained from $f$ by substituting the variable $x$ for
all variables of $f$ is the constraint $\T(x)$ as required.
Else $f$ is not 1-valid. Again if $f$ is not C-closed, then
there is an assignment $s$ different from $\vec 0$ and $\vec 1$ such
that $f(s)=1$ and $f(\bar s)=0$.
Consider the constraint $g(x,y)$ obtained from $f$ by
substituting $x$ for all variables in $Z(s)$ and
$y$ for all variables in $O(s)$.
Then $g(x,y) = \bar x\wedge y$ and thus the constraint $\exists x$ s.t.
$g(x,y)$ implements $\T(y)$.
Finally we are left with the case when $f$ is C-closed. (But \calf\ is
not!) In this case, $f$ implements $\xor$. Let $h$ be a non-C-closed
function in $\calf$ with $h(s) = 1$ and $h(\bar s) = 0$. Substituting
$x$ for all variables in $O(s)$ and $y$ for all variables in $Z(s)$
we get a function $g(x,y)$ with $g(10) = 1$ and $g(01) = 0$. Now
the constraints $g(x,y)$ and $\xor(x,y)$ give strict, perfect and
faithful 2-implementation of $\T(x)$, concluding this case also.
\end{proof}

\iffalse
\begin{lemma}\label{non0-non1-C-closed}
{\rm \cite{Schaefer-78, Creignou-95, KhannaS-96}}
If $f$ is neither 0-valid nor 1-valid and $f$ is $C$-closed, then $\{f\}$
can implement the function $\xor$ strictly,
faithfully and perfectly.
\label{non0_non1_Cclosed}
\label{replication}
\end{lemma}
\begin{proof}
Let $s$ be a satisfying assignment for $f$. Observe that both $O(s)$ and $Z(s)$
are nonempty. Consider the constraint obtained from $f$ by assigning the
identical value $x$ to all variables in $O(s)$ and the identical value $y$ to
all variables in $Z(s)$. Since $f(\vec 0)=f(\vec 1)=0$ and $f(s)=f(\bar s)=1$
it is clear that this constraint is satisfied iff $\xor (x,y)$ is satisfied.
\end{proof}



\begin{lemma}\label{non0-non1}

{\rm \cite{Schaefer-78, Creignou-95, KhannaS-96}}
If $f_0$ is not 0-valid and $f_1$ is not 1-valid, then $\{f_0,f_1\}$
can implement either the functions $\T$ and $\F$ or the
function
$\xor$  strictly,
faithfully and  perfectly.
\label{non0_non1}
\end{lemma}

\begin{proof}
If $f_0$ is $1$-valid and $f_1$ is $0$-valid then the constraint obtained
from $f_0$ by assigning the identical value $x$ to all variables and
the constraint obtained from $f_1$ by assigning the identical value $y$ to
all variables respectively implement the functions $\T$ and $\F$.

Otherwise, suppose that $f_0$ is not $1$-valid. Let $s$ be a satisfying
assignment for $f_0$. Observe that both $O(s)$ and $Z(s)$ are nonempty.
Consider the constraint obtained from $f_0$ by assigning the identical
value $x$ to all variables in $O(s)$ and  the identical value $y$ to all
variables in $Z(s)$. Since $f_0(\vec 0)=f_0(\vec 1)=0$ and $f_0(s)=1$, it
is clear that this constraint implements either the function $\xor$ or the
functions $\T$ and $\F$ according to whether $f_0(\bar s)=1$ or $0$,
strictly,
faithfully and perfectly.
\end{proof}



\begin{lemma}\label{non0-non1-nonC-closed}

{\rm \cite{Schaefer-78, CreignouHr-96, KhannaS-96}}
If $f_0$ is not 0-valid, $f_1$ is not 1-valid and $h$ is some non
$C$-closed function, $\{f_0,f_1,h\}$
can  implement the functions $\T$ and $\F$ strictly,
faithfully and perfectly.
\label{non0_non1_nonC-closed}
\label{unary}
\end{lemma}

\begin{proof}
According to Lemma \ref{non0-non1} $\{f_0,f_1\}$ can implement the functions
$\T$ and $\F$ or the function $\xor$ strictly,
faithfully and perfectly. In the first case we are done. In
the second case, let $s$ be a satisfying assignment for $h$ such that
$h(\bar s)=0$.
Consider the constraint obtained from $h$ by assigning the identical value
$x$ to all variables in $O(s)$ and  the identical value $y$ to all
variables in $Z(s)$. Whatever the variables that do occur in this
constraint, this constraint together with the constraint $\xor(x,y)$ is
satisfied iff $\T(x)\wedge \F(y)$ evaluates to true. Therefore,
$\{f_0,f_1,h\}$
can  implement the functions $\T$ and $\F$ strictly,
perfectly  and faithfully.
\end{proof}
\fi

\subsection{Non  $C$-closed Functions}

The following lemma is a dual to the last one, in that it
assumes a family is not C-closed and then describes what
can be implemented with it, depending on whether or not
it is 0-valid or 1-valid.

\begin{lemma}\label{non-C-closed}
{\rm \cite{CreignouHr-96}}
Let \calf\ be a non-C-closed family.
\begin{enumerate}
\item
If \calf\ is  both $0$-valid and $1$-valid then \calf\ implements
$\bor_1$ strictly, faithfully and perfectly.
\item
If \calf\ is not $0$-valid (resp. not $1$-valid)
then \calf\ implements $\T$ (resp. $\F$)
strictly, perfectly and faithfully.
\end{enumerate}
\end{lemma}

\begin{proof}
Part 2 is identical to Lemma~\ref{lem:non01}, Part 2.
For Part 1,
let $f \in \calf$ be non-C-closed.
Let $s$ be an assignment such that $f(s) = 1$ and $f(\bar s) = 0$.
Let $g(x,y)$ be obtained from $f$ by substituting $x$ for all
variables in $O(s)$ and $y$ for all variables in $Z(s)$.
Since $f$ is 0-valid and 1-valid, the function $g(x,y)$
is given by $g(00) = g(10) = g(11) = 1$ and $g(01) = 0$.
In other words,
$g(x,y) = x \wedge \bar y$, which gives Part 1.
\end{proof}

\subsection{Non Weakly Negative and Non Weakly Positive Functions}

\begin{lemma}
\label{non_weak+_non_weak-}
{\rm \cite{Schaefer-78},\cite{KhannaS-96}}
Let $f_+$ be a non weakly positive function and
$f_-$ be a non weakly negative function. Then
\begin{enumerate}
\item $\{f_+,\F,\T\}$ implements at least one of $\xor$ or $\bor_2$
strictly, perfectly and faithfully.
\item $\{f_-,\F,\T\}$ implements at least one of $\xor$ or
$\bor_0$  strictly, perfectly and faithfully.
\item $\{f_+,f_-,\F,\T\}$ implements $\xor$ strictly, perfectly and faithfully.
\end{enumerate}
\end{lemma}
\begin{proof}
We first show that $\{f_-,\F,\T\})$ can  implement
either the function $\xor$ or the function $\bor_0$. By Lemma
\ref{weak-character}, there are two satisfying assignments for $f_-$, say $s_1$
and
$s_2$, such that $s_1\cap s_2$ is not a satisfying assignment. Observe that
both $O(s_1)\cap Z(s_2)$ and $Z(s_1)\cap O(s_2)$
are nonempty. Consider the constraint $C(u,x,y,v)$ obtained from $f_-$ by
assigning an identical value $u$ to all variables in $Z(s_1)\cap Z(s_2)$,
an identical value $x$ to all variables in $Z(s_1)\cap O(s_2)$,
an identical value $y$ to all variables in $O(s_1)\cap Z(s_2)$ and
an identical value $v$ to all variables in $O(s_1)\cap O(s_2)$. It is easy to
see that the set of constraints $\{C(u,x,y,v), \F(u), \T(v)\}$ strictly,
perfectly, and faithfully implements either
the function $\xor (x,y)$ or $\bor_0(x,y)$ depending on whether $s_1\cup s_2$
is satisfying. Similarly, we can show that $\{f_+,\F,\T\})$ can
strictly, perfectly, and faithfully implement
either the function $\xor$ or the function $\bor_2$. Finally, since
$\{\bor_0,\bor_2\}$ can strictly, perfectly, and faithfully implement
$\xor$, we conclude that
$\{f_+,f_-,\F,\T\}$ can strictly, perfectly, and faithfully implement
$\xor$.
\end{proof}


\subsection{Non \setcoverB\ functions}

\begin{lemma}\label{WN non ISBN}
If $f$ is  a weakly negative (weakly positive) function which is not
\setcoverB$-$ (\setcoverB$+$) then
$\{f,\F,\T\}$ can  perfectly implement the function $\bor_{3,2}$
($\bor_{3,1}$).
\label{non-1-weakly-negative}
\end{lemma}


\begin{proof}
We know that $f$ has a maxterm $m$  with one positive literal and at least two
negative literals. Let us assume that $m=(x\vee\bar y\vee\bar z\vee\ldots)$.
Consider the function $f'(x,y,z)$ which is  $f$ existentially
quantified over the variables not in $m$ with  all variables in $m$ different
from $x$, $y$ and
$z$ set (with the functions $\F$ and $\T$) to
 the value which does not make $m$ true.
Then the assignment $x=0$, $y=z=1$ is a non-satisfying assignment, $f'(011)=0$.
By the definition of a maxterm $f'(010) =f'(001)=f'(111)=1$.
Moreover,  $(0,0,0)=(0,1,0)\cap (0,0,1)$,
and since $f'$ is a
weakly negative constraint $f'(000)=1$  (Lemma~\ref{weak-character}).
Finally, the following values of $f'$ are undetermined $A=f'(100)$,
$B=f'(101)$
and  $C=f'(110)$. Observe that  $(1,0,0)=(1,0,1)\cap (1,1,0)$ and remind that
$f'$ is a
weakly negative constraint. Therefore we cannot have $B=C=1$ and $A=0$
(Lemma~\ref{weak-character}). It remains several cases to discuss.

If $A=1$ then

\noindent $(x\vee\bar y\vee\bar z) \equiv
\exists u_1 f'(x,u_1,u_1)\wedge f'(u_1,y,z). $

If  $A=B=0$  then

\noindent $(x\vee\bar y\vee\bar z) \equiv
\exists u_1\exists u_2\exists u_3\exists u_4
f'(x,u_1,u_2)\wedge f'(y,u_1,u_3)\wedge f'(z,u_2,u_4). $



If $A=C=0$ then

\noindent $(x\vee\bar y\vee\bar z) \equiv
\exists u_1\exists u_2\exists u_3\exists u_4
f'(x,u_1,u_2)\wedge f'(y,u_3,u_1)\wedge f'(z,u_4,u_2). $


\medskip


 Therefore, in any case $\{f,\T,\F\}$ can perfectly implement the function
$\bor_{3,2}$.
\end{proof}

\begin{lemma}
\label{W2A non ISBN}
If $f$ is  affine with width two which is not
\setcoverB$-$ or \setcoverB$+$ then
$\{f,\F,\T\}$ perfectly implements the function $\myxor$.
\end{lemma}

\begin{proof}
By Lemmas~\ref{non_weak+_non_weak-}~and~\ref{WN non ISBN},
we have that
$\{f,\F,\T\}$ strictly, perfectly and faithfully implements at
least one of the functions in the set
$\{\myxor,\bor_0,\bor_2,\bor_{3,1},\bor_{3,2}\}$. (If $f$ is
weakly positive or negative, we get one of the last two, else
we get one of the first three.)
But the last four functions in this set are not affine with
width 2, and by Lemma~\ref{imp closure},
a width-2 affine family can only
implement functions that are width-2 affine. Hence $\{f,\F,\T\}$
must implement $\myxor$ strictly, perfectly and faithfully.
\end{proof}

\begin{lemma}
\label{2CNF non ISBN}
If $f$ is  bijunctive but not
\setcoverB$-$ or \setcoverB$+$ then
$\{f,\F,\T\}$ strictly, perfectly and faithfully
implements the functions $\myxor$
or $\{f,\F,\T\}$ strictly, perfectly and faithfully
implements both the functions $\bor_0$ and $\bor_2$.
\end{lemma}

\begin{proof}
Examining Lemmas~\ref{non_weak+_non_weak-}~and~\ref{WN non ISBN},
more carefully now, we have that
$\{f,\F,\T\}$ strictly, perfectly and faithfully implements all the
functions from at least one of the three families:
$\calf_1 = \{\bor_0,\bor_2\}$,
$\calf_2 = \{\myxor\}$, or
$\calf_3 = \{\bor_{3,1},\bor_{3,2}\}$.
In the first two cases we are done. In the third case, we use the
fact that $\bor_{3,1}(x,y,z) \wedge \F(z)$ gives a strict, perfect
and faithful implementation of $\bor_0(y,z)$ (and similarly for
$\bor_2$). Thus in this case also we get a strict, perfect and
faithful implementation of $\{\bor_0,\bor_2\}$.
\end{proof}

\subsection{Non Affine Functions}

We now turn our attention to non affine functions. The following
lemma shows that, with the help of either $\F$ or $\T$, they
implement one of the three functions $\bor_0$, $\bor_1$, or $\bor_2$.
Notice that these are the only three non-affine functions on upto
2 variables!

\begin{lemma}
\label{lem:imp-non-affine}
\label{0valid-1valid-xor non_affine}
\label{non_affine}
\label{xor non_affine}
If $f$ is not affine, then $\{f, \F \}$ ($\{f, \T \}$) implements
at least one of the three functions $\bor_0,\bor_1$ or $\bor_2$ strictly,
perfectly and faithfully. Furthermore, if $f$ is 0-valid (1-valid) then
$\{f,\F\}$
\lb $\{f,\T\}$ \rb implements one of $\bor_1$ or $\bor_2$
\lb $\bor_0$ or $\bor_1$ \rb strictly,
perfectly and faithfully.
\end{lemma}

\begin{proof}
We start by considering the case when $f$ is 0-valid (the case 1-valid is
similar). In this case, by Lemma~\ref{affine-character}, there exist
assignments
$s_1,s_2$ such that $f(s_1) = f(s_2) = 1$, but $f(s_1 \oplus s_2) = 0$.
The following table describes the situation:
$$
\begin{array}{cllllc}
 ~~~&~ & ~ & ~ & ~  & ~~f() \\
 ~~ & 00 ... 0 & 00...0 & 00...0 & 00...0  & 1\\
s_1 & 00 ... 0 & 00...0 & 11...1 & 11...1 & 1\\
s_2 & 00 ... 0 & 11...1 & 00...0 & 11...1 & 1\\
s_1\oplus s_2 & 00 ... 0 & 11...1 & 11...1 & 00...0 & 0 \\
 ~& 00...0 & xx...x & yy...y & zz...z & ~~~
\end{array}
$$
Fixing the above variables to 0's as shown in the last row, and
assigning replicated copies of three variables $x,y$ and $z$, we get a
constraint $h(x,y,z)$, such that $h(000) = h(011) = h(101) = 1$
and $h(110) = 0$. (Notice that forcing variables to $0$ is feasible
since the constraint $\F$ is available.) In Claim~\ref{clm:table}
we prove that for any such function $h$ the family $\{h,\F\}$ implements
at least one of $\bor_1$ or $\bor_2$ strictly,
perfectly and faithfully.

We now move to the case where $f$ is not $0$-valid. Observe that in this case
$\{f,\F\}$ can implement $\T$ strictly, perfectly and faithfully. (Let $s$ be a
satisfying assignment. Let $g(x,y)$ be the constraint obtained from $f$ by
substituting the variable $x$ for all variables in $O(s)$ and the variable $y$
for all variables in $Z(s)$. The set of constraints $\{ g(x,y), \F(y)\}$ gives
a strict, perfect and faithful implementation of $\T(x)$.) Therefore, we
prove
that
$\{f,\F,
\T
\}$  can implement one of
$\bor_0$,
$\bor_1$ or
$\bor_2$ strictly,
perfectly and faithfully. Here again we get into two cases depending on
whether $f$ is weakly
negative.
 First, if
$f$ is weakly negative. Let $s_0$ be the assignment defined by
$\displaystyle s_0=\bigcap_{s \ satisfies\  f} s$. Following
Lemma~\ref{weak-character}
$s_0$ satisfies $f$. According to Lemma~\ref{affine-character} there exist two
assignments $s_1$, $s_2$ that satisfy $f$ such that
$f(s_0\oplus s_1 \oplus s_2)= 0$.
By definition of $s_0$  our
situtation is summarized by the following table.
$$
\begin{array}{clllllc}
 ~~~&~ & ~ & ~ & ~  & ~  & ~~f() \\
s_0 & 00 ... 0 & 00...0 & 00...0 & 00...0  & 11...1 & 0\\
s_1 & 00 ... 0 & 00...0 & 11...1 & 11...1 & 11...1 & 1\\
s_2 & 00 ... 0 & 11...1 & 00...0 & 11...1& 11...1  & 1\\
s_1\oplus s_2 & 00 ... 0 & 11...1 & 11...1 & 00...0 & 11...1 & 1 \\
 ~& 00...0 & xx...x & yy...y & zz...z & 11...1  & ~~~
\end{array}
$$
Thus forcing the variables to $0, x, y, z$ or $1$ as described in
the last row, we get a function $h$ with
 $h(000) = h(011) = h(101) = 1$
and $h(110) = 0$. (Notice that forcing variables to $0$ or $1$ is feasible
since both the constraints $\F$ and $\T$ are available.)
Applying
Claim~\ref{clm:table}
we find that  in this case $\{h,\F, \T \}$ implements one of $\bor_1$ or
$\bor_2$ strictly,
perfectly and faithfully.

Next we consider the case when $f$ is neither  $0$-valid nor weakly negative.
Following Lemma \ref{non_weak+_non_weak-} $\{f,\F,\T\}$ implements at least one
of $\bor_0$ or
$\myxor$  strictly, perfectly and faithfully.
 In the first  case, we are done, so we consider the second.

At this stage it suffices to show
that $\{f,\myxor,\F, \T\}$ implement one of the
three functions $\bor_0$, $\bor_1$ or $\bor_2$, for a non-affine function
$f$. Using Lemma~\ref{affine-character} we know there exist
assignments $s_1,s_2,s_3$ satisfying $f$ such that $s_1 \oplus
s_2 \oplus s_3$ does not satisfy $f$. The situation is summarized
below.
$$
\begin{array}{cllllllllc}
 ~~~&~ & ~ & ~ & ~ & ~& ~ & ~ & ~ & ~~f() \\
s_1 & 00 ... 0 & 00...0 & 00...0 & 00...0 & 11...1 & 11...1 & 11...1 &
11...1 &        1\\
s_2 & 00 ... 0 & 00...0 & 11...1 & 11...1 & 00...0 & 00...0 & 11...1 &11...1
& 1\\
s_3 & 00 ... 0 & 11...1 & 00...0 & 11...1 & 00...0 & 11...1 & 00...0 &11...1
& 1\\
s_1\oplus s_2 \oplus s_3  & 00 ... 0 & 11...1 & 11...1 & 00...0 & 11...1 &
00...0 & 00...0 &       11...1
& 0\\
 ~& 00...0 & xx...x & yy...y & zz...z & \barZ\barZ ... \barZ& \barY\barY ...
\barY & \barX\barX ... \barX &11 ... 1 & ~~~
\end{array}
$$
Thus creating a 6-ary function $h(x,y,z,\barX,\barY,\barZ)$ using
the usual substitutions; and then adding the constraints
$\myxor(x,\barX)$, $\myxor(y,\barY)$, and $\myxor(z,\barZ)$,
we get a perfect, strict and faithful implementation
of a function $h'$ with
$h'(000) = h'(011) = h'(101) = 1$ and $h'(110) = 0$. Once again
applying Claim~\ref{clm:table} we find that $\{h',\F, \T\}$ implements
one of the functions $\bor_1$ or $\bor_2$ strictly,
perfectly and faithfully.
\end{proof}

To conclude the proof of Lemma~\ref{lem:imp-non-affine}, we
still need the following claim.

\begin{claim}
\label{clm:table}
Let $h$ be a ternary function with $h(000) = h(011) = h(101) = 1$ and $h(110) =
0$. Then
 $\{h,\F\}$ implements
$\bor_1$ or $\bor_2$ strictly,
perfectly and faithfully.
\end{claim}

\begin{proof}
Let $A=h(001)$, $B=h(010)$, $C=h(100)$ and $D=h(111)$ be the undetermined
values of $h$. The following analysis shows that for every possible values of
$A$, $B$, $C$ and $D$ we can implement either $\bor_1$ or $\bor_2$ strictly,
perfectly and faithfully.

If $B=0$ and $D=1$, $h(x,y,x)= (x\vee\bar y)$.

If $B=1$ and $D=0$, $h(x,y,x)= (\bar x\vee\bar y)$.

If $C=0$ and $D=1$, $h(x,y,y)= (\bar x\vee y)$.

If $C=1$ and $D=0$, $h(x,y,y)= (\bar x\vee \bar y)$.


If $B=C=1$, $h(x,y,z)\wedge \F(z)= (\bar x\vee\bar y)\wedge \F(z)$.

If $B=C=D=0$ and $A=0$, $h(x,y,z)=\exists ! x \hbox{ s. t. } (\bar y\vee z).$

If $B=C=D=0$ and $A=1$, $h(x,y,z)\wedge \F(x)=(\bar y\vee z)\wedge\F(x) .$
\end{proof}

\iffalse
\begin{lemma}
{\rm \cite{CreignouHr-96}}
 If $g$ is weakly positive, weakly negative but non-affine, then $\{g,\T,\F\}$
can faithfully implement  the function $\bor_1$.
\label{implicative non_affine}
\end{lemma}

\begin{lemma}
{\rm \cite{ KhannaSW-96}}
 If $g$ is non-affine, then $\{g,\xor,\T,\F\}$
can  implement either the function  $\bor_0$, $\bor_1$ or
$\bor_2$ strictly, perfectly and
faithfully.
\label{0valid-1valid-xor non_affine}
\label{xor non_affine}
\end{lemma}
\begin{proof}
Since $g$ is non-affine, we essentially have the following situation for
three satisfying assignments $s_1,s_2$ and $s_3$ for $g$ (see Lemma
\ref{affine-character}).
$$
\begin{array}{cllllllllc}
 ~~~&~ & ~ & ~ & ~ & ~& ~ & ~ & ~ & ~~g() \\
s_1 & 00 ... 0 & 00...0 & 00...0 & 00...0 & 11...1 & 11...1 & 11...1 &
11...1 &        1\\
s_2 & 00 ... 0 & 00...0 & 11...1 & 11...1 & 00...0 & 00...0 & 11...1 &11...1
& 1\\
s_3 & 00 ... 0 & 11...1 & 00...0 & 11...1 & 00...0 & 11...1 & 00...0 &11...1
& 1\\
s_1\oplus s_2 \oplus s_3  & 00 ... 0 & 11...1 & 11...1 & 00...0 & 11...1 &
00...0 & 00...0 &       11...1
& 0\\
 ~& 00...0 & xx...x & yy...y & zz...z & \barZ\barZ ... \barZ& \barY\barY ...
\barY & \barX\barX ... \barX &11 ... 1 & ~~~
\end{array}
$$

Fixing the above variables to 0's and 1's as shown in the last row,
and assigning replicated copies of three variables $x,y$ and $z$ (and
their negations using $\xor$), we get a constraint $h(x,y,z)$ with the
truth-table in Figure \ref{fig:table1}. (observe that $0$ can be replaced
by a new variable $u$, then it suffices to add the constraint $\F(u)$, the
same stands for $1$ in using $\T$).


\begin{figure}[ptbh]
\vspace{-0.09in}
  \begin{center}
    \leavevmode
%    \epsfxsize=1.5in
     \epsfysize=1in
    \epsffile{table1.eps}
  \end{center}
  \caption{Truth-table of the constraint $h(x,y,z)$}
  \label{fig:table1}
\end{figure}

The undetermined values in the table are indicated by the parameters
$A,B,C$ and $D$. The following analysis shows that for every possible
value of these parameters, we can indeed strictly,perfectly and faithfully
implement an OR constraint
using
the constants 0 and 1.

$$
\begin{array}{rcl}

A = 0, B=1 & \LRA & h(0,y,z) = \bar y \vee z\\
A = 0, B=0, C=1 & \LRA & h(x,0,z) = x \vee  \bar{z}\\
A = 0, B=0, C=0, D=0 & \LRA & \exists x h(y,z)=\exists ! x h(y,z) = y \vee
\bar{z}\\
A = 0, B=0, C=0, D=1 & \LRA & h(x,y,1) = x \vee y\\
A = 1, B=0 & \LRA & h(0,y,z) = \bar{y} \vee  z\\
A = 1, B=1, C=0 & \LRA & h(x,0,z) = x \vee  \bar{z}\\
A = 1, B=1, C=1, D=0 & \LRA & h(x,y,1) = \bar{x} \vee  \bar{z}\\
A = 1, B=1, C=1, D=1 & \LRA & h(1,y,z) = y \vee  \bar{z}
\end{array}
$$
\end{proof}

\begin{lemma}
{\rm \cite{CreignouHr-96}}

 If $g$ is not affine, then $\{g,T,F\}$
can faithfully implement either the function $\bor_0$, $\bor_1$ or
$\bor_2$.
\label{non_affine}
\end{lemma}
\begin{proof}
 If $g$ is weakly positive and weakly negative then we are done by Lemma
\ref{implicative non_affine}. Else, if for instance $g$ is not weakly
positive then $\{g,\T,\F\}$ can implement either the function   $\bor_2$
or $\xor$ (see Lemma \ref{non_weak+_non_weak-}). In the first case we are
done. Otherwise,
$\{g,\T,\F\}$ can implement  the function    $\xor$ and the lemma is proved
according to Lemma \ref{xor non_affine}.
\end{proof}


\begin{lemma}
{\rm \cite{ KhannaSW-96}}

(i) If $g$ is $0$-valid and  non-affine, then $\{g,\F\}$
can  implement either the function $\bor_0$, $\bor_1$ or
$\bor_2$ strictly, perfectly and
faithfully.

 (ii) If $g$ is $1$-valid and  non-affine, then $\{g,\T\}$
can  implement either the function $\bor_0$, $\bor_1$ or
$\bor_2$ strictly, perfectly and
faithfully.

\label{0valid-1valid-xor non_affine}

\end{lemma}
\begin{proof}
Creignou and Hermann~\cite{CreignouHr-96}
showed that if $g$ is a 0-valid non-affine constraint,
then there exist two satisfying assignments $s_1$ and $s_2$ such that
$s_1 \oplus s_2$ is not a satisfying assignment for $g$ (see Lemma
\ref{affine-character}) . Using this
fact and the fact that $g$ is 0-valid, we essentially have the
following situation:

$$
\begin{array}{cllllc}
 ~~~&~ & ~ & ~ & ~  & ~~g() \\
 ~~ & 00 ... 0 & 00...0 & 00...0 & 00...0  & 1\\
s_1 & 00 ... 0 & 00...0 & 11...1 & 11...1 & 1\\
s_2 & 00 ... 0 & 11...1 & 00...0 & 11...1 & 1\\
s_1\oplus s_2 & 00 ... 0 & 11...1 & 11...1 & 00...0 & 0 \\
 ~& 00...0 & xx...x & yy...y & zz...z & ~~~
\end{array}
$$

Fixing the above variables to 0's as shown in the last row, and
assigning replicated copies of three variables $x,y$ and $z$, we get a
constraint $h(x,y,z)$ with the truth-table in Figure \ref{fig:table1}.
The lemma now follows using an analysis identical to the one used in
Lemma~\ref{xor non_affine}.
\end{proof}

\fi


\subsection{Non Bijunctive Functions}

\begin{lemma}
{\rm \cite{Schaefer-78}}
For any $i \in \{0,1,2\}$, $\{\bor_i, \xor\}$ can perfectly implement each of
$\bor_0$,  $\bor_1$ and $\bor_2$.
\label{or_xor}
\end{lemma}
\begin{proof}
We consider the case $i=0$; the other cases are analogous.
The constraint set
$\{\bor_0(x',y), \xor(x',x) \}$ perfectly implements the constraint
$\bor_1(x,y)$, while the constraint $\bor_2(x,y)$ is perfectly implemented
by the
constraint set


\noindent $\{\bor_0(x',y'), \xor(x',x), \xor(y',y) \}$.
\end{proof}


\begin{lemma}{\rm \cite{Schaefer-78}}
If $f$ is not bijunctive, then $\{f,\F, \T,\bor_0,\bor_1,\bor_2\}$
can perfectly implement the function $\oneinthree$.
\label{not_bijunctive}
\end{lemma}
\begin{proof}
If $f$ is not bijunctive, then in the CNF representation of $f$, there
must be a maxterm $m$ with at least three literals. Without loss of
generality, let us assume that $m = (x \vee y \vee z \vee ...)$. Using the
functions $\F$ and $\T$, we can force all the remaining literals in $m$
to false,
and existentially quantifying over the remaining variables gives us a
function $f'$ with a maxterm $m' = (x\vee y\vee z)$. By the definition of
maxterm,
$f'$ must be satisfiable by any assignment which sets exactly one of the
$x,y$ and $z$ to true.

Now consider the constraints $\{f'(x,y,z), \bor_2(x,y), \bor_2(y,z),
\bor_2(x,z) \}$.
Clearly, all constraints are satisfied if and only if exactly one of
the $x,y$ and $z$ are set to true. This completes the proof.
\end{proof}

\subsection{Affine functions not of width 2}

\begin{lemma}
\label{lem:char-affine3}
If $f$ is an affine function which is not of width-$2$ then
$f$ strictly  and perfectly implements $\myxnor_4$.
\end{lemma}

\begin{proof}
Let $k$ be the arity of $f$.
Recall the notion of a dependent set of variables. A set $S$
of variables is dependent if not every
assignment to the variables in $S$ extends to a satisfying
assignment of $f$. A dependent set $S$ is minimally dependent set
if no strict subset $S' \subset S$ is a dependent set. Notice
that $f$ can be expressed as the conjunction of constraints
on its minimally dependent sets. Thus, following Lemma \ref{char w2a}
if $f$ is not of width-2
then it must have a minimally dependent set $S$ of cardinality
at least $3$. Assume $S = \{1,\ldots,p\}$, where $p \geq 3$.
Consider the function
$$f_1(x_1\ldots x_p) = \exists x_{p+1},\ldots,x_k
\mbox{ s.t. } f(x_1,\ldots x_k).$$
$f_1$ is affine (by Lemma~\ref{lem:char-horn}),
is not satisfied by every assignment
and has at least $2^{p-1}$ satisfying assignments. Thus $f_1$ has
exactly $2^{p-1}$ assignments (since the number of satisfying assignments
must be a power of $2$). Thus $f_1$ is described by exactly one
linear constraint and by the minimality of $S$ this must be
the constraint $\myxor_p(x_1\ldots x_p)$ or
the constraint $\myxnor_p(x_1\ldots x_p)$.
Now setting $x_4 = x_5 = \cdots = x_p$, we get an implementation of
one of the
constraints
$\myxor_3(x_1,x_2,x_3)$,
$\myxor_4(x_1,x_2,x_3,x_4)$,
$\myxnor_3(x_1,x_2,x_3)$, or
$\myxnor_4(x_1,x_2,x_3,x_4)$.

We conclude by showing that in any of the first 3 cases, we
can implement the constraint $\myxnor_4$. Notice that
$\myxor_3(x_1,x_2,y)$ and $\myxor_3(y,x_3,x_4)$ give a strict
and perfect implementation of
$\myxnor_4(x_1,x_2,x_3,x_4)$.
Similarly
$\myxnor_3(x_1,x_2,y)$ and $\myxnor_3(y,x_3,x_4)$ also give a strict
and perfect implementation of
$\myxnor_4(x_1,x_2,x_3,x_4)$.
Finally,
$\myxor_4(x_1,x_2,y,z)$ and $\myxor_4(y,z,x_3,x_4)$ give a strict
and perfect implementation of
$\myxnor_4(x_1,x_2,x_3,x_4)$.
Thus in all cases we may implement $\myxnor_4$ strictly and
perfectly.
\end{proof}

\iffalse
\begin{lemma}
\label{lem:char-affine3}
If $f$ is an affine function which is not of width-2 then
$f$ implements either the function $\myxor_p$ of $\myxnor_p$
for some $k \geq 3$.
\end{lemma}

\begin{proof}
Let $k$ be the arity of $f$.
Define a dependent set of variables to be a set
of variables $S \subseteq \{1,\ldots,k\}$ such that not every
assignment to the variables in $S$ extends to a satisfying
assignment of $f$. A dependent set $S$ is minimally dependent set
if no strict subset $S' \subset S$ is a dependent set. Notice
that $f$ can be expressed as the conjunction of constraints
on its minimally dependent sets. Thus if $f$ is not of width-2
then it must have a minimally dependent set $S$ of cardinality
at least $3$. Assume $S = \{1,\ldots,p\}$, where $p \geq 3$.
Consider the
function
$$f_1(x_1\ldots x_p) = \exists x_{p+1},\ldots,x_k
\mbox{ s.t. } f(x_1,\ldots x_k).$$
$f_1$ is affine (by Lemma~\ref{lem:char-horn}),
is not satisfied by every assignment
and has at least $2^{p-1}$ satisfying assignments. Thus $f_1$ has
exactly $2^{p-1}$ assignments (since the number of satisfying assignments
must be a power of $2$). Thus $f_1$ is desribed by exactly one
linear constraint and by the minimality of $S$ this must be
the constraint $\myxor(x_1\ldots x_p)$ or
the constraint $\myxnor(x_1\ldots x_p)$.
\end{proof}
\fi

\subsection{Non 2-monotone Functions}

\begin{lemma}
For any $f \in \{x \vee  y, x\wedge\bar{y}, \bar{x} \vee  \bar{y}\}$,
$\{f,\F, \T\}$ strictly implements the $\xor$ constraint.
\label{L4}
\end{lemma}
\noindent
\begin{proof}
If $f = x \vee  y$, then the instance $\{ f(x,y), f(y,x), \F(x), \F(y) \}$
is a strict $3$-implementation of $x \oplus y$; if $f = x\wedge\bar{y}$,
then the
instance
$\{ f(x,y), f(y,x) \}$ is a strict $1$-implementation of $x \oplus y$;
and
finally, if
$f = \bar{x} \vee  \bar{y}$, then $\{ f(x,y), f(y,x), \T(x), \T(y) \}$
is a strict $3$-implementation of $x \oplus y$.
\end{proof}



%\begin{lemma}
%{\rm \cite{KhannaS-96}}
%Let $f$ be a function which is not $2$-monotone.
%Then $\{f,T,F\}$
%can strictly implement either the $\xor$ or the $\rep$ function.
%\label{constant_to_replication}
%\end{lemma}
%\begin{proof}
%Since $f$ is not 2-monotone and non-trivial, it must be sensitive to
%at least
%two
%variables.
%Consider the boolean $k$-cube with each vertex $s$ labeled by the
%function
%value
%$f(s)$; where $k$ is the
%arity of constraint $f$. Let $V_i$ denote the set of vertices labeled
%$i$, $i
%\in
%\{0,1\}$. If
%$|V_i| \leq |V_{1-i}|$, we claim that it must be the case that there
%exists a
%vertex in $V_i$ which has at least two neighbors in $V_{1-i}$. This is
%readily
%seen using the expansion properties of the $k$-cube; any set $S$
%of at most $2^{k-1}$
%vertices must have expansion factor at least one. Furthermore, the
%expansion
%factor is precisely one only when the set $S$ induces a boolean
%$(k-1)$-cube.
%But the latter case cannot arise since it would imply that $f$ is a
%single
%variable
%constraint. Hence there must exist a vertex $s \in V_i$ which has two
%neighbors
%in
%$V_{1-i}$.
%
%Let $s_i$ and $s_j$ be these two neighbors of $s$, differing in the
%$i_{th}$ and the $j_{th}$ bit position respectively.
%Without loss of generality, we may assume that $i=1$ and $j=2$.
%Consider now the input instance which has a constraint of the form
% $f(x_1,x_2,y_3,y_4,...,y_{k})$ and constraints of the form $T(y_i)$
%for
%each $i$
%in $O(s) -\{1,2\}$ and of the form $F(y_i)$ for each
%$i$ in $Z(s) - \{1,2\}$. It is now easy to verify
%that this set of constraints strictly implements one of the constraints
%$x_1 \oplus x_2$,
%$\overline{x_1 \oplus x_2}$,
%$x_1\vee x_2$,
%$\bar{x_1} \vee  \bar{x_2}$ or
%$\bar{x_1} \vee  x_2$.
%The first two are the constraints XOR and REP respectively.
%By Lemma~\ref{L4}, either of the constraints $x_1 \vee  x_2$
%or $\bar{x_1} \vee  \bar{x_2}$ along with $\{T,F\}$ strictly
%implement XOR. Otherwise, it is easy to verify that
%the family $\{\bar{x_1} \vee  x_2, T, F \}$ strictly implements REP.
%\end{proof}



\begin{lemma}
{\rm \cite{KhannaS-96}}
%{\rm [Hardness Lemma]}
For any function $f$ which is not $2$-monotone,
$\{f,\F, \T\}$ can strictly implement the function $\xor$.
\label{2-monotone-hard}
\end{lemma}
\begin{proof}
We prove this by using the Lemma~\ref{2-monotone-character} for
2-monotone constraints. Let $k$ denote the arity of $f$.
If $f$ is not 2-monotone, it must violate one of the three
conditions $(a),~(b)$ and $(c)$ stated in the
Lemma~\ref{2-monotone-character}.

Suppose $f$ violates the property (a) of
Lemma~\ref{2-monotone-character}.
Then for some satisfying
assignment $s$, there exist two assignments $s_0$ and $s_1$ such that
$Z(s)
\subset Z(s_0)$ and $O(s) \subset O(s_1)$, but $f(s_0) = f(s_1) = 0$.
Without loss of generality, we assume that $s = 0^p 1^q$, $s_0 =
0^{p+a}
1^{q-a}$ and $s_1 = 0^{p-b} 1^{q+b}$, where $p+q = k$. Thus we have
the
following
situation :

$$
\begin{array}{lllllc}
 ~ & ~ & ~& ~ & ~ &~~f() \\
s & \overbrace{00...0}^{p-a} & \overbrace{00...0}^{a} &
\overbrace{11...1}^{b}
&
\overbrace{11...1}^{q-b} & ~~~1\\
s_{0} & 00...0 & 00...0 & 00...0 & 11...1 & ~~~0\\
s_{1} & 00...0 & 11...1 & 11...1 & 11...1 & ~~~0\\
s_{2} & 00...0 & 11...1 & 00...0 & 11...1 & \_\\
 ~ & 00...0 & xx...x & yy...y & 11...1 & \_\\
\end{array}
$$


Observe that both $a$ and $b$ are non-zero.
Fixing the above variables to $0$ and $1$  as shown in the last row and
assigning the variables $x$ and $y$ we get a constraint $h(x,y)$.
%Consider the following set of constraints
%on variables $x_1,x_2,...,x_k$ :
%
%\begin{itemize}
%
%\item
%constraints $F(x_i)$ for $1 \leq i \leq (p-a)$,
%
%\item
%constraints $\rep(x_{p-a+1},x_{p-a+i})$ for $2 \leq i \leq a$,
%
%\item
%constraints $\rep(x_{p+1},x_{p+i})$ for $2 \leq i \leq b$,
%
%\item
%constraints $T(x_i)$ for $(p+a+b+1) \leq i \leq k$, and
%
%\item
%the constraint $f(x_1,x_2,...,x_k)$.
%
%\end{itemize}
%
%Let $s_2$ be the assignment as defined in the preceding table.
%It is easy to verify that for $\alpha=(k-1)$,
%this is a strict
%implementation of the constraint $x_{p-a+1} \oplus x_{p+1}$ if $f(s_2) =
%1$ and the constraint $x_{p-a+1} \overline{x_{p+1}}$, otherwise.
%The claim now follows immediately from Lemma~\ref{L4}.


Let $s_2$ be the assignment as defined in the preceding table.
It is easy to verify that this is a strict
implementation of the constraint $x \oplus y$ if $f(s_2) =
1$ and the constraint $x \wedge \bar {y}$, otherwise.
The claim now follows immediately from Lemma~\ref{L4}.

Next suppose $f$ violates the property (b) of
Lemma~\ref{2-monotone-character}.
Then there exists an unsatisfying assignment $s$ to $f$ satisfying
$V_1 \cap
V_2 \subset O(s)$. Notice that $O(s)$ cannot contain $V_1$ or $V_2$
(since
$V_1$
and $V_2$ are $1$-consistent for $f$).
Thus $s$ sets all variables in
$V_1 \cap V_2$ to 1, and
at least one variable in each of
$V_1 \setminus (V_1 \cap V_2)$
and $V_2 \setminus (V_1 \cap V_2)$ to 0. Consider one such
unsatisfying
assignment $s$. Without loss of generality, we have the following
situation :

$$
\begin{array}{ll}
 ~~~ & \overbrace{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}^{V_1}\\
s & \underbrace{\overbrace{00...0}^{V_1 \setminus O(s)}}_{p}~~
\underbrace{11...1}_{q}
 ~~\overbrace{\underbrace{\overbrace{11...1}^{V_1 \cap
V_2}}_{r}~~
\underbrace{11...1}_{t} ~~
\overbrace{\underbrace{{00...0}}_{u}}^{V_2 \setminus O(s)}}^{V_2} ~~
\underbrace{00...0}_{v} \underbrace{{11...1}}_{w} \\
 ~~~ & xx..x~~11..1~~11..1~~11..1~~yy..y~~00..0~~11..1\\
\end{array}
$$

Fixing the above variables to $0$ and $1$  as shown in the last row and
assigning the variables $x$ and $y$ we get a constraint $h(x,y)$. It is now
easy to verify that this is a strict
$\alpha$-implementation of the constraint $x \vee  y$.
Again, the claim now follows immediately from Lemma~\ref{L4}.
%
%
%Consider the following set of
%constraints on variables $x_1,x_2,...,x_k$ :
%
%\begin{itemize}
%
%\item
%constraints $\rep(x_{1},x_{i})$ for $2 \leq i \leq p$,
%
%\item
%constraints $T(x_i)$ for $(p+1) \leq i \leq (p+q+r+t)$,
%
%\item
%constraints $\rep(x_{p+q+r+t+1},x_{p+q+r+t+i})$ for $2 \leq i \leq u$,
%
%\item
%constraints $F(x_i)$ for $(p+q+r+t+u+1) \leq i \leq (p+q+r+t+u+v)$,
%
%\item
%%and
%finally
%
%\item
%the constraint $f(x_1,x_2,...,x_k)$ where $k = (p+q+r+t+u+v+w)$.
%%
%\end{itemize}
%
%It is now easy to verify that for $\alpha=(k-1)$,
%this is a strict
%$\alpha$-implementation of the constraint $x_{1} \vee  x_{p+q+r+t+1}$.
%Again, the claim now follows immediately from Lemma~\ref{L4}.
%

Finally, the case in which $f$ violates the property $(c)$ above,
can be handled in an analogous manner.
\end{proof}



\begin{lemma}{\rm ~\cite{KhannaS-96}}
\label{non0-non1-non2monotone}
Let $f_0$ be a constraint that is not 0-valid, $f_1$ be a constraint that is
not 1-valid and $f_2$ be a constraint that is not $2$-monotone. Then
$\{f_0,f_1,f_2\}$
can strictly implement the function $\xor$.
\end{lemma}
\begin{proof}
If either $f_0$ or $f_1$ is $C$-closed then Lemma~\ref{non0_non1_Cclosed} gives
us a strict  implementation of the $\xor$ function. Otherwise, using
Lemma~\ref{non0_non1_nonC-closed}, we can strictly implement the functions $\F$
and $\T$. Now  the lemma follows from an application of
Lemma~\ref{2-monotone-hard}.
\end{proof}

\subsection{Miscellaneous}

\begin{definition}
A family $\calf'$ is said to be a basis for a family $\calf$
if every constraint in $\calf$ can be expressed as a conjunction
of constraints in $\calf'$.
\end{definition}

\begin{example}
The family $\{\T, \F,\bor_0, \bor_1,\bor_2\}$
is a basis for the family of bijunctive constraints.
\end{example}

\begin{proposition}
\label{prop:imp-basis}
If $\calf'$ is a basis of $\calf$, then $\calf'$ perfectly
(but not necessarily strictly or faithfully) implements every
constraint in $\calf$.
\end{proposition}

\begin{proof}
Let $f \in \calf$ be given by $f(x) = f_1(x) \wedge \ldots  \wedge
f_l(x)$, where $f_1,\ldots,f_l \in \calf'$.
Then the constraints $f_1(x), f_2(x),\ldots,f_l(x)$ give a
perfect $l$ implementation of $f$.
\end{proof}



\medskip




Let us introduce a new constraint $\sor_1$:
$$\sor_1(x,y,z)\equiv (F(x)\wedge \bor_1(y,z))\vee(T(x)\wedge \bor_1(z,y)).$$


\begin{lemma}\label{implication implementation}
Let ${\cal F}$ be a set of $0$-valid constraints. Suppose that ${\cal F}$
constains  a function $f_+$ which  is not weakly positive,
a function  $f_-$ which  is not weakly negative and  a function $g$ which
is not affine. If every constraint in ${\cal F}$ is $C$-closed then
 ${\cal F}$ can perfectly implement $\sor_1$. Otherwise
${\cal F}$ can perfectly implement $\bor_1$.
\end{lemma}


\begin{proof}
Let us first prove  that $\{f_+, f_-, g, \F\}$ can perfectly implement
$\bor_1$.
According to the characterization of affine $0$-valid functions (see Lemma
\ref{affine-character}) there are two assignments $s_1$ and $s_2$ such that
$g(s_1)=g(s_2)=1$ but $g(s_1\oplus s_2\oplus\vec 0)=g(s_1\oplus s_2)=0$.
The following table describes the situation:
$$
\begin{array}{cllllc}
 ~~~&~ & ~ & ~ & ~  & ~~g() \\
 ~~ & 00 ... 0 & 00...0 & 00...0 & 00...0  & 1\\
s_1 & 00 ... 0 & 00...0 & 11...1 & 11...1 & 1\\
s_2 & 00 ... 0 & 11...1 & 00...0 & 11...1 & 1\\
s_1\oplus s_2 & 00 ... 0 & 11...1 & 11...1 & 00...0 & 0 \\
 ~& 00...0 & xx...x & yy...y & zz...z & ~~~
\end{array}
$$
Fixing the above variables to 0's as shown in the last row, and
assigning replicated copies of three variables $x,y$ and $z$, we get a
constraint $h_0(x,y,z)$, such that $h_0(000) = h_0(011) = h_0(101) = 1$
and $h_0(110) = 0$. (Notice that forcing variables to $0$ is feasible
since the constraint $\F$ is available.)

Following the characterization of weakly negative functions (see
Lemma~\ref{weak-character})
 there are two assignments $s'_1$ and $s'_2$ such that
$f_-(s'_1)=f_-(s'_2)=1$ but $f_-(s'_1\cap s'_2)=0$.
The following table describes the situation:
$$
\begin{array}{cllllc}
 ~~~&~ & ~ & ~ & ~  & ~~f_-() \\
 ~~ & 00 ... 0 & 00...0 & 00...0 & 00...0  & 1\\
s_1 & 00 ... 0 & 00...0 & 11...1 & 11...1 & 1\\
s_2 & 00 ... 0 & 11...1 & 00...0 & 11...1 & 1\\
s_1\cap s_2 & 00 ... 0 & 00...0 & 00...0 & 11...1 & 0 \\
 ~& 00...0 & xx...x & yy...y & zz...z & ~~~
\end{array}
$$
Fixing the above variables to 0's as shown in the last row, and
assigning replicated copies of three variables $x,y$ and $z$, we get a
constraint $h'_0(x,y,z)$, such that
$h'_0(0,0,0) = h'_0(0,1,1) = h'_0(1,0,1)=1$ and $h'_0(0,0,1)=0$.

In using a similar characterization of weakly positive constraints we can
 perfectly implement a constraint $h''_0(x,y,z)$ obtained from $f_+$ such that
$h''_0(0,0,0) = h''_0(0,1,1) = h''_0(1,0,1)=1$ but $h''_0(1,1,1)=0$.

Now let us denote by  $k_0(x,y,z)$ the following conjunction of constraint
applications :
$$h_0(x,y,z)\wedge h'_0(x,y,z)\wedge h''_0(x,y,z).$$
To conclude there are several cases to  analyze.
\begin{itemize}
\item If $k_0(0,1,0)=1$ then $\{ h_0(x,y,z),  h'_0(x,y,z),  h''_0(x,y,z),
\F(x)\}$
is a perfect implementation of
  $y\vee\bar z$,
\item If $k_0(0,1,0)=0$ then $\{ h_0(x,y,z),  h'_0(x,y,z),
h''_0(x,y,z) \}$ is a perfect implementation of $\bar y\vee z$, with $x$ as
an auxiliary variable.
\end{itemize}
This proves that $\{f_+, f_-, g, \F\}$ can perfectly implement
$\bor_1$.\smallskip

If there is a constraint $h$ in ${\cal F}$ which is not $C$-closed, since
$h$ is $0$-valid $h$ can perfectly implement either the function $\bor_1$
or $\F$ (see Lemma \ref{non-C-closed}). In both cases ${\cal F}$ can
perfectly implement (directly or by composition) the function $\bor_1$.
Otherwise let us consider the set of  $\{f_+, f_-, g, \F\}$-constraint
applications that   implements $\bor_1$. Use $x_0$ in place of any variable
with the constraint $\F(y)$. In using the $C$-closed property of every
constraint it is easy to see that this set of constraint applications
perfectly implements the function $\sor_1$.
\end{proof}


%\include{dichotomy_thms}



\chapter{Classification Theorems for Decision, Counting and Quantified
Problems}
\label{Dichotomy Theorems for  Boolean Constraint Satisfaction Problems}


We now study the complexity of the decision, counting and the quantified
variants of the constraint satisfaction problems.
We will show that each of these classes exhibits a dichotomy
--- any problem in each of these classes is either ``easy'' or at least
as ``hard'' as any other problem in the corresponding class.
Such dichotomy results are a rare phenomenon in the study of complexity
theory. Our proof techniques build on the results of the preceding
chapter; we will show that our implementation lemmas give simple
proofs for these dichotomy theorems. While the dichotomy result for the
decision and counting problems were previously known, the dichotomy result
for the quantified constraint satisfaction problems is new.

\section{Preliminaries}

To reduce a problem $\sat({\cal F})$ ($\#\sat({\cal F})$) to a problem
$\sat({\cal F}')$ ($\#\sat({\cal F}')$),
we will often use $\sat({\cal F}' \cup\{\F, \T\})$ ($\#\sat({\cal F}'
\cup\{\F, \T\})$) as an intermediate
problem. We will show that for our purposes, the functions $\F$ and $\T$ can be
easily implemented provided the family ${\cal F}'$ is not $C$-closed.
However, it is not possible to do so when the family ${\cal F}'$ is
$C$-closed. In this particular case we will use the following lemma.

\begin{lemma}
\label{C-closed corollary}
Let ${\calF}$ be a set of $C$-closed constraints.
 If $\sat ({\cal F}\cup\{\F ,\T\}) $  is $\np$-hard  ($\p$-hard)  and if
$\calF$ can
perfectly  implement the $\xor$ function, then $\sat ({\cal
F})$   is $\np$-hard  ($\p$-hard).
If $\#\sat({\cal
F}\cup\{\F ,\T\})$ )  is $\#\p$-hard  and if $\calF$ can
faithfully  implement the $\xor$ function, then $\#\sat({\cal F})$  is
$\#\p$-hard.
\end{lemma}
\begin{proof}
First we show a log-space (counting)
reduction from $\sat(\calF\cup\{\F ,\T\})$  ($\#\sat(\calF\cup\{\F ,\T\})$)
to $\sat(\calF\cup\{\xor\})$ ( $\#\sat(\calF\cup\{\xor\})$). It
suffices to use two new variables
$x_0$
and
$x_1$, that will simulate the role of functions
$\F$ and
$\T$.
Let $\CC$ be an
$\calF\cup\{\F ,\T\}$-collection of constraint applications  on variables
$\vec x$.  We use the variable  $x_0$ in place of any variable  $y$ with
the
constraint
$\F(y)$ and the variable $x_1$  in place of any variable  $z$ with the
constraint
$\T(z)$. Next we add the constraint $\xor(x_0,x_1)$. We get  $\CC '$ an
$\calF\cup\{\xor\}$-collection of constraint applications  on variables
$\vec x, x_0, x_1$. Let $s$ be an assignment to $\vec x$ that satisfies all
constraints in $\CC$. Extending $s$ by $s(x_0)=0$ and $s(x_1)=1$ yields a
satisfying assignment for $\CC'$. Conversely, let $s'$ be an assignment to
$\vec x\cup x_0\cup x_1$ that satisfies all
constraints in $\CC'$. If $s'(x_0)=0$ and $s'(x_1)=1$ then $s'$ restricted
to
$\vec x$  satisfies  $\CC$. Otherwise, $s'(x_0)=1$ and $s'(x_1)=0$. Then,
in
using the $C$-closed property of every  function in $\calF$ it is easy to
verify that the assignment $s(x)=1-s'(x)$ satisfies all
constraints in $\CC$. At this stage we can conclude that
$\sat(\calF\cup\{\xor\})$ is $\np$-hard ($\p$-hard). Moreover,  the
number of satisfying assignments for
$\CC'$ is equal to twice the number of satisfying assignments for $\CC$.
Hence the proposed reduction is a counting reduction, thus proving the
$\#\p$-hardness of
$\#\sat(\calF\cup\{\xor\})$.
Finally, if $\calF$ can perfectly (faithfully) implement the $\xor$
function
then we can conclude by using Lemma \ref{nphard} (Lemma
\ref{sharp_phard} ).
\end{proof}


\section{The Class $\sat$}

Decision version of our constraint satisfaction problems were studied
by Schaefer~\cite{Schaefer-78}. Schaefer referred to these
problems as the {\em generalized satisfiability problems} and he showed the
following dichotomy theorem: each satisfiability problem is either
in $\p$ or is NP-complete. Moreover, he identified a concise
characterization that separates the easy problems from the hard ones.

\begin{theorem}~{\rm \cite{Schaefer-78}}
\label{satisfiability_theorem}
Given a constraint set ${\cal F}$, the problem
$\sat({\cal F})$ is in $\p$ if ${\cal F}$ satisfies one of the
conditions below, and $\sat({\cal F})$ is $\np$-complete, otherwise.
\begin{enumerate}

\item  ${\cal F}$ is $0$-valid \lb $1$-valid \rb.

\item  ${\cal F}$ is weakly positive \lb weakly negative
\rb.

\item  ${\cal F}$ is affine.

\item  ${\cal F}$ is bijunctive.
\end{enumerate}

\end{theorem}


We now establish Schaefer's result. Our proof relies on the following key
lemma.


\begin{lemma}\label{hardness lemma}
{\rm [Hardness Lemma for Satisfiability]}
Let $\calF$ be any collection of constraints that contains :

\begin{itemize}

\item
a constraint $f_+ \in \calF$ such that $f_+$ is not weakly
positive.

\item
a constraint $f_- \in \calF$ such that $f_-$ is not weakly
negative.

\item
a constraint $f_a$ such that $f_a$ is not affine.

\item
a constraint $f_b$ such that $f_b$ is not bijunctive.

\end{itemize}
Then $\calF \cup \{\F,\T\}$ can perfectly implement the constraint
$\oneinthree$.

\end{lemma}
\begin{proof}
We first use the family $\{f_+,f_-,\F,\T \}$ to perfectly implement
the $\xor$ function (Lemma~\ref{non_weak+_non_weak-}) and
the family $\{f_a, \F\}$ to perfectly implement one of
the functions $\bor_0$, $\bor_1$ or $\bor_2$ (Lemma~\ref{non_affine}).
By Lemma~\ref{or_xor} we know that the family $\{ \bor_i, \xor \}$ for any
$\i \in \{0,1,2\}$ can perfectly implement each of the
functions $\bor_0$, $\bor_1$ and $\bor_2$. Finally, we use
family $\{f_b, \bor_0, \bor_1,\bor_2 \}$ to perfectly implement
the function $\oneinthree$ (Lemma~\ref{not_bijunctive}).
\end{proof}






\begin{lemma}\label{oneinthreehard}
{\rm \cite{Schaefer-78}}
$\sat(\{\oneinthree\})$ is $\np$-hard.
\end{lemma}
\begin{proof}
See Example \ref{oneinthree completeness}.
\end{proof}
\medskip

\begin{newproof}{Theorem \ref{satisfiability_theorem}}
The $\sat({\cal F})$ problem is easily seen to be in $\np$.
The polynomial time solvable cases are classical. If every constraint is
$0$-valid ($1$-valid) then every set of constraint applications is completely
satisfiable by the trivial all false (true) assignment.
If every constraint is weakly negative
then every set of constraint
applications can be seen as a Horn formula, whose satisfiability can be
decided in linear time (see \cite{DowlingG-84})
( the case  weakly positive can be treated similarly).
If every constraint is
bijunctive then every set of constraint applications can be seen as a
$2$CNF formula, whose satisfiability can be decided in linear time (see
\cite{AspvallPT-79}).  If every constraint is affine then every set of
constraint applications can be seen as a linear system of equations over
the finite field $\gf(2)$. Thus its satisfiability can be decided in
polynomial time using Gaussian elimination.\medskip

On the other hand,
suppose that ${\cal F}$ does not satisfy any of the above conditions.
Then ${\cal F} \cup \{\F, \T \}$  perfectly implements the
$\np$-hard constraint $\oneinthree$ (Lemma~\ref{hardness lemma} and
Lemma \ref{oneinthreehard}). Therefore, by Lemma  \ref{nphard}
 $\sat(\calF\cup\{\F, \T\})$ is $\np$-hard.
Now if ${\cal
F}$ contains a function
$h$ which is not
$C$-closed, we can perfectly implement the functions $\F$ and $\T$
(Lemma~\ref{non0-non1-nonC-closed}).
Using Lemma \ref{nphard}
we get $\np$-hardness for $\sat({\cal F})$ in this case.
Otherwise, $\calF$ is $C$-closed. By
Lemma~\ref{non0_non1}, we can perfectly implement the
$\xor$ function and conclude the $\np$-hardness result by
using Lemma \ref{C-closed corollary}.
\end{newproof}
\medskip
This complexity classification can be refined in terms of parallel computation.
The following theorem characterizes the parallel complexity of finding a
satisfying truth assigment of an $\calF$-collection of constraint applications
for every constraint set $\calF$ such that the   problem $\Sat (\calF)$ is
in P.


\begin{theorem}\label{decision theorem}
Let $\calF$ be a constraint set such that $\Sat (\calF)$ is in $\p$.
If $\calF$ satisfies one of the following conditions then $\Sat (\calF)$ is in
$\nc$, otherwise $\Sat (\calF)$ is $\p$-complete.
\begin{enumerate}
\item $\calF$ is $0$-valid (resp. $1$-valid).
\item  $\calF$  is affine.
\item $\calF$  is bijunctive.
\item $\calF$ is \ihsbp (resp.  \ihsbn).
\end{enumerate}
\end{theorem}

\begin{proof}
If  every constraint in $\calF$ is $0$-valid (resp. $1$-Valid) then the
all-zero (resp. all-one) assignment trivially satisfies any $\calF$-collection
of constraint applications.

If every constraint in $\calF$ is bijunctive then the problem of finding a
 satisfying assignment to an $\calF$-collection of constraint applications  is
in $\ac^1$~\cite{CookL-87}, a subclass of $\nc ^2$.

If every constraint in $\calF$ is affine then this problem is equivalent to
find a solution of a linear system over the field  $GF(2)$. Therefore, it is
in
$\nc^2$~\cite{PanR-85}.

Finally, suppose that every constraint in $\calF$  is \ihsbp
(it is similar if every relation is \ihsbn). An
 $\calF$-collection of constraint applications
can be seen as a set ${\cal C}$ of clauses, ${\cal C} ={\cal P}\cup {\cal B}$
where ${\cal P}$ is a set of positive clauses and ${\cal B }$ a set of clauses
either of the form $(\bar x)$ or $(\bar x\vee y)$. One can use an  algorithm
similar in spirit to the one  proposed by
Cook and Luby~\cite{CookL-87}. A high level description of this algorithm
is as
follows.
{\sf
\begin{itemize}
  \item From the set of clauses ${\cal B}$, defined over a set of $n$
variables,
construct a digraph $G=(V,E)$. There is a vertex  in $V$ for each of the
$2n$ literals. The edges $E$ are formed from the clauses as follows. For
each clause $(\bar x)$ in ${\cal B}$ we add to $E$ the directed edge $x\ra \bar
x$, for each clause $(\bar x\vee y)$ in ${\cal B}$ we add to $E$ two directed
edges $x\ra y$ and $\bar y\ra \bar x$. (Observe that $G$ is acyclic for the set
of clauses  ${\cal B}$ is trivially satisfiable).

\item Let $A$ be the adjacency matrix for $G$, i.e. the rows and columns of $A$
are indexed by the literals and an entry in $A$ is $1$ if it corresponds to an
edge in $E$ and it is $0$ otherwise, with the exception that each diagonal
entry in $A$ is $1$.

\item Let $A'$ be the  matrix $A$ raised to the power $2n$ using the operations
$(\vee, \wedge)$ in place of $(+,.)$. There is a path from literal $l$ to
literal $l'$ in $G$ if and only if $A'_{ll'}=1$.

\item Let $F_0$ be the set of variables $x$ such that  $(\bar x)$ is a clause
in ${\cal B}$. For each $x$ in $F_0$ set $s_0(x)=0$.

\item  For each variable $y$, if there is an $x_0$ in  $F_0$ such that
$A'_{\bar x_0\bar y}=1$ then set $s_0(y)=0$, otherwise set $s_0(y)=1$



In this way one gets the generic assignment, $s_0$, for ${\cal B}$:
$\displaystyle s_0 =
\bigcup_{s\in
\Sat(\cal B)}s$.
   \item  Verify that $s_0$ satisfies ${\cal P}$.
\end{itemize}
}

It is easy to see that ${\cal C}$ is satisfiable iff $s_0$ satisfies ${\cal
P}$.
The resources required by the algorithm are dominated by the computation of
$A'$ (which can be done by squaring $A$ $\log (2n)$ times using the operations
$(\vee ,\wedge )$).  Hence, this problem is also in
$\nc$, thus completing the proof of the $\nc$ case of Theorem~\ref{decision
theorem}.\medskip

The P-complete case was stated by Schaefer
~\cite[Theorem 5.1, L3, page 224]{Schaefer-78}.
We will use   the following $\p$-completeness result:

\begin{proposition}{\rm ~\cite{Kasif-90}
(see also~\cite[A.6.3, page 168]{GreenlawHR-95}}\label{H-P-completeness})
$\sat(\{\bor_{3,2},\F,\T\})$  and $\sat(\{\bor_{3,1},\F,\T\})$ are
$\p$-complete.
\end{proposition}


Let $\calF$ be a constraint
set such that $\sat(\calF)$ is in $\p$ and such that $\calF$ does not satisfy
any condition of the theorem. According to Theorem~\ref{satisfiability_theorem}
 every constraint in $\calF$ is weakly negative (wealky positive) but at
least one of these functions is not \ihsbn  (\ihsbp). Hence,
$\calF\cup\{\F,\T\}$ perfectly implements the constraint $\bor_{3,2}$
($\bor_{3,1}$), see Lemma
\ref{WN non ISBN}. Therefore, by Proposition \ref{H-P-completeness} and
Lemma \ref{phard}, $\sat (\calF\cup\{\F,\T\})$ is $\p$-hard.

Now, since $\calF$ contains at least one non-0-valid constraint and
one non-1-valid constraint, $\calF$  can
perfectly implement either $\F$ and $\T$, or $\xor$
depending on whether   $\calF$ is $C$-closed
(Lemmas \ref{non0-non1-nonC-closed} and \ref{non-C-closed}). In either case
we conclude the $\p$-hardness result by using Lemma \ref{phard} or
Lemma \ref{C-closed corollary}.
\end{proof}



\section {The Class $\#\sat$ }

Counting version of our constraint satisfaction problems were studied by
Creignou and Hermann  \cite{CreignouHr-96}. As Schaefer they obtained a
dichotomy theorem ($\fp$/ $\#\p$-complete) and identified a concise
characterization that separates the easy counting problems from the hard ones.

\begin{theorem}~{\rm \cite{CreignouHr-96}}\label{sharp sat}
Given a constraint set ${\cal F}$, the problem $\#\sat({\cal F})$ is in
$\fp$ if ${\cal F}$ is an affine family of constraints,
and it is $\#\p$-complete, otherwise.
\end{theorem}

The proof of this theorem relies on the following  $\#\p$-completeness results.

\begin{lemma}~{\rm \cite{Valiant-79},
\cite{Linial-86}}\label{hardness-for-counting}
$\#\sat(\{\bor_0\})$,
$\#\sat(\{\bor_2\})$, and $\#\sat(\{\bor_1\})$ are $\#\p$-complete.
\end{lemma}

\begin{newproof}{Theorem \ref{sharp sat}}
The $\#\sat({\cal F})$ problem is easily seen to be in $\#\p$.
If every constraint in ${\cal F}$ is affine then an instance
of $\#\sat({\cal F})$  can be viewed as a system of linear equations
over $\gf(2)$. We can use Gaussian elimination to determine
the number of satisfying solutions in polynomial time.

On the other hand, suppose that $\calF$ contains a function $g$ which is not
affine. We will show that the problem $\#\sat({\cal F})$ is $\#\p$-hard. There
are three cases to distinguish.




\vspace*{-0.1in}
\noindent
\paragraph{$g$ is neither $0$-valid nor $1$-valid:}
In this case, the family $\{g,\F,\T\}$
can faithfully implement one of the functions $\bor_0$ , $\bor_1$ or
$\bor_2$ (Lemma~\ref{non_affine}). Hence, by Lemma  \ref{sharp_phard} and
Lemma \ref{hardness-for-counting} $\#\sat (\calF\cup\{\F,\T\})$ is $\#\p$-hard.

Now if
$\calF$ contains a function $h$ which is not $C$-closed, we
can faithfully implement the functions $\F$ and $\T$
(Lemma~\ref{non0_non1_nonC-closed}), and hence using Lemma  \ref{sharp_phard}
 we get $\#\p$-hardness for $\#\sat({\calF})$ in
this case.
Otherwise  $\calF$ is
$C$-closed. By  Lemma~\ref{non0-non1-C-closed} we  can faithfully implement the
  $\xor$ function and conclude the $\#\p$-hardness result by using Lemma
\ref{C-closed corollary}.



\vspace*{-0.1in}
\noindent
\paragraph{$g$ is $0$-valid but is not $1$-valid (or vice versa):}
In this case, $\{g,F\}$ can faithfully implement one of the functions
 $\bor_1$ or $\bor_2$ (Lemma~\ref{0valid-1valid-xor non_affine}).
Also, it is clear that $\{g\}$ can faithfully implement $\F$ since
$g$ is $0$-valid and not $1$-valid. Thus $\calF$ can faithfully
implement one of the
functions $\bor_1$ or $\bor_2$. Using Lemma  \ref{sharp_phard} and Lemma
\ref{hardness-for-counting} we get $\#\p$-hardness for $\#\sat({\cal F})$ in
this case.


\vspace*{-0.1in}
\noindent
\paragraph{$g$ is $0$-valid and $1$-valid:}
If $g$ is not $C$-closed then $\{g\}$ can faithfully implement  the
function $\bor_1$ (Lemma~\ref{non-C-closed}).
Otherwise, the family $\{g,F\}$ can faithfully implement one of the functions
 $\bor_1$, or $\bor_2$ (Lemma~\ref{0valid-1valid-xor non_affine}).
Now using as before the $C$-closed property  of $g$ it is easy to
see that this implies the existence of a counting reduction from
$\#\sat({\bor_1})$ or
$\#\sat({\bor_2})$  to $\#\sat(\{g\})$, thus establishing the $\#\p$-hardness
for $\#\sat({\cal F})$.
\end{newproof}
\medskip


It is interesting to compare the results of the two previous theorems. Now we
know exactly what are the polynomial-time solvable satisfiability problems
whose  counting counterparts are  $\#\p$-complete and we get that the
$\np$-completeness of a satisfiability decision problem implies the
$\#\p$-completeness of the corresponding counting problem.
\bigskip




Another closely related aspect of interest is that of
enumerating all the solutions.  Generating all configurations that satisfy a
given specification is a well-studied problem in combinatorics. In practice,
the enumeration problem may arise quite naturally, for instance when there
exist some additional complex conditions that are too difficult to be
incorporated directly into the constraints problem.

A {\em generating algorithm} is an algorithm that generates all configurations
that satisfy a given specification (e.g., all satisfying truth assignments of
a given formula) without duplicate. One has to be careful in defining the
notion of polynomial time for such algorithms. Indeed, in most interesting
problems the number of configurations to be generated is potentially
exponential  in the size of the input. For this reason Johnson, Yannakakis and
Papadimitriou  defined {\em polynomial-delay algorithms}.

\begin{definition}{\rm [Generating algorithm with polynomial delay]
\cite{JohnsonYP-88}}
A generating algorithm has polynomial delay if it generates the
configurations, one after the other, in such a way that the delay until the
first is output, and thereafter the delay between any two consecutive
configurations (and between the last configuration and the halting), is bounded
by a polynomial in the input size.
\end{definition}
\medskip

Creignou and H\'ebrard  refined Schaefer's result in identifying satisfiability
problems for which all the solutions can be generated with polynomial delay.


\begin{theorem}{\rm ~\cite{CreignouHb-96}}
\label{enumeration theorem}
Given a constraint set ${\cal F}$, the problem of generating
all models for any given $\calF$-collection of constraints has a
polynomial space, polynomial delay algorithm if ${\cal F}$ satisfies one of the
conditions below, and otherwise, no such algorithm
exists unless $\p$=$\np$.
\begin{enumerate}
 \item ${\cal F}$ is weakly positive \lb weakly
negative \rb.
 \item ${\cal F}$ is affine.
 \item ${\cal F}$ is bijunctive.
\end{enumerate}
\end{theorem}

\begin{proof}
Observe that if $\calF$ satisfies one of the three conditions above
then $\calF\cup\{\F, \T\}$ still satisfies this condition and
thus $\sat(\calF\cup\{\F, \T\})$ is in $\p$ by
Theorem~\ref{satisfiability_theorem}. We can then conclude that
there is a simple recursive
algorithm which enumerates all models of a given $\calF$-collection of
constraint applications (see ~\cite[Fact 7]{Valiant-79}).

Otherwise, denote by $\sat ^*(\calF)$ the variant of $\sat(\calF)$
in which the objective is to find a non-trivial satisfying Boolean
assignment, i.e. an assignment that is
different from $\vec 0$ and $\vec 1$. The following proposition entails
that there are satisfiability problems for which even though one satisfying
solution can be found trivially, the problem of finding a second one
is $\np$-hard.

\begin{proposition} \label{sat*}
Let  ${\cal F}$ be a constraint set.
 If ~ ${\cal F}$ contains a contraint $f_+$ which is not weakly positive,
a contraint $f_-$ which is not weakly negative,
a contraint $f_a$ which is not affine,
a contraint $f_b$ which is not bijunctive,
then  $\sat ^*(\calF)$ is $\np$-hard.
\end{proposition}

This proposition clearly completes the proof of Theorem \ref{enumeration
theorem}.
\end{proof}
\medskip

\begin{newproof}{Proposition \ref{sat*}}
First observe that if  $\calF$ contains a contraint $f_0$ which is not
$0$-valid and
a contraint $f_1$ which is not $1$-valid, then by Theorem
\ref{satisfiability_theorem}, $\sat (\calF)$ is $\np$-hard, and hence
$\sat ^*(\calF)$ is $\np$-hard as well.

Now suppose that every function in $\calF$ is $0$-valid (the case $1$-valid
can be treated similarly). In this case finding a first solution is
trivial. According to Theorem \ref{satisfiability_theorem}, $\sat (\calF
\cup\{\F,\T\})$ is $\np$-hard. Our proof consists of a reduction
from $\sat (\calF \cup\{\F,\T\})$ to $\sat ^*(\calF)$.
We transform any ($\calF\cup\{\F, \T\}$)-collection of constraint
applications $\CC$ to an $\calF$-collection of constraint applications $\CC'$
such
that $\CC'$ has a non-trivial satisfying assignment iff $\CC$ is
satisfiable. The main tool is Lemma \ref{implication implementation}
which shows that $\calF$ can perfectly implement either $\bor_1$
or $\sor_1$.
To do this transformation, we replace in $\CC$ any variable $y$ that
appears in a constraint $\F(y)$ by a variable $x_0$, and any variable $z$
that appears in a constraint $\T(z)$ by a variable $x_1$.
We now delete all constraint applications of the functions
$\F$ and $\T$.
Next, using Lemma~\ref{implication implementation},
we add  either the constraints $\bor_1(x_0,x_1)$,
$\bor_1(x_0,x)$ and $\bor_1(x,x_1)$, or the constraints  $\sor_1(x_0,x_1)$,
$\sor_1(x_0,x)$ and $\sor_1(x,x_1)$ for
every variable $x$. It is easy to verify that there exists a satisfying Boolean
assignment for $\CC$ iff there exists a satisfying Boolean assignment different
from $\vec 0$ and $\vec 1$ for $\CC'$, thus proving the $\np$-hardness of
$\sat ^*(\calF)$.
\end{newproof}




\section{The Class $\qsat$}

There is also a dichotomy result for quantified constraint satisfaction
problems. Dalmau has
independently observed such a result \cite{Dalmau}. For the
hard case the proof technique is similar to the one used for the above
theorems.
However the polynomial-time solvable cases are less classical.

\begin{theorem}\label{qsat_theorem}
Let  ${\cal F}$ be a constraint set.
 If ~ ${\cal F}$ satisfies one of the following three conditions then
 $\qsat(\calF)$ is in $\p$ otherwise it is $\pspace$-complete
\begin{enumerate}
 \item ${\cal F}$  is weakly positive \lb weakly
negative \rb.
 \item ${\cal F}$ is affine.
 \item ${\cal F}$ is bijunctive.
\end{enumerate}
\end{theorem}

\begin{proof}
First note that the problem  $\qsat(\calF)$  is in $\pspace$.
We can check whether a set of quantified $\calF$-expression is true by
cycling through all
possible assignments for the variables $x_1,\ldots x_n$ and evaluating the
constraints for each. Recording the current
assignment, testing the truth value of the set of constraint applications and
keeping track of where we are in the
process can all be done in polynomial space.

If every constraint in~${\cal F}$  is weakly positive (weakly negative)
or if every  constraint in~${\cal F}$ is bijunctive then the
problem    $\qsat(\calF)$  is known to
be in $\p$ (see \cite{KleineBKF-95} and \cite{AspvallPT-79} respectively). If
every constraint in~${\cal F}$ is affine,
then  an $\calF$-expression can be seen as
a quantified linear system over $GF(2)$. In using  Gaussian elimination
(thus in
polynomial time) one can either show that this system has no solution or
transform it into an equivalent   triangular linear system
 $S=\{E_1,\ldots ,E_p\}$ over a set of variables
$X=\{x_1,\ldots x_n\}$ in which $p\le n$
and
$E_i$ only involves variables in $\{x_i,\ldots x_n\}$ for $i\le n$.
In the first case we are done, the initial quantified $\calF$-expression is
false. Otherwise,
 it
suffices to call the following function
which decides whether a quantified
triangular system of linear equations over $GF(2)$ is evaluated to true.

\smallskip

{\sf Function Eval ($Q_1 x_1\ldots Q_n x_n, S)$

If $S=\emptyset$ then return(True)

Else if $x_n$ does not occur in any equation of $S$

 \ \ \ \ \ \ then return(Eval($Q_1 x_1\ldots Q_{n-1} x_{n-1}, S)$)

 \ \ \ \ \ \ else if $Q_n=\forall$ then return(False)

\ \ \ \ \ \ \ \ \ \ \ \ else let $j_0$ be the greatest $j$ such that $x_n$
occurs in $E_j$,

\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ using $E_{j_0}$ express $x_n$ as a
function of $x_{j_0},\ldots x_{n-1}$,


\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  in S replace
$x_n$ by this function in any other equation,

\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  return(Eval($Q_1 x_1\ldots Q_{n-1} x_{n-1},
 S\setminus E_{j_0})$)
}

\smallskip

This algorithm can clearly be performed in polynomial time, thus proving that
if every constraint in~${\cal F}$ is
affine then $\qsat(\calF)$ is in $\p$ .

\smallskip
Conversely, if ${\cal F}$ does not satisfy any of the conditions of the
theorem, we will show that $\qsat(\calF)$ is $\pspace$-hard using the
following proposition.

\begin{proposition}\label{oneinthree pspace completeness}
$\qsat(\{\oneinthree\})$ is $\pspace$-hard.
\end{proposition}

\begin{proof}
$\qtsat$ is known to be $\pspace$-complete
~\cite{StockmeyerM-73},~\cite{Stockmeyer-76}, and we know that the constraint
$\oneinthree$ can perfectly implement  any ternary
function (see Lemma \ref{oneinthree completeness}).
Therefore, by Lemma~\ref{qnphard}, we get that
$\qsat(\{\oneinthree\})$ is $\pspace$-hard.
\end{proof}

\smallskip



Suppose that  $\calF$ does not satisfy any of the conditions of
the theorem. Then $\calF\cup\{\F,\T\}$  can implement with perfect
completeness the function
 $\oneinthree$ (see Lemma~\ref{hardness
lemma}).  Thus by Lemma~\ref{qnphard} and Proposition~\ref{oneinthree
pspace completeness}, we get that $\qsat(\calF\cup\{\T,\F\})$is
$\pspace$-hard.


Now it remains to eliminate the functions $\F$ and $\T$. The proof can be
handled in much the same way as the proof of
Proposition \ref{sat*}. Once again we have at our disposal either the
constraint $\bor_1$ or $\sor_1$ (Lemma \ref{implication implementation}).
We will transform a quantified $(\calF\cup\{\F,\T\})$-expression to a
quantified
$\calF$-expression . Suppose that the initial instance is of the
form
$\qq_2 x_2\ldots \qq_nx_n\CC$.
We use a new variable
$x_0$ in place of each variable $y$ that appears in a constraint
$\F(y)$ and a new variable $x_1$ in place of each variable
$z$ that appears in a constraint $\T(z)$.
We now delete all constraint applications of the functions
$\F$ and $\T$ and let $\CC'$ be the resulting collection of
constraint applications.
We also introduce a variable $x$.
Next we consider
either the following expression:
$$ \exists x_0 \exists x_1\forall x  \qq_2 x_2\ldots \qq_nx_n\ \ \CC'
\cup\{ \bor _1(x_0,x_1), \bor _1(x_0,x), \bor _1(x,x_1)\}\hbox{ or},$$
$$ \exists x_0 \exists x_1\forall x  \qq_2 x_2\ldots \qq_nx_n\ \ \CC'
\cup\{ \sor _1(x_0,x_1), \sor _1(x_0,x), \sor _1(x,x_1)\}.$$

It is easy to verify that this quantified $\calF$-expression is true if and
only
if the initial quantified $(\calF\cup\{\F,\T\})$-expression is true. Hence,
 $\qsat(\calF\cup\{\F,\T\})$ is log-space reducible to
$\qsat(\calF)$, thus completing the proof of Theorem \ref{qsat_theorem}.
\end{proof}


%\include{optimization}



\chapter{Classification Theorems for Optimization Problems}
\label{Classification Theorems for Optimization Problems}



Recall that in Chapter~\ref{Constraint Satisfaction Problems},
we associated
four basic variants of optimization problems with any
constraint family. Their goals were:
\begin{enumerate}
\item Finding an assignment that maximizes the number of satisifed
constraints.
\item Finding an assignment with the maximum number of variables
set to $1$ that satisfies all given constraints.
\item Finding an assignment that minimizes the number of unsatisfied
constraints.
\item Finding an assignment with minimum number of variables set
to $1$ that satisfies all given constraints.
\end{enumerate}

In this section we study each of the above category of optimization
problems and classify them.
At first glance, this appears to be redundant work. For instance,
task (1) and (3) above seem to be restatements of the same problems!
It turns out however that the natural correspondence between the
two problems only preserves optimality, but not approximability!
Our classification reveals many differences between the approximability
behaviour of maximization and minimization problems.

In our study of the above classes of problems, we will consider
unweighted as well as weighted versions of these problems.
In all cases, the algorithmic results apply to the weighted version
of problems while the inapproximability results hold for
the unweighted versions. We will stress this fact in the individual
lemmas by stating positive results for weighted problems and
(the final) negative results for unweighted problems.


We remark that the literature on constraint satisfaction problems
includes one more class of optimization problems.
Reith and Vollmer \cite{ReithV-98} study the problem of finding the
lexicographically smallest  assignment satisfying an $\calF$-collection of
constraint applications. They get a dichotomy classification of the
problems in this class as polynomial time solvable or
OptP-complete (where OptP is a class of optimization problems
defined in \cite{Krentel-88}). We will not be covering this family
of results in our study here.



\section{Weighted versus Unweighted Optimization Problems}

We start by examining the
relationship between the weighted and unweighted versions of
the optimization problems considered in this chapter.
We first prove a result of
\cite[Theorem 4]{CST96} which reduces the impact
of the weights in weighted optimization problems.
The proof is a special case of a general technique
known as scaling.

\begin{lemma}
\label{wt-rem-prelim}
For every $\calf$ such that \wmaxcspf\ is in $\polyapx$,
\wmaxcspf\ AP-reduces to the special class of \wmaxcspf\ problems
with polynomially bounded positive integral weights.
Analogous results hold for \wmincspf, \wmaxonef\ and \wminonef.
\end{lemma}

\begin{proof}
Given an instance ${\cal I}$ of, say \wmaxcspf,
with weights $w_1,\ldots,w_m$, we first compute
an approximation $A$ to the  value of the optimum
of ${\cal I}$. Since the problem is assumed to be in
\polyapx, we know $A \leq \opt({\cal I}) \leq p(m) A$, for
some polynomial $p(\cdot)$.
We now create an instance ${\cal I'}$
of \wmaxcspf\ that has the same variables and
constraint applications as ${\cal I}$ but with integers weights
$w'_1,\ldots,w'_m$ chosen as follows. Let $M = m^{2} p(m)$
be an integer. Set $w'_j = \lfloor \frac{M w_j}{A} \rfloor + 1$.

Given an $r$-approximate solution $s$ to ${\cal I}'$, we output
either the solution given by the $p(m)$ approximation algorithm to
${\cal I}$ or the solution $s$, whichever is better.
We claim such a solution is an $r(1 + \frac{4}m)$-approximate
solution to ${\cal I}$ provided $m \geq 4$, which satisfies the
condition of the AP-reduction that the solution be
$1 + c (r-1) + o(1)$-approximate, where the $o(1)$ is
with respect to $m$.

The claim is obvious if $r > p(m)$;
so we assume $r \leq p(m)$. Notice that the optimum of
${\cal I}'$ has value at least $\frac{M}{A}\opt({\cal I})$.
Thus $s$ achieves an objective value of at least
$\frac{M}{rA}\opt({\cal I})$ as a solution to ${\cal I}'$.
Hence as a solution to ${\cal I}$ it achieves an objective of
at least

\begin{eqnarray*}
\frac{A}{M}\left(\frac{M}{rA}\opt({\cal I}) - 2m\right)
& = &
\frac{\opt({\cal I})}{r} - \frac{2m A}{M} \\
& = &
\frac{\opt({\cal I})}{r} - \frac{2m A}{m^2 p(m)} \\
& \geq  &
\frac{\opt({\cal I})}{r} - \frac{2m \opt({\cal I})}{m^2 p(m)} \\
& = &
\frac{\opt({\cal I})}{r} \left(1 - \frac{2r}{m p(m)}\right) \\
& \geq &
\frac{\opt({\cal I})}{r} \left(1 - \frac{2}{m}\right) \\
& \geq &
\frac{\opt({\cal I})}{r} \frac{1}{\left(1 + \frac4m\right)} \\
\end{eqnarray*}
(where the last inequality uses $m \geq 4$).
Thus the reduction satisfies the requirements of an AP-reduction.
\end{proof}

\begin{lemma}
\label{lem:weight-remove}
For any constraint family $\calf$, if
\wmaxcspf\ is in \polyapx, then \wmaxcspf AP-reduces
to \maxcspf.
Analogous results hold for
\mincspf, \maxonef\ and \minonef.
\end{lemma}

\begin{proof}
We first use Lemma~\ref{wt-rem-prelim} to
assume that the weights are polynomially bounded positive integers.
We then remove the integer weights by replication of
constraints/variables, depending on the category of the optimization
problem, as described below.

Given an instance of
\wmaxcspf\ on variables $x_1,\ldots,x_n$,
constraints $C_1,\ldots,C_m$ and weights
$w_1,\ldots,w_m$; we reduce it to the unweighted
case by replication of constraints. Thus the
reduced instance has variables $x_1,\ldots,x_n$
and constraint $\{\{C_i^j\}_{j=1}^{w_i}\}_{i=1}^m$
where constraint $C_i^j = C_i$.
It is clear that the reduced instance is essentially
the same as the instance we started with.
Similarly we reduce \wmincspf\ to \mincspf.

Given an instance ${\cal I}$ of
\wmaxonef\ on variables $x_1,\ldots,x_n$,
constraints $C_1,\ldots,C_m$ and weights
$w_1,\ldots,w_n$; we create an instance ${\cal I}'$ of
\maxonef\ on variables $\{\{y_i^j\}_{j=1}^{w_i}\}_{i=1}^n$.
For every constraint $C_j$ of ${\cal I}$ of the form
$f(x_{i_1},\ldots,x_{i_k})$, and for every $j \in \{1,\ldots,k\}$
and $n_j \in \{1,\ldots,w_{i_j}\}$ we impose the constraints
$f(y_{i_1}^{n_1},\ldots,y_{i_k}^{n_k})$. We now claim that
the reduced instance is essentially equivalent to the instance
we started with. To see this, notice that given any feasible
solution $\vec y$ to the ${\cal I}'$ we may convert it to another
feasible solution $\vec y'$ in which, for every $i$, all the
variables $\{(\vec y')_i^j | j = 1,\ldots,w_i\}$ have the same
assignment, by setting $(\vec y')_i^j$ to $1$ if any of the variables
$y_i^{j'}$, $j' = 1,\ldots,w_i$ is set to $1$. Notice that
this preserves feasibility; and only increases the contribution
to the objective function. The assignment $\vec y'$ now induces an
assignment to $\vecx$ with the same value of the objective
function. Thus the reduced instance is essentially equivalent
to the original one. This concludes the reduction from \wmaxonef\ to
\maxonef. The reduction from \wminonef\ to \minonef\ is similar.
\end{proof}





\section{The Class ({\sf Weighted}) $\csp$}

We now establish that every ({\sf Weighted}) $\csp({\cal F})$
problem is either in $\p$ or $\apx$-complete.
The following lemma establishes sufficient conditions for the polynomial time
solvability of $\wcspf$.


\begin{lemma}
[\po\ containment]
\label{polytime_conditions}
If ${\cal F}$ is 0-valid or 1-valid or 2-monotone,
$\wcspf$ is in $\po$.
\end{lemma}
\begin{proof}
If every constraint in ${\cal F}$ is $0$-valid ($1$-valid),
then the assignment which assigns a zero (one) to every variable, trivially
satisfies all the constraints. Otherwise, if every constraint is $2$-monotone,
any given input instance can be transformed into a weighted instance of the
$s$-$t$
$\mincut$ problem such that a minimum cut corresponds to an assignment
minimizing
the weight of unsatisfied
constraints and correspondingly, an assignment minimizing the weight of
unsatisfied constraints, represents a minimum weight $s$-$t$ cut
(see~\cite{Creignou-95, KhannaS-96} for details).
\end{proof}

\medskip

We will use the following result to identify \apx-hard \wcspf\ problems.

\begin{lemma}{\rm ~\cite{py,kmsv}}
\label{lem:xor_hard}
$\csp(\{\xor\})$ is $\apx$-hard.
\end{lemma}

Combining the above with  Lemma~\ref{non0-non1-non2monotone} and
Corollary~\ref{cor:apxhard}, we obtain the following lemma:

\begin{lemma}
[\apx-hardness]
\label{apx-hard-csp}
If $\calf$ is not 0-valid or 1-valid or 2-monotone,
then \cspf\ is \apx-hard.
\end{lemma}

\begin{proof}
By Lemma~\ref{non0-non1-non2monotone}, we have that
\calf\ strictly implements the function $\myxor$.
Combined with Corollary~\ref{cor:apxhard} and
Lemma~\ref{lem:xor_hard} above, we get that
\cspf\ is \apx-hard.
\end{proof}

Note that the \apx\ containment of \wcspf\ was already proved
in Proposition~\ref{prop:abs-apx-csp}. Combined with
Lemmas~\ref{polytime_conditions}~and~\ref{apx-hard-csp}, we
get the following dichotomy theorem for {\sf (Weighted)} \cspf.

\begin{theorem}
[\csp\ Classification Theorem {\rm ~\cite{Creignou-95,KhannaS-96}}]
For any constraint set ${\cal F}$,
({\sf Weighted}) $\csp({\cal F})$ is either in
$\p$ or is $\apx$-complete. Moreover, it is
in $\p$ if and only if ${\cal F}$ is either $0$-valid or $1$-valid or
$2$-monotone.
\label{apx thm}
\end{theorem}

\iffalse
\begin{proof}
If ${\cal F}$ satisfies one of the three conditions above,
$\wcspf$ is in $\p$ by
Lemma~\ref{polytime_conditions}. Otherwise, ${\cal F}$ can strictly implement
$\xor$ (Lemma~\ref{non0-non1-non2monotone}). Combining
Lemma~\ref{lem:xor_hard} with Corollary~\ref{cor:apxhard}, we can
conclude that $\csp({\cal F})$ is $\apx$-hard. Finally,
Proposition~\ref{prop:abs-apx-csp} shows that every ({\sf Weighted})
$\csp({\cal F})$ problem is in $\apx$.
\end{proof}
\fi

\section{The Class ({\sf Weighted}) $\maxone$}

In contrast to the class $\csp$, the class $\maxone$ captures some
problems for which it is $\np$-hard to find even a feasible solution (i.e.
problems that are not decidable in polynomial time).
At the same time, the class contains many problems that
are either easy to solve exactly or are approximable to within constant
factors.
Consequently, our classification theorem for this class exhibits
a richer structure as described below.

\begin{theorem}
[$\maxone$ Classification Theorem {\rm \cite{KhannaSW-96}}]
\label{thm:main2}
For every constraint set $\calF$, ({\sf Weighted}) $\maxone(\calF)$
is either solvable
exactly in $\po$ or $\apx$-complete or $\polyapx$-complete or decidable but
not approximable to within any factor or not decidable. Furthermore,
\begin{enumerate}
\item
\label{case:one}
If $\calF$ is $1$-valid or weakly positive or affine with width $2$, then
({\sf Weighted}) $\maxone(\calF)$ is in \po.
\item
\label{case:two}
Else if $\calF$ is affine
then ({\sf Weighted}) $\maxone(\calF)$ is APX-complete.
\item
\label{case:three}
Else if $\calF$ is weakly negative or bijunctive then
({\sf Weighted}) $\maxone(\calF)$ is $\polyapx$ complete.
\item
\label{case:four}
Else if $\calF$ is $0$-valid then
the task of finding a feasible solution to
({\sf Weighted}) $\maxone(\calF)$ is in $\p$
but finding
a solution of positive value is NP-hard.
\item
\label{case:five}
Else the task of
finding any feasible solution to $\maxone(\calF)$ is $\np$-hard.
\end{enumerate}
\end{theorem}

\subsection{Preliminaries}

In this subsection, we prove a few preliminary lemmas that we will
need in the proof of the theorem, particularly in Cases
\ref{case:two} and \ref{case:three}. We first show that in these
cases, it is essentially equivalent for us to consider the weighted or
unweighted $\maxone(\calF)$ problem.


We begin with a slightly stronger definition of polynomial-time
solvability of $\sat(\calF)$ that we will need.  We then show
that given this stronger form of $\sat(\calF)$ that insofar as
$\apx$-hardness and $\polyapx$-hardness are concerned, the weighted
and unweighted cases of $\maxone(\calF)$ are equivalent.  We conclude
by showing that in Cases \ref{case:two} and \ref{case:three} the
stronger form of $\sat(\calF)$ holds.

\begin{definition}
We say that a constraint satisfaction problem $\sat(\calF)$ is {\em
strongly decidable} if given $m$ constraints on $n$ variables
$x_1,\ldots,x_n$ {\em and an index $i \in \{1,\ldots,n\}$}, there
exists a polynomial time algorithm which decides if there exists an
assignment to $x_1,\ldots,x_n$ satisfying all $m$ constraints and
additionally satisfying the property $x_i = 1$.
\end{definition}

\begin{lemma}
\label{lem:str-dec}
If $\calf$ is a strongly decidable constraint family
the \wmaxonef\ AP-reduces to \maxonef.
\end{lemma}

\begin{proof}
By Lemma~\ref{lem:weight-remove} it suffices to show that
\wmaxonef\ is in \polyapx, and this is shown in
Lemma~\ref{lem:one-polyapx-easy}.
\end{proof}

\begin{lemma}
\label{lem:one-polyapx-easy}
If \calf\ is a strongly decidable constraint family then
\wmaxonef\ is in \polyapx.
\end{lemma}

\begin{proof}
We give an $n$-approximation algorithm for this problem.
Given an instance of \maxonef\ with variables $x_1,\ldots,x_n$,
constraints $C_1,\ldots,C_m$ and (w.l.o.g.) weights $w_1\leq w_2
\cdots \leq w_n$,
we find the largest index $i$ such that the instance is
still satisfiable with $x_i = 1$. We output such a satisfying
assignment. The objective we achieve is at least $w_i$, while
the optimum is at most $\sum_{j=1}^i w_j \leq i w_i \leq n w_i$.
Thus we have an $n$-approximation algorithm for \wmaxonef.
\end{proof}

\medskip

The ability to work with weighted problems in combination with
Lemma~\ref{lem:imp-one}  allows us to use
existential quantification over auxiliary variables and the notion
of perfect implementations of constraints.

As our examination will eventually show, there is really no
essential difference in the approximability of the weighted and
unweighted problems. For now we will satisfy ourselves by stating
this conditionally.


\begin{corollary}
\label{cor-wt}
For any strongly decidable constraint set $\calF$,
\maxonef\ is \apx-hard if and
only if the \wmaxonef\ is \apx-hard.
Similarly,
\maxonef\ is \polyapx-hard if and
only if \wmaxonef\ is \polyapx-hard.
\end{corollary}

Before concluding we show that most problems of interest to us will
be able to use the equivalence between weighted and unweighted
problems.

\begin{lemma}
\label{lem:wt-prelim}
If $\calf$ is 1-valid or affine or weakly positive or weakly negative
or bijunctive, then
$\calF$ is strongly decidable.
\end{lemma}
\begin{proof}
For a constraint $f \in \calF$ and an index $i \in \{1,\ldots,k\}$,
let $f^*_i$ be the constraint:
$$f^*_i(x_1,\ldots,x_k) \defas
f(x_1,\ldots,x_{i-1},1,x_{i+1},\ldots,x_k).$$
Further let $\calF^*$ be the constraint set:
$$\calF^* \defas \calF \cup \{f^*_i | f \in \calF, i \in
[k]\}.$$
First observe that the problem of strong decidability of $\calF$
is the decision
problem $\sat(\calF^*)$. Further, observe that
if $\calf$ is 1-valid or weakly positive or weakly
negative or affine or bijunctive, the so is $\calf^*$.
Thus in each case
we end up with a problem from $\sat(\calF)$ which is in $P$ by Schaefer's
theorem, Theorem \ref{satisfiability_theorem}.
\end{proof}

\subsection{Containment results (Algorithms) for \maxone}

Note that the \polyapx containment for Case~\ref{case:three}
have already been dealt with in
Lemma~\ref{lem:one-polyapx-easy}.
For Case~\ref{case:four}, the fact that
the all zero assignment is feasible shows that it is easy to
find a feasible solution to the $\wmaxonef$ problem.
Thus it suffices
to show membership in \po\ for Case~\ref{case:one} and
membership in \apx\ for Case~\ref{case:two}.
We deal with these two cases in the next two lemmas.

\begin{lemma}
[\po\ containment]
\label{lem:maxone-po-easy}
\wmaxonef\ is in \po\ if \calf
is $1$-valid or is weakly positive or is affine with width $2$.
\end{lemma}

\begin{proof}
If $\calF$ is 1-valid, then setting each variable to 1 satisfies all
constraint applications with the maximum possible variable weight.

If $\calF$ is weakly positive then the problem of finding the feasible
assignment with the greatest weight of one is similar to the problem of finding
the minimal model of a Horn formula. This can be done in linear time by using
unit resolution (see for instance \cite{Minoux-88}).

In the case that $\calF$ is affine with width 2, we reduce the problem
of finding a feasible solution to checking whether a graph is
bipartite, and then use the bipartition to find the optimal solution.
Notice that each constraint corresponds to a conjunction of
constraints of the form $x_i = x_j$ or $x_i \neq x_j$.  Create a
vertex $x_j$ for each variable $x_j$ and for each constraint $x_i \neq
x_j$, add an edge $(x_i,x_j)$. For each constraint $x_i = x_j$,
identify the vertices $x_i$ and $x_j$; if this creates a self-loop,
then clearly no feasible assignment is possible.  Check whether the
graph is bipartite; if not, then there is no feasible assignment.  If
so, then for each connected component of the graph choose the side
with larger weight in the bipartition, and set the
variables corresponding to this side to one.
\end{proof}

\begin{lemma}
[\apx\ containment]
\label{lem:one-apx-easy}
If \calf\ is affine then the \wmaxonef\ is in $\apx$.
\end{lemma}

\begin{proof}
By Lemmas~\ref{lem:wt-prelim}~and~\ref{lem:str-dec} it suffices to
consider the unweighted case. In this case when all constraints are
affine, then satisfying all constraints is essentially the problem of
solving a linear system of equations over GF(2).  If the system is
overdetermined, then no feasible solution exists, else
setting some of variables arbitrarily determines the remainder
of the solution. To be more
precise, the variables $\vec x$ can be partitioned into $\vec{x'}$ and
$\vec{x''}$ such that the feasible solutions are given by arbitrary
assignment to $\vec{x''}$ and setting
$\vec{x'} = A \vec{x''} \oplus \vec{b}$ for some 0/1
matrix $A$ and some 0/1 vector $b$ (where matrix arithmetic is carried
out over GF(2)).
Setting the variables in $\vec{x''}$ to 1 with
probability 1/2 we find that for any variable $x_i$
whose assignment is not a constant in all feasible solutions,
$x_i$ is set to $1$ w.p. $1/2$.
Thus the expected number of ones is at least $\opt/2$,
giving a 2-approximate solution.
\end{proof}


\subsection{Hardness results for \maxone}

We now move on to showing the hardness results for
Theorem~\ref{thm:main2}. Note that there is nothing to
be shown in Case~\ref{case:one} and that Case~\ref{case:five}
follows directly from Schaefer's theorem
(Theorem~\ref{satisfiability_theorem}).
Note also that Case~\ref{case:four}
follows immediately from Proposition \ref{sat*}, which shows that
finding a non-zero feasible assignment is NP-hard.
In what follows, we deal with the two remaining cases
(Case~\ref{case:two}
and Case~\ref{case:three}).


\subsubsection{The $\apx$-hard case}

We start by showing that the problems in Case~\ref{case:two} are
$\apx$-hard.  The basic idea of this proof is to show via
implementations that $\mcut$ can be reduced to any such problem.
We first show that two basic problems in this case are
\apx-hard by reducing \mcut\ to them.

\begin{lemma}
\label{lem:xor-three}
\wmaxone$(\{\myxnor_3\})$ is $\apx$-hard.
\end{lemma}

\begin{proof}
We reduce the $\mcut$ problem to the weighted $\maxone(\{\xor_3\})$
problem as follows. Given a graph $G=(V,E)$ we create a variable $x_v$
for every vertex $v \in V$ and a variable $x_e$ for every edge $e \in
E$.  The weight $w_v$ associated with the vertex variable $x_v$ is
$0$.  The weight $w_e$ of an edge variable $x_e$ is $1$. For every
edge $e$ between $u$ and $v$ we create the constraint
$x_e \oplus x_u \oplus x_v = 0$.  It is clear that any $0/1$ assignment to the
$x_v$'s define a cut and for an edge $e = \{u,v\}$, $x_e$ is one iff
$u$ and $v$ are on opposite sides of the cut. Thus solutions to the
$\maxone$ problem correspond to cuts in $G$ with the objective
function being the number of edges crossing the cut.
\end{proof}

\begin{lemma}
\label{lem:xor-four}
$\wmaxone(\{\myxnor_4,\myxor\})$ is $\apx$-hard.
\end{lemma}

\begin{proof}
We reduce $\mcut$ to $\wmaxone(\{\myxnor_4,\myxor\})$.
Given a graph $G = (V,E)$, we create an instance ${\cal I}$ of
$\wmaxone(\{\myxnor_4,\myxor\})$ with
variables $x_v$ for every
$v \in V$, $x_e$ for every $e \in E$, one global variable $z$
(which is supposed to be zero)
and $m \eqdef |E|$ auxiliary variables $y_1,\ldots,y_m$.
The constraints of ${\cal I}$ are as follows:
For every edge
$e = \{u,v\}$ in $G$ we impose the  constraint
$\myxnor_4(x_e,x_u,x_v,z)$. In addition we include the
constraint $\myxor(z,y_i)$ for every $i \in \{1,\ldots,m\}$.
Finally we set
the weights of the vertex variables and $z$ to be zero and
the weights of the edge variables and the auxiliary variables
$y_i$ to $1$.

We first notice that the optimum of ${\cal I}$ is exactly
$\mcut(G) + m$: Any assignment with $z = 1$ attains an
objective of at most $m$, while any assignment with $z = 1$
defines a cut and attains an objective of $m + $ number of
edges crossing the cut.

Let $s$ be an $r$-approximate solution to ${\cal I}$.
Notice that objective attained by $s$ is at least
$(\mcut(G) + m)/r$.
If $r > 6/5$, we pick a greedy solution which
gives a $2$-approximate to $\mcut(G)$, which is an
$1 + 5(r-1)$-approximate solution.
Else if $r \leq 6/5$,
we report the cut with one side of the partition being vertices
who are assigned to $0$ and the other side consisting of
vertices who are assigned to $1$. We claim such a cut must
have at least
$(\mcut(G) + m)/r - m$ edges crossing the cut.
Using $m \leq
2\mcut(G)$ and $r \leq 6/5$, we find this number is
at least $\mcut(G)/r'$ where $r' \leq 1 + 5(r-1)$.
Thus in either case the reduction satisfies the properties
required by an AP-reduction. The lemma follows.
\end{proof}

We are now ready to show \apx-hardness for this case.

\begin{lemma}
[\apx-hardness]
\label{lem:why}
If \calf\ is affine but not of width-$2$ nor
$1$-valid,
then $\calf$ perfectly implements the family
$\{\myxnor_4,\myxor\}$ or the function $\myxnor_3$.
Thus \maxonef\ is $\apx$-hard.
\end{lemma}

\begin{proof}
By Lemma~\ref{lem:char-affine3} $\calf$ implements
$\myxnor_4$ perfectly.
Let $f \in \calf$ be a non 1-valid function.
If $f$ is $C$-closed, then by Lemma~\ref{non0-non1-C-closed}
$f$ implements $\myxor$ and thus $\calf$ implements the
set $\{\myxnor_4,\myxor\}$. Using
Lemmas~\ref{lem:imp-one} and \ref{lem:xor-four}, we conclude
that \wmaxonef\ is $\apx$-hard; and then use Lemma~\ref{lem:wt-prelim}
and Corollary~\ref{cor-wt} to conclude that \maxonef\ is \apx-hard.

Now consider the case when
$f$ is not C-closed. Here, we can apply Lemma~\ref{non-C-closed}
(Part (ii) and (iii)) to find that $f$ implements $\F$ perfectly.
In such a case we use $\myxnor_4(x_1,x_2,x_3,z)$ and $\F(z)$ to
implement the constraint
$\myxnor_3(x_1,x_2,x_3)$. Thus we are now done, using
Lemma~\ref{lem:xor-three}.
\end{proof}


\subsubsection{The $\polyapx$-hard case}

The hard problem we will use for this part is \mclique\ which
was shown to be hard to approximate to within polynomial factors
by the sequence of works \cite{fglss,as,almss}. This implies that
\mclique\ is \polyapx-hard, as shown by \cite{kmsv}.

\begin{proposition}
\maxone$(\{\bor_2\})$ is \polyapx-hard.
\end{proposition}

\begin{proof}
It turns out this problem is exactly the \mclique\ problem.
Given a graph $G$, let ${\cal I}$ be the instance of
\maxone$(\{\bor_2\})$ with variables $\{x_v | v$ is a vertex of $G \}$,
and constraints $\bar x_u \wedge \bar x_v$ iff $(u,v)$ is {\em not}
an edge of $G$. The set of variables that are assigned $1$ in any
satisfying assignment then correspond to a clique; and the objective
is the size of the clique. The proposition follows from the fact that
\mclique\ is \polyapx-hard \cite{fglss,as,almss,kmsv}.
\end{proof}


The proof for the \polyapx-hardness is somewhat long. We start
by proving
a lemma that implies \wmaxone$(\calf \cup \{\F,\T\})$ is \polyapx-hard.

\begin{lemma}
\label{lem:maxone-polyapx-T+F}
If \calf\ is not weakly positive or affine, then
$\calf \cup \{\F,\T\}$ perfectly implements $\bor_2$.
\end{lemma}

\begin{proof}
Since $\calf$ is not weakly positive, we have by
Lemma~\ref{non_weak+_non_weak-}
that $\calf \cup\{\F,\T\}$ perfectly implement $\bor_2$ or $\myxor$.
In the former case we are done. In the latter case we use the
fact that \calf\ is not affine along with Lemma~\ref{lem:imp-non-affine}
to conclude that $\calf \cup \{\F,\T\}$ perfectly implements one of
$\bor_0,\bor_1$ or $\bor_2$. Combined with $\myxor$, we find that
any of these functions implement $\bor_2$. For example,
$\bor_0(\barX,\barY)$, $\myxor(x,\barX)$ and $\myxor(y,\barY)$ give
a perfect 3-implementation of $\bor_2(x,y)$.
\end{proof}

Now all that remains to be done is to implement $\F$ and $\T$.
Lemma ~\ref{lem:non01} shows that $\calf$ does implement $\F$.
Unfortunately implementing $\T$ may not always be possible. For example,
all functions in \calf\ may be 0-valid!
We will find two alternates for such an event.
(1) If \calf\ implements $\bor_2$, then we don't need to
implement $\T$
(2) If \calf\ implements $\bor_1$, then we will show that this
is good enough to simulate $\T$. We won't get an implementation
of $\T$, however we will get an AP-reduction from
$\wmaxone(\calf \cup \{\T\})$ to $\wmaxone(\calf \cup \{\bor_1\})$.
The following lemmas formalize the above.

\begin{lemma}
\label{2cnf and C-closed}
If $f$ is bijunctive and C-closed, then f is affine with width $2$.
\end{lemma}

\begin{proof}
We run through the maxterms of $f$ and show each one can be
replaced by an affine constraint of width two.
Since maxterms of size $1$ are already affine with width two,
we may move on the maxterms of size $1$. Say, $x_1 \vee \bar x_2$
is a maxterm of $f$. Then C-closedness of $f$ implies that the
complementary term $\bar x_1 \vee x_2$ is also a maxterm of $f$.
Thus we can replace $x_1 \vee \bar x_2$ by the stronger constraint
$x_1 \oplus x_2 = 0$ which is affine with width two.
\end{proof}

\begin{lemma}
\label{lem:not-C-closed}
If \calf\ is $0$-valid or weakly negative or bijunctive,
but \calf\ is not $1$-valid, nor affine nor weakly positive,
then \calf\ implements $\F$.
\end{lemma}
\begin{proof}
By Lemma~\ref{lem:non01} it suffices to show that $\calf$ is not 1-valid
and not C-closed. The  former is given and we now prove the latter.

Notice that a C-closed 0-valid constraint is also 1-valid.
A C-closed weakly positive constraint will also be weakly negative.
Lastly a C-closed bijunctive constraint
is an affine constraint of width 2 (by Lemma~\ref{2cnf and C-closed}).
Thus if $\calF$ is 0-valid, then the constraint which is not
1-valid is not C-closed. If $\calF$ is weakly negative, the constraint
which is not weakly positive is not C-closed. Similarly if $\calF$
is bijunctive, then the constraint that is not affine is not C-closed.
\end{proof}

\medskip

\begin{lemma}
\label{lem:maxone-polyapx-hard-1}
If \calf\ is $0$-valid or weakly negative or bijunctive,
but \calf\ is not $1$-valid, nor affine nor weakly positive,
then \calf\ implements at least one of $\T$, $\bor_1$, $\bor_2$.
\end{lemma}

\begin{proof}
We already have by Lemma~\ref{lem:not-C-closed} that
\calf\ implements $\F$. Let $g$ be a non-affine function
from $\calf$. If $g$ is 0-valid, then we are done by
Lemma~\ref{lem:imp-non-affine}
which says that $\{g,\F\}$ (and hence $\calf$) implements
$\bor_1$ or $\bor_2$. Else $g$ is not 0-valid in which case
$\calf$ implements $\T$.
\end{proof}

Finally we deal with the case where we have an implementation
of $\bor_1$.

\begin{lemma}
For any family \calf\ $\wmaxone(\calF \cup \{\T\})$ AP-reduces to
$\wmaxone(\calF \cup \{\bor_1\})$.
\label{x+ bary_gives_1}
\end{lemma}

\begin{proof}
Given an instance $\calI$ of $\wmaxone(\calF \cup \{\T\})$ we
construct an instance $\calI'$ of
$\wmaxone(\calF\cup \{x \vee  \bar y\})$ as follows.
The variable set of $\calI'$ is the same as that of $\calI$.
Every constraint from $\calF$ in $\calI$ is also included in
$\calI'$. The only remaining constraints are of the form $\T(x_i)$
for some variables $x_i$. We simulate this constraint in $\calI'$
with $n-1$
constraints of the form $x_i \vee  \bar{x}_j$ for every $j \in
\{1,\ldots,n\}$, $j \ne i$. Every non-zero solution to the resulting
instance $\calI'$ is also a solution to $\calI$, since the solution must have
$x_i = 1$ or else every $x_j = 0$. Thus the resulting instance of
$\wmaxone(\calF \cup \{x \vee  \bar y\})$ has the same
objective function and the same feasible space and is
hence at least as hard as the original problem.
\end{proof}

We are finally ready to prove the \polyapx-hardness lemma.

\begin{lemma}
[\polyapx-hardness]
\label{lem:one-polyapx-hard}
If \calf\ is weakly negative or bijunctive,
but \calf\ is not $1$-valid, nor affine nor weakly positive,
then \maxonef\ is \polyapx-hard.
\end{lemma}

\begin{proof}
Note that, by Lemma~\ref{lem:wt-prelim},
\calf\ is strongly decidable
and hence, by Lemma~\ref{lem:str-dec}, \wmaxonef\ AP-reduces to
\maxonef.
Thus it suffices to prove $\polyapx$-hardness for $\wmaxonef$.

By Lemma~\ref{lem:maxone-polyapx-hard-1}, we have that
\calf\ implements one of the three functions $\bor_2$, $\bor_1$
or $\T$. In the first case, we are done, so we move on to the remaining
two. We also have by Lemma~\ref{lem:not-C-closed} that \calf\ implements
$\F$ and so if we are in the case where \calf\ implements $\T$, then
we have that \calf\ implements $\calf\cup \{\F,\T\}$
that, by Lemma~\ref{lem:maxone-polyapx-T+F},
implements $\bor_2$. So we are left with
the case where \calf\ implements $\bor_1$. In this case we
have
\begin{eqnarray*}
\wmaxone(\{\bor_2\}) & \apred & \wmaxone(\calf \cup \{\F,\T\}) \\
& \apred & \wmaxone(\calf \cup \{\bor_1,\F\})
		\mbox{~~~(Using Lemma~\ref{x+ bary_gives_1})}\\
& \apred & \wmaxone(\calf) \\
& \apred & \maxonef
\end{eqnarray*}
Thus in all cases we are done.
\end{proof}


\iffalse
\subsubsection{Case \protect\ref{case:four}: Finding a Solution of
Positive Value is NP-Hard}

The following  lemma proves the hardness part of
Case \ref{case:four} of Theorem \ref{thm:main2}.

\begin{lemma}
\label{lem:str-np}
If $\calF$ is neither $1$-valid nor weakly negative nor weakly positive
nor affine nor bijunctive,
then the problem of finding solutions of non-zero value to a given
instance of $\maxone(\calF)$ is NP-hard.
\end{lemma}


\begin{proof} This lemma follows easily from Proposition \ref{sat*}.
\end{proof}

\fi

\section{The Class ({\sf Weighted}) $\mincsp$}
\label{sec:mincsp}

In this section we classify the class $\mincsp$.
In contrast to the results in previous sections, in this
section (and the next) we will not
not be able to precisely determine the approximability
of every problem in the class.
However we will still be able to partition the class into
finitely many subclasses; and within each subclass the problems
are equivalent upto A-reducibility.

To define these
subclasses, we use the notation ``$\Pi$-completeness''.
Given optimization problems $\Pi$ and $\Pi'$, we say
$\Pi'$ is $\Pi$-complete if $\Pi$ A-reduces to $\Pi'$
and vice versa. The \mincsp\ classification theorem
highlights four problems as important ones:

\begin{itemize}
\item
\minuncut\ = \mincsp$(\{\myxor\})$.
This problem has been
studied previously by Klein et al.~\cite{KARR}
and Garg et al.~\cite{GVY96}.
The problem is known to be $\apx$-hard and
hence not approximable to within some constant factor greater than
1.
On the other hand, the problem is known to be approximable
to within a factor of $O(\log n)$~\cite{GVY96}.

\item
\mincnf\ = \mincsp$(\{\bor_0,\bor_2\})$.
This problem has been studied by  Klein et al.~\cite{KPRT96}.
They show that the problem is $\apx$-hard and that it is
approximable to within a factor of $O(\log n \log\log n)$.

\item
\nearestcp\ = \mincsp$(\{\myxor,\rep\})$.
This is a classical problem for which hardness of
approximation results have been shown by
Arora et al.~\cite{ABSS93}. The \minone\ version
of this problem is essentially identical to this problem.
For both problems, the hardness result of Arora et al.~\cite{ABSS93}
shows that approximating this problem to within
a factor of $\Omega(2^{\log^{1 - \epsilon} n})$ is hard
for every $\epsilon > 0$,
unless $\np\subset\mbox{DTIME}(2^{\log^{O(1)}n}) $.
No non-trivial approximation guarantees are known for this
problem (the trivial bound being a factor of $m$, which is
easily achieved since deciding if all equations are satisfiable
amounts to solving a linear system).
\item
Lastly we also mention one more problem which is
required to present our main theorem.
\horn\ = \mincsp$(\{\bor_{3,1}, \F, \T\})$.
This problem is essentially as
hard as the \nearestcp.
\end{itemize}

We now state the \mincsp\ Classification Theorem.

\begin{theorem}
[\mincsp\ Classification Theorem {\rm \cite{KhannaST-97}}]
\label{thm:main-mincsp}
For any constraint family $\calf$, the problem
({\sf Weighted}) \mincspf\ is
in \po\ or is
\apx-complete or \minuncut-complete or
\mincnf-complete or
\nearestcp-complete or \horn-complete or
the decision problem is \np-hard. Furthermore,
\begin{enumerate}
\item
\label{case:mincsp-one}
If $\calF$ is $0$-valid or $1$-valid or $2$-monotone, then
({\sf Weighted}) \mincspf\ is in \po.
\item
\label{case:mincsp-two}
Else if $\calF$ is
$\setcoverB$
then
({\sf Weighted}) \mincspf\ is \apx-complete.
\item
\label{case:mincsp-three}
Else if $\calF$ is width-$2$ affine then
({\sf Weighted}) \mincspf\ is \minuncut-complete.
\item
\label{case:mincsp-four}
Else if $\calF$ is bijunctive then
({\sf Weighted}) \mincspf\ is \mincnf-complete.
\item
\label{case:mincsp-five}
Else if $\calF$ is affine then
({\sf Weighted}) \mincspf\ is \nearestcp-complete.
\item
\label{case:mincsp-six}
Else if $\calF$ is weakly positive or weakly negative then
({\sf Weighted}) \mincspf\ is \horn-complete.
\item
\label{case:mincsp-seven}
Else deciding if the optimum value of an instance of
({\sf Weighted}) \mincspf\
is zero is $\np$-complete.
\end{enumerate}
\end{theorem}


\subsection{Preliminary results}


We start with an an obvious equivalence between the
complexity of the {\sf (Weighted)} \mincsp\ problem
for a function family and its ``complement''.
For a constraint $f$, let $f^-$ denote the function
$f^-(x) = f(\bar x)$.
For a family $\calf$, let $\calf^- = \{f^- | f \in \calf\}$.

\begin{proposition}
\label{prop:fminus}
\label{prop:imp-fminus}
For every constraint family $\calf$,
{\sf (Weighted)} \mincsp$(\calf)$ is AP-reducible to
{\sf (Weighted)} \mincsp$(\calf^-)$.
\end{proposition}

\begin{proof}
The reduction substitutes every constraint $f(\vec x)$ from
\calf\ with the constraint $f^- (\vec x)$ from $\calf^-$. A
solution for the latter problem is converted into a solution for
the former one by complementing the value of each variable.
The transformation preserves the cost of the solution.
\end{proof}

\begin{proposition}
\label{prop:mincsp-wt}
\label{prop:mincsp-polyapx-easy}
If $\calf$ is decidable then
\wmincspf\ is in \polyapx\ and
is AP-reducible to \mincspf.
\end{proposition}

\begin{proof}
Given an instance $\x$ of \wminonef\ with constraints
$C_1,\ldots,C_m$ sorted in order of decreasing weight
$w_1\geq \cdots \geq w_m$.
Let $j$ be the largest index such that the constraints
$C_1,\ldots,C_j$ are simultaneously satisfiable. Notice
that $j$ is computable in polynomial time and an assignment
$\vec a$ satisfying $C_1,\ldots,C_j$ is computable in
polynomial time. Then the solution $\vec a$ is an $m$-approximate
solution to $\x$, since every solution must fail
to satisfy at least one of the constraints $C_1,\ldots,C_{j+1}$
and thus have an objective of at least $w_{j+1}$,
while $\vec a$ achieves an objective of at most $\sum_{i=j+1}^m w_i
\leq m w_{j+1}$.
Thus we conclude that \wmincspf\ is in \polyapx.
The second part of the proposition follows by
Lemma~\ref{lem:weight-remove}.
\end{proof}


\subsection{Containment Results (Algorithms) for \mincsp}
\label{ssec:mincsp-contain}

We now show the containment results described in
Theorem~\ref{thm:main-mincsp}.
Most results described here are simple containment results which follow easily
from the notion of a ``basis''. The more interesting result here is a constant
factor approximation algorithm for \setcoverB\ which is presented in
Lemma~\ref{lem:cont-apx}.

We start with the classes contained in \po.

\begin{lemma}
[\po\ containment]
\label{lem:mincsp-po-easy}
If \calf\ is $0$-valid or $1$-valid or $2$-monotone, then
\wmincsp$(\calf) \in \po$.
\end{lemma}

\begin{proof}
The lemma may be proven directly as in the proof of
Lemma~\ref{polytime_conditions}. Alternately, one may
use the equivalence of computing the exact optimum solution
of \wcspf\ and \wmincspf, since for any given instance ${\cal I}$
of \wcspf and the same instance to \wmincspf\ an optimum
solution to one is also the optimum solution to the other.
With this observation, the lemma follows from
Lemma~\ref{polytime_conditions}.
\end{proof}

We now move on to \apx\ containment results.

\begin{lemma}
[\apx\ containment]
\label{lem:cont-apx}
\label{lem:mincsp-apx-easy}
If \calf\ is \setcoverB, then
\wmincsp$(\calF) \in \apx$.
\end{lemma}

\begin{proof}
By Propositions~\ref{prop:imp-basis}~and~\ref{prop:fminus}
it suffices to prove the lemma for the problem
\wmincsp$(\setcoverB)$,
where $\setcoverB = \{\bor_{k,0} | k \in [B]\} \cup \{\bor_1,\F\}$.
We will show that for every
$B$, \wmincsp$(\setcoverB)$ is $B+1$-approximable.

Given an instance $\x$ of \wmincsp$(\setcoverB)$ on variables
$x_1,\ldots,x_n$ with constraints
$C_1,\ldots,C_m$ with weights $w_1,\ldots,w_m$,
we create a
linear program on variables $y_1,\ldots,y_n$ (corresponding to
the boolean variables $x_1,\ldots,x_n$) and variables $z_1,\ldots,z_m$
(corresponding to the constraints $C_1,\ldots,C_m$).
For every constraint $C_j$ in the instance $\x$ we create a LP constraint
using the following transformation rules:
\[
\begin{array}{lllcrll}
C_j & : & x_{i_1} \vee \cdots \vee x_{i_k}, \mbox{ for $k \leq B$}
& ~~~ \rightarrow ~~~
& z_j + y_{i_1} + \cdots + y_{i_k} & \geq & 1 \\
C_j & : & \bar x_{i_1} \vee x_{i_2} & ~~~ \rightarrow ~~~
& z_j + (1 - y_{i_1}) + y_{i_2} & \geq & 1 \\
C_j & : & \bar x_{i_1} & ~~~ \rightarrow ~~~
& z_j + (1 - y_{i_1}) & \geq & 1
\end{array}
\]
In addition we add the constraints $0\leq z_j,y_i\leq 1$ for every $i,j$.
It may be verified that any integer solution to the above LP corresponds
to an assignment to the \mincsp\ problem with the variable $z_j$ set to
$1$ if the constraint $C_j$ is not satisfied. Thus the objective function
for the LP is to minimize $\sum_j w_j z_j$.

Given any feasible solution vector $y_1,\ldots,y_n,z_1,\ldots,z_m$ to the
LP above, we show how to obtain a $0/1$ vector
$y''_1,\ldots,y''_n,\allowbreak z''_1,\ldots,z''_m$
that is also feasible such that $\sum_j w_j z''_j \leq (B+1) \sum_j w_j z_j$.

First we set $y'_i = \min\{1,(B+1)y_i\}$
and $z'_j = \min\{1,(B+1)z_j\}$. Observe that the
vector $y'_1,\ldots,y'_n,\allowbreak
z'_1,\ldots,z'_m$ is also feasible and gives a solution of value at most
$(B+1) \sum_j w_j z_j$. We now show
how to get an {\em integral} solution whose
value is at most $\sum_j w_j z'_j$. For this part we first set $y''_i
= 1$ if $y'_i = 1$ and $z''_j = 1$ if $z'_i = 1$. Now we remove every
constraint in the LP that is made redundant. Notice in particular that every
constraint of type (1) is now redundant (either $z''_j$ or one of the $y''_i$'s
has already been set to $1$ and hence the constraint will be satisfied by any
assignment to the remaining variables). We now observe that, on
the remaining variables, the
LP constructed above reduces to
%an $s$-$t$ \mincut\ LP relaxation,
the following


\[
\begin{array}{rrcl}
{\sf Minimize} & \sum_j w_j z_j \\
{\sf Subject to}     & y_{i_2} - y_{i_1} + z_j & \geq & 0 \\
& y_{i_2} + z_j & \geq & 1 \\
& - y_{i_1} + z_j & \geq & 0
\end{array}
\]
with the $y'_i$'s and $z'_j$'s forming a feasible solution
to the above LP.
Notice further that every $z_j$ occurs in at most one constraint above.
Thus the above LP represents a s-t min cut problem,
and therefore has
an optimal integral solution. We set $z''_j$'s and $y''_i$ to such an
integral and optimal solution. Notice that the so obtained solution is
integral and
satisfies $\sum_j w_j z''_j \leq \sum_j w_j z'_j \leq (B+1)\sum_j w_j z_j$.
\end{proof}

\begin{lemma}
[\minuncut\ containment]
\label{lem:cont:uncut}
\label{lem:mincsp-w2a-easy}
For any family \calf\ that is affine with width $2$,
\wmincspf\ A-reduces to \mincsp$(\{\myxor\})$.
\end{lemma}
\begin{proof}
First we will argue that the family
$\calf' = \{\myxor,\F,\T\}$ perfectly
implements $\calf$.
By Proposition~\ref{prop:imp-basis} it suffices to implement the basic
width-2 affine functions: namely, the functions
$\myxor$, $\rep$, $\F$ and $\T$. Every function except $\myxor$ is
already present in $\calf'$. Further the constraints
$\myxor(x,z)$ and
$\myxor(z,y)$
perfectly implement the constraint $\rep(x,y)$.

We would be done if we could now show that $\{\myxor\}$
perfectly implements the functions $\F$ and $\T$, but this is not the case.
So instead we resort to reductions directly and show,
in Lemma~\ref{lem:bgs-like},
that $\wmincsp(\calf')$ A-reduces to $\wmincsp(\{\myxor\})$.
(The lemma is more general and applies whenever the target
is not 0-valid or 1-valid, which is certainly true for us.)
Finally the weights can be removed
using Proposition~\ref{prop:mincsp-wt}.
\end{proof}

\begin{lemma} \label{lem:bgs-like}
\label{lem:csp-non-01}
If \calf\ is not $0$-valid or $1$-valid
then
\wmincsp$(\calf \cup \{\F,\T\})$
is A-reducible to \wmincspf.
\end{lemma}

\begin{proof}
Let $f_0$ be the function from $\calf$ that is not 0-valid and let
$f_1$ be the function that is not 1-valid. If some function
$g$ in $\calf$ is
is not C-closed, then, by Lemma~\ref{lem:non01}
 $\calf$ perfectly and strictly
implements $\F$ and $\T$.
Hence, by Lemma~\ref{lem:imp-mincsp},
\mincsp$(\calf \cup \{\F,\T\})$ is A-reducible to \mincspf.

Otherwise, every function of $\calf$ is C-closed and
hence by Lemma~\ref{non0-non1-C-closed}, $\calf$ perfectly and
strictly implements
the $\myxor$ function and hence the $\rep$ function.
Thus it suffices to show that
\wmincsp$(\calf \cup \{\F,\T\})$ is A-reducible to
\wmincsp$(\calf \cup \{\myxor,\rep\})$
for C-closed families $\calf$.
Here we use an idea from \cite{bgs} described next.

Given an instance $\x$
of \wmincsp$(\calf \cup \{\F,\T\})$
on variables $x_1,\ldots,x_n$
and constraints $C_1,\ldots,C_m$,
we define an instance $\x'$ of
\wmincspf\ whose variables are $x_1,\ldots,x_n$ and additionally
one new auxiliary variable $x_F$. Each
constraint of the form $\F(x_i)$ (resp. $\T(x_i)$)
in $\x$ is replaced by a
constraint
$\rep(x_i,x_F)$ (resp. $\myxor(x_i,x_F)$).
All the other constraints are
not changed.
Thus $\x'$ also has $m$ constraints.
Given a solution $a_1,\ldots,a_n,a_F$ for $\x'$
that satisfies $m'$ of these constraints,
notice that the assignment
$\bar a_1,\ldots, \bar a_n, \bar a_F$ also
satisfies the same collection of constraints (since
every function in $\calF$ is $C$-closed).
In one of these cases the assignment to $x_F$ is false
and then we notice that a constraint of $\x$ is satisfied
if and only if the corresponding constraint in $\x'$ is satisfied.
Thus every solution to $\x'$ can be mapped to a solution of
$\x$ with the same contribution to the objective function.
\end{proof}

The following lemmas show reducibility to
\mincnf, \nearestcp\ and \horn.

\begin{lemma}
[\mincnf\ containment]
\label{lem:cont-2cnf}
\label{lem:mincsp-2cnf-easy}
For any family \calf\ that is bijunctive, the family
$\{\bor_0,\bor_2\}$
perfectly implements every function in $\calF$
and hence \wmincspf $\ared$ \mincnf.
\end{lemma}

\begin{proof}
Again it suffices to consider the basic constraints of $\calF$ and
this
is some subset of
$$\{\bor_0,\bor_1,\bor_2, \F, \T\}.$$
The family $\twocnf$ contains the first and the third function.
Since it contains a non 0-valid function, a non 1-valid function
and a non C-closed function, it also perfectly implements $\F$ and $\T$ (by
Lemma~\ref{lem:non01}, Part 2).
This leaves the function $\bor_1$. It is easily seen that
$\bor_1(x,y)$ is perfectly implemented by the constraints
$\bor_2(x,z)$ and $\bor_0(y,z)$.
The A-reduction now follows from Lemma~\ref{lem:imp-mincsp}.
\end{proof}


\begin{lemma}
[\nearestcp\ containment]
\label{lem:cont-ncp}
\label{lem:mincsp-ncp-easy}
For any family \calf\ that is affine, the family
$\{\myxor_3,\myxnor_3\}$
perfectly implements every function in $\calF$,
and thus \wmincspf\ $\ared$ \nearestcp.
\end{lemma}
\begin{proof}
It suffices to show perfect implementation of the basic affine constraints,
namely,
constraints of the form $\myxnor_p$ and
$\myxor_q$ for every $p,q \geq 1$. We focus on
the former type as the implementation of the latter is analogous.
First, we observe that the constraint $\rep(x_1,x_2) = \myxnor_2(x_1,x_2)$
is
perfectly implemented by the constraints
$\{
\myxnor_3(x_1,x_2,z_1),\allowbreak
\myxnor_3(x_1,x_2,z_2),\allowbreak
\myxnor_3(x_1,x_2,z_3),\allowbreak
\myxnor_3(z_1,z_2,z_3)\}$
Next, the constraint $\F(x_1)$ can be perfectly implemented by
$\{
\rep(x_1, z_1), \allowbreak
\rep(x_1, z_2), \allowbreak
\rep(x_1, z_3), \allowbreak
\myxnor_3(z_1, z_2, z_3)\}$
Finally, the constraint $\myxnor_p(x_1,\ldots,x_p)$
for any $p > 3$ can be perfectly implemented as follows.
We introduce the following set of constraints using
the auxiliary variables $z_1, z_2,...,z_{p-2}$ and
the set of constraints:
$$\{
\myxnor_3(x_1, x_2, z_1),\allowbreak
\myxnor_3(z_1, x_3, z_2),\allowbreak
\myxnor_3(z_2, x_4, z_3),\allowbreak
\ldots,\myxnor_3(z_{p-2}, x_{p-1}, x_p)
\}$$
\end{proof}


\begin{lemma}
[\horn\ containment]
\label{lem:cont-horn}
\label{lem:mincsp-horn-easy}
For any family \calf\ that is weakly positive
the family $\{ \bor_{3,1},\F,\T \})$ perfectly
implements every function in \calf\ and thus
\wmincspf\ $\ared$ \horn.
\end{lemma}

\begin{proof}
As usual it suffices to perfectly implement every function in the
basis $\{\bor_{k,0}\} \cup \{\bor_{k,1}\}$.
The constraint
$\bor_0(x,y)$ is perfectly implemented by the constraints
$\bor_{3,1}(a,x,y)$ and $\T(a)$.
$\bor_{2,1}(x,y)$ is perfectly implemented by
$\bor_{3,1}(x,y,a)$ and $\F(a)$.
The perfect implementation of $\bor_{3,0}(x,y,z)$ is
$\bor_0(x,a)$ and $\bor_{3,1}(a,y,z)$
(the constraint $(a \vee x)$,
in turn, may be implemented with the already shown method).
Thus every $k$-ary constraint, for $k\leq 3$ can be
perfectly implemented by the family $\{ \bor_{3,1}, \F,\T\})$.
For $k \geq 4$, we use the textbook reduction from \sat\ to 3\sat\
(see e.g. \cite[Page 49]{GareyJ-79}) and we observe that when applied
to $k$-ary weakly positive constraints it yields a perfect
implementation
using only 3-ary weakly positive constraints.
\end{proof}

To conclude this section we describe the trivial
approximation algorithms for \nearestcp\ and \horn.
They follow easily from Proposition~\ref{prop:mincsp-polyapx-easy}
and the fact that both families are decidable.

\begin{corollary}[to
Proposition~\protect\ref{prop:mincsp-polyapx-easy}]
\label{cor:mincsp-polyapx-easy}
\horn\ and \nearestcp\ are in \polyapx.
\end{corollary}



\subsection{Hardness Results (Reductions) for \mincsp}
\label{ssec:mincsp-hard}

\begin{lemma}[\apx-hardness]
\label{lem:apx-hard}
If \calf\ is not 0-valid or 1-valid or 2-monotone
and \calf\ is \setcoverB, then
\mincspf\ is \apx-hard.
\end{lemma}

\begin{proof}
The proof essentially follows from
(the only if part of)
Theorem~\ref{apx thm}
in combination
with Proposition~\ref{prop:abs-apx-csp}. We show that for every $\calf$,
\maxcspf\ AP-reduces to \mincspf. Let $\calI$ be an instance
of \maxcspf\ on $n$ variables and $m$ constraints. Let $\vecx'$ be
a solution satisfying $m/k$ constraints that can be found in
polynomial time (by Proposition~\ref{prop:abs-apx-csp}).
Let $\vecx''$ be an $r$-approximate solution to the
same instance $\calI$ viewed as an instance of \mincspf.
If $\opt$ is the optimum solution to the maximization problem $\calI$,
then $\vecx''$ satisfies at least $m - r(m - \opt) = r \opt - (r-1) m$
constraints.
Thus the better of the two solutions is an $r'$-approximate
solution to the instance $\calI$ of \maxcspf, where
\begin{eqnarray*}
r' & \leq & { \opt \over \max\{ m/k, r \opt - (r-1) m\} } \\
& \leq  & { ((r-1)k + 1) \opt \over (r-1)k(m/k) +  r \opt - (r-1) m} \\
& = & \frac{1 + (r-1) k}{r} \\
& \leq & 1 + (r-1) k
\end{eqnarray*}
Thus \maxcspf\ AP-reduces to \mincspf. The lemma follows from
the \apx-hardnes of \maxcspf\ (Theorem~\ref{apx thm}).
\end{proof}


\begin{lemma}[\minuncut-hardness]
\label{lem:minuncut-hard}
\label{lem:mincsp-uncut-hard}
If $\calF$ is affine with width $2$, but not
$0$-valid or $1$-valid or $2$-monotone or IHS-B,
then \mincspf\ is \minuncut-hard.
\end{lemma}

\begin{proof}
Recall that $\minuncut$-hardness
requires that \mincsp$(\myxor)$ be A-reducible to \mincspf.
In turn, it suffices to show that $\calf$ perfectly implements
$\myxor$.

If $\calf$ is C-closed, then by Part 1 of Lemma~\ref{lem:non01},
we have that $\calf$ implements $\myxor$. So we may assume
$\calf$ is not C-closed.
In such a case, by Part 2 of Lemma~\ref{lem:non01},
we have that $\calF$ implements
both $\F$ and $\T$. By Lemma~\ref{W2A non ISBN}, we now have that
$\calf$ perfectly implements $\myxor$.
\end{proof}

%\subsection{The \cnf-hard Case}


\begin{lemma}[\mincnf-hardness]
\label{lem:min2cnf-hard}
\label{lem:mincsp-2cnf-hard}
If $\calF$ is a bijunctive family that is not
$0$-valid or $1$-valid or \setcoverB or affine with width $2$,
then
\mincspf\ is \mincnf-hard.
\end{lemma}
\begin{proof}
Recall that we wish to show that $\mincsp(\{\bor_0,\bor_2\}$
A-reduces to $\mincspf$; or in other words $\calf$ perfectly
implements $\bor_0$ and $\bor_2$.

By Lemma~\ref{2cnf and C-closed}, we have
that every bijunctive family that is C-closed is affine with
width 2.
Since \calf\ is not affine, we have that it is not C-closed.
Since \calf\ is not 0-valid or 1-valid, it perfectly implements
both $\F$ and $\T$ (by Part 2 of Lemma~\ref{lem:non01}).
Applying Lemmas~\ref{2CNF non ISBN} we have that $\calf$ perfectly
implements $\{\bor_0,\bor_2\}$ or it perfectly implements $\myxor$.
In the first case, we are done, else we use the fact that $\calf$
is not affine with width 2. By Lemma~\ref{char w2a},
this implies that $\calf$
is not affine (since every bijunctive function that is affine
has width $2$). Thus using Lemma~\ref{non_affine},
we have that $\calf$
perfectly implements one of the three functions $\bor_0,\bor_1,\bor_2$.
Combined with $\myxor$, any of these functions perfectly implements
both the functions $\bor_0$ and $\bor_2$.
\end{proof}

%\subsection{The \ncp-hard Case}

\begin{lemma}
[\nearestcp-hardness]
\label{lem:ncp-hard}
If $\calF$ is affine but not
$0$-valid or $1$-valid or affine with width $2$, then
\mincspf\ is $\nearestcp$-hard.
\end{lemma}

\begin{proof}
By Lemma~\ref{lem:char-affine3}
we know that in this case $\calF$ perfectly implements
the constraint $x_1 \oplus \cdots \oplus x_p = b$ for some $p \geq 3$ and some
$b \in \{0,1\}$. Thus the family $\calF \cup \{\F,\T\}$ perfectly
implements the functions
$x \oplus y \oplus z = 0,
x \oplus y \oplus z = 1$.
Thus $\nearestcp = $\mincsp$(\{
x \oplus y \oplus z = 0,
x \oplus y \oplus z = 1\}$ is A-reducible to
\mincsp$(\calF \cup \{\F,\T\})$.
Since $\calF$ is neither 0-valid nor 1-valid, we can use
Lemma~\ref{lem:bgs-like}
to conlude that \mincsp$(\calF)$ is $\nearestcp$-hard.
\end{proof}

The next lemma describes the best known hardness of approximation
for the \nearestcp\ problem.
The result relies on
an assumption stronger than $\np \ne \p$.

\begin{lemma}{\rm \cite{ABSS93}} \label{lem:abss}
For every $\epsilon > 0$,
$\nearestcp$ is hard to approximate to within a factor of
$\Omega(2^{\log^{1-\epsilon} n})$, unless $\np$ has
deterministic algorithms running in time $n^{\log^{O(1)}n}$.

\end{lemma}
\begin{proof}
The required hardness of the nearest codeword problem is shown by
Arora et al.~\cite{ABSS93}. The nearest codeword problem, as
defined in Arora~et al., works with the following problem:
Given a $m \times n$ matrix $A$ and a $m$-dimensional vector $b$,
find an $n$-dimensional vector $x$ which minimizes
the Hamming distance between $Ax$ and $b$. Thus
this problem can be expressed as
a \mincsp\ problem with $m$ affine constraints over $n$-variables.
The only technical point to be noted is that these constraints have
unbounded arity.  In
order to get rid of such long constraints, we replace a constraint
of the form
$x_1 \oplus \cdots \oplus x_l = 0$
into $l-2$ constraints $x_1 \oplus x_2 \oplus z_1 = 0$,
$z_1 \oplus x_3 \oplus z_2 = 0$, etc. on auxiliary variables
$z_1,\ldots,
z_{l-3}$. (The same implementation was used in
Lemma~\ref{lem:cont-ncp}.)
This increases the number of constraints by a factor of at most
$n$, but does
not change the objective function. Thus if $M$ represents the number
of constraints in the new instance of the problem, then the approximation
hardness which is $2^{\log^{1 - \epsilon} m}$ can be expressed as
$2^{\frac12 \log^{1-\epsilon} M}$ which is still growing faster
than, say, $2^{\log^{1 - 2\epsilon} M}$. Since the result of \cite{ABSS93}
holds for every positive $\epsilon$, we still get the desired result
claimed above.
\end{proof}



%\subsection{The \chorn-hard Case}

%The proof of the above lemma appears in Appendix~\ref{app:hard-csp}.
It remains to see the \horn-hard case.

\begin{lemma}
\label{lem:nonC-closed}
\label{lem:mincsp-horn-hard1}
If $\calf$ is a C-closed family that is weakly positive or
weakly negative, then $\calf$ is a $\setcoverB$ family.
\end{lemma}

\begin{proof}
Let $f$ be a weakly positive (weakly negative)
C-closed function.
We claim that all
of $f$'s maxterms must be of the form $\T(x_i)$, $\F(x_i)$ or
$\bor_{1}(x_i,x_j)$. If not, then since $f$ is C-closed,
the maxterm involving the complementary literals is also
a maxterm of $f$, but the complementary maxterm is not
weakly positive (and by Lemma~\ref{lem:char-horn2} every maxterm
of $f$ must be weakly positive).
But if all of $f$'s maxterms are of the form $\T(x_i)$, $\F(x_i)$ or
$\bor_{2,1}(x_i,x_j)$, then $f$ is in $\setcoverB$.
\end{proof}


\begin{lemma}
[\horn-hardness]
\label{lem:horn-hard}
If $\calF$ is weakly positive or weakly negative
but not
0-valid or 1-valid or affine or bijunctive or \setcoverB$-$
or \setcoverB$+$, then
\mincsp$(\calF)$ is \horn-hard.
\end{lemma}

\begin{proof}
By Lemma~\ref{lem:nonC-closed}, we have that $\calf$ is not C-closed.
Thus $\calf$ perfectly implements both $\T$ and $\F$.
 From Lemma~\ref{WN non ISBN} we now have that $\calf$ perfectly implements
$\bor_{3,1}$ or $\bor_{3,2}$. In the former case we have implemented
every function in $\horn = \{\bor_{3,1},\F,\T\}$ and so we are
done (using Lemma~\ref{lem:imp-mincsp}).
In the latter case, we obtain an $A$-reduction from
$\wmincsp(\{\bor_{3,2},\F,\T\}$ to $\wmincspf$. This is good
enough, since we can now use
Proposition~\ref{prop:imp-fminus}
which shows that \wmincsp$(\{\bor_{3,1}, \F,\T\})$
A-reduces to \wmincsp$(\{\bor_{3,2},\F,\T\})$,
which in turn A-reduces to
\wmincspf.
Weights can be removed as usual using Lemma~\ref{lem:weight-remove}.
\end{proof}

The problem \horn\ may be shown to be
``hard'' to
approximate to within a factor
of $2^{\log^{1-\epsilon} n}$
by reducing from a variant of the
the ``label cover'' problem introduced by
\cite{ABSS93}
(see \cite{KhannaST-97} and the references therein.)


\begin{lemma}
\label{lem:labelcover-hard}
For every $\epsilon > 0$,
\horn\ is \np-hard to approximate to within a
factor of $2^{\log^{1-\epsilon} n}$.
\end{lemma}



\section{The Class ({\sf Weighted}) $\minone$}
\label{sec:minone}


Here we prove the following classification theorem
for the class $\minone$.

\begin{theorem}
[\minone\ Classification Theorem {\rm \cite{KhannaST-97}}]
\label{thm:main-minone}
For any constraint set $\calF$, the problem
({\sf Weighted}) \minonef\ is either
in \po\ or \apx-complete or \nearestcp-complete or \horn-complete or
\polyapx-complete or the decision problem is \np-hard. Furthermore,
\begin{enumerate}
\item
\label{case:minone-one}
If $\calF$ is $0$-valid or weakly negative or width-$2$ affine,
then ({\sf Weighted}) \minonef\ is in \po.
\item
\label{case:minone-two}
Else if $\calF$ is bijunctive or \setcoverB\
then ({\sf Weighted}) \minonef\ is \apx-complete.
\item
\label{case:minone-three}
Else if $\calF$ is affine then \minonef\ is \nearestcp-complete.
\item Else if \calf\ is weakly positive
then ({\sf Weighted}) \minonef\ is \horn-complete.
\item
\label{case:minone-four}
Else if $\calF$ is $1$-valid
then \minonef\ is \polyapx-complete.
and \wminonef\ is
decidable but hard to approximate to within any factor.
\item
\label{case:minone-five}
Else finding any feasible solution to ({\sf Weighted}) \minonef\ is \np-hard.
\end{enumerate}
\end{theorem}


\subsection{Preliminaries: \minone\ vs. \mincsp}
\label{ssec:minone vs mincsp}

We start with the following easy relation
between \mincsp\ and \minone\ problems.
Recall that a family $\calf$ is decidable if
membership in $\sat(\calf)$ is decidable in polynomial time.

\begin{proposition}
\label{pr:minone vs mincsp}
\label{prop:minone-prelim1}
For any decidable constraint family \calf,
\wminonef\ AP-reduces to \wmincsp$(\calf \cup \{F\})$.
\end{proposition}

\begin{proof}
Let $\x$ be an instance of \wminonef\ over variables
$x_1,\ldots,x_n$ with weights $w_1,\ldots,w_n$. Let $w_{\max}$
be the largest weight. We construct an instance $\x'$ of
\wmincsp$(\calf \cup \{F\})$ by
leaving the constraints of $\x$  (each with weight $n w_{\max}$),
and adding a constraint $F(x_i)$ of weight $w_i$ for any $i =
1,\ldots,n$.
Notice that whenever $\x$ is feasible, the optimum value for
$\x$ equals the optimum value for $\x'$. Given a $r$-approximate
solution to $\vecx$ to $\x'$, we check to see if $\x$ is feasible
and if so find any feasible solution $\vecx'$ and output
solution (from among $\vecx$ and $\vecx'$)
that achieves a lower objective. It is clear that
the solution is at least an $r$-approximate solution if $\x$ is
feasible.
\end{proof}

Reducing a \mincsp\ problem to a \minone\ problem is slightly
less general.

\begin{proposition}
\label{pr:mincsp vs minone}
\label{prop:minone-prelim2}
 \mbox{}
For any function $f$, let $f'$ and $f''$ denote the functions
$f'(\vecx, y) = \myor(f(\vecx),y)$
and $f''(\vecx,y) = \myxor(f(\vecx),y)$ respectively.
If constraint families $\calf$ and $\calf'$ are such
that for every $f \in \calf$, $f'$ or $f''$ is in $\calf'$,
then \wmincspf\ AP-reduces to \wminone$(\calf')$.
\end{proposition}

\begin{proof}
Given an instance $\x$ of \wmincspf\ we create an
instance $\x'$ of \wminone$(\calf')$ as follows:
For every constraint $C_j$ we introduce an auxiliary
variable $y_j$.
The variable takes the same weight as
the constraint $C_j$ in $\x$.
The original variables are retained with weight zero.
If the constraint $C_j(\vecx) \vee y_j$ is a constraint of
$\calf'$ we apply that constraint, else we apply the constraint
$C_j(\vecx) \oplus y = 1$.
Given an assignment to the variables of $\x$, notice
that by setting $y_j = \neg C_j$, we get a feasible
solution to $\x'$
with the same objective value; conversely, a feasible solution
to $\x'$
when projected onto the variables $\vecx$ gives a solution with
the same value to the objective function of $\x$. This shows
that the optimum value to $\x'$ equals that of $\x$ and
that an $r$-approximate solution to $\x'$ projects to give an
$r$-approximate solution to $\x$.
\end{proof}

Finally the following easy proposition is invoked at a few places.

\begin{proposition}
\label{prop:minone-prelim4}
If $\calf$ implements $f$, then $\calf^-$ implements $f^-$.
\end{proposition}

\subsection{Containment Results for \minone}
\label{ssec:con-minone}

\begin{lemma}[\po\ containment]
\label{lm:po}
\label{lem:minone-po-easy}
If \calf\ is 0-valid or 1-valid or affine with width two,
then \wminonef\ is solvable exactly in polynomial time.
\end{lemma}

\begin{proof} Follows from Lemma~\ref{lem:maxone-po-easy}
and from the observation that for any family $\calf$, solving
\wminonef\ to optimality reduces to solving \wmaxone$(\calf^-)$
to optimality.
\end{proof}

\begin{lemma}[\apx\ containment]
\label{lem:cont-apx:ones}
\label{lem:minone-apx-easy}
If \calf\ is bijunctive or \setcoverB, then
\wminonef\ is in \apx.
\end{lemma}

\begin{proof}
For the case when \calf\ is bijunctive,
a 2-approximate algorithm is given by Hochbaum
et al.~\cite{HMNT93}.

Consider now the case when $\calf\ is \setcoverB$.
Here it suffices to consider the case where \calf\ is
\setcoverB$+$, since if $\calf$ is
\setcoverB$-$ then it is weakly negative and by
Lemma~\ref{lem:minone-po-easy}
exact solutions can be found in polynomial time.
By Proposition~\ref{prop:imp-basis}
it is sufficient to consider only basic \setcoverB$+$ constraints.
We use linear-programming relaxations and deterministic rounding.
Let $k$ be the maximum arity of a function in \calf,
we will give a $k$-approximate algorithm.
Let $\phi = \{ C_1,\ldots,C_m \}$ be an instance of \wminonef\ over
variable set $X = \{ x_1,\ldots,x_n \}$
with weights $w_1,\ldots,w_n$. The following is an integer
linear programming formulation of finding the minimum weight satisfying
assigment for $\phi$.

\[
\begin{array}{lll}
{\sf Minimize} & \sum_i w_i y_i\\
\mbox{{\sf Subject to}}\\
& y_{i_1} + \ldots + y_{i_h} \geq 1& \forall (x_{i_1} \vee \ldots \vee
                                    x_{i_h} ) \in \phi\\
& y_{i_1} - y_{i_2} \geq 0 & \forall (x_{i_1} \vee \bar x_{i_2}) \in \phi\\
& y_{i} = 0 & \forall \bar x_{i} \in \phi\\
& y_{i} = 1 & \forall  x_{i} \in \phi\\
& y_{i} \in \{ 0,1 \} & \forall i \in \{ 1,\ldots,n \}
\end{array} \hspace{40pt} \mbox{\rm (SCB)}
\]

Consider now the linear programming relaxation obtained by relaxing
the $y_{i} \in \{ 0,1 \}$ constrains into $0 \leq y_{i} \leq 1$. We first
find
an optimum solution $\bf y^*$ for the relaxation, and then we define
a 0/1 solution by setting $y_i =0$ if $y_i^* < 1/k$, and $y_i =1$ if $y_i^*
\geq 1/k$. It is easy to see that this rounding increases the cost of the
solution at most $k$ times and that the obtained solution is feasible
for (SCB).
\end{proof}

\begin{lemma}
[\nearestcp\ containment]
\label{lem:cont-ncp:ones}
\label{lem:minone-ncp-easy}
For any affine family $\calf$, the problem \wminonef\ is
A-reducible to $\nearestcp$.
\end{lemma}

\begin{proof}
 From Lemmas~\ref{lem:cont-ncp}~and~\ref{lem:imp-one}
we have that \wminonef\ is A-reducible to
\wminone$(\{\myxnor_3,\myxor_3\})$.
 From Proposition~\ref{pr:minone vs mincsp},
we have that
\wminone$(\{\myxnor_3,\myxor_3\})$
A-reduces to
\wmincsp$(\{\myxor_3,\myxnor_3,F\})$.
Notice further that the family $\{\myxnor_3,\myxor_3\}$
can implement $F$ (by Lemma~\ref{non-C-closed}).
Thus we have that
we have that \wminonef\ A-reduces to
\wmincsp$(\{\myxor_3,\myxnor_3,\})$
which is the $\nearestcp$ problem.
\end{proof}

\begin{lemma}
[\horn\ containment]
\label{lem:cont-horn:ones}
\label{lem:minone-horn-easy}
For any weakly positive family $\calf$,
\wminonef\ A-reduces to \horn.
\end{lemma}

\begin{proof}
Follows from the following sequence of assertions:
\begin{enumerate}
\item
$\{ \myor_{3,1}, \F, \T \}$ perfectly implements $\calf$
(Lemma~\ref{lem:mincsp-horn-easy}).
\item
\wminonef\ A-reduces to \wminone$(\{ \myor_{3,1}, \F, \T\})$
(Lemma~\ref{lem:imp-one}).
\item
\wminone$(\{ \myor_{3,1}, \F, \T \})$ AP-reduces to
\wmincsp$(\{ \myor_{3,1}, \F, \T \})$ = \horn\ (Proposition~\ref{pr:minone vs
mincsp}).
\end{enumerate}
\end{proof}

\begin{proposition}
[\polyapx\ containment]
\label{prop:minone-rest-easy}
If $\calf$ is decidable
then \minonef\ is in $\polyapx$.
\end{proposition}

\begin{proof}
The proposition follows immediately from the
fact that in this case it is easy to determine
if the input instance is feasible and if so,
if the optimum value is zero. If so we output the
$\vec 0$ as the solution, else we output any
feasible solution. Since the objective is at least
$1$ and the solution has value at most $n$,
this is an $n$-approximate solution.
\end{proof}


\subsection{Hardness Results for \minone}
%\label{sec:hardness-minone}
\label{ssec:minone-hard}

We start by considering the hardest problems first.
The case when $\calf$ is not decidable is immediate.
We move to the case where $\calf$ may be 1-valid, but
not in any other of Schaefer's easy classes.

\begin{lemma}[\polyapx-hardness]
\label{lem:polyapx-hard:ones}
If $\calf$ is not $0$-valid or bijunctive or affine or weakly positive
or weakly negative then
\wminonef\ is hard to approximate to within any factor,
and \minonef\ is \polyapx-hard.
\end{lemma}

\begin{proof}
We first show how to handle the weighted case.
The hardness for the unweighted case will follow easily.
Consider a function $f \in \calf$ which is not
weakly positive.
For such an $f$, there exists assignments $\vec{a}$ and $\vec{b}$
such that $f(\vec{a}) = 1$ and $f(\vec{b}) = 0$ and $\vec{a}$ is zero in every
coordinate where $\vec{b}$ is zero. (Such a input pair exists for every
non-monotone
function $f$ and every monotone function is also weakly positive.)
Now let $f'$ be the constraint obtained from $f$ by restricting it to inputs
where
$\vec{b}$ is one, and setting all other inputs to zero. Then $f'$ is a
satisfiable
function which is not $1$-valid. We can now apply Schaefer's
theorem~\cite{Schaefer-78}
to conclude that \sat($\calf \cup \{f'\}$) is hard to decide. We now reduce an
instance
of deciding \sat($\calf \cup \{f'\}$) to approximating \wminonef.
Given
an instance $\x$ of \sat($\calf \cup \{f'\}$) we create an instance which has
some
auxiliary variables $W_1,\ldots,W_k$ which are all supposed to take
on the value zero. This
in enforced by giving them very large weights. We now replace every occurence
of the
constraint $f'$ in $\x$ by the constraint $f$ on the corresponding variables
with
the $W_i$'s in places which were set to zero in $f$ to obtain $f'$. It is clear
that
if a ``small'' weight solution exists to the resulting \wminonef\ problem,
then $\x$
is satisfiable, else it is not. Thus we conclude it
is NP-hard to approximate \wminonef\
to within any bounded factors.

For the unweighted case, it suffices to observe that by using polynomially
bounded
weights above, we get a \polyapx\ hardness. Further one can get rid of
weights entirely by replicating variables.
\end{proof}

We may now restrict our attention to function
families $\calf$ that are
\wcnf\ or affine or
weakly positive or weakly negative or 0-valid. In
particular, by the containment results shown in the
previous section, in all such cases the problem \wminonef\ is
in \polyapx. We now give a weight-removing lemma
which allow us to focus on showing the hardness of
the weighted problems.

\begin{lemma}%[Weight-removing Theorem]
%\label{th:noweight}
\label{lem:minone-weight-remove}
If $\calf$ is bijunctive or affine or weakly positive or
weakly negative or $0$-valid,
then \wminonef\ AP-reduces to \minonef.
\end{lemma}

\begin{proof}
By Lemma~\ref{lem:weight-remove} it suffices to
verify that \wminonef\ is in \polyapx\ in all
cases. If $\calf$ is weakly negative or 0-valid, then
this follows from Lemma~\ref{lem:minone-po-easy}.
If $\calf$ is bijunctive then this follows
from Lemma~\ref{lem:minone-apx-easy}. If \calf\ is
affine or weakly positive, then it A-reduces to $\nearestcp$ or
$\horn$ respectively
which are
in $\polyapx$ by Corollary~\ref{cor:mincsp-polyapx-easy}.

\end{proof}

Before dealing with the remaining cases,
we prove one more lemma that is useful in dealing
with \minone\ problems.

\begin{lemma}
\label{lem:minone-fremove-hard}
For every constraint set $\calf$ such that $\calf \cup \{\F\}$
is decidable,
\wminone$(\calf \cup \{\F\})$ AP-reduces to \wminonef.
\end{lemma}

\begin{proof}
Given an instance $\x$ of
\wminone$(\calf\cup\{\F\})$ on $n$ variables $x_1,\ldots,x_n$
with weights $w_1,\ldots,w_n$ we create an instance $\x'$ of
\wminonef, on the variables $x_1,\ldots,x_n$ using all the
constraints of $\x$ that are from $\calf$; and for every variable
variable $x_i$  such that $\F(x_i)$ is a constraint of $\x$, we
increase the weight of the variable $x_i$ to $nw_{\max}$ where
$w_{\max}$ is the maximum of the weights $w_1,\ldots,w_n$.
As in Lemma~\ref{prop:minone-prelim1}
we observe that if $\x$ is feasible, then
the optima for $\x$ and $\x'$ are equal and given an $r$-approximate
solution to $\x'$ we can find an $r$-approximate solution to $\x$.
Furthermore, since $\calf\cup\{\F\}$ is decidable, we can decide whether or
not $\x$ is feasible.
\end{proof}

We now deal with the affine problems.

\begin{lemma}[\nearestcp-hardness]
\label{lem:ncp-hard:ones}
\label{lem:minone-ncp-hard1}
If \calf\ is affine but not width-$2$ affine or $0$-valid then
\minone$(\myxor_3)$ is AP-reducible to \wminonef.
\end{lemma}

\begin{proof}
Notice that since $\calf$ is affine, so is $\calf^-$.
Furthermore, $\calf^-$ is neither  width-2 affine nor 1-valid.
Thus,
by Lemma~\ref{lem:why},
$\calf^-$ perfectly implements
either the family $\{\myxnor_3\}$
or the family $\{\myxor,\myxnor_4\}$.
Thus, by applying Proposition~\ref{prop:minone-prelim4},
we get that $\calf$ implements either $\myxor_3$ or the family
$\{\myxor,\myxnor_4\}$. In the former case, we are
done (by Lemma~\ref{lem:imp-one}). In the latter case,
notice that the constraints $\myxnor_4(x_1,x_2,x_3,x_5)$
and $\myxor(x_4,x_5)$ perfectly implement the constraint
$\myxor_4(x_1,x_2,x_3,x_5)$. Thus we conclude that
\wminone$(\myxor_4)$ is AP-reducible to \wminonef.
Finally we use Lemma~\ref{lem:minone-fremove-hard} to
conclude that the family \wminone$(\{\myxor,\F\})$
is AP-reducible to \wminonef. The lemma follows from
the fact that $\myxor_3(x_1,x_2,x_3)$
is perfectly implemented by the constraints
$\myxor_4(x_1,x_2,x_3,x_4)$ and $\F(x_4)$.
\end{proof}

\begin{lemma}
\label{lem:minone-ncp-hard}
If \calf\ is affine but not width-$2$ affine or $0$-valid then,
for every $\epsilon > 0$,
\minonef\ is
\nearestcp-hard and
hard to approximate to within
a factor of $\Omega(2^{\log^{1 - \epsilon} n})$.
\end{lemma}

\begin{proof}
Follows from the following sequence of reductions:
\begin{eqnarray*}
\lefteqn{\nearestcp} \\
& = & \mbox{\wmincsp}(\{\myxor_3,\myxnor_3\}) \\
& \apred & \mbox{\wminone}(\{\myxor_4,\myxnor_4\})
\mbox{ (using Proposition~\ref{prop:minone-prelim2})} \\
& \apred & \mbox{\wminone}(\{\myxor_3,\myxor\})
\mbox{ (see below) } \\
& \apred & \mbox{\wminone}(\myxor_3)
\mbox{ (using Lemma~\ref{lem:minone-fremove-hard}) }
\\ & \apred & \mbox{\wminonef}
\mbox{ (using Lemmas~\ref{lem:minone-ncp-hard1}~and~\ref{lem:imp-one}) } \\
& \apred & \mbox{\minonef}
\mbox{ (using Lemma~\ref{lem:minone-weight-remove}.) }
\end{eqnarray*}
The second reduction above follows by combining
Lemma~\ref{lem:imp-one}
with the observation that the family
$\{\myxor_3,\myxor\}$ perfectly implement the functions
$\myxor_4$ and $\myxnor_4$ as shown next.
The constraints $\myxor_3(u,v,w)$ and $\myxor_3(w,x,y)$
perfectly implement
the constraint $\myxnor_4(u,v,x,y)$;
the constraints $\myxor_4(u,v,w,x)$ and $\myxor(w,y)$
perfectly implement $\myxor_4(u,v,x,y)$.
The hardness of approximation
of \nearestcp\ follows from
Lemma~\ref{lem:abss}.
\end{proof}

\begin{lemma}[\horn-hardness]
\label{lm:label cover red}
\label{lem:minone-horn-hard}
If \calf\ is weakly positive but not \setcoverB\ or $0$-valid then
\minonef\ is \horn-hard,
and hence hard to approximate within
$2^{\log ^{1-\epsilon} n}$ for any $\epsilon >0$.
\end{lemma}

\begin{proof}
Notice that in this case we know that $\calf \cup \{\T,\F\}$
perfectly implements $\bor_{3,1}$. The lemma now
follows from the following sequence of reductions:
\begin{eqnarray*}
\lefteqn{\mbox{\horn}} \\
& = & \mbox{\wmincsp}(\{\myor_{3,1},\T,\F\} \\
& \apred & \mbox{\wminone}(\{\myor_{4,1},\myor_2,\myor_{2,1}\})
\mbox{ (Using Proposition~\ref{prop:minone-prelim2}.)} \\
& \apred & \mbox{\wminone}(\{\myor_{3,1},\T,\F\})
\mbox{ (Using Lemmas~\ref{lem:mincsp-horn-easy}~and~\ref{lem:imp-one}.)}\\
& \apred & \mbox{\wminone}(\calf \cup \{\T,\F\})
\mbox{ (Using
Lemmas~\ref{WN non ISBN}~and~\ref{lem:imp-one}.) }  \\
& \apred & \mbox{\wminone}(\calf \cup \{\F\})
\mbox{ (Using Lemma~\ref{lem:non01}, Part 2,
to perfectly implement $\T$.) } \\
& \apred & \mbox{\wminonef}
\mbox{ (Using Lemma~\ref{lem:minone-fremove-hard}.) } \\
& \apred & \mbox{\minonef}
\mbox{ (Using Lemma~\ref{lem:weight-remove}.) }
\end{eqnarray*}
The hardness of approximation
follows from Lemma~\ref{lem:labelcover-hard}.
\end{proof}


\begin{lemma}
\label{lem:minone-apx-hard1}
\minone$(\bor_0)$ is \apx-hard.
\end{lemma}

\begin{proof}
We reduce \minvc\ to \minone$(\bor_0)$. Given a graph
$G$ on $n$ vertices, we construct an instance of \minone$(\bor_0)$
on $n$ variables $x_1,\ldots,x_n$. For every edge between vertex
$i$ and $j$ of $G$, we create a constraint $\bor_0(x_i,x_j)$. We
notice that there is a one-to-one correspondence between an
assignment to the variables and vertex covers in $G$ (with variables
assigned 1 corresponding to vertices in the cover) and the minimum
vertex cover minimizes the sum of the variables. The lemma
follows from the fact that $\minvc$ is \apx-hard \cite{py,almss}.
\end{proof}

\begin{lemma}[\apx-hardness]
\label{lem:apx-hard:ones}
\label{lem:minone-apx-hard}
If $\calf$ is not
$0$-valid or weakly negative or affine with width $2$, then
\minonef\ is \apx-hard.
\end{lemma}

\begin{proof}
We first make some simplifying observations.
First, we can assume \calf\ is not affine, since
the case when \calf\ was affine was shown to be
\nearestcp-hard in
Lemma~\ref{lem:minone-ncp-hard}.
By Lemma~\ref{lem:weight-remove} it suffices to show
that \wminonef\ is \apx-hard.
By Lemma~\ref{lem:minone-fremove-hard} it suffices to show that
\wminone$(\calf \cup \{\F\})$ is \apx-hard.
Since $\calf\cup\{\F\}$ is not 0-valid or 1-valid or C-closed it
implements every function in
$\calf\cup\{\F,\T\}$ (by Part 2 of Lemma~\ref{lem:non01}).
Thus it suffices to show \apx-hardness of \wminone$(\calf \cup
\{\F,\T\})$ for a non-affine and non-weakly negative family $\calf$.
In turn it suffices to show that $\calf \cup \{\F,\T\}$ perfectly
implements the function $\bor_0$.

Using the fact that $\calf$ is not weakly negative
(and applying Lemma~\ref{non_weak+_non_weak-})
we have that $\calf \cup \{\F,\T\}$
perfectly implements either $\bor_0$ or $\myxor$.
In the former case, we are done. In the latter
case, we use the fact that $\calf$ is not affine
to get a perfect implementation of one of the functions
$\bor_0,\bor_1$ or $\bor_2$. Combined with the $\myxor$
function, any of these functions gives a perfect implementation
of the function $\bor_0$.
\end{proof}

\iffalse
\bigskip
\begin{remark}
Reith and Vollmer \cite{ReithV-98} studied the problem of finding the
lexicographically smallest  assignment satisfying an $\calF$-collection of
constraint applications. They also get a dichotomy classification
$\p$/$\optp$-complete (\cite{Krentel-88}).
\end{remark}


\fi


%\include{input_constrained_csp}



\chapter{Input-Restricted Constrained Satisfaction Problems}
\label{Input Restricted Constrained Satisfaction Problems}


So far we have seen that for NP-hard optimization problems in our framework
even the goal of finding near-optimal solutions turns out to be
intractable. In particular, any optimization problem
that is not in $\po$, turns out to be at least $\apx$-hard.
An interesting question is if there are restricted
versions of our optimization problems that are hard to solve optimally and
``easy'' to approximate --- a notion that we formalize by the existence
of polynomial time approximation schemes ($\ptas$).
One natural way of creating a restricted version of a problem is
to limit its space of input instances.
In this chapter, we study two widely different input restrictions for
optimization problems. These restrictions are mutually exclusive and
for each one of them we will show that
the restricted classes of optimization problems contain many $\np$-hard
problems that exhibit a $\ptas$.

The first restriction that we study is expressed in terms of the
graph-theoretic
property of {\em planarity}.
At a first glance, our input instances do not appear to have any
graph-theoretic structure. But as it turns out, there is a natural
way of associating a graph with each input instance. Informally, the
graph contains a vertex for each constraint application and each
variable, and there is an edge between a ``variable'' vertex and a
``constraint'' vertex if the constraint contains the variable.
We will study the behaviour of our optimization problems restricted to
input instances with planar associated graphs.
While the planarity restriction strongly constrains the interaction between
various constraint applications, somewhat surprisingly, one can show
the classification theorem for $\sat$ problems largely remains unaltered
under this restriction. We will identify broad subclasses of planar
input-restricted problems that exhibit a $\ptas$.

The second input-restriction that we study is referred to as the {\em density}
restriction. We say that an $\calf$-collection of
constraint applications on $n$ variables is dense if it
contains essentially a largest number possible (modulo constant factors)
of constraint applications for the family $\calf$. The density restriction
is in striking contrast to the planarity restriction above in that it
seems to enforce a strong interaction between constraint applications.

\section{The Planarity Restriction}

In order to formally define planar input-restricted instances of constraint
satisfaction problems, we introduce the notion of an {\em incidence graph}.

\begin{definition}[Incidence Graph]~
Let $\calC$ be a collection of constraint applications $f_1,f_2,...,f_m$
defined
over $n$ variables $x_1,x_2,\cdots,x_n$. Then, the {\em incidence graph} of
 $\calC$ is an undirected graph $G = (V,E)$, is defined as follows:
\begin{itemize}
\item
$V$ contains a vertex $F_i$ for each constraint application $f_i$ and a
vertex $X_j$ for each variable $x_j$, and

\item
$E$ contains an edge $(F_i,X_j)$ whenever the variable $x_j$ occurs in the
constraint application $f_i$.
\end{itemize}
\end{definition}

An input instance  $\calC$ is called {\em planar} if the incidence graph of
$\calC$ is planar. Let ${\cal S}$ be one of the classes $\sat$,
$\csp, \maxone, \minone$ or $\mincsp$. Then $\planar$ ${\cal S}$
refers to the class ${\cal S}$ with input restricted to instances with
planar incidence graphs.
\iffalse
In order to get hardness results for problems restricted to planar instances
there are essentially  two  kinds of methods. Either there are two
stages, the first stage is the proof of hardness for general instances, the
second is the construction of a complicated crossover box which is added to the
nonplanar reduction everywhere two arcs cross. Otherwise it consists in a
planarity-preserving reduction from a known hard planar  problem. Seeing how
complicated the crossover boxes are in the proof of $\np$-hardness for
$\planar~\tsat$ ~\cite{lichtenstein} for instance, it is clear that trying
to get
general  hardness results for planar constraint satisfaction problems in using
the first method is far beyond the scope of this monograph. Using the second
method suppose to know a  hard planar  problem that can be used as a basis in
reductions. For this reason we will only present hardness results for decision
problems. (For instance for counting problems very few results are known.
As far
as we know the only results on the hardness of planar counting problems are due
to Hunt
{\em et al} \cite{HuntMRS-98} who proved among others the $\#\p$-hardness of
$\planar~\#\sat(\{\oneinthree\})$. But nothing is known on the
complexity of $\planar~2$-$\sat$.)
\fi
We start by showing that the planarity restriction does not seem to
significantly alter the complexity of decision problems. In particular,
we can adapt the proof of Theorem \ref{satisfiability_theorem} to obtain
the following analogue for \planar~$\sat(\calF)$.

\begin{theorem}\label{Planar-decision-theorem}
For any constraint family $\calF$, if $\sat(\calF)$ is $\np$-complete
then \planar\ $\sat(\calF\cup\{\F,\T\})$ is $\np$-complete as well.
Furthermore, if $\calF$ is non-C-closed then  \planar\  $\sat(\calF)$ is
$\np$-complete whenever $\sat(\calF)$ is $\np$-complete.
\end{theorem}
\begin{proof}
Let $\calF$ be a constraint family such that $\sat(\calF)$ is
$\np$-complete. Then by Lemma~\ref{hardness lemma}, we know that
$\sat(\{\oneinthree\})$ can be reduced to $\sat(\calF\cup\{\F,\T\})$.
It is known that \planar\  $\sat(\{\oneinthree\})$ is
$\np$-complete~\cite{DyerF-86}.
Thus to prove the first part of the theorem it
suffices to show that the reduction given by Lemma~\ref{hardness lemma}
is planarity preserving. Since the reduction simply replaces each
constraint application of the form $\oneinthree(x,y,z)$ with a
$(\calF\cup\{\F,\T\})$-collection of constraint applications,
it suffices to prove that the incidence graph of this
implementation has a planar embedding with all three
variables $x$, $y$ and $z$ on the outer face. Since our implementation
is built by composing together a series of implementations, this property
needs to be verified for the entire sequence of implementations.
This can be done in a straightforward manner but the details are tedious
and we omit them here.

Similarly, the second part of the theorem follows from an easy verification
of the fact that
any non-C-closed family $\calF$ can perfectly implement the constraints $\F$
and $\T$
(Lemma~\ref{non0-non1-nonC-closed}) in a planarity-preserving manner.
\end{proof}


\subsection{Planarity and Approximability}

It is clear from Theorem~\ref{Planar-decision-theorem} that planar
restrictions of the classes $\csp$, $\maxone$, $\minone$ and $\mincsp$
continue to capture $\np$-hard optimization problems.
Planar restriction of these classes contain many fundamental
$\np$-hard optimization problems, including
\planar\ $\mtsat$ ~\cite{lichtenstein}, \planar\ $\is$ \cite{GareyJS-76}, and
\planar\ $\minvc$ ~\cite{lichtenstein}. We now identify conditions under
which the planar input-restricted problems exhibit a $\ptas$.
We start with a definition.

\begin{definition}[Monotone / Anti-monotone Constraints]~
A constraint function $f$ is called {\em monotone} {\em (anti-monotone)} if
$f$ can be expressed by a Boolean formula that contains only
positive (negative) literals.
\end{definition}

A constraint set $\calF$ is {\em monotone} ({\em anti-monotone}) if
every $f \in \calF$ is monotone (anti-monotone).
The main result of this section is as follows:

\begin{theorem}
{\rm (\cite{hunt,km96})}
\label{thm:planar}
For any constraint family $\calF$, $\planar~\csp(\calF)$ is in $\ptas$.
For any anti-monotone $\calF$, $\planar~\maxone (\calF)$ is in $\ptas$.
For any monotone $\calF$, $\planar~\minone (\calF)$ is in $\ptas$.
\label{thm:input_restricted_planar}
\end{theorem}

Observe that $\planar~\maxone$ confined only to anti-monotone constraint
families captures the $\np$-hard problem $\planar~\is$, and similarly,
$\planar~\maxone$ confined only to anti-monotone constraint families
captures the $\np$-hard problem $\planar~\minvc$.
Thus  \planar\  $\is$ and \planar\  $\vc$,
all have a  $\ptas$.
Notice that we do not indicate any  $\ptas$ results for the class
$\planar~\mincsp$. This is essentially explained by
Theorem~\ref{Planar-decision-theorem} which suggests that the
dichotomy of the class $\sat$ is largely preserved under the planarity
restriction.

Theorem~\ref{thm:planar} is not surprising since it is well-known that
many graph optimization problems that are hard to approximate on general
instances, become significantly easier to approximate on planar graphs.
Lipton and
Tarjan~\cite{lipton2} were the first to present a  $\ptas$ for an $\np$-hard
optimization problem on planar graphs, namely, maximum independent sets
in planar graphs. Subsequently, Chiba, Nishizeki, and
Saito~\cite{chiba} extended this to finding a maximum induced subgraph
satisfying a hereditary property determined by connected components.
Soon after, in a remarkable paper Baker~\cite{baker} developed a powerful
technique
to obtain a  $\ptas$ for a surprisingly large number of $\np$-hard graph
optimization problems.
The proof of Theorem~\ref{thm:input_restricted_planar} builds on Baker's
technique.
In what follows, we start with an overview of Baker's approach in
Section~\ref{sec:input_baker}.
Then in Sections~\ref{sec:planar_csp} and ~\ref{sec:planar_min_maxone},
we establish the $\ptas$ results for
each of $\planar~\csp$, $\planar~\maxone$ and $\planar~\minone$.


\subsection{An Overview of Baker's Technique}
\label{sec:input_baker}

We start by defining a subclass of planar graphs that plays a central
role in Baker's approach.

\begin{definition}[$p$-Outerplanar Graph]~
A {\em 1-outerplanar} graph, or simply an {\em outerplanar} graph, is a
planar graph that has an embedding in the plane with all vertices appearing
on the outer face. A $p$-outerplanar graph is a planar graph that has an
embedding in the plane in which deleting all vertices on the outer face
yields a $(p-1)$-outerplanar graph.
\end{definition}

A useful structural property of outerplanar graphs is as follows.

\begin{lemma}
{\em (\cite{bodlaender88,bodlaender93})}
A $p$-outerplanar graph has a balanced separator\footnote{A {\em balanced
separator} for a graph $G=(V,E)$ is any set $X \subset V$ such that the
graph induced by deleting the vertices in $X$ has no component of size
larger than $2|V|/3$.} of size at most $3p - 1$.
Moreover, for any constant $p$, such a balanced separator can be found by a
linear time algorithm.
\end{lemma}


Baker~\cite{baker} observed that many $\np$-hard optimization problems
can be solved optimally in polynomial time on $O(1)$-outerplanar
graphs. Furthermore, it was observed that for many such problems,
a planar instance can be {\em approximately} reduced to a polynomial-sized
collection of $p$-outerplanar instances for some constant $p$.
Thus an approximate solution to the original instance can be put together
by optimally solving the collection of $O(1)$-outerplanar instances.
We will show that this basic paradigm can be applied to problems
in our optimization classes as well.


\subsection{ $\planar~\csp$}
\label{sec:planar_csp}

We begin by designing a polynomial time algorithm to compute optimal
solutions when the input belongs to the class $p$-$\outerplanar~\csp(\calF)$
for some constant $p$.
Let $k$ denote the maximum arity of a constraint in $\calF$ and
let $G$ denote the incidence graph of a given input instance.
The first step is to find a separator $S$ of size at most $3p-1$ for $G$.
The set $S$ consists of variable vertices as well as the constraint
vertices, and its removal partitions $G$ into two subgraphs $G_1$ and $G_2$.
Let $V(S)$ denote the set of all variables that are either directly present
in $S$ or occur in some constraint that is present in $S$.
We now use a dynamic programming approach as follows.

{\sf
\begin{itemize}

\item Fix a guess $\vec{g}$
of values for the variables in $V(S)$. Let $X[\vec{g}]$ denote the set of
constraints in $G$ that are satisfied by the guess $\vec{g}$ and
let $Y[\vec{g}]$ denote the set of constraints in $G$ that are set to false
by the guess $\vec{g}$.

\item
Remove all vertices in the sets $V(S),~X[\vec{g}]$ and $Y[\vec{g}]$ from
each of $G_1$ and
$G_2$, and
let the resulting graphs be $G_1[\vec{g}]$ and $G_2[\vec{g}]$ respectively.

\item
Recursively compute the optimum values for each of $G_1[\vec{g}]$ and
$G_2[\vec{g}]$.

\item
The optimum value $\opt(G)$ is given by
the guess $\vec{g}$ that maximizes the following sum:
$X[\vec{g}]+\opt(G_1[\vec{g}])+\opt(G_2[\vec{g}])$.

\end{itemize}
}

Observe that since $|V(S)| \le (k+1)(3p-1)$, the number of guesses
tried above is at most $2^{(k+1)(3p-1)}$ which is a constant. Thus if we
denote by $N$ the number of vertices in the graph $G$, the running
time of the above procedure is easily verified to be $N^{2^{O(k
p)}}=N^{O(1)}$.

\begin{lemma}
\label {lem:O(1)_csp}
For any $\calF$, $O(1)$-$\outerplanar~\csp(\calF)$ is contained in $\p$.
\end{lemma}

We now show that the above result can be used to construct a
 $\ptas$ for $\planar~\csp(\calF)$.


\begin{theorem}
\label{thm:wt}
For any $\calF$, $\planar~\csp(\calF)$ is in $\ptas$.
\end{theorem}
\begin{proof}
Let $G$ denote the incidence graph of a given input instance.
We show that for any fixed $\varepsilon > 0$, we can find in polynomial time
a solution whose value is at least $(1-\varepsilon)\opt(G)$.

Assume that the incidence graph $G$ is $t$-outerplanar for
$t \leq n + m$, where $n$ is the number of variables and $m$ is the number
of constraints in the input. Divide the vertices into $t$
levels, called $L_1,\ldots,L_t$, such that $L_t$ corresponds to the
outer face and each level $L_i$ is the outer face obtained by removing the
levels $L_t, \ldots, L_{i+1}$.

Fix any optimal truth assignment, and let $s_i$ denote the {\em weight of the
constraints satisfied} in level $L_i$ by this assignment. Partition the
levels $L_1, \ldots, L_t$
into $p+1$ groups, $S_0, \ldots, S_{p}$, where group $S_r$ is the union of
the levels $L_i$ whose index $i$ is congruent to $3r$, $3r+1$, or $3r+2$
modulo $p'$, where $p' = 3(p +1)$. The value of $p$ will be
specified later. By pigeonhole principle, there exists a group
$S_j$ such that
$$\sum_{L_i \in S_j} s_i \leq {\opt(G) \over p + 1}.$$
This special group $S_j$ may be identified by trying all possible choices
of $j$, and picking the one which yields the best solution. Having fixed
the
choice of $S_j$, delete all vertices in the levels whose index is congruent
to $3j + 1$ modulo $p'$, thereby separating the graph into a collection of
disjoint $(p'-1)$-outerplanar graphs, say $G_1, G_2, \ldots, G_{t'}$,
such that the total optimal value on this collection is at least
$(1 - 1/(p+1)) \times \opt(G)$. Choose $p = \lceil 1/\varepsilon - 1
\rceil$  to
get the desired result.
\end{proof}



\subsection{$\planar~\maxone$ and $\planar~\minone$}
\label{sec:planar_min_maxone}

We will follow essentially the same approach as for $\planar~\csp$.
The following two lemmas can be established in a manner identical
to the proof of Lemma~\ref{lem:O(1)_csp}.

\begin{lemma}
\label{lem:O(1)_maxone}
For any $\calF$, $O(1)$-$\outerplanar~\maxone(\calF)$ and
$O(1)$-$\outerplanar~\minone(\calF)$ are contained in $\p$.
\end{lemma}

We now show how this result can be used to obtain a  $\ptas$ for planar
instances of $\minone(\calF)$ when $\calF$ is monotone.


\begin{theorem}
\label{thm:minone}
For any monotone $\calF$, $\planar~\minone(\calF)$ is in $\ptas$.
\end{theorem}
\begin{proof}
As before, assume that the incidence graph $G$ is $t$-outerplanar for
$t \leq n + m$, where $n$ is the number of variables and $m$ is the number
of constraints in the input. Divide the vertices into $t$
levels, called $L_1,\ldots,L_t$, such that $L_t$ corresponds to the
outer face and each level $L_i$ is the outer face obtained by removing the
levels $L_t, \ldots, L_{i+1}$.

Fix any optimal truth assignment, and let $t_i$ denote the weight of
the variables set to true among the variables that appear in the
constraints at level $L_i$. Partition the
levels $L_1, \ldots, L_t$
into $p+1$ groups, $S_0, \ldots, S_{p}$, where group $S_r$ is the union of
the levels $L_i$ whose index $i$ is congruent to $2r$ or $2r+1$
modulo $p'$, where $p' = 2(p +1)$. The value of $p$ will be
specified later. By pigeonhole principle, there exists a group
$S_j$ such that
$$\sum_{L_i \in S_j} t_i \leq {\opt(G) \over (p + 1)}.$$
This special group $S_j$ may be identified by trying all possible choices
of $j$, and picking the one which yields the best solution. Having fixed
the
choice of $S_j$, delete all the constraint vertices in the levels
represented in $S_j$.
This separates $G$ into a collection of
disjoint $2p$-outerplanar graphs, say $G_1, G_2, \ldots, G_{t'}$,
such that $\sum_{i=1}^{t'} \opt(G_i) \le \opt(G)$. Let $\vec{s}$
denote the assignment to the variables as determined by the union of these
solutions (note that $G_i$'s partition the variables).

But the solution found above needs to be extended to satisfy the
constraints in the layers of the group $S_j$ as well.
To do so, we simply find an optimal solution that satisfies the constraints
in the layers in $S_j$. Let $\vec{s'}$ denote the assignment to variables in
this solution. By our choice of $S_j$, the weight of this solution is no
more than $\opt(G) / (p + 1)$. We now combine the assignments for $\vec s$ and
$\vec{s'}$ into a single assignment as follows: set any variable to true if it
is set to true in either $\vec{s}$ or $\vec{s'}$. Since $\calF$ is monotone,
this modification can not unsatisfy a previously satisfied constraint.
Moreover, the weight of the new solution is at most $(1 +
1/(p+1))\opt(G)$.
Choose $p = \lceil 1/\varepsilon - 1 \rceil$ to get a
$(1+\varepsilon)$-approximation.
\end{proof}
\medskip

The proof of the following theorem is similar to the above proof and is
hence omitted.


\begin{theorem}
\label{thm:maxone}
For any anti-monotone $\calF$, $\planar~\maxone(\calF)$ is in $\ptas$.
\end{theorem}

\section{The Density Restriction}

We now focus on another natural restriction, namely, density.
The notion of dense instances is formalized as follows.

\begin{definition}[Dense Instance]~
Let $\calC$ be a a collection  of $m$ constraint
applications defined over $n$ variables, and let $k$ be the largest arity
of any
constraint in $\calF$. Then we say that
$\calC$ is a {\em dense} instance if $m=\Omega(n^k)$.
\end{definition}

For any $\calF$, we refer to as  {\em $\dense$ $\sat(\calF)$} and {\em $\dense$
$\csp(\calF)$}  the problems $\sat(\calF)$ and $\csp(\calF)$ with input
restricted  to dense instances.
We now show that the density restriction does not alter the
complexity of the underlying decision problems.

\begin{theorem}\label{dense-decision-theorem}
For any constraint set $\calF$,
$\sat(\calF)$ is $\np$-complete if and only if $\dense~\sat(\calF)$ is
$\np$-complete.
\end{theorem}

\begin{proof}
Let $\calC$ be an $\calF$-collection of $m$ constraint applications on
variables
$\vec x=\{x_1,\ldots ,x_n\}$. Construct a dummy $\calF$-collection of
constraints
$\calC'$, which is both dense and satisfiable, as follows.  Let
$\vec x'=\{x'_1,\ldots ,x'_n\}$ be a set of $n$ new
variables and let $f$ be a constraint of largest arity in $\calF$.
Consider the set of all possible constraint applications constructed by
applying $f$ on every $k$-variable subset of $\vec x'$
(there are $\Omega(n^k)$ such  constraint applications). By
Proposition \ref{prop:abs-apx-csp} one can find in polynomial time an
assignment that satisfies at least $\Omega(n^k)$ constraints in this set. Let
$\calC'$ be such a collection of satisfiable constraints. Now
$\calC\cup\calC'$ is a dense instance of $\sat(\calF)$ which is satisfable iff
$\calC$ is satisfiable. Hence $\dense~\sat(\calF)$ is
$\np$-complete.
\end{proof}

The above theorem suggests that our optimization classes contain many problems
that remain hard to solve exactly even when restricted to dense instances.
However density does allow for the possibility that a problem may 
admit a $\ptas$ even if it is hard to solve exactly. For three of
the classes, namely $\maxone$, $\minone$, and $\mincsp$,
even the density condition does not seem to help in getting 
$\ptas$. However for the fourth class, namely $\maxcsp$, density
does turn out to be very helpful.

\iffalse
We next observe that the dense version of
the classes $\maxone$, $\minone$, and $\mincsp$ are unlikely to contain
any $\np$-hard problems that exhibit a $\ptas$.
\mnote{N: i cannot explain why but this theorem seems too strong to me. If we
are not sure of its proof may be we should skip it ...}
\mnote{S: i still believe the original thm to be correct but i changed
it to something we can prove.}
\mnote{M: I too am wary of the theorem below. In order to verify it,
one needs to check that all implementations work out while
maintaining density. Why not leave it vague as above?}

\begin{theorem}
For any constraint family $\calF$,
if $\maxonef$ is $\apx-complete$ then $\dense~\maxonef$ is also
$\apx$-complete. Analogous results hold for the classes
$\dense~\minone$ and $\dense~\mincsp$.
\end{theorem}
\begin{proof}
We use the transformation of Theorem~\ref{dense-decision-theorem}.
For the problem $\dense~\maxonef$ ($\dense~\minonef$) it suffices to
observe that whenever the constraint family $\calF$ satisfies the
$\apx$-completeness conditions for the class $\maxone$ ($\minone$),
it is $\apx$-hard even when restricted to instances which always have
a satisfying solution of value $\Omega(n)$. This follows from the
proofs of Theorem~\ref{thm:main2} (Theorem~\ref{thm:main-minone})
and the fact that any instance of
$\maxcut$ has a solution that contains at least half the edges
($\minvc$ is $\apx$-hard on bounded degree graphs).
Finally, the result follows trivially for $\dense~\mincsp$
since the transformation of Theorem~\ref{dense-decision-theorem}
leaves the total number of satisfiable constraint applications unaltered.
\end{proof}
\fi

We now present our main result here, namely, $\dense~\csp$ is contained
in $\ptas$.
Arora {\em et al}~\cite{AKK} developed a general technique that can be
used to find an {\em additive error} approximation to $\csp(\calF)$.
Specifically, for any fixed $\varepsilon > 0$, their technique can be used
to find a solution to an instance of $\csp(\calF)$ such that the solution
is at most $\varepsilon n^k$ away from the optimal.
On the other hand, according to Proposition
\ref{prop:abs-apx-csp}   there exists a solution of value
$\Omega(n^k)$
for any dense instance of a $\csp(\calF)$ problem.
This latter observation allows one to interpret the additive error
approximation scheme of~\cite{AKK} as a {\em relative error}
scheme for dense instances, giving a $\ptas$ for this
class of instances. 


\begin{definition}[Polynomial Integer Program (PIP)]
A {\em polynomial integer program} refers to an optimization problem
of the form: {\sc Maximize (Minimize)}~$p(x_1,...,x_n)$ such that
$x_i \in \{0,1\}$ for $1 \le i \le n$; here $p$ is a polynomial.
We say that such a program
is a {\em $(c,d)$-PIP} if $p$ is a polynomial of degree at most $d$
and each coefficient of a degree $i$ monomial in $p$ is at most $cn^{d-i}$.
\end{definition}


Even when the parameters $c$ and $d$ are restricted to take only fixed
values, $(c,d)$-PIPs can capture a large variety of NP-hard constraint
satisfaction problems. Arora {\em et al}~\cite{AKK} showed the following result
for approximating $(c,d)$-PIPs.

\begin{theorem}{\rm ~\cite{AKK}}
\label{thm:arora_dense}
Given a $(c,d)$-PIP on $n$ variables where
$c$ and $d$ are constants, and a
fixed $\varepsilon > 0$, there exists a polynomial time algorithm that
finds a solution $(x_1^{*},...,x_n^{*})$ such that
$p(x_1^{*},...,x_n^{*}) \ge \opt - \varepsilon n^d$ where $\opt$ denotes
the optimum value of the PIP.
\end{theorem}

The idea underlying the above result is an exhaustive sampling
technique whereby optimization of a degree $d$ polynomial can
be {\em approximately} reduced to solving an integer linear program.
By relaxing the integrality constraints, one can compute in
polynomial time an optimal fractional solution to this linear program
and then round the fractional solution by the Raghavan and Thompson
rounding technique~\cite{RT87}. A detailed exposition of these steps is
beyond the scope of this monograph and the reader is referred to~\cite{AKK}
for details.

We now show that $\csp(\calF)$ is closely related to $(c,d)$-PIPs.

\begin{proposition}
\label{pro:maxsat_pip}
Let $\calC$ be any instance of $\csp(\calF)$
and let $k$ be the largest arity of any
constraint in $\calF$. Then the problem of finding a
solution satisfying a largest number of constraints in $\calC$
can be expressed as an instance of $(O(1),k)$-PIP.
\end{proposition}
\begin{proof}
It follows from the standard arithmetization technique to express $\calC$
as a polynomial.
\end{proof}


Combining Theorem~\ref{thm:arora_dense} with
Proposition~\ref{pro:maxsat_pip} above, we get our main result.

\begin{corollary}
For any $\calF$, $\dense$ $\csp(\calF)$ is in $\ptas$.
\end{corollary}


%\include{meta_prob}




\chapter{The Complexity of the Meta-problems}
\label{The Complexity of the Meta-problems}


In the previous chapters
we have established classification theorems
which identify properties of the constraint sets that determine
whether or not a problem is tractable. A natural question
is what is the complexity of identifying tractable problems.
In other words, how difficult it is to recognize that the problem specified
by a given constraint set is indeed tractable. The goal of this chapter is
to study this question.
Specifically, let $\C$ denote one of the classes $\sat$, $\#\sat$,
$\qsat$, $\csp$, $\mincsp$, $\maxone$ or $\minone$.
We are interested in studying the following {\em meta-problem}, denoted
by Meta-$\C$:
\smallskip

{\sc Input :}
A constraint set $\calF$.
\smallskip

{\sc Question :}
Is  $\C({\cal F})$ in $\p$?

\smallskip
There are many natural ways of specifying a Boolean function and
the complexity of the meta-problems is directly related to the
manner the functions in the input constraint set are specified.
We will study the above meta-problem for three natural representations:

\begin{itemize}
\item $f$ is specified by its set of satisfying assignments, denoted $\sa(f)$,
\item $f$ is specified by a CNF-formula, and
\item $f$ is specified by a DNF formula.
\end{itemize}

We will show that for each of the above representation schemes,
either the meta-problem is polynomial time solvable for each
one of the classes $\C$ mentioned above, or it is $\conp$-hard for each class.


\section{Representation by the Set of Satisfying Assignments}

Our main result here is the following theorem.

\begin{theorem}
For each class $\C$ in our study, the $\meta$-$\C$ problem is in $\p$
if the input constraint set is specified using the set of satisfying
assignments representation.
\end{theorem}

To establish the above theorem, it suffices to give polynomial time
procedures for recognizing the set of properties described in the
lemma below.

\begin{lemma}
Let $f$ be a constraint function specified by its set of satisfying
assignments. Then the problem of deciding whether $f$ satisfies any one
of the properties below, is in $\p$:

\begin{enumerate}
\item
0-valid (1-valid),

\item
weakly positive (weakly negative),

\item
affine,

\item
bijunctive,

\item
width $2$ affine, and

\item
$2$-monotone.
\end{enumerate}
\end{lemma}
\begin{proof}
It is trivial to verify property (1), and for properties (2) through (4),
the result easily follows from the characterization of these properties
as given in Section~\ref{characterization lemmas}.
To verify that the function $f$ of arity $k$ is width $2$ affine, we use
the following procedure to construct a candidate width 2 affine
function $\displaystyle \tilde f$ and verify that $\sa(\tilde f) = \sa(f)$:
\medskip

{\sf
a) Let $x_1,...,x_k$ be the underlying variables.

b) If a variable $x_i$ takes value $1$ ($0$) in each satisfying assignment
of $f$, include the constraint $x_i = 1$ ($x_i = 0$) in $\displaystyle
\tilde f$.

c) For every pair of variables $x_i, x_j$ such that $x_i = x_j$ in each
satisfying assignment, include the constraint $\xor(x_i,x_j)=0$ in
$\displaystyle \tilde f$.

d) Similarly, for every pair of variables $x_i, x_j$ such that
$x_i \ne x_j$ in each satisfying assignment, include the constraint
$\xor(x_i,x_j)=1$ in $\displaystyle \tilde f$.

e) Verify that every satisfying assignment of $f$ is also a satisfying
assignment for $\displaystyle \tilde f$ and that $\vert\sa(\tilde f)\vert =
\vert\sa(f)\vert$.
}

\medskip

It is clear that the above procedure can clearly be implemented in
time polynomial in $\vert\sa(f)\vert$.
We now move to the last property, namely, the property of being a
2-monotone function.
We will use the characterization of 2-monotone
functions as given by Lemma \ref{2-monotone-character}.
The algorithm below decides in polynomial time whether a constraint
$f$ of arity $k$ is 2-monotone. As before, we build a candidate function
2-monotone function $\tilde f$ by examining the set of satisfying assignments
 $\sa(f)$, and verify that $\sa(\tilde f)=\sa(f)$.
\medskip


{\sf
a) Verify that for each satisfying assignment $s$, either $Z(s)$ is
0-consistent or $O(s)$ is 1-consistent (both could happen).

b) Let $P$ be the set of assignments $s$ such that  $O(s)$ 1-consistent.
Let $m_1$ be the intersection of all these 1-consistent sets.

c)  Let $Q$ be the set of assignments such that  $Z(s)$
is 0-consistent.
Let $m_2$ be the intersection of all these 0-consistent sets.

d) Let $\displaystyle \tilde f =(\bigwedge _{x\in m_1} x)\vee (\bigwedge _{y\in
m_2}
\bar y)$. (If $f$ is $2$-monotone then $f\equiv \tilde f$).

e)$\vert\sa(\tilde f)\vert  =2^{k-\vert m_1\vert} + 2^{k-\vert m_2\vert} -
\varepsilon (m_1, m_2)$,
 where $\varepsilon (m_1, m_2)=0$ if $m_1\cap m_2\ne\emptyset$ and
$\varepsilon (m_1, m_2)=2^{k-\vert m_1\vert-\vert m_2\vert }$ otherwise.

f) Verify that every satisfying assignment of $f$ is also a satisfying
assignment for $\displaystyle \tilde f$ and that $\vert\sa(\tilde f)\vert =
\vert\sa(f)\vert$.
}


\end{proof}



\section{Representation by a CNF-formula}

Our main result here is that the $\meta$-$\C$ problem, for each class $\C$,
becomes $\conp$-hard when the functions are specified by CNF-formulas.
Observe that in order to prove this result, it suffices to
establish the $\conp$-hardness of verifying the following three
properties:

\begin{enumerate}
\item
affine,

\item
width $2$ affine, and

\item
2-monotone.
\end{enumerate}

It is easily seen that together these properties intersect the tractable cases
for
each one of our classes. We start with the properties (1) and (2) above.


\begin{lemma}
\label{lem:metacnf-affine}
Let $f$ be a constraint function specified as a CNF-formula.
Then the problem of deciding whether $f$ is affine \lb width $2$
affine \rb is $\conp$-hard.
\end{lemma}
\begin{proof}
We will show that given a CNF-formula $f$, deciding whether $f$ is
logically equivalent to the equation $\alpha=1$ is $\conp$-hard.
This clearly establishes the claimed result.
We will do a reduction from the $\unsat$ problem defined as below:
\smallskip

{\sc Instance :}
A CNF-formula $f$.
\smallskip

{\sc Question :}
Is  $f$  unsatisfiable?
\smallskip

The $\unsat$ problem is known to be $\conp$-complete~\cite{Cook-71}.
Consider an input $f =\bigwedge_{i=1}^p C_i$ to the $\unsat$ problem where
$f$ is defined over a set of variables $\vec x=\{x_1,\ldots ,x_k\}$. Also,
let $\alpha$ be a new variable not in $\vec x$.
Now consider the formula $f'=\bigwedge_{i=1}^p (C_i\vee\alpha).$
It is clear that if $f$ is  unsatisfiable then $f'$ is
logically equivalent to the linear system $(\alpha =1)$ over the field
$\gf(2)$.
Conversely, suppose that $f'$ is logically equivalent to a linear system over
the field $\gf(2)$. Observe that in this case $\vert\sa(f')\vert$ is
necessarily a power of $2$. By our construction of $f'$, we have
$\vert\sa(f')\vert =2^k+\vert\sa(f)\vert$, and since
$0\le\vert\sa(f)\vert < 2^k$, $\vert\sa(f')\vert$  is a power of $2$ iff
 $\vert\sa(f)\vert=0$, that is, iff $f$ is
unsatisfiable. This completes the proof of the lemma.
\end{proof}


We next establish $\conp$-hardness of recognizing 2-monotone functions.
We will use the following proposition.


\begin{proposition}
\label{pro:metacnf}
Given a CNF-formula $f$, deciding whether $f$ has the all-one assignment as
only
satisfying assignment (i.e. $f\equiv (x_1\wedge\cdots\wedge x_k)$) is
$\conp$-hard.
\end{proposition}
\begin{proof}
We consider the following problem:
\smallskip

{\sc Instance :}
A CNF-formula $f$.
\smallskip

{\sc Question :}
Is $f$ almost unsatisfiable, that is, $f$ is either unsatisfiable or only
satisfied by  the all-one assignment?
\smallskip

It is easy to verify that this problem is
$\conp$-complete by using the following reduction from the $\unsat$
problem. Given an input $f$ to the $\unsat$ problem,
construct the formula $f'=f\wedge (\bar\alpha)$ (where $\alpha$ is a new
variable) as input to the problem above.
Clearly, $f$ is unsatisfiable iff $f'$ is almost unsatisfiable.

Now let ${\displaystyle f=\bigwedge_{i=1}^p C_i}$ be a CNF-formula, defined
over a set of variables $\vec x=\{x_1,\cdots , x_k\}$.
Consider the formula $f'=\bigwedge_{j=1}^k\bigwedge_{i=1}^p (C_i\vee x_j).$
It is easy to verify that $f$ is almost unsatisfiable iff $f'$ has the
all-one
assignment as only satisfying assignment. First observe that the all-one
assignment, $\vec 1$, satisfies $f'$. Also, if $f$ is satisfied by $s\ne\vec 1$
then
$f'$ is also satisfied by $s$. Conversely, suppose that $f$ is almost
unsatisfiable and that $f'$ is satisfied by  $s=(s_1,\cdots ,s_k)\ne\vec 1$.
Let $j_0$ be such that $s_{j_0}=0$. Since $s$ satisfies $f'$, $s$ satisfies
${\displaystyle \bigwedge_{i=1}^p (C_i\vee x_{j_0})}$. Hence, $s$ satisfies
${\displaystyle \bigwedge_{i=1}^p C_i=f}$, a contradiction.
\end{proof}



\begin{lemma}
\label{lem:metacnf-2monotone}
Let $f$ be a constraint function specified as a CNF-formula.
Then the problem of deciding whether $f$ is 2-monotone
is $\conp$-hard.
\end{lemma}
\begin{proof}
By Proposition~\ref{pro:metacnf}, it is sufficient to show
that the problem of deciding
whether a CNF-formula has the all-one assignment for only satisfying assignment
can be reduced to the problem of deciding whether a CNF-formula defines a
2-monotone function. Given a CNF formula $f$ over a set of variables
$\{x_1,\ldots ,x_k\}$, we construct a formula $f'$ over the variables
$\{x_1,\ldots ,x_k\} \cup \{x'_1,\ldots ,x'_k\} \cup \{\alpha\}$
(where $\alpha$ and $x'_i, 1\le i\le k$ are new variables) and defined as
follows:

$$f':= f \wedge \bigwedge_{i=1}^k (x_i\equiv x'_i) \wedge (\alpha).$$

If the all-one assignment is the only satisfying assignment for $f$ then

$$f'\equiv   \bigwedge_{i=1}^k x_i \wedge  \bigwedge_{i=1}^k x'_i\wedge
(\alpha),$$
hence $f'$ is $2$-monotone.

Conversely, if $f'$ is $2$-monotone then $f'$ is equivalent to a conjunction of
positive literals (because of the clause $(\alpha)$) and this conjunction
involves all the variables (because of the clauses  $\bigwedge_{i=1}^k
(x_i\equiv
x'_i)$). Therefore,
$$f'\equiv   \bigwedge_{i=1}^k x_i \wedge  \bigwedge_{i=1}^k x'_i\wedge
(\alpha),$$
hence, the all-one assignment is the only satisfying assignment for $f$.
\end{proof}

We can now conclude the following theorem.

\begin{theorem}
For each class $\C$ in our study, the $\meta$-$\C$ problem is
$\conp$-hard if the input constraint set is specified
using the CNF-formula representation.
\end{theorem}


\section{Representation by a DNF-formula}

Similarly to the case of representation by CNF-formulas, we now show that
the $\meta$-$\C$ problem, for each class $\C$,
remains $\conp$-hard when the functions are specified as DNF-formulas.
As before, it suffices to show $\conp$-hardness of recognizing
the properties of being
affine, width 2 affine, and 2-monotone. We establish the following analogs
of Lemmas~\ref{lem:metacnf-affine} and~\ref{lem:metacnf-2monotone}.

\begin{lemma}
\label{lem:metadnf-affine}
Let $f$ be a constraint function specified as a DNF-formula.
Then the problem of deciding whether $f$ is affine \lb width $2$
affine \rb is $\conp$-hard.
\end{lemma}
\begin{proof}
The proof is similar to Lemma~\ref{lem:metacnf-affine}. We now
provide a reduction from the well-known
$\conp$-complete problem $\tautology$~\cite[LO8]{GareyJ-79}:

\smallskip

{\sc Instance :}
A DNF-formula $f$.
\smallskip

{\sc Question :}
Is  $f$  satisfied by every assignment?
\smallskip

Given an input $f$ to the $\tautology$ problem, we create
a DNF-formula $f'=f\vee (\alpha)$, where $\alpha$ is a new variable.
The claimed result now follows since $f$ is a tautology iff $f'$ is
logically equivalent to constraint $\alpha=1$.
\end{proof}

\begin{lemma}
\label{lem:metadnf-2monotone}
Let $f$ be a constraint function specified as a DNF-formula.
Then the problem of deciding whether $f$ is $2$-monotone
is $\conp$-hard.
\end{lemma}
\begin{proof}
Once again we use the $\tautology$ problem as our starting point.
Let $\displaystyle f=\bigvee _{i=1}^p D_i$ be a DNF-formula, given
as input to the $\tautology$ problem; here each $D_i$ is a conjunction of
literals, for $i=1,\ldots ,p$. We construct a DNF-formula $f'$ as below:

$$f'= \bigvee_{i=1}^p (D_i\wedge\alpha\wedge\beta)\vee
\bigvee_{i=1}^p (D_i\wedge\bar\alpha\wedge\bar\beta),$$
where $\alpha$ and $\beta$ are new variables.
It is easy to verify that $f'$ is 2-monotone iff $f'$ is
equivalent to $ (\alpha\wedge\beta)\vee (\bar\alpha\wedge\bar\beta)$, that is
iff $f$ is a tautology. This completes the proof.
\end{proof}

We can now conclude our main result here.

\begin{theorem}
For each class $\C$ in our study, the $\meta$-$\C$ problem is
$\conp$-hard if the input constraint set is specified
using the DNF-formula representation.
\end{theorem}


%\include{conclusions}



\chapter{Concluding Remarks}
\label{Concluding Remarks}

We have presented a taxonomy of the computational complexity
of problems derived from Boolean constraint satisfaction.
In the process we have seen some of the central complexity classes
such as $\np$, $\nc$, $\pspace$, $\#\p$, and $\npo$.
When specialized to Boolean constraint satisfaction, these classes
partition nicely into just finitely many equivalence classes ---
where problems within an equivalence class are reducible to one another.
A central idea in establishing these partitions is the
notion of {\em implementations}. Implementations allowed us to
build in a unified manner a variety of different reductions addressing the
varying goals of the decision, counting and optimization problems. The
basic toolkit turns out to be significantly more compact than the wide
variety of purposes that it is used for.

One of the most significant conclusions we draw from the study of
constraint satisfaction problems is that it provides an excellent
platform to search for a ``formal basis'' for ``empirical observations''.
Complexity theory is intended to study the most general
forms of computations. However the generality often poses a barrier,
when one tries to formalize a noticeable trend among natural
problems. Typically, the moment one tries to formalize the trend,
a counterexample is found. Usually the counterexample is unnatural,
but there is no way to formalize the notion of naturality either!
In contrast, specializing classes such as $\np$, $\pspace$ and $\npo$ to
Boolean constraint satisfaction creates ``miniaturized imprints'' of these
classes that are refined enough to exhibit many phenomena observed
in the parent classes and yet coarse enough to preserve such phenomena over all
problems contained in them.

Consider for example the unifying notion of reductions used for
NP-completeness. Most known reductions are based on ``gadgets'' ---
an informal theme that signifies that a combinatorial construct has been
used to convert one problem to another.
Much of the work towards formally studying gadgets has been
confined to specific instances of source
and target problems of the reduction (see, for instance, \cite{bgs}).
The finite nature of such problem-specific explorations inherently lacks the
ability to
highlight any general results that describe the ubiquitous
nature of gadget reductions. However, when restricted to
constraint satisfaction problems, the elusive notion of a ``gadget''
reduction can be formalized --- it is indeed the notion of reduction
via implementations. The results described in the earlier
chapters give a very satisfactory explanation of the seemingly universal
nature of these reductions.

Constraint satisfaction problems play a particularly
significant role in the study of optimization problems. The current
decade (1990-2000) has seen an explosion of research studying the
the approximability of optimization problems. While the research
has pointed to significant unifying trends, the trends are sometimes
hard to spot from among the natural diversity exhibited by optimization
problems; and even when a trend becomes visible, it is hard to
formalize or prove it. For example, the classes $\po$, $\ptas$,
$\apx$, $\logapx$, and $\polyapx$, do seem to be very natural
thresholds of approximability with almost all known problems being
complete for some of these classes. However, without the use
of constraint satisfaction problems, there is no way of formally
stating such an assertion. Constraint satisfaction problems actually
allows not only a formal assertion, but also give a proof. Several
other such trends are described in \cite{KhannaSW-96,KhannaST-97}.

One shortcoming of our study is that it is restricted to Boolean domain.
Each problem in our framework naturally extends to non-Boolean domains.
Yet the proofs of classification do not; and it is open as to
whether the theorems do.
Jeavons, Cohen and Gyssens \cite{JeavonsCG-97} have brought to the fore the
link between
 the algebraic closure properties of the constraints and the complexity of the
corresponding constraint satisfaction problems. Our study motivates this
line of
research since it appears that when restricted to Boolean domain, algebraic
closure properties of the constraints (see Chapter \ref{Characterizations of
Constraint Functions}, Section \ref{characterization lemmas}) exactly
characterize  the complexity of the corresponding constraint satisfaction
 problems (see Chapter
\ref{Dichotomy Theorems for  Boolean Constraint Satisfaction Problems}).
The study of
Feder and Vardi~\cite{FederV-93} already points to some significant technical
hurdles in extending the classification results to this domain. However they
also show that classifications of constraint satisfaction problems over
non-Boolean domains are of much more than technical interest.
It turns out that constraint satisfaction problems over non-Boolean
domains are computationally equivalent to problems in ``monotone
monadic SNP'' --- a syntactically restricted class of languages
within NP, which is, in some sense, the largest class within NP
that may show dichotomy results. Their proof of the equivalence
between the two classes is highly non-trivial and further motivates
the study of constraint satisfaction problems. A complete
classification result of all constraint satisfaction problems
over arbitrary domains would bring an extemely satisfying conclusion
to this line of work, and we look forward to seeing work in this
direction.


%\include{bib}



% I tried to unify the format. Whenever I gave up on chasing
% a reference, I put a flag saying % CONFIRM %. Look for this
% and see if you can/want to fix anything.



\chapter*{References}

\begin{thebibliography}{9999}

\bibitem{ABSS93}
Sanjeev Arora, L{\'a}szl{\'o} Babai, Jacques Stern,
	and Z.  Sweedyk.
\newblock The hardness of approximate optima in lattices,
	codes, and systems of linear equations.
\newblock {\em Journal of Computer and System Sciences},
     54(2):317--331, April 1997.

\bibitem{AKK}
Sanjeev Arora, David Karger, and Marek Karpinski.
\newblock Polynomial time approximation schemes for dense
	instances of NP-hard problems.
\newblock In {\em Proceedings of the Twenty-Seventh Annual
	ACM Symposium on the Theory of Computing}, pages 284--293,
	Las Vegas, Nevada, 29 May-1 June 1995.

\bibitem{almss}
Sanjeev Arora, Carsten Lund, Rajeev Motwani, Madhu Sudan, and
Mario Szegedy.
\newblock Proof verification and the hardness of approximation
     problems.
\newblock {\em Journal of the ACM}, 45(3):501--555, May 1998.

\bibitem{as}
Sanjeev Arora and Shmuel Safra.
\newblock Probabilistic checking of proofs: A new characterization
	of NP.
\newblock {\em Journal of the ACM}, 45(1):70--122, January 1998.

\bibitem{AspvallPT-79}
Bengt Aspvall, Michael F. Plass, and Robert Endre Tarjan.
\newblock A linear-time algorithm for testing the truth of
	certain quantified Boolean formulas.
\newblock {\em Information Processing Letters}, 8(3):121--123,
	15 March 1979.

\bibitem
{baker}
Brenda S. Baker.
\newblock Approximation algorithms for NP-complete problems
	on planar graphs.
\newblock {\em Journal of the ACM}, 41(1):153--180, January 1994.

\bibitem{bgs}
Mihir Bellare, Oded Goldreich, and Madhu Sudan.
\newblock Free bits, PCPs, and nonapproximability --- towards
	tight results.
\newblock {\em SIAM Journal on Computing},
     27(3):804--915, June 1998.

% CONFIRM %

\bibitem
{bodlaender88}
H. L. Bodlaender.
\newblock Some classes of graphs with bounded treewidth.
\newblock {\em Bulletin of the European Association for Theoretical
Computer Science} 36:116--126, 1988.

\bibitem
{bodlaender93}
Hans L. Bodlaender.
\newblock A linear time algorithm for finding tree-decompositions
	of small treewidth.
\newblock In {\em Proceedings of the Twenty-Fifth Annual ACM
     Symposium on the Theory of Computing}, pages 226--234, San Diego,
     California, 16-18 May 1993.



\bibitem{BorosCHS-94}
E. Boros, Y. Crama, P. L. Hammer, and M. Saks.
\newblock A complexity index for satisfiability problems.
\newblock {\em SIAM Journal on Computing}, 23(1):45--49, February 1994.

\bibitem%[BC93]
{BovCres}
Daniel Pierre Bovet and Pierluigi Crescenzi.
\newblock {\bf Introduction to the Theory of Complexity.}
\newblock Prentice-Hall, New York, 1993.

% CONFIRM %
\bibitem
{chiba}
N.~Chiba, T.~Nishizeki, and N.~Saito.
\newblock Applications of the planar separator theorem.
\newblock {\em Journal of Information Processing}, 4:203--207 (1981).

\bibitem{Cook-71}
Stephen A. Cook.
\newblock The complexity of theorem-proving procedures.
\newblock In {\em Conference Record of Third Annual ACM
	Symposium on Theory of Computing},
     pages 151--158, Shaker Heights, Ohio, 3-5 May 1971.

\bibitem{Cook-85}
Stephen A. Cook.
\newblock A taxonomy of problems with fast parallel algorithms.
\newblock {\em Information and Control}, 64(1-3):2--21,
January/February/March 1985.

\bibitem{CookL-87}
Stephen A. Cook and Michael Luby.
\newblock A simple parallel algorithm for finding a
	satisfying truth assignment to a 2-CNF formula.
\newblock {\em Information Processing Letters}, 27(3):141--145,
	25 March 1988.

\bibitem{Creignou-95}
Nadia Creignou.
\newblock A dichotomy theorem for maximum generalized
	satisfiability problems.
\newblock {\em Journal of Computer and System Sciences},
	51(3):511--522, December 1995.



\bibitem{CreignouHb-96}
Nadia Creignou and Jean-Jacques H\'ebrard.
\newblock On generating all satisfying truth assignments of a
generalized CNF-formula.
\newblock {\em Theoretical Informatics and Applications},  31(6):499--511,
1997.



\bibitem{CreignouHr-96}
Nadia Creignou and Miki Hermann.
\newblock Complexity of generalized satisfiability counting problems.
\newblock {\em Information and Computation},
	125(1):1--12, 25 February 1996.

\bibitem{CrescenziKST-95}
Pierluigi Crescenzi, Viggo Kann, Riccardo Silvestri, and Luca Trevisan.
\newblock Structure in approximation classes.
\newblock {\em SIAM Journal on Computing}, 28(5):1759--1782, 1999.

\bibitem{CrescenziP-91}
Pierluigi Crescenzi and Alessandro Panconesi.
\newblock Completeness in approximation classes.
\newblock {\em Information and Computation}, 93(2):241--262,
	August 1991.

% CONFIRM %

\bibitem%[CST96]
{CST96}
Pierluigi Crescenzi, Riccardo Silvestri, and Luca Trevisan.
\newblock To weight or not to weight: Where is the question?
\newblock In {\em Proceedings of the 4th IEEE Israel Symposium on Theory of
  Computing and Systems}, pages 68--77, 1996.


\bibitem{Dalmau}
Victor Dalmau.
\newblock Some dichotomy theorems on constant free Boolean formulas.
\newblock Departament LSI, Universitat Polit\`ecnica de Catalunya,
TR  LSI-97-43-R, 1997.

\bibitem{DorT-97}
Dorit Dor and Michael Tarsi.
\newblock Graph decomposition is NP-complete: A complete proof
	of Holyer's conjecture.
\newblock {\em SIAM Journal on Computing}, 26(4):1166--1187,
	August 1997.

\bibitem{DowlingG-84}
William F. Dowling and Jean H. Gallier.
\newblock Linear-time algorithms for testing the satisfiability
	of propositional Horn formulae.
\newblock {\em Journal of Logic Programming},
     1(3):267--284, October 1984.

\bibitem{DyerF-86}
M. E. Dyer and A. M. Frieze.
\newblock Planar 3DM is NP-complete.
\newblock {\em Journal of Algorithms},
	7(2):174--184, June 1986.

\bibitem{FederV-93}
Tom{\'a}s Feder and Moshe Y. Vardi.
\newblock The computational structure of monotone monadic SNP and constraint
satisfaction: a study through Datalog and group theory.
\newblock {\em SIAM Journal on Computing}, 28(1):57--104, January 1998.

\bibitem{fglss}
Uriel Feige, Shafi Goldwasser, Laszlo Lov{\'a}sz, Shmuel
	Safra, and Mario Szegedy.
\newblock Interactive proofs and the hardness of approximating
	cliques.
\newblock {\em Journal of the ACM}, 43(2):268--292, March 1996.

\bibitem{FortuneHW-80}
Steven Fortune, John Hopcroft, and James Wyllie.
\newblock The directed subgraph homeomorphism problem.
\newblock {\em Theoretical Computer Science},
	10(2):111--121, February 1980.

\bibitem{GareyJ-79}
Michael R. Garey and David S. Johnson.
\newblock {\bf Computers and Intractability: A Guide to the
	Theory of NP-Completeness.}
\newblock W.~H.~Freeman and Company, San Francisco, 1979.

\bibitem{GareyJS-76}
M. R. Garey, D. S. Johnson, and L. Stockmeyer.
\newblock Some simplified NP-complete graph problems.
\newblock {\em Theoretical Computer Science},
	1(3):237--267, February 1976.



\bibitem%[GVY96]
{GVY96}
Naveen Garg, Vijay V. Vazirani, and Mihalis Yannakakis.
\newblock Approximate max-flow min-(multi)cut theorems and their
	applications.
\newblock {\em SIAM Journal on Computing},
	25(2):235--251, April 1996.

\bibitem{GoldshlagerSS-82}
Leslie M. Goldschlager, Ralph A. Shaw, and John Staples.
\newblock The maximum flow problem is log space complete for P.
\newblock {\em Theoretical Computer Science}, 21(1):105--111,
	October 1982.

% CONFIRM city below  %

\bibitem{GreenlawHR-95}
Raymond Greenlaw, H. James Hoover, and Walter L. Ruzzo.
\newblock {\em Limits to Parallel Computation: P-completeness Theory}.
\newblock Oxford University Press, 1995.


\bibitem{HellN-90}
P.~Hell and J.~Ne\v set\v ril.
\newblock On the complexity of $H$-coloring.
\newblock {\em  Journal of Combinatorial Theory, Series B}, 48:92--110,
1990.

% CONFIRM %

\bibitem%[HMNT93]
{HMNT93}
D.S. Hochbaum, N.~Megiddo, J.~Naor, and A.~Tamir.
\newblock Tight bounds and 2-approximation algorithms for integer programs with
  two variables per inequality.
\newblock {\em Mathematical Programming}, 62:69--83, 1993.

\bibitem{HU-79}
John E. Hopcroft and Jeffrey D. Ullman.
\newblock {\bf Introduction to Automata Theory, Languages and
	Computation}.
\newblock Addison Wesley Publishing Company, 1979.



\bibitem{Horn-51}
A.~Horn.
\newblock On sentences which are true of direct unions of algebras.
\newblock {\em Journal of Symbolic Logic}, 16:14--21, 1951.

\bibitem
{hunt}
H.B.~Hunt~III, M.V.~Marathe, V. Radhakrishnan, S.S.~Ravi, D.J.~Rosenkrantz,
and R. E.~Stearns.
\newblock Approximation schemes using L-reductions.
\newblock In {\em Proceedings of the Conference on Foundations of Software
Technology and Theoretical Computer Science} (1994), pp.~342-353.

\bibitem
{HuntMRS-98}
H.B.~Hunt~III, M.V.~Marathe, V. Radhakrishnan
and R. E.~Stearns.
\newblock The complexity of planar counting problems.
\newblock {\em SIAM Journal on Computing}, 27(4):1142--1167, 1998.


\bibitem{JaumardS-87}
Brigitte Jaumard and Bruno Simeone.
\newblock On the complexity of the maximum satisfiability problem
	for Horn formulas.
\newblock {\em Information Processing Letters},
	26(1):1--4, 15 September 1987.


\bibitem{JeavonsCG-97}
Peter Jeavons, David Cohen and Marc Gyssens.
\newblock Closure properties of constraints
\newblock {\em Journal of the ACM}, 44(4):527--548, July 1997.

\bibitem{Johnson-74}
David S. Johnson.
\newblock Approximation algorithms for combinatorial problems.
\newblock {\em Journal of Computer and System Sciences},
	9(3):256--278, December 1974.

\bibitem{Johnson-90}
David S. Johnson.
\newblock A catalog of complexity classes.
\newblock In J.~van Leeuwen, editor, {\em Handbook of Theoretical Computer
  Science, Volume~A: Algorithms and Complexity}, chapter~17, pages 67--161.
  North-Holland, Amsterdam, 1990.

\bibitem{JohnsonPY-88}
David S. Johnson, Christos H. Papadimitriou, and Mihalis Yannakakis.
\newblock How easy is local search?
\newblock {\em Journal of Computer and System Sciences},
     37(1):79--100, August 1988.

\bibitem{JohnsonYP-88}
David S. Johnson, Mihalis Yannakakis, and Christos H.  Papadimitriou.
\newblock On generating all maximal independent sets.
\newblock {\em Information Processing Letters},
	27(3):119--123, 25 March 1988.

\bibitem{KarpR-90}
Richard M. Karp and Vijaya Ramachandran.
\newblock Parallel algorithms for shared-memory machines.
\newblock In J.~van Leeuwen, editor, {\em Handbook of Theoretical Computer
  Science, Volume~A: Algorithms and Complexity}, chapter~17, pages 869--941.
  North-Holland, Amsterdam, 1990.



\bibitem{KarpUW-86}
Richard M. Karp, Eli Upfal, and Avi Wigderson.
\newblock Constructing a perfect matching is in RNC.
\newblock {\em Combinatorica}, 6:35--48, 1986.

\bibitem{KarpUW-88}
Richard M. Karp, Eli Upfal, and Avi Wigderson.
\newblock The complexity of parallel search.
\newblock {\em Journal of Computer and System Sciences},
	36(2):225--253, April 1988.

% CONFIRM %
\bibitem{Kasif-90}
S. Kasif.
\newblock On the parallel complexity of discrete relaxation of constraint
satisfaction networks.
\newblock {\em Artificial Intelligence}, 63(45):275--286, 1990.

\bibitem{KavvadiasS-96}
Dimitris Kavvadias and Martha Sideri.
\newblock The inverse satisfiability problem.
\newblock {\em SIAM Journal on Computing}, 28(1):152--163, January 1998.

\bibitem{kmsv}
Sanjeev Khanna, Rajeev Motwani, Madhu Sudan, and Umesh Vazirani.
\newblock On syntactic versus computational views of approximability.
\newblock {\em SIAM Journal on Computing}, 28(1):164--191, January 1998.

% CONFIRM %

\bibitem{km96}
Sanjeev Khanna and Rajeev Motwani.
\newblock Towards a syntactic characterization of PTAS.
\newblock In {\em Proceedings of the Twenty-Eighth Annual
	ACM Symposium on the Theory of Computing}, pages 329--337,
	Philadelphia, Pennsylvania, 22-24 May 1996.

\bibitem{KhannaS-96}
Sanjeev Khanna and Madhu Sudan.
\newblock The optimization complexity of constraint satisfaction problems.
\newblock Stanford University Tech. Note STAN-CS-TN-96-29, 1996.

\bibitem{KhannaST-97}
Sanjeev Khanna, Madhu Sudan, and Luca Trevisan.
\newblock Constraint satisfaction: The approximability of minimization
problems.
\newblock In {\em Proceedings  12th Computational Complexity Conference},
IEEE Computer Society Press, pages 282--296, 1997.

\bibitem{KhannaSW-96}
Sanjeev Khanna, Madhu Sudan, and David P. Williamson.
\newblock A complete classification of the approximability of
	maximization problems derived from Boolean constraint
	satisfaction.
\newblock In {\em Proceedings of the Twenty-Ninth Annual ACM
	Symposium on Theory of Computing}, pages 11-20, El Paso,
	Texas, 4-6 May 1997.

\bibitem%[KARR90]
{KARR}
Philip Klein, Ajit Agrawal, R. Ravi, and Satish Rao.
\newblock Approximation through multicommodity flow.
\newblock In {\em 31st Annual Symposium on Foundations of Computer
	Science}, volume II, pages 726--737, St. Louis, Missouri,
	22-24 October 1990. IEEE.

\bibitem%[KPRT96]
{KPRT96}
Philip N. Klein, Serge A. Plotkin, Satish Rao, and {\'E}va Tardos.
\newblock Approximation algorithms for Steiner and directed multicuts.
\newblock {\em Journal of Algorithms}, 22(2):241--269, February 1997.


\bibitem{KleineB-90}
Hans Kleine B\"uning.
\newblock Existence of simple propositional formulas.
\newblock {\em Information Processing Letters},
	36(4):177--182, 15 November 1990.

\bibitem{KleineBKF-95}
Hans Kleine B\"uning, Marek Karpinski, and Andreas Fl{\"o}gel.
\newblock Resolution for quantified Boolean formulas.
\newblock {\em Information and Computation}, 117(1):12--18,
     15 February 1995.

\bibitem{Kozen-92}
Dexter C. Kozen.
\newblock {\bf The Design and Analysis of Algorithms}.
Chapter 26: Counting problems and \#P.
Pages 138--143.
\newblock Springer-Verlag, 1992.

\bibitem{Krentel-88}
Mark W. Krentel.
\newblock The complexity of optimization problems.
\newblock {\em Journal of Computer and System Sciences},
	36(3):490--509, June 1988.

\bibitem{Krentel-92}
Mark W. Krentel.
\newblock Generalizations of Opt P to the polynomial hierarchy.
\newblock {\em Theoretical Computer Science}, 97(2):183--198,
	27 April 1992.

\bibitem{ladner}
Richard E. Ladner.
\newblock On the structure of polynomial time reducibility.
\newblock {\em Journal of the ACM}, 22(1):155--171, January 1975.

\bibitem%[Lev73]
{Levin-73}
{Leonid A. Levin.}
{Universal'ny\u{\i}e pereborny\u{\i}e zadachi (Universal search
  problems : in Russian)}.
{\em Problemy Peredachi Informatsii}, 9(3):265--266, 1973.
A corrected English translation appears in an appendix to
Trakhtenbrot~\cite{Trakhtenbrot-84}.

\bibitem
{lichtenstein}
David Lichtenstein.
\newblock Planar formulae and their uses.
\newblock {\em SIAM Journal on Computing}, 11(2):329--343, May 1982.

\bibitem{Linial-86}
Nathan Linial.
\newblock Hard enumeration problems in geometry and combinatorics.
\newblock {\em SIAM Journal on Algebraic and Discrete Methods},
	7(2):331--335, April 1986.

% CONFIRM %

\bibitem
{lipton1}
Richard J. Lipton and Robert Endre Tarjan.
\newblock A separator theorem for planar graphs.
\newblock {\em SIAM Journal of Applied Mathematics}, 36:177--189, 1979.

\bibitem
{lipton2}
Richard J. Lipton and Robert Endre Tarjan.
\newblock Applications of a planar separator theorem.
\newblock {\em SIAM Journal on Computing}, 9(3):615--627, August 1980.

% CONFIRM %

\bibitem
{LundY-93}
Carsten Lund and Mihalis Yannakakis.
The approximation of maximum subgraph problems.
In {\em Svante Carlsson Andrzej Lingas, Rolf G. Karlsson, editors,
     Automata, Languages and Programming, 20th International Colloquium},
     volume 700 of Lecture Notes in Computer Science, pages 40--51, Lund,
     Sweden, 5-9 July 1993. Springer-Verlag.

\bibitem{Minoux-88}
Michel Minoux.
\newblock LTUR: A simplified linear-time unit resolution algorithm
	for Horn formulae and computer implementation.
\newblock {\em Information Processing Letters},
	29(1):1--12, 15 September 1988.

\bibitem{MR}
Rajeev Motwani and Prabhakar Raghavan.
\newblock {\bf Randomized Algorithms}.
\newblock Cambridge University Press, 1995.



\bibitem{Mulmuley-87}
Ketan A. Mulmuley.
\newblock A fast parallel algorithm to compute the rank of a matrix over an
arbitrary field.
\newblock {\em Combinatorica}, 7:101--104, 1987.


\bibitem{PanR-85}
Victor Pan and John Reif.
\newblock Efficient parallel solution of linear systems.
\newblock In {\em Proceedings of the Seventeenth Annual ACM Symposium
	on Theory of Computing}, pages 143--152, Providence,
	Rhode Island, 6-8 May 1985.

\bibitem{py}
Christos H. Papadimitriou and Mihalis Yannakakis.
\newblock Optimization, approximation, and complexity classes.
\newblock {\em Journal of Computer and System Sciences},
     43(3):425--440, December 1991.

\bibitem{Papadimitriou-94}
Christos H. Papadimitriou.
\newblock {\bf Computational Complexity}.
\newblock Addison Wesley, 1994.

\bibitem{PapadimitriouSY-90}
Christos H. Papadimitriou, Alejandro A. Sch\"affer, and Mihalis
	Yannakakis.
\newblock On the complexity of local search (extended abstract).
\newblock In {\em Proceedings of the Twenty Second Annual ACM
	Symposium on Theory of Computing}, pages 438--445,
	Baltimore, Maryland, 14-16 May 1990.

\bibitem{PapadimitriouS-82}
Christos H. Papadimitriou and Kenneth Steiglitz.
\newblock {\em Combinatorial Optimization, Algorithms and Complexity}.
\newblock Prentice-Hall, Inc, %page 119,
	1982.

\bibitem{ProvanB-83}
J. Scott Provan and Michael O. Ball.
\newblock The complexity of counting cuts and of computing the
	probability that a graph is connected.
\newblock {\em SIAM Journal on Computing}, 12(4):777--788,
	November 1983.

\bibitem{RT87}
Prabhakar Raghavan and Clark D. Thompson.
\newblock Randomized rounding: a technique for provably good algorithms and
  algorithmic proofs.
\newblock {\em Combinatorica}, 7:365--374, 1987.



\bibitem{ReithV-98}
Stephen Reith and Heribert Vollmer.
\newblock The  complexity of computing optimal assignments of generalized
propositional formul\ae.
\newblock Department of Computer Science, Universit\"at W\"urzburg,  TR 196,
1998.

\bibitem{Savitch-70}
Walter J. Savitch.
\newblock Relationships between nondeterministic and deterministic
	tape complexities.
\newblock {\em Journal of Computer and System Sciences},
	4(2):177--192, April 1970.

\bibitem{Schaefer-78}
Thomas J. Schaefer.
\newblock The complexity of satisfiability problems.
\newblock In {\em Conference Record of the Tenth Annual ACM
	Symposium on Theory of Computing}, pages 216--226,
	San Diego, California, 1-3 May 1978.

\bibitem{SchafferY-91}
Alejandro A. Sch\"affer and Mihalis Yannakakis.
\newblock Simple local search problems that are hard to solve.
\newblock SIAM Journal on Computing, 20(1):56--87, February 1991.

\bibitem{Sipser-96}
Michael Sipser.
\newblock Introduction to the Theory of Computation.
\newblock PWS Publishing Company, New York, December 1996.

\bibitem{StockmeyerM-73}
L. J. Stockmeyer and A. R. Meyer.
\newblock Word problems requiring exponential time: Preliminary report.
\newblock In {\em Conference Record of Fifth Annual ACM Symposium on
	Theory of Computing}, pages 1-9, Austin, Texas, 30 April-2 May
	1973.

\bibitem{Stockmeyer-76}
Larry J. Stockmeyer.
\newblock The polynomial-time hierarchy.
\newblock {\em Theoretical Computer Science}, 3(1):1--22,
	October 1976.

\bibitem{Toda-89}
Seinosuke Toda.
\newblock On the computational power of PP and $\oplus$P.
\newblock In {\em 30th Annual Symposium on Foundations of Computer
	Science}, pages 514--519, Research Triangle Park, North
	Carolina, 30 October-1 November 1989. IEEE.

% CONFIRM %
\bibitem%[Tra84]
{Trakhtenbrot-84}
B.~Trakhtenbrot.
A survey of Russian approaches to {\em Perebor} (brute-force
search) algorithms.
{\em Annals of the History of Computing}
6:384-400, 1984.

\bibitem{Valiant-79}
Leslie G. Valiant.
\newblock The complexity of enumeration and reliability problems.
\newblock {\em SIAM Journal on Computing}, 8(3):410--421, August 1979.


\end{thebibliography}


\end{document}
