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-graded-cut-relay-repair/CURVATURE.json b/research/p104-graded-cut-relay-repair/CURVATURE.json new file mode 100644 index 0000000000..b25e982e4e --- /dev/null +++ b/research/p104-graded-cut-relay-repair/CURVATURE.json @@ -0,0 +1,106 @@ +{ + "component_discount_enclosures": [ + [ + "11.574637158869318381", + "11.574637158869318383" + ], + [ + "6.001777803622792374", + "6.001777803622792379" + ], + [ + "3.329542858827385248", + "3.329542858827385256" + ], + [ + "2.013212726425237169", + "2.013212726425237180" + ], + [ + "1.205090468880674938", + "1.205090468880674950" + ], + [ + "0.657309702259951740", + "0.657309702259951750" + ], + [ + "0.278425564712833406", + "0.278425564712833413" + ] + ], + "conditional_baseline_raw_surplus": [ + "-0.132405116496822352", + "-0.132405116496822052" + ], + "exponent_t": "49805477/50000000", + "full_binary_caller_paid_count": 104904, + "full_binary_caller_rank_sum": 285600, + "maximum_rank_sum_8_fusion": { + "ranks": [ + 4, + 4 + ], + "saving": [ + "0.021428347033463130", + "0.021428347033463131" + ] + }, + "native_h": [ + 1974, + 529, + 330, + 186, + 83, + 1, + 0 + ], + "only_4_plus_4_original_incidence_pair": { + "first_clock": 7112, + "first_owner": 2241, + "first_source": 0, + "hinge_chart": 509, + "second_clock": 7210, + "second_destination": 1, + "second_owner": 2252 + }, + "original_ordered_incidence_counts": { + "2+2": 4227, + "4+4": 1 + }, + "relaxed_h": [ + 4123, + 3496, + 2869, + 2253, + 1637, + 1021, + 505 + ], + "relaxed_minus_native_h": [ + 2149, + 2967, + 2539, + 2067, + 1554, + 1020, + 505 + ], + "scope": "Price and chronological chart-incidence only; no readable fusion, physical supplier, powered outer test, or kappa improvement claimed.", + "seven_best_fusions_raw_surplus": [ + "0.017593312737419560", + "0.017593312737419860" + ], + "six_best_fusions_raw_surplus": [ + "-0.003835034296043570", + "-0.003835034296043271" + ], + "source_caller_sha256": "757b3523798f840bdb02028b23708c3416627a99ea09e7a3c4bcdc5cd0c7ce4b", + "source_graph_sha256": "74e93daf2b7acf794ffb51f92f03f51556f68126d41ee13a8969bddb4cbe6326", + "target_kappa": "0.00389046", + "total_relaxation_gap": [ + "25.059996283598193259", + "25.059996283598193307" + ], + "upward_rank_sum": 4750 +} diff --git a/research/p104-graded-cut-relay-repair/CURVATURE.md b/research/p104-graded-cut-relay-repair/CURVATURE.md new file mode 100644 index 0000000000..89ba7985c2 --- /dev/null +++ b/research/p104-graded-cut-relay-repair/CURVATURE.md @@ -0,0 +1,85 @@ +# Discrete curvature of a paid rank histogram + +Let \(0 /tmp/p104-information-result.json +``` + +`INFORMATION.json` is the captured local output. The independent forward replay +checks owner locations, both full 630-row maps, the altered receipt and the +exact live pre-reader state. An independently implemented reverse adjoint +reconstructs and compares both complete transposes. The script checks source +hashes, exact clock prefixes, the 504 independent target combinations, the +oracle and wrong-oracle controls, private CLEARs and paid histogram. The small +`k ≤ 8` exhaustive residual-bit controls are examples; the general multi-copy +claim follows from the proof above, not enumeration. The script does not +independently re-prove the predecessor's full physical application. + +Ali Romman supplied the graph; [the package notice](NOTICE.md) +and [parent notice](PARENT-NOTICE) record its research lineage. The predecessor +notice describes the larger predecessor package, not every file in this small +standalone folder. The graph provenance and predecessor pins are retained in +[SOURCES.json](SOURCES.json). The source's Apache-2.0 license is +retained in [LICENSE](LICENSE). Computational replay is author-side evidence, +not independent human review. diff --git a/research/p104-graded-cut-relay-repair/INFORMATION.json b/research/p104-graded-cut-relay-repair/INFORMATION.json new file mode 100644 index 0000000000..2c3ea56323 --- /dev/null +++ b/research/p104-graded-cut-relay-repair/INFORMATION.json @@ -0,0 +1,409 @@ +{ + "source_sha256": "74e93daf2b7acf794ffb51f92f03f51556f68126d41ee13a8969bddb4cbe6326", + "scope": "fixed-incidence normalized constant binary fields; no physical supplier admission", + "chart1_target_rank": 505, + "other_chart1_arrivals": 502, + "early_hub_ingress": [ + [ + 8072, + 2326, + 326 + ], + [ + 8098, + 2333, + 329 + ] + ], + "early_hub_to_chart1": [ + [ + 8075, + 2327, + 531 + ], + [ + 10138, + 2862, + 531 + ], + [ + 10141, + 2863, + 531 + ] + ], + "native_top_rank": 505, + "changed_top_rank": 504, + "native_full_rank": 630, + "changed_full_rank": 629, + "attained_native_target_combinations": 504, + "unaffected_top_outputs": 497, + "paired_top_outputs": 7, + "residual_support": [ + 3, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 230, + 359, + 362, + 365, + 367, + 372, + 375, + 378, + 386, + 388, + 390, + 522 + ], + "public_error_signature": [ + 0, + 11, + 117, + 223, + 224, + 230, + 249, + 250, + 251 + ], + "pre_reader_only_changed_owner": [ + 2326 + ], + "preserved_2327_receipt": true, + "original_and_changed_clears": 3433, + "clear_differences_vanish_on_residual_hyperplane": true, + "oracle_residual_at_10137_repairs_all_public_and_clear_values": true, + "wrong_side_information_rejected": true, + "reverse_transposes_verified": true, + "paid_histogram_change": { + "rank_1": 1, + "rank_2": -1 + }, + "joint_copy_residual_controls": [ + [ + 1, + 0, + 1, + 2 + ], + [ + 1, + 1, + 2, + 2 + ], + [ + 1, + 2, + 2, + 2 + ], + [ + 2, + 0, + 1, + 4 + ], + [ + 2, + 1, + 2, + 4 + ], + [ + 2, + 2, + 4, + 4 + ], + [ + 2, + 3, + 4, + 4 + ], + [ + 3, + 0, + 1, + 8 + ], + [ + 3, + 1, + 2, + 8 + ], + [ + 3, + 2, + 4, + 8 + ], + [ + 3, + 3, + 8, + 8 + ], + [ + 3, + 4, + 8, + 8 + ], + [ + 4, + 0, + 1, + 16 + ], + [ + 4, + 1, + 2, + 16 + ], + [ + 4, + 2, + 4, + 16 + ], + [ + 4, + 3, + 8, + 16 + ], + [ + 4, + 4, + 16, + 16 + ], + [ + 4, + 5, + 16, + 16 + ], + [ + 5, + 0, + 1, + 32 + ], + [ + 5, + 1, + 2, + 32 + ], + [ + 5, + 2, + 4, + 32 + ], + [ + 5, + 3, + 8, + 32 + ], + [ + 5, + 4, + 16, + 32 + ], + [ + 5, + 5, + 32, + 32 + ], + [ + 5, + 6, + 32, + 32 + ], + [ + 6, + 0, + 1, + 64 + ], + [ + 6, + 1, + 2, + 64 + ], + [ + 6, + 2, + 4, + 64 + ], + [ + 6, + 3, + 8, + 64 + ], + [ + 6, + 4, + 16, + 64 + ], + [ + 6, + 5, + 32, + 64 + ], + [ + 6, + 6, + 64, + 64 + ], + [ + 6, + 7, + 64, + 64 + ], + [ + 7, + 0, + 1, + 128 + ], + [ + 7, + 1, + 2, + 128 + ], + [ + 7, + 2, + 4, + 128 + ], + [ + 7, + 3, + 8, + 128 + ], + [ + 7, + 4, + 16, + 128 + ], + [ + 7, + 5, + 32, + 128 + ], + [ + 7, + 6, + 64, + 128 + ], + [ + 7, + 7, + 128, + 128 + ], + [ + 7, + 8, + 128, + 128 + ], + [ + 8, + 0, + 1, + 256 + ], + [ + 8, + 1, + 2, + 256 + ], + [ + 8, + 2, + 4, + 256 + ], + [ + 8, + 3, + 8, + 256 + ], + [ + 8, + 4, + 16, + 256 + ], + [ + 8, + 5, + 32, + 256 + ], + [ + 8, + 6, + 64, + 256 + ], + [ + 8, + 7, + 128, + 256 + ], + [ + 8, + 8, + 256, + 256 + ], + [ + 8, + 9, + 256, + 256 + ] + ] +} diff --git a/research/p104-graded-cut-relay-repair/LICENSE b/research/p104-graded-cut-relay-repair/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/p104-graded-cut-relay-repair/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-graded-cut-relay-repair/NOTICE.md b/research/p104-graded-cut-relay-repair/NOTICE.md new file mode 100644 index 0000000000..163cf5af16 --- /dev/null +++ b/research/p104-graded-cut-relay-repair/NOTICE.md @@ -0,0 +1,16 @@ +# Attribution and retained source + +Ali Romman supplied the #8027 graph and physical supplier. The unchanged gzip +here is the single copy of `BINARY-CANDIDATE.json.gz` from source head +`fb9b6a7b0d27da1cf98430893a3016bf811e2aa4`; its bytes also match the graph +retained by #8041 at `05f6172d4d9487090fa24c75137a7c60e6fcd67e`. The pinned paired caller is the unchanged +`research/paired-query-only-bit/EFREE-CALLER.json.gz` from the stated base; +its earlier contributors retain their credit. That predecessor's literal relay and decoder-independent chart-1 cut motivate this +follow-up. ToikY nominated the chart-510 investigation, and DreamingOfClouds +provided the #7852 toolkit. The source's retained lineage and contributors are +recorded in [PARENT-NOTICE](PARENT-NOTICE). + +Clear1nsight prepared these follow-up proofs and verification with substantial +OpenAI Codex assistance. The new and retained material is offered under the +[Apache-2.0 license](LICENSE). The distinct computational implementations are +author-side evidence; independent human scientific review remains open. diff --git a/research/p104-graded-cut-relay-repair/PARENT-NOTICE b/research/p104-graded-cut-relay-repair/PARENT-NOTICE new file mode 100644 index 0000000000..fe51894a1a --- /dev/null +++ b/research/p104-graded-cut-relay-repair/PARENT-NOTICE @@ -0,0 +1,31 @@ +Mixed paid cutoffs for the P104 ordinary BIT supplier + +Prepared for Clear1nsight with substantial OpenAI Codex assistance. The +new schedule, directed comparison, occurrence controls, and documentation +are offered under Apache-2.0. + +verify.py adapts the Apache-2.0 verifiers from Dugongue's PR #7831 +(2d1fb9c878ae1e292cb918de40fa8e4f7fa7f75e) and Rohan Arun's PR #7835 +(43007c979859fa84ccc3a3509ccacc9620d181fa). Rohan Arun submitted #7835 +through the original X request at +https://x.com/RohanArun/status/2123655584797143516. The source manifest +retains the published #7835 NOTICE. + +Retained predecessor NOTICE from the grade-14 package follows. + +Iterated returns on the P104 ordinary suppliers + +Clear1nsight prepared the successor construction, explicit witnesses and verification +with substantial OpenAI Codex assistance, including independent computational checks. +The new material is offered under Apache-2.0. + +The exact starting words and the rational and binary replay interfaces are from +Clear1nsight's PR #7781. The paid and productive scalar operations, the 48-call +complex schedule, the punctured binary supplier and the common outer application +come from Ali Romman's PR #7776. The two paid projections build on the local +quotient and terminal repair in #7774 and #7781. The binary paired caller and +finite compiler use work by DreamingOfClouds, Jerry Chen (CubeJerry), zxv and the +contributors cited in their retained sources. SYLforge, Rohan Arun, Cinna Davis, +Douglas Colkitt and other predecessors contributed the caller, physical and +analytic framework. The source-fetch helper is adapted from #7774. The immutable +source manifest identifies the public inputs and their notices. diff --git a/research/p104-graded-cut-relay-repair/README.md b/research/p104-graded-cut-relay-repair/README.md new file mode 100644 index 0000000000..d1a37ff30d --- /dev/null +++ b/research/p104-graded-cut-relay-repair/README.md @@ -0,0 +1,209 @@ +# Graded information cuts and a complete normalized relay repair + +The pinned 111-port P104 graph saturates eight global dimension cuts. Its +2,776 upward scalar contacts pay exactly **4,750 total rank units**, the +minimum for the same public input and output chart bindings in the binary +constant-field model. An exact relaxation of the powered upward price still +has slack; it is not a construction. Each of the 27 native downward slots is +individually rigid under the fixed-suffix model. The fixed 326 → 531 → 1 relay loses one +binary degree of freedom, and its sharp multi-copy success rate is known. +An explicit changed normalized word restores all 630 public rows, but costs +one additional total paid rank unit and alters five dirty clear records. No +new κ bound or admitted physical supplier is claimed. + +## Eight saturated cuts + +For each `j = 1,...,8`, take the charts of dimension at least `j`. Fix the +inputs initially inside that region and let the other inputs vary. The +required inside targets have respective binary ranks + +``` +516, 627, 627, 627, 616, 616, 616, 505. +``` + +An incoming scalar message has at most two values, so a deterministic +fixed-schedule protocol needs at least that many contacts entering each +region. Outgoing messages and arbitrary inside computation do not increase the +number of incoming transcripts. Every upward rank-`r` contact crosses exactly +`r` thresholds. Summing the eight inequalities proves the **4,750** upward +rank minimum; the original word attains equality at each threshold. New charts, +recoded messages, unbounded local storage and retiming are allowed, provided +initial external information and schedule observations are not supplied free. +One net unit of lost upward grade is therefore impossible in this model. The +27 downward contacts contribute 63 further native grade units, for which this +upward argument gives no corresponding lower bound. Rank-preserving fusions +may change a concave powered tariff. [Proof and precise scope](DIMENSION-CUTS.md). + +For every original dimension-seven chart, the union of it and chart 1 also +saturates its outside-input cut. For `{1,531}` there are 506 independent +required outputs and 506 inbound contacts. Replacing 326 → 1 by 531 → 1 +makes the latter internal and leaves only **505** external contacts; arbitrary +recoding or retiming cannot repair this fixed incidence. Restoring one external +contact passes this necessary cut, without itself constructing a correct word. +The checker covers all 120 pairs, with separate lost, restored and extra-contact +controls. + +## Exact powered interval relaxation + +For `0 < t ≤ 1`, relax the actual endpoint and timing constraints and minimize +`Σ r^t` over multisets of consecutive dimension intervals covering the eight +cut demands. Its sharp optimum is + +``` +505·8^t + 11·7^t + 100·6^t + 11·3^t. +``` + +The superlevel intervals give a primal cover. Ordering levels by demand and +assigning successive differences `j^t − (j−1)^t` gives a feasible dual with +the same value. At `t = 1 − 0.00389046`, the native upward price is in +`[4737.618920783137811, 4737.618920783137812]` and the relaxed minimum is in +`[4712.558924499539618, 4712.558924499539619]`. The gap is approximately +**25.059996283598193 per native invocation**. These intervals are an abstract +lower bound and need not be realizable by causal messages at legal endpoints; +they exclude downward and caller costs. [Primal, dual and scope](GRADE-PRICE.md). + +## Curvature and a conditional fusion budget + +For a histogram of paid ranks \(r\le R\), write `G = Σ r n_r`, +`H_j = Σ n_r max(r−j,0)` and `w_j = 2j^t−(j−1)^t−(j+1)^t`. +A telescoping identity gives the exact powered bill +`G − Σ_{j=1}^{R−1} w_j H_j`; concavity makes every `w_j` nonnegative. +For the native upward histogram and the optimal interval relaxation, the +relaxed-minus-native `H_j` values at `j=1,…,7` are +`2149, 2967, 2539, 2067, 1554, 1020, 505`. The first two priced terms of the +25.059996283598193 relaxation gap are approximately **11.5746371588693** and +**6.00177780362279** per native invocation. They are relaxation headroom, +not realized savings. + +Among hypothetical fusions of positive ranks with sum at most eight, the +largest saving is `2·4^t − 8^t`, approximately **0.02142834703346313** at +the trial rate. Reconstructing the complete 36-call binary raw invoice from +the pinned graph and caller shows that six such fusions cannot close its raw +deficit. Seven hypothetical balanced 4+4 fusions would pass that raw test if +all other terms were unchanged; no physical fusion or powered outer test is +established. In the original word exactly one ordered 4+4 pair has matching +intermediate chart and increasing clock, compared with 4,227 ordered 2+2 +pairs. These are incidence counts only: payload availability, common owner, +legal shortcut and displaced readers have not been established. [Derivation, +source bindings and controls](CURVATURE.md). + +## Individual downward feedback rigidity + +At any one of the 27 native downward logical slots, keep all other interior +instructions and incidences fixed but allow the replacement bit to be an +arbitrary deterministic function of all binary inputs and every terminal +chart to decode its full history freely. The received bit must equal the +native bit or its globally known complement. Two distinct terminal charts, +each with three observations and jointly independent histories, witness each +claim. This single-slot theorem does not prohibit coordinated changes to +several slots or interior computations. + +For each slot, a separate screen grants every strictly cheaper existing sender +and the destination their entire zeroed-receipt histories, even future arrivals. +None of the **4,643** candidate sender–slot pairs can determine the required +native bit. This overgrant includes geometrically incomparable sources. A +second implementation independently replays all 27 zeroed words, computes the +stock exclusions using low-pivot elimination and checks both 256-entry Boolean +truth tables for each witness pair. The result excludes a cheaper single +sender with the same destination in this fixed-suffix model; it does not prove +a global 63-unit downward lower bound. [Proof and exact scope](FEEDBACK-RIGIDITY.md). + +## Sharp success probability on the relay schedule + +The #8041 diagnostic changes the contact at clock 8075 from 326 → 1 to +531 → 1. By clock 10141 chart 531 has two incoming bits but sends three bits +to chart 1. Chart 1 has 502 other arrivals and 505 independent required final +bits. Even with arbitrary deterministic causal binary encoders and decoders, +the combined transcript has at most 504 bits, so the entire native map can be +correct on at most half of uniformly distributed constant binary inputs. +The literal relay attains that bound: its error is `s (r·x)` for nonzero `s` +and the specified 27-coordinate residual `r`, so correctness is exactly the +629-dimensional hyperplane `r·x = 0`. + +For `k ≥ 1` jointly encoded copies and `m ≥ 0` extra input-dependent one-bit +messages on fixed, input-independent routes and times, the sharp success +fraction in the stated side-information model is `2^(-max(0,k-m))`. The +upper bound grants all side-message values to the decoder; the attaining +construction grants the missing residual bit as an **oracle** to chart 531 +for each corrected copy. Physical delivery and price of that oracle remain +open. The theorem's binary scalar restriction and full proof are in +[INFORMATION-PROOF.md](INFORMATION-PROOF.md); it is not a claim against +address-dependent nonconstant field packing. + +## An exact graph repair and its limits + +The changed word keeps the shortened 8075 contact and recodes the later +10138 receipt, 3152 path and 3298 chain. The 124 source-clock edits in [EXACT-EDITS.json](EXACT-EDITS.json) and +[REPAIR-PROOF.md](REPAIR-PROOF.md) yield all **630 of 630** original normalized +forward rows and their exact replayed transposes. Rational projectors certify +the five changed nesting relationships. A corruption of the 3298 repair fails +row 117. All 3,433 private clear values remain nonzero; four clear values +change and a fifth owner's clear moves from chart 8 to chart 0. + +The paid contact count stays 2,803. Its histogram trades one rank-five for one +rank-six contact; total rank rises **one**, rather than falling. The graph +identity alone does not prove physical erasure, live stock, general-field +adjoints, a compiler, the complete 36-call inventory, or either signed +supplier's outer application. It does not establish an improved κ. + +## Relation to earlier work + +- [#8036](https://github.com/CrocSwap/integer-mult-bounds/pull/8036) studies + chart-510's two-export deletion and its residual recovery. Here the graded + cuts cover all chart dimensions, and the constructive word uses the separate + 326/531 relay. +- [#8037](https://github.com/CrocSwap/integer-mult-bounds/pull/8037) prices + single co-endpoint helper hyperplanes with surviving traffic fixed. Here the + cut allows arbitrary retained-message recoding and the repair changes + incidences and sender equations on the unrestricted binary domain. +- [#8038](https://github.com/CrocSwap/integer-mult-bounds/pull/8038) screens + fixed-clock two-hop shortcuts. The new two-chart cut survives arbitrary + retiming, while the repair changes multiple original operations. +- [#8041](https://github.com/CrocSwap/integer-mult-bounds/pull/8041) gives the + fixed chart-1 cut and the relay with an unpriced residual oracle. This result + supplies all dimension cuts, the sharp joint-copy information theorem and a + fully explicit normalized repair with its actual extra rank and clear diffs. + +The external #8027 source and #8041 lineage are pinned in [SOURCES.json](SOURCES.json). +The verifier authenticates the embedded bytes and Git blob, not the external +publication ancestry; the archive does not contain that source Git history. +The separately retained five-file prerequisite `0618e75a22cec54d1651394ef83d088551b7f026` +addresses repository CI guide and historical replay issues; it is not evidence +for these mathematical claims. + +## Reproduce + +Using Python 3.12 and only the standard library, from the repository root: + +```sh +python3.12 -I -B scripts/research_package.py --package research/p104-graded-cut-relay-repair +``` + +The registered command authenticates the one vendored graph and all checked +scripts, compares eight deterministic receipts, and exercises damaged-source, +damaged-receipt, witness, rank-preserving histogram and incidence controls, +plus wrong-oracle, missing-ADD and cut-restoration controls. The +checks include independent forward and transpose replays. They do not provide +an independent human review. For individual commands see the proof files. + +## Open next questions + +- Can this normalized repair satisfy the physical clear, stock, lifetime and + general-field contracts? Implement the named changes in the real compiler, + audit the five changed clears and both field orientations, then price the + actual paired caller. These obligations are not supplied here. +- Can a different causal, endpoint-compatible roster realize a favorable part + of the powered interval relaxation while respecting all other cuts and the + full signed invoices? Begin with specific contacts and clocks; the relaxed + optimum alone does not supply them. +- Can the relay residual be delivered without an extra net cost? Bind an + actual source, route, clock and displaced reader. The oracle supplies no + physical route. + +## Attribution + +Ali Romman supplied the graph and physical supplier. ToikY nominated the +chart-510 site, DreamingOfClouds supplied the #7852 toolkit, and Clear1nsight +prepared this follow-up with substantial OpenAI Codex assistance. The retained +predecessor credits are in [PARENT-NOTICE](PARENT-NOTICE); see +[NOTICE.md](NOTICE.md) and [LICENSE](LICENSE). diff --git a/research/p104-graded-cut-relay-repair/REPAIR-PROOF.md b/research/p104-graded-cut-relay-repair/REPAIR-PROOF.md new file mode 100644 index 0000000000..0e16d26611 --- /dev/null +++ b/research/p104-graded-cut-relay-repair/REPAIR-PROOF.md @@ -0,0 +1,53 @@ +# A complete normalized relay repair + +All clocks are zero-based indices in the unmodified 39,600-instruction #8027 +program. The following is a literal recipe, with every change anchored against +that program. The verifier checks all anchors, final owner locations, and all +630 input-to-output rows. Computation is over normalized scalar linear forms +on 630 independent binary inputs; it is not a physical field implementation. + +1. Remove the ADDs at 8070 and 8071. Initialize owner 2327 at chart 531 at + 8073, add 2326 to it there at 8074, and send it 531 → 1 at 8075. These are + the #8041 diagnostic edits and retain the old 2327 receipt. +2. At 10136 initialize 2862 at chart 326, add owner 2224 at 10137, and move it + 326 → 1 at 10138. Immediately after this MOVE add owner 2861 into 2862 at + chart 1. This restores all 505 final chart-1 outputs; row 117 remains wrong. +3. Change 3152's MOVE at 11022 from 328 → 8 to 328 → 0. Omit the old 11025 + ADD into 3153 at chart 8. Immediately after its 11026 MOVE from 8 → 0 add + 3152 into 3153 at chart 0. +4. At 19845 initialize 3298 at chart 0, then ADD owners 117, 3152, and 3153 + into 3298 in that order. Omit the original instructions at 19846 through + 19951 inclusive. Omit original ADDs at 19954, 19958, 19959, 30079 and + 30080. Change the 39319 CLEAR of owner 3152 to chart 0. All other original + instructions retain their order and operands. The complete expected old + instruction and replacement list is [EXACT-EDITS.json](EXACT-EDITS.json). + +The intermediate partial word fails only output 117. Dropping the ADD of 3152 +at step 4 is a deliberate corruption and again fails exactly row 117. The full +word returns every native row and the independent reverse execution returns +its exact transpose. The five rational projector containments of all changed +endpoints are checked. This establishes the stated graph identity for every +input of the normalized binary model, not merely a finite sample of vectors. + +The 2,803 paid scalar contacts remain. The complete one-word histogram changes +from 29 rank-five and 81 rank-six to 28 rank-five and 82 rank-six contacts; +all other rank counts agree. Thus the total rank rises by one. In particular, +3152's changed downward contact accounts for the extra rank unit. This word is +not a one-rank saving. Its powered cost must be evaluated in a complete caller. + +All 3,433 private CLEAR values remain symbolically nonzero. Exactly five +records change relative to the native normalized trace: + +| Owner | Old chart | New chart | Value changed | +|---|---:|---:|---| +| 2326 | 531 | 531 | yes | +| 3152 | 8 | 0 | no | +| 3298 | 7 | 7 | yes | +| 3299 | 330 | 330 | yes | +| 3300 | 531 | 531 | yes | + +These are dirty records, not proven restorations. The replay does not prove the +physical register lifecycle, erasure, general-field adjoint, compiler, actual +36-call inventory, positive supplier, signed analytic application, or a new +κ. The full exact receipt, including the corruption's residual support and the +paid histograms, is [REPAIR.json](REPAIR.json). diff --git a/research/p104-graded-cut-relay-repair/REPAIR.json b/research/p104-graded-cut-relay-repair/REPAIR.json new file mode 100644 index 0000000000..d2f5ed6dab --- /dev/null +++ b/research/p104-graded-cut-relay-repair/REPAIR.json @@ -0,0 +1,201 @@ +{ + "adjoint_matches_original": true, + "changed_private_clear_values_or_charts": { + "2326": { + "new_chart": 531, + "old_chart": 531, + "value_changed": true + }, + "3152": { + "new_chart": 0, + "old_chart": 8, + "value_changed": false + }, + "3298": { + "new_chart": 7, + "old_chart": 7, + "value_changed": true + }, + "3299": { + "new_chart": 330, + "old_chart": 330, + "value_changed": true + }, + "3300": { + "new_chart": 531, + "old_chart": 531, + "value_changed": true + } + }, + "corrupt_control_117_delta_support": [ + 0, + 3, + 5, + 9, + 11, + 14, + 15, + 20, + 21, + 23, + 25, + 26, + 28, + 30, + 31, + 36, + 37, + 39, + 41, + 42, + 44, + 49, + 50, + 51, + 53, + 55, + 57, + 61, + 62, + 63, + 68, + 69, + 72, + 73, + 74, + 77, + 78, + 83, + 85, + 87, + 88, + 89, + 92, + 93, + 97, + 99, + 101, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 222, + 230, + 246, + 251, + 270, + 271, + 277, + 281, + 283, + 286, + 292, + 303, + 310, + 313, + 315, + 321, + 334, + 337, + 347, + 351, + 362, + 365, + 367, + 386, + 395, + 396, + 406, + 415, + 424, + 428, + 437, + 444, + 445, + 452, + 457, + 459, + 460, + 463, + 466, + 471, + 474, + 523, + 529, + 535, + 564, + 595 + ], + "corrupt_control_wrong_rows": [ + 117 + ], + "corrupted_source_rejected": true, + "exact_public_rows": 630, + "expanded_sha256": "b096d6df2a0c4688296b13ab0cfd50fec1c7dec732819c624ddd7a745a144b69", + "fault_wrong_rows": [ + 0, + 11, + 117, + 223, + 224, + 230, + 249, + 250, + 251 + ], + "new_paid_histogram": { + "1": 1348, + "2": 1247, + "3": 55, + "4": 42, + "5": 28, + "6": 82, + "7": 1 + }, + "one_word_paid_count": 2803, + "one_word_rank_sum_delta": 1, + "original_paid_histogram": { + "1": 1348, + "2": 1247, + "3": 55, + "4": 42, + "5": 29, + "6": 81, + "7": 1 + }, + "output_rank": 630, + "partial_exact_chart1_outputs": 505, + "partial_wrong_rows": [ + 117 + ], + "private_clears": 3433, + "projector_nesting_checked": [ + [ + 326, + 531 + ], + [ + 531, + 1 + ], + [ + 326, + 1 + ], + [ + 0, + 328 + ], + [ + 8, + 328 + ] + ], + "scope": "All-input normalized F2 linear 630-output local graph. No physical, caller, or bound claim.", + "source_sha256": "74e93daf2b7acf794ffb51f92f03f51556f68126d41ee13a8969bddb4cbe6326", + "symbolically_dirty_clears": 3433 +} diff --git a/research/p104-graded-cut-relay-repair/SOURCES.json b/research/p104-graded-cut-relay-repair/SOURCES.json new file mode 100644 index 0000000000..96c2db4eb2 --- /dev/null +++ b/research/p104-graded-cut-relay-repair/SOURCES.json @@ -0,0 +1,106 @@ +{ + "schema_version": 1, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "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" + }, + { + "path": "research/paired-query-only-bit/EFREE-CALLER.json.gz", + "usage": "provenance", + "git_blob": "f022272a8d51ede841778dec76e2bfb24b614d04", + "sha256": "757b3523798f840bdb02028b23708c3416627a99ea09e7a3c4bcdc5cd0c7ce4b" + } + ], + "vendored_graph": { + "repository": "https://github.com/aliromman/integer-mult-bounds", + "pull_request": 8027, + "head": "fb9b6a7b0d27da1cf98430893a3016bf811e2aa4", + "path": "research/p104-live-relative-gain/BINARY-CANDIDATE.json.gz", + "local_path": "pinned/strong-bit.json.gz", + "git_blob": "16f8cafb1c4d139a99a62e46eb40c118e6176c34", + "sha256": "74e93daf2b7acf794ffb51f92f03f51556f68126d41ee13a8969bddb4cbe6326", + "expanded_sha256": "b096d6df2a0c4688296b13ab0cfd50fec1c7dec732819c624ddd7a745a144b69", + "provenance_note": "External PR bytes are vendored unchanged and checked by blob and SHA-256; this package does not contain full source Git history." + }, + "mathematical_dependencies": [ + { + "pr": 8027, + "head": "fb9b6a7b0d27da1cf98430893a3016bf811e2aa4", + "use": "literal source graph, output binding and frames" + }, + { + "pr": 8041, + "head": "05f6172d4d9487090fa24c75137a7c60e6fcd67e", + "use": "predecessor literal relay, chart-1 cut and oracle diagnostic; graph bytes match its retained copy" + }, + { + "pr": 8036, + "head": "99878b566bfcce80ef7ae2650a1231a203361445", + "use": "prior chart-510 two-export deletion and side-information analysis" + }, + { + "pr": 8037, + "head": "112fc71da5477c108764bf488eafa7eab8dd6268", + "use": "prior single co-endpoint helper hyperplane screen" + }, + { + "pr": 8038, + "head": "da5cae2eb54cccb04ef798b3cfda574dcb9eec5e", + "use": "prior fixed-clock two-hop shortcut screen" + }, + { + "pr": 8030, + "head": "6285dd829114705862e8d91facaedc1f31d3cfcb", + "use": "paired single-band caller lineage; the vendored caller is independently pinned at the declared base" + } + ], + "ci_prerequisite": { + "commit": "0618e75a22cec54d1651394ef83d088551b7f026", + "base": "e54523517d0f03e58352e647c403a5af3e525a57", + "description": "Separate five-file selected-CI guide and historical replay prerequisite; not part of the mathematical proof." + }, + "retained_files_sha256": { + "LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "PARENT-NOTICE": "b213998c8dae6d88e4a1f0fd17c81dd78c31ef35bc9460fa16ca692326f1a02b", + "NOTICE.md": "15a383df379e062c005cd1f67b04e73f2f235b30bafe89ccb7ef673f7303745f", + "dimension_cuts.py": "9ce72736838a097320b1cb213b09601273fec5fdfb40966958bcf1d9c37b8fe3", + "DIMENSION-CUTS.json": "ebb1a31a6e85aee298f5ad0d21168ec2d48aed0a7f52f3a0f7c5a7d2d41ba90e", + "grade_price.py": "d1b15db0625855e18f64fecc87e037a635da3cd9413e55c22157ab5c51b6873c", + "GRADE-PRICE.json": "f0707455c18e4ec868b81c2eb13ea06de5facbf7c2ceda465348d7ad39d91901", + "feedback_rigidity.py": "25c7e490ecb678e84c782c61163b61b3428a25497b2ca5b23146130dc5dc19fd", + "FEEDBACK-RIGIDITY.json": "3a648032d227705d3440b52455450a39cd067b98daaf69ccc2c07e3ae1a58410", + "feedback_independent.py": "f3d3788407294b8416c138632c15f7fc73fd7a51006709c2477c84151d80dc7c", + "FEEDBACK-INDEPENDENT.json": "d65d2f6b6ebcf27b4f45606d8e7cc069958140ee0a353fc158357ebd16478b3f", + "information.py": "5ced620536a94181430cae9d063b23475bc92c15c7d8fda55d820caa18e4a650", + "INFORMATION.json": "6809b6ac0e96b1f0316bb5646731b89c5739f5cb8647c4f05db796071b19813d", + "repair.py": "e4de1ec7eb18a7203b1ac1ee2b0affb42ca0dc381289359257b43fdcb18b71ef", + "REPAIR.json": "5613b070541804d66e074909d597ec18031f3a5505af861f6ff63ca03f7c8e88", + "EXACT-EDITS.json": "414622da5c258317187eabdfc5028dced7dbb2c3cc8e80d8b4f2a592ac46fdc8", + "frozen_replay.py": "4f1987e2b50696100cd4279e297a69532c6664aff08c9f449b5208a5db47d408", + "FROZEN-REPLAY.json": "c36f185f66184cd1d861dcf425e855ba6d36c99269a5851042c6fc6d9c47a697", + "verify.py": "64662300b15689272e955a6a0553e587e77675f5fcbef25d31450bff44f33a8d", + "pinned/strong-bit.json.gz": "74e93daf2b7acf794ffb51f92f03f51556f68126d41ee13a8969bddb4cbe6326", + "curvature.py": "60cceec9033fa8d099b343cadd4726b6099dabd9306087eb77741ad1ae332c86", + "CURVATURE.json": "de2d7c008b2fab2f2fbd1b5ecb1d58fe87400dd67da9adfd24639880f691b44d", + "pinned/EFREE-CALLER.json.gz": "757b3523798f840bdb02028b23708c3416627a99ea09e7a3c4bcdc5cd0c7ce4b" + }, + "vendored_caller": { + "repository": "CrocSwap/integer-mult-bounds", + "head": "e54523517d0f03e58352e647c403a5af3e525a57", + "path": "research/paired-query-only-bit/EFREE-CALLER.json.gz", + "local_path": "pinned/EFREE-CALLER.json.gz", + "git_blob": "f022272a8d51ede841778dec76e2bfb24b614d04", + "sha256": "757b3523798f840bdb02028b23708c3416627a99ea09e7a3c4bcdc5cd0c7ce4b", + "usage": "Reconstruct the unchanged 36-call binary raw target and paid histograms; no changed caller is supplied." + } +} diff --git a/research/p104-graded-cut-relay-repair/TASK.json b/research/p104-graded-cut-relay-repair/TASK.json new file mode 100644 index 0000000000..9770365e8c --- /dev/null +++ b/research/p104-graded-cut-relay-repair/TASK.json @@ -0,0 +1,99 @@ +{ + "schema_version": 1, + "task_id": "selected-stock-envelope", + "priority_revision": 8, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "original_card": { + "id": "selected-stock-envelope", + "question": "What explicit uniform stock envelope does the actual selected stopped producer supply at one bootstrap stage?", + "starting_points": [ + "research/selected-bootstrap-stock-audit/README.md", + "research/bootstrap-cutoff-time-space-split/README.md", + "certificates/selected-result.json", + "docs/research/community-efficient1000-review.md", + "research/stock-margin-chain/README.md" + ], + "methods": [ + "Derive a source-bound reserve recurrence at the actual selected atom widths, separating parent stock from completed inner borrowing.", + "Find an exact missing implication or counterexample to a proposed selected-stage stock envelope." + ], + "acceptance_gate": "Bind every coefficient and depth factor to the selected producer and state the width domain. Compare a proved envelope with the sufficient cutoff guard; a large numerical headroom or a historical m=120 coefficient is not a selected m=73 proof.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Resolve the current selected review, separate complex/ordinary BIT/admitted BIT/outer budgets, and compare the card against live handoffs before starting. Historical ceilings require exact source/model equivalence.", + "scope": "Source-binding orientation only; not a scientific replay or all-size proof. Materialize selected inputs if this checkout is sparse." + }, + "first_experiment": "Choose one actual selected producer/stage and derive its parent reserve and depth coefficient from source. Check whether newer handoffs already cover that exact obligation. Stop with the missing implementation lemma if it cannot be bounded; do not rerun #2972 cutoff/headroom arithmetic as a new contribution.", + "bottleneck_link": "This reduces a concrete inherited implementation obligation without confusing unchanged kappa arithmetic with a completed theorem.", + "allowed_variations": [ + "One stage or one explicit reserve/depth implication.", + "An independently checked same-domain proof repair, retaining all remaining assumptions." + ], + "scope_change_triggers": [ + "Importing the historical 57604 or 252 allowance without a selected-producer binding.", + "Calling a conditional fit lemma a full outer-proof adoption.", + "Replacing an actual selected stock coefficient with cutoff comparisons or a conditional fit inequality." + ], + "overlap_terms": [ + "selected stock", + "stock envelope", + "bootstrap cutoff", + "1956", + "1965", + "1990", + "2972", + "stock-margin-chain", + "actual_stock_coefficient" + ], + "existing_checks": [ + { + "scope": "Retained stock audit identifies missing actual selected-stage coefficients; later cutoff-chain arithmetic does not supply them.", + "evidence": "docs/research/research-family-status.md#revision-6-handoffs-source-archives-awaiting-independent-validation", + "remaining": "Derive one actual reserve/depth coefficient from the selected producer.", + "status": "reviewed", + "source_commit": "836b19bfa309ceafbc8ee32a15e8c4b10dde7e11", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + } + ] + }, + "scope_status": "changed", + "scope_change_reason": "The assigned follow-up studies saturated graded information cuts and an explicit local relay repair on the #8027 P104 word, rather than the selected bootstrap stock envelope.", + "actual_scope": "Establish sharp dimension and hub cuts, exact powered interval price and its discrete-curvature decomposition, a bounded-fusion raw price filter, fixed-suffix feedback rigidity, sharp relay information loss, and an explicit normalized 630-row repair with paid and clear differences.", + "bottleneck_link": "Any useful paid change must carry enough information across the saturated receiver and dimension cuts and must still pass the physical and complete caller invoices.", + "stop_rule": "Bind the exact source; prove the information bounds; reproduce independent forward and transpose replays and meaningful source, receipt and repair-corruption controls.", + "outcome": "completed", + "evidence": "README.md, DIMENSION-CUTS.md, GRADE-PRICE.md, CURVATURE.md, FEEDBACK-RIGIDITY.md, INFORMATION-PROOF.md, REPAIR-PROOF.md, deterministic receipts and the registered replay.", + "author": "Clear1nsight", + "ai_assistance": "Substantial OpenAI Codex assistance in research, proof, implementation, arithmetic and documentation.", + "open_questions": [ + { + "question": "Can a fully physical relay repair satisfy the original clear, stock, and register-lifetime contract at a lower total powered cost?", + "why_it_matters": "The displayed all-input normalized repair changes five dirty clear records and has one higher paid rank unit.", + "first_step": "Implement the changed word in the physical compiler and audit each altered clear, both field operators, and the complete paired caller.", + "blocked_by": "A real erasure, stock and caller proof has not been supplied." + }, + { + "question": "Can grade-preserving fusions or a changed contact topology reduce the concave powered invoice without violating every saturated information cut?", + "why_it_matters": "The 4,750 lower bound controls upward rank sum, not the sum of rank powers or downward costs.", + "first_step": "Name the complete incidences and clocks, derive their target cuts and compare the full signed supplier invoice.", + "blocked_by": "No admitted physical construction with favorable complete invoice is known." + }, + { + "question": "Can the required relay side bit be delivered at no extra net cost in a legal changed schedule?", + "why_it_matters": "The fixed-schedule half-success theorem is sharp and identifies one missing scalar per copy.", + "first_step": "Bind an input-dependent message to a source and clock, reproduce all outputs and repair displaced reads.", + "blocked_by": "The oracle construction does not supply or price a physical route." + }, + { + "question": "Can the original 0\u2192509\u21921 rank-four incidence pair support any legal 4+4 fusion after accounting for live histories and displaced readers?", + "why_it_matters": "A 4+4 fusion has the maximum per-contact saving among rank-sum-at-most-eight pairs, but the original census only establishes matching charts and time order.", + "first_step": "Trace both named owners and the first surviving readers at clocks 7112 and 7210, then construct or refute a source-bound replacement and price any repair.", + "blocked_by": "No readable common payload or full changed caller has yet been established." + } + ] +} diff --git a/research/p104-graded-cut-relay-repair/VERIFY.json b/research/p104-graded-cut-relay-repair/VERIFY.json new file mode 100644 index 0000000000..a1ecf2485b --- /dev/null +++ b/research/p104-graded-cut-relay-repair/VERIFY.json @@ -0,0 +1,19 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 600, + "checks": "Authenticate the #8027 graph and paired caller; replay saturated cuts, the exact interval and curvature price decompositions, bounded-fusion raw price and incidence counts, 27 fixed-suffix feedback sites with independent low-pivot audit, the relay information controls and the explicit 630-row repair and transpose; reject corrupted sources, witnesses, histogram, incidences and repair." + } + ] +} diff --git a/research/p104-graded-cut-relay-repair/curvature.py b/research/p104-graded-cut-relay-repair/curvature.py new file mode 100644 index 0000000000..dd7b5013a5 --- /dev/null +++ b/research/p104-graded-cut-relay-repair/curvature.py @@ -0,0 +1,217 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Exact discrete-curvature audit and conditional rank-fusion budget. + +All power evaluations use grade_price.py's outward dyadic-root enclosures. +The baseline full binary invoice is rebuilt from the authenticated native word +and the pinned paired caller; this does not validate a changed physical caller. +""" +from collections import Counter, defaultdict +from fractions import Fraction as Q +from hashlib import sha256 +import gzip +import importlib.util +import json +from pathlib import Path +import sys + +HERE = Path(__file__).resolve().parent +GRAPH_SHA = '74e93daf2b7acf794ffb51f92f03f51556f68126d41ee13a8969bddb4cbe6326' +GRAPH_RAW_SHA = 'b096d6df2a0c4688296b13ab0cfd50fec1c7dec732819c624ddd7a745a144b69' +CALLER_SHA = '757b3523798f840bdb02028b23708c3416627a99ea09e7a3c4bcdc5cd0c7ce4b' +TARIFF_SHA = 'd1b15db0625855e18f64fecc87e037a635da3cd9413e55c22157ab5c51b6873c' +T = 1 - Q('0.00389046') +TARGET = {4:612, 8:14520, 15:444, 22:444, 29:444, 36:444, + 43:444, 50:444, 57:444, 64:444, 127:222} +PAID = {1:48972, 2:44892, 3:1980, 4:1512, 5:1044, 6:2916, 7:480, + 14:444, 21:444, 28:444, 35:444, 42:444, 49:444, 56:444} +EXPECTED_DIFFERENCES = [2149,2967,2539,2067,1554,1020,505] +RELAXED = Counter({8:505, 7:11, 6:100, 3:11}) + + +def tariff(): + path = HERE / 'grade_price.py' + assert sha256(path.read_bytes()).hexdigest() == TARIFF_SHA + spec = importlib.util.spec_from_file_location('p104_curvature_tariff', path) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def read_graph(path): + raw = Path(path).read_bytes() + assert sha256(raw).hexdigest() == GRAPH_SHA + expanded = gzip.decompress(raw) + assert sha256(expanded).hexdigest() == GRAPH_RAW_SHA + return json.loads(expanded) + + +def read_caller(path): + raw = Path(path).read_bytes() + assert sha256(raw).hexdigest() == CALLER_SHA + return json.loads(gzip.decompress(raw)) + + +def prices(ranks): + power = tariff().price + return {0:(Q(0),Q(0)), **{r:power(r,T) for r in sorted(set(ranks)) if r}} + + +def moment(hist, values): + assert all(isinstance(n,int) and n >= 0 and r > 0 for r,n in hist.items()) + return tuple(sum(n*values[r][i] for r,n in hist.items()) for i in (0,1)) + + +def raw_surplus(target, paid, values): + a,b=moment(target,values); c,d=moment(paid,values) + return a-d,b-c + + +def h_values(hist, maximum): + return [sum(n*max(r-j,0) for r,n in hist.items()) for j in range(1,maximum)] + + +def validate_profiles(native, relaxed): + assert all(isinstance(n,int) and n>=0 and 1<=r<=8 for h in (native,relaxed) + for r,n in h.items()) + assert sum(r*n for r,n in native.items()) == sum(r*n for r,n in relaxed.items()) == 4750 + hn,hr=h_values(native,8),h_values(relaxed,8) + differences=[y-x for x,y in zip(hn,hr)] + assert differences == EXPECTED_DIFFERENCES + return hn,hr,differences + + +def dimensions(g): + return {int(c):s['dim'] for c,s in g['frames'].items()} + + +def reconstruct_invoice(g,caller): + dim=dimensions(g); ports=caller['ports']; rank=caller['body_rank'] + local=sum(x[0]=='LOCAL' for x in caller['events']) + assert (ports,rank,local)==(111,7,36) + target,paid=Counter(),Counter() + for row in caller['diagonal']: + target[1+rank*len(row['stages'])]+=ports + for src,dst in zip(g['start'][2*ports:],g['final'][2*ports:],strict=True): + target[abs(dim[dst]-dim[src])]+=local + for row in g['program']: + if row[0]=='MOVE':paid[abs(dim[row[3]]-dim[row[2]])]+=local + for row in caller['events']: + if row[0]=='QUERY':paid[1]+=ports + elif row[0]=='IDLE_ONE':paid[len(row[2])*rank]+=ports + assert dict(target)==TARGET and dict(paid)==PAID + assert sum(target.values())==18906 and sum(paid.values())==104904 + assert sum(r*n for r,n in paid.items())==285600 + return target,paid + + +def native_upward(g): + dim=dimensions(g);h=Counter() + for row in g['program']: + if row[0]=='MOVE': + diff=dim[row[3]]-dim[row[2]] + if diff>0:h[diff]+=1 + return h + + +def ordered_contacts(g): + """Original chronological chart incidences only; not necessarily usable.""" + dim=dimensions(g);past=defaultdict(list);counts=Counter();fours=[] + for clock,row in enumerate(g['program']): + if row[0]!='MOVE':continue + _,owner,src,dst=row;grade=dim[dst]-dim[src] + if grade<=0:continue + for t0,o0,s0,g0 in past[src]: + if g0+grade>8:continue + counts[(g0,grade)]+=1 + if (g0,grade)==(4,4): + fours.append({'first_clock':t0,'first_owner':o0,'first_source':s0, + 'hinge_chart':src,'second_clock':clock, + 'second_owner':owner,'second_destination':dst}) + past[dst].append((clock,owner,src,grade)) + assert counts[(2,2)]==4227 and counts[(4,4)]==1 + assert fours == [{'first_clock':7112,'first_owner':2241,'first_source':0, + 'hinge_chart':509,'second_clock':7210,'second_owner':2252, + 'second_destination':1}] + return counts,fours + + +def text_bounds(pair, digits=18): + scale=10**digits + def fmt(n): + sign='-' if n<0 else '';n=abs(n) + return f'{sign}{n//scale}.{n%scale:0{digits}d}' + return [fmt((pair[0]*scale).__floor__()),fmt((pair[1]*scale).__ceil__())] + + +def overlaps(a,b): + return max(a[0],b[0]) <= min(a[1],b[1]) + + +def check(graph_path,caller_path): + assert not sys.flags.optimize + graph=read_graph(graph_path);caller=read_caller(caller_path) + native=native_upward(graph) + hn,hr,diff=validate_profiles(native,RELAXED) + target,paid=reconstruct_invoice(graph,caller) + counts,fours=ordered_contacts(graph) + vals=prices(set(range(1,58))|set(target)|set(paid)) + w={j:(2*vals[j][0]-vals[j-1][1]-vals[j+1][1], + 2*vals[j][1]-vals[j-1][0]-vals[j+1][0]) for j in range(1,57)} + assert all(a>0 and a<=b for a,b in w.values()) + # Check the discrete identity on every unit rank through the full paid + # caller's maximum rank 56; linearity then covers every integer histogram. + for r in range(1,57): + lo=Q(r)-sum((r-j)*w[j][1] for j in range(1,r)) + hi=Q(r)-sum((r-j)*w[j][0] for j in range(1,r)) + assert overlaps((lo,hi),vals[r]) + components=[(n*w[j][0],n*w[j][1]) for j,n in enumerate(diff,1)] + total=(sum(x[0] for x in components),sum(x[1] for x in components)) + no=moment(native,vals); rel=moment(RELAXED,vals) + assert overlaps(total,(no[0]-rel[1],no[1]-rel[0])) + assert Q('25.059996283598193') < total[1] and total[0] < Q('25.059996283598194') + hp=h_values(paid,56);base_rank=sum(r*n for r,n in paid.items()) + full_identity=(Q(base_rank)-sum(hp[j-1]*w[j][1] for j in range(1,56)), + Q(base_rank)-sum(hp[j-1]*w[j][0] for j in range(1,56))) + assert overlaps(full_identity,moment(paid,vals)) + # Exact intervals certify the best sum<=8 fusion at the target. The + # all-t analytic statement follows separately from concavity/homogeneity. + def fusion(a,b): + return (vals[a][0]+vals[b][0]-vals[a+b][1], + vals[a][1]+vals[b][1]-vals[a+b][0]) + best=fusion(4,4) + for a in range(1,8): + for b in range(1,9-a): + if (a,b)!=(4,4):assert fusion(a,b)[1]0 + def changed(m): + result=paid.copy();result[4]-=2*m;result[8]+=m + assert min(result.values())>=0 + assert sum(r*n for r,n in result.items())==base_rank + return raw_surplus(target,result,vals) + six,seven=changed(6),changed(7) + assert six[1]<0 and seven[0]>0 + assert overlaps(six,(baseline[0]+6*best[0],baseline[1]+6*best[1])) + assert overlaps(seven,(baseline[0]+7*best[0],baseline[1]+7*best[1])) + return { + 'source_graph_sha256':GRAPH_SHA,'source_caller_sha256':CALLER_SHA, + 'target_kappa':'0.00389046','exponent_t':str(T), + 'upward_rank_sum':4750,'native_h':hn,'relaxed_h':hr,'relaxed_minus_native_h':diff, + 'component_discount_enclosures':[text_bounds(x) for x in components], + 'total_relaxation_gap':text_bounds(total), + 'maximum_rank_sum_8_fusion':{'ranks':[4,4],'saving':text_bounds(best)}, + 'full_binary_caller_paid_count':sum(paid.values()),'full_binary_caller_rank_sum':base_rank, + 'conditional_baseline_raw_surplus':text_bounds(baseline), + 'six_best_fusions_raw_surplus':text_bounds(six), + 'seven_best_fusions_raw_surplus':text_bounds(seven), + 'original_ordered_incidence_counts':{'4+4':counts[(4,4)],'2+2':counts[(2,2)]}, + 'only_4_plus_4_original_incidence_pair':fours[0], + 'scope':'Price and chronological chart-incidence only; no readable fusion, physical supplier, powered outer test, or kappa improvement claimed.' + } + + +if __name__=='__main__': + print(json.dumps(check(sys.argv[1],sys.argv[2]),indent=2,sort_keys=True)) diff --git a/research/p104-graded-cut-relay-repair/dimension_cuts.py b/research/p104-graded-cut-relay-repair/dimension_cuts.py new file mode 100644 index 0000000000..6c2c812852 --- /dev/null +++ b/research/p104-graded-cut-relay-repair/dimension_cuts.py @@ -0,0 +1,86 @@ +"""Certify the sharp total upward grade and two-chart sink cuts of #8027.""" +from collections import Counter +import gzip +from hashlib import sha256 +import json +from pathlib import Path +import sys + +GZIP_SHA='74e93daf2b7acf794ffb51f92f03f51556f68126d41ee13a8969bddb4cbe6326' +RAW_SHA='b096d6df2a0c4688296b13ab0cfd50fec1c7dec732819c624ddd7a745a144b69' + + +def rank_by_top(rows): + pivots={} + for r in rows: + while r: + p=r.bit_length()-1 + if p not in pivots: + pivots[p]=r + break + r^=pivots[p] + return len(pivots) + + +def rank_by_column(rows,n): + a=[r for r in rows if r];rank=0 + for i in range(n): + p=next((p for p in range(rank,len(a)) if a[p]>>i & 1),None) + if p is None:continue + a[p],a[rank]=a[rank],a[p] + for j in range(rank+1,len(a)): + if a[j]>>i & 1:a[j]^=a[rank] + rank+=1 + return rank + + +def operator(g): + n=g['public'];vf={i:1<=n and f.pop(d)==a[0];retired+=1;dirty+=bool(vf.pop(d)) + elif op=='SWAP': + s,=a;vf[s],vf[d]=vf[d],vf[s];f[s],f[d]=f[d],f[s] + else:raise ValueError(op) + assert f==dict(enumerate(g['final'])) and retired==dirty==3433 + rows=[vf[i] for i in range(n)] + assert rows==[(1<=j}) for j in range(1,9)} + required=[516,627,627,627,616,616,616,505];assert [c['restricted_target_rank'] for c in layers.values()]==required + assert all(x['slack']==0 for x in layers.values()) + ups=[dims[t]-dims[s] for _,s,t in edges if dims[s]dims[t]] + assert (len(ups),sum(ups),len(downs),sum(downs))==(2776,4750,27,63) + hubs={h:cut(g,rows,edges,{1,h},False) for h,d in sorted(dims.items()) if d==7} + assert len(hubs)==120 and all(c['slack']==0 for c in hubs.values()) + assert hubs[531]==cut(g,rows,edges,{1,531}) and hubs[531]['inside_inputs']==0 and hubs[531]['inbound_contacts']==506 + changed=[(k,531 if k==8075 else s,t) for k,s,t in edges];assert [(s,t) for k,s,t in edges if k==8075]==[(326,1)] + damaged=cut(g,rows,changed,{1,531});assert damaged['slack']==-1 + clean=edges+[(40000,326,531)];positive=cut(g,rows,clean,{1,531});assert positive['slack']==1 + # Restoring the actual external 6->7 contact fixes the cut exactly for the altered topology. + restored=cut(g,rows,changed+[(40000,326,531)],{1,531});assert restored==hubs[531] + # Grade-preserving fusions traversing identical layers are outside the isolated-reduction exclusion. + triple=(6,7,8);assert [int(triple[0]=n + where[i]=None;original[i]=zeroed[i]=0 + elif op=='ADD': + j,c=args;assert where[i]==where[j]==c + original[i]^=original[j];zeroed[i]^=zeroed[j] + elif op=='SWAP': + j,=args + where[i],where[j]=where[j],where[i] + original[i],original[j]=original[j],original[i] + zeroed[i],zeroed[j]=zeroed[j],zeroed[i] + elif op=='MOVE': + a,b=args;assert where[i]==a + if tick==target: + source_before=list(h0[a]);payload=original[i] + assert dim[a]>dim[b] + zeroed[i]=0 + where[i]=b;h0[b].append(original[i]);h1[b].append(zeroed[i]) + else:raise AssertionError(op) + assert where[:n]==g['final'] and all(x is None for x in where[n:]) + assert payload and not add(basis(source_before),payload) + rows=original[:n];zrows=zeroed[:n] + assert rows==[(1<dims[r[3]]] + cases=0; odd=[] + assert len(sites)==len(receipt['certificate'])==27 + for (k, row), item in zip(sites,receipt['certificate']): + _,owner,src,dst=row + assert (k,owner,src,dst)==tuple(item[x] for x in ('clock','owner','source','destination')) + f,h0,h1,outputs,zero=replay(g,k) + affected={g['final'][i] for i,(x,y) in enumerate(zip(outputs,zero)) if x^y} + assert len(affected)==item['odd_terminal_charts'] + odd.append(len(affected)) + pair=item['witness_pair'];joint=[] + for w in pair: + c=w['chart']; obs=h0[c]; suppressed=h1[c] + assert len(obs)==len(suppressed)==3 + joint += obs + deltas=[x^y for x,y in zip(obs,suppressed)] + assert all(d in (0,f) for d in deltas) + shift=sum((x==f)<>x&1 else 0);y=(x&mask).bit_count()%2 + if z in output_by_observation and output_by_observation[z]!=y:ok=False;break + output_by_observation[z]=y + valid+=ok + assert valid==w['recoverable_nonlinear_boolean_functions_out_of_256']==16 + assert pair[0]['chart']!=pair[1]['chart'] and len(basis(joint))==6 + # Grant every candidate and destination their full zeroed histories. + dst_basis=basis(h1[dst]);subcases=0;grade=dims[src]-dims[dst] + assert not add(basis(h1[src]), f) + for c,dim in dims.items(): + if abs(dim-dims[dst])>=grade:continue + b=dst_basis.copy() + for x in h1.get(c,()):add(b,x) + assert add(b,f), (k,c) + subcases+=1 + assert subcases==item['cheaper_dimensions_tested'] + cases+=subcases + assert cases==4643 and sorted(odd)==[55]*15+[63]*12 + result={'source_sha256':SOURCE_SHA,'low_pivot_zeroed_replays':len(sites), + 'full_history_cheaper_sender_exclusions':cases,'positive_native_senders':len(sites), + 'independent_six_observation_pairs':len(sites),'truth_tables_per_witness':256, + 'surviving_local_truth_tables_per_witness':16,'distinct_charts_counts':{'55':15,'63':12}} + return result +if __name__=='__main__':print(json.dumps(check(sys.argv[1],sys.argv[2]),indent=2,sort_keys=True)) diff --git a/research/p104-graded-cut-relay-repair/feedback_rigidity.py b/research/p104-graded-cut-relay-repair/feedback_rigidity.py new file mode 100644 index 0000000000..f2d906a1e5 --- /dev/null +++ b/research/p104-graded-cut-relay-repair/feedback_rigidity.py @@ -0,0 +1,131 @@ +"""Exact native feedback rigidity with arbitrary terminal decoding. Standard library only.""" +from collections import Counter, defaultdict +from hashlib import sha256 +from itertools import combinations +import json +import gzip +from pathlib import Path +import sys + +COMPRESSED='74e93daf2b7acf794ffb51f92f03f51556f68126d41ee13a8969bddb4cbe6326' +EXPANDED='b096d6df2a0c4688296b13ab0cfd50fec1c7dec732819c624ddd7a745a144b69' + + +def bits(x): + while x: + l=x&-x;yield l.bit_length()-1;x^=l + + +class Echelon: + def __init__(self,rows=()): + self.rows={} + for r in rows:self.add(r) + + def add(self,r): + while r: + p=r.bit_length()-1 + if p not in self.rows:self.rows[p]=r;return + r^=self.rows[p] + + def residue(self,r): + for p in sorted(self.rows,reverse=True): + if r>>p & 1:r^=self.rows[p] + return r + + def separator(self,r): + res=self.residue(r) + if not res:return None + z=res&-res + for p,u in sorted(self.rows.items()): + if (z&u).bit_count()%2:z|=1<

=n and ch.pop(d)==a[0];dirty+=bool(v.pop(d)&low) + else:raise ValueError(op) + assert ch==dict(enumerate(g['final'])) and dirty==3433 + assert [v[i]&low for i in range(n)]==[(1<>w&1 else 0);wanted=(w&output_mask).bit_count()%2 + if shifted in answer and answer[shifted]!=wanted:works=False;break + answer[shifted]=wanted + iff=all((perturbation>>w & 1)==(perturbation>>(w^v) & 1) for w in range(size)) + assert works==iff;permitted+=works + assert permitted==1<<(size//2) + return permitted + + +def run(path): + data=Path(path).read_bytes();assert sha256(data).hexdigest()==COMPRESSED + raw=gzip.decompress(data);assert sha256(raw).hexdigest()==EXPANDED;g=json.loads(raw) + n=g['public'];low=(1<dims[r[3]])};assert len(indices)==27 + stock,before,payload,outputs=forward(g,indices);reverse_noise=reverse(g,indices);res=[];checked=0;hash_probes=sha256() + for k,bit in indices.items(): + _,owner,src,dst=p[k];grade=dims[src]-dims[dst];sig=sum(1<>(n+bit)&1) + assert sig==reverse_noise[k] and sig;affected={g['final'][o] for o in bits(sig)};assert len(affected) in (55,63) + tiny=sorted(c for c in affected if len(stock[c])==3) + a,b=next((a,b) for a,b in combinations(tiny,2) if len(Echelon(r&low for r in stock[a]+stock[b]).rows)==6) + witnesses=[] + for c in (a,b): + row=next(o for o in bits(sig) if g['final'][o]==c);u=outputs[row]&low;forms=[r&low for r in stock[c]];shift=sum(((r>>(n+bit))&1)<>(n+bit)&1 else 0) for r in rows) for c,rows in stock.items()} + base=Echelon(suppressed[dst]);assert Echelon(suppressed[src]).residue(f)==0 + cases=0 + for c,dim in sorted(dims.items()): + if abs(dim-dims[dst])>=grade:continue # grant even incomparable projectors of the right dimensions + supply=suppressed.get(c,());sp=Echelon();sp.rows=base.rows.copy() + for r in supply:sp.add(r) + q=sp.separator(f);assert q is not None and all((q&r).bit_count()%2==0 for r in suppressed[dst]+supply) + hash_probes.update(f'{k} {c} {q:x}\n'.encode());cases+=1 + checked+=cases;res.append({'clock':k,'owner':owner,'source':src,'destination':dst,'grade':grade,'odd_terminal_charts':len(affected),'independent_stock_rank':6,'witness_pair':witnesses,'cheaper_dimensions_tested':cases}) + assert Counter(x['odd_terminal_charts'] for x in res)==Counter({55:15,63:12}) + return {'source_sha256':COMPRESSED,'expanded_sha256':EXPANDED,'source_pr':8027,'source_head':'fb9b6a7b0d27da1cf98430893a3016bf811e2aa4','native_feedback_positions':27,'cheaper_sender_cases_even_without_nesting':checked,'positive_native_senders':27,'stock_overgrant':'entire suppressed native transcript of each endpoint, including future receipts','separators_fingerprint_sha256':hash_probes.hexdigest(),'certificate':res} + +if __name__=='__main__':print(json.dumps(run(sys.argv[1]),sort_keys=True,indent=2)) diff --git a/research/p104-graded-cut-relay-repair/frozen_replay.py b/research/p104-graded-cut-relay-repair/frozen_replay.py new file mode 100644 index 0000000000..a2fb347759 --- /dev/null +++ b/research/p104-graded-cut-relay-repair/frozen_replay.py @@ -0,0 +1,131 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Independent list-based interpreter for a source and explicit edit list. + +This checker does not import or call repair.py. The edit list is attached to +original clocks and records the expected old instruction for every edit. +""" +from collections import Counter +import gzip +from hashlib import sha256 +import json +from pathlib import Path +import sys + +ROOT = Path(__file__).resolve().parent +SHA = '74e93daf2b7acf794ffb51f92f03f51556f68126d41ee13a8969bddb4cbe6326' + + +def source(path): + raw = Path(path).read_bytes() + assert sha256(raw).hexdigest() == SHA + return json.loads(gzip.decompress(raw)) + + +def apply(program, doc): + assert doc['source_sha256'] == SHA + indexed = {} + for entry in doc['edits']: + clock = entry['original_clock'] + assert isinstance(clock, int) and 0 <= clock < len(program) + assert clock not in indexed and program[clock] == entry['old'] + indexed[clock] = entry['replacement'] + new = [] + for clock, row in enumerate(program): + new.extend(indexed.get(clock, [row])) + return new + + +def forward(g, program): + where = list(g['start']) + [None] * g['owned_fields'] + vals = [1 << i for i in range(g['public'])] + [0] * g['owned_fields'] + clears = [] + for row in program: + code, i, *a = row + if code == 'INIT': + assert where[i] is None + where[i], vals[i] = a[0], 0 + elif code == 'ADD': + j, c = a + assert where[i] == where[j] == c + vals[i] ^= vals[j] + elif code == 'MOVE': + c, d = a + assert where[i] == c + where[i] = d + elif code == 'SWAP': + j, = a + vals[j], vals[i] = vals[i], vals[j] + where[j], where[i] = where[i], where[j] + elif code == 'CLEAR': + assert where[i] == a[0] and i >= g['public'] + clears.append((i, where[i], vals[i])) + where[i], vals[i] = None, 0 + else: + raise AssertionError(code) + assert where[:g['public']] == g['final'] and all(x is None for x in where[g['public']:]) + return vals[:g['public']], clears + + +def adjoint(g, program): + where = list(g['final']) + [None] * g['owned_fields'] + vals = [1 << i for i in range(g['public'])] + [0] * g['owned_fields'] + for row in reversed(program): + op, i, *a = row + if op == 'INIT': + assert where[i] == a[0] + where[i], vals[i] = None, 0 + elif op == 'CLEAR': + assert where[i] is None + where[i], vals[i] = a[0], 0 + elif op == 'ADD': + j, c = a + assert where[i] == where[j] == c + vals[j] ^= vals[i] + elif op == 'MOVE': + c, d = a + assert where[i] == d + where[i] = c + elif op == 'SWAP': + j, = a + vals[j], vals[i] = vals[i], vals[j] + where[j], where[i] = where[i], where[j] + else: + raise AssertionError(op) + assert where[:g['public']] == g['start'] and all(x is None for x in where[g['public']:]) + return vals[:g['public']] + + +def check(graph_path, edit_path): + assert not sys.flags.optimize + g = source(graph_path) + doc = json.loads(Path(edit_path).read_text()) + original = g['program'] + changed = apply(original, doc) + old_moves = Counter(tuple(r[1:]) for r in original if r[0] == 'MOVE') + new_moves = Counter(tuple(r[1:]) for r in changed if r[0] == 'MOVE') + removed = Counter({(2327,326,1):1, (2862,531,1):1, (3152,328,8):1}) + inserted = Counter({(2327,531,1):1, (2862,326,1):1, (3152,328,0):1}) + assert old_moves - new_moves == removed and new_moves - old_moves == inserted + a, ca = forward(g, original) + b, cb = forward(g, changed) + assert a == b and all(a[i] == (1 << i) ^ ((1 << (i-111)) if 111 <= i < 222 else 0) + for i in range(630)) + assert len(ca) == len(cb) == 3433 and all(x[2] for x in cb) + va, vb = adjoint(g, original), adjoint(g, changed) + assert va == vb and all(((b[j] >> i) & 1) == ((vb[i] >> j) & 1) + for i in range(630) for j in range(630)) + ca = {i:(c,x) for i,c,x in ca} + cb = {i:(c,x) for i,c,x in cb} + changed_clears = sorted(i for i in ca if ca[i] != cb[i]) + assert changed_clears == [2326,3152,3298,3299,3300] + return {'source_sha256': SHA, 'original_records':len(original), + 'edited_records':len(changed), 'original_clock_edits':len(doc['edits']), + 'matched_public_rows':len(b), 'independent_transpose_matches':True, + 'removed_moves':[list(x) for x in sorted(removed)], + 'inserted_moves':[list(x) for x in sorted(inserted)], + 'dirty_clears':len(cb), 'changed_clear_owners':changed_clears} + + +if __name__ == '__main__': + print(json.dumps(check(sys.argv[1], sys.argv[2]), indent=2, sort_keys=True)) diff --git a/research/p104-graded-cut-relay-repair/grade_price.py b/research/p104-graded-cut-relay-repair/grade_price.py new file mode 100644 index 0000000000..3157893417 --- /dev/null +++ b/research/p104-graded-cut-relay-repair/grade_price.py @@ -0,0 +1,99 @@ +"""Exact primal and dual prices for the eight upward dimension cuts. + +Pass the pinned #8027 gzip graph. The incidence inequality itself and the +restricted ranks are checked by dimension_cuts.py in the scientific package. +No native realization of the optimal relaxed interval cover is assumed. +""" +import gzip +import json +from collections import Counter +from fractions import Fraction +from hashlib import sha256 +from math import isqrt +from pathlib import Path +import sys + +SHA='74e93daf2b7acf794ffb51f92f03f51556f68126d41ee13a8969bddb4cbe6326' +F=Fraction +UNIT=1<<128 + + +def price(rank,t): + """Enclose rank^t with monotone dyadic exponents and outward sqrt.""" + bits=72 + assert 0source: + covers.update(range(source+1,target+1)) + tariff[target-source]+=1 + need=[covers[j] for j in range(1,9)] + assert need==[516,627,627,627,616,616,616,505] + order=sorted(range(1,9),key=lambda j:(-need[j-1],j)) + layers=Counter() + for height in range(1,max(need)+1): + inside=tuple(j for j in range(1,9) if need[j-1]>=height) + assert set(inside)==set(order[:len(inside)]) + assert inside==tuple(range(inside[0],inside[-1]+1)) + layers[inside]+=1 + optimum=Counter() + recovered=Counter() + for interval,count in layers.items(): + optimum[len(interval)]+=count + for j in interval: + recovered[j]+=count + assert recovered==covers + assert optimum=={8:505,7:11,6:100,3:11} + assert sum(r*n for r,n in optimum.items())==sum(r*n for r,n in tariff.items())==4750 + t=1-F('0.00389046') + prices={0:(F(0),F(0)),**{r:price(r,t) for r in range(1,9)}} + weights={j:(prices[i][0]-prices[i-1][1],prices[i][1]-prices[i-1][0]) for i,j in enumerate(order,1)} + # Certify all non-tight interval constraints numerically; the tight rows + # telescope symbolically because the interval is the corresponding prefix. + for a in range(1,9): + for b in range(a,9): + interval=list(range(a,b+1)) + if set(interval)!=set(order[:len(interval)]): + assert sum(weights[j][1] for j in interval)> i) & 1] + + +def row_rank(vectors): + pivots = {} + for value in vectors: + while value: + pivot = value.bit_length() - 1 + if pivot not in pivots: + pivots[pivot] = value + break + value ^= pivots[pivot] + return len(pivots) + + +def standard_projector(frame): + """Recover the axes of these specifically coordinate-aligned frames.""" + basis = frame["B"] + kernel = frame["A"] + require(len(basis) == frame["dim"] and len(basis) + len(kernel) == 8, + "projector dimension") + def axis(row): + require(len(row) == 8 and set(row) <= {0, 1} and sum(row) == 1, + "non-coordinate frame") + return row.index(1) + image = [axis(row) for row in basis] + complement = [axis(row) for row in kernel] + require(sorted(image + complement) == list(range(8)), "basis coverage") + return frozenset(image) + + +def instructions(graph, changed): + replacements = { + 8073: ["INIT", 2327, 531], + 8074: ["ADD", 2327, 2326, 531], + 8075: ["MOVE", 2327, 531, 1], + } + result = [] + for clock, original in enumerate(graph["program"]): + if changed and clock in (8070, 8071): + continue + result.append((clock, replacements.get(clock, original) if changed else original)) + return result + + +def forward(graph, program, inject_at_reader=0): + n = graph["public"] + locations = dict(enumerate(graph["start"])) + values = {i: 1 << i for i in range(n)} + clears = [] + pre_reader = None + residual = None + received = None + for clock, event in program: + if clock == 8068: + residual = values[1857] ^ values[2224] + if clock == 10137: + pre_reader = (locations.copy(), values.copy()) + if inject_at_reader: + require(locations[2326] == 531, "oracle owner location") + values[2326] ^= inject_at_reader + op, dest, *args = event + if op == "INIT": + require(dest >= n and dest not in locations, "invalid INIT") + locations[dest], values[dest] = args[0], 0 + elif op == "ADD": + source, chart = args + require(dest != source and locations[dest] == locations[source] == chart, + "invalid ADD") + values[dest] ^= values[source] + elif op == "MOVE": + source, target = args + require(locations[dest] == source, "invalid MOVE") + locations[dest] = target + if clock == 8075: + received = values[dest] + elif op == "SWAP": + source, = args + require(source != dest, "invalid SWAP") + locations[dest], locations[source] = locations[source], locations[dest] + values[dest], values[source] = values[source], values[dest] + elif op == "CLEAR": + require(dest >= n and locations.pop(dest) == args[0], "invalid CLEAR") + clears.append((clock, dest, args[0], values.pop(dest))) + else: + raise AssertionError("unrecognized opcode") + require(locations == dict(enumerate(graph["final"])) and len(values) == n, + "final owner bindings") + require(residual is not None and pre_reader is not None and received is not None, + "missing observations") + return [values[i] for i in range(n)], clears, pre_reader, residual, received + + +def reverse(graph, program): + """Independent adjoint pass, with each input row a final-output bitmask.""" + n = graph["public"] + charts = dict(enumerate(graph["final"])) + dual = {i: 1 << i for i in range(n)} + for _, event in reversed(program): + op, dest, *args = event + if op == "CLEAR": + require(dest not in charts, "reverse CLEAR") + charts[dest], dual[dest] = args[0], 0 + elif op == "INIT": + require(charts.pop(dest) == args[0], "reverse INIT") + del dual[dest] + elif op == "ADD": + source, chart = args + require(charts[source] == charts[dest] == chart, "reverse ADD") + dual[source] ^= dual[dest] + elif op == "MOVE": + before, after = args + require(charts[dest] == after, "reverse MOVE") + charts[dest] = before + elif op == "SWAP": + source, = args + charts[dest], charts[source] = charts[source], charts[dest] + dual[dest], dual[source] = dual[source], dual[dest] + else: + raise AssertionError("reverse opcode") + require(charts == dict(enumerate(graph["start"])), "reverse boundary") + return [dual[i] for i in range(n)] + + +def main(path): + g = read_graph(path) + n = g["public"] + require(n == 630 and len(g["program"]) == 39600 and len(g["frames"]) == 636, + "source dimensions") + require(g["program"][8068:8076] == [ + ["INIT", 2326, 326], ["ADD", 2326, 1855, 326], + ["ADD", 2326, 1857, 326], ["ADD", 2326, 2224, 326], + ["MOVE", 2326, 326, 531], ["INIT", 2327, 326], + ["ADD", 2327, 1855, 326], ["MOVE", 2327, 326, 1]], + "source relay window") + p326, p531, p1 = [standard_projector(g["frames"][str(x)]) for x in (326, 531, 1)] + require(len(p326) == 6 and len(p531) == 7 and len(p1) == 8 + and p326 < p531 < p1, "nested relay projectors") + require(g["start"].count(1) == g["start"].count(531) == 0, "empty receivers") + + original = instructions(g, False) + altered = instructions(g, True) + direct_arrivals = [(t, row[1], row[2]) for t, row in altered + if row[0] == "MOVE" and row[3] == 1] + hub_in = [(t, row[1], row[2]) for t, row in altered + if row[0] == "MOVE" and row[3] == 531 and t <= 10141] + hub_to_top = [(t, row[1], row[2]) for t, row in altered + if row[0] == "MOVE" and row[2:] == [531, 1] and t <= 10141] + require(len(direct_arrivals) == 505 and len(direct_arrivals) - len(hub_to_top) == 502, + "receiver contact count") + require(hub_in == [(8072, 2326, 326), (8098, 2333, 329)], "hub ingress prefix") + require(hub_to_top == [(8075, 2327, 531), (10138, 2862, 531), + (10141, 2863, 531)], "hub egress prefix") + require(not any(row[0] == "MOVE" and row[2] == 1 for _, row in altered), + "unexpected chart-1 output channel") + + old, old_clear, old_pre, residual, old_received = forward(g, original) + new, new_clear, new_pre, changed_residual, new_received = forward(g, altered) + require(old_received == new_received and residual == changed_residual, + "forwarded 2327 receipt") + require(bit_support(residual) == EXPECTED_RESIDUAL, "residual support") + require(old == [(1 << i) ^ ((1 << (i - 111)) if 111 <= i < 222 else 0) + for i in range(n)], "native operator") + difference = [a ^ b for a, b in zip(old, new)] + require(all(d in (0, residual) for d in difference), "not a rank-one error") + signature = [i for i, d in enumerate(difference) if d] + require(signature == EXPECTED_SIGNATURE and row_rank(old) == 630 and row_rank(new) == 629, + "error support or rank") + for rows, program in ((old, original), (new, altered)): + dual = reverse(g, program) + require(all(((rows[o] >> i) & 1) == ((dual[i] >> o) & 1) + for i in range(n) for o in range(n)), "transpose mismatch") + + require(old_pre[0] == new_pre[0], "pre-reader locations") + changed_owners = [i for i in old_pre[1] if old_pre[1][i] != new_pre[1][i]] + require(changed_owners == [2326] + and old_pre[1][2326] ^ new_pre[1][2326] == residual, "pre-reader values") + require(len(old_clear) == len(new_clear) == 3433, "private clear count") + require(all(a[:3] == b[:3] and (a[3] ^ b[3]) in (0, residual) + for a, b in zip(old_clear, new_clear)), "private clear discrepancy") + repaired, repaired_clears, _, _, _ = forward(g, altered, inject_at_reader=residual) + require(repaired == old and repaired_clears == old_clear, "oracle correction") + wrong, _, _, _, _ = forward(g, altered, inject_at_reader=1 << 3) + require(wrong != old, "wrong-side-information control") + + top = [i for i, chart in enumerate(g["final"]) if chart == 1] + require(len(top) == row_rank(old[i] for i in top) == 505, "native chart-1 rank") + require(row_rank(new[i] for i in top) == 504, "altered chart-1 rank") + require(row_rank([old[i] for i in top] + [new[i] for i in top]) == 505, + "altered target space not contained") + bad_top = [i for i in signature if i in top] + require(bad_top == [0, 11, 223, 224, 230, 249, 250, 251], "top error signature") + unaffected = [i for i in top if i not in bad_top] + attained = [new[i] for i in unaffected] + [new[i] ^ new[0] for i in bad_top[1:]] + wanted = [old[i] for i in unaffected] + [old[i] ^ old[0] for i in bad_top[1:]] + require(attained == wanted and len(attained) == row_rank(attained) == 504, + "504-function construction") + + dims = {int(c): spec["dim"] for c, spec in g["frames"].items()} + def paid(program): + return Counter(abs(dims[row[2]] - dims[row[3]]) for _, row in program + if row[0] == "MOVE") + old_paid, new_paid = paid(original), paid(altered) + require(old_paid[1] + 1 == new_paid[1] and old_paid[2] - 1 == new_paid[2] + and all(old_paid[r] == new_paid[r] for r in set(old_paid) | set(new_paid) + if r not in (1, 2)), "paid count change") + + # Exercise the attained k-copy side-information construction with every + # assignment of the k independent residual bits, for k=1..8. Rank and + # the cut proof, not this finite control, establish the general theorem. + vector_controls = [] + for k in range(1, 9): + for m in range(k + 2): + fixed = min(k, m) + successes = sum(1 for bits in range(1 << k) if bits >> fixed == 0) + require(successes == 1 << fixed, "joint-copy side observation") + vector_controls.append([k, m, successes, 1 << k]) + + print(json.dumps({ + "source_sha256": PACKED_HASH, + "scope": "fixed-incidence normalized constant binary fields; no physical supplier admission", + "chart1_target_rank": len(top), + "other_chart1_arrivals": len(direct_arrivals) - len(hub_to_top), + "early_hub_ingress": hub_in, + "early_hub_to_chart1": hub_to_top, + "native_top_rank": row_rank(old[i] for i in top), + "changed_top_rank": row_rank(new[i] for i in top), + "native_full_rank": row_rank(old), "changed_full_rank": row_rank(new), + "attained_native_target_combinations": len(attained), + "unaffected_top_outputs": len(unaffected), "paired_top_outputs": len(bad_top) - 1, + "residual_support": bit_support(residual), "public_error_signature": signature, + "pre_reader_only_changed_owner": changed_owners, + "preserved_2327_receipt": True, "original_and_changed_clears": len(old_clear), + "clear_differences_vanish_on_residual_hyperplane": True, + "oracle_residual_at_10137_repairs_all_public_and_clear_values": True, + "wrong_side_information_rejected": True, + "reverse_transposes_verified": True, + "paid_histogram_change": {"rank_1": 1, "rank_2": -1}, + "joint_copy_residual_controls": vector_controls, + }, indent=2)) + + +if __name__ == "__main__": + main(Path(sys.argv[1]) if len(sys.argv) > 1 else BASE / "strong-bit.json.gz") diff --git a/research/p104-graded-cut-relay-repair/pinned/EFREE-CALLER.json.gz b/research/p104-graded-cut-relay-repair/pinned/EFREE-CALLER.json.gz new file mode 100644 index 0000000000..f022272a8d Binary files /dev/null and b/research/p104-graded-cut-relay-repair/pinned/EFREE-CALLER.json.gz differ diff --git a/research/p104-graded-cut-relay-repair/pinned/strong-bit.json.gz b/research/p104-graded-cut-relay-repair/pinned/strong-bit.json.gz new file mode 100644 index 0000000000..16f8cafb1c Binary files /dev/null and b/research/p104-graded-cut-relay-repair/pinned/strong-bit.json.gz differ diff --git a/research/p104-graded-cut-relay-repair/repair.py b/research/p104-graded-cut-relay-repair/repair.py new file mode 100644 index 0000000000..4552cb7d52 --- /dev/null +++ b/research/p104-graded-cut-relay-repair/repair.py @@ -0,0 +1,240 @@ +#!/usr/bin/env python3 +"""Replay a non-improving, exact P104 326→531 relay schedule. + +Source: #8041 / #8027 strong-bit.json.gz, verified by SHA-256. The graph is +normalized F₂-linear; a 630-bit row denotes a scalar linear form. All inserted +ADDs are cocharted, and all changed MOVE endpoints are verified by exact +rational projectors. No physical or caller realization is claimed. +""" +import gzip +import hashlib +import json +import sys +import tempfile +from collections import Counter +from fractions import Fraction as Q +from pathlib import Path + +HERE = Path(__file__).resolve().parent +HASH = '74e93daf2b7acf794ffb51f92f03f51556f68126d41ee13a8969bddb4cbe6326' +EXPANDED_HASH = 'b096d6df2a0c4688296b13ab0cfd50fec1c7dec732819c624ddd7a745a144b69' + + +def load(path): + raw = Path(path).read_bytes() + if hashlib.sha256(raw).hexdigest() != HASH: + raise ValueError('graph hash mismatch') + data = gzip.decompress(raw) + if hashlib.sha256(data).hexdigest() != EXPANDED_HASH: + raise ValueError('expanded graph hash mismatch') + return json.loads(data) + + +def matmul(a, b): + return [[sum((a[i][k]*b[k][j] for k in range(8)), Q(0)) + for j in range(8)] for i in range(8)] + + +def inverse(a): + v = [[Q(x) for x in row] + [Q(i == j) for j in range(8)] + for i,row in enumerate(a)] + for k in range(8): + pivot = next(i for i in range(k,8) if v[i][k]) + v[k],v[pivot] = v[pivot],v[k] + f = v[k][k] + v[k] = [x/f for x in v[k]] + for i in range(8): + if i != k: + f = v[i][k] + v[i] = [x-f*y for x,y in zip(v[i],v[k])] + return [r[8:] for r in v] + + +def projector(spec): + src = spec['B'] + spec['A'] + m = [[Q(src[j][i]) for j in range(8)] for i in range(8)] + im = inverse(m) + assert all(x.denominator % 3 for row in im for x in row) + d = spec['dim'] + return matmul([[m[i][j] if j < d else Q(0) for j in range(8)] + for i in range(8)], im) + + +def same(a,b): + return a == b + + +def builds(p, variant): + """Transform by zero-based *original* clocks, preserving event order.""" + assert variant in ('original','fault','partial','exact','corrupt') + anchors = { + 8070:['ADD',2326,1857,326],8071:['ADD',2326,2224,326], + 8072:['MOVE',2326,326,531],8073:['INIT',2327,326], + 8074:['ADD',2327,1855,326],8075:['MOVE',2327,326,1], + 10136:['INIT',2862,531],10137:['ADD',2862,2326,531], + 10138:['MOVE',2862,531,1],11022:['MOVE',3152,328,8], + 11025:['ADD',3153,3152,8],11026:['MOVE',3153,8,0], + 19845:['INIT',3298,0],19951:['ADD',3298,3284,0], + 19952:['MOVE',3298,0,7],19954:['ADD',3299,5,7], + 19958:['ADD',3300,1902,330],19959:['ADD',3300,1908,330], + 30079:['ADD',3550,2326,531],30080:['ADD',3550,2333,531], + 30081:['ADD',3550,3300,531],39319:['CLEAR',3152,8], + } + for k,expect in anchors.items(): assert p[k] == expect,(k,p[k]) + if variant == 'original': return [list(row) for row in p] + fix1 = variant in ('partial','exact','corrupt') + fixall = variant in ('exact','corrupt') + out=[] + for i,row in enumerate(p): + row=list(row) + if i in (8070,8071): continue + row={8073:['INIT',2327,531],8074:['ADD',2327,2326,531], + 8075:['MOVE',2327,531,1]}.get(i,row) + if fix1: + row={10136:['INIT',2862,326],10137:['ADD',2862,2224,326], + 10138:['MOVE',2862,326,1]}.get(i,row) + if fixall: + if i==11022:row=['MOVE',3152,328,0] + if i==11025:continue + if i==19845: + out.extend([['INIT',3298,0],['ADD',3298,117,0]]) + if variant != 'corrupt':out.append(['ADD',3298,3152,0]) + out.append(['ADD',3298,3153,0]) + continue + if 19846 <= i <= 19951:continue + if i in (19954,19958,19959,30079,30080):continue + if i==39319:row=['CLEAR',3152,0] + out.append(row) + if fix1 and i==10138:out.append(['ADD',2862,2861,1]) + if fixall and i==11026:out.append(['ADD',3153,3152,0]) + return out + + +def forward(g,p): + c=dict(enumerate(g['start'])) + v={i:1<=g['public'] and c[d]==a[0] + clears.append((d,c[d],v[d]));del c[d],v[d] + elif op=='ADD': + x,chart=a;assert c[d]==c[x]==chart;v[d]^=v[x] + elif op=='MOVE': + source,dest=a;assert c[d]==source;c[d]=dest + elif op=='SWAP': + x,=a;c[d],c[x]=c[x],c[d];v[d],v[x]=v[x],v[d] + else:raise ValueError(op) + assert c==dict(enumerate(g['final'])) + return [v[i] for i in range(g['public'])],clears + + +def reverse(g,p): + """Independent transposed execution: one 630-bit column per live owner.""" + c=dict(enumerate(g['final'])) + v={i:1<>i)&1] + + +def main(): + if sys.flags.optimize:raise RuntimeError('Run without optimization') + g=load(HERE/'strong-bit.json.gz') + assert g['public']==630 and len(g['program'])==39600 + projector_cache={i:projector(g['frames'][str(i)]) for i in (0,1,8,326,328,531)} + for small,large in [(326,531),(531,1),(326,1),(0,328),(8,328)]: + a,b=projector_cache[small],projector_cache[large] + assert same(matmul(a,b),a) and same(matmul(b,a),a),(small,large) + dims={i:g['frames'][str(i)]['dim'] for i in projector_cache} + assert (dims[326],dims[531],dims[1],dims[328],dims[8],dims[0])==(6,7,8,6,1,0) + + rows={};clears={};progs={} + for mode in ('original','fault','partial','exact','corrupt'): + progs[mode]=builds(g['program'],mode) + rows[mode],clears[mode]=forward(g,progs[mode]) + old=rows['original'];new=rows['exact'] + assert old==[(1<>i)&1)==((dual[i]>>o)&1) + for o in range(630) for i in range(630)) + assert reverse(g,progs['exact'])==reverse(g,progs['original']) + assert reverse(g,progs['corrupt'])!=reverse(g,progs['original']) + h0=hist(g,progs['original']);h1=hist(g,progs['exact']) + assert sum(h0.values())==sum(h1.values())==2803 + assert h1-h0==Counter({6:1}) and h0-h1==Counter({5:1}) + # Source-byte negative control exercises the same loader used above. + raw=(HERE/'strong-bit.json.gz').read_bytes() + with tempfile.TemporaryDirectory(prefix='p104-graph-control-') as tmp: + bad=Path(tmp)/'bad.gz' + bad.write_bytes(raw[:-1]+bytes([raw[-1]^1])) + try: load(bad) + except ValueError as e: assert str(e)=='graph hash mismatch' + else: raise AssertionError('corrupted source accepted') + result={ + 'source_sha256':HASH,'expanded_sha256':EXPANDED_HASH, + 'scope':'All-input normalized F2 linear 630-output local graph. No physical, caller, or bound claim.', + 'projector_nesting_checked':[[326,531],[531,1],[326,1],[0,328],[8,328]], + 'output_rank':rank(new),'exact_public_rows':630,'adjoint_matches_original':True, + 'partial_wrong_rows':errors['partial'],'fault_wrong_rows':errors['fault'], + 'corrupt_control_wrong_rows':errors['corrupt'], + 'partial_exact_chart1_outputs':len(chart1), + 'corrupt_control_117_delta_support':support(rows['corrupt'][117]^old[117]), + 'private_clears':len(clears['exact']),'symbolically_dirty_clears':sum(bool(v) for _,_,v in clears['exact']), + 'changed_private_clear_values_or_charts':changed_clears, + 'original_paid_histogram':dict(sorted(h0.items())), + 'new_paid_histogram':dict(sorted(h1.items())), + 'one_word_paid_count':sum(h1.values()), + 'one_word_rank_sum_delta':sum(k*(h1[k]-h0[k]) for k in set(h0)|set(h1)), + 'corrupted_source_rejected':True, + } + print(json.dumps(result,indent=2,sort_keys=True)) + +if __name__=='__main__':main() diff --git a/research/p104-graded-cut-relay-repair/verify.py b/research/p104-graded-cut-relay-repair/verify.py new file mode 100644 index 0000000000..0ff99bc72c --- /dev/null +++ b/research/p104-graded-cut-relay-repair/verify.py @@ -0,0 +1,160 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Run the source-bound cuts, interval price, information and repair replays.""" +import contextlib +import hashlib +import importlib.util +import io +import json +from pathlib import Path +import sys +import tempfile + +HERE = Path(__file__).resolve().parent +GRAPH = HERE / 'pinned' / 'strong-bit.json.gz' +FROZEN = { + 'dimension_cuts.py': '9ce72736838a097320b1cb213b09601273fec5fdfb40966958bcf1d9c37b8fe3', + 'DIMENSION-CUTS.json': 'ebb1a31a6e85aee298f5ad0d21168ec2d48aed0a7f52f3a0f7c5a7d2d41ba90e', + 'feedback_rigidity.py': '25c7e490ecb678e84c782c61163b61b3428a25497b2ca5b23146130dc5dc19fd', + 'FEEDBACK-RIGIDITY.json': '3a648032d227705d3440b52455450a39cd067b98daaf69ccc2c07e3ae1a58410', + 'feedback_independent.py': 'f3d3788407294b8416c138632c15f7fc73fd7a51006709c2477c84151d80dc7c', + 'FEEDBACK-INDEPENDENT.json': 'd65d2f6b6ebcf27b4f45606d8e7cc069958140ee0a353fc158357ebd16478b3f', + 'curvature.py': '60cceec9033fa8d099b343cadd4726b6099dabd9306087eb77741ad1ae332c86', + 'CURVATURE.json': 'de2d7c008b2fab2f2fbd1b5ecb1d58fe87400dd67da9adfd24639880f691b44d', + 'pinned/EFREE-CALLER.json.gz': '757b3523798f840bdb02028b23708c3416627a99ea09e7a3c4bcdc5cd0c7ce4b', + 'grade_price.py': 'd1b15db0625855e18f64fecc87e037a635da3cd9413e55c22157ab5c51b6873c', + 'GRADE-PRICE.json': 'f0707455c18e4ec868b81c2eb13ea06de5facbf7c2ceda465348d7ad39d91901', + 'information.py': '5ced620536a94181430cae9d063b23475bc92c15c7d8fda55d820caa18e4a650', + 'INFORMATION.json': '6809b6ac0e96b1f0316bb5646731b89c5739f5cb8647c4f05db796071b19813d', + 'repair.py': 'e4de1ec7eb18a7203b1ac1ee2b0affb42ca0dc381289359257b43fdcb18b71ef', + 'frozen_replay.py': '4f1987e2b50696100cd4279e297a69532c6664aff08c9f449b5208a5db47d408', + 'EXACT-EDITS.json': '414622da5c258317187eabdfc5028dced7dbb2c3cc8e80d8b4f2a592ac46fdc8', + 'FROZEN-REPLAY.json': 'c36f185f66184cd1d861dcf425e855ba6d36c99269a5851042c6fc6d9c47a697', + 'REPAIR.json': '5613b070541804d66e074909d597ec18031f3a5505af861f6ff63ca03f7c8e88', + 'pinned/strong-bit.json.gz': '74e93daf2b7acf794ffb51f92f03f51556f68126d41ee13a8969bddb4cbe6326', +} + + +def require(condition, message): + if not condition: + raise AssertionError(message) + + +def load_module(filename): + spec = importlib.util.spec_from_file_location('p104_' + filename[:-3], HERE / filename) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def capture(call): + stream = io.StringIO() + with contextlib.redirect_stdout(stream): + call() + return json.loads(stream.getvalue()) + + +def compare(result, name): + expected = json.loads((HERE / name).read_text()) + result = json.loads(json.dumps(result)) # JSON canonicalizes integer keys. + require(result == expected, 'receipt mismatch: ' + name) + + +def must_reject(call, label): + try: + call() + except (AssertionError, ValueError): + return + raise AssertionError('negative control accepted: ' + label) + + +def main(): + require(not sys.flags.optimize, 'run without optimized assertions') + for name, expected in FROZEN.items(): + require(hashlib.sha256((HERE / name).read_bytes()).hexdigest() == expected, + 'frozen bytes changed: ' + name) + graph_bytes = GRAPH.read_bytes() + git_object = b'blob ' + str(len(graph_bytes)).encode('ascii') + b'\0' + graph_bytes + require(hashlib.sha1(git_object).hexdigest() == '16f8cafb1c4d139a99a62e46eb40c118e6176c34', + 'source Git blob mismatch') + dimension = load_module('dimension_cuts.py') + grade = load_module('grade_price.py') + curvature = load_module('curvature.py') + feedback = load_module('feedback_rigidity.py') + feedback_audit = load_module('feedback_independent.py') + information = load_module('information.py') + repair = load_module('repair.py') + frozen = load_module('frozen_replay.py') + repair.HERE = GRAPH.parent + + d = dimension.check(GRAPH) + compare(d, 'DIMENSION-CUTS.json') + p = grade.check(GRAPH) + compare(p, 'GRADE-PRICE.json') + c = curvature.check(GRAPH, HERE / 'pinned/EFREE-CALLER.json.gz') + compare(c, 'CURVATURE.json') + q = feedback.run(GRAPH) + compare(q, 'FEEDBACK-RIGIDITY.json') + q2 = feedback_audit.check(GRAPH, HERE / 'FEEDBACK-RIGIDITY.json') + compare(q2, 'FEEDBACK-INDEPENDENT.json') + i = capture(lambda: information.main(GRAPH)) + compare(i, 'INFORMATION.json') + r = capture(repair.main) + compare(r, 'REPAIR.json') + f = frozen.check(GRAPH, HERE / 'EXACT-EDITS.json') + compare(f, 'FROZEN-REPLAY.json') + g = frozen.source(GRAPH) + changed_histogram = curvature.native_upward(g) + changed_histogram[1] += 1 + changed_histogram[2] -= 2 + changed_histogram[3] += 1 + require(sum(changed_histogram.values()) == sum(curvature.native_upward(g).values()) + and sum(r*n for r,n in changed_histogram.items()) == 4750, + 'histogram corruption control changed count or rank sum') + must_reject(lambda: curvature.validate_profiles(changed_histogram, curvature.RELAXED), + 'rank-preserving histogram corruption') + bad_graph = dict(g) + bad_graph['program'] = [list(row) for row in g['program']] + bad_graph['program'][7112][3] = 0 + must_reject(lambda: curvature.ordered_contacts(bad_graph), 'changed 4+4 incidence') + changes = json.loads((HERE / 'EXACT-EDITS.json').read_text()) + require(frozen.apply(g['program'], changes) == repair.builds(g['program'], 'exact'), + 'independent edit list differs from repair generator') + + # Confirm each independent input reader actually rejects modified source + # bytes, not just that a digest was printed. Temporary files are discarded. + with tempfile.TemporaryDirectory(prefix='p104-graded-source-') as tmp: + bad = Path(tmp) / 'damaged.gz' + raw = GRAPH.read_bytes() + bad.write_bytes(raw[:-1] + bytes([raw[-1] ^ 1])) + for label, reader in [('dimension', dimension.check), ('grade', grade.check), + ('information', information.read_graph), ('repair', repair.load), + ('frozen', frozen.source), ('feedback', feedback.run), + ('curvature', curvature.read_graph)]: + must_reject(lambda reader=reader: reader(bad), label + ' source') + bad_caller = Path(tmp) / 'damaged-caller.gz' + caller = (HERE / 'pinned/EFREE-CALLER.json.gz').read_bytes() + bad_caller.write_bytes(caller[:-1] + bytes([caller[-1] ^ 1])) + must_reject(lambda: curvature.read_caller(bad_caller), 'caller source') + bad_receipt = Path(tmp) / 'damaged-feedback.json' + tampered = json.loads((HERE / 'FEEDBACK-RIGIDITY.json').read_text()) + tampered['certificate'][0]['witness_pair'][0]['shift_mask'] ^= 1 + bad_receipt.write_text(json.dumps(tampered)) + must_reject(lambda: feedback_audit.check(GRAPH, bad_receipt), + 'feedback witness corruption') + corrupt_changes = json.loads((HERE / 'EXACT-EDITS.json').read_text()) + corrupt_changes['edits'][0]['old'][1] += 1 + must_reject(lambda: frozen.apply(g['program'], corrupt_changes), + 'edit anchor corruption') + damaged = dict(d) + damaged['upward_grade'] = d['upward_grade'] - 1 + must_reject(lambda: compare(damaged, 'DIMENSION-CUTS.json'), 'damaged receipt') + print('PASS: source bindings; eight saturated cuts, 120 hub cuts, interval price and curvature;') + print(' 27 feedback sites and 4643 sender exclusions with independent low-pivot replay;') + print(' sharp information bound controls; independent 630-row repair and transpose;') + print(' damaged source, receipt, witness, edit, histogram and incidence controls;') + print(' wrong oracle, missing ADD, and cut controls') + + +if __name__ == '__main__': + main()