\documentstyle[12pt,twoside,psfig,amssymb]{article}
\input{/a/class/6.045/6045-spring-92/handouts/defs-6045}






\newcommand{\poly}{{\Bbb P}}
\newcommand{\RP}{{\Bbb RP}}
\newcommand{\nat}{{\Bbb N}}
\newcommand{\fa}{\forall}
\newcommand{\sig}{\Sigma}
\newcommand{\arr}{\rightarrow}
\newcommand{\pless}{\leq_{P}}
\newcommand{\mless}{\leq_m}


\begin{document}

\handout{lecture30}{Notes on Lecture 30 (4/17/92)}{April 27, 1992}

\section{Polynomial-time reducibility}

Recall from last time the definition of a polynomial-time reduction.

\begin{definition}
$A \pless B$ iff $A \mless B$ via a polynomial-time computable function $f$.
That is, $x \in A$ iff $f(x) \in B$ and $f$ is in $\poly$.
\end{definition}

Polynomial-time reducibility is an important tool in complexity
theory.  Last time we showed how a natural problem (NEREGSQ) was not
in $\poly$ using poly-time reductions.  Although we can't always prove
things are not in $\poly$, we can use poly-time reductions to show
interrelationships between problems.  Recall the following theorem.

\begin{theorem}
If $A \pless B$, and $B \in \poly$, then $A \in \poly$.  Also, if
$A \pless B$ and $A \not\in \poly$, then $B \not\in \poly$.
\end{theorem}

Notice the similarity of using $\pless$ to show languages are in
$\poly$/not in $\poly$ with using $\mless$ to show that languages are
decidable/undecidable.  Unlike decidability, we often don't know for
sure when a set $A \not\in \poly$; we only think it is true.  So in this case
$A \pless B$ only shows that we {\it think} $B \not\in \poly$.

\section{Some examples of reductions}

Consider the following problem:

\begin{quote}
{\bf Vertex Cover (VC)} \\
INPUT: a graph $G=(V,E)$, an integer $k$. \\
DECIDE: Does $G$ have a vertex cover of size no greater than $k$?
(That is, a set of no more than $k$ vertices that touch every edge of
$G$?)
\end{quote}

This problem is actually NP-complete.  We will discuss what this means
later.  For now, take it as a given that this problem is ``hard''.
Consider also the following problem:

\begin{quote}
{\bf Clique} \\
INPUT: a graph $G=(V,E)$, an integer $l$. \\
DECIDE: Does $G$ contain a clique of size no less than $l$? (a set of
$\geq l$ mutually adjacent vertices?)
\end{quote}

\begin{theorem}
VC $\pless$ CLIQUE.
\end{theorem}

\begin{proof}
To prove this, we need a poly-time mapping of $G=(V,E), k$ (an
instance of VC) to $G'=(V',E'),l$ (an instance of CLIQUE) with the
property that $G$ has a vertex cover of size no greater than $k$ iff
$G'$ has a clique of size no less than $l$.  Our mapping is $V'=V$,
$E'=(V \times V) - E$, and $l = |V|-k$.  Note that this mapping can be
performed in polynomial time.  To see that this mapping has the
required properties, first suppose that $G$ has a vertex cover of
size $k$.  Note that there can be no edge between any pair of vertices
not in the vertex cover, otherwise this edge would not be covered.
Hence in $G'$, there is an edge between any two vertices that weren't
in the vertex cover of $G$.  Therefore there is a clique of size $l =
|V| - k$.  The logic works in the opposite direction, too (a clique of
size $l = |V| - k$ implies a vertex cover of size $k$).  Hence we have
shown that VC $\pless$ CLIQUE.
\end{proof}

It can also be shown that CLIQUE $\pless$ VC, so that it is true that 
CLIQUE $\equiv_P$ VC.

Here's another problem.

\begin{quote}
{\bf 3-Colorability} \\
INPUT: a graph $G=(V,E)$. \\
DECIDE: Can we color the vertices with 3 colors so that no two
adjacent vertices have the same color?
\end{quote}

\begin{theorem}
VC $\pless 3$-Colorability.
\end{theorem}

\begin{proof}
Here we want to transform a graph $G=(V,E)$ and $k$ to a graph
$G'=(V',E')$ such that $G$ has a vertex cover of size no greater than
$k$ if and only if $G'$ is three-colorable.  There several components 
to the transformation; we will explain each as we go along.

First of all, $G'$ contains a triangle of three vertices (1,2, and 3)
and three edges.  Such a triangle clearly must be colored with the
three different colors.  We will call the color of vertex 1 the
``true'' color (T), the color of vertex 2 the ``false'' color (F),
and the color of vertex 3 the ``neither'' color (N).  We may also call
vertices 1,2, and 3, the T, F, and N vertices respectively.  See Figure
\ref{fig:reftri}.


\begin{figure}
\centerline{\mbox{\psfig{figure=reftri-fig.ps,height=1in}}}
\caption{The reference triangle}
\label{fig:reftri}
\end{figure}



Next, for each vertex $i$ in $G$, we create two vertices $x_i$ and
$\bar x_i$ in $G'$.  We connect $x_i$ and $\bar x_i$ together with an edge, and
connect them both to the N vertex.  Hence if $G'$ is to be
three-colorable, one of $x_i$ and $\bar x_i$ must be colored T and the
other F.  The main idea of our construction is that we will arrange
things so that ``$x_i$ colored with T in $G'$'' will correspond to
``vertex $i$ is in the vertex cover of $G$''.

If a coloring in this fashion is to correspond to a vertex cover in
$G$, we must have it so that for each edge $(i,j)$ in $G$, we make
sure that either $x_i$ or $x_j$ is colored T in $G'$.  We do this with
the ``widget'' or ``gadget'' in Figure \ref{fig:or-gadget}. To see how
the gadget works, note that if both $x_i$ and $x_j$ are colored T,
then we can color vertex $a$ N and vertex $b$ F.  If $x_i$ is colored
T and $x_j$ F, then we can color $a$ F and $b$ N.  The only case in
which we cannot complete the coloring is if both $x_i$ and $x_j$ are
colored F.



\begin{figure}
\centerline{\mbox{\psfig{figure=or-gadget-fig.ps,height=1in}}}
\caption{Gadget for ensuring each edge is covered}
\label{fig:or-gadget}
\end{figure}




To complete the reduction, we must make sure that no more than $k$
vertices are in the vertex cover for $G$.  Hence we want to make sure
that no more than $k$ of the $x_i$ vertices are colored T.  To do this
we add some more vertices to $G'$.  In particular, we add vertices
$c_{ij}$ and $\bar c_{ij}$ for $0 \leq i \leq n$ and $0 \leq j \leq
k$.  We connect $c_{ij}$ to $\bar c_{ij}$ with an edge and connect
both vertices to the N vertex so that once again exactly one of the
two vertices must be colored T and one F.  We will make our
construction so that $c_{ij}$ can be colored T if and only if ``at
least $j$ of the vertices $x_1, \ldots, x_i$ are colored T''.  Hence
we want $c_{n,k+1}$ to be colored F, in order to make sure that at most
$k$ of the $x_i$ vertices are colored T. To enforce this, we connect
$c_{n,k+1}$ to both the T and N vertices.  Similarly, we connect
$c_{0,0}$ to F and N to force it to be colored T and we connect
$c_{0,j}$ to T and N to force it to be colored F for $0 < j \leq k$.
To force the rest of the $c_{ij}$ to be colored correctly, we notice
that we want $c_{ij}$ to be colored T if $c_{i-1,j-1}$ and $x_i$ are
colored T.  We claim that we can do so with the gadget in Figure
\ref{fig:clause-gadget}.


\begin{figure}
\centerline{\mbox{\psfig{figure=clause-gadget-fig.ps,height=1.5in}}}
\caption{Gadget for computing $c_{ij}$ correctly}
\label{fig:clause-gadget}
\end{figure}

This completes the reduction.  We have arranged the mapping of $G$ to
$G'$ in such a way that $G$ has a vertex cover of size no greater than
$k$ iff $G'$ can be three-colored.  Producing $G'$ from $G$ can be
done in polynomial time, so that VC $\pless$ 3-Colorability. 
\end{proof}

In fact, we can restrict the class of graphs $G'$ that we consider.  A
planar graph is one that can be drawn in the plane such that none of
its edges cross each other.  We can show that 3-Colorability $\pless$
Planar 3-Colorability, where the graph $G'$ to be three-colored must
be planar.  The basic idea is that wherever two edges cross we
introduce the gadget in Figure \ref{fig:planar-gadget}.  The gadget is
constructed in such a way that no matter how it is three-colored, the
color of $A$ must be the same as the color for $A'$, and the color for
$B$ must be the same as the color for $B'$.  This helps us transform a
non-planar graph into a planar graph such that either the two graphs
can both be three-colored, or neither of them can be.

\begin{figure}
\centerline{\mbox{\psfig{figure=planar-gadget.ps,height=1.5in}}}
\caption{Gadget for dealing with crossing edges}
\label{fig:planar-gadget}
\end{figure}


Note that we haven't shown any of these problems aren't in $\poly$.
Right now, we're doing the best we can by showing that if we could solve one 
of them in polynomial time, then we could solve other problems.

\end{document}
