Manuscript En02-C@1 · En02-C-v1.tex · section · 7549c6df

Standalone exact finite checks

Standalone exact finite checks · lines 2088–2162

Back to manuscript

for survivors in ((), (0,), (0, 1)): matrix = reduced_matrix(v, w, survivors, h) size = len(matrix) for a in range(size): for b in range(size): expected = (F(1, size), 0) if i == j and a == b else ZERO need(matrix[a][b] == expected, "early prefix depends on message")

matrix = reduced_matrix(v, w, (0, 1, 2), h) for a in range(8): for b in range(8): if i == j: sign = 1 if i == 0 else -1 base = ONE if a == b else ZERO value = add(base, (sign * LZ[a][b][0], sign * LZ[a][b][1])) else: factor = (0, 1) if (i, j) == (0, 1) else (0, -1) value = add(LX[a][b], mul(factor, LY[a][b])) expected = (F(value[0], 8), F(value[1], 8)) need(matrix[a][b] == expected, "third-prefix matrix-unit certificate failed")

# Before W_2, carrier 1 has the same private marginal. injected = [encode_basis(i, injection_only=True) for i in (0, 1)] for i, j in product((0, 1), repeat=2): matrix = reduced_matrix(injected[i][0], injected[j][0], (0,), injected[i][1]) for a in range(2): for b in range(2): expected = (F(1, 2), 0) if i == j and a == b else ZERO need(matrix[a][b] == expected, "first emission is not private")

def check_streaming_branches(): encoded = [encode_basis(i) for i in (0, 1)] early = [circuit(v, EARLY_DECODER, h) for v, h in encoded]

for t, s in product((0, 1), repeat=2): residuals = [] for raw, h in early: branch = project(raw, 0: t, 1: s, (2, 3, 4)) branch, h = circuit(branch, (("SD", 0), ("H", 0)), h) if 1 - s: branch = gate(branch, ("Z", 0)) if 1 - t: branch = gate(branch, ("X", 0)) residuals.append((branch, h))

b0, h = residuals[0] b1, h1 = residuals[1] need(h == h1 == 7, "streaming normalization changed") e0 = project(b0, 0: 0, (1, 2)) e1 = project(b1, 0: 1, (1, 2)) wrong0 = project(b0, 0: 1, (1, 2)) wrong1 = project(b1, 0: 0, (1, 2)) need(all(a == ZERO for a in wrong0 + wrong1), "wrong logical branch value") need(e0 == e1, "branch loses logical coherence") need(F(sum(sq(a) for a in e0), 1 << h) == F(1, 4), "branch probability is not one quarter")

def swap_ops(a, b): return (("CX", a, b), ("CX", b, a), ("CX", a, b))

def bell_reflection(a, b): # Inverse Bell preparation, all-zero phase, Bell preparation. return (("CX", a, b), ("H", a), ("Z0", a, b), ("H", a), ("CX", a, b))

Nearby in this section