diff --git a/research/clifford-shared-denominator-tape/PROOF.md b/research/clifford-shared-denominator-tape/PROOF.md new file mode 100644 index 0000000000..4f2022fa45 --- /dev/null +++ b/research/clifford-shared-denominator-tape/PROOF.md @@ -0,0 +1,39 @@ +# Terminal coefficient conversion on an adjacent-site tape + +## Source and consumer + +For an input sign and magnitude $N\ge0$, odd $D\ge1$ and $e,p\ge0$, the source value is $\pm N/(D2^e)$ and the returned fixed-point grid is $2^{-p}$. A source supplies the magnitude **already** scaled to the chosen common denominator. Set $s=\max(e-p,0)$, $a=\max(p-e,0)$ and divide +$$ +2^aN=(D2^s)q+R_0,\qquad 0\le R_00$ write $N=2^s A+B$. Divide only $A$ by $D$ and retain $B$ intact. The concatenation of the high remainder $r$ with these $s$ bits is $R_0=2^sr+B$. For $s=0$ append $a$ zeros to the input and use the ordinary remainder. The fraction $R_0/(D2^s)$ certifies the precise fractional part in output-grid units. Truncation is toward zero after the sign is reapplied. + +The source check reconstructs $D$ independently from the cited data. On a rational Galois packet, compute constituent dimension $d$ from the character norm and the Gram scalar from the fixed-space weighted character sum. Apply $1/x$ or the two schedule functions $P(x)=\prod(1-h_i x)$ and $(1-P(x))/x$, then invert the character transform on all 80 classes, multiplying each orbit-summed character by $d/|G|$. Taking the LCM of the reduced entries proves minimality of the reported *shared* kernel denominator. At widths 15, 16, 18, 20 and 22, the checker also applies the grouped inverse-projector formula to the five-qubit corner rows. Their exact odd moduli have bit lengths 381, 727, 997, 2073 and 1829, respectively. The physical program receives the modulus as data. The source-precomputation cost is separate. [Four-qubit central transform](https://github.com/apoursh/integer-mult-bounds/blob/7e7e62c62fcccd11f5c8e22677b4523863a48f4b/research/clifford-transported-fibre-gram/CLASS-ALGEBRA.md) · [Five-qubit corner formula](https://github.com/apoursh/integer-mult-bounds/blob/2007a7604cf44df8b666ada3483bc553ce557fa9/research/clifford-even-five-qubit-spectrum/PROOF.md) · [Exact source checks](denominators.py) + +## Tape protocol and reversibility + +Each site has eight binary tracks. A primitive is NOT, CNOT or Toffoli on at most two adjacent sites; distinct wires act as controls and target. Three CNOTs exchange two wires. A single head accesses its site and the site immediately to its right. We charge unit travel per site between the leftmost sites of consecutive gates, beginning and ending at site zero. Scratch is zero on entry and exit. The magnitude result, exact Euclidean remainder and (for rounding) the one-bit decision are outputs. The sign tag bypasses unsigned arithmetic. Negatives that round to zero read as the integer zero. The program is a uniform family of schedules indexed by public lengths. Generating control instructions, building input numerators, ferrying external data, and counting a universal machine's program counter require their own model. + +The modulus uses $k=\operatorname{bitlength}(D)$ bits. Choose input width $n\ge\max(1,s+1,\operatorname{bitlength}(N))$, with explicit leading-zero padding if needed. Add *one further zero* so rounding up also fits when $D=1$. The number of quotient digits is $m=1+n+p-e$. There are $S=m+k+\max(s,1)+2$ sites. Initially the data track holds $k$ zeros for the residue, the additional zero, the input and any appended zeros. The separate modulus track holds $D$ in sites 1 through $k$. A converter may reserve and re-use these $8S$ binary wires over any number of calls. + +At the start of a digit, the active data window contains a $k$-bit residue $rD]$ for $c_0=0$, $[w\ge D]$ for $c_0=1$. A majority is the XOR of its three pairwise ANDs. Complement one wire temporarily with two NOTs to implement the needed complement convention using three Toffolis. The low-to-high pass computes all carries; copy out the final carry and reverse the pass. For controlled subtraction, copy $c$ along the window and compute the addend bit $cD_i$ at each site. The borrow out is $\mathrm{maj}(\neg w_i,cD_i,b_i)$ with incoming borrow $b_i$. On the return pass erase that site's borrow *before* changing $w_i$ by $cD_i\mathbin\oplus b_i$. The incoming borrow still exists when needed. Uncompute the addend, copied controls and compare flag and shift the modulus to align with the next window. At the end all $m$ modulus shifts are reversed on the modulus track. Gating carries and advancing the modulus use no nonlocal fan-out. [Uniform gate generator](tape.py) + +## Correct rounding and exact tape cost + +For $s=0$, increment the magnitude if $2r>D$. An odd $D$ precludes equality. For $s>0$, let $b$ be the high bit of $B$ and let sticky be the OR of its remaining bits. Compare $2r+b$ with $D$. On equality increment if sticky or the truncated quotient's low bit is one. This is precisely round-to-nearest with ties to even. A reversible OR chain on the tail, plus propagation of quotient parity across the residue, supplies that carry-in to the comparator. All these temporary bits are restored before modifying the quotient. A controlled increment propagates carries from the least significant bit and erases them using the updated zero-run. Keeping the increment decision $u$ along with the original Euclidean remainder makes the conversion reversible: the magnitude of the rounded readout is $q+u$. At genuine ties, keeping only rounded magnitude and Euclidean remainder can conflate $q=1$ and $q=2$ at the same midpoint remainder. One bit of side information is both sufficient and necessary on this output convention when both inputs are admitted. + +For $s=0$, the maximum scalar error in nearest conversion is $(D-1)/(2D)$ output units; the two nearest nonzero residues to the midpoint attain it for $D>1$ with unrestricted magnitudes because 2 is a unit modulo $D$. For $s>0$, half an output unit is attainable at $R_0=D2^{s-1}$. Each real or imaginary component is converted independently. The worst complex Euclidean error for independent components is $\sqrt2$ times that scalar bound, multiplied by $2^{-p}$. + +Write $w=k+1$ in this invoice. Each ordinary digit uses $(8w+2,7w+1,14w)$ gates in order (NOT, CNOT, Toffoli). Restoring the initial modulus position costs an additional $3mw$ CNOTs. The nearest-rounding pass for $s=0$ adds $(4w+2m,m+3,6w+2m)$. For $s>0$ also add $(0,2w+4s+2,2s)$ for parity transport and sticky. For one digit entered and exited at its left boundary the movement is $10k+4$. Moving to the next window adds one. Each reversed modulus shift walks its $k+1$ adjacent swaps and repositions the head by at most $k+1$ between shifts. The rounding, head setup and final return use fewer than 20 full-tape sweeps (including the scratch reversals). In particular total head moves are at most $m(12k+10)+20S$. The generator/simulator computes exact moves for each choice of lengths. These upper bounds include stored input, quotient, local gate scratch and the scale-dependent remainder. [Exhaustive gate and inverse checks](check_tape.py) · [Physical coefficient replay](check_sources.py) + +## Optimal between-digit state and sharp prefix latency + +Consider a deterministic most-significant-first transducer at a fixed input position. It must emit the digit of the exact Euclidean quotient on each read and cannot revisit input or output. All stored information usable at the next digit, including any information in addressing or control, counts as state. Reading the $k$-bit binary expansion of $0\le r1$, put $h=(D-1)/2$. The nearest integer is $\lfloor(N+h)/D\rfloor$. For output bit $j$ its value flips precisely at the integer boundaries $t=kD2^j-h$ in $1\le t<2^n$, for positive integers $k$. After $d$ input bits every prefix is a dyadic interval of length $2^{n-d}$. Every such prefix determines that bit if and only if every flip occurs on an interval boundary. Consequently the exact worst-case determination time is +$$ +d_j=n-\min_t v_2(t) +$$ +when there is at least one flip, and zero otherwise. The two adjacent inputs $t-1,t$ for a minimizing boundary witness necessity. Aligned prefixes prove sufficiency. For $j>v_2(h)$, each boundary has valuation $v_2(h)$, giving $d_j=n-v_2(h)$. Floor division has boundaries $kD2^j$ and hence $d_j=n-j$ whenever the bit can flip. The high-bit delay caused by rounding can grow with $j$ even for a fixed supplied denominator. Allowing a backward correction pass gives the constructive tape scheme above. All claims in this paragraph concern an integer input and rounding at the integer grid; the program separately implements coarser/finer dyadic grids and signed inputs. [Prefix-tree checks and explicit large witnesses](check_latency.py) diff --git a/research/clifford-shared-denominator-tape/README.md b/research/clifford-shared-denominator-tape/README.md new file mode 100644 index 0000000000..95ddb5f262 --- /dev/null +++ b/research/clifford-shared-denominator-tape/README.md @@ -0,0 +1,38 @@ +# A reversible terminal divider for Clifford coefficient readouts + +The four-qubit width-13 inverse Gram kernel has a 145-bit shared odd denominator. On a tape holding a signed numerator and a supplied binary scale, this package converts the corresponding rational coefficient to any requested binary output precision. The local gate program implements Euclidean division, exact remainder delivery, truncation and nearest-even rounding. The numerator can be any signed integer. For a Gaussian coefficient run its two components sequentially. [Gate program](tape.py) · [Locality, resource and latency proofs](PROOF.md) + +The 80 rational classes of #7816 give the following *least common* denominators after reducing every coefficient of the specified kernel or pair. Factoring out the dyadic scale determines which conversion an actual coefficient array needs. + +| Four-qubit width-13 source | Shared odd divisor | Binary scale | +|---|---:|---:| +| Canonical inverse kernel | 22,742,436,009,630,709,072,767,882,717,680,300,149,753,125 | 0 | +| Pair of kernels for the 51-step optimal-norm schedule | 470,624,175 | 11,352 | +| Pair of kernels for the 52-step dyadic schedule | 1 | 7,499 | + +Source magnitudes and Pauli basis changes can carry additional scale. After the inputs are expressed over the chosen common denominator, a long dyadic tail below the requested precision stays in place as low remainder bits. It participates in a single rounding test. The odd division only processes the high numerator digits. For a short magnitude the signed wrapper automatically pads the input to at least one digit above the tail. At precision zero the actual 7,499- and 11,352-bit tails still occupy that many tape sites, including padding, and their sticky scans incur linear movement. [Source reconstruction and literal coefficient](check_sources.py) · [Published Gram kernels](https://github.com/apoursh/integer-mult-bounds/blob/7e7e62c62fcccd11f5c8e22677b4523863a48f4b/research/clifford-transported-fibre-gram/PROOF.md) + +For a fixed odd divisor $D$, a most-significant-bit-first Euclidean quotient transducer requires **exactly $D$ distinguishable states** between input bits. An exact lockstep transducer for $L$ independent component streams requires $D^L$. The tape construction visits a window of $k+1$ data sites for each divided digit, where $k$ is the modulus bit length. Its ordinary digit circuit uses exactly $29(k+1)+3$ NOT, CNOT and Toffoli gates, including advancing the modulus one site. A common-denominator register and an output bank may be reused across calls. The proof gives the entire-program invoice, including retreating the modulus, rounding, scratch closure and head return. + +Nearest rounding changes when a high output bit becomes knowable. For an $n$-bit integer divided by odd $D>1$, put $v=v_2((D-1)/2)$. A nonconstant rounded output bit $j>v$ first becomes determined for *every* input after exactly $n-v$ most-significant input bits. For the canonical four-qubit divisor, $v=1$. For the five-qubit canonical denominators at widths 15 and 16, $v=0$. Arbitrarily high nonconstant quotient bits can therefore depend on the last input bit at those widths. [Latency witnesses and prefix-tree replay](check_latency.py) + +As a physical example, take the identity-class coefficient of the actual width-13 inverse kernel. Its 32-fraction-bit nearest readout gives $4580344441/2^{32}$. With the shared denominator above, the circuit uses 326 eight-track sites, 209,200 NOT, 260,239 CNOT and 365,064 Toffoli gates and 311,724 one-site head moves. This is an upper bound for one terminal conversion in the stated local model. Occupied coefficient construction, numerator scaling and transfer to the converter are upstream obligations in a complete supplier. + +## Reproduce + +Use CPython 3.12 and the standard library from the repository root. + +```sh +python3.12 -B scripts/research_package.py --package research/clifford-shared-denominator-tape +``` + +From this package directory, `python3.12 -B convert.py -15 3 1 0` converts $-15/(3\cdot2)$ to the nearest integer. It returns $-2$, with magnitude remainder 3 modulo 6. The sign, retained rounding flag and remainder reconstruct the exact rational input. Pass `--truncate` to truncate toward zero. The package checks the bit-gate map against exact fractions, reverses the complete gate lists on all small inputs and independently computes when each output prefix becomes determined. [Signed conversion](convert.py) · [Exhaustive physical replay](check_tape.py) · [Source hashes](SOURCE-PINS.json) + +## Open next questions + +1. Can a producer supply these scaled numerators directly as local streams at useful precision? Price at least one complete nonidentity Pauli output, including its symplectic lookup, numerator accumulation, rounding and movement. +2. Is there a lower gate or motion bound stronger than the finite-state and latency obstructions for a named tape layout? Start with intermediate block sizes between one bit and one full residue and compare the cost of moving precomputed constants. + +## Attribution + +apoursh's #7805, #7812 and #7817 established the canonical denominators. The 51/52 schedules and transported kernel come from #7809 and #7816. Their underlying Clifford and character calculations credit Ali Romman, Nick Petalas, alephnan, GAP and the GAP Character Table Library. The binary restoring quotient and majority carry are classical arithmetic. This submission binds the published denominators to an explicit local reversible program, exact gate and head invoices, a residue-state lower bound and a sharp rounding-latency result. Prepared by apoursh with substantial OpenAI Codex assistance under Apache-2.0. [Collaboration claim](https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19756931) diff --git a/research/clifford-shared-denominator-tape/SOURCE-PINS.json b/research/clifford-shared-denominator-tape/SOURCE-PINS.json new file mode 100644 index 0000000000..6d1f814a66 --- /dev/null +++ b/research/clifford-shared-denominator-tape/SOURCE-PINS.json @@ -0,0 +1,26 @@ +[ + { + "local": "retained/CLASS-ALGEBRA.json", + "repository": "apoursh/integer-mult-bounds", + "commit": "7e7e62c62fcccd11f5c8e22677b4523863a48f4b", + "path": "research/clifford-transported-fibre-gram/CLASS-ALGEBRA.json", + "git_blob": "cbee453d502ebcfa5dc1c286185f3e7755fda19d", + "sha256": "6c057511a066c8c0fe2c26ed69183a329e59e80308d1e6c0de7ed11f0d650537" + }, + { + "local": "retained/SCHEDULE.json", + "repository": "apoursh/integer-mult-bounds", + "commit": "7e7e62c62fcccd11f5c8e22677b4523863a48f4b", + "path": "research/clifford-transported-fibre-gram/retained/SCHEDULE.json", + "git_blob": "8285a6ed622d68544ece2ecf668f54bf5b2e8bc2", + "sha256": "77a6ffadc3eb0ec32ddde33898e3dc528e0cdcf3907e565a9fee6ee0a48f5055" + }, + { + "local": "retained/CORNERS.json", + "repository": "apoursh/integer-mult-bounds", + "commit": "2007a7604cf44df8b666ada3483bc553ce557fa9", + "path": "research/clifford-even-five-qubit-spectrum/CORNERS.json", + "git_blob": "3e9bfca8e013c355589154b607fc95c072e80d1d", + "sha256": "11418292858e910133324288467d8b5f438027d1cc0853c0899964eb105a44a6" + } +] diff --git a/research/clifford-shared-denominator-tape/SOURCES.json b/research/clifford-shared-denominator-tape/SOURCES.json new file mode 100644 index 0000000000..e020d06858 --- /dev/null +++ b/research/clifford-shared-denominator-tape/SOURCES.json @@ -0,0 +1,76 @@ +{ + "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": 7772, + "head": "1398fbdca3536389d8ac3c8b3aaa408f03e8f6c2", + "author": "aliromman", + "title": "Determine sharp four-qubit Clifford threshold conditioning", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7772" + }, + { + "pr": 7802, + "head": "ebe2c019e398d73444e4f33f2d71bd5775795a01", + "author": "apoursh", + "title": "Determine the sharp odd denominator for noise-optimal four-qubit Clifford decoding", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7802" + }, + { + "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": 7806, + "head": "b42e665721e76e69d05f24a19bdabee0e0f77c04", + "author": "apoursh", + "title": "Prove the sharp five-qubit Clifford tensor threshold T(5) = 15", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7806" + }, + { + "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": 7812, + "head": "46a25a0e602ae6e2917ae2f2de3828f04bfcba4f", + "author": "apoursh", + "title": "Determine odd-denominator growth for canonical five-qubit Clifford decoding", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7812" + }, + { + "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" + }, + { + "pr": 7817, + "head": "2007a7604cf44df8b666ada3483bc553ce557fa9", + "author": "apoursh", + "title": "Determine both even-width five-qubit Clifford denominator growth rates", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7817" + } + ] +} diff --git a/research/clifford-shared-denominator-tape/TASK.json b/research/clifford-shared-denominator-tape/TASK.json new file mode 100644 index 0000000000..0d266ee7d3 --- /dev/null +++ b/research/clifford-shared-denominator-tape/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": "0d9a68afc6176d568a1d3633eaa58055", + "scope_key": "cdee6027333168fe48af", + "scope_status": "changed", + "actual_scope": "Implement reversible nearest-neighbour conversion of the exact shared Clifford denominators, including nearest-even output on a physical tape and input-state and latency lower bounds.", + "scope_change_reason": "Character and kernel calculations give exact common denominators but leave the actual shared terminal rational-to-binary conversion and location costs open.", + "bottleneck_link": "Turns the denominator handoff into an executable terminal circuit with an accounted readout cost, a dyadic-tail split and precise streaming limits.", + "stop_rule": "Reproduce the actual source kernel divisors, verify reversible local gate programs including rounding boundaries, and prove state and latency lower bounds on named interfaces.", + "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": "Can a producer supply the integer numerators directly in the order required by the division tape?", + "why_it_matters": "The terminal price and one-pass state bound do not account for computing or moving numerator inputs.", + "first_step": "Take one concrete kernel contraction and route its signed accumulator to the physical divider.", + "blocked_by": "A full cost needs explicit label access, precision, storage and a placement for the producer." + } + ], + "claim": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19756931", + "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-shared-denominator-tape/VERIFY.json b/research/clifford-shared-denominator-tape/VERIFY.json new file mode 100644 index 0000000000..d7ca678561 --- /dev/null +++ b/research/clifford-shared-denominator-tape/VERIFY.json @@ -0,0 +1,90 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-E", + "-s", + "-W", + "error", + "-B", + "{package}/check_tape.py" + ], + "timeout_seconds": 120, + "checks": "Local gate simulation and reversal, exact quotient and remainder, both output precisions and signed ties" + }, + { + "argv": [ + "{python}", + "-E", + "-s", + "-O", + "-W", + "error", + "-B", + "{package}/check_tape.py" + ], + "timeout_seconds": 120, + "checks": "Local gate simulation and reversal, exact quotient and remainder, both output precisions and signed ties under optimized Python" + }, + { + "argv": [ + "{python}", + "-E", + "-s", + "-W", + "error", + "-B", + "{package}/check_latency.py" + ], + "timeout_seconds": 120, + "checks": "Exact state thresholds and exhaustive prefix-tree certification for floor and nearest output" + }, + { + "argv": [ + "{python}", + "-E", + "-s", + "-O", + "-W", + "error", + "-B", + "{package}/check_latency.py" + ], + "timeout_seconds": 120, + "checks": "Exact state thresholds and exhaustive prefix-tree certification for floor and nearest output under optimized Python" + }, + { + "argv": [ + "{python}", + "-E", + "-s", + "-W", + "error", + "-B", + "{package}/check_sources.py" + ], + "timeout_seconds": 120, + "checks": "Pinned spectra and corner denominators, the two schedule odd parts and a literal width-13 physical conversion" + }, + { + "argv": [ + "{python}", + "-E", + "-s", + "-O", + "-W", + "error", + "-B", + "{package}/check_sources.py" + ], + "timeout_seconds": 120, + "checks": "Pinned spectra and corner denominators, the two schedule odd parts and a literal width-13 physical conversion under optimized Python" + } + ] +} diff --git a/research/clifford-shared-denominator-tape/check_latency.py b/research/clifford-shared-denominator-tape/check_latency.py new file mode 100644 index 0000000000..78b161024f --- /dev/null +++ b/research/clifford-shared-denominator-tape/check_latency.py @@ -0,0 +1,59 @@ +"""Independent prefix-tree and bounded-state proofs for quotient and rounded outputs.""" +from pathlib import Path +import sys +sys.path.insert(0,str(Path(__file__).resolve().parent)) +from denominators import require + +def v2(x): + return (x & -x).bit_length()-1 + + +def earliest(bits): + # Collapse consecutive equal leaves for both children of every prefix. + level=bits + depth=(len(level)-1).bit_length() + while len(level)>1 and all(a==b for a,b in zip(level[::2],level[1::2],strict=True)): + depth-=1 + level=level[::2] + return depth + + +def main(): + compared=0 + for d in range(3,64,2): + k=d.bit_length() + require(set(range(d))=={x%d for x in range(1<>j)&1 for x in range(limit)]) + require(claimed==observed,("latency",d,n,j,offset)) + compared+=1 + if 0v2(h): + require(earliest([((x+h)//d>>j)&1 for x in range(limit)])==n-v2(h), + "high-bit sharp delay") + for d in (22742436009630709072767882717680300149753125,470624175): + k=d.bit_length() + for j in (12,100,1000): + n=k+j + h=(d-1)//2 + threshold=(d<>j)&1 and + (((threshold-1+h)//d>>j)&1)==0,"literal decoder boundary") + require(((threshold-1)^threshold).bit_length()==v2(h)+1,"common prefix length") + print("PASS",compared,"floor and nearest prefix-tree depths; paired residues, literal 1000-bit delays.") + + +if __name__=="__main__": + main() diff --git a/research/clifford-shared-denominator-tape/check_sources.py b/research/clifford-shared-denominator-tape/check_sources.py new file mode 100644 index 0000000000..300292bf80 --- /dev/null +++ b/research/clifford-shared-denominator-tape/check_sources.py @@ -0,0 +1,48 @@ +"""Verify the terminal divisor interfaces and a literal width-13 canonical class coefficient.""" +from fractions import Fraction +from pathlib import Path +from math import lcm +import sys +sys.path.insert(0,str(Path(__file__).resolve().parent)) +from denominators import data,five,require,split,transformed +from tape import Layout,initial,program,run +from check_tape import expected +from convert import convert + +D13=22742436009630709072767882717680300149753125 + + +def main(): + kernels=transformed() + expected_divisors={"canonical":(D13,0),"schedule51":(470624175,11352),"schedule52":(1,7499)} + for name,k in kernels.items(): + h=lcm(*(v.denominator for f in k for v in f)) + require(split(h)==expected_divisors[name],name) + print(name,"odd divisor and binary scale",split(h)) + for name in ("schedule51","schedule52"): + d,e=expected_divisors[name] + short=convert(-3,d,e,0) + require(short["grid_integer"]==0 and short["exact_residue"]==3 and short["negative_input"], + "long padded binary tail and signed zero readout") + print(name,"three-unit numerator at its actual binary scale: sites",short["sites"]) + corners=data("CORNERS.json")["corners"] + for width,bits,delay in ((15,381,0),(16,727,0),(18,997,1),(20,2073,1),(22,1829,1)): + d=five(width,corners) + require(d.bit_length()==bits and split((d-1)//2)[1]==delay,"five-qubit divisor") + print("five-qubit",width,"carry bits",bits,"rounding suffix bits",delay) + # Physical readout of the identity coefficient of the actual inverse kernel. + val=kernels["canonical"][0][0] + n=abs(val*D13) + require(n.denominator==1,"literal integer numerator") + n=n.numerator + layout=Layout(n.bit_length(),D13.bit_length(),0,32) + state=initial(layout,D13,n) + counts=run(program(layout),state) + require(state==expected(layout,D13,n,True),"source-bound physical coefficient") + q=round(val*2**32) + print("identity kernel",val,"rounded grid integer",q,"sites",layout.sites, + "NOT/CNOT/Toffoli",tuple(counts[i] for i in (1,2,3)),"head moves",counts["moves"]) + + +if __name__=="__main__": + main() diff --git a/research/clifford-shared-denominator-tape/check_tape.py b/research/clifford-shared-denominator-tape/check_tape.py new file mode 100644 index 0000000000..3bbf1074f8 --- /dev/null +++ b/research/clifford-shared-denominator-tape/check_tape.py @@ -0,0 +1,126 @@ +"""Independent all-input, bit-sliced gate replay, including full inverse tape restoration.""" +from fractions import Fraction +from pathlib import Path +import sys + +sys.path.insert(0,str(Path(__file__).resolve().parent)) +from tape import Layout, X,D,Q, initial, program, run, step, wire + + +def require(ok,detail): + if not ok: + raise ValueError(detail) + + +def parallel(gates,state,mask): + # Each physical track is a Python bit-vector; lane i runs input i. + # This oracle checks every intermediate gate against the nearest-neighbour condition. + for g in gates: + require(len(set(g))==len(g) and max(g)//8-min(g)//8<=1, "nonlocal gate") + update=mask + for w in g[:-1]: + update &= state[w] + state[g[-1]] ^= update + + +def slice_rows(rows): + return [sum(x<> (bits-1-i))&1 + state[wire(layout.m,Q)]=flag + return state + + +def small(): + cases=0 + for d in range(1,32,2): + for e,p in [(0,0),(0,3),(4,0),(5,1),(1,0),(2,1),(3,5)]: + layout=Layout(8,d.bit_length(),e,p) + initial_state=slice_rows(initial(layout,d,n) for n in range(256)) + for nearest in (False,True): + tape=initial_state.copy() + gates=list(program(layout,nearest)) + parallel(gates,tape,(1<<256)-1) + require(tape==slice_rows(expected(layout,d,n,nearest) for n in range(256)), + ("published program",d,e,p,nearest)) + parallel(reversed(gates),tape,(1<<256)-1) + require(tape==initial_state,"inverse restoration") + cases+=256 + print("PASS",cases,"forward gate outputs plus exact inverse closures, including all rounding boundaries.") + + +def all_states(d): + # Test every accepted residue and both next digits independently of reachability traces. + k=d.bit_length() + layout=Layout(2,k,0,0) + valid=[] + predicted=[] + for r in range(d): + for b in (0,1): + w=2*r+b + q,nxt=divmod(w,d) + base=initial(layout,d,0) + for j in range(k+1): + base[wire(j,X)] = (w>>(k-j))&1 + valid.append(base) + result=[0]*len(base) + for j in range(k+1): + result[wire(j,X)] = ((q<>(k-j)&1 + for j in range(k): + result[wire(2+j,D)] = (d>>(k-1-j))&1 + predicted.append(result) + state=slice_rows(valid) + gates=list(step(0,k)) + parallel(gates,state,(1<<(2*d))-1) + require(state==slice_rows(predicted),"state map") + require(len(gates)==29*(k+1)+3,"per digit gate invoice") + return 2*d + + + +def invoices(): + from convert import convert + for s in (0,1,2,5): + for k in (1,3,7): + for p in (0,4): + a=Layout(9,k,s+p,p) + n=a.m + w=k+1 + # Per digit plus the final return of the modulus track. + base={1:n*(8*w+2),2:n*(10*w+1),3:n*(14*w)} + nearest={1:4*w+2*n,2:n+3,3:6*w+2*n} + if s: + nearest[2]+=2*w+4*s+2 + nearest[3]+=2*s + for use in (False,True): + result=run(program(a,use),initial(a,(1<>exponent,exponent + + +def transformed(): + tbl=data("CLASS-ALGEBRA.json") + schedule=data("SCHEDULE.json") + classes=tbl["classes"] + mass=sum(c["size"] for c in classes) + bs=schedule["norm_optimal_dyadic_fraction_bits"] + schedules={ + "schedule51":[Fraction(n,1< max(e-p,0)") + + @property + def s(self): + return max(self.e-self.p,0) + + @property + def m(self): + return self.bits+self.p-self.e+1 + + @property + def sites(self): + return self.m+self.k+max(self.s,1)+2 + + +def program(layout, nearest=True): + for i in range(layout.m): + yield from step(i,layout.k) + if nearest: + yield from rounded(layout.m,layout.k,layout.s) + # Return the supplied modulus to its original site positions. + for lo in range(layout.m-1,-1,-1): + for j in range(lo,lo+layout.k+1): + yield from swap(wire(j,D),wire(j+1,D)) + + +def word(value,width): + if not 0 <= value < 1 << width: + raise ValueError("value does not fit") + return [(value >> i)&1 for i in reversed(range(width))] + + +def initial(layout, divisor, numerator): + if divisor%2 != 1 or divisor.bit_length()!=layout.k: + raise ValueError("expected a positive odd modulus of the declared length") + state = [0]*(8*layout.sites) + for i, b in enumerate(word(divisor,layout.k),1): + state[wire(i,D)] = b + for i, b in enumerate(word(numerator,layout.bits),layout.k+1): + state[wire(i,X)] = b + return state + + +def read(state,start,length,track): + value = 0 + for i in range(start,start+length): + value = 2*value+state[wire(i,track)] + return value + + +def run(gates,state): + head = 0 + counts = Counter() + for gate in gates: + sites = [w//8 for w in gate] + anchor = min(sites) + if max(sites)>anchor+1 or len(set(gate))!=len(gate) or min(gate)<0: + raise ValueError("gate locality or alias") + counts["moves"] += abs(head-anchor) + head = anchor + a = gate[-1] + if len(gate)==1: + state[a] ^= 1 + elif len(gate)==2: + state[a] ^= state[gate[0]] + elif len(gate)==3: + state[a] ^= state[gate[0]] & state[gate[1]] + else: + raise ValueError("unknown gate") + counts[len(gate)] += 1 + counts["moves"] += head + return counts