"""Independent corroboration: the full first-order consistency system. Every planar map M (3- and 4-valent rotation-invariant vertices, k <= 6 boundary points) reachable from the 'overlap' hosts is given an unknown deviation vector nu(M) in S_t^k; every occurrence of a relation in M gives a linear equation nu(M) = sum c_i nu(M_i) + (context applied to the error term). Eliminating the nu's leaves linear constraints on the 58 error unknowns (a, b, E2, E25, E3). We show the constraint space has codimension 3, i.e. equals the gauge directions c -> c + eps*w, for every t != 0. """ import sys, time, random, pickle from fractions import Fraction as F from ratfunc import RF from system import System from hosts import proof_hosts from symelim import load, eliminate, factor_set from exact_at import exact_proj print("1. symbolic system on the overlap hosts") t = RF.gen() S = System(t, verbose=False); S.run(proof_hosts(t)) rows = [{c: ([str(x) for x in v.n.coeffs()], [str(x) for x in v.d.coeffs()]) for c, v in r.items()} for r in S.rows] pickle.dump(dict(rows=rows, order=S.order), open("symrows.pkl", "wb")) print(f" planar maps: {len(S.reps)}, scalar equations: {len(S.rows)}") order = ("E3", "E25", "E2", "b", "a") rows, N, tot, cols, bad0 = load("symrows.pkl", order) common = None for trial in range(12): random.seed(trial) perm = list(range(N)); random.shuffle(perm) eperm = list(range(N, tot)) if trial % 2: random.shuffle(eperm) mp = {i: perm[i] for i in range(N)}; mp.update({N + i: eperm[i] for i in range(tot - N)}) rr = [{mp[c]: v for c, v in r.items()} for r in rows]; random.shuffle(rr) piv, bad = eliminate(rr) proj = tot - N - sum(1 for c in piv if c >= N) fs = {str(f) for f in factor_set(bad0 + bad + [piv[c][c] for c in piv])} common = fs if common is None else common & fs print(f" elimination order {trial}: projection onto errors has dim {proj} over Q(t); " f"certificate valid away from the roots of {len(fs)} polynomials") print(" => projection = 3 for all t except possibly roots of", sorted(common)) print("2. exact check at the remaining values") for tv in ("1", "2"): res, nm, sk = exact_proj(F(tv)) print(f" t={tv}: projection dims {res}") print(" (gauge rank is 3 for every t != 0: c w + w c, w in {id+e, I+H, c}, are independent)") print("3. control: misplacing the R2.5 error by one rotation must be detected") import flint, system, rewrite from analyze import analyze p=1000003; tp=flint.nmod(123457,p) orig=rewrite.context_matrix def bad_ctx(M, region, legs, kL, t): if kL==5: legs=legs[1:]+legs[:1] return orig(M, region, legs, kL, t) system.context_matrix=bad_ctx S2=System(tp,verbose=False); S2.run(proof_hosts(tp)) res,gr,bad,*_=analyze(S2,p,tp) print(" gauge vectors violating the (corrupted) equations:", bad, "(nonzero = detected)") system.context_matrix=orig