From 9f7c920501e0dad586f53e1eb66e19ade107f4a8 Mon Sep 17 00:00:00 2001 From: Gareth Davidson Date: Tue, 13 Oct 2026 08:29:05 +0100 Subject: [PATCH 1/2] Tooling: fuse exact dyadic updates in the PR799 independent audit --- research/scalar-fused-dyadic/CLAIM.json | 91 ++++ research/scalar-fused-dyadic/EXPECTED.json | 228 ++++++++++ research/scalar-fused-dyadic/README.md | 170 +++++++ research/scalar-fused-dyadic/SOURCES.json | 29 ++ research/scalar-fused-dyadic/VALIDATION.md | 67 +++ research/scalar-fused-dyadic/adapter.py | 69 +++ research/scalar-fused-dyadic/benchmark.py | 91 ++++ .../evidence/benchmark-python312.json | 279 ++++++++++++ .../evidence/benchmark-python314.json | 279 ++++++++++++ .../evidence/pilot-profile.txt | 24 + .../evidence/pilot-receipts.json | 413 ++++++++++++++++++ research/scalar-fused-dyadic/kernel.py | 59 +++ research/scalar-fused-dyadic/test_kernel.py | 100 +++++ research/scalar-fused-dyadic/verify.py | 242 ++++++++++ 14 files changed, 2141 insertions(+) create mode 100644 research/scalar-fused-dyadic/CLAIM.json create mode 100644 research/scalar-fused-dyadic/EXPECTED.json create mode 100644 research/scalar-fused-dyadic/README.md create mode 100644 research/scalar-fused-dyadic/SOURCES.json create mode 100644 research/scalar-fused-dyadic/VALIDATION.md create mode 100644 research/scalar-fused-dyadic/adapter.py create mode 100644 research/scalar-fused-dyadic/benchmark.py create mode 100644 research/scalar-fused-dyadic/evidence/benchmark-python312.json create mode 100644 research/scalar-fused-dyadic/evidence/benchmark-python314.json create mode 100644 research/scalar-fused-dyadic/evidence/pilot-profile.txt create mode 100644 research/scalar-fused-dyadic/evidence/pilot-receipts.json create mode 100644 research/scalar-fused-dyadic/kernel.py create mode 100644 research/scalar-fused-dyadic/test_kernel.py create mode 100644 research/scalar-fused-dyadic/verify.py diff --git a/research/scalar-fused-dyadic/CLAIM.json b/research/scalar-fused-dyadic/CLAIM.json new file mode 100644 index 0000000000..cb7c27c076 --- /dev/null +++ b/research/scalar-fused-dyadic/CLAIM.json @@ -0,0 +1,91 @@ +{ + "assignment_seed": 93, + "drawn_at_utc": "2026-10-13T07:00:01.830499+00:00", + "claimed_at_utc": "2026-10-13T07:05:26.024948+00:00", + "track": "verification engineering", + "base_commit": "f567884aeb8851b6e794af1184119a3bfbe1e631", + "base_tree": "ef55c5f52efe7a935efabb9de4cc00c8032def1c", + "candidate_selection": "93 modulo 3 = 0", + "candidates": [ + { + "object": "PR799 independent scalar/frame/cone auditor", + "method": "Fuse y+q*x in the dyadic sparse-row loop, retaining Fraction values and every original check", + "chosen": true + }, + { + "object": "Repeated exact transcendental interval arithmetic", + "method": "Integer interval and evaluation reuse", + "chosen": false, + "reason": "PR667/672 already implement these kernels; avoid duplicate work" + }, + { + "object": "Large replay archive validation memory", + "method": "Streaming source admission", + "chosen": false, + "reason": "PR721 already integrated a streaming ZIP/source admission approach" + } + ], + "scope": "Source-pinned opt-in scalar apply adapter. Preserve all native geometry, forward/dual columns, compensation, frame, cone and parent-interface checks. Compare complete reports and mutations; benchmark alternating complete processes on the same fixed word.", + "hypothesis": "A dyadic fused multiply-add needs one Fraction construction/normalization instead of a multiply and an add plus repeated zero construction.", + "expected_deliverable": "Exact kernel, source-bound adapter, full differential checker, arithmetic/adverse controls and raw benchmark samples", + "stopping_rule": "One fused-kernel pilot; retain only if complete audit timing improves without changing any proof-relevant receipt or rejection. No search or mathematical parameter change.", + "expected_finish": "Approximately 90 minutes from claim, final quarter reserved for validation and handoff", + "coordination": "No sprint coordination issue in the previous and current non-PR issue checks; local claim per gist.", + "open_pr_count": 636, + "related_prs": { + "833": { + "title": "Tooling: prune signed-sparse coefficient enumeration with exact stream equivalence", + "head": "fb82f10732f051541f9a9a734fd6e2b13fe49aa1", + "author": "anudeepadi" + }, + "824": { + "title": "Tooling: 1.13x faster exact stage-pair audit with identical receipts", + "head": "2b342526350a3c36936feb7f3f50669fad2770b1", + "author": "navinor" + }, + "778": { + "title": "Tooling: 2.09x faster exact single-intersection Gram replay", + "head": "f015b04c74801fa330f818d178e809c760fb5469", + "author": "merramil" + }, + "752": { + "title": "Tooling: accelerate exact quadratic-affine witness replay", + "head": "3603d8d9184995ae1cc67c0f5e01f02f3a1d634e", + "author": "Curtis-D" + }, + "736": { + "title": "Tooling: skip exact zero row updates in cyclic-inverse replay", + "head": "eccc3b74767848eb6746f39412d57df6c9544b5d", + "author": "thakrarsagar" + }, + "672": { + "title": "Tooling: exact integer exponential intervals with pinned replay evidence", + "head": "7519539e28eaa59f6cb1ebc7a83413ade5521afa", + "author": "steph4n-gh" + }, + "667": { + "title": "[Tooling] Exact integer-Horner logarithm intervals with pinned equivalence tests", + "head": "8d6ffc19ca56af24d8bd525b6c3133842741b766", + "author": "yuj1r0" + } + }, + "status": "validated; awaiting PR submission", + "final_overlap_check": { + "at_utc": "2026-10-13T07:24:56.554307+00:00", + "open_pr_count": 641, + "latest_number": 844 + }, + "result": { + "complete_native_updates_compared": 70765, + "native_columns": 728, + "negative_word_controls": 15, + "arithmetic_cases": 810, + "scalar_prefixes": 10240, + "tests": 9, + "benchmark_rounds_per_interpreter": 5, + "wall_speedup_python312": 1.4960781522533049, + "wall_speedup_python314": 1.4504239677496398, + "kappa": "unchanged" + }, + "validated_at_utc": "2026-10-13T07:28:36.440376+00:00" +} diff --git a/research/scalar-fused-dyadic/EXPECTED.json b/research/scalar-fused-dyadic/EXPECTED.json new file mode 100644 index 0000000000..848db04eef --- /dev/null +++ b/research/scalar-fused-dyadic/EXPECTED.json @@ -0,0 +1,228 @@ +{ + "arithmetic": { + "complete_state_prefixes": 10240, + "fused_cases": 810, + "invalid_gate_controls": 3, + "seed": 93 + }, + "base_commit": "f567884aeb8851b6e794af1184119a3bfbe1e631", + "complete_report": { + "R": 504, + "checked_columns": 728, + "coldends": 72, + "compensation_gates": 6320, + "compressed_sha256": "0841ef246eea89d612342d80ae503eda573626d99b92ce0c3f94225b6e00d3d9", + "content_sha256": "1e1d99ba7aab877d6b573c41f7030ee73de9a52fee51d0a822ddaae71251999f", + "entering": 216, + "h": 9, + "input_file": "FULL-WORD.json.gz", + "local_profile": { + "1": 2548, + "2": 338, + "3": 430, + "4": 194, + "5": 56, + "8": 8 + }, + "lowends": 126, + "parent_center_interface": { + "all_ports_match": true, + "ordered_frame_bases": [ + [ + 256, + 128, + 64, + 34, + 16, + 10, + 4, + 1 + ], + [ + 256, + 128, + 64, + 32, + 16, + 8, + 5, + 3 + ], + [ + 256, + 128, + 64, + 32, + 17, + 9, + 4, + 2 + ], + [ + 256, + 128, + 64, + 36, + 20, + 8, + 2, + 1 + ], + [ + 256, + 128, + 66, + 32, + 18, + 8, + 4, + 1 + ], + [ + 256, + 128, + 65, + 33, + 17, + 9, + 5, + 3 + ], + [ + 256, + 128, + 65, + 33, + 16, + 8, + 4, + 2 + ], + [ + 256, + 128, + 68, + 32, + 16, + 12, + 2, + 1 + ] + ], + "ordered_frame_bases_match": true, + "parent_file_sha256": "66d3c3c70983224650643a0a05a21ac6c6959f84d0f4528650601016f5a76844", + "parent_path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CANONICAL-WORD.json.gz", + "source_centers": [ + 92, + 57, + 81, + 11, + 9 + ], + "transport_tau": 43, + "transported_centers": [ + 92, + 57, + 81, + 224, + 11, + 240, + 9, + 256 + ] + }, + "scope": "Exact rational full scalar map in both orientations; all literal native frame chains, center levels, dyadic units, entrance-zero response, wrapper exclusion and final helper row/column cones. No global owner admission or exponent repricing.", + "status": "PASS_INDEPENDENT_EXACT_FORWARD_AND_DUAL_ENDPOINT_FRAMES_ENTRANCES_CONES", + "v": 112, + "width_inventory": { + "4": 80, + "5": 32, + "7": 54, + "8": 122, + "9": 216 + } + }, + "gzip_positive_control": true, + "native_trace": { + "all_actual_updates": 70765, + "all_sources_unchanged": true, + "exact_updated_row_stream_sha256": "f15681c6fe13d5a0d44e2f0a677fa1659c8e37dde1db591be1ea78e82781bf5c" + }, + "negative_controls": { + "bad_center_frame": { + "accepted": false, + "error": "ordered centre frame interface", + "error_type": "RuntimeError" + }, + "duplicate_early_cleanup": { + "accepted": false, + "error": "duplicate early cleanup gate", + "error_type": "RuntimeError" + }, + "foreign_register": { + "accepted": false, + "error": "register out of range", + "error_type": "RuntimeError" + }, + "invalid_parent_ports": { + "accepted": false, + "error": "transported source/target ports", + "error_type": "RuntimeError" + }, + "missing_cleanup": { + "accepted": false, + "error": "all-column endpoint failure (False, [684])", + "error_type": "RuntimeError" + }, + "missing_precondition": { + "accepted": false, + "error": "all-column endpoint failure (False, [161, 162])", + "error_type": "RuntimeError" + }, + "non_dyadic": { + "accepted": false, + "error": "non-dyadic scalar", + "error_type": "RuntimeError" + }, + "non_unit_scale": { + "accepted": false, + "error": "non-unit scale", + "error_type": "RuntimeError" + }, + "self_add": { + "accepted": false, + "error": "self add", + "error_type": "RuntimeError" + }, + "wrong_coefficient": { + "accepted": false, + "error": "pre-wrapper touch of residual helper", + "error_type": "RuntimeError" + }, + "wrong_geometry": { + "accepted": false, + "error": "wrong source geometry", + "error_type": "RuntimeError" + }, + "wrong_paid_profile": { + "accepted": false, + "error": "paid profile mismatch", + "error_type": "RuntimeError" + }, + "wrong_width_inventory": { + "accepted": false, + "error": "width inventory mismatch", + "error_type": "RuntimeError" + }, + "zero_gate_frame": { + "accepted": false, + "error": "frame not monotone (256, (256, 128, 65, 33, 16, 8, 5, 3), ())", + "error_type": "RuntimeError" + }, + "zero_scale": { + "accepted": false, + "error": "zero scale", + "error_type": "RuntimeError" + } + } +} diff --git a/research/scalar-fused-dyadic/README.md b/research/scalar-fused-dyadic/README.md new file mode 100644 index 0000000000..87ff8713a4 --- /dev/null +++ b/research/scalar-fused-dyadic/README.md @@ -0,0 +1,170 @@ +# Fused exact dyadic updates in the PR799 independent auditor + +**Verification tooling; no new κ.** This optional adapter accelerates the +independent scalar/frame/cone audit retained by Jeremy Kothe's #799 X4 supplier. +It computes `y + q*x` with one rational normalization when the denominators +are powers of two. Rows still contain ordinary `fractions.Fraction` values; +the original checks, gate order, compensation construction and comparison +logic run unchanged. Original source files and default commands are untouched. + +Five alternating fresh-process pairs per interpreter measured **1.45–1.50×** +faster complete audits on this Linux host: + +| CPython | Reference wall median | Fused wall median | Ratio | Reference / fused child CPU medians | +|---|---:|---:|---:|---:| +| 3.12.3 | 0.559843 s | 0.374207 s | 1.496× | 0.558649 / 0.374032 s | +| 3.14.4 | 0.501354 s | 0.345660 s | 1.450× | 0.501150 / 0.345456 s | + +Every timed process produces the complete original receipt, excluding only +its elapsed-time field. Timings include imports, source admission, input +reading, parent-interface binding, all original audit phases, output and +serialization. This is one independent audit stage on one fixed word, not a +whole-frontier speedup or a multiplication runtime result. The host was not +isolated and caches were not flushed; timing is descriptive, not a pass gate. + +## Reproduce + +Python 3.11+ and the standard library; offline: + +```sh +python3 -B -I research/scalar-fused-dyadic/verify.py +python3 -B -I research/scalar-fused-dyadic/test_kernel.py +``` + +Expected primary result: + +```text +PASS_FUSED_DYADIC_AUDIT columns=728 complete_receipts=identical controls=15 native_updates=70765 scalar_prefixes=10240 +``` + +The second command runs nine tests, including deliberately faulty optimizer +implementations. To repeat the complete-process benchmark on a POSIX system, +choose an output that does not exist: + +```sh +python3 -B -I research/scalar-fused-dyadic/benchmark.py \ + --rounds 5 --output /tmp/scalar-fused-benchmark.json +``` + +Expected final marker: `PASS_IDENTICAL_COMPLETE_SCALAR_AUDITS`, followed by the +measured ratio. Both arms start a fresh isolated Python process for each run; +their order alternates. CPU time uses child process resource accounting. All +samples, environment, implementation hashes, source pins and the full matched +receipt are retained in [the 3.12 evidence](evidence/benchmark-python312.json) +and [the 3.14 evidence](evidence/benchmark-python314.json). Preliminary +[profile](evidence/pilot-profile.txt) and +[pilot receipts](evidence/pilot-receipts.json) are kept separately; the profiled +run is not treated as a reference timing sample. + +Use the faster auditor directly on a native word: + +```sh +python3 -B -I research/scalar-fused-dyadic/adapter.py \ + --word /path/to/FULL-WORD.json.gz --output /tmp/new-audit.json +``` + +`--engine reference` runs the original audit through the same wrapper. The +adapter checks immutable source pins before loading that audit, then replaces +only its `apply` function in memory. It always enables the original parent +interface check. It accepts changed words for experiments and leaves their +admission to the original checker; the differential suite separately pins its +benchmark input. All public wrapper outputs refuse overwriting an existing +path. `verify.py --write /new/path.json` reconstructs the differential receipt. + +## Why the arithmetic is identical + +Let `q*x = N/D` before reduction, and `y = A/B`. For dyadic inputs D and B +are positive powers of two, so one divides the other. With `L=max(D,B)`, + +```text +y + q*x = (A*(L/B) + N*(L/D)) / L. +``` + +Both divisions are exact integer divisions. Constructing one `Fraction` from +this numerator/denominator gives exactly the same reduced result as the +original multiplication followed by addition. It handles negative values, +unequal denominator scales, reducible products and exact cancellation. A +missing or zero destination requires only `Fraction(N,D)`. If either existing +denominator is not a power of two, the helper falls back to the original +general-rational operations; it never rounds or silently truncates. + +The original eager `Fraction(0)` default is also avoided. The source snapshot, +zero-entry deletion, arbitrary source/target distinction, inverse-transpose +sign and scale reciprocal are preserved. Scalars, scales and row values retain +their original types. The original `self add`, `zero scale` and unknown-gate +guards remain, while every surrounding admission/frame/endpoint/cone guard is +executed directly from the pinned unmodified auditor. + +Thus, by induction over its calls, the auditor sees the same exact rows after +every update. There is no memoized acceptance decision, modular sampling, +floating approximation, skipped gate or shortened input-column domain. + +## Differential and failure coverage + +The full checker reconstructs compensation and evaluates all **728 arbitrary +native input columns in both orientations**, native frames, centre levels, +width inventory, entrance response, residual-wrapper exclusion and final +helper row/column cones. Its parent port and ordered-centre-frame binding is +enabled in both arms. These are scalar macro rows; this package does not +expand the private coefficient microcircuits or add precision claims. + +The differential checker compares every report field except elapsed time, +against both the reference and the retained maintainer receipt. A further +untimed pass compares the exact target row and unchanged source at **all +70,765 actual updates**, with a deterministic row-stream digest. The complete +surrounding native audit still runs during that pass. + +Additional checks include: + +- **810** fused arithmetic cases: cancellation, missing destinations, zero, + unequal binary denominators, very large signed integers and general rationals. +- **10,240** complete state-prefix comparisons over 64 seeded initial states, + 80 gates and both orientations. Seed 93 is fixed for reproducibility. +- **15** full changed-word controls: geometry, non-dyadic/non-unit/zero + coefficients, self-addition, register range, missing work, entrance response, + paid profile, width inventory, parent centre/port binding, duplicate cleanup + and non-monotone frames. Both engines reject with identical type and message. +- **Three** invalid primitive controls and nine focused tests. Two faulty + optimizer implementations are rejected by the complete audit: dropping the + destination term fails entrance response; ignoring dual mode passes forward + then fails the dual endpoint. +- A recompressed input still passes both native audits; only its compressed + provenance digest changes. The underlying payload and mathematical report + remain identical. The inherited immutable parent-file pin is retained. + +[EXPECTED.json](EXPECTED.json) holds the deterministic evidence, and +[VALIDATION.md](VALIDATION.md) records executed environment and packaging checks. +Both implementations/checks in this contribution were prepared by one AI +agent; there is no independent human-review claim. + +## Provenance and limits + +Base: **f567884aeb8851b6e794af1184119a3bfbe1e631**. Selected source #799: +`80e6463157cfc80b85af09e7e2f14748fe2dac60`. The exact auditor, immutable parent +input and maintainer receipt have SHA-256 and Git-blob pins in +[SOURCES.json](SOURCES.json). The #799 word is read from the committed replay +archive, without extraction or executing archive content, and its member and +payload hashes are checked. The archive container hash is recorded separately. + +Credit **icekylinx** for the independent exact auditor (originally prepared +with GPT-6 Astra assistance), **Jeremy Kothe** for retaining it in #799, and +**Chafik Boukhalfa**, **DreamingOfClouds**, **Rohan Arun**, **eumemic** and the +retained construction/compiler/verification lineage. The kernel adapts the +auditor's scalar interface; all source notices remain intact. + +The local [claim](CLAIM.json) records OS assignment seed **93**, three candidates +and overlap. #667/#672 concern transcendental intervals, #707 determinants, +#721 source-archive streaming, #727 owner masks and #824 historical stage-pair +arithmetic. Those kernels differ from this native scalar update loop; none of +their pending implementations is imported. No sprint coordination issue was +available, so the claim is local. + +The selected κ and mathematical construction are unchanged. Whole supplier +reconstruction, phase/wrapper replay, global owner admission, exponent assembly +and full repository or Lean checks are outside this benchmark. Uniform +compiler, realization, hosting, recursive, precision/tape and analytic +assumptions remain inherited. This is exact finite verification tooling, not a +formal proof of the multiplication theorem. + +Prepared for **Gareth Davidson (@bitplane) with substantial OpenAI Codex +assistance**. Apache-2.0. diff --git a/research/scalar-fused-dyadic/SOURCES.json b/research/scalar-fused-dyadic/SOURCES.json new file mode 100644 index 0000000000..5dffd85be4 --- /dev/null +++ b/research/scalar-fused-dyadic/SOURCES.json @@ -0,0 +1,29 @@ +{ + "base_commit": "f567884aeb8851b6e794af1184119a3bfbe1e631", + "pr799_head": "80e6463157cfc80b85af09e7e2f14748fe2dac60", + "files": [ + { + "path": "research/gauge44-frames-x/independent/audit_local.py", + "sha256": "03afcfc9da428b3f6edac81c1fee7f277ab81b64998efae78380b63498dec6cd", + "git_blob": "4744d8783c25bf7bf5076886169077ca3808309a" + }, + { + "path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CANONICAL-WORD.json.gz", + "sha256": "66d3c3c70983224650643a0a05a21ac6c6959f84d0f4528650601016f5a76844", + "git_blob": "a2e5a1ffd454a353bd2d2100bc26259ff5b57af7" + }, + { + "path": "research/community-frontier799-audit/INDEPENDENT-LOCAL.json", + "sha256": "675b89883366531bea5851d271e0ba184e2ab28c3d135c35d30bb30b0ed41c4e", + "git_blob": "0df66d61ad4f133eb4b49c0520ec0f421d382c45" + } + ], + "benchmark_word": { + "archive": "research/community-frontier799-audit/integrated799-replay.tar.gz", + "member": "native/jx/FULL-WORD.json.gz", + "compressed_sha256": "0841ef246eea89d612342d80ae503eda573626d99b92ce0c3f94225b6e00d3d9", + "payload_sha256": "1e1d99ba7aab877d6b573c41f7030ee73de9a52fee51d0a822ddaae71251999f", + "archive_sha256": "70dfdfcf2ff95352c6020ee9dfca6dca9032b33c10daed3f3dc574c014f4e2cb" + }, + "reference_receipt": "research/community-frontier799-audit/INDEPENDENT-LOCAL.json" +} diff --git a/research/scalar-fused-dyadic/VALIDATION.md b/research/scalar-fused-dyadic/VALIDATION.md new file mode 100644 index 0000000000..17605622b6 --- /dev/null +++ b/research/scalar-fused-dyadic/VALIDATION.md @@ -0,0 +1,67 @@ +# Executed validation + +Linux, 2026-10-13. Base `f567884aeb8851b6e794af1184119a3bfbe1e631`. +All performance numbers describe this host and the pinned #799 word. + +| Command/check | Observed result | +|---|---| +| `/usr/bin/python3.12 -B -I -S verify.py` (3.12.3) | Complete deterministic receipt matches; 15 native controls reject identically | +| `/usr/bin/python3.14 -B -I -O verify.py` (3.14.4) | Same receipt and controls with optimization | +| `test_kernel.py`, both environments above | Nine tests pass | +| Every-update comparison | All 70,765 native target-row updates and unchanged sources agree; stream digest is committed | +| Arithmetic differential | 810 fused cases, 10,240 complete randomized state prefixes and three invalid-gate cases agree | +| Complete-process benchmarks | Five alternating pairs per interpreter; all 20 complete receipts match the maintainer receipt except timing | +| Minimal relocated checkout | Optimized Python 3.12 passes using only this package and four consumed source/input files, in a path with spaces | +| Altered differential receipt | Changing the claimed checked-column count fails complete receipt comparison | +| Source/archive packaging | Repacking the tar archive with identical member bytes passes; the word recompression positive control passes in both engines | +| Source corruption | Adding a newline to the pinned auditor is rejected before import | +| Existing output | Preserved; the wrapper rejects reuse | +| Selected-record check | Exact κ, original source inventory and proof supplement pass | +| Python syntax | All new modules parse successfully | + +Source corruption and output preservation are tests in `test_kernel.py`. +The two deliberately faulty optimizer implementations are tested against the +complete audit. Dropping the destination term is rejected by entrance response +before endpoint testing. Ignoring dual mode passes the forward endpoint and +then fails the dual endpoint. An initial test expected the first mutant to +reach the endpoint guard; its expectation was corrected to the actual earlier +rejection. The optimizer itself did not require a correction. + +The minimal-checkout packaging mutations were made only in a disposable copy +and restored between runs. No inherited source file was edited. + +## Measurement details + +The pilot profile executes 70,765 scalar `apply` calls and shows about 90% of +profiled audit time in that function. It is retained as a hotspot diagnostic, +not a timing comparator. Subsequent reference and fused pilot receipts match. +The final measurements use fresh subprocesses with identical `-B -I` flags, +alternating arm order and the exact same compressed word. Neither run arm +skips native checks or parent-interface binding. Complete stdout and receipt +serialization are included in the external wall/CPU measurements. + +The reference/fused wall medians are 0.559843/0.374207 seconds on 3.12.3 and +0.501354/0.345660 seconds on 3.14.4. All samples are retained, including their +full-process and internal-auditor timings. No memory improvement was measured +or claimed. There is no timing pass threshold, cache flushing or CPU isolation. + +The later addition of an untimed every-update differential pass changes only +`verify.py`. The benchmarked `adapter.py` and `kernel.py` are unchanged and +their exact hashes are included in both benchmark receipts. + +## Current state and scope + +At the final queue refresh there were 641 open PRs through #844. Searches +found no matching native scalar fusion package. #824's historical stage-pair +optimization was inspected and remains distinct. The upstream head was still +the exact base above. Only non-PR issue #650 requested Discussions; no sprint +coordination issue was available. Scope and source heads are in CLAIM.json. + +Full `make verify`, supplier cold rebuilding, phase/wrapper replay, global +admission/assembly, Lean and hosted CI were not run or claimed for this opt-in +adapter. Its measured scope is the complete independent native audit only. +The selected frontier and `upstream/` are untouched. Inherited realization and +analytic obligations remain; this is not a full theorem proof. + +Prepared for Gareth Davidson (@bitplane) with substantial OpenAI Codex +assistance. Apache-2.0; no independent human-review claim. diff --git a/research/scalar-fused-dyadic/adapter.py b/research/scalar-fused-dyadic/adapter.py new file mode 100644 index 0000000000..6946f901b8 --- /dev/null +++ b/research/scalar-fused-dyadic/adapter.py @@ -0,0 +1,69 @@ +"""Opt-in fused arithmetic in the pinned complete PR799 independent audit. + +Gareth Davidson (@bitplane), substantial OpenAI Codex assistance; Apache-2.0. +Original checker by icekylinx, retained by Jeremy Kothe; source bytes unchanged. +""" + +import argparse +import hashlib +import importlib.util +import json +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +AUDITOR = "research/gauge44-frames-x/independent/audit_local.py" + + +def require(ok, message): + if not ok: + raise ValueError(message) + + +def load(path, name): + spec = importlib.util.spec_from_file_location(name, path) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def source_pins(root=ROOT): + pins = json.loads((HERE / "SOURCES.json").read_bytes()) + for entry in pins["files"]: + data = (root / entry["path"]).read_bytes() + require(hashlib.sha256(data).hexdigest() == entry["sha256"], + "source pin mismatch: " + entry["path"]) + return pins + + +def auditor(root=ROOT, engine="fused"): + source_pins(root) + module = load(root / AUDITOR, "pinned_independent_auditor") + if engine == "fused": + module.apply = load(HERE / "kernel.py", "fused_scalar_kernel").apply + else: + require(engine == "reference", "unknown engine") + return module + + +def run(word, output, root=ROOT, engine="fused", parent=True): + require(not output.exists(), "output already exists") + # Word admission is deliberately the original auditor's responsibility, + # permitting the differential suite to exercise genuinely changed inputs. + # The benchmark separately binds its exact word before and after each run. + module = auditor(root, engine) + module.run(word, output, root if parent else None) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--engine", choices=("reference", "fused"), default="fused") + parser.add_argument("--root", type=Path, default=ROOT) + parser.add_argument("--word", type=Path, required=True) + parser.add_argument("--output", type=Path, required=True) + args = parser.parse_args() + run(args.word, args.output, args.root.resolve(), args.engine) + + +if __name__ == "__main__": + main() diff --git a/research/scalar-fused-dyadic/benchmark.py b/research/scalar-fused-dyadic/benchmark.py new file mode 100644 index 0000000000..9c15d606f5 --- /dev/null +++ b/research/scalar-fused-dyadic/benchmark.py @@ -0,0 +1,91 @@ +"""Alternating fresh-process full audits; timings are evidence, not gates. + +Gareth Davidson (@bitplane), substantial OpenAI Codex assistance; Apache-2.0. +""" + +import argparse +import hashlib +import importlib.util +import json +import platform +import resource +import statistics +import subprocess +import sys +import tempfile +import time +from pathlib import Path + +HERE = Path(__file__).resolve().parent +spec = importlib.util.spec_from_file_location("differential", HERE / "verify.py") +verification = importlib.util.module_from_spec(spec) +spec.loader.exec_module(verification) +require = verification.require + + +def measure(rounds): + require(rounds >= 1, "at least one round required") + raw = verification.word_bytes() + expected = verification.expected_report() + samples = [] + with tempfile.TemporaryDirectory(prefix="fused scalar benchmark ") as temporary: + directory = Path(temporary) + word = directory / "FULL-WORD.json.gz" + word.write_bytes(raw) + for round_id in range(rounds): + engines = ("reference", "fused") if round_id % 2 == 0 else ("fused", "reference") + for engine in engines: + output = directory / (str(round_id) + "-" + engine + ".json") + # -I and -B are fixed for both arms. Each timed process includes + # imports, source checks, parent binding, every original audit + # phase, receipt serialization and ordinary stdout production. + command = [sys.executable, "-B", "-I", str(HERE / "adapter.py"), + "--engine", engine, "--word", str(word), "--output", str(output)] + before = resource.getrusage(resource.RUSAGE_CHILDREN) + started = time.perf_counter() + child = subprocess.run(command, capture_output=True, text=True) + wall = time.perf_counter() - started + after = resource.getrusage(resource.RUSAGE_CHILDREN) + require(child.returncode == 0, "timed child failed: " + child.stderr) + report = json.loads(output.read_bytes()) + stable = verification.stable(report) + require(verification.canonical(stable) == verification.canonical(expected), "timed receipt differs") + require(word.read_bytes() == raw, "timed input changed") + verification.adapter.source_pins() + sample = {"round": round_id, "engine": engine, "wall_seconds": wall, + "child_cpu_seconds": after.ru_utime+after.ru_stime-before.ru_utime-before.ru_stime, + "auditor_seconds": report["elapsed_seconds"], + "receipt_sha256_without_timing": hashlib.sha256(verification.canonical(stable).encode()).hexdigest()} + samples.append(sample) + print(engine, round_id, format(wall, ".6f"), "s", flush=True) + medians = {engine: {metric: statistics.median(s[metric] for s in samples if s["engine"] == engine) + for metric in ("wall_seconds", "child_cpu_seconds", "auditor_seconds")} + for engine in ("reference", "fused")} + return {"status": "PASS_IDENTICAL_COMPLETE_SCALAR_AUDITS", "rounds": rounds, + "python": sys.version, "executable": sys.executable, "platform": platform.platform(), + "cpu": platform.processor(), "clock": vars(time.get_clock_info("perf_counter")), + "source_pins": verification.adapter.source_pins(), + "implementation_sha256": {p.name: hashlib.sha256(p.read_bytes()).hexdigest() + for p in [HERE / "adapter.py", HERE / "kernel.py"]}, + "method": "alternating fresh processes; same input; no cache flushing or host isolation; timing is not a pass threshold", + "samples": samples, "medians": medians, + "wall_speedup": medians["reference"]["wall_seconds"] / medians["fused"]["wall_seconds"], + "complete_receipt": expected} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--rounds", type=int, default=5) + parser.add_argument("--output", type=Path, required=True) + args = parser.parse_args() + require(not args.output.exists(), "output already exists") + result = measure(args.rounds) + with args.output.open("x") as output: + json.dump(result, output, indent=2, sort_keys=True) + output.write("\n") + print("PASS_IDENTICAL_COMPLETE_SCALAR_AUDITS rounds=" + str(args.rounds) + + " median_wall_speedup=" + format(result["wall_speedup"], ".3f")) + + +if __name__ == "__main__": + main() diff --git a/research/scalar-fused-dyadic/evidence/benchmark-python312.json b/research/scalar-fused-dyadic/evidence/benchmark-python312.json new file mode 100644 index 0000000000..b93a633bf2 --- /dev/null +++ b/research/scalar-fused-dyadic/evidence/benchmark-python312.json @@ -0,0 +1,279 @@ +{ + "clock": { + "adjustable": false, + "implementation": "clock_gettime(CLOCK_MONOTONIC)", + "monotonic": true, + "resolution": 1e-09 + }, + "complete_receipt": { + "R": 504, + "checked_columns": 728, + "coldends": 72, + "compensation_gates": 6320, + "compressed_sha256": "0841ef246eea89d612342d80ae503eda573626d99b92ce0c3f94225b6e00d3d9", + "content_sha256": "1e1d99ba7aab877d6b573c41f7030ee73de9a52fee51d0a822ddaae71251999f", + "entering": 216, + "h": 9, + "input_file": "FULL-WORD.json.gz", + "local_profile": { + "1": 2548, + "2": 338, + "3": 430, + "4": 194, + "5": 56, + "8": 8 + }, + "lowends": 126, + "parent_center_interface": { + "all_ports_match": true, + "ordered_frame_bases": [ + [ + 256, + 128, + 64, + 34, + 16, + 10, + 4, + 1 + ], + [ + 256, + 128, + 64, + 32, + 16, + 8, + 5, + 3 + ], + [ + 256, + 128, + 64, + 32, + 17, + 9, + 4, + 2 + ], + [ + 256, + 128, + 64, + 36, + 20, + 8, + 2, + 1 + ], + [ + 256, + 128, + 66, + 32, + 18, + 8, + 4, + 1 + ], + [ + 256, + 128, + 65, + 33, + 17, + 9, + 5, + 3 + ], + [ + 256, + 128, + 65, + 33, + 16, + 8, + 4, + 2 + ], + [ + 256, + 128, + 68, + 32, + 16, + 12, + 2, + 1 + ] + ], + "ordered_frame_bases_match": true, + "parent_file_sha256": "66d3c3c70983224650643a0a05a21ac6c6959f84d0f4528650601016f5a76844", + "parent_path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CANONICAL-WORD.json.gz", + "source_centers": [ + 92, + 57, + 81, + 11, + 9 + ], + "transport_tau": 43, + "transported_centers": [ + 92, + 57, + 81, + 224, + 11, + 240, + 9, + 256 + ] + }, + "scope": "Exact rational full scalar map in both orientations; all literal native frame chains, center levels, dyadic units, entrance-zero response, wrapper exclusion and final helper row/column cones. No global owner admission or exponent repricing.", + "status": "PASS_INDEPENDENT_EXACT_FORWARD_AND_DUAL_ENDPOINT_FRAMES_ENTRANCES_CONES", + "v": 112, + "width_inventory": { + "4": 80, + "5": 32, + "7": 54, + "8": 122, + "9": 216 + } + }, + "cpu": "", + "executable": "/usr/bin/python3.12", + "implementation_sha256": { + "adapter.py": "85fcb4024a6c100ba1379015c282c661eb36df4c1ea859fd7406553eff7cdc7b", + "kernel.py": "970beb0c41acf63ac1030ecd265d12cb856e45988a73b2efe4abbf8e51a0ef12" + }, + "medians": { + "fused": { + "auditor_seconds": 0.3466216240012727, + "child_cpu_seconds": 0.3740320000000001, + "wall_seconds": 0.374207156997727 + }, + "reference": { + "auditor_seconds": 0.5317445910004608, + "child_cpu_seconds": 0.5586490000000001, + "wall_seconds": 0.5598431520011218 + } + }, + "method": "alternating fresh processes; same input; no cache flushing or host isolation; timing is not a pass threshold", + "platform": "Linux-7.0.0-38-generic-x86_64-with-glibc2.43", + "python": "3.12.3 (main, Jan 22 2026, 20:57:42) [GCC 13.3.0]", + "rounds": 5, + "samples": [ + { + "auditor_seconds": 0.5186579250002978, + "child_cpu_seconds": 0.5449849999999999, + "engine": "reference", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 0, + "wall_seconds": 0.5452299789976678 + }, + { + "auditor_seconds": 0.3498642150007072, + "child_cpu_seconds": 0.37493, + "engine": "fused", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 0, + "wall_seconds": 0.37711415700323414 + }, + { + "auditor_seconds": 0.34559979400000884, + "child_cpu_seconds": 0.37316099999999996, + "engine": "fused", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 1, + "wall_seconds": 0.37334335599734914 + }, + { + "auditor_seconds": 0.5338488300003519, + "child_cpu_seconds": 0.5617160000000001, + "engine": "reference", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 1, + "wall_seconds": 0.5619295079995936 + }, + { + "auditor_seconds": 0.5317445910004608, + "child_cpu_seconds": 0.5586490000000001, + "engine": "reference", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 2, + "wall_seconds": 0.5598431520011218 + }, + { + "auditor_seconds": 0.35199033900062204, + "child_cpu_seconds": 0.3797279999999997, + "engine": "fused", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 2, + "wall_seconds": 0.3799812479992397 + }, + { + "auditor_seconds": 0.34560478999992483, + "child_cpu_seconds": 0.3726760000000001, + "engine": "fused", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 3, + "wall_seconds": 0.3729056980009773 + }, + { + "auditor_seconds": 0.5337039610021748, + "child_cpu_seconds": 0.5613919999999999, + "engine": "reference", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 3, + "wall_seconds": 0.5616103289976309 + }, + { + "auditor_seconds": 0.5216177540023637, + "child_cpu_seconds": 0.5495640000000005, + "engine": "reference", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 4, + "wall_seconds": 0.5497407809998549 + }, + { + "auditor_seconds": 0.3466216240012727, + "child_cpu_seconds": 0.3740320000000001, + "engine": "fused", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 4, + "wall_seconds": 0.374207156997727 + } + ], + "source_pins": { + "base_commit": "f567884aeb8851b6e794af1184119a3bfbe1e631", + "benchmark_word": { + "archive": "research/community-frontier799-audit/integrated799-replay.tar.gz", + "archive_sha256": "70dfdfcf2ff95352c6020ee9dfca6dca9032b33c10daed3f3dc574c014f4e2cb", + "compressed_sha256": "0841ef246eea89d612342d80ae503eda573626d99b92ce0c3f94225b6e00d3d9", + "member": "native/jx/FULL-WORD.json.gz", + "payload_sha256": "1e1d99ba7aab877d6b573c41f7030ee73de9a52fee51d0a822ddaae71251999f" + }, + "files": [ + { + "git_blob": "4744d8783c25bf7bf5076886169077ca3808309a", + "path": "research/gauge44-frames-x/independent/audit_local.py", + "sha256": "03afcfc9da428b3f6edac81c1fee7f277ab81b64998efae78380b63498dec6cd" + }, + { + "git_blob": "a2e5a1ffd454a353bd2d2100bc26259ff5b57af7", + "path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CANONICAL-WORD.json.gz", + "sha256": "66d3c3c70983224650643a0a05a21ac6c6959f84d0f4528650601016f5a76844" + }, + { + "git_blob": "0df66d61ad4f133eb4b49c0520ec0f421d382c45", + "path": "research/community-frontier799-audit/INDEPENDENT-LOCAL.json", + "sha256": "675b89883366531bea5851d271e0ba184e2ab28c3d135c35d30bb30b0ed41c4e" + } + ], + "pr799_head": "80e6463157cfc80b85af09e7e2f14748fe2dac60", + "reference_receipt": "research/community-frontier799-audit/INDEPENDENT-LOCAL.json" + }, + "status": "PASS_IDENTICAL_COMPLETE_SCALAR_AUDITS", + "wall_speedup": 1.4960781522533049 +} diff --git a/research/scalar-fused-dyadic/evidence/benchmark-python314.json b/research/scalar-fused-dyadic/evidence/benchmark-python314.json new file mode 100644 index 0000000000..6782e23014 --- /dev/null +++ b/research/scalar-fused-dyadic/evidence/benchmark-python314.json @@ -0,0 +1,279 @@ +{ + "clock": { + "adjustable": false, + "implementation": "clock_gettime(CLOCK_MONOTONIC)", + "monotonic": true, + "resolution": 1e-09 + }, + "complete_receipt": { + "R": 504, + "checked_columns": 728, + "coldends": 72, + "compensation_gates": 6320, + "compressed_sha256": "0841ef246eea89d612342d80ae503eda573626d99b92ce0c3f94225b6e00d3d9", + "content_sha256": "1e1d99ba7aab877d6b573c41f7030ee73de9a52fee51d0a822ddaae71251999f", + "entering": 216, + "h": 9, + "input_file": "FULL-WORD.json.gz", + "local_profile": { + "1": 2548, + "2": 338, + "3": 430, + "4": 194, + "5": 56, + "8": 8 + }, + "lowends": 126, + "parent_center_interface": { + "all_ports_match": true, + "ordered_frame_bases": [ + [ + 256, + 128, + 64, + 34, + 16, + 10, + 4, + 1 + ], + [ + 256, + 128, + 64, + 32, + 16, + 8, + 5, + 3 + ], + [ + 256, + 128, + 64, + 32, + 17, + 9, + 4, + 2 + ], + [ + 256, + 128, + 64, + 36, + 20, + 8, + 2, + 1 + ], + [ + 256, + 128, + 66, + 32, + 18, + 8, + 4, + 1 + ], + [ + 256, + 128, + 65, + 33, + 17, + 9, + 5, + 3 + ], + [ + 256, + 128, + 65, + 33, + 16, + 8, + 4, + 2 + ], + [ + 256, + 128, + 68, + 32, + 16, + 12, + 2, + 1 + ] + ], + "ordered_frame_bases_match": true, + "parent_file_sha256": "66d3c3c70983224650643a0a05a21ac6c6959f84d0f4528650601016f5a76844", + "parent_path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CANONICAL-WORD.json.gz", + "source_centers": [ + 92, + 57, + 81, + 11, + 9 + ], + "transport_tau": 43, + "transported_centers": [ + 92, + 57, + 81, + 224, + 11, + 240, + 9, + 256 + ] + }, + "scope": "Exact rational full scalar map in both orientations; all literal native frame chains, center levels, dyadic units, entrance-zero response, wrapper exclusion and final helper row/column cones. No global owner admission or exponent repricing.", + "status": "PASS_INDEPENDENT_EXACT_FORWARD_AND_DUAL_ENDPOINT_FRAMES_ENTRANCES_CONES", + "v": 112, + "width_inventory": { + "4": 80, + "5": 32, + "7": 54, + "8": 122, + "9": 216 + } + }, + "cpu": "", + "executable": "/usr/bin/python3.14", + "implementation_sha256": { + "adapter.py": "85fcb4024a6c100ba1379015c282c661eb36df4c1ea859fd7406553eff7cdc7b", + "kernel.py": "970beb0c41acf63ac1030ecd265d12cb856e45988a73b2efe4abbf8e51a0ef12" + }, + "medians": { + "fused": { + "auditor_seconds": 0.3137332410005911, + "child_cpu_seconds": 0.345456000000001, + "wall_seconds": 0.34566025599997374 + }, + "reference": { + "auditor_seconds": 0.46996844000022975, + "child_cpu_seconds": 0.5011499999999995, + "wall_seconds": 0.5013539200008381 + } + }, + "method": "alternating fresh processes; same input; no cache flushing or host isolation; timing is not a pass threshold", + "platform": "Linux-7.0.0-38-generic-x86_64-with-glibc2.43", + "python": "3.14.4 (main, Aug 20 2026, 10:41:58) [GCC 15.2.0]", + "rounds": 5, + "samples": [ + { + "auditor_seconds": 0.4706118169997353, + "child_cpu_seconds": 0.5011499999999995, + "engine": "reference", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 0, + "wall_seconds": 0.5013539200008381 + }, + { + "auditor_seconds": 0.3161939199999324, + "child_cpu_seconds": 0.3477409999999988, + "engine": "fused", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 0, + "wall_seconds": 0.3479240570013644 + }, + { + "auditor_seconds": 0.3137332410005911, + "child_cpu_seconds": 0.3447740000000006, + "engine": "fused", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 1, + "wall_seconds": 0.3449635360011598 + }, + { + "auditor_seconds": 0.46996844000022975, + "child_cpu_seconds": 0.502566, + "engine": "reference", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 1, + "wall_seconds": 0.5027561900024011 + }, + { + "auditor_seconds": 0.4683428950011148, + "child_cpu_seconds": 0.4990099999999994, + "engine": "reference", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 2, + "wall_seconds": 0.4992386379999516 + }, + { + "auditor_seconds": 0.3128992560014012, + "child_cpu_seconds": 0.345456000000001, + "engine": "fused", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 2, + "wall_seconds": 0.34566025599997374 + }, + { + "auditor_seconds": 0.3190756390031311, + "child_cpu_seconds": 0.3501160000000002, + "engine": "fused", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 3, + "wall_seconds": 0.3514321359980386 + }, + { + "auditor_seconds": 0.4665056479971099, + "child_cpu_seconds": 0.49739700000000064, + "engine": "reference", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 3, + "wall_seconds": 0.49767343499843264 + }, + { + "auditor_seconds": 0.48007052799948724, + "child_cpu_seconds": 0.5123339999999996, + "engine": "reference", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 4, + "wall_seconds": 0.5125476619978144 + }, + { + "auditor_seconds": 0.31143419099680614, + "child_cpu_seconds": 0.3432049999999994, + "engine": "fused", + "receipt_sha256_without_timing": "a82421b7eec5060a3ba5bb8ce4344a280aab45cba83774b70d8465b9506c7558", + "round": 4, + "wall_seconds": 0.34336813199843164 + } + ], + "source_pins": { + "base_commit": "f567884aeb8851b6e794af1184119a3bfbe1e631", + "benchmark_word": { + "archive": "research/community-frontier799-audit/integrated799-replay.tar.gz", + "archive_sha256": "70dfdfcf2ff95352c6020ee9dfca6dca9032b33c10daed3f3dc574c014f4e2cb", + "compressed_sha256": "0841ef246eea89d612342d80ae503eda573626d99b92ce0c3f94225b6e00d3d9", + "member": "native/jx/FULL-WORD.json.gz", + "payload_sha256": "1e1d99ba7aab877d6b573c41f7030ee73de9a52fee51d0a822ddaae71251999f" + }, + "files": [ + { + "git_blob": "4744d8783c25bf7bf5076886169077ca3808309a", + "path": "research/gauge44-frames-x/independent/audit_local.py", + "sha256": "03afcfc9da428b3f6edac81c1fee7f277ab81b64998efae78380b63498dec6cd" + }, + { + "git_blob": "a2e5a1ffd454a353bd2d2100bc26259ff5b57af7", + "path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CANONICAL-WORD.json.gz", + "sha256": "66d3c3c70983224650643a0a05a21ac6c6959f84d0f4528650601016f5a76844" + }, + { + "git_blob": "0df66d61ad4f133eb4b49c0520ec0f421d382c45", + "path": "research/community-frontier799-audit/INDEPENDENT-LOCAL.json", + "sha256": "675b89883366531bea5851d271e0ba184e2ab28c3d135c35d30bb30b0ed41c4e" + } + ], + "pr799_head": "80e6463157cfc80b85af09e7e2f14748fe2dac60", + "reference_receipt": "research/community-frontier799-audit/INDEPENDENT-LOCAL.json" + }, + "status": "PASS_IDENTICAL_COMPLETE_SCALAR_AUDITS", + "wall_speedup": 1.4504239677496398 +} diff --git a/research/scalar-fused-dyadic/evidence/pilot-profile.txt b/research/scalar-fused-dyadic/evidence/pilot-profile.txt new file mode 100644 index 0000000000..b84f3a0f99 --- /dev/null +++ b/research/scalar-fused-dyadic/evidence/pilot-profile.txt @@ -0,0 +1,24 @@ +Tue Oct 13 08:05:28 2026 /tmp/math-pass04-pilot/profile.pstats + + 11543098 function calls (11535843 primitive calls) in 1.935 seconds + + Ordered by: cumulative time + List reduced from 561 to 16 due to restriction <16> + + ncalls tottime percall cumtime percall filename:lineno(function) + 22/1 0.000 0.000 1.936 1.936 {built-in method builtins.exec} + 1 0.003 0.003 1.936 1.936 audit_local.py:1() + 1 0.035 0.035 1.923 1.923 audit_local.py:76(run) + 70765 0.417 0.000 1.730 0.000 audit_local.py:33(apply) + 1139982 0.217 0.000 1.009 0.000 fractions.py:613(forward) + 598698 0.196 0.000 0.402 0.000 fractions.py:742(_mul) + 541284 0.164 0.000 0.341 0.000 fractions.py:710(_add) + 1159155 0.215 0.000 0.295 0.000 fractions.py:317(_from_coprime_ints) + 631055 0.153 0.000 0.199 0.000 fractions.py:186(__new__) + 1790271 0.122 0.000 0.122 0.000 {built-in method __new__ of type object at 0xa43b40} + 2047299 0.098 0.000 0.098 0.000 {built-in method math.gcd} + 12779 0.013 0.000 0.071 0.000 audit_local.py:121(climb) + 26292 0.047 0.000 0.070 0.000 audit_local.py:16(basis) + 1144546 0.050 0.000 0.051 0.000 {built-in method builtins.isinstance} + 633464 0.043 0.000 0.043 0.000 {method 'get' of 'dict' objects} + 541287 0.041 0.000 0.041 0.000 fractions.py:969(__bool__) diff --git a/research/scalar-fused-dyadic/evidence/pilot-receipts.json b/research/scalar-fused-dyadic/evidence/pilot-receipts.json new file mode 100644 index 0000000000..de003e42f4 --- /dev/null +++ b/research/scalar-fused-dyadic/evidence/pilot-receipts.json @@ -0,0 +1,413 @@ +{ + "reference-profile": { + "status": "PASS_INDEPENDENT_EXACT_FORWARD_AND_DUAL_ENDPOINT_FRAMES_ENTRANCES_CONES", + "input_file": "FULL-WORD.json.gz", + "content_sha256": "1e1d99ba7aab877d6b573c41f7030ee73de9a52fee51d0a822ddaae71251999f", + "compressed_sha256": "0841ef246eea89d612342d80ae503eda573626d99b92ce0c3f94225b6e00d3d9", + "parent_center_interface": { + "parent_path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CANONICAL-WORD.json.gz", + "parent_file_sha256": "66d3c3c70983224650643a0a05a21ac6c6959f84d0f4528650601016f5a76844", + "transport_tau": 43, + "ordered_frame_bases_match": true, + "all_ports_match": true, + "transported_centers": [ + 92, + 57, + 81, + 224, + 11, + 240, + 9, + 256 + ], + "source_centers": [ + 92, + 57, + 81, + 11, + 9 + ], + "ordered_frame_bases": [ + [ + 256, + 128, + 64, + 34, + 16, + 10, + 4, + 1 + ], + [ + 256, + 128, + 64, + 32, + 16, + 8, + 5, + 3 + ], + [ + 256, + 128, + 64, + 32, + 17, + 9, + 4, + 2 + ], + [ + 256, + 128, + 64, + 36, + 20, + 8, + 2, + 1 + ], + [ + 256, + 128, + 66, + 32, + 18, + 8, + 4, + 1 + ], + [ + 256, + 128, + 65, + 33, + 17, + 9, + 5, + 3 + ], + [ + 256, + 128, + 65, + 33, + 16, + 8, + 4, + 2 + ], + [ + 256, + 128, + 68, + 32, + 16, + 12, + 2, + 1 + ] + ] + }, + "v": 112, + "h": 9, + "R": 504, + "entering": 216, + "lowends": 126, + "coldends": 72, + "compensation_gates": 6320, + "local_profile": { + "1": 2548, + "2": 338, + "3": 430, + "4": 194, + "5": 56, + "8": 8 + }, + "width_inventory": { + "4": 80, + "5": 32, + "7": 54, + "8": 122, + "9": 216 + }, + "checked_columns": 728, + "elapsed_seconds": 1.9225498029991286, + "scope": "Exact rational full scalar map in both orientations; all literal native frame chains, center levels, dyadic units, entrance-zero response, wrapper exclusion and final helper row/column cones. No global owner admission or exponent repricing." + }, + "reference": { + "status": "PASS_INDEPENDENT_EXACT_FORWARD_AND_DUAL_ENDPOINT_FRAMES_ENTRANCES_CONES", + "input_file": "FULL-WORD.json.gz", + "content_sha256": "1e1d99ba7aab877d6b573c41f7030ee73de9a52fee51d0a822ddaae71251999f", + "compressed_sha256": "0841ef246eea89d612342d80ae503eda573626d99b92ce0c3f94225b6e00d3d9", + "parent_center_interface": { + "parent_path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CANONICAL-WORD.json.gz", + "parent_file_sha256": "66d3c3c70983224650643a0a05a21ac6c6959f84d0f4528650601016f5a76844", + "transport_tau": 43, + "ordered_frame_bases_match": true, + "all_ports_match": true, + "transported_centers": [ + 92, + 57, + 81, + 224, + 11, + 240, + 9, + 256 + ], + "source_centers": [ + 92, + 57, + 81, + 11, + 9 + ], + "ordered_frame_bases": [ + [ + 256, + 128, + 64, + 34, + 16, + 10, + 4, + 1 + ], + [ + 256, + 128, + 64, + 32, + 16, + 8, + 5, + 3 + ], + [ + 256, + 128, + 64, + 32, + 17, + 9, + 4, + 2 + ], + [ + 256, + 128, + 64, + 36, + 20, + 8, + 2, + 1 + ], + [ + 256, + 128, + 66, + 32, + 18, + 8, + 4, + 1 + ], + [ + 256, + 128, + 65, + 33, + 17, + 9, + 5, + 3 + ], + [ + 256, + 128, + 65, + 33, + 16, + 8, + 4, + 2 + ], + [ + 256, + 128, + 68, + 32, + 16, + 12, + 2, + 1 + ] + ] + }, + "v": 112, + "h": 9, + "R": 504, + "entering": 216, + "lowends": 126, + "coldends": 72, + "compensation_gates": 6320, + "local_profile": { + "1": 2548, + "2": 338, + "3": 430, + "4": 194, + "5": 56, + "8": 8 + }, + "width_inventory": { + "4": 80, + "5": 32, + "7": 54, + "8": 122, + "9": 216 + }, + "checked_columns": 728, + "elapsed_seconds": 0.5303628119982022, + "scope": "Exact rational full scalar map in both orientations; all literal native frame chains, center levels, dyadic units, entrance-zero response, wrapper exclusion and final helper row/column cones. No global owner admission or exponent repricing." + }, + "fused": { + "status": "PASS_INDEPENDENT_EXACT_FORWARD_AND_DUAL_ENDPOINT_FRAMES_ENTRANCES_CONES", + "input_file": "FULL-WORD.json.gz", + "content_sha256": "1e1d99ba7aab877d6b573c41f7030ee73de9a52fee51d0a822ddaae71251999f", + "compressed_sha256": "0841ef246eea89d612342d80ae503eda573626d99b92ce0c3f94225b6e00d3d9", + "parent_center_interface": { + "parent_path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CANONICAL-WORD.json.gz", + "parent_file_sha256": "66d3c3c70983224650643a0a05a21ac6c6959f84d0f4528650601016f5a76844", + "transport_tau": 43, + "ordered_frame_bases_match": true, + "all_ports_match": true, + "transported_centers": [ + 92, + 57, + 81, + 224, + 11, + 240, + 9, + 256 + ], + "source_centers": [ + 92, + 57, + 81, + 11, + 9 + ], + "ordered_frame_bases": [ + [ + 256, + 128, + 64, + 34, + 16, + 10, + 4, + 1 + ], + [ + 256, + 128, + 64, + 32, + 16, + 8, + 5, + 3 + ], + [ + 256, + 128, + 64, + 32, + 17, + 9, + 4, + 2 + ], + [ + 256, + 128, + 64, + 36, + 20, + 8, + 2, + 1 + ], + [ + 256, + 128, + 66, + 32, + 18, + 8, + 4, + 1 + ], + [ + 256, + 128, + 65, + 33, + 17, + 9, + 5, + 3 + ], + [ + 256, + 128, + 65, + 33, + 16, + 8, + 4, + 2 + ], + [ + 256, + 128, + 68, + 32, + 16, + 12, + 2, + 1 + ] + ] + }, + "v": 112, + "h": 9, + "R": 504, + "entering": 216, + "lowends": 126, + "coldends": 72, + "compensation_gates": 6320, + "local_profile": { + "1": 2548, + "2": 338, + "3": 430, + "4": 194, + "5": 56, + "8": 8 + }, + "width_inventory": { + "4": 80, + "5": 32, + "7": 54, + "8": 122, + "9": 216 + }, + "checked_columns": 728, + "elapsed_seconds": 0.35046513799898094, + "scope": "Exact rational full scalar map in both orientations; all literal native frame chains, center levels, dyadic units, entrance-zero response, wrapper exclusion and final helper row/column cones. No global owner admission or exponent repricing." + } +} diff --git a/research/scalar-fused-dyadic/kernel.py b/research/scalar-fused-dyadic/kernel.py new file mode 100644 index 0000000000..a1ea9fe535 --- /dev/null +++ b/research/scalar-fused-dyadic/kernel.py @@ -0,0 +1,59 @@ +"""Fuse exact dyadic sparse-row multiply-adds without changing row values. + +Gareth Davidson (@bitplane), substantial OpenAI Codex assistance; Apache-2.0. +The scalar interface is icekylinx's independent audit, retained by Jeremy +Kothe's PR799. See README.md and SOURCES.json for exact provenance. +""" + +from fractions import Fraction as F + + +def fused(q, x, y): + """Return y+q*x as Fraction, with one normalization on dyadic inputs. + + None denotes a missing destination entry (zero). Non-dyadic existing + entries use the original rational operations; no domain is silently + rounded or enlarged by the acceleration. + """ + numerator = q.numerator * x.numerator + denominator = q.denominator * x.denominator + if y is None or not y: + return F(numerator, denominator) + dy = y.denominator + if denominator & (denominator - 1) or dy & (dy - 1): + return y + q * x + if dy >= denominator: + numerator = y.numerator + numerator * (dy // denominator) + denominator = dy + else: + numerator += y.numerator * (denominator // dy) + return F(numerator, denominator) + + +def apply(e, rows, dual=False): + """Same add/scale contract and guards as the pinned reference apply().""" + if e[0] == "add": + t, s = e[1:3] + q = F(e[3], e[4]) + if t == s: + raise RuntimeError("self add") + if dual: + t, s, q = s, t, -q + dst = rows[t] + # Snapshot matches the original even if a caller aliases row objects. + for k, x in list(rows[s].items()): + a = fused(q, x, dst.get(k)) + if a: + dst[k] = a + else: + dst.pop(k, None) + elif e[0] == "scale": + t = e[1] + q = F(e[2], e[3]) + if not q: + raise RuntimeError("zero scale") + if dual: + q = 1 / q + rows[t] = {k: q*x for k, x in rows[t].items()} + else: + raise RuntimeError("unknown scalar primitive") diff --git a/research/scalar-fused-dyadic/test_kernel.py b/research/scalar-fused-dyadic/test_kernel.py new file mode 100644 index 0000000000..118204140f --- /dev/null +++ b/research/scalar-fused-dyadic/test_kernel.py @@ -0,0 +1,100 @@ +"""Arithmetic edge cases and faulty-optimizer/full-audit controls. + +Gareth Davidson (@bitplane), substantial OpenAI Codex assistance; Apache-2.0. +""" + +import contextlib +import copy +import importlib.util +import io +import shutil +import tempfile +import unittest +from fractions import Fraction as F +from pathlib import Path + +HERE = Path(__file__).resolve().parent +spec = importlib.util.spec_from_file_location("verification", HERE / "verify.py") +v = importlib.util.module_from_spec(spec) +spec.loader.exec_module(v) + + +class KernelTests(unittest.TestCase): + def test_exact_cancellation_and_normalization(self): + result = v.kernel.fused(F(3, 8), F(4, 16), F(-3, 32)) + self.assertEqual(result, 0) + self.assertEqual((result.numerator, result.denominator), (0, 1)) + self.assertIs(type(result), F) + + def test_general_rational_fallback(self): + self.assertEqual(v.kernel.fused(F(3, 7), F(2, 3), F(-1, 13)), F(19, 91)) + self.assertEqual(v.kernel.fused(F(3, 7), F(2, 3), None), F(2, 7)) + + def test_large_denominator_alignment_both_directions(self): + for q, x, y in [(F(2**190+1, 2**210), F(-3, 2**75), F(7, 8)), + (F(5, 2), F(17, 4), F(-11, 2**340))]: + self.assertEqual(v.kernel.fused(q, x, y), y + q*x) + + def test_snapshot_preserves_aliased_row_behavior(self): + row = {0: F(1), 1: F(1, 2)} + initial = [row, row] + reference, fused = copy.deepcopy(initial), copy.deepcopy(initial) + v.adapter.auditor(engine="reference").apply(["add", 0, 1, -1, 1], reference) + v.kernel.apply(["add", 0, 1, -1, 1], fused) + self.assertEqual(reference, fused) + self.assertEqual(fused, [{}, {}]) + + def test_dual_scale_is_reciprocal(self): + rows = [{0: F(3)}] + v.kernel.apply(["scale", 0, -1, 8], rows, True) + self.assertEqual(rows, [{0: F(-24)}]) + + def run_fault(self, change, error="all-column endpoint failure"): + with tempfile.TemporaryDirectory() as temporary: + directory = Path(temporary) + word = directory / "FULL-WORD.json.gz" + word.write_bytes(v.word_bytes()) + module = v.adapter.auditor(engine="fused") + change(module) + output = directory / "bad.json" + log = io.StringIO() + with contextlib.redirect_stdout(log): + with self.assertRaisesRegex(RuntimeError, error): + module.run(word, output, v.ROOT) + self.assertFalse(output.exists()) + return log.getvalue() + + def test_dropping_destination_detected_by_full_audit(self): + def bad(module): + module.apply.__globals__["fused"] = lambda q, x, y: q*x + self.run_fault(bad, "nonzero entrance response") + + def test_missing_dual_detected_after_forward_success(self): + def bad(module): + correct = module.apply + module.apply = lambda e, rows, dual=False: correct(e, rows, False) + self.assertIn("endpoint forward PASS", self.run_fault(bad)) + + def test_source_guard_rejects_changed_auditor(self): + with tempfile.TemporaryDirectory() as temporary: + root = Path(temporary) + for item in v.adapter.source_pins()["files"]: + dest = root / item["path"] + dest.parent.mkdir(parents=True, exist_ok=True) + shutil.copy2(v.ROOT / item["path"], dest) + source = root / v.adapter.AUDITOR + source.write_bytes(source.read_bytes() + b"\n") + with self.assertRaisesRegex(ValueError, "source pin mismatch"): + v.adapter.auditor(root, "fused") + + def test_existing_output_is_preserved(self): + with tempfile.TemporaryDirectory() as temporary: + path = Path(temporary) / "keep.json" + path.write_text("preserve\n") + with self.assertRaisesRegex(ValueError, "output already exists"): + v.adapter.run(Path("unused.gz"), path) + self.assertEqual(path.read_text(), "preserve\n") + + +if __name__ == "__main__": + unittest.main() diff --git a/research/scalar-fused-dyadic/verify.py b/research/scalar-fused-dyadic/verify.py new file mode 100644 index 0000000000..1532c71b29 --- /dev/null +++ b/research/scalar-fused-dyadic/verify.py @@ -0,0 +1,242 @@ +"""Complete reference/fused audit equivalence and deliberate bad inputs. + +Gareth Davidson (@bitplane), substantial OpenAI Codex assistance; Apache-2.0. +""" + +import argparse +import copy +import gzip +import hashlib +import io +import json +import random +import tarfile +import tempfile +from contextlib import redirect_stdout +from fractions import Fraction as F +from pathlib import Path + +import importlib.util + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] + + +def load(name): + spec = importlib.util.spec_from_file_location(name, HERE / (name + ".py")) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +adapter = load("adapter") +kernel = load("kernel") +require = adapter.require + + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(",", ":")) + + +def stable(report): + report = dict(report) + elapsed = report.pop("elapsed_seconds") + require(type(elapsed) in (int, float) and elapsed >= 0, "invalid timing") + return report + + +def word_bytes(root=ROOT): + pins = adapter.source_pins(root) + item = pins["benchmark_word"] + with tarfile.open(root / item["archive"]) as archive: + members = [m for m in archive.getmembers() if m.name == item["member"]] + require(len(members) == 1 and members[0].isfile(), "ambiguous benchmark member") + raw = archive.extractfile(members[0]).read() + require(hashlib.sha256(raw).hexdigest() == item["compressed_sha256"], "immutable word bytes") + require(hashlib.sha256(gzip.decompress(raw)).hexdigest() == item["payload_sha256"], "word payload") + return raw + + +def expected_report(root=ROOT): + pins = adapter.source_pins(root) + return stable(json.loads((root / pins["reference_receipt"]).read_bytes())) + + +def run_case(directory, name, raw, root=ROOT): + folder = directory / name + folder.mkdir() + word = folder / "FULL-WORD.json.gz" + word.write_bytes(raw) + outcomes = [] + for engine in ("reference", "fused"): + out = folder / (engine + ".json") + try: + with redirect_stdout(io.StringIO()): + adapter.run(word, out, root, engine) + except (RuntimeError, ValueError, ZeroDivisionError, IndexError) as exc: + require(not out.exists(), "failed audit left a success receipt") + outcome = {"accepted": False, "error_type": type(exc).__name__, "error": str(exc)} + else: + outcome = {"accepted": True, "report": stable(json.loads(out.read_bytes()))} + outcomes.append(outcome) + require(canonical(outcomes[0]) == canonical(outcomes[1]), "engine disagreement: " + name) + return outcomes[0] + + +def mutations(word): + def changed(name, edit): + w = copy.deepcopy(word) + edit(w) + return name, w + + add_index = next(i for i, e in enumerate(word["A"]) if e[0] == "add") + scale_index = next(i for i, e in enumerate(word["A"]) if e[0] == "scale") + yield changed("wrong_geometry", lambda w: w["report"].__setitem__("v", 111)) + yield changed("non_dyadic", lambda w: w["A"][add_index].__setitem__(4, 3)) + yield changed("zero_scale", lambda w: w["A"][scale_index].__setitem__(2, 0)) + yield changed("non_unit_scale", lambda w: w["A"][scale_index].__setitem__(2, 3)) + yield changed("self_add", lambda w: w["A"][add_index].__setitem__(2, w["A"][add_index][1])) + yield changed("foreign_register", lambda w: w["A"][add_index].__setitem__(2, 100000)) + yield changed("wrong_coefficient", lambda w: w["A"][add_index].__setitem__(3, w["A"][add_index][3]+2)) + yield changed("missing_cleanup", lambda w: w["cleanup"].pop()) + yield changed("missing_precondition", lambda w: w["precondition"].pop()) + yield changed("wrong_paid_profile", lambda w: w["report"]["local_profile"].__setitem__("1", 1)) + yield changed("wrong_width_inventory", lambda w: w["report"]["width_inventory"].__setitem__("9", 1)) + yield changed("bad_center_frame", lambda w: w["center_frames"][0].pop()) + yield changed("duplicate_early_cleanup", lambda w: w["early_cleanup"].append(w["early_cleanup"][0])) + yield changed("zero_gate_frame", lambda w: w["A"][-1].__setitem__(-1, [])) + yield changed("invalid_parent_ports", lambda w: w["ports"].__setitem__(0, w["ports"][1])) + + +def arithmetic_controls(root=ROOT): + reference = adapter.auditor(root, "reference") + rng = random.Random(93) + pairs = 0 + # Dyadic and general rational values include cancellation, zero, missing + # destinations, large signed numerators and unequal denominator scales. + values = [F(0), F(1), F(-1), F(3, 2), F(-7, 32), F(1, 3), F(5, 7), + F(2**129+1, 2**140), F(-(2**90+3), 2**16)] + for q in values: + for x in values: + for y in [None] + values: + require(kernel.fused(q, x, y) == (F(0) if y is None else y) + q*x, + "fused arithmetic mismatch") + pairs += 1 + gates = 0 + for case in range(64): + rows = [{j: rng.choice(values) for j in range(7) if rng.randrange(3)} for _ in range(5)] + for dual in (False, True): + a, b = copy.deepcopy(rows), copy.deepcopy(rows) + for _ in range(80): + t, s = rng.sample(range(5), 2) + if rng.randrange(4): + q = rng.choice(values) + e = ["add", t, s, q.numerator, q.denominator] + else: + q = rng.choice(values[1:]) + e = ["scale", t, q.numerator, q.denominator] + reference.apply(e, a, dual) + kernel.apply(e, b, dual) + require(a == b, "scalar prefix state mismatch") + require(all(type(v) is F for row in b for v in row.values()), "row type changed") + gates += 1 + bad = [["add", 0, 0, 1, 2], ["scale", 0, 0, 1], ["alien", 0]] + for e in bad: + errors = [] + for apply in (reference.apply, kernel.apply): + try: + apply(e, [{0: F(1)}], False) + except RuntimeError as exc: + errors.append(str(exc)) + require(len(errors) == 2 and errors[0] == errors[1], "scalar rejection mismatch") + return {"fused_cases": pairs, "complete_state_prefixes": gates, + "seed": 93, "invalid_gate_controls": len(bad)} + + +def trace_equivalence(directory, raw, root=ROOT): + """Compare the actual target row at every native auditor update. + + Source snapshots also check immutability. No state or gate is sampled. + All other rows are untouched by either source-inspected implementation. + This extra differential pass is outside the timed production adapter. + """ + module = adapter.auditor(root, "reference") + reference_apply = module.apply + calls = 0 + stream = hashlib.sha256() + + def compared(e, rows, dual=False): + nonlocal calls + target = e[2] if dual and e[0] == "add" else e[1] + candidate = list(rows) + candidate[target] = dict(rows[target]) + source = (e[1] if dual else e[2]) if e[0] == "add" else None + source_before = dict(rows[source]) if source is not None else None + reference_apply(e, rows, dual) + kernel.apply(e, candidate, dual) + require(rows[target] == candidate[target], "actual native scalar prefix mismatch") + if source is not None: + require(rows[source] == candidate[source] == source_before, "actual native source changed") + stream.update(canonical([dual, e, [[k, a.numerator, a.denominator] + for k, a in sorted(rows[target].items())]]).encode() + b"\n") + calls += 1 + + module.apply = compared + word = directory / "FULL-WORD.json.gz" + word.write_bytes(raw) + out = directory / "trace.json" + with redirect_stdout(io.StringIO()): + module.run(word, out, root) + require(canonical(stable(json.loads(out.read_bytes()))) == canonical(expected_report(root)), "trace receipt mismatch") + return {"all_actual_updates": calls, "exact_updated_row_stream_sha256": stream.hexdigest(), + "all_sources_unchanged": True} + + +def verify(root=ROOT): + raw = word_bytes(root) + original = expected_report(root) + controls = {} + with tempfile.TemporaryDirectory(prefix="fused scalar checks ") as temporary: + directory = Path(temporary) + first = run_case(directory, "original", raw, root) + require(first["accepted"] and canonical(first["report"]) == canonical(original), "original receipt mismatch") + for name, word in mutations(json.loads(gzip.decompress(raw))): + data = gzip.compress(canonical(word).encode(), mtime=0) + outcome = run_case(directory, name, data, root) + require(not outcome["accepted"], "negative control accepted: " + name) + controls[name] = outcome + # A changed compressed container must still pass the actual auditor. + data = gzip.compress(gzip.decompress(raw), compresslevel=1, mtime=17) + positive = run_case(directory, "recompressed", data, root) + require(positive["accepted"], "gzip packaging rejected") + report = dict(positive["report"]) + report["compressed_sha256"] = original["compressed_sha256"] + require(canonical(report) == canonical(original), "gzip packaging changed semantics") + trace = trace_equivalence(directory, raw, root) + return {"base_commit": adapter.source_pins(root)["base_commit"], + "complete_report": original, "negative_controls": controls, + "arithmetic": arithmetic_controls(root), "native_trace": trace, + "gzip_positive_control": True} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--write", type=Path, help="new receipt path; refuses overwrite") + args = parser.parse_args() + if args.write: + require(not args.write.exists(), "output already exists") + result = verify() + if args.write: + with args.write.open("x") as output: + json.dump(result, output, indent=2, sort_keys=True) + output.write("\n") + else: + require(canonical(result) == canonical(json.loads((HERE / "EXPECTED.json").read_bytes())), "differential receipt mismatch") + print("PASS_FUSED_DYADIC_AUDIT columns=" + str(result["complete_report"]["checked_columns"]) + + " complete_receipts=identical controls=" + str(len(result["negative_controls"])) + + " native_updates=" + str(result["native_trace"]["all_actual_updates"]) + + " scalar_prefixes=" + str(result["arithmetic"]["complete_state_prefixes"])) + + +if __name__ == "__main__": + main() From f61b426397097a1cd8ecb16864674752b5d25809 Mon Sep 17 00:00:00 2001 From: Gareth Davidson Date: Tue, 13 Oct 2026 08:32:04 +0100 Subject: [PATCH 2/2] Record the submitted scalar-audit tooling result --- research/scalar-fused-dyadic/CLAIM.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/research/scalar-fused-dyadic/CLAIM.json b/research/scalar-fused-dyadic/CLAIM.json index cb7c27c076..e25e2fcc64 100644 --- a/research/scalar-fused-dyadic/CLAIM.json +++ b/research/scalar-fused-dyadic/CLAIM.json @@ -69,7 +69,7 @@ "author": "yuj1r0" } }, - "status": "validated; awaiting PR submission", + "status": "submitted", "final_overlap_check": { "at_utc": "2026-10-13T07:24:56.554307+00:00", "open_pr_count": 641, @@ -85,7 +85,9 @@ "benchmark_rounds_per_interpreter": 5, "wall_speedup_python312": 1.4960781522533049, "wall_speedup_python314": 1.4504239677496398, - "kappa": "unchanged" + "kappa": "unchanged", + "pr_url": "https://github.com/CrocSwap/integer-mult-bounds/pull/849" }, - "validated_at_utc": "2026-10-13T07:28:36.440376+00:00" + "validated_at_utc": "2026-10-13T07:28:36.440376+00:00", + "submitted_at_utc": "2026-10-13T07:32:04.292564+00:00" }