\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{2}{06-08-2024}{Rohit Gurjar}{Anirudh Garg, Pratik Sahoo}

\section{Some undecidable problems}
\paragraph{Conway's Game of Life.}
You can view the game's rules \href{https://academo.org/demos/conways-game-of-life/}{here} play the game \href{https://playgameoflife.com/}{here}.
Despite its simplicity, certain questions about the Game of Life are undecidable. For instance, it's undecidable whether a given initial configuration will eventually stabilize, enter a repeating cycle, or continue to change indefinitely (this is related to the ``Life universality problem"). This undecidability arises because the Game of Life is Turing complete, meaning it can simulate any computation.
 As a result, 
\begin{claim}
No general algorithm can predict the long-term behaviour of arbitrary configurations in Conway's Game of Life.
\end{claim}

\paragraph{Hilbert's tenth problem.}
The problem ask if a given polynomial equation (in multiple variables) has an integer solution. 
%
The problem is known to be undecidable. This is the result of combined work of Martin Davis, Yuri Matiyasevich, Hilary Putnam and Julia Robinson, which culminated in 1970. 
%
The proof shows that you can encode the behavior of any C++ program into a Diophantine equation in such a way that the program halts on a given input if and only if the corresponding Diophantine equation has an integer solution. 
%

 \section{The Turing Machine: A Formal Model of Computation}

A Turing machine (TM) is a mathematical model of computation that consists of a \textbf{tape}, a \textbf{head}, and a \textbf{finite state control}. It operates on a tape divided into cells, each of which can contain a symbol from a finite alphabet. The head can read and write symbols on the tape and move left or right. The finite state control determines the actions of the head based on the current state and the symbol read. 

Formally, a Turing machine is defined by a tuple:

\[
M = (Q, \Sigma, \Gamma, \delta, q_0, F)
\]

where:

\begin{itemize}
    \item \textbf{Q} is a finite set of states.
    \item $\mathbf{\Sigma}$ is the input alphabet, a finite set of symbols.
    \item $\mathbf{\Gamma}$ is the tape alphabet, a finite set of symbols that includes $\mathbf{\Sigma}$
     and the blank symbol 'B'.
    \item $\mathbf{\delta}$ is the transition function, mapping a state and a symbol to a new state, a symbol to write, and a direction (L or R) for the head to move.
    \item \textbf{$q_0$} is the initial state.
    \item \textbf{F} is a set of final states.
\end{itemize}

The Turing machine starts with the input string written on the tape, the head positioned at the beginning of the string, and the control in the initial state. The machine then iterates through the following steps:

\begin{enumerate}
    \item \textbf{Read}: The head reads the symbol on the current cell.
    \item \textbf{Transition}: The transition function is consulted based on the current state and the symbol read. It determines the new state, the symbol to write, and the direction to move the head.
    \item \textbf{Write}: The head writes the new symbol onto the current cell.
    \item \textbf{Move}: The head moves left or right according to the transition function.
\end{enumerate}

The machine halts when it enters a final state. The output of the Turing machine is the string on the tape at the time of halting.

\subsection{Multi-Tape Turing Machines}

A multi-tape Turing machine is an extension of the basic model with multiple tapes. Each tape has its own head and is controlled by the same finite state control. This allows for more complex computations as information can be stored and accessed simultaneously on different tapes.

\subsection{Simulation of Multi-Tape by Single-Tape}

Surprisingly, any multi-tape Turing machine can be simulated by a single-tape Turing machine. This is achieved by encoding the contents of multiple tapes into a single tape, using special delimiters to separate the data. The single-tape machine can then simulate the actions of the multi-tape machine by carefully traversing the tape and manipulating the encoded data. A multi-tape TM running in time $t(n)$ can be simulated by a single tape TM running in time $O(t(n)^2)$.

\subsection{Binary Alphabet}

A Turing machine with any alphabet can be converted into a Turing machine with a binary alphabet. This is done by encoding each symbol of the original alphabet with a unique binary string. The binary Turing machine can then simulate the actions of the original Turing machine by reading, writing, and manipulating these binary strings.

\subsection{Conclusion}

The Turing machine, despite its simple design, is a remarkably powerful model of computation. Its ability to simulate various computational processes, including multi-tape models and different alphabets, demonstrates its universality and its crucial role in understanding the theoretical limits of computation.
 
 %\textbf{Note:} Infinite- Infinitely long tape Turing Machine is more powerful than finite- Infinitely long Turing Machine.



\begin{quote}
"The idea behind digital computers may be explained by saying that these machines are intended to carry out any operations which could be done by a human computer."
\\
--- Alan Turing
\end{quote}

\textbf{Church-Turing Thesis:}

The Church-Turing Thesis posits that the intuitive concept of a computable function corresponds to what we now recognize as a partial recursive function. In simpler terms, it suggests that any computation that can be performed in the real world can be effectively simulated by a Turing machine.


\section{Simulating x86 Assembly Instructions with a Turing Machine}
To support the hypothesis that any computation done on a reasonable model of computation can be done by a Turing machine, we can check that  for the basic RAM model. 
%
Converting a program in a high level language like C++ to a TM will be too cumbersome. Instead, 
we can consider a low level language like Assembly, and see how its basic instructions can be done by a TM. 

\textbf{MOV (Move Data)}

This instruction copies the value from one register to another. A Turing machine simulates this by reading the value stored in the memory location corresponding to the source register, then writing this value into the location corresponding to the destination register. The machine moves the tape head to the position that represents the source register, reads the value, then moves the tape head to the position representing the destination register, and writes the value.

\textbf{ADD (Addition)}

This instruction adds a value to the contents of a register. A Turing machine would read the value stored in the tape cell representing the register. It would then go through a series of states to add the specified value. For binary arithmetic, this involves handling carries if necessary. Finally, the machine would write the new value back to the tape in the location representing the register.

\textbf{CMP (Compare)}

This instruction compares the values in two registers and determines their relationship (e.g., equal, greater, or less). The Turing machine moves to the tape cells corresponding to the two registers, reads both values, and enters different states based on whether the values are equal, greater, or less. Instead of setting flags, the machine would transition to states that represent the result of the comparison.

\textbf{JMP (Jump)}

This instruction causes the execution to jump to a different instruction located at a specified label. A Turing machine would simulate this by moving its tape head to the position corresponding to the start of the instruction labeled by the target. The machine transitions to a state where it begins reading and executing the instructions at that new position.

%\textbf{CALL/RET (Function Call/Return)}

%For \texttt{CALL}, the Turing machine would store the current tape head position (equivalent to the instruction pointer) on a ``stack" (which could be simulated by a separate section of the tape). The machine would then move its head to the position corresponding to the start of the function code. For \texttt{RET}, the Turing machine retrieves the saved position from the stack and moves the tape head back to that position to continue execution.

\section{Concept of RAM and modern computers}
We can defined a simple model for modern computer system as:
\begin{itemize}
    \item (Countably) infinite RAM (i.e., bits of memory)
    \item Finite number of registers to store arbitrarily large integers
    \item A program counter (storing an arbitrarily large integer)
    \item Basic arithmetic, memory \& control flow commands on above components
    
\end{itemize}
In this model, any location of the RAM can be accessed/manipulated in constant time. 
%
It turns out that this model of computation is also equivalent to Turing Machines (with polynomial overhead).
%
To simulate the RAM model by TM, one can take one tape for every register. Most interesting part is to simulate random access of RAM. 

\section{Universal Turing Machine}

% A \textbf{Universal Turing Machine (UTM)} is a theoretical construct in computer science and mathematics that can simulate the behavior of any other Turing machine.
A universal Turing machine (UTM) is a Turing machine capable of computing any computable sequence, i.e., simulating the work of any other Turing machine.
Formally, a Universal Turing Machine \( U \) has the following properties:

\begin{itemize}
    \item \textbf{Input:} The input to \( U \) consists of two parts:
    \begin{itemize}
        \item A description of a Turing machine \( M \), which includes the machine's states, alphabet, transition functions, and tape configuration.
        \item An input for the machine \( M \) to process.
    \end{itemize}
    \item \textbf{Simulation:} Given a description of a Turing machine \( M \) and an input for \( M \), the Universal Turing Machine \( U \) simulates the behavior of \( M \) on that input. In other words, \( U \) emulates \( M \) by interpreting the description of \( M \) and performing the same computations that \( M \) would perform on the provided input.
    \item \textbf{Operational Structure:} The UTM operates by:
    \begin{itemize}
        \item Reading the description of \( M \) and the input from its tape.
        \item Simulating \( M \) by using its own set of states and transition functions to mimic the operation of \( M \) on the given input.
        \item Producing the same output as \( M \) would produce if \( M \) were run on the given input.
    \end{itemize}
    \item \textbf{Universality:} The UTM is called ``universal" because it can simulate any Turing machine. By loading a description of any Turing machine and its input, it can execute the corresponding computation.
\end{itemize}

\textbf{Smallest Universal Turing Machine:} It is known that there is Universal Turing Machine
which has 15 states and 2 symbol alphabet. 

\section{Time Complexity}
Let $A$ be a Turing machine that always halts.
\\
Let $t_A : \{0,1\}^* \rightarrow \textbf{N}$ describe the number of steps that $A$ takes on a given string.
The time complexity of a Turing machine is defined as:
\[t_A(n) = \max_{x \in \{0, 1\}^n} t_A(x)\]

\section{Efficient Computation}

DTime$(t(n))$ (Deterministic Time) is the class of problems where there exists a halting Turing Machine that runs in time  $O(t(n))$, where $n$ is the size of the input.

The class \textbf{P}, i.e., the problems solvable in polynomial time, is defined as
\[\textbf{P} = \bigcup_{c \geq 1} \text{DTime}(n^c)\]

\section{Cobham-Edmond Thesis}
\begin{theorem}
A Turing Machine can compute any function computable by any reasonable model of computation with polynomial time overhead.
\end{theorem}

	

\end{document}
