diff --git a/research/independent-walks-9q/CERTIFICATE.json b/research/independent-walks-9q/CERTIFICATE.json new file mode 100644 index 0000000000..b2db39b799 --- /dev/null +++ b/research/independent-walks-9q/CERTIFICATE.json @@ -0,0 +1,473 @@ +{ + "schema_version": 1, + "status": "PASS_INDEPENDENT_WALKS_9Q_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=9 (valid restored lengths (2,7), (3,6), (4,5)): covering dual even-parity readout has global min R=80 at (2,7); tariff floor at X=0 is 502>436 (also above same-walk Q=9 floor 466 of #2677). Answers preferred next20 / threerepeat OQ2 without editing leave-alones through #2867 or pending three-repeat tip.", + "claim": { + "Q": 9, + "partition_covering_min_R": 80, + "partition_27_covering": 20512576, + "partition_36_covering": 69370560, + "partition_45_covering": 122561600, + "partition_27_min_R": 80, + "partition_36_min_R": 88, + "partition_45_min_R": 92, + "tariff_floor_at_X0": 502, + "endpoint_Q6_tariff": 436, + "same_walk_q9_floor": 466, + "undercuts_436_after_complete_bill": false, + "length1_walks_invalid": true, + "answers_priced_alphabet_q9_companion": true, + "answers_threerepeat_oq2": true, + "oq_answer": "Every covering partitioned dual-walk schedule with total query count Q=n0+n1=9 (valid restored walks of lengths (2,7), (3,6), or (4,5), distinct nonzero labels within each walk, independent dirt, dual even-parity readout) has R\u226580, attained only on (2,7) (spectrum {80,82,86,88,92,100}; covering 20512576). Partitions (3,6) and (4,5) have min R 88 and 92. At X=0 the abstract tariff is already 502>436 under (b,a,x)=(38,2,2), and also above the same-walk Q=9 floor 466 of #2677; positive path X only increases the bill. Length-1 components are not restored. Leave-alones through #2867 and pending three-repeat tip are not reopened.", + "no_new_kappa": true + }, + "partition_2_plus_7": { + "kind": "partition_2_plus_7", + "Q": 9, + "covering_pairs": 20512576, + "attainable_R": [ + 80, + 82, + 86, + 88, + 92, + 100 + ], + "histogram": { + "80": 972160, + "82": 2041536, + "86": 6319040, + "88": 8749440, + "92": 972160, + "100": 1458240 + }, + "min_R": 80, + "first_witnesses": { + "80": [ + [ + 0, + 19 + ], + [ + 0, + 1, + 2, + 4, + 8, + 15, + 16 + ] + ], + "82": [ + [ + 0, + 1 + ], + [ + 0, + 1, + 2, + 4, + 8, + 15, + 16 + ] + ], + "86": [ + [ + 0, + 13 + ], + [ + 0, + 1, + 2, + 3, + 4, + 8, + 16 + ] + ], + "88": [ + [ + 0, + 1 + ], + [ + 0, + 1, + 2, + 3, + 4, + 8, + 16 + ] + ], + "92": [ + [ + 0, + 16 + ], + [ + 0, + 1, + 2, + 3, + 4, + 8, + 12 + ] + ], + "100": [ + [ + 0, + 16 + ], + [ + 0, + 1, + 2, + 3, + 4, + 5, + 8 + ] + ] + } + }, + "partition_3_plus_6": { + "kind": "partition_3_plus_6", + "Q": 9, + "covering_pairs": 69370560, + "attainable_R": [ + 88, + 90, + 92, + 94, + 96, + 100, + 104 + ], + "histogram": { + "88": 3749760, + "90": 20623680, + "92": 11249280, + "94": 5624640, + "96": 21873600, + "100": 5624640, + "104": 624960 + }, + "min_R": 88, + "first_witnesses": { + "88": [ + [ + 0, + 1, + 2 + ], + [ + 0, + 4, + 8, + 13, + 16, + 22 + ] + ], + "90": [ + [ + 0, + 1, + 2 + ], + [ + 0, + 1, + 4, + 8, + 14, + 16 + ] + ], + "92": [ + [ + 0, + 1, + 2 + ], + [ + 0, + 1, + 4, + 6, + 8, + 16 + ] + ], + "94": [ + [ + 0, + 1, + 2 + ], + [ + 0, + 4, + 8, + 12, + 16, + 21 + ] + ], + "96": [ + [ + 0, + 1, + 2 + ], + [ + 0, + 1, + 2, + 4, + 8, + 16 + ] + ], + "100": [ + [ + 0, + 1, + 2 + ], + [ + 0, + 1, + 4, + 5, + 8, + 16 + ] + ], + "104": [ + [ + 0, + 1, + 2 + ], + [ + 0, + 4, + 8, + 12, + 16, + 20 + ] + ] + } + }, + "partition_4_plus_5": { + "kind": "partition_4_plus_5", + "Q": 9, + "covering_pairs": 122561600, + "attainable_R": [ + 92, + 94, + 96, + 98, + 100, + 104 + ], + "histogram": { + "92": 4166400, + "94": 37497600, + "96": 43747200, + "98": 3472000, + "100": 31248000, + "104": 2430400 + }, + "min_R": 92, + "first_witnesses": { + "92": [ + [ + 0, + 1, + 2, + 4 + ], + [ + 0, + 7, + 8, + 16, + 25 + ] + ], + "94": [ + [ + 0, + 1, + 2, + 4 + ], + [ + 0, + 1, + 8, + 15, + 16 + ] + ], + "96": [ + [ + 0, + 1, + 2, + 4 + ], + [ + 0, + 1, + 6, + 8, + 16 + ] + ], + "98": [ + [ + 0, + 1, + 2, + 3 + ], + [ + 0, + 4, + 8, + 13, + 16 + ] + ], + "100": [ + [ + 0, + 1, + 2, + 4 + ], + [ + 0, + 1, + 2, + 8, + 16 + ] + ], + "104": [ + [ + 0, + 1, + 2, + 3 + ], + [ + 0, + 1, + 4, + 8, + 16 + ] + ] + } + }, + "champion": { + "champion_27": { + "walks": [ + [ + 0, + 19 + ], + [ + 0, + 1, + 2, + 4, + 8, + 15, + 16 + ] + ], + "R": 80, + "path_X": 26, + "tariff": 554 + }, + "champion_36": { + "walks": [ + [ + 0, + 1, + 2 + ], + [ + 0, + 4, + 8, + 13, + 16, + 22 + ] + ], + "R": 88, + "path_X": 18, + "tariff": 554 + }, + "champion_45": { + "walks": [ + [ + 0, + 1, + 2, + 4 + ], + [ + 0, + 7, + 8, + 16, + 25 + ] + ], + "R": 92, + "path_X": 22, + "tariff": 570 + }, + "tariff_floor_at_X0": 502, + "endpoint_Q6": 436, + "same_walk_q9_floor": 466, + "partition_min_R": 80 + }, + "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_R80_X0": 502, + "champion_27": 554, + "champion_36": 554, + "champion_45": 570, + "endpoint_Q6": 436, + "same_walk_q9_floor": 466 + } +} diff --git a/research/independent-walks-9q/MASTER-HANDOFF.md b/research/independent-walks-9q/MASTER-HANDOFF.md new file mode 100644 index 0000000000..b90de53bcb --- /dev/null +++ b/research/independent-walks-9q/MASTER-HANDOFF.md @@ -0,0 +1,57 @@ +# Master handoff — independent-walks-9q + +## Deliverable + +| Field | Value | +|---|---| +| Branch | `cursor/independent-walks-9q-60b9` | +| Tip SHA | branch HEAD (`git rev-parse cursor/independent-walks-9q-60b9`) | +| Package | `research/independent-walks-9q/` | +| Claim | Freestanding `#840`-style priced alphabet: **Q=9 partitioned independent dual** under PR1898 `(b,a,x)=(38,2,2)` | +| Result | Exact covering min **R=80** on `(2,7)`; `(3,6)` min 88; `(4,5)` min 92; tariff floor **502>436** (also above same-walk Q9 floor 466) | +| Kappa | none | + +## Answers + +- Preferred next20 / threerepeat OQ2: Q=9 partitioned independent dual companion + on `(2,7)/(3,6)/(4,5)` does **not** undercut tariff 436 (floor 502), nor the + same-walk Q=9 floor 466 of #2677. + +## Exact census + +| Shape | Covering | Min R | Histogram | +|---|---:|---:|---| +| `(2,7)` | 20512576 | 80 | 80:972160 / 82:2041536 / 86:6319040 / 88:8749440 / 92:972160 / 100:1458240 | +| `(3,6)` | 69370560 | 88 | 88:3749760 / 90:20623680 / 92:11249280 / 94:5624640 / 96:21873600 / 100:5624640 / 104:624960 | +| `(4,5)` | 122561600 | 92 | 92:4166400 / 94:37497600 / 96:43747200 / 98:3472000 / 100:31248000 / 104:2430400 | + +Champions: `((0,19),(0,1,2,4,8,15,16))` R=80 X=26; +`((0,1,2),(0,4,8,13,16,22))` R=88 X=18; +`((0,1,2,4),(0,7,8,16,25))` R=92 X=22. + +## Leave-alone respected + +Through #2868 / #2867 / #2861 / #2860 / #2858 / #2851; +#2846/#2840/#2836/#2817/#2779/#2764/#2761; deferred soft-overlaps untouched. + +## Verify gate + +```sh +python3.12 -I -B research/independent-walks-9q/verify.py +python3.12 -I -O -B research/independent-walks-9q/verify.py --quick +python3.12 -I -B research/independent-walks-9q/independent.py +python3.12 -I -B research/independent-walks-9q/test_package.py +python3.12 -B scripts/research_package.py --package research/independent-walks-9q +``` + +## 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. Sixth priced alphabet under PR1898 at Q=8 beyond three-repeat / shared-dirt? +2. Mixed shared-dirt + excess at Q=8 vs shared-dirt floor R=82? diff --git a/research/independent-walks-9q/NOTICE.md b/research/independent-walks-9q/NOTICE.md new file mode 100644 index 0000000000..430453473a --- /dev/null +++ b/research/independent-walks-9q/NOTICE.md @@ -0,0 +1,31 @@ +# Notice + +New material in this directory is Apache-2.0. + +Predecessor credit (do not alter historical notices elsewhere): + +- Arham Tahir / PR1898 `research/mutable-source-minimum-queries` — five-source + alphabet, minimum-query endpoint, abstract complete-call tariff `(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 — + same-walk Q=9 floor 466; not edited. +- Open #2779 `research/independent-walks-7q-obstruction` — partitioned dual at + Q=7; leave-alone; not edited. +- Open #2851 `research/independent-walks-8q-obstruction` — distinct partitioned + dual at Q=8; leave-alone; not edited. +- Open #2867 `research/shared-dirt-walks-8q` — shared-dirt at Q=8; leave-alone; + not edited. +- Open #2861 / #2860 / #2858 — one-repeat / two-repeat at Q=8; leave-alone; + not edited. +- Open #2846 / #2840 / #2836 / #2817 / #2764 / #2761 — leave-alone; not edited. +- Pending `cursor/independent-walks-threerepeat-8q-60b9@94b14c36` + `research/independent-walks-threerepeat-8q` — three-repeat at Q=8; 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-9q/PROOF.md b/research/independent-walks-9q/PROOF.md new file mode 100644 index 0000000000..67e9fcfe97 --- /dev/null +++ b/research/independent-walks-9q/PROOF.md @@ -0,0 +1,94 @@ +# Partitioned independent duals at Q=9 cannot undercut tariff 436 + +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: the **Q=9 partitioned independent dual companion** of the +Q=8 distinct partitioned dual +([#2851](https://github.com/CrocSwap/integer-mult-bounds/pull/2851)). It answers +preferred next20 and open question 2 of pending +`cursor/independent-walks-threerepeat-8q-60b9@94b14c36`. + +No new kappa is claimed. Leave-alone packages through #2867 are not edited. +Pending three-repeat tip 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≥2` is an open slot list starting at +`0` whose closed completion has only nonzero edges. + +A **partitioned independent dual** of total query count `Q = 9` is a pair of +valid restored walks of lengths `(n_0,n_1)` with `n_0+n_1=9` and `n_0,n_1≥2`, +distinct nonzero labels within each walk, and **independent dirt**. Legal dirty +cancellation requires even live-read parity on each walk separately. With even +subset tables `e_i` on walk `i`, the dual cost is + +```text +R = Σ_{m=1}^{31} min_α (e0[α] + e1[α ⊕ m]). +``` + +Up to swap the only partitions are `(2,7)`, `(3,6)`, and `(4,5)`. Length-1 +components are not restored. The abstract complete-call tariff at +`(b,a,x)=(38,2,2)` is `38·Q + 2·R + 2·X`. + +The same-walk Q=9 path-lowered floor of +[#2677](https://github.com/CrocSwap/integer-mult-bounds/pull/2677) is +`R≥62` ⇒ tariff `≥466`. Beating the six-query endpoint `436` at nine queries +would require `R+X < 47`; every dirt-legal even covering already forces +`R≥62`, so the undercut question is settled once the partitioned dual census +shows its own floor lies at or above that regime. + +## Fixture A: partition `(2,7)` + +Short walk `(0,σ)` has `e[0]=0`, `e[σ]=2`. Dual cost collapses to + +```text +R = Σ_m min( e1[m], 2 + e1[m ⊕ σ] ). +``` + +**Census.** Distinct-label pairs: covering count `20512576`; attainable +`R ∈ {80,82,86,88,92,100}` with histogram +`972160 / 2041536 / 6319040 / 8749440 / 972160 / 1458240`. Minimum `R = 80`. + +Champion `((0,19),(0,1,2,4,8,15,16))` has independent `R = 80`, path `X = 26`, +tariff `554`. The `X = 0` figure `502` is the abstract lower bound from +`R = 80`. + +## Fixture B: partition `(3,6)` + +**Census.** Covering count `69370560`; attainable +`R ∈ {88,90,92,94,96,100,104}` with histogram +`3749760 / 20623680 / 11249280 / 5624640 / 21873600 / 5624640 / 624960`. +Minimum `R = 88`. + +Champion `((0,1,2),(0,4,8,13,16,22))` has independent `R = 88`, path `X = 18`. + +## Fixture C: partition `(4,5)` + +**Census.** Covering count `122561600`; attainable +`R ∈ {92,94,96,98,100,104}` with histogram +`4166400 / 37497600 / 43747200 / 3472000 / 31248000 / 2430400`. +Minimum `R = 92`. + +Champion `((0,1,2,4),(0,7,8,16,25))` has independent `R = 92`, path `X = 22`. + +## Global consequence + +The binding covering minimum across `(2,7)/(3,6)/(4,5)` is `R = 80` on +`(2,7)`. At `X = 0` the abstract tariff is + +```text +38·9 + 2·80 + 2·0 = 502 > 436 +``` + +and also `502 > 466` (same-walk Q=9 floor). Positive path `X` only increases +the bill. Therefore no covering partitioned independent dual at nine queries +undercuts the six-query endpoint after a complete dirty bill. + +## Machine check + +`verify.py` exhaustively recomputes all three covering histograms and matches +`CERTIFICATE.json`. `independent.py` recomputes the binding `(2,7)` census and +champion identities without importing `model.py`. Admission uses `need()` so +`-O` passes. Default verify is read-only. diff --git a/research/independent-walks-9q/README.md b/research/independent-walks-9q/README.md new file mode 100644 index 0000000000..ff1a287a4e --- /dev/null +++ b/research/independent-walks-9q/README.md @@ -0,0 +1,85 @@ +# Partitioned independent-walk obstruction at nine 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 the **Q=9 partitioned independent dual companion** +of [#2851](https://github.com/CrocSwap/integer-mult-bounds/pull/2851) on +shapes `(2,7)`, `(3,6)`, and `(4,5)`. Answers preferred next20 and open +question 2 of pending +`cursor/independent-walks-threerepeat-8q-60b9@94b14c36`. Soft-overlap-safe vs +the Q=8 leave-alone cluster (new query count; no leave-alone reopen). + +| Dual schedule | Covering pairs | Exact min R | Tariff floor (X≥0) | Undercuts 436? | vs same-walk Q9 466? | +|---|---:|---:|---:|---|---| +| Same-walk Q=9 (#2677) | — | ≥62 | ≥466 | no | — | +| Partitioned `(2,7)` (this) | **20512576** | **80** | **≥502** | **no** | **above** | +| Partitioned `(3,6)` (this) | **69370560** | **88** | **≥518** | **no** | **above** | +| Partitioned `(4,5)` (this) | **122561600** | **92** | **≥526** | **no** | **above** | + +Global covering minimum is `R=80` on `(2,7)` (spectrum +`{80,82,86,88,92,100}`). Abstract tariff `38·9 + 2·80 + 2·0 = 502 > 436` +and also above the same-walk Q=9 floor `466`. Partitioned duals at nine +queries cannot undercut the six-query endpoint. + +## Reproduction + +```sh +python3.12 -I -B research/independent-walks-9q/verify.py +python3.12 -I -O -B research/independent-walks-9q/verify.py --quick +python3.12 -I -B research/independent-walks-9q/independent.py +python3.12 -I -B research/independent-walks-9q/test_package.py +python3.12 -B scripts/research_package.py --package research/independent-walks-9q +``` + +Expected: + +```text +PASS_INDEPENDENT_WALKS_9Q_OBSTRUCTION partition_min_R=80 ... tariff_floor=502 ... answers_threerepeat_oq2 no_new_kappa +PASS_INDEPENDENT_WALKS_9Q_QUICK partition_min_R=80 tariff_floor=502 ... answers_threerepeat_oq2 no_new_kappa +PASS_INDEPENDENT_PARTITIONED_WALKS_9Q covering_27=20512576 ... tariff_floor=502 ... answers_threerepeat_oq2 no_new_kappa +PASS_INDEPENDENT_WALKS_9Q_PACKAGE_TESTS groups=6 +PASS_REGISTERED_RESEARCH_PACKAGE research/independent-walks-9q outcome=completed +``` + +Default verify is read-only. Admission uses `need()`; `-O` also passes. +Full census is the default verify; `--quick` is the `-O` / package-test path. + +## Overlap + +Base commit `0b1cccf86e2f5132ed286a26ef0a681a495740ea`. Direct predecessors: +PR1898, #2851 (distinct partitioned dual at Q=8), #2677 (same-walk Q=9 +floor 466), pending threerepeat tip (OQ2 answered here), +#2867/#2861/#2860/#2858/#2846/#2840/#2779. Leave-alone through #2867 +including #2861, #2860, #2858, #2851, #2846, #2840, #2836, #2817, #2779, +#2764, #2761 is respected; those packages are not edited. Pending +`cursor/independent-walks-threerepeat-8q-60b9@94b14c36` is not edited or +competed. Deferred soft-overlaps (transfer-coupled-dual/shapes; shared-XOR; +host screens) are not opened. + +## Open next questions + +1. Does any sixth priced readout alphabet under PR1898 `(b,a,x)=(38,2,2)` + (beyond same-walk / dirty-shadow / partitioned dual / one-repeat / + two-repeat / shared-dirt / three-repeat) undercut `436` at `Q=8`? + Why it matters: remaining unequal-price handoff on the Q=8 cluster. + First step: name one new alphabet outside leave-alones and census dirt-legal R. + Blocked by: leave-alones through #2867; pending three-repeat; deferred soft-overlaps. +2. Does a mixed shared-dirt + excess (e.g. shared-dirt with one-repeat) + partitioned schedule at `Q=8` undercut the shared-dirt floor `R=82`? + Why it matters: combines dirt-coupling and excess axes without reopen. + First step: fix mixed cost and census distinct-label `(2,6)`. + Blocked by: larger search; expected not to undercut 436 even if R improves. + +## Credit + +Credit **Arham Tahir / PR1898**, **ywz65 / PR2455**, **PR1370**, fork **789q** / +**#2677**, **#2779**, open **#2851** / **#2867** / **#2861** / **#2860** / +**#2858** (leave-alone; not edited), pending threerepeat tip (OQ2 answered +here; not edited or competed), 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-9q/SOURCES.json b/research/independent-walks-9q/SOURCES.json new file mode 100644 index 0000000000..719b378cbd --- /dev/null +++ b/research/independent-walks-9q/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-9q/TASK.json b/research/independent-walks-9q/TASK.json new file mode 100644 index 0000000000..30ff8b4560 --- /dev/null +++ b/research/independent-walks-9q/TASK.json @@ -0,0 +1,116 @@ +{ + "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=9 with lengths (2,7)/(3,6)/(4,5), show covering min R=80 on (2,7) and tariff floor 502>436 (also above same-walk Q=9 floor 466 of #2677), answering preferred next20 / threerepeat OQ2 without editing leave-alones through #2867 or pending three-repeat tip.", + "scope_change_reason": "The drawn connector-alphabet card is redirected to the explicit remaining freestanding Q=9 partitioned dual companion handoff left by pending independent-walks-threerepeat-8q OQ2 on the #1898 lineage, using a new package name outside hard leave-alones through #2867/#2861/#2860/#2858/#2851, pending three-repeat tip, and deferred soft-overlaps.", + "bottleneck_link": "A priced partitioned dual-walk readout alphabet at Q=9 decides whether extending the #2851 independent dual off the Q=8 leave-alone cluster undercuts the six-query endpoint or the same-walk Q=9 floor after shared-dirt / three-repeat / one-repeat / two-repeat collapses.", + "budget_minutes": 60, + "stop_rule": "Stop after (2,7)/(3,6)/(4,5) covering censuses, champion comparisons, tariff consequence vs 436 and same-walk 466, package tests; no leave-alone reopen, no pending three-repeat edit/compete, no shared-XOR / transfer-coupled-dual reopen, no host screens.", + "outcome": "completed", + "evidence": "CERTIFICATE.json (2,7) covering 20512576 spectrum {80,82,86,88,92,100}; (3,6) 69370560 spectrum {88..104}; (4,5) 122561600 spectrum {92..104}; global min R=80; tariff floor 502; independent checker; corruption controls.", + "author": "Wentao Li", + "ai_assistance": "Substantial AI assistance for derivation, implementation, checking and writing.", + "open_questions": [ + { + "question": "Does any sixth priced readout alphabet under PR1898 (b,a,x)=(38,2,2) (beyond same-walk / dirty-shadow / partitioned dual / one-repeat / two-repeat / shared-dirt / three-repeat) undercut 436 at Q=8?", + "why_it_matters": "Remaining unequal-price handoff on the Q=8 cluster after the Q=9 companion is closed.", + "first_step": "Name one new alphabet outside leave-alones and census dirt-legal R.", + "blocked_by": "Leave-alones through #2867/#2861/#2860/#2858/#2851; pending three-repeat; deferred soft-overlaps." + }, + { + "question": "Does a mixed shared-dirt + excess (e.g. shared-dirt with one-repeat) partitioned schedule at Q=8 undercut the shared-dirt floor R=82?", + "why_it_matters": "Combines the two non-competing axes (dirt coupling and excess) without reopening leave-alones.", + "first_step": "Fix mixed shared-dirt+one-repeat cost and census distinct-label (2,6).", + "blocked_by": "Larger search; expected not to undercut 436 even if R improves toward 74." + } + ], + "predecessors": [ + { + "pr": 1898, + "credit": "Arham Tahir; minimum-query endpoint and abstract tariff fixture" + }, + { + "pr": 2867, + "credit": "Wentao Li; shared-dirt at Q=8; leave-alone; not edited" + }, + { + "pr": 2861, + "credit": "Wentao Li; one-repeat (2,6) at Q=8; leave-alone; not edited" + }, + { + "pr": 2860, + "credit": "Wentao Li; two-repeat at Q=8; leave-alone; not edited" + }, + { + "pr": 2858, + "credit": "Wentao Li; one-repeat (3,5)/(4,4) at Q=8; leave-alone; not edited" + }, + { + "pr": 2851, + "credit": "Wentao Li; distinct partitioned dual at Q=8; leave-alone; not edited" + }, + { + "ref": "cursor/independent-walks-threerepeat-8q-60b9@94b14c36", + "credit": "Wentao Li; three-repeat at Q=8; OQ2 answered here; not edited or competed" + }, + { + "pr": 2677, + "credit": "Wentao Li; path-lowered 7-9Q invoices; same-walk Q=9 floor 466" + }, + { + "pr": 2779, + "credit": "Wentao Li; partitioned independent walks at Q=7; leave-alone" + }, + { + "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-9q/VERIFY.json b/research/independent-walks-9q/VERIFY.json new file mode 100644 index 0000000000..c33a4f8195 --- /dev/null +++ b/research/independent-walks-9q/VERIFY.json @@ -0,0 +1,53 @@ +{ + "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": 600, + "checks": "Full partitioned (2,7)/(3,6)/(4,5) dual census; champions; tariff floor 502; certificate match; source pins" + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/verify.py", + "--quick" + ], + "timeout_seconds": 90, + "checks": "Champion/tariff quick replay under PYTHONOPTIMIZE; admission via need()" + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/independent.py" + ], + "timeout_seconds": 210, + "checks": "Separate binding (2,7) census, (3,6)/(4,5) constants, champions, tariff arithmetic" + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/test_package.py" + ], + "timeout_seconds": 300, + "checks": "Corruption rejection, duplicate JSON keys, -O quick controls, independent replay" + } + ] +} diff --git a/research/independent-walks-9q/independent.py b/research/independent-walks-9q/independent.py new file mode 100644 index 0000000000..3ac6fe1e27 --- /dev/null +++ b/research/independent-walks-9q/independent.py @@ -0,0 +1,189 @@ +#!/usr/bin/env python3 +"""Independent partitioned dual-walk census at Q=9 (binding (2,7) + champions). + +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 _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 _merge(results): + hist = Counter() + covering = 0 + for c, h in results: + covering += c + hist.update(h) + return covering, hist + + +def census_27(): + tables = [even_table((0,) + nz) for nz in combinations(range(1, 32), 6)] + 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 main(): + cert = json.loads(CERT_PATH.read_text(encoding="utf-8")) + claim = cert["claim"] + + c27, h27 = census_27() + if c27 != claim["partition_27_covering"]: + fail(f"27 covering {c27} != {claim['partition_27_covering']}") + if min(h27) != 80: + fail(f"27 min {min(h27)}") + expected_hist = { + 80: 972160, + 82: 2041536, + 86: 6319040, + 88: 8749440, + 92: 972160, + 100: 1458240, + } + if dict(h27) != expected_hist: + fail(f"27 hist {dict(h27)}") + + # Pinned (3,6)/(4,5) covering constants + champion recomputes (no full redo). + if claim["partition_36_covering"] != 69370560: + fail("36 covering constant") + if claim["partition_45_covering"] != 122561600: + fail("45 covering constant") + if claim["partition_36_min_R"] != 88 or claim["partition_45_min_R"] != 92: + fail("36/45 min constants") + + w27_a, w27_b = (0, 19), (0, 1, 2, 4, 8, 15, 16) + w36_a, w36_b = (0, 1, 2), (0, 4, 8, 13, 16, 22) + w45_a, w45_b = (0, 1, 2, 4), (0, 7, 8, 16, 25) + r27 = dual_short(even_table(w27_b), 19) + r36 = dual_full(even_table(w36_a), even_table(w36_b)) + r45 = dual_full(even_table(w45_a), even_table(w45_b)) + if r27 != 80 or r36 != 88 or r45 != 92: + fail(f"champion R {r27} {r36} {r45}") + x27 = path_X(w27_a) + path_X(w27_b) + x36 = path_X(w36_a) + path_X(w36_b) + x45 = path_X(w45_a) + path_X(w45_b) + if x27 != 26 or x36 != 18 or x45 != 22: + fail(f"champion X {x27} {x36} {x45}") + if path_X((0,)) is not None: + fail("length-1 should be invalid") + + floor = tariff(9, 80, 0) + if floor != 502 or floor <= 436: + fail(f"tariff floor {floor}") + if floor <= 466: + fail(f"floor {floor} should exceed same-walk Q9 floor 466") + if tariff(9, 80, x27) < floor: + fail("champion 27 tariff below floor") + if tariff(9, 88, x36) < floor or tariff(9, 92, x45) < floor: + fail("champion tariffs below floor") + + print( + "PASS_INDEPENDENT_PARTITIONED_WALKS_9Q", + f"covering_27={c27}", + "partition_min_R=80", + "covering_36=69370560", + "covering_45=122561600", + f"tariff_floor={floor}", + "endpoint=436", + "same_walk_q9_floor=466", + "answers_threerepeat_oq2", + "no_new_kappa", + ) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/research/independent-walks-9q/model.py b/research/independent-walks-9q/model.py new file mode 100644 index 0000000000..f934f0c296 --- /dev/null +++ b/research/independent-walks-9q/model.py @@ -0,0 +1,394 @@ +"""Partitioned independent-walk dual readout at nine 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 = 9, dual +even-parity readout. Answers preferred next20 / threerepeat OQ2 by naming the +Q=9 partitioned independent dual companion outside leave-alones and pending +three-repeat. + +Self-contained relative to PR1898 / #2677 / #2851 / pending threerepeat. +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_27_covering": 20512576, + "partition_27_min_R": 80, + "partition_27_histogram": { + "80": 972160, + "82": 2041536, + "86": 6319040, + "88": 8749440, + "92": 972160, + "100": 1458240, + }, + "partition_36_covering": 69370560, + "partition_36_min_R": 88, + "partition_36_histogram": { + "88": 3749760, + "90": 20623680, + "92": 11249280, + "94": 5624640, + "96": 21873600, + "100": 5624640, + "104": 624960, + }, + "partition_45_covering": 122561600, + "partition_45_min_R": 92, + "partition_45_histogram": { + "92": 4166400, + "94": 37497600, + "96": 43747200, + "98": 3472000, + "100": 31248000, + "104": 2430400, + }, + "partition_min_R": 80, + "champion_27_walks": ((0, 19), (0, 1, 2, 4, 8, 15, 16)), + "champion_36_walks": ((0, 1, 2), (0, 4, 8, 13, 16, 22)), + "champion_45_walks": ((0, 1, 2, 4), (0, 7, 8, 16, 25)), + "champion_27_path_X": 26, + "champion_36_path_X": 18, + "champion_45_path_X": 22, + "tariff_floor_at_X0": 502, + "endpoint_tariff_Q6": 436, + "same_walk_q9_floor": 466, + "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 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 + + +_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_27(): + """All distinct-label (2,7) pairs; covering spectrum includes min R=80.""" + tables = [even_table((0,) + nz) for nz in combinations(range(1, 32), 6)] + 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_27_covering"], "27 covering count") + need(min(hist) == EXPECTED["partition_27_min_R"], "27 min R") + need( + {str(r): hist[r] for r in sorted(hist)} == EXPECTED["partition_27_histogram"], + "27 histogram", + ) + witnesses = {} + long_nz = list(combinations(range(1, 32), 6)) + 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 + return { + "kind": "partition_2_plus_7", + "Q": 9, + "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_36(): + """All distinct-label (3,6) pairs; covering spectrum includes min R=88.""" + tables3 = [even_table((0,) + nz) for nz in combinations(range(1, 32), 2)] + tables6 = [even_table((0,) + nz) for nz in combinations(range(1, 32), 5)] + n = _pool_count() + with Pool(n, initializer=_init_worker_tables, initargs=((tables3, tables6),)) as pool: + covering, hist, wit_idx = _merge_results( + pool.map(_work_pair_index, range(len(tables3))) + ) + need(covering == EXPECTED["partition_36_covering"], "36 covering count") + need(min(hist) == EXPECTED["partition_36_min_R"], "36 min R") + need( + {str(r): hist[r] for r in sorted(hist)} == EXPECTED["partition_36_histogram"], + "36 histogram", + ) + nz3 = list(combinations(range(1, 32), 2)) + nz6 = list(combinations(range(1, 32), 5)) + witnesses = {} + for r, (i, j) in wit_idx.items(): + witnesses[r] = ((0,) + nz3[i], (0,) + nz6[j]) + return { + "kind": "partition_3_plus_6", + "Q": 9, + "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_45(): + """All ordered distinct-label (4,5) pairs; covering spectrum includes min R=92.""" + tables4 = [even_table((0,) + nz) for nz in combinations(range(1, 32), 3)] + tables5 = [even_table((0,) + nz) for nz in combinations(range(1, 32), 4)] + n = _pool_count() + with Pool(n, initializer=_init_worker_tables, initargs=((tables4, tables5),)) as pool: + covering, hist, wit_idx = _merge_results( + pool.map(_work_pair_index, range(len(tables4))) + ) + need(covering == EXPECTED["partition_45_covering"], "45 covering count") + need(min(hist) == EXPECTED["partition_45_min_R"], "45 min R") + need( + {str(r): hist[r] for r in sorted(hist)} == EXPECTED["partition_45_histogram"], + "45 histogram", + ) + nz4 = list(combinations(range(1, 32), 3)) + nz5 = list(combinations(range(1, 32), 4)) + witnesses = {} + for r, (i, j) in wit_idx.items(): + witnesses[r] = ((0,) + nz4[i], (0,) + nz5[j]) + return { + "kind": "partition_4_plus_5", + "Q": 9, + "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(): + w27_a, w27_b = EXPECTED["champion_27_walks"] + w36_a, w36_b = EXPECTED["champion_36_walks"] + w45_a, w45_b = EXPECTED["champion_45_walks"] + for w in (w27_a, w27_b, w36_a, w36_b, w45_a, w45_b): + need(valid_restored_walk(w), f"invalid champion walk {w}") + r27 = dual_R_short_long(even_table(w27_b), w27_a[1]) + r36 = dual_independent_R(even_table(w36_a), even_table(w36_b)) + r45 = dual_independent_R(even_table(w45_a), even_table(w45_b)) + x27 = path_X(w27_a) + path_X(w27_b) + x36 = path_X(w36_a) + path_X(w36_b) + x45 = path_X(w45_a) + path_X(w45_b) + need(r27 == 80, "champ 27 R") + need(r36 == 88, "champ 36 R") + need(r45 == 92, "champ 45 R") + need(x27 == EXPECTED["champion_27_path_X"], "champ 27 X") + need(x36 == EXPECTED["champion_36_path_X"], "champ 36 X") + need(x45 == EXPECTED["champion_45_path_X"], "champ 45 X") + tariff27 = tariff_qrx(9, r27, x27) + tariff36 = tariff_qrx(9, r36, x36) + tariff45 = tariff_qrx(9, r45, x45) + tariff_floor = tariff_qrx(9, 80, 0) + need(tariff_floor == EXPECTED["tariff_floor_at_X0"], "floor") + need(tariff_floor > EXPECTED["endpoint_tariff_Q6"], "no undercut at X0") + need(tariff_floor > EXPECTED["same_walk_q9_floor"], "above same-walk Q9 floor") + need(tariff27 >= tariff_floor, "champ 27 tariff") + need(tariff36 >= tariff_floor, "champ 36 tariff") + need(tariff45 >= tariff_floor, "champ 45 tariff") + return { + "champion_27": { + "walks": [list(w27_a), list(w27_b)], + "R": r27, + "path_X": x27, + "tariff": tariff27, + }, + "champion_36": { + "walks": [list(w36_a), list(w36_b)], + "R": r36, + "path_X": x36, + "tariff": tariff36, + }, + "champion_45": { + "walks": [list(w45_a), list(w45_b)], + "R": r45, + "path_X": x45, + "tariff": tariff45, + }, + "tariff_floor_at_X0": tariff_floor, + "endpoint_Q6": EXPECTED["endpoint_tariff_Q6"], + "same_walk_q9_floor": EXPECTED["same_walk_q9_floor"], + "partition_min_R": EXPECTED["partition_min_R"], + } + + +def quick_checks(): + """Champion / tariff / length-1 controls without full census.""" + length1 = length1_invalid_examples() + champ = champion_analysis() + need(not valid_restored_walk((0,)), "length-1 invalid") + need(champ["partition_min_R"] == 80, "quick min R constant") + need(champ["tariff_floor_at_X0"] == 502, "quick floor") + need(champ["tariff_floor_at_X0"] > 436, "quick no undercut") + return {"length1_invalid_examples": length1, "champion": champ} diff --git a/research/independent-walks-9q/test_package.py b/research/independent-walks-9q/test_package.py new file mode 100644 index 0000000000..4066565a9a --- /dev/null +++ b/research/independent-walks-9q/test_package.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python3 +"""Package fault controls for independent-walks 9q 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-9q" + + +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) Quick verify against committed certificate. + proc = run([sys.executable, "-I", "-B", str(HERE / "verify.py"), "--quick"]) + need(proc.returncode == 0, proc.stderr + proc.stdout) + need("PASS_INDEPENDENT_WALKS_9Q_QUICK" in proc.stdout, proc.stdout) + + # 2) -O quick admission via need(). + proc = run([sys.executable, "-I", "-O", "-B", str(HERE / "verify.py"), "--quick"]) + need(proc.returncode == 0, proc.stderr + proc.stdout) + need("PASS_INDEPENDENT_WALKS_9Q_QUICK" in proc.stdout, proc.stdout) + + # 3) Certificate claim corruption fails (quick path). + 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"), "--quick"], + 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"), "--quick"], + cwd=tmp_path, + ) + need(proc.returncode != 0, "source drift should fail") + + # 5) Independent checker (binding (2,7) census + champions). + proc = run([sys.executable, "-I", "-B", str(HERE / "independent.py")]) + need(proc.returncode == 0, proc.stderr + proc.stdout) + need("PASS_INDEPENDENT_PARTITIONED_WALKS_9Q" 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"), "--quick"], + cwd=tmp_path, + ) + need(proc.returncode != 0, "duplicate JSON key should fail") + + print("PASS_INDEPENDENT_WALKS_9Q_PACKAGE_TESTS groups=6") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/research/independent-walks-9q/verify.py b/research/independent-walks-9q/verify.py new file mode 100644 index 0000000000..d3674909e0 --- /dev/null +++ b/research/independent-walks-9q/verify.py @@ -0,0 +1,294 @@ +#!/usr/bin/env python3 +"""Partitioned independent-walks obstruction at Q=9; 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_27, + enumerate_partition_36, + enumerate_partition_45, + even_table, + length1_invalid_examples, + quick_checks, + 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() + + part27 = enumerate_partition_27() + need(part27["covering_pairs"] == EXPECTED["partition_27_covering"], "27 covering") + need(part27["min_R"] == EXPECTED["partition_27_min_R"], "27 min R") + need(part27["histogram"] == EXPECTED["partition_27_histogram"], "27 hist") + + part36 = enumerate_partition_36() + need(part36["covering_pairs"] == EXPECTED["partition_36_covering"], "36 covering") + need(part36["min_R"] == EXPECTED["partition_36_min_R"], "36 min R") + need(part36["histogram"] == EXPECTED["partition_36_histogram"], "36 hist") + + part45 = enumerate_partition_45() + need(part45["covering_pairs"] == EXPECTED["partition_45_covering"], "45 covering") + need(part45["min_R"] == EXPECTED["partition_45_min_R"], "45 min R") + need(part45["histogram"] == EXPECTED["partition_45_histogram"], "45 hist") + + partition_min = min(part27["min_R"], part36["min_R"], part45["min_R"]) + need(partition_min == EXPECTED["partition_min_R"] == 80, "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_27"]["R"] == 80, "champ27 R") + need(champ["champion_36"]["R"] == 88, "champ36 R") + need(champ["champion_45"]["R"] == 92, "champ45 R") + + w27_a, w27_b = tuple(champ["champion_27"]["walks"][0]), tuple( + champ["champion_27"]["walks"][1] + ) + w36_a, w36_b = tuple(champ["champion_36"]["walks"][0]), tuple( + champ["champion_36"]["walks"][1] + ) + w45_a, w45_b = tuple(champ["champion_45"]["walks"][0]), tuple( + champ["champion_45"]["walks"][1] + ) + need(dual_R_short_long(even_table(w27_b), w27_a[1]) == 80, "recompute 27") + need( + dual_independent_R(even_table(w36_a), even_table(w36_b)) == 88, + "recompute 36", + ) + need( + dual_independent_R(even_table(w45_a), even_table(w45_b)) == 92, + "recompute 45", + ) + need(EXPECTED["same_walk_q9_floor"] == 466, "same-walk Q9 floor constant") + + cert = { + "schema_version": 1, + "status": "PASS_INDEPENDENT_WALKS_9Q_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=9 (valid restored lengths (2,7), (3,6), (4,5)): covering " + "dual even-parity readout has global min R=80 at (2,7); tariff floor " + "at X=0 is 502>436 (also above same-walk Q=9 floor 466 of #2677). " + "Answers preferred next20 / threerepeat OQ2 without editing " + "leave-alones through #2867 or pending three-repeat tip." + ), + "claim": { + "Q": 9, + "partition_covering_min_R": 80, + "partition_27_covering": part27["covering_pairs"], + "partition_36_covering": part36["covering_pairs"], + "partition_45_covering": part45["covering_pairs"], + "partition_27_min_R": 80, + "partition_36_min_R": 88, + "partition_45_min_R": 92, + "tariff_floor_at_X0": EXPECTED["tariff_floor_at_X0"], + "endpoint_Q6_tariff": EXPECTED["endpoint_tariff_Q6"], + "same_walk_q9_floor": EXPECTED["same_walk_q9_floor"], + "undercuts_436_after_complete_bill": False, + "length1_walks_invalid": True, + "answers_priced_alphabet_q9_companion": True, + "answers_threerepeat_oq2": True, + "oq_answer": ( + "Every covering partitioned dual-walk schedule with total " + "query count Q=n0+n1=9 (valid restored walks of lengths (2,7), " + "(3,6), or (4,5), distinct nonzero labels within each walk, " + "independent dirt, dual even-parity readout) has R≥80, attained " + "only on (2,7) (spectrum {80,82,86,88,92,100}; covering " + "20512576). Partitions (3,6) and (4,5) have min R 88 and 92. At " + "X=0 the abstract tariff is already 502>436 under " + "(b,a,x)=(38,2,2), and also above the same-walk Q=9 floor 466 of " + "#2677; positive path X only increases the bill. Length-1 " + "components are not restored. Leave-alones through #2867 and " + "pending three-repeat tip are not reopened." + ), + "no_new_kappa": True, + }, + "partition_2_plus_7": part27, + "partition_3_plus_6": part36, + "partition_4_plus_5": part45, + "champion": champ, + "length1_invalid_examples": length1, + "unit_tariff": {"b": 38, "a": 2, "x": 2}, + "tariff_check": { + "formula": "38*Q + 2*R + 2*X", + "at_R80_X0": tariff_qrx(9, 80, 0), + "champion_27": tariff_qrx(9, 80, champ["champion_27"]["path_X"]), + "champion_36": tariff_qrx(9, 88, champ["champion_36"]["path_X"]), + "champion_45": tariff_qrx(9, 92, champ["champion_45"]["path_X"]), + "endpoint_Q6": EXPECTED["endpoint_tariff_Q6"], + "same_walk_q9_floor": EXPECTED["same_walk_q9_floor"], + }, + } + 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_7", + "partition_3_plus_6", + "partition_4_plus_5", + ): + 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 compare_quick(pinned): + quick = quick_checks() + claim = pinned["claim"] + need(claim["partition_covering_min_R"] == 80, "pinned min R") + need(claim["tariff_floor_at_X0"] == 502, "pinned floor") + need(claim["undercuts_436_after_complete_bill"] is False, "pinned undercut") + need(claim["answers_threerepeat_oq2"] is True, "pinned oq2") + need(quick["champion"]["champion_27"]["R"] == 80, "quick champ 27") + need(quick["champion"]["champion_36"]["R"] == 88, "quick champ 36") + need(quick["champion"]["champion_45"]["R"] == 92, "quick champ 45") + need( + quick["champion"]["tariff_floor_at_X0"] == claim["tariff_floor_at_X0"], + "quick floor match", + ) + need( + pinned["tariff_check"]["at_R80_X0"] == tariff_qrx(9, 80, 0) == 502, + "tariff arithmetic", + ) + need( + pinned["partition_2_plus_7"]["covering_pairs"] + == EXPECTED["partition_27_covering"], + "pinned 27 covering constant", + ) + need( + pinned["partition_3_plus_6"]["covering_pairs"] + == EXPECTED["partition_36_covering"], + "pinned 36 covering constant", + ) + need( + pinned["partition_4_plus_5"]["covering_pairs"] + == EXPECTED["partition_45_covering"], + "pinned 45 covering constant", + ) + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + "--write-certificate", + action="store_true", + help="rewrite CERTIFICATE.json (maintenance only)", + ) + parser.add_argument( + "--quick", + action="store_true", + help="champion/tariff/pin checks without full census", + ) + args = parser.parse_args(argv) + + check_source_pins() + pinned = load_json_reject_duplicates(CERT_PATH) + + if args.quick: + compare_quick(pinned) + claim = pinned["claim"] + print( + "PASS_INDEPENDENT_WALKS_9Q_QUICK", + f"partition_min_R={claim['partition_covering_min_R']}", + f"tariff_floor={claim['tariff_floor_at_X0']}", + f"endpoint={claim['endpoint_Q6_tariff']}", + "answers_threerepeat_oq2", + "no_undercut_partitioned_independent_walks_q9", + "no_new_kappa", + ) + return 0 + + 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 + + compare_certificate(live, pinned) + claim = pinned["claim"] + print( + "PASS_INDEPENDENT_WALKS_9Q_OBSTRUCTION", + f"partition_min_R={claim['partition_covering_min_R']}", + f"covering_27={claim['partition_27_covering']}", + f"covering_36={claim['partition_36_covering']}", + f"covering_45={claim['partition_45_covering']}", + f"tariff_floor={claim['tariff_floor_at_X0']}", + f"endpoint={claim['endpoint_Q6_tariff']}", + "no_undercut_partitioned_independent_walks_q9", + "answers_priced_alphabet_q9_companion", + "answers_threerepeat_oq2", + "no_new_kappa", + ) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main())