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
51 changes: 51 additions & 0 deletions research/literal-gate-setup-reuse/BENCHMARK.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"first_pair": {
"baseline_cpu_seconds": 282.46999999999997,
"baseline_wall_seconds": 283.3212143800047,
"candidate_cpu_seconds": 207.42000000000002,
"candidate_wall_seconds": 207.92062770601478,
"complete_stdout_equal": true,
"cpu_fraction_saved": 0.2656919318865719,
"profile_included_in_comparison": false,
"samples_per_arm": 1,
"wall_fraction_saved": 0.26613110083898917
},
"packaged_normal_confirmation": {
"baseline_wall_seconds": 283.3212143800047,
"candidate_wall_seconds": 209.92502825299744,
"baseline_cpu_seconds": 282.46999999999997,
"candidate_cpu_seconds": 209.2,
"wall_fraction_saved": 0.25905644336454303,
"cpu_fraction_saved": 0.2593903777392289,
"note": "Same baseline, later self-contained packaged candidate. Not a second independent pair or a median."
},
"setup": {
"binding": {
"original_method_sha256": "ebb92d6870d73dc452faf6d8c3c62710539ffb9bae3a5588dc694fe2693c6509",
"prepared_ast_sha256": "eb4c3f7790c6b262fb0e4167b26be34f358d82498606d1ba9b448716274fe5b8",
"sites": {
"D": 1,
"P": 1,
"mv": 1,
"qvalue": 1
}
},
"cache": {
"currsize": 512,
"hits": 61214,
"maxsize": 512,
"misses": 23983
},
"second_literal": "Original unchanged independent native_verify.state",
"source_head": "a0171b8d2f942cdfc5295307548fe484c570b1ba"
},
"profile_excluded_from_comparison": true,
"execution_order": [
"profile",
"baseline",
"prototype candidate",
"packaged normal",
"packaged optimized",
"sealed optimized"
]
}
16 changes: 16 additions & 0 deletions research/literal-gate-setup-reuse/COVERAGE-GATE.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"stage": "PASS_BEFORE_COMPLETE_CANDIDATE",
"source": "a0171b8d2f942cdfc5295307548fe484c570b1ba",
"retained": "Both PR5818 entry points and orchestration, original full RESULT/CROSS and actual trace, all original controls, all dense/sparse amplitude comparisons and second literal interpreter.",
"changes": "Only the freshly loaded cross dense-literal Op.zero_state receives a hash-bound AST derivation: compute a P/D setup once per gate, replace two per-address pure calls by exact lookups. All amplitude arithmetic, gate order, phases, denominator reductions, return shape and failures remain. Setup uses captured original dense-literal mv/qvalue, never the sparse interpreter or quadratic engine.",
"proof": "For each fixed gate and address x in 0..2^n-1, table[x] is its original pure function value. Induction on the unchanged gate loop gives identical dense vectors and denominator after every gate. Typed complete immutable (width,gate) keys and a bounded process cache preserve this equality under hits, mutation and eviction.",
"finite_gate": {
"cases": 1522,
"amplitudes": 22700,
"full_width_cases": 4,
"normal_optimized": "PASS",
"cache_controls": 20,
"source_bound_ast_sites": 4
},
"limitations": "Fixed source, widths0..9; entry-wise validation and original source/receipts remain mandatory. It changes one literal method execution by exact setup reuse, not the underlying state algorithm or the second interpreter."
}
42 changes: 42 additions & 0 deletions research/literal-gate-setup-reuse/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
New selected-caller integration, format adapter, bounded input cache and checks:
Ali Romman with substantial OpenAI Codex assistance. Apache-2.0.
The same assistant wrote the code and performed the author-side checks.

The exact quadratic engine and its proof are retained from Ali Romman PR 5704,
head daa4d9dbd102d2a3677afc5614c56466bd2cf3a2. Its NOTICE.md remains byte-exact
and credits classical stabilizer simulation, Charles Bethin PR 662 and all
native/compiler predecessors. This package does not claim that engine as new.

The complete selected source is Ali Romman PR 5599, audited source head
09dd0965711ca7eeb169057a420abab1c9052137. Its exact word, receipt, proof and
NOTICE remain inputs. That notice retains Pierre-Loic Doulcet/hexapode,
Joel Pulikkan/GamingPuzzled, DreamingOfClouds, thu-nmrc, Gareth Davidson/bitplane,
David Arias, Cinna Davis, Jacob Alan Sussman, zxv, Cao Yifan and earlier geometry,
BIT and analytic credit. The derived files retain their original module text.

Classical deterministic memoization and exact affine-support enumeration are
not new general algorithms. The new result is their checked integration into
this complete source replay, with every scalar/native/invoice/compiler check,
independent literal-state evidence and whole-replay measurements. No original
source, selected record, native bill or kappa is changed. Archive inclusion,
local replay and hosted CI are separate from independent mathematical review.

Native-channel attribution from its pinned README: Rohan Arun PR 1972 supplied
the scalar/frame channel; Adam Gall PR 1940 supplied the schedule. Josie Elliston
PR 1071 supplied the P104 fixture/decoder, with Ali Romman PR 1125 and the retained
PR 968/717/446/595/620 lineage. icekylinx's frame-sa504 retains the exact compiler;
Ali Romman PR 1862/1931 retains the independent Gaussian interpreter. Native
lowering and physical binding were prepared for Chafik Boukhalfa with OpenAI
Codex assistance. These are predecessor contributions, not work of this adapter.
Source: https://github.com/CrocSwap/integer-mult-bounds/blob/553d26d796fde9871ff2661a49ac7732e945410f/research/p104-native-channel/README.md


Independent Linux qualification
------------------------------
This package retains the exact PR #5757 official export, including the original source notices. Ali Romman supplied the acceleration, integration, original controls and macOS measurements. Chris R / Clear1nsight supplied the new Linux measurements, applicability review, guarded reproduction and recorded-evidence checks, with substantial OpenAI Codex assistance. No subagents or independent human/proof-kernel acceptance are claimed. The retained construction, controller, native, compiler and stabilizer sources keep their original attribution and Apache-2.0 obligations. No new mathematical construction, physical multiplier speedup or kappa gain is claimed.

Single-pass qualification orchestration
--------------------------------------
Chris R / Clear1nsight with substantial OpenAI Codex assistance supplied the process-local observer/handoff, coverage review, controls and paired Linux measurements. Both original PR5757 entry points, their literal interpreters, archived source and expected scientific receipts remain unchanged. The guard.py harness is retained from PR5816. No subagents or independent human/proof-kernel review. Apache-2.0. No kappa or physical multiplier gain.

Literal P/D setup reuse, exact source-bound derivation, controls and Linux measurements: Chris R / Clear1nsight, with substantial OpenAI Codex assistance; no subagents. Apache-2.0. Original PR5818 and nested source notices retained unchanged.
46 changes: 46 additions & 0 deletions research/literal-gate-setup-reuse/PROFILE.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"coverage": "Both original RESULT/CROSS, full actual trace, both literal interpreters and all original controls executed.",
"gate_visits_across_literal_state_circuits": {
"C": 64523,
"D": 47273,
"P": 37924,
"X": 14668,
"phase": 12477
},
"largest_circuit_repeat": 1,
"method": "Whole-function perf_counter timings; nested totals overlap. No per-amplitude profiler.",
"repeated_tableau_calls": 0,
"source_head": "a0171b8d2f942cdfc5295307548fe484c570b1ba",
"tableau_calls": 17651,
"timings": {
"complete_source_replay": {
"calls": 1,
"seconds": 130.806565787
},
"cross_circuit_tableau": {
"calls": 17651,
"seconds": 7.222084413999962
},
"cross_dense_literal": {
"calls": 17651,
"seconds": 117.68412035899925
},
"cross_entry_inclusive": {
"calls": 1,
"seconds": 147.107770699
},
"cross_sparse_literal": {
"calls": 17651,
"seconds": 15.022373065999984
},
"quadratic_support_all_phases": {
"calls": 84083,
"seconds": 9.472371723999984
},
"verify_entry_inclusive": {
"calls": 1,
"seconds": 131.399111236
}
},
"unique_width_circuits": 17651
}
37 changes: 37 additions & 0 deletions research/literal-gate-setup-reuse/PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Exact gate setup reuse inside one literal interpreter

The object is the complete PR #5818 qualification at `a0171b8d2f942cdfc5295307548fe484c570b1ba`, retaining exact PR #5757 `53006fe6031dab5c23d5b7d1cf6a92f411a04a68`. The second sparse literal interpreter and quadratic engine are unchanged and share no new setup cache with the dense literal interpreter.

## What the profile permits

There are 17,651 distinct width/circuit keys among 17,651 actual state inputs: a whole-circuit tableau cache has no hits. Tableau construction takes 7.222 seconds in the profiled run, too little to meet the requested 15% whole-run threshold even if removed. This rejected nomination is preserved in PROFILE.json.

The dense literal state loop takes 117.684 seconds. Its P gates compute the same pure address map for every amplitude; its D gates compute a fixed quadratic phase for every amplitude. The actual corpus visits 37,924 P and 47,273 D gates. Setup reuse is limited to their independently computed scalar tables, not state vectors, accepted results or the other interpreter's data.

## Exactness and complete keys

Fix a valid width `0 <= n <= 9`. For a P gate define `images[x] = original_mv(rows,x)` for every `0 <= x < 2^n`. For a D gate define `phases[x] = original_qvalue(Q,alpha,x,n)` on the same domain. Both functions are the unchanged helpers captured from this dense literal compiler; no quadratic engine or sparse-interpreter result is consulted.

The cache key is the complete typed immutable pair `(n, gate)`, including every matrix row and every phase coefficient. Lists are recursively copied to tuples. Boolean/float aliases, shape changes and unsupported widths reject before lookup. A hit returns the same immutable integer tuple a fresh evaluation would compute. The LRU stores at most 512 tables, each with at most 512 entries; source-key storage is additional. Eviction merely requires recomputation; exceptions are never accepted or cached. Bounds concern this frozen source and declared width/key domain, not arbitrary-size compiler workloads.

## Source-bound method derivation

The complete original `Op.zero_state` text is pinned by SHA256 `ebb92d6870d73dc452faf6d8c3c62710539ffb9bae3a5588dc694fe2693c6509`. The AST transformer requires exactly one P branch, one D branch, one `mv(e[1],x)` and one `qvalue(e[1],e[2],x,self.n)` call. It adds one setup retrieval at the start of each of those branches and replaces only those two scalar calls with indexed lookups. All other statements are retained. The derived AST has SHA256 `eb4c3f7790c6b262fb0e4167b26be34f358d82498606d1ba9b448716274fe5b8`.

For every amplitude address the replacement value equals the original pure function by construction. Therefore the vector after a P gate, including zero entries, is identical; after a D gate every signed Gaussian amplitude and absolute phase is identical. The C/X/global-phase arithmetic, gate chronology and all denominator/divisibility reductions are untouched. Induction over the unchanged circuit loop proves equality of the returned complete dense vector and denominator on this domain. Fresh output allocation is unchanged; no mutable state-vector answer is stored.

The hook applies only when the unchanged cross checker loads `selected_cross_literal_compiler`. The original source execution and original adapter controls execute before that point. The loader and method are restored in `finally`, and exactly one installation plus actual bounded cache hits are required. The second literal interpreter, its tableaux and its own existing implementation are unchanged. These are still two separate arithmetic implementations, although the dense one now reuses its own exact setup.

## Full qualification and failure coverage

The original complete RESULT/CROSS comparisons remain active. They bind all actual state-call counts, all 17,651 inputs, 9,037,312 amplitude entries per literal interpreter, exact denominators and trace SHA256 `73ac04db73d83151efb474925d48298664cc7490d31bdec7a70dcf79b448f481`. Every amplitude comparison still occurs; no sampling, orbit quotient, cached PASS or stored state vector replaces one.

All PR #5818 stage/contamination/exception and source-custody controls are retained. Every positive run also executes original PR #5757 controls: the adapter corpus, complete cache/type/mutation/capacity/eviction checks, three proof-omission controls and explicit optimized width rejection. The new finite setup corpus independently compares the original dense method with its derived method on 1,522 complete state cases and 22,700 amplitude entries, including four width-nine cases. It tests complete keys, changed inputs/phase/width, immutable results, numeric aliases, bounded capacity, eviction, uncached exceptions and the literal-method source pin. Normal and deliberate optimized validation remain separate.

The complete original PR #5818 package is retained as its authenticated official 45-file export. All member hashes, inventory and head are checked before imports; private baseline and scientific source exports are Git-free/read-only and checked after success. An unmerged Git object is not a runtime dependency. No frozen predecessor, source word, scientific receipt or selected metadata is edited.

## Limits and attribution

The PR #5818 single-process source-sharing boundary remains: this is not a second cold source replay. This proof concerns exact verification computations, not native provider legality or a multiplication theorem. The five framework assumptions, conditional kappa and selected record remain unchanged. Same-agent implementation/checking and hosted CI do not constitute independent human or proof-kernel acceptance. Performance is a source/host-bound measurement, not a universal guarantee.

Ali Romman supplied the original dense/sparse interpreters, PR #5704 engine, PR #5757 integration and controls; PR #5816 supplied Linux qualification and the guard; PR #5818 supplied single-pass orchestration. Preserve their full native/controller/compiler/helper/BIT/classical stabilizer notices in the retained bundle and NOTICE. New setup derivation, controls, profiling and validation: Chris R / Clear1nsight with substantial OpenAI Codex assistance, no subagents. Memoization and tabulation are standard techniques. Apache-2.0.
Loading