"""Enumerate the mutable matrices at G2 node 2 while keeping tau fixed.""" from collections import deque from pathlib import Path import sys sys.dont_write_bytecode = True sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "verification")) from kr_matrices import translated_seed def mutate(matrix, k): row = matrix[k] return tuple( tuple( -value if i == k or j == k else value + max(col[k], 0) * max(row[j], 0) - max(-col[k], 0) * max(-row[j], 0) for j, value in enumerate(col) ) for i, col in enumerate(matrix) ) def main(): seed = translated_seed("G", 2, 2) matrix = tuple(map(tuple, seed["principal"])) tau = seed["tau"] indices = [i for i in range(len(matrix)) if i != tau] pending = deque([matrix]) seen = {matrix} while pending: current = pending.popleft() column = [current[i][tau] for i in indices] if not min(column) < 0 < max(column): raise ValueError("Reached a one-sided column.") for i in indices: neighbor = mutate(current, i) if neighbor not in seen: seen.add(neighbor) pending.append(neighbor) if len(seen) != 12: raise ValueError(f"Expected 12 matrices, found {len(seen)}.") print("All 12 labeled matrices have a mixed tau-column; checked all 36 mutations.") if __name__ == "__main__": main()