Manuscript En02-A@1 · En02-A-v1.tex · section · bb1319d5

Standalone computational specification

Standalone computational specification · lines 2508–2599

Back to manuscript

def finegrain_words(m, s=1): """Return certificate basis labels; amplitudes are 1/sqrt(M).""" m = primitive_multiplicities(m) require(len(m) <= 2 ** s, "too many outcome labels") words = [] refined = 0 for label, count in enumerate(m): for tie in range(count): words.append((label, refined, tie)) refined += 1 require(len(r for _, r, _ in words) == len(words), "refined labels repeat") require(len((k, e) for k, _, e in words) == len(words), "companions repeat") return tuple(words)

def binary_finegrain_net(N): require(isinstance(N, int) and N >= 1, "invalid capacity") out = F(0), F(1) # Every certificate has ceil(log2(M)) <= N - 1. # This is a complete capacity-derived bound, not a fixed cutoff. max_M = 1 << (N - 1) for M in range(2, max_M + 1): for m0 in range(1, M): if finegrain_cost((m0, M - m0), 1) <= N: out.add(F(m0, M)) return tuple(sorted(out))

def binary_certified_net(N): out = set(binary_finegrain_net(N)) for M in range(2, N + 1): for m0 in range(1, M): out.add(F(m0, M)) return tuple(sorted(out))

def binary_mesh(points): points = tuple(sorted(points)) require(points[0] == 0 and points[-1] == 1, "net must include endpoints") return max((b - a) / 2 for a, b in zip(points, points[1:]))

def phi_candidate(x, eta=F(1, 2)): return (x + eta * x * (1 - x) * (1 - 2 * x) * (x - F(1, 3)) * (x - F(2, 3)))

def exact_partial_compensation(): a, u, m = F(1, 3), F(1, 2), F(1, 4) pa, pm = phi_candidate(a), phi_candidate(m) row = (pa, 1 - pa) col = (pm, 1 - pm) J = (i, j): row[i] * col[j] for i in (0, 1) for j in (0, 1) for i in (0, 1): require(sum(J[i, j] for j in (0, 1)) == row[i], "wrong joint row") for j in (0, 1): require(sum(J[i, j] for i in (0, 1)) == col[j], "wrong joint column") # Assigned residual zero-weights are m and a respectively. for i in (0, 1): for j in (0, 1): require(J[i, j] == row[i] * col[j], "forward sequential mismatch") require(J[i, j] == col[j] * row[i], "reverse sequential mismatch") defect = (phi_candidate(a) * phi_candidate(u) - phi_candidate(m) * phi_candidate(a * u / m)) deviation = phi_candidate(F(1, 5)) - F(1, 5) require(defect == -F(5, 4608), "unexpected cocycle defect") require(deviation == F(28, 9375), "unexpected witness deviation") require(m != u, "compensation accidentally faithful") return "partial_joint": J, "cocycle_defect": defect, "candidate_deviation_at_1/5": deviation, "assigned_minus_projective_residual_weight": m - u, "status": "finite partial assignment, not admissibility",

def chi(a): require(0.0 <= a <= 1.0, "a outside [0,1]") return (sqrt(a), 0j, 0j, sqrt(1.0 - a))

Nearby in this section