Arithmetic modulo 2 ^ p and a monic polynomial, on coefficient lists #
The coefficient rings of the contraction algorithm of [OAI26k] (Appendix D.4.1, p. 57) are
A_p = (ℤ / 2 ^ p)[U] / (f) for a monic f ∈ ℤ[U] of degree e. An element is represented in the
basis 1, U, …, U ^ (e - 1) by its list of coordinates, each an integer residue modulo 2 ^ p.
The monic polynomial is given by the list fl of its coefficients below the leading one
(GaloisRingArith.monicOf), so e is the length of fl. With f irreducible modulo 2, A_p is
the Galois ring (ℤ / 2 ^ p)[U] / (f); nothing here needs irreducibility.
The value of a coefficient list c is ∑ i < e, c i U ^ i in A_p (GaloisRingArith.val).
- Addition (
GaloisRingArith.add) adds coordinates modulo2 ^ p. - Multiplication by
U(GaloisRingArith.mulX) shifts the coordinates up and subtracts the top coordinate timesf, reducingU ^ e = -∑ i < e, fl i U ^ i. - Multiplication (
GaloisRingArith.mul) is shift-and-add:c d = ∑ i < e, c i (U ^ i d), accumulatingc itimes the currentU ^ i dand multiplying it byU,etimes. - Powers (
GaloisRingArith.pow)c ^ ktakekmultiplications fromGaloisRingArith.one, withkin unary. In the source the exponents of the mode substitutions are below the precision (Appendix D.4.6, p. 63), so they are polynomial. - Inversion (
GaloisRingArith.inv) starts from the seedx ^ (2 ^ e - 2), a product ofe - 1repeated squares (GaloisRingArith.seed), and takespNewton stepsy ↦ y (2 - x y), each squaring the defectx y - 1(GaloisRingArith.val_mul_newton). When the seed invertsxmodulo2, the result is the inverse (GaloisRingArith.val_mul_inv). In a Galois ring, withfirreducible modulo2, this holds for every unit, since the residue field has2 ^ eelements; that bridge is not made here.
Each operation is correct (GaloisRingArith.val_add, GaloisRingArith.val_mulX,
GaloisRingArith.val_mul) and polynomial-time, with the precision p in unary and the
coordinates and the coefficients of f in binary (GaloisRingArith.computableInPolyTime_add,
GaloisRingArith.computableInPolyTime_mul). Their outputs are reduced, with e coordinates below
2 ^ p (GaloisRingArith.length_mul, GaloisRingArith.lt_of_mem_mul). These are the
polynomial-time arithmetic claims of Appendix D.4.1 for addition and multiplication, in the case
ℓ = 1 of the source, where A = O has no V-coordinates, together with the inversion of units
by inversion modulo two and Newton lifting that the source names (Appendix D.4.1, p. 58).
Main definitions #
Cslib.GaloisRingArith.monicOf: the monic polynomial with given lower coefficients.Cslib.GaloisRingArith.val: the value of a coefficient list.Cslib.GaloisRingArith.add,Cslib.GaloisRingArith.mulX,Cslib.GaloisRingArith.mul,Cslib.GaloisRingArith.one,Cslib.GaloisRingArith.pow,Cslib.GaloisRingArith.neg,Cslib.GaloisRingArith.sub: addition, multiplication byU, multiplication, the unit, powers, negation and subtraction.Cslib.GaloisRingArith.seed,Cslib.GaloisRingArith.newton,Cslib.GaloisRingArith.inv: inversion.
Main results #
Cslib.GaloisRingArith.val_add,Cslib.GaloisRingArith.val_mulX,Cslib.GaloisRingArith.val_mul,Cslib.GaloisRingArith.val_one,Cslib.GaloisRingArith.val_pow,Cslib.GaloisRingArith.val_neg,Cslib.GaloisRingArith.val_sub,Cslib.GaloisRingArith.val_seed,Cslib.GaloisRingArith.val_mul_inv: correctness.Cslib.GaloisRingArith.computableInPolyTime_add,Cslib.GaloisRingArith.computableInPolyTime_mulX,Cslib.GaloisRingArith.computableInPolyTime_mul,Cslib.GaloisRingArith.computableInPolyTime_pow,Cslib.GaloisRingArith.computableInPolyTime_inv: polynomial time.
References #
- OpenAI, The Exponential Time Hypothesis is False, Appendix D.4.1 (p. 57).
The monic polynomial U ^ e + ∑ i < e, fl i U ^ i of degree e = fl.length.
Inversion: p Newton steps from the seed. It is the inverse of x whenever the seed
inverts x modulo 2 (val_mul_inv), in particular for every unit of a Galois ring.
Correctness #
The root satisfies U ^ e = -∑ i < e, fl i U ^ i.
Multiplication by U is correct.
Reduced outputs #
Polynomial time #
Reduction modulo 2 ^ p, with p in unary.
A coordinate, at a unary index.
Tabulating e coordinates, for a unary e.
Addition is polynomial-time, with the precision in unary.
Adding a multiple is polynomial-time, with the precision in unary.
Multiplication by U is polynomial-time, with the precision in unary.
The unit is polynomial-time.
The length e (2 p + 1) of a reduced coefficient list is polynomially bounded.
Multiplication is polynomial-time, with the precision in unary. Every intermediate pair is reduced after its first step, so its length is bounded by the precision and the degree.
Powers are polynomial-time, with the precision and the exponent in unary.
Negation is polynomial-time, with the precision in unary.
Subtraction is polynomial-time, with the precision in unary.
A Newton step is polynomial-time, with the precision in unary.
The seed of inversion is polynomial-time, with the precision in unary.
Inversion is polynomial-time, with the precision in unary.