This notebook is a self-contained mathematical and computational companion to the Difference bases section in the paper.
The task template, including the prompt given to the agents, is available here.
The outline is as follows:
- 1. Problem Definitions
- 2. S1. Independent recovery of a record in the Leech–Golay family.
- 3. Additional findings
- 4. Appendix: the classical one-frequency lower bound
The required packages are:
- None beyond the Python standard library.
1. Problem Definitions
The difference-basis problem asks how few integers are needed so that every distance from through occurs between two chosen integers. Its normalized limit measures how efficiently these distances can be covered as grows.
For a finite set , write
The set is a difference basis for if . Let be the smallest possible cardinality of such a set and let
Rédei and Rényi (1949) proved that the sequence converges to this infimum. A finite certificate therefore consists of a list of distinct marks, its complete positive-difference set, and the first positive integer absent from that set.
A set is a cyclic difference cover if every residue modulo occurs as for some . It is a planar difference set when every nonzero residue occurs exactly once as an ordered difference. This notebook verifies that property directly for the stored 90-point set.
The shared routines below are used by all verification cells. They authenticate and load the stored construction, form ordinary and cyclic differences, and identify the first missing positive difference.
Show code
Code cell 3 · In [1]
from __future__ import annotations
import ast
from bisect import bisect_left, bisect_right
import cmath
from collections import Counter
from fractions import Fraction
import hashlib
import json
import math
from pathlib import Path
import struct
DATA_PATH = Path("difference_basis_q89.npy")
METADATA_PATH = Path("construction_metadata.json")
PROVENANCE_PATH = Path("alphaevolve_provenance.json")
EXPECTED_NPY_SHA256 = "7b3032fa66098cf6af4c151bd7303366a05fd41cd442848c504322c0731f852a"
EXPECTED_BASIS_SHA256 = "498eaa873e07f473c282b00c8d7df51a706267d9438a99e1cef1c7abed1bc018"
EXPECTED_INNER_SHA256 = "8ccb0f4af4714bca24725a8acfb533c46b75cd752c3830c9c7e8308fc7df0ca4"
EXPECTED_PROVENANCE_SHA256 = "1daeee992a6346c22abed88665dc31b78dc131a85e0566abe1d0ad88d059ff47"
def sha256_bytes(payload: bytes) -> str:
return hashlib.sha256(payload).hexdigest()
def canonical_list_sha256(values) -> str:
payload = json.dumps(list(values), separators=(",", ":"), ensure_ascii=True).encode("ascii")
return sha256_bytes(payload)
def load_npy_v1_int64_vector(path: Path) -> tuple[int, ...]:
'Load precisely the bundled small no-pickle NumPy v1.0 format.'
if not path.is_file():
raise FileNotFoundError(f"required construction file is missing: {path}")
payload = path.read_bytes()
if sha256_bytes(payload) != EXPECTED_NPY_SHA256:
raise ValueError("construction SHA-256 mismatch")
if payload[:6] != b"\x93NUMPY" or payload[6:8] != bytes((1, 0)):
raise ValueError("expected a NumPy v1.0 file")
header_length = struct.unpack("<H", payload[8:10])[0]
header_end = 10 + header_length
header = ast.literal_eval(payload[10:header_end].decode("latin1").strip())
if header.get("descr") != "<i8" or header.get("fortran_order") is not False:
raise ValueError("expected a little-endian, C-order int64 array")
shape = header.get("shape")
if not isinstance(shape, tuple) or len(shape) != 1:
raise ValueError("expected a one-dimensional array")
count = int(shape[0])
body = payload[header_end:]
if len(body) != 8 * count:
raise ValueError("array length does not match its header")
return tuple(struct.unpack(f"<{count}q", body))
def positive_differences(values) -> set[int]:
ordered = sorted(values)
return {ordered[j] - ordered[i] for j in range(len(ordered)) for i in range(j)}
def first_missing_positive(differences: set[int]) -> int:
candidate = 1
while candidate in differences:
candidate += 1
return candidate
def cyclic_difference_counts(values, modulus: int) -> list[int]:
counts = [0] * modulus
for x in values:
for y in values:
counts[(x - y) % modulus] += 1
return counts
if not METADATA_PATH.is_file():
raise FileNotFoundError(f"required metadata file is missing: {METADATA_PATH}")
if not PROVENANCE_PATH.is_file():
raise FileNotFoundError(f"required public provenance file is missing: {PROVENANCE_PATH}")
metadata = json.loads(METADATA_PATH.read_text(encoding="utf-8"))
provenance_payload = PROVENANCE_PATH.read_bytes()
if sha256_bytes(provenance_payload) != EXPECTED_PROVENANCE_SHA256:
raise ValueError("public provenance SHA-256 mismatch")
public_provenance = json.loads(provenance_payload)
basis = load_npy_v1_int64_vector(DATA_PATH)
assert len(basis) == 360
assert tuple(sorted(set(basis))) == basis
assert canonical_list_sha256(basis) == EXPECTED_BASIS_SHA256
assert metadata["npy_sha256"] == EXPECTED_NPY_SHA256
assert metadata["basis_canonical_json_sha256"] == EXPECTED_BASIS_SHA256
print("Loaded and authenticated the 360-mark certificate.")
print(f"data SHA-256: {EXPECTED_NPY_SHA256}")
Saved output 1
Loaded and authenticated the 360-mark certificate. data SHA-256: 7b3032fa66098cf6af4c151bd7303366a05fd41cd442848c504322c0731f852a
2. S1. Independent recovery of a record in the Leech–Golay family.
This section certifies the central finding in the main write-up.
Let
The stored basis has the form
where has 90 elements.
Lemma 2.1 (product lift). Suppose is a cyclic difference cover and is a difference basis for . For any representatives , the product
is a difference basis for .
Proof. Fix and write with . If , choose an outer difference and use the same inner representative twice. If , then . A modular witness for has ordinary representative difference either or ; write it as with . The required outer difference is , where difference zero is obtained by repeating one mark. The resulting product difference is
This includes the endpoint .
Lemma 2.2 (the boundary exposed by a cyclic gap). Let be planar modulo , and choose representatives so that the cut lies in a cyclic gap of length . Then the ordinary positive differences of the representatives contain and omit .
Proof. Rotate the representatives so that the selected empty gap is the wraparound gap. Their ordinary span is . For , the unique modular witness for cannot wrap: a wrapped witness would have ordinary separation , larger than the span. Hence is an ordinary positive difference. The two endpoints of the empty gap give the unique modular witness for residue , and that witness wraps across the cut. An ordinary difference would be a second ordered modular witness, contradicting planarity.
Proposition 2.3 (top-layer boundary). If has maximum difference , then for ,
as an ordinary positive difference.
Proof. An inner difference lies strictly between and . In a representation of , any outer difference below would leave an inner term at least , which is impossible; an outer difference above is unavailable. Thus the outer difference must be and the inner difference must be .
Theorem 2.4 (the record). There exists a -element difference basis for . Consequently,
The exhibited basis misses .
Proof. The product constructed above is the required witness. The exact verification below establishes that is a planar difference set with wraparound gap , and that has distinct marks, covers every integer through , and misses .
The next cell authenticates the stored array, extracts its zero-th product layer, counts all modular differences, reconstructs all four product layers, and enumerates every ordinary positive difference.
Show code
Code cell 5 · In [2]
q = 89
v = q * q + q + 1
outer_seed = (0, 1, 4, 6)
assert v == 8011
assert metadata["q"] == q and metadata["v"] == v
assert tuple(metadata["outer_seed"]) == outer_seed
# The zero-th product layer is exactly the inner set.
inner = tuple(x for x in basis if 0 <= x < v)
assert len(inner) == q + 1 == 90
assert canonical_list_sha256(inner) == EXPECTED_INNER_SHA256
assert all(0 <= x < v for x in inner)
# Verify the Singer/planar property without trusting a generator.
modular_counts = cyclic_difference_counts(inner, v)
assert modular_counts[0] == len(inner)
assert all(count == 1 for count in modular_counts[1:])
# Verify the outer ruler and reconstruct all product layers exactly.
outer_differences = positive_differences(outer_seed)
assert set(range(1, 7)).issubset(outer_differences)
reconstructed = tuple(sorted(v * a + d for a in outer_seed for d in inner))
assert reconstructed == basis
assert len(reconstructed) == len(outer_seed) * len(inner) == 360
# Gap and boundary checks.
cyclic_gaps = [inner[i + 1] - inner[i] for i in range(len(inner) - 1)]
cyclic_gaps.append(inner[0] + v - inner[-1])
largest_gap = max(cyclic_gaps)
inner_positive = positive_differences(inner)
inner_first_missing = first_missing_positive(inner_positive)
assert largest_gap == 1044
assert inner[0] + v - inner[-1] == 1044
assert inner_first_missing == 1044
assert set(range(1, 1044)).issubset(inner_positive)
# Complete ordinary-difference verification of the 360 marks.
basis_positive = positive_differences(basis)
first_missing = first_missing_positive(basis_positive)
assert set(range(1, 49110)).issubset(basis_positive)
assert first_missing == 49110
assert 49110 not in basis_positive
# Check the exact top-layer equivalence for every residue, not only the prefix.
assert all(((6 * v + r) in basis_positive) == (r in inner_positive) for r in range(1, v))
score = Fraction(len(basis) ** 2, first_missing - 1)
assert score == Fraction(129600, 49109)
assert basis[-1] - basis[0] == 55033
# Reconstruct the public notebook's product independently from its bundled snapshot.
assert public_provenance["commit"] == "8f447457957deac61e28bf1676746f0753b3b2f8"
assert public_provenance["notebook_path"] == "experiments/difference_bases/difference_bases.ipynb"
assert public_provenance["cell_index_zero_based"] == 1
assert public_provenance["cell_source_sha256"] == "09d0ae46f30326be4abc52dfa9b0f596d70cc6aadc1e19b3946dce6a19a13b8e"
public_outer_seed = tuple(public_provenance["outer_seed"])
public_inner = tuple(public_provenance["inner_set"])
public_basis = tuple(sorted(v * a + d for a in public_outer_seed for d in public_inner))
assert public_outer_seed == outer_seed
assert canonical_list_sha256(public_inner) == EXPECTED_INNER_SHA256
assert canonical_list_sha256(public_basis) == public_provenance["basis_canonical_json_sha256"]
assert public_basis == basis
print("Finite construction certificate: PASS")
print(f"q={q}, v={v}, |D|={len(inner)}, |B|={len(basis)}")
print(f"largest cyclic gap={largest_gap}, ordinary inner prefix={inner_first_missing - 1}")
print(f"covered interval=1..{first_missing - 1}, first missing={first_missing}")
print(f"span={basis[-1] - basis[0]}, exact score={score}, decimal={float(score):.15f}")
print(f"canonical public-list digest={canonical_list_sha256(basis)}")
print("public 360-entry list comparison: PASS")
Saved output 1
Finite construction certificate: PASS q=89, v=8011, |D|=90, |B|=360 largest cyclic gap=1044, ordinary inner prefix=1043 covered interval=1..49109, first missing=49110 span=55033, exact score=129600/49109, decimal=2.639027469506608 canonical public-list digest=498eaa873e07f473c282b00c8d7df51a706267d9438a99e1cef1c7abed1bc018 public 360-entry list comparison: PASS
Verification provenance. The final digest uses the canonical byte string obtained by JSON-encoding the integer list with no spaces. The bundled provenance snapshot records the public seed and all 90 public inner marks from cell 1 of the commit-pinned AlphaEvolve notebook, together with that cell’s source digest. The cell above reconstructs the public 360-entry product from those marks and compares it entry-for-entry with the local certificate, rather than merely comparing scores.
Station Reference. The accepted 360-mark list and official score come from Eval #88. The product-lift and boundary endpoint proofs are in Archive #1, especially addendum archive_1-3. Evals #120, #132, and #180 independently checked the representative list, boundary prefix, and product mechanism.
Related Work. The Station result is an independent recovery of a known record, not a new result relative to the literature. Rédei and Rényi (1949) established the limiting constant, and Singer (1938) constructed planar cyclic difference sets. Leech (1956) and Golay (1972) combined the four-point basis with Singer difference sets to obtain earlier members of this construction family; see also Banakh and Gavrylkiv (2019). Bernshteyn and Tait (2019) record Golay’s preceding bound . The member gives , a new numerical upper bound within this classical family. The verification above establishes the Station construction’s entry-for-entry agreement with the construction reported by Georgiev et al. (2025).
3. Additional findings
These are additional results that may be interesting but are not included in the spotlight.
3.1 The Singer boundary advantage is asymptotically transient
For products built from planar Singer difference sets, we prove that the boundary extension is exactly one less than the largest cyclic gap. This identity explains the construction quantitatively: its score falls below precisely because its maximal gap exceeds . We then use the flat Fourier spectrum of a Singer set to show that every such gap is , uniformly over all multipliers. Consequently, the boundary contribution vanishes asymptotically and the four-layer Singer product converges to ; its finite record improvement cannot produce a smaller asymptotic constant.
For a cyclic set , define a cyclic gap of step to be the forward distance between two consecutive elements of ; it contains empty residues. Let
where is a planar difference set of order and multiplication is modulo .
Lemma 3.1 (gap identity). The optimized boundary run past is exactly .
Proof. Fix a multiplier and place the cut inside a cyclic gap of step . Any witness arc crossing that cut must span the entire empty gap, so the unique witnesses for residues do not cross it. The two endpoints of the gap give the unique witness for residue , and that witness does cross the cut. Thus this cut exposes exactly the ordinary prefix . Maximizing first over cuts and then over unit multipliers proves the identity.
Theorem 3.2 (flat-spectrum gap bound). Uniformly over all unit multipliers,
where .
Proof. For , use the Fourier transform
The autocorrelation of the indicator equals at zero and at every nonzero residue. Taking its Fourier transform therefore gives the exact flat spectrum
Multiplication by a unit only permutes the nonzero frequencies, so the same identity holds for every .
A gap of step contains an empty interval of length . Fourier inversion and the triangle inequality give
The integer is odd. For , the geometric-sum formula and concavity of sine on give
Pairing with yields
Substitution gives and hence the displayed bound for . Since and , this is .
Corollary 3.3 (vanishing finite dip). For the four-layer product with ,
and therefore
More precisely,
Proof. Lemma 3.1 gives the exact endpoint , while Theorem 3.2 gives . Substitution proves both the identity and the limit.
The sign of the finite dip is determined by whether .
The next cell exhausts all unit multipliers at , checks the flat spectrum numerically, and verifies the exact finite-dip identity.
Show code
Code cell 9 · In [3]
current_gap_q89 = max(cyclic_gaps)
G_q89 = 0
gap_argmax_units = []
for unit in range(1, v):
if math.gcd(unit, v) != 1:
continue
dilated = sorted((unit * mark) % v for mark in inner)
unit_gaps = [dilated[i + 1] - dilated[i] for i in range(len(dilated) - 1)]
unit_gaps.append(dilated[0] + v - dilated[-1])
unit_gap = max(unit_gaps)
if unit_gap > G_q89:
G_q89 = unit_gap
gap_argmax_units = [unit]
elif unit_gap == G_q89:
gap_argmax_units.append(unit)
R_q89 = G_q89 - 1
assert current_gap_q89 == G_q89 == 1044 and R_q89 == 1043
assert 6 * v + R_q89 == 49109
# Numerical evaluation of every nonzero Fourier magnitude; exact planarity was already checked.
max_flat_spectrum_error = 0.0
for frequency in range(1, v):
transform = sum(
cmath.exp(-2j * math.pi * frequency * mark / v) for mark in inner
)
max_flat_spectrum_error = max(
max_flat_spectrum_error,
abs(abs(transform) ** 2 - q),
)
assert max_flat_spectrum_error < 1e-8
harmonic = math.fsum(1 / j for j in range(1, (v - 1) // 2 + 1))
explicit_gap_upper = 1 + v * math.sqrt(q) * harmonic / (q + 1)
assert G_q89 <= explicit_gap_upper
dip = Fraction(8, 3) - score
dip_identity = (Fraction(8, 3) * R_q89 - 16 * q) / (6 * v + R_q89)
assert dip == dip_identity
assert R_q89 > 6 * q
print("Singer boundary-transience finite checks: PASS")
print(f"G={G_q89}, R=G-1={R_q89}, exact dip={dip}={float(dip):.12f}")
print(f"exhaustive unit scan: {len(gap_argmax_units)} maximizing multipliers")
print(f"maximum flat-spectrum numerical error={max_flat_spectrum_error:.3e}")
print(f"explicit harmonic gap upper bound={explicit_gap_upper:.3f}")
Saved output 1
Singer boundary-transience finite checks: PASS G=1044, R=G-1=1043, exact dip=4072/147327=0.027639197160 exhaustive unit scan: 6 maximizing multipliers maximum flat-spectrum numerical error=8.210e-10 explicit harmonic gap upper bound=7451.614
For , the exact finite values are , , and , explaining why this particular member lies below . The harmonic bound suffices to show uniformly that the boundary term is a vanishing fraction of .
Station Reference. The exact gap law comes from Archives #5 and #6. The score identity, flat-spectrum theorem, Dirichlet-kernel bound, and scope corrections come from Archive #7 and its addendum. Evals #132 and #180 give exhaustive finite checks of the gap identity, Eval #215 checks the exact dip identity, and Eval #228 checks the flat spectrum numerically. Question Room discussion #8 records the later asymptotic scope review.
Related Work. Lucia (2017), answering a question of Banakh, recorded the bound and noted that the logarithm can be removed. The boundary-gap relation belongs to the classical Leech–Golay analysis; the theorem above gives a self-contained derivation and applies it to the exact score.
4. Appendix: the classical one-frequency lower bound
This appendix records the classical lower-bound argument used for comparison.
Theorem 4.1 (one-frequency lower bound). Let be the unique solution of in . Then
Proof. Fix , and let be any difference basis for with . Define
The covering condition gives for . Expanding the square and using gives the exact finite identity
Every summand on the right is nonnegative. Since ,
Set , where is fixed, and apply the inequality to a minimum basis of size . Dividing by and taking a limit inferior, the cosine sum is a Riemann sum, so
This holds for every . On , the derivative of vanishes exactly when , equivalently . The function satisfies there, while ; hence there is one critical point . The sinc function is positive on . On its derivative has the sign of , so its value at the unique minimum is strictly below its endpoint value . For the sinc function is at least . Thus is its global minimum and gives the stated constant. Rédei–Rényi’s convergence theorem identifies the limit inferior with .
The code below locates by floating-point bisection of the monotone function and checks the constant.
Show code
Code cell 12 · In [4]
def stationary_numerator(u: float) -> float:
return u * math.cos(u) - math.sin(u)
lo = math.pi
hi = 1.5 * math.pi
assert stationary_numerator(lo) < 0 < stationary_numerator(hi)
for _ in range(200):
mid = (lo + hi) / 2
if stationary_numerator(mid) < 0:
lo = mid
else:
hi = mid
u_star = (lo + hi) / 2
sinc_u_star = math.sin(u_star) / u_star
K = 2 * (1 - sinc_u_star)
assert abs(math.tan(u_star) - u_star) < 1e-12
assert abs(sinc_u_star - math.cos(u_star)) < 1e-14
assert abs(K - 2.4344672564224433) < 1e-14
def finite_spectral_bound(n: int, u: float) -> float:
return 2 * math.fsum(1 - math.cos(t * u / n) for t in range(1, n + 1)) / n
finite_rows = [(n, finite_spectral_bound(n, u_star)) for n in (10, 100, 1000, 10_000)]
print(f"u_* = {u_star:.15f}")
print(f"sinc(u_*) = {sinc_u_star:.15f}")
print(f"K = {K:.15f}")
print("finite Riemann-sum bounds:")
for n, value in finite_rows:
print(f" n={n:5d}: {value:.12f}")
Saved output 1
u_* = 4.493409457909063 sinc(u_*) = -0.217233628211222 K = 2.434467256422443 finite Riemann-sum bounds: n= 10: 2.548855725390 n= 100: 2.446566488491 n= 1000: 2.435683759033 n=10000: 2.434588972475
The argument uses one consequence of spectral nonnegativity at one frequency. Averaging this same pointwise inequality over any probability distribution of frequencies cannot improve the result: an average of is at most its largest pointwise value . This obstruction is specific to averaging the one-frequency inequality; Yang and Liao (2022) obtain the stronger published bound from higher-order Fourier information.
Related Work. The argument reproduces the classical one-frequency bound of Leech (1956).