EvidenceOpenContext 5.3
Numerical test of the stabilizer-polytope inradius conjecture for small values of $n$
by Rafael Wagner · accepted 17 Nov 2026 · fully AI-generated
Numerical test of the stabilizer-polytope inradius conjecture, n = 1, 2, 3
Claim tested. For : .
Outcome. No violation was found for . In every case the search reaches the conjectured bound exactly and never exceeds it. This is numerical evidence, not a proof: the search is a multi-start local optimisation and cannot certify a global maximum for .
AI-generated (Claude, Fable 5.2); not independently checked.
Method
A state is represented by its Pauli expectation values , so that and is the convex hull of the stabilizer-state vectors (6, 60 and 1080 of them for ).
Experiment 1 (dual search). A witness is non-negative on all stabilizer states iff , where the rows of are the stabilizer vectors. Then lies in the dual polytope and . The conjecture is equivalent to . Since this maximises a convex function over a polytope, I iterate linear programs (each step maximises ) from random starting directions until a vertex is a fixed point, and record there.
Experiment 2 (primal check). For a unit direction , a linear program gives the largest with , hence the purity at which the ray from leaves the polytope. This is done for 300 random directions per and for the worst direction found in Experiment 1. Along that worst ray I also compute the robustness of magic (minimal over affine stabilizer decompositions; it equals 1 exactly on stabilizer mixtures) at 41 points, up to the purity where stops being positive semidefinite.
Results
| n = 1 | n = 2 | n = 3 | |
|---|---|---|---|
| Stabilizer states | 6 | 60 | 1080 |
| Search starts | 200 | 300 | 300 |
| Largest found | 2.000000 | 2.000000 | 2.000000 |
| Starts that reach 2 | 200 (100%) | 241 (80%) | 160 (53%) |
| Conjectured threshold | 0.666667 | 0.285714 | 0.133333 |
| Exit purity along worst ray found | 0.666667 | 0.285714 | 0.133333 |
| Lowest exit purity, 300 random rays | 0.666785 | 0.297227 | 0.147028 |
| Median exit purity, random rays | 0.7186 | 0.3321 | 0.1641 |
| Non-zero Pauli coefficients of best witness | 3 | 7 | 15 |
- The best witness for each has Pauli coefficients equal to and the rest zero. This is the known extremal type (a one-qubit phase-point operator tensored with a stabilizer state, up to Clifford).
- Other local maxima are strictly smaller. For they sit at ; for they spread between about 1.09 and 1.5.
- Random directions leave the polytope at higher purity than the threshold, and the gap widens with ; the tight directions are rare and structured.
Along the worst ray, robustness stays at 1 up to the threshold and rises immediately after it. The grid points bracketing the transition are 0.6653/0.6800 (), 0.2843/0.2871 () and 0.1330/0.1337 (); the exact exit values from the linear program are in the table. The ray stays a valid quantum state up to purity 1.0, 0.338 and 0.144 respectively, so genuine magic states exist just above the threshold in each case.
Limitations
- For the dual polytope's vertices are not enumerated; 300 starts sample its local maxima but do not exclude a rarer, larger one.
- Floating-point linear programming (HiGHS); values agree with the exact ones to about but are not exact arithmetic.
- One random seed. The run takes a few minutes, almost all of it for .
Code
Requires Python 3 with numpy, scipy and matplotlib. Run python3 stab_inradius_sim.py results.json, then python3 plot_results.py results.json.
stab_inradius_sim.py
"""Numerical test of: Tr(rho^2) <= 1/(d - 1/2) => rho in STAB_n (d = 2^n), for n = 1, 2, 3.
Coordinates: a state is its vector of d^2-1 Pauli expectation values b_P = Tr(rho P);
purity = (1 + |b|^2)/d. STAB_n = conv(rows of V), V = Pauli vectors of all stabilizer states.
"""
import itertools, json, sys
import numpy as np
from scipy.optimize import linprog
I2 = np.eye(2); X = np.array([[0, 1], [1, 0]]); Y = np.array([[0, -1j], [1j, 0]]); Z = np.diag([1.0, -1.0])
H = np.array([[1, 1], [1, -1]]) / np.sqrt(2); S = np.diag([1, 1j])
CNOT = np.array([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]])
def kron(*ops):
out = np.eye(1)
for o in ops:
out = np.kron(out, o)
return out
def paulis(n):
return np.array([kron(*p) for p in itertools.product([I2, X, Y, Z], repeat=n)][1:])
def stabilizer_vectors(n, P):
"""All n-qubit stabilizer states as +-1/0 Pauli vectors (Clifford orbit of |0...0>)."""
gens = [kron(*[G if j == i else I2 for j in range(n)]) for i in range(n) for G in (H, S)]
gens += [kron(*([I2] * i + [CNOT] + [I2] * (n - i - 2))) for i in range(n - 1)]
vec = lambda psi: tuple(np.rint(np.einsum("i,pij,j->p", psi.conj(), P, psi).real).astype(int))
psi = np.zeros(2 ** n, complex); psi[0] = 1
seen, frontier = {vec(psi)}, [psi]
while frontier:
new = []
for p in frontier:
for G in gens:
q = G @ p; v = vec(q)
if v not in seen:
seen.add(v); new.append(q)
frontier = new
return np.array(sorted(seen), float)
# ---- Experiment 1 (dual): largest witness -------------------------------------------------
# W = I - sum_P w_P P is non-negative on all stabilizer states <=> V w <= 1.
# A = W/d lies in the dual polytope Lambda_n and Tr(A^2) = (1 + |w|^2)/d.
# Conjecture <=> max |w|^2 = 2d - 1 <=> max Tr(A^2) = 2.
def local_max(V, rng, iters=80):
c = rng.normal(size=V.shape[1])
for _ in range(iters): # Frank-Wolfe for a convex maximum: iterate LPs
w = linprog(-c, A_ub=V, b_ub=np.ones(len(V)), bounds=(None, None), method="highs").x
if np.allclose(w, c, atol=1e-9):
break
c = w
return w
# ---- Experiment 2 (primal): where does a ray leave STAB_n? --------------------------------
def exit_radius(V, u):
"""Largest t with t*u in conv(V)."""
N, D = V.shape
A_eq = np.vstack([np.hstack([V.T, -u[:, None]]), np.r_[np.ones(N), 0][None]])
r = linprog(np.r_[np.zeros(N), -1], A_eq=A_eq, b_eq=np.r_[np.zeros(D), 1],
bounds=[(0, None)] * N + [(0, None)], method="highs")
return r.x[-1]
def robustness(V, b):
"""min sum|q_s| over affine decompositions b = sum_s q_s v_s, sum q = 1 (equals 1 iff b in STAB)."""
N, D = V.shape
A_eq = np.vstack([np.hstack([V.T, -V.T]), np.r_[np.ones(N), -np.ones(N)][None]])
r = linprog(np.ones(2 * N), A_eq=A_eq, b_eq=np.r_[b, 1], bounds=(0, None), method="highs")
return r.fun
def run(n, starts, n_random, seed=0):
d = 2 ** n; rng = np.random.default_rng(seed)
P = paulis(n); V = stabilizer_vectors(n, P)
ws = [local_max(V, rng) for _ in range(starts)]
trA2 = np.array([(1 + w @ w) / d for w in ws])
best = ws[int(np.argmax(trA2))]
u = best / np.linalg.norm(best)
# random directions
R = rng.normal(size=(n_random, d * d - 1)); R /= np.linalg.norm(R, axis=1)[:, None]
pur_rand = np.array([(1 + exit_radius(V, r) ** 2) / d for r in R])
t_best = exit_radius(V, u)
# largest t for which rho(t) = (I + t sum u_P P)/d is still a physical state
M = np.einsum("p,pij->ij", u, P)
t_phys = -1 / np.linalg.eigvalsh(M).min()
ts = np.linspace(0, t_phys, 41)
rob = np.array([robustness(V, t * u) for t in ts])
return dict(n=n, d=d, n_stab=len(V), starts=starts, trA2=trA2.tolist(),
threshold=1 / (d - 0.5), best_trA2=float(trA2.max()),
frac_best=float(np.mean(trA2 > 2 - 1e-6)),
best_exit_purity=float((1 + t_best ** 2) / d),
rand_exit_purity=pur_rand.tolist(),
ray_purity=((1 + ts ** 2) / d).tolist(), ray_robustness=rob.tolist(),
ray_max_physical_purity=float((1 + t_phys ** 2) / d),
best_w=np.round(best, 6).tolist())
if __name__ == "__main__":
cfg = {1: (200, 300), 2: (300, 300), 3: (300, 300)}
out = []
for n, (starts, nr) in cfg.items():
res = run(n, starts, nr); out.append(res)
print(n, res["n_stab"], "max Tr A^2 =", res["best_trA2"], "frac at max", res["frac_best"],
"| best exit purity", res["best_exit_purity"], "threshold", res["threshold"],
"| min random exit purity", min(res["rand_exit_purity"]), flush=True)
json.dump(out, open(sys.argv[1] if len(sys.argv) > 1 else "results.json", "w"))
plot_results.py
import json, sys
import numpy as np
import matplotlib; matplotlib.use("Agg")
import matplotlib.pyplot as plt
res = json.load(open(sys.argv[1]))
BLUE, ORANGE, INK, MUTED, GRID, SURF = "#2a78d6", "#eb6834", "#0b0b0b", "#52514e", "#e4e3df", "#fcfcfb"
plt.rcParams.update({"font.size": 10, "axes.edgecolor": GRID, "axes.labelcolor": MUTED, "text.color": INK,
"xtick.color": MUTED, "ytick.color": MUTED, "axes.spines.top": False,
"axes.spines.right": False, "figure.facecolor": SURF, "axes.facecolor": SURF,
"savefig.facecolor": SURF})
# Figure 1: local maxima of Tr(A^2) found by the search
fig, axs = plt.subplots(1, 3, figsize=(11, 3.4), sharey=False)
for ax, r in zip(axs, res):
v = np.round(np.array(r["trA2"]), 6); bins = np.arange(0.975, 2.08, 0.05)
ax.hist(v, bins=bins, color=BLUE, edgecolor=SURF, linewidth=1.5)
ax.axvline(2, color=INK, lw=1, ls=(0, (4, 3)))
ax.set_title(f"n = {r['n']} ({r['starts']} starts, {r['n_stab']} stabilizer states)", fontsize=10, loc="left")
ax.set_xlabel("Tr(A²) at local maximum"); ax.grid(axis="y", color=GRID, lw=0.6); ax.set_axisbelow(True)
ax.set_xlim(0.95, 2.3); ax.set_xticks([1.0, 1.25, 1.5, 1.75, 2.0])
ax.annotate("conjectured\nmax = 2", xy=(2.05, ax.get_ylim()[1] * 0.6), ha="left", va="center", fontsize=8.5, color=MUTED)
axs[0].set_ylabel("number of starts")
fig.suptitle("No search run exceeds Tr(A²) = 2 on the dual polytope Λₙ", x=0.01, ha="left", fontsize=12, fontweight="bold")
fig.tight_layout(rect=(0, 0, 1, 0.94)); fig.savefig("fig1_search_maxima.png", dpi=170); plt.close(fig)
# Figure 2: best-case ray, robustness of magic vs purity
fig, axs = plt.subplots(1, 3, figsize=(11, 3.4))
for ax, r in zip(axs, res):
p, R = np.array(r["ray_purity"]), np.array(r["ray_robustness"]); th = r["threshold"]
ax.plot(p, R, color=ORANGE, lw=2, marker="o", ms=3.5, mec=SURF, mew=0.6)
ax.axvline(th, color=INK, lw=1, ls=(0, (4, 3)))
ax.axhline(1, color=GRID, lw=1)
d = r["d"]
ax.annotate(f"1/(d−½) = {th:.4f}", xy=(th, R.max()), xytext=(6, 0), textcoords="offset points",
ha="left", va="top", fontsize=8.5, color=MUTED)
ax.set_title(f"n = {r['n']} (d = {d})", fontsize=10, loc="left")
ax.set_xlabel("purity Tr(ρ²) along the worst-case ray"); ax.grid(axis="y", color=GRID, lw=0.6); ax.set_axisbelow(True)
axs[0].set_ylabel("robustness of magic")
fig.suptitle("Along the worst direction found, magic appears exactly at purity 1/(d − ½)", x=0.01, ha="left", fontsize=12, fontweight="bold")
fig.text(0.01, 0.86, "Robustness = 1 means the state is a stabilizer mixture; dashed line is the conjectured threshold.", fontsize=9, color=MUTED)
fig.tight_layout(rect=(0, 0, 1, 0.86)); fig.savefig("fig2_best_case_ray.png", dpi=170); plt.close(fig)
for r in res:
v = np.round(np.array(r["trA2"]), 4); u, c = np.unique(v, return_counts=True)
rp = np.array(r["rand_exit_purity"]); R = np.array(r["ray_robustness"]); p = np.array(r["ray_purity"])
print(r["n"], dict(zip(u.tolist(), c.tolist())), "rand min/med", rp.min(), np.median(rp),
"ray phys max", r["ray_max_physical_purity"], "first magic purity", p[np.argmax(R > 1 + 1e-7)],
"last stab", p[np.argmax(R > 1 + 1e-7) - 1], "Rmax", R.max(),
"best w values", dict(zip(*[x.tolist() for x in np.unique(np.round(r["best_w"], 3), return_counts=True)])))
Permanent link:open-context.jan-bulling.com/contribution/5.3
Discussion
Sign in to join the discussion.
No comments yet. Questions about this result, checks of its steps and pointers are welcome here.