Undecidability of the Spectral Gap
We show that the spectral gap problem is undecidable. Specifically, we construct families of translationally-invariant, nearest-neighbour Hamiltonians on a 2D square lattice of $d$-level quantum systems ($d$ constant), for which determining whether the system is gapped or gapless is an undecidable problem. This is true even with the promise that each Hamiltonian is either gapped or gapless in the strongest sense: it is promised to either have continuous spectrum above the ground state in the thermodynamic limit, or its spectral gap is lower-bounded by a constant in the thermodynamic limit. Moreover, this constant can be taken equal to the local interaction strength of the Hamiltonian. This implies that it is logically impossible to say in general whether a quantum many-body model is gapped or gapless. Our results imply that for any consistent, recursive axiomatisation of mathematics, there exist specific Hamiltonians for which the presence or absence of a spectral gap is independent of the axioms. These results have a number of important implications for condensed matter and many-body quantum theory.
acknowledgements.tex

\section{Acknowledgements}
TSC would like to thank IBM T.\ J.\ Watson Laboratory for their hospitality during many visits, and Charlie Bennett in particular for insightful discussions about aperiodic tilings and reversible Turing Machines. Also, for pointing out that he [Charlie] had wrestled with implementation details of reversible Turing Machines thirty years ago, and it was time a younger generation took over! TSC also thanks Ashley and Catherine Montanaro for their kind hospitality in lodging him for two months in their house in Cambridge, where part of this work was carried out.

TSC, DPG and MMW thank the Isaac Newton Institute for Mathematical Sciences, Cambridge for their hospitality during the programme ``Mathematical Challenges in Quantum Information'', where part of this work was carried out. TSC and DPG are both very grateful to MMW and the Technische Universit\"at M\"unchen for their hospitality over summer 2014, when another part of the work was completed.

TSC is supported by the Royal Society. DPG acknowledges support from MINECO (grant MTM2011-26912), Comunidad de Madrid (grant QUITEMAD+-CM, ref. S2013/ICE-2801), and financial support from the John von Neumann Professorship program of the Technische Universti\"at M\"unchen. DPG and MMW acknowledge support from the European CHIST-ERA project CQC (funded partially by MINECO grant PRI-PIMCHI-2011-1071).

This work was made possible through the support of grant \#48322 from the John Templeton Foundation. The opinions expressed in this publication are those of the authors and do not necessarily reflect the views of the John Templeton Foundation.



%%% Local Variables:
%%% mode: latex
%%% mode: visual-line
%%% mode: adaptive-wrap-prefix
%%% TeX-master: "spectral-gap"
%%% End:

%  LocalWords:  TSC DPG MMW Technische Universit unchen MINECO MTM Comunidad de QUITEMAD von Universti CHIST CQC PRI PIMCHI

introduction.tex

\section{Introduction}

The spectral gap is one of \emph{the} most important properties of a quantum many-body system. It plays a pivotal role in condensed matter, mathematical, and fundamental physics, and also in quantum computing.

One of the main goals of condensed matter theory is to understand phase transitions and phase diagrams. The behaviour of the spectral gap is intimately related to the phase diagram of a quantum many-body system, with quantum phase transitions occurring at critical points where the gap vanishes. The low-temperature physics of the system are governed by the spectral gap: gapped systems exhibit ``non-critical'' behaviour, with low-energy excitations that behave as massive particles, preventing long-range correlations \cite{Hastings_exp-decay}; gapless systems  exhibit ``critical'' behaviour, with low-energy excitations that behave as massless particles, allowing long-range correlations.

Many seminal results in mathematical physics prove that specific systems are gapped or gapless. Examples include the Lieb-Schultz-Mattis result showing that the Heisenberg chain for half-integer spins is gapless \cite{LiebSchultzMattis} (extended to higher dimensions by Hastings \cite{Hastings_LSM}), or the proof of a spectral gap for the 1D AKLT model \cite{AKLT}. Other results only apply to gapped systems. Important examples include exponential decay of correlations \cite{Hastings_exp-decay}, the 1D entanglement area-law \cite{Hastings_area-law}, or the very recent proof that the ground state energy density problem in 1D is in P \cite{Vidick}.

The spectral gap also arises as a key quantity in quantum computing, via adiabatic quantum computation \cite{Farhi-adiabatic}. In this type of computation, proven to be exactly as powerful as the usual circuit model for quantum computation \cite{Aharonov-adiabatic}, the system is initialised in the ground state of an easy Hamiltonian, that is a Hamiltonian for which the ground state can be easily constructed. Then the interactions are slowly changed, to end up in a target Hamiltonian whose ground state encodes the output of the computation. The key property controlling the efficiency of this method is the minimal spectral gap in the path of Hamiltonians connecting the initial Hamiltonian to the target. A computational problem has an efficient quantum algorithm iff there exists such a Hamiltonian path for which the minimal spectral gap is lower-bounded by an inverse-polynomial in the system size.

Thus understanding whether a given system is gapped or not is one of the fundamental questions in quantum many-body physics. Indeed, there are many famous open problems concerning the spectral gap. A paradigmatic example is the antiferromagnetic Heisenberg model. Even in 1D, the case of integer spin remains open as the ``Haldane conjecture'' \cite{Haldane}, first formulated in 1983. The same question in the case of 2D non-bipartite lattices, such as the Kagome lattice, was posed by Anderson in 1973 \cite{Anderson73}. The spectral gap of such systems remains one of the main unsolved questions about the long-sought topological spin liquid phase. This latter problem has gained a lot of attention in recent years \cite{Balents} due to materials, such as herbertsmithite \cite{Han}, whose interactions are well-approximated by the Heisenberg coupling, and which---according to the latest numerical evidence \cite{White}---are potential candidates for topological spin liquids. In the related setting of quantum field theory, determining if Yang-Mills theory is gapped is one of the Millennium Prize Problems \cite{Yang-Mills}, and is closely related to one of the most important open problems in high-energy physics: explaining the phenomenon of quark confinement.

All of these problems are specific cases of the general spectral gap problem: given a quantum many-body Hamiltonian, is the system it describes gapped or gapless? Our main result is a proof that the spectral gap problem is undecidable. This is much stronger than merely showing that a problem is computationally hard. It implies that it is not merely difficult to determine whether a systems is gapped or gapless; it is \emph{logically impossible to say} in general.

This has two subtly distinct meanings. First, the spectral gap problem is undecidable in precisely the same sense as the Halting Problem is undecidable: there cannot exist an algorithm, no matter how inefficient, to determine if a general Hamiltonian is gapped or gapless. This algorithmic undecidability relates to solving the spectral gap for a family of Hamiltonians, as we might have if we want to map out the phase diagram of a system as we vary some external parameters. Second, the spectral gap problem is in general an undecidable question: there exist simple Hamiltonians for which neither the presence nor the absence of a spectral gap is provable from the axioms of mathematics. \Cref{thm:promise,thm:axiomatic} in \cref{sec:main-results} make both of these meanings precise.

The idea that some of the most difficult open problems in physics could be mathematically proven to be ``impossible to solve'' is not new. Undecidability of other physical quantities has been shown in many-body systems for the much easier cases where either the many-body lattice structure or the translational-invariance is removed \cite{Gu-Nielsen,Lloyd,PourElRichards_book}. Indeed, proving such impossibility theorems is highlighted as one of the main open problems in mathematical physics in the list published by the International Association of Mathematical Physics in the late 90's, edited by Aizenman \cite{Aizenman}. Our result, then, can be seen as a major contribution to this.

%%% Local Variables:
%%% mode: latex
%%% mode: visual-line
%%% mode: adaptive-wrap-prefix
%%% TeX-master: "spectral-gap"
%%% End:

%  LocalWords:  Lieb Mattis AKLT iff antiferromagnetic Kagome herbertsmithite Aizenman

local-Hamiltonians.tex
\section{Encoding QTMs in local Hamiltonians}
\label{sec:local-Hamiltonians}
In this section, we give a self-contained analysis of a local Hamiltonian construction that generalises that of \textcite{Gottesman-Irani}, in order to prove a general result about local Hamiltonian encodings of arbitrary quantum computations.

A full, rigorous analysis of the resulting Hamiltonian will then prove the main result of this section:

\begin{definition}[Computational history state]
  A \keyword{computational history state} $\ket[CQ]{\psi} \in \HS_C\ox\HS_Q$ is a state of the form
  \begin{equation}
    \ket[CQ]{\psi} = \frac{1}{\sqrt{\dim \HS_C}} \sum_{t=1}^{d_C}\ket{t}\ket{\psi_t},
  \end{equation}
  where $\{\ket{t}\}$ is an orthonormal basis for $\HS_C$, and $\ket{\psi_t} = \prod_{i=1}^t U_i\ket{\psi_0}$ for some initial state $\ket{\psi_0}\in\HS_Q$ and set of unitaries $U_i\in\cB(\HS_Q)$.

  $\HS_C$ is called the \keyword{clock register} and $\HS_Q$ is called the \keyword{computational register}. If $U_t$ is the unitary transformation corresponding the $t$'th step of a quantum computation, then $\ket{\psi_t}$ is the state of the computation after $t$ steps. We say that the history state $\ket{\psi}$ \keyword{encodes} the evolution of the quantum computation.
\end{definition}

\begin{theorem}[Local Hamiltonian QTM encoding]
  \label{QTM_in_local_Hamiltonian} \hfill\\
  Let $\C^d = \Bigl(\linspan\bigl\{\leftend,\rightend\bigr\}\oplus\C^C\Bigr)\ox\Bigl(\linspan\bigl\{\leftend,\rightend\bigr\}\oplus\C^Q\Bigr)$ be the local Hilbert space of a 1\nobreakdash-dimensional chain of length $L$.

  For any well-formed unidirectional Quantum Turing Machine $M = (\Sigma,Q,\delta)$ and any constant $K>0$, we can construct a two-body interaction $h \in \cB(\C^d\ox\C^d)$ such that the 1\nobreakdash-dimensional, translationally-invariant, nearest-neighbour Hamiltonian $H(L)=\sum_{i=1}^{L+1} h^{(i,i+1)} \in \cB(\HS(L))$ on the chain of length $L\geq K+3$ has the following properties:
  \begin{enumerate}
  \item \label[part]{QTM_in_local_Hamiltonian:local_dim}%
    $d$ depends only on the alphabet size and number of internal states of $M$.

  \item \label[part]{QTM_in_local_Hamiltonian:FF}%
    $h \geq 0$, and the overall Hamiltonian $H(L)$ is frustration-free for all $L$.

  \item \label[part]{QTM_in_local_Hamiltonian:gs}%
  If we call $\HS(L-2) := (\C^C)^{\ox L-2}\ox(\C^Q)^{\ox L-2} =: \HS_C\ox\HS_Q$ and define $\Sbr\subset\HS=\linspan(\ket{\leftend}\ox\ket{\leftend})_1 \ox \HS(L-2) \ox \linspan(\ket{\rightend}\ox\ket{\rightend})_L$, the unique ground state of $H(L)|_\Sbr$ is a computational history state encoding the evolution of $M$ on input corresponding to the unary representation of the number $L-K-3$, running on a finite tape segment of length $L-3$.

    \setcounter{tmpcounter}{\value{enumi}}
  \end{enumerate}
  %
  Moreover, if $M$ is proper on input given by the unary representation of $L-K-3$, then:
  %
  \begin{enumerate}\setcounter{enumi}{\value{tmpcounter}}
  \item \label[part]{QTM_in_local_Hamiltonian:halt}%
    The computational history state always encodes $\Omega(\abs{\Sigma\times Q}^L)$ time-steps. If $M$ halts in fewer than the number of encoded time steps, exactly one $\ket{\psi_t}$ has support on a state $\ket{\top}$ that encodes a halting state of the QTM. The remaining time steps of the evolution encoded in the history state leave $M$'s tape unaltered, and have zero overlap with $\ket{\top}$.

  \item \label[part]{QTM_in_local_Hamiltonian:out-of-tape}%
    If $M$ runs out of tape within a time $T$ less than the number of encoded time steps (i.e.\ in time-step $T+1$ it would move its head before the starting cell or beyond cell $L-3$), the computational history state only encodes the evolution of $M$ up to time $T$. The remaining steps of the evolution encoded in the computational history state leave $M$'s tape unaltered.

  \item \label[part]{QTM_in_local_Hamiltonian:explicit-form}%
    Finally, if $M$ satisfies \cref{phase-estimation_QTM:amplitudes} of \cref{phase-estimation_QTM}, then $h$ has the following form
    \begin{equation}
      h = A + (e^{i\pi\varphi}B + e^{i\pi2^{-\abs{\varphi}}} C + \hc),
    \end{equation}
    with $B,C \in \cB(\C^d\ox\C^d)$ independent of $n$ and with coefficients in $\Z$, and $A\in \cB(\C^d\ox\C^d)$ Hermitian independent of $n$ and with coefficients in $\Z+\frac{1}{\sqrt{2}}\Z$.
  \end{enumerate}
\end{theorem}

Though we will not need it for our purposes, it is not difficult to prove that the next-highest eigenstate of $H(L)|_\Sbr$ has energy $O(1/T^3)$, where $T$ is the total number of time-steps encoded in the computational history state.




\subsection{Preliminaries}\label{sec:local_Hamiltonian_preliminaries}
As our construction draws heavily on \cite{Gottesman-Irani}, we will follow their notation and terminology, which we summarise here. We divide the chain into multiple tracks:
\begin{center}
  \begin{tabular}{|l|clc|r|}
    \hline
    \multirow{5}{*}{$\leftend$}
    & \dots & Track 1: Clock oscillator & \dots &
    \multirow{5}{*}{$\rightend$} \\
    \cline{2-4}
    & \dots & Track 2: Counter TM head and state & \dots & \\
    \cline{2-4}
    & \dots & Track 3: Counter TM tape & \dots & \\
    \cline{2-4}
    & \dots & Track 4: QTM head and state & \dots & \\
    \cline{2-4}
    & \dots & Track 5: QTM tape & \dots & \\
    \cline{2-4}
    & \dots & Track 6: Time-wasting tape & \dots & \\
    \hline
  \end{tabular}
\end{center}
The local Hilbert space at each site is:
\begin{equation}\label{eq:local_Hilbert_space}
  \begin{split}
    \HS := &\left(
              \linspan\bigl\{\ket{s,p,\sigma}\bigr\} \oplus
              \linspan\bigl\{\ket{\leftend},\ket{\rightend}\bigr\}
            \right) \ox
            \left(
              \linspan\bigl\{\ket{q,\tau,\gamma}\Bigr\} \oplus
              \linspan\bigl\{\ket{\leftend},\ket{\rightend}\bigr\}
            \right)\\
    &s \in \{\arrRzero,\arrLzero,\arrLzeroi,\arrRone,\arrLone,
             \blankL,\blankR\} \text{ for } i\in\{1,\dots,K\},\\
    &p \in P'\cup\{\blankL,\blankR\}
     \text{ where } P:=P_L\cup P_N\cup P_R \text{ and } P':=P\cup P'_R,\\
    &q \in Q'\cup P\cup P'_L\cup \{r_x\}\cup \{\blankL,\blankR\}
     \text{ where } Q:=Q_L\cup Q_N\cup Q_R, Q':=Q\cup Q'_L\\
     &\quad\text{ and } x \in Q\\
    &\sigma \in \Sigma,\\
    &\tau \in \Xi
     \text{ where } \Xi := \{\vdash,\#, 0,\ldots, \zeta-1\}
     \text{ with } \zeta = \abs{\sigma\times Q},\\
    &\gamma \in \Xi \cup \{\vdash_q\} \text{ where } q\in Q'.
  \end{split}
\end{equation}
$\Sigma$ is the tape alphabet of our given QTM $M$. $\Xi$ is the alphabet of the counter TM. $P_L,P_N,P_R$ are the sets of internal states of the counter TM that can be entered by the TM head moving left, not moving, or moving right (respectively). The states $p'\in P_R'$ duplicate the states $p\in P_R$, and $p'\in P'_L$ duplicate those in $P_L$. Similarly for the internal states $Q_L,Q_N,Q_R$ of the QTM, with $q'\in Q'_L$ duplicating the states $q\in Q_L$. Recall that by the unidirection property of reversible and quantum Turing Machines (\cref{reversible_transitions,QTM_transitions}), these sets are disjoint. The $\blankL$ and $\blankR$ Track~2 and~4 symbols are used for cells that do not currently hold the head.\footnote{There are two blank symbols because we will need different symbols to the left and right of the head, in order to enforce the constraint that there is only one head on the track.} The bracket states $\leftend,\rightend$ are the special boundary states $\ket{\leftend},\ket{\rightend}$ from \cref{QTM_in_local_Hamiltonian} that will  only appear at the ends of the chain. The role of the Track~1 states is described in \cref{sec:clock-oscillator}. That of the Track~6 ``time-wasting'' tape, as well as the role of the additional Track~4 $P\cup P'_L$ states, will become apparent in \cref{sec:unitarity}.

This set of states defines a standard basis for the single-site Hilbert space $\HS$. The product states over this single-site basis then give a basis for the Hilbert space $\HS^{\ox L}$ of the chain. We call these the \keyword{standard basis states}.
\begin{definition}[Bracketed state]\label{def:bracketed}
  We call standard basis states that match the regular expression $\leftend\wcsymbol{}^*\rightend$ \keyword{bracketed states} (where $\leftend,\rightend$ stand for the states $\ket{\leftend}_{\text{Tracks~1--3}}\ket{\leftend}_{\text{Tracks~4--6}}$ and $\ket{\rightend}_{\text{Tracks~1--3}}\ket{\rightend}_{\text{Tracks~4--6}}$ respectively, and $\wcsymbol$ stands for any single-site state other than $\leftend,\rightend$).
  %
  We denote by $\Sbr$ the subspace spanned by the bracketed states.
\end{definition}


We will often denote configurations of multiple tracks by writing them vertically, e.g.
\begin{alignat*}{3}
  \twocellsvert{\arrL\,}{p_1}\;, &\qquad&
  \twocellshoriz{\blankL}{\arrL\,}\;, &\qquad&
  \sixcellsvert{\arrL\,}{\blankR}{\blankL}{p_1}{0}{1}
\end{alignat*}
denote, respectively, a single-site configuration of two tracks, a configuration on two neighbouring sites of one track, and a configuration on two neighbouring sites of three tracks. Since we will restrict throughout to the subspace $\Sbr$ of bracketed states, the $\leftend$ and $\rightend$ states will only ever appear at the left and right ends of the chain, across all the tracks. As a shorthand, we will therefore denote configurations involving $\leftend$ and $\rightend$ with symbols stretching vertically across all tracks, e.g.
\begin{alignat*}{2}
  \threecellsL{\arrL\,}{p_1}\;, &\qquad&
  \fourcellsR{\blankR}{p_1}{\;1\;\;}\;.
\end{alignat*}
We will also sometimes need to specify configurations in which the tracks are in any configuration \emph{other than} $\leftend,\rightend$. We denote this with a $\neg\leftend$ or $\neg\rightend$ symbol stretching vertically across all tracks, e.g.
\begin{alignat*}{2}
  \threecellsnotL{\arrL\,}{p_1}\;, &\qquad&
  \fourcellsnotR{\blankR}{p_1}{\;1\;\;}\;.
\end{alignat*}


As usual in such constructions, the two-body Hamiltonian will contain two types of terms: \keyword{penalty terms} and \keyword{transition rule terms}. Penalty terms have the form $\proj{ab}$ where $a,b$ are standard basis states. This adds a positive energy contribution to any configuration containing $a$ to the left of $b$. We call $ab$ an \keyword{illegal pair}, and denote a penalty term $\proj{ab}$ in the Hamiltonian by its corresponding illegal pair. We will sometimes also make use of single-site illegal states $a$. Note that single-site illegal states are easily implemented in terms of illegal pairs, by adding penalty terms $\proj{ax}$ and $\proj{xa}$ for all pairs $ax$ and $xa$ in which the single-site state appears.

\begin{definition}[Legal and illegal states]\label{def:illegal}
  We call a standard basis state \keyword{legal} if it does not contain any illegal pairs, and \keyword{illegal} otherwise.
\end{definition}

We will make repeated use of Lemma~5.2 from \cite{Gottesman-Irani}, which lets us use penalty terms to restrict to configurations matching a regular expression:
\begin{lemma}[Regexps]\label{regexp}
  For any regular expression over the standard basis of single-site states in which each state appears at most once, we can use penalty terms to ensure that any legal standard basis state for the system is a substring of a string in the regular set.
\end{lemma}
All the regular expressions we will use start with a left-bracket state $\leftend$ and end with a right-bracket $\rightend$. So whenever we apply this \namecref{regexp}, the only substrings of the regular set that are \emph{bracketed states} are in fact complete strings in the regular set, not substrings.

Transition rule terms have the form $\tfrac{1}{2}(\ket{\psi}-\ket{\varphi})(\bra{\psi}-\bra{\varphi})$, where $\ket{\psi},\ket{\varphi}$ are states on the same pair of adjacent sites. We will often take $\ket{\psi} = \ket{ab}$ and $\ket{\varphi} = \ket{cd}$ to be standard basis states. This forces any zero-energy eigenstate with amplitude on a configuration containing $ab$ to also have equal amplitude on the configuration in which that $ab$ is replaced by $cd$. Conversely, if a zero-energy eigenstate has amplitude on a configuration containing $cd$, it must also have equal amplitude on the configuration in which that $cd$ is replaced by $ab$. Thus we can think of these terms as implementing the transition rules $ab \rightarrow cd$, which we arbitrarily call the ``forwards'' direction, and the corresponding ``backwards'' transition $cd\rightarrow ab$. Following the notation in \cite{Gottesman-Irani}, we will denote transition rule Hamiltonian terms by their associated forwards transitions $ab\rightarrow cd$ or, more generally, $\ket{\psi} \rightarrow \ket{\varphi}$.

When a transition rule acts diagonally on a subset of the tracks, we will sometimes consider the \keyword{restriction} of the transition rule to those tracks. That is, for a transition rule with the general form $\ket[T]{ab}\ket[T^c]{\psi} \rightarrow \ket[T]{cd}\ket[T^c]{\varphi}$, where $T$ is some subset of the tracks, the restriction of the rule to $T$ is given by $\ket[T]{ab} \rightarrow \ket[T]{cd}$.

When we specify a Hamiltonian term only on a subset of the tracks, we implicitly mean that it acts as identity on the remaining (unspecified) tracks. We will assume throughout this section that the ground state subspace of the Hamiltonian is restricted to the subspace $\Sbr$ of bracketed states, with $\leftend$ at the left end of the chain and $\rightend$ at the right. (We show how to enforce this later, in \cref{sec:put-together}.)



\subsection{Clock Oscillator}\label{sec:clock-oscillator}
Every clock -- even one unusual enough to be encoded in superposition into the ground state of a quantum many-body Hamiltonian! -- needs some form of \keyword{oscillator} that oscillates with a fixed period (such as a pendulum), and a \keyword{counter} that is incremented after each complete oscillation of the oscillator (such as the hands on a clock). For the counter, we will use a reversible counter Turing Machine, described in \cref{sec:counter_TM}. This section describes the Track~1 clock oscillator.

The legal configurations of Track~1 are states matching the regular expression $\leftend\blankL{}^*[\arrRzero\arrLzero\arrLzeroi\arrRone\arrLone]\blankR{}^*\rightend$. By \cref{regexp}, we can enforce this using penalty terms. Independent of the configuration of any other track, a $\arrR$ arrow (either $\arrRzero$ or $\arrRone$) sweeps right along the chain until it reaches the end, whereupon it turns around and becomes a $\arrL$. (When a $\arrRzero$ reaches the end and turns around, the label on the arrow steps through the sequence $(0),(1),\dots,(K)$. This is used later on to correctly initialise the other tracks. The restriction to $L\ge K+3$ in \cref{QTM_in_local_Hamiltonian} ensures that there is enough space for such sequences of transitions.) This $\arrL$ arrow sweeps left until it reaches the beginning of the chain, at which point it turns around and becomes a $\arrR$ again. We call this entire sequence an \keyword{oscillator cycle}. (One complete cycle is illustrated in \cref{fig:clock-oscillator} for a chain of length six.) On a chain of length $L$, one complete oscillator cycle takes $2(L-2)$ steps. The following transition rules on Track~1 enforce this:
\begin{equation}
  \begin{alignedat}{4}
    \twocellshoriz{\arrRzero}{\blankR} \longrightarrow
      \twocellshoriz{\blankL}{\arrRzero}\,,
    &\quad&
    \twocellshoriz{\arrRzero}{\rightend\,} \longrightarrow
      \twocellshoriz{\arrLzeroz}{\rightend\,}\,,
    &\quad&
    \twocellshoriz{\blankL}{\arrLzeroi} \longrightarrow
      \twocellshoriz{\arrLzeroipo}{\blankR}\,,
    &\quad&
    \twocellshoriz{\blankL}{\arrLzeroK} \longrightarrow
      \twocellshoriz{\arrLzero}{\blankR}\,,
    \\[1em]
    \twocellshoriz{\blankL}{\arrLzero} \longrightarrow
      \twocellshoriz{\arrLzero}{\blankR}\,,
    &\quad&
    \twocellshoriz{\arrRone}{\blankR} \longrightarrow
      \twocellshoriz{\blankL}{\arrRone}\,,
    &\quad&
    \twocellshoriz{\arrRone}{\rightend\,} \longrightarrow
      \twocellshoriz{\arrLone}{\rightend\,}\,,
    &\quad&
    \twocellshoriz{\blankL}{\arrLone} \longrightarrow
      \twocellshoriz{\arrLone}{\blankR}\,.
  \end{alignedat}
\end{equation}

\begin{figure}
  \begin{align*}
    &\sixcellshoriz{\leftend}{\,\arrR\,}{\blankR}{\blankR}{\blankR}{\rightend}\\
    &\sixcellshoriz{\leftend}{\blankL}{\,\arrR\,}{\blankR}{\blankR}{\rightend}\\
    &\sixcellshoriz{\leftend}{\blankL}{\blankL}{\,\arrR\,}{\blankR}{\rightend}\\
    &\sixcellshoriz{\leftend}{\blankL}{\blankL}{\blankL}{\,\arrR\,}{\rightend}\\
    &\sixcellshoriz{\leftend}{\blankL}{\blankL}{\blankL}{\,\arrL\,}{\rightend}\\
    &\sixcellshoriz{\leftend}{\blankL}{\blankL}{\,\arrL\,}{\blankR}{\rightend}\\
    &\sixcellshoriz{\leftend}{\blankL}{\,\arrL\,}{\blankR}{\blankR}{\rightend}\\
    &\sixcellshoriz{\leftend}{\,\arrL\,}{\blankR}{\blankR}{\blankR}{\rightend}\\
    &\sixcellshoriz{\leftend}{\,\arrR\,}{\blankR}{\blankR}{\blankR}{\rightend}\\
  \end{align*}
  \caption{Evolution of the Track~1 clock oscillator.}
  \label{fig:clock-oscillator}
\end{figure}

When a left-moving $\arrL$ arrow returns to the beginning of the chain, it turns around and becomes a right-moving $\arrR$ arrow again. However, the label $0$ on the arrow may change to a $1$, depending on the Track~2 state. The $\arrLzero$ arrow transitions to $\arrRone$ if the Track~2 state is $p_{\alpha}$ (the initial state of the counter TM). Whereas $\arrLone$ always transitions to $\arrRone$ \emph{unless} the Track~2 state is $p_{\alpha}$. The following transition rules implement this:
\begin{alignat}{2}
  \threecellsL{\arrLzero}{p_{\alpha}} \longrightarrow
    \threecellsL{\arrRone}{p_{\alpha}}\,,
  &\qquad&
  \threecellsL{\arrLone}{\neg p_{\alpha}} \longrightarrow
    \threecellsL{\arrRone}{\neg p_{\alpha}}\,,
\end{alignat}
where $\neg p_{\alpha}$ here denotes any Track~2 state \emph{other than} $p_{\alpha}$.



\subsection{Initialisation sweep}\label{sec:initialisation_sweep}
During the initial sweep of the Track~1 $\arrRzero$ from left to right and back, Track~1 contains a $\arrRzero$ or $\arrLzero$. We call this the \keyword{initialisation sweep}, and we want to use it to force Tracks~2 and~3 to be in the initial configurations
\begin{equation}\label{eq:track23_initial_configurations}
  \leftend\,p_0\,\blankR{}^*\rightend \text{ and } \leftend\#{}^*\rightend,
\end{equation}
respectively. We do this by adding illegal pairs to forbid Track~2 from being anything other than $\blankR$ when a $\arrRzero$ is over it (except at the beginning of the chain):
\begin{equation}
  \threecellsnotL{\arrRzero}{\neg\blankR}\,,
\end{equation}
and similarly to forbid Track~3 from being anything other than $\#$ when a $\arrRzero$ is over it (except at the beginning of the chain):
\begin{equation}
  \threecellsnotL{\arrRzero}{\neg\#}\,,
  % \qquad
  % \fourcellsnotL{\arrLzero}{\neg\blankR}{\wc}\,,
  % \qquad
  % \fourcellsnotL{\arrLzero}{\wc}{\neg\#}\,,
\end{equation}
where $\neg\wcsymbol$ again denotes anything \emph{other than} the state $\wcsymbol$.

At the beginning of the chain, we use illegal pairs to forbid Track~2 from being anything other than $p_{\alpha}$ when $\arrRzero$ is over it. We also forbid it from being $p_{\alpha}$ when a $\arrLone$ is at the beginning of the chain:
\begin{equation}
  \threecellsL{\arrRzero}{\neg p_{\alpha}}\,,
  \qquad
  \threecellsL{\arrLone}{p_{\alpha}}\,.
\end{equation}
Thus any standard basis state containing a $\arrRzero$, $\arrLzero$ or $\arrLzeroi$ on Track~1 that matches the regular expressions \cref{eq:track23_initial_configurations}, and is \emph{not} in the initial configuration on Tracks~2 and~3, will evolve (either forwards or backwards) under the oscillator transition rules into an illegal configuration, in at most $L$ steps.

If Tracks~2 and~3 are in their initial configurations, then a standard basis state containing a $\arrRzero$, $\arrLzero$ or $\arrLzeroi$ will evolve backwards until it reaches the initial configuration $\ket{\phi_0}$, the standard basis state for Tracks~1 to~3 which has the form:
\begin{equation}
  \begin{array}{|@{}c@{}|@{}c@{}|@{}c@{}|@{}c@{}|}
    \hline
    \multirow{3}{*}{$\leftend$}
    & \arrRzero & \;\blankR\quad\cdots\quad\blankR\; &
    \multirow{3}{*}{$\rightend$}\\
    \cline{2-3}
    & p_{\alpha} & \blankR\quad\cdots\quad\blankR & \\
    \cline{2-3}
    & \vdash & \#\quad\cdots\quad\# & \\
    \hline
  \end{array}.
\end{equation}



\subsection{Clock Counter}\label{sec:counter_TM}

\subsubsection{Counter TM construction}\label{sec:counter_TM_construction}
We construct the counter TM using a generalisation of the binary incrementing machine $\TM{Inc}$ from \cref{incrementer}, which will increment integers written in base-$\zeta$ instead of in binary. Constructing a base-$\zeta$ version of $\TM{Inc}$ is largely a straightforward extension of \cref{incrementer}, though ensuring reversibility is slightly subtle.

% When we write a carry, we must write a 1 on the tape both when the carry is added to a 0 digit, and when it's added to a blank symbol. Reversibility implies that we must transition into different internal states in these two cases. In order to later reversibly merge these two computational paths back together, we must exploit a tape location whose symbol always differs in these two cases, thereby allowing both computational paths to transition into the same internal state again whilst writing different symbols. The tape cell immediately to the right of where the carry was written is just such a location: it cannot be blank if the carry was added to a 0 digit (because we do not allow our little-endian numbers to be padded with zeros), whereas it must be blank if the carry was added to a blank symbol (because we do not allow embedded blanks). We can therefore merge the two computational paths using transitions to the same internal state $p$, but which write a blank symbol to the tape in one case, and a digit in the other.

% However, if the carry was added to a non-zero digit, the cell immediately to the right could contain any symbol, including a blank. We cannot therefore reuse the same internal state both for when the carry is added to a~1, and for when it's added to a non-zero digit; the transition into state $p$ writing a blank is already used by the computational path entered entered when adding the carry to a blank. We must therefore transition to a third, distinct internal state when the carry is added to a non-zero digit. To reversibly merge this third computational path with the others, we must again exploit a tape location whose symbol always differs. In this case, the tape cell where the carry was written is now such a location: it is always~1 if the carry was added to a 0 digit, and is never~1 if the carry was added to a non-zero digit. This allows us to reversibly merge all three computational paths back together: first we merge the two computational paths corresponding to adding the carry to a non-blank digit, before merging these with the path corresponding to adding the carry to a blank symbol.

The following well-formed, normal-form, partial transition function implements a reversible TM that increments any little-endian base-$\zeta$ number written on the tape with a leading ``start-of-tape'' symbol $\vdash$, and returns the head to the starting cell without ever moving the head before the starting cell:
\begin{equation}\label{eq:base-zeta_incrementer}
\begin{array}{l|cccccc}
        & \vdash & \# & 0 & 1 & i & \zeta -1\\
  \hline
  p_0   & (\vdash,p_1,R) \\
  p_1   & & (1,p_2'',R) & (1,p_2',R) & (2,p_2,R) & (i+1,p_2,R) & (0,p_1,R) \\
  p_2   & & (\#,p_3,L) & (0,p_3,L) & (1,p_3,L) & (i,p_3,L) & (\zeta-1,p_3,L) \\
  p_2'  & & & (0,p_3',L) & (1,p_3',L) & (i,p_3',L) & (\zeta-1,p_3',L) \\
  p_2'' & & (\#,p_3',L) \\
  p_3   & & & & & (i,p_4,L) & (\zeta-1,p_4,L) \\
  p_3'  & & & & (1,p_4,L) \\
  p_4   & (\vdash,p_f,N) & & (0,p_4,L) & \\
  p_f   & & (\#,p_0,R) & (0,p_0,R) & (1,p_0,R) & (i,p_0,R) & (\zeta-1,p_0,R) \\
  \multicolumn{4}{l}{\text{\footnotesize $\forall i\in\{2,\dots,\zeta-2\}$} \rule{0em}{1.5em}}
\end{array}
\end{equation}

We now modify this machine in order to make it loop forever. We must be careful to ensure that we reenter the initial state reversibly. To do this, we introduce new initial and final states $p_\alpha$ and $p_\omega$, and modify the $p_0$ and $p_f$ transitions such that the TM reversibly transitions back into the state $p_0$ instead of halting, exploiting the fact that the symbol in the second tape cell will be blank in the first iteration, and non-blank thereafter. The following set of transition rules accomplishes this:
\begin{equation}\label{eq:base-zeta_counter}
\begin{array}{l|cccccc}
         & \vdash & \# & 0 & 1 & i & \zeta-1 \\
  \hline
  p_\alpha & (\vdash,p_{-1},R) \\
  p_{-1}   & & (\#,p_0,L) \\
  p_0     & (\vdash,p_1,R) \\
  p_1     & & (1,p_2'',R) & (1,p_2',R) & (2,p_2,R) & (i+1,p_2,R) & (0,p_1,R) \\
  p_2     & & (\#,p_3,L) & (0,p_3,L) & (1,p_3,L) & (i,p_3,L) & (\zeta-1,p_3,L) \\
  p_2'    & & & (0,p_3',L) & (1,p_3',L) & (i,p_3',L) & (\zeta-1,p_3',L) \\
  p_2''   & & (\#,p_3',L) \\
  p_3     & & & & & (i,p_4,L) & (\zeta-1,p_4,L) \\
  p_3'    & & & & (1,p_4,L) \\
  p_4     & (\vdash,p_f,N) & & (0,p_4,L) & \\
  p_f     & (\vdash,p_f',R) \\
  p_f'    & & & (0,p_0,L) & (1,p_0,L) & (i,p_0,L) & (\zeta-1,p_0,L) \\
  p_\omega & (\vdash,p_\alpha,R) & (\#,p_\alpha,R) & (0,p_\alpha,R) & (1,p_\alpha,R)
          & (i,p_\alpha,R) & (\zeta-1,p_\alpha,R) \\
  \multicolumn{4}{l}{\text{\footnotesize $\forall i\in\{2,\dots,\zeta-2\}$} \rule{0em}{1.5em}}
\end{array}
\end{equation}
These transition rules implement a reversible base-$\zeta$ counter TM. When started from the tape configuration consisting of a $\vdash$ symbol in the first cell followed by the all-blank tape (representing the number~0), this TM will loop indefinitely, incrementing the number written on the tape by~1 in each complete iteration. For brevity, we will refer to this particular initial tape configuration as the \keyword{standard input} to the counter TM tape.


We now declare certain configurations of the counter TM to be ``illegal''. We will choose these illegal configurations to be such that they are never entered by the counter TM started from the standard input. Later on, when we come to encode the counter TM in a local Hamiltonian, we will use penalty terms to give energy penalties to all the configurations we declare ``illegal'' here, so that the corresponding standard basis states of the spin chain are indeed illegal in the sense of \cref{def:illegal}. For now, however,  the ``illegal configurations'' simply define a particular subset $\mathcal{I}$ of the complete set of counter TM head and tape configurations.

Anticipating the later use of penalty terms, when defining illegal configurations we will often make use of the illegal pair notation introduced above, where the top row denotes the counter TM head position and internal state $p$, and the bottom row denotes the tape symbols $ab$ in the section of tape near the head:
\begin{equation}
  \fourcells{p}{\wc}{\;a\;\;}{\;b\;\;}\qquad \text { or } \qquad
  \fourcells{\wc}{p}{\;a\;\;}{\;b\;\;}\;.
\end{equation}
A single row always denotes a section of tape:
\begin{equation}
  \twocellshoriz{\;a\;\;}{\;b\;\;}\;.
\end{equation}
Certain configurations that we declare to be illegal will specify that the counter TM head is or is not located at the starting cell. Again anticipating later use of penalty terms, we denote the starting cell by placing a $\leftend$ symbol on the left. We denote tape cells \emph{other than} the starting cell with $\neg\leftend$ on the left:
\begin{equation}
  \threecellsL{\;p\;\;}{a} \qquad \threecellsnotL{\;p\;\;}{a}\;.
\end{equation}

Note that the counter TM started from the standard input never moves its head before the starting cell, never reenters its initial state $p_\alpha$, and never enters its final state $p_\omega$. We therefore declare any counter TM configuration which is in state $p_\alpha$ with the head anywhere other than the starting cell to be illegal:
\begin{equation}\label{eq:illegal_p0}
  \fourcells{\neg\leftend\,}{p_\alpha}{\wc}{\wc}\;.
\end{equation}
We also declare any configuration in state $p_\omega$ to be illegal:
\begin{equation}\label{eq:illegal_pf}
  \fourcells{p_\omega}{\wc}{\wc}{\wc}\;.
\end{equation}
Similarly, we declare any configuration in state $p_\alpha$ with the head adjacent to a non-blank symbol to be illegal, i.e.\ any configuration containing the illegal pair
\begin{equation}\label{eq:illegal_p0+non-blank}
  \fourcells{p_\alpha}{\wc}{\wc}{\neg\#}\;.
\end{equation}

The transition table in \cref{eq:base-zeta_counter} is partial; some transitions are never used, so were not defined. For each $(p,\tau)$ for which no transition rule is defined in \cref{eq:base-zeta_counter}, we declare configurations in which the counter TM is in state $p$ and the head is reading $\tau$ to be illegal, i.e.\ any configuration containing the illegal pair
\begin{equation}\label{eq:illegal_forward_transitions}
  \twocellsvert{\;p\;\;}{\tau}\;.
\end{equation}
For each configuration $(p_L,\tau,L)$, $(p_R,\tau,R)$ or $(p_N,\tau,N)$ which is not \emph{entered} by any transition rule in \cref{eq:base-zeta_counter}, we declare the corresponding TM head and tape configurations to be illegal, i.e.\ any configurations containing one of the following illegal pairs:
\begin{equation}\label{eq:illegal_backwards_transitions}
  \fourcells{\wc}{\;p_R\;\;}{\tau}{\wc}\;,\qquad
  \fourcells{\;p_L\;\;}{\wc}{\wc}{\tau}\;,\qquad
  \fourcells{\;p_N\;\;}{\wc}{\tau}{\wc}\;.
\end{equation}

Note that during the evolution of the counter TM started from a blank tape, the head is never more than one cell to the right of a non-blank tape symbol. In fact, the only moment at which it is over a blank symbol at all is when the incrementer TM needs to carry a digit, and moves the head to the next blank cell in order to write the carry. We therefore declare configurations in which the head is more than one cell to the right of a non-blank tape symbol to be illegal, i.e.\ all configurations containing the illegal pair
\begin{equation}\label{eq:illegal_head+blank}
  \fourcells{\wc}{\;p\;\;}{\#}{\#}\;.
\end{equation}

Note also that, when started from the standard input, the counter TM never modifies the $\vdash$ in the first cell, never writes a $\vdash$ anywhere \emph{other than} the first cell, and never creates an embedded blank symbol on the tape. We therefore define all tape configurations \emph{without} a $\vdash$ in the starting cell, all tape configuration with a $\vdash$ anywhere other than the first cell, and all tape configurations with an embedded blank, to be illegal.
These illegal TM configurations correspond exactly to tape configurations matching the regular expression
\begin{equation}\label{eq:track3_regexp}
  \vdash\,i^*\,\#^*,\qquad i\in\{0\dots\zeta-1\}.
\end{equation}

The little-endian numbers written by the counter TM are never padded with leading 0's, so the tape never has a~0 to the left of a~$\#$. We therefore define this combination to be illegal, i.e.\ all tape configurations containing the illegal pair
\begin{equation}\label{eq:illegal_0+blank}
  \twocellshoriz{\;0\;\;}{\;\#\;\;}\;.
\end{equation}

Later on, we will only be interested in configurations of the first $L$ cells of the tape, and will stop the counter TM just before it tries to apply a transition rule that maps out of this portion of tape. Therefore, a~0 will never appear in the $L$'th tape cell, and we declare configurations containing a~0 in this cell to be illegal:
\begin{equation}\label{eq:illegal_0+rightend}
  \twocellshoriz{\;0\;\;}{\rightend}
\end{equation}


\begin{lemma}[Evolve-to-illegal]\label{counter_TM_evolve_to_illegal}
  Any counter TM configuration that is reached starting from the standard input is legal. All other configurations with the head in position $r \in [0,L]$ are either illegal, or evolve forwards or backwards to an illegal configuration within $O(L)$ time steps in such a way that the head never leaves the portion of tape $[0,L]$.
\end{lemma}

\begin{proof}
  The first part of the \namecref{counter_TM_evolve_to_illegal} is true by construction, since the partial transition rules of \cref{eq:base-zeta_counter} implement the counter TM without using any of the undefined transitions, and the tape configurations defined to be illegal never occur when the counter TM is started from the standard input.

  Recall that the alphabet of the counter TM is $\Xi := \{\vdash,\#\}\cup\{0,\dots,\zeta-1\}$. Any tape configuration that does not start with a $\vdash$, or which contains a $\vdash$ anywhere other than the first cell, or which contains an embedded blank, or contains a~0 to the left of a~$\#$, or with a $0$ in the $L$-th cell is illegal. So legal tape configurations match the regular expression
  \begin{equation}\label{eq:legal-tape}
    \vdash(\neg \#)^*\neg[0,\#]\#^*.
  \end{equation}
  Configurations in which the head is more than one cell away from a non-blank symbol are illegal by \cref{eq:illegal_head+blank}, so all legal configurations have the head located in, or immediately adjacent to, the non-blank portion of the tape. All other configurations are illegal.

  We divide the legal configurations into separate cases, according to the internal state of the counter TM:

  \paragraph{State $p_\alpha$:}
  All configurations in state $p_\alpha$ are illegal by \cref{eq:illegal_p0}, except those with the head in the starting cell. The latter are illegal by \cref{eq:illegal_p0+non-blank} unless the tape cell to the right of the head is blank. The only such tape configuration which is legal is the standard input. Thus the only legal configuration in state $p_\alpha$ is the initial configuration of the counter TM started from the standard input.

  \paragraph{State $p_{-1}$:}
  There are no transitions out of $(p_{-1},x)$ where $x\neq\#$ in \cref{eq:base-zeta_counter}, so by \cref{eq:illegal_forward_transitions} the only legal $p_{-1}$ configurations have their head over a $\#$. Moreover, there is only one transition into $p_{-1}$ in \cref{eq:base-zeta_counter}. Hence, evolving any such configuration one step \emph{backwards} according to \cref{eq:base-zeta_counter} either enters a configuration that is illegal due to \cref{eq:illegal_forward_transitions}, or steps the head left and transitions to $p_\alpha$. But we have shown that the only legal $p_\alpha$ configuration is the standard input. Thus any configuration in state $p_{-1}$ not reachable starting from the standard input will evolve backwards to an illegal configuration in one time step.

  \paragraph{State $p_1$:}
  Every TM configuration of the form
  \begin{gather*}
    \begin{array}{|c|c|c|c|c|c|}
      \multicolumn{4}{c}{} & \multicolumn{1}{c}{p_1}\\
      \hline
      \vdash & 0 & \cdots & 0 & \tau & \cdots \\
      \hline
      \multicolumn{2}{c}{} &
        \multicolumn{4}{l}{\raisebox{.5em}{$\underbrace{\mspace{80mu}}_n$}}
    \end{array}\\
    \tau\in \Xi/_{\{\vdash\}},\;\;
    n\ge 0\;\;
  \end{gather*}
  with the rest of the tape compatible with \cref{eq:legal-tape} is reached when evolving the counter TM from the standard input; this configuration is produced whilst the counter TM is incrementing the number with little-endian base-$\zeta$ expansion
  \begin{equation*}
    \underbrace{(\zeta-1)\dots(\zeta-1)}_n \tau\cdots.
  \end{equation*}

  The remaining legal configurations have at least one tape symbol $x$ to the left of the head that is neither 0, nor $\#$, nor $\vdash$:
  \begin{gather*}
    \begin{array}{|c|c|c|c|c|c|c|c|c|c|}
      \multicolumn{8}{c}{} & \multicolumn{1}{c}{p_1}\\
      \hline
      \vdash & i_1 & \cdots & i_m & x & 0 & \cdots & 0 & \tau & \cdots \\
      \hline
      \multicolumn{5}{c}{} &
        \multicolumn{3}{l}{\raisebox{.5em}{$\underbrace{\mspace{70mu}}_n$}}
    \end{array}\\
    x \in \Xi/_{\{\vdash,\#,0\}},\;\;
    i_1,\dots,i_m \in \Xi/_{\{\vdash,\#\}},\;\;
    \tau\in \Xi/_{\{\vdash\}},\;\;
      m,n\ge 0.
  \end{gather*}
  Evolving any such configuration \emph{backwards} according to \cref{eq:base-zeta_counter} either enters into an illegal configuration due to \cref{eq:illegal_forward_transitions}, or rewinds the head left replacing 0's with $\zeta-1$'s, eventually reaching the configuration with the head immediately to the right of the $x$:
  \begin{gather*}
    \begin{array}{|c|c|c|c|c|c|c|c|c|c|}
      \multicolumn{5}{c}{} & \multicolumn{1}{c}{p_1}\\
      \hline
      \vdash & i_1 & \cdots & i_m & x & \zeta-1 & \cdots & \zeta-1 & \tau &\cdots \\
      \hline
      \multicolumn{5}{c}{} &
        \multicolumn{3}{l}{\raisebox{.5em}{$\underbrace{\mspace{130mu}}_n$}}
    \end{array}\\
    x \in \Xi/_{\{\vdash,\#,0,1\}},\;\;
    i_1,\dots,i_m \in \Xi/_{\{\vdash,\#\}},\;\;
    \tau\in \Xi/_{\{\vdash,\#\}},\;\;
       m,n\ge 0.
  \end{gather*}
  The state $p_1$ can only be entered by moving right. But the configuration $(p_1,x,R)$ is not entered by any transition rule in \cref{eq:base-zeta_counter}, so this configuration is illegal by \cref{eq:illegal_backwards_transitions}.


  \paragraph{State $p_2$:}
  The state $p_2$ is entered when incrementing any digit other than~0, $\#$ or~$\zeta-1$, so every TM configuration of the form
  \begin{gather*}
    \begin{array}{|c|c|c|c|c|c|c|}
      \multicolumn{5}{c}{} & \multicolumn{1}{c}{p_2}\\
      \hline
      \vdash & 0 & \cdots & 0 & x & \tau & \cdots  \\
      \hline
      \multicolumn{1}{c}{} &
        \multicolumn{4}{l}{\raisebox{.5em}{$\underbrace{\mspace{80mu}}_n$}}
    \end{array}\\
    x \in \Xi/_{\{\vdash,\#,0,1\}},\;\;
    \tau \in \Xi/_{\{\vdash\}},\;\;
    n\ge 0.
  \end{gather*}
  with the rest of the tape compatible with \cref{eq:legal-tape} is reached when evolving the counter TM from the standard input. This configuration is produced whilst the counter TM is incrementing the number with little-edian base-$\zeta$ expansion
  \begin{equation*}
    \underbrace{(\zeta-1)\dots(\zeta-1)}_n (x-1) \tau\cdots
  \end{equation*}

  The state $p_2$ can only be entered by moving right. Configurations $(p_2,x,R)$ where $x\in\{\vdash,\#,0,1\}$ are not entered by any transition rule in \cref{eq:base-zeta_counter}, so these configurations are illegal by \cref{eq:illegal_backwards_transitions}.

  The remaining legal configurations have at least one tape symbol $y$ to the left of the head that is neither~0, $\#$, nor~$\vdash$:
  \begin{gather*}
    \begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}
      \multicolumn{9}{c}{} & \multicolumn{1}{c}{p_2}\\
      \hline
      \vdash & i_1 & \dots & i_m & y & 0 & \cdots & 0 & x & \tau &  \cdots \\
      \hline
      \multicolumn{5}{c}{} &
        \multicolumn{4}{l}{\raisebox{.5em}{$\underbrace{\mspace{80mu}}_n$}}
    \end{array}\\
    x \in \Xi/_{\{\vdash,\#,0,1\}},\;\;
    y \in \Xi/_{\{\vdash,\#,0\}},\;\;
    \tau \in \Xi/_{\{\vdash\}},\;\;
    i_1,\ldots, i_m \in \Xi/_{\{\vdash,\#\}},\;\;
    m,n \ge 0.
  \end{gather*}
  Evolving any such configuration \emph{backwards} one time step according to \cref{eq:base-zeta_counter} either produces an illegal configuration due to \cref{eq:illegal_forward_transitions}, or produces the configuration:
  \begin{gather*}
    \begin{array}{|c|c|c|c|c|c|c|c|c|c|c|}
      \multicolumn{8}{c}{} & \multicolumn{1}{c}{p_1}\\
      \hline
      \vdash & i_1 & \dots & i_m & y & 0 & \cdots & 0 & x-1 & \tau & \cdots \\
      \hline
      \multicolumn{5}{c}{} &
        \multicolumn{4}{l}{\raisebox{.5em}{$\underbrace{\mspace{80mu}}_n$}}
    \end{array}\\
    x \in \Xi/_{\{\vdash,\#,0,1\}},\;\;
    y \in \Xi/_{\{\vdash,\#,0\}},\;\;
    \tau \in \Xi/_{\{\vdash\}},\;\;
    i_1,\ldots, i_m \in \Xi/_{\{\vdash,\#\}},\;\;
    m,n \ge 0.
  \end{gather*}
  But we have already shown above that all such $p_1$ configurations evolve backwards in time to an illegal configuration.


  \paragraph{States $p_2',p_2''$:}
  The argument for states $p_2'$ and $p_2''$ is very similar to that for $p_2$, except that the legal value of $x$ is now $1$.


  \paragraph{State $p_3$:}
  The state $p_3$ is entered by stepping left from $p_2$, so every TM configuration of the form
  \begin{gather*}
    \begin{array}{|c|c|c|c|c|c|}
      \multicolumn{4}{c}{} & \multicolumn{1}{c}{p_3}\\
      \hline
      \vdash & 0 & \cdots & 0 & \tau &  \cdots \\
      \hline
      \multicolumn{1}{c}{} &
        \multicolumn{4}{l}{\raisebox{.5em}{$\underbrace{\mspace{80mu}}_n$}}
    \end{array}\\
    \tau \in \Xi/_{\{\vdash,\#,0,1\}},\;\;
    n \ge 0.
  \end{gather*}
  with the rest of the tape compatible with \cref{eq:legal-tape} is reached when evolving the counter TM from the standard input. This configuration is produced whilst the counter TM is incrementing the number with little-edian base-$\zeta$ expansion
  \begin{equation*}
    \underbrace{(\zeta-1)\dots(\zeta-1)}_n(\tau-1) \cdots
  \end{equation*}

  There is no transition out of $(p_3,x)$ where $\tau\in\{\vdash,\#,0,1\}$ in \cref{eq:base-zeta_counter}, so all such configurations are illegal by \cref{eq:illegal_forward_transitions}. The remaining legal configurations have at least one tape symbol $x$ to the left of the head that is neither~0, $\#$, nor~$\vdash$:
  \begin{gather*}
    \begin{array}{|c|c|c|c|c|c|c|c|c|c|}
      \multicolumn{8}{c}{} & \multicolumn{1}{c}{p_3}\\
      \hline
      \vdash & i_1 & \dots & i_m & x & 0 & \cdots & 0 & \tau &  \cdots \\
      \hline
      \multicolumn{5}{c}{} &
        \multicolumn{4}{l}{\raisebox{.5em}{$\underbrace{\mspace{80mu}}_n$}}
    \end{array}\\
    \tau \in \Xi/_{\{\vdash,\#,0,1\}}, x \in \Xi/_{\{\vdash,\#,0\}}\;\;
    i_1,\dots,i_m \in \Xi/_{\{\vdash,\#\}},\;\;
    m,n\ge 0.
  \end{gather*}
  Evolving any such configuration forwards one time step according to \cref{eq:base-zeta_counter} either produces an illegal configuration (for example if $n=0$), or produces the configuration:
  \begin{gather*}
    \begin{array}{|c|c|c|c|c|c|c|c|c|c|}
      \multicolumn{7}{c}{} & \multicolumn{1}{c}{p_4}\\
      \hline
      \vdash & i_1 & \dots & i_m & x & 0 & \cdots & 0 & \tau & \cdots \\
      \hline
      \multicolumn{5}{c}{} &
        \multicolumn{4}{l}{\raisebox{.5em}{$\underbrace{\mspace{80mu}}_n$}}
    \end{array}\\
    \tau \in \Xi/_{\{\vdash,\#,0,1\}}, x \in \Xi/_{\{\vdash,\#,0\}}\;\;
    i_1,\dots,i_m \in \Xi/_{\{\vdash,\#\}},\;\;
    m,n\ge 0.
  \end{gather*}
  We show below that any such $p_4$ configuration evolves to an illegal configuration.


  \paragraph{State $p_3'$:}
  The argument for state $p_3'$ is very similar to that for $p_3$, except that $\tau=1$ in this case.

  \paragraph{State $p_4$:}
  In a legal state $p_4$ configuration, the head must be over a $0$ or a $\vdash$, since there is no transition out of $(p_4,x)$ for $x\notin\{0,\vdash\}$. We first analyse the case in which it is over a $0$.

  Any TM configuration of the form
  \begin{gather*}
    \begin{array}{|c|c|c|c|c|}
      \multicolumn{3}{c}{} & \multicolumn{1}{c}{p_4}\\
      \hline
      \vdash & 0 & \cdots & 0 &   \cdots \\
      \hline
      \multicolumn{1}{c}{} &
        \multicolumn{4}{l}{\raisebox{.5em}{$\underbrace{\mspace{80mu}}_n$}}
    \end{array}\\
    n \ge 1
  \end{gather*}
  with the rest of the tape compatible with \cref{eq:legal-tape} is reached by evolving the counter TM from the standard input.

  The remaining legal configurations have at least one tape symbol $x$ to the left of the head that is neither~0, $\#$, nor~$\vdash$:
  \begin{gather*}
    \begin{array}{|c|c|c|c|c|c|c|c|c|}
      \multicolumn{7}{c}{} & \multicolumn{1}{c}{p_4}\\
      \hline
      \vdash & i_1 & \dots & i_m & x & 0 & \cdots & 0  &  \cdots \\
      \hline
      \multicolumn{5}{c}{} &
        \multicolumn{4}{l}{\raisebox{.5em}{$\underbrace{\mspace{80mu}}_n$}}
    \end{array}\\
    x \in \Xi/_{\{\vdash,\#,0\}},\;\;
    i_1,\dots,i_m \in \Xi/_{\{\vdash,\#\}},\;\;
    m\ge 0, n\ge 1
  \end{gather*}
  Evolving any such configuration according to \cref{eq:base-zeta_counter} steps the head left over the 0's until the head is over the $x$:
  \begin{gather*}
    \begin{array}{|c|c|c|c|c|c|c|c|c|}
      \multicolumn{4}{c}{} & \multicolumn{1}{c}{p_4}\\
      \hline
      \vdash & i_1 & \dots & i_m & x & 0 & \cdots & 0   & \cdots \\
      \hline
      \multicolumn{5}{c}{} &
        \multicolumn{4}{l}{\raisebox{.5em}{$\underbrace{\mspace{80mu}}_n$}}
    \end{array}\\
    x \in \Xi/_{\{\vdash,\#,0\}},\;\;
    i_1,\dots,i_m \in \Xi/_{\{\vdash,\#\}},\;\;
    m\ge 0, n\ge 1.
  \end{gather*}
  But there is no transition out of $(p_4,x)$ in \cref{eq:base-zeta_counter}, so this configuration is illegal by \cref{eq:illegal_forward_transitions}.

  We now analyse the case in which $p_4$ is over $\vdash$. Evolving one step backwards according to \cref{eq:base-zeta_counter} steps the head right and either enters an illegal configuration, transitions to state $p_4$ with the had over a $0$, or transitions to states $p_3$ or $p_3'$. In all three cases, we have already shown that all such configurations not reachable from the standard input evolve to illegal configurations.

  \paragraph{State $p_f$:}
  There are no transitions out of $(p_f,x)$ where $x\neq\vdash$ in \cref{eq:base-zeta_counter}, so the only legal $p_f$ configurations have the head over a $\vdash$. The latter can only appear in the starting cell in legal configurations. Evolving any such configuration backwards according to \cref{eq:base-zeta_counter} for one time step transitions to the state $p_4$, and we have already shown than all $p_4$ configurations not reachable from the standard input evolve to illegal configurations.

  \paragraph{State $p_f'$:}
  There are no transitions out of $(p_f',x)$ where $x\in\{\vdash,\#\}$ in \cref{eq:base-zeta_counter}, so the only legal $p_f'$ configurations have the head over a symbol in the set $\{0,\dots,\zeta-1\}$. Evolving any such configuration backwards according to \cref{eq:base-zeta_counter} for one time step transitions to the state $p_f$, and we have already shown than all $p_f$ configurations not reachable from the standard input evolve to illegal configurations.

  \paragraph{State $p_0$:}
  There are no transitions out of $(p_0,x)$ where $x\neq\vdash$ in \cref{eq:base-zeta_counter}, so the only legal $p_0$ configurations have the head over a $\vdash$. The latter can only appear at the beginning of the tape in legal configurations. Since the only transitions in \cref{eq:base-zeta_counter} into $p_0$ are from $p_1$ or $p_f'$, evolving any such configuration one step backwards according to \cref{eq:base-zeta_counter} either enters an illegal configuration, or steps the head right into state $p_{-1}$ or $p_f'$. In both cases we have already shown that configurations not reachable from the standard input evolve to illegal ones.

  \paragraph{State $p_\omega$:}
  The counter TM never enters the state $p_\omega$, and all such configurations are illegal.
\end{proof}




\subsubsection{Counter TM Hamiltonian}\label{sec:counter_TM_encoding}
%--- regexps ---
We want all legal Track~2 configurations to contain a single state $p\in P'$ marking the location of the counter TM head, and blanks everywhere else. I.e.\ the Track~2 configuration should match the regular expression $\leftend\blankL{}^*p\,\blankR{}^*\rightend$ where $p\in P'$. By \cref{regexp}, we can enforce this using penalty terms. This Track~2 regular expression allows us to identify Tracks~2 and~3 with the configurations of the counter TM (with internal state $p$, its position being the head location, and Track~3 the tape). This will be explicitly or implicitly exploited in all that follows.


%--- transition terms ---
To encode the evolution of this counter TM in our local Hamiltonian, we encode its transition rules in transition terms. However, the transition rules will only apply when a $\arrRone$ arrow on Track~1 sweeps past the counter TM head encoded on Track~2, so that the counter TM advances exactly one step for each complete left-to-right sweep of the $\arrRone$ arrow. Since we are restricting to two-body interactions and the arrow is moving to the right, transitions in which the head moves left must be triggered when the $\arrRone$ is to the left of the TM head, in order to both move the arrow and update the head location. This way of implementing the left transitions means that
\begin{equation}\label{eq:left-move-illegal}
  \threecellsvert{\arrRone}{p}{\sigma}
\end{equation}
never occurs during the evolution of the counter TM if $\delta(p,\sigma) = (\tau,p_L,L)$. We add a penalty term to make such configurations illegal.

Transitions in which the head moves to the right or stays still will be triggered when the $\arrRone$ is on top of the head. In order to avoid two transitions in which the head moves right from being triggered during the same sweep of the $\arrRone$, we must split these latter transitions into two stages, in which we first transition into an auxiliary state $p'_R\in P'_R$, and then transition into the correct state $p_R\in P_R$ in the following time step (adapting the construction of \cite{Gottesman-Irani}). Thus, when the $\arrRone$ is on top of the the head and the head will move right, we will update the tape, move the head, and step the $\arrRone$ to the right. But we transition into the auxiliary state $p'_R\in P'_R$ instead of $p_R\in P_R$. In the next step, with the $\arrRone$ now on top of the $p'_R$ state, we transition to the correct state $p_R$, and step the $\arrRone$ to the right once more so that it is no longer on top of the head. This way of carrying out the right-moving transitions means that $p'_R$ only ever appears below a $\arrRone$, so we add a penalty term to make all other $p'_R$ configurations illegal:
\begin{equation}\label{eq:p-prime-illegal}
  \twocellsvert{\neg\arrRone}{p'_R}
\end{equation}

For TM transition rules $\delta(p,\sigma) = (\tau,p_N,N)$, $\delta(p,\sigma) = (\tau,p_L,L)$ and $\delta(p,\sigma) = (\tau,p_R,R)$ (where $p\in P\backslash_{\{p_\alpha\}}$, $p_{L,N,R}\in P_{L,N,R}$ and $\sigma,\tau\in\Xi$), the following local transition terms on Tracks~1 to~3 implement the desired transformations (cells marked $\wc$ can be in any state, and are left unchanged by the transition):
\begin{subequations}
\begin{gather}
  \sixcellsvert{\arrRone}{\blankR}{p}{\blankR}{\sigma}{\wc}
    \longrightarrow \sixcellsvert{\blankL}{\arrRone}{p_N}{\blankR}{\tau}{\wc}\,,
  \qquad
  \fourcellsR{\arrRone}{p}{\sigma} \longrightarrow
    \fourcellsR{\arrLone}{p_N}{\tau}\,,
  \label{eq:counter_TM_transitions1}
  \\[1em]
  \sixcellsvert{\arrRone}{\blankR}{\blankL}{p}{\wc}{\sigma} \longrightarrow
    \sixcellsvert{\blankL}{\arrRone}{p_L}{\blankR}{\wc}{\tau}\,,
  \qquad
  \sixcellsvert{\arrRone}{\blankR}{p}{\blankR}{\sigma}{\wc} \longrightarrow
    \sixcellsvert{\blankL}{\arrRone}{\blankL}{p'_R}{\tau}{\wc}\,,
  \label{eq:counter_TM_transitions2}
  \\[1em]
  \sixcellsvert{\arrRone}{\blankR}{p'_R}{\blankR}{\wc}{\wc} \longrightarrow
    \sixcellsvert{\blankL}{\arrRone}{p_R}{\blankR}{\wc}{\wc}\,,
  \qquad
  \fourcellsR{\arrRone}{p'_R}{\wc} \longrightarrow
    \fourcellsR{\arrLone}{p_R}{\wc}\,.
  \label{eq:counter_TM_right-moving}
\end{gather}
\end{subequations}
Transitions in which the head moves left from the end of the chain are already covered by the left-moving transition in \cref{eq:counter_TM_transitions2}. Transitions in which the head would move right off the end of the chain are not implemented. (Transitions in which the head would move left off the beginning of the chain are not implemented either, but in fact the counter TM construction of \cref{sec:counter_TM} will never attempt such a transition when initialised properly. Moreover, we just declared such configurations illegal in \cref{eq:left-move-illegal}.)

When started from the blank input (which represents the number~0), the encoded counter TM will loop $\zeta^{L-3}$ times before it exceeds the $L-2$ tape space available on Track~2 (the space overhead of~1 is due to the way the incrementer TM in implemented in \cref{eq:base-zeta_incrementer}). The incrementer machine takes $\Theta(\log x)$ steps to increment the number $x$ (written on the tape in base-$\zeta$). Thus the counter TM will run for at least $\Omega(\zeta^L)$ (and at most $O(\log L \zeta^L)$) time-steps before it exceeds the available tape space.

The transition function for the counter TM defines a transition rule for each pair $(p,\tau)\in P\times \Xi$. So for any legal configuration containing a $p\in P$ on Track~2, exactly one of the transition rules in \cref{eq:counter_TM_transitions1,eq:counter_TM_transitions2} will apply during each $\arrRone$ sweep. Similarly, for any configuration containing a $p'_R\in P'_R$, a \cref{eq:counter_TM_right-moving} rule will apply. It is easy to verify that if any of the transition rules from \cref{eq:counter_TM_transitions1,eq:counter_TM_transitions2,eq:counter_TM_right-moving} is applied to any legal configuration, none of the \cref{eq:counter_TM_transitions1,eq:counter_TM_transitions2} rules can apply again to the resulting configuration. If the final \cref{eq:counter_TM_transitions2} rule applies, the \cref{eq:counter_TM_right-moving} rule will apply exactly once in the following step, after which none of the rules can apply again to the resulting configuration. The transition rules in \cref{eq:counter_TM_transitions1,eq:counter_TM_transitions2,eq:counter_TM_right-moving} therefore implement a single step of the TM during each left-to-right sweep of the $\arrRone$ state on Track~1, as required. We call this phase of the evolution, in which Track~1 contains a $\arrRone$ or $\arrLone$, the \keyword{computation phase}.

We also modify the clock oscillator rules from \cref{sec:clock-oscillator} involving a right-moving $\arrRone$ arrow to only apply when there is no TM head under the $\arrRone$, since the $\arrRone$ movement is already taken care of by the above transition rules when there is a TM head present:
\begin{equation}
  \fourcells{\arrRone}{\blankR}{\blankL}{\blankL}
    \longrightarrow \fourcells{\blankL}{\arrRone}{\blankL}{\blankL}\,,
  \qquad
  \fourcells{\arrRone}{\blankR}{\blankR}{\blankR}
    \longrightarrow \fourcells{\blankL}{\arrRone}{\blankR}{\blankR}\,,
  \qquad
  \threecellsR{\arrRone}{\blankR} \longrightarrow
      \threecellsR{\arrLone}{\blankR}\,.
\end{equation}


%--- penalties ---
We must also enforce illegality of all the configurations declared to be illegal in \cref{sec:counter_TM_construction}. To do this, we simply introduce local penalty terms corresponding to the combinations declared illegal in \cref{eq:illegal_p0,eq:illegal_pf,eq:illegal_p0+non-blank,eq:illegal_forward_transitions,eq:illegal_backwards_transitions,eq:illegal_head+blank,eq:illegal_0+blank,eq:illegal_0+rightend}, and enforce the Track~3 regular expression of \cref{eq:track3_regexp} using penalty terms and \cref{regexp}.


%--- summary ---
The complete set of Track~1 to~3 transition rules is summarised in \cref{tbl:track123_rules}. The regular expressions on Tracks~1 to~3 enforced by penalty terms, together with all the additional illegal pairs defined so far, are summarised in \cref{tbl:track123_illegal_pairs}.

{
  \centering
  \setlength{\extrarowheight}{4pt}
  \setlength{\tabcolsep}{12pt}
  \begin{longtable}{>{$}c<{$} >{$}c<{$} >{$}c<{$}}
    \caption{All transition rules for Tracks~1 to~3.}
    \label{tbl:track123_rules}\\
    \nobreakhline
    \multicolumn{3}{c}{\text{Track~1 rules}}\\*
    \arrRzero,\arrLzero \text{ rules} & \arrRone \text{ rules}
      & \arrLone \text{ rules} \\*
    \nobreakhline
    &&\\*
    \twocellshoriz{\arrRzero}{\blankR} \longrightarrow
      \twocellshoriz{\blankL}{\arrRzero}
    &&\phantom{\quad (*)}
      \twocellshoriz{\blankL}{\arrLone} \longrightarrow
      \twocellshoriz{\arrLone}{\blankR} \quad (*)\footnote{Transition rules marked with an $(*)$ will be replaced in \cref{sec:QTM_Hamiltonian} by a set of rules that also act on Tracks~4, 5 and 6.}
    \\*[1.5em]
    \twocellshoriz{\arrRzero}{\rightend\,} \longrightarrow
      \twocellshoriz{\arrLzeroz}{\rightend\,}
    \\*[1.5em]
    \twocellshoriz{\blankL}{\arrLzeroi} \longrightarrow
      \twocellshoriz{\arrLzeroipo}{\blankR}
    \\*[1.5em]
    \twocellshoriz{\blankL}{\arrLzeroK} \longrightarrow
      \twocellshoriz{\arrLzero}{\blankR}
    \\*[1.5em]
    &&\\
    &&\\
    \hline
    \multicolumn{3}{c}{\text{Track~1 and~2 rules}}\\*
    \arrRzero,\arrLzero \text{ rules} & \arrRone \text{ rules}
      & \arrLone \text{ rules} \\*
    \nobreakhline
    &&\\*
    \threecellsL{\arrLzero}{p_\alpha} \longrightarrow
      \threecellsL{\arrRone}{p_\alpha}
    &\fourcells{\arrRone}{\blankR}{\blankL}{\blankL}
      \longrightarrow \fourcells{\blankL}{\arrRone}{\blankL}{\blankL}
    &\phantom{\quad (*)}
      \threecellsL{\arrLone}{\neg p_\alpha} \longrightarrow
      \threecellsL{\arrRone}{\neg p_\alpha} \quad (*)
    \\*[2em]
    &\fourcells{\arrRone}{\blankR}{\blankR}{\blankR}
      \longrightarrow \fourcells{\blankL}{\arrRone}{\blankR}{\blankR}
    &\\*[2em]
    &\phantom{\quad (*)}
      \threecellsR{\arrRone}{\blankR} \longrightarrow
      \threecellsR{\arrLone}{\blankR}\quad (*)
    &\\
    &&\\
    \hline
    \multicolumn{3}{c}{\text{Track~1, 2 and~3 rules}}\\*
    \arrRzero,\arrLzero \text{ rules} & \arrRone \text{ rules}
      & \arrLone \text{ rules} \\*
    \nobreakhline
    &&\\*
    &\sixcellsvert{\arrRone}{\blankR}{\blankL}{p}{\wc}{\sigma} \longrightarrow
      \sixcellsvert{\blankL}{\arrRone}{p_L}{\blankR}{\wc}{\tau}
    &\\*[3em]
    &\sixcellsvert{\arrRone}{\blankR}{p}{\blankR}{\sigma}{\wc}
      \longrightarrow \sixcellsvert{\blankL}{\arrRone}{p_N}{\blankR}{\tau}{\wc}
    &\\*[3em]
    &\phantom{\quad (*)}
      \fourcellsR{\arrRone}{p}{\sigma} \longrightarrow
      \fourcellsR{\arrLone}{p_N}{\tau} \quad (*)
    &\\*[3em]
    &\sixcellsvert{\arrRone}{\blankR}{p}{\blankR}{\sigma}{\wc} \longrightarrow
      \sixcellsvert{\blankL}{\arrRone}{\blankL}{p'_R}{\tau}{\wc}
    &\\*[3em]
    &\sixcellsvert{\arrRone}{\blankR}{p'_R}{\blankR}{\wc}{\wc} \longrightarrow
      \sixcellsvert{\blankL}{\arrRone}{p_R}{\blankR}{\wc}{\wc}
    &\\*[3em]
    &\phantom{\quad (*)}
      \fourcellsR{\arrRone}{p'_R}{\wc} \longrightarrow
      \fourcellsR{\arrLone}{p_R}{\wc}\quad (*)\\*
    &&\\*
    \nobreakhline
  \end{longtable}
}


{
  \centering
  \setlength{\extrarowheight}{4pt}
  \setlength{\tabcolsep}{12pt}
  \begin{longtable}{>{$}c<{$} >{$}c<{$} >{$}c<{$} >{$}c<{$}}
    \caption{All illegal pairs and regular expressions enforced by illegal pairs for Tracks~1 to~3.}
    \label{tbl:track123_illegal_pairs}\\*
    \nobreakhline
    \multicolumn{4}{c}{\text{Regular expressions}} \\*
    \multicolumn{2}{c}{\text{Track~1}} & \text{Track~2} & \text{Track~3} \\*
    \nobreakhline
    \multicolumn{2}{c}{} &&\\*
    \multicolumn{2}{>{$}c<{$}}{
    \leftend\blankL{}^*[\arrRzero,\arrLzero,\arrLzeroi,\arrRone,\arrLone]
      \blankR{}^*\rightend}
    & \leftend\blankL{}^*\,p\,\blankR{}^*\rightend
    & \leftend\,\vdash\,i^*\,\#^*\rightend
    \\*
    &&&\\
    \hline
    \multicolumn{4}{c}{Illegal pairs} \\*
    \multicolumn{4}{c}{Tracks~1 and~2} \\*
    \nobreakhline
    \\*
    \multicolumn{4}{>{$}c<{$}}{
      \threecellsnotL{\arrRzero}{\neg\blankR}\,, \qquad
      \threecellsL{\arrRzero}{\neg p_\alpha}\,, \qquad
      \threecellsL{\arrLone}{p_\alpha}\,, \qquad
      \twocellsvert{\neg\arrRone}{p'_R}
    }
    \\
    &&&\\
    \hline
    \multicolumn{4}{c}{Illegal pairs} \\*
    \text{Tracks~1 and~3} & \text{Track~2} & \text{Tracks~2 and~3}
      & \text{Track~3} \\*
    \nobreakhline
    &&&\\*
    \threecellsnotL{\arrRzero}{\neg\#\;}
    & \twocellshoriz{\neg\leftend\,}{\,p_\alpha\;}
    & \fourcells{\,p_\alpha\;}{\wc}{\wc}{\neg\#}
    & \twocellshoriz{\;0\;\;}{\;\#\;\;}
    \\*[1.5em]
    &&\fourcells{\blankL}{\;p\;\;}{\;\#\;\;}{\;\#\;\;} &  \twocellshoriz{\;0\;\;}{\rightend}\\
    \\
    &&&\\
    \hline
    \multicolumn{4}{c}{Illegal pairs} \\*
    \multicolumn{4}{c}{Tracks~2 and~3 for undefined transitions in
      \cref{eq:base-zeta_counter}}\\*
    \nobreakhline
    \\*
    \multicolumn{4}{>{$}c<{$}}{
      \twocellsvert{\;p\;\;}{\tau}\,, \qquad
      \fourcells{\blankL}{\,p_R\;}{\tau}{\wc}\,, \qquad
      \fourcells{\,p_L\;}{\blankR}{\wc}{\tau}\,, \qquad
      \fourcells{\,p_N\;}{\blankR}{\tau}{\wc}
    }\\*
    \\*
    \hline
    \multicolumn{4}{c}{Illegal pairs} \\*
    \multicolumn{4}{c}{Tracks~1, 2 and~3  if $\delta(p,\sigma)=(p_L,\tau,L)$ \cref{eq:left-move-illegal}}\\*
    \nobreakhline
    \\*
    \multicolumn{4}{>{$}c<{$}}{
      \threecellsvert{\arrRone}{\;p\;\;}{\;\sigma\;\;}
    }\\*
    \\*
    \hline
  \end{longtable}
}



\subsection{Clock Hamiltonian}\label{sec:clock_Hamiltonian}
Before considering the remaining tracks, it is helpful to analyse in depth the Hamiltonian defined so far on the first three tracks. For that we start with the definition of well-formed states.

% Restricting to Tracks~1 through~3, the single-site Hilbert space becomes $\C^C \simeq \linspan\{\ket{s,p,\sigma}\} \oplus \linspan\left\{\ket{\leftend},\ket{\rightend}\right\}$ (cf.\ \cref{eq:local_Hilbert_space}). Standard basis states for the whole chain under this restriction are specified by configurations of these three tracks alone. Let the two-body interaction $h^{\text{clock}}\in\cB(\C^C\ox\C^C)$ be the sum over all penalty and transition rule terms defined so far, acting on Tracks~1 to~3. Consider the translationally-invariant nearest-neighbour Hamiltonian $H_{\text{clock}}(L) = \sum_{i=1}^{L-1} h_{i,i+1}^\text{clock}$ defined by this local interaction. Note that this Hamiltonian is positive-semidefinite. We want to understand the ground state subspace of $H_\text{clock}(L)|_\Sbr$, the Track~1 to~3 Hamiltonian restricted to the subspace $\Sbr$ of all bracketed states.

\begin{definition}[Well-formed state]
  \label{def:well-formed}
  We say that a standard basis state on Tracks~1 to~3 is \keyword{well-formed} if it is a bracketed state, its Track~1 configuration matches the regular expression $\leftend\blankL{}^*[\arrLzero\arrLzeroi\arrRzero\arrLone\arrRone]\blankR{}^*\rightend$, and its Track~2 configuration matches the regular expression $\leftend\blankL{}^*p\,\blankR{}^*\rightend$ where $p\in P'$.
\end{definition}

The penalty terms defined previously give an energy penalty of at least~1 to any standard basis state in $\Sbr$ that does not match the desired regular expressions on Tracks~1\nobreakdash--3. Thus only well-formed states can have zero energy. The following result shows that only one transition rule can apply to each well-formed state.

\begin{lemma}[Well-formed transitions]\label{well-formed}
  For any well-formed standard basis state, at most one transition rule applies in the forward direction, and at most one in the backwards direction. Furthermore, the set of well-formed states is closed under the transition rules.
\end{lemma}
%
\begin{proof}
  A well-formed standard basis state contains exactly one of $\arrRzero,$ $\arrLzero$, $\arrLzeroi$, $\arrRone$ or $\arrLone$ on Track~1. Thus clearly only transition rules from one of the sets in \cref{tbl:track123_rules} (the set of $\arrRzero,\arrLzero$ rules, $\arrRone$ rules, or $\arrLone$ rules) can apply in the forward direction. The left hand sides of the rules within the $\arrRzero,\arrLzero$ and $\arrLone$ sets are manifestly mutually exclusive. Since the counter TM is deterministic, there is a unique TM transition that applies at any step, so the left-hand-sides of the $\arrRone$ rules are also mutually exclusive.

  The counter TM is reversible, so there is also a unique backwards TM transition at every step. Thus the same argument applies in the backwards direction to the right hand sides of the rules in each set, with the exception of the $\arrLzero$ turning rule that changes a $\arrRone$ into a $\arrLzero$ (in the backwards direction). But this rule clearly cannot apply at the same time as the right hand side of any rule from the $\arrRone$ set, which concludes the proof of the first part of the lemma.

  It is straightforward to verify that all the transition rules in \cref{tbl:track123_rules} preserve well-formedness, implying the second part.
\end{proof}

Recall that the state $\ket{\phi_0}$ is the standard basis state with $\leftend\arrRzero\blankR{}^*\rightend$ on Track~1, $\leftend\,p_\alpha\,\blankR{}^*\rightend$ on Track~2, and $\leftend\,\vdash\,\#^*\,\rightend$ on Track~3. This corresponds to having the clock oscillator in the first state of the Track~1 sequence (see \cref{fig:clock-oscillator}), and the counter TM Tracks~1 and~2 in their initial configurations. There is no backwards transition out of $\ket{\phi_0}$, so we will refer to it as the \keyword{initial clock state}. Let $\ket{\phi_t}$ be the standard basis state obtained by applying $t$ transitions (in the forwards direction) to $\ket{\phi_0}$, which is well-defined thanks to \cref{well-formed}.
% Define $\ket{\phi_{\text{clock}}}:= \tfrac{1}{\sqrt{T}}\sum_{t=0}^T\ket{\phi_t}$ to be the uniform superposition over all standard basis states in this sequence.

Let us consider the form of the states $\ket{\phi_t}$. Note that $\ket{\phi_0}$ contains a $\arrRzero$ on Track~1. The only transition rules that apply when Track~1 contains a $\arrRzero$, $\arrLzero$ or $\arrLzeroi$ (see \cref{tbl:track123_rules}) are those that sweep the arrow all the way to the right and back again, without affecting Tracks~2 or~3. We saw in \cref{sec:clock-oscillator} that one complete oscillator cycle takes $2(L-2)$ steps. Thus $t\leq 2(L-2)$ corresponds to the initialisation sweep, in which the state $\ket{\phi_t}$ contains a $\arrRzero$, $\arrLzero$ or $\arrLzeroi$ on Track~1, and Tracks~2 and~3 remain in their initial configurations.

At $t = 2(L-2)+1$, the $\arrLzero$ turns around and (because Track~2 contains a $p_\alpha$ at the beginning of the chain) becomes a $\arrRone$. This $\arrRone$ is now over a $p_\alpha$ on Track~2. Thus the next step implements the first step of the counter TM on Tracks~2 and~3, causing Track~2 to transition to $p_\alpha$.

Recall from \cref{sec:counter_TM} that the transition rules implement one step of the counter TM during each left-to-right sweep of the $\arrRone$ on Track~1, and then move the $\arrLone$ back to the beginning of the chain in the second half of the oscillator cycle. Note that the counter TM construction of \cref{sec:counter_TM} never transitions back to its initial state $p_\alpha$. So when the $\arrLone$ reaches the beginning of the chain, it will never find a $p_\alpha$ on Track~3. Thus it will always transition into $\arrRone$, never into $\arrRzero$ (see \cref{tbl:track123_rules}). Therefore, for all $t > 2(L-2)$ the state $\ket{\phi_t}$ contains a $\arrRone$ or $\arrLone$ on Track~1. At $t = 2(L-2)(n+1)$ the $\arrRone$ in $\ket{\phi_t}$ is back at the beginning of the chain, and Tracks~2 and~3 are in the configuration corresponding to the $n$'th step of the counter TM.

Eventually, the number written on Track~3 will be incremented until it reaches $\zeta^{L-4}$, the maximum number that can be written in base-$\zeta$ in $L-4$ digits (the $-4$ accounts for the space-overhead of~2 required by the $\TM{Inc}$ TM implementation, plus the two bracket states at the ends of the chain). When the counter TM tries to increment this number, the head will move right until it reaches the cell adjacent to the $\rightend$ at the end of the chain. At this point, it will be in an internal state that would normally step right in order to write the carry. But the site to the right of the head contains $\rightend$ instead of a blank Tape~2 cell. When the $\arrRone$ on Track~1 reaches the head at the end of on Track~2, there is no further forwards transition out of this configuration (see \cref{tbl:track123_rules}). Let $T$ be the number of transitions required to reach this configuration $\ket{\phi_T}$ starting from the initial state $\ket{\phi_0}$. We will refer to $\ket{\phi_T}$ as the \keyword{final clock state}. Since this configuration occurs when the counter TM is about to exceed $L$ tape space, which occurs after at most $O(\log L \zeta^L)$ steps of the TM (see \cref{sec:counter_TM}) each of which requires $2(L-2)$ transitions, we have that $T = O(L\log L \zeta^L)$. (Though this bound on the run-time will not be important for our purposes.)

The following result will be important later when we come to analyse the Hamiltonian.

\begin{lemma}[Evolve-to-illegal]\label{evolve_to_illegal}
  Evolving any $\ket{\phi_t}$ forwards or backwards in time according to the transition rules will never reach an illegal configuration. All other well-formed standard basis states will evolve either forwards or backwards to an illegal configuration after $O(L^2)$ transitions.
\end{lemma}

\begin{proof}
  As in \cref{counter_TM_evolve_to_illegal} the first part of the \namecref{evolve_to_illegal} is true by construction. For the second part, let us analyse all possible well-formed standard basis states, which we divide into two cases depending on the type of arrow state we have on Track~1:

  \paragraph{Case 1:} Track~1 contains $\arrRzero$, $\arrLzero$ or $\arrLzeroi$. If Tracks~2 and~3 are in the initial configuration, then we are in one of the $\ket{\phi_t}$ states with $0 \le t \le 2(L-2)$.

  If Tracks~2 and~3 are not in the initial configuration, then within at most $O(L)$ steps the $\arrRzero$ or $\arrLzero,\arrLzeroi$ will move forwards or backwards along the chain due to the initialisation sweep clock oscillator transition rules, until it is over a site containing the wrong initial Track~2 or Track~3 state. But this is illegal due to the Track~1\nobreakdash--3 illegal pairs from \cref{tbl:track123_illegal_pairs}.

  \paragraph{Case 2:} Track~1 contains $\arrRone$ or $\arrLone$. Recall that there is a one-to-one correspondence between configurations of the counter TM and well-formed standard basis states that do not contain a $p'_R\in P'_R$ on Track~2.

  Well-formed configurations containing a $p'_R\in P'_R$ on Track~2 evolve by a single backwards transition from \cref{eq:counter_TM_transitions2} to a configuration containing a $p\notin P'_R$ on Track~2, and evolve by a single forwards transition from \cref{eq:counter_TM_right-moving} to a configuration containing a $p_R\in P_R$. A configuration containing $p'_R\in P'_R$ is therefore reachable (resp.\ unreachable) by transition rules from the initial configuration iff the corresponding counter TM configuration with $p'_R$ replaced by the corresponding $p_R$ is reachable (resp.\ unreachable).

  For any well-formed configuration, each sweep of $\arrRone$, the transition rules implements exactly one step of the counter TM encoded in Tracks~2 and~3. The only counter TM transitions that are not implemented are those that would move the head beyond the $L$ sites between the $\leftend$ and $\rightend$. Therefore, if the configuration of Tracks~2 and~3 is not reachable from the initial configuration, then \cref{counter_TM_evolve_to_illegal} guarantees that evolving it forwards or backwards by the transition rules will reach an illegal configuration in $O(L)$ steps of the counter TM, which takes $O(L^2)$ transitions. (Note that it is crucial for this argument that to reach an illegal configuration in \cref{counter_TM_evolve_to_illegal} never requires moving the head outside the portion of tape $[0,L]$.)

  It only remains to consider well-formed states with Track~2 and~3 configurations that are reachable from the initial configuration. For the initial Tracks~2\nobreakdash--3 configuration itself, if $\arrRone$ is in the starting cell then we have the state $\ket{\phi_t}$ for $t=2(L-2)+1$. If not, either we have $\arrRone$ to the right of the head or $\arrLone$ on Track~1, with $p_\alpha$ at the start of Track~2. In both cases, evolving such a state forwards in time will reach a state with a $\arrLone$ over the $p_\alpha$ within $O(L)$ transitions, which is illegal by the second Track~1 and~2 illegal pair from \cref{tbl:track123_illegal_pairs}.

  If the Track~2\nobreakdash--3 configuration is not the initial one, then all positions of $\arrRone$ and $\arrLone$ give rise to elements in the set $\{\ket{\phi_t}\}_t$ except exactly those declared illegal in \cref{eq:left-move-illegal} and \cref{eq:p-prime-illegal}.

  This completes the proof of the \namecref{counter_TM_evolve_to_illegal}.
\end{proof}



\subsection{QTM Hamiltonian}\label{sec:QTM_Hamiltonian}
With the clock in place, encoding an arbitrary quantum Turing Machine in the Hamiltonian is now possible using ideas from \cite{Gottesman-Irani} (and is similar to the construction used in \cref{sec:counter_TM} to encode the reversible counter TM). The configurations are now quantum states, so there can be arbitrary superpositions over standard basis states. But it suffices to verify that the construction does the right thing on standard basis states; this then extends to arbitrary superpositions by linearity and well-formedness.

When we later come to analyse the spectrum, we will require our Hamiltonian to be \keyword{standard-form} in the following sense:
\begin{definition}[Standard-form Hamiltonian]
  \label{def:standard-form_H}
  We say that a Hamiltonian $H = \Htrans + \Hpenalty$ acting on a Hilbert space $\HS = (\C^C\ox\C^Q)^{\ox L} = (\C^C)^{\ox L}\ox(\C^Q)^{\ox L} =: \HS_C\ox\HS_Q$ is of \keyword{standard form} if $\Htranspen = \sum_{i=1}^{L-1} \htranspen^{(i,i+1)}$, and $\htranspen$ satisfy the following conditions:
  \begin{enumerate}
  \item $\htrans \in \cB\left((\C^C\ox\C^Q)^{\ox 2}\right)$ is a sum of transition rule terms, where all the transition rules act diagonally on $\C^C\ox\C^C$ in the following sense. Given standard basis states $a,b,c,d\in\C^C$, exactly one of the following holds:
    \begin{itemize}
    \item there is no transition from $ab$ to $cd$ at all; or
    \item $a,b,c,d\in\C^C$ and there exists a unitary $U_{abcd}$ acting on $\C^Q\ox\C^Q$ together with an orthonormal basis $\{\ket{\psi_{abcd}^i}\}_i$ for $\C^Q\ox\C^Q$, both depending only on $a,b,c,d$, such that the transition rules from $ab$ to $cd$ appearing in $\htrans$ are exactly $\ket{ab}\ket{\psi^i_{abcd}}\rightarrow \ket{cd}U_{abcd}\ket{\psi^i_{abcd}}$ for all $i$.
    \end{itemize}
    \label[part]{standard-form_H:transition_terms}
  \item $\hpenalty \in \cB\left((\C^C\ox\C^Q)^{\ox 2}\right)$ is a sum of penalty terms which act non-trivially only on $(\C^C)^{\ox 2}$ and are diagonal in the standard basis.
    % (I.e.\ each penalty term is of the form $\proj{ab}_C\ox\id_Q$ for some standard basis states $a,b$).
    % Let $\hinit \in \cB((\C^C\ox\C^Q)^{\ox 2})$ be a sum of penalty terms which are diagonal in the standard basis, but may act non-trivially on the entire Hilbert space.
    \label[part]{standard-form_H:penalty_terms}
  \end{enumerate}
\end{definition}

In our case, $\C^C$ corresponds to Tracks 1--3 and $\C^Q$ to Tracks 4--6. Transitions from $ab$ to $cd$ will correspond exactly to the transitions shown for Tracks 1--3 in \cref{tbl:track123_rules}. While adding new transitions involving Tracks 4--6, we will need to remove some of the transitions in Tracks 1--3, but they will be recovered as restrictions of the new rules to those tracks. (In \cref{tbl:track123_rules}, transitions that will be replaced later are marked with an asterisk.) We will define the unitaries $U_{abcd}$ partially, and then complete them to a full unitary. All we have to take care of is that (i)~the new transition involving the rest of the tracks, when restricted to Tracks 1--3, recover exactly the transitions removed from \cref{tbl:track123_rules}; and that (ii)~orthogonality is preserved in the construction.

By the standard form,
\begin{equation}
  \htrans = \sum_{ab\rightarrow cd} (\ket{ab}-\ket{cd})(\bra{ab}-\bra{cd})
            \ox (2\1-U_{abcd}-U_{abcd}^\dagger)\;.
\end{equation}
Now, if we start with a family of QTM $P_n$ which satisfies \cref{phase-estimation_QTM:amplitudes} of \cref{phase-estimation_QTM}, it will be immediate from our construction that the partial definition of all $U_{abcd}$ will only involve elements in the set
\begin{equation}
  \mathcal{S} = \left\{0,1,\pm \frac{1}{\sqrt{2}},e^{i\pi\varphi}, e^{i\pi 2^{-\abs{\varphi}}}\right\}.
\end{equation}
As argued above, the same will hold for the full $U_{abcd}$, which gives \cref{QTM_in_local_Hamiltonian:explicit-form} in \cref{QTM_in_local_Hamiltonian}.


%--- regexps ---
%Once again, we use penalty terms to enforce the regular expression $\leftend\blankL{}^*q\blankR{}^*\rightend$ on Track~4 (where $q\in Q'$), so that all legal standard basis states contain exactly one QTM head on Track~4. We extend the definition of a well-formed state to all five tracks:
%
%\begin{definition}[Well-formed state, Tracks~1\nobreakdash--5]\label{def:well-formed_1-5}
 % We say that a standard basis state on Tracks~1 to~5 is \keyword{well-formed} if its Track~1 configuration matches the regular expression $\leftend\blankL{}^*[\arrLzero\arrRzero\arrLone\arrRone]\blankR{}^*\rightend$, its Track~2 configuration matches the regular expression $\leftend\blankL{}^*p\,\blankR{}^*\rightend$ where $p\in P'$, its Track~3 configuration matches the regular expression $\leftend\,\vdash\,i^*\,\#^*\rightend$ where $i\in[\zeta]$, the Track~2 head state $p$ is at most one site away from a non-blank Track~3 state $i\in\N$, and its Track~4 state matches the regular expression $\leftend\blankL{}^*q\blankR{}^*\rightend$ where $q\in Q'$.
%\end{definition}

%\begin{lemma}\label{well-formed_1-5}
  %The set of well-formed Track~1\nobreakdash--5 standard basis states is closed under transition rules.
%\end{lemma}

%\begin{proof}
  %The restrictions of the transition rules to Tracks~1\nobreakdash--3 are identical to the set of transition rules analysed in \cref{well-formed}, so well-formed Track~1\nobreakdash--3 basis states remain well-formed under application of the transition rules by \cref{well-formed}. The transition rules that act on Track~4 never create or destroy a QTM head, so well-formed Track~4\nobreakdash--5 basis states also remain well-formed.
%\end{proof}


\subsubsection{QTM transition rules}\label{sec:QTM_transition_rules}
We first analyse how to incorporate the QTM transition rules into the Hamiltonian. We will simulate the QTM transition rules $\delta(p,\sigma) = \sum_{\tau,q,D}\delta(p,\sigma,\tau,q,D)\ket{\tau, q, D}$ during the second half of the clock oscillator cycle, when the Track~1 $\arrLone$ state sweeps from right to left. This is done by including the following transition rule terms (cf.\ \cref{eq:counter_TM_transitions1,eq:counter_TM_transitions2,eq:counter_TM_right-moving}), where $q$ is any state in $Q/\{q_f\}$ (i.e.\ we exclude all the transitions out of the QTM's final state):
\begin{subequations}\label{eq:QTM_transition_rules}
\begin{gather}
  \begin{split}
    \Ket{\,\sixcellsvert{\blankL}{\arrLone}{q}{\blankR}{\sigma}{\wc}\,}
      \longrightarrow
    &\sum_{\tau,q_R}\delta(q,\sigma,\tau,q_R,R)
      \Ket{\,\sixcellsvert{\arrLone}{\blankR}{\blankL}{q_R}{\tau}{\wc}\,}
    + \sum_{\tau,q_N}\delta(q,\sigma,\tau,q_N,N)
      \Ket{\,\sixcellsvert{\arrLone}{\blankR}{q_N}{\blankR}{\tau}{\wc}\,}\\
    &\qquad + \sum_{\tau,q_L}\delta(q,\sigma,\tau,q_L,L)
      \Ket{\,\sixcellsvert{\arrLone}{\blankR}{q'_L}{\blankR}{\tau}{\wc}\,}\,,
  \end{split} \label{eq:QTM_transition_step}
  \\[2em]
  \Ket{\,\sixcellsvert{\blankL}{\arrLone}{\blankL}{q'_L}{\wc}{\wc}\,}
    \longrightarrow \Ket{\,\sixcellsvert{\arrLone}{\blankR}{q_L}{\blankR}{\wc}{\wc}\,}\,.
    \label{eq:QTM_left-moving}
  \end{gather}
\end{subequations}
As in the implementation of the reversible counter TM (\cref{sec:counter_TM}), these transition rules implement the \textbf{R}eft-moving, \textbf{N}on-moving and \textbf{L}ight-moving transitions separately. This time, since the $\arrLone$ arrow is sweeping to the left, it is the \emph{left}-moving transitions that are implemented in two stages, first transitioning to an auxiliary state $q_L'\in Q_L'$, then in a second step transitioning to the corresponding $q_L$ state.

Note that if the QTM head ever ends up at the end of the chain, the transition rules of \cref{eq:QTM_transition_rules} can never apply, because they require the $\arrLone$ to be to the right of the QTM head. Thus the final Track~5 tape cell is not used, and the effective tape length available to the QTM for a chain of length $L+3$ is only $L$ rather than\footnote{Two cells are always used by the $\leftend,\rightend$ markers.} $L+1$. If the Track~4 QTM head ends up next to the $\rightend$ at the very end of the chain, this indicates that the head has stepped off the usable portion of the tape, regardless of the internal state.

We also include the following transition rules involving a left-moving $\arrLone$ arrow to cover the case where there is no QTM head present:
\begin{equation}\label{eq:QTM_leftarrow_sweep}
  \fourcells{\blankL}{\arrLone}{\blankL}{\blankL}
    \longrightarrow \fourcells{\arrLone}{\blankR}{\blankL}{\blankL}\,,
  \qquad
  \fourcells{\blankL}{\arrLone}{\blankR}{\blankR}
    \longrightarrow \fourcells{\arrLone}{\blankR}{\blankR}{\blankR}\,,
  \qquad
  \fourcells{\blankL}{\arrLone}{\blankL}{q}
    \longrightarrow \fourcells{\arrLone}{\blankR}{\blankL}{q}\,,
\end{equation}



\subsubsection{QTM Unitarity}\label{sec:unitarity}
With the set of transition rule terms defined so far in \cref{eq:QTM_transition_rules}, there is no transition out of the final state $q_f$ of the QTM. There is also no transition out of a QTM configuration in which the QTM head is at the end of the chain, and the next step would move the head to the right, off the end of the chain. The same is true of configurations trying to move the head left when it is located at the beginning of the chain.\footnote{Although the QTMs we will encode will in fact never do this.}

Ideally, we would like it if, when the QTM reaches one of these configurations, the clock continued ticking but the encoded QTM did nothing for the remaining time steps. However, simply omitting transitions out of these configurations causes a subtle but important issue relating to unitarity of the quantum transition rules, which will be crucial to the analysis of the resulting Hamiltonian in \cref{sec:local-Hamiltonian_analysis}.

If we complete the partial $U$ (associated with the Track 1--3 transitions $\twocellshoriz{\blankL}{\arrLone} \longrightarrow \twocellshoriz{\arrLone}{\blankR}$) as defined so far by \cref{eq:QTM_transition_rules,eq:QTM_qf_transition_rule,eq:QTM_leftarrow_sweep} to a unitary, this will add additional transitions out of the final state $q_f$, and also out of configurations with the head at the beginning or end of the chain. But this means that, instead of the encoded QTM doing nothing for the remaining time steps after reaching such a configuration, it will continue to evolve in some arbitrary way, depending on the particular choice of completion of $U$. On the other hand, if we omit transitions out of these configurations, the resulting $U$ will only be a partial isometry, not a full unitary.

We need to use up any remaining time steps in a controlled way, such that the Track~5 QTM tape is left unaltered after the QTM enters $q_f$ or runs out of tape. To this end, we deliberately add additional transitions out of the final state $q_f$, and also out of configurations with the head at the beginning or end of the chain, which cause the QTM to switch over to running some other, inconsequential computation to use up the remaining time. This time-wasting computation will use Track~6 as its tape, leaving the configuration of the Track~~5 QTM tape untouched.

The only requirement on this time-wasting computation is that it must be guaranteed not to halt or run out of tape before it has used up all the remaining time steps of the clock (otherwise we face the same unitarity issue once again). The natural choice is simply to run the same base-$\zeta$ counter computation as the clock (but running on Tracks~4 and~6). The counter TM never halts; it increments the number written on its tape forever, or -- when encoded on a finite chain -- until it runs out of tape space. Furthermore, since the clock will already have ``ticked'' for some positive number of time steps before this time-wasting counter TM starts running, the clock counter TM is guaranteed to run out of tape (and hence the clock stop ticking) first.

Transitioning from $q_f$ to the time-wasting counter TM can be accomplished simply by dovetailing the counter TM after the QTM, and encoding this dovetailed machine instead of the original QTM. Concretely, this means we must add to the Hamiltonian more transition rule terms of the form~\cref{eq:QTM_transition_rules} that encode all the transition rules of the counter TM from \cref{eq:base-zeta_counter}.\footnote{Since these are the transition rules of a classical reversible TM, they have a particularly simple form, the right hand side of each \cref{eq:QTM_transition_step} rule containing a single term.} Note that Track~6 contains additional subscripted variants $\vdash_q$ of the $\vdash$ tape symbol; the time-wasting counter TM transition rules simply ignore the subscript, and treat all of these as a $\vdash$. (I.e.\ the counter TM rules that read a $\vdash$ symbol in \cref{eq:base-zeta_counter} are duplicated for each $\vdash_q$ variant.) These time-wasting counter TM transition rules involve a disjoint set of Track~4 internal states $q\in P'$ to those $q\in Q'$ used by the QTM. Thus the left- and right-hand sides of all time-wasting counter TM \cref{eq:QTM_transition_rules} transition rules are orthogonal to those encoding the QTM transition rules.

We also add the following transition out of the final state $q_f$ of the original QTM into the initial state $p_\alpha$ of the counter TM, which dovetails the counter TM after the QTM. This transition rule acts on Tracks~1, 4 and~6:
\begin{equation}\label{eq:QTM_qf_transition_rule}
  \sixcellsvert{\blankL}{\arrLone}{q_f}{\blankR}{\vdash}{\wc}
  \longrightarrow
    \sixcellsvert{\arrLone}{\blankR}{p_\alpha}{\blankR}{\;\vdash_{q_f}}{\wc}\,.
\end{equation}

We must also add transitions that switch to running the time-wasting counter TM if the QTM runs out of tape, i.e.\ if it enters a configuration in which the head is at the beginning of the tape and would move left in the next time step, or one with the head at the end of the chain that would move right. (Though in the case of the proper machines considered in \cref{QTM_in_local_Hamiltonian:halt,QTM_in_local_Hamiltonian:out-of-tape,QTM_in_local_Hamiltonian:explicit-form} of \cref{QTM_in_local_Hamiltonian}, the former will never occur.) Moving left off the beginning of the tape is particularly easy, both because the head is already at the beginning of the chain, and because left-moving QTM transitions are implemented by first transitioning to an auxiliary $q'_L\in Q'_L$ state without moving the head. The following transition rule acting on Tracks~1, 2, 4 and~6 accomplishes this:
\begin{equation}\label{eq:QTM_leftend_transition_rule}
  \fivecellsL{\arrLone}{\neg p_\alpha}{q'_L}{\vdash} \longrightarrow
    \fivecellsL{\arrRone}{\neg p_\alpha}{p_\alpha}{\;\vdash_{q'_L}}\,.
\end{equation}
Note that, to preserve reversibility (unitarity), we must keep a record of which internal state $q'_L$ led to the QTM running out of tape. We record this in the $\vdash_q$ symbol written to the Track~6 time-wasting TM tape.

Configurations in which the head step right off the end of the chain involve slightly more effort, as the head is at the wrong end of the chain to start running the time-wasting counter TM. From \cref{sec:QTM_Hamiltonian}, a configuration in which the Track~4 QTM head is at the very end of the chain indicates that the head has stepped right off the usable portion of the Track~5 tape. We first transition from any such configuration into an auxiliary Track~4 head reset state $r$, which moves the head all the way back to the beginning of the chain, before transitioning into the initial state of the counter TM. This requires three additional sets of transition rules.

We want the first new rule to act on Tracks~1 and~4 at the very end of the chain, and transition into the auxiliary reset state $r$:
\begin{equation}\label{eq:QTM_rightend_transition_rule0}
  \threecellsR{\arrRone}{q} \longrightarrow
    \threecellsR{\arrLone}{r_q}\,.
\end{equation}
However, we have to make it compatible with the transitions already defined for Tracks 1--3. Hence, instead of \cref{eq:QTM_rightend_transition_rule0}, we include the following transitions acting on Tracks 1,2,4 and 1,2,3,4.

\begin{equation}\label{eq:QTM_rightend_transition_rule1}
  \fourcellsR{\arrRone}{\blankR}{q} \longrightarrow
    \fourcellsR{\arrLone}{\blankR}{r_q}\, , \quad \quad
    \fivecellsR{\arrRone}{p}{\sigma}{q} \longrightarrow
    \fivecellsR{\arrLone}{p_N}{\tau}{r_q}\, ,
    \quad \quad
    \fivecellsR{\arrRone}{p'_R}{\cdot}{q} \longrightarrow
    \fivecellsR{\arrLone}{p_R}{\cdot}{r_q}\,
\end{equation}


The second new rule also acts on Tracks~1 and~4, and steps the auxiliary $r$ state to the left along with the $\arrLone$:
\begin{equation}\label{eq:QTM_rightend_transition_rule2}
  \fourcells{\blankL}{\arrLone}{\blankL}{r_q} \longrightarrow
    \fourcells{\arrLone}{\blankR}{r_q}{\blankR}\,.
\end{equation}
The third acts on on Tracks~1, 2 4 and~6 at the very beginning of the chain, and transitions into the initial configuration of the time-wasting counter TM:
\begin{equation}\label{eq:QTM_rightend_transition_rule3}
  \fivecellsL{\arrLone}{\neg p_\alpha}{r_q}{\vdash} \longrightarrow
    \fivecellsL{\arrRone}{\neg p_\alpha}{p_\alpha}{\;\vdash_q}\,.
\end{equation}
Again, to preserve reversibility, we record in the $\vdash_q$ symbol which internal state caused the QTM to run out of tape.

{
 \centering
  \setlength{\extrarowheight}{4pt}
  \setlength{\tabcolsep}{4pt}
  \begin{longtable}{>{$}c<{$}}
    \caption{All transition rules for Tracks 4, 5 and 6.}
    \label{tbl:track456_rules}\\
    \nobreakhline
    \text{Track~1 and~4 rules}\\*
    \nobreakhline
    \\*
    \fourcells{\blankL}{\arrLone}{\blankL}{\blankL}
      \longrightarrow \fourcells{\arrLone}{\blankR}{\blankL}{\blankL}\,,
    \qquad
    \fourcells{\blankL}{\arrLone}{\blankR}{\blankR}
      \longrightarrow \fourcells{\arrLone}{\blankR}{\blankR}{\blankR}\\*
    \\*
    \fourcells{\blankL}{\arrLone}{\blankL}{r_q} \longrightarrow
      \fourcells{\arrLone}{\blankR}{r_q}{\blankR}\,,
    \qquad
    \fourcells{\blankL}{\arrLone}{\blankL}{p} \longrightarrow
      \fourcells{\arrLone}{\blankR}{\blankL}{p}\\*
    \\*
    \nobreakhline
    \text{Track~1, 4 and~5 rules}\\*
    \nobreakhline
    \\*
    \begin{array}{rcl}
    \Ket{\,\sixcellsvert{\blankL}{\arrLone}{p}{\blankR}{\sigma}{\wc}\,}
      &\longrightarrow&
      \displaystyle\sum_{\tau,q_R}\delta(p,\sigma,\tau,q_R,R)
        \Ket{\,\sixcellsvert{\arrLone}{\blankR}{\blankL}{q_R}{\tau}{\wc}\,}
        \\[2em]
        &&+ \displaystyle\sum_{\tau,q_N}\delta(p,\sigma,\tau,q_N,N)
          \Ket{\,\sixcellsvert{\arrLone}{\blankR}{q_N}{\blankR}{\tau}{\wc}\,}
        \\[2em]
        &&+ \displaystyle\sum_{\tau,q_L}\delta(p,\sigma,\tau,q_L,L)
          \Ket{\,\sixcellsvert{\arrLone}{\blankR}{q'_L}{\blankR}{\tau}{\wc}\,}\\
    &&\\
    \Ket{\,\sixcellsvert{\blankL}{\arrLone}{\blankL}{q'_L}{\wc}{\wc}\,}
    &\longrightarrow& \Ket{\,\sixcellsvert{\arrLone}{\blankR}{q_L}{\blankR}{\wc}{\wc}\,}
    \end{array}
    \\\\
    \hline
    \text{Track~1, 4 and~6 rules}\\*
    \nobreakhline
    \\*
    \sixcellsvert{\blankL}{\arrLone}{q_f}{\blankR}{\vdash}{\wc}
    \longrightarrow
      \sixcellsvert{\arrLone}{\blankR}{p_\alpha}{\blankR}{\;\vdash_{q_f}}{\wc}\,,
    \qquad
    \sixcellsvert{\blankL}{\arrLone}{p}{\blankR}{\sigma}{\wc} \longrightarrow
    \sixcellsvert{\arrLone}{\blankR}{\blankL}{p_R}{\tau}{\wc}\,,
    \qquad
    \sixcellsvert{\blankL}{\arrLone}{p}{\blankR}{\sigma}{\wc}
    \longrightarrow \sixcellsvert{\arrLone}{\blankR}{p_N}{\blankR}{\tau}{\wc}\\*
    \\*
    \sixcellsvert{\blankL}{\arrLone}{p}{\blankR}{\wc}{\sigma} \longrightarrow
    \sixcellsvert{\arrLone}{\blankR}{p'_L}{\blankR}{\wc}{\tau}\,,
    \qquad
    \sixcellsvert{\blankL}{\arrLone}{\blankL}{p'_L}{\wc}{\wc} \longrightarrow
    \sixcellsvert{\arrLone}{\blankR}{p_L}{\blankR}{\wc}{\wc}
    \\\\
    \nobreakhline
    \text{Track~1, 2 and 4 rules}\\*
    \nobreakhline
    \\*
    \fourcellsR{\arrRone}{\blankR}{q} \longrightarrow
    \fourcellsR{\arrLone}{\blankR}{r_q}\,
    \\\\
    \nobreakhline
    \text{Track~1, 2, 4 and 6 rules}\\*
    \nobreakhline
    \\*
    \fivecellsL{\arrLone}{\neg p_\alpha}{q'_L}{\vdash} \longrightarrow
    \fivecellsL{\arrRone}{\neg p_\alpha}{p_\alpha}{\;\vdash_{q'_L}}\,. \quad
    \fivecellsL{\arrLone}{\neg p_\alpha}{r_q}{\vdash} \longrightarrow
    \fivecellsL{\arrRone}{\neg p_\alpha}{p_\alpha}{\;\vdash_q}\,.
    \\\\
    \nobreakhline
    \text{Track~1, 2, 3 and 4 rules}\\*
    \nobreakhline
    \\*
    \fivecellsR{\arrRone}{p}{\sigma}{q} \longrightarrow
    \fivecellsR{\arrLone}{p_N}{\tau}{r_q}\, ,
    \quad \quad
    \fivecellsR{\arrRone}{p'_R}{\cdot}{q} \longrightarrow
    \fivecellsR{\arrLone}{p_R}{\cdot}{r_q}\, \\*
    % \\*
    % \fourcellsR{\arrRone}{p}{\sigma} \longrightarrow
    % \fourcellsR{\arrLone}{p_N}{\tau}\,,
    % \qquad
    % \fourcellsR{\arrRone}{p}{\wc} \longrightarrow
    % \fourcellsR{\arrLone}{p'_L}{\wc}\\*
    \\*
    \nobreakhline
  \end{longtable}
}


The transition rules in \cref{tbl:track456_rules} implement all the transitions that will take place for a properly initialised QTM. All of them have the desired form $\ket{ab}\ket{ij}\rightarrow \ket{cd}U_{abcd}\ket{ij}$ where $ab\rightarrow cd$ is a Track 1--3 transition and $U_{abcd}$ are partial isometries defined by their action on a subset $\ket{ij}$ of the computational basis of Tracks 4--6. We can now complete the unitaries $U_{abcd}$ at will. All we have to check is that they do indeed define a partial isometry.

The left hand sides of each transition rule in \cref{eq:QTM_transition_rules,eq:QTM_leftarrow_sweep,eq:QTM_qf_transition_rule,eq:QTM_leftend_transition_rule,eq:QTM_rightend_transition_rule1,eq:QTM_rightend_transition_rule2,eq:QTM_rightend_transition_rule3} are manifestly orthogonal. The right hand sides of all \cref{eq:QTM_left-moving,eq:QTM_leftarrow_sweep,eq:QTM_qf_transition_rule,eq:QTM_leftend_transition_rule,eq:QTM_rightend_transition_rule1,eq:QTM_rightend_transition_rule2,eq:QTM_rightend_transition_rule3} rules are clearly mutually orthogonal and normalised, and are also orthogonal to the right hand sides of all \cref{eq:QTM_transition_step} rules.

It remains to show that \cref{eq:QTM_transition_step} defines an isometry. Recall that there are two sets of \cref{eq:QTM_transition_step} terms, one encoding the QTM transition rules, and the other the time-wasting counter TM. Furthermore, the left- and right-hand sides of all rules in the QTM set are orthogonal to those of the counter TM set, as they involve disjoint sets  $\Q'$ and $P'$ (resp.) of internal states. Thus it suffices to prove that each set of transition rules considered separately defines an isometry. Since classical reversible TMs are special cases of QTMs, we prove the result for QTMs.

Let $\ket{\psi(p,\sigma)}$ denote the state on the RHS of \cref{eq:QTM_transition_step}. Then
\begin{equation}
  \begin{split}
    \norm{\psi(p,\sigma)}
    &= \sum_{\tau,q_R}\abs{\delta(p,\sigma,\tau,q_R,R)}^2
       + \sum_{\tau,q_N}\abs{\delta(p,\sigma,\tau,q_N,N)}^2\\
       &\qquad + \sum_{\tau,q_L}\abs{\delta(p,\sigma,\tau,q_L,L)}^2\\
    &= \norm{\delta(p,\sigma)}
    = 1
  \end{split}
\end{equation}
by the normalisation condition of \cref{QTM_transitions}, so the right hand sides of \cref{eq:QTM_transition_step} are normalised.

Similarly, for $(p_1,\tau_1) \neq (p_2,\tau_2)$,
\begin{equation}
  \begin{split}
    \braket{\psi(p_1,\sigma_1)|\psi(p_2,\sigma_2)}
    &= \sum_{\tau,q_R} \delta(p_1,\sigma_1,\tau,q_R,R)^*
                     \delta(p_2,\sigma_2,\tau,q_R,R)\\
      &\qquad + \sum_{\tau,q_N} \delta(p_1,\sigma_1,\tau,q_N,N)^*
                              \delta(p_2,\sigma_2,\tau,q_N,N)\\
      &\qquad\qquad + \sum_{\tau,q_L} \delta(p_1,\sigma_1,\tau,q_L,L)^*
                                    \delta(p_2,\sigma_2,\tau,q_L,L)\\
    &= \langle \delta(p_1,\tau_1), \delta(p_2,\tau_2) \rangle
    = 0
  \end{split}
\end{equation}
by the orthogonality condition of \cref{QTM_transitions}, so the right hand sides of \cref{eq:QTM_transition_step} are mutually orthogonal. Thus the QTM and time-wasting counter TM transition rules from \cref{eq:QTM_transition_step} preserve orthonormality, as required.



%--- penalty terms ---
%We add penalty terms to forbid any state $q'_L\in Q'_L$ from appearing on Track~4 \emph{unless} Track~1 contains a $\arrLone$, and any Track~4 state $q_R\in Q_R$ from appearing in the same location as $\arrLone$ (except at the end of the chain):
%\begin{equation}
%  \twocellsvert{\neg\arrLone}{q'_L}\,,
 % \qquad
 % \threecellsnotR{\arrLone}{q_R}\,.
%\end{equation}



\subsubsection{QTM initialisation sweep}
We use penalty terms that only apply during the initialisation sweep to enforce the correct initial configurations of Tracks~4, 5 and~6. For Track~4, we use the following penalty terms, which force a single $q_0$ at the very beginning of the track:
\begin{equation}\label{eq:init-track4}
  \threecellsnotL{\arrRzero}{\neg\blankR}\,,
  \qquad
  \threecellsL{\arrRzero}{\neg q_0}\,.
\end{equation}

The $\arrLzeroi$ Track~1 states only ever occur during the initialisation sweep in the final $K$ sites at the right end of the chain. We use these to force the initial configuration of Track~5 to contain $K$ blank symbols at the very end, as required by \cref{QTM_in_local_Hamiltonian}.\footnote{These additional blank symbols will be needed later to provide for the small space overhead of the QTM constructed in \cref{phase-estimation_QTM}.}
\begin{equation}\label{eq:init-track5}
  \twocellsvert{\arrLzero}{\neg 1}\,,
  \qquad
  \twocellsvert{\arrLzeroi}{\neg \#}\,.
\end{equation}

Track~6 is forced to be in the all-blank configuration, except for the very first cell which contains a $\vdash$:
\begin{equation}\label{eq:init-track6}
  \threecellsnotL{\arrRzero}{\neg\#}\,,
  \qquad
  \threecellsL{\arrRzero}{\neg\vdash}\,.
\end{equation}




\begin{comment}

The complete set of transition rules is summarised in \cref{tbl:complete_transition_rules}. The complete set of illegal pairs consists of those in \cref{tbl:track45_illegal_pairs} together with those already given in \cref{tbl:track123_illegal_pairs}.


{
 \centering
  \setlength{\extrarowheight}{4pt}
  \setlength{\tabcolsep}{4pt}
  \begin{longtable}{>{$}c<{$} >{$}c<{$} >{$}c<{$}}
    \caption{Complete set of transition rules.
    \label{tbl:complete_transition_rules}\\
    \nobreakhline
    \multicolumn{3}{c}{Track~1 rules}\\*
    \arrRzero,\arrLzero \text{ rules} & \arrRone \text{ rules}
      & \arrLone \text{ rules} \\*
    \nobreakhline
    &&\\*
    \twocellshoriz{\arrRzero}{\rightend\,} \longrightarrow
      \twocellshoriz{\arrLzero}{\rightend\,}
    &&\\*[2em]
    \twocellshoriz{\arrRzero}{\blankR} \longrightarrow
      \twocellshoriz{\blankL}{\arrRzero}
    &&\\
    &&\\
    \hline
    \multicolumn{3}{c}{\text{Track~1 and~2 rules}}\\*
    \arrRzero,\arrLzero \text{ rules} & \arrRone \text{ rules}
      & \arrLone \text{ rules} \\*
    \nobreakhline
    &&\\*
    \threecellsL{\arrLzero}{p_\alpha} \longrightarrow
      \threecellsL{\arrRone}{p_\alpha}
    &\fourcells{\arrRone}{\blankR}{\blankL}{\blankL}
      \longrightarrow \fourcells{\blankL}{\arrRone}{\blankL}{\blankL}
    &\threecellsL{\arrLone}{\neg p_\alpha} \longrightarrow
      \threecellsL{\arrRone}{\neg p_\alpha}
    \\*[2em]
    &\fourcells{\arrRone}{\blankR}{\blankR}{\blankR}
      \longrightarrow \fourcells{\blankL}{\arrRone}{\blankR}{\blankR}
    &\\*[2em]
    &\fourcells{\arrRone}{\blankR}{p'_R}{\blankR} \longrightarrow
      \fourcells{\blankL}{\arrRone}{p_R}{\blankR}
    &\\
    &&\\
    \hline
    \multicolumn{3}{c}{\text{Track~1, 2 and~3 rules}}\\*
    \arrRzero,\arrLzero \text{ rules} & \arrRone \text{ rules}
      & \arrLone \text{ rules} \\*
    \nobreakhline
    &&\\*
    &\sixcellsvert{\arrRone}{\blankR}{p}{\blankR}{\sigma}{\wc}
      \longrightarrow \sixcellsvert{\blankL}{\arrRone}{p_N}{\blankR}{\tau}{\wc}
    &\\*[2em]
    &\sixcellsvert{\arrRone}{\blankR}{\blankL}{p}{\wc}{\sigma} \longrightarrow
      \sixcellsvert{\blankL}{\arrRone}{p_L}{\blankR}{\wc}{\tau}
    &\\*[2em]
    &\sixcellsvert{\arrRone}{\blankR}{p}{\blankR}{\sigma}{\wc} \longrightarrow
      \sixcellsvert{\blankL}{\arrRone}{\blankL}{p'_R}{\tau}{\wc}
    &\\
    &&\\
    \hline
    \multicolumn{3}{c}{\text{Track~1, 2 and~4 rules}}\\*
    \arrRzero,\arrLzero \text{ rules} & \arrRone \text{ rules}
      & \arrLone \text{ rules} \\*
    \nobreakhline
    &&\\*
    &\fourcellsR{\arrRone}{\blankR}{\neg q_R} \longrightarrow
      \fourcellsR{\arrLone}{\blankR}{\neg q_R}
    &\\*[2em]
    &\fourcellsR{\arrRone}{p'_R}{\neg q_R} \longrightarrow
      \fourcellsR{\arrLone}{p_R}{\neg q_R}
    &\\
    &&\\
    \hline
    \multicolumn{3}{c}{\text{Track~1, 2, 3 and~4 rules}}\\*
    \arrRzero,\arrLzero \text{ rules} & \arrRone \text{ rules}
      & \arrLone \text{ rules} \\*
    \nobreakhline
    &&\\*
    &\fivecellsR{\arrRone}{p}{\sigma}{\neg q_R} \longrightarrow
      \fivecellsR{\arrLone}{p_N}{\tau}{\neq q_R}
    &\\
    &&\\
    \hline
    \multicolumn{3}{c}{\text{Track~1, 4 and~5 rules}}\\*
    \arrRzero,\arrLzero \text{ rules} & \arrRone \text{ rules}
      & \arrLone \text{ rules} \\*
    \nobreakhline
    &&\\*
    &&
    \begin{array}{rcl}
    \Ket{\,\sixcellsvert{\blankL}{\arrLone}{p}{\blankR}{\sigma}{\wc}\,}
      &\longrightarrow&
      \displaystyle\sum_{\tau,q_R}\delta(p,\sigma,\tau,q_R,R)
        \Ket{\,\sixcellsvert{\arrLone}{\blankR}{\blankL}{q_R}{\tau}{\wc}\,}
        \\[2em]
        &&+ \displaystyle\sum_{\tau,q_N}\delta(p,\sigma,\tau,q_N,N)
          \Ket{\,\sixcellsvert{\arrLone}{\blankR}{q_N}{\blankR}{\tau}{\wc}\,}
        \\[2em]
        &&+ \displaystyle\sum_{\tau,q_L}\delta(p,\sigma,\tau,q_L,L)
          \Ket{\,\sixcellsvert{\arrLone}{\blankR}{q'_L}{\blankR}{\tau}{\wc}\,}\\
    &&\\
    \Ket{\,\sixcellsvert{\blankL}{\arrLone}{\blankL}{q'_L}{\wc}{\wc}\,}
    &\longrightarrow& \Ket{\,\sixcellsvert{\arrLone}{\blankR}{q_L}{\blankR}{\wc}{\wc}\,}
    \end{array}
    \\
    &&\\
    \hline
    \multicolumn{3}{c}{\text{Track~1 and~4 rules}}\\*
    \arrRzero,\arrLzero \text{ rules} & \arrRone \text{ rules}
      & \arrLone \text{ rules} \\*
    \nobreakhline
    &&\\*
    &&\fourcells{\blankL}{\arrLone}{\blankL}{\blankL}
      \longrightarrow \fourcells{\arrLone}{\blankR}{\blankL}{\blankL}\\*[2em]
    &&\fourcells{\blankL}{\arrLone}{\blankR}{\blankR}
      \longrightarrow \fourcells{\arrLone}{\blankR}{\blankR}{\blankR}\\*[2em]
    &&\fourcells{\blankL}{\arrLone}{\blankR}{q_N}
      \longrightarrow \fourcells{\arrLone}{\blankR}{\blankR}{q_N}\\*[2em]
    &&\threecellsL{\arrLone}{\blankR} \longrightarrow
      \threecellsL{\arrRone}{\blankR} \\*
    &&\\*
    \nobreakhline
  \end{longtable}
}


{
  \centering
  \setlength{\extrarowheight}{4pt}
  \setlength{\tabcolsep}{12pt}
  \begin{longtable}{>{$}c<{$} >{$}c<{$}}
    \caption{Illegal pairs and regular expressions enforced by illegal pairs for Tracks~4 and~5.}
    \label{tbl:track45_illegal_pairs}\\
    \nobreakhline
    \text{Regular expressions} & \text{Illegal pairs} \\*
    \text{Track~4} & \text{Tracks~1 and~5}\\*
    \nobreakhline
    \\*
    \leftend\blankL{}^*q\blankR{}^*\rightend
    & \threecellsnotR{\arrLone}{q_R} \qquad
      \twocellsvert{\neg\arrLone}{q'_L} \\*
    \\
    \hline
  \end{longtable}
}

\end{comment}



{
  \centering
  \setlength{\extrarowheight}{4pt}
  \setlength{\tabcolsep}{12pt}
  \begin{longtable}{>{$}c<{$} >{$}c<{$} >{$}c<{$}}
    \caption{Initialisation illegal pairs for Tracks~4--6.}
    \label{tbl:track45_illegal_pairs}\\
    \nobreakhline
    \multicolumn{3}{c}{Illegal pairs} \\*
    \text{Tracks~1 and~4} & \text{Tracks~1 and~5} & \text{Tracks~1 and~6} \\*
    \nobreakhline
    \\*
    \threecellsnotL{\arrRzero}{\neg\blankR}
    & \twocellsvert{\arrLzero}{\neg 1}
    & \threecellsnotL{\arrRzero}{\neg\#} \\*[2em]
    \threecellsL{\arrRzero}{\neg q_0}
    & \twocellsvert{\arrLzeroi}{\neg \#}
    & \threecellsL{\arrRzero}{\neg\vdash} \\*[2em]
    \\
    \hline
  \end{longtable}
}



\begin{comment}

% --- "analysis" ---
These transition rules and penalty terms enforce the correct QTM transitions when applied to legal, well-formed states. Furthermore, since any well-formed state contains exactly one QTM head on Track~4, at most one of these transition rules applies to any well-formed state. It is also clear that the set of well-formed states on Tracks~1 to~5 remains closed under the full set of transition rules.

With the set of transition rule terms defined in \cref{eq:QTM_transition_rules}, there is no transition out of the final state $q_f$ of the QTM. So the $\arrL$ arrow cannot sweep left past the QTM head once it has entered $q_f$, and the clock stops at this point. Similarly, there is no $\arrRone$ turning rule when Track~5 contains a $q_R\in Q_R$ at the end of the chain. So, if the next step of the QTM would move the head beyond the right end of the chain, the clock stops when the $\arrRone$ reaches the end of the chain.

We can instead choose to allow the clock to continue ticking until it runs out of tape on Track~3, by adding a transition that allows the $\arrL$ to sweep left past a $q_f$ on Track~4 without triggering a transition on the QTM tracks, and adding a $\arrRone$ turning rule that applies when Track~4 contains a $q_R$ at the end of the chain without changing the $q_R$:
\begin{equation}
  \fourcells{\blankL}{\arrLone}{q_f}{\blankR} \longrightarrow
    \fourcells{\arrLone}{\blankR}{q_f}{\blankR}\,,\qquad
  \threecellsR{\arrRone}{q_R} \longrightarrow
    \threecellsR{\arrLone}{q_R}\,.
\end{equation}

\end{comment}




\subsection{Analysis}\label{sec:local-Hamiltonian_analysis}
\Cref{well-formed,evolve_to_illegal} are the key results needed to prove the desired ground state properties of the Hamiltonian we have constructed, thanks to the ``Clairvoyance Lemma'' from \textcite[Lemma~4.2]{AGIK} (see also \cite[Lemma~5.6]{Gottesman-Irani}).\footnote{Note that our definition of ``legal'' states follows that of \cite{Gottesman-Irani}, which differs from the definition in~\cite{AGIK}.} Since the Clairvoyance \namecref{clairvoyance} has previously only been stated and proven for specific constructions, we state and prove a very general version of the \namecref{clairvoyance} here, which applies to any standard-form Hamiltonian, as defined above:


\begin{lemma}[Invariant subspaces]
  \label{invariant_subspaces}
  Let $\Htrans$ and $\Hpenalty$ define a standard-form Hamiltonian as defined in \cref{def:standard-form_H}. Let $\mathcal{S}=\{S_i\}$ be a partition of the standard basis states of $\HS_C$ into minimal subsets $S_i$ that are closed under the transition rules (where a transition rule $\ket[CD]{ab}\ket{\psi} \rightarrow \ket[CD]{cd}U_{abcd}\ket{\psi}$ acts on $\HS_C$ by restriction to $(\C^C)^{\ox 2}$, i.e.\ it acts as $ab \rightarrow cd$).

  Then $\HS = (\bigoplus_S \mathcal{K}_{S_i})\ox\HS_Q$ decomposes into invariant subspaces $\mathcal{K}_{S_i}\ox\HS_Q$ of $H = \Hpenalty + \Htrans$ where $\mathcal{K}_{S_i}$ is spanned by $S_i$.
\end{lemma}

\begin{proof}
   $\Hpenalty$ is diagonal in the standard basis by definition (\cref{standard-form_H:penalty_terms} of \cref{def:standard-form_H}), so $\mathcal{K}_{S_i}\ox\HS_Q$ are trivially invariant under $\Hpenalty$. But, by the form of the transition rule terms (\cref{standard-form_H:transition_terms} of \cref{def:standard-form_H}), the image $\Htrans\ket[C]{x}\ket[Q]{\varphi}$ of a standard basis state $\ket[C]{x}$ under $\Htrans$ has support only on standard basis states of $\HS_C$ that are reachable by transition rules from $\ket[C]{x}$. Closure of $\mathcal{K}_{S_i}\ox\HS_Q$ under $H_\text{trans}$ is then immediate from the definition of $S_i$.
\end{proof}


\begin{lemma}[Clairvoyance Lemma]\label{clairvoyance}
  Let $H = \Htrans + \Hpenalty$ be a standard-form Hamiltonian as defined in \cref{def:standard-form_H}, and let $\mathcal{K}_S$ be defined as in \cref{invariant_subspaces}. Let $\lambda_0(\mathcal{K}_S)$ denote the minimum eigenvalue of the restriction $H\vert_{\mathcal{K}_S\ox \HS_Q}$ of $H = \Htrans + \Hpenalty$ to the invariant subspace $\mathcal{K}_S\ox\HS_Q$.

  Assume that there exists a subset $\mathcal{W}$ of standard basis states for $\HS_C$ with the following properties:
  \begin{enumerate}
  \item All legal standard basis states for $\HS_C$ are contained in $\mathcal{W}$. \label[condition]{clairvoyance:legal}
  \item $\mathcal{W}$ is closed with respect to the transition rules.  \label[condition]{clairvoyance:closure}
  \item At most one transition rule applies in each direction to any state in $\mathcal{W}$. \label[condition]{clairvoyance:single_transition}
  \item For any subset $S\subseteq\mathcal{W}$ that contains only legal states, there exists at least one state to which no backwards transition applies. \label[condition]{clairvoyance:initial_state}
  \end{enumerate}

  \noindent Then each $\mathcal{K}_S$ falls into one of the following categories:
  \begin{enumerate}[label=(\arabic{*}).,ref=(\arabic{*})]
  \item $S$ contains only illegal states, and $\lambda_0(\mathcal{K}_S) \geq 1$. \label[case]{S_illegal}

  \item $S$ contains both legal and illegal states, and $\lambda_0(\mathcal{K}_S) = \Omega(1/\abs{S}^3)$.
  \label[case]{S_legal-illegal}

  \item $S$ contains only legal states, and $\lambda_0(\mathcal{K}_S) = 0$. The corresponding eigenspace is
  \begin{equation}
    \ker\left(\Htrans + \Hpenalty\right) =
    \linspan\left\{
      \frac{1}{\sqrt{\abs{S}}}\sum_{t=0}^{\abs{S}-1}\ket[C]{t}\ket[Q]{\psi_t}
    \right\}
  \end{equation}
  where $\ket[C]{t}$ are the states in $S$, $\ket{\psi_0}$ is any state in $\HS_Q$, and $\ket{\psi_t} := U_t\dots U_1\ket[Q]{\psi_0}$ where $U_t$ is the unitary on $\HS_Q$ appearing in the transition rule that takes $\ket[c]{t-1}$ to $\ket[C]{t}$. All other states in $\mathcal{K}_S\ox\HS_Q$ have energy at least $\Omega(1/\abs{S}^2)$.
  \label[case]{S_legal}
  \end{enumerate}
\end{lemma}


\noindent
To prove this, we will need Kitaev's geometrical lemma:

\begin{lemma*}[Geometrical Lemma -- Lemma~14.4 in \cite{Kitaev_book}]
  \label{Kitaev_geometrical}
  Let $A,B \geq 0$ be non-negative operators such that $\ker A \cap \ker B = \{0\}$, $\lambdamin(A\vert_{\supp A}) \geq \mu$ and $\lambdamin(B\vert_{\supp B}) \geq \mu$. Then
  \begin{equation}
    A + B \geq 2\mu\sin^2\left(\frac{\theta}{2}\right)
  \end{equation}
  where
  \begin{equation}
    \cos\theta := \max_{\substack{\ket{\psi} \in \ker A\\ \ket{\varphi} \in \ker B}}\abs{\braket{\psi|\varphi}}.
  \end{equation}
\end{lemma*}\addtheoremline{lemma}{Geometrical Lemma}


\begin{proof}[of Clairvoyance \cref{clairvoyance}]
  \Cref{S_illegal} is trivial since $\bra[C]{x}\bra[Q]{\psi}\Hpenalty\ket[C]{x}\ket[Q]{\psi} \geq 1$ for any illegal standard basis state $\ket[C]{x}$.

  Now consider \cref{S_legal,S_legal-illegal}. By assumption, all legal standard basis states of $\HS_C$ are contained in $\mathcal{W}$, which is closed under transition rules. Thus closure of~$S$ (\cref{invariant_subspaces}) implies $S \subseteq \mathcal{W}$. Consider the directed graph of states in $\mathcal{W}$ formed by adding a directed edge between pairs of states connected by transition rules. By assumption, only one transition rule applies in each direction to any state in $\mathcal{W}$, so the graph consists of a union of disjoint paths (which could be loops in \cref{S_legal-illegal}). Minimality of $S$ (\cref{invariant_subspaces}) implies that $S$ consists of a single such connected path.

  Let $t=0,\dots,|S|-1$ denote the states in $S$ enumerated in the order induced by the directed graph. $\Htrans$ then acts on the subspace $\mathcal{K}_S\ox\HS_Q$ as
  \begin{equation}\label{eq:H_KS}
    \bigl.\Htrans\bigr\vert_{\mathcal{K}_S\ox\HS_Q}
    = \sum_{t=0}^T \frac{1}{2}\left(
        \proj{t}\ox\id + \proj{t+1}\ox\id
        - \ketbra{t+1}{t}\ox U_t - \ketbra{t}{t+1}\ox U_t^\dg
      \right),
  \end{equation}
  where $U_t$ is the unitary on $\HS_Q$ appearing in the transition rule that takes $\ket[C]{t}$ to $\ket[C]{t+1}$. $T = \abs{S}-1$ if the path in $S$ is a loop, otherwise $T = \abs{S}-2$.

  Consider a single term $H_t := \proj{t}\ox\id + \proj{t+1}\ox\id + \ketbra{t+1}{t}\ox U_t + \ketbra{t}{t+1}\ox U_t^\dg$ from \cref{eq:H_KS}. Defining the unitary $W_t = \proj{t+1}\ox U_t^\dg + (\id-\proj{t+1})\ox\id$, we have
  \begin{equation}
    W_t H_t W_t^\dg
    = \left(\ket{t}-\ket{t+1}\right)\left(\bra{t}-\bra{t+1}\right) \ox\id
    \geq 0.
  \end{equation}
  Thus, whether the path in $S$ forms a loop or not, we have\footnote{This operator has the same form as Kitaev's Hamiltonian, and the analysis from here on is similar to that in \textcite{Kitaev_book}.}
  \begin{equation}\label{eq:Kitaev_Hamiltonian}
    \begin{split}
      \bigl.\Htrans\bigr\vert_{\mathcal{K}_S\ox\HS_Q}
      &\geq \sum_{t=0}^{\abs{S}-2} \frac{1}{2}\left(
          \proj{t}\ox\id + \proj{t+1}\ox\id
          - \ketbra{t+1}{t}\ox U_t - \ketbra{t}{t+1}\ox U_t^\dg
        \right)\\
      &=: \Hpath,
    \end{split}
  \end{equation}
  with equality if the path is not a loop.

  Defining the unitary
  \begin{equation}\label{eq:W_unitary}
    W = \sum_{t=0}^{\abs{S}-2} \proj{t}\ox\prod_{i=0}^t U_i^\dg + \Proj{(\abs{S}-1)}\ox\id,
  \end{equation}
  we have $\Hpath \simeq W \Hpath W^\dg = E\ox\id$ where
  \begin{equation}\label{eq:E_matrix}
    E = \begin{pmatrix}
          \frac{1}{2}  & -\frac{1}{2} &      0       &    \dots     &        &    \dots     &       0      &       0      \\
          -\frac{1}{2} &       1      & -\frac{1}{2} &    \ddots    &        &              &              &       0      \\
                0      & -\frac{1}{2} &      1       & -\frac{1}{2} &        &              &              &    \vdots    \\
             \vdots    &    \ddots    & -\frac{1}{2} &      1       & \ddots &              &              &              \\
                       &              &              &    \ddots    & \ddots &              &    \ddots    &    \vdots    \\
             \vdots    &              &              &              &        &    \ddots    &    \ddots    &       0      \\
                0      &              &              &              & \ddots &    \ddots    &       1      & -\frac{1}{2} \\
                0      &       0      &    \dots     &              & \dots  &      0       & -\frac{1}{2} & \frac{1}{2}
        \end{pmatrix}.
  \end{equation}
  The matrix $E$ is the Laplacian of the random walk on a line, and it is well known that its eigenvalues are given by $\lambda_k = 1-\cos q_k$ where $q_k = k\pi/\abs{S}$, $k=0,\dots,\abs{S}-1$, with corresponding eigenvectors $\ket{\phi_k} \propto \sum_{j=0}^{\abs{S}-1} \cos\left(q_k(j+\frac{1}{2})\right) \ket{j}$~\cite{Kitaev_book}. Thus
  \begin{equation}
    \ker \Hpath
    = \linspan\left\{
        W^\dg \frac{1}{\sqrt{\abs{S}}}\sum_{t=0}^{\abs{S}-1}\ket[C]{t}\ket[Q]{\psi_0}
      \right\}
    = \linspan\left\{
        \frac{1}{\sqrt{\abs{S}}}\sum_{t=0}^{\abs{S}-1}\ket[C]{t}\ket[Q]{\psi_t}
      \right\}
  \end{equation}
  where $\ket{\psi_t} := U_t\dots U_0 \ket{\psi_0}$ for any $\ket{\psi_0}$.

  First consider \cref{S_legal-illegal}. Take $A = \Hpath$ and $B = \Hpenalty|_{\mathcal{K}_S\ox\HS_Q}$ in \cref{Kitaev_geometrical}. We have $\lambdamin(A|_{\supp A}) = 1 - \cos q_1 = \Omega(1/\abs{S}^2)$ and $\lambdamin(B|_{\supp B}) = 1$. Furthermore, since $S$ contains at least one illegal state in \cref{S_legal-illegal}, we have $\ker A\cap \ker B = \{0\}$ and
  \begin{equation}
    \cos^2\theta
    = \max_{\ket{\psi}} \bra[C]{\phi_0}\bra[Q]{\psi}
        W^\dg\,\Pi_{\ker B}W \ket[C]{\phi_0}\ket[Q]{\psi}
    \leq 1 - 1/\abs{S},
  \end{equation}
  where $\Pi_{\ker B}$ is the projector onto $\ker B$ and we have used the fact that $B = \Hpenalty|_{\mathcal{K}_S\ox\HS_Q}$ is diagonal in the standard basis. Invoking \cref{Kitaev_geometrical}, we obtain
  \begin{equation}
    \left(\Htrans + \Hpenalty\middle)\right\vert_{\mathcal{K}\ox\HS_Q}
    \geq \Hpath + \Hpenalty\vert_{\mathcal{K}\ox\HS_Q}
    = \Omega(1/\abs{S}^3),
  \end{equation}
  thus $\lambda_0(\mathcal{K}_S) = \Omega(1/\abs{S}^3)$ as claimed.

  Finally, consider \cref{S_legal}. Since $S$ contains only legal states in this case, $\Hpenalty\vert_{\mathcal{K}_S\ox\HS_Q} = 0$. Furthermore, by \cref{clairvoyance:initial_state} the states in $S$ cannot form a loop, so $H\vert_{\mathcal{K}_S\ox\HS_Q} = \Htrans\vert_{\mathcal{K}_S\ox\HS_Q} = \Hpath \simeq E\ox\id$. The claim in the \namecref{clairvoyance} now follows from the form of the eigenvalues and kernel of $E$, given above.
\end{proof}

Note that the proof of the Clairvoyance \namecref{clairvoyance} relied crucially on unitarity of the operators $U_{abcd}$ appearing in the transition rules (see \cref{invariant_subspaces}). In particular, it is \emph{not} sufficient for the $U_{abcd}$ to be partial isometries. That would not allow us to unitarily transform $\Htrans\vert_{\mathcal{K}_S\ox\HS_Q}$ into $E\ox\1$ using the unitary $W$ in \cref{eq:W_unitary,eq:E_matrix}. Thus, in order to apply the Clairvoyance \cref{clairvoyance}, we \emph{must} complete the quantum parts of the transition rules to a full unitary. This necessitates the time-wasting construction in \cref{sec:unitarity} (or similar).

We are finally in a position to prove \cref{QTM_in_local_Hamiltonian}, the main result of this section. As commented above, let $\HS_C = (\C^C)^{\ox L}$ and $\HS_Q = (\C^Q)^{\ox L}$ be the Track~1\nobreakdash--3 and Track~4\nobreakdash--5 Hilbert spaces, respectively, for a chain of length $L$, where $\C^C \simeq \linspan\{\ket{s,p,\sigma}\}\oplus\linspan\{\leftend,\rightend\}$ and $\C^Q \simeq \linspan\{\ket{q,\tau}\oplus\linspan\{\leftend,\rightend\}\}$ (cf.\ \cref{eq:local_Hilbert_space}). Let $\htrans \in \cB((\C^C\ox\C^Q)^{\ox 2})$ be the sum of all the transition rule terms defined in \cref{tbl:track123_rules,tbl:track456_rules} (omitting those marked in \cref{tbl:track123_rules}) after completing to a full unitary so that the resulting Hamiltonian is standard-form. Let $\hpenalty \in \cB((\C^C\ox\C^Q)^{\ox 2})$ be the sum of all penalty terms defined in \cref{tbl:track123_illegal_pairs}, and $\hinit \in \cB((\C^C\ox\C^Q)^{\ox 2})$ be the sum of all Track~4--6 initialisation penalty terms defined in \cref{tbl:track45_illegal_pairs}.

Define the standard-form (\cref{def:standard-form_H}) Hamiltonian $H(L) = \Htrans(L) + \Hpenalty(L)  \in \HS_C\ox\HS_Q$ on a chain of length $L$, where $\Htranspen = \sum_{i=1}^{L-1} \htranspen^{(i,i+1)}$, and similarly define $\Hinit(L) := \sum_{i=1}^{L-1} \hinit^{(i,i+1)}$.

\begin{proposition}[Unique ground state]\label{H_unique_gs}
  The unique 0-energy eigenstate of\linebreak $\bigl(\Htrans(L) + \Hpenalty(L) + \Hinit(L)\bigr)\bigl|_\Sbr\bigr.$ is the computational history state
  \begin{equation}\label{eq:0-energy_eigenstate}
    \frac{1}{\sqrt{T}}\sum_{t=0}^T \ket[C]{\phi_t}\ket[Q]{\psi_t},
  \end{equation}
  where $T = \Omega\left(L\abs{\Sigma\times Q}^L\right)$, $\ket[Q]{\psi_0}\in\HS_Q$ is the initial configuration of the QTM with the unary representation of the number $L-K-3$ as input, and $\ket[Q]{\psi_t}\in\HS_Q$ is the sequence of states produced by evolving $\ket{\psi_0}$ under the QTM and time-wasting counter TM transition rules (where each such state is duplicated $O(L)$ times in succession in the sequence).
\end{proposition}

\begin{proof}
  Let us first apply the Clairvoyance \namecref{clairvoyance} to $\bigl.\bigl(\Htrans(L) + \Hpenalty(L)\bigr)\bigr|_\Sbr$. We have to check that $\htrans$ and $\hpenalty$ fulfil the requirements of the \namecref{clairvoyance}.

  Take $\HS_C$ to be the Hilbert space of Tracks~1\nobreakdash--3, and $\HS_Q$ the Hilbert space of Tracks~4\nobreakdash--5. Define $\mathcal{W}$ to be the set of all well-formed Track~1\nobreakdash--3 standard basis states. Any state that is not well-formed violates an illegal pair enforcing a regular expression, so all legal Track~1\nobreakdash--3 states are well-formed. $\mathcal{W}$ therefore fulfils \cref{clairvoyance:legal} of \cref{clairvoyance}. By \cref{well-formed}, the set of well-formed states is closed under the transition rules and at most one transition rule applies in each direction to any well-formed state, so $\mathcal{W}$ fulfils \cref{clairvoyance:closure,clairvoyance:single_transition} of \cref{clairvoyance}. Finally, by \cref{evolve_to_illegal}, the only subset of legal Track~1\nobreakdash--3 standard basis states that is closed under the transition rules is the set of clock states $\{\ket{\phi_t}\}$, which has one state $\ket{\phi_0}$ to which no backward transition applies, and one state $\ket{\phi_T}$ to which no forward transition applies. So $\mathcal{W}$ also fulfils \cref{clairvoyance:initial_state} of \cref{clairvoyance}.

  All penalty terms are diagonal in the standard basis, as required by \cref{invariant_subspaces,clairvoyance}, and all transition rules are of the form required in \cref{clairvoyance}, by construction. $\htrans$ and $\hpenalty$ therefore fulfil all the requirements of \cref{invariant_subspaces,clairvoyance}.

  Invoking the Clairvoyance \cref{clairvoyance}, the 0-energy eigenspace of $(\Htrans + \Hpenalty)|_\Sbr$ has the form
  \begin{equation}
    \ker\left(\Htrans + \Hpenalty\middle)\right|_\Sbr =
    \linspan\left\{
      \frac{1}{\sqrt{\abs{S}}}\sum_{t=0}^{\abs{S}-1}\ket[C]{\phi_t}\ket[Q]{\psi_t}
    \right\},
  \end{equation}
  where $\ket[Q]{\psi_t} = U_t\dots U_1\ket[Q]{\psi_0}$ and $\ket[Q]{\psi_0}$ is any state of $\HS_Q$.

  Now we include the $\hinit$ terms, and show that $\ket[Q]{\psi_0}$ must be as claimed in \cref{H_unique_gs}. For $0 \leq t \leq 2L-1$, the clock states $\ket{\phi_t}$ consist of an $\arrRzero$ that sweeps from left to right and back along the chain (where for the time steps $t=L+1,\dots,L+K$ of this sweep, the arrow is in the states $\arrLzeroz,\dots,\arrLzeroK$, respectively). The transition rules that apply during the initialisation sweep act trivially on Tracks~4\nobreakdash--5, so $\ket[Q]{\psi_t} = \ket[Q]{\psi_0}$ for $t \leq 2L-1$. By construction, the $\hinit$ penalty terms from \cref{tbl:track45_illegal_pairs} give an additional energy penalty to any Track~4\nobreakdash--5 states that are not in the desired initial QTM configuration when the $\arrLzero$ sweeps past.

  Consider any Track~4\nobreakdash--5 state $\ket[Q]{\psi_0}$ that is not the desired initial QTM configuration. Then there is some $0 \leq t \leq 2L-1$ for which $\bra[C]{\phi_t}\bra[Q]{\psi_t} \Hinit \ket[C]{\phi_t}\ket[Q]{\psi_t} > 0$. Noting that the overall Hamiltonian $H \geq 0$ and the $\ket{\phi_t}$ are mutually orthogonal, this immediately implies that the unique 0-energy state is that given in \cref{eq:0-energy_eigenstate}.

  The initial state $\ket[Q]{\psi_0}$ on Track~4 matches the regular expression $\leftend\blankL{}^*q\blankR{}^*\rightend$. The transition rules $U_t$ preserve this form -- which allows us to identify Tracks~4 and~5 with the head and tape configuration of the QTM -- and by construction implement one step of the QTM or time-wasting counter TM in each $\arrLone$ sweep (all other unitaries applied to Tracks~4 and~5 during each sweep being identities).

  Finally, the clock counter TM advances through $\Omega(\abs{Q\times L}^L)$ configurations before it runs out of tape, and each step of this TM requires one complete steep of the Track~1 arrow which takes $\Omega(L)$ steps. Thus $T = \Omega(L\abs{Q\times L}^L)$ as claimed. We are done.
\end{proof}


The local Hilbert space dimension in \cref{eq:local_Hilbert_space} manifestly depends only on the alphabet size and internal states of the counter TM encoded on Tracks~2 and~3, the QTM encoded on Tracks~4 and~5, and the time-wasting counter TM encoded on Tracks~4 and~6. However, the alphabet size and internal state space of both counter TMs depends only on the base $\zeta$ we choose, and this is completely determined by the alphabet size and internal state space of the QTM. Thus the local Hilbert space dimension $d$ depends only on the alphabet size and number of internal states of the QTM, as required by \cref{QTM_in_local_Hamiltonian:local_dim} of \cref{QTM_in_local_Hamiltonian}.

Since the local interaction $h$ of our Hamiltonian is constructed by summing transition rule terms and penalty terms, and $\htrans,\hpenalty,\hinit \geq 0$, we have $h \geq 0$. But we have shown that the overall Hamiltonian has a 0-energy eigenstate, hence it is frustration-free, as required in \cref{QTM_in_local_Hamiltonian:FF} of \cref{QTM_in_local_Hamiltonian}.

\Cref{H_unique_gs} implies that the unique ground state of $H|_\Sbr$ has the computational history state form claimed in \cref{QTM_in_local_Hamiltonian:gs} of \cref{QTM_in_local_Hamiltonian}. Moreover, since the history state encodes $\Omega(\abs{Q\times L}^L)$ complete sweeps of the Track~1 arrow, and the QTM is advanced by exactly one step in each right-to-left sweep, the computational history state encodes $\Omega(\abs{Q\times L}^L)$ steps of the computation. If the QTM halts before this, it transitions by the $q_f$ rule of \cref{eq:QTM_qf_transition_rule} to running the time-wasting counter TM, which never alters the QTM tape encoded on Track~5. Track~5 is therefore only in the state $q_f$ for one time step. Thus \cref{QTM_in_local_Hamiltonian:halt} of \cref{QTM_in_local_Hamiltonian} is also satisfied.

Now imagine that the QTM reaches a configuration in which the next step would move the head before the starting cell. (Though in the case of the proper machines considered in \cref{QTM_in_local_Hamiltonian:halt,QTM_in_local_Hamiltonian:out-of-tape,QTM_in_local_Hamiltonian:explicit-form} of \cref{QTM_in_local_Hamiltonian}, the former will never occur.) Consider the corresponding $\ket{\psi_t}$ in the computational history state. The QTM transition rules do not alter Track~6, so Track~6 is still in its initial configuration. Since the QTM has deterministic head movement, then at no point during the evolution is its head ever in a superposition of locations. $\ket{\psi_t}$ is therefore of the form:
\begin{equation}
  \ket{\psi_t} =
    \ket{\leftend} \left( \sum_q
      \ket[\text{Track~4}]{q\blankR\dots\blankR}
      \ox\ket[\text{Track~5}]{\varphi_q}
      \ox\ket[\text{Track~6}]{\vdash_q\#\dots\#}
    \right) \ket{\rightend},
\end{equation}
where $\ket{\varphi_q}$ are unnormalised Track~5 QTM tape states, and all configurations in the superposition would step the QTM head left in the next time-step. The $q_f$ transition rule from \cref{eq:QTM_qf_transition_rule} therefore applies to all states in the superposition, and the next state must have the form:
\begin{equation}
  \ket{\psi_{t+1}} =
    \ket{\leftend} \left( \sum_q
      \ket[\text{Track~4}]{p_\alpha\blankR\dots\blankR}
      \ox\ket[\text{Track~5}]{\varphi_q}
      \ox\ket[\text{Track~6}]{\vdash_q\#\dots\#}
    \right) \ket{\rightend}.
\end{equation}
Thenceforth, only time-wasting counter TM transition rules apply.

A very similar argument applies if the QTM reaches a configuration in which the head moves beyond cell $L$. Since the time-wasting counter TM transitions never alter Track~5, \cref{QTM_in_local_Hamiltonian:out-of-tape} of \cref{QTM_in_local_Hamiltonian} follows.

This concludes the proof of \cref{QTM_in_local_Hamiltonian}, and this section.


%%% Local Variables:
%%% mode: latex
%%% mode: visual-line
%%% mode: adaptive-wrap-prefix
%%% fill-column: 999999
%%% TeX-master: "spectral-gap.tex"
%%% End:

%  LocalWords:  QTMs Gottesman Irani QTM QTM's TMs RHS AGIK Kitaev's Kitaev

main-results.tex
\section{Main results}
\label{sec:main-results}

For each natural number $n$, we define $\varphi=\varphi(n)$ as the rational number whose binary decimal expansion contains the digits of $n$ in reverse order after the decimal. We also fix one particular Universal Turing Machine and call it UTM.


\begin{theorem}[Algorithmic undecidability of the spectral gap]\label{thm:promise}
  We construct explicitly a dimension $d$, $d^2\times d^2$ matrices $A,B,C,D$ and a rational number $\beta$ so that
  \begin{enumerate}
  \item $A$ is Hermitian and with coefficients in $\Z+\beta \Z+ \frac{\beta}{\sqrt{2}}\Z$,
  \item $B,C$ have integer coefficients,
  \item $D$ is Hermitian and with coefficients in $\{0,1,\beta\}$.
  \end{enumerate}
  For each natural number $n$, define:
  \begin{align*}
    h_1(n)&=\alpha(n)\1\quad  \text{($\alpha(n)$ an algebraic number)}\\
    h_{\text{row}}(n)&=D\quad \text{(independent of $n$)}\\
    h_{\text{col}}(n)&=A + \beta\left(e^{i\pi\varphi} B + e^{-i\pi\varphi} B^\dg + e^{i\pi2^{-\abs{\varphi}}} C + e^{-i\pi2^{-\abs{\varphi}}} C^\dg\right).
  \end{align*}
  Then:
  \begin{enumerate}
  \item The local interaction strength is $\le 1$. I.e.\ all terms $h_1(n), h_{\text{row}}(n), h_{\text{col}}(n)$ have operator norm bounded by $1$.
  \item If UTM halts on input $n$, then the associated family of Hamiltonians $\{H^{\Lambda(L)}(n)\}$ is gapped in the strong sense of \cref{def:gapped} and, moreover, the gap $\gamma\ge 1$.
  \item If UTM does not halt on input $n$, then the associated family of Hamiltonians $\{H^{\Lambda(L)}(n)\}$ is gapless in the strong sense of \cref{def:gapless}.
  \end{enumerate}
\end{theorem}

Using the classic result of \textcite{Turing} that the Halting Problem for UTM on input $n$ is algorithmically undecidable, we can conclude that {\it the spectral gap problem is also undecidable}. As noted above, this immediately gives the following:

\begin{theorem}[Axiomatic independence of the spectral gap]\label{thm:axiomatic}
  Let $d\in\mathbb{N}$ be a sufficiently large constant. For any consistent formal system with a recursive set of axioms, there exists a translationally-invariant nearest-neighbour Hamiltonian on a 2D lattice with local dimension $d$ and algebraic entries for which neither the presence nor the absence of a spectral gap is provable from the axioms.
\end{theorem}

It is straightforward (if tedious) to extract an explicit value for $d$ in \cref{thm:promise,thm:axiomatic} from the construction described in this paper.


  \subsection{Implications of the results}
\label{sec:conclusions}

These results have a number of implications for condensed matter physics and fundamental physics. They imply that one can write down simple models whose phase diagrams are uncomputably complicated. The standard approach of trying to gain insight into such models by solving numerically for larger and larger lattice sizes is doomed to failure. The system could display all the features of a gapless model, with the gap of the finite system decreasing monotonically with increasing size. Then, at some threshold size, it may suddenly switch to having a large gap. Not only can this threshold be arbitrarily large; the threshold itself is uncomputable. In general, we can never know whether a large many-body system is approaching the asymptotic behaviour of the thermodynamic limit---one more row of atoms may completely change its properties. Our findings also imply that a result showing robustness of the spectral gap under perturbations, as for the case of frustration-free Hamiltonians in \cite{MichalakisFrustrationFree}, cannot hold for general gapped systems.

Phase diagrams with infinitely many phases are known in quantum systems in connection with the quantum Hall effect, where fractal diagrams like the Hoftstadter butterfly can be obtained \cite{OsadchyAvron,Hofstadter}. Since membership in many fractal sets is not decidable (when formulated in the framework of real computation; see \cite{BlumSmale}), it would be interesting to see whether quantum Hall systems could provide a real-world manifestation of our findings.

Conjectures about the spectral gap, such as the Haldane conjecture, the 2D AKLT conjecture, or the Yang-Mills mass gap conjecture, implicitly assume that these questions can be answered one way or the other. Our results prove that the answer to the general spectral gap question is not determined by the axioms of mathematics. Whilst our results are still a long way from proving that any of these specific conjectures are axiomatically undecidable, they at least open the door to the possibility that these -- or similar -- questions about physical models may be provably unanswerable.




%%% Local Variables:
%%% mode: latex
%%% mode: visual-line
%%% mode: adaptive-wrap-prefix
%%% TeX-master: "spectral-gap"
%%% End:

%  LocalWords:  UTM Hoftstadter AKLT

overview.tex
\section{Extended Overview}\label{sec:extended-overview}
Since the proof of our spectral gap undecidability result \cref{thm:promise} is quite long, in this section we give an overview and discussion of the main ideas in the proof.


The first and most important step in proving undecidability of the spectral gap is to prove undecidability of another relevant quantity: the ground state energy density. Once we have this, it is relatively easy to ``lift'' it to undecidability of the spectral gap. (More precisely, we give a reduction from the ground state energy density problem to the spectral gap problem.) The intuition behind this is illustrated in \cref{fig:GSE-to-gap}; the proof can be found in \cref{sec:spectral-gap}.

In fact, undecidability of the ground state energy density is stronger than we really need to prove undecidability of the spectral gap. It is sufficient to prove undecidability of the ground state energy \emph{with constant promise gap}; undecidability of the ground state energy density implies that this holds even with a promise gap diverging to infinity.

\begin{figure}
  \centering
  \hspace{4em}\includegraphics[width=0.7\columnwidth]{GSE-to-gap}
  \caption[From ground state energy density to spectral gap.]{To relate ground state energy density and spectral gap, we need: (i)~A Hamiltonian $H_u(\varphi)$ whose ground state energy density is either strictly positive or tends to $0$ from below in the thermodynamic limit, but determining which is undecidable, and (ii)~a gapless Hamiltonian $H_d$ with ground state energy~0. We combine $H_u(\varphi)$ and $H_d$ to form a new local interaction, $h(\varphi)$, in such a way that $h(\varphi)$ has (iii)~an additional non-degenerate 0-energy eigenstate, and the continuous spectrum of $H_d$ is shifted immediately above the ground state energy of $H_u$.
  %
  (a)~If the ground state energy density of $H_u(\varphi)$ is strictly positive, its ground state energy in the thermodynamic limit must diverge to $+\infty$, and $h(\varphi)$ is gapped. (b)~Whereas if the ground state energy density of $H_u(\varphi)$ tends to~0 from below, then its ground state energy in the thermodynamic limit must be $\leq 0$, and $h(\varphi)$ is gapless. A proof can be found in \cref{sec:spectral-gap}.}
  \label{fig:GSE-to-gap}
\end{figure}


\subsection{Ground state energy density}
\label{sec:GSE_density}
As in \cref{sec:gapped}, consider the square lattice $\Lambda(L)$ with edge length $L\in\mathbb{N}$ but in the general case of $\nu\in\mathbb{N}$ spatial dimensions, supporting a translationally-invariant nearest-neighbour Hamiltonian
\begin{equation}
  H^{\Lambda(L)}:=\sum_{(i,j)\in\cal E} h^{(i,j)} + \sum_{k\in\Lambda(L)} h_1^{(k)},
\end{equation}
and let $c$ be its local interaction strength. Assume open boundary conditions. The \emph{ground state energy density} is defined as
\begin{equation}
  E_\rho:=\lim_{L\rightarrow\infty}E_\rho(L), \quad\mbox{where}\quad
  E_\rho(L):=L^{-\nu}\lambda_0(H^{\Lambda(L)}).
\end{equation}

The following simple argument shows that this limit is indeed well defined. Consider two lattices of different sizes $L,L'\in\mathbb{N}$ such that $L=nL'$ for some $n\in\mathbb{N}$. Assume w.l.o.g.\ that the interaction terms in the Hamiltonian are all positive semi-definite. Then $H^{\Lambda(L)}$ is, as an operator, lower bounded by the sum of $n^\nu$ translates of $H^{\Lambda(L')}$. So we have that
\begin{equation}
  \lambda_0(H^{\Lambda(L)})\geq n^\nu \lambda_0(H^{\Lambda(L')}).
\end{equation}
On the other hand, we can use a product of $n^\nu$ copies of the ground state of $H^{\Lambda(L')}$ in order to obtain an analogous upper bound on the ground state energy of $H^{\Lambda(L)}$ of the form
\begin{equation}
   \lambda_0(H^{\Lambda(L)})\leq n^\nu \lambda_0(H^{\Lambda(L')})+2\nu n^\nu L'^{(\nu-1) }c.
\end{equation}
Dividing both inequalities by $L^\nu$ we are left with
\begin{equation}
  E_\rho(L')\leq E_\rho(L)\leq E_\rho(L')+\frac{2\nu c}{L'}.
\end{equation}
Hence, an interval of order $\mathcal{O}(1/L')$ contains both $\liminf$ and $\limsup$ of $E_\rho(L)$ so that both must coincide, which proves that $\lim_{L\rightarrow\infty}E_\rho(L)$ is well defined.

The ground state energy density is an important physical quantity in its own right, as well as being our main stepping stone to the spectral gap results. It is therefore worth a brief digression to note that the above argument also shows that the ground state energy density can be computed to any precision $\delta>0$ by exact diagonalisation of $H^{\Lambda(L')}$ for any $L'>2\nu c/\delta$. This immediately implies that the ground state energy density problem is \emph{decidable} if we provide a finite promise gap $\delta$.
%
\begin{proposition}[Decidability of g.s.\ energy density with promise gap]
  \label{thm:gs_density_decidability}
  Let $\delta>0$ be a computable number and consider translationally-invariant nearest-neighbour Hamiltonians on a $\nu-$dimensional square lattice with open boundary conditions, finite local Hilbert space dimensions and algebraic matrix entries. Then determining whether $E_\rho\leq 0$ or $E_\rho\geq \delta$ is decidable under the promise that $E_\rho\not\in (0,\delta)$.
\end{proposition}

Since the real algebraic numbers form a computably ordered field whose cardinality is countably infinite, we can think of the input Hamiltonian as being encoded as natural number.

This is in sharp contrast to the following, which will form the crucial step in our proof:
%
\begin{theorem}[Undecidability of g.s.\ energy density]
  \label{thm:gs_density}
  Let $d\in\mathbb{N}$ be sufficiently large but fixed, and consider translationally-invariant nearest-neighbour Hamiltonians on a 2D square lattice with open boundary conditions, local Hilbert space dimension $d$, algebraic matrix entries, and local interaction strengths bounded by~1. Then determining whether $E_\rho=0$ or $E_\rho>0$ is an undecidable problem.
\end{theorem}

In the next two sections, we will discuss two approaches to proving \cref{thm:gs_density} that do \emph{not} work. \Cref{sec:overview:Wang-tiling} describes a purely classical construction based on Wang tilings. This gives a Hamiltonian with the correct spectral properties, but it necessarily requires unbounded local Hilbert space dimension $d$. In \cref{sec:overview:QMA-constructions}, we briefly review the Kitaev-Feynman-style local Hamiltonian constructions used in recent QMA-hardness results. By a new and careful application of the quantum phase estimation technique, described in \cref{sec:overview:constant-local-dimension}, extending ideas from \textcite{Gottesman-Irani} in \cref{sec:overview:Gottesman-Irani}, this approach can give a Hamiltonian with constant local dimension. But it necessarily fails to have the required spectral properties. Finally, in \cref{sec:overview:thermodynamic-limit}, we discuss how combining ideas from \emph{both} these approaches allows us to achieve the required spectral properties whilst simultaneously keeping the local dimension constant.





\subsection{Wang Tilings}
\label{sec:overview:Wang-tiling}
The first approach one might consider to proving undecidability of the ground state energy is to note the close relationship between tilings and (classical) Hamiltonians, recalling \posscite{Berger} classic result that the tiling problem is undecidable.

We will soon see that this approach is too weak to prove \cref{thm:gs_density}. Nonetheless, not only is it helpful to understand why this approach breaks down, the much more involved construction required to prove our main result will also make use of Wang tilings, albeit in a less direct way.

A unit square whose edges are coloured with colours chosen from a finite set is called a \emph{Wang tile}. A finite set $\mathcal{T}$ of Wang tiles is said to \emph{tile the plane} $\mathbb{Z}^2$ if there is an assignment  $\mathbb{Z}^2\rightarrow \mathcal{T}$  so that abutting edges of adjacent tiles have the same colour. The result we will use is the fact that there exists no algorithm which, given any set of tiles as input, decides whether or not this set can tile the plane---\emph{tiling is undecidable}~\cite{Berger}. Here, rotations or reflections of the tiles are not allowed -- they would make the problem trivial.\footnote{If one slightly modifies the rules of the game and requires complementary rather than matching colours for abutting edges, then the problem remains undecidable even if rotations and reflections are allowed.}

\begin{figure}[htbp]
  \centering
  \includegraphics[width=0.7\columnwidth]{Wang-tiles.pdf}
  \caption[Valid and invalid tilings.]{Examples of valid and invalid tilings (bottom) of a set of four Wang tiles (top).}\label{Wang-tiles}
\end{figure}

A tiling problem can easily be represented as a ground state energy problem for a \emph{classical} Hamiltonian (i.e. one that is diagonal in a product basis). The mapping is straightforward: with the identification $\mathcal{T}=\{1,\ldots,T\}$ we assign a Hilbert space $\cH^{(i)}\simeq\C^T$ to each site $i$ of a square lattice, and define the local interactions via
\begin{equation}
  h^{(i,j)} := \sum_{(m,n)\in C^{(i,j)}} \proj[(i)]{m}\ox\proj[(j)]{n},
\end{equation}
where the set of constraints $C^{(i,j)}\subseteq\mathcal{T}\times\mathcal{T}$ includes all pairs of tiles $(m,n)$ which are incompatible when placed on adjacent sites $i$ and $j$. As is standard in this context, we have used (and will be using throughout) Dirac notation. The overall Hamiltonian on the lattice $\Lambda(L)$ is then
\begin{equation}
  H_c^{\Lambda(L)} := \sum_{(i,j)\in\cal E} h_c^{(i,j)}.
\end{equation}
Undecidability of the ground state energy of $H_c$ with a promise gap of~1 now follows immediately from undecidability of tiling, and this gives undecidability of the ground state energy \emph{density} in the case of open boundary conditions. The full proof is described in \cref{sec:unbounded}.

However, there is a crucial and fundamental limitation to this approach: there is no upper-bound on the local dimension of the Hamiltonian. Rather, the local dimension grows with the number of tile types. And we cannot impose any bound on the latter, or else the tiling problem is restricted to a finite number of cases and is trivially decidable by case enumeration.

On the other hand, this does already allow us to prove a weaker form of our main result: undecidability of the spectral gap for families of Hamiltonians with no constraint on the local dimension. From the discussion in \cref{sec:undecidability}, this immediately implies existence of Hamiltonians for which the spectral gap is axiomatically independent, albeit Hamiltonians whose local dimension is arbitrarily large and unknown (in fact uncomputable). Furthermore, this approach can be extended to prove that \emph{any} low-energy property that distinguishes a Hamiltonian from a gapped system with unique product ground state is undecidable. \Cref{sec:unbounded} of the paper is devoted to proving these results.

Nonetheless, from a physical perspective e.g.\ of characterising the phase diagram of a system, it is unreasonable to allow the local Hilbert space dimension to grow arbitrarily large -- or indeed to change at all -- as the parameters of the Hamiltonian are varied. So we are still a long way from proving our main result.

Fundamentally, the problem is that the corresponding Hamiltonians are too simple. For a problem to be algorithmically undecidable, it must admit a countably infinite number of problem instances. If the local Hilbert space dimension is fixed, the Hamiltonian is completely specified by a finite number of matrix elements defining its local interactions. The only way to encode a countably infinite number of problem instances is to exploit the fact that the matrix elements themselves can take a countable infinity of values (e.g. arbitrarily precise rational numbers, or even computable numbers). Whereas the above tiling approach is only sensitive to the pattern of non-zero matrix elements.

To overcome this, we will need an inherently quantum approach, which is the topic of the next section.



\subsection{QMA constructions}
\label{sec:overview:QMA-constructions}
There is by now a standard approach to proving complexity-theoretic hardness results for local Hamiltonian problems. The idea, which dates back to Feynman~\cite{Feynman} and was significantly developed by Kitaev~\cite{Kitaev_book} and others~\cite{KKR,Oliveira-Terhal,AGIK,Gottesman-Irani}, is to construct a Hamiltonian whose ground state encodes the history of a quantum computation \emph{in superposition}. If we divide the system into two registers, a ``clock'' register and a ``computational'' register, then the desired ground state is
\begin{equation}
  \frac{1}{\sqrt{T+1}}\sum_{t=0}^T\ket{t}\ket{\psi_t},
\end{equation}
where $\ket{\psi_t}$ denotes the state of the computation after $t$ steps. This superposition over the history of a computation is often called a \keyword{computational history state}.

It is not difficult to construct a Hamiltonian with this as its unique ground state. The difficult part is to implement Feynman's idea using a \emph{local} Hamiltonian. This was first done by Kitaev~\cite{Kitaev_book}, who showed how to construct such a Hamiltonian out of 5-body terms. \textcite{KKR} improved this to 2-body, \textcite{Oliveira-Terhal} to nearest-neighbour two-qubit interactions on a 2D square lattice, and \textcite{AGIK} to nearest-neighbour two-body interactions on a line.

All of these constructions exploit the fact that the interactions can differ from site to site, in order to encode arbitrary computations. Indeed, for translationally-invariant nearest-neighbour interactions on a regular lattice, the entire Hamiltonian is specified by a finite number of two-body terms (and possibly one single-body term), and it might appear that there are not enough parameters available to encode arbitrary quantum computations. However, in a remarkable paper, \textcite{Gottesman-Irani} showed how to construct a translationally-invariant Hamiltonian which has as its ground state a computational history state for an arbitrary computation. (In fact, the two-body interaction in the \textcite{Gottesman-Irani} construction is the same \emph{fixed} interaction for \emph{all} problem instances. The input is specified by the only remaining free parameter: the length of the chain!)

The aim of all these local Hamiltonian constructions was to prove QMA-hardness of the finite-size ground state energy problem for the corresponding class of Hamiltonians, by encoding the quantum computation that verifies the witness for a QMA problem and adding a local term to the Hamiltonian that gives an additional energy penalty to the ``no'' output.
% but leave the input (witness) unconstrained. By adding a term to the Hamiltonian that gives an additional energy penalty if the witness verification outputs ``reject'', the ground state energy is higher if no valid witness exists for the problem instance (a ``no'' instance). Whereas if there does exist a valid witness (a ``yes'' instance), then there exists a computational history state starting from that witness as input, which avoids the additional energy penalty hence has lower energy.
% All known local Hamiltonian constructions inherently trade run-time against the size of the ``promise gap'' (the difference in energy between ``yes'' and ``no'' instances): the promise gap scales inverse-polynomially in the run-time of the encoded computation. Since the witness verification for a QMA problem is by definition a polynomial-time computation, the promise on the gap only needs to scale inverse-polynomially in the problem size for the local Hamiltonian problem to be QMA-hard.

An obvious approach to constructing a Hamiltonian with undecidable ground state energy is to use one of these local Hamiltonian constructions to encode the evolution of a universal (reversible or quantum) Turing Machine, instead of a QMA witness verifier, and give an additional energy penalty to the halting state. If we use the \textcite{Gottesman-Irani} construction, the resulting Hamiltonian will consist of translationally-invariant, nearest-neighbour interactions on a line. Since the Halting Problem is undecidable, and the ground state energy depends on whether or not the computation halts, the ground state energy of this Hamiltonian would seem to be undecidable.
% (This is similar to the argument given by \textcite{Lloyd} for why we should expect the spectrum of quantum Hamiltonians to be uncomputable in general.)
As in the tiling approach, this is certainly too weak to prove undecidability of the energy \emph{density}. But one might hope that it is sufficient to prove undecidability of the ground state energy.

However, this Feynman-Kitaev Hamiltonian approach does not even achieve the weaker result of the tiling approach. There are now two crucial problems:
\begin{enumerate}
\item \label{item:QMA_encoding_obstacle}
  The Halting Problem is undecidable for the universal Turing Machine on arbitrary input (or for an arbitrary Turing Machine running on fixed input). As in the tiling approach of the previous section, it is not at all clear how to encode this countably infinite family of problems into the constant number of matrix elements describing the nearest-neighbour interaction.

\item \label{item:QMA_gap_obstacle}
  The promise gap $\delta$ in all known local Hamiltonian constructions, and in particular the translationally-invariant construction of \cite{Gottesman-Irani}, scales inverse-polynomially in the system size. Thus (assuming the limits exist)
  \begin{equation}
    \begin{split}
     \lim_{L\to\infty}\lambda_0(H^{\Lambda(L)})
      &= \begin{cases}
           \lim_{L\to\infty} \alpha(L) & \mathrm{non-halting}\\
           \lim_{L\to\infty} \alpha(L) + \frac{1}{\poly(L)} & \mathrm{halting}\\
         \end{cases}\\
      &= \lim_{L\to\infty}\alpha(L).
    \end{split}
  \end{equation}
  I.e.\ the ground state energy in the thermodynamic limit is identical in both the halting and non-halting cases.
\end{enumerate}
These issues are inherent to the spectral gap problem for many-body quantum systems, where the question is only meaningful or interesting in the thermodynamic limit of Hamiltonians with regular structure (of which translational-invariance is the simplest case). Thus they cannot be side-stepped, and overcoming them is the main task in proving the result.

In the following section, we will see that overcoming~\labelcref{item:QMA_encoding_obstacle}, whilst challenging, can be achieved by exploiting the ability to encode \emph{quantum} computation. Indeed, this will essentially be the only quantum part of our construction.

However, \labelcref{item:QMA_gap_obstacle} presents a more serious obstacle to the history state approach. There is an inherent trade-off between run-time and promise gap in Kitaev-style local Hamiltonian constructions, and the run-time is directly related to the system size when the Hamiltonian is constrained to a lattice. But we are necessarily working in the thermodynamic limit of arbitrarily large lattice size. We therefore need a \emph{constant} promise gap, independent of the length of the computation. This cannot be achieved by any known local Hamiltonian construction, and may well be impossible. Without a constant gap between the halting and non-halting cases, the ground state energy problem becomes trivially decidable in the thermodynamic limit. We discuss how we overcome this obstacle in \cref{sec:overview:thermodynamic-limit}.



\subsection{Constant local dimension}
\label{sec:overview:constant-local-dimension}
To overcome the unbounded local dimension obstacle we faced in \cref{sec:overview:Wang-tiling,sec:overview:QMA-constructions}, we must find a way of encoding the countably infinite family of Halting Problem instances into the finite number of matrix elements describing the local interactions of a system with fixed local Hilbert space dimension.

If we encode the evolution of a quantum Turing Machine into the ground state of a local Hamiltonian using a Feynman-Kitaev-style construction, as described in the previous section, the local dimension will depend on the number of internal states and alphabet size of the QTM. Whichever universal Turing Machine we choose to encode, that particular TM will have a fixed state space and alphabet size. But to encode the Halting Problem, we need a way to feed any desired input to this encoded universal TM. It is not difficult to construct a special-purpose classical TM which outputs any given string, starting from a fixed input. But, exactly analogous to the Wang tiling constructions of \cref{sec:overview:Wang-tiling}, if there is no upper-bound on the number of different strings that we must be able to produce, then either the number of internal states or the alphabet size of the Turing Machine is necessarily unbounded. This is no use to us, as it would again lead to a family of Hamiltonians with unbounded local dimension.

The only way we can hope to generate arbitrarily long strings using constant alphabet size and a constant number of internal states is to use a genuinely quantum construction.\footnote{Indeed, this will essentially be the only point in our construction where we exploit the fact that the Hamiltonian is quantum.} The transition rules of a QTM can have arbitrarily computable numbers as coefficients. (In fact, algebraic numbers will suffice for our purposes.) So, whereas for given alphabet size and number of internal states there is only a finite number of different classical deterministic TMs, there are a countably infinite number of different QTMs. We will show how the string we want to produce can be encoded in the transition rule coefficients of a QTM, in such a way that the QTM writes out this string and then halts \emph{deterministically}.

At first sight, this might appear to violate the Busy Beaver bound on the run-time of a TM~\cite{busy-beaver}, or the Holevo bound on the amount of information that can be extracted from a finite-dimensional quantum state~\cite{Holevo_bound}, or other results that limit the amount of information that can be extracted from a finite-size system. However, a little more thought reveals there is no contradiction here.

Indeed, something similar is already possible for classical probabilistic Turing Machines. It is a straightforward exercise to construct a classical probabilistic TM with fixed alphabet and number of internal states which, given access to a coin with bias $p$, outputs the binary expansion of $p$ with high probability, in expected run-time that is a function of the length of the binary expansion. What is perhaps more surprising is that Quantum Turing Machines allow this to be done \emph{deterministically}.

The reason this does not violate the Busy Beaver theorem is that, to simulate a probabilistic or quantum TM on a deterministic TM, the alphabet and/or internal state size must grow with the precision of the entries in the probabilistic or quantum transition function.

Nor is there any contradiction with the Holevo bound. We are not encoding the string in a finite-dimensional quantum state, or even in multiple copies of a quantum state. We are encoding the string in the unitary transition rules of a QTM, which we get to apply as many times as we like on any quantum state we like. Applying the transition rules to a fixed quantum state and performing quantum state tomography would already allow us to extract the information encoded in the transition rules to arbitrary precision. Again, perhaps the only somewhat surprising aspect is that, by exploiting the full power of quantum computation, we can recover the encoded string \emph{exactly}, regardless of how long the string is.

The idea behind our construction is to use the quantum phase estimation algorithm~\cite{Nielsen+Chuang} (running on a QTM) to extract a phase which we encode in a single-qubit unitary, thereby writing out its binary expansion to the tape. However, for technical reasons that appear to be insurmountable, it is crucial to our proof that the phase estimation be carried out \emph{exactly}, not merely with high probability. Furthermore, the QTM should halt deterministically after a time that depends only on the input. Without these properties, the matrix elements of the Hamiltonians we construct will not be computable, and \cref{thm:promise} becomes vacuous.

It is well-known that the quantum phase estimation circuit can output the unknown phase $\varphi$ exactly if the phase has a finite binary decimal expansion (i.e.\ $\varphi = a/2^b$ for some $a,b\in\N$), given the appropriate set of two-qubit gates~\cite{Nielsen+Chuang}. The universal QTM construction of \textcite{Bernstein-Vazirani} shows that any quantum circuit can be implemented on a QTM. But this only implements a quantum circuit up to some error, not exactly. Indeed, it is not at all clear whether one can carry out exact phase estimation for arbitrary $\varphi$, even in principle, given that the precision of $\varphi$ can be arbitrarily high and is unknown to the quantum phase estimation circuit. (Indeed, a no-go result by \textcite{Ozawa} shows that no quantum Turing Machine can exactly simulate quantum phase estimation on an arbitrary number of qubits.)

We therefore cannot appeal to previous results to show that such a QTM exists. Instead, in \cref{sec:phase-estimation} we give a detailed and explicit construction of a phase-estimation QTM, that satisfies the very strict requirements of our spectral gap undecidability proof. It may seem as if we have achieved nothing, since now we have the problem of generating the correct input to the phase-estimation QTM! But in fact this is not an issue because, firstly, the input is encoded in unary, and generating a unary string is much simpler than generating an arbitrary string; and secondly, it does not matter if the upper-bound in the input is larger than the actual number of digits. Our phase-estimation QTM will still write out the phase exactly, and halt deterministically in this case. (The run-time of the QTM will depend on the size of the upper-bound, but run-time is not relevant here.) So we only need to generate a long string consisting entirely of the same symbol! This is very easy, especially when we come to encode this QTM into a local Hamiltonian.

However, it is important to note that, if the input upper-bound is wrong, so that the number of binary digits in the phase exceeds the number specified in the input, then the only guarantee is that the phase-estimation QTM eventually halts; it could leave an arbitrary string (or even quantum state) written to its tape.

In this way, if we supply the phase-estimation QTM with a suitable input and feed its output into a universal TM, the input on which the universal TM runs is entirely determined by the transition amplitudes of the phase-estimation QTM. Assuming the properties of the \textcite{Gottesman-Irani} construction carry over, the local Hilbert space dimension will be determined by the alphabet size and number of internal states of the QTMs, which is a constant \emph{independent of the input}. Since the alphabet size and number of internal states of any particular universal TM are clearly constant, the local Hilbert space dimension of the Hamiltonian encoding this sequence of Turing Machines will also be constant.




\subsection{Translational invariance}
\label{sec:overview:Gottesman-Irani}
\textcite{Gottesman-Irani} showed how to construct a \emph{fixed} Hamiltonian on a 1D chain, that can encode in its ground state the evolution of a QTM for a number of time-steps polynomial in the length $L$ of the chain. The input to the QTM in their construction is determined by the chain length. They accomplish this by first constructing a translationally-invariant clock to keep track of time, which runs for a total of $L$ steps. This clock drives a binary counter TM for $L$ steps, leaving the binary representation of $L$ written on the tape. The clock is then reset, and switches over to driving the QTM. The binary counting TM and the QTM share the same tape, so the input to the QTM is the binary representation of $L$. It is important to note that the local Hilbert space dimension in the \textcite{Gottesman-Irani} construction depends only on the alphabet size and number of internal states of the Turing Machines (plus some constant multiplicative overhead for the clock).

However, in our case we are interested in the thermodynamic limit. The \textcite{Gottesman-Irani} result per se does not achieve what we need. We cannot use the chain length to encode the input to the QTM, as we are only concerned with the limit as the length tends to infinity. Instead, we want to encode the input to the QTM in the Hamiltonian itself, and carry out the same computation for any chain length.\footnote{In their paper, \textcite{Gottesman-Irani} also provide a construction for infinitely long chains. However this works by adding terms to the Hamiltonian which effectively break up the chain into segments of length $L$, and the finite chain-length construction then goes through independently for each segment. This is also not what we want, as it means that, despite the infinitely long chain, there is still a finite bound $L$ on the space available for the computation.}

Given our quantum phase estimation QTM from the previous section, it is clear how we should adapt the \textcite{Gottesman-Irani} construction to achieve what we need. Instead of the binary counter TM, we first run our phase estimation QTM. Provided the chain length is sufficiently large that $L > \abs{n}$, the phase-estimation QTM will write the desired string to the tape and then halt. We then switch to driving a universal reversible TM which shares the same tape. % By adding a term to the Hamiltonian which gives an additional energy penalty to the halting state of this universal TM, we reduce the Halting Problem to the ground state energy problem of this Hamiltonian.

Whilst this approach does ultimately work, there are a number of technical issues to overcome. In particular, the length of the computation in the \textcite{Gottesman-Irani} construction is limited by the maximum number of time-steps that the clock can encode, which is $O(\poly L)$. Whereas our phase-estimation QTM will require time $O(\poly(L) 2^L)$ on input of length $L$. % One way around this would be to first use a binary counter TM to write out the length $L$ of the chain in binary (just as in \cite{Gottesman-Irani}), then compute $\log L$ and write out a string of $\log L$ 0's, being careful to ensure that this computation requires only $O(L)$ space and $O(\poly L)$ time. If we now run $P_n$ on this $\log L$ string, the $\poly(L) \geq \poly(\log L)2^{\log L}$ clock steps at our disposal will be sufficient to complete the $P_n$ computation.
%However, a simpler
There are a number of ways around this. Perhaps the simplest -- and the one we adopt -- is to modify the \textcite{Gottesman-Irani} clock construction to count in binary instead of unary, so that the clock can encode at least $\Omega(2^L)$ time-steps. However, this substantially complicates the analysis. We also have to address a subtle but important unitarity issue in order to carry out the required spectral analysis of our Hamiltonian.

We give a complete, self-contained construction in \cref{sec:local-Hamiltonians}, heavily inspired by \textcite{Gottesman-Irani}, together with a rigorous proof of the required spectral properties of the resulting Hamiltonian.\footnote{For this, we prove a general version of the ``Clairvoyance Lemma'', which has been used in a number of QMA-hardness proofs in the literature but never formally stated or rigorously proven. This may be of independent interest to Hamiltonian complexity theorists.}

This construction, together with the constant size phase-estimation quantum Turing Machine from \cref{sec:overview:constant-local-dimension}, allows us to construct a family of translationally-invariant 1D local Hamiltonians with \emph{constant} local Hilbert space dimension, whose ground states encode the evolution of a universal Turing Machine running on an input encoded solely into matrix elements of the Hamiltonian. Supplying an appropriate unary input to the phase-estimation QTM (see \cref{sec:overview:constant-local-dimension}) can be done simply by adding local terms to the Hamiltonian that force the all the qubits in the initial state of the computational history superposition to be in the $\ket{1}$ state.

Thus we have succeeded in overcoming the constant local dimension obstacle of the QMA constructions discussed above in \cref{sec:overview:QMA-constructions}. However, simply adding a local term to this Hamiltonian that gives an additional energy penalty to the halting state does not work, for the reasons discussed in \cref{sec:overview:QMA-constructions}: the energy difference between the halting and non-halting cases decreases polynomially with the system size. So all dependence of the ground state energy on the outcome of the computation still vanishes in the thermodynamic limit.




\subsection{The thermodynamic limit}\label{sec:overview:thermodynamic-limit}
The more challenging obstacle of the thermodynamic limit still remains.

We first return to tiling problems. However, instead of using these blindly, as in the Wang tiling approach described in \cref{sec:overview:Wang-tiling} where only undecidability of tiling was used, we prove and then exploit very particular properties of an aperiodic tiling due to \textcite{Robinson}. These will allow us, using the ideas discussed in \cref{sec:overview:constant-local-dimension} and \cref{sec:overview:Gottesman-Irani}, to encode in a quantum local Hamiltonian the \emph{parallel} execution of the \emph{same} universal Turing Machine running on the same chosen input, but running on tapes of all possible finite lengths and for every possible finite run-time.

The idea of encoding the parallel evolution of the same Turing Machine on tapes of all possible finite lengths, instead of encoding the evolution of a single Turing Machine on an infinite tape, dates back to \posscite{Berger} original proof of undecidability of tiling. \textcite{Robinson} also used the same idea in his simplification of Berger's proof. However, our reason for exploiting this idea is somewhat different. In our case, it is the crucial ingredient that allows us to decouple the energy dependence of the computational history ground state -- a purely quantum property -- from the overall system size.

The Robinson tile set \emph{can} tile the infinite plane, but only aperiodically. The aperiodic pattern generated by a Robinson tiling is shown in \cref{fig:tiling}. We have already seen in \cref{sec:overview:Wang-tiling} that tiling problems can easily be turned into translationally-invariant classical Hamiltonians. So we can readily turn this into a classical tiling Hamiltonian whose ground state has the same quasi-periodic structure as the Robinson tiling. The idea is to add another ``layer'' on top of this tiling Hamiltonian, and use this second ``quantum'' layer to place copies of the Hamiltonian from the previous section along the borders of all the squares in \cref{fig:tiling}. (Of course, this has to be done by adding additional translationally-invariant local terms to the Hamiltonian that effectively restrict where the 1D Hamiltonian acts, not by literally restricting the 1D Hamiltonian to the square borders, which would break translational-invariance.)

In this way, we construct a 2D translationally-invariant local Hamiltonian whose ground state contains an encoding of the evolution of the universal Turing Machine along \emph{each} edge of the squares in the Robinson tiling. The effective tape length of this Turing Machine is limited only by the size of the border it ``runs'' on. But the Robinson tiling contains borders of all finite sizes.\footnote{Actually, all powers of 4, but this makes no difference to the argument.} So this Hamiltonian encodes Turing Machines with all possible tape lengths. All of these Turing Machines are running on the same input, encoded in matrix elements of the translationally-invariant local interaction.

If the universal Turing Machine eventually halts on this input, then for all borders above a certain size, the effective tape will be sufficiently long for the machine to halt before it runs out of tape space. If we add a translationally-invariant local term that penalises the halting state, then the ground state will pick up an additional energy from the history states encoding Turing Machines that halt. This energy still decreases with the size of the system it acts on. But, crucially, this size is now the size of the border it is ``running'' on, \emph{not} the overall system size. We have decoupled the ground state energy from the overall system size; it now depends only on the space required for the universal TM to halt.

If the universal Turing Machine never halts on this input, then it will not pick up any additional energy, providing the tape is sufficiently long for the phase-estimation QTM to operate correctly. However, if the effective tape length (border size) is too small to contain a valid upper-bound on the number of digits in the phase, then the quantum state left on the tape by the phase-estimation QTM is arbitrary (see \cref{sec:overview:constant-local-dimension}). In this case, we cannot assume that the universal Turing Machine runs forever, since its input may be corrupted. Thus, even in the non-halting case, the ground state will pick up some additional energy from borders that are too small. But, crucially, we know the maximum size of these borders: it is determined by the number of binary digits in the phase encoded in the matrix elements of the Hamiltonian, \emph{which we chose}. The energy contribution from the small borders is therefore a computable number, e.g.\ brute-force diagonalisation of the Hamiltonian on the small borders. Indeed, since this is an eigenvalue computation, this quantity is even an algebraic number. The number of borders of any given size grows quadratically in the lattice size, so the total energy contribution from the small borders can be removed by subtracting an appropriately weighted $\id$ term from the Hamiltonian.

We have managed to construct a family of Hamiltonians whose ground state energies depend on the solution of the corresponding Halting Problem. However, this is still not sufficient to prove \cref{thm:gs_density} and hence prove \cref{thm:promise}. The difference in energy between the halting and non-halting cases (the ``promise gap'') depends inverse-polynomially on the space required for the universal Turing Machine to halt. Thus, not only does this fail to provide a uniform bound on the promise gap as required, this promise gap is uncomputable.

In fact, this is a limitation of the above analysis, not the true situation. Instead of being uncomputably small, as the above argument suggests, the true promise gap for this Hamiltonian is infinite! To show this requires a more careful analysis of the low-lying eigenvalues (low-energy excitations). It is easy to see that the eigenstate consisting of a valid tiling together with computational history states along the borders has energy that diverges with the lattice size in the halting case; once the lattice is large enough, the number of borders that are sufficiently large for the encoded Turing Machine to halt grows quadratically, and each of them contributes a small but non-zero energy.

The difficulty is that, since its energy diverges, this eigenstate cannot be the ground state in the halting case; we can lower the energy by ``breaking'' some of the Turing Machines, by introducing defects in the tiling layer. In \cref{sec:quasi-periodic}, we prove strong rigidity properties of the Robinson tiling, which show that the tiling pattern is robust against defects: any defect (non-matching adjacent tiles) in the tiling only affects the pattern of borders in a finite ball around the defect. Thus destroying $n$ borders requires $O(n)$ defects, each defect contributes $O(1)$ energy, and Turing Machines on intact borders contribute $O(1)$ energy. Thus, no matter how many defects we introduce, the energy will still grow quadratically with the lattice size. The promise gap therefore diverges quadratically in the thermodynamic limit. Thus we in fact obtain a stronger result than the uniform bound on the promise gap required for our main result; since the ground state energy diverges quadratically, and our system is on a 2D lattice, this in fact proves undecidability of the ground state energy \emph{density}, as claimed in \cref{thm:gs_density}.

Making this argument rigorous is somewhat involved, and is the content of \cref{sec:gs-energy}. \Cref{sec:spectral-gap} then combines this result with any frustration-free gapless quantum Hamiltonian (of which there are many well-known examples) to complete the proof of our main result, \cref{thm:promise}: undecidability of the spectral gap for 2D translationally-invariant Hamiltonians with fixed finite local Hilbert space dimension and local interactions specified by algebraic matrix elements, even when the Hamiltonians are guaranteed to be either gapped with a spectral gap uniformly lower-bounded by the local interaction strength (\cref{def:gapped}), or gapless with continuous spectrum above the ground state (\cref{def:gapless}).




\subsection{Structure of the paper}
We warm up in \cref{sec:unbounded} by giving a complete proof of the weaker but substantially easier undecidability result for the spectral gap of families of Hamiltonians with unbounded local Hilbert space dimension. We also extend this to prove undecidability of essentially all low-energy properties of quantum many-body Hamiltonians.

The bulk of the paper is concerned with proving our main result: undecidability of the spectral gap for Hamiltonians with fixed local dimension. The proof is broken down into several stages, each described in a separate section. Each of these sections is self-contained, in the sense that only the main theorem of the section is needed in subsequent sections.\footnote{Except in the case of \cref{sec:quasi-periodic}, which collects a number of new results on rigidity of the Robinson tiling, needed in subsequent sections.} Proofs in any individual section can therefore be skipped on a first reading, as long as the main result of the section is provisionally accepted.

In \cref{sec:phase-estimation}, we give an explicit construction of an exact quantum phase estimation Turing machine, which will be crucial to achieving constant local dimension. In \cref{sec:local-Hamiltonians} we describe a modification of the \textcite{Gottesman-Irani} encoding of a quantum Turing machine in a 1D, local, translationally-invariant Hamiltonian. \Cref{sec:quasi-periodic} contains the analysis of the rigidity of the Robinson quasi-periodic tiling, which will allow us to achieve the required spectral properties.

With this machinery in place, \cref{sec:put-together} proves our main result. This is divided into two steps. As discussed in \cref{sec:extended-overview}, the first step is to prove undecidability of the ground state energy density problem, which we do in \cref{sec:gs-energy}, making use of all the results from the previous sections. The second step, in \cref{sec:spectral-gap}, reduces the ground state energy density problem to the spectral gap problem, completing the proof of our main result. \Cref{sec:periodic_bc} extends these results to periodic boundary conditions.

% We finish in \cref{sec:conclusions} with a discussion of the implications and open questions raised by undecidability of the spectral gap.



%%% Local Variables:
%%% mode: latex
%%% mode: visual-line
%%% mode: adaptive-wrap-prefix
%%% fill-column: 999999
%%% TeX-master: "spectral-gap"
%%% End:

%  LocalWords:  Kitaev QMA Gottesman Irani KKR Oliveira Terhal AGIK QTM TMs QTMs Holevo Vazirani Ozawa

phase-estimation.tex
\section{Quantum Phase Estimation Turing Machine}
\label{sec:phase-estimation}
We will see in \cref{sec:local-Hamiltonians} how to encode an arbitrary Quantum Turing Machine (QTM) into a translationally-invariant nearest-neighbour Hamiltonian, in such a way that the local Hilbert space dimension is a function only of the alphabet size and number of internal states. This will allow us to encode any specific universal (reversible) Turing Machine in a Hamiltonian with fixed local dimension. However, to prove undecidability by reduction from the Halting Problem, we will need a way to feed any desired input to this universal TM.

to this end, the main result of this section is to construct a family of quantum Turing Machines, all of which have the same alphabet size and number of internal states, but whose transition rules vary. For any given string, we can choose the transition rules such that the QTM, when started from the empty input, writes out the string to its tape and then halts deterministically.

More precisely, we will prove the following result (see below for the necessarily basic definitions, notations, and facts about QTMs).
%
\begin{theorem}[Phase-estimation QTM]
  \label{phase-estimation_QTM}
  There exists a family of well-formed, normal form, unidirectional QTMs $P_n$ indexed by $n\in\N$ with the following properties:
  \begin{enumerate}
  \item \label[part]{phase-estimation_QTM:fixed_size}%
    Both the alphabet and the set of internal states are identical for all $P_n$; only the transition rules differ.

  \item \label[part]{phase-estimation_QTM:output}%
    On input $N\geq\abs{n}$ written in unary, $P_n$ behaves properly, halts deterministically after $O(\poly(N) 2^N)$ steps, uses $N+3$ space, and outputs the binary expansion of $n$ (padded to $N$ digits with leading 0's). (Here, $\abs{n}$ denotes length of the binary expansion of $n$.)

  \item \label[part]{phase-estimation_QTM:amplitudes}%
    For each choice of states $p,q$, alphabet symbols $ \sigma, \tau$ and directions $D$, the transition amplitude $\delta(p,\sigma,\tau,q,D)$ is, independently of $n$, one of the elements of the set
    \begin{equation}
      \left\{0,1,\pm \frac{1}{\sqrt{2}},e^{i\pi\varphi}, e^{i\pi 2^{-\abs{\varphi}}}\right\}
    \end{equation}
    where $\varphi\in\Q$.
  \end{enumerate}

  \Cref{phase-estimation_QTM:amplitudes} implies that the only dependence of the transition rules of $P_n$ on $n$ is that implicit in $\varphi$, which is defined as the rational number whose binary decimal expansion contains the digits of $n$ in reverse order after the decimal.
\end{theorem}
%
Note that the input $N$ does \emph{not} determine the output string that gets written to the tape; it only determines the number of binary digits in the output. The number represented by that output is determined (up to padding with leading zeros) by the choice of the parameter $n$ for the QTM $P_n$.

\Cref{phase-estimation_QTM} is essentially the only inherently quantum ingredient in our result, and the precise properties asserted there will be \emph{absolutely crucial} to the proof. For example, if instead of writing out the string and halting deterministically, the QTM did this only with arbitrarily high probability, our proof would not go through.

It is therefore not at all clear a priori whether QTMs fulfilling these strict requirements exist. Since our proof depends so delicately on the precise properties of these QTMs, we cannot appeal to previous results. Instead, in this section we give a detailed and explicit construction of a QTM based on the quantum phase estimation algorithm, that fulfils all the requirements of \cref{phase-estimation_QTM}.



\subsection{Quantum Turing Machinery}
For completeness we quote the basic definitions of Turing Machines and Quantum Turing Machines verbatim from \cite{Bernstein-Vazirani}.

\begin{definition*}[Turing Machine -- Definition~3.2
                    in~\cite{Bernstein-Vazirani}] \hfill\newline
  \addtheoremline{definition}{Turing Machine}
  \label{def:TM}
  A (deterministic) Turing Machine (TM) is defined by a triplet $(\Sigma, Q, \delta)$ where $\Sigma$ is a finite alphabet with an identified blank symbol $\#$, $Q$ is a finite set of states with an identified initial state $q_0$ and final state $q_f\not = q_0$, and $\delta$ -- the transition function -- is a function
  \begin{equation}
    \delta: Q\times \Sigma \rightarrow \Sigma\times Q\times \{L,R\}.
  \end{equation}
  The TM has a two-way infinite tape of cells indexed by $\Z$ and a single read/write tape head that moves along the tape.
  A \keyword{configuration} of the TM is a complete description of the contents of the tape, the location of the tape head and the state $q\in Q$ of the finite control. At any time, only a finite number of the tape cells may contain non-blank symbols.

  For any configuration $c$ of the TM, the successor configuration $c'$ is defined by applying the transition function to the current state and the symbol scanned by the head, replacing them by those specified in the transition function and moving the head left (L) or right (R) according to $\delta$.

  By convention, the initial configuration satisfies the following conditions: the head is in cell $0$, called the \keyword{starting cell}, and the machine is in state $q_0$. We say that an initial configuration has \keyword{input} $x\in (\Sigma\backslash\{\#\})^*$ if $x$ is written on the tape in positions $0,1,2,\cdots$ and all other tape cells are blank. The TM halts on input $x$ if it eventually enters the final state $q_f$. The number of steps a TM takes to halt on input $x$ is its running time on input $x$. If a TM halts, then its output is the string in $\Sigma^*$ consisting of those tape contents from the leftmost non-blank symbol to the rightmost non-blank symbol, or the empty string if the entire tape is blank. A TM is called \keyword{reversible} if each configuration has at most one predecessor.
\end{definition*}


Let $\tilde{\C}$ be the set consisting of $\alpha$ such that there is a deterministic algorithm that computes the real and imaginary parts of $\alpha$ to within $2^{-n}$ in time polynomial in $n$.

\begin{definition*}[Quantum Turing Machine -- Definition~3.2
                    in~\cite{Bernstein-Vazirani}] \hfill\newline
  \addtheoremline{definition}{Quantum Turing Machine}
  \label{def:QTM}
  A quantum Turing Machine (QTM) is defined by a triplet $(\Sigma, Q, \delta)$ where $\Sigma$ is a finite alphabet with an identified blank symbol $\#$, $Q$ is a finite set of states with an identified initial state $q_0$ and final state $q_f\neq q_0$, and $\delta$ -- the quantum transition function -- is a function
  \begin{equation}
    \delta: Q\times \Sigma \rightarrow \tilde{\C}^{\Sigma\times Q\times \{L,R\}}.
  \end{equation}
  The QTM has a two-way infinite tape of cells indexed by $\Z$ and a single read/write tape head that moves along the tape. We define configurations, initial configurations and final configurations exactly as for deterministic TMs.

  Let $\mathcal{S}$ be the inner-product space of finite complex linear combinations of configurations of $M$ with the Euclidean norm. We call each element $\phi\in \mathcal{S}$ a superposition of $M$. The QTM $M$ defines a linear operator $U_M: \mathcal{S}\rightarrow\mathcal{S}$, called the time evolution operator of $M$, as follows: if $M$ starts in configuration $c$ with current state $p$ and scanned symbol $\sigma$, then after one step $M$ will be in superposition of configurations $\psi=\sum_i\alpha_ic_i$, where each nonzero $\alpha_i$ corresponds to the amplitude $\delta(p,\sigma,\tau,q,d)$ of $\ket{\tau}\ket{q}\ket{d}$ in the transition $\delta(p,\sigma)$ and $c_i$ is the new configuration obtained by writing $\tau$, changing the internal state to $q$ and moving the head in the direction of $d$. Extending this map to the entire $\mathcal{S}$ through linearity gives the linear time evolution operator $U_M$.
\end{definition*}

Here, for convenience of programming, we will consider \emph{generalised} TMs and QTMs in which the head can also stay still ({\bf N}o-movement), as well as move {\bf L}eft or {\bf R}ight.

\begin{definition}[Generalised TM and QTM]
  A generalised TM or generalised QTM is defined exactly as a standard TM (\cref{def:TM}) or standard QTM (\cref{def:QTM}) except that the set of head movement directions is $\{L,R,N\}$ instead of just $\{L,R\}$.
\end{definition}


Following \textcite{Bernstein-Vazirani}, we define various classes of deterministic and quantum Turing Machines:

\begin{definition*}[Well-formed -- Definition~3.3
                   in~\cite{Bernstein-Vazirani}] \hfill\newline
  \addtheoremline{definition}{Well-formed QTM}
  We say that a QTM is \keyword{well-formed} if its time evolution operator is an isometry, that is, it preserves the Euclidean norm.
\end{definition*}

It is easy to see (Theorem~4.2 in~\cite{Bernstein-Vazirani}) that any reversible TM is also a well-formed QTM where the quantum transition function $\delta(p,\sigma, q,\tau, d)=1$ if $\delta(p,\sigma)=(q,\tau,d)$ for the reversible TM and $0$ otherwise.

%\begin{definition*}[Well-behaved; Stationary -- Definition~3.2 in
%                   \cite{Bernstein-Vazirani}] \hfill\newline
%\addtheoremline{definition}{Well-behaved and Stationary QTMs}
% We say that a QTM is \keyword{well-behaved} if it halts on all input strings in final superposition where each configuration has the tape head in the same cell. If %this cell is always the start cell, we call the machine \keyword{stationary}. Similarly, we say a deterministic TM is stationary if it halts on all inputs with its tape head %back in the start cell.
%\end{definition*}


\begin{definition*}[Normal form -- Definition~3.13
                    in~\cite{Bernstein-Vazirani}]
  \addtheoremline{definition}{Normal form QTM}
  \label{def:normal-form} \hfill\newline
  A well-formed QTM or reversible TM $M = (\Sigma,Q,\delta)$ is in \keyword{normal form} if
  \begin{equation}
    \forall\sigma\in\Sigma \quad
      \delta(q_f,\sigma) = \ket{\sigma}\ket{q_0}\ket{N}.
  \end{equation}
\end{definition*}

In \cite{Bernstein-Vazirani} the normal-form condition is $\delta(q_f,\sigma) = \ket{\sigma}\ket{q_0}\ket{R}$. However, the choice of final direction is just an arbitrary convention, since the machine already halted and never carries out those transitions. We replace $R$ with $N$ in the definition for technical reasons (see the Reversal \cref{reversal}, below).


There is a specific class of QTMs, called \keyword{unidirectional}, that play an important role in the general theory developed by \textcite{Bernstein-Vazirani}.

\begin{definition*}[Unidirectional -- Definition~3.14
                    in~\cite{Bernstein-Vazirani}]
  \addtheoremline{definition}{Unidirectional QTM}
  \label{unidirectional} \hfill\newline
  A QTM $M = (\Sigma,Q,\delta))$ is \keyword{unidirectional} if each state can be entered from only one direction. In other words, if $\delta(p_1, \sigma_1, \tau_1, q, d_1)$ and $\delta(p_2, \sigma_2, \tau_2, q, d_2)$ are both non-zero, then $d_1$ = $d_2$.
\end{definition*}

Note that in a unidirectional QTM, the direction component in any transition rule triple $\ket{\tau}\ket{q}\ket{D}$ is fully determined by the state $\ket{q}$. Thus we can recover the complete transition rules from the $\ket{\sigma}\ket{q}$ components alone, without the direction component. We call these the \keyword{reduced transition rules}, $\delta_r: Q\times\Sigma \mapsto \C^{Q\times\Sigma}$. (Equivalently, there exists an isometry $V:\C^Q\mapsto\C^{Q\times\{L,R,N\}}$ that maps the reduced transition rules to the original transition rules: $V\delta_r(p,\tau) = \delta(p,\tau)$.)


The following theorem gives necessary and sufficient conditions for a (partial) transition function to define a reversible Turing Machine.

\begin{theorem*}[Local well-formedness -- Thm.~B.1 and Cor.~B.3
                 in~\cite{Bernstein-Vazirani}]
  \addtheoremline{theorem}{Local well-formedness}
  \label{reversible_transitions} \hfill\newline
  A  TM $M$ is reversible iff its transition function satisfies the following conditions:
  \begin{description}[font=\normalfont\it,style=nextline]
  \item[Unidirection]
    Each state of $M$ can be entered while moving in only one direction. In other words, if $\delta(p_1,\sigma_1) = (\tau_1, q, d_1)$ and $\delta(p_2,\sigma_2) = (\tau_2, q, d_2)$ then $d_1 = d_2$.
  \item[One-to-one]
    The transition function is one-to-one when direction is ignored.
  \end{description}
  Furthermore, a partial transition function satisfying these conditions can always be completed to the transition function of a reversible TM.
\end{theorem*}


\textcite{Bernstein-Vazirani} proved that one can w.l.o.g.\ restrict to \keyword{unidirectional} QTMs. We therefore restrict the following quantum analogue of \cref{reversible_transitions} to the unidirectional case:

\begin{theorem}[Quantum local well-formedness]
  \label{QTM_transitions} \hfill\newline
  A unidirectional QTM $M=(\Sigma,Q,\delta)$ is well-formed iff its quantum transition function $\delta$ satisfies the following conditions:
  \begin{description}[font=\normalfont\it]
    \begin{subequations}
    \item[Normalisation]
      \begin{equation}
        \forall p,\sigma \in Q\times\Sigma \quad \norm{\delta(p,\sigma)} = 1.
      \end{equation}
    \item[Orthogonality]
      \begin{equation}
        \forall (p_1,\sigma_1) \neq (p_2,\sigma_2) \in Q\times\Sigma \quad
        \left\langle\delta_r(p_1,\sigma_1),\delta_r(p_2,\sigma_2)\right\rangle = 0.
      \end{equation}
    % \item[Separability]
    %   \begin{equation}
    %     \forall (p_1,\sigma_1,\tau_1),(p_2,\sigma_2,\tau_2) \in
    %     Q\times\Sigma\times\Sigma \quad
    %     \langle\delta(p_1,\sigma_1\vert\tau_1,L),
    %     \delta(p_2,\sigma_2\vert\tau_2,R)\rangle = 0,
    %   \end{equation}
    %   where $\delta(p,\sigma|\tau,D) := \sum_{q\in Q} \delta(p,\sigma,\tau,q,D) \ket{q}$.
    \end{subequations}
  \end{description}
  Furthermore, a partial quantum transition function satisfying these conditions can always be completed to a well-formed transition function.
\end{theorem}

\textcite{Bernstein-Vazirani} proved this result for standard QTMs, that is, where the head must move left or right in each time step. (In fact, they prove it without the restriction to unidirectional QTMs; see Theorem~5.2.2 and Lemma~5.3.4 in \cite{Bernstein-Vazirani}.) We therefore extend the proof of \cref{QTM_transitions} to generalised QTM, which is not difficult -- indeed, it is made particularly straightforward by our restriction to unidirectional machines.

\begin{proof}[of \cref{QTM_transitions}]
  Let $U$ be the time evolution operator of the QTM $M$. By definition $M$ is well-formed iff  $U$ is an isometry, or equivalently iff the columns of $U$ have unit length and are mutually orthogonal. Clearly, the normalisation condition specifies exactly that each column has unit length.

  Pairs of configurations whose tapes differ in a cell not under either of the heads, or whose tape heads are more than two cells apart, cannot yield the same configuration in a single time step. Therefore, all such pairs of columns are guaranteed to be orthogonal. The orthogonality condition imposes orthogonality of pairs of columns for configurations that differ only in that one is in state $p_1$ reading $\sigma_1$ while the other is in state $p_2$ reading $\sigma_2$.

  It remains to consider pairs of configurations whose heads are one or two cells apart, differing at most in the symbol written in these cells and in their states. However, unidirectionality implies that any update triples that share the same state must share the same direction. Thus either the state or the head location necessarily differs for all such pairs of columns, hence these too are orthogonal.

  The final claim follows straightforwardly from the fact that the normalisation and orthogonality conditions imply that a partial unidirectional reduced transition function $\delta_r$ is well-formed iff it defines an isometry on the space of states and tape symbols, and this can always be extended to a unitary. This fills in the undefined entries of $\delta_r$ by extending $\delta_r(q,\sigma)$ to an orthonormal basis for the space of states and symbols.
\end{proof}


We will often only be interested in the behaviour of a QTM (or reversible TM) on a particular subset of inputs, since the machine will only be run on those. A \keyword{proper} machine is guaranteed to behave appropriately on some subset of inputs, but not necessarily on all possible inputs.

\begin{definition}[Proper QTM]
  \label{def:proper_QTM}
  A QTM behaves \keyword{properly} (or is \emph{proper}) on a subset $\mathcal{X}$ of initial superpositions if whenever initialised in $\phi \in \mathcal{X}$, the QTM halts in a final superposition where each configuration has the tape head in the start cell\footnote{This property is called \keyword{stationarity} in \cite{Bernstein-Vazirani}}, the head never moved to the left of the starting cell, and the QTM never enters a configuration in which the head is in a superposition of different locations. We will refer to this latter property as {\it deterministic head movement}.

  Similarly, we say that a deterministic TM behaves properly (or is proper) on $\mathcal{X}\subset (\Sigma\backslash\{\#\})^*$ if the head never moves to the left of the starting cell, and it halts on every input $x\in \mathcal{X}$ with its tape head back in the starting cell.
\end{definition}
%
When the set $\mathcal{X}$ is clear from the context, we will omit it.

Note that, for a QTM to have deterministic head movement, it is \emph{not} sufficient that none of its transition rules $\delta(\sigma,\tau)$ produce a superposition of head directions. The head can also end up in a superposition of different locations because the tape state is in a superposition, so that two transition rules with different deterministic head movement apply in superposition.

Behaving properly is not a severe restriction on classical Turing Machines.\footnote{Nor is it a severe restriction on QTMs, but we will not need or prove this here.} In fact, given any TM, there is always an equivalent proper TM that computes the same function. One way to see this is to recall that all computable functions are computable by Turing Machines restricted to one-way infinite tapes (see any standard text book on the theory of computation, e.g.\ \textcite{Kozen_book}), and these clearly behave properly if the tape is extended to be two-way infinite. (Returning the head to the starting cell at the end of the computation poses no great difficulty.) In particular, this means that there exist proper universal Turing Machines.

Quantum Turing Machines were originally defined in \textcite{Bernstein-Vazirani} to have two-way infinite tapes. Indeed, those authors point out that there are trivial well-formed machines (such as the always-move-right machine) whose evolution would not be unitary on a one-way infinite tape, since the starting configuration would have no predecessor. However, when we come to encode our QTMs into local Hamiltonians, we will only be able to simulate tapes with a boundary.\footnote{Effectively, we can only encode quantum bounded linear automata rather than QTMs, though there is no limit on the finite tape length we can encode.} To avoid technical issues, we follow \textcite{Bernstein-Vazirani} in defining QTMs on two-way infinite tapes, but we will ensure that none of the QTMs (or reversible TMs) that we construct ever move their head before the starting cell. Thus, when encoding the QTM in a Hamiltonian, we can ignore all of the tape to the left of the starting cell.

In fact, the local Hamiltonians encoding the QTMs will only be able to simulate the evolution on a finite (but arbitrarily large) section of tape. We will therefore be interested in keeping very tight control on the space requirements of all the reversible and quantum TMs that we construct. By carefully controlling the space overhead, it will then be sufficient for our purposes to simulate the evolution of the QTM on a finite portion of tape that is essentially no longer than the input.



\subsubsection{Turing Machine Programming}
For a multi-track Turing machine with $k$ tracks and alphabet $\Sigma_i$ on track $i$, we will denote the contents of a tape cell by a tuple of symbols $[\sigma_1,\sigma_2,\dot\sigma,\sigma_k] \in \Sigma_1\times\Sigma_2\times\dots\times\Sigma_k$ specifying the symbol written on each track. Similarly, the configuration of the tape will be specified by a tuple $[c_1,c_2,\dots,c_n] \in \Sigma_1^*\times\Sigma_2^*\times\dots\times\Sigma_k^*$, where by convention all $c_i$ are aligned to start in the same cell (which will be the starting cell unless otherwise specified). We will use $\wc$ to stand for an arbitrary track symbol. We will often describe Turing machines that act only on a subset of tracks, and leave the contents of all other tracks alone. In this case, we will only write out the states of the acted-upon tracks in the transition function; this transition function should be understood to be extended to the remaining tracks in the obvious way.

As a shorthand, a transition rule on a tuple containing a $\wc$ on one or more tracks should be understood to stand for the set of transition rules that leave the tracks marked $\wc$ unchanged, and act as indicated on the remaining tracks. We will often only specify some of the elements of a transition function when defining a reversible or quantum TM. We will call such partial transition functions ``well-formed'' if the elements that \emph{are} defined satisfy the conditions of \cref{reversible_transitions} or \cref{QTM_transitions}, since by those \lcnamecrefs{QTM_transitions} this is sufficient to guarantee that the partial transition functions can be completed to well-formed transition functions. QTM (or reversible TM) will sometimes use a finite number of auxiliary tracks. These are assumed always to start and finish in the all blank configuration.


We will have frequent recourse to the following basic TM and QTM programming primitives from \textcite{Bernstein-Vazirani}, which we slightly generalise here to account for additional properties of the resulting QTMs that will be important to us later. These primitives allow different QTMs to be combined in various ways to build up a more complex QTM.


\begin{lemma}[Subroutine Lemma] \hfill\newline
  \label{subroutine}
  Let $M_1$ be a two-track, normal form, reversible TM and $M_2$ a two-track normal form reversible TM (or well-formed, normal form, unidirectional QTM) with the same alphabet and the following properties:
  \begin{enumerate}
  \item $M_1$ is proper on initial configurations in $\mathcal{X}_1$ and $M_2$ is  proper on $\mathcal{X}_2$.
  \item When started on $\mathcal{X}_1$, $M_1$ leaves the second track untouched and when started on $\mathcal{X}_2$, $M_2$ leaves the first track untouched.
  \item There is a state $q$ on $M_1$ that, when started on $\mathcal{X}_1$, can only be entered with the head in the starting cell.
  \item $\mathcal{X}_2$ contains all the output superpositions (with $q_f$ replaced by $q_0$) of $k$ consecutive executions of $M_2$ started from an initial configuration in $\mathcal{X}_1$ for all $0\le k\le r$, where $r\in \N\cup\{\infty\}$ is the maximum number of times that $q$ is entered when $M_1$ runs on input in $\mathcal{X}_1$.
  \end{enumerate}
  Then there is a normal form, reversible TM (or well-formed, normal form, unidirectional QTM) $M$ which behaves properly on $\mathcal{X}_1$ and acts as  $M_1$ except that each time it would enter state $q$, it instead runs machine $M_2$.
  \end{lemma}
\begin{proof}
  Exactly as Lemma~4.8 in \cite{Bernstein-Vazirani}.
\end{proof}


\begin{lemma}[Dovetailing Lemma]
  \label{dovetailing}
  Let $M_1$ and $M_2$ be well-formed normal form unidirectional QTMs (resp.\ normal form reversible TMs) with the same alphabet, so that $M_1$ is proper on $\mathcal{X}_1$, $M_2$ is proper on $\mathcal{X}_2$ and $\mathcal{X}_2$ contains all final superpositions (resp.\ configurations) of $M_1$ started on $\mathcal{X}_1$. Then, there is a well-formed normal form unidirectional QTM (resp.\ normal form reversible TM) $M$ which carries out the computation of $M_1$ followed by the computation of $M_2$ and that is also proper on $\mathcal{X}_1$.
  \end{lemma}
\begin{proof}
 Exactly as Lemma~4.9 in \cite{Bernstein-Vazirani}.
\end{proof}


\begin{lemma}[Reversal Lemma]
  \label{reversal}
  If $M$ is a well-formed, normal form, unidirectional QTM (resp.\ normal form reversible TM) then there is a well formed, normal form, unidirectional QTM (resp.\ normal form reversible TM) $M^\dg$ that reverses the computation of $M$ while taking two extra time steps and using the same amount of space. Moreover, if $M$ is proper on $\mathcal{X}$, then $M^\dg$ is proper on the set of final superpositions (resp.\ configurations) of $M$ started on $\mathcal{X}$.
\end{lemma}

\begin{proof}
  The proof is very similar to that of Lemma~4.12 in \cite{Bernstein-Vazirani}. We will prove it for QTMs, since reversible TMs are a special case of these. Consider an initial superposition $\ket{\phi_0}\in \mathcal{X}$, and let $\ket{\phi_1}, \cdots \ket{\phi_n}$ be the evolved sequence obtained by $\ket{\phi_{i+1}}=U_M\ket{\phi_i}$, where $\ket{\phi_n}$ is a final superposition. Since $M$ is normal form, $\ket{\phi_1},\cdots,\ket{\phi_n}$ do not have support on $q_0$.

  Let $\ket{\phi'_n}$ be the superposition obtained by replacing the state $q_f$ in $\ket{\phi_n}$ with the initial state of the new machine $q_0'$. Let $\ket{\phi_0'}$ be the superposition obtained by replacing the state $q_f$ in $\ket{\phi_0}$ with the new final state $q_f'$. We want to construct a QTM $M^\dg$ that, when started from $\ket{\phi'_n}$, halts on $\ket{\phi_0'}$ in $n+2$ steps. $M^\dagger$ will have the same alphabet and set of states as $M$, together with the new initial and final states $q_0',q_f'$. We define the transition function $\delta'$ in the following way:
  \begin{enumerate}
  \item $\delta'(q_0',\sigma)=\ket{\sigma}\ket{q_f}\ket{\bar{d}_{q_f}}$.
    \label{reversal:q0'_transition}
  \item[(ii)] For each $q\in Q\backslash\{q_0\}$ and each $\tau \in \Sigma$,
    \begin{equation} \delta'(q,\tau)=\sum_{p,q}\delta(p,\sigma,\tau,q,d_q)^*\ket{\sigma}\ket{p}\ket{\bar{d_p}}.
    \end{equation}
    \label{reversal:q_transition}
  \item[(iii)] $\delta'(q_0,\sigma)=\ket{\sigma}\ket{q_f'}\ket{d_{q_0}}$.
    \label{reversal:q0_transition}
  \item[(iv)] $\delta'(q_f',\sigma)=\ket{\sigma}\ket{q_0'}\ket{N}$.
    \label{reversal:qf'_transition}
  \end{enumerate}
  Here, for any state $q$, $d_q$ is the unique direction in which that state can be entered, and $\bar{d_q}$ is the opposite direction. Since $M$ is unidirectional, \cref{QTM_transitions} implies that $M^\dg$ is a well-formed, normal form, unidirectional QTM. Given a configuration $c$ in state $q$, $\pi(c)$ is defined as the configuration derived from $c$ by moving the head one step in the direction $\bar{d_q}$. $\pi$ can be extended by linearity to $\mathcal{S}$.

  Let us now analyse the behaviour of $M^\dg$ started from $\ket{\phi_n'}$. By \labelcref{reversal:q0'_transition}, $M^\dg$ maps $\ket{\phi_n'}$ in one step to $\pi(\ket{\phi_n})$. Now consider \labelcref{reversal:q_transition}. Since $M$ is normal form, it maps superposition $\ket{\psi_1}$ to superposition $\ket{\psi_2}$ with no support on state $q_0$ if and only if $\ket{\psi_1}$ has no support on state $q_f$. Denote $Q_0 = Q\backslash\{q_0\}$, $Q_f = Q\backslash\{q_f\}$. If $M$ takes a configuration $c_1$ with a state from $Q_f$ with amplitude $\alpha$ to a configuration $c_2$ (necessarily with a state in $Q_0$), then \labelcref{reversal:q_transition} ensures that $M^\dg$ takes configuration $\pi(c_2)$ to configuration $\pi(c_1)$ with amplitude $\alpha^*$. Let $S_0$ (resp.\ $S_f$) be the space of superpositions using only states in $Q_0$ (resp.\ $Q_f$). Since $M$ is well-formed, the restriction of the evolution operator $U_M$ to $S_f$ is an isometry into $S_0$. Hence $M^\dg$ implements, up to conjugation by $\pi$, the inverse of $U_M$ restricted to $U_M(S_f)$.

  As an aside, note that this implies that the evolution operator of $M$ is indeed a unitary and not just an isometry. Indeed, by \labelcref{reversal:q0'_transition,reversal:q_transition,reversal:q0_transition,reversal:qf'_transition} above, the evolution operator of $M^\dg$ is also an isometry from $S_0$ into $S_f$. Since $\pi$ is trivially a unitary on $\mathcal{S}$, this implies that $U_M$ restricted to $S_f$ is a unitary \emph{onto} $S_0$. Now, since $M$ is normal form, $U_M$ achieves any possible configuration with state $q_0$ by starting from the same configuration but with $q_0$ replaced by $q_f$. These two facts together show that $U_M$ is indeed surjective and hence a unitary.

  Returning to the proof of the \lcnamecref{reversal}, we have seen how \labelcref{reversal:q_transition} implies that $M^\dg$ executes the sequence of $n$ steps $\pi(\ket{\phi_{n-1}}),\cdots \pi(\ket{\phi_0})$. Finally, by \labelcref{reversal:qf'_transition}, in the $(n+2)$'th step, $M^\dg$ maps $\pi(\ket{\phi_0})$ to $\ket{\phi_0'}$ as desired.

  Moreover, it is trivial to see that $M^\dg$ uses exactly the same space as $M$, and behaves properly.
  \end{proof}

Note that our way of defining normal form (\cref{def:normal-form} as opposed to that in \cite{Bernstein-Vazirani}) is crucial to guarantee that the reversal machine is proper. As a corollary of the proof, we have also shown that the evolution of a well-formed, normal form unidirectional QTM is a unitary operator. (The proof of this fact for non-unidirectional QTMs is much more involved, and can be found in \cite{Bernstein-Vazirani}).


\subsubsection{Reversible Turing Machine Toolbox}
It will be helpful to have a toolbox of reversible TMs which carry out various elementary computations. In order to satisfy the space constraints of \cref{phase-estimation_QTM}, we will be interested in keeping tight control of the space requirements of all our constructions.

\begin{lemma}[Copying machine]\label{copier}
  There is a two-track, normal form, reversible TM $\TM{Copy}$ with alphabet $\Sigma\times\Sigma$ that, on input $s$ written on the first track, behaves properly, copies the input to the second track and runs for time $2\abs{s}+1$, using $\abs{s}+1$ space.
\end{lemma}

\begin{proof}
  We simply step the head right, copying the symbol from the first track to the second. However, we defer copying the starting cell until the end of the computation, so that we can locate the starting cell again. It is straightforward to verify that the following normal form transition function implements $\TM{Copy}$:
  \begin{equation}
    \begin{array}{l|ccccc}
           & [\sigma,\#] & [\#,\#] & [\tau,\tau] \\
      \hline
      q_0  & ([\sigma,\#],q_1,R) & ([\#,\#],q_f,N) \\
      q_1  & ([\sigma,\sigma],q_1,R) & ([\#,\#],q_2,L) \\
      q_2  & ([\sigma,\sigma],q_f,N) & & ([\tau,\tau],q_2,L) \\
      q_f  & ([\sigma,\#],q_0,N) & ([\#,\#],q_0,N) & ([\tau,\tau],q_0,N) \\
      \multicolumn{2}{l}{\text{\footnotesize $\forall\sigma,\tau\in\Sigma/\#$} \rule{0em}{1.5em}}
    \end{array}
  \end{equation}
  This partial transition function verifies the two conditions of \cref{reversible_transitions}, so it is well-formed and can be completed to give a reversible TM.
\end{proof}


\begin{lemma}[Shift-right machine]\label{shift_right}
  There exists a normal form, reversible TM $\TM{Shift}$ with alphabet $\Sigma$ that, on input $s$ behaves properly, shifts $s$ one cell to the right and runs for time $2\abs{s}+2$, using space $\abs{s}+2$.
\end{lemma}

\begin{proof}
  It is straightforward to verify that the following normal-form transition function implements $\TM{Shift}$:
  \begin{equation}
    \begin{array}{l|ccc}
             & \# & \sigma \\
      \hline
      q_0    & & (\#,q_1^\sigma,R) \\
      q_1^\nu  & (\nu,q_2,R) & (\nu,q_1^\sigma,R) \\
      q_2    & (\#,q_3,L) \\
      q_3    & (\#,q_f,N) & (\sigma,q_3,L) \\
      q_f    & (\#,q_0,N) & (\sigma,q_0,N) \\
      \multicolumn{2}{l}{\text{\footnotesize $\forall\sigma,\nu\in\Sigma/\#$} \rule{0em}{1.5em}}
    \end{array}
  \end{equation}
  As this partial transition function verifies the two conditions of \cref{reversible_transitions}, it is well-formed and can be completed to give a reversible TM.
\end{proof}


\begin{lemma}[Equality machine]\label{equality}
  There is a three-track, normal form, reversible TM $\TM{Eql}$ with alphabet $\Sigma\times\Sigma\times\{\#,0,1\}$ that, on input $s;t;b$, where $s$ and $t$ are arbitrary input strings and $b$ is a single bit, behaves properly and outputs $s;t;b'$, where $b'=\neg b$ if $s=t$ and $b'=b$ otherwise. Furthermore, $\TM{Eql}$ runs for time $2\abs{s}+1$ and uses $\abs{s}+1$ space.
  \end{lemma}

\begin{proof}
  Implementing a non-reversible equality-testing machine is trivial: just scan the head right checking if the symbols on the two input tracks match. If we encounter a non-matching pair, return to the starting cell and flip the output bit. If we reach the end of the input without encountering a non-matching pair, return to the starting cell and leave the output bit unchanged.

  Doing this reversibly requires more care. The problem is that the computation  splits into two possible paths, depending on whether a non-match was encountered or not, and we must merge these two divergent computations back together again \emph{reversibly}. For example, we cannot simply halt after either flipping the output bit or leaving it unchanged, as that would give multiple transitions into the final state that write the same symbol to the starting cell.

  The trick is to return to the point at which the computational paths diverged (either the first non-matching pair of symbols, or the end of the input) after setting the output bit, in order to merge the two computational paths back together, before returning to the starting cell again to halt.

  Because we want to avoid ever moving the head before the starting cell, there is also the issue of how to identify the starting cell so that we can return to it again. If the symbols in the first cell differ, we can set the output bit immediately and halt. If they are identical, we temporarily change the symbol on the second input track to a $\#$ to mark the starting cell. We can recover the original second-track input at the end of the computation by copying over the symbol from the first track.

  The following normal-form transition function carries out this procedure:
  \begin{equation}
    \begin{array}{l|ccccc}
           & [\sigma,\sigma,b] & [\sigma,\tau,b] & [\sigma,\#,b] & [\#,\tau,b] \\
      \hline
      q_0  & ([\sigma,\#,b],q_1,R) & ([\sigma,\tau,b],q_f,N)
             & ([\sigma,\#,b],q_f,N) & ([\#,\tau,b],q_f,N) \\
      q_1  \\
      q_2  & & & ([\sigma,\#,\neg b],q_3,R) \\
      q_2' & & & ([\sigma,\#,b],q_3',R) \\
      q_3  \\
      q_3' \\
      q_4  & & & ([\sigma,\sigma,b],q_f,N) \\
      q_f  & ([\sigma,\sigma,b],q_0,N) & ([\sigma,\tau,b],q_0,N)
             & ([\sigma,\#,b],q_0,N) & ([\#,\tau,b],q_0,N) \\
      \multicolumn{2}{l}{}\\
           & [\sigma,\sigma,\#] & [\sigma,\tau,\#] & [\sigma,\#,\#]
           & [\#,\tau,\#] \\
      \hline
      q_1  & ([\sigma,\sigma,\#],q_1,R) & ([\sigma,\tau,\#],q_2',L)
             & ([\sigma,\#,\#],q_2',L) & ([\#,\tau,\#],q_2',L) \\
      q_2  & ([\sigma,\sigma,\#],q_2,L) \\
      q_2' & ([\sigma,\sigma,\#],q_2',L) \\
      q_3  & ([\sigma,\sigma,\#],q_3,R) \\
      q_3' & ([\sigma,\sigma,\#],q_3',R) & ([\sigma,\tau,\#],q_4,L)
             & ([\sigma,\#,\#],q_4,L) & ([\#,\tau,\#],q_4,L) \\
      q_4  & ([\sigma,\sigma,\#],q_4,L) \\
      q_f  & ([\sigma,\sigma,\#],q_0,N) & ([\sigma,\tau,\#],q_0,N)
             & ([\sigma,\#,\#],q_0,N) & ([\#,\tau,\#],q_0,N) \\
      \multicolumn{2}{l}{}\\
           & [\#,\#,\#] \\
      \cline{1-2}
      q_1  & ([\#,\#,\#],q_2,L) \\
      q_2  \\
      q_2' \\
      q_3  & ([\#,\#,\#],q_4,L) \\
      q_3' \\
      q_4  \\
      q_f  & ([\#,\#,\#],q_0,N) \\
      \multicolumn{2}{l}{\text{\footnotesize $\forall\sigma\neq\tau\in\Sigma/\#, \forall b\in\{0,1\}$} \rule{0em}{1.5em}}
    \end{array}
  \end{equation}
  One can verify that this partial transition function satisfies the two conditions of \cref{reversible_transitions}, so it is well-formed and can be completed to give a reversible TM, as required.
\end{proof}


It is somewhat easier to construct reversible implementations of basic arithmetic operations if the numbers are written on the tape in little-endian order (i.e.\ least-significant bit first), as it avoids any need to shift the entire number to the right to accommodate additional digits. We adopt this convention for all the following basic arithmetic machines. We do not allow numbers to be padded with leading 0's as that would allow multiple binary representations of the same number, which is inconvenient when constructing reversible machines. Note that this means the number zero is represented by the blank string, not the string ``0''.

\begin{lemma}[Increment and decrement machines]
  \label{incrementer}
  There exist normal form, reversible TMs $\TM{Inc}$ and $\TM{Dec}$ with alphabet $\{\#,0,1\}$ that, on little-endian binary input $n$ (with $n>1$ for $\TM{Dec}$), behave properly and output $n+1$ or $n-1$ respectively. Both machines run for time $O(\log n)$ and uses at most $\abs{n}+2$ space.
\end{lemma}

Incrementing a binary number on a non-reversible TM is straightforward: simply step the head along the number starting from the least significant bit, flipping 1's to 0's to propagate the carry until the first 0 or \#, then flip that 0 or \# to 1 and halt. (Little-endian order avoids any need to shift the whole input to the right to accommodate an additional digit, should one be required.) However, making this procedure reversible is more fiddly. One option of course is to use \posscite{Bennet} general reversible simulation and uncomputation of a non-reversible TM, but this comes at a cost of polynomial space overhead. A more careful construction allows us to implement $\TM{Inc}$ directly, using just two additional tape cells.

\begin{proof}[of \cref{incrementer}]
  We first use the $\TM{Shift}$ machine from \cref{shift_right} to shift the entire input one cell to the right, as a convenient way of getting a $\#$ in the starting cell so that we can return to it later. We then reversibly increment the binary number written on the tape, and finish by running $\TM{Shift}^\dg$ (the reversal of the $\TM{Shift}$ machine, constructed using \cref{reversal}) to shift the output back one cell to the left. The following normal-form transition function implements the increment part of this procedure:
  \begin{equation}
    \begin{array}{l|ccc}
           & \# & 0 & 1 \\
      \hline
      q_0  & (\#,q_1,R) \\
      q_1  & (1,q_2',R) & (1,q_2,R) & (0,q_1,R) \\
      q_2  & & (0,q_3,L) & (1,q_3,L) \\
      q_2' & (\#,q_3,L) \\
      q_3  & & & (1,q_4,L) \\
      q_4  & (\#,q_f,N) & (0,q_4,L) \\
      q_f  & (\#,q_0,N) & (0,q_0,N) & (1,q_0,N) \\
    \end{array}
  \end{equation}
  This partial transition function verifies the two conditions of \cref{reversible_transitions}, so it is well-formed and can be completed to give a reversible TM.

  This completes the construction of $\TM{Inc}$. To implement $\TM{Dec}$, simply construct the reversal of $\TM{Inc}$ using \cref{reversal}.
\end{proof}


We can use the $\TM{Inc}$ construction to construct a looping primitive. (This gives a slightly more general version of the Looping Lemma from \cite[Lemma~4.13]{Bernstein-Vazirani}, which also has tighter control on the space requirements.)
%
\begin{lemma}[Looping Lemma]\label{looping2}
  There is a two-track, normal form, reversible TM $\TM{Loop2}$ with alphabet $\{\#,0,1\}$, which has the following properties. On input $n;m$, with $n< m$ both little-endian binary numbers, $\TM{Loop2}$ behaves properly, runs for time $O((m-n)\log m)$, uses space $\abs{m}+2$ and halts with its tape unchanged. Moreover, $\TM{Loop2}$ has a special state $q$ such that on input $n;m$, it visits state $q$ exactly $m-n$ times, each time with its tape head back in the start cell.

  There is also a one-track, normal form, proper, reversible TM $\TM{Loop}$ which, on input $m\ge 1$, behaves as $\TM{Loop2}$ on input $0;m$.
\end{lemma}

\begin{proof}
  Our construction closely follows the proof of \textcite[Lemma~4.2.10]{Bernstein-Vazirani}. We will use two auxiliary tracks in addition to the two input tracks, both with alphabet $\{\#,0,1\}$ and both initially blank. % We will refer to these tracks as the ``increment track'' and the ``flag track'', and write tape configurations in the order: $n$ input track, $m$ input track, increment track, flag track.

  The core of $\TM{Loop2}$ machine is a reversible TM $M'$ constructed out of two proper, normal form, reversible TMs $M_1$ and $M_2$. $M_1$ has initial and final states $q_0,q_f$, and transforms input $n;m;x;b$ into $n;m;x+1;b'$, where $b$ is a bit and $b'=\neg b$ if $x=n$ or $x=m-1$ but not both, otherwise $b'=b$. $M_2$ has new initial and final states $q_\alpha,q_\omega$, with $q_0$ and $q_f$ as its only other normal (non-initial or final) internal states. $M_2$ behaves as follows:
  \begin{enumerate}
  \item If it is in state $q_\alpha$ with $b=0$, it flips $b$ to 1 and enters state $q_0$. \label{M2_prop1}
  \item If it is in state $q_f$ with $b=0$, it enters state $q_0$. \label{M2_prop2}
  \item If it is in state $q_f$ with $b=1$, it flips $b$ to 0 and halts. \label{M2_prop3}
  \end{enumerate}

  The transition rules for $M'$ are constructed by deleting the $q_f$ to $q_0$ transition rules from $M_1$, and adding all the remaining $M_1$ rules to those of $M_2$. The initial and final states of $M'$ are $q_\alpha,q_\omega$. On input $\mbox{n;m;n;0}$, $M'$ will therefore run $M_2$ until it enters the $q_0$ state, then run $M_1$ until it halts and re-enters $M_2$. It will continue to alternate in this way between $M_2$ and $M_1$ until the former halts. Thus $M'$ goes through the following sequence of configurations:
  \begin{multline}
    \mbox{n;m;n;0} \overset{(i)}{\longrightarrow}
    \mbox{n;m;n;1} \overset{M_1}{\longrightarrow}
    \mbox{n;m;n+1;0} \overset{(ii)}{\longrightarrow}
    \mbox{n;m;n+1;0} \overset{M_1}{\longrightarrow}
    \mbox{n;m;n+2;0} \overset{(ii)}{\longrightarrow}\cdots\\
    \cdots\overset{(ii)}{\longrightarrow}
    \mbox{n;m;m-1;0} \overset{M_1}{\longrightarrow}
    \mbox{n;m;m;1} \overset{(iii)}{\longrightarrow}
    \mbox{n;m;m;0}
  \end{multline}
  It therefore runs exactly $m-n$ times and enters the state $q_f$ once in each run, so we can take $q_f$ as the special state $q$.

  To initialise the tracks, we dovetail a proper, reversible TM before $M'$ which transforms the input $n;m;\#;\#$ into the configuration $n;m;n;0$. This is easily constructed by dovetailing the $\TM{Copy}$ machine from \cref{copier} (acting on the first and third tracks) with a simple reversible TM which changes the first cell of the fourth track from $\#$ to 0 and halts (implementing the latter is trivial). To return all tracks to their initial configuration at the end, we dovetail another proper, reversible TM after $M'$ which transforms the configuration $n;m;m;0$ into the final output $n;m;\#;\#$. This is easily constructed by dovetailing the reversal $\TM{Copy}^\dg$ of the copying machine from \cref{copier} (acting on the second and third tracks) with a simple reversible TM which changes the first cell of the fourth track from 0 back to $\#$. From \cref{adder}, these initialisation and reset machines run for time $O(\log n)$ and $O((m-n)\log m)$, respectively, and use $\abs{n}+1$ and $\abs{m}+1$ space.

  It remains to construct $M_1$ and $M_2$, and show that combining them as described above to form $M'$ gives a proper, normal form, reversible TM. $M_1$ is constructed by dovetailing together the $\TM{Eql}$ machine from \cref{equality} (with the first and third tracks as its input tracks and the fourth track as its output), then the $\TM{Inc}$ machine from \cref{incrementer} (acting only on the third track), and finally another $\TM{Eql}$ machine (this time with the second and third tracks as its input tracks and the fourth track as its output). By \cref{dovetailing} and the fact that all the constituent machines are proper, normal form and reversible, $M_1$ is proper, normal form and reversible. From \cref{incrementer,equality}, $M_1$ runs for time $O(\log m)$ and takes at most $\abs{m}+2$ space.

  The following normal form, partial transition function is essentially the same as the corresponding construction in Lemma~4.2.6 of \textcite{Bernstein-Vazirani}, but we can simplify slightly by exploiting the fact that we are allowing generalised TMs. It acts only on the fourth track, and implements a machine $M_2$ that clearly satisfies the properties \labelcref{M2_prop1,M2_prop2,M2_prop3}, above:
  \begin{equation}
    \begin{array}{l|ccc}
              & \# & 0 & 1 \\
      \hline
      q_\alpha  & & (1,q_0,N) \\
      q_f      & & (0,q_0,N) & (0,q_\omega,N) \\
      q_\omega  & (\#,q_\alpha,N) & (0,q_\alpha,N) & (1,q_\alpha,N)
    \end{array}
  \end{equation}
  $M_2$ is clearly normal form, and satisfies the two conditions of \cref{reversible_transitions}.

  Since $M_1$ is normal form, it has no transitions into $q_0$ or out of $q_f$ other than the ones we deleted before constructing $M'$. All remaining internal states of $M_1$ and $M_2$ are distinct. Thus, since $M_1$ is reversible, the transition rules for $M'$ also satisfy the two conditions of \cref{reversible_transitions}. $M'$ can therefore be be completed to a normal form, reversible TM. Since $M_1$ is proper, it is easy to see that $M'$ is also proper.

  $M'$ loops on $M_1$ $m-n$ times (with constant time overhead and no space overhead coming from $M_2$). Each run of $M_1$ takes time $O(\log m)$, so the complete $\TM{Loop2}$ implementation takes time $O(\log m)$. None of the constituent TMs use more than $\abs{m}+2$ space, so neither does $\TM{Loop2}$. This completes the construction of $\TM{Loop2}$..

  To construct $\TM{Loop}$, we simply remove the second input track from the $\TM{Loop2}$ machine, and replace the $\TM{Eql}$ machine that acts on that track with a trivial machine that checks whether the starting cell of the third track contains the $\#$ symbol.
\end{proof}


The reversible incrementing, decrementing, and looping machines constructed above are sufficient to implement all arithmetic operations. The only ones we will need are addition and subtraction. These are now easy to construct.
%
\begin{lemma}[Binary adder]
  \label{adder}
  There exist two-track, normal form, reversible TMs $\TM{Add}$ and $\TM{Sub}$ with alphabet $\{\#,0,1\}^{\times 3}$, which have the following properties. On input $n;m$ with $n$ and $m$ both little-endian binary numbers and $m\ge 1$, $\TM{Add}$ behaves properly and outputs $n+m;m$. On input $n;m$ with $n> m$, $\TM{Sub}$ behaves properly and outputs $n-m;m$. Both TMs run for time $O(m\log m\log n)$ and  use $\max(\abs{n},\abs{m})+2$ space.
 \end{lemma}

\begin{proof}
  To construct $\TM{Add}$, we simply run the $\TM{Loop}$ TM of \cref{looping2} on the second track, inserting for its special state the $\TM{Inc}$ machine of \cref{incrementer} acting on the first track. Since both $\TM{Loop}$ and $\TM{Inc}$ are proper and normal form, the resulting machine is also proper and normal form. $\TM{Sub}$ is simply the reversal of $\TM{Add}$, constructed using \cref{reversal}.
\end{proof}


We will also need a reversible TM to convert the input from unary representation to binary. Again, it is not difficult to construct this using our reversible incrementing TM.
%
\begin{lemma}[Unary to binary converter]
  \label{unary_to_binary}
  There exists a two-track, normal form, reversible TM $\TM{UtoB}$ with alphabet $\{\#,1\}\times\{\#,0,1\}$ with the following properties. On input $1n;\#$ ($n$ written in unary on the first track), $\TM{UtoB}$ behaves properly and outputs $1n;n$ ($n$ written in little-endian binary on the second track). Furthermore, $\TM{UtoB}$ runs for $O(n^2 \log n)$ steps and uses $n+1$ space.
\end{lemma}

\begin{proof}
  The basic idea is to step the head right along the unary track until we reach the end of the unary input string, running the $\TM{Inc}$ machine of \cref{incrementer} once each time we step right. However, $\TM{Inc}$ needs to be started with its head in the starting cell. So each time we run it, we need to temporarily mark the current head location, move the head back to the starting cell in order to run $\TM{Inc}$, then return the head to its previous location and continue stepping right.

  Consider the following normal form transition function, acting only on the unary track:
  \begin{equation}
    \begin{array}{l|ccc}
            & \# & 1 \\
      \hline
      q_0   & (\#,q_f,N) & (1,q,N) \\
      q_1   & (\#,q_4,L) & (\#,q_2,L) \\
      q_2   & (\#,q,N) & (1,q_2,L) \\
      q     & (\#,q_2',R) & (\#,q_1,R) \\
      q_2'  & (1,q_1,R) & (1,q_2',R) \\
      q_4   & (1,q_f,N) & (1,q_4,L) \\
      q_f   & (\#,q_0,N) & (1,q_0,N)
    \end{array}
  \end{equation}
  This verifies the two conditions of \cref{reversible_transitions}, so it is well-formed and defines a reversible TM. It is also easy to see that this TM is proper.

  The transition function implements a machine that steps right over the 1's on the unary track until it reaches the end of the input, at which point it moves its head back to the starting cell and halts. However, each time it steps right, it temporarily marks the current head location by overwriting the 1 on the unary track with a $\#$, returns the head to the starting cell, enters an apparently useless internal state $q$ for one time step, then returns the head back to where it was before, restores the 1 on the unary track, and continues stepping right from where it left off. The purpose of this apparently pointless procedure is that, by \cref{subroutine}, we can substitute the $\TM{Inc}$ machine from \cref{incrementer} for the state $q$, with $\TM{Inc}$ acting on the (initially blank) binary track.

  The above TM enters the $q$ state precisely $n$ times. Thus, when we substitute $\TM{Inc}$ for $q$, $\TM{Inc}$ will be run precisely $n$ times, leaving the number $n$ written on the binary track as required. Each iteration of $\TM{Inc}$ takes time $O(\log n)$ and at most $\abs{n}+2$ space. The step-right TM constructed above adds time overhead $O(n^2)$ and uses $n+1$ space. Neither machine ever moves its head before the starting cell. Thus the overall machine satisfies the time and space claims of the \namecref{unary_to_binary}.
\end{proof}



\subsection{Quantum phase estimation overview}
The qubits used in the quantum phase estimation circuit can be divided into two sets: the ``output'' qubits which will ultimately contain the binary decimal expansion of the phase in the black-box unitary, and the ``ancilla'' qubits on which the black-box unitary is applied. In our case, the black-box unitary will be the single qubit unitary $U_\varphi=\left(\begin{smallmatrix}1&0\\0&e^{i\pi\varphi}\end{smallmatrix}\right)$, so the ancilla set will be a single qubit. As stated above, $\varphi$ will refer to the number whose binary decimal expansion contains the digits of $n$ in reverse order after the decimal.

The quantum phase estimation algorithm proceeds in five stages:
\begin{inparaenum}[(1)]
  \item A preparation stage, in which the qubits are first initialised in the $\ket{0}$ state, then Hadamard gates are applied to all the output qubits and the ancilla qubit is prepared in an eigenstate of $U_\varphi$ (in our case $\ket{1}$);
  \item The controlled-unitary stage, during which control-$U_\varphi$ operations are applied between the output qubits and the ancilla qubit;
  \item A stage in which we locate the least significant bit of the output;
  \item The quantum Fourier transform stage, in which the inverse quantum Fourier transform is applied to the output qubits;
  \item A reset stage, which resets all the auxiliary systems used during the computation to their initial configuration.
\end{inparaenum}

We will construct QTMs for each of these stages separately, and use the Dovetailing \cref{dovetailing} to chain them together. It will be useful to divide the tape into multiple tracks. % An ``input track'' will hold the input $1N$ ($N$ written in unary), and will not change during the evolution of the QTM.
A ``quantum track'' with alphabet $\Sigma_q=\{\#,0,1\}$ will store the qubits involved in the phase estimation algorithm. The input $1N$ will be supplied as a string of $N$ 1's on the quantum track. All the other tracks will essentially be classical; after each stage they will be left in a single standard basis state (i.e.\ neither entangled with other tracks, nor in a superposition of basis states). These classical tracks will be used to implement the classical processing needed to control the quantum operations applied to the quantum track.


\subsection{Preparation stage}
\label{sec:preparation_stage}
We will use the first cell of the quantum track as the ancilla qubit, and the following $N$ cells as the output qubits of the quantum phase estimation algorithm.

It will be convenient to first store a copy of the input given in unary on the quantum track on an auxiliary ``input track'', but written in binary, i.e.\ to transform the configuration $1N;\#$ of the quantum and input tracks into $1N;N$. Running the unary-to-binary converter $\TM{UtoB}$ from \cref{unary_to_binary} on the quantum and input tracks carries out the desired transformation.

% It will be convenient to first initialise the $N+1$ qubits we will use in the phase estimation to $\ket{0}$, i.e. to transform the configuration of the input and quantum tracks from $N;\#$ into $N;0(N+1)$. This transformation is clearly invertible, so the results of \cite{Bennet,Morita} imply that it can be implemented on a reversible Turing Machine in time $O(\poly(N))$. Indeed, it is not difficult to give an explicit construction.

% We use \cref{dovetailing} to dovetail this first with a very simple reversible TM that changes the first qubit of the quantum track from $\#$ to 0 and halts (constructing this machine is trivial), and then dovetail this with the reversible looping TM from~\cref{looping}. Substituting for the special state of the looping machine a stationary, normal form, reversible TM $M$ which appends a 0 onto the quantum track will cause the looping machine write out the requisite string of 0's.

% One must take a little care when constructing a partial transition function that implements $M$, to ensure that it is unidirectional and one-to-one as stipulated by \cref{reversible_transitions}. We temporarily flip the first cell to 1 to mark the starting cell, then step the TM head right until we find the end of the string, append a 0 and step right to the next~$\#$~cell (this latter is necessary for reversibility). We then step left until we find the 1 marking the start cell, flip it back to 0, and halt. The following normal form, partial transition table accomplishes this, and as it manifestly satisfies the two conditions of \cref{reversible_transitions} it is well-formed:
% \begin{equation}
%  \begin{array}{l|ccc}
%         & \# & 0 & 1 \\
%    \hline
%    q_0  & & (1,q_1,R) \\
%    q_1  & (0,q_2,R) & (0,q_1,R) \\
%    q_2  & (\#,q_3,L) \\
%    q_3  & & (0,q_3,L) & (0,q_f,N) \\
%    q_f  & (\#,q_0,N) & (0,q_0,N) & (1,q_0,N) \\
%  \end{array}
% \end{equation}
% Finally, we dovetail the looping machine with $Copy^\dg$, the reversal of the copying machine constructed using \cref{reversal}, the effect of which is to reset the looping track back to the blank configuration. Note that this construction never moves the head to a location before the starting cell.

% Having initialised the qubits to $\ket{0}$,
We want to initialise the $N+1$ qubits that will be used in the phase estimation, by preparing the ancilla qubit in the state $\ket{1}$ and the output qubits in the $\ket{+}$ state. The first $N$ qubits are already in the $\ket{1}$ state thanks to the input string. We therefore prepare the desired state by first temporarily flipping the state of the first qubit on the quantum track $\ket{\#}$ to mark the starting cell, then stepping the QTM head right rotating each qubit into the $\ket{+}$ state, until we reach the first $\ket{\#}$ state which we again rotate to $\ket{+}$ to initialise the $N+1$'th qubit. We then move the head back to the start location, flip the state of the first cell of the quantum track from $\ket{\#}$ to $\ket{1}$, and halt. (The contents of all other tracks are ignored.) It is straightforward to verify that the following partial transition function satisfies the conditions of \cref{QTM_transitions}, so is well-formed, and implements a proper, well-formed, normal form, unidirectional QTM that does exactly what we want.
\begin{equation}\label{eq:Hadamard_QTM}
  \begin{array}{l|ccc}
           & \# & 0 & 1 \\
    \hline
    q_0  & & & \ket{\#}\ket{q_1}\ket{R} \\
    q_1  & \tfrac{1}{\sqrt{2}}(\ket{0}+\ket{1}) \ket{q_2}\ket{R}
           & & \tfrac{1}{\sqrt{2}}(\ket{0}+\ket{1}) \ket{q_1}\ket{R} \\
    q_2  & \ket{\#}\ket{q_3}\ket{L} \\
    q_3  & \ket{1}\ket{q_f}\ket{N} & \ket{0}\ket{q_3}\ket{L}
           & \ket{1}\ket{q_3}\ket{L} \\
    q_f  & \ket{\#}\ket{q_0}\ket{N} & \ket{0}\ket{q_0}\ket{N}
           & \ket{1}\ket{q_0}\ket{N}
  \end{array}
\end{equation}


\subsection{Control-\texorpdfstring{$U_\varphi$}{Uphi} stage}
\label{sec:cU_stage}
The second stage of the phase estimation procedure is to apply control-$U_\varphi^{2^{n-1}}$ operations between the $n$'th output qubit and the ancilla qubit (see~\cref{fig:cU_circuit}). Constructing a QTM that implements this is more complex. The basic idea is to supply the QTM with an internal state $q$ which causes the $U_\varphi$ rotation to be applied to the quantum track at the current head location. We then construct classical control machinery which iterates over the output qubits, and loops on $q$ to apply $U_\varphi$ for a total of $2^{n-1}$ times.

\begin{figure}[htbp]
  \centering
  \mbox{
    \Qcircuit @C=1em @R=1em {
      \lstick{\ket{0}} & \gate{H} & \qw & \qw              & \qw                & \qw                    & \push{\makebox[2em]{$\dots$}} \qw & \ctrl{5}                  &  \rstick{\ket{0} + e^{2\pi i(2^{N-1}\varphi)}\ket{1}} \qw \\
      & \vdots \\
      \lstick{\ket{0}} & \gate{H} & \qw & \qw              & \qw                & \ctrl{3}               & \push{\makebox[2em]{$\dots$}} \qw & \qw                       &  \rstick{\ket{0} + e^{2\pi i(2^2\varphi)}\ket{1}} \qw \\
      \lstick{\ket{0}} & \gate{H} & \qw & \qw              & \ctrl{2}           & \qw                    & \push{\makebox[2em]{$\dots$}} \qw & \qw                       &  \rstick{\ket{0} + e^{2\pi i(2\varphi)}\ket{1}} \qw \\
      \lstick{\ket{0}} & \gate{H} & \qw & \ctrl{1}         & \qw                & \qw                    & \push{\makebox[2em]{$\dots$}} \qw & \qw                       & \rstick{\ket{0} + e^{2\pi i\varphi}\ket{1}} \qw \\
      \lstick{\ket{1}} & \qw      & \qw & \gate{U_\varphi} & \gate{U_\varphi^2} & \gate{U_\varphi^{2^2}} & \push{\makebox[2em]{$\dots$}} \qw & \gate{U_\varphi^{2^{N-1}}}& \rstick{\ket{1}} \qw
    }
    \hspace{4em}
  }
  \caption[Quantum phase estimation, control-phase stage.]{The first stage of the quantum phase estimation circuit for $\varphi$ (cf.~Fig.~5.2 in~\cite{Nielsen+Chuang}).}
  \label{fig:cU_circuit}
\end{figure}

We will use three auxiliary tracks. One, with alphabet $\Sigma_m=\{t,c,m_0,m_1,\#\}$, will be used to mark the position of the current control and target qubits. (The $m_{0,1}$ states will be used to temporarily store an auxiliary qubit on the mark track of the starting cell.) The other two auxiliary tracks, with alphabet $\Sigma_l=\{0,1,\#\}$, will constitute the work tapes of two different reversible looping TMs from~\cref{looping2}. % We will assume that the input to this stage's QTM consists of a number $N$ written in binary on the input track, an arbitrary state of the first $N+1$ qubits on the quantum track, and all auxiliary tracks initially blank. (The preparation stage from the previous section prepares precisely such a configuration.)


\subsubsection{\texorpdfstring{$cU^k$}{cUk} machine}\label{sec:cU_machine}
We will need a QTM  which applies the control-$U_\varphi$ operation $k$ times. We give a construction for an arbitrary controlled single-qubit unitary $U$, as this will be useful later.

\begin{lemma}[Controlled-$U$ QTM]\label{cU_machine}
  For any single-qubit unitary $U$, there exists a well-formed normal form unidirectional QTM $cU^k$ with the following properties. The QTM has three tracks: a \emph{looping track} with alphabet $\Sigma_l=\{0,1,\#\}$, a \emph{mark track} with alphabet $\Sigma_m=\{t,c,m_0,m_1,\#\}$, and a \emph{quantum track} with alphabet $\Sigma_q=\{0,1,\#\}$. The input consists of a number $k\ge 1$ written in binary on the looping track in little-endian order, a configuration containing a single $t$ and a single $c$ within the first $n$ tape cells on the mark track (and all other cells blank), and an arbitrary $n$-qubit state on the quantum track.

  On such input, the QTM applies the control-$U$ operation $k$ times between the control and target qubits on the quantum track marked by $c$ and $t$, and then halts, having run for time $O(k n + k\log k)$, used at most $\max(n,\abs{k}) + 2$ space, behaving properly and leaving the configurations of the looping and mark tracks unchanged.
\end{lemma}

\begin{proof}
  It will be convenient to first run the $\TM{Shift}$ machine from \cref{shift_right} acting only on the mark and quantum tracks, to shift this part of the input one cell to the right. This produces a $\#$ on the mark and quantum tracks of the start cell, which we can use later to return to this cell. The remainder of the construction returns the quantum and mark tracks of the start cell to the $\#$ state, so we can run the corresponding $\TM{Shift}^\dg$ machine at the very end (where $\TM{Shift}^\dg$ is the reversal of $M_1$ constructed using \cref{reversal}) to shift these tracks back one cell to the left, so that the final output is correctly aligned. These shift operations take $O(n)$ time and use $n + 2$ space.

  We construct the core of the $cU^k$ QTM out of two simpler machines, $M_1$ and $M_2$, dovetailed together in the sequence $M_1,M_2,M_1^\dagger$ (where $M_1^\dg$ is the reversal of $M_1$). Machine $M_1$ scans right until it encounters a $c$ on the mark track, at which point it applies a CNOT between the quantum track and an internal qubit, returns the head to the starting cell, applies a CNOT between the internal qubit and an auxiliary qubit on the mark track, and halts. Clearly, $M_1$ is proper, runs for time at most $O(n)$ and uses at most $n+1$ space.

  The following well-formed, normal form, partial quantum transition function implements $M_1$ (which acts only on the mark and quantum tracks). Note that one of the internal states of $M_1$ comes in two varieties, indicated by a superscript $j=\{0,1\}$, which are used to temporarily store a qubit in the internal state of the machine:
  \begin{equation}
    \begin{array}{l|ccccc}
            & [\#,\#] & [\#,i] & [t,\wc] & [c,j] & [m_k,\wc] \\
      \hline
      q_0   & \ket{m_0,\#}\ket{q_1}\ket{R} \\
      q_1   & & \ket{\#,i}\ket{q_1}\ket{R} & \ket{t,\wc}\ket{q_1}\ket{R}
            & \ket{c,j}\ket{q_2^j}\ket{L} \\
      q_2^j & & \ket{\#,i}\ket{q_2^j}\ket{L} & \ket{t,\wc}\ket{q_2^j}\ket{L}
            & & \ket{m_{k\oplus j}}\ket{q_f}\ket{N} \\
      q_f   & \ket{\#,\#}\ket{q_0}\ket{N} & \ket{\#,i}\ket{q_0}\ket{N}
            & \ket{t,\wc}\ket{q_0}\ket{N} & \ket{c,j}\ket{q_0}\ket{N}
            & \ket{m_k,\wc}\ket{q_0}\ket{N} \\
      \multicolumn{2}{l}{\text{\footnotesize $\forall i,j,k\in\{0,1\}$} \rule{0em}{1.5em}}
    \end{array}
  \end{equation}

  Machine $M_2$ loops $k$ times, where $k$ is specified by the number written in binary on the looping track, applying a control-$U$ operation between the auxiliary qubit stored on the mark track of the start cell and the target qubit, and then halts. We construct $M_2$ using the reversible looping TM $\TM{Loop}$ from \cref{looping2}, and inserting for its special state a QTM $M'$ that is very similar to $M_1$. The $M'$ machine first applies a CNOT between the auxiliary qubit stored in the mark track of the start cell and an internal qubit. It then  scans right until it finds the $t$, and applies a single control-$U$ operation between the internal qubit and the target qubit. Finally, it moves the head back to the starting cell, and applies another CNOT between the internal qubit and the auxiliary qubit, before halting.

  If $u_{ij}$ denotes the $i,j$'th matrix element of $U$, then the following well-formed,  normal form, partial quantum transition function (which acts only on the mark and quantum tracks) implements $M'$:
  \begin{equation}\label{eq:cU_QTM}
    \begin{array}{l|ccccc}
            & [m_0,\wc] & [m_1,\wc] & [\#,\wc] & [t,j] & [c,\wc] \\
      \hline
      q_0   & \ket{m_0,\wc}\ket{q_1^0}\ket{R} & \ket{m_1,\wc}\ket{q_1^1}\ket{R} \\
      q_1^0 & & & \ket{\#,\wc}\ket{q_1^0}\ket{R}
            & \ket{t,j}\ket{q_2^0}\ket{L} & \ket{c,\wc}\ket{q_1^0}\ket{R} \\
      q_1^1 & & & \ket{\#,\wc}\ket{q_1^1}\ket{R}
            & \sum_i u_{ij}\ket{t,i}\ket{q_2^1}\ket{L}
              % I don't think changing this entry to $\sum_{t'} u_{tt'}\ket{t',j}\ket{q_2^1}\ket{L}$ is correct. $t$ is a symbol on the mark track used to mark where to apply the unitary, not a parameter that should be summed over. I \emph{think} it's correct as written -- Toby}
            & \ket{c,\wc}\ket{q_1^1}\ket{R} \\
      q_2^0 & \ket{m_0,\wc}\ket{q_f}\ket{N} & & \ket{\#,\wc}\ket{q_2^0}\ket{L}
            & & \ket{c,\wc}\ket{q_2^0}\ket{L} \\
      q_2^1 & & \ket{m_1,\wc}\ket{q_f}\ket{N} & \ket{\#,\wc}\ket{q_2^1}\ket{L}
            & & \ket{c,\wc}\ket{q_2^1}\ket{L} \\
      q_f   & \ket{m_0,\wc}\ket{q_0}\ket{N} & \ket{m_1,\wc}\ket{q_0}\ket{N}
            & \ket{\#,\wc}\ket{q_0}\ket{N} & \ket{t,j}\ket{q_0}\ket{N}
            & \ket{c,\wc}\ket{q_0}\ket{N} \\
      \multicolumn{2}{l}{\text{\footnotesize $\forall i,j,k\in\{0,1\}$} \rule{0em}{1.5em}}
    \end{array}
  \end{equation}
  This machine is proper, never alters the mark track, and, for given mark track configuration, always runs for the same number of time steps. So substituting it in the looping machine produces a proper QTM $M_2$. Furthermore, since $M'$ takes $O(n)$ time and at most $n+1$ space, $M_2$ runs for time $O(k n + k \log k)$, uses at most $\max(n,\abs{k})+2$ space, and never moves the head before the starting cell.

  The only \emph{qubits} on which the overall QTM acts are the two qubits in the quantum tracks of the cells marked by $t$ and $c$, the auxiliary qubit stored on the mark track (let's label this $m$), and the two internal qubits stored in the internal states $q_2^j$ of $M_1$ and $q_{1,2}^j$ of $M_2$ (let's label these auxiliary $M_1$ and $M_2$ internal qubits by $a_{1,2}$). Qubits $m$, $a_1$ and $a_2$ are initially in the $\ket{0}$ state. Apart from classical processing to move the head into the correct location, $M_1$ just applies a CNOT between the $c$ and $a_1$ qubits, followed by a CNOT between the $a_1$ and $m$ qubits.

  Similarly, $M'$ applies a CNOT between the $m$ and $a_2$ qubits, a control-$U$ operation between the $a_2$ and $t$ qubits, and a final CNOT between the $m$ and $a_2$ qubits. Letting $cU$ denote the control-$U$ gate, and recalling that the $a_2$ qubit starts off in the $\ket{0}$ state, the overall effect of this is:
  \begin{equation}
    CNOT_{m a_2}\; cU_{a_2 t}\; CNOT_{m a_2} \ket[mt]{\psi}\ket[a_2]{0}
    = cU\ket[mt]{\psi}\ket[a_2]{0},
  \end{equation}
  i.e.\ $M'$ effectively applies a single control-$U$ operation between the $m$ and $t$ qubits. $M_2$ repeats the $M'$ operations $k$ times, so the overall action of $M_2$ is to apply a control-$U$ operation $k$ times between the $m$ and $t$ qubits.

  The time-reversal of $M_1$ simply applies its CNOTs in the reverse order. So dovetailing $M_1,M_2,M_1^\dg$ carries out the operation
  \begin{equation}
    CNOT_{ca_1}\; CNOT_{a_1m}\; cU^k_{mt}\; CNOT_{a_1m}\; CNOT_{ca_1}
      \ket[ct]{\psi}\ket[a_1]{0}\ket[m]{0}
    = cU^k_{ct}\ket[ct]{\psi}\ket[a_1]{0}\ket[m]{0}.
  \end{equation}
  Thus the overall action of the entire QTM is to apply a $cU^k$ operation between the control and target qubits, as required, leaving the looping and mark tracks back in the configuration they started in. Furthermore, the QTM runs for time $O(k n + k \log k)$, uses at most $\max(n,\abs{k})+2$ space, and is well-formed, normal form, unidirectional and proper, as claimed.
\end{proof}


\subsubsection{Iterating over the control qubits}
\label{sec:cU_stage_iteration}
We want to apply a $cU_\varphi^{2^{n-1}}$ operation between the $n$'th output qubit and the ancilla qubit, for each of the $N$ output qubits. (Note that the qubits are stored in reverse order on the quantum track, so the 1st output qubit is stored in the $N+1$'th cell of the quantum track and the $N$'th output qubit is stored in the 2nd cell.) As we will need to use a second looping machine to iterate over the qubits, we refer to the looping track for the $cU^k$ machine as the ``$cU$ looping track'', and the track for the second looping machine used here as the ``outer looping track''.

We will need a reversible TM which, on suitable mark and $cU$ looping track configurations (cf.\ \cref{cU_machine}), moves the $c$ marker on the mark track one cell to the left, and doubles the value $k$ written on the $cU$ looping track. It is convenient (though slightly less efficient) to divide the implementation into two parts, dovetailed together: $\TM{Step}_c$ which shifts the $c$ marker one cell to the left, and $\TM{Dbl}$ which doubles the value on the $cU$ looping track. The following well-formed, normal form, partial transition function implements the reversible TM $\TM{Step}_c$ (which only acts on the mark track):
\begin{equation}
  \begin{array}{l|ccc}
         & \# & t_i & c \\
    \hline
    q_0  & & (t_i,q_1,R) \\
    q_1  & (\#,q_1,R) & & (\#,q_2,L) \\
    q_2  & (c,q_3,L) \\
    q_3  & (\#,q_3,L) & (t_i,q_f,N) \\
    q_f  & (\#,q_0,N) & (t_i,q_0,N) & (c,q_0,N) \\
    \multicolumn{2}{l}{\text{\footnotesize $\forall i\in\{0,1\}$} \rule{0em}{1.5em}}
  \end{array}
\end{equation}

Doubling a number in binary simply appends a 0 onto the binary representation of the number. The following well-formed, normal form, partial transition function for $\TM{Dbl}$ (which acts only on the $cU$ looping track) does precisely this, taking advantage of the fact that $k$ is always a power of~2 (so, in little-endian order, always consists of a string of 0's followed by a single~1) to simplify the construction:
\begin{equation}
  \begin{array}{l|ccc}
         & \# & 0 & 1 \\
    \hline
    q_0  & & (\#,q_1,R) & (\#,q_2,R) \\
    q_1  & & (0,q_1,R) & (0,q_2,R) \\
    q_2  & (1,q_3,L) \\
    q_3  & (0,q_f,N) & (0,q_3,L) & \\
    q_f  & (\#,q_0,N) & (0,q_0,N) & (1,q_0,N) \\
  \end{array}
\end{equation}


We are now in a position to implement the complete controlled-$U_\varphi$ stage of the quantum phase estimation algorithm. We initialise the states of the auxiliary tracks, by first running a simple reversible TM that changes the $[\#,\#]$ in the first cell of the mark and $cU$ looping tracks into $[t_0,1]$, then returns to the starting cell and halts. (Constructing a reversible TM for this is trivial.) We then dovetail this with a proper, normal form reversible TM that scans to the end of the output qubits, changes the $\#$ on the mark track into a $c$, and halts. The following normal form, partial transition function (which acts only on the mark and quantum tracks) accomplishes this:
\begin{equation}
  \begin{array}{l|cccc}
         & [\#,\#] & [\#,i] & [t_i,j] \\
    \hline
    q_0  & & & ([t_i,j],q_1,R) \\
    q_1  & ([\#,\#],q_2,L) & ([\#,i],q_1,R) \\
    q_2  & & ([c,i],q_3,L) \\
    q_3  & & ([\#,i],q_3,L) & ([t_i,j],q_f,N) \\
    q_f  & ([\#,\#],q_0,N) & ([\#,i],q_0,N) & ([t_i,j],q_0,N) \\
    \multicolumn{2}{l}{\text{\footnotesize $\forall i,j\in\{0,1\}$} \rule{0em}{1.5em}}
  \end{array}
\end{equation}
On the mark track, this leaves a $t_0$ and $c$ over the ancilla qubit and the first output qubit,\footnote{Recall that the first output qubit is the last one on the quantum track} respectively, and blanks everywhere else. The configuration prepared on the $cU$ looping track corresponds to the number 1 written in binary.

Next, we copy $N$ from the input track to the outer looping track using the $\TM{Copy}$ machine from \cref{copier}. We then run a reversible looping TM from~\cref{looping2} which uses this track as its input track (so it will loop $N$ times in total). For the special state of this looping machine, we substitute a QTM which dovetails the $cU^k$ machine from \cref{cU_machine} with the $\TM{Step}_c$ and $\TM{Dbl}$ machines constructed above.

On appropriate input, the $cU^k$ machine from~\cref{cU_machine} runs for a number of steps which depends only on the classical part of the input supplied on the mark and looping tracks, and not on the quantum state in the quantum track. The $\TM{Step}_c$ and $\TM{Dbl}$ reversible TMs don't touch the quantum track at all. So as long as the mark and $cU$ looping tracks are always in a suitable configuration (cf.\ \cref{cU_machine}) before the $cU^k$ machine is run in each iteration, the outer looping machine will be proper.

Now, we already initialised the $cU$ looping track to $k=1$, above, and marked the ancilla qubit as the target and the first output qubit as the control. So the initial configuration of the mark and $cU$ looping tracks is suitable input for a $cU^k$ machine. When $cU^k$ is run in the first iteration of the outer looping machine, it applies a $cU^1 = cU$ between the first output qubit and the target qubit. $\TM{Step}_c$ and $\TM{Dbl}$ machines then run, which shifts the control marker one cell to the left onto the second output qubit and doubles $k$ to $2$, ready for the next iteration. In the second iteration, the looping machine therefore applies a $cU^2$ between the second output qubit and the ancilla, and doubles $k$ to 4. The looping machine goes through a total of $N$ iterations, each time feeding suitable input to the $cU^k$ machine to make it apply a $cU^{2^{n-1}}$ between the $n$'th output qubit and the ancilla, before halting with $N$ written on the outer looping track, a $t_0$ and $c$ in the first and second cells of the mark track, and $N+1$ written on the $cU$ looping track.

Thus the outer looping machine is well-formed, normal form unidirectional and proper. It runs for a total of $N$ iterations with overhead $N \log N$ (cf. \cref{looping2}). In the $n$'th iteration it runs the $cU^k$ machine from \cref{cU_machine} once with $k=2^{n-1}$, and runs the $\TM{Step}_c$ and $\TM{Dbl}$ machines once each. The $n$'th iteration of the $cU^k$ machine takes time $O(N + 2^{n-1}\log 2^{n-1})$, and the $\TM{Step}_c$ and $\TM{Dbl}$ machines always take time $O(n)$. So the outer looping machine runs for a total time $O(N^2 2^N)$.

Finally, we can uncompute (reset) the auxiliary tracks by running a reversible TM which transforms the configuration $N;N;t_0c;N+1$ left on the input, outer looping, mark, and $cU$ looping tracks, into $N;\#;\#;\#$. We do this by running the reversal $\TM{Copy}^\dg$ of the copying machine from \cref{copier} on the input and outer looping tracks to erase the outer looping track, decrementing the $cU$ looping track and running $\TM{Copy}^\dg$ again to erase that track, and running a trivial reversible TM that changes $t_0c$ on the mark track into $\#\#$.

Putting everything together, the control-$U$ stage runs for a total time $O(N^2 2^N)$ and requires space $N+3$ (2 more cells than the number of quits, which is $N+1$). When dovetailed with the preparation stage from \cref{sec:preparation_stage}, the overall QTM we have constructed implements the control-$U$ circuit of \cref{fig:cU_circuit}. If $\varphi_k$ denotes the $k$'th digit in the binary decimal expansion of $\varphi$, then this prepares the state~\cite{Nielsen+Chuang}
\begin{multline}
  \frac{1}{2^N}
  \left(\ket{0} + e^{2\pi i 0.\varphi_N}\ket{1}\right)
  \left(\ket{0} + e^{2\pi i 0.\varphi_{N-1}\varphi_N}\ket{1}\right) \cdots\\
  \cdots
  \left(\ket{0} + e^{2\pi i 0.\varphi_2\dots\varphi_{N-1}\varphi_N}\ket{1}\right)
  \left(\ket{0} + e^{2\pi i 0.\varphi_1\varphi_2\dots\varphi_N}\ket{1}\right)
\end{multline}
on the $N$ output qubits (ordered as they are on the quantum track). All other tracks are blank, except for the input track which still has the input $N$ written on it as a little-endian binary number.



\subsection{Locating the LSB}\label{sec:LSB_stage}
The final stage of the quantum phase estimation algorithm is to apply the inverse quantum Fourier transform to the quantum state generated by the control-$U$ stage. The structure of the quantum circuit for the QFT is rather reminiscent of that of the control-$U$ stage. It again involves applying a ``cascade'' of control-$U^{2^n}$ gates between pairs of qubits, which we already know how to implement! Only now there is a new cascade starting from each output qubit (see \cref{fig:QFT_circuit}).

However, the phase $2^{-N}$ of the control-$U_{2^{-N}}$ rotation needed in the QFT circuit depends on the total number of qubits $N$ that the QFT is being applied to. If we simply implemented the inverse QFT circuit directly on all $N$ output qubits, the entries of the transition function in our $cU^k$ machine from \cref{sec:cU_stage} would have to depend on the input $N$, which is not allowed. It is not at all obvious whether the inverse QFT circuit on $N$ qubits can be implemented \emph{exactly} when $N$ is given as input.\footnote{The universal QTM construction of \textcite{Bernstein-Vazirani} can approximate the QFT on $N$ qubits to arbitrary precision, but it does not implement it exactly.}

On the other hand, the entries of the transition function \emph{are} allowed to depend on the phase $\varphi$ that we are estimating -- indeed, they necessarily do so, since the output of the $P_n$ QTM in \cref{phase-estimation_QTM} depends on $n$ (or equivalently on $\varphi$). Rather than implementing the QFT on $N$ qubits, we take a different approach. We supply our QTM with the $U_{2^{-\abs{\varphi}}}$ gate, and implement the inverse QFT on $\abs{\varphi}$ qubits, independent of the input $N$. (I.e.\ just enough qubits to hold all the digits of the binary decimal expansion of $\varphi$.) However, for this to work, we must first identify which output qubit holds the least significant bit (LSB) of $\varphi$, so that we know which qubits to apply the $\abs{\varphi}$-qubit inverse QFT to. The role of the input $N$ is merely to provide us with an upper-bound on $\abs{\varphi}$, which allows us to identify the LSB in finite time and space.

Recall that the control-$U$ stage prepared the state~\cite{Nielsen+Chuang}
\begin{multline}
  \frac{1}{2^{\frac{N}{2}}}
  \left(\ket{0} + e^{2\pi i 0.\varphi_N}\ket{1}\right)
  \left(\ket{0} + e^{2\pi i 0.\varphi_{N-1}\varphi_N}\ket{1}\right) \cdots\\
  \cdots
  \left(\ket{0} + e^{2\pi i 0.\varphi_2\dots\varphi_{N-1}\varphi_N}\ket{1}\right)
  \left(\ket{0} + e^{2\pi i 0.\varphi_1\varphi_2\dots\varphi_N}\ket{1}\right)
\end{multline}
on the $N$ output qubits (where $\varphi_k$ denotes the $k$'th digit in the binary decimal expansion of $\varphi$).

The least significant bit of $\varphi$ is the $\abs{\varphi}$'th bit, and by assumption (cf.\ \cref{phase-estimation_QTM}) $\abs{\varphi} \leq N$. So the $\abs{\varphi}$'th bit of $\varphi$ is 1 and the $\abs{\varphi}+1\dots N$'th bits are 0. Thus the last $N-\abs{\varphi}$ output qubits are in the $\ket{+}$ state, and the $\abs{\varphi}$'th qubit, which corresponds to the least significant bit of $\varphi$, is in the $\ket{-}$ state. (Recall that the output qubits are stored on the quantum track in reverse order.)

Therefore, if we construct a QTM that steps right, applying Hadamard rotations to the output qubits in the quantum track until it obtains a $\ket{1}$ and halts, we will be able to locate the least significant bit of $\varphi$. More precisely, this will rotate the first $N-\abs{\varphi}$ output qubits into the $\ket{0}$ state, and halt with the $N-\abs{\varphi}+1$'th qubit (which corresponds to the $\abs{\varphi}$'th bit of $\varphi$) rotated into the $\ket{1}$ state. The least significant bit of $\varphi$ is therefore identified by the first $\ket{1}$ on the quantum track after this machine has finished running.

The following well-formed, normal form, partial quantum transition function (which acts only on the quantum track) implements a proper QTM that steps along the quantum track, applying Hadamards until it obtains a $\ket{1}$. It can be verified that it obeys the three conditions of \cref{QTM_transitions}, so can be completed to a well-formed QTM:
% \begin{equation}
%   \begin{array}{l|ccc}
%           & \# & 0 & 1 \\
%     \hline
%     q_0   & & & \ket{\#}\ket{q_1}\ket{R} \\
%     q_1   & \ket{\#}\ket{q_3}\ket{L}
%             & \tfrac{1}{\sqrt{2}}(\ket{0} + \ket{1})\ket{q_2}\ket{N}
%             & \tfrac{1}{\sqrt{2}}(\ket{0} - \ket{1})\ket{q_2}\ket{N} \\
%     q_2   & & \ket{\#}\ket{q_2'}\ket{L} & \ket{1}\ket{q_3}\ket{L} \\
%     q_2'    & \ket{\#}\ket{q}\ket{N} & \ket{0}\ket{q_2'}\ket{L} \\
%     q     & \ket{\#}\ket{q_2''}\ket{R} \\
%     q_2'' & \ket{0}\ket{q_1}\ket{R} & \ket{0}\ket{q_2''}\ket{R} \\
%     q_3   & \ket{\#}\ket{q_f}\ket{N} & \ket{0}\ket{q_3}\ket{L} \\
%     q_f   & \ket{\#}\ket{q_0}\ket{N} & \ket{0}\ket{q_0}\ket{N}
%             & \ket{1}\ket{q_0}\ket{N} \\
%   \end{array}
% \end{equation}
\begin{equation}\label{eq:LSB_QTM}
  \begin{array}{l|ccc}
         & \# & 0 & 1 \\
    \hline
    q_0  & & & \ket{\#}\ket{q_1}\ket{R} \\
    q_1  & \ket{\#}\ket{q_3}\ket{L}
           & \tfrac{1}{\sqrt{2}}(\ket{0} + \ket{1})\ket{q_2}\ket{N}
           & \tfrac{1}{\sqrt{2}}(\ket{0} - \ket{1})\ket{q_2}\ket{N} \\
    q_2  & & \ket{0}\ket{q_1}\ket{R} & \ket{1}\ket{q_3}\ket{L} \\
    q_3  & \ket{\#}\ket{q_f}\ket{N} & \ket{0}\ket{q_3}\ket{L} \\
    q_f  & \ket{\#}\ket{q_0}\ket{N} & \ket{0}\ket{q_0}\ket{N}
           & \ket{1}\ket{q_0}\ket{N} \\
  \end{array}
\end{equation}
(Note that the qubit in the starting cell of the quantum track is still in the state $\ket{1}$ from the preparation and control-$U$ stages. As we will not need this qubit again, this machine sets it to $\ket{\#}$ to mark the starting cell and leaves it in that state when it halts, for later convenience.)

The configuration written on the quantum track after this machine has finished is the $N+1$-qubit state:
\begin{multline}\label{eq:LSB}
  \ket{\#}\ket{0}\overset{N-\abs{\varphi}}{\cdots}\ket{0}\ket{1}
  \frac{1}{2^{\frac{|\varphi|-1}{2}}}
  \left(\ket{0}
    + e^{2\pi i 0.\varphi_{\abs{\varphi}-1}\varphi_{\abs{\varphi}}}
    \ket{1}\right)
  \left(\ket{0}
    + e^{2\pi i 0.\varphi_{\abs{\varphi}-2}\varphi_{\abs{\varphi}-1}\varphi_{\abs{\varphi}}} \ket{1}\right)
  \cdots\\
  \cdots
  \left(\ket{0}
    + e^{2\pi i 0.\varphi_1\varphi_2\dots\varphi_{\abs{\varphi}-1}\varphi_{\abs{\varphi}}} \ket{1}\right).
\end{multline}
Note that the first $N-\abs{\varphi}+2$ cells of the quantum track are not entangled with the rest of the track.

It will be helpful for later to record the number of output bits that we are skipping, i.e.\ to compute $N-\abs{\varphi}$ and store the result on a separate auxiliary ``count track''. We can do this using a construction that is very similar to the unary-to-binary converter of \cref{unary_to_binary}. Specifically, we will construct a reversible TM $\TM{Count}$ that steps right over $\ket{0}$'s until it finds a $\ket{1}$ on the quantum track, running the $\TM{Inc}$ machine once each time it steps right. (This means first returning the head to the starting cell, running $\TM{Inc}$, then returning the head back to where it was previously.)

Consider the following partial transition function, which satisfies the conditions of \cref{reversible_transitions} so can be completed to a proper, normal form, reversible TM:
\begin{equation}\label{eq:LSB_counting_TM}
  \begin{array}{l|ccc}
         & \# & 0 & 1 \\
    \hline
    q_0  & (\#,q_1,R) \\
    q_1  & (\#,q_4,L) & (\#,q_2,L) & (1,q_4,L) \\
    q_2  & (\#,q,N) & (0,q_2,L) \\
    q    & (\#,q_3,R) \\
    q_3  & (0,q_1,R) & (0,q_3,R) \\
    q_4  & (\#,q_f,N) & (0,q_4,L) \\
    q_f  & (\#,q_0,N) & (0,q_0,N) & (1,q_0,N) \\
  \end{array}
\end{equation}
This machine steps right over 0's until it encounters a 1 (or reaches the end of the input), at which point it moves its head back to the starting cell and halts. (It assumes that the first cell is marked with a $\#$.) However, each time it is about to step right, it first temporarily marks the current head location by overwriting the 0 with a $\#$, returns the head to the starting cell, enters an internal state $q$ for one time step, then returns the head back to where it was before, resets the quantum track to 0, and continues stepping right from where it left off. By \cref{subroutine}, we can substitute for the state $q$ the $\TM{Inc}$ machine from \cref{incrementer} (acting on an initially blank ``count track''). If we run the above TM on the quantum track, it will step right precisely $N-\abs{\varphi}$ times before finding the first $\ket{1}$, so it will halt with $N-\abs{\varphi}$ written to the count track.

The configuration left on the tape now consists of the little-endian binary number $N$ written on the input track, the little-endian binary number $N-\abs{\varphi}$ written on the count track, and the $N+1$-qubit state from \cref{eq:LSB} written on the quantum track.

As the qubits storing the $N-\abs{\varphi}$ trailing 0's of the $N$-digit binary expansion of $\varphi$ now play no further role, it is convenient to shift the starting cell of subsequent machines to the tape cell containing the LSB. To this end, we copy the values $N$ and $N-\abs{\varphi}$ from the input and count tracks onto new auxiliary tracks. We then use a $\TM{Loop}$ machine from \cref{looping2}, which uses the original count track as its input and work track, to run a $\TM{Shift}$ machine from \cref{shift_right} acting on the tracks holding the copies of the count and input tracks. Thus the $\TM{Shift}$ machine will run a total of $N-\abs{\varphi}$ times, thereby shifting the binary strings on the copies so that they start in the $N-\abs{\varphi}$'th cell -- the one containing the LSB of $\abs{\varphi}$ in the quantum track. We then run a trivial TM that steps the head right over the initial string of $\ket{0}$s on the quantum track, until it encounters the first $\ket{1}$ identifying the LSB, and halts with the head at this LSB cell. When we refer to the input and count tracks in the following section, we mean the copies shifted to start at the LSB cell. (At the very end of the computation, we will uncompute the shifted copies of the count and input tracks and step the head left back to the original starting cell, to ensure the overall QTM remains proper.)

Now, we have been careful to ensure that the head is never moved to a location before the starting cell in any of the reversible and quantum TMs that we have constructed. Furthermore, the section of the complete tape configuration located before the LSB cell is unentangled with the rest (see \cref{eq:LSB}, and note that all tracks other than the quantum track are in classical configurations). Thus, if we start any of our TMs in the LSB cell, it acts as if its input were the section of the tape configuration located after (and including) the LSB cell. We can therefore ignore the tape configuration of the first $N-\abs{\varphi}$ cells in the following section, and restrict our attention to the following $\abs{\varphi}$ cells.



\subsection{QFT stage}\label{sec:QFT_stage}
We are now ready to apply the $\abs{\varphi}$-qubit inverse QFT to the $\abs{\varphi}$-qubit state stored on the quantum track. The inverse QFT circuit on $\abs{\varphi}$ qubits consists of cascades of $cU_{2^{-\abs{\varphi}}}^k$ gates, very reminiscent of the control-$U$ stage we have already implemented (see \cref{fig:QFT_circuit}). The construction will therefore be similar. In the following, as we have shifted the starting cell, we relabel the output qubits and refer to the LSB qubit as the 1st qubit, the last one as the $\abs{\varphi}$'th qubit.

\begin{figure}[htbp]
  \centering
  \mbox{\scriptsize\hspace{5em}
    \Qcircuit @C=.5em @R=1em {
      \lstick{\ket{0} + e^{2\pi i 0.j_1\dots j_n}\ket{1}}
        & \qw & \qw & \qw & \qw & \qw & \qw & \qw & \qw & \qw
        & \gate{U_{2^{-\abs{\varphi}}}^1}
        & \gate{U_{2^{-\abs{\varphi}}}^2}
        & \push{\makebox[2em]{$\dots$}} \qw
        & \gate{U_{2^{-\abs{\varphi}}}^{2^{\abs{\varphi}}}}
        & \gate{\makebox[\totalheightof{$U_{2^{-\abs{\varphi}}}^2$}][c]{$H
            \vphantom{U_{2^{-\abs{\varphi}}}^2}$}}
        & \rstick{\ket{j_1}} \qw \\
      \lstick{\ket{0} + e^{2\pi i 0.j_2\dots j_n}\ket{1}}
        & \qw & \qw & \qw & \qw & \qw
        & \gate{U_{2^{-\abs{\varphi}}}^2}
        & \gate{U_{2^{-\abs{\varphi}}}^{2^{\abs{\varphi}}}}
        & \push{\makebox[2em]{$\dots$}} \qw
        & \gate{\makebox[\totalheightof{$U_{2^{-\abs{\varphi}}}^2$}][c]{$H
            \vphantom{U_{2^{-\abs{\varphi}}}^2}$}}
        & \qw & \qw & \qw & \ctrl{-1} & \qw
        & \rstick{\ket{j_2}} \qw \\
      \vdots\\
      \lstick{\ket{0} + e^{2\pi i 0.j_{n-1}\dots j_n}\ket{1}}
        & \qw & \qw
        & \gate{U_{2^{-\abs{\varphi}}}^{2^{\abs{\varphi}}}}
        & \gate{\makebox[\totalheightof{$U_{2^{-\abs{\varphi}}}^2$}][c]{$H
            \vphantom{U_{2^{-\abs{\varphi}}}^2}$}}
        & \push{\makebox[2em]{$\dots$}} \qw
        & \qw & \ctrl{-2} & \qw & \qw & \qw & \ctrl{-3} & \qw & \qw & \qw
        & \rstick{\ket{j_{N-1}}} \qw \\
      \lstick{\ket{0} + e^{2\pi i 0.j_n}\ket{1}}
        & \qw
        & \gate{\makebox[\totalheightof{$U_{2^{-\abs{\varphi}}}^2$}][c]{$H
            \vphantom{U_{2^{-\abs{\varphi}}}^2}$}}
        & \ctrl{-1} & \qw
        & \push{\makebox[2em]{$\dots$}} \qw
        & \ctrl{-3} & \qw & \qw & \qw & \ctrl{-4} & \qw & \qw & \qw & \qw
        & \rstick{\ket{j_{N-1}}} \qw
    }
  }
  \caption[Quantum phase estimation, inverse QFT stage.]{The inverse QFT stage of the quantum phase estimation circuit (cf.~Fig.~5.1 in~\cite{Nielsen+Chuang}).}
  \label{fig:QFT_circuit}
\end{figure}

In each cascade, we want to apply a $cU_{2^{m-n}} = (cU_{2^{-\abs{\varphi}}})^{2^{\abs{\varphi}+m-n}}$ gate between the $m$'th and $n$'th qubit ($m<n$). Once again, we will use mark and $cU$ looping tracks to hold the input to a $cU_{2^{-\abs{\varphi}}}^k$ machine from \cref{cU_machine}. However, the main loop will now consist of two nested loops: an outer loop to iterate the control qubit $m$ of the $cU_{2^{-\abs{\varphi}}}^{2^{\abs{\varphi}+m-n}}$ gate over each output qubit, and an inner loop to iterate the target qubit $n$ over qubits $m+1$ through $\abs{\varphi}$.

We first run a TM that initialises the mark and $cU$ looping tracks, so that the mark track contains the configuration $ct$ in the first two cells, and the $cU$ looping track contains a string of $\abs{\varphi}-1$ 0's followed by a 1. Note that this initial configuration of the $cU$ looping track is the little-endian binary representation of the number $2^{\abs{\varphi}-1}$. (Constructing a proper normal form, reversible TM that implements all of this is an easy exercise.)

We also use the $\TM{Inc}$ machine from \cref{incrementer} to increment the number $N-\abs{\varphi}$ stored on the count track to $N-\abs{\varphi}+1$. We then run the $\TM{Sub}$ machine from \cref{adder}, with the input and count tracks as the input tracks and the inner looping track as the output track, to write the number $N-(N-\abs{\varphi}+1) = \abs{\varphi}-1$ to the inner looping track.


\paragraph{Inner loop} The inner looping machine is very similar to the main looping machine from the control-$U$ stage. We use a $\TM{Loop}$ machine from \cref{looping2}, with the inner looping track as its input and work track. In each iteration, we first run a TM to divide the value on the $cU$ looping track by 2. (This is simply the reversal $\TM{Dbl}^\dg$ of the machine constructed in \cref{sec:cU_stage_iteration}.) We dovetail this with the $cU_{2^{-\abs{\varphi}}}^k$ machine from \cref{cU_machine}. Finally, we dovetail this with a TM that moves the target marker $t$ on the mark track one cell to the right. (This can be implemented by taking the reversal $\TM{Step}_c^\dg$ of the machine from \cref{sec:cU_stage_iteration} and replacing $c$ with $t$ in its transition rules to give a $\TM{Step}_t^\dg$ machine.)

Assume that the inner looping track is initialised to $\abs{\varphi}-m$, the control and target markers on the mark track are initially over the $m$'th and $m+1$'th qubits, and the $cU$ looping track is initialised to $2^{\abs{\varphi}}$. Then the effect of this inner looping machine is to apply $cU_{2^{m-n}}$ operations between the $m$'th and $n$'th qubit for all $m < n \leq \abs{\varphi}$ -- the cascade of $cU$'s starting from the $m$'th qubit in \cref{fig:QFT_circuit}.

This inner looping TM leaves the mark track in the configuration with a $c$ in the same cell that it started out in, a $t$ in the $\abs{\varphi}+1$'th cell (i.e.\ the cell after the last output qubit), and $2^{m-1}$ written on the $cU$ looping track.(The latter is the configuration consisting of an initial string of 0's, followed by a 1 in the cell containing the $c$ on the mark track.)


\paragraph{Outer loop} For the outer looping machine, we use a $\TM{Loop2}$ machine from \cref{looping2} running on the input and count tracks (which hold the numbers $N$ and $N-\abs{\varphi}+1$, respectively). By \cref{looping2}, this machine will therefore loop $\abs{\varphi}-1$ times.

In each iteration, we first run the inner looping machine. Note that for the first iteration, the auxiliary tracks are already initialised as assumed above for the value $m=1$. We dovetail the this with a simple QTM that applies a Hadamard operation to the current control qubit (the one marked by a $c$ on the mark track).

We then run a TM that changes the 1 on the $cU$ looping track to a 0, shifts the $c$ on the mark track one cell to the right, steps right, and changes $[\#,\#]$ on the mark and $cU$ looping tracks to $[t,0]$. The machine then steps right, changing $\#$ to 0 on the $cU$ looping track as it goes, until it reaches the end of the output qubits. Whereupon it changes $\#$ on the $cU$ looping track to $1$, steps right, and changes the $t$ on the mark track to $\#$. Finally, it returns to its starting cell and halts. (Again, by now, constructing a proper, normal form, reversible TM for this is straightforward.) We dovetail this with the $\TM{Dec}$ TM, acting on the inner looping track.

The effect of all this is to reset the configuration of the auxiliary tracks, ready for the next iteration of the inner loop. The control marker $c$ is shifted to the next qubit along, qubit $m$ say, and the target marker $t$ is placed over the adjacent $m+1$'th qubit. The $cU$ looping track is reset to $2^{\abs{\varphi}-1}$, and the inner looping track is decremented to $\abs{\varphi}-m$, as required. In other words, the auxiliary tracks are initialised to the desired configuration for the new value of $m$.

Thus the outer looping machine runs the inner looping machine $\abs{\varphi}-1$ times for each of the output qubits $m=1\dots \abs{\varphi}-1$. Each time it runs, the inner looping machine applies the desired cascade of $cU$ operations between the $m$'th and $n$'th qubits for all $m < n \leq \abs{\varphi}$. The outer looping machine then applies a final Hadamard operation to the $m$'th qubit, before moving onto the next qubit. One can therefore see that the overall effect is to apply the inverse quantum Fourier Transform circuit to the $\abs{\varphi}$ output qubits.


\subsection{Reset Stage}
\label{sec:reset_stage}
To reset all the auxiliary tracks, we dovetail the outer looping TM with a sequence of TMs that uncompute all the configurations we previously prepared on these tracks.

The first of these TMs changes the $ct$ left on the mark track over the final two qubits to $\#\#$, and changes the final configuration $1;2^{\abs{\varphi}-1}$ of the inner looping and $cU$ looping tracks to the blank configuration. (Note that $2^{\abs{\varphi}-1}$ is the configuration consisting of a leading string of 0's followed by a single 1 on the final output qubit, so is straightforward to reset without any arithmetic computations.)

To reset the final configuration $N;N-\abs{\varphi}+1$ of the input and count tracks, we start by decrementing the count track to $N;N-\abs{\varphi}$ (using $\TM{Dec}$). Recall that we redefined the location of the starting cell before implementing the inverse QFT machine, so that the starting cell became the cell containing the LSB of $\varphi$. We also shifted the copies of the input and count tracks accordingly (\cref{sec:LSB_stage}). We now step the head back to the original starting cell (which is easily located as we left a $\#$ written there on the quantum track, cf.\ \cref{sec:LSB_stage}). We can then run the reversal $\TM{Shift}^\dg$ (constructed using \cref{reversal}) of the machine used in \cref{sec:LSB_stage}, to shift the copies of the input and count tracks used in the QFT stage back left again to the original starting cell, and run the reversal $\TM{Copy}^\dg$ of the copy machines to erase the copies of the input and count tracks.

To erase the original count track, which contains $N-\abs{\varphi}$, we must run the reversal $\TM{Count}^\dg$ that we constructed in \cref{sec:LSB_stage}. (The first $N-\abs{\varphi}$ qubits remain in the $\ket{0}$ state and the LSB qubit in the $\ket{1}$ state, so $\TM{Count}^\dg$ will indeed uncompute $N-\abs{\varphi}$.) Finally, to erase the original input track, we first use the $\TM{Shift}^\dg$ machine from \cref{shift_right} on the \emph{quantum} track, to shift the entire final state of the output qubits left. Note that this will work because the first qubit (the ancilla qubit of the control-$U$ stage) was set to $\#$ in \cref{sec:LSB_stage}. We can then run the reversal $\TM{UtoB}^\dg$ of the unary-to-binary machine from \cref{unary_to_binary}, acting on the quantum track and input track, to uncompute the binary conversion of the unary input encoded in the length of the qubit state. Note that the  $\TM{UtoB}$ machine only checks whether the symbols on the unary track are $\#$ or non-$\#$. So the fact that the configuration of the quantum track is no longer necessarily a string of $N$ $\ket{1}$'s does not matter; all that matters is that it is a string of $N$ non-$\ket{\#}$'s.

The end result of all this is to reset all the auxiliary tracks to the blank state, leaving the output of the inverse QFT circuit stored in the first $N$ cells of the quantum track.


% \subsection{Continuity of transition amplitudes}
% In the construction described above, the transition amplitudes of the QTM depend discontinuously on the parameter $n$ specifying the phase $\varphi$. We supplied our QTM with $U_{2^{-\abs{\varphi}}}$ gates, so some of the transition amplitudes depend on $\abs{\varphi}$. It is worth noting that there is an alternative -- albeit more complicated -- way for the QTM to implement the required $U_{2^{-\abs{\varphi}}}$ gates, which avoids this discontinuity. For simplicity of exposition, rather than delve into the full details of this construction, we only give a sketch here.

% \tobytodo[inline]{Give details of alternative $U_{2^{-\abs{\varphi}}}$ construction using \posscite{Mosca} exact gate synthesis result. This should ultimately give an $h_u$ that depends \emph{continuously} on $\varphi$, and not on $\abs{\varphi}$.}

% A recent exact gate synthesis result by \textcite{Mosca} gives an algorithm that can \emph{exactly synthesise} single-qubit unitaries whose matrix elements lie in the ring $\Z[1/\sqrt{2},i]$. This set of unitaries includes all $U_{2^{-k}}$ rotations. Now, we essentially already computed $\abs{\varphi}$ when we located the LSB of $\varphi$. Feeding this as input to the \textcite{Mosca} algorithm allows us to synthesize $U_{2^{-\abs{\varphi}}}$ without supplying it directly in the transition amplitudes. In this way, the transition amplitudes depend only on $\varphi$, hence are continuous.




\subsection{Analysis}
By dovetailing together the preparation stage (\cref{sec:preparation_stage}), control-$U_\varphi$ stage (\cref{sec:cU_stage}), inverse-QFT stage (\cref{sec:QFT_stage}) and reset stage (\cref{sec:reset_stage}), we have succeeded in constructing a family of well-formed, normal form, unidirectional quantum Turing Machines $P_n$ that behave properly on input $N\ge \abs{\varphi}$ written in unary, and implement the quantum phase estimation algorithm on $N$ qubits for phase $\varphi$. By construction, $P_n$ satisfies \cref{phase-estimation_QTM:fixed_size} of \cref{phase-estimation_QTM}.

Now, we know~\cite{Nielsen+Chuang} that the quantum phase estimation algorithm outputs the exact binary decimal expansion of the phase, as long as we run it on enough qubits to store the entire binary decimal expansion of the phase. Thus for $N\geq\abs{\varphi} = \abs{n}$, the $P_n$ writes out the binary decimal expansion of $\varphi$ to $N$ bits (in little-endian order, padding with 0's as necessary). We choose $\varphi$ to be the rational number whose binary decimal expansion contains the digits of $n$ in reverse order after the decimal, where $n$ indexes $P_n$. So our QTM $P_n$ implements the computation claimed in \cref{phase-estimation_QTM:output} of \cref{phase-estimation_QTM}.

We were careful throughout to keep tight control on the space requirements of the reversible and quantum TMs that we used to construct $P_n$. In fact, none of them used more than $N+3$ space. Finally, all steps of the computation take time $O(\poly N)$, except the $cU_\varphi^k$ and $cU_\varphi^k$ computations, which take time $O(2^N)$. Thus the overall run-time is $O(\poly(N) 2^N)$. Thus $P_n$ fulfils the space and time requirements in  \cref{phase-estimation_QTM:output} of \cref{phase-estimation_QTM}.

The last thing we must check in order to finish the proof of \cref{phase-estimation_QTM} is \cref{phase-estimation_QTM:amplitudes}. But the partial transition function defined so far for $P_n$ satisfies \cref{phase-estimation_QTM:amplitudes}. It is trivial to check that one can complete this to a full transition function, whilst still satisfying \cref{phase-estimation_QTM:amplitudes}. Indeed, by \cref{QTM_transitions} the problem is equivalent to completing an orthonormal set of vectors with coefficients in
\begin{equation}
  \mathcal{S} = \left\{
    0,1,\pm \frac{1}{\sqrt{2}},e^{i\pi\varphi}, e^{i\pi 2^{-\abs{\varphi}}}
  \right\}
\end{equation}
to a full orthonormal basis with coefficients in $\mathcal{S}$. Since any normalised vector with coefficients in $\mathcal{S}$ must be proportional to a vector in the canonical basis $\{e_j\}_j$ or of the form $\frac{1}{\sqrt{2}}(e_j\pm e_k)$, $j\not = k$, the result is immediate. This completes the proof of \cref{phase-estimation_QTM}.

Note that the QTM we have constructed only implements the computation correctly when supplied a valid upper-bound on the number of digits in the binary decimal expansion of the phase. If the input is not actually a correct upper bound, we make no claim about the behaviour of the QTM. (This will be significant later, when we come in \cref{sec:put-together} to bound ground state energies of a Hamiltonian constructed out of this QTM.)



%%% Local Variables:
%%% mode: latex
%%% mode: visual-line
%%% mode: adaptive-wrap-prefix
%%% TeX-master: "spectral-gap"
%%% End:

%  LocalWords:  QTM QTMs TMs Vazirani Kozen Bennet CNOT ccccc CNOTs LSB QFT Hadamards

preliminaries.tex
\section{Preliminaries}
\label{sec:preliminaries}

\subsection{Gapped versus gapless Hamiltonians}
\label{sec:gapped}

The following sets the framework for our analysis and defines the objects and terms used. Let $\Lambda(L):=\{1,\ldots,L\}^2$ be the set of sites (or vertices) of a square lattice of size $L\in\mathbb{N}$, which we assume to be at least $2$. By ${\cal E}\subset\Lambda(L)\times\Lambda(L)$ we denote the set of edges of the square lattice, directed such that $(i,j)\in\cal E$ implies that $j$ lies north or east of $i$. Two cases will be considered: \emph{periodic boundary conditions} where the outer rows and columns are connected along the same direction as well, so that $\Lambda(L)$ becomes a square lattice on a torus, and \emph{open boundary conditions} where these connections are not made.

We assign a Hilbert space $\cH^{(i)}\simeq\C^d$ to each site $i\in\Lambda(L)$ and the tensor product $\bigotimes_{i\in S} \cH^{(i)}$ to any subset $S\subseteq\Lambda(L)$. To every neighbouring pair $(i,j)\in\cal E$, we assign a Hermitian operator $h^{(i,j)}\in\cB(\cH^{(i)}\otimes\cH^{(j)})$ describing the interaction between the sites. In addition, we may assign an on-site Hamiltonian given by a Hermitian matrix $h_1^{(k)}\in\cB(\cH^{(k)})$ to every site $k\in\Lambda(L)$.

Throughout, we consider Hamiltonians that are built up from such nearest-neighbour and possibly on-site terms in a translational invariant way. That is, when identifying Hilbert spaces, $h_1^{(k)}=h_1^{(l)}$ for all $k,l\in\Lambda(L)$ and $h^{(i',j')}=h^{(i,j)}$ if there is a $v\in\mathbb{Z}^2$ so that $(i',j')=(i+v,j+v)$. The total Hamiltonian
\begin{equation}
  H^{\Lambda(L)}:=\sum_{(i,j)\in\mathcal{E}} h^{(i,j)}+\sum_{k\in\Lambda(L)} h_1^{(k)}
\end{equation}
can thus be specified by three Hermitian matrices: a $d\times d$ matrix $h_1$ and two $d^2\times d^2$ matrices $h_{\text{row}}$ and $h_{\text{col}}$, which describe the interactions between neighbouring sites within any row and column respectively.
Hence, it may alternatively be written as
\begin{equation}
  H^{\Lambda(L)} = \sum_{\text{rows}}\sum_{c} h_{\text{row}}^{(c,c+1)} + \sum_{\text{columns}}\sum_{r} h_{\text{col}}^{(r,r+1)} + \sum_{i\in\Lambda(L)} h_1^{(i)}.
\end{equation}
$\max\{\|h_{\text{row}}\|, \|h_{\text{col}}\|, \|h_1\|\}$ is called the local interaction strength of the Hamiltonian and can be normalised to be $1$.

Let $\spec H^{\Lambda(L)} := \{\lambda_0,\lambda_1,\dots\}$ denote the spectrum, i.e.\ the set of eigenvalues of $H^{\Lambda(L)}$ listed in increasing order $\lambda_0\leq\lambda_1\leq\ldots$. For clarity we will sometimes write the Hamiltonian in question as an argument of the eigenvalues. $\lambda_0(H^{\Lambda(L)})$ will be called \emph{ground state energy}, the corresponding eigenvector \emph{ground state} and a Hamiltonian $H^{\Lambda(L)}$ \emph{frustration-free} if its ground state energy is zero while all $h^{(i,j)},h_1^{(k)}$ are positive semi-definite. That is, a ground state of a frustration-free Hamiltonian minimises the energy of each interaction term individually.

The quantity we are interested in is the asymptotic behaviour of the \emph{spectral gap}
\begin{equation}
  \Delta(H^{\Lambda(L)}):= \lambda_1(H^{\Lambda(L)})-\lambda_0(H^{\Lambda(L)})
\end{equation}
in the thermodynamic limit, that is, when $L\rightarrow \infty$. The main result of this paper is, loosely speaking, that it is in general undecidable whether or not this gap closes in the thermodynamic limit. To be more precise we need the following definitions:

\begin{definition}[Gapped]\label{def:gapped}
  We say that a family $\{H^{\Lambda(L)}\}$ of Hamiltonians, as described above, characterises a gapped system if there is a constant $\gamma>0$ and a system size $L_0$ such that for all $L>L_0$, $\lambda_0(H^{\Lambda(L)})$ is non-degenerate and $\Delta(H^{\Lambda(L)})\geq\gamma$. In this case, we say that \emph{the spectral gap is at least $\gamma$}.
\end{definition}

\begin{definition}[Gapless]\label{def:gapless}
  We say that a family $\{H^{\Lambda(L)}\}$ of Hamiltonians, as described above, characterises a gapless system if there is a constant $c>0$ such that for all $\varepsilon>0$ there is an $L_0\in\mathbb{N}$ so that for all $L>L_0$ any point in $[\lambda_0(H^{\Lambda(L)}),\lambda_0(H^{\Lambda(L)})+c]$ is within distance $\varepsilon$ from $\spec H^{\Lambda(L)}$.
\end{definition}

Note that gapped is not defined as the negation of gapless; there are systems that fall into neither class. The reason for choosing such strong definitions is to deliberately avoid ambiguous cases (such as systems with degenerate ground states). A Hamiltonian that is gapped or gapless according to these definitions should be recognised as such throughout the literature. Our constructions will allow us to use these strong definitions, because we are able to guarantee that each instance falls into one of the two classes. Indeed, we could further strengthen the definition of ``gapless'' without changing our undecidability results or their proofs, below, by demanding that $c=c(L)$ grows with $L$ so that $\lim_{L\rightarrow\infty}c(L)=\infty$.

\begin{figure}
  \centering
  \includegraphics[width=0.7\columnwidth]{gapped-gapless}
  \caption[Gapped and gapless]{(a)~A gapped system has a unique ground state $\lambda_0(H)$ and a constant lower-bound $\gamma$ on the spectral gap $\Delta(H)$ in the thermodynamic limit. (b)~A gapless system has continuous spectrum above the ground state in the thermodynamic limit. See \cref{def:gapped,def:gapless} for the precise definitions.}
  \label{fig:gapped-gapless}
\end{figure}



\subsection{Undecidability}
\label{sec:undecidability}

There are two different albeit related notions of undecidability, which we will briefly and informally recall in the following: one, which can be called \emph{axiomatic undecidability}, is more related to mathematical logic whereas the other, which might be called \emph{algorithmic undecidability}, feels more at home in theoretical computer science. For a rigorous introduction and a more detailed discussion of the notions used below we refer to \cite{Bar77}.

A decision problem (i.e. a YES/NO assignment to a each member of a set of inputs) is \emph{algorithmically undecidable} if there is no algorithm that terminates and provides the correct answer upon every input. The notion of an `algorithm' used here is formally defined in terms of Turing machines, but the Church-Turing thesis suggests that any other reasonable formalisation will do as well. A simple but crucial point to note here is that decision problems with only finitely many possible inputs are trivially decidable by case distinction. In particular, single-instance problems like "is the spin-1 anti-ferromagnetic Heisenberg model gapped?" are trivially decidable in the algorithmic sense since either the algorithm "PRINT:'YES'" or the algorithm "PRINT:'NO'" will provide the correct assignment.

This differs from the second notion of axiomatic undecidability, also called \emph{axiomatic independence}. Within a formal system, which comprises a set of axioms together with rules defining formal proofs, a statement is undecidable in the axiomatic sense (or, synonymously, independent) if it can neither be proven nor disproven from the axioms.

There is a simple, but for our purpose important, relation between these two notions of undecidability: if a decision problem is algorithmically undecidable, then for every consistent and recursive formal system in which the problem can be stated, there are infinitely many instances of the problem each of which can neither be proven nor disproven from the axioms. The argument is standard \cite{Poonen}, so we only sketch it here informally. Suppose for contradiction that all but finitely many instances are axiomatically decidable. Since the theorems in our formal system are recursively enumerable, this would imply that there exists an algorithm which runs through all theorems, until either a proof or a disproof is found. The exceptions, since there are finitely many, could be dealt with by case distinction.

In the main part of this paper we prove undecidability of problems concerning the spectral gap, the ground state energy density and other low temperature properties of quantum spin systems in the algorithmic sense. Axiomatic independence then follows as a corollary in the way just stated.



%%% Local Variables:
%%% mode: latex
%%% mode: visual-line
%%% mode: adaptive-wrap-prefix
%%% TeX-master: "spectral-gap"
%%% End:

put-together.tex
\section{Putting it all together}
\label{sec:put-together}


\subsection{Undecidability of the g.s.\ energy density}
\label{sec:gs-energy}
To prove our first main result, \cref{thm:gs_density}, we will prove a sequence of lemmas which allow us to combine together the Hamiltonian constructions from the previous sections, and progressively build up the final Hamiltonian.

We will repeatedly need to refer to 1D translationally-invariant Hamiltonians with a particular set of properties. For conciseness, we will call these ``Gottesman-Irani Hamiltonians'', captured in the following definition:

\begin{definition}[Gottesman-Irani Hamiltonian]\label{def:G-I_Hamiltonian}
  Let $\C^Q$ be a finite-dimensional Hilbert space with two distinguished orthogonal states labelled $\ket{\leftend}$, $\ket{\rightend}$. A \emph{Gottesman-Irani Hamiltonian} is a 1D, translationally-invariant, nearest-neighbour Hamiltonian $H_q(r)$ on a chain of length $r$ with local interaction $h_q\in\cB(\C^Q\ox\C^Q)$, which satisfies the following properties:
  \begin{enumerate}
  \item $h_q\geq 0$.
  \item $\comm{h_q}{\proj{\leftend}\ox\proj{\leftend}} = \comm{h_q}{\proj{\leftend}\ox\proj{\rightend}} = \comm{h_q}{\proj{\rightend}\ox\proj{\leftend}} = \comm{h_q}{\proj{\rightend}\ox\proj{\rightend}} = 0$.
  \item $\lambda_0(r) := \lambda_0(H_q(r)|_\Sbr) < 1$, where $\Sbr$ is the subspace of states with fixed boundary conditions $\ket{\leftend},\ket{\rightend}$ at the left and right ends of the chain, respectively. \label[condition]{G-I_Hamiltonian:bracketed}
  \item $\forall n\in\N: \lambda_0(4^n)\geq 0$, and $\sum_{n=1}^\infty\lambda_0(4^n) < 1/2$. \label[condition]{G-I_Hamiltonian:upper-bound}
  \item $\lambda_0(H_q(r)|_{S_<}) = \lambda_0(H_q(r)|_{S_>}) = 0$, where $S_<$ and $S_>$ are the subspaces of states with, respectively, a $\ket{\leftend}$ at the left end of the chain or a $\ket{\rightend}$ at the right end of the chain. \label[condition]{G-I_Hamiltonian:0-energy}
  \end{enumerate}
\end{definition}


\begin{figure}[htbp]
  \centering
  \includegraphics[scale=.25]{Robinson+QTM_large}
  \caption[Gottesman-Irani / Robinson ``sandwich''.]{Intuition behind construction in \cref{tiling+quantum}: we ``sandwich'' together a Gottesman-Irani Hamiltonian and the Robinson tiling Hamiltonian, so that computational history states are forced to appear in the ``top'' layer above every every square border in the Robinson tiling of the ``bottom'' layer.}
  \label{fig:tiling+quantum}
\end{figure}


\begin{lemma}[Tiling + quantum layers]\label{tiling+quantum}
  Let $h_c^{\mathrm{row}},h_c^{\mathrm{col}}\in\cB(\C^C\ox\C^C)$ be the local interactions of a 2D tiling Hamiltonian $H_c$, with two distinguished states (tiles) $\ket{L},\ket{R}\in\C^C$. Let $h_q\in\cB(\C^Q\ox\C^Q)$ be the local interaction of a Gottesman-Irani Hamiltonian $H_q(r)$, as in \cref{def:G-I_Hamiltonian}. Then there is a Hamiltonian on a 2D square lattice with nearest-neighbour interactions $h^\mathrm{row},h^\mathrm{col}\in\cB(\C^{C+Q+1}\ox\C^{C+Q+1})$ with the following properties: For any region of the lattice, the restriction of the Hamiltonian to that region has an eigenbasis of the form $\ket[c]{T}\ox\ket[q]{\psi}$, where $\ket[c]{T}$ is a \emph{product} state representing a classical configuration of tiles. Furthermore, for any given $\ket[c]{T}$, the lowest energy choice for $\ket[q]{\psi}$ consists of ground states of $H_q(r)$ on segments between sites in which $\ket[c]{T}$ contains an $\ket{L}$ and an $\ket{R}$, a 0-energy eigenstate on segments between an $\ket{L}$ or $\ket{R}$ and the boundary of the region, and $\ket{0}$'s everywhere else.
\end{lemma}

\begin{proof}
  The idea is to sandwich the two Hamiltonians $H_c$ and $H_q$ together in two ``layers'', so that the overall Hamiltonian acts as $H_c$ on the $c$-layer, with constraints between the layers that force low-energy configurations of the $q$-layer to be in the auxiliary $\ket{0}$ ``blank'' state, \emph{except} between pairs of $\ket{L}$ and $\ket{R}$ states appearing in the same row of the $c$-layer, where the $q$-layer acts like $H_q$ on that line segment. (See \cref{fig:tiling+quantum}.)

  To this end, define the local Hilbert space to be $\HS := \HS_c\ox(\HS_e\oplus\HS_q) \simeq \C^C\ox(\ket{0}\oplus\C^Q)$. The Hamiltonian $H$ is defined in terms of the two-body interactions as follows:
  \begin{subequations}\label{TQ:overall_H}
  \begin{align}
    h^{\mathrm{col}}_{j,j+1} =
      \label[term]{TQ:cols} &h_c^{\mathrm{col}}\ox \id_{eq}^{(j)} \ox \id_{eq}^{(j+1)}\\
    h^{\mathrm{row}}_{i,i+1} =
      \label[term]{TQ:Hc}   &h_c^{\mathrm{row}}\ox\id_{eq}^{(i)}\ox\id_{eq}^{(i+1)}\\
      \label[term]{TQ:Hq}   &+\id_c^{(i)}\ox\id_c^{(i+1)}\ox h_q\\
      % force < above L
      \label[term]{TQ:<L}   &+\proj[c]{L}^{(i)} \ox (\id_{eq}-\proj{\leftend})^{(i)}
                              \ox \id_{ceq}^{(i+1)}\\
      %force L below <
      \label[term]{TQ:L<}   &+(\id_c- \proj[c]{L})^{(i)} \ox \proj{\leftend}^{(i)}
                              \ox \id_{ceq}^{(i+1)}\\
      % force > above R
      \label[term]{TQ:>R}   &+\id_{ceq}^{(i)} \ox \proj[c]{R}^{(i+1)}
                              \ox (\id_{eq} - \proj{\rightend})^{(i+1)}\\
      % force R below >
      \label[term]{TQ:R>}   &+\id_{ceq}^{(i)}
                              \ox (\id_c-\proj[c]{R})^{(i+1)}
                              \ox\proj{\rightend}^{(i+1)}\\
      % force non-blank in q-layer to left of R in c-layer
      \label[term]{TQ:1R}   &+\id_c^{(i)} \ox \proj[e]{0}^{(i)}
                              \ox \proj[c]{R}^{(i+1)} \ox \id_{eq}^{(i+1)}\\
      % force non-blank in q-layer to right of L in c-layer
      \label[term]{TQ:L1}   &+\proj[c]{L}^{(i)} \ox \id_{eq}^{(i)}
                             \ox\id_c^{(i+1)} \ox \proj[e]{0}^{(i+1)}\\
      % forbid non-blank to right of blank in q-layer except over L
      \label[term]{TQ:10-a} &+\id_c^{(i)} \ox \proj[e]{0}^{(i)}
                              \ox (\id_c-\proj[c]{L})^{(i+1)}
                              \ox (\id_{eq}-\proj[e]{0})^{(i+1)}\\
      % forbid non-blank to left of blank in q-layer except over R
      \label[term]{TQ:10-b} &+(\id_c-\proj[c]{R})^{(i)}
                              \ox (\id_{eq}-\proj[e]{0})^{(i)}
                              \ox\id_c^{(i+1)} \ox \proj[e]{0}^{(i+1)},
  \end{align}
  \end{subequations}
  where $\id_c$, $\id_{eq}$ and $\id_{ceq}$ are the identity operators on the corresponding Hilbert spaces. The Hamiltonian can be understood as follows. \Cref{TQ:L<,TQ:<L} force a $\ket{\leftend}$ in the $q$-layer whenever there is an $\ket{L}$ in the $c$-layer. \Cref{TQ:>R,TQ:R>} do the same with $\ket{\rightend}$ and $\ket{R}$. \Cref{TQ:1R,TQ:L1} force non-blank to the left and right of an $\ket{R}$ or $\ket{L}$, respectively. Finally, \cref{TQ:10-a,TQ:10-b} force a non-blank to the left and right of any other non-blank in the $q$-layer, except when a non-blank coincides with an $\ket{L}$ or $\ket{R}$ in the $c$-layer.

  Since $h_c$ is a tiling Hamiltonian, \cref{TQ:Hc} is by assumption diagonal in the canonical product basis on $\HS_c^{\ox 2}$ (and acts trivially on $(\HS_q\oplus\HS_e)^{\ox 2}$). Meanwhile, \cref{TQ:Hq} is block-diagonal with respect to the four one-dimensional subspaces of $\HS_q^{\ox 2}$ spanned by products of $\ket{\leftend}$ and $\ket{\rightend}$, together with the orthogonal complement thereof. (\Cref{TQ:Hq} acts trivially on $\HS_c^{\ox 2}$.) The remaining terms are manifestly block-diagonal with respect to both of these decompositions simultaneously. The overall Hamiltonian is therefore block-diagonal w.r.t.\ the product basis on the $c$-layer. Hence there is a basis of eigenstates of $H$ of the form $\ket[c]{T}\ket[q]{\psi}$, where $\ket[c]{T}$ is a product state in the canonical basis of the $c$-layer. This proves the first claim of the \namecref{tiling+quantum}.

  For a given classical tile configuration $\ket[c]{T}$ on the $c$-layer, let $\mathcal{L}$ denote the set of all horizontal line segments $\ell$ that lie between an $\ket{L}$ and an $\ket{R}$ (inclusive) in the classical configuration $\ket[c]{T}$. Let $\mathcal{L}_L$ denote the set of all horizontal line segments between an $L$ and the right boundary of the region, and similarly $\mathcal{L}_R$ the segments between the left boundary and an $R$.

  Consider first a state $\ket[q]{\psi_0}$ consisting of the ground state of $H_q(\ell)$ in the $q$-layer for each $\ell\in \mathcal{L}$, a 0-energy eigenstate of $H_q(\ell)$ in the $q$-layer for each $\ell\in\mathcal{L}_R\cup\mathcal{L}_R$, and $\ket{0}$ everywhere else in the $q$-layer. The associated energy $\bra[c]{T}\bra[q]{\psi_0}|H|\ket[c]{T}\ket[q]{\psi_0}$ is clearly $\braket{T|H_c|T} + \sum_\mathrm{\ell\in\mathcal{L}} \lambda_0(\abs{\ell})$. Indeed $\braket{T|H_c|T}$ is the contribution of \cref{TQ:cols,TQ:Hc}, and $\sum_\mathrm{\ell\in\mathcal{L}} \lambda_0(\abs{\ell})$ the contribution of \cref{TQ:Hq}, the rest of the terms being~$0$ as $\ket[c]{T}\ket[q]{\psi_0}$ satisfies all constraints imposed by \crefrange{TQ:<L}{TQ:10-b}.

  To see that this is the lowest energy state for a given classical configuration on the $c$-layer, we define a signature $\sigma$ for each state in the canonical basis of the $q$-layer. The local Hilbert space at site $i$ in the $q$-layer is $\HS_e\oplus\HS_q$, so we assign $\sigma_i=0$ for states in $\HS_e$ and $\sigma_i=1$ for states in $\HS_q$. By collecting computational basis states with the same signature, we decompose $\HS_q$ into a direct sum of subspaces with given signature,
  \begin{equation}
    \bigotimes_{i\in\Lambda}\HS_q^{(i)}\simeq\bigoplus_{\sigma}\HS_\sigma.
  \end{equation}
  The overall Hamiltonian $H$ is block-diagonal with respect to this decomposition, so all eigenstates $\ket[c]{T}\ket[q]{\psi}$ have a $\ket[q]{\psi}$ part with well-defined signature. We distinguish two cases:

  \paragraph{Case 1:} $\sigma_i= 1$ for all $i\in \ell\in \mathcal{L}$. Consider a $q$-layer state $\ket[q]{\psi_\sigma}$ with this signature; that is, a state supported on the corresponding Hilbert space $H_\sigma$. Since all Hamiltonian terms \crefrange{TQ:<L}{TQ:10-b} are $\ge 0$, and for all $\ell\in \mathcal{L}$ the \cref{TQ:Hq} contribution is $\ge \lambda_0(\abs{\ell})$, we easily get that $\bra[c]{T}\bra[q]{\psi_\sigma} H \ket[c]{T}\ket[q]{\psi_\sigma} \ge \braket{T|H_c|T} + \sum_\mathrm{\ell\in\mathcal{L}} \lambda_0(\abs{\ell})$, with equality iff $\ket[q]{\psi_\sigma} = \ket[q]{\psi_0}$.

  \paragraph{Case 2:} There exists $i\in \ell\in \mathcal{L}$ such that $\sigma_i=0$. Let $j$ be the rightmost position in $\ell$ such that $\sigma_j=0$. If this is the right or left end of $\ell$, then the state picks up an energy contribution of~$1$ from \cref{TQ:<L} or \cref{TQ:>R}. If it is the position next to the right or left end, it picks up a contribution of~$1$ from from \cref{TQ:1R} or \cref{TQ:L1}. Finally, if it is not one of the above cases, it acquires a contribution of~$1$ from \cref{TQ:10-b}. In all cases, the contribution is $\geq \lambda_0(\abs{\ell})$ since $\lambda_0(\abs{\ell}) < 1$ by assumption for a Gottesman-Irani Hamiltonian (see \cref{def:G-I_Hamiltonian}). As all terms in the Hamiltonian apart from \cref{TQ:cols,TQ:Hc} are positive-semidefinite, and the contribution from \cref{TQ:cols,TQ:Hc} is $\braket{T|H_c|T}$, we have that $\bra[c]{T}\bra[q]{\psi_\sigma} H \ket[c]{T}\ket[q]{\psi_\sigma} \ge \braket{T|H_c|T} + \sum_\mathrm{\ell\in\mathcal{L}} \lambda_0(\abs{\ell})$, which completes the proof of the \namecref{tiling+quantum}.
\end{proof}


With this, we can now prove the following:
\begin{lemma}[Robinson + Gottesman-Irani Hamiltonian]
  \label{put-promise-together} \hfill\newline
  Let $h_c^{\mathrm{row}},h_c^{\mathrm{col}}\in\cB(\C^C\ox\C^C)$ be the local interactions of the tiling Hamiltonian associated with the modified Robinson tiles. For a given ground state configuration (tiling) of $H_c$, let $\mathcal{L}$ denote the set of all horizontal line segments of the lattice that lie between down/right-facing and down/left-facing red crosses (inclusive).
  Let $h_q\in\cB(\C^Q\ox\C^Q)$ be the local interaction of a Gottesman-Irani Hamiltonian $H_q(r)$, as in \cref{def:G-I_Hamiltonian}.
  % Let $h_q\in\cB(\C^Q\ox\C^Q)$ with $h_q\geq 0$ be the local interaction of a 1D Hamiltonian $H_q(r)$ on a chain of length $r$. Let $\lambda_0(r) := \lambda_0(H_q(r))$ denote its minimum eigenvalue with fixed boundary conditions $\ket{\leftend},\ket{\rightend}$ at the left and right ends of the chain. Assume that $\lambda_0(4^n)\geq 0$ for all $n$, and $\sum_{n=1}^\infty\lambda_0(4^n) < 1/2$. Assume further that $H_q(r)$ has a 0-energy eigenstate if only one of the boundaries is fixed to be $\ket{\leftend}$ or $\ket{\rightend}$.

  Then there is a Hamiltonian on a 2D square lattice of width $L$ and height $H$ with nearest-neighbour interactions $h^\mathrm{row},h^\mathrm{col}\in\cB(\C^{C+Q+1}\ox\C^{C+Q+1})$ such that, for any $L,H$, the ground state energy
  \begin{equation}
    \lambda_0(H^{\Lambda(L)})
    = \min_{\mathcal{L}\subset\Lambda(L)} \sum_{\ell\in\mathcal{L}} \lambda_0(\abs{\ell}),
  \end{equation}
  where the minimisation is over all valid tilings of the $L\times H$ rectangle.
\end{lemma}

\begin{proof}
  Construct the Hamiltonian $H$ as in \cref{tiling+quantum}, with the red down/right- and down/left-facing crosses from the modified Robinson tile set as the designated $\ket{L}$ and $\ket{R}$ states.

  The tiling and QTM Hamiltonians satisfy the requirements of \cref{tiling+quantum}, implying that the lowest energy for a given $c$-layer configuration is attained by putting $\ket{0}$'s in the $q$-layer everywhere except in the segments between an $\ket{L}$ and an $\ket{R}$, inclusive. In the modified Robinson tiling, these are exactly the $4^n$\nobreakdash-segments. Therefore, to bound the ground state energy, we can restrict our attention to classical configurations of Robinson tiles (not necessarily valid tilings) with an eigenstate of $h_q$ along each $4^n$\nobreakdash-segment.

  By \cref{defect-free}, the minimum energy of an eigenstate with a defect-free Robinson tiling on the $L\times H$ rectangle is
  \begin{equation}
    E(0 \text{ defects})
    = \sum_{\ell\in\mathcal{L}}\lambda_0(\abs{\ell})
    = \sum_{n=1}^{\lfloor\log_4(L/2)\rfloor}
      \left(
        \left\lfloor\frac{H}{2^{2n+1}}\right\rfloor
        \left(\left\lfloor\frac{L}{2^{2n+1}}\right\rfloor -1\right)
      \right)
      \lambda_0(4^n),
  \end{equation}
  where the final sum is over all segment lengths $4^n$. (Recall that we only use the red $4^n$\nobreakdash-segments to define line\nobreakdash-segments on which $h_q$ acts non-trivially.)

  On the other hand, since each defect in the classical tile configuration contributes energy at least~1 from the $h_c$ term, \cref{segment_bound} implies that the energy of an eigenstate with $d$ defects on the $L\times H$ rectangle is at least
  \begin{equation}
    E(d \text{ defects})
    = d + \sum_{\ell\in\mathcal{L}} \lambda_0(\abs{\ell})
    \geq d + \mspace{-20mu} \sum_{n=1}^{\lfloor\log_4(L/2)\rfloor}
         \Biggl(
           \left\lfloor\frac{H}{2^{2n+1}}\right\rfloor
           \left(\left\lfloor\frac{L}{2^{2n+1}}\right\rfloor -1\right)
           - 2d
         \Biggr) \lambda_0(4^n).
  \end{equation}
  %
  Since $\sum_r\lambda_0(r) < 1/2$ by assumption for a Gottesman-Irani Hamiltonian (see \cref{def:G-I_Hamiltonian}), we have for all $d>0$
  \begin{equation}
    %\begin{split}
      E(d \text{ defects}) - E(0 \text{ defects})
      \geq d\,\biggl(1 - 2\sum_{n=1}^{\mathclap{\lfloor\log_4(L/2)\rfloor}}
            \lambda_0(4^n)\biggr)
      %\geq d\,\biggl(1 - 2\sum_{n=1}^\infty\lambda_0(4^n)\biggr)\\
      > 0.
    %\end{split}
  \end{equation}
  Therefore, the lowest energy eigenstate always contains a defect-free tiling, and the \nameCref{put-promise-together} follows.
\end{proof}


We can now apply this \namecref{put-promise-together} to construct a Hamiltonian $h_u$ with ground state energy that is undecidable even with a constant promise on the energy gap.

\begin{proposition}[Diverging g.s.\ energy]
  \label{diverging_Hu} \hfill\newline
  There exists a family of interactions $h_u^{row}(n), h_u^{col}(n)\in \cB(\C^U\otimes \C^U)$ and $h_u^{(1)}(n) \in \cB(\C^U)$ with operator norm $\le \frac{1}{2}$ and algebraic matrix entries, and strictly positive functions $\alpha_1^l(n),\alpha_0(n),\delta_2(n),\alpha_1^u(n),\delta_1(n)$ (where the $\alpha$ functions are computable and the $\delta$ functions are uncomputable), such that either $\lambda_0(H_u^{\Lambda(L)}(n)) = -L\alpha_1^l(n) + \alpha_0(n)$, or $\lambda_0(H_u^\Lambda(n)) = L^2\delta_2(n) - L\bigl[\alpha_1^u(n) + \delta_1(n)\bigr]$, but determining which is undecidable.

  Moreover,  the interactions can be taken to have the following form: $h^{(1)}_u(n)=\alpha_2(n)\1$ with  $\alpha_2(n)$ an algebraic computable number,
  $h^{row}_u(n)$  $\{0,\beta\}$-valued and independent of $n$ and
  $$h^{col}_u(n)=\beta \left(A+e^{i\pi\varphi} B+e^{i\pi2^{-\abs{\varphi}}} C\right) + h.c..$$
  where $A\in \cB(\C^U\otimes \C^U)$ is independent of $n$ and has coefficients in $\Z+\frac{1}{\sqrt{2}}\Z$,  $B,C\in \cB(\C^U\otimes \C^U)$ are independent of $n$ and have coefficients in $\Z$, and $\beta\in \Q$  is independent of $n$. Recall that $\varphi$ is defined as the rational number whose binary decimal expansion contains the digits of $n$ in reverse order after the decimal.
\end{proposition}

\begin{proof}
  Let $h_{q\mathit{0}}$ be the Hamiltonian obtained by applying \cref{QTM_in_local_Hamiltonian} with $K=3$ to the QTM from \cref{phase-estimation_QTM} with a proper reversible universal TM dovetailed after it. The Hamiltonian $h_q(n)$ in \cref{put-promise-together} will then be $h_q(n) = h_{q\mathit{0}}(n) + \proj{\top}\ox\id + \id\ox\proj{q_f}$, where $\ket{\top}$ is the halting state of the universal TM. $h_q$ has clearly the form given in \cref{QTM_in_local_Hamiltonian:explicit-form} of \cref{QTM_in_local_Hamiltonian}. We claim that this Hamiltonian is a Gottesman-Irani Hamiltonian according to \cref{def:G-I_Hamiltonian}.

  The only requirements in \cref{def:G-I_Hamiltonian} that are not immediate are those concerning the minimum eigenvalues restricted to various subspaces. Recall the construction of the computational history state Hamiltonian from \cref{QTM_in_local_Hamiltonian}. In the initialisation sweep, the $\arrRzero$ normally sweeps once from left-to-right along the chain, turns around at the $\rightend$ to become a $\arrLzero$, which sweeps once right-to-left back along the chain. The superpositions over the standard basis states in these sequences contain no illegal pairs as long as the other tracks are initialised correctly.
  %
  However, if the $\rightend$ is missing, then when the $\arrRzero$ reaches the right end of the chain, there is no forward transition out of the resulting state. Thus the uniform superposition over the first part of the initialisation sweep, involving just the left-to-right sweep, is an eigenstate of $h_q$. Furthermore, it has 0~energy if the rest of the tracks are correctly initialised. Similarly, if the $\leftend$ is missing, there is no further forward transition once the $\arrLzero$ reaches the left end of the chain, and the superposition over the full initialisation sweep is a 0-energy eigenstate of $h_q$. Thus \cref{G-I_Hamiltonian:0-energy} of \cref{def:G-I_Hamiltonian} is satisfied.

  Let $\ket{\psi} = \frac{1}{\sqrt{T}}\sum_{t=1}^T\ket{\phi_t}\ket{\psi_t}$ be the normalised computational history state for the QTM, where $T = \Omega(\abs{\Sigma\times Q}^r)$ and $\ket{\psi_t}$ is the state encoding the $t$'th step of the computation. Note that $\ket{\psi}$ is a zero-energy eigenstate of $H_{q\mathit{0}}$, and at most one $\ket{\psi_t}$ can have support on the state $\ket{\top}$ that represents the halting state of the universal TM, by \cref{QTM_in_local_Hamiltonian}. For $r>2$, we have
  \begin{equation}
    \begin{split}
      \lambda_0(r) &\leq \braket{\psi|H_q(r)|\psi}
      = \braket{\psi | \left( \sum_i h_{q\mathit{0}}^{(i,i+1)}(n) + \proj[i]{\top}\ox\id_{i+1}
                       + \id_i\ox\proj[i+1]{\top} \right) | \psi}\\
      &= \sum_{t=1}^T \frac{1}{T}
         \braket{\psi_t | \left( \sum_i \proj[i]{\top}\ox\id_{i+1} + \id_i\ox\proj[i+1]{\top} \right)
           | \psi_t}
      \leq O\left(\frac{1}{\abs{\Sigma\times Q}^r}\right),
      % \leq \frac{1}{4^{r-2}}
    \end{split}
  \end{equation}
  %since the QTM has substantially more than two internal states and two symbols.
  thus $\sum_{m=1}^\infty \lambda_0(4^m) < 1/2$. The remaining \cref{G-I_Hamiltonian:bracketed,G-I_Hamiltonian:upper-bound} of \cref{def:G-I_Hamiltonian} are therefore also satisfied. Hence $h_q(n)$ is a Gottesman-Irani Hamiltonian, as claimed.

  Let $\tilde{h}_u^{\text{row}}(n),\tilde{h}_u^{\text{column}}(n)$ be the local interactions obtained by applying \cref{put-promise-together} to $h_q(n)$. Let $N(n) := \max\{\norm{h^{row}(n)},\norm{h^{col}(n)}\}$, and take a rational number $\beta\le \frac{1}{N(n)}$ for all $n$. Such $\beta$ exists by the form of $h_q$ guaranteed by \cref{QTM_in_local_Hamiltonian:explicit-form} in \cref{QTM_in_local_Hamiltonian} and the definition of $\tilde{h}_u^{\text{row}}(n),\tilde{h}_u^{\text{column}}(n)$ based on $h_q$. Define the normalised local interactions $h_u^{\text{row}}(n) := \beta \tilde{h}_u^{\text{row}}(n)$, $h_u^{\text{column}}(n) := \beta \tilde{h}_u^{\text{column}}(n)$.

  For any $r\geq\abs{n}+6$, the QTM from \cref{phase-estimation_QTM} has sufficient tape and time to finish, and we can be sure that the reversible universal TM starts. If the universal TM does \emph{not} halt on input $n$, then for all $r\geq\abs{n}+6$ we have that $\lambda_0(r)=0$. By \cref{defect-free}, the minimum number of $r$-segments in any tiling of an $L\times L$ square (for $r=4^m$, $m\in\N$) is $\lfloor L/2r\rfloor \left(\lfloor L/2r\rfloor-1\right)$ (and this minimum can be attained for all $r$ simultaneously). Hence, as long as we take $L\ge L_0(n)$ where $L_0(n)$ is the minimal $L$ such that the modified Robinson tiling of $\Lambda(L)$ necessarily contains a $4^m$-segment of size $4^m \ge \abs{n}+6$, then \cref{put-promise-together} gives a ground state energy for $H^{\Lambda(L)}(n)$ of
  \begin{subequations}
  \begin{align}
    \lambda_0(H^{\Lambda(L)})
    &= \beta \min_{\mathcal{L}\subset\Lambda(L)} \sum_{\ell\in\mathcal{L}}
      \lambda_0(\abs{\ell}) \;\;\;
    = \beta\sum_{\substack{1\le r \le \abs{n}+6\\ r=4^m,\; m\in\N}}
        \left\lfloor\frac{L}{2r}\right\rfloor
        \left(\left\lfloor \frac{L}{2r}\right\rfloor-1\right) \lambda_0(r)\\[1em]
    &= L^2 \Biggl[ \beta
             \sum_{\substack{1\le r \le \abs{n}+6\\ r=4^m,\; m\in\N}}
             \frac{\lambda_0(r)}{4r^2}
           \Biggr]\;\;
       - \;\; L \Biggl[ \beta
                  \sum_{\substack{1\le r \le \abs{n}+6\\ r=4^m,\; m\in\N}}
                   \frac{\lambda_0(r)}{2r}
                   \left(2\rem\left(\frac{L}{2r}\right) + 1\right)
                \Biggr]
          \notag\\
       &\mspace{50mu}
       + \Biggl[ \beta
           \sum_{\substack{1\le r \le \abs{n}+6\\ r=4^m,\; m\in\N}}
           \lambda_0(r) \rem\left(\frac{L}{2r}\right)
           \left(\rem\left(\frac{L}{2r}\right) + 1\right)
         \Biggr]\\[1em]
    &=: L^2\,\alpha_2(n) - L\,\alpha_1(n,L) + \alpha_0(n,L)\,,
  \end{align}
  \end{subequations}
  where $\rem(x):=x-\lfloor x\rfloor$ denotes the fractional part of $x$. Note that the number of terms in the sums are finite, and for all finite $r$ the quantity $\lambda(r)$ is an eigenvalue of a finite-dimensional matrix. Therefore, $\alpha_2(n)$ is always a computable algebraic number. We also have
  \begin{gather}
    \alpha_1^l(n)
      := \beta \sum_{\substack{1\le r \le \abs{n}+6\\ r=4^m,\; m\in\N}}
        \frac{\lambda_0(r)}{2r}
      \leq \alpha_1(n,L)
      < \beta \sum_{\substack{1\le r \le \abs{n}+6\\ r=4^m,\; m\in\N}}
        \frac{3\lambda_0(r)}{2r}
      =:\alpha_1^u(n),\\
    0 \leq \alpha_0(n,L)
      \leq \beta \sum_{\substack{1\le r \le \abs{n}+6\\ r=4^m,\; m\in\N}}
        \frac{\lambda_0(r)}{r}
      =: \alpha_0(n).
  \end{gather}

  If the universal TM \emph{does} halt on input $n$, then for any $r$ larger than the size of tape needed to halt it is clear that $\lambda_0(r)>0$. This follows immediately from the fact that the computational history state encoding the evolution (which necessarily has support on $\ket{\top}$) is the unique ground state of $h_{q\mathit{0}}$, and $h_{q\mathit{0}}\ge 0$. Let $r_1(n)$ be the minimal such $r$ of the form $4^m$. Then by \cref{put-promise-together}, the ground state energy of $H^{\Lambda(L)}$ is
  \begin{subequations}
  \begin{align}
    \lambda_0(H^{\Lambda(L)})
    &= \beta \min_{\mathcal{L}\subset\Lambda(L)} \sum_{\ell\in\mathcal{L}}
                   \lambda_0(\abs{\ell})\\
    &= \beta \sum_{\substack{1\le r \leq \abs{n}+6\\ r=4^m,\; m\in\N}}
        \left\lfloor\frac{L}{2r}\right\rfloor
        \left(\left\lfloor \frac{L}{2r}\right\rfloor-1\right)
        \lambda_0(r) \;\;\;
      + \beta\sum_{\substack{r \geq r_1(n)\\ r=4^m,\; m\in\N}}
        \left\lfloor\frac{L}{2r}\right\rfloor
        \left(\left\lfloor \frac{L}{2r}\right\rfloor-1\right)
        \lambda_0(r) \\
    &=L^2 \left(
        \alpha_2(n)
        +\beta\sum_{\substack{r \geq r_1(n)\\ r=4^m,\; m\in\N}}
          \frac{\lambda_0(r)}{4r^2}
      \right)\;\;
      - \;\; L \left( \alpha_1(n)
        +\beta\sum_{\substack{r \geq r_1(n)\\ r=4^m,\; m\in\N}}
          \frac{\lambda_0(r)}{2r}
          \left(2\rem\left(\frac{L}{2r}\right) + 1\right)
      \right)\notag\\
      &\mspace{50mu}
      + \left( \alpha_0(n)
        +\beta\sum_{\substack{r \geq r_1(n)\\ r=4^m,\; m\in\N}}
          \lambda_0(r) \rem\left(\frac{L}{2r}\right)
          \left(\rem\left(\frac{L}{2r}\right) + 1\right)
      \right)\\[1em]
    &=: L^2\bigl[\alpha_2(n) + \delta_2(n)\bigr]
        - L \bigl[\alpha_1(n,L) + \delta_1(n,L)\bigr]
        + \alpha_0(n,L) + \delta_0(n,L).
  \end{align}
  \end{subequations}
  Note that $\delta_2(n) > 0$, since in the halting case $\lambda_0(r) > 0$ for all $r\geq r_1(n)$, and
  \begin{gather}
    \beta\sum_{\substack{r \geq r_1(n)\\ r=4^m,\; m\in\N}}
        \frac{\lambda_0(r)}{2r}
      \leq \delta_1(n,L)
      < \beta  \sum_{\substack{r \geq r_1(n)\\ r=4^m,\; m\in\N}}
        \frac{3\lambda_0(r)}{2r}
      =: \delta_1(n),\\
    0 \leq \delta_0(n,L)
      \leq \beta \sum_{\substack{r \geq r_1(n)\\ r=4^m,\; m\in\N}}
        \frac{\lambda_0(r)}{r}
      := \delta_0(n).
  \end{gather}

  We now modify $h(n)$ by adding the 1-body term $h_u^{(1)}=-\alpha_2(n)\id$ acting at each site. The ground state energy of $H^{\Lambda(L)}$ is simply shifted by exactly $-L^2 \alpha_2(n)$, so in the non-halting case we have
  \begin{equation}\label{eq:alpha}
    \lambda_0(H^{\Lambda(L)}) = -L\alpha_1(n,L) + \alpha_0(n,L)
      \leq -L\alpha_1^l(n) + \alpha_0(n).
  \end{equation}
  In the halting case, we have
  \begin{equation}\label{eq:delta}
    \begin{split}
      \lambda_0(H^{\Lambda(L)})
        &=L^2\delta_2(n)
          - L\bigl[\alpha_1(n,L) + \delta_1(n,L)\bigr]
          + \alpha_0(n,L) + \delta_0(n,L)\\
        &\geq L^2\delta_2(n) - L\bigl[\alpha_1^u(n) + \delta_1(n)\bigr].
    \end{split}
  \end{equation}
  The \namecref{diverging_Hu} follows from undecidability of the Halting Problem.
\end{proof}


The following corollary follows immediately by letting $L(n)$ be the minimal $L$ in \cref{diverging_Hu} such that $-L\alpha_1^l(n) + \alpha_0(n) \leq 0$ and $L^2\delta_2(n) - L\bigl[\alpha_1^u(n) + \delta_1(n)\bigr] \geq 1$. This will be useful shortly.

\begin{corollary}[Undecidability of g.s.\ energy with promise]\label{promise_Hu}
  There exists a family of interactions $h_u^{\text{row}}(n), h_u^{\text{col}}(n)\in \cB(\C^U\ox\C^U)$ and $h_u^{(1)}(n)\in\cB(\C^U)$ with operator norm $\le \frac{1}{2}$ and algebraic matrix entries, and an (uncomputable) function $L(n)$, such that either $\lambda_0(H_u^{\Lambda(L)}(n)) \leq 0$ for all $L\ge L(n)$, or $\lambda_0(H_u^\Lambda(n)) \ge 1$ for all $L\ge L(n)$, but determining which is undecidable. Moreover, the interactions can be taken to have the same form as in \cref{diverging_Hu}.
\end{corollary}


Undecidability of the ground state energy density is now immediate from \cref{diverging_Hu} by the definition $E_\rho := \lim_{L\rightarrow\infty}\lambda_0(H^{\Lambda(L)})/L^2$ of the ground state energy density. We restate this result here for convenience:

% hack to generate entry in List of Theorems
\makeatletter
\@ifundefined{r@thm:gs_density@cref}{}{
  \setcounter{tmpcounter}{\value{theorem}}
  \cref@getlabel{thm:gs_density}{\@tempa}
  \def\@tempb{\setcounter{theorem}}
  \expandafter\@tempb\expandafter{\@tempa}
  \addtheoremline{theorem}{Undecidability of g.s.\ energy density -- restated}
  \setcounter{theorem}{\value{tmpcounter}}}
  \addtocounter{theorem}{-1}
\makeatother

\begin{reptheorem}{thm:gs_density}
  Let $d\in\mathbb{N}$ be sufficiently large but fixed, and consider translationally-invariant nearest-neighbour Hamiltonians on a 2D square lattice with open boundary conditions, local Hilbert space dimension $d$, algebraic matrix entries, and local interaction strengths bounded by~1. Then determining whether $E_\rho=0$ or $E_\rho>0$ is an undecidable problem.
\end{reptheorem}




\subsection{From g.s.\ energy density to spectral gap}
\label{sec:spectral-gap}
We are finally in a position to prove our main result: undecidability of the spectral gap, which we restate here for convenience.
Recall that for each natural number $n$, we define $\varphi=\varphi(n)$ to be the rational number whose binary decimal expansion contains the digits of $n$ in reverse order after the decimal.


% hack to generate entry in List of Theorems
\makeatletter
\@ifundefined{r@thm:promise@cref}{}{
  \setcounter{tmpcounter}{\value{theorem}}
  \cref@getlabel{thm:promise}{\@tempa}
  \def\@tempb{\setcounter{theorem}}
  \expandafter\@tempb\expandafter{\@tempa}
  \addtheoremline{theorem}{Undecidability of the spectral gap (restated)}
  \setcounter{theorem}{\value{tmpcounter}}}
  \addtocounter{theorem}{-1}
\makeatother

\begin{reptheorem}{thm:promise}
  \label{repthm:promise}
  We construct explicitly a dimension $d$, $d^2\times d^2$ matrices $A,B,C,D$ and a rational number $\beta$ so that
  \begin{enumerate}
  \item $A$ is Hermitian and with coefficients in $\Z+\beta \Z+ \frac{\beta}{\sqrt{2}}\Z$,
  \item $B,C$ have integer coefficients,
  \item $D$ is Hermitian and with coefficients in $\{0,1,\beta\}$.
  \end{enumerate}
  For each natural number $n$, define:
  \begin{align*}
    h_1(n)&=\alpha_2(n)\1\quad  \text{($\alpha_2(n)$ an algebraic number)}\\
    h_{\text{row}}(n)&=D\quad \text{(independent of $n$)}\\
    h_{\text{col}}(n)&=A + \beta\left(e^{i\pi\varphi} B + e^{-i\pi\varphi} B^\dg + e^{i\pi2^{-\abs{\varphi}}} C + e^{-i\pi2^{-\abs{\varphi}}} C^\dg\right).
  \end{align*}
  Then:
  \begin{enumerate}
  \item The local interaction strength is $\le 1$. I.e.\ all terms $h_1(n), h_{\text{row}}(n), h_{\text{col}}(n)$ have operator norm bounded by $1$.
  \item If UTM halts on input $n$, then the associated family of Hamiltonians $\{H^{\Lambda(L)}(n)\}$ is gapped in the strong sense of \cref{def:gapped} and, moreover, the gap $\gamma\ge 1$.
  \item If UTM does not halt on input $n$, then the associated family of Hamiltonians $\{H^{\Lambda(L)}(n)\}$ is gapless in the strong sense of \cref{def:gapless}.
  \end{enumerate}
\end{reptheorem}


\begin{proof}
  We assign a Hilbert space $\HS^{(i)} := \ket{0}\oplus\HS_u\ox\HS_d \simeq \C\oplus\C^U\ox\C^D$ to each site $i\in\Lambda$, where $\ket{0}$ denotes the generating element of $\C$. Let $h_u$ be the two-body interaction obtained in \cref{promise_Hu} (keeping the one-body term $h^{(1)}_u(n)$ separate, for later convenience).

  Let $h_d$ be the normalised (so that $\norm{h_d}\le \frac{1}{2}$) two-body interaction of any nearest-neighbour Hamiltonian $H_d$ with 0~ground state energy whose spectrum becomes dense in the thermodynamic limit (cf.\ \cref{def:gapless}): $\lim_{L\rightarrow\infty}\spec H_d^{\Lambda(L)} \rightarrow [0,\infty)$. (For example~\cite{LiebSchultzMattis}, we can take $D=2$ and $h_d$ to be the critical XY-model $h_{\text{row}} = \sigma_x\ox\sigma_x + \sigma_y\ox\sigma_y + \sigma_z\ox\id + \id\ox\sigma_z$ along the rows, where $\sigma_{x,y,z}$ are the Pauli matrices, with no interactions along the columns.)

  Define the Hamiltonian $H(n)$ in terms of its two-body and one-body interactions $h(n)$ as follows:
  \begin{subequations}\label{eq:promise_H}
  \begin{align}
    h^{(i,j)}(n) :=
      &\proj{0}^{(i)}\ox\Pi_{ud}^{(j)}
        \label[term]{eq:promise_boundary}\\
      &+ h_{\vphantom{d}u}^{(i,j)}(n)\ox\1_d^{(i)}\ox\1_d^{(j)}
        \label[term]{eq:promise_hu}\\
      &+ \1_{\vphantom{d}u}^{(i)}\ox\1_u^{(j)}\ox h_d^{(i,j)}\;,
        \label[term]{eq:promise_hq}\\
    h^{(i)}(n) := &-\alpha_2(n)\Pi_{ud}^{(i)}.
      \label[term]{eq:promise_alpha}
  \end{align}
  \end{subequations}
  Clearly, both have norm bounded by $1$.

  As in \cref{tiling+quantum}, $\1_u,\1_d$ denote the identity operators on $\HS_u,\HS_d$, and $\Pi_{ud}$ denotes the projection of $\HS$ onto its $\HS_u\ox\HS_d$ subspace. We decompose the global Hamiltonian in the square $\Lambda(L)$ as $H^{\Lambda(L)}=:\tilde{H}_0 + \tilde{H}_u + \tilde{H}_d - \alpha_2\id_{ud} $, where $\tilde{H}_0,\tilde{H}_u,\tilde{H}_d$ are defined by taking the sum over sites separately for the expressions in \cref{eq:promise_boundary,eq:promise_hu,eq:promise_hq}, respectively. Once again, we assign a \emph{signature} $\sigma\in\{0,1\}^{L^2}$ to every state in the computational basis, by assigning a $0$ to the $\ket{0}$ state, and a $1$ to any state in the $ud$ subspace, and decompose the Hilbert space into subspaces of given signature,
  \begin{equation}
    \bigotimes_{i\in\Lambda}\HS^{(i)}\simeq\bigoplus_{\sigma}\HS_\sigma.
  \end{equation}
  Since \cref{eq:promise_H} is manifestly block-diagonal with respect to this direct sum decomposition, we have
  \begin{equation}
    \spec H^{\Lambda(L)} = \bigcup_\sigma\spec H_\sigma.
  \end{equation}
  Therefore, it is sufficient to analyse the spectra for each signature separately. We distinguish three cases:

  \begin{enumerate}
  \item $\sigma=(0,\ldots,0)$: In this sector the Hamiltonian is $0$.

  \item $\sigma=(1,\ldots,1)$: In this sector $\tilde{H}_0=0$ and $\tilde{H}_u + \tilde{H}_d - \alpha_2(n)\sum_i\id_{uq}^{(i)}  = H_u^{\Lambda(L)}\ox\1 + \1\ox H_d^{\Lambda(L)}$, where $H_u^{\Lambda(L)} = \sum_{i,j\in\Lambda} h_u^{(i,j)}(n) - \alpha_2(n)\sum_i\1_u^{(i)}$ is the Hamiltonian from \cref{promise_Hu}. Thus the spectrum stemming from this subspace is $\spec H_u^{\Lambda(L)} + \spec H_d^{\Lambda(L)}$.
  \end{enumerate}
  It only remains to analyse the case of mixed signatures:
  \begin{enumerate}
  \setcounter{enumi}{2}
  \item $\sigma\neq(0,\ldots,0)$ but $\sigma_i=0$ for some $i$.
  \end{enumerate}

  Let $\ket{\psi}$ be any state with this signature. Since all $\sigma_i=0$ sites must be in the state $\ket{0}$, the overall state is of the form $\ket[\{i:\sigma_i=1\}]{\varphi}\bigotimes_{j:\sigma_j=0}\ket[j]{0}$. We must show that any such state has higher energy than either the $\sigma=(0,\ldots,0)$ or $\sigma=(1,\ldots,1)$ state (whichever is the lower).

  Intuitively, 0-signature regions of the lattice reduce the number of QTMs ``running'' in the lattice in two ways: by reducing the total area that contains QTMs, and by breaking QTMs at boundaries between signature\nobreakdash-1 and signature\nobreakdash-0 regions. The former reduces the energy contribution from the $\tilde{H}_u$ \cref{eq:promise_hu} by something that scales as $\alpha_2(n) \times area$. But it also misses out on the negative $-\alpha_2(n)\times area$ contribution from the $-\alpha_2(n)\id_{ud}$ \cref{eq:promise_alpha}. So the net effect of the reduction in area occupied by QTMs cancels out. Meanwhile, breaking the QTMs at the boundaries reduces the $\tilde{H}_u$ energy contribution by something that scales as $\sum_r\lambda_0(r) \times length$, since each length of boundary can break one QTM of each size $r$. But the boundaries also pick up a positive $1\times length$ energy penalty from $\tilde{H}_0$ (\cref{eq:promise_boundary} term). Since $\sum_r\lambda_0(r) < 1$, the energy penalty outweighs the energy reduction. Thus, overall, signature-0 sites within signature-1 region always increase the energy, and the ground state is never a mixed-signature eigenstate.

  We now make this rigorous, analysing the halting and non-halting cases separately.\footnote{The argument is reminiscent of \cref{segment_bound}.}


  \paragraph{Non-halting case:} Let $M$ denote the total number of signature-0 (``marked'') sites, $U$ the total number of signature-1 (``unmarked'') sites, and $B$ the total number of boundaries between signature-0 and signature-1 sites. Now divide the $L\times L$ lattice into blocks of size $2r\times 2r$ with $\lfloor L/2r\rfloor$ blocks in each row and column,\footnote{The remaining $L-2r\lfloor L/2r\rfloor$ columns will play essentially no role.} where $r=4^m$, $m\in\N$. We classify blocks according to the signature within the block: \emph{unmarked} blocks, whose signature contains only 1's; \emph{completely marked} blocks, whose signature contains only 0's; and \emph{partially marked} blocks, whose signature contains both 0's and 1's.

  We first analyse the contribution of the $\tilde{H}_u+\tilde{H}_d$ terms. Consider any horizontal row $i$ of blocks, and let $c_i$ and $p_i$ denote, respectively, the number of completely and partially marked blocks in that row. The number of unmarked blocks in the row is then $\lfloor L/2r\rfloor - c_i - p_i$. Let $b_i$ denote the number of unmarked blocks immediately to the left of a marked block (complete or partial). The marked blocks divide the row into strips of contiguous unmarked blocks. Within each such strip, the Hamiltonian acts as $\tilde{H}_u^{\text{strip}} + \tilde{H}_d^{\text{strip}} \geq H_u^{\text{strip}}$. By \cref{put-promise-together}, the lowest energy eigenstate of $\tilde{H}_u^{\text{strip}}$ has energy $\min_{\mathcal{L}\subset\Lambda(L)} \sum_{\ell\in\mathcal{L}} \lambda_0(\abs{\ell})$, where the minimisation is over all valid tilings of the strip. By \cref{defect-free}, the minimum number of $r$-segments in a strip of $2r\times 2r$ blocks of length $l$ is $l-1$; in other words, each unmarked block contributes one $r$-segment, except for blocks at the ends of strips. Thus the energy contribution from the $r$-segments in the row is at least
  \begin{equation}\label{eq:r-segment_row_energy}
    \left(\left\lfloor\frac{L}{2r}\right\rfloor - c_i - p_i - b_i - 1\right) \lambda_0(r).
  \end{equation}

  Now, each boundary between an unmarked and a marked block (complete or partial) contributes at least one additional vertical boundary between a signature-0 and a signature-1 site. Meanwhile, each partially marked block contributes at least one additional 0/1 signature boundary. Thus, summing over all rows, we have
  \begin{equation}\label{eq:bi_pi_bound}
    \sum_i p_i + b_i \leq B.
  \end{equation}
  Also, each completely marked block must contain at least $4r^2$ signature-0 sites, thus
  \begin{equation}
    \sum_i c_i \leq \frac{M}{4r^2}.
  \end{equation}

  Summing \cref{eq:r-segment_row_energy} over all $\lfloor L/2r\rfloor$ rows of blocks and over all segment lengths $r$, we obtain the following lower bound on the total contribution of the $\tilde{H}_u + \tilde{H}_d$ terms:
  \begin{subequations}\label{eq:non-halting_segment_energy}
  \begin{align}
    \braket{\psi| \tilde{H}_u+\tilde{H}_d  |\psi}
    &\geq \sum_{\substack{r=4^m\\m\in\N}} \sum_i\left(
      \left\lfloor\frac{L}{2r}\right\rfloor - c_i - p_i - b_i - 1
    \right) \lambda_0(r)\\
    &\geq \sum_r \left\lfloor\frac{L}{2r}\right\rfloor
      \left( \left\lfloor\frac{L}{2r}\right\rfloor - 1 \right) \lambda_0(r)
         - B \lambda_0(r) - M \frac{\lambda_0(r)}{4r^2}.
  \end{align}
  \end{subequations}

  Now consider the energy contribution of the $\tilde{H}_0 - \alpha_2(n)\id_{uq}$ terms. $\tilde{H}_0$ gives an energy contribution of~1 to every boundary between signature-0 and signature-1 sites, whereas $-\alpha(n)\id_{uq}$ gives a negative energy contribution of $-\alpha_2(n)$ to every signature-1 site. Thus the total energy contribution from these terms is
  \begin{equation}\label{eq:non-halting_boundary+alpha_energy}
    \braket{\psi|\tilde{H}_0-\alpha_2(n)\id_{uq}|\psi} = B - \alpha_2(n) (L^2-M).
  \end{equation}

  Putting \cref{eq:non-halting_segment_energy,eq:non-halting_boundary+alpha_energy} together, the total energy of any mixed-signature state is at least
  \begin{subequations}\label{eq:non-halting_mixed_sig_bound}
  \begin{align}
    \begin{split}
      \braket{\psi| H^{\Lambda(L)} |\psi}
      & = \braket{\psi| \tilde{H}_u^{\Lambda(L)} + \tilde{H}_d^{\Lambda(L)}
                        + \tilde{H}_0^{\Lambda(L)} - \alpha_2(n)\1 |\psi}\\
      &\geq \sum_r \left(
        \left\lfloor\frac{L}{2r}\right\rfloor
          \left( \left\lfloor\frac{L}{2r}\right\rfloor - 1 \right) \lambda_0(r)
          - B \lambda_0(r) - M \frac{\lambda_0(r)}{4r^2}
        \right)\\
        &\qquad + B - \alpha_2(n) (L^2-M)
    \end{split}\\[.5em]
    \begin{split}
      &= \left[
        \sum_r \left\lfloor\frac{L}{2r}\right\rfloor
        \left( \left\lfloor\frac{L}{2r}\right\rfloor - 1 \right) \lambda_0(r)
        - L^2\alpha_2(n)
      \right]
      + B \left(1-\sum_r\lambda_0(r)\right)\\
      &\qquad - M \left(\sum_r\frac{\lambda_0(r)}{4r^2} - \alpha_2(n)\right)
    \end{split}\\
    &> \lambda_0\left(H_u^{\Lambda(L)}(n)\right) + \frac{B}{2}
      - M \sum_{r \geq \abs{n}+6}\frac{\lambda_0(r)}{4r^2}.
  \end{align}
  \end{subequations}
  In the final inequality we have used the fact that $\alpha_2(n) := \sum_{r < \abs{n}+6}\lambda_0(r)/4r^2$ and $\sum_r\lambda_0(r) < 1/2$, from \cref{diverging_Hu,def:G-I_Hamiltonian}.

  In the non-halting case, $\lambda_0(r) = 0$ for all $r \geq \abs{n}+6$. Furthermore, for any mixed-signature state, the total number of 0/1 signature boundaries $B\geq 2$. Thus \cref{eq:non-halting_mixed_sig_bound} implies the bound $\braket{\psi|H^{\Lambda(L)}|\psi} > \lambda_0(H_u^{\Lambda(L)}) + 1$.


  \paragraph{Halting case:} The argument is similar to the non-halting case, but we count things slightly differently. Let $U$ denote the total number of signature-1 (``unmarked'') sites, and $B$ the total number of boundaries between signature-0 and signature-1 sites. We again divide the $L\times L$ lattice into blocks of size $2r\times 2r$, with $\lfloor L/2r\rfloor$ blocks in each row and column. Let $\mathcal{R}_r$ be the set of blocked rows that contain only signature-1 sites, with $R_r=\abs{\mathcal{R}_r}$ denoting the size of this set. As before, we categorise the blocks into \emph{unmarked}, \emph{completely marked} and \emph{partially marked}, letting $P_r$ denote the total number of partially marked blocks.

  We first analyse the contribution of the $\tilde{H}_u+\tilde{H}_d$ terms. Consider any horizontal row $i$ of blocks. Let $u_i$ denote the number of unmarked blocks in row $i$, and $b_i$ the number of  unmarked blocks which do \emph{not} have an unmarked block to their right (either because they are adjacent to a completely- or partially-marked block, or because they are the last block in the row). By the same argument as above, \cref{put-promise-together,defect-free} imply that the total number of $r$-segments in the i-th row must be at least $u_i - b_i$. Thus the energy contribution from the $r$-segments in the row is at least
  \begin{equation}\label{eq:r-segment_marked_row_energy}
    (u_i - b_i)\lambda_0(r).
  \end{equation}

  Now we count the number of 0/1~signature boundaries. An unmarked block with a marked block on its right contributes at least one boundary between a signature-1 site to the left of a signature-0 site. An unmarked block at the end of a row does not contribute this boundary. However, in this case, if the row contains at least one marked block, there must exist at least one unmarked block that has a marked block on its \emph{left}, which contributes an additional boundary between a signature-1 site to the \emph{right} of a signature-0 site. Therefore, in any row $i$ that contains at least one marked block, there are at least $b_i$ 0/1~signature boundaries. Finally, in a completely unmarked row we have $b_i=1$ from the unmarked block at the end of the row.

  The number of vertical 0/1 signature boundaries is~0 if a row belongs to $\mathcal{R}_r$ and at least~1 if it does not. Thus rows in $\mathcal{R}_r$ contribute one less 0/1 boundary than the others. Meanwhile, each of the $P_r$ partially marked blocks contributes at least one additional 0/1 boundary. Therefore, summing over all rows $i$, we have
  \begin{equation}\label{eq:bi_bound}
    P_r + \sum_i b_i - R_r \leq B.
  \end{equation}

  Each unmarked block contains $4r^2$ signature-1 sites, and each of the $P_r$ partially marked blocks contains at most $4r^2-1$, out of a total of $U$. Thus
  \begin{equation}\label{eq:ui_bound}
    \sum_i u_i > \frac{U - 4r^2 P_r}{4r^2} = \frac{U}{4r^2} - P_r.
  \end{equation}
  Finally, each row in $\mathcal{R}_r$ contains $2rL$ signature-1 sites, so
  \begin{equation}\label{eq:Rr_bound}
    R_r \leq \frac{U}{2rL}.
  \end{equation}

  Summing \cref{eq:r-segment_marked_row_energy} over all rows $i$ and over all segment lengths $r$, and using \cref{eq:bi_bound,eq:ui_bound,eq:Rr_bound}, we obtain the following lower bound on the total contribution of the $\tilde{H}_u + \tilde{H}_d$ terms:
  \begin{subequations}\label{eq:halting_segment_energy}
  \begin{align}
    \braket{\psi| \tilde{H}_u+\tilde{H}_d |\psi}
    &\geq \sum_{\substack{r=4^m\\m\in\N}} \sum_i (u_i - b_i)\lambda_0(r)\\
    &\geq \sum_r \left(\frac{U}{4r^2} - P_r - (B + R_r - P_r)\right)\lambda_0(r)\\
    &\geq \sum_r \left(\frac{U}{4r^2} - B - \frac{U}{2rL}\right)\lambda_0(r).
  \end{align}
  \end{subequations}

  Now consider the energy contribution of the $\tilde{H}_0 - \alpha_2(n)\id_{uq}$ terms. As before, $\tilde{H}_0$ gives an energy contribution of~1 to every boundary between signature-0 and signature-1 sites, whereas $-\alpha(n)_2\id_{uq}$ gives a negative energy contribution of $-\alpha_2(n)$ to every signature-1 site. So the total energy contribution from these terms is
  \begin{equation}\label{eq:halting_boundary+alpha_energy}
    \braket{\psi|\tilde{H}_0-\alpha_2(n)\id_{uq}|\psi} = B - \alpha_2(n)U.
  \end{equation}

  Putting \cref{eq:halting_segment_energy,eq:halting_boundary+alpha_energy} together, the total energy of any mixed-signature state is at least
  \begin{subequations}\label{eq:halting_mixed_sig_bound}
  \begin{align}
    \braket{\psi| H^{\Lambda(L)} |\psi}
    & = \braket{\psi| \tilde{H}_u^{\Lambda(L)} + \tilde{H}_d^{\Lambda(L)}
                      + \tilde{H}_0^{\Lambda(L)} - \alpha_2(n)\1 |\psi}\\
    &\geq \sum_r \left(\frac{U}{4r^2} - B - \frac{U}{2rL}\right)\lambda_0(r)
      + B - \alpha_2(n) U\\
    &= U\left(\sum_r \frac{\lambda_0(r)}{4r^2} - \alpha_2(n)\right)
      + B\left(1-\sum_r\lambda_0(r)\right)
      - \frac{U}{L}\sum_r\frac{\lambda_0(r)}{2r}\\
    &> U\left(\delta_2(n) - \frac{1}{L}\right) + \frac{B}{2}.
  \end{align}
  \end{subequations}
  In the final inequality, we have used $\alpha_2(n) := \sum_{1\leq r < \abs{n}+6}\lambda_0(r)/4r^2$,\linebreak $\delta_2(n) := \sum_{r \geq \abs{n}+6}\lambda_0(r)/4r^2$ and $\sum_r\lambda_0(r) < 1/2$, all from \cref{diverging_Hu,def:G-I_Hamiltonian}.

  For any mixed-signature state, the total number of 0/1~signature boundaries $B \geq 2$. Moreover, in the halting case, $\delta_2(n)>0$ independent of $L$. Thus, for sufficiently large lattice sizes $L$, \cref{eq:halting_mixed_sig_bound} implies the bound $\braket{\psi| H^{\Lambda(L)} |\psi} > 1$.

  \paragraph{} Denoting the part of the spectrum which corresponds to these mixed signatures by $S\subset\mathbb{R}$, we obtain that
  \begin{equation}
    \spec H^{\Lambda(L)}
      = \{0\}\cup\Big\{\spec H_u^{\Lambda(L)} + \spec H_d^{\Lambda(L)}\Big\}\cup S.
  \end{equation}
  Recall that the spectrum of $H_d$ becomes dense in the thermodynamic limit:
  \begin{equation}
    \lim_{L\rightarrow\infty}\spec H_d^{\Lambda(L)} \rightarrow [0,\infty)\;.
  \end{equation}
  By taking $L \ge L(n)$ and using \cref{promise_Hu}, one of two things may happen. If the universal TM does not halt on input $n$, then $S \geq \lambda_0(H_u^{\Lambda(L)})+1$, $\lambda_0(H_u^{\Lambda(L)}) \leq 0$, and $\spec H^{\Lambda(L)}$ becomes dense in $[\lambda_0(H_u^{\Lambda(L)}),\infty)$ as $L$ goes to infinity. If the universal TM \emph{does} halt, then $S \geq 1$ and $\lambda_0(H_u^{\Lambda(L)}) \geq 1$, thus $\Delta(H^{\Lambda(L)})\ge 1$. Determining which is clearly undecidable, thus concluding the proof of our main \namecref{thm:promise}.
\end{proof}



\subsection{Periodic boundary conditions}
\label{sec:periodic_bc}
The previous section proves \cref{thm:promise} for open boundary conditions. This is arguably the most important type of boundary conditions in the context of the spectral gap problem, both physically, because periodic boundary conditions rarely occur in real physical systems, and mathematically, because the thermodynamic limit is better behaved. Nonetheless, our result can also be extended to other types of boundary condition. Extending it to fixed boundary conditions is trivial, so we omit the argument. In this section, we consider the more interesting case of periodic boundary conditions.

For this, we must first address an issue that does not occur for open boundary conditions. For any local interaction $h\geq 0$ on a lattice with open boundary conditions, it is easy to see\footnote{If $\ket{\psi}$ is a ground state with energy $E_0 = \sum_{<i,j> \in \Lambda(L_2)\times\Lambda(L_2)} \tr_{\Lambda(L_2)}\left(h^{(i,j)}\proj{\psi}\right)$ for the lattice of size $L_2$ with open boundary conditions, then the mixed state $\rho = \tr_{i\notin\Lambda(L_1)}\proj{\psi}$ on the lattice of size $L_1 \leq L_2$ has energy $\tr_{\Lambda(L_1)} \left(\sum_{<i,j>\in \Lambda(L_1)\times \Lambda(L_1)} h^{(i,j)}\rho \right) = \tr_{\Lambda(L_2)} \left(\sum_{<i,j>\in \Lambda(L_1)\times \Lambda(L_1)} h^{(i,j)}\proj{\psi}\right) \leq E_0$.} that the ground state energy is non-decreasing with the lattice size: for any $L_2 \geq L_1$, $\lambda_0(H(L_1)) \leq \lambda_0(H(L_2)$.
%
However, this is no longer necessarily the case for other types of boundary conditions. In particular, for periodic boundary conditions, there are trivial examples in which the ground state energy oscillates periodically with the lattice size. A simple example is the classical tiling Hamiltonian on a line, with $N$ tile-types and the constraint that tile type $n$ must be to the left of type $n+1 \bmod N$. For periodic boundary conditions, this has ground state energy~0 for lines of length $L = 0 \bmod N$, but has ground state energy~1 otherwise.

Using a very similar construction to that in the proof of \cref{thm:promise} (see \cref{sec:spectral-gap}), this oscillatory behaviour of the ground state energy translates into oscillatory behaviour of the spectral gap. If we restrict the lattice size $L$ to the subsequence with $L \bmod N = 0$, then the system is gapless. If we restrict to any subsequence with $L \bmod N \neq 0$, then the system is gapped with spectral gap~1. Our \cref{def:gapped,def:gapless} of gapped and gapless systems are therefore not adequate for periodic boundary condition.

Since our \cref{def:gapless} of gapless systems expresses convergence of the sequence of spectra to a dense subset, the most natural generalisation appropriate to other boundary conditions is to relax this requirement to a convergent \emph{sub}sequence of lattice sizes:

\begin{definition}[Gapless -- generalised]\label{def:gapless-generalised}
  We say that a family $\{H^{\Lambda(L)}\}$ of Hamiltonians characterises a gapless system if there is a constant $c>0$ such that for all $\varepsilon>0$ there is an $L_0\in\mathbb{N}$ and a subsequence $\{L_i\}$ of $\N$ such that for all $L_i>L_0$ every point in $[\lambda_0(H^{\Lambda(L_i)}),\lambda_0(H^{\Lambda(L_i)})+c]$ is within distance $\varepsilon$ from $\spec H^{\Lambda(L_i)}$.
\end{definition}

With this generalised definition of gapless systems, \cref{thm:promise} proving undecidability of the spectral gap generalises to the case of periodic boundary conditions. The proof involves slightly modifying the Robinson tiling part of our construction, using a tiling trick from \cite{Gottesman-Irani}. We first restate and prove this trick here (in a slightly generalised form).

The construction works for any (unweighted) tile set. First, duplicate all the tiles to create black- and white-coloured variants of each tile, and impose the constraint that adjacent tiles must have different colours. Turn this into an equivalent weighted tiling by defining the weight of adjacent pairs of matching tiles to be~0, and that of non-matching pairs to be $+5$. (Note that adjacent pairs can fail to match either because the original tile markings fail to match, or because their colours are the same.) Finally, add to the tile set the three new tile types shown in \cref{fig:boundary_tiles} (which do not have additional colour markings).

% Conceptually, this is equivalent to adding an additional ``upper layer'' to the tiling, which has five tile types: the three in \cref{fig:boundary_tiles}, plus one black tile and one white tile. Tiles from the original set are then only placed on the ``bottom layer'' where the top layer contains black or white tiles, but must otherwise match as usual.

\begin{figure}[hbtp]
  \centering
  \includegraphics{boundary-tiles}\\
  \caption{Boundary tiles for periodic boundary condition construction.}
  \label{fig:boundary_tiles}
\end{figure}

The weights for adjacent pairs of tiles in this extended tile set are given in the following table, where $\whitetile$ and $\blacktile$ denote any tiles of the given colour\footnote{The choice of weights is somewhat arbitrary. Here, we choose them slightly more symmetrically than in \cite{Gottesman-Irani}, which makes the proof of \cref{periodic-to-open-bc} marginally simpler to describe.} (the weight for adjacent pairs of opposite-colour tiles is~0 if the original tile markings match, $+5$ if they do not match):

\begin{equation}\label{eq:boundary_tile_weights}
  \begin{array}{cc|ccccc}
    & & \multicolumn{4}{|c}{\text{Right tile}} \\
    & & \whitetile & \blacktile & \horizline & \vertline & \cross \\
    \hline
    \multirow{4}{*}{\rotatebox{90}{\text{Left tile}}}
    & \whitetile &  5  & 0/5 & 5 & 0 & 5 \\
    & \blacktile & 0/5 &  5 & 5 & 0 & 5 \\
    & \horizline &  5  &  5 & 0 & 5 & 1 \\
    & \vertline  &  0  &  0 & 5 & 5 & 5 \\
    & \cross     &  5  &  5 & 1 & 5 & 5
  \end{array}
  \qquad
  \begin{array}{cc|ccccc}
    & & \multicolumn{4}{|c}{\text{Tile above}} \\
    & & \whitetile & \blacktile & \horizline & \vertline & \cross \\
    \hline
    \multirow{4}{*}{\rotatebox{90}{\text{Tile below}}}
    & \whitetile &  5  & 0/5 & 0 & 5 & 5 \\
    & \blacktile & 0/5 &  5  & 0 & 5 & 5 \\
    & \horizline &  0  &  0  & 5 & 5 & 5 \\
    & \vertline  &  5  &  5  & 5 & 0 & 1 \\
    & \cross     &  5  &  5  & 5 & 1 & 5
  \end{array}
\end{equation}

The following \namecref{periodic-to-open-bc} encapsulates the construction given in \cite[\S~4.2]{Gottesman-Irani}. It shows that these weights effectively turn the weighted tiling problem for an odd-sized square region with periodic boundary conditions (a torus), into the unweighted tiling problem for the original tile set on an even-sized square region with open boundary conditions.

\begin{lemma}[Periodic to open b.c.]
  \label{periodic-to-open-bc}
  Given any unweighted tile set and any odd $L\in\N$, all minimum weight tilings of an $L\times L$ torus using the extended tile set described above, with the weights given in \cref{eq:boundary_tile_weights}, consist of a single $\cross$ tile at an arbitrary location, a complete row of $\horizline$ tiles extending horizontally from the $\cross$, a complete column of $\vertline$ tiles extending vertically from the $\cross$, and a valid tiling of the remaining $(L-1)\times(L-1)$ region with the original tile set using alternating colours.
\end{lemma}

\begin{proof}
  The tilings described in the \namecref{periodic-to-open-bc} have total weight $+4$ (coming from the $\vertline$ and $\horizline$ tiles adjacent to the $\cross$). We must show that all other tilings have higher weight. Since $L$ is odd, the torus cannot be tiled consistently with alternating colours, thus any weight $<5$ tiling must contain at least one $\horizline$, $\vertline$ or $\cross$.

  If the tiling contains any tile other than $\horizline$ or $\cross$ to the left or right of a $\horizline$, it has weight $\geq 5$. Thus, in any weight $\leq 5$ tiling, $\horizline$ tiles can only appear in complete rows of $\horizline$ and $\cross$ tiles. The analogous argument for columns implies that $\vertline$ tiles can only appear in complete rows of $\vertline$ and $\cross$ tiles. A $\cross$ adjacent to a black or white tile has weight $+5$, so $\cross$ tiles can only appear where such rows and columns meet. Moreover, adjacent $\horizline$ and $\vertline$ tiles have weight $+5$, so \emph{all} such rows and columns must meet at $\cross$ tiles.

  Therefore, any tiling with weight $<5$ must consist of some non-zero number of rows of $\horizline$ tiles and columns of $\vertline$ tiles meeting at $\cross$ tiles, with coloured tiles everywhere else. Each intersection of a $\horizline$ row with a $\vertline$ column at a $\cross$ contributes weight $+4$, so the weight is minimised by having just one such row and column.

  Finally, the remaining region to be filled with coloured tiles is a square of size $(L-1)\times (L-1)$. $L-1$ is even, so this can be tiled consistently with alternating colours. It contributes weight~0 iff, in addition, the tiles (ignoring the colour markings) form a valid tiling for the original tile set.
\end{proof}


Applying \cref{periodic-to-open-bc} to the modified Robinson tiles of \cref{sec:quasi-periodic}, we obtain a weighted tile set whose minimum weight tilings on a torus of size $L$ have exactly the same quasi-periodic structure as the original Robinson tilings on a square of size $L-1$, for any odd lattice size $L$. Using this tile set in \cref{tiling+quantum}, the proofs of \cref{tiling+quantum,put-promise-together,diverging_Hu,promise_Hu} go through unchanged for odd-sized square lattices with periodic boundary conditions. Undecidability of the ground state energy density (\cref{thm:gs_density}), and undecidability of the spectral gap (\cref{thm:promise}) under the appropriate \cref{def:gapless-generalised} of gapless, follow immediately.



%%% Local Variables:
%%% mode: latex
%%% mode: visual-line
%%% mode: adaptive-wrap-prefix
%%% TeX-master: "spectral-gap"
%%% End:

%  LocalWords:  Gottesman Irani QTM XY QTMs

quasi-periodic.tex

\section{Quasi-periodic tilings}
\label{sec:quasi-periodic}
In order to ultimately prove the required spectral properties of our final Hamiltonian, we require significantly stronger properties of quasi-periodic tilings than those used to prove tiling results. In particular, we will need strong ``rigidity'' results, which show that the quasi-periodic structure is in a sense robust to errors. As far as we are aware, these rigidity results are new. All the tiling results used in the proof of our main results are gathered in this section.

We exploit the very particular properties of a quasi-periodic tiling due to Robinson, which we briefly review in the following section. The Robinson tiling has a hierarchical geometric structure that lends itself to inductive proofs of the required rigidity results.


\subsection{Robinson's tiling}\label{sec:Robinson}
We now describe Robinson's quasi-periodic tiling. It was discovered by Robinson in 1971 \cite{Robinson} as a tool to simplify Berger's proof of the undecidability of the tiling problem \cite{Berger}.

\begin{figure}[hbtp]
  \centering
  \includegraphics[width=0.7\columnwidth]{Robinson-tiles}\\
  \caption{The five basic tiles of Robinson's tiling.}
  \label{fig:Robinson-tiles}
\end{figure}

Robinson's tiling is based on the five basic tiles showed in \cref{fig:Robinson-tiles} and all those that can be obtained from them by rotation or reflection. Tile~(a) is called a \textit{cross}, whereas tiles~(b)\nobreakdash--(e) are called \textit{arms}. In a valid tiling, arrow heads must meet arrow tails. As drawn, cross~(a) is said to face up/right. An arm is said to point in the direction of its only complete central arrow.

\begin{figure}[hbtp]
  \centering
  \includegraphics[width=0.6\columnwidth]{parity-markings}\\
  \caption{Parity markings to force the position of the crosses.}
  \label{fig:parity-markings}
\end{figure}

For each one of the five basic tiles of \cref{fig:Robinson-tiles}, we introduce two possible colours, red or green, to each of the side arrows (note that there is one tile without colour) with the following restrictions: at most one colour may be used horizontally and at most one colour may be used vertically; for the cross, the same colour must be used in both directions; for tile~(b) one colour must be used horizontally and the other colour vertically. Moreover, we impose the restriction that green crosses must appear in alternate positions in alternate rows (and maybe in other positions too).
This can be achieved by adding parity markings to the above tiles: the additional arrows showed in \cref{fig:parity-markings}, which should match properly in any valid tiling, with the following rules: parity marking (a) is associated with green crosses, parity marking (b) with horizontal green arrows, and (c) with vertical green arrows. Parity marking (d) is associated with all tiles. It is important to remark here that parity markings ``live in a different layer'' than the five basic tiles. That is, arrows from the parity markings must match only those from the parity markings and arrows from the basic tiles must match only those from the basic tiles.

\begin{figure}[hbtp]
  \centering
  \includegraphics[width=\columnwidth]{red-tiling}
  \caption{A possible Robinson tiling of the plane.}
  \label{fig:tiling}
\end{figure}

If we now draw only the red collared lines, one possible tiling of the plane looks like \cref{fig:tiling}, which has the crucial (for our purposes) quasi-periodic structure consisting of squares of increasing size.

\begin{figure}[hbtp]
\centering
  \begin{tabular}{cc}
    \includegraphics[width=0.5\columnwidth]{3-square.pdf} & \includegraphics[width=0.5\columnwidth]{7-square}
  \end{tabular}
  \caption[Robinson tiling squares.]{\textit{Left}: A $3\times 3$ square of the Robinson tiling, with the choice of a right/up facing cross in the middle tile. {\em Right}: A $7\times 7$ square of the Robinson tiling, with the choice of a right/down facing cross in the middle tile. (To avoid confusion, we have only drawn the coloured lines of the tiles in this second figure.)}
  \label{fig:3-square}
\end{figure}

Let us try to explain briefly (full details con be found in \cite{Robinson}) how \cref{fig:tiling} emerges, and the remaining freedom it allows in constructing valid tilings of the plane. Since crosses must appear in alternate rows in alternate positions, together with the form of the five basic tiles, if we take any cross, this completely determines the structure of the $3\times 3$ square constructed in the direction it faces. For example, assume we start with a green cross facing left/down. Then we are forced to complete the $3\times 3$ square having it as the top/right corner as shown in \cref{fig:3-square}, where in the middle tile we must have a red cross, with the only freedom of choosing where it faces.

Once this is fixed, the $7\times 7$ square obtained by growing the $3\times 3$ square in the direction this red crosses faces is fixed as shown in \cref{fig:3-square}, where there is a green cross in the central position, with the only freedom of choosing where it faces. Keeping this procedure gives a tiling like the one shown in \cref{fig:tiling}. It consists of a quasi-periodic structure of squares (called borders) of sizes $4^n$ (which means following Robinson's notation that the distance between two of the facing crosses delimiting the border is $4^n+1$) repeated with period $2^{n+1}$, for all $n\in \N$. Such a tiling can tile the whole plane, a half-plane or a quarter-plane, depending on how we sequentially choose the orientation of the central crosses. Lines between valid half or quarter planes must consist only of arms. If tiling divides the plane into two half-planes, the patterns in these half-planes may be shifted relative to one another by an arbitrary even number of cells. In this case, we call the line separating the two half-planes a \keyword{fault}. However, if a half-plane is further divided into two quarter-planes, no further shift is possible between these quarter-planes.



\subsection{Rigidity of the Robinson tiling}\label{sec:rigidity}
We have just seen that with the original Robinson tiles, the quasi-periodic pattern of borders does not necessarily extend throughout the entire plane; there can be a fault line between two half-planes, with ``slippage'' between the patterns on either side of the fault (see \cref{sec:Robinson} and \cite[\S~8]{Robinson}). It will be convenient to slightly modify the Robinson tiles in order to prevent fault lines. To this end, wherever one of the five basic tiles does not have side-arrows, we add dashed side-arrows parallel to the solid central arrows (see \cref{fig:modified_Robinson_tiles}). We then extend the five basic tiles to the full tile set by rotation and reflection, adding parity markings, and adding red and green colourings to the solid side arrows, exactly as in \cref{sec:Robinson}. We refer to these as the ``modified Robinson tiles''. (Similar modifications to the Robinson tile set appear elsewhere in the literature, e.g.\ in \cite{Miekisz}.)

\begin{figure}[hbtp]
  \centering
  \includegraphics[width=0.7\columnwidth]{modified-Robinson-tiles}
  \caption{The five basic tiles of the modified Robinson tiling.}
  \label{fig:modified_Robinson_tiles}
\end{figure}

Since the all original tile markings are still present, any tiling using the modified tiles must also be a valid tiling using the original tiles if the dashed side-arrows are ignored. It is easy to verify that, for any tiling in which the $2^n$\nobreakdash-borders repeat periodically throughout the plane for all $n$ (i.e.\ any tiling that does not contain a fault line), dashed side-arrows can be added to make it into a valid tiling using the modified tiles.

However, if the tiling contains a fault line, there is no way to consistently add dashed side-arrows. To see this, assume without loss of generality that the fault line is vertical. Then there must exist two back-to-back crosses on either side of the fault that are not aligned, so that one points up and the other down. Consider the cross to the left of the fault line. The dashed side-arrow on this cross that points to the right forces a dashed arm to extend in that direction, towards the other cross. Similarly, the left-pointing dashed side-arrow on the cross to the right of the fault forces a dashed arm to extend to the left. These dashed arms must meet somewhere between the two crosses. But, since one cross points up and the other down, one of these arms has the dashed side-arrow on top, the other has it on the bottom, so there is no way to consistently join up the arms.


The crucial property we will use is that the Robinson tiling has a very ``rigid'' structure. Even if we start from a tile configuration that contains a defect (a pair of non-matching adjacent tiles), outside of a ball around the defect, the defect has no effect on the pattern of borders that appears in the rest of the tiling. The following \namecrefs{Robinson_rigidity} make this rigorous.\footnote{Our ``rigidity'' results for the Robinson tiling could certainly be strengthened, but they suffice for our purposes.}

\begin{lemma}[Cross rigidity]\label{crosses}
  In any tiling of a connected region with Robinson tiles, crosses must
  occur in alternate columns and in alternate rows.
\end{lemma}

\begin{proof}
  Immediate from the observation that, for each ``parity tile'' in
  \cref{fig:parity-markings}, its neighbour in each direction is uniquely
  defined.
\end{proof}


\begin{lemma}[Robinson rigifity]\label{Robinson_rigidity}
  Consider a connected region of a 2D square grid made up of square blocks of size $2^{n+1}\times 2^{n+1}$. Any tiling of such a region with modified Robinson tiles must contain a periodic pattern of $2^n$\nobreakdash-borders (some of which may be incomplete due to boundaries), repeating horizontally and vertically with period $2^{n+1}$. That is, the tiling must contain the same periodic pattern of $2^n$\nobreakdash-borders as a section of the tiling of the infinite plane, up to translation and defects that do not affect the $2^n$ borders.
\end{lemma}

\begin{proof}
  By \cref{crosses}, crosses must occur in alternate rows and columns throughout the region being tiled. Following \textcite{Robinson},  we refer to these crosses as ``1\nobreakdash-squares''. (Note that there may be additional crosses in the tiling that do not constitute 1\nobreakdash-squares.) Pick an orientation for one of these 1\nobreakdash-square crosses. Its solid side-arrows force a solid arm to extend in the directions it faces. Unless there is insufficient space to the boundary of the region, there must be a cross two cells away in the direction of each arm. Just as in \textcite[\S 3]{Robinson}, these solid arms force the orientation of any two facing crosses to be mirror images.

  Meanwhile, the dashed side-arrows force a dashed arm to extend in the directions that the cross faces \emph{away} from. Again, these arms force the orientations of any back-to-back crosses to be mirror images. Thus, as soon as we pick the orientation of a single 1\nobreakdash-square cross, the orientations of all adjacent crosses are forced, and hence the orientations of all 1\nobreakdash-square crosses throughout the connected region.

  \paragraph{Base case} Consider first the case $n=1$ with $4\times 4$ blocks. Since orientations of adjacent pairs of 1\nobreakdash-square crosses are mirror images of each other, they are forced to form groups of four facing towards the centre of a $3\times 3$ block. As in \textcite[\S 3]{Robinson}, these blocks must be completed to form ``3\nobreakdash-squares'' with 2\nobreakdash-borders running around the edges and crosses in the centre. (The orientation of the central crosses is not fixed.) In our modified Robinson tiles, the dashed side-arrows also force the orientations of \emph{back-to-back} crosses to be mirror images, which forces adjacent 3\nobreakdash-squares to be aligned. Thus the pattern of complete 2\nobreakdash-borders must repeat horizontally and vertically with period $4$ throughout the region.

  However, in general some of the 1\nobreakdash-squares will be too close to the boundaries of the region to form complete 3\nobreakdash-squares. We need to show that these still force partial 2\nobreakdash-borders. If a 1\nobreakdash-square faces a boundary and is located at that boundary, then there is no further section of 2\nobreakdash-border in that direction in any case, and we have nothing to show. If a 1\nobreakdash-square faces a boundary and is more than two cells away from it, there must be another 1\nobreakdash-square facing it before reaching the boundary, and the section of 2\nobreakdash-border between them must be completed as usual. The only interesting case is if a 1\nobreakdash-square faces a boundary one cell away from it. In this case, the solid side-arrows still force the cell between the cross and the boundary form an arm extending to the boundary. The only difference is that there is no facing cross in that direction to force the side-arrows of the arm to point inwards; they could instead point towards the boundary. Thus any of the arm tiles with solid side-arrows (in a suitable orientation) can be used to form this piece of the 2\nobreakdash-border. For our purposes, we consider any of these to still constitute a section of 2\nobreakdash-border. So partial 2\nobreakdash-borders are still forced at the boundaries.

  This completes the proof for the base case $n=1$. It will be important for later to note that, if a partial 2\nobreakdash-border is large enough to contain the cell that would normally be at the centre of the border, then the central cross is still forced in that cell. To see this, note that because our region is made up of adjacent square blocks, there must be arms on at least two sides of the central cell (not necessarily opposite sides, if the partial 2\nobreakdash-square is located in a corner of the region). Regardless of which tile is used to form these arms, the central arrows perpendicular to the arms must face outwards as usual, because the solid side-arrows on the arms must be on the side away from the central cell. But the only tile that has outward-facing central arrows on adjacent sides is the cross, so it is forced.

  \paragraph{$\mathbf{n=2}$ case} Before proving the general case, it is instructive to consider the next case $n=2$ (with $8\times 8$ blocks). We can always divide each $8\times 8$ block into four $4\times 4$ blocks and apply the previous argument, so the 2\nobreakdash-borders must repeat horizontally and vertically with period~4, throughout the region, with a cross at the centre of each 2\nobreakdash-border (whether partial or complete). Each $8\times 8$ block must therefore contain at least one complete 2\nobreakdash-border, and all 2\nobreakdash-borders must be aligned (hence their central crosses are also aligned).

  Pick an orientation for one of these central crosses. The side-arrows of this cross force solid arms extending in the directions that the cross faces, and dashed arms extending in the directions it faces away from. Now, the only tile at which an arm can terminate is the cross. But there can be no crosses between adjacent 2\nobreakdash-borders. Thus the arms must extend all the way from a central cross to its neighbours, again forcing the orientation of both facing and back-to-back crosses to be mirror images of each other, so that they form groups of four facing towards the centre of a $5\times 5$ block. As in \textcite[\S 3]{Robinson}, these blocks must be completed to form ``5\nobreakdash-squares'' with 4\nobreakdash-borders running around the edges and crosses in the centre. As before, the dashed arms force adjacent 5\nobreakdash-squares to be aligned. So the pattern of complete 4\nobreakdash-borders repeats horizontally and vertically throughout the region, with period~8.

  It remains to consider crosses that are too close to the boundaries to form complete 4\nobreakdash-borders. If the central cross of a 2-border faces a boundary (rather than another cross), its solid side-arrows still force an arm that extends towards the boundary. The only tile that can terminate an arm is a cross. However, we cannot place a cross anywhere within the 3-square surrounding the central cross, as it would break the tiling within the 3-square. The only remaining possibility is to place a cross in the one-cell-wide corridor that runs along each side of a 3\nobreakdash-square. However, where an arm intersects a 2-border it must point outwards, which prevents placing a cross in the corridor. Thus the arm must be extended all the way to the boundary to form a partial 4-border (with some additional freedom in which arm tiles are used to form this section of 4-border).

  This proves the \namecref{Robinson_rigidity} for $n=2$. As in \cite[\S~3]{Robinson}, a cross is forced at the centre of all complete 4-borders. If a partial 4-border is large enough to surround the cell that would be at the centre of the complete border, a cross is forced there too. To see this, observe that for partial borders of this size, the centre cell has partial 4-borders on at least two sides. The central arrows perpendicular to a border necessarily have arrow tails on the inside of the border. These force an arm extending back towards the central cell. That cell therefore has arrow tails on at least two sides, and the central cross is forced.

  \paragraph{General case} The argument for general $n$ is very similar to the argument for the $n=2$ case, and proceeds by induction on $n$. Assume for induction that the pattern of $2^{n-1}$\nobreakdash-borders repeats horizontally and vertically with period $2^n$ in any connected region made up of $2^n\times 2^n$ blocks, and that a cross is forced at the centre of each of those $2^{n-1}$\nobreakdash-borders (whether partial or complete).

  Now consider a connected region made up of $2^{n+1}\times 2^{n+1}$ blocks. We can always divide each block into four $2^n\times 2^n$ blocks. So, by assumption, the pattern of $2^{n-1}$\nobreakdash-borders must repeat horizontally and vertically with period $2^n$ throughout the region, with a cross at the centre of each (partial or complete) $2^{n-1}$\nobreakdash-border. Each $2^{n+1}\times 2^{n+1}$ block therefore contains at least one complete $2^{n-1}$\nobreakdash-border, and adjacent borders (hence also their central crosses) are aligned. The solid and dashed side-arrows of these central crosses force arms extending between adjacent crosses, which in turn force the orientations of adjacent crosses to be mirror images. Thus the arms extending between facing crosses form $2^n$\nobreakdash-borders, and adjacent $2^n$\nobreakdash-borders are aligned. The pattern of $2^n$\nobreakdash-borders therefore repeats horizontally and vertically throughout the region, with period $2^{n+1}$.

  For central crosses that face a boundary instead of an adjacent cross, the solid side-arrows on the cross still force an arm extending towards the boundary. To show that this arm necessarily extends all the way to the boundary, we must show that it is impossible to place a cross anywhere along the arm. Within the $(2^n-1)$\nobreakdash-square surrounding the central cross, we cannot place a cross along the arm without breaking the tiling within  $2^n-1$\nobreakdash-square (cf.\ \cite[\S~3]{Robinson}). Thus the arm must extend to the boundary of this $(2^n-1)$\nobreakdash-square. Similarly, we cannot place a cross along the arm anywhere within  the adjacent $(2^n-1)$\nobreakdash-square. So, if the arm reaches the adjacent $(2^n-1)$\nobreakdash-square, it must continue onwards to the boundary. The only remaining possibility is to place a cross in the one-cell-wide corridor between the adjacent $(2^n-1)$\nobreakdash-squares. However, the arm necessarily points out of the $(2^n-1)$\nobreakdash-square, which prevents placing a cross in the corridor.

  Finally, for the induction step we must show that a cross is forced at the centre of each (complete or partial) $2^n$\nobreakdash-border. The argument applies to any border that extends sufficiently far to surround its centre cell (which includes complete borders). The central cell has (complete or partial) $2^n$\nobreakdash-borders on at least two sides. The central arrows perpendicular to a border necessarily have arrow tails pointing inwards, which force arms extending back towards the central cell. That cell therefore has arrow tails on at least two sides, forcing the central cross.

  Together with the base case $n=1$, this completes the proof.
\end{proof}


We refer to the top edge of a $2^n$\nobreakdash-border as a \emph{$2^n$\nobreakdash-segment}.\footnote{It is on these $2^n$\nobreakdash-segments that the QTMs will ultimately ``run'' in the final construction.}

\begin{lemma}[Segment bound]\label{defect-free}
  The minimum number of $2^n$\nobreakdash-segments in a tiling of an $L\times H$ rectangle (width $L$, height $H$) using modified Robinson tiles is $\lfloor H/2^{n+1}\rfloor \bigl(\lfloor L/2^{n+1}\rfloor -1\bigr)$, and this minimum can be attained simultaneously for all $n$.
\end{lemma}

\begin{proof}
  \Cref{Robinson_rigidity} implies that the tiling must contain the usual periodic pattern of $2^n$\nobreakdash-borders, up to translation. Since the borders repeat vertically with period $2^{n+1}$, the minimum number of rows of $2^n$\nobreakdash-segments is $\lfloor H/2^{n+1}\rfloor$ (obtained by translating the pattern vertically so that there is a row of incomplete borders along the top edge of the region). Similarly, since the borders repeat horizontally with period $2^{n+1}$, the minimum number of $2^n$\nobreakdash-segments in each row of segments is $\lfloor L/2^{n+1}\rfloor -1$ (obtained by translating the pattern horizontally so that there are incomplete segments at the left and/or right edges of the region).

  Since any $2^n$-border in the Robinson tiling contains $2^{n-1}$ borders inside it, the translations can be chosen such that there are incomplete segments of all sizes at the boundaries of the region. The result is now trivial.
\end{proof}

The following \namecref{segment_bound} is the key rigidity result that we will need later. It shows that a defect in the tiling (i.e.\ a non-matching pair of adjacent tiles) cannot affect the pattern of $2^n$\nobreakdash-borders in the tiling outside a ball of size $2^{n+1}$ centred on the defect.

\begin{lemma}[Segment rigidity]\label{segment_bound}
  In any tiling of an $L\times H$ rectangle (width $L$, height $H$) with $d$ defects using modified Robinson tiles, the total number of $2^n$\nobreakdash-segments is at least $\lfloor H/2^{n+1}\rfloor \bigl(\lfloor L/2^{n+1}\rfloor -1\bigr) - 2d$.
\end{lemma}

\begin{proof}
  Divide the $L\times H$ rectangle into contiguous square blocks of size $2^{n+1} \times 2^{n+1}$, with $\lfloor L/2^{n+1}\rfloor$ blocks in each row and $\lfloor H/2^{n+1}\rfloor$ in each column. (Any leftover cells play no further role in the argument.) Delete any block that contains at least one defect (arbitrarily assigning defects that occur at block boundaries to the bottom/left block). Consider any horizontal row of blocks. If the row contains $d_i$ deleted blocks, those missing blocks divide it into at most $d_i+1$ strips of height $2^{n+1}$.

  Since each strip is a connected, defect-free region made up of $2^{n+1} \times 2^{n+1}$ blocks, \cref{Robinson_rigidity} implies that it must be tiled with the usual periodic pattern of $2^n$\nobreakdash-borders, up to translations. The strip may be connected to strips in adjacent rows, in which case we are not free to translate the tiling in each strip independently. Nonetheless, we can lower-bound the number of $2^n$\nobreakdash-segments by allowing the tiling within each strip to be translated independently, and minimising over all such translations.

  Each strip has height $2^{n+1}$, so, regardless of how the pattern is translated vertically, it must contain exactly one row of $2^n$\nobreakdash-segments. The minimum number of segments within a strip of block-length $l$ is $l-1$ (obtained by translating the pattern horizontally so that there are incomplete segments at the beginning and end of the strip). In other words, each block in the strip effectively contributes one segment to the total, except for the block at the right end of the strip, which does not contribute (we assign the segment between adjacent blocks to the left one).

  If the row contains $d_i$ deleted blocks, those missing blocks divide it into at most $d_i+1$ strips.\footnote{For $d_i>n/2$, this substantially over-counts the number of strips, but it is sufficient for our purposes.} Thus the row contains $\lfloor L/2^{n+1}\rfloor - d_i$ non-deleted blocks, with at most $d_i+1$ of them located at ends of strips. The whole row therefore contains at least $\lfloor L/2^{n+1}\rfloor - d_i - \bigl(d_i+1\bigr) = \lfloor L/2^{n+1}\rfloor - 2d_i - 1$ segments.

  Summing over all $\lfloor H/2^{n+1}\rfloor$ rows, and noting that the total number of deleted blocks cannot be more than the total number of defects, we obtain the claimed lower bound on the total number of $2^n$\nobreakdash-segments.
\end{proof}




%%% Local Variables:
%%% mode: latex
%%% mode: visual-line
%%% mode: adaptive-wrap-prefix
%%% TeX-master: "spectral-gap"
%%% End:

%  LocalWords:  QTMs

spectral-gap.tex
\documentclass[12pt,a4paper]{article}

%\usepackage{trace}

\usepackage[T1]{fontenc}
\usepackage[verbose=true]{microtype}
%\usepackage[hmargin=1in,vmargin=1in]{geometry}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{txfonts}        % has to come after amsmath
%\usepackage{mathtools}

\usepackage{qcircuit}
\let\1\relax                % xy package pulled in by qcircuit defines \1
\usepackage{quantum}

\usepackage{authblk}
\usepackage[perpage]{footmisc}
\usepackage{paralist}
\usepackage{enumitem}
\usepackage{tocloft}

\usepackage{array}
%\usepackage{tabularx}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{rotating}

\usepackage[backend=bibtex,style=alphabetic]{biblatex}
\usepackage[colorlinks,linktocpage,hypertexnames=false,pdfpagelabels]{hyperref}
\usepackage[amsmath,thmmarks,hyperref]{ntheorem}
\usepackage[capitalise]{cleveref}

\usepackage{calc}
\newcommand\clap[1]{\hbox to 0pt{\hss#1\hss}}
\usepackage{epsfig}
\usepackage{symbols}

\usepackage{color}
\usepackage{verbatim}



%---- Theorems, lemmas, etc. ----
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{properties}[theorem]{Properties}
\newtheorem{remark}[theorem]{Remark}

\theoremstyle{break}
\newtheorem{problem}[theorem]{Problem}

\theoremstyle{nonumberplain}
\theorembodyfont{\normalfont}
\theoremsymbol{$\Box$}
\newtheorem{proof}{Proof}

\theoremstyle{nonumberbreak}
\theorembodyfont{\normalfont}
\theoremsymbol{$\Box$}
\newtheorem{sketch}{Proof sketch}

% repeated theorems
\theoremstyle{nonumberplain}
\makeatletter
\newtheorem{rep@theorem}[theorem]{\noexpand\rep@title}
\newcommand{\newreptheorem}[2]{%
  \newenvironment{rep#1}[1]{%
    \def\rep@title{#2~\ref{##1}~(restated)}%
    \begin{rep@theorem}}%
    {\end{rep@theorem}}}
\makeatother
\newreptheorem{theorem}{Theorem}


%---- cleveref ----
\crefname{equation}{}{}
\crefrangelabelformat{equation}{\textup{(#3#1#4)}--\textup{(#5#2#6)}}
\crefname{term}{}{}
\creflabelformat{term}{(#2#1#3)}
\crefname{figure}{Figure}{Figure}
\crefname{remark}{Remark}{Remarks}
\crefname{case}{case}{cases}
\crefname{condition}{condition}{conditions}
\crefname{part}{part}{parts}


%---- possessive citations ----
\DeclareNameFormat{labelname:poss}{% Based on labelname from biblatex.def
  \ifcase\value{uniquename}%
    \usebibmacro{name:last}{#1}{#3}{#5}{#7}%
  \or
    \ifuseprefix
      {\usebibmacro{name:first-last}{#1}{#4}{#5}{#8}}
      {\usebibmacro{name:first-last}{#1}{#4}{#6}{#8}}%
  \or
    \usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
  \fi
  \usebibmacro{name:andothers}%
  \ifnumequal{\value{listcount}}{\value{liststop}}{'s}{}}

\DeclareFieldFormat{shorthand:poss}{%
  \ifnameundef{labelname}{#1's}{#1}}

\DeclareFieldFormat{citetitle:poss}{\mkbibemph{#1}'s}

\DeclareFieldFormat{label:poss}{#1's}

\newrobustcmd*{\posscitealias}{%
  \AtNextCite{%
    \DeclareNameAlias{labelname}{labelname:poss}%
    \DeclareFieldAlias{shorthand}{shorthand:poss}%
    \DeclareFieldAlias{citetitle}{citetitle:poss}%
    \DeclareFieldAlias{label}{label:poss}}}

\newrobustcmd*{\posscite}{%
  \posscitealias%
  \textcite}

\newrobustcmd*{\Posscite}{\bibsentence\posscite}

\newrobustcmd*{\posscites}{%
  \posscitealias%
  \textcites}


%---- environments for computational problems ----%
\newenvironment{instance}{\par\textbf{Instance:}}%
  {\par\noindent\ignorespacesafterend}
\newenvironment{question}{\par\noindent\textbf{Question:}}%
  {\par\noindent\ignorespacesafterend}
\newenvironment{promise}{\par\noindent\textbf{Promise:}}%
  {\par\noindent\ignorespacesafterend}


%---- ragged-right section titles ----
\makeatletter
\renewcommand\section{%
  \@startsection{section}{1}{0pt}%
  {-\baselineskip}{.2\baselineskip}%
  {\normalfont\Large\bfseries\raggedright}}
\renewcommand\subsection{%
  \@startsection{subsection}{2}{0pt}%
  {-\baselineskip}{.2\baselineskip}%
  {\normalfont\large\bfseries\raggedright}}
\renewcommand\subsubsection{%
  \@startsection{subsubsection}{3}{0pt}%
  {-\baselineskip}{.2\baselineskip}%
  {\normalfont\normalsize\bfseries\raggedright}}

\renewcommand\paragraph{%
  \@startsection{paragraph}{4}{0pt}%
  {3.25ex\@plus 1ex\@minus .2ex}{-1em}%
  {\normalfont\normalsize\bfseries\itshape}}
\makeatother


%---- Author and affiliation layout ----
\renewcommand{\Affilfont}{\itshape\small}
\newcommand{\affilcr}{\protect\\}


%----- bibliography -----
\bibliography{spectral-gap}
\DefineBibliographyStrings{english}{in = {}}
\DeclareNameAlias{sortname}{last-first}
%\renewcommand{\bibopenparen}{[}
%\renewcommand{\bibcloseparen}{]}


%----- theorem list -----
\makeatletter
\def\thm@@thmline@name#1#2#3#4{%
  \@dottedtocline{-2}{0em}{2.3em}%
  {\makebox[\widesttheorem][l]{#1 \protect\numberline{#2}}#3}%
  {#4}}
\@ifpackageloaded{hyperref}{
  \def\thm@@thmline@name#1#2#3#4#5{%
    \ifx\\#5\\%
      \@dottedtocline{-2}{0em}{2.3em}%
      {\makebox[\widesttheorem][l]{#1 \protect\numberline{#2}}#3}%
      {#4}
    \else
      \ifHy@linktocpage\relax\relax
        \@dottedtocline{-2}{0em}{2.3em}%
        {\makebox[\widesttheorem][l]{#1 \protect\numberline{#2}}#3}%
        {\hyper@linkstart{link}{#5}{#4}\hyper@linkend}%
      \else
        \@dottedtocline{-2}{0em}{2.3em}%
        {\hyper@linkstart{link}{#5}%
          {\makebox[\widesttheorem][l]{#1 \protect\numberline{#2}}#3}%
          \hyper@linkend}%
        {#4}%
      \fi
    \fi}
}
\makeatother

\newlength\widesttheorem
\AtBeginDocument{\settowidth{\widesttheorem}{Proposition 99\quad}}

\theoremlisttype{allname}


%---- \nobreakhline ----
\makeatletter
\def\nobreakhline{%
  \noalign{\ifnum0=`}\fi
    \penalty\@M
    \futurelet\@let@token\LT@@nobreakhline}
\def\LT@@nobreakhline{%
  \ifx\@let@token\hline
    \global\let\@gtempa\@gobble
    \gdef\LT@sep{\penalty\@M\vskip\doublerulesep}% <-- change here
  \else
    \global\let\@gtempa\@empty
    \gdef\LT@sep{\penalty\@M\vskip-\arrayrulewidth}% <-- change here
  \fi
  \ifnum0=`{\fi}%
  \multispan\LT@cols
     \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
  \noalign{\LT@sep}%
  \multispan\LT@cols
     \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
  \noalign{\penalty\@M}%
  \@gtempa}
\makeatother


%---- shorthands ----
\newcommand{\keyword}[1]{\emph{#1}}
\renewcommand{\emptyset}{\varnothing}
\DeclareMathOperator{\gap}{gap}
\DeclareMathOperator{\poly}{poly}
\DeclareMathOperator{\rem}{frac}
\newcommand{\wc}{{}\cdot{}}
\newcommand{\TM}[1]{\text{\textsc{#1}}}
\newcommand{\lambdamin}{\lambda_{\mathrm{min}}}
\newcommand{\Sbr}{{S_{\!\text{br}}}}
\newcommand{\hrow}{h_{\text{row}}}
\newcommand{\hcol}{h_{\text{col}}}
\newcommand{\Htrans}{H_{\text{trans}}}
\newcommand{\Hpenalty}{H_{\text{pen}}}
\newcommand{\Hinit}{H_{\text{init}}}
\newcommand{\Htranspen}{H_{\text{trans,pen}}}
\newcommand{\Hpath}{H_{\text{path}}}
\newcommand{\htrans}{h_{\text{trans}}}
\newcommand{\hpenalty}{h_{\text{pen}}}
\newcommand{\hinit}{h_{\text{init}}}
\newcommand{\htranspen}{h_{\text{trans,pen}}}





%---- misc ----%
\renewcommand{\theenumi}{(\roman{enumi})}
\renewcommand{\descriptionlabel}[1]{\hspace{\labelsep}\textit{#1}}
\renewcommand{\cftfigfont}{Figure }
\newcounter{tmpcounter}



\begin{document}

\title{Undecidability of the Spectral Gap}

\author[1]{Toby Cubitt\thanks{tsc25@cam.ac.uk}}
\affil[1]{DAMTP, University of Cambridge,
  Centre for Mathematical Sciences,\affilcr
  Wilberforce Road, Cambridge CB3 0WA, United Kingdom}
\author[2]{David Perez-Garcia\thanks{dperezga@ucm.es}}
\affil[2]{Departamento de An\'alisis Matem\'atico,
  Facultad de CC Matem\'aticas,\affilcr
  Universidad Complutense de Madrid,
  Plaza de Ciencias 3, 28040 Madrid, Spain}
\author[3]{Michael M.~Wolf\thanks{m.wolf@tum.de}}
\affil[3]{Department of Mathematics, Technische Universit\"at M\"unchen,
  85748 Garching, Germany}

\date{\today}


\maketitle


\begin{abstract}
  We show that the spectral gap problem is undecidable. Specifically, we construct families of translationally-invariant, nearest-neighbour Hamiltonians on a 2D square lattice of $d$-level quantum systems ($d$ constant), for which determining whether the system is gapped or gapless is an undecidable problem. This is true even with the promise that each Hamiltonian is either gapped or gapless in the strongest sense: it is promised to either have continuous spectrum above the ground state in the thermodynamic limit, or its spectral gap is lower-bounded by a constant in the thermodynamic limit. Moreover, this constant can be taken equal to the local interaction strength of the Hamiltonian.

  This implies that it is logically impossible to say in general whether a quantum many-body model is gapped or gapless. Our results imply that for any consistent, recursive axiomatisation of mathematics, there exist specific Hamiltonians for which the presence or absence of a spectral gap is independent of the axioms.

  These results have a number of important implications for condensed matter and many-body quantum theory.
\end{abstract}

\tableofcontents
\clearpage

\section*{List of Theorems}
\listtheorems{theorem,definition,lemma,corollary,proposition,result,claim,remark,example,properties}
\clearpage

\listoffigures
\clearpage


\part{}
\input{introduction}
\input{preliminaries}
\input{main-results}\clearpage
\input{overview}\clearpage
\part{}
\input{unbounded}\clearpage
\part{}
\input{phase-estimation}\clearpage
\input{local-Hamiltonians}\clearpage
\input{quasi-periodic}\clearpage
\input{put-together}\clearpage
\input{acknowledgements}

\printbibliography

\end{document}



%%% Local Variables:
%%% mode: latex
%%% mode: visual-line
%%% mode: adaptive-wrap-prefix
%%% fill-column: 999999
%%% TeX-master: t
%%% End:

%  LocalWords:  Departamento alisis Matem atico Facultad aticas Universidad Complutense Ciencias Technische Universit unchen Garching

unbounded.tex
\section{Unconstrained local Hilbert space dimension}
\label{sec:unbounded}

In this part we will describe two approaches that exploit known undecidability results for tiling and completion problems. Based on these, we can derive undecidability results for the spectral gap and for other low energy properties of translational invariant nearest-neighbour Hamiltonians on a square lattice. In contrast to the approach in the main part of this paper, however, the families of Hamiltonians that we construct here, defined by their local interactions $\{(h_\text{row}(n),h_\text{col}(n))\}_{n\in\mathbb{N}}$, have local Hilbert space dimension $d_n$ that differs for different elements $n$ of the family, in such a way that $\{d_n\}_{n\in\mathbb{N}}$ is unbounded.% (Throughout this section, we will not make use of an additional on-site term in the Hamiltonians, i.e.\ $h_1=0$.)

\subsection{Undecidability of the spectral gap via tiling}
\label{sec:undec_via_tiling}
As in the more sophisticated constructions that will appear later, the idea is to reduce an undecidable ground state energy problem to the spectral gap problem. If we do not constrain the local Hilbert space dimension, then this reduction can be chosen such that it directly exploits the undecidability of a tiling problem. To this end, we need two ingredients:


\subsubsection{Ingredient 1: a tiling Hamiltonian}
We saw in \cref{sec:overview:Wang-tiling} that a tiling problem can easily be represented as a ground state energy problem for the local Hamiltonian
\begin{align}
  h_c^{(i,j)} &:= \sum_{(m,n)\in C^{(i,j)}} \proj{m}^{(i)}\ox\proj{n}^{(j)},\\
  H_c^{\Lambda(L)} &:= \sum_{(i,j)\in\cal E} h_c^{(i,j)},
\end{align}
where the local basis $\ket{m}$ label tile types, and the set of constraints $C^{(i,j)}\subseteq\mathcal{K}\times\mathcal{K}$ includes all pairs of tiles $(m,n)$ which are incompatible when placed on adjacent sites $i$ and $j$.

By construction we have $h_c^{(i,j)}\geq 0$, $H_c^{\Lambda(L)}$ is translational invariant and its spectrum is contained in $\mathbb{N}_0$. If there exists a tiling of the plane, then for open boundary conditions $\forall L: 0\in\spec{H_c^{\Lambda(L)}}$. Similarly, in the case of periodic boundary conditions, the existence of a periodic tiling implies that $0\in\spec{H_c^{\Lambda(L)}}$ holds for an unbounded sequence of $L$'s. On the other hand, if there is no tiling, then there is an $L_0$ such that
\begin{equation}
  \forall L>L_0 : \spec{H_c^{\Lambda(L)}} \geq 1.
\end{equation}
Also note that this implies that in the case of open boundary conditions the ground state energy density is $E_\rho\geq 1/(L_0+1)^2$ if no tiling exists, compared to $E_\rho=0$ if there is a tiling of the plane.


\subsubsection{Ingredient 2: a gapless frustration-free Hamiltonian}
As a second ingredient we will use that there are frustration-free two-body Hamiltonians
\begin{equation}
  H_q^{\Lambda(L)}:=\sum_{(i,j)\in\cal E} h_q^{(i,j)},
\end{equation}
such that for $L\rightarrow\infty$ we get $\spec{H_q^{\Lambda(L)}}\rightarrow\R_+$ in the sense that the spectrum of the finite system approaches a dense subset of $\R_+$ \cite{UncleHamiltonians}. We will denote the corresponding single site Hilbert space by $\HS_q^{(i)}\simeq\C^D$ and we can in fact choose $D=2$ for instance by assigning to each row of the lattice the XY-model with transversal field taken at a gapless point with product ground state. Note that in this case the entries of the matrices $h_q^{(i,j)}$ are rational.


\subsubsection{Reducing tiling to spectral gap}
In order to fruitfully merge the ingredients, we assign a Hilbert space $\HS^{(i)} := \HS_0^{(i)}\oplus\HS_c^{(i)}\ox\HS_q^{(i)} \simeq \C^1\oplus\C^K\ox\C^D$ to each site $i\in\Lambda(L)$. A corresponding orthonormal set of basis vectors will be denoted by $\ket{0}\in\C^1$ and $\ket{k,\alpha}:=\ket{k}\ox\ket{\alpha}\in\C^K\ox\C^D $, respectively. The Hamiltonian is then defined in terms of the two-body interactions
\begin{align}
  H^{(i,j)} &:= \proj{0}^{(i)}\ox\1_{cq}^{(j)}+\1_{cq}^{(i)}\ox\proj{0}^{(j)}
              \label{eq:main1a}\\
           &+ \sum_{(m,n)\in C^{(i,j)}}
              \proj{m}^{(i)}\ox\1_q^{(i)}\ox\proj{n}^{(j)}\ox\1_q^{(j)}
              \label{eq:main2}\\
           &+ \sum_{\alpha,\beta,\gamma,\delta=1}^D\1_c^{(i)} \ox
              \ketbra{\alpha}{\beta}^{(i)} \ox \1_c^{(j)} \ox \ketbra{\delta}{\gamma}^{(j)} \; \braket{\alpha,\delta|h_q^{(i,j)}|\beta,\gamma}.
              \label{eq:main3}
\end{align}
Here $\1_c,\1_q$ and $\1_{cq}$ denote the identity operators on $\HS_c,\HS_q$ and $\HS_c\ox\HS_q$, respectively. As before, we define the Hamiltonian assigned to a square $\Lambda(L)$ as
\begin{equation}
  H^{\Lambda(L)}:=\sum_{(i,j)\in\cal E}H^{(i,j)}.
\end{equation}
\begin{theorem}[Reducing tiling to spectral gap]\label{thm:main-unbounded}
  Consider any set $\mathcal{K}$ of Wang tiles, and the corresponding family of two-body Hamiltonians $\{H^{\Lambda(L)}\}_{L}$ on square lattices $\Lambda(L)$ either with open or with periodic boundary conditions.
  \begin{enumerate}
  \item The family of Hamiltonians is frustration-free.
  \item If $\mathcal{K}$ tiles the plane $\mathbb{Z}^2$, then in the case of open boundary conditions, we have that $\spec{H^{\Lambda(L)}}\rightarrow\mathbb{R}_+$ for $L\rightarrow\infty$, i.e., there is no gap and an excitation spectrum that becomes dense in $\R_+$. Similarly, if $\mathcal{K}$ tiles any torus, then in the case of periodic boundary conditions $\spec{H^{\Lambda(L_i)}}\rightarrow\mathbb{R}_+$ for a subsequence $L_i\rightarrow\infty$.
  \item If $\mathcal{K}$ does not tile the plane, then there is an $L_0$ such that for all $L>L_0$ $H^{\Lambda(L)}$ has a unique ground state and a spectral gap of size at least one, i.e.
    \begin{equation}
      \spec{H^{\Lambda(L)}}\setminus\{0\}\geq 1.
    \end{equation}
  \end{enumerate}
\end{theorem}

\begin{proof}
  Frustration-freeness is evident since $H^{(i,j)}\geq 0$ and $H^{\Lambda(L)}\ket{0,\ldots,0} = 0$. In order to arrive at the other assertions, we decompose the Hamiltonian as $ H^{\Lambda(L)}=:H_0+H_c+H_q$, where the three terms on the right are defined by taking the sum over edges separately for the expressions in \cref{eq:main1a}, \cref{eq:main2} and \cref{eq:main3}, respectively. Let us now assign a \emph{signature} $\sigma\in\{0,\ldots,K\}^{L^2}$ to every state of our computational product basis, so that $\ket{0}^{(i)}$ translates to $\sigma_i=0$ and $\ket{k,\alpha}^{(i)}$ to $\sigma_i=k$, irrespective of $\alpha$. By collecting computational basis states with the same signature we can then decompose the Hilbert space as
  \begin{equation}
    \bigotimes_{i\in\Lambda}\HS^{(i)}\simeq\bigoplus_{\sigma}\HS_\sigma.
  \end{equation}
  The reason behind this is that the Hamiltonian is block diagonal w.r.t. this decomposition, i.e.\ it can be written as
  \begin{equation}
    H^{\Lambda(L)}=\bigoplus_\sigma H_\sigma,
    \quad\text{and thus}\quad
    \spec{H^{\Lambda(L)}}=\bigcup_\sigma\spec{H_\sigma}.
  \end{equation}
  In order to identify the spectra coming from different signatures we will distinguish three cases:

  \begin{enumerate}
  \item $\sigma=(0,\ldots,0)$: this yields an eigenvalue $0$ as already mentioned.

  \item $\sigma \neq (0,\ldots,0)$ but $\sigma_i=0$ for some $i$: for any unit vector $\ket{\psi_\sigma}$ with such a signature we have $\braket{\psi_\sigma|H_0|\psi_\sigma} \geq 1$. We will denote the part of the spectrum which corresponds to these signatures by $S\subset\mathbb{R}$. The only property we will use is that $S\geq 1$.

  \item $\sigma\in\{1,\ldots,K\}^{L^2}$: In the subspace spanned by all states whose signature does not contain $0$ we have that $H_0=0$ and $H_c+H_q=H_c^{\Lambda(L)}\ox\1+\1\ox H_q^{\Lambda(L)}$. Consequently, the spectrum stemming from this subspace equals $\spec{H_c^{\Lambda(L)}}+\spec{H_q^{\Lambda(L)}}$.
  \end{enumerate}

  Putting things together, we obtain
  \begin{equation}
    \spec{H^{\Lambda(L)}} = \{0\}\cup\Big\{\spec{H_c^{\Lambda(L)}}+\spec{H_q^{\Lambda(L)}}\Big\}\cup S,
  \end{equation}
  so that the claimed equivalence between the impossibility of tiling with $\mathcal{K}$ and the existence of a spectral gap of size at least~1 follows from the properties of the chosen ingredients. Uniqueness of the ground state in cases where no tiling exists follows from the above argument when considering the spectra as multisets rather than sets.
\end{proof}

From the undecidability of the tiling problem we now obtain:
\begin{corollary}[Undecidability of spectral gap for unconstrained dimension]\ \\
  Let $\epsilon >0$. Consider all families $\{H^{\Lambda(L)}\}$ of frustration-free translational invariant nearest neighbour Hamiltonians on 2D square lattices with open boundary conditions that are described by a pair of Hermitian matrices $(h_\text{row},h_\text{col})$\footnote{Here we make no use of an additional on-site term, so $h_1=0$.} with rational entries and operator norm smaller than $1+\epsilon$. There is no algorithm that upon input of $(h_\text{row},h_\text{col})$ decides whether these describe a gapped or a gapless system, even under the promise that one of them is true and that in the gapped case the gap is at least of size~1.
\end{corollary}
Here, the norm bound follows from the observation that $\matnorm{H^{(i,j)}} \leq 1 + \matnorm{h_q^{(i,j)}}$ where $h_q^{(i,j)}$ can be rescaled to arbitrary small norm.

For the case of periodic boundary conditions we obtain the same statement if we replace our strong definition of `gapless' by the weaker requirement that $\exists c>0\forall\epsilon>0\forall L_0\exists L>L_0$ so that every point in $[\lambda_0(H^{\Lambda(L)}),\lambda_0(H^{\Lambda(L)})+c]$ is within distance $\epsilon$ from $\spec H^{\Lambda(L)}$. The reason for this is, that if the period of the torus does not match the required one, then a gap can be generated that, however, disappears again if we enlarge the size of the system.

We emphasise that, so far, there is no constraint on the local Hilbert space dimension. Since every instance in the above construction has a finite local Hilbert space we can, however, at least conclude axiomatic undecidability for finite local Hilbert spaces. That is, for every consistent formal system with a recursive set of axioms, there exists an instance of a Hamiltonian with properties as in the corollary and finite dimensional local Hilbert space such that neither the presence nor the absence of a spectral gap can be proven from the axioms. However, the local dimension, whilst finite, is uncomputable. In the main part of the paper, we will prove the much stronger \cref{thm:promise}, which shows that the spectral gap problem remains undecidable even for fixed local dimension. This implies axiomatic independence for Hamiltonians where the finite local dimension is known.

In the above construction, gapped cases are related to the impossibility of tiling. Since the latter always admits a proof, the axiomatically undecidable cases coming from this construction have to be gapless. The following section will provide a construction where this asymmetry is reversed.


\subsection{Undecidability of low energy properties}

\subsubsection{Reducing tile completion to a ground state energy problem}
We now modify the above construction in order to show that not only the spectral gap but many other low energy properties are undecidable as well. The idea, illustrated in the case of the spectral gap, is to invert the relation between gap and existence of tiling. In the previous construction, the existence of a gap was associated with the impossibility of a tiling. Now we want to associate it with the \emph{existence} of a tiling. The drawback is that we loose the frustration free property in that case.% and that the result does not immediately generalize to the case of periodic boundary conditions.
One of the advantages is that we do not have to rely on the undecidability of tiling (which is a rather non-trivial result \cite{Berger,Robinson}) but can exploit the simpler undecidability of the \keyword{completion problem}, already proven by Wang \cite{Wang}. In the completion problem, one fixes one tile at the left-bottom corner and asks whether the first quadrant can be tiled with a given set of tiles.

Undecidability of the completion problem is relatively simple, and explained in full detail in \textcite[Section 4]{Robinson}, by reduction from the halting problem for Turing Machines. Any Turing machine is specified by a finite number of states $Q=\{q_0, q_1,\ldots \}$, a finite alphabet for the tape $S=\{s_0,s_1,\ldots\}$, where $q_0$ is the initial state and $s_0$ the blank, and quintuplets of the forms $$(q,s,s', D,q')\in Q\times S\times S\times \{\text{left, right}\}\times Q$$ meaning that if the head of the machine reads $s$ and the machine is in state $q$, then it will write $s'$ into the current cell on the tape, transit to state $q'$ and move in the direction $D$. Starting in $q,s$, there must be at most one valid quintuplet. If there is none, then the machine halts.\footnote{Note that this definition is slightly different from the one used later in \cref{sec:phase-estimation}.}

Following \textcite{Robinson}, we define the tiles in \cref{fig:RobinsonTM-tiles}, where colours are identified with labelled arrows, in such a way that matching colours are indicated by an arrow head abutting a tail with the same label. We denote the set of tiles by $\mathcal{K}$, which contains at most $K:=|\mathcal{K}|\leq 2+ (3|Q|+1)|S|$ elements.

\begin{figure}[!htp]
  \centering
  % Requires \usepackage{graphicx}
   \includegraphics[width=0.8\columnwidth]{RobinsonTMtiles.pdf}
  \caption[Undecidability of the tiling completion problem.]{Tiles for encoding a Turing machine with half-infinite tape into a completion problem. The tile in the bottom-left corner is fixed and, together with the second tile in the third row, starts the Turing machines running on the blank half-infinite tape. The tiles in the second row are the 'action tiles' that are able to change the state of the Turing machine and correspond to a left or right moving head. For each pair $(q,s)$ there is at most one action tile.}\label{fig:RobinsonTM-tiles}
\end{figure}

We will assume that the Turing machines is constructed such that, when running on the initially blank tape, its head never moves to the left of the starting cell. Note that this can be assumed without loss of generality, since every Turing machine can be simulated by one with this property by standard techniques, which amount to `folding' the tape and thereby doubling the tape alphabet.


If the tile that appears in the bottom-left corner in \cref{fig:RobinsonTM-tiles}, which we denote by $\crossURblue$, is fixed in the bottom-left corner of an $L\times L$ lattice, then any valid tiling corresponds to the evolution of the Turing Machine on the blank tape up to time $L$, where time goes up in the vertical direction and each row of tiles corresponds to the total configuration (including the tape) of the Turing machine in two consecutive instants of time (represented by the bottom and upper edges of that row of tiles). Hence,
\begin{enumerate}[label=(\arabic{*}).,ref=(\arabic{*})]
\item There exists a valid tile completion for all $L\times L$ squares if and only if the Turing Machine, when running on an initially blank tape, does not halt.
\item If such a tiling exists, then it is unique.
\end{enumerate}

Now, the completion problem can be represented as a ground state energy problem in the following straightforward way. Consider a square lattice $\Lambda(L)$ with open boundary conditions and corresponding edge set $\cal E$.

We will assign an energy penalty or energy bonus $w_{(i,j)}(m,n)\in\mathbb{Z}$ to an edge $(i,j)\in\cal E$ on which a pair of tiles $(m,n)\subseteq\mathcal{K}\times\mathcal{K}$ is placed. The choice of the weights is summarised in the following table. Here $\wctile$ stands for any tile different from $\crossURblue$ and the numbers in brackets define the weights in cases where the colours (i.e., labels and arrows) match.
%
\begin{equation}\label{eq:corner_weights}
  \begin{array}{cc|cc}
    & & \multicolumn{2}{|c}{\text{Right tile}} \\
    & & \crossURblue & \wctile \\
    \hline
    \multirow{2}{*}{{\text{Left tile}}}
    & \crossURblue & 4 & 2\ (-1) \\
    & \wctile & 4 & 2\ \phantom{-}(0)
  \end{array}
  \qquad
  \begin{array}{cc|cc}
    & & \multicolumn{2}{|c}{\text{Tile above}} \\
    & & \crossURblue & \wctile \\
    \hline
    \multirow{2}{*}{{\text{Tile below}}}
    & \crossURblue  & 4 & 2\ (-1) \\
    & \wctile  & 4 & 2\ \phantom{-}(0)
  \end{array}
\end{equation}

\vspace{2em}

Assigning a Hilbert space $\HS_u^{(i)}\simeq\mathbb{C}^{K}$ to each site $i\in\Lambda(L)$ whose computational basis states are labelled by tiles we define a Hamiltonian $H_u^{\Lambda(L)}:=\sum_{(i,j)\in\cal E}h_u^{(i,j)},$ with
\begin{equation}
  h_u^{(i,j)} := \sum_{m,n\in\mathcal{K}} \omega_{(i,j)}(m,n)\ \proj[(i)]{m}\ox\proj[(j)]{n}.
\end{equation}
By construction, the Hamiltonian is diagonal in computational basis, its eigenvectors correspond to tile configurations $\Lambda(L)\rightarrow \mathcal{K}$ and, since all weights are integers, its spectrum lies in $\mathbb{Z}$. In order to determine the ground state energy note that the tile $\crossURblue$ is the only one that can lead to negative weights. Assume first that a tile $\crossURblue$ is placed on a site different from the bottom-left corner. Then this tile will have at least one neighbour below with an arrow pointing upwards or one neighbour to the left with an arrow pointing to the right. In either case there will be an energy penalty $+4$ so that the weights involving this tile will sum up to at least $2$. If, however, $\crossURblue$ is placed in the bottom-left corner, then no such energy penalty is picked up and the tile can contribute $-2$ to the energy. If the tiling is then completed following the evolution of the encoded Turing machine on a blank tape, then no additional penalty will occur on $\Lambda(L)$ if until the $L$'th time step either the head of the Turing machines moves left of the origin or the Turing machine does not halt. Hence, in both cases $\lambda_0(H_u^{\Lambda(L)})=-2$ and the ground state is unique and given by a product state.

If the Turing machine halts, then the completion problem has no solution beyond some $L_0$ and every configuration with $\crossURblue$ at its bottom-left corner will get an additional penalty of at least $2$ leading to non-negative energy. Since there is always a configuration that achieves zero energy, e.g., one using only the type of tiles on the top-left in \cref{fig:RobinsonTM-tiles}, we obtain:

\begin{lemma}[Relating ground state energy to the halting problem]\label{TM2gsenergy1}
  Consider any Turing machine with state set $Q$ and tape alphabet $S$ running on an initially blank tape such that its head never moves left of the starting cell. There is a family of translational invariant nearest neighbour Hamiltonians $\{H_u^{\Lambda(L)}\}_L$ (specified above) on the 2D square lattice with open boundary conditions and local Hilbert space dimension at most $|S|(3|Q|+1)+2$ such that
  \begin{enumerate}
  \item\label{TMlemmaitem1} If until time $L$ the Turing machines did not halt, then $\lambda_0(H_u^{\Lambda(L)})=-2$. In this case the corresponding ground state is a unique product state and the only eigenstate with negative energy.
  \item If the Turing machine halts, then $\exists L_0$ (given by the halting time) such that $ \forall L>L_0:\lambda_0(H_u^{\Lambda(L)})= 0$.
\end{enumerate}
\end{lemma}
Since every Turing machine can be simulated by one with a half-infinite tape, which automatically satisfies the constraint that its head never moves to the left of the origin, the above construction leads to an undecidable ground state energy problem, which we will exploit in the following.



\subsubsection{Reduction of the halting problem to arbitrary low energy properties}\label{sec:physical-implications}

Consider translational invariant Hamiltonians on square lattices with open boundary conditions. Let $H_q^{\Lambda(L)}$ describe such a family of Hamiltonians on  $L\times L$ lattices. Our aim is to prove the undecidability of essentially any low energy property displayed by this Hamiltonian in the thermodynamic limit that distinguishes it from a gapped system with unique product ground state, e.g.\ the existence of topological order, or non-vanishing correlation functions. This is implied by the following theorem:

\begin{theorem}[Relating low energy properties to the halting problem]\label{low-energy}
  Let TM be a Turing machine with state set $Q$ and alphabet $S$ running on an initially blank tape. Consider the class of translational invariant Hamiltonians on square lattices with open boundary conditions. Let $H_q^{\Lambda(L)}$ with nearest-neighbour interaction  $h_q^{(i,j)}\in\cB(\HS_q^{(i)}\ox\HS_q^{(j)})$ with $\HS_q^{(i)}\simeq\mathbb{C}^q$ and on-site term $h_{q1}^{(k)}\in\cB(\HS_q^{(k)})$ describe such a Hamiltonian and assume that there is a $c\in\mathbb{R}$ such that $\lambda_0\Big(H_q^{\Lambda(L)}\Big)-cL^2\in[-\frac12,\frac12]$ for all lattice sizes $L$.
  Then there exists a family of Hamiltonians $H^{\Lambda(L)}$ (specified in the proof) with the following properties:
  \begin{enumerate}
  \item $H^{\Lambda(L)}$ is translational invariant on the square lattice with open boundary conditions and local Hilbert spaces $\HS^{(i)}\simeq\mathbb{C}^d$ of dimension $d\leq 2(q+1)+|S|(3|Q|+1)$.
    \item The interactions of $H^{\Lambda(L)}$ are nearest-neighbour (possibly with on-site terms), computable and independent of $L$.
  \item\label{lowenergythm_nonhalting} If up to time $L$ the TM did not halt, then $H^{\Lambda(L)}$ has a non-degenerate product ground state and a spectral gap $\Delta(H^{\Lambda(L)})\geq\frac12$.
  \item \label{lowenergythm_halting} If TM halts, then $\exists L_0$ (given by the halting time) such that $\forall L>L_0$ the following identity between multisets holds in the interval $[0,\frac12)$:
    \begin{equation}
      \spec H_q^{\Lambda(L)}-\lambda_0(H_q^{\Lambda(L)})
      = \spec H^{\Lambda(L)}-\lambda_0(H^{\Lambda(L)}).
    \end{equation}
    In this case there exist isometries $V^{(i)}:\HS_q^{(i)}\rightarrow \HS^{(i)}$, $V:=\bigotimes_i V^{(i)}$ such that for this part of the spectrum any eigenstate $\ket{\phi_q}$ of $H_q^{\Lambda(L)}$ is mapped to the corresponding eigenstate $\ket{\phi}$ of $H^{\Lambda(L)}$ via $V\ket{\phi_q}=\ket{\phi}$.
  \end{enumerate}
\end{theorem}

Some remarks before the proof. Since, on the Turing machine level, \labelcref{lowenergythm_nonhalting} and \labelcref{lowenergythm_halting} cannot be told apart by any effective algorithm, the same has to hold for any property that distinguishes a gapped system with product ground state from the low energy sector of some frustration free Hamiltonian. With small modifications in the proof, the nearest neighbour assumption for $h_q$ could be replaced by any fixed local interaction geometry. In this case, $H^{\Lambda(L)}$ will of course inherit this interaction geometry.

\begin{proof}
  W.l.o.g.\ $c=0$ since we can always compensate for it by adding a multiple of the identity to the on-site part of the Hamiltonian.

  For later use we will embed the given frustration free Hamiltonian in a larger systems such that its ground state energy gets an offset $-1$. To this end, define a translational invariant nearest neighbour Hamiltonian on an auxiliary system with local Hilbert space $\HS_a^{(i)}\simeq\mathbb{C}^2$ via $$\eta:=\sum_{(i,j)\in\cal E}\eta^{(i,j)},\quad\eta^{(i,j)}:=-\frac12 |0\rangle\langle 0|^{(i)}\ox|1\rangle\langle 1|^{(j)}+2 \1^{(i)}\ox|0\rangle\langle 0|^{(j)}.$$ Note that $\lambda_0(\eta)=-1$ and $\Delta(\eta)=1$. Now introduce $\HS_Q^{(i)}:=\HS_a^{(i)}\ox\HS_q^{(i)}$ and set $h_Q^{(i,j)}:=\eta^{(i,j)}\ox\1_q^{(i,j)}+\1_a^{(i,j)}\ox h_q^{(i,j)}$ acting on $\HS_Q^{(i)}\HS_Q^{(j)}$ (up to reordering of Hilbert spaces). Then $H_Q^{\Lambda(L)}:=\sum_{(i,j)\in\cal E} h_Q^{(i,j)}+\sum_{k\in\Lambda(L)}\1_a^{(k)}\otimes h_{q1}^{(k)}$ has the property that in the interval $\Big(-\infty,\lambda_0(H_q^{\Lambda(L)})\Big)$ we have that $$\spec H_q^{\Lambda(L)}-1=\spec H_Q^{\Lambda(L)}$$ holds as an identity between multisets (i.e., including multiplicities) and the corresponding eigenstates are related via a local isometric embedding.

  We will now combine this with the Hamiltonian from the previous subsection by enlarging the local Hilbert space to $\HS^{(i)}:=\HS_u^{(i)}\oplus \HS_Q^{(i)}$ and defining
  \begin{equation}\label{eq:main1}
    h^{(i,j)}:=h_Q^{(i,j)}+h_u^{(i,j)}+7 \1_Q^{(i)}\ox \1_u^{(j)},
  \end{equation}
  where $h_Q^{(i,j)}$ and $h_u^{(i,j)}$ act nontrivially on $\HS^{(i)}_Q\ox \HS_Q^{(j)}$ and $\HS_u^{(i)}\ox \HS_u^{(j)}$ respectively and $\mathbbm{1}_u$ and $\mathbbm{1}_Q$ denote the projectors onto the respective subspaces. The Hamiltonian on the square $\Lambda(L)$ is now
  \begin{equation}
    H^{\Lambda(L)}=\sum_{(i,j)\in\cal E}h^{(i,j)}+\sum_{k\in\Lambda(L)}\1_a^{(k)}\otimes h_{q1}^{(k)}.
  \end{equation}
  We decompose it as $ H^{\Lambda(L)}=:\tilde{H}_q + \tilde{H}_u + \tilde{H}_p$, where the three terms on the right are defined by taking the sum over edges separately for the three interactions in \cref{eq:main1} and $\tilde{H}_q$ contains the on-site terms in addition. Let us now assign a \emph{signature} $\sigma\in\{0,1\}^{L^2}$ to every state of our computational product basis, so that $\ket{i}^{(j)}$ translates to $\sigma_j=0$ for all $\ket{i}\in \HS_u^{(j)}$ and $\sigma_j=1$ for all $\ket{i}\in \HS_Q^{(j)}$. By collecting computational basis states with the same signature, we can then decompose the Hilbert space as
  \begin{equation}
    \bigotimes_{i\in\Lambda}\HS^{(i)}\simeq\bigoplus_{\sigma}\HS_\sigma.
  \end{equation}
  The reason behind this is that the Hamiltonian is block diagonal w.r.t.\ this decomposition, i.e.\ it can be written as
  \begin{equation}
    H^{\Lambda(L)}=\bigoplus_\sigma H_\sigma,
    \quad\mbox{and thus}\quad
    \spec{H^{\Lambda(L)}}=\bigcup_\sigma\spec{H_\sigma}.
  \end{equation}
  In order to identify the spectra and eigenstates coming from different signatures we will distinguish three cases:

  \paragraph{Case~1:} $\sigma=(0,\ldots,0)$. In this sector $\tilde{H}_p = \tilde{H}_q=0$ so that we are left with $H_u^{\Lambda(L)}$.

  \paragraph{Case~2:} $\sigma=(1,\ldots,1)$. In this sector $\tilde{H}_p = \tilde{H}_u=0$ so that we are left with $H_Q^{\Lambda(L)}$.

  \paragraph{Case~3:} $\sigma \neq (0,\ldots,0)$ but $\sigma_i=0$ for some $i$. Let us define $A_\sigma := \{i\in \Lambda(L)|\sigma_i=0\}$. Decompose ${A_\sigma}$ into rectangles row by row, as in \cref{fig:rectangles} following the following conventions for the rectangles:
  \begin{enumerate}
  \item[(i)] They live on the dual lattice.
  \item[(ii)] If one is on top of another of the same size (such as those marked~1 and~2 in the figure), we glue them together into a single larger rectangle.
  \item[(iii)] \textit{For each rectangle}, we choose a neighbouring pair $(i,j)$ such that both $i$ and $j$ are in the same row, $i\in A_\sigma$, $j\not\in A_\sigma$. This selection is illustrated in the figure by black dots (joined by a link). If this is not possible because the rectangle is a whole row (as for the rectangle marked~3 in the figure), we take $j$ in the next (or previous) possible row after applying convention~(ii). An example is shown in the figure as a pair or linked purple dots.
  \item[(iv)] \textit{For each overlapping region} between pairs of rectangles (such as those marked with dashed red lines in the figure), we also choose a neighbouring pair $(i,j)$ with $i\in A_\sigma$, $j\not\in A_\sigma$, but now $i$ belongs to one of the rectangles (the larger one is a valid option) and $j$ in the row of the other rectangle. This selection is illustrated in the figure by linked red dots.
  \end{enumerate}

  \begin{figure}[hbtp]
    \centering
    \includegraphics[width=.8\columnwidth]{rectangles}\\
    \caption[Counting argument for proof of \cref{low-energy}.]{Illustration of the counting explained in the main text.}\label{fig:rectangles}
  \end{figure}

  How can we choose all these pairs $(i,j)$ with the minimal number of repetitions? To repeat a pair, two things may happen. Either we have to choose the same vertical pair to select two different overlapping regions (located at its right and left) -- illustrated by a pair of green dots in the figure -- or we have to choose the same vertical pair to select one or two overlapping regions and also a rectangle made out of a full row. In any case, each pair is chosen not more than three times. For instance, the purple joint dots in the figure are chosen three times. With this analysis we conclude that if we denote by $n_{A_\sigma}$ the number of rectangles, $m_{A_\sigma}$ the number of overlaps between them and $k_{A_\sigma}$ the number of chosen different pairs $(i,j)$ with $i\in A_\sigma$, $j\not\in A_\sigma$, we have that
  \begin{equation}\label{eq:comp-1}
    3k_{A_\sigma}\ge n_{A_\sigma}+m_{A_\sigma}.
  \end{equation}

  With these conventions we divide the interactions of $\tilde{H}_u$ into those within the rectangles $H_{\rm rectangles}$, those in the overlaps of rectangles $H_{\rm overlaps}$ and the rest $H_{\rm rest}$. We have that for any unit vector $|\psi_\sigma\rangle$ with signature $\sigma$:
  \begin{align*}
    \braket{\psi_\sigma|H_{\rm rectangles}|\psi_\sigma}
      &\geq  -2 n_{A_\sigma}\;,\\
    \braket{\psi_\sigma|H_{\rm overlap}|\psi_\sigma}
      &\geq  -2  m_{A_\sigma}\;,\\
    \braket{\psi_\sigma|H_{\rm rest}|\psi_\sigma} &= 0\;,
  \end{align*}
  which gives
  \begin{equation}\label{eq:rect-1}
    \braket{\psi_\sigma|\tilde{H}_u|\psi_\sigma} \geq - 2 (n_{A_\sigma}+m_{A_\sigma})\;.
  \end{equation}
  The reason behind is that, by the same argument as in the previous section, $\lambda_0(H_u^R)\ge -2$ for all rectangles $R$.
   Finally, we have trivially
  \begin{align}\label{eq:rect-3}
  \langle\psi_\sigma|\tilde{H}_q|\psi_\sigma\rangle &\geq \lambda_0(H_q^{\Lambda(L)}) -1\; ,\\
  \langle\psi_\sigma|\tilde{H}_p|\psi_\sigma\rangle &\geq 7k_{A_\sigma}\; .\label{eq:rect-4}
  \end{align}
  Therefore, using \crefrange{eq:comp-1}{eq:rect-4}, we get $\braket{\psi_\sigma|H^{\Lambda(L)}|\psi_\sigma}-\lambda_0(H_q^{\Lambda(L)}) \geq k_{A_\sigma}-1\geq 0$. Hence, if we denote the part of the spectrum which corresponds to these mixed signatures by $S\subset\mathbb{R}$ we have that $S\geq \lambda_0(H_q^{\Lambda(L)})$.

  Putting things together,  we get that the spectrum is decomposed according to the signatures as
  \begin{equation}
    \spec{H^{\Lambda(L)}}=\spec{H_u^{\Lambda(L)}}\cup \spec{H_Q^{\Lambda(L)}}\cup S
  \end{equation}
  where
  \begin{equation}\label{eq:properties-Hq}
    \lambda_0(H_Q^{\Lambda(L)}) =\lambda_0(H_q^{\Lambda(L)})-1,\;\; S\ge -\frac12,
  \end{equation}
  and according to \cref{TM2gsenergy1} either $\spec H_u^{\Lambda(L)}\geq 0$ or $H_u^{\Lambda(L)}$ has one negative eigenvalue $-2$, corresponding to a product ground state. Which is the case depends on the evolution of the encoded Turing machine (and thus becomes undecidable).
\end{proof}


%%% Local Variables:
%%% mode: latex
%%% mode: visual-line
%%% TeX-master: "spectral-gap"
%%% End:

%  LocalWords:  XY

spectral-gap.bbl
% $ biblatex auxiliary file $
% $ biblatex version 2.4 $
% Do not modify the above lines!
%
% This is an auxiliary file used by the 'biblatex' package.
% This file may safely be deleted. It will be recreated as
% required.
%
\begingroup
\makeatletter
\@ifundefined{ver@biblatex.sty}
  {\@latex@error
     {Missing 'biblatex' package}
     {The bibliography requires the 'biblatex' package.}
      \aftergroup\endinput}
  {}
\endgroup

\entry{AKLT}{article}{}
  \name{author}{4}{}{%
    {{}%
     {Affleck}{A.}%
     {I.}{I.}%
     {}{}%
     {}{}}%
    {{}%
     {Kennedy}{K.}%
     {T.}{T.}%
     {}{}%
     {}{}}%
    {{}%
     {Lieb}{L.}%
     {E.H.}{E.}%
     {}{}%
     {}{}}%
    {{}%
     {Tasaki}{T.}%
     {Hal}{H.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{AI+1}
  \strng{fullhash}{AIKTLETH1}
  \field{labelalpha}{Aff+88}
  \field{sortinit}{A}
  \field{issue}{3}
  \field{pages}{477}
  \field{title}{Valence bond ground states in isotropic quantum
  antiferromagnets}
  \field{volume}{115}
  \field{journaltitle}{CMP}
  \field{year}{1988}
\endentry

\entry{Aharonov-adiabatic}{article}{}
  \name{author}{6}{}{%
    {{}%
     {Aharonov}{A.}%
     {D.}{D.}%
     {}{}%
     {}{}}%
    {{}%
     {Dam}{D.}%
     {W.}{W.}%
     {van}{v.}%
     {}{}}%
    {{}%
     {Kempe}{K.}%
     {J.}{J.}%
     {}{}%
     {}{}}%
    {{}%
     {Landau}{L.}%
     {Z.}{Z.}%
     {}{}%
     {}{}}%
    {{}%
     {Lloyd}{L.}%
     {S.}{S.}%
     {}{}%
     {}{}}%
    {{}%
     {Regev}{R.}%
     {O.}{O.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{AD+1}
  \strng{fullhash}{ADDWvKJLZLSRO1}
  \field{labelalpha}{Aha+07}
  \field{sortinit}{A}
  \field{pages}{166\bibrangedash 194}
  \field{title}{Adiabatic quantum computation is equivalent to standard quantum
  computation}
  \field{volume}{37}
  \field{journaltitle}{SIAM Journal of Computing}
  \field{year}{2007}
\endentry

\entry{AGIK}{article}{}
  \name{author}{4}{}{%
    {{}%
     {Aharonov}{A.}%
     {Dorit}{D.}%
     {}{}%
     {}{}}%
    {{}%
     {Gottesman}{G.}%
     {Daniel}{D.}%
     {}{}%
     {}{}}%
    {{}%
     {Irani}{I.}%
     {Sandy}{S.}%
     {}{}%
     {}{}}%
    {{}%
     {Kempe}{K.}%
     {Julia}{J.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{AD+2}
  \strng{fullhash}{ADGDISKJ1}
  \field{labelalpha}{Aha+09}
  \field{sortinit}{A}
  \field{issue}{1}
  \field{note}{arXiv:0705.4077v2 [quant-ph]}
  \field{pages}{41}
  \field{title}{The power of quantum systems on a line}
  \field{volume}{287}
  \field{journaltitle}{Commun.\ Math.\ Phys.}
  \field{year}{2009}
\endentry

\entry{Aizenman}{misc}{}
  \name{editor}{1}{}{%
    {{}%
     {Aizenman}{A.}%
     {M.}{M.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{AM1}
  \strng{fullhash}{AM1}
  \field{labelalpha}{Aiz98}
  \field{sortinit}{A}
  \field{howpublished}{\url{https://web.math.princeton.edu/~aizenman/OpenProblems.iamp/}}
  \field{title}{Open Problems in Mathematical Physics}
  \field{year}{1998-1999}
\endentry

\entry{Anderson73}{article}{}
  \name{author}{1}{}{%
    {{}%
     {Anderson}{A.}%
     {P.~W.}{P.~W.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{APW1}
  \strng{fullhash}{APW1}
  \field{labelalpha}{And73}
  \field{sortinit}{A}
  \field{pages}{153\bibrangedash 160}
  \field{title}{Resonating valence bonds: a new kind of insulator?}
  \field{volume}{8}
  \field{journaltitle}{Mat. Res. Bull.}
  \field{year}{1973}
\endentry

\entry{Balents}{article}{}
  \name{author}{1}{}{%
    {{}%
     {Balents}{B.}%
     {L.}{L.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{BL1}
  \strng{fullhash}{BL1}
  \field{labelalpha}{Bal10}
  \field{sortinit}{B}
  \field{pages}{199\bibrangedash 208}
  \field{title}{Spin liquids in frustrated magnets}
  \field{volume}{464}
  \field{journaltitle}{Nature}
  \field{year}{2010}
\endentry

\entry{Bar77}{book}{}
  \name{editor}{1}{}{%
    {{}%
     {Barwise}{B.}%
     {Jon}{J.}%
     {}{}%
     {}{}}%
  }
  \list{publisher}{1}{%
    {Elsevier}%
  }
  \strng{namehash}{BJ1}
  \strng{fullhash}{BJ1}
  \field{labelalpha}{Bar77}
  \field{sortinit}{B}
  \field{title}{Handbook of mathematical logic}
  \field{year}{1977}
\endentry

\entry{Bennet}{article}{}
  \name{author}{1}{}{%
    {{}%
     {Bennett}{B.}%
     {Charles~H.}{C.~H.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{BCH1}
  \strng{fullhash}{BCH1}
  \field{labelalpha}{Ben73}
  \field{sortinit}{B}
  \field{pages}{525}
  \field{title}{Logical reversibility of computation}
  \field{volume}{17}
  \field{journaltitle}{IBM J. Res. Develop.}
  \field{year}{1973}
\endentry

\entry{Berger}{article}{}
  \name{author}{1}{}{%
    {{}%
     {Berger}{B.}%
     {R.}{R.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{BR1}
  \strng{fullhash}{BR1}
  \field{labelalpha}{Ber66}
  \field{sortinit}{B}
  \field{pages}{1\bibrangedash 72}
  \field{title}{The undecidability of the domino problem}
  \field{volume}{66}
  \field{journaltitle}{Mem. Amer. Math. Soc.}
  \field{year}{1966}
\endentry

\entry{BlumSmale}{incollection}{}
  \name{author}{2}{}{%
    {{}%
     {Blum}{B.}%
     {Lenore}{L.}%
     {}{}%
     {}{}}%
    {{}%
     {Smale}{S.}%
     {Steve}{S.}%
     {}{}%
     {}{}}%
  }
  \name{editor}{3}{}{%
    {{}%
     {Hirsch}{H.}%
     {MorrisW.}{M.}%
     {}{}%
     {}{}}%
    {{}%
     {Marsden}{M.}%
     {JerroldE.}{J.}%
     {}{}%
     {}{}}%
    {{}%
     {Shub}{S.}%
     {Michael}{M.}%
     {}{}%
     {}{}}%
  }
  \list{language}{1}{%
    {English}%
  }
  \list{publisher}{1}{%
    {Springer US}%
  }
  \strng{namehash}{BLSS1}
  \strng{fullhash}{BLSS1}
  \field{labelalpha}{BS93}
  \field{sortinit}{B}
  \field{booktitle}{From Topology to Computation: Proceedings of the Smalefest}
  \verb{doi}
  \verb 10.1007/978-1-4612-2740-3_32
  \endverb
  \field{isbn}{978-1-4612-7648-7}
  \field{pages}{321\bibrangedash 339}
  \field{title}{The G{\"o}del Incompleteness Theorem and Decidability over a
  Ring}
  \verb{url}
  \verb http://dx.doi.org/10.1007/978-1-4612-2740-3_32
  \endverb
  \field{year}{1993}
\endentry

\entry{Bernstein-Vazirani}{article}{}
  \name{author}{2}{}{%
    {{}%
     {Bernstein}{B.}%
     {Ethan}{E.}%
     {}{}%
     {}{}}%
    {{}%
     {Vazirani}{V.}%
     {Umesh}{U.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{BEVU1}
  \strng{fullhash}{BEVU1}
  \field{labelalpha}{BV97}
  \field{sortinit}{B}
  \field{number}{5}
  \field{pages}{1411}
  \field{title}{Quantum complexity theory}
  \verb{url}
  \verb \url{www.cs.berkeley.edu/~vazirani/pubs/bv.ps}
  \endverb
  \field{volume}{26}
  \field{journaltitle}{SIAM Journal on Computing}
  \field{year}{1997}
\endentry

\entry{Farhi-adiabatic}{unpublished}{}
  \name{author}{4}{}{%
    {{}%
     {Farhi}{F.}%
     {E.}{E.}%
     {}{}%
     {}{}}%
    {{}%
     {Goldstone}{G.}%
     {J.}{J.}%
     {}{}%
     {}{}}%
    {{}%
     {Gutmann}{G.}%
     {S.}{S.}%
     {}{}%
     {}{}}%
    {{}%
     {Sipser}{S.}%
     {M.}{M.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{FE+1}
  \strng{fullhash}{FEGJGSSM1}
  \field{labelalpha}{Far+00}
  \field{sortinit}{F}
  \field{note}{\url{arXiv:quant-ph/0001106}}
  \field{title}{Quantum computation by adiabatic evolution}
  \field{year}{2000}
\endentry

\entry{Feynman}{article}{}
  \name{author}{1}{}{%
    {{}%
     {Feynman}{F.}%
     {Richard}{R.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{FR1}
  \strng{fullhash}{FR1}
  \field{labelalpha}{Fey85}
  \field{sortinit}{F}
  \field{pages}{11}
  \field{title}{Quantum mechanical computers}
  \field{volume}{11}
  \field{journaltitle}{Optics News}
  \field{year}{1985}
\endentry

\entry{UncleHamiltonians}{article}{}
  \name{author}{5}{}{%
    {{}%
     {Fern�ndez-Gonz�lez}{F.-G.}%
     {Carlos}{C.}%
     {}{}%
     {}{}}%
    {{}%
     {Schuch}{S.}%
     {Norbert}{N.}%
     {}{}%
     {}{}}%
    {{}%
     {Wolf}{W.}%
     {Michael~M.}{M.~M.}%
     {}{}%
     {}{}}%
    {{}%
     {Cirac}{C.}%
     {J.~Ignacio}{J.~I.}%
     {}{}%
     {}{}}%
    {{}%
     {P�rez-Garc�a}{P.-G.}%
     {David}{D.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{FGC+1}
  \strng{fullhash}{FGCSNWMMCJIPGD1}
  \field{labelalpha}{FG+12}
  \field{sortinit}{F}
  \field{title}{Frustration free gapless Hamiltonians for Matrix Product
  States}
  \field{journaltitle}{arXiv:1210.6613}
  \field{year}{2012}
\endentry

\entry{Gottesman-Irani}{misc}{}
  \name{author}{2}{}{%
    {{}%
     {Gottesman}{G.}%
     {Daniel}{D.}%
     {}{}%
     {}{}}%
    {{}%
     {Irani}{I.}%
     {Sandy}{S.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{GDIS1}
  \strng{fullhash}{GDIS1}
  \field{labelalpha}{GI09}
  \field{sortinit}{G}
  \field{howpublished}{arXiv:0905.2419[quant-ph]}
  \field{title}{The quantum and classical complexity of translationally
  invariant tiling and {H}amiltonian problems}
  \field{year}{2009}
\endentry

\entry{Gu-Nielsen}{article}{}
  \name{author}{4}{}{%
    {{}%
     {Gu}{G.}%
     {Mile}{M.}%
     {}{}%
     {}{}}%
    {{}%
     {Weedbrook}{W.}%
     {Christian}{C.}%
     {}{}%
     {}{}}%
    {{}%
     {Perales}{P.}%
     {Alvaro}{A.}%
     {}{}%
     {}{}}%
    {{}%
     {Nielsen}{N.}%
     {Michael~A.}{M.~A.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{GM+1}
  \strng{fullhash}{GMWCPANMA1}
  \field{labelalpha}{Gu+09}
  \field{sortinit}{G}
  \field{pages}{835\bibrangedash 839}
  \field{title}{More Really is Different}
  \field{volume}{238}
  \field{journaltitle}{Physica D}
  \field{year}{2009}
\endentry

\entry{Haldane}{article}{}
  \name{author}{1}{}{%
    {{}%
     {Haldane}{H.}%
     {F.D.M.}{F.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{HF1}
  \strng{fullhash}{HF1}
  \field{labelalpha}{Hal83}
  \field{sortinit}{H}
  \field{pages}{1153}
  \field{title}{Nonlinear field theory of large-spin Heisenberg
  antiferromagnets: Semiclassically quantized solitons of the one-dimensional
  easy-axis N\'{e}el state}
  \field{volume}{50}
  \field{journaltitle}{PRL}
  \field{year}{1983}
\endentry

\entry{Han}{article}{}
  \name{author}{7}{}{%
    {{}%
     {Han}{H.}%
     {T.-H.}{T.-H.}%
     {}{}%
     {}{}}%
    {{}%
     {Helton}{H.}%
     {J.~S.}{J.~S.}%
     {}{}%
     {}{}}%
    {{}%
     {Chu}{C.}%
     {S.}{S.}%
     {}{}%
     {}{}}%
    {{}%
     {Nocera}{N.}%
     {D.~G.}{D.~G.}%
     {}{}%
     {}{}}%
    {{}%
     {Rodriguez-Rivera}{R.-R.}%
     {J.~A.}{J.~A.}%
     {}{}%
     {}{}}%
    {{}%
     {Broholm}{B.}%
     {C.}{C.}%
     {}{}%
     {}{}}%
    {{}%
     {Lee}{L.}%
     {Y.~S.}{Y.~S.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{HTH+1}
  \strng{fullhash}{HTHHJSCSNDGRRJABCLYS1}
  \field{labelalpha}{Han+12}
  \field{sortinit}{H}
  \field{pages}{406\bibrangedash 410}
  \field{title}{Fractionalized excitations in the spin-liquid state of a
  {K}agome-lattice antiferromagnet}
  \field{volume}{492}
  \field{journaltitle}{Nature}
  \field{year}{2012}
\endentry

\entry{Hastings_LSM}{article}{}
  \name{author}{1}{}{%
    {{}%
     {Hastings}{H.}%
     {M.B.}{M.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{HM1}
  \strng{fullhash}{HM1}
  \field{labelalpha}{Has04}
  \field{sortinit}{H}
  \field{pages}{104431}
  \field{title}{Lieb-Schultz-Mattis in higher dimensions}
  \field{volume}{69}
  \field{journaltitle}{Phys.\ Rev.\ B}
  \field{year}{2004}
\endentry

\entry{Hastings_area-law}{article}{}
  \name{author}{1}{}{%
    {{}%
     {Hastings}{H.}%
     {M.B.}{M.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{HM1}
  \strng{fullhash}{HM1}
  \field{labelalpha}{Has07}
  \field{sortinit}{H}
  \field{issue}{08}
  \field{title}{An area law for one-dimensional quantum systems}
  \field{volume}{2007}
  \field{journaltitle}{J.\ Stat.\ Mech.: Theory and Experiment}
  \field{year}{2007}
\endentry

\entry{Hofstadter}{article}{}
  \name{author}{1}{}{%
    {{}%
     {Hofstadter}{H.}%
     {Douglas~R.}{D.~R.}%
     {}{}%
     {}{}}%
  }
  \list{publisher}{1}{%
    {American Physical Society}%
  }
  \strng{namehash}{HDR1}
  \strng{fullhash}{HDR1}
  \field{labelalpha}{Hof76}
  \field{sortinit}{H}
  \verb{doi}
  \verb 10.1103/PhysRevB.14.2239
  \endverb
  \field{issue}{6}
  \field{pages}{2239\bibrangedash 2249}
  \field{title}{Energy levels and wave functions of Bloch electrons in rational
  and irrational magnetic fields}
  \verb{url}
  \verb http://link.aps.org/doi/10.1103/PhysRevB.14.2239
  \endverb
  \field{volume}{14}
  \field{journaltitle}{Phys. Rev. B}
  \field{month}{09}
  \field{year}{1976}
\endentry

\entry{Holevo_bound}{article}{}
  \name{author}{1}{}{%
    {{}%
     {Holevo}{H.}%
     {Alexander~S.}{A.~S.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{HAS1}
  \strng{fullhash}{HAS1}
  \field{labelalpha}{Hol73}
  \field{sortinit}{H}
  \field{pages}{177\bibrangedash 183}
  \field{title}{Bound for the quantity of information transmitted by a quantum
  communication channel}
  \field{volume}{9}
  \field{journaltitle}{Problems of Information Transmission}
  \field{year}{1973}
\endentry

\entry{Yang-Mills}{misc}{}
  \name{author}{2}{}{%
    {{}%
     {Jaffe}{J.}%
     {Arthur}{A.}%
     {}{}%
     {}{}}%
    {{}%
     {Witten}{W.}%
     {Edward}{E.}%
     {}{}%
     {}{}}%
  }
  \list{publisher}{1}{%
    {Clay Mathematics Institute}%
  }
  \strng{namehash}{JAWE1}
  \strng{fullhash}{JAWE1}
  \field{labelalpha}{JW00}
  \field{sortinit}{J}
  \field{howpublished}{\url{http://www.claymath.org/sites/default/files/yangmills.pdf}}
  \field{title}{Quantum Yang-Mills Theory}
  \field{year}{2000}
\endentry

\entry{KKR}{article}{}
  \name{author}{3}{}{%
    {{}%
     {Kempe}{K.}%
     {J.}{J.}%
     {}{}%
     {}{}}%
    {{}%
     {Kitaev}{K.}%
     {A.}{A.}%
     {}{}%
     {}{}}%
    {{}%
     {Regev}{R.}%
     {O.}{O.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{KJKARO1}
  \strng{fullhash}{KJKARO1}
  \field{labelalpha}{KKR06}
  \field{sortinit}{K}
  \field{issue}{5}
  \field{pages}{1070}
  \field{title}{The complexity of the Local Hamiltonian problem}
  \field{volume}{35}
  \field{journaltitle}{SIAM Journal of Computing}
  \field{year}{2006}
\endentry

\entry{Kozen_book}{book}{}
  \name{author}{1}{}{%
    {{}%
     {Kozen}{K.}%
     {Dexter}{D.}%
     {}{}%
     {}{}}%
  }
  \list{publisher}{1}{%
    {Springer Science \& Business Media}%
  }
  \strng{namehash}{KD1}
  \strng{fullhash}{KD1}
  \field{labelalpha}{Koz97}
  \field{sortinit}{K}
  \field{title}{Automata and computability}
  \field{year}{1997}
\endentry

\entry{Kitaev_book}{book}{}
  \name{author}{3}{}{%
    {{}%
     {Kitaev}{K.}%
     {A.Y.}{A.}%
     {}{}%
     {}{}}%
    {{}%
     {Shen}{S.}%
     {A.H.}{A.}%
     {}{}%
     {}{}}%
    {{}%
     {Vyalyi}{V.}%
     {M.N.}{M.}%
     {}{}%
     {}{}}%
  }
  \list{publisher}{1}{%
    {AMS}%
  }
  \strng{namehash}{KASAVM1}
  \strng{fullhash}{KASAVM1}
  \field{labelalpha}{KSV02}
  \field{sortinit}{K}
  \field{title}{Classical and Quantum Computation}
  \field{volume}{47}
  \field{year}{2002}
\endentry

\entry{Lloyd}{article}{}
  \name{author}{1}{}{%
    {{}%
     {Lloyd}{L.}%
     {S.}{S.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{LS1}
  \strng{fullhash}{LS1}
  \field{labelalpha}{Llo93}
  \field{sortinit}{L}
  \field{pages}{943\bibrangedash 946}
  \field{title}{Quantum-mechanical computers and uncomputability}
  \field{volume}{71}
  \field{journaltitle}{PRL}
  \field{year}{1993}
\endentry

\entry{LiebSchultzMattis}{article}{}
  \name{author}{3}{}{%
    {{}%
     {Lieb}{L.}%
     {E.H.}{E.}%
     {}{}%
     {}{}}%
    {{}%
     {Schultz}{S.}%
     {T.D.}{T.}%
     {}{}%
     {}{}}%
    {{}%
     {Mattis}{M.}%
     {D.C.}{D.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{LESTMD1}
  \strng{fullhash}{LESTMD1}
  \field{labelalpha}{LSM61}
  \field{sortinit}{L}
  \field{pages}{407}
  \field{title}{Two-Dimensional Ising Model as a Soluble Problem of Many
  Fermions}
  \field{volume}{16}
  \field{journaltitle}{Ann. Phys.}
  \field{year}{1961}
\endentry

\entry{Vidick}{article}{}
  \name{author}{3}{}{%
    {{}%
     {Landau}{L.}%
     {Z.}{Z.}%
     {}{}%
     {}{}}%
    {{}%
     {Vazirani}{V.}%
     {U.}{U.}%
     {}{}%
     {}{}}%
    {{}%
     {Vidick}{V.}%
     {T.}{T.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{LZVUVT1}
  \strng{fullhash}{LZVUVT1}
  \field{labelalpha}{LVV13}
  \field{sortinit}{L}
  \field{note}{arXiv:1307.5143v1}
  \field{title}{A polynomial-time algorithm for the ground state of 1D gapped
  local Hamiltonians}
  \field{year}{2013}
\endentry

\entry{Hastings_exp-decay}{article}{}
  \name{author}{1}{}{%
    {{}%
     {M.B.~Hastings}{M.~H.}%
     {T.~Koma}{T.~K.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{MHTK1}
  \strng{fullhash}{MHTK1}
  \field{labelalpha}{MH06}
  \field{sortinit}{M}
  \field{pages}{781\bibrangedash 804}
  \field{title}{Spectral Gap and Exponential Decay of Correlations}
  \field{volume}{265}
  \field{journaltitle}{CMP}
  \field{year}{2006}
\endentry

\entry{Miekisz}{article}{}
  \name{author}{1}{}{%
    {{}%
     {Mi{\k{e}}kisz}{M.}%
     {J.}{J.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{MJ1}
  \strng{fullhash}{MJ1}
  \field{labelalpha}{Mi{\k{e}}97}
  \field{sortinit}{M}
  \field{pages}{691\bibrangedash 711}
  \field{title}{Stable quasiperiodic ground states}
  \field{volume}{88}
  \field{journaltitle}{J. Stat. Phys.}
  \field{year}{1997}
\endentry

\entry{MichalakisFrustrationFree}{article}{}
  \name{author}{2}{}{%
    {{}%
     {Michalakis}{M.}%
     {S.}{S.}%
     {}{}%
     {}{}}%
    {{}%
     {Pytel}{P.}%
     {J.}{J.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{MSPJ1}
  \strng{fullhash}{MSPJ1}
  \field{labelalpha}{MP13}
  \field{sortinit}{M}
  \field{pages}{277\bibrangedash 302}
  \field{title}{Stability of Frustration-Free Hamiltonians}
  \field{volume}{322}
  \field{journaltitle}{CMP}
  \field{year}{2013}
\endentry

\entry{Nielsen+Chuang}{book}{}
  \name{author}{2}{}{%
    {{}%
     {Nielsen}{N.}%
     {Michael~A.}{M.~A.}%
     {}{}%
     {}{}}%
    {{}%
     {Chuang}{C.}%
     {Isaac~L.}{I.~L.}%
     {}{}%
     {}{}}%
  }
  \list{publisher}{1}{%
    {Cambridge University Press}%
  }
  \strng{namehash}{NMACIL1}
  \strng{fullhash}{NMACIL1}
  \field{labelalpha}{NC00}
  \field{sortinit}{N}
  \field{title}{Quantum computation and quantum information}
  \field{year}{2000}
\endentry

\entry{Ozawa}{article}{}
  \name{author}{2}{}{%
    {{}%
     {Nishimura}{N.}%
     {Harumichi}{H.}%
     {}{}%
     {}{}}%
    {{}%
     {Ozawa}{O.}%
     {Masanao}{M.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{NHOM1}
  \strng{fullhash}{NHOM1}
  \field{labelalpha}{NO02}
  \field{sortinit}{N}
  \verb{eprint}
  \verb quant-ph/9906095
  \endverb
  \field{pages}{147}
  \field{title}{Computational Complexity of Uniform Quantum Circuit Families
  and Quantum Turing Machines}
  \field{volume}{276}
  \field{journaltitle}{Theor. Comput. Sci.}
  \field{year}{2002}
\endentry

\entry{OsadchyAvron}{article}{}
  \name{author}{2}{}{%
    {{}%
     {Osadchy}{O.}%
     {D.}{D.}%
     {}{}%
     {}{}}%
    {{}%
     {Avron}{A.}%
     {J.~E.}{J.~E.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{ODAJE1}
  \strng{fullhash}{ODAJE1}
  \field{labelalpha}{OA01}
  \field{sortinit}{O}
  \verb{doi}
  \verb http://dx.doi.org/10.1063/1.1412464
  \endverb
  \field{number}{12}
  \field{pages}{5665\bibrangedash 5671}
  \field{title}{Hofstadter butterfly as quantum phase diagram}
  \verb{url}
  \verb http://scitation.aip.org/content/aip/journal/jmp/42/12/10.1063/1.141246
  \verb 4
  \endverb
  \field{volume}{42}
  \field{journaltitle}{Journal of Mathematical Physics}
  \field{year}{2001}
\endentry

\entry{Oliveira-Terhal}{article}{}
  \name{author}{2}{}{%
    {{}%
     {Oliveira}{O.}%
     {R.}{R.}%
     {}{}%
     {}{}}%
    {{}%
     {Terhal}{T.}%
     {B.}{B.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{ORTB1}
  \strng{fullhash}{ORTB1}
  \field{labelalpha}{OT08}
  \field{sortinit}{O}
  \field{note}{arXiv:0504050[quant-ph]}
  \field{pages}{0900}
  \field{title}{The complexity of quantum spin systems on a two-dimensional
  square lattice}
  \field{volume}{8}
  \field{journaltitle}{QIC}
  \field{year}{2008}
\endentry

\entry{PourElRichards_book}{book}{}
  \name{author}{2}{}{%
    {{}%
     {Pour-El}{P.-E.}%
     {Marian~B.}{M.~B.}%
     {}{}%
     {}{}}%
    {{}%
     {Richards}{R.}%
     {Jonathan~I.}{J.~I.}%
     {}{}%
     {}{}}%
  }
  \list{publisher}{1}{%
    {Springer}%
  }
  \strng{namehash}{PEMBRJI1}
  \strng{fullhash}{PEMBRJI1}
  \field{labelalpha}{PER89}
  \field{sortinit}{P}
  \field{title}{Computability in Analysis and Physics}
  \field{year}{1989}
\endentry

\entry{Poonen}{misc}{}
  \name{author}{1}{}{%
    {{}%
     {Poonen}{P.}%
     {Bjorn}{B.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{PB1}
  \strng{fullhash}{PB1}
  \field{labelalpha}{Poo12}
  \field{sortinit}{P}
  \field{note}{arXiv:1204.0299}
  \field{title}{Undecidable Problems: A Sampler}
  \field{year}{2012}
\endentry

\entry{busy-beaver}{article}{}
  \name{author}{1}{}{%
    {{}%
     {Rado}{R.}%
     {Tibor}{T.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{RT1}
  \strng{fullhash}{RT1}
  \field{labelalpha}{Rad62}
  \field{sortinit}{R}
  \field{pages}{877\bibrangedash 884}
  \field{title}{On non-computable functions}
  \field{volume}{41}
  \field{journaltitle}{Bell System Technical Journal}
  \field{year}{1962}
\endentry

\entry{Robinson}{article}{}
  \name{author}{1}{}{%
    {{}%
     {Robinson}{R.}%
     {R.}{R.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{RR1}
  \strng{fullhash}{RR1}
  \field{labelalpha}{Rob71}
  \field{sortinit}{R}
  \field{pages}{177}
  \field{title}{Undecidability and Nonperiodicity for Tilings of the Plane}
  \field{volume}{12}
  \field{journaltitle}{Invent. Math.}
  \field{year}{1971}
\endentry

\entry{Turing}{article}{}
  \name{author}{1}{}{%
    {{}%
     {Turing}{T.}%
     {Alan}{A.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{TA1}
  \strng{fullhash}{TA1}
  \field{labelalpha}{Tur36}
  \field{sortinit}{T}
  \field{series}{2}
  \field{title}{On computable numbers, with an application to the
  Entscheidungsproblem}
  \field{volume}{42}
  \field{journaltitle}{Proc. London Math. Soc.}
  \field{year}{1936-7}
\endentry

\entry{Wang}{article}{}
  \name{author}{1}{}{%
    {{}%
     {Wang}{W.}%
     {H.}{H.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{WH1}
  \strng{fullhash}{WH1}
  \field{labelalpha}{Wan61}
  \field{sortinit}{W}
  \field{pages}{1\bibrangedash 41}
  \field{title}{Proving ttheorem by pattern recognition}
  \field{volume}{40}
  \field{journaltitle}{Bell System Tech. J.}
  \field{year}{1961}
\endentry

\entry{White}{article}{}
  \name{author}{3}{}{%
    {{}%
     {Yan}{Y.}%
     {S.}{S.}%
     {}{}%
     {}{}}%
    {{}%
     {Huse}{H.}%
     {D.~A.}{D.~A.}%
     {}{}%
     {}{}}%
    {{}%
     {White}{W.}%
     {S.~R.}{S.~R.}%
     {}{}%
     {}{}}%
  }
  \strng{namehash}{YSHDAWSR1}
  \strng{fullhash}{YSHDAWSR1}
  \field{labelalpha}{YHW11}
  \field{sortinit}{Y}
  \field{pages}{1173\bibrangedash 1176}
  \field{title}{Spin-liquid ground state of the S=1/2 Kagome Heisenberg
  antiferromagnet}
  \field{volume}{332}
  \field{journaltitle}{Science}
  \field{year}{2011}
\endentry

\lossort
\endlossort

\endinput
