diff --git a/research/source-archives/t740-joint-axis-pr3200/BINS.json.gz b/research/source-archives/t740-joint-axis-pr3200/BINS.json.gz new file mode 100644 index 0000000000..fc2446437c Binary files /dev/null and b/research/source-archives/t740-joint-axis-pr3200/BINS.json.gz differ diff --git a/research/source-archives/t740-joint-axis-pr3200/MOVES.json.gz b/research/source-archives/t740-joint-axis-pr3200/MOVES.json.gz new file mode 100644 index 0000000000..c349804d70 Binary files /dev/null and b/research/source-archives/t740-joint-axis-pr3200/MOVES.json.gz differ diff --git a/research/source-archives/t740-joint-axis-pr3200/PROVENANCE.json b/research/source-archives/t740-joint-axis-pr3200/PROVENANCE.json new file mode 100644 index 0000000000..d72ec29a91 --- /dev/null +++ b/research/source-archives/t740-joint-axis-pr3200/PROVENANCE.json @@ -0,0 +1,10 @@ +{ + "source_pr": "https://github.com/CrocSwap/integer-mult-bounds/pull/3200", + "source_head": "f09e5b25381393c604082e58fbe56896b13171b5", + "files": { + "BINS.json.gz": {"git_blob": "fc2446437c8ba8b5f10aa4cefd5290927c64dc26", "sha256": "fee514002092bdbe0874d8c1f6b355340fca621a39c2aa77281a6a4fca266606"}, + "MOVES.json.gz": {"git_blob": "c349804d708f75d41bd164f389d1c59c39338f0f", "sha256": "b9a01dcfb777d1cd3f90308e8429e4685eef0d5be5a6f2d03873b85b4982df80"}, + "RESULT.json": {"git_blob": "3b6d80114eb9304e9021141c7dee9ed97f4c6352", "sha256": "96818266cd00dd2dd4d04625c88c7ffd42fc0bc03c374d89b1fb3b51d6f76fdd"}, + "verify.py": {"git_blob": "4083be130e658e58dbb96a346321aed962ad57cd", "sha256": "b460e63bb62e086dde844e43b68113bad998008648936c12b553f15ec8fee313"} + } +} diff --git a/research/source-archives/t740-joint-axis-pr3200/RESULT.json b/research/source-archives/t740-joint-axis-pr3200/RESULT.json new file mode 100644 index 0000000000..3b6d80114e --- /dev/null +++ b/research/source-archives/t740-joint-axis-pr3200/RESULT.json @@ -0,0 +1,62 @@ +{ + "status": "PASS_IDLE_DONOR_GREEDY_R438_T740", + "T": 740, + "axis_moves": 430164, + "donor_children": 151509, + "receiver_children": 167112, + "idle_before": { + "1": 173160, + "3": 48951, + "5": 13875, + "48": 282569 + }, + "idle_after": { + "1": 149514, + "2": 15880, + "3": 14951, + "5": 13855, + "42": 32303, + "44": 5120, + "45": 36420, + "46": 6300, + "47": 20, + "48": 35294, + "49": 28786, + "50": 13600, + "51": 124726 + }, + "profile": { + "1": 16353294, + "2": 4837720, + "3": 1533431, + "4": 679320, + "5": 147055, + "8": 53280, + "42": 32303, + "44": 5120, + "45": 36420, + "46": 6300, + "47": 20, + "48": 35294, + "49": 28786, + "50": 13600, + "51": 124726 + }, + "complex_root": [ + "2168508777157659440043/1250000000000000000000000", + "3469614043452255104069/2000000000000000000000000" + ], + "complex_root_decimal": "17348070217261275520344e-25", + "bit": "69393850564807966059/40000000000000000000000", + "binding": "complex", + "kappa": "17348070217261275520339999999999999999999998999999999999999999999999/10000000000000000000000000000000000000000000000000000000000000000000000", + "kappa_decimal": "0.0017348070217261275520339999999999999999999998999999999999999999999999", + "gain_over_pr3198": "36464614614391539/1000000000000000000000000", + "gain_over_pr3184": "4617960492276791939/1000000000000000000000000", + "gain_over_pr3148": "1257381761882635037/250000000000000000000000", + "max_child_rank": 51, + "halving": [ + 5329, + 5202 + ] +} diff --git a/research/source-archives/t740-joint-axis-pr3200/verify.py b/research/source-archives/t740-joint-axis-pr3200/verify.py new file mode 100644 index 0000000000..4083be130e --- /dev/null +++ b/research/source-archives/t740-joint-axis-pr3200/verify.py @@ -0,0 +1,219 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Independent verifier (does not import build.py) for the idle-remainder donor exchanges. + +Re-derives from BINS / MOVES / DATA-PHASES: donor axes come from the donor's own idle remainder +(recipe axes [used, cap)); receivers are unhosted (used == 0); no child both donates and receives; +every moved axis is a unit vector orthogonal to all of the receiver's axes held at that moment and +commutes with every stage entry/exit X/Y translation, the terminal Y translation and both +children's terminal translations; final ranks <= 51; per-group axis multisets unchanged; the +complete profile and rank mass; an exact complex root bracket with its own interval arithmetic; +kappa = min(floor24(complex_lower), PR589 bit) - 1e-46 - 1e-70 and its gates. +Optional --t740 rebinds BINS to PR3148's materialized fill. Mutation controls must be rejected. +""" +import argparse, copy, gzip, hashlib, json +from collections import Counter, defaultdict +from fractions import Fraction as F +from pathlib import Path + +PKG = Path(__file__).resolve().parent +PHASES = PKG.parents[1] / 'research/adaptive-kernel-demotion/inputs/DATA-PHASES.json' +T = 740 +LOCAL = {1: 2433, 2: 724, 3: 228, 4: 102, 5: 20, 8: 8} +IDLE = {1: 173160, 3: 48951, 5: 13875, 48: 282569} +BITCERT = PKG.parents[1] / 'research/r438-native-rehost/CERTIFICATE.json' +BIT = None # R438 bit endpoint, re-derived from its certificate's bit profile in check_bit() +GATES = dict(PR3198=F('0.0017347705571115131604949999999999999999999998999999999999999999999999'), PR3148=F('0.0017297774946785970118859999999999999999999998999999999999999999999999'), + PR3184=F('0.0017301890612338507600949999999999999999999998999999999999999999999999')) + + +class Reject(Exception): pass +def req(ok, why): + if not ok: raise Reject(why) +def load(p): + b = Path(p).read_bytes(); return json.loads(gzip.decompress(b) if b[:2] == b'\x1f\x8b' else b) +def par(a, b): return bin(a & b).count('1') & 1 + + +def audit(rec, bins, moves): + caps = {(p, c): ch['rank'] for p, r in rec.items() for c, ch in enumerate(r['idle_children'])} + G = {} + for rep, p, kids in bins['groups']: + req((rep, p) not in G and 0 <= rep < T and p in rec, 'group key') + G[rep, p] = {c: u for c, u in kids} + req(all(0 <= u < caps[p, c] for c, u in kids), 'used below capacity') + req(Counter(caps[p, c] - u for (rep, p), kids in G.items() for c, u in kids.items()) == Counter(IDLE), 'idle bill') + trans = {} + for p, rc in rec.items(): + trans[p] = {int(s[k]) for s in rc['stage_alignment'] for k in ('entry_X', 'exit_X', 'entry_Y', 'exit_Y')} | {int(rc['terminal_Y_translation'])} + for c, ch in enumerate(rc['idle_children']): + ax = [int(v) for v in ch['orthogonal_axes']] + req(all(par(v, v) == 1 for v in ax) and all(par(a, b) == 0 for i, a in enumerate(ax) for b in ax[i + 1:]), 'recipe axes orthonormal') + state = {} + def cur(rep, p, c): + k = (rep, p, c) + if k not in state: + u = G[rep, p][c]; state[k] = dict(axes=set(int(v) for v in rec[p]['idle_children'][c]['orthogonal_axes'][u:caps[p, c]]), role=None) + return state[k] + for m in moves: + rep, p, c, d, v = m + req((rep, p) in G and c in G[rep, p] and d in G[rep, p] and c != d, 'children of the group') + req(G[rep, p][d] == 0, 'receiver must be unhosted') + sc, sd = cur(rep, p, c), cur(rep, p, d) + req(sc['role'] != 'R' and sd['role'] != 'D', 'child both donates and receives') + own = set(int(x) for x in rec[p]['idle_children'][c]['orthogonal_axes'][G[rep, p][c]:caps[p, c]]) + req(v in sc['axes'] and v in own, 'axis not in donor remainder') + req(par(v, v) == 1 and all(par(v, x) == 0 for x in sd['axes']), 'axis not orthogonal to receiver axes') + tc = int(rec[p]['idle_children'][c]['translation_after']); td = int(rec[p]['idle_children'][d]['translation_after']) + req(all(par(v, x) == 0 for x in trans[p] | {tc, td}), 'axis does not commute with translations') + sc['axes'].discard(v); sd['axes'].add(v); sc['role'] = 'D'; sd['role'] = 'R' + req(len(sd['axes']) <= 51, 'rank above 51') + final = Counter() + for (rep, p), kids in G.items(): + for c, u in kids.items(): + r = len(state[rep, p, c]['axes']) if (rep, p, c) in state else caps[p, c] - u + if r: final[r] += 1 + return final + + +def mom(prof, b): + Q72 = 10 ** 72 + def rd(x): return F(x.numerator * Q72 // x.denominator, Q72) + def ru(x): return F(-((-x.numerator * Q72) // x.denominator), Q72) + def at(z, n): + s, p = F(0), z + for j in range(n): s += p / (2 * j + 1); p *= z * z + return 2 * s, 2 * p / ((2 * n + 1) * (1 - z * z)) + l2 = at(F(1, 3), 130); W = 896 * T; lo = hi = F(0) + for r, n in sorted(prof.items()): + y, k = F(73, r), 0 + while y >= 2: y /= 2; k += 1 + a, e = at((y - 1) / (y + 1), 90) + L0, L1 = rd(a + k * l2[0]), ru(a + e + k * (l2[0] + l2[1])) + def tay(x): + s, t = F(1), F(1) + for j in range(1, 34): t = t * x / j; s += t + return s, t * x / 34 * 3 + e0, _ = tay(b * L0); e1, t1 = tay(b * L1) + lo += n * r * rd(e0); hi += n * r * ru(e1 + t1) + return lo / (73 * W), hi / (73 * W) + + +def check_bit(): + inv = json.loads(BITCERT.read_text())['pipeline']['candidate']['hosted']['invoice'] + prof = {int(k): v for k, v in inv['bit_profile'].items()} + c, cn = F(inv['bit_lower']), F(inv['next_grid_point_rejected']) + req(c == F(inv['bit_lower_decimal']) and cn - c == F(1, 10 ** 24) and 2 * max(prof) ** 2 < 64 ** 2, 'R438 certificate fields') + W = 28416; N = sum(prof.values()) + def bm(b): + lo = hi = F(0) + for r, n in sorted(prof.items()) + [(1, F(32 * 64 * 64 * N, 10 ** 16))]: + l0, l1 = ln64(r); e0, e1 = exbox(b * l0, b * l1); lo += n * r * e0; hi += n * r * e1 + return lo / (64 * W), hi / (64 * W) + req(bm(c)[1] < 1 and bm(cn)[0] > 1, 'R438 bit endpoint accepted at c, rejected at c+1e-24') + return c + + +def ln64(r): + Q72 = 10 ** 72 + def at(z, n): + s, p = F(0), z + for j in range(n): s += p / (2 * j + 1); p *= z * z + return 2 * s, 2 * p / ((2 * n + 1) * (1 - z * z)) + y, k = F(64, r), 0 + while y >= 2: y /= 2; k += 1 + l2 = at(F(1, 3), 130); a, e = at((y - 1) / (y + 1), 90) + return F((a + k * l2[0]).numerator * Q72 // (a + k * l2[0]).denominator, Q72), F(-((-(a + e + k * (l2[0] + l2[1])).numerator * Q72) // (a + e + k * (l2[0] + l2[1])).denominator), Q72) + + +def exbox(x0, x1): + def tay(x): + s, t = F(1), F(1) + for j in range(1, 34): t = t * x / j; s += t + return s, t * x / 34 * 3 + a, _ = tay(x0); b, t = tay(x1) + return a, b + t + + +def run(rec, bins, moves, result): + final = audit(rec, bins, moves) + prof = Counter({r: n * 9 * T for r, n in LOCAL.items()}); prof.update(final); prof = dict(sorted(prof.items())) + req({str(k): v for k, v in prof.items()} == result['profile'], 'declared profile') + req(sum(r * n for r, n in prof.items()) == 65088 * T, 'rank mass 65088*T') + req(max(prof) <= 51 and 73 * 73 > 2 * max(prof) ** 2, 'halving guard') + lo, hi = F(result['complex_root'][0]), F(result['complex_root'][1]) + req(hi - lo == F(1, 10 ** 25) and mom(prof, lo)[1] < 1 and mom(prof, hi)[0] > 1, 'complex root bracket') + C = min(F(lo.numerator * 10 ** 24 // lo.denominator, 10 ** 24), BIT) + req(C < BIT, 'complex binds below the R438 bit endpoint') + kappa = C - F(1, 10 ** 46) - F(1, 10 ** 70) + req(kappa == F(result['kappa']), 'headline kappa') + for n, g in GATES.items(): req(kappa > g, 'kappa must exceed ' + n) + return prof, kappa, lo + + +def main(): + ap = argparse.ArgumentParser(description=__doc__) + ap.add_argument('--t740', type=Path) + ap.add_argument('--providers', type=Path, default=PKG / 'PR3148-PROVIDERS.json') + ap.add_argument('--write', action='store_true', help='rewrite the committed AUDIT.json receipt') + a = ap.parse_args() + if not __debug__: raise SystemExit('assertions required') + raw = PHASES.read_bytes() + req(hashlib.sha256(raw).hexdigest() == 'c5916ff312678f12aba403847643fbbc29f643acec60bdf836fa56cd3e8251fa', 'phases pin') + rec = {r['port']: r for r in json.loads(raw)['recipes']} + global BIT + BIT = check_bit() + bins, mv, result = load(PKG / 'BINS.json.gz'), load(PKG / 'MOVES.json.gz')['moves'], load(PKG / 'RESULT.json') + rebound = False + if a.t740: + fraw = gzip.decompress((a.t740 / 'COMPOSED-FILL.json.gz').read_bytes()) + req(hashlib.sha256(fraw).hexdigest() == '8f4d6965ba573ff2b71fd7bf6b552643e086739d90bd73c55889502077638e00', 'fill pin') + prov = load(a.providers); order = load(a.t740 / 'ORDER.json'); disp = {(s, r): p for s, r, p in load(a.t740 / 'DISPATCH.json')} + used = Counter() + for time, helper, rep, child, port, offset in json.loads(fraw)['rows']: + s, r = order[time]; used[rep, child, port] += prov[disp[s, r]]['widths'][helper] + caps = {(p, c): ch['rank'] for p, r in rec.items() for c, ch in enumerate(r['idle_children'])} + derived = [[rep, p, [[c, used[rep, c, p]] for c in range(len(rec[p]['idle_children'])) if caps[p, c] - used[rep, c, p] > 0]] for rep in range(T) for p in range(112)] + req([g for g in derived if g[2]] == bins['groups'], 'BINS equal the fill') + rebound = True + prof, kappa, lo = run(rec, bins, mv, result) + rej = {} + first_hosted = next(i for i, m in enumerate(mv) if {c: u for c, u in next(g for g in bins['groups'] if g[0] == m[0] and g[1] == m[1])[2]}[m[2]] > 0) + rep, p, c, d, v = mv[first_hosted] + kids = {cc: u for cc, u in next(g for g in bins['groups'] if g[0] == rep and g[1] == p)[2]} + hosted_other = next((cc for cc, u in kids.items() if u > 0 and cc != c), None) + used_axis = int(rec[p]['idle_children'][c]['orthogonal_axes'][0]) + def mut(f): + x = copy.deepcopy(mv); f(x); return x + cases = dict( + hosted_receiver=mut(lambda x: x.__setitem__(first_hosted, [rep, p, c, hosted_other if hosted_other is not None else c, v])), + hosted_axis_from_used_prefix=mut(lambda x: x.__setitem__(first_hosted, [rep, p, c, d, used_axis])), + foreign_axis=mut(lambda x: x.__setitem__(first_hosted, [rep, p, c, d, 1 << 80])), + axis_moved_twice=mut(lambda x: x.insert(first_hosted + 1, list(x[first_hosted]))), + receiver_donates=mut(lambda x: x.append([rep, p, d, c, v])), + dropped_move=mut(lambda x: x.pop(first_hosted)), + ) + for name, x in cases.items(): + try: run(rec, bins, x, result) + except Reject as e: rej[name] = str(e) + else: raise SystemExit('mutation accepted: ' + name) + r2 = copy.deepcopy(result); r2['complex_root'] = [str(lo + F(1, 10 ** 25)), str(lo + F(2, 10 ** 25))] + try: run(rec, bins, mv, r2) + except Reject as e: rej['next_root_grid'] = str(e) + else: raise SystemExit('mutation accepted: next_root_grid') + r3 = copy.deepcopy(result); r3['kappa'] = str(F(result['kappa']) + F(1, 10 ** 24)) + try: run(rec, bins, mv, r3) + except Reject as e: rej['kappa_above_bit'] = str(e) + else: raise SystemExit('mutation accepted: kappa_above_bit') + out = dict(status='PASS_IDLE_DONOR_GREEDY_R438_AUDIT', moves=len(mv), fill_rebound=rebound, kappa=str(kappa), + complex_root_lower=str(lo), binding='bit' if BIT < lo else 'complex', rejected_controls=rej) + if a.write: (PKG / 'AUDIT.json').write_text(json.dumps(out, indent=1, sort_keys=True) + '\n') + else: + strip = lambda d: {k: v for k, v in d.items() if k != 'fill_rebound'} + req(strip(load(PKG / 'AUDIT.json')) == strip(json.loads(json.dumps(out))), 'committed AUDIT.json receipt') + print('PASS_IDLE_DONOR_GREEDY_R438_AUDIT moves=%d controls=%d kappa=%s binding=%s' % (len(mv), len(rej), float(kappa), out['binding'])) + + +if __name__ == '__main__': + try: main() + except Reject as e: raise SystemExit('FAIL: ' + str(e)) diff --git a/research/t740-joint-axis-optimization/OPERATOR-WITNESS.json b/research/t740-joint-axis-optimization/OPERATOR-WITNESS.json new file mode 100644 index 0000000000..b7188620f6 --- /dev/null +++ b/research/t740-joint-axis-optimization/OPERATOR-WITNESS.json @@ -0,0 +1,150 @@ +{ + "baseline_control_modes_passed": 147, + "baseline_owner_used_children": [ + [ + 4, + 31 + ], + [ + 6, + 31 + ], + [ + 8, + 0 + ], + [ + 10, + 0 + ], + [ + 12, + 0 + ], + [ + 13, + 0 + ], + [ + 14, + 31 + ], + [ + 15, + 31 + ] + ], + "candidate_group_moves": [ + [ + 0, + 0, + 12, + 8, + 9007199254740992 + ], + [ + 0, + 0, + 12, + 8, + 1180591620717411303424 + ], + [ + 0, + 0, + 12, + 10, + 18014398509481984 + ], + [ + 0, + 0, + 12, + 10, + 36028797018963968 + ], + [ + 0, + 0, + 14, + 8, + 4722366482869645213696 + ], + [ + 0, + 0, + 15, + 10, + 4722366482869645213696 + ] + ], + "changed_idle_ranks": { + "10": [ + 48, + 51 + ], + "12": [ + 48, + 44 + ], + "14": [ + 1, + 0 + ], + "15": [ + 1, + 0 + ], + "8": [ + 48, + 51 + ] + }, + "conclusion": "The rank-only overlay changes the exact eight-stream physical operator. Its hypothetical root/kappa is inadmissible.", + "first_coordinate_character_mismatch": { + "bit": 53, + "character": 9007199254740992, + "matrix_differences": [ + [ + 1, + 1, + [ + 0, + 1 + ], + [ + 1, + 0 + ] + ], + [ + 3, + 1, + [ + 0, + 0 + ], + [ + 1, + -1 + ] + ], + [ + 6, + 6, + [ + 0, + 1 + ], + [ + -1, + 0 + ] + ] + ] + }, + "owner_replica": 0, + "port": 0, + "source_operator_audit": "research/idle-star-paired-axis-census/verify.py", + "source_operator_audit_base_main": "997e6a9ca7b4f95d50e366f61412fd640d72a88a" +} diff --git a/research/t740-joint-axis-optimization/PR3251-OPERATOR-WITNESS.json b/research/t740-joint-axis-optimization/PR3251-OPERATOR-WITNESS.json new file mode 100644 index 0000000000..ecb90390fb --- /dev/null +++ b/research/t740-joint-axis-optimization/PR3251-OPERATOR-WITNESS.json @@ -0,0 +1,206 @@ +{ + "schema_version": 1, + "source_pr": "https://github.com/CrocSwap/integer-mult-bounds/pull/3251", + "source_head": "d7d6254416f0b3ffe659079cca42fd152df63a36", + "headline_kappa": "0.0017348157703850985634839999999999999999999998999999999999999999999999", + "status": "candidate-specific exact operator rejection; not a complete supplier audit", + "scope": "The pinned PR #3251 profile and moves pass the inherited PR #3200 rank/profile verifier. At owner replica 0, port 0, the six frozen moves change the exact eight-stream operator.", + "owner_replica": 0, + "port": 0, + "initial_children": [ + [ + 4, + 31 + ], + [ + 6, + 31 + ], + [ + 8, + 0 + ], + [ + 10, + 0 + ], + [ + 12, + 0 + ], + [ + 13, + 0 + ], + [ + 14, + 31 + ], + [ + 15, + 31 + ] + ], + "moves": [ + [ + 0, + 0, + 14, + 8, + 4722366482869645213696 + ], + [ + 0, + 0, + 15, + 10, + 4722366482869645213696 + ], + [ + 0, + 0, + 12, + 8, + 4503599627370496 + ], + [ + 0, + 0, + 12, + 8, + 9007199254740992 + ], + [ + 0, + 0, + 12, + 10, + 18014398509481984 + ], + [ + 0, + 0, + 12, + 10, + 36028797018963968 + ] + ], + "rank_changes": { + "8": [ + 48, + 51 + ], + "10": [ + 48, + 51 + ], + "12": [ + 48, + 44 + ], + "14": [ + 1, + 0 + ], + "15": [ + 1, + 0 + ] + }, + "first_coordinate_character_mismatch": { + "checked_equal_characters": [ + 1, + 2, + 4, + 8, + 16, + 32, + 64, + 128, + 256, + 512, + 1024, + 2048, + 4096, + 8192, + 16384, + 32768, + 65536, + 131072, + 262144, + 524288, + 1048576, + 2097152, + 4194304, + 8388608, + 16777216, + 33554432, + 67108864, + 134217728, + 268435456, + 536870912, + 1073741824, + 2147483648, + 4294967296, + 8589934592, + 17179869184, + 34359738368, + 68719476736, + 137438953472, + 274877906944, + 549755813888, + 1099511627776, + 2199023255552, + 4398046511104, + 8796093022208, + 17592186044416, + 35184372088832, + 70368744177664, + 140737488355328, + 281474976710656, + 562949953421312, + 1125899906842624, + 2251799813685248 + ], + "character": 4503599627370496, + "matrix_differences": [ + [ + 1, + 1, + [ + 0, + 1 + ], + [ + 1, + 0 + ] + ], + [ + 3, + 1, + [ + 0, + 0 + ], + [ + 1, + -1 + ] + ], + [ + 6, + 6, + [ + 0, + 1 + ], + [ + -1, + 0 + ] + ] + ] + }, + "interpretation": "This one exact group mismatch rejects this frozen candidate as an operator-preserving T740 allocation. It does not show that every possible phase repair or changed supplier fails." +} diff --git a/research/t740-joint-axis-optimization/RANK-ONLY-MOVES.json.gz b/research/t740-joint-axis-optimization/RANK-ONLY-MOVES.json.gz new file mode 100644 index 0000000000..0ca3653153 Binary files /dev/null and b/research/t740-joint-axis-optimization/RANK-ONLY-MOVES.json.gz differ diff --git a/research/t740-joint-axis-optimization/RANK-ONLY-RESULT.json b/research/t740-joint-axis-optimization/RANK-ONLY-RESULT.json new file mode 100644 index 0000000000..2301116c78 --- /dev/null +++ b/research/t740-joint-axis-optimization/RANK-ONLY-RESULT.json @@ -0,0 +1,66 @@ +{ + "admissible_kappa_claim": null, + "baseline_kappa": "17348070217261275520339999999999999999999998999999999999999999999999/10000000000000000000000000000000000000000000000000000000000000000000000", + "baseline_scaled_objective": "1161037431722757896", + "best_bound": "1.1506691003073893e+18", + "candidate_variables": 139038, + "groups": 82880, + "improves_claim": true, + "kappa_gain": "64033068461157/1000000000000000000000000", + "moves": 430204, + "objective": "CP-SAT global weighted floor table; g(r)=r*((73/r)^p_star-1), p_star=PR3200 complex-root lower endpoint; Decimal precision=90", + "objective_scale": 100000000000000, + "optimized_complex_root": [ + "17348070857591960131911/10000000000000000000000000", + "2168508857198995016489/1250000000000000000000000" + ], + "optimized_kappa": "17348070857591960131909999999999999999999998999999999999999999999999/10000000000000000000000000000000000000000000000000000000000000000000000", + "optimized_scaled_objective": "1161036554853891176", + "orthogonality_conflicts": 68474, + "pattern_changes": 1457, + "patterns": 2328, + "physical_operator_status": "REJECTED_AT_OWNER0_PORT0_CHARACTER_2^53", + "profile": { + "1": 16353294, + "2": 4837720, + "3": 1533431, + "4": 679320, + "42": 32303, + "44": 5160, + "45": 36380, + "46": 6300, + "47": 20, + "48": 35294, + "49": 28786, + "5": 147055, + "50": 13560, + "51": 124766, + "8": 53280 + }, + "rank_only_score_is_not_a_supplier_claim": true, + "recorded_search": { + "best_bound": "1.1506691003073893e+18", + "seed": 0, + "solver_seconds": 119.327, + "threads": 8, + "time_limit_seconds": 120, + "wall_seconds": 195.996 + }, + "same_settings_replay": { + "best_bound": "1.1506753368109844e+18", + "improves_rank_only_kappa": false, + "profile_matches_pr3200_baseline": true, + "seed": 0, + "solver_seconds": 121.636, + "status": "FEASIBLE", + "threads": 8, + "time_limit_seconds": 120 + }, + "solver_seconds": 119.327, + "solver_version": "9.11.4210", + "source_head": "f09e5b25381393c604082e58fbe56896b13171b5", + "status": "FEASIBLE", + "threads": 8, + "wall_seconds": 195.996, + "weighted_objective_upper_bound": 2417924916360415370 +} diff --git a/research/t740-joint-axis-optimization/README.md b/research/t740-joint-axis-optimization/README.md new file mode 100644 index 0000000000..d2a7e522f4 --- /dev/null +++ b/research/t740-joint-axis-optimization/README.md @@ -0,0 +1,128 @@ +# Exact replay rejects two T740 axis-search candidates, including the newer headline + +A global CP-SAT allocation improves the rank-moment surrogate and would give a hypothetical +κ about `0.001734807085759196013190…`, above PR #3200's conditional headline. A fresh overlap +refresh found the newer open per-group headline in PR #3251, `0.001734815770385098563484`. +That number is about `8.6846259e-9` above our rank-only hypothetical, but its pinned allocation +also fails the exact eight-stream operator replay. Neither candidate gives an admissible new κ; +this package claims **no new κ**. + +## What the solver found + +The search starts from the byte-pinned PR #3200 T740 fill and runs CP-SAT over 2,328 distinct +`(port, child-usage)` patterns and 82,880 groups. It considers 139,038 one-axis transfer +candidates, requires unique source axes, forbids a child from both donating and receiving, enforces +pairwise orthogonality at receivers and caps ranks at 51. OR-Tools 9.11.4210 (Python 3.10, seed 0, +eight workers) found a `FEASIBLE`, not `OPTIMAL`, rank profile in 119.327 seconds. + +The hypothetical profile shifts 40 children from rank 45 to 44 and 40 from rank 50 to 51 while +preserving rank mass. The old PR #3200 verifier accepts its commuting/hosting rules and brackets +the corresponding numerical root. The source-bound exact operator replay does not. + +## Exact rejection witness + +For owner replica 0, port 0, the pinned initial pattern is +`[[4,31],[6,31],[8,0],[10,0],[12,0],[13,0],[14,31],[15,31]]`. The six rank-only transfers +change ranks of children 8, 10, 12, 14 and 15. This extends beyond the four-unhosted-child +assignment screen in [PR #3199](https://github.com/CrocSwap/integer-mult-bounds/pull/3199): +two of the proposed donors (14 and 15) are partially hosted. + +The exact replay first fails at coordinate character `2^53`. Three Gaussian-integer matrix entries +change: + +| Entry | Baseline | Rank-only overlay | +|---|---|---| +| `(1,1)` | `[0,1]` | `[1,0]` | +| `(3,1)` | `[0,0]` | `[1,-1]` | +| `(6,6)` | `[0,1]` | `[-1,0]` | + +The unmodified operator passes the source package's 147-mode positive control. `verify.py` rebuilds +the owner-zero context from authenticated PR3148 fill/journal inputs, confirms it matches the +pinned PR #3200 BINS, applies all six moves, and reproduces the exact mismatch. This is a concrete +false positive of the rank-only objective; it is not a theorem that every possible exchange fails. + +## Exact replay of the newer PR #3251 headline + +The 2026-10-17 19:46 UTC overlap refresh found PR #3251 as the largest open T740 κ headline in its +complete 309-PR snapshot. Its frozen `BINS`, `MOVES` and `RESULT` artifacts are pinned to head +`d7d6254416f0b3ffe659079cca42fd152df63a36`. The inherited PR #3200 verifier accepts its profile, +rank mass, root interval and conditional κ. The exact operator replay rejects the frozen moves in +owner replica 0 / port 0. + +That group makes six transfers: child 14 to 8 and child 15 to 10 on axis `2^72`; child 12 to 8 on +axes `2^52` and `2^53`; and child 12 to 10 on axes `2^54` and `2^55`. Children 8 and 10 go from +rank 48 to 51, child 12 from 48 to 44, and children 14 and 15 from 1 to 0. The baseline and +candidate operators agree at characters `2^0` through `2^51`, then differ at `2^52` in the same +three matrix entries shown above. The witness is frozen in `PR3251-OPERATOR-WITNESS.json` and +replayed by `verify.py`. + +This is a candidate-specific operator counterexample, not a full audit of PR #3251's supplier or +all inherited obligations. It shows the pinned allocation is not operator-preserving under the +source-bound eight-stream replay; it does not show that every possible extension or repair fails. + +## Fixed-word ceiling and limits + +For PR #3200's local profile `{1:2433, 2:724, 3:228, 4:102, 5:20, 8:8}`, +`complex-local-word-ceiling/ceiling.py:ceiling(local, 73, 896, 9, 64)` gives +`a∈[0.001756446675046, 0.001756446675047]`, hence the scoped relaxation +`κ<0.0017533669794458152` under `κ=51: continue + for v in s['axes']: + if legal(v,p,c,d,t['axes']): cands.append((c,d,v)) + candset=set(cands); baseline=base_by_key[(p,kids)] + if not set(baseline).issubset(candset): + raise ValueError(f'baseline move absent from initial candidate universe: {p,kids}') + # Certify baseline feasibility in the same one-shot role/orthogonality domain. + out_axes=set(); recv_axes=defaultdict(list); sources=set(); receivers=set() + for c,d,v in baseline: + if (c,v) in out_axes or c in receivers or d in sources: raise ValueError('baseline role/source conflict') + out_axes.add((c,v)); sources.add(c); receivers.add(d); recv_axes[d].append(v) + if any(dot(a,b) for vv in recv_axes.values() for i,a in enumerate(vv) for b in vv[i+1:]): raise ValueError('baseline incoming axes conflict') + candidate_count+=len(cands) + initial_rank={c:s['rank'] for c,s in state.items()} + bo=Counter(c for c,d,v in baseline); bi=Counter(d for c,d,v in baseline) + base_score+=freq*sum(costs[initial_rank[c]-bo[c]+bi[c]] for c in state) + objective_upper+=freq*len(state)*max(costs) + xs=[]; by_axis=defaultdict(list); by_recv=defaultdict(list); outgoing=defaultdict(list); incoming=defaultdict(list) + for mi,(c,d,v) in enumerate(cands): + x=model.NewBoolVar(f'x{si}_{mi}'); xs.append(x); by_axis[c,v].append(x); by_recv[d].append((x,v)); outgoing[c].append(x); incoming[d].append(x) + for vv in by_axis.values(): + if len(vv)>1: model.Add(sum(vv)<=1) + for d,items in by_recv.items(): + for i in range(len(items)): + xi,vi=items[i] + for j in range(i+1,len(items)): + xj,vj=items[j] + if dot(vi,vj): model.Add(xi+xj<=1); conflicts+=1 + for c,_ in kids: + outs=outgoing[c]; ins=incoming[c] + if outs: + oa=model.NewBoolVar(f'out{si}_{c}'); model.Add(sum(outs)>=oa); model.Add(sum(outs)<=len(outs)*oa) + model.AddHint(oa,int(bool(bo[c]))) + else: oa=None + if ins: + ia=model.NewBoolVar(f'in{si}_{c}'); model.Add(sum(ins)>=ia); model.Add(sum(ins)<=len(ins)*ia) + model.AddHint(ia,int(bool(bi[c]))) + else: ia=None + if oa is not None and ia is not None: model.Add(oa+ia<=1) + fin=model.NewIntVar(0,51,f'rank{si}_{c}') + model.Add(fin==initial_rank[c]-(sum(outs) if outs else 0)+(sum(ins) if ins else 0)) + cv=model.NewIntVar(0,max(costs),f'cost{si}_{c}'); model.AddElement(fin,costs,cv) + final_hint=initial_rank[c]-bo[c]+bi[c] + model.AddHint(fin,final_hint); model.AddHint(cv,costs[final_hint]) + objective.append(freq*cv) + chosen=set(baseline) + for x,edge in zip(xs,cands): model.AddHint(x,int(edge in chosen)) + vars_by_key[(p,kids)]=(cands,xs) + states.append((p,kids,reps,initial_rank,baseline)) + if objective_upper >= 2**63: raise ValueError(f'int64 objective upper bound {objective_upper}') + model.Minimize(sum(objective)) + validation=model.Validate() + if validation: raise ValueError('invalid CP-SAT model: '+validation) + build_seconds=time.time()-t0 + print(json.dumps({'phase':'built','patterns':len(states),'groups':len(bins['groups']),'variables':candidate_count,'incompatibilities':conflicts,'objective_upper_bound':objective_upper,'scale':SCALE,'build_seconds':round(build_seconds,2)},sort_keys=True),flush=True) + solver=cp_model.CpSolver(); solver.parameters.max_time_in_seconds=args.seconds; solver.parameters.num_search_workers=args.workers; solver.parameters.random_seed=args.seed + solver.parameters.log_search_progress=True; solver.parameters.log_to_stdout=False + ts=time.time(); status=solver.Solve(model); solve_seconds=time.time()-ts + status_name=solver.StatusName(status) + if status not in (cp_model.OPTIMAL,cp_model.FEASIBLE): raise RuntimeError(status_name) + selected_by_key={k:[edge for edge,x in zip(cands,xs) if solver.Value(x)] for k,(cands,xs) in vars_by_key.items()} + candidate_stream=[] + for p,kids,reps,rank,baseline in states: + for rep in reps: + candidate_stream.extend([[rep,p,*edge] for edge in sorted(selected_by_key[(p,kids)])]) + new_final=verify.audit(rec,bins,candidate_stream) + new_prof=Counter({r:n*9*verify.T for r,n in verify.LOCAL.items()}); new_prof.update(new_final) + if sum(r*n for r,n in new_prof.items())!=65088*verify.T or max(new_prof)>51: raise ValueError('candidate mass/cap') + root_scale=10**25; lo_i=0; hi_i=10**23 + while hi_i-lo_i>1: + mid=(lo_i+hi_i)//2; mlo,mhi=verify.mom(new_prof,F(mid,root_scale)) + if mhi<1: lo_i=mid + elif mlo>1: hi_i=mid + else: raise ValueError('root interval did not separate') + lo,hi=F(lo_i,root_scale),F(hi_i,root_scale); kappa=min(F(lo.numerator*10**24//lo.denominator,10**24),verify.BIT)-F(1,10**46)-F(1,10**70) + base_kappa=F(result['kappa']) + changed=sum(selected_by_key[(p,kids)]!=base for p,kids,reps,rank,base in states) + objective_value=0 + for (p,kids),reps in groups_by_key.items(): + selected=selected_by_key[(p,kids)]; outs=Counter(c for c,d,v in selected); ins=Counter(d for c,d,v in selected) + initial={c:caps[p,c]-u for c,u in kids} + objective_value+=len(reps)*sum(costs[initial[c]-outs[c]+ins[c]] for c in initial) + out={'status':status_name,'solver_version':__import__('ortools').__version__,'source_head':'f09e5b25381393c604082e58fbe56896b13171b5','objective':'CP-SAT global weighted floor table; g(r)=r*((73/r)^p_star-1), p_star=PR3200 complex-root lower endpoint; Decimal precision=90','objective_scale':SCALE,'patterns':len(states),'groups':len(bins['groups']),'candidate_variables':candidate_count,'orthogonality_conflicts':conflicts,'weighted_objective_upper_bound':objective_upper,'baseline_scaled_objective':str(base_score),'optimized_scaled_objective':str(objective_value),'solver_seconds':round(solve_seconds,3),'wall_seconds':round(time.time()-t0,3),'threads':args.workers,'seed':args.seed,'time_limit_seconds':args.seconds,'profile':{str(k):v for k,v in sorted(new_prof.items())},'baseline_kappa':str(base_kappa),'optimized_complex_root':[str(lo),str(hi)],'optimized_kappa':str(kappa),'kappa_gain':str(kappa-base_kappa),'improves_claim':kappa>base_kappa,'admissible_kappa_claim':None,'physical_operator_status':'NOT_CHECKED_BY_RANK_ONLY_SEARCH','rank_only_score_is_not_a_supplier_claim':True,'pattern_changes':changed,'moves':len(candidate_stream),'best_bound':str(solver.BestObjectiveBound())} + args.output_dir.mkdir(parents=True,exist_ok=True) + payload=json.dumps({'columns':['replica','port','donor_child','receiver_child','axis'],'moves':candidate_stream},sort_keys=True,separators=(',',':')).encode() + compressed=bytearray(gzip.compress(payload,mtime=0)); compressed[9]=255 + (args.output_dir/'RANK-ONLY-MOVES.json.gz').write_bytes(compressed) + (args.output_dir/'RANK-ONLY-RESULT.json').write_text(json.dumps(out,indent=2,sort_keys=True)+'\n') + print(json.dumps(out,indent=2,sort_keys=True),flush=True) +if __name__=='__main__': main() diff --git a/research/t740-joint-axis-optimization/vendor/pr3251/BINS.json.gz b/research/t740-joint-axis-optimization/vendor/pr3251/BINS.json.gz new file mode 100644 index 0000000000..fc2446437c Binary files /dev/null and b/research/t740-joint-axis-optimization/vendor/pr3251/BINS.json.gz differ diff --git a/research/t740-joint-axis-optimization/vendor/pr3251/MOVES.json.gz b/research/t740-joint-axis-optimization/vendor/pr3251/MOVES.json.gz new file mode 100644 index 0000000000..d2b8831feb Binary files /dev/null and b/research/t740-joint-axis-optimization/vendor/pr3251/MOVES.json.gz differ diff --git a/research/t740-joint-axis-optimization/vendor/pr3251/RESULT.json b/research/t740-joint-axis-optimization/vendor/pr3251/RESULT.json new file mode 100644 index 0000000000..e20225791d --- /dev/null +++ b/research/t740-joint-axis-optimization/vendor/pr3251/RESULT.json @@ -0,0 +1,65 @@ +{ + "status": "PASS_IDLE_DONOR_EXACT_R438_T740", + "T": 740, + "axis_moves": 435604, + "donor_children": 150529, + "receiver_children": 167112, + "idle_before": { + "1": 173160, + "3": 48951, + "5": 13875, + "48": 282569 + }, + "idle_after": { + "1": 149514, + "2": 15880, + "3": 14951, + "5": 13855, + "42": 32303, + "43": 1160, + "44": 8240, + "45": 32140, + "46": 6300, + "47": 20, + "48": 35294, + "49": 27626, + "50": 10480, + "51": 129006 + }, + "profile": { + "1": 16353294, + "2": 4837720, + "3": 1533431, + "4": 679320, + "5": 147055, + "8": 53280, + "42": 32303, + "43": 1160, + "44": 8240, + "45": 32140, + "46": 6300, + "47": 20, + "48": 35294, + "49": 27626, + "50": 10480, + "51": 129006 + }, + "complex_root": [ + "8674078851925492817421/5000000000000000000000000", + "17348157703850985634843/10000000000000000000000000" + ], + "complex_root_decimal": "17348157703850985634842e-25", + "bit": "69393850564807966059/40000000000000000000000", + "binding": "complex", + "kappa": "17348157703850985634839999999999999999999998999999999999999999999999/10000000000000000000000000000000000000000000000000000000000000000000000", + "kappa_decimal": "0.0017348157703850985634839999999999999999999998999999999999999999999999", + "gain_over_pr3200": "174973179420229/20000000000000000000000", + "gain_over_pr3198": "45213273585402989/1000000000000000000000000", + "gain_over_pr3184": "4626709151247803389/1000000000000000000000000", + "gain_over_pr3148": "2519137853250775799/500000000000000000000000", + "max_child_rank": 51, + "halving": [ + 5329, + 5202 + ] +} diff --git a/research/t740-joint-axis-optimization/verify.py b/research/t740-joint-axis-optimization/verify.py new file mode 100644 index 0000000000..7cbad49ec1 --- /dev/null +++ b/research/t740-joint-axis-optimization/verify.py @@ -0,0 +1,263 @@ +#!/usr/bin/env python3 +"""Show that the best rank-only T740 CP-SAT candidate fails exact operator replay.""" +import copy +import gzip +import hashlib +import importlib.util +import json +from collections import Counter +from fractions import Fraction as F +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +ARCHIVE = ROOT / 'research/source-archives/t740-joint-axis-pr3200' +PHASES = ROOT / 'research/adaptive-kernel-demotion/inputs/DATA-PHASES.json' +BITCERT = ROOT / 'research/r438-native-rehost/CERTIFICATE.json' +OPERATOR_PACKAGE = ROOT / 'research/idle-star-paired-axis-census' + + +def load(path): + raw = Path(path).read_bytes() + if raw[:2] == b'\x1f\x8b': + raw = gzip.decompress(raw) + return json.loads(raw) + + +def require(ok, reason): + if not ok: + raise ValueError(reason) + + +def load_module(name, path): + spec = importlib.util.spec_from_file_location(name, path) + module = importlib.util.module_from_spec(spec) + require(spec is not None and spec.loader is not None, 'module spec: ' + name) + spec.loader.exec_module(module) + return module + + +def candidate_profile(verifier, recipes, bins, moves, expected): + final = verifier.audit(recipes, bins, moves) + profile = Counter({r: n * 9 * verifier.T for r, n in verifier.LOCAL.items()}) + profile.update(final) + profile = dict(sorted(profile.items())) + require({str(k): v for k, v in profile.items()} == expected['profile'], + 'rank-only candidate profile differs from its receipt') + require(sum(r * n for r, n in profile.items()) == 65088 * verifier.T, + 'rank-only candidate rank mass') + require(max(profile) <= 51 and 73 * 73 > 2 * max(profile) ** 2, + 'rank-only candidate cap/halving') + lo, hi = map(F, expected['optimized_complex_root']) + require(hi - lo == F(1, 10 ** 25), 'rank-only root grid') + require(verifier.mom(profile, lo)[1] < 1 and verifier.mom(profile, hi)[0] > 1, + 'rank-only candidate exact complex root') + bit = verifier.BIT + kappa = min(F(lo.numerator * 10 ** 24 // lo.denominator, 10 ** 24), bit) + kappa -= F(1, 10 ** 46) + F(1, 10 ** 70) + require(lo < bit, 'complex endpoint must bind below R438') + require(kappa == F(expected['optimized_kappa']), 'rank-only hypothetical kappa') + return profile, kappa, lo + + +def operator_context(operator): + operator.authenticate() + vendor = OPERATOR_PACKAGE / 'vendor' + base = operator.decode(operator.read_bytes(vendor / 'BASE-FILL.json.gz'))['rows'] + journal = operator.decode(operator.read_bytes(vendor / 'EXCHANGE.json')) + rows_by_port = operator.project_all_ports(base, operator.journal_edits(base, journal)) + order_base = operator.decode(operator.read_bytes( + ROOT / 'research/rank7-joint-endframes/allocation/ORDER.json')) + order = [[stage, replica + 74 * copy] for stage, replica in order_base for copy in range(10)] + dispatch_rows = operator.decode(operator.read_bytes( + ROOT / 'research/rank7-joint-endframes/allocation/DISPATCH.json')) + dispatch = {(stage, replica): tag for stage, replica, tag in dispatch_rows} + providers = operator.decode(operator.read_bytes(vendor / 'PROVIDERS.json')) + plan = operator.decode(operator.read_bytes( + ROOT / 'research/rank7-joint-endframes/allocation/vendor/PLAN.json.gz')) + template = operator.decode(operator.read_bytes( + ROOT / 'research/rank7-joint-endframes/allocation/vendor/TEMPLATE.json.gz')) + recipes = operator.decode(operator.read_bytes(PHASES))['recipes'] + context = operator.prepare_port(0, rows_by_port[0], order, dispatch, providers, + plan, template, recipes) + blocks = operator.stage_blocks(template) + return context, blocks, recipes + + +def main(): + if not __debug__: + raise SystemExit('assertions required') + require(hashlib.sha256(PHASES.read_bytes()).hexdigest() == + 'c5916ff312678f12aba403847643fbbc29f643acec60bdf836fa56cd3e8251fa', + 'DATA-PHASES pin') + verifier = load_module('pr3200_axis_verifier', ARCHIVE / 'verify.py') + verifier.PKG = ARCHIVE + verifier.PHASES = PHASES + verifier.BITCERT = BITCERT + verifier.BIT = verifier.check_bit() + recipes = {r['port']: r for r in json.loads(PHASES.read_bytes())['recipes']} + bins = load(ARCHIVE / 'BINS.json.gz') + baseline_moves = load(ARCHIVE / 'MOVES.json.gz')['moves'] + baseline_result = load(ARCHIVE / 'RESULT.json') + _, baseline_kappa, _ = verifier.run(recipes, bins, baseline_moves, baseline_result) + + payload = load(HERE / 'RANK-ONLY-MOVES.json.gz') + require(payload['columns'] == ['replica', 'port', 'donor_child', 'receiver_child', 'axis'], + 'rank-only move columns') + moves = payload['moves'] + expected = load(HERE / 'RANK-ONLY-RESULT.json') + require(expected['source_head'] == 'f09e5b25381393c604082e58fbe56896b13171b5', + 'PR #3200 source head') + require(expected['status'] == 'FEASIBLE' and expected['solver_version'] == '9.11.4210', + 'solver must be labelled feasible, not optimal') + require(expected['admissible_kappa_claim'] is None and + expected['rank_only_score_is_not_a_supplier_claim'] is True, + 'rank-only result must be labelled inadmissible') + require(len(moves) == expected['moves'], 'rank-only move count') + profile, hypothetical_kappa, _ = candidate_profile(verifier, recipes, bins, moves, expected) + require(hypothetical_kappa > baseline_kappa, 'the rank-only search should show its relaxed gain') + ceiling = load_module('fixed_word_ceiling', ROOT / 'research/complex-local-word-ceiling/ceiling.py') + cap_lo, cap_hi = ceiling.ceiling(verifier.LOCAL, 73, 896, 9, 64) + require((cap_lo, cap_hi) == (F(878223337523, 500000000000000), + F(1756446675047, 1000000000000000)), + 'fixed-word packing-ceiling receipt') + kappa_cap = cap_hi / (1 + cap_hi) + hypothetical_fraction = hypothetical_kappa / kappa_cap + require(hypothetical_fraction < 1, 'hypothetical candidate cannot exceed the relaxation ceiling') + require(F(expected['kappa_gain']) == hypothetical_kappa - baseline_kappa, + 'rank-only hypothetical gain') + + # Authenticate and use the merged source-bound exact eight-stream replay. + operator = load_module('source_bound_idle_axis_operator', OPERATOR_PACKAGE / 'verify.py') + context, blocks, port_recipes = operator_context(operator) + baseline = {c: list(axes) for c, axes in context['residual'].items()} + baseline_modes = operator.check_baseline(context, baseline, blocks) + require(baseline_modes == 147, 'exact-operator positive-control modes') + owner_group = next(g for g in bins['groups'] if g[0] == 0 and g[1] == 0) + require(owner_group[2] == [[4, 31], [6, 31], [8, 0], [10, 0], [12, 0], [13, 0], [14, 31], [15, 31]], + 'pinned owner-zero port-zero source pattern') + caps = {c: int(child['rank']) for c, child in enumerate(port_recipes[0]['idle_children'])} + usage = {c: u for c, u in owner_group[2]} + require(all(len(baseline[c]) == caps[c] - usage.get(c, caps[c]) for c in range(len(caps))), + 'exact operator context matches PR #3200 BINS') + group_moves = [m for m in moves if m[0] == 0 and m[1] == 0] + require(len(group_moves) == 6, 'owner-zero port-zero candidate move count') + trial = {c: list(axes) for c, axes in baseline.items()} + for rep, port, source, target, axis in group_moves: + require(axis in trial[source], 'candidate source axis available in exact context') + trial[source].remove(axis) + trial[target].append(axis) + changed = {c: [len(baseline[c]), len(trial[c])] for c in range(len(caps)) + if len(baseline[c]) != len(trial[c])} + expected_changed = {'8': [48, 51], '10': [48, 51], '12': [48, 44], '14': [1, 0], '15': [1, 0]} + require({str(c): value for c, value in changed.items()} == expected_changed, + 'exact operator overlay rank vector') + for bit in range(53): + character_before = 1 << bit + require(operator.replay(context, baseline, character_before, blocks) == + operator.replay(context, trial, character_before, blocks), + f'candidate operator mismatch precedes the frozen witness at bit {bit}') + character = 1 << 53 + before = operator.replay(context, baseline, character, blocks) + after = operator.replay(context, trial, character, blocks) + require(before != after, 'candidate must fail exact physical-operator equality') + differences = operator.matrix_differences(before, after) + expected_differences = [[1, 1, [0, 1], [1, 0]], + [3, 1, [0, 0], [1, -1]], + [6, 6, [0, 1], [-1, 0]]] + require(differences == expected_differences, 'exact operator mismatch witness') + witness = load(HERE / 'OPERATOR-WITNESS.json') + require(witness['first_coordinate_character_mismatch']['character'] == character and + witness['first_coordinate_character_mismatch']['matrix_differences'] == differences, + 'frozen exact operator witness') + + # The refreshed overlap scan found a newer, numerically higher per-group claim in PR #3251. + # Its verifier is the PR #3200 rank/profile audit, so bind its frozen output separately and + # test the same owner-zero port-zero group with the exact eight-stream operator. + source_rows = {row['path']: row for row in load(HERE / 'SOURCES.json')['files']} + pr3251_head = 'd7d6254416f0b3ffe659079cca42fd152df63a36' + pr3251_paths = { + 'BINS.json.gz': 'research/rank7-idle-donors-exact-r438/BINS.json.gz', + 'MOVES.json.gz': 'research/rank7-idle-donors-exact-r438/MOVES.json.gz', + 'RESULT.json': 'research/rank7-idle-donors-exact-r438/RESULT.json', + } + pr3251_files = {} + for name, source_path in pr3251_paths.items(): + row = source_rows.get(source_path) + require(row is not None and row['usage'] == 'provenance' and + row['pin'] == f'head:{pr3251_head}:{source_path}', + 'PR #3251 exact source pin: ' + name) + local_path = HERE / 'vendor' / 'pr3251' / name + raw = local_path.read_bytes() + require(hashlib.sha256(raw).hexdigest() == row['sha256'], + 'vendored PR #3251 artifact differs from its pinned source: ' + name) + pr3251_files[name] = load(local_path) + pr3251_bins = pr3251_files['BINS.json.gz'] + pr3251_moves = pr3251_files['MOVES.json.gz']['moves'] + pr3251_result = pr3251_files['RESULT.json'] + require(pr3251_result['status'] == 'PASS_IDLE_DONOR_EXACT_R438_T740' and + pr3251_result['axis_moves'] == len(pr3251_moves) == 435604, + 'PR #3251 frozen candidate receipt') + _, pr3251_kappa, _ = verifier.run(recipes, pr3251_bins, pr3251_moves, pr3251_result) + require(pr3251_kappa > hypothetical_kappa and + pr3251_kappa == F(pr3251_result['kappa']), + 'PR #3251 rank/profile headline is numerically above the rank-only candidate') + pr3251_group = next(g for g in pr3251_bins['groups'] if g[0] == 0 and g[1] == 0) + require(pr3251_group[2] == owner_group[2], 'PR #3251 owner-zero port-zero source pattern') + pr3251_group_moves = [m for m in pr3251_moves if m[0] == 0 and m[1] == 0] + require(len(pr3251_group_moves) == 6, 'PR #3251 owner-zero port-zero move count') + pr3251_trial = {c: list(axes) for c, axes in baseline.items()} + for rep, port, source, target, axis in pr3251_group_moves: + require(axis in pr3251_trial[source], 'PR #3251 transfer axis exists in exact source context') + pr3251_trial[source].remove(axis) + pr3251_trial[target].append(axis) + pr3251_changed = {c: [len(baseline[c]), len(pr3251_trial[c])] + for c in range(len(caps)) if len(baseline[c]) != len(pr3251_trial[c])} + require({str(c): value for c, value in pr3251_changed.items()} == expected_changed, + 'PR #3251 exact operator overlay rank vector') + for bit in range(52): + character_before = 1 << bit + require(operator.replay(context, baseline, character_before, blocks) == + operator.replay(context, pr3251_trial, character_before, blocks), + f'PR #3251 operator mismatch precedes frozen witness at bit {bit}') + pr3251_character = 1 << 52 + pr3251_before = operator.replay(context, baseline, pr3251_character, blocks) + pr3251_after = operator.replay(context, pr3251_trial, pr3251_character, blocks) + require(pr3251_before != pr3251_after, 'PR #3251 candidate must fail exact operator equality') + pr3251_differences = operator.matrix_differences(pr3251_before, pr3251_after) + require(pr3251_differences == expected_differences, + 'PR #3251 exact operator mismatch witness') + pr3251_witness = load(HERE / 'PR3251-OPERATOR-WITNESS.json') + require(pr3251_witness['source_head'] == pr3251_head and + pr3251_witness['headline_kappa'] == pr3251_result['kappa_decimal'] and + pr3251_witness['first_coordinate_character_mismatch']['character'] == pr3251_character and + pr3251_witness['first_coordinate_character_mismatch']['matrix_differences'] == pr3251_differences, + 'frozen PR #3251 exact operator witness') + + # Controls: deleting one rank-only move changes the frozen profile, and a foreign axis + # is rejected by the predecessor's independent physical-move audit. + controls = {} + for name, altered in (('drop_move', moves[1:]),): + try: + candidate_profile(verifier, recipes, bins, altered, expected) + except (ValueError, verifier.Reject) as exc: + controls[name] = str(exc) + else: + raise ValueError('mutation accepted: ' + name) + foreign = copy.deepcopy(moves) + foreign[0][4] = 1 << 80 + try: + candidate_profile(verifier, recipes, bins, foreign, expected) + except (ValueError, verifier.Reject) as exc: + controls['foreign_axis'] = str(exc) + else: + raise ValueError('mutation accepted: foreign_axis') + require(len(controls) == 2, 'mutation controls') + print('PASS_T740_RANK_ONLY_CANDIDATE_REJECTED moves=%d controls=%d hypothetical_kappa=%s cap_fraction=%s checked_before=53 exact_operator_character=2^53 matrix_entries=%d' % + (len(moves), len(controls), hypothetical_kappa, hypothetical_fraction, len(differences))) + print('PASS_PR3251_NUMERIC_REPLAY_REJECTED_OPERATOR moves=%d kappa=%s source_head=%s checked_before=52 exact_operator_character=2^52 matrix_entries=%d' % + (len(pr3251_moves), pr3251_kappa, pr3251_head, len(pr3251_differences))) + + +if __name__ == '__main__': + main()