Binary digits as polynomial coefficients #
Polynomial.binaryDigits n has the binary digits of n as its coefficients, starting with
the least significant bit. Evaluation at 2 recovers n; evaluation at 1 is at most the
binary length n.size. This separates a large integer's magnitude from the sizes of the
coefficients used in an exact polynomial computation.
For a polynomial over ℕ, every coefficient is at most its value at 1. Consequently a
degree bound and a bound on this value give exact recovery from a list of coefficient residues.
Main definitions #
Polynomial.binaryDigits: the polynomial of the binary digits of a natural number.
Main results #
Polynomial.eval_two_binaryDigits: evaluation at2recovers the natural number.Polynomial.eval_one_binaryDigits_le: the coefficient sum is at most the binary length.Polynomial.natDegree_binaryDigits_le: the degree is at most the binary length less one.Polynomial.coeff_le_eval_one: a coefficient of a natural polynomial is at most its value at1.Polynomial.ofCoeffList_coeffsBelow_mod: recovery from bounded coefficient residues.
The polynomial whose coefficients are the binary digits of n, least significant first.
Evaluating the binary-digit polynomial at 2 recovers the natural number.
The sum of the binary digits is at most the binary length.
The binary-digit polynomial has degree at most the binary length less one.
A coefficient of a polynomial over the natural numbers is at most the sum of its
coefficients, its value at 1.
A polynomial over the natural numbers is recovered from the residues of sufficiently many low coefficients when its coefficient sum is below the modulus.