"""Incidence maps between the twisted cell algebras. For each of the 7 framed placements, the endpoint sum P : C(V_0) -> C(V_1), from vertices to edges, is checked to be completely positive, with adjoint the reverse sum, and to satisfy P^*P = q + d and PP^* = 2 + d_E, with d_E the twisted adjacency of the line graph. For the tetrahedron, the program checks the formula P(s+x.sigma) = (2s +- 2x_i), and that exactly 24 of the signed permutation matrices preserve the incidence, namely those of determinant 1. It also checks that the twisted cellular chain complex has homology C,0,C. """ import itertools import numpy as np from solids import (PLACEMENTS, placement, cell_centers, TwistedSpace, edge_sum, adjacency_lists, SIGMA, ONE, GAMMA) def incidence_operator(Vx, Vy, rel): """(Pf)(y) = sum over x incident to y of f(x), between twisted spaces.""" def op(F): G = np.zeros((Vy.n, 2, 2), complex) for y, xs in enumerate(rel): for x in xs: G[y] += F[x] return G return op def matrix_between(Vx, Vy, op): return np.array([Vy.coords(op(e)) for e in Vx.basis]).T def adjoint_between(Vx, Vy, P): nx = np.array(Vx.size, float) ny = np.array(Vy.size, float) return P.conj().T * ny[None, :] / nx[:, None] def check(label): pts, edges, faces = placement(label) c0, c1, c2 = cell_centers(pts, edges, faces) V0, V1 = TwistedSpace(c0), TwistedSpace(c1) rel = [list(e) for e in edges] P = matrix_between(V0, V1, incidence_operator(V0, V1, rel)) rev = [[k for k, e in enumerate(edges) if x in e] for x in range(len(pts))] Q = matrix_between(V1, V0, incidence_operator(V1, V0, rev)) adj = adjacency_lists(len(pts), edges) d = V0.matrix(edge_sum(V0, adj)) line = [[l for l in range(len(edges)) if l != k and set(edges[l]) & set(edges[k])] for k in range(len(edges))] dE = V1.matrix(edge_sum(V1, line)) q = len(adj[0]) ok_adj = np.allclose(adjoint_between(V0, V1, P), Q) ok1 = np.allclose(Q @ P, q * np.eye(V0.dim) + d) ok2 = np.allclose(P @ Q, 2 * np.eye(V1.dim) + dE) return ok_adj, ok1, ok2 def homology(label): """Classical cellular homology of the sphere; the twist transports it.""" pts, edges, faces = placement(label) n0, n1, n2 = len(pts), len(edges), len(faces) d1 = np.zeros((n0, n1)) for k, (i, j) in enumerate(edges): d1[i, k], d1[j, k] = -1, 1 d2 = np.zeros((n1, n2)) centroid = pts.mean(axis=0) for f, face in enumerate(faces): c = pts[list(face)].mean(axis=0) normal = c - centroid # order the face cyclically, counterclockwise seen from outside a = pts[face[0]] - c b = np.cross(normal, a) ang = sorted(face, key=lambda v: np.arctan2((pts[v] - c) @ b, (pts[v] - c) @ a)) for t in range(len(ang)): u, v = ang[t], ang[(t + 1) % len(ang)] k = edges.index((min(u, v), max(u, v))) d2[k, f] = 1 if (u, v) == edges[k] else -1 assert np.allclose(d1 @ d2, 0) r1, r2 = np.linalg.matrix_rank(d1), np.linalg.matrix_rank(d2) return (n0 - r1, n1 - r1 - r2, n2 - r2) def lift(M): """A unitary W with W (x.sigma) W^* = (Mx).sigma, for M in SO_3.""" # the conjugation action on traceless matrices determines W up to a phase: # solve W S_i = S'_i W, with S'_i = (M e_i).sigma, as a linear system in W rows = [] for i in range(3): Si = SIGMA[i] Sp = sum(M[k, i] * SIGMA[k] for k in range(3)) # W Si - Sp W = 0, vectorized (row-major): (I x Si^T - Sp x I) vec(W) = 0 rows.append(np.kron(np.eye(2), Si.T) - np.kron(Sp, np.eye(2))) A = np.vstack(rows) u, s, vh = np.linalg.svd(A) W = vh[-1].conj().reshape(2, 2) W = W / np.sqrt(abs(np.linalg.det(W))) ok = s[-1] < 1e-9 and np.allclose(W @ W.conj().T, np.eye(2)) return W if ok else None def tetrahedral_symmetry(trials=20): pts, edges, faces = placement("tetrahedron") c0, c1, c2 = cell_centers(pts, edges, faces) V0, V1 = TwistedSpace(c0), TwistedSpace(c1) Pop = incidence_operator(V0, V1, [list(e) for e in edges]) rep = V0.orbits[0][0] def extend(a): F = np.zeros((V0.n, 2, 2), complex) for g, (_, U) in enumerate(GAMMA): F[V0.perm[g][rep]] = U @ a @ U.conj().T return F def edge_values(a): G = Pop(extend(a)) return np.concatenate([np.linalg.eigvalsh(G[k]) for k in range(V1.n)]) s, x = 0.3, np.array([0.2, -0.7, 0.5]) a = s * ONE + sum(x[i] * SIGMA[i] for i in range(3)) vals = sorted(np.round(edge_values(a), 9)) expected = sorted(np.round([2 * s + sgn * 2 * x[i] for i in range(3) for sgn in (1, -1)] * 2, 9)) ok_formula = np.allclose(vals, expected) def preserves(M): # P intertwines the rotation with a permutation of the 6 edge characters # iff the 6 values (2s +- 2x_i) are permuted, for generic s, x W = lift(M) if W is None: return False rng = np.random.default_rng(0) for t in range(3): s, x = rng.normal(), rng.normal(size=3) a = s * ONE + sum(x[i] * SIGMA[i] for i in range(3)) if not np.allclose(sorted(edge_values(a)), sorted(edge_values(W @ a @ W.conj().T))): return False return True count = 0 for perm in itertools.permutations(range(3)): for sg in itertools.product([1, -1], repeat=3): M = np.zeros((3, 3)) for i in range(3): M[perm[i], i] = sg[i] if np.linalg.det(M) > 0 and preserves(M): count += 1 rng = np.random.default_rng(1) random_ok = 0 for t in range(trials): Qm, _ = np.linalg.qr(rng.normal(size=(3, 3))) if np.linalg.det(Qm) < 0: Qm[:, 0] *= -1 random_ok += preserves(Qm) return ok_formula, count, random_ok if __name__ == "__main__": for label, _, _ in PLACEMENTS: print(f"{label:17s} P^* = reverse sum, P^*P = q+d, PP^* = 2+d_E: {check(label)} homology {homology(label)}") ok, n, r = tetrahedral_symmetry() print("tetrahedron: P(s+x.sigma) = (2s+-2x_i):", ok, "; rotations among the signed permutations preserving P:", n, "; random rotations preserving P:", r)