"""Order-14 local dimension certificate. Run: OPENBLAS_NUM_THREADS=2 python order14.py Requires Python 3, NumPy and SymPy. All coefficients are reduced modulo 211. No auxiliary files are required. The three indexing conventions are those of mixed_jets.py: row-major interior entries, ordered row pairs, and descending lexicographic order on monomials of fixed degree. """ from collections import Counter from itertools import product import numpy as np from mixed_jets import hadamard, independent_minor, inverse, monomials from order14_linear import directions P = 211 SLICE = np.vstack([np.eye(6, dtype=np.int64), [ [18, 13, 11, 28, 11, 8], [27, 1, 13, 9, 0, 22], [30, 24, 9, 16, 26, 9], [13, 28, 6, 28, 20, 13], [24, 12, 11, 19, 28, 22], [20, 19, 26, 13, 23, 13], ]]) class Slice: def __init__(self): h = hadamard(7, P, 58) self.a, self.b = np.where(~np.eye(14, dtype=bool)) reciprocal = np.array([[pow(int(x), -1, P) for x in row] for row in h]) self.weights = (h[self.a] * reciprocal[self.b] % P)[:, :, None] assert not (self.weights.sum(axis=1) % P).any() columns = [] for unit in np.eye(169, dtype=np.int64): entry = np.zeros((14, 14), dtype=np.int64) entry[1:, 1:] = unit.reshape(13, 13) columns.append((self.weights[:, :, 0] * (entry[self.a]-entry[self.b])).sum(axis=1) % P) self.jacobian = np.column_stack(columns) self.rows, self.pivots = independent_minor(self.jacobian, P) self.free = np.setdiff1d(np.arange(169), self.pivots) assert self.free.tolist() == [153, 154, 155, 160, 161, 162, 163, 164, 165, 166, 167, 168] self.pivot_inverse = inverse(self.jacobian[np.ix_(self.rows, self.pivots)], P) def coefficient(self, known, free): """Solve the 157 pivot equations in one degree or at one monomial.""" width = known.shape[-1] vector = np.zeros((169, width), dtype=np.int64) vector[self.free] = free rhs = -(self.weights * known).sum(axis=1) - self.jacobian @ vector vector[self.pivots] = self.pivot_inverse @ (rhs[self.rows] % P) % P entry = np.zeros((14, 14, width), dtype=np.int64) entry[1:, 1:] = vector.reshape(13, 13, width) ratio = (known + entry[self.a] - entry[self.b]) % P residual = (self.weights * ratio).sum(axis=1) % P assert not residual[self.rows].any() return entry, ratio, residual def quintics(self): entries, ratios = {}, {} for degree in range(1, 6): forms = [] for alpha in monomials(degree, 6): known = np.zeros_like(self.weights) for beta in product(*(range(i+1) for i in alpha)): if not any(beta) or beta == alpha: continue gamma = tuple(i-j for i, j in zip(alpha, beta)) known -= entries[beta][self.b] * ratios[gamma] free = SLICE[:, alpha.index(1), None] if degree == 1 else 0 entry, ratio, residual = self.coefficient(known % P, free) entries[alpha], ratios[alpha] = entry, ratio forms.append(residual[:, 0]) forms = np.column_stack(forms) if degree < 5: assert not forms.any() return forms def along_curve(self, chart, field, degree): """Original ratios on u=t*(1,v(t)), via univariate recursion.""" entries, ratios = {}, {} for k in range(1, degree+1): known = np.zeros((182, 14, field.degree), dtype=np.int64) for j in range(1, k): known -= field.multiply(entries[j][self.b], ratios[k-j]) free = SLICE @ chart[k-1] % P if k <= len(chart) else 0 entry, ratio, residual = self.coefficient(known % P, free) entries[k], ratios[k] = entry, ratio return residual class Field: """Polynomial basis of F_211[T]/(modulus), coefficients in ascending order.""" def __init__(self, modulus): self.modulus = modulus self.degree = len(modulus)-1 def reduce(self, values): result = values.copy() for k in range(len(result)-1, self.degree-1, -1): result[k-self.degree:k] -= (result[k] % P) * self.modulus[:-1] return result[:self.degree] % P def multiply(self, x, y): d = self.degree if d == 1: return x*y % P result = np.zeros((*np.broadcast_shapes(x.shape[:-1], y.shape[:-1]), 2*d-1), dtype=np.int64) for i in range(d): for j in range(d): result[..., i+j] += x[..., i] * y[..., j] for k in range(2*d-2, d-1, -1): result[..., k-d:k] -= (result[..., k, None] % P) * self.modulus[:-1] return result[..., :d] % P def first_obstruction(sliced, coordinates, modulus): field = Field(modulus) d = field.degree chart = np.zeros((5, 6, d), dtype=np.int64) for j in range(6): chart[0, j] = field.reduce(coordinates[:, j]) assert chart[0, 0].tolist() == [1] + [0]*(d-1) assert not sliced.along_curve(chart, field, 5).any() # A quintic restricted to a coordinate line has degree at most 5. # Interpolation at 0,...,5 recovers its first derivative exactly. vandermonde = np.array([[h**k % P for k in range(6)] for h in range(6)]) weights = inverse(vandermonde, P)[1] linear = np.empty((182*d, 5*d), dtype=np.int64) for j in range(1, 6): derivative = np.zeros((182, d), dtype=np.int64) for h in range(1, 6): shifted = chart.copy() shifted[0, j, 0] = (shifted[0, j, 0] + h) % P derivative += weights[h] * sliced.along_curve(shifted, field, 5) for l, unit in enumerate(np.eye(d, dtype=np.int64)): linear[:, (j-1)*d+l] = field.multiply(derivative % P, unit).ravel() rows, cols = independent_minor(linear, P) assert len(cols) == 5*d pivot_inverse = inverse(linear[rows], P) for n in range(1, 5): rhs = (-sliced.along_curve(chart, field, 5+n)).ravel() % P correction = pivot_inverse @ rhs[rows] % P if np.any((linear @ correction - rhs) % P): return 5+n chart[n, 1:] = correction.reshape(5, d) assert not sliced.along_curve(chart, field, 5+n).any() raise AssertionError("Expected an obstruction through degree 9") def main(): sliced = Slice() coordinates, factors = directions(sliced.quintics(), P) print("Dimensions in degrees 11, 12, 13, 14: 90, 38, 20, 20", flush=True) counts = Counter() for factor in factors: degree = first_obstruction(sliced, coordinates, factor) counts[degree] += len(factor)-1 print(f"Factor {factor.tolist()} (constant first), first obstruction in degree {degree}", flush=True) assert counts == {6: 2, 9: 18} print("All 20 projective directions obstructed:", dict(sorted(counts.items()))) if __name__ == "__main__": main()