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-integrated-gaussian-suffix/ADDENDUM-8076.md b/research/p104-integrated-gaussian-suffix/ADDENDUM-8076.md new file mode 100644 index 0000000000..80c9214d36 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/ADDENDUM-8076.md @@ -0,0 +1,41 @@ +# Six-column Gaussian pricing with ToikY’s ordinary child tariff + +At the same complete recurring bound of 318,291,900 log₂ units, the six-column construction raises conditional κ from 0.003898223617430 to **0.003898226579820971**. The increase over ToikY’s exact stopped #8076 ceiling is 6334499898761145463273 / 2138306510848000000000000000000. The gap to 0.0039 is 0.000001773420179029. [Pinned #8076 source](https://github.com/ToikY/integer-mult-bounds/tree/d502eb21637717fe22fc16d4c4e3ede6ec59a106/research/p104-weighted-child-tariff) + +| Charged quantity | ToikY #8076 | Composite | +|---|---:|---:| +| Ordinary debit | 11178/8192 | 11178/8192 | +| Gaussian debit | 64939/524288 | 125645/1048576 | +| Ordinary heights | (8192, 111681, 524288) | (8192, 118919, 524288) | +| Gaussian height | 509812 | 499284 | +| First terminal header | 2^1154447 + 4 | 2^1151157 + 4 | +| Entry conversion | 518 bits | 516 bits | +| Complete recurring log₂ bound | 318291900 | 318291900 | +| Serial setup log₂ bound | 228 | 228 | +| Largest native height | 524288 | 524288 | + +Both tiers pass 54 strict inequalities, four functional conditions and the positive Gaussian condition. The positive margin on the terminal tier is 1072827333439 / 2094148878336000000000000000000. The entry ordinary bound is 125433364. The terminal ordinary bound is 208447817. The ordinary tariff 2401/1024 contracts by a factor at most 2400/2401, so its geometric sum is at most 2401. The invoice retains the five additional entry bits and three additional bits per terminal stage from #8076. + +The preceding six-column proof supplies the Gaussian debit. For a matched grant from grade r to k, its mean retained suffix is bounded by 7(k−r) + (1−c)r²/(2kL) at L = 1054. Substitution into the exact 51-cell table, including all 88 typed shares, yields a finite multiplier below 1.086602588030. The square-root calculation rejects the next smaller debit on denominator 2²⁰. The donor, endpoint, quadrature and unmatched charges appear in the complete Gaussian account. The underlying all-column operators inherit their phase and spectator convention. The other four premises concern owned erasure and suspended fields, uniform chronological mixed compilation, fixed-tape precision and movement, and analytic recovery. Finite fixture execution and the all-size conditional implication have distinct scopes. + +## Exact comparison for one through seven ordinary stages + +For l ordinary heights at least 8192, terminal accounting gives the necessary bound 1731 + 3l + 320ΣH + 220G. The released checker replays the three-stage crossing at the actual cap and the slightly larger 318291911 comparison cap. It recovers #8076’s exact stopped ceiling 1667119388378402860472786027 / 427661302169600000000000000000 and the composite ceiling 1632693363926333812833543539 / 418829775667200000000000000000 at both caps. + +At fixed G at the crossing, the reciprocal tangent maximizes the relaxed three-stage ordinary recurrence at its first minimum height and last maximum height. All other integer triples lose more than the two intermediate downward grid roundings. The next G has an ordinary upper below the current Gaussian upper. The Gaussian upper increases with G and the set of feasible ordinary profiles decreases with G. These two neighboring slices therefore locate the exact crossing. + +For one or two ordinary stages the common clamp directly bounds the recurrence, and the relaxed two-height optimum uses the final height 524288. For four through seven stages, remove the cost of at least one earlier height from the available sum and retain the maximal entering credit η/250³. The reciprocal tangent on the surviving three heights quantifies a strict gap in every case. Repeating the argument at clock 318291899 puts the best stopped upper below the booked composite κ. Thus 318291900 is the smallest integer clock bound permitting that rate within this pricing and height family. + +## Reproduction + +Place the preceding six-column #8073 archive alongside this addendum. From the extracted addendum directory, run + +```sh +python3.12 -IB replay8076.py --predecessor-archive /path/to/six-column-8073-public.tar.gz --output /path/to/new-results +``` + +The runner checks the preceding archive SHA-256, the nested 88-file #8057 archive and the 15 Git blob identities of #8076. Each run creates a fresh source tree. By default it checks all 14 candidate scopes, the authoritative #8076 invoice, the independently repriced ordinary tariff and the exact one-to-seven-stage optimization. A shorter economic/control run uses `--scope source_invoice ordinary_tariff stage_caps invoice independent_price cutoff corrupted_owner`. The output directory must be new so earlier observations stay recoverable. + +Ali Romman supplied the signed 48-call Gaussian word, physical compiler, installer and fixed-resource argument. SYLforge supplied the K7 ordinary word. ToikY supplied the two-type calendar, the ordinary 8/L estimate and the 2401/1024 child tariff. The six-column price and its safety proof belong to the accompanying Gaussian contribution. The original notices, licenses and further source credits are preserved in the pinned scientific package and nested archive. + +The registered package price command runs the short economic and source-control selection. For just that selection, run `python3.12 -I -B research/p104-integrated-gaussian-suffix/verify.py addendum`. The other ten scientific scopes are not run by that command; their separate observed source-replay status is in [EVIDENCE.md](EVIDENCE.md). The complete source replay remains available from the unpacked `source-view-8076/replay8076.py` with the pinned predecessor archive and a new output directory. diff --git a/research/p104-integrated-gaussian-suffix/CAP-THEOREM.md b/research/p104-integrated-gaussian-suffix/CAP-THEOREM.md new file mode 100644 index 0000000000..5442da7284 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/CAP-THEOREM.md @@ -0,0 +1,23 @@ +# Capped stopped rates for one through seven stages + +The theorem here concerns the source's fixed bookings and tariffs, not all possible integer multipliers. Let `b₁,…,bₙ` be ordinary terminal heights, `1 ≤ n ≤ 7`, each in `[8192,524288]`; let the Gaussian height `G` lie in `[1024,524288]`. The source tariff requires + +```text +1731 + 320 Σ bᵢ + 220 G ≤ C₀. +``` + +The source's entry price and conversion must also be paid; the explicit invoices show that the terminal branch dominates for the samples. Set `cB = 4391986206293/2^50`, `cG = 17145637307/2^42`, `η = 39/10000`, and `δstop = 5·10^−18`. Start `r₀=0`, apply `rᵢ < min(η, (249(cB−dB/bᵢ)+rᵢ₋₁)/250)`, with the source's downward `10^−21` grid and one extra guard tick for each intermediate stage, and require `κ + δstop < cG−dG/G`. These are the prices of the original signed caller, including the strict stopping reserve. + +| Family | `C₀` | `dB` | `dG` | exact stopped supremum | crossing `G` | +| --- | ---: | --- | --- | --- | ---: | +| e−6 | 318291911 | `11204/8192` | `125645/2^20` | `523210571423785163651433485201/134217728000000000000000000000000` | 491002 | +| e−8 | 318291911 | `11204/8192` | `130699669/2^30` | `523210399077391326763724428177/134217728000000000000000000000000` | 496173 | +| published #8073 family | 318292011 | `11204/8192` | `64939/524288` | `523210198560303585338978849681/134217728000000000000000000000000` | 501831 | + +The e−8 sample invoice uses `G=496174`; the row above is the fixed-family crossing and does not claim that the displayed sample has the least e−8 clock. The #8073 family cap is the `318292011` cap in its published proof; its installed invoice is `318291911`. + +For three stages, relax the clamp and directed intermediate floors to obtain the weighted reciprocal objective with weights `(1/62500,1/250,1)`. At each listed crossing the optimal relaxed heights have the first at its floor and the third at its ceiling. Their reciprocal tangent slopes increase strictly. Every other integer allocation under the same sum budget loses at least the positive tangent gap computed in [seven-stage.json](data/seven-stage.json), greater than the actual intermediate grid loss. The unrelaxed directed recurrence therefore attains the displayed ordinary upper endpoint as a supremum. The Gaussian bound is monotone in `G`, and the feasible ordinary budget decreases with `G`. The adjacent Gaussian heights settle both sides of the crossing. + +To rule out a strictly better rate with one, two, or four through seven stages, the Gaussian inequality first gives the smallest `G` capable of beating the three-stage supremum. The clock then gives a maximum ordinary height sum. A one-stage relaxation uses `b=524288`; the two-stage reciprocal tangent gives the stated optimum. For four or more stages, at least one earlier height costs `8192`; its entire contribution to the last three stages is bounded by `η/250³`. Dropping all further earlier-height costs, clamps and grid losses can only increase the relaxed upper bound. The exact rational comparisons in [all_stage_caps.py](checks/all_stage_caps.py) put all of these upper bounds strictly below the corresponding three-stage supremum. The smallest e−6 separation is more than `2.827240394×10^−9` for the four-or-more relaxation. + +The same calculation proves a separate minimum-clock statement for the **booked** e−6 rate `0.003898222531555482` in this model. At complete clock `318291610`, positive funding forces `G≥491002`, leaving ordinary height sum at most `657091`; even the relaxed best three heights `(8192,124611,524288)` fall short by the positive fraction in [minimal-clock.json](data/minimal-clock.json). The one-, two-, and four-or-more-stage relaxations also fall short. The actual signed receipt pays `318291611`. This is an exact integer invoice result for the declared prices and stages; it does not rule out a new native word, tariff, budget, owner contract or compiler. diff --git a/research/p104-integrated-gaussian-suffix/EIGHT-COLUMN.md b/research/p104-integrated-gaussian-suffix/EIGHT-COLUMN.md new file mode 100644 index 0000000000..4e0cfe9ad5 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/EIGHT-COLUMN.md @@ -0,0 +1,19 @@ +# Eight-column comparison on #8073 + +The e−8 sample retains the predecessor's physical Gaussian calendar and rebooks its real matched suffixes using the integral in [INTEGRAL.md](INTEGRAL.md). It combines that price with #8073's unchanged ordinary K7 debit `11204/8192`. The installed entry is `(3000,3080;1024)` at κ `0.00345`; the terminal profile is `(8192,121057,524288;496174)` at conditional κ `0.003898221247474783`. + +Here the offset is `s=8`, lower band `L=1874`, upper scale `263772`, and `c=17145637307/2^42`, `t=1−c`, `δ=2^−128`. The independent directed calculation gives `4.550681666 < d < 4.550681667` and + +```text +F = (1+δ)(1+1032/263772)(263772L)^c + (1+d/L+δ)/(1−δ)^4 + < 2^(130699669/2^30). +``` + +The next smaller `2^−30` debit tick fails this accounting expression. A separate actual positive grant has a suffix larger than the averaged coefficient: using that coefficient as a pointwise bound would be invalid. The proof covers the full weighted integral and pays unallocated births, floor and ceiling errors, terminal drain, exterior grants, incomplete periods and group padding separately. The independent numerical control uses a different rational log/exp enclosure from the source's directed-root calculation. + +The complete recurring bound is `318291851`, with terminal `log₂ B = 209131968`, entry conversion `516` bits, first terminal header `2^1150185+4`, maximum native height `524288`, and the inherited fixed setup below `2^228`. It saves 60 clock bits against #8073 and 160 against #8072; its header exponent is 1,768 lower than #8073 and 1,632 higher than #8072. Its rate exceeds #8073's exact stopped family ceiling by `200517087526214045150319/134217728000000000000000000000000`, about `1.4939687216744873×10^−9`. The main e−6 sample is higher by exactly `1284080699/1000000000000000000`. + +The registered `price` mode reconstructs this signed invoice from the same authenticated fifteen #8073 blobs and #8057 parent as the main sample, then checks every field against [eight-column-invoice.json](data/eight-column-invoice.json). It independently checks the e−8 and e−6 factor bounds and the one-through-seven-stage ceilings. All seven separately executed source-bound e−8 modes passed; their individual timestamps and output digests are in [EVIDENCE.md](EVIDENCE.md). The invoice and finite tests remain conditional on the five premises listed in the main README. They neither prove a production-dimensional execution nor select an upstream frontier. + +The separate [source-reuse observation](data/source-reuse.json) compared the #8072 and #8073 reconstructed runtime images: of 106 files, only the installation profile differed; the Gaussian trial and the three recorded transport/grade source hashes agreed. The registered independent referee verifies those three hashes again against the freshly reconstructed #8073 runtime. diff --git a/research/p104-integrated-gaussian-suffix/EVIDENCE.md b/research/p104-integrated-gaussian-suffix/EVIDENCE.md new file mode 100644 index 0000000000..44da167bc5 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/EVIDENCE.md @@ -0,0 +1,17 @@ +# Observed evidence and limits + +All timestamps below are UTC. [observed-scopes.json](data/observed-scopes.json) preserves the individual names, start and finish times, exit codes and output SHA-256 digests. The local runs used CPython 3.12.3. A digest identifies an observed output; it does not replace the executable proof or establish the inherited premises. + +The primary #8073 e−6 construction completed all **14 scientific scopes** between `2026-11-23T04:13:29.007086Z` and `04:33:16.043497Z`: invoice, independent price, placement, cutoff, calendar, ownership, exterior, nested, raw, product, stages, ordinary floor, setup and corrupted-owner rejection. The aggregate qualification was recorded at `04:33:49.719960Z`. These runs used the frozen research replay and the exact #8073 source, before the full public files response was reduced to the fifteen blob pairs in the publication archive. The archive's scientific programs and pinned source blobs are the same. + +The **sanitized public archive** was separately cold-restored. Its independent price and corrupted-owner scopes passed during `04:22:56.454792Z–04:23:43.507697Z`; its full signed invoice passed during `04:29:41.112724Z–04:30:04.348298Z` and had the same output digest as the principal invoice. The independent referee's two factor calculations and literal event controls ran at `04:13Z`; the occupied `H=1024` source grant and the six-versus-four-column negative control were recorded at `04:13:56.548267Z`. These finite controls support the written integral and compilation argument; they are not an exhaustive production-dimensional execution. + +The sealed #8073 package's `setup` mode passed at `04:33:54.238463Z–04:33:58.612326Z`, including source setup and archive/receipt rejection controls. Its `price` mode passed at `04:33:54.235335Z–04:35:48.484964Z`, including the three source pricing scopes, independent factor and actual-grant checks, stage-cap and minimum-clock calculations, and the reconstructed e−8 invoice. The main README's four original invoice rows were compared field by field with the saved signed receipts. + +For the separate #8073 e−8 installation, all seven source-bound scopes (`price`, `calendar`, `raw`, `exterior`, `nested`, `product` and `setup`) passed between `04:19:42.696448Z` and `04:39:45.536271Z`. The standalone #8072 e−8 installation had a separate seven-scope pass. That #8072 result is a control, not a substitute for the #8073 scopes. A clean e−8 #8073 export also reconstructed the exact invoice and passed its full price mode. + +The #8076 e−6 principal construction passed all 14 source scientific scopes between `04:39:59.122078Z` and `04:46:24.180711Z`; the aggregate was qualified at `04:48:09.272307Z`. A separately extracted public addendum passed its seven economic and negative-control scopes at `04:43:25.113187Z–04:45:41.160297Z`. The overlay's own clean `addendum` selector passed the same seven named scopes at `04:51:03.073760Z–04:52:17.698213Z` and freshly reconstructed the 105/106 runtime and 84/88 peer file comparison. The #8076 source and composite table rows and exact rational gains were checked against both signed invoices. The `addendum` selector did not rerun the other ten physical and setup scopes; their statuses come from the separately recorded principal run. + +The direct #8073 archive is pinned by SHA-256, with 28 explicit member pins; the compact #8076 archive has 31. The nested #8057 archive has 88 file pins; the wrapper rejects noncanonical paths, repeated members and unexpected types before the source installer runs. A separate recursive inspection covered seven #8073 tar containers and 344 members with no duplicate, absolute, traversal, alias or special members, and the #8076 archive's 31 members passed the same path and content audit. The overlay setup controls deliberately test altered bytes, absolute and duplicate names in all three direct and immediate peer archives, optimized Python, an incorrect selector, a failing recorded exit and an incorrect output digest. + +The seven registered commands have a combined declared timeout of 1,200 seconds, the generic runner's maximum. The revised registered `price` command combines the separately passed #8073 and #8076 checks; that combined command and the complete final registered suite have not been run locally. On a heavily loaded worker, individual #8073 principal `raw`, `exterior`, `nested` and `product` runs took about 158, 177, 191 and 389 seconds, respectively, and some exceed the registered per-command limits. Isolated hosted-worker performance must therefore be checked rather than inferred from these local passes. No full-scale physical multiplier, unconditional all-size theorem, maintainer admission, or selected-frontier update is claimed. diff --git a/research/p104-integrated-gaussian-suffix/INTEGRAL.md b/research/p104-integrated-gaussian-suffix/INTEGRAL.md new file mode 100644 index 0000000000..3e827e19ca --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/INTEGRAL.md @@ -0,0 +1,72 @@ +# Referee report on the Gaussian matched-suffix price + +The deterministic upper bound for the complete matched-suffix sum is valid for the two reviewed calendars. The predecessor is ToikY’s #8072 at `75f7e1c44f48c43983016bcf8878c4d9e5e87c62`. The first candidate keeps its offset 8 and lower band 1874. The second installs offset 6 and lower band 1054. Both use weights 5 and 451, upper scale 263772, raw trial $c=17145637307/2^{42}$, and $t=1-c$. My check concerns the finite numerical debit feeding the signed supplier. The five inherited all-size assumptions continue to govern the resulting overall multiplication claims. + +## From an issued integer prefix to an integral + +Use $s$ for the column offset, $M=2^H$, $H\ge1024$, $K=M^{82}$, $V=M^6$, and $U=2\lfloor M/(1724\cdot306)\rfloor$. A sender label of grade $r$ at even band $e$ issues $P=r(e-s)$ axes. An interior target of grade $k$ at even band $d$ takes $Q=k(d-s)$. Put $z=k/r>1$. The corresponding grant is + + q = floor(w_a π · lower_measure(max(e,zd), min(e+2,z(d+2)))). + +The measure encloses the integral of $Vx^{-1-t}$. Here $w_a$ belongs to the sender and $π$ is the share of the particular receiving port. The actual constructor computes this lower endpoint, multiplies by the weight and share, floors, creates disjoint replica intervals, and skips zero grants. The upper endpoint and a ceiling are used for births. See `runtime/transport.py`, lines 13–42, and `runtime/typed_transport.py`, lines 76–101 and 102–155 of the pinned predecessor. The six-column source keeps the same integrals, rounding and disjoint ranges. + +For every interior intersection of positive length, $D=re-kd\in(-2r,2k)\cap g\mathbb Z$, with $g=\gcd(2r,2k)$. An actual suffix therefore satisfies + + s(k−r)−2r+g ≤ P−Q ≤ s(k−r)+2k−g. + +The sharp pointwise constants also follow from Bézout. For each multiple of $g$ strictly between the endpoints choose even $e,d$ solving $re-kd=D$. Adding a common period makes both bins positive while preserving that equation. Those bounds on $D$ are exactly the positive-overlap conditions. For offset 8, $5r\le4k$ already proves nonnegativity. For offset 6, the maximum over the 51 actual cells of $(2r-g)/(k-r)$ is $94/17$. Both candidates have $P-Q\ge0$ throughout the ideal grid as well as on their nonzero finite grants. This permits multiplication of the upper bound on $q$ by $P-Q$ and extension of the integration domain. The pointwise constant by itself yields a valid, weaker per-cell price. + +Write $y=x/z$, and write $a(v)=v-2\lfloor v/2\rfloor$. Up to endpoints of zero mass the $e,d$ overlaps partition the interval $L\le yy-10\ge(1-2^{-128})y$ at all allowed $H$. Their actual lengths are at most $258U$. The period $4\lceil M/(4Q)\rceil$, its incomplete tail in $M^2$ rounds, the even upper-band rounding, and the final group of real productive rows all use the predecessor’s charges. The exterior lower bound and the unmatched-parent term each carry the full charge for their own grants. With $\delta=2^{-128}$, the resulting factor on $M^{1-c}$ is bounded by + + (1+δ)(1+1032/263772)(263772L)^c (1+d/L+δ)/(1−δ)^4, + +where $d$ is the bounded grade sum divided by $tΨ$. The factor includes the lower-band loss, late births, the exterior, and the incomplete period and group. + +## Independent controls and their scope + +The verifier reads the predecessor’s actual grade producer, traverses all 88 typed allocations, reconstructs the 51 weighted cells, and tests 1,971 exactly constant phase intervals. Independent rational arithmetic uses the atanh series for the reduced logarithm and the exponential Taylor series, with positive remainder bounds and outward fixed-point rounding. The identity $z^{-t}=z^c/z$ evaluates both integrals through the same positive scalar. It gives the following enclosures. + +| Offset and lower band | Fringe coefficient | Complete accounting factor | Upper debit | +|---|---|---|---| +| 8, 1874 | $4.550681666 < d < 4.550681667$ | $1.088033933515 < F_* < 1.088033933516$ | $130699669/2^{30}$ | +| 6, 1054 | $3.539445647 < d < 3.539445648$ | $1.086602588029 < F_* < 1.086602588030$ | $125645/2^{20}$ | + +One tick down on the respective stated grids fails each displayed accounting expression. An improved accounting argument could still produce a smaller upper bound on the physical run. + +The actual production exponent and the exactly integrated $t=1$ control each ran through literal bounded `TypedPlan.events()` for both offsets. The fixtures included every sender/receiver type combination, late paid events, exterior and zero descriptors, zero integer grants from positive overlaps, and a chain of three nested loan edges. At the production exponent, 4,846 emitted loans were received exactly once and 2,430 issued suffixes exceeded the integrated coefficient. The total for offset 8 was $65,560+2,363,856+703,260=3,132,676$ singleton axes. Offset 6 yielded $51,040+2,445,520+727,400=3,223,960$. These fixtures use small synthetic native grades and the actual compiler and event path. The arithmetic and grade-shape checks use the actual source distributions. The all-size conclusion follows from the integral proof and finite-error bounds. + +The registered `price` and `calendar` modes run the independent numerical and event controls against the freshly reconstructed runtimes. The previously observed results are in [referee-price.json](data/referee-price.json) and [referee-events.json](data/referee-events.json); their timestamps are not compared when rerunning. At $H=1024$, `actual_six_grant.py` reconstructs the floor for a specific installed source and receiver from the 65,600-bit quadrature. The physical 96-to-130 edge from band 1642 to 1214 has a 6,117-bit positive grant at sender type 1 paid index 2 and recipient type 1 target index 1. The suffix is 16 with offset 6 and −52 with offset 4. The receiver returns on time and the original paid event can issue during the epoch. See [referee-six-grant.json](data/referee-six-grant.json). diff --git a/research/p104-integrated-gaussian-suffix/LICENSE b/research/p104-integrated-gaussian-suffix/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/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-integrated-gaussian-suffix/NOTICE.md b/research/p104-integrated-gaussian-suffix/NOTICE.md new file mode 100644 index 0000000000..c6174bc176 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/NOTICE.md @@ -0,0 +1,5 @@ +# Attribution + +Ali Romman supplied the matched-interval suffix derivation, the #8057 weighted signed producer and caller, the literal 36-call and 48-call source words, and the earlier serial setup proof. SYLforge supplied the #8052 K7 ordinary circuit and physical replay. ToikY supplied the weighted two-type calendar, the finite bookings and allocation comparisons in #8070–#8073, and the #8076 ordinary child tariff with its additional charges. Clear1nsight's earlier iterated-return programs and scalar audit are retained in the inherited source notices. The #8073 ordinary K7 suffix price and #8076 child tariff are used without claiming them as new here. + +The original #8073 license and all notices inside the authenticated #8057 archive are retained. OpenAI Codex materially assisted the Gaussian integral analysis, physical compiler, independent referee checks, cost comparisons and verification packaging. See the source-specific notices and proofs for the full predecessor lineage. diff --git a/research/p104-integrated-gaussian-suffix/README.md b/research/p104-integrated-gaussian-suffix/README.md new file mode 100644 index 0000000000..64cfcdc640 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/README.md @@ -0,0 +1,48 @@ +# A signed Gaussian suffix integral + +This package prices the actual matched suffixes in the two-type Gaussian calendar and installs an `e−6` physical compiler. Combining it with the ordinary K7 tariff of [#8073 at `cf4c4b7`](https://github.com/CrocSwap/integer-mult-bounds/commit/cf4c4b7ea4b746be174ee4ba4e49f03b5bc79f8e) gives conditional κ `0.003898222531555482`. A separately source-bound composition with ToikY's later [#8076 at `d502eb2`](https://github.com/CrocSwap/integer-mult-bounds/commit/d502eb21637717fe22fc16d4c4e3ede6ec59a106) gives **conditional κ = 0.003898226579820971** at the same complete recurring clock as #8076. Both remain below `0.0039`; neither changes the selected upstream result. + +The decisive estimate is an integral over all actual edge bins, not a bound on an individual suffix. The proof, its finite error accounting and the independent controls are in [INTEGRAL.md](INTEGRAL.md); the complete compiler, charged-return argument and source history are in [SIX-COLUMN-PROOF.md](source-view/SIX-COLUMN-PROOF.md). [CAP-THEOREM.md](CAP-THEOREM.md) covers the #8073 fixed-price families of one through seven ordinary stages. The [#8076 addendum](ADDENDUM-8076.md) gives its independently repriced child tariff, source comparison and separate 1–7-stage cap. The [e−8 appendix](EIGHT-COLUMN.md) gives another #8073-based example. + +The #8076 composition does not transfer the old cap unchanged: it authenticates that source's fifteen scientific blobs, restores its shared parent, charges its extra entry and stage costs, and checks the changed whole signed invoice. A fresh source comparison reconstructs the two installations: 105 of 106 runtime files and 84 of 88 peer files are byte-identical; the differences are recorded in [physical-equivalence.json](source-view-8076/physical-equivalence.json). + +## Complete sample invoices + +`b` lists ordinary terminal heights, `G` the Gaussian height, and `log₂ C` is the complete recurring upper bound including the selector and the entry-to-terminal conversion. All six rows retain the same entry profile `(3000,3080;1024)` at κ `0.00345`. Its own `log₂ C` is `125660241` before conversion for the first four rows and `125660246` for the #8076 rows, which pay five added entry bits. Terminal `log₂ C` is one less than the complete bound in these samples. The public header identifies the first terminal activation; it is a sufficient threshold, not a practical crossover claim. + +| Sample | κ | `b; G` | ordinary / Gaussian debit | terminal `log₂ B` | complete `log₂ C` | conversion bits | first terminal header | +| --- | ---: | --- | --- | ---: | ---: | ---: | --- | +| [#8072](https://github.com/CrocSwap/integer-mult-bounds/commit/75f7e1c44f48c43983016bcf8878c4d9e5e87c62) | `0.003898214283192` | `(8192,124649,524288;490950)` | `11239/8192`, `64939/524288` | `210281408` | `318292011` | 515 | `2^1148553+4` | +| [#8073](https://github.com/CrocSwap/integer-mult-bounds/commit/cf4c4b7ea4b746be174ee4ba4e49f03b5bc79f8e) | `0.003898219753506` | `(8192,117168,524288;501831)` | `11204/8192`, `64939/524288` | `207887488` | `318291911` | 517 | `2^1151953+4` | +| e−8 appendix on #8073 | `0.003898221247474783` | `(8192,121057,524288;496174)` | `11204/8192`, `130699669/2^30` | `209131968` | `318291851` | 516 | `2^1150185+4` | +| e−6 on #8073 | `0.003898222531555482` | `(8192,124612,524288;491002)` | `11204/8192`, `125645/2^20` | `210269568` | `318291611` | 515 | `2^1148568+2` | +| [#8076](https://github.com/CrocSwap/integer-mult-bounds/commit/d502eb21637717fe22fc16d4c4e3ede6ec59a106) | `0.003898223617430` | `(8192,111681,524288;509812)` | `11178/8192`, `64939/524288` | `206131657` | `318291900` | 518 | `2^1154447+4` | +| e−6 on #8076 | `0.003898226579820971` | `(8192,118919,524288;499284)` | `11178/8192`, `125645/2^20` | `208447817` | `318291900` | 516 | `2^1151157+4` | + +For the first four terminal rows, the source invoice computes `log₂ B = 128 + 320 Σbᵢ`, `terminal log₂ C = max(84500001, 1602 + 220G + log₂ B)`, and `complete log₂ C = 1 + max(entry log₂ C + conversion, terminal log₂ C)`. Thus their displayed terminal branch has `1731 + 320 Σbᵢ + 220G` as its complete clock. This is a bound under the source tariff, not an empirical runtime. Entry conversion is actually checked; it is not silently assumed free. Maximum native height stays `524288`, and the inherited conservative serial fixed-setup bound remains below `2^228` in each case. + +For the #8076 rows, add `3n` to `log₂ B` for `n` terminal ordinary stages, and five to the entry clock; its complete terminal branch is `1731 + 3n + 320 Σbᵢ + 220G`. The child tariff is `2401/1024`, its contraction is `2400/2401`, and its charged geometric sum is 2401. The entry and terminal additions are paid in both #8076 invoices. + +The source carries both native words and all paid occurrences. The ordinary K7 word has **36 native calls**, 18,906 productive labels, 104,652 paid labels and 24 exact transfer shares. The Gaussian word has **48 native calls**; its two real types each have 52,608 productive labels and respectively 282,576 and 281,568 paid labels. With actual weights `(5,451)`, this means 23,989,248 weighted targets and 128,400,048 weighted paid labels across 51 occupied grade pairs and 88 typed cells. The two call counts are per literal native word, not a claim that the whole recursive installation executes only 84 calls. Both paid words, physical widths, owned returns and their complete clock remain charged. + +The exact published #8073 stopped ceiling is `523210198560303585338978849681/134217728000000000000000000000000`. The e−6 rate exceeds it by `372863481514645917150319/134217728000000000000000000000000`, about `2.7780494206744873×10⁻⁹`; its gain over #8073's booked rate is exactly `1389024741/500000000000000000`. Its complete clock is 300 lower than #8073 and 400 lower than #8072; its first-header exponent is 3,385 lower than #8073 and 15 higher than #8072. It exceeds #8072's exact three-stage stopped ceiling by `1107076595744764976049263/134217728000000000000000000000000`. The remaining gap to `0.0039` is `0.000001777468444518`. + +The #8076 e−6 rate exceeds #8076's booked `0.003898223617430` by exactly `2962390971/1000000000000000000`, and its stopped ceiling `1667119388378402860472786027/427661302169600000000000000000` by `6334499898761145463273/2138306510848000000000000000000`. The complete recurring bound remains `318291900`; entry conversion falls from 518 to 516 bits, and the first-header exponent falls from 1154447 to 1151157. The remaining gap to `0.0039` is `0.000001773420179029`. The addendum proves its stated fixed-price one-through-seven-stage ceiling and least integer clock for the booked rate, conditional on the same five premises. + +These are conditional signed claims under five inherited all-size premises: (1) the stated signed native all-column action, (2) owned allocation and restoration, (3) chronological compiler transfer, (4) fixed-alphabet tape, movement and numerical precision, and (5) analytic recovery. The proofs and bounded executions do not establish these premises from first principles. In particular, a finite fixture is not a production-dimensional multiplier run or an upstream admission. See [EVIDENCE.md](EVIDENCE.md) for what was actually observed and what remains unrun. + +## Reproduce + +The sparse registered runner uses CPython 3.12 and the standard library: + +```sh +python3.12 -I -B scripts/research_package.py --package research/p104-integrated-gaussian-suffix +``` + +Each of the seven declared commands also works as `python3.12 -I -B research/p104-integrated-gaussian-suffix/verify.py MODE`, with `MODE` one of `price`, `calendar`, `raw`, `exterior`, `nested`, `product`, and `setup`. The runner rejects optimized Python, authenticates both archives and their whitelisted members, checks the review copies against those bytes, and reconstructs in fresh temporary directories. Each requested named scope must return zero with a matching recorded stdout digest; successful completion of one mode does not assert success of another. The `price` mode checks the #8073 prices and the #8076 addendum's source invoice, ordinary tariff, stage caps, composite invoice, independent price, cutoff and corrupted-owner control. The addendum economic checks can also be run alone with `MODE=addendum`. The other six registered modes exercise the #8073 construction; they are not represented as fresh #8076 physical replays. The separate #8076 scientific replays are reported in [EVIDENCE.md](EVIDENCE.md). The dense physical product is expensive; run one product job at a time on a shared worker. + +The packed #8073 source is a deterministic, publication-minimal derivative of the frozen research replay: it replaces the full public GitHub files response with the fifteen needed public filename/blob pairs. Its SHA-256 is `1ffaf4eed67cfe2271820bc94d62721573ff715829c829c5d9936b561eacb270`. The separate #8076 addendum has SHA-256 `bacfc6ec44616063eae1584e6af07a1dbbfaf7948df1745bc059aa4510c7c9a0` and reuses the authenticated #8057 peer archive, so no second copy of that archive is required. The small source files are visible under [source-view](source-view) and [source-view-8076](source-view-8076); their byte identities are enforced by the wrapper. The nested upstream archive retains its license and notices. [Provenance](SOURCES.json) · [Inputs and commands](VERIFY.json) · [Attribution](NOTICE.md) + +## Open next questions + +Can a different signed native word or a justified new supplier charge close the remaining gap to `0.0039`? A useful next step is one exact source-to-reader and restoration witness with a complete changed invoice; these fixed-family caps do not exclude different words, costs, budgets, interfaces or stage rules. diff --git a/research/p104-integrated-gaussian-suffix/SOURCES.json b/research/p104-integrated-gaussian-suffix/SOURCES.json new file mode 100644 index 0000000000..e7eefb9540 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/SOURCES.json @@ -0,0 +1,18 @@ +{ + "schema_version": 1, + "base_commit": "0618e75a22cec54d1651394ef83d088551b7f026", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + } + ] +} diff --git a/research/p104-integrated-gaussian-suffix/TASK.json b/research/p104-integrated-gaussian-suffix/TASK.json new file mode 100644 index 0000000000..6886b11859 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/TASK.json @@ -0,0 +1,121 @@ +{ + "schema_version": 1, + "task_id": "scalar-to-moment", + "priority_revision": 8, + "base_commit": "0618e75a22cec54d1651394ef83d088551b7f026", + "original_card": { + "id": "scalar-to-moment", + "question": "Can a scalar/frame rewrite improve the complete signed moment through paid jobs, productive targets, or both?", + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "docs/research/recursive-invoice-preflight.md" + ], + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "acceptance_gate": "Require a legal chronological rewrite and favorable complete signed target-minus-paid moment with all extra charges. Unchanged ADD counts or unchanged paid-call counts alone decide neither success nor failure. Compiler, native and outer admission remain separate obligations.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "first_experiment": "Construct one legal source-bound rewrite and compare complete before/after P and T. Charge restoration, source windows and owned helpers. A paid call need not disappear: a legal target split or rank redistribution may win. Stop if the signed moment is unchanged or the consumer repays the gain. Do not extend a scalar-only census on ADD counts.", + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "overlap_terms": [ + "signed moment", + "target split", + "rank exchange", + "scalar rewrite" + ], + "existing_checks": [ + { + "scope": "PR #3998: consecutive A2 scalar contraction", + "evidence": "research/staged544-a2-graph-rewrite/README.md", + "remaining": "A genuinely changed paid itinerary or a distinct independent audit; no default scalar-only expansion.", + "status": "author-checked", + "source_commit": "389268a6b5e0373a3125d5c6fcd6995f4ea324f5", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4019: separated A2 sites with unchanged recursive histogram", + "evidence": "research/staged544-separated-a2/README.md", + "remaining": "A genuinely changed paid itinerary or a distinct independent audit; no default scalar-only expansion.", + "status": "author-checked", + "source_commit": "f408e09df300b575235f7f77f81948071397e16d", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4112: composition audit", + "evidence": "research/staged544-a2-composition-audit/README.md", + "remaining": "A genuinely changed paid itinerary or a distinct independent audit; no default scalar-only expansion.", + "status": "author-checked", + "source_commit": "205b7380656ba4b6316a8a493b1a3c679b8f7a0e", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4152: A1858 contraction audit", + "evidence": "research/staged544-a1858-contraction-audit/README.md", + "remaining": "A genuinely changed paid itinerary or a distinct independent audit; no default scalar-only expansion.", + "status": "author-checked", + "source_commit": "caaa14cde5962adc372fdca71f63d0f29e73c8b2", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "status": "reviewed", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + } + ] + }, + "scope_status": "changed", + "actual_scope": "A source-bound integrated Gaussian suffix integral and six-column compiler on the #8073 signed caller, an eight-column comparison, and the same compiler composed with the #8076 ordinary child tariff under exact fixed-price 1–7-stage caps.", + "scope_change_reason": "The original scalar/frame card is extended to physical Gaussian matched-suffix prices and full signed callers, first on #8073 and then on the independently authenticated #8076 ordinary tariff.", + "bottleneck_link": "Price every actual matched suffix and all remaining finite charges, then compare complete signed clocks and stopped rates to the pinned #8073 and #8076 predecessors.", + "budget_minutes": 60, + "stop_rule": "Reproduce the two source-bound signed compositions, independent integral and tariff controls and fixed-price 1–7-stage caps; retain each actual replay status and stop without claiming the .0039 target.", + "outcome": "completed", + "evidence": "Exact source pins, independent integral and tariff checks, source and composite invoices, fixed-price 1–7-stage certificates, recorded scientific scopes, and separately observed public-archive controls.", + "author": "Campaign contributor", + "ai_assistance": "OpenAI Codex materially assisted the integral proof, compiler, independent checks and packaging.", + "open_questions": [ + { + "question": "Can a new signed native mechanism close the remaining .0039 gap under a complete physical invoice?", + "why_it_matters": "The fixed-price one-through-seven-stage family remains below the target.", + "first_step": "Construct one source-bound paid mechanism with first-reader and owner-return witnesses and price every changed charge.", + "blocked_by": "A legal physical caller and independently checked complete invoice are required." + }, + { + "question": "Can a different paid mechanism close the remaining gap after the #8076 tariff and e−6 Gaussian composition?", + "why_it_matters": "The composed conditional rate remains below .0039, and its fixed-price cap covers only the declared family.", + "first_step": "Construct one changed source-to-reader mechanism with a complete signed price and independent native replay.", + "blocked_by": "A legal owner/return contract, all-size premises and an independently checked complete invoice remain necessary." + } + ], + "related_newer_work": [ + { + "source": "https://github.com/CrocSwap/integer-mult-bounds/commit/d502eb21637717fe22fc16d4c4e3ede6ec59a106", + "pr": 8076, + "reported_conditional_kappa": "0.003898223617430", + "scope": "Reduced ordinary child tariff with added entry and terminal-stage charges; a source-bound Gaussian composition is separately recorded here." + } + ] +} diff --git a/research/p104-integrated-gaussian-suffix/VERIFY.json b/research/p104-integrated-gaussian-suffix/VERIFY.json new file mode 100644 index 0000000000..24c0aa42b0 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/VERIFY.json @@ -0,0 +1,170 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/p104-integrated-gaussian-suffix/appendix/check_combined_seams.py", + "research/p104-integrated-gaussian-suffix/appendix/independent_gaussian.py", + "research/p104-integrated-gaussian-suffix/appendix/rebuild_e8.py", + "research/p104-integrated-gaussian-suffix/appendix/weighted_suffix.py", + "research/p104-integrated-gaussian-suffix/checks/actual_six_grant.py", + "research/p104-integrated-gaussian-suffix/checks/all_stage_caps.py", + "research/p104-integrated-gaussian-suffix/checks/check_referee.py", + "research/p104-integrated-gaussian-suffix/checks/compare_cold_runtimes.py", + "research/p104-integrated-gaussian-suffix/checks/guard_controls.py", + "research/p104-integrated-gaussian-suffix/checks/minimum_signed_invoice.py", + "research/p104-integrated-gaussian-suffix/data/8072-invoice.json", + "research/p104-integrated-gaussian-suffix/data/eight-column-invoice.json", + "research/p104-integrated-gaussian-suffix/data/minimal-clock.json", + "research/p104-integrated-gaussian-suffix/data/observed-scopes.json", + "research/p104-integrated-gaussian-suffix/data/referee-events.json", + "research/p104-integrated-gaussian-suffix/data/referee-price.json", + "research/p104-integrated-gaussian-suffix/data/referee-six-grant.json", + "research/p104-integrated-gaussian-suffix/data/seven-stage.json", + "research/p104-integrated-gaussian-suffix/data/six-column-invoice.json", + "research/p104-integrated-gaussian-suffix/data/source-reuse.json", + "research/p104-integrated-gaussian-suffix/source-view-8076/MANIFEST.json", + "research/p104-integrated-gaussian-suffix/source-view-8076/README.md", + "research/p104-integrated-gaussian-suffix/source-view-8076/candidate-result.json", + "research/p104-integrated-gaussian-suffix/source-view-8076/changes/build_successor.py", + "research/p104-integrated-gaussian-suffix/source-view-8076/changes/certify_frontier.py", + "research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_corrupt_owner.py", + "research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_six_ordinary.py", + "research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_six_price.py", + "research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_successor_cutoff.py", + "research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_successor_tiers.py", + "research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_tariff.py", + "research/p104-integrated-gaussian-suffix/source-view-8076/changes/run_successor.py", + "research/p104-integrated-gaussian-suffix/source-view-8076/changes/stage_caps.py", + "research/p104-integrated-gaussian-suffix/source-view-8076/physical-equivalence.json", + "research/p104-integrated-gaussian-suffix/source-view-8076/replay8076.py", + "research/p104-integrated-gaussian-suffix/source-view-8076/source-blobs.json", + "research/p104-integrated-gaussian-suffix/source-view-8076/source8076/LICENSE", + "research/p104-integrated-gaussian-suffix/source-view-8076/source8076/NOTICE.md", + "research/p104-integrated-gaussian-suffix/source-view-8076/source8076/PEER-SOURCE.json", + "research/p104-integrated-gaussian-suffix/source-view-8076/source8076/PROOF.md", + "research/p104-integrated-gaussian-suffix/source-view-8076/source8076/README.md", + "research/p104-integrated-gaussian-suffix/source-view-8076/source8076/RESULT.json", + "research/p104-integrated-gaussian-suffix/source-view-8076/source8076/SOURCES.json", + "research/p104-integrated-gaussian-suffix/source-view-8076/source8076/TASK.json", + "research/p104-integrated-gaussian-suffix/source-view-8076/source8076/VERIFY.json", + "research/p104-integrated-gaussian-suffix/source-view-8076/source8076/check_cutoff.py", + "research/p104-integrated-gaussian-suffix/source-view-8076/source8076/check_ordinary_floor.py", + "research/p104-integrated-gaussian-suffix/source-view-8076/source8076/check_stage_seam.py", + "research/p104-integrated-gaussian-suffix/source-view-8076/source8076/prepare.py", + "research/p104-integrated-gaussian-suffix/source-view-8076/source8076/verify.py", + "research/p104-integrated-gaussian-suffix/source-view-8076/stage-caps.json", + "research/p104-integrated-gaussian-suffix/source-view/BUNDLE-INPUTS.json", + "research/p104-integrated-gaussian-suffix/source-view/SIX-COLUMN-PROOF.md", + "research/p104-integrated-gaussian-suffix/source-view/build_successor.py", + "research/p104-integrated-gaussian-suffix/source-view/certify_frontier.py", + "research/p104-integrated-gaussian-suffix/source-view/check_corrupt_owner.py", + "research/p104-integrated-gaussian-suffix/source-view/check_six_ordinary.py", + "research/p104-integrated-gaussian-suffix/source-view/check_six_price.py", + "research/p104-integrated-gaussian-suffix/source-view/check_successor_cutoff.py", + "research/p104-integrated-gaussian-suffix/source-view/check_successor_tiers.py", + "research/p104-integrated-gaussian-suffix/source-view/compose8073.py", + "research/p104-integrated-gaussian-suffix/source-view/replay_package.py", + "research/p104-integrated-gaussian-suffix/source-view/run_successor.py", + "research/p104-integrated-gaussian-suffix/source-view/source-blobs.json", + "research/p104-integrated-gaussian-suffix/source-view/source8073/LICENSE", + "research/p104-integrated-gaussian-suffix/source-view/source8073/NOTICE.md", + "research/p104-integrated-gaussian-suffix/source-view/source8073/PEER-SOURCE.json", + "research/p104-integrated-gaussian-suffix/source-view/source8073/PROOF.md", + "research/p104-integrated-gaussian-suffix/source-view/source8073/README.md", + "research/p104-integrated-gaussian-suffix/source-view/source8073/RESULT.json", + "research/p104-integrated-gaussian-suffix/source-view/source8073/SOURCES.json", + "research/p104-integrated-gaussian-suffix/source-view/source8073/TASK.json", + "research/p104-integrated-gaussian-suffix/source-view/source8073/VERIFY.json", + "research/p104-integrated-gaussian-suffix/source-view/source8073/check_cutoff.py", + "research/p104-integrated-gaussian-suffix/source-view/source8073/check_ordinary_floor.py", + "research/p104-integrated-gaussian-suffix/source-view/source8073/check_stage_seam.py", + "research/p104-integrated-gaussian-suffix/source-view/source8073/prepare.py", + "research/p104-integrated-gaussian-suffix/source-view/source8073/verify.py", + "research/p104-integrated-gaussian-suffix/source/addendum-members.json", + "research/p104-integrated-gaussian-suffix/source/archive-members.json", + "research/p104-integrated-gaussian-suffix/source/six-column-8073-public.tar.gz", + "research/p104-integrated-gaussian-suffix/source/six-column-8076-addendum.tar.gz", + "research/p104-integrated-gaussian-suffix/verify.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "price" + ], + "timeout_seconds": 320, + "checks": "Rebuild the complete #8073 and #8076 signed invoices, independent Gaussian and ordinary tariffs, actual occupied grant, cross-source runtime comparison, exact 1–7-stage caps, minimum clocks, and the eight-column sample; verify each requested scope receipt." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "calendar" + ], + "timeout_seconds": 230, + "checks": "Check cutoff, chronological calendar, ownership, signed stage seams, ordinary floor and corrupted-return rejection; independently check the literal event identity." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "raw" + ], + "timeout_seconds": 105, + "checks": "Execute the exact two signed raw native jobs and check physical owner restoration." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "exterior" + ], + "timeout_seconds": 125, + "checks": "Generate the real exterior supply and check both owner returns." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "nested" + ], + "timeout_seconds": 125, + "checks": "Execute the actual nonzero nested loan and both owner returns." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "product" + ], + "timeout_seconds": 270, + "checks": "Execute signed product paths for both tiers and the entry physical coefficient fixture with dirty operand restoration." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "setup" + ], + "timeout_seconds": 25, + "checks": "Check the fixed serial arithmetic, setup bound, and outer, peer and addendum archive and receipt rejection controls." + } + ] +} diff --git a/research/p104-integrated-gaussian-suffix/appendix/check_combined_seams.py b/research/p104-integrated-gaussian-suffix/appendix/check_combined_seams.py new file mode 100644 index 0000000000..d17d6e4d53 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/appendix/check_combined_seams.py @@ -0,0 +1,85 @@ +"""Check the changed signed profile and exercise real ordinary stage seams.""" + +from dataclasses import replace +from fractions import Fraction as Q +import json +from pathlib import Path +import sys + +RUNTIME = Path(sys.argv[1]).resolve() +sys.path.insert(0, str(RUNTIME)) +HERE = Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) +sys.path.append(str(HERE.parent / 'tiered-native-multiplier' / 'source')) +from upstream import install + +install() +from check_stage_seam import verify_stage, verify_tape +from band_product import prepare_native +from installations import BINARY_C, ENTRY, GAUSSIAN_C, TERMINAL +from ordinary_carrier import stage_for_width_log +from outer_budget import qualify +from staged_carriers import entrance_logs + +DEBIT = Q(130699669, 2**30) +ORDINARY_DEBIT = Q(11204, 8192) +G = Q(1, 10**18) +assert TERMINAL.rank_logs == (8192, 121057, 524288) +assert TERMINAL.complex_log == 496174 +assert TERMINAL.kappa == Q('.003898221247474783') +assert max(*TERMINAL.rank_logs, TERMINAL.complex_log) == 524288 + +prior = replace(TERMINAL, rank_logs=(8192, 117168, 524288), complex_log=501831, + kappa=Q('.003898219753506')) +prior_ceiling = Q(523210198560303585338978849681, + 134217728000000000000000000000000) +assert TERMINAL.kappa > prior_ceiling > prior.kappa +old, new = prepare_native(prior), prepare_native(TERMINAL) +assert old[-1].targets is new[-1].targets and old[-1].cells is new[-1].cells +assert all(recipe.level_floor == 18960 for recipe in (*old[:-1], *new[:-1])) +assert all(a.targets is b.targets and a.paid is b.paid and a.cells is b.cells + for a, b in zip(old[:-1], new[:-1], strict=True)) + +booked = Q(0) +for height in TERMINAL.rank_logs[:-1]: + rate = min(TERMINAL.eta, + (249 * (BINARY_C - ORDINARY_DEBIT / height) + booked) / 250) + booked = Q((rate * 10**21).__floor__() - 1, 10**21) +ordinary = min(TERMINAL.eta, + (249 * (BINARY_C - ORDINARY_DEBIT / TERMINAL.rank_logs[-1]) + booked) / 250) +positive = GAUSSIAN_C - DEBIT / TERMINAL.complex_log +assert TERMINAL.ordinary < min(ordinary, positive) +assert qualify(TERMINAL.kappa, G, TERMINAL.ordinary, positive)['strict'] == 54 +assert 1731 + 320 * sum(TERMINAL.rank_logs) + 220 * TERMINAL.complex_log == 318291851 +assert 318291851 < 318291911 < 318292011 + +def must_reject(kappa, positive_rate): + try: + qualify(kappa, G, kappa + 5*G, positive_rate) + except ArithmeticError: + return True + raise AssertionError('an unfunded candidate was accepted') + +# The old suffix debit cannot finance the new signed rate. A rate above the +# new exact Gaussian limit also fails the inherited outer budget itself. +old_positive = GAUSSIAN_C - Q(64939, 524288*TERMINAL.complex_log) +assert must_reject(TERMINAL.kappa, old_positive) +assert TERMINAL.kappa + Q(2, 10**18) + 5*G > ordinary + +cuts = tuple(entrance_logs(TERMINAL.rank_logs)) +assert cuts == (8290, 129411, 653763) +for i, cut in enumerate(cuts, 1): + assert [stage_for_width_log(cut+d, 3, TERMINAL.rank_logs) for d in (-1, 0, 1)] == [i-1, i, i] + assert stage_for_width_log(cut+1, i-1, TERMINAL.rank_logs) == i-1 +direct = [verify_stage(TERMINAL, cuts, 2, 140000), verify_stage(TERMINAL, cuts, 3, 670000)] +compiled = [verify_stage(TERMINAL, cuts, 2, 1100000), verify_stage(TERMINAL, cuts, 3, 4400000)] +assert all(s['direct'] for s in direct) and not any(s['direct'] for s in compiled) +tape = [verify_tape(1, [0,1], [2,1]), verify_tape(2, [1,7], [3,1])] +print('PASS_COMBINED_SIGNED_SEAMS', json.dumps({ + 'prior_booked': str(prior.kappa), 'prior_stopped_ceiling': str(prior_ceiling), + 'candidate': str(TERMINAL.kappa), 'ordinary_upper': str(ordinary), + 'gaussian_upper': str(positive), 'ordinary_slack': str(ordinary-TERMINAL.ordinary), + 'gaussian_slack': str(positive-TERMINAL.ordinary), + 'prior_debit_rejected': True, 'overbooked_ordinary_rate_rejected': True, + 'cuts': cuts, 'direct': direct, 'compiled': compiled, 'signed_tape': tape, +}, sort_keys=True)) diff --git a/research/p104-integrated-gaussian-suffix/appendix/independent_gaussian.py b/research/p104-integrated-gaussian-suffix/appendix/independent_gaussian.py new file mode 100644 index 0000000000..d6a2b7221a --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/appendix/independent_gaussian.py @@ -0,0 +1,108 @@ +"""Independent 192-bit rational enclosure and failure controls for the debit.""" + +from fractions import Fraction as Q +from math import gcd + + +def floor(q): + return q.numerator // q.denominator + + +def ceil(q): + return -(-q.numerator // q.denominator) + + +def verify(recipe, powers): + """Price from the installed paid histogram and cells, not the receipt.""" + c, lower, scale = recipe.trial, 1874, 263772 + t, delta = 1 - c, Q(1, 2**128) + debit = Q(130699669, 2**30) + grid = 1 << 160 + psi_lo = psi_hi = numerator_lo = numerator_hi = 0 + for (raw_r, raw_k), share in recipe.cells.items(): + r, k = Q(raw_r), Q(raw_k) + assert 0 < r and 5 * r <= 4 * k and share > 0 + weight = recipe.paid.histogram[raw_r] * share + edge_lo, edge_hi = powers(k / r, c) + lo = weight * r * (edge_lo - 1) / c + hi = weight * r * (edge_hi - 1) / c + psi_lo += floor(lo * grid) + psi_hi += ceil(hi * grid) + rlo, rhi = powers(r / k, t) + point = 10 * k - 8 * r - gcd(int(2 * r), int(2 * k)) + average = 9 * (k-r) + t * r*r / (2*k*lower) + assert 0 < average < point + numerator_lo += floor(weight * rlo * average * grid) + numerator_hi += ceil(weight * rhi * average * grid) + psi_lo, psi_hi = Q(psi_lo, grid), Q(psi_hi, grid) + numerator_lo, numerator_hi = Q(numerator_lo, grid), Q(numerator_hi, grid) + assert psi_lo > Q('926899828.8291') and psi_lo <= psi_hi + low_fringe = numerator_lo / (t * psi_hi) + high_fringe = numerator_hi / (t * psi_lo) + assert Q('4.550681') < low_fringe < high_fringe < Q('4.550682') + base_lo, base_hi = powers(scale * lower, c) + coefficient = ((1+delta) * (1+Q(4*258, scale)) / (1-delta)**4) + factor_lo = coefficient * base_lo * (1+low_fringe/lower+delta) + factor_hi = coefficient * base_hi * (1+high_fringe/lower+delta) + threshold_lo = powers(2, debit)[0] + previous_tick_hi = powers(2, debit-Q(1, 2**30))[1] + assert threshold_lo - factor_hi > Q(2, 10**10) + # This rejects one extra debit tick using a lower bound on the SAME + # complete accounting expression; it is not a lower bound on physical work. + assert factor_lo - previous_tick_hi > Q(4, 10**10) + old_axes = sum(Q(k)*n for k,n in recipe.targets.histogram.items()) + coarse = 10 * old_axes / (t * psi_hi) + old_factor_lower = coefficient * base_lo * (1+coarse/lower+delta) + assert old_factor_lower > powers(2, debit)[1] + + # Show that the averaged estimate is not a valid pointwise cap. + # Every selected edge is occupied, has positive interval length and is + # strictly descending; the production calendar's grid makes its grant + # positive at H>=1024 (checked separately below). + witness = None + for (raw_r, raw_k), share in recipe.cells.items(): + r, k = Q(raw_r), Q(raw_k) + for d in range(lower, lower+40, 2): + start = 2 * floor(Q(d)*k/(2*r)) + for e in range(start, start+12, 2): + left, right = max(Q(e), Q(d)*k/r), min(Q(e+2), Q(d+2)*k/r) + suffix = r*(e-8)-k*(d-8) + average = 9*(k-r) + t*r*r/(2*k*lower) + if left < right and suffix > average: + assert 0 <= suffix < 10*k-8*r + assert e > d and share > 0 + witness = (r, k, e, d, suffix, left, right) + break + if witness: + break + if witness: + break + assert witness is not None + # Replay the actual downward-rounded integral and one real per-owner + # typed share at the smallest installed Gaussian rank, not a proxy mean. + from transport import Measure + r, k, e, d, _, left, right = witness + typed = next((a, b, share) for (a, rr, b, kk), share in recipe.typed_cells().items() + if rr == r and kk == k and share > 0) + a, b, typed_share = typed + per_owner = typed_share / recipe.targets.variants[b].histogram[k] + M = 2**1024 + m = Measure(t, M**6, max(256, 64*M.bit_length())) + grant = recipe.types()[a].multiplicity * m.mass(left, right)[0] * per_owner + assert floor(grant) > 0 and e < 2*(M//(1724*306)) + def level(band): + value, result = Q(lower), 0 + while value*Q(6, 5) <= band: + value *= Q(6, 5) + result += 1 + return result + assert level(d) < level(e) + print('PASS_INDEPENDENT_GAUSSIAN_ENVELOPE', + 'debit', str(debit), 'interior_edges', len(recipe.cells), + 'previous_debit_tick_rejected', True, + 'coarse_suffix_budget_rejected', True, + 'averaged_bound_not_pointwise_witness', tuple(map(str, witness)), + 'typed_grant_bits', floor(grant).bit_length()) + return dict(debit=str(debit), lower_factor=str(factor_lo), upper_factor=str(factor_hi), + lower_fringe=str(low_fringe), upper_fringe=str(high_fringe), + pointwise_witness=tuple(map(str,witness))) diff --git a/research/p104-integrated-gaussian-suffix/appendix/rebuild_e8.py b/research/p104-integrated-gaussian-suffix/appendix/rebuild_e8.py new file mode 100644 index 0000000000..0d10bad94f --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/appendix/rebuild_e8.py @@ -0,0 +1,119 @@ +"""Reconstruct #8073's source and apply the Gaussian envelope successor. + +The bundled #8073 source/peer archive is not modified. This script only +creates its own candidate tree and updates SHA-256 image checks for the +changed terminal profile and proof files. +""" + +from hashlib import sha256 +import json +from pathlib import Path +import runpy +import shutil +import subprocess +import sys + +ROOT = Path(__file__).resolve().parent +SOURCE, DEST = ROOT / 'source8073', ROOT / 'combined' +OVERLAY = ROOT / 'overlay' +OLD = 'TERMINAL = Profile((8192, 117168, 524288), 501831, Q(".003898219753506"))' +NEW = 'TERMINAL = Profile((8192, 121057, 524288), 496174, Q(".003898221247474783"))' + + +def replace(path, before, after): + data = path.read_text() + if data.count(before) != 1: + raise ValueError(f'{path.name}: expected exactly one {before!r}') + path.write_text(data.replace(before, after)) + + +def sha(path): + return sha256(path.read_bytes()).hexdigest() + + +def main(): + if DEST.exists(): + raise RuntimeError(f'Candidate already exists at {DEST}; preserve it or remove it explicitly') + DEST.mkdir() + source = runpy.run_path(str(SOURCE / 'verify.py')) + peer = source['restore'](DEST) + runpy.run_path(str(SOURCE / 'prepare.py'))['materialize'](peer) + for name in ('check_cutoff.py', 'check_stage_seam.py', 'check_ordinary_floor.py'): + shutil.copyfile(SOURCE / name, peer / name) + + # Bootstrap the exact predecessor once, before changing the new profile, + # to authenticate and derive the expected post-installation image hash. + baseline = DEST / 'baseline-runtime' + subprocess.run([sys.executable, '-IB', str(peer/'bootstrap.py'), str(baseline)], check=True) + baseline_image = (baseline/'installations.py').read_text() + assert baseline_image.count(OLD) == 1 + new_image_hash = sha256(baseline_image.replace(OLD, NEW).encode()).hexdigest() + replace(peer/'runtime.patch', OLD, NEW) + for name in ('weighted_suffix.py', 'independent_gaussian.py', 'check_combined_seams.py'): + shutil.copyfile(OVERLAY/name, peer/name) + + positive = peer/'positive_debit.py' + replace(positive, 'POSITIVE_DEBIT = Q(64939, 524288)', + 'POSITIVE_DEBIT = Q(130699669, 2**30)') + replace(positive, 'from grades import UPPER_DIVISOR', + 'from grades import UPPER_DIVISOR\nfrom weighted_suffix import upper_numerator') + replace(positive, 'fringe = 10 * target_axes / (t * psi)', + 'fringe = upper_numerator(recipe, lower, intervals) / (t * psi)') + replace(positive, 'assert fringe < Q("7.335168")', + 'assert Q("4.550681") < fringe < Q("4.550682")') + + receipt = peer/'receipt.py' + for old,new in ( + ('DEBIT = Q(64939, 2**19)', 'DEBIT = Q(130699669, 2**30)'), + ('assert cost == 318291911 and premium == 517', + 'assert cost == 318291851 and premium == 516'), + ('(516570, 501831)', '(516861, 496173)'), + ('older = Q(".003898214283192")', 'older = Q(".003898219753506")'), + ('assert gain == Q(2735157, 500000000000000)', + 'assert gain == Q(1493968783, 1000000000000000000)'), + ): + replace(receipt, old, new) + + independent = peer/'independent_price.py' + text = independent.read_text() + first, last = text.index('def weighted():'), text.index('def ordinary_debit():') + text = (text[:first] + 'def weighted():\n' + ' sys.path.insert(0, str(Path(__file__).resolve().parent))\n' + ' from independent_gaussian import verify\n' + ' verify(prepare_native(TERMINAL)[-1], powers)\n\n\n' + text[last:]) + independent.write_text(text) + replace(independent, 'TERMINAL.kappa - peer == Q("0.000000018139806")', + 'TERMINAL.kappa - peer == Q(19633774783, 1000000000000000000)') + replace(peer/'check_cutoff.py', 'assert heights == (1024, 501831)', + 'assert heights == (1024, 496174)') + for old,new in ( + ('TERMINAL.rank_logs==(8192,117168,524288) and TERMINAL.complex_log==501831', + 'TERMINAL.rank_logs==(8192,121057,524288) and TERMINAL.complex_log==496174'), + ('(a[-1].rank_log,b[-1].rank_log)==(1024,501831)', + '(a[-1].rank_log,b[-1].rank_log)==(1024,496174)'), + ): + replace(peer/'check_ordinary_floor.py', old, new) + replace(peer/'verify.py', '"check_stage_seam.py"', '"check_combined_seams.py"') + # The appendix rebuild does not run product; it retains the upstream verifier. + + manifest = json.loads((peer/'SOURCES.json').read_bytes()) + manifest['runtime_images']['installations.py']['after'] = new_image_hash + for name in ('runtime.patch', 'positive_debit.py', 'receipt.py', 'independent_price.py', + 'weighted_suffix.py', 'independent_gaussian.py', 'check_combined_seams.py', + 'check_cutoff.py', 'check_ordinary_floor.py', 'check_stage_seam.py', 'verify.py'): + manifest['local_sources'][name] = sha(peer/name) + (peer/'SOURCES.json').write_text(json.dumps(manifest, indent=2)+'\n') + + runtime = DEST/'runtime' + subprocess.run([sys.executable, '-IB', str(peer/'bootstrap.py'), str(runtime)], check=True) + receipt = subprocess.run([sys.executable, '-IB', str(peer/'receipt.py'), str(runtime)], + check=True, capture_output=True, text=True) + result = json.loads(receipt.stdout) + (peer/'RESULT.json').write_text(json.dumps(result, indent=2)+'\n') + (ROOT/'RESULT-8073.json').write_text(json.dumps(result, indent=2)+'\n') + print('PASS_SOURCE_RECONSTRUCTION', peer, 'profile_sha256', new_image_hash) + print('PASS_COMBINED_RECEIPT', result['terminal']['kappa'], result['complete_log2_C']) + + +if __name__ == '__main__': + main() diff --git a/research/p104-integrated-gaussian-suffix/appendix/weighted_suffix.py b/research/p104-integrated-gaussian-suffix/appendix/weighted_suffix.py new file mode 100644 index 0000000000..2745824846 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/appendix/weighted_suffix.py @@ -0,0 +1,43 @@ +"""Directed upper price for the installed interior Gaussian suffixes. + +This is a price proof only. It does not change the installed calendar, +word, ownership, rounding, terminal loss, exterior service, or tape clock. +""" + +from fractions import Fraction as Q +from math import gcd + + +def upper_numerator(recipe, lower, intervals): + """Bound the integral of every occupied paid-to-target edge. + + All edges are summed using their actual weighted paid counts and actual + installed shares. The final upward quantization is one-sided. + """ + c = recipe.trial + t = 1 - c + assert 0 < t < 1 and lower > 8 and lower % 2 == 0 + assert len(recipe.cells) == 51 + grid = 1 << 96 + total = 0 + average_better = 0 + for (raw_r, raw_k), share in recipe.cells.items(): + r, k = Q(raw_r), Q(raw_k) + assert share > 0 and 5 * r <= 4 * k + assert (2 * r).denominator == (2 * k).denominator == 1 + assert recipe.paid.histogram[raw_r] > 0 + assert recipe.targets.histogram[raw_k] > 0 + # Since e,d are even, every routed suffix is at most this value. + pointwise = 10 * k - 8 * r - gcd(int(2 * r), int(2 * k)) + # Integrate the two sawtooth terms against y^(-1-t), y>=lower. + averaged = 9 * (k - r) + t * r * r / (2 * k * lower) + assert pointwise > 0 and averaged > 0 + average_better += averaged < pointwise + bound = min(pointwise, averaged) + # The fraction of the y density induced from x is (r/k)^t. + ratio_upper = Q(intervals(raw_r, t)[1], intervals(raw_k, t)[0]) + assert 0 < ratio_upper < 1 + term = recipe.paid.histogram[raw_r] * share * ratio_upper * bound + total += -(-(term * grid).numerator // (term * grid).denominator) + assert average_better == len(recipe.cells) + return Q(total, grid) diff --git a/research/p104-integrated-gaussian-suffix/checks/actual_six_grant.py b/research/p104-integrated-gaussian-suffix/checks/actual_six_grant.py new file mode 100644 index 0000000000..00c016d3d8 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/checks/actual_six_grant.py @@ -0,0 +1,69 @@ +"""Check one prospective source-to-receiver grant at actual H=1024 precision.""" + +from argparse import ArgumentParser +from datetime import datetime, timezone +from fractions import Fraction as F +from hashlib import sha256 +from pathlib import Path +import json +import sys + + +def level(band, lower): + cap = F(lower) + result = 0 + while cap*F(6,5) <= band: + cap *= F(6,5) + result += 1 + return result + + +def main(): + parser = ArgumentParser() + parser.add_argument("--base-runtime",type=Path, + default=Path(__file__).resolve().parents[1]/"source/installed-8072/runtime") + args = parser.parse_args() + sys.path.insert(0,str(args.base_runtime.resolve())) + started = datetime.now(timezone.utc).isoformat() + from upstream import install + install() + from grades import WEIGHTS, numerical_recipe + from transport import Measure + H,L = 1024,1054 + M = 1<target_level + lo,hi = Measure(1-qrecipe.trial,volume,max(256,64*M.bit_length())).mass(left,right) + records=[] + for (a,raw_r,b,raw_k), share in qrecipe.typed_cells().items(): + if (raw_r,raw_k)!=(r,k): + continue + j = next(j for j,v in enumerate(qrecipe.paid.variants[a]) if v==r) + i = next(i for i,v in enumerate(qrecipe.targets.variants[b]) if v==k) + per_owner = share/qrecipe.targets.variants[b].histogram[k] + actual = int(WEIGHTS[a]*lo*per_owner) + assert 0=4 cost at least one discarded height m. The rate supplied to the + # final three stages by all older stages is clamped at eta independently + # of n. Removing their grid floors, clamps and the other lost heights is + # a monotone relaxation of the permitted recurrence. + more=three+ETA/250**3-stop + assert max(one,two,more)= 1 and alpha >= 0 + b = max(0, x.numerator.bit_length()-x.denominator.bit_length()) + if 2**b > x: + b -= 1 + z = x/2**b + lo, hi = log_series(z) + l2, h2 = log_series(F(2)) + lo, hi = enclose(alpha*(lo + b*l2), alpha*(hi + b*h2)) + assert hi < 1 + pl = ph = ql = qh = 1 + for i in range(1, 35): + pl, ph = enclose(pl*lo/i, ph*hi/i) + ql += pl + qh += ph + return enclose(ql, qh + (ph*hi/35)/(1-hi/36)) + + +def numerical_contract(recipe, s, lower, booked): + c = recipe.trial + t = 1-c + psi_lo = psi_hi = num_lo = num_hi = 0 + minimum_requirement = 0 + phase_count = 0 + typed_pooled = Counter() + tcounts = [v.histogram for v in recipe.targets.variants] + pcounts = [v.histogram for v in recipe.paid.variants] + weights = (5, 451) + for (a,r,b,k), typed in recipe.typed_cells().items(): + # TypedPlan divides this typed share equally amongst real b,k ports. + unit = typed/tcounts[b][k] + typed_pooled[r,k] += weights[a]*pcounts[a][r]*tcounts[b][k]*unit + for (raw_r,raw_k), share in recipe.cells.items(): + r, k = F(raw_r), F(raw_k) + z = k/r + common = gcd(int(2*r),int(2*k)) + assert int(2*r) == 2*r and int(2*k) == 2*k + assert typed_pooled[r,k] == recipe.paid.histogram[r]*share + weight = typed_pooled[r,k] + p_lo, p_hi = exp_power(z,c) + d_lo, d_hi = weight*r*(p_lo-1)/c, weight*r*(p_hi-1)/c + psi_lo += d_lo + psi_hi += d_hi + mean = (s+1)*(k-r) + t*r*r/(2*k*lower) + num_lo += weight*p_lo/z*mean + num_hi += weight*p_hi/z*mean + # Enumerate each constant overlap in one joint period, with even-bin + # starts generated independently of the executable's own bucketing. + period = 2*z.denominator + knots = sorted({F(2*j) for j in range(z.denominator+1)} | + {F(2*j)/z for j in range(z.numerator+1)}) + suffixes = [] + exact_area = 0 + for left, right in zip(knots, knots[1:]): + middle = (left+right)/2 + dst, src = 2*floor(middle/2),2*floor(z*middle/2) + value = r*(src-s)-k*(dst-s) + suffixes.append(value) + exact_area += value*(right-left) + need = (2*r-common)/(k-r) + minimum_requirement = max(need,minimum_requirement) + assert exact_area == period*(s+1)*(k-r) + assert min(suffixes) == s*(k-r)-2*r+common >= 0 + assert max(suffixes) == s*(k-r)+2*k-common + phase_count += len(suffixes) + delta = F(1,2**128) + scale = 263772 + f_lo, f_hi = num_lo/(t*psi_hi), num_hi/(t*psi_lo) + s_lo, s_hi = exp_power(scale*lower,c) + common = (1+delta)*(1+F(1032,scale))/(1-delta)**4 + fac_lo = common*s_lo*(1+f_lo/lower+delta) + fac_hi = common*s_hi*(1+f_hi/lower+delta) + tick = F(1,booked.denominator) + threshold, _ = exp_power(2,booked) + _, previous = exp_power(2,booked-tick) + assert fac_hi < threshold and previous < fac_lo + return dict(fringe_nano_bounds=[floor(10**9*f_lo),ceil(10**9*f_hi)], + factor_pico_bounds=[floor(10**12*fac_lo),ceil(10**12*fac_hi)], + booked_debit=str(booked), lower_gap_pico=floor(10**12*(threshold-fac_hi)), + previous_tick_fails_gap_pico=floor(10**12*(fac_lo-previous)), + phase_intervals=phase_count, grade_cells=len(typed_pooled), + typed_cells=len(recipe.typed_cells()), minimum_shift_requirement=str(minimum_requirement)) + + +def plan_check(runtime, s, t): + """Compare full literal event stream with an independent three-part identity.""" + spec = util.spec_from_file_location("referee_typed_"+str(s), runtime/"typed_transport.py") + module = util.module_from_spec(spec) + sys.modules[spec.name] = module + spec.loader.exec_module(module) + r,k = 4,5 + L,U,V = 50,108,14000 + K = 11 + n = 4096 + weights = (2,3) + # Two copies in each actual raw list force both later chronological loans + # and nontrivial issuer/owner aggregation at both ends. + types = [module.NativeType((k,k),(r,r),w) for w in weights] + cells = {(a,r,b,k): F(w,sum(weights)) for a in range(2) for b,w in enumerate(weights)} + extra = {"column_offset":s} if s!=8 else {} + p = module.TypedPlan(n, types, cells, t, L, U, V, K, n, + delay_base=3,padding=1, **extra) + matched = unused = drain = loans = 0 + literal_by_prefix = Counter() + source_by_type = Counter() + witness = None + actual_grants = 0 + zero_ideal_with_no_grant = 0 + c = 1-t + mean = (s+1)*(k-r) + t*r*r/F(2*k*L) + for e in p.bands: + for a, raw in enumerate(types): + for j,grade in enumerate(raw.paid): + parent = grade*(e-s) + potential = 0 + avail = p.count[e,a] + issued = max(0,K-j*p.delay[e]) + by_pair = {} + for edge in p.send.get((e,a,j),()): + d,b,i = edge.band,edge.kind,edge.port + child = types[b].targets[i]*(d-s) + S = parent-child + l,u = max(F(e),F(d*k,r)),min(F(e+2),F((d+2)*k,r)) + assert l=0 + by_pair[b,i,d] = edge.count + q = cells[a,r,b,k]/types[b].targets.count(k) + lp = exp_power(l,c) + up = exp_power(u,c) + ideal_lo = weights[a]*V*q/t*(lp[0]/l-up[1]/u) + ideal_hi = weights[a]*V*q/t*(lp[1]/l-up[0]/u) + assert edge.count <= ideal_hi < edge.count+2 + if t==1: + assert ideal_lo == ideal_hi + if S > mean and issued > 0: + witness = [e,a,j,d,b,i,edge.count,S] + matched += K*edge.count*S + drain += (K-issued)*edge.count*child + loans += issued*edge.count + actual_grants += 1 + potential += edge.count + source_by_type[a,b] += edge.count + for d in p.bands: + left,right = max(F(e),F(d*k,r)), min(F(e+2),F((d+2)*k,r)) + if leftdst + depth=max(depth,route_depth) + parents_used+=1 + elif mode==2: + _, size, period = next(iterator),next(iterator),next(iterator) + assert size==k*(dst-s) and period==4*ceil(F(n,4*size)) + externals+=1 + else: + assert mode==0 and next(iterator)==k*(dst-s) + zeros+=1 + frames[frame]=(dst,depth) + max_depth = max(max_depth,depth) + elif op==1: + serial,size,selected=fields + donor,depth=frames[frame] + assert size==r*(donor-s) and selected<=size + if selected: + assert serial not in pending + pending[serial]=(selected,depth+1,donor) + observed+=int(size-selected>mean) + literal_by_prefix[bool(selected)] += size-selected + else: + assert op==2 + del frames[frame] + assert not pending and not frames and max_depth>=2 and min(zeros,externals,observed)>0 + assert parents_used==loans + literal = sum(literal_by_prefix.values()) + assert literal == p.leaves_per_epoch == (matched + unused + drain) + assert min(matched,unused,drain,loans)>0 and len(source_by_type)==4 + assert witness is not None and zero_ideal_with_no_grant>0 + integral_per_birth = (sum(weights)*2*V*F(r,k)*exp_power(F(k,r),c)[1] + *exp_power(F(L),c)[1]/(t*L)*mean) + assert matched <= K*integral_per_birth + return dict(s=s,t=str(t),event_leaves=literal,steady_matched_suffix=matched, + unallocated_full_parents=unused,late_missed_prefixes=drain, + finite_matched_grants=actual_grants, positive_interval_no_grant=zero_ideal_with_no_grant, + issued_loans=loans, typed_pairs=len(source_by_type),exterior_slots=p.source_width, + received_interiors=parents_used,exterior_descriptors=externals,zero_descriptors=zeros, + observed_nested_depth=max_depth,issued_above_average=observed, + actual_nonpointwise_witness=witness) + + +def main(): + parser = ArgumentParser() + parser.add_argument("mode",choices=["price","events"]) + parser.add_argument("--base-runtime",type=Path,default=BASE) + parser.add_argument("--six-runtime",type=Path,default=ROOT/"architect/successor/runtime") + parser.add_argument("--offset",choices=[6,8],type=int) + args = parser.parse_args() + base = args.base_runtime.resolve() + offsets = [8,6] if args.offset is None else [args.offset] + selected = {8:(1874,F(130699669,2**30),base), + 6:(1054,F(125645,1048576),args.six_runtime.resolve())} + started = datetime.now(timezone.utc).isoformat() + sys.path.insert(0,str(base)) + if args.mode == "price": + from upstream import install + install() + from grades import numerical_recipe + recipe = numerical_recipe(1024) + result = {str(s):numerical_contract(recipe,s,selected[s][0],selected[s][1]) + for s in offsets} + else: + from installations import GAUSSIAN_C + result = [plan_check(selected[s][2],s,t) for s in offsets + for t in (F(1),1-GAUSSIAN_C)] + pins = {file:sha256((base/file).read_bytes()).hexdigest() + for file in ["transport.py","typed_transport.py","grades.py"]} + if 6 in offsets and args.mode=="events": + pins["six/typed_transport.py"]=sha256((selected[6][2]/"typed_transport.py").read_bytes()).hexdigest() + print(json.dumps(dict(mode=args.mode,started_at=started, finished_at=datetime.now(timezone.utc).isoformat(), + predecessor_runtime=pins, result=result),indent=2)) + + +if __name__=="__main__": + main() diff --git a/research/p104-integrated-gaussian-suffix/checks/compare_cold_runtimes.py b/research/p104-integrated-gaussian-suffix/checks/compare_cold_runtimes.py new file mode 100644 index 0000000000..5be00ad12b --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/checks/compare_cold_runtimes.py @@ -0,0 +1,71 @@ +"""Reconstruct both public six-column capsules and compare every installed source file.""" +from argparse import ArgumentParser +from hashlib import sha256 +from pathlib import Path,PurePosixPath +from tempfile import TemporaryDirectory +import json +import runpy +import subprocess +import sys +import tarfile + +PINS={'old':'1ffaf4eed67cfe2271820bc94d62721573ff715829c829c5d9936b561eacb270', + 'new':'bacfc6ec44616063eae1584e6af07a1dbbfaf7948df1745bc059aa4510c7c9a0'} + +def unpack(path,pin,folder): + if sha256(path.read_bytes()).hexdigest()!=pin:raise ValueError('Incorrect capsule digest') + names=set() + with tarfile.open(path,'r:gz') as archive: + for m in archive: + p=PurePosixPath(m.name) + if not m.isfile() or p.is_absolute() or '..' in p.parts or ( + p.as_posix()!=m.name or m.name in names or '\\' in m.name): + raise ValueError('Unexpected capsule member') + names.add(m.name) + dest=folder/p + dest.parent.mkdir(exist_ok=True,parents=True) + dest.write_bytes(archive.extractfile(m).read()) + +def file_table(folder): + return {f.relative_to(folder).as_posix():sha256(f.read_bytes()).hexdigest() + for f in folder.rglob('*') if f.is_file() and '__pycache__' not in f.parts} + +def compare(old,new): + output={} + for subtree in ('runtime','peer'): + a=file_table(old/subtree) + b=file_table(new/subtree) + if a.keys()!=b.keys():raise ValueError('Installed file list differs') + dif={k:[a[k],b[k]] for k in a if a[k]!=b[k]} + shared={k:v for k,v in a.items() if b[k]==v} + fingerprint=sha256(json.dumps(shared,sort_keys=True,separators=(',',':')).encode()).hexdigest() + output[subtree]={'files':len(a),'identical_files':len(shared), + 'same_file_table_sha256':fingerprint,'differences':dif} + return output + +def main(): + cli=ArgumentParser(description=__doc__) + cli.add_argument('--predecessor-archive',type=Path,required=True) + cli.add_argument('--addendum-archive',type=Path,required=True) + cli.add_argument('--output',type=Path,required=True) + args=cli.parse_args() + with TemporaryDirectory(prefix='compare-six-columns-') as temporary: + leaf=Path(temporary) + unpack(args.predecessor_archive,PINS['old'],leaf) + unpack(args.addendum_archive,PINS['new'],leaf) + old=leaf/'six-column-8073' + new=leaf/'six-column-8076' + subprocess.run([sys.executable,'-IB',str(old/'compose8073.py')],check=True) + work=leaf/'reconstructed-8076' + work.mkdir() + verifier=runpy.run_path(str(new/'replay8076.py')) + verifier['restore'](args.predecessor_archive,work) + out=compare(old/'combined/successor',work/'successor') + expected=json.loads((new/'physical-equivalence.json').read_bytes()) + if out!=expected:raise ValueError('Reconstructed comparison differs from the published observation') + with args.output.open('x') as f:json.dump(out,f,indent=2,sort_keys=True);f.write('\n') + print('PASS',out['runtime']['identical_files'],'of',out['runtime']['files'],'runtime files;', + out['peer']['identical_files'],'of',out['peer']['files'],'peer files') + +if __name__=='__main__': + main() diff --git a/research/p104-integrated-gaussian-suffix/checks/guard_controls.py b/research/p104-integrated-gaussian-suffix/checks/guard_controls.py new file mode 100644 index 0000000000..cb6ac57b20 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/checks/guard_controls.py @@ -0,0 +1,127 @@ +"""Exercise archive and scope-receipt rejection without changing the source bundle.""" + +from copy import copy +from hashlib import sha256 +from importlib.util import module_from_spec, spec_from_file_location +from io import BytesIO +from pathlib import Path +from tempfile import TemporaryDirectory +import json +import shutil +import subprocess +import sys +import tarfile + +ROOT = Path(__file__).resolve().parents[1] +spec = spec_from_file_location("integrated_gaussian_verify", ROOT / "verify.py") +verify = module_from_spec(spec) +spec.loader.exec_module(verify) + + +def must_fail(action, text): + try: + action() + except ValueError as error: + if text not in str(error): + raise AssertionError("unexpected rejection: " + str(error)) from error + else: + raise AssertionError("malformed input accepted: " + text) + + +def altered_bundle(source, destination, kind): + with tarfile.open(source, "r:gz") as old, tarfile.open(destination, "w:gz") as new: + members = old.getmembers() + if kind == "absolute": + bad = tarfile.TarInfo("/six-column-8073/absolute") + bad.size = 1 + new.addfile(bad, BytesIO(b"x")) + return + for item in members: + payload = BytesIO(old.extractfile(item).read()) if item.isfile() else None + new.addfile(copy(item), payload) + item = members[0] + payload = BytesIO(old.extractfile(item).read()) if item.isfile() else None + new.addfile(copy(item), payload) + + +def fake_runner(tree, printed, receipt=None): + combined = tree / "combined" + combined.mkdir() + (combined / "run_successor.py").write_text("print(" + repr(printed) + ")\n") + logs = combined / "successor/logs" + logs.mkdir(parents=True) + if receipt is not None: + (logs / "setup.json").write_text(json.dumps(receipt)) + (logs / "setup.out").write_bytes(b"scope-output") + return combined + + +def main(): + optimized = subprocess.run([sys.executable, "-I", "-O", "-B", str(ROOT / "verify.py"), "setup"], + capture_output=True, text=True) + if optimized.returncode == 0 or "do not use -O" not in optimized.stderr + optimized.stdout: + raise AssertionError("optimized Python was not rejected") + with TemporaryDirectory(prefix="gaussian-guard-") as temporary: + tree = Path(temporary) + case = tree / "case" + (case / "source").mkdir(parents=True) + shutil.copyfile(ROOT / "source/archive-members.json", case / "source/archive-members.json") + shutil.copytree(ROOT / "source-view", case / "source-view") + original = ROOT / "source/six-column-8073-public.tar.gz" + archive = case / "source/six-column-8073-public.tar.gz" + verify.HERE = case + shutil.copyfile(original, archive) + archive.write_bytes(archive.read_bytes() + b"corrupt") + must_fail(lambda: verify.unpack(tree / "bad-hash"), "archive digest mismatch") + for kind, message in (("absolute", "noncanonical archive path"), + ("duplicate", "duplicate archive member")): + altered_bundle(original, archive, kind) + verify.ARCHIVE_SHA256 = sha256(archive.read_bytes()).hexdigest() + must_fail(lambda: verify.unpack(tree / kind), message) + + with tarfile.open(original, "r:gz") as bundle: + peer = bundle.extractfile("six-column-8073/peer8057.tar.gz").read() + peer_pins = json.loads(bundle.extractfile("six-column-8073/source8073/PEER-SOURCE.json").read()) + nested = tree / "peer.tar.gz" + nested.write_bytes(peer) + for kind, message in (("absolute", "invalid peer path"), ("duplicate", "duplicate peer member")): + variant = tree / (kind + "-peer.tar.gz") + altered_bundle(nested, variant, kind) + data = variant.read_bytes() + pins = dict(peer_pins, archive_sha256=sha256(data).hexdigest()) + must_fail(lambda: verify.validate_peer(data, pins), message) + + shutil.copyfile(ROOT / "source/addendum-members.json", case / "source/addendum-members.json") + shutil.copytree(ROOT / "source-view-8076", case / "source-view-8076") + addendum_original = ROOT / "source/six-column-8076-addendum.tar.gz" + addendum = case / "source/six-column-8076-addendum.tar.gz" + shutil.copyfile(addendum_original, addendum) + addendum.write_bytes(addendum.read_bytes() + b"corrupt") + must_fail(lambda: verify.unpack_addendum(tree / "bad-addendum-hash"), "addendum archive digest mismatch") + for kind, message in (("absolute", "noncanonical addendum path"), + ("duplicate", "duplicate addendum member")): + altered_bundle(addendum_original, addendum, kind) + verify.ADDENDUM_SHA256 = sha256(addendum.read_bytes()).hexdigest() + must_fail(lambda: verify.unpack_addendum(tree / (kind + "-addendum")), message) + + one = tree / "selector" + one.mkdir() + must_fail(lambda: verify.run_scopes(fake_runner(one, "raw 0 0.1"), ("setup",)), + "scope output does not match selection") + record = {"mode": "setup", "code": 1, + "started_at": "2026-01-01T00:00:00+00:00", + "finished_at": "2026-01-01T00:00:01+00:00", "output_sha256": "bad"} + two = tree / "failed" + two.mkdir() + must_fail(lambda: verify.run_scopes(fake_runner(two, "setup 0 0.1", record), ("setup",)), + "scope failed or mislabeled") + record["code"] = 0 + three = tree / "digest" + three.mkdir() + must_fail(lambda: verify.run_scopes(fake_runner(three, "setup 0 0.1", record), ("setup",)), + "scope output digest mismatch") + print("PASS_ARCHIVE_AND_RECEIPT_GUARDS") + + +if __name__ == "__main__": + main() diff --git a/research/p104-integrated-gaussian-suffix/checks/minimum_signed_invoice.py b/research/p104-integrated-gaussian-suffix/checks/minimum_signed_invoice.py new file mode 100644 index 0000000000..c97b1d0cc9 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/checks/minimum_signed_invoice.py @@ -0,0 +1,21 @@ +"""Prove the least complete recurring log2 invoice for the installed reported gain.""" +from fractions import Fraction as Q +from pathlib import Path +from contextlib import redirect_stdout +from io import StringIO +import json,runpy + +with redirect_stdout(StringIO()): + proof=runpy.run_path(str(Path(__file__).with_name('all_stage_caps.py'))) +K=Q('.003898222531555482') +ordinary_debit=Q(11204,8192) +gaussian_debit=Q(125645,1048576) +candidate_clock=318291611 +worst=proof['compute'](candidate_clock-1,ordinary_debit,gaussian_debit,K) +G,S=worst['minimum_G_to_beat_3_stage'],worst['ordinary_budget_above_this_G'] +ranks,ordinary=proof['cubic_bound'](S,ordinary_debit) +assert G==491002 and S==657091 and ranks==(8192,124611,524288) +assert ordinary 8 or column_offset % 2: + raise ValueError("Use a nonnegative even column offset of at most eight") + self.column_offset = column_offset + if len(types) != 2 or lower <= column_offset'''), + (' owners = ids[b, k]',''' if column_offset < 8: + rr, kk = Q(2*r), Q(2*k) + if rr.denominator != 1 or kk.denominator != 1 or column_offset*(k-r) < rr-gcd(rr.numerator,kk.numerator): + raise ValueError("A routed prefix can exceed its real paid field") + owners = ids[b, k]'''), + ('upper - 8','upper - self.column_offset'), + ('e - 8','e - self.column_offset',4), + ('band - 8','band - self.column_offset',3)]) + adjust(dest/'grades.py',[('LOWER = 1874','LOWER = 1054'),(' width=self.width,',' width=self.width,\n column_offset=6,')]) + adjust(dest/'installations.py',[('Profile((8192, 111681, 524288), 509812, Q(".003898223617430"))','Profile((8192, 118919, 524288), 499284, Q(".003898226579820971"))')]) + independent=checks/'positive_debit.py' + adjust(independent,[ + ('from fractions import Fraction as Q','from fractions import Fraction as Q\nfrom math import gcd'), + ('BAND_LOWER = 1874','BAND_LOWER = 1054'),('Q(64939, 524288)','Q(125645,1048576)'), + (' fringe = 10 * target_axes / (t * psi)',''' # Nonempty interior grants are rounded down. The full proof bounds + # the y-integral of the integer paid suffix after y=x*r/k. + contributions = Q(0) + needed = Q(0) + for (r,k),share in cells.items(): + r,k=Q(r),Q(k) + r2,k2=int(2*r),int(2*k) + assert 2*r == r2 and 2*k == k2 + needed=max(needed,(2*r-gcd(r2,k2))/(k-r)) + ratio_upper=Q(intervals(r,t)[1],intervals(k,t)[0]) + mean=7*(k-r)+t*r*r/(2*k*lower) + contributions += paid[r]*share*ratio_upper*mean + assert needed==Q(94,17)<6 + fringe=contributions/(t*psi)'''), + ('Q("7.335168")','Q("3.539446")'),('(upper - 8)','(upper - 6)')]) + adjust(checks/'receipt.py',[('Q(64939, 2**19)', 'Q(125645,1048576)'), ('LOWER == 1874', 'LOWER == 1054'), ('cost == 318291900 and premium == 518', 'cost == 318291900 and premium == 516'), ("late['log2_B'] == 206131657", "late['log2_B'] == 208447817"), ('(516124, 509812)', '(516703, 499284)'), ('older = Q(".003898219753506")', 'older = Q(".003898223617430")'), ('Q(965981, 250000000000000)', 'Q(2962390971, 1000000000000000000)'), ('Q(1361743, 100000000000000)', 'Q(16579820971, 1000000000000000000)'), ('Q(523210198560303585338978849681, 134217728000000000000000000000000)', 'Q(1667119388378402860472786027, 427661302169600000000000000000)')]) + adjust(checks/'check_placement.py',[('size = 258 * (e - 8)','size = 258 * (e - 6)')]) + adjust(checks/'check_exterior.py',[ + (' L = 10\n U = 12',' L = 8\n U = 10'), + (' assert 4 * U < 5 * L',' assert 4 * U <= 5 * L'), + (' def __init__(self):\n',' column_offset = 6\n\n def __init__(self):\n'), + ('size = (L - 8) * k','size = (L - 6) * k'), + ('true[owner] = (2 * k, ext.period)','true[owner] = ((L-p.column_offset) * k, ext.period)'), + ('cols = 2 * (1 + kind)','cols = (L-p.column_offset) * (1 + kind)')]) + # One actual linked packet at e=22, d=10 retains the dense predecessor's + # physical widths 16 and 4. Check both typed headers at the new origin. + adjust(checks/'check_nested.py',[ + (' grant = (',''' from typed_transport import column_header + parent_bin, child_bin, offset = 22, 10, 6 + rr, kk = 1, 2 + grant_lo = max(parent_bin, Q(child_bin*kk,rr)) + grant_hi = min(parent_bin+2, Q((child_bin+2)*kk,rr)) + assert (grant_lo,grant_hi)==(22,24) + grant = ('''), + ('.mass(24, 26)[0]','.mass(grant_lo, grant_hi)[0]'), + ('4_400_000_000 < grant.numerator // grant.denominator < 4_600_000_000','5_000_000_000 < grant.numerator // grant.denominator < 6_000_000_000'), + ('and 24 * 1 == 12 * 2','and grant_lo < grant_hi'), + (' P = 16\n S = 8',''' P = column_header(parent_bin-offset,0) + child_header = column_header(child_bin-offset,1) + S = 2*(child_header-1) + assert (P,S,child_header)==(16,8,5)'''), + ('method.native(cr, S // 2 + 1)','method.native(cr, child_header)')]) + # Exercise the new mode in generic dirty calendar and all owners too. + adjust(checks/'check_calendar.py',[(' padding=1,',' padding=1,\n column_offset=6,'), + (' 192,',' 196,')]) + adjust(checks/'check_ownership.py',[(' padding=1,',' padding=1,\n column_offset=6,'), + ('e - 8','e - 6',5)]) + (candidate/'delta-pins.json').write_text(json.dumps(changes,indent=2)+'\n') + print('REGISTERS',len(changes)) + + +if __name__=='__main__':main() diff --git a/research/p104-integrated-gaussian-suffix/source-view-8076/changes/certify_frontier.py b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/certify_frontier.py new file mode 100644 index 0000000000..07f06edfe2 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/certify_frontier.py @@ -0,0 +1,154 @@ +"""Directed reconstruction of the #8076 composite price and fixed-clock allocation.""" +from decimal import Decimal, getcontext +from fractions import Fraction as Q +from functools import cache +from math import ceil, gcd, isqrt +from pathlib import Path +import json +import sys + +ROOT = Path(__file__).resolve().parent +RUNTIME = ROOT / "runtime" +sys.path.insert(0, str(RUNTIME)) +from upstream import HERE, install +install() +sys.path.insert(0, str(ROOT / "peer/research/tiered-native-multiplier/source")) +from grades import numerical_recipe +from installations import BINARY_C, GAUSSIAN_C +from outer_budget import margins +from strong_complex import LAYOUT, WORD, load_changed, word +sys.path.insert(0, str(RUNTIME / "inputs/complex-source")) +from verify_component import check_decrease, margin + +getcontext().prec = 52 +GRID = 1 << 192 +C = GAUSSIAN_C +T = 1 - C +BASE_L = 1874 +CLOCK_CAP = 318291900 +STOP = Q(5, 10**18) +TARGET = Q(39, 10000) +OLD_DEBIT = Q(64939, 524288) +ORD_DEBIT = Q(11178, 8192) +OLD_UPPER = Q(1667119388378402860472786027,427661302169600000000000000000) + + +def dec(value, places=32): + value = Q(value) + return format(Decimal(value.numerator) / Decimal(value.denominator), f".{places}f") + + +@cache +def powers(base, exponent): + """Independent directed interval for a rational base and a positive dyadic exponent.""" + base, exponent = Q(base), Q(exponent) + assert base > 0 and 0 <= exponent < 1 and exponent.denominator.bit_count() == 1 + low = int(base * GRID) + high = ceil(base * GRID) + low_result = high_result = GRID + for bit in range(exponent.denominator.bit_length() - 2, -1, -1): + low = isqrt(low * GRID) + high = 1 + isqrt(high * GRID - 1) + if exponent.numerator & (1 << bit): + low_result = (low_result * low) // GRID + high_result = -(-high_result * high // GRID) + return Q(low_result, GRID), Q(high_result, GRID) + + + + + + + + +def aggregate(recipe): + edges = [(Q(r), Q(k), w, recipe.paid.histogram[r]) for (r,k),w in recipe.cells.items()] + psi = sum(count*w*r*(powers(k/r,C)[0]-1)/C for r,k,w,count in edges) + price_weights = [(r,k,count*w*powers(r/k,T)[1]) for r,k,w,count in edges] + return edges, psi, price_weights + + + + +def factor(fringe, scale, lower): + delta = Q(1, 2**128) + return ((1+delta) * (1+Q(1032, scale)) * powers(scale*lower,C)[1] * + (1+fringe/lower+delta) / (1-delta)**4) + + + + +def ordinary(heights): + rate = Q(0) + for i,h in enumerate(heights): + rate = min(TARGET, (249*(BINARY_C-ORD_DEBIT/h)+rate)/250) + if i+1 < len(heights): + rate = Q(int(rate*10**21)-1,10**21) + return rate + + +def shape(g): + total=(CLOCK_CAP-1740-220*g)//320 + last=524288 + rest=total-last + weights=(Q(1,62500),Q(1,250),Q(1)) + lo,hi=max(8192,rest-last),min(last,rest-8192) + first_lo,first_hi=lo,hi + while lomiddle_cost:lo=n+1 + else:hi=n + optimum=lo + h=(optimum,rest-optimum,last) + def ideal(hs): + return Q(249,250)*sum(w*(BINARY_C-ORD_DEBIT/b) + for w,b in zip(weights,hs)) + # Separable integer reciprocal costs. Every deposit outside this fixed + # slice originates in a lost unit or in a decrement of the last stage. + inc=[w/(b*(b+1)) if b8192 else None for w,b in zip(weights,h)] + assert all(d>=inc[j] for i,d in enumerate(dec) if d is not None + for j in range(3) if i!=j) + third_gap=dec[2]-max(inc[0],inc[1]) + budget_gap=min(x for x in dec if x is not None) + near=[(n,rest-n,last) for n in range(max(first_lo,optimum-1),min(first_hi,optimum+1)+1)] + best=max(near,key=ordinary) + assert ideal(h)-ordinary(best) < Q(249,250)*ORD_DEBIT*min(third_gap,budget_gap) + for n in (optimum-2,optimum+2): + if first_lo<=n<=first_hi: + assert ideal((n,rest-n,last))at(lo)[2] and at(hi)[1]1: + m=(lo+hi)//2 + _,o,c=at(m) + if o>c:lo=m + else:hi=m + rows=[(min(o,c)-STOP,g,hs,o,c) for g,(hs,o,c) in ((k,at(k)) for k in (lo,hi))] + value,g,hs,o,c=max(rows) + disclosed=Q(int(value*10**18),10**18) + assert disclosed+STOP < min(o,c) + strict,functional,positive=margins(disclosed,Q(1,10**18),disclosed+STOP,c) + assert len(strict)==54 and len(functional)==4 and min(*strict,*functional,positive)>0 + return { + "gaussian_height":g,"ordinary_heights":hs,"complete_clock":1740+320*sum(hs)+220*g, + "supremum":str(value),"lower_bookable":str(disclosed),"lower_decimal":dec(disclosed,18), + "strict_gain_over_8076_ceiling":str(disclosed-OLD_UPPER),"ordinary_upper":str(o), + "positive_upper":str(c),"positive_signed_margin":str(positive), + "smaller_crossing_height":lo,"higher_crossing_height":hi, + "signed_inequalities_passed":[len(strict),len(functional),1], + } + + + + diff --git a/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_corrupt_owner.py b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_corrupt_owner.py new file mode 100644 index 0000000000..ebd58d9c10 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_corrupt_owner.py @@ -0,0 +1,26 @@ +"""A one-axis under-return must fail during an actual dirty typed fixture.""" +from pathlib import Path +import runpy,sys +root=Path(__file__).resolve().parent +runtime=Path(sys.argv[1]).resolve();sys.path.insert(0,str(runtime)) +from typed_transport import TypedPlan + +class UnderReturn(TypedPlan): + damaged=False + def send_prefix(self,*args,**kwargs): + width=super().send_prefix(*args,**kwargs) + if width>1 and not UnderReturn.damaged: + UnderReturn.damaged=True + return width-1 + return width + +source=root/'successor/peer/research/frequency-weighted-native-multiplier/check_calendar.py' +check=runpy.run_path(str(source))['run'] +check.__globals__['TypedPlan']=UnderReturn +try: + check() +except (AssertionError,ValueError,ArithmeticError,IndexError) as error: + assert UnderReturn.damaged + print('PASS_CORRUPTED_ONE_AXIS_PREFIX_REJECTED',type(error).__name__) +else: + raise AssertionError('The one-axis under-return escaped its real dirty caller') diff --git a/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_six_ordinary.py b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_six_ordinary.py new file mode 100644 index 0000000000..1f2369ca33 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_six_ordinary.py @@ -0,0 +1,221 @@ +"""Check the actual ordinary floor and fully charged occupied-edge calendar.""" +from collections import Counter +from fractions import Fraction as Q +from hashlib import sha256 +import json +from pathlib import Path +import sys + +RUNTIME=Path(sys.argv[1]).resolve() +sys.path.insert(0,str(RUNTIME)) +from upstream import install + +install() +LOWER=18960 + + +def ceil(x): + return -(-x.numerator//x.denominator) + + +def all_size_stock(word, c, intervals, unit): + """Discharge the parameterized TRANSFER.md hypotheses at the new floor.""" + t = 1-c + targets, paid = Counter(word.targets), Counter(word.paid) + assert max(targets) <= 134 and min(paid) >= 1 + assert all(5*r <= 4*k for r,k in word.cells) + assert all(sum(p for (u,k),p in word.cells.items() if u==r)==1 for r in paid) + # Check actual directed per-receiving-label funding and the whole raw margin. + t_lower = {k: intervals(k,t)[0] for k in targets} + p_upper = {r: intervals(r,t)[1] for r in paid} + t_hi = sum(n*intervals(k,t)[1] for k,n in targets.items()) + p_lo = sum(n*intervals(r,t)[0] for r,n in paid.items()) + assert sum(targets[k]*v for k,v in t_lower.items())>sum(paid[r]*v for r,v in p_upper.items()) + assert 100*p_lo>99*t_hi + for k,n in targets.items(): + load=sum(paid[r]*p*p_upper[r] for (r,s),p in word.cells.items() if s==k) + assert 01 + + # Check the smallest admitted numerical scale; every margin below grows + # with N. Actual binary native stages start no earlier than H=3000. + H=1024 + N=1<=(1-delta)*N + assert Q(6,5)**4>2 and Q(6,5)**73>2**19 + assert len(word.paid)<2**19 + assert 2**19*Q(1,1024*ambient*LOWER)**77+Q(1,N**77)<1 + lower_power=Q(intervals(LOWER,t)[0],unit) + assert lower_power>1024 and Q(1,t*lower_power)+Q(2,N**5)<2 + # Endpoint inverse bases are >1/(512N) through all roots. The + # original 61-stage envelope costs 397+30.5H bits per endpoint. + assert c.denominator.bit_length()-1<=60 and Q(1,N)-Q(1,2**(64*(H+1)))>Q(1,512*N) + grid_error_bits=397+31*H+6*H+3-64*(H+1) + assert grid_error_bits<-132 + # Time and integer errors are already normalized conservatively without + # the L**c*psi denominator, which is strictly greater than one. + assert c>0 and 1=1024. + assert suffix_birth_error1 + assert (1-Q(1,N))/Q(257,256)>Q(1,2) + return {"fringe_upper_1e9":ceil(fringe*10**9),"psi_lower_floor":int(psi), + "grid_absolute_error_exponent_at_H1024":grid_error_bits, + "suffix_target_axes":target_axes, + "suffix_birth_error_upper_at_H1024":"2^30/N^5", + "normalized_error_allowance":"2^-128", + "birth_bound":"2V","copy_group_bound":"3N^3","whole_field_width":"N^92", + "first_two_columns":[LOWER-8,LOWER-6],"minimum_positive_scale_h_guard":1024} + + +def bound_recipe(old, lower): + """Pass the proposed literal cutoff through the installed Recipe.open seam.""" + import transport + + assert old.level_floor==lower + N=1<=0 and sender in live + closes+=1 + assert not live and not pending and not any(held.values()) and opens==closes + assert axes==plan.leaves_per_epoch and len(first_counts)==2 + return {"tested_occupied_K7_grade":[r,k],"lower":LOWER,"upper":hi,"carrier":n, + "first_band_contacts":contacts,"native_opens":opens,"native_closes":closes, + "returned_paid_prefixes":loans,"paid_singletons":axes, + "lower_return_counts":dict(first_counts),"extent":"complete fixture event stream"} + + +def check(): + from band_product import prepare_native + from installations import BINARY_C, ENTRY, TERMINAL + from raw_binary_stage import binary_word + from strict_moment import UNIT + from unpowered_price import intervals + + stage=(RUNTIME/"raw_binary_stage.py").read_bytes() + assert sha256(stage).hexdigest()=="e24bd735598d278dbd46cada584a63da01796d77ad557a45b80a4dfc7bbbd0b0" + assert TERMINAL.rank_logs==(8192,118919,524288) and TERMINAL.complex_log==499284 + word=binary_word() + assert (len(word.targets),len(word.paid),len(word.cells))==(18906,104652,24) + a,b=prepare_native() + ordinary=(*a[:-1],*b[:-1]) + assert tuple(recipe.rank_log for recipe in ordinary)==(*ENTRY.rank_logs,*TERMINAL.rank_logs) + assert (a[-1].rank_log,b[-1].rank_log)==(1024,499284) + openings=[bound_recipe(recipe,LOWER) for recipe in ordinary] + stock=all_size_stock(word,BINARY_C,intervals,UNIT) + finite=finite_plan(word,BINARY_C) + assert finite["tested_occupied_K7_grade"]==[49,64] + assert finite["native_opens"]==323165 and finite["returned_paid_prefixes"]==432 + assert finite["paid_singletons"]==683705746532 + print("PASS_LITERAL_ORDINARY_FLOOR",json.dumps( + {"new_binary_openings":openings,"binary_all_size":stock,"binary_integer_fixture":finite}, + sort_keys=True),flush=True) + + +if __name__=="__main__": + check() diff --git a/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_six_price.py b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_six_price.py new file mode 100644 index 0000000000..4e3f8d5d1f --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_six_price.py @@ -0,0 +1,40 @@ +"""Second directed audit uses the raw installed calendar and original first/last heights.""" +from fractions import Fraction as Q +from math import ceil +from pathlib import Path +import json,sys +root=Path(__file__).resolve().parent +runtime=Path(sys.argv[1]).resolve() +# Load and hash the changed physical calendar before importing the independent +# 192-bit square-root and discrete-optimization implementation. +sys.path.insert(0,str(runtime)) +from upstream import install +install() +from grades import LOWER,numerical_recipe +from installations import ENTRY,TERMINAL +from typed_transport import TypedPlan +assert LOWER==1054 and str(runtime) in str(sys.modules['typed_transport'].__file__) +recipe=numerical_recipe(TERMINAL.complex_log) +sys.path.append(str(root)) +import certify_frontier as f +from certify_frontier import T,C,dec,powers +target=Q('.003898226579820971') +debit=Q(125645,2**20) +edges,psi,weights=f.aggregate(recipe) +upper_fringe=sum(price*(7*(k-r)+T*r*r/(2*k*LOWER)) for r,k,price in weights)/(T*psi) +invoice=f.factor(upper_fringe,263772,LOWER) +assert powers(2,debit)[0]>invoice>powers(2,debit-Q(1,2**20))[1] +f.CLOCK_CAP=318291900 +best=f.optimize(debit) +assert Q(best['lower_bookable'])==target==TERMINAL.kappa and best['gaussian_height']==TERMINAL.complex_log +assert tuple(best['ordinary_heights'])==TERMINAL.rank_logs and best['complete_clock']==318291900 +hi=Q(best['supremum']) +assert targetQ('0.0000000029623909') +assert f.ordinary(TERMINAL.rank_logs)>target+f.STOP +assert len(edges)==51 and len(recipe.typed_cells())==88 and psi>Q('926899828.8291') +print(json.dumps({'independent_interval_bits':192,'finite_factor_upper':dec(invoice,36), + 'debit':str(debit),'upper_slack':dec(powers(2,debit)[0]-invoice,36), + 'next_smaller_debit_denominator':2**20,'next_smaller_fails':True, + 'estimated_fringe_upper':dec(upper_fringe,39),'exact_stop_supremum':str(hi), + 'strict_gain_over_predecessor_upper':str(target-f.OLD_UPPER),'best':best},indent=2)) diff --git a/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_successor_cutoff.py b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_successor_cutoff.py new file mode 100644 index 0000000000..c196ac2cb3 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_successor_cutoff.py @@ -0,0 +1,78 @@ +"""Call the real recipe and exercise the new Gaussian origin at its actual first boundary.""" +from fractions import Fraction as Q +from math import gcd +from pathlib import Path +import json,sys + +runtime=Path(sys.argv[1]).resolve() +sys.path.insert(0,str(runtime)) +from upstream import install +install() +import grades +from grades import LOWER,UPPER_DIVISOR,WEIGHTS,numerical_recipe +from installations import ENTRY,TERMINAL,GAUSSIAN_C +from transport import Measure,ceil +from typed_transport import TypedPlan,NativeType,column_header +assert LOWER==1054 and UPPER_DIVISOR==1724 and WEIGHTS==(5,451) +contacts=[] +for tier in (ENTRY,TERMINAL): + recipe=numerical_recipe(tier.complex_log) + def inspect(n,types,cells,t,lower,upper,volume,ticks,rounds,**kw): + assert n==1<516*lower and 4*258*(upper-6)0 +metrics=[] +for child in (0,1): + actual=[z for z in plan.receive[d,child,0] if z.band==e] + assert len(actual)==2 and all(z.count>0 for z in actual) + for z in actual: + assert r*(e-6)-k*(d-6)==16 + emitted_number=z.count + m=Measure(1-GAUSSIAN_C,1<<36,64*n.bit_length()) + expected=int(WEIGHTS[z.kind]*m.mass(lo,hi)[0]*shares[z.kind,r,child,k]) + assert emitted_number==expected>0 + metrics.append([z.kind,child,emitted_number]) +print('PASS_SHIFT_SIX_LOWER_BOUNDARY',json.dumps({'stages':contacts,'bad_shift_link':[e,d,-52], + 'validated_shift_six_suffix':16,'instantiated_typed_grants':metrics,'real_exterior_slots':plan.source_width})) diff --git a/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_successor_tiers.py b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_successor_tiers.py new file mode 100644 index 0000000000..d0df920c4c --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_successor_tiers.py @@ -0,0 +1,52 @@ +"""Drive signed multiplication, caller dispatch, and both stage seams through this runtime.""" +from pathlib import Path +from fractions import Fraction as Q +from hashlib import sha256 +import runpy,sys + +root=Path(__file__).parent.resolve() +runtime=Path(sys.argv[1]).resolve() +sys.path.insert(0,str(runtime)) +from upstream import install +install() +from installations import ENTRY,TERMINAL,activation +from ordinary_carrier import stage_for_width_log +from staged_carriers import entrance_logs +from band_product import prepare_native,production_supplier +from grades import LOWER +assert LOWER==1054 +assert TERMINAL.rank_logs==(8192,118919,524288) +assert TERMINAL.kappa==Q('.003898226579820971') and TERMINAL.complex_log==499284 +assert activation(TERMINAL)==1151157 +if sys.argv[2]=='product': + from io import BytesIO + from band_product import multiply,multiply_tapes + from check_product import physical_product + inputs=[(0,0),(-1,0),(-1,-1),(-741503,466013),(2**129-17,-(2**73)+3),(-(2**4096+9),2**41-1)] + for a,b in inputs:assert multiply(a,b)==a*b + for tier in (ENTRY,TERMINAL): + left=BytesIO(b'abc'+(741503).to_bytes(6,'little')+b'finish') + right=BytesIO(b'xyz'+(466013).to_bytes(5,'little')+b'end');out=BytesIO() + left.seek(3);right.seek(3) + sign,size=multiply_tapes(left,6,right,5,out,left_negative=True,profile=tier) + assert (sign,size,int.from_bytes(out.getvalue(),'little'))==(True,5,345550037539) + assert left.tell()==right.tell()==3 + recipe=production_supplier(tier.complex_log,tier.positive_stop_denominator).recipe + assert recipe.rank_log==tier.complex_log and recipe.ambient==306 and len(recipe.cells)==51 + witness=physical_product(ENTRY) + assert witness['product']=='-345550037539' and witness['coefficients_prefix']==[11811,10996,4152,868,77] + print('PASS_SIGNED_PRODUCTS_AND_DIRTY_RESTORE',len(inputs),witness) +else: + helper=runpy.run_path(str(root/'check_stage_seam.py')) + cuts=tuple(entrance_logs(TERMINAL.rank_logs)) + assert cuts==(8290,127273,651625) + for i,c in enumerate(cuts,1): + assert [stage_for_width_log(c+d,3,TERMINAL.rank_logs) for d in (-1,0,1)]==[i-1,i,i] + origins=prepare_native(TERMINAL) + assert all(r.level_floor==18960 for r in origins[:-1]) + census=helper['verify_stage'] + direct=[census(TERMINAL,cuts,2,150000),census(TERMINAL,cuts,3,680000)] + compiled=[census(TERMINAL,cuts,2,1200000),census(TERMINAL,cuts,3,4500000)] + assert all(x['direct'] for x in direct) and not any(x['direct'] for x in compiled) + tapes=[helper['verify_tape'](1,[0,1],[2,1]),helper['verify_tape'](2,[1,7],[3,1])] + print('PASS_STAGES_AND_WRONG_SIGN',cuts,direct,compiled,tapes) diff --git a/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_tariff.py b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_tariff.py new file mode 100644 index 0000000000..7304cf3595 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/check_tariff.py @@ -0,0 +1,9 @@ +"""Run the exact ordinary child-tariff controls from the authenticated #8076 checker.""" +from pathlib import Path +import runpy +import sys + +checker, runtime=map(Path,sys.argv[1:]) +sys.argv=[str(checker),str(runtime)] +data=runpy.run_path(str(checker)) +data['ordinary_debit']() diff --git a/research/p104-integrated-gaussian-suffix/source-view-8076/changes/run_successor.py b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/run_successor.py new file mode 100644 index 0000000000..cc8aad841b --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/run_successor.py @@ -0,0 +1,48 @@ +"""Run each scientific scope against the installed candidate and record its actual exit.""" +from datetime import datetime,timezone +from pathlib import Path +from subprocess import run +from hashlib import sha256 +import json +import sys +import time +from shutil import copyfile + +root=Path(__file__).resolve().parent +candidate=root/'successor' +runtime=candidate/'runtime' +peer=candidate/'peer/research/frequency-weighted-native-multiplier' +log=candidate/'logs';log.mkdir(exist_ok=True) +scopes={ + 'invoice':[str(peer/'receipt.py'),str(runtime)], + 'independent_price':[str(root/'check_six_price.py'),str(runtime)], + 'placement':[str(peer/'check_placement.py'),str(runtime)], + 'calendar':[str(peer/'check_calendar.py'),str(runtime)], + 'ownership':[str(peer/'check_ownership.py'),str(runtime)], + 'exterior':[str(peer/'check_exterior.py'),str(runtime)], + 'nested':[str(peer/'check_nested.py'),str(runtime)], + 'raw':[str(peer/'check_raw.py'),str(runtime)], + 'product':[str(root/'check_successor_tiers.py'),str(runtime),'product'], + 'stages':[str(root/'check_successor_tiers.py'),str(runtime),'stages'], + 'cutoff':[str(root/'check_successor_cutoff.py'),str(runtime)], + 'corrupted_owner':[str(root/'check_corrupt_owner.py'),str(runtime)], + 'ordinary_floor':[str(root/'check_six_ordinary.py'),str(runtime)], + 'setup':[str(peer.parent/'tiered-native-multiplier/check_serial_setup.py')]} +stamp=lambda:datetime.now(timezone.utc).isoformat(timespec="microseconds") +failures=[] +for mode in sys.argv[1:] or list(scopes): + if (log/f'{mode}.json').exists(): + previous=json.loads((log/f'{mode}.json').read_bytes()) + attempt=log/'attempts'/previous['started_at'].replace(':','-') + attempt.mkdir(parents=True,exist_ok=True) + for ext in ('json','err','out'):copyfile(log/f'{mode}.{ext}',attempt/f'{mode}.{ext}') + start=stamp();tick=time.monotonic() + with (log/f'{mode}.out').open('wb') as stdout,(log/f'{mode}.err').open('wb') as stderr: + result=run([sys.executable,'-IB',*scopes[mode]],stdout=stdout,stderr=stderr) + end=stamp(); elapsed=time.monotonic()-tick + status=dict(mode=mode,code=result.returncode,started_at=start,finished_at=end,elapsed=elapsed, + output_sha256=sha256((log/f'{mode}.out').read_bytes()).hexdigest()) + (log/f'{mode}.json').write_text(json.dumps(status,indent=2)+'\n') + print(mode,result.returncode,round(elapsed,2),flush=True) + if result.returncode:failures.append(mode) +if failures:raise SystemExit("Failed scopes: "+", ".join(failures)) diff --git a/research/p104-integrated-gaussian-suffix/source-view-8076/changes/stage_caps.py b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/stage_caps.py new file mode 100644 index 0000000000..e6df532766 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view-8076/changes/stage_caps.py @@ -0,0 +1,93 @@ +"""Prove exact #8076 capped rates for one through seven ordinary stages.""" +from fractions import Fraction as Q +import json + +ETA = Q(39, 10000) +BINARY = Q(4391986206293, 2**50) +GAUSSIAN = Q(17145637307, 2**42) +ORDINARY_DEBIT = Q(11178, 8192) +STOP = Q(5, 10**18) +MINIMUM = 8192 +MAXIMUM = 524288 +GRID = 10**21 +BOOKED = Q('.003898226579820971') + + +def ordinary(heights, exact=True): + rate = Q(0) + for i, height in enumerate(heights): + rate = (249 * (BINARY - ORDINARY_DEBIT / height) + rate) / 250 + if exact: + rate = min(ETA, rate) + if i + 1 < len(heights): + rate = Q((GRID*rate).__floor__() - 1, GRID) + return rate + + +def available(clock, g, count): + return (clock - 1731 - 3*count - 220*g) // 320 + + +def profile3(budget): + trial = (MINIMUM, budget - MINIMUM - MAXIMUM, MAXIMUM) + assert MINIMUM <= trial[1] <= MAXIMUM + a,b,c = [Q(1, 250**(2-i)*height**2) for i,height in enumerate(trial)] + assert a < b < c + # The tangent at this corner bounds the relaxed reciprocal objective. + # Its linear loss is strictly positive for every other integer triple. + one_unit = Q(249,250)*ORDINARY_DEBIT*min(b-a,c-b,b) + assert 0 <= ordinary(trial,False)-ordinary(trial) < one_unit + return trial + + +def all_lengths(clock, gd, pivot): + def cell(g): + p=profile3(available(clock,g,3)) + return p, ordinary(p), GAUSSIAN-gd/g + p0,o0,g0=cell(pivot) + p1,o1,g1=cell(pivot+1) + assert g0=o1 else p1, + 'gaussian_height':pivot if g0>=o1 else pivot+1, + 'three_stage_slices':[{'G':g,'ordinary':str(o),'gaussian':str(gg)} + for g,o,gg in [(pivot,o0,g0),(pivot+1,o1,g1)]], + 'exact_stopped_upper_one_to_seven_stages':str(ceiling), + 'one_two_and_four_to_seven_relaxed_upper':[str(v) for v in other], + 'required_G_for_equality_or_improvement':min_g} + + +def verify(): + expected={"public":Q(1667119388378402860472786027,427661302169600000000000000000), + "composite":Q(1632693363926333812833543539,418829775667200000000000000000)} + out={} + for clock in (318291911,318291900): + for label,gd,pivot in [('public',Q(64939,524288),509812), + ('composite',Q(125645,1048576),499284)]: + result=all_lengths(clock,gd,pivot) + assert Q(result['exact_stopped_upper_one_to_seven_stages'])==expected[label] + out[f'{label}_at_{clock}']=result + cheaper=all_lengths(318291899,Q(125645,1048576),499283) + assert Q(cheaper['exact_stopped_upper_one_to_seven_stages'])57` at every installed height. The direct receiver always issues exactly one child. The real quotient lows have equal byte volume and carry their high rows, gap and spectator data across the full signed basis route and inverse. + +Write `F(N)=P(N)/N^92` for the complete timed price per productive width, including paid covers and padding. For either moment `s=t,1`, the sum of normalized child weights is bounded by `(75/32)F(N)N^(−s)`. Multiply the same #8073 directed finite factor by `(2401/1024)/(47/20)=12005/12032`. The resulting factor is funded at `11178/8192` and lies above the allowance at `11177/8192` in the directed enclosure. This proves `τF(N) 2 * (carrier // (2048 * 306)) + assert upper % 2 == 0 and 4*258*(upper-8) < n + assert len(cells) == 88 and tuple(word.multiplicity for word in types) == WEIGHTS + assert (volume, ticks, rounds) == (carrier**6, carrier**82, carrier**2) + assert options == {"width": 1 << (92*height), "delay_base": 1 << 19} + return True + + original = grades.TypedPlan + try: + grades.TypedPlan = verify + assert recipe.open() + finally: + grades.TypedPlan = original + + +heights = (ENTRY.complex_log, TERMINAL.complex_log) +assert heights == (1024, 509812) +for height in heights: + verify_constructor_call(height) +print("PASS_LITERAL_UPPER_FENCE", UPPER_DIVISOR, LOWER, heights, flush=True) + +for band, expected in ((LOWER, (2, 0)), (LOWER+2, (0, 0))): + widths = [] + for kind, scale in enumerate(SCALES): + header = column_header(band-8, kind) + assert header % 2 == kind and header - kind == band-8 + widths.append((header-kind)*scale) + assert tuple(width % 4 for width in widths) == expected +assert (LOWER-8, 2*(LOWER-8)) == (1866,3732) + +native = tuple(NativeType((2,), (1,), weight) for weight in WEIGHTS) +shares = {(a,1,b,2):Q(w,sum(WEIGHTS)) for a in range(2) for b,w in enumerate(WEIGHTS)} +t = 1-GAUSSIAN_C +n, volume = 65536, 2**29 +plan = TypedPlan(n, native, shares, t, LOWER, 4126, volume, 3, 16, delay_base=3, padding=1) +mass = Measure(t, volume, 64*n.bit_length()) +assert plan.bands.start == LOWER and (LOWER-2,0) not in plan.count +for band in plan.bands: + for kind, weight in enumerate(WEIGHTS): + assert plan.count[band,kind] == ceil(weight * mass.mass(band,band+2)[1]) +assert {(a,link.kind) for (_,a,_),ls in plan.send.items() for link in ls} == {(0,0),(0,1),(1,0),(1,1)} +grants = [] +for recipient in range(2): + for link in plan.receive[LOWER,recipient,0]: + assert link.band in (2*LOWER,2*LOWER+2) and plan.delay[LOWER] < plan.delay[link.band] + assert link.count > 0 + grants.append((recipient,link.kind,link.band,link.count)) +assert len(grants) == 8 and plan.source_width > 0 and plan.leaves_per_epoch > 0 +print('PASS_LITERAL_LOWER_CUTOFF', LOWER, (1866,3732), grants, plan.leaves_per_epoch, flush=True) diff --git a/research/p104-integrated-gaussian-suffix/source-view-8076/source8076/check_ordinary_floor.py b/research/p104-integrated-gaussian-suffix/source-view-8076/source8076/check_ordinary_floor.py new file mode 100644 index 0000000000..5cb53914e4 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view-8076/source8076/check_ordinary_floor.py @@ -0,0 +1,221 @@ +"""Check the actual ordinary floor and fully charged occupied-edge calendar.""" +from collections import Counter +from fractions import Fraction as Q +from hashlib import sha256 +import json +from pathlib import Path +import sys + +RUNTIME=Path(sys.argv[1]).resolve() +sys.path.insert(0,str(RUNTIME)) +from upstream import install + +install() +LOWER=18960 + + +def ceil(x): + return -(-x.numerator//x.denominator) + + +def all_size_stock(word, c, intervals, unit): + """Discharge the parameterized TRANSFER.md hypotheses at the new floor.""" + t = 1-c + targets, paid = Counter(word.targets), Counter(word.paid) + assert max(targets) <= 134 and min(paid) >= 1 + assert all(5*r <= 4*k for r,k in word.cells) + assert all(sum(p for (u,k),p in word.cells.items() if u==r)==1 for r in paid) + # Check actual directed per-receiving-label funding and the whole raw margin. + t_lower = {k: intervals(k,t)[0] for k in targets} + p_upper = {r: intervals(r,t)[1] for r in paid} + t_hi = sum(n*intervals(k,t)[1] for k,n in targets.items()) + p_lo = sum(n*intervals(r,t)[0] for r,n in paid.items()) + assert sum(targets[k]*v for k,v in t_lower.items())>sum(paid[r]*v for r,v in p_upper.items()) + assert 100*p_lo>99*t_hi + for k,n in targets.items(): + load=sum(paid[r]*p*p_upper[r] for (r,s),p in word.cells.items() if s==k) + assert 01 + + # Check the smallest admitted numerical scale; every margin below grows + # with N. Actual binary native stages start no earlier than H=3000. + H=1024 + N=1<=(1-delta)*N + assert Q(6,5)**4>2 and Q(6,5)**73>2**19 + assert len(word.paid)<2**19 + assert 2**19*Q(1,1024*ambient*LOWER)**77+Q(1,N**77)<1 + lower_power=Q(intervals(LOWER,t)[0],unit) + assert lower_power>1024 and Q(1,t*lower_power)+Q(2,N**5)<2 + # Endpoint inverse bases are >1/(512N) through all roots. The + # original 61-stage envelope costs 397+30.5H bits per endpoint. + assert c.denominator.bit_length()-1<=60 and Q(1,N)-Q(1,2**(64*(H+1)))>Q(1,512*N) + grid_error_bits=397+31*H+6*H+3-64*(H+1) + assert grid_error_bits<-132 + # Time and integer errors are already normalized conservatively without + # the L**c*psi denominator, which is strictly greater than one. + assert c>0 and 1=1024. + assert suffix_birth_error1 + assert (1-Q(1,N))/Q(257,256)>Q(1,2) + return {"fringe_upper_1e9":ceil(fringe*10**9),"psi_lower_floor":int(psi), + "grid_absolute_error_exponent_at_H1024":grid_error_bits, + "suffix_target_axes":target_axes, + "suffix_birth_error_upper_at_H1024":"2^30/N^5", + "normalized_error_allowance":"2^-128", + "birth_bound":"2V","copy_group_bound":"3N^3","whole_field_width":"N^92", + "first_two_columns":[LOWER-8,LOWER-6],"minimum_positive_scale_h_guard":1024} + + +def bound_recipe(old, lower): + """Pass the proposed literal cutoff through the installed Recipe.open seam.""" + import transport + + assert old.level_floor==lower + N=1<=0 and sender in live + closes+=1 + assert not live and not pending and not any(held.values()) and opens==closes + assert axes==plan.leaves_per_epoch and len(first_counts)==2 + return {"tested_occupied_K7_grade":[r,k],"lower":LOWER,"upper":hi,"carrier":n, + "first_band_contacts":contacts,"native_opens":opens,"native_closes":closes, + "returned_paid_prefixes":loans,"paid_singletons":axes, + "lower_return_counts":dict(first_counts),"extent":"complete fixture event stream"} + + +def check(): + from band_product import prepare_native + from installations import BINARY_C, ENTRY, TERMINAL + from raw_binary_stage import binary_word + from strict_moment import UNIT + from unpowered_price import intervals + + stage=(RUNTIME/"raw_binary_stage.py").read_bytes() + assert sha256(stage).hexdigest()=="e24bd735598d278dbd46cada584a63da01796d77ad557a45b80a4dfc7bbbd0b0" + assert TERMINAL.rank_logs==(8192,111681,524288) and TERMINAL.complex_log==509812 + word=binary_word() + assert (len(word.targets),len(word.paid),len(word.cells))==(18906,104652,24) + a,b=prepare_native() + ordinary=(*a[:-1],*b[:-1]) + assert tuple(recipe.rank_log for recipe in ordinary)==(*ENTRY.rank_logs,*TERMINAL.rank_logs) + assert (a[-1].rank_log,b[-1].rank_log)==(1024,509812) + openings=[bound_recipe(recipe,LOWER) for recipe in ordinary] + stock=all_size_stock(word,BINARY_C,intervals,UNIT) + finite=finite_plan(word,BINARY_C) + assert finite["tested_occupied_K7_grade"]==[49,64] + assert finite["native_opens"]==323165 and finite["returned_paid_prefixes"]==432 + assert finite["paid_singletons"]==683705746532 + print("PASS_LITERAL_ORDINARY_FLOOR",json.dumps( + {"new_binary_openings":openings,"binary_all_size":stock,"binary_integer_fixture":finite}, + sort_keys=True),flush=True) + + +if __name__=="__main__": + check() diff --git a/research/p104-integrated-gaussian-suffix/source-view-8076/source8076/check_stage_seam.py b/research/p104-integrated-gaussian-suffix/source-view-8076/source8076/check_stage_seam.py new file mode 100644 index 0000000000..6d0df84d32 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view-8076/source8076/check_stage_seam.py @@ -0,0 +1,278 @@ +"""Replay literal ordinary dispatch and bounded signed bank returns.""" +from dataclasses import replace +from fractions import Fraction as Q +from hashlib import sha256 +from io import BytesIO +from itertools import product +import json +from pathlib import Path +import sys + +RUNTIME = Path(sys.argv[1]).resolve() +sys.path.insert(0, str(RUNTIME)) +from upstream import install + +install() + + +class DyadicWidth(int): + """Speed up exact exponentiation of a mathematically dyadic test width.""" + def __pow__(self, exponent): + assert self.bit_count() == 1 and exponent >= 0 + return 1 << ((self.bit_length() - 1) * exponent) + + +def verify_stage(profile, cuts, number, log_width): + import ordinary_carrier as carrier + + calls = [] + base = DyadicWidth(1 << log_width) + prev = 1 << cuts[number-2] + power = 1 << (log_width//250) + assert log_width % 10000 == 0 + width = max(prev+1, power) + component = 1 << (39*log_width//10000) + count = -(-width//component) + short, longer = divmod(width,count) + expected_layout = (longer, short+1, count-longer, short) + rank = 1 << profile.rank_logs[number-1] + expect_direct = -(-base//width) <= 1 << (8*profile.rank_logs[number-1]) + + def root(value, degree): + assert value.bit_count() == 1 + quotient, remainder = divmod(value.bit_length()-1,degree) + assert not remainder + return 1 << quotient + + def receiver(dimension, layout, previous, *, direct, profile): + assert dimension == rank and layout == expected_layout and direct == expect_direct + assert previous.func is carrier.ternary + assert previous.keywords == {"maximum": number-1, "profile": profile} + return number + + def body(source,target,digits,prefix,gap,suffix,backend): + assert digits==base and (prefix,gap,suffix)==(1,3,5) and backend==number + calls.append((digits.bit_length()-1,backend)) + + actual = carrier.ceil_root, carrier.Receiver, carrier.root_body + try: + carrier.ceil_root, carrier.Receiver, carrier.root_body = root, receiver, body + carrier.ternary(None,None,base,1,3,5,maximum=number,profile=profile) + finally: + carrier.ceil_root, carrier.Receiver, carrier.root_body = actual + assert calls == [(log_width,number)] + return {"stage":number,"scanned_log":log_width,"rank_log":rank.bit_length()-1, + "predecessor_cut":cuts[number-2],"direct":expect_direct, + "component_log":component.bit_length()-1} + + +def verify_tape(width, u, v): + from five_exchange import same_order_line + from growing_binary import Weighted + from same_order_body import SameOrderBody + from streaming_routes import cold_swap_tape + from ternary_leaf import select_pivot + + class Core(SameOrderBody, Weighted): + def __init__(self): + super().__init__(2,(1,width,0,0),cold_swap_tape) + self.stock=self.owners + self.calls=0 + + def weighted(self,*args,**kwargs): + assert kwargs["atoms"]==1TERMINAL.kappa + assert 1740+320*sum(ranks)+220*height==318291900 + underfunded=booked-positive(height-1) + overfunded=booked-integer_optimum(capped_shape(height+1,cap,1740),debit) + prior_booking_shortfall=booked-upper(ranks,old_debit,True) + assert min(underfunded,overfunded,prior_booking_shortfall)>0 + + smaller=Q(".00389821057")+stop-upper((8192,129407,524402),Q(11,8)) + assert smaller==Q(949618999849667259182401851,233169615645211570995200000000000000000) + historical=Q(".00389821126")+stop-upper((8192,129406,523443),Q(703,512)) + assert historical==Q(131786329075081068292016650499,77580469414725995724800000000000000000) + prior_gaussian_debit=Q(".0038982141226643")+stop-(GAUSSIAN_C-Q(64944,524288*prior_height)) + assert prior_gaussian_debit==Q(5290830738777425573,274384656793600000000000000000)>0 + historical_ordinary_shortfall=historical_booked-upper(historical_profile,historical_debit,True) + assert historical_ordinary_shortfall==Q(25132665927681050851,26843545600000000000000000000000)>0 + historical_height_shortfall=historical_booked-positive(prior_height) + assert historical_height_shortfall==Q(354613496784311279,823153970380800000000000000000)>0 + + profiles=[] + for p,expected in ((predecessor,(8290,125522,649874)),(TERMINAL,(8290,120035,644387))): + cuts=tuple(entrance_logs(p.rank_logs)) + assert cuts==expected + for i,c in enumerate(cuts,1): + assert [stage_for_width_log(c+d,3,p.rank_logs) for d in (-1,0,1)]==[i-1,i,i] + assert stage_for_width_log(c+1,i-1,p.rank_logs)==i-1 + direct=[verify_stage(p,cuts,2,140000),verify_stage(p,cuts,3,670000)] + compiled=[verify_stage(p,cuts,2,1100000),verify_stage(p,cuts,3,4400000)] + assert all(s["direct"] for s in direct) and not any(s["direct"] for s in compiled) + profiles.append({"ranks":p.rank_logs,"cuts":cuts,"direct":direct,"compiled":compiled}) + tape=[verify_tape(1,[0,1],[2,1]),verify_tape(2,[1,7],[3,1])] + print("PASS_LITERAL_CHILD_TARIFF",json.dumps( + {"historical_ordinary_negative_gap":str(historical),"seven_level_negative_gap":str(smaller), + "historical_gaussian_negative_gap":str(prior_gaussian_debit), + "historical_debit_shortfall":str(historical_ordinary_shortfall), + "historical_height_shortfall":str(historical_height_shortfall), + "lower_adjacent_gaussian_shortfall":str(underfunded), + "higher_adjacent_ordinary_shortfall":str(overfunded), + "prior_ordinary_booking_shortfall":str(prior_booking_shortfall), + "candidate_ordinary_slack":str(new_ordinary-booked),"candidate_gaussian_slack":str(new_gaussian-booked), + "new_family_ceiling":str(family_ceiling),"comparator_family_ceiling":str(previous_ceiling), + "historical_family_ceiling":str(comparator_ceiling), + "prior_family_ceiling":str(prior_family_ceiling),"stage_seams":profiles,"signed_tape":tape}, + sort_keys=True),flush=True) + + +if __name__=="__main__": + check() diff --git a/research/p104-integrated-gaussian-suffix/source-view-8076/source8076/prepare.py b/research/p104-integrated-gaussian-suffix/source-view-8076/source8076/prepare.py new file mode 100644 index 0000000000..8a531c197c --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view-8076/source8076/prepare.py @@ -0,0 +1,314 @@ +"""Install the fully charged K7 child-tariff repricing.""" +from hashlib import sha256 +import json + +NEW_INSTALLATION = "da357ce3887acc3020d66a8bf752218a632cb9cd9001ee7e01cfff5d4c495552" +RAW_FLOOR_IMAGES = { + "before": "0c805a525322acf4eb03f083c2c763f3046c3d488e1f993beb484a3e2c2ff4a9", + "after": "e24bd735598d278dbd46cada584a63da01796d77ad557a45b80a4dfc7bbbd0b0", +} +RAW_FLOOR_PATCH = """--- a/raw_binary_stage.py ++++ b/raw_binary_stage.py +@@ -45,7 +45,7 @@ + @cache + def binary_recipe(height): + word = binary_word() +- return Recipe(height, word.tagged.ambient, word.targets, word.paid, word.cells, BINARY_C) ++ return Recipe(height, word.tagged.ambient, word.targets, word.paid, word.cells, BINARY_C, level_floor=18960) +""" + " \n \n def run(recipe, fields, machine):\n" + + +def replace(path, replacements): + source = path.read_text() + for old, new in replacements: + if source.count(old) != 1: + raise ValueError(f"Expected one change point for {old!r} in {path.name}") + source = source.replace(old, new) + path.write_text(source) + + +OLD_EDGE = ''' # The first three positive terms of log(k/r) suffice for each real edge. + psi = Q(0) + for (r, k), share in cells.items(): + u = Q(k - r, k + r) + log_lower = 2 * (u + u**3 / 3 + u**5 / 5) + psi += paid[r] * share * r * log_lower''' + +DIRECTED_EDGE = ''' # Integrate each exact directed edge, retaining both rounding ends. + # A downward ratio of outward powers bounds ((k/r)^c-1)/c. + psi = Q(0) + for (r, k), share in cells.items(): + floor = intervals(k, c)[0] * UNIT // intervals(r, c)[1] + assert floor > UNIT + psi += paid[r] * share * r * (Q(floor, UNIT) - 1) / c''' + +NATIVE_SETUP = ''' setup = native_clock() + grade_count = len(low[-1].paid.histogram) + len(low[-1].targets.histogram) + actual_roles = sum(len(v.targets) + len(v.paid) for v in high[-1].types()) + assert actual_roles < 2**20 and grade_count < 2**8 + assert len(low) + len(high) == 7 and max(heights[-1].bit_length() for heights in (ENTRY.rank_logs, TERMINAL.rank_logs)) <= 20 + grade_actions = 2**20 * 256 + 2**8 * 256 * 8 + 32 * (grade_count + 2)**2 + 2**12 + assert grade_actions < 2**32 and setup["all_setup"] < 2**228''' + +DIRECTED_ORDINARY = '''def ordinary_debit(): + delta = Q(1, 2**128) + predecessor_tariff = Q(47, 20) + child_tariff = Q(2401, 1024) + + def bounds(floor, suffix, tariff): + multiplier = ( + tariff * Q(256, 255) * Q(4097, 4096) * Q(1028, 1024) + * (1 + Q(suffix, floor) + delta) / ((1 - Q(10, floor)) * (1 - delta)**3) + ) + lo, hi = powers(1024 * 134 * floor, BINARY_C) + return multiplier * lo, multiplier * hi + + # Keep the exact predecessor and its earlier finite-factor controls. + lo, hi = bounds(18960, 8, predecessor_tariff) + prior_lo, prior_hi = bounds(18960, 64, predecessor_tariff) + old_lo, old_hi = bounds(32768, 64, predecessor_tariff) + allowance_lo, allowance_hi = (2 * end for end in powers(2, Q(3012, 8192))) + finer_allowance = 2 * powers(2, Q(3011, 8192))[1] + assert allowance_lo - hi > Q("0.0000277614405947") + assert lo - finer_allowance > Q("0.000190576182764755") + assert prior_lo > allowance_hi + assert 2 * powers(2, Q(3047, 8192))[0] - prior_hi > Q("0.000062662376093595") + assert prior_lo - 2 * powers(2, Q(6093, 16384))[1] > Q("0.000046832527238212") + assert prior_hi**1024 < 2**1405 < old_lo**1024 + assert old_hi**512 < 2**703 + assert Q(75, 32) / Q(47, 20) == Q(375, 376) + + # Use the same outward raw envelope for the candidate and its lower tick. + new_lo, new_hi = bounds(18960, 8, child_tariff) + new_allowance = 2 * powers(2, Q(2986, 8192))[0] + prior_tick = 2 * powers(2, Q(2985, 8192))[1] + assert prior_tick < new_lo <= new_hi < new_allowance + assert lo > new_allowance and allowance_lo > new_allowance + + # An equal tariff gives unit contraction, leaving no uniform geometric sum. + child_volume = Q(75, 32) + old_ratio, new_ratio = child_volume / predecessor_tariff, child_volume / child_tariff + assert child_volume / child_volume == 1 + assert new_ratio == Q(2400, 2401) and 1 / (1 - new_ratio) == 2401 + old_sum, new_sum = 1 / (1 - old_ratio), 1 / (1 - new_ratio) + assert old_sum == 376 and old_sum < new_sum < 8 * old_sum + assert 2**16 < (Q(7, 10) * old_sum)**2 < 2**17 + assert 2**21 < (Q(7, 10) * new_sum)**2 < 2**22 + print("PASS_DIRECTED_ORDINARY_DEBIT", 18960, "11178/8192", "2400/2401", "8/L") + print("PASS_CHILD_TARIFF", "2401/1024", "volume<=75/32", "sum=2401", "entry+5", "terminal+9") + + +''' + +EDITS = { + "runtime.patch": ( + ('TERMINAL = Profile((8192, 129414, 524288), 483871, Q(".00389821"))', + 'TERMINAL = Profile((8192, 111681, 524288), 509812, Q(".003898223617430"))'), + ), + "positive_debit.py": ( + ("from strict_moment import UNIT, power_interval", "from strict_moment import UNIT, power_interval\nfrom unpowered_price import intervals"), + ("POSITIVE_DEBIT = Q(65081, 524288)", "POSITIVE_DEBIT = Q(64939, 524288)"), + (OLD_EDGE, DIRECTED_EDGE), + ("assert psi > Q(1790217668064, 10000)", 'assert psi > Q("926899828.8291")'), + ("assert fringe < Q(7579, 1000)", 'assert fringe < Q("7.335168")'), + ), + "receipt.py": ( + ('sys.path.append(str(HERE / "portable"))', 'sys.path.append(str(HERE.parent / "tiered-native-multiplier"))'), + ("from verify_receipt import verify as fixed_installation", "from check_serial_setup import clock as native_clock"), + ("DEBIT = Q(65081, 2**19)", + "DEBIT = Q(64939, 2**19)\nORDINARY_DEBIT = Q(11178, 8192)\nCHILD_TARIFF = Q(2401, 1024)"), + ("def tape_factor(ambient, rate):", "def tape_factor(ambient, rate, lower, suffix=64):"), + (" delta, lower = Q(1, 2**128), 32768", " delta = Q(1, 2**128)"), + ("(1 + Q(64, lower) + delta)", "(1 + Q(suffix, lower) + delta)"), + ("assert ordinary.ambient == 134 and ordinary.trial == BINARY_C", + "assert ordinary.ambient == 134 and ordinary.trial == BINARY_C\n" + " assert ordinary.level_floor == 18960"), + ("Q(11, 8 * height)", "ORDINARY_DEBIT / height"), + ("Q(11, 8) / (BINARY_C - TERMINAL.ordinary)", + "ORDINARY_DEBIT / (BINARY_C - TERMINAL.ordinary)"), + (" bound = 128 + 320 * sum(heights)", + " # The complete per-stage envelope grows by <8.\n" + " bound = 128 + 3 * len(heights) + 320 * sum(heights)"), + (" bound = 40 + 17 + 16384 * sum(heights) + sum(additions)", + " # Charge the square of the new geometric child sum.\n" + " bound = 40 + 22 + 16384 * sum(heights) + sum(additions)"), + (" assert (tape_factor(134, BINARY_C) * Q(47, 20)) ** 8 < 2**11", + ' ordinary_upper = Q("2.574726503200871425")\n' + " assert tape_factor(134, BINARY_C, 18960, 8) * CHILD_TARIFF < ordinary_upper\n" + " assert ordinary_upper**8192 < 2**11178\n" + " assert Q(75, 32) / CHILD_TARIFF == Q(2400, 2401)"), + ("assert cost == 318259431 and premium == 514", + "assert cost == 318291900 and premium == 518\n" + " assert early['log2_C'] == 125660246 and late['log2_B'] == 206131657"), + ("(517430, 483870)", "(516124, 509812)"), + ('older = Q(".0038982016137")', 'older = Q(".003898219753506")'), + ("assert gain == Q(83863, 10**13)", + "assert gain == Q(965981, 250000000000000)\n" + ' peer = Q(".00389821")\n' + " assert TERMINAL.kappa - peer == Q(1361743, 100000000000000)\n" + " old_ceiling = Q(523210198560303585338978849681, 134217728000000000000000000000000)\n" + " ceiling = GAUSSIAN_C - DEBIT / TERMINAL.complex_log - Q(5, 10**18)\n" + " assert older < old_ceiling < TERMINAL.kappa < ceiling\n" + " assert GAUSSIAN_C - DEBIT / (TERMINAL.complex_log - 1) < TERMINAL.ordinary"), + (" complete_log2_C=cost,", " complete_log2_C=cost,\n" + " ordinary_floor=18960,\n" + " ordinary_matched_suffix_coefficient=8,\n" + " ordinary_finite_debit=str(ORDINARY_DEBIT),\n" + " ordinary_child_tariff=str(CHILD_TARIFF),\n" + ' ordinary_child_contraction="2400/2401",\n' + " ordinary_child_geometric_sum=2401,\n" + " ordinary_entry_clock_extra=5,\n" + " ordinary_terminal_clock_extra=3 * len(TERMINAL.rank_logs),\n" + " previous_exact_ceiling=str(old_ceiling),\n" + " exact_guarded_gaussian_ceiling=str(ceiling),\n" + " campaign_percentage_gain=str(100 * gain / older),\n" + " external_peer_rate=str(peer),\n" + " external_peer_delta=str(TERMINAL.kappa - peer),\n" + " external_peer_percentage_gain=str(100 * (TERMINAL.kappa - peer) / peer),"), + (" setup = fixed_installation()", NATIVE_SETUP), + (''' log2_fixed_setup_upper=setup["trace_exponent"], + log2_portable_setup_guard=setup["conservative_exponent"], + log2_full_store_setup_upper=setup["full_store_trace_exponent"], + portable_setup_transition_upper=setup["transitions"],''', + ''' log2_fixed_setup_upper=setup["setup_exponent"], + native_setup_transition_upper=setup["all_setup"], + native_setup_grade_actions=grade_actions,'''), + ), + "independent_price.py": ( + ("lower = powers(2, Q(65081, 524288))[0]", "lower = powers(2, Q(64939, 524288))[0]"), + ('assert lower - upper > Q("0.00012957")', 'assert lower - upper > Q("0.000007887415")'), + ("TERMINAL.kappa - peer == Q(83863, 10**13)", 'TERMINAL.kappa - peer == Q("0.000000022003730")'), + ("def rounded_peer():", DIRECTED_ORDINARY + "def rounded_peer():"), + (" weighted()\n rounded_peer()", " weighted()\n ordinary_debit()\n rounded_peer()"), + ), +} + + +# Apply exact real-integer frequencies and reprice the full typed calendar. +EDITS["runtime.patch"] += ( + ("+GAUSSIAN_C = Q(17145637167, 2**42)", "+GAUSSIAN_C = Q(17145637307, 2**42)"), +) +EDITS["grades.py"] = (("WEIGHTS = (1, 90)", "WEIGHTS = (5, 451)"),) +EDITS["positive_debit.py"] += ( + ("assert target_axes == 135150528", "assert target_axes == 677246016"), + ("assert 91 / (t * 2**10)", "assert sum((5, 451)) / (t * 2**10)"), +) +EDITS["receipt.py"] += ( + ("def raw_counts(base, multiplicity):", "def raw_counts(base, multiplicity, primary=1):"), + ("t, p = targets.copy(), paid.copy()", + "t = Counter({grade: entry * primary for grade, entry in targets.items()})\n" + " p = Counter({grade: entry * primary for grade, entry in paid.items()})"), + ("p[1] -= 1008\n p[Q(1, 2)] += 2016", + "p[1] -= 1008 * primary\n p[Q(1, 2)] += 2016 * primary"), + ("def total_interval(counts):", "def total_interval(counts, trial=GAUSSIAN_C):"), + ("intervals(grade, 1 - GAUSSIAN_C)", "intervals(grade, 1 - trial)"), + ("WEIGHTS == (1, 90)", "WEIGHTS == (5, 451)"), + ("t, p = raw_counts(base, 90)", "t, p = raw_counts(base, WEIGHTS[1], WEIGHTS[0])"), + ("<= 261", "<= 270"), + (" cuts = {}", + " high = total_interval({k: n for k, n in t.items() if k > 2})\n" + " required = total_interval({r: n for r, n in p.items() if 5 * r > 8})\n" + " assert high[0] - required[1] > 462\n" + " past_targets, past_paid = raw_counts(base, 541, 6)\n" + " assert total_interval(past_targets)[1] < total_interval(past_paid)[0]\n" + " old_tariff = Q(17145637167, 2**42)\n" + " cuts = {\"new\": [str(high[0] - required[1]), str(high[1] - required[0])]}"), + (" cap = total_interval({k: n for k, n in chosen.items() if k > 2})", + " cap = total_interval({k: n for k, n in chosen.items() if k > 2}, old_tariff)"), + (" load = total_interval({r: n for r, n in required.items() if 5 * r > 8})", + " load = total_interval({r: n for r, n in required.items() if 5 * r > 8}, old_tariff)"), + (" net = total_interval(chosen)[0] - total_interval(required)[1]", + " net = total_interval(chosen, old_tariff)[0] - total_interval(required, old_tariff)[1]"), +) +EDITS["independent_price.py"] += ( + ('assert psi > Q("184971191.2157")', 'assert psi > Q("926899828.8291")'), +) +EDITS["check_placement.py"] = ( + ("assert 90 * (hi - lo) * M * pi > 4", "assert WEIGHTS[1] * (hi - lo) * M * pi > 4"), +) +EDITS["check_exterior.py"] = ( + ("from band_product import production_supplier", "from band_product import production_supplier\nfrom installations import GAUSSIAN_C"), + ("c = Q(17145637167, 2**42)", "c = GAUSSIAN_C"), +) +EDITS["check_nested.py"] = ( + (" * cells[1, 2]\n * 90", " * cells[1, 2]\n * types[0].multiplicity\n * types[1].multiplicity"), + ("share == cells[1, 2] * 90 / t[2]", "share == cells[1, 2] * types[1].multiplicity / t[2]"), + ("and grant.numerator // grant.denominator == 899557645", "and 4_400_000_000 < grant.numerator // grant.denominator < 4_600_000_000"), +) +EDITS["check_ownership.py"] = ( + ("def run(freq, ticks, lower, upper, volume, n, rounds, delay):", + "def run(freq, ticks, lower, upper, volume, n, rounds, delay, primary=1):"), + ("NativeType((2,), (1, 1), 1)", "NativeType((2,), (1, 1), primary)"), + ("(1, 1, 0, 2): Q(1, 2 * freq)", "(1, 1, 0, 2): Q(primary, 2 * freq)"), + ("1 - Q(1, 2 * freq)", "1 - Q(primary, 2 * freq)"), + (" frequency=freq,", " frequency=(primary, freq),"), + ("run(90, 8, 10, 42, 450, 384, 32, 4)]", + "run(90, 8, 10, 42, 450, 384, 32, 4), run(451, 8, 10, 42, 90, 384, 32, 4, primary=5)]"), +) + + +# Keep the reproduced lower edge and widen the actual even upper fence. +EDITS["grades.py"] += ( + ("LOWER = 2048", "LOWER = 1874\nUPPER_DIVISOR = 1724"), + ("2048 * self.ambient", "UPPER_DIVISOR * self.ambient"), +) +EDITS["positive_debit.py"] += ( + ("BAND_LOWER = 2048", "BAND_LOWER = 1874"), + ("from unpowered_price import intervals", "from unpowered_price import intervals\nfrom grades import UPPER_DIVISOR"), + (" upper = 2 * (M // (2048 * recipe.ambient))", + " scale = UPPER_DIVISOR * recipe.ambient // 2\n" + " upper = 2 * (M // (2 * scale))\n" + " assert 4 * max(targets) * (upper - 8) < M and 516 * (upper + 2) < M"), + ("1024 * recipe.ambient * upper", "scale * upper"), + ("Q(4 * max(targets), 1024 * recipe.ambient)", "Q(4 * max(targets), scale)"), + ("power_interval(1024 * recipe.ambient * lower, c)", "power_interval(scale * lower, c)"), + (' "lower_band": lower,', ' "lower_band": lower,\n "upper_divisor": UPPER_DIVISOR,\n "upper_scale": scale,'), + ("assert t > Q(996, 1000) and 11 * t > 10", + "assert t > Q(996, 1000) and power_interval(lower, t)[0] > 1024 * UNIT"), +) +EDITS["receipt.py"] += (("and LOWER == 2048", "and LOWER == 1874"),) +EDITS["independent_price.py"] += ( + ("from installations import BINARY_C, TERMINAL", "from installations import BINARY_C, TERMINAL\nfrom grades import LOWER, UPPER_DIVISOR"), + (" upper = (", " scale = UPPER_DIVISOR * recipe.ambient // 2\n upper = ("), + ("Q(4 * 258, 1024 * 306)", "Q(4 * 258, scale)"), + ("powers(1024 * 306 * 2048, c)[1]", "powers(scale * LOWER, c)[1]"), + ("fringe / 2048", "fringe / LOWER"), + (' assert lower - upper > Q("0.000007887415")', + ' assert lower - upper > Q("0.000000684423")\n' + ' psi_hi = sum(recipe.paid.histogram[r] * share * r * (powers(Q(k,r), c)[1] - 1) / c\n' + ' for (r,k), share in recipe.cells.items())\n' + ' prior_fringe = 10 * axes / ((1-c) * psi_hi)\n' + ' prior_scale = 1024 * recipe.ambient\n' + ' prior_factor = ((1+delta) * (1+Q(4*258,prior_scale)) * powers(prior_scale*LOWER,c)[0]\n' + ' * (1+prior_fringe/LOWER+delta) / (1-delta)**4)\n' + ' assert prior_factor - powers(2, Q(64939,524288))[1] > Q("0.000051649827")'), +) +EDITS["check_placement.py"] += ( + ("from grades import numerical_recipe, WEIGHTS", "from grades import numerical_recipe, LOWER, UPPER_DIVISOR, WEIGHTS"), + (" U = 2 * (M // (2048 * 306))", + " scale = UPPER_DIVISOR * recipe.ambient // 2\n" + " assert UPPER_DIVISOR == 1724 and scale == 263772\n" + " U = 2 * (M // (2 * scale))"), + (" assert U < lo < hi < M", " assert LOWER < e < U < lo < hi < M"), + (" assert period == 1620 and tickets == (0, 324, 648) and f.swaps[0] == (1, 324, 1)", + " assert period == 1364 and tickets == (0, 272, 545) and f.swaps[0] == (1, 272, 1)"), +) +EDITS["verify.py"] = ( + ('("check_calendar.py", "check_ownership.py")', + '("check_calendar.py", "check_ownership.py", "check_cutoff.py", "check_stage_seam.py", "check_ordinary_floor.py")'), +) + + +def materialize(package): + for name, replacements in EDITS.items(): + replace(package / name, replacements) + with (package / "runtime.patch").open("a") as patch: + patch.write(RAW_FLOOR_PATCH) + path = package / "SOURCES.json" + pins = json.loads(path.read_bytes()) + pins["runtime_images"]["installations.py"]["after"] = NEW_INSTALLATION + pins["runtime_images"]["raw_binary_stage.py"] = RAW_FLOOR_IMAGES + for name in ("runtime.patch", "grades.py"): + pins["local_sources"][name] = sha256((package / name).read_bytes()).hexdigest() + pins["runtime_images"]["grades.py"]["after"] = pins["local_sources"]["grades.py"] + path.write_text(json.dumps(pins, indent=2) + "\n") diff --git a/research/p104-integrated-gaussian-suffix/source-view-8076/source8076/verify.py b/research/p104-integrated-gaussian-suffix/source-view-8076/source8076/verify.py new file mode 100644 index 0000000000..5b5320e445 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view-8076/source8076/verify.py @@ -0,0 +1,83 @@ +"""Restore authenticated public inputs, apply one charged child tariff and replay a signed mode.""" +from argparse import ArgumentParser +from hashlib import sha256 +import json +from pathlib import Path +import runpy +from subprocess import run +import sys +import tarfile +from tempfile import TemporaryDirectory + +HERE = Path(__file__).resolve().parent +HEAD = "cbe847a953b971f9c6c5a0a6661e2008acd29086" +SOURCE_SHA = "798c2e6394c258986484a116198cc542a6d2b4c1f289e5816de2cfecf5141c51" + + +def unique_object(pairs): + result = {} + for name, value in pairs: + if name in result: + raise ValueError(f"Repeated source key {name}") + result[name] = value + return result + + +def restore(tree): + source = (HERE / "PEER-SOURCE.json").read_bytes() + if sha256(source).hexdigest() != SOURCE_SHA: + raise ValueError("Peer source manifest differs") + pins = json.loads(source, object_pairs_hook=unique_object) + archive = HERE / "peer8057.tar.gz" + if pins["head"] != HEAD or sha256(archive.read_bytes()).hexdigest() != pins["archive_sha256"]: + raise ValueError("Unexpected source archive") + seen = set() + with tarfile.open(archive) as bundle: + for item in bundle: + path = Path(item.name) + if path.is_absolute() or ".." in path.parts or str(path) != item.name: + raise ValueError(f"Invalid source path {item.name}") + if item.isdir(): + continue + if not item.isfile() or item.name in seen or item.name not in pins["files_sha256"]: + raise ValueError(f"Unexpected or repeated peer file {item.name}") + data = bundle.extractfile(item).read() + if sha256(data).hexdigest() != pins["files_sha256"][item.name]: + raise ValueError(f"Source differs at {item.name}") + destination = tree / path + destination.parent.mkdir(parents=True, exist_ok=True) + destination.write_bytes(data) + seen.add(item.name) + if seen != pins["files_sha256"].keys(): + raise ValueError("Source archive is missing a file") + return tree / "research" / "frequency-weighted-native-multiplier" + + +def main(): + modes = ("price", "calendar", "raw", "exterior", "nested", "product", "setup", "regenerate") + parser = ArgumentParser(description=__doc__) + parser.add_argument("mode", choices=modes) + args = parser.parse_args() + with TemporaryDirectory(prefix="weighted-child-") as temporary: + tree = Path(temporary) + peer = restore(tree) + runpy.run_path(str(HERE / "prepare.py"))["materialize"](peer) + for name in ("check_cutoff.py", "check_stage_seam.py", "check_ordinary_floor.py"): + (peer / name).write_bytes((HERE / name).read_bytes()) + if args.mode == "regenerate": + runtime = tree / "runtime" + run([sys.executable, "-IB", str(peer / "bootstrap.py"), str(runtime)], check=True) + result = run([sys.executable, "-IB", str(peer / "receipt.py"), str(runtime)], check=True, capture_output=True, text=True) + print(json.dumps(json.loads(result.stdout), indent=2)) + return + if args.mode == "setup": + serial = peer.parent / "tiered-native-multiplier" / "check_serial_setup.py" + run([sys.executable, "-IB", str(serial)], check=True) + else: + (peer / "RESULT.json").write_bytes((HERE / "RESULT.json").read_bytes()) + run([sys.executable, "-IB", str(peer / "verify.py"), args.mode], check=True) + print("PASS_CHILD_TARIFF", args.mode, flush=True) + + +if __name__ == "__main__": + main() diff --git a/research/p104-integrated-gaussian-suffix/source-view-8076/stage-caps.json b/research/p104-integrated-gaussian-suffix/source-view-8076/stage-caps.json new file mode 100644 index 0000000000..38482e336b --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view-8076/stage-caps.json @@ -0,0 +1,144 @@ +{ + "public_at_318291911": { + "clock_cap": 318291911, + "ordinary_heights": [ + 8192, + 111681, + 524288 + ], + "gaussian_height": 509812, + "three_stage_slices": [ + { + "G": 509812, + "ordinary": "523210717173784933073424602001/134217728000000000000000000000000", + "gaussian": "2185126724735343/560544221979738112" + }, + { + "G": 509813, + "ordinary": "523210717115285901706667348881/134217728000000000000000000000000", + "gaussian": "8740524044578679/2242181285965463552" + } + ], + "exact_stopped_upper_one_to_seven_stages": "1667119388378402860472786027/427661302169600000000000000000", + "one_two_and_four_to_seven_relaxed_upper": [ + "6670379237088547318268533/1717986918400000000000000000", + "1605579119637598133064679978243/411880491738726400000000000000000", + "2772300997468814084094029795923/711170992793190400000000000000000" + ], + "required_G_for_equality_or_improvement": 509812 + }, + "composite_at_318291911": { + "clock_cap": 318291911, + "ordinary_heights": [ + 8192, + 118919, + 524288 + ], + "gaussian_height": 499284, + "three_stage_slices": [ + { + "G": 499284, + "ordinary": "523211114815016822873901880209/134217728000000000000000000000000", + "gaussian": "2140003845965527/548968563562512384" + }, + { + "G": 499285, + "ordinary": "523211114763422189671931827089/134217728000000000000000000000000", + "gaussian": "1712006505899883/439175730459312128" + } + ], + "exact_stopped_upper_one_to_seven_stages": "1632693363926333812833543539/418829775667200000000000000000", + "one_two_and_four_to_seven_relaxed_upper": [ + "6670379237088547318268533/1717986918400000000000000000", + "1702526028977799660585243855701/436750070369484800000000000000000", + "36619725784362775590771374069/9393952469811200000000000000000" + ], + "required_G_for_equality_or_improvement": 499284 + }, + "public_at_318291900": { + "clock_cap": 318291900, + "ordinary_heights": [ + 8192, + 111681, + 524288 + ], + "gaussian_height": 509812, + "three_stage_slices": [ + { + "G": 509812, + "ordinary": "523210717173784933073424602001/134217728000000000000000000000000", + "gaussian": "2185126724735343/560544221979738112" + }, + { + "G": 509813, + "ordinary": "523210717115285901706667348881/134217728000000000000000000000000", + "gaussian": "8740524044578679/2242181285965463552" + } + ], + "exact_stopped_upper_one_to_seven_stages": "1667119388378402860472786027/427661302169600000000000000000", + "one_two_and_four_to_seven_relaxed_upper": [ + "6670379237088547318268533/1717986918400000000000000000", + "1605579119637598133064679978243/411880491738726400000000000000000", + "14438928170541047660735750273/3703979796070400000000000000000" + ], + "required_G_for_equality_or_improvement": 509812 + }, + "composite_at_318291900": { + "clock_cap": 318291900, + "ordinary_heights": [ + 8192, + 118919, + 524288 + ], + "gaussian_height": 499284, + "three_stage_slices": [ + { + "G": 499284, + "ordinary": "523211114815016822873901880209/134217728000000000000000000000000", + "gaussian": "2140003845965527/548968563562512384" + }, + { + "G": 499285, + "ordinary": "523211114763422189671931827089/134217728000000000000000000000000", + "gaussian": "1712006505899883/439175730459312128" + } + ], + "exact_stopped_upper_one_to_seven_stages": "1632693363926333812833543539/418829775667200000000000000000", + "one_two_and_four_to_seven_relaxed_upper": [ + "6670379237088547318268533/1717986918400000000000000000", + "1702526028977799660585243855701/436750070369484800000000000000000", + "1483085499904225944809857778041/380451639053516800000000000000000" + ], + "required_G_for_equality_or_improvement": 499284 + }, + "one_clock_lower_composite": { + "clock_cap": 318291899, + "ordinary_heights": [ + 8192, + 118918, + 524288 + ], + "gaussian_height": 499284, + "three_stage_slices": [ + { + "G": 499283, + "ordinary": "523211114815016822873901880209/134217728000000000000000000000000", + "gaussian": "8559998238224801/2195869856203538432" + }, + { + "G": 499284, + "ordinary": "523211114763422189671931827089/134217728000000000000000000000000", + "gaussian": "2140003845965527/548968563562512384" + } + ], + "exact_stopped_upper_one_to_seven_stages": "523211114763421518583291827089/134217728000000000000000000000000", + "one_two_and_four_to_seven_relaxed_upper": [ + "6670379237088547318268533/1717986918400000000000000000", + "1702526028977799660585243855701/436750070369484800000000000000000", + "1483085499904225944809857778041/380451639053516800000000000000000" + ], + "required_G_for_equality_or_improvement": 499284 + }, + "minimum_clock_for_booked_kappa": 318291900, + "gain_over_public_upper": "6334499898761145463273/2138306510848000000000000000000" +} diff --git a/research/p104-integrated-gaussian-suffix/source-view/BUNDLE-INPUTS.json b/research/p104-integrated-gaussian-suffix/source-view/BUNDLE-INPUTS.json new file mode 100644 index 0000000000..1eb4fcc0bd --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/BUNDLE-INPUTS.json @@ -0,0 +1,27 @@ +{ + "build_successor.py": "9ab4e9c13deec0c78fdaf94b4d99bead75c5444ca28356d2823b63b4cf133b97", + "certify_frontier.py": "11467405d9ba805e3ee477c4eb451cf90ac0943e930a1891c1a1c1abce5e173b", + "check_corrupt_owner.py": "f68ca0681c5b695dbb4588b4d7a363344aa2f7e622d6e8d8e278fe896d9228da", + "check_six_ordinary.py": "70fdd6f0f4af1e192d047ce69304c733388bf4759e76a1b852ddf3c5238a185d", + "check_six_price.py": "d99a728235fb96dbc58daa9fa60dc00ed27f18333938b6158e430c17e55e0c01", + "check_successor_cutoff.py": "aee71d6206f99879210be1c0472a8273ef6611d3a23cc6ed44790fd68538f5b2", + "check_successor_tiers.py": "14c4114cc0bf58966d9eee91890230feb30a6d67632a33dffc4aba5bf0ec1a46", + "compose8073.py": "85810eb5fe0e5243828f6196a4b9c5197bf75c7cb5f2280c9112b22dfe11b9ff", + "peer8057.tar.gz": "0e0d559bdb15e7b647f88a2b5e27fcdc9e28e81d8f4145459876ba6da2e9314c", + "run_successor.py": "01e187384cb897c418fa1dc44903440601da16b1705dde99572ffa9ffe14144e", + "source-blobs.json": "e927ca01169192a995bdb5316b85c6ea6f613697c54287eb38f894d5be379e46", + "source8073/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "source8073/NOTICE.md": "9bb1b93c10f93bc4d5c6cf7e0e9a25e91c0bb260a1224a536420d0c145ef58d6", + "source8073/PEER-SOURCE.json": "798c2e6394c258986484a116198cc542a6d2b4c1f289e5816de2cfecf5141c51", + "source8073/PROOF.md": "9b11262a25dcf121f016ef4b8a6d174fc19a8dbd671ad6c9d0ac9b13cb6949ec", + "source8073/README.md": "85a905b0ff98c736056cf45965628f39b9f236eb326a8394b78365c97ecf8605", + "source8073/RESULT.json": "344e8cb43020544c675529be213e5aae5e50647dcd3564f32fc632f0b0a963ad", + "source8073/SOURCES.json": "b3197501bae90ec16c4d99c186e74dfe28e0f5f730e6b8bb94e2d0ce78bcf69c", + "source8073/TASK.json": "ef3430bd093c976f8850b08bfcb6bed26c4f3fcebeea0e889c6e63d903c1724a", + "source8073/VERIFY.json": "e93a797f94c130f5f6cede24b0ae05e81cc22c6299feef9ac5bbbd1eb4b585d2", + "source8073/check_cutoff.py": "27f80ce02d8916f0360dff0815863d7c88d65a646bf69db0845e1e6ea5061797", + "source8073/check_ordinary_floor.py": "893592da4850a3de766e08e1ab0381cbd3c31dce4c85f86e78d5316115368cec", + "source8073/check_stage_seam.py": "f4e21cd98a8ad2d02ce5a8939eac5e75b4f1fd0e0fe3de37497a849cec5c4f5c", + "source8073/prepare.py": "c6a7037712bc56a22b879c8ea94e57e210ca66402e367bb196f02d1a22b72a8a", + "source8073/verify.py": "9443a8ca39b9f0366305b67ba218875050c1574710b0d4ca4465cf8270f53119" +} diff --git a/research/p104-integrated-gaussian-suffix/source-view/SIX-COLUMN-PROOF.md b/research/p104-integrated-gaussian-suffix/source-view/SIX-COLUMN-PROOF.md new file mode 100644 index 0000000000..5b164aada3 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/SIX-COLUMN-PROOF.md @@ -0,0 +1,69 @@ +# The six-column Gaussian calendar and its stopped signed rate + +The comparator is ToikY’s PR #8072 at commit 75f7e1c44f48c43983016bcf8878c4d9e5e87c62. The candidate changes the physical Gaussian width at each even bin start e from e − 8 to e − 6, opens the calendar at L = 1054, and changes the terminal allocation. Ali Romman supplied the signed 48-call word and physical compiler. SYLforge supplied the K7 ordinary construction. ToikY supplied the weighted two-type calendar, finite debits and capped stopped comparison. The same five all-size premises carry forward. + +## The source at κ = 0.0039 + +Set t = 1 − 0.0039. Rebuilding the unsigned rank counts from the signed physical source yields 52,608 productive and 281,568 paid ports in one unsplit word. The difference between Σkᵗ over productive ports and Σrᵗ over paid ports lies strictly between −1.539342547620186178215 and −1.539342547620186178214. Directed arithmetic and the derivative sign put its raw crossing strictly between 0.0038984814465499354937143170325740113 and 0.0038984814465499354937143170325740114. + +A uniform positive width scale a multiplies both masses by aᵗ. Dividing a paid port into positive widths increases its price by concavity. Removing productive ports decreases the available capacity. The two masses add under disjoint union and multiply separately under Cartesian tensor products of the respective productive and paid grades. Induction gives a strict deficit at 0.0039 for every nonempty finite word built from this atom using those operations. The weighted mass relaxation also covers arbitrary positive real frequencies. A productive split that supplies independent owners, another physical word or a signed compiler with different obligations needs a separate comparison. + +The actual two types have frequencies 5 and 451, scales 1 and 2, and 1,008 bisected unit loans in every small copy. At 0.0039 their paid excess exceeds 1,406.0782316527722109495 units per weighted cohort. Both the ordinary and positive inequalities in the complete signed budget fail. The four functional inequalities stay positive. The ordinary clamp is 0.0039 and the booked ordinary rate must exceed the claimed rate by five times 10⁻¹⁸. The Gaussian raw booking 17145637307/2⁴² is already short by 4215053941/2748779069440000 before deducting its finite price. + +## A real prefix on an occupied edge + +For offset s, an actual parent in an even bin e has r(e − s) axes, while its prefix for recipient bin d has k(d − s) axes. The physical calendar creates a positive interior link only if the interval with ends max(e, dk/r) and min(e + 2, (d + 2)k/r) has positive length. Write y = xr/k for some x in that interval, a = k/r, and h(v) = v − 2⌊v/2⌋. The actual suffix then equals + + Sₛ = s(k − r) + k h(y) − r h(a y). + +The bin intersection gives −2r < re − kd < 2k. Since e and d are even, re − kd is an integer multiple of g = gcd(2r, 2k). The two possible extrema are −2r + g and 2k − g. For any multiple D of g in that open interval, Bézout’s identity gives even e and d with er − dk = D. Translating by their common period makes both bin endpoints positive. The two strict inequalities on D then give a nonempty overlap. The verifier enumerates the 1,971 constant intervals across the 51 source grade cells and evaluates their suffixes directly. + +It follows that s(k − r) ≥ 2r − g is sufficient for the prefix to fit. Among all occupied edges, the largest ratio (2r − g)/(k − r) is 94/17, on the edge 96 → 130. Six is the least even offset for the complete source. A finite typed-plan test builds the four positive grants at a compatible pair of bins. Offset four would overdraw 52 axes there, while six leaves 16. The constructor rejects the smaller offset before opening the calendar. + +## Summing the real interior loans + +For a fixed paid port and receiving port, let π be their actual probability and w the sender type's frequency. Each finite grant is rounded downward from a lower bound on wV times π times the integral of x⁻¹⁻ᵗ over its bin intersection. Since Sₛ ≥ 0, multiplying the grant by Sₛ preserves the upper estimate from the integral. All compatible bin intersections partition the domain for the ordered port pair up to endpoints of zero measure. Changing coordinates to y contributes exactly (r/k)ᵗ. Summing over ports in both types leaves the installed weight Dᵣ pᵣₖ, where Dᵣ counts all paid occurrences of grade r with their frequencies, and pᵣₖ is the fraction sent to k. + +The initial domain is L ≤ y < Ur/k. The nonnegative periodic suffix permits extension to the full half-line y ≥ L. Normalize the measure y⁻¹⁻ᵗ dy on that half-line. Because L is even and the density decreases within every complete two-unit bin, E[h(y)] ≤ 1. The continuous periodic function P(z) = h(z)²/2 − h(z) has derivative h(z) − 1 away from even integers and lies in [−1/2, 0]. Set f(y) = y⁻¹⁻ᵗ. Integration by parts gives + + ∫ f(y) [h(ay) − 1] dy = −f(L)P(aL)/a − ∫ f′(y)P(ay) dy/a ≥ −f(L)/(2a). + +All integrals in this display run from L to infinity. Since ∫ f = L⁻ᵗ/t, we get E[h(ay)] ≥ 1 − t/(2aL). The total matched interior suffix count per time therefore has this upper bound. + + V/(t Lᵗ) × Σ Dᵣ pᵣₖ (r/k)ᵗ [ (s + 1)(k − r) + t r²/(2kL) ]. + +The pricing program rounds every positive factor (r/k)ᵗ upwards. To obtain the finite fringe coefficient d, divide the sum by tΨ, with the same boundary mass + + Ψ = Σ Dᵣ pᵣₖ r [ (k/r)ᶜ − 1 ]/c, c = 1 − t. + +The program rounds Ψ down. Three independent bounded typed fixtures each exercise all four type combinations. In every fixture an individual loan exceeds the averaged bound, while the weighted sum of the real grants stays below the integral bound. This control detects an erroneous pointwise use of the averaging step. + +An optional refinement for offset eight uses the joint phases. The function H(y) = kP(y) − rP(ay)/a is piecewise linear with derivative S₈ − 9(k − r). Its maximum over a complete period is attained at a breakpoint. Integration by parts retains the lower endpoint and gives E[S₈] ≤ 9(k − r) + (t/L)(max H − H(L)). + +## Completing the finite Gaussian charge + +A bottom-boundary singleton has e − s ≤ x and keeps the original terminal-mass upper bound. A true exterior recipient satisfies 2⌊y/2⌋ − s > y − s − 2 ≥ y − 10 and has at most 258U axes. These inequalities preserve the existing exterior density, period and incomplete-round estimates. For one paid owner let K be the horizon, C its rounded birth count, P = r(e − s), q the individual grant counts, Q = k(d − s) the corresponding prefixes, and B = max(0, K − jD[e]) the number of timely issues. The literal identity KCP − BΣqQ = KΣq(P − Q) + K(C − Σq)P + (K − B)ΣqQ assigns matched suffixes to the integrated bound, unmatched births and downward-rounded mass to their full singleton price, and late missed prefixes to the pre-existing end-loss allowance. A grant is multiplied by its real type frequency, 5 or 451, before it is rounded. U equals 2⌊M/(1724·306)⌋. The new offset preserves e − 6 < U throughout. The two real decoders use e − 6 and 2(e − 6), both even. The constructor recomputes exterior widths and periods, emitted child prefixes and the actual remaining singleton sizes. + +Throughout the allowed native heights H ≥ 1024, the complete finite factor is at most + + (1 + δ)(1 + 1032/263772)(263772L)ᶜ (1 + d/L + δ)/(1 − δ)⁴, δ = 2⁻¹²⁸. + +At s = 6 and L = 1054, the directed computation yields d < 3.539446 and the finite factor is below 2 raised to 125645/1048576. The installed invoice checks Lᵗ > 1024, 516L < U, 4·258(U − 6) < M and 516(U + 2) < M at the smallest native height. It also checks integer quadrature, temporal separation, lost end slots and group padding. The separate coefficient M²²⁰ still pays for the ordinary supplier and stopped positive depths. Width and memory proofs which use U as a strict upper bound continue to hold. For the installed dyadic trial there are at most 42 square roots. Throughout a contributing integral, 1 ≤ x ≤ M and the initial directed endpoints for 1/x are at least 1/(2M). Each directed square-root interval on this range expands its width by at most √M and adds at most two grid ticks. The subsequent products of factors bounded by one add their interval widths and two grid ticks per multiplication. From initial width at most two ticks, the endpoint error is therefore below 2¹³ M²¹ times a grid tick of size 2 raised to −64(H+1). Multiplying the two endpoint errors by 451V/t still gives less than 2²⁴ M²⁷ grid ticks, which is below one quarter already at H = 1024. This justifies the existing downward grant and endpoint rounding allowance for frequency 451 and divisor 1724. The additional grade feasibility uses at most 88 small gcd calculations with arguments bounded by 516, once during a new typed-plan compilation. A reserve of 512 elementary grade operations per cell fits within the pre-existing strict grade-action and compiler-clock bounds. + +## Exact stopped allocation + +A fixed Gaussian height G leaves a budget for the three ordinary heights bᵢ given by 1731 + 320Σbᵢ + 220G ≤ C₀. Each ordinary height lies in [8192, 524288]. The first stage starts at zero. Each stage carries the previous rate with weight 1/250, uses the fixed debit 11239/8192 and applies the 39/10000 clamp. Each intermediate floor loses one extra unit of the 10⁻²¹ grid. + +Relaxing the clamp and rounding gives an ordinary objective proportional to −Σwᵢ/bᵢ with weights (1/62500, 1/250, 1). Adding one height unit at h earns wᵢ/[h(h+1)]. Removing one costs wᵢ/[h(h−1)]. These monotone discrete prices give the relaxed optimum. The verifier compares the exact rounded grid loss to any loss of budget or decrement of the third height. For changes confined to the first two heights, it checks the neighbors and excludes all farther allocations by curvature. The Gaussian rate increases with G and the feasible ordinary set shrinks, so the two adjacent integers at the crossing settle the complete finite cap. + +The installed profile uses the stricter cap 318292011, equal to #8072's actual recurring charge. Its ordinary heights are (8358, 132157, 524288) and its Gaussian height is 479787. The booked rate is 0.003898216827298. Its complete recurring log₂ C upper bound is 318291831, 180 lower than #8072. The terminal activation is 2¹¹⁴⁵⁰⁶⁴ + 2. The entry conversion costs 514, the maximum native height is 524288, and the conservative fixed setup bound is below 2²²⁸. Both tiers' charged signed inequalities are evaluated from the new installed profile. The looser 318292071 family cap gives the slightly larger arithmetic screen recorded separately. + +The physical checks exercise bounded actual calls and verify symbolic all-size invoices. The full production dimensions and the inherited five all-size premises retain their stated scope. + +## Composition with ToikY’s published PR #8073 + +The second installation restores all 15 changed package blobs at cf4c4b7ea4b746be174ee4ba4e49f03b5bc79f8e, authenticates its 88-file parent archive, applies its own weighted compiler, then installs the shorter Gaussian origin. ToikY’s new ordinary matched-suffix proof buys the K7 debit 11204/8192. The six-column calculation uses that independently supplied debit in the ordinary recurrence and 125645/1048576 only in the positive recurrence. + +The recurring budget is 318291911, the actual published #8073 bill. The best fixed-booking crossing under this budget has ordinary heights (8192, 124612, 524288) and G = 491002. Its stopped supremum is 523210571423785163651433485201 / 134217728000000000000000000000000. The 18-place booking is 0.003898222531555482. The published #8073 family supremum is 523210198560303585338978849681 / 134217728000000000000000000000000. The composite rate exceeds that upper by more than 0.0000000027780494. The gain over the reported #8073 rate is exactly 1389024741 / 500000000000000000. + +The new complete recurring bound is 318291611, 300 below #8073. Its first terminal header is 2 raised to 1148568, plus two, and its entry conversion is 515. The source comparator uses exponent 1151953, offset four and 517 conversion bits. The maximum native height remains 524288. Each signed tier checks 54 strict conditions, four functional conditions and the positive service cap. The smaller binary and Gaussian finite charges therefore enter a single signed caller with actual owner returns. diff --git a/research/p104-integrated-gaussian-suffix/source-view/build_successor.py b/research/p104-integrated-gaussian-suffix/source-view/build_successor.py new file mode 100644 index 0000000000..60bd78096c --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/build_successor.py @@ -0,0 +1,112 @@ +"""Install the six-column Gaussian offset atop the authenticated #8072 runtime.""" +from hashlib import sha256 +from pathlib import Path +from shutil import copyfile,copytree +from fractions import Fraction as Q +import json + +root=Path(__file__).resolve().parent +candidate=root/'successor' +base=root/'runtime' +dest=candidate/'runtime' +source=root/'peer/research/frequency-weighted-native-multiplier' +checks=candidate/'peer/research/frequency-weighted-native-multiplier' +changes={} + + +def write(path,d,old,new,count=1): + if d.count(old)!=count:raise ValueError((str(path),old,d.count(old),count)) + return d.replace(old,new) + + +def adjust(path,seq): + d=path.read_text() + before=sha256(path.read_bytes()).hexdigest() + for old,new,*num in seq:d=write(path,d,old,new,*num) + path.write_text(d) + changes[str(path.relative_to(candidate))]={"before_sha256":before,"after_sha256":sha256(path.read_bytes()).hexdigest()} + + +def main(): + candidate.mkdir(exist_ok=True) + copytree(base,dest,dirs_exist_ok=True,ignore=lambda p,n: {'__pycache__'}) + copytree(root/'peer',candidate/'peer',dirs_exist_ok=True,ignore=lambda p,n: {'__pycache__'}) + typed=dest/'typed_transport.py' + adjust(typed,[ + ('from dataclasses import dataclass','from dataclasses import dataclass\nfrom math import gcd'), + (' def __init__(\n self,',' column_offset = 8\n\n def __init__(\n self,'), + (' width=None,',' width=None,\n column_offset=8,'), + (' if len(types) != 2 or lower <= 8', ''' if type(column_offset) is not int or column_offset < 0 or column_offset > 8 or column_offset % 2: + raise ValueError("Use a nonnegative even column offset of at most eight") + self.column_offset = column_offset + if len(types) != 2 or lower <= column_offset'''), + (' owners = ids[b, k]',''' if column_offset < 8: + rr, kk = Q(2*r), Q(2*k) + if rr.denominator != 1 or kk.denominator != 1 or column_offset*(k-r) < rr-gcd(rr.numerator,kk.numerator): + raise ValueError("A routed prefix can exceed its real paid field") + owners = ids[b, k]'''), + ('upper - 8','upper - self.column_offset'), + ('e - 8','e - self.column_offset',4), + ('band - 8','band - self.column_offset',3)]) + adjust(dest/'grades.py',[('LOWER = 1874','LOWER = 1054'),(' width=self.width,',' width=self.width,\n column_offset=6,')]) + adjust(dest/'installations.py',[('Profile((8192, 124649, 524288), 490950, Q(".003898214283192"))','Profile((8358, 132157, 524288), 479787, Q(".003898216827298"))')]) + independent=checks/'positive_debit.py' + adjust(independent,[ + ('from fractions import Fraction as Q','from fractions import Fraction as Q\nfrom math import gcd'), + ('BAND_LOWER = 1874','BAND_LOWER = 1054'),('Q(64939, 524288)','Q(125645,1048576)'), + (' fringe = 10 * target_axes / (t * psi)',''' # Nonempty interior grants are rounded down. The full proof bounds + # the y-integral of the integer paid suffix after y=x*r/k. + contributions = Q(0) + needed = Q(0) + for (r,k),share in cells.items(): + r,k=Q(r),Q(k) + r2,k2=int(2*r),int(2*k) + assert 2*r == r2 and 2*k == k2 + needed=max(needed,(2*r-gcd(r2,k2))/(k-r)) + ratio_upper=Q(intervals(r,t)[1],intervals(k,t)[0]) + mean=7*(k-r)+t*r*r/(2*k*lower) + contributions += paid[r]*share*ratio_upper*mean + assert needed==Q(94,17)<6 + fringe=contributions/(t*psi)'''), + ('Q("7.335168")','Q("3.539446")'),('(upper - 8)','(upper - 6)')]) + adjust(checks/'receipt.py',[ + ('Q(64939, 2**19)','Q(125645,1048576)'),('LOWER == 1874','LOWER == 1054'), + ('cost == 318292011 and premium == 515','cost == 318291831 and premium == 514'), + ('(517115, 490950)','(517611, 479787)'),('Q(".00389821412325")','Q(".003898214283192")'), + ('Q(79971, 500000000000000)','Q(1272053, 500000000000000)')]) + adjust(checks/'check_placement.py',[('size = 258 * (e - 8)','size = 258 * (e - 6)')]) + adjust(checks/'check_exterior.py',[ + (' L = 10\n U = 12',' L = 8\n U = 10'), + (' assert 4 * U < 5 * L',' assert 4 * U <= 5 * L'), + (' def __init__(self):\n',' column_offset = 6\n\n def __init__(self):\n'), + ('size = (L - 8) * k','size = (L - 6) * k'), + ('true[owner] = (2 * k, ext.period)','true[owner] = ((L-p.column_offset) * k, ext.period)'), + ('cols = 2 * (1 + kind)','cols = (L-p.column_offset) * (1 + kind)')]) + # One actual linked packet at e=22, d=10 retains the dense predecessor's + # physical widths 16 and 4. Check both typed headers at the new origin. + adjust(checks/'check_nested.py',[ + (' grant = (',''' from typed_transport import column_header + parent_bin, child_bin, offset = 22, 10, 6 + rr, kk = 1, 2 + grant_lo = max(parent_bin, Q(child_bin*kk,rr)) + grant_hi = min(parent_bin+2, Q((child_bin+2)*kk,rr)) + assert (grant_lo,grant_hi)==(22,24) + grant = ('''), + ('.mass(24, 26)[0]','.mass(grant_lo, grant_hi)[0]'), + ('4_400_000_000 < grant.numerator // grant.denominator < 4_600_000_000','5_000_000_000 < grant.numerator // grant.denominator < 6_000_000_000'), + ('and 24 * 1 == 12 * 2','and grant_lo < grant_hi'), + (' P = 16\n S = 8',''' P = column_header(parent_bin-offset,0) + child_header = column_header(child_bin-offset,1) + S = 2*(child_header-1) + assert (P,S,child_header)==(16,8,5)'''), + ('method.native(cr, S // 2 + 1)','method.native(cr, child_header)')]) + # Exercise the new mode in generic dirty calendar and all owners too. + adjust(checks/'check_calendar.py',[(' padding=1,',' padding=1,\n column_offset=6,'), + (' 192,',' 196,')]) + adjust(checks/'check_ownership.py',[(' padding=1,',' padding=1,\n column_offset=6,'), + ('e - 8','e - 6',5)]) + (candidate/'delta-pins.json').write_text(json.dumps(changes,indent=2)+'\n') + print('REGISTERS',len(changes)) + + +if __name__=='__main__':main() diff --git a/research/p104-integrated-gaussian-suffix/source-view/certify_frontier.py b/research/p104-integrated-gaussian-suffix/source-view/certify_frontier.py new file mode 100644 index 0000000000..89ddf7bad0 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/certify_frontier.py @@ -0,0 +1,252 @@ +"""Directed reconstruction of the #8072 Gaussian suffix price and fixed-clock allocation.""" +from collections import Counter +from decimal import Decimal, getcontext +from fractions import Fraction as Q +from functools import cache +from hashlib import sha256 +from math import ceil, gcd, isqrt +from pathlib import Path +import json +import sys + +ROOT = Path(__file__).resolve().parent +RUNTIME = ROOT / "runtime" +sys.path.insert(0, str(RUNTIME)) +from upstream import HERE, install +install() +sys.path.insert(0, str(ROOT / "peer/research/tiered-native-multiplier/source")) +from grades import numerical_recipe +from installations import BINARY_C, GAUSSIAN_C +from outer_budget import margins +from strong_complex import LAYOUT, WORD, load_changed, word +sys.path.insert(0, str(RUNTIME / "inputs/complex-source")) +from verify_component import check_decrease, margin + +getcontext().prec = 52 +GRID = 1 << 192 +C = GAUSSIAN_C +T = 1 - C +BASE_L = 1874 +CLOCK_CAP = 318292071 +STOP = Q(5, 10**18) +TARGET = Q(39, 10000) +OLD_DEBIT = Q(64939, 524288) +ORD_DEBIT = Q(11239, 8192) +OLD_UPPER = Q(523209464347189355219919950737, 134217728000000000000000000000000) + + +def dec(value, places=32): + value = Q(value) + return format(Decimal(value.numerator) / Decimal(value.denominator), f".{places}f") + + +@cache +def powers(base, exponent): + """Independent directed interval for a rational base and a positive dyadic exponent.""" + base, exponent = Q(base), Q(exponent) + assert base > 0 and 0 <= exponent < 1 and exponent.denominator.bit_count() == 1 + low = int(base * GRID) + high = ceil(base * GRID) + low_result = high_result = GRID + for bit in range(exponent.denominator.bit_length() - 2, -1, -1): + low = isqrt(low * GRID) + high = 1 + isqrt(high * GRID - 1) + if exponent.numerator & (1 << bit): + low_result = (low_result * low) // GRID + high_result = -(-high_result * high // GRID) + return Q(low_result, GRID), Q(high_result, GRID) + + +def p(z): + rem = z % 2 + return rem * rem / 2 - rem + + +@cache +def periodic_constants(r, k): + r, k = Q(r), Q(k) + ratio = k / r + period = 2 * ratio.denominator + knots = sorted({Q(i) for i in range(0, period + 1, 2)} | + {Q(2*j, ratio) for j in range(ratio.numerator + 1)}) + def H(y): + return k * p(y) - r / ratio * p(ratio * y) + hs = [H(y) for y in knots] + assert hs[0] == hs[-1] == 0 + integral = Q(0) + maximum = Q(0) + minimum = None + for (y, z), (h, j) in zip(zip(knots, knots[1:]), zip(hs, hs[1:])): + mid = (y+z)/2 + measured = r*(2*(ratio*mid//2)-8) - k*(2*(mid//2)-8) + assert measured == 9*(k-r) + (j-h)/(z-y) + assert 0 <= measured < 10*k - 8*r + assert measured.denominator == 1 + integral += (h+j)*(z-y)/2 + maximum = max(maximum, measured) + minimum = min(measured, minimum) if minimum is not None else measured + assert integral/period == -(k - r/ratio)/3 + assert maximum == 10*k-8*r-gcd(int(2*r), int(2*k)) + return max(hs), maximum, minimum, len(knots)-1 + + +def edge_envelopes(r, k, lower): + ratio = k / r + hmax, discrete, minimum, num_intervals = periodic_constants(r,k) + H0 = k * p(Q(lower)) - r/ratio*p(ratio*lower) + simple = 9*(k-r) + T*r/(2*ratio*lower) + sharp = 9*(k-r) + T*(hmax-H0)/lower + assert sharp <= simple and sharp >= 0 and minimum >= 0 + return discrete, min(discrete, simple), min(discrete, sharp), num_intervals + + +def aggregate(recipe): + edges = [(Q(r), Q(k), w, recipe.paid.histogram[r]) for (r,k),w in recipe.cells.items()] + psi = sum(count*w*r*(powers(k/r,C)[0]-1)/C for r,k,w,count in edges) + price_weights = [(r,k,count*w*powers(r/k,T)[1]) for r,k,w,count in edges] + return edges, psi, price_weights + + +def fringe_numerators(recipe, price_weights, lower): + old = 10 * sum(k*n for k,n in recipe.targets.histogram.items()) + by_grade = {} + total_discrete = total_simple = total_sharp = 0 + intervals = 0 + for r, k, load in price_weights: + d, simple, sharp, n = edge_envelopes(r,k,lower) + by_grade[k] = max(by_grade.get(k, Q(0)), d) + total_discrete += load*d + total_simple += load*simple + total_sharp += load*sharp + intervals += n + per_owner = sum(n*by_grade[k] for k,n in recipe.targets.histogram.items()) + assert total_sharp <= total_simple <= total_discrete <= per_owner < old + return (old, per_owner, total_discrete, total_simple, total_sharp), intervals + + +def factor(fringe, scale, lower): + delta = Q(1, 2**128) + return ((1+delta) * (1+Q(1032, scale)) * powers(scale*lower,C)[1] * + (1+fringe/lower+delta) / (1-delta)**4) + + +def booking(upper, denominator=2**24): + lo, hi = 0, denominator-1 + while hi-lo>1: + mid = (lo+hi)//2 + if powers(2,Q(mid,denominator))[0] > upper: + hi = mid + else: + lo = mid + assert powers(2,Q(hi,denominator))[0] > upper + return Q(hi,denominator) + + +def ordinary(heights): + rate = Q(0) + for i,h in enumerate(heights): + rate = min(TARGET, (249*(BINARY_C-ORD_DEBIT/h)+rate)/250) + if i+1 < len(heights): + rate = Q(int(rate*10**21)-1,10**21) + return rate + + +def shape(g): + total=(CLOCK_CAP-1731-220*g)//320 + last=524288 + rest=total-last + weights=(Q(1,62500),Q(1,250),Q(1)) + lo,hi=max(8192,rest-last),min(last,rest-8192) + first_lo,first_hi=lo,hi + while lomiddle_cost:lo=n+1 + else:hi=n + optimum=lo + h=(optimum,rest-optimum,last) + def ideal(hs): + return Q(249,250)*sum(w*(BINARY_C-ORD_DEBIT/b) + for w,b in zip(weights,hs)) + # Separable integer reciprocal costs. Every deposit outside this fixed + # slice originates in a lost unit or in a decrement of the last stage. + inc=[w/(b*(b+1)) if b8192 else None for w,b in zip(weights,h)] + assert all(d>=inc[j] for i,d in enumerate(dec) if d is not None + for j in range(3) if i!=j) + third_gap=dec[2]-max(inc[0],inc[1]) + budget_gap=min(x for x in dec if x is not None) + near=[(n,rest-n,last) for n in range(max(first_lo,optimum-1),min(first_hi,optimum+1)+1)] + best=max(near,key=ordinary) + assert ideal(h)-ordinary(best) < Q(249,250)*ORD_DEBIT*min(third_gap,budget_gap) + for n in (optimum-2,optimum+2): + if first_lo<=n<=first_hi: + assert ideal((n,rest-n,last))at(lo)[2] and at(hi)[1]1: + m=(lo+hi)//2 + _,o,c=at(m) + if o>c:lo=m + else:hi=m + rows=[(min(o,c)-STOP,g,hs,o,c) for g,(hs,o,c) in ((k,at(k)) for k in (lo,hi))] + value,g,hs,o,c=max(rows) + disclosed=Q(int(value*10**15),10**15) + assert disclosed+STOP < min(o,c) + strict,functional,positive=margins(disclosed,Q(1,10**18),disclosed+STOP,c) + assert len(strict)==54 and len(functional)==4 and min(*strict,*functional,positive)>0 + return { + "gaussian_height":g,"ordinary_heights":hs,"complete_clock":1731+320*sum(hs)+220*g, + "supremum":str(value),"lower_bookable":str(disclosed),"lower_decimal":dec(disclosed,15), + "strict_gain_over_8072_ceiling":str(disclosed-OLD_UPPER),"ordinary_upper":str(o), + "positive_upper":str(c),"positive_signed_margin":str(positive), + "smaller_crossing_height":lo,"higher_crossing_height":hi, + "signed_inequalities_passed":[len(strict),len(functional),1], + } + + +def main(): + recipe=numerical_recipe(490950) + edges,psi,weights=aggregate(recipe) + assert len(edges)==51 and len(recipe.typed_cells())==88 + raw=word(*load_changed(HERE/'inputs')) + target,paid=(Counter(p.rank for p in arr) for arr in (raw.targets,raw.paid)) + assert sum(target.values())==52608 and sum(paid.values())==281568 + check_decrease(paid,target) + deficit_lo,deficit_hi=margin(paid,target,TARGET) + assert Q('-1.539342547620186178215')0>margin(paid,target,rawhi)[1] + assert CTARGET + all_variants={} + old_upper=optimize(OLD_DEBIT) + assert Q(old_upper['supremum'])==OLD_UPPER + scale=1724*306//2 + nums,coverage=fringe_numerators(recipe,weights,BASE_L) + for name,num in zip(("historical","owner_max","edge_max","mean","phase"),nums): + fr=num/(T*psi) + upper=factor(fr,scale,BASE_L) + debit=booking(upper) + all_variants[name]={"lower":BASE_L,"fringe_upper":dec(fr),"finite_factor_upper":dec(upper), + "debit":str(debit),"debit_decimal":dec(debit),"allocation":optimize(debit)} + print(json.dumps({"source_head":"75f7e1c44f48c43983016bcf8878c4d9e5e87c62", + "word_sha256":WORD,"layout_sha256":LAYOUT,"targets":sum(target.values()),"paid":sum(paid.values()), + "unsplit_target_moment_minus_paid_interval":[str(deficit_lo),str(deficit_hi)], + "unsplit_root_bracket":[str(rawlo),str(rawhi)],"cG_gap_to_target":str(TARGET-C), + "ordinary_eta":str(TARGET),"ordinary_raw":str(BINARY_C),"gaussian_raw":str(C), + "interior_cells":len(edges),"typed_cells":len(recipe.typed_cells()),"phase_intervals":coverage, + "historical_cap":old_upper,"variants":all_variants},indent=2)) + + +if __name__=='__main__': + main() diff --git a/research/p104-integrated-gaussian-suffix/source-view/check_corrupt_owner.py b/research/p104-integrated-gaussian-suffix/source-view/check_corrupt_owner.py new file mode 100644 index 0000000000..ebd58d9c10 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/check_corrupt_owner.py @@ -0,0 +1,26 @@ +"""A one-axis under-return must fail during an actual dirty typed fixture.""" +from pathlib import Path +import runpy,sys +root=Path(__file__).resolve().parent +runtime=Path(sys.argv[1]).resolve();sys.path.insert(0,str(runtime)) +from typed_transport import TypedPlan + +class UnderReturn(TypedPlan): + damaged=False + def send_prefix(self,*args,**kwargs): + width=super().send_prefix(*args,**kwargs) + if width>1 and not UnderReturn.damaged: + UnderReturn.damaged=True + return width-1 + return width + +source=root/'successor/peer/research/frequency-weighted-native-multiplier/check_calendar.py' +check=runpy.run_path(str(source))['run'] +check.__globals__['TypedPlan']=UnderReturn +try: + check() +except (AssertionError,ValueError,ArithmeticError,IndexError) as error: + assert UnderReturn.damaged + print('PASS_CORRUPTED_ONE_AXIS_PREFIX_REJECTED',type(error).__name__) +else: + raise AssertionError('The one-axis under-return escaped its real dirty caller') diff --git a/research/p104-integrated-gaussian-suffix/source-view/check_six_ordinary.py b/research/p104-integrated-gaussian-suffix/source-view/check_six_ordinary.py new file mode 100644 index 0000000000..c09657d4af --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/check_six_ordinary.py @@ -0,0 +1,23 @@ +"""Rebind two literal height controls while retaining all upstream ordinary tests.""" +from pathlib import Path +import sys +root=Path(__file__).resolve().parent +runtime=Path(sys.argv[1]).resolve() +sys.path.insert(0,str(runtime)) +from installations import TERMINAL +parent=(root/'check_ordinary_floor.py').read_text() +if TERMINAL.complex_log==479787: + old,old_g=(8192,124649,524288),490950 + assert TERMINAL.rank_logs==(8358,132157,524288) +else: + old,old_g=(8192,117168,524288),501831 + assert TERMINAL.complex_log==491002 and TERMINAL.rank_logs==(8192,124612,524288) +no_spaces=lambda h: '('+','.join(map(str,h))+')' +subs=[('TERMINAL.rank_logs=='+no_spaces(old)+' and TERMINAL.complex_log=='+str(old_g), + 'TERMINAL.rank_logs=='+no_spaces(TERMINAL.rank_logs)+' and TERMINAL.complex_log=='+str(TERMINAL.complex_log)), + ('==(1024,'+str(old_g)+')','==(1024,'+str(TERMINAL.complex_log)+')')] +for src,dst in subs: + assert parent.count(src)==1 + parent=parent.replace(src,dst) +code=compile(parent,str(root/'check_ordinary_floor.py'),'exec') +exec(code,{'__name__':'__main__','__file__':str(root/'check_ordinary_floor.py')}) diff --git a/research/p104-integrated-gaussian-suffix/source-view/check_six_price.py b/research/p104-integrated-gaussian-suffix/source-view/check_six_price.py new file mode 100644 index 0000000000..ac4bab88a0 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/check_six_price.py @@ -0,0 +1,40 @@ +"""Second directed audit uses the raw installed calendar and original first/last heights.""" +from fractions import Fraction as Q +from math import ceil +from pathlib import Path +import json,sys +root=Path(__file__).resolve().parent +runtime=Path(sys.argv[1]).resolve() +# Load and hash the changed physical calendar before importing the independent +# 192-bit square-root and discrete-optimization implementation. +sys.path.insert(0,str(runtime)) +from upstream import install +install() +from grades import LOWER,numerical_recipe +from installations import ENTRY,TERMINAL +from typed_transport import TypedPlan +assert LOWER==1054 and str(runtime) in str(sys.modules['typed_transport'].__file__) +recipe=numerical_recipe(TERMINAL.complex_log) +sys.path.append(str(root)) +import certify_frontier as f +from certify_frontier import T,C,dec,powers +target=Q('.003898216827298') +debit=Q(125645,2**20) +edges,psi,weights=f.aggregate(recipe) +upper_fringe=sum(price*(7*(k-r)+T*r*r/(2*k*LOWER)) for r,k,price in weights)/(T*psi) +invoice=f.factor(upper_fringe,263772,LOWER) +assert powers(2,debit)[0]>invoice>powers(2,debit-Q(1,2**20))[1] +f.CLOCK_CAP=318292011 +best=f.optimize(debit) +assert Q(best['lower_bookable'])==target==TERMINAL.kappa and best['gaussian_height']==TERMINAL.complex_log +assert tuple(best['ordinary_heights'])==TERMINAL.rank_logs and best['complete_clock']==318291831 +hi=Q(best['supremum']) +assert targetQ('0.0000000025441059') +assert f.ordinary(TERMINAL.rank_logs)>target+f.STOP +assert len(edges)==51 and len(recipe.typed_cells())==88 and psi>Q('926899828.8291') +print(json.dumps({'independent_interval_bits':192,'finite_factor_upper':dec(invoice,36), + 'debit':str(debit),'upper_slack':dec(powers(2,debit)[0]-invoice,36), + 'next_smaller_debit_denominator':2**20,'next_smaller_fails':True, + 'estimated_fringe_upper':dec(upper_fringe,39),'exact_stop_supremum':str(hi), + 'strict_gain_over_predecessor_upper':str(target-f.OLD_UPPER),'best':best},indent=2)) diff --git a/research/p104-integrated-gaussian-suffix/source-view/check_successor_cutoff.py b/research/p104-integrated-gaussian-suffix/source-view/check_successor_cutoff.py new file mode 100644 index 0000000000..c196ac2cb3 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/check_successor_cutoff.py @@ -0,0 +1,78 @@ +"""Call the real recipe and exercise the new Gaussian origin at its actual first boundary.""" +from fractions import Fraction as Q +from math import gcd +from pathlib import Path +import json,sys + +runtime=Path(sys.argv[1]).resolve() +sys.path.insert(0,str(runtime)) +from upstream import install +install() +import grades +from grades import LOWER,UPPER_DIVISOR,WEIGHTS,numerical_recipe +from installations import ENTRY,TERMINAL,GAUSSIAN_C +from transport import Measure,ceil +from typed_transport import TypedPlan,NativeType,column_header +assert LOWER==1054 and UPPER_DIVISOR==1724 and WEIGHTS==(5,451) +contacts=[] +for tier in (ENTRY,TERMINAL): + recipe=numerical_recipe(tier.complex_log) + def inspect(n,types,cells,t,lower,upper,volume,ticks,rounds,**kw): + assert n==1<516*lower and 4*258*(upper-6)0 +metrics=[] +for child in (0,1): + actual=[z for z in plan.receive[d,child,0] if z.band==e] + assert len(actual)==2 and all(z.count>0 for z in actual) + for z in actual: + assert r*(e-6)-k*(d-6)==16 + emitted_number=z.count + m=Measure(1-GAUSSIAN_C,1<<36,64*n.bit_length()) + expected=int(WEIGHTS[z.kind]*m.mass(lo,hi)[0]*shares[z.kind,r,child,k]) + assert emitted_number==expected>0 + metrics.append([z.kind,child,emitted_number]) +print('PASS_SHIFT_SIX_LOWER_BOUNDARY',json.dumps({'stages':contacts,'bad_shift_link':[e,d,-52], + 'validated_shift_six_suffix':16,'instantiated_typed_grants':metrics,'real_exterior_slots':plan.source_width})) diff --git a/research/p104-integrated-gaussian-suffix/source-view/check_successor_tiers.py b/research/p104-integrated-gaussian-suffix/source-view/check_successor_tiers.py new file mode 100644 index 0000000000..12672ab421 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/check_successor_tiers.py @@ -0,0 +1,52 @@ +"""Drive signed multiplication, caller dispatch, and both stage seams through this runtime.""" +from pathlib import Path +from fractions import Fraction as Q +from hashlib import sha256 +import runpy,sys + +root=Path(__file__).parent.resolve() +runtime=Path(sys.argv[1]).resolve() +sys.path.insert(0,str(runtime)) +from upstream import install +install() +from installations import ENTRY,TERMINAL,activation +from ordinary_carrier import stage_for_width_log +from staged_carriers import entrance_logs +from band_product import prepare_native,production_supplier +from grades import LOWER +assert LOWER==1054 +assert TERMINAL.rank_logs==(8358,132157,524288) +assert TERMINAL.kappa==Q('.003898216827298') and TERMINAL.complex_log==479787 +assert activation(TERMINAL)==1145064 +if sys.argv[2]=='product': + from io import BytesIO + from band_product import multiply,multiply_tapes + from check_product import physical_product + inputs=[(0,0),(-1,0),(-1,-1),(-741503,466013),(2**129-17,-(2**73)+3),(-(2**4096+9),2**41-1)] + for a,b in inputs:assert multiply(a,b)==a*b + for tier in (ENTRY,TERMINAL): + left=BytesIO(b'abc'+(741503).to_bytes(6,'little')+b'finish') + right=BytesIO(b'xyz'+(466013).to_bytes(5,'little')+b'end');out=BytesIO() + left.seek(3);right.seek(3) + sign,size=multiply_tapes(left,6,right,5,out,left_negative=True,profile=tier) + assert (sign,size,int.from_bytes(out.getvalue(),'little'))==(True,5,345550037539) + assert left.tell()==right.tell()==3 + recipe=production_supplier(tier.complex_log,tier.positive_stop_denominator).recipe + assert recipe.rank_log==tier.complex_log and recipe.ambient==306 and len(recipe.cells)==51 + witness=physical_product(ENTRY) + assert witness['product']=='-345550037539' and witness['coefficients_prefix']==[11811,10996,4152,868,77] + print('PASS_SIGNED_PRODUCTS_AND_DIRTY_RESTORE',len(inputs),witness) +else: + helper=runpy.run_path(str(root/'check_stage_seam.py')) + cuts=tuple(entrance_logs(TERMINAL.rank_logs)) + assert cuts==(8456,140677,665029) + for i,c in enumerate(cuts,1): + assert [stage_for_width_log(c+d,3,TERMINAL.rank_logs) for d in (-1,0,1)]==[i-1,i,i] + origins=prepare_native(TERMINAL) + assert all(r.level_floor==18960 for r in origins[:-1]) + census=helper['verify_stage'] + direct=[census(TERMINAL,cuts,2,150000),census(TERMINAL,cuts,3,680000)] + compiled=[census(TERMINAL,cuts,2,1200000),census(TERMINAL,cuts,3,4500000)] + assert all(x['direct'] for x in direct) and not any(x['direct'] for x in compiled) + tapes=[helper['verify_tape'](1,[0,1],[2,1]),helper['verify_tape'](2,[1,7],[3,1])] + print('PASS_STAGES_AND_WRONG_SIGN',cuts,direct,compiled,tapes) diff --git a/research/p104-integrated-gaussian-suffix/source-view/compose8073.py b/research/p104-integrated-gaussian-suffix/source-view/compose8073.py new file mode 100644 index 0000000000..5d1ff3151f --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/compose8073.py @@ -0,0 +1,63 @@ +"""Recreate the Gaussian successor from the live #8073 package, keeping the #8072 result intact.""" +from pathlib import Path +from shutil import copyfile +from hashlib import sha256,sha1 +import json,runpy,subprocess,sys + +parent=Path(__file__).resolve().parent +root=parent/'combined' +source=parent/'source8073' +root.mkdir(exist_ok=True) +provenance=json.loads((parent/'source-blobs.json').read_bytes()) +assert provenance['head']=='cf4c4b7ea4b746be174ee4ba4e49f03b5bc79f8e' and provenance['repository']=='CrocSwap/integer-mult-bounds' +files=provenance['files'] +assert len(files)==15 +for row in files: + if row['filename'].startswith('research/p104-weighted-k7-suffix/'): + name=Path(row['filename']).name + original=(parent if name=='peer8057.tar.gz' else source)/name + data=original.read_bytes() + assert sha1(f'blob {len(data)}\0'.encode()+data).hexdigest()==row['sha'] + copyfile(original,root/name) +# Restore all 88 peer inputs using the exact 8073 manifest, then materialize +# its own ordinary suffix implementation, including every retained negative. +peer=runpy.run_path(str(root/'verify.py'))['restore'](root/'peer') +runpy.run_path(str(root/'prepare.py'))['materialize'](peer) +subprocess.run([sys.executable,'-IB',str(peer/'bootstrap.py'),str(root/'runtime')],check=True) + +def adapt(file,edits=()): + data=(parent/file).read_text() + for old,new,n in edits: + if data.count(old)!=n:raise ValueError((file,old,data.count(old),n)) + data=data.replace(old,new) + (root/file).write_text(data) + +adapt('build_successor.py',[ + ('Profile((8192, 124649, 524288), 490950, Q(".003898214283192"))','Profile((8192, 117168, 524288), 501831, Q(".003898219753506"))',1), + ('Profile((8358, 132157, 524288), 479787, Q(".003898216827298"))','Profile((8192, 124612, 524288), 491002, Q(".003898222531555482"))',1), + ('cost == 318292011 and premium == 515','cost == 318291911 and premium == 517',1), + ('cost == 318291831 and premium == 514','cost == 318291611 and premium == 515',1), + ('(517115, 490950)','(516570, 501831)',1),('(517611, 479787)','(517112, 491002)',1), + ('Q(".00389821412325")','Q(".003898214283192")',1), + ('\'Q(".003898214283192")\')','\'Q(".003898219753506")\')',1), + ('Q(79971, 500000000000000)','Q(2735157, 500000000000000)',1), + ('Q(1272053, 500000000000000)','Q(1389024741, 500000000000000000)',1)]) +adapt('run_successor.py') +adapt('check_successor_cutoff.py') +adapt('check_six_ordinary.py') +adapt('check_corrupt_owner.py') +adapt('check_successor_tiers.py',[ + ('(8358,132157,524288)','(8192,124612,524288)',1), + (".003898216827298",".003898222531555482",1),("479787","491002",1),("1145064","1148568",1), + ("(8456,140677,665029)","(8290,132966,657318)",1)]) +adapt('certify_frontier.py',[ + ('strict_gain_over_8072_ceiling','strict_gain_over_8073_ceiling',1), + ('ORD_DEBIT = Q(11239, 8192)','ORD_DEBIT = Q(11204, 8192)',1), + ('OLD_UPPER = Q(523209464347189355219919950737,','OLD_UPPER = Q(523210198560303585338978849681,',1), + ('disclosed=Q(int(value*10**15),10**15)','disclosed=Q(int(value*10**18),10**18)',1), + ('"lower_decimal":dec(disclosed,15)','"lower_decimal":dec(disclosed,18)',1)]) +adapt('check_six_price.py',[ + ('.003898216827298','.003898222531555482',1),('f.CLOCK_CAP=318292011','f.CLOCK_CAP=318291911',1), + ('318291831','318291611',1),('hi==C-debit/479787-f.STOP','hi==f.ordinary(TERMINAL.rank_logs)-f.STOP',1), + ('.0000000025441059','.0000000027780494',1)]) +subprocess.run([sys.executable,'-IB',str(root/'build_successor.py')],check=True) diff --git a/research/p104-integrated-gaussian-suffix/source-view/replay_package.py b/research/p104-integrated-gaussian-suffix/source-view/replay_package.py new file mode 100644 index 0000000000..16d086d9d6 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/replay_package.py @@ -0,0 +1,36 @@ +"""Cold-build the signed #8073 six-column successor and run selected source scopes.""" +from argparse import ArgumentParser +from hashlib import sha256 +from datetime import datetime,timezone +from pathlib import Path +from shutil import copyfile,copytree +from subprocess import run +from tempfile import TemporaryDirectory +import json,sys + +root=Path(__file__).resolve().parent +cli=ArgumentParser() +cli.add_argument('--output',type=Path,required=True) +cli.add_argument('--scope',nargs='+',help='Run only these scopes; the default is every registered local scope.') +a=cli.parse_args() +out=a.output.resolve() +out.mkdir(exist_ok=False,parents=True) +inputs=json.loads((root/'BUNDLE-INPUTS.json').read_bytes()) +start=datetime.now(timezone.utc).isoformat() +with TemporaryDirectory(prefix='six-column-source-') as temp: + tree=Path(temp) + for name,pin in inputs.items(): + src=root/name;dest=tree/name + assert src.is_file() and sha256(src.read_bytes()).hexdigest()==pin + dest.parent.mkdir(exist_ok=True,parents=True);copyfile(src,dest) + run([sys.executable,'-IB',str(tree/'compose8073.py')],check=True) + candidate=tree/'combined' + call=run([sys.executable,'-IB',str(candidate/'run_successor.py'),*(a.scope or [])]) + logs=candidate/'successor/logs';copytree(logs,out/'logs') + copyfile(candidate/'successor/delta-pins.json',out/'delta-pins.json') + checks={p.stem:json.loads(p.read_bytes()) for p in sorted(logs.glob('*.json'))} + valid=call.returncode==0 and bool(checks) and all(r['code']==0 for r in checks.values()) + (out/'cold-result.json').write_text(json.dumps({'source_head':'cf4c4b7ea4b746be174ee4ba4e49f03b5bc79f8e', + 'started_at':start,'finished_at':datetime.now(timezone.utc).isoformat(),'python':sys.version, + 'verified_inputs':len(inputs),'scopes':checks,'pass':valid},indent=2)+'\n') + if not valid: raise SystemExit('Some verified source scopes failed. See the retained per-scope evidence.') diff --git a/research/p104-integrated-gaussian-suffix/source-view/run_successor.py b/research/p104-integrated-gaussian-suffix/source-view/run_successor.py new file mode 100644 index 0000000000..cc8aad841b --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/run_successor.py @@ -0,0 +1,48 @@ +"""Run each scientific scope against the installed candidate and record its actual exit.""" +from datetime import datetime,timezone +from pathlib import Path +from subprocess import run +from hashlib import sha256 +import json +import sys +import time +from shutil import copyfile + +root=Path(__file__).resolve().parent +candidate=root/'successor' +runtime=candidate/'runtime' +peer=candidate/'peer/research/frequency-weighted-native-multiplier' +log=candidate/'logs';log.mkdir(exist_ok=True) +scopes={ + 'invoice':[str(peer/'receipt.py'),str(runtime)], + 'independent_price':[str(root/'check_six_price.py'),str(runtime)], + 'placement':[str(peer/'check_placement.py'),str(runtime)], + 'calendar':[str(peer/'check_calendar.py'),str(runtime)], + 'ownership':[str(peer/'check_ownership.py'),str(runtime)], + 'exterior':[str(peer/'check_exterior.py'),str(runtime)], + 'nested':[str(peer/'check_nested.py'),str(runtime)], + 'raw':[str(peer/'check_raw.py'),str(runtime)], + 'product':[str(root/'check_successor_tiers.py'),str(runtime),'product'], + 'stages':[str(root/'check_successor_tiers.py'),str(runtime),'stages'], + 'cutoff':[str(root/'check_successor_cutoff.py'),str(runtime)], + 'corrupted_owner':[str(root/'check_corrupt_owner.py'),str(runtime)], + 'ordinary_floor':[str(root/'check_six_ordinary.py'),str(runtime)], + 'setup':[str(peer.parent/'tiered-native-multiplier/check_serial_setup.py')]} +stamp=lambda:datetime.now(timezone.utc).isoformat(timespec="microseconds") +failures=[] +for mode in sys.argv[1:] or list(scopes): + if (log/f'{mode}.json').exists(): + previous=json.loads((log/f'{mode}.json').read_bytes()) + attempt=log/'attempts'/previous['started_at'].replace(':','-') + attempt.mkdir(parents=True,exist_ok=True) + for ext in ('json','err','out'):copyfile(log/f'{mode}.{ext}',attempt/f'{mode}.{ext}') + start=stamp();tick=time.monotonic() + with (log/f'{mode}.out').open('wb') as stdout,(log/f'{mode}.err').open('wb') as stderr: + result=run([sys.executable,'-IB',*scopes[mode]],stdout=stdout,stderr=stderr) + end=stamp(); elapsed=time.monotonic()-tick + status=dict(mode=mode,code=result.returncode,started_at=start,finished_at=end,elapsed=elapsed, + output_sha256=sha256((log/f'{mode}.out').read_bytes()).hexdigest()) + (log/f'{mode}.json').write_text(json.dumps(status,indent=2)+'\n') + print(mode,result.returncode,round(elapsed,2),flush=True) + if result.returncode:failures.append(mode) +if failures:raise SystemExit("Failed scopes: "+", ".join(failures)) diff --git a/research/p104-integrated-gaussian-suffix/source-view/source-blobs.json b/research/p104-integrated-gaussian-suffix/source-view/source-blobs.json new file mode 100644 index 0000000000..fdac55de68 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/source-blobs.json @@ -0,0 +1,67 @@ +{ + "repository": "CrocSwap/integer-mult-bounds", + "pr": 8073, + "head": "cf4c4b7ea4b746be174ee4ba4e49f03b5bc79f8e", + "files": [ + { + "filename": "research/p104-weighted-k7-suffix/LICENSE", + "sha": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64" + }, + { + "filename": "research/p104-weighted-k7-suffix/NOTICE.md", + "sha": "bdad26a55c826d83a537a3fbd0792df9f832c827" + }, + { + "filename": "research/p104-weighted-k7-suffix/PEER-SOURCE.json", + "sha": "6f84b3aef4b8c5026e348d88700bc9401514ccab" + }, + { + "filename": "research/p104-weighted-k7-suffix/PROOF.md", + "sha": "f07cc28fb4ecb1fa6f90e2cdf6bc79b9be9b382c" + }, + { + "filename": "research/p104-weighted-k7-suffix/README.md", + "sha": "87f195f94e8a5ee6dd4b36c211f49dbb8301fea9" + }, + { + "filename": "research/p104-weighted-k7-suffix/RESULT.json", + "sha": "3c007c40f5a51efa32074a76e6491cb4decba3c5" + }, + { + "filename": "research/p104-weighted-k7-suffix/SOURCES.json", + "sha": "e7eefb9540eed783fdbdaae87f1f0128e13ca98f" + }, + { + "filename": "research/p104-weighted-k7-suffix/TASK.json", + "sha": "800c0b2e87bc8d00d02c389fe176ca61097c3aeb" + }, + { + "filename": "research/p104-weighted-k7-suffix/VERIFY.json", + "sha": "50f57c0e65f8412b951a9132e2df7f2f444c2991" + }, + { + "filename": "research/p104-weighted-k7-suffix/check_cutoff.py", + "sha": "da92c74e90d723b3a083967a714ea0386f0633cd" + }, + { + "filename": "research/p104-weighted-k7-suffix/check_ordinary_floor.py", + "sha": "bdc33865627facacc217055714e7e7c4accf967b" + }, + { + "filename": "research/p104-weighted-k7-suffix/check_stage_seam.py", + "sha": "8778b01f2d0cb7c79c980e8dc71b8a353d0d34d1" + }, + { + "filename": "research/p104-weighted-k7-suffix/peer8057.tar.gz", + "sha": "3a3ded828f6bbf9b6e6a76ba255d480452f4d269" + }, + { + "filename": "research/p104-weighted-k7-suffix/prepare.py", + "sha": "e03188e7ea9fca9c142640ba7242d7895b56ac85" + }, + { + "filename": "research/p104-weighted-k7-suffix/verify.py", + "sha": "bb337e17622a6c5bf659d7af18cc815c78772bbe" + } + ] +} diff --git a/research/p104-integrated-gaussian-suffix/source-view/source8073/LICENSE b/research/p104-integrated-gaussian-suffix/source-view/source8073/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/source8073/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-integrated-gaussian-suffix/source-view/source8073/NOTICE.md b/research/p104-integrated-gaussian-suffix/source-view/source8073/NOTICE.md new file mode 100644 index 0000000000..bdad26a55c --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/source8073/NOTICE.md @@ -0,0 +1,5 @@ +# Attribution + +Ali Romman supplied the #8042 matched-interval suffix derivation, #8057 weighted signed producer and caller, and the earlier #8055 serial setup proof. SYLforge supplied the #8052 K7 ordinary circuit and physical replay. #8066 contributes the prior ordinary price and #8067 the literal K7 floor and directed fringe calculation. #8070 supplies the Gaussian booking, #8071 the earlier K7 booking, and #8072 the exact fixed-booking allocation comparison. This package uses the K7-specific suffix bound in the complete charged envelope and allocates the resulting ordinary headroom. + +The archived source and notices retain their original license. The separate historical CI prerequisite reuses Jerry Chen's #7257 source navigation and snapshot repair. OpenAI Codex materially assisted arithmetic, implementation and independent verification. [Original suffix proof](https://github.com/aliromman/integer-mult-bounds/blob/dfd25d553a843a946ca0b94130a5ff8943e98fdd/research/retimed-native-multiplier/TRANSFER.md) · [Full predecessor credit](PROOF.md) · [License](LICENSE) diff --git a/research/p104-integrated-gaussian-suffix/source-view/source8073/PEER-SOURCE.json b/research/p104-integrated-gaussian-suffix/source-view/source8073/PEER-SOURCE.json new file mode 100644 index 0000000000..6f84b3aef4 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/source8073/PEER-SOURCE.json @@ -0,0 +1,94 @@ +{ + "archive_sha256": "0e0d559bdb15e7b647f88a2b5e27fcdc9e28e81d8f4145459876ba6da2e9314c", + "files_sha256": { + "research/frequency-weighted-native-multiplier/FINITE-LOSS.md": "12c6069437a0cbb61c80804f89f027ef9709c186e67d26fb0584ad6e71048052", + "research/frequency-weighted-native-multiplier/GaussianFiniteLoss.lean": "9d247f73d9da2748399b821612b30f20140783c08d761b6d4ef7d3c7c3d07064", + "research/frequency-weighted-native-multiplier/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "research/frequency-weighted-native-multiplier/MEASUREMENTS.json": "9ea26ae002146ae21291ecc0a6b224e5cccb9e3b5d199522558a645863da4f7b", + "research/frequency-weighted-native-multiplier/NOTICE.md": "02e69a1d57e2208ce49b3362a5672136887c1968d66de83a8f358e6d4a9353df", + "research/frequency-weighted-native-multiplier/PROOF.md": "4dbb38cdbe5b691edf4845fe8cf2a99be5d43455cc73199ab7e305abaa91acca", + "research/frequency-weighted-native-multiplier/README.md": "173313f895d9f810e5c32853ff383c8ee962e475dead35e5634047aa9c8a1453", + "research/frequency-weighted-native-multiplier/RESULT.json": "2f4faa6648592f589df22a8a0a07ba6856d20786294a44a7776c7d6e0efa14a5", + "research/frequency-weighted-native-multiplier/SOURCES.json": "01d9e6b6b28cd174800cadfb59f4f064b3844575da297d82e16eb19a0d11c868", + "research/frequency-weighted-native-multiplier/TASK.json": "9db85415d252a595907a8c1ddf8ce64acc5c0aa67dc8f6b4656139053bb40a52", + "research/frequency-weighted-native-multiplier/VERIFICATION.md": "58568a8f5e097a1d828aeff33ea33c63863c4b28dd1a87fd7dca9adebb5d6c1f", + "research/frequency-weighted-native-multiplier/VERIFY.json": "4f5506a41e62585e34c80c6838922d33b04d42e010fab310690f340a5be3721e", + "research/frequency-weighted-native-multiplier/WeightedNumerical.lean": "2017bae8064554efb13c564503d8f88c4615e9f733a74aa5eaf4047e5bd8af94", + "research/frequency-weighted-native-multiplier/bootstrap.py": "a824c0ba9bb5efe5ad5b6c9b891b363b6d2ac31b0a57b9e27b68a6c2bca6f7ee", + "research/frequency-weighted-native-multiplier/check_calendar.py": "1c51b8bd75ef2d9d8847b2ebf88d7dbcc44d89954146c2bdede8854915392b8c", + "research/frequency-weighted-native-multiplier/check_exterior.py": "aee4fd29eb2fa021f806c987e0db23ecb7148e5dc846581f62d3ba39ed7ef725", + "research/frequency-weighted-native-multiplier/check_lean.py": "32e49adef4502f193b5ded2cc4e7f8cea6a285283fda4db2152570a4b68098cb", + "research/frequency-weighted-native-multiplier/check_nested.py": "9b2eaf387abbeeef43dd9bb31081ba73f3423e8233fb3446d61fce802a1c6b5b", + "research/frequency-weighted-native-multiplier/check_ownership.py": "a1fdaf5eaaa4215bc90051db48e17d0bf9cf7fe03f67a4d2bdf4e328f3c1a73a", + "research/frequency-weighted-native-multiplier/check_placement.py": "e4317a1eb36f692912ca4739364859118711620838705d8e33b1eabec32b0990", + "research/frequency-weighted-native-multiplier/check_raw.py": "d62d50279969bfecf23d2e14412949fa643394c1539ccb87db7dac5f79e2d97e", + "research/frequency-weighted-native-multiplier/grades.py": "8d2e3d14ac2149f985d7f6a75bf36182d7f68aadf8df6595fc0774224d4951ac", + "research/frequency-weighted-native-multiplier/independent_price.py": "448811cdb4a2bdefd4f736c2bad81c2a833bde634bcf65498e05267b5ee7ead0", + "research/frequency-weighted-native-multiplier/measure_setup.py": "cbfe019024fbeee428c415549db10180af69995078825b6341bc9021f3d08723", + "research/frequency-weighted-native-multiplier/portable/EVIDENCE.json": "3bfffdda94bbc6a14282399eca69b8619c96bd587c7957b3bdf854e03ef89427", + "research/frequency-weighted-native-multiplier/portable/NOTICE.md": "57d7e187fb48df97838976a7942e41dc381f00daeff7c2b5c392fb1a6f252517", + "research/frequency-weighted-native-multiplier/portable/README.md": "141d07df12c9e5352a8f83a03a033dd2c41cc5d0d6e0edb3532cab462536a974", + "research/frequency-weighted-native-multiplier/portable/STACK-LOCALITY.md": "0211732aaa6083a305e861f8172b581b0a9c98e10191d8432d546ee224c0bf5f", + "research/frequency-weighted-native-multiplier/portable/TRACE-CLOCK.md": "9f2b0d125cc35f91bb037363505d027331c79153211ea21de838405ae01a1a2a", + "research/frequency-weighted-native-multiplier/portable/bounded_wasi.py": "8232cc247e5910aab7a0fecb03426088c8f851fd93cbf8fb3587a4a5d7ee143d", + "research/frequency-weighted-native-multiplier/portable/compare.py": "7a906b2b871011595f66882897e7ff0fa79f007fc7887ae0c21b555d778a75c8", + "research/frequency-weighted-native-multiplier/portable/compiler_state.py": "11f371903410a53aa138bb9b9c49e9441393a34092fff922716a78b5521e1870", + "research/frequency-weighted-native-multiplier/portable/consumer.py": "411cc1052a70f7084de81f6f1e54636737d5e5155d0756b8271d5d82c268d3b3", + "research/frequency-weighted-native-multiplier/portable/fixed_directory.py": "c99e9945295b954b453f4995474db4ec8da9e7d8d6ba1a564456213d066e5904", + "research/frequency-weighted-native-multiplier/portable/guest_opcodes.py": "9b2a1b128939cc8d2ef379199c09af74c52ed4b696640fce01606c431d931db6", + "research/frequency-weighted-native-multiplier/portable/module_census.py": "f22218fc37012f5c14b17afba3e8b868fd7268f25931836397f00fbdd319f6f7", + "research/frequency-weighted-native-multiplier/portable/producer.py": "5a76b94efb0bb59a686255f212b532a0f44a586649befda07dbfc5fe86c6a8b7", + "research/frequency-weighted-native-multiplier/portable/record_census.py": "8132c345cfcc5e7d89494fa437685673273f878f2dc40e0187bf2b84eee17e08", + "research/frequency-weighted-native-multiplier/portable/run.py": "6a1e17556326107cac9e70f446b2a90c35e9b4b07bfb7c4b31e5fe9b081f7d9b", + "research/frequency-weighted-native-multiplier/portable/signed.py": "7620e713be7a8064c5b9f83e6573cfabab801b627f0133b7998fdb51a6bac449", + "research/frequency-weighted-native-multiplier/portable/source_image.py": "e354c3fb2bb05eb36dc2438d89c30b18b7973638c51af526d8e55b56803c73ba", + "research/frequency-weighted-native-multiplier/portable/tape_directory.py": "70bf289334f724cabf1cfa9e074199e6be93ef0aeba8193f279e5ef1336de97b", + "research/frequency-weighted-native-multiplier/portable/verify_receipt.py": "8b42d3c5f35d6810321eb000e10b4e5593d543296cc670c3c8847e7051c1b30c", + "research/frequency-weighted-native-multiplier/positive_debit.py": "7320b6a4ef1320d765e9b41a9b1e286db83a1d36d96f46bee0bef37974e8b8d9", + "research/frequency-weighted-native-multiplier/receipt.py": "82d921fdc33006e2d356d8bf78f3c85777722322d716be44b42bc763a04c8095", + "research/frequency-weighted-native-multiplier/runtime.patch": "f35d37cc1746b5a7ac137a3f6de6de887a24f3af578283c24a64c8a25ccc584b", + "research/frequency-weighted-native-multiplier/typed_raw.py": "0c268432c9d48798c17d927f2d900b5e69dfc6585166cd71f253913e389c3b47", + "research/frequency-weighted-native-multiplier/typed_transport.py": "b76b9ad3dc0dd91473026c079585f830387eaa3c34c25a7820ee5057d5cbf941", + "research/frequency-weighted-native-multiplier/verify.py": "07730c6859c26de43b8621bf7e5b778187f41ac17419569ada7c6e10f5d04d4a", + "research/tiered-native-multiplier/CLOCK.md": "cf71e4a3216df23eb7e4fa8a8d9de3735e6257c65ca8a60a5085d9f3c90c4ecb", + "research/tiered-native-multiplier/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "research/tiered-native-multiplier/MEASUREMENTS.json": "a1083bc55178baf0015ef83ef169f45df61475fcc648f487e03c852c871f1f00", + "research/tiered-native-multiplier/NOTICE.md": "c386dabe3fd1d046bddc782c671219757c7708e9ec874a6ede55b540edc95f2c", + "research/tiered-native-multiplier/NUMERICAL.md": "14b86724db522393981ed54b540a35f27bd952f3d95d6e6d14c5b23896811dc9", + "research/tiered-native-multiplier/README.md": "d2c214591f03313dece24592cde3193deffb2f1057b891604597b5e8c6d020ca", + "research/tiered-native-multiplier/RESULT.json": "661e16fcb533b69b97ad2dc91ab81bed79c44e7fdce01306ce573cb6f0ed7fa7", + "research/tiered-native-multiplier/SERIAL-SETUP.md": "1ca7e23ae113647605a31fa309c3bbdde2baf2d442913247fcda4c8a1eef7e7c", + "research/tiered-native-multiplier/SETUP.md": "6951a98f2f8a0bf73c8d60b16ebbbd66bf87584251df8afbefe4e3a0330bfbf3", + "research/tiered-native-multiplier/SOURCES.json": "7a10012734132909e99b0c6160d68d0b8647e1607d25679efb1f5315cf8e23de", + "research/tiered-native-multiplier/ScaledEntrance.lean": "e404be78622db98e9c3b490a15d0e9f002a2cf1eee9ecbd0a9516efbd0db5329", + "research/tiered-native-multiplier/TASK.json": "2cfe7fe1ea4ee8cd07d24048d45e543fdb8a6fa6585ebdc20b1ede55982a16a7", + "research/tiered-native-multiplier/TierCost.lean": "668a248d1060dd4fe97a0edb6652cb3782b8ba4ccc0d00ec73ee6ae253eb9945", + "research/tiered-native-multiplier/VERIFICATION.md": "343f4b2de9b49c1536d35046eee086898bad48023b7da528c5096ca43a1358d0", + "research/tiered-native-multiplier/VERIFY.json": "c684d5b86039809900c85fb0ce64d531db23c62e06bfcf210d6b2cc349480492", + "research/tiered-native-multiplier/bootstrap.py": "74ac8f1d3af21f86cda48a3d50084d6fa5faf84b44ec2e5929b587f40f5bcfd1", + "research/tiered-native-multiplier/check_gaussian.py": "383a3385bc9763d6eb557163ee62aa9ab999b0d98c719a004db87abfee063d24", + "research/tiered-native-multiplier/check_lean.py": "0d53ee2a814887bb53e78f62f2d2e73544641f2cac470dbecec93cdb0aa17203", + "research/tiered-native-multiplier/check_phase_passes.py": "6afd65da931476680d88cb54336ffedf531c3063af181f75403d511e24e83b94", + "research/tiered-native-multiplier/check_placement.py": "d416329ba75727d8f968abc39caded0c1a1fd3f21ffc9286274c5b834aab7154", + "research/tiered-native-multiplier/check_serial_setup.py": "11d1c3209cb523a360ab9abaefb3122507fdf5cb469169890fe2dac636812c47", + "research/tiered-native-multiplier/grades.py": "340684fdd5ca0e611836b0e7301f1c339282ba532bf9e3ec8055944d8981f3c8", + "research/tiered-native-multiplier/independent_price.py": "0b2ecc4a1845a2807782644b6b2675e2fcb194fcbb3ae80b50af9a775363e952", + "research/tiered-native-multiplier/installations.py": "1c6978b8c7d136ef87191512d9ab9eb3dda8a818844244b96cb165d46d97b1df", + "research/tiered-native-multiplier/measure_setup.py": "896349b654c7b8195e9823beaee080d2d30b3f72a562de90c7b6e2554bdd20bb", + "research/tiered-native-multiplier/receipt.py": "3d0219eb2262ea64ccf2dc8da4d2877e32c519c4670d99577703f8bfc236ba61", + "research/tiered-native-multiplier/runtime.patch": "6c93961841be2abc3629928074e2c7917d264e94187276fc88a33f922a3c62e4", + "research/tiered-native-multiplier/serial_setup.py": "61b5058d394ed74e943303e4bdbf21d58ccf5d8bb39fc4b02e97bc135d7bdbbc", + "research/tiered-native-multiplier/source/INSTALLER-NOTICE.md": "c6b1753ad6ebda2a2143b1a9efc80fadad6c1b27552c3ec8bc7bfdb431fb8eeb", + "research/tiered-native-multiplier/source/K7-NOTICE.md": "9c5ae9750012d305d917e625d14a33cc880e810e801e73364725bcdc24bffdb5", + "research/tiered-native-multiplier/source/K7-STACK-LEDGER.json": "a0c0d5b241e6861a5c49a287617e48fba56b09824f5ef4fcb7f03152edf37e8e", + "research/tiered-native-multiplier/source/activation.py": "6e7f89d40a4d10ecd40a50e5b96334dfc64db90841ece7e3ef12eeca5ee5093b", + "research/tiered-native-multiplier/source/check_binary_k7.py": "5eeb8f818725249cbabf215c323c3f8351b1c4ed3c127119341e6ed09f490dd6", + "research/tiered-native-multiplier/source/installer.tar.gz": "6696459e2e3552f802e7caaaf93dc86c9bb6b62ee38631702bff2e3a8a9a481a", + "research/tiered-native-multiplier/source/ordinary_clock.py": "91dcf0ef72dddbde998b80f3d8b30c8036de9ce97e06e2bbd9c4159bf292020d", + "research/tiered-native-multiplier/source/outer_budget.py": "ca4438db28a447ed5c43d87d43f0ac10a0cb2b4e183342ac93139d517b9d4d02", + "research/tiered-native-multiplier/source/outer_clock.py": "63363c3da673365f3ac5e1b7e318c6938005f1e9c9896799504cc598efbf96fa", + "research/tiered-native-multiplier/source/strong-bit-k7.json.gz": "9e7392c52bcf29c0cc58c54c619f95c28f476394c33e8e0a5aa30c9557d31362", + "research/tiered-native-multiplier/verify.py": "d6cf9085e87743db14932a21cf895f8bd4d0f126b6c0bb7220d3255268dba39a" + }, + "head": "cbe847a953b971f9c6c5a0a6661e2008acd29086" +} diff --git a/research/p104-integrated-gaussian-suffix/source-view/source8073/PROOF.md b/research/p104-integrated-gaussian-suffix/source-view/source8073/PROOF.md new file mode 100644 index 0000000000..f07cc28fb4 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/source8073/PROOF.md @@ -0,0 +1,29 @@ +# Charged K7 suffix bound and exact height allocation + +The comparator is [#8072 at 75f7e1c](https://github.com/CrocSwap/integer-mult-bounds/commit/75f7e1c44f48c43983016bcf8878c4d9e5e87c62), κ 0.003898214283192. Its exact fixed-booking three-stage stopped ceiling is `523209464347189355219919950737/134217728000000000000000000000000`. The new installed target is 0.003898219753506, higher than that ceiling by `734213105999148080049263/134217728000000000000000000000000`. The signed words, source access, owner restoration, caller, compiler, fixed tape and precision, and analytic recovery remain under the same five assumptions. + +## Reprice one term in the all-size K7 invoice + +For the signed ordinary edge measure, write `t=1−c`, `Ψ=Σ π r ((k/r)^c−1)/c` and `V=N^6`. The continuous lower terminal count is `V L^c Ψ`. The pinned [#8042 suffix argument](https://github.com/aliromman/integer-mult-bounds/blob/dfd25d553a843a946ca0b94130a5ff8943e98fdd/research/retimed-native-multiplier/TRANSFER.md#price-of-the-complete-integer-plan) pays fewer than `10k` axes per matched interval and receiver. Its bound on the sum of births is `V/(t L^t)+2U`. Divide the product by the terminal count. The continuous term becomes `10 Σk/(t Ψ L)`, and the additive term is bounded by `20 U Σk/(V L^c Ψ)`. + +The unchanged K7 source has 18906 productive labels, 104652 paid labels, 24 exact transfer shares, and 286098 weighted target axes. At the unchanged floor 18960, downward directed powers give `Ψ>386067` and bound `10 Σk/(t Ψ)` by 7.439580926465596639, which is strictly below 8. The literal replay validates the K7 source, receiver-grade funding, and this bound. With `U≤N`, `Σk<2^25` and `L^c Ψ>1`, the additive term is below `2^30/N^5`. At the conservative scale `H=1024`, this, the inherited integer mass `2^46/N^4`, the delay end `2^20/N^4`, and the normalized grid enclosure are each below `2^-132`. All four decrease in the larger-size domain. Their sum fits the existing `δ=2^-128` allowance. The ordinary native stages start at or above height 3000. The exterior factor `1−10/L` stays in the denominator, as do the three independent `1−δ` losses. + +With that substitution, the same 47/20 child charge, the 375/376 contraction, and the factors `(256/255)(4097/4096)(1028/1024)(1024·134·L)^c` are preserved. This yields a directed complete factor below 2.580517225032310287. The `11204/8192` exponent supports the factor with reserve above 0.0000277614405947. The next smaller grid point `11203/8192` fails the directed envelope. The old `64/L` envelope also fails the new booking at the unchanged K7 floor. These are controls on the proof charge. Neither control removes an issued suffix, padding zero or receiver return. The historical 32768-floor witness is separately checked with its original coefficient 64. The Gaussian finite factor and booking `64939/524288` remain fixed. + +## Capped integer allocation + +The model permits three ordinary heights in [8192,524288], one Gaussian height in [1024,524288], and a complete recurring log₂ C cap of 318292011. The terminal portion imposes `1731+320Σb+220G≤318292011`. The selector, entry conversion and competing entry clock must also be included in the complete price. + +Under the new ordinary debit, the stopped rate is the minimum of the ordinary three-stage recurrence and the Gaussian rate, less `5·10^-18`. The two bounding sides meet between 501830 and 501831. At G=501831, the relaxed ordinary formula uses weights (1/62500,1/250,1) and the same 249/250 multiplier. At the funded heights (8192,117168,524288), its weighted reciprocal tangent slopes are strictly increasing. With the first height at its minimum and the third at its cap, any distinct integer alternative within the sum budget loses at least `(249/250)(11204/8192) min(a₂−a₁,a₃−a₂,a₂)`, with `a_i=w_i/b_i²`. This exceeds the loss from the two directed intermediate floors, and the clamps are inactive at the optimum. The same prior proof method and exact receipt reconstruct #8072's ceiling. At every G≤501830 Gaussian monotonicity bounds the rate below the new ordinary crossing. At every G≥501831 the ordinary feasible sets are nested under the decreasing sum budget. At G=501832 the optimal ordinary allocation fails the booked rate, and G=501830 fails Gaussian. + +The new exact stopped supremum is `523210198560303585338978849681/134217728000000000000000000000000`. The installed rate is strictly below it and strictly above #8072's ceiling. The proof covers the stated capped, fixed-booking model. Other stage counts, changed factors and different budgets have separate scopes. + +## Literal invoice and signed scopes + +The ordinary log₂ B term falls by 2393920 to 207887488. The Gaussian increase costs 2393820. Full recurring log₂ C, after the entry path and 517-bit conversion, is 318291911. The source verifies cuts (8290,125522,649874), first terminal header `2^1151953+4`, maximum native height 524288, and private envelope 536870915. Conservative fixed serial setup remains below 2^228. The calendar checks real placements, compiler seams, the full occupied K7 gallery, both dense signed widths and wrong-return controls. The raw, exterior, nested and product modes check both original signed job types and owner returns. The physical coefficient fixture uses entry, and the signed tier checks cover entry and terminal. + +External #8057 keeps the lower recurring bound 318259431, earlier activation `2^1146239+4`, 514-bit entry and its trace-specific portable setup bound below 2^113. That measured setup is for its own installation. + +## Predecessor credit + +Ali Romman supplied the [#8042 suffix price argument](https://github.com/CrocSwap/integer-mult-bounds/pull/8042), [#8057 signed producer and caller](https://github.com/CrocSwap/integer-mult-bounds/commit/cbe847a953b971f9c6c5a0a6661e2008acd29086), and [#8055 setup proof](https://github.com/CrocSwap/integer-mult-bounds/pull/8055). SYLforge supplied the [#8052 K7 word](https://github.com/CrocSwap/integer-mult-bounds/pull/8052). The Gaussian factor and band follow [#8059](https://github.com/CrocSwap/integer-mult-bounds/pull/8059), [#8063](https://github.com/CrocSwap/integer-mult-bounds/pull/8063), and [#8064](https://github.com/CrocSwap/integer-mult-bounds/pull/8064). [#8066](https://github.com/CrocSwap/integer-mult-bounds/pull/8066) supplies the earlier ordinary price and [#8067](https://github.com/CrocSwap/integer-mult-bounds/pull/8067) the literal K7 floor and fringe computation. [#8068](https://github.com/CrocSwap/integer-mult-bounds/pull/8068) and [#8069](https://github.com/CrocSwap/integer-mult-bounds/pull/8069) supply the allocation method. [#8070](https://github.com/CrocSwap/integer-mult-bounds/pull/8070), [#8071](https://github.com/CrocSwap/integer-mult-bounds/pull/8071), and #8072 supply the exact inherited bookings and comparison. This package integrates the K7-specific suffix term, separately charges the remaining errors and installs the newly funded profile. OpenAI Codex materially assisted mathematical analysis, implementation and independent replay. diff --git a/research/p104-integrated-gaussian-suffix/source-view/source8073/README.md b/research/p104-integrated-gaussian-suffix/source-view/source8073/README.md new file mode 100644 index 0000000000..87f195f94e --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/source8073/README.md @@ -0,0 +1,19 @@ +# K7 matched-interval suffix envelope + +The installed K7 edge measure bounds the ordinary matched-interval suffix by `8/L` at `L=18960`. This replaces the inherited `64/L` allowance while paying the same additive birth, rounding, delay, exterior, child, routing, tape, and owner charges. The directed finite factor supports ordinary debit `11204/8192 = 2801/2048`. + +The literal profile has ordinary heights `(8192,117168,524288)`, Gaussian height `501831`, and conditional κ **0.003898219753506**. This clears [#8072 at 75f7e1c](https://github.com/CrocSwap/integer-mult-bounds/commit/75f7e1c44f48c43983016bcf8878c4d9e5e87c62) and its exact fixed-booking ceiling. The same five all-size premises apply. [Full proof and scope](PROOF.md) · [Exact signed invoice](RESULT.json) + +The complete recurring log₂ C bound is `318291911`, down 100. The first terminal header increases to `2^1151953+4`, entry conversion uses `517` bits, maximum native height is `524288`, and conservative fixed serial setup stays below `2^228`. + +From a clean checkout with Git and CPython 3.12, run: + +```sh +python3.12 -IB scripts/research_package.py --package research/p104-weighted-k7-suffix +``` + +The seven scopes cover the all-size suffix envelope and full price, actual cutoff and signed calendar, both native widths, exterior and nonzero nested owner returns, signed multiplication, and fixed setup. The dense physical coefficient fixture uses entry. Both signed tier paths and their operand restoration pass. The old `64/L` envelope and next smaller grid booking are directed negative controls for this proof. + +## Open next questions + +A different charged mechanism is needed past the fixed-booking capped allocation ceiling. One first step is to trace the complete cost of a less conservative ordinary receiver tariff, including the larger geometric-series constant and every affected routing and tape cost. The changed whole invoice and a fully signed literal witness would still be required. diff --git a/research/p104-integrated-gaussian-suffix/source-view/source8073/RESULT.json b/research/p104-integrated-gaussian-suffix/source-view/source8073/RESULT.json new file mode 100644 index 0000000000..3c007c40f5 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/source8073/RESULT.json @@ -0,0 +1,164 @@ +{ + "gaussian": { + "trial": "17145637307/4398046511104", + "weights": [ + 5, + 451 + ], + "real_targets": [ + 52608, + 52608 + ], + "real_loans": [ + 282576, + 281568 + ], + "weighted_targets": 23989248, + "weighted_loans": 128400048, + "directed_margin": "50803612971593099397385261823/24054211488961849122338563785759685737032", + "grade_cells": 51, + "typed_cells": 88, + "min_individual_share": "13201304847172927608845459442008190307185393429462992684270298788700245/446899527904170582754959784023300718037811994769910427909046367785638460030016", + "raw_loss": "64939/524288", + "finite_loss": { + "debit": "64939/524288", + "lower_band": 1874, + "upper_divisor": 1724, + "upper_scale": 263772, + "weighted_target_axes": 677246016, + "fringe": "300731992641807409954152900460894657843980100197447844991422528204853688215668211247883423632270284604752185077356414542043393890337545630481656301358959888828355981951241689593827286554531764023654568347529813225106712890293586284680289053740956413663198622022741288872686911073141639043561572166225774226737375651730867714231632748200845305439465812618057473234626836722798539968620386933226322541365614201457553609508540907520/40998652557145365153577787818233506119327489237098584954932553603782941667327509819148832095776119788283977775227698549336954100742876813903063528104039112291940389981219697167286059833743913585059522030181548010907114060980452496905024992638705806327343517838194196675803432704863764890292566716043409145456310562043830007999021296818941849630656041093664580408951602143652307837028422076481339316972342955219795453538086660157", + "psi_lower": "196528460356108013065584708967148687972392697794117220125394104355372086010366606542449217521239834999009206019433102187561835223500075396212867927953038078146028126604276449605345572988764076884468002742889615261780056240261521573925165631337138206162400589950679046099745176101509603215174311312114837239511079100152490513829051957568916312720539057430685343839718380675727952080289328609539970012148651042973103501/212027723216171738655015418291315691930171701585846478416886436562775212486586983212322355388444219975411197039046656965050787909137586695566127693342552777136621038922867165426467082128728017241830358096991541437946776707047579988604740409036990911830949834156280840408836254185002070452924692391790866799710571899683191946248308330452444528644677074903772363841515125036664874592194483904694071022298595328", + "upper_factor": "4112243697849840234548804064697289853914924375243290693592243542706713349114623104047203272562204918756815711758635844272611802722873929737690204297647289581661713493504234159880094743047199461235856065945057732133058356459900609359502905713272216353756235021598520870771485197581311869155517057808276891056122412273784813574585738809098997550263587814688804425252109496659222385145373235990826871486847230813833279216700125721742902943576713800036676466696634668728258014860680188003533966770148448230236001502529338799520063545755897422039255263323042684943924703652916598587452339257344/3773923965282266513747974604230282638426723027200469326480397346733395274158191182519834017663989468623100318952688874082753380754101580927288415175678528090638530389513796429991056881963411394691730009663481869642059180706988709616208260822735709172264947981530780538139707968645397162412167355759416004214260083687748675153923661771211144056905947239691564895588903140831408079376585086523528984376960297659960203731557348566625467586938286862811479901536913588544968379268241162068339815360973443235710471898248742080872539822500617736919531163152253381291352968641643608978032108326875" + }, + "capacity_cut": { + "new": [ + "150211139120504027468885319479223039/324518553658426726783156020576256", + "18776392390063003433610665268820335/40564819207303340847894502572032" + ], + "90": [ + "160534949783530073773261795162075101/324518553658426726783156020576256", + "40133737445882518443315448932550083/81129638414606681695789005144064" + ], + "91": [ + "-491919194256701957600730157813641411/324518553658426726783156020576256", + "-122979798564175489400182539309808557/81129638414606681695789005144064" + ] + } + }, + "entry": { + "kappa": "69/20000", + "ordinary_H": [ + 3000, + 3080 + ], + "numerical_H": 1024, + "ordinary_rates": [ + "3431195539202864693/1000000000000000000000", + "690000000000001/200000000000000000" + ], + "gaussian_rate": "16613657019/4398046511104", + "signed": { + "strict": 54, + "functional": 4, + "smallest_margin": "1/10000000000000000000", + "ordinary_margin": "1/1000000000000000000", + "positive_margin": "1098935360482160957159/3355443200000000000000000" + }, + "stock": { + "binary_cuts": [ + 3077, + 6221 + ], + "public_exponent_A": 7437, + "first_public_offset": 4, + "initial_s": 7438, + "stage_and_outer_fixed_log_overhead": 1964, + "retimed_first_stripe_margin": 1701, + "retimed_all_size_margin_floor": 1635, + "absolute_log2_private_control_envelope": 3153922, + "storage_upper": "6.2 p T < 297.6 n bits" + }, + "geometry": { + "public_offset_above_2_to_A": 4, + "first_extent_bits_minus_b": -7433, + "last_extent_bits_minus_b": -7432, + "minimum_width": 3809536, + "log2_axis_count": 7412, + "largest_axis_width": 5592406, + "private_clock_log2_upper": 5734316302, + "actual_dense_root_entry_log2": 11184812 + }, + "binary_surcharges": [ + 0, + 25818582 + ], + "log2_B": 125433359, + "log2_C": 125660241 + }, + "terminal": { + "kappa": "1949109876753/500000000000000", + "ordinary_H": [ + 8192, + 117168, + 524288 + ], + "numerical_H": 501831, + "ordinary_rates": [ + "929744774750514757/250000000000000000000", + "1944256865196699369/500000000000000000000", + "779643950701201/200000000000000000" + ], + "gaussian_rate": "8603667567594205/2207076078713831424", + "signed": { + "strict": 54, + "functional": 4, + "smallest_margin": "1/10000000000000000000", + "ordinary_margin": "1/1000000000000000000", + "positive_margin": "46823865845862929/1683865416499200000000000000000" + }, + "stock": { + "binary_cuts": [ + 8290, + 125522, + 649874 + ], + "public_exponent_A": 1151953, + "first_public_offset": 4, + "initial_s": 1151954, + "stage_and_outer_fixed_log_overhead": 1968, + "retimed_first_stripe_margin": 573923, + "retimed_all_size_margin_floor": 556006, + "absolute_log2_private_control_envelope": 536870915, + "storage_upper": "6.2 p T < 297.6 n bits" + }, + "geometry": { + "public_offset_above_2_to_A": 4, + "first_extent_bits_minus_b": -1151949, + "last_extent_bits_minus_b": -1151948, + "minimum_width": 589801728, + "log2_axis_count": 1151921, + "largest_axis_width": 715827883, + "private_clock_log2_upper": 734188573650, + "actual_dense_root_entry_log2": 1431655766 + }, + "binary_surcharges": [], + "log2_B": 207887488, + "log2_C": 318291910 + }, + "previous_rate": "487276785399/125000000000000", + "rate_delta": "2735157/500000000000000", + "complete_log2_C": 318291911, + "ordinary_floor": 18960, + "ordinary_matched_suffix_coefficient": 8, + "ordinary_finite_debit": "2801/2048", + "ordinary_child_contraction": "375/376", + "entry_price_surcharge": 517, + "fixed_funding_height_floors": [ + 516570, + 501831 + ], + "log2_fixed_setup_upper": 228, + "native_setup_transition_upper": 217364570380528137475793294892811967875864032914108887556978854854656, + "native_setup_grade_actions": 269057152, + "max_native_H": 524288 +} diff --git a/research/p104-integrated-gaussian-suffix/source-view/source8073/SOURCES.json b/research/p104-integrated-gaussian-suffix/source-view/source8073/SOURCES.json new file mode 100644 index 0000000000..e7eefb9540 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/source8073/SOURCES.json @@ -0,0 +1,18 @@ +{ + "schema_version": 1, + "base_commit": "0618e75a22cec54d1651394ef83d088551b7f026", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + } + ] +} diff --git a/research/p104-integrated-gaussian-suffix/source-view/source8073/TASK.json b/research/p104-integrated-gaussian-suffix/source-view/source8073/TASK.json new file mode 100644 index 0000000000..800c0b2e87 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/source8073/TASK.json @@ -0,0 +1,107 @@ +{ + "schema_version": 1, + "task_id": "scalar-to-moment", + "priority_revision": 8, + "base_commit": "0618e75a22cec54d1651394ef83d088551b7f026", + "original_card": { + "id": "scalar-to-moment", + "question": "Can a scalar/frame rewrite improve the complete signed moment through paid jobs, productive targets, or both?", + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "docs/research/recursive-invoice-preflight.md" + ], + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "acceptance_gate": "Require a legal chronological rewrite and favorable complete signed target-minus-paid moment with all extra charges. Unchanged ADD counts or unchanged paid-call counts alone decide neither success nor failure. Compiler, native and outer admission remain separate obligations.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "first_experiment": "Construct one legal source-bound rewrite and compare complete before/after P and T. Charge restoration, source windows and owned helpers. A paid call need not disappear: a legal target split or rank redistribution may win. Stop if the signed moment is unchanged or the consumer repays the gain. Do not extend a scalar-only census on ADD counts.", + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "overlap_terms": [ + "signed moment", + "target split", + "rank exchange", + "scalar rewrite" + ], + "existing_checks": [ + { + "scope": "PR #3998: consecutive A2 scalar contraction", + "evidence": "research/staged544-a2-graph-rewrite/README.md", + "remaining": "A genuinely changed paid itinerary or a distinct independent audit; no default scalar-only expansion.", + "status": "author-checked", + "source_commit": "389268a6b5e0373a3125d5c6fcd6995f4ea324f5", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4019: separated A2 sites with unchanged recursive histogram", + "evidence": "research/staged544-separated-a2/README.md", + "remaining": "A genuinely changed paid itinerary or a distinct independent audit; no default scalar-only expansion.", + "status": "author-checked", + "source_commit": "f408e09df300b575235f7f77f81948071397e16d", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4112: composition audit", + "evidence": "research/staged544-a2-composition-audit/README.md", + "remaining": "A genuinely changed paid itinerary or a distinct independent audit; no default scalar-only expansion.", + "status": "author-checked", + "source_commit": "205b7380656ba4b6316a8a493b1a3c679b8f7a0e", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4152: A1858 contraction audit", + "evidence": "research/staged544-a1858-contraction-audit/README.md", + "remaining": "A genuinely changed paid itinerary or a distinct independent audit; no default scalar-only expansion.", + "status": "author-checked", + "source_commit": "caaa14cde5962adc372fdca71f63d0f29e73c8b2", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "status": "reviewed", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + } + ] + }, + "scope_status": "refined", + "actual_scope": "One tighter all-size K7 matched-interval suffix bound and one literal capped height profile with the same signed words.", + "scope_change_reason": "The actual K7 directed edge sum proves a suffix coefficient below eight, keeping every other ordinary cost in the envelope.", + "bottleneck_link": "The changed charged K7 suffix opens a higher funded Gaussian height before the ordinary and Gaussian crossing.", + "budget_minutes": 60, + "stop_rule": "One saved 30-second gate, then bounded prices and exact adjacent checks under the #8072 clock cap, then only (8192,117168,524288;501831) at \u03ba=.003898219753506 in the seven registered scopes.", + "outcome": "completed", + "evidence": "Source-bound all-size K7 suffix and separate error charges, exact cap crossing, predecessor and adjacent negative controls, actual signed replay.", + "author": "Campaign contributor", + "ai_assistance": "OpenAI Codex assisted proof checking, exact pricing, literal profile retune and independent verification.", + "open_questions": [ + { + "question": "Can a different fully charged ordinary receiver term move the rate past this capped allocation?", + "why_it_matters": "The proved fixed cost model reaches its cap. A new source inequality must account for all direct and recursive work.", + "first_step": "Price one existing exact ordinary provider proof or paid receiver change against the current signed invoice.", + "blocked_by": "Charge all caller, owner returns, fixed setup, precision and tape costs before building." + } + ] +} diff --git a/research/p104-integrated-gaussian-suffix/source-view/source8073/VERIFY.json b/research/p104-integrated-gaussian-suffix/source-view/source8073/VERIFY.json new file mode 100644 index 0000000000..50f57c0e65 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/source8073/VERIFY.json @@ -0,0 +1,94 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/p104-weighted-k7-suffix/PEER-SOURCE.json", + "research/p104-weighted-k7-suffix/peer8057.tar.gz", + "research/p104-weighted-k7-suffix/prepare.py", + "research/p104-weighted-k7-suffix/RESULT.json", + "research/p104-weighted-k7-suffix/check_cutoff.py", + "research/p104-weighted-k7-suffix/check_stage_seam.py", + "research/p104-weighted-k7-suffix/check_ordinary_floor.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "price" + ], + "timeout_seconds": 140, + "checks": "Check the 8/L directed K7 suffix envelope, adjacent and prior-envelope booking controls, unchanged Gaussian factor, signed placement and complete invoice." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "calendar" + ], + "timeout_seconds": 160, + "checks": "Check the actual K7 matched-interval census and all-size error envelope, previous and adjacent profiles, exact capped crossing, seams and signed restoration." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "raw" + ], + "timeout_seconds": 170, + "checks": "Execute both nonzero signed native jobs and restore all physical owners." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "exterior" + ], + "timeout_seconds": 190, + "checks": "Generate the first exterior births and return all owners through the actual signed words." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "nested" + ], + "timeout_seconds": 200, + "checks": "Carry the actual nonzero cross-type nested loan and verify both owner returns." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "product" + ], + "timeout_seconds": 220, + "checks": "Execute the exact signed product and independently verify coefficients and restoration." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "setup" + ], + "timeout_seconds": 90, + "checks": "Check canonical serial division, B\u00e9zout, rational arithmetic and the conservative fixed native setup tape bound." + } + ] +} diff --git a/research/p104-integrated-gaussian-suffix/source-view/source8073/check_cutoff.py b/research/p104-integrated-gaussian-suffix/source-view/source8073/check_cutoff.py new file mode 100644 index 0000000000..da92c74e90 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/source8073/check_cutoff.py @@ -0,0 +1,75 @@ +"""Check the literal upper fence, integer cutoff births and timed returns.""" +from fractions import Fraction as Q +from pathlib import Path +import sys + +sys.path.insert(0, str(Path(sys.argv[1]).resolve())) +from upstream import install + +install() +import grades +from grades import LOWER, SCALES, UPPER_DIVISOR, WEIGHTS, numerical_recipe +from installations import ENTRY, GAUSSIAN_C, TERMINAL +from transport import Measure, ceil +from typed_transport import NativeType, TypedPlan, column_header + +assert LOWER == 1874 and SCALES == (1, 2) and WEIGHTS == (5, 451) +assert UPPER_DIVISOR == 1724 + + +def verify_constructor_call(height): + recipe = numerical_recipe(height) + carrier = 1 << height + + def verify(n, types, cells, t, lower, upper, volume, ticks, rounds, **options): + assert (n, lower, t) == (carrier, LOWER, 1-GAUSSIAN_C) + assert upper == 2 * (carrier // (1724 * 306)) + assert upper > 2 * (carrier // (2048 * 306)) + assert upper % 2 == 0 and 4*258*(upper-8) < n + assert len(cells) == 88 and tuple(word.multiplicity for word in types) == WEIGHTS + assert (volume, ticks, rounds) == (carrier**6, carrier**82, carrier**2) + assert options == {"width": 1 << (92*height), "delay_base": 1 << 19} + return True + + original = grades.TypedPlan + try: + grades.TypedPlan = verify + assert recipe.open() + finally: + grades.TypedPlan = original + + +heights = (ENTRY.complex_log, TERMINAL.complex_log) +assert heights == (1024, 501831) +for height in heights: + verify_constructor_call(height) +print("PASS_LITERAL_UPPER_FENCE", UPPER_DIVISOR, LOWER, heights, flush=True) + +for band, expected in ((LOWER, (2, 0)), (LOWER+2, (0, 0))): + widths = [] + for kind, scale in enumerate(SCALES): + header = column_header(band-8, kind) + assert header % 2 == kind and header - kind == band-8 + widths.append((header-kind)*scale) + assert tuple(width % 4 for width in widths) == expected +assert (LOWER-8, 2*(LOWER-8)) == (1866,3732) + +native = tuple(NativeType((2,), (1,), weight) for weight in WEIGHTS) +shares = {(a,1,b,2):Q(w,sum(WEIGHTS)) for a in range(2) for b,w in enumerate(WEIGHTS)} +t = 1-GAUSSIAN_C +n, volume = 65536, 2**29 +plan = TypedPlan(n, native, shares, t, LOWER, 4126, volume, 3, 16, delay_base=3, padding=1) +mass = Measure(t, volume, 64*n.bit_length()) +assert plan.bands.start == LOWER and (LOWER-2,0) not in plan.count +for band in plan.bands: + for kind, weight in enumerate(WEIGHTS): + assert plan.count[band,kind] == ceil(weight * mass.mass(band,band+2)[1]) +assert {(a,link.kind) for (_,a,_),ls in plan.send.items() for link in ls} == {(0,0),(0,1),(1,0),(1,1)} +grants = [] +for recipient in range(2): + for link in plan.receive[LOWER,recipient,0]: + assert link.band in (2*LOWER,2*LOWER+2) and plan.delay[LOWER] < plan.delay[link.band] + assert link.count > 0 + grants.append((recipient,link.kind,link.band,link.count)) +assert len(grants) == 8 and plan.source_width > 0 and plan.leaves_per_epoch > 0 +print('PASS_LITERAL_LOWER_CUTOFF', LOWER, (1866,3732), grants, plan.leaves_per_epoch, flush=True) diff --git a/research/p104-integrated-gaussian-suffix/source-view/source8073/check_ordinary_floor.py b/research/p104-integrated-gaussian-suffix/source-view/source8073/check_ordinary_floor.py new file mode 100644 index 0000000000..bdc3386562 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/source8073/check_ordinary_floor.py @@ -0,0 +1,221 @@ +"""Check the actual ordinary floor and fully charged occupied-edge calendar.""" +from collections import Counter +from fractions import Fraction as Q +from hashlib import sha256 +import json +from pathlib import Path +import sys + +RUNTIME=Path(sys.argv[1]).resolve() +sys.path.insert(0,str(RUNTIME)) +from upstream import install + +install() +LOWER=18960 + + +def ceil(x): + return -(-x.numerator//x.denominator) + + +def all_size_stock(word, c, intervals, unit): + """Discharge the parameterized TRANSFER.md hypotheses at the new floor.""" + t = 1-c + targets, paid = Counter(word.targets), Counter(word.paid) + assert max(targets) <= 134 and min(paid) >= 1 + assert all(5*r <= 4*k for r,k in word.cells) + assert all(sum(p for (u,k),p in word.cells.items() if u==r)==1 for r in paid) + # Check actual directed per-receiving-label funding and the whole raw margin. + t_lower = {k: intervals(k,t)[0] for k in targets} + p_upper = {r: intervals(r,t)[1] for r in paid} + t_hi = sum(n*intervals(k,t)[1] for k,n in targets.items()) + p_lo = sum(n*intervals(r,t)[0] for r,n in paid.items()) + assert sum(targets[k]*v for k,v in t_lower.items())>sum(paid[r]*v for r,v in p_upper.items()) + assert 100*p_lo>99*t_hi + for k,n in targets.items(): + load=sum(paid[r]*p*p_upper[r] for (r,s),p in word.cells.items() if s==k) + assert 01 + + # Check the smallest admitted numerical scale; every margin below grows + # with N. Actual binary native stages start no earlier than H=3000. + H=1024 + N=1<=(1-delta)*N + assert Q(6,5)**4>2 and Q(6,5)**73>2**19 + assert len(word.paid)<2**19 + assert 2**19*Q(1,1024*ambient*LOWER)**77+Q(1,N**77)<1 + lower_power=Q(intervals(LOWER,t)[0],unit) + assert lower_power>1024 and Q(1,t*lower_power)+Q(2,N**5)<2 + # Endpoint inverse bases are >1/(512N) through all roots. The + # original 61-stage envelope costs 397+30.5H bits per endpoint. + assert c.denominator.bit_length()-1<=60 and Q(1,N)-Q(1,2**(64*(H+1)))>Q(1,512*N) + grid_error_bits=397+31*H+6*H+3-64*(H+1) + assert grid_error_bits<-132 + # Time and integer errors are already normalized conservatively without + # the L**c*psi denominator, which is strictly greater than one. + assert c>0 and 1=1024. + assert suffix_birth_error1 + assert (1-Q(1,N))/Q(257,256)>Q(1,2) + return {"fringe_upper_1e9":ceil(fringe*10**9),"psi_lower_floor":int(psi), + "grid_absolute_error_exponent_at_H1024":grid_error_bits, + "suffix_target_axes":target_axes, + "suffix_birth_error_upper_at_H1024":"2^30/N^5", + "normalized_error_allowance":"2^-128", + "birth_bound":"2V","copy_group_bound":"3N^3","whole_field_width":"N^92", + "first_two_columns":[LOWER-8,LOWER-6],"minimum_positive_scale_h_guard":1024} + + +def bound_recipe(old, lower): + """Pass the proposed literal cutoff through the installed Recipe.open seam.""" + import transport + + assert old.level_floor==lower + N=1<=0 and sender in live + closes+=1 + assert not live and not pending and not any(held.values()) and opens==closes + assert axes==plan.leaves_per_epoch and len(first_counts)==2 + return {"tested_occupied_K7_grade":[r,k],"lower":LOWER,"upper":hi,"carrier":n, + "first_band_contacts":contacts,"native_opens":opens,"native_closes":closes, + "returned_paid_prefixes":loans,"paid_singletons":axes, + "lower_return_counts":dict(first_counts),"extent":"complete fixture event stream"} + + +def check(): + from band_product import prepare_native + from installations import BINARY_C, ENTRY, TERMINAL + from raw_binary_stage import binary_word + from strict_moment import UNIT + from unpowered_price import intervals + + stage=(RUNTIME/"raw_binary_stage.py").read_bytes() + assert sha256(stage).hexdigest()=="e24bd735598d278dbd46cada584a63da01796d77ad557a45b80a4dfc7bbbd0b0" + assert TERMINAL.rank_logs==(8192,117168,524288) and TERMINAL.complex_log==501831 + word=binary_word() + assert (len(word.targets),len(word.paid),len(word.cells))==(18906,104652,24) + a,b=prepare_native() + ordinary=(*a[:-1],*b[:-1]) + assert tuple(recipe.rank_log for recipe in ordinary)==(*ENTRY.rank_logs,*TERMINAL.rank_logs) + assert (a[-1].rank_log,b[-1].rank_log)==(1024,501831) + openings=[bound_recipe(recipe,LOWER) for recipe in ordinary] + stock=all_size_stock(word,BINARY_C,intervals,UNIT) + finite=finite_plan(word,BINARY_C) + assert finite["tested_occupied_K7_grade"]==[49,64] + assert finite["native_opens"]==323165 and finite["returned_paid_prefixes"]==432 + assert finite["paid_singletons"]==683705746532 + print("PASS_LITERAL_ORDINARY_FLOOR",json.dumps( + {"new_binary_openings":openings,"binary_all_size":stock,"binary_integer_fixture":finite}, + sort_keys=True),flush=True) + + +if __name__=="__main__": + check() diff --git a/research/p104-integrated-gaussian-suffix/source-view/source8073/check_stage_seam.py b/research/p104-integrated-gaussian-suffix/source-view/source8073/check_stage_seam.py new file mode 100644 index 0000000000..8778b01f2d --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/source8073/check_stage_seam.py @@ -0,0 +1,271 @@ +"""Replay literal ordinary dispatch and bounded signed bank returns.""" +from dataclasses import replace +from fractions import Fraction as Q +from hashlib import sha256 +from io import BytesIO +from itertools import product +import json +from pathlib import Path +import sys + +RUNTIME = Path(sys.argv[1]).resolve() +sys.path.insert(0, str(RUNTIME)) +from upstream import install + +install() + + +class DyadicWidth(int): + """Speed up exact exponentiation of a mathematically dyadic test width.""" + def __pow__(self, exponent): + assert self.bit_count() == 1 and exponent >= 0 + return 1 << ((self.bit_length() - 1) * exponent) + + +def verify_stage(profile, cuts, number, log_width): + import ordinary_carrier as carrier + + calls = [] + base = DyadicWidth(1 << log_width) + prev = 1 << cuts[number-2] + power = 1 << (log_width//250) + assert log_width % 10000 == 0 + width = max(prev+1, power) + component = 1 << (39*log_width//10000) + count = -(-width//component) + short, longer = divmod(width,count) + expected_layout = (longer, short+1, count-longer, short) + rank = 1 << profile.rank_logs[number-1] + expect_direct = -(-base//width) <= 1 << (8*profile.rank_logs[number-1]) + + def root(value, degree): + assert value.bit_count() == 1 + quotient, remainder = divmod(value.bit_length()-1,degree) + assert not remainder + return 1 << quotient + + def receiver(dimension, layout, previous, *, direct, profile): + assert dimension == rank and layout == expected_layout and direct == expect_direct + assert previous.func is carrier.ternary + assert previous.keywords == {"maximum": number-1, "profile": profile} + return number + + def body(source,target,digits,prefix,gap,suffix,backend): + assert digits==base and (prefix,gap,suffix)==(1,3,5) and backend==number + calls.append((digits.bit_length()-1,backend)) + + actual = carrier.ceil_root, carrier.Receiver, carrier.root_body + try: + carrier.ceil_root, carrier.Receiver, carrier.root_body = root, receiver, body + carrier.ternary(None,None,base,1,3,5,maximum=number,profile=profile) + finally: + carrier.ceil_root, carrier.Receiver, carrier.root_body = actual + assert calls == [(log_width,number)] + return {"stage":number,"scanned_log":log_width,"rank_log":rank.bit_length()-1, + "predecessor_cut":cuts[number-2],"direct":expect_direct, + "component_log":component.bit_length()-1} + + +def verify_tape(width, u, v): + from five_exchange import same_order_line + from growing_binary import Weighted + from same_order_body import SameOrderBody + from streaming_routes import cold_swap_tape + from ternary_leaf import select_pivot + + class Core(SameOrderBody, Weighted): + def __init__(self): + super().__init__(2,(1,width,0,0),cold_swap_tape) + self.stock=self.owners + self.calls=0 + + def weighted(self,*args,**kwargs): + assert kwargs["atoms"]==10 + + # The two adjacent heights bound the full capped three-stage family. + # The Gaussian rate is increasing, and the upper ordinary feasible sets + # are nested as the Gaussian height consumes more of the common clock. + height=TERMINAL.complex_log + ranks=TERMINAL.rank_logs + assert ranks==capped_shape(height,cap)==capped_shape(height,318291911) + assert capped_shape(height-1,cap)==(8192,117169,524288) + assert capped_shape(height+1,cap)==(8192,117167,524288) + new_ordinary=integer_optimum(ranks,debit) + new_gaussian=positive(height) + assert positive(height-1)0 + assert 1731+320*sum(ranks)+220*height==318291911 + underfunded=booked-positive(height-1) + overfunded=booked-integer_optimum(capped_shape(height+1,cap),debit) + assert underfunded==Q(11162322984731929,24055172300800000000000000000)>0 + assert overfunded==Q(53263651314258553967,134217728000000000000000000000000)>0 + prior_booking_shortfall=booked-upper(ranks,prior_debit,True) + assert prior_booking_shortfall>0 + + smaller=Q(".00389821057")+stop-upper((8192,129407,524402),Q(11,8)) + assert smaller==Q(949618999849667259182401851,233169615645211570995200000000000000000) + historical=Q(".00389821126")+stop-upper((8192,129406,523443),Q(703,512)) + assert historical==Q(131786329075081068292016650499,77580469414725995724800000000000000000) + prior_gaussian_debit=Q(".0038982141226643")+stop-(GAUSSIAN_C-Q(64944,524288*prior_height)) + assert prior_gaussian_debit==Q(5290830738777425573,274384656793600000000000000000)>0 + historical_ordinary_shortfall=historical_booked-upper(historical_profile,historical_debit,True) + assert historical_ordinary_shortfall==Q(25132665927681050851,26843545600000000000000000000000)>0 + historical_height_shortfall=historical_booked-positive(prior_height) + assert historical_height_shortfall==Q(354613496784311279,823153970380800000000000000000)>0 + + profiles=[] + for p,expected in ((baseline,(8290,133003,657355)),(TERMINAL,(8290,125522,649874))): + cuts=tuple(entrance_logs(p.rank_logs)) + assert cuts==expected + for i,c in enumerate(cuts,1): + assert [stage_for_width_log(c+d,3,p.rank_logs) for d in (-1,0,1)]==[i-1,i,i] + assert stage_for_width_log(c+1,i-1,p.rank_logs)==i-1 + direct=[verify_stage(p,cuts,2,140000),verify_stage(p,cuts,3,670000)] + compiled=[verify_stage(p,cuts,2,1100000),verify_stage(p,cuts,3,4400000)] + assert all(s["direct"] for s in direct) and not any(s["direct"] for s in compiled) + profiles.append({"ranks":p.rank_logs,"cuts":cuts,"direct":direct,"compiled":compiled}) + tape=[verify_tape(1,[0,1],[2,1]),verify_tape(2,[1,7],[3,1])] + print("PASS_LITERAL_K7_SUFFIX",json.dumps( + {"historical_ordinary_negative_gap":str(historical),"seven_level_negative_gap":str(smaller), + "historical_gaussian_negative_gap":str(prior_gaussian_debit), + "historical_debit_shortfall":str(historical_ordinary_shortfall), + "historical_height_shortfall":str(historical_height_shortfall), + "lower_adjacent_gaussian_shortfall":str(underfunded), + "higher_adjacent_ordinary_shortfall":str(overfunded), + "prior_ordinary_booking_shortfall":str(prior_booking_shortfall), + "candidate_ordinary_slack":str(new_ordinary-booked),"candidate_gaussian_slack":str(new_gaussian-booked), + "new_family_ceiling":str(family_ceiling),"comparator_family_ceiling":str(comparator_ceiling), + "prior_family_ceiling":str(prior_family_ceiling),"stage_seams":profiles,"signed_tape":tape}, + sort_keys=True),flush=True) + + +if __name__=="__main__": + check() diff --git a/research/p104-integrated-gaussian-suffix/source-view/source8073/prepare.py b/research/p104-integrated-gaussian-suffix/source-view/source8073/prepare.py new file mode 100644 index 0000000000..e03188e7ea --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/source8073/prepare.py @@ -0,0 +1,266 @@ +"""Install the K7 matched-suffix bound on the exact weighted producer.""" +from hashlib import sha256 +import json + +NEW_INSTALLATION = "fafc53956d3194d625e3acd87f6b46c81c55b87b3e7e4269b9256dd6c701ea4f" +RAW_FLOOR_IMAGES = { + "before": "0c805a525322acf4eb03f083c2c763f3046c3d488e1f993beb484a3e2c2ff4a9", + "after": "e24bd735598d278dbd46cada584a63da01796d77ad557a45b80a4dfc7bbbd0b0", +} +RAW_FLOOR_PATCH = """--- a/raw_binary_stage.py ++++ b/raw_binary_stage.py +@@ -45,7 +45,7 @@ + @cache + def binary_recipe(height): + word = binary_word() +- return Recipe(height, word.tagged.ambient, word.targets, word.paid, word.cells, BINARY_C) ++ return Recipe(height, word.tagged.ambient, word.targets, word.paid, word.cells, BINARY_C, level_floor=18960) +""" + " \n \n def run(recipe, fields, machine):\n" + + +def replace(path, replacements): + source = path.read_text() + for old, new in replacements: + if source.count(old) != 1: + raise ValueError(f"Expected one change point for {old!r} in {path.name}") + source = source.replace(old, new) + path.write_text(source) + + +OLD_EDGE = ''' # The first three positive terms of log(k/r) suffice for each real edge. + psi = Q(0) + for (r, k), share in cells.items(): + u = Q(k - r, k + r) + log_lower = 2 * (u + u**3 / 3 + u**5 / 5) + psi += paid[r] * share * r * log_lower''' + +DIRECTED_EDGE = ''' # Integrate each exact directed edge, retaining both rounding ends. + # A downward ratio of outward powers bounds ((k/r)^c-1)/c. + psi = Q(0) + for (r, k), share in cells.items(): + floor = intervals(k, c)[0] * UNIT // intervals(r, c)[1] + assert floor > UNIT + psi += paid[r] * share * r * (Q(floor, UNIT) - 1) / c''' + +NATIVE_SETUP = ''' setup = native_clock() + grade_count = len(low[-1].paid.histogram) + len(low[-1].targets.histogram) + actual_roles = sum(len(v.targets) + len(v.paid) for v in high[-1].types()) + assert actual_roles < 2**20 and grade_count < 2**8 + assert len(low) + len(high) == 7 and max(heights[-1].bit_length() for heights in (ENTRY.rank_logs, TERMINAL.rank_logs)) <= 20 + grade_actions = 2**20 * 256 + 2**8 * 256 * 8 + 32 * (grade_count + 2)**2 + 2**12 + assert grade_actions < 2**32 and setup["all_setup"] < 2**228''' + +DIRECTED_ORDINARY = '''def ordinary_debit(): + delta = Q(1, 2**128) + def bounds(floor, suffix): + multiplier = ( + Q(47, 20) * Q(256, 255) * Q(4097, 4096) * Q(1028, 1024) + * (1 + Q(suffix, floor) + delta) / ((1 - Q(10, floor)) * (1 - delta)**3) + ) + lo, hi = powers(1024 * 134 * floor, BINARY_C) + return multiplier * lo, multiplier * hi + + lo, hi = bounds(18960, 8) + prior_lo, prior_hi = bounds(18960, 64) + old_lo, old_hi = bounds(32768, 64) + allowance_lo, allowance_hi = (2 * end for end in powers(2, Q(3012, 8192))) + finer_allowance = 2 * powers(2, Q(3011, 8192))[1] + assert allowance_lo - hi > Q("0.0000277614405947") + assert lo - finer_allowance > Q("0.000190576182764755") + assert prior_lo > allowance_hi + assert 2 * powers(2, Q(3047, 8192))[0] - prior_hi > Q("0.000062662376093595") + assert prior_lo - 2 * powers(2, Q(6093, 16384))[1] > Q("0.000046832527238212") + assert prior_hi**1024 < 2**1405 < old_lo**1024 + assert old_hi**512 < 2**703 + assert Q(75, 32) / Q(47, 20) == Q(375, 376) + print("PASS_DIRECTED_ORDINARY_DEBIT", 18960, "11204/8192", "375/376", "8/L") + + +''' + +EDITS = { + "runtime.patch": ( + ('TERMINAL = Profile((8192, 129414, 524288), 483871, Q(".00389821"))', + 'TERMINAL = Profile((8192, 117168, 524288), 501831, Q(".003898219753506"))'), + ), + "positive_debit.py": ( + ("from strict_moment import UNIT, power_interval", "from strict_moment import UNIT, power_interval\nfrom unpowered_price import intervals"), + ("POSITIVE_DEBIT = Q(65081, 524288)", "POSITIVE_DEBIT = Q(64939, 524288)"), + (OLD_EDGE, DIRECTED_EDGE), + ("assert psi > Q(1790217668064, 10000)", 'assert psi > Q("926899828.8291")'), + ("assert fringe < Q(7579, 1000)", 'assert fringe < Q("7.335168")'), + ), + "receipt.py": ( + ('sys.path.append(str(HERE / "portable"))', 'sys.path.append(str(HERE.parent / "tiered-native-multiplier"))'), + ("from verify_receipt import verify as fixed_installation", "from check_serial_setup import clock as native_clock"), + ("DEBIT = Q(65081, 2**19)", "DEBIT = Q(64939, 2**19)\nORDINARY_DEBIT = Q(11204, 8192)"), + ("def tape_factor(ambient, rate):", "def tape_factor(ambient, rate, lower, suffix=64):"), + (" delta, lower = Q(1, 2**128), 32768", " delta = Q(1, 2**128)"), + ("(1 + Q(64, lower) + delta)", "(1 + Q(suffix, lower) + delta)"), + ("assert ordinary.ambient == 134 and ordinary.trial == BINARY_C", + "assert ordinary.ambient == 134 and ordinary.trial == BINARY_C\n" + " assert ordinary.level_floor == 18960"), + ("Q(11, 8 * height)", "ORDINARY_DEBIT / height"), + ("Q(11, 8) / (BINARY_C - TERMINAL.ordinary)", + "ORDINARY_DEBIT / (BINARY_C - TERMINAL.ordinary)"), + (" assert (tape_factor(134, BINARY_C) * Q(47, 20)) ** 8 < 2**11", + ' ordinary_upper = Q("2.580517225032310287")\n' + " assert tape_factor(134, BINARY_C, 18960, 8) * Q(47, 20) < ordinary_upper\n" + " assert ordinary_upper**8192 < 2**11204\n" + " assert Q(75, 32) / Q(47, 20) == Q(375, 376)"), + ("assert cost == 318259431 and premium == 514", "assert cost == 318291911 and premium == 517"), + ("(517430, 483870)", "(516570, 501831)"), + ('older = Q(".0038982016137")', 'older = Q(".003898214283192")'), + ("assert gain == Q(83863, 10**13)", "assert gain == Q(2735157, 500000000000000)"), + (" complete_log2_C=cost,", " complete_log2_C=cost,\n" + " ordinary_floor=18960,\n" + " ordinary_matched_suffix_coefficient=8,\n" + " ordinary_finite_debit=str(ORDINARY_DEBIT),\n" + ' ordinary_child_contraction="375/376",'), + (" setup = fixed_installation()", NATIVE_SETUP), + (''' log2_fixed_setup_upper=setup["trace_exponent"], + log2_portable_setup_guard=setup["conservative_exponent"], + log2_full_store_setup_upper=setup["full_store_trace_exponent"], + portable_setup_transition_upper=setup["transitions"],''', + ''' log2_fixed_setup_upper=setup["setup_exponent"], + native_setup_transition_upper=setup["all_setup"], + native_setup_grade_actions=grade_actions,'''), + ), + "independent_price.py": ( + ("lower = powers(2, Q(65081, 524288))[0]", "lower = powers(2, Q(64939, 524288))[0]"), + ('assert lower - upper > Q("0.00012957")', 'assert lower - upper > Q("0.000007887415")'), + ("TERMINAL.kappa - peer == Q(83863, 10**13)", 'TERMINAL.kappa - peer == Q("0.000000018139806")'), + ("def rounded_peer():", DIRECTED_ORDINARY + "def rounded_peer():"), + (" weighted()\n rounded_peer()", " weighted()\n ordinary_debit()\n rounded_peer()"), + ), +} + + +# Apply exact real-integer frequencies and reprice the full typed calendar. +EDITS["runtime.patch"] += ( + ("+GAUSSIAN_C = Q(17145637167, 2**42)", "+GAUSSIAN_C = Q(17145637307, 2**42)"), +) +EDITS["grades.py"] = (("WEIGHTS = (1, 90)", "WEIGHTS = (5, 451)"),) +EDITS["positive_debit.py"] += ( + ("assert target_axes == 135150528", "assert target_axes == 677246016"), + ("assert 91 / (t * 2**10)", "assert sum((5, 451)) / (t * 2**10)"), +) +EDITS["receipt.py"] += ( + ("def raw_counts(base, multiplicity):", "def raw_counts(base, multiplicity, primary=1):"), + ("t, p = targets.copy(), paid.copy()", + "t = Counter({grade: entry * primary for grade, entry in targets.items()})\n" + " p = Counter({grade: entry * primary for grade, entry in paid.items()})"), + ("p[1] -= 1008\n p[Q(1, 2)] += 2016", + "p[1] -= 1008 * primary\n p[Q(1, 2)] += 2016 * primary"), + ("def total_interval(counts):", "def total_interval(counts, trial=GAUSSIAN_C):"), + ("intervals(grade, 1 - GAUSSIAN_C)", "intervals(grade, 1 - trial)"), + ("WEIGHTS == (1, 90)", "WEIGHTS == (5, 451)"), + ("t, p = raw_counts(base, 90)", "t, p = raw_counts(base, WEIGHTS[1], WEIGHTS[0])"), + ("<= 261", "<= 270"), + (" cuts = {}", + " high = total_interval({k: n for k, n in t.items() if k > 2})\n" + " required = total_interval({r: n for r, n in p.items() if 5 * r > 8})\n" + " assert high[0] - required[1] > 462\n" + " past_targets, past_paid = raw_counts(base, 541, 6)\n" + " assert total_interval(past_targets)[1] < total_interval(past_paid)[0]\n" + " old_tariff = Q(17145637167, 2**42)\n" + " cuts = {\"new\": [str(high[0] - required[1]), str(high[1] - required[0])]}"), + (" cap = total_interval({k: n for k, n in chosen.items() if k > 2})", + " cap = total_interval({k: n for k, n in chosen.items() if k > 2}, old_tariff)"), + (" load = total_interval({r: n for r, n in required.items() if 5 * r > 8})", + " load = total_interval({r: n for r, n in required.items() if 5 * r > 8}, old_tariff)"), + (" net = total_interval(chosen)[0] - total_interval(required)[1]", + " net = total_interval(chosen, old_tariff)[0] - total_interval(required, old_tariff)[1]"), +) +EDITS["independent_price.py"] += ( + ('assert psi > Q("184971191.2157")', 'assert psi > Q("926899828.8291")'), +) +EDITS["check_placement.py"] = ( + ("assert 90 * (hi - lo) * M * pi > 4", "assert WEIGHTS[1] * (hi - lo) * M * pi > 4"), +) +EDITS["check_exterior.py"] = ( + ("from band_product import production_supplier", "from band_product import production_supplier\nfrom installations import GAUSSIAN_C"), + ("c = Q(17145637167, 2**42)", "c = GAUSSIAN_C"), +) +EDITS["check_nested.py"] = ( + (" * cells[1, 2]\n * 90", " * cells[1, 2]\n * types[0].multiplicity\n * types[1].multiplicity"), + ("share == cells[1, 2] * 90 / t[2]", "share == cells[1, 2] * types[1].multiplicity / t[2]"), + ("and grant.numerator // grant.denominator == 899557645", "and 4_400_000_000 < grant.numerator // grant.denominator < 4_600_000_000"), +) +EDITS["check_ownership.py"] = ( + ("def run(freq, ticks, lower, upper, volume, n, rounds, delay):", + "def run(freq, ticks, lower, upper, volume, n, rounds, delay, primary=1):"), + ("NativeType((2,), (1, 1), 1)", "NativeType((2,), (1, 1), primary)"), + ("(1, 1, 0, 2): Q(1, 2 * freq)", "(1, 1, 0, 2): Q(primary, 2 * freq)"), + ("1 - Q(1, 2 * freq)", "1 - Q(primary, 2 * freq)"), + (" frequency=freq,", " frequency=(primary, freq),"), + ("run(90, 8, 10, 42, 450, 384, 32, 4)]", + "run(90, 8, 10, 42, 450, 384, 32, 4), run(451, 8, 10, 42, 90, 384, 32, 4, primary=5)]"), +) + + +# Keep the reproduced lower edge and widen the actual even upper fence. +EDITS["grades.py"] += ( + ("LOWER = 2048", "LOWER = 1874\nUPPER_DIVISOR = 1724"), + ("2048 * self.ambient", "UPPER_DIVISOR * self.ambient"), +) +EDITS["positive_debit.py"] += ( + ("BAND_LOWER = 2048", "BAND_LOWER = 1874"), + ("from unpowered_price import intervals", "from unpowered_price import intervals\nfrom grades import UPPER_DIVISOR"), + (" upper = 2 * (M // (2048 * recipe.ambient))", + " scale = UPPER_DIVISOR * recipe.ambient // 2\n" + " upper = 2 * (M // (2 * scale))\n" + " assert 4 * max(targets) * (upper - 8) < M and 516 * (upper + 2) < M"), + ("1024 * recipe.ambient * upper", "scale * upper"), + ("Q(4 * max(targets), 1024 * recipe.ambient)", "Q(4 * max(targets), scale)"), + ("power_interval(1024 * recipe.ambient * lower, c)", "power_interval(scale * lower, c)"), + (' "lower_band": lower,', ' "lower_band": lower,\n "upper_divisor": UPPER_DIVISOR,\n "upper_scale": scale,'), + ("assert t > Q(996, 1000) and 11 * t > 10", + "assert t > Q(996, 1000) and power_interval(lower, t)[0] > 1024 * UNIT"), +) +EDITS["receipt.py"] += (("and LOWER == 2048", "and LOWER == 1874"),) +EDITS["independent_price.py"] += ( + ("from installations import BINARY_C, TERMINAL", "from installations import BINARY_C, TERMINAL\nfrom grades import LOWER, UPPER_DIVISOR"), + (" upper = (", " scale = UPPER_DIVISOR * recipe.ambient // 2\n upper = ("), + ("Q(4 * 258, 1024 * 306)", "Q(4 * 258, scale)"), + ("powers(1024 * 306 * 2048, c)[1]", "powers(scale * LOWER, c)[1]"), + ("fringe / 2048", "fringe / LOWER"), + (' assert lower - upper > Q("0.000007887415")', + ' assert lower - upper > Q("0.000000684423")\n' + ' psi_hi = sum(recipe.paid.histogram[r] * share * r * (powers(Q(k,r), c)[1] - 1) / c\n' + ' for (r,k), share in recipe.cells.items())\n' + ' prior_fringe = 10 * axes / ((1-c) * psi_hi)\n' + ' prior_scale = 1024 * recipe.ambient\n' + ' prior_factor = ((1+delta) * (1+Q(4*258,prior_scale)) * powers(prior_scale*LOWER,c)[0]\n' + ' * (1+prior_fringe/LOWER+delta) / (1-delta)**4)\n' + ' assert prior_factor - powers(2, Q(64939,524288))[1] > Q("0.000051649827")'), +) +EDITS["check_placement.py"] += ( + ("from grades import numerical_recipe, WEIGHTS", "from grades import numerical_recipe, LOWER, UPPER_DIVISOR, WEIGHTS"), + (" U = 2 * (M // (2048 * 306))", + " scale = UPPER_DIVISOR * recipe.ambient // 2\n" + " assert UPPER_DIVISOR == 1724 and scale == 263772\n" + " U = 2 * (M // (2 * scale))"), + (" assert U < lo < hi < M", " assert LOWER < e < U < lo < hi < M"), + (" assert period == 1620 and tickets == (0, 324, 648) and f.swaps[0] == (1, 324, 1)", + " assert period == 1364 and tickets == (0, 272, 545) and f.swaps[0] == (1, 272, 1)"), +) +EDITS["verify.py"] = ( + ('("check_calendar.py", "check_ownership.py")', + '("check_calendar.py", "check_ownership.py", "check_cutoff.py", "check_stage_seam.py", "check_ordinary_floor.py")'), +) + + +def materialize(package): + for name, replacements in EDITS.items(): + replace(package / name, replacements) + with (package / "runtime.patch").open("a") as patch: + patch.write(RAW_FLOOR_PATCH) + path = package / "SOURCES.json" + pins = json.loads(path.read_bytes()) + pins["runtime_images"]["installations.py"]["after"] = NEW_INSTALLATION + pins["runtime_images"]["raw_binary_stage.py"] = RAW_FLOOR_IMAGES + for name in ("runtime.patch", "grades.py"): + pins["local_sources"][name] = sha256((package / name).read_bytes()).hexdigest() + pins["runtime_images"]["grades.py"]["after"] = pins["local_sources"]["grades.py"] + path.write_text(json.dumps(pins, indent=2) + "\n") diff --git a/research/p104-integrated-gaussian-suffix/source-view/source8073/verify.py b/research/p104-integrated-gaussian-suffix/source-view/source8073/verify.py new file mode 100644 index 0000000000..bb337e1762 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source-view/source8073/verify.py @@ -0,0 +1,83 @@ +"""Restore authenticated public inputs, apply one retune and replay a signed mode.""" +from argparse import ArgumentParser +from hashlib import sha256 +import json +from pathlib import Path +import runpy +from subprocess import run +import sys +import tarfile +from tempfile import TemporaryDirectory + +HERE = Path(__file__).resolve().parent +HEAD = "cbe847a953b971f9c6c5a0a6661e2008acd29086" +SOURCE_SHA = "798c2e6394c258986484a116198cc542a6d2b4c1f289e5816de2cfecf5141c51" + + +def unique_object(pairs): + result = {} + for name, value in pairs: + if name in result: + raise ValueError(f"Repeated source key {name}") + result[name] = value + return result + + +def restore(tree): + source = (HERE / "PEER-SOURCE.json").read_bytes() + if sha256(source).hexdigest() != SOURCE_SHA: + raise ValueError("Peer source manifest differs") + pins = json.loads(source, object_pairs_hook=unique_object) + archive = HERE / "peer8057.tar.gz" + if pins["head"] != HEAD or sha256(archive.read_bytes()).hexdigest() != pins["archive_sha256"]: + raise ValueError("Unexpected source archive") + seen = set() + with tarfile.open(archive) as bundle: + for item in bundle: + path = Path(item.name) + if path.is_absolute() or ".." in path.parts or str(path) != item.name: + raise ValueError(f"Invalid source path {item.name}") + if item.isdir(): + continue + if not item.isfile() or item.name in seen or item.name not in pins["files_sha256"]: + raise ValueError(f"Unexpected or repeated peer file {item.name}") + data = bundle.extractfile(item).read() + if sha256(data).hexdigest() != pins["files_sha256"][item.name]: + raise ValueError(f"Source differs at {item.name}") + destination = tree / path + destination.parent.mkdir(parents=True, exist_ok=True) + destination.write_bytes(data) + seen.add(item.name) + if seen != pins["files_sha256"].keys(): + raise ValueError("Source archive is missing a file") + return tree / "research" / "frequency-weighted-native-multiplier" + + +def main(): + modes = ("price", "calendar", "raw", "exterior", "nested", "product", "setup", "regenerate") + parser = ArgumentParser(description=__doc__) + parser.add_argument("mode", choices=modes) + args = parser.parse_args() + with TemporaryDirectory(prefix="weighted-edge-") as temporary: + tree = Path(temporary) + peer = restore(tree) + runpy.run_path(str(HERE / "prepare.py"))["materialize"](peer) + for name in ("check_cutoff.py", "check_stage_seam.py", "check_ordinary_floor.py"): + (peer / name).write_bytes((HERE / name).read_bytes()) + if args.mode == "regenerate": + runtime = tree / "runtime" + run([sys.executable, "-IB", str(peer / "bootstrap.py"), str(runtime)], check=True) + result = run([sys.executable, "-IB", str(peer / "receipt.py"), str(runtime)], check=True, capture_output=True, text=True) + print(json.dumps(json.loads(result.stdout), indent=2)) + return + if args.mode == "setup": + serial = peer.parent / "tiered-native-multiplier" / "check_serial_setup.py" + run([sys.executable, "-IB", str(serial)], check=True) + else: + (peer / "RESULT.json").write_bytes((HERE / "RESULT.json").read_bytes()) + run([sys.executable, "-IB", str(peer / "verify.py"), args.mode], check=True) + print("PASS_K7_SUFFIX", args.mode, flush=True) + + +if __name__ == "__main__": + main() diff --git a/research/p104-integrated-gaussian-suffix/source/addendum-members.json b/research/p104-integrated-gaussian-suffix/source/addendum-members.json new file mode 100644 index 0000000000..55c5cd956d --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source/addendum-members.json @@ -0,0 +1,126 @@ +{ + "six-column-8076/MANIFEST.json": { + "sha256": "34e8d69ccb82001b84dee9e4f1c7c0c5ff7ba940e076ab26c5285350cf481d76", + "size": 2916 + }, + "six-column-8076/README.md": { + "sha256": "ef11412d78231935faaa014efae7a00e32e01026a9d2885df55a078b1d951663", + "size": 5224 + }, + "six-column-8076/candidate-result.json": { + "sha256": "63534a3a2341e929a6b9293062736e7b2e772d5bdccd2bcab163f2294e2ce04a", + "size": 9805 + }, + "six-column-8076/changes/build_successor.py": { + "sha256": "85725239d83700172d58c52034e1bc4254316a93d4f960b5020f0e2aebe8a2af", + "size": 6457 + }, + "six-column-8076/changes/certify_frontier.py": { + "sha256": "22f379c343309d96ee35a3a8b5d400d36f5496ff778e5935aff9839a5969a900", + "size": 5212 + }, + "six-column-8076/changes/check_corrupt_owner.py": { + "sha256": "f68ca0681c5b695dbb4588b4d7a363344aa2f7e622d6e8d8e278fe896d9228da", + "size": 999 + }, + "six-column-8076/changes/check_six_ordinary.py": { + "sha256": "4b317504372594545015a63b034189d7b08fc83c3a7e6268b40ccd4359a8808d", + "size": 9326 + }, + "six-column-8076/changes/check_six_price.py": { + "sha256": "d33bd764b2a24b349dba9a939a5e8774e73ff49e2deac20dae21b977bc4897d6", + "size": 2022 + }, + "six-column-8076/changes/check_successor_cutoff.py": { + "sha256": "aee71d6206f99879210be1c0472a8273ef6611d3a23cc6ed44790fd68538f5b2", + "size": 3507 + }, + "six-column-8076/changes/check_successor_tiers.py": { + "sha256": "4b83323e76908a080e7694cd8d22194100470c312d6ee7341c83477e42f5caf0", + "size": 2705 + }, + "six-column-8076/changes/check_tariff.py": { + "sha256": "3a2f1237bc3695fb02b546aa034058ab934e43c972ad8c6a51c31f40b1790d59", + "size": 275 + }, + "six-column-8076/changes/run_successor.py": { + "sha256": "01e187384cb897c418fa1dc44903440601da16b1705dde99572ffa9ffe14144e", + "size": 2552 + }, + "six-column-8076/changes/stage_caps.py": { + "sha256": "44c49042637d14d2b932f0a56fdc04cb8dd7de03ccc8a75f34cf34135eed5f3d", + "size": 3753 + }, + "six-column-8076/physical-equivalence.json": { + "sha256": "fdfd00d8e742c61607e5fe186f54a6af9cbf3f6ccda33e28b766159b29b02b4a", + "size": 1493 + }, + "six-column-8076/replay8076.py": { + "sha256": "b0dbe2bcd78a5e3f56c209f2fdcd21c82ec9be31ff5e51fb92e91da13646a7b2", + "size": 6094 + }, + "six-column-8076/source-blobs.json": { + "sha256": "af3b5e30c8807c7713eadfae4983ccf1ec98277643bd8894f700b4a8a06b48f0", + "size": 1639 + }, + "six-column-8076/source8076/LICENSE": { + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "size": 11357 + }, + "six-column-8076/source8076/NOTICE.md": { + "sha256": "1c0c2c629461ab50460f41761febfd49c728f1ce1797664d381f618d0e39ea9d", + "size": 869 + }, + "six-column-8076/source8076/PEER-SOURCE.json": { + "sha256": "798c2e6394c258986484a116198cc542a6d2b4c1f289e5816de2cfecf5141c51", + "size": 11897 + }, + "six-column-8076/source8076/PROOF.md": { + "sha256": "aa38434530dc31c284a5610e177d6cf090407aee02b3cba1b6d3d6f7916bfde0", + "size": 8117 + }, + "six-column-8076/source8076/README.md": { + "sha256": "899e0bf09a211b6cc6de8aaaaa98c16aa32ba859873bf7b7ec6b6a4da4087869", + "size": 1684 + }, + "six-column-8076/source8076/RESULT.json": { + "sha256": "e37781c0ffcda49b6adc31501cf062d3bbcb6344765440183e96b2572c65411b", + "size": 8395 + }, + "six-column-8076/source8076/SOURCES.json": { + "sha256": "b3197501bae90ec16c4d99c186e74dfe28e0f5f730e6b8bb94e2d0ce78bcf69c", + "size": 584 + }, + "six-column-8076/source8076/TASK.json": { + "sha256": "d6afd1c7f5111d51b36ece0cb409ff3cc0185b9f4077b03448480ecb98570560", + "size": 6935 + }, + "six-column-8076/source8076/VERIFY.json": { + "sha256": "b27dc7710a15b211a4109055faa35b66db13fe62d2a2454795f3720b7bab7e84", + "size": 2573 + }, + "six-column-8076/source8076/check_cutoff.py": { + "sha256": "07bb320dc80b0ceab90b6820af7fe19e4c30f6a6a6d8d24982243911007d874b", + "size": 3125 + }, + "six-column-8076/source8076/check_ordinary_floor.py": { + "sha256": "01336deda6a999a17723222879217c2ca52598e629deae1f8ed362093e95fdce", + "size": 9326 + }, + "six-column-8076/source8076/check_stage_seam.py": { + "sha256": "822ffc5fafa13655c6f6f98de057c09fa56dc2a38b145d90688b6f742a891ec3", + "size": 13129 + }, + "six-column-8076/source8076/prepare.py": { + "sha256": "cc7e6c5176f1bc19d98a85cf0da5d436d9d9c5caa80c979b53178678a96901f6", + "size": 17574 + }, + "six-column-8076/source8076/verify.py": { + "sha256": "315d21e737c151428fada558c347bd8c92777c641a11ffe4503dc4bdb0d411ef", + "size": 3630 + }, + "six-column-8076/stage-caps.json": { + "sha256": "38f705765eb578171511721f64ea73fa6f644d9a08148a2e7963e4d67b2a9cdf", + "size": 5133 + } +} diff --git a/research/p104-integrated-gaussian-suffix/source/archive-members.json b/research/p104-integrated-gaussian-suffix/source/archive-members.json new file mode 100644 index 0000000000..e35fe60be1 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/source/archive-members.json @@ -0,0 +1,114 @@ +{ + "six-column-8073/BUNDLE-INPUTS.json": { + "sha256": "098043bdbfad86ac9df0d0d089ab58d12febdaca15f5ed360b37bf9a76a4e26e", + "size": 2384 + }, + "six-column-8073/SIX-COLUMN-PROOF.md": { + "sha256": "cdac6a6908c539bedb8a5ad24fce7e4ec1d3a29ed764f5296db666daab3007dc", + "size": 12711 + }, + "six-column-8073/build_successor.py": { + "sha256": "9ab4e9c13deec0c78fdaf94b4d99bead75c5444ca28356d2823b63b4cf133b97", + "size": 6169 + }, + "six-column-8073/certify_frontier.py": { + "sha256": "11467405d9ba805e3ee477c4eb451cf90ac0943e930a1891c1a1c1abce5e173b", + "size": 9734 + }, + "six-column-8073/check_corrupt_owner.py": { + "sha256": "f68ca0681c5b695dbb4588b4d7a363344aa2f7e622d6e8d8e278fe896d9228da", + "size": 999 + }, + "six-column-8073/check_six_ordinary.py": { + "sha256": "70fdd6f0f4af1e192d047ce69304c733388bf4759e76a1b852ddf3c5238a185d", + "size": 1138 + }, + "six-column-8073/check_six_price.py": { + "sha256": "d99a728235fb96dbc58daa9fa60dc00ed27f18333938b6158e430c17e55e0c01", + "size": 2019 + }, + "six-column-8073/check_successor_cutoff.py": { + "sha256": "aee71d6206f99879210be1c0472a8273ef6611d3a23cc6ed44790fd68538f5b2", + "size": 3507 + }, + "six-column-8073/check_successor_tiers.py": { + "sha256": "14c4114cc0bf58966d9eee91890230feb30a6d67632a33dffc4aba5bf0ec1a46", + "size": 2702 + }, + "six-column-8073/compose8073.py": { + "sha256": "85810eb5fe0e5243828f6196a4b9c5197bf75c7cb5f2280c9112b22dfe11b9ff", + "size": 3505 + }, + "six-column-8073/peer8057.tar.gz": { + "sha256": "0e0d559bdb15e7b647f88a2b5e27fcdc9e28e81d8f4145459876ba6da2e9314c", + "size": 2504361 + }, + "six-column-8073/replay_package.py": { + "sha256": "bf639291311f37d6a19b828f8c854820fe11ba771b23df8fb0585885ce74dd9c", + "size": 1956 + }, + "six-column-8073/run_successor.py": { + "sha256": "01e187384cb897c418fa1dc44903440601da16b1705dde99572ffa9ffe14144e", + "size": 2552 + }, + "six-column-8073/source-blobs.json": { + "sha256": "e927ca01169192a995bdb5316b85c6ea6f613697c54287eb38f894d5be379e46", + "size": 2179 + }, + "six-column-8073/source8073/LICENSE": { + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "size": 11357 + }, + "six-column-8073/source8073/NOTICE.md": { + "sha256": "9bb1b93c10f93bc4d5c6cf7e0e9a25e91c0bb260a1224a536420d0c145ef58d6", + "size": 1080 + }, + "six-column-8073/source8073/PEER-SOURCE.json": { + "sha256": "798c2e6394c258986484a116198cc542a6d2b4c1f289e5816de2cfecf5141c51", + "size": 11897 + }, + "six-column-8073/source8073/PROOF.md": { + "sha256": "9b11262a25dcf121f016ef4b8a6d174fc19a8dbd671ad6c9d0ac9b13cb6949ec", + "size": 7122 + }, + "six-column-8073/source8073/README.md": { + "sha256": "85a905b0ff98c736056cf45965628f39b9f236eb326a8394b78365c97ecf8605", + "size": 1973 + }, + "six-column-8073/source8073/RESULT.json": { + "sha256": "344e8cb43020544c675529be213e5aae5e50647dcd3564f32fc632f0b0a963ad", + "size": 7840 + }, + "six-column-8073/source8073/SOURCES.json": { + "sha256": "b3197501bae90ec16c4d99c186e74dfe28e0f5f730e6b8bb94e2d0ce78bcf69c", + "size": 584 + }, + "six-column-8073/source8073/TASK.json": { + "sha256": "ef3430bd093c976f8850b08bfcb6bed26c4f3fcebeea0e889c6e63d903c1724a", + "size": 6850 + }, + "six-column-8073/source8073/VERIFY.json": { + "sha256": "e93a797f94c130f5f6cede24b0ae05e81cc22c6299feef9ac5bbbd1eb4b585d2", + "size": 2557 + }, + "six-column-8073/source8073/check_cutoff.py": { + "sha256": "27f80ce02d8916f0360dff0815863d7c88d65a646bf69db0845e1e6ea5061797", + "size": 3125 + }, + "six-column-8073/source8073/check_ordinary_floor.py": { + "sha256": "893592da4850a3de766e08e1ab0381cbd3c31dce4c85f86e78d5316115368cec", + "size": 9326 + }, + "six-column-8073/source8073/check_stage_seam.py": { + "sha256": "f4e21cd98a8ad2d02ce5a8939eac5e75b4f1fd0e0fe3de37497a849cec5c4f5c", + "size": 12846 + }, + "six-column-8073/source8073/prepare.py": { + "sha256": "c6a7037712bc56a22b879c8ea94e57e210ca66402e367bb196f02d1a22b72a8a", + "size": 14692 + }, + "six-column-8073/source8073/verify.py": { + "sha256": "9443a8ca39b9f0366305b67ba218875050c1574710b0d4ca4465cf8270f53119", + "size": 3612 + } +} diff --git a/research/p104-integrated-gaussian-suffix/source/six-column-8073-public.tar.gz b/research/p104-integrated-gaussian-suffix/source/six-column-8073-public.tar.gz new file mode 100644 index 0000000000..edb820fb6c Binary files /dev/null and b/research/p104-integrated-gaussian-suffix/source/six-column-8073-public.tar.gz differ diff --git a/research/p104-integrated-gaussian-suffix/source/six-column-8076-addendum.tar.gz b/research/p104-integrated-gaussian-suffix/source/six-column-8076-addendum.tar.gz new file mode 100644 index 0000000000..1411a653a2 Binary files /dev/null and b/research/p104-integrated-gaussian-suffix/source/six-column-8076-addendum.tar.gz differ diff --git a/research/p104-integrated-gaussian-suffix/verify.py b/research/p104-integrated-gaussian-suffix/verify.py new file mode 100644 index 0000000000..be8d59d865 --- /dev/null +++ b/research/p104-integrated-gaussian-suffix/verify.py @@ -0,0 +1,401 @@ +#!/usr/bin/env python3 +"""Authenticate a pinned source bundle and run one declared scientific scope. + +All source construction and generated logs live in a fresh temporary directory. +The wrapper validates each named scope's recorded exit and stdout digest; it does +not promote an individual successful check to a claim about the other scopes. +""" + +from argparse import ArgumentParser +from datetime import datetime, timezone +from fractions import Fraction +from hashlib import sha256 +from io import BytesIO +from pathlib import Path, PurePosixPath +from tempfile import TemporaryDirectory +import json +import shutil +import subprocess +import sys +import tarfile + + +if not __debug__ or sys.flags.optimize: + raise SystemExit("Verification requires Python assertions; do not use -O or -OO.") + +HERE = Path(__file__).resolve().parent +ARCHIVE_SHA256 = "1ffaf4eed67cfe2271820bc94d62721573ff715829c829c5d9936b561eacb270" +MANIFEST_SHA256 = "ba961383f648a6d7dcbf9caaee4240d4b74486050a2d9d1bc0e100bd2bff6ca5" +ADDENDUM_SHA256 = "bacfc6ec44616063eae1584e6af07a1dbbfaf7948df1745bc059aa4510c7c9a0" +ADDENDUM_MANIFEST_SHA256 = "dfe65dbea792691d82e7c1265cae8e82f374e8c48f644c220643cbaaac978507" +SCOPES = { + "price": ("invoice", "independent_price", "placement"), + "calendar": ("cutoff", "calendar", "ownership", "stages", "ordinary_floor", "corrupted_owner"), + "raw": ("raw",), + "exterior": ("exterior",), + "nested": ("nested",), + "product": ("product",), + "setup": ("setup",), +} +ADDENDUM_SCOPES = ("source_invoice", "ordinary_tariff", "stage_caps", "invoice", + "independent_price", "cutoff", "corrupted_owner") + + +def require(ok, message): + if not ok: + raise ValueError(message) + + +def unique_object(pairs): + value = {} + for key, item in pairs: + require(key not in value, "duplicate JSON key: " + key) + value[key] = item + return value + + +def read_json(path): + return json.loads(path.read_bytes(), object_pairs_hook=unique_object) + + +def digest(data): + return sha256(data).hexdigest() + + +def canonical_path(name): + require(isinstance(name, str) and "\\" not in name and "\x00" not in name, + "invalid archive path") + path = PurePosixPath(name) + require(bool(path.parts) and not path.is_absolute() and ".." not in path.parts + and path.as_posix() == name and path.parts[0] == "six-column-8073" + and len(path.parts) >= 2, "noncanonical archive path: " + name) + return path + + +def validate_peer(data, pins): + """Independently check the complete immediate #8057 tar inventory.""" + require(digest(data) == pins["archive_sha256"], "peer archive digest mismatch") + files = pins["files_sha256"] + require(isinstance(files, dict) and len(files) == 88, "unexpected peer inventory") + directories = set() + for name in files: + path = PurePosixPath(name) + require(not path.is_absolute() and ".." not in path.parts and "\\" not in name + and path.as_posix() == name and len(path.parts) > 1, "invalid peer manifest path") + directories.update(PurePosixPath(*path.parts[:i]).as_posix() for i in range(1, len(path.parts))) + seen, found = set(), set() + with tarfile.open(fileobj=BytesIO(data), mode="r:gz") as bundle: + for member in bundle: + name = member.name + path = PurePosixPath(name) + require(bool(path.parts) and not path.is_absolute() and ".." not in path.parts + and "\\" not in name and path.as_posix() == name, "invalid peer path: " + name) + require(name not in seen, "duplicate peer member: " + name) + seen.add(name) + if member.isdir(): + require(name in directories, "unexpected peer directory: " + name) + continue + require(member.isfile() and name in files and member.size <= 10_000_000, + "unexpected peer member: " + name) + stream = bundle.extractfile(member) + require(stream is not None, "missing peer payload: " + name) + payload = stream.read(member.size + 1) + require(len(payload) == member.size and digest(payload) == files[name], + "peer member digest mismatch: " + name) + found.add(name) + require(found == set(files), "peer archive is missing whitelisted files") + + +def unpack(tree): + archive = HERE / "source/six-column-8073-public.tar.gz" + manifest_path = HERE / "source/archive-members.json" + require(digest(archive.read_bytes()) == ARCHIVE_SHA256, "archive digest mismatch") + require(digest(manifest_path.read_bytes()) == MANIFEST_SHA256, "member manifest digest mismatch") + pins = read_json(manifest_path) + require(isinstance(pins, dict) and len(pins) == 28, "unexpected member inventory") + for name, entry in pins.items(): + canonical_path(name) + require(set(entry) == {"sha256", "size"} and isinstance(entry["size"], int) + and 0 <= entry["size"] <= 3_000_000, "invalid member pin: " + name) + seen = set() + with tarfile.open(archive, "r:gz") as bundle: + for member in bundle: + name = member.name + path = canonical_path(name) + require(name not in seen, "duplicate archive member: " + name) + require(member.isfile() and name in pins, "unexpected archive member: " + name) + require(member.size == pins[name]["size"], "member length mismatch: " + name) + fileobj = bundle.extractfile(member) + require(fileobj is not None, "missing member payload: " + name) + data = fileobj.read(member.size + 1) + require(len(data) == member.size and digest(data) == pins[name]["sha256"], + "member digest mismatch: " + name) + relative = PurePosixPath(*path.parts[1:]) + if relative.as_posix() != "peer8057.tar.gz": + visible = HERE / "source-view" / Path(*relative.parts) + require(visible.is_file() and not visible.is_symlink() + and digest(visible.read_bytes()) == pins[name]["sha256"], + "review copy differs: " + relative.as_posix()) + output = tree / Path(*path.parts) + output.parent.mkdir(parents=True, exist_ok=True) + output.write_bytes(data) + seen.add(name) + require(seen == set(pins), "archive is missing whitelisted members") + visible = {p.relative_to(HERE / "source-view").as_posix() + for p in (HERE / "source-view").rglob("*") if p.is_file()} + wanted = {PurePosixPath(*canonical_path(n).parts[1:]).as_posix() for n in pins + if n != "six-column-8073/peer8057.tar.gz"} + require(visible == wanted, "unexpected or missing review copy") + source = tree / "six-column-8073" + validate_peer((source / "peer8057.tar.gz").read_bytes(), read_json(source / "source8073/PEER-SOURCE.json")) + return source + + +def unpack_addendum(tree): + archive = HERE / "source/six-column-8076-addendum.tar.gz" + manifest_path = HERE / "source/addendum-members.json" + require(digest(archive.read_bytes()) == ADDENDUM_SHA256, "addendum archive digest mismatch") + require(digest(manifest_path.read_bytes()) == ADDENDUM_MANIFEST_SHA256, + "addendum member manifest digest mismatch") + pins = read_json(manifest_path) + require(isinstance(pins, dict) and len(pins) == 31, "unexpected addendum inventory") + seen = set() + with tarfile.open(archive, "r:gz") as bundle: + for member in bundle: + name = member.name + path = PurePosixPath(name) + require(bool(path.parts) and not path.is_absolute() and ".." not in path.parts + and "\\" not in name and path.as_posix() == name + and len(path.parts) >= 2 and path.parts[0] == "six-column-8076", + "noncanonical addendum path: " + name) + require(name not in seen, "duplicate addendum member: " + name) + require(member.isfile() and name in pins, "unexpected addendum member: " + name) + entry = pins[name] + require(set(entry) == {"sha256", "size"} and type(entry["size"]) is int + and 0 <= member.size <= 1_000_000 and member.size == entry["size"], + "addendum member length mismatch: " + name) + stream = bundle.extractfile(member) + require(stream is not None, "missing addendum payload: " + name) + data = stream.read(member.size + 1) + require(len(data) == member.size and digest(data) == entry["sha256"], + "addendum member digest mismatch: " + name) + relative = PurePosixPath(*path.parts[1:]) + visible = HERE / "source-view-8076" / Path(*relative.parts) + require(visible.is_file() and not visible.is_symlink() and digest(visible.read_bytes()) == entry["sha256"], + "addendum review copy differs: " + relative.as_posix()) + destination = tree / Path(*path.parts) + destination.parent.mkdir(parents=True, exist_ok=True) + destination.write_bytes(data) + seen.add(name) + require(seen == set(pins), "addendum is missing whitelisted members") + visible = {p.relative_to(HERE / "source-view-8076").as_posix() + for p in (HERE / "source-view-8076").rglob("*") if p.is_file()} + wanted = {PurePosixPath(*PurePosixPath(n).parts[1:]).as_posix() for n in pins} + require(visible == wanted, "unexpected or missing addendum review copy") + return tree / "six-column-8076" + + +def invoke(script, *args): + result = subprocess.run([sys.executable, "-I", "-B", str(script), *map(str, args)], + capture_output=True, text=True) + if result.returncode: + raise RuntimeError("failed command " + script.name + ": " + result.stderr[-4000:] + + "\n" + result.stdout[-4000:]) + return result.stdout + + +def compose(source): + invoke(source / "compose8073.py") + return source / "combined" + + +def run_scopes(combined, names): + output = invoke(combined / "run_successor.py", *names) + lines = [line.split() for line in output.splitlines() if line.strip()] + require(len(lines) == len(names) and all(len(row) == 3 for row in lines) + and [row[0] for row in lines] == list(names) + and all(row[1] == "0" for row in lines), "scope output does not match selection") + logs = combined / "successor/logs" + require({p.stem for p in logs.glob("*.json")} == set(names), "scope receipt set differs") + records = {} + for name in names: + record = read_json(logs / (name + ".json")) + require(record.get("mode") == name and type(record.get("code")) is int + and record["code"] == 0, "scope failed or mislabeled: " + name) + stdout = (logs / (name + ".out")).read_bytes() + require(record.get("output_sha256") == digest(stdout), "scope output digest mismatch: " + name) + for field in ("started_at", "finished_at"): + stamp = datetime.fromisoformat(record[field]) + require(stamp.utcoffset() is not None, "scope receipt has no timezone: " + name) + require(datetime.fromisoformat(record["started_at"]) <= datetime.fromisoformat(record["finished_at"]), + "scope timestamps out of order: " + name) + records[name] = {key: record[key] for key in + ("code", "started_at", "finished_at", "output_sha256")} + return records + + +def check_json_output(script, reference, *args, keys=None): + observed = json.loads(invoke(script, *args), object_pairs_hook=unique_object) + expected = read_json(reference) + if keys is not None: + observed = {key: observed[key] for key in keys} + expected = {key: expected[key] for key in keys} + require(observed == expected, "independent result differs: " + script.name) + + +def rebuild_eight(tree, source): + root = tree / "eight-column" + root.mkdir() + shutil.copytree(source / "source8073", root / "source8073") + shutil.copyfile(source / "peer8057.tar.gz", root / "source8073/peer8057.tar.gz") + (root / "overlay").mkdir() + for name in ("weighted_suffix.py", "independent_gaussian.py", "check_combined_seams.py"): + shutil.copyfile(HERE / "appendix" / name, root / "overlay" / name) + shutil.copyfile(HERE / "appendix/rebuild_e8.py", root / "rebuild_e8.py") + output = invoke(root / "rebuild_e8.py") + require("PASS_SOURCE_RECONSTRUCTION" in output and "PASS_COMBINED_RECEIPT" in output, + "eight-column reconstruction did not report its two checks") + require(read_json(root / "RESULT-8073.json") == read_json(HERE / "data/eight-column-invoice.json"), + "eight-column signed invoice differs") + return root + + +def price_checks(tree, source, combined): + invoice = read_json(combined / "successor/logs/invoice.out") + require(invoice == read_json(HERE / "data/six-column-invoice.json"), + "six-column signed invoice differs") + check_json_output(HERE / "checks/check_referee.py", HERE / "data/referee-price.json", "price", + "--base-runtime", combined / "runtime", keys=("mode", "predecessor_runtime", "result")) + check_json_output(HERE / "checks/actual_six_grant.py", HERE / "data/referee-six-grant.json", + "--base-runtime", combined / "runtime", + keys=("H", "L", "sender_band", "recipient_band", "r", "k", "source_level", + "recipient_level", "overlap", "precision_bits", "records")) + check_json_output(HERE / "checks/all_stage_caps.py", HERE / "data/seven-stage.json") + check_json_output(HERE / "checks/minimum_signed_invoice.py", HERE / "data/minimal-clock.json") + rebuild_eight(tree, source) + old = read_json(source / "source8073/RESULT.json") + earlier = read_json(HERE / "data/8072-invoice.json") + eight = read_json(HERE / "data/eight-column-invoice.json") + table = read_json(HERE / "data/seven-stage.json") + old_ceiling = Fraction(table["published_8073_family"]["three_stage_exact_stopped_supremum"]) + for candidate in (invoice, eight): + require(Fraction(candidate["terminal"]["kappa"]) > old_ceiling, + "candidate does not clear the pinned stopped ceiling") + require(Fraction(candidate["terminal"]["kappa"]) < Fraction(39, 10000), + "unexpected target crossing") + require(invoice["complete_log2_C"] == 318291611 and old["complete_log2_C"] == 318291911 + and earlier["complete_log2_C"] == 318292011 and eight["complete_log2_C"] == 318291851, + "complete clock comparison differs") + + +def calendar_checks(combined): + base = combined / "runtime" + six = combined / "successor/runtime" + check_json_output(HERE / "checks/check_referee.py", HERE / "data/referee-events.json", "events", + "--base-runtime", base, "--six-runtime", six, + keys=("mode", "predecessor_runtime", "result")) + + +def run_addendum(tree): + source = unpack_addendum(tree) + comparison_path = tree / "cross-runtime.json" + comparison_output = invoke(HERE / "checks/compare_cold_runtimes.py", "--predecessor-archive", + HERE / "source/six-column-8073-public.tar.gz", "--addendum-archive", + HERE / "source/six-column-8076-addendum.tar.gz", "--output", comparison_path) + require(comparison_output.rstrip().endswith("PASS 105 of 106 runtime files; 84 of 88 peer files"), + "cross-source comparison did not pass") + comparison = read_json(comparison_path) + require(comparison == read_json(source / "physical-equivalence.json") + and comparison["runtime"]["identical_files"] == 105 + and comparison["peer"]["identical_files"] == 84, + "cross-source comparison differs") + out = tree / "addendum-receipt" + output = invoke(source / "replay8076.py", "--predecessor-archive", + HERE / "source/six-column-8073-public.tar.gz", "--output", out, + "--scope", *ADDENDUM_SCOPES) + require(output.rstrip().endswith("PASS 7 scopes"), "addendum scope output differs") + receipt = read_json(out / "cold-result.json") + require(receipt.get("pass") is True + and receipt.get("source_head") == "d502eb21637717fe22fc16d4c4e3ede6ec59a106" + and receipt.get("verified_addendum_files") == 30 + and receipt.get("pr8076_scientific_blobs") == 15 + and receipt.get("pr8057_peer_files") == 88 + and set(receipt.get("tested", {})) == set(ADDENDUM_SCOPES), + "addendum receipt does not match the requested scopes") + extras = {"source_invoice", "ordinary_tariff", "stage_caps"} + records = {} + for name in ADDENDUM_SCOPES: + record = receipt["tested"][name] + require(record.get("mode") == name and type(record.get("code")) is int and record["code"] == 0, + "addendum scope failed or mislabeled: " + name) + path = out / (name + ".out") if name in extras else out / "logs" / (name + ".out") + require(record.get("output_sha256") == digest(path.read_bytes()), + "addendum scope output digest mismatch: " + name) + for field in ("started_at", "finished_at"): + require(datetime.fromisoformat(record[field]).utcoffset() is not None, + "addendum scope receipt has no timezone: " + name) + require(datetime.fromisoformat(record["started_at"]) <= datetime.fromisoformat(record["finished_at"]), + "addendum timestamps out of order: " + name) + records[name] = {key: record[key] for key in ("code", "started_at", "finished_at", "output_sha256")} + source_invoice = read_json(out / "source_invoice.out") + invoice = read_json(out / "logs/invoice.out") + require(source_invoice == read_json(source / "source8076/RESULT.json") + and invoice == read_json(source / "candidate-result.json"), "addendum invoice differs") + require(Fraction(invoice["terminal"]["kappa"]) == Fraction(".003898226579820971") + and Fraction(source_invoice["terminal"]["kappa"]) == Fraction(".003898223617430") + and Fraction(invoice["terminal"]["kappa"]) > Fraction(invoice["previous_exact_ceiling"]) + and invoice["complete_log2_C"] == source_invoice["complete_log2_C"] == 318291900 + and invoice["entry_price_surcharge"] == 516 + and Fraction(invoice["ordinary_finite_debit"]) == Fraction(11178, 8192) + and Fraction(invoice["gaussian"]["raw_loss"]) == Fraction(125645, 1048576), + "addendum signed comparison differs") + return records + + +def main(): + parser = ArgumentParser(description=__doc__) + parser.add_argument("mode", choices=(*SCOPES, "addendum")) + mode = parser.parse_args().mode + started = datetime.now(timezone.utc).isoformat() + addendum_records = None + with TemporaryDirectory(prefix="gaussian-suffix-") as tmp: + tree = Path(tmp) + source = unpack(tree) + if mode == "addendum": + records = run_addendum(tree) + else: + combined = compose(source) + records = run_scopes(combined, SCOPES[mode]) + if mode == "price": + price_checks(tree, source, combined) + addendum_records = run_addendum(tree) + elif mode == "calendar": + calendar_checks(combined) + elif mode == "setup": + require(invoke(HERE / "checks/guard_controls.py").strip() == "PASS_ARCHIVE_AND_RECEIPT_GUARDS", + "archive and receipt controls did not pass") + result = {"mode": mode, "started_at": started, "finished_at": datetime.now(timezone.utc).isoformat(), + "archive_sha256": ARCHIVE_SHA256, "verified_scopes": records} + if mode == "price": + result["additional_checks"] = ["independent_integral_prices", "one_to_seven_stage_caps", + "minimum_integer_invoice", "eight_column_signed_invoice", + "actual_positive_grant", "8076_addendum_economics", + "fresh_cross_source_runtime_comparison"] + result["addendum_scopes"] = addendum_records + result["addendum_not_run_by_this_mode"] = ["placement", "calendar", "ownership", "exterior", "nested", + "raw", "product", "stages", "ordinary_floor", "setup"] + if mode == "calendar": + result["additional_checks"] = ["literal_event_identity"] + if mode == "setup": + result["additional_checks"] = ["archive_and_receipt_guards"] + if mode == "addendum": + result["addendum_archive_sha256"] = ADDENDUM_SHA256 + result["additional_checks"] = ["fresh_cross_source_runtime_comparison"] + result["not_run_by_this_mode"] = ["placement", "calendar", "ownership", "exterior", "nested", + "raw", "product", "stages", "ordinary_floor", "setup"] + print(json.dumps(result, indent=2)) + print("PASS_INTEGRATED_GAUSSIAN_" + mode.upper()) + + +if __name__ == "__main__": + main()