\documentclass[12pt,ifthen]{article}
\usepackage{url}
\usepackage{comment}

\newif{\ifshowsoln}
% \showsolntrue

\newcommand{\und}{\_\_\_\_\_\_\_\_\_}
\renewcommand{\P}{{\rm P}}
\newcommand{\into}{{\leftarrow}}
\newcommand{\HAMPATH}{{\rm HAMPATH}}
\newcommand{\HAMCYCLE}{{\rm HAMCYCLE}}
\newcommand{\FHAMCYCLE}{{\rm FHAMCYCLE}}
\newcommand{\NP}{{\rm NP}}
\newcommand{\FP}{{\rm FP}}
\newcommand{\VC}{{\rm VC}}
\newcommand{\DS}{{\rm DS}}
\newcommand{\FVC}{\rm FVC}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\lf}{\left\lfloor}
\newcommand{\rf}{\right\rfloor}
\newcommand{\lc}{\left\lceil}
\newcommand{\rc}{\right\rceil}
\newcommand{\Ceil}[1]{\left\lceil {#1}\right\rceil}
\newcommand{\ceil}[1]{\left\lceil {#1}\right\rceil}
\newcommand{\floor}[1]{\left\lfloor{#1}\right\rfloor}

\newcommand{\goes}{\rightarrow}
\usepackage{amsmath}
\usepackage{amssymb}  % for \nmid

\begin{document}

\centerline{\bf HW 11 CMSC 452}
\centerline{\bf Morally Due TUES April 22 11:00AM} 
\centerline{\bf Dead-Cat Due THU April 24 11:00AM} 


\begin{enumerate}

\item
(40 points) 
In class we did an example of taking a formula $\phi$ and producing a
graph $G$ and a number $k$ such that

$\phi$ is satisfiable IFF $G$ has an ind. set of size $k$. 

The formula was in 3-CNF form which means it is of the form

$C_1 \wedge \cdots \wedge C_k$ where each $C_i$ is the $\vee$ of 3 literals.

The reduction produced $k$ $\triangle$s  and then edges between the $\triangle$s.


\begin{enumerate}
\item
(10 points)
Write psuedocode for a program that takes any formula in 3-CNF form and
outputs a graph $G$ and a number $k$. 

Here is a HINT in that its the program with FILL IN THE BLANKS. 

Begin with 
\begin{enumerate}
\item
Input $C_1 \wedge \cdots \vee C_k$ where


$C_1 = (L_{11} \vee L_{12} \vee L_{13} )$


$C_2 = (L_{21} \vee L_{22} \vee L_{23} )$


$\vdots$ $\qquad$  $\vdots$ $\qquad$ $\vdots$

$C_k = (L_{k1} \vee L_{k2} \vee L_{k3} )$

\item
$V$ is YOU NEED TO DESCRIBE $V$.

\item
$E$ is YOU NEED TO DESCRIBE $E$.

\item
Output $(V,E)$. 
\end{enumerate} 

You do not need to prove or even mention that the program works in polynomial time.
It will. 

\item
Describe the graph you get on input

$$(\neg x \vee y \vee z) \wedge (x\vee \neg y \vee z) \wedge (w\vee \neg x \vee y)
\wedge (\neg w \vee x\vee \neg y).$$


\item
(0 points)
Think about. Come up with a 3-CNF formula that is NOT in 3-SAT.
Apply your algorithm to it. What does the graph look like?
\end{enumerate}

\newpage 

\item
(30 points) 
In this problem all numbers are written in binary.
Hence the number $x$ takes $\lg_2(x)$ bits to represent
and hence is of LENGTH $\lg_2(x)$. 

In this problem all of the quantifiers range over $\{0,1,2,\ldots\}$. 

For $k\ge 2$ let 

$SQ_k=\{ x \colon (\exists y_1,\ldots,y_k)[ x=y_1^2+\cdots+y_k^2] \}$.

\begin{enumerate}
\item
(6 points)

Show that, for all $k$,  $SQ_k$ is in NP. 

(Just describe the witness $y$ and the set $B$.) 

\item
(6 points)
Look on the web to find out what is known about the following questions: 
(Here and for later questions, you don't have to look on the web if you are
sure you know the answer.) 

Is $SQ_2\in\P$?
Is $SQ_2$ NP-Complete?

\item
(6 points)
Look on the web to find out what is known about the following questions: 

Is $SQ_3\in\P$?
Is $SQ_3$ NP-Complete?

\item
(6 points)
Look on the web to find out what is known about the following questions: 

Is $SQ_4\in\P$?
Is $SQ_4$ NP-Complete?

\item
(6 points)
Look on the web to find out what is known about the following questions: 

Is $SQ_5\in\P$?
Is $SQ_5$ NP-Complete?

\end{enumerate}

\newpage

\item 
(30 points)

A {\it Graph} is a $G=(V,E)$ where $V$ is a set and $E$ is a set of unordered pairs of elements of $V$.
(Note that we do not allow self-loops and the edges are undirected.) 

A graph $G=(V,E)$ is {\it $k$-colorable} if there is a function 

$f: V \into \{1,\ldots,k\}$

such that if $(x,y)\in E$ then $f(x)\ne f(y)$. (So two neighbors cannot have the same color.)

A graph is {\it Planar} if it can be drawn in the plane without crossing. 

You can assume the following is true (it is!): $\{ G \colon \hbox{ $G$ is Planar} \}\in\P$.

For all $k\ge\N$ let 

$A_k=\{ G \colon \hbox{ $G$ is Planar and $G$ is $k$-colorable } \}$.

\begin{enumerate}
\item
(6 points) Show that, for all $k$, the set $A_k$ is in NP.

(Just describe the witness $y$ and the set $B$.) 

\item
(6 points)
Look on the web to find out what is known about the following questions: 
(Here and for later questions, you don't have to look on the web if you are
sure you know the answer.) 

Is $A_2\in \P$?
Is $A_2$ NP-complete?

\item
(6 points)
Look on the web to find out what is known about the following questions: 

Is $A_3\in \P$?
Is $A_3$ NP-complete?

\item
(6 points)
Look on the web to find out what is known about the following questions: 

Is $A_4\in \P$?
Is $A_4$ NP-complete?

\item
(6 points)
Look on the web to find out what is known about the following questions: 
Is $A_5\in \P$?
Is $A_5$ NP-complete?
\end{enumerate}

\end{enumerate}
\end{document}