#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Job #1403 — EXACT structural check on the pilot's coefficient. Post-hoc, derivation-verifying. The pilot ran with U = V = floor(x^(6/25)) and Y = Z = floor(x^(1/20)), and at x = 2^14, 2^16 that second cutoff is 1. With B = 1 the restricted Lambda-sum is beta_1(t) = log t (t > 1), so C_{1,1}(m) = sum_{d|m, d>1} mu(d) log(m/d) = [sum_{d|m} mu(d) log(m/d)] - log m = Lambda(m) - log m (the Möbius inversion identity), which is <= 0 for every m >= 1, with equality iff m = 1 or m is prime. Consequences the pilot's own numbers should obey, and which this file tests EXACTLY: I1 C_{Y,Z}(m) == Lambda(m) - log m for every m in the built range at Y = Z = 1; I2 hence c(n) = C_{U,V}(n) * (Lambda(n-2) - log(n-2)) and sign(c(n)) = -sign(C_{U,V}(n)) on the support (the right factor is strictly negative there), so the sign field is a function of the LEFT coefficient alone; I3 the support restriction of the served audit, c(n) = 0 whenever n-2 is prime, is the right factor's zero set, not an accident. If I1-I3 hold, the pilot measured a field whose sign is carried entirely by the truncated left coefficient C_{U,V} with A = 10 and 14 — a cutoff resonance, which is why the mod-p strata are so structured. Usage: python fibre-factorisation-check.py --x 16384 """ import argparse import importlib.util import json import math import os import sys import numpy as np HERE = os.path.dirname(os.path.abspath(__file__)) def load(path): spec = importlib.util.spec_from_file_location("fibre_producer", path) mod = importlib.util.module_from_spec(spec) spec.loader.exec_module(mod) return mod def main(): ap = argparse.ArgumentParser() ap.add_argument("--x", type=int, required=True) ap.add_argument("--out", default=None) a = ap.parse_args() m = load(os.path.join(HERE, "fibre-sign-lag.py")) b = m.build(a.x) mu = m.mu_array(b["hi"]).astype(float) lam = m.lambda_table(b["hi"]) CL = m.coeff_from(b, "L", mu) CR = m.coeff_from(b, "R", mu) # primality over the FULL range: the producer's own trial-division test with primes up to # sqrt(hi). (The first version of this file used b["primes"], which the producer builds only # up to 130, so every prime n > 130 was judged composite and this gate cried wolf on 5 # consecutive n. A gate is only evidence once its own references are right.) small = m.primes_upto(int(math.isqrt(b["hi"])) + 1) def isp(n): return bool(m.is_prime(int(n), small)) # I1: the right factor with the run's own cutoffs against the closed form bad1 = [] for idx, mm in enumerate(range(b["lo"], b["hi"] + 1)): closed = lam[mm] - (math.log(mm) if mm > 1 else 0.0) if abs(CR[idx] - closed) > 1e-9: bad1.append([mm, b["Y"], b["Z"], float(CR[idx]), closed]) # the closed form Lambda(m) - log m vanishes exactly when m = 1 or m is prime badz = [mm for mm in range(b["lo"], b["hi"] + 1) if (abs(CR[mm - b["lo"]]) <= 1e-12) != (mm == 1 or isp(mm))] dec = { "x": a.x, "cutoffs": {"U": b["U"], "V": b["V"], "Y": b["Y"], "Z": b["Z"]}, "I1_right_factor_equals_lambda_minus_log": {"ok": not bad1, "m_checked": b["hi"] - b["lo"] + 1, "violations": bad1[:5]}, "I1_right_factor_nonpositive": {"ok": bool(np.all(CR <= 1e-12)), "max": float(CR.max())}, "closed_form_zero_set_is_exactly_one_and_the_primes": {"ok": badz == [], "violations": badz[:5]}, } # I2: sign(c) == -sign(CL) on the support, and c == CL*CR ns = b["ns"] c = CL[b["li"]] * CR[b["ri"]] sgn = np.sign(c) cl_pair = CL[b["li"]] on = sgn != 0 agree = np.mean(np.sign(cl_pair[on]) == -sgn[on]) if on.any() else float("nan") dec["I2_sign_field_is_minus_sign_of_left_coefficient"] = { "ok": bool(np.all(np.sign(cl_pair[on]) == -sgn[on])), "agreement_fraction": float(agree), "support": int(on.sum())} dec["I2_right_factor_strictly_negative_on_support"] = { "ok": bool(np.all(CR[b["ri"]][on] < 0)), "max_on_support": float(CR[b["ri"]][on].max()) if on.any() else None} # I3: the served audit's assertion is one-directional -- a prime member forces the grouped # coefficient to zero. Tested forward (that is what reviewer evidence needs) and the # CONVERSE is reported as false, because the left factor has composite zeros too. (The # first version of this file asserted the two-directional form, which is simply wrong, and # flagged 5 consecutive even n.) wrong = [int(n) for n, v in zip(ns, c) if (isp(int(n)) or isp(int(n) - 2)) and v != 0] extra = [int(n) for n, v in zip(ns, c) if v == 0 and not isp(int(n)) and not isp(int(n) - 2)] dec["I3_prime_member_forces_zero_forward"] = {"ok": not wrong, "violations": wrong[:5]} dec["I3_converse_is_FALSE_zeros_with_no_prime_member"] = { "count": len(extra), "first": extra[:8], "why": "those are the zeros of the LEFT factor C_{U,V} alone (I2: c = C_{U,V} * (Lambda-log)," " and Lambda(m)-log m is nonzero for composite m), so the zero set is strictly " "larger than the prime members"} # what the sign field actually is: a function of which small divisors d <= A of n are present resid = {} for mod in (3, 5, 7): cnt = {} for n, s in zip(ns, sgn): if s == 0: continue k = (int(n) % mod, int(n - 2) % mod) pos, tot = cnt.get(k, (0, 0)) cnt[k] = (pos + (1 if s > 0 else 0), tot + 1) resid[str(mod)] = {"%d_%d" % k: {"P_plus": v[0] / v[1], "N": v[1]} for k, v in sorted(cnt.items()) if v[1] >= 20} dec["sign_given_pair_of_residues"] = resid txt = json.dumps(dec, indent=1, sort_keys=True) if a.out: open(a.out, "w", encoding="utf-8", newline="\n").write(txt + "\n") print(txt) return 0 if __name__ == "__main__": sys.exit(main())