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-arbitrary-clock-body-idle-fusion-bound/NOTICE.md b/research/p104-arbitrary-clock-body-idle-fusion-bound/NOTICE.md new file mode 100644 index 0000000000..da45fe0867 --- /dev/null +++ b/research/p104-arbitrary-clock-body-idle-fusion-bound/NOTICE.md @@ -0,0 +1 @@ +The exact source lineage and predecessor credits are in README.md and PROVENANCE.json. OpenAI Codex and subagents materially assisted the proof, implementation, independent verification and packaging. This package is contributed under the repository's Apache-2.0 license. diff --git a/research/p104-arbitrary-clock-body-idle-fusion-bound/PINS.json b/research/p104-arbitrary-clock-body-idle-fusion-bound/PINS.json new file mode 100644 index 0000000000..d0aa83007b --- /dev/null +++ b/research/p104-arbitrary-clock-body-idle-fusion-bound/PINS.json @@ -0,0 +1,12 @@ +{ + "PROVENANCE.json": "b5280bad34ee28820dbc6dfc29317a38936e4f13e53407881354b2331d1ff070", + "engines/forward.py": "75d94780f9db49a4b08bb0e7fb4bd7fc04adb8cabbf73d83a809179c04c3d439", + "engines/independent.py": "d0d1e42bc072f01c377872e763613e9afee4436d97f5479fbbcb369eb57bbf33", + "engines/lead.py": "b5e3998d889fc8f750b913cceda821c54c9fb5dfe4bb73ce8082caa1639bfd45", + "engines/pricing.py": "f4d0b6c9314b838d882d6d06020f24881c19a3fda97a7c00df87b1e920785182", + "inputs/7113-SHA256.json": "064e11ecfedce9937ea1782e5baee37e89b3c9eebabed5b4a9ba84f412bbe078", + "inputs/7113-signed-child.py": "ef03444360f02225138be9b38e2f9a85f313eeaa910d63a365de0f16d228cb8b", + "inputs/CALLER.json": "255d89f38cd45e38e5770f559bc43dc217e989032359768cdc7e8cdfd64b47bc", + "receipts/INDEPENDENT.json": "d99962b8ab8feb2aa98585ed1f8f80a1cf051fd566372a01c42b9c931ada1538", + "receipts/LEAD.json": "5af516e224cf0159a4aab67fb532635ce18b97ea80f338432b2271c0aaac4cb9" +} diff --git a/research/p104-arbitrary-clock-body-idle-fusion-bound/PROOF.md b/research/p104-arbitrary-clock-body-idle-fusion-bound/PROOF.md new file mode 100644 index 0000000000..51108409f2 --- /dev/null +++ b/research/p104-arbitrary-clock-body-idle-fusion-bound/PROOF.md @@ -0,0 +1,21 @@ +# One legal joint body sign excludes each disjoint-mask fusion + +Fix the exact #7113 Type A caller at the #7334 comparator. It has 96 ports, 36 roles per port and 30 body-only IDLE_ONE calls. The 14 early masks are nonempty subsets of stages 2 through 8 containing stage 8. The 16 late masks are nonempty subsets of stages 9 through 16 containing stage 9. Two masks from the same side intersect. Every cross-side pair is disjoint, giving exactly 224 cases. The only change considered is deleting both idles and inserting one Type A field multiplication by the whole body product for their union, at any clock. The other actions are fixed. + +## One physical specialization + +Set q=1, D8=D9=−1, and every other body variable to 1. Each body acts on a disjoint eight-axis block. The binary Gaussian C has eigenvalues 1 and i on the plus and minus Walsh vectors. Choose two minus Walsh bits in each of the stage-8 and stage-9 blocks and plus bits elsewhere. This realizes the same specialization at every positive integral admitted width. Arbitrary role inputs can be supported in this common sector. + +Each original idle in the proposed pair acts by −1 on its own role at this profile. A fused union body acts by +1, hence is the identity on its target field. Any placement of that identity gives the same specialized product as deleting both old idles. The result also permits a reversible change of basis around the fused factor with no change to the fixed surrounding action, since conjugation preserves the identity. + +## Exact projector comparison + +Let G_i denote the old invertible caller prefix before idle i, and E_i the rank-one projector onto that idle's live role at its own clock. The pulled-back projector is P_i=G_i⁻¹E_i G_i. Its reflection R_i=I−2P_i is an involution. Removing a single original idle from the literal word removes its own local reflection. For two removed idles, the new whole product equals the old product multiplied on the input side by the two pulled-back reflections in reverse chronological order. This follows by telescoping the original prefixes, which include all old idles. The product is unchanged exactly when R_j R_i=I, or equivalently P_j=P_i. + +The lead maintains exact prefix rows and inverse columns as it reads the tape. The independent replay instead walks forward and reverse sparse basis vectors on its own literal lowering. Both check the old diagonal endpoint and find an unequal matrix entry for every one of the 224 pairs. For the largest priced pair, clocks 1448 and 1763, the stage-mask lengths are 7 and 8, and the first differing projector entry is [1,0], with values −2 and 0. A separate omission replay on all 36 input columns changes the complete output matrix entry [1,0] from 0 to −4. No case survives the specialization. + +## Directed price + +Write H(r)=r^(1−κ). A hypothetical fusion of body masks with m and n stages pays H(8m+8n) in place of H(8m)+H(8n) at each of 96 ports. The difference is positive by strict concavity. Its gross increases in either rank and has positive mixed partial −H″(8m+8n) in the two ranks up to the positive scale of the stage units. Consequently an optimum disjoint matching pairs the 14 early ranks with the 14 largest late ranks, sorted in the same order. The exchange inequality follows by integrating that positive mixed partial over each rectangle of crossed pairs. All other paid and productive entries are fixed for this quote. Directed exact power bounds over the old crossing certify the combined gross below 238.182 raw. The actual saving in this model is absent because no proposed pair preserves the caller. + +The proof makes no claim about changed multi-field operators, changed erased maps, a changed signed interface, or a cancellation of several wrong single-pair edits. No physical rewrite, dirty-restoration proof, or changed recurrence was attempted. diff --git a/research/p104-arbitrary-clock-body-idle-fusion-bound/PROVENANCE.json b/research/p104-arbitrary-clock-body-idle-fusion-bound/PROVENANCE.json new file mode 100644 index 0000000000..a54d446a6c --- /dev/null +++ b/research/p104-arbitrary-clock-body-idle-fusion-bound/PROVENANCE.json @@ -0,0 +1,39 @@ +{ + "benchmark": { + "head": "aaeec8c0acf01e99a5f331ef363a698d9c084ace", + "kappa": "0.00364665195644", + "pr": 7334 + }, + "caller": { + "head": "07a76c5e2738882c0cb322278e56f6cae3c9885d", + "manifest": "research/signed-caller-8x9/SHA256.json", + "path": "research/signed-caller-8x9/expected/ODD-TYPE-AB-CALLER.json", + "pr": 7113, + "sha256": "255d89f38cd45e38e5770f559bc43dc217e989032359768cdc7e8cdfd64b47bc" + }, + "predecessors": [ + { + "credit": "Adjacent-rank moment comparison and exclusion method in a distinct BIT model.", + "pr": 7305 + }, + { + "credit": "Distinct Type B odd/even idle route.", + "pr": 7357 + }, + { + "credit": "Exact caller export and retained scalar walk.", + "head": "3d1a62e154957f00aeeb4eec703cf6a07dfa3ef0", + "pr": 7435 + }, + { + "credit": "Directed rank-power arithmetic.", + "pr": 7362 + } + ], + "receipt_transport": { + "independent_original_sha256": "d99962b8ab8feb2aa98585ed1f8f80a1cf051fd566372a01c42b9c931ada1538", + "lead_changes": "Only replay-root path keys normalized to the bundled files. Exact data fields preserved.", + "lead_original_sha256": "4f0532cdba82362c4ecf462984d87328540d5555237b20b93cc2b61fe9d497b8" + }, + "schema_version": 1 +} diff --git a/research/p104-arbitrary-clock-body-idle-fusion-bound/README.md b/research/p104-arbitrary-clock-body-idle-fusion-bound/README.md new file mode 100644 index 0000000000..5b6ca7eb47 --- /dev/null +++ b/research/p104-arbitrary-clock-body-idle-fusion-bound/README.md @@ -0,0 +1,19 @@ +# Bound arbitrary-clock fusion of Type A body idles + +On the exact [#7334 benchmark](https://github.com/CrocSwap/integer-mult-bounds/pull/7334) with the [#7113 signed caller](https://github.com/CrocSwap/integer-mult-bounds/pull/7113), replace two Type A body idles with disjoint stage masks by one whole union-mask body on one field. Allow that body at any clock and keep the surrounding scalar, body, signed and paid itinerary fixed. + +One physically realizable joint negative body specialization gives a different exact transported projector at every one of the 224 disjoint-mask pairs. All are excluded. The best quoted pair at clocks 1448 and 1763 also fails literal omission at output row 1 and input column 0, where 0 becomes −4. The optimistic combined saving of any disjoint matching is below 238.182 raw before ancillary work. No complete construction or exponent change follows. + +From a clean POSIX checkout with CPython 3.12 and assertions enabled: + +```sh +python3.12 -I -B research/p104-arbitrary-clock-body-idle-fusion-bound/replay.py +``` + +The standard-library replay authenticates bundled inputs by path and runs two independent exact engines. It compares all case keys, projector witnesses and the literal control, and rejects a corrupted caller. Expected marker `PASS_TYPE_A_BODY_IDLE_FUSION`. No previous temporary files, Git history or network is required for the standalone command. + +## Open next questions + +Could a different body supplier realize a two-field action at a single priced occurrence? Specify its physical axes, exact scalar action on two independent dirty inputs, routing and restoration before repricing. The one-field union-mask operator considered here becomes the identity at the joint negative specialization. Operators that do not have that specialization and changes to the fixed surrounding itinerary require separate tests. + +[#7334](https://github.com/CrocSwap/integer-mult-bounds/pull/7334) and [#7113](https://github.com/CrocSwap/integer-mult-bounds/pull/7113) supply the exact comparator and caller. [#7305](https://github.com/CrocSwap/integer-mult-bounds/pull/7305) supplies a related fixed-slot BIT exclusion method and [#7357](https://github.com/CrocSwap/integer-mult-bounds/pull/7357) addresses a distinct Type B odd/even idle family. [#7435](https://github.com/CrocSwap/integer-mult-bounds/pull/7435) supplies the source-pinned caller export and retained scalar walk. [#7362](https://github.com/CrocSwap/integer-mult-bounds/pull/7362) supplies directed pricing. OpenAI Codex and subagents materially assisted the proof, implementation, independent replay and packaging. diff --git a/research/p104-arbitrary-clock-body-idle-fusion-bound/SOURCES.json b/research/p104-arbitrary-clock-body-idle-fusion-bound/SOURCES.json new file mode 100644 index 0000000000..e8c2f265cd --- /dev/null +++ b/research/p104-arbitrary-clock-body-idle-fusion-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-arbitrary-clock-body-idle-fusion-bound/TASK.json b/research/p104-arbitrary-clock-body-idle-fusion-bound/TASK.json new file mode 100644 index 0000000000..43115fb844 --- /dev/null +++ b/research/p104-arbitrary-clock-body-idle-fusion-bound/TASK.json @@ -0,0 +1,84 @@ +{ + "actual_scope": "Exact #7334/#7113 Type A caller. All 224 pairs of IDLE_ONE calls with disjoint stage masks, allowing one fused body at any clock and keeping other phase and ownership actions unchanged.", + "ai_assistance": "OpenAI Codex and subagents materially assisted proof, implementation, independent replay and packaging.", + "author": "P104 arbitrary-clock body idle fusion audit", + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "bottleneck_link": "A successful fusion replaces two charged body suppliers by one higher-rank paid supplier and changes the binding complex moment.", + "budget_minutes": 4, + "evidence": "All 224 pairs excluded by exact transported projector inequality at a single legal joint negative body specialization. The best pair also fails literal omission. Directed aggregate bound is strictly below 238.182 raw.", + "open_questions": [ + { + "blocked_by": "The original fields have different exact pulled-back projectors and ordinary conjugation does not change the fused body identity at the exhibited specialization.", + "first_step": "Freeze one pair and price an explicit alternate body-dependent channel before changing any native contacts.", + "question": "Can a changed body supplier affect two independent fields within a single priced occurrence?", + "why_it_matters": "The one-field fusion law used here leaves multiple-field operators and changed coframes open." + } + ], + "original_card": { + "acceptance_gate": "A source-bound arbitrary-input identity and legal producer/consumer boundary with the complete paid and productive target invoice, including restoration, ownership, native alignment and extra charges. Price under the actual current model; historical ceiling.py assumptions must be established before use. A favorable optimistic relaxation keeps a route open but is not a completed supplier. A scoped local result remains useful; expansion requires the family-level budget gate.", + "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/qq16-caller-install/README.md", + "remaining": "Complete matched physical protocol bill, or changed source-compatible demand/circuit; no affordable supplier yet.", + "scope": "PR #4166: author-checked installed producer/service/return/bridge connection; native-component comparison loses.", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129", + "source_commit": "0b082d22a0e9a442d264ab0633e35ef26c790630", + "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": "Choose an exact caller and a new demand/interface hypothesis. Read the scoped #5617/#5631/#5649/#5747 and #5720/#5745 objections before rebuilding an excluded schedule. Compare the complete matched source/consumer protocols including all retained helper outputs. For an active-mode injection, first check #5745: its canonical delivery claim repays the eight removed centre jobs. Audit that exact claim or change its channel/feedback hypothesis; do not repeat the same free-injection search. Stop if the full favorable budget fails or the required restored output is unobservable.", + "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": "joint-query-controller", + "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": [ + "query demand", + "active mode", + "5720", + "5745", + "5747", + "caller" + ], + "question": "Can a changed query demand or caller remove real work while satisfying native chronology and restoration?", + "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" + ] + }, + "outcome": "negative-result", + "priority_revision": 8, + "schema_version": 1, + "scope_change_reason": "Test exact paid body idle fusion while keeping signed contacts and all other paid sites unchanged.", + "scope_status": "changed", + "stop_rule": "Two independent CPython 3.12 engines, each capped at 224 cases and 30 runner seconds. Check the top quoted pair by literal omission on all 36 columns.", + "task_id": "joint-query-controller" +} diff --git a/research/p104-arbitrary-clock-body-idle-fusion-bound/VERIFICATION.md b/research/p104-arbitrary-clock-body-idle-fusion-bound/VERIFICATION.md new file mode 100644 index 0000000000..ff870769c8 --- /dev/null +++ b/research/p104-arbitrary-clock-body-idle-fusion-bound/VERIFICATION.md @@ -0,0 +1 @@ +Both discovery and independent replays used CPython 3.12 with assertions. The lead ran in 0.24 seconds and the independent replay in 0.04 seconds. Each engine is capped at 30 runner seconds and 224 pair cases. The original caller's complete Type A matrix is checked in the chosen specialization. Every case has an exact unequal projector entry from each implementation. The highest-priced case is also checked by omitting both literal idles and comparing all 36 columns. The standalone replay authenticates all input, engine and receipt bytes, independently regenerates both exact receipts and rejects a deliberately altered caller byte. It needs no modified caller construction or complete exponent verifier for this scoped exclusion. diff --git a/research/p104-arbitrary-clock-body-idle-fusion-bound/VERIFY.json b/research/p104-arbitrary-clock-body-idle-fusion-bound/VERIFY.json new file mode 100644 index 0000000000..d32d9005a0 --- /dev/null +++ b/research/p104-arbitrary-clock-body-idle-fusion-bound/VERIFY.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/replay.py" + ], + "checks": "Regenerate both exact 224-pair receipts, compare every transported projector witness and the literal best-case failure, and reject corrupted pinned inputs.", + "timeout_seconds": 80 + } + ], + "inputs": [], + "python": "3.12", + "requirements": [], + "schema_version": 1, + "status": "ready" +} diff --git a/research/p104-arbitrary-clock-body-idle-fusion-bound/engines/forward.py b/research/p104-arbitrary-clock-body-idle-fusion-bound/engines/forward.py new file mode 100644 index 0000000000..7842fd300e --- /dev/null +++ b/research/p104-arbitrary-clock-body-idle-fusion-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-arbitrary-clock-body-idle-fusion-bound/engines/independent.py b/research/p104-arbitrary-clock-body-idle-fusion-bound/engines/independent.py new file mode 100644 index 0000000000..1d82a59ac5 --- /dev/null +++ b/research/p104-arbitrary-clock-body-idle-fusion-bound/engines/independent.py @@ -0,0 +1,179 @@ +"""Independently check the R211 IDLE_ONE fusion reflection gate.""" +from ast import Assign, Name, literal_eval, parse +from fractions import Fraction as Q +from hashlib import sha256 +from json import dumps, loads +from math import prod +from pathlib import Path +from signal import SIGALRM, alarm, signal +from sys import argv, implementation, version_info + +N = 36 +CAP = 30 +NEGATIVE = {8, 9} +PINS = { + 'inputs/CALLER.json': '255d89f38cd45e38e5770f559bc43dc217e989032359768cdc7e8cdfd64b47bc', + 'inputs/7113-SHA256.json': '064e11ecfedce9937ea1782e5baee37e89b3c9eebabed5b4a9ba84f412bbe078', + 'inputs/7113-signed-child.py': 'ef03444360f02225138be9b38e2f9a85f313eeaa910d63a365de0f16d228cb8b', +} +HEAD = 'aaeec8c0acf01e99a5f331ef363a698d9c084ace' +CALLER = '07a76c5e2738882c0cb322278e56f6cae3c9885d' + + +def no_duplicates(items): + out = dict(items) + assert len(out) == len(items) + return out + + +def read(root, name): + raw = (root / name).read_bytes() + assert sha256(raw).hexdigest() == PINS[name], name + return loads(raw, object_pairs_hook=no_duplicates) + + +def lower(caller, omitted=()): + atoms, idle = [], [] + alpha = Q(caller['types']['A']['alpha2']) + assert alpha == -1 + for clock, event in enumerate(caller['events']): + if event[0] == 'B': + continue + if event[0] == 'J': + _, stage, (a, b, c, d), _ = event + assert len({a, b, c, d}) == 4 + atoms.extend([('add', b, a, Q(1)), ('add', c, d, alpha)]) + if stage in NEGATIVE: + atoms.extend(('scale', row, row, Q(-1)) for row in (a, b, c, d)) + continue + assert event[0] == 'A' + _, op, row, *args = event + if op == 'ADD': + atoms.append(('add', row, args[0], Q(args[1]))) + elif op == 'SCALE': + atoms.append(('scale', row, row, Q(args[0]))) + elif op == 'SWAP': + atoms.append(('swap', row, args[0], Q(1))) + elif op == 'QUERY': + src, exp = args + assert exp == -1 + atoms.append(('add', row, src, Q(1))) + elif op == 'IDLE_ONE': + stages, = args + assert len(set(stages)) == len(stages) + body = prod(-1 if i in NEGATIVE else 1 for i in stages) + idle.append((clock, row, tuple(stages), len(atoms), body)) + if body != 1 and clock not in omitted: + atoms.append(('scale', row, row, Q(body))) + else: + assert op == 'LAMBDA' # Common q²=1 specialization. + return atoms, idle + + +def vector(word, coordinate, mode): + x = {coordinate: Q(1)} + for kind, dest, source, a in word if mode == 'forward' else reversed(word): + if kind == 'add': + if mode == 'row': + dest, source = source, dest + c = x.get(source) + if c: + y = x.get(dest, 0) + (-a if mode == 'inverse' else a) * c + if y: + x[dest] = y + else: + x.pop(dest, None) + elif kind == 'swap': + u, v = x.pop(dest, None), x.pop(source, None) + if u: + x[source] = u + if v: + x[dest] = v + elif dest in x: + x[dest] = x[dest] / a if mode == 'inverse' else x[dest] * a + return x + + +def projector(word, entry): + clock, row, stages, index, sign = entry + assert sign == -1 + prefix = word[:index] + u, v = vector(prefix, row, 'inverse'), vector(prefix, row, 'row') + assert sum(x * v.get(i, 0) for i, x in u.items()) == 1 + return {(i, j): x * y for i, x in u.items() for j, y in v.items()} + + +def reflection(p, x): + out = x.copy() + for (i, j), value in p.items(): + if j in x: + out[i] = out.get(i, 0) - 2 * value * x[j] + return {i: v for i, v in out.items() if v} + + +def stop(*_): + raise TimeoutError('R211 independent 30-second cap') + + +def main(): + assert __debug__ and implementation.name == 'cpython' and version_info[:2] == (3, 12) + assert len(argv) == 2, 'pass the authenticated #7435 package root' + root = Path(argv[1]).resolve() + signal(SIGALRM, stop) + alarm(CAP) + caller = read(root, 'inputs/CALLER.json') + manifest = read(root, 'inputs/7113-SHA256.json') + assert manifest['expected/ODD-TYPE-AB-CALLER.json'] == PINS['inputs/CALLER.json'] + child_path = 'inputs/7113-signed-child.py' + child = (root / child_path).read_bytes() + assert sha256(child).hexdigest() == PINS[child_path] == manifest['replay/supplier7112/short-caller/signed_child.py'] + binary = next(literal_eval(n.value) for n in parse(child).body + if isinstance(n, Assign) and isinstance(n.targets[0], Name) and n.targets[0].id == 'C') + for sign, twice_eigen in ((1, (2, 0)), (-1, (0, 2))): + for i in range(2): + assert tuple(binary[i][0][k] + sign*binary[i][1][k] for k in range(2)) == tuple(sign**i*x for x in twice_eigen) + assert len(caller['events']) == 4783 and caller['types']['A']['roles'] == N + word, entries = lower(caller) + early = [e for e in entries if 8 in e[2]] + late = [e for e in entries if 9 in e[2]] + assert (len(entries), len(early), len(late)) == (30, 14, 16) + assert all(a[0] < b[0] and set(a[2]).isdisjoint(b[2]) and a[4] == b[4] == -1 for a in early for b in late) + diag = [] + for q, z, *bits in caller['types']['A']['diagonal']: + assert len(bits) == 17 and z == 0 and all(b in (0, 1) for b in bits) + diag.append(Q((-1) ** (bits[7] + bits[8]))) + for j in range(N): + assert vector(word, j, 'forward') == {j: diag[j]} + projectors = {e[0]: projector(word, e) for e in entries} + cases = [] + for a in early: + for b in late: + left, right = projectors[a[0]], projectors[b[0]] + first = next((p for p in sorted(left.keys() | right.keys()) if left.get(p, 0) != right.get(p, 0)), None) + cases.append({'clocks': [a[0], b[0]], 'roles': [a[1], b[1]], 'ranks': [8*len(a[2]), 8*len(b[2])], + 'masks': [a[2], b[2]], + 'witness': None if first is None else [*first, str(left.get(first, 0)), str(right.get(first, 0))]}) + assert len(cases) == 224 + # H(r)+H(s)-H(r+s) is strictly increasing in either positive input + # for H(r)=r^(1−κ), 0<κ<1. Break ties by chronological clocks. + best = min(cases, key=lambda c: (-c['ranks'][0], -c['ranks'][1], c['clocks'])) + first, second = best['clocks'] + omitted, _ = lower(caller, (first, second)) + first_wrong = None + for j in range(N): + literal = vector(omitted, j, 'forward') + grouped = reflection(projectors[second], reflection(projectors[first], {j: Q(1)})) + assert literal == {i: diag[i] * x for i, x in grouped.items()} + if literal != {j: diag[j]} and first_wrong is None: + i = min(i for i in literal.keys() | {j} if literal.get(i, 0) != (diag[j] if i == j else 0)) + first_wrong = [i, j, str(diag[j] if i == j else 0), str(literal.get(i, 0))] + assert (first_wrong is None) == (best['witness'] is None) + alarm(0) + print(dumps({'head': HEAD, 'caller': CALLER, 'pins': PINS, 'profile': {'q': 1, 'negative_D': sorted(NEGATIVE)}, + 'endpoint': list(map(str, diag)), 'early': len(early), 'late': len(late), 'cases': cases, + 'survivors': [c for c in cases if c['witness'] is None], 'best': best, + 'literal_omission_first_wrong': first_wrong, 'runner_cap_seconds': CAP}, sort_keys=True, indent=2)) + + +if __name__ == '__main__': + main() diff --git a/research/p104-arbitrary-clock-body-idle-fusion-bound/engines/lead.py b/research/p104-arbitrary-clock-body-idle-fusion-bound/engines/lead.py new file mode 100644 index 0000000000..85db8835c2 --- /dev/null +++ b/research/p104-arbitrary-clock-body-idle-fusion-bound/engines/lead.py @@ -0,0 +1,151 @@ +"""One shared legal body specialization for every disjoint Type A idle pair.""" +from fractions import Fraction as F +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 +ROOT = HERE.parent +PINS = { + 'inputs/CALLER.json': '255d89f38cd45e38e5770f559bc43dc217e989032359768cdc7e8cdfd64b47bc', + 'engines/forward.py': '75d94780f9db49a4b08bb0e7fb4bd7fc04adb8cabbf73d83a809179c04c3d439', + 'engines/pricing.py': 'f4d0b6c9314b838d882d6d06020f24881c19a3fda97a7c00df87b1e920785182', +} +CROSSING = (F('0.00364665195644044790699554028334161'), F('0.00364665195644044790699554028334162')) + + +def add(a, b, c): + return [x + c*y for x, y in zip(a, b, strict=True)] + + +def minus(stage_set): + return len({8, 9}.intersection(stage_set)) % 2 + + +def expanded(tape, omitted): + for clock, e in enumerate(tape): + if clock in omitted: + continue + yield e + if e[0] == 'J' and e[1] in (8, 9): + for role in e[2]: + yield ['A', 'SCALE', role, '-1'] + elif e[:2] == ['A', 'IDLE_ONE'] and minus(e[3]): + yield ['A', 'SCALE', e[2], '-1'] + + +def collect(tape, unit): + rows = [unit(i) for i in range(36)] + inverse = [unit(i) for i in range(36)] + idles = [] + + def shear(d, s, value): + rows[d] = add(rows[d], rows[s], value) + inverse[s] = add(inverse[s], inverse[d], -value) + + def scale(d, value): + rows[d] = [x*value for x in rows[d]] + inverse[d] = [x/value for x in inverse[d]] + + for clock, e in enumerate(tape): + if e[0] == 'B': + continue + if e[0] == 'J': + a, b, c, d = e[2] + shear(b, a, F(1)) + shear(c, d, F(-1)) + if e[1] in (8, 9): + for role in e[2]: + scale(role, F(-1)) + continue + assert e[0] == 'A' + _, op, d, *args = e + if op == 'ADD': + shear(d, args[0], F(args[1])) + elif op == 'QUERY': + assert args[1] == -1 + shear(d, args[0], F(1)) + elif op == 'SCALE': + scale(d, F(args[0])) + elif op == 'SWAP': + s, = args + rows[d], rows[s] = rows[s], rows[d] + inverse[d], inverse[s] = inverse[s], inverse[d] + elif op == 'IDLE_ONE': + assert minus(args[0]) == 1 + u, v = inverse[d], rows[d] + assert sum(x*y for x,y in zip(u,v,strict=True)) == 1 + idles.append((clock, d, args[0], u, v)) + scale(d, F(-1)) + else: + assert op == 'LAMBDA' and args[0] in (-1, 1) + return idles, rows, inverse + + +def stop(*_): + raise TimeoutError('30-second 224-pair body gate cap') + + +def main(): + assert __debug__ + signal(SIGALRM, stop) + alarm(30) + for name, digest in PINS.items(): + assert sha256((ROOT/name).read_bytes()).hexdigest() == digest + source = run_path(str(ROOT/'engines/forward.py')) + h = run_path(str(HERE/'pricing.py'))['power_bounds'] + unit, apply = source['unit'], source['apply'] + caller = loads((ROOT/'inputs/CALLER.json').read_bytes()) + tape = caller['events'] + a = caller['types']['A'] + assert len(a['ports']) == 96 and a['alpha2'] == '-1' + idles, end, inv = collect(tape, unit) + assert len(idles) == 30 + for i, row in enumerate(a['diagonal']): + expected = [x*(-1)**(row[9]+row[10]) for x in unit(i)] + assert end[i] == inv[i] == expected + k0, k1 = CROSSING + + def price(n, m): + x, y = 8*n, 8*m + return (96*(h(x,k1)[0]+h(y,k1)[0]-h(x+y,k0)[1]), + 96*(h(x,k0)[1]+h(y,k0)[1]-h(x+y,k1)[0])) + + records = [] + for a0, a1 in combinations(idles, 2): + i, r, m, u, v = a0 + j, s, n, x, y = a1 + if not set(m).isdisjoint(n): + continue + assert minus(m+n) == 0 + lower, upper = price(len(m), len(n)) + assert 0 < lower < upper < 96 + witness = next(([a,b,str(u[a]*v[b]),str(x[a]*y[b])] + for a in range(36) for b in range(36) if u[a]*v[b] != x[a]*y[b]), None) + records.append({'clocks':[i,j], 'roles':[r,s], 'masks':[m,n], 'quote':[str(lower),str(upper)], + 'projector_inequality':witness}) + assert len(records) == 224 + best = min(records,key=lambda v:(-F(v['quote'][1]),v['clocks'])) + early = sorted(len(mask) for _,_,mask,*_ in idles if 8 in mask) + late = sorted(len(mask) for _,_,mask,*_ in idles if 9 in mask)[-len(early):] + matching_upper = sum(price(i,j)[1] for i,j in zip(early,late,strict=True)) + literal = list(expanded(tape, set())) + changed = list(expanded(tape, set(best['clocks']))) + witness = next(([j,i,str(x),str(y)] for i in range(36) + for j,(x,y) in enumerate(zip(apply(literal,unit(i),1),apply(changed,unit(i),1),strict=True)) + if x != y), None) + assert bool(witness) == bool(best['projector_inequality']) + alarm(0) + print(dumps({'pins':PINS, 'crossing':list(map(str,CROSSING)), 'profile':{'q':1,'negative_body_stages':[8,9]}, + 'pairs':records, 'case_cap':224, 'runner_cap_seconds':30, 'best':best, + 'disjoint_matching_upper':str(matching_upper), 'max_pairs':len(early), + 'literal_best_difference':witness, + 'survivors':[v['clocks'] for v in records if v['projector_inequality'] is None]}, + indent=2,sort_keys=True)) + + +if __name__ == '__main__': + main() diff --git a/research/p104-arbitrary-clock-body-idle-fusion-bound/engines/pricing.py b/research/p104-arbitrary-clock-body-idle-fusion-bound/engines/pricing.py new file mode 100644 index 0000000000..40ec194017 --- /dev/null +++ b/research/p104-arbitrary-clock-body-idle-fusion-bound/engines/pricing.py @@ -0,0 +1,82 @@ +"""Directed interval arithmetic and the retained signed BIT invoice.""" +from collections import Counter +from fractions import Fraction +from functools import cache + +TARGET = "10018846261809/2500000000000000" +SCALE = 10**49 + + +def rounded(x, upper): + scaled = SCALE*x + if upper: + return Fraction(-((-scaled.numerator) // scaled.denominator), SCALE) + return Fraction(scaled.numerator // scaled.denominator, SCALE) + + +@cache +def log_bounds(x): + z = (x-1)/(x+1) + terms = 60 + exact_partial = 2*sum(z**(2*i+1)/(2*i+1) for i in range(terms)) + tail = 2*z**(2*terms+1)/((2*terms+1)*(1-z*z)) + return rounded(exact_partial, False), rounded(exact_partial+tail, True) + + +@cache +def power_bounds(rank, k): + binary = 2**(rank.bit_length()-1) + shift = binary.bit_length()-1 + l2, u2 = log_bounds(Fraction(2)) + lo, hi = log_bounds(Fraction(rank, binary)) + lo, hi = k*(lo+shift*l2), k*(hi+shift*u2) + assert 0 <= lo <= hi < 1 + + def exponential(z, terms): + total = term = Fraction(1) + for i in range(1, terms+1): + term *= -z/i + total += term + return total + + return rounded(rank*exponential(hi, 35), False), rounded(rank*exponential(lo, 34), True) + + +def cost(hist, k): + lower = upper = Fraction(0) + for r, n in hist.items(): + a, b = (n*x for x in power_bounds(r, k)) + lower += min(a, b) + upper += max(a, b) + return lower, upper + + +def profile(invoice, native, word, ranks): + copies = invoice["native_calls"] + assert copies == len(invoice["native_instances"]) == 36 + assert {tuple((r["stage"], r["copy"])) for r in invoice["native_instances"]} == { + (stage, which) for stage in range(1, 19) for which in (0, 1) + } + assert all(r["ports"] == 111 for r in invoice["native_instances"]) + assert native == Counter({int(r): n for r, n in invoice["native_paid"].items()}) + assert sum(native.values()) == 2871 + caller_paid = {1: 444, **{r: 444 for r in range(7, 57, 7)}} + assert invoice["event_counts"]["QUERY"]*111 == caller_paid[1] + assert invoice["event_counts"]["IDLE_ONE"]*111 == 8*444 + full_paid = Counter({r: copies*n for r, n in native.items()}) + full_paid.update(caller_paid) + + helpers = Counter(ranks[word["final"][j]]-ranks[word["start"][j]] + for j in range(222, word["public"])) + assert helpers == Counter({int(r): n for r, n in invoice["native_helpers"].items()}) + caller_targets = {**{r: 444 for r in range(8, 65, 7)}, 127: 222} + full_targets = Counter({r: copies*n for r, n in helpers.items()}) + full_targets.update(caller_targets) + assert full_paid == Counter({int(r): n for r, n in invoice["paid"].items()}) + assert full_targets == Counter({int(r): n for r, n in invoice["targets"].items()}) + assert sum(full_paid.values()) == invoice["paid_jobs"] + assert sum(full_targets.values()) == invoice["productive_fields"] + signed = full_targets.copy() + signed.subtract(full_paid) + assert sum(r*n for r, n in signed.items()) == invoice["rank_surplus"] + return signed, copies diff --git a/research/p104-arbitrary-clock-body-idle-fusion-bound/inputs/7113-SHA256.json b/research/p104-arbitrary-clock-body-idle-fusion-bound/inputs/7113-SHA256.json new file mode 100644 index 0000000000..5a7d6b80dc --- /dev/null +++ b/research/p104-arbitrary-clock-body-idle-fusion-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-arbitrary-clock-body-idle-fusion-bound/inputs/7113-signed-child.py b/research/p104-arbitrary-clock-body-idle-fusion-bound/inputs/7113-signed-child.py new file mode 100644 index 0000000000..0980a6559b --- /dev/null +++ b/research/p104-arbitrary-clock-body-idle-fusion-bound/inputs/7113-signed-child.py @@ -0,0 +1,146 @@ +"""Exact nine-slot signed child on the retained 153-coordinate field layout.""" + +from collections import Counter +from hashlib import sha256 +from pathlib import Path +from random import Random +import argparse +import json + +LAYOUT = 153 +EXPECTED_PORTS = (15, 17, 27, 34, 35, 42, 47, 55) +NOTE_SHA = '64c70926a8705874f1c9b42a2f703e42cad4e90f927f544458cfdf729540236c' +# Integer numerators over 2 in the exact C gate. +C = (((1, 1), (1, -1)), ((1, -1), (1, 1))) +PHASE = ((1, 0), (0, -1), (-1, 0), (0, 1)) + + +def multiply(x, y): + a, b = x + c, d = y + return a*c - b*d, a*d + b*c + + +def conjugate(z): + a, b = z + return a, -b + + +def matrix_product(a, b): + return tuple(tuple(tuple(sum(multiply(a[i][k], b[k][j])[c] for k in range(2)) + for c in range(2)) for j in range(2)) for i in range(2)) + + +def swap_blocks(label, a, b, width): + mask = (1 << width)-1 + delta = ((label >> (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<