diff --git a/research/transfer-coupled-7q-obstruction/CERTIFICATE.json b/research/transfer-coupled-7q-obstruction/CERTIFICATE.json new file mode 100644 index 0000000000..0dd901963f --- /dev/null +++ b/research/transfer-coupled-7q-obstruction/CERTIFICATE.json @@ -0,0 +1,180 @@ +{ + "schema_version": 1, + "status": "PASS_TRANSFER_COUPLED_7Q_OBSTRUCTION", + "scope": "Five-source common-B mutable-source Q/R/X alphabet (PR1898). Transfer-coupled dual at Q=7 with shape (p,a,b)=(5,1,1): shared prefix length 5, priced transfer C>=1, divergent length-1 tips, independent dirt, dual even-parity readout, fair shared-prefix XOR billing. Covering min R=84; min fair X at R=84 is 9; tariff floor 452>436. Answers transfer-coupled OQ for the maximal-sharing fork.", + "claim": { + "Q": 7, + "shape": [ + 5, + 1, + 1 + ], + "covering_pairs": 8749440, + "min_R": 84, + "min_fair_X_at_R84": 9, + "tariff_floor": 452, + "endpoint_Q6_tariff": 436, + "undercuts_436_after_complete_bill": false, + "transfer_C_min": 1, + "answers_transfer_coupled_511": true, + "oq_answer": "Every covering distinct-label transfer-coupled schedule of shape (5,1,1) at total Q=7 (shared restored prefix of length 5, two divergent nonzero tips, priced transfer C>=1, independent dirt, dual even-parity readout, fair shared-prefix XOR billing) has R>=84. Among the 1458240 covering pairs with R=84, every fair-X bill is >=9 (witness X=9). Abstract tariff floor is therefore 38*7+2*84+2*9=452>436. C=0 is rejected. Other (p,a,b) shapes are out of full census here; spot samples show observed min R>=86, which already cannot undercut because R+X>=86>85.", + "no_new_kappa": true + }, + "census_5_1_1": { + "kind": "transfer_coupled_5_1_1", + "Q": 7, + "shape": [ + 5, + 1, + 1 + ], + "covering_pairs": 8749440, + "n_R84": 1458240, + "attainable_R": [ + 84, + 88, + 90 + ], + "histogram": { + "84": 1458240, + "88": 2083200, + "90": 5208000 + }, + "min_R": 84, + "min_fair_X_at_R84": 9, + "champion": { + "prefix": [ + 0, + 1, + 3, + 6, + 12 + ], + "tips": [ + 8, + 16 + ], + "R": 84, + "fair_X": 9, + "tariff": 452, + "transfer_C": 1 + }, + "tariff_floor": 452, + "endpoint_Q6": 436 + }, + "champion": { + "prefix": [ + 0, + 1, + 3, + 6, + 12 + ], + "tips": [ + 8, + 16 + ], + "walks": [ + [ + 0, + 1, + 3, + 6, + 12, + 8 + ], + [ + 0, + 1, + 3, + 6, + 12, + 16 + ] + ], + "R": 84, + "fair_X": 9, + "transfer_C": 1, + "tariff": 452 + }, + "transfer_C_controls": { + "C0_rejected_by_need": true, + "C1_fair_X": 9, + "transfer_C_min": 1 + }, + "other_shape_samples": { + "threshold_R_plus_X": 85, + "shape_4_1_2": { + "covering_samples": 3205, + "min_R_observed": 86, + "best": { + "P": [ + 7, + 21, + 30 + ], + "A": [ + 19 + ], + "B": [ + 16, + 17 + ], + "R": 86 + }, + "cannot_undercut_if_R_ge_86": true + }, + "shape_3_2_2": { + "covering_samples": 3185, + "min_R_observed": 90, + "best": { + "P": [ + 14, + 19 + ], + "A": [ + 23, + 31 + ], + "B": [ + 18, + 24 + ], + "R": 90 + }, + "cannot_undercut_if_R_ge_86": true + }, + "shape_3_1_3": { + "covering_samples": 3186, + "min_R_observed": 88, + "best": { + "P": [ + 18, + 22 + ], + "A": [ + 11 + ], + "B": [ + 8, + 9, + 24 + ], + "R": 88 + }, + "cannot_undercut_if_R_ge_86": true + }, + "note": "Samples only; not a full other-shape census. Observed minima \u226586 already forbid undercutting at Q=7 because R+X\u226586>85." + }, + "unit_tariff": { + "b": 38, + "a": 2, + "x": 2 + }, + "tariff_check": { + "formula": "38*Q + 2*R + 2*X (C folded into fair X)", + "floor_R84_X9": 452, + "endpoint_Q6": 436, + "undercut_requires_R_plus_X_lt": 85 + } +} diff --git a/research/transfer-coupled-7q-obstruction/NOTICE.md b/research/transfer-coupled-7q-obstruction/NOTICE.md new file mode 100644 index 0000000000..db011d6191 --- /dev/null +++ b/research/transfer-coupled-7q-obstruction/NOTICE.md @@ -0,0 +1,31 @@ +# Notice + +New material in this directory is Apache-2.0. + +Predecessor credit (do not alter historical notices elsewhere): + +- Arham Tahir / PR1898 `research/mutable-source-minimum-queries` — five-source + alphabet, minimum-query endpoint, abstract complete-call tariff. +- ywz65 / open PR2455 `research/mutable-source-six-query-xor` — component lemma + and restored interaction-graph census at six queries. +- Arham Tahir / PR1370 — path-local shear lowering. +- TennisBowling / PR1524 — equal-price theorem and unequal-price handoff. +- Ross Richardson / PR943/934 — prefix framework. +- Fork path-lowered `research/mutable-source-789q-invoice` / open #2677 — + distinct-slot spectrum and champion path; not edited. +- Open #2643 `research/seven-query-xor-floor` — restored `X ≥ 6` at `Q = 7`; + not edited. +- Open #2686 `research/seven-query-r-floor` — even-subset `R ≥ 82`; not edited. +- Open #2687 — leave-alone; not edited. +- Open #2715 `research/cheaper-readout-7q-obstruction` — all-subset / + dirty-parity repair; not edited. +- Open #2761 `research/multi-connector-7q-obstruction` (same-walk multi-connector / + priced shadow); not edited. +- Open #2764 `research/dirty-parity-8q-obstruction`; not edited. +- Pending / open partitioned independent-walks package + `research/independent-walks-7q-obstruction` — transfer-coupled OQ answered + here for shape `(5,1,1)` without editing that package. +- Live pin: `research/mutable-source-shear-cost/CERTIFICATE.json`. + +Prepared by Wentao Li (VictorLiwentao, @Is__Victor) with substantial AI +assistance. diff --git a/research/transfer-coupled-7q-obstruction/PROOF.md b/research/transfer-coupled-7q-obstruction/PROOF.md new file mode 100644 index 0000000000..2b7ce9e9f4 --- /dev/null +++ b/research/transfer-coupled-7q-obstruction/PROOF.md @@ -0,0 +1,125 @@ +# Transfer-coupled (5,1,1) duals cannot undercut tariff 436 at Q=7 + +This is a scoped obstruction in the five-source common-B mutable-source alphabet +of [PR1898](https://github.com/CrocSwap/integer-mult-bounds/pull/1898). It answers +the **transfer-coupled** open question left by partitioned independent walks: +can a shared prefix, priced transfer `C≥1`, and divergent suffixes undercut the +six-query endpoint tariff `436` at total `Q = 7` after a complete dirty bill? + +The claim is restricted to shape `(p,a,b) = (5,1,1)` (maximal sharing / longest +walks). No new kappa is claimed. Leave-alone packages through #2764 / #2761 are +not edited. Pending independent-walks / dirty-parity / multi-connector fixtures +are not competed with on their own claims. + +## Setup + +Retain queries `Q_j`, readouts `R_m: y_m += A_m z`, and paid source shears +`X_(s,t)`. A **transfer-coupled schedule** of shape `(p,a,b)` with +`p+a+b = 7` consists of: + +1. a shared restored **prefix** of length `p` starting at `0`; +2. a priced **transfer** of cost `C ≥ 1` forking the connector state; +3. two divergent **suffixes** of lengths `a` and `b`. + +The two walks are `prefix∥suffix_a` and `prefix∥suffix_b`. Shared prefix queries +are counted once, so the query bill is `Q = p+a+b`. Each walk carries independent +dirt, so dual even-parity readout costs + +```text +R = Σ_{m=1}^{31} min_a (e0[a] + e1[a ⊕ m]). +``` + +**Fair shared-prefix XOR billing** charges prefix edges once, adds the transfer +`C`, then charges each tip chain `(prefix_end → tip → 0)` separately. The +abstract complete-call tariff at `(b,a,x)=(38,2,2)` is `38·Q + 2·R + 2·X` with +`C` folded into the fair-`X` bill. + +## Why `(5,1,1)` + +Up to swap, shapes with `p≥1` and `a,b≥1` are the fifteen triples listed in the +independent-walks OQ. Shape `(5,1,1)` maximises the shared prefix and produces +two length-6 walks at `Q=7` — the most threatening dual-row configuration after +partitioned walks collapsed at `R=112`. Spot samples of `(4,1,2)`, `(3,2,2)` and +`(3,1,3)` observe covering minima `R≥86`; already `R+X≥86>85` forbids undercutting +`436` at `Q=7`, but those shapes are not fully censused here. + +## Undercut threshold + +At `Q=7`, + +```text +38·7 + 2(R+X) < 436 ⟺ R+X < 85. +``` + +Any covering schedule with `R≥86` is therefore blocked even at `X=0`. The only +remaining threat is `R≤84` with very small fair `X`. + +## Census of distinct-label `(5,1,1)` + +Prefix nonzero labels form a 4-set `P ⊂ {1,…,31}`; tips `a≠b` lie outside `P`. +Even-subset tables depend only on the slot **set**, so the dual `R` census is +over unordered tip pairs. Covering count: + +```text +covering = 8 749 440, +attainable R = {84, 88, 90}, +histogram: 84 ↦ 1 458 240, 88 ↦ 2 083 200, 90 ↦ 5 208 000. +``` + +In particular **min `R = 84`**. (Machine-checked dual `min_a`, not a copied +constant; independent checker reproduces the same histogram.) + +## Fair-`X` floor on the `R=84` layer + +For each `R=84` system, the fair-`X` cost decomposes by path end-point: + +```text +X = min_pend ( path_0→P→pend + C + edge(pend,a) + edge(pend,b) + + edge(a,0) + edge(b,0) ), +``` + +with `C=1`. Enumerating all `1 458 240` systems yields + +```text +min fair X |_{R=84} = 9, +``` + +attained at prefix `(0,1,3,6,12)` with tips `(8,16)` (and the tip swap). No +`R=84` schedule has fair `X≤8`. Consequently every covering `(5,1,1)` bill +satisfies `R+X ≥ 84+9 = 93 > 85`. + +## Tariff consequence + +```text +38·7 + 2·84 + 2·9 = 452 > 436. +``` + +Positive deviations of `R` or `X` only increase the bill. Transfer-coupled +`(5,1,1)` duals therefore cannot undercut the six-query endpoint under the +PR1898 abstract tariff after charging walks, transfer, and dirt. + +`C=0` is rejected by the priced-transfer interface (`need(C≥1)`). + +## Scope limits + +- Fixes transfer-coupled shape `(5,1,1)` with distinct nonzero labels. + Other `(p,a,b)` triples are out of full census (spot samples only). +- Same-walk multi-connector / priced shadow remain #2761; dirty-parity at + `Q=8` remains #2764; partitioned independent walks remain their own package. +- Shared non-path XOR schedules remain deferred (soft-overlap with #2643). +- Host screens are deferred. +- Leave-alone through #2764 / #2761 (including #2593, #2643, #2677, #2686, + #2687, #2715, #2761, #2764) is not edited. +- No new kappa, physical supplier, or multiplication theorem. + +## Relation to predecessors + +| Prior | Already proves | This package adds | +|---|---|---| +| PR1898 | Min `Q=6`, endpoint tariff 436 | — | +| #2643 | `X≥6` at single-walk `Q=7` | — | +| #2686 | Even-subset `R≥82` on one walk | — | +| #2715 | All-subset collapses under dirty-parity | — | +| #2761 | Same-walk dual / dirty shadow stay at `R≥82` | — | +| Independent-walks | Partitioned duals have exact `R=112` | transfer-coupled OQ | +| **This** | — | **`(5,1,1)` transfer-coupled duals have min `R=84`, min fair `X=9` at that layer; tariff floor `452>436`** | diff --git a/research/transfer-coupled-7q-obstruction/README.md b/research/transfer-coupled-7q-obstruction/README.md new file mode 100644 index 0000000000..d4254884d4 --- /dev/null +++ b/research/transfer-coupled-7q-obstruction/README.md @@ -0,0 +1,79 @@ +# Transfer-coupled (5,1,1) obstruction at seven queries + +**Scoped obstruction / priced alphabet; no new kappa.** Answers the +**transfer-coupled** open question left by partitioned independent walks on the +#2715 / #2761 lineage in the five-source common-B mutable-source alphabet of +[#1898](https://github.com/CrocSwap/integer-mult-bounds/pull/1898): can a shared +prefix, priced transfer `C≥1`, and divergent suffixes undercut tariff `436` at +total `Q=7` after a complete dirty bill? + +Scoped to maximal-sharing shape `(p,a,b)=(5,1,1)` (two length-6 walks, prefix +counted once). + +| Schedule | Covering pairs | Min R | Min fair X at min R | Tariff floor | Undercuts 436? | +|---|---:|---:|---:|---:|---| +| Partitioned dual (#indep-walks) | — | 112 | — | ≥490 | no | +| Transfer-coupled `(5,1,1)` | **8749440** | **84** | **9** | **≥452** | **no** | +| Same-walk even-subset (#2686) | — | 82 | — | ≥442 at X=6 | no | + +Every covering distinct-label `(5,1,1)` dual has `R∈{84,88,90}`. On the +`R=84` layer, fair shared-prefix XOR billing with `C=1` is at least `9` +(champion prefix `(0,1,3,6,12)`, tips `(8,16)`). Abstract tariff +`38·7+2·84+2·9=452>436`. Spot samples of other shapes observe `R≥86`, which +already cannot undercut (`R+X≥86>85`). + +## Reproduction + +```sh +python3.12 -I -B research/transfer-coupled-7q-obstruction/verify.py +python3.12 -I -O -B research/transfer-coupled-7q-obstruction/verify.py +python3.12 -I -B research/transfer-coupled-7q-obstruction/independent.py +python3.12 -I -B research/transfer-coupled-7q-obstruction/test_package.py +python3.12 -B scripts/research_package.py --package research/transfer-coupled-7q-obstruction +``` + +Expected: + +```text +PASS_TRANSFER_COUPLED_7Q_OBSTRUCTION covering=8749440 min_R=84 min_fair_X=9 tariff_floor=452 answers_transfer_coupled_511 no_new_kappa +PASS_INDEPENDENT_TRANSFER_COUPLED_7Q covering=8749440 min_R=84 min_fair_X=9 tariff_floor=452 ... answers_transfer_coupled_511 no_new_kappa +PASS_TRANSFER_COUPLED_7Q_PACKAGE_TESTS groups=6 +PASS_REGISTERED_RESEARCH_PACKAGE research/transfer-coupled-7q-obstruction outcome=completed +``` + +Default verify is read-only. Admission uses `need()`; `-O` also passes. + +## Overlap + +Base commit `0b1cccf86e2f5132ed286a26ef0a681a495740ea`. Direct predecessors: +PR1898, #2643, #2686, #2715, #2761, #2764, partitioned independent-walks OQ. +Leave-alone through #2764/#2761 including #2593, #2643, #2677, #2686, #2687, +#2715, #2761, #2764 is respected; those packages are not edited. Pending +`cursor/independent-walks-7q-60b9` is not edited or competed with on its +partitioned fixture. Deferred shared-XOR soft-overlap with #2643 and host +screens are not opened. + +## Open next questions + +1. Do other transfer-coupled shapes `(p,a,b)` with `p+a+b=7` (e.g. `(4,1,2)`, + `(3,2,2)`) achieve covering `R≤84` after the same dirty bill? + Why it matters: closes the remaining transfer-coupled shapes; spot samples + already show observed min `R≥86`. + First step: full set-based dual census for `(4,1,2)` and `(3,2,2)`. + Blocked by: larger search. +2. Does the dirty-shadow sym-diff collapse extend verbatim to eight queries? + Why it matters: companion of #2761/#2764 priced-shadow OQs. + First step: reuse the snapshot lemma on length-8 slot lists. + Blocked by: separate freestanding package; leave-alone #2761/#2764. + +## Credit + +Credit **Arham Tahir / PR1898**, **ywz65 / PR2455**, **PR1370**, fork **789q** / +**#2677**, **#2643**, **#2686**, open **#2715**, **#2761**, **#2764**, +partitioned independent-walks (OQ answered here for `(5,1,1)`; not edited), +**TennisBowling / PR1524**, **Ross Richardson / PR943**, and the retained +mutable-source lineage. Live input pin: +`research/mutable-source-shear-cost/CERTIFICATE.json`. Prepared by Wentao Li +([VictorLiwentao](https://github.com/VictorLiwentao), +[@Is__Victor](https://x.com/Is__Victor)) with substantial AI assistance. +Apache-2.0. No independent human review or multiplication theorem is claimed. diff --git a/research/transfer-coupled-7q-obstruction/SOURCES.json b/research/transfer-coupled-7q-obstruction/SOURCES.json new file mode 100644 index 0000000000..719b378cbd --- /dev/null +++ b/research/transfer-coupled-7q-obstruction/SOURCES.json @@ -0,0 +1,24 @@ +{ + "schema_version": 1, + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "06c96f5579bb67ed1b86d334e78fbed7da6945f1", + "sha256": "6686ad58f1fbdbc87134a78901b60fd53a20d3984355e91defbbebc9e9fa8075" + }, + { + "path": "research/mutable-source-shear-cost/CERTIFICATE.json", + "usage": "input", + "git_blob": "48958451bc819f2caa13bf3d9609423706ffb8a0", + "sha256": "665435375c025bbcf69eadf43bd9aeae44eb12fefdf12a78d5bfd66abde4ae3c" + } + ] +} diff --git a/research/transfer-coupled-7q-obstruction/TASK.json b/research/transfer-coupled-7q-obstruction/TASK.json new file mode 100644 index 0000000000..5f0ad141de --- /dev/null +++ b/research/transfer-coupled-7q-obstruction/TASK.json @@ -0,0 +1,104 @@ +{ + "schema_version": 1, + "task_id": "connector-alphabet-change", + "priority_revision": 4, + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "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": "changed", + "actual_scope": "Price the transfer-coupled dual of shape (p,a,b)=(5,1,1) at total Q=7 in the PR1898 alphabet: shared restored prefix of length 5, priced transfer C>=1, divergent length-1 tips, independent dirt, dual even-parity readout, fair shared-prefix XOR billing. Prove covering min R=84 and min fair X at R=84 equals 9, so tariff floor 452>436.", + "scope_change_reason": "The drawn connector-alphabet card is redirected to the explicit transfer-coupled open question left by partitioned independent-walks on the #2715 / #2761 lineage, which is the remaining freestanding priced obstruction outside leave-alones and pending packages.", + "bottleneck_link": "A priced transfer-coupled dual decides whether sharing a query prefix across two dirt ports can undercut the six-query endpoint after charging the transfer.", + "budget_minutes": 60, + "stop_rule": "Stop after (5,1,1) dual census, fair-X floor on R=84, C>=1 control, tariff floor, package tests; no full other-shape census, no same-walk reopen, no host screens, no soft-overlap with #2643.", + "outcome": "completed", + "evidence": "CERTIFICATE.json covering 8749440 with R in {84,88,90}; min R=84; among 1458240 R=84 pairs min fair X=9 (witness prefix (0,1,3,6,12) tips 8,16); tariff floor 452; independent checker; corruption controls.", + "author": "Wentao Li", + "ai_assistance": "Substantial AI assistance for derivation, implementation, checking and writing.", + "open_questions": [ + { + "question": "Do other transfer-coupled shapes (p,a,b) with p+a+b=7 and min(a,b)>=1 (e.g. (4,1,2), (3,2,2)) achieve covering R<=84 after the same dirty bill?", + "why_it_matters": "Closes the remaining transfer-coupled shapes; spot samples already show observed min R>=86, which cannot undercut.", + "first_step": "Full set-based dual census for (4,1,2) and (3,2,2) with distinct labels.", + "blocked_by": "Larger search." + }, + { + "question": "Does the dirty-shadow sym-diff collapse extend verbatim to eight queries?", + "why_it_matters": "Companion of #2761/#2764 open questions on priced-shadow readout.", + "first_step": "Reuse the snapshot lemma on length-8 slot lists.", + "blocked_by": "Separate freestanding package; leave-alone #2761/#2764 fixtures." + } + ], + "predecessors": [ + { + "pr": 1898, + "credit": "Arham Tahir; minimum-query endpoint and abstract tariff fixture" + }, + { + "pr": 2715, + "credit": "Wentao Li; cheaper-readout obstruction; transfer-coupled OQ lineage" + }, + { + "pr": 2761, + "credit": "Wentao Li; multi-connector / priced-shadow; independent-walks OQ" + }, + { + "pr": 2686, + "credit": "Wentao Li; even-subset R floor on one walk" + }, + { + "pr": 2643, + "credit": "Wentao Li; seven-query XOR floor X>=6" + }, + { + "pr": 2677, + "credit": "Wentao Li; path-lowered 7-9Q invoices" + }, + { + "pr": 2455, + "credit": "ywz65; six-query XOR necessity" + }, + { + "pr": 1370, + "credit": "Arham Tahir; path-local shear lowering / four-X word" + }, + { + "pr": 1524, + "credit": "TennisBowling; equal-price theorem / unequal-price handoff" + } + ] +} diff --git a/research/transfer-coupled-7q-obstruction/VERIFY.json b/research/transfer-coupled-7q-obstruction/VERIFY.json new file mode 100644 index 0000000000..77fb33c5ff --- /dev/null +++ b/research/transfer-coupled-7q-obstruction/VERIFY.json @@ -0,0 +1,52 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/mutable-source-shear-cost/CERTIFICATE.json" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 180, + "checks": "Transfer-coupled (5,1,1) dual census; fair-X floor on R=84; C>=1 control; champion; tariff floor 452; certificate match; source pins" + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 180, + "checks": "Same admission under PYTHONOPTIMIZE via need()" + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/independent.py" + ], + "timeout_seconds": 180, + "checks": "Separate (5,1,1) dual census, fair-X floor, champion, tariff arithmetic" + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/test_package.py" + ], + "timeout_seconds": 600, + "checks": "Corruption rejection, duplicate JSON keys, -O controls, independent replay" + } + ] +} diff --git a/research/transfer-coupled-7q-obstruction/independent.py b/research/transfer-coupled-7q-obstruction/independent.py new file mode 100644 index 0000000000..f49db68cd5 --- /dev/null +++ b/research/transfer-coupled-7q-obstruction/independent.py @@ -0,0 +1,220 @@ +#!/usr/bin/env python3 +"""Independent transfer-coupled (5,1,1) census at Q=7. + +Does not import model.py or verify.py. Prepared by Wentao Li with substantial +AI assistance. Apache-2.0. +""" +from __future__ import annotations + +import json +from collections import Counter +from itertools import combinations, permutations +from multiprocessing import Pool +from pathlib import Path + +HERE = Path(__file__).resolve().parent +CERT_PATH = HERE / "CERTIFICATE.json" +INF = 99 + +EXPECTED_COVERING = 8749440 +EXPECTED_HIST = {84: 1458240, 88: 2083200, 90: 5208000} +EXPECTED_MIN_X = 9 +EXPECTED_TARIFF = 452 + + +def fail(message): + raise SystemExit(f"FAIL_INDEPENDENT: {message}") + + +def even_table(nz5): + slots = (0,) + tuple(nz5) + even = [INF] * 32 + even[0] = 0 + for bits in range(1, 64): + size = bits.bit_count() + if size % 2: + continue + value = 0 + for i in range(6): + if bits >> i & 1: + value ^= slots[i] + if size < even[value]: + even[value] = size + return even + + +def edge(a, b): + d = a ^ b + if d == 0: + return None + return 2 * (d.bit_count() - 1) + + +def dual(e0, e1): + reach = [(i, e0[i]) for i in range(32) if e0[i] < INF] + total = 0 + for m in range(1, 32): + best = INF + for i, c0 in reach: + c1 = e1[i ^ m] + if c1 < INF and c0 + c1 < best: + best = c0 + c1 + if best >= INF: + return None + total += best + return total + + +def path_ends(P): + best = {p: INF for p in P} + for pref in permutations(P): + cost = 0 + prev = 0 + ok = True + for v in pref: + c = edge(prev, v) + if c is None: + ok = False + break + cost += c + prev = v + if ok and cost < best[pref[-1]]: + best[pref[-1]] = cost + return best + + +def min_fair_x(P, a, b): + best = INF + best_prefix = None + for pref in permutations(P): + x = 0 + prev = 0 + ok = True + for v in pref: + c = edge(prev, v) + if c is None: + ok = False + break + x += c + prev = v + if not ok: + continue + x += 1 # transfer C + pend = pref[-1] + for tip in (a, b): + c = edge(pend, tip) + if c is None: + ok = False + break + x += c + c = edge(tip, 0) + if c is None: + ok = False + break + x += c + if not ok: + continue + if x < best: + best = x + best_prefix = (0,) + pref + return None if best >= INF else (best, best_prefix) + + +def worker(P): + P = tuple(P) + rem = [x for x in range(1, 32) if x not in P] + tables = {t: even_table(P + (t,)) for t in rem} + ends = path_ends(P) + hist = Counter() + covering = 0 + min_x = INF + witness = None + for i, a in enumerate(rem): + ea = tables[a] + for b in rem[i + 1 :]: + r = dual(ea, tables[b]) + if r is None: + continue + covering += 1 + hist[r] += 1 + if r != 84: + continue + close = 2 * (a.bit_count() - 1) + 2 * (b.bit_count() - 1) + lb = INF + for pend in P: + ca = edge(pend, a) + cb = edge(pend, b) + if ca is None or cb is None or ends[pend] >= INF: + continue + lb = min(lb, ends[pend] + 1 + ca + cb + close) + if lb <= 9: + got = min_fair_x(P, a, b) + if got and got[0] < min_x: + min_x = got[0] + witness = (got[1], a, b, got[0]) + return covering, dict(hist), min_x, witness + + +def tariff(q, r, x): + return 38 * q + 2 * r + 2 * x + + +def main(): + with Pool() as pool: + results = pool.map(worker, list(combinations(range(1, 32), 4)), chunksize=32) + + covering = 0 + hist = Counter() + min_x = INF + witness = None + for c, h, mx, w in results: + covering += c + hist.update(h) + if mx < min_x: + min_x = mx + witness = w + + if covering != EXPECTED_COVERING: + fail(f"covering {covering} != {EXPECTED_COVERING}") + if dict(hist) != EXPECTED_HIST: + fail(f"histogram {dict(hist)}") + if min(hist) != 84: + fail(f"min R {min(hist)}") + if min_x != EXPECTED_MIN_X: + fail(f"min X {min_x}") + if witness is None: + fail("missing witness") + + prefix, a, b, x = witness + r = dual(even_table(prefix[1:] + (a,)), even_table(prefix[1:] + (b,))) + if r != 84 or x != 9: + fail(f"witness recompute R={r} X={x}") + t = tariff(7, r, x) + if t != EXPECTED_TARIFF: + fail(f"tariff {t}") + if t <= 436: + fail("undercuts endpoint") + + # Cross-check pinned certificate without importing model. + cert = json.loads(CERT_PATH.read_text(encoding="utf-8")) + claim = cert["claim"] + if claim["covering_pairs"] != covering: + fail("cert covering") + if claim["min_R"] != 84 or claim["min_fair_X_at_R84"] != 9: + fail("cert floors") + if claim["tariff_floor"] != t: + fail("cert tariff") + if claim.get("undercuts_436_after_complete_bill") is not False: + fail("cert undercut flag") + + print( + "PASS_INDEPENDENT_TRANSFER_COUPLED_7Q " + f"covering={covering} min_R=84 min_fair_X={min_x} tariff_floor={t} " + f"champion_prefix={list(prefix)} tips=[{a}, {b}] " + "answers_transfer_coupled_511 no_new_kappa" + ) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/research/transfer-coupled-7q-obstruction/model.py b/research/transfer-coupled-7q-obstruction/model.py new file mode 100644 index 0000000000..537690cc8a --- /dev/null +++ b/research/transfer-coupled-7q-obstruction/model.py @@ -0,0 +1,384 @@ +"""Transfer-coupled dual readout at seven queries, shape (5,1,1). + +Answers the transfer-coupled open question left by partitioned independent +walks (#2715 / multi-connector lineage / independent-walks-7q): shared prefix, +priced transfer C≥1, divergent length-1 suffixes, total Q=p+a+b=7, dual +even-parity dirt-legal readout with fair shared-prefix XOR billing. + +Scoped to the maximal-sharing fork (p,a,b)=(5,1,1) (walks of length 6+6). +Self-contained relative to PR1898 / #2643 / #2686 / #2715 / #2761 / #2764 / +independent-walks. Prepared by Wentao Li with substantial AI assistance. +Apache-2.0. +""" +from __future__ import annotations + +from collections import Counter +from itertools import combinations, permutations +from multiprocessing import Pool + +INF = 99 + +EXPECTED = { + "shape": (5, 1, 1), + "Q": 7, + "covering_pairs": 8749440, + "attainable_R": [84, 88, 90], + "histogram": {"84": 1458240, "88": 2083200, "90": 5208000}, + "min_R": 84, + "n_R84": 1458240, + "min_fair_X_at_R84": 9, + "champion_prefix": (0, 1, 3, 6, 12), + "champion_tips": (8, 16), + "champion_R": 84, + "champion_fair_X": 9, + "champion_tariff": 452, + "tariff_floor": 452, + "endpoint_tariff_Q6": 436, + "transfer_C_min": 1, + "partitioned_min_R": 112, +} + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def tariff_qrx(q, r, x, extra=0): + """Abstract complete-call tariff at (b,a,x)=(38,2,2), plus optional extras.""" + leaves = 28 * q + r + nodes = 9 * q + dispatch = q + r + x + return leaves + nodes + x + dispatch + extra + + +def edge_cost(a, b): + delta = a ^ b + if delta == 0: + return None + return 2 * (delta.bit_count() - 1) + + +def even_table_nz5(nz5): + """Even-subset table on slots (0,) + five nonzero labels (order-irrelevant).""" + slots = (0,) + tuple(nz5) + even = [INF] * 32 + even[0] = 0 + for bits in range(1, 64): + size = bits.bit_count() + if size % 2: + continue + value = 0 + for i in range(6): + if bits >> i & 1: + value ^= slots[i] + if size < even[value]: + even[value] = size + return even + + +def dual_independent_R(e0, e1): + """Σ_m min_a (e0[a] + e1[a⊕m]) with independent even-parity ports.""" + reach0 = [(a, e0[a]) for a in range(32) if e0[a] < INF] + total = 0 + for m in range(1, 32): + best = INF + for a, c0 in reach0: + c1 = e1[a ^ m] + if c1 < INF: + cost = c0 + c1 + if cost < best: + best = cost + if best >= INF: + return None + total += best + return total + + +def fair_X(prefix, tip_a, tip_b, C=1): + """Fair shared-prefix XOR bill: prefix edges once + transfer C + both tip chains. + + Each tip chain is (prefix_end → tip → 0). Prefix must start at 0. + """ + need(type(prefix) is tuple and prefix and prefix[0] == 0, "prefix starts at 0") + need(C >= 1, "priced transfer C>=1") + x = 0 + prev = prefix[0] + for v in prefix[1:]: + c = edge_cost(prev, v) + if c is None: + return None + x += c + prev = v + x += C + pend = prefix[-1] + for tip in (tip_a, tip_b): + c = edge_cost(pend, tip) + if c is None: + return None + x += c + c = edge_cost(tip, 0) + if c is None: + return None + x += c + return x + + +def min_path_costs_to_ends(nonzero_prefix): + """Min Hamiltonian path cost from 0 through all nonzero prefix labels, by end.""" + best = {p: INF for p in nonzero_prefix} + for pref in permutations(nonzero_prefix): + cost = 0 + prev = 0 + ok = True + for v in pref: + c = edge_cost(prev, v) + if c is None: + ok = False + break + cost += c + prev = v + if not ok: + continue + pend = pref[-1] + if cost < best[pend]: + best[pend] = cost + return best + + +def fair_X_lower_bound(nonzero_prefix, tip_a, tip_b, path_to, C=1): + """Exact min over prefix orders of fair_X, via end-point decomposition.""" + close = 2 * (tip_a.bit_count() - 1) + 2 * (tip_b.bit_count() - 1) + best = INF + for pend in nonzero_prefix: + ca = edge_cost(pend, tip_a) + cb = edge_cost(pend, tip_b) + if ca is None or cb is None: + continue + pc = path_to[pend] + if pc >= INF: + continue + lb = pc + C + ca + cb + close + if lb < best: + best = lb + return None if best >= INF else best + + +def min_fair_X_over_orders(nonzero_prefix, tip_a, tip_b, C=1): + best = None + for pref in permutations(nonzero_prefix): + prefix = (0,) + pref + x = fair_X(prefix, tip_a, tip_b, C) + if x is None: + continue + if best is None or x < best[0]: + best = (x, prefix) + return best + + +def _process_prefix_set(P): + """Worker: census tip pairs for one 4-set prefix; track R=84 X bounds.""" + P = tuple(P) + rem = [x for x in range(1, 32) if x not in P] + tables = {t: even_table_nz5(P + (t,)) for t in rem} + path_to = min_path_costs_to_ends(P) + local = Counter() + covering = 0 + n84 = 0 + min_x = INF + witness = None + for i, a in enumerate(rem): + ea = tables[a] + reach0 = [(x, ea[x]) for x in range(32) if ea[x] < INF] + for b in rem[i + 1 :]: + e1 = tables[b] + total = 0 + ok = True + for m in range(1, 32): + best = INF + for x, c0 in reach0: + c1 = e1[x ^ m] + if c1 < INF: + cost = c0 + c1 + if cost < best: + best = cost + if best >= INF: + ok = False + break + total += best + if not ok: + continue + covering += 1 + local[total] += 1 + if total != 84: + continue + n84 += 1 + lb = fair_X_lower_bound(P, a, b, path_to, C=1) + if lb is None: + continue + if lb <= 9: + exact = min_fair_X_over_orders(P, a, b, C=1) + if exact is None: + continue + x, prefix = exact + need(x >= lb, "fair X below decomposed lower bound") + if x < min_x: + min_x = x + witness = (prefix, a, b, x) + return covering, dict(local), n84, min_x, witness + + +def enumerate_511(workers=None): + """Full distinct-label (5,1,1) dual census with fair-X floor on R=84.""" + prefix_sets = list(combinations(range(1, 32), 4)) + hist = Counter() + covering = 0 + n84 = 0 + min_x = INF + witness = None + with Pool(processes=workers) as pool: + for c, local, n, mx, w in pool.imap_unordered( + _process_prefix_set, prefix_sets, chunksize=32 + ): + covering += c + hist.update(local) + n84 += n + if mx < min_x: + min_x = mx + witness = w + need(covering > 0, "expected covering pairs") + need(min_x < INF and witness is not None, "expected R=84 witness") + attainable = sorted(hist) + return { + "kind": "transfer_coupled_5_1_1", + "Q": 7, + "shape": [5, 1, 1], + "covering_pairs": covering, + "n_R84": n84, + "attainable_R": attainable, + "histogram": {str(r): hist[r] for r in attainable}, + "min_R": min(attainable), + "min_fair_X_at_R84": min_x, + "champion": { + "prefix": list(witness[0]), + "tips": [witness[1], witness[2]], + "R": 84, + "fair_X": witness[3], + "tariff": tariff_qrx(7, 84, witness[3]), + "transfer_C": 1, + }, + "tariff_floor": tariff_qrx(7, 84, min_x), + "endpoint_Q6": EXPECTED["endpoint_tariff_Q6"], + } + + +def champion_recompute(): + """Recompute dual R and fair X on the pinned champion (not copied).""" + prefix = EXPECTED["champion_prefix"] + a, b = EXPECTED["champion_tips"] + nz0 = prefix[1:] + (a,) + nz1 = prefix[1:] + (b,) + r = dual_independent_R(even_table_nz5(nz0), even_table_nz5(nz1)) + x = fair_X(prefix, a, b, C=1) + need(r == EXPECTED["champion_R"], f"champion R {r}") + need(x == EXPECTED["champion_fair_X"], f"champion X {x}") + t = tariff_qrx(7, r, x) + need(t == EXPECTED["champion_tariff"], f"champion tariff {t}") + need(t > EXPECTED["endpoint_tariff_Q6"], "no undercut") + return { + "prefix": list(prefix), + "tips": [a, b], + "walks": [list(prefix + (a,)), list(prefix + (b,))], + "R": r, + "fair_X": x, + "transfer_C": 1, + "tariff": t, + } + + +def r_undercut_threshold(): + """At Q=7, undercutting 436 requires R+X < 85 (with C folded into X).""" + # 38*7 + 2(R+X) < 436 ⇒ R+X < 85 + return 85 + + +def other_shape_samples(): + """Spot samples: shapes with observed min R≥86 cannot undercut (R+X≥86>85).""" + from random import Random + + rng = Random(0) + + def sample_shape(p_nz, a_len, b_len, trials=4000): + min_r = INF + covering = 0 + best = None + labels = list(range(1, 32)) + for _ in range(trials): + if p_nz: + P = tuple(sorted(rng.sample(labels, p_nz))) + else: + P = () + rem = [x for x in labels if x not in P] + A = tuple(sorted(rng.sample(rem, a_len))) + rem2 = [x for x in rem if x not in A] + B = tuple(sorted(rng.sample(rem2, b_len))) + slots0 = (0,) + P + A + slots1 = (0,) + P + B + + def even_slots(slots): + n = len(slots) + even = [INF] * 32 + even[0] = 0 + for bits in range(1, 1 << n): + size = bits.bit_count() + if size % 2: + continue + value = 0 + for i in range(n): + if bits >> i & 1: + value ^= slots[i] + if size < even[value]: + even[value] = size + return even + + r = dual_independent_R(even_slots(slots0), even_slots(slots1)) + if r is None: + continue + covering += 1 + if r < min_r: + min_r = r + best = {"P": list(P), "A": list(A), "B": list(B), "R": r} + return { + "covering_samples": covering, + "min_R_observed": None if min_r >= INF else min_r, + "best": best, + "cannot_undercut_if_R_ge_86": (min_r >= 86) if min_r < INF else None, + } + + return { + "threshold_R_plus_X": r_undercut_threshold(), + "shape_4_1_2": sample_shape(3, 1, 2), + "shape_3_2_2": sample_shape(2, 2, 2), + "shape_3_1_3": sample_shape(2, 1, 3), + "note": ( + "Samples only; not a full other-shape census. Observed minima ≥86 " + "already forbid undercutting at Q=7 because R+X≥86>85." + ), + } + + +def transfer_C_controls(): + """C=0 is outside the priced-transfer interface; C≥1 is required.""" + prefix = EXPECTED["champion_prefix"] + a, b = EXPECTED["champion_tips"] + try: + fair_X(prefix, a, b, C=0) + c0_rejected = False + except ValueError: + c0_rejected = True + x1 = fair_X(prefix, a, b, C=1) + return { + "C0_rejected_by_need": c0_rejected, + "C1_fair_X": x1, + "transfer_C_min": 1, + } diff --git a/research/transfer-coupled-7q-obstruction/test_package.py b/research/transfer-coupled-7q-obstruction/test_package.py new file mode 100644 index 0000000000..cbcfdf6255 --- /dev/null +++ b/research/transfer-coupled-7q-obstruction/test_package.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +"""Package fault controls for transfer-coupled 7q obstruction. Wentao Li + AI.""" +from __future__ import annotations + +import json +import shutil +import subprocess +import sys +import tempfile +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +PKG_NAME = "transfer-coupled-7q-obstruction" + + +def need(ok, message): + if not ok: + raise SystemExit(f"FAIL_TEST: {message}") + + +def run(args, cwd=None): + return subprocess.run(args, cwd=cwd or ROOT, text=True, capture_output=True) + + +def main(): + # 1) Default read-only verify. + proc = run([sys.executable, "-I", "-B", str(HERE / "verify.py")]) + need(proc.returncode == 0, proc.stderr + proc.stdout) + need("PASS_TRANSFER_COUPLED_7Q_OBSTRUCTION" in proc.stdout, proc.stdout) + + # 2) -O admission via need(). + proc = run([sys.executable, "-I", "-O", "-B", str(HERE / "verify.py")]) + need(proc.returncode == 0, proc.stderr + proc.stdout) + need("PASS_TRANSFER_COUPLED_7Q_OBSTRUCTION" in proc.stdout, proc.stdout) + + # 3) Certificate claim corruption fails. + with tempfile.TemporaryDirectory() as tmp: + tmp_path = Path(tmp) + research = tmp_path / "research" / PKG_NAME + shutil.copytree(HERE, research) + pinned = tmp_path / "research" / "mutable-source-shear-cost" + pinned.mkdir(parents=True) + shutil.copy2( + ROOT / "research" / "mutable-source-shear-cost" / "CERTIFICATE.json", + pinned / "CERTIFICATE.json", + ) + cert = research / "CERTIFICATE.json" + data = json.loads(cert.read_text(encoding="utf-8")) + data["claim"]["min_R"] = 0 + cert.write_text(json.dumps(data, indent=2) + "\n", encoding="utf-8") + proc = run([sys.executable, "-I", "-B", str(research / "verify.py")], cwd=tmp_path) + need(proc.returncode != 0, "corrupted certificate should fail") + + # 4) Source pin corruption rejection. + with tempfile.TemporaryDirectory() as tmp: + tmp_path = Path(tmp) + research = tmp_path / "research" / PKG_NAME + shutil.copytree(HERE, research) + pinned = tmp_path / "research" / "mutable-source-shear-cost" + pinned.mkdir(parents=True) + src = ROOT / "research" / "mutable-source-shear-cost" / "CERTIFICATE.json" + (pinned / "CERTIFICATE.json").write_bytes(src.read_bytes() + b"\n") + proc = run([sys.executable, "-I", "-B", str(research / "verify.py")], cwd=tmp_path) + need(proc.returncode != 0, "source drift should fail") + + # 5) Independent checker. + proc = run([sys.executable, "-I", "-B", str(HERE / "independent.py")]) + need(proc.returncode == 0, proc.stderr + proc.stdout) + need("PASS_INDEPENDENT_TRANSFER_COUPLED_7Q" in proc.stdout, proc.stdout) + + # 6) Duplicate JSON key rejection. + with tempfile.TemporaryDirectory() as tmp: + tmp_path = Path(tmp) + research = tmp_path / "research" / PKG_NAME + shutil.copytree(HERE, research) + pinned = tmp_path / "research" / "mutable-source-shear-cost" + pinned.mkdir(parents=True) + shutil.copy2( + ROOT / "research" / "mutable-source-shear-cost" / "CERTIFICATE.json", + pinned / "CERTIFICATE.json", + ) + cert = research / "CERTIFICATE.json" + raw = cert.read_text(encoding="utf-8") + corrupted = raw.replace( + '"schema_version": 1,', + '"schema_version": 1,\n "schema_version": 2,', + 1, + ) + need(corrupted != raw, "failed to inject duplicate key") + cert.write_text(corrupted, encoding="utf-8") + proc = run([sys.executable, "-I", "-B", str(research / "verify.py")], cwd=tmp_path) + need(proc.returncode != 0, "duplicate JSON key should fail") + + print("PASS_TRANSFER_COUPLED_7Q_PACKAGE_TESTS groups=6") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/research/transfer-coupled-7q-obstruction/verify.py b/research/transfer-coupled-7q-obstruction/verify.py new file mode 100644 index 0000000000..3cebedb578 --- /dev/null +++ b/research/transfer-coupled-7q-obstruction/verify.py @@ -0,0 +1,199 @@ +#!/usr/bin/env python3 +"""Transfer-coupled (5,1,1) obstruction at Q=7; read-only default. + +Prepared by Wentao Li with substantial AI assistance. Apache-2.0. +""" +from __future__ import annotations + +import argparse +import hashlib +import json +import sys +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +sys.path.insert(0, str(HERE)) +from model import ( # noqa: E402 + EXPECTED, + champion_recompute, + dual_independent_R, + enumerate_511, + even_table_nz5, + fair_X, + other_shape_samples, + r_undercut_threshold, + tariff_qrx, + transfer_C_controls, +) + +CERT_PATH = HERE / "CERTIFICATE.json" +SOURCES_PATH = HERE / "SOURCES.json" + + +def need(ok, message): + if not ok: + raise SystemExit(f"FAIL: {message}") + + +def sha256(path: Path) -> str: + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def load_json_reject_duplicates(path: Path): + text = path.read_text(encoding="utf-8") + + def _hook(pairs): + out = {} + for key, value in pairs: + if key in out: + raise ValueError(f"duplicate JSON key {key!r} in {path}") + out[key] = value + return out + + return json.loads(text, object_pairs_hook=_hook) + + +def check_source_pins(): + sources = load_json_reject_duplicates(SOURCES_PATH) + for rec in sources["files"]: + if rec["usage"] != "input": + continue + live = ROOT / rec["path"] + need(live.is_file(), f"missing input {rec['path']}") + need(sha256(live) == rec["sha256"], f"source bytes mismatch: {rec['path']}") + + +def build_certificate(): + census = enumerate_511() + need(census["covering_pairs"] == EXPECTED["covering_pairs"], "covering count") + need(census["min_R"] == EXPECTED["min_R"], "min R") + need(census["histogram"] == EXPECTED["histogram"], "histogram") + need(census["attainable_R"] == EXPECTED["attainable_R"], "attainable R") + need(census["n_R84"] == EXPECTED["n_R84"], "n R84") + need(census["min_fair_X_at_R84"] == EXPECTED["min_fair_X_at_R84"], "min fair X") + need(census["tariff_floor"] == EXPECTED["tariff_floor"], "tariff floor") + need(census["tariff_floor"] > EXPECTED["endpoint_tariff_Q6"], "no undercut") + + champ = champion_recompute() + need(champ["R"] == 84 and champ["fair_X"] == 9, "champion recompute") + + # Explicit dual recomputation (not copied from constant). + prefix = tuple(champ["prefix"]) + a, b = champ["tips"] + r = dual_independent_R( + even_table_nz5(prefix[1:] + (a,)), even_table_nz5(prefix[1:] + (b,)) + ) + need(r == 84, "explicit dual") + need(fair_X(prefix, a, b, C=1) == 9, "explicit fair X") + + controls = transfer_C_controls() + need(controls["C0_rejected_by_need"], "C=0 must be rejected") + need(controls["C1_fair_X"] == 9, "C=1 control") + + samples = other_shape_samples() + need(samples["threshold_R_plus_X"] == 85, "undercut threshold") + for key in ("shape_4_1_2", "shape_3_2_2", "shape_3_1_3"): + obs = samples[key]["min_R_observed"] + need(obs is not None and obs >= 86, f"{key} sample min R") + + need(tariff_qrx(7, 84, 9) == 452, "tariff arithmetic") + # Endpoint 436 is the PR1898 six-query complete-call pin (not re-derived here). + need(EXPECTED["endpoint_tariff_Q6"] == 436, "endpoint pin") + need(tariff_qrx(7, 84, 9) > 436, "floor above endpoint") + + return { + "schema_version": 1, + "status": "PASS_TRANSFER_COUPLED_7Q_OBSTRUCTION", + "scope": ( + "Five-source common-B mutable-source Q/R/X alphabet (PR1898). " + "Transfer-coupled dual at Q=7 with shape (p,a,b)=(5,1,1): shared " + "prefix length 5, priced transfer C>=1, divergent length-1 tips, " + "independent dirt, dual even-parity readout, fair shared-prefix XOR " + "billing. Covering min R=84; min fair X at R=84 is 9; tariff floor " + "452>436. Answers transfer-coupled OQ for the maximal-sharing fork." + ), + "claim": { + "Q": 7, + "shape": [5, 1, 1], + "covering_pairs": census["covering_pairs"], + "min_R": 84, + "min_fair_X_at_R84": 9, + "tariff_floor": 452, + "endpoint_Q6_tariff": 436, + "undercuts_436_after_complete_bill": False, + "transfer_C_min": 1, + "answers_transfer_coupled_511": True, + "oq_answer": ( + "Every covering distinct-label transfer-coupled schedule of shape " + "(5,1,1) at total Q=7 (shared restored prefix of length 5, two " + "divergent nonzero tips, priced transfer C>=1, independent dirt, " + "dual even-parity readout, fair shared-prefix XOR billing) has " + "R>=84. Among the 1458240 covering pairs with R=84, every fair-X " + "bill is >=9 (witness X=9). Abstract tariff floor is therefore " + "38*7+2*84+2*9=452>436. C=0 is rejected. Other (p,a,b) shapes are " + "out of full census here; spot samples show observed min R>=86, " + "which already cannot undercut because R+X>=86>85." + ), + "no_new_kappa": True, + }, + "census_5_1_1": census, + "champion": champ, + "transfer_C_controls": controls, + "other_shape_samples": samples, + "unit_tariff": {"b": 38, "a": 2, "x": 2}, + "tariff_check": { + "formula": "38*Q + 2*R + 2*X (C folded into fair X)", + "floor_R84_X9": 452, + "endpoint_Q6": 436, + "undercut_requires_R_plus_X_lt": r_undercut_threshold(), + }, + } + + +def main(argv=None): + ap = argparse.ArgumentParser(description=__doc__) + ap.add_argument( + "--write-certificate", + action="store_true", + help="rewrite CERTIFICATE.json (default is read-only check)", + ) + args = ap.parse_args(argv) + + check_source_pins() + cert = build_certificate() + + if args.write_certificate: + CERT_PATH.write_text(json.dumps(cert, indent=2) + "\n", encoding="utf-8") + else: + need(CERT_PATH.is_file(), "missing CERTIFICATE.json") + pinned = load_json_reject_duplicates(CERT_PATH) + need(pinned["status"] == cert["status"], "certificate status") + need(pinned["claim"] == cert["claim"], "certificate claim drift") + need( + pinned["census_5_1_1"]["covering_pairs"] == cert["census_5_1_1"]["covering_pairs"], + "census covering drift", + ) + need( + pinned["census_5_1_1"]["histogram"] == cert["census_5_1_1"]["histogram"], + "census histogram drift", + ) + need( + pinned["census_5_1_1"]["min_fair_X_at_R84"] + == cert["census_5_1_1"]["min_fair_X_at_R84"], + "fair X drift", + ) + need(pinned["champion"]["tariff"] == cert["champion"]["tariff"], "champion drift") + + print( + "PASS_TRANSFER_COUPLED_7Q_OBSTRUCTION " + f"covering={cert['claim']['covering_pairs']} min_R={cert['claim']['min_R']} " + f"min_fair_X={cert['claim']['min_fair_X_at_R84']} " + f"tariff_floor={cert['claim']['tariff_floor']} " + "answers_transfer_coupled_511 no_new_kappa" + ) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main())