\newsection
\section{Turing Machines}
\setcounter{subsection}{2}
\subsection{Representation}
Turing machines are much more capable than FA and NFA. A full definition of them can be found in the book on pages 96 - 98 (= pages 110 - 112 in the PDF).

For example, to detect a recursive language like $\{ 0^n 1^n \divides n \in \N \}$ we simply replace the left and rightmost symbol with a different one
and repeat until we only have the new symbol, at which point we accept, or there are no more $0$s or $1$s, at which point we reject.

The Turing Machines have an accepting $\qacc$ and a rejecting state $\qrej$ and a configuration is an element of
$\{ \{ \cent \}\cdot \Gamma^* \cdot Q \cdot \Gamma^+ \cup Q \cdot \{ \cent \} \cdot \Gamma^+ \}$ with $\cdot$ being the concatenation and $\cent$ the marker of the start of the band.
\rmvspace
\begin{align*}
    \cL_{RE} & = \{ L(M) \divides M \text{ is a TM} \}\\
    \cL_R    & = \{ L(M) \divides M \text{ is a TM and it always halts} \}
\end{align*}


\subsection{Multi-tape TM and Church's Thesis}
$k$-Tape Turing machines have $k$ extra tapes that can be written to and read from, called memory tapes. They \textit{cannot} write to the input tape.
Initially the memory tapes are empty and we are in state $q_0$.
All read/write-heads of the memory tapes can move in either direction, granted they have not reached the far left end, marked with $\cent$.

As with normal TMs, the Turing Machine $M$ accepts $w$ if and only if $M$ reaches the state $\qacc$ and rejects if it does not terminate or reaches the state $\qrej$

\inlinelemma There exists an equivalent $1$-Tape-TM for every TM.

\inlinelemma There exists an equivalent TM for each Multi-tape TM.


Church's Thesis states that the Turing Machines are a formalization of the term ``Algorithm''.
It is the only axiom specific to Computer Science.

All the words that can be accepted by a Turing Machine are elements of $\cL_{RE}$ and are called \bi{recursively enumerable}.


\subsection{Non-Deterministic Turing Machines}
The same ideas as with NFA apply here. The transition function also maps into the power set:
\rmvspace
\begin{align*}
    \delta : (Q - \{ \qacc, \qrej \}) \times \Gamma \rightarrow \cP(Q \times \Gamma \times \{ L, R, N \})
\end{align*}

\drmvspace
Again, when constructing a normal TM from a NTM (which is not required at the Midterm, or any other exam for that matter in this course),
we again apply BFS to the NTM's calculation tree.

\stepLabelNumber{theorem}
\inlinetheorem For an NTM $M$ exists a TM $A$ s.t. $L(M) = L(A)$ and if $M$ doesn't contain infinite calculations on words of $(L(M))^C$, then $A$ always stops.
