From eead545a4ba6c50010fcac0919a9fdc6b14bd673 Mon Sep 17 00:00:00 2001 From: apoursh <8867770+apoursh@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:03:36 -0500 Subject: [PATCH] Compute compact Clifford adjoints and canonical readouts on repeated stabilizer sites --- .../CANONICAL.md | 55 + .../COORDINATES.md | 57 + .../clifford-compact-adjoint-fibres/PROOF.md | 30 + .../clifford-compact-adjoint-fibres/README.md | 39 + .../SOURCE-PINS.json | 82 + .../SOURCES.json | 97 ++ .../clifford-compact-adjoint-fibres/TASK.json | 93 + .../VERIFY.json | 117 ++ .../adjoint.py | 190 +++ .../canonical.py | 128 ++ .../check_coordinates.py | 118 ++ .../coordinate_support.py | 63 + .../source/CLASS-ALGEBRA.json | 165 ++ .../source/engine/INPUTS.json | 72 + .../source/engine/contractions.py | 236 +++ .../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 +++ .../source/row/bell_reads.py | 128 ++ .../source/row/compile_row.py | 247 +++ .../source/width13-spectrum.json | 1519 +++++++++++++++++ .../spherical.py | 66 + .../verify_adjoint.py | 150 ++ .../verify_canonical.py | 60 + 25 files changed, 4238 insertions(+) create mode 100644 research/clifford-compact-adjoint-fibres/CANONICAL.md create mode 100644 research/clifford-compact-adjoint-fibres/COORDINATES.md create mode 100644 research/clifford-compact-adjoint-fibres/PROOF.md create mode 100644 research/clifford-compact-adjoint-fibres/README.md create mode 100644 research/clifford-compact-adjoint-fibres/SOURCE-PINS.json create mode 100644 research/clifford-compact-adjoint-fibres/SOURCES.json create mode 100644 research/clifford-compact-adjoint-fibres/TASK.json create mode 100644 research/clifford-compact-adjoint-fibres/VERIFY.json create mode 100644 research/clifford-compact-adjoint-fibres/adjoint.py create mode 100644 research/clifford-compact-adjoint-fibres/canonical.py create mode 100644 research/clifford-compact-adjoint-fibres/check_coordinates.py create mode 100644 research/clifford-compact-adjoint-fibres/coordinate_support.py create mode 100644 research/clifford-compact-adjoint-fibres/source/CLASS-ALGEBRA.json create mode 100644 research/clifford-compact-adjoint-fibres/source/engine/INPUTS.json create mode 100644 research/clifford-compact-adjoint-fibres/source/engine/contractions.py create mode 100644 research/clifford-compact-adjoint-fibres/source/engine/source/LICENSE create mode 100644 research/clifford-compact-adjoint-fibres/source/engine/source/PR5698-NOTICE.md create mode 100644 research/clifford-compact-adjoint-fibres/source/engine/source/PR5704-NOTICE.md create mode 100644 research/clifford-compact-adjoint-fibres/source/engine/source/PR5704-quadratic.py create mode 100644 research/clifford-compact-adjoint-fibres/source/row/bell_reads.py create mode 100644 research/clifford-compact-adjoint-fibres/source/row/compile_row.py create mode 100644 research/clifford-compact-adjoint-fibres/source/width13-spectrum.json create mode 100644 research/clifford-compact-adjoint-fibres/spherical.py create mode 100644 research/clifford-compact-adjoint-fibres/verify_adjoint.py create mode 100644 research/clifford-compact-adjoint-fibres/verify_canonical.py diff --git a/research/clifford-compact-adjoint-fibres/CANONICAL.md b/research/clifford-compact-adjoint-fibres/CANONICAL.md new file mode 100644 index 0000000000..2d0e09b8c6 --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/CANONICAL.md @@ -0,0 +1,55 @@ +# Five rational weights for a repeated rank-one stabilizer site + +Let $a,b$ be normalized four-qubit stabilizer states in absolute Gaussian-dyadic gauges, with diagonalizing Pauli Lagrangians $L_a,L_b$. Put $B=|a\rangle\langle b|$ and $y=(\mathrm{vec}B)^{\otimes13}$. For the column labelled $(S,p)$ let $V=W_pU_S$, $\tau=\langle a|V|b\rangle$, and +$$ +j=d(L_a,SL_b)=4-\dim(L_a\cap SL_b). +$$ +With the dictionary normalization in [the adjoint proof](PROOF.md), the full Moore–Penrose solution is +$$ +(A^\dagger y)_{S,p}=h_j\,\overline\tau. +$$ + +| $j$ | $h_j$ | +|---:|---:| +| 0 | $279183413/16081633325721600$ | +| 1 | $52701673/32163266651443200$ | +| 2 | $36859/253254068121600$ | +| 3 | $-777583/64326533302886400$ | +| 4 | $-14688133/1029224532846182400$ | + +The input to the executable specifies $a=U_{T_a}|r\rangle$ and $b=U_{T_b}|c\rangle$; changing either by a Gaussian unit gives the thirteenth power of the corresponding phase on $y$. All 36,720 stabilizer lines (2,295 Lagrangians, sixteen eigencharacters each) occur on each side. When $T_a=T_b=I$, $B$ is an ordinary computational matrix unit. For a query, evaluate one four-qubit matrix element and the rank of the displayed intersection. The class computation below is finite preprocessing shared by all inputs and queries. [Executable](canonical.py) + +## From the adjoint to five distances + +The two stabilizer projectors for $a$ and $Vb$ are normalized signed sums of their sixteen Pauli stabilizers. Their trace pairing vanishes when the two characters disagree on the intersection; otherwise it equals $2^{-j}$ because the intersection contains $2^{4-j}$ labels. Hence $|\tau|^2$ is zero or $2^{-j}$. In the nonzero case $\tau(1+i)^j$ is a Gaussian dyadic of norm one. Factoring its Gaussian-integer numerator over the unique prime above two leaves only a Gaussian unit, so $\overline\tau^{12}=(-1/64)^j$. This gives +$$ +(A^*y)_{S,p}=(\overline\tau/4)^{13}=u_j\overline\tau,\qquad +u_j=4^{-13}(-1/64)^j +$$ +also when $\tau=0$. Keeping the complex phase here is essential even for real-looking rank-one inputs. + +In each fibre the 256 matrices $V_{S,p}$ are a trace-orthogonal basis of squared norm 16. Under synthesis $M_c(S)=\sum_pc_{S,p}V_{S,p}$, the adjoint data therefore become $16u_j B$. Coefficient extraction is $c_{S,p}=\operatorname{Tr}(V_{S,p}^*M_c(S))/16$. By #7816, $K=A^*A$ acts entrywise on $M$ by the real central convolution with $F(g)=16^{-12}(-64)^{\dim\operatorname{Fix}(g)}$ on $G=\mathrm{Sp}(8,2)$. This Gram is invertible. On functions $f(S)=w(d(L_a,SL_b))$, left and right transport identify its action with that at a single diagonal reference Lagrangian $Z$ on both sides. Namely, for $L_a=A_0 Z$ and $L_b=B_0 Z$ substitute $A_0^{-1}SB_0$ in the function argument; centrality makes both translations commute with the convolution. The stabilizer $P$ of $Z$ acts transitively on Lagrangians $X$ at each fixed distance from $Z$ by extending a pair of intersection-adapted symplectic bases. Thus the space of such radial functions is five-dimensional and retained by both $K$ and $K^{-1}$. [Central convolution and source conventions](https://github.com/apoursh/integer-mult-bounds/blob/7e7e62c62fcccd11f5c8e22677b4523863a48f4b/research/clifford-transported-fibre-gram/PROOF.md) + +## Exact radial normal equations + +Write $\Omega=G/P$ for the 2,295 Lagrangians, with shell sizes $(n_0,\ldots,n_4)=(1,30,280,960,1024)$. These also follow by selecting the intersection in $Z$ and then a symmetric graph on its quotient, $n_j={4\brack j}_2\,2^{j(j+1)/2}$. The executable generates all of $\Omega$ by closing $Z$ under specified symplectic transvections; the count, shell sizes and Lagrangian invariant certify coverage. For an ordinary conjugacy representative $g_i$ let $D_{ij}=\#\{X\in\Omega:d(X,g_iX)=j\}$. The operator $\sum_g F(g)g$ on functions on $\Omega$ has common entry $b_j$ on every ordered pair at distance $j$. Counting all such ordered pairs gives +$$ +b_j=\frac{\sum_i |C_i| F(g_i)D_{ij}}{|\Omega|n_j}. +$$ +The pushforward from the group has exactly this normalization: the entry from $X$ to $Y$ sums over every group element carrying $X$ to $Y$, including the entire stabilizer multiplicity. Equivalently one may use $g^{-1}$ since $F(g^{-1})=F(g)$. We compute the displacement counts on every retained ordinary representative and check equality on the fused rational pair before using its combined class size. The class sizes, fixed dimensions and all 81 representatives were computed natively in the referenced #7816 GAP source. [Frozen class data](source/CLASS-ALGEBRA.json) · [Native regeneration](https://github.com/apoursh/integer-mult-bounds/blob/7e7e62c62fcccd11f5c8e22677b4523863a48f4b/research/clifford-transported-fibre-gram/CLASS-ALGEBRA.md) + +Choose one $Y_i$ at distance $i$ from $Z$ and form the $5\times5$ matrix +$$ +K_{ik}^{\rm rad}=\sum_{X:d(Z,X)=k} b_{d(Y_i,X)}. +$$ +Exact elimination gives the displayed solution of $K^{\rm rad}h=u$. Multiplying each $16h_jB$ by $K$ gives $16u_jB$ on *all* group arguments. Since the full Gram is invertible, synthesis and extraction prove the claimed Moore–Penrose formula. Tests check the five normal equations, $n_iK_{ik}=n_kK_{ki}$, all distance branches under independent dense lift multiplication, and a separate spherical-eigenvalue reconstruction. The displacement construction uses $81\cdot2295$ class-representative/Lagrangian pairs and five distance rows. It never forms the $12,128,668,876,800$-column dictionary. [Direct checks](verify_canonical.py) · [Independent spectral reconstruction](spherical.py) + +## Error and support on the complete dictionary + +Trace orthogonality gives $\sum_p|\tau|^2=16$, so each fibre has exactly $16\cdot2^j$ nonzero $\tau$. All five $h_j$ are nonzero. Each shell of distance $j$ contains $|P|n_j$ group elements, and $|P|=47,377,612,800/2295$. Thus $|P|\sum_j n_j16\cdot2^j=8,338,459,852,800$ canonical coefficients are nonzero, the same support as the adjoint on this family. The orthogonal projector satisfies +$$ +\|AA^\dagger y\|^2=\langle A^*y,A^\dagger y\rangle +=16|P|\sum_j n_j u_j h_j +=\frac{478566778595}{5856573836677349376}. +$$ +The input has unit norm. Subtracting this fraction from one gives the minimum squared least-squares residual in the full Clifford span. The sparse known-fibre interface of #7816 by itself would require nearly every fibre; here the rank-one stabilizer symmetry gives a compact inverse despite that density. The argument applies to a repeated separable stabilizer site. Site-varying computational points have the adjoint census in [COORDINATES.md](COORDINATES.md); their inverse-Gram reduction remains open. diff --git a/research/clifford-compact-adjoint-fibres/COORDINATES.md b/research/clifford-compact-adjoint-fibres/COORDINATES.md new file mode 100644 index 0000000000..055b4df947 --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/COORDINATES.md @@ -0,0 +1,57 @@ +# Exactly how dense is the adjoint of one computational coordinate? + +Even a width-13 chart supported at one raw address produces trillions of nonzero adjoint coefficients. Their exact count depends on the correlations between the row and column nibbles of its 13 sites. The counts below concern the standard point observation with amplitude one. They do not assume a Clifford decomposition of that observation. + +| Attained extremum over all raw addresses | Occupied symplectic fibres | Nonzero Pauli-labelled coefficients | +|---|---:|---:| +| Minimum | 21,139,292,160 | 5,411,658,792,960 | +| Maximum | 47,377,612,800 | 8,338,459,852,800 | + +## Count for any coordinate + +Write $V=\mathbb F_2^n$, $q=2^n$, and denote the raw site row and column nibbles by $(r_i,c_i)\in V^2$. Use $n=4,f=13$ for the counts above. Let $Z$ denote the diagonal Pauli Lagrangian. For a fixed symplectic element $S$, write $H$ for the projection of $SZ$ onto the output $X$ bits and put $h=\dim H$. Let $J$ be the $X$-to-$X$ block of $S$. The support of the zero column of its unitary lift $U_S$ is an affine translate of $H$. Indeed it is stabilized by $SZ$ with specified signs. Diagonal stabilizers give $n-h$ independent support equations; the remaining stabilizer translations generate $H$ and preserve absolute value. Column $c$ is obtained by applying the conjugated input $X^c$, so its support is shifted by $Jc$. Each nonzero matrix entry has absolute value $2^{-h/2}$ by normalization. + +For the label $X^xZ^z U_S$ the adjoint entry on this coordinate is a product of $f$ conjugated unitary matrix entries divided by $q^{f/2}$. It is nonzero exactly when the constraints on $x$ at the individual sites agree. With differences from site one, this requires +$$ + \Delta r_i+J\Delta c_i\in H \quad\text{for every }i . +$$ +When compatible, $x$ runs through one coset of $H$ and $z$ is arbitrary. Exactly $2^{n+h}$ coefficients survive in the fibre, each of absolute value $2^{-(n+h)f/2}$. + +For each candidate subspace $H\le V$, quotient the output by $H$ and write $m=n-h$. The map $\bar J:V\to V/H$ is surjective since the full symplectic map has surjective output $X$ block and the images of the input $Z$ directions generate $H$. The site differences prescribe $\bar J(\Delta c_i)=\overline{\Delta r_i}$ on a subspace of dimension $s=\operatorname{rank}(\Delta c_i)$. If the prescribed pairs do not form the graph of a linear map on that subspace, this $H$ contributes zero. Otherwise let $b=\operatorname{rank}(\overline{\Delta r_i})$ and set $E(a,d)=\prod_{j=0}^{d-1}(2^a-2^j)$ for $d\le a$, zero for $d>a$. The number of surjective extensions is +$$ + 2^{b(n-s)}E(n-s,m-b). +$$ +To see this, choose a complement to the prescribed domain. Its map to the codomain modulo the prescribed image must be onto, and each such map has $2^{b(n-s)}$ lifts. + +The multiplicity of each surjective $\bar J$ at fixed $H$ is +$$ + 2^{h(h+1)/2}\,\frac{|P_Z|}{E(n,m)},\qquad + |P_Z|=2^{n(n+1)/2}|\operatorname{GL}(n,2)|. +$$ +Indeed any Lagrangian $L$ projecting onto $H$ satisfies $L\cap Z=H^\perp$. Modulo $H^\perp$, its lifts of $H$ are the graphs of maps $H\to H^*$, with isotropy equivalent to symmetry. This gives $2^{h(h+1)/2}$ choices. The symplectic group acts transitively on Lagrangians by extending a basis to a symplectic basis. For each $L$ there are $|P_Z|$ maps with $SZ=L$. The stabilizer $P_Z$ of $Z$ consists of a general linear basis change and a symmetric shear, giving its displayed order. Right composition with general linear basis changes preserving $Z$ permutes the surjections $V\to V/H$ transitively, so every surjection has the same multiplicity. Summing the product of the extension count and this multiplicity over $H$ counts exactly the occupied fibres. + +## Sharp extrema + +For $h=n$ the compatibility conditions disappear at every address. This yields the lower bound; take $c_i=0$ and use rows $0,e_1,\ldots,e_n$ among the $f$ sites to force $H=V$. Taking every site equal makes all fibres compatible, attaining the upper bound. These two witnesses exist for $f\ge n+1$. Each occupied rank-$h$ fibre always contributes the same number of entries and the same positive squared norm, so the witnesses also minimize and maximize the squared norm. At width 13 the extrema of $\|A^*\delta\|_2^2$ are $315/2^{70}$ and $87222165730875/2^{70}$, respectively. + +For the all-equal address the numbers of compatible fibres by $h=0,1,2,3,4$ are 20,643,840, 619,315,200, 5,780,275,200, 19,818,086,400 and 21,139,292,160. These follow from the same multiplicity or by counting the $h$-dimensional $H$. The computation enumerates only the 67 binary subspaces in dimension four. The independent small-qubit checker generates the 6 and 720 symplectic classes of lifts modulo Paulis in dimensions two and four via actual Hadamard, phase and controlled-NOT matrices. It tests all pairs of site addresses at each size and 240 further multisite lists, for 512 literal comparisons. [Census implementation](coordinate_support.py) · [Small-qubit verification](check_coordinates.py) + +## Independent check of the five canonical weights + +For a repeated site the canonical calculation in [the main proof](PROOF.md) reduces to a radial Gram on the graph of the 2,295 Lagrangians. The following check uses the earlier quotient character spectrum and the nearest-neighbour graph alone to compute this action, independently of the conjugacy-class displacement computation. Write $i=4-\dim(L\cap L_0)$ and connect vertices sharing a hyperplane. The number of neighbours at distances $i-1$ and $i+1$ is +$$ + c_i=2^i-1,\qquad b_i=2(16-2^i). +$$ +Indeed each hyperplane of $L$ extends to two other Lagrangians, since its perpendicular quotient has dimension two. Exactly $2^i-1$ hyperplanes contain $L\cap L_0$. For each of these, one of the other two extensions adds the line cut out by $L_0$ in that quotient, reducing the distance; the other keeps it fixed. If the hyperplane misses part of $L\cap L_0$, the original $L$ already uses the unique line from $L_0$, so both alternatives increase the distance. This gives shell sizes $k=(1,30,280,960,1024)$. + +The stabilizer of $L_0$ acts transitively on each shell by extending bases adapted to two Lagrangians to symplectic bases. Consequently the permutation representation has a five-dimensional commutant, one dimension per orbit on ordered pairs. The adjacency matrix has five distinct eigenvalues: with $u(0)=1$, the tridiagonal radial eigenvalue equation +$$ + \theta u(i)=c_i u(i-1)+(30-c_i-b_i)u(i)+b_i u(i+1) +$$ +gives and checks $\theta=30,13,3,-5,-15$ at both boundaries. The adjacency algebra thus exhausts the commutant and every eigenspace is an irreducible constituent of multiplicity one. Its projection kernel based at a vertex is a multiple of $u$. Transitivity, the trace and idempotence give its multiplicity $2295/\sum_i k_i u(i)^2$. The respective dimensions are 1, 135, 1190, 918 and 51, each unique among the 81 quotient characters in the frozen #7772 table. Their normalized Gram eigenvalues are, in this order, +$$ + \frac{470624175}{2^{32}},\quad \frac{1132984125}{2^{32}},\quad + \frac{5790052125}{2^{33}},\quad \frac{15074084025}{2^{33}},\quad + \frac{22846598775}{2^{32}} . +$$ +Project the radial adjoint values onto each $u$, divide by the corresponding Gram eigenvalue, and sum. All five canonical weights and the squared projection norm $478566778595/5856573836677349376$ agree exactly with the displacement-based solve. The norm is strictly between zero and one and all weights are nonzero. [Independent computation](spherical.py) · [Source spectrum](source/width13-spectrum.json) diff --git a/research/clifford-compact-adjoint-fibres/PROOF.md b/research/clifford-compact-adjoint-fibres/PROOF.md new file mode 100644 index 0000000000..b628bf0db9 --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/PROOF.md @@ -0,0 +1,30 @@ +# The physical adjoint on one affine-quadratic chart + +For $p=16x+z$, set $W_p=X^x Z^z$. Write $S\in\mathrm{Sp}(8,2)$, $V_{S,p}=W_pU_S$ and $a_{S,p}=(\mathrm{vec}(V_{S,p})/4)^{\otimes13}$. The lift $U_S$ follows the published transvection order; for each axis $u$, the factor is $(1+i)(I+iP_u)/2$ with $P_u=i^{(x_u\cdot z_u\bmod2)}W_u$. The high 52 bits of the observation address encode all 13 rows, and the low 52 bits encode the matching columns. We compute $t_{S,p}=\langle a_{S,p},y\rangle$, conjugate-linear in its first argument. The Bell left inverse of #7816 is a different specified operator on off-span observations. The subsequent canonical application is proved for a repeated stabilizer site in [CANONICAL.md](CANONICAL.md). [Absolute lifts and coordinate conventions](https://github.com/apoursh/integer-mult-bounds/blob/7e7e62c62fcccd11f5c8e22677b4523863a48f4b/research/clifford-transported-fibre-gram/PROOF.md) + +## One symbolic contraction for 256 labels + +On the independent support $a=a_0+Cu$ of the supplied chart, $y(a)=\alpha i^{q(u)}$. All binary sums in addresses are XOR. The quadratic $q$ has arbitrary linear coefficients modulo four and even cross coefficients. Write $(r_i(u),c_i(u))$ for the two four-bit addresses at site $i$. For the whole fibre simultaneously the coefficient at $(x,z)$ is +$$ +t_{S,16x+z}=\alpha\sum_u i^{q(u)}\, + (-1)^{\sum_i z\cdot(r_i(u)+x)} + \prod_{i=1}^{13}\overline{(U_S/4)_{r_i(u)+x,c_i(u)}}. +$$ + +The normalized Choi entries of $U_S$ form a single affine-quadratic chart. One way to see this is to prepare four Bell pairs and implement the local Clifford. The program constructs its 256 entries by the stated transvections. It finds a reduced basis of their affine support, takes the entry at the lexicographically least (binary integer order) support point as the absolute anchor, interpolates the phase on the coordinate basis and its pairs and verifies every matrix entry. This directly fixes the global phase and checks the chart extracted from the actual specified lift. Let $\beta$ be this anchor. For each site the program adds the binary constraints for membership in that support and subtracts its quadratic phase from the combined polynomial. The Weyl modulation contributes $2\sum_i z\cdot(r_i+x)$, again quadratic of the admissible type. Hence the result is $\alpha\bar\beta^{13}$ times a quadratic Gauss sum on an affine binary system in the eight label bits and at most 104 input parameters. + +Eliminate the highest pivots, putting the eight parameter bits at low indices. If inconsistent, the answer vanishes. Otherwise the low free variables parametrize exactly the projected affine set of labels, injectively. Each pivot among the original label bits depends only on earlier free label bits. The remaining free variables index the slice to be summed. Substitution pulls the polynomial back into these coordinates and preserves the even-cross form because a binary affine form expanded modulo four has even mixed terms and twice a product only needs its expansion modulo two. + +For a summed bit $w$, write the dependent part of the phase $aw+2w\ell$ with $\ell$ linear in the other bits. For $a=1,3$, summing $w$ gives $(1+i^a)i^{-a\ell}$, leaving a new admissible phase. For even $a$, summing gives twice the indicator $\ell=a/2$. When $\ell$ uses another summed variable, solve and substitute that variable. When it only uses retained variables, record the equation on those parameters. An impossible constant equation produces zero. Each step removes at least one summed bit and never enumerates its assignments. Solve the recorded equations after the last summed variable, restrict the quadratic phase and multiply the initial scalar by the resulting Gaussian integer. The label map stays injective on the final affine parameter space. The return is thus either zero or an eight-bit chart with $2^d$ equally large nonzero coefficients and a common absolute scalar, $0\le d\le8$. [Parametric elimination](adjoint.py) · [Literal independent summation](verify_adjoint.py) + +## Sharp image of the single-fibre map + +The 256 one-site normalized columns $b_p=\mathrm{vec}(W_pU_S)/4$ form an orthonormal stabilizer basis. The linear map $|p\rangle\mapsto b_p$ is Clifford. At $S=I$, Fourier-transform the four $z$ bits and add the resulting column bits into the four $x$ bits to obtain $4^{-1}\sum_c(-1)^{z\cdot c}|x+c,c\rangle$. For $S\ne I$, apply $U_S^{\mathsf T}$ on the column register. The transpose is again a Clifford, with the specified absolute lift. Four simultaneous real Hadamards have Gaussian-dyadic entries; alternatively each can be rephased by $e^{i\pi/4}$ and the common sign corrected after four. Copy the computational label thirteen times by binary CNOTs before applying this basis transformation sitewise. This is a Clifford isometry $E_S:|p\rangle\mapsto b_p^{\otimes13}$. Therefore $E_S^*E_S=I$; for any eight-bit affine-quadratic chart $w$, $E_S w$ is a single affine-quadratic observation (up to its supplied scalar) whose requested fibre is exactly $w$. The statement covers non-unit scalings because classical stabilizer-state closure applies after removing a common factor. The elementary generator routes or the same parametric elimination also work directly on unnormalized charts. In particular all nine nonzero support ranks occur. The test generates nine explicit large-support observations by Fourier synthesis at $S=I$ and checks all coefficients including their phases. + +For the zero output, use any distinct one-site computational labels $a,b$ in the first two tensor positions. The difference of the two ordered basis strings with $a,b$ interchanged and the other sites fixed is a two-point affine-quadratic observation. Its pairing with every $v^{\otimes13}$ vanishes by site exchange, even though the observation itself is nonzero. + +## Access and arithmetic + +For rank $r$ input, storing the address basis takes at most $104r$ bits and the dense phase table has at most $1+r+\binom r2$ entries, in addition to the scalar. These data are shared across named targets. Each target uses at most 16 transvections on a 256-entry site table; repeated targets can reuse this site description. There are at most 52 affine membership equations because the support of any unitary has at least 16 entries. One binary solve on at most $D=8+r\le112$ variables and one elimination of at most $r$ internal bits suffice. The final constraint solve uses at most eight variables. A conservative bound for the explicit Python phase substitutions is $O(D^5)$ small coefficient operations per target: a substitution expands at most $O(D^2)$ terms into at most $O(D^2)$ terms apiece; it can recur at most $D$ times. Binary row arithmetic uses masks of at most $D+1$ bits. There is no $2^{104}$ amplitude table. The output has at most eight basis vectors, 36 nonconstant phase coefficients and one complex scalar, or 256 entries if expanded. + +If the input scalar has component magnitude at most $2^B$ before its dyadic denominator, each dense lift numerator entry has magnitude at most $2^\ell$ for a word of length $\ell$. An unreduced output denominator is $2^{e+13(\ell+2)}$ for input denominator $2^e$. The accumulated Gauss factors have magnitude at most $2^{104}$ by the inner sum bound, and $|\alpha_{\rm num}|\le\sqrt2\,2^B$. Thus $B+13\ell+106$ magnitude bits per numerator component suffice. These are classical arithmetic and representation bounds. The separate price of the observation producer, physical movement and any complete multiplier depends on its interface. diff --git a/research/clifford-compact-adjoint-fibres/README.md b/research/clifford-compact-adjoint-fibres/README.md new file mode 100644 index 0000000000..3d0e063157 --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/README.md @@ -0,0 +1,39 @@ +# A compact adjoint and an off-span canonical Clifford decoder + +At four qubits and tensor width 13, one affine-quadratic observation gives **one eight-bit affine-quadratic chart per requested symplectic fibre** of the Hilbert adjoint $A^*y$. The chart gives all 256 Pauli-labelled coefficients with their absolute complex phases. It can be zero; otherwise its support is an affine subspace of size $2^d$, with every $0\le d\le8$ attainable. The computation reads the input chart once and uses one symbolic Gauss elimination per named target. [Construction, sharpness and costs](PROOF.md) · [Executable](adjoint.py) + +For the repeated site observation $y=(\operatorname{vec}|a\rangle\langle b|)^{\otimes13}$ formed from any two normalized four-qubit stabilizer states in the indicated Gaussian-dyadic gauges, **five rational numbers encode every coefficient of the full Moore–Penrose solution** $A^\dagger y=(A^*A)^{-1}A^*y$. Exactly 8,338,459,852,800 coefficients are nonzero. The orthogonal projection $AA^\dagger y$ has squared norm $478566778595/5856573836677349376$, so these unit-norm observations lie strictly outside the Clifford column span. This covers all 1,348,358,400 ordered pairs of stabilizer lines, including all repeated matrix units. Finite linear combinations of these inputs can be queried by linearity. [Five-weight formula and proof](CANONICAL.md) · [Exact executable](canonical.py) + +An arbitrary computational point observation, including different coordinates at the 13 sites, can force between **5,411,658,792,960 and 8,338,459,852,800** nonzero adjoint coefficients. Both extrema have explicit witnesses, and the support calculation counts the occupied coefficients on any supplied point by visiting just the 67 binary subspaces in four dimensions. [Exact census and witnesses](COORDINATES.md) + +## Replay and input + +Use CPython 3.12 and its standard library from the repository root. + +```sh +python3.12 -B scripts/research_package.py --package research/clifford-compact-adjoint-fibres +``` + +`adjoint.py request.json` accepts either a 104-bit `chart` or a retained #5704 `circuit` with optional `initial`. Columns of each `target` are the binary images of the eight Pauli basis labels. A chart is the list `[width, offset, independent_columns, phase_terms, real, imag, denominator_bits]` with Gaussian integer scalar divided by a power of two. A term is `[variable_mask, coefficient_mod_four]`. Binary rows occupy the high 52 address bits and columns the low 52. This request computes the identity fibre on the zero basis coordinate. + +```json +{"circuit":[],"targets":[[1,2,4,8,16,32,64,128]]} +``` + +It returns `[[8,0,[1,2,4,8],[],1,0,26]]`, with value $2^{-26}$ at all sixteen $Z$ labels. The first checker compares against literal products of 13 matrix entries, exhaustive small parametric Gauss sums and encoded charts with all nine possible support dimensions. An antisymmetric two-point observation cancels on every Clifford column. [Adjoint verification](verify_adjoint.py) + +`canonical.py request.json` evaluates individual Moore–Penrose coefficients on a repeated site, using the observable row and column and an array of `[target, Pauli_label]` pairs. Optional `left_basis` and `right_basis` are the symplectic maps whose fixed lifts supply the desired stabilizer bases; both default to the computational basis. The example returns the exact real coefficient `279183413/16081633325721600` and zero imaginary part. + +```json +{"row":0,"column":0,"queries":[[[1,2,4,8,16,32,64,128],0]]} +``` + +One implementation constructs the five-dimensional normal equations using the displacements of 2,295 Lagrangians under native conjugacy representatives. A second derives their spectral solution from the dual polar distance graph and previously published character degrees. [Canonical verification](verify_canonical.py) · [Independent spherical computation](spherical.py) · [Coordinate verification](check_coordinates.py) + +## Open next questions + +Which repeated *entangled* eight-bit stabilizer sites have a small spherical calculation for $A^\dagger y$? Classify their Schmidt ranks and the corresponding left/right stabilizers, then check whether the adjoint matrix coordinates still lie in a manageable invariant subspace. General affine-quadratic input now has a requested-fibre adjoint, but a compact canonical inverse on that full domain would also have to apply the inverse Gram to its potentially dense output. + +## Sources and scope + +Ali Romman's #5704 and #5727 supply the absolute-phase affine-quadratic engine, binary solves and one-pair contractions. The width-13 conventions, symplectic lifts and scalar central Gram reduction are from apoursh's #7800 and #7816, using the Clifford framework of alephnan and the spectral work of Nick Petalas and Ali Romman. The spherical cross-check uses the #7772 spectrum. The retained files have immutable hashes and the original attribution notices. This contribution addresses observation and decoder arithmetic under the supplied representation. Its results preserve the selected conditional multiplication exponent. Prepared by apoursh with substantial OpenAI Codex assistance under Apache-2.0. [Source pins](SOURCE-PINS.json) · [Public claim](https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19756928) diff --git a/research/clifford-compact-adjoint-fibres/SOURCE-PINS.json b/research/clifford-compact-adjoint-fibres/SOURCE-PINS.json new file mode 100644 index 0000000000..f4082bd5b8 --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/SOURCE-PINS.json @@ -0,0 +1,82 @@ +[ + { + "local": "source/engine/INPUTS.json", + "repository": "apoursh/integer-mult-bounds", + "commit": "65573785774c6bbac12485a4d90cd82778d25e36", + "path": "research/clifford-compact-pauli-fibre/predecessor/source/engine/INPUTS.json", + "sha256": "c62bd55fd36c136ba2ec34f6d91ed481497932fadc7134d0b7e5c10009fd588c", + "git_blob": "f9d4fd920651b002370ffb5084dbef2abaa5ed44" + }, + { + "local": "source/engine/contractions.py", + "repository": "apoursh/integer-mult-bounds", + "commit": "65573785774c6bbac12485a4d90cd82778d25e36", + "path": "research/clifford-compact-pauli-fibre/predecessor/source/engine/contractions.py", + "sha256": "a2fc065d6f293ddcffe5b6eec7fff0fdf57c8e3d4c6be355bd92e87d3f1865ef", + "git_blob": "76c807deceea0b1a6b64b50735253959b07c144d" + }, + { + "local": "source/engine/source/LICENSE", + "repository": "apoursh/integer-mult-bounds", + "commit": "65573785774c6bbac12485a4d90cd82778d25e36", + "path": "research/clifford-compact-pauli-fibre/predecessor/source/engine/source/LICENSE", + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "git_blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64" + }, + { + "local": "source/engine/source/PR5698-NOTICE.md", + "repository": "apoursh/integer-mult-bounds", + "commit": "65573785774c6bbac12485a4d90cd82778d25e36", + "path": "research/clifford-compact-pauli-fibre/predecessor/source/engine/source/PR5698-NOTICE.md", + "sha256": "1f55b3e4bb80a60611b1fca0622da5a99fe7877446f03d0edd1dc8f3a5abadd2", + "git_blob": "56712e3195faf8c83319100065183b8b2488809d" + }, + { + "local": "source/engine/source/PR5704-NOTICE.md", + "repository": "apoursh/integer-mult-bounds", + "commit": "65573785774c6bbac12485a4d90cd82778d25e36", + "path": "research/clifford-compact-pauli-fibre/predecessor/source/engine/source/PR5704-NOTICE.md", + "sha256": "a77adc71861e3b9c73c703c5db5b671f61a1101d85d14cca08547e21d6d8dce4", + "git_blob": "b96b400e5ca04b3a9003a8b2c70a2461972d39d7" + }, + { + "local": "source/engine/source/PR5704-quadratic.py", + "repository": "apoursh/integer-mult-bounds", + "commit": "65573785774c6bbac12485a4d90cd82778d25e36", + "path": "research/clifford-compact-pauli-fibre/predecessor/source/engine/source/PR5704-quadratic.py", + "sha256": "d406584aed1479b75c387bc964b9e797b2f4f75e5f8c6bbea00df07f7d590a91", + "git_blob": "ce3c86ec07fd5767741e02ff0c88b93ba9164fb4" + }, + { + "local": "source/row/bell_reads.py", + "repository": "apoursh/integer-mult-bounds", + "commit": "65573785774c6bbac12485a4d90cd82778d25e36", + "path": "research/clifford-compact-pauli-fibre/predecessor/source/row/bell_reads.py", + "sha256": "44942462cd7778d23042bf827fb313d0e7acf99aa5b9793e411503e83d3421b7", + "git_blob": "32b2ed2a94dc77d04709fedb420bf0ffd6d74f73" + }, + { + "local": "source/row/compile_row.py", + "repository": "apoursh/integer-mult-bounds", + "commit": "65573785774c6bbac12485a4d90cd82778d25e36", + "path": "research/clifford-compact-pauli-fibre/predecessor/source/row/compile_row.py", + "sha256": "4e6420f6dcccfd76d64a3b14d94dbdd4803bfd780c921a225d8f29b5d9f0565b", + "git_blob": "daf35d6a26993ed00cfc25a9e16c9136fba2a275" + }, + { + "local": "source/CLASS-ALGEBRA.json", + "repository": "apoursh/integer-mult-bounds", + "commit": "7e7e62c62fcccd11f5c8e22677b4523863a48f4b", + "path": "research/clifford-transported-fibre-gram/CLASS-ALGEBRA.json", + "sha256": "6c057511a066c8c0fe2c26ed69183a329e59e80308d1e6c0de7ed11f0d650537", + "git_blob": "cbee453d502ebcfa5dc1c286185f3e7755fda19d" + }, + { + "local": "source/width13-spectrum.json", + "repository": "aliromman/integer-mult-bounds", + "commit": "1398fbdca3536389d8ac3c8b3aaa408f03e8f6c2", + "path": "research/clifford-threshold-conditioning/RESULT.json", + "sha256": "d032d5e63820f4ffe246d21adcd8d272f04dfd635a6fc519c4a81a366ca41d49", + "git_blob": "039f22ba0bfec63c02fb3a97959766b8ec3a1bfa" + } +] diff --git a/research/clifford-compact-adjoint-fibres/SOURCES.json b/research/clifford-compact-adjoint-fibres/SOURCES.json new file mode 100644 index 0000000000..dd84994798 --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/SOURCES.json @@ -0,0 +1,97 @@ +{ + "schema_version": 1, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + } + ], + "cited_research": [ + { + "pr": 5704, + "head": "daa4d9dbd102d2a3677afc5614c56466bd2cf3a2", + "author": "aliromman", + "title": "Make complete Clifford replay 5.17x faster with exact quadratic states", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/5704" + }, + { + "pr": 5727, + "head": "8b74ecd0eea26d95b400e56435d35fbd261dc49b", + "author": "aliromman", + "title": "Add exact phase-sensitive Clifford contractions and attained finite-span errors", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/5727" + }, + { + "pr": 7772, + "head": "1398fbdca3536389d8ac3c8b3aaa408f03e8f6c2", + "author": "aliromman", + "title": "Determine sharp four-qubit Clifford threshold conditioning", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7772" + }, + { + "pr": 7799, + "head": "7f08a74037788311cc6b7da27297b25f1b188e45", + "author": "apoursh", + "title": "Prove the sharp Gaussian-dyadic four-qubit Clifford tensor width is 13 (no κ)", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7799" + }, + { + "pr": 7800, + "head": "fdc90699f4a64139ed6d84cdbf9a606ff0ccd32e", + "author": "apoursh", + "title": "Compile the width-13 Clifford decoder into 4,265 Bell reads and certify its dense input cost (no κ)", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7800" + }, + { + "pr": 7801, + "head": "9d15f66abc9ccf760ca5f7ea442adeb87b8f7115", + "author": "apoursh", + "title": "Evaluate the 4,265-term Clifford identity row on a compact input with one Gauss sum", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7801" + }, + { + "pr": 7805, + "head": "d3df403a13bee082a8cef62f190024aaf0cd08dd", + "author": "apoursh", + "title": "Determine the exact odd denominator of the canonical width-13 Clifford decoder", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7805" + }, + { + "pr": 7809, + "head": "7efc2c67b32e305d20e484dc3afa9229ab119269", + "author": "apoursh", + "title": "Prove sharp 52- and 51-pass bounds for width-13 Clifford decoding", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7809" + }, + { + "pr": 7813, + "head": "65573785774c6bbac12485a4d90cd82778d25e36", + "author": "apoursh", + "title": "Compute all 256 Pauli coefficients from one compact width-13 observation", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7813" + }, + { + "pr": 7815, + "head": "34a20a30596467409e7361534d52495819787a78", + "author": "aliromman", + "title": "Recover all unknown Clifford terms from exact tensor trains", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7815" + }, + { + "pr": 7816, + "head": "7e7e62c62fcccd11f5c8e22677b4523863a48f4b", + "author": "apoursh", + "title": "Apply the width-13 Clifford Gram and its inverse to requested fibres", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7816" + } + ] +} diff --git a/research/clifford-compact-adjoint-fibres/TASK.json b/research/clifford-compact-adjoint-fibres/TASK.json new file mode 100644 index 0000000000..bad04d3133 --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/TASK.json @@ -0,0 +1,93 @@ +{ + "schema_version": 1, + "task_id": "uniform-transfer-audit", + "original_card": { + "id": "uniform-transfer-audit", + "question": "Can one of the selected record's five inherited assumptions be proved at its actual caller?", + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md" + ], + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "acceptance_gate": "Identify the proposition and what would change downstream; do not equate a finite replay with a universal proof.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "first_experiment": "Choose one assumption ID (native_all_columns, owned_erasure, compiler, precision_tape, analytic_recovery), one quantified implication and exact dependency closure. Check current handoffs, including #5625 row reentry and #5707 root-prefix lowering, without treating their partial scope as the whole theorem. Prove or falsify that implication with a caller-bound argument; stop at the chosen obligation. Finite tests or root digits do not discharge an all-size statement.", + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "overlap_terms": [ + "native_all_columns", + "owned_erasure", + "compiler", + "precision_tape", + "analytic_recovery" + ], + "existing_checks": [ + { + "scope": "PR #4100: proposed unconditional construction and finite checks, without independent acceptance.", + "evidence": "research/unconditional-batched-crt/README.md", + "remaining": "Independent proof audit of one caller-bound all-size implication; all other premises remain explicit.", + "status": "author-checked", + "source_commit": "337d04939571a637aeab54a0f58f54fde811663a", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "status": "reviewed", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + } + ] + }, + "priority_revision": 8, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "selection_nonce": "3ea605f1162bf3f7b3654173a21817c3", + "scope_key": "58d0403e3078b2c5ae8a", + "scope_status": "changed", + "actual_scope": "Calculate the true width-13 adjoint of a compact affine-quadratic observation at named targets, count simultaneous support on coordinate observations, and compute the canonical decoder on repeated rank-one stabilizer sites.", + "scope_change_reason": "The earlier known-fibre Gram calculation requires supplied coefficient support and leaves the adjoint producer on actual observations open. Its Bell extension behaves differently off the column span.", + "bottleneck_link": "Gives exact and compressed representations on named observation interfaces and quantifies a concrete obstruction to listing sparse adjoint inputs.", + "stop_rule": "Check absolute phases and off-span controls, certify the exact support extremes, and verify the compact canonical result by independent radial and character calculations.", + "outcome": "completed", + "evidence": "The package README, proof and registered verification commands describe the exact scope and controls.", + "author": "apoursh", + "ai_assistance": "Substantial OpenAI Codex assistance with mathematical derivation, verification and review.", + "open_questions": [ + { + "question": "For which product or entangled observations can the full canonical readout use a comparably small orbit calculation?", + "why_it_matters": "A local adjoint chart on every requested target does not itself compress a global inverse across targets.", + "first_step": "Test two distinct repeated site factors and characterize the orbits of their common stabilizer.", + "blocked_by": "The present five-weight inversion uses the symmetry of one repeated rank-one stabilizer matrix." + } + ], + "claim": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19756928", + "overlap": "Read #1163, recent #1166 handoffs, active #7111 work and recent PRs; checked relevant all-state PR searches. The local overlap cache and sparse inventory have limited coverage. Compared recent #7815–#7818, the #1166 handoffs, the current #7111 research thread and all-state PR searches to the claimed scope.", + "upstream_refresh": { + "date_utc": "2026-11-19", + "canonical_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "selected_orientation": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "selected": "The selected result is #7000. The revision-8 catalogue refers to the earlier #5599.", + "before_submission": "Fetched canonical main again and checked the current work against the live PR queue." + } +} diff --git a/research/clifford-compact-adjoint-fibres/VERIFY.json b/research/clifford-compact-adjoint-fibres/VERIFY.json new file mode 100644 index 0000000000..0701e0d362 --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/VERIFY.json @@ -0,0 +1,117 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-E", + "-s", + "-W", + "error", + "-B", + "{package}/verify_adjoint.py" + ], + "timeout_seconds": 120, + "checks": "Literal phase-sensitive adjoint overlaps and single-fibre affine-quadratic support" + }, + { + "argv": [ + "{python}", + "-E", + "-s", + "-O", + "-W", + "error", + "-B", + "{package}/verify_adjoint.py" + ], + "timeout_seconds": 120, + "checks": "Literal phase-sensitive adjoint overlaps and single-fibre affine-quadratic support under optimized Python" + }, + { + "argv": [ + "{python}", + "-E", + "-s", + "-W", + "error", + "-B", + "{package}/check_coordinates.py" + ], + "timeout_seconds": 120, + "checks": "Any-coordinate point-support census, sharp extrema and independent small Clifford matrix checks" + }, + { + "argv": [ + "{python}", + "-E", + "-s", + "-O", + "-W", + "error", + "-B", + "{package}/check_coordinates.py" + ], + "timeout_seconds": 120, + "checks": "Any-coordinate point-support census, sharp extrema and independent small Clifford matrix checks under optimized Python" + }, + { + "argv": [ + "{python}", + "-E", + "-s", + "-W", + "error", + "-B", + "{package}/verify_canonical.py" + ], + "timeout_seconds": 120, + "checks": "Repeated stabilizer observations, canonical rational profile and projected mass" + }, + { + "argv": [ + "{python}", + "-E", + "-s", + "-O", + "-W", + "error", + "-B", + "{package}/verify_canonical.py" + ], + "timeout_seconds": 120, + "checks": "Repeated stabilizer observations, canonical rational profile and projected mass under optimized Python" + }, + { + "argv": [ + "{python}", + "-E", + "-s", + "-W", + "error", + "-B", + "{package}/spherical.py" + ], + "timeout_seconds": 120, + "checks": "Independent polar graph / character spectrum reconstruction of all five canonical shell weights" + }, + { + "argv": [ + "{python}", + "-E", + "-s", + "-O", + "-W", + "error", + "-B", + "{package}/spherical.py" + ], + "timeout_seconds": 120, + "checks": "Independent polar graph / character spectrum reconstruction of all five canonical shell weights under optimized Python" + } + ] +} diff --git a/research/clifford-compact-adjoint-fibres/adjoint.py b/research/clifford-compact-adjoint-fibres/adjoint.py new file mode 100644 index 0000000000..f1de960eed --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/adjoint.py @@ -0,0 +1,190 @@ +"""Exact width-13 Hilbert adjoint on a supplied affine-quadratic observation.""" +import argparse +from functools import cache, reduce +import json +from operator import xor +from pathlib import Path +import sys + +HERE = Path(__file__).resolve().parent +sys.path[:0] = [str(HERE / 'source' / sub) for sub in ('engine', 'row')] +from contractions import Q, conjugate, power, solution +from bell_reads import decompose +from compile_row import IDENTITY, is_symplectic + + +def evaluate_form(form, argument): + return (form & 1) ^ ((form >> 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-compact-adjoint-fibres/canonical.py b/research/clifford-compact-adjoint-fibres/canonical.py new file mode 100644 index 0000000000..4168b9aecb --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/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-compact-adjoint-fibres/check_coordinates.py b/research/clifford-compact-adjoint-fibres/check_coordinates.py new file mode 100644 index 0000000000..3a7356e526 --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/check_coordinates.py @@ -0,0 +1,118 @@ +"""Exhaust the one/two-qubit Clifford quotients using literal Gaussian matrices.""" +from collections import deque +from itertools import product +from fractions import Fraction +from pathlib import Path +from random import Random +import sys + +sys.path.insert(0,str(Path(__file__).resolve().parent)) +from coordinate_support import census + + +def require(ok, detail): + if not ok: + raise ValueError(detail) + + +def act(g, p, n): + kind, i, j = g + x, z = p >> n, p & ((1 << n)-1) + if kind == "H": + bit = ((x ^ z) >> i) & 1 + x ^= bit << i + z ^= bit << i + elif kind == "S": + z ^= x & (1 << i) + else: + x ^= ((x >> i) & 1) << j + z ^= ((z >> j) & 1) << i + return (x << n) | z + + +def matrix_step(g, matrix): + # Gaussian integers are stored in Python complex values. The small integer + # sums and sign changes here stay exact; check the component range at each step. + kind,i,j = g + q = len(matrix) + result = [] + for r in range(q): + b = (r >> i) & 1 + if kind == "H": + lo, hi = matrix[r & ~(1 << i)], matrix[r | (1 << i)] + row = tuple(a-x if b else a+x for a,x in zip(lo,hi,strict=True)) + elif kind == "S": + row = tuple(v*(1j if b else 1) for v in matrix[r]) + else: + row = matrix[r ^ (b << j)] + require(all(abs(v.real) < 2**30 and abs(v.imag) < 2**30 and + v.real == int(v.real) and v.imag == int(v.imag) for v in row),"integer range") + result.append(row) + return tuple(result) + + +def native(n): + q = 1 << n + gens = [(kind,i,0) for kind in ("H","S") for i in range(n)] + gens += [("CX",i,j) for i in range(n) for j in range(n) if i != j] + ident = tuple(1 << j for j in range(2*n)) + eye = tuple(tuple(complex(r==c) for c in range(q)) for r in range(q)) + seen = {ident} + todo = deque([(ident,eye)]) + support = [] + while todo: + sym, matrix = todo.popleft() + h = sum(row[0] != 0 for row in matrix).bit_length()-1 + masks = tuple(sum(1 << x for x in range(q) if matrix[r ^ x][c]) + for r in range(q) for c in range(q)) + support.append((h,masks)) + for g in gens: + partner = tuple(act(g,p,n) for p in sym) + if partner not in seen: + seen.add(partner) + todo.append((partner,matrix_step(g,matrix))) + require(len(support)=={1:6,2:720}[n],"incomplete small group") + return support + + +def direct(n, records, addresses): + q = 1 << n + hits = [0]*(n+1) + coeffs = [0]*(n+1) + for h,masks in records: + mask = (1 << q)-1 + for r,c in addresses: + mask &= masks[r*q+c] + if mask: + hits[h] += 1 + coeffs[h] += q*mask.bit_count() + return tuple(zip(hits,coeffs,strict=True)) + + +def main(): + small = 0 + rng = Random(1701) + for n in [1,2]: + native_group = native(n) + q = 1 << n + sites = list(product(range(q),repeat=2)) + examples = list(product(sites,repeat=2)) + examples += [tuple(rng.choice(sites) for _ in range(rng.randrange(3,10))) for _ in range(120)] + for a in examples: + require(census(n,a)==direct(n,native_group,a),("support mismatch",n,a)) + small += 1 + min_pattern = [(0,0),(1,0),(2,0),(4,0),(8,0)]+[(0,0)]*8 + max_pattern = [(0,0)]*13 + for label,pat in [("minimum",min_pattern),("maximum",max_pattern)]: + table=census(4,pat) + norm=sum(Fraction(ncoeff,2**((4+h)*13)) for h,(_,ncoeff) in enumerate(table)) + print(label,table,"total fibres and coefficients",tuple(map(sum,zip(*table))),"adjoint squared norm",norm) + require(sum(n for n,_ in census(4,max_pattern))==47377612800,"full Sp(8,2)") + require(census(4,min_pattern)[:4]==((0,0),)*4,"lower ranks survive separating coordinate") + extrema = [tuple(map(sum,zip(*census(4,pat)))) for pat in (min_pattern,max_pattern)] + require(extrema==[(21139292160,5411658792960),(47377612800,8338459852800)],"global extrema") + print("PASS literal small-rank matrix support on",small,"coordinate lists") + + +if __name__ == "__main__": + main() diff --git a/research/clifford-compact-adjoint-fibres/coordinate_support.py b/research/clifford-compact-adjoint-fibres/coordinate_support.py new file mode 100644 index 0000000000..ff5b6dedab --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/coordinate_support.py @@ -0,0 +1,63 @@ +"""Count occupied adjoint coefficients on any raw coordinate using binary subspaces.""" +from functools import cache +from math import prod + + +def rank(values): + pivots = {} + for vector in values: + while vector and vector.bit_length() in pivots: + vector ^= pivots[vector.bit_length()] + if vector: + pivots[vector.bit_length()] = vector + return len(pivots) + + +def epimorphisms(domain, codomain): + if codomain > domain: + return 0 + return prod((1 << domain) - (1 << i) for i in range(codomain)) + + +@cache +def subspaces(n): + zero = frozenset({0}) + spaces = {zero} + todo = [zero] + while todo: + space = todo.pop() + for v in range(1, 1 << n): + if v not in space: + bigger = space.union(w ^ v for w in space) + if bigger not in spaces: + spaces.add(bigger) + todo.append(bigger) + return tuple(spaces) + + +def census(n, row_columns): + """By Hadamard rank, return (occupied fibres, nonzero Pauli coefficients).""" + if not 1 <= n <= 4 or not row_columns: + raise ValueError("Supply 1..4 qubits and at least one coordinate pair") + q = 1 << n + if any(not (0 <= r < q and 0 <= c < q) for r, c in row_columns): + raise ValueError("Invalid computational address") + r0, c0 = row_columns[0] + diffs = [(r ^ r0, c ^ c0) for r, c in row_columns[1:]] + s = rank(c for _, c in diffs) + parabolic = (1 << (n*(n+1)//2))*epimorphisms(n,n) + by_rank = [0]*(n+1) + for H in subspaces(n): + h = len(H).bit_length()-1 + m = n-h + # A pivot need not be chosen in X/H: use the smallest integer in each coset. + prescribed = [(min(r ^ a for a in H), c) for r,c in diffs] + if rank((r << n) | c for r,c in prescribed) != s: + continue + b = rank(r for r,_ in prescribed) + extensions = (1 << (b*(n-s))) * epimorphisms(n-s,m-b) + weight, rem = divmod(parabolic, epimorphisms(n,m)) + if rem: + raise ValueError("Invalid parabolic multiplicity") + by_rank[h] += extensions * weight * (1 << (h*(h+1)//2)) + return tuple((count,count*(q << h)) for h,count in enumerate(by_rank)) diff --git a/research/clifford-compact-adjoint-fibres/source/CLASS-ALGEBRA.json b/research/clifford-compact-adjoint-fibres/source/CLASS-ALGEBRA.json new file mode 100644 index 0000000000..cbee453d50 --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/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-compact-adjoint-fibres/source/engine/INPUTS.json b/research/clifford-compact-adjoint-fibres/source/engine/INPUTS.json new file mode 100644 index 0000000000..f9d4fd9206 --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/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-compact-adjoint-fibres/source/engine/contractions.py b/research/clifford-compact-adjoint-fibres/source/engine/contractions.py new file mode 100644 index 0000000000..76c807dece --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/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-compact-adjoint-fibres/source/engine/source/LICENSE b/research/clifford-compact-adjoint-fibres/source/engine/source/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/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-compact-adjoint-fibres/source/engine/source/PR5698-NOTICE.md b/research/clifford-compact-adjoint-fibres/source/engine/source/PR5698-NOTICE.md new file mode 100644 index 0000000000..56712e3195 --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/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-compact-adjoint-fibres/source/engine/source/PR5704-NOTICE.md b/research/clifford-compact-adjoint-fibres/source/engine/source/PR5704-NOTICE.md new file mode 100644 index 0000000000..b96b400e5c --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/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-compact-adjoint-fibres/source/engine/source/PR5704-quadratic.py b/research/clifford-compact-adjoint-fibres/source/engine/source/PR5704-quadratic.py new file mode 100644 index 0000000000..ce3c86ec07 --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/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-compact-adjoint-fibres/source/row/bell_reads.py b/research/clifford-compact-adjoint-fibres/source/row/bell_reads.py new file mode 100644 index 0000000000..32b2ed2a94 --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/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-compact-adjoint-fibres/source/row/compile_row.py b/research/clifford-compact-adjoint-fibres/source/row/compile_row.py new file mode 100644 index 0000000000..daf35d6a26 --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/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-compact-adjoint-fibres/source/width13-spectrum.json b/research/clifford-compact-adjoint-fibres/source/width13-spectrum.json new file mode 100644 index 0000000000..039f22ba0b --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/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-compact-adjoint-fibres/spherical.py b/research/clifford-compact-adjoint-fibres/spherical.py new file mode 100644 index 0000000000..7cfa882a15 --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/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-compact-adjoint-fibres/verify_adjoint.py b/research/clifford-compact-adjoint-fibres/verify_adjoint.py new file mode 100644 index 0000000000..cd8b7e01e5 --- /dev/null +++ b/research/clifford-compact-adjoint-fibres/verify_adjoint.py @@ -0,0 +1,150 @@ +"""Literal tensor entries, parameter sums and sharp support-rank witnesses.""" +from random import Random +from pathlib import Path +import json +from hashlib import sha256 +import sys +sys.path.insert(0,str(Path(__file__).resolve().parent)) +from adjoint import (HERE, IDENTITY, Observation, Q, conjugate, decompose, eliminate, + evaluate_forms, power) +from bell_reads import transvection + + +def target(axes): + out = IDENTITY + for axis in axes: + out = tuple(transvection(axis,j) for j in out) + return out + + +def add(v,w): + return v[0]+w[0],v[1]+w[1] + + +def entry(chart,p): + pair,e = Q.amplitude(chart,p) + return pair[0],pair[1],1 << e + + +def same(x,y): + return x[0]*y[2]==y[0]*x[2] and x[1]*y[2]==y[1]*x[2] + + +def literal(t): + # Right multiplication in reversed word order, on columns. The consumer acts on rows. + rows = [[(int(r==c),0) for c in range(16)] for r in range(16)] + axes = decompose(t) + for a in reversed(axes): + x,z = divmod(a,16) + new = [] + for row in rows: + new.append([Q.multiply((1,1),add(v,Q.multiply_i(row[c ^ x], + 1 + ((x & z).bit_count() & 1) + 2*(z & c).bit_count()))) for c,v in enumerate(row)]) + rows = new + return rows,len(axes)+2 + + +def literal_contractions(chart,t): + _,offset,columns,phase,a,b,e = chart + vals,d = literal(t) + sums = [(0,0)]*256 + for u in range(1 << len(columns)): + address = offset + for j in Q.bits(u): + address ^= columns[j] + r,c = divmod(address,1<<52) + sample = Q.multiply_i((a,b),Q.value(dict(phase),u)) + for x in range(16): + prod = sample + parity_input = 0 + for j in range(13): + before = ((r >> (4*j)) & 15) ^ x + parity_input ^= before + prod = Q.multiply(prod,conjugate(vals[before][(c >> (4*j)) & 15])) + if prod == (0,0): + break + if prod!=(0,0): + for z in range(16): + p=16*x+z + sums[p]=add(sums[p],Q.multiply_i(prod,2*(z & parity_input).bit_count())) + return [(*v,1 << (e+13*d)) for v in sums] + + +def parametric_checks(rng): + checked = 0 + for n in range(9): + for fixed in range(n+1): + for _ in range(5): + q = {0:rng.randrange(4)} + for i in range(n): + Q.term(q,1 << i,rng.randrange(4)) + for j in range(i): + Q.term(q,(1<