\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{relsize}
\newcounter{lecnum}
\usepackage{graphicx}
\graphicspath{./}
\usepackage{caption}
\usepackage{subcaption}
\newcommand{\abs}[1]{\lvert #1 \rvert}
\newcommand{\lecture}[4]{
   \newpage
   \setcounter{lecnum}{#1}
   \noindent

   \begin{center}
   \framebox{
      \vbox{\vspace{2mm}
    \hbox to 16cm { {\bf CS760 Topics in Computational Complexity
                        \hfill 2024-25 Sem I} }
       \vspace{4mm}
       \hbox to 16cm { {\Large \hfill Lecture #1: #2  \hfill} }
       \vspace{2mm}
       \hbox to 16cm { {\it Scribe: #4  \hfill  Lecturer: #3} }
      \vspace{2mm}}
   }
   \end{center}
   \vspace*{4mm}
}

\newtheorem{theorem}{Theorem}[lecnum]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}

% custom
\usepackage{enumitem}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{commath}
\newcommand{\N}{\mathbb{N}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\F}{\mathbb{F}}
\newcommand{\E}{\mathbb{E}}
\newcommand{\restr}[2]{\ensuremath{\left.#1\right|_{#2}}}
\newcommand{\aw}{\operatorname{aw}}

\begin{document}

\lecture{6}{20-08-2024}{Rohit Gurjar}{ Nandan Manjunath Immadisetty, Dheeraj Kurukunda}

\section{Some Problems to Work on}
\begin{itemize}
    \item \textbf{Longest Path Problem}: Given two vertices $a$, $b$ in a directed-graph find the longest path from $a$ to $b$.
    This is an NP-hard problem and HAM $\le$ longest path (Proof not given in class).
    
    \item (\textbf{HW}) HAMILTONIAN path problem is equivalent to HAMILTONIAN cycle problem. This means one problem reduces to other and vice-versa. (Hint: Just try to add additional vertices to prove this result in original graph)
    
    \item (\textbf{HW}) Directed longest path $\le$ Undirected longest Path, i.e.,  undirected longest path problem is NP-hard.
    
    \item Given a directed graph and vertices $a$, $b$ is there a path of even length from $a$ to $b$. 
    For undirected graph you can find such a path in linear time.
    
    \item \textbf{3-SAT $\le$ IND-SET} 
    
    Here 3-SAT is defined as the problem of determining whether a given Boolean formula, expressed in conjunctive normal form (CNF) where each clause contains exactly three literals, has an assignment of truth values to its variables that makes the entire formula evaluate to true.
    
    The IND-SET (Independent Set) problem is the problem of determining whether a given graph contains an independent set of a specified size. An independent set is a subset of vertices in the graph such that no two vertices in the subset are adjacent (i.e., there is no edge connecting any pair of vertices in the set).
    
    \item \textbf{IND-SET $\le$ MAX-CUT}
    Here MAX-CUT is defined as the problem of finding a cut in a given graph that maximizes the number of edges between two disjoint subsets of vertices. A cut is defined as a partition of the vertices of the graph into two subsets, and the value of the cut is the number of edges that have one endpoint in each subset. (Proof was not completed in class).

    \item \textbf{INTEGER PROGRAMMING} Is an optimization problem where the objective is to maximize or minimize a linear function subject to a set of linear  inequality constraints, where all variables must be integers. We can also use INTEGER PROGRAMMING to check are there any integer solutions which satisfy given linear inequalities.
    
    {3-SAT $\le$ INTEGER PROGRAMMING} Here we are only considering the case where we don't have to maximize an objective function, i.e., the feasibility question. One can reduce optimization question to feasibility via binary search. 

    \item \textbf{QUADRATIC PROGRAMMING}: Here instead of linear constraints, we will have degree 2 constraints  and our objective is to check  whether there exist real solutions (no need to be integers). This problem is NP-hard.
    
    {3-SAT $\le$ QUADRATIC PROGRAMMING PROGRAMMING}
    
\end{itemize}

Below we describe some of the above reductions. 

\subsection{Proof for 3-SAT $\le$ IND-SET}
Given a CNF formula $\Phi$, 
 we will try to generate a graph $G_{\Phi}$ and corresponding number $k_{\Phi}$ such that if $\Phi$ is satisfiable then there exists an independent set  of size $k_{\Phi}$ in $G_\Phi$ and vice-versa.

Take every clause in $\Phi$ and add vertices to graph corresponding to each literal in a clause and connect all these three vertices (3 because it is a 3-SAT) to make a triangle. Do this for every clause.
Also across clauses if there are vertices such that one is negation of another then connect these vertices.
We take $k_\Phi$ to be the number of clauses. 

If  there exists an INDSET of size $k_\Phi$ then there is an assignment to variables such that $\Phi$ is satisfiable and vice-versa. 

Why does it work. If there is an IND-SET of size $k_\Phi$ (number of 
 clauses) then each vertex should come from the triangle corresponding to each clause
  and only one vertex can come corresponding to each sub-graph as all vertices in this sub-graph are connected.
If you assign literal corresponding to each selected vertex in IND-SET  as true then we will get a satisfying assignment. Note that in the selected vertices no two literals corresponding to vertices can be negation of each other as these two vertices will be connected and won't be part of IND-SET. 

To prove the converse, consider a satisfying assignment for $\Phi$. This will set at least one literal  true from every clause. Pick one such literal from every clause, and take the corresponding set of vertices in $G_\Phi$. It is easy to verify that the obtained set is an independent set. 

\subsection{Proof for 3-SAT $\le$ INTEGER PROGRAMMING}

Let $\Phi$ be a CNF formula. 
Now to reduce it to INTEGER PROGRAMMING,
 we will create a set of linear inequalities corresponding to each clause. 
 For each clause replace $\vee$ with $+$, replace $\neg x$ with $1-x$ and make inequality as the corresponding linear expression $\ge$ 1\\
\textbf{Example:}
\[(x_1 \vee x_2 \vee \neg x3)\wedge (\neg x_1 \vee x_2)\] is converted to
\begin{align}
x_1 + x_2 + (1 - x_3) & \ge 1 \\
(1 - x_1) + x_2 & \ge 1\\
1\ge x_i\ge 0
\end{align}
Note that we need to find integer solutions.

It is easy to verify that $\Phi$ is satisfiable if and only if the constructed integer program has an integer solution. 

\subsection{Proof for 3-SAT $\le$ QUADRATIC PROGRAMMING}

It is similar to above case, but now we add a quadratic equation to ensure that
a variable can take only values 0 or 1. 

\textbf{Example:}
\[(x_1 \vee x_2 \vee \neg x3)\wedge (\neg x_1 \vee x_2)\] is converted to
\begin{align}
{x_1} + {x_2} + (1 - {x_3}) & \ge 1 \\
(1 - {x_1}) + {x_2} & \ge 1\\
{x_i}^2 & = {x_i} \text{ for } i=1,2,3.
\end{align}

\section{Understanding the Complexity Heirarchy:}

The complexity class EXP (exponential time) is defined as follows.
\[
\mathbf{EXP} = \bigcup_{c \geq 1} \text{DTime}\left(2^{n^c}\right)
\]
There is another related class \textbf{E}, which is of interest. 
\[
\mathbf{E} = \bigcup_{c \geq 1} \text{DTime}\left(2^{cn}\right)
\]

It is proven that \textbf{P \({\neq}\) EXP}, i.e., there are Problems (in terms of Turing machines etc.) that cannot be solved in polynomial time but is in \textbf{EXP}. 
%
But the questions of whether \textbf{P = NP} or whether \textbf{NP = EXP} is still unsolved.

%\begin{align*}
   % \textbf{P}  & \subseteq \textbf{NP} \subseteq \textbf{EXP} \quad (\text{but}) \\
    %\textbf{P} & \subsetneq \textbf{EXP}
%\end{align*}

\subsection{Time Constructible Functions:}
A function $f \mathbb{{N}} \to \mathbb{{N}} $ is said to be time constructible if 
$f(n)$ is computable in $O(f(n))$ time. 
    
\subsection{Time Hierarchy Theorem:}
For two time Constructible functions ${f(n)}$ and ${g(n)}$,
if $f(n)$ is significantly smaller than $g(n)$, 
i.e., if ${f(n)\log(f(n))} = {o(g(n))}$,  then
\begin{align*}
     \text{DTIME} (f(n)) &\subsetneq \text{DTIME} (g(n)).
\end{align*}
% For example, if \textbf{f(n) = \(\mathbf{n^2}\)} and \textbf{g(n) = \(\mathbf{n^3}\)} then \(\exists\) a problem s.t it could be solved in O(\(n^3\)) but not O(\(n^2\))
That is,  there are problems which can be solved in time $O(g(n))$ but not in time $O(f(n))$.
Before beginning the proof we assume the following results:
\begin{itemize}
   \item Every string in $\{0,1\}^*$ represents a TM. 
    \item For any TM, there are infinitely many representations.
   \item There is a universal TM $U$ with {6 tapes}, alphabet as $\{0,1\}$, and a constant number of states such that 
   
    for any input \(\langle x, \alpha \rangle\), $U$ will give the output $M_x (\alpha)$, where $M_x$ is the Turing machine represented by $x$. If $M_x$ halts in $t$ steps on input $\alpha$ then 
    $U(M_x,\alpha)$ halts in  $O(t \log t)$ steps. 
\end{itemize}

\textbf{Proof of time hierarchy theorem}\\
We start designing one such problem.
% Assume the follwing results:
% \begin{itemize}
%     \item Every string represents a TM
%     \item For any TM, there are infinitely many representations
%     \item 
%     We can construct a TM 'U' with \textbf{6 states}, alphabet as \textbf{0,1}, and constant states s.t \\
%     For any input \(\langle x_{m}\),\(\alpha \rangle\) if M(\(\alpha\)) runs in t then U(\(x_M,\alpha\)) runs in O(\(tlog(t)\))
% \end{itemize}
% Now consider the problem of computing the function D: \( \{0,1\}^{x} \to \{0,1\}\) below:
Define function $D(x)$ as follows:
\begin{itemize}[itemsep = 0.5mm]
    \item Run the Universal TM on \(\langle M_{x},x \rangle\) for $g(\abs{x})$ steps
    \item If there is no Output (doesn't halt): Output 0 \\
    Else if output is $b$ : Output $1-b$ (i.e flip the output). 
\end{itemize}
Clearly, this function could be computed in $O(g(n))$ time.

Now \textbf{assume} there exists a Turing Machine $N$ which always gives the same 
output as $D(\cdot)$, but under $c f(n)$ time ($c$ is some constant).

\textbf{\underline{Claim:}} $N$ will differ from $D(\cdot)$ on some input, and 
that input is one of the encodings of $N$.

Let $y$ be one of the encodings of $N$.
%
According to definition of function $D$,
$D(y)$ is obtained by running the universal TM on $\langle N, y \rangle$ for $g(\abs{y})$ steps. 
Note that the universal TM can finish the simulation of $N$ on $y$ in time $c' \cdot c \cdot f(\abs{y}) \log (c \cdot f(\abs{y}))$. 
%
If $c' \cdot c \cdot f(\abs{y}) \log (c \cdot f(\abs{y})) < g(\abs{y})$, then the universal TM on input $\langle N, y \rangle$
 will halt, with output $N(y)$.
In that case, by definition, $D(y)$ is the different from   $N(y)$. 
%
Hence, $y$ is a input where $D(\cdot)$ and $N$ disagree. 

One issue here is that the inequality  $c' \cdot c \cdot f(\abs{y}) \log (c \cdot f(\abs{y})) < g(\abs{y})$
holds only when $\abs{y}$ is large enough. 
%
Since we assumed there are infinitely many representations of any TM, we can choose a large enough representation $y$ of TM $N$. 

Thus we proved that there exists  a problem which can be computed in $O(g(n))$ time but not in $O(f(n))$ time.
However, we do not know such a separation for a natural looking problem. 

\end{document}