From b9214af1c7d5fce254b2862f59ca10c64bd9e3e3 Mon Sep 17 00:00:00 2001 From: Sagar Thakrar Date: Tue, 13 Oct 2026 10:37:04 +0530 Subject: [PATCH 1/2] Research: restore decoder stars to save 128 R420 XORs --- .../r420-decoder-bundles/CERTIFICATE.json | 205 ++++++++++++++++ research/r420-decoder-bundles/CLAIM.md | 12 + research/r420-decoder-bundles/NATIVE.json | 155 +++++++++++++ research/r420-decoder-bundles/README.md | 185 +++++++++++++++ research/r420-decoder-bundles/SOURCES.json | 13 ++ research/r420-decoder-bundles/VALIDATION.json | 30 +++ research/r420-decoder-bundles/audit.py | 218 ++++++++++++++++++ research/r420-decoder-bundles/native.py | 123 ++++++++++ research/r420-decoder-bundles/recipe.json | 125 ++++++++++ research/r420-decoder-bundles/verify.py | 216 +++++++++++++++++ 10 files changed, 1282 insertions(+) create mode 100644 research/r420-decoder-bundles/CERTIFICATE.json create mode 100644 research/r420-decoder-bundles/CLAIM.md create mode 100644 research/r420-decoder-bundles/NATIVE.json create mode 100644 research/r420-decoder-bundles/README.md create mode 100644 research/r420-decoder-bundles/SOURCES.json create mode 100644 research/r420-decoder-bundles/VALIDATION.json create mode 100644 research/r420-decoder-bundles/audit.py create mode 100644 research/r420-decoder-bundles/native.py create mode 100644 research/r420-decoder-bundles/recipe.json create mode 100644 research/r420-decoder-bundles/verify.py diff --git a/research/r420-decoder-bundles/CERTIFICATE.json b/research/r420-decoder-bundles/CERTIFICATE.json new file mode 100644 index 0000000000..0e4dd8449e --- /dev/null +++ b/research/r420-decoder-bundles/CERTIFICATE.json @@ -0,0 +1,205 @@ +{ + "status": "PASS_R420_DECODER_BUNDLES", + "assignment_seed": 19, + "search": { + "operands": 80, + "oriented_edges_checked": 6320, + "positive_edges": 463, + "packings_tried": 1, + "star_savings": [ + 18, + 17, + 14, + 4, + 3, + 2, + 2, + 1, + 1, + 1, + 1 + ], + "unselected_operands": 25, + "stopping_rule": "no positive edge remains among unused operands" + }, + "stars": 11, + "edges": 44, + "columns": 660, + "decoder_additions_before": 321, + "decoder_additions_after": 257, + "native_additions_before": 26916, + "native_additions_after": 26788, + "saved_with_cleanup": 128, + "baseline_canonical_sha256": "e597e3885c0a8daa262afa5985ee2930443329126aece76d33159d81882bdcc2", + "candidate_canonical_sha256": "d914b4d213175249af4fcd0a98f3f2b5addef1aea702c0224945c79f4d614eef", + "original_H1_H5": true, + "independent": { + "status": "PASS", + "columns": 660, + "scope": "relative scalar-word rewrite; closed E8 frames and cohort hosting inherited", + "checks": { + "all_A_columns_equal": true, + "all_frame_paths_equal": true, + "scalar_invoice_equal": true, + "baseline_full_operator": true, + "baseline_inverse_operator": true, + "baseline_interface": true, + "candidate_full_operator": true, + "candidate_inverse_operator": true, + "candidate_interface": true + }, + "different_A_output_registers": [], + "different_frame_path_registers": [], + "words": { + "baseline": { + "full_operator_is_target_add": true, + "inverse_operator_is_target_add": true, + "interface": { + "no_target_feeds_source_or_helper": true, + "D_targets_from_zero_frame_helpers": true, + "targets_and_helpers_start_at_zero": true, + "A_never_writes_target": true, + "C_literal_reverse": true, + "sources_and_helpers_finish_at_full": true + }, + "gates": { + "D": 120, + "A": 2064, + "B": 837, + "C": 2661 + }, + "adds": { + "D": 19922, + "A": 2376, + "B": 1077, + "C": 2973 + }, + "scatter_adds": 568, + "positive_scalar_bounds": { + "forward": { + "maximum": 144651, + "bits": 18 + }, + "inverse": { + "maximum": 2270064, + "bits": 22 + } + }, + "scalar_invoice": { + "paid_histogram": { + "1": 1320, + "2": 1440, + "4": 60, + "5": 120, + "8": 9 + }, + "rank_mass": 5112, + "moves": 2940, + "copies": 9, + "scope": "scalar MOVE and scatter COPY invoice, before cohort hosting" + } + }, + "candidate": { + "full_operator_is_target_add": true, + "inverse_operator_is_target_add": true, + "interface": { + "no_target_feeds_source_or_helper": true, + "D_targets_from_zero_frame_helpers": true, + "targets_and_helpers_start_at_zero": true, + "A_never_writes_target": true, + "C_literal_reverse": true, + "sources_and_helpers_finish_at_full": true + }, + "gates": { + "D": 120, + "A": 2086, + "B": 837, + "C": 2683 + }, + "adds": { + "D": 19922, + "A": 2312, + "B": 1077, + "C": 2909 + }, + "scatter_adds": 568, + "positive_scalar_bounds": { + "forward": { + "maximum": 235233, + "bits": 18 + }, + "inverse": { + "maximum": 3088728, + "bits": 22 + } + }, + "scalar_invoice": { + "paid_histogram": { + "1": 1320, + "2": 1440, + "4": 60, + "5": 120, + "8": 9 + }, + "rank_mass": 5112, + "moves": 2940, + "copies": 9, + "scope": "scalar MOVE and scatter COPY invoice, before cohort hosting" + } + } + }, + "scalar_ADD_saving_including_C": 128 + }, + "negative_controls": [ + "missing star restoration", + "uncancelled decoder operand", + "scalar-valid nonliteral cleanup", + "unpaid frame-zero preparation", + "retained register used as hub", + "overlapping stars", + "missing dirty compensation", + "changed source word" + ], + "three_register_separation": { + "group": [ + 515, + 489, + 347 + ], + "all_oriented_edge_weights": [ + [ + 515, + 489, + 2 + ], + [ + 515, + 347, + 2 + ], + [ + 489, + 515, + 1 + ], + [ + 489, + 347, + 1 + ], + [ + 347, + 515, + 1 + ], + [ + 347, + 489, + 1 + ] + ], + "star_saving": 4, + "disjoint_pair_ceiling": 2 + }, + "kappa_claim": "none" +} diff --git a/research/r420-decoder-bundles/CLAIM.md b/research/r420-decoder-bundles/CLAIM.md new file mode 100644 index 0000000000..9b4c60c795 --- /dev/null +++ b/research/r420-decoder-bundles/CLAIM.md @@ -0,0 +1,12 @@ +# Local sprint claim + +- Track: bit supplier. Assignment seed 19, drawn with Node crypto.randomInt(100), backed by operating-system randomness. +- Base: `66849e1475c930fd7732b1a0067ffee7e1e95f60`. +- Started: 2026-10-13 04:49 UTC. Expected finish: 05:30 UTC. Final verification begins no later than 05:20 UTC. +- Object: the nine FULL-frame phase-A decoder totals of eumemic's PR543 R420 bit word. +- Hypothesis: restored bundles of at least three non-retained operand registers can improve on the disjoint-pair mechanism in PR708, after paying preparation, restoration and literal reverse cleanup. +- Method: exact enumeration of small bundles, followed by one bounded disjoint selection. Preserve every frame path and arbitrary dirty inputs; recompute positive scalar growth. Seed 19 fixes tie ordering. +- Deliverable: one frozen circuit and exact verifier, or a scoped negative result if the paid budget fails. No new kappa claim. +- Three candidates considered: phase-B block resynthesis, phase-A quad synthesis, and decoder bundles. PR670/674/688 cover block rewrites and PR691 covers quad synthesis. Bundles change the search class beyond PR708's pair matching. +- Coordination check: GitHub pinnedIssues returned an empty list; no separate issue opened. Open PR metadata inspected through PR720. PR708 is the direct predecessor and will be credited and pinned; PR686/694 cover frame-zero compensation, a different circuit. +- Contributor: Sagar Thakrar (@thakrarsagar), with substantial OpenAI Codex assistance. Apache-2.0. diff --git a/research/r420-decoder-bundles/NATIVE.json b/research/r420-decoder-bundles/NATIVE.json new file mode 100644 index 0000000000..7b8311b273 --- /dev/null +++ b/research/r420-decoder-bundles/NATIVE.json @@ -0,0 +1,155 @@ +{ + "source_sha256": { + "code/bit/export_records.py": "8a5999601f917dbb492bb9ae9a344611f18cc7cedc53dc3c76496a369e530eb3", + "code/bit/regression/stage_cohort.py": "6c288f6f234b528c1a7c0a4adfb724e91e0fe6b18c8dffad96af3f973de1829a", + "code/bit/checkers/legality_h.cpp": "6c1ef2b24e57781d6951c172a1024fc4300e6fd392c9d6672079a7806ab663b3", + "code/bit/checkers/columns_k.cpp": "1c344d18fcd494eeca93e259f10cafae7705780e6592f6dcb35b34752dab9bc2", + "code/bit/checkers/json.hpp": "aaf127c04cb31c406e5b04a63f1ae89369fccde6d8fa7cdda1ed4f32dfc5de63", + "portable-include/bits/stdc++.h": "420094be2af295eed03a983dd66debbbe9cfb78d8252859f4498a615a0074b99" + }, + "python": "3.14.8", + "platform": "macOS-26.5.2-arm64-arm-64bit-Mach-O", + "compiler": "g++-16 (Homebrew GCC 16.2.0) 16.2.0", + "words": { + "baseline": { + "word_sha256": "9721a3819efd68307f66f00d84a952eb28eb7c3ad2ce79653ce295c98a764784", + "canonical_sha256": "e597e3885c0a8daa262afa5985ee2930443329126aece76d33159d81882bdcc2", + "records": 29874, + "native_ADDs": 26916, + "rank_mass": 5112, + "paid_histogram": [ + [ + 1, + 1320 + ], + [ + 2, + 1440 + ], + [ + 4, + 60 + ], + [ + 5, + 120 + ], + [ + 8, + 9 + ] + ], + "local_raw_H": [ + [ + 1, + 1320 + ], + [ + 2, + 1440 + ], + [ + 4, + 60 + ], + [ + 5, + 120 + ], + [ + 8, + 9 + ] + ], + "payload_prefix_bits": 100, + "payload_prefix_upper": "998206739997057013039187410944", + "signed_lift_prefix": [ + { + "bits": 18, + "cancellation_free_signed_row_l1_upper": "144651", + "reverse": false + }, + { + "bits": 22, + "cancellation_free_signed_row_l1_upper": "2270064", + "reverse": true + } + ], + "formal_columns_checked": 1380, + "omitted_bridge_controls_rejected": 18 + }, + "candidate": { + "word_sha256": "9a1e1c337b689735dd8a20e37a11ac005571a23ae79e7bd867b71fb19da9d60f", + "canonical_sha256": "d914b4d213175249af4fcd0a98f3f2b5addef1aea702c0224945c79f4d614eef", + "records": 29746, + "native_ADDs": 26788, + "rank_mass": 5112, + "paid_histogram": [ + [ + 1, + 1320 + ], + [ + 2, + 1440 + ], + [ + 4, + 60 + ], + [ + 5, + 120 + ], + [ + 8, + 9 + ] + ], + "local_raw_H": [ + [ + 1, + 1320 + ], + [ + 2, + 1440 + ], + [ + 4, + 60 + ], + [ + 5, + 120 + ], + [ + 8, + 9 + ] + ], + "payload_prefix_bits": 103, + "payload_prefix_upper": "7947564222982123825239771942912", + "signed_lift_prefix": [ + { + "bits": 18, + "cancellation_free_signed_row_l1_upper": "235233", + "reverse": false + }, + { + "bits": 22, + "cancellation_free_signed_row_l1_upper": "3088728", + "reverse": true + } + ], + "formal_columns_checked": 1380, + "omitted_bridge_controls_rejected": 18 + } + }, + "status": "PASS_R420_DECODER_BUNDLES_NATIVE_NINE_STAGE", + "boost": { + "version": "1.85.0", + "archive_sha256": "7009fe1faa1697476bdc7027703a2badb84e849b7b0baad5086b087b971f8617", + "url": "https://archives.boost.io/release/1.85.0/source/boost_1_85_0.tar.bz2" + } +} diff --git a/research/r420-decoder-bundles/README.md b/research/r420-decoder-bundles/README.md new file mode 100644 index 0000000000..773c0f5004 --- /dev/null +++ b/research/r420-decoder-bundles/README.md @@ -0,0 +1,185 @@ +# Restored stars in the R420 decoder totals + +**Finite bit-circuit construction. No new kappa.** Eleven disjoint restored +stars reduce the nine phase-A decoder totals in eumemic's PR543 R420 word from +321 to **257 binary XORs**, including preparation and restoration. Rebuilding +literal reverse cleanup doubles the saving to **128 native ADDs**, from 26,916 +to **26,788**. No helper, source-access operation, frame move, copy, restoration, +or recursive child is omitted from the comparison. + +This extends the disjoint-pair mechanism in +[PR708](https://github.com/CrocSwap/integer-mult-bounds/pull/708) at +`2ec522a466ec448f148d4355dc43b51c0ef1e0b5`. Its frozen recipe saves 114 native +ADDs. The present recipe saves 14 more by allowing a helper to accumulate several +leaves. This is a different circuit class, not another pair-matching seed. It +does not prove that either recipe is globally optimal. + +## Base and accepted result + +Base commit: `66849e1475c930fd7732b1a0067ffee7e1e95f60`. +The selected record at this base is conditional +`kappa = 51110230636731/31250000000000000 = 0.001635527380375392`. +Its complex supplier is PR626 at `660de893d27bb7abd1d5b01b1640207528a5c851`; +its bit supplier is PR543 at `2065fe4f72a914d907f1046603f5a36f17018535`. +See the actual [selected review](../../docs/research/community-k492-review.md) +and [bit construction](../e8-bit-r420/README.md). Historical frontier statements +inside the latter are not claims about the current selected result. + +Only this research directory is added. The selected frontier, original supplier, +`upstream/`, and other concurrent packages are unchanged. Source and canonical +word hashes are in [SOURCES.json](SOURCES.json); compression headers are not used +to determine mathematical equality. + +## Reproduce + +Python 3.10 or later, standard library only: + +```sh +python3 -B research/r420-decoder-bundles/verify.py +``` + +Expected final line: + +```text +PASS_R420_DECODER_BUNDLES decoder=321->257 native_ADDs=26916->26788 saved=128 columns=660 controls=8 no_new_kappa +``` + +The command regenerates the nomination and circuit in memory, verifies all +pinned inputs, and compares every field of [CERTIFICATE.json](CERTIFICATE.json). +It invokes the unchanged PR543 E8 label, frame, dirty-column and H1-H5 checker, +then a separate set-valued interpreter in [audit.py](audit.py). Eight negative +controls cover omitted restoration, an uncancelled total operand, stale literal +cleanup, unpaid frame-zero preparation, a retained helper used as scratch, +overlapping stars, missing dirt compensation, and a changed source word. +Optimized Python is refused because inherited verification uses assertions. + +For a fresh native nine-stage replay, also install a C++17 compiler and Boost +headers and choose two output directories that do not yet exist: + +```sh +python3 -B research/r420-decoder-bundles/verify.py --output /tmp/r420-bundles-words +BOOST_INCLUDE=/path/to/boost CXX=c++ python3 -B research/r420-decoder-bundles/native.py \ + /tmp/r420-bundles-words/baseline.json.gz \ + /tmp/r420-bundles-words/candidate.json.gz /tmp/r420-bundles-native +``` + +Expected final line: + +```text +PASS_R420_DECODER_BUNDLES_NATIVE_NINE_STAGE ADDs=26916->26788 columns=1380 controls=18/18 for both words +``` + +The runner checks canonical word identity before export and pins all six native +dependencies. [NATIVE.json](NATIVE.json) records the executed local replay with +Python 3.14.8, GCC 16.2.0 and Boost 1.85.0. Both words pass all 1,380 formal +columns, nine COPY/ERASE lifecycles, and all 18 omitted-bridge rejection controls. +Exported records fall from 29,874 to 29,746. The payload bound rises from 100 to +103 bits and still satisfies the inherited strict requirement `< 104`. + +## Circuit and exact cost + +A star has hub `a` and leaves `L`. All are distinct non-retained helpers already +used by the nine totals. At FULL, prepare + + a <- a XOR XOR(L). + +In every total whose original source set contains `a`, toggle all members of `L` +in its source set. Leave other totals unchanged. After the nine totals, undo +the preparation. No star register is a total destination; different stars have +disjoint registers. The new total therefore reads exactly its original linear +form on arbitrary inputs, including arbitrary helper dirt. Every star helper +returns to its value before the totals, so the entire A operator is unchanged. The +existing D compensation still applies, and C is rebuilt as the literal reverse +of all A/B gates whose destination is a source or helper. Thus the original +H1-H5 interface applies without amendment. + +Write `n_a` for the number of totals reading `a` and `n_ab` for the number reading +both `a` and `b`. Preparing and restoring an edge costs two binary ADDs. Toggling +`b` in the `n_a` affected totals removes it `n_ab` times and adds it +`n_a - n_ab` times. The fully paid phase-A saving per leaf is exactly + + w(a,b) = 2*n_ab - n_a - 2. + +Disjoint stars make these savings additive. The selected 44 edges save 64 ADDs +in A and 64 in C. The decoder circuit has 44 preparation ADDs, 169 total ADDs, +and 44 restoration ADDs, summing to 257. Every selected register originally +climbed to FULL during these totals. Moving that climb earlier changes no +ordered register frame path. Both interpreters verify this on the literal word. + +There is also a strict small-class separation. On registers `[515, 489, 347]`, +the two hub-515 edges each have weight 2; the other four oriented edges each +have weight 1. The star saves four ADDs in A. A disjoint-pair recipe on these +three registers can choose at most one edge and saves at most two. The verifier +enumerates all six oriented edges. This statement does not bound pair recipes +that use additional registers. + +## Cost boundary and search coverage + +| Quantity | Original | Restored stars | +|---|---:|---:| +| Binary decoder ADDs, including preparation/restoration | 321 | 257 | +| Complete native ADDs, including C and D | 26,916 | 26,788 | +| Helpers / retained copies | 420 / 9 | 420 / 9 | +| Scalar MOVE count / rank mass | 2,940 / 5,112 | 2,940 / 5,112 | +| Forward positive scalar maximum | 144,651 | 235,233 | +| Inverse positive scalar maximum | 2,270,064 | 3,088,728 | +| Nine-stage payload prefix bits | 100 | 103 | + +The paid histogram remains `{1:1320, 2:1440, 4:60, 5:120, 8:9}`. +Unchanged recursive ranks give no recursive-moment gain by themselves. The +larger positive envelopes must be carried into any complete hosted invoice. +The #626 selected composition is complex-bound; these fewer local ADDs do not +establish a stronger exponent or a practical runtime speedup. + +Assignment seed **19** was drawn from operating-system randomness. The search +scores all 6,320 oriented edges among the 80 eligible operands; 463 have positive +weight. One seed-19 ordering resolves ties. At each step it chooses the hub with +largest total positive weight over unused leaves and removes that whole star. +It stops when no positive edge remains on unused registers. Exactly one packing +was attempted: eleven stars, 44 edges, and 25 unselected operands. There is no +solver, restart, or optimality claim. Before nomination, an optimistic +common-incidence screen visited all 82,160 three-operand subsets. That score was +discarded because rows reading only part of a bundle must also be charged; no +word was constructed from that screen. The exact edge formula above includes +those costs. The frozen +[recipe](recipe.json) and its regeneration are checked byte-for-value. + +The full hosted-parent construction, global finite invoice, changed-word outer +assembly, and remote CI were not run. Neither `make verify` nor a new selected +frontier replay is claimed for this isolated research addition. All-size +compilation, common-label/mutable-basis realization, whole-owner hosting, +normalized residuals, precision/tape/exact recovery, and analytic transfer +remain inherited assumptions. Finite checks do not formally prove the full +multiplication theorem. + +## Attribution and concurrent work + +The circuit is based on eumemic's PR543 R420 word and PR493 carrier skeleton, +Dylan Crow's bitE8 format and exporter, DreamingOfClouds' retained totals and +nine-stage pricing, Zhihao Chen's scalar interface, and the common-label and +whole-owner lineage credited in the original supplier. Preserve those notices. +PR708 supplies the immediate pair-sharing idea, relative set-replay precedent, +and the attributed native runner adapted here. Its sources are pinned above; +its pending review status is not treated as acceptance of this result. + +Concurrent PR686/694 optimize frame-zero compensation, PR670/674/688 change +phase-B blocks, PR691 changes a phase-A quad, and PR713/716 change target bases +in D. None is imported or composed here. PR661's negative result fixes the B +gate stream and does not prohibit this A/C rewrite. The local sprint claim and +final overlap refresh are recorded in [CLAIM.md](CLAIM.md). + +The final refresh found Chinmay Khaladkar's +[PR748](https://github.com/CrocSwap/integer-mult-bounds/pull/748), head +`0ccc0b425d2b9667108d3a0918a5cfa0aa7a5861`, which reports a larger 244-ADD +saving by changing one total's source representation and recomputing D for its +changed helper-dirt map. The present contribution preserves the complete A +operator and D, and adds fresh nine-stage C++ replay. It is not an overall +savings record. PR742's shared target donors and PR733's two-sided D basis also +give larger whole-word savings in different circuits. None of these concurrent +recipes is imported or assumed composable. + +Prepared for **Sagar Thakrar, @thakrarsagar**, with substantial **OpenAI Codex +assistance** in construction, proof, checker implementation, independent replay, +and packaging. Separate AI workers checked the star identity, set-valued replay, +and native checker path. No independent human review is claimed. This new work +is under the repository's Apache-2.0 license. diff --git a/research/r420-decoder-bundles/SOURCES.json b/research/r420-decoder-bundles/SOURCES.json new file mode 100644 index 0000000000..43cbe23709 --- /dev/null +++ b/research/r420-decoder-bundles/SOURCES.json @@ -0,0 +1,13 @@ +{ + "base_commit": "66849e1475c930fd7732b1a0067ffee7e1e95f60", + "PR543_source_head": "2065fe4f72a914d907f1046603f5a36f17018535", + "selected_PR626_source_head": "660de893d27bb7abd1d5b01b1640207528a5c851", + "mechanism_predecessor_PR708": "2ec522a466ec448f148d4355dc43b51c0ef1e0b5", + "word_canonical_sha256": "e597e3885c0a8daa262afa5985ee2930443329126aece76d33159d81882bdcc2", + "files_sha256": { + "research/e8-bit-r420/code/xcheck.py": "5737d18a7826fd51e131035f2d7bebba2e2868af91dd7672a5f11208b036d424", + "research/e8-bit-r420/code/gen_l3.py": "d5c802447c99255db1bdfcae62b2116bfc9612c9dc9000d41aa4f5f2fec9f2f2", + "research/e8-bit-r420/README.md": "9807be57c6adf26b30e4f54e2f8160075bbc05091f1a6d157e43d2a4620c1c9f", + "certificates/selected-result.json": "b3bf402f31a69bde0629936a9b569bed48281568d7b16d5fba120b5311ea1f53" + } +} diff --git a/research/r420-decoder-bundles/VALIDATION.json b/research/r420-decoder-bundles/VALIDATION.json new file mode 100644 index 0000000000..6691516318 --- /dev/null +++ b/research/r420-decoder-bundles/VALIDATION.json @@ -0,0 +1,30 @@ +{ + "date_utc": "2026-10-13", + "base_commit": "66849e1475c930fd7732b1a0067ffee7e1e95f60", + "status": "PASS_FINITE_RESEARCH_PACKAGE", + "python": "3.14.8", + "checks": { + "primary_command": "python3 -B research/r420-decoder-bundles/verify.py", + "primary_result": "PASS_R420_DECODER_BUNDLES decoder=321->257 native_ADDs=26916->26788 saved=128 columns=660 controls=8 no_new_kappa", + "unchanged_PR543_checker": "PASS E8 labels, 672 closed frames, all 660 dirty-input columns, H1-H5 and decomposed conclusion", + "independent_set_interpreter": "PASS whole A operator, complete word and inverse, frame paths, scalar paid histogram, exact positive envelopes", + "native": "PASS both words: 1380 formal columns, 18 omitted-bridge controls, 9 copies and erasures, payload 100->103 bits below 104; see NATIVE.json", + "optimized_python": "Verifier refuses -O with explicit error", + "native_wrong_candidate_control": "Baseline substituted for candidate rejected by canonical hash before compilation or output creation", + "relocated_minimal_archive": "PASS from exported Git tree containing only this package and the pinned primary dependencies", + "coverage_metadata_negative": "Changing recipe.search.oriented_edges_checked from 6320 to 6321 rejected with search coverage or stopping rule changed", + "selected_record": "make selected-record-check passed", + "staged_whitespace": "git diff --cached --check passed", + "separate_AI_review": "No remaining finite mathematical or accounting blocker; search metadata binding and proof wording corrected" + }, + "not_run": [ + "repository-wide make verify", + "changed-word hosted-parent construction and global invoice", + "changed-word outer assembly or selected frontier cold replay", + "remote CI", + "full theorem formalization" + ], + "reason_for_scope": "Only an isolated finite research package is added; no selected construction or production generator is changed. Full integration remains a separate obligation.", + "no_new_kappa": true, + "no_independent_human_review": true +} diff --git a/research/r420-decoder-bundles/audit.py b/research/r420-decoder-bundles/audit.py new file mode 100644 index 0000000000..02c88e3192 --- /dev/null +++ b/research/r420-decoder-bundles/audit.py @@ -0,0 +1,218 @@ +"""Independent set-valued replay and scalar invoice for an R420 decoder rewrite. + +The scalar word, its inverse, every dirty-input column, and all frame paths are +checked here without importing the producer or the upstream checker. Closed +E8 frames and the hosted/cohort realization remain inherited obligations. +PR708 by Sagar Thakrar used set-valued relative replay for pair sharing; this +checker extends that method to bundles and recomputes the scalar paid invoice. +Sagar Thakrar, with substantial OpenAI Codex assistance; Apache-2.0. +""" + +import argparse +from collections import Counter +from fractions import Fraction +import gzip +import json + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def load(value): + if isinstance(value, dict): + return value + with (gzip.open(value, "rt") if str(value).endswith(".gz") else open(value)) as stream: + return json.load(stream) + + +def rank(rows): + basis = {} + for source in rows: + row = list(map(Fraction, source)) + for pivot, old in sorted(basis.items()): + factor = row[pivot] + row = [a - factor * b for a, b in zip(row, old)] + pivot = next((i for i, value in enumerate(row) if value), None) + if pivot is not None: + scale = row[pivot] + basis[pivot] = [value / scale for value in row] + return len(basis) + + +def validate(word): + require(word["v"] == 120 and word["R"] == 420 and word["h"] == 8, + "expected the R420 E8 scalar word") + n = 2 * word["v"] + word["R"] + frames = word["frames"] + require(len(word["lines"]) == word["v"] and all( + len(row) == word["h"] and all(type(x) is int for x in row) + for row in word["lines"]), "malformed label table") + for frame in frames: + require(len(frame) == len(set(frame)) and all( + type(x) is int and 0 <= x < word["v"] for x in frame), "malformed frame") + for key in ("start", "final"): + require(len(word[key]) == n and all(type(x) is int and 0 <= x < len(frames) + for x in word[key]), "malformed " + key) + for section in "DABC": + for gate in word[section]: + require(len(gate) == 3, "malformed gate in " + section) + frame, destination, sources = gate + require(type(frame) is int and 0 <= frame < len(frames), "invalid gate frame") + registers = [destination] + sources + require(sources and all(type(x) is int and 0 <= x < n for x in registers) + and len(registers) == len(set(registers)), "invalid gate operands") + require(len(word["ret"]) == len(set(word["ret"])) and all( + type(r) is int and 2 * word["v"] <= r < n for r in word["ret"]), + "invalid retained helpers") + require(len(word["scatter"]) == word["v"], "invalid scatter row count") + for row in word["scatter"]: + require(len(row) == len(set(row)) and all( + type(k) is int and 0 <= k < len(word["ret"]) for k in row), + "invalid scatter operands") + return n + + +def events(word, sections): + for section in sections: + if section == "scatter": + for target, row in enumerate(word["scatter"]): + for index in row: + yield None, word["v"] + target, [word["ret"][index]] + else: + yield from word[section] + + +def symbolic(n, gates): + values = [{r} for r in range(n)] + for _, destination, sources in gates: + for source in sources: + values[destination].symmetric_difference_update(values[source]) + return values + + +def positive(n, gates): + """Nonnegative scalar envelope of the forward word and its inverse. + + Replacing every ADD/SUB by addition bounds signed lifts. A scatter COPY is + read-only, so repeated adds from its unchanged owner give the same envelope. + With all inputs one, the maximum is the exact maximum positive row sum. + The reversed event order is the inverse envelope, not a transpose norm. + """ + result = {} + for label, ordered in (("forward", gates), ("inverse", reversed(gates))): + values = [1] * n + for _, destination, sources in ordered: + values[destination] += sum(values[source] for source in sources) + maximum = max(values) + result[label] = {"maximum": maximum, "bits": maximum.bit_length()} + return result + + +def geometry(word, dimensions): + current = list(word["start"]) + paths = [[frame] for frame in current] + frames = list(map(set, word["frames"])) + histogram = Counter() + moves = 0 + + def move(register, frame): + nonlocal moves + old = current[register] + if old == frame: + return + require(frames[old] < frames[frame] and dimensions[old] < dimensions[frame], + f"non-nested frame move on register {register}: {old}->{frame}") + histogram[dimensions[frame] - dimensions[old]] += 1 + moves += 1 + current[register] = frame + paths[register].append(frame) + + for section in ("D", "A", "scatter", "B", "C"): + if section == "scatter": + require(all(dimensions[f] == 0 for f in current[word["v"]:2 * word["v"]]), + "scatter target already left frame zero") + for helper in word["ret"]: + histogram[dimensions[current[helper]]] += 1 + else: + for frame, destination, sources in word[section]: + for register in [destination] + sources: + move(register, frame) + for register, frame in enumerate(word["final"]): + move(register, frame) + return paths, {"paid_histogram": {str(rank): count for rank, count in sorted(histogram.items())}, + "rank_mass": sum(rank * count for rank, count in histogram.items()), + "moves": moves, "copies": len(word["ret"]), + "scope": "scalar MOVE and scatter COPY invoice, before cohort hosting"} + + +def interfaces(word, dimensions): + v = word["v"] + target = lambda r: v <= r < 2 * v + full = [i for i, dimension in enumerate(dimensions) if dimension == word["h"]] + require(len(full) == 1, "expected a unique full frame") + reverse = [[full[0], destination, sources] for section in ("A", "B") + for _, destination, sources in word[section] if not target(destination)] + return { + "no_target_feeds_source_or_helper": all(target(d) or all(not target(s) for s in src) + for section in "DABC" for _, d, src in word[section]), + "D_targets_from_zero_frame_helpers": all(dimensions[f] == 0 and target(d) + and all(s >= 2 * v for s in src) for f, d, src in word["D"]), + "targets_and_helpers_start_at_zero": all(dimensions[f] == 0 for f in word["start"][v:]), + "A_never_writes_target": all(not target(d) for _, d, _ in word["A"]), + "C_literal_reverse": word["C"] == reverse[::-1], + "sources_and_helpers_finish_at_full": all(dimensions[f] == word["h"] + for r, f in enumerate(word["final"]) if not target(r)), + } + + +def compare(baseline, candidate): + baseline, candidate = load(baseline), load(candidate) + n = validate(baseline) + require(validate(candidate) == n, "register count changed") + immutable = sorted((set(baseline) | set(candidate)) - {"A", "C"}) + changed = [key for key in immutable if baseline.get(key) != candidate.get(key)] + require(not changed, "changed fields outside A/C: " + ", ".join(changed)) + dimensions = [rank(baseline["lines"][i] for i in frame) for frame in baseline["frames"]] + expected = [{r, r - baseline["v"]} if baseline["v"] <= r < 2 * baseline["v"] else {r} + for r in range(n)] + operators, paths, reports = {}, {}, {} + for label, word in (("baseline", baseline), ("candidate", candidate)): + gates = list(events(word, ("D", "A", "scatter", "B", "C"))) + operators[label] = symbolic(n, word["A"]) + paths[label], invoice = geometry(word, dimensions) + reports[label] = { + "full_operator_is_target_add": symbolic(n, gates) == expected, + "inverse_operator_is_target_add": symbolic(n, reversed(gates)) == expected, + "interface": interfaces(word, dimensions), + "gates": {section: len(word[section]) for section in "DABC"}, + "adds": {section: sum(len(gate[2]) for gate in word[section]) for section in "DABC"}, + "scatter_adds": sum(map(len, word["scatter"])), + "positive_scalar_bounds": positive(n, gates), + "scalar_invoice": invoice, + } + differing_a = [r for r in range(n) if operators["baseline"][r] != operators["candidate"][r]] + differing_paths = [r for r in range(n) if paths["baseline"][r] != paths["candidate"][r]] + checks = {"all_A_columns_equal": not differing_a, "all_frame_paths_equal": not differing_paths, + "scalar_invoice_equal": reports["baseline"]["scalar_invoice"] == reports["candidate"]["scalar_invoice"]} + for label, report in reports.items(): + checks[label + "_full_operator"] = report["full_operator_is_target_add"] + checks[label + "_inverse_operator"] = report["inverse_operator_is_target_add"] + checks[label + "_interface"] = all(report["interface"].values()) + return {"status": "PASS" if all(checks.values()) else "FAIL", "columns": n, + "scope": "relative scalar-word rewrite; closed E8 frames and cohort hosting inherited", + "checks": checks, "different_A_output_registers": differing_a, + "different_frame_path_registers": differing_paths, "words": reports, + "scalar_ADD_saving_including_C": sum(reports["baseline"]["adds"].values()) + - sum(reports["candidate"]["adds"].values())} + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("baseline") + parser.add_argument("candidate") + args = parser.parse_args() + result = compare(args.baseline, args.candidate) + print(json.dumps(result, indent=2, sort_keys=True)) + raise SystemExit(0 if result["status"] == "PASS" else 1) diff --git a/research/r420-decoder-bundles/native.py b/research/r420-decoder-bundles/native.py new file mode 100644 index 0000000000..f007d89f5d --- /dev/null +++ b/research/r420-decoder-bundles/native.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python3 +"""Replay both R420 bundle words with the pinned nine-stage native checkers. + +Usage: BOOST_INCLUDE=/path/to/boost CXX=c++ python3 native.py BASE.gz CANDIDATE.gz FRESH_OUTPUT +Adapted from PR #708, native.py at 2ec522a466ec448f148d4355dc43b51c0ef1e0b5. +Sagar Thakrar, with substantial OpenAI Codex assistance; Apache-2.0. +""" +import gzip +import hashlib +import json +import os +from pathlib import Path +import platform +import shlex +import subprocess +import sys + + +HUB = Path(__file__).resolve().parents[1] / "e8-bit-carrier-skeleton" +PINS = { + "code/bit/export_records.py": "8a5999601f917dbb492bb9ae9a344611f18cc7cedc53dc3c76496a369e530eb3", + "code/bit/regression/stage_cohort.py": "6c288f6f234b528c1a7c0a4adfb724e91e0fe6b18c8dffad96af3f973de1829a", + "code/bit/checkers/legality_h.cpp": "6c1ef2b24e57781d6951c172a1024fc4300e6fd392c9d6672079a7806ab663b3", + "code/bit/checkers/columns_k.cpp": "1c344d18fcd494eeca93e259f10cafae7705780e6592f6dcb35b34752dab9bc2", + "code/bit/checkers/json.hpp": "aaf127c04cb31c406e5b04a63f1ae89369fccde6d8fa7cdda1ed4f32dfc5de63", + "portable-include/bits/stdc++.h": "420094be2af295eed03a983dd66debbbe9cfb78d8252859f4498a615a0074b99", +} + + +def need(ok, message): + if not ok: + raise RuntimeError(message) + + +def run(base_word, candidate_word, output_path): + certificate = json.loads((Path(__file__).parent / "CERTIFICATE.json").read_text()) + for name, path in (("baseline", base_word), ("candidate", candidate_word)): + word = json.loads(gzip.decompress(Path(path).read_bytes())) + content = json.dumps(word, sort_keys=True, separators=(",", ":")).encode() + need(hashlib.sha256(content).hexdigest() == certificate[name + "_canonical_sha256"], + name + ": word does not match the local certificate") + for name, digest in PINS.items(): + need(hashlib.sha256((HUB / name).read_bytes()).hexdigest() == digest, + "native dependency changed: " + name) + output = Path(output_path).resolve() + output.mkdir(parents=True, exist_ok=False) + checker = HUB / "code/bit/checkers" + compiler = shlex.split(os.environ.get("CXX", "c++")) + includes = ["-I" + str(HUB / "portable-include"), "-I" + str(checker), + "-I" + os.environ.get("BOOST_INCLUDE", "/usr/include")] + commands = [] + + def execute(args, log): + args = [str(x) for x in args] + commands.append(args) + with log.open("w") as stream: + subprocess.run(args, stdout=stream, stderr=subprocess.STDOUT, check=True) + + common = compiler + ["-O2", "-std=c++17", "-DHDIM=8", "-DNCOPY=9"] + includes + execute(common + ["-o", output / "legality", checker / "legality_h.cpp"], + output / "compile-legality.log") + execute(common + ["-DVPORTS=120", "-DRHELP=420", "-DKPAIRS=4", "-o", + output / "columns", checker / "columns_k.cpp"], + output / "compile-columns.log") + result = {"source_sha256": PINS, "python": platform.python_version(), + "platform": platform.platform(), "compiler": subprocess.check_output( + compiler + ["--version"], text=True).splitlines()[0], "words": {}} + python = [sys.executable, "-I", "-B"] + for label, word in (("baseline", base_word), ("candidate", candidate_word)): + folder = output / label + folder.mkdir() + records, cin, cout = (folder / name for name in ("records", "cin", "cout")) + execute(python + [HUB / "code/bit/export_records.py", Path(word).resolve(), records], + folder / "export.log") + execute(python + [HUB / "code/bit/regression/stage_cohort.py", records, records, + cin, cout], folder / "stage.log") + execute([output / "legality", cin, cout, cout / "legality.json"], + folder / "legality.log") + execute([output / "columns", cout / "COHORT249-RECORDS.bin", cout / "columns.json"], + folder / "columns.log") + legality = json.loads((cout / "legality.json").read_text()) + columns = json.loads((cout / "columns.json").read_text()) + need(legality["status"] == "PASS_INDEPENDENT_COHORT_LEGALITY_SOURCE_OWNERS_AND_LIFECYCLE", + label + ": legality failed") + need(legality["copies"] == legality["erasures"] == 9, label + ": copy lifecycle changed") + need(columns["status"] == "PASS_NEW_COHORT249_ALL_BRIDGED_STAGE_FORMAL_COLUMNS_AND_PREFIX_BILL", + label + ": columns failed") + need(columns["formal_columns_checked"] == 1380 and len(columns["stages"]) == 9, + label + ": incorrect native coverage") + need(columns["bridge_additions"] == 2160 and columns["fresh_center_copies"] == 81, + label + ": stage accounting changed") + need(columns["payload_prefix_bits"] < 104, label + ": exceeds inherited payload budget") + controls = columns["negative_controls"] + need(len(controls) == 18 and all(item["rejected"] for item in controls), + label + ": omitted bridge control did not reject") + need(legality["common_frame_ADDs"] == columns["local_scalar_additions"], + label + ": inconsistent exported addition counts") + result["words"][label] = {"word_sha256": hashlib.sha256(Path(word).read_bytes()).hexdigest(), + "canonical_sha256": certificate[label + "_canonical_sha256"], + "records": legality["records"], "native_ADDs": legality["common_frame_ADDs"], + "rank_mass": legality["rank_mass"], "paid_histogram": legality["paid_histogram"], + "local_raw_H": columns["local_raw_H"], "payload_prefix_bits": columns["payload_prefix_bits"], + "payload_prefix_upper": columns["payload_prefix_upper"], + "signed_lift_prefix": columns["signed_lift_prefix"], + "formal_columns_checked": columns["formal_columns_checked"], + "omitted_bridge_controls_rejected": len(controls)} + before, after = (result["words"][label] for label in ("baseline", "candidate")) + need(before["native_ADDs"] == 26916 and after["native_ADDs"] == 26788, + "expected 128 exported ADD savings") + need(before["records"] - after["records"] == 128, "unexpected record change") + for key in ("rank_mass", "paid_histogram", "local_raw_H"): + need(before[key] == after[key], "paid ranks changed: " + key) + result["status"] = "PASS_R420_DECODER_BUNDLES_NATIVE_NINE_STAGE" + result["commands"] = commands + (output / "native-report.json").write_text(json.dumps(result, indent=2) + "\n") + return result + + +if __name__ == "__main__": + if len(sys.argv) != 4: + raise SystemExit(__doc__) + report = run(*sys.argv[1:]) + print(report["status"], "ADDs=26916->26788 columns=1380 controls=18/18 for both words") diff --git a/research/r420-decoder-bundles/recipe.json b/research/r420-decoder-bundles/recipe.json new file mode 100644 index 0000000000..e440488b89 --- /dev/null +++ b/research/r420-decoder-bundles/recipe.json @@ -0,0 +1,125 @@ +{ + "seed": 19, + "stars": [ + [ + 551, + [ + 575, + 366, + 527, + 377, + 559, + 398, + 488, + 402, + 438 + ] + ], + [ + 540, + [ + 435, + 379, + 415, + 299, + 514, + 506, + 529, + 511, + 375, + 434, + 534, + 431, + 532 + ] + ], + [ + 530, + [ + 343, + 547, + 498, + 260, + 505, + 339, + 326, + 502, + 356, + 531 + ] + ], + [ + 515, + [ + 489, + 347 + ] + ], + [ + 327, + [ + 395, + 283, + 373 + ] + ], + [ + 516, + [ + 507 + ] + ], + [ + 374, + [ + 492, + 309 + ] + ], + [ + 297, + [ + 444 + ] + ], + [ + 473, + [ + 497 + ] + ], + [ + 482, + [ + 305 + ] + ], + [ + 439, + [ + 404 + ] + ] + ], + "search": { + "operands": 80, + "oriented_edges_checked": 6320, + "positive_edges": 463, + "packings_tried": 1, + "star_savings": [ + 18, + 17, + 14, + 4, + 3, + 2, + 2, + 1, + 1, + 1, + 1 + ], + "unselected_operands": 25, + "stopping_rule": "no positive edge remains among unused operands" + } +} diff --git a/research/r420-decoder-bundles/verify.py b/research/r420-decoder-bundles/verify.py new file mode 100644 index 0000000000..2088673d7b --- /dev/null +++ b/research/r420-decoder-bundles/verify.py @@ -0,0 +1,216 @@ +"""Exact finite decoder-star construction, with no new kappa claim. + +Sagar Thakrar (@thakrarsagar), with substantial OpenAI Codex assistance. +Apache-2.0. Extends the restored disjoint-pair idea of PR708 to disjoint stars. +The source word and geometry/interface checker are eumemic's PR543 work. +""" +import argparse +import copy +import gzip +import hashlib +import importlib.util +import json +from pathlib import Path +import random +import sys + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parent.parent +WORD = ROOT / "research/e8-bit-r420/data/bitE8mut-r420.json.gz" +XCHECK = ROOT / "research/e8-bit-r420/code/xcheck.py" + + +def need(condition, message): + if not condition: + raise ValueError(message) + + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(",", ":")).encode() + + +def digest(value): + return hashlib.sha256(canonical(value)).hexdigest() + + +def nominate(word, seed): + """One oriented-edge census and one greedy star packing, without restarts.""" + rows = [set(g[2]) for g in word["A"][-9:]] + pool = sorted(set.union(*rows) - set(word["ret"])) + signatures = {r: sum(1 << i for i, row in enumerate(rows) if r in row) for r in pool} + weights = {(a, b): 2 * (signatures[a] & signatures[b]).bit_count() + - signatures[a].bit_count() - 2 for a in pool for b in pool if a != b} + order = pool[:] + random.Random(seed).shuffle(order) + priority = {r: i for i, r in enumerate(order)} + remaining = set(pool) + stars, savings = [], [] + while remaining: + candidates = [] + for a in remaining: + leaves = sorted((b for b in remaining if b != a and weights[a, b] > 0), + key=priority.__getitem__) + saving = sum(weights[a, b] for b in leaves) + if saving: + candidates.append((saving, -priority[a], a, leaves)) + if not candidates: + break + saving, _, a, leaves = max(candidates) + stars.append([a, leaves]) + savings.append(saving) + remaining.difference_update([a] + leaves) + return stars, {"operands": len(pool), "oriented_edges_checked": len(weights), + "positive_edges": sum(w > 0 for w in weights.values()), + "packings_tried": 1, "star_savings": savings, + "unselected_operands": len(remaining), + "stopping_rule": "no positive edge remains among unused operands"} + + +def construct(word, stars): + tail = word["A"][-9:] + full = next(i for i, frame in enumerate(word["frames"]) if len(frame) == word["v"]) + need([g[1] for g in tail] == word["ret"], "tail is not the nine retained totals") + need(all(g[0] == full for g in tail), "totals are not at FULL") + pool = set().union(*(set(g[2]) for g in tail)) - set(word["ret"]) + used = set() + for a, leaves in stars: + group = [a] + leaves + need(leaves and len(group) == len(set(group)), "invalid star") + need(set(group) <= pool and not used.intersection(group), "stars must be disjoint non-retained operands") + used.update(group) + preparation = [[full, a, list(leaves)] for a, leaves in stars] + totals = [] + for frame, destination, sources in tail: + row = set(sources) + for a, leaves in stars: + if a in row: + row.symmetric_difference_update(leaves) + totals.append([frame, destination, sorted(row)]) + result = copy.deepcopy(word) + result["A"] = result["A"][:-9] + preparation + totals + preparation[::-1] + v = word["v"] + result["C"] = [[full, d, list(s)] for _, d, s in reversed(result["A"] + result["B"]) + if not v <= d < 2*v] + return result + + +def scalar(gates, n): + values = [1 << i for i in range(n)] + for _, destination, sources in gates: + for source in sources: + values[destination] ^= values[source] + return values + + +def additions(word): + return sum(len(g[2]) for section in "DABC" for g in word[section]) + sum(map(len, word["scatter"])) + + +def check_pins(word): + pins = json.loads((HERE / "SOURCES.json").read_text()) + need(digest(word) == pins["word_canonical_sha256"], "word semantic pin mismatch") + for name, expected in pins["files_sha256"].items(): + need(hashlib.sha256((ROOT / name).read_bytes()).hexdigest() == expected, "source pin mismatch: " + name) + + +def verify(baseline, stars, search): + candidate = construct(baseline, stars) + n = 2 * baseline["v"] + baseline["R"] + need(scalar(baseline["A"], n) == scalar(candidate["A"], n), "complete A operator changed") + need(additions(baseline) - additions(candidate) == 2 * sum(search["star_savings"]), "paid saving mismatch") + spec = importlib.util.spec_from_file_location("r420_xcheck", XCHECK) + checker = importlib.util.module_from_spec(spec) + spec.loader.exec_module(checker) + for word in (baseline, candidate): + _, _, _, hypotheses, conclusions, _ = checker.check(word) + need(all(hypotheses.values()) and all(conclusions.values()), "original H1-H5 or conclusion failed") + import audit + independent = audit.compare(baseline, candidate) + need(independent["status"] == "PASS", "independent audit failed") + controls = [] + + def rejects(name, action): + try: + action() + except (ValueError, checker.Reject): + controls.append(name) + else: + raise ValueError("negative control accepted: " + name) + + def same_a(word): + need(scalar(word["A"], n) == scalar(baseline["A"], n), "A operator mismatch") + + missing = copy.deepcopy(candidate) + missing["A"].pop() + rejects("missing star restoration", lambda: same_a(missing)) + need(audit.compare(baseline, missing)["status"] == "FAIL", "independent audit missed restoration failure") + wrong = copy.deepcopy(candidate) + begin = len(baseline["A"]) - 9 + len(stars) + hub, leaves = stars[0] + index = next(i for i, g in enumerate(baseline["A"][-9:]) if hub in g[2]) + wrong["A"][begin + index][2] = sorted(set(wrong["A"][begin + index][2]) ^ {leaves[0]}) + rejects("uncancelled decoder operand", lambda: same_a(wrong)) + need(audit.compare(baseline, wrong)["status"] == "FAIL", "independent audit missed decoder failure") + stale = copy.deepcopy(candidate) + stale["C"] = baseline["C"] + checker.Word(stale).full() + rejects("scalar-valid nonliteral cleanup", lambda: need( + checker.Word(stale).interface()[0]["H4_C_literal_reverse_at_full"], "H4 mismatch")) + early = copy.deepcopy(candidate) + early["A"][len(baseline["A"]) - 9][0] = next(i for i, f in enumerate(baseline["frames"]) if not f) + rejects("unpaid frame-zero preparation", lambda: checker.Word(early).full()) + rejects("retained register used as hub", lambda: construct(baseline, [[baseline["ret"][0], leaves]])) + rejects("overlapping stars", lambda: construct(baseline, stars + [stars[0]])) + dirty = copy.deepcopy(candidate) + dirty["D"][0][2].pop() + rejects("missing dirty compensation", lambda: checker.Word(dirty).full()) + raw = copy.deepcopy(baseline) + raw["A"][0][2] = [] + rejects("changed source word", lambda: check_pins(raw)) + # This three-register restriction separates stars from disjoint pairs. + group = [515, 489, 347] + need([group[0], group[1:]] in stars, "separating star absent") + rows = [set(g[2]) for g in baseline["A"][-9:]] + weights = [[a, b, sum(1 if b in row else -1 for row in rows if a in row) - 2] + for a in group for b in group if a != b] + star_saving = sum(gain for a, _, gain in weights if a == group[0]) + pair_ceiling = max(0, *(gain for _, _, gain in weights)) + need(star_saving == 4 and pair_ceiling == 2, "three-register separation failed") + report = {"status": "PASS_R420_DECODER_BUNDLES", "assignment_seed": 19, + "search": search, "stars": len(stars), "edges": sum(len(bs) for _, bs in stars), + "columns": n, "decoder_additions_before": sum(len(g[2]) for g in baseline["A"][-9:]), + "decoder_additions_after": sum(len(g[2]) for g in candidate["A"][-(9+2*len(stars)):]), + "native_additions_before": additions(baseline), "native_additions_after": additions(candidate), + "saved_with_cleanup": additions(baseline) - additions(candidate), + "baseline_canonical_sha256": digest(baseline), "candidate_canonical_sha256": digest(candidate), + "original_H1_H5": True, "independent": independent, "negative_controls": controls, + "three_register_separation": {"group": group, "all_oriented_edge_weights": weights, + "star_saving": star_saving, "disjoint_pair_ceiling": pair_ceiling}, + "kappa_claim": "none"} + return candidate, report + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--output", type=Path, help="new directory for reconstructed words and report") + args = parser.parse_args() + need(__debug__, "run without -O: inherited checkers require assertions") + baseline = json.loads(gzip.decompress(WORD.read_bytes())) + check_pins(baseline) + recipe = json.loads((HERE / "recipe.json").read_text()) + need(recipe["seed"] == 19, "assignment seed changed") + stars, search = nominate(baseline, recipe["seed"]) + need(stars == recipe["stars"], "frozen recipe differs from bounded nomination") + need(search == recipe["search"], "search coverage or stopping rule changed") + candidate, report = verify(baseline, stars, search) + need(report == json.loads((HERE / "CERTIFICATE.json").read_text()), "certificate mismatch") + if args.output: + args.output.mkdir(parents=True, exist_ok=False) + for name, word in (("baseline", baseline), ("candidate", candidate)): + (args.output / (name + ".json.gz")).write_bytes(gzip.compress(canonical(word), mtime=0)) + (args.output / "report.json").write_text(json.dumps(report, indent=2) + "\n") + print("PASS_R420_DECODER_BUNDLES decoder=321->257 native_ADDs=26916->26788 saved=128 columns=660 controls=8 no_new_kappa") + + +if __name__ == "__main__": + main() From 2b30b63789f6d9948233fc67d9d79bca6b185c5b Mon Sep 17 00:00:00 2001 From: Sagar Thakrar Date: Tue, 13 Oct 2026 10:37:55 +0530 Subject: [PATCH 2/2] Record decoder-star sprint handoff and PR link --- research/r420-decoder-bundles/CLAIM.md | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/research/r420-decoder-bundles/CLAIM.md b/research/r420-decoder-bundles/CLAIM.md index 9b4c60c795..16554d87e3 100644 --- a/research/r420-decoder-bundles/CLAIM.md +++ b/research/r420-decoder-bundles/CLAIM.md @@ -10,3 +10,32 @@ - Three candidates considered: phase-B block resynthesis, phase-A quad synthesis, and decoder bundles. PR670/674/688 cover block rewrites and PR691 covers quad synthesis. Bundles change the search class beyond PR708's pair matching. - Coordination check: GitHub pinnedIssues returned an empty list; no separate issue opened. Open PR metadata inspected through PR720. PR708 is the direct predecessor and will be credited and pinned; PR686/694 cover frame-zero compensation, a different circuit. - Contributor: Sagar Thakrar (@thakrarsagar), with substantial OpenAI Codex assistance. Apache-2.0. + +## Completed result, 2026-10-13 05:07 UTC + +[PR753](https://github.com/CrocSwap/integer-mult-bounds/pull/753) contains one +finite bit-circuit construction. Eleven restored stars save 128 native ADDs, +including every preparation/restoration and literal cleanup, preserving the +complete A operator and D. The nine-stage C++ replay passes 1,380 columns and +18/18 omitted-bridge controls for both words; payload grows from 100 to 103 bits, +below 104. No new kappa or complete hosted invoice is claimed. + +The initial optimistic three-operand screen was replaced by exact partial-row +accounting, giving additive star-edge costs. The single accepted nomination +covers all 6,320 oriented edges on 80 operands, then one seed-19 greedy star +packing; its frozen coverage and stopping rule are checked. A three-register +witness separates stars from disjoint pairs on the same registers. + +Final overlap refresh through #751 found no duplicate fixed-A decoder-star +contribution. PR708's head remained `2ec522a466ec448f148d4355dc43b51c0ef1e0b5`. +PR748 at `0ccc0b425d2b9667108d3a0918a5cfa0aa7a5861` has larger savings via a +changed dirt map and recomputed D; it is credited rather than superseded. +PR733/742 change D bases. Their savings are not added here. Main remained at +the exact base above and the pinned-issue query was still empty. + +Implementation and nomination were frozen before the final review and handoff. +Final verification included a relocated minimal archive, eight built-in controls, +an altered-coverage rejection, selected-record integrity, and staged whitespace. +The separate AI review's metadata-binding and proof-wording findings were fixed. +Full hosted/outer assembly, repository-wide verification, remote CI and full +theorem formalization remain outside this contribution.