From e390bcdbcb8370c2be2a58e931d7028da3ca758c Mon Sep 17 00:00:00 2001 From: Chris R Date: Mon, 19 Oct 2026 13:11:16 +1100 Subject: [PATCH 1/9] research(qq16): document scoped six-tape Gaussian axis kernel --- research/qq16-gaussian-axis-tapes/README.md | 52 +++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 research/qq16-gaussian-axis-tapes/README.md diff --git a/research/qq16-gaussian-axis-tapes/README.md b/research/qq16-gaussian-axis-tapes/README.md new file mode 100644 index 0000000000..1c35a8005e --- /dev/null +++ b/research/qq16-gaussian-axis-tapes/README.md @@ -0,0 +1,52 @@ +# QQ16 Gaussian-axis arithmetic on six physical bit tapes + +**Scope:** one exactly divisible, nonuniform tensor-axis line primitive, not an F0/B1 producer or an admitted recursive supplier. + +The [native reference](../qq16-native-rounded-components/vendor/native.py) defines, for every coordinate `x` and its partner `y=x xor (1<=1`, signed two's-complement little-endian component width `W>=2`, and an axis `0<=axis Date: Mon, 19 Oct 2026 13:12:04 +1100 Subject: [PATCH 2/9] research(qq16): implement metered six-tape Gaussian axis --- research/qq16-gaussian-axis-tapes/tapes.py | 163 +++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 research/qq16-gaussian-axis-tapes/tapes.py diff --git a/research/qq16-gaussian-axis-tapes/tapes.py b/research/qq16-gaussian-axis-tapes/tapes.py new file mode 100644 index 0000000000..661aafb229 --- /dev/null +++ b/research/qq16-gaussian-axis-tapes/tapes.py @@ -0,0 +1,163 @@ +"""Source-bound QQ16 Gaussian axis on six bit tapes. + +Clear1nsight, with substantial OpenAI ChatGPT assistance. Apache-2.0. +The Python object store and loop indices simulate a nonuniform compiled +controller. Kernel payload access is exclusively read/write/unit-move. +""" +from collections import Counter + + +def need(condition, message): + if not condition: + raise ValueError(message) + + +class Tape: + """One independently based owned interval, with dirty exterior sentinels.""" + + def __init__(self, bits, origin=0, trace=False, discardable=False): + need(type(origin) is int, "integer origin") + need(all(type(x) is int and x in (0, 1) for x in bits), "binary cells") + self.cells = list(bits) + self.discardable = discardable + self.origin = origin + self.head = origin + self.count = Counter() + self.trace = [] if trace else None + self.exterior = {origin - 1: 1, origin + len(bits): 1, + origin + len(bits) + 1: 0} + + def record(self, action): + self.count[action] += 1 + if self.trace is not None: + self.trace.append((action, self.head - self.origin)) + + def read(self): + pos = self.head - self.origin + need(0 <= pos < len(self.cells), "read outside owned interval") + self.record("read") + return self.cells[pos] + + def write(self, value): + pos = self.head - self.origin + need(0 <= pos < len(self.cells), "write outside owned interval") + need(type(value) is int and value in (0, 1), "binary write") + self.record("write") + self.cells[pos] = value + + def move(self, direction): + need(type(direction) is int and direction in (-1, 1), "unit move") + pos = self.head + direction - self.origin + # One-past may be visited, never dereferenced. + need(0 <= pos <= len(self.cells), "move outside allowed head interval") + self.record("move") + self.head += direction + + +def walk(tapes, direction, steps): + """Every move below is charged, including closed-window head returns.""" + for _ in range(steps): + for tape in tapes: + tape.move(direction) + + +def axis_kernel(tapes, n, width, axis, sign=1): + """Apply C_sign on coordinate pairs differing in bit axis. + + Preconditions: N=2**n with n>=1, width>=2, six separate supplied tapes, + signed little-endian input components, and every Gaussian numerator even + and in the signed width-bit range. No admission scan is hidden in the bill. + Scratch is owned (its old contents may be destroyed), not borrowed. + """ + need(type(n) is int and n >= 1, "positive dimension") + need(type(width) is int and width >= 2, "component width") + need(type(axis) is int and 0 <= axis < n, "axis range") + need(type(sign) is int and sign in (-1, 1), "line sign") + need(len(tapes) == 6 and len({id(t) for t in tapes}) == 6, + "six distinct tapes") + need(len({id(t.cells) for t in tapes}) == 6, "disjoint tape storage") + size = 1 << n + half = 1 << axis + need([len(t.cells) for t in tapes] == [size * width] * 2 + + [size * width // 2] * 4, "tape lengths") + need(all(t.head == t.origin for t in tapes), "entry heads") + data, scratch = tapes[:2], tapes[2:] + need(all(t.discardable is True for t in scratch), "owned scratch required") + + # Pack the low and high halves of every axis block in four streams. + for coordinate in range(size): + lane = (coordinate >> axis) & 1 + for _ in range(width): + for component in range(2): + src, dst = data[component], scratch[2 * lane + component] + bit = src.read() + dst.write(bit) + src.move(1) + dst.move(1) + bit = 0 + walk(data, -1, size * width) + walk(scratch, -1, size * width // 2) + + for _block in range(size // (2 * half)): + for upper in (False, True): + orientation = -sign if upper else sign + for _pair in range(half): + carry_r = carry_i = 0 + for bit_index in range(width): + a, b, c, d = (t.read() for t in scratch) + # Each sum is bounded finite-control arithmetic on four + # bits and a carry in {-1,0,1,2}, never a W-bit host add. + tr = carry_r + a - orientation * b + c + orientation * d + ti = carry_i + b + orientation * a + d - orientation * c + out_r, out_i = tr % 2, ti % 2 + carry_r, carry_i = tr // 2, ti // 2 + need(-1 <= carry_r <= 2 and -1 <= carry_i <= 2, + "finite carry range") + if bit_index == 0: + need(out_r == out_i == 0, "nonexact half") + else: + data[0].write(out_r) + data[1].write(out_i) + walk(data, 1, 1) + if upper: + # The second output is the last reader of this bit. + for tape in scratch: + tape.write(0) + walk(scratch, 1, 1) + # Arithmetic right shift duplicates the numerator sign bit. + data[0].write(out_r) + data[1].write(out_i) + walk(data, 1, 1) + carry_r = carry_i = out_r = out_i = a = b = c = d = tr = ti = 0 + if not upper: + walk(scratch, -1, half * width) + walk(scratch, -1, size * width // 2) + walk(data, -1, size * width) + return (bit, carry_r, carry_i, out_r, out_i, a, b, c, d, tr, ti) + + +def encode(values, width): + """Unmetered fixture preparation, not part of the kernel/caller claim.""" + need(all(type(v) is int and -(1 << (width - 1)) <= v < (1 << (width - 1)) + for v in values), "signed input range") + return [(v >> bit) & 1 for v in values for bit in range(width)] + + +def decode(tape, width): + """Unmetered test observation, not part of the physical implementation.""" + values = [] + for start in range(0, len(tape.cells), width): + word = sum(tape.cells[start + bit] << bit for bit in range(width)) + values.append(word - ((word >> (width - 1)) << width)) + return values + + +def fixture(real, imag, width, dirty=1, origins=None, trace=False): + size = len(real) + need(size == len(imag), "component lengths") + origins = origins or [0] * 6 + need(len(origins) == 6, "six origins") + streams = [encode(real, width), encode(imag, width)] + streams += [[dirty] * (size * width // 2) for _ in range(4)] + return [Tape(bits, origin, trace, discardable=(index >= 2)) + for index, (bits, origin) in enumerate(zip(streams, origins))] From 5aca96b551a72282272fa72f34bdaa5eb3fce276 Mon Sep 17 00:00:00 2001 From: Chris R Date: Mon, 19 Oct 2026 13:13:04 +1100 Subject: [PATCH 3/9] research(qq16): add exact native-bound axis verification --- research/qq16-gaussian-axis-tapes/verify.py | 215 ++++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 research/qq16-gaussian-axis-tapes/verify.py diff --git a/research/qq16-gaussian-axis-tapes/verify.py b/research/qq16-gaussian-axis-tapes/verify.py new file mode 100644 index 0000000000..6f384e6863 --- /dev/null +++ b/research/qq16-gaussian-axis-tapes/verify.py @@ -0,0 +1,215 @@ +"""Exact behavioural verification and source binding for the axis kernel. + +Clear1nsight, with substantial OpenAI ChatGPT assistance. Apache-2.0. +This checks a local implementation, not full producer or supplier admission. +""" +import argparse +from collections import Counter +import hashlib +import itertools +import json +from pathlib import Path +from types import SimpleNamespace + +PACKAGE = Path(__file__).resolve().parent +ROOT = PACKAGE.parents[1] +BASE = "20ecf2891d80b5acf18d980b2164fb44ea7faa90" +INPUTS = { + "research/qq16-native-rounded-components/vendor/native.py": ( + "e1976b3a55a40206808405b99a4c443093378bef", + "999eb1230798b25821de7771ecfa86381e137124059b30ccef167169d176ee8e"), + "research/qq16-all-depth-producer-grid/RESULT.json": ( + "372809009d835ce707eace8d514a667f2301b1d8", + "b954ab5c5a720b21a9ab49bda2e1a0824ab184a482243d6263dab3c4bddb91bb"), +} + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def module(path): + # Execute source bytes, never a cached .pyc. Predecessor bytes are checked + # before this function is called; no predecessor dispatcher is reused. + namespace = {"__name__": "axis_audit_module", "__file__": str(path)} + exec(compile(path.read_bytes(), str(path), "exec"), namespace) + return SimpleNamespace(**namespace) + + +def sources(root=ROOT, package=PACKAGE): + manifest = json.loads((package / "SOURCES.json").read_text()) + need(manifest["base_commit"] == BASE, "source base") + rows = [r for r in manifest["files"] if r["usage"] == "input"] + need(len(rows) == len(INPUTS), "source input cardinality") + need({r["path"] for r in rows} == set(INPUTS), "source input set") + for row in rows: + blob, sha = INPUTS[row["path"]] + need((row["git_blob"], row["sha256"]) == (blob, sha), "source pin") + path = root / row["path"] + need(not any(p.is_symlink() for p in [path, *path.parents]), "source symlink") + raw = path.read_bytes() + need(len(raw) <= 1_000_000, "source size") + need(hashlib.sha256(raw).hexdigest() == sha, "source SHA256") + need(hashlib.sha1(b"blob " + str(len(raw)).encode() + b"\0" + raw).hexdigest() + == blob, "source Git blob") + native = module(root / next(iter(INPUTS))) + receipt = json.loads((root / list(INPUTS)[1]).read_text()) + lines = receipt["direct_cost_at_one"]["native_gaussian_lines"] + need(type(lines) is int and lines == 11076, "inherited factor count") + need(receipt["physical_routing_priced"] is False + and receipt["supplier_admission"] is False, "inherited claim boundary") + return native, receipt + + +def oracle(real, imag, axis, sign, width): + """Independent integer formula with the full stated domain checked.""" + rr, ii = [], [] + for x in range(len(real)): + y = x ^ (1 << axis) + numerators = (real[x] + real[y] + sign * (imag[y] - imag[x]), + imag[x] + imag[y] + sign * (real[x] - real[y])) + for z in numerators: + need(z % 2 == 0, "oracle nonexact half") + need(-(1 << (width - 1)) <= z < (1 << (width - 1)), + "oracle numerator overflow") + rr.append(numerators[0] // 2) + ii.append(numerators[1] // 2) + return rr, ii + + +def check_case(t, real, imag, n, width, axis, sign, dirty=1, trace=False): + want = oracle(real, imag, axis, sign, width) + tapes = t.fixture(real, imag, width, dirty, + origins=[-31, 7, 101, -85, 23, 5], trace=trace) + exterior = [dict(tape.exterior) for tape in tapes] + control = t.axis_kernel(tapes, n, width, axis, sign) + need(control == (0,) * 11, "finite control cleanup") + got = t.decode(tapes[0], width), t.decode(tapes[1], width) + need(got == want, "Gaussian value mismatch") + need(all(tape.head == tape.origin for tape in tapes), "head restoration") + need(all(not any(tape.cells) for tape in tapes[2:]), "scratch cleanup") + need([tape.exterior for tape in tapes] == exterior, "dirty exterior") + units = (1 << n) * width + # Independent closed-window count, separated by physical tape role. + for tape in tapes[:2]: + need(tape.count == {"read": units, "write": units, "move": 4 * units}, + "data tape tariff") + for tape in tapes[2:]: + need(tape.count == {"read": units, "write": units, "move": 3 * units}, + "scratch tape tariff") + return tapes + + +def verify(): + native, inherited = sources() + t = module(PACKAGE / "tapes.py") + pair_cases = 0 + for a, b, c, d in itertools.product(range(-4, 4), repeat=4): + for sign in (-1, 1): + check_case(t, [2*a, 2*c], [2*b, 2*d], 1, 7, 0, sign) + pair_cases += 1 + + routed_cases = 0 + metered_actions = pair_cases * 32 * 2 * 7 + for n in range(1, 8): + size = 1 << n + real = [2 * ((7*x + 1) % 23 - 11) for x in range(size)] + imag = [2 * ((11*x + 4) % 19 - 9) for x in range(size)] + for axis in range(n): + for sign in (-1, 1): + check_case(t, real, imag, n, 8, axis, sign) + routed_cases += 1 + metered_actions += 32 * size * 8 + + boundary_cases = 0 + for width in (2, 3, 4, 8, 32, 64, 279, 317, 545): + lo, hi = -(1 << (width - 2)), (1 << (width - 2)) - 1 + for real, imag in (([lo, lo], [0, 0]), ([hi, hi], [0, 0]), + ([0, 0], [lo, lo]), ([0, 0], [hi, hi])): + for sign in (-1, 1): + check_case(t, real, imag, 1, width, 0, sign) + boundary_cases += 1 + metered_actions += 32 * 2 * width + + real = [2 * ((x*x + 7*x) % 101 - 50) for x in range(512)] + imag = [2 * ((13*x + 1) % 97 - 48) for x in range(512)] + native_cases = 0 + native_digest = hashlib.sha256() + for axis in range(9): + for sign in (-1, 1): + tapes = check_case(t, real, imag, 9, 12, axis, sign) + re, im, exponent = native.line(native.vector(real, imag), 1 << axis, sign) + need(all(x % (1 << exponent) == 0 for x in re + im), "native exact grid") + want = ([x // (1 << exponent) for x in re], + [x // (1 << exponent) for x in im]) + need((t.decode(tapes[0], 12), t.decode(tapes[1], 12)) == want, + "pinned native mismatch") + native_digest.update(json.dumps(want, separators=(",", ":")).encode()) + native_cases += 1 + metered_actions += 32 * 512 * 12 + + # Two successive differently oriented axes reuse the *same* scratch, + # and then their inverses undo the exact common-grid operation. + real, imag = [16*(x-7) for x in range(16)], [16*(3-x) for x in range(16)] + tapes = t.fixture(real, imag, 12) + for axis, sign in ((0, 1), (3, -1), (3, 1), (0, -1)): + before = t.decode(tapes[0], 12), t.decode(tapes[1], 12) + want = oracle(*before, axis, sign, 12) + need(t.axis_kernel(tapes, 4, 12, axis, sign) == (0,) * 11, "reuse control") + need((t.decode(tapes[0], 12), t.decode(tapes[1], 12)) == want, "reuse values") + need(all(not any(s.cells) and s.head == s.origin for s in tapes[2:]), + "reuse scratch boundary") + need((t.decode(tapes[0], 12), t.decode(tapes[1], 12)) == (real, imag), + "inverse composition") + need(sum(sum(s.count.values()) for s in tapes) == 4 * 32 * 16 * 12, + "reuse tariff") + metered_actions += 4 * 32 * 16 * 12 + + result = { + "status": "PASS_QQ16_GAUSSIAN_AXIS_TAPES", + "source_base": BASE, + "scope": "Nonuniform six-tape axis kernel on supplied owned windows", + "exhaustive_scaled_signed_pair_cases": pair_cases, + "routed_cases_n1_through_n7": routed_cases, + "signed_boundary_cases": boundary_cases, + "pinned_native_cases": native_cases, + "native_output_digest": native_digest.hexdigest(), + "same_scratch_composed_axes": 4, + "total_metered_actions": metered_actions, + "cell_actions_per_NW": {"read": 6, "write": 6, "move": 20, "total": 32}, + "data_bits_per_NW": 2, + "discardable_scratch_bits_per_NW": 2, + "inherited_axis_factors_per_tensor_layer": + inherited["direct_cost_at_one"]["native_gaussian_lines"], + "conditional_axis_only_actions_per_lambda_NW": 32 * 11076, + "complete_producer": False, + "caller_layout_admitted": False, + "new_kappa": False, + } + return result + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--write", type=Path, help="Create a new receipt, never overwrite") + args = parser.parse_args() + # Fail before an expensive replay if an explicit destination already exists. + if args.write is not None: + need(not args.write.exists(), "receipt output exists") + result = verify() + text = json.dumps(result, indent=2) + "\n" + if args.write is not None: + with args.write.open("x", encoding="utf-8") as stream: + stream.write(text) + else: + stored = json.loads((PACKAGE / "RESULT.json").read_text()) + need(json.dumps(stored, sort_keys=True) == json.dumps(result, sort_keys=True), + "receipt mismatch") + print(result["status"], "pairs=" + str(result["exhaustive_scaled_signed_pair_cases"]), + "native=" + str(result["pinned_native_cases"]), "actions=32*N*W", + "no_new_kappa") + + +if __name__ == "__main__": + main() From 20d53ecc0c3057785a866847c33a6d72d2dc7aef Mon Sep 17 00:00:00 2001 From: Chris R Date: Mon, 19 Oct 2026 13:13:30 +1100 Subject: [PATCH 4/9] research(qq16): pin axis tariff and predecessor sources --- research/qq16-gaussian-axis-tapes/RESULT.json | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 research/qq16-gaussian-axis-tapes/RESULT.json diff --git a/research/qq16-gaussian-axis-tapes/RESULT.json b/research/qq16-gaussian-axis-tapes/RESULT.json new file mode 100644 index 0000000000..51317fe0ae --- /dev/null +++ b/research/qq16-gaussian-axis-tapes/RESULT.json @@ -0,0 +1,25 @@ +{ + "status": "PASS_QQ16_GAUSSIAN_AXIS_TAPES", + "source_base": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "scope": "Nonuniform six-tape axis kernel on supplied owned windows", + "exhaustive_scaled_signed_pair_cases": 8192, + "routed_cases_n1_through_n7": 56, + "signed_boundary_cases": 72, + "pinned_native_cases": 18, + "native_output_digest": "202a896bd27c275ba90e2a284874b74f19b6f750c6012dc07a1e0f24d8e7f175", + "same_scratch_composed_axes": 4, + "total_metered_actions": 8663040, + "cell_actions_per_NW": { + "read": 6, + "write": 6, + "move": 20, + "total": 32 + }, + "data_bits_per_NW": 2, + "discardable_scratch_bits_per_NW": 2, + "inherited_axis_factors_per_tensor_layer": 11076, + "conditional_axis_only_actions_per_lambda_NW": 354432, + "complete_producer": false, + "caller_layout_admitted": false, + "new_kappa": false +} From 185b2cc0ee76499182366d142b1ebf876ecc2e83 Mon Sep 17 00:00:00 2001 From: Chris R Date: Mon, 19 Oct 2026 13:13:33 +1100 Subject: [PATCH 5/9] research(qq16): pin axis tariff and predecessor sources --- .../qq16-gaussian-axis-tapes/SOURCES.json | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 research/qq16-gaussian-axis-tapes/SOURCES.json diff --git a/research/qq16-gaussian-axis-tapes/SOURCES.json b/research/qq16-gaussian-axis-tapes/SOURCES.json new file mode 100644 index 0000000000..14a7cf2d65 --- /dev/null +++ b/research/qq16-gaussian-axis-tapes/SOURCES.json @@ -0,0 +1,30 @@ +{ + "schema_version": 1, + "base_commit": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "b1fea0c94436b236cc2b7d41a7be032811b94c81", + "sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "67f085acd86acd7d4e03922d9cf4b26bca66fed5", + "sha256": "47b42433f5a85809a3aadd29c2c339da2c6ed728e4f7762df6b88bccb7874cf0" + }, + { + "path": "research/qq16-native-rounded-components/vendor/native.py", + "usage": "input", + "git_blob": "e1976b3a55a40206808405b99a4c443093378bef", + "sha256": "999eb1230798b25821de7771ecfa86381e137124059b30ccef167169d176ee8e" + }, + { + "path": "research/qq16-all-depth-producer-grid/RESULT.json", + "usage": "input", + "git_blob": "372809009d835ce707eace8d514a667f2301b1d8", + "sha256": "b954ab5c5a720b21a9ab49bda2e1a0824ab184a482243d6263dab3c4bddb91bb" + } + ] +} From b7b7a6e8e8b0e51bc70e122e4d2a57c81173c76b Mon Sep 17 00:00:00 2001 From: Chris R Date: Mon, 19 Oct 2026 13:15:33 +1100 Subject: [PATCH 6/9] test(qq16): reject malformed tape and source contracts --- .../qq16-gaussian-axis-tapes/test_verify.py | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 research/qq16-gaussian-axis-tapes/test_verify.py diff --git a/research/qq16-gaussian-axis-tapes/test_verify.py b/research/qq16-gaussian-axis-tapes/test_verify.py new file mode 100644 index 0000000000..b5ede4903f --- /dev/null +++ b/research/qq16-gaussian-axis-tapes/test_verify.py @@ -0,0 +1,130 @@ +"""Reject malformed caller contracts, leaked scratch and uncharged operations. + +Clear1nsight, with substantial OpenAI ChatGPT assistance. Apache-2.0. +""" +import shutil +import sys +import tempfile +import unittest +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import tapes +import verify + + +class PhysicalAxisControls(unittest.TestCase): + def good(self): + return tapes.fixture([4, -2], [0, 2], 5, origins=[-8, 4, 22, 31, -11, 7]) + + def test_valid_dirty_scratch(self): + verify.check_case(tapes, [4, -2], [0, 2], 1, 5, 0, 1) + verify.check_case(tapes, [4, -2], [0, 2], 1, 5, 0, -1, dirty=0) + + def test_invalid_line_parameters(self): + for axis, sign in [(-1, 1), (1, 1), (0, 0), (0, 2)]: + with self.subTest(axis=axis, sign=sign), self.assertRaises(ValueError): + tapes.axis_kernel(self.good(), 1, 5, axis, sign) + + def test_forbid_data_scratch_alias(self): + v = self.good() + v[5] = v[0] + with self.assertRaisesRegex(ValueError, "six distinct"): + tapes.axis_kernel(v, 1, 5, 0) + v = self.good() + v[5].cells = v[0].cells + with self.assertRaisesRegex(ValueError, "disjoint tape"): + tapes.axis_kernel(v, 1, 5, 0) + + def test_forbid_borrowed_scratch(self): + v = self.good() + v[2].discardable = False + with self.assertRaisesRegex(ValueError, "owned scratch"): + tapes.axis_kernel(v, 1, 5, 0) + + def test_wrong_entry_heads(self): + v = self.good() + v[3].move(1) + with self.assertRaisesRegex(ValueError, "entry heads"): + tapes.axis_kernel(v, 1, 5, 0) + + def test_inexact_numerator_rejected(self): + v = tapes.fixture([1, 0], [0, 0], 5) + with self.assertRaisesRegex(ValueError, "nonexact half"): + tapes.axis_kernel(v, 1, 5, 0) + with self.assertRaisesRegex(ValueError, "oracle nonexact"): + verify.oracle([1, 0], [0, 0], 0, 1, 5) + + def test_num_overflow_is_explicit_caller_duty(self): + with self.assertRaisesRegex(ValueError, "oracle numerator overflow"): + verify.oracle([15, 15], [15, -15], 0, 1, 5) + + def test_tape_move_cannot_escape(self): + v = self.good()[2] + with self.assertRaisesRegex(ValueError, "move outside"): + v.move(-1) + for _ in range(len(v.cells)): + v.move(1) + with self.assertRaisesRegex(ValueError, "read outside"): + v.read() + with self.assertRaisesRegex(ValueError, "write outside"): + v.write(1) + + def test_missing_scratch_zero_rejected(self): + original = tapes.Tape.write + def corrupt(self, value): + if self.discardable and value == 0 and self.count["read"]: + self.record("write") # pay operation while omitting its effect + else: + original(self, value) + tapes.Tape.write = corrupt + try: + with self.assertRaisesRegex(ValueError, "scratch cleanup"): + verify.check_case(tapes, [4, -2], [0, 2], 1, 5, 0, 1) + finally: + tapes.Tape.write = original + + def test_omitted_movement_charge_rejected(self): + original = tapes.Tape.record + def corrupt(self, action): + if action != "move": + original(self, action) + tapes.Tape.record = corrupt + try: + with self.assertRaisesRegex(ValueError, "tariff"): + verify.check_case(tapes, [4, -2], [0, 2], 1, 5, 0, 1) + finally: + tapes.Tape.record = original + + def test_dirty_exterior_never_touched(self): + v = verify.check_case(tapes, [4, -2], [0, 2], 1, 5, 0, 1, trace=True) + for tape in v: + self.assertTrue(all(0 <= pos <= len(tape.cells) + for _, pos in tape.trace)) + self.assertTrue(all(pos < len(tape.cells) + for op, pos in tape.trace if op in ("read", "write"))) + + def test_source_and_manifest_corruption_rejected(self): + with tempfile.TemporaryDirectory() as td: + root = Path(td) / "repo" + package = root / "research" / "qq16-gaussian-axis-tapes" + package.mkdir(parents=True) + shutil.copyfile(verify.PACKAGE / "SOURCES.json", package / "SOURCES.json") + for name in verify.INPUTS: + dst = root / name + dst.parent.mkdir(parents=True, exist_ok=True) + shutil.copyfile(verify.ROOT / name, dst) + verify.sources(root, package) + source = root / "research/qq16-native-rounded-components/vendor/native.py" + source.write_bytes(source.read_bytes() + b"\n# changed source\n") + with self.assertRaisesRegex(ValueError, "source SHA256"): + verify.sources(root, package) + shutil.copyfile(verify.ROOT / next(iter(verify.INPUTS)), source) + mf = package / "SOURCES.json" + mf.write_text(mf.read_text().replace("e1976b3a", "e1976b3b")) + with self.assertRaisesRegex(ValueError, "source pin"): + verify.sources(root, package) + + +if __name__ == "__main__": + unittest.main() From 7a20def7edd977dfefaee68611cdece5791190e9 Mon Sep 17 00:00:00 2001 From: Chris R Date: Mon, 19 Oct 2026 13:16:37 +1100 Subject: [PATCH 7/9] research(qq16): declare scope, dependencies and registered replay --- research/qq16-gaussian-axis-tapes/TASK.json | 101 ++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 research/qq16-gaussian-axis-tapes/TASK.json diff --git a/research/qq16-gaussian-axis-tapes/TASK.json b/research/qq16-gaussian-axis-tapes/TASK.json new file mode 100644 index 0000000000..4b8e247dbf --- /dev/null +++ b/research/qq16-gaussian-axis-tapes/TASK.json @@ -0,0 +1,101 @@ +{ + "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": "changed", + "actual_scope": "One exact, metered six-tape Gaussian coordinate axis step on supplied owned data/scratch windows for the pinned QQ16 native reference", + "scope_change_reason": "The original producer+consumer card remains unsolved, while numerical producer and cover-routing packages already cover those subcontracts. This bounded physical coordinate primitive changes the object to one explicit missing tape boundary; it does not claim a complete producer or recursive cost.", + "bottleneck_link": "Physical scalar Gaussian execution is one unpriced ingredient between the all-depth QQ16 numeric reference and an actual caller, but further work must bind this ingredient to legal producer windows and an affordable F17 consumer.", + "budget_minutes": 60, + "stop_rule": "Stop after exact six-tape value/cleanup/head/count verification and source-pinned controls. Do not extrapolate axis-only cell counts to a physical QQ16 producer without a charged caller and complete supplier invoice.", + "outcome": "partial", + "evidence": "Executable six-tape algorithm with 32NW metered actions, exact native-line agreement at 18 cases, 8,192 finite pairs and 12 behavioural test groups. No full producer or kappa claim.", + "author": "Clear1nsight", + "ai_assistance": "Substantial OpenAI ChatGPT assistance in derivation, code, tests, and documentation. No independent human or proof-kernel review.", + "open_questions": [ + { + "question": "Does a literal F0/B1 native event admit the required six supplied bit-tape windows?", + "why_it_matters": "Local physical execution is not source admission or bounded global movement.", + "first_step": "Bind one selected Gaussian child to an owner/frame and explicit data/scratch tape intervals.", + "blocked_by": "Actual caller allocation, layout conversion, and borrowed-helper lifetime." + }, + { + "question": "Can consecutive axis/monomial/cover events be executed at an affordable complete tariff?", + "why_it_matters": "Repacking and consumer costs can erase the local tariff advantage.", + "first_step": "Price one adjacent axis and monomial pair from literal source.", + "blocked_by": "Physical address/control and full F0/B1/F17 invoice." + }, + { + "question": "Are dirty helpers restored in the caller's required coordinate frame?", + "why_it_matters": "Arbitrary helper return may be frame-relative, not literal numeric identity.", + "first_step": "Bind one caller L224 entry/exit frame, using PR3293 as calibrated test.", + "blocked_by": "Legal caller borrowed-state semantics and paid adapter." + } + ], + "selection": { + "method": "Explicit assigned QQ16 physical-producer task, no random reroll.", + "base_main": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "overlap": "Consulted #3303/#3652 numeric, #3394 cover routing, #3241 physical SCALE, #3374 F17 bill and #3339 missing caller. Live title-only PR search found no identical six-tape Gaussian axis; hidden discussion coverage not complete." + }, + "family_decision": { + "decision": "narrow and stop", + "proved": "Conditional per-axis signed-binary implementation under explicit divisible, nonoverflowing operands and supplied six owned windows, exact counted cell operations.", + "unknown": "Caller encoding/admission, layout transitions, address/control operations, physical producer aggregation, borrowed-helper semantics, F17 consumer, recursive moment and all-size transfer." + } +} From 2be0f348b79f58073b7eb3ce568b9e4db6e0426f Mon Sep 17 00:00:00 2001 From: Chris R Date: Mon, 19 Oct 2026 13:16:40 +1100 Subject: [PATCH 8/9] research(qq16): declare scope, dependencies and registered replay --- research/qq16-gaussian-axis-tapes/VERIFY.json | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 research/qq16-gaussian-axis-tapes/VERIFY.json diff --git a/research/qq16-gaussian-axis-tapes/VERIFY.json b/research/qq16-gaussian-axis-tapes/VERIFY.json new file mode 100644 index 0000000000..0c22b446b4 --- /dev/null +++ b/research/qq16-gaussian-axis-tapes/VERIFY.json @@ -0,0 +1,35 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/qq16-native-rounded-components/vendor/native.py", + "research/qq16-all-depth-producer-grid/RESULT.json" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-Werror", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 240, + "checks": "Hash authentic source bytes; test native operator, exact pair and routed fixture values, all tape movement/cleanup/counts and frozen result." + }, + { + "argv": [ + "{python}", + "-I", + "-Werror", + "-O", + "-B", + "{package}/test_verify.py" + ], + "timeout_seconds": 120, + "checks": "Twelve behavioural controls including source tamper, scratch leak, missing movement invoice, malformed alias/head and invalid arithmetic domains." + } + ] +} From 2f25b8a68ee676031bcf590c2a95c96a3165dde6 Mon Sep 17 00:00:00 2001 From: Chris R Date: Mon, 19 Oct 2026 15:13:26 +1100 Subject: [PATCH 9/9] fix(actions): apply existing P112 runner-context repair Carry the focused change from 89031d21f01f8b676f87c76443f5afc41457a17c (PR #8) onto this active branch. Initialise TMPDIR after runner setup, preserving workflow triggers, repository guard, permissions, pinned actions, timeouts, replay commands and all research inputs. Validated YAML, exact semantic delta, shell syntax and TMPDIR assignment including spaces. Substantial OpenAI assistance. --- .github/workflows/p112-common-slice.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/p112-common-slice.yml b/.github/workflows/p112-common-slice.yml index 37f99ca573..48047f61c4 100644 --- a/.github/workflows/p112-common-slice.yml +++ b/.github/workflows/p112-common-slice.yml @@ -15,9 +15,9 @@ jobs: if: github.repository == 'CrocSwap/integer-mult-bounds' runs-on: ubuntu-24.04 timeout-minutes: 20 - env: - TMPDIR: ${{ runner.temp }}/p112-common-slice steps: + - name: Initialise P112 work directory + run: echo "TMPDIR=$RUNNER_TEMP/p112-common-slice" >> "$GITHUB_ENV" - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with: fetch-depth: 0