← Eyal Merhavi · Labelings, models, and gauge theory

Chapter 5 of Labelings, models, and gauge theory, rendered from the executed notebook. Code cells and their outputs are shown as they ran.

Run this chapter in your browser ↗ · Source on GitHub ↗
Runs on JupyterLite. The first time, it downloads Python and its libraries (about 40 MB).

Chapter 5 — Layers and the transfer matrix: dynamics from a distribution

So far a model has been a single, static object: one probability distribution over whole labelings of a board. Nothing in it "happens". There is no before and after.

Now take a board shaped like a stack of rings: a cylinder. Cut it into its rings, one layer at a time, and ask a modest question: if I know the labels on one ring, what do I know about the next one? The answer turns out to be one matrix. Its eigenvalues are numbers you can also measure by sampling the model and watching how quickly two rings forget each other. And on the simplest boards, the ring's loop product does nothing more than a random walk on the group.

This chapter is the bridge of the course. On one side is "a model is a distribution". On the other side is a vector space with an operator acting on it, which physicists would recognize as a quantum system. We will build that operator from the distribution, never assume it.

What you'll learn

Prerequisites: chapters 1–4. From linear algebra: eigenvalues of symmetric matrices. From probability: Markov chains.

import itertools
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from scipy.linalg import circulant
from scipy.optimize import minimize_scalar
from scipy.special import ive

from lgt import *
from lgt import viz
from lgt.grid import GridModel

viz.use_style()
rng = np.random.default_rng(5)

5.1 Cutting a board into layers

Take a grid with WW columns and NN rows and wrap it around in both directions. Each row is now a ring of WW vertices. We call the rows layers V0,V1,…,VN−1V_0,V_1,\dots,V_{N-1}, with layer indices taken mod NN, so layer NN is layer 00 again (glossary 5.2).

Every edge is one of two kinds:

Every face is a square with two layer edges (one in layer kk, one in layer k+1k+1) and two step edges. So the faces sit between consecutive layers, in a band we call a slab. A layer labeling (glossary 5.5) is the restriction of a labeling UU to the WW layer edges of one layer: an element a∈Ω:=GWa\in\Omega:=G^{W}.

If you ignore the wrap-around in the vertical direction, the board looks like a cylinder: rings stacked on top of each other, joined by step edges. Below, one layer is drawn in teal and the step edges above it in gold. (Time wraps around too, so the top ring is glued back to the bottom one.)

def draw_cylinder(ax, W, N, layer=2):
    ang = 2 * np.pi * np.arange(W + 1) / W
    for k in range(N):
        c = viz.TEAL if k == layer else viz.INK
        ax.plot(np.cos(ang), np.sin(ang), k, color=c, lw=3 if k == layer else 1.2)
        ax.scatter(np.cos(ang[:W]), np.sin(ang[:W]), k, color=viz.INK, s=10)
        if k < N - 1:
            for x in range(W):
                c = viz.GOLD if k == layer else viz.MUTED
                ax.plot([np.cos(ang[x])] * 2, [np.sin(ang[x])] * 2, [k, k + 1], color=c,
                        lw=2.5 if k == layer else 0.8)
    ax.set_box_aspect((1, 1, 1.4)); ax.set_axis_off()

fig = plt.figure(figsize=(5, 5.5))
draw_cylinder(fig.add_subplot(projection="3d"), W=8, N=6)
plt.show()
A board drawn as a stack of 6 rings of 8 vertices each, joined by vertical step edges. One ring, layer 2, is teal, and the step edges from it to the next ring are gold.

Each ring (black) is a layer; the vertical segments are step edges. The teal ring is layer 2, and the gold step edges lead from it to layer 3.

Symmetries. A symmetry of a board (glossary 5.1) is a bijection of the vertices that maps edges to edges and faces to faces. The total cost only looks at face products, so a symmetry of the board is automatically a symmetry of every model on it. Our board has two that matter:

Let's check both with a few lines of code, together with a bijection that is not a symmetry.

def is_symmetry(board, vmap):
    edges = lambda m: sorted(tuple(sorted((m[s], m[t]))) for s, t in board.edges.tolist())
    faces = lambda m: sorted(tuple(sorted({m[v] for v in board.walk_vertices(f)})) for f in board.faces)
    ident = list(range(board.n_vertices))
    return edges(vmap) == edges(ident) and faces(vmap) == faces(ident)

W, N = 4, 6
B = Board.grid(W, N, periodic=True)                    # vertex (x, k) has index x + W*k
vid = lambda x, k: (x % W) + W * (k % N)
shift = [vid(x, k + 1) for k in range(N) for x in range(W)]
flip = [vid(x, -k) for k in range(N) for x in range(W)]
twist = [vid(-x if k == 0 else x, k) for k in range(N) for x in range(W)]  # mirror layer 0 only
print("shift:", is_symmetry(B, shift), "  flip:", is_symmetry(B, flip), "  twist:", is_symmetry(B, twist))
shift: True   flip: True   twist: False

Why do we care? Because of the shift, every slab looks exactly like every other slab. Whatever rule tells us how layer kk constrains layer k+1k+1, it is the same rule for every kk, just like a time-homogeneous Markov chain uses the same transition matrix at every step. The flip will give that rule a special shape (sections 5.4 and 5.6).

Recap. A layered board splits its vertices into layers V0,…,VN−1V_0,\dots,V_{N-1}. Layer edges stay inside a layer, step edges go from one layer to the next, and every face lives in the slab between two consecutive layers. The shift and the flip are symmetries of the board, hence of every model on it.

Check yourself

  1. On the W×NW\times N torus, how many layer edges, step edges and faces are there in total?
Answer

WNWN layer edges (WW per layer), WNWN step edges (WW per slab) and WNWN faces (WW per slab).

  1. Why is "mirror only layer 0" not a symmetry?
Answer

It keeps layer 0's ring intact, but the step edge from (x,0)(x,0) to (x,1)(x,1) is sent to a pair (−x,0)(-x,0), (x,1)(x,1), which is not an edge unless x≡−xx\equiv-x.

5.2 The transfer matrix

This section builds one matrix, TT, that contains the whole model on the stack. We get there in three small steps: a toy chain, one slab of our board, and then the matrix itself.

Warm-up: a sum over sequences is a matrix power

Forget boards for a moment. Suppose you have a finite set of states Ω\Omega and a table of nonnegative weights K(a,b)K(a,b), one for every ordered pair of states. Give a sequence of states a0,a1,…,ata_0,a_1,\dots,a_t the weight

K(a0,a1)K(a1,a2)⋯K(at−1,at). K(a_0,a_1)\,K(a_1,a_2)\cdots K(a_{t-1},a_t).

If KK were a table of transition probabilities, this would be the probability of a path of a Markov chain. Here it is just a weight. Now fix the two ends a0a_0 and ata_t and add up the weights of all sequences in between. For t=2t=2 this sum is

∑a1∈ΩK(a0,a1)K(a1,a2), \sum_{a_1\in\Omega}K(a_0,a_1)\,K(a_1,a_2),

which is exactly the (a0,a2)(a_0,a_2) entry of the matrix product K⋅KK\cdot K. By the same reasoning, summing over all the states in between, for sequences of length tt, gives the entry (Kt)(a0,at)(K^t)(a_0,a_t) of the tt-th matrix power. This is the same fact you use when you compute tt-step probabilities of a Markov chain, or count walks of length tt in a graph with powers of its adjacency matrix.

One more twist. If the sequence is cyclic, meaning it must end where it started (at=a0a_t=a_0), then adding up over a0a_0 as well gives ∑a0(Kt)(a0,a0)\sum_{a_0}(K^t)(a_0,a_0), the trace tr⁡Kt\operatorname{tr}K^t. Let's check both statements by brute force on a two-state example.

K = np.array([[3.0, 1.0],
              [1.0, 2.0]])                      # weights between two states, called 0 and 1
t_len = 4
seqs = list(itertools.product([0, 1], repeat=t_len + 1))
open_sum = sum(np.prod([K[s[i], s[i + 1]] for i in range(t_len)]) for s in seqs if (s[0], s[-1]) == (0, 1))
cyclic = sum(np.prod([K[s[i], s[i + 1]] for i in range(t_len)]) for s in seqs if s[0] == s[-1])
Kt = np.linalg.matrix_power(K, t_len)
print(f"sequences 0 -> ... -> 1 of length 4: brute force {open_sum:.0f}, matrix power entry {Kt[0, 1]:.0f}")
print(f"cyclic sequences of length 4:        brute force {cyclic:.0f}, trace of K^4 {np.trace(Kt):.0f}")
sequences 0 -> ... -> 1 of length 4: brute force 75, matrix power entry 75
cyclic sequences of length 4:        brute force 175, trace of K^4 175

Matrix powers are a compact way to add up exponentially many products. Now we show that our model on the stack is a weighted sequence of this kind, with states = layer labelings.

One slab

Look at the slab between layer kk and layer k+1k+1 of the W×NW\times N torus. It contains:

Here is a slab with W=3W=3, unrolled flat, the dashed column being column 0 again.

def draw_slab(ax, W=3):
    for x in range(W):
        ax.annotate("", xy=(x + 1, 0), xytext=(x, 0), arrowprops=dict(arrowstyle="-|>", color=viz.TEAL, lw=2.2))
        ax.annotate("", xy=(x + 1, 1), xytext=(x, 1), arrowprops=dict(arrowstyle="-|>", color=viz.CORAL, lw=2.2))
        ax.annotate("", xy=(x, 1), xytext=(x, 0), arrowprops=dict(arrowstyle="-|>", color=viz.GOLD, lw=2.2))
        ax.text(x + 0.5, -0.13, f"$a_{x}$", ha="center", va="top", fontsize=13, color=viz.TEAL)
        ax.text(x + 0.5, 1.13, f"$b_{x}$", ha="center", va="bottom", fontsize=13, color=viz.CORAL)
        ax.text(x - 0.07, 0.72, f"$s_{x}$", ha="right", va="center", fontsize=13, color=viz.GOLD)
        ax.add_patch(plt.Rectangle((x + 0.08, 0.08), 0.84, 0.84, color=viz.PALE, zorder=0))
        ax.text(x + 0.55, 0.35, f"face {x}", ha="center", va="center", fontsize=10, color=viz.MUTED)
    ax.plot([W, W], [0, 1], ls="--", color=viz.GOLD, lw=2)
    ax.text(W + 0.08, 0.5, "$s_0$ again", ha="left", va="center", fontsize=11, color=viz.GOLD)
    ax.text(-0.9, 0.0, "layer $k$", ha="right", va="center", fontsize=11)
    ax.text(-0.9, 1.0, "layer $k+1$", ha="right", va="center", fontsize=11)
    ax.scatter(*np.meshgrid(np.arange(W + 1), [0, 1]), color=viz.INK, zorder=5, s=25)
    ax.set_xlim(-2.4, W + 1.2); ax.set_ylim(-0.45, 1.45); ax.set_aspect("equal"); ax.axis("off")

fig, ax = plt.subplots(figsize=(7, 3))
draw_slab(ax)
plt.show()
A slab with W equal to 3, unrolled flat: layer k on the bottom with edges a0, a1, a2, layer k plus 1 on top with edges b0, b1, b2, vertical step edges s0, s1, s2, and faces 0, 1, 2 between them. A dashed gold line on the right is s0 again.

Every face of the board lies in exactly one slab, and a face in this slab involves only aa, bb and ss. So the total cost splits into slab costs, and the weight e−βS(U)e^{-\beta S(U)} splits into a product of slab weights:

e−βS(U)=∏k=0N−1q(ak,sk,ak+1),q(a,s,b)=∏x=0W−1e−βφ(face x)∈ℝ>0. e^{-\beta S(U)}=\prod_{k=0}^{N-1} q(a_k,s_k,a_{k+1}),\qquad q(a,s,b)=\prod_{x=0}^{W-1}e^{-\beta\varphi(\text{face }x)}\ \in\mathbb R_{>0}.

Here q(a,s,b)q(a,s,b) is the slab weight: the weight of one slab whose lower layer carries aa, whose step edges carry ss and whose upper layer carries bb. On the left, ak∈Ωa_k\in\Omega is the whole layer labeling of layer kk and sk∈GWs_k\in G^W the step labels of slab kk. So from now on the subscript tells you what is meant: axa_x with a column index xx is one label of a layer labeling aa; aka_k (or ata_t) with a layer index is the layer labeling of layer kk.

For the coin model (G=ℤ2G=\mathbb Z_2, labels ±1\pm1, which are their own inverses) the face product of face xx is simply axsx+1bxsxa_x\,s_{x+1}\,b_x\,s_x, and φ(f)=1−f\varphi(f)=1-f.

The matrix

The step labels ss of a slab appear in that slab's weight and nowhere else. So we can add them up slab by slab, which leaves a weight that depends only on the two neighboring layer labelings. That is the transfer matrix (glossary 5.6):

T(a,b)=∑s∈GWq(a,s,b),T∈ℝΩ×Ω. T(a,b)=\sum_{s\in G^W}q(a,s,b),\qquad T\in\mathbb R^{\Omega\times\Omega}.

Its rows and columns are indexed by layer labelings. For the coin model with W=3W=3 there are 23=82^3=8 of them, so TT is 8×88\times8. Let's compute one entry by hand first, T(a,b)T(a,b) with a=b=(+1,+1,+1)a=b=(+1,+1,+1). The face products become sxsx+1s_xs_{x+1}, so each face is a defect exactly when sx≠sx+1s_x\neq s_{x+1}. Going through the 8 choices of ss: 2 of them (all equal) give no defects, and the other 6 give exactly 2 defects. Each defect costs φ(−1)=2\varphi(-1)=2, so

T((+,+,+),(+,+,+))=2⋅1+6⋅e−4β. T\big((+,+,+),(+,+,+)\big)=2\cdot1+6\cdot e^{-4\beta}.

def layer_labelings(W):
    """All 2^W coin-model layer labelings, as rows of +-1."""
    return np.array(list(itertools.product([1, -1], repeat=W)))

def coin_transfer_matrix(W, beta):
    A = layer_labelings(W)                      # rows of A also serve as the step labels s
    T = np.zeros((len(A), len(A)))
    for i, a in enumerate(A):
        for j, b in enumerate(A):
            f = a * b * A * np.roll(A, -1, axis=1)          # face x: a_x b_x s_x s_{x+1}, one row per s
            T[i, j] = np.exp(-beta * (1 - f)).prod(axis=1).sum()
    return T

beta = 0.7
T3 = coin_transfer_matrix(3, beta)
print(f"T(+++, +++) from code: {T3[0, 0]:.6f}   by hand: {2 + 6 * np.exp(-4 * beta):.6f}")
T(+++, +++) from code: 2.364860   by hand: 2.364860

The normalizer ZZ is a trace

Recall from chapter 2 what a model needs: a weight e−βS(U)e^{-\beta S(U)} for every labeling, and the total of all weights,

Z=∑Ue−βS(U)∈ℝ>0 Z=\sum_{U}e^{-\beta S(U)}\ \in\mathbb R_{>0}

(for a finite group, summing over all labelings UU). Every probability is a weight divided by ZZ, and every average is a ratio of two such sums. (Chapter 2 divided ZZ by the number of labelings, to compare with the uniform distribution. That changes ZZ by a constant factor, which cancels from every probability.)

Computing ZZ by brute force means visiting all |G||E||G|^{|E|} labelings. The transfer matrix replaces this with a matrix power, in three steps.

Step 1: organize the sum by layers and slabs. A labeling of the stack is the same thing as a list of NN layer labelings a0,…,aN−1a_0,\dots,a_{N-1} together with NN lists of step labels s0,…,sN−1s_0,\dots,s_{N-1}. Its weight is a product of slab weights, with aN=a0a_N=a_0 because the stack wraps around:

Z=∑a0,…,aN−1∑s0,…,sN−1q(a0,s0,a1)q(a1,s1,a2)⋯q(aN−1,sN−1,a0). Z=\sum_{a_0,\dots,a_{N-1}}\ \sum_{s_0,\dots,s_{N-1}}\ q(a_0,s_0,a_1)\,q(a_1,s_1,a_2)\cdots q(a_{N-1},s_{N-1},a_0).

Step 2: sum out the step labels. The labels sks_k appear in factor kk and in no other factor, so their sum can be done inside that factor, and it gives T(ak,ak+1)T(a_k,a_{k+1}) by definition:

Z=∑a0,…,aN−1T(a0,a1)T(a1,a2)⋯T(aN−1,a0). Z=\sum_{a_0,\dots,a_{N-1}}T(a_0,a_1)\,T(a_1,a_2)\cdots T(a_{N-1},a_0).

Step 3: recognize the warm-up. This is a sum over cyclic sequences of states, weighted by K=TK=T. So it is a trace:

Z=tr⁡TN. Z=\operatorname{tr}T^N .

In the smallest case, N=2N=2, you can see it directly: Z=∑a0,a1T(a0,a1)T(a1,a0)=∑a0(T2)(a0,a0)=tr⁡T2Z=\sum_{a_0,a_1}T(a_0,a_1)\,T(a_1,a_0)=\sum_{a_0}(T^2)(a_0,a_0)=\operatorname{tr}T^2.

(On boards of dimension 3 or more, some faces lie inside a layer. Their cost is then split half-and-half between the two slabs touching that layer, so that TT stays symmetric. On our 2D torus every face is in a slab, so no splitting is needed.)

The check: build the model on the 3×33\times3 torus, enumerate all 2182^{18} labelings exactly (chapter 2), and compare ZZ with tr⁡T3\operatorname{tr}T^3.

B33 = Board.grid(3, 3, periodic=True)
ex = Model(B33, Z2(), beta).exact()
total_weight = 2.0 ** B33.n_edges * np.exp(ex.log_Z)   # undo chapter 2's division by 2^18
print(f"Z by summing over all 2^18 labelings: {total_weight:.6e}")
print(f"trace of T^3:                         {np.trace(np.linalg.matrix_power(T3, 3)):.6e}")
Z by summing over all 2^18 labelings: 3.762284e+03
trace of T^3:                         3.762284e+03

They agree to every digit. A sum over 262,144 labelings has become the trace of the cube of an 8×88\times8 matrix. For a taller board we would only raise TT to a higher power, and the matrix stays 8×88\times8.

Why a trace? Because the stack is periodic: layer NN is layer 00, so the sequence of layers must return to where it started. If instead the stack had two separate ends, with the bottom layer fixed to aa and the top layer fixed to bb, the same three steps would give a single matrix entry, (TN)(a,b)(T^N)(a,b). The trace is the periodic version of that.

Averages are traces too

The same bookkeeping computes averages. Suppose f:Ω→ℝf:\Omega\to\mathbb R is a function of one layer's labeling, and you want ⟨f(a0)⟩β\langle f(a_0)\rangle_\beta. An average is the sum of (weight × ff) divided by ZZ, so put the factor f(a0)f(a_0) into the sum of Step 2. In matrix language, let Df∈ℝΩ×ΩD_f\in\mathbb R^{\Omega\times\Omega} be the diagonal matrix with the values f(a)f(a) on its diagonal. Then (DfT)(a0,a1)=f(a0)T(a0,a1)(D_fT)(a_0,a_1)=f(a_0)\,T(a_0,a_1), so multiplying by f(a0)f(a_0) is the same as inserting DfD_f just before the first TT:

∑a0,…,aN−1f(a0)T(a0,a1)⋯T(aN−1,a0)=tr⁡(DfTN). \sum_{a_0,\dots,a_{N-1}}f(a_0)\,T(a_0,a_1)\cdots T(a_{N-1},a_0)=\operatorname{tr}\big(D_f\,T^N\big).

A second function gg of layer tt (for 0≤t≤N0\le t\le N) is inserted the same way, as DgD_g after the first tt factors of TT. Dividing by Z=tr⁡TNZ=\operatorname{tr}T^N gives:

Rule (averages as traces). For functions f,g:Ω→ℝf,g:\Omega\to\mathbb R of a layer labeling, ⟨f(a0)g(at)⟩β=tr⁡(DfTtDgTN−t)/tr⁡TN\langle f(a_0)\,g(a_t)\rangle_\beta=\operatorname{tr}\big(D_f\,T^t\,D_g\,T^{N-t}\big)/\operatorname{tr}T^N.

Read it as a trip around the stack: measure ff, go up tt slabs, measure gg, and go the remaining N−tN-t slabs back to the start. Let's check it on the 3×33\times3 torus with f=g=wf=g=w, the ring's loop product of a layer: w(a)=a0a1a2w(a)=a_0a_1a_2, the product of its three labels (column indices here). We compare layers 0 and 1.

eidx = B33.meta["edge_index"]
def w_layer(k):
    """Loop product of layer k's ring, for every labeling of the exact enumeration."""
    return np.prod([ex.U[:, eidx[(x + 3 * k, 0)]] for x in range(3)], axis=0)

D_w = np.diag(layer_labelings(3).prod(axis=1))          # multiply by the loop product
mp = np.linalg.matrix_power
print(f"<w(a_0) w(a_1)> by enumeration: {np.sum(ex.p * w_layer(0) * w_layer(1)):.6f}")
print(f"<w(a_0) w(a_1)> by traces:      {np.trace(D_w @ T3 @ D_w @ mp(T3, 2)) / np.trace(mp(T3, 3)):.6f}")
<w(a_0) w(a_1)> by enumeration: 0.266615
<w(a_0) w(a_1)> by traces:      0.266615

Tall stacks: one eigenvalue wins

First a property we will use constantly: TT is symmetric, T(a,b)=T(b,a)T(a,b)=T(b,a). Swapping the roles of the two layers is the flip of one slab, which maps faces to faces and does not change any cost (it may invert a face product, and the face costs of glossary 4.2 satisfy φ(x−1)=φ(x)\varphi(x^{-1})=\varphi(x)). For the coin model you can see it directly: the face product axsx+1bxsxa_x\,s_{x+1}\,b_x\,s_x doesn't change if aa and bb trade places. A real symmetric matrix has real eigenvalues λ0≥λ1≥⋯\lambda_0\ge\lambda_1\ge\cdots and an orthonormal basis of eigenvectors.

The trace of a matrix is the sum of its eigenvalues, and the eigenvalues of TNT^N are the NN-th powers of those of TT. So

Z=tr⁡TN=∑nλnN. Z=\operatorname{tr}T^N=\sum_n\lambda_n^N .

Every entry of TT is a sum of positive weights. For such a matrix the Perron–Frobenius theorem (the one behind the stationary distribution of a Markov chain) says that the largest eigenvalue λ0\lambda_0 is positive and strictly larger than |λn||\lambda_n| for every other nn. Dividing by λ0N\lambda_0^N, every other term (λn/λ0)N(\lambda_n/\lambda_0)^N goes to 00. So as NN grows, λ0\lambda_0 takes over: Z≈λ0NZ\approx\lambda_0^N, and 1Nlog⁡Z→log⁡λ0\frac1N\log Z\to\log\lambda_0. In words: in a tall stack every layer contributes the same factor λ0\lambda_0 to the total weight. You can see it converge.

print("T symmetric:", np.allclose(T3, T3.T))
lam0 = np.linalg.eigvalsh(T3).max()
for N_ in [1, 2, 3, 5, 10, 20]:
    print(f"N = {N_:>2}:  (1/N) log Z = {np.log(np.trace(mp(T3, N_))) / N_:.6f}     log lambda_0 = {np.log(lam0):.6f}")
T symmetric: True
N =  1:  (1/N) log Z = 2.940161     log lambda_0 = 2.740694
N =  2:  (1/N) log Z = 2.764484     log lambda_0 = 2.740694
N =  3:  (1/N) log Z = 2.744260     log lambda_0 = 2.740694
N =  5:  (1/N) log Z = 2.740799     log lambda_0 = 2.740694
N = 10:  (1/N) log Z = 2.740694     log lambda_0 = 2.740694
N = 20:  (1/N) log Z = 2.740694     log lambda_0 = 2.740694

Already at N=10N=10 the two agree to six digits. This factor λ0\lambda_0 is "the weight per layer", and section 5.4 will divide by it.

Recap. A sum over sequences of products is a matrix power, and a sum over cyclic sequences is a trace. Writing a labeling as layers plus step labels and summing out the step labels gives Z=tr⁡TNZ=\operatorname{tr}T^N on a periodic stack (a single entry (TN)(a,b)(T^N)(a,b) with fixed ends). Averages of layer functions are traces with diagonal matrices inserted. In a tall stack Z≈λ0NZ\approx\lambda_0^N: each layer contributes the factor λ0\lambda_0.

Check yourself

  1. In the warm-up, what does (Kt)(a,b)(K^t)(a,b) add up?
Answer

The weights of all sequences of length tt that start at aa and end at bb, where a sequence's weight is the product of KK over its consecutive pairs.

  1. Compute T((+,+,+),(−,+,+))T\big((+,+,+),(-,+,+)\big) by hand.
Answer

Now face 0 has product −s0s1-s_0s_1 and faces 1, 2 have s1s2s_1s_2, s2s0s_2s_0. The product of all three face products is −1-1, so an odd number of faces are defects: 1 or 3. Going through ss: 6 choices give one defect and 2 give three. So T=6e−2β+2e−6βT=6e^{-2\beta}+2e^{-6\beta}.

  1. How big is TT for the coin model with W=10W=10? For G=S3G=S_3 with W=4W=4?
Answer

210×210=1024×10242^{10}\times2^{10}=1024\times1024, and 64×64=1296×12966^4\times6^4=1296\times1296. The size grows exponentially in the size of a layer, but not with the height of the stack.

5.3 The layer constraint: the ring's loop product does a random walk

Let's look at the 8×88\times8 matrix. We sort the layer labelings by their loop product w(a)=a0a1a2w(a)=a_0a_1a_2 (chapter 1: the product of the labels around the ring), the four with w=+1w=+1 first.

A3 = layer_labelings(3)
w3 = A3.prod(axis=1)
order = np.argsort(-w3, kind="stable")                    # w = +1 first, then w = -1
names = ["".join("+" if v > 0 else "−" for v in a) for a in A3[order]]
fig, ax = plt.subplots(figsize=(5, 4.3))
im = ax.imshow(T3[np.ix_(order, order)], cmap="magma")
ax.axhline(3.5, color="white", lw=2); ax.axvline(3.5, color="white", lw=2)
ax.set_xticks(range(8), names, rotation=45, fontsize=9); ax.set_yticks(range(8), names, fontsize=9)
ax.set(xlabel="layer labeling $b$ (layer $k+1$)", ylabel="layer labeling $a$ (layer $k$)",
       title="T, sorted by loop product")
fig.colorbar(im, ax=ax, shrink=0.8)
plt.show()
The 8 by 8 transfer matrix T as a heat map, with rows and columns sorted by loop product. It is made of four constant blocks: bright when the two layer labelings have the same loop product, dark when they differ.

Two things stand out. The matrix has only two distinct entries. And it is made of four constant blocks: the entry is large when aa and bb have the same loop product, and small when they differ. Everything else about aa and bb seems to be irrelevant. Why?

Why TT only sees loop products

Take a reframing hh that acts only on the vertices of layer k+1k+1. It changes the layer labeling bb into some other labeling h⋅bh\cdot b. It also changes the step labels touching layer k+1k+1, but those are exactly the labels ss that TT sums over. Reframing doesn't change any face product's cost (chapter 2), and it only relabels which ss is which in the sum. So the sum is the same:

Fact 5.1 (layer constraint). For every reframing hh that acts only on one layer, T(a,h⋅b)=T(a,b)T(a,h\cdot b)=T(a,b), and likewise T(h⋅a,b)=T(a,b)T(h\cdot a,b)=T(a,b). So T(a,b)T(a,b) depends only on the classes of aa and bb (glossary 5.10).

On a ring the class of a layer labeling is determined by its loop product (chapter 1). For the coin model that means: T(a,b)T(a,b) depends only on whether w(a)=w(b)w(a)=w(b). Let's check, using the reframing that flips vertex 1 of the upper layer (which flips the two labels b0b_0 and b1b_1 touching it).

code = lambda rows: ((1 - rows) // 2) @ (2 ** np.arange(3)[::-1])     # row of +-1 -> row index of T
h = np.array([1, -1, 1])                                             # flip vertex 1 only
hb = A3 * h * np.roll(h, -1)                                         # b_x -> h_x b_x h_{x+1}
print("T(a, h.b) == T(a, b) for all a, b:", np.allclose(T3[:, code(hb)], T3))
same, diff = T3[0, 0], T3[0, code(np.array([[-1, 1, 1]]))[0]]
print(f"the two entries: same loop product {same:.4f}, different loop product {diff:.4f}")
T(a, h.b) == T(a, b) for all a, b: True
the two entries: same loop product 2.3649, different loop product 1.5096

Shrinking TT to a 2×22\times2 matrix

Since only ww matters, collapse each block. Write TsameT_{\text{same}} and TdiffT_{\text{diff}} for the two entries printed above. If the current layer has loop product ww, the total weight of moving to some next labeling with loop product w′w' is the block entry times the 4 labelings in that block:

T̃=(4Tsame4Tdiff4Tdiff4Tsame), \tilde T=\begin{pmatrix}4\,T_{\text{same}} & 4\,T_{\text{diff}}\\ 4\,T_{\text{diff}} & 4\,T_{\text{same}}\end{pmatrix},

rows and columns indexed by w∈{+1,−1}w\in\lbrace +1,-1\rbrace. Divide each row by its sum and you get a matrix of transition probabilities: the probability that the next layer's loop product equals or differs from this one's.

Tt = 4 * np.array([[same, diff], [diff, same]])
P = Tt / Tt.sum(axis=1, keepdims=True)
print("transition probabilities for the loop product (rows: from +1, -1; columns: to +1, -1):")
print(np.round(P, 4))
print(f"probability of keeping w: {P[0, 0]:.4f}    formula (1 + tanh(beta)^3) / 2 = {(1 + np.tanh(beta) ** 3) / 2:.4f}")
transition probabilities for the loop product (rows: from +1, -1; columns: to +1, -1):
[[0.6104 0.3896]
 [0.3896 0.6104]]
probability of keeping w: 0.6104    formula (1 + tanh(beta)^3) / 2 = 0.6104

Where does that formula come from? Use the freedom of Fact 5.1: reframe layer by layer from the bottom up so that every step label becomes +1+1. (This is a tree normal form whose tree contains the step edges; on a torus one slab is left over, which we ignore for now.) With all sx=+1s_x=+1, the face products of a slab are just fx=axbxf_x=a_xb_x, so bx=axfxb_x=a_xf_x, and multiplying around the ring:

w(b)=w(a)⋅f0f1⋯fW−1. w(b)=w(a)\cdot f_0f_1\cdots f_{W-1}.

The face products of a slab are independent, each +1+1 with probability 11+e−2β\frac{1}{1+e^{-2\beta}} (this is Fact 2.8 of chapter 2, and its average is tanh⁡β\tanh\beta). So f0⋯fW−1f_0\cdots f_{W-1} has average r=(tanh⁡β)Wr=(\tanh\beta)^W, and it is +1+1 with probability (1+r)/2(1+r)/2.

Fact 5.2 (the ring's walk). Going up one layer, the ring's loop product is multiplied by the product of WW independent random face products, each with distribution proportional to e−βφe^{-\beta\varphi}. The sequence w(a0),w(a1),w(a2),…w(a_0),w(a_1),w(a_2),\dots is a random walk on GG. For the coin model it keeps its value with probability (1+r)/2(1+r)/2 and flips with probability (1−r)/2(1-r)/2, where r=(tanh⁡β)Wr=(\tanh\beta)^W.

Here is that walk, read off from samples of the actual model (using the fast sampler of chapter 4) on tori with N=64N=64 layers and three ring lengths.

def ring_walks(W, N, beta, n_samples, rng, gap=20):
    M = GridModel((W, N), Z2(), beta).hot_start(rng)
    M.sweep(rng, 300)
    out = []
    for _ in range(n_samples):
        M.sweep(rng, gap)
        out.append(M.U[0].prod(axis=0))          # loop product of every layer's ring
    return np.array(out)

walks = {W: ring_walks(W, 64, 1.2, 1000, rng, gap=5) for W in [2, 4, 8]}
fig, axs = plt.subplots(3, 1, figsize=(9, 4.6), sharex=True)
for ax, W in zip(axs, [2, 4, 8]):
    ax.imshow(walks[W][::100], cmap=ListedColormap([viz.GOLD, viz.PALE]), aspect="auto", vmin=-1, vmax=1)
    ax.set_yticks([]); ax.set_ylabel(f"W = {W}", rotation=0, ha="right", va="center")
axs[-1].set_xlabel("layer $k$")
axs[0].set_title(r"loop product of each layer's ring: pale $=+1$, gold $=-1$ (10 samples per panel, $\beta=1.2$)")
plt.show()
Three strips for ring lengths W equal to 2, 4 and 8, each showing 10 samples of the loop product of each of 64 layers, pale for plus one and gold for minus one. The values flip like a telegraph signal, more often for longer rings.

Each row is one sample: a sequence of 64 values, flipping now and then like a telegraph signal. The longer the ring, the more often it flips, because more faces get a chance to be defects.

This is worth pausing on. Summing the model over everything except the layers' loop products leaves a sum over paths w0→w1→⋯→wN−1→w0w_0\to w_1\to\cdots\to w_{N-1}\to w_0 of a random walk on GG, each path weighted by its step probabilities. A weighted sum over paths is what physicists call a path integral. Here it is not a metaphor: it is a random walk you can sample.

Recap. T(a,b)T(a,b) doesn't change if either layer is reframed, so it only sees the classes of the layers. On a ring those are given by the loop product, so TT collapses to a small matrix on GG, which (after normalizing rows) is the transition matrix of a random walk: going up one layer multiplies the loop product by WW independent face products.

Check yourself

  1. For the coin model at β=1.2\beta=1.2, what is the probability that the loop product flips between consecutive layers, for W=2W=2 and W=8W=8?
Answer

tanh⁡1.2≈0.834\tanh1.2\approx0.834. For W=2W=2, r≈0.695r\approx0.695 and the flip probability is (1−r)/2≈0.15(1-r)/2\approx0.15. For W=8W=8, r≈0.234r\approx0.234 and it is about 0.380.38.

  1. At β=0\beta=0 what does the walk do?
Answer

Every face product is uniform, so their product is uniform: the loop product jumps to a fresh uniform value at every layer. No memory at all.

5.4 How fast do layers forget? Eigenvalues

Here is the question that will give us the most important number of the chapter: if you know the loop product at layer 0, how much do you know about it at layer tt?

Iterating the walk by hand

The answer is in the powers PtP^t of the transition matrix: (Pt)(w,w′)(P^t)(w,w') is the probability of going from ww to w′w' in tt steps (the warm-up of 5.2 again). For a 2×22\times2 matrix we can compute PtP^t exactly, using two special vectors. Write PP as

P=12(1+r1−r1−r1+r). P=\frac12\begin{pmatrix}1+r & 1-r\\ 1-r & 1+r\end{pmatrix}.

Multiply it by the vectors u0=(1,1)u_0=(1,1) and u1=(1,−1)u_1=(1,-1):

Pu0=u0,Pu1=ru1. P\,u_0=u_0,\qquad P\,u_1=r\,u_1 .

So u0u_0 and u1u_1 are eigenvectors, with eigenvalues 11 and rr: PP does not mix them, it only scales them. Read as functions of the loop product, u0u_0 is the constant function and u1u_1 is the function ww itself. Any vector is a combination of the two, for example the starting distribution "certainly +1+1":

(1,0)=12u0+12u1. (1,0)=\tfrac12u_0+\tfrac12u_1 .

(A distribution is usually multiplied by PP from the left. Here PP is symmetric, so left and right give the same vector, and Pt(1,0)⊤P^t(1,0)^{\top} is the first column of PtP^t, whose first entry is (Pt)(+1,+1)(P^t)(+1,+1).) Applying PP a total of tt times multiplies the u0u_0 part by 1t1^t and the u1u_1 part by rtr^t:

Pt(1,0)⊤=12u0+12rtu1=(12+12rt,12−12rt). P^t(1,0)^{\top}=\tfrac12u_0+\tfrac12r^tu_1=\big(\tfrac12+\tfrac12r^t,\ \tfrac12-\tfrac12r^t\big).

The first entry is the answer:

Pr⁡(wt=+1∣w0=+1)=12+12rt. \Pr(w_t=+1\mid w_0=+1)=\frac12+\frac12\,r^t .

The constant part, 12\frac12, is where the walk ends up when it has forgotten everything. The memory of the start is the second part, and it shrinks by the factor rr at every layer. The eigenvalue rr is the rate of forgetting.

Let's check this against the samples from the previous section: the fraction of pairs of layers tt apart whose loop products agree.

fig, ax = plt.subplots(figsize=(7, 3.8))
ts = np.arange(0, 13)
for W, c in zip([2, 4, 8], [viz.TEAL, viz.CORAL, viz.GOLD]):
    agree = [np.mean(walks[W] == np.roll(walks[W], -t, axis=1)) for t in ts]
    r_W = np.tanh(1.2) ** W
    ax.semilogy(ts, np.array(agree) - 0.5, "o", color=c, label=f"W = {W}: samples")
    ax.semilogy(ts, 0.5 * r_W ** ts, "-", color=c, lw=1.5, label=fr"W = {W}: $r^t/2$")
ax.set(xlabel="layer separation $t$", ylabel=r"$\Pr(\mathrm{agree}) - 1/2$", ylim=(3e-3, 0.7))
ax.legend(fontsize=8, ncol=3, loc="upper right")
plt.show()
On a log scale, the probability that two layers t apart agree, minus one half, for W equal to 2, 4 and 8. Sample dots follow straight lines r to the t over 2; the longer the ring, the steeper the line.

On this logarithmic scale each "memory" curve is a straight line, and its slope is log⁡r\log r. A longer ring has a smaller rr, so a steeper line: it forgets faster. Once the remaining memory is below about half a percent, it is smaller than the sampling noise, and the points scatter around the line instead of following it (for W=8W=8 that happens after only a few layers).

Levels: rates instead of factors

Exponential decay is easier to talk about as a rate. Write r=e−E1r=e^{-E_1}, so that

rt=e−E1t,E1=−log⁡r. r^t=e^{-E_1t},\qquad E_1=-\log r .

E1E_1 is "how much memory is lost per layer". For the coin model, E1=−log⁡(tanh⁡β)W=−Wlog⁡tanh⁡βE_1=-\log(\tanh\beta)^W=-W\log\tanh\beta.

In general we don't normalize TT into a probability matrix first, so we define the rates directly from the eigenvalues of TT. TT is symmetric, so its eigenvalues are real. Order them λ0≥λ1≥⋯\lambda_0\ge\lambda_1\ge\cdots. The levels (glossary 5.8) are

En=−log⁡λnλ0≥0. E_n=-\log\frac{\lambda_n}{\lambda_0}\ \ge0 .

Dividing by λ0\lambda_0 is what normalizing does: λ0\lambda_0 is the overall weight per layer, and it cancels from every probability. For the coin model you can see this exactly. Every row of T̃\tilde T has the same sum, so the constant vector u0u_0 is an eigenvector of T̃\tilde T with that row sum as eigenvalue, and that is λ0\lambda_0 (checked below). Then P=T̃/λ0P=\tilde T/\lambda_0, so the eigenvalues of PP are those of T̃\tilde T divided by λ0\lambda_0: 11 and r=λ1/λ0r=\lambda_1/\lambda_0. So E0=0E_0=0 always, and the gap E1E_1 is the decay rate of the slowest-forgetting memory. A small gap means long memory; a big gap means fast forgetting.

What about the other six eigenvalues?

The full TT for W=3W=3 is 8×88\times8, so it has 8 eigenvalues, not 2. Let's look at all of them.

ev = np.sort(np.linalg.eigvalsh(T3))[::-1]
print("eigenvalues of the 8x8 T:", np.round(ev, 6) + 0.0)
print(f"lambda_1 / lambda_0 = {ev[1] / ev[0]:.6f}     r = tanh(beta)^3 = {np.tanh(beta) ** 3:.6f}")
print(f"lambda_0 = {ev[0]:.6f}     row sum of the 2x2 matrix = {Tt[0].sum():.6f}")
eigenvalues of the 8x8 T: [15.497733  3.42115   0.        0.        0.        0.        0.
  0.      ]
lambda_1 / lambda_0 = 0.220752     r = tanh(beta)^3 = 0.220752
lambda_0 = 15.497733     row sum of the 2x2 matrix = 15.497733

Two of them are the eigenvalues of the small matrix T̃\tilde T: on a function that is constant on each class, TT acts exactly like T̃\tilde T, because each block has 4 equal entries. The other six are exactly zero. The reason is Fact 5.1. Take any function gg of a layer labeling that adds up to zero over each class, for example g(b)=b0−b1g(b)=b_0-b_1 (which flips sign under the reframing of vertex 1). Then

(Tg)(a)=∑bT(a,b)g(b)=∑classes cT(a,c)∑b∈cg(b)=0, (Tg)(a)=\sum_bT(a,b)\,g(b)=\sum_{\text{classes }c}T(a,c)\sum_{b\in c}g(b)=0,

because T(a,b)T(a,b) is the same number T(a,c)T(a,c) for every bb in a class cc. Such functions form a subspace of dimension 8−2=68-2=6: the 8 values of gg only have to satisfy one linear condition per class, and there are 2 classes. Every vector in it is an eigenvector with eigenvalue 00, which accounts for the six zeros. So TT erases everything about a layer except its class. Only functions of the loop product survive one step, and those are what the levels describe. This is why glossary 5.8 says to restrict TT to reframing-invariant functions.

g = A3[:, 0] - A3[:, 1]                                          # b_0 - b_1, not an invariant
print("T applied to g = b_0 - b_1:", np.round(T3 @ g, 10))
for W_ in [2, 3, 4, 6]:
    lam = np.sort(np.linalg.eigvalsh(coin_transfer_matrix(W_, beta)))[::-1]
    print(f"W={W_}: nonzero eigenvalues {np.sum(lam > 1e-9)},  E1 = {-np.log(lam[1] / lam[0]):.4f},  "
          f"-W log tanh(beta) = {-W_ * np.log(np.tanh(beta)):.4f}")
T applied to g = b_0 - b_1: [0. 0. 0. 0. 0. 0. 0. 0.]
W=2: nonzero eigenvalues 2,  E1 = 1.0071,  -W log tanh(beta) = 1.0071
W=3: nonzero eigenvalues 2,  E1 = 1.5107,  -W log tanh(beta) = 1.5107
W=4: nonzero eigenvalues 2,  E1 = 2.0143,  -W log tanh(beta) = 2.0143
W=6: nonzero eigenvalues 2,  E1 = 3.0214,  -W log tanh(beta) = 3.0214

For every ring length, only 2 eigenvalues are nonzero, and the gap matches −Wlog⁡tanh⁡β-W\log\tanh\beta. The gap is proportional to the length of the ring: keeping a loop of length WW "remembered" from layer to layer costs an amount proportional to WW.

A warning about signs

We took log\log of eigenvalue ratios without worrying. That needs every relevant eigenvalue to be positive. (Zero eigenvalues are harmless: they belong to the erased functions, which we have just set aside.) A negative eigenvalue would make the memory alternate in sign from layer to layer (rtr^t with r<0r<0), and no decay rate could describe it. For our models this never happens. The property that guarantees it is called flip-positivity, and it is important enough to get its own section (5.6).

Recap. An eigenvector of the walk is a function that one step only rescales; its eigenvalue is the factor. Memory of the start decays like (λ1/λ0)t=e−E1t(\lambda_1/\lambda_0)^t=e^{-E_1t}, so the gap E1E_1 is the rate of forgetting. TT erases every non-invariant function (eigenvalue 0), so only functions of the loop product matter. For the coin model E1=−Wlog⁡tanh⁡βE_1=-W\log\tanh\beta, and flip-positivity guarantees the logarithm makes sense.

Check yourself

  1. Verify Pu1=ru1P\,u_1=r\,u_1 by multiplying out.
Answer

First entry: 12((1+r)−(1−r))=r\frac12\big((1+r)-(1-r)\big)=r. Second entry: 12((1−r)−(1+r))=−r\frac12\big((1-r)-(1+r)\big)=-r. So Pu1=(r,−r)=ru1Pu_1=(r,-r)=r\,u_1.

  1. Suppose we allowed a negative stiffness, β=−0.7\beta=-0.7, with W=3W=3. What is λ1/λ0\lambda_1/\lambda_0, and what goes wrong?
Answer

tanh⁡(−0.7)3≈−0.22\tanh(-0.7)^3\approx-0.22. The memory rtr^t alternates in sign and −log-\log of a negative number is undefined. Flip-positivity fails for negative stiffness (with odd WW), and the derived picture of section 5.8 breaks down (section 5.6 shows this failure in detail).

  1. Why does the gap grow with WW?
Answer

The ring's loop product flips whenever an odd number of the WW faces in a slab are defects. More faces mean more chances, so the walk forgets faster.

5.5 Two roads to one number

We computed the gap from the cost function: build TT, take eigenvalues. Now forget the cost. Suppose someone hands you a black box that produces random labelings of the cylinder from some model, and nothing else. Can you get the same number?

Yes: section 5.4 already said how. Memory decays like e−E1te^{-E_1t}, so measure memory. Write wk=w(ak)∈{±1}w_k=w(a_k)\in\lbrace\pm1\rbrace for the loop product of layer kk's ring and define the layer correlation

C(t)=⟨wkwk+t⟩β,C:{0,…,N}→ℝ, C(t)=\big\langle w_k\,w_{k+t}\big\rangle_\beta,\qquad C:\lbrace 0,\dots,N\rbrace\to\mathbb R ,

which by the shift symmetry does not depend on kk.

The prediction, step by step

On a periodic stack two layers tt apart are joined two ways: tt slabs going up and N−tN-t slabs going the rest of the way round. With the matrices of 5.2 the average is

C(t)=tr⁡(DwTtDwTN−t)tr⁡TN, C(t)=\frac{\operatorname{tr}\big(D_w\,T^t\,D_w\,T^{N-t}\big)}{\operatorname{tr}T^N},

where DwD_w is the diagonal matrix that multiplies by the loop product (the rule of 5.2 with f=g=wf=g=w). Now compute the trace in a basis of eigenvectors of TT. Recall that the trace of a matrix MM can be computed in any orthonormal basis, as ∑vv⊤Mv\sum_v v^{\top}Mv; so a basis vector with Mv=cvMv=cv contributes exactly cc. For the space of functions on Ω\Omega (2W2^W-dimensional) take:

(Divide each by its length to make them orthonormal; that doesn't change what they contribute.) An erased gg contributes 00, because the first matrix to act on it, TN−tT^{N-t}, kills it (for 0<t<N0<t<N). Multiplying by ww swaps the other two, since w2=1w^2=1: Dwu0=u1D_wu_0=u_1 and Dwu1=u0D_wu_1=u_0. Now follow u0u_0 through M=DwTtDwTN−tM=D_w\,T^t\,D_w\,T^{N-t}, from right to left: TN−tT^{N-t} scales it by λ0N−t\lambda_0^{N-t}, DwD_w turns it into u1u_1, TtT^t scales by λ1t\lambda_1^t, and DwD_w turns it back into u0u_0. So Mu0=λ0N−tλ1tu0Mu_0=\lambda_0^{N-t}\lambda_1^t\,u_0. Starting from u1u_1 instead gives Mu1=λ1N−tλ0tu1Mu_1=\lambda_1^{N-t}\lambda_0^t\,u_1. Adding both and dividing by tr⁡TN=λ0N+λ1N\operatorname{tr}T^N=\lambda_0^N+\lambda_1^N (the zero eigenvalues add nothing):

C(t)=λ0N−tλ1t+λ1N−tλ0tλ0N+λ1N=e−E1t+e−E1(N−t)1+e−E1N. C(t)=\frac{\lambda_0^{N-t}\lambda_1^{t}+\lambda_1^{N-t}\lambda_0^{t}}{\lambda_0^N+\lambda_1^N}=\frac{e^{-E_1t}+e^{-E_1(N-t)}}{1+e^{-E_1N}} .

Two exponentials appear because a periodic stack can be traversed both ways round. For tt much smaller than NN, C(t)≈e−E1tC(t)\approx e^{-E_1t}: the correlation between layers decays at a rate equal to the gap.

First a sanity check of this formula against exact enumeration on the 3×33\times3 torus, where N=3N=3 and t=1t=1:

eidx = B33.meta["edge_index"]
w_layer = lambda k: np.prod([ex.U[:, eidx[(x + 3 * k, 0)]] for x in range(3)], axis=0)
C1_exact = float(np.sum(ex.p * w_layer(0) * w_layer(1)))
r = np.tanh(beta) ** 3
print(f"C(1) by enumeration: {C1_exact:.6f}    by the formula: {(r + r ** 2) / (1 + r ** 3):.6f}")
C(1) by enumeration: 0.266615    by the formula: 0.266615

Now road 2 for real. We sample the coin model on a 4×164\times16 torus at β=1.6\beta=1.6 with the chapter 4 sampler, record every layer's loop product, and average wkwk+tw_kw_{k+t} over all samples and all starting layers kk. The cost function is used only inside the sampler, which we treat as the black box.

W5, N5, beta5 = 4, 16, 1.6
M = GridModel((W5, N5), Z2(), beta5).hot_start(rng)
M.sweep(rng, 500)
ws = np.array([(M.sweep(rng), M.U[0].prod(axis=0))[1] for _ in range(20000)])   # (samples, N)
per_sample = np.stack([np.mean(ws * np.roll(ws, -t, axis=1), axis=1) for t in range(N5 + 1)], 1)
blocks = per_sample.reshape(100, -1, N5 + 1).mean(axis=1)                         # binning (ch. 4)
C_hat, C_err = blocks.mean(axis=0), blocks.std(axis=0, ddof=1) / np.sqrt(len(blocks))

def C_model(t, E1, N):
    return (np.exp(-E1 * t) + np.exp(-E1 * (N - t))) / (1 + np.exp(-E1 * N))

def fit_E1(C, err, N):
    t = np.arange(1, N)
    return minimize_scalar(lambda E: np.sum(((C[t] - C_model(t, E, N)) / err[t]) ** 2),
                           bounds=(0.01, 3), method="bounded").x
E1_road1 = -W5 * np.log(np.tanh(beta5))
E1_road2 = fit_E1(C_hat, C_err, N5)
boot = [fit_E1(blocks[i].mean(axis=0), C_err, N5)
        for i in (rng.integers(0, len(blocks), len(blocks)) for _ in range(200))]
print(f"road 1 (eigenvalues of T):       E1 = {E1_road1:.4f}")
print(f"road 2 (sampling, black box):    E1 = {E1_road2:.4f} ± {np.std(boot):.4f}")
road 1 (eigenvalues of T):       E1 = 0.3263
road 2 (sampling, black box):    E1 = 0.3361 ± 0.0058
t = np.arange(N5 + 1)
tt = np.linspace(0, N5, 300)
fig, ax = plt.subplots(figsize=(7, 3.8))
ax.errorbar(t, C_hat, yerr=2 * C_err, fmt="o", color=viz.CORAL, ms=5, capsize=2,
            label="road 2: measured from samples (±2 s.e.)")
ax.plot(tt, C_model(tt, E1_road1, N5), color=viz.TEAL, lw=2, label="road 1: from eigenvalues of $T$")
ax.plot(tt, np.exp(-E1_road1 * tt), color=viz.MUTED, ls=":", label=r"$e^{-E_1 t}$ alone")
ax.set(xlabel="layer separation $t$", ylabel="$C(t)$", yscale="log", ylim=(0.03, 1.2))
ax.legend(fontsize=9)
plt.show()
On a log scale, the correlation C(t) between layers t apart on a torus of 16 layers. Coral dots measured from samples, with error bars, follow the teal curve computed from the eigenvalues of T, which dips to a minimum at t equal to 8 and rises again; a dotted line shows the plain exponential decay.

The dots (sampling) lie within their error bars of the teal curve (eigenvalues), though all of them sit slightly below it. That common shift is not 15 separate discrepancies: neighbouring points come from the same samples and move together. The fitted gap, E1=0.336±0.006E_1=0.336\pm0.006 against 0.3260.326, is about 1.7 standard errors away, which is agreement within the statistical error. For small tt both follow the dotted straight line e−E1te^{-E_1t} on this log scale; past the middle of the stack the correlation climbs back up, because the layers are approaching each other the other way round the periodic stack.

Why this matters. Road 2 never used the cost function: it needed only samples of the distribution, plus a way to cut the board into layers with a shift and a flip. This is the answer to a question from the very start of the course: what do you need, besides the distribution, to extract dynamics? Only the layering and its symmetries. The cost function is merely one convenient way of writing the distribution down.

Recap. The correlation between layers tt apart decays like e−E1te^{-E_1t} (with a mirror term on a periodic stack). Measuring that decay from samples gives the gap without ever looking at the cost. Road 1 (eigenvalues) and road 2 (sampling) agree within the sampling error.

Check yourself

  1. With E1≈0.33E_1\approx0.33, how many layers apart must two rings be before their correlation drops below 1%?
Answer

e−0.33t<0.01e^{-0.33t}<0.01 needs t>ln⁡100/0.33≈14t>\ln100/0.33\approx14. On a stack of only 16 layers you'd never see that, because the mirror term takes over first.

  1. The correlation length (glossary 4.7) measures how fast correlations decay with distance. How is it related to the gap?
Answer

C(t)≈e−t/ξC(t)\approx e^{-t/\xi} with ξ=1/E1\xi=1/E_1: the correlation length in the layer direction is the reciprocal of the gap.

5.6 Flip-positivity

Twice already we needed every eigenvalue of TT to be nonnegative: to take logarithms in 5.4, and for C(t)C(t) to decay instead of oscillating in 5.5. This section explains the property behind that, flip-positivity. It is worth the time: it is also what turns functions on the board into the vector space of a quantum system (5.8), and it is one of the properties the Millennium problem demands of the limit in chapter 6.

Two ways to put a mirror in the stack

The flip θ\theta turns the stack upside down. There are two natural places to put the mirror:

Either way the mirror splits the periodic stack into an upper half and a lower half, and θ\theta swaps them. On a periodic stack the mirror has a second copy halfway round, so we take NN even. Through a layer, the upper half is layers 0,1,…,N/20,1,\dots,N/2 with the edges among them (the two mirror layers 00 and N/2N/2 belong to both halves). Between layers, the upper half is layers 1,…,N/21,\dots,N/2 with the edges among them; the step edges of slabs 00 and N/2N/2, which the mirrors cut, belong to neither half.

def draw_mirror(ax, between, ks=range(-3, 4)):
    for k in ks:
        ax.plot([0, 4], [k, k], color=viz.INK, lw=2)
        ax.text(-0.3, k, f"layer {k}", ha="right", va="center", fontsize=10)
    m = 0.5 if between else 0.0
    ax.fill_between([-0.2, 4.2], m, 3.5, color=viz.TEAL, alpha=0.12, lw=0)
    ax.plot([-0.2, 4.2], [m, m], color=viz.CORAL, ls="--", lw=2.5)
    ax.text(4.4, m, "mirror", color=viz.CORAL, va="center", fontsize=11)
    ax.text(4.4, 2.5, "upper half", color=viz.TEAL, va="center", fontsize=11)
    t = 2
    ax.annotate("", xy=(2, 2 * m - t), xytext=(2, t),
                arrowprops=dict(arrowstyle="<->", color=viz.GOLD, lw=2, connectionstyle="arc3,rad=0.35"))
    ax.set(xlim=(-2.2, 7), ylim=(-3.6, 3.6), title="mirror between layers 0 and 1" if between else "mirror through layer 0")
    ax.axis("off")

fig, axs = plt.subplots(1, 2, figsize=(10, 4))
draw_mirror(axs[0], between=False); draw_mirror(axs[1], between=True)
plt.show()
Two diagrams of layers minus 3 to 3 with the upper half shaded. Left: a mirror through layer 0, with a gold arrow joining layer 2 to layer minus 2. Right: a mirror between layers 0 and 1, with the arrow joining layer 2 to layer minus 1.

The gold arrows join layer 2 to its mirror image: layer −2-2 on the left, layer −1-1 on the right. Notice the number of slabs between a layer and its image. Through a layer it is always even (2t2t). Between layers it is always odd (2t−12t-1). That difference will matter.

The definition

Write EupperE_{\text{upper}} for the edges of the upper half, and let FF be any function of their labels, F:GEupper→ℂF:G^{E_{\text{upper}}}\to\mathbb C. Its mirror image θF=F∘θ\theta F=F\circ\theta is the same function applied to the mirrored labeling, so it depends only on the lower half. Flip-positivity (glossary 5.7) says:

⟨θF¯F⟩β≥0for every function F of the upper half. \big\langle\,\overline{\theta F}\;F\,\big\rangle_\beta\ \ge\ 0\qquad\text{for every function }F\text{ of the upper half.}

In words: a quantity measured on the top half and the same quantity measured on its mirror image are never, on average, anti-aligned. For a real FF this says that FF and its mirror image have a nonnegative average product.

This is not automatic. Averages of products of two different functions can be negative, of course. The claim is about a function and its own mirror image, and it is a real restriction on the model.

The single-layer case is linear algebra

Take the simplest upper-half function, a real function f:Ω→ℝf:\Omega\to\mathbb R of one layer: F=f(at)F=f(a_t) (so the complex conjugate does nothing). Its mirror image is ff of the mirrored layer, which is pp slabs away, with p=2tp=2t (mirror through a layer) or p=2t−1p=2t-1 (mirror between layers). By the trace rule of 5.2,

⟨θFF⟩β=tr⁡(DfTpDfTN−p)tr⁡TN. \big\langle\theta F\;F\big\rangle_\beta=\frac{\operatorname{tr}\big(D_f\,T^{p}\,D_f\,T^{N-p}\big)}{\operatorname{tr}T^N}.

(The model is shift-invariant, so only the separation pp between the two layers matters.) Write TT in its orthonormal eigenvectors v0,v1,…v_0,v_1,\dots (5.2): Tp=∑mλmpvmvm⊤T^p=\sum_m\lambda_m^{\,p}\,v_mv_m^{\top} and TN−p=∑nλnN−pvnvn⊤T^{N-p}=\sum_n\lambda_n^{\,N-p}\,v_nv_n^{\top}. Substituting, and using tr⁡(Dfvmvm⊤Dfvnvn⊤)=(vn⊤Dfvm)(vm⊤Dfvn)=(vm⊤Dfvn)2\operatorname{tr}(D_fv_mv_m^{\top}D_fv_nv_n^{\top})=(v_n^{\top}D_fv_m)(v_m^{\top}D_fv_n)=(v_m^{\top}D_fv_n)^2 (DfD_f is diagonal, hence symmetric), the numerator becomes

∑m,nλmpλnN−p(vm⊤Dfvn)2. \sum_{m,n}\lambda_m^{\,p}\,\lambda_n^{\,N-p}\,\big(v_m^{\top}D_fv_n\big)^2 .

Each term is a square times λmpλnN−p\lambda_m^p\lambda_n^{N-p}. Since NN is even, pp and N−pN-p are both even (mirror through a layer) or both odd (mirror between layers). Even powers are nonnegative whatever the signs of the eigenvalues. Odd powers are nonnegative for sure only if no eigenvalue is negative. So:

Fact 5.3 (flip-positivity for one layer). Let TT be symmetric with positive entries, and NN even. For the mirror through a layer, ⟨θFF⟩β≥0\langle\theta F\,F\rangle_\beta\ge0 for every single-layer FF, automatically. For the mirror between layers, ⟨θFF⟩β≥0\langle\theta F\,F\rangle_\beta\ge0 for every single-layer FF if TT has no negative eigenvalue; if TT does have a negative eigenvalue, it fails for some single-layer FF once the stack is tall enough.

Why the failure: on a tall stack the terms with n=0n=0 dominate, and they add up to λ0N−p∑mλmp(vm⊤Dfv0)2\lambda_0^{N-p}\sum_m\lambda_m^{\,p}(v_m^{\top}D_fv_0)^2. By Perron–Frobenius v0v_0 has positive entries, so you can choose f=vm/v0f=v_m/v_0 (entrywise) for an eigenvector vmv_m with λm<0\lambda_m<0. Then Dfv0=vmD_fv_0=v_m, the sum is just λmp<0\lambda_m^{\,p}<0 for odd pp, and the average is negative.

So the between-layers flip is the demanding one, and "TT has nonnegative eigenvalues" is what flip-positivity says about single layers.

Watching it fail

Negative stiffness is the easy way to break it: a model with β<0\beta<0 prefers defects. Take the coin model with W=3W=3 and β=−0.7\beta=-0.7. The favourite slab now has all 3 of its faces as defects, an odd number, and an odd number of defects in a slab flips the ring's loop product (Fact 5.2). So the loop product tends to flip at every layer. Neighbouring layers become anti-aligned.

Use F=w(a1)F=w(a_1), the loop product of layer 1. The mirror between layers 0 and 1 turns it into w(a0)w(a_0), so flip-positivity requires ⟨w(a0)w(a1)⟩β≥0\langle w(a_0)\,w(a_1)\rangle_\beta\ge0. Let's compute it with the trace rule on a stack of N=8N=8 layers, for both signs of β\beta, and for several separations pp.

def flip_overlap(T, f, p, N):
    """<f(a_0) f(a_p)> on a periodic stack of N layers, by the trace rule."""
    D = np.diag(f)
    return np.trace(D @ mp(T, p) @ D @ mp(T, N - p)) / np.trace(mp(T, N))

w3_ = layer_labelings(3).prod(axis=1)
for b in [0.7, -0.7]:
    Tb = coin_transfer_matrix(3, b)
    vals = "  ".join(f"p={p}: {flip_overlap(Tb, w3_, p, 8):+.4f}" for p in [1, 2, 3, 4])
    ev_ = np.linalg.eigvalsh(Tb); nz = ev_[np.abs(ev_) > 1e-9][::-1]
    print(f"beta = {b:+.1f}   nonzero eigenvalues of T: {np.round(nz, 3)}   {vals}")
beta = +0.7   nonzero eigenvalues of T: [15.498  3.421]   p=1: +0.2208  p=2: +0.0488  p=3: +0.0113  p=4: +0.0047
beta = -0.7   nonzero eigenvalues of T: [1033.487 -228.144]   p=1: -0.2208  p=2: +0.0488  p=3: -0.0113  p=4: +0.0047

At β=+0.7\beta=+0.7 every overlap is positive. At β=−0.7\beta=-0.7 one eigenvalue of TT is negative, and the overlaps for odd separations (p=1,3p=1,3, the between-layers mirror) are negative, exactly as Fact 5.3 predicts. Even separations stay positive.

Is this an artifact of matrices? Ask the black box: sample the β=−0.7\beta=-0.7 model directly with the Metropolis rule of chapter 4, and measure the average product of neighbouring layers' loop products.

Bneg = Board.grid(3, 8, periodic=True)
chain = Model(Bneg, Z2(), beta=-0.7).metropolis(rng, n_samples=3000, burn_in=200)
eneg = Bneg.meta["edge_index"]
w_rows = np.stack([np.prod([chain[:, eneg[(x + 3 * k, 0)]] for x in range(3)], axis=0) for k in range(8)], 1)
measured = np.mean(w_rows * np.roll(w_rows, -1, axis=1))
print(f"sampled <w(a_k) w(a_k+1)> at beta=-0.7: {measured:+.3f}    trace rule: {flip_overlap(coin_transfer_matrix(3, -0.7), w3_, 1, 8):+.3f}")
sampled <w(a_k) w(a_k+1)> at beta=-0.7: -0.224    trace rule: -0.221

The samples agree: neighbouring layers really are anti-aligned. With such a model, section 5.4's levels make no sense (−log-\log of a negative ratio), and the derived system of section 5.8 can't be built.

Why it holds for our models: a sum of squares

For β≥0\beta\ge0 it never fails, and for the coin model we can see exactly why. Write one face's weight, for a face product f=±1f=\pm1. Since eβf=cosh⁡(βf)+sinh⁡(βf)e^{\beta f}=\cosh(\beta f)+\sinh(\beta f), and cosh\cosh is even while sinh\sinh is odd, eβf=cosh⁡β+fsinh⁡βe^{\beta f}=\cosh\beta+f\sinh\beta. So:

e−β(1−f)=e−β(cosh⁡β+fsinh⁡β). e^{-\beta(1-f)}=e^{-\beta}\big(\cosh\beta+f\,\sinh\beta\big).

Multiply this over the WW faces of a slab and expand the product: 2W2^W terms, each picking, for every face, either cosh⁡β\cosh\beta or fsinh⁡βf\sinh\beta. Now sum over the step labels ss. A step label sxs_x appears in two faces, x−1x-1 and xx. If a term picks fsinh⁡βf\sinh\beta in exactly one of them, that term is sxs_x times something not involving sxs_x, and summing over sx=±1s_x=\pm1 gives (+1)+(−1)=0(+1)+(-1)=0: the term dies. If it picks both, sxs_x appears squared, sx2=1s_x^2=1, and it survives. So a term survives only if, for every xx, faces x−1x-1 and xx are picked alike; going around the ring, that means all faces alike. That leaves just two terms: "pick cosh⁡β\cosh\beta everywhere", and "pick fsinh⁡βf\sinh\beta everywhere". In the second, the product of the WW face products axsx+1bxsxa_x\,s_{x+1}\,b_x\,s_x is w(a)w(b)w(a)\,w(b) times ∏xsx2=1\prod_xs_x^2=1. Neither surviving term depends on ss, so each of the 2W2^W choices of ss contributes the same, and

T(a,b)=(2e−β)W(cosh⁡Wβ+sinh⁡Wβw(a)w(b)). T(a,b)=\big(2e^{-\beta}\big)^W\Big(\cosh^W\!\beta\;+\;\sinh^W\!\beta\;w(a)\,w(b)\Big).

In matrix form, with 𝟏\mathbf 1 the all-ones vector and ww the vector of loop products,

T=c0𝟏𝟏⊤+c1ww⊤,c0=(2e−βcosh⁡β)W,c1=(2e−βsinh⁡β)W. T=c_0\,\mathbf 1\mathbf 1^{\top}+c_1\,w\,w^{\top},\qquad c_0=(2e^{-\beta}\cosh\beta)^W,\quad c_1=(2e^{-\beta}\sinh\beta)^W .

The vectors 𝟏\mathbf 1 and ww are orthogonal (𝟏⊤w=∑aw(a)=0\mathbf 1^{\top}w=\sum_aw(a)=0, since half the labelings have w=+1w=+1), and each has squared length 2W2^W. So T𝟏=2Wc0𝟏T\mathbf 1=2^Wc_0\,\mathbf 1 and Tw=2Wc1wTw=2^Wc_1\,w, while TT kills every vector orthogonal to both. That explains everything we saw in 5.3 and 5.4 at once: two distinct entries, only 𝟏\mathbf 1 and ww survive, all other eigenvalues are zero, λ0=2Wc0\lambda_0=2^Wc_0, λ1=2Wc1\lambda_1=2^Wc_1, and λ1/λ0=c1/c0=tanh⁡Wβ\lambda_1/\lambda_0=c_1/c_0=\tanh^W\!\beta. And for any vector ff,

f⊤Tf=c0(∑af(a))2+c1(∑aw(a)f(a))2, f^{\top}Tf=c_0\Big(\sum_a f(a)\Big)^2+c_1\Big(\sum_a w(a)f(a)\Big)^2,

a sum of squares with coefficients c0,c1c_0,c_1. When β≥0\beta\ge0 both coefficients are nonnegative, so f⊤Tf≥0f^{\top}Tf\ge0 for every ff; taking ff to be an eigenvector shows that TT can never have a negative eigenvalue. When β<0\beta<0 and WW is odd, c1<0c_1<0, and that is the failure we just watched.

for b in [0.7, -0.7]:
    c0, c1 = (2 * np.exp(-b) * np.cosh(b)) ** 3, (2 * np.exp(-b) * np.sinh(b)) ** 3
    closed = c0 * np.ones((8, 8)) + c1 * np.outer(w3_, w3_)
    print(f"beta = {b:+.1f}: closed form matches T: {np.allclose(closed, coin_transfer_matrix(3, b))},   c0 = {c0:.4f}, c1 = {c1:+.4f}")
beta = +0.7: closed form matches T: True,   c0 = 1.9372, c1 = +0.4276
beta = -0.7: closed form matches T: True,   c0 = 129.1859, c1 = -28.5180

The same mechanism works for every group. Above, we expanded the weight of one face in two special functions of the face product, 11 and ff. For a general GG the special functions are the characters of GG (for the coin model, 11 and ff; for the circle, the functions einθe^{in\theta}, n∈ℤn\in\mathbb Z, that 5.7 will use as eigenfunctions of the ring's walk). For the standard face cost every coefficient of that expansion is nonnegative when β≥0\beta\ge0. For the circle, the expansion is eβcos⁡θ=∑nIn(β)einθe^{\beta\cos\theta}=\sum_nI_n(\beta)\,e^{in\theta}, with the Bessel numbers In(β)≥0I_n(\beta)\ge0 we will meet again in 5.7. Nonnegative coefficients make the weight across the mirror a sum of "(something about the top half) × (the same thing about the bottom half)", which is a sum of squares. This argument, done carefully for all upper-half functions, not just single layers, is the theorem of Osterwalder and Seiler (1978).

Fact 5.4 (flip-positivity of our models; Osterwalder–Seiler). For the standard face costs of glossary 4.2 (including the coin and circle costs), any compact label group, any dimension and any β≥0\beta\ge0, the model on a periodic grid with an even number of layers is flip-positive for the mirror between layers, for every function of the upper half. In particular TT has no negative eigenvalues. (For the mirror through a layer, the single-layer case is automatic, as Fact 5.3 showed; we won't need more than that.)

We don't prove Fact 5.4 here; the coin-model computation above is the single-layer case of it.

th = np.linspace(-np.pi, np.pi, 7)
n_ = np.arange(-30, 31)
series = np.real(np.exp(1j * np.outer(th, n_)) @ ive(n_, 2.0)) * np.exp(2.0)  # sum_n I_n(2) e^{in theta}
print("circle expansion reproduces e^{beta cos theta}:", np.allclose(series, np.exp(2.0 * np.cos(th))))
print("smallest coefficient I_n(2), n = 0..30:", f"{(ive(np.arange(31), 2.0) * np.exp(2.0)).min():.2e}", "(all positive)")
circle expansion reproduces e^{beta cos theta}: True
smallest coefficient I_n(2), n = 0..30: 3.89e-33 (all positive)

What flip-positivity buys: an inner product

Here is the reason flip-positivity is central rather than technical. For two functions F,F′F,F' of the upper half, define

⟨F,F′⟩θ=⟨θF¯F′⟩β∈ℂ. \langle F,F'\rangle_\theta=\big\langle\,\overline{\theta F}\;F'\,\big\rangle_\beta\ \in\mathbb C .

This is linear in F′F' and conjugate-linear in FF. Swapping FF and F′F' conjugates it (apply the symmetry θ\theta inside the average, and use θθ=\theta\theta= identity). And flip-positivity says exactly that ⟨F,F⟩θ≥0\langle F,F\rangle_\theta\ge0. So it is an inner product on functions of the upper half, except that some nonzero functions may have length zero. Throw those away (formally: take the quotient by them), and what is left is a genuine inner-product space, built from nothing but the distribution and the mirror.

For single-layer functions, take the mirror between layers 0 and 1, and F=f(a1)F=f(a_1), F′=g(a1)F'=g(a_1), so θF=f(a0)\theta F=f(a_0). The trace rule gives ⟨F,F′⟩θ=tr⁡(DfTDgTN−1)/tr⁡TN\langle F,F'\rangle_\theta=\operatorname{tr}(D_f\,T\,D_g\,T^{N-1})/\operatorname{tr}T^N. On a tall stack TN−1≈λ0N−1v0v0⊤T^{N-1}\approx\lambda_0^{N-1}v_0v_0^{\top} and tr⁡TN≈λ0N\operatorname{tr}T^N\approx\lambda_0^N (5.2), so this tends to (Dfv0)⊤T(Dgv0)/λ0(D_fv_0)^{\top}T(D_gv_0)/\lambda_0. For the coin model v0=𝟏/2Wv_0=\mathbf 1/\sqrt{2^W} is constant, so the inner product is proportional to f⊤Tgf^{\top}Tg. The functions of length zero are those with f⊤Tf=0f^{\top}Tf=0. For a matrix with no negative eigenvalues that forces Tf=0Tf=0 (expand ff in eigenvectors), so they are exactly the functions TT erases: the non-invariant ones of 5.4. What survives are the functions of the loop product. That is the 2-dimensional space we have been working in all along, now obtained from the flip.

G_flip = T3 / np.linalg.eigvalsh(T3).max()        # the flip inner product on single-layer functions
print("rank of the flip inner product on the 8 single-layer functions:", np.linalg.matrix_rank(G_flip, tol=1e-9))
print("its eigenvalues (all >= 0):", np.round(np.linalg.eigvalsh(G_flip), 6) + 0.0)
rank of the flip inner product on the 8 single-layer functions: 2
its eigenvalues (all >= 0): [0.       0.       0.       0.       0.       0.       0.220752 1.      ]

In general, the vector space of a quantum system is constructed exactly this way: functions of the upper half, with the flip inner product, modulo the functions of length zero. The transfer matrix then acts on it as a positive operator. This is the Osterwalder–Schrader construction (named in the dictionary). It is also why flip-positivity is one of the requirements in the Millennium problem (chapter 6): it is an inequality between averages, so it survives limits, and with it the inner product survives too.

Recap. A mirror through a layer or between two layers swaps the upper and lower halves of the stack. Flip-positivity says a function of the upper half and its mirror image never have a negative average product. For single layers it means TT has no negative eigenvalue; it fails for negative stiffness, as sampling confirms. For our models it holds because the weight across the mirror is a sum of squares with nonnegative coefficients. Its payoff is an inner product on functions of the upper half: the vector space of the derived system.

Check yourself

  1. Why is the through-a-layer mirror "automatically" positive for single-layer functions, even at negative stiffness?
Answer

A layer and its mirror image are an even number 2t2t of slabs apart (and N−2tN-2t is even too). Even powers of real eigenvalues are nonnegative, so every term λm2tλnN−2t(vm⊤Dfvn)2\lambda_m^{2t}\lambda_n^{N-2t}(v_m^\top D_fv_n)^2 is nonnegative.

  1. Coin model with W=4W=4 and β=−0.7\beta=-0.7: does the single-layer test pass?
Answer

Yes: c1=(2e−βsinh⁡β)4≥0c_1=(2e^{-\beta}\sinh\beta)^4\ge0 because the power is even, so TT is still a sum of squares. With 4 faces per slab, the favourite slab (all faces defects) has an even number of defects, so it no longer flips the loop product.

  1. What is ⟨F,F⟩θ\langle F,F\rangle_\theta for a constant function F=cF=c?
Answer

⟨c‾c⟩β=|c|2\langle\bar c\,c\rangle_\beta=|c|^2, which is >0>0 for c≠0c\neq0. Constants always have positive length; for the coin model the constant function is (up to normalization) the eigenvector v0v_0 of TT.

5.7 The circle: free motion on a group

Now let the labels be angles, G=U(1)G=U(1), with face cost φ(θ)=1−cos⁡θ\varphi(\theta)=1-\cos\theta. Fact 5.2 still holds: the ring's loop product w∈U(1)w\in U(1) is a random walk on the circle, and each step adds WW independent angles, each with density proportional to eβcos⁡θe^{\beta\cos\theta}.

A random walk on a circle is diagonalized by the functions χn(w)=einw\chi_n(w)=e^{in w}, n∈ℤn\in\mathbb Z (the characters of U(1)U(1)). One step multiplies χn\chi_n by the average of einθe^{in\theta} over one step. For one face that average is a ratio of Bessel functions, In(β)/I0(β)I_n(\beta)/I_0(\beta), so

λnλ0=(In(β)I0(β))W,En=−Wlog⁡In(β)I0(β). \frac{\lambda_n}{\lambda_0}=\Big(\frac{I_n(\beta)}{I_0(\beta)}\Big)^W,\qquad E_n=-W\log\frac{I_n(\beta)}{I_0(\beta)} .

For a stiff model each face angle is small and roughly Gaussian with variance 1/β1/\beta, so one step is roughly Gaussian with variance W/βW/\beta, and λn/λ0≈e−Wn2/(2β)\lambda_n/\lambda_0\approx e^{-Wn^2/(2\beta)}:

En≈W2βn2. E_n\approx\frac{W}{2\beta}\,n^2 .

The levels lie on a parabola. Let's check this against an honest matrix: replace the circle by K=64K=64 equally spaced angles, build the 64×6464\times64 transfer matrix of the walk, and take its eigenvalues.

def circle_levels_matrix(W, beta, K=64):
    p = np.exp(beta * np.cos(2 * np.pi * np.arange(K) / K)); p /= p.sum()   # one face
    step = p.copy()
    for _ in range(W - 1):                                                   # W faces in a slab
        step = np.real(np.fft.ifft(np.fft.fft(step) * np.fft.fft(p)))
    ev = np.sort(np.linalg.eigvalsh(circulant(step)))[::-1][:15]           # the top few levels
    return -np.log(ev / ev[0])

def circle_levels_bessel(W, beta, n):
    return -W * np.log(ive(n, beta) / ive(0, beta))
n = np.arange(0, 7)
fig, axs = plt.subplots(1, 2, figsize=(11, 3.8), sharey=False)
for ax, b in zip(axs, [2.0, 10.0]):
    Em = circle_levels_matrix(2, b)
    ax.plot(n, Em[[0] + [2 * k - 1 for k in n[1:]]], "o", color=viz.CORAL, ms=8, label="eigenvalues of a 64×64 matrix")
    ax.plot(n, circle_levels_bessel(2, b, n), "x", color=viz.INK, ms=8, mew=2, label="Bessel formula")
    nn = np.linspace(0, 6, 100)
    ax.plot(nn, 2 / (2 * b) * nn ** 2, color=viz.TEAL, label=r"parabola $\frac{W}{2\beta}n^2$")
    ax.set(title=fr"$W=2$, $\beta={b}$", xlabel="$n$", ylabel="level $E_n$")
    ax.legend(fontsize=8)
plt.show()
Two panels of energy levels E_n against n from 0 to 6 for W equal to 2, at stiffness 2 and 10. Eigenvalues of a 64 by 64 matrix (dots) match the Bessel formula (crosses); at stiffness 10 they lie on the parabola W n squared over 2 beta, and at stiffness 2 they bend below it for large n.

Each eigenvalue except the first comes twice, for nn and −n-n (the walk can't tell clockwise from counterclockwise), so we plot every second one. Matrix and formula agree. At β=10\beta=10 the levels sit right on the parabola; at β=2\beta=2 they bend below it for large nn, where the Gaussian approximation is too crude.

A parabola of levels En∝n2E_n\propto n^2 is famous: it is the spectrum of a free particle moving on a circle. Physicists call it a rotor. Here it was never put in. It came out of a distribution over labelings of a cylinder.

And the walk itself? Below are a few samples of the actual U(1)U(1) model on a 4×644\times64 torus at β=4\beta=4. For each sample we follow the angle wkw_k of every layer's loop product and draw it continuously (adding 2π2\pi whenever it wraps), starting from 00.

M = GridModel((4, 64), U1(), 4.0).hot_start(rng)
M.sweep(rng, 600)
fig, ax = plt.subplots(figsize=(8, 3.6))
for i in range(8):
    M.sweep(rng, 60)
    ang = np.unwrap(np.angle(M.U[0].prod(axis=0)))
    ax.plot(np.r_[ang, ang[0] + 2 * np.pi * np.round((ang[-1] - ang[0]) / (2 * np.pi))] - ang[0], lw=1.3)
for m in (-2, -1, 0, 1, 2):
    ax.axhline(2 * np.pi * m, color=viz.MUTED, lw=0.8, ls=":")
ks = np.arange(-2, 3)
ax.set(xlabel="layer $k$", ylabel=r"loop product angle $w_k - w_0$", yticks=2 * np.pi * ks,
       yticklabels=[r"$-4\pi$", r"$-2\pi$", "0", r"$2\pi$", r"$4\pi$"])
plt.show()
Eight random-walk paths of a layer's loop product angle over 64 layers, unwrapped, each starting at 0 and ending at a whole multiple of 2 pi, between minus 4 pi and 4 pi.

Each curve is a random walk path. Because the stack is periodic, each path has to come back to its starting point on the circle after 64 layers, but it may arrive having wound around the circle: on this unrolled picture every path ends at a whole multiple of 2π2\pi. The model is a weighted sum over all such paths.

Recap. For the circle group the ring's loop product does a random walk on the circle. Its eigenfunctions are the characters einwe^{inw}, with levels En=−Wlog⁡(In(β)/I0(β))≈W2βn2E_n=-W\log(I_n(\beta)/I_0(\beta))\approx\frac{W}{2\beta}n^2: the levels of a free particle on a circle, derived from a distribution.

Check yourself

  1. If you double the ring length WW, what happens to the levels?
Answer

They all double. In the parabola picture, W/(2β)W/(2\beta) plays the role of 1/(2⋅mass)1/(2\cdot\text{mass}): a longer ring is "lighter", so it wanders faster.

  1. Why does each level EnE_n with n≠0n\neq0 appear twice among the eigenvalues?
Answer

χn\chi_n and χ−n\chi_{-n} have the same eigenvalue, because the step distribution is symmetric (θ\theta and −θ-\theta equally likely).

5.8 Naming what we built

Step back and look at the objects we derived, using nothing but the model and a layering:

H=−log⁡T, H=-\log T ,

whose eigenvalues are the levels EnE_n (after subtracting the smallest, −log⁡λ0-\log\lambda_0);

This pair (vector space, HH) is the derived system of glossary 5.9. Physicists know it under another name. The vector space is a Hilbert space, HH is the Hamiltonian, its eigenvalues are energy levels, and the whole thing is a quantum system. The coin model on a ring derives a two-level system; the circle model derives a rotor. The periodic stack of NN layers corresponds to that quantum system at temperature 1/N1/N; a very tall stack means temperature near zero, where only the lowest levels matter.

The usual textbook order goes the other way round: start from a quantum system, write e−NHe^{-NH} as a product of NN small steps, insert complete sets of states between them, and call the result a path integral. We never assumed a Hilbert space or a Hamiltonian. We had a distribution on labelings, and they came out.

A word about real time. Our "time" direction is the layer index, and correlations decay like e−Ente^{-E_nt}. The quantum system's actual time evolution is e−iHte^{-iHt}: oscillations instead of decay. In principle the two determine each other, since both are built from the same HH. In practice, recovering oscillations from a sum of noisy decaying exponentials is a notoriously unstable inverse problem: tiny errors in C(t)C(t) hide large changes in the oscillating answer. That is why simulations of real-time dynamics are hard, and why people hope quantum computers will help.

Recap. The invariant functions of a layer, together with H=−log⁡TH=-\log T, form the derived system. Its eigenvalues are the levels. Physicists call it a quantum system, its vector space a Hilbert space and HH its Hamiltonian, but here it was derived from a distribution, not assumed.

Check yourself

  1. In the coin model on a ring, what is the "quantum system" we derived?
Answer

A 2-dimensional vector space (functions of w∈{±1}w\in\lbrace\pm1\rbrace) with levels 00 and −Wlog⁡tanh⁡β-W\log\tanh\beta: a two-level system.

  1. As the stack gets taller (N→∞N\to\infty), what happens to C(t)C(t) at fixed tt?
Answer

The mirror term e−E1(N−t)e^{-E_1(N-t)} and the e−E1Ne^{-E_1N} in the denominator vanish, leaving exactly e−E1te^{-E_1t}. Zero temperature: only the lowest level and the first one above it matter for this correlation.

Chapter recap

Dictionary

Our term Other names
layer, layer edge, step edge time slice; spatial link, temporal link
shift, flip time translation, time reflection
transfer matrix TT transfer matrix / transfer operator
layer constraint (Fact 5.1) Gauss's law
step edges set to the identity temporal gauge
Z=tr⁡TNZ=\operatorname{tr}T^N partition function
weight per layer λ0\lambda_0, 1Nlog⁡Z→log⁡λ0\frac1N\log Z\to\log\lambda_0 free energy per unit time; vacuum (ground-state) energy −log⁡λ0-\log\lambda_0
flip-positivity reflection positivity (Osterwalder–Schrader); Fact 5.4 is the Osterwalder–Seiler theorem
flip inner product ⟨F,G⟩θ\langle F,G\rangle_\theta the Osterwalder–Schrader inner product, from which the Hilbert space is built
H=−log⁡TH=-\log T, levels EnE_n Hamiltonian, energy levels
gap E1E_1 mass gap (the lightest state above the vacuum)
gap growing like W⋅W\cdotconst for a wrapped loop string tension: the energy of a flux loop grows with its length
derived system (invariant functions, HH) Hilbert space and Hamiltonian; a quantum system
random walk of the loop product, summed over paths path integral
circle levels ∝n2\propto n^2 quantum rotor; free particle on a circle
periodic stack of NN layers temperature 1/N1/N
rebuilding HH from correlations Osterwalder–Schrader reconstruction: the general theorem that a flip-positive distribution yields a Hilbert space and a Hamiltonian

What's next

We now have all the ingredients. A model on a board; invariants and averages; sampling; and a derived system with levels and a gap. Chapter 6 puts them together: take the board to be a four-dimensional grid and the label group to be a group of 3×33\times3 matrices, and you have the theory physicists call Yang–Mills. We will state, entirely in our terms, what the Millennium Prize problem about it asks, what is known, and what was proved this year.