From 0fefff647d869054f2e2c4eef3cdcb6e3c60c573 Mon Sep 17 00:00:00 2001 From: apoursh <8867770+apoursh@users.noreply.github.com> Date: Thu, 19 Nov 2026 11:40:10 -0500 Subject: [PATCH] Construct Gaussian-dyadic Clifford decoders at linear tensor width --- research/clifford-general-width/PROOF.md | 78 +++++++++ research/clifford-general-width/README.md | 42 +++++ research/clifford-general-width/SOURCES.json | 83 +++++++++ research/clifford-general-width/TASK.json | 99 +++++++++++ research/clifford-general-width/VERIFY.json | 90 ++++++++++ .../clifford-general-width/verify_blocks.py | 115 ++++++++++++ .../clifford-general-width/verify_planes.py | 133 ++++++++++++++ .../clifford-general-width/verify_twist.py | 163 ++++++++++++++++++ 8 files changed, 803 insertions(+) create mode 100644 research/clifford-general-width/PROOF.md create mode 100644 research/clifford-general-width/README.md create mode 100644 research/clifford-general-width/SOURCES.json create mode 100644 research/clifford-general-width/TASK.json create mode 100644 research/clifford-general-width/VERIFY.json create mode 100644 research/clifford-general-width/verify_blocks.py create mode 100644 research/clifford-general-width/verify_planes.py create mode 100644 research/clifford-general-width/verify_twist.py diff --git a/research/clifford-general-width/PROOF.md b/research/clifford-general-width/PROOF.md new file mode 100644 index 0000000000..11388e1bef --- /dev/null +++ b/research/clifford-general-width/PROOF.md @@ -0,0 +1,78 @@ +# A linear sufficient width for dyadic Clifford tensor interpolation + +Let $R=\mathbb Z[i,1/2]$, $d=2^n$, and choose a Gaussian-dyadic unitary matrix $U_a$ in each projective class of the full $n$-qubit Clifford group modulo scalar powers of $i$. The raw observation matrix $C_f$ has columns $\operatorname{vec}(U_a^{\otimes f})$. Reordering its coordinates produces $\operatorname{vec}(U_a)^{\otimes f}$. All inputs and outputs below are complex-linear, including when the mixture coefficients are arbitrary complex numbers. + +**Theorem.** There is a specified matrix $B_f$ over $R$ satisfying $B_f C_f=I$ for every $f\ge F(n)$, where + +| Qubits | Sufficient width $F(n)$ | +|---|---:| +| $n=1,2$ | 5, 9 respectively | +| odd $n\ge3$ | $3n+2$ | +| even $n\ge4$ | $3n+1$ | + +For the normalized columns $d^{-f/2}\operatorname{vec}(U_a^{\otimes f})$, multiply $B_f$ by $d^{f/2}$. This gives an $R$-left inverse whenever $nf$ is even. For odd $nf$ the normalization uses a square root of two, and the same formula is over $R[\sqrt2]$. In that case every entry of the normalized map lies in $\sqrt2\,\mathbb Q(i)$. Multiplying by an $R$-matrix keeps every entry in this same rational subspace, which excludes $1$ because $\sqrt2\notin\mathbb Q(i)$. Thus the raw and normalized ring conclusions genuinely differ. Every specialization of the raw identity to a residue field of odd characteristic still splits. Optimality for $n\ge5$ is open here. + +The Bell-fibre decomposition and four-dimensional character corners are due to apoursh in [#7799, Sections 1–3](https://github.com/apoursh/integer-mult-bounds/blob/7f08a74037788311cc6b7da27297b25f1b188e45/research/clifford-bell-fibres/PROOF.md). The argument below includes both pair parities and constructs pure and mixed subspaces in arbitrary dimension. [#6714, three-qubit framework](https://github.com/alephnan/integer-mult-bounds/blob/f7f32a18dde54e67624a9ed9cc7e1b266d9585c0/research/clifford-three-qubit-threshold/PROOF.md) · [#7766, four-qubit spectrum](https://github.com/aliromman/integer-mult-bounds/blob/d7c2dd1868c70f0addce2c0a4d3220149452f14b/research/clifford-four-qubit-threshold/PROOF.md) + +## 1. The two Bell contractions + +Write $V=X\oplus L=\mathbb F_2^n\oplus\mathbb F_2^n$, $W_{x,z}=X^xZ^z$, and $q(x,z)=x\cdot z$. The symplectic pairing is the polar form of $q$, written $[u,v]$. Let $G=\mathrm{Sp}(V)$. Conjugation and congruence respectively act by + +```text +U W_t U* = γ_U(t) W_(St) +U W_t Uᵀ = θ_U(t) W_(L_S t), L_S t = St+b_S . +``` + +Both phases are fourth roots of unity. The first identity is the Clifford definition. Its map to $G$ is onto since symplectic transvections lift by $(1+i)(I+iP)/2$ for Hermitian Paulis $P$. For an element fixing all labels the conjugation signs form a character. Removing the corresponding Weyl leaves a scalar by Pauli irreducibility. A scalar in $R$ of complex modulus one is a power of $i$, by descent in $a^2+b^2=4^j$. The projective kernel is therefore exactly the Weyls. Since the Weyls are real, $U,\bar U$ have the same linear label action. Thus $U U^T$ is a Weyl up to phase, which gives the affine label action in the second identity. Applying transpose gives $q(L_S t)=q(t)$. + +Use $k$ ordered Bell pairs and one singleton, $f_0=2k+1$. For input labels $t=(t_1,\ldots,t_k)$, an output $t'$ is hit by column $U$ exactly when $t'_j=L_S t_j$ for each $j$. The block obtained from that column is then $β U$, with $β=\prod_j\theta_U(t_j)$. Indeed input and output Bell vectors are the normalized vectorizations of the indicated Weyls. **Over $R$** each complete input/output Bell matrix element has coefficient $1/d$ times products of Weyl entries, since the two square roots cancel within a pair. This applies also to odd $n$. Write $w=\sum_j t_j$, $w'=\sum_j t'_j$ as binary sums. + +| Pair count | Output sum | Fixed correction to a hit block $M$ | Result on $M=β U$ | +|---|---|---|---| +| $k$ even | $w'=Sw$ | $W_{w'} M W_w^{-1}$ | $σ U$, with $σ=β/\gamma_U(w)$ | +| $k$ odd | $w'=L_S w$ | $W_{w'}^{-1}M W_w$ | $σ\bar U$, with $σ=β\theta_U(w)$ | + +For the odd row use $U W_w U^T=\theta_U(w)W_{w'}$ and $(U^T)^{-1}=\bar U$. In particular the fixed linear operation on an observation produces $σ\bar U$ on a column and $cσ\bar U$ on that column multiplied by $c$. It never conjugates $c$. + +For either row of the table $σ=σ_S(t)$ is independent of the Pauli and scalar lift. Left multiplication of $U$ by a real Weyl multiplies $β$ by $(-1)^{[p,w']}$. The corresponding singleton phase in either row receives exactly that sign as well. In the even case a scalar $zU$ gives the extra factor $z^{2k}=1$. In the odd case the extra factor is $z^{2k+2}=1$. The phases of an ordinary or congruence action compose on their respective labels, so $σ_{S_1S_2}(t)=σ_{S_1}(L_{S_2}t)σ_{S_2}(t)$. This is where both parity and the direction of the right and left corrections enter. + +## 2. A seed whose point stabilizer has dyadic order + +Let $s=\lfloor n/2\rfloor+1$ except that $s=1$ at $n=2$. In the standard symplectic basis use the seed +```text +T = (0,Z_1,...,Z_n,X_(s+1),...,X_n), +k = 2n-s+1, f_0 = 4n-2s+3. +``` + +Fixing the seed’s zero label forces $b_S=0$. Fixing $L$ pointwise forces $S$ to be the shear $(x,z)\mapsto(x,z+Bx)$, $B=B^T$. Preserving $q$ forces $B$ to have zero diagonal, and the displayed $X$ labels force its last $n-s$ columns and rows to vanish. Conversely these shears are all products of real controlled-$Z_{ab}$ with $a> n + return tuple((v ^ x, 2 * ((v & z).bit_count() % 2)) for v in range(1 << n)) + + +def recognize(a, n): + x, phase = a[0] + z = sum(1 << j for j in range(n) if a[1 << j][1] != phase) + label = (z << n) | x + require(all(j == r and (t - p) % 4 == phase for (j, t), (r, p) in zip(a, weyl(n, label))), + "operator must be a phased Weyl matrix") + return label, phase + + +def tuple_action(u, source, n): + transposed = conjugate(inverse(u)) + ordinary_inverse = inverse(u) + + def act(label, right): + return recognize(compose(compose(u, weyl(n, label)), right), n) + + blocks = [act(label, transposed) for label in source] + labels = tuple(label for label, _ in blocks) + beta = sum(t for _, t in blocks) % 4 + w = reduce(xor, source) + odd = len(source) % 2 + wp, t = act(w, transposed if odd else ordinary_inverse) + require(wp == reduce(xor, labels), "affine output sum") + return labels, beta, (beta + t if odd else beta - t) % 4 + + +def add_monomial(acc, u, coefficient, phase): + real, imag = coefficient + rotations = ((real, imag), (-imag, real), (-real, -imag), (imag, -real)) + for j, (i, t) in enumerate(u): + a, b = rotations[(phase + t) % 4] + k = (i, j) + x, y = acc.get(k, (0, 0)) + acc[k] = x + a, y + b + + +def evaluate(n): + s = n // 2 + 1 + d = 1 << n + source = (0, *(1 << (n+j) for j in range(n)), *(1 << j for j in range(s, n))) + basis = list(combinations(range(s), 2)) + cnot = tuple((v ^ (((v >> 1) & 1) << 2), 0) for v in range(d)) + phase0 = tuple((v, v & 1) for v in range(d)) + phase1 = tuple((v, (v >> 1) & 1) for v in range(d)) + g = compose(cnot, phase0) + h = compose(phase1, cnot) + miss = compose(phase1, g) + i, _, ji = tuple_action(h, source, n) + j, _, jj = tuple_action(g, source, n) + w, wp = reduce(xor, i), reduce(xor, j) + odd = len(source) % 2 + left = inverse(weyl(n, wp)) if odd else weyl(n, wp) + right = weyl(n, w) if odd else inverse(weyl(n, w)) + actual, expected = {}, {} + accepted = skipped = 0 + for pattern in range(1 << len(basis)): + edges = [(1 << a) | (1 << b) for t, (a, b) in enumerate(basis) if (pattern >> t) & 1] + c = tuple((v, 2 * (sum((v & e) == e for e in edges) % 2)) for v in range(d)) + stabilizes, beta, sigma = tuple_action(c, source, n) + require((stabilizes, beta, sigma) == (source, 0, 0), "seed stabilizer phases") + for hit, lft in [(True, g), (False, miss)]: + lift = compose(compose(lft, c), inverse(h)) + for j_pauli, p in enumerate((0, 1, 2 << n, 3 | (2 << n))): + u0 = compose(weyl(n, p), lift) + scalar = (j_pauli + pattern) % 4 + u = tuple((row, (a + scalar) % 4) for row, a in u0) + out, beta, sigma = tuple_action(u, i, n) + require((out == j) == hit, "literal block membership vs planted coset") + if not hit: + skipped += 1 + continue + require(sigma == (jj - ji) % 4, "transporter phase") + c_input = (2 - pattern, pattern + j_pauli + 1) + add_monomial(actual, compose(compose(left, u), right), c_input, beta + ji - jj) + add_monomial(expected, conjugate(u) if odd else u, c_input, 0) + accepted += 1 + require(actual == expected and any(a or b for a, b in actual.values()), "coset sum") + return len(source), accepted, skipped + + +if __name__ == "__main__": + for n in (5, 6): + k, hits, misses = evaluate(n) + print(f"PASS n={n} f={2*k+1} pairs={k} accepted={hits} excluded={misses}") diff --git a/research/clifford-general-width/verify_planes.py b/research/clifford-general-width/verify_planes.py new file mode 100644 index 0000000000..37f3617f4f --- /dev/null +++ b/research/clifford-general-width/verify_planes.py @@ -0,0 +1,133 @@ +"""Certify finite Walsh corners using binary vector spaces, without Clifford data.""" +from itertools import combinations + + +def require(test, why): + if not test: + raise ValueError(why) + + +def span(basis): + values = [0] + for vector in basis: + values += [v ^ vector for v in values] + return values + + +def pairs(n): + return list(combinations(range(n), 2)) + + +def make_form(n, edges): + rows = [0] * n + for i, j in edges: + rows[i] ^= 1 << j + rows[j] ^= 1 << i + return rows + + +def polar_functionals(rows): + table = [0] + for row in rows: + table += [a ^ row for a in table] + return table + + +def independent_extension(candidates, size, orthogonal, first=()): + basis = list(first) + current = set(span(basis)) + for v in candidates: + if len(basis) == size: + break + if v not in current and all(not orthogonal(v, u) for u in basis): + basis.append(v) + current |= {u ^ v for u in current} + require(len(basis) == size, "isotropic extension") + return basis + + +def pure_corner(n, s, dual): + def polar(u, v): + return (dual[u] & v).bit_count() % 2 + + basis = independent_extension(range(1, 1 << n), s, polar) + require(len(set(span(basis))) == 1 << s, "dimension") + require(all(not polar(u, v) for u, v in combinations(basis, 2)), "pure pair shear") + + +def binary_quadratic(n, edges): + edge_masks = [(1 << i) | (1 << j) for i, j in edges] + return [sum((v & mask) == mask for mask in edge_masks) % 2 for v in range(1 << n)] + + +def mixed_corner(n, s, dual, q): + def polar(u, v): + return (dual[u] & v).bit_count() % 2 + + r = next(v for v in range(1, 1 << n) if q[v] == 0) + hyperplane = [u for u in range(1 << n) if not polar(u, r)] + outside = next(u for u in range(1 << n) if polar(u, r)) + basis = independent_extension(hyperplane, s - 1, polar, first=[r]) + require(len(hyperplane) == 1 << (n - 1), "mixed hyperplane") + require(all(not polar(u, v) for u, v in combinations(basis, 2)), "pure kernel signs") + # T_p fixes the hyperplane and translates its other coset by p. + # Test by comparing actual values of Q on the whole coset, without + # consulting the radical or assuming the character changes. + fixed = [p for p in span(basis) + if all(q[outside ^ y] == q[outside ^ y ^ p] for y in hyperplane)] + require(fixed == [0], "mixed character stabilizer") + return len(span(basis)) - 1 + + +def main(): + pure_forms = mixed_forms = moved = represented = 0 + for n in (1, 2, 3, 4, 5): + s = 1 if n == 2 else n // 2 + 1 + all_edges = pairs(n) + for bits in range(1 << len(all_edges)): + edges = [edge for j, edge in enumerate(all_edges) if bits >> j & 1] + dual = polar_functionals(make_form(n, edges)) + if n == 4 and len(set(dual)) == 1 << n: + q0 = binary_quadratic(n, edges) + for linear in range(1 << n): + q = [a ^ ((linear & v).bit_count() % 2) for v, a in enumerate(q0)] + moved += mixed_corner(n, s, dual, q) + mixed_forms += 1 + else: + pure_corner(n, s, dual) + pure_forms += 1 + represented += 1 << n + + # For n=6..9 check all possible alternating ranks in the usual symplectic + # basis. Every linear part is inspected on each full-rank polar form. + # For lower ranks a pure witness works for all linear parts at once. + ranks = 0 + for n in range(6, 10): + for rank in range(0, n + 1, 2): + edges = [(i, i + 1) for i in range(0, rank, 2)] + dual = polar_functionals(make_form(n, edges)) + require(len(set(dual)) == 1 << rank, "symplectic block rank") + ranks += 1 + if rank != n: + pure_corner(n, n // 2 + 1, dual) + continue + q0 = binary_quadratic(n, edges) + for linear in range(1 << n): + q = [a ^ ((linear & v).bit_count() % 2) for v, a in enumerate(q0)] + moved += mixed_corner(n, n // 2 + 1, dual, q) + mixed_forms += 1 + + # In a hyperbolic pair, choosing Q(r)=1 instead of 0 leaves T_r + # invisible; the mixed corner's stabilizer count would be wrong. + q_bad = [((v & 1) > 0) ^ ((v & 3) == 3) ^ ((v & 12) == 12) for v in range(16)] + require(all(q_bad[v] == q_bad[v ^ 1] for v in range(16) if v & 2), "wrong r control") + # The anisotropic binary plane really has no nonzero singular vector. + require(all(((v & 1) ^ ((v >> 1) & 1) ^ (v == 3)) == 1 for v in (1, 2, 3)), + "two-dimensional exception") + print(f"PASS exhaustive n<=5 characters={represented} pure_polar_checks={pure_forms}") + print(f"PASS n=6..9 canonical polar ranks={ranks}; combined mixed corners={mixed_forms}, " + f"nontrivial character moves={moved}; two controls") + + +if __name__ == "__main__": + main() diff --git a/research/clifford-general-width/verify_twist.py b/research/clifford-general-width/verify_twist.py new file mode 100644 index 0000000000..9712ebee47 --- /dev/null +++ b/research/clifford-general-width/verify_twist.py @@ -0,0 +1,163 @@ +"""Literal exact Gaussian-rational matrices test the two singleton corrections.""" +from fractions import Fraction +from functools import cache, reduce +from itertools import product +from operator import xor + + +def require(ok, why): + if not ok: + raise ValueError(why) + + +zero = (0, 0) +one = (1, 0) +minus = (-1, 0) +imag = (0, 1) +units = (one, imag, minus, (0, -1)) + + +def add(a, b): + return (a[0] + b[0], a[1] + b[1]) + + +def mul(a, b): + return (a[0] * b[0] - a[1] * b[1], a[0] * b[1] + a[1] * b[0]) + + +@cache +def scale(h, a): + return tuple(mul(h, v) for v in a) + + +@cache +def matmul(a, b): + return tuple(add(mul(a[2*i], b[j]), mul(a[2*i+1], b[j+2])) + for i in range(2) for j in range(2)) + + +def transpose(a): + return (a[0], a[2], a[1], a[3]) + + +def conjugate(a): + return tuple((v[0], -v[1]) for v in a) + + +def tables(): + ident = (one, zero, zero, one) + x = (zero, one, one, zero) + z = (one, zero, zero, minus) + weyl = (ident, x, z, matmul(x, z)) + h = scale((Fraction(1, 2), Fraction(1, 2)), (one, one, one, minus)) + phase = (one, zero, zero, imag) + lifted = [ident] + seen = {ident} + for a in lifted: + for gate in [h, phase]: + b = matmul(gate, a) + if b not in seen: + seen.add(b) + lifted.append(b) + require(len(lifted) == 96, "one-qubit lifts") + + lookup = {scale(phase, w): (j, i) + for j, w in enumerate(weyl) for i, phase in enumerate(units)} + ordinary, bell = {}, {} + for u in lifted: + ordinary[u] = [lookup[matmul(matmul(u, w), transpose(conjugate(u)))] for w in weyl] + bell[u] = [lookup[matmul(matmul(u, w), transpose(u))] for w in weyl] + return weyl, lifted, ordinary, bell + + +def main(): + weyl, lifted, ordinary, bell = tables() + all_checks = odd_checks = wrong_plain = wrong_even = 0 + reps, descents = {}, {} + for u in lifted: + symplectic = tuple(t for t, _ in ordinary[u]) + reps[symplectic] = u + for k in (1, 2, 3, 4): + for source in product(range(4), repeat=k): + output = tuple(bell[u][v][0] for v in source) + phase = sum(bell[u][v][1] for v in source) % 4 + w = reduce(xor, source, 0) + wp = reduce(xor, output, 0) + if k % 2: + require(wp == bell[u][w][0], "odd affine sum") + corrected = matmul(matmul(transpose(weyl[wp]), u), weyl[w]) + sigma = (phase + bell[u][w][1]) % 4 + target = conjugate(u) + odd_checks += 1 + wrong_plain += int(scale(units[sigma], target) != scale(units[sigma], u)) + else: + require(wp == ordinary[u][w][0], "even linear sum") + corrected = matmul(matmul(weyl[wp], u), transpose(weyl[w])) + sigma = (phase - ordinary[u][w][1]) % 4 + target = u + wrong_even += int(scale(units[sigma], target) != scale(units[phase], u)) + require(scale(units[phase], corrected) == scale(units[sigma], target), + "matrix singleton correction") + key = (symplectic, source) + value = (output, sigma) + if key in descents: + require(descents[key] == value, "phase depends on the chosen Pauli/scalar lift") + else: + descents[key] = value + all_checks += 1 + + cocycles = 0 + for a in reps: + for b in reps: + ab = tuple(a[v] for v in b) + for k in (1, 2, 3, 4): + for source in product(range(4), repeat=k): + mid, right = descents[b, source] + end, left = descents[a, mid] + require(descents[ab, source] == (end, (left + right) % 4), "cocycle") + cocycles += 1 + + # All 24 projective representatives have independently chosen scalar lifts. + # Use a nonreal coefficient in every term. Extract the complete corrected + # blocks from exact matrix sums and compare to the linear conjugate-fibre + # prediction. Conjugating the observed mixture would conjugate coefficients. + def msum(matrices): + out = (zero,) * 4 + for a in matrices: + out = tuple(add(x, y) for x, y in zip(out, a)) + return out + + chosen = [] + rays = set() + for u in lifted: + if u not in rays: + rays |= {scale(z, u) for z in units} + chosen.append(scale(units[len(chosen) % 4], u)) + require(len(chosen) == 24, "projective calibration") + sources = (0, 1, 2) + w = reduce(xor, sources) + grouped = {} + for j, u in enumerate(chosen): + output, sigma = descents[tuple(t for t, _ in ordinary[u]), sources] + phase = sum(bell[u][v][1] for v in sources) % 4 + c = (2 * j - 13, j + 1) + if output not in grouped: + grouped[output] = ([], [], []) + observed, predicted, erroneous = grouped[output] + observed.append(scale(mul(c, units[phase]), u)) + predicted.append(scale(mul(c, units[sigma]), conjugate(u))) + erroneous.append(scale(mul((c[0], -c[1]), units[sigma]), conjugate(u))) + bad_mixtures = 0 + for output, (observed, predicted, erroneous) in grouped.items(): + actual = matmul(matmul(transpose(weyl[reduce(xor, output)]), msum(observed)), weyl[w]) + require(actual == msum(predicted), "complex mixture") + bad_mixtures += int(actual != msum(erroneous)) + + require(wrong_plain and wrong_even and bad_mixtures, "mutation controls did not discriminate") + print(f"PASS lifts=96 tuples={all_checks} odd={odd_checks} cocycles={cocycles}") + print(f"PASS complex-mixture blocks={len(grouped)}; wrong plain singleton={wrong_plain}, " + f"omitted even correction={wrong_even}, conjugated coefficient blocks={bad_mixtures}") + + +if __name__ == "__main__": + main()