diff --git a/research/independent-walks-8q-obstruction/CERTIFICATE.json b/research/independent-walks-8q-obstruction/CERTIFICATE.json new file mode 100644 index 0000000000..1d4be4c2d7 --- /dev/null +++ b/research/independent-walks-8q-obstruction/CERTIFICATE.json @@ -0,0 +1,286 @@ +{ + "schema_version": 1, + "status": "PASS_INDEPENDENT_WALKS_8Q_OBSTRUCTION", + "scope": "Five-source common-B mutable-source Q/R/X alphabet (PR1898) at (b,a,x)=(38,2,2). Freestanding partitioned independent dual walks at total Q=8 (valid restored lengths (2,6), (3,5), (4,4)): covering dual even-parity readout has global min R=92 at (2,6); tariff floor at X=0 is 488>436. Answers dirty-shadow/#2840 OQ2 / onerepeat OQ2 by naming one new priced alphabet at eight queries.", + "claim": { + "Q": 8, + "partition_covering_min_R": 92, + "partition_26_covering": 3916416, + "partition_35_covering": 10416000, + "partition_44_covering": 14165760, + "partition_26_min_R": 92, + "partition_35_min_R": 98, + "partition_44_min_R": 100, + "tariff_floor_at_X0": 488, + "endpoint_Q6_tariff": 436, + "undercuts_436_after_complete_bill": false, + "length1_walks_invalid": true, + "answers_priced_alphabet_q8_oq": true, + "oq_answer": "Every covering partitioned dual-walk schedule with total query count Q=n0+n1=8 (valid restored walks of lengths (2,6), (3,5), or (4,4), distinct nonzero labels within each walk, independent dirt, dual even-parity readout) has R\u226592, attained only on (2,6) (spectrum {92,96,104}; covering 3916416). Partitions (3,5) and (4,4) have min R 98 and 100. At X=0 the abstract tariff is already 488>436 under (b,a,x)=(38,2,2); positive path X only increases the bill. Length-1 components are not restored. Transfer-coupled / onerepeat / dirty-shadow leave-alones are not reopened.", + "no_new_kappa": true + }, + "partition_2_plus_6": { + "kind": "partition_2_plus_6", + "Q": 8, + "covering_pairs": 3916416, + "attainable_R": [ + 92, + 96, + 104 + ], + "histogram": { + "92": 1416576, + "96": 1249920, + "104": 1249920 + }, + "min_R": 92, + "first_witnesses": { + "92": [ + [ + 0, + 16 + ], + [ + 0, + 1, + 2, + 4, + 8, + 15 + ] + ], + "96": [ + [ + 0, + 1 + ], + [ + 0, + 1, + 2, + 4, + 8, + 16 + ] + ], + "104": [ + [ + 0, + 16 + ], + [ + 0, + 1, + 2, + 3, + 4, + 8 + ] + ] + }, + "champion_structural_rank4_outside": { + "applies": true, + "rank": 4, + "sigma_in_span": false, + "R": 92, + "sum_even": 30 + } + }, + "partition_3_plus_5": { + "kind": "partition_3_plus_5", + "Q": 8, + "covering_pairs": 10416000, + "attainable_R": [ + 98, + 104 + ], + "histogram": { + "98": 3124800, + "104": 7291200 + }, + "min_R": 98, + "first_witnesses": { + "98": [ + [ + 0, + 1, + 2 + ], + [ + 0, + 4, + 8, + 13, + 16 + ] + ], + "104": [ + [ + 0, + 1, + 2 + ], + [ + 0, + 1, + 4, + 8, + 16 + ] + ] + } + }, + "partition_4_plus_4": { + "kind": "partition_4_plus_4", + "Q": 8, + "covering_pairs": 14165760, + "attainable_R": [ + 100, + 104, + 112 + ], + "histogram": { + "100": 3610880, + "104": 9999360, + "112": 555520 + }, + "min_R": 100, + "first_witnesses": { + "100": [ + [ + 0, + 1, + 2, + 4 + ], + [ + 0, + 7, + 8, + 16 + ] + ], + "104": [ + [ + 0, + 1, + 2, + 4 + ], + [ + 0, + 1, + 8, + 16 + ] + ], + "112": [ + [ + 0, + 1, + 2, + 3 + ], + [ + 0, + 4, + 8, + 16 + ] + ] + } + }, + "champion": { + "champion_26": { + "walks": [ + [ + 0, + 16 + ], + [ + 0, + 1, + 2, + 4, + 8, + 15 + ] + ], + "R": 92, + "path_X": 16, + "tariff": 520, + "structural_rank4_outside": { + "applies": true, + "rank": 4, + "sigma_in_span": false, + "R": 92, + "sum_even": 30 + } + }, + "champion_35": { + "walks": [ + [ + 0, + 1, + 2 + ], + [ + 0, + 4, + 8, + 13, + 16 + ] + ], + "R": 98, + "path_X": 12, + "tariff": 524 + }, + "champion_44": { + "walks": [ + [ + 0, + 1, + 2, + 4 + ], + [ + 0, + 7, + 8, + 16 + ] + ], + "R": 100, + "path_X": 16, + "tariff": 536 + }, + "tariff_floor_at_X0": 488, + "endpoint_Q6": 436, + "single_walk_even_min_R_Q8": 74, + "partition_min_R": 92 + }, + "length1_invalid_examples": [ + { + "slots": [ + 0 + ], + "valid_restored_walk": false, + "path_X": null, + "note": "closed_(0,0)_zero_edge" + } + ], + "unit_tariff": { + "b": 38, + "a": 2, + "x": 2 + }, + "tariff_check": { + "formula": "38*Q + 2*R + 2*X", + "at_R92_X0": 488, + "champion_26": 520, + "champion_35": 524, + "champion_44": 536, + "endpoint_Q6": 436 + } +} diff --git a/research/independent-walks-8q-obstruction/NOTICE.md b/research/independent-walks-8q-obstruction/NOTICE.md new file mode 100644 index 0000000000..925a235af1 --- /dev/null +++ b/research/independent-walks-8q-obstruction/NOTICE.md @@ -0,0 +1,26 @@ +# 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 `(b,a,x)=(38,2,2)`. +- 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 at Q=8; not edited. +- Open #2779 `research/independent-walks-7q-obstruction` — partitioned dual at + Q=7; not edited; this package is the freestanding Q=8 companion. +- Open #2840 `research/dirty-shadow-8q-obstruction` — dirty-shadow at Q=8; OQ2 + answered here for partitioned independent walks; not edited. +- Open #2836 / #2817 transfer-coupled packages — leave-alone; not edited. +- Pending `cursor/transfer-coupled-onerepeat-7q-60b9@90d879d1` — not edited or + competed. +- Live pin: `research/mutable-source-shear-cost/CERTIFICATE.json`. + +Prepared by Wentao Li (VictorLiwentao, @Is__Victor) with substantial AI +assistance. diff --git a/research/independent-walks-8q-obstruction/PROOF.md b/research/independent-walks-8q-obstruction/PROOF.md new file mode 100644 index 0000000000..39a7ab331b --- /dev/null +++ b/research/independent-walks-8q-obstruction/PROOF.md @@ -0,0 +1,126 @@ +# Partitioned independent walks cannot undercut tariff 436 at Q=8 + +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) at unit +tariff `(b,a,x)=(38,2,2)`. It is a freestanding `#840`-style priced alphabet at +eight queries: two restored walks with **distinct slot lists**, independent +dirt, and dual even-parity readout. It answers open question 2 of +[#2840](https://github.com/CrocSwap/integer-mult-bounds/pull/2840) (and the +matching handoff on pending transfer-coupled-onerepeat): whether any other +priced readout alphabet undercuts the six-query endpoint tariff `436` at `Q=8` +after a complete dirty bill. + +No new kappa is claimed. Leave-alone packages through #2840 are not edited. +Pending `cursor/transfer-coupled-onerepeat-7q-60b9` is not edited or competed. + +## Setup + +Retain queries `Q_j`, readouts `R_m: y_m += A_m z`, and paid source shears +`X_(s,t)`. A **restored walk** of length `n` is an open slot list +`(s_0,…,s_{n-1})` with `s_0 = 0` whose closed completion `(s_0,…,s_{n-1},0)` +has only nonzero edges. Length-1 lists are illegal: the closed return is the +zero edge `(0,0)`. + +A **partitioned independent dual** of total query count `Q = 8` is a pair of +valid restored walks of lengths `(n_0,n_1)` with `n_0 + n_1 = 8` and +`n_0,n_1 ≥ 2`. Up to swap the only cases are `(2,6)`, `(3,5)`, and `(4,4)`. +Each walk carries its own dirt coefficient. For mask `m` the dual even-parity +cost is + +```text +min_a (e0[a] + e1[a ⊕ m]), +``` + +where `e_i` is the even-subset table of walk `i` (with `e_i[0] = 0`). + +The abstract complete-call tariff at `(b,a,x)=(38,2,2)` is `38·Q + 2·R + 2·X`. + +## Length-1 exclusion + +A length-1 list `(0,)` closes to `(0,0)`. That edge has XOR `0`, so it is not a +restored walk. Consequently `(1,7)` and `(7,1)` are not legal partitions of a +`Q = 8` dual schedule. + +## Fixture A: partition `(2,6)` + +Short walk `(0,σ)` has even table `e0[0]=0`, `e0[σ]=2`. Long walk +`(0,b_1,…,b_5)` with distinct nonzero labels. Dual cost collapses to + +```text +R = Σ_{m=1}^{31} min( e1[m], 2 + e1[m ⊕ σ] ). +``` + +**Lemma (rank-4 outside identity).** When the long span `V` has rank `4` and +`σ ∉ V`, masks in `V` pay `e1` and masks in the complementary coset pay +`2 + e1(· ⊕ σ)`, so + +```text +R = 2 · Σ_{v ∈ V \ {0}} e1[v] + 32. +``` + +On the champion `((0,16),(0,1,2,4,8,15))` one has `Σ e1 = 30`, hence +`R = 2·30 + 32 = 92`. The identity is machine-checked on that witness. + +**Census.** Distinct-label pairs: `31 · C(31,5) = 5267241` candidates; covering +count `3916416`; attainable `R ∈ {92,96,104}` with histogram +`1416576 / 1249920 / 1249920`. Minimum `R = 92`. + +Champion path `X = 16`, tariff `520`. The `X = 0` figure `488` is only the +abstract lower bound from `R = 92`. + +## Fixture B: partition `(3,5)` + +**Census.** Distinct-label pairs: `C(31,2)·C(31,4) = 14631225` candidates; +covering count `10416000`; attainable `R ∈ {98,104}` with histogram +`3124800 / 7291200`. Minimum `R = 98` (machine-checked dual `min_a` on every +covering pair). + +Champion: `((0,1,2), (0,4,8,13,16))` with path `X = 12`, tariff `520`. + +## Fixture C: partition `(4,4)` + +**Census.** Ordered distinct-label pairs: `C(31,3)² = 20205025` candidates; +covering count `14165760`; attainable `R ∈ {100,104,112}` with histogram +`3610880 / 9999360 / 555520`. Minimum `R = 100`. + +Champion: `((0,1,2,4), (0,7,8,16))` with path `X = 16`, tariff `536`. + +## Tariff consequence + +Every covering partitioned dual at `Q = 8` has `R ≥ 92`, attained only on +`(2,6)`. Even at `X = 0`, + +```text +38·8 + 2·92 + 2·0 = 488 > 436. +``` + +Positive path-`X` only increases the bill. Partitioned independent walks at +eight queries therefore cannot undercut the six-query endpoint under the PR1898 +abstract tariff. By comparison, a single same-walk even-subset schedule can +reach `R = 74` ([#2677](https://github.com/CrocSwap/integer-mult-bounds/pull/2677) +/ dirty-shadow collapse [#2840](https://github.com/CrocSwap/integer-mult-bounds/pull/2840)); +splitting the query budget across two independent dirt ports forces a worse +readout invoice (`R ≥ 92`). + +## Scope limits + +- Fixes the **partitioned** independent-walk interface at total `Q = 8` with + distinct nonzero labels within each walk. Transfer-coupled schedules, + transfer-coupled onerepeat, dirty-shadow, and same-walk multi-connector + leave-alones are outside and not edited. +- Shared non-path XOR schedules remain deferred (soft-overlap with #2643). +- Host screens are deferred. +- Soft-overlap transfer-coupled-dual/shapes vs #2817/#2836 is not opened. +- Leave-alone through #2840 (including #2836, #2817, #2779, #2764, #2761, + #2715, #2687, #2686, #2677, #2643, #2593, #2487) 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, `(b,a,x)=(38,2,2)` | — | +| #2677 | Distinct-slot `R≥74` at single-walk `Q=8` | — | +| #2779 | Partitioned dual walks at `Q=7` have exact `R=112` | — | +| #2840 | Dirty-shadow at `Q=8` matches even-subset; OQ2 | — | +| **This** | — | **Partitioned dual walks at `Q=8` have `R≥92` (min on `(2,6)`); tariff floor `488>436`** | diff --git a/research/independent-walks-8q-obstruction/README.md b/research/independent-walks-8q-obstruction/README.md new file mode 100644 index 0000000000..31ea4c9795 --- /dev/null +++ b/research/independent-walks-8q-obstruction/README.md @@ -0,0 +1,82 @@ +# Partitioned independent-walk obstruction at eight queries + +**Scoped obstruction / priced alphabet; no new kappa.** Freestanding +`#840`-style priced obstruction under +[#1898](https://github.com/CrocSwap/integer-mult-bounds/pull/1898) at +`(b,a,x)=(38,2,2)`. Names one new dirt-legal readout alphabet at `Q=8` outside +leave-alones through #2840 and pending +`cursor/transfer-coupled-onerepeat-7q-60b9`: two restored walks with distinct +slot lists, independent dirt, and dual even-parity readout. Answers open +question 2 of [#2840](https://github.com/CrocSwap/integer-mult-bounds/pull/2840) +(and the matching onerepeat handoff): does any other priced alphabet undercut +tariff `436` at eight queries after a complete dirty bill? + +| Dual schedule | Covering pairs | Exact min R | Tariff floor (X≥0) | Undercuts 436? | +|---|---:|---:|---:|---| +| Same-walk even-subset (#2677) | — | ≥74 | ≥452 at X=0 | no | +| Partition `(2,6)` | **3916416** | **92** | **≥488** | **no** | +| Partition `(3,5)` | **10416000** | **98** | **≥500** | **no** | +| Partition `(4,4)` | **14165760** | **100** | **≥504** | **no** | + +Global covering minimum is `R=92` on `(2,6)` only (spectrum `{92,96,104}`). +Abstract tariff `38·8 + 2·92 + 2·0 = 488 > 436`. Length-1 components are not +restored. Transfer-coupled / onerepeat / dirty-shadow fixtures are not edited. + +## Reproduction + +```sh +python3.12 -I -B research/independent-walks-8q-obstruction/verify.py +python3.12 -I -O -B research/independent-walks-8q-obstruction/verify.py +python3.12 -I -B research/independent-walks-8q-obstruction/independent.py +python3.12 -I -B research/independent-walks-8q-obstruction/test_package.py +python3.12 -B scripts/research_package.py --package research/independent-walks-8q-obstruction +``` + +Expected: + +```text +PASS_INDEPENDENT_WALKS_8Q_OBSTRUCTION partition_min_R=92 ... tariff_floor=488 ... answers_priced_alphabet_q8_oq no_new_kappa +PASS_INDEPENDENT_PARTITIONED_WALKS_8Q covering_26=3916416 covering_35=10416000 covering_44=14165760 partition_min_R=92 tariff_floor=488 ... no_new_kappa +PASS_INDEPENDENT_WALKS_8Q_PACKAGE_TESTS groups=6 +PASS_REGISTERED_RESEARCH_PACKAGE research/independent-walks-8q-obstruction outcome=completed +``` + +Default verify is read-only. Admission uses `need()`; `-O` also passes. + +## Overlap + +Base commit `0b1cccf86e2f5132ed286a26ef0a681a495740ea`. Direct predecessors: +PR1898, #2677 (distinct-slot `R≥74` at Q=8), #2779 (partitioned walks at Q=7), +#2840 (dirty-shadow at Q=8; OQ2). Leave-alone through #2840 including #2836, +#2817, #2779, #2764, #2761, #2715, #2687, #2686, #2677, #2643, #2593, #2487 is +respected; those packages are not edited. Pending +`cursor/transfer-coupled-onerepeat-7q-60b9@90d879d1` is not edited or competed. +Deferred soft-overlaps (transfer-coupled-dual/shapes vs #2817/#2836; shared-xor; +host screens) are not opened. + +## Open next questions + +1. Do non-distinct (one-repeat) layers inside a partitioned Q=8 walk improve on + `R=92` at `(2,6)`? + Why it matters: closes the one-repeat companion of the Hamilton layer at + eight queries without reopening transfer-coupled onerepeat. + First step: allow one repeated nonzero label in the length-6 walk of `(2,6)`. + Blocked by: larger search; expected to worsen coverage/cost. +2. Does any third priced readout alphabet under PR1898 `(b,a,x)=(38,2,2)` (beyond + same-walk / dirty-shadow / partitioned dual) undercut `436` at `Q=8`? + Why it matters: remaining unequal-price handoff after this freestanding + alphabet. + First step: name one new alphabet outside leave-alones and census dirt-legal R. + Blocked by: leave-alone packages through #2840; pending onerepeat. + +## Credit + +Credit **Arham Tahir / PR1898**, **ywz65 / PR2455**, **PR1370**, fork **789q** / +**#2677**, **#2643**, **#2686**, **#2715**, **#2761**, **#2779**, open **#2840** +(dirty-shadow; OQ2 answered here for partitioned independent walks; 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/independent-walks-8q-obstruction/SOURCES.json b/research/independent-walks-8q-obstruction/SOURCES.json new file mode 100644 index 0000000000..719b378cbd --- /dev/null +++ b/research/independent-walks-8q-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/independent-walks-8q-obstruction/TASK.json b/research/independent-walks-8q-obstruction/TASK.json new file mode 100644 index 0000000000..861e0ee370 --- /dev/null +++ b/research/independent-walks-8q-obstruction/TASK.json @@ -0,0 +1,112 @@ +{ + "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": "Freestanding #840-style priced obstruction under PR1898 (b,a,x)=(38,2,2): census partitioned independent dual walks at total Q=8 with lengths (2,6)/(3,5)/(4,4), show covering min R=92 on (2,6) and tariff floor 488>436 after a complete dirty bill, answering #2840 OQ2 / onerepeat OQ2 without editing leave-alones or pending onerepeat.", + "scope_change_reason": "The drawn connector-alphabet card is redirected to the explicit remaining freestanding Q=8 priced-alphabet handoff left by #2840 OQ2 on the #1898 lineage, using a new package name outside hard leave-alones through #2840, pending transfer-coupled-onerepeat, deferred transfer-coupled-dual/shapes soft-overlap, shared-XOR, and host screens.", + "bottleneck_link": "A priced partitioned dual-walk readout alphabet at Q=8 decides whether intermediate query counts can undercut the six-query endpoint by splitting the walk budget across independent dirt ports after the Q=7 partitioned and Q=8 same-walk collapses.", + "budget_minutes": 60, + "stop_rule": "Stop after (2,6)/(3,5)/(4,4) covering censuses, rank-4 outside identity on the (2,6) champion, tariff consequence, package tests; no transfer-coupled/onerepeat/dirty-shadow reopen, no shared-XOR reopening, no host screens.", + "outcome": "completed", + "evidence": "CERTIFICATE.json (2,6) covering 3916416 spectrum {92:1416576,96:1249920,104:1249920}; (3,5) 10416000 spectrum {98,104}; (4,4) 14165760 spectrum {100,104,112}; global min R=92; tariff floor 488; independent checker; corruption controls.", + "author": "Wentao Li", + "ai_assistance": "Substantial AI assistance for derivation, implementation, checking and writing.", + "open_questions": [ + { + "question": "Do non-distinct (one-repeat) layers inside a partitioned Q=8 walk improve on R=92 at (2,6)?", + "why_it_matters": "Closes the one-repeat companion of the Hamilton layer at eight queries without reopening transfer-coupled onerepeat.", + "first_step": "Allow one repeated nonzero label in the length-6 walk of (2,6).", + "blocked_by": "Larger search; expected to worsen coverage/cost." + }, + { + "question": "Does any third priced readout alphabet under PR1898 (b,a,x)=(38,2,2) (beyond same-walk / dirty-shadow / partitioned dual) undercut 436 at Q=8?", + "why_it_matters": "Remaining unequal-price handoff after this freestanding alphabet.", + "first_step": "Name one new alphabet outside leave-alones and census dirt-legal R.", + "blocked_by": "Leave-alone packages through #2840; pending onerepeat." + } + ], + "predecessors": [ + { + "pr": 1898, + "credit": "Arham Tahir; minimum-query endpoint and abstract tariff fixture" + }, + { + "pr": 2840, + "credit": "Wentao Li; dirty-shadow at Q=8; OQ2 answered here for partitioned walks" + }, + { + "pr": 2779, + "credit": "Wentao Li; partitioned independent walks at Q=7" + }, + { + "pr": 2677, + "credit": "Wentao Li; path-lowered 7-9Q invoices; distinct-slot R>=74 at Q=8" + }, + { + "pr": 2761, + "credit": "Wentao Li; multi-connector / priced-shadow at Q=7" + }, + { + "pr": 2715, + "credit": "Wentao Li; cheaper-readout obstruction lineage" + }, + { + "pr": 2686, + "credit": "Wentao Li; even-subset R floor at Q=7" + }, + { + "pr": 2643, + "credit": "Wentao Li; seven-query XOR floor X>=6" + }, + { + "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/independent-walks-8q-obstruction/VERIFY.json b/research/independent-walks-8q-obstruction/VERIFY.json new file mode 100644 index 0000000000..fcbacede91 --- /dev/null +++ b/research/independent-walks-8q-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": "Partitioned (2,6)/(3,5)/(4,4) dual census; rank-4 outside identity; length-1 invalid; champions; tariff floor 488; 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 partitioned dual census, champions, 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/independent-walks-8q-obstruction/independent.py b/research/independent-walks-8q-obstruction/independent.py new file mode 100644 index 0000000000..3cffe2bccf --- /dev/null +++ b/research/independent-walks-8q-obstruction/independent.py @@ -0,0 +1,217 @@ +#!/usr/bin/env python3 +"""Independent partitioned dual-walk census at Q=8. + +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 +import os +from collections import Counter +from itertools import combinations +from multiprocessing import Pool +from pathlib import Path + +HERE = Path(__file__).resolve().parent +CERT_PATH = HERE / "CERTIFICATE.json" +INF = 99 + +_WORKER_TABLES = None + + +def fail(message): + raise SystemExit(f"FAIL_INDEPENDENT: {message}") + + +def even_table(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 + + +def dual_full(e0, e1): + 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: + best = min(best, c0 + c1) + if best >= INF: + return None + total += best + return total + + +def dual_short(e_long, sigma): + total = 0 + for m in range(1, 32): + best = INF + if e_long[m] < INF: + best = e_long[m] + if e_long[m ^ sigma] < INF: + best = min(best, 2 + e_long[m ^ sigma]) + if best >= INF: + return None + total += best + return total + + +def path_X(slots): + closed = slots + (0,) + total = 0 + for a, b in zip(closed, closed[1:]): + delta = a ^ b + if delta == 0: + return None + total += 2 * (delta.bit_count() - 1) + return total + + +def tariff(q, r, x): + return 38 * q + 2 * r + 2 * x + + +def _init_tables(tables): + global _WORKER_TABLES + _WORKER_TABLES = tables + + +def _work_short_chunk(chunk): + hist = Counter() + covering = 0 + for e in chunk: + for sigma in range(1, 32): + r = dual_short(e, sigma) + if r is None: + continue + covering += 1 + hist[r] += 1 + return covering, hist + + +def _work_pair_index(i): + e0 = _WORKER_TABLES[0][i] + hist = Counter() + covering = 0 + for e1 in _WORKER_TABLES[1]: + r = dual_full(e0, e1) + if r is None: + continue + covering += 1 + hist[r] += 1 + return covering, hist + + +def _merge(results): + hist = Counter() + covering = 0 + for c, h in results: + covering += c + hist.update(h) + return covering, hist + + +def census_26(): + tables = [even_table((0,) + nz) for nz in combinations(range(1, 32), 5)] + n = max(1, os.cpu_count() or 2) + chunk = max(1, (len(tables) + n * 4 - 1) // (n * 4)) + chunks = [tables[i : i + chunk] for i in range(0, len(tables), chunk)] + with Pool(n) as pool: + return _merge(pool.map(_work_short_chunk, chunks)) + + +def census_35(): + t3 = [even_table((0,) + nz) for nz in combinations(range(1, 32), 2)] + t5 = [even_table((0,) + nz) for nz in combinations(range(1, 32), 4)] + n = max(1, os.cpu_count() or 2) + with Pool(n, initializer=_init_tables, initargs=((t3, t5),)) as pool: + return _merge(pool.map(_work_pair_index, range(len(t3)))) + + +def census_44(): + t4 = [even_table((0,) + nz) for nz in combinations(range(1, 32), 3)] + n = max(1, os.cpu_count() or 2) + with Pool(n, initializer=_init_tables, initargs=((t4, t4),)) as pool: + return _merge(pool.map(_work_pair_index, range(len(t4)))) + + +def main(): + cert = json.loads(CERT_PATH.read_text(encoding="utf-8")) + claim = cert["claim"] + + c26, h26 = census_26() + c35, h35 = census_35() + c44, h44 = census_44() + if c26 != claim["partition_26_covering"]: + fail(f"26 covering {c26} != {claim['partition_26_covering']}") + if c35 != claim["partition_35_covering"]: + fail(f"35 covering {c35} != {claim['partition_35_covering']}") + if c44 != claim["partition_44_covering"]: + fail(f"44 covering {c44} != {claim['partition_44_covering']}") + if min(h26) != 92 or set(h26) != {92, 96, 104}: + fail(f"26 hist {dict(h26)}") + if min(h35) != 98 or set(h35) != {98, 104}: + fail(f"35 hist {dict(h35)}") + if min(h44) != 100 or set(h44) != {100, 104, 112}: + fail(f"44 hist {dict(h44)}") + if h26[92] != 1416576 or h26[96] != 1249920 or h26[104] != 1249920: + fail("26 histogram counts") + if h35[98] != 3124800 or h35[104] != 7291200: + fail("35 histogram counts") + if h44[100] != 3610880 or h44[104] != 9999360 or h44[112] != 555520: + fail("44 histogram counts") + + w26_a, w26_b = (0, 16), (0, 1, 2, 4, 8, 15) + w35_a, w35_b = (0, 1, 2), (0, 4, 8, 13, 16) + w44_a, w44_b = (0, 1, 2, 4), (0, 7, 8, 16) + r26 = dual_short(even_table(w26_b), 16) + r35 = dual_full(even_table(w35_a), even_table(w35_b)) + r44 = dual_full(even_table(w44_a), even_table(w44_b)) + if r26 != 92 or r35 != 98 or r44 != 100: + fail(f"champion R {r26} {r35} {r44}") + x26 = path_X(w26_a) + path_X(w26_b) + x35 = path_X(w35_a) + path_X(w35_b) + x44 = path_X(w44_a) + path_X(w44_b) + if x26 != 16 or x35 != 12 or x44 != 16: + fail(f"champion X {x26} {x35} {x44}") + if path_X((0,)) is not None: + fail("length-1 should be invalid") + + floor = tariff(8, 92, 0) + if floor != 488 or floor <= 436: + fail(f"tariff floor {floor}") + if tariff(8, 92, x26) < floor: + fail("champion 26 tariff below floor") + if tariff(8, 98, x35) < floor or tariff(8, 100, x44) < floor: + fail("champion tariffs below floor") + + print( + "PASS_INDEPENDENT_PARTITIONED_WALKS_8Q", + f"covering_26={c26}", + f"covering_35={c35}", + f"covering_44={c44}", + "partition_min_R=92", + f"tariff_floor={floor}", + "endpoint=436", + "answers_priced_alphabet_q8_oq", + "no_new_kappa", + ) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/research/independent-walks-8q-obstruction/model.py b/research/independent-walks-8q-obstruction/model.py new file mode 100644 index 0000000000..9d7059d69f --- /dev/null +++ b/research/independent-walks-8q-obstruction/model.py @@ -0,0 +1,411 @@ +"""Partitioned independent-walk dual readout at eight queries. + +Freestanding priced alphabet under PR1898 (b,a,x)=(38,2,2): two restored walks +with independent dirt and distinct slot lists, total Q = n0 + n1 = 8, dual +even-parity readout. Answers dirty-shadow / onerepeat OQ2 by naming one new +alphabet at Q=8 outside leave-alones and pending transfer-coupled-onerepeat. + +Self-contained relative to PR1898 / #2677 / #2779 / #2840. Prepared by Wentao Li +with substantial AI assistance. Apache-2.0. +""" +from __future__ import annotations + +from collections import Counter +from itertools import combinations +from multiprocessing import Pool +import os + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +INF = 99 + +EXPECTED = { + "partition_26_covering": 3916416, + "partition_26_min_R": 92, + "partition_26_histogram": {"92": 1416576, "96": 1249920, "104": 1249920}, + "partition_35_covering": 10416000, + "partition_35_min_R": 98, + "partition_35_histogram": {"98": 3124800, "104": 7291200}, + "partition_44_covering": 14165760, + "partition_44_min_R": 100, + "partition_44_histogram": {"100": 3610880, "104": 9999360, "112": 555520}, + "partition_min_R": 92, + "champion_26_walks": ((0, 16), (0, 1, 2, 4, 8, 15)), + "champion_35_walks": ((0, 1, 2), (0, 4, 8, 13, 16)), + "champion_44_walks": ((0, 1, 2, 4), (0, 7, 8, 16)), + "champion_26_path_X": 16, + "champion_35_path_X": 12, + "champion_44_path_X": 16, + "tariff_floor_at_X0": 488, + "endpoint_tariff_Q6": 436, + "single_walk_even_min_R_Q8": 74, + "length1_invalid": True, +} + + +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 even_table(slots): + """Even-subset per-mask minima on a slot list (INF if unreachable).""" + need(type(slots) is tuple and slots and slots[0] == 0, "slots must start at 0") + 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 + + +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 dual_R_short_long(e_long, sigma): + """Optimized dual when the short walk is (0, sigma): e_short[0]=0, e_short[sigma]=2.""" + total = 0 + for m in range(1, 32): + best = INF + if e_long[m] < INF: + best = e_long[m] + flipped = e_long[m ^ sigma] + if flipped < INF: + best = min(best, 2 + flipped) + if best >= INF: + return None + total += best + return total + + +def gf2_span(vals): + basis = [] + for v in vals: + x = v + for b in basis: + x = min(x, x ^ b) + if x: + basis.append(x) + basis.sort(reverse=True) + span = {0} + for b in basis: + span |= {s ^ b for s in span} + return frozenset(span), len(basis) + + +def path_X(slots): + """Path XOR cost on the restored closed walk slots + (0,).""" + closed = slots + (0,) + total = 0 + for a, b in zip(closed, closed[1:]): + delta = a ^ b + if delta == 0: + return None + total += 2 * (delta.bit_count() - 1) + return total + + +def valid_restored_walk(slots): + """A restored walk needs length ≥ 2 (closed return must be a nonzero edge).""" + if type(slots) is not tuple or not slots or slots[0] != 0: + return False + if len(slots) < 2: + return False + return path_X(slots) is not None + + +def sum_even_nonzero(even, span): + return sum(even[v] for v in span if v != 0) + + +def structural_26_rank4_outside(sigma, long_slots): + """When long span has rank 4 and sigma is outside, R = 2·Σe + 32.""" + e_long = even_table(long_slots) + span, rank = gf2_span(long_slots) + r = dual_R_short_long(e_long, sigma) + if r is None or rank != 4 or sigma in span: + return { + "applies": False, + "rank": rank, + "sigma_in_span": sigma in span, + "R": r, + "sum_even": None, + } + even_sum = sum_even_nonzero(e_long, span) + need(r == 2 * even_sum + 32, f"rank-4 outside identity failed: {r} vs {2 * even_sum + 32}") + return { + "applies": True, + "rank": 4, + "sigma_in_span": False, + "R": r, + "sum_even": even_sum, + } + + +# --- multiprocessing workers (module-level for pickling) --- + +_WORKER_TABLES = None + + +def _init_worker_tables(tables): + global _WORKER_TABLES + _WORKER_TABLES = tables + + +def _work_short_chunk(chunk): + hist = Counter() + covering = 0 + witnesses = {} + for e_long in chunk: + for sigma in range(1, 32): + r = dual_R_short_long(e_long, sigma) + if r is None: + continue + covering += 1 + hist[r] += 1 + witnesses.setdefault(r, sigma) + return covering, hist, witnesses + + +def _work_pair_index(i): + e0 = _WORKER_TABLES[0][i] + hist = Counter() + covering = 0 + witnesses = {} + for j, e1 in enumerate(_WORKER_TABLES[1]): + r = dual_independent_R(e0, e1) + if r is None: + continue + covering += 1 + hist[r] += 1 + witnesses.setdefault(r, (i, j)) + return covering, hist, witnesses + + +def _merge_results(results): + hist = Counter() + covering = 0 + witnesses = {} + for c, h, w in results: + covering += c + hist.update(h) + for r, wit in w.items(): + witnesses.setdefault(r, wit) + return covering, hist, witnesses + + +def _pool_count(): + return max(1, os.cpu_count() or 2) + + +def enumerate_partition_26(): + """All distinct-label (2,6) pairs; covering spectrum {92,96,104}.""" + tables = [even_table((0,) + nz) for nz in combinations(range(1, 32), 5)] + n = _pool_count() + chunk = max(1, (len(tables) + n * 4 - 1) // (n * 4)) + chunks = [tables[i : i + chunk] for i in range(0, len(tables), chunk)] + with Pool(n) as pool: + covering, hist, _ = _merge_results(pool.map(_work_short_chunk, chunks)) + need(covering == EXPECTED["partition_26_covering"], "26 covering count") + need(min(hist) == EXPECTED["partition_26_min_R"], "26 min R") + need( + {str(r): hist[r] for r in sorted(hist)} == EXPECTED["partition_26_histogram"], + "26 histogram", + ) + # Rebuild first witnesses with concrete walks for the certificate. + witnesses = {} + long_nz = list(combinations(range(1, 32), 5)) + for nz, e_long in zip(long_nz, tables): + slots = (0,) + nz + for sigma in range(1, 32): + r = dual_R_short_long(e_long, sigma) + if r is None: + continue + witnesses.setdefault(r, ((0, sigma), slots)) + if len(witnesses) == len(hist): + break + if len(witnesses) == len(hist): + break + # Structural check on the R=92 champion (rank-4 outside). + w0, w1 = EXPECTED["champion_26_walks"] + struct = structural_26_rank4_outside(w0[1], w1) + need(struct["applies"] and struct["R"] == 92, "champion 26 structural") + return { + "kind": "partition_2_plus_6", + "Q": 8, + "covering_pairs": covering, + "attainable_R": sorted(hist), + "histogram": {str(r): hist[r] for r in sorted(hist)}, + "min_R": min(hist), + "first_witnesses": { + str(r): [list(a), list(b)] for r, (a, b) in sorted(witnesses.items()) + }, + "champion_structural_rank4_outside": struct, + } + + +def enumerate_partition_35(): + """All distinct-label (3,5) pairs; covering spectrum {98,104}.""" + tables3 = [even_table((0,) + nz) for nz in combinations(range(1, 32), 2)] + tables5 = [even_table((0,) + nz) for nz in combinations(range(1, 32), 4)] + n = _pool_count() + with Pool(n, initializer=_init_worker_tables, initargs=((tables3, tables5),)) as pool: + covering, hist, wit_idx = _merge_results( + pool.map(_work_pair_index, range(len(tables3))) + ) + need(covering == EXPECTED["partition_35_covering"], "35 covering count") + need(min(hist) == EXPECTED["partition_35_min_R"], "35 min R") + need( + {str(r): hist[r] for r in sorted(hist)} == EXPECTED["partition_35_histogram"], + "35 histogram", + ) + nz3 = list(combinations(range(1, 32), 2)) + nz5 = list(combinations(range(1, 32), 4)) + witnesses = {} + for r, (i, j) in wit_idx.items(): + witnesses[r] = ((0,) + nz3[i], (0,) + nz5[j]) + return { + "kind": "partition_3_plus_5", + "Q": 8, + "covering_pairs": covering, + "attainable_R": sorted(hist), + "histogram": {str(r): hist[r] for r in sorted(hist)}, + "min_R": min(hist), + "first_witnesses": { + str(r): [list(a), list(b)] for r, (a, b) in sorted(witnesses.items()) + }, + } + + +def enumerate_partition_44(): + """All ordered distinct-label (4,4) pairs; covering spectrum {100,104,112}.""" + tables4 = [even_table((0,) + nz) for nz in combinations(range(1, 32), 3)] + n = _pool_count() + with Pool(n, initializer=_init_worker_tables, initargs=((tables4, tables4),)) as pool: + covering, hist, wit_idx = _merge_results( + pool.map(_work_pair_index, range(len(tables4))) + ) + need(covering == EXPECTED["partition_44_covering"], "44 covering count") + need(min(hist) == EXPECTED["partition_44_min_R"], "44 min R") + need( + {str(r): hist[r] for r in sorted(hist)} == EXPECTED["partition_44_histogram"], + "44 histogram", + ) + nz4 = list(combinations(range(1, 32), 3)) + witnesses = {} + for r, (i, j) in wit_idx.items(): + witnesses[r] = ((0,) + nz4[i], (0,) + nz4[j]) + return { + "kind": "partition_4_plus_4", + "Q": 8, + "covering_pairs": covering, + "attainable_R": sorted(hist), + "histogram": {str(r): hist[r] for r in sorted(hist)}, + "min_R": min(hist), + "first_witnesses": { + str(r): [list(a), list(b)] for r, (a, b) in sorted(witnesses.items()) + }, + } + + +def length1_invalid_examples(): + """Length-1 'walks' are not restored: closed return is a zero edge.""" + examples = [] + for slots in ((0,),): + examples.append( + { + "slots": list(slots), + "valid_restored_walk": valid_restored_walk(slots), + "path_X": path_X(slots), + "note": "closed_(0,0)_zero_edge", + } + ) + need(all(not ex["valid_restored_walk"] for ex in examples), "length-1 must be invalid") + need(all(ex["path_X"] is None for ex in examples), "zero return edge") + return examples + + +def champion_analysis(): + w26_a, w26_b = EXPECTED["champion_26_walks"] + w35_a, w35_b = EXPECTED["champion_35_walks"] + w44_a, w44_b = EXPECTED["champion_44_walks"] + for w in (w26_a, w26_b, w35_a, w35_b, w44_a, w44_b): + need(valid_restored_walk(w), f"invalid champion walk {w}") + r26 = dual_R_short_long(even_table(w26_b), w26_a[1]) + r35 = dual_independent_R(even_table(w35_a), even_table(w35_b)) + r44 = dual_independent_R(even_table(w44_a), even_table(w44_b)) + x26 = path_X(w26_a) + path_X(w26_b) + x35 = path_X(w35_a) + path_X(w35_b) + x44 = path_X(w44_a) + path_X(w44_b) + need(r26 == 92, "champ 26 R") + need(r35 == 98, "champ 35 R") + need(r44 == 100, "champ 44 R") + need(x26 == EXPECTED["champion_26_path_X"], "champ 26 X") + need(x35 == EXPECTED["champion_35_path_X"], "champ 35 X") + need(x44 == EXPECTED["champion_44_path_X"], "champ 44 X") + struct = structural_26_rank4_outside(w26_a[1], w26_b) + need(struct["applies"] and struct["R"] == 92, "champ structural") + tariff26 = tariff_qrx(8, r26, x26) + tariff35 = tariff_qrx(8, r35, x35) + tariff44 = tariff_qrx(8, r44, x44) + tariff_floor = tariff_qrx(8, 92, 0) + need(tariff_floor == EXPECTED["tariff_floor_at_X0"], "floor") + need(tariff_floor > EXPECTED["endpoint_tariff_Q6"], "no undercut at X0") + need(tariff26 >= tariff_floor, "champ 26 tariff") + need(tariff35 >= tariff_floor, "champ 35 tariff") + need(tariff44 >= tariff_floor, "champ 44 tariff") + return { + "champion_26": { + "walks": [list(w26_a), list(w26_b)], + "R": r26, + "path_X": x26, + "tariff": tariff26, + "structural_rank4_outside": struct, + }, + "champion_35": { + "walks": [list(w35_a), list(w35_b)], + "R": r35, + "path_X": x35, + "tariff": tariff35, + }, + "champion_44": { + "walks": [list(w44_a), list(w44_b)], + "R": r44, + "path_X": x44, + "tariff": tariff44, + }, + "tariff_floor_at_X0": tariff_floor, + "endpoint_Q6": EXPECTED["endpoint_tariff_Q6"], + "single_walk_even_min_R_Q8": EXPECTED["single_walk_even_min_R_Q8"], + "partition_min_R": EXPECTED["partition_min_R"], + } diff --git a/research/independent-walks-8q-obstruction/test_package.py b/research/independent-walks-8q-obstruction/test_package.py new file mode 100644 index 0000000000..02c6ba5a3c --- /dev/null +++ b/research/independent-walks-8q-obstruction/test_package.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +"""Package fault controls for independent-walks 8q 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 = "independent-walks-8q-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_INDEPENDENT_WALKS_8Q_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_INDEPENDENT_WALKS_8Q_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"]["partition_covering_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_PARTITIONED_WALKS_8Q" 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_INDEPENDENT_WALKS_8Q_PACKAGE_TESTS groups=6") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/research/independent-walks-8q-obstruction/verify.py b/research/independent-walks-8q-obstruction/verify.py new file mode 100644 index 0000000000..d6043df302 --- /dev/null +++ b/research/independent-walks-8q-obstruction/verify.py @@ -0,0 +1,234 @@ +#!/usr/bin/env python3 +"""Partitioned independent-walks obstruction at Q=8; 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_analysis, + dual_R_short_long, + dual_independent_R, + enumerate_partition_26, + enumerate_partition_35, + enumerate_partition_44, + even_table, + length1_invalid_examples, + structural_26_rank4_outside, + tariff_qrx, + valid_restored_walk, +) + +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(): + need(not valid_restored_walk((0,)), "length-1 invalid") + length1 = length1_invalid_examples() + + part26 = enumerate_partition_26() + need(part26["covering_pairs"] == EXPECTED["partition_26_covering"], "26 covering") + need(part26["min_R"] == EXPECTED["partition_26_min_R"], "26 min R") + need(part26["histogram"] == EXPECTED["partition_26_histogram"], "26 hist") + + part35 = enumerate_partition_35() + need(part35["covering_pairs"] == EXPECTED["partition_35_covering"], "35 covering") + need(part35["min_R"] == EXPECTED["partition_35_min_R"], "35 min R") + need(part35["histogram"] == EXPECTED["partition_35_histogram"], "35 hist") + + part44 = enumerate_partition_44() + need(part44["covering_pairs"] == EXPECTED["partition_44_covering"], "44 covering") + need(part44["min_R"] == EXPECTED["partition_44_min_R"], "44 min R") + need(part44["histogram"] == EXPECTED["partition_44_histogram"], "44 hist") + + partition_min = min(part26["min_R"], part35["min_R"], part44["min_R"]) + need(partition_min == EXPECTED["partition_min_R"] == 92, "global partition min") + + champ = champion_analysis() + need(champ["tariff_floor_at_X0"] == EXPECTED["tariff_floor_at_X0"], "tariff floor") + need(champ["tariff_floor_at_X0"] > EXPECTED["endpoint_tariff_Q6"], "no undercut") + need(champ["champion_26"]["R"] == 92, "champ26 R") + need(champ["champion_35"]["R"] == 98, "champ35 R") + need(champ["champion_44"]["R"] == 100, "champ44 R") + + w26_a, w26_b = tuple(champ["champion_26"]["walks"][0]), tuple( + champ["champion_26"]["walks"][1] + ) + w35_a, w35_b = tuple(champ["champion_35"]["walks"][0]), tuple( + champ["champion_35"]["walks"][1] + ) + w44_a, w44_b = tuple(champ["champion_44"]["walks"][0]), tuple( + champ["champion_44"]["walks"][1] + ) + need(dual_R_short_long(even_table(w26_b), w26_a[1]) == 92, "recompute 26") + need( + dual_independent_R(even_table(w35_a), even_table(w35_b)) == 98, + "recompute 35", + ) + need( + dual_independent_R(even_table(w44_a), even_table(w44_b)) == 100, + "recompute 44", + ) + need(structural_26_rank4_outside(w26_a[1], w26_b)["R"] == 92, "recompute structural") + need(EXPECTED["single_walk_even_min_R_Q8"] == 74, "baseline even floor constant") + + cert = { + "schema_version": 1, + "status": "PASS_INDEPENDENT_WALKS_8Q_OBSTRUCTION", + "scope": ( + "Five-source common-B mutable-source Q/R/X alphabet (PR1898) at " + "(b,a,x)=(38,2,2). Freestanding partitioned independent dual walks " + "at total Q=8 (valid restored lengths (2,6), (3,5), (4,4)): covering " + "dual even-parity readout has global min R=92 at (2,6); tariff floor " + "at X=0 is 488>436. Answers dirty-shadow/#2840 OQ2 / onerepeat OQ2 " + "by naming one new priced alphabet at eight queries." + ), + "claim": { + "Q": 8, + "partition_covering_min_R": 92, + "partition_26_covering": part26["covering_pairs"], + "partition_35_covering": part35["covering_pairs"], + "partition_44_covering": part44["covering_pairs"], + "partition_26_min_R": 92, + "partition_35_min_R": 98, + "partition_44_min_R": 100, + "tariff_floor_at_X0": EXPECTED["tariff_floor_at_X0"], + "endpoint_Q6_tariff": EXPECTED["endpoint_tariff_Q6"], + "undercuts_436_after_complete_bill": False, + "length1_walks_invalid": True, + "answers_priced_alphabet_q8_oq": True, + "oq_answer": ( + "Every covering partitioned dual-walk schedule with total " + "query count Q=n0+n1=8 (valid restored walks of lengths (2,6), " + "(3,5), or (4,4), distinct nonzero labels within each walk, " + "independent dirt, dual even-parity readout) has R≥92, attained " + "only on (2,6) (spectrum {92,96,104}; covering 3916416). " + "Partitions (3,5) and (4,4) have min R 98 and 100. At X=0 the " + "abstract tariff is already 488>436 under (b,a,x)=(38,2,2); " + "positive path X only increases the bill. Length-1 components " + "are not restored. Transfer-coupled / onerepeat / dirty-shadow " + "leave-alones are not reopened." + ), + "no_new_kappa": True, + }, + "partition_2_plus_6": part26, + "partition_3_plus_5": part35, + "partition_4_plus_4": part44, + "champion": champ, + "length1_invalid_examples": length1, + "unit_tariff": {"b": 38, "a": 2, "x": 2}, + "tariff_check": { + "formula": "38*Q + 2*R + 2*X", + "at_R92_X0": tariff_qrx(8, 92, 0), + "champion_26": tariff_qrx(8, 92, champ["champion_26"]["path_X"]), + "champion_35": tariff_qrx(8, 98, champ["champion_35"]["path_X"]), + "champion_44": tariff_qrx(8, 100, champ["champion_44"]["path_X"]), + "endpoint_Q6": EXPECTED["endpoint_tariff_Q6"], + }, + } + return cert + + +def compare_certificate(live, pinned): + need(live["status"] == pinned["status"], "status") + need(live["claim"] == pinned["claim"], "claim drift") + for key in ( + "partition_2_plus_6", + "partition_3_plus_5", + "partition_4_plus_4", + ): + need( + live[key]["covering_pairs"] == pinned[key]["covering_pairs"], + f"{key} covering drift", + ) + need(live[key]["histogram"] == pinned[key]["histogram"], f"{key} hist drift") + need(live[key]["min_R"] == pinned[key]["min_R"], f"{key} min drift") + need(live["tariff_check"] == pinned["tariff_check"], "tariff drift") + need( + live["champion"]["tariff_floor_at_X0"] + == pinned["champion"]["tariff_floor_at_X0"], + "floor", + ) + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + "--write-certificate", + action="store_true", + help="rewrite CERTIFICATE.json (maintenance only)", + ) + args = parser.parse_args(argv) + + check_source_pins() + live = build_certificate() + + if args.write_certificate: + CERT_PATH.write_text(json.dumps(live, indent=2) + "\n", encoding="utf-8") + print("WROTE_CERTIFICATE", CERT_PATH) + return 0 + + pinned = load_json_reject_duplicates(CERT_PATH) + compare_certificate(live, pinned) + claim = pinned["claim"] + print( + "PASS_INDEPENDENT_WALKS_8Q_OBSTRUCTION", + f"partition_min_R={claim['partition_covering_min_R']}", + f"covering_26={claim['partition_26_covering']}", + f"covering_35={claim['partition_35_covering']}", + f"covering_44={claim['partition_44_covering']}", + f"tariff_floor={claim['tariff_floor_at_X0']}", + f"endpoint={claim['endpoint_Q6_tariff']}", + "no_undercut_partitioned_independent_walks_q8", + "answers_priced_alphabet_q8_oq", + "no_new_kappa", + ) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main())