#!/usr/bin/env python3 """Job 3307: k = 46 basis-prefix identity B(21) = B(27)[:846] in the pinned engine (tables not built). Transport argument: I(F), J(F) are functionals of F itself. The zero-padded vector in B(27) represents the same F exactly iff the witness's labelled terms (a, lam) are B(27)'s first 846 labels in order, so the d = 27 values equal the d = 21 values (paths A and B, replay3307.py). stdout: one JSON line. """ import hashlib, importlib.util, json, os, sys from fractions import Fraction as Fr HERE = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, HERE) from replay3307 import ensure_src # noqa: E402 ensure_src() p = os.path.join(HERE, "src", "even-engine.py") assert hashlib.sha256(open(p, "rb").read()).hexdigest().startswith("0ad32e25") s = importlib.util.spec_from_file_location("even_engine", p); eng = importlib.util.module_from_spec(s); s.loader.exec_module(eng) class Basis(eng.EvenEngine): def _build_tables(self): pass w = json.load(open(os.path.join(HERE, "src", "indexed-witness.json"))) lab = [(t["a"], tuple(t["partition"])) for t in w["terms"]] b21 = Basis(46, Fr(25, 861), 21).B; b27 = Basis(46, Fr(25, 861), 27).B out = {"n21": len(b21), "n27": len(b27), "witness_labels_eq_B21": lab == [tuple(x) for x in b21], "B21_is_prefix_of_B27": [tuple(x) for x in b27[:len(b21)]] == [tuple(x) for x in b21], "tail_degrees_min": min(x[0] + sum(x[1]) for x in b27[len(b21):]), "zero_tail_pairs_skipped": len(b27) * (len(b27) + 1) // 2 - len(b21) * (len(b21) + 1) // 2} out["ok"] = out["witness_labels_eq_B21"] and out["B21_is_prefix_of_B27"] and out["n21"] == 846 and out["n27"] == 2526 print(json.dumps(out)); sys.exit(0 if out["ok"] else 1)