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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions research/clifford-pauli-anchor/BENCHMARK.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
{
"medians": {
"anchor": {
"audit_wall_seconds": 31.100221754000813,
"equality_engine_seconds": 0.32612274498751503,
"process_wall_seconds": 31.162376325000878
},
"cached": {
"audit_wall_seconds": 37.46667832699859,
"equality_engine_seconds": 6.721224512994013,
"process_wall_seconds": 37.53124580500116
},
"packed": {
"audit_wall_seconds": 39.74438383100096,
"equality_engine_seconds": 9.774096749983073,
"process_wall_seconds": 39.808734207999805
}
},
"platform": "Linux-7.2.8-200.fc44.x86_64-x86_64-with-glibc2.43",
"processes": "fresh, sequential; alternating orders; OS caches not flushed; shared host",
"python": "3.12.14 (main, Sep 1 2026, 14:16:52) [Clang 22.1.3 ]",
"rounds": 3,
"samples": [
{
"audit_wall_seconds": 41.48234724699978,
"equality_engine_seconds": 10.138834029015925,
"mode": "packed",
"process_wall_seconds": 41.551688278001166,
"round": 0
},
{
"audit_wall_seconds": 37.985246696000104,
"equality_engine_seconds": 6.860120718009057,
"mode": "cached",
"process_wall_seconds": 38.04833538599996,
"round": 0
},
{
"audit_wall_seconds": 32.14846472099998,
"equality_engine_seconds": 0.32612274498751503,
"mode": "anchor",
"process_wall_seconds": 32.21189399399918,
"round": 0
},
{
"audit_wall_seconds": 31.100221754000813,
"equality_engine_seconds": 0.3309641259984346,
"mode": "anchor",
"process_wall_seconds": 31.162376325000878,
"round": 1
},
{
"audit_wall_seconds": 37.46667832699859,
"equality_engine_seconds": 6.6524566870321,
"mode": "cached",
"process_wall_seconds": 37.53124580500116,
"round": 1
},
{
"audit_wall_seconds": 39.636854862999826,
"equality_engine_seconds": 9.752910248998887,
"mode": "packed",
"process_wall_seconds": 39.700494374999835,
"round": 1
},
{
"audit_wall_seconds": 36.88609559100041,
"equality_engine_seconds": 6.721224512994013,
"mode": "cached",
"process_wall_seconds": 36.94726072999947,
"round": 2
},
{
"audit_wall_seconds": 30.54571194900018,
"equality_engine_seconds": 0.3232460919844016,
"mode": "anchor",
"process_wall_seconds": 30.610115636000046,
"round": 2
},
{
"audit_wall_seconds": 39.74438383100096,
"equality_engine_seconds": 9.774096749983073,
"mode": "packed",
"process_wall_seconds": 39.808734207999805,
"round": 2
}
],
"scope": "Complete retained PR3202 two-provider audit; native generation and full supplier admission excluded",
"semantic_identity": {
"anchor_engine_sha256": "5f57804b7b7c3b1d8d2ceeefc41e199504f4d60c39e84df887fa6b3cd66b8b71",
"call_multiset_sha256": "e39f695f2e4f1ca106fb3479417b795d691b8488dc2b37edd087e0ab8e54811f",
"calls": {
"accepted": 244,
"calls": 253,
"rejected": 9
},
"reference_result_sha256": "e059aa7e91a658e4bbf4d0b15be0bde7e3896c99aefb162e06e1003c1d220eb2",
"source_sha256": {
"research/clifford-state-performance/fast_state.py": "2fe087ba4558bd21ca49945dbedaa4047e4170e8fd4e2280701bb2f0481811b5",
"research/frontier1094-recipes-exact-seed76/clifford.py": "d5e42ddabd141b7bfbd70fe13908f3c3a06aeccebeab90623596bfb1988b97fb",
"research/packed-clifford-gate-tables/adapter.py": "b0d9ad3183416e1c2780e69ea4bea57afba8c20da3979f61a6430731b4a42599",
"research/pr3044-r2-native-slice/README.md": "86af5efaf6dddf337fb80d4e1a5058633ed93d3247f0a00650f43f7b344e3175",
"research/pr3044-r2-native-slice/RESULT.json": "289f8ce423d2fc60489bd0b3a7ee9d7ca68e3e23c93389f31eff4d938157ba7a",
"research/pr3044-r2-native-slice/SOURCES.json": "77da54e04b3d61cb436503ce8e9a6f7a0e11d0180fcc49d7eace65bb3e01f4f9",
"research/pr3044-r2-native-slice/data/base/CANONICAL-WORD.json.gz": "682e7b76fa51dfbfd7b7962ce1382317c8091f2cf14ae131f6b557de6475a6c0",
"research/pr3044-r2-native-slice/data/base/CLIFFORD-RECIPES.json.gz": "708bf689bf80265991cbe4b5916cf8a60522e74c674eb576c32932903f0c8ad0",
"research/pr3044-r2-native-slice/data/base/LOCAL-PROGRAMS.json.gz": "c57a0999b9d89e90a49096ea0e25817d1986b015726f711c3059a8aa875e5c24",
"research/pr3044-r2-native-slice/data/base/RESIDUAL-ADAPTERS.json.gz": "8faeab9752757c54ee0eef3df700a7c715c49d772d4c5dc545b11b80cecfd6b4",
"research/pr3044-r2-native-slice/data/extra/CANONICAL-WORD.json.gz": "94e9a36aa0068024ccfceae4f6cb166ad33c5d460921e3e8e5df511eca0e6295",
"research/pr3044-r2-native-slice/data/extra/CLIFFORD-RECIPES.json.gz": "bff42748de313838c5dd82772c56a8154750db3e3746d4c792e875c15f38ca08",
"research/pr3044-r2-native-slice/data/extra/LOCAL-PROGRAMS.json.gz": "c57a0999b9d89e90a49096ea0e25817d1986b015726f711c3059a8aa875e5c24",
"research/pr3044-r2-native-slice/data/extra/RESIDUAL-ADAPTERS.json.gz": "da4f5fe1bdd515d29674cd098f6773c34a63061a49dcd1946f393b8f881723dd",
"research/pr3044-r2-native-slice/verify.py": "004a0bc6787cea330f401ab8b3f26bbe72499004e0ecb0ba09234ec6d2ada874",
"research/rank7-shared-restore-fanin/evidence/NATIVE-RECEIPT.json": "3dce85d535c34dd5755b7a7828b9706cd38198aa99e849dc0f166ac4e7ea47df",
"research/rank7-shared-restore-fanin/evidence/SOURCE-MANIFEST.json": "4f52f55eb311319a7e8ac7de7f4e9cc45e36166270db42c21c955c96a2e0639c",
"research/rank7-shared-restore-fanin/evidence/WORD-base.json.gz": "08e7e10e49053b97b7ae8a7e93f085ade519f3d270ed54b9c0c3a19236a4d267",
"research/rank7-shared-restore-fanin/evidence/WORD-extra.json.gz": "9c625893f09e46688fc650e1d65d05a416b504e2dcffe5fefdc4181c6de22479",
"research/two-sided-helper-extraction/vendor/fastnative/vendor/native/new/code/borrow/bw_adapters.py": "c5907050a9a7fa36d4fcba3ad4fe440d1bec2063360c095013891785ba65c3ce",
"research/two-sided-helper-extraction/vendor/fastnative/vendor/native/new/code/borrow/bw_emit.py": "99b59a6fa3feda86785e4225157dcb1a6169d256cec4f5e0acc9cea7a701df76",
"research/two-sided-helper-extraction/vendor/fastnative/vendor/native/new/code/borrow/bw_gauss.py": "0884b14d6d77cde419a3c773ad9b21d0d18de1e6e20e6b6d5add458ed32ba4cb",
"research/two-sided-helper-extraction/vendor/fastnative/vendor/native/new/code/borrow/bw_phases.py": "9d1a620e26715f4c42fd0347ecc14ef5a4a9031867869b64e8bae4d8526a821e",
"research/two-sided-helper-extraction/vendor/fastnative/vendor/native/new/code/borrow/bw_transport.py": "9818e08b819310b40f1441b89be8c4369584a5b3fa5dfe9b86b1df9a7f5d6a76",
"research/two-sided-helper-extraction/vendor/fastnative/vendor/native/new/code/borrow/vendor/clifford/clifford_exact.py": "2982ead07721e83358dc67c6f49c2b4c16a236a6bebdfd72f58221be1f5d0962"
}
},
"speedup_over": {
"cached": {
"audit_wall_seconds": 1.2047077549271423,
"equality_engine_seconds": 20.609493254606704,
"process_wall_seconds": 1.2043768874869367
},
"packed": {
"audit_wall_seconds": 1.2779453518169253,
"equality_engine_seconds": 29.970607386974052,
"process_wall_seconds": 1.277461442376015
}
}
}
34 changes: 34 additions & 0 deletions research/clifford-pauli-anchor/NOTICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Attribution and retained sources

New comparator, integration, controls, benchmark and documentation: Tekalign
(@tekuuu), with substantial OpenAI Codex assistance. Apache-2.0.

`vendor/pr3202/` retains twelve files verbatim from 24kHandsome1201's
PR3202, commit `259043321323717b7e816d6be38ad5e1f0b69b4c`. Its original README,
code attribution, native receipts and source manifest are unchanged. These
files are necessary to replay the current R2 caller and its exact artifacts;
they are not newly generated native evidence. See `SOURCES.json` for every
source path, blob and SHA256 digest. The upstream repository's Apache-2.0
license applies.

Sagar Thakrar (@thakrarsagar), PR1781, supplies the separate packed exact
Clifford kernel and its gate conventions. The default packed oracle remains
unchanged. The comparator criterion (signed Pauli tableau plus one exact
column) is established Clifford algebra, also used by the retained native
producer; its discovery is not claimed here. Credit icekylinx, Jeremy Kothe,
Mason Hale and the original Clifford/native implementation lineage.

ywz65, PR2638, supplies the existing opt-in cached-table packed comparator used
as a stronger benchmark baseline. Charles Bethin (@cbethin), PR662, supplies
its table recurrences. The new engine's bounded immutable table implementation
uses the same known binary recurrences, independently coded for this engine.
Ali Romman/#1029 and Tekalign/#2768 are predecessors for sparse exact state
evaluation and current native replay tooling, respectively.

The R2 construction and its audits retain Nick Petalas/#3044, Jeremy Kothe,
Marius-Paul Dumitrean/#2979, Hiroki Kumazaki/#3146, Cinna Davis and the full
geometry, extraction, ownership and native lineage listed in the retained
README. This package does not assume independent approval of those sources.

Substantial AI assistance was used for algebra, implementation, testing and
writing. No independent human or proof-assistant review is claimed.
153 changes: 153 additions & 0 deletions research/clifford-pauli-anchor/PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# Exact Clifford equality from signed Pauli action and one anchor

The complete criterion below is established Clifford algebra, already used by
the retained native producer's tableau and zero-column check. This package
does not claim its discovery. It implements the criterion separately for
Sagar Thakrar's PR1781 gate grammar, then substitutes that comparator into
24kHandsome1201's source-bound PR3202 audit. The intended contribution is
measured verification engineering, with exact coverage preserved.

## Domain and conventions

Basis labels are `x in F_2^n`, bit zero first. The implementation accepts
`1 <= n <= 9`; its current caller uses `n=9`. Gates are chronological:

- `P(G)|x> = |Gx>` for an invertible binary row matrix `G`.
- `X(b)|x> = |x+b>`.
- `D(Q,a)|x> = i^q(x)|x>`, where
`q(x)=sum_j a_j x_j + 2 sum_{j<k} Q_jk x_j x_k (mod 4)`.
Only the strict upper triangle of `Q` is read, exactly as in PR1781.
- `PH(p)=i^p I`.
- `C(v,s)=((1+s i)I+(1-s i)X(v))/2`, with `v != 0` and `s=+1` or `-1`.

The first four gates are unitary. `X(v)` is a Hermitian involution, and the
two eigenvalues of `C(v,s)` are `1` and `s i`; hence it too is unitary.
The validator checks both entire input words, including permutation
invertibility, before comparing them. This excludes unsupported non-Clifford
gates and prevents a mismatch early in a word from hiding a malformed gate.

Write a Pauli as `W(p,x,z)=i^p X(x) Z(z)`, so
`W(p,x,z)|y> = i^(p+2 z dot y)|y+x>`.
Its full phase modulo four is stored. Discarding that phase is unsound.

## Signed conjugation rules

The initial list consists of `X(e_j)` and `Z(e_j)` for every coordinate.
For each gate `A` replace every stored Pauli by `A W A^*`. Chronological
updates therefore produce the generator images under the complete word.

| Gate | Updated `(p,x,z)` |
|---|---|
| `P(G)` | `(p, Gx, G^(-T)z)` |
| `X(b)` | `(p+2 z dot b, x, z)` |
| `PH(k)` | `(p,x,z)` |
| `D(Q,a)` | `(p+q(x), x, z+B x)` |
| `C(v,s)`, if `z dot v=0` | `(p,x,z)` |
| `C(v,s)`, if `z dot v=1` | `(p-s, x+v, z)` |

Phases are reduced modulo four and binary coordinates modulo two. Here `B`
is symmetric with diagonal `a_j mod 2` and off-diagonal entries the strict
upper-triangle coefficients of `Q`, reflected across the diagonal.

For the diagonal gate, direct expansion gives

```
q(y+x)-q(y) = q(x) + 2 (Bx) dot y (mod 4),
```

which proves the stated rule. For `C`, put `T=X(v)`. A Pauli either commutes
or anticommutes with `T`. The commuting case is unchanged. In the other case,
expanding `((1+s i)I+(1-s i)T) W ((1-s i)I+(1+s i)T)/4`
gives `-s i T W`, which is exactly the last row. These derivations determine
the signs; they are not inferred by ignoring global phases in a tableau.

## Why the comparison covers every input

Let `U,V` be two accepted words. Suppose their **signed** images of every
`X(e_j)` and `Z(e_j)` agree. Then `V^* U` commutes with all those generators.
Commuting with all `Z(e_j)` forces its matrix to be diagonal: distinct basis
labels have distinct joint sign eigenvalues. Commuting also with all
`X(e_j)` makes its diagonal entries equal along every edge of the binary
cube. That cube is connected, so `V^* U=lambda I` and `U=lambda V`.

The additional equality `U|0>=V|0>` forces `lambda=1`, since `V|0>` is
nonzero. Thus the signed generator images plus **one exact anchor vector**
are a necessary and sufficient test of operator equality, including global
phase. At nine axes, this covers all 512 input basis columns and every complex
linear combination without constructing those 512 columns individually.

This relies on the validated Clifford gate grammar. It is not a method for
checking arbitrary linear operators from 18 generators and one sample.
Nor is it a polynomial-time implementation claim: the anchor representation
can contain `2^n` amplitudes. The implemented domain is bounded at nine axes.

## Exact anchor arithmetic and table reuse

`anchor` starts with `{0: (1,0)}`. Its state is a sparse Gaussian-integer
numerator vector with common denominator `2^k`, where `k` is the number of
`C` gates already applied. Permutations, translations and fourth-root phases
preserve that denominator. Each `C` applies its literal numerator formula
and increments `k`; exact zeros are removed. No rounding, floating point,
norm tolerance or projective normalization occurs.

Two anchors are compared after multiplication to the common denominator
`2^max(k,l)`. Python integers do not overflow. Equality tests retain every
nonzero coordinate, including the possibility that coordinate zero itself
vanishes; testing just the scalar amplitude at coordinate zero would not
suffice.

The bounded 64-entry cache contains only immutable gate tables. For a binary
permutation, `Gx=G(x-e_j)+G e_j` at the least set bit `j`. For a quadratic
phase, `q(x)=q(x-e_j)+a_j+2 sum_{k != j} B_jk x_k`. These are the known
binary recurrences used by Charles Bethin/#662 and ywz65/#2638, coded here
for the comparator's gate representation. Keys include dimension and every
operand. Caller-owned lists are frozen before use. No new acceptance-result
or state-vector cache is introduced. The retained audit's own full-circuit
deduplication is unchanged.

## Current-caller integration and limitations

`replay.py` authenticates all 25 source/input files before running any retained
code, copies the captured bytes into a fresh private snapshot, and loads the
unchanged PR3202 verifier with one explicit installation statement immediately
after its kernel initialization. The source anchor must occur exactly once.
The hook substitutes only `same_operator`; all source/event binding, canonical
frame construction, both orientations, the scalar restoration control, recipe
coverage, wrapper chronology and sixteen semantic mutants per provider remain.

Three modes run that identical caller: original packed kernel; the existing
#2638 table-cached packed kernel; and the new comparator. Every mode must
reproduce the entire original result. The benchmark also matches the multiset
of actual circuit pairs and Boolean decisions, with multiplicity. It uses
fresh serial processes and alternates order. Timing has no acceptance threshold.

The nested predecessor result retains its historical kernel hash; the enclosing
receipt separately identifies the actual mode, new engine, transformed verifier
and all captured source hashes. Its inherited `512`-column fields describe
the operator domain covered, not an assertion that the new engine explicitly
simulated 512 input columns. Native generation is outside this retained-artifact
benchmark; the source artifacts are authenticated on every replay.

This does not expand PR3202's scientific coverage, implement a fast recursive
multiplier, certify a supplier, or establish a new kappa. Native operations
outside the slice, physical ownership, complete cleanup, precision/tape and
outer/all-size obligations remain as in the predecessor.

## Executed failure and differential checks

`controls.py` uses the unchanged packed matrix implementation as an oracle
on 96 deterministic circuits (seed 86), dimensions one through four. It checks
`U P = image(P) U` for all generators on every input column: 480 signed Pauli
images and 4,704 matrix-column relations. It separately checks each complete
anchor vector and 480 comparator decisions, including adjoints and faults.
The small-dimensional computations are finite evidence for the implementation;
the preceding argument supplies the all-input implication for valid words.

Two controls expose the respective blind spots. `PH(1)` has identity Pauli
action but a different anchor. A nontrivial diagonal character fixes `|0>`
but changes a signed Pauli image. Its unsigned Pauli labels are unchanged,
so the latter control also detects dropping signs. Invalid gate, singular
matrix and mutable-cache-key controls fail explicitly under optimized Python.

Tekalign (@tekuuu), with substantial OpenAI Codex assistance. Apache-2.0.
No independent human or proof-kernel review is claimed.
Loading