diff --git a/research/heterogeneous-output-pair-seed7557/CERTIFICATE.json b/research/heterogeneous-output-pair-seed7557/CERTIFICATE.json new file mode 100644 index 0000000000..c3c4ca7eb9 --- /dev/null +++ b/research/heterogeneous-output-pair-seed7557/CERTIFICATE.json @@ -0,0 +1,555 @@ +{ + "schema": "heterogeneous-output-pair-v1", + "source": { + "path": "research/universal-connector-boundary/CERTIFICATE.json", + "sha256": "e733746ba3e5151c829b4e8728bfff5ae3ed24d8d203eb77c735d20758e8266a" + }, + "operation": "AP(i,k,z): y_i += A_i z; y_k += A_k z", + "contract": "distinct targets; arbitrary independent binary-linear A maps; arbitrary dirty connector and targets; both A child evaluations and writes are paid", + "small_fixture": { + "source_word": [ + 0, + 1, + 0, + 1 + ], + "prefix_states": [ + 0, + 1, + 3, + 2, + 0 + ], + "output_masks": [ + 1, + 2, + 3 + ], + "readout_slots": [ + [ + 0, + 1 + ], + [ + 0, + 3 + ], + [ + 0, + 2 + ] + ], + "events_by_boundary": [ + { + "boundary": 0, + "events": [ + [ + "P", + 0, + 1 + ], + [ + "A", + 2 + ] + ] + }, + { + "boundary": 1, + "events": [ + [ + "A", + 0 + ] + ] + }, + { + "boundary": 2, + "events": [ + [ + "A", + 2 + ] + ] + }, + { + "boundary": 3, + "events": [ + [ + "A", + 1 + ] + ] + } + ], + "root_events_including_sources": 9 + }, + "five_source_fixture": { + "source_word": [ + 0, + 1, + 2, + 0, + 3, + 1, + 4, + 2, + 3, + 4 + ], + "prefix_states": [ + 0, + 1, + 3, + 7, + 6, + 14, + 12, + 28, + 24, + 16, + 0 + ], + "output_masks": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31 + ], + "target_id_to_mask": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31 + ], + "readout_slots": [ + [ + 0, + 1 + ], + [ + 1, + 2 + ], + [ + 0, + 2 + ], + [ + 2, + 3 + ], + [ + 2, + 4 + ], + [ + 0, + 4 + ], + [ + 0, + 3 + ], + [ + 4, + 5 + ], + [ + 3, + 5 + ], + [ + 4, + 6 + ], + [ + 3, + 6 + ], + [ + 0, + 6 + ], + [ + 1, + 6 + ], + [ + 0, + 5 + ], + [ + 1, + 5 + ], + [ + 0, + 9 + ], + [ + 1, + 9 + ], + [ + 5, + 7 + ], + [ + 2, + 9 + ], + [ + 6, + 8 + ], + [ + 0, + 1, + 6, + 8 + ], + [ + 4, + 9 + ], + [ + 3, + 9 + ], + [ + 0, + 8 + ], + [ + 1, + 8 + ], + [ + 4, + 7 + ], + [ + 2, + 8 + ], + [ + 0, + 7 + ], + [ + 1, + 7 + ], + [ + 4, + 8 + ], + [ + 2, + 7 + ] + ], + "events_by_boundary": [ + { + "boundary": 0, + "events": [ + [ + "P", + 0, + 2 + ], + [ + "P", + 5, + 6 + ], + [ + "P", + 11, + 13 + ], + [ + "P", + 15, + 20 + ], + [ + "P", + 23, + 27 + ] + ] + }, + { + "boundary": 1, + "events": [ + [ + "P", + 0, + 1 + ], + [ + "P", + 12, + 14 + ], + [ + "P", + 16, + 20 + ], + [ + "P", + 24, + 28 + ] + ] + }, + { + "boundary": 2, + "events": [ + [ + "P", + 1, + 2 + ], + [ + "P", + 3, + 4 + ], + [ + "P", + 18, + 26 + ], + [ + "A", + 30 + ] + ] + }, + { + "boundary": 3, + "events": [ + [ + "P", + 3, + 6 + ], + [ + "P", + 8, + 10 + ], + [ + "A", + 22 + ] + ] + }, + { + "boundary": 4, + "events": [ + [ + "P", + 4, + 5 + ], + [ + "P", + 7, + 9 + ], + [ + "P", + 21, + 25 + ], + [ + "A", + 29 + ] + ] + }, + { + "boundary": 5, + "events": [ + [ + "P", + 7, + 8 + ], + [ + "P", + 13, + 14 + ], + [ + "A", + 17 + ] + ] + }, + { + "boundary": 6, + "events": [ + [ + "P", + 9, + 10 + ], + [ + "P", + 11, + 12 + ], + [ + "P", + 19, + 20 + ] + ] + }, + { + "boundary": 7, + "events": [ + [ + "P", + 17, + 25 + ], + [ + "P", + 27, + 28 + ], + [ + "A", + 30 + ] + ] + }, + { + "boundary": 8, + "events": [ + [ + "P", + 19, + 20 + ], + [ + "P", + 23, + 24 + ], + [ + "P", + 26, + 29 + ] + ] + }, + { + "boundary": 9, + "events": [ + [ + "P", + 15, + 16 + ], + [ + "P", + 18, + 21 + ], + [ + "A", + 22 + ] + ] + } + ], + "source_events": 10, + "paired_output_events": 29, + "singleton_output_events": 6, + "output_map_evaluations_and_target_writes": 64, + "root_events": 45, + "complete_map_child_calls": 74 + }, + "descriptor_model": { + "event_tag_bits": 2, + "tag_codes": { + "B": "00", + "A": "01", + "AP": "10" + }, + "source_id_bits": 3, + "output_id_bits": 5, + "unpaired_bits": 498, + "paired_bits": 440 + }, + "complete_cost_delta": "29 * (d_pair - 2*d_A - 2*s)", + "definitions": { + "s": "fully charged stored/read descriptor-bit cost", + "d_A": "ordinary top-level output-event dispatch cost", + "d_pair": "pair-event dispatch, decode, routing and transitions, excluding its 12 descriptor bits and its two complete A children" + }, + "break_even": "d_pair < 2*d_A + 2*s", + "scope": "finite connector interface construction; no selected supplier or kappa claim" +} diff --git a/research/heterogeneous-output-pair-seed7557/README.md b/research/heterogeneous-output-pair-seed7557/README.md new file mode 100644 index 0000000000..48c31a24cc --- /dev/null +++ b/research/heterogeneous-output-pair-seed7557/README.md @@ -0,0 +1,147 @@ +# Heterogeneous paired-output events at a dirty connector + +**Result.** At one connector boundary, an explicit event +`AP(i,k,z): y_i += A_i z; y_k += A_k z` can packetize two distinct output +readouts with arbitrary independent maps. The exact five-source, 31-output +schedule in the pinned universal-connector certificate has 64 output-map +readouts. Pairing targets that share a boundary gives 29 pair events and six +single events. Including the ten unchanged source events, the root event stream +shrinks from 74 events to 45. It still performs all 74 complete map-child +executions and all 64 target writes. + +The maps are arbitrary binary-linear maps, including singular maps, with no +relation assumed between different `A_i`. The pair handler sequentially runs +both complete child calls at the current boundary; each leaves the connector +unchanged, and the target rows are distinct. The operation shares the +connector value and event packet only. It does not share either `A` evaluation. +A fixed descriptor encoding saves 58 bits. The complete-cost improvement is +conditional on the pair event's dispatch, decode, routing and transition bill. +No selected supplier or new `kappa` is claimed. + +## Pins and reproduction + +- Base commit: `0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2`. +- Selected record: `836330098538459/500000000000000000`, SHA-256 + `10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32`. Its + review is `docs/research/community-batch1099-review.md`, source manifest is + `research/community-frontier1094-audit/SELECTED-SOURCE.json`, certificate is + `research/community-frontier1094-audit/ASSEMBLY.json`, and canonical reproduction + is `make frontier1094-verify` (not run for this connector-only contribution). +- Live schedule input: `research/universal-connector-boundary/CERTIFICATE.json`, + SHA-256 `e733746ba3e5151c829b4e8728bfff5ae3ed24d8d203eb77c735d20758e8266a`. + +Run from the repository root: + +```sh +python3 -I -B research/heterogeneous-output-pair-seed7557/verify.py +python3 scripts/research_package.py --package research/heterogeneous-output-pair-seed7557 --check-only +python3 scripts/research_package.py --package research/heterogeneous-output-pair-seed7557 +``` + +The first command should print: + +```text +PASS_HETEROGENEOUS_OUTPUT_PAIR n2_scalar_cases=2048 n2_events=9 five_source_pairs=29 singles=6 root_events=45 child_calls=74 descriptor_bits=498->440 +``` + +The source-pinned control separately passes as +`PASS_UNIVERSAL_CONNECTOR_BOUNDARY pairings=945 max_coverage=31 queries=74 leaves=182`. +The package verifier checks the control certificate hash and recomputes the +paired schedule from its contents. + +## Exact dirty-state identity + +Work over `F2` with arbitrary dirty source rows `x_j`, connector `z_0`, and +output rows `y_m`. The source events update + +```text +z <- z + B_j x_j. +``` + +Let `q_t` be the five-bit parity vector of source toggles before boundary `t`. +Then `z_t = z_0 + sum_j (q_t)_j B_j x_j`. The fixed certificate assigns each +output mask `m` an even set `T_m` of readout boundaries (two boundaries for 30 +masks and four for mask 21), with `xor_{t in T_m} q_t = m`. Therefore + +```text +y_m(final) + = y_m(initial) + sum_{t in T_m} A_m z_t + = y_m(initial) + A_m sum_{j:m_j=1} B_j x_j. +``` + +The dirty connector term cancels because `|T_m|` is even. Every source label +appears twice, so the final connector is `z_0`. An `AP(i,k,z)` event is just +the two independent additions at the same `z_t`, grouped in one event packet; +expanding it restores the original readout order. The verifier checks that +expansion exactly matches all 64 readouts, and rejects any packet with a missing +row, a row at the wrong boundary, or an aliased pair of targets. These are exact +algebraic identities for arbitrary linear maps; the 2,048 scalar cases exercise +the smallest instance across every map, input and dirty-state choice. + +For the minimal fixture, `B0 B1 B0 B1` has prefixes `0,1,3,2,0`. Masks 1, 2, +and 3 read at boundary pairs `(0,1)`, `(0,3)`, and `(0,2)`. Pairing masks 1 +and 2 at boundary zero yields nine root events including the four source +updates; it still executes six A children and six writes. The verifier exhausts +every scalar `A/B` map, source value, dirty connector and dirty target for this +fixture. + +## Fully charged event budget + +Keep the complete child bill fixed: + +```text +C_child = P + 2 * sum_j c(B_j) + sum_m r_m * c(A_m), +``` + +where `r_m` is the source schedule's readout count (two, except four for mask +21). Each `c(A_m)` includes its map computation, target read/write, private +scratch restoration, head return and required frames. All 64 output-map +executions remain in `C_child`; the ten source calls and one-time preparation +also remain unchanged. + +The event stream uses implicit boundary order and a fixed 2-bit event tag: +`00` for a source event, `01` for a singleton output, and `10` for a paired +output. Source IDs use 3 bits and output IDs use 5 bits. A source event costs +5 bits, a single output event 7 bits, and a pair event 12 bits. Thus + +```text +unpaired descriptors = 10*(2+3) + 64*(2+5) = 498 bits +paired descriptors = 10*(2+3) + 6*(2+5) + 29*(2+5+5) = 440 bits. +``` + +Let `s` be the fully charged cost per stored/read descriptor bit. Let `d_B` +and `d_A` be the ordinary top-level source and output dispatch costs, excluding +their descriptors and complete children. Let `d_pair` include the pair handler, +decoding both IDs, routing both targets and every extra interface transition, +while excluding the 12 descriptor bits and the two complete A children. The +full invoices are + +```text +C_unpaired = C_child + 10*(d_B + 5*s) + 64*(d_A + 7*s) +C_pair = C_child + 10*(d_B + 5*s) + 6*(d_A + 7*s) + 29*(d_pair + 12*s). +``` + +Source events cancel, so + +```text +C_pair - C_unpaired = 29 * (d_pair - 2*d_A - 2*s). +``` + +The pair is favorable exactly when `d_pair < 2*d_A + 2*s`. This fully charges +both output maps and target writes. At `d_pair = 2*d_A`, the descriptor saving +alone lowers the bill by `58*s`; a pair-specific surcharge above that must be +less than `2*s` per pair to preserve a gain. This is a parameterized interface +result, not a measured machine tariff. It does not reduce the paid recursive +moment unless an actual caller's `d_pair`, `d_A`, and `s` satisfy the inequality. + +## Overlap and attribution + +The nearest live connector claim is [Discussion #2221](https://github.com/CrocSwap/integer-mult-bounds/discussions/2221), which studies a seven-source mask family under the original single-output alphabet. [PR #2182](https://github.com/CrocSwap/integer-mult-bounds/pull/2182) concerns fixed-port and two-root/frame boundaries. [PR #2201](https://github.com/CrocSwap/integer-mult-bounds/pull/2201) adds a source-side arity-four call; [PR #2128](https://github.com/CrocSwap/integer-mult-bounds/pull/2128) adds source-side DUO calls. The local [common-A broadcast package](../common-a-broadcast-readout-seed4a52/README.md) shares one A evaluation across rows, which is unavailable for arbitrary independent `A_i`. The local [two-projection connector package](../two-projection-connector-seed51a5/README.md) changes a helper frame and does not add this output operation. This finite construction is distinct in its operation and hypothesis; the overlap scan is not a novelty guarantee. + +The source contract and five-source schedule descend from the universal dirty-connector boundary work, which extends [PR934's three-by-three result](../universal-connector-boundary/references/PR934-README.md). This package changes the output event wrapper only and copies no predecessor implementation. + +## Open next questions + +- **Can a caller pay for the pair dispatcher below the break-even threshold?** This matters because the exact descriptor reduction reaches a recursive cost only with a real interface. First locate two independent output maps reading the same live connector at one selected-supplier boundary and invoice the pair handler and routing. Blocker: no selected supplier currently declares this dispatcher or its tariff. + +Prepared by Cinna Davis with substantial OpenAI Codex assistance in mathematical scoping, construction, exact replay, cost accounting and writing. No independent human review, supplier admission, physical benchmark, selected-frontier change or `kappa` improvement is claimed. diff --git a/research/heterogeneous-output-pair-seed7557/SOURCES.json b/research/heterogeneous-output-pair-seed7557/SOURCES.json new file mode 100644 index 0000000000..bc70317ae9 --- /dev/null +++ b/research/heterogeneous-output-pair-seed7557/SOURCES.json @@ -0,0 +1,24 @@ +{ + "schema_version": 1, + "base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "e8870e5917057d59b730eb14721a778639eca050", + "sha256": "d46eb6d5b3e279428753d770653663fbdf1063e55c255ea073d768f344927ef7" + }, + { + "path": "research/universal-connector-boundary/CERTIFICATE.json", + "usage": "input", + "git_blob": "079e3e1441dc07c2f0536e9527acf290e51ea9c0", + "sha256": "e733746ba3e5151c829b4e8728bfff5ae3ed24d8d203eb77c735d20758e8266a" + } + ] +} diff --git a/research/heterogeneous-output-pair-seed7557/TASK.json b/research/heterogeneous-output-pair-seed7557/TASK.json new file mode 100644 index 0000000000..6f20964731 --- /dev/null +++ b/research/heterogeneous-output-pair-seed7557/TASK.json @@ -0,0 +1,133 @@ +{ + "schema_version": 1, + "task_id": "connector-alphabet-change", + "priority_revision": 4, + "base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "original_card": { + "id": "connector-alphabet-change", + "question": "Does one explicit extension of the connector alphabet offer a favorable completed budget?", + "starting_points": [ + "research/universal-connector-boundary/README.md", + "certificates/selected-result.json" + ], + "methods": [ + "Construct and charge a legal extra operation on a minimal instance.", + "Prove a target-specific bound after adding one specified operation family." + ], + "acceptance_gate": "State which fixed-alphabet premise changes and charge its implementation; do not declare it free.", + "first_step": { + "command": [ + "python3", + "-B", + "research/universal-connector-boundary/verify.py" + ], + "expected": "PASS_UNIVERSAL_CONNECTOR_BOUNDARY", + "inspect": "Reproduce the 945-pairing control, then read Exact interface to list the allowed calls.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "Add exactly one legally priced operation and test a tiny dirty-input instance before enumerating larger cases.", + "bottleneck_link": "A new legal connector operation could change recursive interface cost; a larger census in the same alphabet is a separate side result.", + "allowed_variations": [ + "Choose one additional operation and a small source count for its first counterexample." + ], + "scope_change_triggers": [ + "Keeping the alphabet and only increasing the source count; record this as a changed assignment." + ], + "overlap_terms": [ + "universal connector", + "source-toggle", + "connector alphabet" + ] + }, + "scope_status": "refined", + "actual_scope": "Add a heterogeneous paired-output macro AP_{i,k}(z): independently evaluate arbitrary A_i z and A_k z at the same connector boundary and add to two distinct arbitrary-dirty target rows. Use the source-pinned five-source ten-toggle path and all 31 nonzero output masks. The macro packetizes 29 pairs and six singleton events, while retaining all 74 complete B/A child executions and all 64 target writes.", + "scope_change_reason": "The assigned card asks for one explicitly priced added connector operation. This refines it to a two-target output event with independent A maps, on the existing fixed source path. It does not add common-A sharing, source-side combination, a second connector, or a frame change.", + "bottleneck_link": "The only demonstrated saving is in the root event descriptor and dispatch bill. It could affect a recursive interface only if a caller can execute the paired event with d_pair < 2*d_A + 2*s; no selected supplier placement or kappa gain is established.", + "budget_minutes": 60, + "stop_rule": "Test the n=2 dirty-input fixture before scaling to the pinned n=5 schedule. Stop if a pair cannot retain both complete A child costs and target writes, if packets join targets at different boundaries or alias targets, or if the fully charged event inequality has no favorable price region. Do not claim supplier adoption or kappa.", + "outcome": "completed", + "evidence": "Exact n=2 exhaustive replay covers all 2,048 choices of scalar A/B maps, inputs and dirty connector/target bits. The source-pinned five-source certificate recomputes 29 distinct-target output pairs and six singleton events; expansion is identical to all 64 original readouts. Thus 45 top-level event packets still execute 74 complete map children and 64 target writes. The fixed 2-bit-tag descriptor falls from 498 to 440 bits. The verifier rejects omission, cross-boundary grouping and aliased targets. Exact complete-cost delta and break-even inequality are in README.md and CERTIFICATE.json.", + "author": "Cinna Davis", + "ai_assistance": "Substantial OpenAI Codex assistance in mathematical scoping, construction, exact replay, cost accounting and writing.", + "open_questions": [ + { + "question": "Can a concrete recursive caller expose AP_{i,k} with d_pair below 2*d_A+2*s?", + "why_it_matters": "Only a measured caller-specific inequality can turn the exact descriptor saving into a paid recursive-interface improvement.", + "first_step": "Locate two independent output maps reading the same live connector value in one selected-supplier boundary, then charge the pair dispatcher and target routing against two ordinary event dispatches.", + "blocked_by": "No selected supplier currently declares a paired-output dispatcher or its decode/transition tariff." + } + ], + "accepted_seed": "7557a8c485dcac30165483ba39aa22f6", + "selector_scope_key": "ff4f5113ed2256ab19ed", + "refined_scope_key": "beea7c7212c07047d4d2", + "catalogue_sha256": "d46eb6d5b3e279428753d770653663fbdf1063e55c255ea073d768f344927ef7", + "selected_record_sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32", + "selected_record_kappa": "836330098538459/500000000000000000", + "overlap": { + "checked_at": "2026-10-15T00:45:28Z", + "refresh": { + "open_prs": { + "complete_pagination": true, + "records": 463, + "fetched_at": "2026-10-15T00:43:30Z" + }, + "discussions_comments_replies": { + "complete_pagination": true, + "records": 918, + "fetched_at": "2026-10-15T00:45:28Z" + }, + "warnings": [], + "helper": "python3 scripts/find_overlap.py --task connector-alphabet-change --refresh --json" + }, + "direct_checks": "Inspected Discussion #2221 claim body and latest 60 updated Discussion bodies; ran live PR searches for paired output connector, multi-target readout, and output DUO; fetched current #2182, #2201 and #2128 descriptions/heads. The overlap helper surfaced #2128; direct checks distinguish the other nearby work.", + "closest_work": [ + { + "ref": "Discussion #2221", + "seed": "7db30a45a4ca218f66c410637c8459f3", + "scope": "Seven-source weight-1/2/3 output-mask family retaining the original single-output readout alphabet." + }, + { + "ref": "PR #2182", + "head": "dc252de1cc594829c3031abdb4de104713bc474a", + "scope": "Fixed-port and two-root connector/frame boundaries; no heterogeneous pair-output event." + }, + { + "ref": "PR #2201", + "head": "21fee7f7fb9ed42298ee998dbc120e684ca7fb71", + "scope": "Source-side arity-four bundle." + }, + { + "ref": "PR #2128", + "head": "697369a971eed02c0fbcd75ebefec9f59945f08e", + "scope": "Source-side DUO calls." + }, + { + "ref": "research/common-a-broadcast-readout-seed4a52", + "scope": "Shares one common A evaluation across outputs; this work pays two independent A evaluations." + }, + { + "ref": "research/two-projection-connector-seed51a5", + "scope": "Changes a second helper/frame and uses two projections; this does not add this output event." + } + ], + "novelty_limit": "Overlap searches are leads, not proof that no related contribution exists." + }, + "claim_url": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1167#discussioncomment-18937098", + "refined_scope_key_basis": "First 20 hex digits of SHA-256 over the UTF-8 string connector-alphabet-change|heterogeneous paired-output AP_{i,k}|arbitrary independent A_i,A_k|fixed five-source ten-toggle word|29 boundary pairs|fully charged descriptor and dispatch inequality.", + "selected_chain": { + "review": { + "path": "docs/research/community-batch1099-review.md", + "sha256": "7e76d2c38e5fce30587835b7251df1430488ae4dd372611ef69a3f03f476b6cb" + }, + "source_manifest": { + "path": "research/community-frontier1094-audit/SELECTED-SOURCE.json", + "sha256": "79b3de5db3dbcb9829789ba58e9e45758926031e2a7d80667a08429d369be53b" + }, + "assembly_certificate": { + "path": "research/community-frontier1094-audit/ASSEMBLY.json", + "sha256": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045" + }, + "reproduce": "make frontier1094-verify", + "executed_this_cycle": false + } +} diff --git a/research/heterogeneous-output-pair-seed7557/VERIFY.json b/research/heterogeneous-output-pair-seed7557/VERIFY.json new file mode 100644 index 0000000000..74f7c00a6f --- /dev/null +++ b/research/heterogeneous-output-pair-seed7557/VERIFY.json @@ -0,0 +1,20 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/universal-connector-boundary/CERTIFICATE.json" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Recompute source-bound n=2 and five-source packet schedules; exhaust all scalar dirty-state cases for n=2; check output expansion, descriptor arithmetic, and omission/cross-boundary/alias controls." + } + ] +} diff --git a/research/heterogeneous-output-pair-seed7557/verify.py b/research/heterogeneous-output-pair-seed7557/verify.py new file mode 100644 index 0000000000..78bb15456e --- /dev/null +++ b/research/heterogeneous-output-pair-seed7557/verify.py @@ -0,0 +1,343 @@ +#!/usr/bin/env python3 +"""Check heterogeneous paired-output packetization and its dirty-state contract.""" +from collections import Counter +import hashlib +import json +from pathlib import Path + +ROOT = Path(__file__).resolve().parent +SOURCE = ROOT.parent / "universal-connector-boundary" / "CERTIFICATE.json" +SOURCE_SHA256 = "e733746ba3e5151c829b4e8728bfff5ae3ed24d8d203eb77c735d20758e8266a" +FIVE_WORD = [0, 1, 2, 0, 3, 1, 4, 2, 3, 4] + + +def need(condition, message): + if not condition: + raise ValueError(message) + + +def prefix_states(word): + states = [0] + for label in word: + states.append(states[-1] ^ (1 << label)) + return states + + +def endpoints(word, masks): + states = prefix_states(word) + result = {} + for mask in masks: + found = next(((i, j) for i in range(len(states)) + for j in range(i + 1, len(states)) + if states[i] ^ states[j] == mask), None) + need(found is not None, f"mask {mask} has no paired readout") + result[mask] = found + return result + + +def pair_count(counts): + total = sum(counts.values()) + return min(total // 2, total - max(counts.values(), default=0)) + + +def maximum_pairs(counts): + """Return a maximum matching in a complete graph with colored vertices.""" + remaining = Counter(counts) + pairs = [] + while True: + live = [label for label, count in remaining.items() if count] + if len(live) < 2: + break + live.sort(key=lambda label: (-remaining[label], label)) + left, right = live[:2] + pairs.append(tuple(sorted((left, right)))) + remaining[left] -= 1 + remaining[right] -= 1 + need(len(pairs) == pair_count(counts), "pair matching is not maximum") + return sorted(pairs) + + +def boundary_targets(readout_slots): + slots = [Counter() for _ in range(max(max(x) for x in readout_slots) + 1)] + for target, endpoints_ in enumerate(readout_slots): + for boundary in endpoints_: + slots[boundary][target] += 1 + return slots + + +def make_packets(slots): + packets = [] + for counts in slots: + pairs = maximum_pairs(counts) + used = Counter(label for pair in pairs for label in pair) + singles = [] + for target, count in sorted(counts.items()): + singles.extend([target] * (count - used[target])) + packets.append([("P", left, right) for left, right in pairs] + + [("A", target) for target in singles]) + return packets + + +def validate_packets(packets, slots): + need(len(packets) == len(slots), "packet boundary count mismatch") + for boundary, (events, expected) in enumerate(zip(packets, slots)): + observed = Counter() + for event in events: + if event[0] == "A": + need(len(event) == 2, f"malformed singleton at boundary {boundary}") + observed[event[1]] += 1 + elif event[0] == "P": + need(len(event) == 3, f"malformed pair at boundary {boundary}") + left, right = event[1:] + need(left != right, "paired targets must be distinct") + observed[left] += 1 + observed[right] += 1 + else: + raise ValueError(f"unknown output event {event[0]}") + need(observed == expected, + f"boundary {boundary} output inventory mismatch: {observed} != {expected}") + + +def expand_packets(packets): + expanded = [] + for events in packets: + row = [] + for event in events: + if event[0] == "A": + row.append(("A", event[1])) + elif event[0] == "P": + row.extend(("A", target) for target in event[1:]) + else: + raise ValueError(f"unknown output event {event[0]}") + expanded.append(sorted(row, key=lambda event: event[1])) + return expanded + + +def scalar_replay(events, source_masks, b_maps, a_maps, sources, connector, targets): + """One-bit F2 interpreter; event tuples are B, A or P.""" + z = connector + ys = list(targets) + for event in events: + if event[0] == "B": + j = event[1] + z ^= b_maps[j] & sources[j] + elif event[0] == "A": + i = event[1] + ys[i] ^= a_maps[i] & z + elif event[0] == "P": + i, k = event[1:] + need(i != k, "paired targets must be distinct") + ys[i] ^= a_maps[i] & z + ys[k] ^= a_maps[k] & z + else: + raise ValueError(f"unknown scalar event {event[0]}") + expected = list(targets) + for i, mask in enumerate(source_masks): + signal = 0 + for j in range(len(sources)): + if mask & (1 << j): + signal ^= b_maps[j] & sources[j] + expected[i] ^= a_maps[i] & signal + return z, ys, expected + + +def flatten_at_boundaries(packets, source_word): + events = [] + for boundary, outputs in enumerate(packets): + events.extend(outputs) + if boundary < len(source_word): + events.append(("B", source_word[boundary])) + return events + + +def build_certificate(certificate): + item = certificate["schedules"]["five_extra_output"] + slots = boundary_targets(item["readout_slots"]) + packets = make_packets(slots) + five_events = [] + for boundary, outputs in enumerate(packets): + five_events.append({"boundary": boundary, + "events": [list(event) for event in outputs]}) + + small_word = [0, 1, 0, 1] + small_masks = [1, 2, 3] + small_ends = endpoints(small_word, small_masks) + small_slots = boundary_targets([list(small_ends[m]) for m in small_masks]) + small_packets = make_packets(small_slots) + small_events = [] + for boundary, outputs in enumerate(small_packets): + small_events.append({"boundary": boundary, + "events": [list(event) for event in outputs]}) + + readouts = sum(sum(counts.values()) for counts in slots) + pair_count_ = sum(event[0] == "P" for events in packets for event in events) + singleton_count = sum(event[0] == "A" for events in packets for event in events) + source_events = len(item["source_word"]) + return { + "schema": "heterogeneous-output-pair-v1", + "source": { + "path": "research/universal-connector-boundary/CERTIFICATE.json", + "sha256": SOURCE_SHA256, + }, + "operation": "AP(i,k,z): y_i += A_i z; y_k += A_k z", + "contract": "distinct targets; arbitrary independent binary-linear A maps; arbitrary dirty connector and targets; both A child evaluations and writes are paid", + "small_fixture": { + "source_word": small_word, + "prefix_states": prefix_states(small_word), + "output_masks": small_masks, + "readout_slots": [list(small_ends[m]) for m in small_masks], + "events_by_boundary": small_events, + "root_events_including_sources": len(small_word) + sum( + len(events) for events in small_packets), + }, + "five_source_fixture": { + "source_word": item["source_word"], + "prefix_states": prefix_states(item["source_word"]), + "output_masks": item["rows"], + "target_id_to_mask": list(range(1, 32)), + "readout_slots": item["readout_slots"], + "events_by_boundary": five_events, + "source_events": source_events, + "paired_output_events": pair_count_, + "singleton_output_events": singleton_count, + "output_map_evaluations_and_target_writes": readouts, + "root_events": source_events + pair_count_ + singleton_count, + "complete_map_child_calls": source_events + readouts, + }, + "descriptor_model": { + "event_tag_bits": 2, + "tag_codes": {"B": "00", "A": "01", "AP": "10"}, + "source_id_bits": 3, + "output_id_bits": 5, + "unpaired_bits": source_events * 5 + readouts * 7, + "paired_bits": source_events * 5 + singleton_count * 7 + pair_count_ * 12, + }, + "complete_cost_delta": "29 * (d_pair - 2*d_A - 2*s)", + "definitions": { + "s": "fully charged stored/read descriptor-bit cost", + "d_A": "ordinary top-level output-event dispatch cost", + "d_pair": "pair-event dispatch, decode, routing and transitions, excluding its 12 descriptor bits and its two complete A children", + }, + "break_even": "d_pair < 2*d_A + 2*s", + "scope": "finite connector interface construction; no selected supplier or kappa claim", + } + + +def expect_reject(label, thunk): + try: + thunk() + except (AssertionError, ValueError): + return + raise ValueError(f"negative control accepted: {label}") + + +def main(): + source_bytes = SOURCE.read_bytes() + need(hashlib.sha256(source_bytes).hexdigest() == SOURCE_SHA256, + "source certificate hash mismatch") + certificate = json.loads(source_bytes) + expected_package_certificate = build_certificate(certificate) + package_certificate = json.loads((ROOT / "CERTIFICATE.json").read_text()) + need(package_certificate == expected_package_certificate, + "package certificate differs from the recomputed pinned schedule") + item = certificate["schedules"]["five_extra_output"] + need(item["source_word"] == FIVE_WORD, "pinned five-source word changed") + need(Counter(FIVE_WORD) == Counter({j: 2 for j in range(5)}), + "each source map must occur exactly twice") + need(item["queries"] == 74, "pinned source query total changed") + need(certificate["lowered"]["five_extra_output"]["leaf_calls"] == 182, + "pinned lowered leaf total changed") + + # Smallest meaningful instance: all three nonzero masks on n=2. + small_word = [0, 1, 0, 1] + small_masks = [1, 2, 3] + small_ends = endpoints(small_word, small_masks) + need(small_ends == {1: (0, 1), 2: (0, 3), 3: (0, 2)}, + "n=2 endpoint fixture changed") + small_slots = boundary_targets([list(small_ends[m]) for m in small_masks]) + small_packets = make_packets(small_slots) + validate_packets(small_packets, small_slots) + small_events = flatten_at_boundaries(small_packets, small_word) + need(sum(e[0] == "P" for e in small_events) == 1, + "n=2 fixture must use one paired output event") + need(len(small_events) == 9, "n=2 event count mismatch") + + # Exhaust every scalar linear map and every dirty/input bit in n=2. + scalar_cases = 0 + for b0 in range(2): + for b1 in range(2): + for a0 in range(2): + for a1 in range(2): + for a2 in range(2): + for x0 in range(2): + for x1 in range(2): + for z0 in range(2): + for y0 in range(2): + for y1 in range(2): + for y2 in range(2): + z, ys, expected = scalar_replay( + small_events, small_masks, + [b0, b1], [a0, a1, a2], + [x0, x1], z0, [y0, y1, y2]) + need(z == z0, "small dirty connector not restored") + need(ys == expected, "small arbitrary-dirty map identity failed") + scalar_cases += 1 + need(scalar_cases == 2048, "scalar exhaustive domain incomplete") + + # Max-cardinality grouping on the pinned 31-output schedule. + need(item["rows"] == list(range(1, 32)), "output mask set changed") + need(all(len(slot) in (2, 4) for slot in item["readout_slots"]), + "base outputs must have paired readouts") + need(Counter(map(len, item["readout_slots"])) == Counter({2: 30, 4: 1}), + "expected 30 two-read outputs and one four-read output") + for row, slot in zip(item["rows"], item["readout_slots"]): + states = prefix_states(FIVE_WORD) + value = 0 + for boundary in slot: + value ^= states[boundary] + need(value == row, f"row {row} endpoint difference mismatch") + slots = boundary_targets(item["readout_slots"]) + packets = make_packets(slots) + validate_packets(packets, slots) + expanded = expand_packets(packets) + canonical_original = [sorted(("A", target) for target, ends in enumerate(item["readout_slots"]) + if boundary in ends) + for boundary in range(len(slots))] + need(expanded == canonical_original, "paired packets do not expand to the exact readout schedule") + pairs = sum(event[0] == "P" for events in packets for event in events) + singles = sum(event[0] == "A" for events in packets for event in events) + readouts = sum(len(events) for events in canonical_original) + source_events = len(FIVE_WORD) + root_events = source_events + pairs + singles + child_calls = source_events + readouts + need((pairs, singles, readouts, root_events, child_calls) == (29, 6, 64, 45, 74), + "five-source packet inventory changed") + + # Meaningful corruptions: omission, moving a pair across a boundary, and aliasing. + omitted = [list(events) for events in packets] + omitted[0].pop(0) + expect_reject("omitted output", lambda: validate_packets(omitted, slots)) + moved = [list(events) for events in packets] + pair = next(event for event in moved[0] if event[0] == "P") + moved[0].remove(pair) + moved[1].append(pair) + expect_reject("wrong boundary", lambda: validate_packets(moved, slots)) + aliased = [list(events) for events in packets] + aliased[0][0] = ("P", 0, 0) + expect_reject("aliased targets", lambda: validate_packets(aliased, slots)) + + # Fixed-width instruction invoice: 2-bit event tag, 3-bit B ID, 5-bit A ID. + unpaired_bits = source_events * (2 + 3) + readouts * (2 + 5) + paired_bits = source_events * (2 + 3) + singles * (2 + 5) + pairs * (2 + 10) + need((unpaired_bits, paired_bits, unpaired_bits - paired_bits) == (498, 440, 58), + "fixed-width descriptor invoice changed") + print( + "PASS_HETEROGENEOUS_OUTPUT_PAIR " + f"n2_scalar_cases={scalar_cases} n2_events={len(small_events)} " + f"five_source_pairs={pairs} singles={singles} root_events={root_events} " + f"child_calls={child_calls} descriptor_bits={unpaired_bits}->{paired_bits}" + ) + + +if __name__ == "__main__": + main()