From 3168b12e946665d22d9b986ee34d48978eef2b16 Mon Sep 17 00:00:00 2001 From: Clear1nsight <22630354+Clear1nsight@users.noreply.github.com> Date: Wed, 11 Nov 2026 14:22:27 +1100 Subject: [PATCH 1/4] Reuse #7147 selected replay navigation for onboarding This is the exact documentation prerequisite retained by #7156. It points the onboarding check to the selected #7000/#7001 review. Credit to Rohan Arun and the source authors. --- docs/ci-verification.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/ci-verification.md b/docs/ci-verification.md index 63ba3e9aa8..52b62d0481 100644 --- a/docs/ci-verification.md +++ b/docs/ci-verification.md @@ -1,8 +1,25 @@ # CI verification -## Current selected-family replay: #6030 +## Current selected-family replay: #7000 with #7001 The [selected record](../certificates/selected-result.json) binds conditional +κ = 0.00363005817 to the [application review](research/pr-intake-evidence/pr7000-application/PROOF-REVIEW.md), +[validation receipts](research/pr-intake-evidence/pr7000-application/VALIDATION.json), +and [explicit source closure](../certificates/frontier7000-source.json). +`make frontier7000-verify` follows that exact-source selected replay. The review +reuses eleven authenticated preceding executions and records seven fresh serial +application, scalar and complete native-catalogue executions. The earlier +monolithic timeout is retained separately and is not completed coverage. +Consult the receipts for exact commands, source heads and limits. + +The five inherited framework assumptions remain. No complete uniform word, +literal multiplier execution, independent human proof or formal-kernel proof +is asserted. Routine research submissions do not need to rerun this +selected-family replay. The sections below preserve historical checkpoints. + +## Historical selected-family replay: #6030 + +The [historical checkpoint](../certificates/checkpoints/frontier6030.json) binds conditional κ = 0.003125804 to the [proof review](research/pr-intake-evidence/pr6030-audit/PROOF-REVIEW.md), [validation receipts](research/pr-intake-evidence/pr6030-audit/VALIDATION.json), and [explicit source closure](../certificates/frontier6030-source.json). From 72725fbdf8ca47bf5093f23d4bde4fea6120b586 Mon Sep 17 00:00:00 2001 From: Clear1nsight <22630354+Clear1nsight@users.noreply.github.com> Date: Wed, 11 Nov 2026 21:53:51 +1100 Subject: [PATCH 2/4] Replay the historical selected check at its inspected commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The PR #6292 rejection census and package plan are statements about 2485805. Load its exact sources and planner in a private sparse checkout, keeping all source hashes, 19 expected rejections, nine package selections and the empty-plan control. Subsequent edits to the live Makefile and CI guide no longer invalidate this historical check. The original audit is by unpaidmoon, building on Dennis’s historical replay gate. The pinned repository view follows the precedent of Matarener’s PR #5434. Repair prepared with substantial OpenAI Codex assistance. --- .../historical-selected-replay-gap/README.md | 6 +- .../SOURCES.json | 60 +++++++++--------- .../VERIFY.json | 31 +-------- .../historical-selected-replay-gap/verify.py | 63 ++++++++++++++----- 4 files changed, 82 insertions(+), 78 deletions(-) diff --git a/research/historical-selected-replay-gap/README.md b/research/historical-selected-replay-gap/README.md index 55d8cc3b49..36d9a873ca 100644 --- a/research/historical-selected-replay-gap/README.md +++ b/research/historical-selected-replay-gap/README.md @@ -69,7 +69,11 @@ python3 -B scripts/research_package.py --package research/historical-selected-re The direct command prints `PASS_HISTORICAL_SELECTED_REPLAY_GAP`. A registered replay prints `PASS_REGISTERED_RESEARCH_PACKAGE`. Both require Git history -containing the two inspected commits. +containing the two inspected commits and the source and manifest objects at +`2485805a6d47f36ea83ddde6327d453ac82d44dc`. The verifier uses a temporary +sparse checkout of that commit, checks the declared source digests there, and +uses its planner and manifest inventory. The recorded rejections and selection +therefore remain reproducible after later changes to the live Makefile or CI guide. ## Open next questions diff --git a/research/historical-selected-replay-gap/SOURCES.json b/research/historical-selected-replay-gap/SOURCES.json index c1010eec95..62bb8b3950 100644 --- a/research/historical-selected-replay-gap/SOURCES.json +++ b/research/historical-selected-replay-gap/SOURCES.json @@ -4,13 +4,13 @@ "files": [ { "path": "Makefile", - "usage": "input", + "usage": "provenance", "git_blob": "0d683a06b9e7ee162496108ce9a7c5d2ee94fccf", "sha256": "4f2d4f2dcd15139ec82658a975f85ed300897385f85799218539f4c8d60567da" }, { "path": "certificates/partial-swap-network.json", - "usage": "input", + "usage": "provenance", "git_blob": "eccafa830c16170c36faf93045ddf1f638f7bcd4", "sha256": "4c0b9d37e1034b2076e30a70f8e514416298c462d9ee98bc87fe6556b14df786" }, @@ -22,7 +22,7 @@ }, { "path": "docs/ci-verification.md", - "usage": "input", + "usage": "provenance", "git_blob": "63ba3e9aa8bdc5e942b56e34244b92b16f854085", "sha256": "c7d3027e9ad8bcbff68f07aa9576b30fb2f3c76c44d876d40c7fdbf4a3e2228a" }, @@ -34,163 +34,163 @@ }, { "path": "research/clifford-state-performance/SOURCE.json", - "usage": "input", + "usage": "provenance", "git_blob": "6f98a0061a5104dfab82c9e806f819b41811f684", "sha256": "396d0f08df24952248140d5c65c51b8c902ef1c580892ff7ea182890530f67ee" }, { "path": "research/community-batch1047-audit/CONTENT-COVERAGE.json", - "usage": "input", + "usage": "provenance", "git_blob": "5e0f92af463ec12c5e1dcc3effd44081a88af647", "sha256": "07a9daeaf2bda308a92e9a4684f13d5fc766c7772d74801fceb7f4599fdab226" }, { "path": "research/community-batch1099-audit/CONTENT-COVERAGE.json", - "usage": "input", + "usage": "provenance", "git_blob": "9e13266bf85e627f1b7dc225e9530ea69fd2c7f0", "sha256": "421e1211fb1897c45621dc6801c276e53f2e6f335583c9c9049e535f87c0a3b1" }, { "path": "research/community-batch932-audit/CONTENT-COVERAGE.json", - "usage": "input", + "usage": "provenance", "git_blob": "cc4d03eb59b9ab3f952735f7e88ff18c2d15d7af", "sha256": "184629cac91a5cfaca50330a88596008b824221433867dcf8117539c913c284a" }, { "path": "research/community-batch970-audit/CONTENT-COVERAGE.json", - "usage": "input", + "usage": "provenance", "git_blob": "8b9f4111badf7de5d97684799560b55110e9da79", "sha256": "23188ed920e38a54006cb883e181585620821c63bf7e8b5e05d32719417cc37e" }, { "path": "research/community-frontier741-audit/CONTENT-COVERAGE.json", - "usage": "input", + "usage": "provenance", "git_blob": "a5300d4e7a5381a3f443fc54c768ca6f0f236d68", "sha256": "3c820fb30e1b4d9bcfc6a7ab524375e5b2abd66b940af2c509146104f0bcd79c" }, { "path": "research/community-frontier890-audit/CONTENT-COVERAGE.json", - "usage": "input", + "usage": "provenance", "git_blob": "d7ff6d777b01d69b6ce84caf25d3b7e4a4d2f211", "sha256": "6b185a9902652f893f3ebd8ada92d2f11b6de6533a9a4d11718a8a4496101128" }, { "path": "research/community-hyperplane599-audit/SOURCE.json", - "usage": "input", + "usage": "provenance", "git_blob": "546f37d326d10a99910ae8f908e71ef768524d98", "sha256": "65099d764bfcc39bda5e4d9966783611b094c3522dbdd1435cd498d657a8ef8e" }, { "path": "research/community-k492-audit/SOURCE.json", - "usage": "input", + "usage": "provenance", "git_blob": "e538481e4cb16ed936d3195f2dfb5b5a9ca0a76b", "sha256": "2c0f4fa5bc150d05658af2e7c54c4d2c337dd52b7efd3d69530ae73bcbdf452a" }, { "path": "research/community-reconciliation92-audit/MANIFEST.json", - "usage": "input", + "usage": "provenance", "git_blob": "2a2e93685173d5f13cbb5abe740f5d90352e0228", "sha256": "5f501f3c118131e7d069f30ad77186eb2ad6961f9680a0ef105f4514ed41808a" }, { "path": "research/partial-swap-digest/baseline.py", - "usage": "input", + "usage": "provenance", "git_blob": "a2f0190704db83bd8ef48e46e723c49b925804fe", "sha256": "81e9af92cdf38243a540cdcff2062778e449467848d444da37a9553c12ca4c34" }, { "path": "research/r420-two-sided-basis/SOURCES.json", - "usage": "input", + "usage": "provenance", "git_blob": "5d718e11e62f4bcadecf1e02d6b61f87dbe190b0", "sha256": "d9810b0d139c5a1211fd2c1f0d142187cc1fca30026e1e7bc4f9ecfacf1596d1" }, { "path": "research/skip-clones/SOURCE.json", - "usage": "input", + "usage": "provenance", "git_blob": "8d1bb3b9c8189e35e5d8bfdfa632d7473e8be0d5", "sha256": "0b68e63e35a97ce6b0cdb6e291b88ebaa8f2dd4afb70b2498f10ee89428258dc" }, { "path": "research/split-skip/SOURCE.json", - "usage": "input", + "usage": "provenance", "git_blob": "2ab610b6ea2edd2865fda793ef2168b0c76afb4f", "sha256": "7c2b4646a3ecfef6f881da5c43e4bd0fa9a4d1b00548b8ab458d897e16735134" }, { "path": "scripts/historical-ci-inputs/Makefile", - "usage": "input", + "usage": "provenance", "git_blob": "aff68409021c9d401a6f8013b9dfd7dbcc30f2a8", "sha256": "ea8830dd79da493e2d75baf753d733ff7efbcf2b4794afe41fae0ac8f3055646" }, { "path": "scripts/historical-ci-inputs/ledger-batch932-run_isolated_tests.py", - "usage": "input", + "usage": "provenance", "git_blob": "65db599ab0b1dea0312c4ca048e0bd0f44c3736f", "sha256": "96ea543e6c707424afe247e77bd86c82152f90fc76a0773c4232145da5cdf8d1" }, { "path": "scripts/historical-ci-inputs/ledger-batch932-test_isolated_test_runner.py", - "usage": "input", + "usage": "provenance", "git_blob": "34820a8f24678f918f4d0e7a35380d8013fc3495", "sha256": "628391b6abfbc8674ceec1751867a4392f2cc0b5b66886243e139af86cf355ac" }, { "path": "scripts/historical-ci-inputs/ledger-batch970-verify_selected_result.py", - "usage": "input", + "usage": "provenance", "git_blob": "c755b76e0d44ba4917aa94440ebe54daefce5b2a", "sha256": "d7fd929726b326aeeaf0a3996475adec88eee9aac09ae0bebeeaa0bc1fc8f199" }, { "path": "scripts/historical-ci-inputs/ledger-frontier741-ci-verification.md", - "usage": "input", + "usage": "provenance", "git_blob": "7f3c012504187917a728b9fe87043f0fc8cd006a", "sha256": "a854022e0e1d5d4db4d60e586be3ea56005013ef14a1fc06d02bc06e8529c4b0" }, { "path": "scripts/historical-ci-inputs/partial-swap-context.json", - "usage": "input", + "usage": "provenance", "git_blob": "ad65114886bf34a4fd27e79f3be502389e689faa", "sha256": "833a9642f33aeab2ffea17ec9c6b82e0a953f90192b2c82e10bef21538dccba9" }, { "path": "scripts/historical-ci-inputs/partial-swap-network.json", - "usage": "input", + "usage": "provenance", "git_blob": "52075f2463f60af5e16571347f24274fce73a1ea", "sha256": "f3c4be597b2f2136da4ae2cc80c7454f63c90aa01f84e5b8131cee4dd55de815" }, { "path": "scripts/partial_swap/shared.py", - "usage": "input", + "usage": "provenance", "git_blob": "44a0e454c70f9c4b98e258b8443612e6a119904b", "sha256": "5a0646a50b9f3e8ea55168620a78e8853b0ab810517cefc8cfb8696aedee278a" }, { "path": "scripts/replay_historical_check.py", - "usage": "input", + "usage": "provenance", "git_blob": "1e92fff2782970ef71378f594f2350d245a4db26", "sha256": "5467619c78183d3adc82b0cb55af28e5c1a01fca2b0588677816244b53e2bafd" }, { "path": "scripts/research_package.py", - "usage": "input", + "usage": "provenance", "git_blob": "091b4c8f58bac9a9580d76025b887dc5c873d05f", "sha256": "e1256016e7f51827d04fa2179255989f639ae1d97afaa9c16265f85a0c6abd70" }, { "path": "scripts/run_isolated_tests.py", - "usage": "input", + "usage": "provenance", "git_blob": "a96ab35b315ce492e7fbbfd6c5ae211aa066b541", "sha256": "49eb56dd0fc0d8d8ffdb209970a7adf2176223580646f575d5c22e59543b381c" }, { "path": "scripts/verify_selected_result.py", - "usage": "input", + "usage": "provenance", "git_blob": "6882a4700e410dec569b51ae2eaf1a19cc019195", "sha256": "d6b305eac5b9bdb8172c469ad30a1655a60fa0aceac8b1bf610e1b73f51babd8" }, { "path": "tests/test_isolated_test_runner.py", - "usage": "input", + "usage": "provenance", "git_blob": "343b24abf6719b81805eba5a84c74e57634c8288", "sha256": "3a5470d0b139828b90e19bf9583ddeafcd69f8e34f2824664eb3a2958a52e34d" } diff --git a/research/historical-selected-replay-gap/VERIFY.json b/research/historical-selected-replay-gap/VERIFY.json index 98553e72ed..ab7efa3471 100644 --- a/research/historical-selected-replay-gap/VERIFY.json +++ b/research/historical-selected-replay-gap/VERIFY.json @@ -4,36 +4,7 @@ "python": "3.12", "requirements": [], "inputs": [ - "Makefile", - "certificates/partial-swap-network.json", - "docs/ci-verification.md", - "research/clifford-state-performance/SOURCE.json", - "research/community-batch1047-audit/CONTENT-COVERAGE.json", - "research/community-batch1099-audit/CONTENT-COVERAGE.json", - "research/community-batch932-audit/CONTENT-COVERAGE.json", - "research/community-batch970-audit/CONTENT-COVERAGE.json", - "research/community-frontier741-audit/CONTENT-COVERAGE.json", - "research/community-frontier890-audit/CONTENT-COVERAGE.json", - "research/community-hyperplane599-audit/SOURCE.json", - "research/community-k492-audit/SOURCE.json", - "research/community-reconciliation92-audit/MANIFEST.json", - "research/partial-swap-digest/baseline.py", - "research/r420-two-sided-basis/SOURCES.json", - "research/skip-clones/SOURCE.json", - "research/split-skip/SOURCE.json", - "scripts/historical-ci-inputs/Makefile", - "scripts/historical-ci-inputs/ledger-batch932-run_isolated_tests.py", - "scripts/historical-ci-inputs/ledger-batch932-test_isolated_test_runner.py", - "scripts/historical-ci-inputs/ledger-batch970-verify_selected_result.py", - "scripts/historical-ci-inputs/ledger-frontier741-ci-verification.md", - "scripts/historical-ci-inputs/partial-swap-context.json", - "scripts/historical-ci-inputs/partial-swap-network.json", - "scripts/partial_swap/shared.py", - "scripts/replay_historical_check.py", - "scripts/research_package.py", - "scripts/run_isolated_tests.py", - "scripts/verify_selected_result.py", - "tests/test_isolated_test_runner.py" + "scripts/research_package.py" ], "commands": [ { diff --git a/research/historical-selected-replay-gap/verify.py b/research/historical-selected-replay-gap/verify.py index 83b995941a..9d266c5a4e 100644 --- a/research/historical-selected-replay-gap/verify.py +++ b/research/historical-selected-replay-gap/verify.py @@ -6,8 +6,10 @@ """ import hashlib import importlib.util +import json import subprocess import sys +import tempfile from pathlib import Path ROOT = Path(__file__).resolve().parents[2] @@ -61,31 +63,47 @@ def require(ok, message): raise SystemExit(message) -def load_checker(): - path = ROOT / "scripts/replay_historical_check.py" - spec = importlib.util.spec_from_file_location("historical_selected_replay_gap_checker", path) +def load_module(path): + spec = importlib.util.spec_from_file_location(path.stem, path) module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) return module +def checkout_snapshot(snapshot, sources, runner, env): + paths = [runner.canonical_relative_path(row["path"]) for row in sources["files"]] + git = ["git", "-c", "maintenance.auto=false", "-c", "gc.auto=0", + "-c", "core.autocrlf=false"] + subprocess.run([*git, "clone", "--quiet", "--shared", "--no-tags", "--no-checkout", + "--", str(ROOT), str(snapshot)], cwd=ROOT, env=env, check=True) + subprocess.run([*git, "update-ref", "--no-deref", "HEAD", INSPECTED], + cwd=snapshot, env=env, check=True) + # The pinned planner reads omitted manifests from the sparse HEAD/index. + patterns = "".join(f"/{path.as_posix()}\n" for path in paths) + subprocess.run([*git, "sparse-checkout", "set", "--no-cone", "--stdin"], + cwd=snapshot, env=env, input=patterns.encode("utf-8"), check=True) + subprocess.run([*git, "read-tree", "-mu", "HEAD"], cwd=snapshot, env=env, check=True) + for path, row in zip(paths, sources["files"], strict=True): + require(hashlib.sha256((snapshot / path).read_bytes()).hexdigest() == row["sha256"], + "historical checkout source digest changed: " + path.as_posix()) + + def entries(checker): for name, config in checker.CONFIG.items(): for entry in [config, *config.get("additional_inputs", [])]: yield name, entry -def reject(checker, entry): +def reject(root, checker, entry): try: - checker.authenticated_input(ROOT, entry) + checker.authenticated_input(root, entry) except ValueError as exc: return str(exc) raise SystemExit("historical input was admitted: " + entry["path"]) -def main(): - require(not sys.flags.optimize, "assertions must stay enabled") - checker = load_checker() +def check_snapshot(root, env): + checker = load_module(root / "scripts/replay_historical_check.py") selected = [entry for name, entry in entries(checker) if name == "tooling-ledger" and entry["path"] == SELECTED_PATH] require(len(selected) == 1, "selected-result checker overlay is not unique") @@ -94,7 +112,7 @@ def main(): require(entry["accepted_live_sha256"] == [SELECTED_ACCEPTED], "accepted selected-checker successors changed") frozen = (checker.INPUTS / entry["input"]).read_bytes() - live = (ROOT / SELECTED_PATH).read_bytes() + live = (root / SELECTED_PATH).read_bytes() require(hashlib.sha256(frozen).hexdigest() == SELECTED_PIN, "frozen selected checker bytes changed") require(hashlib.sha256(live).hexdigest() == SELECTED_LIVE, "live selected checker digest changed") require(SELECTED_LIVE not in (SELECTED_PIN, SELECTED_ACCEPTED), "live checker was already admitted") @@ -102,7 +120,7 @@ def main(): # live successor, not a broken comparison. require(SELECTED_PIN in (SELECTED_PIN, *entry["accepted_live_sha256"]), "pin membership control failed") - require(reject(checker, entry) == REJECTIONS[SELECTED_PATH][1], + require(reject(root, checker, entry) == REJECTIONS[SELECTED_PATH][1], "selected checker rejection text changed") counts = {path: 0 for path in REJECTIONS} @@ -110,7 +128,7 @@ def main(): for _name, item in entries(checker): if item["path"] not in REJECTIONS: continue - message = reject(checker, item) + message = reject(root, checker, item) counts[item["path"]] += 1 messages.setdefault(item["path"], message) for path, (count, message) in REJECTIONS.items(): @@ -118,20 +136,31 @@ def main(): require(messages[path] == message, "rejection text changed for " + path) require(sum(counts.values()) == 19, "rejection total changed") ci = [item for _name, item in entries(checker) if item["path"] == CI_PATH] - require(len(ci) == 1 and hashlib.sha256((ROOT / CI_PATH).read_bytes()).hexdigest() == CI_LIVE, + require(len(ci) == 1 and hashlib.sha256((root / CI_PATH).read_bytes()).hexdigest() == CI_LIVE, "selected CI note digest changed") diff = subprocess.check_output( - ["git", "diff", "--name-only", PARENT, INSPECTED], cwd=ROOT, text=True) + ["git", "diff", "--name-only", PARENT, INSPECTED], cwd=root, env=env, text=True) changed = sorted(name for name in diff.splitlines() if name) require(changed == CHANGED, "inspected commit diff changed") - sys.path.insert(0, str(ROOT / "scripts")) - from research_package import plan_details - details = plan_details(ROOT, set(changed)) + planner = load_module(root / "scripts/research_package.py") + details = planner.plan_details(root, set(changed)) require([row["package"] for row in details] == PLAN_PACKAGES, "helper plan selection changed") matched = {name for row in details for names in row["causes"].values() for name in names} require(sorted(set(changed) - matched) == UNMATCHED, "unmatched plan paths changed") - require(plan_details(ROOT, set()) == [], "empty change set selected a package") + require(planner.plan_details(root, set()) == [], "empty change set selected a package") + + +def main(): + require(not sys.flags.optimize, "assertions must stay enabled") + sources = json.loads(Path(__file__).with_name("SOURCES.json").read_bytes()) + require(sources["base_commit"] == INSPECTED, "historical checkout base changed") + runner = load_module(ROOT / "scripts/research_package.py") + env = runner.git_source_env() + with tempfile.TemporaryDirectory(prefix="historical-selected-replay-") as temporary: + snapshot = Path(temporary) / "snapshot" + checkout_snapshot(snapshot, sources, runner, env) + check_snapshot(snapshot, env) print("PASS_HISTORICAL_SELECTED_REPLAY_GAP") print("selected_checker_live=" + SELECTED_LIVE) print("rejections=19 distinct_paths=7 plan_packages=9") From aec6330dd752cebbc01b876e59e0bb12a1617299 Mon Sep 17 00:00:00 2001 From: DreamingOfClouds Date: Fri, 13 Nov 2026 18:25:11 -0600 Subject: [PATCH 3/4] Add P104 t = -1 laws: charge deficiency, one-unit owned cuts, hub additivity, the per-J odd unit (no kappa) Co-Authored-By: Claude Opus 5.5 --- research/p104-t-minus-one-laws/NOTICE | 17 + research/p104-t-minus-one-laws/PROOF.md | 92 +++++ research/p104-t-minus-one-laws/README.md | 179 ++++++++++ research/p104-t-minus-one-laws/SOURCES.json | 24 ++ research/p104-t-minus-one-laws/TASK.json | 123 +++++++ research/p104-t-minus-one-laws/VERIFY.json | 41 +++ research/p104-t-minus-one-laws/charge_law.py | 331 ++++++++++++++++++ .../p104-t-minus-one-laws/kernel_bills.py | 244 +++++++++++++ research/p104-t-minus-one-laws/odd_unit.py | 212 +++++++++++ 9 files changed, 1263 insertions(+) create mode 100644 research/p104-t-minus-one-laws/NOTICE create mode 100644 research/p104-t-minus-one-laws/PROOF.md create mode 100644 research/p104-t-minus-one-laws/README.md create mode 100644 research/p104-t-minus-one-laws/SOURCES.json create mode 100644 research/p104-t-minus-one-laws/TASK.json create mode 100644 research/p104-t-minus-one-laws/VERIFY.json create mode 100644 research/p104-t-minus-one-laws/charge_law.py create mode 100644 research/p104-t-minus-one-laws/kernel_bills.py create mode 100644 research/p104-t-minus-one-laws/odd_unit.py diff --git a/research/p104-t-minus-one-laws/NOTICE b/research/p104-t-minus-one-laws/NOTICE new file mode 100644 index 0000000000..07afb30465 --- /dev/null +++ b/research/p104-t-minus-one-laws/NOTICE @@ -0,0 +1,17 @@ +Apache-2.0. DreamingOfClouds with Claude Opus 5.5 (Anthropic), via Claude Code. + +The E8/P104 Gram matrix is computed from the repository file +research/complex-frame-pair-decoders/inputs/pr717/P104_HIT_flip_3a.txt (PR968 +decoder, SHA256 8e0178db02c14e1b29058cdbdbd50aac22f2b55a1ba21dc82f417610c9932526, +pinned in SOURCES.json) as D T^T / 2. Credit the PR968 authors for that decoder +and its normal form, Rohan Arun for the signed #7113 caller whose t = -1 per-port +contract and 17-stage role pairing the odd-unit law takes as given, and +Clear1nsight, ToikY and the other contributors of the P104 price and replay +lineage for the conventions used here. + +The sigma-rank o, the identity o = rank of the q-odd part and Lemma E are stated +and checked in research/p104-structure-laws (#7555); this package uses them as +cited results. + +All checkers in this package are our own code; no code is imported from the +repository or any other package, and no data is vendored. diff --git a/research/p104-t-minus-one-laws/PROOF.md b/research/p104-t-minus-one-laws/PROOF.md new file mode 100644 index 0000000000..4058536c07 --- /dev/null +++ b/research/p104-t-minus-one-laws/PROOF.md @@ -0,0 +1,92 @@ +# Proofs and premises + +Notation: n ports, G the root Gram matrix (rank r), K = ker G, Z = G/2 − I on partner cells (G_pt odd). +Arrivals at V are the public rows present at V plus the owned rows landing there. The deficiency is +D = rank(arrivals + targets) − rank(arrivals). Targets: X_p ↦ x_p − y_p; helpers/relays ↦ their own token. +The checked instances: A_m (roots e_i − e_j, ports e_i + e_j + e_{m+1} ∈ F₂^{m+2}; G/2 eigenvalues 0 and (m+1)/2) +and E8/P104 (G = D Tᵀ/2 from the PR968 decoder; rank 8, G² = 26G, 48 partners per port). + +## Law 1. Charge law and the corrected anchored law [P] + +**Premises (relay family).** (a) U-junk is cleaned by relays that lump −b·y_t, are read by X_p (coefficient +fixed by Z_pt) and re-add a copy of Y_t, ending as their own token; (b) every owned deposit is charge-neutral +(its x-part has rows in range G: true for U, which has no x, for parked copies, and for the E8-type L = G/2·x); +(c) each cell re-adds either Y_t^final (settled) or an owned copy O_t of pure y_t (early); (d) X finals at V. + +**General witness.** A linear functional λ that kills every arrival but not every target certifies a missing +dimension. Take λ = (k on the x-symbols, k′ on the y-symbols, θ on tokens). Owned U rows at V are y-only and +span range G, so λ(U) = 0 forces k′ ⊥ range G, i.e. k′ ∈ K. Helper and relay +arrivals each contain their own token with coefficient 1, so θ is determined by them. Substituting into the X_p +arrival (x_p − y_p plus the relay reads) gives, row by row, +((I + Z^S)k + Z^E k′)_p = 0, where a settled cell contributes through Y_t^final = x_t (coefficient k_t) and an +early cell through O_t = y_t (coefficient k′_t). The solutions with k = k′ ∈ K are target-blind (they vanish on +x_p − y_p). Hence D = dim{(k, k′) : k′ ∈ K, (I + Z^S)k + Z^E k′ = 0} − dim K. ∎ + +**Corollaries.** All settled (E = ∅): the condition is (G/2)k = 0 with k′ ∈ K free, so D = dim K = n − r. +Column-pure sets give dim(K ∩ ker Z^E); per cell that form is wrong because solutions with k ∉ K exist +(8 of 90 checked sets). The σ-anchor schedule (one early cell per column on a perfect partner matching) gives +D = 0 on every E8 matching checked [C]; a general proof for all matchings is not claimed. + +## Law 2. Carried-row law [P] + +**Premises.** The word is linear; an owned MOVE moves one row and is billed |Δdim| ≥ 1 (SPEC P[d] per row); +owned INIT/COPY/dirty CLEAR are free and make no MOVE. + +**Proof.** For each owned MOVE m of register R (F → F′), cut R at the MOVE: before it R is dirty-cleared at F; +after it a new owned register is born at F′ holding a fresh inert symbol σ_m. This σ-world has no owned MOVE; +let D₀ be its deficiency. The real word is the σ-world followed by the substitution π: σ_m ↦ c_m (the content of R +at the MOVE); this is exact because the word is linear and σ_m enters only through R. Let A be the σ-world +arrivals and W = span A ∩ (σ-free space). Then codim_{span A} W ≤ s := #σ, π is the identity on W, and so +span πA ⊆ W + (≤ s dimensions) and W ⊆ span πA. Targets T are σ-free, so T ∩ span A = T ∩ W and +D₀ = dim T − dim(T ∩ W), while D = dim T − dim(T ∩ span πA) ≥ dim T − dim(T ∩ W) − s = D₀ − s. Finally +s = #MOVEs ≤ Σ|Δdim| = owned units. ∎ + +## Law 3. Hub additivity [P] + +**Setting.** Hubs j = 1..m in time order; S_j the X's finalised at hub j; fwd_j the ports whose finals are +present at hub j; K_j = {k ∈ K : k_{fwd_j} = 0}. + +**Bound.** By the witness argument of law 1 (time-local cell charges), every register present at hub j is +killed by f_k for k ∈ K_j: forwarded finals τ_t carry f_k = −k_t = 0. Targets τ_p, p ∈ S_j, carry −k_p. +So D_j ≥ rank(K_j|S_j) = dim K_j − dim{k ∈ K_j : k_{S_j} = 0}. By law 2 each owned landing kills at most one +witness, so the owned units needed are ≥ Σ_j D_j. + +**Telescoping.** Nested (fwd_j = S_{= n - r - N_neutral - N_owned, which bounds every t = -1 owned bill on P104 (96 per call with N = 0).", + "first_step": "State a content-class invariant for public ADD sequences and test it on A3/A4 programs with courier and twin operations.", + "blocked_by": "Nothing." + }, + { + "question": "Can an L-side network deliver all of a column's L-side charge after Y_t passes its partner line (the Y-prefix schedule) at a public cost below the U-side relay floor?", + "why_it_matters": "Per-cell anchored re-adds remove the owned bill exactly (D = 0 on E8 matchings); the remaining cost of that schedule sits entirely on the L side.", + "first_step": "On the A3 toy, find frames where the Y-prefix L-side gives and receives are legal, and compute D and the public bill.", + "blocked_by": "Nothing." + } + ] +} diff --git a/research/p104-t-minus-one-laws/VERIFY.json b/research/p104-t-minus-one-laws/VERIFY.json new file mode 100644 index 0000000000..eafa342c18 --- /dev/null +++ b/research/p104-t-minus-one-laws/VERIFY.json @@ -0,0 +1,41 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/complex-frame-pair-decoders/inputs/pr717/P104_HIT_flip_3a.txt" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/charge_law.py" + ], + "timeout_seconds": 120, + "checks": "Law 1 and the counting half of law 5. Exact relay-family algebra on A3/A4: all cells settled gives D = n - r (3, 6); the corrected anchored law D = dim{(k,k'): k' in ker G, (I+Z^S)k + Z^E k' = 0} - dim ker G equals the model's D on 60 + 30 random early sets with Y exact; control: the per-cell form dim(ker G cap ker Z^E) is wrong on 8/90. E8/P104 Gram from the pinned PR968 file: rank 8, G^2 = 26G, 48 partners, dim ker G 96, all settled D = 96, three perfect partner matchings D = 0, partial matchings D >= 96 - c. Atom counting dim{k in ker G : k_N = 0} >= n - r - |N| over all column sets at A3/A4, tight at every |N|. Prints PASS_T1_CHARGE_LAW." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/kernel_bills.py" + ], + "timeout_seconds": 240, + "checks": "Laws 2 and 3. Carried-row bound D >= D0 - s on 3,000 seeded random substitution worlds, attained, with the s - 1 control violated. Hub additivity: nested sums of per-hub deficiencies = dim K on all 4,683 ordered hub sequences at A3 and 4,000 at A4; no-forwarding sums >= dim K; E8/P104: label pairing F2 rank 9, 510 hyperplane hubs (sizes 44-60), D1 + D_V = 96 on 510/510, last-hub-only control as low as 36, non-nested excess in [0, 2], one hub per port 96 nested / 103 unforwarded. Prints PASS_T1_KERNEL_BILLS." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/odd_unit.py" + ], + "timeout_seconds": 60, + "checks": "Law 4. Exact F_p (p = 2147483629, i = sqrt(-1)): H specialises to M; o(H^n) = 2,2,0,2,2,0, H^3 = -I, H^6 = I; o(SW) = 1 so 17 odd units per port per word; three-register lift reproduces H, cube -I, o = 2, q-free (o = 0) only in the gauge frame whose gauge has o = 1; o invariant under 200 sigma-fixed conjugations, control non-sigma-fixed changes it; gauge ledger total 20 for every m. Prints PASS_T1_ODD_UNIT." + } + ] +} diff --git a/research/p104-t-minus-one-laws/charge_law.py b/research/p104-t-minus-one-laws/charge_law.py new file mode 100644 index 0000000000..21791d4ba3 --- /dev/null +++ b/research/p104-t-minus-one-laws/charge_law.py @@ -0,0 +1,331 @@ +"""P104 t = -1 laws 1 and 5 (part): the charge law, the corrected anchored deficiency law and Y-atom counting. + +Standard library only, exact rational arithmetic. Contract per port: M = [[1,-1],[1,0]], X = x - y, Y = x. + +Geometry A_m (toy): ports q_ij = e_i + e_j + e_{m+1} in F2^(m+2), roots e_i - e_j, G = Gram of the roots (rank m), +partner cells (p,t) = {p != t, G_pt odd}, Z = G/2 - I on partner cells. E8/P104: the Gram of the 104 live lines +D T^T / 2 of the PR968 decoder file research/complex-frame-pair-decoders/inputs/pr717/P104_HIT_flip_3a.txt +(SHA256 pinned below). + +Relay model (frame-free exact algebra, the d = 0 MONOHUB relay family): owned U = rows sum_t B_tj Y_t (product +-G/2), owned L = rows sum_s B_sj X_s; every partner cell (p,t) has a relay R_pt (lump -y_t, read by X_p, re-add) +and an L-side helper H_tp; cell (p,t) in the early set E re-adds a parked owned copy O_t of pure y_t, every other +cell re-adds Y_t^final (settled). D = rank(arrivals + targets) - rank(arrivals) at V. + +Checked: + (a) all cells settled: D = n - r (A3: 3, A4: 6) -- GLIFT's charge deficiency; + (b) the corrected anchored law D = dim{(k,k'): k' in ker G, (I+Z^S)k + Z^E k' = 0} - dim ker G equals the model's + D on 60 random early sets at A3 and 30 at A4, with Y exact on every run; + (c) control: the per-cell form dim(ker G cap ker Z^E) disagrees with the model on some of those sets; + (d) E8/P104: rank G = 8, G^2 = 26 G, 48 partners per port, dim ker G = 96; law (b): all settled D = 96, three + random perfect partner matchings D = 0; early cells on c columns give D >= 96 - c (printed); + (e) Y-atom counting: for every column set N at A3 (64) and A4 (1,024), dim{k in ker G : k_N = 0} >= n - r - |N|, + with equality attained at every |N| <= n - r, and some sets of size n - r not spanning (D > 0). +Prints PASS_T1_CHARGE_LAW.""" +import hashlib, itertools, os, random, sys +from fractions import Fraction as Fr + +HERE = os.path.dirname(os.path.abspath(__file__)) +ROOT = os.path.dirname(os.path.dirname(HERE)) +PR968 = 'research/complex-frame-pair-decoders/inputs/pr717/P104_HIT_flip_3a.txt' +PR968_SHA256 = '8e0178db02c14e1b29058cdbdbd50aac22f2b55a1ba21dc82f417610c9932526' + + +def say(s): + print(s, flush=True) + + +def expect(name, got, want): + if got != want: + raise SystemExit('FAIL %s: got %r want %r' % (name, got, want)) + say('ok %s: %r' % (name, got)) + + +def rank(rows): + """Exact rank of a list of sparse rows {key: Fraction}.""" + piv = {} # pivot key -> normalised row + r = 0 + for row in rows: + v = {k: Fr(x) for k, x in row.items() if x} + while v: + k = min(v) + if k in piv: + c = v[k] + for kk, xx in piv[k].items(): + nv = v.get(kk, 0) - c * xx + if nv: + v[kk] = nv + else: + v.pop(kk, None) + else: + c = v[k] + piv[k] = {kk: xx / c for kk, xx in v.items()} + r += 1 + break + return r + + +def dense_rank(M): + return rank([{j: x for j, x in enumerate(row) if x} for row in M]) + + +def nullspace(M): + """Basis of {v : M v = 0} (M dense list of lists, rationals).""" + n = len(M[0]) + A = [[Fr(x) for x in row] for row in M] + pivc = [] + r = 0 + for c in range(n): + p = next((i for i in range(r, len(A)) if A[i][c] != 0), None) + if p is None: + continue + A[r], A[p] = A[p], A[r] + A[r] = [x / A[r][c] for x in A[r]] + for i in range(len(A)): + if i != r and A[i][c] != 0: + f = A[i][c] + A[i] = [x - f * y for x, y in zip(A[i], A[r])] + pivc.append(c) + r += 1 + free = [c for c in range(n) if c not in pivc] + out = [] + for f in free: + v = [Fr(0)] * n + v[f] = Fr(1) + for i, c in enumerate(pivc): + v[c] = -A[i][f] + out.append(v) + return out + + +# ---------------------------------------------------------------------------------------------- geometry +def geometry(m): + pairs = list(itertools.combinations(range(m + 1), 2)) + roots = [[(1 if k == i else -1 if k == j else 0) for k in range(m + 1)] for i, j in pairs] + ports = [(1 << i) | (1 << j) | (1 << (m + 1)) for i, j in pairs] + n = len(roots) + G = [[sum(a * b for a, b in zip(roots[s], roots[t])) for t in range(n)] for s in range(n)] + B = [[Fr(r[k]) for k in range(m)] for r in roots] + IJ = [[Fr(1 + (a == b)) for b in range(m)] for a in range(m)] + C = [[sum(B[t][a] * IJ[a][j] for a in range(m)) / 2 for j in range(m)] for t in range(n)] + for s in range(n): + for t in range(n): + assert sum(C[s][j] * B[t][j] for j in range(m)) == Fr(G[s][t], 2) + even_label = bin(ports[s] & ports[t]).count('1') % 2 == 0 + assert (G[s][t] % 2 == 1) == (s != t and even_label) # partner cells = odd Gram = label pairing + Z = {(s, t): Fr(G[s][t], 2) for s in range(n) for t in range(n) if s != t and G[s][t] % 2} + return n, G, B, C, Z + + +def relay_model(m, E): + n, G, B, C, Z = geometry(m) + r = m + pub, own = {}, {} + X = ['X%d' % p for p in range(n)] + Y = ['Y%d' % t for t in range(n)] + for p in range(n): + pub[X[p]] = {'x%d' % p: Fr(1)} + for t in range(n): + pub[Y[t]] = {'y%d' % t: Fr(1)} + rel = {k: 'R%d_%d' % k for k in Z} + hel = {k: 'H%d_%d' % k for k in Z} + for v in list(rel.values()) + list(hel.values()): + pub[v] = {v: Fr(1)} + + def reg(a): + return pub[a] if a in pub else own[a] + + def add(d, c, s): + dd = reg(d) + for k, v in list(reg(s).items()): + nv = dd.get(k, 0) + c * v + if nv: + dd[k] = nv + else: + dd.pop(k, None) + U = ['U%d' % j for j in range(r)] + L = ['L%d' % j for j in range(r)] + for j in range(r): + own[U[j]] = {} + own[L[j]] = {} + for t in range(n): + add(U[j], B[t][j], Y[t]) + add(L[j], B[t][j], X[t]) + for (p, t), R in rel.items(): + add(R, -1, Y[t]) # relay lump -y_t + for (t, p), H in hel.items(): + add(H, -1, Y[p]) # L-side helper lump + for t in range(n): + own['O%d' % t] = {} + add('O%d' % t, 1, Y[t]) # parked owned copy of pure y_t (anchor) + for t in range(n): + add(Y[t], -1, 'O%d' % t) # zero-Y by parking + for j in range(r): + for t in range(n): + add(Y[t], C[t][j], L[j]) # L deposit G/2 x (charge-neutral) + for (t, p), H in hel.items(): + add(Y[t], Z[(t, p)], H) # L-side give + for (t, p), H in hel.items(): + add(H, 1, X[p]) # receive pure x_p + for (p, t), R in rel.items(): + add(X[p], -Z[(p, t)], R) # X reads relay + for (p, t), R in rel.items(): + if (p, t) in E: + add(R, 1, 'O%d' % t) # early re-add from the anchor + for (t, p), H in hel.items(): + add(Y[t], -Z[(t, p)], H) # L-side second reads + for (p, t), R in rel.items(): + if (p, t) not in E: + add(R, 1, Y[t]) # settled re-add against Y_t final + Vregs = X + list(rel.values()) + list(hel.values()) + T = {} + for p in range(n): + T[X[p]] = {'x%d' % p: Fr(1), 'y%d' % p: Fr(-1)} + for v in list(rel.values()) + list(hel.values()): + T[v] = {v: Fr(1)} + arr = [pub[v] for v in Vregs] + [own[u] for u in U] + D = rank(arr + [T[v] for v in Vregs]) - rank(arr) + yok = all(pub[Y[t]] == {'x%d' % t: Fr(1)} for t in range(n)) + return D, yok + + +def corrected_law(n, G, Z, E, K): + """dim{(k, c) : (I + Z^S) k + Z^E K c = 0} - dim ker G.""" + d = len(K) + M = [] + for p in range(n): + row = {} + for u in range(n): + v = Fr(int(p == u)) + if (p, u) in Z and (p, u) not in E: + v += Z[(p, u)] + if v: + row[u] = v + for j in range(d): + v = sum((Z[(p, u)] * K[j][u] for u in range(n) if (p, u) in E), Fr(0)) + if v: + row[n + j] = v + M.append(row) + return (n + d - rank(M)) - d + + +def percell_form(n, Z, E, K): + """GLIFT's per-cell extension dim(ker G cap ker Z^E) (control).""" + d = len(K) + cols = [[sum((Z[(p, u)] * K[j][u] for u in range(n) if (p, u) in E), Fr(0)) for p in range(n)] for j in range(d)] + return d - dense_rank(cols) + + +def section_toys(): + say('== (a)-(c) relay model on A3 and A4') + total_bad_percell = 0 + for m, trials in ((3, 60), (4, 30)): + n, G, B, C, Z = geometry(m) + K = nullspace([[Fr(x) for x in r] for r in G]) + expect('A%d: n, rank G, dim ker G, partner cells' % m, (n, dense_rank(G), len(K), len(Z)), + {3: (6, 3, 3, 24), 4: (10, 4, 6, 60)}[m]) + D0, yok = relay_model(m, set()) + expect('A%d all cells settled: D = n - r, Y exact' % m, (D0, yok), (n - m, True)) + cells = sorted(Z) + rng = random.Random(7) + ok = bad = 0 + hist = {} + for _ in range(trials): + E = set(rng.sample(cells, rng.randint(0, len(cells) // 2))) + D, yok = relay_model(m, E) + law = corrected_law(n, G, Z, E, K) + assert yok, 'Y not exact' + if D != law: + raise SystemExit('FAIL corrected law: model %d law %d' % (D, law)) + ok += 1 + bad += percell_form(n, Z, E, K) != D + hist[D] = hist.get(D, 0) + 1 + expect('A%d corrected anchored law = model D on random early sets' % m, ok, trials) + say(' A%d D histogram %s; per-cell form wrong on %d/%d' % (m, dict(sorted(hist.items())), bad, trials)) + total_bad_percell += bad + if total_bad_percell == 0: + raise SystemExit('FAIL control: per-cell form never disagreed') + say('ok control: per-cell form dim(ker G cap ker Z^E) disagrees on %d/90 sets (misses k outside ker G)' % total_bad_percell) + + +# ---------------------------------------------------------------------------------------------- E8 / P104 +def load_e8(): + path = os.path.join(ROOT, PR968) + raw = open(path, 'rb').read() + expect('SHA256 of %s' % PR968, hashlib.sha256(raw).hexdigest(), PR968_SHA256) + L = raw.decode().split('\n') + Dr = [[int(x) for x in l[3:].split()] for l in L if l.startswith(' d:')] + Tr = [[int(x) for x in l[3:].split()] for l in L if l.startswith(' t:')] + n = len(Dr[0]) + g = [[sum(Dr[k][i] * Tr[k][j] for k in range(8)) // 2 for j in range(n)] for i in range(n)] + return n, g + + +def section_e8(): + say('== (d) E8 / P104') + n, G = load_e8() + expect('ports', n, 104) + expect('rank G', dense_rank(G), 8) + G2 = [[sum(G[i][k] * G[k][j] for k in range(n)) for j in range(n)] for i in range(n)] + expect('G^2 = 26 G', all(G2[i][j] == 26 * G[i][j] for i in range(n) for j in range(n)), True) + Z = {(p, t): Fr(G[p][t], 2) for p in range(n) for t in range(n) if p != t and G[p][t] % 2} + part = {t: [p for p in range(n) if (p, t) in Z] for t in range(n)} + expect('partners per port', sorted({len(v) for v in part.values()}), [48]) + K = nullspace([[Fr(x) for x in r] for r in G]) + expect('dim ker G', len(K), 96) + expect('all cells settled: D', corrected_law(n, G, Z, set(), K), 96) + rng = random.Random(3) + + def matching(cols): + for _ in range(5000): + order = list(cols) + rng.shuffle(order) + used, sig = set(), {} + for t in order: + c = [p for p in part[t] if p not in used] + if not c: + break + p = rng.choice(c) + used.add(p) + sig[t] = p + else: + return sig + raise SystemExit('no matching found') + for tr in range(3): + sig = matching(range(n)) + expect('perfect partner matching %d (one early cell per column): D' % tr, + corrected_law(n, G, Z, {(sig[t], t) for t in sig}, K), 0) + for c in (8, 48, 90, 96): + sig = matching(rng.sample(range(n), c)) + D = corrected_law(n, G, Z, {(sig[t], t) for t in sig}, K) + if D < 96 - c: + raise SystemExit('FAIL atom bound at c=%d: D=%d' % (c, D)) + say('ok early cells on %3d columns: D = %d >= %d' % (c, D, max(0, 96 - c))) + + +def section_atoms(): + say('== (e) Y-atom counting: dim{k in ker G : k_N = 0} >= n - r - |N|') + for m in (3, 4): + n, G, B, C, Z = geometry(m) + d = n - m + best = {} + nonspan = 0 + for mask in range(1 << n): + N = [i for i in range(n) if mask >> i & 1] + Cc = [i for i in range(n) if not mask >> i & 1] + dim = len(Cc) - (dense_rank([[G[i][j] for j in Cc] for i in range(n)]) if Cc else 0) + if dim < d - len(N): + raise SystemExit('FAIL atom bound') + best[len(N)] = min(best.get(len(N), 99), dim) + nonspan += (len(N) == d and dim > 0) + expect('A%d min over |N| = 0..%d' % (m, d), [best[k] for k in range(d + 1)], list(range(d, -1, -1))) + if nonspan == 0: + raise SystemExit('FAIL control: every (n-r)-set spans') + say('ok A%d: %d column sets of size n - r = %d leave D > 0 (not every n - r columns suffice)' % (m, nonspan, d)) + + +if __name__ == '__main__': + section_toys() + section_atoms() + section_e8() + say('PASS_T1_CHARGE_LAW') diff --git a/research/p104-t-minus-one-laws/kernel_bills.py b/research/p104-t-minus-one-laws/kernel_bills.py new file mode 100644 index 0000000000..05f416fe85 --- /dev/null +++ b/research/p104-t-minus-one-laws/kernel_bills.py @@ -0,0 +1,244 @@ +"""P104 t = -1 laws 2 and 3: the carried-row law (one owned MOVE cuts the V-span deficiency by at most 1) and +multi-hub additivity (per-hub deficiencies telescope to dim K). Standard library only, exact rationals. + +Law 2 (carried-row). Arrivals A_sigma live over base symbols plus inert symbols sigma_1..sigma_s (one per owned +MOVE); the real word substitutes sigma_m -> c_m. With targets T sigma-free, +D = dim(T + pi A) - dim(pi A) >= D0 - s, D0 = dim(T + A_sigma) - dim(A_sigma). Checked on 3,000 seeded random +worlds (base dim 6..12, s = 0..4, substitutions with base-only and chained contents); the bound is attained +(D = D0 - s) in a positive fraction; control: the strengthened bound D >= D0 - s + 1 is violated. + +Law 3 (hub additivity). K = ker G (atom set empty). Hubs j = 1..m finalise the X's in S_j; the witness at hub j is +K_j = {k in K : k_fwd_j = 0} and D_j = rank(K_j restricted to S_j) = dim K_j - dim{k in K_j : k_S_j = 0}. + nested (fwd_j = S_= dim K. +Checked on all 4,683 ordered hub sequences at A3, 4,000 seeded random ones at A4, and on E8/P104 for every +hyperplane hub of the label pairing (510 hubs, then V), 300 non-nested hyperplane pairs, and one hub per port. +Control: the last hub alone (D_V) falls well below dim K. Prints PASS_T1_KERNEL_BILLS.""" +import hashlib, itertools, os, random +from fractions import Fraction as Fr + +HERE = os.path.dirname(os.path.abspath(__file__)) +ROOT = os.path.dirname(os.path.dirname(HERE)) +PR968 = 'research/complex-frame-pair-decoders/inputs/pr717/P104_HIT_flip_3a.txt' +PR968_SHA256 = '8e0178db02c14e1b29058cdbdbd50aac22f2b55a1ba21dc82f417610c9932526' + + +def say(s): + print(s, flush=True) + + +def expect(name, got, want): + if got != want: + raise SystemExit('FAIL %s: got %r want %r' % (name, got, want)) + say('ok %s: %r' % (name, got)) + + +def rank(rows): + piv = {} + r = 0 + for row in rows: + v = {k: Fr(x) for k, x in row.items() if x} + while v: + k = min(v) + if k in piv: + c = v[k] + for kk, xx in piv[k].items(): + nv = v.get(kk, 0) - c * xx + if nv: + v[kk] = nv + else: + v.pop(kk, None) + else: + c = v[k] + piv[k] = {kk: xx / c for kk, xx in v.items()} + r += 1 + break + return r + + +# ---------------------------------------------------------------------------------------------- law 2 +def rand_row(rng, keys, dens): + return {k: Fr(rng.randint(-3, 3)) for k in keys if rng.random() < dens} + + +def carried_row(): + say('== law 2: carried-row bound D >= D0 - s') + rng = random.Random(2026) + trials = attained = ctl = 0 + for _ in range(3000): + b = rng.randint(6, 12) + s = rng.randint(0, 4) + base = ['b%d' % i for i in range(b)] + sig = ['s%d' % i for i in range(s)] + A = [rand_row(rng, base, 0.3) for _ in range(rng.randint(1, b))] + for _ in range(rng.randint(0, 2 * s + 1)): # arrivals that carry sigma content + r = rand_row(rng, base, 0.2) + for sg in sig: + if rng.random() < 0.5: + r[sg] = Fr(rng.choice([-1, 1, 2])) + A.append(r) + T = [rand_row(rng, base, 0.4) for _ in range(rng.randint(1, b // 2 + 1))] + # substitution sigma_m -> c_m; chained: c_m may itself be a target or an earlier sigma's content + sub = {} + for i, sg in enumerate(sig): + mode = rng.random() + if mode < 0.4 and T: + c = dict(rng.choice(T)) + elif mode < 0.6 and i: + c = dict(sub[sig[rng.randrange(i)]]) + for k, v in rand_row(rng, base, 0.1).items(): + c[k] = c.get(k, 0) + v + else: + c = rand_row(rng, base, 0.3) + sub[sg] = c + + def pi(r): + out = {} + for k, v in r.items(): + for kk, vv in (sub[k].items() if k in sub else [(k, Fr(1))]): + out[kk] = out.get(kk, 0) + v * vv + return {k: v for k, v in out.items() if v} + D0 = rank(A + T) - rank(A) + PA = [pi(r) for r in A] + D = rank(PA + T) - rank(PA) + if D < D0 - s: + raise SystemExit('FAIL carried-row law: D=%d D0=%d s=%d' % (D, D0, s)) + trials += 1 + attained += (s > 0 and D == D0 - s) + ctl += (D < D0 - s + 1) + expect('random worlds checked', trials, 3000) + say('ok bound attained with s > 0 on %d worlds' % attained) + if attained == 0 or ctl == 0: + raise SystemExit('FAIL control: bound never tight') + say('ok control: D >= D0 - s + 1 is violated on %d worlds' % ctl) + + +# ---------------------------------------------------------------------------------------------- law 3 +class Alg: + def __init__(self, G): + self.G = G + self.n = len(G) + self.c = {} + + def zdim(self, A): # dim{k in ker G : k_A = 0} + A = frozenset(A) + if A not in self.c: + C = [i for i in range(self.n) if i not in A] + rk = rank([{j: self.G[i][c] for j, c in enumerate(C) if self.G[i][c]} for i in range(self.n)]) if C else 0 + self.c[A] = len(C) - rk + return self.c[A] + + def Dj(self, S, fwd): + return self.zdim(fwd) - self.zdim(set(fwd) | set(S)) + + def chain(self, seq): + out, done = [], set() + for S in seq: + out.append(self.Dj(S, done)) + done |= set(S) + return out + + def flat(self, seq): + out = [self.Dj(S, ()) for S in seq[:-1]] + prev = set().union(*map(set, seq[:-1])) if len(seq) > 1 else set() + return out + [self.Dj(seq[-1], prev)] + + +def ordered_partitions(xs): + xs = list(xs) + if not xs: + yield [] + return + for k in range(1, len(xs) + 1): + for first in itertools.combinations(xs, k): + rest = [x for x in xs if x not in first] + for p in ordered_partitions(rest): + yield [first] + p + + +def toyG(m): + pairs = list(itertools.combinations(range(m + 1), 2)) + roots = [[(1 if k == i else -1 if k == j else 0) for k in range(m + 1)] for i, j in pairs] + return [[sum(a * b for a, b in zip(r, s)) for s in roots] for r in roots] + + +def hubs(): + say('== law 3: hub additivity') + for m in (3, 4): + G = toyG(m) + A = Alg(G) + n = len(G) + dK = A.zdim(()) + expect('A%d dim K' % m, dK, n - m) + if m == 3: + seqs = list(ordered_partitions(range(n))) + else: + rng = random.Random(7) + seqs = [] + for _ in range(4000): + k = rng.randint(2, 5) + lab = [rng.randrange(k) for _ in range(n)] + seq = [tuple(i for i in range(n) if lab[i] == j) for j in range(k)] + seqs.append([s for s in seq if s]) + nested = sum(sum(A.chain(s)) == dK for s in seqs) + fl = [sum(A.flat(s)) for s in seqs] + expect('A%d nested sum D_j = dim K on all %d sequences' % (m, len(seqs)), nested, len(seqs)) + expect('A%d no-forwarding sum D_j >= dim K' % m, min(fl) >= dK, True) + say(' A%d no-forwarding sums in [%d, %d]' % (m, min(fl), max(fl))) + # E8 / P104 + raw = open(os.path.join(ROOT, PR968), 'rb').read() + expect('SHA256 of %s' % PR968, hashlib.sha256(raw).hexdigest(), PR968_SHA256) + L = raw.decode().split('\n') + Dr = [[int(x) for x in l[3:].split()] for l in L if l.startswith(' d:')] + Tr = [[int(x) for x in l[3:].split()] for l in L if l.startswith(' t:')] + n = len(Dr[0]) + G = [[sum(Dr[k][i] * Tr[k][j] for k in range(8)) // 2 for j in range(n)] for i in range(n)] + A = Alg(G) + dK = A.zdim(()) + expect('E8/P104 dim K', dK, 96) + # label pairing: S(i,j) = 1 iff even; its F2 row space = the label functionals + rows = [sum(1 << j for j in range(n) if G[i][j] % 2 == 0) for i in range(n)] + basis = [] + for r in rows: + for bb in basis: + r = min(r, r ^ bb) + if r: + basis.append(r) + expect('F2 rank of the label pairing on the 104 ports', len(basis), 9) + full = (1 << n) - 1 + hubsets = set() + for c in range(1, 1 << len(basis)): + f = 0 + for i, bb in enumerate(basis): + if c >> i & 1: + f ^= bb + zero = full & ~f + if 0 < bin(zero).count('1') < n: + hubsets.add(zero) + H = [[i for i in range(n) if z >> i & 1] for z in sorted(hubsets)] + expect('hyperplane hubs, sizes', (len(H), sorted({len(S) for S in H})), (510, [44, 48, 52, 56, 60])) + d1 = [A.Dj(S, ()) for S in H] + dv = [A.zdim(S) for S in H] + expect('nested two-hub D1 + D_V = 96 on all hubs', sum(x + y == dK for x, y in zip(d1, dv)), len(H)) + say('ok D1 in [%d, %d], D_V in [%d, %d]' % (min(d1), max(d1), min(dv), max(dv))) + if min(dv) >= dK: + raise SystemExit('FAIL control') + say('ok control: counting the last hub alone gives as little as %d < 96' % min(dv)) + rng = random.Random(11) + ex = [] + for _ in range(300): + S1, S2 = rng.sample(H, 2) + S2 = [p for p in S2 if p not in S1] + rest = [p for p in range(n) if p not in S1 and p not in S2] + seq = [s for s in (tuple(S1), tuple(S2), tuple(rest)) if s] + ex.append(sum(A.flat(seq)) - dK) + expect('non-nested hyperplane pairs + V: excess over 96 >= 0', min(ex) >= 0, True) + say(' excess in [%d, %d]' % (min(ex), max(ex))) + seq = [(p,) for p in range(n)] + expect('one hub per port, nested', sum(A.chain(seq)), 96) + expect('one hub per port, no forwarding', sum(A.flat(seq)), 103) + + +if __name__ == '__main__': + carried_row() + hubs() + say('PASS_T1_KERNEL_BILLS') diff --git a/research/p104-t-minus-one-laws/odd_unit.py b/research/p104-t-minus-one-laws/odd_unit.py new file mode 100644 index 0000000000..34e59a87d4 --- /dev/null +++ b/research/p104-t-minus-one-laws/odd_unit.py @@ -0,0 +1,212 @@ +"""P104 t = -1 law 4: the per-J odd unit of the t = -1 native and why gauge, automorphism and finite order do not +remove it. Standard library only; exact arithmetic in F_p, p = 2147483629 (p = 1 mod 4), with i = sqrt(-1). + +Laurent matrices in q are evaluated at q = chi; sigma: q -> -q. o(N) = rank(sigma(N) N^-1 - I), evaluated at the +two sigma-pairs (chi, -chi) = (i, -i) and (1, -1). (o = rank of the q-odd part, see #7555 law 4.) + +Checked: + (a) H = [[1,-q],[q^-1,0]] specialises to M = [[1,-1],[1,0]] at q = 1; o(H^n), n = 1..6, = 2,2,0,2,2,0; + H^3 = -I, H^6 = I; SW = J L_q (J = [[0,-1],[1,0]], L_q = [[1,0],[-q^-1,1]]) has o = 1, so the t = -1 native + carries o(H) - o(SW) = 1 more odd unit per J: 17 per port per word, an integer (not mod 2) deficit; + (b) the three-register lift on (X, Y, Z = X - qY): X' = Z, Y' = q^-1 X, Z' = -qY reproduces H on (X, Y), keeps + Z = X - qY, is monomial with o = 2 and cube -I; in the gauge frame Y'' = qY it is the q-free signed 3-cycle + (o = 0), and the gauge diag(1, q) itself has o = 1, while a q-free transvection conjugated by it has o = 1; + (c) sigma-fixed global automorphisms (entries a + b q^2): o(U N U^-1) = o(N) on 200 random U for N in + {H, H^2, SW, L_q, random Laurent 3x3}; control: a non-sigma-fixed U changes o; + (d) the gauge-shift ledger: (m - 16) + (36 - m) = 20 for every m = 0..36 (word part from Lemma E of #7555, boundary + part = odd rank of the gauge diag(q^-g)), against 3 for the unshifted design. +Prints PASS_T1_ODD_UNIT.""" +import random + +P = 2147483629 +IM = next(pow(g, (P - 1) // 4, P) for g in range(2, 99) if pow(g, (P - 1) // 2, P) == P - 1) +assert IM * IM % P == P - 1 + + +def say(s): + print(s, flush=True) + + +def expect(name, got, want): + if got != want: + raise SystemExit('FAIL %s: got %r want %r' % (name, got, want)) + say('ok %s: %r' % (name, got)) + + +def inv(a): + return pow(a % P, P - 2, P) + + +def ev(A, chi): # A: matrix of {exp: coef} + return [[sum(c * pow(chi, e % (P - 1), P) for e, c in x.items()) % P for x in r] for r in A] + + +def mmul(A, B): + return [[sum(A[i][k] * B[k][j] for k in range(len(B))) % P for j in range(len(B[0]))] for i in range(len(A))] + + +def rank(A): + M = [r[:] for r in A] + rk = 0 + for c in range(len(M[0])): + p = next((r for r in range(rk, len(M)) if M[r][c]), None) + if p is None: + continue + M[rk], M[p] = M[p], M[rk] + iv = inv(M[rk][c]) + for r in range(len(M)): + if r != rk and M[r][c]: + f = M[r][c] * iv % P + M[r] = [(a - f * b) % P for a, b in zip(M[r], M[rk])] + rk += 1 + return rk + + +def minv(A): + n = len(A) + M = [list(A[i]) + [int(i == j) for j in range(n)] for i in range(n)] + for c in range(n): + p = next(r for r in range(c, n) if M[r][c]) + M[c], M[p] = M[p], M[c] + iv = inv(M[c][c]) + M[c] = [x * iv % P for x in M[c]] + for r in range(n): + if r != c and M[r][c]: + f = M[r][c] + M[r] = [(a - f * b) % P for a, b in zip(M[r], M[c])] + return [r[n:] for r in M] + + +def o_at(A, chi): + n = len(A) + S = mmul(ev(A, (-chi) % P), minv(ev(A, chi))) + return rank([[(S[i][j] - (i == j)) % P for j in range(n)] for i in range(n)]) + + +def o_of(A): + a, b = o_at(A, IM), o_at(A, 1) + if a != b: + raise SystemExit('FAIL o differs between sigma pairs') + return a + + +def lmul(A, B): # Laurent matrix product + n, m, k = len(A), len(B[0]), len(B) + out = [[{} for _ in range(m)] for _ in range(n)] + for i in range(n): + for j in range(m): + d = {} + for t in range(k): + for e1, c1 in A[i][t].items(): + for e2, c2 in B[t][j].items(): + d[e1 + e2] = (d.get(e1 + e2, 0) + c1 * c2) % P + out[i][j] = {e: c for e, c in d.items() if c} + return out + + +def lconst(n, s=1): + return [[({0: s % P} if i == j else {}) for j in range(n)] for i in range(n)] + + +def leq(A, B): + return all(A[i][j] == B[i][j] for i in range(len(A)) for j in range(len(A[0]))) + + +def mono(c, e): + return {e: c % P} + + +H = [[mono(1, 0), mono(-1, 1)], [mono(1, -1), {}]] +J = [[{}, mono(-1, 0)], [mono(1, 0), {}]] +Lq = [[mono(1, 0), {}], [mono(-1, -1), mono(1, 0)]] +SW = lmul(J, Lq) + + +def section_a(): + say('== (a) the t = -1 native and its per-J odd unit') + expect('H at q = 1 is M = [[1,-1],[1,0]]', ev(H, 1), [[1, P - 1], [1, 0]]) + pw = lconst(2) + os_ = [] + for k in range(1, 7): + pw = lmul(pw, H) + os_.append(o_of(pw)) + if k == 3: + expect('H^3 = -I', leq(pw, lconst(2, -1)), True) + expect('H^6 = I', leq(pw, lconst(2)), True) + expect('o(H^n), n = 1..6', os_, [2, 2, 0, 2, 2, 0]) + expect('o(SW = J L_q), o(L_q), o(J)', (o_of(SW), o_of(Lq), o_of(J)), (1, 1, 0)) + expect('odd units per port per word, 17 J: H minus SW', 17 * (o_of(H) - o_of(SW)), 17) + + +def section_b(): + say('== (b) the three-register lift and the gauge frame') + lift = [[{}, {}, mono(1, 0)], [mono(1, -1), {}, {}], [{}, mono(-1, 1), {}]] # rows: X', Y', Z' over (X,Y,Z) + emb = [[mono(1, 0), {}], [{}, mono(1, 0)], [mono(1, 0), mono(-1, 1)]] # (X, Y) -> (X, Y, X - qY) + expect('lift . embed = embed . H (lift reproduces H and keeps Z = X - qY)', leq(lmul(lift, emb), lmul(emb, H)), True) + l3 = lmul(lmul(lift, lift), lift) + expect('lift^3 = -I', leq(l3, lconst(3, -1)), True) + expect('o(lift)', o_of(lift), 2) + D = [[mono(1, 0), {}, {}], [{}, mono(1, 1), {}], [{}, {}, mono(1, 0)]] # gauge Y'' = qY + Di = [[mono(1, 0), {}, {}], [{}, mono(1, -1), {}], [{}, {}, mono(1, 0)]] + g = lmul(lmul(D, lift), Di) + expect('gauge frame: lift is q-free', all(set(x) <= {0} for r in g for x in r), True) + expect('o(gauged lift)', o_of(g), 0) + D2 = [[mono(1, 0), {}], [{}, mono(1, 1)]] + D2i = [[mono(1, 0), {}], [{}, mono(1, -1)]] + T = [[mono(1, 0), mono(1, 0)], [{}, mono(1, 0)]] # q-free transvection X += Y + expect('o(gauge diag(1,q)), o(T), o(D T D^-1)', (o_of(D2), o_of(T), o_of(lmul(lmul(D2, T), D2i))), (1, 0, 1)) + + +def section_c(): + say('== (c) sigma-fixed global automorphisms preserve o') + rng = random.Random(5) + + def rl(n, odd=False): + while True: + A = [[{e: rng.randrange(P) for e in ((0, 2) if not odd else (0, 1, 2))} for _ in range(n)] for _ in range(n)] + if rank(ev(A, IM)) == n and rank(ev(A, 1)) == n and rank(ev(A, (-IM) % P)) == n and rank(ev(A, P - 1)) == n: + return A + + def linv_ev(U, chi): + return minv(ev(U, chi)) + + def o_conj(U, N, chi): + n = len(N) + a = mmul(mmul(ev(U, chi), ev(N, chi)), linv_ev(U, chi)) + b = mmul(mmul(ev(U, (-chi) % P), ev(N, (-chi) % P)), linv_ev(U, (-chi) % P)) + S = mmul(b, minv(a)) + return rank([[(S[i][j] - (i == j)) % P for j in range(n)] for i in range(n)]) + R3 = rl(3, odd=True) + cases = [('H', H), ('H^2', lmul(H, H)), ('SW', SW), ('L_q', Lq), ('random 3x3', R3)] + ok = 0 + for name, N in cases: + base = o_of(N) + for _ in range(40): + U = rl(len(N)) + for chi in (IM, 1): + if o_conj(U, N, chi) != base: + raise SystemExit('FAIL invariance %s' % name) + ok += 1 + expect('sigma-fixed conjugations checked (5 natives x 40 U, both sigma pairs)', ok, 200) + ch = 0 + for _ in range(20): + U = rl(2, odd=True) + ch += o_conj(U, lmul(H, H), IM) != o_of(lmul(H, H)) or o_conj(U, SW, IM) != o_of(SW) + if ch == 0: + raise SystemExit('FAIL control: non-sigma-fixed U never changes o') + say('ok control: non-sigma-fixed U changes o on %d/20 trials' % ch) + + +def section_d(): + say('== (d) gauge-shift ledger') + tot = {(m - 16) + (36 - m) for m in range(37)} + expect('word (m - 16) + boundary (36 - m) over m = 0..36', tot, {20}) + expect('unshifted design odd ops per port per word (37 - 34)', 37 - 17 * o_of(H), 3) + + +if __name__ == '__main__': + section_a() + section_b() + section_c() + section_d() + say('PASS_T1_ODD_UNIT') From 31842e1de2004fb9a339c16a8ca6333a5339e13b Mon Sep 17 00:00:00 2001 From: DreamingOfClouds Date: Fri, 13 Nov 2026 19:29:54 -0600 Subject: [PATCH 4/4] Retract law 5's "neutral period" premise; add addendum and E8 counterexample checker Lemma A as worded ("a y-atom leaves Y_q only during Y_q's neutral period or through an owned copy") is false on E8/P104: a sigma-anchor design whose every Y_t first takes -Z_ts x_s from a pure X_s, then is snapshotted and parked, has 0 neutral columns and 0 owned units yet D = 7 (literal bound 96). counterexample.py reproduces this exactly (standard library, cross-validated against a full register simulation, with controls). ADDENDUM.md states the retraction, the corrected premise, what is proved (D >= (n - r) - dim Q_V for all programs; Lemma P in the park family) and what stays open. Laws 1-4 are unaffected; no kappa claim. Co-Authored-By: Claude Opus 5.5 --- research/p104-t-minus-one-laws/ADDENDUM.md | 130 ++++++ research/p104-t-minus-one-laws/PROOF.md | 36 +- research/p104-t-minus-one-laws/README.md | 75 ++-- research/p104-t-minus-one-laws/VERIFY.json | 10 + .../p104-t-minus-one-laws/counterexample.py | 376 ++++++++++++++++++ 5 files changed, 591 insertions(+), 36 deletions(-) create mode 100644 research/p104-t-minus-one-laws/ADDENDUM.md create mode 100644 research/p104-t-minus-one-laws/counterexample.py diff --git a/research/p104-t-minus-one-laws/ADDENDUM.md b/research/p104-t-minus-one-laws/ADDENDUM.md new file mode 100644 index 0000000000..85eddf69f6 --- /dev/null +++ b/research/p104-t-minus-one-laws/ADDENDUM.md @@ -0,0 +1,130 @@ +# Addendum (Nov 13): retraction of premise PA's "neutral period" wording and of law 5 as stated + +No κ impact. No priced word changes. Laws 1–4 are unaffected. + +## Retraction + +The following statement in PROOF.md (premise PA, Lemma A) and README.md §5 is **retracted**: + +> A y-atom of column q leaves Y_q only during Y_q's neutral period or through an owned copy. + +Here "neutral" meant: Y_q holds no public x-charge (and no charged token) when its atom leaves. Read that way, it is +**false on E8/P104**. So law 5 as stated is **withdrawn**: + +> D ≥ dim{k ∈ ker G : k_N = 0} ≥ n − r − N_neutral − N_owned, with N_neutral the columns whose atom leaves during +> Y's neutral period. + +This includes the headline "96 per call on E8/P104 when N_neutral = 0". The corrected, narrower statement below +replaces it. + +## The counterexample [C, frame legality P-cond] + +**Design ("wasted line contamination").** Start from the σ-anchor schedule. There is one early cell (σ(t), t) per +column on a perfect partner matching σ, and every other cell is settled. Then change one thing per column t: + +1. Y_t visits the line ⟨q_s⟩ of a partner s = s(t) ≠ σ(t). There it takes −Z_ts·x_s from a **pure** X_s, + through a two-read window. +2. Y_t moves to F_t = ⟨q_s, q_σ(t)⟩ ⊆ q_t^⊥. There it is snapshotted, O_t := Y_t = y_t − Z_ts·x_s (an owned + COPY, unmoved and free), and parked (Y_t −= O_t). +3. The early relay re-adds O_t. Everything else is the anchor design. + +Every column's atom leaves while Y_t holds public x-charge, so N_neutral = 0. No owned register moves, so there are +0 owned units and N_owned = 0. The literal bound is therefore n − r = **96**. + +**Numbers (E8/P104, Gram from the pinned PR968 file).** Every one of the 104 columns is contaminated: + +| contamination map s(t) | distinct sources | D | literal bound | +|---|---|---|---| +| seeded greedy-few map (seed 0) | 7 | **7** | 96 | +| seeded greedy-few map (seed 29) | 9 | 9 | 96 | +| deterministic greedy cover | 5 | 5 | 96 | +| control: s(t) = σ(t) | – | 96 | 96 | +| control: injective second matching | 104 | 96 | 96 | +| clean σ anchors (no contamination) | 0 | 0 | 0 | + +**Mechanism.** Contamination is charged per distinct *source*, not per column. Empirically D ≤ ρ_K(sources), +where ρ_K(S) = rank of K = ker G restricted to S. This holds on every design run here and on 92/92 author runs on +A3/A4/E8. It is not proved, and equality fails on some designs. + +**Reproduce.** + +```sh +python3.12 -I -B research/p104-t-minus-one-laws/counterexample.py # prints PASS_T1_COUNTEREXAMPLE (~11 s) +``` + +This is standard library only and exact over Q. It computes D in two ways: + +- by the exact witness formula of law 1, extended to contaminated snapshots; +- by a full frame-free simulation with every register written out, where D = rank(arrivals + targets) − + rank(arrivals) and Y is exact. + +The two agree on 54 random A3/A4 designs (clean, x-contaminated and co-read). The E8 rows above are then computed +with the formula, and the clean-anchor value D = 0 agrees with law 1. + +**Scope of the counterexample.** The algebra is exact. Frame legality is P-cond: + +- **Order.** Relays lump at {0}. Every Y_t then visits its source line while all X are still pure. Next the X's + read relays at their lines. Snapshot, park and early re-add follow at the 2-dimensional frames F_t. +- **Frames.** q_s, q_σ(t) ⊥ q_t, so the frames nest. +- **The unbuilt part.** The L side is the same unbuilt network that the clean anchor design needs: all L charge + arrives after the anchor, here at frames ⊇ F_t. + +**Price.** None. The park erases the pre-park delivery (Lemma P below), so every column must deliver cell (t, s) +again (+104 reads). D ≥ 0 is the clean design's value, so the design is strictly dominated by the clean anchor +design. The co-read variant (strip x_s from O_t by co-reading the pure X_s) gives D = 0, and it is only a deferral +of that same cell. + +## Corrected statement + +> **PA (corrected).** A y-atom of column q is a frame-local time difference of Y_q (G4) or an owned unit. In the park +> family F1, every L-cell counted in Y_q^final is delivered after the park snapshot, at frames ⊇ the export frame +> (Lemma P). + +Drop "during Y_q's neutral period". As an x-neutrality statement it is false. + +## What is proved + +The proofs below are in the author's notes. They are summarised here; the package does not machine-check them. + +- **G1, all programs [P].** Take any linear program in the σ-world of law 2. Let Q_V be the y-classes, mod + range G, of token-free combinations of arrivals at V. Then **D ≥ (n − r) − dim Q_V**. + - *Proof sketch.* Witnesses (0 on x, k ∈ K on y, θ on tokens) kill U. A subspace computation gives + proj_K(A^⊥) = (A ∩ K*)^⊥, and here A ∩ K* = Q_V. + - Law 5's inequality is therefore exactly G1 plus PA_gen: Q_V ⊆ span{e_q : q ∈ N}. +- **G2/G3 (Q-ledger) [P].** These steps never change Q: + - public ADD, SCALE and MOVE; + - owned deposits that are token-free with zero y-class: U, L, the gauge J ∈ range G·y, and x-only rows. + + Each other owned add changes dim Q by at most 1. So atom scarcity is created only by owned parks, and + (n − r) − dim Q_V ≤ #(owned adds that are not Π-null). +- **G4 (restorer locality) [P].** A class restored by an unmoved owned row at frame F is a time difference + Σ c_i (R_i(τ₁) − R_i(τ_i)) of public contents at F. Receipts that are x-only and token-free are invisible to it. + That is why x-neutrality is the wrong hypothesis. +- **Lemma P, park family F1 [P].** In F1, y_t leaves Y_t by an own-snapshot park: O = Y_t(τ₀) at frame F, then + Y_t −= O at τ₁ ≥ τ₀ with Y_t still at F. Then Y_t^final = the deliveries after τ₀. + - Every L-cell counted in Y_t^final, and the L deposit, arrives after τ₀ at frames ⊇ F. + - F is the last frame at which Y_t holds y_t. + - So the **48-L-cells-per-exporting-column bill (4,608 on E8 for 96 columns) holds in F1 with no neutrality + hypothesis**. + - F1 covers the anchor-style designs that zero Y by parking, and it covers the counterexample. +- **Exchange lemma [P].** Co-reading an unchanged source to strip a pre-export delivery is a deferral: the same + cell can be delivered after the export with one read fewer. + +## What remains open + +- **PA_gen outside F1.** These are programs that remove y_t from Y_t by tokened public routes, by the J gauge or + by carrier preloads, instead of a park. A pre-export delivery is not erased there. The missing step is to bound + how many G4 time differences can carry distinct column classes without the relay structure. +- **The contamination law D ≤ ρ_K(sources).** It is empirical (92/92) and unproved. +- **Law 3's below-re-add-frame case.** It was conditional on Lemma A. It is now conditional on the corrected PA + (G1 + PA_gen) and is unchanged otherwise. + +## Consequence + +- **Law 5 is withdrawn in its original form.** The 96-per-call figure for N_neutral = 0 does not hold for + arbitrary programs. It fails on E8 in the anchor-design model. +- **The corrected conditional form replaces it.** D ≥ (n − r) − dim Q_V holds for all programs. Law 5's + inequality holds under PA_gen. In the park family the L-side bill holds unconditionally. +- **Laws 1–4 are unaffected.** That covers the charge law and corrected anchored law, the carried-row law, hub + additivity and the per-J odd unit. +- **No κ claim** was made or changed. The frontier is untouched. diff --git a/research/p104-t-minus-one-laws/PROOF.md b/research/p104-t-minus-one-laws/PROOF.md index 4058536c07..c8a47b49cc 100644 --- a/research/p104-t-minus-one-laws/PROOF.md +++ b/research/p104-t-minus-one-laws/PROOF.md @@ -58,7 +58,7 @@ hub gives dim K − ρ(S_{ ~~**Premise PA (Lemma A).** There is a set N of columns, |N| = N_neutral + N_owned, such that every cell charge +> φ_pu lies in span({e_u} ∪ {e_q : q ∈ N}), with φ_pu = e_u unless u ∈ N. (A y-atom of column q leaves Y_q only +> during Y_q's neutral period or through an owned copy.)~~ + +**Corrected premise (replaces it).** A y-atom of column q is a frame-local time difference of Y_q, or an owned unit. +In the park family F1, every L-cell counted in Y_q^final is delivered after the park snapshot, at frames ⊇ the export +frame (Lemma P). For all programs D ≥ (n − r) − dim Q_V, where Q_V is the y-classes of token-free arrival +combinations at V (G1). The inequality below holds under PA_gen: Q_V ⊆ span{e_q : q ∈ N}. Statements, proof +sketches and the open cases are in ADDENDUM.md. + +**Theorem [P under PA_gen; the algebra below is unchanged].** Row p of the arrival map is +(G/2)_{p,N^c} k_{N^c} + F_p·k_N with F arbitrary. For k ∈ K with k_N = 0 this is (Gk/2)_p = 0, so f_k kills every +arrival, while f_k(τ_{X_p}) = −k_p. Hence D ≥ dim{k ∈ K : k_N = 0} ≥ dim K − |N|. ∎ What fails is the identification +of N with the x-neutral columns; the 96-per-call reading for N_neutral = 0 is withdrawn. **Cell form [P].** Z^E K = Σ_u v_u K_uᵀ over the columns u that hold early cells, a sum of rank-one terms, so -rank(Z^E K) ≤ #(such columns) and D ≥ n − r − #(columns): atoms count columns, never cells. +rank(Z^E K) ≤ #(such columns) and D ≥ n − r − #(columns): atoms count columns, never cells. (This concerns clean +early cells; contaminated snapshots are charged per distinct source, see ADDENDUM.md.) -**Status.** PA is not proved for arbitrary programs. A general proof needs a content-class invariant for public -ADD sequences that forces the partner/diagonal structure; that step is open. +**Status.** PA_gen is proved in the park family F1 (Lemma P) for the L-side bill. It is open for programs that remove +y_t from Y_t by tokened public routes, the J gauge or carrier preloads. The empirical law D ≤ ρ_K(sources) is +unproved. diff --git a/research/p104-t-minus-one-laws/README.md b/research/p104-t-minus-one-laws/README.md index 84ec505329..90c7cb8e15 100644 --- a/research/p104-t-minus-one-laws/README.md +++ b/research/p104-t-minus-one-laws/README.md @@ -6,6 +6,12 @@ a standard-library checker. It makes no κ claim and builds no word. The E8/P104 numbers use the Gram matrix of the 104 live lines, computed as D Tᵀ/2 from the pinned PR968 decoder file. Proofs and premises are in [PROOF.md](PROOF.md). +> **Retraction (Nov 13).** Law 5 as originally stated, and the "neutral period" +> wording of its premise (Lemma A), are retracted: they fail on E8/P104 +> (D = 7 with 0 neutral and 0 owned columns, against a literal bound of 96). A +> corrected conditional form replaces them. Laws 1–4 are unaffected, and no κ +> or price changes. See [ADDENDUM.md](ADDENDUM.md) and `counterexample.py`. + The σ-rank o(N) = rank(σ(N)N⁻¹ − I), the identity o = rank(q-odd part), Lemma E and the hub bound are in [#7555](https://github.com/CrocSwap/integer-mult-bounds/pull/7555) (law 4 there). They are cited here, not repeated. @@ -88,7 +94,8 @@ finals forwarded to hub j} and D_j = rank(K_j|S_j). - One hub per port gives 96 nested and 103 unforwarded. - **Scope.** The per-hub bound D_j ≥ rank(K_j|S_j) uses the same arrival formula as law 5, so for hubs below the relay re-add frames it is [cond] on - Lemma A. + the corrected premise PA_gen ([ADDENDUM.md](ADDENDUM.md)); the retracted + "neutral period" wording is not used. ## 4. The per-J odd unit (`odd_unit.py`) @@ -116,25 +123,36 @@ parity. child-size σ-odd transforms. The total is ≥ 20 per port per word for every m, against 3 for the unshifted design. -## 5. Y-atom conservation [cond: Lemma A] - -**Statement.** D ≥ dim{k ∈ ker G : k_N = 0} ≥ n − r − N_neutral − N_owned, -where N is the set of atom columns: columns whose y-atom leaves during Y's -neutral period, or through an owned copy. - -- **Status.** The inequality is [P] given premise PA (Lemma A), and PA is open. - Combined with law 2, it gives owned cost ≥ n − r − N_neutral for the relay - family. That is **96 per call on E8/P104 when N_neutral = 0**. -- **Checks.** - - [C] dim{k ∈ ker G : k_N = 0} ≥ n − r − |N| for every column set N at A3 (64) - and A4 (1,024). The bound is tight at every |N|. - - Not every set of n − r columns spans (4 sets at A3, 85 at A4). - - The exhaustive 2²⁴ cell-assignment run on A3 is not packaged. Its bound - follows from the rank inequality rank(Z^E K) ≤ #(columns with early cells) - in PROOF.md. -- **Scope.** Lemma A is supported only by author runs on A3/A4/D4 relay and - engine families, which are not packaged here. It is not proved for arbitrary - programs. +## 5. Y-atom conservation — original form RETRACTED, see [ADDENDUM.md](ADDENDUM.md) + +**Retracted statement (kept for the record).** + +> ~~D ≥ dim{k ∈ ker G : k_N = 0} ≥ n − r − N_neutral − N_owned, where N is the +> set of atom columns: columns whose y-atom leaves during Y's neutral period, or +> through an owned copy. … That is 96 per call on E8/P104 when N_neutral = 0.~~ + +- **Why [C].** On E8/P104, there is a σ-anchor design in which every Y_t first + takes −Z_ts·x_s from a pure X_s at that partner's line and is then + snapshotted and parked. It has 0 neutral columns and 0 owned units, and + D = 7, against the literal bound 96. Sources concentrated on 5 or 9 partners + give D = 5 and D = 9. `counterexample.py` reproduces this exactly. Frame + legality is conditional on the same unbuilt L side as the clean anchor + design. There is no κ or price impact. +- **What replaces it.** + - For all programs, D ≥ (n − r) − dim Q_V, where Q_V is the y-classes of + token-free arrival combinations at V [P]. + - The law-5 inequality D ≥ dim{k ∈ K : k_N = 0} holds under PA_gen: + Q_V ⊆ span{e_q : q ∈ N}. + - In the park family, every L-cell counted in Y_q^final arrives after the park + snapshot at frames ⊇ the export frame (Lemma P). So the 48-L-cells-per- + column bill holds there without any neutrality hypothesis [P]. +- **Open.** + - Tokened public removal, J gauge and carrier preloads, all outside the park + family. + - The empirical contamination law D ≤ ρ_K(sources), unproved. +- **Still checked [C].** dim{k ∈ ker G : k_N = 0} ≥ n − r − |N| for every column + set N at A3 (64) and A4 (1,024), tight at every |N|. This is a statement + about K, not about which columns are atoms. ## Checks @@ -142,8 +160,9 @@ neutral period, or through an owned copy. python3.12 -B scripts/research_package.py --package research/p104-t-minus-one-laws ``` -There are three commands, listed in [VERIFY.json](VERIFY.json), and all of -them use the standard library only. +There are four commands, listed in [VERIFY.json](VERIFY.json), and all of +them use the standard library only. The fourth, `counterexample.py`, reproduces +the law-5 retraction ([ADDENDUM.md](ADDENDUM.md)). - Each prints the numbers it reproduces, asserts them, and runs a control that must fail. - The PR968 input is authenticated by SHA256. @@ -158,13 +177,19 @@ them use the standard library only. check. - Law 4's boundary count depends on its stated premise. The 17 stages, 36 roles and 96/104 ports enter as parameters of #7113's caller. -- Lemma A is open, so law 5 and the below-re-add-frame case of law 3 are - conditional. +- **Law 5 as originally stated is retracted** ([ADDENDUM.md](ADDENDUM.md)): + the "neutral period" wording of Lemma A is false on E8 (D = 7 with 0 neutral + and 0 owned columns, literal bound 96). The corrected premise PA_gen is + proved in the park family and is open outside it. The below-re-add-frame case + of law 3 is conditional on PA_gen. +- The contamination law D ≤ ρ_K(sources) is empirical. - No human has reviewed the package. ## Open next questions -- **Lemma A.** Is PA true for arbitrary legal programs? +- **PA_gen.** Does Q_V ⊆ span{e_q : q ∈ N} hold for programs that remove y_t + without a park (tokened public routes, J gauge, carrier preloads)? +- **Contamination law.** Prove D ≤ ρ_K(sources) for contaminated anchors. - **The Y-prefix L side.** Can the σ-anchor schedule's L-side network be built at public cost below the U-side relay floor? diff --git a/research/p104-t-minus-one-laws/VERIFY.json b/research/p104-t-minus-one-laws/VERIFY.json index eafa342c18..9b0802fdf4 100644 --- a/research/p104-t-minus-one-laws/VERIFY.json +++ b/research/p104-t-minus-one-laws/VERIFY.json @@ -36,6 +36,16 @@ ], "timeout_seconds": 60, "checks": "Law 4. Exact F_p (p = 2147483629, i = sqrt(-1)): H specialises to M; o(H^n) = 2,2,0,2,2,0, H^3 = -I, H^6 = I; o(SW) = 1 so 17 odd units per port per word; three-register lift reproduces H, cube -I, o = 2, q-free (o = 0) only in the gauge frame whose gauge has o = 1; o invariant under 200 sigma-fixed conjugations, control non-sigma-fixed changes it; gauge ledger total 20 for every m. Prints PASS_T1_ODD_UNIT." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/counterexample.py" + ], + "timeout_seconds": 180, + "checks": "Law 5 retraction (ADDENDUM.md). The witness formula for sigma-anchor designs with x-contaminated snapshots equals a full frame-free register simulation (Y exact) on 54 random A3/A4 designs (clean / x-contaminated / co-read). E8/P104 from the pinned PR968 file: settled D = 96, clean sigma anchors D = 0; every one of the 104 columns contaminated by a pure x_s from a partner s != sigma(t) (N_neutral = 0, 0 owned units, literal bound 96): seeded greedy-few maps give D = 7 (7 sources) and D = 9 (9 sources), a deterministic greedy cover gives D = 5 (5 sources); D <= rho_K(sources) on each. Controls: contamination by the sigma cell itself D = 96, by an injective second matching D = 96. Prints PASS_T1_COUNTEREXAMPLE." } ] } diff --git a/research/p104-t-minus-one-laws/counterexample.py b/research/p104-t-minus-one-laws/counterexample.py new file mode 100644 index 0000000000..ab33bf28f4 --- /dev/null +++ b/research/p104-t-minus-one-laws/counterexample.py @@ -0,0 +1,376 @@ +"""P104 t = -1: counterexample to the literal "neutral period" wording of premise PA (Lemma A, law 5). + +Standard library only, exact rational arithmetic. See ADDENDUM.md. + +Design ("wasted line contamination" on the sigma-anchor schedule). One early cell (sigma(t), t) per column on a +perfect partner matching sigma; every other cell settled. Change one thing per column t: before its snapshot, Y_t +visits the line of a partner source s(t) != sigma(t) and takes -Z_ts x_s from a PURE X_s (through a two-read window +W_ts). Y_t is then snapshotted, O_t = Y_t = y_t - Z_ts x_s (owned COPY, unmoved, free), and parked (Y_t -= O_t); +the early relay re-adds O_t. So every column's atom leaves while Y_t holds public x-charge: N_neutral = 0. No owned +register is moved: N_owned = 0 owned units. The literal law-5 bound is then D >= n - r = 96 on E8/P104. + +Checked: + (a) the witness formula D(sigma, s) (exact, over Q) equals the full frame-free simulation (all registers + written out, D = rank(arrivals + targets) - rank(arrivals), Y exact) on random A3/A4 designs in the + modes clean / x-contaminated / co-read; + (b) E8/P104 (Gram from the pinned PR968 file): settled D = 96, clean sigma anchors D = 0 (agrees with law 1's + corrected_law), and the contaminated design with every one of the 104 columns contaminated by sources + concentrated on few partners gives D = 7 (7 sources, seeded greedy map), D = 9 (9 sources) and D = 5 + (5 sources, deterministic greedy cover), all < 96: the literal bound fails; + (c) controls: contamination by the sigma cell itself (s(t) = sigma(t)) gives D = 96, and contamination + through an injective second matching gives D = 96 (contamination is not harmless in general; it is charged + per distinct source); the empirical law D <= rho_K(sources) holds on every E8 design run here. +Prints PASS_T1_COUNTEREXAMPLE.""" +import hashlib, itertools, os, random, sys +from fractions import Fraction as Fr + +sys.setrecursionlimit(10000) +HERE = os.path.dirname(os.path.abspath(__file__)) +ROOT = os.path.dirname(os.path.dirname(HERE)) +PR968 = 'research/complex-frame-pair-decoders/inputs/pr717/P104_HIT_flip_3a.txt' +PR968_SHA256 = '8e0178db02c14e1b29058cdbdbd50aac22f2b55a1ba21dc82f417610c9932526' + + +def say(s): + print(s, flush=True) + + +def expect(name, got, want): + if got != want: + raise SystemExit('FAIL %s: got %r want %r' % (name, got, want)) + say('ok %s: %r' % (name, got)) + + +def rank(rows): + """Exact rank of a list of sparse rows {key: Fraction}.""" + piv = {} + r = 0 + for row in rows: + v = {k: Fr(x) for k, x in row.items() if x} + while v: + k = min(v) + if k in piv: + c = v[k] + for kk, xx in piv[k].items(): + nv = v.get(kk, 0) - c * xx + if nv: + v[kk] = nv + else: + v.pop(kk, None) + else: + c = v[k] + piv[k] = {kk: xx / c for kk, xx in v.items()} + r += 1 + break + return r + + +def nullspace(M): + """Basis of {v : M v = 0} (M dense list of lists, rationals).""" + n = len(M[0]) + A = [[Fr(x) for x in row] for row in M] + pivc = [] + r = 0 + for c in range(n): + p = next((i for i in range(r, len(A)) if A[i][c] != 0), None) + if p is None: + continue + A[r], A[p] = A[p], A[r] + A[r] = [x / A[r][c] for x in A[r]] + for i in range(len(A)): + if i != r and A[i][c] != 0: + f = A[i][c] + A[i] = [x - f * y for x, y in zip(A[i], A[r])] + pivc.append(c) + r += 1 + free = [c for c in range(n) if c not in pivc] + out = [] + for f in free: + v = [Fr(0)] * n + v[f] = Fr(1) + for i, c in enumerate(pivc): + v[c] = -A[i][f] + out.append(v) + return out + + +# ---------------------------------------------------------------------------------------------- geometry +def geometry(m): + """A_m toy (same as charge_law.py): n, G, B (roots in a basis), C (L deposit coefficients), Z.""" + pairs = list(itertools.combinations(range(m + 1), 2)) + roots = [[(1 if k == i else -1 if k == j else 0) for k in range(m + 1)] for i, j in pairs] + n = len(roots) + G = [[sum(a * b for a, b in zip(roots[s], roots[t])) for t in range(n)] for s in range(n)] + B = [[Fr(r[k]) for k in range(m)] for r in roots] + IJ = [[Fr(1 + (a == b)) for b in range(m)] for a in range(m)] + C = [[sum(B[t][a] * IJ[a][j] for a in range(m)) / 2 for j in range(m)] for t in range(n)] + for s in range(n): + for t in range(n): + assert sum(C[s][j] * B[t][j] for j in range(m)) == Fr(G[s][t], 2) + Z = {(s, t): Fr(G[s][t], 2) for s in range(n) for t in range(n) if s != t and G[s][t] % 2} + return n, G, B, C, Z + + +def load_e8(): + path = os.path.join(ROOT, PR968) + raw = open(path, 'rb').read() + expect('SHA256 of %s' % PR968, hashlib.sha256(raw).hexdigest(), PR968_SHA256) + L = raw.decode().split('\n') + Dr = [[int(x) for x in l[3:].split()] for l in L if l.startswith(' d:')] + Tr = [[int(x) for x in l[3:].split()] for l in L if l.startswith(' t:')] + n = len(Dr[0]) + return n, [[sum(Dr[k][i] * Tr[k][j] for k in range(8)) // 2 for j in range(n)] for i in range(n)] + + +def zcells(n, G): + return {(p, t): Fr(G[p][t], 2) for p in range(n) for t in range(n) if p != t and G[p][t] % 2} + + +def partners(n, Z): + return [[s for s in range(n) if (t, s) in Z] for t in range(n)] + + +def matching(n, part, rng, forbid=None): + """Perfect partner matching column t -> row sigma(t) (augmenting paths), avoiding forbid[t].""" + forbid = forbid or {} + match, rowof = {}, {} + + def aug(t, seen): + cand = [p for p in part[t] if p != forbid.get(t)] + rng.shuffle(cand) + for p in cand: + if p in seen: + continue + seen.add(p) + if p not in rowof or aug(rowof[p], seen): + match[t] = p + rowof[p] = t + return True + return False + for t in range(n): + if not aug(t, set()): + raise SystemExit('FAIL no perfect matching') + return match + + +# ---------------------------------------------------------------------------------------------- witness formula +def witness_D(n, Z, K, sig, pre, cr=None): + """Exact D for the sigma-anchor design with contaminated snapshots. + Witness = (a on x, b = K beta on y, theta on tokens). Row p: a_p + sum_t Z_pt rho_pt = 0 with + rho_pt = a_t (settled) or b_t - sum_{s in pre_t minus cr_t} Z_ts a_s (early, p = sig[t]). + Window tokens force sum_{s in pre_t minus cr_t} Z_ts a_s = 0 on the early relay token. + D = dim(witnesses) - dim(trivial witnesses a = b, all relay tokens 0) = rank(M + extra) - rank(M).""" + cr = cr or {} + d = len(K) + M = [] + for p in range(n): + row = {p: Fr(1)} + for t in range(n): + z = Z.get((p, t)) + if not z: + continue + if sig.get(t) == p: + for j in range(d): + if K[j][t]: + row[n + j] = row.get(n + j, 0) + z * K[j][t] + for s in pre.get(t, ()): + if s not in cr.get(t, ()): + row[s] = row.get(s, 0) - z * Z[(t, s)] + else: + row[t] = row.get(t, 0) + z + M.append(row) + extra = [] + for p in range(n): + row = {p: Fr(1)} + for j in range(d): + if K[j][p]: + row[n + j] = -K[j][p] + extra.append(row) + for t in sig: + row = {} + for s in pre.get(t, ()): + if s not in cr.get(t, ()): + row[s] = row.get(s, 0) + Z[(t, s)] + if row: + extra.append(row) + return rank(M + extra) - rank(M) + + +# ---------------------------------------------------------------------------------------------- full simulation +def simulate(m, mode, S, sig, first): + """Every register written out (frame-free, exact). Modes for columns t in S: + clean: O_t = y_t; xcont: O_t = Y_t after window (t, first[t]) completed against pure X_s (= y_t - Z_ts x_s); + coread: as xcont, then O_t += Z_ts X_s (strip). Returns (D, Y exact).""" + n, G, B, C, Z = geometry(m) + r = m + reg = {} + + def new(k, v): + reg[k] = dict(v) + + def add(dst, c, src): + dd = reg[dst] + for a, v in list(reg[src].items()): + nv = dd.get(a, 0) + c * v + if nv: + dd[a] = nv + else: + dd.pop(a, None) + X = ['X%d' % p for p in range(n)] + Y = ['Y%d' % t for t in range(n)] + for p in range(n): + new(X[p], {'x%d' % p: Fr(1)}) + for t in range(n): + new(Y[t], {'y%d' % t: Fr(1)}) + rel = {(p, t): 'R%d_%d' % (p, t) for (p, t) in Z} + win = {(t, s): 'W%d_%d' % (t, s) for (t, s) in Z} + hel = list(rel.values()) + list(win.values()) + for k in hel: + new(k, {k: Fr(1)}) + U = [] + for j in range(r): + new('U%d' % j, {}) + new('L%d' % j, {}) + for t in range(n): + add('U%d' % j, B[t][j], Y[t]) + add('L%d' % j, B[t][j], X[t]) + U.append('U%d' % j) + for (p, t), R in rel.items(): + add(R, -1, Y[t]) # relays lump pure y_t + for (t, s), W in win.items(): + add(W, -1, Y[s]) # windows lump pure y_s + for t in range(n): + new('P%d' % t, {}) + add('P%d' % t, 1, Y[t]) # pure park (keeps Y exact) + done = set() + for t in range(n): + new('O%d' % t, {}) + s = first[t] + W = win[(t, s)] + if t in S and mode in ('xcont', 'coread'): + add(Y[t], Z[(t, s)], W) + add(W, 1, X[s]) # X_s still pure + add(Y[t], -Z[(t, s)], W) + done.add((t, s)) + add('O%d' % t, 1, Y[t]) # snapshot y_t - Z_ts x_s + if mode == 'coread': + add('O%d' % t, Z[(t, s)], X[s]) + else: + add('O%d' % t, 1, Y[t]) + for (t, s), W in win.items(): + if (t, s) not in done: + add(Y[t], Z[(t, s)], W) + add(W, 1, X[s]) + add(Y[t], -Z[(t, s)], W) + for (p, t), R in rel.items(): + add(X[p], -Z[(p, t)], R) # X reads relays + for t in range(n): + for j in range(r): + add(Y[t], C[t][j], 'L%d' % j) # L deposit G/2 x + add(Y[t], -1, 'P%d' % t) + for (p, t), R in rel.items(): + add(R, 1, 'O%d' % t if p == sig[t] else Y[t]) # early re-add O_t, settled re-add Y_t final + yok = all(reg[Y[t]] == {'x%d' % t: Fr(1)} for t in range(n)) + T = [{'x%d' % p: Fr(1), 'y%d' % p: Fr(-1)} for p in range(n)] + [{h: Fr(1)} for h in hel] + arr = [reg[v] for v in X + hel] + [reg[u] for u in U] + return rank(arr + T) - rank(arr), yok + + +def section_crossval(): + say('== (a) witness formula = full simulation on A3/A4') + tot = 0 + for m, seeds in ((3, 12), (4, 6)): + n, G, B, C, Z = geometry(m) + part = partners(n, Z) + K = nullspace([[Fr(x) for x in r] for r in G]) + seen = set() + for seed in range(seeds): + rng = random.Random(seed) + sig = matching(n, part, rng) + S = set(rng.sample(range(n), rng.randint(1, n))) + first = {t: rng.choice(part[t]) for t in range(n)} + for mode in ('clean', 'xcont', 'coread'): + d1, yok = simulate(m, mode, S, sig, first) + pre = {t: [first[t]] for t in S} if mode != 'clean' else {} + cr = {t: [first[t]] for t in S} if mode == 'coread' else {} + d2 = witness_D(n, Z, K, sig, pre, cr) + if d1 != d2 or not yok: + raise SystemExit('FAIL A%d seed %d %s: sim %d formula %d Yexact %s' % (m, seed, mode, d1, d2, yok)) + seen.add((mode, d1)) + tot += 1 + say('ok A%d: formula = simulation, Y exact, on %d designs; (mode, D) seen %s' + % (m, 3 * seeds, sorted(x for x in seen))) + if not any(mode == 'xcont' and d > 0 for mode, d in seen): + raise SystemExit('FAIL control: x-contamination never changed D on the toys') + expect('cross-validated designs', tot, 54) + + +def rho_K(K, S): + return rank([{j: K[j][s] for j in range(len(K)) if K[j][s]} for s in sorted(S)]) if S else 0 + + +def section_e8(): + say('== (b) E8 / P104: every column contaminated, D far below the literal bound') + n, G = load_e8() + expect('ports', n, 104) + Z = zcells(n, G) + part = partners(n, Z) + expect('partners per port', sorted({len(v) for v in part}), [48]) + K = nullspace([[Fr(x) for x in r] for r in G]) + r = n - len(K) + expect('rank G', r, 8) + expect('settled: D', witness_D(n, Z, K, {}, {}), 96) + sig = matching(n, part, random.Random(1)) + expect('sigma is a perfect partner matching', sorted(sig.values()) == list(range(n)) + and all((sig[t], t) in Z for t in range(n)), True) + expect('clean sigma anchors: D', witness_D(n, Z, K, sig, {}), 0) + # contamination sources concentrated on few partners: greedy cover, smallest index on ties + cover = {s: {t for t in range(n) if (t, s) in Z and sig[t] != s} for s in range(n)} + S, left = [], set(range(n)) + while left: + s = max(range(n), key=lambda x: (len(cover[x] & left), -x)) + S.append(s) + left -= cover[s] + src = {t: min(s for s in S if t in cover[s]) for t in range(n)} + pre = {t: [src[t]] for t in range(n)} + expect('every column contaminated (N_neutral = 0), s(t) partner of t, s(t) != sigma(t)', + all((t, src[t]) in Z and src[t] != sig[t] for t in range(n)) and len(pre) == n, True) + lit = n - r - 0 - 0 + expect('literal law-5 bound n - r - N_neutral - N_owned', lit, 96) + for seed, want in ((0, 7), (29, 9)): + # seeded greedy-few map (each column reuses an already-used source when it can); the LEMMAA schedule + rng = random.Random(seed) + s7 = {} + order = list(range(n)) + rng.shuffle(order) + for t in order: + cand = [x for x in part[t] if x != sig[t]] + used = [x for x in cand if x in s7.values()] + s7[t] = rng.choice(used) if used else rng.choice(cand) + expect('greedy-few seed %d: all 104 columns contaminated, distinct sources' % seed, + (len(s7), len(set(s7.values()))), (n, want)) + D7 = witness_D(n, Z, K, sig, {t: [v] for t, v in s7.items()}) + expect('greedy-few seed %d: D (literal bound 96)' % seed, D7, want) + expect('D <= rho_K(sources)', D7 <= rho_K(K, set(s7.values())), True) + expect('deterministic greedy cover: distinct sources', len(set(src.values())), 5) + D = witness_D(n, Z, K, sig, pre) + expect('deterministic greedy cover: D (literal bound 96)', D, 5) + if not D < lit: + raise SystemExit('FAIL: no counterexample') + expect('D <= rho_K(sources)', D <= rho_K(K, set(src.values())), True) + say(' cover sources %s; rho_K = %d' % (sorted(set(src.values())), rho_K(K, set(src.values())))) + say('== (c) controls on E8: contamination does cost when sources spread') + preline = {t: [sig[t]] for t in range(n)} + expect('contamination by the sigma cell itself: D', witness_D(n, Z, K, sig, preline), 96) + sig2 = matching(n, part, random.Random(2), forbid=sig) + expect('second matching injective, avoids sigma', len(set(sig2.values())) == n + and all(sig2[t] != sig[t] for t in range(n)), True) + D2 = witness_D(n, Z, K, sig, {t: [sig2[t]] for t in range(n)}) + expect('contamination through an injective second matching: D', D2, 96) + expect('D <= rho_K(sources) (second matching)', D2 <= rho_K(K, set(sig2.values())), True) + + +if __name__ == '__main__': + section_crossval() + section_e8() + say('PASS_T1_COUNTEREXAMPLE')