diff --git a/research/order-seventeen-clifford/PROOF.md b/research/order-seventeen-clifford/PROOF.md new file mode 100644 index 0000000000..01e2382d7c --- /dev/null +++ b/research/order-seventeen-clifford/PROOF.md @@ -0,0 +1,165 @@ +# Order seventeen and the sharp rank-eight response cap + +Prepared by apoursh with substantial OpenAI Codex assistance. Apache-2.0. +The upper bound and Bell-spectator method are credited to Nick Petalas's +[PR6192](sources/pr6192-PROOF.md), head +`91df334ccd2a4bc9959e311f118ac8aaf967ffc2`; its Pauli-character step retains +Ross Richardson's credit. The new contribution is the explicit order-17 +matrix, signed-generator certificate and rank-eight specialization. + +## 1. Conventions and the four-qubit construction + +Index the computational basis by integers `x=sum_j 2^j x_j`, with bits +`j=0,1,2,3`. Matrix products act rightmost first. Let + +```text +Hg = (1+i)/2 [[1,1],[1,-1]], S = diag(1,i), +A = [[0,0,0,1], [0,0,1,0], [0,1,0,1], [1,0,1,1]], +U = i S_3 CZ_03 CZ_12 CZ_23 Hg^(tensor 4). +``` + +All factors are Gaussian-dyadic unitaries normalizing the Pauli group; +therefore U is a Gaussian-dyadic Clifford. Because `Hg=e^(pi i/4)H`, +its fourth tensor power is `-H^(tensor 4)`. Consequently every matrix +entry is given explicitly by + +```text +U[x,y] = (-i/4) i^(x_3) + (-1)^(x_0 x_3 + x_1 x_2 + x_2 x_3 + sum_j x_j y_j). +``` + +The prefactor `-i` is part of the assertion. Replacing U by iU preserves +Cliffordness but changes its seventeenth power to iI and destroys Phi17. + +Here is a complete integer certificate specification. Set `G=4U`, let +`P_0=I16` and `P_(j+1)=P_j G`, all over Gaussian integers. Exact +multiplication gives + +```text +G G* = 16 I16, +P_17 = 4^17 I16, +sum_(j=0)^16 4^(16-j) P_j = 0, +Tr(G) = -4. +``` + +These are equalities of all 256 entries, not sampled vectors or floating +point residuals. `independent.py` evaluates exactly this unreduced integer +recurrence. `verify.py` separately reduces a common denominator after each +Gaussian matrix operation, and checks all powers U^j for j=0,...,17. +It additionally finds denominator four and trace -1 for every j=1,...,16. +Thus U has exact order 17 and satisfies the actual whole-bank primitive +relation `Phi17(U)=I+U+...+U^16=0`. Exact order follows because 17 is prime +and U is not the identity, as its trace is -1 rather than 16. + +This is a complete finite certificate backed by explicit arithmetic, not +a formal-kernel verification or an extrapolation to unknown matrices. + +## 2. Signed Pauli action + +Use `X^x Z^z` in that order and Hermitian representatives +`P(x,z)=i^(sum_j x_j z_j) X^x Z^z`. Write binary labels as columns +`(x_0,...,x_3,z_0,...,z_3)`. Direct conjugation gives + +```text +U X_j U* = Z_j, +U Z_j U* = i^(A_jj) X_j product_k Z_k^(A_kj). +``` + +Each displayed image is the positive Hermitian representative. Both +checkers verify all eight generator equalities as full complex matrices, +including their phases. Hence the induced binary symplectic map is + +```text +S_U = [[0,I4],[I4,A]], +row masks = [16,32,64,128,129,66,164,216]. +``` + +Its order is 17, its native upper-right block is `I4` of rank four, +and `rank(S_U-I8)=8`. For the last claim, a vector in its kernel has +`x=z` and `Ax=0`. A is invertible: `Av=(v3,v2,v1+v3,v0+v2+v3)` +vanishes only for v=0. Thus the kernel is trivial. These facts are also +checked over F2 without using floating point ranks. + +## 3. Eight-qubit saturation + +Let D be the four active qubits and E four identity spectators. Put + +```text +V = (product_(j=0)^3 CNOT(j -> j+4)) (Hg^(tensor 4) tensor I16), +W = V^-1 (U tensor I16) V. +``` + +V and its inverse are Gaussian-dyadic Clifford circuits. Polynomial +evaluation commutes with tensoring an identity and with conjugation, so + +```text +Phi17(W) = V^-1 (Phi17(U) tensor I16) V = 0. +``` + +This identity is on all 256 coordinates; the spectators need not be +initialized. It does not assert that their state is restored by a caller: +W generally couples the two registers. The proof avoids an unnecessary +dense 256-dimensional power computation by using the already certified +16-dimensional identity and these exact algebraic operations. + +To compute the native block, order labels as `(x_D,x_E,z_D,z_E)`. +For input Z label `(d,e)`, V sends `(0,0,d,e)` to `(d,d,e,e)`. +The embedded active map sends this to `(e,d,d+Ae,e)`. +Applying V^-1 gives output X label + +```text +(d+(A+I)e, d+e). +``` + +Therefore `B_W=[[I,A+I],[I,I]]`. If it kills `(d,e)`, the second +equation gives d=e and the first then gives Ae=0, so d=e=0. +Thus its rank is eight. Both checkers also build V from its individual +binary Hadamard/CNOT actions, perform the complete conjugation and +recover this block. The primary checker verifies symplecticity, order +and defect rank eight. Additional identity spectators preserve both +the polynomial relation and native rank eight for every M>=8. + +## 4. Why eight is the cap + +This is the n=17 specialization of Petalas's theorem, not a new general +upper-bound argument. A whole-bank Gaussian-rational Clifford T on M +qubits satisfying Phi17(T)=0 has characteristic polynomial `Phi17^t`, +where `t=2^(M-4)`. Indeed Phi17 is irreducible over Q(i), since +`[Q(zeta68):Q(i)]=phi(68)/2=16`. Thus M>=4 and `Tr(T)=-2^(M-4)`. + +On the fixed space K of its binary Pauli action S_T, the signs of +Hermitian Pauli conjugation form a character. Their sum is the trace +of the adjoint action, namely `|Tr(T)|^2=2^(2M-8)>0`. A character +sum is either zero or |K|, hence `dim K=2M-8` and +`rank(S_T-I)=8`. The native B block is a submatrix of S_T-I, so +its rank is at most `min(M,8)`. Section 3 attains eight for every +M>=8. Four is the least possible active width; eight is the least +ambient width that can have an 8-by-8 full-rank native block. + +The complete cited proof, including the character argument and its +classical field-degree source, is retained in +[the predecessor document](sources/pr6192-PROOF.md). Its pending status +does not imply maintainer acceptance. The concrete identities above +are checked independently of predecessor executable code. + +## 5. Boundaries and failure controls + +Finite order alone is insufficient. U tensor U has order 17, but + +```text +Tr(Phi17(U tensor U)) = 16^2 + 16(-1)^2 = 272 != 0. +``` + +Other controls show that removing a CZ edge or omitting one polynomial +term fails Phi17; identity spectators without V leave native rank four; +an asymmetric proposed phase matrix is not symplectic; and the ordinary +companion matrix of Phi17 satisfies the polynomial but is not unitary. +These distinguish actual hypotheses rather than testing only that the +code can reproduce its own constants. + +The displayed W uses 12 H-type factors (including inverse Hg), eight +CNOTs, three CZs, one S and a scalar phase i. This is only an algebraic +factor inventory. Whether those factors are native, how they align with +an actual producer/consumer, and their complete paid and target bill +are not established. There is no ownership/restoration certificate, +new supplier, new kappa or full multiplication theorem here. diff --git a/research/order-seventeen-clifford/README.md b/research/order-seventeen-clifford/README.md new file mode 100644 index 0000000000..b87a9dc49d --- /dev/null +++ b/research/order-seventeen-clifford/README.md @@ -0,0 +1,149 @@ +# An explicit order-seventeen Gaussian-dyadic Clifford + +**Scoped construction and exact finite certificate; no new multiplication bound.** + +This answers the order-17 existence question in Nick Petalas's pending +[PR6192](https://github.com/CrocSwap/integer-mult-bounds/pull/6192), pinned at +`91df334ccd2a4bc9959e311f118ac8aaf967ffc2`. We give a four-qubit Clifford +whose actual matrix satisfies `Phi17(U)=0`, then apply that predecessor's +Bell-spectator method to attain its native `B`-rank cap of eight on eight +qubits. The construction works over `Z[i,1/2]`, including its global phase. + +With little-endian qubits `0,1,2,3`, rightmost factors acting first, set + +```text +Hg = (1+i)/2 [[1,1],[1,-1]], S = diag(1,i), +U17 = i S_3 CZ_03 CZ_12 CZ_23 Hg^(tensor 4). +``` + +The complete `16 x 16` certificate gives `U17^17=I`, `Phi17(U17)=0`, +trace `-1`, all eight signed Pauli-generator images, symplectic defect +rank eight and native `B` rank four. On four added identity spectators, +let `V` prepare four Bell pairs and put `W=V^-1(U17 tensor I16)V`. +Then `Phi17(W)=0`, and its native block is + +```text +B_W = [[I, A+I], [I, I]], A = [[0,0,0,1], + [0,0,1,0], + [0,1,0,1], + [1,0,1,1]]. +``` + +Since `A` is invertible over `F2`, `B_W` has rank eight. Adding identity +qubits preserves that rank, so the cap is attained for every ambient +width `M>=8`. See [PROOF.md](PROOF.md) for conventions, the finite +certificate, algebraic extension and credited upper-bound argument. + +## Evidence and limits + +`verify.py` uses exact Gaussian integer numerators with reduced denominators. +It checks all matrix entries, all sixteen nonidentity powers, all signed +Pauli-generator images, and the complete binary Bell conjugation. Seven +controls distinguish wrong phase, an omitted CZ, a truncated polynomial, +finite order without a primitive response, unused spectators, a nonsymplectic +prediction and a nonunitary cyclotomic companion. + +`independent.py` was written separately, without importing the primary +checker. It uses unreduced Gaussian integers `G=4U17` and clears denominators +in the polynomial identity; it independently checks the eight Pauli images +and constructs the binary Bell circuit. Both checkers use explicit failures +that remain active under optimized Python. The eight-qubit polynomial +identity follows by tensoring and conjugation in the written proof; neither +checker expands all powers of a dense `256 x 256` matrix. + +This is an explicit finite algebraic response, not an admitted supplier. +No source-bound caller, native legal schedule, ownership/dirty restoration, +complete paid/target invoice or multiplication theorem is supplied. Native +`B` rank is a binary algebraic invariant, not a physical gate-price receipt. +The selected conditional `kappa=781451/250000000`, its five framework +assumptions and selected evidence remain unchanged. No selected cold replay +was run. Earlier binding-only orientation was reused after confirming its +1227 bound inputs were unchanged from checkpoint `3f0152a32eeebac0df11946dbd50cabe5a7f7839` to this base; +that reuse is not a fresh scientific replay. + +## Reproduce + +From a full Git checkout, with Python 3.12 and no third-party dependencies: + +```sh +python3.12 -B scripts/research_package.py --package research/order-seventeen-clifford --check-only +python3.12 -B scripts/research_package.py --package research/order-seventeen-clifford +``` + +The registered commands run both checkers normally and with `-O`, isolated +and with warnings treated as errors. Expected markers are +`PASS_ORDER_SEVENTEEN_CLIFFORD` and `PASS_INDEPENDENT_ORDER17`. +For a Git-free source export, run these direct commands from its root, +once normally and once with `-O` added: + +```sh +python3.12 -I -B -W error research/order-seventeen-clifford/verify.py +python3.12 -I -B -W error research/order-seventeen-clifford/independent.py +``` + +[VERIFY.json](VERIFY.json) has no external live inputs: all mathematical +inputs are defined in the package. [SOURCES.json](SOURCES.json) pins the +base, original catalogue card and selected record as historical provenance. +The pending predecessor is not an ancestor dependency: its two cited source +documents are retained verbatim under `sources/` to make the precise theorem +and method available in an offline export. [SOURCE-PINS.json](SOURCE-PINS.json) +records their public source URLs, exact head and SHA256 digests, checked by +the primary verifier. Their bytes were also compared with the fetched head +before publication. No predecessor executable is imported or replayed. +The Git source-history preflight covers declared base provenance; it does +not authenticate the external predecessor-head label or validate its theorem. +Package-local changes already select this registered replay. + +## Coordination and scope + +Canonical main was pulled first at +`a5bff3bf133e482541c09eba4e773884bdb2b1b7`, priority revision 8. +The original `joint-query-controller` card is retained in [TASK.json](TASK.json). +Its scope is explicitly changed to this bounded algebraic subproblem: the +card's complete source/consumer acceptance gate remains unmet. +The canonical investigation is [Discussion 1166, comment 19273131](https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19273131), +responding to the predecessor's released +[handoff](https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19272674). + +Overlap coverage was bounded: the local helper searched 30 of 8623 package +notes (8593 absent in this sparse checkout), without a fresh remote cache. +Live checks read the newest 15 handoff comments and all-state PR searches +for `Clifford seventeen`, `Phi17` and `order-17`; no competing explicit +instance was found in those results. This is not an exhaustive novelty audit. +The stopping rule was the first complete exact order-17 construction and +its rank certificate, without searching larger orders or proposing a +supplier-budget change. + +## Open next questions + +- **Can this response satisfy an actual source/consumer contract?** Its + algebraic feasibility removes one uncertainty, but does not remove paid + work. Start by identifying one current caller whose required whole-bank + action matches this exact matrix, then check native chronology, all + retained outputs and restoration. Blocker: no such caller is supplied here. +- **Can the rank-eight witness be implemented more cheaply than this Bell + conjugation in that caller's allowed alphabet?** A cheaper implementation + might affect a complete invoice. First establish the matched contract and + price the stated circuit, then compare one exactly equivalent circuit. + Blocker: without that contract and cost model, an algebraic gate count + cannot establish a saving. Do not expand the search before that gate. + +The structured questions and blockers are also in [TASK.json](TASK.json). + +## Credit + +Prepared by **apoursh**, with substantial OpenAI Codex assistance for +construction, independently written exact checks, proof and packaging. +Nick Petalas retains credit for PR6192's odd-cyclotomic rank theorem and +Bell-spectator sharpness method; Ross Richardson retains the earlier +whole-bank cubic/Pauli-character argument (PR4081). Copied predecessor +documents retain their attribution and the repository's Apache-2.0 license. + +Cyclic Clifford constructions are classical; for example, Oliver Kern, +Kedar S. Ranade and Ulrich Seyfarth give cyclic MUB constructions in +power-of-two dimensions in +[arXiv:0912.4661](https://arxiv.org/abs/0912.4661). +This package claims a reproducible explicit Gaussian-dyadic instance and +rank-eight certificate for the repository's handoff, not historical priority +for cyclic Clifford existence or Bell conjugation. The cited literature is +context, not a replay dependency. New material is Apache-2.0. diff --git a/research/order-seventeen-clifford/SOURCE-PINS.json b/research/order-seventeen-clifford/SOURCE-PINS.json new file mode 100644 index 0000000000..f65480158f --- /dev/null +++ b/research/order-seventeen-clifford/SOURCE-PINS.json @@ -0,0 +1,19 @@ +{ + "source_pr": 6192, + "author": "Nick Petalas", + "head": "91df334ccd2a4bc9959e311f118ac8aaf967ffc2", + "status": "pending predecessor; cited theorem and method, not independently replayed", + "license": "Apache-2.0", + "files": [ + { + "path": "sources/pr6192-PROOF.md", + "source_url": "https://github.com/CrocSwap/integer-mult-bounds/blob/91df334ccd2a4bc9959e311f118ac8aaf967ffc2/research/odd-cyclotomic-response/PROOF.md", + "sha256": "324f494b016b4c63573cb6ed3fd14cedc258621cb17a5b9800165d921a1445d0" + }, + { + "path": "sources/pr6192-README.md", + "source_url": "https://github.com/CrocSwap/integer-mult-bounds/blob/91df334ccd2a4bc9959e311f118ac8aaf967ffc2/research/odd-cyclotomic-response/README.md", + "sha256": "dab05bd081f14224bdbe2a0429b8f4389fb930a2922a7544781b184bd4d0f7ec" + } + ] +} diff --git a/research/order-seventeen-clifford/SOURCES.json b/research/order-seventeen-clifford/SOURCES.json new file mode 100644 index 0000000000..75db18102e --- /dev/null +++ b/research/order-seventeen-clifford/SOURCES.json @@ -0,0 +1,18 @@ +{ + "schema_version": 1, + "base_commit": "a5bff3bf133e482541c09eba4e773884bdb2b1b7", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "d59b5035e7b4cbaa9d688a1d32dd0d6eb79c466a", + "sha256": "9b8d0eea95b3bf0dfcb7938a732a6439b87a2685dec2a5ab9e525b3b34debbfa" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + } + ] +} diff --git a/research/order-seventeen-clifford/TASK.json b/research/order-seventeen-clifford/TASK.json new file mode 100644 index 0000000000..2495742205 --- /dev/null +++ b/research/order-seventeen-clifford/TASK.json @@ -0,0 +1,93 @@ +{ + "schema_version": 1, + "task_id": "joint-query-controller", + "priority_revision": 8, + "base_commit": "a5bff3bf133e482541c09eba4e773884bdb2b1b7", + "original_card": { + "id": "joint-query-controller", + "question": "Can a changed query demand or caller remove real work while satisfying native chronology and restoration?", + "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": "A source-bound arbitrary-input identity and legal producer/consumer boundary with the complete paid and productive target invoice, including restoration, ownership, native alignment and extra charges. Price under the actual current model; historical ceiling.py assumptions must be established before use. A favorable optimistic relaxation keeps a route open but is not a completed supplier. A scoped local result remains useful; expansion requires the family-level budget gate.", + "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 an exact caller and a new demand/interface hypothesis. Read the scoped #5617/#5631/#5649/#5747 and #5720/#5745 objections before rebuilding an excluded schedule. Compare the complete matched source/consumer protocols including all retained helper outputs. For an active-mode injection, first check #5745: its canonical delivery claim repays the eight removed centre jobs. Audit that exact claim or change its channel/feedback hypothesis; do not repeat the same free-injection search. Stop if the full favorable budget fails or the required restored output is unobservable.", + "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": [ + "query demand", + "active mode", + "5720", + "5745", + "5747", + "caller" + ], + "existing_checks": [ + { + "scope": "PR #4166: author-checked installed producer/service/return/bridge connection; native-component comparison loses.", + "evidence": "research/qq16-caller-install/README.md", + "remaining": "Complete matched physical protocol bill, or changed source-compatible demand/circuit; no affordable supplier yet.", + "status": "author-checked", + "source_commit": "0b082d22a0e9a442d264ab0633e35ef26c790630", + "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" + } + ] + }, + "scope_status": "changed", + "actual_scope": "Construct and exactly verify one Gaussian-dyadic whole-bank Clifford satisfying Phi17(U)=0; specialize the credited Bell-spectator method to attain native B rank eight.", + "scope_change_reason": "Handoff-first selection from pending PR6192 (head 91df334ccd2a4bc9959e311f118ac8aaf967ffc2), released in Discussion 1166 comment 19272674. This algebraic existence subproblem changes the original joint-query-controller first experiment; no exact caller or complete supplier invoice is claimed.", + "bottleneck_link": "Side result: makes one primitive order-17 response concrete and shows the native rank-eight cap is attainable. Complete source/consumer chronology, ownership, restoration and the paid/target bill remain the admission gate.", + "budget_minutes": 60, + "stop_rule": "Stop after the first complete exact order-17 construction and its rank-eight certificate; no larger-order search or supplier-budget expansion.", + "outcome": "completed", + "evidence": "PROOF.md; verify.py (exact 16x16 matrices, signed Pauli generators, binary Bell conjugation, seven controls and source hashes); independently written independent.py. Normal and optimized registered replay on Python 3.12. No selected cold replay.", + "author": "apoursh", + "ai_assistance": "Substantial OpenAI Codex assistance: candidate construction, two independently written exact checkers, separate mathematical audit, proof, source provenance and PR packaging. Prepared by apoursh.", + "open_questions": [ + { + "question": "Can this exact response satisfy an actual source/consumer contract?", + "why_it_matters": "Algebraic feasibility alone does not remove paid work or establish a supplier.", + "first_step": "Identify one current caller needing this exact whole-bank matrix, then check native chronology, retained outputs, ownership and restoration.", + "blocked_by": "No matched caller or restoration contract is supplied in this package." + }, + { + "question": "Can a rank-eight order-17 implementation cost less than the displayed Bell conjugation in the matched caller alphabet?", + "why_it_matters": "Only a complete matched invoice can turn an implementation improvement into a bound contribution.", + "first_step": "After the caller gate, price the stated circuit and compare one exactly equivalent legal circuit, retaining all restoration charges.", + "blocked_by": "The source/consumer contract and applicable physical cost model must be established before expanding this algebraic search." + } + ], + "scope_key": "58d8c9133832c5149bdc", + "chooser_seed": "4262150df398c92e1de63418f634f565", + "coordination_url": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19273131" +} diff --git a/research/order-seventeen-clifford/VERIFY.json b/research/order-seventeen-clifford/VERIFY.json new file mode 100644 index 0000000000..765cd828d2 --- /dev/null +++ b/research/order-seventeen-clifford/VERIFY.json @@ -0,0 +1,59 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "-W", + "error", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Exact complete order-17 matrix certificate, signed Pauli action, Bell rank eight, seven hypothesis controls and retained source digests." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "-W", + "error", + "-O", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Exact complete order-17 matrix certificate, signed Pauli action, Bell rank eight, seven hypothesis controls and retained source digests. Optimized Python control." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "-W", + "error", + "{package}/independent.py" + ], + "timeout_seconds": 120, + "checks": "Independent unreduced Gaussian integer order-17 certificate and signed Pauli/Bell block check; no primary checker imports." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "-W", + "error", + "-O", + "{package}/independent.py" + ], + "timeout_seconds": 120, + "checks": "Independent unreduced Gaussian integer order-17 certificate and signed Pauli/Bell block check; no primary checker imports. Optimized Python control." + } + ] +} diff --git a/research/order-seventeen-clifford/independent.py b/research/order-seventeen-clifford/independent.py new file mode 100644 index 0000000000..8070c24021 --- /dev/null +++ b/research/order-seventeen-clifford/independent.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 +"""Separately written exact integer audit; no imports from verify.py. + +Prepared by apoursh with substantial OpenAI Codex assistance. Apache-2.0. +Retains Nick Petalas's PR6192 cap/Bell method and Ross Richardson's lineage. +""" +import json + + +def need(ok, why): + if not ok: raise ValueError(why) + + +def add(x,y): return (x[0]+y[0],x[1]+y[1]) +def mul(x,y): return (x[0]*y[0]-x[1]*y[1],x[0]*y[1]+x[1]*y[0]) +def conjugate(x): return x[0],-x[1] + +def mm(a,b): + columns=list(zip(*b)) + return [[(sum(x[0]*y[0]-x[1]*y[1] for x,y in zip(row,col)), + sum(x[0]*y[1]+x[1]*y[0] for x,y in zip(row,col))) + for col in columns] for row in a] + +def adjoint(a):return [[conjugate(x) for x in col] for col in zip(*a)] +def scaled(a,n):return [[(n*x,n*y) for x,y in row] for row in a] +def identity(n):return [[(int(i==j),0) for j in range(n)] for i in range(n)] +def bits(n):return [(n>>j)&1 for j in range(4)] + +def pauli(a,b): + out=[[(0,0) for _ in range(16)] for _ in range(16)] + for y in range(16):out[y^a][y]=((-1)**((y&b).bit_count()),0) + return out + +def f2mm(a,b):return [[sum(x*y for x,y in zip(row,col))%2 for col in zip(*b)] for row in a] +def f2rank(a): + a=[row[:] for row in a];rank=0 + for c in range(len(a[0])): + k=next((i for i in range(rank,len(a)) if a[i][c]),None) + if k is None:continue + a[k],a[rank]=a[rank],a[k] + for i in range(rank+1,len(a)): + if a[i][c]:a[i]=[x^y for x,y in zip(a[i],a[rank])] + rank+=1 + return rank + +A=[[0,0,0,1],[0,0,1,0],[0,1,0,1],[1,0,1,1]] +G=[] +for x in range(16): + q=bits(x);parity=q[0]*q[3]+q[1]*q[2]+q[2]*q[3] + row=[] + for y in range(16): + sign=(-1)**(parity+(x&y).bit_count()) + row.append((sign,0) if q[3] else (0,-sign)) + G.append(row) +I=identity(16);need(mm(G,adjoint(G))==scaled(I,16),'unitarity') +power=I;phi=[[(0,0) for _ in range(16)] for _ in range(16)] +for j in range(17): + for x in range(16): + for y in range(16):phi[x][y]=add(phi[x][y],mul((4**(16-j),0),power[x][y])) + power=mm(power,G) +need(all(v==(0,0) for row in phi for v in row),'Phi17 exact zero') +need(power==scaled(I,4**17),'order17 exact identity') +trace=(sum(G[i][i][0] for i in range(16)),sum(G[i][i][1] for i in range(16))) +need(trace==(-4,0),'trace minus one') +for i in range(4): + actual=mm(mm(G,pauli(1<S) H_D. +N=16;H=[[int(i==j) for j in range(N)] for i in range(N)] +for i in range(4):H[i],H[8+i]=H[8+i],H[i] +C=[[int(i==j) for j in range(N)] for i in range(N)] +for i in range(4):C[4+i][i]=1;C[8+i][12+i]=1 +T=f2mm(C,H);Ti=f2mm(H,C) +need(f2mm(T,Ti)==[[int(i==j) for j in range(N)]for i in range(N)],'Bell inverse') +S=[[int(i==j) for j in range(N)]for i in range(N)] +for i in range(4): + S[i]=[int(j==8+i) for j in range(N)] + S[8+i]=[int(j==i)^(A[i][j-8] if 8<=j<12 else 0)for j in range(N)] +W=f2mm(f2mm(Ti,S),T) +B=[row[8:] for row in W[:8]] +expected=[[int(i==j) for j in range(4)]+[A[i][j]^int(i==j)for j in range(4)] for i in range(4)] +expected += [[int(i==j)for j in range(4)]*2 for i in range(4)] +need(B==expected and f2rank(B)==8,'full native B rank') +need(f2rank([[S[i][j]^int(i==j) for j in range(16)]for i in range(16)])==8,'active defect rank eight') +print(json.dumps({'status':'PASS_INDEPENDENT_ORDER17','unitarity_entries':256,'phi17_entries':256,'order17_entries':256,'pauli_images':8,'trace':'-1','active_symplectic_defect_rank':f2rank([[S[i][j]^int(i==j) for j in range(16)]for i in range(16)]),'Bell_B_rank':f2rank(B),'Bell_B':B},sort_keys=True)) diff --git a/research/order-seventeen-clifford/sources/pr6192-PROOF.md b/research/order-seventeen-clifford/sources/pr6192-PROOF.md new file mode 100644 index 0000000000..cbb01d01ff --- /dev/null +++ b/research/order-seventeen-clifford/sources/pr6192-PROOF.md @@ -0,0 +1,159 @@ +# Odd cyclotomic response gate + +This scoped proof was produced by Nick Petalas. It extends Ross Richardson's +whole-bank cubic trace gate in [PR4081](https://github.com/CrocSwap/integer-mult-bounds/pull/4081). +The cyclotomic extension and the degree-four sharpness example are the new steps. +The predecessor's Pauli character argument is credited below. No historical +priority is claimed for the classical field-degree or Clifford facts. + +## Statement + +Let n>1 be odd. Let U be a unitary Clifford on M qubits, with every matrix +entry in Q(i), and suppose the **actual whole-bank matrix** satisfies + + Phi_n(U)=0. + +Here Phi_n is the nth cyclotomic polynomial. Write S_U for the induced +symplectic matrix on the 2M binary Pauli coordinates. Then: + +1. phi(n)=2^a for some integer 1<=a<=M. Equivalently, n is a squarefree + product of distinct Fermat primes. +2. The characteristic polynomial is Phi_n(X)^(2^(M-a)), and + Tr(U)=mu(n) 2^(M-a). +3. rank_F2(S_U-I)=2a, exactly. In particular, the native off-diagonal + B-block rank is at most min(M,2a). + +The condition on n is necessary. This proof does not assert Clifford +existence for every such n. A Fermat prime means a prime of the form +2^(2^j)+1, including any not presently known. The statement does not assume +that the currently known Fermat primes are the only ones. + +At n=5, the bound B-rank<=4 is attained on four qubits, as constructed below. +Thus the degree-four cap cannot be reduced for all ambient widths. + +## Cyclotomic degree and trace + +For odd n, adjoining i and a primitive nth root gives Q(zeta_(4n)). Indeed, +the orders 4 and n are coprime, so the product of primitive roots of those +orders has order 4n, and its powers recover both factors. Classical +cyclotomic irreducibility therefore gives + + [Q(i,zeta_n):Q(i)] = phi(4n)/2 = phi(n). + +For a proof of the classical irreducibility theorem, see Romyar Sharifi's +[Abstract Algebra, Theorem 6.6.11](https://math.ucla.edu/~sharifi/notes/algebra-ch06.html). +Consequently Phi_n remains irreducible over Q(i). Its roots are distinct. +Since Phi_n(U)=0, the Q(i)[X]-module defined by U is a direct sum of copies +of Q(i)[X]/(Phi_n). Equivalently, its characteristic polynomial is Phi_n^t +for a positive integer t, and + + 2^M = t phi(n). + +Thus phi(n) is a power of two, say 2^a, with a<=M. If +n=product_p p^e_p, then phi(n)=product_p p^(e_p-1)(p-1). Every p is odd. +No e_p can exceed one, and every p-1 must be a power of two. If p=1+2^b +is prime, b is itself a power of two: an odd divisor c>1 of b would factor +(2^(b/c))^c+1. Conversely, a squarefree product of Fermat primes has +power-of-two totient. This proves the stated equivalence. + +Each primitive nth root occurs t times. The sum of the primitive nth roots +is mu(n). One elementary derivation partitions all nth roots by their +exact orders and applies Mobius inversion to their sum. Hence + + Tr(U)=t mu(n)=mu(n) 2^(M-a). + +Squarefreeness makes mu(n) equal to plus or minus one. In particular the +trace is nonzero, and its squared absolute value is 2^(2M-2a). + +## Pauli adjoint trace + +This is the Pauli-character step used in the predecessor's cubic proof. +For completeness, let P_v be Hermitian Pauli representatives, indexed by +v in F2^(2M). Clifford conjugation sends P_v to epsilon(v) P_(S_U v), +where epsilon(v) is plus or minus one. On K=ker(S_U-I), comparing the +conjugation of P_v P_w with the product of the conjugations cancels the +same Pauli multiplication phase. It gives + + epsilon(v+w)=epsilon(v)epsilon(w), v,w in K. + +Thus epsilon restricted to K is a character. Its sum over K is zero if +the character is nontrivial, and 2^dim(K) otherwise. This sum is the trace +of conjugation by U in the Pauli basis. The same linear map on matrices +has trace Tr(U) conjugate(Tr(U)), by its tensor representation U tensor +conjugate(U). The trace computed above is nonzero. Therefore + + 2^dim(K) = 2^(2M-2a), + rank(S_U-I) = 2M-dim(K) = 2a. + +In the physical X/Z coordinates, the off-diagonal B block of S_U is also +a submatrix of S_U-I. Its rank is at most 2a, and its size is M by M. +This proves the native-rank cap without any tensor or support restriction. + +## A sharp degree-four example + +Define H_g=(1+i)[[1,1],[1,-1]]/2, S=diag(1,i), and let C be CNOT with +the first qubit controlling the second. The Gaussian-dyadic Clifford + + U5 = - C (S tensor I) (H_g tensor H_g) + +has matrix + + 1/2 * [ -i -i -i -i ] + [ -i i -i i ] + [ 1 -1 -1 1 ] + [ 1 1 -1 -1 ]. + +Direct matrix multiplication gives U5^5=I and +I+U5+U5^2+U5^3+U5^4=0. Its trace is -1, and its symplectic defect has +rank four. These are complete 4-by-4 identities, checked with integer +Gaussian numerators in verify.py. + +Add two identity spectators. On the four qubits numbered 0,1,2,3, let V +be Bell preparation on pairs (0,2) and (1,3). Apply H_g on 0 and 1, then +CNOT 0->2 and 1->3. Set + + W = V^-1 (U5 tensor I_4) V. + +Conjugation preserves Phi5(W)=0. Its B block is nonsingular. To see this +without relying on a computed rank, write A for the four-dimensional +symplectic coordinate space of the first two qubits, and E for that of +the spectators. Bell preparation sends the standard Z Lagrangian L to +a graph L' of a symplectic isomorphism A->E. In characteristic two this +graph is Lagrangian, has dimension four, and intersects A trivially. +The active symplectic map T of U5 has T-I invertible. For l in L', + + ((T direct_sum I)-I)l = ((T-I) projection_A(l), 0). + +If (T direct_sum I)l also lies in L', the displayed difference lies in +A intersect L', hence is zero. Invertibility of T-I and of +projection_A restricted to L' forces l=0. Thus L' and its image are +transverse. Pulling back by V, L and S_W L are transverse. The map from +input Z coordinates to output X coordinates is therefore invertible, +which is exactly B-rank four. The standalone verifier also checks this +complete 16-by-16 matrix, all eight Pauli generators and every fixed +Pauli sign. + +## Meaning for a proposed response interface + +The n=3 case is Richardson's result. New examples of the necessary bound +are n=5 with defect four, n=15 with defect six, and n=17 with defect eight. +Orders 7,9,25 and 27 cannot satisfy their primitive cyclotomic relation +on any Gaussian-rational qubit bank, even before Cliffordness is imposed. +Those are exclusions of the primitive relation, not exclusions of those +finite orders among Clifford operators. + +For fixed odd n, no family with unbounded native B rank can retain +Phi_n(U)=0 on the whole bank. In terms of a rank r, any such primitive +response needs phi(n)>=2^(r/2). This is an obstruction to a fixed-degree +primitive response identity, not a complete query-price +or caller impossibility theorem. + +Order alone is insufficient: U5 tensor U5 still has order five but +does not satisfy Phi5=0, and its symplectic defect rank is eight. +Arbitrary global phases also do not preserve the premise. Non-Gaussian +coefficient fields, non-Clifford operators, restricted-input quotients, +responses with several cyclotomic factors, and complete changed callers +are outside this theorem. No physical implementation invoice, dirty +restoration, supplier admission, new kappa or complete multiplication +theorem follows. The universal proof is written mathematics, not a +finite extrapolation or a formal-kernel result. diff --git a/research/order-seventeen-clifford/sources/pr6192-README.md b/research/order-seventeen-clifford/sources/pr6192-README.md new file mode 100644 index 0000000000..e695506e8f --- /dev/null +++ b/research/order-seventeen-clifford/sources/pr6192-README.md @@ -0,0 +1,125 @@ +# Odd cyclotomic Clifford response gate + +Scoped written proof with exact finite corroboration, produced by Nick Petalas. +For every odd n>1, an actual Gaussian-rational M-qubit Clifford U satisfying +Phi_n(U)=0 on the whole bank necessarily obeys + +```text +phi(n)=2^a, 1<=a<=M +n is a squarefree product of distinct Fermat primes +Tr(U)=mu(n) 2^(M-a) +rank_F2(S_U-I)=2a +native B-rank <= min(M,2a). +``` + +The degree-four cap is sharp: a complete four-qubit Clifford W satisfies +Phi5(W)=0 and has native B-rank four. Its construction adds two identity +spectators to an explicit two-qubit order-five Clifford and conjugates by +Bell preparation. For fixed odd n, the primitive relation cannot carry +unbounded native rank. This is an interface obstruction, with no new kappa. + +[PROOF.md](PROOF.md) gives the all-parameter argument and the explicit +sharpness construction. The new step extends Ross Richardson's +[PR4081](https://github.com/CrocSwap/integer-mult-bounds/pull/4081) +whole-bank cubic gate to every odd cyclotomic polynomial. His cubic result +and fixed-Pauli character argument retain their credit. Classical cyclotomic +irreducibility, totient arithmetic and Clifford/Bell gates retain their +classical status. Global literature priority is unclaimed. No predecessor +verifier is imported or replayed. + +## Evidence and reproduction + +The standalone standard-library verifier uses exact integer Gaussian +numerators, common positive denominators and binary elimination. It checks: + +- All 2,047 odd n in 3..4095. Totients from explicit coprime enumeration + equal the independently factored formula, and the degree condition equals + the squarefree Fermat-prime condition. Eleven n in this interval pass the + necessary degree test. This is not an existence census. +- The complete two-qubit degree-four matrix and four-qubit sharp example, + including their polynomial identities, unitarity, all Pauli generators, + every fixed-Pauli sign, both ranks and the adjoint trace identity. +- An order-five tensor control with symplectic defect eight that fails + Phi5=0; a wrong global phase; a passing primitive-power control; a + nonunitary companion matrix satisfying Phi5; and four invalid domains. + +Run from the repository root with CPython 3.12: + +```sh +/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -W error -B research/odd-cyclotomic-response/verify.py +/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -W error -O -B research/odd-cyclotomic-response/verify.py +/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/research_package.py --package research/odd-cyclotomic-response +/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/check_research_commit.py --package research/odd-cyclotomic-response --check-source-history --check-modes +``` + +Other installations may substitute their CPython 3.12 path. Expected markers +are `PASS_ODD_CYCLOTOMIC_RESPONSE`, `PASS_REGISTERED_RESEARCH_PACKAGE` and +`PASS_RESEARCH_COMMIT_BYTES`. Each direct check takes less than one second +locally and has a registered 30-second limit. Normal and optimized runs +generate the same six-file SHA256-bound receipt on stdout. No receipt is +hand-written or stored in the package. Direct replay also works in a +read-only Git-free export. + +[SOURCES.json](SOURCES.json) pins the catalogue, selected record and source +proof as historical provenance. They are not executable inputs. The +scientific base is `a5bff3bf133e482541c09eba4e773884bdb2b1b7`, priority +revision 8. The selected source-binding first command passed as metadata +orientation only. The `joint-query-controller` card is explicitly changed +to this algebraic response-interface result; it does not solve the installed +QQ16 caller task. [TASK.json](TASK.json) records the overlap limits and +structured next questions. + +## Limits + +The universal result is the written proof. Finite checks corroborate the +identities and bounded arithmetic, and do not prove the all-n statement. +The necessary condition on n is not a sufficient existence classification. +Order n alone, non-Gaussian coefficient fields, non-Clifford operators, +several cyclotomic factors and restricted-input identities are outside the +theorem. A sparse reader relation of unbounded degree is also outside the +fixed-degree consequence. + +No actual selected caller, physical native program, complete signed invoice, +dirty restoration, ownership, hosting, precision, stock, tape execution or +supplier admission is supplied. No selected scientific replay, Lean or +Docker run was performed. All five selected framework assumptions remain. +Independent human and formal proof-kernel review are unclaimed. No complete +multiplication theorem or selected-frontier change follows. + +## Open next questions + +- Determine which degree-permitted n admit Gaussian-rational Clifford + responses. Begin with a complete primitive order-seventeen example and + its Pauli action; the necessary degree condition alone supplies no such + construction. +- Bound native rank when a fixed product of several odd cyclotomic factors + annihilates U. Begin with the exact multiplicity and trace equations for + Phi3*Phi5; cancellation can make the adjoint trace vanish, so the present + nonzero-character argument does not automatically apply. + +These are follow-on questions. Any favorable physical caller still needs +its complete producer/consumer contract and paid bill before expansion. + +## Verification implementation bounds + +There is no recursion or dynamic code loading. Every matrix has dimension +at most 16, every scalar numerator and denominator is bounded by 2^256, +matrix powers use at most 32 factors, polynomials have at most 33 bounded +integer coefficients, and the factor domain ends at 4095. Pauli loops have +at most 256 labels and eight generators. Every function is below 60 lines. +Explicit invariant failures remain active under optimized Python. + +Power of Ten rule 3 has a managed-runtime deviation at verify.py: Python +allocates integer, tuple and dictionary objects during exact arithmetic. +Fixed dimensions, bit capacities, factor bounds and sequential fixtures +bound live collections. No asynchronous resources or retained output files +exist. Rule 8 uses the standard dataclass decorator for one fixed four-field +immutable record; it loads no external schema or executable input. Rule 9 +uses reduce with the single built-in gcd target over at most 512 integers. +Warning-strict normal and optimized runs plus AST compilation supply the +available Python diagnostics. A static type-checking configuration is not +introduced for this isolated research package. A future larger replay must +reassess these capacities before raising them. + +New work is Apache-2.0. Exact predecessor pins and credit are in +[SOURCES.json](SOURCES.json) and [PROOF.md](PROOF.md). diff --git a/research/order-seventeen-clifford/verify.py b/research/order-seventeen-clifford/verify.py new file mode 100644 index 0000000000..3f5d5f9b59 --- /dev/null +++ b/research/order-seventeen-clifford/verify.py @@ -0,0 +1,311 @@ +#!/usr/bin/env python3 +"""Exact order-seventeen Clifford construction and sharp eight-rank witness. + +Prepared by apoursh with substantial OpenAI Codex assistance. Apache-2.0. +Nick Petalas retains PR6192's rank cap and Bell-conjugation method; +Ross Richardson retains the earlier cubic/Pauli-character lineage. +No predecessor executable code is imported. +""" + +import hashlib +import json +from functools import reduce +from math import gcd, lcm +from pathlib import Path + +PHASES = ((1, 0), (0, 1), (-1, 0), (0, -1)) +A = ((0, 0, 0, 1), (0, 0, 1, 0), (0, 1, 0, 1), (1, 0, 1, 1)) + + +def need(condition, message): + if not condition: + raise ValueError(message) + + +def gmul(x, y): + return x[0] * y[0] - x[1] * y[1], x[0] * y[1] + x[1] * y[0] + + +def canonical(rows, denominator=1): + need(denominator > 0 and rows and all(len(row) == len(rows) for row in rows), + 'positive denominator and square matrix') + common = reduce(gcd, (v for row in rows for entry in row for v in entry), denominator) + return tuple(tuple((x // common, y // common) for x, y in row) for row in rows), denominator // common + + +def identity(size): + return canonical([[(int(i == j), 0) for j in range(size)] for i in range(size)]) + + +def multiply(left, right): + a, da = left + b, db = right + need(len(a) == len(b), 'equal matrix sizes') + columns = tuple(zip(*b, strict=True)) + output = [] + for row in a: + out = [] + for column in columns: + real = imag = 0 + for x, y in zip(row, column, strict=True): + p, q = gmul(x, y) + real += p + imag += q + out.append((real, imag)) + output.append(out) + return canonical(output, da * db) + + +def adjoint(matrix): + rows, denominator = matrix + return canonical([[(x, -y) for x, y in column] for column in zip(*rows, strict=True)], denominator) + + +def scale_phase(matrix, phase): + rows, denominator = matrix + return canonical([[gmul(PHASES[phase % 4], x) for x in row] for row in rows], denominator) + + +def sum_matrices(matrices): + denominator = lcm(*(den for unused, den in matrices)) + size = len(matrices[0][0]) + out = [[(0, 0) for j in range(size)] for i in range(size)] + for rows, den in matrices: + factor = denominator // den + for i, row in enumerate(rows): + for j, (real, imag) in enumerate(row): + x, y = out[i][j] + out[i][j] = x + factor * real, y + factor * imag + return canonical(out, denominator) + + +def is_zero(matrix): + return all(entry == (0, 0) for row in matrix[0] for entry in row) + + +def trace(matrix): + rows, denominator = matrix + return sum(rows[i][i][0] for i in range(len(rows))), sum(rows[i][i][1] for i in range(len(rows))), denominator + + +def powers(matrix, exponent): + output = [identity(len(matrix[0]))] + for unused in range(exponent): + output.append(multiply(matrix, output[-1])) + return output + + +def construct_u(omit_edge=False): + rows = [] + for x in range(16): + bits = [(x >> j) & 1 for j in range(4)] + quadratic = bits[1] * bits[2] + bits[2] * bits[3] + if not omit_edge: + quadratic += bits[0] * bits[3] + rows.append([PHASES[(-1 + bits[3] + 2 * quadratic + 2 * (x & y).bit_count()) % 4] + for y in range(16)]) + return canonical(rows, 4) + + +def pauli(x, z): + rows = [[(0, 0) for unused in range(16)] for unused in range(16)] + for column in range(16): + rows[column ^ x][column] = PHASES[((x & z).bit_count() + 2 * (column & z).bit_count()) % 4] + return canonical(rows) + + +def pauli_action(unitary): + lookup = {} + for x in range(16): + for z in range(16): + positive = pauli(x, z) + lookup[positive] = (x, z, 1) + lookup[scale_phase(positive, 2)] = (x, z, -1) + images = [] + for index in range(8): + operator = pauli(1 << index, 0) if index < 4 else pauli(0, 1 << (index - 4)) + image = multiply(multiply(unitary, operator), adjoint(unitary)) + need(image in lookup, 'complete signed Pauli image') + x, z, sign = lookup[image] + images.append({'x': x, 'z': z, 'sign': sign}) + columns = [item['x'] | item['z'] << 4 for item in images] + symplectic = [sum(((column >> row) & 1) << j for j, column in enumerate(columns)) + for row in range(8)] + return images, symplectic + + +def binary_identity(size): + return [1 << i for i in range(size)] + + +def binary_multiply(left, right): + out = [] + for row in left: + value = 0 + for j, other in enumerate(right): + if row >> j & 1: + value ^= other + out.append(value) + return out + + +def binary_transpose(rows): + return [sum(((row >> j) & 1) << i for i, row in enumerate(rows)) for j in range(len(rows))] + + +def binary_rank(rows, width): + rows = list(rows) + position = 0 + for column in range(width): + pivot = next((i for i in range(position, len(rows)) if rows[i] >> column & 1), None) + if pivot is None: + continue + rows[position], rows[pivot] = rows[pivot], rows[position] + for i in range(len(rows)): + if i != position and rows[i] >> column & 1: + rows[i] ^= rows[position] + position += 1 + return position + + +def binary_inverse(rows): + size = len(rows) + augmented = [row | (1 << (size + i)) for i, row in enumerate(rows)] + for j in range(size): + pivot = next((i for i in range(j, size) if augmented[i] >> j & 1), None) + need(pivot is not None, 'invertible binary matrix') + augmented[j], augmented[pivot] = augmented[pivot], augmented[j] + for i in range(size): + if i != j and augmented[i] >> j & 1: + augmented[i] ^= augmented[j] + result = [row >> size for row in augmented] + need(binary_multiply(rows, result) == binary_identity(size), 'binary inverse residual') + return result + + +def binary_power(rows, exponent): + result = binary_identity(len(rows)) + for unused in range(exponent): + result = binary_multiply(rows, result) + return result + + +def check_symplectic(rows): + half = len(rows) // 2 + form = [1 << (i + half) for i in range(half)] + [1 << i for i in range(half)] + return binary_multiply(binary_multiply(rows, form), binary_transpose(rows)) == form + + +def native_rank(rows): + half = len(rows) // 2 + return binary_rank([row >> half for row in rows[:half]], half) + + +def bell_witness(active): + embedded = binary_identity(16) + coordinates = list(range(4)) + list(range(8, 12)) + for i, row in enumerate(active): + embedded[coordinates[i]] = sum(((row >> j) & 1) << coordinates[j] for j in range(8)) + v = binary_identity(16) + for j in range(4): + v[j], v[j + 8] = v[j + 8], v[j] + for control in range(4): + target = control + 4 + v[target] ^= v[control] + v[control + 8] ^= v[target + 8] + need(check_symplectic(v) and check_symplectic(embedded), 'Bell and embedded symplectic maps') + w = binary_multiply(binary_multiply(binary_inverse(v), embedded), v) + expected_b = [(1 << i) | sum((A[i][j] ^ int(i == j)) << (j + 4) for j in range(4)) + for i in range(4)] + [(1 << i) | (1 << (i + 4)) for i in range(4)] + need([row >> 8 for row in w[:8]] == expected_b, 'Bell B block agrees with closed formula') + need(native_rank(w) == 8 and check_symplectic(w), 'sharp eight-qubit native rank') + need(binary_rank([row ^ (1 << i) for i, row in enumerate(w)], 16) == 8, 'Bell defect rank') + need(binary_power(w, 17) == binary_identity(16), 'Bell symplectic order divides seventeen') + return w, expected_b, native_rank(embedded) + + +def controls(unitary, power_list, symplectic, spectator_rank): + outcomes = [] + wrong_phase = scale_phase(unitary, 1) + wrong_powers = powers(wrong_phase, 17) + need(wrong_powers[17] == scale_phase(identity(16), 1), 'wrong phase has seventeenth power iI') + need(not is_zero(sum_matrices(wrong_powers[:17])), 'wrong phase rejected by Phi17') + outcomes.append('wrong_global_phase_fails_Phi17') + edge_mutant = construct_u(omit_edge=True) + need(multiply(edge_mutant, adjoint(edge_mutant)) == identity(16), 'edge mutant stays unitary') + need(not is_zero(sum_matrices(powers(edge_mutant, 16))), 'omitted CZ edge rejected by Phi17') + outcomes.append('missing_CZ_edge_fails_Phi17') + need(not is_zero(sum_matrices(power_list[:16])), 'truncated polynomial rejected') + outcomes.append('truncated_polynomial_nonzero') + traces = [trace(matrix) for matrix in power_list[:17]] + need(all(imag == 0 and real % den == 0 for real, imag, den in traces), 'integral real traces') + tensor_trace = sum((real // den) ** 2 for real, unused, den in traces) + need(tensor_trace == 272, 'order-seventeen tensor is not primitive: Phi17 trace 272') + outcomes.append('tensor_square_order17_but_not_Phi17_by_trace') + need(spectator_rank == 4, 'identity spectators alone do not attain rank eight') + outcomes.append('spectators_without_Bell_keep_native_rank_four') + asymmetric = list(symplectic) + asymmetric[4] ^= 1 << 5 + need(not check_symplectic(asymmetric), 'asymmetric phase prediction rejected') + outcomes.append('asymmetric_phase_matrix_not_symplectic') + companion = [[(0, 0) for unused in range(16)] for unused in range(16)] + for i in range(15): + companion[i + 1][i] = (1, 0) + for row in companion: + row[15] = (-1, 0) + companion = canonical(companion) + need(is_zero(sum_matrices(powers(companion, 16))), 'companion has correct polynomial') + need(multiply(companion, adjoint(companion)) != identity(16), 'companion is not unitary') + outcomes.append('cyclotomic_companion_fails_unitarity') + return outcomes + + +def source_hashes(package): + pins = json.loads((package / 'SOURCE-PINS.json').read_text()) + need(pins['source_pr'] == 6192 and pins['head'] == '91df334ccd2a4bc9959e311f118ac8aaf967ffc2', + 'expected predecessor identity') + need(len(pins['files']) == 2, 'two retained predecessor documents') + result = {} + for record in pins['files']: + path = Path(record['path']) + need(not path.is_absolute() and '..' not in path.parts, 'relative source path') + digest = hashlib.sha256((package / path).read_bytes()).hexdigest() + need(digest == record['sha256'], 'retained source digest: ' + str(path)) + result[str(path)] = digest + return result + + +def main(): + sources = source_hashes(Path(__file__).resolve().parent) + unitary = construct_u() + need(multiply(unitary, adjoint(unitary)) == identity(16), 'complete exact unitarity') + power_list = powers(unitary, 17) + need(power_list[17] == identity(16), 'actual order seventeen') + need(is_zero(sum_matrices(power_list[:17])), 'actual whole-bank Phi17') + need(trace(unitary) == (-4, 0, 4), 'actual trace minus one') + need(all(matrix[1] == 4 and trace(matrix) == (-4, 0, 4) for matrix in power_list[1:17]), + 'all sixteen primitive powers have denominator four and trace minus one') + images, symplectic = pauli_action(unitary) + expected = [1 << (i + 4) for i in range(4)] + [ + (1 << i) | sum(A[i][j] << (j + 4) for j in range(4)) for i in range(4)] + need(symplectic == expected and all(item['sign'] == 1 for item in images), 'stated signed Pauli action') + need(check_symplectic(symplectic), 'binary symplectic identity') + need(binary_power(symplectic, 17) == binary_identity(8), 'binary order seventeen') + need(binary_rank([row ^ (1 << i) for i, row in enumerate(symplectic)], 8) == 8, + 'active symplectic defect eight') + need(native_rank(symplectic) == 4, 'active native rank four') + w, b, spectator_rank = bell_witness(symplectic) + result = {'schema_version': 1, 'active_qubits': 4, 'matrix_dimension': 16, + 'actual_order': 17, 'Phi17_zero': True, 'trace': '-1', + 'primitive_powers_checked': 16, 'signed_Pauli_images': images, + 'symplectic_rows': symplectic, 'active_defect_rank': 8, 'active_B_rank': 4, + 'Bell_symplectic_rows': w, 'Bell_B_rows': b, 'Bell_B_rank': 8, + 'controls': controls(unitary, power_list, symplectic, spectator_rank), + 'source_sha256': sources, + 'scope': 'finite construction; eight-qubit polynomial identity follows by tensor and conjugation; no physical invoice or new kappa'} + print(json.dumps(result, sort_keys=True)) + print('PASS_ORDER_SEVENTEEN_CLIFFORD') + + +if __name__ == '__main__': + main()