# Section 10: computer-assisted proof that 9 chains of rotators, of orders 16, 17, 18, give local maximizers of the 1-norm on # the unitary group U_N which are not rescaled complex Hadamard matrices. The seeds are in certify.json: the angles found by # chains.py, rounded to 12 digits, which at N = 16 are those of the table in the paper. For each seed the program proves: # (1) In the box of radius 10^-11 around the seed, with theta_0 = 0, there is exactly one critical point of the chain energy # Tr|S| = sum_k |hat s_k|, that is, one solution of F_j = Im(conj(s_j) gamma_j) = 0, where gamma is the inverse Fourier # transform of the phases of hat s, so that U = Pol(S) is the circulant matrix of gamma. This is the Krawczyk test: for the # map T(x) = x - Y F(x), with Y an approximate inverse of the Jacobian, the interval enclosure of T on the box lies inside # the box, and the enclosure of I - Y F' over the box has norm < 1, so T is a contraction of the box, with a unique fixed # point, which is a zero of F. The same test is then done on a box of radius 10^-30 around a refined center, lying inside # the first box, so that the exact chain is located within 10^-30 too. # (2) For this exact chain, the numbers conj(s_j) gamma_j are positive, so S is the phase matrix of U, and U is a critical # point of the 1-norm on U_N. Also, ||U||_1 = Tr|S| is strictly smaller than N sqrt(N), so U is not Hadamard. # (3) The Hessian h(B) = sum_ij Re(conj(S_ij) (UB)_ij)^2 / |U_ij| - Tr(X B^2) of the 1-norm at U, along U exp(itB) with B # self-adjoint, where X = S^* U, satisfies h(B) <= -c ||B||^2 for any B orthogonal to the tangent space K of the orbit # of U under the gauge group, spanned by the matrices E_jj and U^* E_jj U. This is an interval Cholesky decomposition of # sum_p k_p k_p^t - h - c, in an orthonormal basis of the self-adjoint matrices. # These facts show that U is a local maximizer, as explained in the paper. All the proof is done with intervals of decimal # numbers with 60 digits, rounded outwards, by using only the decimal module of Python. NumPy is used only to propose data, # namely the matrix Y and the refined centers, and to display eigenvalues: wrong proposals can only make a test fail. # Usage: python3 certify.py [N ...]. With no argument the 9 seeds are checked, and any failure stops the program with an error. import sys, json, time from decimal import Decimal as D, Context, ROUND_FLOOR, ROUND_CEILING, ROUND_HALF_EVEN P = 60 DN = Context(prec=P, rounding=ROUND_FLOOR); UP = Context(prec=P, rounding=ROUND_CEILING); NE = Context(prec=P, rounding=ROUND_HALF_EVEN) class I: # real intervals [a, b], with decimal endpoints __slots__ = ("a", "b") def __init__(self, a, b=None): self.a = a if isinstance(a, D) else D(a); self.b = self.a if b is None else (b if isinstance(b, D) else D(b)) def __add__(x, y): if not isinstance(y, I): y = I(y) return I(DN.add(x.a, y.a), UP.add(x.b, y.b)) __radd__ = __add__ def __sub__(x, y): if not isinstance(y, I): y = I(y) return I(DN.subtract(x.a, y.b), UP.subtract(x.b, y.a)) def __rsub__(x, y): return I(y) - x def __neg__(x): return I(x.b.copy_negate(), x.a.copy_negate()) def __mul__(x, y): if not isinstance(y, I): y = I(y) a, b, c, d = x.a, x.b, y.a, y.b if a >= 0 and c >= 0: return I(DN.multiply(a, c), UP.multiply(b, d)) return I(min(DN.multiply(a, c), DN.multiply(a, d), DN.multiply(b, c), DN.multiply(b, d)), max(UP.multiply(a, c), UP.multiply(a, d), UP.multiply(b, c), UP.multiply(b, d))) __rmul__ = __mul__ def inv(x): assert x.a > 0 or x.b < 0, "division by an interval containing 0" return I(DN.divide(D(1), x.b), UP.divide(D(1), x.a)) def __truediv__(x, y): if not isinstance(y, I): y = I(y) return x * y.inv() def sqrt(x): assert x.a > 0 e = D(10) ** (3 - P); r1 = NE.sqrt(x.a); r2 = NE.sqrt(x.b); lo = DN.multiply(r1, DN.subtract(D(1), e)); hi = UP.multiply(r2, UP.add(D(1), e)) assert UP.multiply(lo, lo) <= x.a and DN.multiply(hi, hi) >= x.b # so that lo <= sqrt(a) and sqrt(b) <= hi return I(lo, hi) def mag(x): return max(x.a.copy_abs(), x.b.copy_abs()) def mid(x): return NE.divide(NE.add(x.a, x.b), D(2)) def rad(x): return UP.subtract(x.b, x.a) def inside(x, y): return y.a < x.a and x.b < y.b # x is in the interior of y def __repr__(x): return "[%s, %s]" % (x.a, x.b) class C: # complex intervals __slots__ = ("re", "im") def __init__(self, re, im=0): self.re = re if isinstance(re, I) else I(re); self.im = im if isinstance(im, I) else I(im) def __add__(x, y): return C(x.re + y.re, x.im + y.im) def __sub__(x, y): return C(x.re - y.re, x.im - y.im) def __mul__(x, y): if isinstance(y, I): return C(x.re * y, x.im * y) return C(x.re * y.re - x.im * y.im, x.re * y.im + x.im * y.re) def conj(x): return C(x.re, -x.im) def abs(x): return (x.re * x.re + x.im * x.im).sqrt() BIG = Context(prec=300) def show(x, digits=24): return "[%s, %s]" % (x.a.quantize(D(10) ** -digits, rounding=ROUND_FLOOR, context=BIG), x.b.quantize(D(10) ** -digits, rounding=ROUND_CEILING, context=BIG)) def arctaninv(q, terms=60): # arctan(1/q), by its alternating series s = I(0); q = I(q); p = I(1) / q for k in range(terms): t = p / (2 * k + 1); s = s + t if k % 2 == 0 else s - t; p = p / (q * q) t = (p / (2 * terms + 1)).mag(); return s + I(t.copy_negate(), t) PI = 16 * arctaninv(5) - 4 * arctaninv(239) # the formula of Machin def trig(x, terms=70): # cos and sin of an interval, by Taylor series with the Lagrange remainder m = x.mag(); assert m < 8 x2 = x * x; c = I(0); s = I(0); t = I(1) # t = x^(2k) / (2k)! for k in range(terms): c = c + t if k % 2 == 0 else c - t; u = t / (2 * k + 1) s = s + u if k % 2 == 0 else s - u; t = t * x2 / ((2 * k + 1) * (2 * k + 2)) r = I(m); rc = I(1) for k in range(1, 2 * terms + 1): rc = rc * r / k # m^(2 terms) / (2 terms)!, which bounds both remainders, for the series of cos and of sin(x)/x e = rc.b; assert e < D(10) ** (5 - P) return c + I(e.copy_negate(), e), x * (s + I(e.copy_negate(), e)) def chain(theta, N, W): # s, hat s, |hat s|, the phases phi of hat s, and gamma, for a chain given by intervals s = [C(*trig(t)) for t in theta]; hat = [] for k in range(N): z = C(0) for j in range(N): z = z + s[j] * W[(j * k) % N] hat.append(z) a = [z.abs() for z in hat]; phi = [C(z.re / r, z.im / r) for z, r in zip(hat, a)]; gamma = [] for j in range(N): z = C(0) for k in range(N): z = z + phi[k] * W[(j * k) % N].conj() gamma.append(C(z.re / N, z.im / N)) return s, hat, a, phi, gamma def gradient(theta, N, W): # F_j = Im(conj(s_j) gamma_j), which is the derivative of the energy with respect to theta_j, divided by N s, hat, a, phi, gamma = chain(theta, N, W); return [(s[j].conj() * gamma[j]).im for j in range(N)] def jacobian(theta, N, W): # dF_j / dtheta_l = (sum_k c_jk c_lk / |hat s_k| - delta_jl sum_k c_jk) / N, with c_jk = Re(conj(phi_k) s_j w^jk) s, hat, a, phi, gamma = chain(theta, N, W); c = [[(phi[k].conj() * s[j] * W[(j * k) % N]).re for k in range(N)] for j in range(N)]; ia = [x.inv() for x in a]; J = [] for j in range(N): row = [] for l in range(N): z = I(0) for k in range(N): z = z + c[j][k] * c[l][k] * ia[k] if j == l: for k in range(N): z = z - c[j][k] row.append(z / N) J.append(row) return J def krawczyk(x, rad, Y, N, W): # the box of radius rad around x, the enclosure K of T on it, and the norm of I - Y F' over it box = [I(0)] + [I(DN.subtract(z.a, rad), UP.add(z.a, rad)) for z in x[1:]] F = gradient(x, N, W)[1:]; J = [row[1:] for row in jacobian(box, N, W)[1:]]; delta = I(rad.copy_negate(), rad); inside = True; image = D(0); norm = D(0) for j in range(N - 1): k = x[j + 1] - sum((Y[j][l] * F[l] for l in range(N - 1)), I(0)); row = D(0) for l in range(N - 1): e = (I(1) if j == l else I(0)) - sum((Y[j][m] * J[m][l] for m in range(N - 1)), I(0)); k = k + e * delta; row = UP.add(row, e.mag()) inside = inside and k.inside(box[j + 1]); image = max(image, (k - x[j + 1]).mag()); norm = max(norm, row) return box, inside, image, norm def certify(seed, margin): import numpy as np N = len(seed); t0 = time.time(); W = [C(*trig(2 * PI * m / N)) for m in range(N)] x = [I(D(a)) for a in seed]; assert x[0].a == 0 and x[0].b == 0 print("chain of %d rotators, seed %s" % (N, " ".join(seed)), flush=True) Y = np.linalg.inv(np.array([[float(z.mid()) for z in row[1:]] for row in jacobian(x, N, W)[1:]])); Y = [[I(float(v)) for v in row] for row in Y] big, inside, image, norm = krawczyk(x, D(10) ** -11, Y, N, W) print(" (1) box of radius 1e-11 around the seed: the image under T lies within %.1e of the seed, inside the box: %s, and ||I - Y F'|| <= %.1e" % (image, inside, norm), flush=True) assert inside and norm < 1 for it in range(8): # refinement of the center, which proves nothing by itself F = gradient(x, N, W)[1:]; x = [I(0)] + [I((x[j + 1] - sum((Y[j][l] * F[l] for l in range(N - 1)), I(0))).mid()) for j in range(N - 1)] box, inside, image, norm = krawczyk(x, D(10) ** -30, Y, N, W) within = all(big[j].a < box[j].a and box[j].b < big[j].b for j in range(1, N)); drift = max((x[j] - I(D(seed[j]))).mag() for j in range(N)) print(" box of radius 1e-30 around the refined center, which is %.1e away from the seed: inside the first box: %s, image within %.1e, inside: %s, ||I - Y F'|| <= %.1e" % (drift, within, image, inside, norm), flush=True) assert within and inside and norm < 1 # (2) the exact chain lies in the box, and from now on all the enclosures are valid for it s, hat, a, phi, gamma = chain(box, N, W); pos = [(s[j].conj() * gamma[j]).re for j in range(N)]; energy = sum(a, I(0)); bound = I(N) * I(N).sqrt() assert all(z.a > 0 for z in pos) and energy.b < bound.a print(" (2) the numbers conj(s_j) gamma_j are positive, lying in %s, and so are the numbers |hat s_k|, lying in %s" % (show(I(min(z.a for z in pos), max(z.b for z in pos)), 12), show(I(min(z.a for z in a), max(z.b for z in a)), 12))) print(" ||U||_1 = Tr|S| lies in %s, and N sqrt(N) - Tr|S| lies in %s, which is positive" % (show(energy), show(bound - energy)), flush=True) # (3) the Hessian of the 1-norm on U_N, in the orthonormal basis e_ii, (e_ij + e_ji)/sqrt(2), i(e_ij - e_ji)/sqrt(2) of the self-adjoint matrices U = [[gamma[(j - i) % N] for j in range(N)] for i in range(N)]; S = [[s[(j - i) % N] for j in range(N)] for i in range(N)]; absU = [[pos[(j - i) % N] for j in range(N)] for i in range(N)] iU = [[z.inv() for z in row] for row in absU]; r2 = I(D(1) / D(2)).sqrt(); X = [[C(0)] * N for i in range(N)] for p in range(N): for q in range(N): z = C(0) for r in range(N): z = z + S[r][p].conj() * U[r][q] X[p][q] = z basis = [[(i, i, C(1))] for i in range(N)] for i in range(N): for j in range(i + 1, N): basis.append([(i, j, C(r2)), (j, i, C(r2))]); basis.append([(i, j, C(0, r2)), (j, i, C(0, -r2))]) n = len(basis); cols = [] # for each basis element B, the nonzero columns of Re(conj(S) (UB)) for B in basis: d = {} for p, q, v in B: col = d.setdefault(q, [I(0)] * N); d[q] = [col[r] + (S[r][q].conj() * (U[r][p] * v)).re for r in range(N)] cols.append(d) bycol = {}; byrow = {} for a_, B in enumerate(basis): for q in cols[a_]: bycol.setdefault(q, []).append(a_) for p, q, v in B: byrow.setdefault(p, []).append((a_, q, v)) H = [[I(0)] * n for a_ in range(n)] for q, members in bycol.items(): # the first term for a_ in members: wa = [cols[a_][q][r] * iU[r][q] for r in range(N)] for b_ in members: if b_ > a_: continue H[a_][b_] = H[a_][b_] + sum((wa[r] * cols[b_][q][r] for r in range(N)), I(0)) half = I(D(1) / D(2)) for a_, B in enumerate(basis): # the second term, Re Tr(X (BC + CB)) / 2, with Tr(X B C) = sum X_pq B_qr C_rp for q, r, u in B: for b_, p, v in byrow[r]: t = ((X[p][q] * u) * v).re * half if b_ <= a_: H[a_][b_] = H[a_][b_] - t if a_ <= b_: H[b_][a_] = H[b_][a_] - t index = {}; k = N for i in range(N): for j in range(i + 1, N): index[(i, j)] = k; k += 2 kernel = [] # the coordinates of the matrices E_jj and U^* E_jj U for j in range(N): v = [I(0)] * n; v[j] = I(1); kernel.append(v); v = [I(0)] * n; root2 = I(2).sqrt() for p in range(N): v[p] = (U[j][p].conj() * U[j][p]).re for q in range(p + 1, N): z = U[j][p].conj() * U[j][q]; v[index[(p, q)]] = z.re * root2; v[index[(p, q)] + 1] = z.im * root2 kernel.append(v) A = [[I(0)] * n for a_ in range(n)]; c = I(D(str(margin))) # A = sum_p k_p k_p^t - H - c, lower triangle for a_ in range(n): for b_ in range(a_ + 1): z = -H[a_][b_] for v in kernel: z = z + v[a_] * v[b_] A[a_][b_] = z - c if a_ == b_ else z Hm = np.array([[float(H[max(a_, b_)][min(a_, b_)].mid()) for b_ in range(n)] for a_ in range(n)]); Am = np.array([[float(A[max(a_, b_)][min(a_, b_)].mid()) for b_ in range(n)] for a_ in range(n)]) ev = np.linalg.eigvalsh(Hm); width = max(A[a_][b_].rad() for a_ in range(n) for b_ in range(a_ + 1)) print(" (3) Hessian of size %d, assembled in %d seconds, with entries known up to %.1e. In double precision, its midpoint has %d eigenvalues below -1e-9, %d in between, %d above 1e-9, the largest negative one being %.6f" % (n, time.time() - t0, width, (ev < -1e-9).sum(), (abs(ev) <= 1e-9).sum(), (ev > 1e-9).sum(), ev[ev < -1e-9].max()), flush=True) L = [[None] * n for a_ in range(n)]; smallest = None # interval Cholesky decomposition for j in range(n): z = A[j][j] for k in range(j): z = z - L[j][k] * L[j][k] assert z.a > 0, "the pivot number %d is not positive" % j smallest = z.a if smallest is None else min(smallest, z.a); d = z.sqrt(); L[j][j] = d; di = d.inv() for i in range(j + 1, n): z = A[i][j]; Li = L[i]; Lj = L[j] for k in range(j): z = z - Li[k] * Lj[k] L[i][j] = z * di print(" interval Cholesky decomposition of sum_p k_p k_p^t - h - %s: all the %d pivots are positive, the smallest one being at least %.6f, with intervals of radius at most %.1e" % (margin, n, smallest, max(L[j][j].rad() for j in range(n)))) print(" so h(B) <= -%s ||B||^2 for any self-adjoint B which is orthogonal to the gauge directions, and U is a local maximizer of the 1-norm on U_%d, which is not a rescaled complex Hadamard matrix. Total time: %d seconds" % (margin, N, time.time() - t0), flush=True) if __name__ == "__main__": if not __debug__: raise SystemExit("the proof uses assertions: run without the -O option") import os seeds = json.load(open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "certify.json"))) counts = {} for row in seeds: counts[row["N"]] = counts.get(row["N"], 0) + 1 assert counts == {16: 1, 17: 2, 18: 6}, counts orders = [int(x) for x in sys.argv[1:]] or [16, 17, 18]; done = 0 for row in seeds: if row["N"] in orders: certify(row["angles"], row["margin"]); done += 1 assert done == sum(counts.get(n, 0) for n in orders) and done > 0, "nothing was checked" print("all the %d requested chains are certified" % done)