#!/usr/bin/env python3 """Check the 8-to-4+4 block in Table F.3 of arXiv:2611.11018v1.""" from math import comb # Each stage is a permutation given as disjoint cycles. STAGES = ( ((1, 2, 4),), ((2, 7, 6),), ((1, 6), (2, 7)), ((0, 6, 7),), ((1, 2, 4),), ((1, 2, 5),), ((3, 6, 7),), ) def preimage(pattern, cycles): inverse = dict(zip(range(8), range(8))) for cycle in cycles: for source, destination in zip(cycle, cycle[1:] + cycle[:1]): inverse[destination] = source return frozenset(inverse[position] for position in pattern) def coverage(stages): # Start with the solved color pattern and undo or skip each stage. patterns = {frozenset(range(4))} for stage in reversed(stages): patterns |= {preimage(pattern, stage) for pattern in patterns} return len(patterns) if __name__ == '__main__': total = comb(8, 4) verified = coverage(STAGES) deleted = [coverage(STAGES[:index] + STAGES[index + 1:]) for index in range(len(STAGES))] assert verified == total > 2 ** 6 print(f'Published network: {verified}/{total}') print(f'Removing one stage: {deleted}')