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






\newcommand{\poly}{{\Bbb P}}
%\newcommand{\NP}{{\Bbb NP}}
\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{lecture32}{Notes on Lecture 32 (4/24/92)}{May 1, 1992}

These notes cover the parts of the lecture not discussed in Martin.

\section*{The NP-completeness of GSAT}

The lecture began by finishing up the proof that GSAT is NP-complete.
This proof is covered in Martin pgs. 436-442.

\section*{3SAT}

One of the implications of NP-complete problems is that if any
NP-complete problem can be solved in polynomial time, then $\poly =
\NP$; that is, {\it any} problem in $\NP$ can be solved in polynomial
time.  Now that we have one NP-complete problem, it is not so
difficult to show that other problems are also NP-complete.

\begin{theorem}
Suppose that $B$ is NP-hard, and $B \pless A$.  Then $A$ is also
NP-hard.
\end{theorem}

\begin{proof}  This follows from the fact that $\pless$ is transitive.
If $B$ is NP-hard, then for all $L \in \NP$, $L \pless B$.  Since $B
\pless A$, it follows that $L \pless A$.  Therefore $A$ is NP-hard.
\end{proof}

We will now show a series of reductions from GSAT that will prove that
other problems are NP-hard.  When we can prove that the problem is
in $\NP$, then the problem is also NP-complete. Our first problem is
3SAT.  3SAT is the language of all satisfiable boolean formulas that
are in conjunctive normal form, and have no more than three literals
per clause (e.g. $(x_i \vee \bar x_j \vee x_k) \wedge (x_l \vee \bar
x_i) \wedge \ldots)$).  This form is sometimes called 3CNF.

\begin{theorem}
GSAT $\pless$ 3SAT.
\end{theorem}

\begin{proof}
We want to show that in polynomial time we can take a general boolean
formula $\phi$ and convert it to a formula $\phi'$ in 3CNF such that
$\phi$ is satisfiable if and only if $\phi'$ is.  We could try to
convert $\phi$ to CNF first, and then convert it to 3CNF, but this
might cause an exponential blowup in the size of the formula, and so
the reduction would take more than polynomial time.  So we need to
look for another way to transform the formula.  We will now give a
``proof by example''.  Suppose $\phi = \not [(x_1 \rightarrow x_2)
\wedge (x_1 \vee (( \not x_2 \vee x_3) \equiv \not x_3))]$.  We let a
new variable $y_i$ correspond to each boolean connective in the
formula (e.g.\ $y_1$ to $\rightarrow$, $y_2$ to $\wedge$, $y_3$ to
$\vee$, $y_4$ to $\vee$ and $y_5$ to $\equiv$).  We set each $y_i$ to
be equivalent to the result of each connective.  So then $(y_1 \equiv
(x_1 \rightarrow x_2))$, $(y_2 \equiv (y_1 \wedge y_3))$, $(y_3 \equiv
(x_1 \vee y_5))$, $(y_4 \equiv (\not x_2 \vee x_3))$, and $(y_5 \equiv
(y_4 \equiv \not x_3))$.  Let $\phi_1$ be the formula that is the AND
of all these clauses ($\phi_1 = (y_1 \equiv
(x_1 \rightarrow x_2)) \wedge (y_2 \equiv (y_1 \wedge y_3)) \wedge
\ldots$),
and let $\phi_2 = \phi_1 \wedge \not y_2$.  We claim that $\phi_2$ is
satisfiable iff $\phi$ is satisfiable.  First, if there is some
setting of the $x$ variables that satisfies $\phi$, we can get from
these the $y$ variables that satisfy $\phi_2$.  Similarly, if there
are $x$ and $y$ variables that satisfy $\phi_2$, then the $x$
variables alone will satisfy the formula $\phi$.

We are not quite done, since $\phi_2$ is still not in 3CNF.  However,
each clause of $\phi_2$ has three variables in it.  We can take each
clause and convert it to 3CNF form (the standard ``product-of-sums''
transformation), and obtain a formula which is 3CNF.  We are
guaranteed not to have exponential-size blowup because each clause of
3 variables cannot increase too much in size when converted to 3CNF.
This entire reduction can be done in polynomial time, so that we have
shown that GSAT $\pless$ 3SAT.  (See Martin p.\ 442-444 for a similar
reduction).
\end{proof}

\section*{2SAT}

Suppose each clause has at most 2 variables in it.  Is this problem
still NP-complete?  It turns out that the answer is ``no''; in fact,
there is a polynomial-time algorithm for deciding whether a 2CNF
formula is satisfiable or not.  We will outline the algorithm here.

First, suppose that there is a variable $x_i$ that does not appear
negated anywhere in the formula (as $\bar x_i$).  Then we can set any
such variable to $T$.  So we get a formula in which every variable
appears in both negated and unnegated forms (e.g.\ $(x_1 \vee x_2)
\wedge (\bar x_1 \vee x_3) \wedge (\bar x_2 \vee x_4) \wedge \bar x_4
\wedge (\bar x_3 \vee \bar x_2)$).  Next, if any clause has exactly
one literal in it, its assignment is determined.  For example, $x_4$
must be false for the formula above to be satisfiable.  By setting
$x_4$ to be false, we determine the settings of other variables.
Since $x_4$ is false, $x_2$ must be false, which forces $x_1$ to be
true, which forces $x_3$ to be true.

Once we are finished with these two steps, each clause will have two
variables in it, and each variable will occur in both negated and
unnegated forms.  Next we choose some variable $x_i$ arbitrarily, try
assigning it ``true'', and propagate the effects of this assignment as
above.  Eventually one of three things happen:
\begin{enumerate}
\item The entire formula is satisfied.  Then we are done.
\item We reach a contradiction.  This implies that $x_i$ must be
false, not true, so we assign $x_i$ ``false'' and propagate the
effects
of the assignment.
\item Propagation stops without assigning values to all variables.
\end{enumerate}
\noindent In this last case the assignment of ``true'' to $x_i$ has
satisfied some subset of clauses.  The remaining clauses don't contain
any occurences of $x_i$ or any of the variables that were set by
propagating the effects of the assignment.  So we can simply remove
the satisfied clauses and repeat the step of arbitrarily setting the
value of one of the remaining variables.

The entire algorithm runs in polynomial time because the propagation
step takes polynomial time.  Each time we arbitrarily set the value of
the variable, we discover the proper setting of that variable.  Since
there are only a polynomial number of variables, we only do this a
polynomial number of times.

\section*{Clique}

In this part of the lecture, we showed that 3SAT $\pless$ Clique.
This reduction is covered in Martin pgs.\ 444-446, where it is
referred to as the ``complete subgraph problem''.

\end{document}
