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-k7-integral-fringe/INPUTS.json b/research/p104-k7-integral-fringe/INPUTS.json new file mode 100644 index 0000000000..4ff0688d3a --- /dev/null +++ b/research/p104-k7-integral-fringe/INPUTS.json @@ -0,0 +1,242 @@ +{ + "files": { + "LICENSE": { + "git_blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64", + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "size": 11357, + "source": "c20a08dc0a79a989e3515068560d5da371c0a2a8:research/p104-shortcut-word-eta-27bit-5stage/LICENSE" + }, + "RESULT.json": { + "git_blob": "ed2458ee635e3745ccc4388aebe9e735b09197d1", + "sha256": "6894e85cec33111c46ca03a56ddad9a33cd913f267e4ec5c5d2ed95bc1adb8af", + "size": 8192, + "source": "4c3ff9f606991a60834d46a9e9fd50c44a6995e7:paired-768/r428/OBSERVED-PRICE.json" + }, + "source/paired-768/r415/overlay/ASSEMBLY.json": { + "git_blob": "1519a24ad2f32c911de376ab4ec82801bdcccca6", + "sha256": "a9b1fc38145ee605f35feb1277be316919e74c6747355c4c199cd3430b2dfab9", + "size": 2385, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r415/overlay/ASSEMBLY.json" + }, + "source/paired-768/r415/overlay/INPUTS.json": { + "git_blob": "a0dea1f0665f06a621bd29cacac425eff239da52", + "sha256": "cacf5d35f0a2c65df8d5b17b7075f6cea5d98be75d473dee1baa31724f319b64", + "size": 2306, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r415/overlay/INPUTS.json" + }, + "source/paired-768/r415/overlay/assemble.py": { + "git_blob": "223004a40bb3dc88ef9beaf37059660b7ac41e52", + "sha256": "0a5311eb25e889155d025a689236a3e5a434ec82d47a905fdf321eaf6a95d828", + "size": 4805, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r415/overlay/assemble.py" + }, + "source/paired-768/r415/overlay/price_source.py": { + "git_blob": "9faa59139db5a8e4c304c72dccd54f25d8bb0a12", + "sha256": "e99a1e022cda2a59695034d74ed6d919aa9d025a65a740104e33831a79e31713", + "size": 4987, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r415/overlay/price_source.py" + }, + "source/paired-768/r415/overlay/profile_source.py": { + "git_blob": "795e7df833d1de1fc366cd8527ebf9cd707ecc17", + "sha256": "0643d658c3c92074f4815e6705479d2c1650f0b820a2d0c74a8128d0bd05ecd0", + "size": 3950, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r415/overlay/profile_source.py" + }, + "source/paired-768/r415/overlay/seam_source.py": { + "git_blob": "19e724fbeed906e930cbd78d0ef6da83ba81f4bd", + "sha256": "0e9b3806137237322f5567cd48d057eef79cbf186b79263b6e866e184cde927e", + "size": 4651, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r415/overlay/seam_source.py" + }, + "source/paired-768/r416/setup/check_installed.py": { + "git_blob": "f30b5d4900c16cb3087393b50b0e7041deb36d0c", + "sha256": "e16fac0f9a91930575d4f11d50e4e26b357d2dcb0992470a679f6501904629e4", + "size": 6609, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r416/setup/check_installed.py" + }, + "source/paired-768/r416/signed/RECEIPT.json": { + "git_blob": "951ac58807ae155a20e83b4b13c9858fa0d9dc51", + "sha256": "316bb1a57ea8aa87fb2b565a4899c9b0b5a64ff1513c89e14a19d83ecd58e8e1", + "size": 2132, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r416/signed/RECEIPT.json" + }, + "source/paired-768/r417/physical/check.py": { + "git_blob": "ba9b01d0d6c045e5a703127744a1a31a800e9961", + "sha256": "cfd29f44b3df46aed035de7827bc2611449bf3b782d4e07a0373f20582edc597", + "size": 7879, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r417/physical/check.py" + }, + "source/paired-768/r417/setup-receipt/RECEIPT.json": { + "git_blob": "1b6fedb385012897a9ac88bd1783340a829a6232", + "sha256": "a690d662d0c9e137a6673d1c9c8dac24d2183e8ccd612b09ab13eb01a1c9d99e", + "size": 627, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r417/setup-receipt/RECEIPT.json" + }, + "source/paired-768/r417/setup-receipt/check_patch.py": { + "git_blob": "84d1b6e805ed8cbc23b0f9f9fb09b915e7f66f73", + "sha256": "c9f034036518f4fb9329d7e151f43d238efeab3c20e5f2c8b3e4c1b07a157b7e", + "size": 3602, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r417/setup-receipt/check_patch.py" + }, + "source/paired-768/r418/oracle/RECEIPT.json": { + "git_blob": "53232abb30384793ce06b1f9b798f25dfa96a730", + "sha256": "41a48b4b9641963b3d1f7ac64210d82fdefd6632b95ac0388e1799d99f6fe050", + "size": 25920, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r418/oracle/RECEIPT.json" + }, + "source/paired-768/r418/typed/check.py": { + "change": "Rename the digest loop local from expected to digest so the expected oracle function remains callable. Retain the 100-second kind-0 cap and give kind 1 a 160-second wall cap within the unchanged package command budget.", + "preimage": { + "git_blob": "34edf85043c3d4b31ca2ddd73961c0a1eae54e6d", + "sha256": "28c81eba875402ca8b60acd5d270a530bc58f746baa835e6388a620365e633ae", + "size": 8261, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r418/typed/check.py" + }, + "sha256": "53d75f0c42132dbcc8d733410c9a4dce588340b55ee07f6247e00bee64826080", + "size": 8278 + }, + "source/paired-768/r419/cross-price/RECEIPT.json": { + "git_blob": "7140a2a5dac1f9e6128d95033e1af9f005551fbb", + "sha256": "f2f2c6ffb164084c3e977a1b7699754918ed1e15bee585c1285dbae3d7afb42d", + "size": 3501, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r419/cross-price/RECEIPT.json" + }, + "source/paired-768/r420/overlay/ASSEMBLY.json": { + "git_blob": "d9a45e0dfd00333a4cbee5bb7feb6f67dd4f5b80", + "sha256": "c103b4b678c9c7a2945142cd9075632b0d0f9d93608f23479ebc22ed14eea4f8", + "size": 2541, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r420/overlay/ASSEMBLY.json" + }, + "source/paired-768/r420/overlay/assemble.py": { + "git_blob": "e62d98093154174282184062cd68748c899c9bdb", + "sha256": "33ca8c8a81d4ee7cebb9aca8948b73b2fb7d42592538424cb446a2edb45b668d", + "size": 4407, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r420/overlay/assemble.py" + }, + "source/paired-768/r420/overlay/price.py": { + "git_blob": "1e710a7914d3500600fa911fef1ac443d6e27e50", + "sha256": "985ee9fc1204aeeb5462aaa278ec20595330e096d6ccd382d24e815115a09a3e", + "size": 4986, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r420/overlay/price.py" + }, + "source/paired-768/r420/overlay/profile.py": { + "git_blob": "13a75a940f8b90f74097c9d596c095a8fcaf107f", + "sha256": "a1c1e3463c47454b7f6be4a22aa9acce3756aca8b78f0e6f63d34c7d7e680c26", + "size": 3595, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r420/overlay/profile.py" + }, + "source/paired-768/r420/overlay/seam.py": { + "git_blob": "74857977068623a737d4149f76c2c91f62bba2c5", + "sha256": "5d3c632db5f4ad8629d12c6e782dab64bf8e2ce2b020971c85c1c7ffb729bc44", + "size": 3307, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r420/overlay/seam.py" + }, + "source/paired-768/r420/setup/check_installed.py": { + "git_blob": "26a39fd513e8930d5f26fb6d5ba6ef76394b440a", + "sha256": "bd3bf241376d7e4e044ee8f92705c0a71bc059e52dabd8e56d971e418b69216a", + "size": 823, + "source": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a:paired-768/r420/setup/check_installed.py" + }, + "source/paired-768/r428/ASSEMBLY.json": { + "git_blob": "efc1d19b02d3ff2ec211c6e81685a0dcd651a2c4", + "sha256": "8d24e3afdd6e501a4cea93b81d01e210cd27495eb8d9c5f40c9e76f4803ea147", + "size": 2164, + "source": "4c3ff9f606991a60834d46a9e9fd50c44a6995e7:paired-768/r428/ASSEMBLY.json" + }, + "source/paired-768/r428/assemble.py": { + "git_blob": "877329b240ab09b4cad6657bdc75e2f1b6e1ff38", + "sha256": "426253b0bdc8e9a2c06602e8d8eb9c90dc5feba34d4a04eb8b93a4a1cac852af", + "size": 7194, + "source": "4c3ff9f606991a60834d46a9e9fd50c44a6995e7:paired-768/r428/assemble.py" + }, + "source/paired-768/r428/check_setup.py": { + "git_blob": "be36c3b1cd7c8ab326d6fc29bee47bd175dcaa06", + "sha256": "4af6910aefca5a150f16cbed8e08cb5b60d458af6c52e7c9f8e3fd435274ee0c", + "size": 1474, + "source": "4c3ff9f606991a60834d46a9e9fd50c44a6995e7:paired-768/r428/check_setup.py" + }, + "source/paired-768/r428/edits.py": { + "git_blob": "a87519e11c17676a8a0922b193bcf30e08dcd859", + "sha256": "a926aaafa51434090f7ee233e6d91a71b2916b225e655afe649f7567419c7134", + "size": 7449, + "source": "4c3ff9f606991a60834d46a9e9fd50c44a6995e7:paired-768/r428/edits.py" + }, + "source/peer8094/NOTICE.md": { + "git_blob": "bdad26a55c826d83a537a3fbd0792df9f832c827", + "sha256": "9bb1b93c10f93bc4d5c6cf7e0e9a25e91c0bb260a1224a536420d0c145ef58d6", + "size": 1080, + "source": "c20a08dc0a79a989e3515068560d5da371c0a2a8:research/p104-shortcut-word-eta-27bit-5stage/NOTICE.md" + }, + "source/peer8094/PEER-SOURCE.json": { + "git_blob": "6f84b3aef4b8c5026e348d88700bc9401514ccab", + "sha256": "798c2e6394c258986484a116198cc542a6d2b4c1f289e5816de2cfecf5141c51", + "size": 11897, + "source": "c20a08dc0a79a989e3515068560d5da371c0a2a8:research/p104-shortcut-word-eta-27bit-5stage/PEER-SOURCE.json" + }, + "source/peer8094/PROOF.md": { + "git_blob": "6dac92ac931233c8dc6d2a88422f0339e94cba32", + "sha256": "b470831617155e1818b2c2d9340f39ccd88fcc8dedd2177e6bcfbe25f949fd83", + "size": 4411, + "source": "c20a08dc0a79a989e3515068560d5da371c0a2a8:research/p104-shortcut-word-eta-27bit-5stage/PROOF.md" + }, + "source/peer8094/RESULT.json": { + "git_blob": "c2723777ef65312f4fd91ff178d61145cd522525", + "sha256": "915e124475494b08e786eb433e6591d85f2bdedebd624a45b49504c63bbb30e6", + "size": 8211, + "source": "c20a08dc0a79a989e3515068560d5da371c0a2a8:research/p104-shortcut-word-eta-27bit-5stage/RESULT.json" + }, + "source/peer8094/VERIFY.json": { + "git_blob": "35fd75e9fec3bb92aa28ef8e8e3dbcc3c6c23efe", + "sha256": "bfb5e28ca4cd85c8acda2bd5c31a31be05ddd8d47b7d1ca7217c9972f91c29a7", + "size": 2671, + "source": "c20a08dc0a79a989e3515068560d5da371c0a2a8:research/p104-shortcut-word-eta-27bit-5stage/VERIFY.json" + }, + "source/peer8094/check_cutoff.py": { + "git_blob": "393a19216fbf9fe4627b05dee4bf6ab7b2ecd81a", + "sha256": "a26eeb23591197b94f98a30d43474ffb90c1c4816db5b5ccc243eb3692b95795", + "size": 3125, + "source": "c20a08dc0a79a989e3515068560d5da371c0a2a8:research/p104-shortcut-word-eta-27bit-5stage/check_cutoff.py" + }, + "source/peer8094/check_ordinary_floor.py": { + "git_blob": "b49e8a5ea639e7a13c021570b8a3a3f507d1e6ca", + "sha256": "d66db3d6d01259216fc1823be7066e676541d820ea8a96a4c513a635e91eb244", + "size": 9663, + "source": "c20a08dc0a79a989e3515068560d5da371c0a2a8:research/p104-shortcut-word-eta-27bit-5stage/check_ordinary_floor.py" + }, + "source/peer8094/check_stage_seam.py": { + "git_blob": "82fc94cfa1708a32269eba30b7bac6b74522a46f", + "sha256": "b790eb6855afa255a609eaaf88a46ed9e8b04232671cca4d0f8bd0bad27f11ac", + "size": 12822, + "source": "c20a08dc0a79a989e3515068560d5da371c0a2a8:research/p104-shortcut-word-eta-27bit-5stage/check_stage_seam.py" + }, + "source/peer8094/peer8057.tar.gz": { + "git_blob": "3a3ded828f6bbf9b6e6a76ba255d480452f4d269", + "sha256": "0e0d559bdb15e7b647f88a2b5e27fcdc9e28e81d8f4145459876ba6da2e9314c", + "size": 2504361, + "source": "c20a08dc0a79a989e3515068560d5da371c0a2a8:research/p104-shortcut-word-eta-27bit-5stage/peer8057.tar.gz" + }, + "source/peer8094/prepare.py": { + "git_blob": "6717e94acc667184fc925bb75a51a30907be3b40", + "sha256": "bc401e5c47d275617f3c7d162d56ea4c604ef3d4c6637ab2a8aa8627a570a9f6", + "size": 21919, + "source": "c20a08dc0a79a989e3515068560d5da371c0a2a8:research/p104-shortcut-word-eta-27bit-5stage/prepare.py" + }, + "source/peer8094/verify.py": { + "git_blob": "14c6bf5a25ef4aff9418c1aafa088d58c698b101", + "sha256": "705dd39399f315f053c23db76680816fa4e9d5da505b623dba0a27d6a0be2a12", + "size": 3644, + "source": "c20a08dc0a79a989e3515068560d5da371c0a2a8:research/p104-shortcut-word-eta-27bit-5stage/verify.py" + }, + "source/peer8094/w5669_shortcut5.json.gz": { + "git_blob": "2381d62342e3caa457e1ef498f05ba98dcc1b11c", + "sha256": "6ef741c346ea075c4f2ed11f9d42d7076103e72d4a9e5059d495f1cb990fd149", + "size": 1351798, + "source": "c20a08dc0a79a989e3515068560d5da371c0a2a8:research/p104-shortcut-word-eta-27bit-5stage/w5669_shortcut5.json.gz" + } + }, + "fringe_handoff": "4c3ff9f606991a60834d46a9e9fd50c44a6995e7", + "intermediate_peer_head": "490cd470f86157d29c9d3f8da9f96d6e2c3c04e5", + "peer_head": "c20a08dc0a79a989e3515068560d5da371c0a2a8", + "public_handoff": "a5d5fd437a3bb3d0a78f3fb4f6412db8a04bb42a", + "schema_version": 1 +} diff --git a/research/p104-k7-integral-fringe/LICENSE b/research/p104-k7-integral-fringe/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/p104-k7-integral-fringe/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/research/p104-k7-integral-fringe/NOTICE.md b/research/p104-k7-integral-fringe/NOTICE.md new file mode 100644 index 0000000000..da369bebba --- /dev/null +++ b/research/p104-k7-integral-fringe/NOTICE.md @@ -0,0 +1,5 @@ +# Attribution + +The exact [#8095 timeout repair](https://github.com/CrocSwap/integer-mult-bounds/commit/490cd470f86157d29c9d3f8da9f96d6e2c3c04e5) supplies the prior layered assembly, signed replay and typed oracle limits. Its [source archive](source/peer8094/NOTICE.md) retains the original notices and license. The retained construction includes floration’s #8094 five-shortcut profile, Ali Romman’s signed #8057 stack and #8042 quotient analysis, SYLforge’s K7 word, and the #8085 exterior-period proof. Jerry Chen’s #7257 supplies the separately scoped historical CI prerequisite. [License](LICENSE) + +The [Round 428 artifact](https://github.com/ToikY/integer-mult-bounds/tree/4c3ff9f606991a60834d46a9e9fd50c44a6995e7/paired-768/r428) supplies the integral-fringe assembly and setup selector. OpenAI Codex materially assisted the source proof, implementation and verification workflow. diff --git a/research/p104-k7-integral-fringe/PROOF.md b/research/p104-k7-integral-fringe/PROOF.md new file mode 100644 index 0000000000..9e2afe0d90 --- /dev/null +++ b/research/p104-k7-integral-fringe/PROOF.md @@ -0,0 +1,81 @@ +# Fixed-height integral fringe bound + +The complete staged local signed replay passed on the exact source. The rate uses the five stated premises. + +Under the five retained premises, the signed fixed-tape construction gives + +```text +T(n) ≤ 2^228 + 2^85945126846 · n(1+log₂ n)^(1−κ) +κ = 1950428656337/500000000000000 = 0.003900857312674. +``` + +Here n≥2 is the larger signed operand magnitude length in bits. Include the declared input length when a scan must traverse extra bytes. The signed driver charges both scans and restores the input heads, including in the zero and unit cases. One read, write, or one-cell move on a fixed-alphabet tape costs one transition. The finite additive term charges fixed installation. The comparator is [#8095 at 490cd470f86157d29c9d3f8da9f96d6e2c3c04e5](https://github.com/CrocSwap/integer-mult-bounds/commit/490cd470f86157d29c9d3f8da9f96d6e2c3c04e5). The candidate reuses its fixed words, calendar, caller, resource heights, source access, ownership, phase, restoration, precision and tape contracts. [Comparator’s complete signed proof](https://github.com/CrocSwap/integer-mult-bounds/blob/490cd470f86157d29c9d3f8da9f96d6e2c3c04e5/research/p104-k7-sharper-period/PROOF.md) + +## Premises and caller + +The five inherited contracts apply at every admissible instance. Native actions and whole-job adapters obey the declared coordinate, sign, phase and spectator conventions at every positive column multiplicity. Owned streams and suspended centers obey their allocation, erasure and return contracts. The mixed compiler and chronological product, completion and splitting satisfy uniform closure for the fixed template. The fixed-tape access, movement, precision and storage bounds apply at every active size. Finally the analytic decomposition, fine-prime avoidance and exact recovery apply to both signed inputs. [Canonical premise record](https://github.com/CrocSwap/integer-mult-bounds/blob/e54523517d0f03e58352e647c403a5af3e525a57/certificates/selected-result.json) + +The caller uses both input conversions, the two normalized forward transforms, pointwise multiplication, the opposite transform, original-coordinate extraction and scaling, rounding, inverse CRT, carry and sign restoration. The price proof below changes one finite cost estimate for the Gaussian supplier. That supplier uses the same physical widths and selected axes at every call, so the inherited precision and recovery argument uses the same represented data. All-size correctness is conditional on the five contracts. The local scientific verifier checks finite instances. + +## Integral grant and physical suffix + +For an even sender band e and an even receiver band d, the actual `TypedPlan` lower grant is a type-weighted and share-weighted lower integral, floored to an integer. The overlap is + +```text +(max(e, dk/r), min(e+2, (d+2)k/r)). +``` + +A positive grant implies the interval has positive length, since `Measure.mass` returns zero for non-increasing endpoints. Thus `−2r < re−kd < 2k`. The paid grade r is a positive multiple of 1/2 and the productive grade k is a positive integer. In particular re−kd is integral, so `re−kd ≤ 2k−1`. The sender emits `P=r(e−8)` axes and `send_prefix` grants `Q=k(d−8)` axes to the pending recipient. For a funded edge, `5r ≤ 4k` and `r ≥ 1/2`, giving + +```text +0 < P−Q = 8(k−r) + re−kd ≤ 10k−8r−1 ≤ 10k−5. +``` + +The strict lower inequality follows from `P−Q > 8k−10r ≥ 0`. This applies to every actual positive interior grant of either type. The stronger per-cell bound replaces 1 by `gcd(2r,2k)`. The prior #8083 proof and Round 409 referee report give that lattice bound and integrate the coupled phases to obtain the stronger aggregate coefficient `9(k−r)+t r²/(2kL)`, with `t=1−c_G`. Round 409 used #8087’s resource point and the conservative exterior multiplier `22067/21981`. The present proof uses only the weaker pointwise consequence, booked on #8095’s actual word and exterior envelope. [Stronger prior proof and scope](https://github.com/ToikY/integer-mult-bounds/blob/8e7738d0cd3cd37d1aa9815c6ea129bf21e5e1ef/paired-768/r409/price/PEER-INTEGRAL.md) + +## Funded whole-calendar ledger + +For one sender band, type and paid index, let K count birth ticks, C count replicas, and q_i denote interior grants of selected widths Q_i. The actual paid index has B=max(0,K−j·delay[e]) ticks that can issue loans. The singleton count decomposes exactly as + +```text +K C P − B Σ_i q_i Q_i + = K Σ_i q_i(P−Q_i) + K(C−Σ_i q_i)P + (K−B)Σ_i q_i Q_i. +``` + +Apply the bound only to the first term. The second pays the unissued parent and every birth or grant rounding loss. The third pays the lost prefix when the sender issues late. Exterior virtual grants and their 257/256 period multiplier, incomplete tails, group padding, input movement and owner restoration retain their full charges in the existing invoice. + +Let `p_rk` be the funded grade allocation, `D_r` the weighted count of paid grade r and `N_k` the weighted count of productive grade k. The actual two-type split gives each target label of type b share `p_rk w_b/N_k`, with weights 5 and 451. Summing by grade recovers `D_r p_rk`. Its directed capacities imply `Σ_r D_r p_rk r^t ≤ N_k k^t`. Changing variables from sender x to receiver `y=xr/k` introduces `(r/k)^t) in the density `x^(−1−t)dx`. Quantizing down the overlap grants and extending the upper integral to `y≥L` therefore bounds the numerator by + +```text +Σ_k N_k(10k−5) = 10A−5Σ_k N_k ≤ (515/516)·10A, +A = Σ_k k N_k = 677246016 and k ≤ 258. +``` + +The inequality charges the nonnegative per-grade costs against each funded capacity. It needs neither full occupancy nor a minimum actual number of grants. The denominator `tΨ` uses the same directed lower edge sum as #8095. The matched fringe upper `f=(515/516)·10A/(tΨ)` enters the complete Gaussian factor at `L=1874`, `S=263772`, `c_G=17158764376/2^42` and `δ=2^-128` as + +```text +F ≤ (257/256)(1+δ)(SL)^c_G · (1+f/L+δ) / (1−δ)^4. +``` + +The installed and independent enclosures at 112 and 192 bits fund the chosen debit `D=1039699/2^23` and reject the old fringe at D. The positive predecessor control recovers the old factor at `1039701/2^23` and rejects that old factor one tick lower. The new booking is deliberately conservative. The ordinary side already binds with two ticks removed. [Installed and independent price receipts](https://github.com/ToikY/integer-mult-bounds/blob/4c3ff9f606991a60834d46a9e9fd50c44a6995e7/paired-768/r428/REPLAY.md) + +## Fixed-height rate and full cost + +The ordinary debit is `d=1414404/2^20`. With `c_B=4391986206293/2^50`, the installed recurrence computes `u=min(η,(249(c_B−d/H)+b)/250)`, beginning with b=0 and using `b=(floor(10^21u)−1)/10^21` at interior stages. Subtract `5g`, with `g=10^-18`, at the final ceiling. The Gaussian ceiling is `c_G−D/G−5g`. At terminal the ordinary heights are (31808, 502922, 7951907, 125730703, 134217727), η=1/256 and G=208653. + +| Stopped ceiling at those heights | Value | +| --- | ---: | +| #8095 Gaussian crossing, D=1039701/2^23 | 0.003900857312000550659… | +| One-tick Gaussian crossing, D=1039700/2^23 | 0.003900857312571878603… | +| Ordinary crossing | 0.003900857312674217046… | +| Candidate Gaussian crossing, D=1039699/2^23 | 0.003900857313143206547… | + +The old crossing is exactly `113795043963992926650746873/29171803750400000000000000000`. The ordinary crossing is exactly `70271597635576107423265784940945878127/18014398375264256000000000000000000000000`. The candidate Gaussian crossing is `341385131991978779952240619/87515411251200000000000000000`. The booked rate is strictly above the old crossing and strictly below both candidate ceilings. One tick would permit a smaller increase, but falls short of the chosen rate. The signed seam rejects the old debit, G−1, the next displayed tick 0.003900857312675, and missing ordinary guard. Both price tiers exercise 54 strict and four functional signed inequalities. [Signed seam controls](https://github.com/ToikY/integer-mult-bounds/blob/4c3ff9f606991a60834d46a9e9fd50c44a6995e7/paired-768/r428/SIGNED-SEAM.log) + +The entry profile has ordinary heights (3000, 3080), Gaussian height 1024, η=39/10000 and rate 0.00345. The terminal cuts are (32000, 534986, 8486957, 134217724, 268435515). The selector activates at the first public header `2^268644472+2`. The retained live-data ceiling is `6.2pT<297.6n` bits. The entry and terminal recurring log₂ bounds before the selector are 125660246 and 85945126845. The low-size branch converts to the terminal rate for `ceil((κ−0.00345)·268644472)=121121` additional bits. With one selector bit, the complete recurring log₂ bound is `1+max(125660246+121121,85945126845)=85945126846`. + +The fixed setup instantiates nine recipes and two positive carriers, and charges 137589952512 structural actions within the additional `2^40` allowance. With `N₀=2^68+2^40`, the inherited indexed serial bound charges the expanded action count in both the full lookup and the outer multiplier. It yields `217364571993743287866367176320080817069553173293686105666269057384448 < 2^228`. The candidate's local constructor census checked nine recipes and 2,492,277 emitted records at the exact updated selector image. [Inherited expanded setup method](https://github.com/CrocSwap/integer-mult-bounds/blob/490cd470f86157d29c9d3f8da9f96d6e2c3c04e5/research/p104-k7-sharper-period/PROOF.md) + +## Verification scope + +Round 428 observed the literal installed receipt at selector SHA-256 `6dc565fad3b91bcb43ff71397897afcc54fd5f9d595a8f88b91234994d8e70be` and passed independent pricing and the signed seam. Round 429 passed the dense rank-five relay at node 104493 (2,048 forward and 2,048 adjoint values with a wrong-Fourier negative control), both typed returns seeded with real helper 173 (10 and 20 paid axes), restored ownership, and passed the fixed census, cold price, calendar, raw, exterior and nested modes. The independent signed product also passed. The registered verifier covers all listed scopes. See [registered scopes](VERIFY.json) for the complete gate. diff --git a/research/p104-k7-integral-fringe/README.md b/research/p104-k7-integral-fringe/README.md new file mode 100644 index 0000000000..007afa6285 --- /dev/null +++ b/research/p104-k7-integral-fringe/README.md @@ -0,0 +1,31 @@ +# Charge the integral interior fringe at the #8095 profile + +The complete staged local signed replay passed on the exact source. The rate uses the five stated premises. + +The installed price supports conditional κ **0.003900857312674** and recurring `log₂ C = 85945126846` under the five premises of the comparator. The price replaces the Gaussian matched interior fringe bound of `10k` by `10k−5` for a funded recipient of grade k. It books a conservative two-tick decrease in the Gaussian debit, from `1039701/2^23` to `1039699/2^23`. The same five-stage resource profile then binds on its ordinary price. [Proof and complete accounting](PROOF.md) · [Installed price](RESULT.json) + +| Comparison | Exact comparator κ | Exact Δκ | Percentage gain | +| --- | ---: | ---: | ---: | +| Strongest independently reproduced, [#8095 at 490cd470](https://github.com/CrocSwap/integer-mult-bounds/commit/490cd470f86157d29c9d3f8da9f96d6e2c3c04e5) | 0.003900857312000 | `337/500000000000000` = 0.000000000000674 | `337/19504286560` percent ≈ **+0.0000000172782531%** | +| Latest relevant external peer, [#8094 at c20a08dc](https://github.com/CrocSwap/integer-mult-bounds/commit/c20a08dc0a79a989e3515068560d5da371c0a2a8) | 0.003900857267786 | `5611/125000000000000` = 0.000000000044888 | `2244400/1950428633893` percent ≈ **+0.000001150721416%** | + +The exact #8095 timeout-only repair passed its registered local suite. Its hosted retry is separate from this candidate. #8094’s original local 100-second product cap expired, and its unchanged product later passed at 220 seconds alongside the other six exact scopes. [#8095 hosted retry](https://github.com/CrocSwap/integer-mult-bounds/actions/runs/45294927135) · [#8094 local continuation](https://github.com/ToikY/integer-mult-bounds/blob/616be5669b7e21e338bba164e5307b020e9f8005/paired-768/r423/REPLAY.md) + +## Replay from a clean checkout + +Use Git and CPython 3.12 with assertions enabled. Run from the repository root. Use fresh temporary storage outside the checkout, with at least 8 GiB available on both the temporary and checkout volumes. + +```sh +scratch="$(mktemp -d)" +TMPDIR="$scratch" python3.12 -IB scripts/research_package.py --package research/p104-k7-integral-fringe +``` + +The package authenticates its source inputs and constructs the runtime from them. The [literal overlay and observed price](https://github.com/ToikY/integer-mult-bounds/blob/4c3ff9f606991a60834d46a9e9fd50c44a6995e7/paired-768/r428/REPLAY.md) and [independent source proof](https://github.com/ToikY/integer-mult-bounds/blob/4c3ff9f606991a60834d46a9e9fd50c44a6995e7/paired-768/r427/INDEPENDENT.md) can also be replayed separately. See [registered scopes](VERIFY.json) for the full suite. + +## Open next questions + +Can the exact K7 ordinary finite factor support one lower debit tick on the same caller and heights? Compare the current guarded ordinary ceiling with the new Gaussian ceiling before modifying the profile. The remaining Gaussian headroom above the ordinary crossing is about `4.69e-13`, so a larger increase would require a combined price. The earlier phase-averaged fringe is a candidate for that repricing after the ordinary bound moves. + +## Credit + +Clear1nsight’s [#8083](https://github.com/CrocSwap/integer-mult-bounds/pull/8083) and the [Round 409 referee proof](https://github.com/ToikY/integer-mult-bounds/blob/8e7738d0cd3cd37d1aa9815c6ea129bf21e5e1ef/paired-768/r409/price/PEER-INTEGRAL.md) establish the stronger lattice and integrated bounds. Ali Romman supplied the [#8057 typed allocator and signed caller](https://github.com/CrocSwap/integer-mult-bounds/pull/8057) and its underlying [#8042 quotient receiver](https://github.com/CrocSwap/integer-mult-bounds/pull/8042). SYLforge supplied the [#8052 K7 word](https://github.com/CrocSwap/integer-mult-bounds/pull/8052). floration supplied [#8094’s five-shortcut word and resource profile](https://github.com/CrocSwap/integer-mult-bounds/pull/8094). [#8085](https://github.com/CrocSwap/integer-mult-bounds/pull/8085) supplied the four-aligned exterior period proof, and [#8095](https://github.com/CrocSwap/integer-mult-bounds/pull/8095) supplied its exact #8094 instantiation and sharper ordinary tariff. This package applies the sufficient integral fringe bound to that literal combined profile and regenerates its signed invoice. OpenAI Codex materially assisted proof, implementation and verification. diff --git a/research/p104-k7-integral-fringe/RESULT.json b/research/p104-k7-integral-fringe/RESULT.json new file mode 100644 index 0000000000..ed2458ee63 --- /dev/null +++ b/research/p104-k7-integral-fringe/RESULT.json @@ -0,0 +1,174 @@ +{ + "gaussian": { + "trial": "2144845547/549755813888", + "weights": [ + 5, + 451 + ], + "real_targets": [ + 52608, + 52608 + ], + "real_loans": [ + 282336, + 281328 + ], + "weighted_targets": 23989248, + "weighted_loans": 128290608, + "directed_margin": "25058737434575388224575020763/12026966897699221379437011099669697124641", + "grade_cells": 51, + "typed_cells": 88, + "min_individual_share": "84552148502764401372515549359944817029050164931794082594601537579467011/2860129876771506011238618397035687755768702340256804091497779103672800801628608", + "raw_loss": "1039699/8388608", + "finite_loss": { + "debit": "1039699/8388608", + "lower_band": 1874, + "upper_divisor": 1724, + "upper_scale": 263772, + "weighted_target_axes": 677246016, + "fringe": "5901736995608069389540191581324620521801413860360386929124082750806091224963672866617567310611418843401472225382711281447500014585402513226910762825592112669829792027120054261355342806736603627978590777020331891438595334474115444870026633108565163317846674245245974648246364935530747085937780475977774547587255865074478685947555850010539544783984412736284301087359681649960734460655947292401530169586156145809951561959476297728/805524208269002280803516180660470803581637950571577465436975808235985474333097392202771597292725137506857760156786098954722820054048115279995121377925109131938386381984563344323308439099430702667066476756121157124145902826670829203023450246876632650262675459521738429095929617361299172295217061669174337552444585580825737576396912312994824902466941319754084862764211923786998656405626038620551132229231790573366099389052907073", + "psi_lower": "36774473797948037912541634097319747003962336700199693263185882360108702157204359298849184867697091848216479995115497386337385946240131323176845598251098906577844387526162820503736128940557939295960932285381747537950101211679504229529740379309339083420407786722205325615622484024288593604461947377591301975260073070627318995418672896973647110540817123114001402885032828105953443989475620884756624494834416485967126325/39705077055616758278398945718051270079611438391017956157398730393989438789277411838957841865629177832072563146472685672846872214469179617143201512976452800338626006041794233403917197722699527632604968482024969035216709987572500437752314454941061554198481484429943611438686069826395238026562564130057975559635506987142353835625307135663742826983170452337581165507977519446768523155949307595075711756167806976", + "upper_factor": "14303046919640560737606446936436112996165525366573488987571304235560995004465756058050611969194231428708923528537307210431998261466556867471316177088271789594380484625107527721781402454242773294089783007954456306746593510709637863957924083612067428110023391505411359153541169743151078142107722238551170949468304584437734556816291889058572244768588860696059800814696230478765242528771586695297366482938730550708364903888440381382436463292802128278890356655008389419138005252581904257402138768412627840230984099972896732213882997430976553750025600894294504939109625932195287281958912/13125673273338910102949884649219874440869358239504417652316449487029238910404556640368194817233268398376901695133371918219797953226244323913273784818408301422821089299740703658098395941518422985999877296981124269222603090637815486586850274215316410181516020389770090963193606800795149812074841646860312035475926644741877739284667155194017156164354354646241590434168002585441943218998847831721642392923589290133698956282292906036980762956564325853970170439320739643954123734640308981260030830761640228922778609586373046695446008122557377990645803081824585934644193076741543006931875" + }, + "capacity_cut": { + "new": [ + "2356659474246895453004862288340047/5070602400912917605986812821504", + "75413103175900654496155594298779059/162259276829213363391578010288128" + ], + "90": [ + "168820568970742257315174557382401181/162259276829213363391578010288128", + "337641137941484514630349115332889169/324518553658426726783156020576256" + ], + "91": [ + "-156428030449689521334616704420940755/162259276829213363391578010288128", + "-156428030449689521334616704133756587/162259276829213363391578010288128" + ] + } + }, + "entry": { + "kappa": "69/20000", + "ordinary_H": [ + 3000, + 3080 + ], + "numerical_H": 1024, + "ordinary_rates": [ + "687487096732174501/200000000000000000000", + "690000000000001/200000000000000000" + ], + "gaussian_rate": "2078304811/549755813888", + "signed": { + "strict": 54, + "functional": 4, + "smallest_margin": "1/10000000000000000000", + "ordinary_margin": "1/1000000000000000000", + "positive_margin": "138585855931394387223/419430400000000000000000" + }, + "stock": { + "binary_cuts": [ + 3077, + 6221 + ], + "public_exponent_A": 7437, + "first_public_offset": 4, + "initial_s": 7438, + "stage_and_outer_fixed_log_overhead": 1964, + "retimed_first_stripe_margin": 1701, + "retimed_all_size_margin_floor": 1635, + "absolute_log2_private_control_envelope": 3153922, + "storage_upper": "6.2 p T < 297.6 n bits" + }, + "geometry": { + "public_offset_above_2_to_A": 4, + "first_extent_bits_minus_b": -7433, + "last_extent_bits_minus_b": -7432, + "minimum_width": 3809536, + "log2_axis_count": 7412, + "largest_axis_width": 5592406, + "private_clock_log2_upper": 5734316302, + "actual_dense_root_entry_log2": 11184812 + }, + "binary_surcharges": [ + 0, + 25818582 + ], + "log2_B": 125433364, + "log2_C": 125660246 + }, + "terminal": { + "kappa": "1950428656337/500000000000000", + "ordinary_H": [ + 31808, + 502922, + 7951907, + 125730703, + 134217727 + ], + "numerical_H": 208653, + "ordinary_rates": [ + "384302656065184053/100000000000000000000", + "1948982322876679157/500000000000000000000", + "1950343402916629679/500000000000000000000", + "3900855960382181573/1000000000000000000000", + "780171462534801/200000000000000000" + ], + "gaussian_rate": "447460320204527/114708199835172864", + "signed": { + "strict": 54, + "functional": 4, + "smallest_margin": "1/10000000000000000000", + "ordinary_margin": "1/1000000000000000000", + "positive_margin": "41062803994531819/87515411251200000000000000000" + }, + "stock": { + "binary_cuts": [ + 32000, + 534986, + 8486957, + 134217724, + 268435515 + ], + "public_exponent_A": 268644472, + "first_public_offset": 2, + "initial_s": 268644473, + "stage_and_outer_fixed_log_overhead": 1976, + "retimed_first_stripe_margin": 134320142, + "retimed_all_size_margin_floor": 130122687, + "absolute_log2_private_control_envelope": 137438952451, + "storage_upper": "6.2 p T < 297.6 n bits" + }, + "geometry": { + "public_offset_above_2_to_A": 2, + "first_extent_bits_minus_b": -268644468, + "last_extent_bits_minus_b": -268644467, + "minimum_width": 137545971456, + "log2_axis_count": 268644432, + "largest_axis_width": 183251937963, + "private_clock_log2_upper": 187925345127545, + "actual_dense_root_entry_log2": 366503875926 + }, + "binary_surcharges": [], + "log2_B": 85899221583, + "log2_C": 85945126845 + }, + "previous_rate": "121901791/31250000000", + "rate_delta": "337/500000000000000", + "complete_log2_C": 85945126846, + "ordinary_floor": 4474, + "ordinary_matched_suffix_coefficient": "186/25", + "ordinary_finite_debit": "353601/262144", + "ordinary_child_tariff": "2391/1024", + "ordinary_child_contraction": "2390/2391", + "ordinary_child_geometric_sum": 2391, + "ordinary_entry_clock_extra": 5, + "ordinary_terminal_clock_extra": 15, + "entry_price_surcharge": 121121, + "fixed_funding_height_floors": [ + 134145234, + 208653 + ], + "log2_fixed_setup_upper": 228, + "native_setup_transition_upper": 217364571993743287866367176320080817069553173293686105666269057384448, + "native_setup_grade_actions": 269057152, + "max_native_H": 134217727 +} diff --git a/research/p104-k7-integral-fringe/SOURCES.json b/research/p104-k7-integral-fringe/SOURCES.json new file mode 100644 index 0000000000..e7eefb9540 --- /dev/null +++ b/research/p104-k7-integral-fringe/SOURCES.json @@ -0,0 +1,18 @@ +{ + "schema_version": 1, + "base_commit": "0618e75a22cec54d1651394ef83d088551b7f026", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + } + ] +} diff --git a/research/p104-k7-integral-fringe/TASK.json b/research/p104-k7-integral-fringe/TASK.json new file mode 100644 index 0000000000..4acd94155e --- /dev/null +++ b/research/p104-k7-integral-fringe/TASK.json @@ -0,0 +1,107 @@ +{ + "schema_version": 1, + "task_id": "scalar-to-moment", + "priority_revision": 8, + "base_commit": "0618e75a22cec54d1651394ef83d088551b7f026", + "original_card": { + "id": "scalar-to-moment", + "question": "Can a scalar/frame rewrite improve the complete signed moment through paid jobs, productive targets, or both?", + "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", + "docs/research/recursive-invoice-preflight.md" + ], + "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." + ], + "acceptance_gate": "Require a legal chronological rewrite and favorable complete signed target-minus-paid moment with all extra charges. Unchanged ADD counts or unchanged paid-call counts alone decide neither success nor failure. Compiler, native and outer admission remain separate obligations.", + "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." + }, + "first_experiment": "Construct one legal source-bound rewrite and compare complete before/after P and T. Charge restoration, source windows and owned helpers. A paid call need not disappear: a legal target split or rank redistribution may win. Stop if the signed moment is unchanged or the consumer repays the gain. Do not extend a scalar-only census on ADD counts.", + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "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." + ], + "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." + ], + "overlap_terms": [ + "signed moment", + "target split", + "rank exchange", + "scalar rewrite" + ], + "existing_checks": [ + { + "scope": "PR #3998: consecutive A2 scalar contraction", + "evidence": "research/staged544-a2-graph-rewrite/README.md", + "remaining": "A genuinely changed paid itinerary or a distinct independent audit; no default scalar-only expansion.", + "status": "author-checked", + "source_commit": "389268a6b5e0373a3125d5c6fcd6995f4ea324f5", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4019: separated A2 sites with unchanged recursive histogram", + "evidence": "research/staged544-separated-a2/README.md", + "remaining": "A genuinely changed paid itinerary or a distinct independent audit; no default scalar-only expansion.", + "status": "author-checked", + "source_commit": "f408e09df300b575235f7f77f81948071397e16d", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4112: composition audit", + "evidence": "research/staged544-a2-composition-audit/README.md", + "remaining": "A genuinely changed paid itinerary or a distinct independent audit; no default scalar-only expansion.", + "status": "author-checked", + "source_commit": "205b7380656ba4b6316a8a493b1a3c679b8f7a0e", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4152: A1858 contraction audit", + "evidence": "research/staged544-a1858-contraction-audit/README.md", + "remaining": "A genuinely changed paid itinerary or a distinct independent audit; no default scalar-only expansion.", + "status": "author-checked", + "source_commit": "caaa14cde5962adc372fdca71f63d0f29e73c8b2", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "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.", + "status": "reviewed", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + } + ] + }, + "scope_status": "refined", + "actual_scope": "One integral upper bound for interior Gaussian loan suffixes in the exact #8095 signed profile. Use the same physical construction, fixed heights and complete replay scopes.", + "scope_change_reason": "Integral paid/selected intervals strengthen the existing interior suffix bound; the existing ownership census bounds the weighted suffix count.", + "bottleneck_link": "The Gaussian finite debit can be tightened while retaining the ordinary recurrence, phase, owner, precision and tape interfaces. The revised profile must retain both directed margins.", + "budget_minutes": 60, + "stop_rule": "Check only the fixed two-tick Gaussian debit reduction and its literal selector. Stop on a failed prior envelope, directed margin, exact binding, restored output, installation scope, or replay cap.", + "outcome": "completed", + "evidence": "Full independently replayed signed scope at one exact installed profile with a smaller Gaussian interior debit, including product, typed ownership and setup.", + "author": "Campaign contributor", + "ai_assistance": "OpenAI Codex materially assisted period arithmetic, source assembly and the replay workflow.", + "open_questions": [ + { + "question": "Which legal change can reduce the ordinary binding cost at these heights?", + "why_it_matters": "The complete staged bound funds both suppliers and any gain from a second change must be composable with the same signed caller.", + "first_step": "Pin one already paid ordinary receiver term and compare the fully charged directed margin before constructing a new profile.", + "blocked_by": "Prove any changed receiver interface and retain all ownership, input recovery, precision and tape obligations." + } + ] +} diff --git a/research/p104-k7-integral-fringe/VERIFY.json b/research/p104-k7-integral-fringe/VERIFY.json new file mode 100644 index 0000000000..389dbba19a --- /dev/null +++ b/research/p104-k7-integral-fringe/VERIFY.json @@ -0,0 +1,127 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/p104-k7-integral-fringe/INPUTS.json", + "research/p104-k7-integral-fringe/LICENSE", + "research/p104-k7-integral-fringe/RESULT.json", + "research/p104-k7-integral-fringe/source/paired-768/r415/overlay/ASSEMBLY.json", + "research/p104-k7-integral-fringe/source/paired-768/r415/overlay/INPUTS.json", + "research/p104-k7-integral-fringe/source/paired-768/r415/overlay/assemble.py", + "research/p104-k7-integral-fringe/source/paired-768/r415/overlay/price_source.py", + "research/p104-k7-integral-fringe/source/paired-768/r415/overlay/profile_source.py", + "research/p104-k7-integral-fringe/source/paired-768/r415/overlay/seam_source.py", + "research/p104-k7-integral-fringe/source/paired-768/r416/setup/check_installed.py", + "research/p104-k7-integral-fringe/source/paired-768/r416/signed/RECEIPT.json", + "research/p104-k7-integral-fringe/source/paired-768/r417/physical/check.py", + "research/p104-k7-integral-fringe/source/paired-768/r417/setup-receipt/RECEIPT.json", + "research/p104-k7-integral-fringe/source/paired-768/r417/setup-receipt/check_patch.py", + "research/p104-k7-integral-fringe/source/paired-768/r418/oracle/RECEIPT.json", + "research/p104-k7-integral-fringe/source/paired-768/r418/typed/check.py", + "research/p104-k7-integral-fringe/source/paired-768/r419/cross-price/RECEIPT.json", + "research/p104-k7-integral-fringe/source/paired-768/r420/overlay/ASSEMBLY.json", + "research/p104-k7-integral-fringe/source/paired-768/r420/overlay/assemble.py", + "research/p104-k7-integral-fringe/source/paired-768/r420/overlay/price.py", + "research/p104-k7-integral-fringe/source/paired-768/r420/overlay/profile.py", + "research/p104-k7-integral-fringe/source/paired-768/r420/overlay/seam.py", + "research/p104-k7-integral-fringe/source/paired-768/r420/setup/check_installed.py", + "research/p104-k7-integral-fringe/source/paired-768/r428/ASSEMBLY.json", + "research/p104-k7-integral-fringe/source/paired-768/r428/assemble.py", + "research/p104-k7-integral-fringe/source/paired-768/r428/check_setup.py", + "research/p104-k7-integral-fringe/source/paired-768/r428/edits.py", + "research/p104-k7-integral-fringe/source/peer8094/NOTICE.md", + "research/p104-k7-integral-fringe/source/peer8094/PEER-SOURCE.json", + "research/p104-k7-integral-fringe/source/peer8094/PROOF.md", + "research/p104-k7-integral-fringe/source/peer8094/RESULT.json", + "research/p104-k7-integral-fringe/source/peer8094/VERIFY.json", + "research/p104-k7-integral-fringe/source/peer8094/check_cutoff.py", + "research/p104-k7-integral-fringe/source/peer8094/check_ordinary_floor.py", + "research/p104-k7-integral-fringe/source/peer8094/check_stage_seam.py", + "research/p104-k7-integral-fringe/source/peer8094/peer8057.tar.gz", + "research/p104-k7-integral-fringe/source/peer8094/prepare.py", + "research/p104-k7-integral-fringe/source/peer8094/verify.py", + "research/p104-k7-integral-fringe/source/peer8094/w5669_shortcut5.json.gz", + "research/p104-k7-integral-fringe/verify.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "price" + ], + "timeout_seconds": 80, + "checks": "Compare complete regenerated signed receipt, directed ordinary and Gaussian prices, and actual placement." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "calendar" + ], + "timeout_seconds": 365, + "checks": "Check actual matched interval calendar, ownership, cutoff, stage seams and adjacent controls, and ordinary floor." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "raw" + ], + "timeout_seconds": 80, + "checks": "Check both two- and four-column signed native types and all owner returns." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "exterior" + ], + "timeout_seconds": 85, + "checks": "Exercise physical exterior births and verify returned owners." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "nested" + ], + "timeout_seconds": 95, + "checks": "Check actual nonzero typed nested ownership and restoration." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "product" + ], + "timeout_seconds": 210, + "checks": "Check signed products, independent coefficients and restoration." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "native" + ], + "timeout_seconds": 285, + "checks": "Check the dirty physical relay, both true-helper typed widths and the exact installed nine-recipe setup census at the new selector." + } + ] +} diff --git a/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/ASSEMBLY.json b/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/ASSEMBLY.json new file mode 100644 index 0000000000..1519a24ad2 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/ASSEMBLY.json @@ -0,0 +1,49 @@ +{ + "candidate_RESULT": "not generated", + "changed_prepared_paths": { + "PREDECESSOR-RESULT.json": { + "after": "2f4faa6648592f589df22a8a0a07ba6856d20786294a44a7776c7d6e0efa14a5", + "before": null + }, + "RESULT.json": { + "after": null, + "before": "2f4faa6648592f589df22a8a0a07ba6856d20786294a44a7776c7d6e0efa14a5" + }, + "SOURCES.json": { + "after": "c6a31ad88b5f1b60d337b26a02f9e6328129eb7f1ed1b9088bdd0a9295cb866d", + "before": "4046d066c59e1c36446d98c35aab0da2806e9743edab921d9adfdb00b22e42be" + }, + "check_stage_seam.py": { + "after": "57a4f8807833a512760466dcb18a477a9d04112af4e1cf945ac0efd88a330662", + "before": "b790eb6855afa255a609eaaf88a46ed9e8b04232671cca4d0f8bd0bad27f11ac" + }, + "independent_price.py": { + "after": "f7e9c7f697c8af121bdaa7a8dffed21bb86f077a76d12cfc660b79c64d7df39d", + "before": "719c13cdd08254f4229c551f3b9263820724f21579d18be76bda4833302812b0" + }, + "receipt.py": { + "after": "438945be65f7647f85ba0f9bf5cd6dad7db60b39ea148885d7142a7b694184aa", + "before": "492336828d9139ddfd4017ced7355a5de11b569295f87bde5866d4b3db68d4b8" + }, + "runtime.patch": { + "after": "2eb7d8a20b5202774aa787a1313f645e20428419ba85fb8490fe4d76df7f3059", + "before": "73947f929c432137295b586f6b9b56106b5076942817ae6712541e9e726c75c0" + } + }, + "file_count": 53, + "native_bootstrap": "not run", + "parent": "c20a08dc0a79a989e3515068560d5da371c0a2a8", + "physical_profile": { + "baseline_installation_sha256": "5b31cca69a8f10c78152ae030ae7c7ab156d22feec83347b887aa3fe78098ee7", + "baseline_runtime_patch_sha256": "73947f929c432137295b586f6b9b56106b5076942817ae6712541e9e726c75c0", + "baseline_terminal_kappa": "0.003900857267786", + "candidate_installation_sha256": "37460b2be0a93ecfe110be25de5a4ea787c2d09973f926f680ea148453dc89e2", + "candidate_runtime_patch_sha256": "2eb7d8a20b5202774aa787a1313f645e20428419ba85fb8490fe4d76df7f3059", + "candidate_terminal_kappa": "0.003900857269150", + "installation_preimage_sha256": "1c6978b8c7d136ef87191512d9ab9eb3dda8a818844244b96cb165d46d97b1df", + "scope": "Signed installation selector source only. No native or setup replay." + }, + "prepared_peer_path": "research/frequency-weighted-native-multiplier", + "projected_kappa": "0.003900857269150", + "scope": "Exact prepared sources and derived installation image hash only" +} diff --git a/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/INPUTS.json b/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/INPUTS.json new file mode 100644 index 0000000000..a0dea1f066 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/INPUTS.json @@ -0,0 +1,61 @@ +{ + "head": "c20a08dc0a79a989e3515068560d5da371c0a2a8", + "package": "research/p104-shortcut-word-eta-27bit-5stage", + "files": { + "PEER-SOURCE.json": { + "sha256": "798c2e6394c258986484a116198cc542a6d2b4c1f289e5816de2cfecf5141c51", + "git_blob": "6f84b3aef4b8c5026e348d88700bc9401514ccab", + "size": 11897 + }, + "PROOF.md": { + "sha256": "b470831617155e1818b2c2d9340f39ccd88fcc8dedd2177e6bcfbe25f949fd83", + "git_blob": "6dac92ac931233c8dc6d2a88422f0339e94cba32", + "size": 4411 + }, + "RESULT.json": { + "sha256": "915e124475494b08e786eb433e6591d85f2bdedebd624a45b49504c63bbb30e6", + "git_blob": "c2723777ef65312f4fd91ff178d61145cd522525", + "size": 8211 + }, + "VERIFY.json": { + "sha256": "bfb5e28ca4cd85c8acda2bd5c31a31be05ddd8d47b7d1ca7217c9972f91c29a7", + "git_blob": "35fd75e9fec3bb92aa28ef8e8e3dbcc3c6c23efe", + "size": 2671 + }, + "check_cutoff.py": { + "sha256": "a26eeb23591197b94f98a30d43474ffb90c1c4816db5b5ccc243eb3692b95795", + "git_blob": "393a19216fbf9fe4627b05dee4bf6ab7b2ecd81a", + "size": 3125 + }, + "check_ordinary_floor.py": { + "sha256": "d66db3d6d01259216fc1823be7066e676541d820ea8a96a4c513a635e91eb244", + "git_blob": "b49e8a5ea639e7a13c021570b8a3a3f507d1e6ca", + "size": 9663 + }, + "check_stage_seam.py": { + "sha256": "b790eb6855afa255a609eaaf88a46ed9e8b04232671cca4d0f8bd0bad27f11ac", + "git_blob": "82fc94cfa1708a32269eba30b7bac6b74522a46f", + "size": 12822 + }, + "peer8057.tar.gz": { + "sha256": "0e0d559bdb15e7b647f88a2b5e27fcdc9e28e81d8f4145459876ba6da2e9314c", + "git_blob": "3a3ded828f6bbf9b6e6a76ba255d480452f4d269", + "size": 2504361 + }, + "prepare.py": { + "sha256": "bc401e5c47d275617f3c7d162d56ea4c604ef3d4c6637ab2a8aa8627a570a9f6", + "git_blob": "6717e94acc667184fc925bb75a51a30907be3b40", + "size": 21919 + }, + "verify.py": { + "sha256": "705dd39399f315f053c23db76680816fa4e9d5da505b623dba0a27d6a0be2a12", + "git_blob": "14c6bf5a25ef4aff9418c1aafa088d58c698b101", + "size": 3644 + }, + "w5669_shortcut5.json.gz": { + "sha256": "6ef741c346ea075c4f2ed11f9d42d7076103e72d4a9e5059d495f1cb990fd149", + "git_blob": "2381d62342e3caa457e1ef498f05ba98dcc1b11c", + "size": 1351798 + } + } +} diff --git a/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/assemble.py b/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/assemble.py new file mode 100644 index 0000000000..223004a40b --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/assemble.py @@ -0,0 +1,117 @@ +"""Materialize one pinned source overlay without bootstrapping native runtime.""" +from argparse import ArgumentParser +from hashlib import sha1, sha256 +import json +from pathlib import Path +import runpy +import signal +from tarfile import open as tar_open +from tempfile import TemporaryDirectory + +HERE = Path(__file__).resolve().parent +INPUTS_SHA = "cacf5d35f0a2c65df8d5b17b7075f6cea5d98be75d473dee1baa31724f319b64" +BASE = "c20a08dc0a79a989e3515068560d5da371c0a2a8" +PROBE_FILES = ("check_cutoff.py", "check_stage_seam.py", "check_ordinary_floor.py") +CHANGED = {"SOURCES.json", "runtime.patch", "receipt.py", "independent_price.py", + "check_stage_seam.py", "PREDECESSOR-RESULT.json", "RESULT.json"} + + +def read_unique(pairs): + result = dict(pairs) + if len(result) != len(pairs): + raise ValueError("Repeated source pin") + return result + + +def digest(data): + return sha256(data).hexdigest() + + +def verify_inputs(package): + raw = (HERE / "INPUTS.json").read_bytes() + if digest(raw) != INPUTS_SHA: + raise ValueError("Source inventory differs") + pins = json.loads(raw, object_pairs_hook=read_unique) + if pins["head"] != BASE: + raise ValueError("Incorrect comparator pin") + for name, expected in pins["files"].items(): + data = (package / name).read_bytes() + blob = sha1(f"blob {len(data)}\0".encode() + data).hexdigest() + if (digest(data), blob, len(data)) != (expected["sha256"], expected["git_blob"], expected["size"]): + raise ValueError(f"Incorrect source bytes for {name}") + with tar_open(package / "peer8057.tar.gz") as archive: + if sum(item.size for item in archive) > 32 * 1024 * 1024: + raise ValueError("Archive exceeds the source-only capacity") + + +def inventory(root): + return {p.relative_to(root).as_posix(): digest(p.read_bytes()) + for p in sorted(root.rglob("*")) if p.is_file()} + + +def materialize(package, tree): + core = runpy.run_path(str(package / "verify.py")) + peer = core["restore"](tree) + runpy.run_path(str(package / "prepare.py"))["materialize"](peer) + for name in PROBE_FILES: + (peer / name).write_bytes((package / name).read_bytes()) + + initial = inventory(peer) + profile = runpy.run_path(str(HERE / "profile_source.py"))["patch_profile"](peer) + runpy.run_path(str(HERE / "price_source.py"))["patch_prices"](peer) + runpy.run_path(str(HERE / "seam_source.py"))["patch_stage_checks"](peer) + (peer / "RESULT.json").rename(peer / "PREDECESSOR-RESULT.json") + final = inventory(peer) + changed = {name for name in initial.keys() | final.keys() if initial.get(name) != final.get(name)} + if changed != CHANGED: + raise ValueError(f"Unexpected changed prepared paths: {sorted(changed)}") + for name in ("receipt.py", "independent_price.py", *PROBE_FILES, "verify.py", "bootstrap.py"): + compile((peer / name).read_bytes(), name, "exec") + assert not (peer / "RESULT.json").exists() + assert (peer / "runtime.patch").read_text().count('Q(".003900857269150")') == 1 + result = dict( + scope="Exact prepared sources and derived installation image hash only", + parent=BASE, + projected_kappa="0.003900857269150", + physical_profile=profile, + changed_prepared_paths={name: {"before": initial.get(name), "after": final.get(name)} + for name in sorted(changed)}, + prepared_peer_path=peer.relative_to(tree).as_posix(), + file_count=len(final), + native_bootstrap="not run", + candidate_RESULT="not generated", + ) + (tree / "SOURCE-ASSEMBLY.json").write_text(json.dumps(result, indent=2, sort_keys=True) + "\n") + return result + + +def timeout(_signal, _frame): + raise TimeoutError("The one-package source preparation reached its 45-second cap") + + +def main(): + parser = ArgumentParser(description=__doc__) + parser.add_argument("--package-root", required=True, type=Path) + parser.add_argument("--output", type=Path, help="Persist the exact prepared source in a new directory") + args = parser.parse_args() + assert __debug__ + package = args.package_root.resolve() + output = args.output.resolve() if args.output else None + if output and output.exists(): + parser.error("--output must name a new directory") + signal.signal(signal.SIGALRM, timeout) + signal.alarm(45) + try: + verify_inputs(package) + with TemporaryDirectory(prefix="k7-source-overlay-", dir=output.parent if output else None) as temp: + tree = Path(temp) / "prepared" + result = materialize(package, tree) + if output: + tree.rename(output) + print(json.dumps(result, indent=2, sort_keys=True)) + finally: + signal.alarm(0) + + +if __name__ == "__main__": + main() diff --git a/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/price_source.py b/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/price_source.py new file mode 100644 index 0000000000..9faa59139d --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/price_source.py @@ -0,0 +1,100 @@ +"""Apply the proven fixed-height child tariff to the prepared #8094 prices.""" + +from hashlib import sha256 +from pathlib import Path + +BASE_PINS = { + "receipt.py": "492336828d9139ddfd4017ced7355a5de11b569295f87bde5866d4b3db68d4b8", + "independent_price.py": "719c13cdd08254f4229c551f3b9263820724f21579d18be76bda4833302812b0", +} + +RECEIPT_EDITS = ( + ("ORDINARY_DEBIT = Q(1420718, 2**20)\nCHILD_TARIFF = Q(2401, 1024)", + "ORDINARY_DEBIT = Q(1414404, 2**20)\nCHILD_TARIFF = Q(2391, 1024)"), + (''' ordinary_upper = Q("2.557796525567700799") + assert tape_factor(134, BINARY_C, 4474, Q(186, 25)) * Q(255, 256) * CHILD_TARIFF < ordinary_upper + assert ordinary_upper**1048576 < 2**1420718 + assert Q(75, 32) / CHILD_TARIFF == Q(2400, 2401)''', + ''' ordinary_upper = tape_factor(134, BINARY_C, 4474, Q(186, 25)) * Q(255, 256) * CHILD_TARIFF + ordinary_allowance = 2 * Q(power_interval(2, ORDINARY_DEBIT - 1)[0], UNIT) + assert ordinary_upper < ordinary_allowance + worst_child = Q(2390, 1024) + rank_guard = 3**7 # N >= 9 and the quotient mean decreases with N. + assert 21 * rank_guard + 3 <= worst_child * (9 * rank_guard - 1) + assert all(height >= 4 for profile in (ENTRY, TERMINAL) for height in profile.rank_logs) + child_ratio = worst_child / CHILD_TARIFF + assert child_ratio == Q(2390, 2391) + child_sum = 1 / (1 - child_ratio) + assert child_sum == 2391 < 8 * 376 and (Q(7, 10) * child_sum)**2 < 2**22'''), + ("(134145233, 208653)", "(133567098, 208653)"), + (''' older = Q(".003898219753506") + gain = TERMINAL.kappa - older + assert gain == Q(".003900857267786") - Q(".003898219753506")''', + ''' older = Q(".003900857267786") + gain = TERMINAL.kappa - older + assert TERMINAL.kappa == Q(".003900857269150") + assert gain == Q(341, 250000000000000) + old_crossing = Q( + 70271596826947689616436948507028761711, + 18014398375264256000000000000000000000000, + ) + assert older < old_crossing < TERMINAL.kappa + assert TERMINAL.complex_log == 208653 + stop = Q(1, TERMINAL.positive_stop_denominator) + positive_ceiling = GAUSSIAN_C - DEBIT / TERMINAL.complex_log - 5 * stop + assert TERMINAL.kappa < positive_ceiling <= TERMINAL.kappa + Q(1, 10**15) + assert GAUSSIAN_C - DEBIT / (TERMINAL.complex_log - 1) - 5 * stop < TERMINAL.kappa + for invoice in (early, late): + assert (invoice["signed"]["strict"], invoice["signed"]["functional"]) == (54, 4)'''), + (''' ordinary_child_contraction="2400/2401", + ordinary_child_geometric_sum=2401,''', + ''' ordinary_child_contraction=str(child_ratio), + ordinary_child_geometric_sum=int(child_sum),'''), +) + +NEW_INDEPENDENT_CONTROLS = ''' + # Use the unchanged suffix at the new tariff on the same finite factor. + candidate_tariff = Q(2391, 1024) + candidate_lo, candidate_hi = bounds(4474, Q(186, 25), candidate_tariff) + lower_allowance = 2 * powers(2, Q(1414403, 2**20) - 1)[1] + candidate_allowance = 2 * powers(2, Q(1414404, 2**20) - 1)[0] + assert lower_allowance < candidate_lo < candidate_hi < candidate_allowance + child_mean = Q(2390, 1024) + assert 21 * 3**7 + 3 <= child_mean * (9 * 3**7 - 1) + assert 21 * 3**6 + 3 > child_mean * (9 * 3**6 - 1) + assert Q(75, 32) / candidate_tariff > 1 # The coarser bound fails here. + candidate_ratio = child_mean / candidate_tariff + assert candidate_ratio == Q(2390, 2391) + candidate_sum = 1 / (1 - candidate_ratio) + assert candidate_sum == 2391 < 2401 + assert (Q(7, 10) * candidate_sum)**2 < 2**22 and candidate_sum < 8 * 376 + print("PASS_SHARPER_CHILD_TARIFF", 4474, "1414404/1048576", str(candidate_ratio)) +''' + +INDEPENDENT_EDITS = ( + (' print("PASS_CHILD_TARIFF", "2401/1024", "volume<=75/32", "sum=2401", "entry+5", "terminal+9")\n', + ' print("PASS_CHILD_TARIFF", "2401/1024", "volume<=75/32", "sum=2401", "entry+5", "terminal+9")\n' + + NEW_INDEPENDENT_CONTROLS), + ('assert TERMINAL.kappa - peer == Q(".003900857267786") - Q(".0038982016137") and TERMINAL.kappa > c', + '''assert TERMINAL.kappa - Q(".003900857267786") == Q(341, 250000000000000) + assert TERMINAL.kappa > c'''), +) + + +def patch_prices(peer: Path) -> None: + """Authenticate both prepared inputs before writing either edited module.""" + changed = {} + for name, edits in (("receipt.py", RECEIPT_EDITS), ("independent_price.py", INDEPENDENT_EDITS)): + path = peer / name + data = path.read_bytes() + if sha256(data).hexdigest() != BASE_PINS[name]: + raise ValueError(f"Unexpected prepared input {name}") + source = data.decode() + for before, after in edits: + if source.count(before) != 1: + raise ValueError(f"Expected one change point in {name}") + source = source.replace(before, after, 1) + compile(source, name, "exec") + changed[path] = source.encode() + for path, data in changed.items(): + path.write_bytes(data) diff --git a/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/profile_source.py b/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/profile_source.py new file mode 100644 index 0000000000..795e7df833 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/profile_source.py @@ -0,0 +1,91 @@ +"""Bind the fixed-height tariff candidate to the literal signed profile.""" + +from hashlib import sha256 +import json +from pathlib import Path +from subprocess import run +from tempfile import TemporaryDirectory + + +BEFORE = b'TERMINAL = Profile((31808, 502922, 7951907, 125730703, 134217727), 208653, Q(".003900857267786"), Q(1, 256))' +AFTER = BEFORE.replace(b".003900857267786", b".003900857269150") +PREIMAGE = "1c6978b8c7d136ef87191512d9ab9eb3dda8a818844244b96cb165d46d97b1df" +OLD_PATCH = "73947f929c432137295b586f6b9b56106b5076942817ae6712541e9e726c75c0" +OLD_IMAGE = "5b31cca69a8f10c78152ae030ae7c7ab156d22feec83347b887aa3fe78098ee7" + + +def digest(data: bytes) -> str: + return sha256(data).hexdigest() + + +def unique_object(pairs): + result = {} + for key, value in pairs: + if key in result: + raise ValueError(f"Duplicate source manifest key: {key}") + result[key] = value + return result + + +def installation_image(preimage: bytes, patch: bytes) -> bytes: + """Apply just the one path selected by the existing weighted bootstrap.""" + with TemporaryDirectory(prefix="ordinary-profile-source-") as temporary: + target = Path(temporary) / "installations.py" + target.write_bytes(preimage) + run( + ["git", "apply", "--no-index", "--include=installations.py", + "--whitespace=nowarn", "-"], + cwd=temporary, + input=patch, + check=True, + ) + return target.read_bytes() + + +def patch_profile(peer: Path) -> dict: + """Check both exact source images, then change the profile patch and pins.""" + manifest_file = peer / "SOURCES.json" + manifest = json.loads(manifest_file.read_bytes(), object_pairs_hook=unique_object) + patch_file = peer / "runtime.patch" + patch = patch_file.read_bytes() + patch_digest = digest(patch) + images = manifest["runtime_images"]["installations.py"] + if (images != {"before": PREIMAGE, "after": OLD_IMAGE} + or patch_digest != OLD_PATCH + or manifest["local_sources"]["runtime.patch"] != OLD_PATCH): + raise ValueError("The prepared #8094 runtime patch or installation pins differ") + + preimage_path = peer.parent / "tiered-native-multiplier" / "installations.py" + preimage = preimage_path.read_bytes() + if digest(preimage) != PREIMAGE: + raise ValueError("The literal tiered installation preimage differs") + installed = installation_image(preimage, patch) + if digest(installed) != OLD_IMAGE or installed.count(BEFORE) != 1: + raise ValueError("The replayed #8094 installation image differs") + + if patch.splitlines().count(b"+" + BEFORE) != 1 or AFTER in patch: + raise ValueError("Expected exactly one authenticated terminal profile patch line") + candidate_patch = patch.replace(b"+" + BEFORE, b"+" + AFTER, 1) + candidate = installation_image(preimage, candidate_patch) + if candidate != installed.replace(BEFORE, AFTER, 1): + raise ValueError("The candidate changed another installed profile byte") + compile(candidate, "installations.py", "exec") + + candidate_hash = digest(candidate) + new_patch_hash = digest(candidate_patch) + receipt = { + "installation_preimage_sha256": PREIMAGE, + "baseline_installation_sha256": OLD_IMAGE, + "candidate_installation_sha256": candidate_hash, + "baseline_runtime_patch_sha256": patch_digest, + "candidate_runtime_patch_sha256": new_patch_hash, + "baseline_terminal_kappa": "0.003900857267786", + "candidate_terminal_kappa": "0.003900857269150", + "scope": "Signed installation selector source only. No native or setup replay.", + } + images["after"] = candidate_hash + manifest["local_sources"]["runtime.patch"] = new_patch_hash + encoded_manifest = json.dumps(manifest, indent=2) + "\n" + patch_file.write_bytes(candidate_patch) + manifest_file.write_text(encoded_manifest, encoding="utf-8") + return receipt diff --git a/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/seam_source.py b/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/seam_source.py new file mode 100644 index 0000000000..19e724fbee --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r415/overlay/seam_source.py @@ -0,0 +1,89 @@ +"""Adapt the authenticated #8094 seam checker to the fixed-height tariff edit.""" + +from hashlib import sha256 +from pathlib import Path + + +SOURCE_SHA256 = "b790eb6855afa255a609eaaf88a46ed9e8b04232671cca4d0f8bd0bad27f11ac" + + +def patch_stage_checks(peer: Path) -> None: + path = peer / "check_stage_seam.py" + original = path.read_bytes() + if sha256(original).hexdigest() != SOURCE_SHA256: + raise ValueError("The exact #8094 check_stage_seam.py is required") + source = original.decode("utf-8") + replacements = ( + ( + " ORDINARY=Q(1420718,2**20) # floor retune + child tariff + no 256/255 (unchanged by the Gaussian word)", + """ OLD_ORDINARY=Q(1420718,2**20) + ORDINARY=Q(1414404,2**20) # tariff 2391/1024, same floor and fringe + OLD_KAPPA=Q(".003900857267786") + GRID=Q(1,10**15)""", + ), + ( + ' assert TERMINAL.kappa==Q(".003900857267786")', + ' assert TERMINAL.kappa==Q(".003900857269150")', + ), + ( + """ assert ordinary_upper(ranks)>paid and gaussian_upper(TERMINAL.complex_log)>paid + # The ordinary side binds: the install is the 15-digit floor of its rate. + assert TERMINAL.kappa<=ordinary_upper(ranks)-5*STOPgaussian_upper(TERMINAL.complex_log)>paid + old_crossing=ordinary_upper(ranks,OLD_ORDINARY)-5*STOP + assert OLD_KAPPA<=old_crossingold_crossing + assert TERMINAL.kappa+GRID>=gaussian_upper(TERMINAL.complex_log)-5*STOP""", + ), + ( + """ def require_funding(proposed,gaussian): + if ordinary_upper(proposed)<=paid or gaussian_upper(gaussian)<=paid:""", + """ def require_funding(proposed,gaussian,*,debit=ORDINARY,kappa=TERMINAL.kappa): + threshold=kappa+5*STOP + if ordinary_upper(proposed,debit)<=threshold or gaussian_upper(gaussian)<=threshold:""", + ), + ( + """ # The install is the 15-digit floor of the rate, so the lower heights carry + # slack: DROPS[i] is the first drop of height i that falls below the booking. + DROPS=[917, 943, 944, 944, 5] + for i,d in enumerate(DROPS): + require_funding(at(i,-(d-1)),TERMINAL.complex_log) + assert ordinary_upper(previous_record[0]) 0 + assert observed["largest_integer_bits"] < 2**38 and observed["bytes"] < 2**38 + directory_sha256 = sha256(path.read_bytes()).hexdigest() + finally: + Recipe.open, Recipe.width, WeightedRecipe.open, WeightedRecipe.width = saved + overhead = 2*2048*(2**25+1) + sum(map(len, HEIGHTS))*2**24 + assert overhead == 137589952512 < EXTRA_ACTIONS + setup = expanded_serial_bound(EXTRA_ACTIONS) + assert expanded_serial_bound(0) < setup < 2**228 + return dict( + scope="Observed fixed constructor and directory census; conditional all-size setup bound", + installation_sha256=digest, profile=args.profile, heights=HEIGHTS, + positive_carrier_bits=carriers, directory=observed, directory_sha256=directory_sha256, + structural_added_action_ceiling=overhead, extra_indexed_action_budget=EXTRA_ACTIONS, + serial_transition_upper=setup, serial_upper_power=228, + ) + + +def main(): + assert __debug__ + parser = ArgumentParser(description=__doc__) + parser.add_argument("--runtime", type=Path, required=True) + parser.add_argument("--portable", type=Path, required=True) + parser.add_argument("--scratch", type=Path, required=True) + parser.add_argument("--profile", choices=SELECTORS, required=True) + args = parser.parse_args() + for path in ("runtime", "portable", "scratch"): + setattr(args, path, getattr(args, path).resolve()) + def timeout(_signal, _frame): + raise TimeoutError("The installed setup census reached its 150-second cap") + + signal.signal(signal.SIGALRM, timeout) + signal.alarm(150) + try: + print(json.dumps(census(args), indent=2, sort_keys=True)) + finally: + signal.alarm(0) + + +if __name__ == "__main__": + main() diff --git a/research/p104-k7-integral-fringe/source/paired-768/r416/signed/RECEIPT.json b/research/p104-k7-integral-fringe/source/paired-768/r416/signed/RECEIPT.json new file mode 100644 index 0000000000..951ac58807 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r416/signed/RECEIPT.json @@ -0,0 +1,108 @@ +{ + "base_head": "c20a08dc0a79a989e3515068560d5da371c0a2a8", + "word_sha256": "6ef741c346ea075c4f2ed11f9d42d7076103e72d4a9e5059d495f1cb990fd149", + "archive_sha256": "0e0d559bdb15e7b647f88a2b5e27fcdc9e28e81d8f4145459876ba6da2e9314c", + "source_sha256": { + "phase_atlas.py": "6425300f5d3d984290496df0ff411aca6879869b285298e553cd4d94ba02faa7", + "gauss_phase.py": "a087d0dd5f448d39e6a2dfdc876be7238b75a55b8f9c350eda3907a1865bcb56", + "inputs/review/native_verify.py": "3049471905b47b385c88378a1a3be7a18b8858aadd035b8a6da2f4a03b470f38", + "inputs/review/clifford_exact.py": "2982ead07721e83358dc67c6f49c2b4c16a236a6bebdfd72f58221be1f5d0962" + }, + "node": 104493, + "charts": [ + 365, + 1028, + 529 + ], + "rank": 5, + "record": { + "rank": 5, + "left": { + "matrix_rows": [ + 1, + 36, + 68, + 130, + 258, + 8, + 16, + 2, + 6 + ], + "offset": 0, + "quadratic_rows": [ + 0, + 6, + 2, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "linear_Z4": [ + 2, + 3, + 2, + 2, + 2, + 0, + 0, + 0, + 0 + ], + "phase": 0 + }, + "right": { + "matrix_rows": [ + 1, + 392, + 270, + 32, + 64, + 394, + 388, + 128, + 144 + ], + "offset": 29, + "quadratic_rows": [ + 0, + 134, + 142, + 388, + 0, + 0, + 0, + 270, + 392 + ], + "linear_Z4": [ + 2, + 3, + 3, + 2, + 0, + 2, + 2, + 0, + 3 + ], + "phase": 0 + } + }, + "exact_columns_forward": 512, + "exact_columns_adjoint": 512, + "negative_controls": [ + "quarter-turn global phase", + "forward Fourier in adjoint wrapper" + ], + "scope": "One nine-axis compiled relay and its adjoint on the exact Gaussian dyadic grid.", + "remaining": [ + "other four relay roles", + "physical signed calls and owner restoration", + "lift to column bundles and spectator routes", + "registered replay" + ] +} diff --git a/research/p104-k7-integral-fringe/source/paired-768/r417/physical/check.py b/research/p104-k7-integral-fringe/source/paired-768/r417/physical/check.py new file mode 100644 index 0000000000..ba9b01d0d6 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r417/physical/check.py @@ -0,0 +1,187 @@ +"""Replay one literal rank-five relay with its native dense physical primitives.""" + +from argparse import ArgumentParser +from hashlib import sha256 +import json +from pathlib import Path +from shutil import disk_usage +import signal +import sys +from tempfile import gettempdir +from types import SimpleNamespace + +NODE, DONOR, PAIR = 104493, 94870, (365, 529) +RESERVE = 8 * 1024**3 +PINS = { + "strong_complex.py": "8f3fb92523df006e2e94505127088aaf2e64fadd20b3cab2344f62d7690e875d", + "w5669_shortcut5.json.gz": "6ef741c346ea075c4f2ed11f9d42d7076103e72d4a9e5059d495f1cb990fd149", + "check_strong_physical.py": "c1497710e88267cff463ca0ad47acca4d8e88d48c8c4cf563e6ad35c2836d978", +} +MODULES = { + "native_verify": "3049471905b47b385c88378a1a3be7a18b8858aadd035b8a6da2f4a03b470f38", + "raw48": "86c30fd4a906830bb6f4b54cdc0be083bd2649bebf68da7383efd7beee223700", + "compact_columns": "2a9cdf04bbb22fe8e3cc065dd9159916cc13d83a8700477b595faf834be76f50", + "spool": "b24796e8d220eed9107ecf4e7b1bb28bd3c75f1e3596774bb47a9c6af9a0814d", + "positive": "a1b5d1725c6230667646d3e50551d566e2faac39bc39a02c703c3da065f4db5c", +} +RECEIPT = "316bb1a57ea8aa87fb2b565a4899c9b0b5a64ff1513c89e14a19d83ecd58e8e1" +OWNER = "external" +PERM = (1, 0, *range(2, 9)) + + +def digest(data): + return sha256(data).hexdigest() + + +def checked(path, pin): + data = path.read_bytes() + if digest(data) != pin: + raise ValueError(f"Unexpected authenticated bytes for {path.name}") + return data + + +def swap_low_chart_axes(address): + return address ^ ((((address >> 1) ^ (address >> 2)) & 1) * 6) + + +def dirty(seed): + return [((17*j - 11*seed) << 18, (3*j*j + 41*seed - 971) << 18) + for j in range(2048)] + + +def lifted(values, circuit, direct, engine, quarter): + out = [None] * len(values) + for high in (0, 1): + for low in (0, 1): + slots = [low | j << 1 | high << 10 for j in range(512)] + result = direct(circuit, [values[i] for i in slots], engine, quarter) + for i, value in zip(slots, result, strict=True): + out[i] = value + return out + + +def compare(actual, expected, label): + if actual != expected: + index = next(i for i, (a, b) in enumerate(zip(actual, expected, strict=True)) if a != b) + raise AssertionError(f"{label} differs at dense address {index}") + + +def replay(runtime, receipt): + for name, pin in PINS.items(): + checked(runtime / name, pin) + record = json.loads(checked(receipt, RECEIPT)) + if (record["node"], record["charts"][::2], record["rank"]) != (NODE, list(PAIR), 5): + raise ValueError("Round 416 retained a different witness") + if min(disk_usage(runtime).free, disk_usage(gettempdir()).free) < RESERVE: + raise RuntimeError("The 8 GiB native reserve is unavailable") + + sys.path.insert(0, str(runtime)) + from upstream import install + + _, _, _, source = install() + import native_verify as engine + import compact_columns + import positive + import raw48 + import spool + from check_strong_physical import direct + from periodic import Job + from strong_complex import artifacts + + for module in (engine, compact_columns, positive, raw48, spool): + checked(Path(module.__file__), MODULES[module.__name__]) + atlas = artifacts(source / "research/grade14-native-realization", runtime / "inputs") + assert atlas.moves[NODE] == PAIR and atlas.forms[NODE] == ((DONOR, 1),) + rank, right, left = atlas.factors[PAIR] + r = record["record"] + assert (rank, right, left) == (5, raw48.monomial(r["right"]), raw48.monomial(r["left"])) + old, new = (engine.frame(tuple(atlas.graph["frames"][i]), 9) for i in PAIR) + forward = engine.adjoint(old) + new + backward = engine.adjoint(new) + old + + # Install the literal node's paid action inside the live graph generator. + # The synthetic identity helper supplies its predecessor row without + # materializing the unrelated full raw caller or its numerical calendar. + identity = (PAIR[0], PAIR[0]) + excerpt = SimpleNamespace( + graph={"initial": [PAIR[0]], "final": [PAIR[0]], + "schedule": [DONOR, NODE], "first_output": NODE}, + moves={NODE: PAIR}, forms={DONOR: ((~0, 1),), NODE: atlas.forms[NODE]}, + factors={identity: (9, (), ()), PAIR: (rank, right, left)}, + regs=[], main=set(), layout={"source_labels": [DONOR]}, odd=atlas.odd, + ) + clock, call_row = next((i, row) for i, row in enumerate(atlas.instructions()) if row[0] == "NATIVE") + call, color = call_row[1:3] + columns = compact_columns.Columns(1, 0, 1, 0, 0, 0, 1, spool.cold_swap) + arena = spool.Arena(11, 32) + field = arena.field() + initial = dirty(365) + field.write(initial) + fields = {OWNER: field} + raw = raw48.ComplexRaw(excerpt, fields, columns, low=1, bundle=1, slots=9) + helpers = {("helper", clock, call, DONOR): Job(OWNER, PERM)} + tape = raw.graph(clock, call, color, (), helpers, {}, 1) + tag, job = next(tape) + assert tag == ("return", clock, call, NODE) + assert tuple(job.axes) == tuple(range(rank)) + assert set(fields) == {OWNER, job.owner} and fields[job.owner] is not field + loan = fields[job.owner] + aligned = [tuple(atlas.odd*v for v in initial[swap_low_chart_axes(i)]) for i in range(2048)] + before_child = lifted(aligned, engine.monomial(r["right"]), direct, engine, spool.quarter) + compare(list(loan.values()), before_child, "Published scratch") + compare(list(field.values()), initial, "Owned field during publication") + for axis in job.axes: + positive.one_axis(loan, axis + 1) + assert next(tape, None) is None + assert fields == {OWNER: field} and arena.live == 1 + canonical = [initial[swap_low_chart_axes(i)] for i in range(2048)] + result = lifted(canonical, forward, direct, engine, spool.quarter) + expected = [result[swap_low_chart_axes(i)] for i in range(2048)] + compare(list(field.values()), expected, "Signed output after owner return") + + inverse_input = dirty(529) + field.write(inverse_input) + raw.chart(field, left, range(9), 1, inverse=True) + for axis in range(rank): + positive.one_axis(field, axis + 1) + columns.row(field, (axis + 1,)) + raw.chart(field, right, range(9), 1, inverse=True) + inverse_expected = lifted(inverse_input, backward, direct, engine, spool.quarter) + compare(list(field.values()), inverse_expected, "Independent adjoint output") + wrong = lifted(inverse_input, engine.adjoint(engine.monomial(r["left"])) + + engine.fourier(rank) + engine.adjoint(engine.monomial(r["right"])), + direct, engine, spool.quarter) + assert wrong != inverse_expected + assert arena.live == 1 and fields.pop(OWNER) is field and not fields + field.retire() + arena.close() + return { + "scope": "One-column dense physical chart and actual graph scratch lifecycle, with synthetic identity boundary", + "node": NODE, "charts": PAIR, "literal_donor": DONOR, + "paid_tag": tag, "paid_rank": rank, "spectator_fibres": 4, + "forward_values": len(initial), "adjoint_values": len(inverse_input), + "wrong_fourier_rejected": True, "external_owner_restored": True, + } + + +def timeout(_signum, _frame): + raise TimeoutError("The one-relay installed fixture reached its 90-second cap") + + +def main(): + parser = ArgumentParser(description=__doc__) + parser.add_argument("--runtime", type=Path, required=True) + parser.add_argument("--relay-receipt", type=Path, required=True) + args = parser.parse_args() + if not __debug__: + raise RuntimeError("Enable assertions for the exact fixture") + signal.signal(signal.SIGALRM, timeout) + signal.alarm(90) + try: + print(json.dumps(replay(args.runtime.resolve(), args.relay_receipt), indent=2)) + finally: + signal.alarm(0) + + +if __name__ == "__main__": + main() diff --git a/research/p104-k7-integral-fringe/source/paired-768/r417/setup-receipt/RECEIPT.json b/research/p104-k7-integral-fringe/source/paired-768/r417/setup-receipt/RECEIPT.json new file mode 100644 index 0000000000..1b6fedb385 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r417/setup-receipt/RECEIPT.json @@ -0,0 +1,9 @@ +{ + "corrected_sha256": "5d647aea991322addecbbb68565f20cf585badc3dadc82e392ce2feb86986c62", + "expanded_setup_transitions": 217364571993743287866367176320080817069553173293686105666269057384448, + "legacy_setup_transitions": 217364570380528137475793294892811967875864032914108887556978854854656, + "preimage": "438945be65f7647f85ba0f9bf5cd6dad7db60b39ea148885d7142a7b694184aa", + "scope": "Literal prepared receipt calculation and missing-lookup control; installed execution unrun", + "stale_lookup_mutation_transitions": 217364571190274262743716685292688335482457826921929987660068646027264, + "stale_lookup_rejected": true +} diff --git a/research/p104-k7-integral-fringe/source/paired-768/r417/setup-receipt/check_patch.py b/research/p104-k7-integral-fringe/source/paired-768/r417/setup-receipt/check_patch.py new file mode 100644 index 0000000000..84d1b6e805 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r417/setup-receipt/check_patch.py @@ -0,0 +1,95 @@ +"""Replay the fixed setup receipt correction on the prepared Round 415 source.""" +from argparse import ArgumentParser +import ast +from hashlib import sha256 +import json +from pathlib import Path + +PREIMAGE = "438945be65f7647f85ba0f9bf5cd6dad7db60b39ea148885d7142a7b694184aa" +LEGACY = 217364570380528137475793294892811967875864032914108887556978854854656 +EXPANDED = 217364571993743287866367176320080817069553173293686105666269057384448 +OLD = " setup = native_clock()\n" +NEW = """ setup = native_clock() + indexed_setup_actions = 2**68 + 2**40 + lookup = 8 * (4 * setup["max_datum_bits"] * indexed_setup_actions) * 512 * 128 + setup["all_setup"] = ( + (indexed_setup_actions + 1) + * (lookup + setup["local_arithmetic"] + 2**120) + * 2**32 + ) +""" + + +def digest(data): + return sha256(data).hexdigest() + + +def patch_source(source): + if digest(source) != PREIMAGE: + raise ValueError("Prepared receipt source differs") + if source.count(OLD.encode()) != 1: + raise ValueError("Expected exactly one setup receipt anchor") + output = source.replace(OLD.encode(), NEW.encode()) + compile(output, "receipt.py", "exec") + return output + + +def setup_slice(source, native_clock): + tree = ast.parse(source) + for body in (node.body for node in tree.body if isinstance(node, ast.FunctionDef)): + for i, node in enumerate(body): + if not isinstance(node, ast.Assign) or ast.unparse(node.value) != "native_clock()": + continue + end = i + 1 + while end < len(body) and isinstance(body[end], ast.Assign): + if ast.unparse(body[end].targets[0]) not in ( + "indexed_setup_actions", "lookup", "setup['all_setup']", + ): + break + end += 1 + namespace = {"native_clock": native_clock} + exec(compile(ast.Module(body=body[i:end], type_ignores=[]), "receipt.py", "exec"), + namespace) + return namespace["setup"]["all_setup"] + raise ValueError("Missing setup calculation") + + +def check(source): + updated = patch_source(source) + w = 2**38 + h = 2*w + 2 + local = 2**16*(h+4)*(7*h+9) + 8*2**16*(h+4)**2 + + def inherited(): + return dict(max_datum_bits=w, all_setup=LEGACY, local_arithmetic=local) + + assert setup_slice(source, inherited) == LEGACY + assert setup_slice(updated, inherited) == EXPANDED < 2**228 + mutated = updated.replace(b"4 * setup[\"max_datum_bits\"] * indexed_setup_actions", + b"4 * setup[\"max_datum_bits\"] * 2**68") + assert mutated != updated + stale = setup_slice(mutated, inherited) + assert LEGACY < stale < EXPANDED + return { + "scope": "Literal prepared receipt calculation and missing-lookup control; installed execution unrun", + "preimage": PREIMAGE, "corrected_sha256": digest(updated), + "legacy_setup_transitions": LEGACY, "expanded_setup_transitions": EXPANDED, + "stale_lookup_mutation_transitions": stale, "stale_lookup_rejected": stale != EXPANDED, + }, updated + + +def main(): + assert __debug__ + parser = ArgumentParser(description=__doc__) + parser.add_argument("receipt", type=Path) + parser.add_argument("--output", type=Path, help="Write the correction to a new path") + args = parser.parse_args() + receipt, updated = check(args.receipt.read_bytes()) + if args.output: + with args.output.open("xb") as stream: + stream.write(updated) + print(json.dumps(receipt, indent=2, sort_keys=True)) + + +if __name__ == "__main__": + main() diff --git a/research/p104-k7-integral-fringe/source/paired-768/r418/oracle/RECEIPT.json b/research/p104-k7-integral-fringe/source/paired-768/r418/oracle/RECEIPT.json new file mode 100644 index 0000000000..53232abb30 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r418/oracle/RECEIPT.json @@ -0,0 +1 @@ +{"scope":"Exact source-only chart, paid boundary and terminal rays; installed run unvisited","source_label":173,"initial_terminal_charts":[3,127],"relay":104493,"relay_coefficient":"-2","pre_child_global_factor":"-287059239366334164389409750","nonmain_cone_origins":222,"normalized_terminals":{"173":"1"},"endpoint_rank":9,"endpoint_record":{"rank":9,"left":{"matrix_rows":[1,2,4,8,16,32,64,128,256],"offset":0,"quadratic_rows":[0,0,0,0,0,0,0,0,0],"linear_Z4":[2,2,2,2,2,2,2,2,2],"phase":0},"right":{"matrix_rows":[1,2,4,8,16,32,64,128,256],"offset":511,"quadratic_rows":[0,0,0,0,0,0,0,0,0],"linear_Z4":[2,2,2,2,2,2,2,2,2],"phase":1}},"kind_oracles":{"0":[{"basis":11,"before_paid":{"first":99,"support":4,"pivot":["-1/2","0"],"phases":[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1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,2,3,0,0,1,0,1,1,2,3,0,0,1,1,2,2,3,0,1,1,2,3,0,0,1,2,3,3,0,0,1,1,2,3,0,0,1,3,0,0,1,2,3,3,0,0,1,1,2,3,0,0,1,2,3,3,0,1,2,2,3,3,0,0,1,2,3,3,0,3,0,0,1,2,3,3,0,0,1,1,2,3,0,0,1,2,3,3,0,1,2,2,3,3,0,0,1,2,3,3,0,2,3,3,0,1,2,2,3,3,0,0,1,2,3,3,0,1,2,2,3,0,1,1,2,2,3,3,0,1,2,2,3,2,3,3,0,1,2,2,3,3,0,0,1,2,3,3,0,1,2,2,3,0,1,1,2,2,3,3,0,1,2,2,3,1,2,2,3,0,1,1,2,2,3,3,0,1,2,2,3,0,1,1,2,3,0,0,1,1,2,2,3,0,1,1,2,0,1,1,2,3,0,0,1,1,2,2,3,0,1,1,2,3,0,0,1,2,3,3,0,0,1,1,2,3,0,0,1,3,0,0,1,2,3,3,0,0,1,1,2,3,0,0,1,2,3,3,0,1,2,2,3,3,0,0,1,2,3,3,0,3,0,0,1,2,3,3,0,0,1,1,2,3,0,0,1,2,3,3,0,1,2,2,3,3,0,0,1,2,3,3,0,2,3,3,0,1,2,2,3,3,0,0,1,2,3,3,0,1,2,2,3,0,1,1,2,2,3,3,0,1,2,2,3]}}]}} diff --git a/research/p104-k7-integral-fringe/source/paired-768/r418/typed/check.py b/research/p104-k7-integral-fringe/source/paired-768/r418/typed/check.py new file mode 100644 index 0000000000..d46dbfa128 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r418/typed/check.py @@ -0,0 +1,193 @@ +"""Check the full installed typed return seeded at exact helper 173.""" +from argparse import ArgumentParser +from fractions import Fraction +from hashlib import sha256 +import json +from pathlib import Path +from shutil import disk_usage +import signal +import sys +from tempfile import gettempdir + +NODE, SEED, CONTROL = 104493, 173, 164 +ORACLE_SHA = "41a48b4b9641963b3d1f7ac64210d82fdefd6632b95ac0388e1799d99f6fe050" +PINS = { + "strong_complex.py": "8f3fb92523df006e2e94505127088aaf2e64fadd20b3cab2344f62d7690e875d", + "w5669_shortcut5.json.gz": "6ef741c346ea075c4f2ed11f9d42d7076103e72d4a9e5059d495f1cb990fd149", + "typed_raw.py": "0c268432c9d48798c17d927f2d900b5e69dfc6585166cd71f253913e389c3b47", + "check_nonzero_eight.py": "e0955bbbdef1a19668cc62fc1f500574705fc484224e571c47426793a6ec631a", +} +ROOTS = ((1, 0), (0, 1), (-1, 0), (0, -1)) + + +def product(a, b): + return a[0]*b[0]-a[1]*b[1], a[0]*b[1]+a[1]*b[0] + + +def fourier(data, rank): + """Independent convolution with the rank-r Gaussian kernel on each ray.""" + scalar, rays = data + kernel_factor = ((1, 0), (1, 1), (0, 2), (-2, 2))[rank % 4] + power = (-4) ** (rank // 4) + kernel_factor = tuple(power*x for x in kernel_factor) + output = [] + for ray in rays: + real, imag = [0]*512, [0]*512 + for idx, phase in enumerate(ray): + if phase >= 0: + for flip in range(1 << rank): + a, b = ROOTS[(phase - flip.bit_count()) % 4] + real[idx ^ flip] += a + imag[idx ^ flip] += b + vector = tuple(zip(real, imag, strict=True)) + pivot = next(z for z in vector if z != (0, 0)) + lookup = {product(pivot, q): i for i, q in enumerate(ROOTS)} + output.append(tuple(-1 if q == (0, 0) else lookup[q] for q in vector)) + scalar = product(scalar, product(pivot, kernel_factor)) + den = 1 << (rank*len(rays)) + assert all(x % den == 0 for x in scalar) + return tuple(x//den for x in scalar), tuple(output) + + +def expected(oracle, kind, origin, scalar, phase): + records = oracle["kind_oracles"][str(kind)] + assert tuple(r["basis"] for r in records) == origin + if phase != "terminal": + scale = int(oracle["pre_child_global_factor"]) + scalar = tuple(scale*v for v in scalar) + for r in records: + scalar = product(scalar, tuple(map(Fraction, r[phase]["pivot"]))) + assert all(v.denominator == 1 for v in scalar) + return tuple(map(int, scalar)), tuple(tuple(r[phase]["phases"]) for r in records) + + +def read_oracle(path): + data = path.read_bytes() + assert sha256(data).hexdigest() == ORACLE_SHA + return json.loads(data) + + +def run(runtime, kind, oracle_path): + for name, digest in PINS.items(): + assert sha256((runtime/name).read_bytes()).hexdigest() == digest, name + if min(disk_usage(runtime).free, disk_usage(gettempdir()).free) < 8*1024**3: + raise RuntimeError("The 8 GiB native reserve is unavailable") + sys.path.insert(0, str(runtime)) + from upstream import install + + install() + from band_product import production_supplier + from check_nonzero_eight import Axes, Field, WitnessRaw, addresses, basis, diagonal, rot + from periodic import Job + from typed_raw import TypedRaw + + class RayField(Field): + def blank(self): + return RayField(self.stock) + + def phase(self, op, suffix): + if self.data is None: + return + z, rays = self.data + base = op(0) % 4 + z = rot(z, base) + single = tuple((op(x)-base) % 4 for x in addresses(0, len(rays))) + output = [] + for col, ray in enumerate(rays): + assert all((op(x)-base) % 4 == t for x, t in zip( + addresses(col, len(rays)), single, strict=True)) + value, phase = diagonal(ray, single) + output.append(value) + z = rot(z, phase) + self.data = z, tuple(output) + + producer = production_supplier(1024, 10**18) + atlas, word = producer.physical, producer.word + assert atlas.layout["source_labels"][SEED] == SEED and SEED not in atlas.main + assert atlas.layout["source_labels"][CONTROL] == CONTROL and CONTROL in atlas.main + assert (atlas.graph["initial"][SEED], atlas.graph["final"][SEED]) == (3, 127) + assert atlas.moves[NODE] == (365, 529) and atlas.forms[NODE] == ((94870, 1),) + assert dict(atlas.forms[94870])[~SEED] == -2 + clock, call = next((i, row[1]) for i, row in enumerate(atlas.instructions()) if row[0] == "NATIVE") + seed_tag = ("helper", clock, call, SEED) + assert all(p.tag != ("helper", clock, call, CONTROL) for p in word.targets) + owner, = (i for i, p in enumerate(word.targets) if p.tag == seed_tag) + assert word.targets[owner].rank == 9 + chosen = ("return", clock, call, NODE) + spec = producer.recipe.types()[kind] + columns = 2*(1+kind) + oracle = read_oracle(oracle_path) + origins = tuple((37*i+11+17*kind) % 512 for i in range(columns)) + initial = ((3 if not kind else -7) << 2048, (5 if not kind else 2) << 2048) + before_paid = expected(oracle, kind, origins, initial, "before_paid") + after_paid = expected(oracle, kind, origins, initial, "after_paid_before_left") + terminal = expected(oracle, kind, origins, initial, "terminal") + assert fourier(before_paid, 5) == after_paid + + class Observed(WitnessRaw): + trace = None + + def raw(self, bound, width): + assert width == columns + for tag, job in super().raw(bound, width): + if tag != chosen: + yield tag, job + continue + assert self.trace is None and self.fields[owner] is original[owner] + assert tuple(job.axes) == tuple(range(5*columns)) + loan = self.fields[job.owner] + assert job.owner not in original and loan.data is not None + assert loan.data == before_paid + yield tag, job + assert self.fields[job.owner] is loan and loan.data == after_paid + self.trace = (job.owner, loan, len(job.axes)) + + stock = [0, 0] + fields = {i: RayField(stock) for i in range(len(spec.targets))} + original = fields.copy() + jobs = [Job(i, range(2*k)) for i, k in enumerate(spec.targets)] + fields[owner].data = initial, tuple(basis(i) for i in origins) + assert fourier(fields[owner].data, 9) == terminal + raw = Observed(atlas, fields, Axes(), low=0, bundle=1, slots=2*306) + it = TypedRaw(word, raw).native(jobs, 2+kind) + live = 0 + for rank in spec.paid: + job = next(it) + assert len(job.axes) == 2*rank + field = fields[job.owner] + if field.data is not None: + live += 1 + for axis in job.axes: + field.paid(axis) + assert next(it, None) is None and raw.trace is not None + token, loan, axes = raw.trace + assert token not in fields and not loan.live + assert fields.keys() == original.keys() and all(fields[i] is f for i, f in original.items()) + assert {i: f.data for i, f in fields.items() if f.data is not None} == {owner: terminal} + assert all(f.writes and f.live for f in fields.values()) + for field in fields.values(): + field.retire() + assert stock[0] == 0 + return dict(kind=kind, columns=columns, seed_tag=seed_tag, observed_tag=chosen, + paid_axes=axes, original_owners=len(original), nonzero_paid=live, + exact_terminal=True, bad_seed_164_absent=True, retired_relay_scratch=True) + + +def timeout(_sig, _frame): + raise TimeoutError("The installed typed-return probe reached its per-kind time cap") + + +if __name__ == "__main__": + assert __debug__ + p = ArgumentParser(description=__doc__) + p.add_argument("--runtime", type=Path, required=True) + p.add_argument("--kind", type=int, choices=(0, 1), required=True) + p.add_argument("--oracle", type=Path, default=Path(__file__).resolve().parent.parent / + "oracle/RECEIPT.json") + args = p.parse_args() + signal.signal(signal.SIGALRM, timeout) + signal.alarm((100, 160)[args.kind]) + try: + print(json.dumps(run(args.runtime.resolve(), args.kind, args.oracle), indent=2)) + finally: + signal.alarm(0) diff --git a/research/p104-k7-integral-fringe/source/paired-768/r419/cross-price/RECEIPT.json b/research/p104-k7-integral-fringe/source/paired-768/r419/cross-price/RECEIPT.json new file mode 100644 index 0000000000..7140a2a5da --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r419/cross-price/RECEIPT.json @@ -0,0 +1,25 @@ +{ + "scope": "Directed rescale of the pinned finite loss; installed science unrun", + "lower_x": "21981/86", + "old_period": "22067/21981", + "changed_period": "257/256", + "debit": "1039701/8388608", + "old_debit": "32493/262144", + "adjacent_shortfall": "162189833839590717396010000493472337612686051077178206948436963839448987565365783115599833834262523827371677191328512705309239151202251945351566655776117073577352427554612031605195206508669145400862723922166283251306553939621795668117682587004642815809268760898020099497416822788364568636097736382889501613590987695853135607234784363861391602247244659065113161387765861960828653965857626972173536248490950011710121303954655324462862455279989498350350174258353873988330889444075572378303034296035853223834453079030205003372256031903335938336365106455614583617995836266205701880883375054412815789325641409461361359126604982515448352467353/2249828665540450910683940065558561332761494884138609873020656627231022912543224514579459278889633522326721755615338020452306488063717483965316670471119670255550824506365586283598369348712006442135563120401155160875337847806387932425970687000238687641019186771014712906467977608350226165708896080916165399498801841570672736181006260126046988142266110975185235454646786396048311222473877194957387110698327398274948194483131314005948295216938037738095545906598026259821803479896067128342463444957633992240642913584877938644071047047597741826292259778255165140728718939202568685298328390957461115600095907310486824839040876529979877159757414400000", + "reserve": "161558214725530676224224806405131604675861779004862888034812807775884623100499385290957766328394371139062229961888977440879553722013669464498619421352146416026915477653137607537803990248927366217300333707033728539920782772084987550901196139856893522930459094442141440983695860222414665033333308664189848025047581781566301596097711316287946891377699426866459091215492290413321773667473451716512842019743203174502118716609723335209859261856027818609632169589023721173433282098059767361032295568800658188505763729303883827761098206167165856898995637949873932901988030360165963242412359483213411012215748276784970063219519542021628309208713/8999314662161803642735760262234245331045979536554439492082626508924091650172898058317837115558534089306887022461352081809225952254869935861266681884478681022203298025462345134393477394848025768542252481604620643501351391225551729703882748000954750564076747084058851625871910433400904662835584323664661597995207366282690944724025040504187952569064443900740941818587145584193244889895508779829548442793309593099792777932525256023793180867752150952382183626392105039287213919584268513369853779830535968962571654339511754576284188190390967305169039113020660562914875756810274741193313563829844462400383629241947299356163506119919508639029657600000", + "positive_ceiling": "113795043963992926650746873/29171803750400000000000000000", + "ordinary_ceiling": "70271597635576107423265784940945878127/18014398375264256000000000000000000000000", + "binding": "positive", + "projected_kappa": "121901791/31250000000", + "gain_over_frozen_tariff": "857/20000000000000", + "gain_over_pending_8094": "22107/500000000000000", + "recurring_log2_C": 85945126846, + "entry_conversion": 121121, + "terminal_scalar": { + "strict": 54, + "functional": 4, + "smallest_margin": "1/10000000000000000000", + "ordinary_margin": "1/1000000000000000000", + "positive_margin": "16063725946873/29171803750400000000000000000" + } +} diff --git a/research/p104-k7-integral-fringe/source/paired-768/r420/overlay/ASSEMBLY.json b/research/p104-k7-integral-fringe/source/paired-768/r420/overlay/ASSEMBLY.json new file mode 100644 index 0000000000..d9a45e0dfd --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r420/overlay/ASSEMBLY.json @@ -0,0 +1,47 @@ +{ + "candidate_RESULT": "not generated", + "changed_from_frozen": { + "SOURCES.json": { + "after": "bc16e0da6b59d42f22b81baeebc0ef50ed96a9e265922e678b0be72e5f22fe6c", + "before": "c6a31ad88b5f1b60d337b26a02f9e6328129eb7f1ed1b9088bdd0a9295cb866d" + }, + "check_stage_seam.py": { + "after": "57d5ac6ac268fc07fbd92447abf297a2e2f4ea4f5a6c2da95d0abb1ca75d08ca", + "before": "57a4f8807833a512760466dcb18a477a9d04112af4e1cf945ac0efd88a330662" + }, + "independent_price.py": { + "after": "267fdaa92130165bd42c716a6579c3c25ea7424be654118d2a386ce6f1676b6e", + "before": "f7e9c7f697c8af121bdaa7a8dffed21bb86f077a76d12cfc660b79c64d7df39d" + }, + "positive_debit.py": { + "after": "89e715555dee209867b45b0a763f207dd0a479f8bc9fbf542b73fa4048415def", + "before": "32ee6a20e8f7fe6e2d1a3852b232179b0c6736c816f5bfd7bd9ec62cbffa9eb8" + }, + "receipt.py": { + "after": "3aca2167fbc5995cb3d928d0f08e087be0dfa4019dd689538d1e101366118b5e", + "before": "438945be65f7647f85ba0f9bf5cd6dad7db60b39ea148885d7142a7b694184aa" + }, + "runtime.patch": { + "after": "77dd66e595835c68a4d6a1df2e45e538a97d2fe046b2c18726281854af5b151e", + "before": "2eb7d8a20b5202774aa787a1313f645e20428419ba85fb8490fe4d76df7f3059" + } + }, + "native_bootstrap": "not run", + "original_peer": "c20a08dc0a79a989e3515068560d5da371c0a2a8", + "physical_profile": { + "baseline_installation_sha256": "37460b2be0a93ecfe110be25de5a4ea787c2d09973f926f680ea148453dc89e2", + "baseline_runtime_patch_sha256": "2eb7d8a20b5202774aa787a1313f645e20428419ba85fb8490fe4d76df7f3059", + "baseline_sources_sha256": "c6a31ad88b5f1b60d337b26a02f9e6328129eb7f1ed1b9088bdd0a9295cb866d", + "baseline_terminal_kappa": "0.003900857269150", + "candidate_installation_sha256": "c5d83f8c6acdab6828185bc6bb67537cf320ba79ab177f9da535edae7b5af72e", + "candidate_runtime_patch_sha256": "77dd66e595835c68a4d6a1df2e45e538a97d2fe046b2c18726281854af5b151e", + "candidate_sources_sha256": "bc16e0da6b59d42f22b81baeebc0ef50ed96a9e265922e678b0be72e5f22fe6c", + "candidate_terminal_kappa": "0.003900857312000", + "installation_preimage_sha256": "1c6978b8c7d136ef87191512d9ab9eb3dda8a818844244b96cb165d46d97b1df", + "scope": "Literal installation selector and dependency pins; installed science unrun" + }, + "prepared_peer_path": "research/frequency-weighted-native-multiplier", + "prior_projected_kappa": "0.003900857269150", + "projected_kappa": "0.003900857312000", + "scope": "Exact positive-period source assembly; native replay unrun" +} diff --git a/research/p104-k7-integral-fringe/source/paired-768/r420/overlay/assemble.py b/research/p104-k7-integral-fringe/source/paired-768/r420/overlay/assemble.py new file mode 100644 index 0000000000..e62d980931 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r420/overlay/assemble.py @@ -0,0 +1,96 @@ +"""Assemble the single sharper-period candidate from exact frozen public inputs.""" +from argparse import ArgumentParser +from hashlib import sha256 +import json +from pathlib import Path +import runpy +import signal +from tempfile import TemporaryDirectory + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +PEER = "c20a08dc0a79a989e3515068560d5da371c0a2a8" +PINS = { + "r415/overlay/assemble.py": "0a5311eb25e889155d025a689236a3e5a434ec82d47a905fdf321eaf6a95d828", + "r415/overlay/ASSEMBLY.json": "a9b1fc38145ee605f35feb1277be316919e74c6747355c4c199cd3430b2dfab9", + "r417/setup-receipt/check_patch.py": "c9f034036518f4fb9329d7e151f43d238efeab3c20e5f2c8b3e4c1b07a157b7e", + "r417/setup-receipt/RECEIPT.json": "a690d662d0c9e137a6673d1c9c8dac24d2183e8ccd612b09ab13eb01a1c9d99e", + "r419/cross-price/RECEIPT.json": "f2f2c6ffb164084c3e977a1b7699754918ed1e15bee585c1285dbae3d7afb42d", +} +CHANGED = {"runtime.patch", "SOURCES.json", "receipt.py", "independent_price.py", + "positive_debit.py", "check_stage_seam.py"} + + +def materialize(root, package, tree): + for name, expected in PINS.items(): + if sha256((root / name).read_bytes()).hexdigest() != expected: + raise ValueError(f"Incorrect inherited exact input {name}") + prior = runpy.run_path(str(root / "r415/overlay/assemble.py")) + prior["verify_inputs"](package) + result = prior["materialize"](package, tree) + if result != json.loads((root / "r415/overlay/ASSEMBLY.json").read_bytes()): + raise ValueError("The frozen tariff assembly differs") + peer = tree / result["prepared_peer_path"] + old = prior["inventory"](peer) + + correct = runpy.run_path(str(root / "r417/setup-receipt/check_patch.py"))["check"] + evidence, corrected = correct((peer / "receipt.py").read_bytes()) + if evidence != json.loads((root / "r417/setup-receipt/RECEIPT.json").read_bytes()): + raise ValueError("The exact setup receipt correction differs") + (peer / "receipt.py").write_bytes(corrected) + profile = runpy.run_path(str(HERE / "profile.py"))["patch_profile"](peer) + runpy.run_path(str(HERE / "price.py"))["patch_price"](peer) + runpy.run_path(str(HERE / "seam.py"))["patch_stage_checks"](peer) + + new = prior["inventory"](peer) + actual_changed = {name for name in old.keys() | new.keys() if old.get(name) != new.get(name)} + if actual_changed != CHANGED: + raise ValueError(f"Unexpected prepared source changes: {sorted(actual_changed)}") + for name in ("receipt.py", "positive_debit.py", "independent_price.py", "check_stage_seam.py", + "verify.py", "bootstrap.py"): + compile((peer / name).read_bytes(), name, "exec") + assert "RESULT.json" not in new + receipt = dict( + scope="Exact positive-period source assembly; native replay unrun", + original_peer=PEER, + projected_kappa="0.003900857312000", + prior_projected_kappa=result["projected_kappa"], + prepared_peer_path=result["prepared_peer_path"], + physical_profile=profile, + changed_from_frozen={name: {"before": old[name], "after": new[name]} + for name in sorted(actual_changed)}, + native_bootstrap="not run", candidate_RESULT="not generated", + ) + (tree / "PERIOD-ASSEMBLY.json").write_text(json.dumps(receipt, indent=2, sort_keys=True) + "\n") + return receipt + + +def timeout(_signal, _frame): + raise TimeoutError("The source assembly reached its 45-second cap") + + +def main(): + assert __debug__ + parser = ArgumentParser(description=__doc__) + parser.add_argument("--root", type=Path, default=ROOT) + parser.add_argument("--package-root", type=Path, required=True) + parser.add_argument("--output", type=Path) + args = parser.parse_args() + output = args.output.resolve() if args.output else None + if output and output.exists(): + parser.error("--output must be fresh") + signal.signal(signal.SIGALRM, timeout) + signal.alarm(45) + try: + with TemporaryDirectory(prefix="period-source-", dir=output.parent if output else None) as tmp: + tree = Path(tmp) / "prepared" + result = materialize(args.root.resolve(), args.package_root.resolve(), tree) + if output: + tree.rename(output) + print(json.dumps(result, indent=2, sort_keys=True)) + finally: + signal.alarm(0) + + +if __name__ == "__main__": + main() diff --git a/research/p104-k7-integral-fringe/source/paired-768/r420/overlay/price.py b/research/p104-k7-integral-fringe/source/paired-768/r420/overlay/price.py new file mode 100644 index 0000000000..1e710a7914 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r420/overlay/price.py @@ -0,0 +1,117 @@ +"""Apply the exact sharper-period price to the frozen ordinary-tariff image.""" + +from hashlib import sha256 +from pathlib import Path + +BASE_PINS = { + "positive_debit.py": "32ee6a20e8f7fe6e2d1a3852b232179b0c6736c816f5bfd7bd9ec62cbffa9eb8", + "receipt.py": "5d647aea991322addecbbb68565f20cf585badc3dadc82e392ce2feb86986c62", + "independent_price.py": "f7e9c7f697c8af121bdaa7a8dffed21bb86f077a76d12cfc660b79c64d7df39d", +} + +POSITIVE_EDITS = ( + ("POSITIVE_DEBIT = Q(1039776, 2**23)", "POSITIVE_DEBIT = Q(1039701, 2**23)"), + (''' # Keep the upper physical period, complete group padding, both endpoint + # roundings, and the endpoint of the integral's chosen upper band. + finite_factor = ( + (1 + DELTA) + * (1 + Q(4 * max(targets), scale)) + * Q(power_interval(scale * lower, c)[1], UNIT) + * (1 + fringe / lower + DELTA) + / (1 - DELTA) ** 4 + ) + assert UNIT * finite_factor < power_interval(2, POSITIVE_DEBIT)[0]''', + ''' # The literal four-aligned period gives ceil(x)/x for x=M/(4s). + # Here s <= max(targets)*upper and upper <= M/scale. + x_lower = Q(scale, 4 * max(targets)) + period_upper = Q(257, 256) + assert 255 < x_lower < 256 and 256 / x_lower < period_upper + # For x <= 256 the first ratio covers ceil(x)/x. For x > 256, + # m=ceil(x)-1 is at least 256, and ceil(x)/x < 1+1/m. + common_factor = ( + (1 + DELTA) + * Q(power_interval(scale * lower, c)[1], UNIT) + * (1 + fringe / lower + DELTA) + / (1 - DELTA) ** 4 + ) + finite_factor = period_upper * common_factor + assert UNIT * finite_factor < power_interval(2, POSITIVE_DEBIT)[0] + assert power_interval(2, POSITIVE_DEBIT - Q(1, 2**23))[1] < UNIT * finite_factor + coarse_factor = (1 + 1 / x_lower) * common_factor + assert power_interval(2, POSITIVE_DEBIT)[1] < UNIT * coarse_factor'''), +) + +RECEIPT_EDITS = ( + ("DEBIT = Q(1039776, 2**23)", "DEBIT = Q(1039701, 2**23)"), + ("== (133567098, 208653)", "== (134136243, 208653)"), + ('assert TERMINAL.kappa == Q(".003900857269150")', + 'assert TERMINAL.kappa == Q(".003900857312000")'), + ("assert gain == Q(341, 250000000000000)", + "assert gain == Q(22107, 500000000000000)"), + (''' stop = Q(1, TERMINAL.positive_stop_denominator) + positive_ceiling = GAUSSIAN_C - DEBIT / TERMINAL.complex_log - 5 * stop''', + ''' stop = Q(1, TERMINAL.positive_stop_denominator) + frozen_tariff = Q(".003900857269150") + frozen_positive_ceiling = GAUSSIAN_C - Q(1039776, 2**23) / TERMINAL.complex_log - 5 * stop + assert frozen_tariff < frozen_positive_ceiling < TERMINAL.kappa + assert TERMINAL.kappa - frozen_tariff == Q(857, 20000000000000) + positive_ceiling = GAUSSIAN_C - DEBIT / TERMINAL.complex_log - 5 * stop'''), +) + +INDEPENDENT_EDITS = ( + (''' upper = ( + (1 + delta) + * (1 + Q(4 * 258, scale)) + * powers(scale * LOWER, c)[1] + * (1 + fringe / LOWER + delta) + / (1 - delta) ** 4 + ) + lower = powers(2, Q(1039776, 2**23))[0] + assert lower - upper > 0 and lower - upper > Q("0.000000019") + assert powers(2, Q(1039775, 2**23))[0] < upper''', + ''' assert max(recipe.targets.histogram) == 258 + x_lower = Q(scale, 4 * 258) + period_upper = Q(257, 256) + assert 255 < x_lower < 256 and 256 / x_lower < period_upper + common_factor = ( + (1 + delta) + * powers(scale * LOWER, c)[1] + * (1 + fringe / LOWER + delta) + / (1 - delta) ** 4 + ) + coarse_factor = (1 + 1 / x_lower) * common_factor + old_allowance = powers(2, Q(1039776, 2**23))[0] + assert old_allowance - coarse_factor > Q("0.000000019") + assert powers(2, Q(1039775, 2**23))[0] < coarse_factor + upper = period_upper * common_factor + new_lo, new_hi = powers(2, Q(1039701, 2**23)) + assert powers(2, Q(1039700, 2**23))[1] < upper < new_lo < new_hi < coarse_factor + print("PASS_SHARPER_POSITIVE_PERIOD", "257/256", "1039701/8388608")'''), + ('assert TERMINAL.kappa - Q(".003900857267786") == Q(341, 250000000000000)', + 'assert TERMINAL.kappa - Q(".003900857267786") == Q(22107, 500000000000000)'), +) + +EDITS = { + "positive_debit.py": POSITIVE_EDITS, + "receipt.py": RECEIPT_EDITS, + "independent_price.py": INDEPENDENT_EDITS, +} + + +def patch_price(peer: Path) -> None: + """Apply the debit with the exact Round 417 receipt as the preimage.""" + changed = {} + for name, changes in EDITS.items(): + path = peer / name + raw = path.read_bytes() + if sha256(raw).hexdigest() != BASE_PINS[name]: + raise ValueError(f"Unexpected prepared input {name}") + text = raw.decode() + for before, after in changes: + if text.count(before) != 1: + raise ValueError(f"Expected one change point in {name}") + text = text.replace(before, after, 1) + compile(text, name, "exec") + changed[path] = text.encode() + for path, data in changed.items(): + path.write_bytes(data) diff --git a/research/p104-k7-integral-fringe/source/paired-768/r420/overlay/profile.py b/research/p104-k7-integral-fringe/source/paired-768/r420/overlay/profile.py new file mode 100644 index 0000000000..13a75a940f --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r420/overlay/profile.py @@ -0,0 +1,78 @@ +"""Change only the terminal booking in the frozen Round 415 profile.""" +from hashlib import sha256 +import json +from pathlib import Path +from subprocess import run +from tempfile import TemporaryDirectory + +OLD_RATE = "0.003900857269150" +NEW_RATE = "0.003900857312000" +BEFORE = b'TERMINAL = Profile((31808, 502922, 7951907, 125730703, 134217727), 208653, Q(".003900857269150"), Q(1, 256))' +AFTER = BEFORE.replace(b".003900857269150", b".003900857312000") +PREIMAGE = "1c6978b8c7d136ef87191512d9ab9eb3dda8a818844244b96cb165d46d97b1df" +OLD_PATCH = "2eb7d8a20b5202774aa787a1313f645e20428419ba85fb8490fe4d76df7f3059" +OLD_IMAGE = "37460b2be0a93ecfe110be25de5a4ea787c2d09973f926f680ea148453dc89e2" +OLD_MANIFEST = "c6a31ad88b5f1b60d337b26a02f9e6328129eb7f1ed1b9088bdd0a9295cb866d" + + +def digest(value): + return sha256(value).hexdigest() + + +def authenticate(path, pin): + value = path.read_bytes() + if digest(value) != pin: + raise ValueError(f"Unexpected frozen bytes: {path.name}") + return value + + +def installation_image(preimage, patch): + with TemporaryDirectory(prefix="typed-period-profile-") as temporary: + target = Path(temporary) / "installations.py" + target.write_bytes(preimage) + run( + ["git", "apply", "--no-index", "--include=installations.py", + "--whitespace=nowarn", "-"], + cwd=temporary, input=patch, check=True, timeout=10, + ) + return target.read_bytes() + + +def patch_profile(peer: Path) -> dict: + """Replay the selected source image and update its two manifest pins.""" + patch_file = peer / "runtime.patch" + manifest_file = peer / "SOURCES.json" + patch = authenticate(patch_file, OLD_PATCH) + manifest = json.loads(authenticate(manifest_file, OLD_MANIFEST)) + preimage = authenticate(peer.parent / "tiered-native-multiplier" / "installations.py", PREIMAGE) + images = manifest["runtime_images"]["installations.py"] + if images != {"before": PREIMAGE, "after": OLD_IMAGE} or manifest["local_sources"]["runtime.patch"] != OLD_PATCH: + raise ValueError("Unexpected frozen profile manifest pins") + baseline = installation_image(preimage, patch) + if digest(baseline) != OLD_IMAGE or baseline.splitlines().count(BEFORE) != 1: + raise ValueError("Unexpected installed selector preimage") + if patch.splitlines().count(b"+" + BEFORE) != 1 or AFTER in patch: + raise ValueError("Expected one exact terminal selector patch line") + + changed_patch = patch.replace(b"+" + BEFORE, b"+" + AFTER, 1) + changed = installation_image(preimage, changed_patch) + if changed != baseline.replace(BEFORE, AFTER, 1): + raise ValueError("Unexpected additional installed selector edit") + compile(changed, "installations.py", "exec") + images["after"] = digest(changed) + manifest["local_sources"]["runtime.patch"] = digest(changed_patch) + encoded = (json.dumps(manifest, indent=2) + "\n").encode() + patch_file.write_bytes(changed_patch) + manifest_file.write_bytes(encoded) + return { + "scope": "Literal installation selector and dependency pins; installed science unrun", + "installation_preimage_sha256": PREIMAGE, + "baseline_installation_sha256": OLD_IMAGE, + "baseline_runtime_patch_sha256": OLD_PATCH, + "baseline_sources_sha256": OLD_MANIFEST, + "baseline_terminal_kappa": OLD_RATE, + "candidate_installation_sha256": images["after"], + "candidate_runtime_patch_sha256": digest(changed_patch), + "candidate_sources_sha256": digest(encoded), + "candidate_terminal_kappa": NEW_RATE, + } diff --git a/research/p104-k7-integral-fringe/source/paired-768/r420/overlay/seam.py b/research/p104-k7-integral-fringe/source/paired-768/r420/overlay/seam.py new file mode 100644 index 0000000000..7485797706 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r420/overlay/seam.py @@ -0,0 +1,69 @@ +"""Update the frozen Round 415 stage controls for the sharper period price.""" + +from hashlib import sha256 +from pathlib import Path + +SOURCE_SHA256 = "57a4f8807833a512760466dcb18a477a9d04112af4e1cf945ac0efd88a330662" + + +def patch_stage_checks(peer: Path) -> None: + path = peer / "check_stage_seam.py" + original = path.read_bytes() + if sha256(original).hexdigest() != SOURCE_SHA256: + raise ValueError("The exact Round 415 prepared stage checker is required") + + replacements = ( + ( + " GAUSSIAN=Q(1039776,2**23) # five-shortcut word debit", + """ PRIOR_GAUSSIAN=Q(1039776,2**23) + GAUSSIAN=Q(1039701,2**23) # sharper four-aligned period bound + PRIOR_KAPPA=Q(".003900857269150")""", + ), + ( + ' assert TERMINAL.kappa==Q(".003900857269150")', + ' assert TERMINAL.kappa==Q(".003900857312000")', + ), + ( + """ def gaussian_upper(h): + return GAUSSIAN_C-GAUSSIAN/h""", + """ def gaussian_upper(h,debit=GAUSSIAN): + return GAUSSIAN_C-debit/h""", + ), + ( + """ assert TERMINAL.kappa>old_crossing + assert TERMINAL.kappa+GRID>=gaussian_upper(TERMINAL.complex_log)-5*STOP""", + """ assert TERMINAL.kappa>old_crossing + prior_positive_crossing=gaussian_upper(TERMINAL.complex_log,PRIOR_GAUSSIAN)-5*STOP + assert PRIOR_KAPPAprior_positive_crossing + assert TERMINAL.kappa+GRID>=gaussian_upper(TERMINAL.complex_log)-5*STOP""", + ), + ( + """ def require_funding(proposed,gaussian,*,debit=ORDINARY,kappa=TERMINAL.kappa): + threshold=kappa+5*STOP + if ordinary_upper(proposed,debit)<=threshold or gaussian_upper(gaussian)<=threshold:""", + """ def require_funding(proposed,gaussian,*,debit=ORDINARY,kappa=TERMINAL.kappa,gaussian_debit=GAUSSIAN): + threshold=kappa+5*STOP + if ordinary_upper(proposed,debit)<=threshold or gaussian_upper(gaussian,gaussian_debit)<=threshold:""", + ), + ( + " require_funding(proposed,gaussian,debit=OLD_ORDINARY,kappa=OLD_KAPPA)", + """ require_funding(proposed,gaussian,debit=OLD_ORDINARY,kappa=OLD_KAPPA, + gaussian_debit=PRIOR_GAUSSIAN)""", + ), + ( + """ rejected(lambda:require_funding(ranks,TERMINAL.complex_log-1),"gaussian-height-minus-one"), + rejected(lambda:require_funding(ranks,TERMINAL.complex_log,kappa=TERMINAL.kappa+GRID),""", + """ rejected(lambda:require_funding(ranks,TERMINAL.complex_log-1),"gaussian-height-minus-one"), + rejected(lambda:require_funding(ranks,TERMINAL.complex_log,gaussian_debit=PRIOR_GAUSSIAN), + "prior-gaussian-debit-at-new-rate"), + rejected(lambda:require_funding(ranks,TERMINAL.complex_log,kappa=TERMINAL.kappa+GRID),""", + ), + ) + source = original.decode("utf-8") + for before, after in replacements: + if source.count(before) != 1: + raise ValueError("A stage-check source anchor was missing or repeated") + source = source.replace(before, after, 1) + compile(source, str(path), "exec") + path.write_text(source, encoding="utf-8") diff --git a/research/p104-k7-integral-fringe/source/paired-768/r420/setup/check_installed.py b/research/p104-k7-integral-fringe/source/paired-768/r420/setup/check_installed.py new file mode 100644 index 0000000000..26a39fd513 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r420/setup/check_installed.py @@ -0,0 +1,24 @@ +"""Use the frozen nine-recipe census with the additional period selector.""" +from fractions import Fraction +from hashlib import sha256 +from pathlib import Path +import runpy + +ROOT = Path(__file__).resolve().parents[2] +BASE = "e16fac0f9a91930575d4f11d50e4e26b357d2dcb0992470a679f6501904629e4" +IMAGE = "c5d83f8c6acdab6828185bc6bb67537cf320ba79ab177f9da535edae7b5af72e" + + +def extend(root=ROOT): + source = root / "r416/setup/check_installed.py" + if sha256(source.read_bytes()).hexdigest() != BASE: + raise ValueError("The frozen installed census differs") + census = runpy.run_path(str(source)) + selectors = census["SELECTORS"] + assert set(selectors) == {"peer", "candidate"} + selectors["period"] = IMAGE, Fraction(".003900857312000") + return census + + +if __name__ == "__main__": + extend()["main"]() diff --git a/research/p104-k7-integral-fringe/source/paired-768/r428/ASSEMBLY.json b/research/p104-k7-integral-fringe/source/paired-768/r428/ASSEMBLY.json new file mode 100644 index 0000000000..efc1d19b02 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r428/ASSEMBLY.json @@ -0,0 +1,37 @@ +{ + "baseline_terminal_kappa": "0.003900857312000", + "candidate_RESULT": "not generated", + "candidate_installation_sha256": "6dc565fad3b91bcb43ff71397897afcc54fd5f9d595a8f88b91234994d8e70be", + "changed": { + "research/frequency-weighted-native-multiplier/SOURCES.json": { + "after": "434bdd0322622aa5dd7d592fe2b7fa2e19e5e741e2554ac094084164926708c2", + "before": "bc16e0da6b59d42f22b81baeebc0ef50ed96a9e265922e678b0be72e5f22fe6c" + }, + "research/frequency-weighted-native-multiplier/check_stage_seam.py": { + "after": "dbaa72c655cc46e5db7264b6f7453a61f3e7ea0b3d76ba712f5e55746df09740", + "before": "57d5ac6ac268fc07fbd92447abf297a2e2f4ea4f5a6c2da95d0abb1ca75d08ca" + }, + "research/frequency-weighted-native-multiplier/independent_price.py": { + "after": "c78812589570aac1a18070ba74c60416aa1a2672789482d51b83082dd2bd72f9", + "before": "267fdaa92130165bd42c716a6579c3c25ea7424be654118d2a386ce6f1676b6e" + }, + "research/frequency-weighted-native-multiplier/positive_debit.py": { + "after": "0b81dbf6cca7397f540f4b525f059ffa4e6beef7106f756600963fd45e43d285", + "before": "89e715555dee209867b45b0a763f207dd0a479f8bc9fbf542b73fa4048415def" + }, + "research/frequency-weighted-native-multiplier/receipt.py": { + "after": "c39a9f0e754348849a210a291989b68d234e7639633977b18f7b4afc231b94fe", + "before": "3aca2167fbc5995cb3d928d0f08e087be0dfa4019dd689538d1e101366118b5e" + }, + "research/frequency-weighted-native-multiplier/runtime.patch": { + "after": "72782749b01521fa307e4117eda263eeb21f3750dc4f0abcfd09354edf2bb8c8", + "before": "77dd66e595835c68a4d6a1df2e45e538a97d2fe046b2c18726281854af5b151e" + } + }, + "installation_preimage_sha256": "1c6978b8c7d136ef87191512d9ab9eb3dda8a818844244b96cb165d46d97b1df", + "old_installation_sha256": "c5d83f8c6acdab6828185bc6bb67537cf320ba79ab177f9da535edae7b5af72e", + "predecessor_result_sha256": "ad6ca3a20b296033ed586821db1f42ffee2d9b5cd9723dbcb1720605f143f609", + "projected_delta": "337/500000000000000", + "projected_terminal_kappa": "0.003900857312674", + "scope": "Frozen source assembly and exact selector image only. Installed replay unrun." +} diff --git a/research/p104-k7-integral-fringe/source/paired-768/r428/assemble.py b/research/p104-k7-integral-fringe/source/paired-768/r428/assemble.py new file mode 100644 index 0000000000..877329b240 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r428/assemble.py @@ -0,0 +1,166 @@ +"""Apply the integral-fringe change solely to an authenticated Round 420 tree.""" + +from argparse import ArgumentParser +from hashlib import sha256 +import json +import os +from pathlib import Path +import runpy +import shutil +import signal +from subprocess import run +from tempfile import TemporaryDirectory + + +HERE = Path(__file__).resolve().parent +PEER = Path("research/frequency-weighted-native-multiplier") +INSTALLATIONS = Path("research/tiered-native-multiplier/installations.py") +PINS = { + "positive_debit.py": "89e715555dee209867b45b0a763f207dd0a479f8bc9fbf542b73fa4048415def", + "receipt.py": "3aca2167fbc5995cb3d928d0f08e087be0dfa4019dd689538d1e101366118b5e", + "independent_price.py": "267fdaa92130165bd42c716a6579c3c25ea7424be654118d2a386ce6f1676b6e", + "check_stage_seam.py": "57d5ac6ac268fc07fbd92447abf297a2e2f4ea4f5a6c2da95d0abb1ca75d08ca", + "runtime.patch": "77dd66e595835c68a4d6a1df2e45e538a97d2fe046b2c18726281854af5b151e", + "SOURCES.json": "bc16e0da6b59d42f22b81baeebc0ef50ed96a9e265922e678b0be72e5f22fe6c", +} +PREIMAGE = "1c6978b8c7d136ef87191512d9ab9eb3dda8a818844244b96cb165d46d97b1df" +OLD_IMAGE = "c5d83f8c6acdab6828185bc6bb67537cf320ba79ab177f9da535edae7b5af72e" +OLD_RESULT = "ad6ca3a20b296033ed586821db1f42ffee2d9b5cd9723dbcb1720605f143f609" +OLD_RATE = "0.003900857312000" +NEW_RATE = "0.003900857312674" +SELECTOR = b'TERMINAL = Profile((31808, 502922, 7951907, 125730703, 134217727), 208653, Q(".003900857312000"), Q(1, 256))' +NEW_SELECTOR = SELECTOR.replace(b".003900857312000", b".003900857312674") + + +def digest(data): + return sha256(data).hexdigest() + + +def authenticated(path, expected): + raw = path.read_bytes() + if digest(raw) != expected: + raise ValueError(f"Unexpected frozen source at {path.name!r}") + return raw + + +def unique_object(pairs): + result = {} + for key, value in pairs: + if key in result: + raise ValueError(f"Duplicate manifest key {key!r}") + result[key] = value + return result + + +def replace_unique(text, before, after): + if text.count(before) != 1: + raise ValueError(f"Expected one source anchor, found {text.count(before)}: {before[:110]!r}") + return text.replace(before, after, 1) + + +def image(preimage, patch, stage): + with TemporaryDirectory(prefix="selector-", dir=stage) as temporary: + target = Path(temporary) / "installations.py" + target.write_bytes(preimage) + env = dict(os.environ, GIT_CEILING_DIRECTORIES=str(stage)) + run(["git", "apply", "--no-index", "--include=installations.py", "--whitespace=nowarn", "-"], + cwd=temporary, env=env, input=patch, check=True, timeout=10) + return target.read_bytes() + + +def inventory(root): + files = {} + for path in (root / "research").rglob("*"): + if path.is_symlink(): + raise ValueError(f"A source symlink is outside this assembly: {path.relative_to(root)}") + if path.is_file(): + files[path.relative_to(root).as_posix()] = digest(path.read_bytes()) + return files + + +def materialize(frozen, stage): + prior = {name: authenticated(frozen / PEER / name, pin) for name, pin in PINS.items()} + preimage = authenticated(frozen / INSTALLATIONS, PREIMAGE) + baseline = image(preimage, prior["runtime.patch"], stage) + if digest(baseline) != OLD_IMAGE: + raise ValueError("The installed Round 420 image differs") + patch = replace_unique(prior["runtime.patch"], b"+" + SELECTOR, b"+" + NEW_SELECTOR) + installed = image(preimage, patch, stage) + if installed != replace_unique(baseline, SELECTOR, NEW_SELECTOR): + raise ValueError("The selector patch made another change to installations.py") + compile(installed, "installations.py", "exec") + manifest = json.loads(prior["SOURCES.json"], object_pairs_hook=unique_object) + pins = manifest["runtime_images"]["installations.py"] + if pins != {"before": PREIMAGE, "after": OLD_IMAGE} or manifest["local_sources"]["runtime.patch"] != PINS["runtime.patch"]: + raise ValueError("The old selector pins differ") + pins["after"] = digest(installed) + manifest["local_sources"]["runtime.patch"] = digest(patch) + edits = runpy.run_path(str(HERE / "edits.py"))["EDITS"] + changed = { + "runtime.patch": patch, + "SOURCES.json": (json.dumps(manifest, indent=2) + "\n").encode(), + } + for name, replacements in edits.items(): + text = prior[name].decode() + for before, after in replacements: + text = replace_unique(text, before, after) + compile(text, name, "exec") + changed[name] = text.encode() + if set(changed) != set(PINS): + raise ValueError("The changed source inventory differs") + before = inventory(frozen) + old_result = (PEER / "RESULT.json").as_posix() + if old_result in before: + authenticated(frozen / old_result, OLD_RESULT) + candidate = stage / "candidate" + shutil.copytree(frozen / "research", candidate / "research") + (candidate / old_result).unlink(missing_ok=True) + for name, raw in changed.items(): + (candidate / PEER / name).write_bytes(raw) + after = inventory(candidate) + differences = {p for p in before.keys() | after.keys() if before.get(p) != after.get(p)} + expected = {(PEER / name).as_posix() for name in changed} + if differences - {old_result} != expected or old_result in after: + raise ValueError("An unexpected source changed or a stale receipt survived") + return candidate, { + "scope": "Frozen source assembly and exact selector image only. Installed replay unrun.", + "baseline_terminal_kappa": OLD_RATE, + "projected_terminal_kappa": NEW_RATE, + "projected_delta": "337/500000000000000", + "predecessor_result_sha256": OLD_RESULT, + "installation_preimage_sha256": PREIMAGE, + "old_installation_sha256": OLD_IMAGE, + "candidate_installation_sha256": digest(installed), + "changed": {p: {"before": before[p], "after": after[p]} for p in sorted(expected)}, + "candidate_RESULT": "not generated", + } + + +def timeout(_signal, _frame): + raise TimeoutError("Source assembly reached the 45-second cap") + + +def main(): + if not __debug__: + raise RuntimeError("Run with assertions enabled") + parser = ArgumentParser(description=__doc__) + parser.add_argument("--frozen", type=Path, required=True) + parser.add_argument("--output", type=Path, required=True) + args = parser.parse_args() + frozen, output = args.frozen.resolve(), args.output.resolve() + if args.output.is_symlink() or output.exists() or output.is_relative_to(frozen): + parser.error("--output must be a fresh path outside the frozen tree") + signal.signal(signal.SIGALRM, timeout) + signal.alarm(45) + try: + with TemporaryDirectory(prefix="fringe-source-", dir=output.parent) as temporary: + candidate, receipt = materialize(frozen, Path(temporary)) + (candidate / "FRINGE-ASSEMBLY.json").write_text(json.dumps(receipt, indent=2, sort_keys=True) + "\n") + candidate.rename(output) + print(json.dumps(receipt, indent=2, sort_keys=True)) + finally: + signal.alarm(0) + + +if __name__ == "__main__": + main() diff --git a/research/p104-k7-integral-fringe/source/paired-768/r428/check_setup.py b/research/p104-k7-integral-fringe/source/paired-768/r428/check_setup.py new file mode 100644 index 0000000000..be36c3b1cd --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r428/check_setup.py @@ -0,0 +1,37 @@ +"""Bind the Round 420 installed census to the integral-fringe selector.""" + +from argparse import ArgumentParser +from fractions import Fraction +from hashlib import sha256 +from pathlib import Path +import runpy +import sys + + +BASE = "bd3bf241376d7e4e044ee8f92705c0a71bc059e52dabd8e56d971e418b69216a" +IMAGE = "6dc565fad3b91bcb43ff71397897afcc54fd5f9d595a8f88b91234994d8e70be" + + +def extend(root): + source = root / "r420/setup/check_installed.py" + if sha256(source.read_bytes()).hexdigest() != BASE: + raise ValueError("The installed Round 420 census wrapper differs") + census = runpy.run_path(str(source))["extend"](root) + selectors = census["SELECTORS"] + if set(selectors) != {"peer", "candidate", "period"}: + raise ValueError("The inherited installed census selectors differ") + selectors["fringe"] = IMAGE, Fraction(".003900857312674") + return census + + +if __name__ == "__main__": + parser = ArgumentParser(description=__doc__) + parser.add_argument("--handoff-root", type=Path, required=True) + parser.add_argument("--runtime", type=Path, required=True) + parser.add_argument("--portable", type=Path, required=True) + parser.add_argument("--scratch", type=Path, required=True) + args = parser.parse_args() + main = extend(args.handoff_root.resolve())["main"] + sys.argv[1:] = ("--profile", "fringe", "--runtime", str(args.runtime), + "--portable", str(args.portable), "--scratch", str(args.scratch)) + main() diff --git a/research/p104-k7-integral-fringe/source/paired-768/r428/edits.py b/research/p104-k7-integral-fringe/source/paired-768/r428/edits.py new file mode 100644 index 0000000000..a87519e11c --- /dev/null +++ b/research/p104-k7-integral-fringe/source/paired-768/r428/edits.py @@ -0,0 +1,138 @@ +"""Exact source changes to the Round 420 price and stage verifiers.""" + +POSITIVE = ( + ("POSITIVE_DEBIT = Q(1039701, 2**23)", "POSITIVE_DEBIT = Q(1039699, 2**23)"), + (''' fringe = 10 * target_axes / (t * psi) + assert target_axes == 677246016 + assert psi > Q("926190717.2837") + assert fringe < Q("7.340806")''', + ''' # The literal integral suffix is at most 10*k-5 for each target slot. + # At grade <=258 the weighted slot count is at least target_axes/258. + target_slots = sum(targets.values()) + assert target_axes == 677246016 and target_slots >= Q(target_axes, 258) + old_fringe = 10 * target_axes / (t * psi) + fringe = Q(515, 516) * old_fringe + assert (10 * target_axes - 5 * target_slots) / (t * psi) <= fringe + assert psi > Q("926190717.2837") and old_fringe < Q("7.340806")'''), + (''' common_factor = ( + (1 + DELTA) + * Q(power_interval(scale * lower, c)[1], UNIT) + * (1 + fringe / lower + DELTA) + / (1 - DELTA) ** 4 + ) + finite_factor = period_upper * common_factor + assert UNIT * finite_factor < power_interval(2, POSITIVE_DEBIT)[0] + assert power_interval(2, POSITIVE_DEBIT - Q(1, 2**23))[1] < UNIT * finite_factor + coarse_factor = (1 + 1 / x_lower) * common_factor + assert power_interval(2, POSITIVE_DEBIT)[1] < UNIT * coarse_factor''', + ''' common_factor = ( + (1 + DELTA) * Q(power_interval(scale * lower, c)[1], UNIT) / (1 - DELTA) ** 4 + ) + old_factor = period_upper * common_factor * (1 + old_fringe / lower + DELTA) + finite_factor = period_upper * common_factor * (1 + fringe / lower + DELTA) + old_debit = Q(1039701, 2**23) + assert power_interval(2, old_debit - Q(1, 2**23))[1] < UNIT * old_factor + assert UNIT * old_factor < power_interval(2, old_debit)[0] + new_lo, new_hi = power_interval(2, POSITIVE_DEBIT) + assert UNIT * finite_factor < new_lo <= new_hi < UNIT * old_factor + coarse_factor = (1 + 1 / x_lower) * common_factor * (1 + old_fringe / lower + DELTA) + assert power_interval(2, old_debit)[1] < UNIT * coarse_factor'''), +) + +INDEPENDENT = ( + (''' axes = sum(k * n for k, n in recipe.targets.histogram.items()) + fringe = 10 * axes / ((1 - c) * psi) + assert psi > Q("926190717") and fringe < Q("7.340806")''', + ''' histogram = recipe.targets.histogram + axes = sum(k * n for k, n in histogram.items()) + suffix_bound = sum((10*k - 5) * n for k, n in histogram.items()) + assert axes == 677246016 and suffix_bound <= Q(515, 516) * 10 * axes + old_fringe = 10 * axes / ((1 - c) * psi) + fringe = Q(515, 516) * old_fringe + assert psi > Q("926190717") and old_fringe < Q("7.340806")'''), + (''' common_factor = ( + (1 + delta) + * powers(scale * LOWER, c)[1] + * (1 + fringe / LOWER + delta) + / (1 - delta) ** 4 + ) + coarse_factor = (1 + 1 / x_lower) * common_factor + old_allowance = powers(2, Q(1039776, 2**23))[0] + assert old_allowance - coarse_factor > Q("0.000000019") + assert powers(2, Q(1039775, 2**23))[0] < coarse_factor + upper = period_upper * common_factor + new_lo, new_hi = powers(2, Q(1039701, 2**23)) + assert powers(2, Q(1039700, 2**23))[1] < upper < new_lo < new_hi < coarse_factor + print("PASS_SHARPER_POSITIVE_PERIOD", "257/256", "1039701/8388608")''', + ''' common_factor = (1 + delta) * powers(scale * LOWER, c)[1] / (1 - delta) ** 4 + coarse_factor = (1 + 1 / x_lower) * common_factor * (1 + old_fringe / LOWER + delta) + old_allowance = powers(2, Q(1039776, 2**23))[0] + assert old_allowance - coarse_factor > Q("0.000000019") + assert powers(2, Q(1039775, 2**23))[0] < coarse_factor + previous = period_upper * common_factor * (1 + old_fringe / LOWER + delta) + period_lo, period_hi = powers(2, Q(1039701, 2**23)) + assert powers(2, Q(1039700, 2**23))[1] < previous < period_lo < period_hi < coarse_factor + proposed = period_upper * common_factor * (1 + fringe / LOWER + delta) + new_lo, new_hi = powers(2, Q(1039699, 2**23)) + assert proposed < new_lo < new_hi < previous + print("PASS_GAUSSIAN_INTEGER_FRINGE", "515/516", "1039699/8388608")'''), + (''' assert TERMINAL.kappa - Q(".003900857267786") == Q(22107, 500000000000000)''', + ''' assert TERMINAL.kappa - Q(".003900857267786") == Q(5611, 125000000000000) + assert TERMINAL.kappa - Q(".003900857312000") == Q(337, 500000000000000)'''), +) + +RECEIPT = ( + ("DEBIT = Q(1039701, 2**23)", "DEBIT = Q(1039699, 2**23)"), + ("== (134136243, 208653)", "== (134145234, 208653)"), + (''' gain = TERMINAL.kappa - older + assert TERMINAL.kappa == Q(".003900857312000") + assert gain == Q(22107, 500000000000000)''', + ''' previous = Q(".003900857312000") + gain = TERMINAL.kappa - previous + assert TERMINAL.kappa == Q(".003900857312674") + assert previous - older == Q(22107, 500000000000000) + assert gain == Q(337, 500000000000000)'''), + (''' assert TERMINAL.kappa - frozen_tariff == Q(857, 20000000000000) + positive_ceiling = GAUSSIAN_C - DEBIT / TERMINAL.complex_log - 5 * stop + assert TERMINAL.kappa < positive_ceiling <= TERMINAL.kappa + Q(1, 10**15)''', + ''' assert previous - frozen_tariff == Q(857, 20000000000000) + previous_positive = GAUSSIAN_C - Q(1039701, 2**23) / TERMINAL.complex_log - 5 * stop + assert previous < previous_positive <= previous + Q(1, 10**15) + positive_ceiling = GAUSSIAN_C - DEBIT / TERMINAL.complex_log - 5 * stop + prior_booked = Q(late["ordinary_rates"][-2]) + last_height = TERMINAL.rank_logs[-1] + ordinary_ceiling = min( + TERMINAL.eta, (249 * (BINARY_C - ORDINARY_DEBIT / last_height) + prior_booked) / 250 + ) - 5 * stop + assert previous_positive < TERMINAL.kappa < ordinary_ceiling < positive_ceiling + assert ordinary_ceiling <= TERMINAL.kappa + Q(1, 10**15)'''), + (" previous_rate=str(older),", " previous_rate=str(previous),"), +) + +SEAM = ( + (''' GAUSSIAN=Q(1039701,2**23) # sharper four-aligned period bound''', + ''' PERIOD_GAUSSIAN=Q(1039701,2**23) + PERIOD_KAPPA=Q(".003900857312000") + GAUSSIAN=Q(1039699,2**23) # book a conservative two-tick integral fringe reduction'''), + ('assert TERMINAL.kappa==Q(".003900857312000")', 'assert TERMINAL.kappa==Q(".003900857312674")'), + ("assert ordinary_upper(ranks)>gaussian_upper(TERMINAL.complex_log)>paid", + "assert gaussian_upper(TERMINAL.complex_log)>ordinary_upper(ranks)>paid"), + (''' assert TERMINAL.kappa+GRID>=gaussian_upper(TERMINAL.complex_log)-5*STOP''', + ''' period_crossing=gaussian_upper(TERMINAL.complex_log,PERIOD_GAUSSIAN)-5*STOP + assert PERIOD_KAPPA=ordinary_upper(ranks)-5*STOP'''), + (''' rejected(lambda:require_funding(ranks,TERMINAL.complex_log,kappa=TERMINAL.kappa+GRID), + "next-displayed-kappa-at-fixed-gaussian-height"),''', + ''' rejected(lambda:require_funding(ranks,TERMINAL.complex_log,gaussian_debit=PERIOD_GAUSSIAN), + "period-only-gaussian-debit-at-new-rate"), + rejected(lambda:require_funding(ranks,TERMINAL.complex_log,kappa=TERMINAL.kappa+GRID), + "next-displayed-kappa-at-fixed-five-stage-profile"),'''), +) + +EDITS = { + "positive_debit.py": POSITIVE, + "independent_price.py": INDEPENDENT, + "receipt.py": RECEIPT, + "check_stage_seam.py": SEAM, +} diff --git a/research/p104-k7-integral-fringe/source/peer8094/NOTICE.md b/research/p104-k7-integral-fringe/source/peer8094/NOTICE.md new file mode 100644 index 0000000000..bdad26a55c --- /dev/null +++ b/research/p104-k7-integral-fringe/source/peer8094/NOTICE.md @@ -0,0 +1,5 @@ +# Attribution + +Ali Romman supplied the #8042 matched-interval suffix derivation, #8057 weighted signed producer and caller, and the earlier #8055 serial setup proof. SYLforge supplied the #8052 K7 ordinary circuit and physical replay. #8066 contributes the prior ordinary price and #8067 the literal K7 floor and directed fringe calculation. #8070 supplies the Gaussian booking, #8071 the earlier K7 booking, and #8072 the exact fixed-booking allocation comparison. This package uses the K7-specific suffix bound in the complete charged envelope and allocates the resulting ordinary headroom. + +The archived source and notices retain their original license. The separate historical CI prerequisite reuses Jerry Chen's #7257 source navigation and snapshot repair. OpenAI Codex materially assisted arithmetic, implementation and independent verification. [Original suffix proof](https://github.com/aliromman/integer-mult-bounds/blob/dfd25d553a843a946ca0b94130a5ff8943e98fdd/research/retimed-native-multiplier/TRANSFER.md) · [Full predecessor credit](PROOF.md) · [License](LICENSE) diff --git a/research/p104-k7-integral-fringe/source/peer8094/PEER-SOURCE.json b/research/p104-k7-integral-fringe/source/peer8094/PEER-SOURCE.json new file mode 100644 index 0000000000..6f84b3aef4 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/peer8094/PEER-SOURCE.json @@ -0,0 +1,94 @@ +{ + "archive_sha256": "0e0d559bdb15e7b647f88a2b5e27fcdc9e28e81d8f4145459876ba6da2e9314c", + "files_sha256": { + "research/frequency-weighted-native-multiplier/FINITE-LOSS.md": "12c6069437a0cbb61c80804f89f027ef9709c186e67d26fb0584ad6e71048052", + "research/frequency-weighted-native-multiplier/GaussianFiniteLoss.lean": "9d247f73d9da2748399b821612b30f20140783c08d761b6d4ef7d3c7c3d07064", + "research/frequency-weighted-native-multiplier/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "research/frequency-weighted-native-multiplier/MEASUREMENTS.json": "9ea26ae002146ae21291ecc0a6b224e5cccb9e3b5d199522558a645863da4f7b", + "research/frequency-weighted-native-multiplier/NOTICE.md": "02e69a1d57e2208ce49b3362a5672136887c1968d66de83a8f358e6d4a9353df", + "research/frequency-weighted-native-multiplier/PROOF.md": "4dbb38cdbe5b691edf4845fe8cf2a99be5d43455cc73199ab7e305abaa91acca", + "research/frequency-weighted-native-multiplier/README.md": "173313f895d9f810e5c32853ff383c8ee962e475dead35e5634047aa9c8a1453", + "research/frequency-weighted-native-multiplier/RESULT.json": "2f4faa6648592f589df22a8a0a07ba6856d20786294a44a7776c7d6e0efa14a5", + "research/frequency-weighted-native-multiplier/SOURCES.json": "01d9e6b6b28cd174800cadfb59f4f064b3844575da297d82e16eb19a0d11c868", + "research/frequency-weighted-native-multiplier/TASK.json": "9db85415d252a595907a8c1ddf8ce64acc5c0aa67dc8f6b4656139053bb40a52", + "research/frequency-weighted-native-multiplier/VERIFICATION.md": "58568a8f5e097a1d828aeff33ea33c63863c4b28dd1a87fd7dca9adebb5d6c1f", + "research/frequency-weighted-native-multiplier/VERIFY.json": "4f5506a41e62585e34c80c6838922d33b04d42e010fab310690f340a5be3721e", + "research/frequency-weighted-native-multiplier/WeightedNumerical.lean": "2017bae8064554efb13c564503d8f88c4615e9f733a74aa5eaf4047e5bd8af94", + "research/frequency-weighted-native-multiplier/bootstrap.py": "a824c0ba9bb5efe5ad5b6c9b891b363b6d2ac31b0a57b9e27b68a6c2bca6f7ee", + "research/frequency-weighted-native-multiplier/check_calendar.py": "1c51b8bd75ef2d9d8847b2ebf88d7dbcc44d89954146c2bdede8854915392b8c", + "research/frequency-weighted-native-multiplier/check_exterior.py": "aee4fd29eb2fa021f806c987e0db23ecb7148e5dc846581f62d3ba39ed7ef725", + "research/frequency-weighted-native-multiplier/check_lean.py": "32e49adef4502f193b5ded2cc4e7f8cea6a285283fda4db2152570a4b68098cb", + "research/frequency-weighted-native-multiplier/check_nested.py": "9b2eaf387abbeeef43dd9bb31081ba73f3423e8233fb3446d61fce802a1c6b5b", + "research/frequency-weighted-native-multiplier/check_ownership.py": "a1fdaf5eaaa4215bc90051db48e17d0bf9cf7fe03f67a4d2bdf4e328f3c1a73a", + "research/frequency-weighted-native-multiplier/check_placement.py": "e4317a1eb36f692912ca4739364859118711620838705d8e33b1eabec32b0990", + "research/frequency-weighted-native-multiplier/check_raw.py": "d62d50279969bfecf23d2e14412949fa643394c1539ccb87db7dac5f79e2d97e", + "research/frequency-weighted-native-multiplier/grades.py": "8d2e3d14ac2149f985d7f6a75bf36182d7f68aadf8df6595fc0774224d4951ac", + "research/frequency-weighted-native-multiplier/independent_price.py": "448811cdb4a2bdefd4f736c2bad81c2a833bde634bcf65498e05267b5ee7ead0", + "research/frequency-weighted-native-multiplier/measure_setup.py": "cbfe019024fbeee428c415549db10180af69995078825b6341bc9021f3d08723", + "research/frequency-weighted-native-multiplier/portable/EVIDENCE.json": "3bfffdda94bbc6a14282399eca69b8619c96bd587c7957b3bdf854e03ef89427", + "research/frequency-weighted-native-multiplier/portable/NOTICE.md": "57d7e187fb48df97838976a7942e41dc381f00daeff7c2b5c392fb1a6f252517", + "research/frequency-weighted-native-multiplier/portable/README.md": "141d07df12c9e5352a8f83a03a033dd2c41cc5d0d6e0edb3532cab462536a974", + "research/frequency-weighted-native-multiplier/portable/STACK-LOCALITY.md": "0211732aaa6083a305e861f8172b581b0a9c98e10191d8432d546ee224c0bf5f", + "research/frequency-weighted-native-multiplier/portable/TRACE-CLOCK.md": "9f2b0d125cc35f91bb037363505d027331c79153211ea21de838405ae01a1a2a", + "research/frequency-weighted-native-multiplier/portable/bounded_wasi.py": "8232cc247e5910aab7a0fecb03426088c8f851fd93cbf8fb3587a4a5d7ee143d", + "research/frequency-weighted-native-multiplier/portable/compare.py": "7a906b2b871011595f66882897e7ff0fa79f007fc7887ae0c21b555d778a75c8", + "research/frequency-weighted-native-multiplier/portable/compiler_state.py": "11f371903410a53aa138bb9b9c49e9441393a34092fff922716a78b5521e1870", + "research/frequency-weighted-native-multiplier/portable/consumer.py": "411cc1052a70f7084de81f6f1e54636737d5e5155d0756b8271d5d82c268d3b3", + "research/frequency-weighted-native-multiplier/portable/fixed_directory.py": "c99e9945295b954b453f4995474db4ec8da9e7d8d6ba1a564456213d066e5904", + "research/frequency-weighted-native-multiplier/portable/guest_opcodes.py": "9b2a1b128939cc8d2ef379199c09af74c52ed4b696640fce01606c431d931db6", + "research/frequency-weighted-native-multiplier/portable/module_census.py": "f22218fc37012f5c14b17afba3e8b868fd7268f25931836397f00fbdd319f6f7", + "research/frequency-weighted-native-multiplier/portable/producer.py": "5a76b94efb0bb59a686255f212b532a0f44a586649befda07dbfc5fe86c6a8b7", + "research/frequency-weighted-native-multiplier/portable/record_census.py": "8132c345cfcc5e7d89494fa437685673273f878f2dc40e0187bf2b84eee17e08", + "research/frequency-weighted-native-multiplier/portable/run.py": "6a1e17556326107cac9e70f446b2a90c35e9b4b07bfb7c4b31e5fe9b081f7d9b", + "research/frequency-weighted-native-multiplier/portable/signed.py": "7620e713be7a8064c5b9f83e6573cfabab801b627f0133b7998fdb51a6bac449", + "research/frequency-weighted-native-multiplier/portable/source_image.py": "e354c3fb2bb05eb36dc2438d89c30b18b7973638c51af526d8e55b56803c73ba", + "research/frequency-weighted-native-multiplier/portable/tape_directory.py": "70bf289334f724cabf1cfa9e074199e6be93ef0aeba8193f279e5ef1336de97b", + "research/frequency-weighted-native-multiplier/portable/verify_receipt.py": "8b42d3c5f35d6810321eb000e10b4e5593d543296cc670c3c8847e7051c1b30c", + "research/frequency-weighted-native-multiplier/positive_debit.py": "7320b6a4ef1320d765e9b41a9b1e286db83a1d36d96f46bee0bef37974e8b8d9", + "research/frequency-weighted-native-multiplier/receipt.py": "82d921fdc33006e2d356d8bf78f3c85777722322d716be44b42bc763a04c8095", + "research/frequency-weighted-native-multiplier/runtime.patch": "f35d37cc1746b5a7ac137a3f6de6de887a24f3af578283c24a64c8a25ccc584b", + "research/frequency-weighted-native-multiplier/typed_raw.py": "0c268432c9d48798c17d927f2d900b5e69dfc6585166cd71f253913e389c3b47", + "research/frequency-weighted-native-multiplier/typed_transport.py": "b76b9ad3dc0dd91473026c079585f830387eaa3c34c25a7820ee5057d5cbf941", + "research/frequency-weighted-native-multiplier/verify.py": "07730c6859c26de43b8621bf7e5b778187f41ac17419569ada7c6e10f5d04d4a", + "research/tiered-native-multiplier/CLOCK.md": "cf71e4a3216df23eb7e4fa8a8d9de3735e6257c65ca8a60a5085d9f3c90c4ecb", + "research/tiered-native-multiplier/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "research/tiered-native-multiplier/MEASUREMENTS.json": "a1083bc55178baf0015ef83ef169f45df61475fcc648f487e03c852c871f1f00", + "research/tiered-native-multiplier/NOTICE.md": "c386dabe3fd1d046bddc782c671219757c7708e9ec874a6ede55b540edc95f2c", + "research/tiered-native-multiplier/NUMERICAL.md": "14b86724db522393981ed54b540a35f27bd952f3d95d6e6d14c5b23896811dc9", + "research/tiered-native-multiplier/README.md": "d2c214591f03313dece24592cde3193deffb2f1057b891604597b5e8c6d020ca", + "research/tiered-native-multiplier/RESULT.json": "661e16fcb533b69b97ad2dc91ab81bed79c44e7fdce01306ce573cb6f0ed7fa7", + "research/tiered-native-multiplier/SERIAL-SETUP.md": "1ca7e23ae113647605a31fa309c3bbdde2baf2d442913247fcda4c8a1eef7e7c", + "research/tiered-native-multiplier/SETUP.md": "6951a98f2f8a0bf73c8d60b16ebbbd66bf87584251df8afbefe4e3a0330bfbf3", + "research/tiered-native-multiplier/SOURCES.json": "7a10012734132909e99b0c6160d68d0b8647e1607d25679efb1f5315cf8e23de", + "research/tiered-native-multiplier/ScaledEntrance.lean": "e404be78622db98e9c3b490a15d0e9f002a2cf1eee9ecbd0a9516efbd0db5329", + "research/tiered-native-multiplier/TASK.json": "2cfe7fe1ea4ee8cd07d24048d45e543fdb8a6fa6585ebdc20b1ede55982a16a7", + "research/tiered-native-multiplier/TierCost.lean": "668a248d1060dd4fe97a0edb6652cb3782b8ba4ccc0d00ec73ee6ae253eb9945", + "research/tiered-native-multiplier/VERIFICATION.md": "343f4b2de9b49c1536d35046eee086898bad48023b7da528c5096ca43a1358d0", + "research/tiered-native-multiplier/VERIFY.json": "c684d5b86039809900c85fb0ce64d531db23c62e06bfcf210d6b2cc349480492", + "research/tiered-native-multiplier/bootstrap.py": "74ac8f1d3af21f86cda48a3d50084d6fa5faf84b44ec2e5929b587f40f5bcfd1", + "research/tiered-native-multiplier/check_gaussian.py": "383a3385bc9763d6eb557163ee62aa9ab999b0d98c719a004db87abfee063d24", + "research/tiered-native-multiplier/check_lean.py": "0d53ee2a814887bb53e78f62f2d2e73544641f2cac470dbecec93cdb0aa17203", + "research/tiered-native-multiplier/check_phase_passes.py": "6afd65da931476680d88cb54336ffedf531c3063af181f75403d511e24e83b94", + "research/tiered-native-multiplier/check_placement.py": "d416329ba75727d8f968abc39caded0c1a1fd3f21ffc9286274c5b834aab7154", + "research/tiered-native-multiplier/check_serial_setup.py": "11d1c3209cb523a360ab9abaefb3122507fdf5cb469169890fe2dac636812c47", + "research/tiered-native-multiplier/grades.py": "340684fdd5ca0e611836b0e7301f1c339282ba532bf9e3ec8055944d8981f3c8", + "research/tiered-native-multiplier/independent_price.py": "0b2ecc4a1845a2807782644b6b2675e2fcb194fcbb3ae80b50af9a775363e952", + "research/tiered-native-multiplier/installations.py": "1c6978b8c7d136ef87191512d9ab9eb3dda8a818844244b96cb165d46d97b1df", + "research/tiered-native-multiplier/measure_setup.py": "896349b654c7b8195e9823beaee080d2d30b3f72a562de90c7b6e2554bdd20bb", + "research/tiered-native-multiplier/receipt.py": "3d0219eb2262ea64ccf2dc8da4d2877e32c519c4670d99577703f8bfc236ba61", + "research/tiered-native-multiplier/runtime.patch": "6c93961841be2abc3629928074e2c7917d264e94187276fc88a33f922a3c62e4", + "research/tiered-native-multiplier/serial_setup.py": "61b5058d394ed74e943303e4bdbf21d58ccf5d8bb39fc4b02e97bc135d7bdbbc", + "research/tiered-native-multiplier/source/INSTALLER-NOTICE.md": "c6b1753ad6ebda2a2143b1a9efc80fadad6c1b27552c3ec8bc7bfdb431fb8eeb", + "research/tiered-native-multiplier/source/K7-NOTICE.md": "9c5ae9750012d305d917e625d14a33cc880e810e801e73364725bcdc24bffdb5", + "research/tiered-native-multiplier/source/K7-STACK-LEDGER.json": "a0c0d5b241e6861a5c49a287617e48fba56b09824f5ef4fcb7f03152edf37e8e", + "research/tiered-native-multiplier/source/activation.py": "6e7f89d40a4d10ecd40a50e5b96334dfc64db90841ece7e3ef12eeca5ee5093b", + "research/tiered-native-multiplier/source/check_binary_k7.py": "5eeb8f818725249cbabf215c323c3f8351b1c4ed3c127119341e6ed09f490dd6", + "research/tiered-native-multiplier/source/installer.tar.gz": "6696459e2e3552f802e7caaaf93dc86c9bb6b62ee38631702bff2e3a8a9a481a", + "research/tiered-native-multiplier/source/ordinary_clock.py": "91dcf0ef72dddbde998b80f3d8b30c8036de9ce97e06e2bbd9c4159bf292020d", + "research/tiered-native-multiplier/source/outer_budget.py": "ca4438db28a447ed5c43d87d43f0ac10a0cb2b4e183342ac93139d517b9d4d02", + "research/tiered-native-multiplier/source/outer_clock.py": "63363c3da673365f3ac5e1b7e318c6938005f1e9c9896799504cc598efbf96fa", + "research/tiered-native-multiplier/source/strong-bit-k7.json.gz": "9e7392c52bcf29c0cc58c54c619f95c28f476394c33e8e0a5aa30c9557d31362", + "research/tiered-native-multiplier/verify.py": "d6cf9085e87743db14932a21cf895f8bd4d0f126b6c0bb7220d3255268dba39a" + }, + "head": "cbe847a953b971f9c6c5a0a6661e2008acd29086" +} diff --git a/research/p104-k7-integral-fringe/source/peer8094/PROOF.md b/research/p104-k7-integral-fringe/source/peer8094/PROOF.md new file mode 100644 index 0000000000..6dac92ac93 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/peer8094/PROOF.md @@ -0,0 +1,49 @@ +# Retuned K7 ordinary floor and exact height allocation + +The comparator is [#8073](https://github.com/CrocSwap/integer-mult-bounds/pull/8073), κ 0.003898219753506. Its exact fixed-booking stopped ceiling is `523210198560303585338978849681/134217728000000000000000000000000`, and this package re-derives it in `check_stage_seam.py`. The new installed target is 0.003898224460300, above that ceiling. The signed words, source access, owner restoration, caller, compiler, fixed tape and precision, and analytic recovery stay under the same five assumptions. + +## One parameter in the all-size K7 invoice + +#8073's complete directed ordinary factor is + +`(47/20)(256/255)(4097/4096)(1028/1024)(1024·134·L)^c (1+s/L+δ) / ((1−10/L)(1−δ)^3)`, with `c = 4391986206293/2^50` and `δ = 2^-128`. + +Here `s` bounds `10Σk/(tΨ)`. #8073 proves `s < 7.439580926465596639` from the unchanged K7 source, with 18906 productive labels, 104652 paid labels, 24 transfer shares and 286098 weighted target axes. Ψ is a sum over the 24 directed edges only, so neither the bound nor its additive errors (`2^30/N^5`, `2^46/N^4`, `2^20/N^4`, the grid enclosure) depend on `L`. This package books `s = 186/25`. `check_ordinary_floor.py` asserts `0 < 10Σk/(tΨ) < 186/25` and reports the ceiling 7.439580927 (×10⁹ rounded up). + +The floor `L` is a free construction parameter of the binary recipe (`level_floor`). #8067 picked 18960, which is where `c log L + (s+10)/L` is minimal when `s = 64`. With `s = 186/25` the minimum sits at `L = 4474`. Every floor hypothesis in `check_ordinary_floor.py` holds there: +- `L` is even and `24(L+2) < 25L`; +- `L^t > 1024` (about 4331); +- `(1−10/L)Ψ > 1`; +- the 77-power delay bound holds; +- the first two columns are `(4466, 4468)`. + +The literal recipes open with `level_floor = 4474` through the installed `Recipe.open` seam, for all five ordinary stages (entry and terminal). + +The directed factor at `(L, s) = (4474, 186/25)` is below 2.573602304817903473. Directed 192-bit roots show: +- `2^(1430037/2^20)` exceeds it by more than 7.58e-7; +- the next finer point `1430036/2^20` fails; +- #8073's own `(18960, 8)` booking fails the new allowance. + +`receipt.py` also checks `upper^(2^20) < 2^1430037` exactly. The 47/20 child charge, the 375/376 contraction and the Gaussian booking `64939/524288` with its bands 1874/1724 are unchanged. + +## Capped integer allocation + +This uses the same model and the same cap as #8072 and #8073: +- three ordinary heights in [8192, 524288] and one Gaussian height; +- `1731 + 320Σb + 220G ≤ 318292011`; +- the stopped rate is the minimum of the three-stage recurrence (with 1e-21 booking ticks) and the Gaussian rate, less 5e-18. + +At `G = 511587` the cap leaves `(8192, 110461, 524288)`. Its weighted reciprocal tangent slopes are strictly increasing, so #8073's integer-optimum argument applies unchanged. `G − 1` keeps the same ordinary heights and fails Gaussian, and `G + 1` forces `b₂ = 110460` and fails ordinary. Two- and four-stage schedules under the same cap are lower (two stages: 0.00389818; four stages: 0.00389822181). + +## Literal invoice + +The full recurring log₂ C is 318291991, after the entry path with 518-bit conversion. The funding floors are (516019, 511587). The binary cuts are (8290, 118815, 643167), the first terminal header and stock come from `RESULT.json`, and the maximum native height is 524288. Conservative fixed serial setup stays below 2^228, because the setup scope is unchanged. + +## Predecessor credit + +Everything except the floor, the suffix booking, the debit grid and the profile comes from [#8073](https://github.com/CrocSwap/integer-mult-bounds/pull/8073) (Campaign contributor with OpenAI Codex). That builds on: +- Ali Romman's [#8042](https://github.com/CrocSwap/integer-mult-bounds/pull/8042) suffix argument, [#8057](https://github.com/CrocSwap/integer-mult-bounds/commit/cbe847a953b971f9c6c5a0a6661e2008acd29086) signed producer and [#8055](https://github.com/CrocSwap/integer-mult-bounds/pull/8055) setup proof; +- SYLforge's [#8052](https://github.com/CrocSwap/integer-mult-bounds/pull/8052) K7 word; +- [#8059](https://github.com/CrocSwap/integer-mult-bounds/pull/8059) through [#8072](https://github.com/CrocSwap/integer-mult-bounds/pull/8072) for the Gaussian factor, the bands, the floor computation and the allocation method. + +The floor retune and this package were made with Claude (Anthropic). diff --git a/research/p104-k7-integral-fringe/source/peer8094/RESULT.json b/research/p104-k7-integral-fringe/source/peer8094/RESULT.json new file mode 100644 index 0000000000..c2723777ef --- /dev/null +++ b/research/p104-k7-integral-fringe/source/peer8094/RESULT.json @@ -0,0 +1,174 @@ +{ + "gaussian": { + "trial": "2144845547/549755813888", + "weights": [ + 5, + 451 + ], + "real_targets": [ + 52608, + 52608 + ], + "real_loans": [ + 282336, + 281328 + ], + "weighted_targets": 23989248, + "weighted_loans": 128290608, + "directed_margin": "25058737434575388224575020763/12026966897699221379437011099669697124641", + "grade_cells": 51, + "typed_cells": 88, + "min_individual_share": "84552148502764401372515549359944817029050164931794082594601537579467011/2860129876771506011238618397035687755768702340256804091497779103672800801628608", + "raw_loss": "32493/262144", + "finite_loss": { + "debit": "32493/262144", + "lower_band": 1874, + "upper_divisor": 1724, + "upper_scale": 263772, + "weighted_target_axes": 677246016, + "fringe": "9855327798491145000008863611532376016988768776524141279702351778045123210618948864642927936166641175388866240444915926300679636006691575485715060252445081351560429404511158572360378279210639068080753530558224129392605801257746179782957096064788428064753669613420462519401696785546490279430080018137642933835029211580682854203685497104978657309177854278066988223552089745565498322648766352359836788046785020187491928709028380672/1342540347115003801339193634434118005969396584285962442394959680393309123888495653671285995487875229178096266927976831591204700090080192133325202296541848553230643969974272240538847398499051171111777461260201928540243171377784715338372417078127721083771125765869564048493216028935498620492028436115290562587407642634709562627328187188324708170778235532923474771273686539644997760676043397700918553715386317622276832315088178455", + "psi_lower": "36774473797948037912541634097319747003962336700199693263185882360108702157204359298849184867697091848216479995115497386337385946240131323176845598251098906577844387526162820503736128940557939295960932285381747537950101211679504229529740379309339083420407786722205325615622484024288593604461947377591301975260073070627318995418672896973647110540817123114001402885032828105953443989475620884756624494834416485967126325/39705077055616758278398945718051270079611438391017956157398730393989438789277411838957841865629177832072563146472685672846872214469179617143201512976452800338626006041794233403917197722699527632604968482024969035216709987572500437752314454941061554198481484429943611438686069826395238026562564130057975559635506987142353835625307135663742826983170452337581165507977519446768523155949307595075711756167806976", + "upper_factor": "134667828521352946827277466923875792742152375382159190455807148713042743779215305635750257991965288838288719960034256612002029434764148272719558843914695715191801891192941005051504337914181031605782716144250340031975697947945996890931788989525599377871413615387566852154789135127352312497311434855201439925870554904241254867886758903637446909883062852425586685301736720143445020707734415017867921629872549964489271241855789110424006584585024504735895884925924106791529175262703307716505501393496931406502797178207294089568551602504714558234605348776657310756368049810181098265475603759104/123580773374774139706743239199911715736300977349790795558001573628030255043046429657611426002240582458056212955511247617563450590225969427286635772453353747514638005869472174378209726976604548505671114727150196313963306505957707180235079767540675988558958727593661411586205630782812490534897988699310975574852767165940503581524301776246934358632848298093520591047826407102440056585801857110986448849642213266520351744694262757454851094484829657958670678869440431292058646015766763918814535977632841275152600551084571577381729778445461612470638411946979432368932333435171592011149954840625" + }, + "capacity_cut": { + "new": [ + "2356659474246895453004862288340047/5070602400912917605986812821504", + "75413103175900654496155594298779059/162259276829213363391578010288128" + ], + "90": [ + "168820568970742257315174557382401181/162259276829213363391578010288128", + "337641137941484514630349115332889169/324518553658426726783156020576256" + ], + "91": [ + "-156428030449689521334616704420940755/162259276829213363391578010288128", + "-156428030449689521334616704133756587/162259276829213363391578010288128" + ] + } + }, + "entry": { + "kappa": "69/20000", + "ordinary_H": [ + 3000, + 3080 + ], + "numerical_H": 1024, + "ordinary_rates": [ + "429429543222806817/125000000000000000000", + "690000000000001/200000000000000000" + ], + "gaussian_rate": "2078299883/549755813888", + "signed": { + "strict": 54, + "functional": 4, + "smallest_margin": "1/10000000000000000000", + "ordinary_margin": "1/1000000000000000000", + "positive_margin": "138582096165769387223/419430400000000000000000" + }, + "stock": { + "binary_cuts": [ + 3077, + 6221 + ], + "public_exponent_A": 7437, + "first_public_offset": 4, + "initial_s": 7438, + "stage_and_outer_fixed_log_overhead": 1964, + "retimed_first_stripe_margin": 1701, + "retimed_all_size_margin_floor": 1635, + "absolute_log2_private_control_envelope": 3153922, + "storage_upper": "6.2 p T < 297.6 n bits" + }, + "geometry": { + "public_offset_above_2_to_A": 4, + "first_extent_bits_minus_b": -7433, + "last_extent_bits_minus_b": -7432, + "minimum_width": 3809536, + "log2_axis_count": 7412, + "largest_axis_width": 5592406, + "private_clock_log2_upper": 5734316302, + "actual_dense_root_entry_log2": 11184812 + }, + "binary_surcharges": [ + 0, + 25818582 + ], + "log2_B": 125433364, + "log2_C": 125660246 + }, + "terminal": { + "kappa": "1950428633893/500000000000000", + "ordinary_H": [ + 31808, + 502922, + 7951907, + 125730703, + 134217727 + ], + "numerical_H": 208653, + "ordinary_rates": [ + "120088687817902031/31250000000000000000", + "779590393282934239/200000000000000000000", + "3900686000905168083/1000000000000000000000", + "3900855909461999139/1000000000000000000000", + "780171453557201/200000000000000000" + ], + "gaussian_rate": "149153438386085/38236066611724288", + "signed": { + "strict": 54, + "functional": 4, + "smallest_margin": "1/10000000000000000000", + "ordinary_margin": "1/1000000000000000000", + "positive_margin": "39818194746132473/29171803750400000000000000000" + }, + "stock": { + "binary_cuts": [ + 32000, + 534986, + 8486957, + 134217724, + 268435515 + ], + "public_exponent_A": 268644472, + "first_public_offset": 2, + "initial_s": 268644473, + "stage_and_outer_fixed_log_overhead": 1976, + "retimed_first_stripe_margin": 134320142, + "retimed_all_size_margin_floor": 130122687, + "absolute_log2_private_control_envelope": 137438952451, + "storage_upper": "6.2 p T < 297.6 n bits" + }, + "geometry": { + "public_offset_above_2_to_A": 2, + "first_extent_bits_minus_b": -268644468, + "last_extent_bits_minus_b": -268644467, + "minimum_width": 137545971456, + "log2_axis_count": 268644432, + "largest_axis_width": 183251937963, + "private_clock_log2_upper": 187925345127545, + "actual_dense_root_entry_log2": 366503875926 + }, + "binary_surcharges": [], + "log2_B": 85899221583, + "log2_C": 85945126845 + }, + "previous_rate": "1949109876753/500000000000000", + "rate_delta": "65937857/25000000000000", + "complete_log2_C": 85945126846, + "ordinary_floor": 4474, + "ordinary_matched_suffix_coefficient": "186/25", + "ordinary_finite_debit": "710359/524288", + "ordinary_child_tariff": "2401/1024", + "ordinary_child_contraction": "2400/2401", + "ordinary_child_geometric_sum": 2401, + "ordinary_entry_clock_extra": 5, + "ordinary_terminal_clock_extra": 15, + "entry_price_surcharge": 121121, + "fixed_funding_height_floors": [ + 134145233, + 208653 + ], + "log2_fixed_setup_upper": 228, + "native_setup_transition_upper": 217364570380528137475793294892811967875864032914108887556978854854656, + "native_setup_grade_actions": 269057152, + "max_native_H": 134217727 +} diff --git a/research/p104-k7-integral-fringe/source/peer8094/VERIFY.json b/research/p104-k7-integral-fringe/source/peer8094/VERIFY.json new file mode 100644 index 0000000000..35fd75e9fe --- /dev/null +++ b/research/p104-k7-integral-fringe/source/peer8094/VERIFY.json @@ -0,0 +1,94 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/p104-shortcut-word-eta-27bit-5stage/PEER-SOURCE.json", + "research/p104-shortcut-word-eta-27bit-5stage/peer8057.tar.gz", + "research/p104-shortcut-word-eta-27bit-5stage/prepare.py", + "research/p104-shortcut-word-eta-27bit-5stage/RESULT.json", + "research/p104-shortcut-word-eta-27bit-5stage/check_cutoff.py", + "research/p104-shortcut-word-eta-27bit-5stage/check_stage_seam.py", + "research/p104-shortcut-word-eta-27bit-5stage/check_ordinary_floor.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "price" + ], + "timeout_seconds": 150, + "checks": "Check the (186/25)/L directed K7 suffix envelope at the retuned floor 4474, adjacent and prior-envelope booking controls, unchanged Gaussian factor, signed placement and complete invoice." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "calendar" + ], + "timeout_seconds": 600, + "checks": "Check the actual K7 matched-interval census and all-size error envelope, previous and adjacent profiles, exact capped crossing, seams and signed restoration." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "raw" + ], + "timeout_seconds": 80, + "checks": "Execute both nonzero signed native jobs and restore all physical owners." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "exterior" + ], + "timeout_seconds": 90, + "checks": "Generate the first exterior births and return all owners through the actual signed words." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "nested" + ], + "timeout_seconds": 90, + "checks": "Carry the actual nonzero cross-type nested loan and verify both owner returns." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "product" + ], + "timeout_seconds": 100, + "checks": "Execute the exact signed product and independently verify coefficients and restoration." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "setup" + ], + "timeout_seconds": 60, + "checks": "Check canonical serial division, B\u00e9zout, rational arithmetic and the conservative fixed native setup tape bound." + } + ] +} diff --git a/research/p104-k7-integral-fringe/source/peer8094/check_cutoff.py b/research/p104-k7-integral-fringe/source/peer8094/check_cutoff.py new file mode 100644 index 0000000000..393a19216f --- /dev/null +++ b/research/p104-k7-integral-fringe/source/peer8094/check_cutoff.py @@ -0,0 +1,75 @@ +"""Check the literal upper fence, integer cutoff births and timed returns.""" +from fractions import Fraction as Q +from pathlib import Path +import sys + +sys.path.insert(0, str(Path(sys.argv[1]).resolve())) +from upstream import install + +install() +import grades +from grades import LOWER, SCALES, UPPER_DIVISOR, WEIGHTS, numerical_recipe +from installations import ENTRY, GAUSSIAN_C, TERMINAL +from transport import Measure, ceil +from typed_transport import NativeType, TypedPlan, column_header + +assert LOWER == 1874 and SCALES == (1, 2) and WEIGHTS == (5, 451) +assert UPPER_DIVISOR == 1724 + + +def verify_constructor_call(height): + recipe = numerical_recipe(height) + carrier = 1 << height + + def verify(n, types, cells, t, lower, upper, volume, ticks, rounds, **options): + assert (n, lower, t) == (carrier, LOWER, 1-GAUSSIAN_C) + assert upper == 2 * (carrier // (1724 * 306)) + assert upper > 2 * (carrier // (2048 * 306)) + assert upper % 2 == 0 and 4*258*(upper-8) < n + assert len(cells) == 88 and tuple(word.multiplicity for word in types) == WEIGHTS + assert (volume, ticks, rounds) == (carrier**6, carrier**82, carrier**2) + assert options == {"width": 1 << (92*height), "delay_base": 1 << 19} + return True + + original = grades.TypedPlan + try: + grades.TypedPlan = verify + assert recipe.open() + finally: + grades.TypedPlan = original + + +heights = (ENTRY.complex_log, TERMINAL.complex_log) +assert heights == (1024, 208653) +for height in heights: + verify_constructor_call(height) +print("PASS_LITERAL_UPPER_FENCE", UPPER_DIVISOR, LOWER, heights, flush=True) + +for band, expected in ((LOWER, (2, 0)), (LOWER+2, (0, 0))): + widths = [] + for kind, scale in enumerate(SCALES): + header = column_header(band-8, kind) + assert header % 2 == kind and header - kind == band-8 + widths.append((header-kind)*scale) + assert tuple(width % 4 for width in widths) == expected +assert (LOWER-8, 2*(LOWER-8)) == (1866,3732) + +native = tuple(NativeType((2,), (1,), weight) for weight in WEIGHTS) +shares = {(a,1,b,2):Q(w,sum(WEIGHTS)) for a in range(2) for b,w in enumerate(WEIGHTS)} +t = 1-GAUSSIAN_C +n, volume = 65536, 2**29 +plan = TypedPlan(n, native, shares, t, LOWER, 4126, volume, 3, 16, delay_base=3, padding=1) +mass = Measure(t, volume, 64*n.bit_length()) +assert plan.bands.start == LOWER and (LOWER-2,0) not in plan.count +for band in plan.bands: + for kind, weight in enumerate(WEIGHTS): + assert plan.count[band,kind] == ceil(weight * mass.mass(band,band+2)[1]) +assert {(a,link.kind) for (_,a,_),ls in plan.send.items() for link in ls} == {(0,0),(0,1),(1,0),(1,1)} +grants = [] +for recipient in range(2): + for link in plan.receive[LOWER,recipient,0]: + assert link.band in (2*LOWER,2*LOWER+2) and plan.delay[LOWER] < plan.delay[link.band] + assert link.count > 0 + grants.append((recipient,link.kind,link.band,link.count)) +assert len(grants) == 8 and plan.source_width > 0 and plan.leaves_per_epoch > 0 +print('PASS_LITERAL_LOWER_CUTOFF', LOWER, (1866,3732), grants, plan.leaves_per_epoch, flush=True) diff --git a/research/p104-k7-integral-fringe/source/peer8094/check_ordinary_floor.py b/research/p104-k7-integral-fringe/source/peer8094/check_ordinary_floor.py new file mode 100644 index 0000000000..b49e8a5ea6 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/peer8094/check_ordinary_floor.py @@ -0,0 +1,226 @@ +"""Check the actual ordinary floor and fully charged occupied-edge calendar.""" +from collections import Counter +from fractions import Fraction as Q +from hashlib import sha256 +import json +from pathlib import Path +import sys + +RUNTIME=Path(sys.argv[1]).resolve() +sys.path.insert(0,str(RUNTIME)) +from upstream import install + +install() +LOWER=4474 + + +def ceil(x): + return -(-x.numerator//x.denominator) + + +def all_size_stock(word, c, intervals, unit): + """Discharge the parameterized TRANSFER.md hypotheses at the new floor.""" + t = 1-c + targets, paid = Counter(word.targets), Counter(word.paid) + assert max(targets) <= 134 and min(paid) >= 1 + assert all(5*r <= 4*k for r,k in word.cells) + assert all(sum(p for (u,k),p in word.cells.items() if u==r)==1 for r in paid) + # Check actual directed per-receiving-label funding and the whole raw margin. + t_lower = {k: intervals(k,t)[0] for k in targets} + p_upper = {r: intervals(r,t)[1] for r in paid} + t_hi = sum(n*intervals(k,t)[1] for k,n in targets.items()) + p_lo = sum(n*intervals(r,t)[0] for r,n in paid.items()) + assert sum(targets[k]*v for k,v in t_lower.items())>sum(paid[r]*v for r,v in p_upper.items()) + assert 100*p_lo>99*t_hi + for k,n in targets.items(): + load=sum(paid[r]*p*p_upper[r] for (r,s),p in word.cells.items() if s==k) + assert 01 + + # Check the smallest admitted numerical scale; every margin below grows + # with N. Actual binary native stages start no earlier than H=3000. + H=1024 + N=1<=(1-delta)*N + assert Q(6,5)**4>2 and Q(6,5)**73>2**19 + assert len(word.paid)<2**19 + assert 2**19*Q(1,1024*ambient*LOWER)**77+Q(1,N**77)<1 + lower_power=Q(intervals(LOWER,t)[0],unit) + assert lower_power>1024 and Q(1,t*lower_power)+Q(2,N**5)<2 + # Endpoint inverse bases are >1/(512N) through all roots. The + # original 61-stage envelope costs 397+30.5H bits per endpoint. + assert c.denominator.bit_length()-1<=60 and Q(1,N)-Q(1,2**(64*(H+1)))>Q(1,512*N) + grid_error_bits=397+31*H+6*H+3-64*(H+1) + assert grid_error_bits<-132 + # Time and integer errors are already normalized conservatively without + # the L**c*psi denominator, which is strictly greater than one. + assert c>0 and 1=1024. + assert suffix_birth_error1 + assert (1-Q(1,N))/Q(257,256)>Q(1,2) + return {"fringe_upper_1e9":ceil(fringe*10**9),"psi_lower_floor":int(psi), + "grid_absolute_error_exponent_at_H1024":grid_error_bits, + "suffix_target_axes":target_axes, + "suffix_birth_error_upper_at_H1024":"2^30/N^5", + "normalized_error_allowance":"2^-128", + "birth_bound":"2V","copy_group_bound":"3N^3","whole_field_width":"N^92", + "first_two_columns":[LOWER-8,LOWER-6],"minimum_positive_scale_h_guard":1024} + + +def bound_recipe(old, lower): + """Pass the proposed literal cutoff through the installed Recipe.open seam.""" + import transport + + assert old.level_floor==lower + N=1<=0 and sender in live + closes+=1 + assert not live and not pending and not any(held.values()) and opens==closes + assert axes==plan.leaves_per_epoch and len(first_counts)==2 + return {"tested_occupied_K7_grade":[r,k],"lower":LOWER,"upper":hi,"carrier":n, + "first_band_contacts":contacts,"native_opens":opens,"native_closes":closes, + "returned_paid_prefixes":loans,"paid_singletons":axes, + "lower_return_counts":dict(first_counts),"extent":"complete fixture event stream"} + + +def check(): + from band_product import prepare_native + from installations import BINARY_C, ENTRY, TERMINAL + from raw_binary_stage import binary_word + from strict_moment import UNIT + from unpowered_price import intervals + + stage=(RUNTIME/"raw_binary_stage.py").read_bytes() + assert sha256(stage).hexdigest()=="8020d33828233e7016700849a507a8cee78db8a17a33b6063b737313ea05b07f" + assert TERMINAL.rank_logs==(31808,502922,7951907,125730703,134217727) and TERMINAL.complex_log==208653 + word=binary_word() + assert (len(word.targets),len(word.paid),len(word.cells))==(18906,104652,24) + a,b=prepare_native() + ordinary=(*a[:-1],*b[:-1]) + assert tuple(recipe.rank_log for recipe in ordinary)==(*ENTRY.rank_logs,*TERMINAL.rank_logs) + assert (a[-1].rank_log,b[-1].rank_log)==(1024,208653) + openings=[bound_recipe(recipe,LOWER) for recipe in ordinary] + stock=all_size_stock(word,BINARY_C,intervals,UNIT) + finite=finite_plan(word,BINARY_C) + assert finite["tested_occupied_K7_grade"]==[49,64] + assert finite["native_opens"]==76380 and finite["returned_paid_prefixes"]==456 + assert finite["paid_singletons"]==38003660528 + print("PASS_LITERAL_ORDINARY_FLOOR",json.dumps( + {"new_binary_openings":openings,"binary_all_size":stock,"binary_integer_fixture":finite}, + sort_keys=True),flush=True) + + +if __name__=="__main__": + check() diff --git a/research/p104-k7-integral-fringe/source/peer8094/check_stage_seam.py b/research/p104-k7-integral-fringe/source/peer8094/check_stage_seam.py new file mode 100644 index 0000000000..82fc94cfa1 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/peer8094/check_stage_seam.py @@ -0,0 +1,270 @@ +"""Replay literal ordinary dispatch and bounded signed bank returns.""" +from dataclasses import replace +from fractions import Fraction as Q +from hashlib import sha256 +from io import BytesIO +from itertools import product +import json +from pathlib import Path +import sys + +RUNTIME = Path(sys.argv[1]).resolve() +sys.path.insert(0, str(RUNTIME)) +from upstream import install + +install() + + +class DyadicWidth(int): + """Speed up exact exponentiation of a mathematically dyadic test width.""" + def __pow__(self, exponent): + assert self.bit_count() == 1 and exponent >= 0 + return 1 << ((self.bit_length() - 1) * exponent) + + +def verify_stage(profile, cuts, number, log_width): + import ordinary_carrier as carrier + + calls = [] + base = DyadicWidth(1 << log_width) + prev = 1 << cuts[number-2] + power = 1 << (log_width//250) + eta=profile.eta + assert log_width % 10000 == 0 and log_width*eta.numerator % eta.denominator == 0 and log_width % 250 == 0 + width = max(prev+1, power) + component = 1 << (log_width*eta.numerator//eta.denominator) + count = -(-width//component) + short, longer = divmod(width,count) + expected_layout = (longer, short+1, count-longer, short) + rank = 1 << profile.rank_logs[number-1] + expect_direct = -(-base//width) <= 1 << (8*profile.rank_logs[number-1]) + + def root(value, degree): + assert value.bit_count() == 1 + quotient, remainder = divmod(value.bit_length()-1,degree) + assert not remainder + return 1 << quotient + + def receiver(dimension, layout, previous, *, direct, profile): + assert dimension == rank and layout == expected_layout and direct == expect_direct + assert previous.func is carrier.ternary + assert previous.keywords == {"maximum": number-1, "profile": profile} + return number + + def body(source,target,digits,prefix,gap,suffix,backend): + assert digits==base and (prefix,gap,suffix)==(1,3,5) and backend==number + calls.append((digits.bit_length()-1,backend)) + + actual = carrier.ceil_root, carrier.Receiver, carrier.root_body + try: + carrier.ceil_root, carrier.Receiver, carrier.root_body = root, receiver, body + carrier.ternary(None,None,base,1,3,5,maximum=number,profile=profile) + finally: + carrier.ceil_root, carrier.Receiver, carrier.root_body = actual + assert calls == [(log_width,number)] + return {"stage":number,"scanned_log":log_width,"rank_log":rank.bit_length()-1, + "predecessor_cut":cuts[number-2],"direct":expect_direct, + "component_log":component.bit_length()-1} + + +def verify_tape(width, u, v): + from five_exchange import same_order_line + from growing_binary import Weighted + from same_order_body import SameOrderBody + from streaming_routes import cold_swap_tape + from ternary_leaf import select_pivot + + class Core(SameOrderBody, Weighted): + def __init__(self): + super().__init__(2,(1,width,0,0),cold_swap_tape) + self.stock=self.owners + self.calls=0 + + def weighted(self,*args,**kwargs): + assert kwargs["atoms"]==1paid and gaussian_upper(TERMINAL.complex_log)>paid + # The ordinary side binds: the install is the 15-digit floor of its rate. + assert TERMINAL.kappa<=ordinary_upper(ranks)-5*STOP30 + assert 2*TERMINAL.eta>Q(1,250) and TERMINAL.eta>Q(1,258) + assert all(ordinary_upper(ranks[:i])1024 and stock["retimed_all_size_margin_floor"]>1024 + signed=qualify(TERMINAL.kappa,STOP,paid,gaussian_upper(TERMINAL.complex_log)) + assert (signed["strict"],signed["functional"])==(54,4) + logB=128+3*len(ranks)+320*sum(ranks) + late=1602+220*TERMINAL.complex_log+logB + conversion=((TERMINAL.kappa-ENTRY.kappa)*activation(TERMINAL)).__ceil__() + assert conversion==PREMIUM + assert 1+max(125660246+conversion,late)==TOTAL + assert TOTAL>318292011 + + hs=list(ranks); last=len(hs)-1 + def at(i,delta): + t=list(hs); t[i]+=delta; return tuple(t) + def require_funding(proposed,gaussian): + if ordinary_upper(proposed)<=paid or gaussian_upper(gaussian)<=paid: + raise ArithmeticError("Profile does not fund the terminal price") + def require_budget(cap): + if 1+max(125660246+conversion,late)>cap: + raise ArithmeticError("The full recurring invoice exceeds the declared cap") + capped=((62186,986008,1048575),66037) + previous_record=((125432,1988432,31439868,33554431),198527) # #8090, 25-bit 4-stage + # The install is the 15-digit floor of the rate, so the lower heights carry + # slack: DROPS[i] is the first drop of height i that falls below the booking. + DROPS=[917, 943, 944, 944, 5] + for i,d in enumerate(DROPS): + require_funding(at(i,-(d-1)),TERMINAL.complex_log) + assert ordinary_upper(previous_record[0])1: + mid=(lo+hi)//2 + try: + resource_receipt(replace(TERMINAL,rank_logs=(*prefix,mid,TOP))) + lo=mid + except AssertionError: + hi=mid + return lo + free=tuple(hs[:last-1]) + assert max_penultimate(free)==hs[last-1] + neighbours=[] + for i in range(len(free)): + for s in (-16,16): + t=list(free); t[i]+=s + if t[0]>=8192: + neighbours.append(ordinary_upper((*t,max_penultimate(t),TOP))) + # The 1e-21 intermediate ticks make the rate flat at the 1e-23 scale, so ties are allowed. + assert all(n<=ordinary_upper(ranks) for n in neighbours) + + assert sha256((RUNTIME/"strong-bit.json.gz").read_bytes()).hexdigest()==( + "9e7392c52bcf29c0cc58c54c619f95c28f476394c33e8e0a5aa30c9557d31362") + old=replace(TERMINAL,rank_logs=capped[0],complex_log=capped[1],kappa=Q(".003899574328473"),eta=Q(39,10000)) + old_native,new_native=prepare_native(old),prepare_native(TERMINAL) + word=binary_word() + assert (len(word.targets),len(word.paid),len(word.cells))==(18906,104652,24) + assert old_native[-1].targets is new_native[-1].targets and old_native[-1].cells is new_native[-1].cells + assert all(v.level_floor==4474 and v.targets is word.targets and v.paid is word.paid and v.cells is word.cells + for v in (*old_native[:-1],*new_native[:-1])) + def round_up(n): + return ((n+159999)//160000)*160000 # lcm(10000, 250, 256) + direct=[verify_stage(TERMINAL,cuts,i,round_up(cuts[i-1])) for i in range(2,len(ranks)+1)] + compiled=[verify_stage(TERMINAL,cuts,i,round_up(9*ranks[i-1])) for i in range(2,len(ranks)+1)] + assert all(x["direct"] for x in direct) and not any(x["direct"] for x in compiled) + tape=[verify_tape(1,[0,1],[2,1]),verify_tape(2,[1,7],[3,1])] + print("PASS_SHORTCUT_ETA_27BIT_5STAGE_PROFILE",json.dumps({ + "kappa":str(TERMINAL.kappa),"heights":ranks,"gaussian_height":TERMINAL.complex_log, + "binary_cuts":cuts,"signed":signed,"conversion_bits":conversion,"log2_B":logB, + "complete_log2_C":TOTAL,"stock":stock,"controls":controls, + "direct_stage_seams":direct,"compiled_stage_seams":compiled,"signed_tape":tape},sort_keys=True,default=str),flush=True) + + +if __name__=="__main__": + check() diff --git a/research/p104-k7-integral-fringe/source/peer8094/peer8057.tar.gz b/research/p104-k7-integral-fringe/source/peer8094/peer8057.tar.gz new file mode 100644 index 0000000000..3a3ded828f Binary files /dev/null and b/research/p104-k7-integral-fringe/source/peer8094/peer8057.tar.gz differ diff --git a/research/p104-k7-integral-fringe/source/peer8094/prepare.py b/research/p104-k7-integral-fringe/source/peer8094/prepare.py new file mode 100644 index 0000000000..6717e94acc --- /dev/null +++ b/research/p104-k7-integral-fringe/source/peer8094/prepare.py @@ -0,0 +1,340 @@ +"""Install the stacked retune on the five-shortcut Gaussian word at 27-bit heights, 5 ordinary stages and eta 1/256 (enlarged budget).""" +from hashlib import sha256 +import json + +NEW_INSTALLATION = "5b31cca69a8f10c78152ae030ae7c7ab156d22feec83347b887aa3fe78098ee7" +RAW_FLOOR_IMAGES = { + "before": "0c805a525322acf4eb03f083c2c763f3046c3d488e1f993beb484a3e2c2ff4a9", + "after": "8020d33828233e7016700849a507a8cee78db8a17a33b6063b737313ea05b07f", +} +RAW_FLOOR_PATCH = """--- a/raw_binary_stage.py ++++ b/raw_binary_stage.py +@@ -45,7 +45,7 @@ + @cache + def binary_recipe(height): + word = binary_word() +- return Recipe(height, word.tagged.ambient, word.targets, word.paid, word.cells, BINARY_C) ++ return Recipe(height, word.tagged.ambient, word.targets, word.paid, word.cells, BINARY_C, level_floor=4474) +""" + " \n \n def run(recipe, fields, machine):\n" + + +def replace(path, replacements): + source = path.read_text() + for old, new in replacements: + if source.count(old) != 1: + raise ValueError(f"Expected one change point for {old!r} in {path.name}") + source = source.replace(old, new) + path.write_text(source) + + +OLD_EDGE = ''' # The first three positive terms of log(k/r) suffice for each real edge. + psi = Q(0) + for (r, k), share in cells.items(): + u = Q(k - r, k + r) + log_lower = 2 * (u + u**3 / 3 + u**5 / 5) + psi += paid[r] * share * r * log_lower''' + +DIRECTED_EDGE = ''' # Integrate each exact directed edge, retaining both rounding ends. + # A downward ratio of outward powers bounds ((k/r)^c-1)/c. + psi = Q(0) + for (r, k), share in cells.items(): + floor = intervals(k, c)[0] * UNIT // intervals(r, c)[1] + assert floor > UNIT + psi += paid[r] * share * r * (Q(floor, UNIT) - 1) / c''' + +NATIVE_SETUP = ''' setup = native_clock() + grade_count = len(low[-1].paid.histogram) + len(low[-1].targets.histogram) + actual_roles = sum(len(v.targets) + len(v.paid) for v in high[-1].types()) + assert actual_roles < 2**20 and grade_count < 2**8 + assert len(low) + len(high) == 9 and max(h.bit_length() for h in (*ENTRY.rank_logs, ENTRY.complex_log, *TERMINAL.rank_logs, TERMINAL.complex_log)) <= 27 + # 27-bit indexed setup, extending the #8081/#8087 SETUP-PROOF (see SETUP-27BIT.md): every 92H stays below the\n # datum bound w = 2^38, the Gaussian carriers stay below 2^25 bits, and each of the 9 recipes gets 2^24 actions. + assert 92*(2**27-1) < 2**38 and 1024*(2**27-1)+3 < 2**38\n assert TERMINAL.complex_log < 2**25 and ENTRY.complex_log < 2**25 + assert 2*2048*(2**25+1) + 9*2**24 == 137589952512 < 2**40 + assert TERMINAL.eta == Q(1, 256) and all(abs(x).bit_length() <= 128 for x in (TERMINAL.eta.numerator, TERMINAL.eta.denominator, TERMINAL.kappa.numerator, TERMINAL.kappa.denominator)) + grade_actions = 2**20 * 256 + 2**8 * 256 * 8 + 32 * (grade_count + 2)**2 + 2**12 + assert grade_actions < 2**32 and setup["all_setup"] < 2**228''' + +DIRECTED_ORDINARY = '''def ordinary_debit(): + delta = Q(1, 2**128) + predecessor_tariff = Q(47, 20) + child_tariff = Q(2401, 1024) + + def bounds(floor, suffix, tariff=child_tariff, reserve=Q(1)): + # #8082: the ordinary contraction is paid by the clock sum, so the + # positive 256/255 summation reserve is not charged here. + multiplier = ( + tariff * reserve * Q(4097, 4096) * Q(1028, 1024) + * (1 + Q(suffix, floor) + delta) / ((1 - Q(10, floor)) * (1 - delta)**3) + ) + lo, hi = powers(1024 * 134 * floor, BINARY_C) + return multiplier * lo, multiplier * hi + + lo, hi = bounds(4474, Q(186, 25)) + # #8073's own booking at its floor, kept as a positive control. + k_lo, k_hi = bounds(18960, 8, predecessor_tariff, Q(256, 255)) + # #8076's own booking (floor 18960, 8/L, child tariff) at 11178/8192. + t_lo, t_hi = bounds(18960, 8, child_tariff, Q(256, 255)) + assert t_hi < 2 * powers(2, Q(2986, 8192))[0] + # Our earlier retune (floor 4474, (186/25)/L, tariff 47/20) at 1430037/2^20. + r_lo, r_hi = bounds(4474, Q(186, 25), predecessor_tariff, Q(256, 255)) + # #8082 (reserve dropped, tariff 47/20) at 1424116/2^20, and the tariff stack with 256/255 at 1426639/2^20. + e_lo, e_hi = bounds(4474, Q(186, 25), predecessor_tariff) + assert e_hi < 2 * powers(2, Q(375540, 2**20))[0] + c_lo, c_hi = bounds(4474, Q(186, 25), child_tariff, Q(256, 255)) + assert c_hi < 2 * powers(2, Q(378063, 2**20))[0] + assert r_hi < 2 * powers(2, Q(381461, 2**20))[0] + assert 2 * powers(2, Q(3012, 8192))[0] - k_hi > Q("0.0000277614405947") + prior_lo, prior_hi = bounds(18960, 64, predecessor_tariff, Q(256, 255)) + old_lo, old_hi = bounds(32768, 64, predecessor_tariff, Q(256, 255)) + allowance_lo, allowance_hi = (2 * end for end in powers(2, Q(372142, 2**20))) + finer_allowance = 2 * powers(2, Q(372141, 2**20))[1] + reserve = allowance_lo - hi + assert reserve > 0 and lo - finer_allowance > 0 + # The new allowance also fails at #8073's floor 18960 with the 8/L suffix. + assert k_lo > allowance_hi + # Both parent bookings fail the combined allowance. + assert t_lo > allowance_hi and r_lo > allowance_hi and e_lo > allowance_hi and c_lo > allowance_hi + print("ORDINARY_RESERVE", float(reserve), float(lo - finer_allowance), float(k_lo - allowance_hi)) + assert prior_lo > allowance_hi + assert 2 * powers(2, Q(3047, 8192))[0] - prior_hi > Q("0.000062662376093595") + assert prior_lo - 2 * powers(2, Q(6093, 16384))[1] > Q("0.000046832527238212") + assert prior_hi**1024 < 2**1405 < old_lo**1024 + assert old_hi**512 < 2**703 + assert Q(75, 32) / Q(47, 20) == Q(375, 376) + + # #8076: an equal tariff gives unit contraction; 2401/1024 gives sum 2401. + child_volume = Q(75, 32) + old_ratio, new_ratio = child_volume / predecessor_tariff, child_volume / child_tariff + assert new_ratio == Q(2400, 2401) and 1 / (1 - new_ratio) == 2401 + old_sum, new_sum = 1 / (1 - old_ratio), 1 / (1 - new_ratio) + assert old_sum == 376 and old_sum < new_sum < 8 * old_sum + assert 2**16 < (Q(7, 10) * old_sum)**2 < 2**17 + assert 2**21 < (Q(7, 10) * new_sum)**2 < 2**22 + print("PASS_DIRECTED_ORDINARY_DEBIT", 4474, "1420718/1048576", "2400/2401", "(186/25)/L, no 256/255") + print("PASS_CHILD_TARIFF", "2401/1024", "volume<=75/32", "sum=2401", "entry+5", "terminal+9") + + +''' + +EDITS = { + "runtime.patch": ( + ('TERMINAL = Profile((8192, 129414, 524288), 483871, Q(".00389821"))', + 'TERMINAL = Profile((31808, 502922, 7951907, 125730703, 134217727), 208653, Q(".003900857267786"), Q(1, 256))'), + ), + "positive_debit.py": ( + ("from strict_moment import UNIT, power_interval", "from strict_moment import UNIT, power_interval\nfrom unpowered_price import intervals"), + ("POSITIVE_DEBIT = Q(65081, 524288)", "POSITIVE_DEBIT = Q(1039776, 2**23)"), + (OLD_EDGE, DIRECTED_EDGE), + ("assert psi > Q(1790217668064, 10000)", 'assert psi > Q("926190717.2837")'), + ("assert fringe < Q(7579, 1000)", 'assert fringe < Q("7.340806")'), + ), + "receipt.py": ( + ('sys.path.append(str(HERE / "portable"))', 'sys.path.append(str(HERE.parent / "tiered-native-multiplier"))'), + ("from verify_receipt import verify as fixed_installation", "from check_serial_setup import clock as native_clock"), + ("DEBIT = Q(65081, 2**19)", "DEBIT = Q(1039776, 2**23)\nORDINARY_DEBIT = Q(1420718, 2**20)\nCHILD_TARIFF = Q(2401, 1024)"), + ("def tape_factor(ambient, rate):", "def tape_factor(ambient, rate, lower, suffix=64):"), + (" delta, lower = Q(1, 2**128), 32768", " delta = Q(1, 2**128)"), + ("(1 + Q(64, lower) + delta)", "(1 + Q(suffix, lower) + delta)"), + ("assert ordinary.ambient == 134 and ordinary.trial == BINARY_C", + "assert ordinary.ambient == 134 and ordinary.trial == BINARY_C\n" + " assert ordinary.level_floor == 4474"), + ("Q(11, 8 * height)", "ORDINARY_DEBIT / height"), + ("Q(11, 8) / (BINARY_C - TERMINAL.ordinary)", + "ORDINARY_DEBIT / (BINARY_C - TERMINAL.ordinary)"), + (" bound = 128 + 320 * sum(heights)", + " # The complete per-stage envelope grows by <8 (#8076).\n" + " bound = 128 + 3 * len(heights) + 320 * sum(heights)"), + (" bound = 40 + 17 + 16384 * sum(heights) + sum(additions)", + " # Charge the square of the new geometric child sum (#8076).\n" + " bound = 40 + 22 + 16384 * sum(heights) + sum(additions)"), + (" assert (tape_factor(134, BINARY_C) * Q(47, 20)) ** 8 < 2**11", + ' ordinary_upper = Q("2.557796525567700799")\n' + " assert tape_factor(134, BINARY_C, 4474, Q(186, 25)) * Q(255, 256) * CHILD_TARIFF < ordinary_upper\n" + " assert ordinary_upper**1048576 < 2**1420718\n" + " assert Q(75, 32) / CHILD_TARIFF == Q(2400, 2401)"), + ("assert cost == 318259431 and premium == 514", "assert cost == 85945126846 and premium == 121121\n" + " assert early['log2_C'] == 125660246 and late['log2_B'] == 85899221583"), + ("(517430, 483870)", "(134145233, 208653)"), + ('older = Q(".0038982016137")', 'older = Q(".003898219753506")'), + ("assert gain == Q(83863, 10**13)", "assert gain == Q(\".003900857267786\") - Q(\".003898219753506\")"), + (" complete_log2_C=cost,", " complete_log2_C=cost,\n" + " ordinary_floor=4474,\n" + " ordinary_matched_suffix_coefficient=\"186/25\",\n" + " ordinary_finite_debit=str(ORDINARY_DEBIT),\n" + " ordinary_child_tariff=str(CHILD_TARIFF),\n" + ' ordinary_child_contraction="2400/2401",\n' + " ordinary_child_geometric_sum=2401,\n" + " ordinary_entry_clock_extra=5,\n" + " ordinary_terminal_clock_extra=3 * len(TERMINAL.rank_logs),"), + (" setup = fixed_installation()", NATIVE_SETUP), + (''' log2_fixed_setup_upper=setup["trace_exponent"], + log2_portable_setup_guard=setup["conservative_exponent"], + log2_full_store_setup_upper=setup["full_store_trace_exponent"], + portable_setup_transition_upper=setup["transitions"],''', + ''' log2_fixed_setup_upper=setup["setup_exponent"], + native_setup_transition_upper=setup["all_setup"], + native_setup_grade_actions=grade_actions,'''), + ), + "independent_price.py": ( + ("lower = powers(2, Q(65081, 524288))[0]", "lower = powers(2, Q(1039776, 2**23))[0]"), + ('assert lower - upper > Q("0.00012957")', 'assert lower - upper > Q("0.000007887415")'), + ("TERMINAL.kappa - peer == Q(83863, 10**13)", 'TERMINAL.kappa - peer == Q(".003900857267786") - Q(".0038982016137")'), + ("def rounded_peer():", DIRECTED_ORDINARY + "def rounded_peer():"), + (" weighted()\n rounded_peer()", " weighted()\n ordinary_debit()\n rounded_peer()"), + ), +} + + +# Apply exact real-integer frequencies and reprice the full typed calendar. +EDITS["runtime.patch"] += ( + ("+GAUSSIAN_C = Q(17145637167, 2**42)", "+GAUSSIAN_C = Q(17158764376, 2**42)"), +) +EDITS["grades.py"] = (("WEIGHTS = (1, 90)", "WEIGHTS = (5, 451)"),) +EDITS["positive_debit.py"] += ( + ("assert target_axes == 135150528", "assert target_axes == 677246016"), + ("assert 91 / (t * 2**10)", "assert sum((5, 451)) / (t * 2**10)"), +) +EDITS["receipt.py"] += ( + ("def raw_counts(base, multiplicity):", "def raw_counts(base, multiplicity, primary=1):"), + ("t, p = targets.copy(), paid.copy()", + "t = Counter({grade: entry * primary for grade, entry in targets.items()})\n" + " p = Counter({grade: entry * primary for grade, entry in paid.items()})"), + ("p[1] -= 1008\n p[Q(1, 2)] += 2016", + "p[1] -= 1008 * primary\n p[Q(1, 2)] += 2016 * primary"), + ("def total_interval(counts):", "def total_interval(counts, trial=GAUSSIAN_C):"), + ("intervals(grade, 1 - GAUSSIAN_C)", "intervals(grade, 1 - trial)"), + ("WEIGHTS == (1, 90)", "WEIGHTS == (5, 451)"), + ("t, p = raw_counts(base, 90)", "t, p = raw_counts(base, WEIGHTS[1], WEIGHTS[0])"), + ("<= 261", "<= 270"), + (" cuts = {}", + " high = total_interval({k: n for k, n in t.items() if k > 2})\n" + " required = total_interval({r: n for r, n in p.items() if 5 * r > 8})\n" + " assert high[0] - required[1] > 462\n" + " past_targets, past_paid = raw_counts(base, 541, 6)\n" + " assert total_interval(past_targets)[1] < total_interval(past_paid)[0]\n" + " old_tariff = Q(17145637167, 2**42)\n" + " cuts = {\"new\": [str(high[0] - required[1]), str(high[1] - required[0])]}"), + (" cap = total_interval({k: n for k, n in chosen.items() if k > 2})", + " cap = total_interval({k: n for k, n in chosen.items() if k > 2}, old_tariff)"), + (" load = total_interval({r: n for r, n in required.items() if 5 * r > 8})", + " load = total_interval({r: n for r, n in required.items() if 5 * r > 8}, old_tariff)"), + (" net = total_interval(chosen)[0] - total_interval(required)[1]", + " net = total_interval(chosen, old_tariff)[0] - total_interval(required, old_tariff)[1]"), +) +EDITS["independent_price.py"] += ( + ('assert psi > Q("184971191.2157")', 'assert psi > Q("926190717")'), + ('fringe < Q("7.335168")', 'fringe < Q("7.340806")'), +) +EDITS["independent_price.py"] += ( + ("assert (targets.total(), paid.total()) == (105216, 564142)", "assert (targets.total(), paid.total()) == (105216, 563662)"), +) +EDITS["check_placement.py"] = ( + ("assert 90 * (hi - lo) * M * pi > 4", "assert WEIGHTS[1] * (hi - lo) * M * pi > 4"), +) +EDITS["check_exterior.py"] = ( + ("from band_product import production_supplier", "from band_product import production_supplier\nfrom installations import GAUSSIAN_C"), + ("c = Q(17145637167, 2**42)", "c = GAUSSIAN_C"), +) +EDITS["check_nested.py"] = ( + (" * cells[1, 2]\n * 90", " * cells[1, 2]\n * types[0].multiplicity\n * types[1].multiplicity"), + ("share == cells[1, 2] * 90 / t[2]", "share == cells[1, 2] * types[1].multiplicity / t[2]"), + ("and grant.numerator // grant.denominator == 899557645", "and 4_400_000_000 < grant.numerator // grant.denominator < 4_600_000_000"), +) +EDITS["check_ownership.py"] = ( + ("def run(freq, ticks, lower, upper, volume, n, rounds, delay):", + "def run(freq, ticks, lower, upper, volume, n, rounds, delay, primary=1):"), + ("NativeType((2,), (1, 1), 1)", "NativeType((2,), (1, 1), primary)"), + ("(1, 1, 0, 2): Q(1, 2 * freq)", "(1, 1, 0, 2): Q(primary, 2 * freq)"), + ("1 - Q(1, 2 * freq)", "1 - Q(primary, 2 * freq)"), + (" frequency=freq,", " frequency=(primary, freq),"), + ("run(90, 8, 10, 42, 450, 384, 32, 4)]", + "run(90, 8, 10, 42, 450, 384, 32, 4), run(451, 8, 10, 42, 90, 384, 32, 4, primary=5)]"), +) + + +# Keep the reproduced lower edge and widen the actual even upper fence. +EDITS["grades.py"] += ( + ("LOWER = 2048", "LOWER = 1874\nUPPER_DIVISOR = 1724"), + ("2048 * self.ambient", "UPPER_DIVISOR * self.ambient"), +) +EDITS["positive_debit.py"] += ( + ("BAND_LOWER = 2048", "BAND_LOWER = 1874"), + ("from unpowered_price import intervals", "from unpowered_price import intervals\nfrom grades import UPPER_DIVISOR"), + (" upper = 2 * (M // (2048 * recipe.ambient))", + " scale = UPPER_DIVISOR * recipe.ambient // 2\n" + " upper = 2 * (M // (2 * scale))\n" + " assert 4 * max(targets) * (upper - 8) < M and 516 * (upper + 2) < M"), + ("1024 * recipe.ambient * upper", "scale * upper"), + ("Q(4 * max(targets), 1024 * recipe.ambient)", "Q(4 * max(targets), scale)"), + ("power_interval(1024 * recipe.ambient * lower, c)", "power_interval(scale * lower, c)"), + (' "lower_band": lower,', ' "lower_band": lower,\n "upper_divisor": UPPER_DIVISOR,\n "upper_scale": scale,'), + ("assert t > Q(996, 1000) and 11 * t > 10", + "assert t > Q(996, 1000) and power_interval(lower, t)[0] > 1024 * UNIT"), +) +EDITS["receipt.py"] += (("and LOWER == 2048", "and LOWER == 1874"), + # The shortcut word moves #8057's single-weight capacity control. + ("assert cap[1] - load[0] < -1515 and net > Q(3, 100)", "assert cap[1] - load[0] < -960 and net > Q(3, 100)"), +) +EDITS["independent_price.py"] += ( + ("from installations import BINARY_C, TERMINAL", "from installations import BINARY_C, TERMINAL\nfrom grades import LOWER, UPPER_DIVISOR"), + (" upper = (", " scale = UPPER_DIVISOR * recipe.ambient // 2\n upper = ("), + ("Q(4 * 258, 1024 * 306)", "Q(4 * 258, scale)"), + ("powers(1024 * 306 * 2048, c)[1]", "powers(scale * LOWER, c)[1]"), + ("fringe / 2048", "fringe / LOWER"), + (' assert lower - upper > Q("0.000007887415")', + ' assert lower - upper > 0 and lower - upper > Q("0.000000019")\n' + ' assert powers(2, Q(1039775, 2**23))[0] < upper\n' + ' psi_hi = sum(recipe.paid.histogram[r] * share * r * (powers(Q(k,r), c)[1] - 1) / c\n' + ' for (r,k), share in recipe.cells.items())\n' + ' prior_fringe = 10 * axes / ((1-c) * psi_hi)\n' + ' prior_scale = 1024 * recipe.ambient\n' + ' prior_factor = ((1+delta) * (1+Q(4*258,prior_scale)) * powers(prior_scale*LOWER,c)[0]\n' + ' * (1+prior_fringe/LOWER+delta) / (1-delta)**4)\n' + ' assert prior_factor - powers(2, Q(64939,524288))[1] > Q("0.000127791")'), +) +EDITS["check_placement.py"] += ( + ("from grades import numerical_recipe, WEIGHTS", "from grades import numerical_recipe, LOWER, UPPER_DIVISOR, WEIGHTS"), + (" U = 2 * (M // (2048 * 306))", + " scale = UPPER_DIVISOR * recipe.ambient // 2\n" + " assert UPPER_DIVISOR == 1724 and scale == 263772\n" + " U = 2 * (M // (2 * scale))"), + (" assert U < lo < hi < M", " assert LOWER < e < U < lo < hi < M"), + (" assert period == 1620 and tickets == (0, 324, 648) and f.swaps[0] == (1, 324, 1)", + " assert period == 1364 and tickets == (0, 272, 545) and f.swaps[0] == (1, 272, 1)"), +) +EDITS["verify.py"] = ( + ('("check_calendar.py", "check_ownership.py")', + '("check_calendar.py", "check_ownership.py", "check_cutoff.py", "check_stage_seam.py", "check_ordinary_floor.py")'), +) + + +SHORTCUT_FILE = "w5669_shortcut5.json.gz" +SHORTCUT_SHA = "6ef741c346ea075c4f2ed11f9d42d7076103e72d4a9e5059d495f1cb990fd149" +SHORTCUT_PATCH = '--- a/strong_complex.py\n+++ b/strong_complex.py\n@@ -8,6 +8,7 @@\n import json\n \n WORD = "38d2b3a2311a9ba5fee091cc7aa204c7ed95651aec95d75184b2391df090cbfb"\n+SHORTCUT_WORD = "ed3bea7186f962f3a8a8ae389cecce3d1ef48a7a832cf9af6c9048a6b5919b35"\n LAYOUT = "0ce3f9e383fc4bfdd22612b9e34fc9759d97204215937b82d23aec2cedd9b8ee"\n ADDITIONAL = "6ff19e063214b1698165d9da1fcd6182d9b837ac2d6e61aa71658b629aabbc95"\n GRID = 154113755636630124932500335624192000\n@@ -42,7 +43,16 @@\n graph, _ = reconstruct(parent, read("BANK-FACTORS.json.gz"))\n if digest(graph) != WORD or digest(layout) != LAYOUT:\n raise ValueError("The reconstructed Gaussian graph or its owner layout differs")\n- return graph, layout\n+ # Install the five exact chart-3 relay shortcuts on the reconstructed word.\n+ import gzip\n+ shortcut = json.loads(gzip.decompress((Path(__file__).resolve().parent / "w5669_shortcut5.json.gz").read_bytes()))\n+ if digest(shortcut) != SHORTCUT_WORD:\n+ raise ValueError("The shortcut Gaussian graph differs")\n+ if any(shortcut[key] != graph[key] for key in ("initial", "final", "frames", "first_output")):\n+ raise ValueError("The shortcut word changed an endpoint, chart or output")\n+ if (len(graph["moves"]), len(shortcut["moves"])) != (5674, 5669):\n+ raise ValueError("The shortcut word does not remove exactly five transfers")\n+ return shortcut, layout\n \n \n def required_pairs(graph, layout):\n@@ -85,7 +95,7 @@\n \n graph, layout = load_changed(data)\n catalogue = native_catalogue(graph, layout)\n- if digest(catalogue) != "8a9ff9558bf5fa3854699937fe063f98c86467d5d32a4488bfc878d2be081e70":\n+ if digest(catalogue) != "f581128079a67c9fc6341ee96dce772342748f508c77f7d5956bf41408d97f58":\n raise ValueError("The generated all-column Clifford catalogue differs")\n tables = Path(grade) / "retained/data"\n bases = read_json(tables / "CALLER-PHASE-BASES.json")["by_q"]\n' +SHORTCUT_IMAGES = {"before": 'b0f18924be837173ccbbd1b7814a7a9a27228d68ff0dcbaf44a90a2065d0574c', "after": "8f3fb92523df006e2e94505127088aaf2e64fadd20b3cab2344f62d7690e875d"} +EDITS["bootstrap.py"] = ( + ('for name in ("grades.py", "typed_raw.py", "typed_transport.py"):', + 'for name in ("grades.py", "typed_raw.py", "typed_transport.py", "w5669_shortcut5.json.gz"):'), +) + + +def materialize(package): + from pathlib import Path + word = (Path(__file__).resolve().parent / SHORTCUT_FILE).read_bytes() + if sha256(word).hexdigest() != SHORTCUT_SHA: + raise ValueError("The shortcut word archive differs") + (package / SHORTCUT_FILE).write_bytes(word) + for name, replacements in EDITS.items(): + replace(package / name, replacements) + with (package / "runtime.patch").open("a") as patch: + patch.write(RAW_FLOOR_PATCH) + patch.write(SHORTCUT_PATCH) + path = package / "SOURCES.json" + pins = json.loads(path.read_bytes()) + pins["runtime_images"]["installations.py"]["after"] = NEW_INSTALLATION + pins["runtime_images"]["raw_binary_stage.py"] = RAW_FLOOR_IMAGES + pins["runtime_images"]["strong_complex.py"] = SHORTCUT_IMAGES + for name in ("runtime.patch", "grades.py", SHORTCUT_FILE): + pins["local_sources"][name] = sha256((package / name).read_bytes()).hexdigest() + pins["runtime_images"]["grades.py"]["after"] = pins["local_sources"]["grades.py"] + path.write_text(json.dumps(pins, indent=2) + "\n") diff --git a/research/p104-k7-integral-fringe/source/peer8094/verify.py b/research/p104-k7-integral-fringe/source/peer8094/verify.py new file mode 100644 index 0000000000..14c6bf5a25 --- /dev/null +++ b/research/p104-k7-integral-fringe/source/peer8094/verify.py @@ -0,0 +1,83 @@ +"""Restore authenticated public inputs, apply one retune and replay a signed mode.""" +from argparse import ArgumentParser +from hashlib import sha256 +import json +from pathlib import Path +import runpy +from subprocess import run +import sys +import tarfile +from tempfile import TemporaryDirectory + +HERE = Path(__file__).resolve().parent +HEAD = "cbe847a953b971f9c6c5a0a6661e2008acd29086" +SOURCE_SHA = "798c2e6394c258986484a116198cc542a6d2b4c1f289e5816de2cfecf5141c51" + + +def unique_object(pairs): + result = {} + for name, value in pairs: + if name in result: + raise ValueError(f"Repeated source key {name}") + result[name] = value + return result + + +def restore(tree): + source = (HERE / "PEER-SOURCE.json").read_bytes() + if sha256(source).hexdigest() != SOURCE_SHA: + raise ValueError("Peer source manifest differs") + pins = json.loads(source, object_pairs_hook=unique_object) + archive = HERE / "peer8057.tar.gz" + if pins["head"] != HEAD or sha256(archive.read_bytes()).hexdigest() != pins["archive_sha256"]: + raise ValueError("Unexpected source archive") + seen = set() + with tarfile.open(archive) as bundle: + for item in bundle: + path = Path(item.name) + if path.is_absolute() or ".." in path.parts or str(path) != item.name: + raise ValueError(f"Invalid source path {item.name}") + if item.isdir(): + continue + if not item.isfile() or item.name in seen or item.name not in pins["files_sha256"]: + raise ValueError(f"Unexpected or repeated peer file {item.name}") + data = bundle.extractfile(item).read() + if sha256(data).hexdigest() != pins["files_sha256"][item.name]: + raise ValueError(f"Source differs at {item.name}") + destination = tree / path + destination.parent.mkdir(parents=True, exist_ok=True) + destination.write_bytes(data) + seen.add(item.name) + if seen != pins["files_sha256"].keys(): + raise ValueError("Source archive is missing a file") + return tree / "research" / "frequency-weighted-native-multiplier" + + +def main(): + modes = ("price", "calendar", "raw", "exterior", "nested", "product", "setup", "regenerate") + parser = ArgumentParser(description=__doc__) + parser.add_argument("mode", choices=modes) + args = parser.parse_args() + with TemporaryDirectory(prefix="k7-shortcut-eta27-5stage-") as temporary: + tree = Path(temporary) + peer = restore(tree) + runpy.run_path(str(HERE / "prepare.py"))["materialize"](peer) + for name in ("check_cutoff.py", "check_stage_seam.py", "check_ordinary_floor.py"): + (peer / name).write_bytes((HERE / name).read_bytes()) + if args.mode == "regenerate": + runtime = tree / "runtime" + run([sys.executable, "-IB", str(peer / "bootstrap.py"), str(runtime)], check=True) + result = run([sys.executable, "-IB", str(peer / "receipt.py"), str(runtime)], check=True, capture_output=True, text=True) + print(json.dumps(json.loads(result.stdout), indent=2)) + return + if args.mode == "setup": + serial = peer.parent / "tiered-native-multiplier" / "check_serial_setup.py" + run([sys.executable, "-IB", str(serial)], check=True) + else: + (peer / "RESULT.json").write_bytes((HERE / "RESULT.json").read_bytes()) + run([sys.executable, "-IB", str(peer / "verify.py"), args.mode], check=True) + print("PASS_SHORTCUT_WORD_ETA_27BIT_5STAGE", args.mode, flush=True) + + +if __name__ == "__main__": + main() diff --git a/research/p104-k7-integral-fringe/source/peer8094/w5669_shortcut5.json.gz b/research/p104-k7-integral-fringe/source/peer8094/w5669_shortcut5.json.gz new file mode 100644 index 0000000000..2381d62342 Binary files /dev/null and b/research/p104-k7-integral-fringe/source/peer8094/w5669_shortcut5.json.gz differ diff --git a/research/p104-k7-integral-fringe/verify.py b/research/p104-k7-integral-fringe/verify.py new file mode 100644 index 0000000000..bc5601b512 --- /dev/null +++ b/research/p104-k7-integral-fringe/verify.py @@ -0,0 +1,144 @@ +"""Replay the integral-fringe construction from the packaged immutable source.""" + +from argparse import ArgumentParser +from hashlib import sha256 +import json +import os +from pathlib import Path, PurePosixPath +from shutil import copyfile, disk_usage +from subprocess import PIPE, run +import sys +from tempfile import TemporaryDirectory, gettempdir + + +HERE = Path(__file__).resolve().parent +SOURCES = HERE / "source" +HANDOFF = SOURCES / "paired-768" +PERIOD = HANDOFF / "r420/overlay" +FRINGE = HANDOFF / "r428" +WEIGHTED = Path("research/frequency-weighted-native-multiplier") +SCIENTIFIC = ("price", "calendar", "raw", "exterior", "nested", "product") +INPUTS_SHA256 = "36de89cde22bb3fbf6389bba09d9a0855d27a1707e27e41207e5c490dfe58a51" +IMAGE_SHA256 = "6dc565fad3b91bcb43ff71397897afcc54fd5f9d595a8f88b91234994d8e70be" +RESERVE = 8 * 1024**3 +THREAD_ENV = dict.fromkeys(("OMP_NUM_THREADS", "OPENBLAS_NUM_THREADS", "MKL_NUM_THREADS", + "VECLIB_MAXIMUM_THREADS", "BLIS_NUM_THREADS", "NUMEXPR_NUM_THREADS"), "1") + + +def unique_object(pairs): + result = {} + for key, value in pairs: + if key in result: + raise ValueError(f"Duplicate input key {key!r}") + result[key] = value + return result + + +def read_json(data): + return json.loads(data, object_pairs_hook=unique_object) + + +def authenticate(): + data = (HERE / "INPUTS.json").read_bytes() + if sha256(data).hexdigest() != INPUTS_SHA256: + raise ValueError("Unexpected pinned input manifest") + manifest = read_json(data) + if manifest["schema_version"] != 1: + raise ValueError("Unexpected input manifest schema") + files = manifest["files"] + actual_sources = {p.relative_to(HERE).as_posix() for p in SOURCES.rglob("*") + if p.is_file() or p.is_symlink()} + if actual_sources != set(files) - {"RESULT.json", "LICENSE"}: + raise ValueError("Packaged source inventory differs") + for name, pin in files.items(): + relative = PurePosixPath(name) + if relative.as_posix() != name or relative.is_absolute() or ".." in relative.parts: + raise ValueError(f"Unexpected input path {name!r}") + path = HERE / name + if not path.is_file() or path.resolve(strict=True) != path: + raise ValueError(f"Not a regular source input {name!r}") + content = path.read_bytes() + if len(content) != pin["size"] or sha256(content).hexdigest() != pin["sha256"]: + raise ValueError(f"Unexpected packaged bytes at {name!r}") + return files + + +def reserve(scratch): + if min(disk_usage(HERE).free, disk_usage(scratch).free) < RESERVE: + raise RuntimeError("The 8 GiB native replay reserve is unavailable") + + +def python(path, *args, env, capture=False): + reserve(Path(env["TMPDIR"])) + return run([sys.executable, "-IB", str(path), *map(str, args)], check=True, text=True, + env=env, stdout=PIPE if capture else None).stdout + + +def prepare(scratch, env): + frozen = scratch / "period" + observed = python(PERIOD / "assemble.py", "--package-root", SOURCES / "peer8094", + "--output", frozen, env=env, capture=True) + if read_json(observed) != read_json((PERIOD / "ASSEMBLY.json").read_bytes()): + raise ValueError("The independently assembled predecessor differs from its pin") + destination = scratch / "fringe" + observed = python(FRINGE / "assemble.py", "--frozen", frozen, "--output", destination, + env=env, capture=True) + expected = read_json((FRINGE / "ASSEMBLY.json").read_bytes()) + if any(read_json(data) != expected for data in ( + observed, (destination / "FRINGE-ASSEMBLY.json").read_bytes() + )): + raise ValueError("The independently assembled integral-fringe source differs from its pin") + return destination / WEIGHTED + + +def install(peer, runtime, env): + python(peer / "bootstrap.py", runtime, env=env) + if sha256((runtime / "installations.py").read_bytes()).hexdigest() != IMAGE_SHA256: + raise ValueError("The installed source image differs from its pin") + + +def native(peer, runtime, scratch, env): + python(HANDOFF / "r417/physical/check.py", "--runtime", runtime, "--relay-receipt", + HANDOFF / "r416/signed/RECEIPT.json", env=env) + for kind in (0, 1): + python(HANDOFF / "r418/typed/check.py", "--runtime", runtime, "--kind", kind, + "--oracle", HANDOFF / "r418/oracle/RECEIPT.json", env=env) + setup = scratch / "setup" + setup.mkdir() + python(FRINGE / "check_setup.py", "--handoff-root", HANDOFF, "--runtime", runtime, + "--portable", peer / "portable", "--scratch", setup, env=env) + + +def main(): + if sys.version_info[:2] != (3, 12) or not __debug__: + raise RuntimeError("Use CPython 3.12 with assertions enabled") + parser = ArgumentParser(description=__doc__) + parser.add_argument("mode", choices=("inputs", *SCIENTIFIC, "native", "regenerate")) + mode = parser.parse_args().mode + inputs = authenticate() + if mode == "inputs": + for name in inputs: + if name.endswith(".py"): + compile((HERE / name).read_bytes(), name, "exec") + print(f"PASS_INTEGRAL_FRINGE_INPUTS {len(inputs)}") + return + reserve(Path(gettempdir())) + with TemporaryDirectory(prefix="p104-k7-integral-fringe-") as temporary: + scratch = Path(temporary).resolve() + env = dict(os.environ, **THREAD_ENV, TMPDIR=str(scratch)) + peer = prepare(scratch, env) + if mode in SCIENTIFIC: + copyfile(HERE / "RESULT.json", peer / "RESULT.json") + python(peer / "verify.py", mode, env=env) + else: + runtime = scratch / "runtime" + install(peer, runtime, env) + if mode == "regenerate": + python(peer / "receipt.py", runtime, env=env) + return + native(peer, runtime, scratch, env) + print(f"PASS_INTEGRAL_FRINGE_SCOPE {mode}") + + +if __name__ == "__main__": + main()