"""Exact checks for the cyclic matched products in the paper.""" from collections import Counter from itertools import combinations, permutations, product from math import factorial def compose(first, second): return tuple(first[i] for i in second) def derivative(f, t): n = len(f) return tuple((f[(v + t) % n] - f[t]) % n for v in range(n)) def generated_group(identity, generators): group, stack = {identity}, [identity] while stack: current = stack.pop() for g in generators: nxt = compose(current, g) if nxt not in group: group.add(nxt) stack.append(nxt) return group def grid_order_six(): # Cyclic order makes the derivative below translation on the CRT grid. letters = [(v % 2, v % 3) for v in range(6)] maps = [lambda r, c: (r, (c + r) % 3)] for column in (1, 2): maps.append(lambda r, c, j=column: (r ^ (c == j), c)) generators = [tuple(letters.index(f(*point)) for point in letters) for f in maps] group = generated_group(tuple(range(6)), generators) assert all(g[0] == 0 for g in group) assert len(group) == factorial(5) signatures = {tuple(derivative(g, t) for g in generators) for t in range(6)} assert len(signatures) == 6 return len(group) def degree_six_obstruction(): """Exhaust the Fourier orbit families at cost six in S5 fixing 0.""" identity = tuple(range(6)) elements = [(0,) + perm for perm in permutations(range(1, 6))] translate = {x: derivative(x, 1) for x in elements} cyclic = {frozenset(generated_group(identity, [x])) for x in elements} order_two = [subgroup for subgroup in cyclic if len(subgroup) == 2] order_three = [subgroup for subgroup in cyclic if len(subgroup) == 3] order_four = {subgroup for subgroup in cyclic if len(subgroup) == 4} involutions = [next(iter(subgroup - {identity})) for subgroup in order_two] for a, b in combinations(involutions, 2): ab = compose(a, b) if ab == compose(b, a): order_four.add(frozenset((identity, a, b, ab))) cases = [ ('2+4', product(order_two, order_four), 875, [8]), ('2+2+2', combinations(order_two, 3), 2300, [4, 6]), ('3+3', combinations(order_three, 2), 45, []), ] for sizes, families, expected_count, expected_orders in cases: count, orders = 0, [] for family in families: count += 1 multiplicity = Counter(x for subgroup in family for x in subgroup) if all(multiplicity[x] == multiplicity[translate[x]] for x in elements): orders.append(len(generated_group(identity, multiplicity))) orders.sort() assert count == expected_count and orders == expected_orders print(f'n=6, {sizes}: {count} families, surviving generated orders {orders}') def prime_power_obstruction(n, p): """Try every permutation moving the order-p subgroup. A potential coideal image preserving L must have commuting normalized derivatives there. For L trivial the image itself is trivial. """ small = set(range(0, n, n // p)) possible_sizes = [] size = p while size <= n: possible_sizes.append(size) size *= p failures_tested = 0 for perm in permutations(range(1, n)): f = (0,) + perm if {f[t] for t in small} == small: continue failures_tested += 1 for size in possible_sizes: subgroup = set(range(0, n, n // size)) if {f[t] for t in subgroup} != subgroup: continue shifts = {derivative(f, t) for t in subgroup} assert any(compose(g, h) != compose(h, g) for g, h in combinations(shifts, 2)) return failures_tested def multiplicative_generator(p): for c in range(2, p): if len({pow(c, j, p) for j in range(p - 1)}) == p - 1: return c raise ValueError('expected an odd prime') def check_odd_coideal(n, p): """Check the supported homogeneous basis under multiplication, star and slices.""" step = n // p c = multiplicative_generator(p) subgroup = [tuple(v % step + step * ((pow(c, j, p) * (v // step)) % p) for v in range(n)) for j in range(p - 1)] f = subgroup[1] inversions = sum(f[i] > f[j] for j in range(n) for i in range(j)) assert inversions % 2 == 1 # A basis element 1_{L-t} # x is represented by the pair (t,x). sectors = [{derivative(x, t) for x in subgroup} for t in range(step)] for t, sector in enumerate(sectors): assert len(sector) == p - 1 and tuple(range(n)) in sector for x in sector: assert all((x[v] - v) % step == 0 for v in range(n)) assert all(compose(x, y) == compose(y, x) and compose(x, y) in sector for y in sector) for shift in range(n): assert derivative(x, shift) in sectors[(t + shift) % step] return sum(map(len, sectors)) if __name__ == '__main__': print('Grid generators at n=6 give stabilizer order', grid_order_six()) degree_six_obstruction() for n, p in [(4, 2), (8, 2), (9, 3)]: print(f'n={n}: excluded all {prime_power_obstruction(n, p)} permutations moving T[p]') for n, p in [(15, 3), (45, 5), (225, 3)]: print(f'n={n}, p={p}: odd image verified, coideal dimension {check_odd_coideal(n, p)}')