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-six-stage-resolution/BRIDGE.json b/research/p104-six-stage-resolution/BRIDGE.json new file mode 100644 index 0000000000..4351b8b42d --- /dev/null +++ b/research/p104-six-stage-resolution/BRIDGE.json @@ -0,0 +1,153 @@ +{ + "finite_controls": { + "rank_cases": 129, + "sample_rank_cases": { + "0": [ + 1, + 11, + 60 + ], + "1": [ + 2, + 25, + 120 + ], + "16": [ + 17, + 386, + 2380 + ], + "64": [ + 65, + 1498, + 11700 + ], + "128": [ + 129, + 2974, + 25800 + ] + }, + "stop_cases_d_2_to_18": 289, + "D": 1000000000000000000000, + "D_bits": 70, + "D_set_bits": 29, + "max_products": 98, + "large_D_controls": [ + { + "base": 1, + "h_bits": 65, + "result": true, + "products": 98, + "max_temporary_bits": 1 + }, + { + "base": 2, + "h_bits": 4097, + "result": false, + "products": 22, + "max_temporary_bits": 8193 + }, + { + "base": 17, + "h_bits": 257, + "result": false, + "products": 22, + "max_temporary_bits": 513 + }, + { + "base": 2, + "h_bits": 2, + "result": false, + "products": 22, + "max_temporary_bits": 4 + } + ], + "nested_epoch": [ + 323, + 128, + 1456, + 8481, + 654, + 271392, + 271392 + ] + }, + "exact_guards": { + "v": 430, + "minimum_target_witness": "15^430", + "maximum_paid_witness": "12^430", + "all_15_labels": 444, + "largest_actual_G_strict_lower": 2381395348837209302317, + "ranks": [ + { + "H": 1000000000000000000000, + "H_bits": 70, + "G_plus_1_upper": 7558139534883720933, + "G_bound_bits": 63, + "quotient_log": 2007830539102499749086, + "old_quotient_understatement": 40313025320292731, + "binary_rank_writer_transitions_upper": 1440000000000000000001440 + }, + { + "H": 4000000000000000000000, + "H_bits": 72, + "G_plus_1_upper": 30232558139534883723, + "G_bound_bits": 65, + "quotient_log": 8031322156409998996149, + "old_quotient_understatement": 161252101281170923, + "binary_rank_writer_transitions_upper": 5920000000000000000001480 + }, + { + "H": 16000000000000000000000, + "H_bits": 74, + "G_plus_1_upper": 120930232558139534886, + "G_bound_bits": 67, + "quotient_log": 32125288625639995984404, + "old_quotient_understatement": 645008405124683693, + "binary_rank_writer_transitions_upper": 24320000000000000000001520 + }, + { + "H": 64000000000000000000000, + "H_bits": 76, + "G_plus_1_upper": 483720930232558139537, + "G_bound_bits": 69, + "quotient_log": 128501154502559983937420, + "old_quotient_understatement": 2580033620498734769, + "binary_rank_writer_transitions_upper": 99840000000000000000001560 + }, + { + "H": 256000000000000000000000, + "H_bits": 78, + "G_plus_1_upper": 1934883720930232558142, + "G_bound_bits": 71, + "quotient_log": 514004618010239935749487, + "old_quotient_understatement": 10320134481994939078, + "binary_rank_writer_transitions_upper": 409600000000000000000001600 + }, + { + "H": 1024000000000000000000000, + "H_bits": 80, + "G_plus_1_upper": 7739534883720930232561, + "G_bound_bits": 73, + "quotient_log": 2056018472040959742997756, + "old_quotient_understatement": 41280537927979756315, + "binary_rank_writer_transitions_upper": 1679360000000000000000001640 + } + ], + "nodes_log_upper": 12973, + "slot_log_upper": 26038, + "local_log_upper": 53044, + "qnative": 65536 + }, + "signed_guards": { + "common_denominator": 1000000000000000000000000000000000000000000, + "common_denominator_bits": 140, + "kappa_numerator_over_D": 3890115286594445000, + "ordinary_numerator_over_D": 3890115286594445005, + "strict": 54, + "functional": 4, + "min_margin": "1/10000000000000000000000", + "max_scaled_numerator_bits": 181 + } +} diff --git a/research/p104-six-stage-resolution/BRIDGE.md b/research/p104-six-stage-resolution/BRIDGE.md new file mode 100644 index 0000000000..ffdce10381 --- /dev/null +++ b/research/p104-six-stage-resolution/BRIDGE.md @@ -0,0 +1,72 @@ +# Finite-tape bridge for the six-stage last-tick profile + +## Decision and scope + +For the newly chosen constants, the operations **that this note lowers**—fixed-rank integer generation, powered-label and epoch indexing, sequential image navigation, and the positive stopping comparator—do not require an additional mathematical oracle or an extra unbounded-word instruction. A serial fixed-alphabet multitape machine can carry them out with the charges below. This statement is conditional on the same all-column native action, typed owner/erasure and restoration, compiler transfer, precision/tape accounting, and analytic recovery premises identified in [#8035](https://github.com/CrocSwap/integer-mult-bounds/pull/8035). It does **not** prove those premises, the entire physical multiplier, or uniform transfer of an arbitrary compiler. A concrete finite-parameter recheck is not a proof for arbitrary future powers or ranks. + +The literal Python program is **not** an all-size implementation on this host. With its actual rank, `ordinary_carrier.stage_body` evaluates `1 << H` and `prepare_native` also evaluates `1 << log_rank`. Here `1 << 10**21` raises `OverflowError: too many digits in integer`. Near the host limit another oversized shift raised `MemoryError`; the exact exception need not be uniform. `len(range(sys.maxsize+1))` raises `OverflowError`, and a `TemporaryFile.seek` beyond `sys.maxsize` raised `ValueError` on this host. The Python finite controls exercise the same algorithms at feasible scales; they do not execute production. + +There are further obstructions even if the first shift is replaced. The inherited `SourceRule.targets` and `.paid` are eager Python tuples. The source has 444 target labels of rank 15, so at least 444^430 distinct retained target paths exist. This is greater than 2^3440 and vastly exceeds `sys.maxsize`; it cannot be a Python tuple. The abstract tape implementation must enumerate the occurrences and pay for the corresponding data. It must also replace growing Python lists, dictionaries, frames and offsets with serially searched, delimited tapes. A fixed alphabet means finitely many symbols and a fixed number of physical tape heads, not finitely many occupied cells. + +## Construct the actual fixed integers + +Write H in ordinary binary as a constant in the finite program. The largest H here is `1024000000000000000000000`, whose encoding has 80 bits. Use a separate counter tape holding H least-significant-bit first and an output tape. Write `1`, then repeatedly test/decrement the counter and append `0`. This emits the binary integer N=2^H as exactly H+1 digits. A zero test and decrement each scan at most the counter and return to its marked beginning. If k is the length of the input encoding, the concrete routine in `check_bridge.py` uses at most + + 20 (H+1) (k+2) + +read, write and single-cell head-move steps and H+O(k) cells. To see the bound for every H, a zero test scans at most k digits and returns, and a decrement flips at most k digits and returns. Including the output write, one iteration costs at most `9k+16` elementary tape actions; the final failed test and initialization cost at most `4k+7`. Their sum is bounded by the display. At the largest H the upper bound is `1679360000000000000000001640` steps, a 91-bit integer, and is <2^H=N. This is a mathematical finite tape, not a statement about attainable hardware. The 129-case toy replay writes the true binary strings for H=0,...,128 and counts every read, write and movement. + +An H+1 digit encoding of N is not a stock of N axes. Where the reference constructs `tuple(range(N))`, a tape implementation must actually enumerate N indices. An H+1 digit odometer, appending each fixed-width index, takes O(N(H+1)^2) transitions and O(N(H+1)) cells on sequential tapes; these are below N^3 and N^2 respectively for the present large H. It cannot charge such an N-item construction as O(H). Actual whole-field payload movement is separate from this control cost. Use delimited records and explicit tags for signs, lengths, IDs and owners; an integer is data, never a fixed-width machine register or one unit-cost word. + +## v=430 installer and actual forest depth + +Let A=134^430, let the minimum retained target rank be 15^430, and cap paid blocks at 12^430. The exact source contains rank-15 target labels and rank-56 paid labels. Consequently the first minimum and the maximum paid block are actually attained: the loop's ratio is `(5/4)^430`. Let G be its least integer with `(5/4)^(430G) > 2^H/(4A)`. Because A<2^(8*430) and `(5/4)^430<2^430`, + + G > floor((H-2-8*430)/430). + +At the largest H this lower bound is `2381395348837209302317`, over 258 times this host's `sys.maxsize`. The old `G < 2^50` assertion is therefore false, not merely unsupported by a coarse new upper bound. Real path stacks, odometers and suspended frames must reside on tape; growing Python sequence lengths and recursion cannot implement this instance. + +For the upper bound, `(5/4)^13 > 2^4` yields + + G+1 <= ceil(13H/(4*430)) + 2. + +At largest H the right side is `7739534883720930232561`, with 73 binary digits. The exact powered source census gives + + 18906^430 + 104904^430 + 23800^430 < 2^(18*430). + +For H>=512*430, enumeration of every candidate, including rejects and split paid occurrences, gives `(W+P#)^G < N^[18(13/4+1/512)] < N^60`. The physical source's raw record bound `2^64*(v+1)*2^(28v)= 2H+64` and `Q<3H<8H`. At Hmax, Q is `2056018472040959742997756`. The hardcoded predecessor helper is smaller by `41280537927979756315`. The old helper is used by the predecessor's receipt, not by this profile's `ordinary_carrier.stage_body`; the candidate's last-tick checker computes Q separately using the actual eta. This prevents mistaking a bad proof threshold for a demonstrated runtime dispatch bug. + +## Stopping parameter and explicit comparator charge + +For the positive caller, g=1/D and D=10^21 are constants of this particular finite machine. Their common rational encodings, signed gate coefficients and denominator are stored as finite binary data. At this D, `kappa*D=3890115286594445000` and `ordinary*D=3890115286594445005`. The 54 strict margins, four functional margins and the positive paid margin in the pinned gate all have denominators dividing D^2, which has 140 bits. Their exact scaled numerators use at most 181 bits; the least margin is 1/(10D). The replay checks those properties. + +The fixed gate can be evaluated by keeping a common D^2 denominator. Form products of the few base D-denominator parameters first, then use signed additions and exact fixed-denominator divisions; the other products are by fixed small rationals. No expression multiplies two separately formed D^2-denominator quantities. Even the 2^45-7^16 constant, after scaling by D^2, has fewer than 186 bits. This gives a concrete fixed straight-line evaluation with fewer than 10000 integer operations on at most 256-bit working values. Applying the inherited 2^20(b+1)^3 schoolbook bound, with rewinds and initialization, costs less than 2^60 tape transitions and fewer than 2^23 retained work cells. This charges **the fixed gate calculation**, not the input-dependent signed multiplication or its recovery. + +In an active `Positive._run`, the original root has selected width h and the current width e satisfies 0<=e<=h. It stops when e<=M or e^D<=h. If the latter test runs, repeated squaring uses D's 70 bits and 29 one-bits: at most 69 squarings and 29 selected multiplications, 98 products total. The algorithm rejects as soon as its running value exceeds h; it caps each squared base at h+1. Before an early rejection every operand is <=h+1 and every actual, not-yet-capped product is <=(h+1)^2. It does not materialize e^D. + +Let L=ceil(log2(h+2)). The predecessor's sequential schoolbook arithmetic estimate is 2^20(b+1)^3 transitions for b-bit operands and its elementary comparisons. Charging that conservatively to every one of the 98 products, their 2L+2-bit temporaries, comparisons, counter handling and cleanup gives at most `2^32*(L+2)^3` transitions and O(L+70) work cells for **one test**. With epsilon=10^-23 and x=h+2, calculus and ln 2>1/2 imply + + 2^32 (L+2)^3 <= 2^277 x^epsilon. + +Indeed `(1+log2 x)^3 / x^epsilon <= (1+6/epsilon)^3 < 2^240`, and `L+2 <= 3(1+log2 x)`. The checked strict gate minimum for this profile is 10^-22, so this exponent is one-tenth of that minimum. This shows a concrete possible allocation for the new per-test logarithms; it does not automatically pay other growing work or permit the same slack to be spent twice. The number of tests, positive recurrence, remaining finite list of logarithmic charges, tape movement and signed recovery still depend on the inherited estimates. [#8035's proof](https://github.com/Clear1nsight/integer-mult-bounds/blob/ea776471bf8ed143a0625cf2d7532f65d15eb5f9/research/p104-single-band-signed-margin/PROOF.md) states its stopping proof for every fixed integer D>=2; replacing D=10^17 by 10^21 increases the fixed bit-loop factor and changes the actual stopping condition, and the signed inequalities must be rechecked, as the last-tick receipt does. + +## Replay and limits + +From this package, `python3.12 -I -B verify.py price` reconstructs the pinned source privately and passes its path to `check_bridge.py` and `check_dispatch.py`. To call either helper directly, supply an already reconstructed source directory as its sole argument. The bridge test checks exact production-height integer inequalities without forming any 2^H, compares small stopping boundaries against both direct integer powering and the source comparator, exercises D=10^21 on finite inputs, constructs and counts 129 concrete rank tapes, and invokes the physical nested-epoch test. `BRIDGE.json` is the sealed receipt. The nested test used rank 323, 128 lanes, 1456 records and an 8481-byte image; one parent resumed at saved offset 654, with 271392 total bytes read and 271392 units of seek distance. These controls do not run the production epoch. + +The separately produced `check_last_product.py` receipt uses `physical_product(LAST_TICK)` and passed with product -345550037539, 138 shuttles and 157248 H calls. It passes the requested profile to `Product`, but that product has `machine.total=32`: every H dispatch therefore uses the `total<=4096` local `RetainedProduct.h` branch. It does not execute the candidate's positive supplier or stopping parameter. Its finite staged receiver has rank 2. It is evidence about that small signed instance, not production-size execution. + +`check_dispatch.py` additionally verifies the real `Product.h` forwards `(rank_log, denominator)=(1600000, 10^21)` to its supplier factory, with the factory and outer H body replaced by spies. It exercises the real `band_positive.Positive._run` stop branch at e=3, carrier 2: D=3 stops at h=27 and continues at h=26; D=10^21 continues at finite h=2^4096. It replaces `one_axis` with a recorder and stops before reaching the supplier. This improves branch-binding evidence but does not execute the production positive word or produce an astronomical stopped case. Retain the full five inherited premises and open all-size/compiler mapping when reporting the conditional numerical result. diff --git a/research/p104-six-stage-resolution/CANDIDATE-OVERLAY.json b/research/p104-six-stage-resolution/CANDIDATE-OVERLAY.json new file mode 100644 index 0000000000..b94e94d182 --- /dev/null +++ b/research/p104-six-stage-resolution/CANDIDATE-OVERLAY.json @@ -0,0 +1,17 @@ +{ + "calibration.py": { + "new_sha256": "c2bc0311586e55ec1c58eb24147d1734f6bcd7aa999b585caaeed156276a3bbc", + "new_text": "\"\"\"Set the physical ranks and check their complete price with rational arithmetic.\"\"\"\n\nfrom dataclasses import dataclass, replace\nfrom fractions import Fraction\n\nfrom upstream import install\n\ninstall()\nfrom staged_carriers import entrance_logs\n\nCOMPLEX_POWER = 128\nCOMPLEX_FLOOR = 1 << 15\nCOMPLEX_C = Fraction(2043, 524288)\nGAP = Fraction(1, 10**14)\nSETUP_DEGREE = 1024\n\n\n@dataclass(frozen=True)\nclass Profile:\n rank_logs: tuple\n complex_log: int\n power: int\n floor: int\n bit_c: Fraction\n eta: Fraction\n ordinary: Fraction\n kappa: Fraction\n positive_stop_denominator: int = 10**14\n\n\nCOMPACT = Profile(\n (260_000, 1_600_000),\n 610_000,\n 128,\n 1 << 15,\n Fraction(2039, 524288),\n Fraction(97, 25_000),\n Fraction(\"0.003879928035646\"),\n Fraction(\"0.00387992803556\"),\n)\nHIGH_RATE = Profile(\n (25_000_000, 160_000_000, 1_000_000_000, 6_000_000_000, 36_000_000_000, 224_000_000_000),\n 1_600_000,\n 228,\n 1 << 35,\n Fraction(17108907955, 2**42),\n Fraction(39, 10_000),\n Fraction(\"0.003890115197377\"),\n Fraction(\"0.00389011519729\"),\n)\nPRICE_MATCH = replace(\n HIGH_RATE,\n rank_logs=tuple(7 * h for h in HIGH_RATE.rank_logs),\n ordinary=Fraction(\"0.003890115271496\"),\n kappa=Fraction(\"0.00389011527141\"),\n)\nSPLIT_TARIFF = replace(\n HIGH_RATE,\n rank_logs=(106_811_524, 1_708_984_375, 27_343_750_000,\n 437_500_000_000, 7_000_000_000_000, 112_000_000_000_000),\n power=268,\n floor=1 << 50,\n bit_c=Fraction(280312348082011, 2**56),\n ordinary=Fraction(\"0.0038901152863925\"),\n kappa=Fraction(\"0.003890115286352\"),\n)\nSPLIT_TILT = Fraction(593, 2048)\nPRODUCTIVE_TILT = Fraction(491, 1024)\nSPLIT_WEIGHT = Fraction(1, 64)\nFIXED_STOCK = replace(SPLIT_TARIFF, kappa=Fraction(\"0.0038901152863924\"),\n positive_stop_denominator=10**17)\nSMALL_GAP = replace(FIXED_STOCK,\n rank_logs=tuple(64*height for height in FIXED_STOCK.rank_logs),\n power=285,\n floor=1 << 47,\n bit_c=Fraction(280312348082137, 2**56),\n ordinary=Fraction(\"0.00389011528659083\"),\n kappa=Fraction(\"0.0038901152865907\"),\n)\nNEAR_RAW = replace(FIXED_STOCK,\n rank_logs=tuple((1 << 16)*height for height in FIXED_STOCK.rank_logs),\n power=384,\n floor=1 << 52,\n bit_c=Fraction(1148159377744532071, 2**68),\n ordinary=Fraction(\"0.003890115286594432\"),\n kappa=Fraction(\"0.00389011528659443\"),\n positive_stop_denominator=10**20,\n)\nPROFILES = {\"compact\": COMPACT, \"high-rate\": HIGH_RATE, \"price-match\": PRICE_MATCH,\n \"split-tariff\": SPLIT_TARIFF, \"fixed-stock-stop\": FIXED_STOCK, \"small-gap\": SMALL_GAP,\n \"near-raw\": NEAR_RAW}\n\n\ndef debit(ambient, largest_target, power, c, floor, outer_bits):\n # The dyadic carrier needs no final axes. The paid replication factor is below 9/4.\n assert 32 * floor * 4 < 9 * 15 * (floor - 2)\n assert 9**4 < 2**5 * 4**4\n scale = 4 * (ambient * largest_target) ** power * floor\n upper = Fraction(5, 4) + c * (scale - 1).bit_length() + outer_bits\n return -(-upper.numerator // upper.denominator)\n\n\ndef split_tariff_debit(profile):\n floor = profile.floor\n scale = 4 * (134 * 127) ** profile.power * floor\n assert Fraction(1024 * floor, 15 * (floor - 2)) < 69\n assert 69**100 < 2**611\n bound = Fraction(611, 100) + profile.bit_c * (scale - 1).bit_length()\n return -(-bound.numerator // bound.denominator)\n\n\ndef prices(profile):\n bit_loss = (split_tariff_debit(profile) if profile.power in (SPLIT_TARIFF.power, SMALL_GAP.power)\n else debit(134, 127, profile.power, profile.bit_c, profile.floor, 5))\n numeric_loss = debit(153, 129, COMPLEX_POWER, COMPLEX_C, COMPLEX_FLOOR, 1)\n result = []\n previous = Fraction(0)\n for i, height in enumerate(profile.rank_logs):\n covered = profile.bit_c - Fraction(bit_loss, height)\n limit = min((249 * covered + previous) / 250, profile.eta)\n rate = (\n profile.ordinary\n if i == len(profile.rank_logs) - 1\n else Fraction(int(limit * 10**18) - 1, 10**18)\n )\n if not previous < rate < limit:\n raise ArithmeticError(\"An ordinary stage has insufficient strict price headroom\")\n result.append((height, covered, rate))\n previous = rate\n gap = Fraction(1, profile.positive_stop_denominator)\n if not (\n 0 < gap <= GAP\n and profile.kappa + 4 * gap < profile.ordinary\n and profile.kappa + 5 * gap < COMPLEX_C - Fraction(numeric_loss, profile.complex_log)\n ):\n raise ArithmeticError(\"The numerical consumer cannot receive these prices\")\n return bit_loss, numeric_loss, result\n\n\ndef entrance(profile):\n from linear_geometry import connected_exponent\n\n return connected_exponent(entrance_logs(profile.rank_logs)[-1], profile.complex_log)\n", + "old_sha256": "444f185c619ef01bdea6328af3dc7ba30014b5cfebe7d1de875966e656fd57ff" + }, + "strict_moment.py": { + "new_sha256": "b6ff0c51047b5e79ae08509c19a59b11de6f296dd3f78136ada6d564c7516c16", + "new_text": "\"\"\"Bound the two powered moments from all the actual labelled port ranks.\"\"\"\n\nfrom collections import Counter\nfrom fractions import Fraction\nfrom math import isqrt\n\nfrom calibration import COMPLEX_C, COMPLEX_POWER, NEAR_RAW, PRODUCTIVE_TILT, SMALL_GAP, SPLIT_TARIFF, SPLIT_TILT, SPLIT_WEIGHT\n\nUNIT = 1 << 112\n\n\ndef ceiling(a, b):\n return -(-a // b)\n\n\ndef power_interval(rank, exponent):\n \"\"\"Return outward integer bounds in units of 2^-112 for a dyadic power.\"\"\"\n k, d = exponent.numerator, exponent.denominator\n if rank <= 0 or k < 0 or d & (d - 1):\n raise ValueError(\"Use positive ranks and nonnegative dyadic powers\")\n whole, residue = divmod(k, d)\n low = high = rank**whole * UNIT\n lo_root = hi_root = rank * UNIT\n while d > 1:\n d //= 2\n lo_root = isqrt(lo_root * UNIT)\n hi_root = 1 + isqrt(hi_root * UNIT - 1)\n if residue & d:\n low = low * lo_root // UNIT\n high = ceiling(high * hi_root, UNIT)\n return low, high\n\n\ndef moment(hist, exponent, upper):\n return sum(count * power_interval(rank, exponent)[upper] for rank, count in hist.items())\n\n\ndef certify(word, c, tilt, drop, power, slack_bits, cutoff, *, split_weight=2):\n if (word.power, word.floor, word.low_cut, word.high_cut) != (power, cutoff, 12, 12):\n raise ValueError(\"The evaluated strictifier differs from the installed one\")\n targets = Counter(p.rank for p in word.targets)\n paid = Counter(p.rank for p in word.paid)\n t = 1 - c\n lower = moment(targets, t, False)\n alpha = Fraction(moment(paid, t, True), lower)\n gamma = Fraction(moment(paid, t + tilt, True) * UNIT, lower * power_interval(12, tilt)[0])\n loss = Fraction(moment(targets, t - drop, True) * power_interval(cutoff, drop)[1], lower * UNIT)\n if split_weight != 2:\n # For x >= 1, (2x)^c - 1 <= (101/100)c x^tilt / tilt.\n assert 0 < c < Fraction(1, 250) and c <= tilt <= 1\n assert Fraction(101, 100)**250 > 2\n assert Fraction(101, 100) * c / tilt < split_weight\n deficit = 1 - alpha**power - split_weight * gamma**power - loss**power\n if not (tilt >= c and deficit > Fraction(1, 1 << slack_bits)):\n raise ArithmeticError(\"The strict local surplus cannot pay all physical fringe axes\")\n return {\n \"raw_productive\": sum(targets.values()),\n \"raw_paid\": sum(paid.values()),\n \"productive\": dict(sorted(targets.items())),\n \"paid\": dict(sorted(paid.items())),\n \"surplus_lower_units_1e12\": int(10**12 * deficit),\n }\n\n\ndef both(binary, positive, profile):\n if profile.power == NEAR_RAW.power:\n return (\n certify(binary, profile.bit_c, SPLIT_TILT, PRODUCTIVE_TILT,\n profile.power, profile.floor.bit_length() - 2, 15),\n certify(positive, COMPLEX_C, Fraction(19, 64), Fraction(23, 64), COMPLEX_POWER, 14, 16),\n )\n if profile.power in (SPLIT_TARIFF.power, SMALL_GAP.power):\n return (\n certify(binary, profile.bit_c, SPLIT_TILT, PRODUCTIVE_TILT,\n profile.power, profile.floor.bit_length() - 2, 15, split_weight=SPLIT_WEIGHT),\n certify(positive, COMPLEX_C, Fraction(19, 64), Fraction(23, 64), COMPLEX_POWER, 14, 16),\n )\n return (\n certify(\n binary,\n profile.bit_c,\n Fraction(19, 64),\n Fraction(31 if profile.power == 228 else 26, 64),\n profile.power,\n profile.floor.bit_length() - 2,\n 15 if profile.power == 228 else 16,\n ),\n certify(positive, COMPLEX_C, Fraction(19, 64), Fraction(23, 64), COMPLEX_POWER, 14, 16),\n )\n", + "old_sha256": "f13c79ed45ce41c67a3f47c1767601be032ae65a908b9ee3a80643b0ac08689a" + }, + "strong_binary.py": { + "new_sha256": "fa6f496389e58d0fc53b6c88f922dbdeb981e677ad1cb160dd26a45b6247b09d", + "new_text": "\"\"\"Run the 111-port binary source on the retained physical bank machine.\n\nThe catalogue initialization and the outer 36-call interpreter use the\nconstruction of PR 7914. The inner MOVE, ADD, SWAP, INIT and CLEAR interpreter\nand the complete chart constructors come from that package.\n\"\"\"\n\nfrom functools import cache\nfrom hashlib import sha256\nfrom pathlib import Path\n\nfrom factored_frames import inverse_word\nfrom powered import PoweredWord\nfrom raw_binary import BinarySource, Catalogue, job_frame, placed_job\nfrom tagged_sources import BIT_CALLER, BIT_PIN, binary_ports, packed, pinned\n\n\nSOURCE_SHA256 = \"74e93daf2b7acf794ffb51f92f03f51556f68126d41ee13a8969bddb4cbe6326\"\n\n\n@cache\ndef graph():\n data = Path(__file__).with_name(\"strong-bit.json.gz\").read_bytes()\n if sha256(data).hexdigest() != SOURCE_SHA256:\n raise ValueError(\"The 111-port binary source differs\")\n return packed(data)\n\n\n@cache\ndef caller():\n return packed(pinned(BIT_CALLER, BIT_PIN))\n\n\n@cache\ndef native_word(power=128):\n if power not in (128, 228, 268, 285, 384):\n raise ValueError(\"Select a certified binary power\")\n raw = binary_ports(graph(), caller())\n floor = 16 if power == 128 else 15\n return PoweredWord(raw.ambient, raw.targets, raw.paid, power, floor, 12, 12)\n\n\nclass ActiveCatalogue(Catalogue):\n def __init__(self, dimension, columns):\n self.dimension = dimension\n self.columns = columns\n self.graph = graph()\n self.root = caller()\n self.ports = self.root[\"ports\"]\n self.body = self.root[\"body_rank\"]\n self.ambient = 1 + self.body + self.body * self.root[\"stages\"]\n if self.ambient * columns > dimension or columns < 1:\n raise ValueError(\"The complete source ambient and its columns must fit the frame\")\n\n for name in (\n \"raw_projector\",\n \"difference\",\n \"joint\",\n \"target\",\n \"head\",\n \"idle\",\n \"port_stage\",\n ):\n setattr(self, name, cache(getattr(self, name)))\n\n\n@cache\ndef active_catalogue(dimension, columns):\n return ActiveCatalogue(dimension, columns)\n\n\nclass StrongBinarySource(BinarySource):\n \"\"\"Use the same literal graph for the paid jobs, true charts and owner program.\"\"\"\n\n def raw(self, inputs, columns):\n c = active_catalogue(self.banks.dimension, columns)\n active, restores = {}, []\n for tag, job in inputs:\n target = c.target(tag)\n source = job_frame(job, self.banks.dimension)\n matcher = source.matcher_to(target)\n self.banks.route(job.owner, matcher)\n active[tag] = job.owner\n restores.append((job.owner, matcher))\n for clock, row in enumerate(c.root[\"events\"]):\n op, *args = row\n if op == \"LOCAL\":\n stage, x, y = args\n pairs = [(active[\"root\", x, p], active[\"root\", y, p]) for p in range(c.ports)]\n for p, pair in enumerate(pairs):\n matcher = c.port_stage(p, stage)\n for owner in pair:\n self.banks.route(owner, matcher)\n owners = (\n [a for a, b in pairs]\n + [b for a, b in pairs]\n + [active[\"helper\", clock, i] for i in range(2 * c.ports, c.graph[\"public\"])]\n )\n yield from self.inner(clock, owners, c)\n for p, pair in enumerate(pairs):\n back = tuple(inverse_word(c.port_stage(p, stage)))\n for owner in pair:\n self.banks.route(owner, back)\n elif op == \"IDLE_ONE\":\n x, stages = args\n frame = c.idle(tuple(stages))\n for p in range(c.ports):\n yield (op, clock, p), placed_job(active[\"root\", x, p], frame)\n else:\n x, y = args\n for p in range(c.ports):\n left, right = active[\"root\", x, p], active[\"root\", y, p]\n if op == \"ADD\":\n self.banks.xor(left, right)\n elif op == \"SWAP\":\n self.banks.swap(left, right)\n elif op == \"QUERY\":\n borrowed = self.banks.clone(right)\n yield (op, clock, p), placed_job(borrowed, c.head(p))\n self.banks.xor(left, borrowed)\n self.banks.retire(borrowed)\n else:\n raise ValueError(\"Unknown binary root opcode\")\n for owner, matcher in reversed(restores):\n self.banks.route(owner, tuple(inverse_word(matcher)))\n", + "old_sha256": "74ba0d1aa9ca1dc2f4ade19ca1989f8dbf5329ddf3736bf3056280283f4fd660" + } +} diff --git a/research/p104-six-stage-resolution/CANDIDATE.json b/research/p104-six-stage-resolution/CANDIDATE.json new file mode 100644 index 0000000000..bab014e31c --- /dev/null +++ b/research/p104-six-stage-resolution/CANDIDATE.json @@ -0,0 +1,98 @@ +{ + "binary_price": "1148159377744532071/295147905179352825856", + "complete_requirements": { + "all_size_margin_lower_at_entrance": 3028633891106537675, + "binary_entrance_logs": [ + 7028112486876, + 119028112486940, + 1911028112487004, + 30583028112487068, + 489335028112487132, + 7829367028112487196 + ], + "binary_rank_logs": [ + 7000000036864, + 112000000000000, + 1792000000000000, + 28672000000000000, + 458752000000000000, + 7340032000000000000 + ], + "complex_rank_log": 1600000, + "component_exponent": "39/10000", + "full_binary_debit": 28, + "full_positive_debit": 10, + "initial_s": 7829367028114087739, + "kappa": "389011528659443/100000000000000000", + "linear_geometry": { + "actual_dense_root_entry_log2": 12592977287652387236524, + "first_extent_bits_minus_b": -7829367028114087734, + "largest_axis_width": 6296488643826193618262, + "last_extent_bits_minus_b": -7829367028114087733, + "log2_axis_count": 7829367028114087663, + "minimum_width": 4008635918394412923648, + "private_clock_log2_upper": 6455629472481839205101371, + "public_offset_above_2_to_A": 2 + }, + "log2_all_fixed_setup_upper": 7516192768000000000003, + "log2_dominant_J": 7516192768000000000000, + "log2_rank_part_of_recurring_envelope": 751619276800000000000000, + "log2_sufficient_public_precision": 7829367028114087738, + "native_depth_bound_at_entrance": 4893355585643, + "native_volume_log2_upper": 65536, + "ordinary_rate": "30391525676519/7812500000000000", + "positive_context_cost_bitlength_upper": 58, + "prior_geometry_at_same_n": { + "actual_dense_root_entry_log2": 14518714321960041107770649917088777022124, + "first_extent_bits_minus_b": -7829367028114087734, + "largest_axis_width": 7259357160980020553885324958544388511062, + "last_extent_bits_minus_b": -7829367028114087733, + "log2_axis_count": 7829367028114087603, + "minimum_width": 3923135235898881430276118745356168455744, + "private_clock_log2_upper": 64276647704967273370063302245658979309977600, + "public_offset_above_2_to_A": 2 + }, + "rate_ticks_e18": [ + 3874554821464079, + 3890053044484935, + 3890115037610456, + 3890115285597548, + 3890115286590408, + 3890115286594432 + ], + "raw_structural_nodes_log2_upper": 11593, + "stripe_excess_log_at_entrance": 641381903321727150, + "stripe_margin_at_entrance": 3273301610735316717, + "uniform_payload_slope": "24500006102356979261/299072267200000000000" + }, + "floor": 4503599627370496, + "forest_G_plus_1_upper": 62122666666666669, + "improvement_over_8035": "373/100000000000000000", + "kappa": "389011528659443/100000000000000000", + "local_exponent_upper": 47388, + "native_slot_log_upper": 23261, + "positive_paid_cap": "1274827/327680000", + "positive_stop": "1/100000000000000000000", + "power": 384, + "raw_gap_upper": "31129996943/1000000000000000000000000000", + "raw_interval": [ + "1945057643297230564998471/500000000000000000000000000", + "3890115286594461129996943/1000000000000000000000000000" + ], + "signed": { + "functional": 4, + "ordinary_margin": "49/25000000000000000000", + "positive_margin": "6959404830149/20000000000000000000", + "smallest_margin": "1/1000000000000000000000", + "strict": 54 + }, + "stage_rates": [ + "3874554821464079/1000000000000000000", + "778010608896987/200000000000000000", + "486264379701307/125000000000000000", + "972528821399387/250000000000000000", + "486264410823801/125000000000000000", + "30391525676519/7812500000000000" + ], + "surplus_floor_e30": 1442216955823918 +} diff --git a/research/p104-six-stage-resolution/LAST-TICK-OVERLAY.json b/research/p104-six-stage-resolution/LAST-TICK-OVERLAY.json new file mode 100644 index 0000000000..63db5fc2c0 --- /dev/null +++ b/research/p104-six-stage-resolution/LAST-TICK-OVERLAY.json @@ -0,0 +1,22 @@ +{ + "calibration.py": { + "new_sha256": "102746d42df774d8915f2bbef036c7062241002609e65e8142e833a1b9e9f42a", + "new_text": "\"\"\"Set the physical ranks and check their complete price with rational arithmetic.\"\"\"\n\nfrom dataclasses import dataclass, replace\nfrom fractions import Fraction\n\nfrom upstream import install\n\ninstall()\nfrom staged_carriers import entrance_logs\n\nCOMPLEX_POWER = 128\nCOMPLEX_FLOOR = 1 << 15\nCOMPLEX_C = Fraction(2043, 524288)\nGAP = Fraction(1, 10**14)\nSETUP_DEGREE = 1024\n\n\n@dataclass(frozen=True)\nclass Profile:\n rank_logs: tuple\n complex_log: int\n power: int\n floor: int\n bit_c: Fraction\n eta: Fraction\n ordinary: Fraction\n kappa: Fraction\n positive_stop_denominator: int = 10**14\n\n\nCOMPACT = Profile(\n (260_000, 1_600_000),\n 610_000,\n 128,\n 1 << 15,\n Fraction(2039, 524288),\n Fraction(97, 25_000),\n Fraction(\"0.003879928035646\"),\n Fraction(\"0.00387992803556\"),\n)\nHIGH_RATE = Profile(\n (25_000_000, 160_000_000, 1_000_000_000, 6_000_000_000, 36_000_000_000, 224_000_000_000),\n 1_600_000,\n 228,\n 1 << 35,\n Fraction(17108907955, 2**42),\n Fraction(39, 10_000),\n Fraction(\"0.003890115197377\"),\n Fraction(\"0.00389011519729\"),\n)\nPRICE_MATCH = replace(\n HIGH_RATE,\n rank_logs=tuple(7 * h for h in HIGH_RATE.rank_logs),\n ordinary=Fraction(\"0.003890115271496\"),\n kappa=Fraction(\"0.00389011527141\"),\n)\nSPLIT_TARIFF = replace(\n HIGH_RATE,\n rank_logs=(106_811_524, 1_708_984_375, 27_343_750_000,\n 437_500_000_000, 7_000_000_000_000, 112_000_000_000_000),\n power=268,\n floor=1 << 50,\n bit_c=Fraction(280312348082011, 2**56),\n ordinary=Fraction(\"0.0038901152863925\"),\n kappa=Fraction(\"0.003890115286352\"),\n)\nSPLIT_TILT = Fraction(593, 2048)\nPRODUCTIVE_TILT = Fraction(491, 1024)\nSPLIT_WEIGHT = Fraction(1, 64)\nFIXED_STOCK = replace(SPLIT_TARIFF, kappa=Fraction(\"0.0038901152863924\"),\n positive_stop_denominator=10**17)\nSMALL_GAP = replace(FIXED_STOCK,\n rank_logs=tuple(64*height for height in FIXED_STOCK.rank_logs),\n power=285,\n floor=1 << 47,\n bit_c=Fraction(280312348082137, 2**56),\n ordinary=Fraction(\"0.00389011528659083\"),\n kappa=Fraction(\"0.0038901152865907\"),\n)\nNEAR_RAW = replace(FIXED_STOCK,\n rank_logs=tuple((1 << 16)*height for height in FIXED_STOCK.rank_logs),\n power=384,\n floor=1 << 52,\n bit_c=Fraction(1148159377744532071, 2**68),\n ordinary=Fraction(\"0.003890115286594432\"),\n kappa=Fraction(\"0.00389011528659443\"),\n positive_stop_denominator=10**20,\n)\nLAST_TICK = replace(NEAR_RAW,\n rank_logs=tuple(10**21 * 4**i for i in range(6)),\n power=430,\n floor=1 << 70,\n bit_c=Fraction(1175715202810401744919, 302231454903657293676544),\n ordinary=Fraction(\"0.003890115286594445005\"),\n kappa=Fraction(\"0.003890115286594445\"),\n positive_stop_denominator=10**21,\n)\nPROFILES = {\"compact\": COMPACT, \"high-rate\": HIGH_RATE, \"price-match\": PRICE_MATCH,\n \"split-tariff\": SPLIT_TARIFF, \"fixed-stock-stop\": FIXED_STOCK, \"small-gap\": SMALL_GAP,\n \"near-raw\": NEAR_RAW, \"last-tick\": LAST_TICK}\n\n\ndef debit(ambient, largest_target, power, c, floor, outer_bits):\n # The dyadic carrier needs no final axes. The paid replication factor is below 9/4.\n assert 32 * floor * 4 < 9 * 15 * (floor - 2)\n assert 9**4 < 2**5 * 4**4\n scale = 4 * (ambient * largest_target) ** power * floor\n upper = Fraction(5, 4) + c * (scale - 1).bit_length() + outer_bits\n return -(-upper.numerator // upper.denominator)\n\n\ndef split_tariff_debit(profile):\n floor = profile.floor\n scale = 4 * (134 * 127) ** profile.power * floor\n assert Fraction(1024 * floor, 15 * (floor - 2)) < 69\n assert 69**100 < 2**611\n bound = Fraction(611, 100) + profile.bit_c * (scale - 1).bit_length()\n return -(-bound.numerator // bound.denominator)\n\n\ndef prices(profile):\n bit_loss = (split_tariff_debit(profile) if profile.power in (SPLIT_TARIFF.power, SMALL_GAP.power)\n else debit(134, 127, profile.power, profile.bit_c, profile.floor, 5))\n numeric_loss = debit(153, 129, COMPLEX_POWER, COMPLEX_C, COMPLEX_FLOOR, 1)\n result = []\n previous = Fraction(0)\n for i, height in enumerate(profile.rank_logs):\n covered = profile.bit_c - Fraction(bit_loss, height)\n limit = min((249 * covered + previous) / 250, profile.eta)\n rate = (\n profile.ordinary\n if i == len(profile.rank_logs) - 1\n else Fraction(int(limit * 10**18) - 1, 10**18)\n )\n if not previous < rate < limit:\n raise ArithmeticError(\"An ordinary stage has insufficient strict price headroom\")\n result.append((height, covered, rate))\n previous = rate\n gap = Fraction(1, profile.positive_stop_denominator)\n if not (\n 0 < gap <= GAP\n and profile.kappa + 4 * gap < profile.ordinary\n and profile.kappa + 5 * gap < COMPLEX_C - Fraction(numeric_loss, profile.complex_log)\n ):\n raise ArithmeticError(\"The numerical consumer cannot receive these prices\")\n return bit_loss, numeric_loss, result\n\n\ndef entrance(profile):\n from linear_geometry import connected_exponent\n\n return connected_exponent(entrance_logs(profile.rank_logs)[-1], profile.complex_log)\n", + "old_sha256": "c2bc0311586e55ec1c58eb24147d1734f6bcd7aa999b585caaeed156276a3bbc" + }, + "check_product.py": { + "new_sha256": "ecd30e9ec9428506829d427f79606f873c977ec2062ced478f448bada799b742", + "new_text": "\"\"\"Compare signed integer tapes and all recovered digits at the same Fourier geometry.\"\"\"\n\nfrom collections import Counter\nfrom io import BytesIO\nfrom time import perf_counter\n\nfrom band_product import PackProduct, Product, multiply\nfrom ordinary_carrier import ordinary_swap, stage_body\n\n\ndef limbs(value, b):\n v = abs(value)\n return [(v >> q) % (1 << b) for q in range(0, v.bit_length(), b)]\n\n\ndef one(machine, a, b):\n field_bits = machine.b\n left, right = (abs(v).to_bytes((abs(v).bit_length() + 7) // 8, \"little\") for v in (a, b))\n inputs = [BytesIO(b\"keep\" + v + b\"tail\") for v in (left, right)]\n for src in inputs:\n src.seek(4)\n target = BytesIO(b\"head\" + bytes(80) + b\"guard\")\n target.seek(4)\n before = machine.h_calls\n start = perf_counter()\n sign, size, coeff = machine.multiply_tapes(\n inputs[0],\n len(left),\n inputs[1],\n len(right),\n target,\n coefficients=True,\n left_negative=a < 0,\n right_negative=b < 0,\n )\n seconds = perf_counter() - start\n expected = [0] * machine.size\n for i, x in enumerate(limbs(a, field_bits)):\n for j, y in enumerate(limbs(b, field_bits)):\n expected[i + j] += x * y\n raw = abs(a * b).to_bytes(max(1, (abs(a * b).bit_length() + 7) // 8), \"little\")\n assert list(coeff) == expected and sign == (a * b < 0) and size == len(raw)\n assert target.getvalue() == b\"head\" + raw + bytes(80 - size) + b\"guard\"\n assert all(\n t.tell() == 4 and t.getvalue() == b\"keep\" + v + b\"tail\"\n for t, v in zip(inputs, (left, right), strict=True)\n )\n assert machine.h_calls > before\n return {\n \"product\": str(a * b),\n \"bits\": [abs(a).bit_length(), abs(b).bit_length()],\n \"H_calls\": machine.h_calls - before,\n \"coefficients_prefix\": expected[:5],\n \"seconds\": round(seconds, 4),\n }\n\n\ndef stock_and_public(profile):\n from dataclasses import replace\n assert multiply(-741503, 466013, profile=profile) == -345550037539\n for x in (0, -1, 1, 37, -69, 2**16383 + 5):\n assert multiply(x, -997, profile=profile) == x * -997\n # Exercise the production stage body with a feasible rank and all 81 by 81 addresses.\n profile = replace(profile, rank_logs=(1,))\n side = 3**4\n records = bytes((i * 97 + (i >> 4)) % 256 for i in range(side * side))\n result = BytesIO()\n stage_body(BytesIO(records), result, 4, 1, 1, 1, 1, profile)\n assert result.getvalue() == bytes(\n records[j * side + i] for i in range(side) for j in range(side)\n )\n\n\ndef physical_product(profile=None):\n from binary_receiver import Receiver\n from module_atoms import balanced_widths\n from ordinary import rectangle\n from streaming_routes import work_tapes\n from triangular_ordinary import root_body\n\n if profile is None:\n from calibration import COMPACT\n\n profile = COMPACT\n stock_and_public(profile)\n core = Receiver(2, balanced_widths(1), direct=True, profile=profile)\n calls = Counter()\n\n def exchange(src, dst, bits, prefix, gap, suffix):\n assert bits == 1\n calls[\"shuttles\"] += 1\n calls[\"padded_bytes\"] += prefix * 81 * gap * suffix\n with work_tapes(2) as (opened, restored):\n rectangle(src, opened, 2, 9, prefix, gap, suffix)\n opened.seek(0)\n root_body(opened, restored, 2, prefix, gap, suffix, core)\n restored.seek(0)\n rectangle(restored, dst, 2, 9, prefix, gap, suffix, restrict=True)\n\n machine = Product((3, 5), 8, 136, exchange, profile=profile)\n assert machine.profile is profile\n row = one(machine, -741503, 466013)\n assert calls[\"shuttles\"] == 138 and row[\"H_calls\"] == 157248\n return {**row, **calls, \"rank\": core.n, \"stage_body_records\": 81**2}\n\n\ndef matched(*, wide=False):\n cases = [\n ((9,), 24, 224, [-((1 << 120) - 1), (1 << 119) + (1 << 96) + (1 << 49) + 1]),\n ((3, 5), 8, 136, [-741503, 466013]),\n ]\n if wide:\n cases.append(((9, 25), 8, 136, [-741503, 466013]))\n for sides, b, P, values in cases:\n for constructor in (PackProduct, Product):\n counts = Counter()\n\n def charged(src, dst, bits, prefix, gap, suffix):\n counts[bits] += 1\n ordinary_swap(src, dst, bits, prefix, gap, suffix)\n\n start = perf_counter()\n machine = (\n constructor(sides, b, P, charged)\n if constructor is Product\n else constructor(sides, b, P)\n )\n wall = perf_counter() - start\n yield {\n \"path\": constructor.__module__,\n \"true_sides\": sides,\n \"padded_sites\": machine.total,\n \"setup_seconds\": round(wall, 4),\n **one(machine, *values),\n \"physical_shuttles_by_width\": dict(counts),\n }\n\n\nif __name__ == \"__main__\":\n import json, sys\n\n for row in matched(wide=\"--wide\" in sys.argv):\n print(json.dumps(row), flush=True)\n", + "old_sha256": "3caf1264c85faa30dd2c599c3d3521059f25a366d64df995bd145161fb608092" + }, + "strict_moment.py": { + "new_sha256": "616d0db009194d8566cc44b581ef48e331460d11c892fcd8ce73769a6c528418", + "new_text": "\"\"\"Bound the two powered moments from all the actual labelled port ranks.\"\"\"\n\nfrom collections import Counter\nfrom fractions import Fraction\nfrom math import isqrt\n\nfrom calibration import COMPLEX_C, COMPLEX_POWER, LAST_TICK, NEAR_RAW, PRODUCTIVE_TILT, SMALL_GAP, SPLIT_TARIFF, SPLIT_TILT, SPLIT_WEIGHT\n\nUNIT = 1 << 112\n\n\ndef ceiling(a, b):\n return -(-a // b)\n\n\ndef power_interval(rank, exponent):\n \"\"\"Return outward integer bounds in units of 2^-112 for a dyadic power.\"\"\"\n k, d = exponent.numerator, exponent.denominator\n if rank <= 0 or k < 0 or d & (d - 1):\n raise ValueError(\"Use positive ranks and nonnegative dyadic powers\")\n whole, residue = divmod(k, d)\n low = high = rank**whole * UNIT\n lo_root = hi_root = rank * UNIT\n while d > 1:\n d //= 2\n lo_root = isqrt(lo_root * UNIT)\n hi_root = 1 + isqrt(hi_root * UNIT - 1)\n if residue & d:\n low = low * lo_root // UNIT\n high = ceiling(high * hi_root, UNIT)\n return low, high\n\n\ndef moment(hist, exponent, upper):\n return sum(count * power_interval(rank, exponent)[upper] for rank, count in hist.items())\n\n\ndef certify(word, c, tilt, drop, power, slack_bits, cutoff, *, split_weight=2):\n if (word.power, word.floor, word.low_cut, word.high_cut) != (power, cutoff, 12, 12):\n raise ValueError(\"The evaluated strictifier differs from the installed one\")\n targets = Counter(p.rank for p in word.targets)\n paid = Counter(p.rank for p in word.paid)\n t = 1 - c\n lower = moment(targets, t, False)\n alpha = Fraction(moment(paid, t, True), lower)\n gamma = Fraction(moment(paid, t + tilt, True) * UNIT, lower * power_interval(12, tilt)[0])\n loss = Fraction(moment(targets, t - drop, True) * power_interval(cutoff, drop)[1], lower * UNIT)\n if split_weight != 2:\n # For x >= 1, (2x)^c - 1 <= (101/100)c x^tilt / tilt.\n assert 0 < c < Fraction(1, 250) and c <= tilt <= 1\n assert Fraction(101, 100)**250 > 2\n assert Fraction(101, 100) * c / tilt < split_weight\n deficit = 1 - alpha**power - split_weight * gamma**power - loss**power\n if not (tilt >= c and deficit > Fraction(1, 1 << slack_bits)):\n raise ArithmeticError(\"The strict local surplus cannot pay all physical fringe axes\")\n return {\n \"raw_productive\": sum(targets.values()),\n \"raw_paid\": sum(paid.values()),\n \"productive\": dict(sorted(targets.items())),\n \"paid\": dict(sorted(paid.items())),\n \"surplus_lower_units_1e12\": int(10**12 * deficit),\n }\n\n\ndef both(binary, positive, profile):\n if profile.power in (NEAR_RAW.power, LAST_TICK.power):\n return (\n certify(binary, profile.bit_c, SPLIT_TILT, PRODUCTIVE_TILT,\n profile.power, profile.floor.bit_length() - 2, 15),\n certify(positive, COMPLEX_C, Fraction(19, 64), Fraction(23, 64), COMPLEX_POWER, 14, 16),\n )\n if profile.power in (SPLIT_TARIFF.power, SMALL_GAP.power):\n return (\n certify(binary, profile.bit_c, SPLIT_TILT, PRODUCTIVE_TILT,\n profile.power, profile.floor.bit_length() - 2, 15, split_weight=SPLIT_WEIGHT),\n certify(positive, COMPLEX_C, Fraction(19, 64), Fraction(23, 64), COMPLEX_POWER, 14, 16),\n )\n return (\n certify(\n binary,\n profile.bit_c,\n Fraction(19, 64),\n Fraction(31 if profile.power == 228 else 26, 64),\n profile.power,\n profile.floor.bit_length() - 2,\n 15 if profile.power == 228 else 16,\n ),\n certify(positive, COMPLEX_C, Fraction(19, 64), Fraction(23, 64), COMPLEX_POWER, 14, 16),\n )\n", + "old_sha256": "b6ff0c51047b5e79ae08509c19a59b11de6f296dd3f78136ada6d564c7516c16" + }, + "strong_binary.py": { + "new_sha256": "7b9a5b8782e5449cdd4810f67b7e05879a121646bf72dc3e1a366e327fbcebe4", + "new_text": "\"\"\"Run the 111-port binary source on the retained physical bank machine.\n\nThe catalogue initialization and the outer 36-call interpreter use the\nconstruction of PR 7914. The inner MOVE, ADD, SWAP, INIT and CLEAR interpreter\nand the complete chart constructors come from that package.\n\"\"\"\n\nfrom functools import cache\nfrom hashlib import sha256\nfrom pathlib import Path\n\nfrom factored_frames import inverse_word\nfrom powered import PoweredWord\nfrom raw_binary import BinarySource, Catalogue, job_frame, placed_job\nfrom tagged_sources import BIT_CALLER, BIT_PIN, binary_ports, packed, pinned\n\n\nSOURCE_SHA256 = \"74e93daf2b7acf794ffb51f92f03f51556f68126d41ee13a8969bddb4cbe6326\"\n\n\n@cache\ndef graph():\n data = Path(__file__).with_name(\"strong-bit.json.gz\").read_bytes()\n if sha256(data).hexdigest() != SOURCE_SHA256:\n raise ValueError(\"The 111-port binary source differs\")\n return packed(data)\n\n\n@cache\ndef caller():\n return packed(pinned(BIT_CALLER, BIT_PIN))\n\n\n@cache\ndef native_word(power=128):\n if power not in (128, 228, 268, 285, 384, 430):\n raise ValueError(\"Select a certified binary power\")\n raw = binary_ports(graph(), caller())\n floor = 16 if power == 128 else 15\n return PoweredWord(raw.ambient, raw.targets, raw.paid, power, floor, 12, 12)\n\n\nclass ActiveCatalogue(Catalogue):\n def __init__(self, dimension, columns):\n self.dimension = dimension\n self.columns = columns\n self.graph = graph()\n self.root = caller()\n self.ports = self.root[\"ports\"]\n self.body = self.root[\"body_rank\"]\n self.ambient = 1 + self.body + self.body * self.root[\"stages\"]\n if self.ambient * columns > dimension or columns < 1:\n raise ValueError(\"The complete source ambient and its columns must fit the frame\")\n\n for name in (\n \"raw_projector\",\n \"difference\",\n \"joint\",\n \"target\",\n \"head\",\n \"idle\",\n \"port_stage\",\n ):\n setattr(self, name, cache(getattr(self, name)))\n\n\n@cache\ndef active_catalogue(dimension, columns):\n return ActiveCatalogue(dimension, columns)\n\n\nclass StrongBinarySource(BinarySource):\n \"\"\"Use the same literal graph for the paid jobs, true charts and owner program.\"\"\"\n\n def raw(self, inputs, columns):\n c = active_catalogue(self.banks.dimension, columns)\n active, restores = {}, []\n for tag, job in inputs:\n target = c.target(tag)\n source = job_frame(job, self.banks.dimension)\n matcher = source.matcher_to(target)\n self.banks.route(job.owner, matcher)\n active[tag] = job.owner\n restores.append((job.owner, matcher))\n for clock, row in enumerate(c.root[\"events\"]):\n op, *args = row\n if op == \"LOCAL\":\n stage, x, y = args\n pairs = [(active[\"root\", x, p], active[\"root\", y, p]) for p in range(c.ports)]\n for p, pair in enumerate(pairs):\n matcher = c.port_stage(p, stage)\n for owner in pair:\n self.banks.route(owner, matcher)\n owners = (\n [a for a, b in pairs]\n + [b for a, b in pairs]\n + [active[\"helper\", clock, i] for i in range(2 * c.ports, c.graph[\"public\"])]\n )\n yield from self.inner(clock, owners, c)\n for p, pair in enumerate(pairs):\n back = tuple(inverse_word(c.port_stage(p, stage)))\n for owner in pair:\n self.banks.route(owner, back)\n elif op == \"IDLE_ONE\":\n x, stages = args\n frame = c.idle(tuple(stages))\n for p in range(c.ports):\n yield (op, clock, p), placed_job(active[\"root\", x, p], frame)\n else:\n x, y = args\n for p in range(c.ports):\n left, right = active[\"root\", x, p], active[\"root\", y, p]\n if op == \"ADD\":\n self.banks.xor(left, right)\n elif op == \"SWAP\":\n self.banks.swap(left, right)\n elif op == \"QUERY\":\n borrowed = self.banks.clone(right)\n yield (op, clock, p), placed_job(borrowed, c.head(p))\n self.banks.xor(left, borrowed)\n self.banks.retire(borrowed)\n else:\n raise ValueError(\"Unknown binary root opcode\")\n for owner, matcher in reversed(restores):\n self.banks.route(owner, tuple(inverse_word(matcher)))\n", + "old_sha256": "fa6f496389e58d0fc53b6c88f922dbdeb981e677ad1cb160dd26a45b6247b09d" + } +} diff --git a/research/p104-six-stage-resolution/LAST-TICK-RECEIPT.json b/research/p104-six-stage-resolution/LAST-TICK-RECEIPT.json new file mode 100644 index 0000000000..68e300af92 --- /dev/null +++ b/research/p104-six-stage-resolution/LAST-TICK-RECEIPT.json @@ -0,0 +1,154 @@ +{ + "G_plus_1_upper": 7739534883720930232561, + "band_floor": 1180591620717411303424, + "bit_debit": 31, + "complete_requirements": { + "all_size_margin_lower_at_entrance": 528024503534136304443898, + "binary_entrance_logs": [ + 1004016064257028112515, + 5004016064257028112579, + 21004016064257028112643, + 85004016064257028112707, + 341004016064257028112771, + 1365004016064257028112835 + ], + "binary_rank_logs": [ + 1000000000000000000000, + 4000000000000000000000, + 16000000000000000000000, + 64000000000000000000000, + 256000000000000000000000, + 1024000000000000000000000 + ], + "complex_rank_log": 1600000, + "component_exponent": "39/10000", + "full_binary_debit": 31, + "full_positive_debit": 10, + "initial_s": 1365004016064257029713504, + "kappa": "778023057318889/200000000000000000", + "linear_geometry": { + "actual_dense_root_entry_log2": 1650586719047173699865498966, + "first_extent_bits_minus_b": -1365004016064257029713499, + "largest_axis_width": 825293359523586849932749483, + "last_extent_bits_minus_b": -1365004016064257029713498, + "log2_axis_count": 1365004016064257029713411, + "minimum_width": 698882056224899599213315328, + "private_clock_log2_upper": 846499529268618797786591880800, + "public_offset_above_2_to_A": 4 + }, + "log2_all_fixed_setup_upper": 1048576000000000000000000003, + "log2_dominant_J": 1048576000000000000000000000, + "log2_rank_part_of_recurring_envelope": 104857600000000000000000000000, + "log2_sufficient_public_precision": 1365004016064257029713503, + "native_depth_bound_at_entrance": 853127510040162488, + "native_volume_log2_upper": 65536, + "ordinary_rate": "778023057318889001/200000000000000000000", + "positive_context_cost_bitlength_upper": 58, + "prior_geometry_at_same_n": { + "actual_dense_root_entry_log2": 249429612771140764706762211450245635354612487334572, + "first_extent_bits_minus_b": -1365004016064257029713499, + "largest_axis_width": 124714806385570382353381105725122817677306243667286, + "last_extent_bits_minus_b": -1365004016064257029713498, + "log2_axis_count": 1365004016064257029713334, + "minimum_width": 119247101687779229647005282862830728700692477313024, + "private_clock_log2_upper": 1953744514052574898536537417045520956220903926031974400, + "public_offset_above_2_to_A": 4 + }, + "rate_ticks_e18": [ + 3874554825448082, + 3890053044749874, + 3890115037627081, + 3890115285598590, + 3890115286590476, + 3890115286594445 + ], + "raw_structural_nodes_log2_upper": 12973, + "stripe_excess_log_at_entrance": 111821128995984177955026, + "stripe_margin_at_entrance": 570680879036144336901724, + "uniform_payload_slope": "128000000000000273/1562500000000000000" + }, + "gap": "1/1000000000000000000000", + "host_py_ssize_max": 9223372036854775807, + "kappa": "778023057318889/200000000000000000", + "kappa_decimal": "0.003890115286594445", + "local_exponent": 53044, + "minimum_last_height_with_profile_debit": 166468119783642494505, + "native_q": 65536, + "native_slot_log_upper": 26038, + "numeric_debit": 10, + "ordinary": "778023057318889001/200000000000000000000", + "physical_execution_limit": "Production ranks exceed CPython shift size and available host storage; feasible controls only.", + "positive_paid_cap": "1274827/327680000", + "power": 430, + "power_430_toy_owner_control": { + "raw_calls": 430, + "returned_original_owner": true + }, + "raw_interval": [ + "1945057643297230564998471/500000000000000000000000000", + "3890115286594461129996943/1000000000000000000000000000" + ], + "signed": { + "functional": 4, + "ordinary_margin": "1/1000000000000000000000", + "positive_margin": "69594048298499/200000000000000000000", + "smallest_margin": "1/10000000000000000000000", + "strict": 54 + }, + "six_stage_upper_decimal": "0.003890115286594445189476955228", + "six_stage_upper_fraction": "972528821648611297369238807/250000000000000000000000000000", + "stages": [ + { + "height": 1000000000000000000000, + "limit": "139595549344916359020188522147497820907/36028797018963968000000000000000000000000", + "margin_floor_e24": 1245636, + "rate": "1937277412724041/500000000000000000", + "strict_margin": "44878791509438121820907/36028797018963968000000000000000000000000" + }, + { + "height": 4000000000000000000000, + "limit": "140153931542296025111072962766483931883/36028797018963968000000000000000000000000", + "margin_floor_e24": 1596793, + "rate": "1945026522374937/500000000000000000", + "strict_margin": "57530555784226451931883/36028797018963968000000000000000000000000" + }, + { + "height": 16000000000000000000000, + "limit": "140156165071085543933409156571843707627/36028797018963968000000000000000000000000", + "margin_floor_e24": 1770582, + "rate": "3890115037627081/1000000000000000000", + "strict_margin": "63791973396554435707627/36028797018963968000000000000000000000000" + }, + { + "height": 64000000000000000000000, + "limit": "140156174005200702035797759183262499563/36028797018963968000000000000000000000000", + "margin_floor_e24": 1600030, + "rate": "389011528559859/100000000000000000", + "strict_margin": "57647165237578142499563/36028797018963968000000000000000000000000" + }, + { + "height": 256000000000000000000000, + "limit": "140156174040937162705822778300990669547/36028797018963968000000000000000000000000", + "margin_floor_e24": 1636392, + "rate": "972528821647619/250000000000000000", + "strict_margin": "58957238162332222669547/36028797018963968000000000000000000000000" + }, + { + "height": 1024000000000000000000000, + "limit": "140156174041080108546521644696289592043/36028797018963968000000000000000000000000", + "margin_floor_e24": 175482, + "rate": "778023057318889001/200000000000000000000", + "strict_margin": "6322424775643709752043/36028797018963968000000000000000000000000" + } + ], + "surplus_floor_e21": 3906, + "trial": "1175715202810401744919/302231454903657293676544", + "upper_grid_rates": [ + "1937277412724041/500000000000000000", + "1945026522374937/500000000000000000", + "3890115037627081/1000000000000000000", + "389011528559859/100000000000000000", + "972528821647619/250000000000000000" + ], + "upper_scope": "given bit_c < RAW_RIGHT, 5 stages on 1e-18 grid and this price recurrence" +} diff --git a/research/p104-six-stage-resolution/LICENSE b/research/p104-six-stage-resolution/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/p104-six-stage-resolution/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-six-stage-resolution/OVERLAY.json b/research/p104-six-stage-resolution/OVERLAY.json new file mode 100644 index 0000000000..93fcd0e584 --- /dev/null +++ b/research/p104-six-stage-resolution/OVERLAY.json @@ -0,0 +1,96 @@ +{ + "band_product.py": { + "old_sha256": "7feb08718d511b45d0e9f927540115c9c1526f9b65ff3dadaef55b1ac8a2b19d", + "new_sha256": "b58c52fdb95499722618614b49a628fd8565d7a64173415961416039ed86aec6", + "edits": [ + [ + "\n@cache\ndef production_supplier(rank_log):\n from strong_complex import artifacts, word\n\n", + "\n@cache\ndef production_supplier(rank_log, stop_denominator):\n from strong_complex import artifacts, word\n\n" + ], + [ + " return ComplexRaw(atlas, fields, columns, **kw)\n\n return Positive(native, physical, 1 << rank_log)\n\n\n", + " return ComplexRaw(atlas, fields, columns, **kw)\n\n return Positive(native, physical, 1 << rank_log, denominator=stop_denominator)\n\n\n" + ], + [ + " binary = source_planner(profile.power, profile.floor)\n streams = [binary.image(1 << log_rank) for log_rank in profile.rank_logs]\n positive = production_supplier(profile.complex_log)\n if positive.owners <= 1:\n raise ArithmeticError(\"The numerical carrier needs independent rows\")\n", + " binary = source_planner(profile.power, profile.floor)\n streams = [binary.image(1 << log_rank) for log_rank in profile.rank_logs]\n positive = production_supplier(profile.complex_log, profile.positive_stop_denominator)\n if positive.owners <= 1:\n raise ArithmeticError(\"The numerical carrier needs independent rows\")\n" + ], + [ + " bit,\n self.profile.complex_log,\n partial(production_supplier, self.profile.complex_log),\n )\n\n", + " bit,\n self.profile.complex_log,\n partial(production_supplier, self.profile.complex_log, self.profile.positive_stop_denominator),\n )\n\n" + ] + ] + }, + "calibration.py": { + "old_sha256": "c36a253ab22f77381fe3e36889c9175680eadfd4a1203f2047141dc7a772f679", + "new_sha256": "444f185c619ef01bdea6328af3dc7ba30014b5cfebe7d1de875966e656fd57ff", + "edits": [ + [ + " ordinary: Fraction\n kappa: Fraction\n\n\n", + " ordinary: Fraction\n kappa: Fraction\n positive_stop_denominator: int = 10**14\n\n\n" + ], + [ + " kappa=Fraction(\"0.00389011527141\"),\n)\nPROFILES = {\"compact\": COMPACT, \"high-rate\": HIGH_RATE, \"price-match\": PRICE_MATCH}\n\n\n", + " kappa=Fraction(\"0.00389011527141\"),\n)\nSPLIT_TARIFF = replace(\n HIGH_RATE,\n rank_logs=(106_811_524, 1_708_984_375, 27_343_750_000,\n 437_500_000_000, 7_000_000_000_000, 112_000_000_000_000),\n power=268,\n floor=1 << 50,\n bit_c=Fraction(280312348082011, 2**56),\n ordinary=Fraction(\"0.0038901152863925\"),\n kappa=Fraction(\"0.003890115286352\"),\n)\nSPLIT_TILT = Fraction(593, 2048)\nPRODUCTIVE_TILT = Fraction(491, 1024)\nSPLIT_WEIGHT = Fraction(1, 64)\nFIXED_STOCK = replace(SPLIT_TARIFF, kappa=Fraction(\"0.0038901152863924\"),\n positive_stop_denominator=10**17)\nSMALL_GAP = replace(FIXED_STOCK,\n rank_logs=tuple(64*height for height in FIXED_STOCK.rank_logs),\n power=285,\n floor=1 << 47,\n bit_c=Fraction(280312348082137, 2**56),\n ordinary=Fraction(\"0.00389011528659083\"),\n kappa=Fraction(\"0.0038901152865907\"),\n)\nPROFILES = {\"compact\": COMPACT, \"high-rate\": HIGH_RATE, \"price-match\": PRICE_MATCH,\n \"split-tariff\": SPLIT_TARIFF, \"fixed-stock-stop\": FIXED_STOCK, \"small-gap\": SMALL_GAP}\n\n\n" + ], + [ + "\n\ndef prices(profile):\n bit_loss = debit(134, 127, profile.power, profile.bit_c, profile.floor, 5)\n numeric_loss = debit(153, 129, COMPLEX_POWER, COMPLEX_C, COMPLEX_FLOOR, 1)\n result = []\n", + "\n\ndef split_tariff_debit(profile):\n floor = profile.floor\n scale = 4 * (134 * 127) ** profile.power * floor\n assert Fraction(1024 * floor, 15 * (floor - 2)) < 69\n assert 69**100 < 2**611\n bound = Fraction(611, 100) + profile.bit_c * (scale - 1).bit_length()\n return -(-bound.numerator // bound.denominator)\n\n\ndef prices(profile):\n bit_loss = (split_tariff_debit(profile) if profile.power in (SPLIT_TARIFF.power, SMALL_GAP.power)\n else debit(134, 127, profile.power, profile.bit_c, profile.floor, 5))\n numeric_loss = debit(153, 129, COMPLEX_POWER, COMPLEX_C, COMPLEX_FLOOR, 1)\n result = []\n" + ], + [ + " result.append((height, covered, rate))\n previous = rate\n if not (\n profile.kappa + 4 * GAP < profile.ordinary\n and profile.kappa + 5 * GAP < COMPLEX_C - Fraction(numeric_loss, profile.complex_log)\n ):\n raise ArithmeticError(\"The numerical consumer cannot receive these prices\")\n", + " result.append((height, covered, rate))\n previous = rate\n gap = Fraction(1, profile.positive_stop_denominator)\n if not (\n 0 < gap <= GAP\n and profile.kappa + 4 * gap < profile.ordinary\n and profile.kappa + 5 * gap < COMPLEX_C - Fraction(numeric_loss, profile.complex_log)\n ):\n raise ArithmeticError(\"The numerical consumer cannot receive these prices\")\n" + ] + ] + }, + "check_product.py": { + "old_sha256": "5ace944e196d730ba966c042ddff6eccd2022e04f721619dfe47f45eefd64177", + "new_sha256": "3caf1264c85faa30dd2c599c3d3521059f25a366d64df995bd145161fb608092", + "edits": [ + [ + "\n\ndef stock_and_public():\n from dataclasses import replace\n from calibration import COMPACT\n\n assert multiply(-741503, 466013) == -345550037539\n for x in (0, -1, 1, 37, -69, 2**16383 + 5):\n assert multiply(x, -997) == x * -997\n # Exercise the production stage body with a feasible rank and all 81 by 81 addresses.\n profile = replace(COMPACT, rank_logs=(1,))\n side = 3**4\n records = bytes((i * 97 + (i >> 4)) % 256 for i in range(side * side))\n", + "\n\ndef stock_and_public(profile):\n from dataclasses import replace\n assert multiply(-741503, 466013, profile=profile) == -345550037539\n for x in (0, -1, 1, 37, -69, 2**16383 + 5):\n assert multiply(x, -997, profile=profile) == x * -997\n # Exercise the production stage body with a feasible rank and all 81 by 81 addresses.\n profile = replace(profile, rank_logs=(1,))\n side = 3**4\n records = bytes((i * 97 + (i >> 4)) % 256 for i in range(side * side))\n" + ], + [ + "\n\ndef physical_product():\n from binary_receiver import Receiver\n from module_atoms import balanced_widths\n", + "\n\ndef physical_product(profile=None):\n from binary_receiver import Receiver\n from module_atoms import balanced_widths\n" + ], + [ + " from triangular_ordinary import root_body\n\n stock_and_public()\n core = Receiver(2, balanced_widths(1), direct=True)\n calls = Counter()\n\n", + " from triangular_ordinary import root_body\n\n if profile is None:\n from calibration import COMPACT\n\n profile = COMPACT\n stock_and_public(profile)\n core = Receiver(2, balanced_widths(1), direct=True, profile=profile)\n calls = Counter()\n\n" + ] + ] + }, + "strict_moment.py": { + "old_sha256": "899ce86a0e5ae0455ea6cf97934658b2fd31b81d7111cb2bd636ce10e3e7264d", + "new_sha256": "f13c79ed45ce41c67a3f47c1767601be032ae65a908b9ee3a80643b0ac08689a", + "edits": [ + [ + "from math import isqrt\n\nfrom calibration import COMPLEX_C, COMPLEX_POWER\n\nUNIT = 1 << 112\n", + "from math import isqrt\n\nfrom calibration import COMPLEX_C, COMPLEX_POWER, PRODUCTIVE_TILT, SMALL_GAP, SPLIT_TARIFF, SPLIT_TILT, SPLIT_WEIGHT\n\nUNIT = 1 << 112\n" + ], + [ + "\n\ndef certify(word, c, tilt, drop, power, slack_bits, cutoff):\n if (word.power, word.floor, word.low_cut, word.high_cut) != (power, cutoff, 12, 12):\n raise ValueError(\"The evaluated strictifier differs from the installed one\")\n", + "\n\ndef certify(word, c, tilt, drop, power, slack_bits, cutoff, *, split_weight=2):\n if (word.power, word.floor, word.low_cut, word.high_cut) != (power, cutoff, 12, 12):\n raise ValueError(\"The evaluated strictifier differs from the installed one\")\n" + ], + [ + " gamma = Fraction(moment(paid, t + tilt, True) * UNIT, lower * power_interval(12, tilt)[0])\n loss = Fraction(moment(targets, t - drop, True) * power_interval(cutoff, drop)[1], lower * UNIT)\n deficit = 1 - alpha**power - 2 * gamma**power - loss**power\n if not (tilt >= c and deficit > Fraction(1, 1 << slack_bits)):\n raise ArithmeticError(\"The strict local surplus cannot pay all physical fringe axes\")\n", + " gamma = Fraction(moment(paid, t + tilt, True) * UNIT, lower * power_interval(12, tilt)[0])\n loss = Fraction(moment(targets, t - drop, True) * power_interval(cutoff, drop)[1], lower * UNIT)\n if split_weight != 2:\n # For x >= 1, (2x)^c - 1 <= (101/100)c x^tilt / tilt.\n assert 0 < c < Fraction(1, 250) and c <= tilt <= 1\n assert Fraction(101, 100)**250 > 2\n assert Fraction(101, 100) * c / tilt < split_weight\n deficit = 1 - alpha**power - split_weight * gamma**power - loss**power\n if not (tilt >= c and deficit > Fraction(1, 1 << slack_bits)):\n raise ArithmeticError(\"The strict local surplus cannot pay all physical fringe axes\")\n" + ], + [ + "\ndef both(binary, positive, profile):\n return (\n certify(\n", + "\ndef both(binary, positive, profile):\n if profile.power in (SPLIT_TARIFF.power, SMALL_GAP.power):\n return (\n certify(binary, profile.bit_c, SPLIT_TILT, PRODUCTIVE_TILT,\n profile.power, profile.floor.bit_length() - 2, 15, split_weight=SPLIT_WEIGHT),\n certify(positive, COMPLEX_C, Fraction(19, 64), Fraction(23, 64), COMPLEX_POWER, 14, 16),\n )\n return (\n certify(\n" + ] + ] + }, + "strong_binary.py": { + "old_sha256": "03ffb2075620fe793156e9bd22890185bef21e097abadba3a7d6cb5406051855", + "new_sha256": "74ba0d1aa9ca1dc2f4ade19ca1989f8dbf5329ddf3736bf3056280283f4fd660", + "edits": [ + [ + "@cache\ndef native_word(power=128):\n if power not in (128, 228):\n raise ValueError(\"Select a certified binary power\")\n raw = binary_ports(graph(), caller())\n", + "@cache\ndef native_word(power=128):\n if power not in (128, 228, 268, 285):\n raise ValueError(\"Select a certified binary power\")\n raw = binary_ports(graph(), caller())\n" + ] + ] + } +} diff --git a/research/p104-six-stage-resolution/PREDECESSOR-SOURCES.json b/research/p104-six-stage-resolution/PREDECESSOR-SOURCES.json new file mode 100644 index 0000000000..4afaeff69d --- /dev/null +++ b/research/p104-six-stage-resolution/PREDECESSOR-SOURCES.json @@ -0,0 +1,633 @@ +{ + "schema_version": 1, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "path": "AGENTS.md", + "git_blob": "ff81117fca368042f6092964d1f54eb4e6e08fb9", + "sha256": "fece32cdec9c1572ddce354a0b623459cb2c4ca162125d36d36262a92e3caa83", + "usage": "provenance" + }, + { + "path": "autoresearch.md", + "git_blob": "2fe84a7b30b1e26e60ce0ec4775894eb1831c5d6", + "sha256": "d16f0d3bb4d4b213d06c128db6d6460b0fe9ec1ac5a6c1ea1febf1db40e7b60d", + "usage": "provenance" + }, + { + "path": "CONTRIBUTING.md", + "git_blob": "5185786f2ec00f215019fb5777d70979429690a9", + "sha256": "fcd1a8d0e52342a23b8ffa9e905e85ccc539fb084145ef016dfc93cedfb3d924", + "usage": "provenance" + }, + { + "path": "certificates/selected-result.json", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1", + "usage": "provenance" + }, + { + "path": "docs/research/agent-task-catalog.json", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81", + "usage": "provenance" + }, + { + "path": "research/unconditional-batched-crt/CRT.md", + "git_blob": "d98dd8e368431cac33d5fc1c8c336696663641d6", + "sha256": "02c3a1e38cbee25aefe2640cc72676da62ba10eb7519fbcb9adb9d48b74eff2b", + "usage": "provenance" + }, + { + "path": "research/delayed-cover-physical-batch-routing/PROOF.md", + "git_blob": "af919b5ba2257c07ea17180f9b8c9fd457556079", + "sha256": "1c3dcd294d327a16fa081b7ea27497941ac6480d352f53e55e8b9e87f45d1454", + "usage": "provenance" + }, + { + "path": "notes/compact-control-movement.tex", + "git_blob": "06b6a9ef24245ac7b724c53a204635415b402357", + "sha256": "b963c3d2f4e1b7059aa289bb4b4ac89b688920bcf42f5b20d7698cdef0132cc6", + "usage": "provenance" + } + ], + "offline_predecessor": { + "head": "6285dd829114705862e8d91facaedc1f31d3cfcb", + "pr": 8030, + "tree": "3a1c001cbf175ae48ee1d56e56e4723eda1c8218", + "archive": "predecessor-8030.tar.gz", + "archive_sha256": "769d5a05cc1373fa22ed5956af636992fcd19d7e5c1753a32033a73c358cd31c", + "files": { + "ACTIVATION-SPACE.md": { + "size": 15082, + "mode": "100644", + "git_blob": "52f71ba75c3383401da5eda2c435a998629bc984", + "sha256": "e805961b0b3f5263cfb0b5c559dd99243330b8821d0a2c932c2bfabde79181c4" + }, + "ACTUAL-SETUP.md": { + "size": 6161, + "mode": "100644", + "git_blob": "61deda9516719a7039b60a0bc0f53673ad7a252d", + "sha256": "071abc2a2f9ad6d53923ccbc3f0ef09ae31430dd1ba03f54bca2bb661cda954b" + }, + "APPLICATION.md": { + "size": 11870, + "mode": "100644", + "git_blob": "07f01dadb8160dc44875a55d0884780a9ffb3649", + "sha256": "e84215c5ca9faeeb5aa9567fe6db0f1dc817bbc909c8c4e6caf3aa6d65ca938a" + }, + "BAND.md": { + "size": 16863, + "mode": "100644", + "git_blob": "bf1d63a1b7219b46dc935e734adcb22d84cac1f1", + "sha256": "4c0adb553b4357ead618e26af4fe8c600fdafc816449c54b48a9b2dfa0cff494" + }, + "LICENSE": { + "size": 11357, + "mode": "100644", + "git_blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64", + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + }, + "LINEAR-GEOMETRY.md": { + "size": 21359, + "mode": "100644", + "git_blob": "b07c2127327faceb59c4e6833e592cb96c98600a", + "sha256": "8f6a9045ebcb4b8ddeb6339e7414bc897a6583e02ae689b15d4dac0394659550" + }, + "NOTICE.md": { + "size": 4296, + "mode": "100644", + "git_blob": "10167a0c8a4f2ec6af86f16acc6cad577e5aa713", + "sha256": "c00f5acddbb6516a69f1fd9a3ef01e737f4c10fabb36a19eef5623b1fbc1edbe" + }, + "README.md": { + "size": 7097, + "mode": "100644", + "git_blob": "5349b7f95653fbc85557b44540bcdf587d3b03aa", + "sha256": "0814b1c07155a037347127fc941c47ec3d5c23b8e8c06d23f46993085f0f6798" + }, + "REQUIREMENTS.json": { + "size": 6970, + "mode": "100644", + "git_blob": "64a217df2fc0012b7aab402ceeb3d5fae1f2ce9a", + "sha256": "6de3056c25423a952d35c89f661ba511594981544c4dd270f6a5b58920edb1aa" + }, + "SOURCES.json": { + "size": 3201, + "mode": "100644", + "git_blob": "94e74a7e0202e088a4fc78e7fd4aedbfda4c7043", + "sha256": "0d22a7cfdde48de7a106fca872601d5ed345a4ae3631b0acff2e05407eae2e65" + }, + "STRONG-BINARY.md": { + "size": 13442, + "mode": "100644", + "git_blob": "530be21be91f5988cb22feea134613122f9cf040", + "sha256": "548e4d8e2290c4e58845ddd20f9099d9fc866cd3b19997ad0791b056e66ccd92" + }, + "STRONG-COMPLEX.md": { + "size": 13932, + "mode": "100644", + "git_blob": "e9c08411e4cbdddb3a2c8bb1e19bc59e8c9ba6be", + "sha256": "724e816015c2329414d503a7b29683bf563be4b7469a8149cfe2cfc888696b44" + }, + "TASK.json": { + "size": 5897, + "mode": "100644", + "git_blob": "baff001ee17330bb0a4745161fc4bec7f1b369f5", + "sha256": "9372161b8b3de4bb6ec5efa1f3519a0bbe45a87c2cc8d1c5a6f76bd6f2c0da56" + }, + "VERIFICATION.md": { + "size": 6883, + "mode": "100644", + "git_blob": "00890cd08a955dcecd1b8da12478853096cd78de", + "sha256": "1906c8a2564b83df5ed386ffea3ba8c675c225051ff9800d0147223cea0fe1bd" + }, + "VERIFY.json": { + "size": 2415, + "mode": "100644", + "git_blob": "549567731dde171633082c211dd860ed8f457c19", + "sha256": "9b935893bb78c26ff753e21f290d3007762cc8f3c1781e06c13bd628632f82de" + }, + "band_compiler.py": { + "size": 3702, + "mode": "100644", + "git_blob": "49d3675027743cb7f1ed91765da5b92ba0819a90", + "sha256": "64d96e1b732117983bf5f5cba3c59ba91b672ae0f03fc23477c8727c4109a701" + }, + "band_positive.py": { + "size": 3683, + "mode": "100644", + "git_blob": "d2e6cf98c50e5a9a11ef41d5793921890bc6527d", + "sha256": "a279e7f4261f947f32f6b0e641bacf95b69755e7ac9263e3df60698bb425b5e8" + }, + "band_product.py": { + "size": 4311, + "mode": "100644", + "git_blob": "4fba42dc54ac9ccfcebe35ecbf5b4a16f130455f", + "sha256": "7feb08718d511b45d0e9f927540115c9c1526f9b65ff3dadaef55b1ac8a2b19d" + }, + "binary_receiver.py": { + "size": 4436, + "mode": "100644", + "git_blob": "d6652929234d9232d824603e15ebc2990047d216", + "sha256": "2be42f476aa71cc2d2ad44392113151e101e56f7a09b7264fc98a74393756372" + }, + "build_charts.py": { + "size": 1333, + "mode": "100644", + "git_blob": "65492d9f8d403e1f467957501ad6dd1bfd9a23ac", + "sha256": "5ae0a7e6509ed81b03e42534ea2a82a01b8edf5dec3ef9d9b9dca49bd424725c" + }, + "calibration.py": { + "size": 2963, + "mode": "100644", + "git_blob": "9992aee320983f7e0fcbd650643d2dcc4674e3c8", + "sha256": "c36a253ab22f77381fe3e36889c9175680eadfd4a1203f2047141dc7a772f679" + }, + "check_activation_space.py": { + "size": 2953, + "mode": "100644", + "git_blob": "5dfbd8e718da6bf451e440ffb0ac0bcb51a25b28", + "sha256": "51df69d2e2c396a8bf4d6f51572e3d04250237ee23b6d3bce25bf02625f07eee" + }, + "check_band.py": { + "size": 9019, + "mode": "100644", + "git_blob": "2a453d888f53d668ed573c2db80805f984f5f27a", + "sha256": "21343d0f71d82986a5cfeb2fd7f2da4836bee5ac54eeca3608d012f994c237f6" + }, + "check_dense_band.py": { + "size": 1335, + "mode": "100644", + "git_blob": "eabff4f9911ab4423ba38ea1c9a7ca737cb8e0e1", + "sha256": "7b06a2d8c0e23897b93dbd9075123553495d51258a63ee9b8c940d76cb1db44b" + }, + "check_epoch_reentry.py": { + "size": 2630, + "mode": "100644", + "git_blob": "fa1f66b44153505051ccd0c6461b7dce73394735", + "sha256": "5764c34527e1c7b06456864f8628fdd12cc8ec2f0c47f07d4a75151663abf129" + }, + "check_linear_geometry.py": { + "size": 8659, + "mode": "100644", + "git_blob": "e8c636fc61fb8e56bc840083768bfdd83c3e77af", + "sha256": "57ed4d3111de70a9ed1ac42717f7c2c9d02073878ca2b3e211cb22e2989c5616" + }, + "check_product.py": { + "size": 4876, + "mode": "100644", + "git_blob": "c1af1bd9cc64615041a0ea908ebf4d66076936de", + "sha256": "5ace944e196d730ba966c042ddff6eccd2022e04f721619dfe47f45eefd64177" + }, + "check_strong_binary.py": { + "size": 9959, + "mode": "100644", + "git_blob": "05f8801667ef417fe63a710c01ef8d94a3df0f76", + "sha256": "dd5acaa148e4bf04fd395515010660678600e7fc1e8ef806c6446a448568aa8b" + }, + "check_strong_complex.py": { + "size": 9287, + "mode": "100644", + "git_blob": "cc1232dabcf0523dd22ac3a23c2bf78b49620e90", + "sha256": "ab3ae76bfbd2238d7c41b130a4de8f73f65f7bec3bba92973d914abaaa72cd0a" + }, + "check_strong_physical.py": { + "size": 3512, + "mode": "100644", + "git_blob": "754f4430b05a2d90c0228a468f26fe8f35409b96", + "sha256": "c1497710e88267cff463ca0ad47acca4d8e88d48c8c4cf563e6ad35c2836d978" + }, + "check_strong_raw_word.py": { + "size": 6304, + "mode": "100644", + "git_blob": "32d3cc9d3ba4c2c87dec73c0254b3bf7d69adf5a", + "sha256": "946fbb355f21536287a9af5812bc833c14a50a0aa0a455c5fdaff2b28ff15465" + }, + "check_weighted_binary.py": { + "size": 6921, + "mode": "100644", + "git_blob": "5e500f36231e9575041fec8c01726605ae629013", + "sha256": "fe70753a3c62f8e3b9b39e526311ae1e5bf4743bfba9d66f0320adcbaa52fade" + }, + "epoch_tape.py": { + "size": 6294, + "mode": "100644", + "git_blob": "2a54438538061dc06f3286ef9624f43c187abb0d", + "sha256": "c66b8c040571471170581b0c577a36f5d2c1283aac517bdc6f407122b945df04" + }, + "independent_binary_price.py": { + "size": 4835, + "mode": "100644", + "git_blob": "9cc55c5655f35f99aa017cad2e59ea4d0dcaac81", + "sha256": "1936595a79fbfa14ec74af3b4e521216740d00bd45f379b5e97a1440e5a2aaf9" + }, + "inputs/complex-source.json": { + "size": 1309, + "mode": "100644", + "git_blob": "6e1030bb2e40ec36e264a27a030dcbf8e2ee5554", + "sha256": "b33575085bcaf8e646ad7656d1f8d2c7ad402712e6b49efd307fc926f2fb39b0" + }, + "inputs/complex-source/BANK-FACTORS.json.gz": { + "size": 4098, + "mode": "100644", + "git_blob": "de611b5588be4ed1a22225b030c7994d0ef3e3f1", + "sha256": "b009cd6bb13036879214cb6d43beb923578ef7fb4c83f36a1cc971ab4ea23543" + }, + "inputs/complex-source/BIDIRECTIONAL-QUOTIENT-RECEIPT.json": { + "size": 1075, + "mode": "100644", + "git_blob": "7606122e82f72718048e6c53e9cd37ba684d11fc", + "sha256": "459f519593242a3e8ecf42817f178fb214a6833e0df0e1ce727c5809035d02de" + }, + "inputs/complex-source/BIDIRECTIONAL-QUOTIENT.json.gz": { + "size": 42126, + "mode": "100644", + "git_blob": "93b35fe94405b77409182cf0d3de06c2227ea096", + "sha256": "ed725d5c69a507352efc6a18f3e4f7e5c20592a655a7b80193034232feb43d6f" + }, + "inputs/complex-source/BIDIRECTIONAL.json.gz": { + "size": 115971, + "mode": "100644", + "git_blob": "3c91100fb02b95bf163fcccd1637dcc0bfc1b48a", + "sha256": "baf07c7085f588ce06201e2a6bf4f5f58632801202783ca195d3b8369ff74836" + }, + "inputs/complex-source/HELPER-SPLITS-RECEIPT.json": { + "size": 995, + "mode": "100644", + "git_blob": "f35d9f85be917ddc6f6743b4b45fd4a8274fc69c", + "sha256": "712b783baf1463b738bd5c5ad3023bf42681d7d0105dd550ba3549c02674f711" + }, + "inputs/complex-source/HELPER-SPLITS.json": { + "size": 3361, + "mode": "100644", + "git_blob": "a6225bf11bc9b0710f9f123da2143c1039e91dc0", + "sha256": "f70ba89a9ed5839476bbe298d4cb8f4d9eeb703621d5f478c884861cdd91fb20" + }, + "inputs/complex-source/LAYOUT.json.gz": { + "size": 7865, + "mode": "100644", + "git_blob": "3ee3637e63e4a2c135b29ae44b39937d6f33ab4b", + "sha256": "84cd1d11ff454eecf3504e4b3f26adc371539b17553bfce1bcfda7a331811998" + }, + "inputs/complex-source/LICENSE": { + "size": 11357, + "mode": "100644", + "git_blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64", + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + }, + "inputs/complex-source/PARENT-NOTICE": { + "size": 1694, + "mode": "100644", + "git_blob": "fe51894a1a630c6feee4b13da2a0499e41ee6edf", + "sha256": "b213998c8dae6d88e4a1f0fd17c81dd78c31ef35bc9460fa16ca692326f1a02b" + }, + "inputs/complex-source/WORD.json.gz": { + "size": 617321, + "mode": "100644", + "git_blob": "31786df96c1da3fe7adc42e30839265b29a90964", + "sha256": "731246c085638706bdb97e7e88618f8923e27ee4ce8eb4869f0847f8f4699f7c" + }, + "inputs/complex-source/replay.py": { + "size": 10929, + "mode": "100644", + "git_blob": "129817a60c7949749d22b9a0523aa27cea4780c9", + "sha256": "9c847a1242e730acf1dfd3a83f4801470e3e2da6c3079f53ccb7ada620b37a7b" + }, + "inputs/complex-source/verify_bidirectional.py": { + "size": 6798, + "mode": "100644", + "git_blob": "dad44147182f126ff75757bd14977d04272aed3c", + "sha256": "ef85db5c6f348b55e0db4d61517dde6a58b027737037e14b9fdea04f8b96e716" + }, + "inputs/complex-source/verify_component.py": { + "size": 7051, + "mode": "100644", + "git_blob": "6f2aff9a042ced040502e3e9fef0b47adc428f59", + "sha256": "163b1ca3a35531da94ef454229f040592c754675f59dfb805d0a9aadb33b8d65" + }, + "inputs/complex-source/verify_split_helpers.py": { + "size": 3731, + "mode": "100644", + "git_blob": "d596f75f1ff185c642f66209f04315d4770a1186", + "sha256": "6a0b59657bd1902d19b9c0f8badef2caa13c8ba84e0311550d6391360bdf186b" + }, + "inputs/new-charts.json.gz": { + "size": 1464, + "mode": "100644", + "git_blob": "04d818a87cac2b384cba4358b26d6e40d592552f", + "sha256": "b626b1ebc3359a36c4437b6916a340597bc74403b65f5a05f057602f5b6d35b0" + }, + "inputs/review.json": { + "size": 1445, + "mode": "100644", + "git_blob": "be3441d8ebb63d2235593a74c2a186dcea711dff", + "sha256": "614a5d273fc8a676b12d512ae9282f88990e696f978a2800f6cd7f986d295874" + }, + "inputs/review/check_complex.py": { + "size": 6659, + "mode": "100644", + "git_blob": "e1c0793e65ee4968f69f02ff947719ada284cc42", + "sha256": "ce8dc94ccc9fc780b991aad35aceba03b95335f9fd5b77235deb9e1a7f52e9f8" + }, + "inputs/review/check_periodic.py": { + "size": 7672, + "mode": "100644", + "git_blob": "f18ce6df234bcddb21fd46871773f25a66cf9fa5", + "sha256": "c1a5c81b5a4121498886758dd021ffdaa237c9fdc6e71e0d315a80947edc70d5" + }, + "inputs/review/check_powered.py": { + "size": 5924, + "mode": "100644", + "git_blob": "2f1c1192cdc2fe298622a837f830182e5c231c0b", + "sha256": "fc81d8d652b4290f473874114f72d4c7c8213ee4f26f5be8968894e01f786c35" + }, + "inputs/review/clifford_exact.py": { + "size": 6824, + "mode": "100644", + "git_blob": "166841a037f069249f6f7f6dedb89248812f59e2", + "sha256": "2982ead07721e83358dc67c6f49c2b4c16a236a6bebdfd72f58221be1f5d0962" + }, + "inputs/review/graph_identity.py": { + "size": 3801, + "mode": "100644", + "git_blob": "b372fd19ed4d24a630d04d3e51f9c7e55bf8e902", + "sha256": "90440581667a00a8e0a8e02a8a5a196a88dc0edb48eb8e89c22603e615524681" + }, + "inputs/review/native_verify.py": { + "size": 12323, + "mode": "100644", + "git_blob": "2c209dfa9cfade3bc20ac5fc9d876b433a147f8c", + "sha256": "3049471905b47b385c88378a1a3be7a18b8858aadd035b8a6da2f4a03b470f38" + }, + "inputs/triangular.json": { + "size": 1314, + "mode": "100644", + "git_blob": "349cba11da90a2ff5539dec904389cb904899b52", + "sha256": "8474fd210582be93568bef852910cc9a11fbfc5da710e29dd4ce50fbf47be54d" + }, + "inputs/triangular/LICENSE": { + "size": 11357, + "mode": "100644", + "git_blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64", + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + }, + "inputs/triangular/NOTICE.md": { + "size": 3860, + "mode": "100644", + "git_blob": "9323d93ce13ff8f924006a4218f94efb9edebc52", + "sha256": "7ec57034ab47631a47e35ab9cd86a563a6a4bb2ce7397d545861f898281c696c" + }, + "inputs/triangular/direct_body.py": { + "size": 6255, + "mode": "100644", + "git_blob": "e8d742d9efab1be4283c7b13d0a17c6faad0d989", + "sha256": "f4ca3082b95f958b50f84a3c138667add0051d6a796e7f63afe95d41cf24e7af" + }, + "inputs/triangular/inputs/retained.json": { + "size": 6679, + "mode": "100644", + "git_blob": "43a35ae8c03f612b57705b3b80caa38f5d91ae22", + "sha256": "4d0dd81eb156c97403d752a3dc654d85a93b0284aed8cfa5eed840259f6abd88" + }, + "inputs/triangular/inputs/retained.tar.gz": { + "size": 1083295, + "mode": "100644", + "git_blob": "c1a75d8f555f109cb522d3050ce00d75b20efdb8", + "sha256": "77742c09b088f27e8742c3fad7b7148d3397e4d51b95312106f39a8970165903" + }, + "inputs/triangular/limb_scale.py": { + "size": 3839, + "mode": "100644", + "git_blob": "2c7243ddb889b5fd858d0b6714a43b5af02bfb78", + "sha256": "ed7c27348c2bc8259683b617c45bb0ee6aacb781c0ad04168c59035b7b5cf8ff" + }, + "inputs/triangular/multiplier.py": { + "size": 4185, + "mode": "100644", + "git_blob": "512cc8cba444b4579b414bef843d7d376ecf4067", + "sha256": "e805fb05caaa76d4c65dc3a55b99c6332a1c3772516547cf24e8027ade718cf4" + }, + "inputs/triangular/quotient_route.py": { + "size": 11607, + "mode": "100644", + "git_blob": "fc8502647a9626ffd4047cb7046b80ecc83afb5c", + "sha256": "3243f45d6097a80bc8b077d8682426e4555f6c4a3097bd0a12ffd4f1f5c45ba8" + }, + "inputs/triangular/receiver.py": { + "size": 10352, + "mode": "100644", + "git_blob": "37646beb735d42e86f3f9d54b6d0997a7eee30da", + "sha256": "09d2e9508e3e34934a6f2132c6e864f6b4ba68fa96aaadbec0a1902aa7762642" + }, + "inputs/triangular/retained.py": { + "size": 1830, + "mode": "100644", + "git_blob": "47d494454262cf9a12ec9ca57b9da5bb38dd5bc6", + "sha256": "970e71bb0fcab41a03ccc5068ddc5e0df5c00953098f542fdc1a3e0e2048ffda" + }, + "inputs/triangular/same_order_body.py": { + "size": 6478, + "mode": "100644", + "git_blob": "0b7afa194a7152cf221964a14ebfffc642209fcf", + "sha256": "56a15ce431daf25794741cb5157e136ce509ed646b32aaea34348088396e459d" + }, + "inputs/triangular/staged_carriers.py": { + "size": 5578, + "mode": "100644", + "git_blob": "4dd73b0d36850c80e2f446096d971fd0b1b409aa", + "sha256": "6c925ae4b39dc9999ac5891d1a27dcbb38e129a36e1473b2b418f27a806b6fc4" + }, + "inputs/triangular/triangular_ordinary.py": { + "size": 3674, + "mode": "100644", + "git_blob": "f9f44f18527ae0c7f705558962aea519ca7bc107", + "sha256": "1f69f21881229566e0b251a2edd8a3c9ac6409eeebdb68ee046f27e74dd8af71" + }, + "lean/.gitignore": { + "size": 7, + "mode": "100644", + "git_blob": "01f8cdb637da2370fa79960e25efa59dd8cffd6d", + "sha256": "fde850d24186b6e99c8c0debd641fb3ab85198b109eb66f71a1fea02bd6ea1b3" + }, + "lean/BandFlow.lean": { + "size": 15134, + "mode": "100644", + "git_blob": "71e109b0abba123f91302a913cf51d5e3b2ac631", + "sha256": "c47338afcf5a35e992df47ea4d11e89709a848041ef680a77c39acd57384342a" + }, + "lean/Profiles.lean": { + "size": 2148, + "mode": "100644", + "git_blob": "2423069aa74f1c739858c5a8fb272c0665cd9879", + "sha256": "53bcad234dac897478d35260598d602cc79b545e979df18efb6f82ba6667617a" + }, + "lean/SquareSieve.lean": { + "size": 6694, + "mode": "100644", + "git_blob": "183d1e6705049461e4375fe2b4d21cacc324d10d", + "sha256": "4aa9e9693a8006981aac783f7a7302b4102505c544203f69062d3073c4e83618" + }, + "lean/lake-manifest.json": { + "size": 3551, + "mode": "100644", + "git_blob": "f27574d9f7d30f24567df0789cd81751f0819998", + "sha256": "3b30b2d7e59f23142ff2028b8beec632936359b7fe3e904e8984d842a44b1488" + }, + "lean/lakefile.toml": { + "size": 304, + "mode": "100644", + "git_blob": "cac451e8fbd658c5c88eb6b8511b943bfce75d07", + "sha256": "34e23113b620bf67211a36526ebb9a768d4cddb5ba2e990b8d3222540875e19d" + }, + "lean/lean-toolchain": { + "size": 25, + "mode": "100644", + "git_blob": "ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5", + "sha256": "d5edba4e4b8faad9c1baeadb265716d20d03be4d1a2647dc5e35b0c0325bea7b" + }, + "linear_geometry.py": { + "size": 3145, + "mode": "100644", + "git_blob": "f042bfa42f75bfb3d2b59501b13f54aad197a9bf", + "sha256": "6628fcddf1eed2ffa39c2d3256d79577b950e04c4a688161a66ba92baa3fb7c2" + }, + "ordinary_carrier.py": { + "size": 2681, + "mode": "100644", + "git_blob": "15382c98cb39d8f0ef999f8cfd46aaa5e23e8a96", + "sha256": "c8e87147661a394bc7e1b879744546b7697fcde7f3636556b39ca1623a9d7b31" + }, + "positive_dispatch.py": { + "size": 2393, + "mode": "100644", + "git_blob": "6846c690e0292e9c9f1d19fb6cac3713ea0c1e73", + "sha256": "8bd147f6fd1a22b8b4519d165a290b46ab50870246345cbb0740a405f49a9a73" + }, + "prior_setup.py": { + "size": 2905, + "mode": "100644", + "git_blob": "282d755de195893b85f33ceed9d5d017e3e97a25", + "sha256": "28fa12b5290033e50e145e374d2c42b564b30ecdb2f4309213834b5a10981d5a" + }, + "resources.py": { + "size": 2918, + "mode": "100644", + "git_blob": "36cf93f347623bfe15a8fdf9a0178db68dd155a8", + "sha256": "13027d55cb74e2f53f2c182c6dce3a99c0886d2f6bc51da62df5746e3054f94e" + }, + "strict_moment.py": { + "size": 2618, + "mode": "100644", + "git_blob": "f95dff0192befe7631d1df9fc8261de98e051765", + "sha256": "899ce86a0e5ae0455ea6cf97934658b2fd31b81d7111cb2bd636ce10e3e7264d" + }, + "strong-bit.json.gz": { + "size": 135471, + "mode": "100644", + "git_blob": "16f8cafb1c4d139a99a62e46eb40c118e6176c34", + "sha256": "74e93daf2b7acf794ffb51f92f03f51556f68126d41ee13a8969bddb4cbe6326" + }, + "strong_binary.py": { + "size": 4722, + "mode": "100644", + "git_blob": "913e4faaa31709796e0bc70d9ae120555acadad0", + "sha256": "03ffb2075620fe793156e9bd22890185bef21e097abadba3a7d6cb5406051855" + }, + "strong_complex.py": { + "size": 4381, + "mode": "100644", + "git_blob": "3d5fa9f9b2bdecd9aa179af7d1fc55d3e998bb4e", + "sha256": "0c9a103a322df6c18b9b3754e5756f07ce02130a131d20a1bb254d47175cfa5e" + }, + "upstream.py": { + "size": 1128, + "mode": "100644", + "git_blob": "f68872df228508a3227cbb406caab27ddd0e5655", + "sha256": "d9b079965d8abc04be3eda662fc84ba9a08c4f03e8ccc7bd3e775876164e6c10" + }, + "verify.py": { + "size": 3506, + "mode": "100644", + "git_blob": "c0b5cbeba13d70d534e697c4288b62fb86259430", + "sha256": "20ab1e4bc2d2944ddb59f774c09977439a70e10389b7f28454f0b00fd81d5cc9" + }, + "verify_formal.py": { + "size": 1959, + "mode": "100644", + "git_blob": "0f35787441541c83b82422a81e1a28a7fc3f6550", + "sha256": "b9e908e09467794a52fd10d32ed6a1eb6f63e1d37726520af493825285f1db85" + }, + "verify_sources.py": { + "size": 2347, + "mode": "100644", + "git_blob": "a3ef7f778829e73ee80fcda0fb0df3f864359b84", + "sha256": "6ef97baeafb01cb0fc9afb6ff7beb779cea93755620f836f9e4db5307e3cd365" + } + } + }, + "paired_native_source": { + "pr": 8027, + "head": "fb9b6a7b0d27da1cf98430893a3016bf811e2aa4" + }, + "comparative_profile": { + "pr": 8032, + "head": "9c5881ab4015854c68d5f5a3fc7d97f68505cc4c", + "kappa": "0.00389011528633", + "largest_BIT_rank_exponent": 114688000000000, + "sufficient_public_exponent": 136798773006437 + }, + "split_tariff_comparator": { + "pr": 8033, + "head": "a1313ff9f84fd00d50b282fe432e522191277821", + "kappa": "0.003890115286352", + "largest_BIT_rank_exponent": 112000000000000, + "sufficient_public_exponent": 119466661575676 + }, + "signed_inequality_source": { + "commit": "4f7c67ae387cc91580f469aeda4d508b372b9ec1", + "path": "research/p104-dual-supplier-lift/complex/supplier_gate.py", + "sha256": "3796b2e5a27f3caa142d16364154788e60d0099f1e24a8dcd028e4fbd35a84ca", + "kind": "external exact provenance of the self-contained expression transcription" + } +} diff --git a/research/p104-six-stage-resolution/PROOF.md b/research/p104-six-stage-resolution/PROOF.md new file mode 100644 index 0000000000..31bfd646a3 --- /dev/null +++ b/research/p104-six-stage-resolution/PROOF.md @@ -0,0 +1,174 @@ +# The moment threshold and the six-stage grid + +This note separates a theorem about the **abstract moment invoice** from an +installation of one particular paired multiplier. The latter retains the +all-size premises listed in the README. + +## Definitions and the raw crossing + +For the fixed 36-call binary word, let + +\[ + T(s)=\sum_{\text{productive }i}r_i^s,\qquad + P(s)=\sum_{\text{paid }j}r_j^s,\qquad t=1-c, +\] + +with every occurrence counted, including repeated ranks. The source has +18,906 productive and 104,904 paid occurrences. Set + +\[ + \alpha(c)=P(t)/T(t),\quad + \gamma(c)=P(t+593/2048)/(12^{593/2048}T(t)),\quad + \lambda(c)=15^{491/1024}T(t-491/1024)/T(t). +\] + +The replay reconstructs these inventories from the source word. Its +outward-rational log/exp series prove that \(D(c)=T(1-c)-P(1-c)\) has +opposite signs at the endpoints of + +\[ + 0.0038901152865944611299969420\), an +integer floor \(L>2/\epsilon\) makes the usual `2/L` surcharge fit; a +power of two can be chosen. Conversely, at or above the raw crossing in +this interval, \(\alpha\ge1\), so this strict invoice cannot pass. +Thus the supremum of prices for this **specified abstract invoice** is +\(c_*\). This conclusion does not assert a physical construction for +arbitrary \(v,L\), or an upper bound for other invoices or words. + +Let \(\delta=c_*-c\). The least sufficient integer power satisfies + +\[ + v_{\min}(c)=\Theta(\log(1/\delta))\quad(\delta\downarrow0). +\] + +For the lower bound, \(\lambda\) stays above some fixed \(a\in(0,1)\). +Any sufficient \(v\) obeys +\(a^v\le1-\alpha^v\le v(1-\alpha)\le C v\delta\); this excludes +\(v=o(\log(1/\delta))\), and yields a positive constant lower multiple +of \(\log(1/\delta)\). For the upper bound take +\(v=\lceil K\log(1/\delta)\rceil\), with \(K\) large enough that the +uniformly subunit \(\gamma^v\) and \(\lambda^v\) are each at most +\(\delta^2\). Since \(1-\alpha^v=\Omega(v\delta)\) for this choice, +these two tails fit for all sufficiently small \(\delta\). The +constant coefficient \(\theta\) changes constants, not the order. +The floors are chosen after the positive surplus and may grow with +\(c\); this is not a fixed-precision or fixed-resource convergence +claim. `SCALING.json` gives finite directed controls at seven distances +below the lower endpoint of the crossing bracket; it is evidence for the +endpoint calculations and finite examples, while the asymptotic assertion +follows from the argument above. + +A sharper expansion follows because the split ratio exceeds the final +productive ratio at the crossing. Put \(\Delta=1-\alpha(c)\), +\(A=\log(1/\Delta)\), and \(a=-\log\gamma(c_*)\). If +\(x_\theta\) is the unique positive real zero of the surplus, then +\[ + a x_\theta=A-\log A+\log(a\theta)+o(1). +\] +Indeed, at the zero the dominant balance is +\(\Delta x_\theta=(1+o(1))\theta e^{-a x_\theta}\); taking logarithms +and substituting \(x_\theta\sim A/a\) gives the formula. The least +integer power is \(\lfloor x_\theta\rfloor+1\). The two continuous +threshold powers therefore differ by \(\log(128)/a\), about 49.83 continuous +factors in the limit; the difference of integer minima has rounding error +strictly less than one. [Expanded proof and finite examples](SCALING.md). + +## Literal six-stage upper envelope + +The #8035 stage rule pays a positive debit \(d\) at height \(H_i\), +then requires + +\[ + b_i<\min\!\left(\eta,\frac{249(c-d/H_i)+b_{i-1}}{250}\right), + \qquad b_0=0. +\] + +The first five rates are rounded by the source to +`(floor(10^18 * limit) - 1) / 10^18`. The sixth is a separately +specified ordinary rate. Omitting the positive debits and the other cap +only increases an upper envelope. Iterating the source's exact first-five +rounding at \(c_*\), the five maximal ticks are + +``` +3874554825448082 3890053044749874 3890115037627081 +3890115285598590 3890115286590476 +``` + +and the final limiting ordinary rate lies in +`[0.003890115286594445189476954232, + 0.003890115286594445189476955228]`. Thus a signed \(\kappa\) +reported on the `10^-18` grid, necessarily below the ordinary rate, is +at most **0.003890115286594445** for this source, six-stage rule and raw +price family. This is an upper bound, not by itself a witness that the +last tick is attainable. The coarser continuous bound +\(c_*(1-250^{-6})\) is valid but slightly less sharp. If the trial is +restricted to the `2^-56` denominator used by #8035, even this coarser +bound limits the report to the 440 tick. None of these statements covers +other operator words, tariffs, stage counts, grids or caller rules. + +## Fixed finite installation and model boundary + +The included profile receipts evaluate concrete signed margins, both +supplier debits and all six exact rates; their checkers retain rejection +controls for a trial above the crossing, a paid rank-one addition, +vanishing or insufficient stopping margin, and equality at each paid +supplier border. For the last tick, the fixed stop denominator is +\(D=10^{21}\), a 70-bit integer with 29 one-bits. The capped +repeated-square comparison uses at most 69 squarings and 29 multiply/compare +steps, with operands bounded by \(h+1\); a sequential schoolbook +lowering costs \(O(98(1+\log h)^3)\) transitions and +\(O(1+\log h)\) work cells per test before inherited outer accounting. + +At the maximum binary log-rank \(H=1{,}024\cdot10^{21}\), +\((5/4)^{13}>2^4\) gives +\(G+1\le\lceil13H/(4\cdot430)\rceil+2\le +7{,}739{,}534{,}883{,}720{,}930{,}232{,}561\). The former +instance-specific \(G<2^{50}\) is false here: the attained rank-15 +productive path and rank-12 paid block give +\(G>\lfloor(H-2-8\cdot430)/430\rfloor= +2{,}381{,}395{,}348{,}837{,}209{,}302{,}317\), greater than this host's +`sys.maxsize`. The checked source-slot logarithm is at most 26,038; the dynamic local allowance is 53,044 and +its next-power-of-two allowance is 65,536. The stage quotient guard uses +the actual \(\eta=39/10000\): +\(Q(H)=\lceil10000(2H+64)/9961\rceil<3H<8H\), at every stage. +These checks bound the stated finite profile; they do not prove the +inherited compiler transfer for arbitrary powers. The reference Python +also constructs eager tuples for powered source paths; at least +\(444^{430}>2^{3440}\) retained target paths exist. A finite-tape +lowering must enumerate and charge these paths rather than materialize a +Python tuple. [Fixed-rank lowering and limits](BRIDGE.md). + +The source uses finite but astronomical rank and precision constants. Its stated asymptotic implication is **conditional +in the ideal finite-tape model**, retaining #8035's all-column native +action, owned erasure/restoration, compiler transfer, precision/tape +services and analytic recovery. Feasible host tests exercise selected +finite interfaces only; they do not execute the astronomical production +tapes or independently prove those five all-size premises. + +Increasing \(v\) indefinitely is a separate physical problem: the fixed +positive height in these finite examples cannot support unbounded native +volume under the retained stripe inequality. The abstract supremum and +logarithmic power theorem therefore do not establish that the full +multiplier approaches \(c_*\). No practical crossover or selected +frontier is claimed. diff --git a/research/p104-six-stage-resolution/README.md b/research/p104-six-stage-resolution/README.md new file mode 100644 index 0000000000..512ef6db3f --- /dev/null +++ b/research/p104-six-stage-resolution/README.md @@ -0,0 +1,139 @@ +# Six-stage resolution of the fixed P104 moment tariff + +For the fixed 36-call P104 binary source, this package proves a logarithmic +scaling theorem for a specified split/prune moment certificate, computes an +exact upper envelope for the source's six-stage reporting grid, and gives a +concrete conditional installation at its last permitted grid tick: +**κ ≥ 0.003890115286594445**. The increase over #8035's conditional +`0.0038901152865907` is exactly `0.000000000000003745`. This is a +nearer installation of the same paid word, not a cheaper word, a practical +crossover, or a change to the selected result. + +The abstract moment certificate has supremum \(c_*\) in the directed +interval `[0.003890115286594461129996942, +0.003890115286594461129996943]`. For a distance \(\delta\) below this +crossing, the least sufficient power is \(\Theta(\log(1/\delta))\) when +the floor may grow. A second-order expansion quantifies an asymptotic +49.83-factor saving for the refined split coefficient before rounding. This result is about that invoice; it does not supply +all-size multiplier implementations as the power tends to infinity. +The literal six-stage rule, with its five floor-minus-one `10^-18` grid +rates, has the stricter limiting ordinary bound +`0.003890115286594445189476955228` at the upper endpoint. It permits no +higher `10^-18` reported κ for this rule and fixed raw source. +[Statement and proof](PROOF.md) · [Directed calculations and finite examples](SCALING.json) + +The last-tick profile uses a `430`-factor binary word, `15^430` +productive cutoff, `12^430` paid cap, floor `2^70`, stop exponent +`g=10^-21`, dyadic binary trial +`1175715202810401744919/302231454903657293676544`, and full binary and +positive debits of 31 and 10. The independent directed engines certify +a strict classic split-tail surplus greater than `3906/10^21` before the +`2/2^70` surcharge. The six rank logarithms are `10^21 * 4^i`, +`i=0,...,5`; the largest is `1024000000000000000000000`. The sufficient +public precision exponent is `1365004016064257029713503`. These constants +are enormous, and no host executed a production-dimensional tape. +[Last-tick receipt](LAST-TICK-RECEIPT.json) + +The hosted nine-stage local-word packing ceiling in +`research/complex-local-word-ceiling/ceiling.py` assumes a different +coverage law; its applicability to this 48-call paired supplier is not +established. As a replacement scoped bound, the fixed binary word's raw +crossing gives \(0.999999999999995853594108487 < \kappa/c_* < +0.999999999999995853594108745\) for the reported candidate. This is a +fraction of that raw price ceiling, not a complex local packing cap. + +An earlier `384`-factor installation at `0.00389011528659443` is retained +as a separately checked intermediate profile. [Receipt](CANDIDATE.json) +Both profiles retain #8035's all-size premises: all-column native action, +owned erasure and restoration, compiler transfer, precision and tape +services, and analytic recovery. Their stated asymptotic implications are +conditional on those premises in an ideal finite-tape model. The finite +replay tests source identities, arithmetic, selected feasible operator and +product controls; it does not independently establish the inherited +all-size premises. CPython array and file limits preclude the astronomical +instances, and the necessary final rank bound already exceeds this +machine's shift-count range. The actual source forest depth exceeds +`2381395348837209302317`, and eagerly materializing its retained targets +would require more than `2^3440` tuple entries. A tape implementation must +explicitly lower and pay the enumerator, stack, offsets and record scans; +[the bounded bridge](BRIDGE.md) establishes selected controls, retaining +the inherited compiler-accounting premise. A green finite replay is not a +human or proof-kernel review. + +## Reproduction and source identity + +Use CPython 3.12 and the standard library from a checkout containing this +package: + +```sh +python3.12 -IB scripts/research_package.py --package research/p104-six-stage-resolution +``` + +For a self-contained offline copy of this directory, run the same cases +from inside it: + +```sh +for case in price band dense binary grid atlas physical product; do + python3.12 -IB verify.py "$case" +done +``` + +`VERIFY.json` specifies the registered per-case timeouts. Each case +reconstructs a private temporary tree. The archive is the byte-identical +#8030 package at `6285dd829114705862e8d91facaedc1f31d3cfcb`; +`PREDECESSOR-SOURCES.json` and `OVERLAY.json` are exact #8035 files from +`ea776471bf8ed143a0625cf2d7532f65d15eb5f9`. The verifier authenticates +all 91 archived files, their Git package-tree identity, the sequential overlays, +and unchanged inherited profile rows. The archive contains the sole copy +of the #8027 graph (SHA-256 +`74e93daf2b7acf794ffb51f92f03f51556f68126d41ee13a8969bddb4cbe6326`). +The exact independent log/exp reader `verify_funding.py` comes from #8041 +at `05f6172d4d9487090fa24c75137a7c60e6fcd67e`; it is used as a library, +with the graph and caller read from the authenticated reconstructed +archive. No second copy of the graph or ancestor archive is required. +Archive and file identities do not establish that the full source history +is present. Concurrent [#8042](https://github.com/CrocSwap/integer-mult-bounds/pull/8042) +at `3d33cb0c8a523b66d91e8de8250b85d0a436eb35` retains the #8035 rate +and uses a different unpowered retimed construction; it is not a replay +or proof of this powered profile. Related #8040 was inspected at +`c7f35d0f798aae9bf27bce2a64e8d4e2390d78d5`. The scientific branch is based on prerequisite commit +`0618e75a22cec54d1651394ef83d088551b7f026`, whose parent is the pinned +upstream main snapshot `e54523517d0f03e58352e647c403a5af3e525a57`. + +The `price` case checks both retained profiles, their strict margins, the +source-grid ceiling and the scaling receipt; the other cases cover +feasible band, dense, binary, grid, atlas, physical and signed-product +controls. Last-tick receipt comparison records the host `sys.maxsize` but +excludes that environmental field from byte-independent numerical +comparison. A candidate-profile Product is explicitly bound and checked +on the feasible product. All 157,248 H calls in that small product use +the local kernel, not the candidate positive supplier. Separate tests use +a mock to check `Product.h` supplier-parameter forwarding and halt the +positive stop branch before the supplier; they do not run that word at +production scale. `BRIDGE.json` records the finite tape and dispatch +controls. See `VERIFY.json` for the per-case scope. + +## Open next questions + +1. Can a legal changed binary word raise the raw crossing? Start with one + explicit changed incidence, and recompute its complete paid/productive + inventory, typed owner restoration, and full caller operator. The + present source has no such replacement. +2. Can all supplier, stripe, precision and recovery obligations be proved + uniformly for a growing number of tensor factors? First derive a + positive-rank and stock allocation as a function of the factor power; + fixed positive height does not support an unbounded naive extension of + the present stripe bound. +3. Can the five inherited all-size premises be independently formalized or + established by a separate proof? Start with an arbitrary-column native + action and its owner/erasure invariant at the stated ideal-tape interface. + +## Credit + +Ali Romman supplied the paired binary and rational circuits and the +single-band tape application; Clear1nsight contributed the #8033 tariff, +#8035 stopping refinement, and #8041 comparison reader. DreamingOfClouds +and the P104 dual-supplier contributors supplied the signed gate machinery. +Other credits and notices are retained in the authenticated archive. +New work used substantial OpenAI Codex assistance. Apache-2.0; see +[LICENSE](LICENSE). diff --git a/research/p104-six-stage-resolution/RESULT.json b/research/p104-six-stage-resolution/RESULT.json new file mode 100644 index 0000000000..1deecfb332 --- /dev/null +++ b/research/p104-six-stage-resolution/RESULT.json @@ -0,0 +1,172 @@ +{ + "baseline_kappa": "243132205397/62500000000000", + "fixed_stock": { + "band_floor": 1125899906842624, + "bit_trial": "280312348082011/72057594037927936", + "certified_surplus_floor_e24": 137497115659, + "complete_requirements": { + "all_size_margin_lower_at_entrance": 46056909860339, + "binary_entrance_logs": [ + 107240551, + 1816224990, + 29159975054, + 466659975118, + 7466659975182, + 119466659975246 + ], + "binary_rank_logs": [ + 106811524, + 1708984375, + 27343750000, + 437500000000, + 7000000000000, + 112000000000000 + ], + "complex_rank_log": 1600000, + "component_exponent": "39/10000", + "full_binary_debit": 21, + "full_positive_debit": 10, + "initial_s": 119466661575677, + "kappa": "9725288215981/2500000000000000", + "linear_geometry": { + "actual_dense_root_entry_log2": 192153584101141164, + "first_extent_bits_minus_b": -119466661575672, + "largest_axis_width": 96076792050570582, + "last_extent_bits_minus_b": -119466661575671, + "log2_axis_count": 119466661575617, + "minimum_width": 61166930726747904, + "private_clock_log2_upper": 98505088387899413501, + "public_offset_above_2_to_A": 2 + }, + "log2_all_fixed_setup_upper": 114688000000000003, + "log2_dominant_J": 114688000000000000, + "log2_rank_part_of_recurring_envelope": 11468800000000000000, + "log2_sufficient_public_precision": 119466661575676, + "native_depth_bound_at_entrance": 75859736, + "native_volume_log2_upper": 65536, + "ordinary_rate": "1556046114557/400000000000000", + "positive_context_cost_bitlength_upper": 58, + "prior_geometry_at_same_n": { + "actual_dense_root_entry_log2": 3380401600608611737324541881004, + "first_extent_bits_minus_b": -119466661575672, + "largest_axis_width": 1690200800304305868662270940502, + "last_extent_bits_minus_b": -119466661575671, + "log2_axis_count": 119466661575573, + "minimum_width": 913426126594389717785472533056, + "private_clock_log2_upper": 14965573658122731675945438736809984, + "public_offset_above_2_to_A": 2 + }, + "rate_ticks_e18": [ + 3874359003879035, + 3890040022613520, + 3890114220608457, + 3890115234520437, + 3890115283396085, + 3890115286392500 + ], + "raw_structural_nodes_log2_upper": 8113, + "stripe_excess_log_at_entrance": 9943087644814, + "stripe_margin_at_entrance": 49790243143022, + "uniform_payload_slope": "759627333958522/9126961279296875" + }, + "factor_power": 268, + "g": "1/100000000000000000", + "kappa": "9725288215981/2500000000000000", + "positive_paid_cap": "1274827/327680000", + "signed": { + "functional": 4, + "ordinary_margin": "3/50000000000000000", + "positive_margin": "27837635479/80000000000000000", + "smallest_margin": "1/1000000000000000000", + "strict": 54 + } + }, + "fixed_word_raw_interval": [ + "1945057643297230564998471/500000000000000000000000000", + "3890115286594461129996943/1000000000000000000000000000" + ], + "largest_gain": "2387/10000000000000000", + "near_crossing": { + "band_floor": 140737488355328, + "bit_trial": "280312348082137/72057594037927936", + "certified_surplus_floor_e24": 25356184201, + "complete_requirements": { + "all_size_margin_lower_at_entrance": 2957494058781171, + "binary_entrance_logs": [ + 6863391165, + 116238391229, + 1866238391293, + 29866238391357, + 477866238391421, + 7645866238391485 + ], + "binary_rank_logs": [ + 6835937536, + 109375000000, + 1750000000000, + 28000000000000, + 448000000000000, + 7168000000000000 + ], + "complex_rank_log": 1600000, + "component_exponent": "39/10000", + "full_binary_debit": 22, + "full_positive_debit": 10, + "initial_s": 7645866239991958, + "kappa": "38901152865907/10000000000000000", + "linear_geometry": { + "actual_dense_root_entry_log2": 12297829382473034412, + "first_extent_bits_minus_b": -7645866239991953, + "largest_axis_width": 6148914691236517206, + "last_extent_bits_minus_b": -7645866239991952, + "log2_axis_count": 7645866239991892, + "minimum_width": 3914683514875883776, + "private_clock_log2_upper": 6304325656722185444502, + "public_offset_above_2_to_A": 4 + }, + "log2_all_fixed_setup_upper": 7340032000000000003, + "log2_dominant_J": 7340032000000000000, + "log2_rank_part_of_recurring_envelope": 734003200000000000000, + "log2_sufficient_public_precision": 7645866239991957, + "native_depth_bound_at_entrance": 4779859471, + "native_volume_log2_upper": 65536, + "ordinary_rate": "389011528659083/100000000000000000", + "positive_context_cost_bitlength_upper": 58, + "prior_geometry_at_same_n": { + "actual_dense_root_entry_log2": 13846124956092873676081323544586924, + "first_extent_bits_minus_b": -7645866239991953, + "largest_axis_width": 6923062478046436838040661772293462, + "last_extent_bits_minus_b": -7645866239991952, + "log2_axis_count": 7645866239991842, + "minimum_width": 3741393315830320735193337899120896, + "private_clock_log2_upper": 61298988086563990959951325070812512256, + "public_offset_above_2_to_A": 4 + }, + "rate_ticks_e18": [ + 3874551620035190, + 3890052831589600, + 3890115024252961, + 3890115284762185, + 3890115286537883, + 3890115286590830 + ], + "raw_structural_nodes_log2_upper": 8623, + "stripe_excess_log_at_entrance": 626505740910746, + "stripe_margin_at_entrance": 3196427379085231, + "uniform_payload_slope": "23931754708979261/292062760937500000" + }, + "factor_power": 285, + "g": "1/100000000000000000", + "kappa": "38901152865907/10000000000000000", + "positive_paid_cap": "1274827/327680000", + "signed": { + "functional": 4, + "ordinary_margin": "9/100000000000000000", + "positive_margin": "5567523923/16000000000000000", + "smallest_margin": "1/1000000000000000000", + "strict": 54 + } + }, + "remaining_gap_upper": "3761129996943/1000000000000000000000000000", + "same_stock_gain": "101/2500000000000000" +} diff --git a/research/p104-six-stage-resolution/SCALING.json b/research/p104-six-stage-resolution/SCALING.json new file mode 100644 index 0000000000..59aafda0ae --- /dev/null +++ b/research/p104-six-stage-resolution/SCALING.json @@ -0,0 +1,232 @@ +{ + "raw_root_bracket": [ + "1945057643297230564998471/500000000000000000000000000", + "3890115286594461129996943/1000000000000000000000000000" + ], + "rank_occurrences": [ + 18906, + 104904 + ], + "price_interval": [ + "389/100000", + "194523/50000000" + ], + "raw_derivative": [ + "-384103.196067", + "-384101.029183" + ], + "split_ratio_at_root": [ + "0.907225472004138239146095", + "0.907225472004138239146096" + ], + "floor_ratio_at_root": [ + "0.900009332074691621646901", + "0.900009332074691621646902" + ], + "split_ratio_on_interval": [ + "0.907224363", + "0.907226722" + ], + "floor_ratio_on_interval": [ + "0.900008163", + "0.900010595" + ], + "six_stage": { + "first_five_max_ticks": [ + 3874554825448082, + 3890053044749874, + 3890115037627081, + 3890115285598590, + 3890115286590476 + ], + "sixth_limit": [ + "0.003890115286594445189476954232", + "0.003890115286594445189476955228" + ], + "max_reporting_tick": 3890115286594445 + }, + "minimum_powers": [ + { + "crossing_reference_minus_price": "1e-8", + "theta": "1/64", + "v": 127, + "previous_surplus": [ + "-0.0000000852696776269474347592756779726728", + "-0.0000000852696776269474347592756779726727" + ], + "surplus": [ + "0.0000001069115700566577354608503247976531", + "0.0000001069115700566577354608503247976532" + ] + }, + { + "crossing_reference_minus_price": "1e-8", + "theta": "2", + "v": 144, + "previous_surplus": [ + "-0.0000001458196394555293057555901913706462", + "-0.0000001458196394555293057555901913706461" + ], + "surplus": [ + "0.0000000630087084310514254157145537164942", + "0.0000000630087084310514254157145537164943" + ] + }, + { + "crossing_reference_minus_price": "1e-10", + "theta": "1/64", + "v": 168, + "previous_surplus": [ + "-0.0000000016064068783085875823065426383610", + "-0.0000000016064068783085875823065426383609" + ], + "surplus": [ + "0.0000000009415459862426596159707591890590", + "0.0000000009415459862426596159707591890591" + ] + }, + { + "crossing_reference_minus_price": "1e-10", + "theta": "2", + "v": 188, + "previous_surplus": [ + "-0.0000000022149006038192025511916325113613", + "-0.0000000022149006038192025511916325113612" + ], + "surplus": [ + "0.0000000004958565761234981199883002102922", + "0.0000000004958565761234981199883002102923" + ] + }, + { + "crossing_reference_minus_price": "1e-12", + "theta": "1/64", + "v": 210, + "previous_surplus": [ + "-0.0000000000135619587201727723579054541795", + "-0.0000000000135619587201727723579054541794" + ], + "surplus": [ + "0.0000000000172893563404404968508766513676", + "0.0000000000172893563404404968508766513677" + ] + }, + { + "crossing_reference_minus_price": "1e-12", + "theta": "2", + "v": 233, + "previous_surplus": [ + "-0.0000000000197744850188564661878290108940", + "-0.0000000000197744850188564661878290108939" + ], + "surplus": [ + "0.0000000000127418525875856750201716681910", + "0.0000000000127418525875856750201716681911" + ] + }, + { + "crossing_reference_minus_price": "1e-15", + "theta": "1/64", + "v": 273, + "previous_surplus": [ + "-0.0000000000000399198322015493412505133950", + "-0.0000000000000399198322015493412505133949" + ], + "surplus": [ + "0.0000000000000019076252201104524738586208", + "0.0000000000000019076252201104524738586209" + ] + }, + { + "crossing_reference_minus_price": "1e-15", + "theta": "2", + "v": 301, + "previous_surplus": [ + "-0.0000000000000251394589112296427449922733", + "-0.0000000000000251394589112296427449922732" + ], + "surplus": [ + "0.0000000000000163796130050396468457367625", + "0.0000000000000163796130050396468457367626" + ] + }, + { + "crossing_reference_minus_price": "1e-18", + "theta": "1/64", + "v": 338, + "previous_surplus": [ + "-0.0000000000000000127125372162685820211666", + "-0.0000000000000000127125372162685820211665" + ], + "surplus": [ + "0.0000000000000000349186114484563596341199", + "0.0000000000000000349186114484563596341200" + ] + }, + { + "crossing_reference_minus_price": "1e-18", + "theta": "2", + "v": 370, + "previous_surplus": [ + "-0.0000000000000000121444347787938516224728", + "-0.0000000000000000121444347787938516224727" + ], + "surplus": [ + "0.0000000000000000367981298211343486782535", + "0.0000000000000000367981298211343486782536" + ] + }, + { + "crossing_reference_minus_price": "1e-21", + "theta": "1/64", + "v": 403, + "previous_surplus": [ + "-0.0000000000000000000171768193677969760907", + "-0.0000000000000000000171768193677969760906" + ], + "surplus": [ + "0.0000000000000000000392062805034651111499", + "0.0000000000000000000392062805034651111500" + ] + }, + { + "crossing_reference_minus_price": "1e-21", + "theta": "2", + "v": 439, + "previous_surplus": [ + "-0.0000000000000000000188679451458357515823", + "-0.0000000000000000000188679451458357515822" + ], + "surplus": [ + "0.0000000000000000000393400095383264709265", + "0.0000000000000000000393400095383264709266" + ] + }, + { + "crossing_reference_minus_price": "1e-24", + "theta": "1/64", + "v": 469, + "previous_surplus": [ + "-0.0000000000000000000000064049347151963082", + "-0.0000000000000000000000064049347151963081" + ], + "surplus": [ + "0.0000000000000000000000571864967909962549", + "0.0000000000000000000000571864967909962550" + ] + }, + { + "crossing_reference_minus_price": "1e-24", + "theta": "2", + "v": 508, + "previous_surplus": [ + "-0.0000000000000000000000480407448495307724", + "-0.0000000000000000000000480407448495307723" + ], + "surplus": [ + "0.0000000000000000000000215715107165248052", + "0.0000000000000000000000215715107165248053" + ] + } + ] +} diff --git a/research/p104-six-stage-resolution/SCALING.md b/research/p104-six-stage-resolution/SCALING.md new file mode 100644 index 0000000000..2d63991b53 --- /dev/null +++ b/research/p104-six-stage-resolution/SCALING.md @@ -0,0 +1,81 @@ +# The cost of approaching the raw crossing + +For the fixed complete #8035 binary inventory put t=1-c and let T(t) and +P(t) be its productive and paid rank moments. Let c* be their crossing in +[0.00389,0.00389046]. Define + + alpha = P(t)/T(t), delta = 1-alpha, + gamma = P(t+z)/(12^z T(t)), lambda = 15^w T(t-w)/T(t), + F_theta(v) = 1 - alpha^v - theta gamma^v - lambda^v, + +with z=593/2048, w=491/1024 and fixed theta=1/64 or 2. An allowed column +cutoff L pays the rounding requirement whenever F_theta(v)>2/L. Both +coefficients have previously established full split-tail tariff proofs. + +The directed derivative of T(1-c)-P(1-c) lies strictly between -384104 and +-384101 throughout the stated interval. The directed endpoint signs enclose +c* between 0.003890115286594461129996942 and 0.003890115286594461129996943. +In particular delta is positive and proportional to c*-c from the left. +The same interval calculation gives gamma<0.907227, lambda<0.900011, +and gamma>lambda. At the root gamma* lies between 0.907225472004138239146095 +and 0.907225472004138239146096. + +With unrestricted finite v and finite L, c* is exactly the supremum of this +moment test on the interval. For c0 and any L>2/F_theta(v) pays rounding. +For c>=c* the raw term alone is at least one. This is a result about a +specific sufficient pricing test. A growing tensor power also changes +physical storage, individual ranks and the separate numerical supplier +requirements of an algorithm. + +There is a sharp scaling law. Extend v to positive real x and let x_theta +be the unique zero of F_theta. The least positive integer v passing with +some finite L is floor(x_theta)+1, since F_theta increases strictly. +Put A=log(1/delta) and a=-log(gamma*), using natural logarithms. Then + + a x_theta = A - log A + log(a theta) + o(1) + +as c approaches c* from below. First x_theta tends to infinity: any bounded +x leaves the other two tail terms bounded away from zero while 1-alpha^x +tends to zero. Uniform q<1 bounds gamma and lambda; at x=C A for a sufficiently +large fixed C the tails are O(delta^2), whereas 1-(1-delta)^x>=delta for +x>=1. Hence x_theta=O(A) and x_theta delta tends to zero. Smoothness of +the moments and the nonzero crossing derivative give gamma(c)^x_theta = +(gamma*)^x_theta (1+o(1)). The strict gap lambda*0 for its paid debit, b_0=0, and +C_i=c-d/H_i. At each stage the strict condition is +b_i < min(eta,(249 C_i+b_(i-1))/250). Thus b_6 1 + else Path(__file__).resolve().parent.parent / 'last-tick') +sys.path.insert(0, str(SOURCE)) +from upstream import install + +install() +from positive import power_le +from check_epoch_reentry import trial as epoch_trial +from strong_binary import native_word +from calibration import LAST_TICK, COMPLEX_C +from outer_budget import margins + + +class Tape: + """One transition per read, write or unit head movement on a finite alphabet.""" + + def __init__(self, cells, head=0): + self.cells = list(cells) + ['_'] + self.head = head + self.steps = 0 + + def read(self): + self.steps += 1 + return self.cells[self.head] + + def write(self, value): + self.steps += 1 + self.cells[self.head] = value + + def move(self, delta): + assert delta in (-1, 1) + self.steps += 1 + self.head += delta + assert self.head >= 0 + if self.head == len(self.cells): + self.cells.append('_') + + +def home(tape): + while tape.read() != '<': + tape.move(-1) + tape.move(1) + + +def nonzero(tape): + while True: + bit = tape.read() + if bit in ('1', '#'): + home(tape) + return bit == '1' + assert bit == '0' + tape.move(1) + + +def decrement(tape): + while tape.read() == '0': + tape.write('1') + tape.move(1) + assert tape.read() == '1' + tape.write('0') + home(tape) + + +def rank_on_tapes(h): + """From binary h on a counter tape, write binary 2**h on another tape.""" + bits = list(reversed(format(h, 'b'))) + counter = Tape(['<', *bits, '#'], head=1) + rank = Tape([]) + rank.write('1') + rank.move(1) + while nonzero(counter): + decrement(counter) + rank.write('0') + rank.move(1) + word = ''.join(rank.cells[:rank.head]) + steps = counter.steps + rank.steps + # The bound deliberately includes all tests, failed scans, and head returns. + bound = 20 * (h + 1) * (len(bits) + 2) + assert steps <= bound, (h, steps, bound) + assert word == '1' + '0' * h + return len(word), steps, bound + + +def count_power_le(base, power, ceiling): + """Mirror the source loop while bounding each actual untruncated product.""" + value, products, max_temporary = 1, 0, 0 + assert 0 <= base <= ceiling and power > 0 + while power: + if power & 1: + value *= base + products += 1 + max_temporary = max(max_temporary, value) + assert value <= (ceiling + 1) ** 2 + if value > ceiling: + return False, products, max_temporary + power //= 2 + if power: + square = base * base + products += 1 + max_temporary = max(max_temporary, square) + assert square <= (ceiling + 1) ** 2 + base = min(ceiling + 1, square) + return True, products, max_temporary + + +def controls(): + rank_receipts = {str(h): rank_on_tapes(h) for h in range(0, 129)} + for base in range(1, 18): + for d in range(2, 19): + border = base ** d + for h in sorted({base, max(base, border - 1), max(base, border), max(base, border + 1)}): + got, count, _ = count_power_le(base, d, h) + assert got == (base ** d <= h) == power_le(base, d, h) + assert count <= d.bit_length() - 1 + d.bit_count() + d = 10**21 + assert (d.bit_length(), d.bit_count()) == (70, 29) + stop = [] + for base, h in ((1, 2**64), (2, 2**4096), (17, 2**256), (2, 2)): + got, count, temporary = count_power_le(base, d, h) + assert got == power_le(base, d, h) + stop.append({'base': base, 'h_bits': h.bit_length(), 'result': got, + 'products': count, 'max_temporary_bits': temporary.bit_length()}) + epoch = epoch_trial() + return { + 'rank_cases': len(rank_receipts), + 'sample_rank_cases': {k: rank_receipts[k] for k in ('0', '1', '16', '64', '128')}, + 'stop_cases_d_2_to_18': 17 * 17, + 'D': d, + 'D_bits': d.bit_length(), 'D_set_bits': d.bit_count(), 'max_products': 98, + 'large_D_controls': stop, + 'nested_epoch': list(epoch), + } + + +def guards(): + v, Hs = 430, [10**21 * 4**i for i in range(6)] + assert 5**13 > 16 * 4**13 and 15**v >= 2 * 12**v + assert 18_906**v + 104_904**v + 23_800**v < 2**(18*v) + assert 18 * (Fraction(13, 4) + Fraction(1, 512)) < 60 + assert 512 * v <= min(Hs) + word = native_word(v) + targets15 = [i for i, port in enumerate(word.targets) if port.rank == 15] + paid56 = next(i for i, port in enumerate(word.paid) if port.rank == 56) + assert len(targets15) == 444 + assert word.target((targets15[0],) * v).rank == 15**v + assert next(word.blocks((paid56,) * v)).rank == 12**v + assert 134**v < 2**(8*v) + assert (Fraction(5, 4)**v) < 2**v + actual_g_floor = (Hs[-1] - 2 - 8*v)//v + assert actual_g_floor == 2381395348837209302317 + assert actual_g_floor > 258*((1 << 63) - 1) + checks = [] + for h in Hs: + g = (13*h + 4*v - 1)//(4*v) + 2 + q = (10000*(2*h + 64) + 9961 - 1)//9961 + old = (25000*(2*h + 64) + 24903 - 1)//24903 + assert 9961*q >= 10000*(2*h + 64) and q < 3*h < 8*h + assert q > old and g <= 4*(h + 1) + construction = 20*(h+1)*(h.bit_length()+2) + assert construction.bit_length() < h + checks.append({'H': h, 'H_bits': h.bit_length(), 'G_plus_1_upper': g, + 'G_bound_bits': g.bit_length(), 'quotient_log': q, + 'old_quotient_understatement': q-old, + 'binary_rank_writer_transitions_upper': construction}) + nodes = 64 + v.bit_length() + 30*v + local = 4*nodes + 8*max(Hs).bit_length() + 512 + qnative = 1 << local.bit_length() + slot = 19 + 2*nodes + checks[-1]['G_bound_bits'] + assert (nodes, slot, local, qnative) == (12973, 26038, 53044, 65536) + assert slot < local < qnative + return {'v': v, 'minimum_target_witness': '15^430', 'maximum_paid_witness': '12^430', + 'all_15_labels': len(targets15), 'largest_actual_G_strict_lower': actual_g_floor, + 'ranks': checks, 'nodes_log_upper': nodes, 'slot_log_upper': slot, + 'local_log_upper': local, 'qnative': qnative} + + +def signed_guard(): + p = LAST_TICK + D = p.positive_stop_denominator + strict, functional, positive = margins( + p.kappa, Fraction(1, D), p.ordinary, COMPLEX_C - Fraction(10, p.complex_log) + ) + all_margins = strict + functional + [positive] + assert len(strict) == 54 and len(functional) == 4 + assert min(all_margins) == Fraction(1, 10 * D) + assert all(D**2 % x.denominator == 0 for x in all_margins) + assert all(x > 0 for x in all_margins) + scaled_bits = max(abs(int(x * D**2)).bit_length() for x in all_margins) + assert scaled_bits == 181 and scaled_bits < 186 + assert p.kappa * D == 3890115286594445000 + assert p.ordinary * D == 3890115286594445005 + return {'common_denominator': D**2, 'common_denominator_bits': (D**2).bit_length(), + 'kappa_numerator_over_D': int(p.kappa * D), + 'ordinary_numerator_over_D': int(p.ordinary * D), + 'strict': len(strict), 'functional': len(functional), + 'min_margin': str(min(all_margins)), 'max_scaled_numerator_bits': scaled_bits} + + +if __name__ == '__main__': + result = {'finite_controls': controls(), 'exact_guards': guards(), 'signed_guards': signed_guard()} + print(json.dumps(result, indent=2)) + print('PASS_TAPE_BRIDGE_SMALL_CONTROLS_AND_EXACT_GUARDS') diff --git a/research/p104-six-stage-resolution/check_candidate.py b/research/p104-six-stage-resolution/check_candidate.py new file mode 100644 index 0000000000..603dc5f9d9 --- /dev/null +++ b/research/p104-six-stage-resolution/check_candidate.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Check the installed six-stage profile from both directed price engines.""" +from pathlib import Path +import sys +sys.path.insert(0,str(Path(__file__).resolve().parent)) +from collections import Counter +from dataclasses import replace +from fractions import Fraction as Q +import json +from types import SimpleNamespace +from unittest.mock import patch +from upstream import install +install() +from band_product import production_supplier +from binary_receiver import Receiver,source_rule +from calibration import (NEAR_RAW,SMALL_GAP,GAP,COMPLEX_C,SPLIT_TILT, + PRODUCTIVE_TILT,prices) +from check_profile import RAW_LEFT, RAW_RIGHT, check, reject, check_stop_dispatch +from independent_binary_price import raw_moments,mass,rank_price +from module_atoms import balanced_widths +from outer_budget import qualify +from positive import power_le +from resources import requirements +from strict_moment import certify,UNIT,moment,power_interval +from strong_binary import graph,caller,native_word + +def main(): + check_stop_dispatch() + check(not power_le(2,10**20,1<<1000) and power_le(1,10**20,1<<1000),'exact new stop threshold') + with patch('strong_complex.artifacts',return_value=SimpleNamespace(graph=None,layout=None)),patch('strong_complex.word',return_value=object()): + a=production_supplier(9,10**20);b=production_supplier(9,10**17) + check(a is not b and a.carrier==b.carrier==512 and a.denominator==10**20,'actual stopping policy and cache binding') + production_supplier.cache_clear() + T,P=raw_moments(graph(),caller());p=NEAR_RAW;v,c=p.power,p.bit_c + check(p.kappa==Q('0.00389011528659443') and p.kappa>SMALL_GAP.kappa and p.kappaQ(lower_e30,10**30)>Q(2,p.floor),'both directed classic split surpluses') + certify(word,c,z,w,v,p.floor.bit_length()-2,15) + # A dyadic trial known to lie above the independently bracketed crossing must fail. + upper=Q((RAW_RIGHT*(2**70)).__ceil__(),2**70) + check(upper>RAW_RIGHT,'crossing control') + reject(certify,word,upper,z,w,v,p.floor.bit_length()-2,15) + check(mass(P,t,0)+1>mass(T,t,1),'one extra paid rank-one position exceeds raw surplus') + check(18_906**v+104_904**v+23_800**v<2**(18*v) and + 5**13>16*4**13 and 8*(Q(13,4)+Q(1,512))<27 and + 18*(Q(13,4)+Q(1,512))<60 and 15**v>=2*12**v and + 512*v<=min(p.rank_logs),'complete split census, enumeration and frame guard') + check(2**64*(v+1)*2**(28*v)<2**(512*v) and + 872*(Q(13,4)+Q(2,512))*(512*v)<2**(512*v),'generation and causal precision') + bit,numeric,stages=prices(p) + check((bit,numeric,len(stages))==(28,10,6),'complete staged invoices') + positive=COMPLEX_C-Q(numeric,p.complex_log);g=Q(1,p.positive_stop_denominator) + signed=qualify(p.kappa,g,p.ordinary,positive) + reject(qualify,p.kappa,GAP,p.ordinary,positive) + reject(qualify,p.kappa,Q(0),p.ordinary,positive) + reject(qualify,p.kappa,g,p.kappa+4*g,positive) + reject(qualify,p.kappa,g,p.ordinary,p.kappa+5*g) + reject(prices,replace(p,positive_stop_denominator=GAP.denominator)) + res=requirements(p) + # Replace the old listed-rank G<2^50 convenience by the source's general + # v*G <= 13*H/4 + v. The latter follows from (5/4)^13 > 2^4. + H=max(p.complex_log,*p.rank_logs) + Gplus1=(13*H+4*v-1)//(4*v)+2 + nodes=res['raw_structural_nodes_log2_upper'];q=res['native_volume_log2_upper'] + local_exponent=4*nodes+8*(H+1).bit_length()+512 + check(Gplus1<=4*(H+1) and 19+2*nodes+Gplus1.bit_length()0,'all-size stock and precision certificate') + receiver=Receiver(2,balanced_widths(1),direct=True,profile=p) + check(receiver.rule is source_rule(v) and receiver.rule.word is word and receiver.stock>0,'profile reaches physical BIT receiver') + report={'kappa':str(p.kappa),'positive_stop':str(g),'binary_price':str(c),'power':v,'floor':p.floor, + 'surplus_floor_e30':lower_e30,'positive_paid_cap':str(positive),'signed':signed, + 'raw_interval':[str(RAW_LEFT),str(RAW_RIGHT)], 'raw_gap_upper':str(RAW_RIGHT-p.kappa), + 'improvement_over_8035':str(p.kappa-SMALL_GAP.kappa), + 'stage_rates':[str(t[2]) for t in stages], 'forest_G_plus_1_upper':Gplus1, + 'native_slot_log_upper':19+2*nodes+Gplus1.bit_length(), + 'local_exponent_upper':local_exponent, 'complete_requirements':res} + content=json.dumps(report,sort_keys=True,indent=2)+'\n' + if len(sys.argv)>1:Path(sys.argv[1]).write_text(content) + else:print(content,end='') + print('PASS_NEAR_RAW_SIX_STAGE_SIGNED_GAIN',p.kappa,flush=True) +if __name__=='__main__':main() diff --git a/research/p104-six-stage-resolution/check_dispatch.py b/research/p104-six-stage-resolution/check_dispatch.py new file mode 100644 index 0000000000..513998b531 --- /dev/null +++ b/research/p104-six-stage-resolution/check_dispatch.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python3 +"""Exercise profile forwarding and the actual positive stop branch at feasible sizes.""" + +from pathlib import Path +from types import SimpleNamespace +from unittest.mock import patch +import sys + +SOURCE = (Path(sys.argv[1]).resolve() if len(sys.argv) > 1 + else Path(__file__).resolve().parent.parent / 'last-tick') +sys.path.insert(0, str(SOURCE)) +from upstream import install + +install() +from band_product import Product +from band_positive import Positive +from calibration import LAST_TICK + + +def main(): + calls = [] + supplied = object() + + def inspect_h_pack(machine, tape, start, end, bit, rank_log, make_supplier): + calls.append(('h_pack', rank_log, make_supplier() is supplied)) + + # This exercises the real Product.h binding; its large body is deliberately mocked. + product = object.__new__(Product) + product.profile = LAST_TICK + with patch('band_product.h_pack', side_effect=inspect_h_pack), \ + patch('band_product.production_supplier', return_value=supplied) as supplier: + product.h(None, 0, 1, 0) + supplier.assert_called_once_with(1_600_000, 10**21) + assert calls == [('h_pack', 1_600_000, True)] + + class ContinueActive(Exception): + pass + + class Probe(Positive): + @property + def owners(self): + # Stop before any fake fields enter the physical supplier. + raise ContinueActive + + columns = SimpleNamespace(window=1, offset=0) + + def run(den, h): + visited = [] + probe = Probe(None, None, 2, denominator=den) + with patch('band_positive.one_axis', side_effect=lambda field, axis: visited.append(axis)): + try: + probe._run(None, 10, 3, columns, h) + except ContinueActive: + return 'active_before_supplier', visited + return 'stopped', visited + + assert run(3, 27) == ('stopped', [10, 11, 12]) + assert run(3, 26) == ('active_before_supplier', [12]) + assert run(10**21, 2**4096) == ('active_before_supplier', [12]) + print('PASS_PROFILE_FACTORY_FORWARDING', 1_600_000, 10**21) + print('PASS_ACTUAL_POSITIVE_STOP_BRANCH', 'D=3 equality and below', + 'D=10^21 active finite control; supplier mocked') + + +if __name__ == '__main__': + main() diff --git a/research/p104-six-stage-resolution/check_last_product.py b/research/p104-six-stage-resolution/check_last_product.py new file mode 100644 index 0000000000..227fc60113 --- /dev/null +++ b/research/p104-six-stage-resolution/check_last_product.py @@ -0,0 +1,11 @@ +"""Replay the candidate configuration on feasible signed and full-product controls.""" +from pathlib import Path +import sys +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from upstream import install +install() +from calibration import LAST_TICK +from check_product import physical_product +import json +print(json.dumps(physical_product(LAST_TICK)), flush=True) +print('PASS_LAST_TICK_FEASIBLE_PHYSICAL_PRODUCT', flush=True) diff --git a/research/p104-six-stage-resolution/check_last_tick.py b/research/p104-six-stage-resolution/check_last_tick.py new file mode 100644 index 0000000000..52a6d9b759 --- /dev/null +++ b/research/p104-six-stage-resolution/check_last_tick.py @@ -0,0 +1,224 @@ +#!/usr/bin/env python3 +"""Recompute the sixth-stage grid cap and the candidate's complete rational invoice.""" +from collections import Counter +from dataclasses import replace +from decimal import Decimal, localcontext +from fractions import Fraction as Q +from itertools import islice +from pathlib import Path +from types import SimpleNamespace +from unittest.mock import patch +import json +import sys + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from upstream import install +install() +from band_product import production_supplier +from binary_receiver import Receiver, source_rule +from calibration import (COMPLEX_C, GAP, LAST_TICK, NEAR_RAW, PRODUCTIVE_TILT, + SPLIT_TILT, prices) +from check_profile import RAW_LEFT, RAW_RIGHT, check, check_stop_dispatch, reject +from independent_binary_price import crossing_limit, mass, rank_price, raw_moments +from linear_geometry import ceil_log2 +from module_atoms import balanced_widths +from outer_budget import qualify +from periodic import Job +from positive import power_le +from powered import Port, PoweredWord +from resources import requirements +from strict_moment import certify +from strong_binary import graph, caller, native_word + + +def decimal(q, n=40): + with localcontext() as ctx: + ctx.prec = n + return str(Decimal(q.numerator) / Decimal(q.denominator)) + + +def six_stage_ceiling(raw_right): + """Inductively dominate each grid rate with zero debits and the raw ceiling. + + This is an upper bound for the specific six-stage price algorithm when + bit_c < raw_right. It is not a bound for other callers or other grids. + """ + previous = Q(0) + rates = [] + for _ in range(5): + limit = (249 * raw_right + previous) / 250 + previous = Q((limit * 10**18).__floor__() - 1, 10**18) + rates.append(previous) + return rates, (249 * raw_right + previous) / 250 + + +def power_430_toy(): + """Exercise the 430-level interpreter on a one-port finite owner control.""" + source = Port(('toy-productive',), 1) + paid = Port(('toy-paid',), 1) + toy = PoweredWord(1, (source,), (paid,), 430, 1, 1, 1) + class Physical: + calls = 0 + def raw(self, inputs, columns): + ((tag, job),) = inputs + check(tag == source.tag and columns == 1, 'toy raw binding') + self.calls += 1 + yield paid.tag, job + def fresh(self, *_args): + raise AssertionError('The one-port control does not discard a target') + def retire(self, *_args): + raise AssertionError('The one-port control owns no extra field') + physical = Physical() + field = Job('preserved-owner', (0,)) + check(tuple(toy.native((field,), 1, physical)) == (field,) and physical.calls == 430, + '430-level powered interpreter preserves the toy owner') + + +def main(path=None): + check_stop_dispatch() + den = 10**21 + check(not power_le(2, den, 1 << 1000) and power_le(1, den, 1 << 1000), + 'last-tick stop comparator') + with patch('strong_complex.artifacts', return_value=SimpleNamespace(graph=None, layout=None)), \ + patch('strong_complex.word', return_value=object()): + a, b = production_supplier(9, den), production_supplier(9, 10**20) + check(a is not b and a.carrier == b.carrier == 512 and a.denominator == den, + 'positive supplier and exact stop cache key') + production_supplier.cache_clear() + + p = LAST_TICK + v, c = p.power, p.bit_c + tick = Q('0.003890115286594445') + check(p.kappa == tick and p.kappa > NEAR_RAW.kappa, 'improved claimed tick') + check(Q(0) < RAW_LEFT-c < Q(1,10**20), 'dyadic trial is below bracket within 1e-20') + targets, paid = raw_moments(graph(), caller()) + crossing_limit(targets, paid) + check(mass(targets, 1-RAW_LEFT, 0) > mass(paid, 1-RAW_LEFT, 1) and + mass(paid, 1-RAW_RIGHT, 0) > mass(targets, 1-RAW_RIGHT, 1), + 'directed independently bracketed fixed source crossing') + upper_grid, upper = six_stage_ceiling(RAW_RIGHT) + check(tick < upper < tick + Q(1, 10**18), 'next grid tick exceeds six-stage upper cap') + + word = native_word(v) + check(Counter(x.rank for x in word.targets) == targets and + Counter(x.rank for x in word.paid) == paid, 'literal source inventories') + check((word.ambient, word.power, word.floor, word.low_cut, word.high_cut) == + (134, 430, 15, 12, 12), 'installed powered source') + power_430_toy() + # Bind a real 430-factor productive path and a real paid path to the retained word. + tj = next(i for i,port in enumerate(word.targets) if port.rank >= 15) + pj = next(i for i,port in enumerate(word.paid) if 1 <= port.rank <= 4) + target = word.target((tj,)*v) + block, = word.blocks((pj,)*v) + check(target.rank == word.targets[tj].rank**v and target.rank >= 15**v and + len(target.tag) == v and block.rank == word.paid[pj].rank**v and + block.first == 0 and len(block.tags) == v, 'actual 430-factor paths') + tj_low = next(i for i,port in enumerate(word.targets) if port.rank < 15) + pj_high = next(i for i,port in enumerate(word.paid) if port.rank > 12) + discarded = word.target((tj_low,)*v) + first, second = islice(word.blocks((pj_high,)*v), 2) + check(discarded.rank < 15**v and first.rank == second.rank == 12**v and + (first.first,second.first) == (0,12**v), + 'real discarded path and consecutive paid split offsets') + t, z, w = 1-c, SPLIT_TILT, PRODUCTIVE_TILT + denom = mass(targets, t, 0) + alpha = mass(paid, t, 1)/denom + gamma = mass(paid, t+z, 1)/(rank_price(12,z)[0]*denom) + lam = rank_price(15,w)[1]*mass(targets,t-w,1)/denom + surplus = 1-alpha**v-2*gamma**v-lam**v + check(surplus > Q(2,p.floor), 'independent directed classic split surplus') + check(surplus > Q(3906,10**21), 'reporting precision for actual positive margin') + certify(word,c,z,w,v,p.floor.bit_length()-2,15) + corrupt_c = Q((RAW_RIGHT*2**80).__ceil__(),2**80) + reject(certify,word,corrupt_c,z,w,v,p.floor.bit_length()-2,15) + check(mass(paid,t,0)+1 > mass(targets,t,1), 'extra rank-one paid occurrence fails') + check(18_906**v+104_904**v+23_800**v < 2**(18*v) and + 5**13>16*4**13 and 8*(Q(13,4)+Q(1,512))<27 and + 18*(Q(13,4)+Q(1,512))<60 and 15**v>=2*12**v and + 512*v<=min(p.rank_logs), 'split census, enumeration and frame guard') + check(2**64*(v+1)*2**(28*v)<2**(512*v) and + 872*(Q(13,4)+Q(2,512))*(512*v)<2**(512*v), + 'generation and causal precision guard') + + bit,numeric,stages = prices(p) + check((bit,numeric,len(stages)) == (31,10,6), 'complete BIT, numerical and stage invoices') + previous = Q(0) + stage_report = [] + for i,(h,covered,rate) in enumerate(stages): + limit = min((249*covered+previous)/250,p.eta) + margin = limit-rate + check(margin>0 and previous minimum_last_height and minimum_last_height > sys.maxsize, + 'profile debit forces last height beyond host shift-count range') + signed = qualify(p.kappa,gap,p.ordinary,positive) + reject(qualify,p.kappa,GAP,p.ordinary,positive) + reject(qualify,p.kappa,Q(0),p.ordinary,positive) + reject(qualify,p.kappa,gap,p.kappa+4*gap,positive) + reject(qualify,p.kappa,gap,p.ordinary,p.kappa+5*gap) + reject(prices,replace(p,positive_stop_denominator=GAP.denominator)) + reject(prices,replace(p,kappa=tick+Q(1,10**18))) + + res = requirements(p) + cuts, s = res['binary_entrance_logs'],res['initial_s'] + for i,h in enumerate(p.rank_logs): + # The predecessor helper fixes eta=97/25000. This profile uses 39/10000, + # so compute the actual conservative quotient entry directly. + qcut = (Q(2*h+64,1)/(1-p.eta)).__ceil__() + check((1-p.eta)*qcut >= 2*h+64 and qcut < 3*h < 8*h, + f'quotient entry for stage {i+1}') + top = cuts[i+1] if i+1 2^4 and the target/paid ratio is >= (5/4)^v, + # G+1 <= ceil(13H/(4v))+2. This replaces the old G < 2^50 guard. + Gplus1=(13*H+4*v-1)//(4*v)+2 + nodes=res['raw_structural_nodes_log2_upper'];q=res['native_volume_log2_upper'] + local=4*nodes+8*ceil_log2(H+1)+512 + check(Gplus1<=4*(H+1) and 19+2*nodes+Gplus1.bit_length()0,'all-size stock and precision certificate') + receiver=Receiver(2,balanced_widths(1),direct=True,profile=p) + check(receiver.rule is source_rule(v) and receiver.rule.word is word and receiver.stock>0, + 'actual profile reaches receiver on feasible rank control') + result = { + 'kappa':str(p.kappa),'kappa_decimal':decimal(p.kappa), + 'six_stage_upper_fraction':str(upper),'six_stage_upper_decimal':decimal(upper), + 'upper_scope':'given bit_c < RAW_RIGHT, 5 stages on 1e-18 grid and this price recurrence', + 'raw_interval':[str(RAW_LEFT),str(RAW_RIGHT)],'trial':str(c),'power':v,'band_floor':p.floor, + 'gap':str(gap),'ordinary':str(p.ordinary),'positive_paid_cap':str(positive),'signed':signed, + 'surplus_floor_e21':(surplus*10**21).__floor__(), + 'power_430_toy_owner_control': {'raw_calls':430, 'returned_original_owner':True}, + 'bit_debit':bit,'numeric_debit':numeric,'stages':stage_report, + 'upper_grid_rates':[str(a) for a in upper_grid], + 'G_plus_1_upper':Gplus1,'native_slot_log_upper':19+2*nodes+Gplus1.bit_length(), + 'local_exponent':local,'native_q':q, + 'minimum_last_height_with_profile_debit':minimum_last_height, + 'host_py_ssize_max':sys.maxsize, + 'physical_execution_limit': 'Production ranks exceed CPython shift size and available host storage; feasible controls only.', + 'complete_requirements':res} + content=json.dumps(result,sort_keys=True,indent=2)+'\n' + if path: + Path(path).write_text(content) + else: + print(content,end='') + print('PASS_LAST_TICK_ARITHMETIC_AND_FEASIBLE_RECEIVER',decimal(p.kappa),flush=True) + + +if __name__=='__main__': + main(sys.argv[1] if len(sys.argv)>1 else None) diff --git a/research/p104-six-stage-resolution/check_product_profiles.py b/research/p104-six-stage-resolution/check_product_profiles.py new file mode 100644 index 0000000000..184499aa5c --- /dev/null +++ b/research/p104-six-stage-resolution/check_product_profiles.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 +"""Retain earlier public/stock controls and test the last profile's feasible product.""" +from pathlib import Path +import json +import sys +sys.path.insert(0,str(Path(__file__).resolve().parent)) +from upstream import install +install() +from calibration import FIXED_STOCK, SMALL_GAP, NEAR_RAW, LAST_TICK +from check_product import physical_product, stock_and_public +for profile in (FIXED_STOCK, SMALL_GAP, NEAR_RAW): + stock_and_public(profile) +row=physical_product(LAST_TICK) +assert row['product']=='-345550037539' and row['shuttles']==138 +assert row['H_calls']==157248 and row['stage_body_records']==81**2 +print(json.dumps(row,sort_keys=True),flush=True) +print('PASS_LAST_TICK_AND_RETAINED_STOCK_CONTROLS',flush=True) diff --git a/research/p104-six-stage-resolution/check_profile.py b/research/p104-six-stage-resolution/check_profile.py new file mode 100644 index 0000000000..fe3381b843 --- /dev/null +++ b/research/p104-six-stage-resolution/check_profile.py @@ -0,0 +1,127 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Qualify both parameterized signed profiles with two directed price readers.""" +from collections import Counter +from dataclasses import replace +from fractions import Fraction as Q +import json +from pathlib import Path +import sys +from types import SimpleNamespace +from unittest.mock import patch + +sys.path.insert(0,str(Path(__file__).resolve().parent)) +from upstream import install + +install() +from band_product import production_supplier +from binary_receiver import Receiver, source_rule +from calibration import (COMPLEX_C,FIXED_STOCK,GAP,PRODUCTIVE_TILT,SMALL_GAP,SPLIT_TARIFF, + SPLIT_TILT,SPLIT_WEIGHT,prices) +from independent_binary_price import mass,rank_price,raw_moments +from module_atoms import balanced_widths +from outer_budget import qualify +from positive import power_le +from resources import requirements +from strict_moment import certify +from strong_binary import caller,graph,native_word + +RAW_LEFT = Q('0.003890115286594461129996942') +RAW_RIGHT = Q('0.003890115286594461129996943') + + +def check(ok,message): + if not ok: + raise ArithmeticError(message) + + +def reject(run,*args): + try: + run(*args) + except ArithmeticError: + return + raise ValueError('The corrupted control passed') + + +def check_profile(p,expected_debit,targets,paid): + v,c=p.power,p.bit_c + word=native_word(v) + check(Counter(x.rank for x in word.targets)==targets and Counter(x.rank for x in word.paid)==paid, + 'independent literal inventories agree') + check((word.ambient,word.floor,word.low_cut,word.high_cut)==(134,15,12,12), + 'installed word takes the certified physical positions and split cap') + t,z,w=1-c,SPLIT_TILT,PRODUCTIVE_TILT + denom=mass(targets,t,0) + alpha=mass(paid,t,1)/denom + gamma=mass(paid,t+z,1)/(rank_price(12,z)[0]*denom) + lam=rank_price(15,w)[1]*mass(targets,t-w,1)/denom + surplus=1-alpha**v-SPLIT_WEIGHT*gamma**v-lam**v + eps=Q(2,p.floor) + check(0mass(targets,t,1), + 'independent price passes and one excess rank-one cut fails') + certify(word,c,z,w,v,p.floor.bit_length()-2,15,split_weight=SPLIT_WEIGHT) + reject(certify,word,c,z,w,v,p.floor.bit_length()-2,15) + check(18_906**v+104_904**v+23_800**v<2**(18*v) and + 5**13>16*4**13 and 8*(Q(13,4)+Q(1,512))<27 and + 18*(Q(13,4)+Q(1,512))<60 and 15**v>=2*12**v and + 512*v<=min(p.rank_logs), 'actual order, splits, rank width and source enumeration') + check(2**64*(v+1)*2**(28*v)<2**(512*v) and + 872*(Q(13,4)+Q(2,512))*(512*v)<2**(512*v), 'generation and causal precision guard') + binary,numeric,rows=prices(p) + check(binary==expected_debit and numeric==10 and len(rows)==6,'complete BIT, positive and stage bills') + positive=COMPLEX_C-Q(numeric,p.complex_log) + g=Q(1,p.positive_stop_denominator) + signed=qualify(p.kappa,g,p.ordinary,positive) + reject(qualify,p.kappa,GAP,p.ordinary,positive) + reject(qualify,p.kappa,Q(0),p.ordinary,positive) + reject(qualify,p.kappa,g,p.kappa+4*g,positive) + reject(qualify,p.kappa,g,p.ordinary,p.kappa+5*g) + reject(prices,replace(p,positive_stop_denominator=GAP.denominator)) + res=requirements(p) + check(res['all_size_margin_lower_at_entrance']>0,'complete size, precision and stripe certificate') + control=Receiver(2,balanced_widths(1),direct=True,profile=p) + check(control.rule is source_rule(v) and control.rule.word is word and control.stock>0, + 'this profile enters the physical BIT receiver') + return {'kappa':str(p.kappa),'g':str(g),'bit_trial':str(c),'factor_power':v,'band_floor':p.floor, + 'certified_surplus_floor_e24':(surplus*10**24).__floor__(),'positive_paid_cap':str(positive), + 'signed':signed,'complete_requirements':res} + + +def check_stop_dispatch(): + check(power_le(4,3,128) and not power_le(4,4,128), 'integer discrimination at a feasible cutoff') + for den in (10**14,10**17): + check(not power_le(2,den,1<<1000) and power_le(1,den,1<<1000),'exact reduced power stop') + # Check the actual production supplier constructor and its cache key on two ranks. + with patch('strong_complex.artifacts',return_value=SimpleNamespace(graph=None,layout=None)), \ + patch('strong_complex.word',return_value=object()): + small=production_supplier(9,10**17) + old=production_supplier(9,10**14) + check(small is not old and small.carrier==old.carrier==512 and + small.denominator==10**17 and old.denominator==10**14, 'positive runtime policy and cache') + production_supplier.cache_clear() + + +def main(): + check_stop_dispatch() + T,P=raw_moments(graph(),caller()) + check(mass(T,1-RAW_LEFT,0)>mass(P,1-RAW_LEFT,1) and + mass(P,1-RAW_RIGHT,0)>mass(T,1-RAW_RIGHT,1), 'fixed-word raw directed bracket') + check(FIXED_STOCK.rank_logs==SPLIT_TARIFF.rank_logs and FIXED_STOCK.ordinary==SPLIT_TARIFF.ordinary + and FIXED_STOCK.bit_c==SPLIT_TARIFF.bit_c, 'fixed-stock comparison') + fixed=check_profile(FIXED_STOCK,21,T,P) + near=check_profile(SMALL_GAP,22,T,P) + check(SPLIT_TARIFF.kappabudget or upper<=budget, "precision insufficient for sign" + return lower>budget + lo,hi=0,1 + while not classify(hi): + lo,hi=hi,2*hi + while hi-lo>1: + mid=(hi+lo)//2 + if classify(mid): + hi=mid + else: + lo=mid + bad=finite_surplus(hi-1,bounds,theta,lib) + good=finite_surplus(hi,bounds,theta,lib) + assert bad[1]<=budget0 and lib.difference(T,P,K_HIGH)[1]<0 + assert lib.difference(T,P,right)[1]<0 + # D'(c) is the paid log-moment less the productive log-moment. + p=log_moment_bounds(lib,P,1-right,1-left) + h=log_moment_bounds(lib,T,1-right,1-left) + deriv=(p[0]-h[1],p[1]-h[0]) + assert -385000bracket[2][1] and bracket[1][1]Q('.907225471') and at_root[1][1]Q('.900009331') and at_root[2][1]= 1 and exponent >= 0 + if r == 1 or exponent == 0: + return Q(1), Q(1) + h = r.bit_length()-1 + l2, u2 = log_series(Q(2)) + lm, um = log_series(Q(r, 1 << h)) + lo = down((h*l2+lm)*exponent/16) + hi = up((h*u2+um)*exponent/16) + elo, _ = exp_series(lo) + _, ehi = exp_series(hi) + return down(elo**16), up(ehi**16) + + +def moment(hist, exponent): + lo = hi = Q(0) + for r, count in hist.items(): + a, b = power(r, exponent) + lo += count*a + hi += count*b + return lo, hi + + +def surplus(target, paid, c, v, z, w, weight, keep): + t = 1-c + tl, th = moment(target, t) + pl, ph = moment(paid, t) + gl, gh = moment(paid, t+z) + ol, oh = moment(target, t-w) + cl, ch = power(12, z) + kl, kh = power(keep, w) + lo = 1-(ph/tl)**v-weight*(gh/(tl*cl))**v-(oh*kh/tl)**v + hi = 1-(pl/th)**v-weight*(gl/(th*ch))**v-(ol*kl/th)**v + return lo, hi + + +def difference(target, paid, k): + tl, th = moment(target, 1-k) + pl, ph = moment(paid, 1-k) + return tl-ph, th-pl + + +def agree(interval, reference): + assert max(interval[0], reference[0]) <= min(interval[1], reference[1]) + + +def main(): + ref = load_reference() + k, c, g = Q(194523, 50000000), Q(70084296829703, 2**54), Q(1, 10**17) + assert k == ref.K and g == ref.G + target, base = ref.load_inputs() + cases = {"baseline": (0, 0), "24 fusions": (24, 0), "25 fusions": (25, 0), + "one net rank-one deletion": (0, 1), "36 net rank-one deletions": (0, 36)} + report = {} + for label, (fusions, deletions) in cases.items(): + paid = base.copy() + paid[1] -= 2*fusions+deletions + paid[2] += fusions + assert min(paid.values()) > 0 + assert sum(paid.values()) == 104904-fusions-deletions + first_moment = sum(r*n for r, n in paid.items()) + assert first_moment == 285600-deletions + raw = difference(target, paid, k) + split = surplus(target, paid, c, 268, ref.Z, ref.W, ref.WEIGHT, 15) + agree(raw, ref.raw_difference(target, paid, k)) + agree(split, ref.powered_surplus(target, paid, c, 268, ref.Z, ref.W, ref.WEIGHT, 15)) + if deletions or fusions == 25: + assert raw[0] > 0 and split[0] > Q(2, 2**50) + ref.power_and_enumeration_checks(268, 2**50, c, sum(paid.values())) + else: + assert raw[1] < 0 and split[1] < 0 + report[label] = {"paid_count": sum(paid.values()), "paid_rank_sum": first_moment, + "raw": ref.enclosing_text(*raw, 18), + "split_268": ref.enclosing_text(*split, 18)} + shortenings = {} + for r in sorted(base): + if r == 1: + continue + paid = base.copy() + paid[r] -= 1 + paid[r-1] += 1 + assert sum(paid.values()) == 104904 and sum(q*n for q,n in paid.items()) == 285599 + raw = difference(target, paid, k) + split = surplus(target, paid, c, 268, ref.Z, ref.W, ref.WEIGHT, 15) + agree(raw, ref.raw_difference(target, paid, k)) + agree(split, ref.powered_surplus(target, paid, c, 268, ref.Z, ref.W, ref.WEIGHT, 15)) + assert raw[0] > Q(84,100) and split[0] > Q(79,100000) + shortenings[str(r)] = {"raw": ref.enclosing_text(*raw,18), + "split_268": ref.enclosing_text(*split,18)} + ref.power_and_enumeration_checks(268, 2**50, c, 104904) + assert len(shortenings) == 13 + report["single rank shortenings"] = shortenings + pos = surplus(ref.POS_TARGET, ref.POS_PAID, ref.POS_C, 128, Q(19,64), Q(23,64), Q(2), 16) + agree(pos, ref.powered_surplus(ref.POS_TARGET, ref.POS_PAID, ref.POS_C, 128, + Q(19,64), Q(23,64), Q(2), 16)) + assert pos[0] > Q(2, 2**15) + assert ref.bit_debit(268, 2**50, c) == 21 and ref.positive_debit() == 10 + levels = ref.stage_prices(c, 21) + cap = ref.POS_C-Q(10, 1600000) + strict, functional, positive_gap = ref.signed_margins(k, g, ref.ORDINARY, cap) + assert len(strict) == 54 and len(functional) == 4 + assert min(*strict, *functional, positive_gap) == Q(1, 10**18) + assert min(ref.signed_margins(k, 0, ref.ORDINARY, cap)[0]) == 0 + assert min(ref.signed_margins(k, g, k+4*g, cap)[0]) == 0 + assert ref.signed_margins(k, g, ref.ORDINARY, k+5*g)[2] == 0 + report["shared application"] = { + "positive_split_128": ref.enclosing_text(*pos, 18), "positive_cap": str(cap), + "ordinary_gate_margin": str(ref.ORDINARY-k-4*g), "positive_gate_margin": str(positive_gap), + "last_stage_headroom": str(levels[-1][2]-ref.ORDINARY), + "stage_rates": [str(level[3]) for level in levels], + "minimum_signed_gate_margin": str(min(*strict,*functional,positive_gap)), + "strict_gates": len(strict), "functional_gates": len(functional), + "kappa_target": str(k), "status": "conditional prices; physical word required"} + print(json.dumps(report, indent=2, sort_keys=True)) + + +if __name__ == "__main__": + main()