Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions research/clifford-reversible-coefficient-readout/BRUHAT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Producing the factored input from a symplectic matrix

The tape consumes a factorization $N=i^g M_L^* H_b^\sharp M_R$. Every four-qubit binary symplectic map admits this format. The accompanying classical compiler accepts eight columns, in low-$Z$, high-$X$ order, and optionally a particular $16\times16$ Gaussian-dyadic matrix. It prepares a record once; its work is separate from each reversible query. When only the binary action is supplied, the compiler chooses one deterministic gauge. Supplying the absolute matrix preserves its Pauli translation and scalar phase.

Let $Z$ be the diagonal Pauli space and project $S Z$ to its upper four $X$ bits. Select a basis of this image of dimension $h$, keeping one lift $s_i$ of each selected basis vector. Extend the image basis to a basis of the full nibble. Let $A$ take this full basis to the standard basis. The symplectic basis change acts by $(z,x)\mapsto(A^{-T}z,Ax)$. In these coordinates $S Z$ contains precisely the diagonal directions $e_{h+1},\ldots,e_4$. The low $h$ components of the transformed $z_i$ for $s_i$ form the columns of a symmetric $h\times h$ matrix, by isotropy. Extend that matrix by zero on other axes to obtain $Q$. Adding $Qx$ to $z$ clears these $h$ diagonal components. Components beyond $h$ are already in the diagonal subspace and do not affect the resulting Lagrangian.

Compose this shear after $A$ to obtain $P_L$. It takes $SZ$ to the coordinate Lagrangian generated by $X_1,\ldots,X_h,Z_{h+1},\ldots,Z_4$. The partial Hadamard $H_b$ in the first $h$ bits maps it to $Z$. Hence $P_R=H_bP_L S$ preserves $Z$. Such a map has the form
$$
(z,x)\longmapsto (A_R^{-T}(z+C_Rx),A_Rx)
$$
where $A_R$ is invertible, and $C_R$ is symmetric by the symplectic pairing. The monomial $M|v\rangle=i^{q(v)}|Av\rangle$ realizes this map when the coefficients of $v_i$ in $q$ have parity $C_{ii}$ and the coefficients of $v_iv_j$ are $2C_{ij}$ modulo four. For the left side the input-coordinate shear is $A^T Q A$. Consequently $M_L^* H_b^\sharp M_R$ induces exactly $S$. Here $H^\sharp=\frac{1+i}{2}\bigl(\begin{smallmatrix}1&1\\1&-1\end{smallmatrix}\bigr)$, so all lift entries and their denominators use Gaussian integers and powers of two.

For a supplied absolute lift $U$, the quotient of $U$ by the constructed lift has trivial symplectic action. Its signs on the Weyl basis are a character of the binary Pauli label space, hence match a Pauli displacement by nondegeneracy of the pairing. After removing this displacement the operator commutes with all Weyls and is scalar. A scalar of modulus one in $\mathbb Z[i,1/2]$ is a power of $i$, by unique factorization or the sum-of-two-squares identity for powers of two. Thus $U=i^g X^xZ^z N$ for a unique $x,z,g$. The implementation tests exact entries after cross-multiplication by the supplied powers of two. It rejects a table with no match. It absorbs the displacement into the left monomial: in $M_L (X^xZ^z)^*$, the row permutation receives shift $Ax$, and the new phase polynomial is $q(v+x)+2z\cdot(v+x)$ with its constant removed. The conjugate of this constant phase enters $g$. The resulting input still allows the caller to choose an independent queried Pauli label.

`bruhat.py request.json` accepts `symplectic` and optional `entries`, `denominator_bits`. Absolute entries are 256 pairs of signed integer numerators in **row-major** order. The output supplies `left`, `right`, `mask`, and `phase`; the tape query also needs `x`, `z`, `terms`, and `precision`. The absolute-table step tests at most $256\cdot4$ corrections and at most 256 entries per correction. In the named four-qubit model the only unbounded input here is integer precision. [Classical factorization](bruhat.py)

The independent check recovers outgoing Pauli modulations from character signs and tests the binary identity on all 720 elements of an embedded two-qubit symplectic group. Fifty native four-qubit gate words cover the five possible Hadamard ranks, global units and Pauli corrections. Their 12,800 exact matrix entries were generated gate by gate and compared with the compiled absolute lift. [Verification](check_bruhat.py)
48 changes: 48 additions & 0 deletions research/clifford-reversible-coefficient-readout/PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# From repeated matrix units to a clean canonical readout

## Inputs, lift and target

In the four-qubit dictionary of width 13, use the normalized columns $(\operatorname{vec}(W_pU)/4)^{\otimes13}$, where $W_p=X^xZ^z$. An observation is explicitly supplied as an $m$-record sum
$$y=\sum_{\nu=1}^m i^{t_\nu}\bigl(\operatorname{vec} |r_\nu\rangle\langle c_\nu|\bigr)^{\otimes13}.$$
All rows, columns, Gaussian-unit weights and target fields are runtime inputs. Records may repeat and cancel. The output is the real and imaginary coefficient of $A^\dagger y$ for the queried label, each rounded to the nearest multiple of $2^{-p}$ with ties resolved to even. The circuit family is determined only by $m\ge1$ and $p\ge0$.

A monomial Clifford field $M$ maps $|v\rangle$ to $i^{q_M(v)}|Av+u\rangle$ on four-bit vectors. The phase polynomial is
$$q_M(v)=\sum_{a=0}^3 l_a v_a+2\sum_{a<b}d_{ab}v_av_b\pmod4.$$
Its binary linear matrix is supplied as four row masks, with $A\in\mathrm{GL}(4,2)$. The query lift is $U=i^gM_L^*H_b^\sharp M_R$, where $H_b^\sharp$ applies $(1+i)\bigl(\begin{smallmatrix}1&1\\1&-1\end{smallmatrix}\bigr)/2$ exactly to the mask bits of $b$. Its support-rank shell is $j=|b|$ because both monomial maps preserve the diagonal symplectic Lagrangian. The Gaussian phase convention matters even though the symplectic map only identifies a fibre. All four-qubit Clifford classes admit such factors. The optional compiler produces factors from a supplied binary symplectic map and can match an additionally supplied literal Gaussian-dyadic lift. Factoring is a separate precomputation when the caller starts with that other representation. Source input validation is a promise of well-formed factors, including nonsingular $A$. The CLI checks their dimensions and admissibility before executing the generated circuit. [Factorization and phase matching](BRUHAT.md)

## Five scales and the sharp denominator

PR #7821 gives the exact canonical coefficient of a single repeated matrix unit as $h_j\overline{\langle r|W_pU|c\rangle}$, with real rational shell weights $h_j$. Put $r'=r+x$, $l=A_Lr'+u_L$, and $v=A_Rc+u_R$ over the binary field. A record is active exactly when $l$ and $v$ agree away from $b$. For an active record the matrix entry is
$$
i^{g+q_R(c)-q_L(r')+2(z\cdot r'+l\cdot (b\wedge v))}
((1+i)/2)^j .
$$
This follows by inserting the two monomial basis images on either side of the partial Hadamard. Conjugating the entry and multiplying by $i^t$ gives an eighth-root direction with angle index
$$
e=2\bigl(t-g-q_R(c)+q_L(r')+2(z\cdot r'+l\cdot(b\wedge v))\bigr)-j\pmod8 .
$$
Its nonzero real or imaginary components have magnitude $2^{-\lceil j/2\rceil}$. Odd $j$ gives both components and even $j$ gives one. When $h_j<0$ the producer adds four to $e$ before extracting signs.

Let $H=4,116,898,131,384,729,600=7,852,360,022,325\cdot2^{19}$. Putting $a_j=Hh_j/2^{\lceil j/2\rceil}$ gives the following signed integers in order from $j=0$ to $j=4$.
$$
(71470953728,\quad3372907072,\quad299589952,\quad-12441328,\quad-14688133).
$$
The retained #7772 spectrum and the tridiagonal five-shell projector of #7821 reconstruct the exact rational $h_j$ and certify each integer. The absolute signed-component numerators of every contribution are therefore zero or $|a_j|$. Rank four alone forces the full denominator: take all four Hadamards, both monomials the identity, $p$ the zero Pauli label, $g=t=0$ and $r=c=0$. The canonical value is $14688133/H$, already in lowest terms. Thus $H$ is the least positive constant clearing *both components on the whole promised family*, even for one record. Its odd part is the exact common odd divisor required for this scaled-numerator interface. An unrestricted circuit could choose a different arithmetic representation. [Exact scale reconstruction](check_arithmetic.py) · [Canonical shell theorem](https://github.com/apoursh/integer-mult-bounds/blob/eead545a4ba6c50010fcac0919a9fdc6b14bd673/research/clifford-compact-adjoint-fibres/CANONICAL.md)

For a fixed target in shell $j$, allow arbitrarily many unit records. The attainable coefficient lattice is $(|a_j|/H)(1+i)^{j\bmod2}\mathbb Z[i]$. Choose any nonzero matrix entry and vary $t$ to realize every direction of that parity. For even $j$ the available scaled vectors are the four coordinate unit vectors, so the minimum number of unit records to make $(u,v)$ is $|u|+|v|$. For odd $j$ they are the four diagonals. An attainable pair has $u\equiv v\pmod2$ and needs at least $\max(|u|,|v|)$ steps. At exactly that length, choose each coordinate's signs independently to reach the prescribed value. These statements give the minimal number with arbitrary record coordinates, permitting the empty sum for zero. They distinguish the two parity lattices even when the supplied input format allows null records.

## Producer and signed accumulation

The runtime target logic counts the four mask bits, selects the five integer scales bitwise, and evaluates both affine addresses and quadratic phases for every record. A test on the unaffected bits suppresses excluded records. A three-bit angle selects the real and imaginary positive and negative indicators. For each component the accumulator adds the selected signed magnitude. The carry circuit uses $a+b+c\bmod2=a\oplus b\oplus c$ and outgoing carry $ab\oplus c(a\oplus b)$. Negative addends use the complemented magnitude plus one. With $B=\operatorname{bitlength}(m\max_j|a_j|)$, all partial sums fit signed two's-complement words of $B+1$ bits, including sums that change sign. The final conditional complement and increment produce the two absolute numerator magnitudes with their signs. Only after this exact accumulation does rounding begin. [Gate generator](producer.py) · [Literal independent matrix verification](check_values.py)

## Circuit, tape and physical prices

All initially occupied input wires are the fields of the request. Every other site bit starts zero. The constants $a_j$ and the common odd modulus are part of the uniform gate program; a runtime mask selects the scale in logic. The modulus bits are explicitly written with NOT gates and erased at the end. No table of answers or undocumented register content is supplied. The two output lanes and their sign bits are initially zero and occupy named distinct wires. All logical XOR and AND operations in fresh zero wires compile to CNOT and Toffoli. A single wire for one is toggled at the beginning and cleared at the end. Work is retained for reversal rather than silently discarded.

Eight local bits of each site hold logical data and two additional bits are clean routing tracks. The tape head accesses one site or a pair of adjacent sites. Gate cost counts NOT, CNOT and Toffoli separately and the head cost is the sum of absolute displacements between lower site indices of successive gates, including return to site zero. If a logical gate is already adjacent it is emitted directly. Otherwise each remote control copies its bit to a distinct routing track at its home and propagates it by CNOT one adjacent site at a time to the target. After the central local gate, every propagation is undone in reverse. Other occupied logical wires are untouched. For control distance $d>0$ in such a route the two sweeps use exactly $2(d+1)$ CNOT gates, in addition to the central gate. The two tracks accommodate the maximum two controls. Head prices include travel between the two routes and between separate gates. The literal replay meters every elementary gate. A second metering method uses just the first and last anchors on each monotone sweep and agrees exactly. [Local lowering](physical.py)

The conversion block uses the adjacent-site bit program from #7820, embedded at the end of the tape. For each lane, load the magnitude into the appropriate divisor input positions, run nearest-even division of the signed magnitude by $H$ to the requested precision, copy the rounded magnitude to the outputs, and reverse the divider and the load. Compute the output sign as the exact sign gated by a nonzero *rounded* magnitude and clean its work. After both lanes, erase the modulus and reverse the entire numerator program. Each step is a reversible gate sequence. Hence zero-initialized work is restored exactly, including all division remainders, sign flags and input copies, while the inputs and two signed outputs remain. The external CLI prints the stored magnitudes and signs as integers. No rational, nonlinear or random-access arithmetic operation is counted as a single physical gate. [Readout and resource meter](readout.py) · [Retained division gates](retained/divider.py) · [Divider proof](https://github.com/apoursh/integer-mult-bounds/blob/20a5532ea99b8ade78755486a6b92aa8071dc076/research/clifford-shared-denominator-tape/PROOF.md)

For an exact per-size receipt the generator uses $s=\max(19-p,0)$, $n=\max(B,s+1)$, quotient length $q=n+p-19+1$ and $k=\operatorname{bitlength}(7852360022325)=43$. If $A$ logical bit addresses have been allocated in the producer, output and sign work together, the physical tape has $\lceil A/8\rceil+q+k+\max(s,1)+2$ sites. In four fixed qubits, the coordinate and phase circuits per record are bounded, each signed accumulator uses $O(B)$ gates per record, and the output sign calculation uses $O(q)$ gates and wires. Hence the sites $S$ are $O(m(1+\log m)+p+1)$. Local lowering needs at most $O(S)$ elementary gates and head moves per nonlocal gate. Together with four local divider traversals this gives $O(S^2)$ elementary gates and head moves. These are conservative upper bounds for this explicit layout. Runtime values never change its schedule; every input with the same $m,p$ has the same receipt.

At $m=3,p=48$, the supplied nonidentity example has two active terms and one zero. The active terms are $(a,-a)$ and $(-a,-a)$ with $a=777583/257306133211545600$. Real parts cancel and the imaginary parts sum to $-777583/128653066605772800$. The exact final rounded integer is $-1701$ in the imaginary lane, while separate per-record rounding would give $-1702$ (check the signed values with the replay). The complete example uses 458 ten-track sites, 97,574 NOT, 849,046 CNOT and 171,478 Toffoli gates and 1,353,992 head moves. All inputs and every other bit are checked at the endpoint. [Local replay and negative control](check_local.py) · [Input](example.json)
34 changes: 34 additions & 0 deletions research/clifford-reversible-coefficient-readout/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# A clean physical canonical-coefficient readout at width 13

Given an explicit list of repeated computational matrix units with Gaussian-unit weights and a runtime four-qubit Clifford/Pauli target, this circuit returns the real and imaginary parts of the full width-13 Moore–Penrose coefficient, rounded once to any prescribed binary precision. The routine computes the target matrix entry and phase, chooses its shell, accumulates the signed complex numerator and performs the terminal division. It preserves the inputs, clears the workspace and returns the head home. Every Clifford class is covered by the supplied absolute-factor interface. [Equations, gate construction and costs](PROOF.md) · [Optional normal-form compiler](BRUHAT.md)

The least common component denominator for this observation family is **$H=7852360022325\cdot2^{19}$**. A single four-Hadamard coefficient attains that denominator in lowest terms. The proof also determines, at each target, the entire attainable Gaussian lattice and the fewest unit-weight records needed to realize each of its elements. The prior general inverse kernel has a different denominator. The observation interface here is a list of repeated matrix units and the numerical target is one named coefficient. [Arithmetic certificate](check_arithmetic.py) · [Upstream canonical weights](https://github.com/apoursh/integer-mult-bounds/blob/eead545a4ba6c50010fcac0919a9fdc6b14bd673/research/clifford-compact-adjoint-fibres/CANONICAL.md)

A three-record example cancels in the real component. At 48 fractional bits the complex grid output is $(0,-1701)$; rounding individual terms first gives $(0,-1702)$. The end-to-end reversible calculation takes **458 ten-track sites** and **1,353,992 adjacent head moves**, including register cleanup and return to the input end. Its primitive gate invoice is 97,574 NOTs, 849,046 CNOTs and 171,478 Toffolis. These costs are uniform over all target and record fields at the stated list length and precision. [Published input](example.json) · [Literal elementary replay](check_local.py)

## Input and replay

From the repository root use Python 3.12 and the standard library.

~~~sh
python3.12 -B scripts/research_package.py --package research/clifford-reversible-coefficient-readout
~~~

From the package directory run the following example. The CLI returns the signed integers in units of $2^{-\mathrm{precision}}$, the workspace size and the gate/motion invoice. Omitting the literal option executes equivalent reversible gates with the clean propagation routes metered by their lengths.

~~~sh
python3.12 -B readout.py example.json --literal
~~~

Each request provides left and right monomials. Their four binary row masks, translation nibble, four coefficients modulo four, and six cross-term bits define affine basis maps with quadratic phases. The cross bits follow ordered pairs $(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)$. The four-bit mask chooses partial Gaussian Hadamards, the two-bit phase chooses a central Gaussian unit, and the two nibbles $x,z$ specify $X^xZ^z$. Each list item is $[r,c,t]$ for weight $i^t$ on a computational matrix unit repeated over 13 sites. The precision is a nonnegative integer. Register allocation assumes the labels have been supplied at the documented fixed-width input positions. Building the external observation or translating another target representation can have additional costs. [Machine-readable example](example.json) · [Input encoding and wire layout](readout.py)

Four reproducible checks cover the rational scales and component lattice, exact complex sums against dense Gaussian matrices for all partial-Hadamard masks, actual elementary tape execution including modulus setup and output cleanup, and the constructive Bruhat compiler. Each checker also runs with optimized Python. [Dense oracle](check_values.py) · [Factorization check](check_bruhat.py) · [Registered commands](VERIFY.json)

## Open next questions

1. Can a moving-head compiler accept a symplectic matrix and its signed lift generators on tape, carry out the Bruhat reduction reversibly, and retain an interface of comparable cost for many queries?
2. For many named outputs, can the packet of returned coefficients share arithmetic and movement while preserving a clean output layout? Give a complete cost for an entire 256-label fibre and include placement of the outputs.

## Attribution

The five canonical weights and the repeated-site theorem are from apoursh's #7821, using the width-13 conditioning calculation by Ali Romman, with the Clifford and character work of alephnan and Nick Petalas. The local quotient and nearest-even gates are taken from apoursh's #7820. This extension derives the smaller exact denominator and record metric, supplies normal-form coverage and connects runtime target and observation labels to a clean local numerical readout. Prepared by apoursh with substantial OpenAI Codex assistance under Apache-2.0. The selected conditional multiplication exponent remains 0.00363005817. [Retained source hashes](SOURCE-PINS.json) · [Coordination claim](https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19757301)
Loading
Loading