From 52ad2a3802ff7fe84a74694b5def51b337d2e056 Mon Sep 17 00:00:00 2001 From: apoursh <8867770+apoursh@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:25:56 -0500 Subject: [PATCH] Compute exact canonical Clifford readouts for mixed width-13 observations --- .../FLAG-SPECTRUM.md | 23 + .../clifford-mixed-site-canonical/POINTED.md | 72 + .../clifford-mixed-site-canonical/PROOF.md | 37 + .../clifford-mixed-site-canonical/README.md | 37 + .../SOURCE-PINS.json | 106 ++ .../SOURCES.json | 83 + .../clifford-mixed-site-canonical/SUPPORT.md | 29 + .../clifford-mixed-site-canonical/TASK.json | 93 + .../clifford-mixed-site-canonical/VERIFY.json | 117 ++ .../check_mixed.py | 116 ++ .../check_pointed.py | 142 ++ .../check_support.py | 118 ++ .../flag_spectrum.py | 64 + .../clifford-mixed-site-canonical/mixed.py | 186 ++ .../clifford-mixed-site-canonical/pointed.py | 161 ++ .../predecessor/adjoint.py | 190 +++ .../predecessor/canonical.py | 128 ++ .../predecessor/source/CLASS-ALGEBRA.json | 165 ++ .../predecessor/source/engine/INPUTS.json | 72 + .../predecessor/source/engine/contractions.py | 236 +++ .../predecessor/source/engine/source/LICENSE | 201 +++ .../source/engine/source/PR5698-NOTICE.md | 9 + .../source/engine/source/PR5704-NOTICE.md | 33 + .../source/engine/source/PR5704-quadratic.py | 283 +++ .../predecessor/source/row/bell_reads.py | 128 ++ .../predecessor/source/row/compile_row.py | 247 +++ .../predecessor/source/width13-spectrum.json | 1519 +++++++++++++++++ .../predecessor/spherical.py | 66 + .../clifford-mixed-site-canonical/support.py | 49 + 29 files changed, 4710 insertions(+) create mode 100644 research/clifford-mixed-site-canonical/FLAG-SPECTRUM.md create mode 100644 research/clifford-mixed-site-canonical/POINTED.md create mode 100644 research/clifford-mixed-site-canonical/PROOF.md create mode 100644 research/clifford-mixed-site-canonical/README.md create mode 100644 research/clifford-mixed-site-canonical/SOURCE-PINS.json create mode 100644 research/clifford-mixed-site-canonical/SOURCES.json create mode 100644 research/clifford-mixed-site-canonical/SUPPORT.md create mode 100644 research/clifford-mixed-site-canonical/TASK.json create mode 100644 research/clifford-mixed-site-canonical/VERIFY.json create mode 100644 research/clifford-mixed-site-canonical/check_mixed.py create mode 100644 research/clifford-mixed-site-canonical/check_pointed.py create mode 100644 research/clifford-mixed-site-canonical/check_support.py create mode 100644 research/clifford-mixed-site-canonical/flag_spectrum.py create mode 100644 research/clifford-mixed-site-canonical/mixed.py create mode 100644 research/clifford-mixed-site-canonical/pointed.py create mode 100644 research/clifford-mixed-site-canonical/predecessor/adjoint.py create mode 100644 research/clifford-mixed-site-canonical/predecessor/canonical.py create mode 100644 research/clifford-mixed-site-canonical/predecessor/source/CLASS-ALGEBRA.json create mode 100644 research/clifford-mixed-site-canonical/predecessor/source/engine/INPUTS.json create mode 100644 research/clifford-mixed-site-canonical/predecessor/source/engine/contractions.py create mode 100644 research/clifford-mixed-site-canonical/predecessor/source/engine/source/LICENSE create mode 100644 research/clifford-mixed-site-canonical/predecessor/source/engine/source/PR5698-NOTICE.md create mode 100644 research/clifford-mixed-site-canonical/predecessor/source/engine/source/PR5704-NOTICE.md create mode 100644 research/clifford-mixed-site-canonical/predecessor/source/engine/source/PR5704-quadratic.py create mode 100644 research/clifford-mixed-site-canonical/predecessor/source/row/bell_reads.py create mode 100644 research/clifford-mixed-site-canonical/predecessor/source/row/compile_row.py create mode 100644 research/clifford-mixed-site-canonical/predecessor/source/width13-spectrum.json create mode 100644 research/clifford-mixed-site-canonical/predecessor/spherical.py create mode 100644 research/clifford-mixed-site-canonical/support.py diff --git a/research/clifford-mixed-site-canonical/FLAG-SPECTRUM.md b/research/clifford-mixed-site-canonical/FLAG-SPECTRUM.md new file mode 100644 index 0000000000..4682142408 --- /dev/null +++ b/research/clifford-mixed-site-canonical/FLAG-SPECTRUM.md @@ -0,0 +1,23 @@ +# Character check on the marked Lagrangians + +For each of the 81 ordinary conjugacy representatives in the pinned class data, compute the permutation character by counting its fixed points on pairs $(L,v)$, where $L$ is Lagrangian and $0\ne v\in L$. Each invariant $L$ contributes $|\ker(S-I)\cap L|-1$ and every other $L$ contributes zero. The count is the same on both ordinary classes in the fused packet. This calculation tests fixed flags directly, independently of the classification of relative positions of two marked Lagrangians. + +For a rationalized character $\chi_B$, its norm squared is the number of irreducibles in its Galois packet $B$. Take its character inner product with the fixed-flag character, divide by this norm, and obtain the multiplicity of each constituent. The action on all 34,425 flags decomposes as follows. + +| Ordinary degree | Multiplicity | Normalized Gram eigenvalue | +|---:|---:|---:| +| 1 | 1 | $470624175/2^{32}$ | +| 51 | 1 | $22846598775/2^{32}$ | +| 119 | 1 | $359889075/2^{31}$ | +| 135 | 2 | $1132984125/2^{32}$ | +| 918 | 2 | $15074084025/2^{33}$ | +| 1190 | 2 | $5790052125/2^{33}$ | +| 2856 | 1 | $2289090375/2^{30}$ | +| 3400 | 1 | $6597966375/2^{34}$ | +| 4200 | 1 | $1068242175/2^{31}$ | +| 5712 | 1 | $29452962825/2^{35}$ | +| 13600 | 1 | $35251991775/2^{35}$ | + +The scalar is the fixed-space central kernel evaluated on the ordinary character, as in #7816. All listed constituents are rational, and their multiplicity-weighted degree sum is 34,425. Their squared multiplicities sum to 20, the number of orbitals. The 11 distinct positive scalars give exactly the minimal polynomial's roots, each simple, since a central operator is scalar on each irreducible. In particular the inverse on this whole flag module can be represented by a polynomial of degree at most ten. The weighted sums of the scalars and their reciprocals also agree with the independently computed traces: each trace is 34,425 times the corresponding diagonal orbital entry. + +The smallest common odd denominator of the **full inverse matrix on flags** is 4,073,770,240,465,467,939,271,875. All 20 orbital entries have denominators dividing it. One entry on flags at distance one with distinct marks contained in the common intersection already forces the entire denominator. This is the unrestricted flag inverse before restriction to the particular singleton right-hand sides in the mixed problem. [Fixed-flag character and exact denominator replay](flag_spectrum.py) · [Orbital convolution and mixed inputs](POINTED.md) diff --git a/research/clifford-mixed-site-canonical/POINTED.md b/research/clifford-mixed-site-canonical/POINTED.md new file mode 100644 index 0000000000..1c5d0f495b --- /dev/null +++ b/research/clifford-mixed-site-canonical/POINTED.md @@ -0,0 +1,72 @@ +# Twelve repeated sites and an arbitrary singleton + +Fix two normalized four-qubit stabilizer vectors $a,b$ in the Gaussian-dyadic lifts of #7821. Put $B=|a\rangle\langle b|$ and take any complex $16$-by-$16$ matrix $C$. This construction returns the canonical Moore–Penrose coefficient of $y=(\mathrm{vec}\,B)^{\otimes 12}\otimes\mathrm{vec}\,C$ at any requested width-13 label. All site orderings have the same coefficients because each dictionary column is a tensor power. The program accepts Gaussian-rational entries for $C$ in the respective stabilizer bases. It includes coherences and arbitrary superpositions. [Pointed-flag implementation](pointed.py) · [Independent verification](check_pointed.py) + +## The compatibility projector + +In the convention of #7821, column $(S,p)$ has the factor $\mathrm{vec}(V)/4$ with $V=W_pU_S$. Let $L_a,L_b$ be the Pauli-label Lagrangians fixing the lines of $a,b$. For each $u\in L_a$, let $D_a(u)$ be the *signed* Hermitian Pauli fixing $a$ pointwise. Define $D_b(v)$ similarly. Within each Lagrangian the signed Paulis form an ordinary elementary abelian group. For $X=S L_b$, put $I=X\cap L_a$ and $j=4-\dim I$. + +The overlap $\tau=\langle a|V|b\rangle$ is nonzero exactly when the two stabilizer signs agree on $I$. Indeed the trace of the two stabilizer projectors is either $|I|/16$ or zero by character orthogonality. Compatibility at $u=S v\in I$ is the equality $D_a(u)=V D_b(v) V^*$. In the nonzero case $\overline{\tau}^{12}=(-1/64)^j$, including the phase in the Gaussian-dyadic lift. This follows as in #7821 from $|\tau|^2=2^{-j}$ and unique factorization in the Gaussian integers. Consequently the raw adjoint coefficient is $4^{-13}(-1/64)^j\,\mathbf1_{\rm compatible}\,\mathrm{Tr}(V^*C)$. + +Under the matrix synthesis of #7816, $M_d(S)=\sum_p d_{S,p}W_pU_S$. The operator $C\mapsto D_a(Sv) C D_b(v)$ is diagonal on the trace-orthogonal basis $\{W_pU_S\}_p$ with signs equal to the compatibility characters. Averaging over $Sv\in I$ projects onto precisely the compatible basis matrices. Thus +$$ + M_{A^*y}(S)/16 + = b_j\!\!\sum_{v\in L_b:\,Sv\in L_a} D_a(Sv) C D_b(v),\qquad + b_j=\frac{(-1/64)^j}{4^{13}2^{4-j}} . +$$ +Here $D_a(0)=D_b(0)=1$. The central Gram applies separately to each scalar matrix-entry function on $G=\mathrm{Sp}(8,2)$. The scalar convolution with $F(g)=16^{-12}(-64)^{\dim\mathrm{Fix}(g)}$ is invertible. For the $v=0$ term invert the five-shell function $b_j$ on the unmarked Lagrangians. Each remaining term is a scalar function associated to two **pointed** Lagrangians. Fix $u\in L_a\setminus0$ and $v\in L_b\setminus0$, set $\alpha=(L_a,u)$ and $\beta=(L_b,v)$. Its input function at $S$ is +$$ + f_\alpha(S\beta)=b_{d(L_a,SL_b)}\mathbf1_{\{u=Sv\}} . +$$ +Both the unmarked and the pointed inputs are pullbacks along a transitive group action. Convolution pushes forward to the permutation action; inversion commutes with this identification because the convolution is central. Inverting these scalar functions once therefore gives the desired $M_{A^\dagger y}(S)/16$ with the same matrix factors. + +## The twenty orbital weights + +The set $\mathcal F$ of pointed Lagrangians has $N=2295\cdot15=34425$ members. For $\alpha=(L,u)$, $\beta=(X,w)$ use the tuple +$$ + R(\alpha,\beta)=\bigl(4-\dim(L\cap X),\ [u=w],\ [u\in X],\ [w\in L],\ \langle u,w\rangle\bigr) +$$ +with the final entry the binary symplectic pairing. All entries are invariant under simultaneous symplectic action. Fix $(L,u)=(Z,e_1)$; any flag can be carried here via a symplectic basis. The finite orbit certificate enumerates every flag and finds twenty tuples, with 2, 5, 6, 5 and 2 at respective distances 0 through 4. For each tuple it starts at one representative and closes under ten symmetric shears fixing $Z$ pointwise and nine elementary basis changes within the stabilizer of $e_1$. Every generated orbit has exactly the size of its tuple's fibre. This proves that the tuple separates all ordered-pair orbits without assuming the pointed permutation representation is multiplicity-free. + +For a central per-element convolution kernel $T$, write $t_k$ for a single entry of its induced matrix between flags of relation $k$, and $n_k$ for the number of flags at this relation from one base flag. For each group conjugacy representative $g_c$ let $D_{ck}$ count the flags $z$ with $R(z,g_c z)=k$. Double-counting ordered flags and transports gives +$$ + t_k=\frac{\sum_c |c|T(g_c)D_{ck}}{Nn_k}. +$$ +Compute this for $F$ and its inverse. For the inverse, in the ordinary character formula take the sum of $d_\chi\chi(g_c^{-1})/\lambda_\chi$ over irreducible characters and divide by $|G|$. Here $\lambda_\chi=|\,\chi(1)\,|^{-1}\sum_g \chi(g) F(g)$. The retained rational Galois packet sums are real. Each constituent degree is the identity value of its packet divided by its character norm squared. The two representatives in the sole fused rational class yield the same displacement counts, verified before fusion. These computations use the native class data from #7816 and the standard library. + +The checker composes the two induced kernels on all twenty relations, summing over every intermediate flag and obtaining the identity exactly. Summing the inverse's marked targets with a fixed underlying Lagrangian gives the corresponding unmarked matrix entry, since the fifteen marked target fibres partition the transports into that Lagrangian. For a *pointed* input $f_\alpha$ supported only on flags with mark $u$, each output weight requires only the 135 Lagrangians containing $u$. Exactly five unmarked weights $z_j$ and twenty pointed weights $w_k$ remain. All depend only on the alphabet. The optional independent permutation-character check gives the same forward and inverse traces. [Spectral check](flag_spectrum.py) + +## Query and support + +Use the supplied left and right stabilizer bases so that $a,b$ have coordinate labels $r,c$ and $C$ has coordinates $C_{ik}$. Conjugating all labels by the two given basis changes gives a relative symplectic matrix $S'$ and absolute matrix entries $V'_{ik}$. Write $j=d(Z,S'Z)$. On rows and columns $D_a(u),D_b(v)$ act by the signs $(-1)^{u\cdot(i+r)},(-1)^{v\cdot(k+c)}$. Therefore +$$ + \gamma_{ik} + =z_j+\sum_{u,v\in Z\setminus0}(-1)^{u\cdot(i+r)+v\cdot(k+c)} + w_{R((Z,u),(S'Z,S'v))},\qquad + (A^\dagger y)_{S,p}=\sum_{i,k}\gamma_{ik}\,\overline{V'_{ik}} C_{ik}. +$$ +One length-256 Walsh transform (2,048 rational additions/subtractions) supplies all the $\gamma_{ik}$ after 225 relation lookups; only nonzero supplied $C_{ik}$ then contribute to the sum. For each requested Pauli translate the inherited transition routine contracts the three $16$-dimensional basis matrices with absolute phases. Computing the shared table and the basis transitions is included in the program. It uses rational arithmetic without enumerating $|G|$ symplectic maps or the dictionary columns. The interface takes explicit singleton matrix entries; an arbitrary observation producer would incur its own cost. A minimal request, with the singleton different from the repeated matrix unit, is + +~~~json +{"row":0,"column":0,"singleton":[[3,2,["2/3","1/5"]]],"queries":[[[1,2,4,8,16,32,64,128],16]]} +~~~ + +Both real and imaginary answers are nonzero, $-515081410492739/6019539287498757820800000$ and $-515081410492739/20065130958329192736000000$ respectively. Optional `left_basis` and `right_basis` select the bases used both for the repeated site and for the entries of $C$. Example reproduction: pass the object in a file to `python3.12 -B pointed.py input.json`. + +For each distance it suffices to enumerate all $16^2$ Walsh frequencies on one representative Lagrangian. Basis changes preserving $Z$ carry any other pair of Lagrangians at that distance to the representative pair; this permutes their linear forms. The numbers of distinct $\gamma$ are respectively 4, 7, 8, 7 and 4, giving thirty distinct nonzero rationals in total. Their least common denominator is $2^{17}\cdot 5878456335448005684375$. Each frequency is realizable by choosing the singleton matrix unit and the labels of the repeated matrix unit. For every such choice some Pauli translate makes $V'_{ik}$ nonzero; in the Gaussian dyadics that entry is a unit since its norm squared is a power of two. The displayed odd part is consequently *sharp* for the family of 12+1 matrix units, and clears the decoder coefficients for Gaussian-dyadic singleton entries. For every same-basis singleton matrix unit the nonzero canonical support consists of precisely the columns where $V'_{ik}\ne0$, hence 8,338,459,852,800 columns by the shell census of #7821. + +## Principal angles for the entire variable-singleton subspace + +For $C=|i\rangle\langle k|$ in the given bases, let $\alpha=i+r$ and $\beta=k+c$. To compute $\|AA^\dagger y\|^2=\langle A^* y,A^\dagger y\rangle$, use compatibility of the repeated and singleton coordinates. Their nonzero Pauli sets agree or are disjoint according as +$$ + \alpha\cdot Sv=\beta\cdot v\quad\text{for all }v\in Z\text{ with }Sv\in Z +$$ +in relative coordinates. If compatible, the sum of $|V'_{ik}|^2$ over that common Pauli set is $16$. At each distance, average $16\,4^{-13}(-1/64)^j\gamma_{ik}$ times the compatibility indicator over all row and column differences of the prescribed zero/nonzero types, then multiply by the number of group elements at the distance. This average gives the exact sum for any fixed differences: independent linear changes of the left and right computational bases act transitively on each nonzero character set and preserve the distance and the uniform sum over $S$. At fixed distance representative the uniform average covers the transported characters on the two representative Lagrangians. The group-element count in shell $j$ is $(|G|/2295)(1,30,280,960,1024)_j$. + +| Difference from the repeated matrix unit | Multiplicity | Squared projection norm | +|---|---:|---:| +| Neither coordinate differs | 1 | $478566778595/5856573836677349376$ | +| Exactly one differs | 30 | $34240796149757/767064758258815834521600$ | +| Both differ | 225 | $319403078159153570779/55516311878981796023500800000$ | + +The three values are positive, distinct and strictly below one. They are the squared cosines of the three principal angles between the 256-dimensional variable-singleton subspace and the Clifford column span. Indeed, left and right diagonal Paulis in the chosen bases permute the dictionary columns up to phases, so commute with the orthogonal projection. The twelve repeated sites contribute a trivial sign to this action. Distinct singleton matrix units belong to distinct simultaneous characters. Their projections are therefore mutually orthogonal. For a general $C$, multiplying each table value by the appropriate $|C_{ik}|^2$ and summing gives the exact squared projection norm. The intersection of this entire subspace with the Clifford column span is zero. The computational checks also compare literal raw thirteenth-degree products at rotated bases and the $C=B$ specialization against the five-weight solution of #7821. [Exact checks](check_pointed.py) diff --git a/research/clifford-mixed-site-canonical/PROOF.md b/research/clifford-mixed-site-canonical/PROOF.md new file mode 100644 index 0000000000..ed11fb0673 --- /dev/null +++ b/research/clifford-mixed-site-canonical/PROOF.md @@ -0,0 +1,37 @@ +# A one-sided canonical decoder at width 13 + +Use the four-qubit dictionary with columns $(\mathrm{vec}(V)/4)^{\otimes13}$, $V=W_pU_S$, and the Gaussian-dyadic lifts in #7821. The observation has an arbitrary 52-qubit vector $\psi$ on the row registers and $\bar b^{\otimes13}$ on the column registers. Here $b$ is any normalized four-qubit stabilizer vector in the indicated gauges, with Pauli Lagrangian $L_b$. The linear statements apply to all complex $\psi$ given the stated overlaps. The compact producer takes a supplied affine-quadratic row chart. [Lift and address conventions](https://github.com/apoursh/integer-mult-bounds/blob/eead545a4ba6c50010fcac0919a9fdc6b14bd673/research/clifford-compact-adjoint-fibres/PROOF.md) + +## Reduction to 36,720 features + +For each Lagrangian $L$ take an orthonormal stabilizer eigenbasis $\mathcal B_L$ in Gaussian-dyadic gauges and set +$$ + d_\psi(L)=\sum_{w\in\mathcal B_L} w\langle w^{\otimes13},\psi\rangle . +$$ +Changing the allowed lift of a line multiplies its vector by a Gaussian unit $\eta$. Indeed a Gaussian dyadic of modulus one has only units at odd primes, and clearing its denominator leaves only the ramified prime above two. The phase change in the feature is $\eta\bar\eta^{13}=1$. Each $Vb$ is a line of $SL_b$ with such a phase. Thus $(A^*y)_{S,p}=4^{-13}\langle Vb,d_\psi(SL_b)\rangle$. In the trace-orthogonal synthesis $M_c(S)=\sum_p c_{S,p}V$ this reads $M_{A^*y}(S)=16\cdot4^{-13}d_\psi(SL_b)b^*$. By #7816, $K=A^*A$ applies the same real central convolution on each matrix entry, with kernel $16^{-12}(-64)^{\dim\mathrm{Fix}(g)}$. It is positive definite and preserves functions of $SL_b$. This permutation module has 2,295 vertices. [Normal operator](https://github.com/apoursh/integer-mult-bounds/blob/7e7e62c62fcccd11f5c8e22677b4523863a48f4b/research/clifford-transported-fibre-gram/PROOF.md) + +The normalized zonal functions $u_\theta(i)$ and Gram scalars $\lambda_\theta$ on this module are computed in #7821 from the dual polar graph on the Lagrangians. At adjacency levels $30,13,3,-5,-15$ their multiplicities are $m_\theta=1,135,1190,918,51$. The spectral projector entry on a vertex pair at distance $i$ is $m_\theta u_\theta(i)/2295$. The full inverse has entry $H_i=\sum_\theta m_\theta u_\theta(i)/(2295\lambda_\theta)$. This works on arbitrary vertex data, even when $d_\psi$ itself is nonradial. The canonical label query is +$$ + (A^\dagger y)_{S,p}=4^{-13}\left\langle Vb,\sum_X H_{d(SL_b,X)} d_\psi(X)\right\rangle . +$$ +These five inverse kernel entries give the normal solution before returning to Weyl coordinates. The repeated-site coefficients from #7821 already applied the inverse to a particular radial right-hand side. [Pinned spherical decomposition](https://github.com/apoursh/integer-mult-bounds/blob/eead545a4ba6c50010fcac0919a9fdc6b14bd673/research/clifford-compact-adjoint-fibres/COORDINATES.md) · [Program](mixed.py) + +## One elimination per vertex on an entangled row chart + +Project $L$ onto its $X$ coordinates to obtain $H\subseteq\mathbb F_2^4$ of dimension $h$. Choose a pivot-reduced basis $x_i$ of $H$, with lifts $(x_i,z_i)\in L$. Decompose a nibble $r=s+\sum_i t_i x_i$ using the pivot bits for $t(r)$, so both $s$ and $t(r)$ are linear functions of $r$. The form $\ell_{ij}=z_i\cdot x_j$ is symmetric by isotropy, and well-defined because changes of lift lie in $H^\perp$. Put +$$ + q(t)=\sum_i\ell_{ii}t_i+2\sum_{i>(4*k))&15 for k in range(13)],(Fraction(t[0],1<0 and singulars>j)&1)<> transform[v]) & 1 for v in points): + n += sum(transform[v]==v for v in points if v) + vals.append(n) + if len(set(vals)) != 1: + raise ArithmeticError("Fused rational classes have distinct fixed-flag counts") + fixed.append(vals[0]) + if fixed[0] != NFLAGS: + raise ArithmeticError("Flags fixed by identity") + shell = [Fraction((-64)**cl["fixed"],16**12) for cl in table["classes"]] + sizes = [cl["size"] for cl in table["classes"]] + eigenvalues = {} + constituents = [] + for row in table["characters"]: + orbit = Fraction(sum(n*v*v for n,v in zip(sizes,row,strict=True)),ORDER) + mult = Fraction(sum(n*f*v for n,f,v in zip(sizes,fixed,row,strict=True)),ORDER)/orbit + if orbit.denominator!=1 or mult.denominator!=1 or mult<0: + raise ArithmeticError("Nonintegral packet data") + if mult: + scalar = sum(n*k*v for n,k,v in zip(sizes,shell,row,strict=True))/row[0] + constituents.append((row[0]//int(orbit),int(mult),int(orbit),scalar)) + eigenvalues[scalar] = eigenvalues.get(scalar,0)+row[0]*int(mult) + if sum(eigenvalues.values())!=NFLAGS or sum(o*m*m for _,m,o,_ in constituents)!=len(orbital_counts): + raise ArithmeticError("Permutation dimension or commutant dimension") + return constituents, eigenvalues + + +def main(): + constituents, levels = statistics() + level = (0,1,1,1,0) + a,b = orbital_kernels() + if a[level]*NFLAGS != sum(x*n for x,n in levels.items()): + raise ArithmeticError("Orbital Gram trace") + if b[level]*NFLAGS != sum(n/x for x,n in levels.items()): + raise ArithmeticError("Orbital inverse trace") + denominator=lcm(*(x.denominator for x in b.values())) + if denominator!=4073770240465467939271875 or b[(1,0,1,1,0)].denominator!=denominator: + raise ArithmeticError("Full flag inverse denominator and one-entry witness") + print("PASS fixed-flag character, constituents",sorted(constituents), "and",len(levels),"levels; both traces") + + +if __name__ == "__main__": + main() diff --git a/research/clifford-mixed-site-canonical/mixed.py b/research/clifford-mixed-site-canonical/mixed.py new file mode 100644 index 0000000000..8c1bade777 --- /dev/null +++ b/research/clifford-mixed-site-canonical/mixed.py @@ -0,0 +1,186 @@ +"""One-sided width-13 canonical queries for a row chart and one repeated input stabilizer.""" +import argparse +from fractions import Fraction +from functools import cache, reduce +import json +from operator import xor +from pathlib import Path +import sys + +HERE = Path(__file__).resolve().parent +sys.path.insert(0,str(HERE/"predecessor")) +from adjoint import Q, IDENTITY, eliminate, evaluate_forms, linear_forms, solution, substitute_form, validate +from canonical import distance, point_set, quotient, unitary +from compile_row import apply, is_symplectic, span +from spherical import spherical_solution + +ZERO = (4,0,(),(),0,0,0) + + +def geometry(basis): + """Coordinates t in the X-projection, with a symmetric phase lift on each coset.""" + xs, zs = [], [] + pivots = {} + for g in basis: + x,z = divmod(g,16) + if Q.coordinates(pivots,x) is None: + xs.append(x) + zs.append(z) + pivots = Q.basis(xs) + idx = sorted(pivots) + cols = [pivots[i][0] for i in idx] + zs = [reduce(xor,(zs[k] for k in Q.bits(pivots[i][1])),0) for i in idx] + phase = {} + for i,z in enumerate(zs): + if (z & cols[i]).bit_count()%2: + phase[1<>1)<<5)|(f&1) for f in linear_forms(off,cols,52)] + self.blocks = [raw[j:j+4] for j in range(0,52,4)] + self.rows = [(off >> j)&15 for j in range(0,52,4)] + self.parity = reduce(xor,self.rows) + self.y = [2<>j)&1)<>1,f&1)) + for j,y in enumerate(self.y): + constrain(reduce(xor,(r[j] for r in self.blocks),y)) + phase = dict(self.phase) + for mask,v in Q.substitute(q,[self.y[j] for j in idx]).items(): + Q.term(phase,mask,v) + for r in self.blocks: + coords = [r[i] for i in idx] + for j in range(4): + if j not in idx: + constrain(reduce(xor,(r[i]^self.y[i] for i,c in zip(idx,cols,strict=True) + if c>>j&1),r[j]^self.y[j])) + for mask,v in Q.substitute(q,coords).items(): + Q.term(phase,mask,-v) + solved = solution(4+self.rank,equations) + if solved is None: + return ZERO + n,forms = solved + labels = forms[:4] + mask = reduce(int.__or__,(f>>1 for f in labels),0) + fixed = mask.bit_length() + Q.need(mask == (1<>v)&1, (L>>w)&1, pairing(v,w)) + + +@cache +def geometry(): + bases,spaces,rings = quotient() + elems = [span(B) for B in bases] + flags = [(L,v) for L,vs in zip(spaces,elems,strict=True) for v in vs if v] + counts = Counter(relation(BASE,1,L,v) for L,v in flags) + reps = {relation(BASE,1,L,v):(L,v) for L,v in flags} + require(len(flags)==NFLAGS and list(counts.values()).count(0)==0,"flag inventory") + return spaces,elems,counts,reps + + +def class_inverse(data): + classes = data['classes'] + rows = data['characters'] + coeffs = [] + for chi in rows: + n,rem = divmod(sum(c['size']*a*a for c,a in zip(classes,chi,strict=True)),ORDER) + require(not rem and chi[0]%n==0,"ordinary packet size") + degree = chi[0]//n + eig = Fraction(sum(c['size']*a*(-64)**c['fixed'] for c,a in zip(classes,chi,strict=True)), + chi[0]*16**12) + coeffs.append(degree/eig) + den = lcm(*(x.denominator for x in coeffs)) + nums = [(x*den).numerator for x in coeffs] + return [Fraction(sum(v*c for v,c in zip(col,nums,strict=True)),den*ORDER) + for col in zip(*rows,strict=True)] + + +@cache +def orbital_kernels(): + data = json.loads((HERE/'predecessor'/'source'/'CLASS-ALGEBRA.json').read_text()) + spaces,elems,counts,_ = geometry() + gram,recip = Counter(),Counter() + for c,reciprocal in zip(data['classes'],class_inverse(data),strict=True): + old = None + for S in c['representatives']: + action = [apply(S,v) for v in range(256)] + obs = Counter() + for L,vs in zip(spaces,elems,strict=True): + ws = [action[v] for v in vs] + X = sum(1<>v)&1,(L>>w)&1,pairing(v,w))] += 1 + if old is not None: + require(old==obs,"rationally fused classes have unequal displacement census") + old=obs + for key,n in old.items(): + mass=c['size']*n + gram[key]+=mass*(-64)**c['fixed'] + recip[key]+=mass*reciprocal + G = {k:Fraction(gram[k],NFLAGS*m*16**12) for k,m in counts.items()} + I = {k:recip[k]/(NFLAGS*m) for k,m in counts.items()} + return G,I + + +def rhs(j): + return Fraction(1,4**13)*Fraction(-1,64)**j/(1<<(4-j)) + + +@cache +def weights(): + """Scalar weights for the unmarked summand and every ordered pointed pair.""" + spaces,_,_,reps = geometry() + _,kernel = orbital_kernels() + # Recover the unmarked kernel by summing inverse transition weights over + # all marked target points at a fixed Lagrangian, starting at one marked flag. + by_shell = {} + bases,_,rings = quotient() + for B,L,j in zip(bases,spaces,rings,strict=True): + if j not in by_shell: + by_shell[j]=sum(kernel[relation(BASE,1,L,v)] for v in span(B) if v) + unmarked=[] + candidates = {j:L for j,L in zip(rings,spaces,strict=True)} + for j in range(5): + X=candidates[j] + unmarked.append(sum(by_shell[distance(X,Y)]*rhs(i) for Y,i in zip(spaces,rings,strict=True))) + restricted = [(Y,rhs(i)) for Y,i in zip(spaces,rings,strict=True) if (Y>>1)&1] + pointed = {k:sum(kernel[relation(X,x,Y,1)]*b for Y,b in restricted) + for k,(X,x) in reps.items()} + return tuple(unmarked),pointed + + +def transformed_inputs(target,left_basis,right_basis): + for S in (target,left_basis,right_basis): + require(is_symplectic(S),"four-qubit symplectic map required") + return compose(inverse(tuple(left_basis)),compose(tuple(target),tuple(right_basis))) + + +def site_weights(relative,r,c,unmarked,pointed): + """Walsh factors indexed in the repeated site's left and right bases.""" + require(type(r) is int and type(c) is int and 0<=r<16 and 0<=c<16,"invalid repeated-site labels") + X=point_set(relative[:4]) + raw=[Fraction(0)]*256 + raw[0]=unmarked[distance(BASE,X)] + for v in range(1,16): + w=apply(relative,v) + for u in range(1,16): + raw[u | (v<<4)]=pointed[relation(BASE,u,X,w)] + for bit in range(8): + shift=1<> 1) & argument).bit_count() % 2 + + +def linear_forms(offset, columns, width): + return [((offset >> i) & 1) | sum(((c >> i) & 1) << (j+1) + for j,c in enumerate(columns)) for i in range(width)] + + +def evaluate_forms(forms, argument): + return sum(evaluate_form(f,argument) << j for j,f in enumerate(forms)) + + +def substitute_form(f, forms): + return reduce(xor, (forms[j] for j in Q.bits(f >> 1)), f & 1) + + +def validate(chart, n): + width, offset, cols, terms, a, b, e = chart + Q.need(width == n and all(type(x) is int for x in (width,a,b,e)) and e >= 0, + "Invalid chart width or scalar") + Q.validate_integer(offset,1 << n,"Invalid chart offset") + for col in cols: + Q.validate_integer(col,1 << n,"Invalid support column") + Q.basis(cols) + phase = dict(terms) + Q.need(len(phase)==len(terms),"Repeated phase monomial") + for m,v in phase.items(): + Q.validate_integer(m,1 << len(cols),"Invalid phase monomial") + Q.need(type(v) is int and 1 <= v <= 3 and + (m.bit_count() <= 1 or (m.bit_count() == 2 and v == 2)),"Invalid quadratic phase") + + +def table(target): + """Normalized Choi numerators at local address r+16c; common denominator 2**e.""" + Q.need(is_symplectic(target) and all(type(v) is int for v in target), "Invalid symplectic map") + axes = decompose(target) + values = [(int((j & 15) == (j >> 4)),0) for j in range(256)] + for axis in axes: + x,z = divmod(axis,16) + updated = [] + for j,(a,b) in enumerate(values): + e = 1 + ((x & z).bit_count() & 1) + 2*((z & (j ^ x)).bit_count() & 1) + u,v = Q.multiply_i(values[j ^ x],e) + updated.append(Q.multiply((1,1),(a+u,b+v))) + values = updated + return values, len(axes)+2 + + +@cache +def site(target): + vals, den = table(target) + active = [j for j,x in enumerate(vals) if x != (0,0)] + origin = min(active) + independent = [] + pivots = {} + for j in active: + u = j ^ origin + if Q.coordinates(pivots, u) is None: + independent.append(u) + pivots = Q.basis(independent) + positions = sorted(pivots) + columns = [pivots[j][0] for j in positions] + rotations = [Q.multiply_i(vals[origin],k) for k in range(4)] + phase = {1 << i: rotations.index(vals[origin ^ c]) for i,c in enumerate(columns)} + for i,c in enumerate(columns): + for h,d in enumerate(columns[:i]): + value = (rotations.index(vals[origin ^ c ^ d]) - phase[1<> i) & 1) << h for h,i in enumerate(positions)) + reconstructed = reduce(xor,(columns[h] for h in Q.bits(coords)),origin) + expected = rotations[Q.value(phase,coords)] if reconstructed == j else (0,0) + Q.need(value==expected,"Single-site affine phase reconstruction") + return origin, positions, columns, phase, vals[origin], den + + +def eliminate(n, fixed, phase): + """Sum n-fixed Boolean variables, retaining the affine conditions on the fixed ones.""" + scalar = (1,0) + constraints = [] + while n > fixed: + n -= 1 + last = 1 << n + a = phase.pop(last,0) + neighbours = 0 + for mask in tuple(phase): + if mask & last: + neighbours ^= mask ^ last + del phase[mask] + if a & 1: + scalar = Q.multiply(scalar,(1,1 if a == 1 else -1)) + Q.affine(phase,neighbours << 1,-a) + continue + scalar = (2*scalar[0],2*scalar[1]) + if neighbours >> fixed: + # Solve a second *summed* variable. No factor accompanies fixing this bit. + _,forms = solution(n,[(neighbours,a//2)]) + phase = Q.substitute(phase,forms) + n -= 1 + else: + constraints.append((neighbours,a//2)) + resolved = solution(fixed,constraints) + if resolved is None: + return None + rank, forms = resolved + return rank, forms, Q.substitute(phase,forms), scalar + + +class Observation: + def __init__(self, chart): + validate(chart,104) + _,offset,columns,terms,a,b,self.denominator = chart + self.rank = len(columns) + self.scalar = (a,b) + self.phase = dict(terms) + # The high half of each address is the physical row, the low half its column. + raw = linear_forms(offset,columns,104) + raw = [((f >> 1) << 9) | (f & 1) for f in raw] + self.blocks = [] + for t in range(13): + rows = [raw[52+4*t+j] ^ (1 << (5+j)) for j in range(4)] + self.blocks.append(rows + raw[4*t:4*t+4]) + + def fibre(self,target): + origin,pivots,cols,local,anchor,den = site(tuple(target)) + equations = [] + phase = {k << 8:v for k,v in self.phase.items()} + for block in self.blocks: + displaced = [f ^ ((origin >> j) & 1) for j,f in enumerate(block)] + coords = [displaced[j] for j in pivots] + for j in range(8): + if j not in pivots: + eq = reduce(xor,(coord for col,coord in zip(cols,coords,strict=True) if col >> j & 1), + displaced[j]) + equations.append((eq >> 1,eq & 1)) + for k,v in Q.substitute(local,coords).items(): + Q.term(phase,k,-v) + for j in range(4): + Q.product(phase,1 << (1+j),block[j]) + zero = (8,0,(),(),0,0,0) + resolved = solution(8+self.rank,equations) + if resolved is None or self.scalar == (0,0): + return zero + n,forms = resolved + labels = forms[:8] + # Highest-pivot elimination leaves a prefix of free label variables before observations. + label_mask = reduce(int.__or__,(f >> 1 for f in labels),0) + fixed = label_mask.bit_length() + Q.need(label_mask == (1 << fixed)-1,"Noncontiguous free labels") + summed = eliminate(n,fixed,Q.substitute(phase,forms)) + if summed is None: + return zero + rank, pars, q, scale = summed + label = [substitute_form(f,pars) for f in labels] + offset = evaluate_forms(label,0) + columns = tuple(evaluate_forms(label,1 << j) ^ offset for j in range(rank)) + scalar = Q.multiply(Q.multiply(self.scalar,power(conjugate(anchor),13)),scale) + scalar = Q.multiply_i(scalar,q.pop(0,0)) + (a,b),e = Q.normalize(scalar,self.denominator+13*den) + return 8,offset,columns,tuple(sorted(q.items())),a,b,e + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('input',type=Path) + request = json.loads(parser.parse_args().input.read_text()) + if ('chart' in request) == ('circuit' in request): + parser.error("Supply exactly one of chart or circuit") + chart = request['chart'] if 'chart' in request else Q.signature(104,request['circuit'],request.get('initial',0)) + observation = Observation(chart) + print(json.dumps([observation.fibre(target) for target in request['targets']])) diff --git a/research/clifford-mixed-site-canonical/predecessor/canonical.py b/research/clifford-mixed-site-canonical/predecessor/canonical.py new file mode 100644 index 0000000000..4168b9aecb --- /dev/null +++ b/research/clifford-mixed-site-canonical/predecessor/canonical.py @@ -0,0 +1,128 @@ +"""Canonical coefficients for any repeated site coordinate, via the five Lagrangian distances.""" +import argparse +from collections import Counter +from fractions import Fraction +from functools import cache +from pathlib import Path +import json +import sys + +sys.path.insert(0,str(Path(__file__).resolve().parent)) +from adjoint import HERE, IDENTITY, Q, conjugate, table +from bell_reads import transvection +from compile_row import apply, span + +ORDER = 47377612800 +COUNTS = (1,30,280,960,1024) + + +def point_set(point): + return sum(1 << v for v in span(point)) + + +def distance(left,right): + return 5-(left & right).bit_count().bit_length() + + +@cache +def quotient(): + # Close the diagonal Lagrangian under a fixed list of symplectic transvections. + base = (1,2,4,8) + initial = point_set(base) + queue = [base] + seen = {initial} + axes = (1,2,4,8,16,32,64,128,3,6,12) + for point in queue: + for axis in axes: + image = tuple(transvection(axis,v) for v in point) + key = point_set(image) + if key not in seen: + seen.add(key) + queue.append(image) + points = [point_set(point) for point in queue] + rings = [distance(initial,X) for X in points] + Q.need(tuple(rings.count(j) for j in range(5))==COUNTS,"2,295 Lagrangians with correct sphere census") + return queue,points,rings + + +@cache +def radial_matrix(): + bases,points,rings = quotient() + classes = json.loads((HERE/'source/CLASS-ALGEBRA.json').read_text())['classes'] + mass = [0]*5 + for c in classes: + counts = [] + for s in c['representatives']: + action = [apply(s,v) for v in range(256)] + moved = [point_set(tuple(action[v] for v in X)) for X in bases] + counts.append(Counter(distance(a,b) for a,b in zip(moved,points,strict=True))) + Q.need(all(h==counts[0] for h in counts),"Rational packet has dissimilar displacements") + for j in range(5): + mass[j] += c['size']*(-64)**c['fixed']*counts[0][j] + kernel = [Fraction(v,len(points)*cnt*16**12) for v,cnt in zip(mass,COUNTS,strict=True)] + reps = [points[rings.index(j)] for j in range(5)] + return tuple(tuple(sum(kernel[distance(Y,X)] for X,r in zip(points,rings,strict=True) if r==k) + for k in range(5)) for Y in reps) + + +def solve(matrix,rhs): + augmented = [list(row)+[v] for row,v in zip(matrix,rhs,strict=True)] + for j in range(5): + pivot = next(i for i in range(j,5) if augmented[i][j]) + augmented[j],augmented[pivot] = augmented[pivot],augmented[j] + augmented[j]=[v/augmented[j][j] for v in augmented[j]] + for i in range(5): + if i!=j: + a=augmented[i][j] + augmented[i]=[v-a*w for v,w in zip(augmented[i],augmented[j],strict=True)] + return tuple(row[-1] for row in augmented) + + +@cache +def profile(): + # Stored values multiply conjugate(V[r,c]); factor 1/16 of extraction is absorbed. + rhs = tuple(Fraction(1,4**13)*Fraction(-1,64)**j for j in range(5)) + return solve(radial_matrix(),rhs) + + +@cache +def unitary(target): + # table divides the literal unitary by 4 for Choi normalization. + matrix, shift = table(target) + return matrix,shift-2 + + +def transition(target,p,r,c,left_basis=IDENTITY,right_basis=IDENTITY): + """Literal for a,b supplied as normalized stabilizer columns.""" + Q.need(all(type(v) is int and 0 <= v < m for v,m in ((p,256),(r,16),(c,16))),"site/Pauli labels") + x,z = divmod(p,16) + mid,e = unitary(tuple(target)) + left,u = unitary(tuple(left_basis)) + right,v = unitary(tuple(right_basis)) + result = (0,0) + for j in range(16): + l = conjugate(left[(j ^ x) | (r << 4)]) + if (z & j).bit_count()%2: + l = (-l[0],-l[1]) + if l == (0,0): + continue + for k in range(16): + term = Q.multiply(l,Q.multiply(mid[j | (k << 4)],right[k | (c << 4)])) + result = result[0]+term[0],result[1]+term[1] + return tuple(Fraction(value,1 << (e+u+v)) for value in result) + + +def coefficient(target,p,r,c,left_basis=IDENTITY,right_basis=IDENTITY): + val = conjugate(transition(target,p,r,c,left_basis,right_basis)) + j = distance(point_set(tuple(left_basis[:4])),point_set(tuple(apply(target,b) for b in right_basis[:4]))) + weight = profile()[j] + return val[0]*weight,val[1]*weight + + +if __name__=='__main__': + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument('input',type=Path) + rec=json.loads(parser.parse_args().input.read_text()) + print(json.dumps([[str(v) for v in coefficient(tuple(t),p,rec['row'],rec['column'], + tuple(rec.get('left_basis',IDENTITY)),tuple(rec.get('right_basis',IDENTITY)))] + for t,p in rec['queries']])) diff --git a/research/clifford-mixed-site-canonical/predecessor/source/CLASS-ALGEBRA.json b/research/clifford-mixed-site-canonical/predecessor/source/CLASS-ALGEBRA.json new file mode 100644 index 0000000000..cbee453d50 --- /dev/null +++ b/research/clifford-mixed-site-canonical/predecessor/source/CLASS-ALGEBRA.json @@ -0,0 +1,165 @@ +{ +"classes":[ +{"size":1,"fixed":8,"representatives":[[1,2,4,8,16,32,64,128]]}, +{"size":987033600,"fixed":1,"representatives":[[154,29,55,73,118,33,251,224]]}, +{"size":987033600,"fixed":1,"representatives":[[42,98,59,245,15,85,165,198]]}, +{"size":329011200,"fixed":1,"representatives":[[194,245,128,166,5,82,143,80]]}, +{"size":329011200,"fixed":1,"representatives":[[42,68,222,16,40,150,76,9]]}, +{"size":987033600,"fixed":1,"representatives":[[148,211,117,173,154,193,22,185]]}, +{"size":987033600,"fixed":1,"representatives":[[12,254,217,49,93,7,62,237]]}, +{"size":1480550400,"fixed":1,"representatives":[[44,208,158,123,160,196,75,245]]}, +{"size":1480550400,"fixed":1,"representatives":[[178,14,118,201,167,84,222,107]]}, +{"size":1184440320,"fixed":1,"representatives":[[117,186,49,214,200,79,180,213]]}, +{"size":1184440320,"fixed":1,"representatives":[[141,25,146,248,190,37,63,252]]}, +{"size":329011200,"fixed":1,"representatives":[[42,28,89,20,121,225,38,248]]}, +{"size":1974067200,"fixed":1,"representatives":[[148,92,234,47,105,104,164,132]]}, +{"size":36556800,"fixed":1,"representatives":[[148,47,108,122,240,41,153,9]]}, +{"size":1579253760,"fixed":1,"representatives":[[181,94,208,41,23,69,31,21]]}, +{"size":3384115200,"fixed":1,"representatives":[[226,135,81,47,123,219,75,180]]}, +{"size":2632089600,"fixed":1,"representatives":[[231,237,30,164,118,139,248,6]]}, +{"size":493516800,"fixed":2,"representatives":[[194,16,78,230,46,247,12,54]]}, +{"size":164505600,"fixed":2,"representatives":[[194,146,231,40,134,187,130,58]]}, +{"size":493516800,"fixed":2,"representatives":[[197,55,22,26,8,20,107,73]]}, +{"size":370137600,"fixed":2,"representatives":[[42,223,98,199,129,25,131,158]]}, +{"size":370137600,"fixed":2,"representatives":[[95,188,85,7,143,2,140,76]]}, +{"size":592220160,"fixed":2,"representatives":[[119,62,242,34,183,156,99,237]]}, +{"size":164505600,"fixed":2,"representatives":[[89,66,216,101,202,121,52,152]]}, +{"size":54835200,"fixed":2,"representatives":[[194,123,14,193,111,187,130,211]]}, +{"size":123379200,"fixed":2,"representatives":[[86,114,172,52,93,59,60,219]]}, +{"size":41126400,"fixed":2,"representatives":[[232,159,179,86,135,43,76,48]]}, +{"size":92534400,"fixed":2,"representatives":[[33,30,96,168,49,32,204,104]]}, +{"size":92534400,"fixed":2,"representatives":[[150,177,85,206,245,15,163,255]]}, +{"size":61689600,"fixed":2,"representatives":[[232,80,90,191,69,196,130,248]]}, +{"size":197406720,"fixed":2,"representatives":[[118,42,240,89,25,227,210,21]]}, +{"size":109670400,"fixed":2,"representatives":[[65,203,139,2,211,95,157,104]]}, +{"size":658022400,"fixed":2,"representatives":[[241,178,184,242,90,116,201,87]]}, +{"size":12185600,"fixed":2,"representatives":[[220,125,224,203,172,77,115,192]]}, +{"size":526417920,"fixed":2,"representatives":[[34,175,29,217,44,122,5,114]]}, +{"size":1128038400,"fixed":2,"representatives":[[108,66,67,192,128,241,209,101]]}, +{"size":877363200,"fixed":2,"representatives":[[97,40,33,147,246,168,167,243]]}, +{"size":82252800,"fixed":3,"representatives":[[93,57,125,85,223,5,122,129]]}, +{"size":82252800,"fixed":3,"representatives":[[136,7,100,190,106,169,140,191]]}, +{"size":123379200,"fixed":3,"representatives":[[42,158,160,46,192,177,131,223]]}, +{"size":123379200,"fixed":3,"representatives":[[229,170,69,68,198,196,214,90]]}, +{"size":41126400,"fixed":3,"representatives":[[1,193,172,225,185,10,13,14]]}, +{"size":46267200,"fixed":3,"representatives":[[127,234,236,158,100,33,76,101]]}, +{"size":15422400,"fixed":3,"representatives":[[1,230,135,72,181,132,107,79]]}, +{"size":7711200,"fixed":3,"representatives":[[6,139,138,104,202,121,253,3]]}, +{"size":7711200,"fixed":3,"representatives":[[1,171,69,160,159,33,164,205]]}, +{"size":164505600,"fixed":3,"representatives":[[194,119,41,230,73,144,107,54]]}, +{"size":54835200,"fixed":3,"representatives":[[32,193,184,149,23,197,21,140]]}, +{"size":197406720,"fixed":3,"representatives":[[27,66,91,129,188,58,101,19]]}, +{"size":10281600,"fixed":4,"representatives":[[241,248,41,37,26,30,151,180]]}, +{"size":15422400,"fixed":4,"representatives":[[251,36,203,199,37,51,165,67]]}, +{"size":3427200,"fixed":4,"representatives":[[191,40,120,202,175,118,254,170]]}, +{"size":3855600,"fixed":4,"representatives":[[1,204,69,138,180,108,107,101]]}, +{"size":1285200,"fixed":4,"representatives":[[56,47,230,178,135,154,182,79]]}, +{"size":963900,"fixed":4,"representatives":[[238,147,149,118,101,188,215,26]]}, +{"size":64260,"fixed":4,"representatives":[[1,199,40,36,48,32,168,68]]}, +{"size":10967040,"fixed":4,"representatives":[[42,28,218,214,56,35,107,181]]}, +{"size":3655680,"fixed":4,"representatives":[[42,46,180,147,79,127,168,135]]}, +{"size":13160448,"fixed":4,"representatives":[[242,144,61,228,54,120,244,159]]}, +{"size":514080,"fixed":5,"representatives":[[1,140,138,111,122,201,77,3]]}, +{"size":514080,"fixed":5,"representatives":[[1,230,224,134,119,74,169,141]]}, +{"size":321300,"fixed":5,"representatives":[[1,40,198,202,17,200,64,170]]}, +{"size":685440,"fixed":5,"representatives":[[120,170,125,80,224,32,64,161]]}, +{"size":16065,"fixed":6,"representatives":[[1,230,224,236,29,32,169,141]]}, +{"size":5355,"fixed":6,"representatives":[[175,217,170,125,190,85,155,245]]}, +{"size":10880,"fixed":6,"representatives":[[1,96,102,225,249,171,64,105]]}, +{"size":255,"fixed":7,"representatives":[[1,235,237,225,249,32,64,105]]}, +{"size":329011200,"fixed":0,"representatives":[[32,57,133,76,234,200,17,81]]}, +{"size":1974067200,"fixed":0,"representatives":[[201,133,191,158,129,229,135,24]]}, +{"size":1579253760,"fixed":0,"representatives":[[151,214,54,11,144,217,9,96]]}, +{"size":526417920,"fixed":0,"representatives":[[60,220,203,186,37,133,74,161]]}, +{"size":164505600,"fixed":0,"representatives":[[200,110,217,245,24,12,235,215]]}, +{"size":27417600,"fixed":0,"representatives":[[201,65,253,221,9,44,99,191]]}, +{"size":609280,"fixed":0,"representatives":[[201,165,25,57,237,44,99,91]]}, +{"size":2256076800,"fixed":0,"representatives":[[108,32,33,41,105,122,209,140]]}, +{"size":1754726400,"fixed":0,"representatives":[[145,156,85,2,67,128,151,230]]}, +{"size":3158507520,"fixed":0,"representatives":[[103,29,224,202,59,123,105,97]]}, +{"size":2368880640,"fixed":0,"representatives":[[227,240,64,89,106,98,101,58]]}, +{"size":157925376,"fixed":0,"representatives":[[242,56,95,43,27,187,107,238]]}, +{"size":5573836800,"fixed":0,"representatives":[[209,255,139,43,149,49,125,71],[134,149,130,47,108,131,93,132]]} +], +"characters":[ +[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], +[35,0,-2,2,0,-2,0,1,-1,-1,1,1,-1,-3,-1,0,0,0,2,0,1,1,1,-2,0,2,-2,-1,3,-1,3,3,1,-1,-1,0,2,-4,0,1,-3,-2,-1,-1,3,-5,-2,0,-1,2,3,6,-1,7,3,-5,0,2,5,-1,-9,-5,-6,11,3,14,-21,1,-1,0,2,1,-3,5,0,-1,0,0,0,1], +[51,-2,0,0,2,0,-2,-1,1,1,-1,1,-1,-3,-1,0,0,0,2,0,1,1,1,2,4,-2,2,3,-1,3,-1,1,-1,-3,1,2,0,0,-4,-3,1,-2,-1,-1,-5,3,-2,0,-1,2,3,-2,7,-1,3,11,4,6,1,-9,-1,-5,-6,11,19,6,-21,2,0,-1,1,2,-2,6,-1,0,1,1,1,0], +[85,0,0,-2,-2,0,0,-1,-1,-1,-1,-2,0,2,0,-1,-1,2,0,2,1,1,1,2,0,2,2,1,1,1,1,0,2,4,2,1,1,-2,-2,-3,-3,-2,-3,-3,-3,-3,-2,-4,-3,6,5,6,5,5,5,5,6,4,5,-11,-11,-11,-10,21,21,22,-43,-1,1,1,-1,-1,3,-5,1,1,0,0,0,0], +[119,-1,1,-1,1,1,-1,-1,1,1,-1,0,0,0,0,0,0,1,1,1,1,1,1,-1,-1,3,-1,-1,3,-1,3,2,2,2,0,0,2,5,1,1,5,3,3,3,-1,7,3,3,3,7,7,11,3,11,7,-1,5,5,9,11,19,15,15,31,23,35,63,-1,-1,0,0,-1,-1,-1,0,-1,-1,-1,-1,0], +[135,1,-1,1,-1,-1,1,1,-1,-1,1,0,0,0,0,0,0,1,1,1,1,1,1,3,3,-1,3,3,-1,3,-1,0,0,0,2,2,0,1,5,5,1,3,3,3,7,-1,3,3,3,7,7,3,11,3,7,15,9,9,5,19,11,15,15,31,39,27,63,0,0,-1,-1,0,0,0,-1,0,0,0,0,-1], +[238,0,0,-2,2,-1,1,0,0,0,-2,1,1,1,-1,0,1,-2,0,-1,2,-2,0,2,0,1,5,2,2,-2,2,3,-1,-5,-1,0,1,-5,-1,2,-2,1,2,-2,-6,-6,-2,4,2,-3,2,9,-2,14,-2,14,-6,4,8,10,-22,-2,-11,30,-18,49,-98,-1,1,-1,-1,-1,3,-5,0,1,0,-1,3,0], +[510,1,1,3,-1,1,-1,0,0,-1,1,-1,1,3,-1,-1,0,-1,1,-1,-2,2,1,3,1,1,5,2,2,-2,3,1,-1,-3,-1,-1,0,3,-1,-2,2,5,2,-2,10,10,-1,-3,-1,1,2,13,-2,14,14,30,-5,-3,5,-6,26,14,9,46,-2,69,174,-1,1,0,2,3,7,15,-1,0,0,0,0,0], +[595,-1,1,1,-1,1,1,1,-1,0,0,1,-1,5,1,0,-1,-1,1,-1,1,-3,-2,1,-1,-1,-1,-1,3,3,2,5,-1,1,1,0,1,7,-1,1,1,-5,-5,-1,-1,7,1,-1,-2,-5,-1,11,-1,23,-13,-5,-1,1,10,-5,35,-5,11,43,-13,91,203,2,0,-1,1,-2,2,10,0,1,0,0,0,0], +[595,0,0,-2,-2,-1,-1,1,1,0,0,3,1,-1,0,0,-1,0,2,1,-1,-1,0,0,-6,1,-7,7,-1,-1,0,-3,-1,1,0,0,1,1,1,-1,-1,-3,3,-5,3,3,0,2,0,5,-5,-3,-5,11,3,51,0,10,0,-5,-5,3,5,35,-45,-35,35,-1,-1,0,0,3,3,19,0,1,-1,1,5,0], +[918,0,0,2,-2,1,-1,0,0,-2,0,0,0,0,0,1,0,0,2,-1,-2,2,-2,0,6,1,-3,2,2,6,0,0,0,0,-2,1,0,-1,-5,-2,2,-3,2,6,-6,-6,0,6,0,-7,2,-3,22,6,6,54,0,18,-2,-22,10,6,-15,38,150,-27,-90,0,0,0,-2,0,0,0,1,0,0,-1,3,0], +[1190,1,1,-1,3,-1,1,0,0,1,-1,-2,0,2,0,0,-1,1,3,-1,2,-2,-1,1,7,1,-3,2,2,6,1,-2,0,2,-2,0,-1,-1,3,2,-2,1,2,6,10,10,1,-1,-3,-3,2,1,22,6,22,70,1,11,-5,26,-6,22,5,54,166,-7,182,0,0,1,1,4,4,20,0,-1,0,0,0,0], +[1275,1,-1,-1,1,1,1,-1,1,0,0,2,0,6,0,-1,0,-3,-1,-1,-3,1,0,-1,5,3,3,3,-1,-1,0,2,0,6,0,1,0,-1,7,1,1,-1,-5,-9,7,-1,-1,-3,0,-1,-1,-1,15,-9,-21,35,5,15,0,35,-5,-13,15,35,155,15,195,3,-1,0,0,-1,-1,15,1,0,0,0,0,0], +[1512,-1,1,1,-1,1,-1,0,0,1,1,0,0,0,1,0,0,-1,1,-1,0,0,1,-3,3,1,-3,0,0,0,1,0,0,0,-1,0,0,-5,-1,4,-4,-3,0,0,8,-8,-3,3,1,1,8,21,-8,24,8,-24,-9,9,17,16,-64,-24,-39,136,-24,189,-504,0,0,1,-1,0,0,0,0,0,0,1,-3,-1], +[1785,0,0,0,0,0,0,-1,-1,-1,-1,1,1,9,1,0,0,0,4,0,1,1,1,-4,0,-4,-4,-3,-3,-3,-3,3,-1,3,-1,0,0,0,0,-3,-3,4,1,1,-15,-15,4,0,1,4,9,-12,-7,-7,9,-55,0,12,5,9,9,25,36,121,57,84,441,2,0,0,2,2,6,30,0,0,0,0,0,0], +[1785,0,0,2,-2,0,2,-1,1,-1,-1,1,-1,-3,1,0,0,2,0,-2,-1,-1,1,2,-4,0,4,5,1,-3,-3,-1,1,3,-1,0,0,2,-2,3,-1,4,-3,5,-15,9,-2,0,1,0,1,-4,-3,-11,-7,65,-10,12,5,29,-11,1,-24,81,-103,84,-399,-2,0,0,2,2,-10,30,0,0,0,0,0,0], +[2295,1,-1,-1,1,0,0,-1,1,0,0,0,0,0,1,1,0,1,-1,0,-3,1,-2,3,-3,0,0,-1,3,3,2,0,0,0,1,-1,0,-4,4,-3,-3,0,-1,3,-5,-13,3,-3,-2,8,3,24,3,27,7,15,9,-9,10,-25,-65,-33,-24,143,87,216,-657,0,0,-1,1,0,0,0,-1,0,0,0,0,0], +[2856,1,-1,-3,-1,-1,1,0,0,0,0,-2,0,-6,0,0,0,-1,-1,-1,0,0,0,-3,1,1,-3,0,0,0,0,-2,0,-6,-2,0,0,3,-1,-4,4,1,0,0,-8,8,1,-3,0,5,8,25,-8,24,8,-24,-5,3,16,0,80,40,45,200,40,273,840,0,0,0,-2,0,-8,-24,0,0,1,1,1,0], +[2856,1,-1,-1,1,-1,1,0,0,1,1,0,0,0,1,0,0,-1,1,-1,0,0,1,1,-1,-3,1,0,0,0,1,2,-2,-6,1,0,0,-1,-5,-4,4,-3,0,0,-8,8,-3,3,1,1,8,-19,24,-8,8,40,11,21,1,-64,16,-24,-39,136,296,21,-504,-2,0,1,1,-2,2,-6,0,0,-1,0,-4,0], +[2975,-1,-1,-1,-1,0,0,1,1,0,0,1,1,-7,0,0,-1,1,1,0,-1,-1,0,-3,5,-4,4,3,3,-5,0,5,1,5,0,0,-1,-4,-4,3,3,4,-1,7,-1,-1,1,-7,0,4,-9,-4,-1,31,-17,15,5,5,0,-25,-25,31,20,-65,95,140,-385,1,1,0,0,-3,5,5,0,-1,0,0,0,0], +[2975,-1,1,1,-1,0,0,1,-1,0,0,1,1,1,0,0,1,-1,-3,0,1,-3,0,1,3,4,4,3,-1,-1,0,-3,1,5,0,0,-1,4,-4,-3,-3,4,-1,-5,-13,-5,1,-5,0,12,3,12,19,-5,-1,55,15,5,0,-65,-25,-41,-20,135,255,140,-665,1,-1,0,0,1,-3,5,0,-1,0,0,0,0], +[3213,-1,-1,1,1,-1,-1,-1,1,0,2,0,0,0,1,0,0,-1,1,1,3,-1,0,3,-3,1,9,1,-3,-3,-2,0,0,0,-1,0,0,1,1,-1,-1,-3,-3,9,17,-7,3,-3,-2,-11,1,-3,1,9,-19,69,-9,9,8,-35,37,-27,21,85,-147,189,693,0,0,1,-1,0,0,0,0,0,0,-1,3,0], +[3213,1,1,1,1,1,1,1,1,0,0,0,0,0,-1,0,0,1,1,1,1,1,0,-3,-3,-3,-3,-3,-3,-3,-4,0,0,0,-1,0,0,1,1,1,1,-3,-3,-3,13,13,-3,-3,-4,13,13,-3,-3,-3,13,-51,9,9,8,-35,-35,-51,-51,205,141,189,-819,0,0,-1,-1,0,0,0,0,0,0,-1,3,0], +[3400,-1,-1,1,1,0,0,0,0,0,0,3,-1,3,0,0,0,1,-1,2,0,0,0,1,-1,2,2,0,0,0,0,-1,-1,7,0,-2,-2,-2,-2,0,0,6,8,8,8,8,-3,3,0,14,8,14,8,8,40,40,5,-5,0,40,40,72,30,200,200,190,840,2,0,0,0,-2,2,10,1,1,0,0,0,0], +[3570,-1,-1,1,1,1,1,0,0,0,0,-2,0,-6,0,0,0,1,-5,-3,2,2,0,-3,-1,1,9,-2,-2,6,0,2,0,6,0,0,0,1,1,-2,-2,1,2,-6,2,2,1,3,0,1,-6,-7,-14,18,34,66,5,15,0,10,10,-14,-15,-110,50,105,210,0,0,0,0,0,8,24,0,0,-1,1,5,0], +[3570,0,0,2,2,-1,-1,0,0,0,0,0,0,0,-1,0,0,0,-2,-1,-2,-2,-2,0,-2,-1,-1,-2,-2,-2,-2,-2,2,6,1,0,0,-1,-1,2,2,-9,-6,-6,-6,-6,0,6,2,7,2,7,2,2,-30,-30,16,6,10,50,50,18,39,178,178,231,882,-1,1,1,1,3,7,15,0,0,0,0,0,0], +[3570,2,0,0,-2,1,-1,0,0,0,0,-2,0,-6,-1,0,0,0,2,1,2,-2,-2,2,-4,-1,3,-2,-2,2,-2,2,0,6,1,0,0,-3,1,-2,2,7,6,-6,-10,6,-2,0,2,-13,-2,-1,2,18,-30,50,-4,6,10,30,-50,34,-21,98,-142,231,-798,3,-1,1,1,-1,-1,15,0,0,0,0,0,0], +[3808,1,-1,1,-1,0,0,0,0,1,-1,-2,0,-6,0,0,0,-1,3,0,0,0,1,-3,1,0,0,0,0,0,3,-2,0,10,2,0,-2,4,-4,0,0,-8,0,0,16,-16,1,-3,3,0,0,16,0,0,32,-96,-5,7,-7,16,-16,-32,0,96,-32,112,-672,0,0,0,2,0,-8,40,0,1,0,-1,3,0], +[4200,-1,1,-1,-3,1,-1,0,0,0,0,-2,0,-6,0,0,0,-1,-1,-1,0,0,0,1,-3,-3,1,0,0,0,0,0,-2,-12,0,0,0,-1,3,4,-4,1,0,0,8,-8,1,-3,0,5,8,-15,24,-8,8,40,15,15,0,80,0,40,45,200,360,105,840,-2,0,0,0,-2,-6,-30,0,0,0,0,0,1], +[4760,1,-1,-1,1,1,-1,0,0,-1,-1,2,0,-2,0,0,1,1,-1,1,0,0,1,-1,1,-1,-5,0,0,0,1,4,-2,8,2,0,-1,5,1,4,-4,-1,0,0,-8,8,-1,1,-3,-13,-8,7,8,40,-8,-40,1,-1,5,-16,64,-40,-5,56,-104,287,952,-2,0,1,-1,2,-2,-10,0,-1,0,0,0,0], +[5712,0,0,0,0,0,0,0,0,0,0,-1,1,3,-1,0,0,-2,2,0,0,0,0,-2,-6,4,4,0,0,0,-4,3,1,15,1,0,0,0,0,0,0,-4,0,16,0,0,2,6,-4,-4,0,12,16,16,16,16,-6,6,-8,0,0,80,-36,80,336,-84,336,-2,0,-1,1,-2,-6,-30,0,0,0,1,-3,0], +[5950,0,0,0,0,-1,-1,0,0,0,0,-4,0,4,0,0,1,2,-2,1,-2,-2,0,-2,2,1,1,2,2,2,0,2,-2,10,0,0,1,-3,-3,2,2,5,-10,6,6,6,2,-2,0,13,-2,-19,-2,-2,14,-50,-10,10,0,30,30,-34,-35,190,-130,-35,-770,1,-1,0,0,1,5,-35,0,1,0,0,0,0], +[5950,1,1,-1,-1,-1,-1,0,0,0,0,2,0,6,0,0,0,-1,-3,-1,2,2,0,3,1,-1,-1,-6,2,2,0,4,2,-8,0,0,-2,-1,-1,2,2,-1,-2,6,-2,-2,-1,-3,0,15,-10,-17,-10,38,14,30,-5,25,0,-10,-10,14,15,-210,190,175,-210,-1,-1,0,0,3,-5,-5,0,1,0,0,0,0], +[7140,-1,-1,-1,-1,0,0,0,0,1,1,0,0,0,0,0,0,1,1,2,0,0,-1,1,1,2,-6,-4,-4,4,-1,4,0,12,-2,0,0,2,2,0,0,6,-4,-12,-4,-4,-3,-3,3,-2,-4,22,20,-12,4,100,-11,21,-5,-4,-4,-60,30,4,484,-42,-252,-3,1,-1,1,1,1,-15,0,0,0,0,0,0], +[8160,-1,1,-1,1,0,0,0,0,-1,1,-2,0,-6,0,0,0,-1,3,0,0,0,1,1,5,0,0,0,0,0,-1,2,0,6,2,-2,0,-4,4,0,0,-8,0,0,-16,16,1,-3,3,0,0,-16,0,0,32,160,-1,-21,5,-16,16,-32,0,96,224,-48,-672,0,0,-1,-1,4,-4,60,1,0,0,0,0,0], +[8925,-1,-1,-3,1,2,0,1,-1,0,0,0,0,0,0,0,0,1,3,0,-1,-1,0,1,-1,2,6,-3,1,-3,0,-4,0,-12,0,0,0,0,4,-1,3,6,-7,9,5,-19,-3,3,0,-6,-3,-10,-7,33,13,-155,5,15,0,-15,25,21,-30,165,125,-210,-315,0,0,0,0,4,-4,60,0,0,0,0,0,0], +[8925,1,1,-1,3,1,-1,1,-1,0,0,1,-1,-3,0,0,0,1,-1,-1,-1,-1,0,1,3,-3,1,5,1,-3,0,3,1,15,0,0,0,-1,3,-5,-1,1,1,-7,13,-11,1,3,0,5,5,-15,-15,-23,13,85,-15,15,0,-55,-15,37,45,245,-195,105,1365,-2,0,0,0,-2,-6,-30,0,0,0,0,0,0], +[8960,0,0,-2,2,0,0,0,0,-1,1,0,0,8,0,0,-1,0,-2,0,0,0,1,0,2,0,0,0,0,0,-1,-4,0,-4,2,0,-1,4,-4,0,0,0,0,0,0,0,0,2,3,-8,0,8,0,0,0,0,-16,14,5,64,-64,0,-40,256,-256,392,-1792,0,0,-1,-1,0,8,-40,0,-1,0,0,0,1], +[9639,0,0,0,0,0,0,-1,-1,1,1,0,0,0,0,0,0,0,0,0,-1,-1,1,0,0,0,0,-1,7,-1,-3,0,0,0,0,0,0,0,0,3,3,0,7,-9,-9,-9,0,0,-3,0,-9,0,15,-33,39,-105,0,0,9,-9,-9,-9,0,-9,-153,0,567,-3,-1,0,0,-3,9,81,0,0,1,0,4,0], +[10200,-1,1,3,1,-1,1,0,0,0,0,0,0,0,0,-1,0,1,-3,1,0,0,0,-1,-1,-1,-5,0,0,0,0,2,-2,-6,0,1,0,-3,1,-4,4,3,0,0,8,-8,3,3,0,-9,-8,11,8,40,-8,-40,5,-15,0,0,-80,24,15,120,-40,435,-1800,-2,0,0,0,2,-10,30,1,0,0,0,0,0], +[11900,0,0,-2,-2,0,0,0,0,0,0,-1,-1,7,0,0,1,-2,0,2,0,0,0,-2,-8,-2,-2,4,4,4,0,1,1,-7,0,0,-1,-2,-2,0,0,2,-4,-4,12,12,2,4,0,-6,-4,10,-20,-20,28,220,10,20,0,-20,-20,-4,10,60,-260,-70,700,1,1,0,0,1,1,65,0,-1,0,0,0,0], +[11900,1,1,-1,-1,0,0,0,0,0,0,3,-1,3,0,0,0,-1,1,0,0,0,0,-1,1,0,8,-4,-4,4,0,-5,-1,11,0,0,2,-4,-4,0,0,0,4,-4,4,4,3,-3,0,16,-12,-8,12,44,-4,-100,-5,5,0,20,20,-36,0,220,-260,-280,-420,-1,1,0,0,-1,-5,35,0,-1,0,0,0,0], +[13056,0,0,2,-2,0,0,0,0,1,-1,0,0,0,-1,1,0,0,-2,0,0,0,1,0,2,0,0,0,0,0,-1,-4,0,-12,1,1,0,-4,4,0,0,0,0,0,0,0,0,-6,-1,-8,0,8,0,0,0,0,-16,6,1,-64,64,0,24,256,-256,456,2304,0,0,-1,1,0,8,24,1,0,-1,0,-4,0], +[13600,0,0,0,0,0,0,0,0,0,0,2,0,-2,0,-1,1,2,-2,0,0,0,0,-2,2,-4,-4,0,0,0,0,-4,2,-8,0,-1,1,0,0,0,0,-4,0,0,0,0,2,-2,0,-20,0,-4,32,32,32,160,-10,10,0,0,0,32,-20,160,800,-260,160,2,0,0,0,-2,2,10,-1,1,0,0,0,0], +[14280,-1,-1,-1,-1,0,0,0,0,0,0,-1,1,3,0,0,0,3,-1,-2,0,0,0,-1,-5,2,2,0,0,0,0,1,-1,-3,0,0,0,2,2,0,0,-10,8,-8,8,8,-1,3,0,14,-8,-2,8,8,-24,104,-5,15,0,-40,-40,8,30,200,-440,-210,840,2,0,0,0,2,-2,6,0,0,1,-1,-5,0], +[14280,1,1,-1,-1,0,0,0,0,0,0,1,-1,-3,-1,0,0,1,3,-2,0,0,2,1,-5,2,2,0,0,0,-2,1,-1,-3,-1,0,0,2,2,0,0,-2,-8,8,-8,-8,1,3,2,6,-8,22,8,8,40,40,1,-21,-10,-40,-40,-56,54,72,328,294,-1848,2,0,1,-1,-2,10,-30,0,0,0,0,0,0], +[14688,-1,1,-1,1,0,0,0,0,-1,1,0,0,0,1,0,0,-1,-1,0,0,0,-1,-3,-3,0,0,0,0,0,1,0,0,0,1,2,0,-4,4,0,0,0,0,0,-16,16,-3,-3,1,8,0,24,0,0,32,-96,-9,-9,-17,-16,16,96,-24,224,96,216,2016,0,0,1,1,0,0,0,-1,0,0,-1,3,0], +[16065,-1,-1,-1,-1,0,0,1,-1,1,-1,0,0,0,0,0,0,-1,-1,2,-1,3,-1,3,3,-2,6,1,-3,-3,1,0,0,0,-2,0,0,2,2,3,3,-6,1,-3,-19,5,3,3,-3,2,5,-6,-11,-3,17,105,-9,-9,-5,41,-31,-39,-30,329,-159,378,-2583,0,0,1,1,0,0,0,0,0,0,0,0,0], +[16065,0,0,2,-2,-1,1,-1,1,1,1,0,0,0,-1,0,0,0,2,1,-1,-1,-1,0,6,-1,3,-3,1,-3,3,0,0,0,1,0,0,5,1,-1,-5,3,-3,-3,-15,9,0,6,-1,-1,1,-21,-19,21,33,-135,0,18,-5,-19,-59,57,39,329,33,-189,1449,0,0,0,-2,0,0,0,0,0,0,0,0,0], +[16065,0,0,2,2,-1,-1,1,-1,1,-1,0,0,0,1,0,0,0,2,-1,-1,3,-1,0,-6,3,3,1,5,-3,-3,0,0,0,1,0,0,-1,-1,-1,-1,3,1,-3,-3,21,0,-6,1,-13,5,3,-3,21,-15,-135,0,18,-5,41,-31,-87,51,89,417,-189,441,0,0,0,-2,0,0,0,0,0,0,0,0,0], +[16065,0,0,2,2,1,1,-1,-1,1,1,0,0,0,-1,0,0,0,2,-1,1,1,-1,0,-6,-1,-9,5,-3,-3,3,0,0,0,1,0,0,-1,-1,1,1,3,1,9,-15,-15,0,-6,-1,11,-7,3,-7,9,-15,225,0,18,-5,41,41,-15,-21,209,-447,-189,-1071,0,0,0,-2,0,0,0,0,0,0,0,0,0], +[16065,1,1,-1,-1,0,0,-1,-1,1,1,0,0,0,0,0,0,1,-1,2,1,1,-1,-3,3,-2,6,5,5,-3,-1,0,0,0,-2,0,0,2,2,-3,-3,-6,1,9,1,1,-3,3,3,2,-7,-6,1,33,-47,-15,9,-9,-5,41,41,-63,-30,-31,129,378,1953,0,0,-1,1,0,0,0,0,0,0,0,0,0], +[17850,-1,1,-1,1,-1,1,0,0,0,0,-1,1,3,0,0,0,1,5,-1,-2,2,0,3,-1,-3,1,-2,-2,2,0,-1,1,3,0,0,0,-1,-5,2,-2,5,-2,-14,14,-2,-1,3,0,-7,-10,5,-6,10,10,90,5,-15,0,-10,70,-22,-15,170,-70,525,2730,1,-1,0,0,-3,-7,-15,0,0,0,0,0,0], +[17850,0,2,-2,0,-1,1,0,0,0,0,-1,-1,-9,0,0,0,0,-2,1,-2,2,0,2,0,3,-1,-2,-2,-6,0,3,-1,3,0,0,0,1,-3,2,-2,-1,6,2,6,-10,2,0,0,-5,-2,15,-6,-22,-54,-70,0,30,0,-50,30,74,-45,10,570,-105,-630,2,0,0,0,2,6,30,0,0,0,0,0,0], +[18360,-1,1,1,-1,-1,1,0,0,-1,-1,0,0,0,0,1,0,-1,1,1,0,0,1,-3,3,-1,3,0,0,0,1,0,0,0,2,-1,0,1,5,-4,4,3,0,0,8,-8,-3,3,-3,7,-8,3,8,-24,-40,120,-9,9,5,64,-16,-72,15,-104,696,27,792,0,0,1,-1,0,0,0,-1,0,0,0,0,0], +[19040,1,-1,1,-1,0,0,0,0,1,-1,0,0,0,1,0,0,-1,-1,0,0,0,-1,1,1,0,0,0,0,0,-3,4,0,-4,1,0,2,4,-4,0,0,0,0,0,16,-16,-3,-3,1,8,0,-8,0,0,32,160,-5,-37,-5,16,-16,96,-24,224,352,56,2016,0,0,0,-2,4,4,20,0,-1,0,0,0,0], +[23800,-1,-1,-1,-1,0,0,0,0,0,0,-1,-1,7,0,0,1,-1,3,-2,0,0,0,-1,3,-2,-2,0,0,0,0,-3,1,13,0,0,1,2,2,0,0,2,8,8,8,8,-1,-5,0,-6,-8,-6,-8,-8,-40,-40,15,-5,0,-40,-40,56,10,120,120,490,-3080,-2,0,0,0,2,6,-50,0,1,0,0,0,0], +[23800,1,-1,1,3,1,-1,0,0,0,0,-2,0,2,0,0,-1,-1,-1,1,0,0,0,-3,1,-1,3,0,0,0,0,-2,0,-14,0,0,1,1,-3,4,-4,7,0,0,-8,8,1,5,0,11,-8,7,8,-24,-40,120,-5,-5,0,-80,0,-8,35,-40,760,175,-1960,0,0,0,0,0,-8,40,0,1,0,0,0,0], +[26775,0,0,0,0,-1,-1,-1,-1,0,0,3,1,-9,0,0,0,0,0,-1,-1,-1,0,0,0,3,-5,-1,-1,7,0,3,1,-9,0,0,0,3,3,-1,-1,3,-1,7,15,15,0,0,0,3,-1,-21,-9,-41,-9,-105,0,0,0,15,15,-9,-45,375,-105,315,-3465,1,1,0,0,-3,-3,45,0,0,0,0,0,0], +[26775,0,0,0,0,-1,-1,1,1,0,0,-3,-1,9,0,0,0,0,0,-1,-1,-1,0,0,0,3,-5,3,-5,-5,0,3,1,-9,0,0,0,3,3,-1,-1,3,7,-1,-9,-9,0,0,0,3,-1,-21,15,31,39,-105,0,0,0,15,15,-57,-45,-345,-105,315,1575,1,1,0,0,-3,-3,45,0,0,0,0,0,0], +[28560,0,0,2,2,0,0,0,0,-1,-1,-2,0,-6,1,0,0,-2,0,2,0,0,1,2,4,2,-6,0,0,0,-3,-2,0,-6,-1,0,0,2,2,0,0,-2,0,0,0,0,-2,0,1,6,-16,-2,-16,48,16,80,10,12,5,-16,-16,16,6,336,-368,-546,336,0,0,0,2,-4,4,-60,0,0,0,0,0,0], +[28917,0,0,0,0,0,0,-1,1,-2,0,0,0,0,0,0,0,0,0,0,3,-1,-2,0,0,0,0,1,5,-3,0,0,0,0,0,0,0,0,0,3,3,0,5,-15,9,-15,0,0,0,0,9,0,-15,9,21,-99,0,0,-18,-27,45,-99,0,333,405,0,-2835,0,0,0,0,0,0,0,0,0,0,1,-3,0], +[30464,0,0,2,-2,0,0,0,0,1,-1,0,0,8,0,0,-1,0,-2,0,0,0,1,0,-6,0,0,0,0,0,3,0,0,8,0,0,-1,-4,4,0,0,0,0,0,0,0,0,2,3,-8,0,-24,0,0,0,0,0,-10,9,-64,64,0,-40,256,768,-280,-1792,0,0,0,0,0,0,-64,0,-1,1,0,4,0], +[32130,-1,-1,1,1,1,1,0,0,0,0,0,0,0,-1,0,0,-1,1,1,-2,-2,2,3,-3,-3,-3,-2,6,6,-2,0,0,0,-1,0,0,1,1,-2,-2,-3,2,-6,2,2,3,-3,2,13,10,-3,-6,42,-46,-30,-9,9,-10,10,10,18,-51,-398,258,189,882,0,0,1,-1,0,0,0,0,0,0,0,0,0], +[32130,1,-1,1,-1,1,-1,0,0,0,0,0,0,0,1,0,0,1,1,-1,2,-2,2,3,3,1,-3,-2,-2,-6,2,0,0,0,-1,0,0,-5,-1,-2,2,-3,-2,-6,-2,14,3,3,-2,1,-10,21,-14,-30,-14,-30,9,9,-10,70,-10,18,-39,82,642,189,2898,0,0,-1,-1,0,0,0,0,0,0,0,0,0], +[32130,1,1,1,1,-1,-1,0,0,0,0,0,0,0,1,0,0,1,1,1,-2,-2,2,-3,-3,1,9,-2,-2,6,2,0,0,0,-1,0,0,1,1,2,2,-3,2,-6,-14,-14,-3,-3,-2,-11,10,-3,-14,18,-14,210,9,9,-10,10,10,66,21,-158,-318,189,-2142,0,0,-1,-1,0,0,0,0,0,0,0,0,0], +[34425,0,0,0,0,1,1,-1,-1,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,0,5,-3,5,-3,-3,0,0,0,0,0,-1,0,-3,-3,1,1,-3,-7,-15,9,9,0,0,0,-3,1,-27,17,33,9,-135,0,0,0,-15,-15,105,45,-375,-135,405,-2295,0,0,0,0,0,0,0,-1,0,0,0,0,0], +[34425,0,0,0,0,1,1,1,1,0,0,0,0,0,0,-1,0,0,0,1,1,1,0,0,0,5,-3,1,1,9,0,0,0,0,0,-1,0,-3,-3,1,1,-3,1,9,-15,-15,0,0,0,-3,1,-27,-7,-39,-39,-135,0,0,0,-15,-15,-39,45,345,-135,405,4185,0,0,0,0,0,0,0,-1,0,0,0,0,0], +[34560,0,0,-2,2,0,0,0,0,-1,1,0,0,0,-1,1,0,0,-2,0,0,0,1,0,-6,0,0,0,0,0,3,0,0,0,-1,1,0,4,-4,0,0,0,0,0,0,0,0,-6,-1,-8,0,-24,0,0,0,0,0,-18,5,64,-64,0,24,256,768,-216,2304,0,0,0,2,0,0,0,1,0,0,0,0,-1], +[38080,0,0,0,0,0,0,0,0,0,0,2,0,-10,0,0,-1,-2,-2,0,0,0,0,-2,-2,0,0,0,0,0,0,-2,0,10,0,0,1,0,0,0,0,8,0,0,0,0,2,2,0,-8,0,-8,0,0,64,64,10,10,0,0,0,-64,-40,-320,-320,280,2240,0,0,0,0,4,4,-44,0,1,1,-1,-5,0], +[38556,0,0,0,0,0,0,0,0,-1,-1,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,-4,-4,-4,3,0,0,0,0,0,0,0,0,0,0,0,-4,12,12,12,0,0,3,0,12,0,12,12,-36,156,0,0,-9,-36,-36,-36,0,-36,-612,0,2268,-3,-1,0,0,-3,9,81,0,0,1,1,1,0], +[43520,0,0,0,0,0,0,0,0,0,0,0,0,-8,1,-1,1,0,4,0,0,0,-2,0,-4,0,0,0,0,0,2,-4,0,-4,1,1,-1,0,0,0,0,0,0,0,0,0,0,4,-2,16,0,-16,0,0,0,0,-16,-4,10,0,0,0,16,-512,512,176,-512,0,0,-1,1,0,8,-40,1,-1,0,0,0,0], +[47600,0,0,0,0,0,0,0,0,0,0,-1,1,3,0,0,0,0,-4,0,0,0,0,4,0,-4,-4,0,0,0,0,-3,-1,17,0,0,2,0,0,0,0,-4,0,16,0,0,-4,0,0,-4,0,12,-16,-16,48,-80,0,20,0,0,0,-16,60,-400,240,140,-1680,2,0,0,0,-2,-6,50,0,-1,0,0,0,0], +[48195,0,0,0,0,0,0,-1,-1,0,0,0,0,0,0,0,0,0,0,0,-1,-1,0,0,0,0,0,-5,3,-5,0,0,0,0,0,0,0,0,0,3,3,0,3,3,3,3,0,0,0,0,3,0,27,-21,3,51,0,0,0,-45,-45,-45,0,-45,-765,0,2835,3,1,0,0,3,-9,-81,0,0,-1,1,5,0], +[51408,0,0,-2,-2,0,0,0,0,1,1,0,0,0,0,0,0,0,-2,-2,0,0,1,0,6,2,-6,0,0,0,-3,0,0,0,2,0,0,-2,-2,0,0,6,0,0,0,0,0,6,-3,-2,16,6,-16,48,-48,144,0,-18,-7,16,16,-48,30,16,-48,-378,-1008,0,0,0,2,0,0,0,0,0,0,-1,3,0], +[53550,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,-2,-2,0,0,0,-3,5,2,-6,2,0,6,2,-18,0,0,0,-3,-3,-2,-2,-3,6,6,6,6,0,0,0,-3,-2,21,6,-10,30,-210,0,0,0,30,30,-66,45,30,-210,-315,-1890,-1,-1,0,0,3,3,-45,0,0,0,0,0,0], +[57120,0,0,0,0,0,0,0,0,0,0,2,0,6,-1,0,0,2,2,0,0,0,-2,-2,6,4,4,0,0,0,-2,0,-2,-12,1,0,0,0,0,0,0,-4,0,0,0,0,2,-6,2,-4,0,12,-32,-32,32,160,6,6,10,0,0,32,-36,-352,288,-84,672,-2,0,1,1,-2,-6,-30,0,0,0,0,0,0], +[65536,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,-2,2,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-32,16,0,0,0,0,0,0,-512,0,0,0,0,-2,0,0,64,-1,1,-1,0,-4,1], +[68850,0,0,0,0,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,-1,2,2,0,0,0,-5,3,6,-2,6,0,0,0,0,0,-2,0,3,3,2,2,3,-6,-6,-6,-6,0,0,0,3,2,27,10,-6,-30,-270,0,0,0,-30,-30,66,-45,-30,-270,-405,1890,0,0,0,0,0,0,0,1,0,0,0,0,0], +[85050,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,-6,10,-6,0,0,0,0,0,0,0,0,0,-6,-6,0,-6,-6,-6,-6,0,0,0,0,-6,0,42,-54,-6,90,0,0,0,90,90,90,0,90,-1350,0,-5670,0,0,0,0,0,0,0,0,0,0,0,0,-1] +]} diff --git a/research/clifford-mixed-site-canonical/predecessor/source/engine/INPUTS.json b/research/clifford-mixed-site-canonical/predecessor/source/engine/INPUTS.json new file mode 100644 index 0000000000..f9d4fd9206 --- /dev/null +++ b/research/clifford-mixed-site-canonical/predecessor/source/engine/INPUTS.json @@ -0,0 +1,72 @@ +[ + { + "local": "PR5704-quadratic.py", + "origin": "research/exact-clifford-quadratic-replay/quadratic.py", + "head": "daa4d9dbd102d2a3677afc5614c56466bd2cf3a2", + "sha256": "d406584aed1479b75c387bc964b9e797b2f4f75e5f8c6bbea00df07f7d590a91", + "git_blob": "ce3c86ec07fd5767741e02ff0c88b93ba9164fb4" + }, + { + "local": "PR5704-PROOF.md", + "origin": "research/exact-clifford-quadratic-replay/PROOF.md", + "head": "daa4d9dbd102d2a3677afc5614c56466bd2cf3a2", + "sha256": "e5039414a02e36cdeab82fb9803fc4de0c3e0f3997e8812ef9d227e5d417ec91", + "git_blob": "559f9f4b207783c6eb908450b63eed3431594c22" + }, + { + "local": "PR5704-NOTICE.md", + "origin": "research/exact-clifford-quadratic-replay/NOTICE.md", + "head": "daa4d9dbd102d2a3677afc5614c56466bd2cf3a2", + "sha256": "a77adc71861e3b9c73c703c5db5b671f61a1101d85d14cca08547e21d6d8dce4", + "git_blob": "b96b400e5ca04b3a9003a8b2c70a2461972d39d7" + }, + { + "local": "PR5526-PROOF.md", + "origin": "research/clifford-pointwise-faithfulness/PROOF.md", + "head": "df0137efd35e11b4445734bf612bdd4c7ebc330c", + "sha256": "45483e4b5f604a5e70602c5caaa4394d4a0d0d1a6d0b6e8a93b836d50b23f764", + "git_blob": "465009d9d1b6947e80e6f1e868022f47ddab1f3c" + }, + { + "local": "clifford_exact.py", + "origin": "research/exact-clifford-quadratic-replay/source/source/clifford_exact.py", + "head": "daa4d9dbd102d2a3677afc5614c56466bd2cf3a2", + "sha256": "2982ead07721e83358dc67c6f49c2b4c16a236a6bebdfd72f58221be1f5d0962", + "git_blob": "166841a037f069249f6f7f6dedb89248812f59e2" + }, + { + "local": "prune_native.py", + "origin": "research/exact-clifford-quadratic-replay/source/source/prune_native.py", + "head": "daa4d9dbd102d2a3677afc5614c56466bd2cf3a2", + "sha256": "f2b37c183a10922eabc8e0436b426a08866430e96bd0adc7e178951c7fbb5257", + "git_blob": "8c3e11b2408fa96eefa3ebe7952d1b11b90b772b" + }, + { + "local": "PHYSICAL.json", + "origin": "research/exact-clifford-quadratic-replay/source/PHYSICAL.json", + "head": "daa4d9dbd102d2a3677afc5614c56466bd2cf3a2", + "sha256": "f78ba861d23ff33f2c9ffeca8c3ab6a7f1ec906f38adff5d325c13efb187c7c3", + "git_blob": "375b30b8c7aa16df521deaec04f16d1af8532abd" + }, + { + "local": "CONSTRUCTION.json.gz", + "origin": "research/exact-clifford-quadratic-replay/source/CONSTRUCTION.json.gz", + "head": "daa4d9dbd102d2a3677afc5614c56466bd2cf3a2", + "sha256": "00d13d7774adf087f93bc58d4c5860e296f8408c0ee25a4db254a056f8da7dec", + "git_blob": "31c6d481dd8b32e30d3c137bd2561a59a9d9fcc0" + }, + { + "local": "PR5698-NOTICE.md", + "origin": "research/exact-clifford-quadratic-replay/source/NOTICE.md", + "head": "daa4d9dbd102d2a3677afc5614c56466bd2cf3a2", + "sha256": "1f55b3e4bb80a60611b1fca0622da5a99fe7877446f03d0edd1dc8f3a5abadd2", + "git_blob": "56712e3195faf8c83319100065183b8b2488809d" + }, + { + "local": "LICENSE", + "origin": "research/exact-clifford-quadratic-replay/source/source/LICENSE", + "head": "daa4d9dbd102d2a3677afc5614c56466bd2cf3a2", + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "git_blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64" + } +] diff --git a/research/clifford-mixed-site-canonical/predecessor/source/engine/contractions.py b/research/clifford-mixed-site-canonical/predecessor/source/engine/contractions.py new file mode 100644 index 0000000000..76c807dece --- /dev/null +++ b/research/clifford-mixed-site-canonical/predecessor/source/engine/contractions.py @@ -0,0 +1,236 @@ +"""Exact Clifford contractions with absolute phase. Apache-2.0. + +Classical affine-support and quadratic Gauss-sum methods. Prepared by +Ali Romman with substantial OpenAI Codex assistance. +""" +from fractions import Fraction +from hashlib import sha256 +import importlib.util +import json +from pathlib import Path +import sys + +ROOT = Path(__file__).resolve().parent + + +def load_source(name, filename): + records = json.loads((ROOT / 'INPUTS.json').read_text()) + record = next(x for x in records if x['local'] == filename) + path = ROOT / 'source' / filename + if sha256(path.read_bytes()).hexdigest() != record['sha256']: + raise ValueError('Changed frozen input: ' + filename) + spec = importlib.util.spec_from_file_location(name, path) + module = importlib.util.module_from_spec(spec) + sys.modules[name] = module + spec.loader.exec_module(module) + return module + + +Q = load_source('contraction_quadratic', 'PR5704-quadratic.py') + + +def add(a, b): + return a[0] + b[0], a[1] + b[1] + + +def conjugate(a): + return a[0], -a[1] + + +def power(a, exponent): + Q.need(type(exponent) is int and exponent >= 0, 'Nonnegative integral exponent') + result = (1, 0) + while exponent: + if exponent & 1: + result = Q.multiply(result, a) + a = Q.multiply(a, a) + exponent >>= 1 + return result + + +def solution(n, equations): + """Return every binary solution as affine coordinate forms, or None.""" + rows = {} + for mask, rhs in equations: + Q.validate_integer(mask, 1 << n, 'Equation variable mask') + Q.validate_integer(rhs, 2, 'Equation right side') + while mask: + pivot = mask.bit_length() - 1 + if pivot not in rows: + rows[pivot] = (mask, rhs) + break + other, value = rows[pivot] + mask ^= other + rhs ^= value + if not mask and rhs: + return None + free = [j for j in range(n) if j not in rows] + forms = [0] * n + for k, j in enumerate(free): + forms[j] = 1 << (k + 1) + for pivot in sorted(rows): + mask, rhs = rows[pivot] + forms[pivot] = rhs + for j in Q.bits(mask ^ (1 << pivot)): + forms[pivot] ^= forms[j] + return len(free), forms + + +def gauss(n, poly): + """Return sum_x i**q(x) as an exact Gaussian integer.""" + Q.need(type(n) is int and n >= 0, 'Nonnegative Gauss dimension') + for mask, coefficient in poly.items(): + Q.validate_integer(mask, 1 << n, 'Phase variable mask') + Q.need(type(coefficient) is int and 0 < coefficient < 4, + 'Canonical nonzero phase coefficient') + Q.need(mask.bit_count() <= 2 and (mask.bit_count() != 2 or coefficient == 2), + 'Only even quadratic terms') + poly = dict(poly) + scalar = (1, 0) + while n: + last = 1 << (n - 1) + a = poly.pop(last, 0) + linear = 0 + for mask in list(poly): + if mask & last: + linear ^= mask ^ last + del poly[mask] + n -= 1 + if a & 1: + scalar = Q.multiply(scalar, (1, 1 if a == 1 else -1)) + Q.affine(poly, linear << 1, -a) + elif linear: + resolved = solution(n, [(linear, a // 2)]) + Q.need(resolved is not None, 'A nonzero linear form takes both values') + n, forms = resolved + poly = Q.substitute(poly, forms) + scalar = (2 * scalar[0], 2 * scalar[1]) + elif a: + return (0, 0) + else: + scalar = (2 * scalar[0], 2 * scalar[1]) + return Q.multiply_i(scalar, poly.get(0, 0)) + + +def inner(left, right): + """Return the exact inner product of two valid engine states. + + Inputs come from signature or choi. Arbitrary serialized states are not + admitted without the source engine's construction contract. + """ + n, offset, cols, terms, a, b, den = left + m, other, cols2, terms2, c, d, den2 = right + Q.need(n == m, 'Equal state dimensions') + r = len(cols) + allcols = cols + cols2 + equations = [(sum(((v >> i) & 1) << j for j, v in enumerate(allcols)), + ((offset ^ other) >> i) & 1) for i in range(n)] + resolved = solution(len(allcols), equations) + if resolved is None: + return Fraction(0), Fraction(0) + dimension, forms = resolved + phase = Q.substitute(dict(terms2), forms[r:]) + for mask, coefficient in Q.substitute(dict(terms), forms[:r]).items(): + Q.term(phase, mask, -coefficient) + total = Q.multiply(Q.multiply((a, -b), (c, d)), gauss(dimension, phase)) + return Fraction(total[0], 1 << (den + den2)), Fraction(total[1], 1 << (den + den2)) + + +def choi(n, circuit): + """Return a normalized Choi state, retaining one common Bell phase.""" + Q.need(type(n) is int and n >= 0, 'Nonnegative circuit width') + preparation = [('C', (1 << j) | (1 << (n + j)), 1) for j in range(n)] + preparation.append(('D', tuple(1 << j if j < n else 0 for j in range(2 * n)), + (1,) * n + (0,) * n)) + expanded = [] + for gate in circuit: + # Validate the original arity and domain before extension. + Q.signature(n, [gate]) + kind = gate[0] + if kind == 'P': + expanded.append(('P', tuple(gate[1]) + tuple(1 << j for j in range(n, 2 * n)))) + elif kind == 'D': + expanded.append(('D', tuple(gate[1]) + (0,) * n, tuple(gate[2]) + (0,) * n)) + else: + expanded.append(gate) + return Q.signature(2 * n, preparation + expanded) + + +def trace(n, circuit): + result = inner(choi(n, []), choi(n, circuit)) + return result[0] * (1 << n), result[1] * (1 << n) + + +def kernel(states): + """Return normalized trace(U_i^* U_j) for valid equal-width circuits.""" + return [[inner(a, b) for b in states] for a in states] + + +def residual_norm(gram, coefficients, width): + """Return ||sum c_i U_i^(tensor width)||_HS^2 / d^width.""" + Q.need(type(width) is int and width > 0, 'Positive tensor width') + size = len(coefficients) + Q.need(len(gram) == size and all(len(row) == size for row in gram), 'Gram dimensions') + result = (Fraction(0), Fraction(0)) + for i, a in enumerate(coefficients): + for j, b in enumerate(coefficients): + result = add(result, Q.multiply(Q.multiply(conjugate(a), b), power(gram[i][j], width))) + Q.need(result[1] == 0 and result[0] >= 0, 'A valid Gram norm is real and nonnegative') + return result[0] + + +def decide(n, circuits, coefficients): + """Apply the credited four-width theorem to one fixed expanded residual.""" + Q.need(len(circuits) == len(coefficients), 'One fixed coefficient per circuit') + for a in coefficients: + Q.need(len(a) == 2 and all(type(x) in (int, Fraction) for x in a), + 'Exact rational real and imaginary coefficients') + gram = kernel([choi(n, c) for c in circuits]) + first = 4 * n + 4 if n else 1 + norms = [residual_norm(gram, coefficients, f) for f in range(first, first + 4)] + return dict(widths=list(range(first, first + 4)), norms=norms, + all_positive_widths_zero=all(x == 0 for x in norms)) + + +def divide(a, b): + scale = b[0] ** 2 + b[1] ** 2 + Q.need(scale != 0, 'Nonzero complex pivot') + value = Q.multiply(a, conjugate(b)) + return Fraction(value[0]) / scale, Fraction(value[1]) / scale + + +def best_approximation(states, target, width): + """Minimize the normalized squared residual in the supplied finite span. + + Coefficients may depend on this width. Dependent columns are permitted. + This operation does not admit a physical readout or new native queries. + """ + Q.need(type(width) is int and width > 0, 'Positive tensor width') + size = len(states) + gram = kernel(states + [target]) + matrix = [[power(gram[i][j], width) for j in range(size)] + + [power(gram[i][size], width)] for i in range(size)] + pivots = [] + for col in range(size): + row = next((r for r in range(len(pivots), size) if matrix[r][col] != (0, 0)), None) + if row is None: continue + k = len(pivots) + matrix[k], matrix[row] = matrix[row], matrix[k] + pivot = matrix[k][col] + matrix[k] = [divide(x, pivot) for x in matrix[k]] + for r in range(size): + if r != k: + factor = matrix[r][col] + matrix[r] = [add(x, Q.multiply((-factor[0], -factor[1]), y)) + for x, y in zip(matrix[r], matrix[k])] + pivots.append(col) + Q.need(all(row[-1] == (0, 0) for row in matrix[len(pivots):]), 'Consistent Gram normal equations') + coefficients = [(Fraction(0), Fraction(0))] * size + for row, col in enumerate(pivots): coefficients[col] = matrix[row][-1] + residual = residual_norm(gram, [(-x, -y) for x, y in coefficients] + [(1, 0)], width) + # Orthogonality is an independently inspectable optimum certificate. + for i in range(size): + value = (Fraction(0), Fraction(0)) + for j in range(size): value = add(value, Q.multiply(power(gram[i][j], width), coefficients[j])) + Q.need(value == power(gram[i][size], width), 'Exact residual orthogonality') + return dict(coefficients=coefficients, squared_residual=residual, span_rank=len(pivots)) diff --git a/research/clifford-mixed-site-canonical/predecessor/source/engine/source/LICENSE b/research/clifford-mixed-site-canonical/predecessor/source/engine/source/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/clifford-mixed-site-canonical/predecessor/source/engine/source/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/research/clifford-mixed-site-canonical/predecessor/source/engine/source/PR5698-NOTICE.md b/research/clifford-mixed-site-canonical/predecessor/source/engine/source/PR5698-NOTICE.md new file mode 100644 index 0000000000..56712e3195 --- /dev/null +++ b/research/clifford-mixed-site-canonical/predecessor/source/engine/source/PR5698-NOTICE.md @@ -0,0 +1,9 @@ +# Attribution + +Ali Romman with substantial OpenAI Codex assistance. Apache-2.0. + +Dugongue PR5687 supplies the actual two-line C coframe proposal and its complete profile, source interpretation and moment/tail proof. The native-dual-suppliers source supplies the actual restriction, native maps and main normalizers. Preserve Cao Yifan PR4610/4470, Cinna Davis and the native/frame/helper/ROW/controller lineage, DaysSky, Nick Petalas, Ryanson Jonathan, zxv, Jacob Alan Sussman, and every retained phase, scalar, compiler, precision, stock and analytic notice. + +Seventeen source files are retained byte for byte. Their original comments and attribution remain unchanged. INPUTS.json and SOURCES.json give exact commits, paths, Git objects and SHA256 hashes. Dinic's integral flow algorithm and the submodular graph-cut construction are classical methods, not new mathematics claimed here. + +The new work is the complete 423-frame binary optimization, four additional folds, exact emitted physical program and phase certificates, finite optimality headroom bound, stronger full gain, and charged higher-moment transfer. No global literature priority, independent human acceptance or new kappa is claimed. diff --git a/research/clifford-mixed-site-canonical/predecessor/source/engine/source/PR5704-NOTICE.md b/research/clifford-mixed-site-canonical/predecessor/source/engine/source/PR5704-NOTICE.md new file mode 100644 index 0000000000..b96b400e5c --- /dev/null +++ b/research/clifford-mixed-site-canonical/predecessor/source/engine/source/PR5704-NOTICE.md @@ -0,0 +1,33 @@ +# Attribution + +Ali Romman with substantial OpenAI Codex assistance. Apache-2.0. + +The affine-support and quadratic-phase representation is classical stabilizer +simulation. Credit Jeroen Dehaene and Bart De Moor, Physical Review A 68, 042318 +(2003), and the phase-sensitive stabilizer literature, including Bravyi, Browne, +Calpin, Campbell, Gosset and Howard (arXiv:1808.00128). The proof gives a direct +induction for this exact Gaussian-dyadic gate grammar. No discovery or optimal +simulation-complexity claim is made. + +Charles Bethin PR662 supplies the byte-exact table evaluator and prior runtime +work. Its retained NOTICE credits icekylinx, DreamingOfClouds, chafreaky, Jeremy +Kothe and the prior Clifford/wrapper/compiler lineage. Its source and notice +are frozen in tables/. They are used as a comparison engine and finite oracle. + +Ali Romman PR5698 supplies the complete actual restricted-C coframe construction, +source replay and proof checks. Its 32 package files and all nested notices are +frozen in source/. replay.py and verify_source.py are explicitly marked derived +copies with only source paths and state-equality calls changed. Preserve +Dugongue PR5687, Cao Yifan PR4610/4470, Cinna Davis, DaysSky, Nick Petalas, +Ryanson Jonathan, zxv, Jacob Alan Sussman and all native/helper/phase/ROW/controller, +compiler, precision and stock attribution in those retained files. + +BigCactusLabs PR702 and Joshua Snider's cold-wrapper quadratic certificate are +related independent finite amplitude/phase audits. Their scopes and credit are +separate from this implementation. No source contribution is reassigned here. + +The new contribution is the exact polynomial-state engine, explicit full-source +integration, proof-check preservation binding, independent representation tests, +all-actual-state cross-check and complete same-fixture runtime evidence. There +is no change to the mathematical construction, selected result or physical bill. +No independent human review or proof-kernel acceptance is claimed. diff --git a/research/clifford-mixed-site-canonical/predecessor/source/engine/source/PR5704-quadratic.py b/research/clifford-mixed-site-canonical/predecessor/source/engine/source/PR5704-quadratic.py new file mode 100644 index 0000000000..ce3c86ec07 --- /dev/null +++ b/research/clifford-mixed-site-canonical/predecessor/source/engine/source/PR5704-quadratic.py @@ -0,0 +1,283 @@ +"""Exact affine-support states for the retained Gaussian-dyadic gate grammar. + +The method is classical stabilizer simulation. This implementation keeps the +absolute Gaussian-integer scalar. Ali Romman with substantial OpenAI Codex +assistance. Apache-2.0. +""" + + +def need(condition, message): + if not condition: + raise ValueError(message) + + +def bits(mask): + while mask: + bit = mask & -mask + yield bit.bit_length() - 1 + mask ^= bit + + +def term(poly, mask, value): + value = (poly.get(mask, 0) + value) % 4 + if value: + poly[mask] = value + else: + poly.pop(mask, None) + + +def affine(poly, form, coefficient): + """Add a coefficient times an affine Boolean form, modulo four.""" + coefficient %= 4 + if not coefficient: + return + constant = form & 1 + term(poly, 0, coefficient * constant) + signed = coefficient * (1 - 2 * constant) + indices = list(bits(form >> 1)) + for i in indices: + term(poly, 1 << i, signed) + if coefficient & 1: + for k, i in enumerate(indices): + for j in indices[k + 1:]: + term(poly, (1 << i) | (1 << j), 2) + + +def product(poly, left, right): + """Add twice the product of two affine Boolean forms.""" + a, b = left & 1, right & 1 + u, v = list(bits(left >> 1)), list(bits(right >> 1)) + term(poly, 0, 2 * a * b) + if b: + for i in u: + term(poly, 1 << i, 2) + if a: + for j in v: + term(poly, 1 << j, 2) + for i in u: + for j in v: + term(poly, (1 << i) | (1 << j), 2) + + +def substitute(poly, forms): + result = {} + for mask, coefficient in poly.items(): + if not mask: + term(result, 0, coefficient) + elif mask.bit_count() == 1: + affine(result, forms[mask.bit_length() - 1], coefficient) + else: + need(mask.bit_count() == 2 and coefficient == 2, + 'A phase must have only even quadratic terms') + i, j = bits(mask) + product(result, forms[i], forms[j]) + return result + + +def value(poly, argument): + return sum(c for mask, c in poly.items() if argument & mask == mask) % 4 + + +def basis(columns): + """Return reduced binary columns with their original coordinates.""" + rows = {} + for j, column in enumerate(columns): + vector, coordinates = column, 1 << j + while vector: + pivot = vector.bit_length() - 1 + if pivot not in rows: + rows[pivot] = (vector, coordinates) + break + other, witness = rows[pivot] + vector ^= other + coordinates ^= witness + need(vector != 0, 'Support columns must be independent') + for pivot in sorted(rows): + vector, witness = rows[pivot] + for other in sorted(rows): + if other > pivot and rows[other][0] >> pivot & 1: + x, y = rows[other] + rows[other] = (x ^ vector, y ^ witness) + return rows + + +def coordinates(rows, vector): + result = 0 + for pivot in sorted(rows, reverse=True): + if vector >> pivot & 1: + column, witness = rows[pivot] + vector ^= column + result ^= witness + return None if vector else result + + +def multiply_i(pair, power): + a, b = pair + return ((a, b), (-b, a), (-a, -b), (b, -a))[power % 4] + + +def multiply(left, right): + a, b = left + c, d = right + return a * c - b * d, a * d + b * c + + +def normalize(pair, denominator): + need(pair != (0, 0), 'A unitary state cannot be zero') + while denominator and not ((pair[0] | pair[1]) & 1): + pair = (pair[0] // 2, pair[1] // 2) + denominator -= 1 + return pair, denominator + + +def matrix_vector(rows, vector): + return sum(((row & vector).bit_count() & 1) << j for j, row in enumerate(rows)) + + +def validate_integer(value_, limit, message): + need(type(value_) is int and 0 <= value_ < limit, message) + + +def signature(n, circuit, initial=0, counters=None): + """Return a canonical exact state without an exponential vector. + + A state is scalar times i^q(z) at offset xor columns*z. The columns + remain independent. The returned tuple describes every amplitude. + """ + need(type(n) is int and n >= 0, 'The width must be a nonnegative integer') + validate_integer(initial, 1 << n, 'Initial basis index') + columns, offset, poly = [], initial, {} + scalar, denominator = (1, 0), 0 + counts = counters if counters is not None else {} + + def count(key): + counts[key] = counts.get(key, 0) + 1 + + for gate in circuit: + need(isinstance(gate, (tuple, list)) and gate, 'Nonempty gate record') + kind = gate[0] + r = len(columns) + if kind == 'P': + need(len(gate) == 2 and len(gate[1]) == n, 'Permutation dimensions') + rows = gate[1] + for row in rows: + validate_integer(row, 1 << n, 'Binary permutation row') + basis(rows) + offset = matrix_vector(rows, offset) + columns = [matrix_vector(rows, x) for x in columns] + elif kind == 'X': + need(len(gate) == 2, 'Translation record') + validate_integer(gate[1], 1 << n, 'Translation mask') + offset ^= gate[1] + elif kind == 'phase': + need(len(gate) == 2 and type(gate[1]) is int, 'Global phase record') + term(poly, 0, gate[1]) + elif kind == 'D': + need(len(gate) == 3 and len(gate[1]) == len(gate[2]) == n, + 'Diagonal dimensions') + rows, linear = gate[1], gate[2] + for i in range(n): + validate_integer(rows[i], 1 << n, 'Binary diagonal row') + need(type(linear[i]) is int and linear[i] % 2 == (rows[i] >> i & 1), + 'Diagonal parity lift') + for j in range(i): + need((rows[i] >> j & 1) == (rows[j] >> i & 1), + 'Symmetric diagonal matrix') + forms = [(offset >> i & 1) | + sum((column >> i & 1) << (j + 1) for j, column in enumerate(columns)) + for i in range(n)] + for i, coefficient in enumerate(linear): + affine(poly, forms[i], coefficient) + for j in bits(rows[i] >> (i + 1)): + product(poly, forms[i], forms[i + 1 + j]) + elif kind == 'C': + need(len(gate) == 3 and type(gate[2]) is int and gate[2] in (-1, 1), + 'Translation-root record and sign') + q, sign = gate[1:] + validate_integer(q, 1 << n, 'Translation-root mask') + witness = coordinates(basis(columns), q) + scalar = multiply(scalar, (1, sign)) + denominator += 1 + term(poly, 1 << r, -sign) + if witness is None: + columns.append(q) + count('independent_root') + else: + # The last variable has zero output after this substitution. + forms = [(1 << (i + 1)) | (((witness >> i) & 1) << (r + 1)) + for i in range(r)] + [1 << (r + 1)] + poly = substitute(poly, forms) + last = 1 << r + coefficient = poly.pop(last, 0) + neighbours = 0 + for mask in list(poly): + if mask & last: + need(mask.bit_count() == 2 and poly[mask] == 2, + 'Dependent-root quadratic term') + neighbours ^= mask ^ last + del poly[mask] + if coefficient & 1: + scalar = multiply(scalar, (1, 1 if coefficient == 1 else -1)) + affine(poly, neighbours << 1, -coefficient) + count('odd_elimination') + else: + scalar = (2 * scalar[0], 2 * scalar[1]) + constant = coefficient // 2 + if neighbours: + pivot = (neighbours & -neighbours).bit_length() - 1 + free = [i for i in range(r) if i != pivot] + forms = [0] * r + for j, i in enumerate(free): + forms[i] = 1 << (j + 1) + forms[pivot] = constant | sum( + 1 << (j + 1) for j, i in enumerate(free) if neighbours >> i & 1) + poly = substitute(poly, forms) + if constant: + offset ^= columns[pivot] + columns = [columns[i] ^ (columns[pivot] if neighbours >> i & 1 else 0) + for i in free] + count('even_restriction') + else: + need(constant == 0, 'A unitary root cannot annihilate the state') + count('even_free') + scalar, denominator = normalize(scalar, denominator) + else: + raise ValueError('Unknown gate: ' + str(kind)) + need(len(columns) <= n, 'Support dimension cannot exceed width') + counts['peak_support_rank'] = max(counts.get('peak_support_rank', 0), len(columns)) + + rows = basis(columns) + reduced_offset, shift = offset, 0 + for pivot in sorted(rows, reverse=True): + if reduced_offset >> pivot & 1: + column, witness = rows[pivot] + reduced_offset ^= column + shift ^= witness + ordered = [rows[p] for p in sorted(rows)] + forms = [(shift >> i & 1) | sum(((witness >> i) & 1) << (j + 1) + for j, (_, witness) in enumerate(ordered)) for i in range(len(columns))] + poly = substitute(poly, forms) + scalar = multiply_i(scalar, poly.pop(0, 0)) + scalar, denominator = normalize(scalar, denominator) + return (n, reduced_offset, tuple(x for x, _ in ordered), tuple(sorted(poly.items())), + scalar[0], scalar[1], denominator) + + +def amplitude(state, index): + n, offset, columns, terms, real, imag, denominator = state + validate_integer(index, 1 << n, 'Amplitude index') + argument = coordinates(basis(columns), index ^ offset) + if argument is None: + return (0, 0), 0 + pair = multiply_i((real, imag), value(dict(terms), argument)) + return pair, denominator + + +def equal_operators(left, right): + """Compare valid retained Clifford objects, including absolute phase. + + Their tableaus must be derived from their circuits by the retained exact + constructors. An arbitrary supplied tableau is not a valid input contract. + """ + return (left.n == right.n and left.tab == right.tab and + signature(left.n, left.circuit) == signature(right.n, right.circuit)) diff --git a/research/clifford-mixed-site-canonical/predecessor/source/row/bell_reads.py b/research/clifford-mixed-site-canonical/predecessor/source/row/bell_reads.py new file mode 100644 index 0000000000..32b2ed2a94 --- /dev/null +++ b/research/clifford-mixed-site-canonical/predecessor/source/row/bell_reads.py @@ -0,0 +1,128 @@ +"""Emit the phase-corrected Bell measurements for the compiled Clifford row. + +Use --emit for the identity fibre in order. Labels have four low Z bits +and four high X bits. apoursh with substantial OpenAI Codex assistance. +Apache-2.0. Phase correction is from PR7799. +""" +import argparse +from functools import cache +import json +from typing import NamedTuple + +from compile_row import DENOMINATOR, IDENTITY, SEED, apply, iter_terms, pairing + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def parity(value): + return value.bit_count() % 2 + + +def q0(v): + return parity((v >> 4) & v) + + +def transvection(axis, vector): + return vector ^ (axis if pairing(axis, vector) else 0) + + +def decompose(matrix): + """Write a symplectic map as a sequence of transvections in application order.""" + columns = list(matrix) + corrections = [] + for i, target in enumerate(IDENTITY): + source = columns[i] + if source == target: + continue + if pairing(source, target): + axes = (source ^ target,) + else: + middle = next(v for v in range(256) + if pairing(v, source) and pairing(v, target) + and all(pairing(source ^ v, fixed) == 0 for fixed in IDENTITY[:i])) + axes = (source ^ middle, middle ^ target) + for axis in axes: + columns = [transvection(axis, v) for v in columns] + corrections.append(axis) + require(tuple(columns) == IDENTITY, "transvection reduction failed") + return tuple(reversed(corrections)) + + +def step(axis, v, bell): + """Phase exponent modulo four of a transvection on one unphased Weyl label.""" + out = transvection(axis, v) + exponent = 0 + if out != v: + exponent = 1 + q0(axis) + 2 * parity((axis & 15) & (v >> 4)) + if bell: + if q0(axis): + exponent += 1 + else: + exponent += 2 + 2 * parity((out & 15) & (axis >> 4)) + out ^= axis + return out, exponent % 4 + + +def label_sum(labels): + total = 0 + for label in labels: + total ^= label + return total + + +@cache +def transported_seed(matrix): + """Return the six output labels and the seed's transport phase exponent.""" + labels = list(SEED) + weight = label_sum(SEED) + phase = 0 + for axis in decompose(matrix): + next_weight, gamma = step(axis, weight, False) + values = [step(axis, label, True) for label in labels] + labels = [value for value, _ in values] + phase += sum(theta for _, theta in values) - gamma + weight = next_weight + # Independent affine check. q(Sv+b)=q(v) fixes the offset b uniquely. + offset = labels[0] + require(all(q0(apply(matrix, u) ^ offset) == q0(u) for u in (0, *IDENTITY)), + "Bell offset violates transpose parity") + require(all(label == apply(matrix, v) ^ offset for v, label in zip(SEED, labels, strict=True)) + and weight == label_sum(labels), "misordered symplectic transport") + return tuple(labels), phase % 4 + + +class Read(NamedTuple): + numerator: int + input_labels: tuple[int, ...] + output_labels: tuple[int, ...] + correction_i: int + + +def iter_reads(target=IDENTITY): + """Weight is numerator/DENOMINATOR. Multiply the corrected singleton by i^correction_i.""" + for term in iter_terms(target): + i, phase_i = transported_seed(term.input_map) + j, phase_j = transported_seed(term.output_map) + yield Read(term.numerator, i, j, (phase_i - phase_j) % 4) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--emit", action="store_true", help="emit one JSON object per identity-fibre read") + args = parser.parse_args() + pairs = set() + for read in iter_reads(): + pair = read.input_labels, read.output_labels + require(pair not in pairs, "repeated literal Bell address") + pairs.add(pair) + if args.emit: + print(json.dumps(dict(read._asdict(), denominator=DENOMINATOR))) + if not args.emit: + print(f"PASS_BELL_READS distinct_pairs={len(pairs)}") + + +if __name__ == "__main__": + main() diff --git a/research/clifford-mixed-site-canonical/predecessor/source/row/compile_row.py b/research/clifford-mixed-site-canonical/predecessor/source/row/compile_row.py new file mode 100644 index 0000000000..daf35d6a26 --- /dev/null +++ b/research/clifford-mixed-site-canonical/predecessor/source/row/compile_row.py @@ -0,0 +1,247 @@ +"""Compile the shear-character certificate in PR7799 into signed Bell reads. + +Binary vectors have four low Z bits and four high X bits, least significant +bit for qubit one. A matrix is the tuple of images of the standard basis. +apoursh, with substantial OpenAI Codex and separate agent assistance. +Apache-2.0. The seed, character cases and plane selection are from PR7799. +""" +import argparse +from collections import Counter, defaultdict +from functools import cache +from itertools import combinations, combinations_with_replacement +import json +from typing import NamedTuple + + +IDENTITY = tuple(1 << i for i in range(8)) +DENOMINATOR = 1024 +SEED = (0, 1, 2, 4, 8, 128) +UPPER = tuple(combinations_with_replacement(range(4), 2)) + + +class Term(NamedTuple): + numerator: int + input_map: tuple[int, ...] + output_map: tuple[int, ...] + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def apply(columns, vector): + result = 0 + while vector: + bit = vector & -vector + result ^= columns[bit.bit_length() - 1] + vector ^= bit + return result + + +def compose(left, right): + return tuple(apply(left, v) for v in right) + + +def pairing(u, v): + return (((u >> 4) & v) ^ ((v >> 4) & u)).bit_count() % 2 + + +def span(basis): + points = [0] + for v in basis: + points += [u ^ v for u in points] + return points + + +def is_symplectic(matrix): + return (len(matrix) == 8 and all(isinstance(v, int) and 0 <= v < 256 for v in matrix) + and all(pairing(matrix[i], matrix[j]) == pairing(IDENTITY[i], IDENTITY[j]) + for i, j in combinations(range(8), 2))) + + +@cache +def shear(mask): + """Send (z,x) to (z+B x,x), with B's upper triangle given by mask.""" + result = list(IDENTITY) + for index, (i, j) in enumerate(UPPER): + if mask & (1 << index): + result[4 + i] ^= 1 << j + if i != j: + result[4 + j] ^= 1 << i + return tuple(result) + + +def pair_mask(u, v): + return sum(((((u >> i) & (v >> j)) ^ ((u >> j) & (v >> i))) & 1) << k + for k, (i, j) in enumerate(UPPER)) + + +def quadratic_address(v): + return sum(1 << k for k, (i, j) in enumerate(UPPER) if v & (1 << i) and v & (1 << j)) + + +def select_plane(ch): + # Match the deterministic binary ordering used by the PR7799 verifier. + values = tuple((ch & quadratic_address(v)).bit_count() % 2 for v in range(16)) + + def polar(u, v): + return values[u] ^ values[v] ^ values[u ^ v] + + if any(all(polar(v, b) == 0 for b in (1, 2, 4, 8)) for v in range(1, 16)): + return next(w for w in combinations(range(1, 16), 3) + if len(set(span(w))) == 8 and all(polar(i, j) == 0 for i, j in combinations(w, 2))) + r = next(v for v in range(1, 16) if values[v] == 0) + hyperplane = [u for u in range(16) if polar(r, u) == 0] + z2 = next(v for v in hyperplane if v not in (0, r)) + dual = next(x for x in range(1, 16) if all((x & v).bit_count() % 2 == 0 for v in hyperplane)) + return r, z2, dual << 4 + + +def canonical_basis(points): + basis = [] + for v in sorted(points): + if v not in span(basis): + basis.append(v) + return tuple(basis) + + +def extend_basis(w): + z = list(w) + z.append(next(v for v in range(1, 256) if v not in span(z) and all(pairing(v, u) == 0 for u in z))) + x = [] + for i in range(4): + x.append(next(v for v in range(1, 256) + if all(pairing(v, u) == int(i == j) for j, u in enumerate(z)) + and all(pairing(v, b) == 0 for b in x))) + matrix = tuple(z + x) + require(is_symplectic(matrix), "plane transporter is not symplectic") + return matrix + + +def walsh(characters): + values = [0] * 1024 + for ch in characters: + values[ch] = 1 + step = 1 + while step < len(values): + for start in range(0, len(values), 2 * step): + for i in range(start, start + step): + j = i + step + values[i], values[j] = values[i] + values[j], values[i] - values[j] + step *= 2 + return values + + +def normalizer_representatives(w, p_basis): + if len(p_basis) == 3: + return [0] + dual = next(v for v in w if v >> 4) + p = span(p_basis) + representatives = {} + for mask in range(1024): + b_dual = apply(shear(mask), dual) ^ dual + key = min(b_dual ^ u for u in p) + representatives.setdefault(key, mask) + require(len(representatives) == 4, "mixed-plane normalizer index") + return sorted(representatives.values()) + + +def iter_terms(target=IDENTITY): + """Yield numerator / DENOMINATOR weights on transported coset *sums*. + + Apply the source and target transporters to SEED via the affine Bell + action and undo the singleton/transport phases as specified in PROOF.md. + The weighted sum of those 16-by-16 blocks is the target's fibre matrix + on the image of the observation map. Target defaults to the identity. + """ + require(is_symplectic(target), "invalid target symplectic matrix") + by_plane = defaultdict(list) + for ch in range(1024): + by_plane[canonical_basis(span(select_plane(ch)))].append(ch) + for w, chars in sorted(by_plane.items()): + pure = tuple(z for z in w if z < 16) + h = span(tuple(pair_mask(u, v) for u, v in combinations(pure, 2))) + representatives = normalizer_representatives(w, pure) + g = extend_basis(w) + values = walsh(chars) + divisor = 4 if len(pure) == 2 else 1 + for delta, value in enumerate(values): + if not value or delta != min(delta ^ offset for offset in h): + continue + require(value % divisor == 0, "coefficient needs a finer denominator") + for b in representatives: + right = compose(shear(b), g) + left = compose(target, compose(shear(delta ^ b), g)) + yield Term(value // divisor, right, left) + + +def seed_subgroup(): + hats = [pair_mask(1 << i, 1 << j) for i, j in combinations(range(3), 2)] + return tuple(shear(mask) for mask in span(hats)) + + +@cache +def inverse(matrix): + # Binary symplectic inverse from the images of a paired basis. + return tuple(sum(pairing(matrix[i ^ 4], u) << i for i in range(8)) for u in IDENTITY) + + +def bell_tuple(matrix): + # q(L v)=q(v) gives = q(u)+q(S^-1 u), hence b from the + # images of basis vectors under the inverse. q(e_j)=0. + inv = inverse(matrix) + offset = 0 + for j in range(8): + v = inv[j ^ 4] + offset |= (((v >> 4) & v).bit_count() % 2) << j + return tuple(apply(matrix, v) ^ offset for v in SEED) + + +def check(target): + accum = Counter() + seen = set() + terms = list(iter_terms(target)) + subgroup = seed_subgroup() + for weight, right, left in terms: + products = {compose(left, compose(c, inverse(right))) for c in subgroup} + key = frozenset(products) + require(len(products) == 8 and key not in seen, "repeated or malformed coset") + seen.add(key) + for item in products: + accum[item] += weight + require({k: v for k, v in accum.items() if v} == {target: DENOMINATOR}, + "signed coset sum is not the single target") + require(len(accum) == 8304, "expanded union size") + mass_by_input = Counter() + for term in terms: + mass_by_input[bell_tuple(term.input_map)] += abs(term.numerator) + require(Counter(mass_by_input.values()) == {128: 29, 192: 10, 224: 8, 240: 8, 288: 12}, + "absolute coefficient mass by input") + require(8 * sum(m*m for m in mass_by_input.values()) * 64 == 1319 * DENOMINATOR**2, + "simultaneous squared norm bound") + numerators = [term.numerator for term in terms] + require(len(terms) == 4265 and sum(abs(w) for w in numerators) == 12800, + "row sparsity or absolute mass") + require(sum(w*w for w in numerators) == DENOMINATOR**2 // 8, "squared row mass") + require(any(w % 2 for w in numerators), "denominator 1024 not attained") + return len(accum) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--emit", action="store_true", help="emit the identity row as JSON lines") + args = parser.parse_args() + if args.emit: + for term in iter_terms(): + print(json.dumps(term._asdict(), separators=(",", ":"))) + return + covered = check(IDENTITY) + # Hadamard on each qubit swaps the two coordinate registers. + require(check(IDENTITY[4:] + IDENTITY[:4]) == covered, "translated support") + print(f"PASS_COMPRESSED_CLIFFORD_ROW terms=4265 group_terms=34120 union={covered}" + " denominator=1024 absolute_mass=25/2 squared_mass=1/8 row_norm_squared=2^45") + + +if __name__ == "__main__": + main() diff --git a/research/clifford-mixed-site-canonical/predecessor/source/width13-spectrum.json b/research/clifford-mixed-site-canonical/predecessor/source/width13-spectrum.json new file mode 100644 index 0000000000..039f22ba0b --- /dev/null +++ b/research/clifford-mixed-site-canonical/predecessor/source/width13-spectrum.json @@ -0,0 +1,1519 @@ +{ + "source_files": 18, + "projective_order": 12128668876800, + "width": 13, + "rows": [ + { + "row": 1, + "quotient_degree": 1, + "multiplicity": 651, + "clifford_degree": 16, + "regular_dimension": 256, + "eigenvalue": [ + 470624175, + 4294967296 + ] + }, + { + "row": 2, + "quotient_degree": 35, + "multiplicity": 1518660, + "clifford_degree": 560, + "regular_dimension": 313600, + "eigenvalue": [ + 7841980575, + 1073741824 + ] + }, + { + "row": 3, + "quotient_degree": 51, + "multiplicity": 1611753, + "clifford_degree": 816, + "regular_dimension": 665856, + "eigenvalue": [ + 22846598775, + 4294967296 + ] + }, + { + "row": 4, + "quotient_degree": 85, + "multiplicity": 3148145, + "clifford_degree": 1360, + "regular_dimension": 1849600, + "eigenvalue": [ + 26774973225, + 4294967296 + ] + }, + { + "row": 5, + "quotient_degree": 119, + "multiplicity": 118482, + "clifford_degree": 1904, + "regular_dimension": 3625216, + "eigenvalue": [ + 359889075, + 2147483648 + ] + }, + { + "row": 6, + "quotient_degree": 135, + "multiplicity": 211575, + "clifford_degree": 2160, + "regular_dimension": 4665600, + "eigenvalue": [ + 1132984125, + 4294967296 + ] + }, + { + "row": 7, + "quotient_degree": 238, + "multiplicity": 5425992, + "clifford_degree": 3808, + "regular_dimension": 14500864, + "eigenvalue": [ + 4120362675, + 1073741824 + ] + }, + { + "row": 8, + "quotient_degree": 510, + "multiplicity": 620620, + "clifford_degree": 8160, + "regular_dimension": 66585600, + "eigenvalue": [ + 439864425, + 2147483648 + ] + }, + { + "row": 9, + "quotient_degree": 595, + "multiplicity": 620620, + "clifford_degree": 9520, + "regular_dimension": 90630400, + "eigenvalue": [ + 188513325, + 1073741824 + ] + }, + { + "row": 10, + "quotient_degree": 595, + "multiplicity": 2637635, + "clifford_degree": 9520, + "regular_dimension": 90630400, + "eigenvalue": [ + 3204726525, + 4294967296 + ] + }, + { + "row": 11, + "quotient_degree": 918, + "multiplicity": 9570847, + "clifford_degree": 14688, + "regular_dimension": 215737344, + "eigenvalue": [ + 15074084025, + 8589934592 + ] + }, + { + "row": 12, + "quotient_degree": 1190, + "multiplicity": 4765475, + "clifford_degree": 19040, + "regular_dimension": 362521600, + "eigenvalue": [ + 5790052125, + 8589934592 + ] + }, + { + "row": 13, + "quotient_degree": 1275, + "multiplicity": 4765475, + "clifford_degree": 20400, + "regular_dimension": 416160000, + "eigenvalue": [ + 2702024325, + 4294967296 + ] + }, + { + "row": 14, + "quotient_degree": 1512, + "multiplicity": 28353468, + "clifford_degree": 24192, + "regular_dimension": 585252864, + "eigenvalue": [ + 27113003775, + 8589934592 + ] + }, + { + "row": 15, + "quotient_degree": 1785, + "multiplicity": 22608300, + "clifford_degree": 28560, + "regular_dimension": 815673600, + "eigenvalue": [ + 2289090375, + 1073741824 + ] + }, + { + "row": 16, + "quotient_degree": 1785, + "multiplicity": 3878875, + "clifford_degree": 28560, + "regular_dimension": 815673600, + "eigenvalue": [ + 1570944375, + 4294967296 + ] + }, + { + "row": 17, + "quotient_degree": 2295, + "multiplicity": 38434110, + "clifford_degree": 36720, + "regular_dimension": 1348358400, + "eigenvalue": [ + 6053372325, + 2147483648 + ] + }, + { + "row": 18, + "quotient_degree": 2856, + "multiplicity": 4592588, + "clifford_degree": 45696, + "regular_dimension": 2088124416, + "eigenvalue": [ + 2324997675, + 8589934592 + ] + }, + { + "row": 19, + "quotient_degree": 2856, + "multiplicity": 36173280, + "clifford_degree": 45696, + "regular_dimension": 2088124416, + "eigenvalue": [ + 2289090375, + 1073741824 + ] + }, + { + "row": 20, + "quotient_degree": 2975, + "multiplicity": 28260375, + "clifford_degree": 47600, + "regular_dimension": 2265760000, + "eigenvalue": [ + 6867271125, + 4294967296 + ] + }, + { + "row": 21, + "quotient_degree": 2975, + "multiplicity": 42578965, + "clifford_degree": 47600, + "regular_dimension": 2265760000, + "eigenvalue": [ + 10346688495, + 4294967296 + ] + }, + { + "row": 22, + "quotient_degree": 3213, + "multiplicity": 6330324, + "clifford_degree": 51408, + "regular_dimension": 2642782464, + "eigenvalue": [ + 356080725, + 1073741824 + ] + }, + { + "row": 23, + "quotient_degree": 3213, + "multiplicity": 49512177, + "clifford_degree": 51408, + "regular_dimension": 2642782464, + "eigenvalue": [ + 11140239825, + 4294967296 + ] + }, + { + "row": 24, + "quotient_degree": 3400, + "multiplicity": 7757750, + "clifford_degree": 54400, + "regular_dimension": 2959360000, + "eigenvalue": [ + 6597966375, + 17179869184 + ] + }, + { + "row": 25, + "quotient_degree": 3570, + "multiplicity": 15825810, + "clifford_degree": 57120, + "regular_dimension": 3262694400, + "eigenvalue": [ + 3204726525, + 4294967296 + ] + }, + { + "row": 26, + "quotient_degree": 3570, + "multiplicity": 7757750, + "clifford_degree": 57120, + "regular_dimension": 3262694400, + "eigenvalue": [ + 1570944375, + 4294967296 + ] + }, + { + "row": 27, + "quotient_degree": 3570, + "multiplicity": 45216600, + "clifford_degree": 57120, + "regular_dimension": 3262694400, + "eigenvalue": [ + 2289090375, + 1073741824 + ] + }, + { + "row": 28, + "quotient_degree": 3808, + "multiplicity": 42503604, + "clifford_degree": 60928, + "regular_dimension": 3712221184, + "eigenvalue": [ + 64552348575, + 34359738368 + ] + }, + { + "row": 29, + "quotient_degree": 4200, + "multiplicity": 12412400, + "clifford_degree": 67200, + "regular_dimension": 4515840000, + "eigenvalue": [ + 1068242175, + 2147483648 + ] + }, + { + "row": 30, + "quotient_degree": 4760, + "multiplicity": 10550540, + "clifford_degree": 76160, + "regular_dimension": 5800345600, + "eigenvalue": [ + 3204726525, + 8589934592 + ] + }, + { + "row": 31, + "quotient_degree": 5712, + "multiplicity": 29089346, + "clifford_degree": 91392, + "regular_dimension": 8352497664, + "eigenvalue": [ + 29452962825, + 34359738368 + ] + }, + { + "row": 32, + "quotient_degree": 5950, + "multiplicity": 56520750, + "clifford_degree": 95200, + "regular_dimension": 9063040000, + "eigenvalue": [ + 6867271125, + 4294967296 + ] + }, + { + "row": 33, + "quotient_degree": 5950, + "multiplicity": 39564525, + "clifford_degree": 95200, + "regular_dimension": 9063040000, + "eigenvalue": [ + 9614179575, + 8589934592 + ] + }, + { + "row": 34, + "quotient_degree": 7140, + "multiplicity": 51622285, + "clifford_degree": 114240, + "regular_dimension": 13050777600, + "eigenvalue": [ + 20907025425, + 17179869184 + ] + }, + { + "row": 35, + "quotient_degree": 8160, + "multiplicity": 67824900, + "clifford_degree": 130560, + "regular_dimension": 17045913600, + "eigenvalue": [ + 48070897875, + 34359738368 + ] + }, + { + "row": 36, + "quotient_degree": 8925, + "multiplicity": 26376350, + "clifford_degree": 142800, + "regular_dimension": 20391840000, + "eigenvalue": [ + 1068242175, + 2147483648 + ] + }, + { + "row": 37, + "quotient_degree": 8925, + "multiplicity": 62172825, + "clifford_degree": 142800, + "regular_dimension": 20391840000, + "eigenvalue": [ + 5035998825, + 4294967296 + ] + }, + { + "row": 38, + "quotient_degree": 8960, + "multiplicity": 106392000, + "clifford_degree": 143360, + "regular_dimension": 20552089600, + "eigenvalue": [ + 34336355625, + 17179869184 + ] + }, + { + "row": 39, + "quotient_degree": 9639, + "multiplicity": 42729687, + "clifford_degree": 154224, + "regular_dimension": 23785042176, + "eigenvalue": [ + 3204726525, + 4294967296 + ] + }, + { + "row": 40, + "quotient_degree": 10200, + "multiplicity": 113041500, + "clifford_degree": 163200, + "regular_dimension": 26634240000, + "eigenvalue": [ + 16023632625, + 8589934592 + ] + }, + { + "row": 41, + "quotient_degree": 11900, + "multiplicity": 52752700, + "clifford_degree": 190400, + "regular_dimension": 36252160000, + "eigenvalue": [ + 3204726525, + 4294967296 + ] + }, + { + "row": 42, + "quotient_degree": 11900, + "multiplicity": 79129050, + "clifford_degree": 190400, + "regular_dimension": 36252160000, + "eigenvalue": [ + 9614179575, + 8589934592 + ] + }, + { + "row": 43, + "quotient_degree": 13056, + "multiplicity": 33761728, + "clifford_degree": 208896, + "regular_dimension": 43637538816, + "eigenvalue": [ + 7477695225, + 17179869184 + ] + }, + { + "row": 44, + "quotient_degree": 13600, + "multiplicity": 82897100, + "clifford_degree": 217600, + "regular_dimension": 47349760000, + "eigenvalue": [ + 35251991775, + 34359738368 + ] + }, + { + "row": 45, + "quotient_degree": 14280, + "multiplicity": 63303240, + "clifford_degree": 228480, + "regular_dimension": 52203110400, + "eigenvalue": [ + 3204726525, + 4294967296 + ] + }, + { + "row": 46, + "quotient_degree": 14280, + "multiplicity": 137910630, + "clifford_degree": 228480, + "regular_dimension": 52203110400, + "eigenvalue": [ + 27926902575, + 17179869184 + ] + }, + { + "row": 47, + "quotient_degree": 14688, + "multiplicity": 48532484, + "clifford_degree": 235008, + "regular_dimension": 55228760064, + "eigenvalue": [ + 19109665575, + 34359738368 + ] + }, + { + "row": 48, + "quotient_degree": 16065, + "multiplicity": 55390335, + "clifford_degree": 257040, + "regular_dimension": 66069561600, + "eigenvalue": [ + 2492565075, + 4294967296 + ] + }, + { + "row": 49, + "quotient_degree": 16065, + "multiplicity": 65940875, + "clifford_degree": 257040, + "regular_dimension": 66069561600, + "eigenvalue": [ + 2967339375, + 4294967296 + ] + }, + { + "row": 50, + "quotient_degree": 16065, + "multiplicity": 87041955, + "clifford_degree": 257040, + "regular_dimension": 66069561600, + "eigenvalue": [ + 3916887975, + 4294967296 + ] + }, + { + "row": 51, + "quotient_degree": 16065, + "multiplicity": 169562250, + "clifford_degree": 257040, + "regular_dimension": 66069561600, + "eigenvalue": [ + 3815150625, + 2147483648 + ] + }, + { + "row": 52, + "quotient_degree": 16065, + "multiplicity": 118693575, + "clifford_degree": 257040, + "regular_dimension": 66069561600, + "eigenvalue": [ + 5341210875, + 4294967296 + ] + }, + { + "row": 53, + "quotient_degree": 17850, + "multiplicity": 52752700, + "clifford_degree": 285600, + "regular_dimension": 81567360000, + "eigenvalue": [ + 1068242175, + 2147483648 + ] + }, + { + "row": 54, + "quotient_degree": 17850, + "multiplicity": 124345650, + "clifford_degree": 285600, + "regular_dimension": 81567360000, + "eigenvalue": [ + 5035998825, + 4294967296 + ] + }, + { + "row": 55, + "quotient_degree": 18360, + "multiplicity": 93447640, + "clifford_degree": 293760, + "regular_dimension": 86294937600, + "eigenvalue": [ + 3679500825, + 4294967296 + ] + }, + { + "row": 56, + "quotient_degree": 19040, + "multiplicity": 73853780, + "clifford_degree": 304640, + "regular_dimension": 92805529600, + "eigenvalue": [ + 22433085675, + 34359738368 + ] + }, + { + "row": 57, + "quotient_degree": 23800, + "multiplicity": 195938600, + "clifford_degree": 380800, + "regular_dimension": 145008640000, + "eigenvalue": [ + 5951634975, + 4294967296 + ] + }, + { + "row": 58, + "quotient_degree": 23800, + "multiplicity": 226083000, + "clifford_degree": 380800, + "regular_dimension": 145008640000, + "eigenvalue": [ + 6867271125, + 4294967296 + ] + }, + { + "row": 59, + "quotient_degree": 26775, + "multiplicity": 254343375, + "clifford_degree": 428400, + "regular_dimension": 183526560000, + "eigenvalue": [ + 6867271125, + 4294967296 + ] + }, + { + "row": 60, + "quotient_degree": 26775, + "multiplicity": 118693575, + "clifford_degree": 428400, + "regular_dimension": 183526560000, + "eigenvalue": [ + 3204726525, + 4294967296 + ] + }, + { + "row": 61, + "quotient_degree": 28560, + "multiplicity": 158258100, + "clifford_degree": 456960, + "regular_dimension": 208812441600, + "eigenvalue": [ + 16023632625, + 17179869184 + ] + }, + { + "row": 62, + "quotient_degree": 28917, + "multiplicity": 250273881, + "clifford_degree": 462672, + "regular_dimension": 214065379584, + "eigenvalue": [ + 6256847025, + 4294967296 + ] + }, + { + "row": 63, + "quotient_degree": 30464, + "multiplicity": 231508992, + "clifford_degree": 487424, + "regular_dimension": 237582155776, + "eigenvalue": [ + 1373454225, + 1073741824 + ] + }, + { + "row": 64, + "quotient_degree": 32130, + "multiplicity": 131881750, + "clifford_degree": 514080, + "regular_dimension": 264278246400, + "eigenvalue": [ + 2967339375, + 4294967296 + ] + }, + { + "row": 65, + "quotient_degree": 32130, + "multiplicity": 166171005, + "clifford_degree": 514080, + "regular_dimension": 264278246400, + "eigenvalue": [ + 7477695225, + 8589934592 + ] + }, + { + "row": 66, + "quotient_degree": 32130, + "multiplicity": 237387150, + "clifford_degree": 514080, + "regular_dimension": 264278246400, + "eigenvalue": [ + 5341210875, + 4294967296 + ] + }, + { + "row": 67, + "quotient_degree": 34425, + "multiplicity": 118693575, + "clifford_degree": 550800, + "regular_dimension": 303380640000, + "eigenvalue": [ + 2492565075, + 4294967296 + ] + }, + { + "row": 68, + "quotient_degree": 34425, + "multiplicity": 254343375, + "clifford_degree": 550800, + "regular_dimension": 303380640000, + "eigenvalue": [ + 5341210875, + 4294967296 + ] + }, + { + "row": 69, + "quotient_degree": 34560, + "multiplicity": 158878720, + "clifford_degree": 552960, + "regular_dimension": 305764761600, + "eigenvalue": [ + 830855025, + 1073741824 + ] + }, + { + "row": 70, + "quotient_degree": 38080, + "multiplicity": 168808640, + "clifford_degree": 609280, + "regular_dimension": 371222118400, + "eigenvalue": [ + 3204726525, + 4294967296 + ] + }, + { + "row": 71, + "quotient_degree": 38556, + "multiplicity": 170918748, + "clifford_degree": 616896, + "regular_dimension": 380560674816, + "eigenvalue": [ + 3204726525, + 4294967296 + ] + }, + { + "row": 72, + "quotient_degree": 42525, + "multiplicity": 314188875, + "clifford_degree": 680400, + "regular_dimension": 462944160000, + "eigenvalue": [ + 5341210875, + 4294967296 + ] + }, + { + "row": 73, + "quotient_degree": 42525, + "multiplicity": 314188875, + "clifford_degree": 680400, + "regular_dimension": 462944160000, + "eigenvalue": [ + 5341210875, + 4294967296 + ] + }, + { + "row": 74, + "quotient_degree": 43520, + "multiplicity": 265270720, + "clifford_degree": 696320, + "regular_dimension": 484861542400, + "eigenvalue": [ + 35251991775, + 34359738368 + ] + }, + { + "row": 75, + "quotient_degree": 47600, + "multiplicity": 316516200, + "clifford_degree": 761600, + "regular_dimension": 580034560000, + "eigenvalue": [ + 9614179575, + 8589934592 + ] + }, + { + "row": 76, + "quotient_degree": 48195, + "multiplicity": 213648435, + "clifford_degree": 771120, + "regular_dimension": 594626054400, + "eigenvalue": [ + 3204726525, + 4294967296 + ] + }, + { + "row": 77, + "quotient_degree": 51408, + "multiplicity": 322846524, + "clifford_degree": 822528, + "regular_dimension": 676552310784, + "eigenvalue": [ + 18160116975, + 17179869184 + ] + }, + { + "row": 78, + "quotient_degree": 53550, + "multiplicity": 356080725, + "clifford_degree": 856800, + "regular_dimension": 734106240000, + "eigenvalue": [ + 9614179575, + 8589934592 + ] + }, + { + "row": 79, + "quotient_degree": 57120, + "multiplicity": 316516200, + "clifford_degree": 913920, + "regular_dimension": 835249766400, + "eigenvalue": [ + 16023632625, + 17179869184 + ] + }, + { + "row": 80, + "quotient_degree": 65536, + "multiplicity": 381308928, + "clifford_degree": 1048576, + "regular_dimension": 1099511627776, + "eigenvalue": [ + 67299257025, + 68719476736 + ] + }, + { + "row": 81, + "quotient_degree": 68850, + "multiplicity": 356080725, + "clifford_degree": 1101600, + "regular_dimension": 1213522560000, + "eigenvalue": [ + 7477695225, + 8589934592 + ] + } + ], + "distinct_levels": [ + { + "eigenvalue": [ + 470624175, + 4294967296 + ], + "rows": [ + 1 + ], + "eigenspace_dimension": 256 + }, + { + "eigenvalue": [ + 359889075, + 2147483648 + ], + "rows": [ + 5 + ], + "eigenspace_dimension": 3625216 + }, + { + "eigenvalue": [ + 188513325, + 1073741824 + ], + "rows": [ + 9 + ], + "eigenspace_dimension": 90630400 + }, + { + "eigenvalue": [ + 439864425, + 2147483648 + ], + "rows": [ + 8 + ], + "eigenspace_dimension": 66585600 + }, + { + "eigenvalue": [ + 1132984125, + 4294967296 + ], + "rows": [ + 6 + ], + "eigenspace_dimension": 4665600 + }, + { + "eigenvalue": [ + 2324997675, + 8589934592 + ], + "rows": [ + 18 + ], + "eigenspace_dimension": 2088124416 + }, + { + "eigenvalue": [ + 356080725, + 1073741824 + ], + "rows": [ + 22 + ], + "eigenspace_dimension": 2642782464 + }, + { + "eigenvalue": [ + 1570944375, + 4294967296 + ], + "rows": [ + 16, + 26 + ], + "eigenspace_dimension": 4078368000 + }, + { + "eigenvalue": [ + 3204726525, + 8589934592 + ], + "rows": [ + 30 + ], + "eigenspace_dimension": 5800345600 + }, + { + "eigenvalue": [ + 6597966375, + 17179869184 + ], + "rows": [ + 24 + ], + "eigenspace_dimension": 2959360000 + }, + { + "eigenvalue": [ + 7477695225, + 17179869184 + ], + "rows": [ + 43 + ], + "eigenspace_dimension": 43637538816 + }, + { + "eigenvalue": [ + 1068242175, + 2147483648 + ], + "rows": [ + 29, + 36, + 53 + ], + "eigenspace_dimension": 106475040000 + }, + { + "eigenvalue": [ + 19109665575, + 34359738368 + ], + "rows": [ + 47 + ], + "eigenspace_dimension": 55228760064 + }, + { + "eigenvalue": [ + 2492565075, + 4294967296 + ], + "rows": [ + 48, + 67 + ], + "eigenspace_dimension": 369450201600 + }, + { + "eigenvalue": [ + 2702024325, + 4294967296 + ], + "rows": [ + 13 + ], + "eigenspace_dimension": 416160000 + }, + { + "eigenvalue": [ + 22433085675, + 34359738368 + ], + "rows": [ + 56 + ], + "eigenspace_dimension": 92805529600 + }, + { + "eigenvalue": [ + 5790052125, + 8589934592 + ], + "rows": [ + 12 + ], + "eigenspace_dimension": 362521600 + }, + { + "eigenvalue": [ + 2967339375, + 4294967296 + ], + "rows": [ + 49, + 64 + ], + "eigenspace_dimension": 330347808000 + }, + { + "eigenvalue": [ + 3204726525, + 4294967296 + ], + "rows": [ + 10, + 25, + 39, + 41, + 45, + 60, + 70, + 71, + 76 + ], + "eigenspace_dimension": 1645529044992 + }, + { + "eigenvalue": [ + 830855025, + 1073741824 + ], + "rows": [ + 69 + ], + "eigenspace_dimension": 305764761600 + }, + { + "eigenvalue": [ + 3679500825, + 4294967296 + ], + "rows": [ + 55 + ], + "eigenspace_dimension": 86294937600 + }, + { + "eigenvalue": [ + 29452962825, + 34359738368 + ], + "rows": [ + 31 + ], + "eigenspace_dimension": 8352497664 + }, + { + "eigenvalue": [ + 7477695225, + 8589934592 + ], + "rows": [ + 65, + 81 + ], + "eigenspace_dimension": 1477800806400 + }, + { + "eigenvalue": [ + 3916887975, + 4294967296 + ], + "rows": [ + 50 + ], + "eigenspace_dimension": 66069561600 + }, + { + "eigenvalue": [ + 16023632625, + 17179869184 + ], + "rows": [ + 61, + 79 + ], + "eigenspace_dimension": 1044062208000 + }, + { + "eigenvalue": [ + 67299257025, + 68719476736 + ], + "rows": [ + 80 + ], + "eigenspace_dimension": 1099511627776 + }, + { + "eigenvalue": [ + 35251991775, + 34359738368 + ], + "rows": [ + 44, + 74 + ], + "eigenspace_dimension": 532211302400 + }, + { + "eigenvalue": [ + 18160116975, + 17179869184 + ], + "rows": [ + 77 + ], + "eigenspace_dimension": 676552310784 + }, + { + "eigenvalue": [ + 9614179575, + 8589934592 + ], + "rows": [ + 33, + 42, + 75, + 78 + ], + "eigenspace_dimension": 1359456000000 + }, + { + "eigenvalue": [ + 5035998825, + 4294967296 + ], + "rows": [ + 37, + 54 + ], + "eigenspace_dimension": 101959200000 + }, + { + "eigenvalue": [ + 20907025425, + 17179869184 + ], + "rows": [ + 34 + ], + "eigenspace_dimension": 13050777600 + }, + { + "eigenvalue": [ + 5341210875, + 4294967296 + ], + "rows": [ + 52, + 66, + 68, + 72, + 73 + ], + "eigenspace_dimension": 1559616768000 + }, + { + "eigenvalue": [ + 1373454225, + 1073741824 + ], + "rows": [ + 63 + ], + "eigenspace_dimension": 237582155776 + }, + { + "eigenvalue": [ + 5951634975, + 4294967296 + ], + "rows": [ + 57 + ], + "eigenspace_dimension": 145008640000 + }, + { + "eigenvalue": [ + 48070897875, + 34359738368 + ], + "rows": [ + 35 + ], + "eigenspace_dimension": 17045913600 + }, + { + "eigenvalue": [ + 6256847025, + 4294967296 + ], + "rows": [ + 62 + ], + "eigenspace_dimension": 214065379584 + }, + { + "eigenvalue": [ + 6867271125, + 4294967296 + ], + "rows": [ + 20, + 32, + 58, + 59 + ], + "eigenspace_dimension": 339864000000 + }, + { + "eigenvalue": [ + 27926902575, + 17179869184 + ], + "rows": [ + 46 + ], + "eigenspace_dimension": 52203110400 + }, + { + "eigenvalue": [ + 15074084025, + 8589934592 + ], + "rows": [ + 11 + ], + "eigenspace_dimension": 215737344 + }, + { + "eigenvalue": [ + 3815150625, + 2147483648 + ], + "rows": [ + 51 + ], + "eigenspace_dimension": 66069561600 + }, + { + "eigenvalue": [ + 16023632625, + 8589934592 + ], + "rows": [ + 40 + ], + "eigenspace_dimension": 26634240000 + }, + { + "eigenvalue": [ + 64552348575, + 34359738368 + ], + "rows": [ + 28 + ], + "eigenspace_dimension": 3712221184 + }, + { + "eigenvalue": [ + 34336355625, + 17179869184 + ], + "rows": [ + 38 + ], + "eigenspace_dimension": 20552089600 + }, + { + "eigenvalue": [ + 2289090375, + 1073741824 + ], + "rows": [ + 15, + 19, + 27 + ], + "eigenspace_dimension": 6166492416 + }, + { + "eigenvalue": [ + 10346688495, + 4294967296 + ], + "rows": [ + 21 + ], + "eigenspace_dimension": 2265760000 + }, + { + "eigenvalue": [ + 11140239825, + 4294967296 + ], + "rows": [ + 23 + ], + "eigenspace_dimension": 2642782464 + }, + { + "eigenvalue": [ + 6053372325, + 2147483648 + ], + "rows": [ + 17 + ], + "eigenspace_dimension": 1348358400 + }, + { + "eigenvalue": [ + 27113003775, + 8589934592 + ], + "rows": [ + 14 + ], + "eigenspace_dimension": 585252864 + }, + { + "eigenvalue": [ + 4120362675, + 1073741824 + ], + "rows": [ + 7 + ], + "eigenspace_dimension": 14500864 + }, + { + "eigenvalue": [ + 22846598775, + 4294967296 + ], + "rows": [ + 3 + ], + "eigenspace_dimension": 665856 + }, + { + "eigenvalue": [ + 26774973225, + 4294967296 + ], + "rows": [ + 4 + ], + "eigenspace_dimension": 1849600 + }, + { + "eigenvalue": [ + 7841980575, + 1073741824 + ], + "rows": [ + 2 + ], + "eigenspace_dimension": 313600 + } + ], + "minimum": [ + 470624175, + 4294967296 + ], + "maximum": [ + 7841980575, + 1073741824 + ], + "minimum_dimension": 256, + "maximum_dimension": 313600, + "gram_condition": [ + 101244, + 1519 + ], + "inverse_squared_norm": [ + 4294967296, + 470624175 + ], + "second_moment": [ + 930080652310818734947227759375, + 72057594037927936 + ], + "one_qubit_calibration": { + "projective_elements": 24, + "closure_products": 576, + "quotient_character_counts": [ + [ + -64, + 12 + ], + [ + 1, + 8 + ], + [ + 4096, + 4 + ] + ], + "multiplicities": [ + 651, + 715, + 1365 + ], + "eigenvalues": [ + [ + 1953, + 2048 + ], + [ + 2145, + 2048 + ], + [ + 4095, + 4096 + ] + ], + "eigenspace_dimensions": [ + 4, + 4, + 16 + ], + "gram_second_moment": [ + 25184259, + 1048576 + ], + "literal_cubic_annihilator": true, + "normalization_controls": 3 + } +} diff --git a/research/clifford-mixed-site-canonical/predecessor/spherical.py b/research/clifford-mixed-site-canonical/predecessor/spherical.py new file mode 100644 index 0000000000..7cfa882a15 --- /dev/null +++ b/research/clifford-mixed-site-canonical/predecessor/spherical.py @@ -0,0 +1,66 @@ +"""Independent polar-graph verification of the canonical answer on repeated coordinates.""" +from fractions import Fraction +from pathlib import Path +import json +import sys + +HERE = Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) + + +def spherical_solution(): + rows = json.loads((HERE/"source"/"width13-spectrum.json").read_text())["rows"] + shell_sizes = [1] + down = [2**i-1 for i in range(5)] + up = [2*(16-2**i) for i in range(5)] + stay = [30-a-b for a,b in zip(up,down,strict=True)] + for i in range(4): + shell_sizes.append(shell_sizes[-1]*up[i]//down[i+1]) + size = sum(shell_sizes) + if shell_sizes != [1,30,280,960,1024]: + raise ValueError("Incorrect polar-graph shells") + rhs = [Fraction(16,4**13)*Fraction(-1,64)**i for i in range(5)] + answer = [Fraction(0)]*5 + eigensystem = [] + for theta in [30,13,3,-5,-15]: + u = [Fraction(1)] + for i in range(4): + prev = down[i]*u[i-1] if i else 0 + u.append(((theta-stay[i])*u[i]-prev)/up[i]) + if down[-1]*u[-2]+stay[-1]*u[-1] != theta*u[-1]: + raise ValueError("Incorrect radial eigenvector") + degree = Fraction(size,sum(k*x*x for k,x in zip(shell_sizes,u,strict=True))) + matching = [Fraction(*row["eigenvalue"]) for row in rows if row["quotient_degree"]==degree] + if len(matching) != 1: + raise ValueError(("Nonunique quotient representation",degree)) + scalar = matching[0] + coeff = degree/size*sum(k*x*y for k,x,y in zip(shell_sizes,rhs,u,strict=True)) + for i in range(5): + answer[i] += coeff*u[i]/scalar + eigensystem.append((theta,int(degree),scalar,tuple(u))) + if sum(d for _,d,_,_ in eigensystem)!=size or any(v==0 for v in answer): + raise ValueError("Radial decomposition or unexpectedly empty shell") + mass = Fraction(20643840,16)*sum(k*x*y for k,x,y in zip(shell_sizes,answer,rhs,strict=True)) + if not 0 < mass < 1: + raise ValueError("Repeated coordinate projection must be proper and nonzero") + return tuple(answer),mass,eigensystem + + + +def compare(): + from canonical import profile, radial_matrix + weights, mass, eigensystem = spherical_solution() + if tuple(a/16 for a in weights) != profile(): + raise ValueError("Independent canonical coefficient profiles disagree") + if mass != Fraction(478566778595,5856573836677349376): + raise ValueError("Projection mass mismatch") + matrix = radial_matrix() + for theta,degree,scalar,u in eigensystem: + result = [sum(x*y for x,y in zip(row,u,strict=True)) for row in matrix] + if result != [scalar*v for v in u]: + raise ValueError(("Geometric and character Gram actions disagree",theta,degree)) + print("PASS all five radial eigenspaces, canonical profile, exact projection mass",mass) + + +if __name__ == "__main__": + compare() diff --git a/research/clifford-mixed-site-canonical/support.py b/research/clifford-mixed-site-canonical/support.py new file mode 100644 index 0000000000..f2073b9009 --- /dev/null +++ b/research/clifford-mixed-site-canonical/support.py @@ -0,0 +1,49 @@ +"""Canonical support of a row coordinate, via its binary quadratic defect.""" +from functools import reduce +from operator import xor + + +def slot(i,j): + if i>j: + i,j=j,i + return j*(j+1)//2+i + + +def evaluation_bits(v): + return sum(((v>>i)&(v>>j)&1)<