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
73 changes: 73 additions & 0 deletions research/cached-dirty-paths/BENCHMARK.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"executable_sha256": {
"SOURCES.json": "c8ac64e892500c3423d1d5733b19e1d793d977704f476f1d10281c5e43ba5951",
"benchmark.py": "a123eaf27a7dec4edda569e832985760dfc3927e6ebfe5996ee83a2eef565fd8",
"check_certificate.py": "ee53974866ba979b9e2ff13bcb44ba63f770351b9f24e5eccb18aaf44d66bfd9",
"replay.py": "af6feb7d42c909f5057c64f9173de30753a253f50f5215bc24145253c7f88a86"
},
"failures": 0,
"input_sha256": {
"research/cyclic-dirty-commutator-audit/echo.py": "63d44c48801f51720a7cc994d6b5e2e857d1aa4fae4c6b83c0cca032b3d9e13b",
"research/universal-dirty-certificates/README.md": "fb8d94a58b6c0448aa893e65f263b9d71639b1aa79cd10f054d0dc740a570dca",
"research/universal-dirty-certificates/SOURCES.json": "5d2c0b2a8921b8dc0f724fa11f93cdfeb764e57cfdfb7fa236ec958d72306899",
"research/universal-dirty-certificates/check_certificate.py": "09cba2605c62f8af0dc48cf60b4eab9f8711cba820e22698d0447833c1a16c37",
"research/universal-dirty-certificates/examples/binary-echo3.certificate.json": "cd088d9d5c0a8378361341c99e25ae5654a6be0b20398c9757a76804df2ab66a",
"research/universal-dirty-certificates/examples/binary-echo3.json": "a5199c1dc6236e346891c641b9402d8065c5bd29087c560e76fcdf2299cdfcf9",
"research/universal-dirty-certificates/examples/dirty-echo3.certificate.json": "21444c604e17d0cbd707ffbecde10edb4bdff0bdc5a3ffb71819be04c3ac58c5",
"research/universal-dirty-certificates/examples/dirty-echo3.json": "862281041cd5616a8785b526d0cee57a50aa7457a8cb64a0abff1133d6d60798",
"research/universal-dirty-certificates/examples/wrong-order.certificate.json": "54850450cc231e4db2a1c4637fc3f7a49dfb694d9c64cfeb8faa8df91d529a79",
"research/universal-dirty-certificates/examples/wrong-order.json": "137def9876c1195456a312b8c232d656ff063cc5caae645be6afc3d06709742c",
"research/universal-dirty-certificates/fields.py": "0829ad6ed3775ba6e3d11cf04cfb3513ac763549b730aaed74958b1238e660d7",
"research/universal-dirty-certificates/linear_words.py": "fe825cf7c886de61bb5ec5a02171c5a392a7bddc185280726f4c359b3f289584",
"research/universal-dirty-certificates/verify.py": "2759a2e7514453012ed0e4ffc7017375dea973925672dc16f127d91790dcb6e5"
},
"load_average_at_end": [
5.4560546875,
4.09814453125,
2.72216796875
],
"logical_cpus": 18,
"median_seconds": {
"baseline": 5.680195042,
"cached": 4.398449334
},
"platform": "macOS-27.0.1-arm64-arm-64bit",
"python": "3.12.15 (main, Oct 14 2026, 00:55:37) [Clang 23.1.3 ]",
"reduction_percent": 22.56517071196725,
"samples_seconds": {
"baseline": [
5.680195042,
5.481301333,
6.071584333,
5.704761833,
5.459807334
],
"cached": [
4.318586542,
4.34075425,
4.426208458,
4.558830625,
4.398449334
]
},
"schema": "complete-dirty-path-benchmark/v1",
"scientific_output": {
"certificate_rejections": 15,
"committed_examples": 3,
"differential_cases": 120,
"echo_identities": 210,
"exponential_support": {
"basis_rows": 65,
"distinct_words": 18446744073709551616,
"states": 130
},
"finite_field_operations": 596,
"gaussian_field_controls": 51,
"input_rejections": 9,
"literal_counterexamples": 180,
"max_echo_basis_rows": 38,
"max_echo_states": 284,
"tensor_of_sum_rejections": 1
},
"successful_complete_replays": 10
}
157 changes: 157 additions & 0 deletions research/cached-dirty-paths/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# Shared-prefix replay for complete dirty-circuit certificates

This contribution was produced by Nick Petalas. Apache-2.0.

Claim type: exact implementation-preservation argument and measured performance
improvement. The complete PR5235 scientific caller runs with a prefix cache
local to each certificate check. No new dirty-circuit theorem, supplier,
selected-frontier update or kappa is claimed. Independent human and formal
proof-kernel review are unclaimed.

## Result and evidence

The implementation replaces repeated rooted path traversal with a trie. Every
requested output role owns a separate root. All certificate predicates and every
initial,
terminal and operator-closure equation remain in place. The source producer,
field arithmetic, fixtures and complete scientific caller are unchanged.

Five alternating runs per side give a **22.57% reduction** in complete replay
wall time, with zero failures and identical scientific output.

| Complete replay | Median seconds | Range seconds |
| --- | ---: | ---: |
| baseline | 5.680195 | 5.459807 to 6.071584 |
| cached | 4.398449 | 4.318587 to 4.558831 |

The timed path includes interpreter startup, authentication of thirteen source
files, imports, the complete scientific replay and its output. Only the two
explicit elapsed-time fields are removed for scientific output comparison.
Every replay retains 210 echo identities, 120 differential circuits,
180 literal counterexamples, 15 certificate rejections, 9 input rejections,
596 finite-field operations, 51 Gaussian controls, three committed examples
and the 130-state, 65-basis-row exponential-support fixture with 2^64 words.
These are predecessor coverage counts, preserved here, not new mathematical results.

An untimed profile found rooted path evaluation used 5.906 of 20.534 instrumented
seconds. Those times identify the changed work and are excluded from performance
samples. Producer elimination and full closure checks remain paid. The machine
has 18 logical CPUs and other research processes may run concurrently. Alternating
the sides limits drift. These are local measurements, not a portable speed ratio.

## Why the checker accepts the same certificates

For ordinary JSON inputs, fix one call, its reconstructed roots and exact
transition function. Define
R(i,empty)=root_i and R(i,wa)=step(R(i,w),a). The old function evaluates this
recursion by a finite loop on each requested word.

The new trie starts with root_i. When a child labelled a is absent, it stores
step(R(i,w),a). Induction on prefix length proves that every stored row equals
the old R(i,w). An existing child therefore returns exactly the old result.
Roots remain keyed by output role, and the trie belongs to one check call.
No reuse crosses problems, fields, shifted interpretations or certificates.

Stored row dictionaries remain unchanged. The retained transition, terminal
and linear-combination functions build new dictionaries, and scalar operations
do not mutate operands. Every request still checks its output index and every
symbol before consulting the cache. A valid cached prefix cannot bypass path
validation. The rest of the checker is byte-for-byte unchanged. `verify.py`
reverses the declared cache-only edit and requires exact equality with the
authenticated predecessor source.

Let P be the sum of requested path lengths, U the number of distinct nonempty
rooted prefixes and R the number of requested roots. The old path evaluator
applies P transitions; the cache applies U. Full closure evaluation is unchanged.
For S dependency states, each sparse row has at most S entries, so extra retained
space is O(S(U+R)). This is a memory tradeoff, not a constant-memory claim.

New controls use two roots with shared symbol sequences over Q, Q(i), F2, F3
and F5, degrees one through eight, and both shifted interpretations. They compare
verdicts and check the exact P-U transition saving. Repeated calls test cache
lifetime. Both implementations reject malformed shared-prefix paths, Boolean or
out-of-range roles, missing initial/closure coverage and wrong source digests.
The complete old and new scientific outputs must agree as well.

## Reproduce

From the repository root, using standard-library CPython 3.12:

```sh
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/research_package.py --package research/cached-dirty-paths
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -W error -B research/cached-dirty-paths/verify.py
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -W error -O -B research/cached-dirty-paths/verify.py
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/check_research_commit.py --package research/cached-dirty-paths --check-source-history
```

Expected result: `PASS_CACHED_DIRTY_PATHS`. Registered checks run both complete
variants and all new controls. Normal execution writes nothing. Any CPython 3.12
executable can replace the absolute interpreter path.

For a fresh ten-run measurement, choose a new path outside the checkout:

```sh
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -W error -B research/cached-dirty-paths/benchmark.py --receipt /absolute/new/external/benchmark.json
```

`BENCHMARK.json` is the retained generated measurement artifact. Replay checks
its executable/input hashes, success count, exact scientific output and derived
medians. A fresh measurement need not reproduce the local wall times. It must
preserve the scientific output. Every live source file is pinned by SHA256 and
Git blob in SOURCES.json and declared in VERIFY.json.

## Scope and implementation constraints

Only this opt-in package changes. The retained PR5235 package stays immutable.
`replay.py --baseline` uses its checker; the default uses the cached copy. The
wrapper authenticates every source file before loading it. The copied checker
keeps its original attribution. No general adoption is made here.

New cache code has no recursion, eviction or global result cache. Traversal is
bounded by word length. The new fixtures have at most sixteen unary calls;
the retained complete caller bounds the shipped replay. The benchmark has ten
child processes with 90-second deadlines and captures bounded complete reports.

Power-of-ten deviations: Python dictionaries and exact arithmetic allocate during
execution. The cache bound above and fixed replay domains constrain live memory;
no fixed-allocation compliance is claimed. The retained independently transcribed
`reconstruct` function is 86 lines and remains byte-identical. Splitting it would
exceed this cache-only change and its exact-delta gate. New functions are below
60 lines. The fixed-module loader is needed to run the unchanged caller and
authenticates its source inventory first. Warning-strict normal and optimized
Python, exact-delta and behavioral checks provide the available diagnostics.
A future larger adapter must price its cache memory explicitly.

No selected supplier replay, native/physical admission, rounded execution,
compiler closure, storage/stock/tape pricing, analytic recovery, Lean, Docker or
independent human review is supplied. The five selected framework assumptions
remain. Faster replay does not improve the selected multiplication bound.

## Open next questions

Can a larger source-bound independent-symbol program retain the benefit within
a stated peak-memory budget? Start by measuring its rooted-prefix count and
sparse-row sizes, then compare the complete producer/checker path. A compatible
real adapter and measured memory budget are blockers. The present cache avoids
no transitions when every requested prefix is distinct.

## Credit and overlap

zxv / [PR5235](https://github.com/CrocSwap/integer-mult-bounds/pull/5235) supplies
the compiler, independent checker, scalar layer, proof, fixtures and explicit
repeated-path performance handoff. Classical weighted-automata equivalence and
noncommutative identity testing retain their Kiefer and Raz-Shpilka credit.
The echo scheduler retains androolloyd, Chafik Boukhalfa / PR628 and Ali Romman /
PR621 credit. Cinna Davis / PR4100 and PR4088, ToikY, Sagar Thakrar, roger-sato,
Charles Bethin and Ross Richardson retain the dirty-phase, tensor and register
attribution in the predecessor README. No predecessor mathematics is claimed
or audited as this contribution.

The cache, preservation argument and measurements were produced by Nick Petalas.
The target was reserved in the [advance CLAIM](https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19294845).
Live PRs, active Discussions, local reservations, recent account work, main README
text and merged object/formula searches were checked. The cached search covered
333 open PRs and 6,046 Discussion records but omitted 8,623 sparse main notes.
Separate Git searches covered relevant main README text. Arbitrary diffs,
unpublished work and later publications remain outside that coverage.
These searches do not establish global novelty.
96 changes: 96 additions & 0 deletions research/cached-dirty-paths/SOURCES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"schema_version": 1,
"base_commit": "2485805a6d47f36ea83ddde6327d453ac82d44dc",
"files": [
{
"path": "certificates/selected-result.json",
"usage": "provenance",
"git_blob": "d59b5035e7b4cbaa9d688a1d32dd0d6eb79c466a",
"sha256": "9b8d0eea95b3bf0dfcb7938a732a6439b87a2685dec2a5ab9e525b3b34debbfa"
},
{
"path": "docs/research/agent-task-catalog.json",
"usage": "provenance",
"git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec",
"sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81"
},
{
"path": "research/cyclic-dirty-commutator-audit/echo.py",
"usage": "input",
"sha256": "63d44c48801f51720a7cc994d6b5e2e857d1aa4fae4c6b83c0cca032b3d9e13b",
"git_blob": "76a31171368eb945815cc00dce931c6c7a88e836"
},
{
"path": "research/universal-dirty-certificates/README.md",
"usage": "input",
"sha256": "fb8d94a58b6c0448aa893e65f263b9d71639b1aa79cd10f054d0dc740a570dca",
"git_blob": "be4e5981e57bdd2aa8d2ba8c36479594cf38b5d2"
},
{
"path": "research/universal-dirty-certificates/SOURCES.json",
"usage": "input",
"sha256": "5d2c0b2a8921b8dc0f724fa11f93cdfeb764e57cfdfb7fa236ec958d72306899",
"git_blob": "78109486a46ebc0f6552d8de4cc09afa5a783535"
},
{
"path": "research/universal-dirty-certificates/check_certificate.py",
"usage": "input",
"sha256": "09cba2605c62f8af0dc48cf60b4eab9f8711cba820e22698d0447833c1a16c37",
"git_blob": "cdb1d3fe14ba929cbe343d181cd08ff56f7f42e9"
},
{
"path": "research/universal-dirty-certificates/examples/binary-echo3.certificate.json",
"usage": "input",
"sha256": "cd088d9d5c0a8378361341c99e25ae5654a6be0b20398c9757a76804df2ab66a",
"git_blob": "34996f4e4234ad769010ba88b108b8141b835e75"
},
{
"path": "research/universal-dirty-certificates/examples/binary-echo3.json",
"usage": "input",
"sha256": "a5199c1dc6236e346891c641b9402d8065c5bd29087c560e76fcdf2299cdfcf9",
"git_blob": "8bb08f646562569d4c48168f9f4459cb57e8a120"
},
{
"path": "research/universal-dirty-certificates/examples/dirty-echo3.certificate.json",
"usage": "input",
"sha256": "21444c604e17d0cbd707ffbecde10edb4bdff0bdc5a3ffb71819be04c3ac58c5",
"git_blob": "f19706f07112e6d6b0b8a5301a6b1284274d5cea"
},
{
"path": "research/universal-dirty-certificates/examples/dirty-echo3.json",
"usage": "input",
"sha256": "862281041cd5616a8785b526d0cee57a50aa7457a8cb64a0abff1133d6d60798",
"git_blob": "13c38bf647c050243f5691d5a61be75ea3e4a4d9"
},
{
"path": "research/universal-dirty-certificates/examples/wrong-order.certificate.json",
"usage": "input",
"sha256": "54850450cc231e4db2a1c4637fc3f7a49dfb694d9c64cfeb8faa8df91d529a79",
"git_blob": "20e3102d5a6e68b6fa19345080d0eeb957977c23"
},
{
"path": "research/universal-dirty-certificates/examples/wrong-order.json",
"usage": "input",
"sha256": "137def9876c1195456a312b8c232d656ff063cc5caae645be6afc3d06709742c",
"git_blob": "85482942f052694a3a6d15d364d18823b51e1b00"
},
{
"path": "research/universal-dirty-certificates/fields.py",
"usage": "input",
"sha256": "0829ad6ed3775ba6e3d11cf04cfb3513ac763549b730aaed74958b1238e660d7",
"git_blob": "f1b6dc83e26bd9fd9ec67ded3fedb330ef89598d"
},
{
"path": "research/universal-dirty-certificates/linear_words.py",
"usage": "input",
"sha256": "fe825cf7c886de61bb5ec5a02171c5a392a7bddc185280726f4c359b3f289584",
"git_blob": "4a877e1ab9a87a0f01eb13e28ddf309c2060bd5e"
},
{
"path": "research/universal-dirty-certificates/verify.py",
"usage": "input",
"sha256": "2759a2e7514453012ed0e4ffc7017375dea973925672dc16f127d91790dcb6e5",
"git_blob": "abccca3c9e9005343e254a78dc3482693eabd993"
}
]
}
61 changes: 61 additions & 0 deletions research/cached-dirty-paths/TASK.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"schema_version": 1,
"task_id": "replay-runtime",
"priority_revision": 8,
"base_commit": "2485805a6d47f36ea83ddde6327d453ac82d44dc",
"original_card": {
"id": "replay-runtime",
"question": "Can one measured replay bottleneck be sped up without dropping coverage?",
"starting_points": [
"scripts/run_isolated_tests.py",
"scripts/verify_replay_coverage.py",
"certificates/selected-result.json"
],
"methods": [
"Profile one isolated replay and optimize the measured bottleneck.",
"Design source-bound reuse with explicit dependency invalidation and negative controls."
],
"acceptance_gate": "Report before/after wall time on the same fixture, retained checks and invalidation behavior.",
"first_step": {
"command": [
"python3",
"-B",
"scripts/research_selected_baseline.py"
],
"expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY",
"inspect": "Resolve the current selected review, separate complex/ordinary BIT/admitted BIT/outer budgets, and compare the card against live handoffs before starting. Historical ceilings require exact source/model equivalence.",
"scope": "Source-binding orientation only; not a scientific replay or all-size proof. Materialize selected inputs if this checkout is sparse."
},
"first_experiment": "Measure one unchanged fixture, preserve check coverage, and test one optimization with invalidation controls.",
"bottleneck_link": "Faster trustworthy replays increase review throughput and let mechanism candidates be checked sooner.",
"allowed_variations": [
"Profile one stage or design one source-bound cache boundary."
],
"scope_change_triggers": [
"Skipping coverage or comparing different fixtures to claim speedup."
],
"overlap_terms": [
"replay runtime",
"cache invalidation",
"isolated tests"
]
},
"scope_status": "refined",
"actual_scope": "Cache rooted path prefixes within each complete PR5235 certificate check, preserving every predicate and equation; measure the complete unchanged scientific caller.",
"scope_change_reason": "The replay-runtime card is narrowed to the explicit repeated-path traversal handoff of PR5235.",
"bottleneck_link": "Quicker exact complete-endpoint checking helps test recursive-interface candidates while preserving all dirty returns. This is verifier engineering, not a supplier or kappa improvement.",
"budget_minutes": 60,
"stop_rule": "Stop at the first source-bound complete-caller timing improvement with exact output parity, five alternating runs per side and all rejection controls; otherwise release the failed method.",
"outcome": "completed",
"evidence": "README.md; BENCHMARK.json; verify.py; replay.py; source-bound cache-only delta; normal and optimized registered replay.",
"author": "Nick Petalas",
"ai_assistance": "Independent human and formal proof-kernel review are unclaimed.",
"open_questions": [
{
"question": "Can a larger source-bound independent-symbol adapter retain a benefit within a measured peak-memory budget?",
"why_it_matters": "The trie trades extra sparse-row retention for fewer repeated transitions; large callers need a complete cost comparison.",
"first_step": "Measure distinct rooted prefixes, sparse row sizes and complete producer/checker time on one compatible actual adapter.",
"blocked_by": "A source-bound real adapter and measured memory budget are absent."
}
]
}
Loading