Lagrange interpolation, and interpolation in the exponent, in polynomial time #
Lemma 22.1 of [BS23] says that the value at a point j* of a polynomial of degree less
than t over Z_q is a fixed combination ∑ λ_j ω(j) of its values at t distinct nodes, and
that the coefficients λ_j are efficiently computable from the nodes and j*. Corollary 22.2
says that in a group of prime order q the element h^{ω(j*)} can be efficiently computed from
the nodes, j* and the elements h^{ω(j)}. This file proves both efficiency clauses, for
functions that are tied to the identities.
lagrangeWeightNat q nodes j xcomputes the coefficientλ_jat the pointxon natural numbers moduloq, as a product of the factors(j - j')⁻¹ (x - j')fromextractNat. Modulo a prime it is the value atxof the Lagrange basis polynomial ofj(lagrangeWeightNat_cast_eq_eval_basis), so Lemma 22.1 holds with these coefficients (eval_eq_sum_lagrangeWeightNat_mul_eval). Withqthe order of a group of a prime-order group family, it is computable in polynomial time (computableInPolyTime_lagrangeWeightNat).lagrangeCombine d x sharescombines the group elements of a list of pairs(j, h_j)with those coefficients. On the elementsf(j) • hit givesf(x) • h(lagrangeCombine_eval_smul, Corollary 22.2 written additively), and its encoding is computable in polynomial time from the encoded pairs (computableInPolyTime_encode_lagrangeCombine).
The identities over an arbitrary field, without cost statements, are
Lagrange.eval_eq_sum_eval_basis_mul_eval and Lagrange.eval_smul_eq_sum_eval_basis_smul.
Differences from the book:
- The prime is the order
F.order dof a group of aPrimeOrderGroupFamily, because the certified inverse modulo a prime,computableInPolyTime_extractNat, is stated for it. The identitieslagrangeWeightNat_cast_eq_eval_basisandeval_eq_sum_lagrangeWeightNat_mul_evalhold for every primeq. - The node set
J ⊆ Z_qis a list of natural numbers whose residues modulo the order are distinct, and the pointj*is any natural number. The computed coefficient needs no hypothesis on the nodes: it skips the nodes equal tojmodulo the order. - The group is written additively, as in the library's Diffie–Hellman modules.
- The combination's certificate takes the encodings of group elements, not arbitrary words: the
input is the list of pairs
(j, F.encode d h_j). For words that are not encodings, no polynomial bound on the intermediate results of the combination is available. lagrangeCombinerecomputes every coefficient with its own fold, so it performs quadratically many modular exponentiations in the number of nodes. The certificates claim polynomial time and no sharper bound.
Main definitions #
Cslib.Crypto.PrimeOrderGroupFamily.lagrangeWeightNat: the Lagrange coefficient moduloqon natural numbers.Cslib.Crypto.PrimeOrderGroupFamily.lagrangeCombine: the combination of group elements with those coefficients.
Main results #
Cslib.Crypto.PrimeOrderGroupFamily.lagrangeWeightNat_cast_eq_eval_basis: the computed coefficient is the value of a Lagrange basis polynomial.Cslib.Crypto.PrimeOrderGroupFamily.eval_eq_sum_lagrangeWeightNat_mul_eval: Lemma 22.1 of [BS23] with the computed coefficients.Cslib.Crypto.PrimeOrderGroupFamily.computableInPolyTime_lagrangeWeightNat: the efficiency clause of Lemma 22.1.Cslib.Crypto.PrimeOrderGroupFamily.lagrangeCombine_eval_smul: Corollary 22.2 for the computed combination.Cslib.Crypto.PrimeOrderGroupFamily.computableInPolyTime_encode_lagrangeCombine: the efficiency clause of Corollary 22.2.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Section 22.1.1, Lemma 22.1 (p. 928) and Corollary 22.2 (p. 929).
The interpolation coefficient on natural numbers #
The Lagrange interpolation coefficient at the point x of the node j among nodes, computed
modulo q on natural numbers: the product of (j - j')⁻¹ (x - j') over the nodes j' that differ
from j modulo q, each factor computed by extractNat.
Modulo a prime q, lagrangeWeightNat is the product of the quotients (x - j') / (j - j')
over the nodes j' that differ from j modulo q. No hypothesis on the nodes is needed.
Modulo a prime q, for nodes that are distinct modulo q and a node j among them,
lagrangeWeightNat is the value at x of the Lagrange basis polynomial of j: the coefficient of
Lagrange.eval_basis. Both hypotheses are needed.
Lemma 22.1 of [BS23] for the computed coefficients: for a prime q, nodes that
are distinct modulo q and a polynomial f over ZMod q of degree less than the number of
nodes, the value of f at any point x is the combination of its values at the nodes with the
coefficients lagrangeWeightNat q nodes j x. These coefficients are computable in polynomial time
when q is the order of a group of a family (computableInPolyTime_lagrangeWeightNat).
The efficiency clause of Lemma 22.1 of [BS23]: the coefficient
lagrangeWeightNat modulo the group order is computable in polynomial time from the group
description, the list of nodes, the node and the point, all computed from the input. No hypothesis
on the nodes is needed.
Interpolation in the exponent #
The combination ∑ λ_j • h_j of the group elements h_j of the pairs (j, h_j), with the
coefficients λ_j = lagrangeWeightNat of their nodes at the point x modulo the group order.
This is the book's ∏ (h^{ω(j)})^{λ_j} ([BS23], Corollary 22.2), written
additively.
Corollary 22.2 of [BS23] for the computed combination, written additively: from
the elements f(j) • h at nodes that are distinct modulo the group order, lagrangeCombine gives
f(x) • h, for a polynomial f of degree less than the number of nodes. Its encoding is
computable in polynomial time (computableInPolyTime_encode_lagrangeCombine).
The efficiency clause of Corollary 22.2 of [BS23]: the encoding of
lagrangeCombine is computable in polynomial time from the group description, the point and the
list of pairs (j, F.encode d h_j) of nodes and encoded group elements, all computed from the
input. The elements must be group elements: the input is their encodings, not arbitrary words.