"""Two local obstructions to a class cover of the twisted STS(27). Run with Python 3.8 or later. Only the standard library is required. The specification and block numbering are those of section 3 of the manuscript. The calculation reconstructs every block and parallel class from coordinates. """ from collections import Counter from functools import lru_cache from itertools import combinations, combinations_with_replacement, product def make_blocks(): """Fibres first, then ordered base lines, then the two fibre coordinates.""" blocks = [tuple(range(3 * i, 3 * i + 3)) for i in range(9)] for i, j, k in combinations(range(9), 3): if (i // 3 + j // 3 + k // 3) % 3 or (i + j + k) % 3: continue for a, b in product(range(3), repeat=2): blocks.append((3 * i + a, 3 * j + b, 3 * k + (a + b) % 3)) return blocks def parallel_classes(blocks): """At each step, the first unused point lies in one uniquely chosen block.""" masks = [sum(1 << p for p in block) for block in blocks] through = [[i for i, block in enumerate(blocks) if p in block] for p in range(27)] def visit(free, chosen): if not free: yield frozenset(chosen) return point = (free & -free).bit_length() - 1 for i in through[point]: if free & masks[i] == masks[i]: yield from visit(free ^ masks[i], chosen + [i]) return list(visit((1 << 27) - 1, [])) def resolutions_at_root(blocks, classes, root, common): """Count local resolutions by the unique member containing both roots.""" disjoint = [i for i, b in enumerate(blocks) if set(b).isdisjoint(blocks[root])] assert len(disjoint) == 80 flags = {b: 1 << i for i, b in enumerate(disjoint)} masks = {c: sum(flags[b] for b in c if b != root) for c in classes if root in c} through = {bit: [mask for mask in masks.values() if mask & bit] for bit in flags.values()} @lru_cache(None) def count(free): if not free: return 1 choices = None for bit, rows in through.items(): if free & bit: candidates = [m for m in rows if m & free == m] if not candidates: return 0 if choices is None or len(candidates) < len(choices): choices = candidates return sum(count(free ^ m) for m in choices) all_free = (1 << len(disjoint)) - 1 return {c: count(all_free ^ masks[c]) for c in common} def fractional_obstruction(blocks, classes): """Weights on 20 disjoint-block pairs incident to block 0 or 100. A fractional cover assigns nonnegative weights to parallel classes and covers each disjoint-block pair with total weight exactly 1. Summing the pair weights once gives -1. Summing them via a fractional cover would give a nonnegative result, because each class has nonnegative weight. """ groups = [ (0, +1, [2, 101, 103, 105]), (0, -1, [110, 112, 114]), (100, +2, [10, 11, 12, 13, 15, 17]), (100, -2, [8, 30, 35, 46, 53, 93, 98]), ] weights = {} for root, weight, neighbours in groups: for b in neighbours: assert set(blocks[root]).isdisjoint(blocks[b]) pair = tuple(sorted((root, b))) assert pair not in weights weights[pair] = weight histogram = Counter(sum(weights.get(pair, 0) for pair in combinations(sorted(c), 2)) for c in classes) assert len(weights) == 20 and sum(weights.values()) == -1 assert histogram == {0: 6932, 1: 37, 2: 21, 4: 19} return dict(sorted(histogram.items())) def check_plane_count(): """Check the 17 possible colour profiles in the geometric proof.""" for k, expected in enumerate(((1, {0}), (4, {0}), (8, {0, 4, 12}), (4, {8, 12, 16, 36}))): profiles = set() for direction in ("000", "0+-"): for selected in combinations(direction, k): profiles.add(tuple(selected.count(colour) for colour in "0+-")) weights = [] for planes in combinations_with_replacement(sorted(profiles), 3): neutral, positive, negative = zip(*planes) if (sum(positive) - sum(negative)) % 3: continue neutral_pairs = sum(a * b for a, b in combinations(neutral, 2)) opposite_pairs = sum(positive[i] * negative[j] for i in range(3) for j in range(3) if i != j) weights.append(2 * (neutral_pairs - sum(neutral) + opposite_pairs)) assert (len(weights), set(weights)) == expected assert 4 * 9 + 2 * 18 - 216 + 2 * 54 == -36 print("Geometric obstruction: 17 admissible profiles; every weight is nonnegative") def main(): blocks = make_blocks() point_pair_count = Counter(pair for b in blocks for pair in combinations(b, 2)) assert len(blocks) == 117 and len(point_pair_count) == 351 and set(point_pair_count.values()) == {1} t, u = 0, 100 assert blocks[t] == (0, 1, 2) and blocks[u] == (9, 13, 16) classes = parallel_classes(blocks) assert len(classes) == len(set(classes)) == 7009 common = [c for c in classes if t in c and u in c] left = resolutions_at_root(blocks, classes, t, common) right = resolutions_at_root(blocks, classes, u, common) left_ok = {c for c in common if left[c]} right_ok = {c for c in common if right[c]} assert (len(common), len(left_ok), len(right_ok)) == (40, 38, 1) assert left_ok.isdisjoint(right_ok) assert (sum(left.values()), sum(right.values())) == (420, 14) forced, = right_ok assert sorted(forced) == [0, 1, 2, 6, 7, 8, 100, 104, 105] print(f"Roots: {blocks[t]} and {blocks[u]}") print("Common parallel classes: 40; extendible at the first/second/both: 38/1/0") print("Numbers of local resolutions: 420 and 14") print("Unique common class extendible at the second root (block IDs):", sorted(forced)) print("Fractional obstruction: total pair weight = -1; class-weight histogram =", fractional_obstruction(blocks, classes)) check_plane_count() if __name__ == "__main__": if not __debug__: raise SystemExit("Run without -O so that every assertion is verified.") main()