diff --git a/research/independent-walks-tworepeat-8q/CERTIFICATE.json b/research/independent-walks-tworepeat-8q/CERTIFICATE.json new file mode 100644 index 0000000000..9a1d96361c --- /dev/null +++ b/research/independent-walks-tworepeat-8q/CERTIFICATE.json @@ -0,0 +1,108 @@ +{ + "schema_version": 1, + "status": "PASS_INDEPENDENT_WALKS_TWOREPEAT_8Q_OBSTRUCTION", + "scope": "Five-source common-B mutable-source Q/R/X alphabet (PR1898) at (b,a,x)=(38,2,2). Freestanding two-repeat (excess-2) layers inside partitioned independent dual walks at total Q=8 on shapes (2,6), (3,5), and (4,4): every dual has covering count 0; no dirt-legal covering schedule exists, so none undercuts tariff 436. Answers preferred next17 / onerepeat-35-44 OQ1\u2013OQ2 without editing leave-alones through #2851 or pending onerepeat tips.", + "claim": { + "Q": 8, + "partitions": [ + [ + 2, + 6 + ], + [ + 3, + 5 + ], + [ + 4, + 4 + ] + ], + "alphabet": "two_repeat_partitioned_independent_dual", + "two_repeat_26_covering": 0, + "two_repeat_26_valid_walks": 26970, + "two_repeat_26_shape_221": 13485, + "two_repeat_26_shape_311": 13485, + "two_repeat_35_covering": 0, + "two_repeat_35_valid_multisets": 465, + "two_repeat_44_covering": 0, + "two_repeat_44_valid_walks": 0, + "covering_min_R": null, + "tariff_floor_at_X0": null, + "endpoint_Q6_tariff": 436, + "undercuts_436_after_complete_bill": false, + "beats_distinct_floors": false, + "answers_third_priced_alphabet_q8": true, + "answers_onerepeat_35_44_oq2_tworepeat": true, + "oq_answer": "The named third priced readout alphabet under PR1898 (b,a,x)=(38,2,2) beyond same-walk / dirty-shadow / partitioned dual / one-repeat is the two-repeat (excess-2) companion of partitioned independent duals at Q=8. Exact covering census: (2,6) covering 0 on 26970 valid longs (shapes {2,2,1}:13485 and {3,1,1}:13485; span \u22648 so coset union \u226416); (3,5) covering 0 on 465\u00d7465 distinct-L3 \u00d7 {2,2}-L5 pairs (sumset \u226416); (4,4) covering 0 because shape {d:3} never restores. No covering R exists, so the alphabet cannot undercut tariff 436 after a complete dirty bill. Leave-alones through #2851 and pending onerepeat tips are not reopened.", + "no_new_kappa": true + }, + "two_repeat_2_plus_6": { + "kind": "two_repeat_partition_2_plus_6", + "Q": 8, + "valid_walks": 26970, + "shape_221": 13485, + "shape_311": 13485, + "covering_pairs": 0, + "attainable_R": [], + "histogram": {}, + "min_R": null, + "structural_max_span": 8, + "structural_max_coset_union": 16, + "first_witnesses": {} + }, + "two_repeat_3_plus_5": { + "kind": "two_repeat_partition_3_plus_5", + "Q": 8, + "short_tables": 465, + "long_multisets": 465, + "covering_pairs": 0, + "attainable_R": [], + "histogram": {}, + "min_R": null, + "structural_max_label_count_long": 2, + "structural_max_sumset": 16, + "first_witnesses": {} + }, + "two_repeat_4_plus_4": { + "kind": "two_repeat_partition_4_plus_4", + "Q": 8, + "valid_two_repeat_l4_walks": 0, + "covering_pairs": 0, + "attainable_R": [], + "histogram": {}, + "min_R": null, + "note": "shape_{d:3}_never_restores", + "first_witnesses": {} + }, + "champion": { + "covering_any_partition": false, + "tariff_floor_at_X0": null, + "endpoint_Q6": 436, + "undercuts_436_after_complete_bill": false, + "distinct_26_min_R": 92, + "distinct_35_min_R": 98, + "distinct_44_min_R": 100, + "one_repeat_26_min_R": 112, + "one_repeat_35_min_R": 112, + "one_repeat_44_min_R": 112, + "two_repeat_covering_min_R": null, + "comparison_tariffs": { + "distinct_26_at_R92_X0": 488, + "one_repeat_at_R112_X0": 528, + "endpoint_Q6": 436 + } + }, + "unit_tariff": { + "b": 38, + "a": 2, + "x": 2 + }, + "tariff_check": { + "formula": "38*Q + 2*R + 2*X", + "two_repeat_covering_floor": null, + "distinct_26_at_R92_X0": 488, + "one_repeat_at_R112_X0": 528, + "endpoint_Q6": 436 + } +} diff --git a/research/independent-walks-tworepeat-8q/MASTER-HANDOFF.md b/research/independent-walks-tworepeat-8q/MASTER-HANDOFF.md new file mode 100644 index 0000000000..6e8e00ebca --- /dev/null +++ b/research/independent-walks-tworepeat-8q/MASTER-HANDOFF.md @@ -0,0 +1,55 @@ +# Master handoff — independent-walks-tworepeat-8q + +## Deliverable + +| Field | Value | +|---|---| +| Branch | `cursor/independent-walks-tworepeat-8q-60b9` | +| Tip SHA | branch HEAD (`git rev-parse cursor/independent-walks-tworepeat-8q-60b9`) | +| Package | `research/independent-walks-tworepeat-8q/` | +| Claim | Freestanding `#840`-style priced alphabet: **two-repeat** (excess-2) partitioned independent dual at Q=8 under PR1898 `(b,a,x)=(38,2,2)` | +| Result | Exact covering census **0** on `(2,6)` / `(3,5)` / `(4,4)`; cannot undercut tariff **436** | +| Kappa | none | + +## Answers + +- Preferred next17 / onerepeat-35-44 OQ1: named third alphabet beyond same-walk / + dirty-shadow / partitioned dual / one-repeat. +- onerepeat-35-44 OQ2: two-repeat does not undercut distinct floors (in fact + never covers). + +## Exact census + +| Shape | Valid | Covering | Structural bound | +|---|---:|---:|---| +| `(2,6)` | 26970 (`{2,2,1}` 13485 + `{3,1,1}` 13485) | 0 | span ≤8 ⇒ coset ∪ ≤16 | +| `(3,5)` | 465 `{2,2}` multisets | 0 | sumset ≤16 | +| `(4,4)` | 0 (`{d:3}` never restores) | 0 | — | + +## Leave-alone respected + +Through #2851; pending `cursor/independent-walks-onerepeat-8q-60b9@b07bc1e1` and +`cursor/independent-walks-onerepeat-35-44-60b9@8bd3d298`; #2846/#2840/#2836/#2817/ +#2779/#2764/#2761; deferred soft-overlaps untouched. + +## Verify gate + +```sh +python3.12 -I -B research/independent-walks-tworepeat-8q/verify.py +python3.12 -I -O -B research/independent-walks-tworepeat-8q/verify.py +python3.12 -I -B research/independent-walks-tworepeat-8q/independent.py +python3.12 -I -B research/independent-walks-tworepeat-8q/test_package.py +python3.12 -B scripts/research_package.py --package research/independent-walks-tworepeat-8q +``` + +## Attribution + +Author: Wentao Li \ +Disclosure: Prepared by Wentao Li with substantial AI assistance. +`TASK.json` `ai_assistance` without product/model names. +Never `Co-authored-by: Victor Li`. + +## Next open + +1. Fourth priced alphabet under PR1898 at Q=8 beyond two-repeat? +2. Shared-dirt dual on distinct partitioned walks (soft-overlap check vs shared-XOR)? diff --git a/research/independent-walks-tworepeat-8q/NOTICE.md b/research/independent-walks-tworepeat-8q/NOTICE.md new file mode 100644 index 0000000000..e2fd678767 --- /dev/null +++ b/research/independent-walks-tworepeat-8q/NOTICE.md @@ -0,0 +1,33 @@ +# 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. +- Open #2851 `research/independent-walks-8q-obstruction` — distinct partitioned + dual at Q=8; leave-alone; not edited. +- Open #2846 `research/transfer-coupled-onerepeat-7q` — transfer-coupled + one-repeat at Q=7; leave-alone; not edited. +- Open #2840 / #2836 / #2817 / #2764 / #2761 / #2715 / #2686 / #2643 — + leave-alone through #2851; not edited. +- Pending `cursor/independent-walks-onerepeat-8q-60b9@b07bc1e1` + `research/independent-walks-onerepeat-8q` — one-repeat (2,6) at Q=8; + leave-alone; not edited or competed. +- Pending `cursor/independent-walks-onerepeat-35-44-60b9@8bd3d298` + `research/independent-walks-onerepeat-35-44` — one-repeat (3,5)/(4,4) at Q=8; + OQ1–OQ2 answered here; 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-tworepeat-8q/PROOF.md b/research/independent-walks-tworepeat-8q/PROOF.md new file mode 100644 index 0000000000..c20c7ee722 --- /dev/null +++ b/research/independent-walks-tworepeat-8q/PROOF.md @@ -0,0 +1,97 @@ +# Two-repeat partitioned walks cannot cover 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 names one freestanding `#840`-style priced +readout alphabet at eight queries beyond same-walk / dirty-shadow / partitioned +dual / one-repeat: the **two-repeat** (excess-2) companion of partitioned +independent duals. It answers preferred next17 and open questions 1–2 of pending +`cursor/independent-walks-onerepeat-35-44-60b9`. + +No new kappa is claimed. Leave-alone packages through #2851 are not edited. +Pending onerepeat tips are 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≥2` is an open slot list starting at +`0` whose closed completion has only nonzero edges. + +The **excess** of a walk is `Σ (count(ℓ)−1)` over nonzero labels. One-repeat +has excess `1`. **Two-repeat** means excess exactly `2`. + +A **two-repeat partitioned 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`, +where at least one side is two-repeat, with independent dirt and dual +even-parity cost + +```text +R = Σ_{m=1}^{31} min_α ( e0[α] + e1[α ⊕ m] ). +``` + +Up to swap the only partitions are `(2,6)`, `(3,5)`, and `(4,4)`. + +The abstract complete-call tariff at `(b,a,x)=(38,2,2)` is `38·Q + 2·R + 2·X`. + +## Fixture A: partition `(2,6)` + +Short walk `(0,σ)`. Long walk of length 6 with excess 2 on five nonzero slots +forces exactly three distinct nonzero labels. Restoring shapes: + +| Shape | Count | +|---|---:| +| `{d:2,e:2,o}` | **13485** | +| `{d:3,o₁,o₂}` | **13485** | +| Total valid | **26970** | + +**Lemma (span ≤ 8).** Three labels span a subspace of rank ≤ 3, hence size ≤ 8. + +**Lemma (coset union ≤ 16).** Pairing with short `(0,σ)` reaches at most +`span ∪ (span ⊕ σ)`, size ≤ 16 < 32. Dual covering is therefore impossible. + +**Census.** Exact covering count **0** (machine-checked on all `26970·31` +pairs). + +## Fixture B: partition `(3,5)` + +Short walk: distinct-label length-3 (`C(31,2)=465` even tables). Long walk: +excess 2 on four nonzero slots. + +| Shape | Restores? | Count | +|---|---|---:| +| `{d:2,e:2}` | yes | **465** | +| `{d:3,o}` | no | 0 | +| `{d:4}` | no | 0 | + +**Lemma (sumset ≤ 16).** Long `{d,e}` has span size ≤ 4; short length-3 has +span size ≤ 4; the XOR sumset has size ≤ 16 < 32. Dual covering is impossible. + +**Census.** Exact covering count **0** on all `465·465` pairs. + +## Fixture C: partition `(4,4)` + +Two-repeat on length-4 means shape `{d:3}` (three identical nonzero labels). +Any ordering has an adjacent zero-XOR edge on the closed walk. + +**Census.** Valid two-repeat length-4 walks: **0**. Covering count **0**. + +## Tariff consequence + +No covering two-repeat partitioned dual exists at `Q=8`. There is therefore no +dirt-legal `R` and no complete-call tariff in this alphabet that can undercut +the six-query endpoint `436`. By comparison: + +| Alphabet | Covering min R | Tariff floor (X=0) | Undercuts 436? | +|---|---:|---:|---| +| Distinct partitioned (`#2851`) | 92 | 488 | no | +| One-repeat partitioned (pending) | 112 | 528 | no | +| **Two-repeat partitioned (this)** | **— (covering 0)** | **—** | **no** | + +## Scope limits + +- Fixes the **two-repeat** (excess-2) partitioned independent-walk interface at + total `Q=8`. Same-walk, dirty-shadow, distinct partitioned, and one-repeat + leave-alones / pending tips are outside and not edited. +- Transfer-coupled dual/shapes, shared-XOR, and host screens remain deferred + soft-overlaps and are not opened. +- No new kappa and no multiplication theorem are claimed. diff --git a/research/independent-walks-tworepeat-8q/README.md b/research/independent-walks-tworepeat-8q/README.md new file mode 100644 index 0000000000..eb04e65324 --- /dev/null +++ b/research/independent-walks-tworepeat-8q/README.md @@ -0,0 +1,82 @@ +# Two-repeat partitioned-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` beyond +same-walk / dirty-shadow / partitioned dual / one-repeat: **two-repeat** +(excess-2) layers inside partitioned independent duals on shapes `(2,6)`, +`(3,5)`, and `(4,4)`. Answers preferred next17 and open questions 1–2 of pending +`cursor/independent-walks-onerepeat-35-44-60b9`. + +| Dual schedule | Valid objects | Exact covering | Undercuts 436? | +|---|---:|---:|---| +| Distinct partitioned (#2851) | — | min R=92 | no | +| One-repeat (pending tips) | — | min R=112 | no | +| Two-repeat `(2,6)` | **26970** walks | **0** | **no** | +| Two-repeat `(3,5)` | **465** multisets | **0** | **no** | +| Two-repeat `(4,4)` | **0** walks | **0** | **no** | + +Span/sumset lemmas: `(2,6)` long span ≤8 so coset union ≤16; `(3,5)` sumset ≤16; +`(4,4)` shape `{d:3}` never restores. No covering `R` exists, so the alphabet +cannot undercut tariff `436`. + +## Reproduction + +```sh +python3.12 -I -B research/independent-walks-tworepeat-8q/verify.py +python3.12 -I -O -B research/independent-walks-tworepeat-8q/verify.py +python3.12 -I -B research/independent-walks-tworepeat-8q/independent.py +python3.12 -I -B research/independent-walks-tworepeat-8q/test_package.py +python3.12 -B scripts/research_package.py --package research/independent-walks-tworepeat-8q +``` + +Expected: + +```text +PASS_INDEPENDENT_WALKS_TWOREPEAT_8Q_OBSTRUCTION covering_26=0 covering_35=0 covering_44=0 ... answers_third_priced_alphabet_q8 no_undercut_436 no_new_kappa +PASS_INDEPENDENT_WALKS_TWOREPEAT_8Q covering_26=0 covering_35=0 ... no_undercut_436 no_new_kappa +PASS_INDEPENDENT_WALKS_TWOREPEAT_8Q_PACKAGE_TESTS groups=6 +PASS_REGISTERED_RESEARCH_PACKAGE research/independent-walks-tworepeat-8q outcome=completed +``` + +Default verify is read-only. Admission uses `need()`; `-O` also passes. + +## Overlap + +Base commit `0b1cccf86e2f5132ed286a26ef0a681a495740ea`. Direct predecessors: +PR1898, #2851 (distinct partitioned dual at Q=8), pending onerepeat tips, +#2846/#2840/#2779/#2677. Leave-alone through #2851 including #2846, #2840, +#2836, #2817, #2779, #2764, #2761 is respected; those packages are not edited. +Pending `cursor/independent-walks-onerepeat-8q-60b9@b07bc1e1` and +`cursor/independent-walks-onerepeat-35-44-60b9@8bd3d298` are not edited or +competed. Deferred soft-overlaps (transfer-coupled-dual/shapes; shared-xor; +host screens) are not opened. + +## Open next questions + +1. Does any fourth priced readout alphabet under PR1898 `(b,a,x)=(38,2,2)` + (beyond same-walk / dirty-shadow / partitioned dual / one-repeat / two-repeat) + undercut `436` at `Q=8`? + Why it matters: remaining unequal-price handoff after two-repeat is closed. + First step: name one new alphabet outside leave-alones and census dirt-legal R. + Blocked by: leave-alones through #2851; pending onerepeat; deferred soft-overlaps. +2. Does a shared-dirt (single coefficient) dual on distinct partitioned walks + undercut the independent-dirt floors? + Why it matters: changes the dual cost from independent `min_a` to a coupled + readout. + First step: fix shared-dirt dual cost and census `(2,6)` distinct labels. + Blocked by: soft-overlap risk with shared-XOR leave-alone. + +## Credit + +Credit **Arham Tahir / PR1898**, **ywz65 / PR2455**, **PR1370**, fork **789q** / +**#2677**, **#2779**, open **#2851** (distinct partitioned; leave-alone; not +edited), pending onerepeat tips (OQ answered here; not edited), open **#2846** / +**#2840** / **#2836** / **#2817** / **#2764** / **#2761** (leave-alone), +**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-tworepeat-8q/SOURCES.json b/research/independent-walks-tworepeat-8q/SOURCES.json new file mode 100644 index 0000000000..719b378cbd --- /dev/null +++ b/research/independent-walks-tworepeat-8q/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-tworepeat-8q/TASK.json b/research/independent-walks-tworepeat-8q/TASK.json new file mode 100644 index 0000000000..0e15c514ea --- /dev/null +++ b/research/independent-walks-tworepeat-8q/TASK.json @@ -0,0 +1,100 @@ +{ + "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): name the two-repeat (excess-2) partitioned independent dual alphabet at total Q=8 on shapes (2,6)/(3,5)/(4,4), show exact covering census 0 on every shape and therefore no undercut of tariff 436, answering preferred next17 / onerepeat-35-44 OQ1–OQ2 without editing leave-alones through #2851 or pending onerepeat tips.", + "scope_change_reason": "The drawn connector-alphabet card is redirected to the explicit remaining freestanding Q=8 third-alphabet handoff left by pending independent-walks-onerepeat-35-44 OQ1 on the #1898 lineage, using a new package name outside hard leave-alones through #2851, pending onerepeat-(2,6)/(3,5)/(4,4), and deferred transfer-coupled-dual/shapes / shared-XOR / host-screen soft-overlaps.", + "bottleneck_link": "A priced two-repeat companion of the partitioned dual at Q=8 decides whether relaxing beyond one-repeat reopens an undercut of the six-query endpoint after the distinct / one-repeat / dirty-shadow collapses.", + "budget_minutes": 60, + "stop_rule": "Stop after (2,6)/(3,5)/(4,4) two-repeat covering censuses, span/sumset lemmas, tariff consequence, package tests; no leave-alone reopen, no pending onerepeat edit/compete, no shared-XOR reopening, no host screens.", + "outcome": "completed", + "evidence": "CERTIFICATE.json covering_26=0 (valid 26970; {2,2,1}:13485 {3,1,1}:13485); covering_35=0 (465 multisets); covering_44=0 (0 valid L4); span≤8 / sumset≤16; no undercut 436; independent checker; corruption controls.", + "author": "Wentao Li", + "ai_assistance": "Substantial AI assistance for derivation, implementation, checking and writing.", + "open_questions": [ + { + "question": "Does any fourth priced readout alphabet under PR1898 (b,a,x)=(38,2,2) (beyond same-walk / dirty-shadow / partitioned dual / one-repeat / two-repeat) undercut 436 at Q=8?", + "why_it_matters": "Remaining unequal-price handoff after two-repeat is closed.", + "first_step": "Name one new alphabet outside leave-alones and census dirt-legal R.", + "blocked_by": "Leave-alone packages through #2851; pending onerepeat tips; deferred soft-overlaps." + }, + { + "question": "Does a shared-dirt (single coefficient) dual on distinct partitioned walks undercut the independent-dirt floors?", + "why_it_matters": "Changes the dual cost from min_a(e0[a]+e1[a⊕m]) to a coupled readout.", + "first_step": "Fix shared-dirt dual cost and census (2,6) distinct labels.", + "blocked_by": "Soft-overlap risk with shared-XOR leave-alone; confirm novelty first." + } + ], + "predecessors": [ + { + "pr": 1898, + "credit": "Arham Tahir; minimum-query endpoint and abstract tariff fixture" + }, + { + "pr": 2851, + "credit": "Wentao Li; distinct partitioned dual at Q=8; leave-alone; not edited" + }, + { + "ref": "cursor/independent-walks-onerepeat-8q-60b9@b07bc1e1", + "credit": "Wentao Li; one-repeat (2,6) at Q=8; leave-alone; not edited" + }, + { + "ref": "cursor/independent-walks-onerepeat-35-44-60b9@8bd3d298", + "credit": "Wentao Li; one-repeat (3,5)/(4,4) at Q=8; OQ1–OQ2 answered here; not edited" + }, + { + "pr": 2846, + "credit": "Wentao Li; transfer-coupled onerepeat at Q=7; leave-alone" + }, + { + "pr": 2840, + "credit": "Wentao Li; dirty-shadow at Q=8; leave-alone" + }, + { + "pr": 2779, + "credit": "Wentao Li; partitioned independent walks at Q=7" + }, + { + "pr": 2677, + "credit": "Wentao Li; Q=7–9 invoice / distinct-slot Q=8 baseline" + } + ] +} diff --git a/research/independent-walks-tworepeat-8q/VERIFY.json b/research/independent-walks-tworepeat-8q/VERIFY.json new file mode 100644 index 0000000000..80eb7ab037 --- /dev/null +++ b/research/independent-walks-tworepeat-8q/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": "Two-repeat (2,6)/(3,5)/(4,4) dual censuses; span lemmas; covering 0; 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 two-repeat dual census, covering 0, tariff consequence" + }, + { + "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-tworepeat-8q/independent.py b/research/independent-walks-tworepeat-8q/independent.py new file mode 100644 index 0000000000..1e57376bbb --- /dev/null +++ b/research/independent-walks-tworepeat-8q/independent.py @@ -0,0 +1,204 @@ +#!/usr/bin/env python3 +"""Independent two-repeat partitioned dual 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 +from collections import Counter +from itertools import combinations, permutations +from pathlib import Path + +HERE = Path(__file__).resolve().parent +CERT_PATH = HERE / "CERTIFICATE.json" +INF = 99 + +EXPECTED_26_COVERING = 0 +EXPECTED_35_COVERING = 0 +EXPECTED_44_VALID = 0 +EXPECTED_26_WALKS = 26970 +EXPECTED_26_221 = 13485 +EXPECTED_26_311 = 13485 +EXPECTED_35_MULTISETS = 465 +ENDPOINT = 436 + + +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_R(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 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 find_restoring(multiset_nz): + for perm in set(permutations(multiset_nz)): + walk = (0,) + perm + if path_X(walk) is not None: + return walk + return None + + +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 slots_from_ms(ms): + nz = [] + for lab, cnt in sorted(Counter(ms).items()): + nz.extend([lab] * cnt) + return (0,) + tuple(nz) + + +def census_26(): + walks = [] + for d, e in combinations(range(1, 32), 2): + for o in range(1, 32): + if o in (d, e): + continue + w = find_restoring((d, d, e, e, o)) + if w is None: + fail("{2,2,1} should restore") + walks.append(w) + n221 = len(walks) + for d in range(1, 32): + others = [x for x in range(1, 32) if x != d] + for o1, o2 in combinations(others, 2): + w = find_restoring((d, d, d, o1, o2)) + if w is None: + fail("{3,1,1} should restore") + walks.append(w) + if n221 != EXPECTED_26_221: + fail(f"221 count {n221}") + if len(walks) - n221 != EXPECTED_26_311: + fail("311 count") + if len(walks) != EXPECTED_26_WALKS: + fail(f"walks {len(walks)}") + covering = 0 + for walk in walks: + span, rank = gf2_span(walk) + if rank > 3 or len(span) > 8: + fail("span bound") + e1 = even_table(slots_from_ms(walk[1:])) + for sigma in range(1, 32): + if dual_R(even_table((0, sigma)), e1) is not None: + covering += 1 + if covering != EXPECTED_26_COVERING: + fail(f"26 covering {covering}") + return covering, len(walks), n221 + + +def census_35(): + tables3 = [even_table((0,) + nz) for nz in combinations(range(1, 32), 2)] + tables5 = [] + for d, e in combinations(range(1, 32), 2): + if find_restoring((d, d, e, e)) is None: + fail("{2,2} should restore") + tables5.append(even_table(slots_from_ms((d, d, e, e)))) + if len(tables5) != EXPECTED_35_MULTISETS: + fail("35 multisets") + covering = 0 + for e0 in tables3: + for e1 in tables5: + if dual_R(e0, e1) is not None: + covering += 1 + if covering != EXPECTED_35_COVERING: + fail(f"35 covering {covering}") + return covering, len(tables5) + + +def census_44(): + valid = 0 + for d in range(1, 32): + if find_restoring((d, d, d)) is not None: + valid += 1 + if valid != EXPECTED_44_VALID: + fail(f"44 valid {valid}") + return valid + + +def main(): + pinned = json.loads(CERT_PATH.read_text(encoding="utf-8")) + c26, n26, n221 = census_26() + c35, n35 = census_35() + v44 = census_44() + claim = pinned["claim"] + if claim["two_repeat_26_covering"] != c26: + fail("26 claim drift") + if claim["two_repeat_35_covering"] != c35: + fail("35 claim drift") + if claim["two_repeat_44_valid_walks"] != v44: + fail("44 claim drift") + if claim["undercuts_436_after_complete_bill"] is not False: + fail("undercut claim") + if claim["endpoint_Q6_tariff"] != ENDPOINT: + fail("endpoint") + print( + "PASS_INDEPENDENT_WALKS_TWOREPEAT_8Q", + f"covering_26={c26}", + f"covering_35={c35}", + f"valid_26={n26}", + f"shape_221={n221}", + f"multisets_35={n35}", + f"valid_44={v44}", + "tariff_floor=None", + "no_undercut_436", + "no_new_kappa", + ) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/research/independent-walks-tworepeat-8q/model.py b/research/independent-walks-tworepeat-8q/model.py new file mode 100644 index 0000000000..cd43b5df2b --- /dev/null +++ b/research/independent-walks-tworepeat-8q/model.py @@ -0,0 +1,347 @@ +"""Two-repeat partitioned independent-walk duals at Q=8. + +Names one freestanding priced readout alphabet under PR1898 +(b,a,x)=(38,2,2) beyond same-walk / dirty-shadow / partitioned dual / +one-repeat: the two-repeat (excess-2) companion of partitioned independent +duals on shapes (2,6), (3,5), and (4,4). + +Answers preferred next17 / independent-walks-onerepeat-35-44 OQ1–OQ2 without +editing leave-alones through #2851 or pending onerepeat tips. + +Self-contained relative to PR1898 / #2779 / iw8q / iwor lineage. +Prepared by Wentao Li with substantial AI assistance. Apache-2.0. +""" +from __future__ import annotations + +from collections import Counter +from itertools import combinations, permutations + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +INF = 99 + +EXPECTED = { + "Q": 8, + "distinct_26_min_R": 92, + "distinct_35_min_R": 98, + "distinct_44_min_R": 100, + "one_repeat_26_min_R": 112, + "one_repeat_35_min_R": 112, + "one_repeat_44_min_R": 112, + "partition_26_covering": 0, + "partition_26_valid_walks": 26970, + "partition_26_shape_221": 13485, + "partition_26_shape_311": 13485, + "partition_35_covering": 0, + "partition_35_valid_multisets": 465, + "partition_35_short_tables": 465, + "partition_44_covering": 0, + "partition_44_valid_walks": 0, + "length4_two_repeat_valid": 0, + "tariff_floor_at_X0": None, + "endpoint_tariff_Q6": 436, + "undercuts_436": False, +} + + +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): + 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 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 valid_restored_walk(slots): + 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 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 excess_nonzero(slots): + """Σ (count−1) over nonzero labels; one-repeat has excess 1, two-repeat 2.""" + need(type(slots) is tuple and slots and slots[0] == 0, "slots form") + return sum(c - 1 for c in Counter(slots[1:]).values()) + + +def is_two_repeat_nonzero(slots): + return excess_nonzero(slots) == 2 + + +def find_restoring(multiset_nz): + for perm in set(permutations(multiset_nz)): + walk = (0,) + perm + if path_X(walk) is not None: + return walk + return None + + +def slots_from_multiset(ms): + nz = [] + for lab, cnt in sorted(Counter(ms).items()): + nz.extend([lab] * cnt) + return (0,) + tuple(nz) + + +def two_repeat_l6_walks(): + """Restoring two-repeat length-6 walks: shapes {2,2,1} and {3,1,1}.""" + walks_221 = [] + walks_311 = [] + for d, e in combinations(range(1, 32), 2): + others = [x for x in range(1, 32) if x != d and x != e] + for o in others: + walk = find_restoring((d, d, e, e, o)) + need(walk is not None, "{2,2,1} should restore") + need(is_two_repeat_nonzero(walk), "excess 2") + walks_221.append(walk) + for d in range(1, 32): + others = [x for x in range(1, 32) if x != d] + for o1, o2 in combinations(others, 2): + walk = find_restoring((d, d, d, o1, o2)) + need(walk is not None, "{3,1,1} should restore") + need(is_two_repeat_nonzero(walk), "excess 2") + walks_311.append(walk) + need(len(walks_221) == EXPECTED["partition_26_shape_221"], "221 count") + need(len(walks_311) == EXPECTED["partition_26_shape_311"], "311 count") + need( + len(walks_221) + len(walks_311) == EXPECTED["partition_26_valid_walks"], + "L6 total", + ) + return walks_221, walks_311 + + +def two_repeat_l5_multisets(): + """Unique two-repeat length-5 multisets; only shape {2,2} restores.""" + tables = [] + reps = [] + for d, e in combinations(range(1, 32), 2): + walk = find_restoring((d, d, e, e)) + need(walk is not None, "{2,2} should restore") + slots = slots_from_multiset((d, d, e, e)) + need(is_two_repeat_nonzero(slots), "excess 2") + tables.append(even_table(slots)) + reps.append(walk) + # Shape {3,1} never restores. + for d in range(1, 32): + for o in range(1, 32): + if o == d: + continue + need(find_restoring((d, d, d, o)) is None, "{3,1} never restores") + for d in range(1, 32): + need(find_restoring((d, d, d, d)) is None, "{4} never restores") + need(len(tables) == EXPECTED["partition_35_valid_multisets"], "L5 count") + return tables, reps + + +def length4_two_repeat_count(): + """Length-4 two-repeat is shape {d:3}; closed walk always has a zero edge.""" + valid = 0 + for d in range(1, 32): + if find_restoring((d, d, d)) is not None: + valid += 1 + need(valid == EXPECTED["length4_two_repeat_valid"], "L4 two-repeat") + return valid + + +def structural_rank_bound_l6(walk): + """Two-repeat L6 has ≤3 distinct nonzero labels ⇒ rank ≤3 ⇒ |span|≤8.""" + labels = set(walk[1:]) + need(len(labels) <= 3, "two-repeat L6 ≤3 labels") + span, rank = gf2_span(walk) + need(rank <= 3, "rank ≤3") + need(len(span) <= 8, "|span|≤8") + return span, rank + + +def census_two_repeat_26(): + """Short (0,σ) × two-repeat length-6; covering count 0 by span lemma + census.""" + walks_221, walks_311 = two_repeat_l6_walks() + all_walks = walks_221 + walks_311 + # Structural: every long has |span|≤8, so with short coset at most 16 masks. + for walk in all_walks: + structural_rank_bound_l6(walk) + covering = 0 + hist = Counter() + for walk in all_walks: + e1 = even_table(slots_from_multiset(walk[1:])) + span, _rank = gf2_span(walk) + need(len(span) <= 8, "span bound") + for sigma in range(1, 32): + e0 = even_table((0, sigma)) + # Coset bound: reachable masks ⊆ span ∪ (span ⊕ σ). + union = span | {v ^ sigma for v in span} + need(len(union) <= 16, "coset union ≤16") + r = dual_independent_R(e0, e1) + if r is not None: + covering += 1 + hist[r] += 1 + need(covering == EXPECTED["partition_26_covering"], "26 covering") + need(len(hist) == 0, "26 empty spectrum") + return { + "kind": "two_repeat_partition_2_plus_6", + "Q": 8, + "valid_walks": len(all_walks), + "shape_221": len(walks_221), + "shape_311": len(walks_311), + "covering_pairs": covering, + "attainable_R": [], + "histogram": {}, + "min_R": None, + "structural_max_span": 8, + "structural_max_coset_union": 16, + "first_witnesses": {}, + } + + +def census_two_repeat_35(): + """Distinct length-3 × two-repeat length-5 {2,2}; covering count 0.""" + tables3 = [even_table((0,) + nz) for nz in combinations(range(1, 32), 2)] + need(len(tables3) == EXPECTED["partition_35_short_tables"], "L3 count") + tables5, reps5 = two_repeat_l5_multisets() + covering = 0 + hist = Counter() + nz3 = list(combinations(range(1, 32), 2)) + for i, e0 in enumerate(tables3): + span0, rank0 = gf2_span((0,) + nz3[i]) + need(rank0 <= 2 and len(span0) <= 4, "L3 span") + for j, e1 in enumerate(tables5): + span1, rank1 = gf2_span(reps5[j]) + need(rank1 <= 2 and len(span1) <= 4, "L5 {2,2} span") + # Sumset of two affine reaches of size ≤4 has size ≤16 < 32. + sumset = {a ^ b for a in span0 for b in span1} + need(len(sumset) <= 16, "sumset ≤16") + r = dual_independent_R(e0, e1) + if r is not None: + covering += 1 + hist[r] += 1 + need(covering == EXPECTED["partition_35_covering"], "35 covering") + need(len(hist) == 0, "35 empty spectrum") + return { + "kind": "two_repeat_partition_3_plus_5", + "Q": 8, + "short_tables": len(tables3), + "long_multisets": len(tables5), + "covering_pairs": covering, + "attainable_R": [], + "histogram": {}, + "min_R": None, + "structural_max_label_count_long": 2, + "structural_max_sumset": 16, + "first_witnesses": {}, + } + + +def census_two_repeat_44(): + """Two-repeat length-4 never restores; covering count 0 vacuously.""" + valid = length4_two_repeat_count() + need(valid == EXPECTED["partition_44_valid_walks"], "44 valid") + return { + "kind": "two_repeat_partition_4_plus_4", + "Q": 8, + "valid_two_repeat_l4_walks": valid, + "covering_pairs": 0, + "attainable_R": [], + "histogram": {}, + "min_R": None, + "note": "shape_{d:3}_never_restores", + "first_witnesses": {}, + } + + +def champion_analysis(): + """No covering champion; record tariff consequence and comparison floors.""" + need(EXPECTED["partition_26_covering"] == 0, "26 cover") + need(EXPECTED["partition_35_covering"] == 0, "35 cover") + need(EXPECTED["partition_44_covering"] == 0, "44 cover") + need(EXPECTED["undercuts_436"] is False, "no undercut") + # Abstract floor is undefined (no covering R); compare endpoint only. + endpoint = EXPECTED["endpoint_tariff_Q6"] + need(endpoint == 436, "endpoint") + need(tariff_qrx(8, 92, 0) == 488, "distinct 26 floor sanity") + need(tariff_qrx(8, 112, 0) == 528, "one-repeat floor sanity") + return { + "covering_any_partition": False, + "tariff_floor_at_X0": None, + "endpoint_Q6": endpoint, + "undercuts_436_after_complete_bill": False, + "distinct_26_min_R": EXPECTED["distinct_26_min_R"], + "distinct_35_min_R": EXPECTED["distinct_35_min_R"], + "distinct_44_min_R": EXPECTED["distinct_44_min_R"], + "one_repeat_26_min_R": EXPECTED["one_repeat_26_min_R"], + "one_repeat_35_min_R": EXPECTED["one_repeat_35_min_R"], + "one_repeat_44_min_R": EXPECTED["one_repeat_44_min_R"], + "two_repeat_covering_min_R": None, + "comparison_tariffs": { + "distinct_26_at_R92_X0": tariff_qrx(8, 92, 0), + "one_repeat_at_R112_X0": tariff_qrx(8, 112, 0), + "endpoint_Q6": endpoint, + }, + } diff --git a/research/independent-walks-tworepeat-8q/test_package.py b/research/independent-walks-tworepeat-8q/test_package.py new file mode 100644 index 0000000000..02232efd2a --- /dev/null +++ b/research/independent-walks-tworepeat-8q/test_package.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +"""Package fault controls for independent-walks tworepeat 8q. 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-tworepeat-8q" + + +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_TWOREPEAT_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_TWOREPEAT_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"]["two_repeat_26_covering"] = 1 + 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_WALKS_TWOREPEAT_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_TWOREPEAT_8Q_PACKAGE_TESTS groups=6") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/research/independent-walks-tworepeat-8q/verify.py b/research/independent-walks-tworepeat-8q/verify.py new file mode 100644 index 0000000000..b5348e1440 --- /dev/null +++ b/research/independent-walks-tworepeat-8q/verify.py @@ -0,0 +1,230 @@ +#!/usr/bin/env python3 +"""Two-repeat partitioned independent-walks 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, + census_two_repeat_26, + census_two_repeat_35, + census_two_repeat_44, + champion_analysis, + 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") + need(not valid_restored_walk((0, 1, 1, 1)), "length-4 two-repeat invalid") + + census26 = census_two_repeat_26() + need(census26["covering_pairs"] == EXPECTED["partition_26_covering"], "26 covering") + need(census26["valid_walks"] == EXPECTED["partition_26_valid_walks"], "26 walks") + need(census26["shape_221"] == EXPECTED["partition_26_shape_221"], "221") + need(census26["shape_311"] == EXPECTED["partition_26_shape_311"], "311") + + census35 = census_two_repeat_35() + need(census35["covering_pairs"] == EXPECTED["partition_35_covering"], "35 covering") + need( + census35["long_multisets"] == EXPECTED["partition_35_valid_multisets"], + "35 multisets", + ) + + census44 = census_two_repeat_44() + need(census44["covering_pairs"] == EXPECTED["partition_44_covering"], "44 covering") + need( + census44["valid_two_repeat_l4_walks"] == EXPECTED["partition_44_valid_walks"], + "44 walks", + ) + + champ = champion_analysis() + need(champ["covering_any_partition"] is False, "no covering") + need(champ["undercuts_436_after_complete_bill"] is False, "no undercut") + need(champ["tariff_floor_at_X0"] is None, "no R floor") + + cert = { + "schema_version": 1, + "status": "PASS_INDEPENDENT_WALKS_TWOREPEAT_8Q_OBSTRUCTION", + "scope": ( + "Five-source common-B mutable-source Q/R/X alphabet (PR1898) at " + "(b,a,x)=(38,2,2). Freestanding two-repeat (excess-2) layers inside " + "partitioned independent dual walks at total Q=8 on shapes (2,6), " + "(3,5), and (4,4): every dual has covering count 0; no dirt-legal " + "covering schedule exists, so none undercuts tariff 436. Answers " + "preferred next17 / onerepeat-35-44 OQ1–OQ2 without editing leave-alones " + "through #2851 or pending onerepeat tips." + ), + "claim": { + "Q": 8, + "partitions": [[2, 6], [3, 5], [4, 4]], + "alphabet": "two_repeat_partitioned_independent_dual", + "two_repeat_26_covering": 0, + "two_repeat_26_valid_walks": EXPECTED["partition_26_valid_walks"], + "two_repeat_26_shape_221": EXPECTED["partition_26_shape_221"], + "two_repeat_26_shape_311": EXPECTED["partition_26_shape_311"], + "two_repeat_35_covering": 0, + "two_repeat_35_valid_multisets": EXPECTED["partition_35_valid_multisets"], + "two_repeat_44_covering": 0, + "two_repeat_44_valid_walks": 0, + "covering_min_R": None, + "tariff_floor_at_X0": None, + "endpoint_Q6_tariff": EXPECTED["endpoint_tariff_Q6"], + "undercuts_436_after_complete_bill": False, + "beats_distinct_floors": False, + "answers_third_priced_alphabet_q8": True, + "answers_onerepeat_35_44_oq2_tworepeat": True, + "oq_answer": ( + "The named third priced readout alphabet under PR1898 " + "(b,a,x)=(38,2,2) beyond same-walk / dirty-shadow / partitioned " + "dual / one-repeat is the two-repeat (excess-2) companion of " + "partitioned independent duals at Q=8. Exact covering census: " + "(2,6) covering 0 on 26970 valid longs (shapes {2,2,1}:13485 and " + "{3,1,1}:13485; span ≤8 so coset union ≤16); (3,5) covering 0 on " + "465×465 distinct-L3 × {2,2}-L5 pairs (sumset ≤16); (4,4) " + "covering 0 because shape {d:3} never restores. No covering R " + "exists, so the alphabet cannot undercut tariff 436 after a " + "complete dirty bill. Leave-alones through #2851 and pending " + "onerepeat tips are not reopened." + ), + "no_new_kappa": True, + }, + "two_repeat_2_plus_6": census26, + "two_repeat_3_plus_5": census35, + "two_repeat_4_plus_4": census44, + "champion": champ, + "unit_tariff": {"b": 38, "a": 2, "x": 2}, + "tariff_check": { + "formula": "38*Q + 2*R + 2*X", + "two_repeat_covering_floor": None, + "distinct_26_at_R92_X0": tariff_qrx(8, 92, 0), + "one_repeat_at_R112_X0": tariff_qrx(8, 112, 0), + "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") + need( + live["two_repeat_2_plus_6"]["covering_pairs"] + == pinned["two_repeat_2_plus_6"]["covering_pairs"], + "26 covering drift", + ) + need( + live["two_repeat_2_plus_6"]["valid_walks"] + == pinned["two_repeat_2_plus_6"]["valid_walks"], + "26 walks drift", + ) + need( + live["two_repeat_3_plus_5"]["covering_pairs"] + == pinned["two_repeat_3_plus_5"]["covering_pairs"], + "35 covering drift", + ) + need( + live["two_repeat_3_plus_5"]["long_multisets"] + == pinned["two_repeat_3_plus_5"]["long_multisets"], + "35 multisets drift", + ) + need( + live["two_repeat_4_plus_4"]["covering_pairs"] + == pinned["two_repeat_4_plus_4"]["covering_pairs"], + "44 covering drift", + ) + need( + live["two_repeat_4_plus_4"]["valid_two_repeat_l4_walks"] + == pinned["two_repeat_4_plus_4"]["valid_two_repeat_l4_walks"], + "44 walks drift", + ) + need(live["tariff_check"] == pinned["tariff_check"], "tariff drift") + need( + live["champion"]["undercuts_436_after_complete_bill"] + == pinned["champion"]["undercuts_436_after_complete_bill"], + "undercut drift", + ) + + +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_TWOREPEAT_8Q_OBSTRUCTION", + f"covering_26={claim['two_repeat_26_covering']}", + f"covering_35={claim['two_repeat_35_covering']}", + f"covering_44={claim['two_repeat_44_covering']}", + f"valid_26={claim['two_repeat_26_valid_walks']}", + "answers_third_priced_alphabet_q8", + "no_undercut_436", + "no_new_kappa", + ) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main())