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). 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") diff --git a/research/p104-signed-phase-leg-reuse-bound/LOCAL-PINS.json b/research/p104-signed-phase-leg-reuse-bound/LOCAL-PINS.json new file mode 100644 index 0000000000..456eaa150c --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/LOCAL-PINS.json @@ -0,0 +1,28 @@ +{ + "engines/LEAD-PINS": "e1846ccfeb5f3fb1f2d4a8e6d649f91f8a81a5dcba9e28e1bb33b56ccb173fb5", + "engines/TRIPLE-PINS": "0587ca0312c5aabe8fa4aeee7d0a39d5f11ca61a096c008f43e8d6de540a2b6a", + "engines/forward.py": "75d94780f9db49a4b08bb0e7fb4bd7fc04adb8cabbf73d83a809179c04c3d439", + "engines/independent.py": "6a1a1a2c81027d054e3e454926448f36361bef12e5c1ce15c221dba60ca6d19a", + "engines/lead.py": "b79ff0664c7cd0c3de8c739a81cbcbe12731c7b8d9b20fd8c5d39d8b1e116c3d", + "engines/r193_reverse.py": "9ae59db62515c19c64af6fde62b1708c35d0a9f369f77b01691f6c22438bed03", + "engines/rank_gate.py": "c5828f686452a908c2bfadb9ba407ccc94efb4e8c533ab814b8c7dd0a26a34e0", + "engines/reverse.py": "2faedaf76b8d1cc399294f5595862092de75ea1dd3a0ec41898a61edad006d53", + "engines/triple_lead.py": "ca2d444ce51446e8d943548701541cd9356bedbda8621e05ab908c417e951e02", + "engines/triple_reverse.py": "bbc5cbc7216967e88070bbaabde0e3b4b8092d0f5b624eff56ef43aefda80af5", + "inputs/7113-SHA256.json": "064e11ecfedce9937ea1782e5baee37e89b3c9eebabed5b4a9ba84f412bbe078", + "inputs/7113-application.py": "d98987db98553dc55bfc80e3ca47abfcd51c57af6f8cda61101391d8eae94184", + "inputs/7113-signed-child.py": "ef03444360f02225138be9b38e2f9a85f313eeaa910d63a365de0f16d228cb8b", + "inputs/CALLER.json": "255d89f38cd45e38e5770f559bc43dc217e989032359768cdc7e8cdfd64b47bc", + "inputs/NATIVE-RESULT.json": "c6d1b00a83185ab0062397b363258b1f3f6685d755e9c1d4f7d3e7e511240812", + "inputs/PHYSICAL-BINDING.json": "ade5f8cbb2e30677b1d48d23a1aa270b3d0b72e2504472ab9fdb71d124b075b5", + "inputs/PR7362-SHA256.json": "2c90ca39b0f075cc4b3ec9e90c66fde473465e7bb50cf1db9a820d3a29556c0b", + "inputs/R92-PRICE.json": "05d7a5ebdd2eeedd6c8f534e8e2eeac22484daf9f387f4a6b88cc9eed22a6b8f", + "inputs/pricing.py": "f4d0b6c9314b838d882d6d06020f24881c19a3fda97a7c00df87b1e920785182", + "receipts/R193-LEAD.json": "4926019203f511866cf327128ebcd291561ebc03b6d77a6816361d7128d4664c", + "receipts/R193-PRICE.json": "1ad9852ecff0b3780770cbf4e500731e65214a9c438f8b1ed2c0cbe484d9b36b", + "receipts/R193-REVERSE.json": "e59b4016fc5e5e5de548f16aaa5a895c8b073e4cf8f0c7b73366bd78b1023e06", + "receipts/R194-LEAD.json": "e293aa9dfb2ead89ab22336c005bf9dc11b4f44faf81712d6c032b543dde6b66", + "receipts/R194-REVERSE.json": "49b7dbd3d08c56b16dc43f23bd6f410dde0b98040d922cee6f617786eb474834", + "receipts/R195-LEAD.json": "c666d42e67346f2c93c789fc8c48916de5909e661a36aec1927ca614a254591c", + "receipts/R195-REVERSE.json": "f6091c7c63b21145077808bbdacc61431f641d0da37f9fa648aea4b7ead3b472" +} diff --git a/research/p104-signed-phase-leg-reuse-bound/NOTICE b/research/p104-signed-phase-leg-reuse-bound/NOTICE new file mode 100644 index 0000000000..0c569b4dab --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/NOTICE @@ -0,0 +1,3 @@ +Apache-2.0. + +#7334 and #7113 supply the exact native and caller. #7419 supplies proper-window rank and pricing receipts. #7410 supplies signed specialization and literal prefix methods. #7362 and #7298 supply exact rank stock and tariff. OpenAI Codex and subagents materially assisted. diff --git a/research/p104-signed-phase-leg-reuse-bound/PROOF.md b/research/p104-signed-phase-leg-reuse-bound/PROOF.md new file mode 100644 index 0000000000..842233d3a9 --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/PROOF.md @@ -0,0 +1,17 @@ +# Exact signed phase-leg recombination + +Use the exact #7113 Type A word at unit bodies and q=±1. The signed-child Walsh eigenvalues 1 and i give the two central signs at width two, while the independent body axes admit unit values. The original endpoints are I and −I on the 36 roles. For the minus prefix N before a J leg or QUERY, the relative factor is T=N⁻¹(I+2εE_dj)N, where ε is the signed shear coefficient, d the destination and j the source. The two legs of the same J commute and can use the same pre-event prefix. If P_± are the prefixes including the current event, P_−⁻¹P_+ is obtained by left-multiplying the previous relative product by T. There are 38 factors: 34 J legs and four QUERYs. + +For an early selected factor T_a and late T_b, move T_a through the unselected intervening product S by conjugation. The gathered pair is T_b S T_a S⁻¹. For a triple gather the three selected factors at its latest slot, conjugating each earlier factor through the intervening unselected products and preserving their relative order. Every unselected factor stays fixed. The rank of the gathered product minus I bounds from below the number of rank-one updates required, since any product minus I telescopes and rank is subadditive. + +## Proper windows and endpoint checks + +A proper maximal window is the event interval containing a contiguous nonempty proper subset of native calls and extending to its neighboring unchanged J anchors or tape ends. #7419 supplies two exact rank replays for all 153 maximal windows, including 152 proper windows. In every proper window the sign-difference rank is exactly the number of its original rank-one factors. The window's local relative product differs from the corresponding global factor product by a common invertible conjugation. Its displacement rank is the same. Any compression reducing a selected pair or triple inside a proper window would lower the total factor count below this rank, while preserving the window's product. It is therefore impossible. + +The package replays one independent window method, checks it against the frozen second receipt, and reconstructs the coverage from literal factor clocks. There are 38 choose 2 = 703 pairs and 38 choose 3 = 8,436 triples. A tuple fails to fit a proper window exactly when it contains a J1 leg and a J17 leg. The two maximal proper windows J1–J16 and J2–J17 already cover every other tuple. This leaves four pairs and 140 triples for exact global calculation. Both engines find rank two for all four pairs and rank three for all 140 triples. The independent pair minor determinants are 4, −4, 12 and 4. Every triple has a committed nonzero exact 3×3 minor. Both methods replay the old full relative endpoint −I. + +## Conditional price and limitations + +The motivating one-leg reduction would replace J1 directly and reuse the old paid J17. The optimistic quote removes J1's 6,279 paid positions and 1,101 fresh productive helper targets. It adds 400 rank-eight body calls, 16 Type B rank-one calls and 96 Type A rank-one calls, preserving the other old stock. Reconstructing the signed rank moment from the exact native and caller invoice gives a directed gross of about 50.33412118538 before physical implementation and ancillary costs. No pair or triple reduction survives, so verified savings and Δκ are zero. + +This proof keeps all unselected relative factors fixed. It grants generous local action to the selected factors and uses a legal signed unit-body specialization. Rewrites of four or more factors, nonunit bodies as a distinct construction step, changes to retained factors, cross-port packing and another paid provider stay outside the tested scope. diff --git a/research/p104-signed-phase-leg-reuse-bound/PROVENANCE.json b/research/p104-signed-phase-leg-reuse-bound/PROVENANCE.json new file mode 100644 index 0000000000..0bf466c66a --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/PROVENANCE.json @@ -0,0 +1,138 @@ +{ + "comparator": { + "author": "Clear1nsight", + "head": "aaeec8c0acf01e99a5f331ef363a698d9c084ace", + "kappa": "0.00364665195644", + "pull_request": 7334, + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/7334", + "status": "strongest independently reproduced complete comparable witness" + }, + "derived_inputs": { + "inputs/R92-PRICE.json": { + "key": "R92-PRICE.json", + "receipt": "inputs/PR7362-SHA256.json" + } + }, + "files": { + "engines/reverse.py": { + "commit": "ae41a5abb02fd18d3e270ee2ab4822b651902d0d", + "git_blob": "f2ee99c8d481ace7f211223dc809e5631b590168", + "path": "research/p104-type-a-late-mask-permutation-bound/engines/seam_reverse.py", + "sha256": "2faedaf76b8d1cc399294f5595862092de75ea1dd3a0ec41898a61edad006d53", + "source": "https://github.com/CrocSwap/integer-mult-bounds/blob/ae41a5abb02fd18d3e270ee2ab4822b651902d0d/research/p104-type-a-late-mask-permutation-bound/engines/seam_reverse.py" + }, + "inputs/7113-SHA256.json": { + "commit": "07a76c5e2738882c0cb322278e56f6cae3c9885d", + "git_blob": "5a7d6b80dc51aa918a5d521b60d18f9a6bbbc52e", + "path": "research/signed-caller-8x9/SHA256.json", + "sha256": "064e11ecfedce9937ea1782e5baee37e89b3c9eebabed5b4a9ba84f412bbe078", + "source": "https://github.com/rohanarun/integer-mult-bounds/blob/07a76c5e2738882c0cb322278e56f6cae3c9885d/research/signed-caller-8x9/SHA256.json" + }, + "inputs/7113-application.py": { + "commit": "07a76c5e2738882c0cb322278e56f6cae3c9885d", + "git_blob": "1a6d358cbec88e70615e5314cdfca9e123124f83", + "path": "research/signed-caller-8x9/replay/supplier7112/short-caller/upstream_application.py", + "sha256": "d98987db98553dc55bfc80e3ca47abfcd51c57af6f8cda61101391d8eae94184", + "source": "https://github.com/rohanarun/integer-mult-bounds/blob/07a76c5e2738882c0cb322278e56f6cae3c9885d/research/signed-caller-8x9/replay/supplier7112/short-caller/upstream_application.py" + }, + "inputs/7113-signed-child.py": { + "commit": "07a76c5e2738882c0cb322278e56f6cae3c9885d", + "git_blob": "0980a6559ba1939763de5c798c7947c8bdd51d67", + "path": "research/signed-caller-8x9/replay/supplier7112/short-caller/signed_child.py", + "sha256": "ef03444360f02225138be9b38e2f9a85f313eeaa910d63a365de0f16d228cb8b", + "source": "https://github.com/rohanarun/integer-mult-bounds/blob/07a76c5e2738882c0cb322278e56f6cae3c9885d/research/signed-caller-8x9/replay/supplier7112/short-caller/signed_child.py" + }, + "inputs/CALLER.json": { + "commit": "07a76c5e2738882c0cb322278e56f6cae3c9885d", + "git_blob": "9451ceaf6e8e037894680b549f3ef41c21b260d7", + "path": "research/signed-caller-8x9/expected/ODD-TYPE-AB-CALLER.json", + "sha256": "255d89f38cd45e38e5770f559bc43dc217e989032359768cdc7e8cdfd64b47bc", + "source": "https://github.com/rohanarun/integer-mult-bounds/blob/07a76c5e2738882c0cb322278e56f6cae3c9885d/research/signed-caller-8x9/expected/ODD-TYPE-AB-CALLER.json" + }, + "inputs/NATIVE-RESULT.json": { + "commit": "aaeec8c0acf01e99a5f331ef363a698d9c084ace", + "git_blob": "eb101307d4d0399efed96d88cf6d4c01ec9c7369", + "path": "research/p104-helper-319-fused-return/NATIVE-RESULT.json", + "sha256": "c6d1b00a83185ab0062397b363258b1f3f6685d755e9c1d4f7d3e7e511240812", + "source": "https://github.com/Clear1nsight/integer-mult-bounds/blob/aaeec8c0acf01e99a5f331ef363a698d9c084ace/research/p104-helper-319-fused-return/NATIVE-RESULT.json" + }, + "inputs/PHYSICAL-BINDING.json": { + "commit": "07a76c5e2738882c0cb322278e56f6cae3c9885d", + "git_blob": "c10f2a7f93b5632fb8789046b6a5c99da42c432a", + "path": "research/signed-caller-8x9/expected/ODD-PHYSICAL-BINDING.json", + "sha256": "ade5f8cbb2e30677b1d48d23a1aa270b3d0b72e2504472ab9fdb71d124b075b5", + "source": "https://github.com/rohanarun/integer-mult-bounds/blob/07a76c5e2738882c0cb322278e56f6cae3c9885d/research/signed-caller-8x9/expected/ODD-PHYSICAL-BINDING.json" + }, + "inputs/PR7362-SHA256.json": { + "commit": "5eec7ed633dcf9b9bbc95552aa653da296f863fb", + "git_blob": "b1486e0b5cfe4535f381ed26f7bce4aee21d8a43", + "path": "research/p104-rank-two-virtual-cut-bound/receipts/SHA256.json", + "sha256": "2c90ca39b0f075cc4b3ec9e90c66fde473465e7bb50cf1db9a820d3a29556c0b", + "source": "https://github.com/CrocSwap/integer-mult-bounds/blob/5eec7ed633dcf9b9bbc95552aa653da296f863fb/research/p104-rank-two-virtual-cut-bound/receipts/SHA256.json" + }, + "inputs/pricing.py": { + "commit": "c522451caf287bb3c16eaece72be4c263315dca4", + "git_blob": "40ec194017bda1d524bba4f07b188c53281419d0", + "path": "research/adjacent-owned-add-exchange-bound/pricing.py", + "sha256": "f4d0b6c9314b838d882d6d06020f24881c19a3fda97a7c00df87b1e920785182", + "source": "https://github.com/CrocSwap/integer-mult-bounds/blob/c522451caf287bb3c16eaece72be4c263315dca4/research/adjacent-owned-add-exchange-bound/pricing.py" + }, + "receipts/R193-LEAD.json": { + "commit": "a590edb3c5f7efd7404b1203e727c8cc3218493e", + "git_blob": "d2f272917b1279849701bc25d04580b73a479498", + "path": "research/p104-contiguous-direct-j-replacement-bound/receipts/R193-LEAD.json", + "sha256": "4926019203f511866cf327128ebcd291561ebc03b6d77a6816361d7128d4664c", + "source": "https://github.com/CrocSwap/integer-mult-bounds/blob/a590edb3c5f7efd7404b1203e727c8cc3218493e/research/p104-contiguous-direct-j-replacement-bound/receipts/R193-LEAD.json" + }, + "receipts/R193-PRICE.json": { + "commit": "a590edb3c5f7efd7404b1203e727c8cc3218493e", + "git_blob": "244e5f80a62739b853d5c6ce0da447cebe69beb8", + "path": "research/p104-contiguous-direct-j-replacement-bound/inputs/PRICE.json", + "sha256": "1ad9852ecff0b3780770cbf4e500731e65214a9c438f8b1ed2c0cbe484d9b36b", + "source": "https://github.com/CrocSwap/integer-mult-bounds/blob/a590edb3c5f7efd7404b1203e727c8cc3218493e/research/p104-contiguous-direct-j-replacement-bound/inputs/PRICE.json" + }, + "receipts/R193-REVERSE.json": { + "commit": "a590edb3c5f7efd7404b1203e727c8cc3218493e", + "git_blob": "75c0cb4c5f26a51279aa493c21325e77db79826a", + "path": "research/p104-contiguous-direct-j-replacement-bound/receipts/R193-INDEPENDENT.json", + "sha256": "e59b4016fc5e5e5de548f16aaa5a895c8b073e4cf8f0c7b73366bd78b1023e06", + "source": "https://github.com/CrocSwap/integer-mult-bounds/blob/a590edb3c5f7efd7404b1203e727c8cc3218493e/research/p104-contiguous-direct-j-replacement-bound/receipts/R193-INDEPENDENT.json" + } + }, + "predecessors": { + "fixed_host_methods": { + "credit": "Adjacent fixed J8/J9 support analysis for different QUERY demotions and endpoint.", + "head": "4dfa0a393fd12101af5ffed161ed1bc5aa045f11", + "pull_request": 7412, + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/7412" + }, + "fixed_phase_even_seam": { + "credit": "Exact source for signed prefix and seam, directed price, and the excluded fixed phase-even model.", + "head": "ae41a5abb02fd18d3e270ee2ab4822b651902d0d", + "pull_request": 7410, + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/7410" + }, + "pricing_engine": { + "credit": "Exact directed rational tariff implementation", + "head": "c522451caf287bb3c16eaece72be4c263315dca4", + "url": "https://github.com/CrocSwap/integer-mult-bounds/blob/c522451caf287bb3c16eaece72be4c263315dca4/research/adjacent-owned-add-exchange-bound/pricing.py" + }, + "proper_rank_windows": { + "credit": "Exact 152 proper window rank receipts and complete direct provider price.", + "head": "a590edb3c5f7efd7404b1203e727c8cc3218493e", + "pull_request": 7419, + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/7419" + }, + "rank_two_price": { + "credit": "Exact input receipt for the directed comparator price", + "head": "5eec7ed633dcf9b9bbc95552aa653da296f863fb", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7362" + }, + "signed_caller": { + "credit": "Rohan Arun, literal signed Type A/B caller and physical gate", + "head": "07a76c5e2738882c0cb322278e56f6cae3c9885d", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/7113" + } + }, + "schema_version": 1 +} diff --git a/research/p104-signed-phase-leg-reuse-bound/README.md b/research/p104-signed-phase-leg-reuse-bound/README.md new file mode 100644 index 0000000000..5b606cae10 --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/README.md @@ -0,0 +1,19 @@ +# Pair and triple reuse of signed Type A phase legs + +**NO VERIFIED GAIN.** The exact comparator is [#7334](https://github.com/CrocSwap/integer-mult-bounds/pull/7334) at `aaeec8c0acf01e99a5f331ef363a698d9c084ace` with signed [#7113](https://github.com/CrocSwap/integer-mult-bounds/pull/7113) at `07a76c5e2738882c0cb322278e56f6cae3c9885d`, κ = 0.00364665195644. + +At unit bodies the old Type A relative endpoint between the two legal central signs is −I. Its chronological factorization has 38 rank-one updates, two per native J call and four original QUERYs. Can two or three selected updates be moved through the intervening fixed factors and replaced by one fewer rank-one update? All 703 pairs and 8,436 triples fail. The 152 proper maximal windows cover 699 pairs and 8,296 triples by exact displacement rank. The four remaining pairs and 140 remaining triples span J1 and J17. Independent exact endpoint replays find rank two and rank three, respectively, for every transported product minus identity. There are zero unresolved keys in the declared family. + +Run from a clean checkout with POSIX CPython 3.12 and assertions. + +```sh +python3.12 -I -B research/p104-signed-phase-leg-reuse-bound/replay.py +``` + +The offline command authenticates the exact word and source receipts, verifies the legal signed phases, reproduces the proper-window gate and both methods for each endpoint family, and rejects a changed caller. See [proof and pricing](PROOF.md) and [verification](VERIFICATION.md). + +[#7419](https://github.com/CrocSwap/integer-mult-bounds/pull/7419) at `a590edb3c5f7efd7404b1203e727c8cc3218493e` supplies the proper-window rank certificate and price stock. #7334 and #7113 supply the exact native and caller. #7410 supplies exact signed-phase replay and literal-prefix tools, #7362 the rank stock, and #7298 the directed tariff. OpenAI Codex and subagents materially assisted. Apache-2.0. + +## Open next questions + +A simultaneous rewrite of four or more selected factors, a changed retained factor, or a different provider remains open. Price one exact new family, then bound the displacement rank of its transported product before any all-body or native build. diff --git a/research/p104-signed-phase-leg-reuse-bound/SOURCES.json b/research/p104-signed-phase-leg-reuse-bound/SOURCES.json new file mode 100644 index 0000000000..e8c2f265cd --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/SOURCES.json @@ -0,0 +1,18 @@ +{ + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "path": "certificates/selected-result.json", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1", + "usage": "provenance" + }, + { + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "path": "docs/research/agent-task-catalog.json", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81", + "usage": "provenance" + } + ], + "schema_version": 1 +} diff --git a/research/p104-signed-phase-leg-reuse-bound/TASK.json b/research/p104-signed-phase-leg-reuse-bound/TASK.json new file mode 100644 index 0000000000..475e0959e4 --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/TASK.json @@ -0,0 +1,117 @@ +{ + "actual_scope": "Exact #7334/#7113 Type A signed unit-body relative product. All 703 pairs and 8,436 triples of its 38 factors, with other relative factors fixed.", + "ai_assistance": "OpenAI Codex and subagents materially assisted proof, implementation, independent verification and packaging.", + "author": "P104 signed phase-leg recombination research", + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "bottleneck_link": "Reducing the signed phase rank updates can make one direct stage replacement cheaper after accounting for every retired helper and new paid call.", + "budget_minutes": 13, + "evidence": "152 exact proper maximal windows cover 699 pairs and 8,296 triples. Independent methods exclude four endpoint pairs by rank two and 140 endpoint triples by rank three. Zero unresolved.", + "open_questions": [ + { + "blocked_by": "Every pair and triple has full displacement rank with unselected factors fixed.", + "first_step": "Pin and price one distinct larger group, then compute exact transported displacement rank before a physical build.", + "question": "Can at least four selected relative factors be jointly compressed in the same signed price class?", + "why_it_matters": "A rank reduction might remove a paid Type A signed query per port." + } + ], + "original_card": { + "acceptance_gate": "An exact arbitrary-input identity, source/target frame availability and restoration at the chosen cut, plus the complete channel+correction+idle/hosting bill or an explicit favorable bound. The native channel alone is not a supplier. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "existing_checks": [ + { + "evidence": "research/p104-literal-slot-defect/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "scope": "PR #4133: literal-slot defect", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129", + "source_commit": "88666f1dee93fbd85b31fd5d6f91a219e111b5f4", + "status": "author-checked" + }, + { + "evidence": "research/p104-uniform-commutation-gap/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "scope": "PR #4136: uniform commutation gap", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129", + "source_commit": "281ce601a8be9db470de630759179c23e1dfaa88", + "status": "author-checked" + }, + { + "evidence": "research/p104-uniform-encoding-gap/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "scope": "PR #4140: uniform encoding gap", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129", + "source_commit": "de25c6525aa866962309df5d107b32d55e6e5628", + "status": "author-checked" + }, + { + "evidence": "research/p104-source-chart-shortcut/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "scope": "PR #4153: source-chart shortcut exhausts its optimistic allowance", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129", + "source_commit": "9123241fea53df77e51ffe30d9aca1625d4bf3a8", + "status": "author-checked" + }, + { + "evidence": "research/p104-fiber-tag-seam/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "scope": "PR #4154: fiber-tag seam mismatch", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129", + "source_commit": "4ffcdaee5d6255a9cea1fe53a5424435068089d0", + "status": "author-checked" + }, + { + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "status": "reviewed" + } + ], + "first_experiment": "Start with the selected #5599 emitted word and review pending #5718 distinct input/output bases plus #5717/#5719 coverage before claiming work. Pick one uncovered source word, helper group and cut region. Prove the arbitrary-input relation and legal entry/exit corrections, then compare full target and paid profiles. Reject if completion, owned lifetimes or consumer costs repay the gain. A static pairing rank alone is not a physical split.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "id": "p104-side-correction", + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "overlap_terms": [ + "P104", + "helper basis", + "helper split", + "5718", + "dyadic capacity" + ], + "question": "Can joint helper bases and a legal causal split improve the complete P104 productive/paid invoice?", + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "research/p104-helper-subspace-splits/README.md", + "research/dyadic-helper-channel-capacity/README.md" + ] + }, + "outcome": "negative-result", + "priority_revision": 8, + "schema_version": 1, + "scope_change_reason": "Replace the earlier contiguous provider proposal with noncontiguous chronological relative-factor reuse.", + "scope_status": "changed", + "stop_rule": "Cover proper windows by exact telescoping rank, then four endpoint pairs at 30 seconds per method and 140 endpoint triples at 40 seconds per method. Stop on complete rank obstruction.", + "task_id": "p104-side-correction" +} diff --git a/research/p104-signed-phase-leg-reuse-bound/VERIFICATION.md b/research/p104-signed-phase-leg-reuse-bound/VERIFICATION.md new file mode 100644 index 0000000000..77721b1244 --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/VERIFICATION.md @@ -0,0 +1,5 @@ +# Verification + +The replay uses POSIX CPython 3.12 and assertions, with all exact inputs and receipts bundled. Both 30-second endpoint pair gates exited 0 in 0.99s and 0.23s. Both 40-second endpoint triple gates exited 0 in 2.27s and 0.282s. The independent proper-window replay exited 0 in 0.25s. No scientific gate hit its cap. The package compares full pair displacements, matches every triple and rank, re-evaluates the stored exact determinants, and verifies the entire combinatorial coverage. The known full endpoint and changed-caller controls pass. + +All tested pair and triple scopes exhausted with zero unresolved. No four-phase, nonunit-body, new supplier, precision, compiler, restoration, tape or recurrence run followed because there was no rank survivor. No complete κ claim is made. diff --git a/research/p104-signed-phase-leg-reuse-bound/VERIFY.json b/research/p104-signed-phase-leg-reuse-bound/VERIFY.json new file mode 100644 index 0000000000..c61e8c412b --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/VERIFY.json @@ -0,0 +1,14 @@ +{ + "commands": [ + { + "argv": ["{python}", "-I", "-B", "{package}/replay.py"], + "checks": "Verify all proper-window rank certificates and independently replay every endpoint pair and triple, with exact price and source controls.", + "timeout_seconds": 120 + } + ], + "inputs": [], + "python": "3.12", + "requirements": [], + "schema_version": 1, + "status": "ready" +} diff --git a/research/p104-signed-phase-leg-reuse-bound/engines/LEAD-PINS b/research/p104-signed-phase-leg-reuse-bound/engines/LEAD-PINS new file mode 100644 index 0000000000..09fdf7aba2 --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/engines/LEAD-PINS @@ -0,0 +1,4 @@ +75d94780f9db49a4b08bb0e7fb4bd7fc04adb8cabbf73d83a809179c04c3d439 forward.py +c5828f686452a908c2bfadb9ba407ccc94efb4e8c533ab814b8c7dd0a26a34e0 rank_gate.py +255d89f38cd45e38e5770f559bc43dc217e989032359768cdc7e8cdfd64b47bc inputs/CALLER.json +4926019203f511866cf327128ebcd291561ebc03b6d77a6816361d7128d4664c inputs/R193.json diff --git a/research/p104-signed-phase-leg-reuse-bound/engines/TRIPLE-PINS b/research/p104-signed-phase-leg-reuse-bound/engines/TRIPLE-PINS new file mode 100644 index 0000000000..e05ed2dc5a --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/engines/TRIPLE-PINS @@ -0,0 +1,6 @@ +255d89f38cd45e38e5770f559bc43dc217e989032359768cdc7e8cdfd64b47bc inputs/CALLER.json +1ad9852ecff0b3780770cbf4e500731e65214a9c438f8b1ed2c0cbe484d9b36b inputs/R193-PRICE.json +4926019203f511866cf327128ebcd291561ebc03b6d77a6816361d7128d4664c inputs/R193-RESULT.json +49b7dbd3d08c56b16dc43f23bd6f410dde0b98040d922cee6f617786eb474834 inputs/R194-RESULT.json +75d94780f9db49a4b08bb0e7fb4bd7fc04adb8cabbf73d83a809179c04c3d439 inputs/forward.py +2faedaf76b8d1cc399294f5595862092de75ea1dd3a0ec41898a61edad006d53 inputs/reverse.py diff --git a/research/p104-signed-phase-leg-reuse-bound/engines/forward.py b/research/p104-signed-phase-leg-reuse-bound/engines/forward.py new file mode 100644 index 0000000000..7842fd300e --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/engines/forward.py @@ -0,0 +1,125 @@ +"""Check profitable Type A late-mask swaps by direct forward propagation.""" +from collections import Counter +from fractions import Fraction +from hashlib import sha256 +from itertools import combinations +from json import dumps, loads +from pathlib import Path +from runpy import run_path +from signal import SIGALRM, alarm, signal + +HERE = Path(__file__).resolve().parent +N = 36 +CUT = 1741 +PINS = { + "inputs/CALLER.json": "255d89f38cd45e38e5770f559bc43dc217e989032359768cdc7e8cdfd64b47bc", + "inputs/R92-PRICE.json": "05d7a5ebdd2eeedd6c8f534e8e2eeac22484daf9f387f4a6b88cc9eed22a6b8f", + "inputs/pricing.py": "f4d0b6c9314b838d882d6d06020f24881c19a3fda97a7c00df87b1e920785182", +} + + +def unit(i): + return [Fraction(i == j) for j in range(N)] + + +def apply(events, column, q, inverse=False): + col = column.copy() + direction = -1 if inverse else 1 + for event in reversed(events) if inverse else events: + if event[0] == "B": + continue + if event[0] == "J": + _, _, (u, v, x, y), _ = event + assert len({u, v, x, y}) == 4 + col[v] += direction * q * col[u] + col[x] -= direction * q * col[y] + continue + assert event[0] == "A" + _, op, dest, *args = event + if op == "ADD": + src, value = args + col[dest] += direction * Fraction(value) * col[src] + elif op == "QUERY": + src, exponent = args + assert exponent == -1 + col[dest] += direction * q * col[src] + elif op == "SWAP": + src, = args + col[dest], col[src] = col[src], col[dest] + elif op == "SCALE": + value, = args + col[dest] *= Fraction(value) ** direction + else: + assert op in ("IDLE_ONE", "LAMBDA") + return col + + +def stop(*_): + raise TimeoutError("30-second solver cap") + + +def main(): + assert __debug__ + signal(SIGALRM, stop) + alarm(30) + for name, digest in PINS.items(): + assert sha256((HERE / name).read_bytes()).hexdigest() == digest + caller = loads((HERE / "inputs/CALLER.json").read_bytes()) + old = loads((HERE / "inputs/R92-PRICE.json").read_bytes()) + tape = caller["events"] + a = caller["types"]["A"] + assert len(a["ports"]) == 96 and a["roles"] == N and len(tape) == 4783 + assert tape[CUT] == ["A", "ADD", 10, 0, "2"] + assert all(row[:2] == [-1, 0] for row in a["diagonal"]) + counts = [(sum(row[2:10]), sum(row[10:])) for row in a["diagonal"]] + pre = tape[:CUT] + forward, inverse = {}, {} + for q in (1, -1): + forward[q] = [apply(pre, unit(i), q) for i in range(N)] + inverse[q] = [apply(pre, unit(i), q, inverse=True) for i in range(N)] + for i in range(N): + assert apply(pre, inverse[q][i], q) == unit(i) + assert apply(tape, unit(i), q) == [q * entry for entry in unit(i)] + cases = [] + ranks = Counter() + for a, b in combinations(range(N), 2): + x, y = counts[a] + u, v = counts[b] + before = sorted((1 + 8*(x+y), 1 + 8*(u+v))) + after = sorted((1 + 8*(x+v), 1 + 8*(u+y))) + assert sum(before) == sum(after) + if after[0] <= before[0]: + status = "tie" if after == before else "worse" + ranks[status] += 1 + cases.append([a, b, before, after, status, None]) + continue + ranks["profitable"] += 1 + vectors = {q: [x-y for x,y in zip(forward[q][a], forward[q][b], strict=True)] + for q in (1, -1)} + duals = {q: [col[a]-col[b] for col in inverse[q]] for q in (1, -1)} + for q in (1, -1): + assert sum(x*y for x,y in zip(vectors[q], duals[q], strict=True)) == 2 + # W - I = -(G d)(d^T G^-1), where d = e_a - e_b. + witness = None + for i, j in ((i, j) for i in range(N) for j in range(N)): + odd = vectors[-1][i]*duals[-1][j] - vectors[1][i]*duals[1][j] + if odd: + witness = [i, j, str(odd)] + break + status = "excluded" if witness else "survives" + cases.append([a, b, before, after, status, witness]) + ranks[status] += 1 + assert len(cases) == 630 + assert next(case for case in cases if case[:2] == [0, 9])[-1] == [0, 0, "4"] + neutral_plus = apply(pre, unit(0), 1) + assert neutral_plus == forward[1][0] + cost = run_path(str(HERE / "inputs/pricing.py"))["cost"] + quote = cost(Counter({73: 192, 137: -96, 9: -96}), Fraction(old["old_crossing_upper"])) + alarm(0) + print(dumps({"pins": PINS, "head": old["head"], "cut": CUT, + "counts": ranks, "budget_seconds": 30, "cases": cases, + "control_pair_0_9_upper": str(quote[1])}, indent=2, sort_keys=True)) + + +if __name__ == "__main__": + main() diff --git a/research/p104-signed-phase-leg-reuse-bound/engines/independent.py b/research/p104-signed-phase-leg-reuse-bound/engines/independent.py new file mode 100644 index 0000000000..8a3df049ff --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/engines/independent.py @@ -0,0 +1,149 @@ +"""Independent exact global signed reuse test for four J1/J17 leg pairs.""" +from fractions import Fraction as Q +from hashlib import sha256 +from itertools import combinations, product +from json import dumps, loads +from pathlib import Path +from runpy import run_path +from signal import SIGALRM, alarm, signal + +ROOT = Path(__file__).resolve().parent +PINS = { + "inputs/CALLER.json": "255d89f38cd45e38e5770f559bc43dc217e989032359768cdc7e8cdfd64b47bc", + "inputs/R193-PRICE.json": "1ad9852ecff0b3780770cbf4e500731e65214a9c438f8b1ed2c0cbe484d9b36b", + "inputs/forward.py": "75d94780f9db49a4b08bb0e7fb4bd7fc04adb8cabbf73d83a809179c04c3d439", + "inputs/reverse.py": "2faedaf76b8d1cc399294f5595862092de75ea1dd3a0ec41898a61edad006d53", +} +HEAD = "aaeec8c0acf01e99a5f331ef363a698d9c084ace" +CALLER = "07a76c5e2738882c0cb322278e56f6cae3c9885d" +N, SECONDS = 36,30 + + +def unique(items): + data = dict(items) + assert len(items) == len(data), "duplicate key" + return data + + +def read(path): + raw = (ROOT/path).read_bytes() + assert sha256(raw).hexdigest() == PINS[path], path + return raw + + +def stop(*_): + raise TimeoutError("30-second signed reuse cap") + + +def dot(a,b): + return sum(x*y for x,y in zip(a,b,strict=True) if x and y) + + +def plus(a,b,scale): + return [x+scale*y for x,y in zip(a,b,strict=True)] if scale else a.copy() + + +def take(factors,x): + for u,v in factors: + x = plus(x,u,dot(v,x)) + return x + + +def witness(columns,rows): + for i,j in combinations(range(N),2): + a,b = columns + if a[i]*b[j] == a[j]*b[i]: + continue + for k,l in combinations(range(N),2): + x,y = rows + if x[k]*y[l] == x[l]*y[k]: + continue + m = [[a[h]*x[g]+b[h]*y[g] for g in (k,l)] for h in (i,j)] + det = m[0][0]*m[1][1]-m[0][1]*m[1][0] + assert det and det == (a[i]*b[j]-a[j]*b[i])*(x[k]*y[l]-x[l]*y[k]) + return {"rows":[i,j],"columns":[k,l],"matrix":m,"determinant":det} + return None + return None + + +def main(): + assert __debug__ + signal(SIGALRM,stop) + alarm(SECONDS) + caller,price = [loads(read(name),object_pairs_hook=unique) for name in + ("inputs/CALLER.json","inputs/R193-PRICE.json")] + assert (price["head"],price["caller"]) == (HEAD,CALLER) + assert price["clocks"] == [43,137,268] and len(caller["types"]["A"]["ports"]) == 96 + assert price["new_rank8_children"] == 1200 and price["new_type_b_rank1_children"] == 48 + quote = [Q(v)/3-96 for v in price["price_by_type_a_rank1_per_port"]["0"]["raw_gross"]] + assert 50 < quote[0] <= quote[1] < 51 + read("inputs/forward.py") + read("inputs/reverse.py") + f = run_path(str(ROOT/"inputs/forward.py")) + r = run_path(str(ROOT/"inputs/reverse.py")) + unit,apply,cv = f["unit"],f["apply"],r["covector"] + tape = caller["events"] + assert len(tape)==4783 and caller["types"]["A"]["roles"]==N + factors, labels, queries = [], [], [] + for clock,event in enumerate(tape): + if event[0]=="J": + _, stage,(u,v,x,y),_ = event + legs = [(v,u,1),(x,y,-1)] + elif event[:2]==["A","QUERY"]: + _,_,v,u,exp = event + assert exp==-1 + queries.append(clock) + stage,legs = 0,[(v,u,1)] + else: + continue + for leg,(d,s,sign) in enumerate(legs): + before = tape[:clock] + out = [2*sign*x for x in apply(before,unit(d),-1,inverse=True)] + row = cv(before,unit(s),-1) + assert dot(row,out)==0 + factors.append((out,row)) + labels.append([clock,stage,leg,d,s,sign]) + assert len(factors)==38 and queries==[1516,1580,1659,1721] + for i in range(N): + e = unit(i) + assert take(factors,e)==[-v for v in e] + assert apply(tape,e,1)==e and apply(tape,e,-1)==[-v for v in e] + early = [i for i,label in enumerate(labels) if label[1]==1] + late = [i for i,label in enumerate(labels) if label[1]==17] + assert len(early)==len(late)==2 + assert [labels[i][:2] for i in early+late] == [[43,1],[43,1],[4691,17],[4691,17]] + results = [] + for a,b in product(early,late): + between = factors[a+1:b] + ua,va = factors[a] + ub,vb = factors[b] + u = take(between,ua) + v = va.copy() + for ui,vi in between: + v = plus(v,vi,-dot(v,ui)) + assert dot(u,v)==0 + u = plus(u,ub,dot(vb,u)) + proof = witness((u,ub),(v,vb)) + results.append({"factor_pair":[a,b],"early":labels[a],"late":labels[b], + "intervening_count":len(between),"rank_two_minor":proof, + "column_factors":[u,ub],"row_factors":[v,vb]}) + for i in range(N): + e = unit(i) + for j,(uj,vj) in enumerate(factors): + if j==a: + continue + if j==b: + e = plus(plus(e,u,dot(v,e)),ub,dot(vb,e)) + else: + e = plus(e,uj,dot(vj,e)) + assert e==[-x for x in unit(i)] + alarm(0) + print(dumps({"head":HEAD,"caller":CALLER,"pins":PINS,"phases":[1,-1],"basis_columns":N, + "runner_cap_seconds":SECONDS,"factor_count":len(factors),"factor_labels":labels, + "old_relative_endpoint":"-I","price":quote,"pairs":results, + "survivors":[r["factor_pair"] for r in results if not r["rank_two_minor"]]}, + indent=2,sort_keys=True,default=str)) + + +if __name__=="__main__": + main() diff --git a/research/p104-signed-phase-leg-reuse-bound/engines/lead.py b/research/p104-signed-phase-leg-reuse-bound/engines/lead.py new file mode 100644 index 0000000000..8e74f0bcdf --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/engines/lead.py @@ -0,0 +1,91 @@ +"""Try fusing one first-J and one final-J relative rank-one shear.""" +from fractions import Fraction as Q +from hashlib import sha256 +from json import dumps,loads +from pathlib import Path +from runpy import run_path +from signal import SIGALRM,alarm,signal + +ROOT=Path(__file__).resolve().parent + + +def dot(a,b): + return sum(x*y for x,y in zip(a,b,strict=True) if x and y) + + +def add(a,b,coef): + return [x+coef*y for x,y in zip(a,b,strict=True)] + + +def stop(*_): + raise TimeoutError("30-second global phase reuse cap") + + +def main(): + assert __debug__ + signal(SIGALRM,stop) + alarm(30) + pins={} + for line in (ROOT/"PINS").read_text().splitlines(): + h,name=line.split() + assert name not in pins and sha256((ROOT/name).read_bytes()).hexdigest()==h + pins[name]=h + f=run_path(str(ROOT/"forward.py")) + rank=run_path(str(ROOT/"rank_gate.py"))["rank"] + assert pins["inputs/CALLER.json"]==f["PINS"]["inputs/CALLER.json"] + unit,apply=f["unit"],f["apply"] + tape=loads((ROOT/"inputs/CALLER.json").read_bytes())["events"] + price=loads((ROOT/"inputs/R193.json").read_bytes()) + credit=[Q(x)-96 for x in price["per_host_before_new_A_channels"]] + assert credit[0]>0 and credit[1]<96 + factors=[] + for clock,e in enumerate(tape): + if e[0]=="J": + a,b,c,d=e[2] + shears=[(b,a,1),(c,d,-1)] + elif e[:2]==["A","QUERY"]: + assert e[-1]==-1 + shears=[(e[2],e[3],1)] + else: + continue + prefix=tape[:clock] + columns=[apply(prefix,unit(i),-1) for i in range(36)] + for dst,src,coefficient in shears: + u=apply(prefix,unit(dst),-1,inverse=True) + v=[2*coefficient*column[src] for column in columns] + assert not dot(u,v) and apply(prefix,u,-1)==unit(dst) + factors.append((clock,dst,src,u,v)) + assert len(factors)==38 and [p[0] for p in factors[:2]+factors[-2:]]==[43,43,4691,4691] + for i in range(36): + x=unit(i) + for _,_,_,u,v in factors: + x=add(x,u,dot(v,x)) + assert x==[-v for v in unit(i)] + assert apply(tape,unit(i),1)==unit(i) + assert apply(tape,unit(i),-1)==[-v for v in unit(i)] + records=[] + for i in (0,1): + for j in (36,37): + a,b=factors[i],factors[j] + u,v=a[3:] + for _,_,_,x,y in factors[i+1:j]: + u=add(u,x,dot(y,u)) + v=add(v,y,-dot(v,x)) + assert not dot(u,v) + x,y=b[3:] + columns=[add([u_i*vi for u_i in u],x,yi+dot(y,u)*vi) + for vi,yi in zip(v,y,strict=True)] + r=rank(columns) + records.append({"legs":[a[:3],b[:3]],"rank":len(r),"pivots":r, + "delta":[[l,k,str(z)] for k,c in enumerate(columns) + for l,z in enumerate(c) if z]}) + alarm(0) + print(dumps({"pins":pins,"factors":len(factors),"old_endpoint":"-I", + "upper_gross_with_one_saved_leg":credit,"pair_cap":4, + "runner_cap_seconds":30,"records":records, + "survivors":[r["legs"] for r in records if r["rank"]<=1]}, + indent=2,sort_keys=True,default=str)) + + +if __name__=="__main__": + main() diff --git a/research/p104-signed-phase-leg-reuse-bound/engines/r193_reverse.py b/research/p104-signed-phase-leg-reuse-bound/engines/r193_reverse.py new file mode 100644 index 0000000000..42d5fd8e67 --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/engines/r193_reverse.py @@ -0,0 +1,161 @@ +"""Directly replay every maximal fixed-anchor interval of the 17 signed J calls.""" +from collections import Counter +from fractions import Fraction as Q +from hashlib import sha256 +from json import dumps, loads +from pathlib import Path +from runpy import run_path +from signal import SIGALRM, alarm, signal + +ROOT = Path(__file__).resolve().parent +PINS = { + "inputs/CALLER.json": "255d89f38cd45e38e5770f559bc43dc217e989032359768cdc7e8cdfd64b47bc", + "inputs/PRICE.json": "1ad9852ecff0b3780770cbf4e500731e65214a9c438f8b1ed2c0cbe484d9b36b", + "inputs/pricing.py": "f4d0b6c9314b838d882d6d06020f24881c19a3fda97a7c00df87b1e920785182", +} +LOWER = Q("0.00364665195644044790699554028334161") +BIT_CAP = Q("0.00376669") +N = 36 + + +def unique(pairs): + d = dict(pairs) + assert len(d) == len(pairs) + return d + + +def checked(name): + data = (ROOT / name).read_bytes() + assert sha256(data).hexdigest() == PINS[name], name + return data + + +def add(row, source, amount): + for j,v in source.items(): + value = row.get(j, 0) + amount*v + if value: + row[j] = value + else: + row.pop(j,None) + + +def propagate(matrix, e, q): + if e[0] == "J": + x,y,u,v = e[2] + add(matrix[y], matrix[x], q) + add(matrix[u], matrix[v], -q) + return + assert e[0] == "A" + op,dst = e[1:3] + if op == "ADD": + add(matrix[dst], matrix[e[3]], Q(e[4])) + elif op == "QUERY": + add(matrix[dst], matrix[e[3]], Q(q)**e[4]) + elif op == "SCALE": + amount = Q(e[3]) + assert amount + matrix[dst] = {j: amount*v for j,v in matrix[dst].items()} + elif op == "SWAP": + src = e[3] + matrix[dst],matrix[src] = matrix[src],matrix[dst] + else: + assert op in ("IDLE_ONE","LAMBDA") + + +def pivots(rows): + basis = {} + witnesses = [] + for i,row in enumerate(rows): + work = row.copy() + while work: + j = min(work) + if j not in basis: + basis[j] = work + witnesses.append((i,j,work[j])) + break + add(work, basis[j], -work[j]/basis[j][j]) + return witnesses + + +def stop(*_): + raise TimeoutError("60-second exact window cap") + + +def main(): + assert __debug__ + signal(SIGALRM, stop) + alarm(60) + caller = loads(checked("inputs/CALLER.json"),object_pairs_hook=unique) + preflight = loads(checked("inputs/PRICE.json"),object_pairs_hook=unique) + checked("inputs/pricing.py") + engine = run_path(str(ROOT / "inputs/pricing.py"))["cost"] + events = caller["events"] + clocks = [t for t,e in enumerate(events) if e[0]=="J"] + assert len(events)==4783 and len(clocks)==17 and clocks[:3]==preflight["clocks"]==[43,137,268] + assert [events[t][1] for t in clocks]==list(range(1,18)) + assert caller["types"]["A"]["roles"] == N and len(caller["types"]["A"]["ports"])==96 + assert len(caller["types"]["B"]["ports"])==8 + ends = [t-1 for t in clocks[1:]] + [len(events)-1] + total = [(i,j) for i in range(17) for j in range(i,17)] + terms = Counter({int(r): n for r,n in preflight["per_J_old_P"].items()}) + terms.subtract({int(r): n for r,n in preflight["per_J_old_helper_T"].items()}) + terms.subtract({1:16,8:400}) + crossing = Q(preflight["exact_crossing_upper"]) + exact = engine(terms,crossing) + pos = {r:n for r,n in terms.items() if n>0} + neg = {r:n for r,n in terms.items() if n<0} + uniform_upper = engine(pos,LOWER)[1] + engine(neg,BIT_CAP)[1] + uniform_lower = engine(pos,BIT_CAP)[0] + engine(neg,LOWER)[0] + assert uniform_lower < exact[0] <= exact[1] < uniform_upper < 149 + assert len(pivots([{0:Q(1),1:Q(2)},{0:Q(2),1:Q(4)}]))==1 + cases = [] + capped = False + try: + for first in range(17): + start = 0 if first==0 else clocks[first-1]+1 + forward = {q:[{i:Q(1)} for i in range(N)] for q in (1,-1)} + retained = 0 + last = first + for t in range(start,len(events)): + e = events[t] + if e[0] in ("J","A"): + for q,mat in forward.items(): + propagate(mat,e,q) + retained += e[:2]==["A","QUERY"] + if t != ends[last]: + continue + rows = [row.copy() for row in forward[1]] + for row,minus in zip(rows,forward[-1],strict=True): + add(row,minus,-1) + proof = pivots(rows) + rank = len(proof) + required = max(0,rank-retained) + stages = last-first+1 + gross = [stages*value-96*required for value in exact] + cases.append({"first_last":[first+1,last+1],"clocks":[start,t], + "required_phase_rank":rank,"retained_queries_per_port":retained, + "new_queries_lower_per_port":required,"rank_pivots":proof, + "incumbent_gross_interval":gross, + "uniform_gross_upper":stages*uniform_upper-96*required}) + if last==16: + break + last+=1 + except TimeoutError: + capped=True + finally: + alarm(0) + assert [(r["first_last"][0]-1,r["first_last"][1]-1) for r in cases]==total[:len(cases)] + assert capped or len(cases)==153 + print(dumps({"pins":PINS,"unit_bodies":True,"signs":[1,-1],"stage_clocks":clocks, + "rows_per_matrix":N,"windows_total":153,"windows_checked":len(cases),"capped":capped, + "unresolved_keys":[[i+1,j+1] for i,j in total[len(cases):]], + "per_stage_gross_interval_at_crossing_upper":exact, + "per_stage_uniform_lower_upper":[uniform_lower,uniform_upper], + "uniform_kappa_interval":[LOWER,BIT_CAP],"cap_seconds":60,"cases":cases}, + default=str,sort_keys=True,indent=2)) + if capped: + raise SystemExit(2) + + +if __name__ == "__main__": + main() diff --git a/research/p104-signed-phase-leg-reuse-bound/engines/rank_gate.py b/research/p104-signed-phase-leg-reuse-bound/engines/rank_gate.py new file mode 100644 index 0000000000..8ed714b15c --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/engines/rank_gate.py @@ -0,0 +1,56 @@ +from hashlib import sha256 +from json import dumps,loads +from pathlib import Path +from runpy import run_path +from signal import SIGALRM, alarm, signal + +ROOT=Path(__file__).resolve().parent + + +def stop(*_): + raise TimeoutError("20-second exact gate") + + +def rank(rows): + piv={} + for row in rows: + r=row.copy() + for k,v in sorted(piv.items()): + if r[k]: + r=[x-r[k]*y for x,y in zip(r,v,strict=True)] + k=next((i for i,x in enumerate(r) if x),None) + if k is not None: + piv[k]=[x/r[k] for x in r] + return sorted(piv) + + +def main(): + assert __debug__ + signal(SIGALRM,stop) + alarm(20) + pins={} + for line in (ROOT/"PINS").read_text().splitlines(): + h,p=line.split() + assert p not in pins and sha256((ROOT/p).read_bytes()).hexdigest()==h + pins[p]=h + assert pins["inputs/PRICE.json"]=="1ad9852ecff0b3780770cbf4e500731e65214a9c438f8b1ed2c0cbe484d9b36b" + f=run_path(str(ROOT/"forward.py")) + assert pins["inputs/CALLER.json"]==f["PINS"]["inputs/CALLER.json"] + c=loads((ROOT/"inputs/CALLER.json").read_bytes()) + tape=c["events"][43:269] + assert [(43+i,e[1]) for i,e in enumerate(tape) if e[0]=="J"]==[(43,1),(137,2),(268,3)] + unit,apply=f["unit"],f["apply"] + cols={q:[apply(tape,unit(i),q) for i in range(36)] for q in (1,-1)} + assert all(apply(tape,col,q,inverse=True)==unit(i) for q,xs in cols.items() for i,col in enumerate(xs)) + diff=[[x-y for x,y in zip(a,b,strict=True)] for a,b in zip(cols[1],cols[-1],strict=True)] + piv=rank(diff) + assert rank([unit(i) for i in range(4)])==list(range(4)) + alarm(0) + print(dumps({"pins":pins,"rank":len(piv),"rank_cap":4,"pivot_rows":piv, + "clock_window_inclusive":[43,268],"unit_bodies":True,"signs":[1,-1], + "basis_columns":36,"seconds_cap":20,"delta_entries":[[i,j,str(x)] for j,v in enumerate(diff) + for i,x in enumerate(v) if x]},indent=2,sort_keys=True)) + + +if __name__=="__main__": + main() diff --git a/research/p104-signed-phase-leg-reuse-bound/engines/reverse.py b/research/p104-signed-phase-leg-reuse-bound/engines/reverse.py new file mode 100644 index 0000000000..f2ee99c8d4 --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/engines/reverse.py @@ -0,0 +1,148 @@ +"""Reverse-covector check of a Type A late-mask reassignment at one seam.""" +from fractions import Fraction as Q +from hashlib import sha256 +from json import dumps, loads +from pathlib import Path +from signal import SIGALRM, alarm, signal + +HERE = Path(__file__).resolve().parent +PINS = {"inputs/CALLER.json": "255d89f38cd45e38e5770f559bc43dc217e989032359768cdc7e8cdfd64b47bc"} +HEAD = "aaeec8c0acf01e99a5f331ef363a698d9c084ace" +CALLER = "07a76c5e2738882c0cb322278e56f6cae3c9885d" +CUT = 1741 +ROOTS = (0, 9) +N = 36 + + +def read(name): + raw = (HERE/name).read_bytes() + assert sha256(raw).hexdigest() == PINS[name] + return loads(raw) + + +def basis(index): + return [Q(j == index) for j in range(N)] + + +def swap(row): + a, b = ROOTS + out = row[:] + out[a], out[b] = out[b], out[a] + return out + + +def covector(events, row, q, invert=False): + # If the event product is O_n ... O_1, a row covector acts on it + # from n to 1 and on its inverse from 1 to n. + result = row[:] + direction = -1 if invert else 1 + for event in events if invert else reversed(events): + kind = event[0] + if kind == "B": + continue + if kind == "J": + _, _, (u, v, x, y), _ = event + result[u] += direction*q*result[v] + result[y] -= direction*q*result[x] + continue + assert kind == "A" + _, op, dest, *args = event + if op == "ADD": + src, a = args + result[src] += direction*Q(a)*result[dest] + elif op == "QUERY": + src, exponent = args + assert exponent == -1 + result[src] += direction*q*result[dest] + elif op == "SCALE": + a, = args + result[dest] *= Q(a)**direction + elif op == "SWAP": + src, = args + result[dest], result[src] = result[src], result[dest] + elif op == "IDLE_ONE": + assert args[0] + else: + assert op == "LAMBDA" and args[0] in (1, -1) + return result + + +def nonzero(matrix): + return [[i, j, str(value)] for i, row in enumerate(matrix) + for j, value in enumerate(row) if value] + + +def row_mul(row, matrix): + return [sum(a*b for a, b in zip(row, col, strict=True) if a and b) + for col in zip(*matrix, strict=True)] + + +def stop(*_): + raise TimeoutError("20-second exact seam cap") + + +def main(): + assert __debug__ + signal(SIGALRM, stop) + alarm(20) + c = read("inputs/CALLER.json") + assert c["types"]["A"]["roles"] == N + assert c["types"]["A"]["alpha2"] == "-1" + tape = c["events"] + assert len(tape) == 4783 and tape[CUT] == ["A", "ADD", 10, 0, "2"] + pre, post = tape[:CUT], tape[CUT:] + for events, stages, query_count in ((pre, set(range(1, 9)), 4), + (post, set(range(9, 18)), 0)): + assert sorted(event[1] for event in events if event[0] == "J") == sorted(stages) + assert sum(event[:2] == ["A", "QUERY"] for event in events) == query_count + assert all(set(event[3]) <= stages for event in events if event[:2] == ["A", "IDLE_ONE"]) + targets = c["types"]["A"]["diagonal"] + assert len(targets) == N and all(d[:2] == [-1, 0] for d in targets) + masks = [[sum(targets[i][2:10]), sum(targets[i][10:])] for i in ROOTS] + assert masks == [[8, 9], [0, 1]] + + seam, boundary = {}, {} + prefix = {} + + for q in (1, -1): + g = [covector(pre, basis(i), q) for i in range(N)] + prefix[q] = nonzero(g) + + w = [covector(pre, swap(row), q, invert=True) for row in g] + for i, (g_row, w_row) in enumerate(zip(g, w, strict=True)): + assert covector(pre, g_row, q, invert=True) == basis(i) + assert covector(pre, w_row, q) == swap(g_row) + assert row_mul(w_row, w) == basis(i) + after_swap = covector(post, swap(basis(i)), q) + edited = covector(pre, row_mul(after_swap, w), q) + assert edited == [q*x for x in basis(i)] + assert covector(tape, basis(i), q) == edited + seam[q] = w + boundary[q] = { + "displacement_nonzeros": len(nonzero([[x-y for x, y in zip(row, basis(i), strict=True)] + for i, row in enumerate(w)])), + "seam_nonzeros": len(nonzero(w)), + } + + odd = [[a-b for a, b in zip(u, v, strict=True)] + for u, v in zip(seam[1], seam[-1], strict=True)] + witness = nonzero(odd) + # A wrong final readout with no output swap is exposed at unit bodies. + wrong = covector(pre, row_mul(covector(post, basis(ROOTS[0]), 1), seam[1]), 1) + assert wrong != basis(ROOTS[0]) + alarm(0) + print(dumps({ + "benchmark": HEAD, "caller": CALLER, "pins": PINS, "cut": CUT, + "roots": ROOTS, "central_signs": [1, -1], "basis_columns": N, + "early_late_body_counts": masks, "old_ranks": [137, 9], "new_ranks": [73, 73], + "q_even_at_real_pair": not witness, "odd_entries_count": len(witness), + "first_odd_entries": witness[:12], "boundary": boundary, + "seam_plus": nonzero(seam[1]), "seam_minus": nonzero(seam[-1]), + "prefix_plus": prefix[1], "prefix_minus": prefix[-1], + + "runner_cap_seconds": 20, "negative_control": "missing final output swap", + }, indent=2, sort_keys=True)) + + +if __name__ == "__main__": + main() diff --git a/research/p104-signed-phase-leg-reuse-bound/engines/triple_lead.py b/research/p104-signed-phase-leg-reuse-bound/engines/triple_lead.py new file mode 100644 index 0000000000..4fc741f303 --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/engines/triple_lead.py @@ -0,0 +1,110 @@ +"""Try fusing one first-J and one final-J relative rank-one shear.""" +from fractions import Fraction as Q +from hashlib import sha256 +from json import dumps,loads +from pathlib import Path +from runpy import run_path +from signal import SIGALRM,alarm,signal + +ROOT=Path(__file__).resolve().parent + + +def dot(a,b): + return sum(x*y for x,y in zip(a,b,strict=True) if x and y) + + +def add(a,b,coef): + return [x+coef*y for x,y in zip(a,b,strict=True)] + + +def stop(*_): + raise TimeoutError("40-second triple recombination cap") + + +def main(): + assert __debug__ + signal(SIGALRM,stop) + alarm(40) + pins={} + for line in (ROOT/"PINS").read_text().splitlines(): + h,name=line.split() + assert name not in pins and sha256((ROOT/name).read_bytes()).hexdigest()==h + pins[name]=h + f=run_path(str(ROOT/"forward.py")) + rank=run_path(str(ROOT/"rank_gate.py"))["rank"] + assert pins["inputs/CALLER.json"]==f["PINS"]["inputs/CALLER.json"] + unit,apply=f["unit"],f["apply"] + tape=loads((ROOT/"inputs/CALLER.json").read_bytes())["events"] + price=loads((ROOT/"inputs/R193.json").read_bytes()) + credit=[Q(x)-96 for x in price["per_host_before_new_A_channels"]] + assert credit[0]>0 and credit[1]<96 + factors=[] + for clock,e in enumerate(tape): + if e[0]=="J": + a,b,c,d=e[2] + shears=[(b,a,1),(c,d,-1)] + elif e[:2]==["A","QUERY"]: + assert e[-1]==-1 + shears=[(e[2],e[3],1)] + else: + continue + prefix=tape[:clock] + columns=[apply(prefix,unit(i),-1) for i in range(36)] + for dst,src,coefficient in shears: + u=apply(prefix,unit(dst),-1,inverse=True) + v=[2*coefficient*column[src] for column in columns] + assert not dot(u,v) and apply(prefix,u,-1)==unit(dst) + factors.append((clock,dst,src,u,v)) + assert len(factors)==38 and [p[0] for p in factors[:2]+factors[-2:]]==[43,43,4691,4691] + for i in range(36): + x=unit(i) + for _,_,_,u,v in factors: + x=add(x,u,dot(v,x)) + assert x==[-v for v in unit(i)] + assert apply(tape,unit(i),1)==unit(i) + assert apply(tape,unit(i),-1)==[-v for v in unit(i)] + from itertools import combinations + cases=[p for p in combinations(range(38),3) if p[0]<2 and p[-1]>=36] + assert len(cases)==140 + proper=[r for r in price["records"] if r["hosts"]!=[1,17]] + assert len(proper)==152 + assert all(r["rank"]==r["retained_QUERY"]+2*(r["hosts"][1]-r["hosts"][0]+1) + for r in proper) + records=[] + for case in cases: + transported=[] + last=case[-1] + for i in case: + u,v=factors[i][3:] + for j in range(i+1,last): + if j in case: + continue + x,y=factors[j][3:] + u=add(u,x,dot(y,u)) + v=add(v,y,-dot(v,x)) + assert not dot(u,v) + transported.append((u,v)) + cols=[] + for j in range(36): + basis=unit(j) + val=basis + for u,v in transported: + val=add(val,u,dot(v,val)) + cols.append(add(val,basis,-1)) + piv=rank(cols) + item={"case":case,"rank":len(piv),"pivots":piv, + "keys":[factors[i][:3] for i in case]} + if len(piv)<=2: + item["transported_factors"]=transported + item["delta"]=[[i,j,str(x)] for j,v in enumerate(cols) for i,x in enumerate(v) if x] + records.append(item) + alarm(0) + print(dumps({"pins":pins,"factors":len(factors),"old_endpoint":"-I", + "upper_gross_with_one_saved_leg":credit,"triple_cap":140, + "runner_cap_seconds":40,"records":records, + "survivors":[r["case"] for r in records if r["rank"]<=2]}, + indent=2,sort_keys=True,default=str)) + + +if __name__=="__main__": + main() diff --git a/research/p104-signed-phase-leg-reuse-bound/engines/triple_reverse.py b/research/p104-signed-phase-leg-reuse-bound/engines/triple_reverse.py new file mode 100644 index 0000000000..00b90921af --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/engines/triple_reverse.py @@ -0,0 +1,144 @@ +"""Exact rank-three certificates for every first/last-stage triple.""" +from collections import Counter +from fractions import Fraction as Q +from hashlib import sha256 +from itertools import combinations +from json import dumps, loads +from pathlib import Path +from runpy import run_path +from signal import SIGALRM, alarm, signal + +ROOT = Path(__file__).resolve().parent +HEAD = 'aaeec8c0acf01e99a5f331ef363a698d9c084ace' +CALLER = '07a76c5e2738882c0cb322278e56f6cae3c9885d' +N, CASES, SECONDS = 36, 140, 40 + + +def dot(a,b): + return sum(x*y for x,y in zip(a,b,strict=True) if x and y) + + +def add(a,b,c): + return [x+c*y for x,y in zip(a,b,strict=True)] if c else a[:] + + +def stop(*_): + raise TimeoutError('40-second triple rank cap') + + +def rank_indices(vectors): + rows, pivots, picked = [], [], [] + for i,v in enumerate(vectors): + w = v[:] + for j,row in zip(pivots,rows,strict=True): + w = add(w,row,-w[j]) + j = next((j for j,x in enumerate(w) if x),None) + if j is not None: + rows.append([x/w[j] for x in w]) + pivots.append(j) + picked.append(i) + return picked + + +def det3(m): + a,b,c = m + return a[0]*(b[1]*c[2]-b[2]*c[1])-a[1]*(b[0]*c[2]-b[2]*c[0])+a[2]*(b[0]*c[1]-b[1]*c[0]) + + +def verify_pins(): + pins = {} + for line in (ROOT/'PINS').read_text().splitlines(): + expected,path = line.split() + assert path not in pins and sha256((ROOT/path).read_bytes()).hexdigest()==expected + pins[path] = expected + return pins + + +def json_file(path): + return loads((ROOT/path).read_bytes()) + + +def transport(factors, chosen, idx): + u,v = factors[idx] + for j in range(idx+1,chosen[-1]): + if j in chosen: + continue + x,y = factors[j] + u,v = add(u,x,dot(y,u)),add(v,y,-dot(v,x)) + assert not dot(u,v) + return u,v + + +def main(): + assert __debug__ + signal(SIGALRM,stop) + alarm(SECONDS) + pins = verify_pins() + prior = json_file('inputs/R194-RESULT.json') + rank_predecessor = json_file('inputs/R193-RESULT.json') + assert (prior['head'],prior['caller'],prior['factor_count'])==(HEAD,CALLER,38) + assert (rank_predecessor['head'],rank_predecessor['caller'])==(HEAD,CALLER) + f = run_path(str(ROOT/'inputs/forward.py')) + r = run_path(str(ROOT/'inputs/reverse.py')) + unit,apply,cv = f['unit'],f['apply'],r['covector'] + tape = json_file('inputs/CALLER.json')['events'] + assert len(tape)==4783 + factors,labels = [],[] + for clock,event in enumerate(tape): + if event[0]=='J': + _,stage,(u,v,x,y),_ = event + legs = ((v,u,1),(x,y,-1)) + elif event[:2]==['A','QUERY']: + _,_,v,u,exp = event + assert exp==-1 + stage,legs = 0,((v,u,1),) + else: + continue + for leg,(d,s,sign) in enumerate(legs): + before = tape[:clock] + out = [2*sign*x for x in apply(before,unit(d),-1,inverse=True)] + row = cv(before,unit(s),-1) + assert not dot(row,out) + factors.append((out,row)) + labels.append([clock,stage,leg,d,s,sign]) + assert labels==prior['factor_labels'] + for i in range(N): + e = unit(i) + for u,v in factors: + e = add(e,u,dot(v,e)) + assert e==[-x for x in unit(i)] + triples = [t for t in combinations(range(38),3) if min(t)<2 and max(t)>=36] + assert len(triples)==CASES + cases,counts = [],Counter() + for triple in triples: + shifted = [transport(factors,triple,i) for i in triple] + columns = [u for u,_ in shifted] + rows = [] + for u,v in shifted: + w = v[:] + for x,y in zip(columns,rows): + w = add(w,y,dot(v,x)) + rows.append(w) + ri,ci = rank_indices(list(zip(*columns,strict=True))),rank_indices(list(zip(*rows,strict=True))) + case = {'triple':triple,'labels':[labels[i] for i in triple]} + if len(ri)==len(ci)==3: + minor = [[sum(columns[k][i]*rows[k][j] for k in range(3)) for j in ci] for i in ri] + det = det3(minor) + assert det + case.update(rank=3,minor={'rows':ri,'columns':ci,'matrix':minor,'determinant':det}) + else: + delta = [[sum(columns[k][i]*rows[k][j] for k in range(3)) for j in range(N)] for i in range(N)] + rank = len(rank_indices(delta)) + assert rank<=2 + case.update(rank=rank,transported_factors=shifted,delta_rows=delta) + counts[case['rank']]+=1 + cases.append(case) + alarm(0) + print(dumps({'head':HEAD,'caller':CALLER,'pins':pins,'factor_count':len(factors),'factor_labels':labels, + 'case_cap':CASES,'runner_cap_seconds':SECONDS,'counts':counts,'cases':cases, + 'survivors':[c['triple'] for c in cases if c['rank']<=2]}, + default=str,indent=2,sort_keys=True)) + + +if __name__ == '__main__': + main() diff --git a/research/p104-signed-phase-leg-reuse-bound/inputs/7113-SHA256.json b/research/p104-signed-phase-leg-reuse-bound/inputs/7113-SHA256.json new file mode 100644 index 0000000000..5a7d6b80dc --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/inputs/7113-SHA256.json @@ -0,0 +1,69 @@ +{ + "replay/supplier7108/CALLER.json": "9557f713ab4ffb91ede05e8a6d5668c694b9940fc16f2f2d657e2f2b2cac2d3f", + "replay/supplier7112/RESULT.json": "7b808ff32d9803084aaaf820cd172ddc9001c7aebbd17e0324e779abeff91b30", + "replay/supplier7112/WORD.json.gz": "fe0b1dc3049a6b72760a705af2e698e0e9998e969e19862a696eba63434eb233", + "replay/supplier7112/short-caller/DATA-PHASES.json": "c5916ff312678f12aba403847643fbbc29f643acec60bdf836fa56cd3e8251fa", + "replay/supplier7112/short-caller/ODD-LOCALIZED-GROUPING.json": "8aac6b3d9e528bffbcf411bbd300c8e0f0b7bf75da45ab12badf3f3530ffcbe2", + "replay/supplier7112/short-caller/ODD-UNIT-DYADIC-TAPES.json": "c3195057f7a6723a81172ed540d0f1c4ba699ff3cb8dc37cbde7bb481d9b976c", + "replay/supplier7112/short-caller/ODD-UNIT-PREFIX-CLOSURES.json": "3b953e5d3e83e7573a3e908a5a23edb78773d4d22816aca54f766f0f0e9f5403", + "replay/supplier7112/short-caller/SHORT-ADMISSION-PARTIAL.json": "7977815fe72382738727e3d550eea3bc735923c9c57968872d4f863cb39cd401", + "replay/supplier7112/short-caller/SHORT-CALLER-RAW-PRICE.json": "a4f83d65d250efb40f6506658374d7414afdde11c96eb88b7d2fbb182aa090c1", + "replay/supplier7112/short-caller/SHORT-CATALOGUE-0-1000.log": "a916a76627fb79bf606b22f857ca93db6342891fb2c85b20658b5002c359e422", + "replay/supplier7112/short-caller/SHORT-CATALOGUE-1000-2000.log": "da633bfa408e98a2f2a958262a09d5e4274a9b25f7b4a6a73df5a97f37338f79", + "replay/supplier7112/short-caller/SHORT-CATALOGUE-2000-3047.log": "e8d500c0261a4a9e0cf3da2838d82806ed497ab9cf57cb8620ca6debfb98525c", + "replay/supplier7112/short-caller/SHORT-PRECISION.json": "68a00d2b83ee2eb944d2e05fc7f32bc9aa37282c45b968f0ab6fd500659ac028", + "replay/supplier7112/short-caller/SHORT-TYPE-A-ROOT.json": "e9812d720942d8149c219dfa28c1081ff1d353529e5282ca4624a04233f38f88", + "replay/supplier7112/short-caller/admission-source/ARCHIVE-CHAIN.json": "6de95c4eb396e69883fbeeb3989782bbbe232c22644af1c804050badca10f456", + "replay/supplier7112/short-caller/admission-source/FULL-RESULT.json": "d9ba709fa5dcefffe3f3abdcf34600ce188224703cfd743e6db8b58ba4816cb7", + "replay/supplier7112/short-caller/admission-source/INDEPENDENT-NOTICE.md": "cadbc642ca84311d2c7a6cf704c7828cb4cf77e3c784b66e4c6e8a5c28002fb8", + "replay/supplier7112/short-caller/admission-source/INDEPENDENT-SOURCES.json": "dced1457df5230466ba6202fd6d4595bc2b7fb2a65302806bf2720b1837ff350", + "replay/supplier7112/short-caller/admission-source/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "replay/supplier7112/short-caller/admission-source/NATIVE-INPUTS.json": "9bb6c1567783661334d6c1d23f715ce5635cbbb513678819ab9e020a34c7e4c0", + "replay/supplier7112/short-caller/admission-source/NOTICE": "da12736e2e824167ff56f2ecb623a5f88f75a270410360890f61dffc33bab249", + "replay/supplier7112/short-caller/admission-source/data/bit-admission.json": "a46b6c6040f75184cab5467656811ad988c216e3bc8e44d595a5015b6e49620b", + "replay/supplier7112/short-caller/admission-source/data/caller.json": "3828d53e80ea97e8b866320f081af20b6b93bfebd58b95b56b85a7afe151af5e", + "replay/supplier7112/short-caller/admission-source/data/final.json.gz": "2b94953dc14a122e3ef089633f05b58ec689ec5156feb7c784ed3e137dc01883", + "replay/supplier7112/short-caller/admission-source/frozen/clifford_exact.py": "2982ead07721e83358dc67c6f49c2b4c16a236a6bebdfd72f58221be1f5d0962", + "replay/supplier7112/short-caller/admission-source/frozen/native_verify.py": "3049471905b47b385c88378a1a3be7a18b8858aadd035b8a6da2f4a03b470f38", + "replay/supplier7112/short-caller/admission-source/frozen/physical.py": "4e995d1158033d83bf69b671f23dc7924d66edbbe07623ba063ba7421234ea20", + "replay/supplier7112/short-caller/admission-source/frozen/verify_host3_odd.py": "e75ad2096ba2587d1dc9c8982b2c2eb7c6fd2636a80adcd943314ef2cf6fd258", + "replay/supplier7112/short-caller/admission-source/independent.py": "21f46a8340331abb1486b50bd4e04453f1968b0a5950d86ff7780dd368590874", + "replay/supplier7112/short-caller/admission-source/interval_gate.py": "60a743d13f668ef86db4b8215b4d5d04430a671ba6f1fe06d9c1c4c3dfe86da5", + "replay/supplier7112/short-caller/admission-source/precision_replay.py": "850d9098c5946ab27ef5228acc54d59df2196e72259d3e21588ec0c319c8f5ee", + "replay/supplier7112/short-caller/admission-source/retained/odd-native-common-grid/independent_bounds.py": "198521def614fe78fa728f1dde2b7fb820c0c0e0ac3ad0c9224dccbf51eac0d5", + "replay/supplier7112/short-caller/admission-source/retained/query-only-precision-envelope/envelopes.py": "783da6b5b450fc07434946cb9ec86070dfee01df6b5fa1c385cb024def2c9a9f", + "replay/supplier7112/short-caller/admission-source/retained/query-only-precision-envelope/source_binding.py": "624c459311c58f3847b7713b818bfd340153abf42919f02ac9aa8892ed52a2bd", + "replay/supplier7112/short-caller/assemble_odd_application.py": "6cdac39ab196a70c53ba2283c2555cd8dee30644dcc4769628b46fb53bd55a1f", + "replay/supplier7112/short-caller/candidate_gate.py": "e71097ca81a082afd7c647324a6c94cb357aeb1084693a095a0f3e0b45a9b11a", + "replay/supplier7112/short-caller/check_odd_caller_exact_grid.py": "abd5a5fd011b71e5b382cbc058855594d4f2fe7b049f375506675c0303180f54", + "replay/supplier7112/short-caller/check_odd_fixed_tape_counts.py": "e6246e9f8fbeae3077d82e585eafd3647c1a8758c58f33c7c13e7efa6c1e42bb", + "replay/supplier7112/short-caller/check_odd_partial_admission.py": "4416b1ea5f07f8a91028a2e500116588fbdfaed95a8ef9bac7a46bcb44b9478e", + "replay/supplier7112/short-caller/check_odd_physical_binding.py": "5c80c3b0415a7f91d216395248dd6f13297eed637732098e1ca8fb0548951b98", + "replay/supplier7112/short-caller/check_odd_precision.py": "b2d9c13577158157a587ace766d9dadb7819a0164b372722329d9754e1be6c61", + "replay/supplier7112/short-caller/connected.py": "469537b46fb92c5aca926d3b1497da5425408673b0a73ba1427f23d872b414e7", + "replay/supplier7112/short-caller/cut_library.py": "7ccb81af19db54ec7cdb44849af018d4ca8893f80f17277914f8566715985133", + "replay/supplier7112/short-caller/emit_odd_type_ab.py": "7a7993648433c6febad8c07b315aec1b96598835a3f587b62040423c33c3b71f", + "replay/supplier7112/short-caller/emit_odd_type_b.py": "d1fa8b67d98beacd6bb574b3d5fcbc94b8646a7ffbce91d2a6fd4d690d3c5329", + "replay/supplier7112/short-caller/host34.py": "bded1a8626d65ee40c4ba3b25780fc03f0fa08906f3c83f631892df072d9a9b7", + "replay/supplier7112/short-caller/independent.py": "21f46a8340331abb1486b50bd4e04453f1968b0a5950d86ff7780dd368590874", + "replay/supplier7112/short-caller/interval_gate.py": "60a743d13f668ef86db4b8215b4d5d04430a671ba6f1fe06d9c1c4c3dfe86da5", + "replay/supplier7112/short-caller/lower.py": "67345fdfc8e5bb816e24b37dfafad0396372c48ec4e1b95b8b69f019a8fdfdee", + "replay/supplier7112/short-caller/mirrored.py": "55dd441a3a7f504b351857d45fd701994a0950ae1baec6c4c2b4b0166fb69db3", + "replay/supplier7112/short-caller/odd_unit_dyadic_tapes.py": "3cdafa35635360a487ce400ec8d585f6134dd7c58209543528e98e7db178bbc7", + "replay/supplier7112/short-caller/screen.py": "01e3eaba4b710a080e6e393e53157e6a119fdf312620eed26e9185ca91f6bea6", + "replay/supplier7112/short-caller/short_dyadic_seam.py": "6e588b365618ab2df4fa2d1f16073d09a953a7cd6e826e1f96bbf87f950b672b", + "replay/supplier7112/short-caller/short_native_catalogue.py": "775695c379f407801910531565cc371012cee501b2cec5f5d718ecdccf06b64d", + "replay/supplier7112/short-caller/signed_child.py": "ef03444360f02225138be9b38e2f9a85f313eeaa910d63a365de0f16d228cb8b", + "replay/supplier7112/short-caller/signed_model.py": "f88c798b9a22c656ea0b755b4f32be411c1f80687dff1a1ac9e9c2a0b5f4203e", + "replay/supplier7112/short-caller/stage.py": "0ab5546e926dd98d3ad833909b534840b7d8d0467c4790ca09bc2b14b37313f5", + "replay/supplier7112/short-caller/upstream_application.py": "d98987db98553dc55bfc80e3ca47abfcd51c57af6f8cda61101391d8eae94184", + "replay/supplier7112/short-caller/upstream_native_catalogue.py": "6120e1ea1e07eeba757694d209437a38f121b0a377cc466889a30fa52c561472", + "expected/ODD-8X9-APPLICATION-CHECKS.json": "10512d62f540fe7bb839ec94b6a21bbdf4a3dfadf56b4ec9095d4b242bda19b8", + "expected/ODD-ADMISSION-PARTIAL.json": "75ec76e4393ef1622fcff9e2727dc411921076af4a506d97506665add140fa86", + "expected/ODD-CALLER-EXACT-GRID.json": "87d25d9fa3778bf4784e3a9e17f32ce5ba372663c6e97392cc62b87e6719042c", + "expected/ODD-FIXED-TAPE-COUNTS.json": "1a8bf36a966edca8c61f3be803cdbe136307095dec40245cdc93e79a9062fe99", + "expected/ODD-PHYSICAL-BINDING.json": "ade5f8cbb2e30677b1d48d23a1aa270b3d0b72e2504472ab9fdb71d124b075b5", + "expected/ODD-PRECISION.json": "9c03607288cc2afb80cb02c197f93360978233036418b32b09ad91be16f9c153", + "expected/ODD-TYPE-AB-CALLER.json": "255d89f38cd45e38e5770f559bc43dc217e989032359768cdc7e8cdfd64b47bc", + "expected/ODD-TYPE-AB-REPLAY.json": "71fd0a7ad8b743266c6a75100f3543b48ea7d6fcbe45f008d3b61270e3b660a0" +} diff --git a/research/p104-signed-phase-leg-reuse-bound/inputs/7113-application.py b/research/p104-signed-phase-leg-reuse-bound/inputs/7113-application.py new file mode 100644 index 0000000000..1a6d358cbe --- /dev/null +++ b/research/p104-signed-phase-leg-reuse-bound/inputs/7113-application.py @@ -0,0 +1,369 @@ +#!/usr/bin/env python3 +"""Exact-source caller geometry, occurrence allocation and rational BIT frames. + +No contributor scientific module is imported. Complex phase-polynomial +method credited to the retained fragment physical audit; here coefficients +of the full degree-two polynomial are constructed instead of probing it. +OpenAI Codex assistance for Douglas Colkitt. Apache-2.0. +""" +from collections import Counter +from copy import deepcopy +from fractions import Fraction as Q +from hashlib import sha256 +from pathlib import Path +import gzip +import json + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[3] + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def read(path): + raw = (ROOT / path).read_bytes() + pin = next(p for p in json.loads((HERE / 'SOURCES.json').read_text())['files'] + if p['path'] == path) + need(sha256(raw).hexdigest() == pin['sha256'], 'source bytes: ' + path) + return json.loads(gzip.decompress(raw) if path.endswith('.gz') else raw) + + +def digest(value): + return sha256(json.dumps(value, sort_keys=True, separators=(',', ':')).encode()).hexdigest() + + +def bits(n): + result = [] + while n: + a = n & -n + result.append(a) + n ^= a + return result + + +def dot(a, b): + return (a & b).bit_count() % 2 + + +def terms(items): + c = Counter() + for v, a in items: + c[v] += a + return {v: a % 4 for v, a in c.items() if v and a % 4} + + +def sub(a, b): + return terms(list(a.items()) + [(v, -c) for v, c in b.items()]) + + +def polynomial(t): + # parity(sum x_i) = sum x_i - 2 sum_{i 0, 'positive complete helper job') + T[rank] += 1 + need(len(mapping) == len(set(mapping.values())) == word['public'], 'injective native inputs') + for r in range(word['public'], word['public']+word['owned_fields']): + mapping[r] = ('owned', ci, r-word['public']) + need(len(set(mapping.values())) == word['public']+51, 'owned/public separation') + for ni, move in native_moves: + _, r, start, end, owned = move + rank = abs(len(word['frames'][end])-len(word['frames'][start])) + need(owned == (r >= word['public']) and rank > 0, 'actual paid owner class') + P[rank] += 1 + occurrences.append([ci, ni, list(mapping[r]), rank, start, end]) + for pi, q in enumerate(word['ports']): + transform = route(q, by_q[q], stage) + before_axes = [1 << j for j in range(9+8*(stage-1))] + after_axes = [1 << j for j in range(9+8*stage)] + spectator = [1 << j for j in range(9, 9+8*stage)] + x0 = terms((a, 1) for a in before_axes) + y0 = terms(list(x0.items())+[(q, -1)]) + x1 = terms((a, 1) for a in after_axes) + y1 = terms(list(x1.items())+[(q, -1)]) + nx0 = terms([(a, 1) for a in spectator]+[(q, 1)]) + ny0 = terms((a, 1) for a in spectator) + nx1 = terms((a, 1) for a in spectator+[1 << j for j in range(9)]) + ny1 = terms(list(nx1.items())+[(q, -1)]) + shifts = [boundary(a, b, transform) for a, b in + ((x0, nx0), (y0, ny0), (nx1, x1), (ny1, y1))] + body = terms((1 << j, 1) for j in range(9+8*(stage-1), 9+8*stage)) + for actual, expected in ((sub(x1,x0),body), (sub(y1,y0),body), + (sub(y1,x0),terms(list(body.items())+[(q,-1)])), + (sub(x1,y0),terms(list(body.items())+[(q,1)]))): + need(not polynomial(sub(actual,expected)), 'all four contact operators') + need(polynomial(sub(terms([(q,1)]),terms([(q,-1)]))), 'wrong query orientation rejected') + phase_records.append([ci,pi,shifts,2 if pi in second else 1]) + else: + ty, op, r, *a = e + kind = caller['types'][ty] + used = [r] + ([a[0]] if op in ('ADD','SWAP','QUERY') else []) + need(all(kind['offset'] <= x < kind['offset']+kind['roles'] for x in used), 'caller owners stay in type') + need(len(used) == len(set(used)), 'distinct scalar/query owners') + if op in ('QUERY','IDLE_ONE'): + if op == 'QUERY': + need(a[1] in (-1,1), 'signed completed query') + rank = 1; query_uses += len(kind['ports']) + else: + selected = a[0] + need(selected and len(selected)==len(set(selected)) + and all(1 <= s <= 18 for s in selected), 'whole idle stage axes') + rank = 8*len(selected); idle_uses += len(kind['ports']) + for pi in kind['ports']: + owner = ['query_scratch',ci,pi] if op == 'QUERY' else ['main',pi,r] + occurrences.append([ci,op,owner,rank]); P[rank] += 1 + elif op == 'LAMBDA': + need(a[0] in (-1,1), 'global normalizer sign') + lambda_uses += len(kind['ports']) + need(stage_order == list(range(1,19)), 'fresh chronological native stages') + for kind in caller['types'].values(): + for diagonal in kind['diagonal']: + qp, zero, *selection = diagonal + need(qp in (-1,0,1) and zero == 0 and len(selection)==18 + and set(selection)<={0,1} and any(selection), 'positive nonempty root endpoint') + rank = abs(qp)+8*sum(selection) + for pi in kind['ports']: + q = word['ports'][pi] + axes = [1 << (9+8*j+k) for j,yes in enumerate(selection) if yes for k in range(8)] + actual = terms([(q,qp)]+[(a,1) for a in axes]) + target = terms((a,1) for a in ([q] if qp else [])+axes) + need(translation(sub(target,actual)) == (q if qp == -1 else 0), 'whole output correction') + T[rank] += 1 + for name, actual in [('P',P),('T',T)]: + need(actual == Counter({int(k):v for k,v in receipt['invoice'][name].items()}), 'independent '+name+' invoice') + need(sum(T.values()) == len(owners), 'every productive target is one actual owner') + need(len(occurrences) == sum(P.values()), 'every paid position retained in order') + return dict(ambient=153, native_calls=18, native_public=1480, fresh_helpers=19440, + productive_fields=len(owners), paid_positions=len(occurrences), + complete_paid_position_digest=digest(occurrences), + native_contact_boundaries=sum(4*r[3] for r in phase_records), + phase_record_digest=digest(phase_records), nonzero_boundary_translations=sum(sum(bool(x) for x in r[2])*r[3] for r in phase_records), + reserved_native_banks=18*51, reserved_serial_query_lambda_bank=1, + query_uses=query_uses, idle_uses=idle_uses, lambda_uses=lambda_uses, + paid=dict(sorted(P.items())), targets=dict(sorted(T.items())), + rank_surplus=sum(r*T[r] for r in T)-sum(r*P[r] for r in P)) + + +def inverse(matrix): + n = len(matrix) + a = [[Q(x) for x in row]+[Q(i==j) for j in range(n)] for i,row in enumerate(matrix)] + det = Q(1) + for j in range(n): + pivot = next((i for i in range(j,n) if a[i][j]),None) + need(pivot is not None, 'rational basis invertible') + if pivot != j: + a[j],a[pivot] = a[pivot],a[j]; det = -det + v = a[j][j]; det *= v; a[j] = [x/v for x in a[j]] + for i in range(n): + if i != j: + v = a[i][j] + a[i] = [x-v*y for x,y in zip(a[i],a[j])] + return [row[n:] for row in a], det + + +def bit_application(word, caller, receipt): + ff = word['frames']; determinants=[]; denominator_witnesses=set() + for label, frame in ff.items(): + B,A = frame['B'],frame['A']; d = frame['dim'] + need(len(B)==d and len(A)==8-d and all(len(v)==8 for v in B+A), 'rational frame dimensions') + need(all(sum(Q(x)*Q(y) for x,y in zip(b,a))==0 for b in B for a in A), 'complement annihilation') + inv, det = inverse(list(zip(*(B+A)))) + determinants.append([label,str(det)]) + denominator_witnesses.add(abs(det.numerator)); denominator_witnesses.add(det.denominator) + for row in inv: + denominator_witnesses.update(x.denominator for x in row) + for row in B+A: + denominator_witnesses.update(Q(x).denominator for x in row) + charts=[] + for port in range(111): + head=ff[str(word['start'][port])]; body=ff[str(word['final'][port+111])] + need(head['dim']==1 and body['dim']==7, 'actual main head/body ranks') + u=head['B'][0] + need(all(sum(Q(x)*Q(y) for x,y in zip(u,v))==0 for v in body['B']), 'main complement') + inv,det=inverse(list(zip(*([u]+body['B'])))) + charts.append([port,str(det)]) + denominator_witnesses.update([abs(det.numerator),det.denominator]) + for row in inv:denominator_witnesses.update(x.denominator for x in row) + P,T=Counter(),Counter(); positions=[]; names={('main',pi,r) for pi in range(111) for r in range(38)} + calls=[] + for ci,e in enumerate(caller['events']): + op=e[0] + if op=='LOCAL': + _,stage,src,dst=e; calls.append(stage) + mapping={i:('main',i,src) for i in range(111)} + mapping.update({i+111:('main',i,dst) for i in range(111)}) + for r in range(222,word['public']): + owner=('helper',ci,r); need(owner not in names,'fresh BIT helper');names.add(owner);mapping[r]=owner + T[abs(ff[str(word['start'][r])]['dim']-ff[str(word['final'][r])]['dim'])]+=1 + need(len(mapping)==len(set(mapping.values()))==659,'injective BIT occurrence') + for r in range(659,659+word['owned_fields']):mapping[r]=('owned',ci,r-659) + for ni,move in enumerate(word['program']): + if move[0]=='MOVE': + _,r,a,b=move;rank=abs(ff[str(a)]['dim']-ff[str(b)]['dim']) + P[rank]+=1;positions.append([ci,ni,list(mapping[r]),rank,a,b]) + elif op=='QUERY': + need(e[1]!=e[2] and 0<=min(e[1:])<=max(e[1:])<38,'BIT query owners') + for pi in range(111):P[1]+=1;positions.append([ci,op,['query_scratch',ci,pi],1]) + elif op=='IDLE_ONE': + _,owner,ss=e;need(ss and len(ss)==len(set(ss)) and all(1<=s<=18 for s in ss),'BIT idle axes') + for pi in range(111):P[7*len(ss)]+=1;positions.append([ci,op,['main',pi,owner],7*len(ss)]) + need(calls==[s for s in range(1,19) for _ in range(2)],'paired native chronology') + for d in caller['diagonal']: + need(d['q']==1 and d['stages'] and len(d['stages'])==len(set(d['stages'])),'BIT positive endpoint') + T[1+7*len(d['stages'])]+=111 + need(P==Counter({int(k):v for k,v in receipt['paid'].items()}) and + T==Counter({int(k):v for k,v in receipt['targets'].items()}),'complete BIT invoice') + need(sum(T.values())==len(names)==19950,'BIT owner count') + return dict(ambient=134, rational_frames=len(ff), rational_main_charts=len(charts), + rational_determinants_digest=digest(determinants), + finite_prime_exclusion_witness_count=len(denominator_witnesses), + finite_prime_exclusion_witness_digest=digest(sorted(denominator_witnesses)), + native_calls=len(calls), fresh_helpers=36*437, productive_fields=len(names), + paid_positions=len(positions), complete_paid_position_digest=digest(positions), + reserved_native_banks=36*word['owned_fields'], reserved_serial_query_bank=1, + rank_surplus=sum(r*T[r] for r in T)-sum(r*P[r] for r in P)) + + +def main(): + p='research/shared-wire-split-composition/' + w,c,r=read(p+'data/final.json.gz'),read(p+'data/caller.json'),read(p+'FULL-RESULT.json') + phases=read('research/p104-two-chain-shared-native/retained/runtime/DATA-PHASES.json') + complex_result=complex_application(w,c,r,phases) + p='research/paired-query-only-bit/' + bw,bc,br=read(p+'retained/inputs/BIT-NATIVE-WORD.json.gz'),read(p+'EFREE-CALLER.json.gz'),read(p+'EFREE-RESULT.json') + bit_result=bit_application(bw,bc,br) + controls={} + def reject(name, action): + try:action() + except ValueError as error:controls[name]=str(error) + else:raise ValueError('negative control accepted: '+name) + alias=deepcopy(c);joint=next(e for e in alias['events'] if e[0]=='J');joint[2][2]=joint[2][0] + reject('same_frame_main_alias',lambda:complex_application(w,alias,r,phases)) + reordered=deepcopy(c);joint=next(e for e in reordered['events'] if e[0]=='J');joint[1]=2 + reject('wrong_stage',lambda:complex_application(w,reordered,r,phases)) + bad_bit=deepcopy(bw);bad_bit['frames']['0']['A'][1]=bad_bit['frames']['0']['A'][0][:] + reject('singular_BIT_spectator_basis',lambda:bit_application(bad_bit,bc,br)) + q=w['ports'][0];basis=next(x for x in phases['recipes'] if x['q']==q)['idle_children'][0]['orthogonal_axes'][:8] + reject('singular_complex_route',lambda:route(q,basis[:-1]+basis[:1],1)) + transform=route(q,basis,1) + before=terms((1<> (a*width)) ^ (label >> (b*width))) & mask + return label ^ (delta << (a*width)) ^ (delta << (b*width)) + + +def permute(label, swaps, width): + for a, b in swaps: + label = swap_blocks(label, a, b, width) + return label + + +def masks(stage, width): + return ((1 << width)-1, ((1 << (8*width))-1) << ((9+8*(stage-1))*width)) + + +def descriptor(stage): + assert 1 <= stage <= 18 + return tuple((j, 8*stage+j) for j in range(1, 9)) + + +def packed_kernel(row, col, width, mutate=None): + if (row ^ col) >> (9*width): + return (0, 0) + result = (1, 0) + for j in range(9*width): + result = multiply(result, C[(row >> j) & 1][(col >> j) & 1]) + q = (1 << width)-1 + if (row ^ col) & q and ((row ^ col) & q).bit_count() % 2: + result = -result[0], -result[1] + exponent = width if mutate != 'missing multiplicity' else 1 + return multiply(PHASE[exponent % 4] if mutate != 'missing global phase' else (1,0), result) + + +def separate_kernel(row, col, stage, width): + q, body = masks(stage, width) + if (row ^ col) & ~(q | body): + return (0,0) + result = (1,0) + for bit in range(width): + result = multiply(result, conjugate(C[(row >> bit) & 1][(col >> bit) & 1])) + start = (9+8*(stage-1))*width + for bit in range(start, start+8*width): + result = multiply(result, C[(row >> bit) & 1][(col >> bit) & 1]) + return result + + +def verify_route(stage, width): + swaps = descriptor(stage) + q, body = masks(stage, width) + front = (1 << (9*width))-1 + assert permute(q | body, swaps, width) == front + assert permute(q, swaps, width) == q + for i in range(LAYOUT*width): + x = 1 << i + assert permute(permute(x, swaps, width), reversed(swaps), width) == x + return swaps + + +def check_finite(stage, width, rng): + swaps = verify_route(stage, width) + q, body = masks(stage, width) + prefix = 9*width + active = q | body + parked = rng.getrandbits(LAYOUT*width) & ~active + if width == 1: + pairs = ((r,c) for r in range(1<