# fourcheck.py -- independent check of the 4-count criterion (Theorem 4.1) at level 30: random vanishing multisets of # 30-th roots are built as A = D^+ + P, B = D^- + P with D_ij = u_i + v_j (all vanishing multisets arise so), and # their regularity (decomposition into rotated prime cycles of lengths 2, 3, 5) is decided by exhaustive search, # then compared with the inequalities A_ij <= B_ij + A_ik + A_lj. import numpy as np, itertools, functools, random cycles=[] for step in (15,10,6): seen=set() for x in range(30): c=frozenset((x+k*step)%30 for k in range(30//step)) if c not in seen: seen.add(c); cycles.append(sorted(c)) assert len(cycles)==15+10+6 idx=lambda s,i,j:(15*s+10*i+6*j)%30 @functools.lru_cache(maxsize=None) def regular(a): if sum(a)==0: return True x=next(k for k in range(30) if a[k]) # the first occupied root must lie in some cycle for c in cycles: if x in c and all(a[y]>0 for y in c): b=list(a) for y in c: b[y]-=1 if regular(tuple(b)): return True return False def criterion(a): A=[[a[idx(0,i,j)] for j in range(5)] for i in range(3)]; B=[[a[idx(1,i,j)] for j in range(5)] for i in range(3)] return all(A[i][j]<=B[i][j]+A[i][k]+A[l][j] for i in range(3) for j in range(5) for k in range(5) for l in range(3)) random.seed(1); w=np.exp(2j*np.pi/30); stats=[0,0,0] for trial in range(20000): u=[random.randint(-2,2) for _ in range(3)]; v=[random.randint(-2,2) for _ in range(5)] a=[0]*30 for i in range(3): for j in range(5): D=u[i]+v[j]; P=random.choice([0,0,0,1]) a[idx(0,i,j)]=max(D,0)+P; a[idx(1,i,j)]=max(-D,0)+P if sum(a)==0 or sum(a)>40: continue assert abs(sum(a[k]*w**k for k in range(30)))<1e-9 r=regular(tuple(a)); c=criterion(a) stats[0]+=1; stats[1]+=(not r) if r!=c: stats[2]+=1; print("MISMATCH",a) print(f"{stats[0]} vanishing multisets tested, {stats[1]} irregular, {stats[2]} mismatches with the 4-count criterion") assert stats[2] == 0 # the sharpness example of Corollary 4.2, m = 1, 2, 3 S=[idx(1,1,0),idx(1,2,0),idx(0,0,1),idx(0,0,2),idx(0,0,3),idx(0,0,4)] for m in (1,2,3): a=[m]*30 for x in S: a[x]+=2*m+1 assert not regular(tuple(a)) and not criterion(a) print(f"m = {m}: counts between {min(a)} and {max(a)}, regular: {regular(tuple(a))}, criterion: {criterion(a)}")