# square.py # The duals of Z_4 = and of the Klein group Z_2 x Z_2 = , with their # standard generating sets {g,g^-1} and {x,y}, are isomorphic: the map # g -> (1+i)/2 x + (1-i)/2 y # is a trace-preserving isomorphism of *-algebras C[Z_4] -> C[Z_2 x Z_2], # mapping the span of g,g^-1 onto the span of x,y. # We check this exactly, with Gaussian rationals, and then we check that the # vectors xi_k of the 2 groups correspond to each other, via the tensor powers # of the unitary matrix F of this map, for k = 1,...,K. from fractions import Fraction from itertools import product K = 10 class Gauss: # Gaussian rationals a+bi def __init__(self, a, b=0): self.a, self.b = Fraction(a), Fraction(b) def __add__(self, o): return Gauss(self.a + o.a, self.b + o.b) def __mul__(self, o): return Gauss(self.a * o.a - self.b * o.b, self.a * o.b + self.b * o.a) def conj(self): return Gauss(self.a, -self.b) def __eq__(self, o): return self.a == o.a and self.b == o.b def __repr__(self): return '(%s,%s)' % (self.a, self.b) ZERO, ONE = Gauss(0), Gauss(1) alpha, beta = Gauss(Fraction(1, 2), Fraction(1, 2)), Gauss(Fraction(1, 2), Fraction(-1, 2)) # elements of C[Z_2 x Z_2] as dictionaries (i,j) -> coefficient, for x^i y^j def mul(u, v): w = {} for (i, j), c in u.items(): for (k, l), d in v.items(): key = ((i + k) % 2, (j + l) % 2) w[key] = w.get(key, ZERO) + c * d return {key: c for key, c in w.items() if not c == ZERO} def star(u): return {key: c.conj() for key, c in u.items()} def tr(u): return u.get((0, 0), ZERO) unit = {(0, 0): ONE} g = {(1, 0): alpha, (0, 1): beta} # image of g h = star(g) # image of g^-1 assert mul(g, h) == unit and mul(h, g) == unit, 'the image of g is not unitary' g2 = mul(g, g) assert g2 == {(1, 1): ONE}, 'the square of the image of g is not xy' assert mul(g2, g2) == unit, 'the image of g is not of order 4' powers = [unit, g, g2, mul(g2, g)] assert all(tr(powers[k]) == (ONE if k == 0 else ZERO) for k in range(4)), 'the trace is not preserved' assert h == {(1, 0): beta, (0, 1): alpha} print('g -> (1+i)/2 x + (1-i)/2 y is a trace-preserving isomorphism C[Z_4] -> C[Z_2 x Z_2]') # the unitary F, with rows indexed by x,y and columns indexed by g,g^-1 F = [[alpha, beta], [beta, alpha]] def xi_cyclic(k): # xi_k for (Z_4,{g,g^-1}): words in +1,-1 with sum 0 modulo 4 return {w: 1 for w in product((0, 1), repeat=k) if sum(1 if s == 0 else -1 for s in w) % 4 == 0} def xi_klein(k): # xi_k for (Z_2 x Z_2,{x,y}): words with an even number of x, and of y return {w: 1 for w in product((0, 1), repeat=k) if w.count(0) % 2 == 0 and w.count(1) % 2 == 0} def apply(F, v, k): # apply the k-th tensor power of F to the vector v for pos in range(k): w = {} for word, c in v.items(): for t in (0, 1): d = F[t][word[pos]] new = word[:pos] + (t,) + word[pos + 1:] w[new] = w.get(new, ZERO) + d * c v = {word: c for word, c in w.items() if not c == ZERO} return v for k in range(1, K + 1): a = {w: Gauss(c) for w, c in xi_cyclic(k).items()} b = {w: Gauss(c) for w, c in xi_klein(k).items()} ok = apply(F, b, k) == a print('k = %2d words %4d %4d F^k xi_k(Klein) = xi_k(Z_4): %s' % (k, len(a), len(b), ok)) assert ok print('all checks passed')