From 4f85225710435e10ac2ae0ff13dd0838fedce305 Mon Sep 17 00:00:00 2001 From: James Reed Date: Sat, 17 Oct 2026 22:35:00 -0700 Subject: [PATCH] Compare the four stored L359 magnitudes with the F0 tolerance --- research/qq16-l359-scalar/README.md | 60 +++++++++++++ research/qq16-l359-scalar/RESULT.json | 10 +++ research/qq16-l359-scalar/SOURCES.json | 30 +++++++ research/qq16-l359-scalar/TASK.json | 73 +++++++++++++++ research/qq16-l359-scalar/VERIFY.json | 23 +++++ research/qq16-l359-scalar/test_verify.py | 28 ++++++ research/qq16-l359-scalar/verify.py | 110 +++++++++++++++++++++++ 7 files changed, 334 insertions(+) create mode 100644 research/qq16-l359-scalar/README.md create mode 100644 research/qq16-l359-scalar/RESULT.json create mode 100644 research/qq16-l359-scalar/SOURCES.json create mode 100644 research/qq16-l359-scalar/TASK.json create mode 100644 research/qq16-l359-scalar/VERIFY.json create mode 100644 research/qq16-l359-scalar/test_verify.py create mode 100644 research/qq16-l359-scalar/verify.py diff --git a/research/qq16-l359-scalar/README.md b/research/qq16-l359-scalar/README.md new file mode 100644 index 0000000000..413ca2bdfb --- /dev/null +++ b/research/qq16-l359-scalar/README.md @@ -0,0 +1,60 @@ +# One stored L359 magnitude meets the F0 tolerance + +**Partial. No new exponent.** + +The F0 fault checker keeps a state of 712 rationals. It sets register 359 +to `2^e` for `e` in `{0, 8, 64, 256}` and records the completed data defect +`4 u 2^e`, with `u = 2^-80`. The final response entries are pairs of a +register index and one rational. + +The #2965 transfer states a sufficient F0 tolerance `epsF <= H 2^(-beta-8)`. +At `H = 1` and `beta = 64` that tolerance is `2^-72`. The stored defect +meets it at `e = 0` and misses it at `e = 8`, `e = 64` and `e = 256`. +The transfer also states that its forward bounds are endpoint bounds. This +comparison uses the stored completed defects. + +## What was executed + +The checker reads the fault source, its receipt and the transfer note. It +recomputes `4 u 2^e` and compares each stored defect with `2^-72`. It does +not replay the 26,099-event word. + +## Scope and evidence + +Original card: `joint-query-controller`, priority revision 6, refined to +these four scalars. [TASK.json](TASK.json) records the scope change. +[RESULT.json](RESULT.json) is the executed receipt and is not rewritten. +[SOURCES.json](SOURCES.json) pins the fault checker, its receipt and the +transfer note. No selected frontier file changes. + +Upstream checkpoint: `20ecf2891d80b5acf18d980b2164fb44ea7faa90`, priority +revision 6, checked 2026-10-18 05:32 UTC. Catalogue and selected record match +that commit. Handoff discussion #1166, through the PR3547 note at 2026-10-18 +05:31 UTC, was released work. Draw seed `5b21e54f2184a7574e607206a582d4dd`, +track `recursive-interfaces`, second card `joint-query-controller`. + +## Reproduce + +From the repository root, standard-library Python 3.12: + +```sh +python3.12 -B research/qq16-l359-scalar/verify.py +python3.12 -B research/qq16-l359-scalar/test_verify.py +python3.12 -B scripts/research_package.py --package research/qq16-l359-scalar +``` + +The comparison finishes in under a second. + +## Open next questions + +The four stored magnitudes are scalars in register 359. One meets the +published F0 tolerance and three miss it. Replaying the word would leave +this comparison. + +## Credit + +Arham Tahir supplied the F0 scalar fault witness. Nick Petalas supplied the +#2965 completed-output tolerance. The selected record is unchanged. + +Prepared by jwr with substantial Cursor agent assistance. No independent human +review is claimed. Apache-2.0. diff --git a/research/qq16-l359-scalar/RESULT.json b/research/qq16-l359-scalar/RESULT.json new file mode 100644 index 0000000000..badb0368fc --- /dev/null +++ b/research/qq16-l359-scalar/RESULT.json @@ -0,0 +1,10 @@ +{ + "register": 359, + "width": 712, + "exponents": [0, 8, 64, 256], + "beta": 64, + "tolerance": "1/4722366482869645213696", + "meets_tolerance": [true, false, false, false], + "meeting_count": 1, + "no_new_kappa": true +} diff --git a/research/qq16-l359-scalar/SOURCES.json b/research/qq16-l359-scalar/SOURCES.json new file mode 100644 index 0000000000..11b560bd40 --- /dev/null +++ b/research/qq16-l359-scalar/SOURCES.json @@ -0,0 +1,30 @@ +{ + "schema_version": 1, + "base_commit": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "files": [ + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "67f085acd86acd7d4e03922d9cf4b26bca66fed5", + "sha256": "47b42433f5a85809a3aadd29c2c339da2c6ed728e4f7762df6b88bccb7874cf0" + }, + { + "path": "research/qq16-producer-dirty-fault/verify.py", + "usage": "input", + "git_blob": "8677c419ed90eb1f4c14eac4bbb2a591eafba02c", + "sha256": "abb0a094fd791a5436529a8572c4d539acd6232229b2ffa95fde569637008ec3" + }, + { + "path": "research/qq16-producer-dirty-fault/RESULT.json", + "usage": "input", + "git_blob": "fbead079e26a5e29f2d7926311f392d6a64d5c2b", + "sha256": "e48a14b6b8505cbd4721e379b26f80ace7d96f360a409cc6b18a9701153f3282" + }, + { + "path": "research/qq16-producer-defect-transfer/README.md", + "usage": "input", + "git_blob": "16903a0090c020d033d24712cce11c633031e688", + "sha256": "30cf4389425f7704b1ed45af6cf4b5165e7b5c04af5077640ac96399c61cd703" + } + ] +} diff --git a/research/qq16-l359-scalar/TASK.json b/research/qq16-l359-scalar/TASK.json new file mode 100644 index 0000000000..3d3e8ffd1e --- /dev/null +++ b/research/qq16-l359-scalar/TASK.json @@ -0,0 +1,73 @@ +{ + "schema_version": 1, + "task_id": "joint-query-controller", + "priority_revision": 6, + "base_commit": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "original_card": { + "id": "joint-query-controller", + "question": "Can a literal QQ16 producer meet the proposed completed-output error budgets with dirty helpers and an affordable physical consumer?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/joint-query/README.md", + "research/joint-query/evidence/QQ16-SELECTED-WITNESS.md", + "research/joint-query/evidence/JOINT-QUERY-TRANSFER.md", + "docs/research/community-efficient1000-review.md", + "research/qq16-producer-defect-transfer/README.md" + ], + "methods": [ + "Derive one literal producer's completed-output defects and intermediate dirty-helper bounds, with its physical bill.", + "Design or audit one consumer, retention or hosting boundary and its complete cost for the pinned producer/decoder." + ], + "acceptance_gate": "Name the changed premise of the fixed F0/B1 observation obstruction. Show exactly which query is recovered, legal native reads and restoration, and a full favorable budget including cover maps, helpers and endpoints. Local inverse identities alone do not close the global controller. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read the revision-6 family record and #2965 producer-defect transfer after the local QQ16 decoder contract. Its author-checked output-error estimate does not implement producer interiors, bound dirty helpers, or pay for the consumer; independently check the implication used.", + "scope": "Source-bound orientation only. Read the named package and review before relying on its local evidence; this command is not its replay or supplier admission." + }, + "first_experiment": "Pin one literal F0/B1 producer and its native-child contracts; derive the actual intermediate magnitude ledger and completed-output defects, including dirty helpers and correlations. Compare with #2965 budgets and price storage, movement, cleanup and F17 consumption. Stop with a precise missing bound if no producer contract supplies it; do not optimize another decoder precision constant in isolation.", + "bottleneck_link": "The native local words exist; retained query information and its physical access are the missing link to a composed recursive interface.", + "allowed_variations": [ + "One paid query, one changed first pair, or one precisely specified affine helper state.", + "A counterexample or lower bound for that exact proposed repair.", + "One unresolved obligation of a newer local decoder, with exact source heads and a distinct claim/domain." + ], + "scope_change_triggers": [ + "Retaining the fixed first pair and ordinary schedule while allowing only homogeneous selected-only control, already excluded by the witness.", + "Treating cover-map counts as zero-cost physical address operations.", + "Recreating the pending complete local decoder or early-record/output-bank coalescing already under investigation without a distinct audit or changed premise.", + "Treating a completed-output defect inequality as a producer-interior, dirty-range or physical-cost certificate." + ], + "overlap_terms": [ + "QQ16", + "joint-query", + "changing-chart controller", + "selected observation", + "1969", + "2540", + "early record", + "output-bank retention", + "complete native decoder", + "2965", + "producer defect", + "dirty-helper range", + "F17 consumer" + ] + }, + "scope_status": "refined", + "actual_scope": "Compare the four stored scalar magnitudes of register L359 with the #2965 F0 tolerance at beta=64.", + "scope_change_reason": "The fault receipt already stores those four scalars and the completed-defect formula. This comparison uses that receipt. It does not replay the word or price an F17 consumer.", + "bottleneck_link": "Only the magnitude 2^0 meets H*2^(-72). The larger three stored magnitudes miss that completed-output tolerance. The selected kappa is unchanged.", + "budget_minutes": 60, + "stop_rule": "Compare these four stored scalars. Do not replay the F0 word and do not price F17 consumption.", + "outcome": "partial", + "evidence": "Register 359 is one rational in a 712-register state. The defects 4*u*2^e meet 2^(-72) for e=0 and miss it for e=8, 64 and 256.", + "author": "jwr", + "ai_assistance": "Substantial assistance from the Cursor coding agent in the execution, checker and writeup.", + "open_questions": [], + "no_open_questions_reason": "The receipt stores four scalars for register 359. Replaying the word or pricing F17 consumption would leave this comparison." +} diff --git a/research/qq16-l359-scalar/VERIFY.json b/research/qq16-l359-scalar/VERIFY.json new file mode 100644 index 0000000000..09a37ca2fe --- /dev/null +++ b/research/qq16-l359-scalar/VERIFY.json @@ -0,0 +1,23 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/qq16-producer-dirty-fault/verify.py", + "research/qq16-producer-dirty-fault/RESULT.json", + "research/qq16-producer-defect-transfer/README.md" + ], + "commands": [ + { + "argv": ["{python}", "-B", "{package}/verify.py"], + "timeout_seconds": 30, + "checks": "Check that register 359 is one rational and compare the four stored defects with 2^(-72)." + }, + { + "argv": ["{python}", "-B", "{package}/test_verify.py"], + "timeout_seconds": 30, + "checks": "Check the zero-power defect, the exponent-8 miss, and rejection of a nested entry." + } + ] +} diff --git a/research/qq16-l359-scalar/test_verify.py b/research/qq16-l359-scalar/test_verify.py new file mode 100644 index 0000000000..368741585c --- /dev/null +++ b/research/qq16-l359-scalar/test_verify.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +"""A power of two meets the tolerance only while the defect stays at most 2^-72.""" + +import importlib.util +from fractions import Fraction +from pathlib import Path + +HERE = Path(__file__).resolve().parent +spec = importlib.util.spec_from_file_location("qq16_l359_scalar", HERE / "verify.py") +verify = importlib.util.module_from_spec(spec) +spec.loader.exec_module(verify) + + +def main(): + if verify.completed_defect(0) != Fraction(1, 2**78): + raise SystemExit("the zero-power defect moved") + if verify.meets_tolerance(0) is not True or verify.meets_tolerance(8) is not False: + raise SystemExit("the tolerance split moved") + try: + verify.scalar_entry([359, ["1", "0"]]) + except SystemExit: + print("PASS_QQ16_L359_SCALAR_TESTS groups=1") + return + raise SystemExit("a nested entry passed as a scalar") + + +if __name__ == "__main__": + main() diff --git a/research/qq16-l359-scalar/verify.py b/research/qq16-l359-scalar/verify.py new file mode 100644 index 0000000000..62b79e9b92 --- /dev/null +++ b/research/qq16-l359-scalar/verify.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +"""Compare the four stored L359 scalars with the F0 output tolerance. + +The fault checker writes one rational into register 359. This package reads +that source and its receipt. It does not replay the 26,099-event word. +""" + +import hashlib +import json +from fractions import Fraction +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[2] +PACKAGE = Path(__file__).resolve().parent +FAULT = ROOT / "research/qq16-producer-dirty-fault" +TRANSFER = ROOT / "research/qq16-producer-defect-transfer/README.md" +MARKER = "PASS_QQ16_L359_SCALAR meets=1 no_new_kappa" +EXPONENTS = (0, 8, 64, 256) +BETA = 64 + + +def fail(message): + raise SystemExit("FAIL_QQ16_L359_SCALAR " + message) + + +def require(condition, message): + if not condition: + fail(message) + + +def sha256(path): + digest = hashlib.sha256() + with path.open("rb") as handle: + for block in iter(lambda: handle.read(1 << 20), b""): + digest.update(block) + return digest.hexdigest() + + +def authenticate(): + sources = json.loads((PACKAGE / "SOURCES.json").read_text(encoding="utf-8")) + pinned = {row["path"]: row for row in sources["files"] if row["usage"] == "input"} + expected = { + "research/qq16-producer-dirty-fault/verify.py", + "research/qq16-producer-dirty-fault/RESULT.json", + "research/qq16-producer-defect-transfer/README.md", + } + require(set(pinned) == expected, "input inventory changed") + for path, row in pinned.items(): + require(sha256(ROOT / path) == row["sha256"], "input drift " + path) + + +def completed_defect(exponent): + return 4 * Fraction(1, 2**80) * 2**exponent + + +def meets_tolerance(exponent): + return completed_defect(exponent) <= Fraction(1, 2**(BETA + 8)) + + +def scalar_entry(entry): + require(type(entry) is list and len(entry) == 2, "a response entry is not a pair") + require(type(entry[0]) is int and type(entry[1]) is str, "a response entry is not a register scalar") + Fraction(entry[1]) + + +def evaluate(): + authenticate() + source = (FAULT / "verify.py").read_text(encoding="utf-8") + receipt = json.loads((FAULT / "RESULT.json").read_text(encoding="utf-8")) + transfer = TRANSFER.read_text(encoding="utf-8") + require("WIDTH = 712" in source, "the state width moved") + require("value = [Q(0)] * WIDTH" in source, "the unit state moved") + require("initial[359] = magnitude" in source, "the L359 assignment moved") + require("for exponent in (0, 8, 64, 256):" in source, "the stored exponents moved") + require("magnitude, u = Q(2**exponent), Q(1, 2**80)" in source, "the magnitude formula moved") + require("epsF <= H 2^(-beta-8)" in transfer, "the F0 tolerance moved") + require("not producer-interior range certificates" in transfer, "the endpoint limit moved") + require(receipt["dirty_input"] == 359 and receipt["completed_defect_formula"] == "4*u*T", "the receipt target moved") + cases = receipt["cases"] + require([case["dirty_power_of_two"] for case in cases] == list(EXPONENTS), "the case order moved") + meets = [] + for case in cases: + exponent = case["dirty_power_of_two"] + require(Fraction(case["u"]) == Fraction(1, 2**80), "the relative unit moved") + require(Fraction(case["completed_data_defect"]) == completed_defect(exponent), "a stored defect left 4*u*T") + meets.append(meets_tolerance(exponent)) + for entry in receipt["unit_fault_final_response"]: + scalar_entry(entry) + require(meets == [True, False, False, False], "the tolerance comparison moved") + return { + "register": 359, + "width": 712, + "exponents": list(EXPONENTS), + "beta": BETA, + "tolerance": str(Fraction(1, 2**(BETA + 8))), + "meets_tolerance": meets, + "meeting_count": 1, + "no_new_kappa": True, + } + + +def main(): + observed = evaluate() + stored = json.loads((PACKAGE / "RESULT.json").read_text(encoding="utf-8")) + require(observed == stored, "RESULT.json does not match the execution: " + json.dumps(observed, sort_keys=True)) + print(MARKER) + + +if __name__ == "__main__": + main()