diff --git a/research/gf4-scalar-source-connector-seeda472dd8c/CERTIFICATE.json b/research/gf4-scalar-source-connector-seeda472dd8c/CERTIFICATE.json new file mode 100644 index 0000000000..dcab6f04c2 --- /dev/null +++ b/research/gf4-scalar-source-connector-seeda472dd8c/CERTIFICATE.json @@ -0,0 +1,458 @@ +{ + "format": "gf4-scalar-source-connector-v1", + "seed": "a472dd8c6aee62b83f9dbc2e489790b0", + "base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "selected_record_sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32", + "priority_revision": 4, + "selector_scope_key": "ff4f5113ed2256ab19ed", + "field": { + "definition": "F2[w]/(w^2+w+1)", + "representation": "a+b*w encoded by bits (a,b), code=a+2*b" + }, + "coefficient_encoding": "0=0, 1=1, 2=w, 3=w^2; addition is bitwise XOR", + "source_word": [ + { + "source": 0, + "alpha": 1 + }, + { + "source": 1, + "alpha": 1 + }, + { + "source": 0, + "alpha": 2 + }, + { + "source": 1, + "alpha": 2 + }, + { + "source": 0, + "alpha": 3 + }, + { + "source": 1, + "alpha": 3 + } + ], + "prefix_points": [ + [ + 0, + 0 + ], + [ + 1, + 0 + ], + [ + 1, + 1 + ], + [ + 3, + 1 + ], + [ + 3, + 3 + ], + [ + 0, + 3 + ], + [ + 0, + 0 + ] + ], + "targets": [ + { + "target": 0, + "coefficients": [ + 0, + 1 + ], + "boundaries": [ + 1, + 2 + ] + }, + { + "target": 1, + "coefficients": [ + 0, + 2 + ], + "boundaries": [ + 3, + 4 + ] + }, + { + "target": 2, + "coefficients": [ + 0, + 3 + ], + "boundaries": [ + 0, + 5 + ] + }, + { + "target": 3, + "coefficients": [ + 1, + 0 + ], + "boundaries": [ + 0, + 1 + ] + }, + { + "target": 4, + "coefficients": [ + 1, + 1 + ], + "boundaries": [ + 0, + 2 + ] + }, + { + "target": 5, + "coefficients": [ + 1, + 2 + ], + "boundaries": [ + 2, + 5 + ] + }, + { + "target": 6, + "coefficients": [ + 1, + 3 + ], + "boundaries": [ + 1, + 5 + ] + }, + { + "target": 7, + "coefficients": [ + 2, + 0 + ], + "boundaries": [ + 2, + 3 + ] + }, + { + "target": 8, + "coefficients": [ + 2, + 1 + ], + "boundaries": [ + 1, + 3 + ] + }, + { + "target": 9, + "coefficients": [ + 2, + 2 + ], + "boundaries": [ + 2, + 4 + ] + }, + { + "target": 10, + "coefficients": [ + 2, + 3 + ], + "boundaries": [ + 1, + 4 + ] + }, + { + "target": 11, + "coefficients": [ + 3, + 0 + ], + "boundaries": [ + 4, + 5 + ] + }, + { + "target": 12, + "coefficients": [ + 3, + 1 + ], + "boundaries": [ + 0, + 3 + ] + }, + { + "target": 13, + "coefficients": [ + 3, + 2 + ], + "boundaries": [ + 3, + 5 + ] + }, + { + "target": 14, + "coefficients": [ + 3, + 3 + ], + "boundaries": [ + 0, + 4 + ] + } + ], + "event_stream": [ + { + "kind": "read", + "target": 2, + "boundary": 0 + }, + { + "kind": "read", + "target": 3, + "boundary": 0 + }, + { + "kind": "read", + "target": 4, + "boundary": 0 + }, + { + "kind": "read", + "target": 12, + "boundary": 0 + }, + { + "kind": "read", + "target": 14, + "boundary": 0 + }, + { + "kind": "source", + "source": 0, + "alpha": 1, + "after_boundary": 0 + }, + { + "kind": "read", + "target": 0, + "boundary": 1 + }, + { + "kind": "read", + "target": 3, + "boundary": 1 + }, + { + "kind": "read", + "target": 6, + "boundary": 1 + }, + { + "kind": "read", + "target": 8, + "boundary": 1 + }, + { + "kind": "read", + "target": 10, + "boundary": 1 + }, + { + "kind": "source", + "source": 1, + "alpha": 1, + "after_boundary": 1 + }, + { + "kind": "read", + "target": 0, + "boundary": 2 + }, + { + "kind": "read", + "target": 4, + "boundary": 2 + }, + { + "kind": "read", + "target": 5, + "boundary": 2 + }, + { + "kind": "read", + "target": 7, + "boundary": 2 + }, + { + "kind": "read", + "target": 9, + "boundary": 2 + }, + { + "kind": "source", + "source": 0, + "alpha": 2, + "after_boundary": 2 + }, + { + "kind": "read", + "target": 1, + "boundary": 3 + }, + { + "kind": "read", + "target": 7, + "boundary": 3 + }, + { + "kind": "read", + "target": 8, + "boundary": 3 + }, + { + "kind": "read", + "target": 12, + "boundary": 3 + }, + { + "kind": "read", + "target": 13, + "boundary": 3 + }, + { + "kind": "source", + "source": 1, + "alpha": 2, + "after_boundary": 3 + }, + { + "kind": "read", + "target": 1, + "boundary": 4 + }, + { + "kind": "read", + "target": 9, + "boundary": 4 + }, + { + "kind": "read", + "target": 10, + "boundary": 4 + }, + { + "kind": "read", + "target": 11, + "boundary": 4 + }, + { + "kind": "read", + "target": 14, + "boundary": 4 + }, + { + "kind": "source", + "source": 0, + "alpha": 3, + "after_boundary": 4 + }, + { + "kind": "read", + "target": 2, + "boundary": 5 + }, + { + "kind": "read", + "target": 5, + "boundary": 5 + }, + { + "kind": "read", + "target": 6, + "boundary": 5 + }, + { + "kind": "read", + "target": 11, + "boundary": 5 + }, + { + "kind": "read", + "target": 13, + "boundary": 5 + }, + { + "kind": "source", + "source": 1, + "alpha": 3, + "after_boundary": 5 + } + ], + "cost_model": { + "scalar_multiplication_per_nonunit_event": "L binary XORs at length L in the polynomial basis", + "proposed_source_calls": 6, + "proposed_calls_per_source": 3, + "proposed_nonunit_scalar_events": 4, + "proposed_scalar_xors": "4L", + "serial_per_target_source_calls": 48, + "serial_calls_per_source": 24, + "serial_nonunit_scalar_events": 32, + "serial_scalar_xors": "32L", + "readouts_both": 30, + "event_code": { + "source": "type 0 + source id (1 bit) + alpha (2 bits) = 4 bits", + "read": "type 1 + target id (4 bits) = 5 bits" + }, + "proposed_event_descriptor_bits": 174, + "serial_event_descriptor_bits": 342, + "descriptor_saving_bits": 168, + "complete_cost_formula_proposed": "3(c_B0+c_B1)+4L+2 sum_r c_Ar+174 beta + D_common", + "complete_cost_formula_serial": "24(c_B0+c_B1)+32L+2 sum_r c_Ar+342 beta + D_common", + "saving_serial_minus_proposed": "21(c_B0+c_B1)+28L+168 beta", + "c_Bj": "complete unit-coefficient source map call including access, child work, connector addition, dispatch, frame/head travel, and scratch restoration; scalar multiply is itemized separately", + "beta": "price per stored event descriptor bit", + "limits": "No physical supplier or new kappa is asserted; any interface-specific precision/hosting costs must be added before transfer." + }, + "lower_bound": { + "distinct_prefixes_at_most": "k", + "pairwise_differences_at_most": "k*(k-1)/2", + "required_nonzero_rows": 15, + "minimum_source_calls": 6, + "witness_attains": 6, + "minimum_target_readouts": 30, + "minimum_total_root_calls": 36 + } +} diff --git a/research/gf4-scalar-source-connector-seeda472dd8c/README.md b/research/gf4-scalar-source-connector-seeda472dd8c/README.md new file mode 100644 index 0000000000..f05d010c75 --- /dev/null +++ b/research/gf4-scalar-source-connector-seeda472dd8c/README.md @@ -0,0 +1,184 @@ +# Six-call GF(4) scalar-source connector for two sources + +**Recursive-interface construction; no supplier admission or new `kappa`.** +Adding a paid scalar label to a one-source connector update gives a shortest +universal source path for all 15 nonzero coefficient rows on two sources over +`GF(4)`. The path uses six complete source calls, the counting lower bound, and +30 complete target readouts. It restores an arbitrary dirty connector and uses +no extra copy or helper row. + +The source path is + +```text +S(0,1) S(1,1) S(0,w) S(1,w) S(0,w^2) S(1,w^2) +``` + +where `S(j,a)` means `z += a B_j x_j` and `w^2+w+1=0`. With the encoding +`0=0, 1=1, 2=w, 3=w^2`, its closed prefix sequence is + +```text +(0,0), (1,0), (1,1), (w^2,1), (w^2,w^2), (0,w^2), (0,0). +``` + +The six nonterminal points have 15 distinct unordered differences, exactly all +nonzero vectors of `GF(4)^2`. [CERTIFICATE.json](CERTIFICATE.json) lists the +boundary pair for every target row and the literal 36-event program stream. + +## Interface and dirty-state proof + +The changed operation family is the single-source update + +```text +S(j,a): z += a B_j x_j, a in {1,w,w^2}. +``` + +The base alphabet has only `a=1`; `a=w,w^2` are added. The two source arrays +are read-only. `z` and all targets may start arbitrarily dirty. `B_0`, `B_1`, +and each `A_r` are arbitrary fixed `GF(4)`-linear maps. The target batch is +exactly the 15 nonzero rows `(u_r,v_r)` of `GF(4)^2`: + +```text +y_r += A_r (u_r B_0 x_0 + v_r B_1 x_1). +``` + +After a source prefix `q=(q_0,q_1)`, linearity gives + +```text +z_q = z_initial + q_0 B_0 x_0 + q_1 B_1 x_1. +``` + +For row `(u_r,v_r)`, call `A_r` at its two certified prefix boundaries. The +two readouts add to +`A_r((q_s+q_t)_0 B_0x_0 + (q_s+q_t)_1 B_1x_1)`. Their dirty `A_r z_initial` +terms cancel because the field has characteristic two, and the certified +boundary difference is `(u_r,v_r)`. At the end, each source has been updated +by coefficients `1+w+w^2=0`, so `z` returns exactly to its entry value. +Readouts change no source or connector state; no data-dependent branch is +used. + +The lower bound is exact in this domain. A closed path of `k` source events +has at most `k` distinct prefix points because its initial and final points +coincide. In characteristic two each unordered pair supplies one difference. +Covering all 15 nonzero rows therefore requires `binom(k,2) >= 15`, hence +`k >= 6`. The six-event construction attains it. The verifier also exhausts +all 594 closed source words of lengths 1 through 5; the largest observed +coverage is 7 masks. This finite census is a control; the pair-count argument +is the general lower bound for this fixed two-source target family. + +The full call count is also optimal in this alphabet. With `B_0=B_1=0`, an +arbitrary dirty connector must leave every target unchanged, so each nonzero +row's distinct `A_r` target update must occur an even number of times. Since +every nonzero target row must be realized, this requires at least 30 readouts. +The six source events plus those 30 readouts attain the 36-call lower bound. + +## Complete cost comparison + +The complete source-event price `c_Bj` includes source access, the full `B_j` +child, connector accumulation, per-call dispatch, frame and head travel, and +private scratch restoration. Multiplication by `w` or `w^2` is not free: in +the polynomial basis each costs exactly one binary XOR per `GF(4)` symbol, or +`L` XORs for length `L`. A complete target event price `c_A_r` includes the +full `A_r` child and target update. Both constructions reserve the same two +sources, one dirty connector, and 15 dirty targets; neither adds a copy, +helper row, frame switch, or precision assumption. + +For all 15 rows, six have one nonzero coordinate and nine have two. A +per-target closed schedule applies each nonzero source coefficient once on +the forward leg and once on the return leg. It uses 48 source calls and the +same 30 target readouts. Each of the six `(source, coefficient)` event types +occurs eight times. The shared path uses each event type once, for six calls. +Its four nonunit source multiplications cost `4L` XORs, versus `32L` for the +per-target schedule. + +The literal event stream is encoded with a prefix record: a source event has +type bit `0`, one source-ID bit, and a two-bit coefficient; a readout has type +bit `1` and a four-bit target ID. The stream's order encodes its boundary +placement, so no uncharged pair-lookup table is required. This uses 174 bits +for the shared path (six source events, 30 readouts) and 342 bits for the +per-target schedule (48 source events, 30 readouts). Let `beta` be the price +per stored descriptor bit and `D_common` the shared interpreter/setup bill. +Then + +```text +C_shared = 3(c_B0+c_B1) + 4L + 2 sum_r c_A_r + 174 beta + D_common +C_serial = 24(c_B0+c_B1) + 32L + 2 sum_r c_A_r + 342 beta + D_common +C_serial - C_shared = 21(c_B0+c_B1) + 28L + 168 beta. +``` + +Thus the explicit source child, scalar-XOR, and event-storage terms all +decrease in this exact program model. A physical supplier still has to supply +the added field operations and meet its precision, hosting, and assembly +contracts; none is inferred from this interface result. + +## Open next questions + +Does a source-pinned multiplier supplier expose GF(4)-linear source maps and +admit the added scalar updates at a lower complete recursive cost? This matters +because only a source-bound caller and hosting bill can transfer the interface +saving to an existing multiplication construction. The first step is to search +the current selected supplier sources for a two-source GF(4)-linear connector +boundary and price each scaled event, scratch restoration, precision, and +event storage in the supplier's complete-cost model. This package establishes +no such supplier occurrence. + +## Scope, provenance, and overlap + +The accepted assignment was seed +`a472dd8c6aee62b83f9dbc2e489790b0`, task +`recursive-interfaces / connector-alphabet-change`, priority revision 4, +selector scope key `ff4f5113ed2256ab19ed`, at exact base +`0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2`. The selected-record SHA-256 is +`10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32`. +Scope is refined from the card's one-extra-operation prompt to a single-source +scalar family over `GF(4)`, two sources, and the full 15-row target family. +The live claim is [Discussion #2262](https://github.com/CrocSwap/integer-mult-bounds/discussions/2262); +the focused contribution is [PR #2266](https://github.com/CrocSwap/integer-mult-bounds/pull/2266). + +The fixed binary dirty connector begins with Ross Richardson's +[PR #943](https://github.com/CrocSwap/integer-mult-bounds/pull/943). Nearby +extensions include the two-source combined event in merged +[PR #1531](https://github.com/CrocSwap/integer-mult-bounds/pull/1531), the +atomic triple-source event in [PR #1518](https://github.com/CrocSwap/integer-mult-bounds/pull/1518), +the six-source DUO construction in [PR #2128](https://github.com/CrocSwap/integer-mult-bounds/pull/2128), +and higher-arity source bundles in [PR #2249](https://github.com/CrocSwap/integer-mult-bounds/pull/2249). +Those bundle several sources per event or change the source-count domain. This +construction keeps one source per event and changes the coefficient alphabet. +The paired-output packet in [PR #2230](https://github.com/CrocSwap/integer-mult-bounds/pull/2230) +changes output events instead. The latest live overlap also found new +[PR #2259](https://github.com/CrocSwap/integer-mult-bounds/pull/2259), which +fuses four aligned `F2[C2^2]` source contributions into a single physical +stream event and proves a data-traffic/head-return saving for one target. That +uses a four-source bundled event and identity coefficient frame. This package +uses one source per event with a nonbinary `GF(4)` coefficient, covers all 15 +two-source target rows, and proves the exact six-event difference cover for +arbitrary fixed linear maps and dirty connector/targets. The mechanisms, +domains, cost terms, and evidence differ; no supplier or `kappa` comparison is +claimed. The fresh full overlap snapshot and targeted field-term scan are +recorded in [TASK.json](TASK.json); overlap results are leads, not proof of +novelty. + +The live selected result remains the maintainer-reviewed conditional +construction at `kappa = 836330098538459/500000000000000000` on base +`0fdd7d82...`. This GF(4) connector theorem does not alter that result, select +a supplier, or establish a new multiplication exponent. + +## Reproduce + +From the repository root, with the Python standard library: + +```sh +python3 -I -B research/gf4-scalar-source-connector-seeda472dd8c/verify.py +python3 -I -B research/gf4-scalar-source-connector-seeda472dd8c/independent.py +python3 scripts/research_package.py --package research/gf4-scalar-source-connector-seeda472dd8c --check-only +python3.12 scripts/research_package.py --package research/gf4-scalar-source-connector-seeda472dd8c +``` + +Expected first two lines: + +```text +PASS_GF4_SCALAR_SOURCE_CONNECTOR targets=15 source_calls=6 minimum=6 readouts=30 short_closed_words=594 max_short_cover=7 dirty_cases=245760 scalar_ops=4_vs_32 descriptor_bits=174_vs_342 controls=3 +PASS_GF4_SCALAR_CONNECTOR_INDEPENDENT rows=15 pair_differences=15 dirty_states=245760 omitted_source_and_misplaced_read_controls=2 +``` + +Prepared by OpenAI Codex with substantial AI assistance. No independent human +review, physical supplier realization, or hosted CI result is claimed. diff --git a/research/gf4-scalar-source-connector-seeda472dd8c/SOURCES.json b/research/gf4-scalar-source-connector-seeda472dd8c/SOURCES.json new file mode 100644 index 0000000000..cc14142efa --- /dev/null +++ b/research/gf4-scalar-source-connector-seeda472dd8c/SOURCES.json @@ -0,0 +1,24 @@ +{ + "schema_version": 1, + "base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "input", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "input", + "git_blob": "e8870e5917057d59b730eb14721a778639eca050", + "sha256": "d46eb6d5b3e279428753d770653663fbdf1063e55c255ea073d768f344927ef7" + }, + { + "path": "research/universal-connector-boundary/CERTIFICATE.json", + "usage": "input", + "git_blob": "079e3e1441dc07c2f0536e9527acf290e51ea9c0", + "sha256": "e733746ba3e5151c829b4e8728bfff5ae3ed24d8d203eb77c735d20758e8266a" + } + ] +} diff --git a/research/gf4-scalar-source-connector-seeda472dd8c/TASK.json b/research/gf4-scalar-source-connector-seeda472dd8c/TASK.json new file mode 100644 index 0000000000..9acce38879 --- /dev/null +++ b/research/gf4-scalar-source-connector-seeda472dd8c/TASK.json @@ -0,0 +1,90 @@ +{ + "schema_version": 1, + "seed": "a472dd8c6aee62b83f9dbc2e489790b0", + "track": "recursive-interfaces", + "task_id": "connector-alphabet-change", + "priority_revision": 4, + "base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "selected_record_sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32", + "catalogue_sha256": "d46eb6d5b3e279428753d770653663fbdf1063e55c255ea073d768f344927ef7", + "selector_scope_key": "ff4f5113ed2256ab19ed", + "discussion_claim": "https://github.com/CrocSwap/integer-mult-bounds/discussions/2262", + "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 paid single-source scalar updates over GF(4) and determine the shortest dirty-connector path for the full 15-row, two-source coefficient family.", + "scope_change_reason": "The card permits choosing one additional operation family on a small source count. I chose GF(4) scalar labels on single-source updates, rather than the already covered multi-source bundle families, and fixed the domain at two sources and all 15 nonzero coefficient rows.", + "bottleneck_link": "For this exact interface batch, the shared scalar-source path reduces complete B-child invocations from 48 to 6 while preserving the 30 complete A readouts; the paid scalar multiplications and event descriptors are explicitly included. This is a recursive-interface cost result, not a selected-supplier or kappa claim.", + "budget_minutes": 60, + "stop_rule": "Finish the exact two-source GF(4) pair-difference construction and lower bound; replay all length-one GF(4)-linear maps and dirty scalars for the 15 rows; verify the 48-to-6 source-child cost, event descriptor price, and failure controls. Do not search larger fields or source counts in this cycle.", + "outcome": "completed", + "evidence": "CERTIFICATE.json gives a six-event closed path, six distinct prefixes, all 15 unique nonzero differences, the target boundary pairs and 36-event schedule. verify.py checks the k>=6 counting bound, exhausts 594 closed paths of lengths 1..5 (maximum coverage 7), replays 245760 dirty scalar cases, and checks omission/wrong-pair/readout controls. independent.py separately executes the literal stream on the same 245760 states. Complete cost comparison: 6 versus 48 B events; 4L versus 32L scalar XORs; 174 versus 342 descriptor bits under the stated prefix-record encoding. The predecessor baseline passed: PASS_UNIVERSAL_CONNECTOR_BOUNDARY pairings=945 max_coverage=31 queries=74 leaves=182. The full model also needs at least 30 target readouts by dirty-connector cancellation, so the 36 total root calls are optimal in the stated alphabet.", + "author": "OpenAI Codex", + "ai_assistance": "Substantial OpenAI Codex assistance in mathematical derivation, exact enumeration, verifier implementation, cost accounting, and package preparation.", + "open_questions": [ + { + "question": "Does any source-pinned multiplier supplier expose GF(4)-linear source maps and admit the added scalar-update events at lower complete recursive cost?", + "why_it_matters": "Only a source-bound caller and hosting bill could transfer this interface saving to an existing multiplication construction.", + "first_step": "Search the current selected supplier sources for a two-source GF(4)-linear connector boundary and price each scaled event, scratch restoration, precision, and event storage using the supplier's complete-cost model.", + "blocked_by": "No supplier occurrence or GF(4) connector realization is established by this finite interface construction." + } + ], + "overlap_refresh": { + "searched_at": "2026-10-15T02:48:08.293807+00:00", + "open_prs": { + "fetched_at": "2026-10-15T02:46:03.689687+00:00", + "complete_pagination": true, + "records": 490 + }, + "discussions_and_comments": { + "fetched_at": "2026-10-15T02:48:08.142755+00:00", + "complete_pagination": true, + "records": 974 + }, + "warnings": [], + "targeted_terms": [ + "GF(4)", + "GF4", + "four-element field", + "scaled source toggle", + "scalar-source connector", + "extension-field connector" + ], + "nearest_new_overlap": "PR #2259: four-source aligned F2 coefficient-stream fusion for a single physical target; distinguished in README.md by operation, field, source count, output family, and cost objective." + }, + "pull_request": "https://github.com/CrocSwap/integer-mult-bounds/pull/2266" +} diff --git a/research/gf4-scalar-source-connector-seeda472dd8c/VERIFY.json b/research/gf4-scalar-source-connector-seeda472dd8c/VERIFY.json new file mode 100644 index 0000000000..b4eca9d2a2 --- /dev/null +++ b/research/gf4-scalar-source-connector-seeda472dd8c/VERIFY.json @@ -0,0 +1,33 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "certificates/selected-result.json", + "docs/research/agent-task-catalog.json", + "research/universal-connector-boundary/CERTIFICATE.json" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Exact GF(4) source path, all 15 boundary differences, minimum-call lower bound and shorter-path controls, complete scalar dirty-state replay, event storage pricing, and mutation controls." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/independent.py" + ], + "timeout_seconds": 180, + "checks": "Code-disjoint literal operation-stream execution over every length-one GF(4)-linear map and dirty scalar state, with omitted-event and misplaced-readout controls." + } + ] +} diff --git a/research/gf4-scalar-source-connector-seeda472dd8c/independent.py b/research/gf4-scalar-source-connector-seeda472dd8c/independent.py new file mode 100644 index 0000000000..1bcc8341e8 --- /dev/null +++ b/research/gf4-scalar-source-connector-seeda472dd8c/independent.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python3 +"""Code-disjoint event interpreter for the GF(4) dirty-state construction.""" +from itertools import product +import json +from pathlib import Path + + +HERE = Path(__file__).resolve().parent +MULTIPLICATION = ( + (0, 0, 0, 0), + (0, 1, 2, 3), + (0, 2, 3, 1), + (0, 3, 1, 2), +) + + +def require(ok, label): + if not ok: + raise SystemExit("FAIL_GF4_SCALAR_CONNECTOR_INDEPENDENT " + label) + + +def fmul(a, b): + return MULTIPLICATION[a][b] + + +def execute(events, target_id, maps, inputs, connector, output): + b0, b1, a_map = maps + x0, x1 = inputs + sources = (b0, b1) + xs = (x0, x1) + start = connector + value = output + for event in events: + if event["kind"] == "source": + j = event["source"] + connector ^= fmul(event["alpha"], fmul(sources[j], xs[j])) + elif event["target"] == target_id: + value ^= fmul(a_map, connector) + return connector, value, start + + +def main(): + cert = json.loads((HERE / "CERTIFICATE.json").read_text(encoding="utf-8")) + require(cert["format"] == "gf4-scalar-source-connector-v1", "format") + events = cert["event_stream"] + targets = cert["targets"] + word = cert["source_word"] + require(len(word) == 6 and len(events) == 36, "event counts") + + # Independently build prefix states from event labels using the two-bit + # additive representation. Each pair is checked against its target row. + q = [0, 0] + states = [tuple(q)] + for source_event in word: + q[source_event["source"]] ^= source_event["alpha"] + states.append(tuple(q)) + require(states[0] == states[-1] == (0, 0), "closed walk") + require(len(set(states[:-1])) == 6, "distinct prefixes") + differences = [] + for left in range(6): + for right in range(left + 1, 6): + differences.append((states[left][0] ^ states[right][0], + states[left][1] ^ states[right][1])) + require(len(set(differences)) == 15, "difference uniqueness") + require(set(differences) == {(u, v) for u in range(4) for v in range(4) + if (u, v) != (0, 0)}, "difference coverage") + for target in targets: + left, right = target["boundaries"] + got = (states[left][0] ^ states[right][0], + states[left][1] ^ states[right][1]) + require(list(got) == target["coefficients"], "pair label") + + # Execute the literal interleaving over every length-one GF(4)-linear map, + # source, dirty connector, and dirty target scalar. A_r, B0 and B1 are all + # multiplication maps, which exhaust End_GF(4)(GF(4)). + checked = 0 + for row in targets: + u, v = row["coefficients"] + for b0, b1, a_map, x0, x1, z_dirty, y_dirty in product(range(4), repeat=7): + connector, output, initial = execute( + events, row["target"], (b0, b1, a_map), (x0, x1), z_dirty, y_dirty) + expected = y_dirty ^ fmul(a_map, + fmul(u, fmul(b0, x0)) ^ fmul(v, fmul(b1, x1))) + require(connector == initial, "arbitrary connector dirt") + require(output == expected, "target output") + checked += 1 + + # Negative controls use concrete states: deleting the final source event + # leaves z=w^2; moving row (1,0)'s second read from boundary 1 to 2 adds + # the unwanted x1 term. + shortened = [event for event in events + if not (event["kind"] == "source" and + event.get("after_boundary") == 5)] + end, _, _ = execute(shortened, 0, (0, 1, 1), (0, 1), 0, 0) + require(end == 3, "omitted-event control") + row10 = next(row for row in targets if row["coefficients"] == [1, 0]) + corrupted = [event for event in events + if not (event["kind"] == "read" and event["target"] == row10["target"] + and event["boundary"] == 1)] + # The bad second read is inserted at boundary 2, after source event 1. + insert_at = next(i + 1 for i, event in enumerate(corrupted) + if event["kind"] == "source" and event.get("after_boundary") == 1) + corrupted.insert(insert_at, {"kind": "read", "target": row10["target"], + "boundary": 2}) + _, bad_output, _ = execute(corrupted, row10["target"], (0, 1, 1), + (0, 1), 0, 0) + require(bad_output == 1, "misplaced-readout control") + + print("PASS_GF4_SCALAR_CONNECTOR_INDEPENDENT rows=15 pair_differences=15 " + "dirty_states=%d omitted_source_and_misplaced_read_controls=2" % checked) + + +if __name__ == "__main__": + main() diff --git a/research/gf4-scalar-source-connector-seeda472dd8c/verify.py b/research/gf4-scalar-source-connector-seeda472dd8c/verify.py new file mode 100644 index 0000000000..9eef8a0fd1 --- /dev/null +++ b/research/gf4-scalar-source-connector-seeda472dd8c/verify.py @@ -0,0 +1,210 @@ +#!/usr/bin/env python3 +"""Verify the exact two-source GF(4) scalar-toggle connector construction.""" +from itertools import product +import json +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[2] +HERE = Path(__file__).resolve().parent + + +def need(condition, message): + if not condition: + raise SystemExit("FAIL_GF4_SCALAR_CONNECTOR " + message) + + +def mul(a, b): + """Multiply codes for a+b*w, with w^2=w+1.""" + product_bits = 0 + for shift in range(2): + if (b >> shift) & 1: + product_bits ^= a << shift + if product_bits & 4: + product_bits ^= 0b111 + return product_bits + + +def apply_event(q, event): + j, alpha = event["source"], event["alpha"] + out = list(q) + out[j] ^= alpha + return tuple(out) + + +def pair_cover(points): + cover = {} + for left in range(len(points)): + for right in range(left + 1, len(points)): + diff = (points[left][0] ^ points[right][0], + points[left][1] ^ points[right][1]) + need(diff not in cover, "duplicate prefix difference") + cover[diff] = (left, right) + return cover + + +def event_stream(targets, source_word): + stream = [] + for boundary in range(len(source_word)): + for target in targets: + if boundary in target["boundaries"]: + stream.append({"kind": "read", "target": target["target"], + "boundary": boundary}) + event = source_word[boundary] + stream.append({"kind": "source", "source": event["source"], + "alpha": event["alpha"], "after_boundary": boundary}) + return stream + + +def search_short_words(): + """Exact finite negative control for every closed event word of length < 6.""" + operations = [(j, a) for j in range(2) for a in (1, 2, 3)] + closed = 0 + maximum = 0 + for k in range(1, 6): + for word in product(operations, repeat=k): + q = (0, 0) + points = [q] + for j, alpha in word: + p = list(q) + p[j] ^= alpha + q = tuple(p) + points.append(q) + if q != (0, 0): + continue + closed += 1 + distinct = list(dict.fromkeys(points[:-1])) + masks = {(p[0] ^ r[0], p[1] ^ r[1]) + for i, p in enumerate(distinct) + for r in distinct[i + 1:]} + maximum = max(maximum, len(masks)) + need(len(masks) < 15, "unexpected shorter full cover") + return closed, maximum + + +def main(): + cert = json.loads((HERE / "CERTIFICATE.json").read_text(encoding="utf-8")) + need(cert["format"] == "gf4-scalar-source-connector-v1", "format") + need(cert["seed"] == "a472dd8c6aee62b83f9dbc2e489790b0", "seed pin") + need(cert["base_commit"] == "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", "base pin") + need(cert["selected_record_sha256"] == + "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32", + "selected record pin") + need(cert["field"]["representation"] == "a+b*w encoded by bits (a,b), code=a+2*b", + "field convention") + need([[mul(a, b) for b in range(4)] for a in range(4)] == + [[0, 0, 0, 0], [0, 1, 2, 3], [0, 2, 3, 1], [0, 3, 1, 2]], + "GF(4) multiplication table") + + word = cert["source_word"] + need(len(word) == 6 and all(e["source"] in (0, 1) and e["alpha"] in (1, 2, 3) + for e in word), "source word domain") + q = (0, 0) + points = [q] + for event in word: + q = apply_event(q, event) + points.append(q) + need(q == (0, 0), "dirty connector not restored") + need(points == [tuple(p) for p in cert["prefix_points"]], "prefix certificate") + core_points = points[:-1] + need(len(set(core_points)) == 6, "prefixes are not six distinct states") + + rows = [(u, v) for u in range(4) for v in range(4) if (u, v) != (0, 0)] + targets = cert["targets"] + need(len(targets) == 15, "target count") + need([(t["coefficients"][0], t["coefficients"][1]) for t in targets] == rows, + "target ordering") + cover = pair_cover(core_points) + need(set(cover) == set(rows), "prefix differences do not cover GF(4)^2\\{0}") + for target in targets: + i, j = target["boundaries"] + need((i, j) == cover[tuple(target["coefficients"])], "boundary pair") + need((core_points[i][0] ^ core_points[j][0], + core_points[i][1] ^ core_points[j][1]) == tuple(target["coefficients"]), + "target coefficient difference") + + need(cert["event_stream"] == event_stream(targets, word), "literal event stream") + reads = [e for e in cert["event_stream"] if e["kind"] == "read"] + need(len(cert["event_stream"]) == 36 and len(reads) == 30, "event count") + need([sum(e["kind"] == "read" and e["target"] == t for e in cert["event_stream"]) + for t in range(15)] == [2] * 15, "paired target readouts") + + # Any closed k-call path has at most k distinct prefixes. Its unordered + # pairwise differences number at most binom(k,2), so k<6 cannot cover 15. + need(all(k * (k - 1) // 2 < 15 for k in range(6)), "minimum-call counting bound") + closed_short, max_short = search_short_words() + need(closed_short == 594 and max_short == 7, "short-word census") + + # Every GF(4)-linear scalar map and every dirty scalar state at length 1. + # Replay the actual source calls, then both A readouts at the certified pair. + dirty_cases = 0 + for target in targets: + u, v = target["coefficients"] + i, j = target["boundaries"] + for b0, b1, a_map, x0, x1, z0, y0 in product(range(4), repeat=7): + z = z0 + at = [z] + for event in word: + src = (b0, b1)[event["source"]] + x = (x0, x1)[event["source"]] + z ^= mul(event["alpha"], mul(src, x)) + at.append(z) + need(at[-1] == z0, "connector dirt changed in scalar replay") + got = y0 ^ mul(a_map, at[i]) ^ mul(a_map, at[j]) + expected = y0 ^ mul(a_map, mul(u, mul(b0, x0))) ^ \ + mul(a_map, mul(v, mul(b1, x1))) + need(got == expected, "dirty scalar target replay") + dirty_cases += 1 + + # Negative controls: deleting the last source event leaves dirty connector + # state; corrupting a target's boundary pair fails on an explicit input. + q_bad = (0, 0) + for event in word[:-1]: + q_bad = apply_event(q_bad, event) + need(q_bad == (0, 3), "omission control fixture") + need(mul(q_bad[1], mul(1, 1)) != 0, "omitted event dirt witness") + target10 = next(t for t in targets if t["coefficients"] == [1, 0]) + wrong_i, wrong_j = (0, 2) + wrong_diff = (core_points[wrong_i][0] ^ core_points[wrong_j][0], + core_points[wrong_i][1] ^ core_points[wrong_j][1]) + need(wrong_diff != tuple(target10["coefficients"]), "wrong-pair control fixture") + bad_pair_got = (core_points[wrong_i][1] ^ core_points[wrong_j][1]) + bad_pair_expected = 0 # x0=0, x1=1, B0=0, B1=1 for row (1,0). + need(bad_pair_got != bad_pair_expected, "wrong-pair control was not detected") + bad_stream = [e for e in cert["event_stream"] + if not (e["kind"] == "read" and e["target"] == target10["target"] + and e["boundary"] == 1)] + need(len(bad_stream) == 35 and + sum(e["kind"] == "read" and e["target"] == target10["target"] + for e in bad_stream) == 1, "readout-deletion control") + + row_weight_sum = sum((u != 0) + (v != 0) for u, v in rows) + need(row_weight_sum == 24, "baseline row weights") + for source in range(2): + multiplicities = [2 * sum(row[source] == alpha for row in rows) + for alpha in (1, 2, 3)] + need(multiplicities == [8, 8, 8], "baseline coefficient event multiplicities") + proposed = [sum(e["source"] == source and e["alpha"] == alpha for e in word) + for alpha in (1, 2, 3)] + need(proposed == [1, 1, 1], "proposed coefficient event multiplicities") + new_scalars = sum(e["alpha"] != 1 for e in word) + old_scalars = sum(a != 1 for j in range(2) for a in (1, 2, 3) for _ in range(8)) + need(new_scalars == 4 and old_scalars == 32, "scalar-multiply cost counts") + desc_new = 6 * 4 + 30 * 5 + desc_old = 48 * 4 + 30 * 5 + cost = cert["cost_model"] + need(cost["proposed_event_descriptor_bits"] == desc_new == 174, "new descriptor bits") + need(cost["serial_event_descriptor_bits"] == desc_old == 342, "baseline descriptor bits") + need(cost["descriptor_saving_bits"] == desc_old - desc_new == 168, "descriptor delta") + need(cert["lower_bound"]["minimum_source_calls"] == 6, "certified lower bound") + need(cert["lower_bound"]["minimum_target_readouts"] == 30 and + cert["lower_bound"]["minimum_total_root_calls"] == 36, + "full-query lower bound") + + print("PASS_GF4_SCALAR_SOURCE_CONNECTOR targets=15 source_calls=6 minimum=6 readouts=30 " + "short_closed_words=594 max_short_cover=7 dirty_cases=%d scalar_ops=4_vs_32 " + "descriptor_bits=174_vs_342 controls=3" % dirty_cases) + + +if __name__ == "__main__": + main()