"""Implicit Abel inversion at a fixed divisor of three branch points. Run with Python 3. No Jacobian vector-field or Cartier recurrence is used to produce the derivatives. The comparison with Cartier is performed last. """ from math import comb, factorial def trace_row(power, period, modulus): def trace(n): if n % 7 == 0: return 3 return period if n % 7 in (1, 2, 4) else -1-period return tuple(trace(power + i) % modulus for i in range(3)) def inverse(matrix, p, modulus): n = len(matrix) rows = [list(row) + [int(i == j) for j in range(n)] for i, row in enumerate(matrix)] for col in range(n): pivot = next(i for i in range(col, n) if rows[i][col] % p) rows[col], rows[pivot] = rows[pivot], rows[col] unit = pow(rows[col][col], -1, modulus) rows[col] = [x * unit % modulus for x in rows[col]] for i in range(n): if i != col: factor = rows[i][col] rows[i] = [(v - factor*w) % modulus for v, w in zip(rows[i], rows[col])] return [row[n:] for row in rows] def integrals(modulus, max_degree): # I_l'(Y)=(1+Y²)^(l/7-1), I_l(0)=0. Entries are actual derivatives at 0. inv7 = pow(7, -1, modulus) result = [] for ell in (1, 2, 3, 4): coeff = [0] * (max_degree + 1) coeff[1] = 1 for n in range(1, max_degree-1, 2): j = (n-1)//2 coeff[n+2] = coeff[n] * 2*n * (ell - 7*(j+1)) * inv7 % modulus result.append(coeff) return result def implicit_jets(p, period, orders): modulus = p*p half7 = 7*pow(2, -1, modulus) % modulus traces = [trace_row(ell, period, modulus) for ell in (1, 2, 3, 4)] inv = inverse(traces[:3], p, modulus) a, b = (1, 2) if p % 7 == 2 else (2, 1) max_total = max(r+s for r, s in orders) # D^e I_l(0) is divisible by (e-1)! over Z_p. Beyond 2p all vanish mod p². max_power = min(max_total, 2*p) coeff = integrals(modulus, max_power) binom = [[comb(n, i) % modulus for i in range(n+1)] for n in range(max_total+1)] indices = {(i, j) for r, s in orders for i in range(r+1) for j in range(s+1)} powers = {} observable = {(0, 0): 0} # Y is a single branch parameter in the unramified cubic. Its conjugates # give the other two parameters because the source coordinates are rational. # powers[r,s][e] is the (r,s) derivative of Y^e/e! at the origin. for r, s in sorted(indices - {(0, 0)}, key=lambda pair: (sum(pair), pair)): degree = r+s upper = min(degree, max_power) acc = [[0, 0, 0] for _ in range(upper+1)] for i in range(1 if r else 0, r+1): for j in range(0 if r else 1, s+1): if (i+j) % 2 == 0 or i+j == degree: continue weight = (binom[r-1][i-1] * binom[s][j] if r else binom[s-1][j-1]) % modulus if weight == 0: continue # The product rule for d(Y^e/e!)=(Y^(e-1)/(e-1)!) dY. x0, x1, x2 = powers[i, j][1] for e, (y0, y1, y2) in powers[r-i, s-j].items(): if e+1 > upper: continue cubic = x1*y2 + x2*y1 quartic = x2*y2 value = acc[e+1] # rho³=1+(1+period)rho+period*rho², rho⁴=period-rho-rho². value[0] += weight*(x0*y0 + cubic + period*quartic) value[1] += weight*(x0*y1 + x1*y0 + (1+period)*cubic - quartic) value[2] += weight*(x0*y2 + x1*y1 + x2*y0 + period*cubic - quartic) divided = {e: tuple(c % modulus for c in acc[e]) for e in range(2 if degree % 2 == 0 else 3, upper+1, 2)} powers[r, s] = divided observable[r, s] = 0 if degree % 2 == 0: continue nonlinear = [] for row, coefficients in zip(traces, coeff): nonlinear.append(sum(coefficients[e] * sum(x*y for x, y in zip(row, value)) for e, value in divided.items()) % modulus) targets = [half7 * int(((r,s) == (1,0) and ell == a) or ((r,s) == (0,1) and ell == b)) - nonlinear[ell-1] for ell in (1, 2, 3)] linear = tuple(sum(x*y for x, y in zip(row, targets)) % modulus for row in inv) divided[1] = linear observable[r, s] = (nonlinear[3] + sum(x*y for x, y in zip(traces[3], linear))) * pow(half7, -1, modulus) % modulus return {order: observable[order] for order in orders} def cartier(source, target, p): k, remainder = divmod(p*target - source, 7) m = (p-1)//2 return 0 if remainder or not 0 <= k <= m else (-1)**(m-k) * comb(m, k) % p def polynomial_primitive(poly, p): result = {} for power, coefficient in poly.items(): if coefficient % p: assert (power + 1) % p, (p, power, coefficient) result[power + 1] = coefficient * pow(power + 1, -1, p) % p differentiated = {i - 1: i * c % p for i, c in result.items()} assert differentiated == {i: c % p for i, c in poly.items() if c % p} return result def check_witt_primitives(p): # Clearing y^p or y^(p²) from a curve differential leaves a polynomial. # A polynomial has a primitive over F_p exactly when its x^(pk-1) # coefficients vanish. Check the explicit numerators before integration. a, b = (1, 2) if p % 7 == 2 else (2, 1) m = (p - 1) // 2 def shifted_power(shift, exponent): return {7*k + shift: (-1)**(exponent-k) * comb(exponent, k) % p for k in range(exponent + 1)} derivative = shifted_power(a - 1, m) first = polynomial_primitive(derivative, p) polynomial_primitive(shifted_power(2, m), p) product = derivative for _ in range(p - 1): next_product = {} for i, ci in product.items(): for j, cj in first.items(): next_product[i+j] = (next_product.get(i+j, 0) + ci*cj) % p product = next_product h = cartier(b, a, p) second = shifted_power(b - 1, (p + 1)*m) for power, coefficient in product.items(): second[power] = (second.get(power, 0) - h*coefficient) % p primitive = polynomial_primitive(second, p) print(f"p={p}: verified the three rational Witt primitives, deg Q={max(primitive)}") def check_branch(p, js): a, b = (1, 2) if p % 7 == 2 else (2, 1) H, B = cartier(b, a, p), cartier(4, b, p) boundary = [(p*j, p-j) for j in js] outside = [(r+2, s) for r, s in boundary] periods = [v for v in range(p*p) if (v*v + v + 2) % (p*p) == 0] assert len(periods) == 2 for period in periods: values = implicit_jets(p, period, boundary+outside) for j, index in zip(js, boundary): assert values[index] % p == -B * pow(H, j, p) % p, (p, period, index, values[index]) assert all(values[index] % p == 0 for index in outside) print(f"p={p}, period={period} mod {p*p}, H={H}, B={B}") if 1 in js: raw = values[p, p-1] unit = raw * pow(factorial(p-1), -2, p*p) % (p*p) print(f" first mixed derivative = {raw}, p times its Taylor coefficient = {unit} (mod {p*p})") print(" (j, derivative mod p², next derivative two steps in a mod p²)") print(" ", [(j, values[on], values[off]) for j, on, off in zip(js, boundary, outside)]) if __name__ == "__main__": for prime in (11, 23): check_witt_primitives(prime) check_branch(prime, list(range(prime + 1)))