+ All Categories
Home > Documents > arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin...

arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin...

Date post: 24-Sep-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
24
arXiv:2006.03529v3 [cond-mat.stat-mech] 11 Sep 2020 Describing classical spin Hamiltonians as automata: a new complexity measure David Drexel and Gemma De las Cuevas Institute for Theoretical Physics, Technikerstr. 21a, A-6020 Innsbruck, Austria We describe classical spin Hamiltonians as automata and use the classification of the latter to obtain a new complexity measure of Hamiltonians. Specifically, we associate a classical spin Hamiltonian to the formal lan- guage consisting of pairs of spin configurations and the corresponding energy, and classify this language in the Chomsky hierarchy. We prove that the language associated to (i) eectively zero-dimensional spin Hamil- tonians is regular, (ii) local one-dimensional (1D) spin Hamiltonians is deterministic context-free, (iii) local two-dimensional (2D) or higher-dimensional spin Hamiltonians is context-sensitive, and (iv) totally unbounded spin Hamiltonians is recursively enumerable. It follows that only highly non-physical spin Hamiltonians [(iv)] correspond to Turing machines. It also follows that the Ising model without fields is easy or hard if defined on a 1D or 2D lattice, in contrast to the computational complexity of its ground state energy problem, where the threshold is found between planar and non-planar graphs. Our work puts classical spin Hamiltonians at the same level as automata, and paves the road toward a rigorous comparison of universal spin models and universal Turing machines. 1. INTRODUCTION Statistical physics and computational complexity theory have had strong ties for decades [1, 2]. Traditionally, the complexity of classical spin Hamiltonians has been studied from the point of view of the computational complexity of the ground state energy problem (GSE), which is defined as follows: Given a Hamiltonian and an energy value, is there a spin configuration whose energy is below that value? This problem is naturally in the class non-deterministic polynomial time, NP, as the spin configuration witnesses the case in which it is a yes-instance. In addition, in some apparently simple cases, it is already NP-hard [3]. For the most paradigmatic classical spin model, the Ising model without fields, the GSE is ‘easy’ if defined on a planar graph, and ‘hard’ if defined on a non-planar graph [4]. Here, easy means in the complexity class polynomial time, P, and hard means NP-complete [5]. Another complexity measure is the Kolmogorov complex- ity of the Hamiltonian, which is defined as the length of the shortest algorithm that produces a description of the Hamil- tonian as its output [68]. This description of a Hamiltonian could be fed to a universal Turing machine, which could then simulate, e.g., the time evolution that it generates. This com- plexity measure is however uncomputable. In this paper, we take a dierent route to measuring the complexity of a classical spin Hamiltonian. We propose to de- scribe a classical spin Hamiltonian as an automaton that sends spin configurations to energies, and we classify what type of automaton this is. Equivalently, we associate a classical spin Hamiltonian to the formal language consisting of all pairs of spin configurations and their corresponding energy, and clas- sify this language in the Chomsky hierarchy. In other words, we put classical spin models and automata at the same level, and then borrow the classification of automata to infer a com- plexity classification of classical spin Hamiltonians. Our main result is that, on the one hand, classical spin Hamiltonians with physically local 1,2, ... and k-body interactions (where k is fixed) on a one-dimensional (1D) chain—here called local 1D spin Hamiltonians—correspond to deterministic context-free languages. If the local 1D spin Hamiltonians behaves eectively as a zero-dimensional spin Hamiltonian—called 0D spin Hamiltonians—, the cor- responding language is regular. On the other hand, these Hamiltonians in dimensions higher than one, for example on a two-dimensional (2D) lattice—local 2D spin Hamiltonianscorrespond to context-sensitive languages. The same is true for 1D spin Hamiltonians where the local interaction term involves a fixed number of spins (k) but these need not be physically close to each other—called unbounded 1D spin Hamiltonians (see Fig. 1). In addition, we show that only highly non-physical spin Hamiltonians, namely those without any structure—called totally unbounded spin Hamiltonianscorrespond to Turing machines (see Fig. 2 for a classification in the Chomsky hierarchy). Theorem 1 (Main result – informal). The language associ- ated to (i) a 0D spin Hamiltonian is regular; (ii) a local 1D spin Hamiltonian is deterministic context- free; (iii) a local 2D or higher dimensional spin Hamiltonian, or unbounded 1D spin Hamiltonian, is context-sensitive; (iv) a totally unbounded spin Hamiltonian is recursively enumerable. As we will see, statements (ii) and (iii) also hold if the local Hamiltonian term is unspecified, i.e. it is given as part of the language. These results apply, in particular, to the Ising model with- out fields, and show that the boundary between ‘easy’ and ‘hard’ (more precisely: deterministic context-free and context- sensitive) is given by whether the lattice is 1D or higher di- mensional. This is a dierent threshold than for the GSE of the Ising model without fields, which is given by whether the graph is planar or non-planar, corresponding to the complex- ity class P and NP-complete (see Table 1). Since the complex- ity measures are dierent—in particular, our measure involves the full Hamiltonian, not only its behavior around the ground state—, it is not surprising that the thresholds are dierent.
Transcript
Page 1: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

arX

iv:2

006.

0352

9v3

[co

nd-m

at.s

tat-

mec

h] 1

1 Se

p 20

20

Describing classical spin Hamiltonians as automata: a new complexity measure

David Drexel and Gemma De las CuevasInstitute for Theoretical Physics, Technikerstr. 21a, A-6020 Innsbruck, Austria

We describe classical spin Hamiltonians as automata and use the classification of the latter to obtain a new

complexity measure of Hamiltonians. Specifically, we associate a classical spin Hamiltonian to the formal lan-

guage consisting of pairs of spin configurations and the corresponding energy, and classify this language in

the Chomsky hierarchy. We prove that the language associated to (i) effectively zero-dimensional spin Hamil-

tonians is regular, (ii) local one-dimensional (1D) spin Hamiltonians is deterministic context-free, (iii) local

two-dimensional (2D) or higher-dimensional spin Hamiltonians is context-sensitive, and (iv) totally unbounded

spin Hamiltonians is recursively enumerable. It follows that only highly non-physical spin Hamiltonians [(iv)]

correspond to Turing machines. It also follows that the Ising model without fields is easy or hard if defined

on a 1D or 2D lattice, in contrast to the computational complexity of its ground state energy problem, where

the threshold is found between planar and non-planar graphs. Our work puts classical spin Hamiltonians at the

same level as automata, and paves the road toward a rigorous comparison of universal spin models and universal

Turing machines.

1. INTRODUCTION

Statistical physics and computational complexity theory

have had strong ties for decades [1, 2]. Traditionally, the

complexity of classical spin Hamiltonians has been studied

from the point of view of the computational complexity of

the ground state energy problem (GSE), which is defined as

follows: Given a Hamiltonian and an energy value, is there

a spin configuration whose energy is below that value? This

problem is naturally in the class non-deterministic polynomial

time, NP, as the spin configuration witnesses the case in which

it is a yes-instance. In addition, in some apparently simple

cases, it is already NP-hard [3]. For the most paradigmatic

classical spin model, the Ising model without fields, the GSE

is ‘easy’ if defined on a planar graph, and ‘hard’ if defined on

a non-planar graph [4]. Here, easy means in the complexity

class polynomial time, P, and hard means NP-complete [5].

Another complexity measure is the Kolmogorov complex-

ity of the Hamiltonian, which is defined as the length of the

shortest algorithm that produces a description of the Hamil-

tonian as its output [6–8]. This description of a Hamiltonian

could be fed to a universal Turing machine, which could then

simulate, e.g., the time evolution that it generates. This com-

plexity measure is however uncomputable.

In this paper, we take a different route to measuring the

complexity of a classical spin Hamiltonian. We propose to de-

scribe a classical spin Hamiltonian as an automaton that sends

spin configurations to energies, and we classify what type of

automaton this is. Equivalently, we associate a classical spin

Hamiltonian to the formal language consisting of all pairs of

spin configurations and their corresponding energy, and clas-

sify this language in the Chomsky hierarchy. In other words,

we put classical spin models and automata at the same level,

and then borrow the classification of automata to infer a com-

plexity classification of classical spin Hamiltonians.

Our main result is that, on the one hand, classical spin

Hamiltonians with physically local 1−, 2−, . . . and k-body

interactions (where k is fixed) on a one-dimensional (1D)

chain—here called local 1D spin Hamiltonians—correspond

to deterministic context-free languages. If the local 1D

spin Hamiltonians behaves effectively as a zero-dimensional

spin Hamiltonian—called 0D spin Hamiltonians—, the cor-

responding language is regular. On the other hand, these

Hamiltonians in dimensions higher than one, for example on a

two-dimensional (2D) lattice—local 2D spin Hamiltonians—

correspond to context-sensitive languages. The same is true

for 1D spin Hamiltonians where the local interaction term

involves a fixed number of spins (k) but these need not be

physically close to each other—called unbounded 1D spin

Hamiltonians (see Fig. 1). In addition, we show that only

highly non-physical spin Hamiltonians, namely those without

any structure—called totally unbounded spin Hamiltonians—

correspond to Turing machines (see Fig. 2 for a classification

in the Chomsky hierarchy).

Theorem 1 (Main result – informal). The language associ-

ated to

(i) a 0D spin Hamiltonian is regular;

(ii) a local 1D spin Hamiltonian is deterministic context-

free;

(iii) a local 2D or higher dimensional spin Hamiltonian, or

unbounded 1D spin Hamiltonian, is context-sensitive;

(iv) a totally unbounded spin Hamiltonian is recursively

enumerable.

As we will see, statements (ii) and (iii) also hold if the local

Hamiltonian term is unspecified, i.e. it is given as part of the

language.

These results apply, in particular, to the Ising model with-

out fields, and show that the boundary between ‘easy’ and

‘hard’ (more precisely: deterministic context-free and context-

sensitive) is given by whether the lattice is 1D or higher di-

mensional. This is a different threshold than for the GSE of

the Ising model without fields, which is given by whether the

graph is planar or non-planar, corresponding to the complex-

ity class P and NP-complete (see Table 1). Since the complex-

ity measures are different—in particular, our measure involves

the full Hamiltonian, not only its behavior around the ground

state—, it is not surprising that the thresholds are different.

Page 2: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

2

Classical spin Hamiltonian Automaton

0D spin Hamiltonian Deterministic

finite-state automaton

. . .

Tape

Finite

control

read

Local 1D spin Hamiltonian Deterministic

pushdown automaton

. . .

Tape

Finite

control

read

Stack

push/pop

Local 2D or higher dimensional

spin Hamiltonian or

Unbounded 1D spin Hamiltonian

Linear bounded automaton

→←

. . .

Tape

Finite

control

read/write

Totally unbounded Hamiltonian Turing machine

→←

. . . . . .

Infinite tape

Finite

control

read/write

FIG. 1. We describe classical spin Hamiltonians as automata. We

prove that local 1D spin Hamiltonians correspond to deterministic

pushdown automata, and local 2D or higher dimensional spin Hamil-

tonians, or unbounded 1D spin Hamiltonians correspond to linear

bounded automata. A subset of local 1D spin Hamiltonians that is

effectively 0D corresponds to deterministic finite-state automata. To-

tally unbounded Hamiltonians correspond to Turing machines.

A crucial point in casting classical spin Hamiltonians as au-

tomata is letting Hamiltonians be uniform in the system size,

that is, functions valid for all system sizes n. For example,

The Ising model without fields defined on a graph

‘easy’ ‘hard’

GSE planar (in P) non-planar (NP-complete)

As an automaton 1D (DPDA) 2D or higher (LBA)

TABLE 1. The complexity of the Ising model without fields defined

on a graph G. The computational complexity of the GSE is easy

/ hard (namely in P / NP-complete) if G is a planar / non-planar

graph. When it is described as an automaton, this Hamiltonian is

easy / hard [namely a deterministic pushdown automaton (DPDA) /

a linear bounded automaton (LBA)] when G is a 1D / 2D lattice.

‘the 1D Ising model’ will refer to the set of maps

(s1, . . . , sn) 7→

n−1∑

i=1

si si+1

for all n (here si ∈ {1,−1}). What is characteristic of the

1D Ising model, thus, is the form of the local Hamiltonian

h(si, si+1) = si si+1. Intuitively, this local Hamiltonian will be

encoded in the transition rules of the head of the automaton,

and will determine ‘how complicated’ this automaton is. The

automaton will run (that is, compute the energy) for any sys-

tem size.

This point can also be seen as follows: If the system size

were fixed, the input–output relations (that is, the set of spin

configurations and their corresponding energy) would be a fi-

nite list. Therefore, the corresponding language would have

a finite number of elements, so it would be trivial, and our

complexity measure would be meaningless.

Another important point is the freedom in associating a lan-

guage to a Hamiltonian, but the lack of freedom in the classi-

fication of the language in the Chomsky hierarchy (Fig. 3).

Namely, to every Hamiltonian H we associate a language

LH , and the association H LH is not unique. In contrast,

once LH is fixed, its classification in the Chomsky hierarchy

is unambiguous—our theorems will prove, for example, that

LH ∈ L1\L2. Since we want to obtain a new complexity mea-

sure for H, we would like LH to be in the lowest possible level

of the Chomsky hierarchy [9]. While we cannot prove that

LH is the least complex one, throughout the paper we will in-

vestigate, whenever possible, the freedom in the association

H LH . For example, before associating a language to H,

we rescale and shift H so that the energy is in the naturals; in

Section 3.5 we investigate the effect of not shifting the energy.

Another example is the fact that we write the energy of H in

unary; in Section 3.4 we will investigate the effect of express-

ing the energy in binary.

Finally, we remark that describing certain objects in con-

densed matter physics as automata has been considered before.

For example, certain 1D quantum Hamiltonians, called ma-

trix product operators, as well as certain 1D quantum states,

called matrix product states, are described as finite complex

weighted automata in [10]. In this work we focus on describ-

ing classical spin Hamiltonians as automata. Similarly, the

quantum Kolmogorov complexity of a quantum state was de-

fined and studied in [11].

This paper is organized as follows. In Section 2 we present

the preliminaries about formal languages and automata the-

Page 3: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

3

L0 Recursively enumerable

L1 Context-sensitive

L2 Context-free

DCFL

L3 Regular0D spin Hamiltonian

Local 1D spin Hamiltonian

Local 2D or higher dimensional

spin Hamiltonian or

Unbounded 1D spin Hamiltonian

Totally unbounded

spin Hamiltonian

Classical spin HamiltoniansThis work

Formal languages Automata

Finite-state automata

Deterministic pushdown automata

Pushdown automata

Linear bounded automata

Turing machines

FIG. 2. (Middle column) The Chomsky hierarchy L0 ⊃ L1 ⊃ L2 ⊃ L3 together with the intermediary class deterministic context-free

languages (DCFL). (Right column) Each level of the Chomsky hierarchy is associated to the class of automata that recognizes it. (Left

column) In this work we put classical spin models at the same level as formal languages and automata, and find that local 1D spin Hamiltonians

correspond to DCFL, and local 2D or higher dimensional spin Hamiltonians, and unbounded 1D spin Hamiltonians, correspond to context-

sensitive languages. A subclass of local 1D spin Hamiltonians that is effectively 0D corresponds to regular languages.

H LH

Automaton that

recognizes LH

FIG. 3. We associate a Hamiltonian H to a formal language LH , and

classify LH in the Chomsky hierarchy. The association H LH is

not unique, but once LH is fixed, its classification in the Chomsky

hierarchy is unambiguous. This classification is equivalent to provid-

ing an automaton that recognizes LH—that is, given a string x, the

automaton tells whether x ∈ LH . Intuitively, the Hamiltonian H can

be seen as the automaton that checks whether a given spin configura-

tion and energy match—this is the view advocated in Fig. 1.

ory needed for this work. In Section 3 we prove that the

languages associated to local 1D spin Hamiltonians are deter-

ministic context-free, that if the energy is encoded in binary

the corresponding language is context-sensitive (the proof of

which is completed in Appendix A), and that the languages

associated to effectively 0D spin Hamiltonians are regular. In

Section 4 we prove that the languages associated to local 2D

spin Hamiltonians are context-sensitive, and present the ex-

plicit construction of the linear bounded automaton in Ap-

pendix B, as well as an extension to higher-dimensional and

non-rectangular planar lattices. In Section 5 we prove that

the languages associated to unbounded 1D spin Hamiltonians

are context-sensitive (the proof of which is completed in Ap-

pendix C), and the languages associated to totally unbounded

Hamiltonians are recursively enumerable. In Section 6 we in-

clude the local Hamiltonian as part of the input, show the com-

plexity classification of Section 3 and Section 4 also holds in

this case, and give a direct comparison to the GSE. In Sec-

tion 7 we conclude and present an outlook of this work.

2. PRELIMINARIES

In this section we introduce general notation and definitions

(Section 2.1), the definition and basic properties of determinis-

tic finite-state automata (Section 2.2), of pushdown automata

(Section 2.3), and of Turing machines and linear bounded au-

tomata (Section 2.4). For a more extensive introduction to

these topics we refer to the opening chapters of [12].

Throughout this paper, ‘language’ stands for ‘formal lan-

guage’, ‘spin’ stands for ‘classical spin’, and ‘Hamiltonian’

stands for ‘classical spin Hamiltonian’.

2.1. Notation and definitions

In this subsection we review a number of standard defini-

tions commonly used in automata theory. Throughout this

work we denote the set of integers from 1 to n by [n] :=

{1, 2, . . . , n}.

For a given natural q ≥ 1, an alphabet Σq is a finite set

with cardinality |Σq| = q. The elements of an alphabet are

called symbols and are arbitrary—we only require that there

are q different symbols. The n-fold Cartesian product of Σq is

denoted

Σnq = Σq × · · · × Σq︸ ︷︷ ︸

n times

.

A string α over an alphabet Σq is a finite sequence of symbols

in Σq, namely α ∈ Σnq for some n. Here n is the length of

the string α, denoted |α|. For example, if b is a symbol in

the alphabet Σq, i.e. b ∈ Σq, then the n-fold repetition of b is

Page 4: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

4

denoted bn ∈ Σnq. We additionally define ε to be the empty

string, |ε| = 0, and in particular we define Σ0q = {ε} for any

alphabet Σq.

The Kleene star of an alphabet Σq, denoted Σ∗q, is defined as

Σ∗q =⋃

i≥0

Σiq.

The Kleene star creates the set of all strings over the given

alphabet, including ε.

The fundamental binary operation on strings is concatena-

tion, which maps pairs of strings α and β to a new string αβ

by joining their ends. More formally, for two alphabets Σq,Σ′p,

concatenation is an operation defined on their Kleene stars:

Σ∗q × Σ′∗p → {γω | γ ∈ Σ

∗q, ω ∈ Σ

′∗p }

(α, β) 7→ αβ.

The empty string ε acts as the identity element of concatena-

tion

αε = εα = α.

2.2. Finite-state automata

We briefly review the notion of finite-state automata. In

particular we present the deterministic variant.

Definition 2 (Deterministic finite-state automaton). A deter-

ministic finite-state automaton (DFA) M is formally described

by a 5-tuple

M = (Q,Σ, δ, q0, F)

where

• Q is a finite set of states

• Σ is a finite set called input alphabet

• δ : Q × Σ→ Q is the transition function

• q0 ∈ Q is the start state, and

• F ⊆ Q is the set of accept states.

A DFA can be thought of as a combination of a tape on

which inputs are written as strings over Σ, and a machine head

which can take any of the states in Q. The head moves along

the tape from beginning to end, reading one symbol at a time,

and transitions to a new state according to δ. Each transition

depends on the current state of the head and the symbol that is

read from the tape.

If there exists a sequence of transitions such that the head

enters a state in F after reading the entire input, the automaton

accepts the input. Otherwise the input is rejected. The set of

all accepted strings is the language recognized by the DFA.

The set of all languages recognized by DFAs are the regular

languages, or L3.

2.3. Pushdown automata

Next we review the notion of a pushdown automaton. Later

we will restrict to the less powerful deterministic variant.

Definition 3 (Pushdown automaton). A pushdown automaton

(PDA) M is formally described by a 7-tuple

M = (Q,Σ, Γ, Z, δ, q0, F)

where

• Q is a finite set of states

• Σ is a finite set called input alphabet

• Γ is a finite set called stack alphabet

• Z ∈ Γ is the initial stack symbol

• δ is a finite subset of (Q× (Σ∪{ε})×Γ)× (Q×Γ∗) called

transition relation

• q0 ∈ Q is the start state, and

• F ⊆ Q is the set of accept states.

A PDA can be thought of as a combination of a tape on

which inputs are written as strings over Σ, a machine head

which can take any of the states in Q and move along the tape

from beginning to end, reading one symbol at a time, and an

infinite amount of last-in-first-out stack memory accessible to

the head. A computation of the PDA consists of a number of

discrete steps. At each step the head may read a symbol from

the tape, advance to the next symbol, and may pop the symbol

at the top of the stack. Depending on the tape symbol t, stack

symbol s, and state of the head q, the head transitions into a

state q′, and pushes a string γ ∈ Γ∗ on top of the stack. The

allowed transitions are given by δ and need not be unique—

for a given combination (q, t, s) there may be multiple possible

transitions, from which one is chosen. This property is known

as non-determinism. Additionally, transitions may not read

the current tape symbol and only operate on the stack; this is

called an ε-transition.

Initially the stack only contains the symbol Z and the head

is in state q0, positioned over the first input symbol. If there

exists a sequence of transitions such that the head enters a state

in F after reading the entire input, the automaton accepts the

input. Otherwise the input is rejected. The set of all accepted

strings is the language recognized by the PDA. The set of all

languages recognized by PDAs are the context-free languages,

or L2.

A less powerful form of the PDA is the deterministic push-

down automaton.

Definition 4 (Deterministic pushdown automaton). A deter-

ministic pushdown automaton (DPDA) is defined as a PDA

with one additional restriction: for any given instantaneous

description of the automaton (q ∈ Q, t ∈ Σ, s ∈ Γ) there is at

most one possible transition.

While the PDA can take multiple paths of transitions and

accepts if any of them reach an accept state after consum-

ing the input, the DPDA only follows one fixed sequence of

transitions for a given input. The languages which are recog-

nized by DPDAs are the deterministic context-free languages

(DCFL), which are a proper subset of L2.

Page 5: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

5

2.4. Turing machines and linear bounded automata

Let us now review a more powerful type of automaton, the

Turing machine, to later restrict to the less powerful variant of

linear bounded automata.

Definition 5 (Turing machine). A Turing machine (TM) M is

formally described by an 8-tuple

M = (Q,Σ, Γ,⊔, δ, q0, q f , qr)

where

• Q is a finite set of states

• Σ is a finite set called input alphabet

• Γ is a finite set with Σ ⊂ Γ, called tape alphabet

• ⊔ ∈ Γ is called the blank symbol

• δ : Q × Γ → Q × Γ × {L,R} is the transition function,

where L,R are symbols for left, right

• q0 ∈ Q is the start state

• q f ∈ Q is the accept state, and

• qr ∈ Q is the reject state.

As the PDA, a Turing machine can be imagined as a ma-

chine head with a finite number of internal states and operat-

ing on a tape of symbols. The first major difference with PDA

is that, while in PDA the head can only move to the right, in

a TM the head can move left or right. The second major dif-

ference is the ability to overwrite the tape: While PDAs can

only read the tape, the TM can also replace the symbol it just

read. It is thus natural that the tape on which a TM operates is

infinite, namely both sides of the input string are padded with

endless strings of blank symbols ⊔.

To summarize, the TM works as follows: for a given inter-

nal state q ∈ Q and tape symbol a ∈ Γ, it overwrites a with

a symbol b ∈ Γ, enters a new state p ∈ Q, and chooses a di-

rection d ∈ {L,R} in which to move the head. In terms of the

transition function this is succinctly expressed as

δ(q, a) = (p, b, d).

Once the TM enters the accept or reject state, it is never al-

lowed to leave it. In this case, the automaton is said to halt,

and accept or reject this input, respectively. Formally, this

means that for all a ∈ Γ there exist b, c ∈ Γ and d, d′ ∈ {L,R},

such that

δ(q f , a) = (q f , b, d)

δ(qr, a) = (qr, c, d′)

Note that the TM need not halt: a computation can also loop

forever without ever entering the accept or reject state. The

set of languages recognized by Turing machines are the recur-

sively enumerable languages, or L0.

One further interesting type of automaton is the linear

bounded automaton (LBA), which is obtained by restricting

the tape accessible to the Turing machine to be a linear func-

tion of the length of the input. Because of the linear speedup

theorem [13], this is equivalent to requiring the length of the

tape to be exactly the same as the length of the input. That is,

the automaton can only overwrite the input, i.e. it has no blank

spaces to the left or right of the input to work with.

Definition 6 (Linear bounded automaton). A linear bounded

automaton (LBA) is defined as a TM with one additional re-

striction: the length of the tape accessible to the automaton

is equal to the length of the input. Formally, this means that

there exist special symbols ‡L, ‡R at the left and right ends of

the input, respectively, which the LBA cannot move past or

overwrite. That is, for all q ∈ Q there exist p, r ∈ Q such that

δ(q, ‡L) = (p, ‡L,R)

δ(q, ‡R) = (r, ‡R, L).

The languages accepted by LBAs are the context-sensitive

languages, or L1. These are a proper subset of L0.

3. 1D SPIN HAMILTONIANS AS AUTOMATA

In this section we define 1D classical spin Hamiltoni-

ans (Section 3.1), associate formal languages to them (Sec-

tion 3.2), and show that they are deterministic context-free

(Section 3.3). We also show that the languages where the en-

ergy is encoded in binary are context-sensitive (Section 3.4),

and for 0D Hamiltonians the associated languages are regular

(Section 3.5).

3.1. Definition of 1D spin Hamiltonians

In this subsection we provide a rigorous definition of 1D

classical spin Hamiltonians (Definition 7). To this end, we

first fix some notation and conventions.

A discrete classical spin variable can take q ∈ N distinct

values, which are called levels and labelled 1, . . . , q. In order

to make a connection to automata, we let these q levels define

the alphabet Σq.

We denote a configuration of n q-level spins as a tuple con-

sisting of the string of q-level spins, S (n), and the length n:

(S (n), n) = (s1s2 . . . sn, n) ∈ Σnq × N.

For example, a spin configuration of four 2-level spins (with

Σ2 = {1, 2}) is denoted (S (4), 4) = (1212, 4). Note that in 1D

n is redundant, as the string itself already has a well-defined

length, but this becomes meaningful when generalizing the

construction to higher dimensions, as will be apparent in Sec-

tion 4. In addition, for a given spin configuration (S (n), n) we

denote substrings of adjacent spins starting at spin si′ and end-

ing at si as

S [i′ ,i] := si′ si′+1 . . . si−1 si.

Note that for substrings we omit the superscript (n) to keep

notation simple.

Page 6: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

6

We are now ready to define 1D classical spin Hamiltoni-

ans with physically local interactions. Intuitively, k will de-

note the maximum range of the interaction (see below for the

precise definition). In this work, we consider locality in the

physical sense, meaning that these k spins are required to be

‘physically’ adjacent, which will translate to adjacency in the

spin configuration. This is to be contrasted with locality in

the computer science sense, in which one would require that

interactions be at most between k spins—in other words: that

every term in the Hamiltonian has arity at most k, which will

be considered in Section 5.1. Locality in the physical sense is

thus more restrictive than in the computer science sense.

Definition 7 (Local 1D Hamiltonian). Let q > 1, k ≥ 1 be

fixed natural numbers. Let

D1D =⋃

n≥1

{

(S (n), n) | S (n) ∈ Σnq

}

(1)

be the set of all 1D q-level spin configurations. A local 1D

Hamiltonian H with at most k-body interactions is a map

H : D1D → Q

(S (n), n) 7→

n∑

i=1

h(S [i−k+1,i]). (2)

In addition, h : Σkq → Q is called the local Hamiltonian.

In words, H takes a spin configuration of n q-level spins

and maps it to an energy value [14], which is obtained by

summing up the local Hamiltonians for each substring of k

adjacent spins. The details of the interaction will be contained

in the definition of h. Note that this definition of h includes 1-,

2-, . . ., and up to k-body interactions—hence the formulation

of “at most” k-body interactions.

Note that in Eq. (2) the sum starts from i = 1, causing h to

be evaluated on substrings with initial indices i−k+1 < 1. The

way this is to be understood depends on the type of boundary

conditions considered. For periodic boundary conditions the

spin indices loop around

s j ≔ s j+n ∀ j < 1,

whereas for open boundary conditions we identify spins s j for

j < 1 with special symbol x < Σq. The local Hamiltonian

h : (Σq ∪ {x})k → Q

is extended so that spins of symbol x do not contribute to

the energy. Note that this is just a notational choice to keep

Eq. (2) simple. In the remainder of this Section, in Section 4

and Section 6 we will consider open boundary conditions; in

Remark 29 we will briefly describe how to obtain the same

results for periodic boundary conditions.

To illustrate this definition, we now describe the 1D Ising

model with fields in this framework.

Example 8 (The 1D Ising model). Consider the 1D Ising

model with fields with homogeneous coupling strength 1 and

magnetic field 1,

H(σ1, . . . , σn) =

n∑

i=1

σi +

n∑

i=2

σi−1σi,

where σi ∈ {−1, 1}. In terms of Definition 7, this is described

by k = 2, q = 2, si ∈ {0, 1} ∪ {x}, and

h(si−1si) =

(−1)si if si−1 = x,

(−1)si + (−1)si−1+si otherwise.

3.2. The languages associated to 1D spin Hamiltonians

In this subsection we associate a formal language to the

definition of a 1D spin Hamiltonian that we just presented.

This language will contain the set of all pairs consisting of

the spin configuration and its corresponding energy. Since the

system size is not fixed, this will give rise to a language with

an infinite number of strings.

There is obviously much freedom in the transformation of

(S (n),H(S (n))) to a string that belongs to a formal language

(see the discussion around Fig. 3). Since we want to study the

complexity of the resulting formal language, it is only natural

to choose the transformation that gives rise to the simplest

possible language. Here we will choose one obvious encoding,

in which we associate one spin to a fixed number of symbols,

express the energy in unary, and introduce a constant overhead

of string symbols [15].

We first introduce a rescaling of the Hamiltonian so that its

image is in the natural numbers. The rescaling of the Hamil-

tonian (as given in Definition 7) is accomplished by replacing

h by

h′(α) = λ(h(α) + Λ), (3)

where λ ∈ Q is the greatest common divisor of all values in

the image of h, and Λ ∈ Q is given by

Λ = −minα∈Σk

q

h(α).

Note that λ and Λ are clearly computable, since the image of

h, and respectively Σkq, are finite sets. Note also that the image

of h′ now lies inN. The rescaling of a Hamiltonian H as given

by Definition 7 is then defined as

H′ : D1D → N

(S (n), n) 7→∑n

i=1 h′(S [i−k+1,i]).(4)

Definition 9 (Unary encoding). The unary encoding u is a

map from N to strings over a single symbol alphabet {⋄}

u : N→ {⋄}∗

n 7→ ⋄n, n ≥ 1

0 7→ ε.

In words, u maps a number n to the string consisting of n

times the symbol ⋄, that is, ⋄n. It is important to note that ⋄ is

not part of the spin alphabet, ⋄ < Σq.

Definition 10 (Languages of 1D Hamiltonians). Let H be a

1D Hamiltonian given in Definition 7, rescaled as in (4). The

language associated to H, denoted LH , is defined as

LH = {S(n) ⊢ u(H′(S (n), n)) ⊥

| (S (n), n) ∈ D1D}

Page 7: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

7

astart b

ef

ε,Z → Txx...xZ

si,TS [i−k+1,i−1]→ TS [i−k+2,i]

u(h′(S [i−k+1,i]))

⊢,TS [n−k+2,n]→ ε

⋄, ⋄ → ε

⊥,Z → Z

FIG. 4. A DPDA recognizing the language of a 1D local Hamilto-

nian. (a): An ε-transition pushes symbol Txx...x on top of the stack to

indicate that no spins have been read yet. (b): Each transition reads

the spin si+1 from the tape and the previous k − 1 spins S [i−k+1,i−1]

from top of the stack, pushing back the unary energy from their lo-

cal interaction and TS [i−k+2,i]on top. The total energy is successively

built up on the stack, while the topmost symbol always corresponds

to the previously read spins. This continues until the delimiter ⊢ is

encountered. (e): The energy string in the tape is compared to the

energy string in the stack, and the accepting state f is reached only

if their length matches. We have omitted all transitions that lead the

automaton to reject.

where ⊢,⊥< Σq are delimiting symbols. The set of all LH is

denoted L1D.

The symbol ⊢ serves as a separator between the spin con-

figuration and the energy, while ⊥ marks the end of the string.

Note that | has the usual meaning of ‘such that’.

3.3. Classifying the languages of 1D spin Hamiltonians

We now classify the languages of 1D spin Hamiltonians in

the Chomsky hierarchy.

Theorem 11 (1D Hamiltonians). Let LH ∈ L1D (Defini-

tion 10). Then LH is deterministic context-free and not reg-

ular.

To prove this theorem, we will use the well-known pumping

lemma for regular languages.

Lemma 12 (Pumping lemma for regular languages [12]). Let

L be a regular language. Then the following property holds:

There exists a pumping length p ≥ 1 such that for any strings

α, β, γ with αβγ ∈ L, |β| ≥ p, there exist strings ω, µ, ν such

that β = ωµν, µ , ε, and for all j ≥ 0, the string αωµ jνγ ∈ L.

Proof of Theorem 11. We first prove that LH ∈ L1D is not reg-

ular by Lemma 12. For a given p we choose three strings

α = S (n) ⊢ β = u(H′(S (n), n)) γ =⊥

such that S (n) is a string of spins with H′(S (n), n) ≥ p. This

ensures that the string

αβγ = S (n) ⊢ ⋄ ⋄ ⋄ · · · ⋄ ⋄︸ ︷︷ ︸

≥p

is an element of LH with |β| ≥ p. It is now clear that any

choice of ωµν = β with j , 1 will result in a malformed string

αωµ jνγ , LH , since the spin configuration and the energy no

longer match. Therefore LH < L3.

Now we prove that LH is in DCFL by explicitly construct-

ing a DPDA that accepts LH . In terms of Definition 4 the

automaton is described by

• States Q = {a, b, e, f }

• Input alphabet Σ = Σq ∪ {⋄, ⊢,⊥}

• Stack alphabet Γ = {Tω | ω ∈ (Σq ∪ {x})k−1} ∪ {⋄, Z}

• Transition relation δ as shown in Fig. 4

• Start state a

• Initial stack symbol Z

• Accept states F = { f }

A visualisation of the DPDA can be seen in Fig. 4. The main

idea of this construction is the following. We encode the last

k − 1 spins read from the tape in a single symbol TS [i−k+1,i−1]on

top of the stack. This makes them accessible at each step of

the computation. When reading the next spin si, the symbol

is popped from the stack and the appropriate amount of en-

ergy symbols is pushed, followed by an updated stack symbol

now including si. This way, each group of k adjacent spins

is considered while summing up the corresponding energy on

the stack. Once the delimiter ⊢ is read, the energy symbols of

the input and on the stack are compared. This is achieved by

reading an energy symbol from the tape and simultaneously

popping one from the stack. This process is continued until

the end symbol of the string ⊥ is reached. At that point, only

if the amount of energy symbols on the tape coincide does the

automaton move to the accept state. �

The code that simulates this DPDA is attached to this

manuscript, in the file called dpda_simulator.py.

Note that a trivial Hamiltonian (e.g. a Hamiltonian that

maps every spin configuration to the same value, H′ = 0)

is a particular case of Definition 7, and it corresponds to a

regular language (cf. Fig. 2). To see this, note that in this

Hamiltonian the spin configuration is independent of the en-

ergy, from which it follows that the pumping lemma for reg-

ular languages (Lemma 12) does apply. Recognizing this lan-

guage reduces to verifying that the input obeys the pattern of

a spin configuration followed by delimiters. This requires no

stack and can therefore be done with a finite-state automaton.

Example 13 (1D Ising model with fields revisited). The lan-

guage corresponding to the 1D Ising model with fields (Exam-

ple 8), denoted LIsing

H, is recognized by the DPDA of Fig. 5.

Page 8: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

8

Head

h′(s1, s2)

s1 s2 . . . sn ⊢ u(H′(S (n), n)) ⊥ . . .

u(h′(s1 s2))Ts2

Stack

Tape

Z

e

e

Ts1

read

FIG. 5. A DPDA recognizing the language of the 1D Ising model

with fields, LIsing

1D(Example 13). The tape initially contains the spin

configuration (written in some appropriate alphabet) and an energy

value written in unary. This input string is an element of LIsing

1Dif and

only if the energy is precisely u(H′(S (n), n)). The head of the PDA

reads the state of the first two spins, calculates the energy h′(s1s2),

and stores it on the stack in unary. It then proceeds similarly with

the second and third spins and so on until the last pair. Finally, it

compares the calculated energy stored on the stack with the value

written on the tape and accepts if and only if they coincide.

3.4. Languages of 1D spin Hamiltonians with binary encoding

We now consider a binary encoding of the energy, instead of

a unary one, and prove that the resulting set of languages,Lbin1D

,

is no longer deterministic context-free, but context-sensitive

(Proposition 16). This illustrates the dependence of our com-

plexity measure on the association H LH . It also shows

that our standard choice of a unary encoding gives rise to a

simpler language—which is desirable, since we want to asso-

ciate the least complex language to a Hamiltonian.

Definition 14 (Binary encoding). The binary encoding b is

the map

b : N→ {0, 1}∗

n 7→ b(n) = c1 . . . cm

where m = ⌊log2(n)⌋ + 1 and n =∑m

l=1 cl2l−1.

Note that we are slightly abusing notation, as we use {0, 1}

as symbols of an alphabet (first line of the definition), and as

integers (second line of the definition).

Definition 15 (Binary languages of 1D Hamiltonians). Let H

be the 1D Hamiltonian given in Definition 7, rescaled as in (4).

The binary language associated to H, denoted LbinH

, is defined

as

LbinH = {S

(n) ⊢ b(H′(S (n), n)) ⊥

| (S (n), n) ∈ D1D}

where ⊢,⊥< Σq are delimiting symbols. The set of all LbinH

is

denoted Lbin1D

.

Note that the symbols 0, 1 < Σq.

q ∈ Q a ∈ Σ δ(q, a)

qα, |α| < k − 2 s ∈ Σq qαsi+1

qα, |α| = k − 2 s ∈ Σq pεαs

pωα , |ω| < k − 1 s ∈ Σq pωsα

pωα , |ω| = k − 1 s ∈ Σq pω2 ...ωk−1 sα

qαi

⊢ eu′(H′′(α,|α|))

pωα ⊢ eu′(H′′(αω,|α|+|ω|))

e j, j < 0 � e j+1

e j, j > 0 ⋄ e j−1

e j, j = 0 ⊥ f

TABLE 2. Transitions of a finite state automaton recognizing LH ∈

L0D. The automaton reads the input string and stores the first and

last k−1 spins it read as part of its state. The energy associated to the

spins is then compared to the energy of the tape and the automaton

accepts if they match. All combinations of current state q and input

symbol a not shown in the table transition into the reject state r.

Proposition 16 (1D Hamiltonians, binary). Let LbinH∈ Lbin

1D

(Definition 15). Then LbinH

is context-sensitive and not context-

free.

To show that LbinH

is not context-free we will use Ogden’s

lemma.

Lemma 17 (Ogden’s lemma [16]). Let L be a context-free

language. Then there exists an integer p ≥ 1 such that for

any string η ∈ L with |η| ≥ p the following holds: For any

way of selecting p or more of the symbols in η, there is a

decomposition η = αβγµν such that

(i) βµ contains at least one of the selected symbols,

(ii) βγµ contains at most p selected symbols, and

(iii) αβ jγµ jν ∈ L for all j ≥ 0.

Proof of Proposition 16. First we prove that LbinH∈ Lbin

1Dis not

context-free. So assume LbinH

is context-free, and that H is

non-trivial, i.e. H′ , 0. For any p ≥ 1, there exists an ele-

ment η ∈ LbinH

such that the binary representation of the en-

ergy, b(H′(S (n), n)), contains the symbol 1 at least p times.

These 1 symbols will be the selected symbols of the state-

ment of Lemma 17, and we claim that for any decomposition

η = αβγµν for which condition (i) holds, condition (iii) does

not hold. So, by (i), η = αβγµν includes at least one symbol

1 in βµ. Now, the string αβ jγµ jν with j > 1 has symbols 1

placed in a more significant digit of the binary representation,

and thus the corresponding energy is exponentially larger than

that in η. On the other hand, adding at most jn spins results in

a spin configuration whose energy (according to the Hamilto-

nian H′) only increases by a linear amount in j, because k is

bounded. It follows that (iii) is not fulfilled. Therefore (i) and

(iii) can not be fulfilled simultaneously and LbinH< L2.

To prove that LbinH∈ L1 we explicitly construct an LBA

recognizing the language in Appendix A. �

3.5. 0D Hamiltonians

We now investigate the role of the shift of the Hamiltonian

(namely, Λ in (3)) in the complexity of the corresponding

Page 9: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

9

α β

α

. . .

γ β

FIG. 6. A visualisation of the 0D Hamiltonian property given in

Definition 18, for k = 3. The spin configuration αβ is equivalent to

αγβ for all γ ∈ Σ∗q, as only the spins on the boundary of the chain

contribute to the energy.

language. That is, in this section the local 1D Hamiltonian

can also assign negative energies to the spin configurations.

As we will see, this can decrease the complexity of the cor-

responding language—essentially because there can be non-

trivial cancellations of positive and negative energies, result-

ing in a bounded image of H. In the following we will see

that this subclass of 1D Hamiltonians corresponds precisely

to that of 0D Hamiltonians.

Definition 18 (0D Hamiltonian). A 0D Hamiltonian is a local

1D Hamiltonian as given in Definition 7, with the property

that for all α, β ∈ Σk−1q and γ ∈ Σ∗q the following holds:

H(αβ, 2k − 2) = H(αγβ, 2k − 2 + |γ|).

In words, the energy associated to a spin configuration by a

0D Hamiltonian depends solely on the first and last k−1 spins

in the chain, as illustrated in Fig. 6. As a consequence, the

energy of a 0D Hamiltonian is bounded. Note that the lack of

dependence on the system size n can be seen as a holographic

property, as all interactions in the middle of the spin chain

cancel and only the behaviour at the boundary matters. Note

also that in the case of periodic boundary conditions the only

0D Hamiltonian is the trivial one, H = 0.

Example 19 (0D Hamiltonian for k = 2 [17]). Consider the

Hamiltonian H described by k = 2, q = 2, si ∈ {0, 1} ∪ {x},

and

h(si−1si) =

1 if si−1 si = 01,

−1 if si−1 si = 10,

0 otherwise.

This satisfies the property given in Definition 18. Only adja-

cent spins of non-equal level contribute to the energy. How-

ever, there cannot be two 01 spin pairs without a 10 between

them and vice-versa. It follows that the energy is bounded to

be in the finite set {1,−1, 0}, and can be determined by just

checking the first and last spin.

Note that if we had shifted the 1D Hamiltonian so that only

positive energies were allowed, the defining property of 0D

Hamiltonians would not be possible. In other words, if h only

had positive values in its image, the energy would be mono-

tonically increasing with the length of the spin configuration

and would thus be unbounded. For this reason we consider

another rescaling of the local hamiltonian:

h′′(α) = λh(α),

where λ ∈ Q is again the greatest common divisor of all values

in the image of h. The values of h′′ are therefore integers, and

can in particular include negative values. The new rescaled

Hamiltonian H′′ is given by

H′′ : D1D → Z

(S (n), n) 7→∑n

i=1 h′′(S [i−k+1,i]).(5)

To accommodate the possibility of negative numbers we de-

fine a modified unary encoding that takes the sign into account.

This is accomplished by another symbol�, used to denote neg-

ative unary values.

Definition 20 (Unary encoding on integers). The unary encod-

ing on integers u′ is a map from Z to strings over the alphabet

{⋄,�},

u′ : Z→ {⋄,�}∗

n 7→ ⋄n, n > 0

n 7→ �|n|, n < 0

0 7→ ε.

Next we define the language of a local 1D Hamiltonian un-

der this rescaling.

Definition 21 (Languages of 1D Hamiltonians without shift).

Let H be the 1D Hamiltonian given in Definition 7, rescaled as

in (5). The language associated to H, denoted Lneg

H, is defined

as

Lneg

H= {S (n) ⊢ u′(H′′(S (n), n)) ⊥

| (S (n), n) ∈ D1D}.

The set of all LH is denoted Lneg

1D.

Theorem 22 (Characterisation of 0D Hamiltonians). Let H

be a local 1D Hamiltonian as given in Definition 7. The fol-

lowing statements are equivalent:

1. H is a 0D Hamiltonian (Definition 18).

2. The image of H is bounded.

Proof. 1 ⇒ 2: As H is a 0D Hamiltonian, only up to 2k − 2

spins of the configuration contribute to the energy. There are a

total of∑2k−2

i=1 qi configurations with at most 2k − 2 spins. The

configurations αβ with α, β ∈ Σk−1q each give rise to an equiv-

alence class, where for all γ ∈ Σ∗q the equivalence αβ ≡ αγβ

holds. Every spin configuration with a length that is greater

than 2k − 2 are part of one such equivalence class and share

its image H(αβ, 2k − 2). It follows that the domain of H is

effectively finite, and thus the image of H is also finite and

therefore trivially bounded.

Page 10: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

10

qεstart

q0

q1

p00

p10

p01

p11

e0

e1

e−1

f

0

1

0

1

1

0

1

0

1 0

0

1

1

0

FIG. 7. A DFA recognizing LH ∈ L0D for the 0D Hamiltonian given in Example 19. The states p encode the first and last spin symbol read by

the automaton, allowing a transition to the correct energy state e once the delimiter ⊢ is read. Note that all combinations of symbol and state

that are not pictured here lead to the state r and cause the input to be rejected.

2 ⇒ 1: We prove the contrapositive of the statement. We

assume H is not a 0D Hamiltonian, i.e. there exist α, β ∈ Σk−1q ,

and γ ∈ Σ∗q such that

H(αβ, 2k − 2) − H(αγβ, 2k − 2 + |γ|) = ∆, ∆ , 0. (6)

We want to show that the image of H is not bounded. Consider

now the strings (αβ)l, indexed by the natural number l ≥ 1.

There are two cases:

1. The energy of the string αβ repeated l times

El = H((αβ)l, (2k − 2)l)

goes to ±∞ (i.e. either to −∞ or +∞). In this case the

image of H is clearly not bounded.

2. El is bounded for l → ∞. In this case we consider the

energy of the string αγβ repeated l times. As the length

of both α and β is k − 1, there is no cross-interaction

between the γ parts of the string, and each γ only con-

tributes ∆ to the energy, as given in Eq. (6). The energy

is therefore

H((αγβ)l, (2k − 2 + |γ|)l) = El + l∆.

The first term is bounded by assumption, while the sec-

ond term goes to ±∞ for l → ∞, causing the energy in

total to go to ±∞.

In either case, the energy is not bounded. �

This theorem thus says that the class of 0D Hamiltonians

completely characterizes the subset of local 1D Hamiltonians

with bounded energy in the absence of an energy shift. We

next characterize the complexity of this subclass of Hamilto-

nians.

Definition 23 (Languages of 0D Hamiltonians). Let H be a

0D Hamiltonian as given in Definition 7, rescaled as in (5).

The language associated to H, denoted LH , is defined as

LH = {S(n) ⊢ u′(H′′(S (n), n)) ⊥

| (S (n), n) ∈ D1D}.

The set of all LH is denoted L0D.

Theorem 24 (0D Hamiltonians). Let LH ∈ L0D (Defini-

tion 23). Then LH is regular.

Proof. We explicitly provide a deterministic finite-state au-

tomaton recognizing the language. It is described by

• States Q

• Input alphabet Σ = Σq ∪ {¬,⊥, ⋄,�, ⊢}

• Transition function δ as specified by Table 2

• Start state qε0

• Accept states F = { f }

The set of states Q consists of

Q = {qα | α ∈

k−2⋃

i=0

Σiq} ∪ {p

ωα | ω ∈

k−1⋃

i=0

Σiq and α ∈ Σk−1

q }

∪ {e j | −max(|Emin|, |Emax|) ≤ j ≤ max(|Emin|, |Emax|)}

∪ { f , r},

Page 11: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

11

where Emin and Emax are the lower and upper bound of en-

ergy for H′′. As according to Theorem 22 the energy of a 0D

Hamiltonian is bounded and depends only on a finite amount

of spins, these bounds exist and are computable.

As the final energy of the configuration only depends on a

finite amount of spins, the general idea of this construction

is to store information about the spins in the state of the au-

tomatons head. This is achieved by having an explicit state

for all possible combinations of 2k − 2 spins. The first k − 1

spins encountered are stored in the string α which is part of

the q states. For all further spins an additional string ω of up

to k − 1 spins is maintained in the states p, containing the last

k − 1 spins seen. This allows choosing the transition to the

correct energy state e j upon reading the delimiter ⊢.

The states e j encode an energy as j ∈ Z, which is compared

to the energy written on the tape. If they match, the automaton

transitions to the state f , accepting the input. An example of

this DFA is given in Fig. 7 for the 0D Hamiltonian given in

Example 19. �

In summary, allowing negative contributions of local 1D

Hamiltonians gives rise to languages in the set Lneg

1D. This set

can be partitioned into the set of languages of 0D Hamiltoni-

ans, L0D, and the set of languages of ‘truly’ 1D Hamiltonians,

Lneg

truly1D,

Lneg

1D= L0D ∪ L

neg

truly1D. (7)

If LH ∈ L0D, then LH is regular. On the other hand, if

LH ∈ Lneg

truly1D, then LH is deterministic context-free. To see

the last claim, recall that the rescaling used in the proof of

Theorem 11 [Eq. (4)] shifted the image of the Hamiltonian to

N, following the rescaling from Q to Z. It is easy to see that

the pumping argument showing that LH ∈ L1D cannot be regu-

lar also holds in the presence of negative energies. The DPDA

construction is slightly modified to allow for negative ener-

gies: ⋄ and �, respectively, represent positive and negative

energy values on the stack. If the symbol on top of the stack

is ⋄ (respectively, �), adding energy corresponds to pushing ⋄

(respectively, popping �).

4. 2D SPIN HAMILTONIANS AS AUTOMATA

In this section we define 2D spin Hamiltonians (Sec-

tion 4.1), associate formal languages to them (Section 4.2),

show that they are context-sensitive (Section 4.3), and extend

this result to higher dimensions (Section 4.4).

4.1. Definition of 2D spin Hamiltonians

In order to define 2D spin Hamiltonians we need to intro-

duce some more notation. The total number of spins in the

input is denoted as a product of the form n = nrnc, where nr

is the number of rows in the spin lattice, and nc the number

of columns. The entire 2D configuration of n spins is denoted

(S (ncnr), nc, nr). A double subindex si, j indicates the spin at the

ith row and the jth column. In the string S (ncnr ), this spin will

be labelled sinc+ j. Strings describing a rectangle in the spin

lattice spanned by the corners si′ , j′ and si, j are denoted

S [i′ ,i]×[ j′ , j] =si′ , j′ si′ , j′+1 . . . si′ , j−1si′ , jsi′+1, j′ . . . si, j−1 si, j

∈ Σ(i−i′+1)( j− j′+1)q .

Entire rows of spins are denoted as S i, where S i ≔ S [i,i]×[1,nc]

corresponds to the ith row.

Definition 25 (Local 2D Hamiltonian). Let q > 1, k ≥ 1 be

fixed natural numbers. Let

D2D =⋃

nc,nr≥1

{

(S (ncnr), nc, nr) | S(ncnr) ∈ Σncnr

q

}

be the set of 2D spin configurations. A local 2D Hamiltonian

H with at most k2-body interactions is a map

H : D2D → Q

(S (ncnr), nc, nr) 7→

nr∑

i=1

nc∑

j=1

h(S [i−k+1,i]×[ j−k+1, j]).

In addition, h : Σk2

q → Q is called the local Hamiltonian.

4.2. The languages associated to 2D spin Hamiltonians

We now associate formal languages to 2D spin Hamiltoni-

ans. As in the 1D case, the local interaction is extended with

the special symbol x, which stands for “the absence of a spin”

and is used to model open boundary conditions. A rescaled

H′ is defined analogously as before. Namely first h′ is defined

analogously as (3), and

H′ : D2D → N

(S (ncnr), nc, nr) 7→∑nr

i=1

∑nc

j=1h′(S [i−k+1,i]×[ j−k+1, j]).

(8)

Namely we rescale the local interaction h so that its image is

in N; this results in h′. The unary encoding is used exactly as

before.

Definition 26 (Languages of 2D Hamiltonians). Let H be a

local 2D Hamiltonian as defined in Definition 25, rescaled as

in (8). The language associated to H, denoted LH , is defined

as

LH = {S 1¬S 2¬ . . .¬S nr⊢ u(H′(S (ncnr), nc, nr)) ⊥

| (S (ncnr), nc, nr) ∈ D2D}

where ⊢,⊥,¬ < Σq are delimiting symbols. The set of all LH

is denoted L2D.

The new delimiter ¬ is used to indicate the end of a row of

spins.

Page 12: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

12

4.3. Classifying the language of 2D spin Hamiltonians

Now we classify LH ∈ L2D in the Chomsky hierarchy.

Theorem 27 (2D Hamiltonians). Let LH ∈ L2D (Defini-

tion 26). Then LH is context-sensitive and not context-free.

Intuitively, the jump in complexity from L1D to L2D is due

to the fact that the distance between interacting spins is un-

bounded in the input string. For example, spin s1,1 interacts

with s2,1, but the input string is one-dimensional and presented

as s1,1, . . . , s1,nc, s2,1, . . .. Since the number of columns nc is

unbounded, s1,1 and s2,1 are arbitrarily separated in the input

string.

To prove the theorem, we will use the pumping lemma for

context-free languages.

Lemma 28 (Pumping lemma for context-free languages [12]).

Let L be a context-free language. Then the following property

holds: There exists a pumping length p ≥ 1 such that for

any string η ∈ L with |η| ≥ p, there exists a decomposition

η = αβγµν with |βµ| ≥ 1 and |βγµ| ≤ p, such that αβ jγµ jν ∈ L

for all j ≥ 0.

Note that the difference to the pumping lemma for regular

languages is that in this case there are two substrings β and µ

which are pumped simultaneously.

Proof of Theorem 27. First we prove that LH ∈ L2D is not

context-free by exploiting Lemma 28. We do so by show-

ing that for any choice of pumping length p there exists an

element of LH that does not fulfil the condition stated in the

lemma. Specifically, for p ≥ 1, choose any element η ∈ LH

with number of spin columns nc > p and rows nr ≥ 3. Now,

for any decomposition η = αβγµν as stated by the lemma, the

middle part can at most span across two of the rows, due to

|βγµ| ≤ p < nc. Pumping the string with any choice of j , 1

will therefore cause at least two rows to be of unequal length.

It follows that αβ jγµ jν < LH . and therefore LH < L2.

To prove that LH ∈ L1 we explicitly construct an LBA in

Appendix B. �

The code that simulates this LBA is also attached to this

manuscript, in the file called lba_simulator.py.

Remark 29 (Periodic boundary conditions). Both Theorem 11

and Theorem 27 hold for periodic instead of open boundary

conditions. In the 1D case the DPDA must be augmented to

carry the state of the first k − 1 spins all the way through the

computation to compute their interactions with the last k − 1

spins. This is achieved by extending the stack alphabet such

that both the last k − 1 spins, as well as the first k − 1 spins

read can be stored in a single symbol TS [i−k+1,i−1],S [1,k−1]on top

of the stack. On the last transition before comparing the en-

ergies, the energies of the boundary-crossing interactions are

evaluated and pushed all at once.

For the 2D case the collecting spin step needs to be ad-

justed. Instead of adding the x symbol to the internal string

representation of the interaction when the edges of the lattice

are encountered, the automaton instead moves its head to the

Non-rectangular

planar lattice

Embedding in

rectangular lattice

FIG. 8. Any planar lattice can be embedded into a rectangular lattice

by cleaving vertices, as well as adding new edges and vertices. The

edges of the original lattice then correspond to paths in the rectangu-

lar lattice.

opposite lattice edge and continues collecting spins there. The

first half of either proof utilising the respective pumping lem-

mas is unchanged by these alterations.

Remark 30 (Effectively 1D Hamiltonians). The analogue of

0D Hamiltonians (Definition 18) in two dimensions would

be 2D Hamiltonians with no interactions between rows, i.e.

which only contain interactions between spins in the same row.

Such a Hamiltonian is in fact a stack of 1D Hamiltonians. The

associated language is context-sensitive due to Theorem 27,

i.e. it has the same complexity as the 2D case. Ultimately, this

is due to the fact that every row in a 2D spin Hamiltonian

needs to have the same length— and this fact alone suffices

to make the language context-sensitive. In this sense, the dis-

tinction between 0D and 1D Hamiltonians (Section 3.5) does

not generalise to 2D. This could be seen as an artifact of our

definition of 2D languages, but on the other hand, a stack of

1D Hamiltonians is not a 1D Hamiltonian.

Remark 31 (Non-rectangular planar lattices). The result of

Theorem 27 also holds for non-rectangular planar spin lat-

tices (Note that lattice, in contrast to graph, implies period-

icity). To see this, recall that any planar graph is a minor of

a sufficiently large rectangular grid [18]. We can therefore

embed the planar lattice into a rectangular lattice by adding

vertices and edges, as well as cleaving vertices (the inverse

operation to graph contraction). We treat the new vertices

created by these operations as the symbol x, which we previ-

ously used to denote the absence of a spin in the sense of open

boundary conditions. The LBA recognizing the language is

slightly extended by adding x to the input alphabet. An ex-

ample of this embedding is shown in Fig. 8. All that is left is

the choice of k and local Hamiltonian h such that the local

interactions of the original lattice are preserved. This choice

depends on the operations applied during the embedding. Fol-

lowing this, the non-rectangular lattice can be treated just like

a rectangular lattice as given in Definition 25.

4.4. Extension to higher dimensional lattices

We now prove that the result given in Theorem 27 also

holds for Hamiltonians of dimension d > 2. To this end we

first define Hamiltonians acting on strings on a d-dimensional

Page 13: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

13

lattice. Spins are now indexed by a multi-index, si1 ,...,id . Sim-

ilarly as before we denote spin configurations as S (n1···nd),

where n1, n2, . . . , nd denote the size of the lattice in the cor-

responding dimension, and n1 · · · nd denotes their product. In

addition, strings describing a hypercube spanned by the cor-

ners si′1,...,i′

dand si1,...,id are denoted

S [i′1,i1]×...×[i′

d,id].

Definition 32 (Local dD Hamiltonian). Let q > 1, k ≥ 1, d ≥

1 be fixed natural numbers. Let

DdD =⋃

n1,...,nd≥1

{

(S (n1···nd), n1, . . . , nd) | S (n1···nd) ∈ Σn1 ···ndq

}

be the set of dD spin configurations. A local dD Hamiltonian

H with at most kd-body interactions is a map

H : DdD → Q

(S (n1···nd), n1, . . . , nd) 7→

n1∑

i1=1

. . .

nd∑

id=1

h(S [i1−k+1,i1]×...×[id−k+1,id]).

In addition, h : Σkd

q → Q is called the local Hamiltonian.

In order to define the language associated to these Hamilto-

nian we introduce a recursive notation for the strings of their

spin configurations. (Note that we are distinguishing here be-

tween the spin configuration S (n1···nd), and the string describing

this spin configuration – the latter will be part of the language).

For fixed n1, . . . , nd, we denote the string describing a spin

configuration by Qd. For d = 1, Q1 corresponds to the 1D

case defined in Section 3.1, namely

Q1 = S (n1) ∈ Σn1q .

For d > 1, Qd is defined as the concatenation of nd strings,

each of which is associated to lattice dimension d − 1, sepa-

rated by delimiter symbols ¬d,

Qd = Qd−11 ¬d . . .¬dQd−1

nd.

Note that Q2 corresponds to the 2D configurations defined in

Section 4.1.

Definition 33 (Languages of dD Hamiltonians). Let H be a

local dD Hamiltonian as given in Definition 32, rescaled to H′

analogously as in (4). The language associated to H, denoted

LH , is defined as

LH = {Qd ⊢ u(H′(S (n1···nd), n1, . . . , nd)) ⊥

| (S (n1···nd), n1, . . . , nd) ∈ DdD}

with delimiting symbols ⊢,⊥,¬2, . . . ,¬d < Σq. The set of all

LH ∈ LdD is denoted LdD.

As a corollary of Theorem 27 we classify these languages

in the Chomsky hierarchy.

Corollary 34 (dD Hamiltonians). Let LH ∈ LdD (Defini-

tion 33). Then LH ∈ LdD is context-sensitive and not context-

free.

Proof. The proof that LH ∈ LdD is not context-free is entirely

analogous to the proof of L2D 1 L2 (see Theorem 27).

The proof that LH ∈ L1 is analogous to the construction for

2D, presented in Appendix B. The steps for validating the in-

put (Appendix B.2) and comparing the energy (Appendix B.4)

are the same as for the 2D construction, except for the addition

of transitions for the delimiters ¬2, . . . ,¬d. Let us now show

how the step for ensuring equal row lengths (Appendix B.1)

generalizes to higher dimension. The goal of this step is to en-

sure that the spin configuration is indeed a hyperrectangle, i.e.

for all dimensions 1 ≤ i < d each Qi−11, . . . ,Qi−1

nihas the same

ni−1. For i = 1 this is achieved by counting spin symbols sep-

arated by all delimiters ¬ j for 1 ≤ j ≤ d in parallel, as used in

the 2D construction. For each of the higher dimensions i > 1

we instead count the symbols ¬i separated by all higher di-

mensional delimiters ¬i′ in parallel, where i < i′. This is used

to check that the ni is indeed uniform across all Qi. For the

highest dimension i = d there is nothing to check, as there is

only one Qd.

The step for collecting interacting spins (Appendix B.3)

generalises to higher dimensions as follows. To navigate to

the correct position in each row of interacting spins, we use

a counting procedure for each dimension 1 ≤ i < d similarly

as for the 2D case. Namely, the i = 1 case is demonstrated

in the 2D construction: From the end of each of the k inter-

acting rows—as indicated by the symbol ¬2—spin symbols

are counted in parallel, until the earmarked interaction spin s′

is encountered in the first row. Analogously, for each higher

dimension 1 < i < d we earmark the first delimiter ¬i follow-

ing the interaction symbol. Starting from k ¬i+1 symbols we

count ¬i symbols in parallel until encountering the earmarked

delimiter, thus identifying the delimiters corresponding to the

location of interacting spins in the input.

Neither of these extensions requires the automaton to write

additional information to the tape beyond earmarking sym-

bols. The LBA for the 2D case thus generalises to higher

dimensions, from which it follows that LH ∈ L1. �

5. UNBOUNDED INTERACTION RANGE

In this section we consider Hamiltonians with an un-

bounded interaction range. This means that the range of the

interactions, called k in the previous sections, is not upper

bounded, i.e. grows with the system size n. We distinguish

two cases: First, the case in which there is a local Hamilto-

nian which is still local in the computer science sense, but not

in the physical sense (see the discussion before Definition 7),

i.e. the local Hamiltonian has a fixed arity (Section 5.1); and,

second, the case in which the latter does not hold, i.e. there is

no restriction on the local Hamiltonian (Section 5.2).

5.1. Local Hamiltonians of fixed arity

Here we consider local Hamiltonians which are local in the

computer science sense: that is, each local Hamiltonian af-

fects at most a certain number of variables r (i.e. its arity is at

Page 14: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

14

most r), but these variables need not be ‘close’ to each other

according to some lattice, i.e. they are not local in the physical

sense.

As in previous sections, we will first define these Hamiltoni-

ans (Definition 35), associate formal languages to them (Def-

inition 36) and prove that they are context-sensitive (Proposi-

tion 37). We thus obtain the same complexity as for the 2D

bounded case (Section 4). The ultimate reason for this result

is indeed the same: the lack of upper bound on the distance

between interacting spins implies that the effective distance

between interacting spins in the string of the language is un-

bounded, which implies that the corresponding language can-

not be context-free.

Let us now define a spin Hamiltonian H as a sum of local

Hamiltonians h of fixed arity r. (Note that we still refer to h

as a local Hamiltonian, although it is no longer local in the

physical sense.) Physically, the variables involved in h can be

as far from each other as possible, i.e. we consider the worst

case in which the physical range of the interaction k is the

whole system size n, k = n. Note that previously (Sec. 3,

Sec. 4) we had r = k.

Definition 35 (Unbounded 1D Hamiltonian of fixed arity).

Let q > 1, r ≥ 2 be fixed natural numbers. Let D1D be given

by (1). An unbounded 1D Hamiltonian of fixed arity H is a

map

H : D1D → Q

(S (n), n) 7→

n∑

0<i1<i2···<ir≤n

h(si1 si2 . . . sir ). (9)

In addition, h : Σrq → Q is called the local Hamiltonian.

In order to define the associated languages Lunbound1D

, we

rescale H to H′ analogously as in (4).

Definition 36 (Languages of unbounded 1D Hamiltonians).

Let H be a unbounded 1D spin Hamiltonian as given in Defi-

nition 35, rescaled analogously as in (4). The language asso-

ciated to H, denoted LunboundH

, is defined as

LunboundH = {S (n) ⊢ u(H′(S (n), n)) ⊥

| (S (n), n) ∈ D1D}

where ⊢,⊥< Σq are delimiting symbols. The set of all LunboundH

is denoted Lunbound1D

.

We now show that an unbounded k does increase the com-

plexity of the language.

Proposition 37 (Unbounded 1D Hamiltonians). Let

LunboundH

∈ Lunbound1D

(Definition 36). Then LunboundH

is

context-sensitive and not context-free.

Proof. We first use the pumping lemma for context-free lan-

guages (Lemma 28) to prove that LunboundH

< L2. Let us as-

sume that the Hamiltonian is not trivial, H′ , 0. For a given

pumping length p we choose ω ∈ LunboundH

such that

ω = θp ⊢ ⋄ . . .⋄︸︷︷︸

≥p

⊥,

where θ ∈ Σkq such that h′(θ) > 0. We now consider all possi-

ble decompositions of ω = αβγµν with |βγµ| ≤ p and |βµ| > 0:

(i) β or µ contains one of the delimiters ⊢ or ⊥. The pump-

ing lemma is clearly violated in this case, as any j , 1

leads to an amount of delimiters that does not conform

with LunboundH

. In particular this implies that any choice

of decomposition that fulfils the lemma must have β and

µ which are purely substrings of the spin configuration

θp or of the energy ⋄ . . . ⋄.

(ii) One of β or µ is empty and the other is a substring of

θp, or both are substrings of θp. If we were to duplicate

any particular spin of the configuration, the energy of

the configuration would increase with at least p, since

the new spin interacts with all p substrings θ of the con-

figuration. Therefore, any possible choice of β and µ

with j , 1 leads to αβ jγµ jν < LunboundH

, since the energy

no longer matches.

(iii) One of β or µ is empty and the other is a substring of

⋄ . . .⋄, or both are substrings of ⋄ . . .⋄. Any choice of

j , 1 leads to αβ jγµ jν < LunboundH

, since the energy is

changed without changing the spin configuration.

(iv) β is a substring of θp and µ is a substring of ⋄ . . .⋄, both

of which are non-empty. By the same argument as in

(i), when replacing β with β j the energy increases by at

least ( j − 1)p. On the other hand, duplicating µ with

the same j only adds ( j − 1)|µ| diamonds to the string.

Due to |βγµ| ≤ p and |β| > 0 it follows that |µ| < p and

consequently ( j − 1)|µ| < ( j − 1)p.

Since αβ jγµ jν < LunboundH

for j > 1 in all cases, LunboundH

< L2.

To prove that LunboundH

∈ L1 we explicitly construct an LBA

accepting the language in Appendix C. �

5.2. Totally unbounded Hamiltonians

We now consider Hamiltonians which are not local in the

physical or computer science sense— we call these Hamilto-

nians totally unbounded. To define these Hamiltonians it no

longer makes sense to use local Hamiltonians h. Instead, we

view the Hamiltonian as a family of functions {Hn}n for all

system sizes n. We will only consider the case in which this

family admits a computable description, i.e. where there exists

a Turing machine such that on input it n produces a description

of Hn. We now give a formal definition of such Hamiltonians,

as well as the language associated to them.

Definition 38 (Totally unbounded Hamiltonian). Let q > 1 be

a fixed natural number. A totally unbounded Hamiltonian H

is a family of functions

H = {Hn : Σnq → Q}n. (10)

Furthermore, there is a Turing machine C that, when given

input n, produces a description d of Hn,

C : n 7→ d(Hn).

Page 15: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

15

In addition, there exist λ ∈ Q and Λ ∈ Q such that H′n :=

λ(Hn + Λ) is a map

H′n : Σnq → N

for all n.

Note that in the second part of Definition 38 we are asking

for the existence of a rescaling (λ) and shift (Λ) independent

of the system size.

Definition 39 (Languages of totally unbounded Hamiltonian).

Let H be a totally unbounded Hamiltonian as given in Def-

inition 38. The language associated to H, denoted LtotalH

, is

defined as

LtotalH = {S (n) ⊢ u(H′n(S (n))) ⊥

| S (n) ∈ Σnq}

where ⊢,⊥< Σq are delimiting symbols. The set of all LtotalH

is

denoted Ltotal.

In the following we prove that these language are in L0, for

the obvious reason that the very description of the Hamilto-

nian involves a Turing machine itself.

Proposition 40 (Totally unbounded Hamiltonians). Let

LtotalH∈ Ltotal (Definition 39). Then Ltotal

His recursively enu-

merable.

Proof. To show that LtotalH< L1, note that any automaton

recognizing LtotalH

necessarily includes the Turing machine C

(Definition 38) as a subroutine. The tape space this TM uses

need not be bounded by a linear function of the size of the

input, i.e. it need not be an LBA.

That LtotalH∈ L0 follows from the definition of the language:

we require that the description of H be computable. Explicitly,

we claim there is a TM M that takes as input the string

S (n) ⊢ u(En) ⊥

where En is a natural number, and accepts if and only if

En = H′n(S (n)). In addition, M rejects all other strings, in-

cluding ill-formed ones. This TM works as follows: first it

counts the length of the spin configuration S (n), i.e. n. Then

it uses the TM C as a subroutine (Definition 38) in order to

obtain d(Hn). The latter could for example be a list of the val-

ues of spin configurations of length n and their corresponding

energy, where the spin configurations are ordered e.g. lexico-

graphically. Now M reads S (n) and looks for the correspond-

ing energy value in the list, i.e. Hn(S (n)). Since by assumption

there exist λ,Λ with the properties given in Definition 38, M

uses them to compute H′n(S (n)). Finally, M compares H′n(S (n))

with En, and accepts if and only if they are identical. �

6. LOCAL HAMILTONIAN ENCODED IN THE INPUT

In the previous sections, every spin Hamiltonian H was de-

fined by the uniform “action” on all spins of a given local

Hamiltonian h. Namely, for any H, h was fixed. In order

to allow a direct comparison to the ground state energy prob-

lem (GSE) of the 2D Ising model with unfixed couplings, we

now consider the case where h is specified as part of the input.

The only requirement will be that the interaction range of h be

bounded, and that h be chosen from a finite set. As before, we

first consider the 1D case (Section 6.1) and then the 2D case

(Section 6.2). We then compare our result to the complexity

of the GSE of the Ising model (Section 6.3).

6.1. 1D spin Hamiltonians with unfixed local Hamiltonian

Here we define 1D spin Hamiltonians with unfixed lo-

cal Hamiltonian (Definition 41), associate languages to them

(Definition 42), and show that these languages are determinis-

tic context-free (Corollary 43).

We consider the case in which the local Hamiltonian can

be chosen from a finite set, {h1, . . . , hp}, for some fixed p ≥

1. Which local Hamiltonian is applied, centered around every

spin, is given as part of the input. Namely, for every system

size n, H will also pick local Hamiltonians

hI1, . . . , hIn

,

where each index I j ∈ [p] specifies the local Hamiltonian that

is picked “centered around spin j” (in fact j will be at the right

end of the interaction). The collection of all these indices is

denoted I = (I1, . . . ,In), where we omit the superscript (n)

to keep notation simple.

Definition 41 (Unfixed local 1D Hamiltonian). Let q > 1, k ≥

1, p ≥ 1 be fixed natural numbers. Let

F1D =⋃

n≥1

{

(I, S (n), n) | I ∈ [p]n, S (n) ∈ Σnq

}

be the set of all 1D spin configurations with unfixed local

Hamiltonians. An unfixed 1D local Hamiltonian H with at

most k-body interactions is a map

H : F1D → Q

(I, S (n), n) 7→

n∑

i=1

hIi(S [i−k+1,i]), (11)

where h1, . . . , hp : Σkq → Q are the local Hamiltonians.

Recall that hi is a local interaction in the physical sense (see

[5]), meaning that it assigns energy values to subconfiguration

S (k) of k adjacent spins.

The rescaling of this Hamiltonian is done analogously to

Eq. (3), with the only difference that indices now run over the

finite set [p]. Namely, we choose λ as the greatest common

divisor among the images of all h j, and

Λ = −minj∈[p]

minα∈Σk

q

h j(α).

The rescaled local interaction is thus

h′j(α) = λ(h j(α) + Λ),

Page 16: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

16

and the Hamiltonian H′ as

H′(I, S (n), n) =

n∑

i=1

h′Ii(S [i−k+1,i]). (12)

Now we define the languages associated to the Hamiltoni-

ans of Definition 41. We use alphabet Σp = [p], whose sym-

bols correspond to the indices of the p different local Hamil-

tonians. We denote a string of spin symbols interleaved with

a string of local Hamiltonian indices by

R(n) = I1s1I2s2 . . .Insn ∈ (ΣpΣq)n.

Definition 42 (Languages of unfixed local 1D Hamiltonians).

Let H be a Hamiltonian as given in Definition 41, and H′ its

rescaled version given by (12). The language associated to H,

denoted LunfixH

, is defined as

LunfixH = {R(n) ⊢ u(H′(I, S (n), n)) ⊥

| (I, S (n), n) ∈ F1D}

where ⊢,⊥< Σq are delimiting symbols. The set of all LunfixH

is

denoted Lunfix1D

.

We now prove that the unfixed local Hamiltonians lead to

a language of the same complexity as before, so that the com-

plexity classification given by Theorem 11 also holds.

Corollary 43 (Unfixed 1D Hamiltonian). Let LunfixH∈ Lunfix

1D

(Definition 42). Then LunfixH

is deterministic context-free and

not regular.

Proof. A construction of a DPDA accepting LunfixH∈ Lunfix

1Dis

given in Fig. 9. For k ≥ 1 and q ≥ 2 it is formally described

by

• States Q = {a, b1, b2, e, f }

• Input alphabet Σ = Σq ∪ Σp ∪ {⊢,⊥, ⋄}

• Stack alphabet

Γ = {TIi,ω | Ii ∈ Σp and ω ∈ ([q] ∪ {x})k−1} ∪ {⋄, Z}

• Transition relation δ as shown in Fig. 9

• Start state a

• Initial stack symbol Z

• Accepting state f

The automaton is similar to the previous construction for

the fixed interaction case. The stack alphabet TIi,ω symbols

are extended so that they do not only encode the previous

k − 1 spins, but also the last seen interaction map index. Us-

ing this information from the top of the stack the automaton

chooses its transitions to push the corresponding amount of

energy symbols on the stack for each interaction. The energy

comparison step is the same as before.

The proof that LunfixH

is not regular is identical to the one for

the case of fixed couplings. �

6.2. 2D spin Hamiltonians with unfixed local Hamiltonian

Here we present an analogous study for the 2D case: We

define unfixed local 2D spin Hamiltonians (Definition 44), as-

sociate languages to them (Definition 45), and show that these

languages are context-sensitive (Corollary 46).

Definition 44 (Unfixed local 2D Hamiltonian). Let q > 1, k ≥

1, p ≥ 1 be fixed natural numbers. Let

F2D =⋃

nc ,nr≥1

{

(I, S (ncnr), nc, nr) | I ∈ [p]ncnr , S (ncnr ) ∈ Σncnrq

}

be the set of all 2D spin configurations with unfixed local

Hamiltonians. An unfixed local 2D Hamiltonian H with at

most k2-body interactions is a map

H : F2D → Q

(I, S (ncnr), nc, nr) 7→

nr∑

i=1

nc∑

j=1

hIi(S [i−k+1,i]×[ j−k+1, j]), (13)

where h1, . . . , hp : Σk2

q → Q are the local Hamiltonians.

Similar to the 1D case, and generalising the 2D case of Sec-

tion 4.1, we denote rows of spins interleaved with interaction

map indices by Ri,

Ri = Ii,1si,1Ii,2si,2 . . .Ii,ncsi,nc∈ (ΣpΣq)nc .

Definition 45 (Languages of unfixed 2D Hamiltonian). Let

H be a Hamiltonian as given in Definition 44. The language

associated to H, denoted LunfixH

, is defined as

LunfixH = {R1¬R2¬ . . .¬Rnr

⊢ u(H′(I, S (ncnr ), nc, nr)) ⊥

| (I, S (ncnr), nc, nr) ∈ F2D}

where ⊢,⊥,¬ < Σq are delimiting symbols. The set of all LunfixH

is denoted Lunfix2D

.

We now show that the classification of LunfixH∈ Lunfix

2Din the

Chomsky hierarchy is the same as that of its fixed counterpart,

LH ∈ L2D (Theorem 27).

Corollary 46 (Unfixed 2D Hamiltonian). Let LunfixH∈ Lunfix

2D

(Definition 45). Then LunfixH

is context-sensitive and not

context-free.

Proof. The proof for LunfixH< L2 is identical to the one for LH .

To prove that LunfixH

is context-sensitive, we slightly mod-

ify the LBA given in Appendix B. During the collecting spins

step, the interaction map index of the current interaction spin

is also collected and considered when determining the energy

of the interaction. Since this addition does not require addi-

tional space on the tape beyond the input, the resulting au-

tomaton is still an LBA and LunfixH∈ L1. �

Page 17: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

17

a

start

b1 b2 e fI1, Z → TI1 ,xx...xZ

si,TIi,S [i−k+1,i−1]→ TIi ,S [i−k+2,i]

u(h′Ii

(S [i−k+1,i]))

Ii,TIi−1 ,S [i−k+1,i−1]→ TIi ,S [i−k+1,i−1]

⊢,TIn ,S [n−k+2,n]→ ε

⋄, ⋄ → ε

⊥,Z → Z

FIG. 9. A DPDA recognizing LunfixH ∈ Lunfix

1D. (a): The first transition reads the first interaction map index I1 and stores it on the stack in the

symbol TI1 ,xx...x. (b): On the transition from b1 to b2 the next spin si is read from the tape. In addition, the previous k − 1 spins as well as the

interaction map index are read from the stack as a single symbol TIi ,S [i−k+1,i−1]. The local Hamiltonian is evaluated on the spins and the resulting

energy is pushed on the stack, followed by an updated stack symbol TIi,S [i−k+2,i]that includes si. The transition from b2 to b1 reads the next

interaction map index Ii and stores it in the symbol on top of the stack. Once the delimiter ⊢ is encountered, the top stack symbol is discarded

and the automaton transitions to e. (e): The energy string on the tape is compared to the energy string in the stack, and the final state f is

reached only if their length matches.

6.3. Comparison to the ground state energy problem

In the following we will compare Corollary 43 and Corol-

lary 46 to the computational complexity of the GSE for the

Ising model. To this end we first give a statement of the GSE

as it is commonly formulated and then translate it into our lan-

guage.

Definition 47 (GSE). Given n ∈ N, and a Hamiltonian func-

tion H that maps configurations of n spins to energy values

and an energy E ∈ Q, is there a spin configuration S (n) such

that H(S (n)) < E?

One particular example is the GSE of the Ising model. Re-

call Example 8, where the 1D Ising model with homogeneous

coupling strength and magnetic field is given. We now extend

this to the 2D case with unfixed couplings.

Example 48 (The 2D Ising model with unfixed couplings).

Consider the 2D Ising model with fields with coupling

strengths Ji, j ∈ {−1, 0, 1} and magnetic field m ∈ Z,

H(σ1, . . . , σn) =

n∑

i=1

mσi +∑

〈i, j〉

Ji, jσiσ j,

where σi ∈ {−1, 1} and 〈i, j〉 denotes all pairs of neighbouring

spins. In terms of Definition 44, this is described by k = 2,

q = 2, p = 9, si ∈ {0, 1} ∪ {x}, and local Hamiltonians

{h1, . . . , h9}. The local Hamiltonians correspond to all com-

binations of coupling strengths picked from {−1, 0, 1} for the

Complexity of Ising models

GSE Language

1D Ising with fieldsin P

deterministic context-free

2D Ising without fieldscontext-sensitive

2D Ising with fields in NP

TABLE 3. The complexities of the ground state energy problem, as

well as classification of the associated language for the Ising models

given in Example 8 and Example 48.

interactions of si, j with neighbours si−1, j, si, j−1, i.e.

h1(si−1, j−1si−1, j si, j−1si, j) = m(−1)si, j

h2(si−1, j−1si−1, j si, j−1si, j) = m(−1)si, j + g(si, jsi−1, j)

h3(si−1, j−1si−1, j si, j−1si, j) = m(−1)si, j − g(si, jsi−1, j)

h4(si−1, j−1si−1, j si, j−1si, j) = m(−1)si, j + g(si, jsi, j−1)

h5(si−1, j−1si−1, j si, j−1si, j) = m(−1)si, j − g(si, jsi, j−1)

h6(si−1, j−1si−1, j si, j−1si, j) = m(−1)si, j + g(si, jsi−1, j) + g(si, jsi, j−1)

h7(si−1, j−1si−1, j si, j−1si, j) = m(−1)si, j + g(si, jsi−1, j) − g(si, jsi, j−1)

h8(si−1, j−1si−1, j si, j−1si, j) = m(−1)si, j − g(si, jsi−1, j) + g(si, jsi, j−1)

h9(si−1, j−1si−1, j si, j−1si, j) = m(−1)si, j − g(si, jsi−1, j) − g(si, jsi, j−1)

where g(sis j) =

0 if s j = x,

(−1)si+s j otherwise.

According to Corollary 46 the language associated to this

Hamiltonian is context-sensitive, regardless of the choice of

magnetic field m. In contrast to this, the complexity of the

GSE displays a threshold for this example. In the absence of

a magnetic field (i.e. m = 0) the problem is in P, whereas for

m , 0 it becomes NP-complete [3, 4].

On the other hand, the language associated to the 1D Ising

model given earlier in Example 8 corresponds to a context-

free language according to Theorem 11. This highlights that

the threshold of language complexity is distinct of the thresh-

old for the complexity of the GSE as shown in Table 3.

Remark 49 (Computational complexity). Note that the com-

plexity measure we present in this work is distinct from the

computational complexity of e.g. the GSE. Decision problems

Page 18: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

18

in computational complexity are formulated in the following

way: Given a language L, give a TM that decides for all inputs

x whether x ∈ L or x < L. The time complexity of the prob-

lem is given by the TM that accomplishes this task in the least

amount of steps. Usually one studies the worst-case complex-

ity, in which the hardest instance determines the complexity of

the problem. Note that here we consider a family of languages

(such as L1D or L2D), and show that if a language L is an ele-

ment of this family, then L is in a certain level of the Chomsky

hierarchy. The two approaches are thus different.

7. CONCLUSIONS AND OUTLOOK

We have described classical spin Hamiltonians as automata,

and the classification of the latter has led to a new complexity

measure of Hamiltonians. More precisely, we have associated

formal languages to classical spin Hamiltonians and have clas-

sified these languages in the Chomsky hierarchy. Our main

results are that:

(i) The language associated to a 0D spin Hamiltonian is

regular (Theorem 24).

(ii) The language associated to a local 1D spin Hamiltonian

is deterministic context-free (Theorem 11), even if the

local Hamiltonian is given as part of the input (Corol-

lary 43).

(iii) The language associated to a local 2D spin Hamilto-

nian is context-sensitive (Theorem 27), even if the lo-

cal Hamiltonian is part of the input (Corollary 46). The

same classification holds for the language associated to

an unbounded 1D spin Hamiltonian (Proposition 37).

(iv) The language associated to a totally unbounded Hamil-

tonian is recursively enumerable (Proposition 40).

In addition, we have shown that the languages associated to

bounded 1D spin Hamiltonians where the energy is written in

binary are context-sensitive (Proposition 16).

We thus see that for ‘natural’ spin models, that is, local

ones, the threshold in hardness occurs at the boundary be-

tween a 1D and a 2D lattice. In particular, this implies that

the language associated to the Ising model without fields is

deterministic context-free or context-sensitive if it is defined

on a 1D or 2D lattice, respectively. This is in contrast to the

computational complexity of its ground state energy problem,

which is in P or NP-complete if defined on a planar or non-

planar graph, respectively (Table 1).

In any case, all of these natural spin models correspond

to automata which are weaker than Turing machines. Only

highly non-physical spin models—namely, totally unbounded

Hamiltonians—correspond to Turing machines.

This work puts classical spin Hamiltonians and automata at

the same level (by describing one as the other), and thereby

opens the door to transfer results from one field to the other.

As a first result of this cross-fertilisation, we have borrowed

the Chomsky hierarchy of formal languages to derive a com-

plexity classification of classical spin Hamiltonians. But this

has sown the ground for many other results: An important one

would be a rigorous comparison between universal spin mod-

els [19] and universal Turing machines. (Note that translation-

ally invariant universal classical spin Hamiltonians have also

been shown to exist [20]). For example, universal spin models

allow for a full characterisation [19, Theorem 15], but univer-

sal Turing machines do not, due to Rice’s Theorem—thus, the

two notions of universality do not seem to be equivalent. An-

other fascinating consequence involves exploring the reach of

undecidedability in classical spin Hamiltonians.

Another line of research concerns the quantum case, where

one would consider quantum spin Hamiltonians. It would be

interesting to associate formal languages to them and classify

their complexity. Note that a complexity classification of the

ground state energy problem for local qubit Hamiltonian prob-

lems has been provided in [21]. Note also that for quantum

spin Hamiltonians, the phenomenon of universality has also

been shown to hold [22], as well as for translationally invari-

ant versions thereof [23, 24].

Acknowledgements.— We thank Maris Ozols for many in-

teresting comments and remarks, especially regarding the im-

portance of the rescaling of h for the classification of the cor-

responding language (Example 19). We also thank Georg

Moser for many interesting discussions, and Robert Ganian

for his input regarding parametrized complexity. We thank

Alexis Toumi for a question regarding quasi context-sensitive

languages, and Martin Schwarz for an interesting comment.

[1] C. Moore and S. Mertens, The nature of computation (Oxford

University Press, 2011).

[2] M. Mezard and A. Montanari,

Information, Physics, And Computation (Oxford Graduate

Texts, 2009).

[3] F. Barahona, J. Phys. A 15, 3241 (1982), doi:

10.1088/0305-4470/15/10/028 .

[4] S. Istrail, in STOC’00 (Portland, Oregon: ACM Press, 2000)

p. 87.

[5] Recall that from a computational complexity perspective, the

2D Ising model with fields is equivalent to the 2D Ising model

without fields on a square lattice with an additional ‘spike’, that

is, an outlying extra vertex connected to every other vertex, i.e.

a non-planar graph. Note that a more refined analysis of the

computational complexity of the GSE is provided by parame-

terized complexity, where one takes into account dependence

on various parameters in the input [25].

[6] A. N. Kolmogorov, Int. J. Comput. Math. 2, 157 (1968), doi:

10.1080/00207166808803030.

[7] G. J. Chaitin, J. ACM 13, 547 (1966), doi:

10.1145/321356.321363.

[8] M. Hutter, Universal Artificial Intelligence (Springer, 2010)

doi: 10.1007/b138233.

[9] We conjecture that proving that the association H LH is op-

Page 19: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

19

timal is uncomputable. By ‘optimal’ we mean that it gives rise

to the LH in the lowest possible level in the Chomsky hierarchy.

One should also require that the association be faithful in some

way, i.e. that H can be retrieved from LH .

[10] G. M. Crosswhite and D. Bacon,

Phys. Rev. A 78, 012356 (2008).

[11] C. E. Mora, H. J. Briegel, and B. Kraus,

Int. J. Quantum Inf. 5, 729 (2007), doi:

10.1142/S0219749907003171.

[12] D. C. Kozen, Automata and Computability (Springer, 1997) doi:

10.1007/978-1-4612-1844-9 .

[13] C. M. Papadimitriou, Computational complexity (Reading,

Massachusetts: Addison-Wesley, 1995).

[14] We take this energy value to be rational number, so that we can

later rescale it to h′, whose image are natural numbers.

[15] We conjecture that any other transformation whose description

is independent of the system size would result in a formal lan-

guage at the same level of the Chomsky hierarchy.

[16] W. Ogden, Math. Syst. Theory 2, 191 (1968), doi:

10.1007/BF01694004.

[17] We thank Maris Ozols for providing this example.

[18] R. Tamassia and I. G. Tollis, IEEE T Circuits Syst. (1989), doi:

10.1109/31.34669.

[19] G. De las Cuevas and T. S. Cubitt, Science 351, 1180 (2016),

doi: 10.1126/science.aab3326.

[20] T. Kohler and T. S. Cubitt, JSTAT 176, 228 (2019), doi:

10.1007/s10955-019-02295-3 .

[21] T. Cubitt and A. Montanaro, SIAM J. Comput. 45, 268 (2016),

doi: 10.1137/140998287.

[22] T. S. Cubitt, A. Montanaro, and S. Piddock,

Proc. Natl. Acad. Sci. 38, 9497 (2018).

[23] S. Piddock and J. Bausch, (2020), arXiv:2001.08050.

[24] T. Kohler, S. Piddock, J. Bausch, and T. Cubitt, (2020),

arXiv:2003.13753.

[25] M. Cygan, F. V. Fomin, L. Kowalik, D. Loksh-

tanov, D. Marx, M. Pilipczuk, M. Pilipczuk, and

S. Saurabh, Parameterized Algorithms (Springer, 2015)

doi: 10.1007/978-3-319-21275-3 .

Page 20: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

20

Appendix A: An LBA that recognizes the binary languages of

1D spin Hamiltonians

Here we present an LBA that recognizes the binary lan-

guages of 1D spin Hamiltonians LbinH

, thereby showing that

LbinH∈ L1 and completing the proof of Proposition 16. This

LBA will be based on the one of Appendix B. Its specifica-

tions are given by

• States Q = Qvalidate ∪ Qcollect ∪ Qcompare ∪

{Accept,Reject}

• Input alphabet Σ = Σq ∪ {⊥, ⋄, ⊢}

• Tape alphabet Γ = Γ′ ∪ {‡L, ‡R} where Γ′ = Σ∪Σ′q ∪ {⊔}

• Blank Symbol ⊔ ∈ Γ

• Left and right endmarker ‡L, ‡R ∈ Γ

• Transition function δ

• Start state Start ∈ Qvalidate

• Accept state Accept ∈ Q

• Reject state Reject ∈ Q.

To present this LBA, we need to define binary addition ⊕ as

⊕ : {0, 1}∗ × {0, 1}∗ → {0, 1}∗

(α, β) 7→ b(b−1(α) + b−1(β))

where b−1 is the inverse of the binary encoding given in Defi-

nition 14,

b−1 : {0, 1}∗ → N

c1 . . . cm 7→

m∑

l=1

cl2l−1.

As in the construction for 2D Hamiltonians we split the pre-

sentation of the LBA in several steps. The first two steps vali-

date the input to ensure there are no unexpected symbols and

collect interacting spins to determine the amount of energy as-

sociated to each local interaction. Both these steps are already

discussed in Appendix B for the 2D case, so we refer there

for an explicit implementation. Instead we focus on the third

step, which compares the energy of the local interactions to

the energy on the tape.

The energy comparison step consists of the states

Qcompare = {CheckEnergy}

∪ {SubtractBinaryα | α ∈ {0, 1}i

and 0 ≤ i < ⌊log2 maxβ∈Σk

q

h′(β))⌋},

and the transitions given in Table 4. For each local interac-

tion, the collecting spin step transitions into SubtractBinaryα,

where α is the binary representation of the energy of the inter-

action. The SubtractBinaryα states then perform binary sub-

traction. The energy in the state of the head is subtracted bit-

wise from the energy on the tape, adding carried bits back into

α by binary addition. If there is no more energy on the tape

Comparing binary energies

q ∈ Q a ∈ Γ δ(q, a)

SubtractBinaryα, α , ε ∗ ∈ Γ \ {0, 1,⊥} (SubtractBinaryα, ∗,R)

SubtractBinaryα, α , ε ⊥ (Reject,⊥, L)

SubtractBinary0α ∗ ∈ {0, 1} (SubtractBinaryα, ∗,R)

SubtractBinary1α 1 (SubtractBinaryα, 0,R)

SubtractBinary1α 0 (SubtractBinaryα⊕1, 1,R)

SubtractBinaryε ∗ ∈ Γ (NextInteraction, ∗, L)

CheckEnergy ∗ ∈ Γ \ {1,⊥} (CheckEnergy, ∗,R)

CheckEnergy 1 (Reject, 1,R)

CheckEnergy ⊥ (Accept,⊥, L)

TABLE 4. Transitions of an LBA for comparing energies of local

interactions to binary energy written on the tape. Binary subtraction

is performed by the Head to subtract the contribution of each local

interaction from the energy written on the tape. This is accomplished

bit-wise, with carried bits added back into the internal state via binary

addition.

to subtract, the automaton rejects. Otherwise, after finishing

subtracting it transitions into NextInteraction ∈ Qcollect to con-

sider the next interaction.

Once all interactions have been considered, the automaton

transitions into CheckEnergy. The tape is checked for the

symbol 1, which corresponds to leftover energy. If there is no

energy left on the tape the automaton accepts, otherwise the

input is rejected.

Appendix B: An LBA that recognizes the languages of 2D spin

Hamiltonians

Here we construct an LBA that recognizes LH ∈ L2D,

thereby proving that LH ∈ L1 and completing the proof of

Theorem 27. The flowchart for this LBA is presented in

Fig. 10. We first present the basic properties of this LBA and

then present the main steps in subsections 1, 2, 3 and 4.

The LBA is described by

• States Q = Qrows ∪ Qvalidate ∪ Qcollect ∪ Qcompare ∪

{Accept,Reject}

• Input alphabet Σ = Σq ∪ {¬,⊥, ⋄, ⊢}

• Tape alphabet Γ = Γ′ ∪ {‡L, ‡R} where Γ′ = Σ ∪ Σ′q ∪

Σ′′q ∪ {⊔}

• Blank Symbol ⊔ ∈ Γ

• Left and right endmarker ‡L, ‡R ∈ Γ

• Transition function δ as specified by Tables 5 to 8

• Start state CountFirstRow ∈ Qrows

• Accept state Accept ∈ Q

• Reject state Reject ∈ Q

First note that the tape alphabet of the automaton not only

includes the spin alphabet Σq, but also Σ′q and Σ′′q . These are

copies of the spin alphabet where each spin symbol is marked

by a prime or double prime, and they are used by the automa-

ton to earmark selected spins in the configuration. This is used

to navigate the spin configuration during the computation.

Page 21: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

21

Check

row length

Validate

inputstart

Collect

interacting

spins

Compare

energyreject accept

uniform

non-uniform

valid

invalid

repeat ∀ interactions

different same

FIG. 10. Scheme for an LBA recognizing the language of a 2D

spin Hamiltonian. Initially the input string is checked for uniform

row length (Appendix B.1) and then for unexpected characters (Ap-

pendix B.2). For every spin interaction, the automaton reads all

interacting spins and calculates the energy of the interaction (Ap-

pendix B.3). It overwrites the corresponding amount of energy sym-

bols ⋄ from the tape, and rejects if there are none left to overwrite.

Afterwards the tape is scanned for any leftover ⋄ (Appendix B.4),

and if there are none it accepts.

Further note that for the sake of simplicity we split the tran-

sition table and set of states into four different parts as de-

picted in Fig. 10. In the following we go over every part and

explain the workings of the automaton in detail.

1. Checking the row length

In the first step it is ensured that the rows of the spin con-

figuration given in the input are all of equal length. This is

achieved by counting the spins in every row in parallel and re-

jecting if one row is either longer or shorter than the first. This

step is implemented via the states

Qrows = {CountFirstRow,AdvanceRow,CountRow,

BackToStart,CompareLengths}

as well as the transitions given in Table 5. Note that some com-

binations of current state and symbol are omitted in this table,

as we go by the convention that any such omitted transitions

lead to the Reject state.

The automaton initially starts in state CountFirstRow,

marking the first spin of the configuration with a prime. It tran-

sitions into AdvanceRow which moves the head to the next

row of spins, and then CountRow which marks the first un-

primed spin it encounters there with a prime. This continues

until one spin of every row has been marked and ⊥ is read, at

which point BackToStart is entered, which moves the head to

the beginning of the input and starts over with CountFirstRow.

This way, with each cycle between these states, one spin of ev-

ery row is marked with a prime.

Once all spins in the first row have been marked,

CountFirstRow encounters the first row delimiting symbol, at

Checking row length

q ∈ Q a ∈ Γ δ(q, a)

CountFirstRow s ∈ Σq (AdvanceRow, s′,R)

CountFirstRow s′ ∈ Σ′q (CountFirstRow, s′,R)

CountFirstRow ∗ ∈ {¬, ⊢} (CompareLengths, ∗,R)

AdvanceRow s ∈ Σq (AdvanceRow, s,R)

AdvanceRow ¬ (CountRow,¬,R)

AdvanceRow ⊢ (BackToStart, ⊢, L)

CountRow s′ ∈ Σ′q (CountRow, s′,R)

CountRow s ∈ Σq (AdvanceRow, s′,R)

CountRow ∗ ∈ {¬, ⊢} (Reject, ∗,R)

BackToStart ∗ ∈ Γ′ (BackToStart, ∗, L)

BackToStart ‡L (CountFirstRow, ‡L,R)

CompareLengths ∗ ∈ Γ′ \ Σq (CompareLengths, ∗,R)

CompareLengths s ∈ Σq (Reject, s,R)

CompareLengths ‡R (q‡R , ‡R, L)

TABLE 5. Transitions of an LBA for validating that a 2D spin con-

figuration given as input has equal row length. By making use of the

primed spin alphabet Σ′q the automaton counts the spins in all rows of

the configuration in parallel, marking them with a prime. If there is

any unmarked spin left after the first row is done being counted, or if

any other row is done counting before the first, the input is rejected.

Otherwise, the head moves to the end of the input and into the state

q‡R, continuing with the transitions shown in Table 6.

which point it enters the state CompareLengths and the entire

remaining input is scanned for unprimed spin symbols. If any

are encountered, the input is rejected as the rows are not of

uniform length. Additionally, if at any point during the previ-

ous transition cycles there were no spins left to prime in any

row, the input is also rejected. Otherwise, the right endmarker

‡R at the end of the input is encountered, and the automaton

moves on to the next phase, where the input is checked for

unexpected symbols.

2. Validating the input

In this step the automaton checks the input for unexpected

symbols and rejects if any are found. For example, an energy

symbol ⋄ in the spin configuration part of the input, or delim-

iters in the wrong places would cause the input to be rejected.

This step is implemented via the states

Qvalidate = {qs, q¬, q⊥, q⊢, q‡L, q‡R}

and the transitions are given by Table 6. Starting from the end

of the input the automaton moves its head to the beginning and

checks for unexpected symbols, by keeping track of the last

symbol encountered in its state. Further, all the marked spins

from the previous step are overwritten with their unmarked

counterparts.

After encountering the left endmarker ‡L the entire input

has been validated against unexpected symbols. The automa-

ton moves to the next step by again marking the first spin in

the configuration with a prime and transitioning into the state

RowEnd.

Page 22: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

22

Validating input

q ∈ Q a ∈ Γ δ(q, a) q ∈ Q a ∈ Γ δ(q, a)

q‡R⊥ (q⊥,⊥, L) qs ¬ (q¬,¬, L)

q⊥ ⋄ (q⊥, ⋄, L) qs ‡L (q‡L, ‡L,R)

q⊥ ⊢ (q⊢, ⊢, L) q¬ s′ ∈ Σ′q (qs, s, L)

q⊢ s′ ∈ Σ′q (qs, s, L) q‡Ls ∈ Σq (RowEnd, s′,R)

qs s′ ∈ Σ′q (qs, s, L)

TABLE 6. Transitions for validating the input of an LBA corre-

sponding to a 2D spin Hamiltonian. Starting from the end, primes

placed on the spins by the previous step are removed and the input

is checked for unexpected symbols. If none are encountered, the au-

tomaton marks the first spin of the input with a prime and transitions

to the state SeekEnd ∈ Qgather, continuing with the transitions shown

in Table 7.

3. Collecting interacting spins

This step determines the energy associated to the interac-

tion of a k-by-k square subconfiguration of the input and is al-

ternated with the energy comparison step until all interactions

have been considered. It is implemented via the states

Qcollect = {RowEnd,Return} ∪ {MarkSpini | 0 ≤ i < k}

∪ {NextRowi | 0 ≤ i < k}

∪ {CollectSpinsαi, j | 0 ≤ i ≤ k and 0 ≤ j < k

and α ∈ ({x} ∪ Σq)k2−i− jk},

where the indices i, j, α are used to index a multiplicity of

states. The transitions of this step are given in Table 7.

Continuing from the previous step the head of the automa-

ton starts to the right of a spin marked with a prime, this spin

marks the bottom right corner of the square interaction which

is currently being determined. We refer to this spin in the fol-

lowing as the interaction spin, and similarly to the row it is

part of as the interaction row. All other spins are unmarked.

Beginning in the state RowEnd the head moves to the right

until it reaches the end of the interaction row, signalled by ei-

ther of the delimiters ¬ or ⊥, where it switches to the state

MarkSpink−1.

Next the automaton tries to identify which spins fall into the

interacting square subconfiguration. This is accomplished by

marking the rightmost unmarked spin of k rows with a double

prime, beginning with the interaction row and continuing left.

This is repeated until the interaction spin in the interaction

row is encountered. Once the interaction spin is reached, the

spins to the right of the subconfiguration in each row will be

marked with a double prime making it possible to find the

subconfiguration spins by skipping over the marked ones.

This behaviour is implemented via the MarkSpini,

NextRowi and Return states. MarkSpini moves the head to

the left, skipping over double primed spins until encountering

an unmarked one. This spin is then marked with a double

prime and the state changes to NextRowi, which continues to

the left until encountering a delimiter signalling the start of an-

other row, at which point the state transitions to MarkSpini−1.

The index i keeps track of how many more rows need to be

marked. Once MarkSpin0 marks a spin the automaton transi-

tions into Return and moves back to the start of the current

row instead of continuing. Similarly, if NextRowi encounters

the left endmarker ‡L it transitions to Return, because the sub-

configuration extends beyond the input configuration.

After returning to the end of the current row the process

repeats. This continues until MarkSpink−1 encounters the

interaction spin s—distinguished by being marked with a

single prime—at which point the automaton transitions to

CollectSpinssk−1,k−1.

The purpose of the CollectSpinsαi, j states is to visit all the

spins in the subconfiguration on the tape and store them in α,

building a representation of the subconfiguration in the inter-

nal state of the automaton. The index i keeps track of how

many more spins of a row still need to be collected, and j

keeps track of how many more rows there are to visit. While

i > 0, j > 0 the head moves to the left, skipping over double

primed spins and prepending any unmarked spins it reads to

α, decrementing i for each spin collected in this manner. For

i = 0 the head continues moving to the left, but stops collect-

ing spins. Whenever the row delimiter ¬ is encountered α is

prepended by the string xi, j is decremented, and i is set to

k. In the cases where i , 0 the string xi is non-empty and

corresponds to i spins missing from the current row, other-

wise x0 = ε and α remains unchanged. As explained in ear-

lier sections, this serves to model open boundary conditions

in the cases where the subconfiguration extends beyond the

input configuration.

This step ends once both i = 0 and j = 0, α now contain-

ing k2 spins collected from k consecutive rows. The automa-

ton transitions to the state SubtractEnergyh′(α) and proceeds

to the energy comparison step. The index of the state corre-

sponds to the energy of the square interaction. If instead the

head encounters the left endmarker before collecting all spins

it transitions to SubtractEnergyh′(xi+ jkα), which accounts for i

spins from the current row, as well as j complete rows miss-

ing.

4. Comparing energy

This step determines if the energy of the spin configuration

and the energy given as part of the input match. It is alter-

nated with the collecting spins step until all interactions have

been considered, at which point the tape is checked for any

remaining energy and the automaton either accepts or rejects

the input. It is implemented via the states

Qcompare = {NextInteraction,CheckEnergy,CleanUp,

ClearRow}

∪ {SubtractEnergyi | 0 ≤ i ≤ maxβ∈Σk2

q

h′(β)},

and the transitions given in Table 8.

Continuing from the previous step the automaton is in the

state SubtractEnergyi, where i corresponds to the energy de-

termined from the previously collected spins. This energy is

next subtracted from the energy written on the tape as part of

the input. To achieve this the head moves to the right, skipping

Page 23: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

23

Collecting interacting spins

q ∈ Q a ∈ Γ δ(q, a)

RowEnd ∗ ∈ Σq ∪ Σ′′q (RowEnd, ∗,R)

RowEnd ∗ ∈ {¬, ⊢} (MarkSpink−1, ∗, L)

MarkSpini s′′ ∈ Σ′′q (MarkSpini, s′′, L)

MarkSpini, i > 0 s ∈ Σq (NextRowi, s′′, L)

MarkSpini, i = 0 s ∈ Σq (Return, s′′,R)

MarkSpink−1 s′ ∈ Σ′q (CollectSpinssk−1,k−1, s

′, L)

NextRowi ∗ ∈ Γ′ \ {¬} (NextRowi, ∗, L)

NextRowi ¬ (MarkSpini−1,¬, L)

NextRowi ‡L (Return, ‡L,R)

Return ∗ ∈ Γ′ \ Σ′q (Return, ∗,R)

Return s′ ∈ Σ′q (RowEnd, ∗,R)

CollectSpinsαi, j, i > 0 s ∈ Σq (CollectSpinssαi−1, j, s, L)

CollectSpinsα0, j, j > 0 s ∈ Σq (CollectSpinsα0, j, s, L)

CollectSpinsαi, j s′′ ∈ Σq (CollectSpinsαi, j, s′′, L)

CollectSpinsαi, j, j > 0 ¬ (CollectSpinsxiαk, j−1,¬, L)

CollectSpinsαi,0 ¬ (SubtractEnergyh′(xiα),¬,R)

CollectSpinsα0,0 ∗ ∈ Γ′ (SubtractEnergyh′(α), ∗,R)

CollectSpinsαi, j ‡L (SubtractEnergyh′(xi+ jkα), ‡L,R)

TABLE 7. Transitions of an LBA for gathering all spins involved in

an interaction of a 2D spin Hamiltonian. The states with indices in

this table correspond to multiple different states as indexed by 0 ≤

i, j < k, or by a string α ∈⋃k2

i=1(Σq ∪ {x})i. By making use of the

prime spin alphabets Σ′q,Σ′′q the automaton navigates the lattice to

find all spins in a k-by-k square and stores them in its internal state as

α. Open boundary conditions are handled by prepending α with the

symbol x, indicating missing spins, when the edges of the lattice are

encountered. Once all interacting spins have been collected, the LBA

transitions into a state SubtractEnergyi, where i is the energy of this

particular interaction, and continues with the transitions in Table 8.

over spins and delimiters. Once the head reaches the energy

section of the tape, the automaton begins overwriting energy

symbols ⋄ by the blank symbol ⊔ one by one, decrementing

i each time. If the end of input symbol ⊥ is read then there

are no more ⋄ on the tape to overwrite, meaning the energy

written on the tape does not match the energy of the spin con-

figuration, causing the automaton to reject the input.

As soon as SubtractEnergy0 is reached, exactly as many

energy symbols as determined in the spin collection step have

been overwritten. The head now moves back to the left, skip-

ping over everything until the left endmarker is read. The

automaton transitions to CleanUp, which moves the head

to the right until the interaction spin is encountered. The

double primes on the marked spins from the previous step

are removed. Once the interaction spin is read, it is re-

placed with a regular unprimed spin and the head transitions

to NextInteraction to determine the next interaction spin. It

moves to the right until encountering a spin s which is marked

with a prime as the new interaction spin, and the automaton

transitions to the state RowEnd, restarting the spin collection

step. If it encounters a double primed spin it instead transi-

tions to ClearRow. ClearRow removes the remainder of the

double primes in the row and then transitions to MarkSpink−1

to restart the spin collection. If the end of the spin configu-

ration ⊢ is encountered by NextInteraction, all spins have al-

ready been considered as interaction spins and the automaton

Comparing energy

q ∈ Q a ∈ Γ δ(q, a)

SubtractEnergyi, i > 0 ∗ ∈ Γ′ \ {⋄,⊥} (SubtractEnergyi, ∗,R)

SubtractEnergyi, i > 0 ⋄ (SubtractEnergyi−1,⊔,R)

SubtractEnergyi, i > 0 ⊥ (Reject,⊥,R)

SubtractEnergy0 ∗ ∈ Γ′ (SubtractEnergy0 , ∗, L)

SubtractEnergy0 ‡L (CleanUp, ‡L,R)

CleanUp ∗ ∈ Σq ∪ {¬} (CleanUp, ∗,R)

CleanUp s′′ ∈ Σ′′q (CleanUp, s,R)

CleanUp s′ ∈ Σ′q (NextInteraction, s,R)

NextInteraction s ∈ Σq (RowEnd, s′,R)

NextInteraction s′′ ∈ Σ′′q (ClearRow, s′,R)

NextInteraction ¬ (NextInteraction,¬,R)

NextInteraction ⊢ (CheckEnergy, ⊢,R)

ClearRow s′′ ∈ Σ′′q (ClearRow, s,R)

ClearRow ∗ ∈ {¬, ⊢} (MarkSpink−1, s, L)

CheckEnergy ⊔ (CheckEnergy,⊔,R)

CheckEnergy ⋄ (Reject, ⋄,R)

CheckEnergy ⊥ (Accept,⊥, L)

TABLE 8. Transitions of an LBA for comparing the energy of a

spin configuration as calculated by the automaton with the energy

given in the input. The states SubtractEnergyi overwrite i energy

symbols from the tape, where the i corresponds to the energy of a

particular interaction. If there are no more symbols left to overwrite,

or if there are still some left on the tape after all interactions have

been considered, the input is rejected. Conversely, if the amount of

symbols overwritten after all interactions is exactly the amount of

symbols initially in the input, the input is accepted.

transitions to CheckEnergy.

CheckEnergy tests if there are any energy symbols ⋄ re-

maining on the tape. The head is moved to the right skipping

over everything until ⋄ or ⊥ is read. If ⋄ is read, there are

still energy symbols remaining on the tape, meaning that the

energy given as part of the input does not match the energy

of the given spin configuration and the automaton rejects the

input. If instead ⊥ is read, there are no ⋄ left on the tape,

meaning the input energy and the spin configuration energy

match exactly and the automaton accepts. This concludes our

construction of a linear bounded automaton which recognizes

LH ∈ L2D, proving LH ∈ L1.

Appendix C: An LBA that recognizes the languages of

unbounded 1D spin Hamiltonians

Here we present an LBA that recognizes the languages of

unbounded 1D spin Hamiltonians LunboundH

, thereby showing

that LunboundH

∈ L1 and completing the proof of Proposition 37.

This LBA will be based on the one of Appendix B. Its specifi-

cations are given by

• States Q = Qvalidate ∪ Qevaluate ∪ {Accept,Reject}

• Input alphabet Σ = Σq ∪ {⊥, ⋄, ⊢}

• Tape alphabet Γ = Γ′ ∪ {‡L, ‡R} where Γ′ = Σ ∪

(⋃r

i=1 Σ(i)q ) ∪ {⊔}

• Blank Symbol ⊔ ∈ Γ

• Left and right endmarker ‡L, ‡R ∈ Γ

Page 24: arXiv:2006.03529v2 [cond-mat.stat-mech] 19 Jun 2020 · 3 guage associated to local 1D spin Hamiltonians is determin-istic context-free, and that if the energy is encoded in binary

24

Evaluate unbounded interactions

q ∈ Q a ∈ Γ δ(q, a)

SelectSpini, i > 0 s ∈ Σq (SelectSpini−1, ∗,R)

SelectSpini, r > i > 0 ⊢ (ClearSpini+1, ⊢, L)

SelectSpin0 ∗ ∈ Γ (PrepareCollection, ∗, L)

SelectSpinr ⊢ (CheckEnergy, ⊢,R)

ClearSpini ∗ ∈ Γ \ Σ(i)q (ClearSpini, ∗, L)

ClearSpini s(i) ∈ Σ(i)q (SelectSpini, s,R)

PrepareCollection ∗ ∈ Γ \ {‡L} (PrepareCollection, ∗, L)

PrepareCollection ‡L (CollectSpinsεr , ‡L,R)

CollectSpinsαi , i > 0 s ∈ Σq (CollectSpinsαi , s,R)

CollectSpinsαi , i > 0 s(i) ∈ Σ(i)q (CollectSpinsαs

i−1, s(i),R)

CollectSpins0α ∗ ∈ Γ (SubtractEnergyu(h′(α)), ∗,R)

SubtractEnergyi, i > 0 ∗ ∈ Γ \ {⋄,⊥} (SubtractEnergyi, ∗,R)

SubtractEnergyi, i > 0 ⋄ (SubtractEnergyi−1,⊔,R)

SubtractEnergyi, i > 0 ⊥ (Reject,⊥,R)

SubtractEnergy0 ∗ ∈ Γ \ Σ(i)q (SubtractEnergy0 , ∗, L)

SubtractEnergy0 s(1) ∈ Σ(1)q (SelectSpin1 , s,R)

CheckEnergy ⊔ (CheckEnergy,⊔,R)

CheckEnergy ⋄ (Reject, ⋄,R)

CheckEnergy ⊥ (Accept,⊥, L)

TABLE 9. Transitions of an LBA for evaluating if the energy of a

given spin configuration of a unbounded 1D Hamiltonian matches

the energy written on the tape. Starting at the leftmost spin in the

state SelectSpinr , each group of r interacting spins is considered

separately. For each of these interactions the corresponding amount

of energy is overwritten from the tape. If the sum of the energies

from all interactions matches the energy on the tape, the automaton

accepts, otherwise it rejects the input.

• Transition function δ

• Start state Start ∈ Qvalidate

• Accept state Accept ∈ Q

• Reject state Reject ∈ Q

Note that here we let the tape alphabet contain r distinguish-

able copies Σ(i)q of the spin alphabet Σq. As in the 2D construc-

tion, they are used to earmark certain positions in the spin

configuration.

Similar to the construction in Appendix B, we split the

states and transitions of the automaton across two steps. The

first step serves to validate the input, ensuring that there are

no unexpected symbols. This is functionally identical to the

validating step presented in Appendix B.2, so we refer there

for a concrete implementation.

The second step considers all groups of interacting spins

and compares their energy with what is given in the input. It

is implemented by the states

Qevaluate = {PrepareCollection,CheckEnergy}

∪ {SelectSpini | 0 ≤ i ≤ r}

∪ {ClearSpini | 0 < i ≤ r}

∪ {CollectSpinsαi | 0 ≤ i ≤ r and α ∈ Σr−iq }

∪ {SubtractEnergyi | 0 ≤ i ≤ maxβ∈Σk

q

h(β)}

and the transitions given in Table 9. It is initiated after the

string has been validated by the first step, and begins with the

head in state SelectSpinr positioned at the leftmost spin.

In the evaluating step all combinations of r interacting

spins are considered sequentially. The PrepareCollection,

SelectSpini, and ClearSpini states serve to select the next

set of interacting spins. This is accomplished by overwrit-

ing them on the tape with the corresponding symbol from

the duplicated spin alphabets Σ(i)q . Once r spins have been

marked this way, the head reads the spin configuration in the

CollectSpinsαi states, where α is used to store the interacting

spins as part of the internal state of the head.

Once all r spins are collected, the automaton transitions to

the SubtractEnergyi states, specifically SubtractEnergyh′(α).

In these states the head moves to the energy written on the

tape and overwrites a total of h′(α) energy symbols from the

tape with ⊔. If there are no ⋄ left to overwrite at any point the

automaton rejects, since the energy of the spin configuration

does not match the energy on the tape. Otherwise the proce-

dure is repeated for the next interaction of r spins.

After considering all interactions the head transitions into

the state CheckEnergy. The tape is scanned for any leftover

⋄, and if there are none, the automaton accepts. Otherwise it

rejects the input.


Recommended