Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Translationally invariant nearest-neighbour Hamiltonians on a 2D square lattice

Definition
usg_lattice_model

by LG · Sep 12, 2026 · Mathlib 0df444a (Lean v4.33.1)

mathematical-physicsquantum-informationspectral-gaptheoretical-computer-scienceundecidability

This file fixes the lattice model used throughout the mission.

For a side length LLL, the lattice is Λ(L)={0,…,L−1}2\Lambda(L)=\{0,\dots,L-1\}^2Λ(L)={0,…,L−1}2, whose elements are called sites; the first coordinate is the row index and the second the column index. Each site carries a ddd-dimensional quantum system, so the standard product basis of the whole lattice is indexed by the configurations, i.e. the assignments of a level in {0,…,d−1}\{0,\dots,d-1\}{0,…,d−1} to every site. Operators on the lattice are complex matrices indexed by configurations.

Open boundary conditions. The horizontal (row) edges are the pairs of sites in a common row whose column indices are consecutive, and the vertical (column) edges are the pairs of sites in a common column whose row indices are consecutive. No edges wrap around, so the outer rows and columns are not connected.

Embedding of local terms. A two-body interaction h∈B(Cd⊗Cd)h\in B(\mathbb{C}^d\otimes\mathbb{C}^d)h∈B(Cd⊗Cd) placed on an edge (p,q)(p,q)(p,q) acts as hhh on the two factors p,qp,qp,q and as the identity on every other site; an on-site term h1∈B(Cd)h_1\in B(\mathbb{C}^d)h1​∈B(Cd) acts as h1h_1h1​ on its site and as the identity elsewhere.

The Hamiltonian. Given an on-site matrix h1h_1h1​ and two two-body matrices hrow,hcolh_{\mathrm{row}},h_{\mathrm{col}}hrow​,hcol​, the same three matrices being used at every site and every edge, the model on Λ(L)\Lambda(L)Λ(L) is

HΛ(L)=∑(i,j) row edgehrow(i,j)+∑(i,j) column edgehcol(i,j)+∑k∈Λ(L)h1(k).H^{\Lambda(L)}=\sum_{(i,j)\ \text{row edge}}h_{\mathrm{row}}^{(i,j)}+\sum_{(i,j)\ \text{column edge}}h_{\mathrm{col}}^{(i,j)}+\sum_{k\in\Lambda(L)}h_1^{(k)} .HΛ(L)=(i,j) row edge∑​hrow(i,j)​+(i,j) column edge∑​hcol(i,j)​+k∈Λ(L)∑​h1(k)​.

This is the translational invariance used in the source: the interaction depends on the edge only through its direction.

Local interaction strength. max⁡{∥h1∥,∥hrow∥,∥hcol∥}\max\{\lVert h_1\rVert,\lVert h_{\mathrm{row}}\rVert,\lVert h_{\mathrm{col}}\rVert\}max{∥h1​∥,∥hrow​∥,∥hcol​∥}, where ∥⋅∥\lVert\cdot\rVert∥⋅∥ is the ℓ2\ell_2ℓ2​ operator norm.

The phase parameter. For n∈Nn\in\mathbb{N}n∈N, φ(n)\varphi(n)φ(n) is the rational number in [0,1)[0,1)[0,1) whose binary expansion after the point is the binary expansion of nnn written in reverse order: if n=bk−1⋯b1b0n=b_{k-1}\cdots b_1b_0n=bk−1​⋯b1​b0​ in binary then φ(n)=0.b0b1⋯bk−1\varphi(n)=0.b_0b_1\cdots b_{k-1}φ(n)=0.b0​b1​⋯bk−1​, and ∣φ(n)∣=k|\varphi(n)|=k∣φ(n)∣=k is the number of digits of nnn. These are the numbers appearing in the phases eiπφe^{i\pi\varphi}eiπφ and eiπ2−∣φ∣e^{i\pi 2^{-|\varphi|}}eiπ2−∣φ∣ of the main theorem.

The model is the standard finite-lattice spin-system setting of mathematical physics, and it is reused by every statement of this mission.

Definition code
import Mathlib

set_option autoImplicit false

namespace UndecidableSpectralGap

/-- The sites of the `L × L` square lattice `Λ(L) = {1,…,L}²`.
The first component is the row index, the second the column index. -/
abbrev Site (L : ℕ) := Fin L × Fin L

/-- A standard basis state of the lattice system with local dimension `d`:
an assignment of a level in `Fin d` to every site. -/
abbrev Config (L d : ℕ) := Site L → Fin d

/-- The directed horizontal (row) edges of `Λ(L)` with **open** boundary conditions:
pairs of sites in the same row whose column indices are consecutive. -/
def rowEdges (L : ℕ) : Finset (Site L × Site L) :=
  Finset.univ.filter fun e => e.1.1 = e.2.1 ∧ (e.1.2 : ℕ) + 1 = (e.2.2 : ℕ)

/-- The directed vertical (column) edges of `Λ(L)` with **open** boundary conditions:
pairs of sites in the same column whose row indices are consecutive. -/
def colEdges (L : ℕ) : Finset (Site L × Site L) :=
  Finset.univ.filter fun e => e.1.2 = e.2.2 ∧ (e.1.1 : ℕ) + 1 = (e.2.1 : ℕ)

/-- The two-body interaction `h` acting on the pair of sites `(p, q)` of the lattice,
written in the standard product basis: it acts as `h` on the factors `p` and `q`
and as the identity on all other sites. -/
def embedTwo {L d : ℕ} (p q : Site L) (h : Matrix (Fin d × Fin d) (Fin d × Fin d) ℂ) :
    Matrix (Config L d) (Config L d) ℂ :=
  fun c c' => if ∀ s, s ≠ p → s ≠ q → c s = c' s then h (c p, c q) (c' p, c' q) else 0

/-- The on-site interaction `h` acting on the site `p`, written in the standard product
basis: it acts as `h` on the factor `p` and as the identity on all other sites. -/
def embedOne {L d : ℕ} (p : Site L) (h : Matrix (Fin d) (Fin d) ℂ) :
    Matrix (Config L d) (Config L d) ℂ :=
  fun c c' => if ∀ s, s ≠ p → c s = c' s then h (c p) (c' p) else 0

/-- The translationally invariant nearest-neighbour Hamiltonian
`H^{Λ(L)} = Σ_rows h_row + Σ_columns h_col + Σ_sites h₁`
on the `L × L` square lattice with open boundary conditions, local dimension `d`,
on-site term `h₁`, horizontal interaction `hrow` and vertical interaction `hcol`. -/
def latticeHam (L d : ℕ) (h1 : Matrix (Fin d) (Fin d) ℂ)
    (hrow hcol : Matrix (Fin d × Fin d) (Fin d × Fin d) ℂ) :
    Matrix (Config L d) (Config L d) ℂ :=
  (∑ e ∈ rowEdges L, embedTwo e.1 e.2 hrow) + (∑ e ∈ colEdges L, embedTwo e.1 e.2 hcol)
    + ∑ p : Site L, embedOne p h1

/-- The operator norm (largest singular value) of a square complex matrix,
viewed as an operator on the Euclidean space of its index type. -/
noncomputable def opNorm {n : Type*} [Fintype n] [DecidableEq n] (A : Matrix n n ℂ) : ℝ :=
  ‖Matrix.toEuclideanCLM (𝕜 := ℂ) A‖

/-- The local interaction strength `max{‖h₁‖, ‖h_row‖, ‖h_col‖}` of a lattice model. -/
noncomputable def localInteractionStrength {d : ℕ} (h1 : Matrix (Fin d) (Fin d) ℂ)
    (hrow hcol : Matrix (Fin d × Fin d) (Fin d × Fin d) ℂ) : ℝ :=
  max (opNorm h1) (max (opNorm hrow) (opNorm hcol))

/-- `phi n` is the rational number `φ(n) ∈ [0,1)` whose binary fractional expansion consists
of the binary digits of `n` in reverse order after the point: if `n = b_{k-1}…b_1b_0` in
binary, then `φ(n) = 0.b_0b_1…b_{k-1}`. -/
def phi (n : ℕ) : ℚ :=
  ∑ i ∈ Finset.range n.size, if n.testBit i then (2 : ℚ) ^ (-(i + 1 : ℤ)) else 0

/-- `phiLen n` is the number `|φ(n)|` of binary digits of `n`, i.e. the length of the
fractional expansion of `φ(n)`. -/
def phiLen (n : ℕ) : ℕ := n.size

end UndecidableSpectralGap
Source
Cubitt, Perez-Garcia & Wolf, Undecidability of the Spectral Gap, Forum of Mathematics Pi 10:e14 (2022), pp. 1-102, doi:10.1017/fmp.2021.15, https://doi.org/10.1017/fmp.2021.15 (full version; same numbering as arXiv:1502.04573v5), Section 1.1 (Definitions and notation), pp. 2-3, eqs. (1.1)-(1.2) and the definition of the local interaction strength; Section 1.2, p. 3 (definition of the rational number phi(n)).
Read-back

What the Lean code literally says, in plain math · Aristotle (Harmonic)

This item introduces no claim; it fixes nine notions, and everything below is a definition.

Sites and configurations. For a natural number LLL, a site is a pair (r,c)(r,c)(r,c) with r,c∈{0,1,…,L−1}r,c \in \{0,1,\dots,L-1\}r,c∈{0,1,…,L−1}; the first coordinate is called the row index, the second the column index. For L=0L = 0L=0 there are no sites. For natural numbers LLL and ddd, a configuration is a function assigning to every site a level in {0,1,…,d−1}\{0,1,\dots,d-1\}{0,1,…,d−1}; the set of configurations is the index set of every matrix below, so a "state space" here is literally the set of such assignments, of cardinality dL2d^{L^2}dL2. Two degenerate readings are admitted: if d=0d = 0d=0 and L≥1L \ge 1L≥1 there are no configurations at all, and if L=0L = 0L=0 there is exactly one configuration (the empty assignment) for every ddd, including d=0d = 0d=0.

Edges. rowEdges(L)\mathrm{rowEdges}(L)rowEdges(L) is the finite set of ordered pairs of sites ((r1,c1),(r2,c2))\bigl((r_1,c_1),(r_2,c_2)\bigr)((r1​,c1​),(r2​,c2​)) such that r1=r2r_1 = r_2r1​=r2​ and c1+1=c2c_1 + 1 = c_2c1​+1=c2​ as natural numbers; colEdges(L)\mathrm{colEdges}(L)colEdges(L) is the set of ordered pairs with c1=c2c_1 = c_2c1​=c2​ and r1+1=r2r_1 + 1 = r_2r1​+1=r2​. Each horizontally (respectively vertically) adjacent pair therefore occurs exactly once, in the direction of increasing index, and no pair joins the last index to the first: there is no wrap-around. Both sets are empty when L≤1L \le 1L≤1.

Embedding of a two-body term. Given sites p,qp,qp,q and a matrix hhh indexed by pairs of levels, embedTwo p q h\mathrm{embedTwo}\,p\,q\,hembedTwopqh is the matrix indexed by configurations whose entry in row ccc and column c′c'c′ equals

h(c(p), c(q)), (c′(p), c′(q))h_{(c(p),\,c(q)),\,(c'(p),\,c'(q))}h(c(p),c(q)),(c′(p),c′(q))​

whenever c(s)=c′(s)c(s) = c'(s)c(s)=c′(s) holds for every site sss different from both ppp and qqq, and equals 000 otherwise. Nothing forbids p=qp = qp=q; in that case the defining formula is still read literally, with hhh evaluated at (c(p),c(p))(c(p),c(p))(c(p),c(p)) and the agreement condition imposed at all sites other than ppp.

Embedding of a one-body term. Given a site ppp and a matrix hhh indexed by levels, embedOne p h\mathrm{embedOne}\,p\,hembedOneph has entry hc(p), c′(p)h_{c(p),\,c'(p)}hc(p),c′(p)​ when c(s)=c′(s)c(s) = c'(s)c(s)=c′(s) for every site s≠ps \ne ps=p, and 000 otherwise.

The Hamiltonian. For L,dL, dL,d, an on-site matrix h1h_1h1​ of size d×dd \times dd×d and two matrices hrow,hcolh_{\mathrm{row}}, h_{\mathrm{col}}hrow​,hcol​ of size d2×d2d^2 \times d^2d2×d2 (indexed by pairs of levels), all with complex entries,

HΛ(L)  =  ∑e∈rowEdges(L)embedTwo e1 e2 hrow  +  ∑e∈colEdges(L)embedTwo e1 e2 hcol  +  ∑pembedOne p h1,H^{\Lambda(L)} \;=\; \sum_{e \in \mathrm{rowEdges}(L)} \mathrm{embedTwo}\,e_1\,e_2\,h_{\mathrm{row}} \;+\; \sum_{e \in \mathrm{colEdges}(L)} \mathrm{embedTwo}\,e_1\,e_2\,h_{\mathrm{col}} \;+\; \sum_{p} \mathrm{embedOne}\,p\,h_1 ,HΛ(L)=e∈rowEdges(L)∑​embedTwoe1​e2​hrow​+e∈colEdges(L)∑​embedTwoe1​e2​hcol​+p∑​embedOneph1​,

the last sum running over all sites. The same three matrices are used at every edge and every site; no dependence on the position enters. No hypothesis of Hermiticity, positivity or normalisation is imposed at this point, and for L≤1L \le 1L≤1 the two edge sums are empty.

Operator norm. For a square complex matrix AAA indexed by a finite type with decidable equality, ∥A∥\lVert A\rVert∥A∥ is the norm of the associated continuous linear operator on the Euclidean (i.e. ℓ2\ell^2ℓ2) space on that index type — the largest singular value of AAA. The local interaction strength of a triple is

max⁡{∥h1∥, ∥hrow∥, ∥hcol∥}.\max\bigl\{\lVert h_1\rVert,\ \lVert h_{\mathrm{row}}\rVert,\ \lVert h_{\mathrm{col}}\rVert\bigr\}.max{∥h1​∥, ∥hrow​∥, ∥hcol​∥}.

The rational φ\varphiφ. For a natural number nnn, let kkk be the number of binary digits of nnn (so k=0k = 0k=0 for n=0n = 0n=0, and in general 2k−1≤n<2k2^{k-1}\le n<2^k2k−1≤n<2k for n≥1n\ge 1n≥1). Then φ(n)  =  ∑i=0k−1[i-th binary digit of n is 1]  2−(i+1)  ∈  Q,\varphi(n) \;=\; \sum_{i=0}^{k-1} \bigl[\text{$i$-th binary digit of $n$ is }1\bigr]\; 2^{-(i+1)} \;\in\; \mathbb{Q},φ(n)=∑i=0k−1​[i-th binary digit of n is 1]2−(i+1)∈Q, i.e. the rational in [0,1)[0,1)[0,1) whose binary expansion after the point is the binary expansion of nnn read from the least significant digit; φ(0)=0\varphi(0) = 0φ(0)=0. Separately, ∣φ(n)∣|\varphi(n)|∣φ(n)∣ denotes that same digit count kkk, so ∣φ(0)∣=0|\varphi(0)| = 0∣φ(0)∣=0.

Provenance: this read-back was produced by the agent that drafted the item, not by an independent blind auditor.

Human review
  • Endorsed by Shuze Chen · Sep 15, 2026

  • Endorsed by LG · Sep 15, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me